From b28603d16fecf6c767a608800d90f3813290483a Mon Sep 17 00:00:00 2001 From: hide_d Date: Sat, 24 Feb 2018 02:47:50 +0900 Subject: [PATCH] =?UTF-8?q?refeshNationStaticInfo=20=ED=95=A8=EC=88=98=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80=20getNationStaticInfo=20=ED=95=A8=EC=88=98?= =?UTF-8?q?=EC=97=90=20level=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- twe/event_1.php | 2 +- twe/event_2.php | 2 +- twe/func.php | 13 +++++++++---- twe/func_gamerule.php | 6 ++++-- twe/func_npc.php | 2 +- twe/func_process.php | 12 ++++++------ twe/process_war.php | 2 +- 7 files changed, 23 insertions(+), 16 deletions(-) diff --git a/twe/event_1.php b/twe/event_1.php index 54d3ef03..32b70563 100644 --- a/twe/event_1.php +++ b/twe/event_1.php @@ -199,7 +199,7 @@ $history[count($history)] = "●{$admin['year']}년 {$admin['month']}월:< $history[count($history)] = "●{$admin['year']}년 {$admin['month']}월:【이벤트】이민족의 기세는 그 누구도 막을 수 없을듯 합니다!"; pushHistory($connect, $history); -getNationStaticInfo(null, true); +refreshNationStaticInfo(); echo ""; diff --git a/twe/event_2.php b/twe/event_2.php index 00b9bbf4..71dff514 100644 --- a/twe/event_2.php +++ b/twe/event_2.php @@ -203,7 +203,7 @@ $history[count($history)] = "●{$admin['year']}년 {$admin['month']}월:< $history[count($history)] = "●{$admin['year']}년 {$admin['month']}월:【이벤트】그러나 중원의 영웅들이라면 막아낼 수도 있을법 해 보입니다!"; pushHistory($connect, $history); -getNationStaticInfo(null, true); +refreshNationStaticInfo(); echo ""; diff --git a/twe/func.php b/twe/func.php index 257a4ad1..417bc7b1 100644 --- a/twe/func.php +++ b/twe/func.php @@ -140,7 +140,7 @@ function getGeneralName($forceExit=false) } /** - * nationID를 이용하여 국가의 '어지간해선' 변경되지 않는 정보(이름, 색, 성향, 수도)를 반환해줌 + * nationID를 이용하여 국가의 '어지간해선' 변경되지 않는 정보(이름, 색, 성향, 규모, 수도)를 반환해줌 * * @param int|null $nationID 국가 코드 * @param bool $forceRefresh 강제 갱신 여부 @@ -161,7 +161,7 @@ function getNationStaticInfo($nationID, $forceRefresh=false) if($nationList === null){ $nationList = ArrayToDict( - getDB()->query("select nation, name, color, type, capital from nation"), + getDB()->query("select nation, name, color, type, level, capital from nation"), "nation"); } @@ -169,8 +169,13 @@ function getNationStaticInfo($nationID, $forceRefresh=false) return $nationList[$nationID]; } return null; +} - +/** + * getNationStaticInfo() 함수의 국가 캐시를 초기화 + */ +function refreshNationStaticInfo(){ + getNationStaticInfo(null, true); } function GetImageURL($imgsvr) { @@ -3757,7 +3762,7 @@ function deleteNation($connect, $general) { MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); pushHistory($connect, $history); - getNationStaticInfo(null, false); + refreshNationStaticInfo(); } function nextRuler($connect, $general) { diff --git a/twe/func_gamerule.php b/twe/func_gamerule.php index 5dd13d68..be07b4df 100644 --- a/twe/func_gamerule.php +++ b/twe/func_gamerule.php @@ -868,7 +868,7 @@ function checkMerge($connect) { unset($youlog); unset($history); - getNationStaticInfo(null, true); + refreshNationStaticInfo(); } } @@ -988,7 +988,7 @@ function checkSurrender($connect) { unset($youlog); unset($history); - getNationStaticInfo(null, true); + refreshNationStaticInfo(); } } @@ -1058,6 +1058,8 @@ function updateNationState($connect) { //작위 상승 $query = "update nation set level='{$nation['level']}' where nation='{$nation['nation']}'"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); + + refreshNationStaticInfo(); } $gennum = $gencount; if($gencount < 10) $gencount = 10; diff --git a/twe/func_npc.php b/twe/func_npc.php index be6fb3f1..9907e80a 100644 --- a/twe/func_npc.php +++ b/twe/func_npc.php @@ -1042,7 +1042,7 @@ function RegCity($connect, $nation, $name, $cap=0) { if($cap > 0) { @MYDB_query("update nation set capital='$city' where nation='$nation'",$connect) or Error(__LINE__.MYDB_error($connect),""); } - getNationStaticInfo(null, true); + refreshNationStaticInfo(); } function Promotion($connect, $nation, $level) { diff --git a/twe/func_process.php b/twe/func_process.php index 4aeaa03a..76e9d81e 100644 --- a/twe/func_process.php +++ b/twe/func_process.php @@ -3698,7 +3698,7 @@ function process_46($connect, &$general) { $exp = 1000; $ded = 1000; - getNationStaticInfo(null, true); + refreshNationStaticInfo(); // 성격 보정 $exp = CharExperience($exp, $general['personal']); @@ -3773,7 +3773,7 @@ function process_47($connect, &$general) { pushHistory($connect, $history); - getNationStaticInfo(null, true); + refreshNationStaticInfo(); } pushAllLog($alllog); pushGenLog($general, $log); @@ -4401,7 +4401,7 @@ function process_55($connect, &$general) { $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $nationcount = MYDB_num_rows($result); - getNationStaticInfo(null, true); + refreshNationStaticInfo(); for($i=0; $i < $nationcount; $i++) { $younation = MYDB_fetch_array($result); @@ -4460,7 +4460,7 @@ function process_56($connect, &$general) { DeleteConflict($connect, $general['nation']); deleteNation($connect, $general); - getNationStaticInfo(null, true); + refreshNationStaticInfo(); } pushAllLog($alllog); pushGenLog($general, $log); @@ -5007,7 +5007,7 @@ function process_66($connect, &$general) { $query = "update general set dedication=dedication+'$ded',experience=experience+'$exp' where no='{$general['no']}'"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - getNationStaticInfo(null, true); + refreshNationStaticInfo(); } pushHistory($connect, $history); @@ -6326,7 +6326,7 @@ function process_81($connect, &$general) { $query = "update general set dedication=dedication+'$ded',experience=experience+'$exp' where no='{$general['no']}'"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - getNationStaticInfo(null, true); + refreshNationStaticInfo(); } pushHistory($connect, $history); diff --git a/twe/process_war.php b/twe/process_war.php index 2d5fe0ad..3284f3c4 100644 --- a/twe/process_war.php +++ b/twe/process_war.php @@ -1861,7 +1861,7 @@ function ConquerCity($connect, $game, $general, $city, $nation, $destnation) { $query = "update general set atmos=atmos*0.8 where nation='{$destnation['nation']}'"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - getNationStaticInfo(null, true); + refreshNationStaticInfo(); } }