diff --git a/hwe/a_bestGeneral.php b/hwe/a_bestGeneral.php index 5d3c818d..e349de30 100644 --- a/hwe/a_bestGeneral.php +++ b/hwe/a_bestGeneral.php @@ -75,7 +75,7 @@ $types = [ $v['nationName'] = '???'; $v['pictureFullPath'] = GetImageURL(0)."/default.jpg"; $v['name'] = '???'; - $v['owner_name'] = null; + $v['ownerName'] = null; $v['bgColor'] = GameConst::$basecolor4; $v['fgColor'] = newColor($v['bgColor']); return $v; @@ -163,7 +163,7 @@ $types = [ $generals = []; foreach($db->query( - "SELECT nation,no,name,name2 as owner_name, owner, picture, imgsvr, + "SELECT nation,no,name,owner_name as ownerName, owner, picture, imgsvr, experience, dedication, dex1, dex2, dex3, dex4, dex5, horse, weapon, book, item @@ -194,7 +194,7 @@ $templates = new \League\Plates\Engine('templates'); foreach($types as $idx=>[$typeName, $typeValue, $typeFunc]){ $validCnt = 0; $typeGenerals = array_map(function($general) use($typeValue, $typeFunc, &$validCnt, $ownerNameList){ - $general['owner_name'] = $ownerNameList[$general['owner']]??null; + $general['ownerName'] = $ownerNameList[$general['owner']]??null; $general = ($typeFunc)($general); $value = $general['value']; diff --git a/hwe/a_hallOfFame.php b/hwe/a_hallOfFame.php index 633f7632..2b40acc9 100644 --- a/hwe/a_hallOfFame.php +++ b/hwe/a_hallOfFame.php @@ -122,7 +122,7 @@ foreach($types as $idx=>[$typeName, $typeValue]) { $general += $aux; if(key_exists($general['owner'], $ownerNameList)){ - $general['owner_name'] = $ownerNameList[$general['owner']]; + $general['ownerName'] = $ownerNameList[$general['owner']]; } if(!key_exists('bgColor', $general)){ diff --git a/hwe/a_npcList.php b/hwe/a_npcList.php index 64107723..beed9a1f 100644 --- a/hwe/a_npcList.php +++ b/hwe/a_npcList.php @@ -54,27 +54,44 @@ $sel[$type] = "selected"; query('SELECT npc,nation,name,owner_name,special,special2,personal,leadership,strength,intel,leadership+strength+intel as sum,explevel,experience,dedication from general where npc=1'); +$sortType = [ + 1 => ['name', true], + 2 => ['nation', true], + 3 => ['sum', false], + 4 => ['leadership', false], + 5 => ['strength', false], + 6 => ['intel', false], + 7 => ['experience', false], + 8 => ['dedication', false], +]; + +foreach($generalList as &$general){ + $general['nationName'] = $nationName[$general['nation']]; + $general['coloredName'] = getColoredName($general['name'], $general['npc']); +} + +[$sortKey, $isAsc] = $sortType[$type]; + +if($isAsc){ + usort($generalList, function($lhs, $rhs)use($sortKey){ + return $lhs[$sortKey] <=> $rhs[$sortKey]; + }); +} +else{ + usort($generalList, function($lhs, $rhs)use($sortKey){ + return $rhs[$sortKey] <=> $lhs[$sortKey]; + }); +} + +?> @@ -89,7 +106,8 @@ echo" - "; + + for ($j=0; $j < $gencount; $j++) { $general = MYDB_fetch_array($genresult); $nation = $nationname[$general['nation']]; @@ -105,7 +123,7 @@ for ($j=0; $j < $gencount; $j++) { echo " - + diff --git a/hwe/c_die_immediately.php b/hwe/c_die_immediately.php index c858889c..94980b83 100644 --- a/hwe/c_die_immediately.php +++ b/hwe/c_die_immediately.php @@ -13,7 +13,7 @@ $userID = Session::getUserID(); $db = DB::db(); $gameStor = KVStorage::getStorage($db, 'game_env'); -$general = $db->queryFirstRow('SELECT no,name,name2,npc,lastrefresh FROM general WHERE owner=%i AND npc = 0', $userID); +$general = $db->queryFirstRow('SELECT no,name,owner_name,npc,lastrefresh FROM general WHERE owner=%i AND npc = 0', $userID); if(!$general){ header('location:b_myPage.php'); diff --git a/hwe/c_troop.php b/hwe/c_troop.php deleted file mode 100644 index 6b1159a2..00000000 --- a/hwe/c_troop.php +++ /dev/null @@ -1,67 +0,0 @@ -setReadOnly(); -$userID = $session::getUserID(); - -$db = DB::db(); - -$me = $db->queryFirstRow('SELECT `no`, nation, troop FROM general WHERE `owner`=%i', $userID); - - -if($name && mb_strwidth($name) > 18){ - $name = mb_strimwidth($name, 0, 18); -} - -$name = trim($name); -if($btn == "부 대 창 설" && $name != "" && $me['troop'] == 0) { - $db->insertIgnore('troop',[ - 'troop_leader'=>$me['no'], - 'name'=>$name, - 'nation'=>$me['nation'], - ]); - - $db->update('general', [ - 'troop'=>$me['no'], - ], 'no=%i',$me['no']); -} elseif($btn == "부 대 변 경" && $name != "") { - $db->update('troop', [ - 'name'=>$name - ], 'troop_leader=%i',$me['no']); -} elseif($btn == "부 대 추 방" && $gen != 0) { - $db->update('general', [ - 'troop'=>0 - ], 'no=%i AND troop= %i', $gen, $me['no']); -} elseif($btn == "부 대 가 입" && $troop != 0) { - $troopLeaderNation = $db->queryFirstField('SELECT `nation` FROM `general` WHERE `no`=%i AND `troop`=%i AND `nation`=%i', $troop, $troop, $me['nation']); - if($troopLeaderNation){ - $db->update('general', [ - 'troop'=>$troop - ], 'no=%i', $me['no']); - } -} elseif($btn == "부 대 탈 퇴") { - //부대장일 경우 - if($me['troop'] == $me['no']) { - // 모두 탈퇴 - $db->update('general', [ - 'troop'=>0 - ], 'troop=%i',$me['troop']); - // 부대 삭제 - $db->delete('troop', 'troop_leader=%i', $me['troop']); - } else { - $db->update('general', [ - 'troop'=>0 - ], 'no=%i', $me['no']); - } -} - -header('Location:b_troop.php', true, 303); diff --git a/hwe/func.php b/hwe/func.php index a0eb13c2..ba00fc87 100644 --- a/hwe/func.php +++ b/hwe/func.php @@ -1427,7 +1427,7 @@ function CheckHall($no) { [$scenarioIdx, $scenarioName, $startTime] = $gameStor->getValuesAsArray(['scenario', 'scenario_text', 'starttime']); - $ownerName = $generalObj->getVar('name2'); + $ownerName = $generalObj->getVar('owner_name'); if($generalObj->getVar('owner')){ $ownerName = RootDB::db()->queryFirstField('SELECT name FROM member WHERE no = %i', $generalObj->getVar('owner')); } @@ -1470,7 +1470,7 @@ function CheckHall($no) { 'imgsvr'=>$generalObj->getVar('imgsvr'), 'startTime'=>$startTime, 'unitedTime'=>$unitedDate, - 'owner_name'=>$ownerName, + 'ownerName'=>$ownerName, 'serverID'=>UniqueConst::$serverID, 'serverIdx'=>$serverCnt, 'serverName'=>UniqueConst::$serverName, diff --git a/hwe/func_gamerule.php b/hwe/func_gamerule.php index 6e41002a..c6fd306b 100644 --- a/hwe/func_gamerule.php +++ b/hwe/func_gamerule.php @@ -226,7 +226,6 @@ function updateYearly() { //관직 변경 해제 function updateQuaterly() { $db = DB::db(); - $connect=$db->get(); //천도 제한 해제, 관직 변경 제한 해제 $db->update('nation', [ diff --git a/hwe/func_process_chief.php b/hwe/func_process_chief.php index 857e9f31..7a5fbc1e 100644 --- a/hwe/func_process_chief.php +++ b/hwe/func_process_chief.php @@ -74,118 +74,6 @@ function process_51(&$general) { pushGenLog($general, ["●{$month}월:{$destNation['name']}으로 항복 권고 서신을 보냈습니다.<1>$date"]); } -function process_52(&$general) { - $db = DB::db(); - $gameStor = KVStorage::getStorage($db, 'game_env'); - $connect=$db->get(); - - $log = []; - $alllog = []; - $history = []; - - $date = substr($general['turntime'],11,5); - - $admin = $gameStor->getValues(['year','month']); - - $query = "select nation,supply from city where city='{$general['city']}'"; - $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - $city = MYDB_fetch_array($result); - - $query = "select nation,name,level,gold,rice,surlimit,l{$general['level']}turn0 from nation where nation='{$general['nation']}'"; - $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - $mynation = MYDB_fetch_array($result); - - $command = DecodeCommand($mynation["l{$general['level']}turn0"]); - $rice = $command[3]; - $gold = $command[2]; - $which = $command[1]; - $rice *= 1000; - $gold *= 1000; - $limit = $mynation['level'] * 10000; - - if($gold < 0) { $gold = 0; } - if($rice < 0) { $rice = 0; } - - $query = "select nation,name,gold,rice,surlimit from nation where nation='$which'"; - $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - $younation = MYDB_fetch_array($result); - - if($gold > $mynation['gold']-GameConst::$basegold) { $gold = $mynation['gold'] - GameConst::$basegold; } - if($rice > $mynation['rice']-GameConst::$baserice) { $rice = $mynation['rice'] - GameConst::$baserice; } - - if($younation['nation'] == 0) { - $log[] = "●{$admin['month']}월:멸망한 국가입니다. 원조 실패. <1>$date"; - } elseif($gold == 0 && $rice == 0) { - $log[] = "●{$admin['month']}월:보낼 물자가 부족합니다. 원조 실패. <1>$date"; - } elseif($gold < 0 || $rice < 0) { - $log[] = "●{$admin['month']}월:보낼 물자가 부족합니다. 원조 실패. <1>$date"; - } elseif($gold > $limit || $rice > $limit) { - $log[] = "●{$admin['month']}월:작위 제한량 이상은 보낼 수 없습니다. 원조 실패. <1>$date"; - } elseif($general['level'] < 5) { - $log[] = "●{$admin['month']}월:수뇌부가 아닙니다. 원조 실패. <1>$date"; - } elseif($mynation['surlimit'] > 0) { - $log[] = "●{$admin['month']}월:외교제한중입니다. 원조 실패. <1>$date"; - } elseif($younation['surlimit'] > 0) { - $log[] = "●{$admin['month']}월:상대국이 외교제한중입니다. 원조 실패. <1>$date"; - } elseif($city['nation'] != $general['nation']) { - $log[] = "●{$admin['month']}월:아국이 아닙니다. 원조 실패. <1>$date"; - } elseif($city['supply'] == 0) { - $log[] = "●{$admin['month']}월:고립된 도시입니다. 원조 실패. <1>$date"; - } else { - // 본국 자원 감소 - $query = "update nation set gold=gold-'$gold',rice=rice-'$rice',surlimit=surlimit+12 where nation='{$general['nation']}'"; - MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - - // 상대국 자원 증가 - $query = "update nation set gold=gold+'$gold',rice=rice+'$rice' where nation='$which'"; - MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - - //아국 수뇌부에게 로그 전달 - $query = "select no,name,nation from general where nation='{$general['nation']}' and level>='9'"; - $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - $gencount = MYDB_num_rows($result); - - $josaRo = JosaUtil::pick($younation['name'], '로'); - $genlog = ["{$younation['name']}{$josaRo} 금$gold 쌀$rice을 지원했습니다."]; - for($i=0; $i < $gencount; $i++) { - $gen = MYDB_fetch_array($result); - pushGenLog($gen, $genlog); - } - pushGeneralHistory($general, "●{$admin['year']}년 {$admin['month']}월:{$younation['name']}{$josaRo} 금$gold 쌀$rice을 지원"); - pushNationHistory($mynation, "●{$admin['year']}년 {$admin['month']}월:{$younation['name']}{$josaRo} 금$gold 쌀$rice을 지원"); - pushNationHistory($younation, "●{$admin['year']}년 {$admin['month']}월:{$mynation['name']}{$josaRo}부터 금$gold 쌀$rice을 지원 받음"); - - //상대국 수뇌부에게 로그 전달 - $query = "select no,name,nation from general where nation='$which' and level>='9'"; - $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - $gencount = MYDB_num_rows($result); - - for($i=0; $i < $gencount; $i++) { - $gen = MYDB_fetch_array($result); - $genlog[0] = "{$mynation['name']}에서 금$gold 쌀$rice을 원조 했습니다."; - pushGenLog($gen, $genlog); - } - - $history[] = "●{$admin['year']}년 {$admin['month']}월:【원조】{$mynation['name']}에서 {$younation['name']}{$josaRo} 물자를 지원합니다."; - $log[] = "●{$admin['month']}월:{$younation['name']}{$josaRo} 물자를 지원합니다. <1>$date"; - - $exp = 5; - $ded = 5; - - // 성격 보정 - $exp = CharExperience($exp, $general['personal']); - $ded = CharDedication($ded, $general['personal']); - - // 경험치 상승 // 공헌도, 명성 상승 - $query = "update general set dedication=dedication+'$ded',experience=experience+'$exp' where no='{$general['no']}'"; - MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - -// $log = checkAbility($general, $log); - } - pushWorldHistory($history, $admin['year'], $admin['month']); - pushGenLog($general, $log); -} - function process_53(&$general) { $db = DB::db(); $gameStor = KVStorage::getStorage($db, 'game_env'); @@ -491,1159 +379,6 @@ function process_65(&$general) { pushGenLog($general, $log); } -function process_66(&$general) { - $db = DB::db(); - $gameStor = KVStorage::getStorage($db, 'game_env'); - $connect=$db->get(); - - $log = []; - $alllog = []; - $history = []; - - $date = substr($general['turntime'],11,5); - - $admin = $gameStor->getValues(['year','month','develcost']); - - $query = "select nation,supply from city where city='{$general['city']}'"; - $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - $city = MYDB_fetch_array($result); - - $query = "select nation,name,gold,rice,surlimit,l{$general['level']}term,l{$general['level']}turn0,capital,capset from nation where nation='{$general['nation']}'"; - $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - $nation = MYDB_fetch_array($result); - - $command = DecodeCommand($nation["l{$general['level']}turn0"]); - $which = $command[1]; - - $query = "select city,name,nation from city where city='$which'"; - $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - $destcity = MYDB_fetch_array($result); - - $nearCities = searchDistance($nation['capital'], 1, false); - $amount = $admin['develcost'] * 10; - - $code = $nation["l{$general['level']}term"]; - if($code%100 == 66) { - $term = intdiv($code, 100) + 1; - $code = $term * 100 + 66; - } else { - $term = 1; - $code = 100 + 66; - } - - if($city['nation'] != $general['nation']) { - $log[] = "●{$admin['month']}월:아국이 아닙니다. 천도 실패. <1>$date"; - } elseif($general['level'] < 5) { - $log[] = "●{$admin['month']}월:수뇌부가 아닙니다. 천도 실패. <1>$date"; - } elseif($city['supply'] == 0) { - $log[] = "●{$admin['month']}월:고립된 도시입니다. 천도 실패. <1>$date"; - } elseif($destcity['nation'] != $general['nation']) { - $log[] = "●{$admin['month']}월:아국 영토가 아닙니다. 천도 실패. <1>$date"; - } elseif($destcity['city'] == $nation['capital'] || !key_exists($destcity['city'], $nearCities)){ - $log[] = "●{$admin['month']}월:인접도시가 아닙니다. 천도 실패. <1>$date"; - } elseif($nation['capset'] == 1) { - $log[] = "●{$admin['month']}월:다음 분기에 가능합니다. 천도 실패. <1>$date"; - } elseif($nation['gold']-GameConst::$basegold < $amount || $nation['rice']-GameConst::$baserice < $amount) { - $log[] = "●{$admin['month']}월:물자가 부족합니다. 천도 실패. <1>$date"; - } elseif($term < 3) { - $log[] = "●{$admin['month']}월:천도중... ({$term}/3) <1>$date"; - - $query = "update nation set l{$general['level']}term={$code} where nation='{$general['nation']}'"; - MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - } else { - $josaRo = JosaUtil::pick($destcity['name'], '로'); - $log[] = "●{$admin['month']}월:{$destcity['name']}{$josaRo} 천도했습니다. <1>$date"; - - $josaYi = JosaUtil::pick($general['name'], '이'); - $josaYiNation = JosaUtil::pick($nation['name'], '이'); - - $alllog[] = "●{$admin['month']}월:{$general['name']}{$josaYi} {$destcity['name']}{$josaRo} 천도를 명령하였습니다."; - $history[] = "●{$admin['year']}년 {$admin['month']}월:【천도】{$nation['name']}{$josaYiNation} {$destcity['name']}{$josaRo} 천도하였습니다."; - pushGeneralHistory($general, "●{$admin['year']}년 {$admin['month']}월:{$destcity['name']}{$josaRo} 천도 명령"); - pushNationHistory($nation, "●{$admin['year']}년 {$admin['month']}월:{$general['name']}{$josaYi} {$destcity['name']}{$josaRo} 천도 명령"); - - //수도 변경 - $query = "update nation set l{$general['level']}term='0',capital='{$destcity['city']}',capset='1',gold=gold-'$amount',rice=rice-'$amount' where nation='{$general['nation']}'"; - MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - - refreshNationStaticInfo(); - } - - pushWorldHistory($history, $admin['year'], $admin['month']); - pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']); - pushGenLog($general, $log); -} - -function process_67(&$general) { - $db = DB::db(); - $gameStor = KVStorage::getStorage($db, 'game_env'); - $connect=$db->get(); - - $log = []; - $alllog = []; - $history = []; - - $date = substr($general['turntime'],11,5); - - $admin = $gameStor->getValues(['year','month','develcost']); - - $query = "select nation,supply from city where city='{$general['city']}'"; - $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - $city = MYDB_fetch_array($result); - - $query = "select nation,name,gold,rice,surlimit,l{$general['level']}term,l{$general['level']}turn0,capital,capset from nation where nation='{$general['nation']}'"; - $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - $nation = MYDB_fetch_array($result); - - $command = DecodeCommand($nation["l{$general['level']}turn0"]); - $which = $command[1]; - - $query = "select city,name,nation,level from city where city='$which'"; - $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - $destcity = MYDB_fetch_array($result); - - $amount = $admin['develcost'] * GameConst::$expandCityCostCoef + GameConst::$expandCityDefaultCost; // 7만~13만 - - $code = $nation["l{$general['level']}term"]; - if($code%100 == 67) { - $term = intdiv($code, 100) + 1; - $code = $term * 100 + 67; - } else { - $term = 1; - $code = 100 + 67; - } - - if($nation['capital'] != $general['city']) { - $log[] = "●{$admin['month']}월:수도에서 실행해야 합니다. 증축 실패. <1>$date"; - } elseif($nation['capital'] != $destcity['city']) { - $log[] = "●{$admin['month']}월:수도만 가능합니다. 증축 실패. <1>$date"; - } elseif($destcity['level'] <= 3) { - $log[] = "●{$admin['month']}월:수진, 진, 관문은 불가능합니다. 증축 실패. <1>$date"; - } elseif($destcity['level'] >= 8) { - $log[] = "●{$admin['month']}월:더이상 증축할 수 없습니다. 증축 실패. <1>$date"; - } elseif($general['level'] < 5) { - $log[] = "●{$admin['month']}월:수뇌부가 아닙니다. 증축 실패. <1>$date"; - } elseif($nation['capset'] == 1) { - $log[] = "●{$admin['month']}월:다음 분기에 가능합니다. 증축 실패. <1>$date"; - } elseif($nation['gold']-GameConst::$basegold < $amount || $nation['rice']-GameConst::$baserice < $amount) { - $log[] = "●{$admin['month']}월:물자가 부족합니다. 증축 실패. <1>$date"; - } elseif($term < 6) { - $log[] = "●{$admin['month']}월:증축중... ({$term}/6) <1>$date"; - - $query = "update nation set l{$general['level']}term={$code} where nation='{$general['nation']}'"; - MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - } else { - $josaUl = JosaUtil::pick($destcity['name'], '을'); - $log[] = "●{$admin['month']}월:{$destcity['name']}{$josaUl} 증축했습니다. <1>$date"; - $exp = 5 * 6; - $ded = 5 * 6; - - // 성격 보정 - $exp = CharExperience($exp, $general['personal']); - $ded = CharDedication($ded, $general['personal']); - - $josaYi = JosaUtil::pick($general['name'], '이'); - $josaYiNation = JosaUtil::pick($nation['name'], '이'); - - $alllog[] = "●{$admin['month']}월:{$general['name']}{$josaYi} {$destcity['name']}{$josaUl} 증축하였습니다."; - $history[] = "●{$admin['year']}년 {$admin['month']}월:【증축】{$nation['name']}{$josaYiNation} {$destcity['name']}{$josaUl} 증축하였습니다."; - pushGeneralHistory($general, "●{$admin['year']}년 {$admin['month']}월:{$destcity['name']}{$josaUl} 증축"); - pushNationHistory($nation, "●{$admin['year']}년 {$admin['month']}월:{$general['name']}{$josaYi} {$destcity['name']}{$josaUl} 증축"); - - //물자 감소 - $query = "update nation set l{$general['level']}term='0',capset='1',gold=gold-'$amount',rice=rice-'$amount' where nation='{$general['nation']}'"; - MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - - //수도 증축 - $db->update('city', [ - 'upgrading'=>$db->sqleval('upgrading+1'), - 'level'=>$db->sqleval('level+1'), - 'pop_max'=>$db->sqleval('pop_max + %i', GameConst::$expandCityPopIncreaseAmount), - 'agri_max'=>$db->sqleval('agri_max + %i', GameConst::$expandCityDevelIncreaseAmount), - 'comm_max'=>$db->sqleval('comm_max + %i', GameConst::$expandCityDevelIncreaseAmount), - 'secu_max'=>$db->sqleval('secu_max + %i', GameConst::$expandCityDevelIncreaseAmount), - 'def_max'=>$db->sqleval('def_max + %i', GameConst::$expandCityWallIncreaseAmount), - 'wall_max'=>$db->sqleval('wall_max + %i', GameConst::$expandCityWallIncreaseAmount), - ], 'city=%i', $destcity['city']); - - //경험치, 공헌치 - $query = "update general set dedication=dedication+'$ded',experience=experience+'$exp' where no='{$general['no']}'"; - MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - } - - pushWorldHistory($history, $admin['year'], $admin['month']); - pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']); - pushGenLog($general, $log); -} - -function process_68(&$general) { - $db = DB::db(); - $gameStor = KVStorage::getStorage($db, 'game_env'); - $connect=$db->get(); - - $log = []; - $alllog = []; - $history = []; - - $date = substr($general['turntime'],11,5); - - $admin = $gameStor->getValues(['year','month','develcost']); - - $query = "select nation,supply from city where city='{$general['city']}'"; - $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - $city = MYDB_fetch_array($result); - - $query = "select nation,name,gold,rice,surlimit,l{$general['level']}term,l{$general['level']}turn0,capital,capset from nation where nation='{$general['nation']}'"; - $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - $nation = MYDB_fetch_array($result); - - $command = DecodeCommand($nation["l{$general['level']}turn0"]); - $which = $command[1]; - - $query = "select city,name,nation,level,pop,agri,comm,def,wall,secu,upgrading from city where city='$which'"; - $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - $destcity = MYDB_fetch_array($result); - - $amount = $admin['develcost'] * GameConst::$expandCityCostCoef + GameConst::$expandCityDefaultCost / 2; // 4만~10만 - - $code = $nation["l{$general['level']}term"]; - if($code%100 == 68) { - $term = intdiv($code, 100) + 1; - $code = $term * 100 + 68; - } else { - $term = 1; - $code = 100 + 68; - } - - if($nation['capital'] != $general['city']) { - $log[] = "●{$admin['month']}월:수도에서 실행해야 합니다. 감축 실패. <1>$date"; - } elseif($nation['capital'] != $destcity['city']) { - $log[] = "●{$admin['month']}월:수도만 가능합니다. 감축 실패. <1>$date"; - } elseif($destcity['level'] <= 3) { - $log[] = "●{$admin['month']}월:수진, 진, 관문은 불가능합니다. 감축 실패. <1>$date"; - } elseif($destcity['level'] <= 6) { - $log[] = "●{$admin['month']}월:더이상 감축할 수 없습니다. 감축 실패. <1>$date"; - } elseif($destcity['upgrading'] <= 0) { - $log[] = "●{$admin['month']}월:증축된 도시가 아닙니다. 감축 실패. <1>$date"; - } elseif($general['level'] < 5) { - $log[] = "●{$admin['month']}월:수뇌부가 아닙니다. 감축 실패. <1>$date"; - } elseif($nation['capset'] == 1) { - $log[] = "●{$admin['month']}월:다음 분기에 가능합니다. 감축 실패. <1>$date"; - } elseif($term < 6) { - $log[] = "●{$admin['month']}월:감축중... ({$term}/6) <1>$date"; - - $query = "update nation set l{$general['level']}term={$code} where nation='{$general['nation']}'"; - MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - } else { - $josaUl = JosaUtil::pick($destcity['name'], '을'); - $log[] = "●{$admin['month']}월:{$destcity['name']}{$josaUl} 감축했습니다. <1>$date"; - $exp = 5 * 6; - $ded = 5 * 6; - - // 성격 보정 - $exp = CharExperience($exp, $general['personal']); - $ded = CharDedication($ded, $general['personal']); - - $josaYi = JosaUtil::pick($general['name'], '이'); - $josaYiNation = JosaUtil::pick($nation['name'], '이'); - - $alllog[] = "●{$admin['month']}월:{$general['name']}{$josaYi} {$destcity['name']}{$josaUl} 감축하였습니다."; - $history[] = "●{$admin['year']}년 {$admin['month']}월:【감축】{$nation['name']}{$josaYiNation} {$destcity['name']}{$josaUl} 감축하였습니다."; - pushGeneralHistory($general, "●{$admin['year']}년 {$admin['month']}월:{$destcity['name']}{$josaUl} 감축"); - pushNationHistory($nation, "●{$admin['year']}년 {$admin['month']}월:{$general['name']}{$josaYi} {$destcity['name']}{$josaUl} 감축"); - - //물자 증가 - $query = "update nation set l{$general['level']}term='0',capset='1',gold=gold+'$amount',rice=rice+'$amount' where nation='{$general['nation']}'"; - MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - - $pop = $destcity['pop'] - GameConst::$expandCityPopIncreaseAmount; - $agri = $destcity['agri'] - GameConst::$expandCityDevelIncreaseAmount; - $comm = $destcity['comm'] - GameConst::$expandCityDevelIncreaseAmount; - $def = $destcity['def'] - GameConst::$expandCityWallIncreaseAmount; - $wall = $destcity['wall'] - GameConst::$expandCityWallIncreaseAmount; - $secu = $destcity['secu'] - GameConst::$expandCityDevelIncreaseAmount; - if($pop < 30000) { $pop = 30000; } - if($agri < 0) { $agri = 0; } - if($comm < 0) { $comm = 0; } - if($def < 0) { $def = 0; } - if($wall < 0) { $wall = 0; } - if($secu < 0) { $secu = 0; } - //수도 감축 - $db->update('city', [ - 'upgrading'=>$db->sqleval('upgrading-1'), - 'level'=>$db->sqleval('level-1'), - 'pop_max'=>$db->sqleval('pop_max - %i', GameConst::$expandCityPopIncreaseAmount), - 'agri_max'=>$db->sqleval('agri_max - %i', GameConst::$expandCityDevelIncreaseAmount), - 'comm_max'=>$db->sqleval('comm_max - %i', GameConst::$expandCityDevelIncreaseAmount), - 'secu_max'=>$db->sqleval('secu_max - %i', GameConst::$expandCityDevelIncreaseAmount), - 'def_max'=>$db->sqleval('def_max - %i', GameConst::$expandCityWallIncreaseAmount), - 'wall_max'=>$db->sqleval('wall_max - %i', GameConst::$expandCityWallIncreaseAmount), - 'pop'=>$pop, - 'agri'=>$agri, - 'comm'=>$comm, - 'secu'=>$secu, - 'def'=>$def, - 'wall'=>$wall - ], 'city=%i', $destcity['city']); - - //경험치, 공헌치 - $query = "update general set dedication=dedication+'$ded',experience=experience+'$exp' where no='{$general['no']}'"; - MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - } - - pushWorldHistory($history, $admin['year'], $admin['month']); - pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']); - pushGenLog($general, $log); -} - -function process_71(&$general) { - $db = DB::db(); - $gameStor = KVStorage::getStorage($db, 'game_env'); - $connect=$db->get(); - - $log = []; - $alllog = []; - $history = []; - $sabotagelog = []; - - $date = substr($general['turntime'],11,5); - - $admin = $gameStor->getValues(['year','month','develcost']); - - $query = "select nation,supply from city where city='{$general['city']}'"; - $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - $city = MYDB_fetch_array($result); - - $query = "select nation,gennum,name,type,strategic_cmd_limit,l{$general['level']}term,l{$general['level']}turn0 from nation where nation='{$general['nation']}'"; - $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - $nation = MYDB_fetch_array($result); - - $query = "select no from diplomacy where me='{$general['nation']}' and state=0"; - $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - $dipCount = MYDB_num_rows($result); - - $genCount = Util::valueFit($nation['gennum'], GameConst::$initialNationGenLimit); - - //$term2 = Util::round($genCount / 10); - //if($term2 == 0) { $term2 = 1; } - $term2 = 3; - $term3 = Util::round(sqrt($genCount*8)*10); - - $code = $nation["l{$general['level']}term"]; - if($code%100 == 71) { - $term = intdiv($code, 100) + 1; - $code = $term * 100 + 71; - } else { - $term = 1; - $code = 100 + 71; - } - - if($city['nation'] != $general['nation']) { - $log[] = "●{$admin['month']}월:아국이 아닙니다. 필사즉생 실패. <1>$date"; - } elseif($general['level'] < 5) { - $log[] = "●{$admin['month']}월:수뇌부가 아닙니다. 필사즉생 실패. <1>$date"; - } elseif($dipCount == 0) { - $log[] = "●{$admin['month']}월:전쟁중이 아닙니다. 필사즉생 실패. <1>$date"; - } elseif($nation['strategic_cmd_limit'] > 0) { - $log[] = "●{$admin['month']}월:전략기한이 남았습니다. 필사즉생 실패. <1>$date"; - } elseif($term < $term2) { - $log[] = "●{$admin['month']}월:필사즉생 수행중... ({$term}/{$term2}) <1>$date"; - - $query = "update nation set l{$general['level']}term={$code} where nation='{$general['nation']}'"; - MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - } else { - $log[] = "●{$admin['month']}월:필사즉생 발동! <1>$date"; - $exp = 5 * $term2; - $ded = 5 * $term2; - - // 성격 보정 - $exp = CharExperience($exp, $general['personal']); - $ded = CharDedication($ded, $general['personal']); - - $josaYi = JosaUtil::pick($general['name'], '이'); - $josaYiNation = JosaUtil::pick($nation['name'], '이'); - - $query = "select no,name from general where nation='{$general['nation']}' and no!='{$general['no']}'"; - $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - $cnt = MYDB_num_rows($result); - $alllog[0] = "{$general['name']}{$josaYi} 필사즉생을 발동하였습니다."; - for($i=0; $i < $cnt; $i++) { - $gen = MYDB_fetch_array($result); - pushGenLog($gen, $alllog); - } - -// $alllog[] = "●{$admin['month']}월:{$general['name']}{$josaYi} 필사즉생을 발동하였습니다."; -// $history[] = "●{$admin['year']}년 {$admin['month']}월:【전략】{$nation['name']}{$josaYiNation} 필사즉생을 발동하였습니다."; - $sabotagelog[] = "●{$admin['year']}년 {$admin['month']}월:【전략】{$nation['name']}{$josaYiNation} 필사즉생을 발동하였습니다."; - pushGeneralHistory($general, "●{$admin['year']}년 {$admin['month']}월:필사즉생을 발동"); - pushNationHistory($nation, "●{$admin['year']}년 {$admin['month']}월:{$general['name']}{$josaYi} 필사즉생을 발동"); - - //전장수 훈사100 - $query = "update general set atmos=100,train=100 where nation='{$general['nation']}'"; - MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - - // 국가보정 - if($nation['type'] == 11) { $term3 = Util::round($term3 / 2); } - if($nation['type'] == 12) { $term3 = $term3 * 2; } - - //전략기한 - $query = "update nation set strategic_cmd_limit={$term3} where nation='{$general['nation']}'"; - MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - - //경험치, 공헌치 - $query = "update general set dedication=dedication+'$ded',experience=experience+'$exp' where no='{$general['no']}'"; - MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - } - -// pushWorldHistory($history, $admin['year'], $admin['month']); -// pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']); - pushSabotageLog($sabotagelog); - pushGenLog($general, $log); -} - -function process_72(&$general) { - $db = DB::db(); - $gameStor = KVStorage::getStorage($db, 'game_env'); - $connect=$db->get(); - - $log = []; - $alllog = []; - $history = []; - $sabotagelog = []; - - $date = substr($general['turntime'],11,5); - - $admin = $gameStor->getValues(['year','month','develcost']); - - $query = "select nation,supply from city where city='{$general['city']}'"; - $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - $city = MYDB_fetch_array($result); - - $query = "select nation,gennum,name,type,strategic_cmd_limit,l{$general['level']}term,l{$general['level']}turn0 from nation where nation='{$general['nation']}'"; - $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - $nation = MYDB_fetch_array($result); - - $command = DecodeCommand($nation["l{$general['level']}turn0"]); - $which = $command[1]; - - $query = "select city,name,nation from city where city='$which'"; - $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - $destcity = MYDB_fetch_array($result); - - $query = "select no from diplomacy where me='{$general['nation']}' and state=0"; - $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - $dipCount = MYDB_num_rows($result); - - $genCount = Util::valueFit($nation['gennum'], GameConst::$initialNationGenLimit); - - //$term2 = Util::round($genCount / 20); - //if($term2 == 0) { $term2 = 1; } - $term2 = 1; - $term3 = Util::round(sqrt($genCount*4)*10); - - $code = $nation["l{$general['level']}term"]; - if($code%100 == 72) { - $term = intdiv($code, 100) + 1; - $code = $term * 100 + 72; - } else { - $term = 1; - $code = 100 + 72; - } - - if($city['nation'] != $general['nation']) { - $log[] = "●{$admin['month']}월:아국이 아닙니다. 백성동원 실패. <1>$date"; - } elseif($general['level'] < 5) { - $log[] = "●{$admin['month']}월:수뇌부가 아닙니다. 백성동원 실패. <1>$date"; - } elseif($dipCount == 0) { - $log[] = "●{$admin['month']}월:전쟁중이 아닙니다. 백성동원 실패. <1>$date"; - } elseif($nation['strategic_cmd_limit'] > 0) { - $log[] = "●{$admin['month']}월:전략기한이 남았습니다. 백성동원 실패. <1>$date"; - } elseif($destcity['nation'] != $general['nation']) { - $log[] = "●{$admin['month']}월:아국 도시만 가능합니다. 백성동원 실패. <1>$date"; - } elseif($term < $term2) { - $log[] = "●{$admin['month']}월:백성동원 수행중... ({$term}/{$term2}) <1>$date"; - - $query = "update nation set l{$general['level']}term={$code} where nation='{$general['nation']}'"; - MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - } else { - $log[] = "●{$admin['month']}월:백성동원 발동! <1>$date"; - $exp = 5 * $term2; - $ded = 5 * $term2; - - // 성격 보정 - $exp = CharExperience($exp, $general['personal']); - $ded = CharDedication($ded, $general['personal']); - - $josaYi = JosaUtil::pick($general['name'], '이'); - $josaYiNation = JosaUtil::pick($nation['name'], '이'); - - $query = "select no,name from general where nation='{$general['nation']}' and no!='{$general['no']}'"; - $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - $cnt = MYDB_num_rows($result); - $alllog[0] = "{$general['name']}{$josaYi} {$destcity['name']}백성동원을 발동하였습니다."; - for($i=0; $i < $cnt; $i++) { - $gen = MYDB_fetch_array($result); - pushGenLog($gen, $alllog); - } - -// $alllog[] = "●{$admin['month']}월:{$general['name']}{$josaYi} {$destcity['name']}백성동원을 발동하였습니다."; -// $history[] = "●{$admin['year']}년 {$admin['month']}월:【전략】{$nation['name']}{$josaYiNation} {$destcity['name']}백성동원을 발동하였습니다."; - $sabotagelog[] = "●{$admin['year']}년 {$admin['month']}월:【전략】{$nation['name']}{$josaYiNation} {$destcity['name']}백성동원을 발동하였습니다."; - pushGeneralHistory($general, "●{$admin['year']}년 {$admin['month']}월:{$destcity['name']}백성동원을 발동"); - pushNationHistory($nation, "●{$admin['year']}년 {$admin['month']}월:{$general['name']}{$josaYi} {$destcity['name']}백성동원을 발동"); - - //도시 성수 80% - $query = "update city set def=def_max*0.8,wall=wall_max*0.8 where city='{$destcity['city']}'"; - MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - - // 국가보정 - if($nation['type'] == 11) { $term3 = Util::round($term3 / 2); } - if($nation['type'] == 12) { $term3 = $term3 * 2; } - - //전략기한 - $query = "update nation set strategic_cmd_limit={$term3} where nation='{$general['nation']}'"; - MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - - //경험치, 공헌치 - $query = "update general set dedication=dedication+'$ded',experience=experience+'$exp' where no='{$general['no']}'"; - MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - } - -// pushWorldHistory($history, $admin['year'], $admin['month']); -// pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']); - pushSabotageLog($sabotagelog); - pushGenLog($general, $log); -} - -function process_73(&$general) { - $db = DB::db(); - $gameStor = KVStorage::getStorage($db, 'game_env'); - $connect=$db->get(); - - $log = []; - $alllog = []; - $history = []; - $sabotagelog = []; - - $date = substr($general['turntime'],11,5); - - $admin = $gameStor->getValues(['year','month','develcost']); - - $query = "select nation,supply from city where city='{$general['city']}'"; - $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - $city = MYDB_fetch_array($result); - - $query = "select nation,gennum,name,type,strategic_cmd_limit,l{$general['level']}term,l{$general['level']}turn0 from nation where nation='{$general['nation']}'"; - $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - $nation = MYDB_fetch_array($result); - - $command = DecodeCommand($nation["l{$general['level']}turn0"]); - $which = $command[1]; - - $query = "select city,name,nation from city where city='$which'"; - $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - $destcity = MYDB_fetch_array($result); - - $query = "select nation,name from nation where nation='{$destcity['nation']}'"; - $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - $destnation = MYDB_fetch_array($result); - - $query = "select state from diplomacy where me='{$general['nation']}' and you='{$destcity['nation']}'"; - $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - $dip = MYDB_fetch_array($result); - - $genCount = Util::valueFit($nation['gennum'], GameConst::$initialNationGenLimit); - - //$term2 = Util::round($genCount / 20); - //if($term2 == 0) { $term2 = 1; } - $term2 = 3; - $term3 = Util::round(sqrt($genCount*4)*10); - - $code = $nation["l{$general['level']}term"]; - if($code%100 == 73) { - $term = intdiv($code, 100) + 1; - $code = $term * 100 + 73; - } else { - $term = 1; - $code = 100 + 73; - } - - if($city['nation'] != $general['nation']) { - $log[] = "●{$admin['month']}월:아국이 아닙니다. 수몰 실패. <1>$date"; - } elseif($general['level'] < 5) { - $log[] = "●{$admin['month']}월:수뇌부가 아닙니다. 수몰 실패. <1>$date"; - } elseif($destcity['nation'] == 0) { - $log[] = "●{$admin['month']}월:공백지입니다. 수몰 실패. <1>$date"; - } elseif($destcity['nation'] == $general['nation']) { - $log[] = "●{$admin['month']}월:대상도시가 아국입니다. 수몰 실패. <1>$date"; - } elseif($dip['state'] > 0) { - $log[] = "●{$admin['month']}월:전쟁중인 상대국에만 가능합니다. 수몰 실패. <1>$date"; - } elseif($nation['strategic_cmd_limit'] > 0) { - $log[] = "●{$admin['month']}월:전략기한이 남았습니다. 수몰 실패. <1>$date"; - } elseif($term < $term2) { - $log[] = "●{$admin['month']}월:수몰 수행중... ({$term}/{$term2}) <1>$date"; - - $query = "update nation set l{$general['level']}term={$code} where nation='{$general['nation']}'"; - MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - } else { - $log[] = "●{$admin['month']}월:수몰 발동! <1>$date"; - $exp = 5 * $term2; - $ded = 5 * $term2; - - // 성격 보정 - $exp = CharExperience($exp, $general['personal']); - $ded = CharDedication($ded, $general['personal']); - - $josaYi = JosaUtil::pick($general['name'], '이'); - $josaYiNation = JosaUtil::pick($nation['name'], '이'); - - $query = "select no,name from general where nation='{$general['nation']}' and no!='{$general['no']}'"; - $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - $cnt = MYDB_num_rows($result); - $alllog[0] = "{$general['name']}{$josaYi} {$destcity['name']}수몰을 발동하였습니다."; - for($i=0; $i < $cnt; $i++) { - $gen = MYDB_fetch_array($result); - pushGenLog($gen, $alllog); - } - - $query = "select no,name from general where nation='{$destcity['nation']}'"; - $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - $cnt = MYDB_num_rows($result); - $alllog[0] = "{$destcity['name']}수몰이 발동되었습니다."; - for($i=0; $i < $cnt; $i++) { - $gen = MYDB_fetch_array($result); - pushGenLog($gen, $alllog); - } - -// $alllog[] = "●{$admin['month']}월:{$general['name']}{$josaYi} {$destcity['name']}수몰을 발동하였습니다."; -// $history[] = "●{$admin['year']}년 {$admin['month']}월:【전략】{$nation['name']}{$josaYiNation} {$destcity['name']}수몰을 발동하였습니다."; - $sabotagelog[] = "●{$admin['year']}년 {$admin['month']}월:【전략】{$nation['name']}{$josaYiNation} {$destcity['name']}수몰을 발동하였습니다."; - pushGeneralHistory($general, "●{$admin['year']}년 {$admin['month']}월:{$destcity['name']}수몰을 발동"); - pushNationHistory($nation, "●{$admin['year']}년 {$admin['month']}월:{$general['name']}{$josaYi} {$destnation['name']}{$destcity['name']}수몰을 발동"); - pushNationHistory($destnation, "●{$admin['year']}년 {$admin['month']}월:{$nation['name']}{$general['name']}{$josaYi} 아국의 {$destcity['name']}수몰을 발동"); - - //도시 성수 80% 감소 - $query = "update city set def=def*0.2,wall=wall*0.2 where city='{$destcity['city']}'"; - MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - - // 국가보정 - if($nation['type'] == 11) { $term3 = Util::round($term3 / 2); } - if($nation['type'] == 12) { $term3 = $term3 * 2; } - - //전략기한 - $query = "update nation set strategic_cmd_limit={$term3} where nation='{$general['nation']}'"; - MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - - //경험치, 공헌치 - $query = "update general set dedication=dedication+'$ded',experience=experience+'$exp' where no='{$general['no']}'"; - MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - } - -// pushWorldHistory($history, $admin['year'], $admin['month']); -// pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']); - pushSabotageLog($sabotagelog); - pushGenLog($general, $log); -} - -function process_74(&$general) { - $db = DB::db(); - $gameStor = KVStorage::getStorage($db, 'game_env'); - $connect=$db->get(); - - $log = []; - $alllog = []; - $history = []; - $sabotagelog = []; - - $date = substr($general['turntime'],11,5); - - $admin = $gameStor->getValues(['year','month','develcost']); - - $query = "select nation,supply from city where city='{$general['city']}'"; - $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - $city = MYDB_fetch_array($result); - - $query = "select nation,gennum,name,type,strategic_cmd_limit,l{$general['level']}term,l{$general['level']}turn0 from nation where nation='{$general['nation']}'"; - $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - $nation = MYDB_fetch_array($result); - - $command = DecodeCommand($nation["l{$general['level']}turn0"]); - $which = $command[1]; - - $query = "select city,name,nation from city where city='$which'"; - $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - $destcity = MYDB_fetch_array($result); - - $query = "select nation,name from nation where nation='{$destcity['nation']}'"; - $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - $destnation = MYDB_fetch_array($result); - - $query = "select state from diplomacy where me='{$general['nation']}' and you='{$destcity['nation']}'"; - $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - $dip = MYDB_fetch_array($result); - - $genCount = Util::valueFit($nation['gennum'], GameConst::$initialNationGenLimit); - - //$term2 = Util::round($genCount / 20); - //if($term2 == 0) { $term2 = 1; } - $term2 = 2; - $term3 = Util::round(sqrt($genCount*4)*10); - - $code = $nation["l{$general['level']}term"]; - if($code%100 == 74) { - $term = intdiv($code, 100) + 1; - $code = $term * 100 + 74; - } else { - $term = 1; - $code = 100 + 74; - } - - if($city['nation'] != $general['nation']) { - $log[] = "●{$admin['month']}월:아국이 아닙니다. 허보 실패. <1>$date"; - } elseif($general['level'] < 5) { - $log[] = "●{$admin['month']}월:수뇌부가 아닙니다. 허보 실패. <1>$date"; - } elseif($destcity['nation'] == 0) { - $log[] = "●{$admin['month']}월:공백지입니다. 허보 실패. <1>$date"; - } elseif($destcity['nation'] == $general['nation']) { - $log[] = "●{$admin['month']}월:대상도시가 아국입니다. 허보 실패. <1>$date"; - } elseif($dip['state'] > 1) { - $log[] = "●{$admin['month']}월:선포,전쟁중인 상대국에만 가능합니다. 허보 실패. <1>$date"; - } elseif($nation['strategic_cmd_limit'] > 0) { - $log[] = "●{$admin['month']}월:전략기한이 남았습니다. 허보 실패. <1>$date"; - } elseif($term < $term2) { - $log[] = "●{$admin['month']}월:허보 수행중... ({$term}/{$term2}) <1>$date"; - - $query = "update nation set l{$general['level']}term={$code} where nation='{$general['nation']}'"; - MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - } else { - $log[] = "●{$admin['month']}월:허보 발동! <1>$date"; - $exp = 5 * $term2; - $ded = 5 * $term2; - - // 성격 보정 - $exp = CharExperience($exp, $general['personal']); - $ded = CharDedication($ded, $general['personal']); - - $josaYi = JosaUtil::pick($general['name'], '이'); - $josaYiNation = JosaUtil::pick($nation['name'], '이'); - - $query = "select no,name from general where nation='{$general['nation']}' and no!='{$general['no']}'"; - $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - $cnt = MYDB_num_rows($result); - $alllog[0] = "{$general['name']}{$josaYi} {$destcity['name']}허보를 발동하였습니다."; - for($i=0; $i < $cnt; $i++) { - $gen = MYDB_fetch_array($result); - pushGenLog($gen, $alllog); - } - -// $alllog[] = "●{$admin['month']}월:{$general['name']}{$josaYi} {$destcity['name']}허보를 발동하였습니다."; -// $history[] = "●{$admin['year']}년 {$admin['month']}월:【전략】{$nation['name']}{$josaYiNation} {$destcity['name']}허보를 발동하였습니다."; - $sabotagelog[] = "●{$admin['year']}년 {$admin['month']}월:【전략】{$nation['name']}{$josaYiNation} {$destcity['name']}허보를 발동하였습니다."; - pushGeneralHistory($general, "●{$admin['year']}년 {$admin['month']}월:{$destcity['name']}허보를 발동"); - pushNationHistory($nation, "●{$admin['year']}년 {$admin['month']}월:{$general['name']}{$josaYi} {$destnation['name']}{$destcity['name']}허보를 발동"); - pushNationHistory($destnation, "●{$admin['year']}년 {$admin['month']}월:{$nation['name']}{$general['name']}{$josaYi} 아국의 {$destcity['name']}허보를 발동"); - - //상대국 도시 전부 검색 - $query = "select city from city where nation='{$destcity['nation']}' and supply=1"; - $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - $cityCount = MYDB_num_rows($result); - $cities = []; - for($i=0; $i < $cityCount; $i++) { - $dCity = MYDB_fetch_array($result); - $cities[$i] = $dCity['city']; - } - //상대국 유저 랜덤 배치 - $query = "select no,name from general where nation='{$destcity['nation']}' and city='{$destcity['city']}'"; - $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - $count = MYDB_num_rows($result); - $opplog = ["●상대국의 허보에 당했다! <1>$date"]; - for($i=0; $i < $count; $i++) { - $gen = MYDB_fetch_array($result); - $selCity = $cities[rand() % $cityCount]; - //현재도시이면 한번 다시 랜덤추첨 - if($selCity == $destcity['city']) { $selCity = $cities[rand() % $cityCount]; } - - $query = "update general set city={$selCity} where no='{$gen['no']}'"; - MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - - pushGenLog($gen, $opplog); - } - - // 국가보정 - if($nation['type'] == 11) { $term3 = Util::round($term3 / 2); } - if($nation['type'] == 12) { $term3 = $term3 * 2; } - - //전략기한 - $query = "update nation set strategic_cmd_limit={$term3} where nation='{$general['nation']}'"; - MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - - //경험치, 공헌치 - $query = "update general set dedication=dedication+'$ded',experience=experience+'$exp' where no='{$general['no']}'"; - MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - } - -// pushWorldHistory($history, $admin['year'], $admin['month']); -// pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']); - pushSabotageLog($sabotagelog); - pushGenLog($general, $log); -} - -function process_75(&$general) { - $db = DB::db(); - $gameStor = KVStorage::getStorage($db, 'game_env'); - $connect=$db->get(); - - $log = []; - $alllog = []; - $history = []; - $sabotagelog = []; - - $date = substr($general['turntime'],11,5); - - $admin = $gameStor->getValues(['year','month','develcost']); - - $query = "select nation,supply from city where city='{$general['city']}'"; - $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - $city = MYDB_fetch_array($result); - - $query = "select nation,gennum,name,type,strategic_cmd_limit,l{$general['level']}term,l{$general['level']}turn0 from nation where nation='{$general['nation']}'"; - $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - $nation = MYDB_fetch_array($result); - - $command = DecodeCommand($nation["l{$general['level']}turn0"]); - $which = $command[1]; - - $query = "select nation,name from nation where nation='$which'"; - $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - $destnation = MYDB_fetch_array($result); - - $query = "select state from diplomacy where me='{$general['nation']}' and you='{$destnation['nation']}'"; - $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - $dip = MYDB_fetch_array($result); - - $genCount = Util::valueFit($nation['gennum'], GameConst::$initialNationGenLimit); - - //$term2 = Util::round($genCount / 40); - //if($term2 == 0) { $term2 = 1; } - $term2 = 3; - $term3 = Util::round(sqrt($genCount*2)*10); - - $code = $nation["l{$general['level']}term"]; - if($code%100 == 75) { - $term = intdiv($code, 100) + 1; - $code = $term * 100 + 75; - } else { - $term = 1; - $code = 100 + 75; - } - - if(!$destnation) { - $log[] = "●{$admin['month']}월:없는 국가입니다. 피장파장 실패. <1>$date"; - } elseif($city['nation'] != $general['nation']) { - $log[] = "●{$admin['month']}월:아국이 아닙니다. 피장파장 실패. <1>$date"; - } elseif($general['level'] < 5) { - $log[] = "●{$admin['month']}월:수뇌부가 아닙니다. 피장파장 실패. <1>$date"; - } elseif($dip['state'] > 1) { - $log[] = "●{$admin['month']}월:선포,전쟁중인 상대국에만 가능합니다. 피장파장 실패. <1>$date"; - } elseif($nation['strategic_cmd_limit'] > 0) { - $log[] = "●{$admin['month']}월:전략기한이 남았습니다. 피장파장 실패. <1>$date"; - } elseif($term < $term2) { - $log[] = "●{$admin['month']}월:피장파장 수행중... ({$term}/{$term2}) <1>$date"; - - $query = "update nation set l{$general['level']}term={$code} where nation='{$general['nation']}'"; - MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - } else { - $log[] = "●{$admin['month']}월:피장파장 발동! <1>$date"; - $exp = 5 * $term2; - $ded = 5 * $term2; - - // 성격 보정 - $exp = CharExperience($exp, $general['personal']); - $ded = CharDedication($ded, $general['personal']); - - $josaYi = JosaUtil::pick($general['name'], '이'); - $josaYiNation = JosaUtil::pick($nation['name'], '이'); - - $query = "select no,name from general where nation='{$general['nation']}' and no!='{$general['no']}'"; - $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - $cnt = MYDB_num_rows($result); - $alllog[0] = "{$general['name']}{$josaYi} {$destnation['name']}피장파장을 발동하였습니다."; - for($i=0; $i < $cnt; $i++) { - $gen = MYDB_fetch_array($result); - pushGenLog($gen, $alllog); - } - - $query = "select no,name from general where nation='{$destnation['nation']}'"; - $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - $cnt = MYDB_num_rows($result); - $alllog[0] = "●아국에 피장파장이 발동되었습니다."; - for($i=0; $i < $cnt; $i++) { - $gen = MYDB_fetch_array($result); - pushGenLog($gen, $alllog); - } - -// $alllog[] = "●{$admin['month']}월:{$general['name']}{$josaYi} {$destnation['name']}피장파장을 발동하였습니다."; -// $history[] = "●{$admin['year']}년 {$admin['month']}월:【전략】{$nation['name']}{$josaYiNation} {$destnation['name']}피장파장을 발동하였습니다."; - $sabotagelog[] = "●{$admin['year']}년 {$admin['month']}월:【전략】{$nation['name']}{$josaYiNation} {$destnation['name']}피장파장을 발동하였습니다."; - pushGeneralHistory($general, "●{$admin['year']}년 {$admin['month']}월:{$destnation['name']}피장파장을 발동"); - pushNationHistory($nation, "●{$admin['year']}년 {$admin['month']}월:{$general['name']}{$josaYi} {$destnation['name']}피장파장을 발동"); - pushNationHistory($destnation, "●{$admin['year']}년 {$admin['month']}월:{$nation['name']}{$general['name']}{$josaYi} 아국에 피장파장을 발동"); - - //전략기한+60 - $query = "update nation set strategic_cmd_limit=strategic_cmd_limit+60 where nation='{$destnation['nation']}'"; - MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - - // 국가보정 - if($nation['type'] == 11) { $term3 = Util::round($term3 / 2); } - if($nation['type'] == 12) { $term3 = $term3 * 2; } - - //전략기한, 최소72 - if($term3 < 72) { $term3 = 72; } - $query = "update nation set strategic_cmd_limit={$term3} where nation='{$general['nation']}'"; - MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - - //경험치, 공헌치 - $query = "update general set dedication=dedication+'$ded',experience=experience+'$exp' where no='{$general['no']}'"; - MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - } - -// pushWorldHistory($history, $admin['year'], $admin['month']); -// pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']); - pushSabotageLog($sabotagelog); - pushGenLog($general, $log); -} - -function process_76(&$general) { - $db = DB::db(); - $gameStor = KVStorage::getStorage($db, 'game_env'); - $connect=$db->get(); - - $log = []; - $alllog = []; - $history = []; - $sabotagelog = []; - - $date = substr($general['turntime'],11,5); - - $admin = $gameStor->getValues(['startyear','year','month','develcost','npccount', 'turnterm', 'turntime']); - - $query = "select nation,supply from city where city='{$general['city']}'"; - $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - $city = MYDB_fetch_array($result); - - $query = "select nation,gennum,name,type,strategic_cmd_limit,l{$general['level']}term,l{$general['level']}turn0 from nation where nation='{$general['nation']}'"; - $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - $nation = MYDB_fetch_array($result); - - $genCount = Util::valueFit($nation['gennum'], GameConst::$initialNationGenLimit); - - //$term2 = Util::round($genCount / 10); - //if($term2 == 0) { $term2 = 1; } - $term2 = 3; - $term3 = Util::round(sqrt($genCount*10)*10); - - $code = $nation["l{$general['level']}term"]; - if($code%100 == 76) { - $term = intdiv($code, 100) + 1; - $code = $term * 100 + 76; - } else { - $term = 1; - $code = 100 + 76; - } - - if($admin['year'] < $admin['startyear']+3) { - $log[] = "●{$admin['month']}월:현재 초반 제한중입니다. 의병모집 실패. <1>$date"; - } elseif($city['nation'] != $general['nation']) { - $log[] = "●{$admin['month']}월:아국이 아닙니다. 의병모집 실패. <1>$date"; - } elseif($general['level'] < 5) { - $log[] = "●{$admin['month']}월:수뇌부가 아닙니다. 의병모집 실패. <1>$date"; - } elseif($nation['strategic_cmd_limit'] > 0) { - $log[] = "●{$admin['month']}월:전략기한이 남았습니다. 의병모집 실패. <1>$date"; - } elseif($term < $term2) { - $log[] = "●{$admin['month']}월:의병모집 수행중... ({$term}/{$term2}) <1>$date"; - - $query = "update nation set l{$general['level']}term={$code} where nation='{$general['nation']}'"; - MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - } else { - $log[] = "●{$admin['month']}월:의병모집 발동! <1>$date"; - $exp = 5 * $term2; - $ded = 5 * $term2; - - // 성격 보정 - $exp = CharExperience($exp, $general['personal']); - $ded = CharDedication($ded, $general['personal']); - - $josaYi = JosaUtil::pick($general['name'], '이'); - $josaYiNation = JosaUtil::pick($nation['name'], '이'); - - $query = "select no,name from general where nation='{$general['nation']}' and no!='{$general['no']}'"; - $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - $cnt = MYDB_num_rows($result); - $alllog[0] = "{$general['name']}{$josaYi} 의병모집을 발동하였습니다."; - for($i=0; $i < $cnt; $i++) { - $gen = MYDB_fetch_array($result); - pushGenLog($gen, $alllog); - } - -// $alllog[] = "●{$admin['month']}월:{$general['name']}{$josaYi} 의병모집을 발동하였습니다."; -// $history[] = "●{$admin['year']}년 {$admin['month']}월:【전략】{$nation['name']}{$josaYiNation} 의병모집을 발동하였습니다."; - $sabotagelog[] = "●{$admin['year']}년 {$admin['month']}월:【전략】{$nation['name']}{$josaYiNation} 의병모집을 발동하였습니다."; - pushGeneralHistory($general, "●{$admin['year']}년 {$admin['month']}월:의병모집을 발동"); - pushNationHistory($nation, "●{$admin['year']}년 {$admin['month']}월:{$general['name']}{$josaYi} 의병모집을 발동"); - - $avgGenNum = $db->queryFirstField('SELECT avg(gennum) FROM nation'); - $addGenCount = 5 + Util::round($avgGenNum / 10); - - $avgGen = $db->queryFirstRow('SELECT max(leadership+strength+intel) as stat_sum, avg(dedication) as ded,avg(experience) as exp, avg(dex1+dex2+dex3+dex4) as dex_t, avg(age) as age, avg(dex5) as dex5 from general where npc < 5 and nation = %i', $general['nation']); - - $dexTotal = $avgGen['dex_t']; - - //의병추가 - $npc = 4; - $npcid = Util::randRangeInt(0, 9999999); - for($i=0; $i < $addGenCount; $i++) { - //무장 50%, 지장 50%, 무지장 0% - $stat_tier1 = GameConst::$defaultStatMax - 10 + rand()%11; - $stat_tier3 = GameConst::$defaultStatMin + rand()%6; - $stat_tier2 = GameConst::$defaultStatTotal - $stat_tier1 - $stat_tier3; - $type = Util::choiceRandomUsingWeight([ - 'strength0'=>1, - 'strength1'=>1, - 'strength_exp'=>1, - 'intel'=>3, - 'neutral'=>0 - ]); - switch($type){ - case 'strength0': - $leadership = $stat_tier1; - $strength = $stat_tier2; - $intel = $stat_tier3; - $dexVal = [$dexTotal*5/8, $dexTotal/8, $dexTotal/8, $dexTotal/8]; - break; - case 'strength1': - $leadership = $stat_tier1; - $strength = $stat_tier2; - $intel = $stat_tier3; - $dexVal = [$dexTotal/8, $dexTotal*5/8, $dexTotal/8, $dexTotal/8]; - break; - case 'strength_exp': - $leadership = $stat_tier1; - $strength = $stat_tier2; - $intel = $stat_tier3; - $dexVal = [$dexTotal/8, $dexTotal/8, $dexTotal*5/8, $dexTotal/8]; - break; - case 'intel': - $leadership = $stat_tier1; - $strength = $stat_tier3; - $intel = $stat_tier2; - $dexVal = [$dexTotal/8, $dexTotal/8, $dexTotal/8, $dexTotal*5/8]; - break; - default: - $leadership = $stat_tier3; - $strength = $stat_tier1; - $intel = $stat_tier2; - $dexVal = [$dexTotal/4, $dexTotal/4, $dexTotal/4, $dexTotal/4]; - break; - } - // 국내 최고능치 기준으로 랜덤성 스케일링 - if($avgGen['stat_sum'] > 210) { - $leadership = Util::round($leadership * $avgGen['stat_sum'] / GameConst::$defaultStatTotal * (60+rand()%31)/100); - $strength = Util::round($strength * $avgGen['stat_sum'] / GameConst::$defaultStatTotal * (60+rand()%31)/100); - $intel = Util::round($intel * $avgGen['stat_sum'] / GameConst::$defaultStatTotal * (60+rand()%31)/100); - } elseif($avgGen['stat_sum'] > 180) { - $leadership = Util::round($leadership * $avgGen['stat_sum'] / GameConst::$defaultStatTotal * (75+rand()%21)/100); - $strength = Util::round($strength * $avgGen['stat_sum'] / GameConst::$defaultStatTotal * (75+rand()%21)/100); - $intel = Util::round($intel * $avgGen['stat_sum'] / GameConst::$defaultStatTotal * (75+rand()%21)/100); - } else { - $leadership = Util::round($leadership * $avgGen['stat_sum'] / GameConst::$defaultStatTotal * (90+rand()%11)/100); - $strength = Util::round($strength * $avgGen['stat_sum'] / GameConst::$defaultStatTotal * (90+rand()%11)/100); - $intel = Util::round($intel * $avgGen['stat_sum'] / GameConst::$defaultStatTotal * (90+rand()%11)/100); - } - $over1 = 0; - $over2 = 0; - $over3 = 0; - // 너무 높은 능치는 다른 능치로 분산 - if($leadership > 90) { - $over1 = rand() % ($leadership - 90) + 5; - $leadership -= $over1; - } - if($strength > 90) { - $over2 = rand() % ($strength - 90) + 5; - $strength -= $over2; - } - if($intel > 90) { - $over3 = rand() % ($intel - 90) + 5; - $intel -= $over3; - } - // 낮은 능치쪽으로 합산 - if($type == 'strength') { - $intel = $intel + $over1 + $over2 + $over3; - } else { - $strength = $strength + $over1 + $over2 + $over3; - } - // 너무 높은 능치는 제한 - if($leadership > GameConst::$defaultStatNPCMax) { - $leadership = GameConst::$defaultStatNPCMax; - } - if($strength > GameConst::$defaultStatNPCMax) { - $strength = GameConst::$defaultStatNPCMax; - } - if($intel > GameConst::$defaultStatNPCMax) { - $intel = GameConst::$defaultStatNPCMax; - } - - $affinity = rand() % 150 + 1; - $name = "ⓖ의병장{$npcid}"; - $picture = 'default.jpg'; - $turntime = getRandTurn($admin['turnterm'], new \DateTimeImmutable($admin['turntime'])); - $personal = rand() % 10; - $bornyear = $admin['year']; - $deadyear = $admin['year'] + 3; - $killturn = 64 + rand()%7; - - @MYDB_query(" - insert into general ( - npc,npc_org,affinity,name,picture,nation, - city,leadership,strength,intel,experience,dedication, - level,gold,rice,crew,crewtype,train,atmos,tnmt, - weapon,book,horse,turntime,killturn,age,belong,personal,special,specage,special2,specage2,npcmsg, - makelimit,bornyear,deadyear, - dex1, dex2, dex3, dex4, dex5 - ) values ( - '$npc','$npc','$affinity','$name','$picture','{$nation['nation']}', - '{$general['city']}','$leadership','$strength','$intel','{$avgGen['exp']}','{$avgGen['ded']}', - '1','100','100','0','".GameUnitConst::DEFAULT_CREWTYPE."','0','0','0', - '0','0','0','$turntime','$killturn','{$avgGen['age']}','1','$personal','0','0','0','0','', - '0','$bornyear','$deadyear', - '{$dexVal[0]}','{$dexVal[1]}','{$dexVal[2]}','{$dexVal[3]}','{$avgGen['dex5']}' - )", - $connect - ) or Error(__LINE__.MYDB_error($connect),""); - - $npcid++; - } - - // 국가보정 - if($nation['type'] == 11) { $term3 = Util::round($term3 / 2); } - if($nation['type'] == 12) { $term3 = $term3 * 2; } - - //전략기한 - $db->update('nation', [ - 'strategic_cmd_limit'=>$term3, - 'gennum'=>$db->sqleval('gennum + %i', $addGenCount), - ], 'nation=%i', $general['nation']); - - //경험치, 공헌치 - $query = "update general set dedication=dedication+'$ded',experience=experience+'$exp' where no='{$general['no']}'"; - MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - } - -// pushWorldHistory($history, $admin['year'], $admin['month']); -// pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']); - pushSabotageLog($sabotagelog); - pushGenLog($general, $log); -} - function process_77(&$general) { $db = DB::db(); $gameStor = KVStorage::getStorage($db, 'game_env'); diff --git a/hwe/j_get_general_list.php b/hwe/j_get_general_list.php index 00dcbdcb..e8d42d8b 100644 --- a/hwe/j_get_general_list.php +++ b/hwe/j_get_general_list.php @@ -42,7 +42,7 @@ else{ $session->setReadOnly(); -$rawGeneralList = $db->queryAllLists('SELECT owner,no,picture,imgsvr,npc,age,nation,special,special2,personal,name,name2,injury,leadership,strength,intel,experience,dedication,level,killturn,connect from general'); +$rawGeneralList = $db->queryAllLists('SELECT owner,no,picture,imgsvr,npc,age,nation,special,special2,personal,name,owner_name as ownerName,injury,leadership,strength,intel,experience,dedication,level,killturn,connect from general'); $ownerNameList = []; if($gameStor->isunited){ @@ -53,10 +53,10 @@ if($gameStor->isunited){ $generalList = []; foreach($rawGeneralList as $rawGeneral){ - [$owner,$no,$picture,$imgsvr,$npc,$age,$nation,$special,$special2,$personal,$name,$name2,$injury,$leadership,$strength,$intel,$experience,$dedication,$level,$killturn,$connect] = $rawGeneral; + [$owner,$no,$picture,$imgsvr,$npc,$age,$nation,$special,$special2,$personal,$name,$ownerName,$injury,$leadership,$strength,$intel,$experience,$dedication,$level,$killturn,$connect] = $rawGeneral; if(key_exists($owner, $ownerNameList)){ - $name2 = $ownerNameList[$owner]; + $ownerName = $ownerNameList[$owner]; } $nationArr = getNationStaticInfo($nation); @@ -73,7 +73,7 @@ foreach($rawGeneralList as $rawGeneral){ getGeneralSpecialWarName($special2), getGenChar($personal), $name, - $npc==1?$name2:null, + $npc==1?$ownerName:null, $injury, $leadership, $lbonus, diff --git a/hwe/j_select_npc.php b/hwe/j_select_npc.php index d24cf239..8777dfce 100644 --- a/hwe/j_select_npc.php +++ b/hwe/j_select_npc.php @@ -73,7 +73,7 @@ if ($gencount >= $maxgeneral) { //등록 시작 $db->update('general', [ - 'name2'=>$userNick, + 'owner_name'=>$userNick, 'npc'=>1, 'killturn'=>6, 'defence_train'=>80, diff --git a/hwe/join_post.php b/hwe/join_post.php index 11646956..bba1be26 100644 --- a/hwe/join_post.php +++ b/hwe/join_post.php @@ -221,7 +221,7 @@ $affinity = rand()%150 + 1; $db->insert('general', [ 'owner' => $userID, 'name' => $name, - 'name2' => $member['name'], + 'owner_name' => $member['name'], 'picture' => $face, 'imgsvr' => $imgsvr, 'nation' => 0, diff --git a/hwe/js/select_npc.js b/hwe/js/select_npc.js index b737b949..943d493f 100644 --- a/hwe/js/select_npc.js +++ b/hwe/js/select_npc.js @@ -179,7 +179,7 @@ function printGeneralList(value){ special2:general[7], personal:general[8], name:general[9], - name2:general[10], + ownerName:general[10], injury:general[11], leadership:general[12], lbonus:general[13], @@ -213,8 +213,8 @@ function printGeneralList(value){ general.userCSS = 'color:skyblue'; } - if(general.name2){ - general.nameAux += '
({0})'.format(general.name2); + if(general.ownerName){ + general.nameAux += '
({0})'.format(general.ownerName); } if(general.reserved == 1){ diff --git a/hwe/sammo/GameConstBase.php b/hwe/sammo/GameConstBase.php index c669ccda..009553af 100644 --- a/hwe/sammo/GameConstBase.php +++ b/hwe/sammo/GameConstBase.php @@ -319,7 +319,8 @@ class GameConstBase //'che_급습', ], '기타'=>[ - //'che_국기변경' + //'che_국기변경', + //'che_국호변경', ] ]; public static $retirementYear = 80; diff --git a/hwe/sammo/General.php b/hwe/sammo/General.php index aa9fd1e3..b47631be 100644 --- a/hwe/sammo/General.php +++ b/hwe/sammo/General.php @@ -833,7 +833,7 @@ class General implements iAction{ 'horse', 'weapon', 'book', 'item', 'last_turn' ]; $fullColumn = [ - 'no', 'name', 'name2', 'picture', 'imgsvr', 'nation', 'city', 'troop', 'injury', 'affinity', + 'no', 'name', 'owner_name', 'picture', 'imgsvr', 'nation', 'city', 'troop', 'injury', 'affinity', 'leadership', 'leadership_exp', 'strength', 'strength_exp', 'intel', 'intel_exp', 'weapon', 'book', 'horse', 'item', 'experience', 'dedication', 'level', 'gold', 'rice', 'crew', 'crewtype', 'train', 'atmos', 'turntime', 'makelimit', 'killturn', 'block', 'dedlevel', 'explevel', 'age', 'startage', 'belong', diff --git a/hwe/sammo/TextDecoration/DyingMessage.php b/hwe/sammo/TextDecoration/DyingMessage.php index 4d2e10e6..464cda62 100644 --- a/hwe/sammo/TextDecoration/DyingMessage.php +++ b/hwe/sammo/TextDecoration/DyingMessage.php @@ -98,7 +98,7 @@ class DyingMessage{ $this->name = $general->getName(); $this->npc = $general->getVar('npc'); if($general->getVar('owner') > 0 && $general->getVar('startage') - $general->getVar('age') > 1){ - $this->realName = $general->getVar('name2'); + $this->realName = $general->getVar('owner_name'); } } diff --git a/hwe/sammo/TurnExecutionHelper.php b/hwe/sammo/TurnExecutionHelper.php index c98a06d9..8dd72b37 100644 --- a/hwe/sammo/TurnExecutionHelper.php +++ b/hwe/sammo/TurnExecutionHelper.php @@ -176,7 +176,7 @@ class TurnExecutionHelper // npc유저 삭턴시 npc로 전환 if($general->getVar('npc') == 1 && $general->getVar('deadyear') > $gameStor->year){ - $ownerName = $general->getVar('name2'); + $ownerName = $general->getVar('owner_name'); $josaYi = JosaUtil::pick($ownerName, '이'); $logger->pushGlobalActionLog("{$ownerName}{$josaYi} {$generalName}의 육체에서 유체이탈합니다!"); @@ -185,7 +185,7 @@ class TurnExecutionHelper $general->setVar('npc', $general->getVar('npc_org')); $general->setVar('owner', 1); $general->setVar('defence_train', 80); - $general->setVar('name2', null); + $general->setVar('owner_name', null); } else{ $general->applyDB($db); diff --git a/hwe/sql/schema.sql b/hwe/sql/schema.sql index fc597988..0f4c0b1c 100644 --- a/hwe/sql/schema.sql +++ b/hwe/sql/schema.sql @@ -20,7 +20,7 @@ CREATE TABLE `general` ( `picture` VARCHAR(40) NOT NULL, `imgsvr` INT(1) NOT NULL DEFAULT '0', `name` CHAR(32) NOT NULL COLLATE 'utf8mb4_bin', - `name2` CHAR(32) NULL DEFAULT NULL COLLATE 'utf8mb4_bin', + `owner_name` CHAR(32) NULL DEFAULT NULL COLLATE 'utf8mb4_bin', `nation` INT(6) NOT NULL DEFAULT '0', `city` INT(6) NOT NULL DEFAULT '3', `troop` INT(6) NOT NULL DEFAULT '0', diff --git a/hwe/templates/hallOfFrame.php b/hwe/templates/hallOfFrame.php index 54426b14..013b4b02 100644 --- a/hwe/templates/hallOfFrame.php +++ b/hwe/templates/hallOfFrame.php @@ -16,8 +16,8 @@

- -

()
+ +
()

희생된 장수지력 명성 계급
{$name}{$general['name2']}{$general['owner_name']} Lv {$general['explevel']} {$nation} ".displayCharInfo($general['personal'])."