forked from devsam/core
npc_control form
This commit is contained in:
Vendored
+2
File diff suppressed because one or more lines are too long
Vendored
+76
@@ -0,0 +1,76 @@
|
||||
(function (factory) {
|
||||
"use strict";
|
||||
var sortable,
|
||||
jq,
|
||||
_this = this
|
||||
;
|
||||
|
||||
if (typeof define === "function" && define.amd) {
|
||||
try {
|
||||
define(["sortablejs", "jquery"], function(Sortable, $) {
|
||||
sortable = Sortable;
|
||||
jq = $;
|
||||
checkErrors();
|
||||
factory(Sortable, $);
|
||||
});
|
||||
} catch(err) {
|
||||
checkErrors();
|
||||
}
|
||||
return;
|
||||
} else if (typeof exports === 'object') {
|
||||
try {
|
||||
sortable = require('sortablejs');
|
||||
jq = require('jquery');
|
||||
} catch(err) { }
|
||||
}
|
||||
|
||||
if (typeof jQuery === 'function' || typeof $ === 'function') {
|
||||
jq = jQuery || $;
|
||||
}
|
||||
|
||||
if (typeof Sortable !== 'undefined') {
|
||||
sortable = Sortable;
|
||||
}
|
||||
|
||||
function checkErrors() {
|
||||
if (!jq) {
|
||||
throw new Error('jQuery is required for jquery-sortablejs');
|
||||
}
|
||||
|
||||
if (!sortable) {
|
||||
throw new Error('SortableJS is required for jquery-sortablejs (https://github.com/SortableJS/Sortable)');
|
||||
}
|
||||
}
|
||||
checkErrors();
|
||||
factory(sortable, jq);
|
||||
})(function (Sortable, $) {
|
||||
"use strict";
|
||||
|
||||
$.fn.sortable = function (options) {
|
||||
var retVal,
|
||||
args = arguments;
|
||||
|
||||
this.each(function () {
|
||||
var $el = $(this),
|
||||
sortable = $el.data('sortable');
|
||||
|
||||
if (!sortable && (options instanceof Object || !options)) {
|
||||
sortable = new Sortable(this, options);
|
||||
$el.data('sortable', sortable);
|
||||
} else if (sortable) {
|
||||
if (options === 'destroy') {
|
||||
sortable.destroy();
|
||||
$el.removeData('sortable');
|
||||
} else if (options === 'widget') {
|
||||
retVal = sortable;
|
||||
} else if (typeof sortable[options] === 'function') {
|
||||
retVal = sortable[options].apply(sortable, [].slice.call(args, 1));
|
||||
} else if (options in sortable.options) {
|
||||
retVal = sortable.option.apply(sortable, args);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return (retVal === void 0) ? this : retVal;
|
||||
};
|
||||
});
|
||||
@@ -0,0 +1,271 @@
|
||||
<?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("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,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;
|
||||
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=1024" />
|
||||
<title><?= UniqueConst::$serverName ?>: 임시 NPC 정책</title>
|
||||
<script>
|
||||
var nationID = <?= $nationID ?>;
|
||||
|
||||
var defaultNationPolicy = <?= Json::encode($defaultNationPolicy) ?>;
|
||||
var currentNationPolicy = <?= Json::encode($currentNationPolicy) ?>;
|
||||
|
||||
var defaultNationPriority = <?= Json::encode($defaultNationPriority) ?>;
|
||||
var currentNationPriority = <?= Json::encode($currentNationPriority) ?>;
|
||||
var availableNationPriorityItems = <?= Json::encode(AutorunNationPolicy::$defaultPriority) ?>;
|
||||
|
||||
var defaultGeneralActionPriority = <?= Json::encode($defaultGeneralActionPriority) ?>;
|
||||
/*var currentGeneralActionPriority = <?= Json::encode($currentGeneralActionPriority) ?>;*/
|
||||
var currentGeneralActionPriority = ["NPC사망대비", "귀환", "금쌀구매", "출병", "긴급내정", "전투준비", "전방워프", "NPC헌납", "징병", "후방워프", "전쟁내정", "소집해제", "내정워프"];
|
||||
var availableGeneralActionPriorityItems = <?= Json::encode(AutorunGeneralPolicy::$default_priority) ?>;
|
||||
</script>
|
||||
<?= WebUtil::printJS('../e_lib/jquery-3.3.1.min.js') ?>
|
||||
<?= WebUtil::printJS('../e_lib/Sortable.min.js') ?>
|
||||
<?= WebUtil::printJS('../e_lib/jquery-sortable.js') ?>
|
||||
<?= WebUtil::printJS('../e_lib/bootstrap.bundle.min.js') ?>
|
||||
<?= WebUtil::printJS('../d_shared/common_path.js') ?>
|
||||
<?= WebUtil::printJS('js/common.js') ?>
|
||||
<?= WebUtil::printJS('js/npc_control.js') ?>
|
||||
|
||||
<?= WebUtil::printCSS('../e_lib/bootstrap.min.css') ?>
|
||||
<?= WebUtil::printCSS('../e_lib/summernote/summernote-bs4.css') ?>
|
||||
<?= WebUtil::printCSS('../d_shared/common.css') ?>
|
||||
<?= WebUtil::printCSS('css/common.css') ?>
|
||||
<?= WebUtil::printCSS('css/npc_control.css') ?>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id='container' class='tb_layout bg0' style='width:1000px;margin:auto;border:solid 1px #888888;'>
|
||||
<div class='tb_layout bg0'>임시 NPC 정책<br>
|
||||
<?= backButton() ?></div>
|
||||
|
||||
<div class='bg1 section_bar'>국가 정책</div>
|
||||
<div class="form_list">
|
||||
<div class="form-group row">
|
||||
<div class="col-sm-6">
|
||||
<div class="row">
|
||||
<label for="reqNationGold" class="col-sm-6 col-form-label">국가 권장 금</label>
|
||||
<div class="col-sm-6">
|
||||
<input type="number" class="form-control" id="reqNationGold" min="0" value="0">
|
||||
</div>
|
||||
</div>
|
||||
<div style='text-align:right;'><small class="form-text text-muted">이 보다 많으면 포상, 적으면 몰수합니다.(긴급포상 제외)</small></div>
|
||||
</div>
|
||||
|
||||
<label for="reqNationRice" class="col-sm-3 col-form-label">국가 권장 쌀</label>
|
||||
<div class="col-sm-3">
|
||||
<input type="number" class="form-control" id="reqNationRice" min="0" value="0">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="reqHumanWarUrgentGold" class="col-sm-3 col-form-label">전투유저장 긴급포상 금</label>
|
||||
<div class="col-sm-3">
|
||||
<input type="number" class="form-control" id="reqHumanWarUrgentGold" min="0" value="0">
|
||||
</div>
|
||||
<label for="reqHumanWarUrgentRice" class="col-sm-3 col-form-label">전투유저장 긴급포상 쌀</label>
|
||||
<div class="col-sm-3">
|
||||
<input type="number" class="form-control" id="reqHumanWarUrgentRice" min="0" value="0">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="reqHumanWarRecommandGold" class="col-sm-3 col-form-label">전투유저장 권장 금</label>
|
||||
<div class="col-sm-3">
|
||||
<input type="number" class="form-control" id="reqHumanWarRecommandGold" min="0" value="0">
|
||||
</div>
|
||||
<label for="reqHumanWarRecommandRice" class="col-sm-3 col-form-label">전투유저장 권장 쌀</label>
|
||||
<div class="col-sm-3">
|
||||
<input type="number" class="form-control" id="reqHumanWarRecommandRice" min="0" value="0">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="reqHumanDevelGold" class="col-sm-3 col-form-label">내정유저장 권장 금</label>
|
||||
<div class="col-sm-3">
|
||||
<input type="number" class="form-control" id="reqHumanDevelGold" min="0" value="0">
|
||||
</div>
|
||||
<label for="reqHumanDevelRice" class="col-sm-3 col-form-label">내정유저장 권장 쌀</label>
|
||||
<div class="col-sm-3">
|
||||
<input type="number" class="form-control" id="reqHumanDevelRice" min="0" value="0">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="reqNPCWarGold" class="col-sm-3 col-form-label">전투NPC 권장 금</label>
|
||||
<div class="col-sm-3">
|
||||
<input type="number" class="form-control" id="reqNPCWarGold" min="0" value="0">
|
||||
</div>
|
||||
<label for="reqNPCWarRice" class="col-sm-3 col-form-label">전투NPC 권장 쌀</label>
|
||||
<div class="col-sm-3">
|
||||
<input type="number" class="form-control" id="reqNPCWarRice" min="0" value="0">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="reqNPCDevelGold" class="col-sm-3 col-form-label">내정NPC 권장 금</label>
|
||||
<div class="col-sm-3">
|
||||
<input type="number" class="form-control" id="reqNPCDevelGold" min="0" value="0">
|
||||
</div>
|
||||
<label for="reqNPCDevelRice" class="col-sm-3 col-form-label">내정NPC 권장 쌀</label>
|
||||
<div class="col-sm-3">
|
||||
<input type="number" class="form-control" id="reqNPCDevelRice" min="0" value="0">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="minimumResourceActionAmount" class="col-sm-3 col-form-label">포상/몰수/헌납/삼/팜 최소 단위</label>
|
||||
<div class="col-sm-3">
|
||||
<input type="number" class="form-control" id="minimumResourceActionAmount" min="0" value="0">
|
||||
</div>
|
||||
<label for="minWarCrew" class="col-sm-3 col-form-label">최소 전투 가능 병력 수</label>
|
||||
<div class="col-sm-3">
|
||||
<input type="number" class="form-control" id="minWarCrew" min="0" value="0">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="minNPCRecruitCityPopulation" class="col-sm-3 col-form-label">NPC 최소 징병 가능 인구 수</label>
|
||||
<div class="col-sm-3">
|
||||
<input type="number" class="form-control" id="minNPCRecruitCityPopulation" min="0" value="0">
|
||||
</div>
|
||||
<label for="safeRecruitCityPopulationRatio" class="col-sm-3 col-form-label">제자리 징병 허용 인구율(%)</label>
|
||||
<div class="col-sm-3">
|
||||
<input type="number" class="form-control" data-type="percent" id="safeRecruitCityPopulationRatio" min="0" max="100" value="0">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="minNPCWarLeadership" class="col-sm-3 col-form-label">NPC 전투 참여 통솔 기준</label>
|
||||
<div class="col-sm-3">
|
||||
<input type="number" class="form-control" id="minNPCWarLeadership" min="0" value="0">
|
||||
</div>
|
||||
<label for="properWarTrainAtmos" class="col-sm-3 col-form-label">훈련/사기진작 목표치</label>
|
||||
<div class="col-sm-3">
|
||||
<input type="number" class="form-control" id="properWarTrainAtmos" min="0" max="100" value="0">
|
||||
</div>
|
||||
</div>
|
||||
<div class="alert alert-secondary">
|
||||
전투 부대는 작업중입니다(json양식: {부대번호:[시작도시번호(아국),도착도시번호(적군)],...})<br>
|
||||
후방 징병 부대는 작업중입니다(json양식: [부대번호,...])<br>
|
||||
내정 부대는 작업중입니다(json양식: [부대번호,...])
|
||||
<input type="hidden" value="{}" id="CombatForce">
|
||||
<input type="hidden" value="[]" id="SupportForce">
|
||||
<input type="hidden" value="[]" id="DevelopForce">
|
||||
<input type="hidden" value="true" id="allowNpcAttackCity">
|
||||
</div>
|
||||
<div class='control_bar'>
|
||||
<button type="button" class="btn btn-dark reset_btn" data-type="nation_policy">초기값으로</button><button type="button" class="btn btn-primary submit_btn" data-type="nation_policy">설정</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-sm-6 half_section_left">
|
||||
<div class='bg1 section_bar'>NPC 사령턴 우선순위</div>
|
||||
<div class="form_list">
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<div class="bg2 sub_bar">비활성</div>
|
||||
<div id="nationPriorityDisabled" class="list-group col" data-type="list">
|
||||
<div class="list-group-item">비활성화1</div>
|
||||
<div class="list-group-item">비활성화2</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<div class="bg2 sub_bar">활성</div>
|
||||
<div id="nationPriority" class="list-group col" data-type="list">
|
||||
<div class="list-group-item">활성화1</div>
|
||||
<div class="list-group-item">활성화2</div>
|
||||
<div class="list-group-item">활성화3</div>
|
||||
<div class="list-group-item">활성화4</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class='control_bar'>
|
||||
<button type="button" class="btn btn-dark reset_btn" data-type="nation_priority">초기값으로</button><button type="button" class="btn btn-primary submit_btn" data-type="nation_priority">설정</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-6 half_section_right">
|
||||
<div class='bg1 section_bar'>NPC 일반턴 우선순위</div>
|
||||
<div class="form_list">
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<div class="bg2 sub_bar">비활성</div>
|
||||
<div id="generalPriorityDisabled" class="list-group col" data-type="list">
|
||||
<div class="list-group-item">비활성화1</div>
|
||||
<div class="list-group-item">비활성화2</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<div class="bg2 sub_bar">활성</div>
|
||||
<div id="generalPriority" class="list-group col" data-type="list">
|
||||
<div class="list-group-item">활성화1</div>
|
||||
<div class="list-group-item">활성화2</div>
|
||||
<div class="list-group-item">활성화3</div>
|
||||
<div class="list-group-item">활성화4</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class='control_bar'>
|
||||
<button type="button" class="btn btn-dark reset_btn" data-type="general_priority">초기값으로</button><button type="button" class="btn btn-primary submit_btn" data-type="general_priority">설정</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
+1
-1
@@ -31,7 +31,7 @@ color:white;
|
||||
|
||||
.commandButton {
|
||||
float:left;
|
||||
width:111px;
|
||||
width:100px;
|
||||
height:30px;
|
||||
font-weight:bold;
|
||||
font-size:13px;
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
.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;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
jQuery(function($){
|
||||
|
||||
function initPriority(priorityKey, currentPriority, availablePriority){
|
||||
var $disabledList = $('#{0}Disabled'.format(priorityKey));
|
||||
var $enabledList = $('#{0}'.format(priorityKey));
|
||||
|
||||
$disabledList.empty();
|
||||
$enabledList.empty();
|
||||
|
||||
var usedKey = {};
|
||||
var itemFrame = '<div class="list-group-item" data-value="{0}">{0}</div>';
|
||||
$.each(currentPriority, function(key, val){
|
||||
var $item = $(itemFrame.format(val));
|
||||
usedKey[val] = true;
|
||||
$enabledList.append($item);
|
||||
})
|
||||
|
||||
var $disabled = $(itemFrame.format('<비활성화 항목들>')).addClass('filtered');
|
||||
$disabledList.append($disabled);
|
||||
|
||||
$.each(availablePriority, function(key, val){
|
||||
if(val in usedKey){
|
||||
return true;
|
||||
}
|
||||
var $item = $(itemFrame.format(val));
|
||||
$disabledList.append($item);
|
||||
})
|
||||
|
||||
$disabledList.sortable({
|
||||
group: priorityKey,
|
||||
filter: '.filtered',
|
||||
animation: 150
|
||||
});
|
||||
|
||||
$enabledList.sortable({
|
||||
group: priorityKey,
|
||||
filter: '.filtered',
|
||||
animation: 150
|
||||
});
|
||||
}
|
||||
|
||||
initPriority('generalPriority', currentGeneralActionPriority, availableGeneralActionPriorityItems);
|
||||
initPriority('nationPriority', currentNationPriority, availableNationPriorityItems);
|
||||
|
||||
|
||||
$.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{
|
||||
$obj.val(val);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
@@ -113,10 +113,31 @@ class AutorunGeneralPolicy{
|
||||
|
||||
}
|
||||
|
||||
function __construct(General $general, $aiOptions, array $nationPolicy, array $serverPolicy, array $nation, array $env){
|
||||
//TODO: 국가 정책을 받아와야함
|
||||
function __construct(General $general, $aiOptions, ?array $nationPolicy, ?array $serverPolicy, array $nation, array $env){
|
||||
$this->priority = static::$default_priority;
|
||||
|
||||
if($serverPolicy && key_exists('priority', $serverPolicy)){
|
||||
$priority = [];
|
||||
foreach($serverPolicy['priority'] as $priorityItem){
|
||||
if(!property_exists($this, $priorityItem)){
|
||||
continue;
|
||||
}
|
||||
$priority[] = $priorityItem;
|
||||
}
|
||||
$this->priority = $priority;
|
||||
}
|
||||
|
||||
if($nationPolicy && key_exists('priority', $nationPolicy)){
|
||||
$priority = [];
|
||||
foreach($nationPolicy['priority'] as $priorityItem){
|
||||
if(!property_exists($this, $priorityItem)){
|
||||
continue;
|
||||
}
|
||||
$priority[] = $priorityItem;
|
||||
}
|
||||
$this->priority = $priority;
|
||||
}
|
||||
|
||||
if($general->getNPCType() >= 2){
|
||||
$this->doNPCState($general);
|
||||
return;
|
||||
|
||||
@@ -140,22 +140,68 @@ class AutorunNationPolicy {
|
||||
public $safeRecruitCityPopulationRatio = 0.5;
|
||||
public $properWarTrainAtmos = 90;
|
||||
|
||||
///이쪽의 값이 실제 초기화 값임
|
||||
public static $defaultPolicy = [
|
||||
'reqNationGold'=>10000,
|
||||
'reqNationRice'=>12000,
|
||||
'CombatForce'=>[],
|
||||
'SupportForce'=>[],
|
||||
'DevelopForce'=>[],
|
||||
'reqHumanWarUrgentGold'=>0,
|
||||
'reqHumanWarUrgentRice'=>0,
|
||||
'reqHumanWarRecommandGold'=>0,
|
||||
'reqHumanWarRecommandRice'=>0,
|
||||
'reqHumanDevelGold'=>10000,
|
||||
'reqHumanDevelRice'=>10000,
|
||||
'reqNPCWarGold'=>0,
|
||||
'reqNPCWarRice'=>0,
|
||||
'reqNPCDevelGold'=>0,
|
||||
'reqNPCDevelRice'=>500,
|
||||
|
||||
'minimumResourceActionAmount'=>1000,
|
||||
|
||||
'minNPCWarLeadership'=>40,
|
||||
'minWarCrew'=>1500,
|
||||
|
||||
'allowNpcAttackCity'=>true,
|
||||
'minNPCRecruitCityPopulation'=>50000,
|
||||
'safeRecruitCityPopulationRatio'=>0.5,
|
||||
'properWarTrainAtmos'=>90,
|
||||
];
|
||||
|
||||
function __construct(General $general, $aiOptions, array $nationPolicy, array $serverPolicy, array $nation, array $env)
|
||||
function __construct(General $general, $aiOptions, ?array $nationPolicy, ?array $serverPolicy, array $nation, array $env)
|
||||
{
|
||||
foreach($serverPolicy as $policy=>$value){
|
||||
if(!property_exists($this, $policy)){
|
||||
continue;
|
||||
}
|
||||
$this->$policy = $value;
|
||||
foreach(static::$defaultPolicy as $policy=>$value){
|
||||
$this->{$policy} = $value;
|
||||
}
|
||||
|
||||
if($serverPolicy){
|
||||
foreach($serverPolicy['values']??[] as $policy=>$value){
|
||||
if(!property_exists($this, $policy)){
|
||||
continue;
|
||||
}
|
||||
$this->$policy = $value;
|
||||
}
|
||||
|
||||
foreach($nationPolicy as $policy){
|
||||
if(!property_exists($this, $policy)){
|
||||
continue;
|
||||
if(key_exists('priority', $serverPolicy)){
|
||||
$this->priority = $serverPolicy['priority'];
|
||||
}
|
||||
$this->$policy = $value;
|
||||
}
|
||||
|
||||
|
||||
if($nationPolicy){
|
||||
foreach($nationPolicy['values']??[] as $policy){
|
||||
if(!property_exists($this, $policy)){
|
||||
continue;
|
||||
}
|
||||
$this->$policy = $value;
|
||||
}
|
||||
|
||||
if(key_exists('priority', $nationPolicy)){
|
||||
$this->priority = $nationPolicy['priority'];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(!$this->priority){
|
||||
$this->priority = $this::$defaultPriority;
|
||||
|
||||
@@ -113,11 +113,11 @@ class GeneralAI
|
||||
'name' => '재야',
|
||||
];
|
||||
|
||||
$serverPolicy = KVStorage::getStorage($db, 'autorun_nation_policy_0');
|
||||
$nationPolicy = KVStorage::getStorage($db, "autorun_nation_policy_{$this->nation['nation']}");
|
||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||
$nationStor = KVStorage::getStorage($db, $this->nation['nation'], 'nation_env');
|
||||
|
||||
$this->nationPolicy = new AutorunNationPolicy($general, $this->env['autorun_user']['options']??[], $nationPolicy->getAll(), $serverPolicy->getAll(), $this->nation, $this->env);
|
||||
$this->generalPolicy = new AutorunGeneralPolicy($general, $this->env['autorun_user']['options']??[], $nationPolicy->getAll(), $serverPolicy->getAll(), $this->nation, $this->env);
|
||||
$this->nationPolicy = new AutorunNationPolicy($general, $this->env['autorun_user']['options'], $nationStor->getValue('npc_general_policy'), $gameStor->getValue('npc_general_policy'), $this->nation, $this->env);
|
||||
$this->generalPolicy = new AutorunGeneralPolicy($general, $this->env['autorun_user']['options'], $nationStor->getValue('npc_nation_policy'), $gameStor->getValue('npc_nation_policy'), $this->nation, $this->env);
|
||||
|
||||
$this->nation['aux'] = Json::decode($this->nation['aux']??'{}');
|
||||
|
||||
|
||||
@@ -303,8 +303,8 @@ class NPC{
|
||||
$killturn = ($this->death - $year) * 12 + mt_rand(0, 11) + $month - 1;
|
||||
}
|
||||
|
||||
$specage = $this->specAge?:$age + 1;
|
||||
$specage2 = $this->specAge2?:$age + 1;
|
||||
$specage = $this->specAge?:($age + 1);
|
||||
$specage2 = $this->specAge2?:($age + 1);
|
||||
|
||||
$db->insert('general',[
|
||||
'npc'=>$this->npc,
|
||||
|
||||
@@ -7,20 +7,17 @@
|
||||
<a href='b_myBossInfo.php'><button type="button" class='commandButton' <?=$meLevel>=1?'':'disabled'?> style='background-color:<?=$bgColor?>;color:<?=$fgColor?>;'>인 사 부</button></a>
|
||||
<a href='b_dipcenter.php'><button type="button" class='commandButton' <?=$showSecret?'':'disabled'?> style='background-color:<?=$bgColor?>;color:<?=$fgColor?>;'>내 무 부</button></a>
|
||||
<a href='b_chiefcenter.php'><button type="button" class='commandButton' <?=$showSecret?'':'disabled'?> style='background-color:<?=$bgColor?>;color:<?=$fgColor?>;'>사 령 부</button></a>
|
||||
<a href='b_npc_control.php'><button type="button" class='commandButton' <?=$showSecret?'':'disabled'?> style='background-color:<?=$bgColor?>;color:<?=$fgColor?>;'>NPC 정책</button></a>
|
||||
<a href='b_genList.php' target='_blank'><button type="button" class='commandButton' <?=$showSecret?'':'disabled'?> style='background-color:<?=$bgColor?>;color:<?=$fgColor?>;'>암 행 부</button></a>
|
||||
<a href='b_tournament.php' target='_blank'><button type="button" class='commandButton' style='background-color:<?=$bgColor?>;color:<?=$fgColor?>;'>토 너 먼 트</button></a>
|
||||
|
||||
|
||||
</div>
|
||||
<div>
|
||||
|
||||
<a href='b_myKingdomInfo.php'><button type="button" class='commandButton' <?=$meLevel>=1?'':'disabled'?> style='background-color:<?=$bgColor?>;color:<?=$fgColor?>;'>세력 정보</button></a>
|
||||
<a href='b_myCityInfo.php'><button type="button" class='commandButton' <?=($meLevel>=1&&$nationLevel>=1)?'':'disabled'?> style='background-color:<?=$bgColor?>;color:<?=$fgColor?>;'>세력 도시</button></a>
|
||||
<a href='b_myGenInfo.php'><button type="button" class='commandButton' <?=$meLevel>=1?'':'disabled'?> style='background-color:<?=$bgColor?>;color:<?=$fgColor?>;'>세력 장수</button></a>
|
||||
<a href='b_diplomacy.php'><button type="button" class='commandButton' style='background-color:<?=$bgColor?>;color:<?=$fgColor?>;'>중원 정보</button></a>
|
||||
<a href='b_currentCity.php'><button type="button" class='commandButton' style='background-color:<?=$bgColor?>;color:<?=$fgColor?>;'>현재 도시</button></a>
|
||||
<a href='b_battleCenter.php' target='_blank'><button type="button" class='commandButton' <?=$showSecret?'':'disabled'?> style='background-color:<?=$bgColor?>;color:<?=$fgColor?>;'>감 찰 부</button></a>
|
||||
<a href='b_myPage.php'><button type="button" class='commandButton' style='background-color:<?=$bgColor?>;color:<?=$fgColor?>;'>내 정보 & 설정</button></a>
|
||||
<button type="button" style="visibility:hidden;" class='commandButton'>빈칸</button>
|
||||
<a href='b_myPage.php'><button type="button" class='commandButton' style='background-color:<?=$bgColor?>;color:<?=$fgColor?>;'>내 정보&설정</button></a>
|
||||
<a href='b_auction.php' target='_blank'><button type="button" class='commandButton' style='background-color:<?=$bgColor?>;color:<?=$fgColor?>;'>거 래 장</button></a>
|
||||
<a href='b_betting.php' target='_blank'><button type="button" class='commandButton' style='background-color:<?=$bgColor?>;color:<?=$fgColor?>;'>베 팅 장</button></a>
|
||||
|
||||
|
||||
+2
-2
@@ -284,10 +284,10 @@ class Util extends \utilphp\util
|
||||
return $result;
|
||||
}
|
||||
|
||||
public static function convertArrayToSetLike($arr){
|
||||
public static function convertArrayToSetLike($arr, $valueIsKey=true){
|
||||
$result = [];
|
||||
foreach($arr as $datum){
|
||||
$result[$datum] = $datum;
|
||||
$result[$datum] = $valueIsKey?$datum:1;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user