정적 분석 결과 반영.
This commit is contained in:
+7
-3
@@ -5,6 +5,13 @@ include "lib.php";
|
||||
include "func.php";
|
||||
// $btn, $msg, $scoutmsg, $rate, $bill, $secretlimit
|
||||
|
||||
$btn = Util::getReq('btn');
|
||||
$msg = Util::getReq('msg');
|
||||
$scoutmsg = Util::getReq('scoutmsg');
|
||||
$rate = Util::getReq('rate', 'int');
|
||||
$bill = Util::getReq('bill', 'int');
|
||||
$secretlimit = Util::getReq('secretlimit', 'int');
|
||||
|
||||
//로그인 검사
|
||||
$session = Session::requireGameLogin()->setReadOnly();
|
||||
$userID = Session::getUserID();
|
||||
@@ -34,19 +41,16 @@ if($btn == "국가방침") {
|
||||
$query = "update nation set scoutmsg='$scoutmsg' where nation='{$me['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
} elseif($btn == "세율") {
|
||||
$rate = (int)$rate;
|
||||
if($rate < 5) { $rate = 5; }
|
||||
if($rate > 30) { $rate = 30; }
|
||||
$query = "update nation set rate='$rate' where nation='{$me['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
} elseif($btn == "지급율") {
|
||||
$bill = (int)$bill;
|
||||
if($bill < 20) { $bill = 20; }
|
||||
if($bill > 200) { $bill = 200; }
|
||||
$query = "update nation set bill='$bill' where nation='{$me['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
} elseif($btn == "기밀권한") {
|
||||
$secretlimit = (int)$secretlimit;
|
||||
if($secretlimit < 1) { $secretlimit = 1; }
|
||||
if($secretlimit > 99) { $secretlimit = 99; }
|
||||
$query = "update nation set secretlimit='$secretlimit' where nation='{$me['nation']}'";
|
||||
|
||||
+24
-11
@@ -4,6 +4,23 @@ namespace sammo;
|
||||
include "lib.php";
|
||||
include "func.php";
|
||||
// $turn, $command, $cost, $name, $nationname, $note, $double, $third, $fourth
|
||||
$turn = Util::getReq('turn', 'array_int');
|
||||
$command = Util::getReq('command', 'int', 0);
|
||||
$cost = Util::getReq('cost', 'int');
|
||||
$name = Util::getReq('name');
|
||||
$nationname = Util::getReq('nationname', 'string', '');
|
||||
$note = Util::getReq('note', 'string', '');
|
||||
$double = Util::getReq('double', 'int', 0);
|
||||
$third = Util::getReq('third', 'int', 0);
|
||||
$fourth = Util::getReq('fourth', 'int', 0);
|
||||
|
||||
if(!$turn){
|
||||
$turn = [0];
|
||||
}
|
||||
|
||||
'@phan-var int $double';
|
||||
'@phan-var int $third';
|
||||
'@phan-var int $fourth';
|
||||
|
||||
//로그인 검사
|
||||
$session = Session::requireGameLogin()->setReadOnly();
|
||||
@@ -39,12 +56,11 @@ if($command == 46) {
|
||||
'makenation'=>$name
|
||||
], 'owner=%i', $userID);
|
||||
|
||||
$count = count($turn);
|
||||
$query = ['con'=>$db->sqleval('con')];
|
||||
$query = [];
|
||||
foreach($turn as $turnIdx){
|
||||
$query['turn'.$turnIdx] = $comStr;
|
||||
}
|
||||
$db->upate('general', $query, 'owner=%i', $userID);
|
||||
$db->update('general', $query, 'owner=%i', $userID);
|
||||
header('Location:index.php');
|
||||
//통합제의
|
||||
} elseif($command == 53) {
|
||||
@@ -122,15 +138,12 @@ if($command == 46) {
|
||||
//echo "<script>location.replace('b_chiefcenter.php');</script>";
|
||||
echo 'b_chiefcenter.php';//TODO:debug all and replace
|
||||
} else {
|
||||
$count = count($turn);
|
||||
$str = "con=con";
|
||||
for($i=0; $i < $count; $i++) {
|
||||
$str .= ",turn{$turn[$i]}='{$comStr}'";
|
||||
$query = [];
|
||||
foreach($turn as $turnIdx){
|
||||
$query['turn'.$turnIdx] = $comStr;
|
||||
}
|
||||
$query = "update general set {$str} where owner='{$userID}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
//echo "<script>location.replace('index.php');</script>";
|
||||
echo 'index.php';//TODO:debug all and replace
|
||||
$db->update('general', $query, 'owner=%i', $userID);
|
||||
header('Location:index.php');
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -4,10 +4,13 @@ namespace sammo;
|
||||
include "lib.php";
|
||||
include "func.php";
|
||||
// $btn, $msg
|
||||
|
||||
$gen = Util::getReq('gen', 'int');
|
||||
$sel = Util::getReq('sel', 'int');
|
||||
|
||||
//관리자용
|
||||
$auto = Util::getReq('gen', 'int');
|
||||
$type = Util::getReq('type', 'int');
|
||||
|
||||
//로그인 검사
|
||||
$session = Session::requireGameLogin()->setReadOnly();
|
||||
$userID = Session::getUserID();
|
||||
|
||||
+5
-2
@@ -4,14 +4,17 @@ namespace sammo;
|
||||
include "lib.php";
|
||||
include "func.php";
|
||||
// $btn, $name, $troop
|
||||
$btn = Util::getReq('btn');
|
||||
$name = Util::getReq('name');
|
||||
$troop = Util::getReq('troop', 'int');
|
||||
|
||||
//로그인 검사
|
||||
$session = Session::requireGameLogin()->setReadOnly();
|
||||
$generalID = $session->$generalID;
|
||||
$userID = $session::getUserID();
|
||||
|
||||
$db = DB::db();
|
||||
|
||||
$me = $db->queryFirstRow('select no,nation,troop from general where no=%i', $generalID);
|
||||
$me = $db->queryFirstRow('SELECT `no`, nation, troop FROM general WHERE `owner`=%i', $userID);
|
||||
|
||||
$name = trim($name);
|
||||
$name = addslashes(SQ2DQ($name));
|
||||
|
||||
+5
-1
@@ -4,7 +4,11 @@ namespace sammo;
|
||||
include "lib.php";
|
||||
include "func.php";
|
||||
|
||||
$btn = Util::getReq('btn');
|
||||
$sel = Util::getReq('sel', 'int');
|
||||
$comment = Util::getReq('comment');
|
||||
$title = Util::getReq('title');
|
||||
$str = Util::getReq('str');
|
||||
|
||||
//로그인 검사
|
||||
$session = Session::requireGameLogin()->setReadOnly();
|
||||
@@ -38,7 +42,7 @@ else if($btn == "댓글" && $comment != "") {
|
||||
|
||||
$nation = getNationStaticInfo($me['nation']);
|
||||
if($nation == null) {
|
||||
$nation['name'] = "재야";
|
||||
$nation = ['name' => "재야"];
|
||||
}
|
||||
|
||||
if($admin['votecomment'] != "") { $admin['votecomment'] .= "|"; }
|
||||
|
||||
@@ -3,6 +3,11 @@ namespace sammo;
|
||||
|
||||
include "lib.php";
|
||||
include "func.php";
|
||||
|
||||
$ok = Util::getReq('ok');
|
||||
$when = Util::getReq('when', 'int');
|
||||
$gen = Util::getReq('gen', 'int'); //XXX: -_-;;;;;;;;;;;;
|
||||
|
||||
//로그인 검사
|
||||
$session = Session::requireGameLogin()->setReadOnly();
|
||||
$userID = Session::getUserID();
|
||||
|
||||
@@ -3,6 +3,10 @@ namespace sammo;
|
||||
|
||||
include "lib.php";
|
||||
include "func.php";
|
||||
|
||||
$ok = Util::getReq('ok');
|
||||
$gen = Util::getReq('gen', 'int'); //XXX: -_-;;;;;;;;;;;;
|
||||
|
||||
//로그인 검사
|
||||
$session = Session::requireGameLogin()->setReadOnly();
|
||||
$userID = Session::getUserID();
|
||||
|
||||
@@ -3,6 +3,10 @@ namespace sammo;
|
||||
|
||||
include "lib.php";
|
||||
include "func.php";
|
||||
|
||||
$ok = Util::getReq('ok');
|
||||
$gen = Util::getReq('gen', 'int'); //XXX: -_-;;;;;;;;;;;;
|
||||
|
||||
//로그인 검사
|
||||
$session = Session::requireGameLogin()->setReadOnly();
|
||||
$userID = Session::getUserID();
|
||||
|
||||
@@ -3,6 +3,10 @@ namespace sammo;
|
||||
|
||||
include "lib.php";
|
||||
include "func.php";
|
||||
|
||||
$ok = Util::getReq('ok');
|
||||
$gen = Util::getReq('gen', 'int'); //XXX: -_-;;;;;;;;;;;;
|
||||
|
||||
//로그인 검사
|
||||
$session = Session::requireGameLogin()->setReadOnly();
|
||||
$userID = Session::getUserID();
|
||||
|
||||
+1
-1
@@ -168,7 +168,7 @@ if($ok == "수락" && $me['level'] < 12 && $nation['level'] > 0 && $nation['scou
|
||||
pushGenLog($me, $mylog);
|
||||
pushGenLog($you, $youlog);
|
||||
pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']);
|
||||
pushWorldHistory($history, $admin['year'], $admin['month']);
|
||||
//pushWorldHistory($history, $admin['year'], $admin['month']);
|
||||
|
||||
echo "<script>location.replace('msglist.php');</script>";
|
||||
|
||||
|
||||
@@ -3,6 +3,10 @@ namespace sammo;
|
||||
|
||||
include "lib.php";
|
||||
include "func.php";
|
||||
|
||||
$ok = Util::getReq('ok');
|
||||
$gen = Util::getReq('gen', 'int'); //XXX: -_-;;;;;;;;;;;;
|
||||
|
||||
//로그인 검사
|
||||
$session = Session::requireGameLogin()->setReadOnly();
|
||||
$userID = Session::getUserID();
|
||||
@@ -65,6 +69,8 @@ for($i=0; $i < $warcount; $i++) {
|
||||
}
|
||||
}
|
||||
|
||||
$mylog = [];
|
||||
|
||||
if($ok == "수락") {
|
||||
// 서신 보낸 후 멸망 했을때.
|
||||
if($me['level'] < 5) {
|
||||
|
||||
@@ -1735,7 +1735,10 @@ function process_31(&$general) {
|
||||
$query = "select spy from nation where nation='{$general['nation']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$nation = MYDB_fetch_array($result);
|
||||
if($nation['spy'] != "") { $cities = explode("|", $nation['spy']); }
|
||||
if($nation['spy'] != "")
|
||||
{
|
||||
$cities = array_map('intval', explode("|", $nation['spy']));
|
||||
}
|
||||
$exist = 0;
|
||||
for($i=0; $i < count($cities); $i++) {
|
||||
if(intdiv($cities[$i], 10) == $destination) {
|
||||
|
||||
@@ -940,12 +940,12 @@ function fight($tnmt_type, $tnmt, $phs, $group, $g1, $g2, $type) {
|
||||
$damage1 = Util::round($damage1); $damage2 = Util::round($damage2);
|
||||
|
||||
$log[] = '<S>●</> '
|
||||
.StringUtil::padStringAlignRight($phase, 2, "0").'合 : '
|
||||
.'<C>'.StringUtil::padStringAlignRight($energy1, 3, "0").'</>'
|
||||
.'<span class="ev_highlight">(-'.StringUtil::padStringAlignRight($damage1, 3, "0").')</span>'
|
||||
.StringUtil::padStringAlignRight((string)$phase, 2, "0").'合 : '
|
||||
.'<C>'.StringUtil::padStringAlignRight((string)$energy1, 3, "0").'</>'
|
||||
.'<span class="ev_highlight">(-'.StringUtil::padStringAlignRight((string)$damage1, 3, "0").')</span>'
|
||||
.' vs '
|
||||
.'<span class="ev_highlight">(-'.StringUtil::padStringAlignRight($damage2, 3, "0").')</span>'
|
||||
.'<C>'.StringUtil::padStringAlignRight($energy2, 3, "0").'</>';
|
||||
.'<span class="ev_highlight">(-'.StringUtil::padStringAlignRight((string)$damage2, 3, "0").')</span>'
|
||||
.'<C>'.StringUtil::padStringAlignRight((string)$energy2, 3, "0").'</>';
|
||||
|
||||
if($energy1 <= 0 && $energy2 <= 0) {
|
||||
if($type == 0) { $sel = 2; break; }
|
||||
|
||||
@@ -16,7 +16,7 @@ if(!$generalInfo){
|
||||
Json::die($result);
|
||||
}
|
||||
|
||||
$result['generalID'] = $generalID;
|
||||
$result['generalID'] = $generalInfo['no'];
|
||||
$result['myNationID'] = $generalInfo['nation'];
|
||||
$result['isChief'] = ($generalInfo['level'] == 12);
|
||||
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
<?php
|
||||
namespace sammo;
|
||||
|
||||
|
||||
require(__DIR__.'/../f_func/config.php');
|
||||
|
||||
$session = Session::requireLogin(null);
|
||||
|
||||
if($session->userGrade < 5){
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>'충분한 권한을 가지고 있지 않습니다.'
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
if($scenarioIdx === null){
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>'올바르지 않은 scenarioIdx'
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ if (!$result) {
|
||||
]);
|
||||
}
|
||||
|
||||
'@phan-var-force mixed[] $result';
|
||||
'@phan-var-force mixed[] $messageInfo';
|
||||
|
||||
$msgType = $messageInfo['type'];
|
||||
|
||||
|
||||
+7
-7
@@ -28,6 +28,8 @@ if(!isset($post['genlist']) || !isset($post['msg'])){
|
||||
}
|
||||
|
||||
|
||||
'@phan-var mixed[] $post';
|
||||
|
||||
$destMailbox = $post['dest_mailbox'];
|
||||
$msg = $post['msg'];
|
||||
$datetime = new \DateTime();
|
||||
@@ -68,9 +70,7 @@ if($con >= 2) {
|
||||
]);
|
||||
}
|
||||
|
||||
//SubStrForWidth는 반각은 1, 전각은 2로 측정하는듯 보이나, 대부분 글자수 단위로 카운트 하고 있어 mb_substr로 처리함.
|
||||
$msg = mb_substr($msg, 0, 99, 'UTF-8');
|
||||
$msg = trim($msg);
|
||||
$msg = StringUtil::cutStringForWidth($msg, 100, '');
|
||||
|
||||
if($msg == ''){
|
||||
Json::die([
|
||||
@@ -89,7 +89,7 @@ $src = [
|
||||
|
||||
// 전체 메세지
|
||||
if($destMailbox == 9999) {
|
||||
sendMessage('public', $src, null, $msg, $date);
|
||||
sendMessage('public', $src, [], $msg, $date);
|
||||
// 국가 메세지
|
||||
} elseif($destMailbox >= 9000) {
|
||||
|
||||
@@ -97,7 +97,7 @@ if($destMailbox == 9999) {
|
||||
$real_nation = $me['nation_id'];
|
||||
}
|
||||
else{
|
||||
$real_nation = $dest - 9000;
|
||||
$real_nation = $destMailbox - 9000;
|
||||
}
|
||||
|
||||
if(!getNationStaticInfo($real_nation)){
|
||||
@@ -138,8 +138,8 @@ if($destMailbox == 9999) {
|
||||
|
||||
$dest = [
|
||||
'id' => $destMailbox,
|
||||
'name' => $dest_user['name'],
|
||||
'nation_id' => $dest_user['nation']
|
||||
'name' => $destUser['name'],
|
||||
'nation_id' => $destUser['nation']
|
||||
];
|
||||
|
||||
sendMessage('private', $src, $dest, $msg, $date);
|
||||
|
||||
+5
-146
@@ -34,148 +34,7 @@ $connect=$db->get();
|
||||
<link href="../d_shared/common.css" red="stylesheet">
|
||||
<link rel='stylesheet' href="css/common.css">
|
||||
<script type="text/javascript" src="../e_lib/jquery-3.2.1.min.js"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
jQuery(function($){
|
||||
|
||||
var totalAbil = 150;
|
||||
var $leader = $('#leader');
|
||||
var $power = $('#power');
|
||||
var $intel = $('#intel');
|
||||
|
||||
function abilityRand(){
|
||||
var leader = Math.random()*65 + 10;
|
||||
var power = Math.random()*65 + 10;
|
||||
var intel = Math.random()*65 + 10;
|
||||
var rate = leader + power + intel;
|
||||
|
||||
leader = Math.floor(leader / rate * totalAbil);
|
||||
power = Math.floor(power / rate * totalAbil);
|
||||
intel = Math.floor(intel / rate * totalAbil);
|
||||
|
||||
|
||||
while(leader+power+intel < totalAbil){
|
||||
leader+=1;
|
||||
}
|
||||
|
||||
if(leader > 75 || power > 75 || intel > 75 || leader < 10 || power < 10 || intel < 10){
|
||||
return abilityRand();
|
||||
}
|
||||
|
||||
$leader.val(leader);
|
||||
$power.val(power);
|
||||
$intel.val(intel);
|
||||
}
|
||||
|
||||
|
||||
function abilityLeadpow(){
|
||||
var leader = Math.random() * 6;
|
||||
var power = Math.random() * 6;
|
||||
var intel = Math.random() * 1;
|
||||
var rate = leader + power + intel;
|
||||
|
||||
leader = Math.floor(leader / rate * totalAbil);
|
||||
power = Math.floor(power / rate * totalAbil);
|
||||
intel = Math.floor(intel / rate * totalAbil);
|
||||
|
||||
while(leader+power+intel < totalAbil){
|
||||
power+=1;
|
||||
}
|
||||
|
||||
if(intel < 10){
|
||||
leader -= 10 - intel;
|
||||
intel = 10;
|
||||
}
|
||||
|
||||
if(leader > 75){
|
||||
power += leader - 75;
|
||||
leader = 75;
|
||||
}
|
||||
|
||||
if(power > 75){
|
||||
leader += power - 75;
|
||||
power = 75;
|
||||
}
|
||||
|
||||
$leader.val(leader);
|
||||
$power.val(power);
|
||||
$intel.val(intel);
|
||||
}
|
||||
|
||||
function abilityLeadint(){
|
||||
var leader = Math.random() * 6;
|
||||
var power = Math.random() * 1;
|
||||
var intel = Math.random() * 6;
|
||||
var rate = leader + power + intel;
|
||||
|
||||
leader = Math.floor(leader / rate * totalAbil);
|
||||
power = Math.floor(power / rate * totalAbil);
|
||||
intel = Math.floor(intel / rate * totalAbil);
|
||||
|
||||
while(leader+power+intel < totalAbil){
|
||||
intel+=1;
|
||||
}
|
||||
|
||||
if(power < 10){
|
||||
leader -= 10 - power;
|
||||
power = 10;
|
||||
}
|
||||
|
||||
if(leader > 75){
|
||||
intel += leader - 75;
|
||||
leader = 75;
|
||||
}
|
||||
|
||||
if(intel > 75){
|
||||
leader += intel - 75;
|
||||
intel = 75;
|
||||
}
|
||||
|
||||
$leader.val(leader);
|
||||
$power.val(power);
|
||||
$intel.val(intel);
|
||||
}
|
||||
|
||||
function abilityPowint(){
|
||||
var leader = Math.random() * 1;
|
||||
var power = Math.random() * 6;
|
||||
var intel = Math.random() * 6;
|
||||
var rate = leader + power + intel;
|
||||
|
||||
leader = Math.floor(leader / rate * totalAbil);
|
||||
power = Math.floor(power / rate * totalAbil);
|
||||
intel = Math.floor(intel / rate * totalAbil);
|
||||
|
||||
while(leader+power+intel < totalAbil){
|
||||
intel+=1;
|
||||
}
|
||||
|
||||
if(leader < 10){
|
||||
power -= 10 - leader;
|
||||
leader = 10;
|
||||
}
|
||||
|
||||
if(power > 75){
|
||||
intel += power - 75;
|
||||
power = 75;
|
||||
}
|
||||
|
||||
if(intel > 75){
|
||||
power += intel - 75;
|
||||
intel = 75;
|
||||
}
|
||||
|
||||
$leader.val(leader);
|
||||
$power.val(power);
|
||||
$intel.val(intel);
|
||||
}
|
||||
|
||||
window.abilityRand = abilityRand;
|
||||
window.abilityLeadpow = abilityLeadpow;
|
||||
window.abilityLeadint = abilityLeadint;
|
||||
window.abilityPowint = abilityPowint;
|
||||
});
|
||||
</script>
|
||||
<script type="text/javascript" src="js/join.js"></script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
@@ -239,7 +98,7 @@ if ($admin['show_img_level'] >= 1 && $member['grade'] >= 1 && $member['picture']
|
||||
<tr>
|
||||
<td align=right id=bg1>전콘 사용 여부</td>
|
||||
<td width=64 height=64>
|
||||
<img src={$imageTemp}/{$member['picture']} border=0>
|
||||
<img src='{$imageTemp}/{$member['picture']}' border=0>
|
||||
</td>
|
||||
<td>
|
||||
<input type=checkbox name=pic value=1 checked>사용
|
||||
@@ -276,15 +135,15 @@ if ($admin['show_img_level'] >= 1 && $member['grade'] >= 1 && $member['picture']
|
||||
</tr>
|
||||
<tr>
|
||||
<td width=498 align=right id=bg1>통솔</td>
|
||||
<td colspan=2><input type="text" name="leader" id="leader" value="<?=$abil['leader']?>"></td>
|
||||
<td colspan=2><input type="number" name="leader" id="leader" value="50"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width=498 align=right id=bg1>무력</td>
|
||||
<td colspan=2><input type="text" name="power" id="power" value="<?=$abil['power']?>"></td>
|
||||
<td colspan=2><input type="number" name="power" id="power" value="50"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width=498 align=right id=bg1>지력</td>
|
||||
<td colspan=2><input type="text" name="intel" id="intel" value="<?=$abil['intel']?>"></td>
|
||||
<td colspan=2><input type="number" name="intel" id="intel" value="50"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width=498 align=right id=bg1>능력치 조정</td>
|
||||
|
||||
+140
@@ -0,0 +1,140 @@
|
||||
|
||||
jQuery(function($){
|
||||
|
||||
var totalAbil = 150;
|
||||
var $leader = $('#leader');
|
||||
var $power = $('#power');
|
||||
var $intel = $('#intel');
|
||||
|
||||
function abilityRand(){
|
||||
var leader = Math.random()*65 + 10;
|
||||
var power = Math.random()*65 + 10;
|
||||
var intel = Math.random()*65 + 10;
|
||||
var rate = leader + power + intel;
|
||||
|
||||
leader = Math.floor(leader / rate * totalAbil);
|
||||
power = Math.floor(power / rate * totalAbil);
|
||||
intel = Math.floor(intel / rate * totalAbil);
|
||||
|
||||
|
||||
while(leader+power+intel < totalAbil){
|
||||
leader+=1;
|
||||
}
|
||||
|
||||
if(leader > 75 || power > 75 || intel > 75 || leader < 10 || power < 10 || intel < 10){
|
||||
return abilityRand();
|
||||
}
|
||||
|
||||
$leader.val(leader);
|
||||
$power.val(power);
|
||||
$intel.val(intel);
|
||||
}
|
||||
|
||||
|
||||
function abilityLeadpow(){
|
||||
var leader = Math.random() * 6;
|
||||
var power = Math.random() * 6;
|
||||
var intel = Math.random() * 1;
|
||||
var rate = leader + power + intel;
|
||||
|
||||
leader = Math.floor(leader / rate * totalAbil);
|
||||
power = Math.floor(power / rate * totalAbil);
|
||||
intel = Math.floor(intel / rate * totalAbil);
|
||||
|
||||
while(leader+power+intel < totalAbil){
|
||||
power+=1;
|
||||
}
|
||||
|
||||
if(intel < 10){
|
||||
leader -= 10 - intel;
|
||||
intel = 10;
|
||||
}
|
||||
|
||||
if(leader > 75){
|
||||
power += leader - 75;
|
||||
leader = 75;
|
||||
}
|
||||
|
||||
if(power > 75){
|
||||
leader += power - 75;
|
||||
power = 75;
|
||||
}
|
||||
|
||||
$leader.val(leader);
|
||||
$power.val(power);
|
||||
$intel.val(intel);
|
||||
}
|
||||
|
||||
function abilityLeadint(){
|
||||
var leader = Math.random() * 6;
|
||||
var power = Math.random() * 1;
|
||||
var intel = Math.random() * 6;
|
||||
var rate = leader + power + intel;
|
||||
|
||||
leader = Math.floor(leader / rate * totalAbil);
|
||||
power = Math.floor(power / rate * totalAbil);
|
||||
intel = Math.floor(intel / rate * totalAbil);
|
||||
|
||||
while(leader+power+intel < totalAbil){
|
||||
intel+=1;
|
||||
}
|
||||
|
||||
if(power < 10){
|
||||
leader -= 10 - power;
|
||||
power = 10;
|
||||
}
|
||||
|
||||
if(leader > 75){
|
||||
intel += leader - 75;
|
||||
leader = 75;
|
||||
}
|
||||
|
||||
if(intel > 75){
|
||||
leader += intel - 75;
|
||||
intel = 75;
|
||||
}
|
||||
|
||||
$leader.val(leader);
|
||||
$power.val(power);
|
||||
$intel.val(intel);
|
||||
}
|
||||
|
||||
function abilityPowint(){
|
||||
var leader = Math.random() * 1;
|
||||
var power = Math.random() * 6;
|
||||
var intel = Math.random() * 6;
|
||||
var rate = leader + power + intel;
|
||||
|
||||
leader = Math.floor(leader / rate * totalAbil);
|
||||
power = Math.floor(power / rate * totalAbil);
|
||||
intel = Math.floor(intel / rate * totalAbil);
|
||||
|
||||
while(leader+power+intel < totalAbil){
|
||||
intel+=1;
|
||||
}
|
||||
|
||||
if(leader < 10){
|
||||
power -= 10 - leader;
|
||||
leader = 10;
|
||||
}
|
||||
|
||||
if(power > 75){
|
||||
intel += power - 75;
|
||||
power = 75;
|
||||
}
|
||||
|
||||
if(intel > 75){
|
||||
power += intel - 75;
|
||||
intel = 75;
|
||||
}
|
||||
|
||||
$leader.val(leader);
|
||||
$power.val(power);
|
||||
$intel.val(intel);
|
||||
}
|
||||
|
||||
window.abilityRand = abilityRand;
|
||||
window.abilityLeadpow = abilityLeadpow;
|
||||
window.abilityLeadint = abilityLeadint;
|
||||
window.abilityPowint = abilityPowint;
|
||||
});
|
||||
+71
-57
@@ -787,7 +787,6 @@ function command_22($turn, $command) {
|
||||
$connect=$db->get();
|
||||
$userID = Session::getUserID();
|
||||
|
||||
die('비활성화됨');//TODO:등용장 대 디자인
|
||||
starter("등용");
|
||||
|
||||
$query = "select nation from general where owner='{$userID}'";
|
||||
@@ -1563,38 +1562,47 @@ function command_46($turn, $command) {
|
||||
|
||||
starter("건국");
|
||||
|
||||
$query = "select maxnation from game limit 1";
|
||||
$result = MYDB_query($query, $connect) or Error("command_46 ".MYDB_error($connect),"");
|
||||
$admin = MYDB_fetch_array($result);
|
||||
$maxnation = $db->queryFirstField('SELECT maxnation FROM game LIMIT 1');
|
||||
|
||||
$color = GetNationColors();
|
||||
$colorUsed = [];
|
||||
|
||||
foreach(GetNationColors() as $color){
|
||||
$colorUsed[$color] = 0;
|
||||
}
|
||||
|
||||
$nationCount = count(getAllNationStaticInfo());
|
||||
foreach(getAllNationStaticInfo() as $nation){
|
||||
if($nation['level'] <= 0){
|
||||
continue;
|
||||
}
|
||||
$nationcolor[$i] = $nation['color'];
|
||||
}
|
||||
$validCount = count($color);
|
||||
//등록된 색깔 가려내기
|
||||
for($i=0; $i < count($color); $i++) {
|
||||
$valid[$i] = 1;
|
||||
for($j=0; $j < $nationcount; $j++) {
|
||||
if($color[$i] == $nationcolor[$j]) {
|
||||
$valid[$i] = 0;
|
||||
$validCount--;
|
||||
}
|
||||
|
||||
if(isset($nationcolor[$nation['color']])){
|
||||
$nationcolor[$nation['color']] = 1;
|
||||
}
|
||||
else{
|
||||
$nationcolor[$nation['color']]++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$colorUsedCnt = 0;
|
||||
foreach($colorUsed as $color=>$used){
|
||||
if($used){
|
||||
continue;
|
||||
}
|
||||
$colorUsedCnt += 1;
|
||||
}
|
||||
|
||||
//색깔이 다 쓰였으면 그냥 모두 허용
|
||||
if($validCount <= 0) {
|
||||
for($i=0; $i < count($color); $i++) {
|
||||
$valid[$i] = 1;
|
||||
if($colorUsedCnt === count($colorUsed)){
|
||||
foreach(array_keys($colorUsed) as $color){
|
||||
$colorUsed[$color] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if($nationcount < $admin['maxnation']) {
|
||||
echo "
|
||||
|
||||
if($nationCount < $maxnation) {
|
||||
?>
|
||||
현재 도시에서 나라를 세웁니다. 중, 소도시에서만 가능합니다.<br>
|
||||
|
||||
- 법 가 : <font color=cyan>금수입↑ 치안↑</font> <font color=magenta>인구↓ 민심↓</font><br>
|
||||
@@ -1613,15 +1621,16 @@ function command_46($turn, $command) {
|
||||
|
||||
<form name=form1 action=c_double.php method=post>
|
||||
국명 : <input type=text name=name size=12 maxlength=6 style=text-align:right;color:white;background-color:black>
|
||||
색깔 : <select name=double size=1>";
|
||||
for($i=0; $i < count($color); $i++) {
|
||||
if($valid[$i]) {
|
||||
echo "
|
||||
<option value={$i} style=background-color:{$color[$i]};color:".newColor($color[$i]).";>국가명</option>";
|
||||
}
|
||||
색깔 : <select name=double size=1>
|
||||
<?php
|
||||
foreach(GetNationColors() as $idx=>$color) {
|
||||
if($colorUsed[$color] > 0){
|
||||
continue;
|
||||
}
|
||||
echo "<option value={$idx} style=background-color:{$color};color:".newColor($color).";>국가명</option>";
|
||||
}
|
||||
|
||||
echo "
|
||||
?>
|
||||
</select>
|
||||
성향 : <select name=third size=1>
|
||||
<option value=1 style=background-color:black;color:white;>".getNationType(1)."</option>
|
||||
@@ -1639,17 +1648,15 @@ function command_46($turn, $command) {
|
||||
<option value=13 style=background-color:black;color:white;>".getNationType(13)."</option>
|
||||
</select>
|
||||
<input type=submit value=건국>
|
||||
<input type=hidden name=command value=$command>";
|
||||
<input type=hidden name=command value=$command>
|
||||
<?php
|
||||
for($i=0; $i < count($turn); $i++) {
|
||||
echo "
|
||||
<input type=hidden name=turn[] value=$turn[$i]>";
|
||||
echo "<input type=hidden name=turn[] value=$turn[$i]>";
|
||||
}
|
||||
|
||||
echo "
|
||||
</form>";
|
||||
echo "</form>";
|
||||
} else {
|
||||
echo "
|
||||
더 이상 건국은 불가능합니다.<br>";
|
||||
echo "더 이상 건국은 불가능합니다.<br>";
|
||||
}
|
||||
ender();
|
||||
}
|
||||
@@ -2761,30 +2768,37 @@ function command_81($turn, $command) {
|
||||
|
||||
starter("국기변경", 1);
|
||||
|
||||
$color = GetNationColors();
|
||||
$colorUsed = [];
|
||||
|
||||
foreach(GetNationColors() as $color){
|
||||
$colorUsed[$color] = 0;
|
||||
}
|
||||
|
||||
foreach(getAllNationStaticInfo() as $nation){
|
||||
foreach(getAllNationStaticInfo() as $nation){
|
||||
if($nation['level'] <= 0){
|
||||
continue;
|
||||
}
|
||||
|
||||
$nationcolor[$i] = $nation['color'];
|
||||
}
|
||||
$validCount = count($color);
|
||||
//등록된 색깔 가려내기
|
||||
for($i=0; $i < count($color); $i++) {
|
||||
$valid[$i] = 1;
|
||||
for($j=0; $j < $nationcount; $j++) {
|
||||
if($color[$i] == $nationcolor[$j]) {
|
||||
$valid[$i] = 0;
|
||||
$validCount--;
|
||||
}
|
||||
if(isset($nationcolor[$nation['color']])){
|
||||
$nationcolor[$nation['color']] = 1;
|
||||
}
|
||||
else{
|
||||
$nationcolor[$nation['color']]++;
|
||||
}
|
||||
}
|
||||
|
||||
$colorUsedCnt = 0;
|
||||
foreach($colorUsed as $color=>$used){
|
||||
if($used){
|
||||
continue;
|
||||
}
|
||||
$colorUsedCnt += 1;
|
||||
}
|
||||
|
||||
//색깔이 다 쓰였으면 그냥 모두 허용
|
||||
if($validCount <= 0) {
|
||||
for($i=0; $i < count($color); $i++) {
|
||||
$valid[$i] = 1;
|
||||
if($colorUsedCnt === count($colorUsed)){
|
||||
foreach(array_keys($colorUsed) as $color){
|
||||
$colorUsed[$color] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2792,12 +2806,12 @@ function command_81($turn, $command) {
|
||||
국기를 변경합니다. 단 1회 가능합니다.<br>
|
||||
<form name=form1 action=c_double.php method=post>
|
||||
색깔 : <select name=double size=1>";
|
||||
for($i=0; $i < count($color); $i++) {
|
||||
if($valid[$i]) {
|
||||
echo "
|
||||
<option value={$i} style=background-color:{$color[$i]};color:".newColor($color[$i]).";>국가명</option>";
|
||||
}
|
||||
}
|
||||
foreach(GetNationColors() as $idx=>$color) {
|
||||
if($colorUsed[$color] > 0){
|
||||
continue;
|
||||
}
|
||||
echo "<option value={$idx} style=background-color:{$color};color:".newColor($color).";>국가명</option>";
|
||||
}
|
||||
echo "
|
||||
</select>
|
||||
<input type=submit value=국기변경>
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@ $userID = Session::getUserID();
|
||||
$rootDB = RootDB::db();
|
||||
|
||||
//회원 테이블에서 정보확인
|
||||
$member = $rootDB->queryFirstRow('select no,name,picture,grade from MEMBER where no=%i', $userID); MYDB_fetch_array($result);
|
||||
$member = $rootDB->queryFirstRow('select no,name,picture,grade from MEMBER where no=%i', $userID);
|
||||
|
||||
if(!$member) {
|
||||
MessageBox("잘못된 접근입니다!!!");
|
||||
|
||||
@@ -122,7 +122,7 @@ pushGeneralHistory($me, "<C>●</>{$year}년 {$month}월:<Y>{$npc['name']}</>의
|
||||
//pushGenLog($me, $mylog);
|
||||
pushGeneralPublicRecord(["<C>●</>{$month}월:<Y>{$npc['name']}</>의 육체에 <Y>{$session->userName}</>(이)가 <S>빙의</>됩니다!"], $year, $month);
|
||||
|
||||
pushAdminLog(["가입 : {$session->userName} // {$id} // ".getenv("REMOTE_ADDR")]);
|
||||
pushAdminLog(["가입 : {$userID} // {$session->userName} // {$npcID} // ".getenv("REMOTE_ADDR")]);
|
||||
|
||||
$rootDB->insert('member_log', [
|
||||
'member_no' => $userID,
|
||||
@@ -131,13 +131,13 @@ $rootDB->insert('member_log', [
|
||||
'action'=>Json::encode([
|
||||
'server'=>DB::prefix(),
|
||||
'type'=>'npc',
|
||||
'generalID'=>$me['no'],
|
||||
'generalName'=>$me['name']
|
||||
'generalID'=>$npc['no'],
|
||||
'generalName'=>$npc['name']
|
||||
])
|
||||
]);
|
||||
|
||||
?>
|
||||
<script>
|
||||
window.alert('정상적으로 회원 가입되었습니다. 장수명 : <?=$me['name']?>');
|
||||
window.alert('정상적으로 회원 가입되었습니다. 장수명 : <?=$npc['name']?>');
|
||||
</script>");
|
||||
<script>window.open('../i_other/help.php');</script>
|
||||
|
||||
@@ -17,7 +17,7 @@ $result = [];
|
||||
$server = [];
|
||||
|
||||
|
||||
$rootServer = end(AppConf::getList())->getShortName();
|
||||
$rootServer = Util::array_last(AppConf::getList())->getShortName();
|
||||
|
||||
foreach (AppConf::getList() as $setting) {
|
||||
$serverColor = $setting->getColor();
|
||||
|
||||
@@ -28,7 +28,7 @@ class WebUtil
|
||||
}
|
||||
|
||||
/**
|
||||
* @return null|mixed|mixed[]
|
||||
* @return mixed|mixed[]
|
||||
*/
|
||||
public static function parseJsonPost()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user