버그 수정

This commit is contained in:
2020-04-30 19:29:39 +09:00
parent b24eabc82a
commit cf1dc17298
6 changed files with 60 additions and 57 deletions
+2 -2
View File
@@ -22,7 +22,7 @@ $queryMap = [
} }
return $lhs['name']<=>$rhs['name']; return $lhs['name']<=>$rhs['name'];
}], }],
'warnum' => ['전투수', 1, function($lhs, $rhs){ 'warnum' => ['전투수', 2, function($lhs, $rhs){
return -($lhs['warnum']<=>$rhs['warnum']); return -($lhs['warnum']<=>$rhs['warnum']);
}] }]
]; ];
@@ -72,7 +72,7 @@ else if($reqArgType===2){
$generalBasicList = $db->query('SELECT no, name, nation, npc, turntime, value as %b $generalBasicList = $db->query('SELECT no, name, nation, npc, turntime, value as %b
FROM general LEFT JOIN rank_data FROM general LEFT JOIN rank_data
ON general.no = rank_data.general_id ON general.no = rank_data.general_id
WHERE rank_data.type = %b', WHERE rank_data.type = %s',
$reqQueryType, $reqQueryType $reqQueryType, $reqQueryType
); );
} }
+2 -2
View File
@@ -26,7 +26,7 @@ $queryMap = [
} }
return $lhs['name']<=>$rhs['name']; return $lhs['name']<=>$rhs['name'];
}], }],
'warnum' => ['전투수', 1, function($lhs, $rhs){ 'warnum' => ['전투수', 2, function($lhs, $rhs){
return -($lhs['warnum']<=>$rhs['warnum']); return -($lhs['warnum']<=>$rhs['warnum']);
}] }]
]; ];
@@ -91,7 +91,7 @@ else if($reqArgType===2){
$generalBasicList = $db->query('SELECT no, name, npc, turntime, officer_level, value as %b $generalBasicList = $db->query('SELECT no, name, npc, turntime, officer_level, value as %b
FROM general LEFT JOIN rank_data FROM general LEFT JOIN rank_data
ON general.no = rank_data.general_id ON general.no = rank_data.general_id
WHERE rank_data.type = %b AND general.nation = %i', WHERE rank_data.type = %s AND general.nation = %i',
$reqQueryType, $reqQueryType, $nationID $reqQueryType, $reqQueryType, $nationID
); );
} }
-1
View File
@@ -194,7 +194,6 @@ function updateQuaterly() {
function preUpdateMonthly() { function preUpdateMonthly() {
$db = DB::db(); $db = DB::db();
$gameStor = KVStorage::getStorage($db, 'game_env'); $gameStor = KVStorage::getStorage($db, 'game_env');
$connect=$db->get();
//연감 월결산 //연감 월결산
$result = LogHistory(); $result = LogHistory();
+43 -49
View File
@@ -423,7 +423,6 @@ function getTwo($tournament, $phase) {
function qualify($tnmt_type, $tnmt, $phase) { function qualify($tnmt_type, $tnmt, $phase) {
$db = DB::db(); $db = DB::db();
$gameStor = KVStorage::getStorage($db, 'game_env'); $gameStor = KVStorage::getStorage($db, 'game_env');
$connect=$db->get();
$cand = getTwo($tnmt, $phase); $cand = getTwo($tnmt, $phase);
@@ -437,13 +436,15 @@ function qualify($tnmt_type, $tnmt, $phase) {
$gameStor->phase=0; $gameStor->phase=0;
$gameStor->tournament=3; $gameStor->tournament=3;
for($i=0; $i < 8; $i++) { foreach(Util::range(8) as $grpIdx){
$query = "select grp,grp_no,win+draw+lose as game,win,draw,lose,gl,win*3+draw as gd from tournament where grp='$i' order by gd desc, gl desc, seq limit 0,4"; $promoters = $db->query(
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); 'SELECT grp,grp_no,win+draw+lose as game,win,draw,lose,gl,win*3+draw as gd from tournament where grp=%i order by gd desc, gl desc, seq limit 0,4',
for($k=1; $k <= 4; $k++) { $grpIdx
$gen = MYDB_fetch_array($result); );
$query = "update tournament set prmt='$k' where grp='{$gen['grp']}' and grp_no='{$gen['grp_no']}'"; foreach($promoters as $grpRank=>$grpGen){
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $db->update('tournament', [
'prmt'=>$grpRank+1,
], 'grp=%i AND grp_no=%i', $grpIdx, $grpGen['grp_no']);
} }
} }
} }
@@ -451,7 +452,6 @@ function qualify($tnmt_type, $tnmt, $phase) {
function qualifyAll($tnmt_type, $tnmt, $phase) { function qualifyAll($tnmt_type, $tnmt, $phase) {
$db = DB::db(); $db = DB::db();
$connect=$db->get();
$start = $phase; $start = $phase;
$end = $phase - ($phase % 4) + 4; $end = $phase - ($phase % 4) + 4;
@@ -463,7 +463,6 @@ function qualifyAll($tnmt_type, $tnmt, $phase) {
function selection($tnmt_type, $tnmt, $phase) { function selection($tnmt_type, $tnmt, $phase) {
$db = DB::db(); $db = DB::db();
$gameStor = KVStorage::getStorage($db, 'game_env'); $gameStor = KVStorage::getStorage($db, 'game_env');
$connect=$db->get();
//시드1 배정 //시드1 배정
if($phase < 8) { if($phase < 8) {
@@ -521,7 +520,6 @@ function selectionAll($tnmt_type, $tnmt, $phase) {
function finallySingle($tnmt_type, $tnmt, $phase) { function finallySingle($tnmt_type, $tnmt, $phase) {
$db = DB::db(); $db = DB::db();
$gameStor = KVStorage::getStorage($db, 'game_env'); $gameStor = KVStorage::getStorage($db, 'game_env');
$connect=$db->get();
$cand = getTwo($tnmt, $phase); $cand = getTwo($tnmt, $phase);
@@ -535,13 +533,15 @@ function finallySingle($tnmt_type, $tnmt, $phase) {
$gameStor->tournament=5; $gameStor->tournament=5;
$gameStor->phase=0; $gameStor->phase=0;
for($i=10; $i < 18; $i++) { foreach(Util::range(10, 18) as $grpIdx){
$query = "select grp,grp_no,win+draw+lose as game,win,draw,lose,gl,win*3+draw as gd from tournament where grp='$i' order by gd desc, gl desc, seq limit 0,2"; $promoters = $db->query(
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); 'SELECT grp,grp_no,win+draw+lose as game,win,draw,lose,gl,win*3+draw as gd from tournament where grp=%i order by gd desc, gl desc, seq limit 0,2',
for($k=1; $k <= 2; $k++) { $grpIdx
$gen = MYDB_fetch_array($result); );
$query = "update tournament set prmt='$k' where grp='{$gen['grp']}' and grp_no='{$gen['grp_no']}'"; foreach($promoters as $grpRank=>$grpGen){
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $db->update('tournament', [
'prmt'=>$grpRank+1,
], 'grp=%i AND grp_no=%i', $grpIdx, $grpGen['grp_no']);
} }
} }
} }
@@ -558,7 +558,6 @@ function finallyAll($tnmt_type, $tnmt, $phase) {
function final16set() { function final16set() {
$db = DB::db(); $db = DB::db();
$gameStor = KVStorage::getStorage($db, 'game_env'); $gameStor = KVStorage::getStorage($db, 'game_env');
$connect=$db->get();
//1조1-5조2, 2조1-6조2, 3조1-7조2, 4조1-8조2, 5조1-1조2, 6조1-2조2, 7조1-3조2, 8조1-4조2 //1조1-5조2, 2조1-6조2, 3조1-7조2, 4조1-8조2, 5조1-1조2, 6조1-2조2, 7조1-3조2, 8조1-4조2
$grp = Array(10, 14, 11, 15, 12, 16, 13, 17, 14, 10, 15, 11, 16, 12, 17, 13); $grp = Array(10, 14, 11, 15, 12, 16, 13, 17, 14, 10, 15, 11, 16, 12, 17, 13);
@@ -595,7 +594,6 @@ function final16set() {
function finalFight($tnmt_type, $tnmt, $phase, $type) { function finalFight($tnmt_type, $tnmt, $phase, $type) {
$db = DB::db(); $db = DB::db();
$gameStor = KVStorage::getStorage($db, 'game_env'); $gameStor = KVStorage::getStorage($db, 'game_env');
$connect=$db->get();
switch($type) { switch($type) {
case 16: $offset = 20; $turn = 7; $next = 7; break; case 16: $offset = 20; $turn = 7; $next = 7; break;
@@ -637,7 +635,6 @@ function finalFight($tnmt_type, $tnmt, $phase, $type) {
function setGift($tnmt_type, $tnmt, $phase) { function setGift($tnmt_type, $tnmt, $phase) {
$db = DB::db(); $db = DB::db();
$gameStor = KVStorage::getStorage($db, 'game_env'); $gameStor = KVStorage::getStorage($db, 'game_env');
$connect=$db->get();
$admin = $gameStor->getValues(['year', 'month', 'develcost']); $admin = $gameStor->getValues(['year', 'month', 'develcost']);
@@ -801,7 +798,6 @@ function setGift($tnmt_type, $tnmt, $phase) {
function setRefund() { function setRefund() {
$db = DB::db(); $db = DB::db();
$gameStor = KVStorage::getStorage($db, 'game_env'); $gameStor = KVStorage::getStorage($db, 'game_env');
$connect=$db->get();
//16강자 명성 돈 //16강자 명성 돈
$cost = $gameStor->develcost; $cost = $gameStor->develcost;
@@ -833,17 +829,11 @@ function getLog($lvl1, $lvl2) {
function fight($tnmt_type, $tnmt, $phs, $group, $g1, $g2, $type) { function fight($tnmt_type, $tnmt, $phs, $group, $g1, $g2, $type) {
$log = []; $log = [];
$db = DB::db(); $db = DB::db();
$connect=$db->get();
eraseTnmtFightLog($group); eraseTnmtFightLog($group);
$query = "select *,(leadership+strength+intel)*7/15 as total,h,w,b from tournament where grp='$group' and grp_no='$g1'"; $gen1 = $db->queryFirstRow('SELECT *,(leadership+strength+intel)*7/15 as total,h,w,b from tournament where grp=%i AND grp_no=%i', $group, $g1);
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $gen2 = $db->queryFirstRow('SELECT *,(leadership+strength+intel)*7/15 as total,h,w,b from tournament where grp=%i AND grp_no=%i', $group, $g2);
$gen1 = MYDB_fetch_array($result);
$query = "select *,(leadership+strength+intel)*7/15 as total,h,w,b from tournament where grp='$group' and grp_no='$g2'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$gen2 = MYDB_fetch_array($result);
if($type == 0) { $turn = 10; } if($type == 0) { $turn = 10; }
else { $turn = 100; } else { $turn = 100; }
@@ -1063,11 +1053,15 @@ function fight($tnmt_type, $tnmt, $phs, $group, $g1, $g2, $type) {
$log[] = "<S>●</> <Y>{$gen1['name']}</> <S>승리</>!"; $log[] = "<S>●</> <Y>{$gen1['name']}</> <S>승리</>!";
$gl = Util::round(($gd2 - $gd1) / 50); $gl = Util::round(($gd2 - $gd1) / 50);
$query = "update tournament set win=win+1,gl=gl+'$gl' where grp='$group' and grp_no='$g1'"; $db->update('tournament', [
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); 'win'=>$db->sqleval('win+1'),
$query = "update tournament set lose=lose+1,gl=gl-'$gl' where grp='$group' and grp_no='$g2'"; 'gl'=>$db->sqleval('gl+%i', $gl)
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); ], 'grp=%i AND grp_no=%i', $group, $g1);
$db->update('tournament', [
'lose'=>$db->sqleval('lose+1'),
'gl'=>$db->sqleval('gl-%i', $gl)
], 'grp=%i AND grp_no=%i', $group, $g2);
if($general1['gl'] > $general2['gl']) { $gl1 = 1; $gl2 = 0; } if($general1['gl'] > $general2['gl']) { $gl1 = 1; $gl2 = 0; }
elseif($general1['gl'] == $general2['gl']) { $gl1 = 2; $gl2 = -1; } elseif($general1['gl'] == $general2['gl']) { $gl1 = 2; $gl2 = -1; }
else { $gl1 = 3; $gl2 = -2; } else { $gl1 = 3; $gl2 = -2; }
@@ -1079,10 +1073,14 @@ function fight($tnmt_type, $tnmt, $phs, $group, $g1, $g2, $type) {
$log[] = "<S>●</> <Y>{$gen2['name']}</> <S>승리</>!"; $log[] = "<S>●</> <Y>{$gen2['name']}</> <S>승리</>!";
$gl = Util::round(($gd1 - $gd2) / 50); $gl = Util::round(($gd1 - $gd2) / 50);
$query = "update tournament set win=win+1,gl=gl+'$gl' where grp='$group' and grp_no='$g2'"; $db->update('tournament', [
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); 'lose'=>$db->sqleval('lose+1'),
$query = "update tournament set lose=lose+1,gl=gl-'$gl' where grp='$group' and grp_no='$g1'"; 'gl'=>$db->sqleval('gl-%i', $gl)
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); ], 'grp=%i AND grp_no=%i', $group, $g1);
$db->update('tournament', [
'win'=>$db->sqleval('win+1'),
'gl'=>$db->sqleval('gl+%i', $gl)
], 'grp=%i AND grp_no=%i', $group, $g2);
if($general2['gl'] > $general1['gl']) { $gl2 = 1; $gl1 = 0; } if($general2['gl'] > $general1['gl']) { $gl2 = 1; $gl1 = 0; }
elseif($general2['gl'] == $general1['gl']) { $gl2 = 2; $gl1 = -1; } elseif($general2['gl'] == $general1['gl']) { $gl2 = 2; $gl1 = -1; }
@@ -1094,8 +1092,9 @@ function fight($tnmt_type, $tnmt, $phs, $group, $g1, $g2, $type) {
case 2: case 2:
$log[] = "<S>●</> 무승부!"; $log[] = "<S>●</> 무승부!";
$query = "update tournament set draw=draw+1 where grp='$group' and (grp_no='$g1' or grp_no='$g2')"; $db->update('tournament', [
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); 'draw'=>$db->sqleval('draw+1')
], 'grp=%i AND (grp_no=%i OR grp_no=%i)', $group, $g1, $g2);
if($general1['gl'] > $general2['gl']) { $gl2 = -1; $gl1 = 1; } if($general1['gl'] > $general2['gl']) { $gl2 = -1; $gl1 = 1; }
elseif($general1['gl'] == $general2['gl']) { $gl2 = 0; $gl1 = 0; } elseif($general1['gl'] == $general2['gl']) { $gl2 = 0; $gl1 = 0; }
@@ -1125,15 +1124,10 @@ function fight($tnmt_type, $tnmt, $phs, $group, $g1, $g2, $type) {
if(($tnmt == 2 && $phs < 55) || ($tnmt == 4 && $phs < 5)) { if(($tnmt == 2 && $phs < 55) || ($tnmt == 4 && $phs < 5)) {
$cand = getTwo($tnmt, $phs+1); $cand = getTwo($tnmt, $phs+1);
$query = "select name from tournament where grp='$group' and grp_no='$cand[0]'"; $gen1Name = $db->queryFirstField('SELECT name FROM tournament where grp=%i and grp_no=%i', $group, $cand[0]);
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $gen2Name = $db->queryFirstField('SELECT name FROM tournament where grp=%i and grp_no=%i', $group, $cand[1]);
$gen1 = MYDB_fetch_array($result);
$query = "select name from tournament where grp='$group' and grp_no='$cand[1]'"; $log[] = "--------------- 다음경기 ---------------<br><S>☞</> <Y>{$gen1Name}</> vs <Y>{$gen2Name}</>";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$gen2 = MYDB_fetch_array($result);
$log[] = "--------------- 다음경기 ---------------<br><S>☞</> <Y>{$gen1['name']}</> vs <Y>{$gen2['name']}</>";
} }
pushTnmtFightLog($group, $log); pushTnmtFightLog($group, $log);
+1 -1
View File
@@ -151,7 +151,7 @@ class che_포상 extends Command\NationCommand{
], 'nation=%i', $nationID); ], 'nation=%i', $nationID);
$destGeneral->getLogger()->pushGeneralActionLog("{$resName} <C>{$amountText}</>을 포상으로 받았습니다.", ActionLogger::PLAIN); $destGeneral->getLogger()->pushGeneralActionLog("{$resName} <C>{$amountText}</>을 포상으로 받았습니다.", ActionLogger::PLAIN);
$logger->pushGeneralActionLog("{$destGeneral->getName()}에게 {$resName} <C>$amountText</>을 수여했습니다. <1>$date</>"); $logger->pushGeneralActionLog("<Y>{$destGeneral->getName()}</>에게 {$resName} <C>$amountText</>을 수여했습니다. <1>$date</>");
$this->setResultTurn(new LastTurn(static::getName(), $this->arg)); $this->setResultTurn(new LastTurn(static::getName(), $this->arg));
$general->applyDB($db); $general->applyDB($db);
+12 -2
View File
@@ -1575,10 +1575,20 @@ class GeneralAI
$avgRice += $general->getVar('rice'); $avgRice += $general->getVar('rice');
$genCnt += 1; $genCnt += 1;
} }
foreach($this->userWarGenerals as $general){ foreach($this->npcCivilGenerals as $general){
$avgGold += $general->getVar('gold'); $avgGold += $general->getVar('gold');
$avgRice += $general->getVar('rice'); $avgRice += $general->getVar('rice');
$genCnt += 2; $genCnt += 1;
}
foreach($this->userWarGenerals as $general){
$avgGold += $general->getVar('gold') / 2;
$avgRice += $general->getVar('rice') / 2;
$genCnt += 1;
}
foreach($this->userCivilGenerals as $general){
$avgGold += $general->getVar('gold') / 2;
$avgRice += $general->getVar('rice') / 2;
$genCnt += 1;
} }
$avgGold += $nation['gold']; $avgGold += $nation['gold'];
$avgRice += $nation['rice']; $avgRice += $nation['rice'];