feat(WIP): 내무부
This commit is contained in:
+1
-1
@@ -52,7 +52,7 @@ return [
|
||||
'hwe/b_betting.php',
|
||||
'hwe/v_chiefCenter.php',
|
||||
'hwe/b_currentCity.php',
|
||||
'hwe/b_dipcenter.php',
|
||||
'hwe/v_nationStratFinan.php',
|
||||
'hwe/b_diplomacy.php',
|
||||
'hwe/b_genList.php',
|
||||
'hwe/b_myBossInfo.php',
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<?=$btnBegin??''?><a href='b_troop.php' class='commandButton <?= ($meLevel >= 1 && $nationLevel >= 1) ? '' : 'disabled' ?> <?=$btnClass??""?>'>부대 편성</a><?=$btnEnd??''?>
|
||||
<?=$btnBegin??''?><a href='t_diplomacy.php' class='commandButton <?= $showSecret ? '' : 'disabled' ?> <?=$btnClass??""?>'>외 교 부</a><?=$btnEnd??''?>
|
||||
<?=$btnBegin??''?><a href='b_myBossInfo.php' class='commandButton <?= $meLevel >= 1 ? '' : 'disabled' ?> <?=$btnClass??""?>'>인 사 부</a><?=$btnEnd??''?>
|
||||
<?=$btnBegin??''?><a href='b_dipcenter.php' class='commandButton <?= $showSecret ? '' : 'disabled' ?> <?=$btnClass??""?>'>내 무 부</a><?=$btnEnd??''?>
|
||||
<?=$btnBegin??''?><a href='v_nationStratFinan.php' class='commandButton <?= $showSecret ? '' : 'disabled' ?> <?=$btnClass??""?>'>내 무 부</a><?=$btnEnd??''?>
|
||||
<?=$btnBegin??''?><a href='v_chiefCenter.php' class='commandButton <?= $showSecret ? '' : 'disabled' ?> <?=$btnClass??""?>'>사 령 부</a><?=$btnEnd??''?>
|
||||
<?=$btnBegin??''?><a href='v_NPCControl.php' class='commandButton <?= $showSecret ? '' : 'disabled' ?> <?=$btnClass??""?>'>NPC 정책</a><?=$btnEnd??''?>
|
||||
<?=$btnBegin??''?><a href='b_genList.php' target='_blank' class='open-window commandButton <?=$btnClass??""?> <?= $showSecret ? '' : 'disabled' ?>'>암 행 부</a><?=$btnEnd??''?>
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
<template>
|
||||
<div>위쪽버튼</div>
|
||||
<div>외교관계</div>
|
||||
|
||||
<div>국 가 방 침 & 임관 권유 메시지</div>
|
||||
<div id="noticeForm">
|
||||
<div class="bg1" style="display: flex; justify-content: space-around">
|
||||
@@ -24,9 +27,7 @@
|
||||
<div class="bg1" style="display: flex; justify-content: space-around">
|
||||
<div style="flex: 1 1 auto">임관 권유</div>
|
||||
<div>
|
||||
<b-button
|
||||
@click="enableEditScoutMsg"
|
||||
v-if="editable && !inEditScoutMsg"
|
||||
<b-button @click="enableEditScoutMsg" v-if="editable && !inEditScoutMsg"
|
||||
>임관 권유문 수정</b-button
|
||||
>
|
||||
<b-button @click="saveScoutMsg" v-if="editable && inEditScoutMsg"
|
||||
@@ -44,81 +45,140 @@
|
||||
<TipTap v-model="scoutMsg" :editable="inEditScoutMsg" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>예산&정책</div>
|
||||
<div>추가 설정</div>
|
||||
<div>돌아가기</div>
|
||||
</template>
|
||||
<script lang="ts">
|
||||
import "@scss/dipcenter.scss";
|
||||
import "@scss/common_legacy.scss";
|
||||
import "@scss/editor_component.scss";
|
||||
import TipTap from "./components/TipTap.vue";
|
||||
import { defineComponent } from "vue";
|
||||
import { defineComponent, reactive, ref, toRefs } from "vue";
|
||||
import { sammoAPI } from "./util/sammoAPI";
|
||||
import { isString } from "lodash";
|
||||
declare const editable: boolean;
|
||||
declare const nationMsg: string;
|
||||
declare const scoutMsg: string;
|
||||
import { diplomacyState, NationStaticItem } from "./defs";
|
||||
|
||||
type NationItem = NationStaticItem & {
|
||||
cityCnt: number;
|
||||
diplomacy: {
|
||||
state: diplomacyState;
|
||||
term: number | null;
|
||||
};
|
||||
};
|
||||
declare const staticValues: {
|
||||
editable: boolean;
|
||||
nationMsg: string;
|
||||
scoutMsg: string;
|
||||
nationID: number;
|
||||
officerLevel: number;
|
||||
year: number;
|
||||
month: number;
|
||||
nationsList: Record<number, NationItem>;
|
||||
|
||||
gold: number;
|
||||
rice: number;
|
||||
income: {
|
||||
gold: {
|
||||
city: number;
|
||||
war: number;
|
||||
};
|
||||
rice: {
|
||||
city: number;
|
||||
wall: number;
|
||||
};
|
||||
};
|
||||
|
||||
polcy: {
|
||||
rate: number;
|
||||
bill: number;
|
||||
secretLimit: number;
|
||||
blockScout: boolean;
|
||||
blockWar: boolean;
|
||||
};
|
||||
warSettingCnt: {
|
||||
remain: number;
|
||||
inc: number;
|
||||
max: number;
|
||||
};
|
||||
};
|
||||
|
||||
export default defineComponent({
|
||||
name: "PartialDipcenter",
|
||||
components: {
|
||||
TipTap,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
editable,
|
||||
oldNationMsg: nationMsg,
|
||||
oldScoutMsg: scoutMsg,
|
||||
nationMsg,
|
||||
scoutMsg,
|
||||
inEditNationMsg: false,
|
||||
inEditScoutMsg: false,
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
enableEditNationMsg() {
|
||||
this.inEditNationMsg = true;
|
||||
},
|
||||
rollbackNationMsg() {
|
||||
this.inEditNationMsg = false;
|
||||
this.nationMsg = this.oldNationMsg;
|
||||
},
|
||||
async saveNationMsg() {
|
||||
const msg = this.nationMsg;
|
||||
setup() {
|
||||
const self = reactive(staticValues);
|
||||
|
||||
let oldNationMsg = staticValues.nationMsg;
|
||||
const inEditNationMsg = ref(false);
|
||||
|
||||
function enableEditNationMsg() {
|
||||
inEditNationMsg.value = true;
|
||||
}
|
||||
|
||||
function rollbackNationMsg() {
|
||||
inEditNationMsg.value = false;
|
||||
self.nationMsg = oldNationMsg;
|
||||
}
|
||||
|
||||
async function saveNationMsg() {
|
||||
const msg = self.nationMsg;
|
||||
try {
|
||||
await sammoAPI("Nation/SetNotice", {
|
||||
msg,
|
||||
});
|
||||
this.oldNationMsg = msg;
|
||||
this.inEditNationMsg = false;
|
||||
oldNationMsg = msg;
|
||||
inEditNationMsg.value = false;
|
||||
} catch (e) {
|
||||
if (isString(e)) {
|
||||
alert(e);
|
||||
}
|
||||
console.error(e);
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
enableEditScoutMsg() {
|
||||
this.inEditScoutMsg = true;
|
||||
},
|
||||
rollbackScoutMsg() {
|
||||
this.inEditScoutMsg = false;
|
||||
this.scoutMsg = this.oldScoutMsg;
|
||||
},
|
||||
async saveScoutMsg() {
|
||||
const msg = this.scoutMsg;
|
||||
let oldScoutMsg = staticValues.scoutMsg;
|
||||
const inEditScoutMsg = ref(false);
|
||||
|
||||
function enableEditScoutMsg() {
|
||||
inEditScoutMsg.value = true;
|
||||
}
|
||||
function rollbackScoutMsg() {
|
||||
inEditScoutMsg.value = false;
|
||||
self.scoutMsg = oldScoutMsg;
|
||||
}
|
||||
async function saveScoutMsg() {
|
||||
const msg = self.scoutMsg;
|
||||
try {
|
||||
await sammoAPI("Nation/SetScoutMsg", {
|
||||
msg,
|
||||
});
|
||||
this.oldScoutMsg = msg;
|
||||
this.inEditScoutMsg = false;
|
||||
oldScoutMsg = msg;
|
||||
inEditScoutMsg.value = false;
|
||||
} catch (e) {
|
||||
if (isString(e)) {
|
||||
alert(e);
|
||||
}
|
||||
console.error(e);
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
|
||||
return {
|
||||
...toRefs(self),
|
||||
inEditNationMsg,
|
||||
inEditScoutMsg,
|
||||
enableEditNationMsg,
|
||||
rollbackNationMsg,
|
||||
saveNationMsg,
|
||||
enableEditScoutMsg,
|
||||
rollbackScoutMsg,
|
||||
saveScoutMsg,
|
||||
};
|
||||
},
|
||||
methods: {},
|
||||
});
|
||||
</script>
|
||||
@@ -26,7 +26,7 @@
|
||||
"v_NPCControl": "v_NPCControl.ts",
|
||||
"v_join": "v_join.ts",
|
||||
"v_main": "v_main.ts",
|
||||
"v_dipcenter": "v_dipcenter.ts",
|
||||
"v_nationStratFinan": "v_nationStratFinan.ts",
|
||||
"v_processing": "v_processing.ts"
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
import { createApp } from 'vue'
|
||||
import PartialDipcenter from '@/PartialDipcenter.vue';
|
||||
import BootstrapVue3 from 'bootstrap-vue-3';
|
||||
import { htmlReady } from './util/htmlReady';
|
||||
//import { activateFlip } from './legacy/activateFlip';
|
||||
//import { activateFlip } from "@/legacy/activateFlip";
|
||||
import { setAxiosXMLHttpRequest } from '@util/setAxiosXMLHttpRequest';
|
||||
//import { htmlReady } from './util/htmlReady';
|
||||
|
||||
createApp(PartialDipcenter).use(BootstrapVue3).mount('#editorForm');
|
||||
setAxiosXMLHttpRequest();
|
||||
|
||||
|
||||
htmlReady(function(){
|
||||
//activateFlip();
|
||||
})
|
||||
@@ -0,0 +1,10 @@
|
||||
import { createApp } from 'vue'
|
||||
import PageNationStratFinan from '@/PageNationStratFinan.vue';
|
||||
import BootstrapVue3 from 'bootstrap-vue-3';
|
||||
import { auto500px } from './util/auto500px';
|
||||
|
||||
|
||||
|
||||
|
||||
auto500px();
|
||||
createApp(PageNationStratFinan).use(BootstrapVue3).mount('#container');
|
||||
@@ -0,0 +1,163 @@
|
||||
<?php
|
||||
|
||||
namespace sammo;
|
||||
|
||||
include "lib.php";
|
||||
include "func.php";
|
||||
//로그인 검사
|
||||
$session = Session::requireGameLogin()->setReadOnly();
|
||||
$userID = Session::getUserID();
|
||||
|
||||
$db = DB::db();
|
||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||
|
||||
increaseRefresh("내무부", 1);
|
||||
|
||||
$me = $db->queryFirstRow('SELECT no, nation, officer_level, con, turntime, belong, permission, penalty FROM general WHERE owner=%i', $userID);
|
||||
|
||||
$con = checkLimit($me['con']);
|
||||
if ($con >= 2) {
|
||||
printLimitMsg($me['turntime']);
|
||||
exit();
|
||||
}
|
||||
|
||||
$permission = checkSecretPermission($me);
|
||||
if ($permission < 0) {
|
||||
echo '국가에 소속되어있지 않습니다.';
|
||||
die();
|
||||
} else if ($permission < 1) {
|
||||
echo "권한이 부족합니다. 수뇌부가 아니거나 사관년도가 부족합니다.";
|
||||
die();
|
||||
}
|
||||
|
||||
|
||||
$nationID = $me['nation'];
|
||||
$nation = $db->queryFirstRow('SELECT nation,level,name,color,type,gold,rice,bill,rate,scout,war,secretlimit,capital FROM nation WHERE nation = %i', $nationID);
|
||||
|
||||
$nationStor = KVStorage::getStorage($db, $nationID, 'nation_env');
|
||||
|
||||
[$year, $month] = $gameStor->getValuesAsArray(['year', 'month']);
|
||||
$nationStor->cacheValues(['notice', 'scout_msg', 'available_war_setting_cnt']);
|
||||
|
||||
$cityCntList = Util::convertPairArrayToDict($db->queryAllLists('SELECT nation, count(city) FROM city GROUP BY nation'));
|
||||
$dipStateList = Util::convertArrayToDict($db->query('SELECT you,state,term FROM diplomacy WHERE me = %i', $nationID), 'you');
|
||||
|
||||
$nationsList = getAllNationStaticInfo();
|
||||
|
||||
$cityList = $db->query('SELECT * FROM city WHERE nation=%i', $nationID);
|
||||
$dedicationList = $db->query('SELECT dedication FROM general WHERE nation=%i AND npc!=5', $nationID);
|
||||
|
||||
|
||||
foreach ($nationsList as &$nationItem) {
|
||||
|
||||
$staticNationID = $nationItem['nation'];
|
||||
//속령수
|
||||
$nationItem['cityCnt'] = $cityCntList[$staticNationID] ?? 0;
|
||||
if ($staticNationID !== $nationID) {
|
||||
$diplomacyItem = $dipStateList[$staticNationID];
|
||||
|
||||
$nationItem['diplomacy'] = [
|
||||
'state' => $diplomacyItem['state'],
|
||||
'term' => $diplomacyItem['term'],
|
||||
];
|
||||
} else {
|
||||
$nationItem['diplomacy'] = [
|
||||
'state' => 7,
|
||||
'term' => null,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 수입 연산
|
||||
$goldIncome = getGoldIncome(
|
||||
$nation['nation'],
|
||||
$nation['level'],
|
||||
$nation['rate'],
|
||||
$nation['capital'],
|
||||
$nation['type'],
|
||||
$cityList
|
||||
);
|
||||
$warIncome = getWarGoldIncome($nation['type'], $cityList);
|
||||
|
||||
$riceIncome = getRiceIncome(
|
||||
$nation['nation'],
|
||||
$nation['level'],
|
||||
$nation['rate'],
|
||||
$nation['capital'],
|
||||
$nation['type'],
|
||||
$cityList
|
||||
);
|
||||
$wallIncome = getWallIncome(
|
||||
$nation['nation'],
|
||||
$nation['level'],
|
||||
$nation['rate'],
|
||||
$nation['capital'],
|
||||
$nation['type'],
|
||||
$cityList
|
||||
);
|
||||
|
||||
$incomes = [
|
||||
'gold' => [
|
||||
'city' => $goldIncome,
|
||||
'war' => $warIncome,
|
||||
],
|
||||
'rice' => [
|
||||
'city' => $riceIncome,
|
||||
'wall' => $wallIncome,
|
||||
],
|
||||
];
|
||||
|
||||
$outcome = getOutcome(100, $dedicationList);
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=500" />
|
||||
<title><?= UniqueConst::$serverName ?>: 내무부</title>
|
||||
<?= WebUtil::printStaticValues([
|
||||
'staticValues' => [
|
||||
'editable' => ($me['officer_level'] >= 5 || $permission == 4),
|
||||
'nationMsg' => $nationStor->notice ?? '',
|
||||
'scoutMsg' => $nationStor->scout_msg ?? '',
|
||||
'nationID' => $nationID,
|
||||
'officerLevel' => $me['officer_level'],
|
||||
'year' => $year,
|
||||
'month' => $month,
|
||||
'nationsList' => $nationsList,
|
||||
|
||||
'gold' => $nation['gold'],
|
||||
'rice' => $nation['rice'],
|
||||
'income' => $incomeList,
|
||||
'outcome' => $outcome,
|
||||
|
||||
'policy' => [
|
||||
'rate' => $nation['rate'],
|
||||
'bill' => $nation['bill'],
|
||||
'secretLimit' => $nation['secretlimit'],
|
||||
'blockScout' => $nation['scout']!=0,
|
||||
'blockWar' => $nation['war']!=0,
|
||||
],
|
||||
'warSettingCnt' => [
|
||||
'remain' => $nationStor->getValue('available_war_setting_cnt'),
|
||||
'inc' => GameConst::$incAvailableWarSettingCnt,
|
||||
'max' => GameConst::$maxAvailableWarSettingCnt
|
||||
],
|
||||
]
|
||||
]) ?>
|
||||
<?= WebUtil::printJS('../d_shared/common_path.js') ?>
|
||||
<?= WebUtil::printCSS('../d_shared/common.css') ?>
|
||||
<link rel="stylesheet" type="text/css"
|
||||
href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css" />
|
||||
<?= WebUtil::printDist('vue', 'v_nationStratFinan', true) ?>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="container"></div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
Reference in New Issue
Block a user