$game_env -> $admin

This commit is contained in:
2018-05-21 01:05:59 +09:00
parent 21837d0869
commit 913b308892
5 changed files with 103 additions and 103 deletions
+19 -19
View File
@@ -82,7 +82,7 @@ $query = "select no,tournament,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); $me = MYDB_fetch_array($result);
$game_env = $gameStor->getAll(); $admin = $gameStor->getAll();
$con = checkLimit($me['con']); $con = checkLimit($me['con']);
if($con >= 2) { printLimitMsg($me['turntime']); exit(); } if($con >= 2) { printLimitMsg($me['turntime']); exit(); }
@@ -172,7 +172,7 @@ if($isgen == "장수공격" || $isgen == "성벽공격" || $isgen == "장수평
$opposecount = 0; $opposecount = 0;
} }
$warphase = getRate($game_env, $general['crewtype'], "spd"); //병종간 페이즈 수 얻기 $warphase = getRate($admin, $general['crewtype'], "spd"); //병종간 페이즈 수 얻기
// 우선 스케일링 // 우선 스케일링
$city['def'] *= 10; $city['def'] *= 10;
@@ -300,7 +300,7 @@ if($isgen == "장수공격" || $isgen == "성벽공격" || $isgen == "장수평
} }
//회피 //회피
$ratio = rand() % 100; // 0 ~ 99 $ratio = rand() % 100; // 0 ~ 99
$ratio2 = getRate($game_env, $general['crewtype'], "avd"); //회피율 $ratio2 = getRate($admin, $general['crewtype'], "avd"); //회피율
if($ratio < $ratio2 && $avoid == 1) { if($ratio < $ratio2 && $avoid == 1) {
$msg .= "<C>●</><C>회피</>했다!</><br>"; $msg .= "<C>●</><C>회피</>했다!</><br>";
$myCrew /= 10; // 10%만 소모 $myCrew /= 10; // 10%만 소모
@@ -664,7 +664,7 @@ if($isgen == "장수공격" || $isgen == "성벽공격" || $isgen == "장수평
} }
//회피 //회피
$ratio = rand() % 100; // 0 ~ 99 $ratio = rand() % 100; // 0 ~ 99
$ratio2 = getRate($game_env, $general['crewtype'], "avd"); //회피율 $ratio2 = getRate($admin, $general['crewtype'], "avd"); //회피율
if($ratio < $ratio2 && $myAvoid == 1) { if($ratio < $ratio2 && $myAvoid == 1) {
$msg .= "<C>●</><C>회피</>했다!</><br>"; $msg .= "<C>●</><C>회피</>했다!</><br>";
$myCrew /= 10; // 10%만 소모 $myCrew /= 10; // 10%만 소모
@@ -672,7 +672,7 @@ if($isgen == "장수공격" || $isgen == "성벽공격" || $isgen == "장수평
} }
//회피 //회피
$ratio = rand() % 100; // 0 ~ 99 $ratio = rand() % 100; // 0 ~ 99
$ratio2 = getRate($game_env, $oppose['crewtype'], "avd"); //회피율 $ratio2 = getRate($admin, $oppose['crewtype'], "avd"); //회피율
if($ratio < $ratio2 && $opAvoid == 1) { if($ratio < $ratio2 && $opAvoid == 1) {
$msg .= "<C>●</>상대가 <R>회피</>했다!</><br>"; $msg .= "<C>●</>상대가 <R>회피</>했다!</><br>";
$opCrew /= 10; // 10%만 소모 $opCrew /= 10; // 10%만 소모
@@ -801,8 +801,8 @@ if($isgen == "장수공격" || $isgen == "성벽공격" || $isgen == "장수평
$def = 7000; $def = 7000;
$wall = 7000; $wall = 7000;
$train3 = $game_env['city_rate']; $train3 = $admin['city_rate'];
$atmos3 = $game_env['city_rate']; $atmos3 = $admin['city_rate'];
} }
switch($level1) { switch($level1) {
@@ -1597,31 +1597,31 @@ if($isgen == "장수공격" || $isgen == "성벽공격") {
<?php <?php
for($i=0; $i <= 5; $i++) { for($i=0; $i <= 5; $i++) {
printSimul($game_env, $i); printSimul($admin, $i);
} }
echo " echo "
<tr><td height=5 colspan=8 id=bg1></td></tr>"; <tr><td height=5 colspan=8 id=bg1></td></tr>";
for($i=10; $i <= 14; $i++) { for($i=10; $i <= 14; $i++) {
printSimul($game_env, $i); printSimul($admin, $i);
} }
echo " echo "
<tr><td height=5 colspan=8 id=bg1></td></tr>"; <tr><td height=5 colspan=8 id=bg1></td></tr>";
for($i=20; $i <= 27; $i++) { for($i=20; $i <= 27; $i++) {
printSimul($game_env, $i); printSimul($admin, $i);
} }
echo " echo "
<tr><td height=5 colspan=8 id=bg1></td></tr>"; <tr><td height=5 colspan=8 id=bg1></td></tr>";
for($i=30; $i <= 38; $i++) { for($i=30; $i <= 38; $i++) {
printSimul($game_env, $i); printSimul($admin, $i);
} }
echo " echo "
<tr><td height=5 colspan=8 id=bg1></td></tr>"; <tr><td height=5 colspan=8 id=bg1></td></tr>";
for($i=40; $i <= 43; $i++) { for($i=40; $i <= 43; $i++) {
printSimul($game_env, $i); printSimul($admin, $i);
} }
echo " echo "
<tr><td height=5 colspan=8 id=bg1></td></tr>"; <tr><td height=5 colspan=8 id=bg1></td></tr>";
@@ -1632,13 +1632,13 @@ if($isgen == "장수공격" || $isgen == "성벽공격") {
</html> </html>
<?php <?php
function printSimul($game_env, $i) { function printSimul($admin, $i) {
$att = $game_env["att{$i}"]; $att = $admin["att{$i}"];
$def = $game_env["def{$i}"]; $def = $admin["def{$i}"];
$spd = $game_env["spd{$i}"]; $spd = $admin["spd{$i}"];
$avd = $game_env["avd{$i}"]; $avd = $admin["avd{$i}"];
$cst = $game_env["cst{$i}"]; $cst = $admin["cst{$i}"];
$ric = $game_env["ric{$i}"]; $ric = $admin["ric{$i}"];
echo " echo "
<tr> <tr>
<td align=right>".GameUnitConst::byId($i)->name."</td> <td align=right>".GameUnitConst::byId($i)->name."</td>
+16 -16
View File
@@ -10,7 +10,7 @@ $connect=$db->get();
increaseRefresh("갱신정보", 2); increaseRefresh("갱신정보", 2);
$game_env = $gameStor->getValues(['year','month','refresh','maxrefresh','maxonline']); $admin = $gameStor->getValues(['year','month','refresh','maxrefresh','maxonline']);
$log = getRawFileLogRecent(__dir__.'/logs/_traffic.txt', 11, 100); $log = getRawFileLogRecent(__dir__.'/logs/_traffic.txt', 11, 100);
@@ -29,21 +29,21 @@ foreach($log as $i=>$value){
$refresh[$i] = $parse[3]; $refresh[$i] = $parse[3];
$online[$i] = $parse[4]; $online[$i] = $parse[4];
} }
$year[] = $game_env['year']; $year[] = $admin['year'];
$month[] = $game_env['month']; $month[] = $admin['month'];
$date[] = date('Y-m-d H:i:s'); $date[] = date('Y-m-d H:i:s');
if ($game_env['maxrefresh'] == 0) { if ($admin['maxrefresh'] == 0) {
$game_env['maxrefresh'] = 1; $admin['maxrefresh'] = 1;
} }
if ($game_env['maxrefresh'] < $game_env['refresh']) { if ($admin['maxrefresh'] < $admin['refresh']) {
$game_env['maxrefresh'] = $game_env['refresh']; $admin['maxrefresh'] = $admin['refresh'];
} }
if ($game_env['maxonline'] == 0) { if ($admin['maxonline'] == 0) {
$game_env['maxonline'] = 1; $admin['maxonline'] = 1;
} }
if ($game_env['maxonline'] < $curonline) { if ($admin['maxonline'] < $curonline) {
$game_env['maxonline'] = $curonline; $admin['maxonline'] = $curonline;
} }
?> ?>
<!DOCTYPE html> <!DOCTYPE html>
@@ -89,9 +89,9 @@ span.out_bar{
<table align=center class='tb_layout bg0'> <table align=center class='tb_layout bg0'>
<tr><td colspan=4 align=center id=bg2><font size=5>접 속 량</font></td></tr> <tr><td colspan=4 align=center id=bg2><font size=5>접 속 량</font></td></tr>
<?php <?php
$refresh[] = $game_env['refresh']; $refresh[] = $admin['refresh'];
foreach($refresh as $i=>$value){ foreach($refresh as $i=>$value){
$w = round($value / $game_env['maxrefresh'] * 100, 1); $w = round($value / $admin['maxrefresh'] * 100, 1);
$color = getTrafficColor($w); $color = getTrafficColor($w);
$dt = substr($date[$i], 11, 5); ?> $dt = substr($date[$i], 11, 5); ?>
<tr height=30> <tr height=30>
@@ -114,7 +114,7 @@ foreach($refresh as $i=>$value){
?> ?>
<tr><td colspan=4 height=5 align=center id=bg1></td></tr> <tr><td colspan=4 height=5 align=center id=bg1></td></tr>
<tr> <tr>
<td colspan=4 height=30 align=center id=bg0>최고기록: <?=$game_env['maxrefresh']?></td> <td colspan=4 height=30 align=center id=bg0>최고기록: <?=$admin['maxrefresh']?></td>
</tr> </tr>
@@ -126,7 +126,7 @@ foreach($refresh as $i=>$value){
<?php <?php
$online[] = $curonline; $online[] = $curonline;
foreach($online as $i=>$value){ foreach($online as $i=>$value){
$w = round($value / $game_env['maxonline'] * 100, 1); $w = round($value / $admin['maxonline'] * 100, 1);
$color = getTrafficColor($w); $color = getTrafficColor($w);
$dt = substr($date[$i], 11, 5); ?> $dt = substr($date[$i], 11, 5); ?>
<tr height=30> <tr height=30>
@@ -149,7 +149,7 @@ foreach($online as $i=>$value){
?> ?>
<tr><td colspan=4 height=5 align=center id=bg1></td></tr> <tr><td colspan=4 height=5 align=center id=bg1></td></tr>
<tr> <tr>
<td colspan=4 height=30 align=center id=bg0>최고기록: <?=$game_env['maxonline']?></td> <td colspan=4 height=30 align=center id=bg0>최고기록: <?=$admin['maxonline']?></td>
</tr> </tr>
</table> </table>
</td></tr> </td></tr>
+37 -37
View File
@@ -1322,20 +1322,20 @@ function updateTraffic() {
$online = getOnlineNum(); $online = getOnlineNum();
$db = DB::db(); $db = DB::db();
$gameStor = KVStorage::getStorage($db, 'game_env'); $gameStor = KVStorage::getStorage($db, 'game_env');
$game_env = $gameStor->getValues(['year','month','refresh','maxonline','maxrefresh']); $admin = $gameStor->getValues(['year','month','refresh','maxonline','maxrefresh']);
//최다갱신자 //최다갱신자
$user = $db->queryFirstRow('select name,refresh from general order by refresh desc limit 1'); $user = $db->queryFirstRow('select name,refresh from general order by refresh desc limit 1');
if($game_env['maxrefresh'] < $game_env['refresh']) { if($admin['maxrefresh'] < $admin['refresh']) {
$game_env['maxrefresh'] = $game_env['refresh']; $admin['maxrefresh'] = $admin['refresh'];
} }
if($game_env['maxonline'] < $online) { if($admin['maxonline'] < $online) {
$game_env['maxonline'] = $online; $admin['maxonline'] = $online;
} }
$gameStor->refresh = 0; $gameStor->refresh = 0;
$gameStor->maxrefresh = $game_env['maxrefresh']; $gameStor->maxrefresh = $admin['maxrefresh'];
$gameStor->maxonline = $game_env['maxonline']; $gameStor->maxonline = $admin['maxonline'];
$db->update('general', ['refresh'=>0], true); $db->update('general', ['refresh'=>0], true);
@@ -1344,9 +1344,9 @@ function updateTraffic() {
file_put_contents(__dir__."/logs/_traffic.txt", file_put_contents(__dir__."/logs/_traffic.txt",
Json::encode([ Json::encode([
$date, $date,
$game_env['year'], $admin['year'],
$game_env['month'], $admin['month'],
$game_env['refresh'], $admin['refresh'],
$online, $online,
$user['name']."(".$user['refresh'].")" $user['name']."(".$user['refresh'].")"
])."\n" ])."\n"
@@ -2153,7 +2153,7 @@ function uniqueItem($general, $log, $vote=0) {
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$gen = MYDB_fetch_array($result); $gen = MYDB_fetch_array($result);
if($game_env['scenario'] == 0) { $prob = $gen['cnt'] * 5; } // 5~6개월에 하나씩 등장 if($admin['scenario'] == 0) { $prob = $gen['cnt'] * 5; } // 5~6개월에 하나씩 등장
else { $prob = $gen['cnt']; } // 1~2개월에 하나씩 등장 else { $prob = $gen['cnt']; } // 1~2개월에 하나씩 등장
if($vote == 1) { $prob = Util::round($gen['cnt'] * 0.7 / 3); } // 투표율 70%, 투표 한번에 2~3개 등장 if($vote == 1) { $prob = Util::round($gen['cnt'] * 0.7 / 3); } // 투표율 70%, 투표 한번에 2~3개 등장
@@ -2194,63 +2194,63 @@ function uniqueItem($general, $log, $vote=0) {
switch($sel) { switch($sel) {
case 0: case 0:
$log[] = "<C>●</><C>".getWeapName($it)."</>(을)를 습득했습니다!"; $log[] = "<C>●</><C>".getWeapName($it)."</>(을)를 습득했습니다!";
$alllog[0] = "<C>●</>{$game_env['month']}월:<Y>{$general['name']}</>(이)가 <C>".getWeapName($it)."</>(을)를 습득했습니다!"; $alllog[0] = "<C>●</>{$admin['month']}월:<Y>{$general['name']}</>(이)가 <C>".getWeapName($it)."</>(을)를 습득했습니다!";
pushGeneralHistory($general, "<C>●</>{$game_env['year']}{$game_env['month']}월:<C>".getWeapName($it)."</>(을)를 습득"); pushGeneralHistory($general, "<C>●</>{$admin['year']}{$admin['month']}월:<C>".getWeapName($it)."</>(을)를 습득");
if($vote == 0) { if($vote == 0) {
$history[] = "<C>●</>{$game_env['year']}{$game_env['month']}월:<C><b>【아이템】</b></><D><b>{$nation['name']}</b></>의 <Y>{$general['name']}</>(이)가 <C>".getWeapName($it)."</>(을)를 습득했습니다!"; $history[] = "<C>●</>{$admin['year']}{$admin['month']}월:<C><b>【아이템】</b></><D><b>{$nation['name']}</b></>의 <Y>{$general['name']}</>(이)가 <C>".getWeapName($it)."</>(을)를 습득했습니다!";
} elseif($vote == 1) { } elseif($vote == 1) {
$history[] = "<C>●</>{$game_env['year']}{$game_env['month']}월:<C><b>【설문상품】</b></><D><b>{$nation['name']}</b></>의 <Y>{$general['name']}</>(이)가 <C>".getWeapName($it)."</>(을)를 습득했습니다!"; $history[] = "<C>●</>{$admin['year']}{$admin['month']}월:<C><b>【설문상품】</b></><D><b>{$nation['name']}</b></>의 <Y>{$general['name']}</>(이)가 <C>".getWeapName($it)."</>(을)를 습득했습니다!";
} elseif($vote == 2) { } elseif($vote == 2) {
$history[] = "<C>●</>{$game_env['year']}{$game_env['month']}월:<C><b>【랜덤임관상품】</b></><D><b>{$nation['name']}</b></>의 <Y>{$general['name']}</>(이)가 <C>".getWeapName($it)."</>(을)를 습득했습니다!"; $history[] = "<C>●</>{$admin['year']}{$admin['month']}월:<C><b>【랜덤임관상품】</b></><D><b>{$nation['name']}</b></>의 <Y>{$general['name']}</>(이)가 <C>".getWeapName($it)."</>(을)를 습득했습니다!";
} elseif($vote == 3) { } elseif($vote == 3) {
$history[] = "<C>●</>{$game_env['year']}{$game_env['month']}월:<C><b>【건국상품】</b></><D><b>{$nation['name']}</b></>의 <Y>{$general['name']}</>(이)가 <C>".getWeapName($it)."</>(을)를 습득했습니다!"; $history[] = "<C>●</>{$admin['year']}{$admin['month']}월:<C><b>【건국상품】</b></><D><b>{$nation['name']}</b></>의 <Y>{$general['name']}</>(이)가 <C>".getWeapName($it)."</>(을)를 습득했습니다!";
} }
break; break;
case 1: case 1:
$log[] = "<C>●</><C>".getBookName($it)."</>(을)를 습득했습니다!"; $log[] = "<C>●</><C>".getBookName($it)."</>(을)를 습득했습니다!";
$alllog[0] = "<C>●</>{$game_env['month']}월:<Y>{$general['name']}</>(이)가 <C>".getBookName($it)."</>(을)를 습득했습니다!"; $alllog[0] = "<C>●</>{$admin['month']}월:<Y>{$general['name']}</>(이)가 <C>".getBookName($it)."</>(을)를 습득했습니다!";
pushGeneralHistory($general, "<C>●</>{$game_env['year']}{$game_env['month']}월:<C>".getBookName($it)."</>(을)를 습득"); pushGeneralHistory($general, "<C>●</>{$admin['year']}{$admin['month']}월:<C>".getBookName($it)."</>(을)를 습득");
if($vote == 0) { if($vote == 0) {
$history[] = "<C>●</>{$game_env['year']}{$game_env['month']}월:<C><b>【아이템】</b></><D><b>{$nation['name']}</b></>의 <Y>{$general['name']}</>(이)가 <C>".getBookName($it)."</>(을)를 습득했습니다!"; $history[] = "<C>●</>{$admin['year']}{$admin['month']}월:<C><b>【아이템】</b></><D><b>{$nation['name']}</b></>의 <Y>{$general['name']}</>(이)가 <C>".getBookName($it)."</>(을)를 습득했습니다!";
} elseif($vote == 1) { } elseif($vote == 1) {
$history[] = "<C>●</>{$game_env['year']}{$game_env['month']}월:<C><b>【설문상품】</b></><D><b>{$nation['name']}</b></>의 <Y>{$general['name']}</>(이)가 <C>".getBookName($it)."</>(을)를 습득했습니다!"; $history[] = "<C>●</>{$admin['year']}{$admin['month']}월:<C><b>【설문상품】</b></><D><b>{$nation['name']}</b></>의 <Y>{$general['name']}</>(이)가 <C>".getBookName($it)."</>(을)를 습득했습니다!";
} elseif($vote == 2) { } elseif($vote == 2) {
$history[] = "<C>●</>{$game_env['year']}{$game_env['month']}월:<C><b>【랜덤임관상품】</b></><D><b>{$nation['name']}</b></>의 <Y>{$general['name']}</>(이)가 <C>".getBookName($it)."</>(을)를 습득했습니다!"; $history[] = "<C>●</>{$admin['year']}{$admin['month']}월:<C><b>【랜덤임관상품】</b></><D><b>{$nation['name']}</b></>의 <Y>{$general['name']}</>(이)가 <C>".getBookName($it)."</>(을)를 습득했습니다!";
} elseif($vote == 3) { } elseif($vote == 3) {
$history[] = "<C>●</>{$game_env['year']}{$game_env['month']}월:<C><b>【건국상품】</b></><D><b>{$nation['name']}</b></>의 <Y>{$general['name']}</>(이)가 <C>".getBookName($it)."</>(을)를 습득했습니다!"; $history[] = "<C>●</>{$admin['year']}{$admin['month']}월:<C><b>【건국상품】</b></><D><b>{$nation['name']}</b></>의 <Y>{$general['name']}</>(이)가 <C>".getBookName($it)."</>(을)를 습득했습니다!";
} }
break; break;
case 2: case 2:
$log[] = "<C>●</><C>".getHorseName($it)."</>(을)를 습득했습니다!"; $log[] = "<C>●</><C>".getHorseName($it)."</>(을)를 습득했습니다!";
$alllog[0] = "<C>●</>{$game_env['month']}월:<Y>{$general['name']}</>(이)가 <C>".getHorseName($it)."</>(을)를 습득했습니다!"; $alllog[0] = "<C>●</>{$admin['month']}월:<Y>{$general['name']}</>(이)가 <C>".getHorseName($it)."</>(을)를 습득했습니다!";
pushGeneralHistory($general, "<C>●</>{$game_env['year']}{$game_env['month']}월:<C>".getHorseName($it)."</>(을)를 습득"); pushGeneralHistory($general, "<C>●</>{$admin['year']}{$admin['month']}월:<C>".getHorseName($it)."</>(을)를 습득");
if($vote == 0) { if($vote == 0) {
$history[] = "<C>●</>{$game_env['year']}{$game_env['month']}월:<C><b>【아이템】</b></><D><b>{$nation['name']}</b></>의 <Y>{$general['name']}</>(이)가 <C>".getHorseName($it)."</>(을)를 습득했습니다!"; $history[] = "<C>●</>{$admin['year']}{$admin['month']}월:<C><b>【아이템】</b></><D><b>{$nation['name']}</b></>의 <Y>{$general['name']}</>(이)가 <C>".getHorseName($it)."</>(을)를 습득했습니다!";
} elseif($vote == 1) { } elseif($vote == 1) {
$history[] = "<C>●</>{$game_env['year']}{$game_env['month']}월:<C><b>【설문상품】</b></><D><b>{$nation['name']}</b></>의 <Y>{$general['name']}</>(이)가 <C>".getHorseName($it)."</>(을)를 습득했습니다!"; $history[] = "<C>●</>{$admin['year']}{$admin['month']}월:<C><b>【설문상품】</b></><D><b>{$nation['name']}</b></>의 <Y>{$general['name']}</>(이)가 <C>".getHorseName($it)."</>(을)를 습득했습니다!";
} elseif($vote == 2) { } elseif($vote == 2) {
$history[] = "<C>●</>{$game_env['year']}{$game_env['month']}월:<C><b>【랜덤임관상품】</b></><D><b>{$nation['name']}</b></>의 <Y>{$general['name']}</>(이)가 <C>".getHorseName($it)."</>(을)를 습득했습니다!"; $history[] = "<C>●</>{$admin['year']}{$admin['month']}월:<C><b>【랜덤임관상품】</b></><D><b>{$nation['name']}</b></>의 <Y>{$general['name']}</>(이)가 <C>".getHorseName($it)."</>(을)를 습득했습니다!";
} elseif($vote == 3) { } elseif($vote == 3) {
$history[] = "<C>●</>{$game_env['year']}{$game_env['month']}월:<C><b>【건국상품】</b></><D><b>{$nation['name']}</b></>의 <Y>{$general['name']}</>(이)가 <C>".getHorseName($it)."</>(을)를 습득했습니다!"; $history[] = "<C>●</>{$admin['year']}{$admin['month']}월:<C><b>【건국상품】</b></><D><b>{$nation['name']}</b></>의 <Y>{$general['name']}</>(이)가 <C>".getHorseName($it)."</>(을)를 습득했습니다!";
} }
break; break;
case 3: case 3:
$log[] = "<C>●</><C>".getItemName($it)."</>(을)를 습득했습니다!"; $log[] = "<C>●</><C>".getItemName($it)."</>(을)를 습득했습니다!";
$alllog[0] = "<C>●</>{$game_env['month']}월:<Y>{$general['name']}</>(이)가 <C>".getItemName($it)."</>(을)를 습득했습니다!"; $alllog[0] = "<C>●</>{$admin['month']}월:<Y>{$general['name']}</>(이)가 <C>".getItemName($it)."</>(을)를 습득했습니다!";
pushGeneralHistory($general, "<C>●</>{$game_env['year']}{$game_env['month']}월:<C>".getItemName($it)."</>(을)를 습득"); pushGeneralHistory($general, "<C>●</>{$admin['year']}{$admin['month']}월:<C>".getItemName($it)."</>(을)를 습득");
if($vote == 0) { if($vote == 0) {
$history[] = "<C>●</>{$game_env['year']}{$game_env['month']}월:<C><b>【아이템】</b></><D><b>{$nation['name']}</b></>의 <Y>{$general['name']}</>(이)가 <C>".getItemName($it)."</>(을)를 습득했습니다!"; $history[] = "<C>●</>{$admin['year']}{$admin['month']}월:<C><b>【아이템】</b></><D><b>{$nation['name']}</b></>의 <Y>{$general['name']}</>(이)가 <C>".getItemName($it)."</>(을)를 습득했습니다!";
} elseif($vote == 1) { } elseif($vote == 1) {
$history[] = "<C>●</>{$game_env['year']}{$game_env['month']}월:<C><b>【설문상품】</b></><D><b>{$nation['name']}</b></>의 <Y>{$general['name']}</>(이)가 <C>".getItemName($it)."</>(을)를 습득했습니다!"; $history[] = "<C>●</>{$admin['year']}{$admin['month']}월:<C><b>【설문상품】</b></><D><b>{$nation['name']}</b></>의 <Y>{$general['name']}</>(이)가 <C>".getItemName($it)."</>(을)를 습득했습니다!";
} elseif($vote == 2) { } elseif($vote == 2) {
$history[] = "<C>●</>{$game_env['year']}{$game_env['month']}월:<C><b>【랜덤임관상품】</b></><D><b>{$nation['name']}</b></>의 <Y>{$general['name']}</>(이)가 <C>".getItemName($it)."</>(을)를 습득했습니다!"; $history[] = "<C>●</>{$admin['year']}{$admin['month']}월:<C><b>【랜덤임관상품】</b></><D><b>{$nation['name']}</b></>의 <Y>{$general['name']}</>(이)가 <C>".getItemName($it)."</>(을)를 습득했습니다!";
} elseif($vote == 3) { } elseif($vote == 3) {
$history[] = "<C>●</>{$game_env['year']}{$game_env['month']}월:<C><b>【건국상품】</b></><D><b>{$nation['name']}</b></>의 <Y>{$general['name']}</>(이)가 <C>".getItemName($it)."</>(을)를 습득했습니다!"; $history[] = "<C>●</>{$admin['year']}{$admin['month']}월:<C><b>【건국상품】</b></><D><b>{$nation['name']}</b></>의 <Y>{$general['name']}</>(이)가 <C>".getItemName($it)."</>(을)를 습득했습니다!";
} }
break; break;
} }
pushGeneralPublicRecord($alllog, $game_env['year'], $game_env['month']); pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']);
pushWorldHistory($history, $game_env['year'], $game_env['month']); pushWorldHistory($history, $admin['year'], $admin['month']);
} }
} }
return $log; return $log;
+12 -12
View File
@@ -47,22 +47,22 @@ if(file_exists(__dir__.'/.htaccess')){
//TODO: 천통시에도 예약 오픈 알림이 필요..? //TODO: 천통시에도 예약 오픈 알림이 필요..?
$game_env = $gameStor->getValues(['isUnited', 'npcmode', 'year', 'month', 'scenario', 'scenario_text', 'maxgeneral', 'turnterm']); $admin = $gameStor->getValues(['isUnited', 'npcmode', 'year', 'month', 'scenario', 'scenario_text', 'maxgeneral', 'turnterm']);
$game_env['maxUserCnt'] = $game_env['maxgeneral']; $admin['maxUserCnt'] = $admin['maxgeneral'];
$game_env['npcMode'] = $game_env['npcmode']; $admin['npcMode'] = $admin['npcmode'];
$game_env['turnTerm'] = $game_env['turnterm']; $admin['turnTerm'] = $admin['turnterm'];
unset($game_env['npcmode']); unset($admin['npcmode']);
unset($game_env['maxgeneral']); unset($admin['maxgeneral']);
unset($game_env['turnterm']); unset($admin['turnterm']);
$nationCnt = $db->queryFirstField('SELECT count(`nation`) from nation where `level` > 0'); $nationCnt = $db->queryFirstField('SELECT count(`nation`) from nation where `level` > 0');
$genCnt = $db->queryFirstField('SELECT count(`no`) from general where `npc` < 2'); $genCnt = $db->queryFirstField('SELECT count(`no`) from general where `npc` < 2');
$npcCnt = $db->queryFirstField('SELECT count(`no`) from general where `npc` >= 2'); $npcCnt = $db->queryFirstField('SELECT count(`no`) from general where `npc` >= 2');
$game_env['scenario'] = $game_env['scenario_text']; $admin['scenario'] = $admin['scenario_text'];
$game_env['userCnt'] = $genCnt; $admin['userCnt'] = $genCnt;
$game_env['npcCnt'] = $npcCnt; $admin['npcCnt'] = $npcCnt;
$game_env['nationCnt'] = $nationCnt; $admin['nationCnt'] = $nationCnt;
$me = []; $me = [];
@@ -79,6 +79,6 @@ if($general){
//TODO: 이를 표현하는 방법은 '이전 버전'의 serverListPost.php를 참고할 것. //TODO: 이를 표현하는 방법은 '이전 버전'의 serverListPost.php를 참고할 것.
Json::die([ Json::die([
'game'=>$game_env, 'game'=>$admin,
'me'=>$me?:null 'me'=>$me?:null
]); ]);
+19 -19
View File
@@ -13,10 +13,10 @@ function processWar($general, $city) {
$date = substr($general['turntime'],11,5); $date = substr($general['turntime'],11,5);
$game_env = $gameStor->getAll(); $admin = $gameStor->getAll();
$year = $game_env['year']; $year = $admin['year'];
$month = $game_env['month']; $month = $admin['month'];
$log = []; $log = [];
$batlog = []; $batlog = [];
@@ -154,7 +154,7 @@ function processWar($general, $city) {
$city = addConflict($city, $general['nation'], 1);//NOTE: 이 경우 두 국가가 분쟁 중인 경우에는 병량패퇴의 이득이 없다. $city = addConflict($city, $general['nation'], 1);//NOTE: 이 경우 두 국가가 분쟁 중인 경우에는 병량패퇴의 이득이 없다.
ConquerCity($game_env, $general, $city, $nation, $destnation); ConquerCity($admin, $general, $city, $nation, $destnation);
break; break;
// 장수가 없어서 도시 공격 // 장수가 없어서 도시 공격
} elseif($opposecount == 0) { } elseif($opposecount == 0) {
@@ -189,13 +189,13 @@ function processWar($general, $city) {
if($myCrew <= 0) { $myCrew = rand() % 90 + 10; } if($myCrew <= 0) { $myCrew = rand() % 90 + 10; }
//훈련 사기따라 //훈련 사기따라
$myCrew = getCrew($myCrew, $game_env['city_rate']+$oppAtmosBonus, CharTrain($general['train']+$genTrain+$genTrainBonus, $general['personal'])); $myCrew = getCrew($myCrew, $admin['city_rate']+$oppAtmosBonus, CharTrain($general['train']+$genTrain+$genTrainBonus, $general['personal']));
$cityCrew = getCrew($cityCrew, CharAtmos($general['atmos']+$genAtmos+$genAtmosBonus, $general['personal']), $game_env['city_rate']+$oppTrainBonus); $cityCrew = getCrew($cityCrew, CharAtmos($general['atmos']+$genAtmos+$genAtmosBonus, $general['personal']), $admin['city_rate']+$oppTrainBonus);
//숙련도 따라 //숙련도 따라
$genDexAtt = getGenDex($general, $general['crewtype']); $genDexAtt = getGenDex($general, $general['crewtype']);
$genDexDef = getGenDex($general, 40); $genDexDef = getGenDex($general, 40);
$cityCrew *= getDexLog($genDexAtt, ($game_env['city_rate']-60)*7200); $cityCrew *= getDexLog($genDexAtt, ($admin['city_rate']-60)*7200);
$myCrew *= getDexLog(($game_env['city_rate']-60)*7200, $genDexDef); $myCrew *= getDexLog(($admin['city_rate']-60)*7200, $genDexDef);
$avoid = 1; $avoid = 1;
// 병종간 특성 // 병종간 특성
@@ -432,7 +432,7 @@ function processWar($general, $city) {
// 도시쌀 소모 계산 // 도시쌀 소모 계산
$opexp = Util::round($opexp / 50 * 0.8); $opexp = Util::round($opexp / 50 * 0.8);
$rice = Util::round($opexp * 5 * getCrewtypeRice(0, 0) * ($game_env['city_rate']/100 - 0.2)); $rice = Util::round($opexp * 5 * getCrewtypeRice(0, 0) * ($admin['city_rate']/100 - 0.2));
$destnation['rice'] -= $rice; $destnation['rice'] -= $rice;
if($destnation['rice'] < 0) { $destnation['rice'] = 0; } if($destnation['rice'] < 0) { $destnation['rice'] = 0; }
$query = "update nation set rice='{$destnation['rice']}' where nation='{$destnation['nation']}'"; $query = "update nation set rice='{$destnation['rice']}' where nation='{$destnation['nation']}'";
@@ -463,7 +463,7 @@ function processWar($general, $city) {
if($nation['type'] == 3 || $nation['type'] == 13) { $num *= 1.1; } if($nation['type'] == 3 || $nation['type'] == 13) { $num *= 1.1; }
if($nation['type'] == 5 || $nation['type'] == 6 || $nation['type'] == 7 || $nation['type'] == 8 || $nation['type'] == 12) { $num *= 0.9; } if($nation['type'] == 5 || $nation['type'] == 6 || $nation['type'] == 7 || $nation['type'] == 8 || $nation['type'] == 12) { $num *= 0.9; }
// 부드러운 기술 제한 // 부드러운 기술 제한
if(TechLimit($game_env['startyear'], $year, $nation['tech'])) { $num = intdiv($num, 4); } if(TechLimit($admin['startyear'], $year, $nation['tech'])) { $num = intdiv($num, 4); }
$query = "update nation set totaltech=totaltech+'$num',tech=totaltech/'$gencount' where nation='{$nation['nation']}'"; $query = "update nation set totaltech=totaltech+'$num',tech=totaltech/'$gencount' where nation='{$nation['nation']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
// 죽은수 기술로 누적 // 죽은수 기술로 누적
@@ -476,7 +476,7 @@ function processWar($general, $city) {
$num *= 0.9; $num *= 0.9;
} }
// 부드러운 기술 제한 // 부드러운 기술 제한
if(TechLimit($game_env['startyear'], $year, $destnation['tech'])) { $num = intdiv($num, 4); } if(TechLimit($admin['startyear'], $year, $destnation['tech'])) { $num = intdiv($num, 4); }
$query = "update nation set totaltech=totaltech+'$num',tech=totaltech/'$destgencount' where nation='{$destnation['nation']}'"; $query = "update nation set totaltech=totaltech+'$num',tech=totaltech/'$destgencount' where nation='{$destnation['nation']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
//양국 평균 기술가격 //양국 평균 기술가격
@@ -516,7 +516,7 @@ function processWar($general, $city) {
$alllog = []; $alllog = [];
$history = []; $history = [];
ConquerCity($game_env, $general, $city, $nation, $destnation); ConquerCity($admin, $general, $city, $nation, $destnation);
break; break;
// 공격 장수 병사 소진시 실패 처리 // 공격 장수 병사 소진시 실패 처리
} elseif($general['crew'] <= 0) { } elseif($general['crew'] <= 0) {
@@ -1338,7 +1338,7 @@ function processWar($general, $city) {
if($nation['type'] == 3 || $nation['type'] == 13) { $num *= 1.1; } if($nation['type'] == 3 || $nation['type'] == 13) { $num *= 1.1; }
if($nation['type'] == 5 || $nation['type'] == 6 || $nation['type'] == 7 || $nation['type'] == 8 || $nation['type'] == 12) { $num *= 0.9; } if($nation['type'] == 5 || $nation['type'] == 6 || $nation['type'] == 7 || $nation['type'] == 8 || $nation['type'] == 12) { $num *= 0.9; }
// 부드러운 기술 제한 // 부드러운 기술 제한
if(TechLimit($game_env['startyear'], $year, $nation['tech'])) { $num = intdiv($num, 4); } if(TechLimit($admin['startyear'], $year, $nation['tech'])) { $num = intdiv($num, 4); }
$query = "update nation set totaltech=totaltech+'$num',tech=totaltech/'$gencount' where nation='{$nation['nation']}'"; $query = "update nation set totaltech=totaltech+'$num',tech=totaltech/'$gencount' where nation='{$nation['nation']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
@@ -1361,7 +1361,7 @@ function processWar($general, $city) {
if($destnation['type'] == 3 || $destnation['type'] == 13) { $num *= 1.1; } if($destnation['type'] == 3 || $destnation['type'] == 13) { $num *= 1.1; }
if($destnation['type'] == 5 || $destnation['type'] == 6 || $destnation['type'] == 7 || $destnation['type'] == 8 || $destnation['type'] == 12) { $num *= 0.9; } if($destnation['type'] == 5 || $destnation['type'] == 6 || $destnation['type'] == 7 || $destnation['type'] == 8 || $destnation['type'] == 12) { $num *= 0.9; }
// 부드러운 기술 제한 // 부드러운 기술 제한
if(TechLimit($game_env['startyear'], $year, $destnation['tech'])) { $num = intdiv($num, 4); } if(TechLimit($admin['startyear'], $year, $destnation['tech'])) { $num = intdiv($num, 4); }
$query = "update nation set totaltech=totaltech+'$num',tech=totaltech/'$destgencount' where nation='{$destnation['nation']}'"; $query = "update nation set totaltech=totaltech+'$num',tech=totaltech/'$destgencount' where nation='{$destnation['nation']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
//양국 평균 기술가격 //양국 평균 기술가격
@@ -1626,9 +1626,9 @@ function getCityDef($city) {
return $def; return $def;
} }
function getRate($game_env, $type, $dtype) { function getRate($admin, $type, $dtype) {
$t = "{$dtype}{$type}"; $t = "{$dtype}{$type}";
return $game_env[$t]; return $admin[$t];
} }
function addConflict($city, $nationID, $mykillnum) { function addConflict($city, $nationID, $mykillnum) {
@@ -1697,7 +1697,7 @@ function getConquerNation($city) : int {
return Util::array_first_key($conflict); return Util::array_first_key($conflict);
} }
function ConquerCity($game_env, $general, $city, $nation, $destnation) { function ConquerCity($admin, $general, $city, $nation, $destnation) {
'@phan-var array<string,mixed> $city'; '@phan-var array<string,mixed> $city';
$db = DB::db(); $db = DB::db();
$connect=$db->get(); $connect=$db->get();
@@ -1712,8 +1712,8 @@ function ConquerCity($game_env, $general, $city, $nation, $destnation) {
$destnationName = "공백지인"; $destnationName = "공백지인";
} }
$year = $game_env['year']; $year = $admin['year'];
$month = $game_env['month']; $month = $admin['month'];
$alllog[] = "<C>●</>{$month}월:<Y>{$general['name']}</>(이)가 <G><b>{$city['name']}</b></> 공략에 <S>성공</>했습니다."; $alllog[] = "<C>●</>{$month}월:<Y>{$general['name']}</>(이)가 <G><b>{$city['name']}</b></> 공략에 <S>성공</>했습니다.";
$log[] = "<C>●</><G><b>{$city['name']}</b></> 공략에 <S>성공</>했습니다."; $log[] = "<C>●</><G><b>{$city['name']}</b></> 공략에 <S>성공</>했습니다.";