From 0b17a289c88fe18facf0e1944d993510d4686f6e Mon Sep 17 00:00:00 2001 From: hide_d Date: Fri, 13 Apr 2018 02:42:10 +0900 Subject: [PATCH 01/66] =?UTF-8?q?=EB=82=B4=EC=A0=95=20=EC=88=98=EC=B9=98?= =?UTF-8?q?=EB=A5=BC=20tm=EA=B3=BC=20=EC=9D=BC=EC=B9=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/func_process.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hwe/func_process.php b/hwe/func_process.php index f10e6ff4..b215c806 100644 --- a/hwe/func_process.php +++ b/hwe/func_process.php @@ -324,7 +324,7 @@ function process_3(&$general) { if($general['level'] == 12 || $general['level'] == 11 || $general['level'] == 9 || $general['level'] == 7 || $general['level'] == 5) { $score *= 1.05; } $rd = rand() % 100; - $r = CriticalRatioDomestic($general, 0); + $r = CriticalRatioDomestic($general, 2); // 특기보정 : 발명 if($general['special'] == 3) { $score *= 1.1; $admin['develcost'] *= 0.8; $r['succ'] += 10; } @@ -520,7 +520,7 @@ function process_5(&$general, $type) { if($general['level'] == 4 && $general['no'] == $city['gen1']) { $score *= 1.05; } $rd = rand() % 100; // 현재 20% - $r = CriticalRatioDomestic($general, 0); + $r = CriticalRatioDomestic($general, 1); // 특기보정 : 수비, 축성 if($type == 1 && $general['special'] == 11) { $r['succ'] += 10; $score *= 1.1; $admin['develcost'] *= 0.8; } if($type == 2 && $general['special'] == 10) { $r['succ'] += 10; $score *= 1.1; $admin['develcost'] *= 0.8; } @@ -709,7 +709,7 @@ function process_8(&$general) { if($general['level'] == 4 && $general['no'] == $city['gen1']) { $score *= 1.05; } $rd = rand() % 100; // 현재 20% - $r = CriticalRatioDomestic($general, 0); + $r = CriticalRatioDomestic($general, 1); // 특기보정 : 통찰 if($general['special'] == 12) { $r['succ'] += 10; $score *= 1.1; $admin['develcost'] *= 0.8; } From 02f90842fe1a20d1bd680ef5800374d0c77a210a Mon Sep 17 00:00:00 2001 From: hide_d Date: Fri, 13 Apr 2018 03:41:39 +0900 Subject: [PATCH 02/66] =?UTF-8?q?TM=20=EC=84=9C=EB=B2=84=20=EB=B0=B8?= =?UTF-8?q?=EB=9F=B0=EC=8A=A4=20=ED=8C=A8=EC=B9=98=20=EC=9D=B4=EC=8B=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/func_gamerule.php | 3 +- hwe/func_process.php | 74 ++++++++++++++++++---------------- hwe/func_process_personnel.php | 16 +++++--- hwe/func_process_trick.php | 2 +- hwe/join_post.php | 2 +- hwe/process_war.php | 45 ++++++++------------- hwe/sql/schema.sql | 1 - 7 files changed, 72 insertions(+), 71 deletions(-) diff --git a/hwe/func_gamerule.php b/hwe/func_gamerule.php index 8959e79b..869aa466 100644 --- a/hwe/func_gamerule.php +++ b/hwe/func_gamerule.php @@ -188,7 +188,7 @@ function getGenDex($general, $type) { return $general["dex{$type}"]; } -function addGenDex($no, $type, $exp) { +function addGenDex($no, $atmos, $train, $type, $exp) { $db = DB::db(); $connect=$db->get(); @@ -196,6 +196,7 @@ function addGenDex($no, $type, $exp) { $dexType = "dex{$type}"; if($type == 30) { $exp = Util::round($exp * 0.90); } //귀병은 90%효율 elseif($type == 40) { $exp = Util::round($exp * 0.90); } //차병은 90%효율 + $exp = Util::round($exp * ($atmos+$train) / 200); // 사기 + 훈련 / 200 $query = "update general set {$dexType}={$dexType}+{$exp} where no='$no'"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); diff --git a/hwe/func_process.php b/hwe/func_process.php index b215c806..dd9a8709 100644 --- a/hwe/func_process.php +++ b/hwe/func_process.php @@ -1,7 +1,6 @@ $rd) { $score = CriticalScore($score, 1); $log[] = "●{$admin['month']}월:{$dtype}{$atype} 실패하여 $score 상승했습니다. <1>$date"; - } elseif($city['rate'] >= 80 && $r['succ'] > $rd) { + } elseif($r['succ'] + $r['fail'] > $rd) { $score = CriticalScore($score, 0); $log[] = "●{$admin['month']}월:{$dtype}{$atype} 성공하여 $score 상승했습니다. <1>$date"; } else { @@ -323,10 +323,12 @@ function process_3(&$general) { // 군주, 참모, 모사 보정 if($general['level'] == 12 || $general['level'] == 11 || $general['level'] == 9 || $general['level'] == 7 || $general['level'] == 5) { $score *= 1.05; } - $rd = rand() % 100; + $rd = Util::randF(); $r = CriticalRatioDomestic($general, 2); // 특기보정 : 발명 - if($general['special'] == 3) { $score *= 1.1; $admin['develcost'] *= 0.8; $r['succ'] += 10; } + if($general['special'] == 3) { $r['succ'] += 0.1; $score *= 1.1; $admin['develcost'] *= 0.8; } + //민심 반영 + if($city['rate'] < 80) { $r['succ'] *= $city['rate'] / 80; } //버그방지 if($score < 1) $score = 1; @@ -334,7 +336,7 @@ function process_3(&$general) { if($r['fail'] > $rd) { $score = CriticalScore($score, 1); $log[] = "●{$admin['month']}월:{$dtype}를 실패하여 $score 상승했습니다. <1>$date"; - } elseif($city['rate'] >= 80 && $r['succ'] > $rd) { + } elseif($r['succ'] + $r['fail'] > $rd) { $score = CriticalScore($score, 0); $log[] = "●{$admin['month']}월:{$dtype}를 성공하여 $score 상승했습니다. <1>$date"; } else { @@ -421,10 +423,10 @@ function process_4(&$general) { // 시중 보정 if($general['level'] == 2 && $general['no'] == $city['gen3']) { $score *= 1.05; } - $rd = rand() % 100; + $rd = Util::randF(); $r = CriticalRatioDomestic($general, 0); // 특기보정 : 인덕 - if($general['special'] == 20) { $r['succ'] += 10; $admin['develcost'] *= 0.8; $score *= 1.1; } + if($general['special'] == 20) { $r['succ'] += 0.1; $score *= 1.1; $admin['develcost'] *= 0.8; } //버그방지 if($score < 1) $score = 1; @@ -432,7 +434,7 @@ function process_4(&$general) { if($r['fail'] > $rd) { $score = CriticalScore($score, 1); $log[] = "●{$admin['month']}월:선정을 실패하여 민심이 $score 상승했습니다. <1>$date"; - } elseif($r['succ'] > $rd) { + } elseif($r['succ'] + $r['fail'] > $rd) { $score = CriticalScore($score, 0); $log[] = "●{$admin['month']}월:선정을 성공하여 민심이 $score 상승했습니다. <1>$date"; } else { @@ -519,11 +521,13 @@ function process_5(&$general, $type) { // 태수 보정 if($general['level'] == 4 && $general['no'] == $city['gen1']) { $score *= 1.05; } - $rd = rand() % 100; // 현재 20% + $rd = randF(); $r = CriticalRatioDomestic($general, 1); // 특기보정 : 수비, 축성 - if($type == 1 && $general['special'] == 11) { $r['succ'] += 10; $score *= 1.1; $admin['develcost'] *= 0.8; } - if($type == 2 && $general['special'] == 10) { $r['succ'] += 10; $score *= 1.1; $admin['develcost'] *= 0.8; } + if($type == 1 && $general['special'] == 11) { $r['succ'] += 0.1; $score *= 1.1; $admin['develcost'] *= 0.8; } + if($type == 2 && $general['special'] == 10) { $r['succ'] += 0.1; $score *= 1.1; $admin['develcost'] *= 0.8; } + //민심 반영 + if($city['rate'] < 80) { $r['succ'] *= $city['rate'] / 80; } //버그방지 if($score < 1) $score = 1; @@ -531,7 +535,7 @@ function process_5(&$general, $type) { if($r['fail'] > $rd) { $score = CriticalScore($score, 1); $log[] = "●{$admin['month']}월:{$dtype}를 실패하여 $score 상승했습니다. <1>$date"; - } elseif($city['rate'] >= 80 && $r['succ'] > $rd) { + } elseif($r['succ'] + $r['fail'] > $rd) { $score = CriticalScore($score, 0); $log[] = "●{$admin['month']}월:{$dtype}를 성공하여 $score 상승했습니다. <1>$date"; } else { @@ -611,10 +615,10 @@ function process_7(&$general) { // 시중 보정 if($general['level'] == 2 && $general['no'] == $city['gen3']) { $score *= 1.05; } - $rd = rand() % 100; // 현재 20% + $rd = Util::randF(); $r = CriticalRatioDomestic($general, 0); // 특기보정 : 인덕 - if($general['special'] == 20) { $r['succ'] += 10; $score *= 1.1; $admin['develcost'] *= 0.8; } + if($general['special'] == 20) { $r['succ'] += 0.1; $score *= 1.1; $admin['develcost'] *= 0.8; } //버그방지 if($score < 1) $score = 1; @@ -622,7 +626,7 @@ function process_7(&$general) { if($r['fail'] > $rd) { $score = CriticalScore($score, 1); $log[] = "●{$admin['month']}월:장려를 실패하여 주민이 {$score}0명 증가했습니다. <1>$date"; - } elseif($r['succ'] > $rd) { + } elseif($r['succ'] + $r['fail'] > $rd) { $score = CriticalScore($score, 0); $log[] = "●{$admin['month']}월:장려를 성공하여 주민이 {$score}0명 증가했습니다. <1>$date"; } else { @@ -708,10 +712,12 @@ function process_8(&$general) { // 태수 보정 if($general['level'] == 4 && $general['no'] == $city['gen1']) { $score *= 1.05; } - $rd = rand() % 100; // 현재 20% + $rd = Util::randF(); $r = CriticalRatioDomestic($general, 1); // 특기보정 : 통찰 - if($general['special'] == 12) { $r['succ'] += 10; $score *= 1.1; $admin['develcost'] *= 0.8; } + if($general['special'] == 12) { $r['succ'] += 0.1; $score *= 1.1; $admin['develcost'] *= 0.8; } + //민심 반영 + if($city['rate'] < 80) { $r['succ'] *= $city['rate'] / 80; } //버그방지 if($score < 1) $score = 1; @@ -719,7 +725,7 @@ function process_8(&$general) { if($r['fail'] > $rd) { $score = CriticalScore($score, 1); $log[] = "●{$admin['month']}월:{$dtype}을 실패하여 $score 강화했습니다. <1>$date"; - } elseif($city['rate'] >= 80 && $r['succ'] > $rd) { + } elseif($r['succ'] + $r['fail'] > $rd) { $score = CriticalScore($score, 0); $log[] = "●{$admin['month']}월:{$dtype}을 성공하여 $score 강화했습니다. <1>$date"; } else { @@ -821,7 +827,7 @@ function process_9(&$general) { MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); } - switch(rand()%3) { + switch(Util::choiceRandomUsingWeight([$general['leader'], $general['power'], $general['intel']])) { case 0: $general['leader2']++; $query = "update general set resturn='SUCCESS',leader2='{$general['leader2']}',dedication=dedication+'$ded',experience=experience+'$exp' where no='{$general['no']}'"; @@ -1001,7 +1007,7 @@ function process_11(&$general, $type) { $exp = $crew; $ded = $crew; // 숙련도 증가 - addGenDex($general['no'], $armtype, $crew); + addGenDex($general['no'], GameConst::$maxatmos, GameConst::$maxtrain, $armtype, $crew); // 성격 보정 $exp = CharExperience($exp, $general['personal']); $ded = CharDedication($ded, $general['personal']); @@ -1071,7 +1077,7 @@ function process_13(&$general) { $exp = 100; $ded = 70; // 숙련도 증가 - addGenDex($general['no'], $general['crewtype'], Util::round($general['crew']/100)); + addGenDex($general['no'], GameConst::$maxatmos, GameConst::$maxtrain, $general['crewtype'], Util::round($general['crew']/100)); // 성격 보정 $exp = CharExperience($exp, $general['personal']); $ded = CharDedication($ded, $general['personal']); @@ -1143,7 +1149,7 @@ function process_14(&$general) { $exp = 100; $ded = 70; // 숙련도 증가 - addGenDex($general['no'], $general['crewtype'], Util::round($general['crew']/100)); + addGenDex($general['no'], GameConst::$maxatmos, GameConst::$maxtrain, $general['crewtype'], Util::round($general['crew']/100)); // 성격 보정 $exp = CharExperience($exp, $general['personal']); $ded = CharDedication($ded, $general['personal']); @@ -1219,7 +1225,7 @@ function process_15(&$general) { $exp = 100 * 3; $ded = 70 * 3; // 숙련도 증가 - addGenDex($general['no'], $general['crewtype'], Util::round($general['crew']/100 * 3)); + addGenDex($general['no'], GameConst::$maxatmos, GameConst::$maxtrain, $general['crewtype'], Util::round($general['crew']/100 * 3)); // 성격 보정 $exp = CharExperience($exp, $general['personal']); $ded = CharDedication($ded, $general['personal']); @@ -1307,7 +1313,7 @@ function process_16(&$general) { $query = "update city set state=43,term=3 where city='{$destcity['city']}'"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); // 숙련도 증가 - addGenDex($general['no'], $general['crewtype'], Util::round($general['crew']/100)); + addGenDex($general['no'], GameConst::$maxatmos, GameConst::$maxtrain, $general['crewtype'], Util::round($general['crew']/100)); // 전투 처리 $dead = processWar($general, $destcity); @@ -1812,17 +1818,17 @@ function process_41(&$general) { if($ratio < 33) { // 숙련도 증가 - addGenDex($general['no'], $general['crewtype'], $crewexp); + addGenDex($general['no'], GameConst::$maxatmos, GameConst::$maxtrain, $general['crewtype'], $crewexp); $log[] = "●{$admin['month']}월:$crewstr 숙련도 향상이 지지부진했습니다. <1>$date"; } elseif($ratio < 66) { $exp = $exp * 2; // 숙련도 증가 - addGenDex($general['no'], $general['crewtype'], $crewexp * 2); + addGenDex($general['no'], GameConst::$maxatmos, GameConst::$maxtrain, $general['crewtype'], $crewexp * 2); $log[] = "●{$admin['month']}월:$crewstr 숙련도가 향상되었습니다. <1>$date"; } else { $exp = $exp * 3; // 숙련도 증가 - addGenDex($general['no'], $general['crewtype'], $crewexp * 3); + addGenDex($general['no'], GameConst::$maxatmos, GameConst::$maxtrain, $general['crewtype'], $crewexp * 3); $log[] = "●{$admin['month']}월:$crewstr 숙련도가 일취월장했습니다. <1>$date"; } @@ -2458,7 +2464,7 @@ function process_49(&$general) { MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); // 경험치 상승 - switch(rand()%3) { + switch(Util::choiceRandomUsingWeight([$general['leader'], $general['power'], $general['intel']])) { case 0: $general['leader2']++; $query = "update general set leader2='{$general['leader2']}' where no='{$general['no']}'"; diff --git a/hwe/func_process_personnel.php b/hwe/func_process_personnel.php index 83300a8f..fcd60126 100644 --- a/hwe/func_process_personnel.php +++ b/hwe/func_process_personnel.php @@ -132,9 +132,15 @@ function process_25(&$general) { } elseif(strpos($general['nations'], ",{$nation['nation']},") > 0) { $log[] = "●{$admin['month']}월:이미 임관했었던 국가입니다. 임관 실패. <1>$date"; } else { - $alllog[] = "●{$admin['month']}월:{$general['name']}(이)가 {$nation['name']}임관했습니다."; - $log[] = "●{$admin['month']}월:{$nation['name']}에 임관했습니다. <1>$date"; - pushGeneralHistory($general, "●{$admin['year']}년 {$admin['month']}월:{$nation['name']}에 임관"); + if($where == 99 || $where == 98) { + $alllog[] = "●{$admin['month']}월:{$general['name']}(이)가 어쩌다보니 {$nation['name']}임관했습니다."; + $log[] = "●{$admin['month']}월:{$nation['name']}에 랜덤으로 임관했습니다. <1>$date"; + pushGeneralHistory($general, "●{$admin['year']}년 {$admin['month']}월:{$nation['name']}에 임관"); + } else { + $alllog[] = "●{$admin['month']}월:{$general['name']}(이)가 {$nation['name']}임관했습니다."; + $log[] = "●{$admin['month']}월:{$nation['name']}에 임관했습니다. <1>$date"; + pushGeneralHistory($general, "●{$admin['year']}년 {$admin['month']}월:{$nation['name']}에 임관"); + } if($gencount < 10) { $exp = 700; } else { $exp = 100; } @@ -227,7 +233,7 @@ function process_29(&$general) { if(rand() % $criteria > 0) { $exp = 100; $ded = 70; - switch(rand()%3) { + switch(Util::choiceRandomUsingWeight([$general['leader'], $general['power'], $general['intel']])) { case 0: $general['leader2'] += 1; break; case 1: $general['power2'] += 1; break; case 2: $general['intel2'] += 1; break; @@ -237,7 +243,7 @@ function process_29(&$general) { // 탐색 성공 $exp = 200; $ded = 300; - switch(rand()%3) { + switch(Util::choiceRandomUsingWeight([$general['leader'], $general['power'], $general['intel']])) { case 0: $general['leader2'] += 3; break; case 1: $general['power2'] += 3; break; case 2: $general['intel2'] += 3; break; diff --git a/hwe/func_process_trick.php b/hwe/func_process_trick.php index c97e6519..a7a22c35 100644 --- a/hwe/func_process_trick.php +++ b/hwe/func_process_trick.php @@ -458,7 +458,7 @@ function process_35(&$general) { } elseif($dip['state'] >= 7) { $log[] = "●{$admin['month']}월:불가침국입니다. {$destcity['name']}에 선동 실패. <1>$date"; } else { - $query = "select leader,horse,power,weap,intel,book,injury from general where city='$destination' and nation='{$destcity['nation']}' order by sum desc"; + $query = "select leader,horse,power,weap,intel,book,injury from general where city='$destination' and nation='{$destcity['nation']}' order by leader desc"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $gen = MYDB_fetch_array($result); diff --git a/hwe/join_post.php b/hwe/join_post.php index a757c5b0..b32e63bb 100644 --- a/hwe/join_post.php +++ b/hwe/join_post.php @@ -136,7 +136,7 @@ $pleader = 0; $ppower = 0; $pintel = 0; for ($statBonusCnt = 3 + mt_rand(0, 2); $statBonusCnt > 0; $statBonusCnt--) { - switch (Util::choiceRandomUsingWeight(array($leader, $power, $intel))) { + switch (Util::choiceRandomUsingWeight([$leader, $power, $intel])) { case 0: $pleader++; break; diff --git a/hwe/process_war.php b/hwe/process_war.php index 0d9e91a1..0d17ed57 100644 --- a/hwe/process_war.php +++ b/hwe/process_war.php @@ -272,11 +272,11 @@ function processWar($general, $city) { } } } elseif($general['crewtype'] == 40) { // 정란 - $cityCrew = $cityCrew * 1.5; + $cityCrew = $cityCrew * 1.8; } elseif($general['crewtype'] == 41) { // 충차 - $cityCrew = $cityCrew * 2.0; + $cityCrew = $cityCrew * 2.4; } elseif($general['crewtype'] == 42) { // 벽력거 - $cityCrew = $cityCrew * 1.5; + $cityCrew = $cityCrew * 1.8; } //군주 공격 보정 10% if($general['level'] == 12) { @@ -316,13 +316,14 @@ function processWar($general, $city) { //회피 $ratio = rand() % 100; // 0 ~ 99 $ratio2 = GameUnitConst::byID($general['crewtype'])->avoid; //회피율 + $ratio2 = Util::round($ratio2 * $general['train'] / 100); //훈련 반영 //특기보정 : 궁병 if($general['special2'] == 51) { $ratio2 += 20; } //도구 보정 : 둔갑천서, 태평요술 if($general['item'] == 26 || $general['item'] == 25) { $ratio2 += 20; } if($ratio < $ratio2 && $avoid == 1) { $batlog[] = "회피했다!"; - $myCrew /= 10; // 10%만 소모 + $myCrew /= 5; // 20%만 소모 $avoid = 0; } @@ -456,8 +457,8 @@ function processWar($general, $city) { $query = "update general set crew='{$general['crew']}',killcrew=killcrew+'$mykillnum',deathcrew=deathcrew+'$mydeathnum' where no='{$general['no']}'"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); // 숙련도 증가 - addGenDex($general['no'], $general['crewtype'], $mykillnum); - addGenDex($general['no'], 40, $mydeathnum); + addGenDex($general['no'], $general['atmos'], $general['train'], $general['crewtype'], $mykillnum); + addGenDex($general['no'], $general['atmos'], $general['train'], 40, $mydeathnum); // 죽은수 기술로 누적 $num = Util::round($mydeathnum * 0.01); // 국가보정 @@ -1137,6 +1138,7 @@ function processWar($general, $city) { //회피 $ratio = rand() % 100; // 0 ~ 99 $ratio2 = GameUnitConst::byID($general['crewtype'])->avoid; //회피율 + $ratio2 = Util::round($ratio2 * $general['train'] / 100); //훈련 반영 //특기보정 : 돌격, 궁병 if($oppose['special2'] == 60) { $ratio2 -= 100; } if($general['special2'] == 51) { $ratio2 += 20; } @@ -1152,13 +1154,14 @@ function processWar($general, $city) { } else { $batlog[] = "회피했다!"; $oppbatlog[] = "●상대가 회피했다!"; - $myCrew /= 10; // 10%만 소모 + $myCrew /= 5; // 20%만 소모 $myAvoid = 0; } } //회피 $ratio = rand() % 100; // 0 ~ 99 $ratio2 = GameUnitConst::byID($oppose['crewtype'])->defence; //회피율 + $ratio2 = Util::round($ratio2 * $oppose['train'] / 100); //훈련 반영 // 특기보정 : 돌격, 궁병 if($general['special2'] == 60) { $ratio2 -= 100; } if($oppose['special2'] == 51) { $ratio2 += 20; } @@ -1180,7 +1183,7 @@ function processWar($general, $city) { } else { $oppbatlog[] = "회피했다!"; $batlog[] = "●상대가 회피했다!"; - $opCrew /= 10; // 10%만 소모 + $opCrew /= 5; // 20%만 소모 $opAvoid = 0; } } @@ -1329,8 +1332,8 @@ function processWar($general, $city) { $query = "update general set injury='{$oppose['injury']}',crew='{$oppose['crew']}',killcrew=killcrew+'$opkillnum',deathcrew=deathcrew+'$opdeathnum' where no='{$oppose['no']}'"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); // 숙련도 증가 - addGenDex($oppose['no'], $oppose['crewtype'], $opkillnum * 0.9); - addGenDex($oppose['no'], $general['crewtype'], $opdeathnum * 0.9); + addGenDex($oppose['no'], $general['atmos'], $general['train'], $oppose['crewtype'], $opkillnum * 0.9); + addGenDex($oppose['no'], $general['atmos'], $general['train'], $general['crewtype'], $opdeathnum * 0.9); // 죽은수 기술로 누적 $num = Util::round($mydeathnum * 0.01); // 국가보정 @@ -1352,8 +1355,8 @@ function processWar($general, $city) { $query = "update general set injury='{$general['injury']}',crew='{$general['crew']}',killcrew=killcrew+'$mykillnum',deathcrew=deathcrew+'$mydeathnum' where no='{$general['no']}'"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); // 숙련도 증가 - addGenDex($general['no'], $general['crewtype'], $mykillnum); - addGenDex($general['no'], $oppose['crewtype'], $mydeathnum); + addGenDex($general['no'], $general['atmos'], $general['train'], $general['crewtype'], $mykillnum); + addGenDex($general['no'], $general['atmos'], $general['train'], $oppose['crewtype'], $mydeathnum); // 죽은수 기술로 누적 $num = Util::round($opdeathnum * 0.01); // 국가보정 @@ -1548,10 +1551,10 @@ function CriticalRatio3($general) { $ratio = max($mainstat - 65, 0); if ($crewtype >= 3) { - $ratio /= 2; + $ratio *= 0.4; } else{ - $ratio *= 0.7; + $ratio *= 0.5; } $ratio = round($ratio); @@ -1562,20 +1565,6 @@ function CriticalRatio3($general) { return $ratio; } -function CriticalRatio2($leader, $power, $intel) { - // 707010장수 9% 706515장수 17% 706020장수 25% xx50xx장수 57% - if($leader <= $power && $leader <= $intel) { // 통솔이 제일 낮은경우 - $ratio = sqrt($leader/($leader+$power+$intel))*150 - 30; - } elseif($power < $leader && $power <= $intel) { // 무력이 제일 낮은경우 - $ratio = sqrt($power /($leader+$power+$intel))*150 - 30; - } elseif($intel < $leader && $intel < $power) { // 지력이 제일 낮은경우 - $ratio = sqrt($intel /($leader+$power+$intel))*150 - 30; - } - - if($ratio > 50) $ratio = 50; - return $ratio; -} - function CriticalScore2($score) { $score = Util::round($score * (rand()%8 + 13)/10); // 1.3~2.0 return $score; diff --git a/hwe/sql/schema.sql b/hwe/sql/schema.sql index 6a4b4ccb..a1dfd6fb 100644 --- a/hwe/sql/schema.sql +++ b/hwe/sql/schema.sql @@ -192,7 +192,6 @@ create table nation ( l5set int(1) default 0, scout int(1) default 0, war int(1) default 0, - myset int(1) default 3, tricklimit int(4) default 36, surlimit int(4) default 72, scoutmsg text default '', From be7154284ee9ae14a22e8753b339d76880ed0c0b Mon Sep 17 00:00:00 2001 From: hide_d Date: Fri, 13 Apr 2018 15:48:47 +0900 Subject: [PATCH 03/66] =?UTF-8?q?=EB=93=B1=EC=9A=A9=EC=9E=A5=20=EC=88=98?= =?UTF-8?q?=EB=9D=BD=20=EC=BD=94=EB=93=9C=20=EC=9E=91=EC=84=B1=EC=A4=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/sammo/Message.php | 4 ++-- hwe/sammo/ScoutMessage.php | 46 +++++++++++++++++++++++++++++++++----- 2 files changed, 42 insertions(+), 8 deletions(-) diff --git a/hwe/sammo/Message.php b/hwe/sammo/Message.php index 086cc179..466766aa 100644 --- a/hwe/sammo/Message.php +++ b/hwe/sammo/Message.php @@ -19,9 +19,9 @@ class Message protected $sendCnt = 0; public $msgType; - /** @var MessageTarget */ + /** @var \sammo\MessageTarget */ public $src; - /** @var MessageTarget */ + /** @var \sammo\MessageTarget */ public $dest; public $msg; /** @var \DateTime */ diff --git a/hwe/sammo/ScoutMessage.php b/hwe/sammo/ScoutMessage.php index 7295f422..35c94ca5 100644 --- a/hwe/sammo/ScoutMessage.php +++ b/hwe/sammo/ScoutMessage.php @@ -3,6 +3,11 @@ namespace sammo; class ScoutMessage extends Message{ + const ACCEPTED = 1; + const DECLINED = -1; + const INVALID = 0; + protected $validScout = true; + public function __construct( string $msgType, MessageTarget $src, @@ -16,12 +21,44 @@ class ScoutMessage extends Message{ if ($msgType !== self::MSGTYPE_PRIVATE){ throw new \InvalidArgumentException('DiplomaticMessage msgType'); } - parent::__construct(...func_get_args()); - //TODO: 누가, 누구에게 보낸 건지 파싱 + if(Util::array_get($msgOption['action']) !== 'scout'){ + throw new \InvalidArgumentException('Action !== scout'); + } + + parent::__construct(...func_get_args()); + + if(Util::array_get($msgOption['used'])){ + $this->validScout = false; + } } - public static function generateScoutMessage(int $srcGeneralID, int $destGeneralID, &$reason = null, \DateTime $date = null): Message{ + /** + * @return int 수행 결과 반환, ACCEPTED(등용장 소모), DECLINED(등용장 소모), INVALID 중 반환 + */ + public function agreeMessage(string &$reason=null):int{ + //NOTE: 올바른 유저가 agreeMessage() 호출을 한건지는 외부에서 체크 필요(Session->userID 등) + + if(!$this->validScout){ + if($reason !== null){ + $reason = '이미 사용한 등용장입니다'; + } + return self::INVALID; + } + if($this->mailbox !== $this->dest->generalID){ + if($reason !== null){ + $reason = '송신자가 등용장을 수락할 수 없습니다'; + } + return self::INVALID; + } + + + $db = DB::db(); + $general = $db->queryFirstRow('SELECT nation, `no`, city, nations FROM general WHERE `no`=%i', $this->dest->generalID); + + } + + public static function buildScoutMessage(int $srcGeneralID, int $destGeneralID, &$reason = null, \DateTime $date = null): Message{ if($srcGeneralID == $destGeneralID){ if($reason !== null){ $reason = '같은 장수에게 등용장을 보낼 수 없습니다'; @@ -84,8 +121,5 @@ class ScoutMessage extends Message{ return new ScoutMessage(Message::MSGTYPE_PRIVATE, $src, $dest, $msg, $date, $validUntil, $msgOption); } - public function send(){ - $this->sendToReceiver(); - } } \ No newline at end of file From 253a953dfe67b0e68f94391922782701c6008073 Mon Sep 17 00:00:00 2001 From: hide_d Date: Sat, 14 Apr 2018 00:15:25 +0900 Subject: [PATCH 04/66] =?UTF-8?q?SQL=20Injection=20=EB=8C=80=EC=9D=91?= =?UTF-8?q?=EC=9D=84=20=EC=9C=84=ED=95=B4=20=ED=8C=8C=EC=9D=BC=20=EC=83=81?= =?UTF-8?q?=EB=8B=A8=EC=97=90=20Util::getReq=20=EC=82=AC=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/a_bestGeneral.php | 1 + hwe/a_genList.php | 48 ++++++++++------ hwe/a_history.php | 6 +- hwe/a_npcList.php | 26 +++++---- hwe/a_vote.php | 1 + hwe/b_battleCenter.php | 7 ++- hwe/b_betting.php | 2 + hwe/b_genList.php | 4 +- hwe/b_myCityInfo.php | 5 +- hwe/b_myGenInfo.php | 4 +- hwe/b_myPage.php | 15 +++++ hwe/b_tournament.php | 2 + hwe/c_betting.php | 1 + hwe/c_chiefboard.php | 61 ++++++++++---------- hwe/c_double.php | 3 - hwe/c_myBossInfo.php | 10 ++++ hwe/c_nationrule.php | 1 + hwe/c_tournament.php | 128 +++++++++++++++++++++++++++++------------ hwe/c_troop.php | 1 - hwe/d_scout.php | 2 + hwe/join_post.php | 10 ++-- 21 files changed, 225 insertions(+), 113 deletions(-) diff --git a/hwe/a_bestGeneral.php b/hwe/a_bestGeneral.php index 18a62c8a..fb765ac1 100644 --- a/hwe/a_bestGeneral.php +++ b/hwe/a_bestGeneral.php @@ -55,6 +55,7 @@ if ($con >= 2) { =2"; } else { $sel = "npc<2"; diff --git a/hwe/a_genList.php b/hwe/a_genList.php index 4bcec301..1b0a9dee 100644 --- a/hwe/a_genList.php +++ b/hwe/a_genList.php @@ -3,6 +3,9 @@ namespace sammo; include "lib.php"; include "func.php"; + +$type = Util::getReq('type', 'int', 9); + //로그인 검사 $session = Session::requireGameLogin()->setReadOnly(); $userID = Session::getUserID(); @@ -13,17 +16,20 @@ $connect=$db->get(); increaseRefresh("장수일람", 2); $query = "select conlimit 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); $query = "select con,turntime from general where owner='{$userID}'"; -$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); +$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), ""); $me = MYDB_fetch_array($result); $con = checkLimit($me['con'], $admin['conlimit']); -if($con >= 2) { printLimitMsg($me['turntime']); exit(); } +if ($con >= 2) { + printLimitMsg($me['turntime']); + exit(); +} -if(!isset($type) || $type == 0) { +if ($type <= 0 || $type > 15) { $type = 9; } @@ -68,12 +74,12 @@ if(!isset($type) || $type == 0) { $nationname = []; $nationlevel = []; $nationname[0] = "-"; -foreach(getAllNationStaticInfo() as $nation){ +foreach (getAllNationStaticInfo() as $nation) { $nationname[$nation['nation']] = $nation['name']; $nationlevel[$nation['nation']] = $nation['level']; } -switch($type) { +switch ($type) { //FIXME: $query 처리 조심. case 1: $query = "select picture,imgsvr,npc,age,nation,special,special2,personal,name,injury,leader,power,intel,experience,dedication,level,killturn,connect from general order by nation"; break; case 2: $query = "select picture,imgsvr,npc,age,nation,special,special2,personal,name,injury,leader,power,intel,experience,dedication,level,killturn,connect from general order by leader desc"; break; case 3: $query = "select picture,imgsvr,npc,age,nation,special,special2,personal,name,injury,leader,power,intel,experience,dedication,level,killturn,connect from general order by power desc"; break; @@ -82,6 +88,7 @@ switch($type) { case 6: $query = "select picture,imgsvr,npc,age,nation,special,special2,personal,name,injury,leader,power,intel,experience,dedication,level,killturn,connect from general order by dedication desc"; break; case 7: $query = "select picture,imgsvr,npc,age,nation,special,special2,personal,name,injury,leader,power,intel,experience,dedication,level,killturn,connect from general order by level desc"; break; case 8: $query = "select picture,imgsvr,npc,age,nation,special,special2,personal,name,injury,leader,power,intel,experience,dedication,level,killturn,connect from general order by killturn"; break; + default: case 9: $query = "select picture,imgsvr,npc,age,nation,special,special2,personal,name,injury,leader,power,intel,experience,dedication,level,killturn,connect from general order by connect desc"; break; case 10: $query = "select picture,imgsvr,npc,age,nation,special,special2,personal,name,injury,leader,power,intel,experience,dedication,level,killturn,connect from general order by experience desc"; break; case 11: $query = "select picture,imgsvr,npc,age,nation,special,special2,personal,name,injury,leader,power,intel,experience,dedication,level,killturn,connect from general order by personal"; break; @@ -90,7 +97,7 @@ switch($type) { case 14: $query = "select picture,imgsvr,npc,age,nation,special,special2,personal,name,injury,leader,power,intel,experience,dedication,level,killturn,connect from general order by age desc"; break; case 15: $query = "select picture,imgsvr,npc,age,nation,special,special2,personal,name,injury,leader,power,intel,experience,dedication,level,killturn,connect from general order by npc desc"; break; } -$genresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); +$genresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), ""); $gencount = MYDB_num_rows($genresult); echo" @@ -112,24 +119,24 @@ echo" "; -for($j=0; $j < $gencount; $j++) { +for ($j=0; $j < $gencount; $j++) { $general = MYDB_fetch_array($genresult); $nation = $nationname[$general['nation']]; - if($general['level'] == 12) { + if ($general['level'] == 12) { $lbonus = $nationlevel[$general['nation']] * 2; - } elseif($general['level'] >= 5) { + } elseif ($general['level'] >= 5) { $lbonus = $nationlevel[$general['nation']]; } else { $lbonus = 0; } - if($lbonus > 0) { + if ($lbonus > 0) { $lbonus = "+{$lbonus}"; } else { $lbonus = ""; } - if($general['injury'] > 0) { + if ($general['injury'] > 0) { $leader = intdiv($general['leader'] * (100 - $general['injury']), 100); $power = intdiv($general['power'] * (100 - $general['injury']), 100); $intel = intdiv($general['intel'] * (100 - $general['injury']), 100); @@ -142,9 +149,13 @@ for($j=0; $j < $gencount; $j++) { $intel = "{$general['intel']}"; } - if($general['npc'] >= 2) { $name = "{$general['name']}"; } - elseif($general['npc'] == 1) { $name = "{$general['name']}"; } - else { $name = "{$general['name']}"; } + if ($general['npc'] >= 2) { + $name = "{$general['name']}"; + } elseif ($general['npc'] == 1) { + $name = "{$general['name']}"; + } else { + $name = "{$general['name']}"; + } $general['connect'] = Util::round($general['connect'] / 10) * 10; @@ -160,12 +171,15 @@ for($j=0; $j < $gencount; $j++) { - + - + "; } echo " diff --git a/hwe/a_history.php b/hwe/a_history.php index 593e53c3..8d4a42d9 100644 --- a/hwe/a_history.php +++ b/hwe/a_history.php @@ -4,7 +4,7 @@ namespace sammo; include "lib.php"; include "func.php"; $btn = Util::getReq('btn'); -$yearmonth = Util::getReq('yearmonth'); +$yearmonth = Util::getReq('yearmonth', 'int'); //로그인 검사 $session = Session::requireGameLogin()->setReadOnly(); @@ -44,8 +44,8 @@ if (!$yearmonth) { $year = $admin['year']; $month = $admin['month'] - 1; } else { - $year = substr($yearmonth, 0, 3) - 0; - $month = substr($yearmonth, 3, 2) - 0; + $year = intdiv($yearmonth, 100); + $month = $yearmonth % 100; if ($btn == "◀◀ 이전달") { $month -= 1; diff --git a/hwe/a_npcList.php b/hwe/a_npcList.php index 42233b3a..e120155a 100644 --- a/hwe/a_npcList.php +++ b/hwe/a_npcList.php @@ -6,14 +6,15 @@ include "func.php"; $type = Util::getReq('type', 'int', 1); +if($type <= 0 || $type > 8){ + $type = 1; +} + $db = DB::db(); $connect=$db->get(); increaseRefresh("빙의일람", 2); -if($type == 0) { - $type = 1; -} $sel = []; $sel[$type] = "selected"; @@ -49,11 +50,12 @@ $sel[$type] = "selected"; 명성"; -for($j=0; $j < $gencount; $j++) { +for ($j=0; $j < $gencount; $j++) { $general = MYDB_fetch_array($genresult); $nation = $nationname[$general['nation']]; - if($general['npc'] >= 2) { $name = "{$general['name']}"; } - elseif($general['npc'] == 1) { $name = "{$general['name']}"; } - else { $name = "{$general['name']}"; } + if ($general['npc'] >= 2) { + $name = "{$general['name']}"; + } elseif ($general['npc'] == 1) { + $name = "{$general['name']}"; + } else { + $name = "{$general['name']}"; + } echo " diff --git a/hwe/a_vote.php b/hwe/a_vote.php index 8bb7cbe9..56f9b63f 100644 --- a/hwe/a_vote.php +++ b/hwe/a_vote.php @@ -340,6 +340,7 @@ function getVoteColor($type) } switch ($type) { + default: case 0: $color = "black"; break; case 1: $color = "red"; break; case 2: $color = "orange"; break; diff --git a/hwe/b_battleCenter.php b/hwe/b_battleCenter.php index 1fe2ab0a..89caa475 100644 --- a/hwe/b_battleCenter.php +++ b/hwe/b_battleCenter.php @@ -9,8 +9,8 @@ $v->rule('required', 'gen') ->rule('integer', 'gen'); $btn = Util::getReq('btn'); -$gen = Util::getReq('gen', 'int'); -$type = Util::getReq('type', 'int'); +$gen = Util::getReq('gen', 'int', 0); +$type = Util::getReq('type', 'int', 0); //로그인 검사 $session = Session::requireGameLogin()->setReadOnly(); @@ -61,7 +61,7 @@ if ($btn == '정렬하기') { $gen = 0; } -if ($type == 0) { +if ($type <= 0 || $type > 3) { $type = 0; } $sel = []; @@ -96,6 +96,7 @@ $sel[$type] = "selected";
삭턴 벌점
{$nation} ".getHonor($general['experience'])." ".getDed($general['dedication']).""; echo getLevel($general['level']); echo ""; + echo getLevel($general['level']); + echo " $leader $power $intel {$general['killturn']}{$general['connect']}"; echo "
【".getConnect($general['connect'])."】
{$general['connect']}"; + echo "
【".getConnect($general['connect'])."】
계급
= 100) { $w -= 0.1; @@ -132,7 +133,7 @@ $dt = date('H:i');
접 속 량
= 100) { $w -= 0.1; diff --git a/hwe/b_diplomacy.php b/hwe/b_diplomacy.php index 0b166c34..00d53b2d 100644 --- a/hwe/b_diplomacy.php +++ b/hwe/b_diplomacy.php @@ -56,7 +56,7 @@ foreach ($db->queryAllLists('SELECT city, `name`, conflict FROM city WHERE confl $rawConflict )) { - $conflict = Json::decode($city['conflict']); + $conflict = Json::decode($rawConflict); if (count($conflict)<2) { continue; } diff --git a/i_entrance/j_icon_change.php b/i_entrance/j_icon_change.php index ddb34941..29b7303b 100644 --- a/i_entrance/j_icon_change.php +++ b/i_entrance/j_icon_change.php @@ -65,7 +65,7 @@ if(!is_uploaded_file($image['tmp_name'])) { while(true){ $newPicName = dechex(rand(0x000000f,0xfffffff)).$newExt; - $dest = AppConf::getUserIconPathFS().$newPicName; + $dest = AppConf::getUserIconPathFS().'/'.$newPicName; if(file_exists($dest)){ continue; } From a03d2cee63a170b0399c89693f5520adf15963a3 Mon Sep 17 00:00:00 2001 From: hide_d Date: Sat, 14 Apr 2018 00:28:24 +0900 Subject: [PATCH 06/66] =?UTF-8?q?lib.php=EC=97=90=EC=84=9C=20=EA=B0=95?= =?UTF-8?q?=EC=A0=9C=EB=A1=9C=20$=5FPOST=20=EC=B6=94=EC=B6=9C=EC=9D=84=20?= =?UTF-8?q?=EC=8B=9C=ED=96=89=ED=95=98=EB=8D=98=20=EB=B6=80=EB=B6=84?= =?UTF-8?q?=EC=9D=84=20=EC=84=B8=EB=B6=80=20=ED=8C=8C=EC=9D=BC=EB=A1=9C=20?= =?UTF-8?q?=EC=9D=B4=EB=8F=99.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/_119_b.php | 2 ++ hwe/_admin1_submit.php | 2 ++ hwe/_admin2_submit.php | 2 ++ hwe/_admin4_submit.php | 2 ++ hwe/_admin5.php | 2 ++ hwe/_admin5_submit.php | 2 ++ hwe/_admin6.php | 2 ++ hwe/_admin7.php | 2 ++ hwe/_admin8.php | 2 ++ hwe/a_bestGeneral.php | 2 ++ hwe/a_emperior.php | 2 ++ hwe/a_emperior2.php | 2 ++ hwe/a_genList.php | 2 ++ hwe/a_history.php | 2 ++ hwe/a_npcList.php | 2 ++ hwe/b_auction.php | 2 ++ hwe/b_battleCenter.php | 2 ++ hwe/b_currentCity.php | 2 ++ hwe/b_genList.php | 2 ++ hwe/b_myCityInfo.php | 2 ++ hwe/b_myGenInfo.php | 2 ++ hwe/b_myPage.php | 2 ++ hwe/c_auction.php | 2 ++ hwe/c_betting.php | 5 +++++ hwe/c_chiefboard.php | 2 ++ hwe/c_dipcenter.php | 2 ++ hwe/c_double.php | 2 ++ hwe/c_myBossInfo.php | 2 ++ hwe/c_nationboard.php | 2 ++ hwe/c_nationrule.php | 2 ++ hwe/c_tournament.php | 2 ++ hwe/c_troop.php | 2 ++ hwe/c_vote.php | 2 ++ hwe/d_ally.php | 2 ++ hwe/d_cancel.php | 2 ++ hwe/d_cease.php | 2 ++ hwe/d_merge.php | 2 ++ hwe/d_scout.php | 2 ++ hwe/d_surrender.php | 2 ++ hwe/j_install_db.php | 2 ++ hwe/j_map_history.php | 2 ++ hwe/join_post.php | 2 ++ hwe/lib.php | 17 ++++++++++------- hwe/preprocessing.php | 2 ++ hwe/processing.php | 2 ++ hwe/turn.php | 2 ++ 46 files changed, 103 insertions(+), 7 deletions(-) diff --git a/hwe/_119_b.php b/hwe/_119_b.php index e6dfe110..34ba6505 100644 --- a/hwe/_119_b.php +++ b/hwe/_119_b.php @@ -24,6 +24,8 @@ $btn = Util::getReq('btn'); $minute = Util::getReq('minute', 'int'); $minute2 = Util::getReq('minute2', 'int'); +extractMissingPostToGlobals(); + $db = DB::db(); $connect=$db->get(); diff --git a/hwe/_admin1_submit.php b/hwe/_admin1_submit.php index 9a2c65de..82d7fc9a 100644 --- a/hwe/_admin1_submit.php +++ b/hwe/_admin1_submit.php @@ -29,6 +29,8 @@ $maxgeneral = Util::getReq('maxgeneral', 'int', GameConst::$defaultMaxGeneral); $maxnation = Util::getReq('maxnation', 'int', GameConst::$defaultMaxNation); $startyear = Util::getReq('startyear', 'int', GameConst::$defaultStartYear); +extractMissingPostToGlobals(); + $db = DB::db(); $connect=$db->get(); diff --git a/hwe/_admin2_submit.php b/hwe/_admin2_submit.php index fc568cc1..eead775e 100644 --- a/hwe/_admin2_submit.php +++ b/hwe/_admin2_submit.php @@ -7,6 +7,8 @@ include "func.php"; $btn = Util::getReq('btn'); $weap = Util::getReq('weap', 'int'); +extractMissingPostToGlobals(); + //로그인 검사 $session = Session::requireLogin()->loginGame()->setReadOnly(); diff --git a/hwe/_admin4_submit.php b/hwe/_admin4_submit.php index 61b4e71c..19248da0 100644 --- a/hwe/_admin4_submit.php +++ b/hwe/_admin4_submit.php @@ -14,6 +14,8 @@ if($session->userGrade < 5) { $btn = Util::getReq('btn'); $genlist = Util::getReq('genlist', 'int'); +extractMissingPostToGlobals(); + $db = DB::db(); $connect=$db->get(); diff --git a/hwe/_admin5.php b/hwe/_admin5.php index e22c0b2f..c045a126 100644 --- a/hwe/_admin5.php +++ b/hwe/_admin5.php @@ -7,6 +7,8 @@ include "func.php"; $type = Util::getReq('type', 'int', 0); $type2 = Util::getReq('type2', 'int', 0); +extractMissingPostToGlobals(); + //로그인 검사 $session = Session::requireGameLogin()->setReadOnly(); diff --git a/hwe/_admin5_submit.php b/hwe/_admin5_submit.php index b5fa892c..4a3c60c9 100644 --- a/hwe/_admin5_submit.php +++ b/hwe/_admin5_submit.php @@ -7,6 +7,8 @@ include "func.php"; $btn = Util::getReq('btn'); $nation = Util::getReq('nation', 'int'); +extractMissingPostToGlobals(); + //로그인 검사 $session = Session::requireGameLogin()->setReadOnly(); $userID = Session::getUserID(); diff --git a/hwe/_admin6.php b/hwe/_admin6.php index 4daeaad0..9102e875 100644 --- a/hwe/_admin6.php +++ b/hwe/_admin6.php @@ -6,6 +6,8 @@ include "func.php"; $type = Util::getReq('type', 'int'); +extractMissingPostToGlobals(); + //로그인 검사 $session = Session::requireGameLogin()->setReadOnly(); diff --git a/hwe/_admin7.php b/hwe/_admin7.php index 7610e758..98e65466 100644 --- a/hwe/_admin7.php +++ b/hwe/_admin7.php @@ -8,6 +8,8 @@ $btn = Util::getReq('btn'); $gen = Util::getReq('gen', 'int', 0); $type = Util::getReq('type', 'int'); +extractMissingPostToGlobals(); + //로그인 검사 $session = Session::requireGameLogin()->setReadOnly(); diff --git a/hwe/_admin8.php b/hwe/_admin8.php index 3c3bded4..c31d991f 100644 --- a/hwe/_admin8.php +++ b/hwe/_admin8.php @@ -8,6 +8,8 @@ $btn = Util::getReq('btn'); $gen = Util::getReq('gen', 'int', 0); $type = Util::getReq('type', 'int'); +extractMissingPostToGlobals(); + //로그인 검사 $session = Session::requireGameLogin()->setReadOnly(); diff --git a/hwe/a_bestGeneral.php b/hwe/a_bestGeneral.php index fb765ac1..92e1236b 100644 --- a/hwe/a_bestGeneral.php +++ b/hwe/a_bestGeneral.php @@ -6,6 +6,8 @@ include "func.php"; $btn = Util::getReq('btn'); +extractMissingPostToGlobals(); + //로그인 검사 $session = Session::requireGameLogin()->setReadOnly(); $userID = Session::getUserID(); diff --git a/hwe/a_emperior.php b/hwe/a_emperior.php index b7e41e6a..c09d1205 100644 --- a/hwe/a_emperior.php +++ b/hwe/a_emperior.php @@ -6,6 +6,8 @@ include "func.php"; $select = Util::getReq('select', 'int', 0); +extractMissingPostToGlobals(); + $db = DB::db(); $connect=$db->get(); diff --git a/hwe/a_emperior2.php b/hwe/a_emperior2.php index 4f2996a0..eae1b186 100644 --- a/hwe/a_emperior2.php +++ b/hwe/a_emperior2.php @@ -6,6 +6,8 @@ include "func.php"; $select = Util::getReq('select', 'int', 0); +extractMissingPostToGlobals(); + $db = DB::db(); $connect=$db->get(); diff --git a/hwe/a_genList.php b/hwe/a_genList.php index 1b0a9dee..0de1c55e 100644 --- a/hwe/a_genList.php +++ b/hwe/a_genList.php @@ -6,6 +6,8 @@ include "func.php"; $type = Util::getReq('type', 'int', 9); +extractMissingPostToGlobals(); + //로그인 검사 $session = Session::requireGameLogin()->setReadOnly(); $userID = Session::getUserID(); diff --git a/hwe/a_history.php b/hwe/a_history.php index 8d4a42d9..14a2ff9c 100644 --- a/hwe/a_history.php +++ b/hwe/a_history.php @@ -6,6 +6,8 @@ include "func.php"; $btn = Util::getReq('btn'); $yearmonth = Util::getReq('yearmonth', 'int'); +extractMissingPostToGlobals(); + //로그인 검사 $session = Session::requireGameLogin()->setReadOnly(); $userID = Session::getUserID(); diff --git a/hwe/a_npcList.php b/hwe/a_npcList.php index e120155a..09963a91 100644 --- a/hwe/a_npcList.php +++ b/hwe/a_npcList.php @@ -6,6 +6,8 @@ include "func.php"; $type = Util::getReq('type', 'int', 1); +extractMissingPostToGlobals(); + if($type <= 0 || $type > 8){ $type = 1; } diff --git a/hwe/b_auction.php b/hwe/b_auction.php index 8f584be9..9690c1ab 100644 --- a/hwe/b_auction.php +++ b/hwe/b_auction.php @@ -7,6 +7,8 @@ include "func.php"; $msg = Util::getReq('msg'); $msg2 = Util::getReq('msg2'); +extractMissingPostToGlobals(); + //로그인 검사 $session = Session::requireGameLogin()->setReadOnly(); $userID = Session::getUserID(); diff --git a/hwe/b_battleCenter.php b/hwe/b_battleCenter.php index 89caa475..b0c0390c 100644 --- a/hwe/b_battleCenter.php +++ b/hwe/b_battleCenter.php @@ -12,6 +12,8 @@ $btn = Util::getReq('btn'); $gen = Util::getReq('gen', 'int', 0); $type = Util::getReq('type', 'int', 0); +extractMissingPostToGlobals(); + //로그인 검사 $session = Session::requireGameLogin()->setReadOnly(); $userID = Session::getUserID(); diff --git a/hwe/b_currentCity.php b/hwe/b_currentCity.php index bbe29353..b509b2d0 100644 --- a/hwe/b_currentCity.php +++ b/hwe/b_currentCity.php @@ -6,6 +6,8 @@ include "func.php"; $citylist = Util::getReq('citylist', 'int'); +extractMissingPostToGlobals(); + //로그인 검사 $session = Session::requireGameLogin()->setReadOnly(); $userID = Session::getUserID(); diff --git a/hwe/b_genList.php b/hwe/b_genList.php index 07565e93..24d4fdee 100644 --- a/hwe/b_genList.php +++ b/hwe/b_genList.php @@ -6,6 +6,8 @@ include "func.php"; $type = Util::getReq('type', 'int', 7); +extractMissingPostToGlobals(); + //로그인 검사 $session = Session::requireGameLogin()->setReadOnly(); $userID = Session::getUserID(); diff --git a/hwe/b_myCityInfo.php b/hwe/b_myCityInfo.php index 575fe3f8..26230074 100644 --- a/hwe/b_myCityInfo.php +++ b/hwe/b_myCityInfo.php @@ -6,6 +6,8 @@ include "func.php"; $type = Util::getReq('type', 'int', 10); +extractMissingPostToGlobals(); + //로그인 검사 $session = Session::requireGameLogin()->setReadOnly(); $userID = Session::getUserID(); diff --git a/hwe/b_myGenInfo.php b/hwe/b_myGenInfo.php index 8e28b10a..ebfb0448 100644 --- a/hwe/b_myGenInfo.php +++ b/hwe/b_myGenInfo.php @@ -6,6 +6,8 @@ include "func.php"; $type = Util::getReq('type', 'int', 1); +extractMissingPostToGlobals(); + //로그인 검사 $session = Session::requireGameLogin()->setReadOnly(); $userID = Session::getUserID(); diff --git a/hwe/b_myPage.php b/hwe/b_myPage.php index 409e515a..987610f8 100644 --- a/hwe/b_myPage.php +++ b/hwe/b_myPage.php @@ -9,6 +9,8 @@ $map = Util::getReq('map', 'int', 0); $mode = Util::getReq('mode', 'int', 2); $tnmt = Util::getReq('tnmt', 'int', 1); +extractMissingPostToGlobals(); + if($map < 0 && $map > 2){ $map = 0; } diff --git a/hwe/c_auction.php b/hwe/c_auction.php index 524c537b..460a95e6 100644 --- a/hwe/c_auction.php +++ b/hwe/c_auction.php @@ -24,6 +24,8 @@ $term = Util::getReq('term', 'int'); $stuff = Util::getReq('stuff', 'int'); $sel = Util::getReq('sel', 'int'); +extractMissingPostToGlobals(); + //로그인 검사 $session = Session::requireGameLogin()->setReadOnly(); $userID = Session::getUserID(); diff --git a/hwe/c_betting.php b/hwe/c_betting.php index c8238d0a..6aa93e51 100644 --- a/hwe/c_betting.php +++ b/hwe/c_betting.php @@ -22,6 +22,11 @@ for($i=0;$i<16;$i++){ } } +if($betGold == -1){ + extractMissingPostToGlobals(); +} + + if($betTarget < 0 || $betGold < 10 || $betGold > 1000){ header('Location: b_betting.php'); exit(); diff --git a/hwe/c_chiefboard.php b/hwe/c_chiefboard.php index c089b9c0..43003760 100644 --- a/hwe/c_chiefboard.php +++ b/hwe/c_chiefboard.php @@ -10,6 +10,8 @@ $num = Util::getReq('num'); $reply = Util::getReq('reply'); // $title, $msg, $num +extractMissingPostToGlobals(); + //로그인 검사 $session = Session::requireGameLogin()->setReadOnly(); $userID = Session::getUserID(); diff --git a/hwe/c_dipcenter.php b/hwe/c_dipcenter.php index 96f650f9..70d66542 100644 --- a/hwe/c_dipcenter.php +++ b/hwe/c_dipcenter.php @@ -12,6 +12,8 @@ $rate = Util::getReq('rate', 'int'); $bill = Util::getReq('bill', 'int'); $secretlimit = Util::getReq('secretlimit', 'int'); +extractMissingPostToGlobals(); + //로그인 검사 $session = Session::requireGameLogin()->setReadOnly(); $userID = Session::getUserID(); diff --git a/hwe/c_double.php b/hwe/c_double.php index 97868cae..f80ac357 100644 --- a/hwe/c_double.php +++ b/hwe/c_double.php @@ -14,6 +14,8 @@ $double = Util::getReq('double', 'int', 0); $third = Util::getReq('third', 'int', 0); $fourth = Util::getReq('fourth', 'int', 0); +extractMissingPostToGlobals(); + if(!$turn){ $turn = [0]; } diff --git a/hwe/c_myBossInfo.php b/hwe/c_myBossInfo.php index ed166ef9..b149ddbb 100644 --- a/hwe/c_myBossInfo.php +++ b/hwe/c_myBossInfo.php @@ -11,6 +11,8 @@ $genlist = Util::getReq('genlist', 'int'); $outlist = Util::getReq('outlist', 'int'); $citylist = Util::getReq('citylist', 'int'); +extractMissingPostToGlobals(); + //로그인 검사 $session = Session::requireGameLogin()->setReadOnly(); $userID = Session::getUserID(); diff --git a/hwe/c_nationboard.php b/hwe/c_nationboard.php index b76f046d..68a0b03f 100644 --- a/hwe/c_nationboard.php +++ b/hwe/c_nationboard.php @@ -8,6 +8,8 @@ $title = Util::getReq('title'); $msg = Util::getReq('msg'); $num = Util::getReq('num', 'int'); +extractMissingPostToGlobals(); + //로그인 검사 $session = Session::requireGameLogin()->setReadOnly(); $userID = Session::getUserID(); diff --git a/hwe/c_nationrule.php b/hwe/c_nationrule.php index 26932a63..d142b112 100644 --- a/hwe/c_nationrule.php +++ b/hwe/c_nationrule.php @@ -6,6 +6,8 @@ include "func.php"; // $msg $msg = Util::getReq('msg'); +extractMissingPostToGlobals(); + //로그인 검사 $session = Session::requireGameLogin()->setReadOnly(); $userID = Session::getUserID(); diff --git a/hwe/c_tournament.php b/hwe/c_tournament.php index 8173c19c..b240ff68 100644 --- a/hwe/c_tournament.php +++ b/hwe/c_tournament.php @@ -14,6 +14,8 @@ $gen = Util::getReq('gen', 'int'); $sel = Util::getReq('sel', 'int'); $trig = Util::getReq('trig', 'int'); +extractMissingPostToGlobals(); + //로그인 검사 $session = Session::requireGameLogin()->setReadOnly(); $userID = Session::getUserID(); diff --git a/hwe/c_troop.php b/hwe/c_troop.php index 44c00b1a..94c6f5cf 100644 --- a/hwe/c_troop.php +++ b/hwe/c_troop.php @@ -8,6 +8,8 @@ $btn = Util::getReq('btn'); $name = Util::getReq('name'); $troop = Util::getReq('troop', 'int'); +extractMissingPostToGlobals(); + //로그인 검사 $session = Session::requireGameLogin()->setReadOnly(); $userID = $session::getUserID(); diff --git a/hwe/c_vote.php b/hwe/c_vote.php index ca6385b0..6fca9aab 100644 --- a/hwe/c_vote.php +++ b/hwe/c_vote.php @@ -10,6 +10,8 @@ $comment = Util::getReq('comment'); $title = Util::getReq('title'); $str = Util::getReq('str'); +extractMissingPostToGlobals(); + //로그인 검사 $session = Session::requireGameLogin()->setReadOnly(); $userID = Session::getUserID(); diff --git a/hwe/d_ally.php b/hwe/d_ally.php index a5187102..a043c865 100644 --- a/hwe/d_ally.php +++ b/hwe/d_ally.php @@ -8,6 +8,8 @@ $ok = Util::getReq('ok'); $when = Util::getReq('when', 'int'); $gen = Util::getReq('gen', 'int'); //XXX: -_-;;;;;;;;;;;; +extractMissingPostToGlobals(); + //로그인 검사 $session = Session::requireGameLogin()->setReadOnly(); $userID = Session::getUserID(); diff --git a/hwe/d_cancel.php b/hwe/d_cancel.php index 252a1548..838b17d5 100644 --- a/hwe/d_cancel.php +++ b/hwe/d_cancel.php @@ -7,6 +7,8 @@ include "func.php"; $ok = Util::getReq('ok'); $gen = Util::getReq('gen', 'int'); //XXX: -_-;;;;;;;;;;;; +extractMissingPostToGlobals(); + //로그인 검사 $session = Session::requireGameLogin()->setReadOnly(); $userID = Session::getUserID(); diff --git a/hwe/d_cease.php b/hwe/d_cease.php index bce92012..bc017df2 100644 --- a/hwe/d_cease.php +++ b/hwe/d_cease.php @@ -7,6 +7,8 @@ include "func.php"; $ok = Util::getReq('ok'); $gen = Util::getReq('gen', 'int'); //XXX: -_-;;;;;;;;;;;; +extractMissingPostToGlobals(); + //로그인 검사 $session = Session::requireGameLogin()->setReadOnly(); $userID = Session::getUserID(); diff --git a/hwe/d_merge.php b/hwe/d_merge.php index ece9105b..2a06b2f9 100644 --- a/hwe/d_merge.php +++ b/hwe/d_merge.php @@ -7,6 +7,8 @@ include "func.php"; $ok = Util::getReq('ok'); $gen = Util::getReq('gen', 'int'); //XXX: -_-;;;;;;;;;;;; +extractMissingPostToGlobals(); + //로그인 검사 $session = Session::requireGameLogin()->setReadOnly(); $userID = Session::getUserID(); diff --git a/hwe/d_scout.php b/hwe/d_scout.php index 0b634d47..d40d32e8 100644 --- a/hwe/d_scout.php +++ b/hwe/d_scout.php @@ -12,6 +12,8 @@ include "func.php"; $gen = Util::getReq('gen', 'int'); +extractMissingPostToGlobals(); + $session = Session::requireGameLogin()->setReadOnly(); $userID = Session::getUserID(); //FIXME: 망했음. CriticalFailure. 재 구현. diff --git a/hwe/d_surrender.php b/hwe/d_surrender.php index 4af69215..85c73d7f 100644 --- a/hwe/d_surrender.php +++ b/hwe/d_surrender.php @@ -7,6 +7,8 @@ include "func.php"; $ok = Util::getReq('ok'); $gen = Util::getReq('gen', 'int'); //XXX: -_-;;;;;;;;;;;; +extractMissingPostToGlobals(); + //로그인 검사 $session = Session::requireGameLogin()->setReadOnly(); $userID = Session::getUserID(); diff --git a/hwe/j_install_db.php b/hwe/j_install_db.php index ee7ee67b..e104c449 100644 --- a/hwe/j_install_db.php +++ b/hwe/j_install_db.php @@ -19,6 +19,8 @@ $username = Util::getReq('db_id'); $password = Util::getReq('db_pw'); $dbName = Util::getReq('db_name'); +extractMissingPostToGlobals(); + if(!$host || !$port || !$username || !$password || !$dbName){ Json::die([ 'result'=>false, diff --git a/hwe/j_map_history.php b/hwe/j_map_history.php index f9075424..688cec7c 100644 --- a/hwe/j_map_history.php +++ b/hwe/j_map_history.php @@ -7,6 +7,8 @@ include "func.php"; $year = Util::getReq('year', 'int'); $month = Util::getReq('month', 'int'); +extractMissingPostToGlobals(); + $url = '/a_history.php'; if(!strpos($_SERVER['HTTP_REFERER'], $url)) { diff --git a/hwe/join_post.php b/hwe/join_post.php index a27dc090..c8c0f12e 100644 --- a/hwe/join_post.php +++ b/hwe/join_post.php @@ -53,6 +53,8 @@ $leader = Util::getReq('leader', 'int', 50); $power = Util::getReq('power', 'int', 50); $intel = Util::getReq('intel', 'int', 50); +extractMissingPostToGlobals(); + $rootDB = RootDB::db(); //회원 테이블에서 정보확인 $member = $rootDB->queryFirstRow('SELECT `no`, id, picture, grade, `name` FROM MEMBER WHERE no=%i', $userID); diff --git a/hwe/lib.php b/hwe/lib.php index be4ac818..06251497 100644 --- a/hwe/lib.php +++ b/hwe/lib.php @@ -90,30 +90,33 @@ function LogText($prefix, $variable) file_put_contents(ROOT.'/d_log/dbg_logs.txt', $text, FILE_APPEND); } -function extractSuperGlobals() +function extractMissingPostToGlobals() { + $result = []; if (isset($_POST) && count($_POST) > 0) { - LogText($_SERVER['REQUEST_URI'], $_POST); + foreach($_POST as $key=>$val){ if(isset($GLOBALS[$key])){ continue; } + $result[$key]=$val; $GLOBALS[$key]=$val; } } if (isset($_GET) && count($_GET) > 0) { - LogText($_SERVER['REQUEST_URI'], $_GET); - foreach($_GET as $key=>$val){ if(isset($GLOBALS[$key])){ continue; } + $result[$key]=$val; $GLOBALS[$key]=$val; } } + + if($result){ + LogText($_SERVER['REQUEST_URI'], $result); + } + } - - -extractSuperGlobals(); diff --git a/hwe/preprocessing.php b/hwe/preprocessing.php index 2d50b058..3bc5ecb5 100644 --- a/hwe/preprocessing.php +++ b/hwe/preprocessing.php @@ -14,6 +14,8 @@ $turn = Util::getReq('turn', 'array_int'); $sel = Util::getReq('sel', 'int'); $commandtype = Util::getReq('commandtype', 'int'); +extractMissingPostToGlobals(); + increaseRefresh("턴입력", 1); if(!$turn || $commandtype === null){ diff --git a/hwe/processing.php b/hwe/processing.php index 54c77eac..86bec5a7 100644 --- a/hwe/processing.php +++ b/hwe/processing.php @@ -8,6 +8,8 @@ include "func.php"; $commandtype = Util::getReq('commandtype', 'int', 0); $turn = Util::getReq('turn', 'array_int', [0]); +extractMissingPostToGlobals(); + $session = Session::requireGameLogin()->setReadOnly(); $db = DB::db(); diff --git a/hwe/turn.php b/hwe/turn.php index d5ff9cc1..ee762f1a 100644 --- a/hwe/turn.php +++ b/hwe/turn.php @@ -8,6 +8,8 @@ include "func.php"; $type = Util::getReq('type', 'int', 0); $sel = Util::getReq('sel', 'int', 1); +extractMissingPostToGlobals(); + if($sel <= 0 || $sel > 12){ $sel = 1; } From b797bab7e08b6734a4a7b3f3a18d2a15befa22d7 Mon Sep 17 00:00:00 2001 From: hide_d Date: Sat, 14 Apr 2018 02:42:58 +0900 Subject: [PATCH 07/66] =?UTF-8?q?=EB=88=84=EB=9D=BD=EB=90=9C=20getReq=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80.=20=EB=B2=84=EA=B7=B8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/_admin1_submit.php | 1 + hwe/_admin4_submit.php | 2 +- hwe/_admin5.php | 13 +++++++------ hwe/_admin6.php | 9 ++++----- hwe/_admin7.php | 9 +++++---- hwe/_admin8.php | 11 ++++------- hwe/b_battleCenter.php | 7 ++++--- hwe/b_genList.php | 6 +++--- hwe/b_myCityInfo.php | 6 +++--- hwe/b_myGenInfo.php | 7 +++---- hwe/b_myPage.php | 6 +++--- hwe/c_chiefboard.php | 2 +- hwe/c_troop.php | 1 + 13 files changed, 40 insertions(+), 40 deletions(-) diff --git a/hwe/_admin1_submit.php b/hwe/_admin1_submit.php index 82d7fc9a..88b4c4ac 100644 --- a/hwe/_admin1_submit.php +++ b/hwe/_admin1_submit.php @@ -22,6 +22,7 @@ if (!$v->validate()) { Error($v->errorStr()); } +$msg = Util::getReq('msg'); $btn = Util::getReq('btn'); $log = Util::getReq('log'); $starttime = Util::getReq('starttime', 'string', (new \DateTime())->format('Y-m-d H:i:s')); diff --git a/hwe/_admin4_submit.php b/hwe/_admin4_submit.php index 19248da0..d4032440 100644 --- a/hwe/_admin4_submit.php +++ b/hwe/_admin4_submit.php @@ -12,7 +12,7 @@ if($session->userGrade < 5) { } $btn = Util::getReq('btn'); -$genlist = Util::getReq('genlist', 'int'); +$genlist = Util::getReq('genlist', 'array_int'); extractMissingPostToGlobals(); diff --git a/hwe/_admin5.php b/hwe/_admin5.php index c045a126..af822bf4 100644 --- a/hwe/_admin5.php +++ b/hwe/_admin5.php @@ -7,6 +7,13 @@ include "func.php"; $type = Util::getReq('type', 'int', 0); $type2 = Util::getReq('type2', 'int', 0); +if($type < 0 || $type > 17){ + $type = 0; +} +if($type2 < 0 || $type2 > 6){ + $type2 = 0; +} + extractMissingPostToGlobals(); //로그인 검사 @@ -35,12 +42,6 @@ if($session->userGrade < 5) { $db = DB::db(); $connect=$db->get(); -if($type == 0) { - $type = 0; -} -if($type2 == 0) { - $type2 = 0; -} $sel = []; $sel2 = []; $sel[$type] = "selected"; diff --git a/hwe/_admin6.php b/hwe/_admin6.php index 9102e875..8ad66ef1 100644 --- a/hwe/_admin6.php +++ b/hwe/_admin6.php @@ -4,8 +4,10 @@ namespace sammo; include "lib.php"; include "func.php"; -$type = Util::getReq('type', 'int'); - +$type = Util::getReq('type', 'int', 0); +if($type < 0 || $type > 4){ + $type = 0; +} extractMissingPostToGlobals(); //로그인 검사 @@ -34,9 +36,6 @@ if($session->userGrade < 5) { $db = DB::db(); $connect=$db->get(); -if($type == 0) { - $type = 0; -} $sel[$type] = "selected"; ?> diff --git a/hwe/_admin7.php b/hwe/_admin7.php index 98e65466..8be7c7ff 100644 --- a/hwe/_admin7.php +++ b/hwe/_admin7.php @@ -6,7 +6,11 @@ include "func.php"; $btn = Util::getReq('btn'); $gen = Util::getReq('gen', 'int', 0); -$type = Util::getReq('type', 'int'); +$type = Util::getReq('type', 'int', 0); + +if($type < 0 || $type > 3){ + $type = 0; +} extractMissingPostToGlobals(); @@ -40,9 +44,6 @@ if($btn == '정렬하기') { $gen = 0; } -if($type == 0) { - $type = 0; -} $sel[$type] = "selected"; ?> diff --git a/hwe/_admin8.php b/hwe/_admin8.php index c31d991f..cff5f832 100644 --- a/hwe/_admin8.php +++ b/hwe/_admin8.php @@ -6,7 +6,7 @@ include "func.php"; $btn = Util::getReq('btn'); $gen = Util::getReq('gen', 'int', 0); -$type = Util::getReq('type', 'int'); +$type = 0; extractMissingPostToGlobals(); @@ -40,9 +40,6 @@ if ($btn == '정렬하기') { $gen = 0; } -if ($type == 0) { - $type = 0; -} $sel[$type] = "selected"; ?> @@ -84,9 +81,9 @@ foreach (getAllNationStaticInfo() as $nation) { $nationColor[$nation['nation']] = $nation['color']; } -switch ($type) { -case 0: $query = "select * from diplomacy where me < you order by state desc"; break; -} + +$query = "select * from diplomacy where me < you order by state desc"; + $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), ""); $dipcount = MYDB_num_rows($result); for ($i=0; $i < $dipcount; $i++) { diff --git a/hwe/b_battleCenter.php b/hwe/b_battleCenter.php index b0c0390c..c147d6ad 100644 --- a/hwe/b_battleCenter.php +++ b/hwe/b_battleCenter.php @@ -12,6 +12,10 @@ $btn = Util::getReq('btn'); $gen = Util::getReq('gen', 'int', 0); $type = Util::getReq('type', 'int', 0); +if ($type < 0 || $type > 3) { + $type = 0; +} + extractMissingPostToGlobals(); //로그인 검사 @@ -63,9 +67,6 @@ if ($btn == '정렬하기') { $gen = 0; } -if ($type <= 0 || $type > 3) { - $type = 0; -} $sel = []; $sel[$type] = "selected"; diff --git a/hwe/b_genList.php b/hwe/b_genList.php index 24d4fdee..209d6305 100644 --- a/hwe/b_genList.php +++ b/hwe/b_genList.php @@ -5,6 +5,9 @@ include "lib.php"; include "func.php"; $type = Util::getReq('type', 'int', 7); +if ($type <= 0 || $type > 8) { + $type = 7; +} extractMissingPostToGlobals(); @@ -40,9 +43,6 @@ if ($me['level'] == 0 || ($me['level'] == 1 && $me['belong'] < $nation['secretli exit(); } -if ($type <= 0 || $type > 8) { - $type = 7; -} $sel = []; $sel[$type] = "selected"; diff --git a/hwe/b_myCityInfo.php b/hwe/b_myCityInfo.php index 26230074..760e464b 100644 --- a/hwe/b_myCityInfo.php +++ b/hwe/b_myCityInfo.php @@ -5,6 +5,9 @@ include "lib.php"; include "func.php"; $type = Util::getReq('type', 'int', 10); +if ($type <= 0 || $type > 12) { + $type = 10; +} extractMissingPostToGlobals(); @@ -26,9 +29,6 @@ if ($me['level'] == 0) { exit(); } -if ($type <= 0 || $type > 12) { - $type = 10; -} $sel = [$type => "selected"]; ?> diff --git a/hwe/b_myGenInfo.php b/hwe/b_myGenInfo.php index ebfb0448..3e02e498 100644 --- a/hwe/b_myGenInfo.php +++ b/hwe/b_myGenInfo.php @@ -5,6 +5,9 @@ include "lib.php"; include "func.php"; $type = Util::getReq('type', 'int', 1); +if($type <= 0 || $type > 15) { + $type = 1; +} extractMissingPostToGlobals(); @@ -26,10 +29,6 @@ if($me['level'] == 0) { exit(); } - -if($type <= 0 || $type > 15) { - $type = 1; -} $sel = [$type => "selected"]; ?> diff --git a/hwe/b_myPage.php b/hwe/b_myPage.php index 987610f8..e6313c93 100644 --- a/hwe/b_myPage.php +++ b/hwe/b_myPage.php @@ -11,15 +11,15 @@ $tnmt = Util::getReq('tnmt', 'int', 1); extractMissingPostToGlobals(); -if($map < 0 && $map > 2){ +if($map < 0 || $map > 2){ $map = 0; } -if($mode < 0 && $mode > 2){ +if($mode < 0 || $mode > 2){ $mode = 2; } -if($tnmt < 0 && $tnmt > 1){ +if($tnmt < 0 || $tnmt > 1){ $tnmt = 1; } diff --git a/hwe/c_chiefboard.php b/hwe/c_chiefboard.php index 43003760..0b6f55ad 100644 --- a/hwe/c_chiefboard.php +++ b/hwe/c_chiefboard.php @@ -6,7 +6,7 @@ include "func.php"; $title = Util::getReq('title'); $msg = Util::getReq('msg'); -$num = Util::getReq('num'); +$num = Util::getReq('num', 'int'); $reply = Util::getReq('reply'); // $title, $msg, $num diff --git a/hwe/c_troop.php b/hwe/c_troop.php index 94c6f5cf..bf4f0a69 100644 --- a/hwe/c_troop.php +++ b/hwe/c_troop.php @@ -6,6 +6,7 @@ include "func.php"; // $btn, $name, $troop $btn = Util::getReq('btn'); $name = Util::getReq('name'); +$gen = Util::getReq('gen', 'int'); $troop = Util::getReq('troop', 'int'); extractMissingPostToGlobals(); From b56919a343cee82415047dd44a477f64b2b6f2ef Mon Sep 17 00:00:00 2001 From: hide_d Date: Sat, 14 Apr 2018 02:52:03 +0900 Subject: [PATCH 08/66] =?UTF-8?q?=ED=8C=9D=EC=97=85=20=EC=B0=A8=EB=8B=A8?= =?UTF-8?q?=EC=97=90=20=EB=A7=89=ED=9E=88=EB=8A=94=20=EB=AC=B8=EC=A0=9C=20?= =?UTF-8?q?=ED=95=B4=EA=B2=B0...?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.php | 20 ++++++-------------- oauth_kakao/index.php | 20 ++++++-------------- 2 files changed, 12 insertions(+), 28 deletions(-) diff --git a/index.php b/index.php index 34fcb004..9a4c6d94 100644 --- a/index.php +++ b/index.php @@ -53,15 +53,12 @@ function getOAuthToken(mode='login', scope_list = null){ } -function sendTempPasswordToKakaoTalk(retry=false){ +function sendTempPasswordToKakaoTalk(){ $.post({ url:'j_change_pw.php', dataType:'json' }).then(function(obj){ - if (!obj.result && retry) { - getOAuthToken('change_pw', 'talk_message'); - } - else if(!obj.result){ + if(!obj.result){ alert(obj.reason); } else{ @@ -70,18 +67,13 @@ function sendTempPasswordToKakaoTalk(retry=false){ }); } -function doLoginUsingOAuth(retry=false){ +function doLoginUsingOAuth(){ $.post({ url:'oauth_kakao/j_login_oauth.php', dataType:'json' }).then(function(obj){ if(!obj.result){ - if(obj.noRetry || !retry){ - alert(obj.reason); - } - else{ - getOAuthToken('login'); - } + alert(obj.reason); } else{ window.location.href = "./"; @@ -140,7 +132,7 @@ function postOAuthResult(result){
-
+
@@ -148,7 +140,7 @@ function postOAuthResult(result){ rule('lengthBetween', 'name', [1, 6]) +->rule('lengthBetween', 'name', 1, 6) ->rule('min', [ 'leader', 'power', @@ -69,9 +69,9 @@ $db = DB::db(); ########## 동일 정보 존재여부 확인. ########## $admin = $db->queryFirstRow('SELECT year,month,maxgeneral,turnterm,genius,npcmode from game limit 1'); -$gencount = $db->queryFirstField('SELECT count(`no`) FROM general WHERE noc<2'); +$gencount = $db->queryFirstField('SELECT count(`no`) FROM general WHERE npc<2'); $oldGeneral = $db->queryFirstField('SELECT `no` FROM general WHERE `owner`=%i', $userID); -$oldName = $db->queryFirstField('SELECT `no` FROM general WHERE `name`=%i', $name); +$oldName = $db->queryFirstField('SELECT `no` FROM general WHERE `name`=%s', $name); if ($oldGeneral) { echo(" + "); - +window.open('../i_other/help.php'); +location.href = './'; + From 7ef3f0d5c52742a6f76e4b907a9686f0683bd31f Mon Sep 17 00:00:00 2001 From: hide_d Date: Tue, 17 Apr 2018 01:54:57 +0900 Subject: [PATCH 51/66] =?UTF-8?q?=EC=9E=84=EC=8B=9C=EB=A1=9C=20=EC=99=B8?= =?UTF-8?q?=EA=B5=90=20=EC=84=9C=EC=8B=A0=20=EB=B0=9B=EB=8A=94=20=EA=B8=B0?= =?UTF-8?q?=EB=8A=A5=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/j_msg_decide_opt.php | 89 ++++------------------------------------ 1 file changed, 9 insertions(+), 80 deletions(-) diff --git a/hwe/j_msg_decide_opt.php b/hwe/j_msg_decide_opt.php index c22deca0..466159de 100644 --- a/hwe/j_msg_decide_opt.php +++ b/hwe/j_msg_decide_opt.php @@ -29,13 +29,6 @@ if ($msgID === null || !is_bool($msgResponse)) { ]); } -$msg = Message::getMessageByID($msgID); -if($msg === null){ - Json::die([ - 'result'=>false, - 'reason'=>'올바르지 않은 메시지' - ]); -} $general = DB::db()->queryFirstRow('select `no`, `name`, `nation`, `nations`, `level`, `npc`, `gold`, `rice`, `troop` from `general` where `no` = %i', $generalID); if(!$general){ Json::die([ @@ -44,87 +37,23 @@ if(!$general){ ]); } -list($result, $messageInfo) = getSingleMessage($msgID); - -if (!$result) { +$msg = Message::getMessageByID($msgID); +if($msg === null){ Json::die([ 'result'=>false, - 'reason'=>$messageInfo + 'reason'=>'올바르지 않은 메시지' ]); } -'@phan-var-force mixed[] $messageInfo'; - -$msgType = $messageInfo['type']; - -$validUntil = $messageInfo['valid_until']; -$date = date('Y-m-d H:i:s'); -if ($validUntil < $date) { - Json::die([ - 'result'=>false, - 'reason'=>'만료된 메시지' - ]); +if($msgResponse){ + $result = $msg->agreeMessage($general['no']); } - -$msgOption = Json::decode(Util::array_get($messageInfo['option'], '{}')); -$msgAction = Util::array_get($msgOption['action'], null); -$messageInfo['option'] = $msgOption; - -$msgSrc = Json::decode($messageInfo['src']); -$messageInfo['src'] = $msgSrc; -$msgDest = Json::decode($messageInfo['dest']); -$messageInfo['dest'] = $msgDest; - -if (!$msgAction) { - Json::die([ - 'result'=>false, - 'reason'=>'응답 대상 메시지 아님' - ]); -} - -if ($msgType == 'diplomacy' && $msgSrc['nation_id'] != $msgDest['nation_id']) { - //여기로 올일이 있나? - Json::die([ - 'result'=>false, - 'reason'=>'(버그) 외교 대상 동일' - ]); -} - -if($msgType == 'diplomacy'){ - if($general['level'] < 6){ - Json::die([ - 'result'=>false, - 'reason'=>'외교 권한 없음' - ]); - } - - if($general['nation'] != $msgDest['nation_id']){ - Json::die([ - 'result'=>false, - 'reason'=>'올바르지 않은 소속 국가' - ]); - } -} - -switch ($msgAction) { -case 'scout': - //TODO: 등용장 받음. 함수 호출 - $result = acceptScout($messageInfo, $general, $msgResponse); - break; -case 'ally': - $result = acceptAlly($messageInfo, $general, $msgResponse); - break; - //TODO:기타 등등 -case '': - Json::die([]); - break; -default: - //구현이 정상적으로 된 경우 이쪽으로 오지 않음 - $result = [false, '처리 대상 아님']; +else{ + $result = $msg->declineMessage($general['no']); } Json::die([ - 'result' => $result[0], - 'reason' => $result[1] + 'result' => $result===DiplomaticMessage::ACCEPTED, + 'reason' => 'result' ]); \ No newline at end of file From 8c21eec168a6bf8c004101b2e5b1462129e1e4d5 Mon Sep 17 00:00:00 2001 From: hide_d Date: Tue, 17 Apr 2018 01:55:12 +0900 Subject: [PATCH 52/66] =?UTF-8?q?=EB=A9=94=EC=8B=9C=EC=A7=80=20=EA=B4=80?= =?UTF-8?q?=EB=A0=A8=20=EB=B2=84=EA=B7=B8=20=EC=9A=B0=ED=9A=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/js/msg.js | 4 ++-- hwe/process_war.php | 5 +++-- hwe/processing.php | 28 ++++++++++++------------- hwe/sammo/DiplomaticMessage.php | 37 ++++++++++++++++++++++++++------- hwe/sammo/Message.php | 6 +++--- hwe/select_npc.php | 5 +++-- 6 files changed, 54 insertions(+), 31 deletions(-) diff --git a/hwe/js/msg.js b/hwe/js/msg.js index cf7e689a..93bd0c00 100644 --- a/hwe/js/msg.js +++ b/hwe/js/msg.js @@ -12,7 +12,7 @@ function hexToRgb(hex) { function isBrightColor(color){ color = hexToRgb(color); - if ((color.r*0.299 + color.g*0.587 + color.b*0.114) > 186){ + if ((color.r*0.299 + color.g*0.587 + color.b*0.114) > 140){ return true; } else{ @@ -31,7 +31,7 @@ var generalList = {}; function responseMessage(msgID, response){ $.ajax({ - url: 'j_decide_opt.php', + url: 'j_msg_decide_opt.php', type: 'post', dataType:'json', contentType: 'application/json', diff --git a/hwe/process_war.php b/hwe/process_war.php index 761315a2..364b9555 100644 --- a/hwe/process_war.php +++ b/hwe/process_war.php @@ -1775,13 +1775,14 @@ function ConquerCity($game, $general, $city, $nation, $destnation) { || $nation['name'] == "왜족") { //등용장 미발부 } elseif(Util::randBool(0.5)) { - sendScoutMsg([ + //TODO:등용장 보낼것 + /*sendScoutMsg([ 'id' => $ruler['no'], 'nation_id' => $ruler['nation'] ],[ 'id' => $gen['no'], 'nation_id' => $gen['nation'] - ],$general['turntime']); + ],$general['turntime']);*/ } //NPC인 경우 10% 확률로 임관(엔장, 인재, 의병) diff --git a/hwe/processing.php b/hwe/processing.php index 844a4f39..8533a760 100644 --- a/hwe/processing.php +++ b/hwe/processing.php @@ -1597,22 +1597,22 @@ function command_46($turn, $command) { ?> 성향 : - +> "; diff --git a/hwe/sammo/DiplomaticMessage.php b/hwe/sammo/DiplomaticMessage.php index 3bce0a74..b4c59701 100644 --- a/hwe/sammo/DiplomaticMessage.php +++ b/hwe/sammo/DiplomaticMessage.php @@ -49,7 +49,7 @@ class DiplomaticMessage extends Message{ $this->validDiplomacy = false; } - if($this->$validUntil < (new \DateTime())){ + if($this->validUntil < (new \DateTime())){ $this->validDiplomacy = false; } } @@ -95,7 +95,7 @@ class DiplomaticMessage extends Message{ protected function cancelNA(){ $helper = new Engine\Diplomacy($this->src->nationID, $this->dest->nationID); - $chk = $helper->noAggression(); + $chk = $helper->cancelNA(); if($chk[0] !== self::ACCEPTED){ return $chk; } @@ -117,7 +117,7 @@ class DiplomaticMessage extends Message{ protected function stopWar(){ $helper = new Engine\Diplomacy($this->src->nationID, $this->dest->nationID); - $chk = $helper->noAggression(); + $chk = $helper->stopWar(); if($chk[0] !== self::ACCEPTED){ return $chk; } @@ -139,7 +139,7 @@ class DiplomaticMessage extends Message{ protected function acceptMerge(){ $helper = new Engine\Diplomacy($this->src->nationID, $this->dest->nationID); - $chk = $helper->noAggression(); + $chk = $helper->acceptMerge(); if($chk[0] !== self::ACCEPTED){ return $chk; } @@ -175,7 +175,7 @@ class DiplomaticMessage extends Message{ protected function acceptSurrender(){ $helper = new Engine\Diplomacy($this->src->nationID, $this->dest->nationID); - $chk = $helper->noAggression(); + $chk = $helper->acceptSurrender(); if($chk[0] !== self::ACCEPTED){ return $chk; } @@ -219,6 +219,8 @@ class DiplomaticMessage extends Message{ throw \RuntimeException('전송되지 않은 메시지에 수락 진행 중'); } + + $db = DB::db(); $general = $db->queryFirstRow( 'SELECT `name`, `level` FROM general WHERE `no`=%i AND nation=%i', @@ -226,7 +228,20 @@ class DiplomaticMessage extends Message{ $this->dest->nationID ); + if(!$general){ + $this->dest->generalID = $receiverID; + $this->dest->generalName = $general['name']; + } + + list($result, $reason) = $this->checkDiplomaticMessageValidation($general); + $db->update('diplomacy', [ + 'reserved'=>'', + 'showing'=>null + ], '(me=%s AND you=%s) OR (you=%s AND me=%s)', + $this->src->nationID, $this->dest->nationID, + $this->src->nationID, $this->dest->nationID + ); if($result !== self::ACCEPTED){ pushGenLog(['no'=>$receiverID], ["●{$reason} {$this->diplomacyName} 실패."]); if($result === self::DECLINED){ @@ -282,9 +297,9 @@ class DiplomaticMessage extends Message{ "【외교】{$year}년 {$month}월: {$this->src->nationName}이 {$this->dest->nationName}에게 제안한 {$this->diplomacyName} 동의.", new \DateTime(), new \DateTime('9999-12-31'), - Json::encode([ + [ 'delete'=>$this->id - ]) + ] ); $newMsg->send(); @@ -305,7 +320,13 @@ class DiplomaticMessage extends Message{ throw \RuntimeException('전송되지 않은 메시지에 거절 진행 중'); } - list($result, $reason) = $this->checkScoutMessageValidation($receiverID); + $db = DB::db(); + $general = $db->queryFirstRow( + 'SELECT `name`, `level` FROM general WHERE `no`=%i AND nation=%i', + $receiverID, + $this->dest->nationID + ); + list($result, $reason) = $this->checkDiplomaticMessageValidation($general); if($result === self::INVALID){ pushGenLog(['no'=>$receiverID], ["●{$reason} {$this->diplomacyName} 거절 불가."]); diff --git a/hwe/sammo/Message.php b/hwe/sammo/Message.php index 819dc8c0..793bb918 100644 --- a/hwe/sammo/Message.php +++ b/hwe/sammo/Message.php @@ -188,7 +188,7 @@ class Message { $db = DB::db(); $now = new \DateTime(); - $row = $db->queryFirstRow('SELECT * FROM `message` WHERE `id` = %i AND ValidUntil', $messageID); + $row = $db->queryFirstRow('SELECT * FROM `message` WHERE `id` = %i AND valid_until', $messageID); if (!$row) { return null; } @@ -344,8 +344,8 @@ class Message 'text' => $this->msg, 'option' => $this->msgOption ]), - 'validUntil'=>$this->validUntil->format('Y-m-d H:i:s'), - ]); + 'valid_until'=>$this->validUntil->format('Y-m-d H:i:s'), + ], 'id=%i', $this->id); } } diff --git a/hwe/select_npc.php b/hwe/select_npc.php index d3a28d97..9fca674a 100644 --- a/hwe/select_npc.php +++ b/hwe/select_npc.php @@ -7,6 +7,7 @@ include "func.php"; $session = Session::requireLogin()->setReadOnly(); $userID = Session::getUserID(); $rootDB = RootDB::db(); +$db = DB::db(); //회원 테이블에서 정보확인 $member = $rootDB->queryFirstRow('select no,name,picture,grade from member where no=%i', $userID); @@ -17,14 +18,14 @@ if(!$member) { exit(1); } -$admin = $rootDB->queryFirstRow('select npcmode,maxgeneral,show_img_level from game limit 1'); +$admin = $db->queryFirstRow('select npcmode,maxgeneral,show_img_level from game limit 1'); if($admin['npcmode'] != 1) { header('Location:join.php'); die(); } -$db = DB::db(); + $connect=$db->get(); ?> From 87bc416fc7310bca8bc4c4b1368e1a1bc81654e2 Mon Sep 17 00:00:00 2001 From: hide_d Date: Tue, 17 Apr 2018 02:14:31 +0900 Subject: [PATCH 53/66] =?UTF-8?q?=EC=9D=B8=EC=82=AC=EB=B6=80=20=ED=91=9C?= =?UTF-8?q?=EA=B8=B0=20=EB=B2=84=EA=B7=B8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/b_myBossInfo.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/hwe/b_myBossInfo.php b/hwe/b_myBossInfo.php index 5e5cc3dd..06fe7f51 100644 --- a/hwe/b_myBossInfo.php +++ b/hwe/b_myBossInfo.php @@ -81,18 +81,18 @@ echo " "; for($i=12; $i >= $lv; $i-=2) { $i1 = $i; $i2 = $i - 1; - $imageTemp1 = GetImageURL($level[$i1]['imgsvr']); - $imageTemp2 = GetImageURL($level[$i2]['imgsvr']); - echo " + $imageTemp1 = GetImageURL($level[$i1]['imgsvr']??0); + $imageTemp2 = GetImageURL($level[$i2]['imgsvr']??0); + ?>
- - - - - - + + + + + + - "; + Date: Tue, 17 Apr 2018 02:14:38 +0900 Subject: [PATCH 54/66] =?UTF-8?q?=ED=86=A0=EB=84=88=EB=A8=BC=ED=8A=B8=20?= =?UTF-8?q?=ED=91=9C=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/func_tournament.php | 1 + 1 file changed, 1 insertion(+) diff --git a/hwe/func_tournament.php b/hwe/func_tournament.php index 08510715..3f794ee2 100644 --- a/hwe/func_tournament.php +++ b/hwe/func_tournament.php @@ -117,6 +117,7 @@ function getTournamentTerm() { $admin = MYDB_fetch_array($result); switch($admin['tnmt_auto']) { + case 0: $str = '설정 안됨'; break; case 1: $str = "경기당 12분"; break; case 2: $str = "경기당 7분"; break; case 3: $str = "경기당 3분"; break; From 33b7d228f900eac4ec42267d01f9073fd166fa13 Mon Sep 17 00:00:00 2001 From: hide_d Date: Tue, 17 Apr 2018 02:14:48 +0900 Subject: [PATCH 55/66] =?UTF-8?q?=EA=B8=B4=EA=B8=89=20=EC=B2=9C=EB=8F=84?= =?UTF-8?q?=20=EB=B2=84=EA=B7=B8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/process_war.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hwe/process_war.php b/hwe/process_war.php index 364b9555..41d84416 100644 --- a/hwe/process_war.php +++ b/hwe/process_war.php @@ -1854,7 +1854,7 @@ function ConquerCity($game, $general, $city, $nation, $destnation) { ], 'no IN %li',[$city['gen1'], $city['gen2'], $city['gen3']]); //수도였으면 긴급 천도 - if(!isset($destnation['capital']) && $destnation['capital'] == $city['city']) { + if(isset($destnation['capital']) && $destnation['capital'] == $city['city']) { $minCity = findNextCapital($city['city'], $destnation['nation']); $minCityName = CityConst::byID($minCity)->name; From 3d602b49bfea4eef1309be82cb5c6b741dbcec4c Mon Sep 17 00:00:00 2001 From: hide_d Date: Tue, 17 Apr 2018 02:14:58 +0900 Subject: [PATCH 56/66] =?UTF-8?q?=EB=A9=94=EC=8B=9C=EC=A7=80=20=ED=91=9C?= =?UTF-8?q?=EA=B8=B0=20=ED=94=84=EB=A0=88=EC=9E=84=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/css/msg.css | 7 +++++-- hwe/index.php | 9 +++------ tmp_msg/msg.css | 2 ++ 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/hwe/css/msg.css b/hwe/css/msg.css index 873165d0..af2ab808 100644 --- a/hwe/css/msg.css +++ b/hwe/css/msg.css @@ -91,8 +91,11 @@ } .board_side{ - width:50%; - float:left; + width:498px; + display:inline-block; + border-left:groove 1px; + border-right:groove 1px; + border-bottom:groove 1px; } .msg_body{ diff --git a/hwe/index.php b/hwe/index.php index 5471a935..2bbec125 100644 --- a/hwe/index.php +++ b/hwe/index.php @@ -286,21 +286,18 @@ if ($session->userGrade >= 5) { 내용 없이 '서신전달&갱신'을 누르면 메세지창이 갱신됩니다.
-
-
+
전체 메시지(최고99자)
개인 메시지(최고99자)
-
-
+
국가 메시지(최고99자)
-
-
+
diff --git a/tmp_msg/msg.css b/tmp_msg/msg.css index 6e60782e..e68207a3 100644 --- a/tmp_msg/msg.css +++ b/tmp_msg/msg.css @@ -76,6 +76,8 @@ .board_side{ width:50%; float:left; + border-left:groove 0.1em; + border-right:groove 0.1em; } .msg_body{ From 932ce9bf513ee3960997b5da96d75f556788eb2c Mon Sep 17 00:00:00 2001 From: hide_d Date: Tue, 17 Apr 2018 03:06:55 +0900 Subject: [PATCH 57/66] =?UTF-8?q?=EB=8F=84=EC=8B=9C=20=EC=A0=95=EB=B3=B4?= =?UTF-8?q?=20=EB=B0=B0=EA=B2=BD=20=EC=95=88=EB=B3=B4=EC=9D=B4=EB=8A=94=20?= =?UTF-8?q?=E3=85=93=E3=84=B1=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/b_currentCity.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hwe/b_currentCity.php b/hwe/b_currentCity.php index a6b6959c..ca04b706 100644 --- a/hwe/b_currentCity.php +++ b/hwe/b_currentCity.php @@ -32,7 +32,8 @@ $myNation = MYDB_fetch_array($result); 도시정보 - + + From 78ce7d20e3394c3ce16fd76f77e9ad59eca1b4f0 Mon Sep 17 00:00:00 2001 From: hide_d Date: Tue, 17 Apr 2018 03:10:18 +0900 Subject: [PATCH 58/66] =?UTF-8?q?=EA=B1=B0=EB=9E=98=EC=9E=A5=20=EC=97=90?= =?UTF-8?q?=EB=9F=AC=EB=A1=9C=EA=B7=B8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/c_auction.php | 3 +++ hwe/func_legacy.php | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/hwe/c_auction.php b/hwe/c_auction.php index 460a95e6..1e113c18 100644 --- a/hwe/c_auction.php +++ b/hwe/c_auction.php @@ -24,6 +24,9 @@ $term = Util::getReq('term', 'int'); $stuff = Util::getReq('stuff', 'int'); $sel = Util::getReq('sel', 'int'); +$msg = ''; +$msg2 = ''; + extractMissingPostToGlobals(); //로그인 검사 diff --git a/hwe/func_legacy.php b/hwe/func_legacy.php index 7c2b09fc..0dd66972 100644 --- a/hwe/func_legacy.php +++ b/hwe/func_legacy.php @@ -51,8 +51,8 @@ function Submit($url, $msg="", $msg2="") { echo "a"; // 파폭 버그 때문 echo "
- - + + "; From af0c470923a1c3f6495d3c03e4d37b16b4732d1c Mon Sep 17 00:00:00 2001 From: hide_d Date: Tue, 17 Apr 2018 03:10:25 +0900 Subject: [PATCH 59/66] =?UTF-8?q?=EB=B6=80=EB=8C=80=20=EA=B0=80=EC=9E=85?= =?UTF-8?q?=20=EC=95=88=EB=90=98=EB=8A=94=20=EB=B2=84=EA=B7=B8=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/c_troop.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hwe/c_troop.php b/hwe/c_troop.php index bf4f0a69..1cb77c25 100644 --- a/hwe/c_troop.php +++ b/hwe/c_troop.php @@ -40,8 +40,9 @@ if($btn == "부 대 창 설" && $name != "" && $me['troop'] == 0) { 'troop'=>0 ], 'no=%i AND troop=(SELECT troop FROM troop WHERE no = %i)', $gen, $me['no']); } elseif($btn == "부 대 가 입" && $troop != 0) { - $troop = $db->queryFirstField('SELECT troop FROM troop WHERE no = %i', $troop); - if($troop){ + $troopLeader = $db->queryFirstField('SELECT `no` FROM troop WHERE troop=%i', $troop); + $troopLeaderNation = $db->queryFirstField('SELECT `nation` FROM `general` WHERE `no`=%i AND `nation`=%i', $troopLeader, $me['nation']); + if($troopLeaderNation){ $db->update('general', [ 'troop'=>$troop ], 'no=%i', $me['no']); From ec1be2c88717588dcf86fbaa72c955f3951be8fb Mon Sep 17 00:00:00 2001 From: hide_d Date: Tue, 17 Apr 2018 03:10:38 +0900 Subject: [PATCH 60/66] =?UTF-8?q?=ED=95=A9=EB=B3=91=20=ED=95=AD=EB=B3=B5?= =?UTF-8?q?=20=EC=95=88=EB=90=98=EB=8A=94=20=EB=B2=84=EA=B7=B8=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/sammo/DiplomaticMessage.php | 6 +++--- hwe/sammo/Engine/Diplomacy.php | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/hwe/sammo/DiplomaticMessage.php b/hwe/sammo/DiplomaticMessage.php index b4c59701..4a7f2c7a 100644 --- a/hwe/sammo/DiplomaticMessage.php +++ b/hwe/sammo/DiplomaticMessage.php @@ -139,7 +139,7 @@ class DiplomaticMessage extends Message{ protected function acceptMerge(){ $helper = new Engine\Diplomacy($this->src->nationID, $this->dest->nationID); - $chk = $helper->acceptMerge(); + $chk = $helper->acceptMerge($this->src->generalID, $this->dest->generalID); if($chk[0] !== self::ACCEPTED){ return $chk; } @@ -175,7 +175,7 @@ class DiplomaticMessage extends Message{ protected function acceptSurrender(){ $helper = new Engine\Diplomacy($this->src->nationID, $this->dest->nationID); - $chk = $helper->acceptSurrender(); + $chk = $helper->acceptSurrender($this->src->generalID, $this->dest->generalID); if($chk[0] !== self::ACCEPTED){ return $chk; } @@ -228,7 +228,7 @@ class DiplomaticMessage extends Message{ $this->dest->nationID ); - if(!$general){ + if($general){ $this->dest->generalID = $receiverID; $this->dest->generalName = $general['name']; } diff --git a/hwe/sammo/Engine/Diplomacy.php b/hwe/sammo/Engine/Diplomacy.php index 1ee28199..6ebb40d4 100644 --- a/hwe/sammo/Engine/Diplomacy.php +++ b/hwe/sammo/Engine/Diplomacy.php @@ -187,8 +187,8 @@ class Diplomacy{ $db = \sammo\DB::db(); - $states = $db->queryOneField( - 'SELECT `state` FROM diplomacy WHERE me = %i AND you != %i AND `state` NOT IN (2, 7) GROUP BY `state` ORDER BY `state`', + $states = $db->queryFirstColumn( + 'SELECT `state` FROM diplomacy WHERE `state` NOT IN (2, 7) AND me=%i AND you <>%i', $this->srcNation['nation'], $this->destNation['nation'] ); From d5ead5b74f48ea4cc84dd65351268bfc9979650c Mon Sep 17 00:00:00 2001 From: hide_d Date: Tue, 17 Apr 2018 03:11:00 +0900 Subject: [PATCH 61/66] =?UTF-8?q?=EC=9E=AC=EC=95=BC=EC=9D=BC=EB=95=8C=20se?= =?UTF-8?q?cretlimit=20=EA=B2=BD=EA=B3=A0=20=EB=9C=A8=EB=8A=94=EA=B1=B0=20?= =?UTF-8?q?=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/func_template.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hwe/func_template.php b/hwe/func_template.php index 2303b24c..7d3de5b6 100644 --- a/hwe/func_template.php +++ b/hwe/func_template.php @@ -108,6 +108,9 @@ function commandButton() { if($me['level'] >= 2){ $showSecret = true; } + else if($me['level']== 0){ + $showSecret = false; + } else if($me['belong'] >= $nation['secretlimit']){ $showSecret = true; } From f919187b917562b062d49a745b5bd17890b17ea4 Mon Sep 17 00:00:00 2001 From: hide_d Date: Tue, 17 Apr 2018 03:22:53 +0900 Subject: [PATCH 62/66] =?UTF-8?q?=EB=B6=88=EA=B0=80=EC=B9=A8=20=EB=A9=94?= =?UTF-8?q?=EC=8B=9C=EC=A7=80=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/sammo/DiplomaticMessage.php | 2 +- hwe/sammo/Engine/Diplomacy.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hwe/sammo/DiplomaticMessage.php b/hwe/sammo/DiplomaticMessage.php index 4a7f2c7a..212c02aa 100644 --- a/hwe/sammo/DiplomaticMessage.php +++ b/hwe/sammo/DiplomaticMessage.php @@ -72,7 +72,7 @@ class DiplomaticMessage extends Message{ protected function noAggression(){ $year = Util::array_get($this->msgOption['year']); - $option = Util::array_get($this->msgOption['option']); + $option = Util::array_get($this->msgOption['option'])??''; if($year < 1 || $year > 30){ return [self::INVALID, '올바르지 않은 불가침 서신입니다.']; } diff --git a/hwe/sammo/Engine/Diplomacy.php b/hwe/sammo/Engine/Diplomacy.php index 6ebb40d4..89f0a40a 100644 --- a/hwe/sammo/Engine/Diplomacy.php +++ b/hwe/sammo/Engine/Diplomacy.php @@ -79,7 +79,7 @@ class Diplomacy{ } if(!$this->srcNation || !$this->destNation || !$this->valid){ - return [ScoutMessage::DECLINED, '이미 멸망한 국가입니다.']; + return [DiplomaticMessage::DECLINED, '올바르지 않은 국가입니다.']; } if($this->srcNation['level'] == 0 || $this->destNation['level'] == 0){ From d9ffdf9df841e73a5930c1f5fe580c7faa768b77 Mon Sep 17 00:00:00 2001 From: hide_d Date: Tue, 17 Apr 2018 03:23:02 +0900 Subject: [PATCH 63/66] =?UTF-8?q?=EC=99=B8=EA=B5=90=20=EC=84=9C=EC=8B=A0?= =?UTF-8?q?=20=EB=B0=80=EB=A6=AC=EB=8A=94=20=EB=B2=84=EA=B7=B8=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/css/msg.css | 2 ++ hwe/js/templates/message.html | 5 +---- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/hwe/css/msg.css b/hwe/css/msg.css index af2ab808..546123be 100644 --- a/hwe/css/msg.css +++ b/hwe/css/msg.css @@ -91,7 +91,9 @@ } .board_side{ + height:1370px; width:498px; + overflow-y: hidden; display:inline-block; border-left:groove 1px; border-right:groove 1px; diff --git a/hwe/js/templates/message.html b/hwe/js/templates/message.html index 8e703c14..11895e03 100644 --- a/hwe/js/templates/message.html +++ b/hwe/js/templates/message.html @@ -32,7 +32,4 @@ <%if(this.option && this.option.action) {%>
-
- <%} %> - - \ No newline at end of file + <%} %> \ No newline at end of file From b5fb2e9cf42dbd045c3f5e8ecfdcdc9342d4510d Mon Sep 17 00:00:00 2001 From: hide_d Date: Tue, 17 Apr 2018 03:39:17 +0900 Subject: [PATCH 64/66] =?UTF-8?q?=EC=A4=91=EC=9B=90=20=EC=A0=95=EB=B3=B4?= =?UTF-8?q?=20=EB=B6=84=EC=9F=81=20=ED=98=84=ED=99=A9=EC=9D=84=20=EC=A0=9C?= =?UTF-8?q?=EB=8C=80=EB=A1=9C=20=EB=B3=B4=EC=97=AC=EC=A4=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/b_diplomacy.php | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/hwe/b_diplomacy.php b/hwe/b_diplomacy.php index 00d53b2d..f91cc616 100644 --- a/hwe/b_diplomacy.php +++ b/hwe/b_diplomacy.php @@ -25,7 +25,6 @@ $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"" $nationcount = MYDB_num_rows($result); $nationnum = []; $nationname = []; -$nationcolor = []; $nationStr = ""; $powerStr = ""; @@ -41,7 +40,6 @@ for($i=0; $i < $nationcount; $i++) { $nationnum[] = $nation['nation']; $nationname[$nation['nation']] = $nation['name']; - $nationcolor[$nation['nation']] = $nation['color']; $nationStr .= " {$nation['name']}
"; $powerStr .= "국력 {$nation['power']}
"; @@ -64,9 +62,10 @@ foreach ($db->queryAllLists('SELECT city, `name`, conflict FROM city WHERE confl $sum = array_sum($conflict); foreach ($conflict as $nationID=>$killnum) { - $conflict['percent'] = round(100*$killnum / $sum, 1); - $conflict['name'] = $nationname[$nationID]; - $conflict['color'] = $nationcolor[$nationID]; + $conflict[$nationID] = ['killnum'=>$killnum]; + $conflict[$nationID]['percent'] = round(100*$killnum / $sum, 1); + $conflict[$nationID]['name'] = $nationname[$nationID]; + $conflict[$nationID]['color'] = getNationStaticInfo($nationID)['color']; } $realConflict[] = [$cityID, $cityName, $conflict]; @@ -120,7 +119,7 @@ if($nationcount != 0) { for($i=0; $i < $nationcount; $i++) { echo " -
"; + "; } echo " "; @@ -137,7 +136,7 @@ for($i=0; $i < $nationcount; $i++) { } echo " - "; + "; for($k=0; $k < $nationcount; $k++) { if($i == $k) { @@ -202,7 +201,7 @@ for($i=0; $i < $nationcount; $i++) { cellpadding=0 bordercolordark='gray' bordercolorlight='black' - style='font-size:13px;word-break:break-all;' + style='font-size:13px;word-break:break-all;width:100%;' class='bg0' > @@ -212,12 +211,10 @@ for($i=0; $i < $nationcount; $i++) { align=right style='color:;background-color:;' >  - - - + +
접 속 자
".getLevel($i1, $nation['level'])."";echo $level[$i1]['name']==''?"-":$level[$i1]['name']; echo " ({$level[$i1]['belong']}년)".getLevel($i2, $nation['level'])."";echo $level[$i2]['name']==''?"-":$level[$i2]['name']; echo " ({$level[$i2]['belong']}년)");background-size:64px;'>(년)");background-size:64px;'>(년)
{$nationname[$nationnum[$i]]}{$nationname[$nationnum[$i]]}
{$nationname[$nationnum[$i]]}{$nationname[$nationnum[$i]]}%' - style='background-color:;' - >
%;background-color:;' + > 
From 7f7d8b20998e10a94d225c844e42a346c8619c99 Mon Sep 17 00:00:00 2001 From: hide_d Date: Tue, 17 Apr 2018 03:43:22 +0900 Subject: [PATCH 65/66] =?UTF-8?q?=EB=AA=85=EC=9E=A5=EC=9D=BC=EB=9E=8C=20?= =?UTF-8?q?=ED=91=9C=EA=B8=B0=20=EC=98=A4=EB=A5=98=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/a_bestGeneral.php | 4 ++-- hwe/a_genList.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/hwe/a_bestGeneral.php b/hwe/a_bestGeneral.php index ea9428a3..ddf18225 100644 --- a/hwe/a_bestGeneral.php +++ b/hwe/a_bestGeneral.php @@ -166,7 +166,7 @@ for ($i=0; $i < 21; $i++) { echo " "; } else { $imageTemp = GetImageURL($gen['imgsvr']); - echo ""; + echo ""; } } @@ -267,7 +267,7 @@ for ($i=0; $i < 4; $i++) { echo " "; } else { $imageTemp = GetImageURL($gen['imgsvr']??0); - echo " width='64' height='64' src={$imageTemp}/{$pic[$k]}>"; + echo ""; } } diff --git a/hwe/a_genList.php b/hwe/a_genList.php index 599b2375..d7765c16 100644 --- a/hwe/a_genList.php +++ b/hwe/a_genList.php @@ -164,7 +164,7 @@ for ($j=0; $j < $gencount; $j++) { $imageTemp = GetImageURL($general['imgsvr']); echo " - width='64' height='64' src={$imageTemp}/{$general['picture']}> + $name {$general['age']}세 ".getGenChar($general['personal'])." From da7fcafb276a9573e0ddfa3bf83da091b11983a7 Mon Sep 17 00:00:00 2001 From: hide_d Date: Tue, 17 Apr 2018 03:45:57 +0900 Subject: [PATCH 66/66] =?UTF-8?q?=EC=82=AC=EB=A0=B9=EB=B6=80=20NPC=20?= =?UTF-8?q?=EC=83=89=EC=83=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/b_chiefcenter.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/hwe/b_chiefcenter.php b/hwe/b_chiefcenter.php index 0e916875..66b464dc 100644 --- a/hwe/b_chiefcenter.php +++ b/hwe/b_chiefcenter.php @@ -117,14 +117,14 @@ for($k=0; $k < 2; $k++) { ]; } - if ($gen[$l4]['npc']??0 >= 2) { $gen[$l4]['name'] = "".($gen[$l4]['name']??'').""; } - elseif($gen[$l4]['npc']??0 == 1) { $gen[$l4]['name'] = "".($gen[$l4]['name']??'').""; } - if ($gen[$l3]['npc']??0 >= 2) { $gen[$l3]['name'] = "".($gen[$l3]['name']??'').""; } - elseif($gen[$l3]['npc']??0 == 1) { $gen[$l3]['name'] = "".($gen[$l3]['name']??'').""; } - if ($gen[$l2]['npc']??0 >= 2) { $gen[$l2]['name'] = "".($gen[$l2]['name']??'').""; } - elseif($gen[$l2]['npc']??0 == 1) { $gen[$l2]['name'] = "".($gen[$l2]['name']??'').""; } - if ($gen[$l1]['npc']??0 >= 2) { $gen[$l1]['name'] = "".($gen[$l1]['name']??'').""; } - elseif($gen[$l1]['npc']??0 == 1) { $gen[$l1]['name'] = "".($gen[$l1]['name']??'').""; } + if ($gen[$l4]['npc'] >= 2) { $gen[$l4]['name'] = "".($gen[$l4]['name']??'').""; } + elseif($gen[$l4]['npc'] == 1) { $gen[$l4]['name'] = "".($gen[$l4]['name']??'').""; } + if ($gen[$l3]['npc'] >= 2) { $gen[$l3]['name'] = "".($gen[$l3]['name']??'').""; } + elseif($gen[$l3]['npc'] == 1) { $gen[$l3]['name'] = "".($gen[$l3]['name']??'').""; } + if ($gen[$l2]['npc'] >= 2) { $gen[$l2]['name'] = "".($gen[$l2]['name']??'').""; } + elseif($gen[$l2]['npc'] == 1) { $gen[$l2]['name'] = "".($gen[$l2]['name']??'').""; } + if ($gen[$l1]['npc'] >= 2) { $gen[$l1]['name'] = "".($gen[$l1]['name']??'').""; } + elseif($gen[$l1]['npc'] == 1) { $gen[$l1]['name'] = "".($gen[$l1]['name']??'').""; } echo "