diff --git a/hwe/b_npc_control.php b/hwe/b_npc_control.php deleted file mode 100644 index 421cfb71..00000000 --- a/hwe/b_npc_control.php +++ /dev/null @@ -1,421 +0,0 @@ -setReadOnly(); -$userID = Session::getUserID(); - -$db = DB::db(); -$gameStor = KVStorage::getStorage($db, 'game_env'); -$gameStor->cacheValues(['autorun_user', 'develcost']); - -increaseRefresh("NPC 정책", 1); - - -$me = $db->queryFirstRow('SELECT no, npc, nation, city, officer_level, con, turntime, belong, permission, penalty FROM general WHERE owner=%i', $userID); - -$nationID = $me['nation']; -$nation = $db->queryFirstRow('SELECT nation,level,name,color,type,gold,rice,bill,tech,rate,scout,war,secretlimit,capital FROM nation WHERE nation = %i', $nationID); - -$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(); -} - - -$nationStor = KVStorage::getStorage($db, $nationID, 'nation_env'); -$nationStor->cacheValues(['npc_nation_policy', 'npc_general_policy']); -$gameStor->cacheAll(); - -$general = new General($me, null, null, $nation, $gameStor->year, $gameStor->month, false); - -$rawServerPolicy = $gameStor->getValue('npc_nation_policy') ?? []; -$rawNationPolicy = $nationStor->getValue('npc_nation_policy') ?? []; -$rawServerGeneralPolicy = $gameStor->getValue('npc_general_policy') ?? []; -$rawNationGeneralPolicy = $nationStor->getValue('npc_general_policy') ?? []; - -$defaultNationPolicy = ($rawServerPolicy['values'] ?? []) + AutorunNationPolicy::$defaultPolicy; -$currentNationPolicy = ($rawNationPolicy['values'] ?? []) + $defaultNationPolicy; - -$defaultNationPriority = $rawServerPolicy['priority'] ?? (AutorunNationPolicy::$defaultPriority); -$currentNationPriority = $rawNationPolicy['priority'] ?? $defaultNationPriority; - -$defaultGeneralActionPriority = $rawServerGeneralPolicy['priority'] ?? (AutorunGeneralPolicy::$default_priority); -$currentGeneralActionPriority = $rawNationGeneralPolicy['priority'] ?? $defaultGeneralActionPriority; - -$autoPolicyVariable = []; -if ($currentNationPolicy['reqHumanWarUrgentRice'] ?? 0) { - $autoPolicyVariable['reqHumanWarUrgentRice'] = $currentNationPolicy['reqHumanWarUrgentRice']; -} -if ($currentNationPolicy['reqHumanWarUrgentGold'] ?? 0) { - $autoPolicyVariable['reqHumanWarUrgentGold'] = $currentNationPolicy['reqHumanWarUrgentGold']; -} -$autoPolicy = new AutorunNationPolicy($general, ($gameStor->autorun_user)['options'], ['values' => $autoPolicyVariable], null, $nation, $gameStor->getAll(true)); -$zeroPolicy = new AutorunNationPolicy($general, ($gameStor->autorun_user)['options'], null, null, $nation, $gameStor->getAll(true)); - - -?> - - - - - - - - <?= UniqueConst::$serverName ?>: 임시 NPC 정책 - - - - - - - - - - - - - - - - - - - -
-
임시 NPC 정책
-
- -
국가 정책
-
- 최근 설정: () -
-
-
-
-
- -
- -
-
-
이보다 많으면 포상, 적으면 몰수/헌납합니다.(긴급포상 제외)
-
- -
-
- -
- -
-
-
이보다 많으면 포상, 적으면 몰수/헌납합니다.(긴급포상 제외)
-
-
-
-
-
- -
- -
-
-
- 유저장긴급포상시 이보다 금이 적은 장수에게 포상합니다.
- 0이면 보병 6회 징병( * 6) 가능한 금을 기준으로 하며, 그 수치는 현재 reqHumanWarUrgentGold) ?>입니다.
-
-
-
- -
- -
-
-
유저장긴급포상시 이보다 쌀이 적은 장수에게 포상합니다.
0이면 기본 병종으로 명 사살 가능한 쌀을 기준으로 하며, 그 수치는 현재 reqHumanWarUrgentRice) ?>입니다.
-
-
-
-
-
- -
- -
-
-
유저전투장에게 주는 금입니다. 이보다 적으면 포상합니다.
- 0이면 유저전투장 긴급포상 금의 2배를 기준으로 하며, 그 수치는 현재 reqHumanWarRecommandGold) ?>입니다.
-
-
-
- -
- -
-
-
유저전투장에게 주는 쌀입니다. 이보다 적으면 포상합니다.
- 0이면 유저전투장 긴급포상 쌀의 2배를 기준으로 하며, 그 수치는 현재 reqHumanWarRecommandRice) ?>입니다.
-
-
-
-
-
- -
- -
-
-
유저내정장에게 주는 금입니다. 이보다 적으면 포상합니다.
-
-
-
- -
- -
-
-
유저내정장에게 주는 쌀입니다. 이보다 적으면 포상합니다.
-
-
-
-
-
- -
- -
-
-
NPC전투장에게 주는 금입니다. 이보다 적으면 포상합니다.
- 0이면 기본 병종 4회( * 4) 징병비를 기준으로 하며, 그 수치는 현재 reqNPCWarGold) ?>입니다.
-
-
-
- -
- -
-
-
NPC전투장에게 주는 쌀입니다. 이보다 적으면 포상합니다.
- 0이면 기본 병종으로 명 사살 가능한 쌀을 기준으로 하며, 그 수치는 현재 reqNPCWarRice) ?>입니다.
-
-
-
-
-
- -
- -
-
-
NPC내정장에게 주는 금입니다. 이보다 5배 더 많다면 헌납합니다.
0이면 30턴 내정 가능한 금을 기준으로 하며, 그 수치는 현재 reqNPCDevelGold) ?>입니다.
-
-
-
- -
- -
-
-
NPC내정장에게 주는 쌀입니다. 이보다 5배 더 많다면 헌납합니다.
-
-
-
-
-
- -
- -
-
-
연산결과가 이 단위보다 적다면 수행하지 않습니다.
-
-
-
- -
- -
-
-
이보다 적을 때에는 징병을 시도합니다.
-
-
-
-
-
- -
- -
-
-
이보다 낮으면 NPC는 도시에서 징병하지 않고 후방 워프합니다.
-
-
-
- -
- -
-
-
전쟁 시 후방 발령, 후방 워프의 기준 인구입니다. 이보다 많다면 '충분하다'고 판단합니다.
-
-
-
-
-
- -
- -
-
-
이 수치보다 같거나 높으면 NPC전투장으로 분류됩니다.
-
-
-
- -
- -
-
-
훈련/사기진작 기준치입니다. 이보다 같거나 높으면 출병합니다.
-
-
-
- 전투 부대는 작업중입니다(json양식: {부대번호:[시작도시번호(아국),도착도시번호(적군)],...})
- 후방 징병 부대는 작업중입니다(json양식: [부대번호,...])
- 내정 부대는 작업중입니다(json양식: [부대번호,...]) - - - - - -
-
-
- - -
-
-
-
-
-
NPC 사령턴 우선순위
-
- 최근 설정: () -
-
예턴이 없거나, 지정되어 있더라도 실패할경우
아래 순위에 따라 사령턴을 시도합니다.
-
-
-
-
비활성
-
-
-
-
-
활성
-
-
-
-
-
-
- - -
-
-
-
-
-
NPC 일반턴 우선순위
-
- 최근 설정: () -
-
순위가 높은 것부터 시도합니다.
아무것도 실행할 수 없으면 물자조달이나 인재탐색을 합니다.
-
-
-
-
비활성
-
-
-
-
-
활성
-
-
-
-
-
-
- - -
-
-
-
-
-
- - - \ No newline at end of file diff --git a/hwe/css/npc_control.css b/hwe/css/npc_control.css deleted file mode 100644 index d4a124b7..00000000 --- a/hwe/css/npc_control.css +++ /dev/null @@ -1,49 +0,0 @@ -.section_bar{ - text-align:center; - border:0.5px solid #aaa; - padding-right:0; - padding-left:0; -} - -.sub_bar{ - text-align:center; - border:0.5px solid #aaa; - margin-left:-5px; - margin-right:-5px; -} - -.reset_btn{ - width:15ch; -} - -.submit_btn{ - margin-left:1em; - width:15ch; -} - -.control_bar{ - margin-top:8pt; - text-align:right; -} - -.col-form-label{ - text-align:right; - padding-right:2ch; -} - -.form_list{ - padding:8pt; -} - -.half_section_left{ - padding-right:0; - border-right:0.5px solid #aaa; -} -.half_section_right{ - padding-left:0; - -} - -.popover{ - max-width:100%; -} \ No newline at end of file diff --git a/hwe/js/npc_control.js b/hwe/js/npc_control.js deleted file mode 100644 index 0a2cebf6..00000000 --- a/hwe/js/npc_control.js +++ /dev/null @@ -1,289 +0,0 @@ -jQuery(function ($) { - - var itemFrame = - '
' - + '  ' - + '{0}' - + '' + - '
'; - var itemFrameDisabled = - '
' - + '{0}' + - '
'; - - - function initPriority(priorityKey, currentPriority, availablePriority) { - var $disabledList = $('#{0}Disabled'.format(priorityKey)); - var $enabledList = $('#{0}'.format(priorityKey)); - - $disabledList.empty(); - $enabledList.empty(); - - var usedKey = {}; - var items = []; - $.each(currentPriority, function (key, val) { - var $item = $(itemFrame.format(val)); - usedKey[val] = true; - $enabledList.append($item); - items.push($item); - }) - - var $disabled = $(itemFrameDisabled.format('<비활성화 항목들>')).addClass('filtered'); - $disabledList.append($disabled); - - var lastInfoObj = null; - var lastInfoData = null; - - var onChoose = function(evt){ - //$(evt.item).find('.help-message').popopver('disable'); - if(lastInfoObj){ - lastInfoObj.popover('hide'); - } - } - - var onUnchoose = function(evt){ - var $item = $(evt.item);//.find('.help-message').popopver('enable'); - var $helpMessage = $item.find('.help-message'); - if(!$helpMessage.length){ - return; - } - if(lastInfoData != $item.data('value')){ - $helpMessage.popover('show') - lastInfoData = $item.data('value'); - lastInfoObj = $helpMessage; - } - else{ - $helpMessage.popover('hide'); - lastInfoData = null; - lastInfoObj = null; - } - - } - - $.each(availablePriority, function (key, val) { - if (val in usedKey) { - return true; - } - var $item = $(itemFrame.format(val)); - $disabledList.append($item); - items.push($item); - }) - - $disabledList.sortable({ - group: priorityKey, - filter: '.filtered', - onChoose,onChoose, - onUnchoose:onUnchoose, - animation: 150 - }); - - $enabledList.sortable({ - group: priorityKey, - filter: '.filtered', - onChoose,onChoose, - onUnchoose:onUnchoose, - animation: 150 - }); - - $.each(items, function(key, $item){ - var itemValue = $item.data('value'); - if(!(itemValue in btnHelpMessage)){ - return true; - } - - var helpText = btnHelpMessage[itemValue]; - var $helpMessage = $item.find('.help-message'); - $helpMessage.popover({ - content:helpText, - placement:'top', - html:true, - trigger:'hover' - }); - $item.mouseleave(function(){ - $helpMessage.popover('hide'); - }); - }); - } - - - - function initNationPolicy() { - $.each(currentNationPolicy, function (key, val) { - var $obj = $('#{0}'.format(key)); - - if (!$obj.length) { - console.log('{0}가 없대!'.format(key)); - return true; - } - - var type = $obj.data('type'); - if (!$obj.is('input')) { - console.log('아니라고?'); - return true; - } - - if (type == 'percent') { - $obj.val(val * 100); - } - else if (type == 'json') { - $obj.val(JSON.stringify(val)); - } - else { - $obj.val(val); - } - }); - } - - - initPriority('generalPriority', currentGeneralActionPriority, availableGeneralActionPriorityItems); - initPriority('nationPriority', currentNationPriority, availableNationPriorityItems); - initNationPolicy(); - - - $('.reset_btn').click(function () { - var $this = $(this); - - if (!confirm('서버 초기 설정으로 되돌릴까요?')) { - return false; - } - - var type = $this.parents('.control_bar').data('type'); - if (type === 'nationPolicy') { - window.currentNationPolicy = window.defaultNationPolicy; - initNationPolicy(); - } - else if (type === 'generalPriority') { - window.currentGeneralActionPriority = window.defaultGeneralActionPriority; - initPriority('generalPriority', currentGeneralActionPriority, availableGeneralActionPriorityItems); - } - else if (type === 'nationPriority') { - window.currentNationPriority = window.defaultNationPriority; - initPriority('nationPriority', currentNationPriority, availableNationPriorityItems); - } - - $.toast({ - title: '초기화 완료', - content: '서버 초기값을 적용했습니다. 설정 버튼을 누르면 반영됩니다.', - type: 'info', - delay: 5000 - }); - return false; - }); - - $('.revert_btn').click(function () { - var $this = $(this); - - if (!confirm('이전 설정으로 되돌릴까요?')) { - return false; - } - - var type = $this.parents('.control_bar').data('type'); - if (type === 'nationPolicy') { - initNationPolicy(); - } - - if (type === 'generalPriority') { - initPriority('generalPriority', currentGeneralActionPriority, availableGeneralActionPriorityItems); - } - - if (type === 'nationPriority') { - initPriority('nationPriority', currentNationPriority, availableNationPriorityItems); - } - - $.toast({ - title: '되돌리기 완료', - content: '이전 설정으로 되돌렸습니다.', - type: 'info', - delay: 5000 - }); - }); - - var collectPriority = function (priorityKey) { - var $list = $('#{0}'.format(priorityKey)); - var result = []; - $list.find('.list-group-item').each(function () { - var $item = $(this); - result.push($item.data('value')); - }); - return result; - } - - var collectNationPolicy = function () { - var src = window.currentNationPolicy; - var result = {}; - $.each(src, function (key, val) { - var $item = $('#{0}'.format(key)); - var val = $item.val(); - var dataType = $item.data('type'); - if (dataType === 'percent') { - val /= 100; - } - else if (dataType === 'json') { - val = JSON.parse(val); - } - else if (dataType === 'integer') { - val = parseInt(val); - } - result[key] = val; - }); - return result; - } - window.collectNationPolicy = collectNationPolicy; - - $('.submit_btn').click(function () { - var $this = $(this); - if (!confirm('저장할까요?')) { - return false; - } - - var type = $this.parents('.control_bar').data('type'); - var data; - if (type === 'nationPolicy') { - data = collectNationPolicy(); - } - else if (type === 'nationPriority') { - data = collectPriority(type); - } - else if (type === 'generalPriority') { - data = collectPriority(type); - } - else { - alert('올바르지 않은 type : {0}'.type); - return false; - } - console.log(data); - - $.post({ - url: 'j_set_npc_control.php', - dataType: 'json', - data: { - type: type, - data: JSON.stringify(data) - } - }).then(function (data) { - if (!data) { - return quickReject('설정하지 못했습니다.'); - } - if (!data.result) { - return quickReject('설정하지 못했습니다. : ' + data.reason); - } - $.toast({ - title: '적용 완료', - content: 'NPC 정책이 반영되었습니다.', - type: 'success', - delay: 5000 - }); - }, errUnknownToast) - .fail(function (reason) { - $.toast({ - title: '에러!', - content: reason, - type: 'danger', - delay: 5000 - }); - }); - }) - -}); \ No newline at end of file