정적 분석 결과 반영

This commit is contained in:
2018-04-06 23:18:42 +09:00
parent 0639fc3b83
commit cfb2a2dbd5
14 changed files with 197 additions and 146 deletions
+2
View File
@@ -13,6 +13,8 @@ return [
// of the php executable used to execute phan. // of the php executable used to execute phan.
"target_php_version" => '7.0', "target_php_version" => '7.0',
'backward_compatibility_checks ' => false, 'backward_compatibility_checks ' => false,
'ignore_undeclared_variables_in_global_scope' => false,
'minimum_severity'=>\Phan\Issue::SEVERITY_NORMAL,
'file_list' => [ 'file_list' => [
'f_config/config.php', 'f_config/config.php',
+3 -3
View File
@@ -97,9 +97,9 @@ if($me['level'] == 0) {
if($myNation['level'] > 0) { if($myNation['level'] > 0) {
// 첩보도시도 목록에 추가 // 첩보도시도 목록에 추가
$where = 'city=0'; $where = 'city=0';
$citys = explode("|", $myNation['spy']); $cities = explode("|", $myNation['spy']);
for($i=0; $i < count($citys); $i++) { for($i=0; $i < count($cities); $i++) {
$city = floor($citys[$i]/10); $city = floor($cities[$i]/10);
$where .= " or city='{$city}'"; $where .= " or city='{$city}'";
} }
+20 -20
View File
@@ -388,20 +388,20 @@ function getLevelPer($exp, $level) {
return $per; return $per;
} }
function getBill($dedication) { function getBill(int $dedication) : int{
for($level = 0; $dedication > (($level+1)*($level+1)*100); $level++) { for($level = 0; $dedication > (($level+1)*($level+1)*100); $level++) {
} }
return ($level * 200 + 400); return ($level * 200 + 400);
} }
function getCost(int $armtype) { function getCost(int $armtype) : int {
//FIXME: 정말로 side effect가 없으려면 query는 밖으로 이동해야함. //FIXME: 정말로 side effect가 없으려면 query는 밖으로 이동해야함.
//TODO: 병종 값이 column으로 들어있는건 전혀 옳지 않음. key->value 형태로 바꿔야함 //TODO: 병종 값이 column으로 들어있는건 전혀 옳지 않음. key->value 형태로 바꿔야함
return DB::db()->queryFirstColumn('select %b from game limit 1', sprintf('cst%d', $armtype)); return DB::db()->queryFirstColumn('select %b from game limit 1', sprintf('cst%d', $armtype));
} }
function TechLimit($startyear, $year, $tech) { function TechLimit($startyear, $year, $tech) : int {
$limit = 0; $limit = 0;
if($year < $startyear+ 5 && $tech >= 1000) { $limit = 1; } if($year < $startyear+ 5 && $tech >= 1000) { $limit = 1; }
if($year < $startyear+10 && $tech >= 2000) { $limit = 1; } if($year < $startyear+10 && $tech >= 2000) { $limit = 1; }
@@ -418,7 +418,7 @@ function TechLimit($startyear, $year, $tech) {
return $limit; return $limit;
} }
function getTechAbil($tech) { function getTechAbil($tech) : int{
if($tech < 1000) { $abil = 0; } if($tech < 1000) { $abil = 0; }
elseif($tech < 2000) { $abil = 25; } elseif($tech < 2000) { $abil = 25; }
elseif($tech < 3000) { $abil = 50; } elseif($tech < 3000) { $abil = 50; }
@@ -435,7 +435,7 @@ function getTechAbil($tech) {
return $abil; return $abil;
} }
function getTechCost($tech) { function getTechCost($tech) : float{
if($tech < 1000) { $cost = 1.00; } if($tech < 1000) { $cost = 1.00; }
elseif($tech < 2000) { $cost = 1.15; } elseif($tech < 2000) { $cost = 1.15; }
elseif($tech < 3000) { $cost = 1.30; } elseif($tech < 3000) { $cost = 1.30; }
@@ -452,7 +452,7 @@ function getTechCost($tech) {
return $cost; return $cost;
} }
function getTechCall($tech) { function getTechCall($tech) : string {
if($tech < 1000) { $str = '0등급'; } if($tech < 1000) { $str = '0등급'; }
elseif($tech < 2000) { $str = '1등급'; } elseif($tech < 2000) { $str = '1등급'; }
elseif($tech < 3000) { $str = '2등급'; } elseif($tech < 3000) { $str = '2등급'; }
@@ -469,7 +469,7 @@ function getTechCall($tech) {
return $str; return $str;
} }
function getDexCall($dex) { function getDexCall($dex) : string {
if($dex < 2500) { $str = '<font color="navy">F-</font>'; } if($dex < 2500) { $str = '<font color="navy">F-</font>'; }
elseif($dex < 7500) { $str = '<font color="navy">F</font>'; } elseif($dex < 7500) { $str = '<font color="navy">F</font>'; }
elseif($dex < 15000) { $str = '<font color="navy">F+</font>'; } elseif($dex < 15000) { $str = '<font color="navy">F+</font>'; }
@@ -504,7 +504,7 @@ function getDexCall($dex) {
return $str; return $str;
} }
function getDexLevel($dex) { function getDexLevel($dex) : int {
if($dex < 2500) { $lvl = 0; } if($dex < 2500) { $lvl = 0; }
elseif($dex < 7500) { $lvl = 1; } elseif($dex < 7500) { $lvl = 1; }
elseif($dex < 15000) { $lvl = 2; } elseif($dex < 15000) { $lvl = 2; }
@@ -545,7 +545,7 @@ function getDexLog($dex1, $dex2) {
} }
function getWeapName($weap) { function getWeapName($weap) : string {
switch($weap) { switch($weap) {
case 0: $weapname = '-'; break; case 0: $weapname = '-'; break;
case 1: $weapname = '단도(+1)'; break; case 1: $weapname = '단도(+1)'; break;
@@ -579,7 +579,7 @@ function getWeapName($weap) {
return $weapname; return $weapname;
} }
function getWeapEff($weap) { function getWeapEff($weap) : int{
switch($weap) { switch($weap) {
case 7: $weap = 7; break; case 7: $weap = 7; break;
case 8: $weap = 7; break; case 8: $weap = 7; break;
@@ -606,7 +606,7 @@ function getWeapEff($weap) {
return $weap; return $weap;
} }
function getBookName($book) { function getBookName($book) : string {
switch($book) { switch($book) {
case 0: $bookname = '-'; break; case 0: $bookname = '-'; break;
case 1: $bookname = '효경전(+1)'; break; case 1: $bookname = '효경전(+1)'; break;
@@ -640,7 +640,7 @@ function getBookName($book) {
return $bookname; return $bookname;
} }
function getBookEff($book) { function getBookEff($book) : int {
switch($book) { switch($book) {
case 7: $book = 7; break; case 7: $book = 7; break;
case 8: $book = 7; break; case 8: $book = 7; break;
@@ -667,7 +667,7 @@ function getBookEff($book) {
return $book; return $book;
} }
function getHorseName($horse) { function getHorseName($horse) : string {
switch($horse) { switch($horse) {
case 0: $horsename = '-'; break; case 0: $horsename = '-'; break;
case 1: $horsename = '노기(+1)'; break; case 1: $horsename = '노기(+1)'; break;
@@ -701,7 +701,7 @@ function getHorseName($horse) {
return $horsename; return $horsename;
} }
function getHorseEff($horse) { function getHorseEff($horse) : int {
switch($horse) { switch($horse) {
case 7: $horse = 7; break; case 7: $horse = 7; break;
case 8: $horse = 7; break; case 8: $horse = 7; break;
@@ -728,7 +728,7 @@ function getHorseEff($horse) {
return $horse; return $horse;
} }
function getItemName($item) { function getItemName($item) : string {
switch($item) { switch($item) {
case 0: $itemname = '-'; break; case 0: $itemname = '-'; break;
case 1: $itemname = '환약(치료)'; break; case 1: $itemname = '환약(치료)'; break;
@@ -762,7 +762,7 @@ function getItemName($item) {
return $itemname; return $itemname;
} }
function getItemCost2($weap) { function getItemCost2($weap) : int {
switch($weap) { switch($weap) {
case 0: $weapcost = 0; break; case 0: $weapcost = 0; break;
case 1: $weapcost = 100; break; case 1: $weapcost = 100; break;
@@ -776,7 +776,7 @@ function getItemCost2($weap) {
return $weapcost; return $weapcost;
} }
function getItemCost($weap) { function getItemCost($weap) : int {
switch($weap) { switch($weap) {
case 0: $weapcost = 0; break; case 0: $weapcost = 0; break;
case 1: $weapcost = 1000; break; case 1: $weapcost = 1000; break;
@@ -792,7 +792,7 @@ function getItemCost($weap) {
function ConvertLog($str, $type=1) { function ConvertLog(string $str, $type=1) : string {
//TODO: 이 함수는 없애야 한다. CSS로 대신하자 //TODO: 이 함수는 없애야 한다. CSS로 대신하자
if($type > 0) { if($type > 0) {
$str = str_replace("<1>", "<font size=1>", $str); $str = str_replace("<1>", "<font size=1>", $str);
@@ -833,7 +833,7 @@ function ConvertLog($str, $type=1) {
function newColor($color) { function newColor($color) : string {
switch($color) { switch($color) {
case "": case "":
case "#330000": case "#330000":
@@ -860,6 +860,6 @@ function newColor($color) {
return $color; return $color;
} }
function backColor($color) { function backColor($color) : string {
return newColor($color); return newColor($color);
} }
+15 -10
View File
@@ -458,7 +458,6 @@ function preUpdateMonthly() {
for($i=0; $i < $gencount; $i++) { for($i=0; $i < $gencount; $i++) {
$general = MYDB_fetch_array($result); $general = MYDB_fetch_array($result);
unset($log);
$log = []; $log = [];
$log = checkDedication($general, $log); $log = checkDedication($general, $log);
$log = checkExperience($general, $log); $log = checkExperience($general, $log);
@@ -472,14 +471,14 @@ function preUpdateMonthly() {
for($i=0; $i < $nationCount; $i++) { for($i=0; $i < $nationCount; $i++) {
$nation = MYDB_fetch_array($result); $nation = MYDB_fetch_array($result);
$spy = ""; $k = 0; $spy = ""; $k = 0;
$citys = []; $cities = [];
if($nation['spy'] != "") { $citys = explode("|", (string)$nation['spy']); } if($nation['spy'] != "") { $cities = explode("|", (string)$nation['spy']); }
while(count($citys)) { while(count($cities)) {
$citys[$k]--; $cities[$k]--;
if($citys[$k]%10 != 0) { $spy .= (string)$citys[$k]; } if($cities[$k]%10 != 0) { $spy .= (string)$cities[$k]; }
$k++; $k++;
if($k >= count($citys)) { break; } if($k >= count($cities)) { break; }
if($citys[$k-1]%10 != 0) { $spy .= "|"; } if($cities[$k-1]%10 != 0) { $spy .= "|"; }
} }
$query = "update nation set spy='$spy' where nation='{$nation['nation']}'"; $query = "update nation set spy='$spy' where nation='{$nation['nation']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
@@ -497,6 +496,8 @@ function postUpdateMonthly() {
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$admin = MYDB_fetch_array($result); $admin = MYDB_fetch_array($result);
$history = [];
//각 국가 전월 장수수 대비 당월 장수수로 단합도 산정 //각 국가 전월 장수수 대비 당월 장수수로 단합도 산정
//각 국가 장수수를 구하고 국력 산정 //각 국가 장수수를 구하고 국력 산정
// $query = "select nation,gennum from nation where level>0"; // $query = "select nation,gennum from nation where level>0";
@@ -531,6 +532,7 @@ group by A.nation
"; ";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$nationCount = MYDB_num_rows($result); $nationCount = MYDB_num_rows($result);
$genNum = [];
for($i=0; $i < $nationCount; $i++) { for($i=0; $i < $nationCount; $i++) {
$nation = MYDB_fetch_array($result); $nation = MYDB_fetch_array($result);
$genNum[$nation['nation']] = $nation['gennum']; $genNum[$nation['nation']] = $nation['gennum'];
@@ -573,6 +575,7 @@ group by A.nation
$query = "select me,you from diplomacy where state='1' and term<='1' and me<you"; $query = "select me,you from diplomacy where state='1' and term<='1' and me<you";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$dipCount = MYDB_num_rows($result); $dipCount = MYDB_num_rows($result);
for($i=0; $i < $dipCount; $i++) { for($i=0; $i < $dipCount; $i++) {
$dip = MYDB_fetch_array($result); $dip = MYDB_fetch_array($result);
$nation1 = getNationStaticInfo($dip['me']); $nation1 = getNationStaticInfo($dip['me']);
@@ -585,7 +588,6 @@ group by A.nation
$query = "select A.me as me,A.you as you,A.term as term1,B.term as term2 from diplomacy A, diplomacy B where A.me=B.you and A.you=B.me and A.state='0' and A.me<A.you"; $query = "select A.me as me,A.you as you,A.term as term1,B.term as term2 from diplomacy A, diplomacy B where A.me=B.you and A.you=B.me and A.state='0' and A.me<A.you";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$dipCount = MYDB_num_rows($result); $dipCount = MYDB_num_rows($result);
$history = array();
for($i=0; $i < $dipCount; $i++) { for($i=0; $i < $dipCount; $i++) {
$dip = MYDB_fetch_array($result); $dip = MYDB_fetch_array($result);
@@ -1009,6 +1011,8 @@ function checkStatistic() {
$nationHists = []; $nationHists = [];
$specialHists = []; $specialHists = [];
$personalHists = [];
$specialHists2 = [0];
$etc = ''; $etc = '';
@@ -1245,6 +1249,7 @@ function checkEmperior() {
$query = "select no,name from general where nation='{$nation['nation']}' order by dedication desc"; $query = "select no,name from general where nation='{$nation['nation']}' order by dedication desc";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$gencount = MYDB_num_rows($result); $gencount = MYDB_num_rows($result);
$gen = '';
for($i=0; $i < $gencount; $i++) { for($i=0; $i < $gencount; $i++) {
$general = MYDB_fetch_array($result); $general = MYDB_fetch_array($result);
$gen .= "{$general['name']}, "; $gen .= "{$general['name']}, ";
@@ -1301,7 +1306,7 @@ function checkEmperior() {
)"; )";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$history[] = "<C>●</>{$admin['year']}{$admin['month']}월:<Y><b>【통일】</b></><D><b>{$nation['name']}</b></>(이)가 전토를 통일하였습니다."; $history = ["<C>●</>{$admin['year']}{$admin['month']}월:<Y><b>【통일】</b></><D><b>{$nation['name']}</b></>(이)가 전토를 통일하였습니다."];
pushWorldHistory($history, $admin['year'], $admin['month']); pushWorldHistory($history, $admin['year'], $admin['month']);
//연감 월결산 //연감 월결산
+8 -4
View File
@@ -7,7 +7,9 @@ class Message{
public $mailbox; public $mailbox;
public $type; public $type;
public $isSender; public $isSender;
/** @var mixed[] */
public $src; public $src;
/** @var mixed[] */
public $dest; public $dest;
public $time; public $time;
public $text; public $text;
@@ -35,7 +37,7 @@ class Message{
$this->dest['nation_id'] = null; $this->dest['nation_id'] = null;
} }
$this->datetime = $row['time']; $this->time = $row['time'];
$this->text = $db_message['text']; $this->text = $db_message['text'];
$this->option = $db_message['option']; $this->option = $db_message['option'];
} }
@@ -119,7 +121,7 @@ function sendRawMessage($msgType, $isSender, $mailbox, $src, $dest, $msg, $date,
$dest['nation'] = Util::array_get($destNation['name'], '재야'); $dest['nation'] = Util::array_get($destNation['name'], '재야');
$dest['color'] = Util::array_get($destNation['color'], '#ffffff'); $dest['color'] = Util::array_get($destNation['color'], '#ffffff');
if(!$isSender && $mailBox < 9000 && Util::array_get($msgOption['alert'], false)){ if(!$isSender && $mailbox < 9000 && Util::array_get($msgOption['alert'], false)){
//TODO:newmsg보단 lastmsg로 datetime을 넣는게 더 나아보임 //TODO:newmsg보단 lastmsg로 datetime을 넣는게 더 나아보임
DB::db()->update('general', array( DB::db()->update('general', array(
'newmsg' => true 'newmsg' => true
@@ -149,7 +151,7 @@ function sendRawMessage($msgType, $isSender, $mailbox, $src, $dest, $msg, $date,
function sendMessage($msgType, $src, $dest, $msg, $date = null, $validUntil = null, $msgOption = null){ function sendMessage($msgType, $src, $dest, $msg, $date = null, $validUntil = null, $msgOption = null){
if($date === null){ if($date === null){
$date = $datetime->format('Y-m-d H:i:s'); $date = (new \Datetime())->format('Y-m-d H:i:s');
} }
if($validUntil === null){ if($validUntil === null){
@@ -252,7 +254,7 @@ function getMailboxList(){
"color"=>"#ffffff" "color"=>"#ffffff"
]; ];
$result = array_map(function($nation){ $result = array_map(function($nation) use ($generalNations) {
$nationID = $nation['nation']; $nationID = $nation['nation'];
$mailbox = $nationID + 9000; $mailbox = $nationID + 9000;
$nation = $nation['name']; $nation = $nation['name'];
@@ -300,6 +302,7 @@ function DecodeMsg($msg, $type, $who, $date, $bg, $num=0) {
$sndr = MYDB_fetch_array($result); $sndr = MYDB_fetch_array($result);
if($sndr['nation'] == 0) { if($sndr['nation'] == 0) {
$sndrnation = [];
$sndrnation['name'] = '재야'; $sndrnation['name'] = '재야';
$sndrnation['color'] = '#FFFFFF'; $sndrnation['color'] = '#FFFFFF';
} else { } else {
@@ -327,6 +330,7 @@ function DecodeMsg($msg, $type, $who, $date, $bg, $num=0) {
$rcvr = MYDB_fetch_array($result); $rcvr = MYDB_fetch_array($result);
if($rcvr['nation'] == 0) { if($rcvr['nation'] == 0) {
$rcvrnation = [];
$rcvrnation['name'] = '재야'; $rcvrnation['name'] = '재야';
$rcvrnation['color'] = '#FFFFFF'; $rcvrnation['color'] = '#FFFFFF';
} else { } else {
+1
View File
@@ -84,6 +84,7 @@ function SetCrew($no, $personal, $gold, $leader, $genType, $tech, $region, $city
$db = DB::db(); $db = DB::db();
$connect=$db->get(); $connect=$db->get();
$type = 0;
switch($genType) { switch($genType) {
case 0: //무장 case 0: //무장
case 2: //무내정장 case 2: //무내정장
+39 -22
View File
@@ -107,27 +107,41 @@ function getGeneralIntel(&$general, $withInjury, $withItem, $withStatAdjust, $us
* @return array 계산된 실패, 성공 확률 ('succ' => 성공 확률, 'fail' => 실패 확률) * @return array 계산된 실패, 성공 확률 ('succ' => 성공 확률, 'fail' => 실패 확률)
*/ */
function CriticalRatioDomestic(&$general, $type) { function CriticalRatioDomestic(&$general, $type) {
$leader = getGeneralLeadership($general, false, true, false, false); $leader = getGeneralLeadership($general, false, true, true, false);
$power = getGeneralPower($general, false, true, false, false); $power = getGeneralPower($general, false, true, true, false);
$intel = getGeneralIntel($general, false, true, false, false); $intel = getGeneralIntel($general, false, true, true, false);
$avg = ($leader+$power+$intel) / 3; $avg = ($leader+$power+$intel) / 3;
// 707010장수 18/21% 706515장수 16/27% 706020장수 14/33% xx50xx장수 10/50% /*
* 능력치가 높아질 수록 성공 확률 감소. 실패 확률도 감소
* 무력 내정 기준(지력 내정 방식과 구조 동일)
756510(32%/30%), 707010(28%/25%), 657510(23%/20%)
106575(23%/20%), 107070(20%/17%), 107565(17%/15%)
506040(33%/30%), 505050(43%/40%), 504060(50%/50%)
* 통솔 내정 기준
756510(25%/22%), 707010(31%/28%), 657510(38%,35%),
505050(50%,50%), 107070(50%,50%)
*/
switch($type) { switch($type) {
case 0: $ratio = $avg / $leader; break; case 0: $ratio = $avg / $leader; break;
case 1: $ratio = $avg / $power; break; case 1: $ratio = $avg / $power; break;
case 2: $ratio = $avg / $intel; break; case 2: $ratio = $avg / $intel; break;
} }
if($ratio > 1) $ratio = 1; $ratio = min($ratio, 1.2);
$r['fail'] = (0.2 / $ratio - 0.1) * 100; $fail = pow($ratio / 1.2, 1.4) - 0.3;
$r['succ'] = ($ratio - 0.5) * 100; $succ = pow($ratio / 1.2, 1.5) - 0.25;
if($r['fail'] < 0) { $r['fail'] = 0; } $fail = min(max($fail, 0), 0.5);
$r['succ'] += $r['fail']; $succ = min(max($succ, 0), 0.5);
if($r['succ'] > 100) { $r['succ'] = 100; }
return $r;
return array(
'succ'=>$succ,
'fail'=>$fail
);
} }
/** /**
@@ -1456,7 +1470,7 @@ function process_26(&$general) {
$ded = CharDedication($ded, $general['personal']); $ded = CharDedication($ded, $general['personal']);
//부대원에게 로그 전달 //부대원에게 로그 전달
$genlog[] = "<C>●</><S>{$troop['name']}</>의 부대원들은 <G><b>{$city['name']}</b></>(으)로 집합되었습니다."; $genlog = ["<C>●</><S>{$troop['name']}</>의 부대원들은 <G><b>{$city['name']}</b></>(으)로 집합되었습니다."];
for($i=0; $i < $gencount; $i++) { for($i=0; $i < $gencount; $i++) {
$troopgen = MYDB_fetch_array($result); $troopgen = MYDB_fetch_array($result);
@@ -1602,7 +1616,7 @@ function process_30(&$general) {
$query = "select no,name from general where nation='{$general['nation']}' and level<'12'"; $query = "select no,name from general where nation='{$general['nation']}' and level<'12'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$gencount = MYDB_num_rows($result); $gencount = MYDB_num_rows($result);
$genlog[0] = "<C>●</>방랑군 세력이 <G><b>{$destcity['name']}</b></>(으)로 강행했습니다."; $genlog = ["<C>●</>방랑군 세력이 <G><b>{$destcity['name']}</b></>(으)로 강행했습니다."];
for($j=0; $j < $gencount; $j++) { for($j=0; $j < $gencount; $j++) {
$gen = MYDB_fetch_array($result); $gen = MYDB_fetch_array($result);
pushGenLog($gen, $genlog); pushGenLog($gen, $genlog);
@@ -1652,6 +1666,7 @@ function process_31(&$general) {
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$gencount = MYDB_num_rows($result); $gencount = MYDB_num_rows($result);
$crew = 0; $crew = 0;
$typecount = [];
for($i=0; $i < $gencount; $i++) { for($i=0; $i < $gencount; $i++) {
$gen = MYDB_fetch_array($result); $gen = MYDB_fetch_array($result);
if($gen['crew'] != 0) { $typecount[$gen['crewtype']]++; $crew += $gen['crew']; } if($gen['crew'] != 0) { $typecount[$gen['crewtype']]++; $crew += $gen['crew']; }
@@ -1720,20 +1735,21 @@ function process_31(&$general) {
$query = "select spy from nation where nation='{$general['nation']}'"; $query = "select spy from nation where nation='{$general['nation']}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$nation = MYDB_fetch_array($result); $nation = MYDB_fetch_array($result);
if($nation['spy'] != "") { $citys = explode("|", $nation['spy']); } if($nation['spy'] != "") { $cities = explode("|", $nation['spy']); }
for($i=0; $i < count($citys); $i++) { $exist = 0;
if(floor($citys[$i]/10) == $destination) { for($i=0; $i < count($cities); $i++) {
if(floor($cities[$i]/10) == $destination) {
$exist = 1; $exist = 1;
break; break;
} }
} }
// 기존 첩보 목록에 없으면 새로 등록, 있으면 갱신 // 기존 첩보 목록에 없으면 새로 등록, 있으면 갱신
if($exist == 0) { if($exist == 0) {
$citys[] = $destination * 10 + 3; $cities[] = $destination * 10 + 3;
} else { } else {
$citys[$i] = $destination * 10 + 3; $cities[$i] = $destination * 10 + 3;
} }
$spy = implode("|", $citys); $spy = implode("|", $cities);
$query = "update nation set spy='$spy' where nation='{$general['nation']}'"; $query = "update nation set spy='$spy' where nation='{$general['nation']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
@@ -2037,6 +2053,7 @@ function process_43(&$general) {
$db = DB::db(); $db = DB::db();
$connect=$db->get(); $connect=$db->get();
$genlog = [];
$log = []; $log = [];
$alllog = []; $alllog = [];
$history = []; $history = [];
@@ -2169,10 +2186,10 @@ function process_44(&$general) {
$log[] = "<C>●</>{$admin['month']}월:자금이 없습니다. 헌납 실패. <1>$date</>"; $log[] = "<C>●</>{$admin['month']}월:자금이 없습니다. 헌납 실패. <1>$date</>";
} elseif($what == 2 && $general['rice'] <= 0) { } elseif($what == 2 && $general['rice'] <= 0) {
$log[] = "<C>●</>{$admin['month']}월:군량이 없습니다. 헌납 실패. <1>$date</>"; $log[] = "<C>●</>{$admin['month']}월:군량이 없습니다. 헌납 실패. <1>$date</>";
} elseif($general['nation'] != $city['nation'] && $mynation['level'] != 0) { } elseif($general['nation'] != $city['nation'] && $nation['level'] != 0) {
$log[] = "<C>●</>{$admin['month']}월:아국이 아닙니다. 증여 실패. <1>$date</>"; $log[] = "<C>●</>{$admin['month']}월:아국이 아닙니다. 헌납 실패. <1>$date</>";
} elseif($city['supply'] == 0) { } elseif($city['supply'] == 0) {
$log[] = "<C>●</>{$admin['month']}월:고립된 도시입니다. 증여 실패. <1>$date</>"; $log[] = "<C>●</>{$admin['month']}월:고립된 도시입니다. 헌납 실패. <1>$date</>";
} else { } else {
// $alllog[] = "<C>●</>{$admin['month']}월:<D><b>{$nation['name']}</b></>에서 장수들이 재산을 헌납 하고 있습니다."; // $alllog[] = "<C>●</>{$admin['month']}월:<D><b>{$nation['name']}</b></>에서 장수들이 재산을 헌납 하고 있습니다.";
$log[] = "<C>●</>{$admin['month']}월: $dtype <C>$amount</>을 헌납했습니다. <1>$date</>"; $log[] = "<C>●</>{$admin['month']}월: $dtype <C>$amount</>을 헌납했습니다. <1>$date</>";
+17 -7
View File
@@ -5,6 +5,7 @@ function process_23(&$general) {
$db = DB::db(); $db = DB::db();
$connect=$db->get(); $connect=$db->get();
$genlog = [];
$log = []; $log = [];
$alllog = []; $alllog = [];
$history = []; $history = [];
@@ -106,6 +107,7 @@ function process_24(&$general) {
$db = DB::db(); $db = DB::db();
$connect=$db->get(); $connect=$db->get();
$genlog = [];
$log = []; $log = [];
$alllog = []; $alllog = [];
$history = []; $history = [];
@@ -341,7 +343,7 @@ function process_51(&$general) {
} }
//기존 메세지 한칸씩 뒤로 미룸 //기존 메세지 한칸씩 뒤로 미룸
for($i=$deleted-1; $i >=0; $i--) { for($i=$deleted-1; $i >=0; $i--) {
moveMsg("nation", "dip", $i+1, $younatin["dip{$i}"], $younation["dip{$i}_type"], $younation["dip{$i}_who"], $younation["dip{$i}_when"], "nation", $younation['nation']); moveMsg("nation", "dip", $i+1, $younation["dip{$i}"], $younation["dip{$i}_type"], $younation["dip{$i}_who"], $younation["dip{$i}_when"], "nation", $younation['nation']);
} }
//권고 서신시 장수번호/상대국 번호 //권고 서신시 장수번호/상대국 번호
$me = $general['no'] * 10000 + $younation['nation']; $me = $general['no'] * 10000 + $younation['nation'];
@@ -429,9 +431,9 @@ function process_52(&$general) {
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$gencount = MYDB_num_rows($result); $gencount = MYDB_num_rows($result);
$genlog = ["<C>●</><D><b>{$younation['name']}</b></>(으)로 금<C>$gold</> 쌀<C>$rice</>을 지원했습니다."];
for($i=0; $i < $gencount; $i++) { for($i=0; $i < $gencount; $i++) {
$gen = MYDB_fetch_array($result); $gen = MYDB_fetch_array($result);
$genlog[0] = "<C>●</><D><b>{$younation['name']}</b></>(으)로 금<C>$gold</> 쌀<C>$rice</>을 지원했습니다.";
pushGenLog($gen, $genlog); pushGenLog($gen, $genlog);
} }
pushGeneralHistory($general, "<C>●</>{$admin['year']}{$admin['month']}월:<D><b>{$younation['name']}</b></>(으)로 금<C>$gold</> 쌀<C>$rice</>을 지원"); pushGeneralHistory($general, "<C>●</>{$admin['year']}{$admin['month']}월:<D><b>{$younation['name']}</b></>(으)로 금<C>$gold</> 쌀<C>$rice</>을 지원");
@@ -1241,6 +1243,7 @@ function process_71(&$general) {
$log = []; $log = [];
$alllog = []; $alllog = [];
$history = []; $history = [];
$tricklog = [];
$date = substr($general['turntime'],11,5); $date = substr($general['turntime'],11,5);
@@ -1346,6 +1349,7 @@ function process_72(&$general) {
$log = []; $log = [];
$alllog = []; $alllog = [];
$history = []; $history = [];
$tricklog = [];
$date = substr($general['turntime'],11,5); $date = substr($general['turntime'],11,5);
@@ -1460,6 +1464,7 @@ function process_73(&$general) {
$log = []; $log = [];
$alllog = []; $alllog = [];
$history = []; $history = [];
$tricklog = [];
$date = substr($general['turntime'],11,5); $date = substr($general['turntime'],11,5);
@@ -1590,6 +1595,7 @@ function process_74(&$general) {
$log = []; $log = [];
$alllog = []; $alllog = [];
$history = []; $history = [];
$tricklog = [];
$date = substr($general['turntime'],11,5); $date = substr($general['turntime'],11,5);
@@ -1685,20 +1691,21 @@ function process_74(&$general) {
$query = "select city from city where nation='{$destcity['nation']}' and supply=1"; $query = "select city from city where nation='{$destcity['nation']}' and supply=1";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$cityCount = MYDB_num_rows($result); $cityCount = MYDB_num_rows($result);
$cities = [];
for($i=0; $i < $cityCount; $i++) { for($i=0; $i < $cityCount; $i++) {
$dCity = MYDB_fetch_array($result); $dCity = MYDB_fetch_array($result);
$citys[$i] = $dCity['city']; $cities[$i] = $dCity['city'];
} }
//상대국 유저 랜덤 배치 //상대국 유저 랜덤 배치
$query = "select no,name from general where nation='{$destcity['nation']}' and city='{$destcity['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),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$count = MYDB_num_rows($result); $count = MYDB_num_rows($result);
$opplog[0] = "<C>●</>상대국의 허보에 당했다! <1>$date</>"; $opplog = ["<C>●</>상대국의 허보에 당했다! <1>$date</>"];
for($i=0; $i < $count; $i++) { for($i=0; $i < $count; $i++) {
$gen = MYDB_fetch_array($result); $gen = MYDB_fetch_array($result);
$selCity = $citys[rand() % $cityCount]; $selCity = $cities[rand() % $cityCount];
//현재도시이면 한번 다시 랜덤추첨 //현재도시이면 한번 다시 랜덤추첨
if($selCity == $destcity['city']) { $selCity = $citys[rand() % $cityCount]; } if($selCity == $destcity['city']) { $selCity = $cities[rand() % $cityCount]; }
$query = "update general set city={$selCity} where no='{$gen['no']}'"; $query = "update general set city={$selCity} where no='{$gen['no']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
@@ -1732,6 +1739,7 @@ function process_75(&$general) {
$log = []; $log = [];
$alllog = []; $alllog = [];
$history = []; $history = [];
$tricklog = [];
$date = substr($general['turntime'],11,5); $date = substr($general['turntime'],11,5);
@@ -2076,6 +2084,7 @@ function process_77(&$general) {
$log = []; $log = [];
$alllog = []; $alllog = [];
$history = []; $history = [];
$tricklog = [];
$date = substr($general['turntime'],11,5); $date = substr($general['turntime'],11,5);
@@ -2203,6 +2212,7 @@ function process_78(&$general) {
$log = []; $log = [];
$alllog = []; $alllog = [];
$history = []; $history = [];
$tricklog = [];
$date = substr($general['turntime'],11,5); $date = substr($general['turntime'],11,5);
@@ -2366,7 +2376,7 @@ function process_81(&$general) {
$query = "select no,name from general where nation='{$general['nation']}' and no!='{$general['no']}'"; $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),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$cnt = MYDB_num_rows($result); $cnt = MYDB_num_rows($result);
$genlog[0] = "<C>●</><Y>{$general['name']}</>(이)가 <font color={$color}><b>국기</b></font>를 변경합니다."; $genlog = ["<C>●</><Y>{$general['name']}</>(이)가 <font color={$color}><b>국기</b></font>를 변경합니다."];
for($i=0; $i < $cnt; $i++) { for($i=0; $i < $cnt; $i++) {
$gen = MYDB_fetch_array($result); $gen = MYDB_fetch_array($result);
pushGenLog($gen, $genlog); pushGenLog($gen, $genlog);
+2 -9
View File
@@ -409,10 +409,6 @@ function process_29(&$general) {
$gennum = $gencount; $gennum = $gencount;
if($gencount < 10) $gencount = 10; if($gencount < 10) $gencount = 10;
// 국가보정
if($nation['type'] == 11) { $term3 = round($term3 / 2); }
if($nation['type'] == 12) { $term3 = $term3 * 2; }
//국가 기술력 그대로 //국가 기술력 그대로
$query = "update nation set totaltech=tech*'$gencount',gennum='$gennum' where nation='{$general['nation']}'"; $query = "update nation set totaltech=tech*'$gencount',gennum='$gennum' where nation='{$general['nation']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
@@ -462,11 +458,6 @@ function process_45(&$general) {
} elseif($general['level'] == 12) { } elseif($general['level'] == 12) {
$log[] = "<C>●</>{$admin['month']}월:군주입니다. 하야 실패. <1>$date</>"; $log[] = "<C>●</>{$admin['month']}월:군주입니다. 하야 실패. <1>$date</>";
} else { } else {
$exp = 100;
// 성격 보정
$exp = CharExperience($exp, $general['personal']);
$ded = CharDedication($ded, $general['personal']);
$query = "select no from diplomacy where me='{$general['nation']}' and state>='3' and state<='4'"; $query = "select no from diplomacy where me='{$general['nation']}' and state>='3' and state<='4'";
$dipresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $dipresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
@@ -713,6 +704,7 @@ function process_54(&$general) {
$connect=$db->get(); $connect=$db->get();
$log = []; $log = [];
$youlog = [];
$alllog = []; $alllog = [];
$history = []; $history = [];
$date = substr($general['turntime'],11,5); $date = substr($general['turntime'],11,5);
@@ -920,6 +912,7 @@ function process_57(&$general) {
$connect=$db->get(); $connect=$db->get();
$log = []; $log = [];
$youlog = [];
$alllog = []; $alllog = [];
$history = []; $history = [];
$date = substr($general['turntime'],11,5); $date = substr($general['turntime'],11,5);
+2 -2
View File
@@ -229,8 +229,8 @@ function process_33(&$general) {
$nation['gold'] -= $gold; $nation['gold'] -= $gold;
$nation['rice'] -= $rice; $nation['rice'] -= $rice;
if($nation['gold'] < GameConst::$minNationalgold) { $gold += ($nation['gold'] - GameConst::$minNationalgold); $nation['gold'] = GameConst::$minNationalgold; } if($nation['gold'] < GameConst::$minNationalGold) { $gold += ($nation['gold'] - GameConst::$minNationalGold); $nation['gold'] = GameConst::$minNationalGold; }
if($nation['rice'] < GameConst::$minNationalrice) { $rice += ($nation['rice'] - GameConst::$minNationalrice); $nation['rice'] = GameConst::$minNationalrice; } if($nation['rice'] < GameConst::$minNationalRice) { $rice += ($nation['rice'] - GameConst::$minNationalRice); $nation['rice'] = GameConst::$minNationalRice; }
$query = "update nation set gold='{$nation['gold']}',rice='{$nation['rice']}' where nation='{$destcity['nation']}'"; $query = "update nation set gold='{$nation['gold']}',rice='{$nation['rice']}' where nation='{$destcity['nation']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$query = "update city set state=34 where city='$destination'"; $query = "update city set state=34 where city='$destination'";
+6 -6
View File
@@ -2,17 +2,17 @@
namespace sammo; namespace sammo;
function getFont($str) { function getFont(string $str) {
if(strlen($str) >= 22) { $str = "<font size=1>{$str}</font>"; } if(strlen($str) >= 22) { $str = "<font size=1>{$str}</font>"; }
return $str; return $str;
} }
function SQ2DQ($str) { function SQ2DQ(string $str) {
return str_replace("'", "&#039;", $str); return str_replace("'", "&#039;", $str);
} }
function Tag2Code($str) { function Tag2Code(string $str) {
// return htmlspecialchars(nl2br(str_replace(" ", "&nbsp;", $str))); // return htmlspecialchars(nl2br(str_replace(" ", "&nbsp;", $str)));
// $str = str_replace("&", "&amp;", $str); // $str = str_replace("&", "&amp;", $str);
$str = str_replace("'", "&#039;", $str); $str = str_replace("'", "&#039;", $str);
@@ -24,14 +24,14 @@ function Tag2Code($str) {
return nl2br($str); return nl2br($str);
} }
function BadTag2Code($str) { function BadTag2Code(string $str) {
/* FIXME: 제대로된 tag 변환 코드 사용 */ /* FIXME: 제대로된 tag 변환 코드 사용 */
$str = str_replace("<script", "<sorry", $str); $str = str_replace("<script", "<sorry", $str);
$str = str_replace("<embed", "<sorry", $str); $str = str_replace("<embed", "<sorry", $str);
return $str; return $str;
} }
function tab($str, $maxsize, $ch) { function tab(string $str, $maxsize, $ch) {
$size = strlen($str); $size = strlen($str);
$string = ''; $string = '';
@@ -47,7 +47,7 @@ function tab($str, $maxsize, $ch) {
return $string; return $string;
} }
function tab2($str, $maxsize, $ch) { function tab2(string $str, $maxsize, $ch) {
$size = strlen($str); $size = strlen($str);
$string = ''; $string = '';
+44 -30
View File
@@ -16,32 +16,32 @@ function processSpring() {
$query = "update city set dead=0,agri=agri*0.99,comm=comm*0.99,secu=secu*0.99,def=def*0.99,wall=wall*0.99"; $query = "update city set dead=0,agri=agri*0.99,comm=comm*0.99,secu=secu*0.99,def=def*0.99,wall=wall*0.99";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
// 유지비 3% 거상 1.5%
$query = "update general set gold=gold*0.97 where gold>10000 and special!=30";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$query = "update general set gold=gold*0.985 where gold>10000 and special=30";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
// 유지비 1% 거상 0.5% // 유지비 1% 거상 0.5%
$query = "update general set gold=gold*0.99 where gold>1000 and gold<=10000 and special!=30"; $query = "update general set gold=gold*0.99 where gold>1000 and gold<=10000 and special!=30";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$query = "update general set gold=gold*0.995 where gold>1000 and gold<=10000 and special=30"; $query = "update general set gold=gold*0.995 where gold>1000 and gold<=10000 and special=30";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
// 유지비 5% // 유지비 3% 거상 1.5%
$query = "update nation set gold=gold*0.95 where gold>100000"; $query = "update general set gold=gold*0.97 where gold>10000 and special!=30";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$query = "update general set gold=gold*0.985 where gold>10000 and special=30";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
// 유지비 1%
$query = "update nation set gold=gold*0.99 where gold>1000 and gold<=10000";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
// 유지비 3% // 유지비 3%
$query = "update nation set gold=gold*0.97 where gold>10000 and gold<=100000"; $query = "update nation set gold=gold*0.97 where gold>10000 and gold<=100000";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
// 유지비 1% // 유지비 5%
$query = "update nation set gold=gold*0.99 where gold>1000 and gold<=10000"; $query = "update nation set gold=gold*0.95 where gold>100000";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$query = "select year,month from game limit 1"; $query = "select year,month from game limit 1";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$admin = MYDB_fetch_array($result); $admin = MYDB_fetch_array($result);
$history[0] = "<R>★</>{$admin['year']}{$admin['month']}월: <S>모두들 즐거운 게임 하고 계신가요? ^^ <Y>삼국일보</> 애독해 주시고, <M>훼접</>은 삼가주세요~</>"; pushWorldHistory(["<R>★</>{$admin['year']}{$admin['month']}월: <S>모두들 즐거운 게임 하고 계신가요? ^^ <Y>삼국일보</> 애독해 주시고, <M>훼접</>은 삼가주세요~</>"], $admin['year'], $admin['month']);
pushWorldHistory($history, $admin['year'], $admin['month']);
} }
function processGoldIncome() { function processGoldIncome() {
@@ -51,6 +51,7 @@ function processGoldIncome() {
$query = "select year,month,gold_rate from game limit 1"; $query = "select year,month,gold_rate from game limit 1";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$admin = MYDB_fetch_array($result); $admin = MYDB_fetch_array($result);
$adminLog = [];
$query = "select name,nation,gold,rate_tmp,bill,type from nation"; $query = "select name,nation,gold,rate_tmp,bill,type from nation";
$nationresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $nationresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
@@ -83,12 +84,17 @@ function processGoldIncome() {
// 실지급율 // 실지급율
$ratio = $realoutcome / $originoutcome; $ratio = $realoutcome / $originoutcome;
} }
$adminLog[] = StringUtil::Fill2($nation['name'],12," ")." // 세금 : ".StringUtil::Fill2($income,6," ")." // 세출 : ".StringUtil::Fill2($originoutcome,6," ")." // 실제 : ".tab2($realoutcome,6," ")." // 지급율 : ".tab2(round($ratio*100,2),5," ")." % // 결과금 : ".tab2($nation['gold'],6," "); $adminLog[] = StringUtil::Fill2((string)$nation['name'],12," ")
." // 세금 : ".StringUtil::Fill2((string)$income,6," ")
." // 세출 : ".StringUtil::Fill2((string)$originoutcome,6," ")
." // 실제 : ".tab2((string)$realoutcome,6," ")
." // 지급율 : ".tab2((string)round($ratio*100,2),5," ")
." % // 결과금 : ".tab2((string)$nation['gold'],6," ");
$query = "select no,name,nation from general where nation='{$nation['nation']}' and level>='9'"; $query = "select no,name,nation from general where nation='{$nation['nation']}' and level>='9'";
$coreresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $coreresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$corecount = MYDB_num_rows($coreresult); $corecount = MYDB_num_rows($coreresult);
$corelog[0] = "<C>●</>이번 수입은 금 <C>$income</>입니다."; $corelog = ["<C>●</>이번 수입은 금 <C>$income</>입니다."];
for($j=0; $j < $corecount; $j++) { for($j=0; $j < $corecount; $j++) {
$coregen = MYDB_fetch_array($coreresult); $coregen = MYDB_fetch_array($coreresult);
pushGenLog($coregen, $corelog); pushGenLog($coregen, $corelog);
@@ -110,13 +116,11 @@ function processGoldIncome() {
$query = "update general set gold='{$general['gold']}' where no='{$general['no']}'"; $query = "update general set gold='{$general['gold']}' where no='{$general['no']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$log[0] = "<C>●</>봉급으로 금 <C>$gold</>을 받았습니다."; pushGenLog($general, ["<C>●</>봉급으로 금 <C>$gold</>을 받았습니다."]);
pushGenLog($general, $log);
} }
} }
$history[0] = "<C>●</>{$admin['year']}{$admin['month']}월:<W><b>【지급】</b></>봄이 되어 봉록에 따라 자금이 지급됩니다."; pushWorldHistory(["<C>●</>{$admin['year']}{$admin['month']}월:<W><b>【지급】</b></>봄이 되어 봉록에 따라 자금이 지급됩니다."], $admin['year'], $admin['month']);
pushWorldHistory($history, $admin['year'], $admin['month']);
pushAdminLog($adminLog); pushAdminLog($adminLog);
} }
@@ -124,6 +128,9 @@ function popIncrease() {
$db = DB::db(); $db = DB::db();
$connect=$db->get(); $connect=$db->get();
$rate = [];
$type = [];
$query = "select nation,rate_tmp,type from nation"; $query = "select nation,rate_tmp,type from nation";
$nationresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $nationresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$nationcount = MYDB_num_rows($nationresult); $nationcount = MYDB_num_rows($nationresult);
@@ -233,7 +240,7 @@ function getGoldIncome($nationNo, $rate, $admin_rate, $type) {
$citycount = MYDB_num_rows($cityresult); $citycount = MYDB_num_rows($cityresult);
//총 수입 구함 //총 수입 구함
$income[0] = 0; $income[1] = 0; // income[0] : 세수, income[1] : 수비병 세수 $income = [0, 0]; // income[0] : 세수, income[1] : 수비병 세수
for($j=0; $j < $citycount; $j++) { for($j=0; $j < $citycount; $j++) {
$city = MYDB_fetch_array($cityresult); $city = MYDB_fetch_array($cityresult);
@@ -367,6 +374,7 @@ function processRiceIncome() {
$query = "select year,month,rice_rate from game limit 1"; $query = "select year,month,rice_rate from game limit 1";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$admin = MYDB_fetch_array($result); $admin = MYDB_fetch_array($result);
$adminLog = [];
$query = "select name,nation,rice,rate_tmp,bill,type from nation"; $query = "select name,nation,rice,rate_tmp,bill,type from nation";
$nationresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $nationresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
@@ -400,12 +408,17 @@ function processRiceIncome() {
// 실지급율 // 실지급율
$ratio = $realoutcome / $originoutcome; $ratio = $realoutcome / $originoutcome;
} }
$adminLog[] = StringUtil::Fill2($nation['name'],12," ")." // 세곡 : ".StringUtil::Fill2($income,6," ")." // 세출 : ".StringUtil::Fill2($originoutcome,6," ")." // 실제 : ".tab2($realoutcome,6," ")." // 지급율 : ".tab2(round($ratio*100,2),5," ")." % // 결과곡 : ".tab2($nation['rice'],6," "); $adminLog[] = StringUtil::Fill2($nation['name'],12," ")
." // 세곡 : ".StringUtil::Fill2((string)$income,6," ")
." // 세출 : ".StringUtil::Fill2((string)$originoutcome,6," ")
." // 실제 : ".tab2((string)$realoutcome,6," ")
." // 지급율 : ".tab2((string)round($ratio*100,2),5," ")
." % // 결과곡 : ".tab2((string)$nation['rice'],6," ");
$query = "select no,name,nation from general where nation='{$nation['nation']}' and level>='9'"; $query = "select no,name,nation from general where nation='{$nation['nation']}' and level>='9'";
$coreresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $coreresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$corecount = MYDB_num_rows($coreresult); $corecount = MYDB_num_rows($coreresult);
$corelog[0] = "<C>●</>이번 수입은 쌀 <C>$income</>입니다."; $corelog = ["<C>●</>이번 수입은 쌀 <C>$income</>입니다."];
for($j=0; $j < $corecount; $j++) { for($j=0; $j < $corecount; $j++) {
$coregen = MYDB_fetch_array($coreresult); $coregen = MYDB_fetch_array($coreresult);
pushGenLog($coregen, $corelog); pushGenLog($coregen, $corelog);
@@ -427,13 +440,11 @@ function processRiceIncome() {
$query = "update general set rice='{$general['rice']}' where no='{$general['no']}'"; $query = "update general set rice='{$general['rice']}' where no='{$general['no']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$log[0] = "<C>●</>봉급으로 쌀 <C>$rice</>을 받았습니다."; pushGenLog($general, ["<C>●</>봉급으로 쌀 <C>$rice</>을 받았습니다."]);
pushGenLog($general, $log);
} }
} }
$history[0] = "<C>●</>{$admin['year']}{$admin['month']}월:<W><b>【지급】</b></>가을이 되어 봉록에 따라 군량이 지급됩니다."; pushWorldHistory(["<C>●</>{$admin['year']}{$admin['month']}월:<W><b>【지급】</b></>가을이 되어 봉록에 따라 군량이 지급됩니다."], $admin['year'], $admin['month']);
pushWorldHistory($history, $admin['year'], $admin['month']);
pushAdminLog($adminLog); pushAdminLog($adminLog);
} }
@@ -474,7 +485,7 @@ function getRiceIncome($nationNo, $rate, $admin_rate, $type) {
$citycount = MYDB_num_rows($cityresult); $citycount = MYDB_num_rows($cityresult);
//총 수입 구함 //총 수입 구함
$income[0] = 0; $income[1] = 0; // income[0] : 세수, income[1] : 수비병 세수 $income = [0, 0]; // income[0] : 세수, income[1] : 수비병 세수
for($j=0; $j < $citycount; $j++) { for($j=0; $j < $citycount; $j++) {
$city = MYDB_fetch_array($cityresult); $city = MYDB_fetch_array($cityresult);
@@ -581,6 +592,10 @@ function disaster() {
if($admin['month'] == 4 && $disastertype == 3) { $isgood = 1; } if($admin['month'] == 4 && $disastertype == 3) { $isgood = 1; }
if($admin['month'] == 7 && $disastertype == 3) { $isgood = 1; } if($admin['month'] == 7 && $disastertype == 3) { $isgood = 1; }
$disastercity = [];
$disasterratio = [];
$disastername = [];
for($i=0; $i < $citycount; $i++) { for($i=0; $i < $citycount; $i++) {
$city = MYDB_fetch_array($cityresult); $city = MYDB_fetch_array($cityresult);
//호황 발생 도시 선택 ( 기본 3% 이므로 약 3개 도시 ) //호황 발생 도시 선택 ( 기본 3% 이므로 약 3개 도시 )
@@ -589,14 +604,13 @@ function disaster() {
else { $ratio = 6 - round(1.0*$city['secu']/$city['secu2']*3); } // 3 ~ 6% else { $ratio = 6 - round(1.0*$city['secu']/$city['secu2']*3); } // 3 ~ 6%
if(rand()%100+1 < $ratio) { if(rand()%100+1 < $ratio) {
$idx = count($disastercity); $disastercity[] = $city['city'];
$disastercity[$idx] = $city['city']; $disasterratio[] = 1.0 * $city['secu'] / $city['secu2'];
$disasterratio[$idx] = 1.0 * $city['secu'] / $city['secu2']; $disastername[] = $city['name'];
$disastername .= $city['name']." ";
} }
} }
$disastername = "<G><b>{$disastername}</b></>"; $disastername = "<G><b>".join(' ', $disastername)."</b></>";
$disaster = []; $disaster = [];
//재해 처리 //재해 처리
+6 -2
View File
@@ -571,6 +571,11 @@ function setGift($tnmt_type, $tnmt, $phase) {
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$admin = MYDB_fetch_array($result); $admin = MYDB_fetch_array($result);
$genNo = [];
$genName = [];
$genGold = [];
$genCall = [];
switch($tnmt_type) { switch($tnmt_type) {
case 0: $tp = "전력전"; $tp2 = "tt"; break; case 0: $tp = "전력전"; $tp2 = "tt"; break;
case 1: $tp = "통솔전"; $tp2 = "tl"; break; case 1: $tp = "통솔전"; $tp2 = "tl"; break;
@@ -708,8 +713,7 @@ function setGift($tnmt_type, $tnmt, $phase) {
$query = "update general set gold=gold+'$gold',betwingold=betwingold+'$gold',betwin=betwin+1 where no='{$gen['no']}'"; $query = "update general set gold=gold+'$gold',betwingold=betwingold+'$gold',betwin=betwin+1 where no='{$gen['no']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
//로그 //로그
$log[0] = "<S>◆</><C>{$tp}</> 대회의 베팅 당첨으로 <C>{$gold}</>의 <S>금</> 획득!"; pushGenLog($gen, ["<S>◆</><C>{$tp}</> 대회의 베팅 당첨으로 <C>{$gold}</>의 <S>금</> 획득!"]);
pushGenLog($gen, $log);
} }
} }
+32 -31
View File
@@ -1,7 +1,8 @@
<?php <?php
namespace sammo; namespace sammo;
class GameConst{ class GameConst
{
/** @var string 버전 */ /** @var string 버전 */
public static $title = "삼국지 모의전투 PHP HideD"; public static $title = "삼국지 모의전투 PHP HideD";
/** @var string 코드 아래에 붙는 설명 코드 */ /** @var string 코드 아래에 붙는 설명 코드 */
@@ -9,65 +10,65 @@ class GameConst{
/** @var string 코드 아래에 붙는 설명 코드 */ /** @var string 코드 아래에 붙는 설명 코드 */
public static $helper = "도움 주신 분들"; public static $helper = "도움 주신 분들";
/** @var int 내정시 최하 민심 설정*/ /** @var int 내정시 최하 민심 설정*/
public static $develrate = 50; public static $develrate = 50;
/** @var int 능력치 상승 경험치*/ /** @var int 능력치 상승 경험치*/
public static $upgradeLimit = 30; public static $upgradeLimit = 30;
/** @var int 숙련도 제한치*/ /** @var int 숙련도 제한치*/
public static $dexLimit = 1000000; public static $dexLimit = 1000000;
/** @var int 초기 사기치*/ /** @var int 초기 사기치*/
public static $defaultatmos = 40; public static $defaultatmos = 40;
/** @var int 초기 훈련치*/ /** @var int 초기 훈련치*/
public static $defaulttrain = 40; public static $defaulttrain = 40;
/** @var int 초기 사기치*/ /** @var int 초기 사기치*/
public static $defaultatmos2 = 70; public static $defaultatmos2 = 70;
/** @var int 초기 훈련치*/ /** @var int 초기 훈련치*/
public static $defaulttrain2 = 70; public static $defaulttrain2 = 70;
/** @var int 최대 훈련치*/ /** @var int 최대 훈련치*/
public static $maxtrain = 100; public static $maxtrain = 100;
/** @var int 인위적으로 올릴 수 있는 최대 사기치*/ /** @var int 인위적으로 올릴 수 있는 최대 사기치*/
public static $maxatmos = 100; public static $maxatmos = 100;
/** @var int 최대 사기치*/ /** @var int 최대 사기치*/
public static $maximumatmos = 150; public static $maximumatmos = 150;
/** @var int 최대 훈련치*/ /** @var int 최대 훈련치*/
public static $maximumtrain = 110; public static $maximumtrain = 110;
/** @var int 풀징병시 훈련 1회 상승량*/ /** @var int 풀징병시 훈련 1회 상승량*/
public static $training = 30; public static $training = 30;
/** @var float 훈련시 사기 감소율*/ /** @var float 훈련시 사기 감소율*/
public static $atmosing = 0.98; public static $atmosing = 0.98;
/** @var float 계략 기본 성공률*/ /** @var float 계략 기본 성공률*/
public static $basefiring = 0.25; public static $basefiring = 0.25;
/** @var int 계략시 확률 가중치(수치가 클수록 변화가 적음 : (지력차/public static $firing + public static $basefiring)*/ /** @var int 계략시 확률 가중치(수치가 클수록 변화가 적음 : (지력차/public static $firing + public static $basefiring)*/
public static $firing = 300; public static $firing = 300;
/** @var int 계략시 기본 수치 감소량*/ /** @var int 계략시 기본 수치 감소량*/
public static $firingbase = 100; public static $firingbase = 100;
/** @var int 계략시 수치 감소량(public static $firingbase ~ public static $firingpower)*/ /** @var int 계략시 수치 감소량(public static $firingbase ~ public static $firingpower)*/
public static $firingpower = 400; public static $firingpower = 400;
/** @var int 명장,지장에 사용될 통솔 제한*/ /** @var int 명장,지장에 사용될 통솔 제한*/
public static $goodgenleader = 65; public static $goodgenleader = 65;
/** @var int 명장에 사용될 무력 제한*/ /** @var int 명장에 사용될 무력 제한*/
public static $goodgenpower = 65; public static $goodgenpower = 65;
/** @var int 지장에 사용될 지력 제한*/ /** @var int 지장에 사용될 지력 제한*/
public static $goodgenintel = 65; public static $goodgenintel = 65;
/** @var string 기본 배경색깔 푸른색*/ /** @var string 기본 배경색깔 푸른색*/
public static $basecolor = "#000044"; public static $basecolor = "#000044";
/** @var string 기본 배경색깔 초록색*/ /** @var string 기본 배경색깔 초록색*/
public static $basecolor2 = "#225500"; public static $basecolor2 = "#225500";
/** @var string 기본 배경색깔 붉은색*/ /** @var string 기본 배경색깔 붉은색*/
public static $basecolor3 = "#660000"; public static $basecolor3 = "#660000";
/** @var string 기본 배경색깔 검붉은색*/ /** @var string 기본 배경색깔 검붉은색*/
public static $basecolor4 = "#330000"; public static $basecolor4 = "#330000";
/** @var int 페이즈당 표준 감소 병사 수*/ /** @var int 페이즈당 표준 감소 병사 수*/
public static $armperphase = 500; public static $armperphase = 500;
/** @var int 기본 국고*/ /** @var int 기본 국고*/
public static $basegold = 0; public static $basegold = 0;
/** @var int 기본 병량*/ /** @var int 기본 병량*/
public static $baserice = 2000; public static $baserice = 2000;
/** @var int 최저 국고(긴급시) */ /** @var int 최저 국고(긴급시) */
public static $minNationalgold = 0; public static $minNationalGold = 0;
/** @var int 최저 병량(긴급시) */ /** @var int 최저 병량(긴급시) */
public static $minNationalRice = 0; public static $minNationalRice = 0;
/** @var float 군량 매매시 세율*/ /** @var float 군량 매매시 세율*/
public static $taxrate = 0.01; public static $taxrate = 0.01;
/** @var float 성인 연령 */ /** @var float 성인 연령 */
public static $adultAge = 14; public static $adultAge = 14;
} }