forked from devsam/core
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
da7fcafb27 | ||
|
|
7f7d8b2099 | ||
|
|
b5fb2e9cf4 | ||
|
|
d9ffdf9df8 | ||
|
|
f919187b91 | ||
|
|
d5ead5b74f | ||
|
|
ec1be2c887 | ||
|
|
af0c470923 | ||
|
|
78ce7d20e3 | ||
|
|
932ce9bf51 | ||
|
|
3d602b49bf | ||
|
|
33b7d228f9 | ||
|
|
95a8fd5495 | ||
|
|
87bc416fc7 | ||
|
|
8c21eec168 | ||
|
|
7ef3f0d5c5 | ||
|
|
e90e508005 | ||
|
|
816daed570 | ||
|
|
3626266763 | ||
|
|
6c117a628c | ||
|
|
d3225dfb41 | ||
|
|
bd7e7540d8 | ||
|
|
48088748df | ||
|
|
7a5eecc3e1 | ||
|
|
51d7dede55 | ||
|
|
bcad77ec06 | ||
|
|
9b79d12521 | ||
|
|
4b33461c70 | ||
|
|
bc3a8fefd8 | ||
|
|
db97400b43 | ||
|
|
3ad4032239 | ||
|
|
1d0fb7151d | ||
|
|
0c9099c868 | ||
|
|
c87cbaa0a6 | ||
|
|
5a94bf434a | ||
|
|
d567f3218a | ||
|
|
5d97c4ebea | ||
|
|
c3be464774 | ||
|
|
0d1e10a2ce | ||
|
|
723a7bbfba | ||
|
|
6a100ed2c1 | ||
|
|
5a6cd7fb46 | ||
|
|
871c99a67a | ||
|
|
7bdde2ac8a | ||
|
|
3564282acb | ||
|
|
13e24dbcb4 | ||
|
|
0026e9cb15 | ||
|
|
156795d7e9 | ||
|
|
e41d73b5bd | ||
|
|
655cd1700c | ||
|
|
9fb455d38a | ||
|
|
879a1e1c61 | ||
|
|
e614092690 | ||
|
|
4ebe51d978 | ||
|
|
10a29e584f | ||
|
|
a88982940b | ||
|
|
b92a95cc07 | ||
|
|
bffca5e163 | ||
|
|
b56919a343 | ||
|
|
b797bab7e0 | ||
|
|
a03d2cee63 | ||
|
|
67fef4b73d | ||
|
|
253a953dfe | ||
|
|
be7154284e | ||
|
|
02f90842fe | ||
|
|
0b17a289c8 |
+1
-1
@@ -32,7 +32,7 @@ return [
|
||||
'hwe/func_npc.php',
|
||||
'hwe/func_process_chief.php',
|
||||
'hwe/func_process_personnel.php',
|
||||
'hwe/func_process_trick.php',
|
||||
'hwe/func_process_sabotage.php',
|
||||
'hwe/func_process.php',
|
||||
'hwe/func_string.php',
|
||||
'hwe/func_template.php',
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
The MIT License
|
||||
|
||||
Copyright (c) 2018 Hide_D, 62che
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
@@ -0,0 +1,60 @@
|
||||
# 삼국지 모의전투 HiDCHe
|
||||
|
||||
삼국지 모의전투 유기체서버를 기반으로 더욱 더 진화한 서버입니다.
|
||||
|
||||
|
||||
## 요구사항
|
||||
|
||||
* Apache2
|
||||
* <code>mpm_event</code> 권장
|
||||
* PHP 7.0 이상
|
||||
* <code>php-fpm</code> 권장
|
||||
* php에서 curl을 실행가능해야 합니다.
|
||||
* MySQL 5.6 이상, 또는 MariaDB 10.0 이상
|
||||
* <code>git</code>
|
||||
* <code>curl</code>
|
||||
|
||||
Linux는 Ubuntu 16.04, Windows는 Windows 10에서 XAMPP를 사용한 환경에서 테스트되었습니다.
|
||||
|
||||
Docker를 이용한 설치는 계획중입니다.
|
||||
|
||||
## 설치
|
||||
|
||||
본 게임은 <code>git</code>을 이용한 업그레이드 시스템을 구현하였으므로, <code>git</code>이 필요합니다.
|
||||
또한 웹 서비스 데몬을 운영중인 사용자(일반적으로 <code>www-data</code>, <code>apache</code>)에게 디렉토리 권한이 주어져야합니다.
|
||||
|
||||
### 다운로드
|
||||
|
||||
웹 데몬 user가 <code>www-data</code>인 경우 다음과 같이 입력하여 최신 배포버전과 이미지 파일을 얻을 수 있습니다.
|
||||
|
||||
```
|
||||
sudo -u www-data git clone ssh://git@storage.hided.net:2525/devsam/core.git
|
||||
git clone ssh://git@storage.hided.net:2525/devsam/image.git
|
||||
```
|
||||
|
||||
> 이미지는 별도의 업데이트 기능을 제공하지 않습니다. 수동으로 <code>git pull</code>을 해야합니다.
|
||||
|
||||
### 설치
|
||||
|
||||
이후 해당 경로를 웹 브라우저를 통해 접근하여 설치를 진행할 수 있습니다.
|
||||
|
||||
Database 수는 로그인 관리 서버 1개, 내부 서버 5개로, 총 6개의 Database가 필요합니다. 내부 설정을 고쳐서 서버 수를 늘리거나 줄일 경우 그에 맞는 Database 수가 필요합니다. 또한 Database마다 관리할 별도의 계정을 만드는 것을 추천합니다.
|
||||
|
||||
설치 이후에는 서버관리 페이지에서 **업데이트** 명령을 통해 원 클릭 업데이트가 가능합니다.
|
||||
|
||||
|
||||
## 카카오로그인 연동
|
||||
|
||||
현재 카카오로그인 API KEY를 입력하는 작업이 설치과정에 추가되어있지 않습니다.
|
||||
|
||||
<code>f_install/templates/KakaoKey.orig.php</code> 를 <code>d_setting/KakaoKey.php</code>로 복사한 후 API 키를 입력하여야 합니다.
|
||||
|
||||
|
||||
## 라이선스
|
||||
|
||||
본 게임을 수정하거나 재배포할 경우 다음 중 하나의 라이선스를 선택하여 적용할 수 있습니다.
|
||||
|
||||
* MIT License
|
||||
* GPL 2.0 또는 이후
|
||||
|
||||
만약 별도의 라이선스를 적용하고자 할 경우 Hide_D에게 문의하여 주십시오.
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
@charset "utf-8";
|
||||
|
||||
* { margin: 0px; padding: 0px; }
|
||||
body { color:white; background-color:black; border-width:1; border-color:gray; }
|
||||
body { color:white; background-color:black; border-width:1px; border-color:gray; }
|
||||
table {
|
||||
border: solid 1px; border-spacing: 0px; border-collapse: separate; border-top-color: gray; border-left-color: gray; border-right-color: black; border-bottom-color: black;
|
||||
padding: 0px;
|
||||
|
||||
@@ -24,7 +24,7 @@ $rootDB->error_handler = function($params){
|
||||
]);
|
||||
};
|
||||
|
||||
$memberCnt = $rootDB->queryFirstField('SELECT count(`NO`) from MEMBER');
|
||||
$memberCnt = $rootDB->queryFirstField('SELECT count(`NO`) from member');
|
||||
if($memberCnt == 0){
|
||||
Json::die([
|
||||
'step'=>'admin',
|
||||
|
||||
@@ -29,6 +29,8 @@ class RootDB
|
||||
if (self::$uDB === null) {
|
||||
self::$uDB = new \MeekroDB(self::$host, self::$user, self::$password, self::$dbName, self::$port, self::$encoding);
|
||||
self::$uDB->connect_options[MYSQLI_OPT_INT_AND_FLOAT_NATIVE] = true;
|
||||
|
||||
self::$uDB->error_handler= function(){};
|
||||
self::$uDB->throw_exception_on_error = true;
|
||||
self::$uDB->throw_exception_on_nonsql_error = true;
|
||||
}
|
||||
|
||||
@@ -11,18 +11,24 @@ class ServConfig
|
||||
public static $sharedIconPath = '_tK_sharedIconPath_';
|
||||
public static $gameImagePath = "_tK_gameImagePath_";
|
||||
|
||||
public static function getSharedIconPath() : string
|
||||
public static function getSharedIconPath(string $filepath='') : string
|
||||
{
|
||||
if($filepath){
|
||||
return static::$sharedIconPath."/{$filepath}";
|
||||
}
|
||||
return static::$sharedIconPath;
|
||||
}
|
||||
|
||||
public static function getUserIconPath() : string
|
||||
public static function getUserIconPath(string $filepath='') : string
|
||||
{
|
||||
return AppConf::getUserIconPathWeb();
|
||||
return AppConf::getUserIconPathWeb($filepath);
|
||||
}
|
||||
|
||||
public static function getGameImagePath() : string
|
||||
public static function getGameImagePath(string $filepath='') : string
|
||||
{
|
||||
if($filepath){
|
||||
return static::$gameImagePath."/{$filepath}";
|
||||
}
|
||||
return static::$gameImagePath;
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -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'));
|
||||
@@ -29,6 +30,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();
|
||||
|
||||
|
||||
+238
-191
@@ -7,6 +7,8 @@ include "func.php";
|
||||
$btn = Util::getReq('btn');
|
||||
$weap = Util::getReq('weap', 'int');
|
||||
|
||||
extractMissingPostToGlobals();
|
||||
|
||||
//로그인 검사
|
||||
$session = Session::requireLogin()->loginGame()->setReadOnly();
|
||||
|
||||
@@ -24,281 +26,326 @@ $connect=$db->get();
|
||||
|
||||
switch($btn) {
|
||||
case "전체 접속허용":
|
||||
$query = "update general set con=0";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$db->update('general', [
|
||||
'con'=>0
|
||||
], true);
|
||||
break;
|
||||
case "전체 접속제한":
|
||||
$query = "update general set con=1000";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$db->update('general', [
|
||||
'con'=>1000
|
||||
], true);
|
||||
break;
|
||||
case "블럭 해제":
|
||||
$db->update('general', [
|
||||
'block'=>0
|
||||
], '`no` IN %li', $genlist);
|
||||
DB::db()->query('update general set block=0 where no IN %li', $genlist);
|
||||
break;
|
||||
case "1단계 블럭":
|
||||
$date = date('Y-m-d H:i:s');
|
||||
$db = DB::db();
|
||||
$db->query('update general set block=1,killturn=24 where no IN %li',$genlist);
|
||||
//FIXME: subquery로 하는게 더 빠를 듯.
|
||||
$uid = $db->queryFirstColumn('select owner from general where no IN %li', $genlist);
|
||||
RootDB::db()->query('update MEMBER set block_num=block_num+1,block_date=%s where no IN %ls', $date, $uid);
|
||||
$db->update('general', [
|
||||
'block'=>1,
|
||||
'killturn'=>24
|
||||
], '`no` IN %li', $genlist);
|
||||
$uid = $db->queryFirstColumn('SELECT `owner` FROM general WHERE `no` IN %li', $genlist);
|
||||
RootDB::db()->update('member',[
|
||||
'block_num'=>$db->sqleval('block_num+1'),
|
||||
'block_date'=>$date
|
||||
], 'id IN %li', $uid);
|
||||
break;
|
||||
case "2단계 블럭":
|
||||
$date = date('Y-m-d H:i:s');
|
||||
$db = DB::db();
|
||||
$db->query('update general set gold=0,rice=0,block=2,killturn=24 where no IN %li',$genlist);
|
||||
$db->update('general', [
|
||||
'gold'=>0,
|
||||
'rice'=>0,
|
||||
'block'=>2,
|
||||
'killturn'=>24
|
||||
], '`no` IN %li', $genlist);
|
||||
$uid = $db->queryFirstColumn('select owner from general where no IN %li', $genlist);
|
||||
RootDB::db()->query('update MEMBER set block_num=block_num+1,block_date=%s where id IN %ls', $date, $uid);
|
||||
RootDB::db()->update('member',[
|
||||
'block_num'=>$db->sqleval('block_num+1'),
|
||||
'block_date'=>$date
|
||||
], 'id IN %li', $uid);
|
||||
break;
|
||||
case "3단계 블럭":
|
||||
$date = date('Y-m-d H:i:s');
|
||||
$db = DB::db();
|
||||
$db->query('update general set gold=0,rice=0,block=3,killturn=24 where no IN %li',$genlist);
|
||||
$uid = $db->queryFirstColumn('select owner from general where no IN %li', $genlist);
|
||||
RootDB::db()->query('update MEMBER set block_num=block_num+1,block_date=%s where id IN %ls', $date, $uid);
|
||||
$db->update('general', [
|
||||
'gold'=>0,
|
||||
'rice'=>0,
|
||||
'block'=>3,
|
||||
'killturn'=>24
|
||||
], '`no` IN %li', $genlist);
|
||||
$uid = $db->queryFirstColumn('SELECT `owner` from general where no IN %li', $genlist);
|
||||
RootDB::db()->update('member',[
|
||||
'block_num'=>$db->sqleval('block_num+1'),
|
||||
'block_date'=>$date
|
||||
], 'id IN %li', $uid);
|
||||
break;
|
||||
case "무한삭턴":
|
||||
DB::db()->query('update general set killturn=8000 where no IN %li',$genlist);
|
||||
$db->update('general', [
|
||||
'killturn'=>8000
|
||||
], '`no` IN %li', $genlist);
|
||||
break;
|
||||
case "강제 사망":
|
||||
$date = date('Y-m-d H:i:s');
|
||||
DB::db()->query('update general set turn0=0,killturn=0,turntime=%s where no IN %li',$date, $genlist);
|
||||
$db->update('general', [
|
||||
'turn0'=>0,
|
||||
'killturn'=>0,
|
||||
'turntime'=>$date,
|
||||
], '`no` IN %li', $genlist);
|
||||
break;
|
||||
case "특기 부여":
|
||||
$admin = DB::db()->queryFirstRow('select `year`, `month` from `game` where `no`=1');
|
||||
list($year, $month) = $db->queryFirstList('select `year`, `month` from `game` where `no`=1');
|
||||
|
||||
for($i=0; $i < count($genlist); $i++) {
|
||||
$you = DB::db()->queryFirstRow('select `no`, `nation` from `general` where `no` = %i', $genlist[$i]);
|
||||
$msg = "특기 부여!";
|
||||
sendMessage('private', ['id'=>$generalID, 'nation_id'=>0], ['id'=>$you['no'], 'nation_id'=>$you['nation']], $msg);
|
||||
}
|
||||
for($i=0; $i < count($genlist); $i++) {
|
||||
$query = "select no,leader,power,intel from general where no='$genlist[$i]'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$general = MYDB_fetch_array($result);
|
||||
$src = MessageTarget::buildQuick($session->generalID);
|
||||
$text = "특기 부여!";
|
||||
|
||||
$special2 = getSpecial2($general['leader'], $general['power'], $general['intel']);
|
||||
foreach($db->query("SELECT `no`,leader,power,intel,dex0,dex10,dex20,dex30,dex40 FROM general WHERE `no` IN %li", $genlist) as $general){
|
||||
$msg = new Message(Message::MSGTYPE_PRIVATE, $src, MessageTarget::buildQuick($general['no']), $text, new DateTime(), new DateTime('9999-12-31'), []);
|
||||
$msg->send(true);
|
||||
|
||||
$query = "update general set specage2=age,special2='$special2' where no='{$general['no']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
|
||||
$log[0] = "<C>●</>특기 【<b><L>".getGenSpecial($special2)."</></b>】(을)를 익혔습니다!";
|
||||
pushGeneralHistory($general, "<C>●</>{$admin['year']}년 {$admin['month']}월:특기 【<b><C>".getGenSpecial($special2)."</></b>】(을)를 습득");
|
||||
pushGenLog($general, $log);
|
||||
$specialWar = SpecialityConst::pickSpecialWar($general);
|
||||
$db->update('general', [
|
||||
'specage2'=>$db->sqleval('age'),
|
||||
'special2'=>$specialWar
|
||||
], 'no=%i', $general['no']);
|
||||
$specialWarName = SpecialityConst::WAR[$specialWar][0];
|
||||
pushGeneralHistory($general, "<C>●</>{$year}년 {$month}월:특기 【<b><C>{$specialWarName}</></b>】(을)를 습득");
|
||||
pushGenLog($general, ["<C>●</>특기 【<b><L>{$specialWarName}</></b>】(을)를 익혔습니다!"]);
|
||||
}
|
||||
|
||||
break;
|
||||
case "경험치1000":
|
||||
for($i=0; $i < count($genlist); $i++) {
|
||||
$you = DB::db()->queryFirstRow('select `no`, `nation` from `general` where `no` = %i', $genlist[$i]);
|
||||
$msg = $btn." 지급!";
|
||||
sendMessage('private', ['id'=>$generalID, 'nation_id'=>0], ['id'=>$you['no'], 'nation_id'=>$you['nation']], $msg);
|
||||
}
|
||||
for($i=0; $i < count($genlist); $i++) {
|
||||
$query = "update general set experience=experience+1000 where no='$genlist[$i]'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$src = MessageTarget::buildQuick($session->generalID);
|
||||
$text = $btn." 지급!";
|
||||
foreach($genlist as $generalID){
|
||||
$msg = new Message(Message::MSGTYPE_PRIVATE, $src, MessageTarget::buildQuick($generalID), $text, new DateTime(), new DateTime('9999-12-31'), []);
|
||||
$msg->send(true);
|
||||
}
|
||||
$db->update('general',[
|
||||
'experience'=>$db->sqleval('experience+1000')
|
||||
], '`no` IN %li', $genlist);
|
||||
|
||||
break;
|
||||
case "공헌치1000":
|
||||
for($i=0; $i < count($genlist); $i++) {
|
||||
$you = DB::db()->queryFirstRow('select `no`, `nation` from `general` where `no` = %i', $genlist[$i]);
|
||||
$msg = $btn." 지급!";
|
||||
sendMessage('private', ['id'=>$generalID, 'nation_id'=>0], ['id'=>$you['no'], 'nation_id'=>$you['nation']], $msg);
|
||||
}
|
||||
for($i=0; $i < count($genlist); $i++) {
|
||||
$query = "update general set dedication=dedication+1000 where no='$genlist[$i]'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$src = MessageTarget::buildQuick($session->generalID);
|
||||
$text = $btn." 지급!";
|
||||
foreach($genlist as $generalID){
|
||||
$msg = new Message(Message::MSGTYPE_PRIVATE, $src, MessageTarget::buildQuick($generalID), $text, new DateTime(), new DateTime('9999-12-31'), []);
|
||||
$msg->send(true);
|
||||
}
|
||||
$db->update('general',[
|
||||
'dedication'=>$db->sqleval('dedication+1000')
|
||||
], '`no` IN %li', $genlist);
|
||||
|
||||
break;
|
||||
case "보숙10000":
|
||||
for($i=0; $i < count($genlist); $i++) {
|
||||
$you = DB::db()->queryFirstRow('select `no`, `nation` from `general` where `no` = %i', $genlist[$i]);
|
||||
$msg = "보병숙련도+10000 지급!";
|
||||
sendMessage('private', ['id'=>$generalID, 'nation_id'=>0], ['id'=>$you['no'], 'nation_id'=>$you['nation']], $msg);
|
||||
}
|
||||
for($i=0; $i < count($genlist); $i++) {
|
||||
$query = "update general set dex0=dex0+10000 where no='$genlist[$i]'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$src = MessageTarget::buildQuick($session->generalID);
|
||||
$text = "보병숙련도+10000 지급!";
|
||||
foreach($genlist as $generalID){
|
||||
$msg = new Message(Message::MSGTYPE_PRIVATE, $src, MessageTarget::buildQuick($generalID), $text, new DateTime(), new DateTime('9999-12-31'), []);
|
||||
$msg->send(true);
|
||||
}
|
||||
$db->update('general',[
|
||||
'dex0'=>$db->sqleval('dex0+10000')
|
||||
], '`no` IN %li', $genlist);
|
||||
break;
|
||||
case "궁숙10000":
|
||||
for($i=0; $i < count($genlist); $i++) {
|
||||
$you = DB::db()->queryFirstRow('select `no`, `nation` from `general` where `no` = %i', $genlist[$i]);
|
||||
$msg = "궁병숙련도+10000 지급!";
|
||||
sendMessage('private', ['id'=>$generalID, 'nation_id'=>0], ['id'=>$you['no'], 'nation_id'=>$you['nation']], $msg);
|
||||
}
|
||||
for($i=0; $i < count($genlist); $i++) {
|
||||
$query = "update general set dex10=dex10+10000 where no='$genlist[$i]'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$src = MessageTarget::buildQuick($session->generalID);
|
||||
$text = "궁병숙련도+10000 지급!";
|
||||
foreach($genlist as $generalID){
|
||||
$msg = new Message(Message::MSGTYPE_PRIVATE, $src, MessageTarget::buildQuick($generalID), $text, new DateTime(), new DateTime('9999-12-31'), []);
|
||||
$msg->send(true);
|
||||
}
|
||||
$db->update('general',[
|
||||
'dex10'=>$db->sqleval('dex10+10000')
|
||||
], '`no` IN %li', $genlist);
|
||||
break;
|
||||
case "기숙10000":
|
||||
for($i=0; $i < count($genlist); $i++) {
|
||||
$you = DB::db()->queryFirstRow('select `no`, `nation` from `general` where `no` = %i', $genlist[$i]);
|
||||
$msg = "기병숙련도+10000 지급!";
|
||||
sendMessage('private', ['id'=>$generalID, 'nation_id'=>0], ['id'=>$you['no'], 'nation_id'=>$you['nation']], $msg);
|
||||
}
|
||||
for($i=0; $i < count($genlist); $i++) {
|
||||
$query = "update general set dex20=dex20+10000 where no='$genlist[$i]'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$src = MessageTarget::buildQuick($session->generalID);
|
||||
$text = "기병숙련도+10000 지급!";
|
||||
foreach($genlist as $generalID){
|
||||
$msg = new Message(Message::MSGTYPE_PRIVATE, $src, MessageTarget::buildQuick($generalID), $text, new DateTime(), new DateTime('9999-12-31'), []);
|
||||
$msg->send(true);
|
||||
}
|
||||
$db->update('general',[
|
||||
'dex20'=>$db->sqleval('dex20+10000')
|
||||
], '`no` IN %li', $genlist);
|
||||
break;
|
||||
case "귀숙10000":
|
||||
for($i=0; $i < count($genlist); $i++) {
|
||||
$you = DB::db()->queryFirstRow('select `no`, `nation` from `general` where `no` = %i', $genlist[$i]);
|
||||
$msg = "귀병숙련도+10000 지급!";
|
||||
sendMessage('private', ['id'=>$generalID, 'nation_id'=>0], ['id'=>$you['no'], 'nation_id'=>$you['nation']], $msg);
|
||||
}
|
||||
for($i=0; $i < count($genlist); $i++) {
|
||||
$query = "update general set dex30=dex30+10000 where no='$genlist[$i]'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$src = MessageTarget::buildQuick($session->generalID);
|
||||
$text = "귀병숙련도+10000 지급!";
|
||||
foreach($genlist as $generalID){
|
||||
$msg = new Message(Message::MSGTYPE_PRIVATE, $src, MessageTarget::buildQuick($generalID), $text, new DateTime(), new DateTime('9999-12-31'), []);
|
||||
$msg->send(true);
|
||||
}
|
||||
$db->update('general',[
|
||||
'dex30'=>$db->sqleval('dex30+10000')
|
||||
], '`no` IN %li', $genlist);
|
||||
break;
|
||||
case "차숙10000":
|
||||
for($i=0; $i < count($genlist); $i++) {
|
||||
$you = DB::db()->queryFirstRow('select `no`, `nation` from `general` where `no` = %i', $genlist[$i]);
|
||||
$msg = "차병숙련도+10000 지급!";
|
||||
sendMessage('private', ['id'=>$generalID, 'nation_id'=>0], ['id'=>$you['no'], 'nation_id'=>$you['nation']], $msg);
|
||||
}
|
||||
for($i=0; $i < count($genlist); $i++) {
|
||||
$query = "update general set dex40=dex40+10000 where no='$genlist[$i]'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$src = MessageTarget::buildQuick($session->generalID);
|
||||
$text = "차병숙련도+10000 지급!";
|
||||
foreach($genlist as $generalID){
|
||||
$msg = new Message(Message::MSGTYPE_PRIVATE, $src, MessageTarget::buildQuick($generalID), $text, new DateTime(), new DateTime('9999-12-31'), []);
|
||||
$msg->send(true);
|
||||
}
|
||||
$db->update('general',[
|
||||
'dex40'=>$db->sqleval('dex40+10000')
|
||||
], '`no` IN %li', $genlist);
|
||||
break;
|
||||
case "접속 허용":
|
||||
for($i=0; $i < count($genlist); $i++) {
|
||||
$query = "update general set con=0 where no='$genlist[$i]'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
}
|
||||
$db->update('genera',[
|
||||
'con'=>0
|
||||
], '`no` IN %li', $genlist);
|
||||
break;
|
||||
case "접속 제한":
|
||||
for($i=0; $i < count($genlist); $i++) {
|
||||
$query = "update general set con=1000 where no='$genlist[$i]'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
}
|
||||
$db->update('genera',[
|
||||
'con'=>1000
|
||||
], '`no` IN %li', $genlist);
|
||||
break;
|
||||
case "메세지 전달":
|
||||
//TODO:새 갠메 시스템으로 변경
|
||||
$date = date('Y-m-d H:i:s');
|
||||
for($i=0; $i < count($genlist); $i++) {
|
||||
$you = DB::db()->queryFirstRow('select `no`, `nation` from `general` where `no` = %i', $genlist[$i]);
|
||||
sendMessage('private', ['id'=>$generalID, 'nation_id'=>0], ['id'=>$you['no'], 'nation_id'=>$you['nation']], $msg);
|
||||
$text = $msg;
|
||||
foreach($genlist as $generalID){
|
||||
$msg = new Message(Message::MSGTYPE_PRIVATE, $src, MessageTarget::buildQuick($generalID), $text, new DateTime(), new DateTime('9999-12-31'), []);
|
||||
$msg->send(true);
|
||||
}
|
||||
break;
|
||||
case "무기지급":
|
||||
$date = date('Y-m-d H:i:s');
|
||||
for($i=0; $i < count($genlist); $i++) {
|
||||
$you = DB::db()->queryFirstRow('select `no`, `nation` from `general` where `no` = %i', $genlist[$i]);
|
||||
if($weap == 0) { $msg = "무기 회수!"; }
|
||||
else { $msg = getWeapName($weap)." 지급!"; }
|
||||
sendMessage('private', ['id'=>$generalID, 'nation_id'=>0], ['id'=>$you['no'], 'nation_id'=>$you['nation']], $msg);
|
||||
|
||||
if($weap == 0) {
|
||||
$text = "무기 회수!";
|
||||
}
|
||||
for($i=0; $i < count($genlist); $i++) {
|
||||
if($weap == 0) {
|
||||
$query = "update general set weap='0' where no='$genlist[$i]'";
|
||||
} else {
|
||||
$query = "update general set weap='$weap' where no='$genlist[$i]' and weap<'$weap'";
|
||||
}
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
else {
|
||||
$text = getWeapName($weap)." 지급!";
|
||||
}
|
||||
|
||||
foreach($genlist as $generalID){
|
||||
$msg = new Message(Message::MSGTYPE_PRIVATE, $src, MessageTarget::buildQuick($generalID), $text, new DateTime(), new DateTime('9999-12-31'), []);
|
||||
$msg->send(true);
|
||||
}
|
||||
|
||||
if($weap == 0){
|
||||
$db->update('general', [
|
||||
'weap'=>0
|
||||
], '`no` IN %li', $genlist);
|
||||
}
|
||||
else{
|
||||
$db->update('general', [
|
||||
'weap'=>$weap
|
||||
], '`no` IN %li AND weap < %i', $genlist, $weap);
|
||||
}
|
||||
break;
|
||||
case "책지급":
|
||||
$date = date('Y-m-d H:i:s');
|
||||
for($i=0; $i < count($genlist); $i++) {
|
||||
$you = DB::db()->queryFirstRow('select `no`, `nation` from `general` where `no` = %i', $genlist[$i]);
|
||||
if($weap == 0) { $msg = "서적 회수!"; }
|
||||
else { $msg = getBookName($weap)." 지급!"; }
|
||||
// 상대에게 발송
|
||||
sendMessage('private', ['id'=>$generalID, 'nation_id'=>0], ['id'=>$you['no'], 'nation_id'=>$you['nation']], $msg);
|
||||
if($weap == 0) {
|
||||
$text = "책 회수!";
|
||||
}
|
||||
for($i=0; $i < count($genlist); $i++) {
|
||||
if($weap == 0) {
|
||||
$query = "update general set book='0' where no='$genlist[$i]'";
|
||||
} else {
|
||||
$query = "update general set book='$weap' where no='$genlist[$i]' and book<'$weap'";
|
||||
}
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
else {
|
||||
$text = getBookName($weap)." 지급!";
|
||||
}
|
||||
|
||||
foreach($genlist as $generalID){
|
||||
$msg = new Message(Message::MSGTYPE_PRIVATE, $src, MessageTarget::buildQuick($generalID), $text, new DateTime(), new DateTime('9999-12-31'), []);
|
||||
$msg->send(true);
|
||||
}
|
||||
|
||||
if($weap == 0){
|
||||
$db->update('general', [
|
||||
'book'=>0
|
||||
], '`no` IN %li', $genlist);
|
||||
}
|
||||
else{
|
||||
$db->update('general', [
|
||||
'book'=>$weap
|
||||
], '`no` IN %li AND book < %i', $genlist, $weap);
|
||||
}
|
||||
break;
|
||||
case "말지급":
|
||||
$date = date('Y-m-d H:i:s');
|
||||
for($i=0; $i < count($genlist); $i++) {
|
||||
$you = DB::db()->queryFirstRow('select `no`, `nation` from `general` where `no` = %i', $genlist[$i]);
|
||||
if($weap == 0) { $msg = "말 회수!"; }
|
||||
else { $msg = getHorseName($weap)." 지급!"; }
|
||||
// 상대에게 발송
|
||||
sendMessage('private', ['id'=>$generalID, 'nation_id'=>0], ['id'=>$you['no'], 'nation_id'=>$you['nation']], $msg);
|
||||
if($weap == 0) {
|
||||
$text = "말 회수!";
|
||||
}
|
||||
for($i=0; $i < count($genlist); $i++) {
|
||||
if($weap == 0) {
|
||||
$query = "update general set horse='0' where no='$genlist[$i]'";
|
||||
} else {
|
||||
$query = "update general set horse='$weap' where no='$genlist[$i]' and horse<'$weap'";
|
||||
}
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
else {
|
||||
$text = getHorseName($weap)." 지급!";
|
||||
}
|
||||
|
||||
foreach($genlist as $generalID){
|
||||
$msg = new Message(Message::MSGTYPE_PRIVATE, $src, MessageTarget::buildQuick($generalID), $text, new DateTime(), new DateTime('9999-12-31'), []);
|
||||
$msg->send(true);
|
||||
}
|
||||
|
||||
if($weap == 0){
|
||||
$db->update('general', [
|
||||
'horse'=>0
|
||||
], '`no` IN %li', $genlist);
|
||||
}
|
||||
else{
|
||||
$db->update('general', [
|
||||
'horse'=>$weap
|
||||
], '`no` IN %li AND horse < %i', $genlist, $weap);
|
||||
}
|
||||
break;
|
||||
case "도구지급":
|
||||
$date = date('Y-m-d H:i:s');
|
||||
for($i=0; $i < count($genlist); $i++) {
|
||||
$you = DB::db()->queryFirstRow('select `no`, `nation` from `general` where `no` = %i', $genlist[$i]);
|
||||
if($weap == 0) { $msg = "특수도구 회수!"; }
|
||||
else { $msg = getItemName($weap)." 지급!"; }
|
||||
// 상대에게 발송
|
||||
sendMessage('private', ['id'=>$generalID, 'nation_id'=>0], ['id'=>$you['no'], 'nation_id'=>$you['nation']], $msg);
|
||||
if($weap == 0) {
|
||||
$text = "특수도구 회수!";
|
||||
}
|
||||
for($i=0; $i < count($genlist); $i++) {
|
||||
if($weap == 0) {
|
||||
$query = "update general set item='0' where no='$genlist[$i]'";
|
||||
} else {
|
||||
$query = "update general set item='$weap' where no='$genlist[$i]' and item<'$weap'";
|
||||
}
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
else {
|
||||
$text = getItemName($weap)." 지급!";
|
||||
}
|
||||
|
||||
foreach($genlist as $generalID){
|
||||
$msg = new Message(Message::MSGTYPE_PRIVATE, $src, MessageTarget::buildQuick($generalID), $text, new DateTime(), new DateTime('9999-12-31'), []);
|
||||
$msg->send(true);
|
||||
}
|
||||
|
||||
if($weap == 0){
|
||||
$db->update('general', [
|
||||
'item'=>0
|
||||
], '`no` IN %li', $genlist);
|
||||
}
|
||||
else{
|
||||
$db->update('general', [
|
||||
'item'=>$weap
|
||||
], '`no` IN %li AND item < %i', $genlist, $weap);
|
||||
}
|
||||
break;
|
||||
case "NPC해제":
|
||||
for($i=0; $i < count($genlist); $i++) {
|
||||
$query = "update general set npc=1 where no='$genlist[$i]'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
}
|
||||
$db->update('general', [
|
||||
'npc'=>1
|
||||
], '`no` IN %li', $genlist);
|
||||
break;
|
||||
case "하야입력":
|
||||
for($i=0; $i < count($genlist); $i++) {
|
||||
$query = "update general set turn0='00000000000045' where no='$genlist[$i]'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
}
|
||||
$db->update('general', [
|
||||
'turn0'=>'00000000000045'
|
||||
], '`no` IN %li', $genlist);
|
||||
break;
|
||||
case "방랑해산":
|
||||
for($i=0; $i < count($genlist); $i++) {
|
||||
$query = "update general set turn0='00000000000047',turn1='00000000000056' where no='$genlist[$i]'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
}
|
||||
$db->update('general', [
|
||||
'turn0'=>'00000000000047',
|
||||
'turn1'=>'00000000000056'
|
||||
], '`no` IN %li', $genlist);
|
||||
break;
|
||||
case "NPC설정":
|
||||
for($i=0; $i < count($genlist); $i++) {
|
||||
$query = "update general set npc=2 where no='$genlist[$i]'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
}
|
||||
$db->update('general', [
|
||||
'npc'=>2
|
||||
], '`no` IN %li', $genlist);
|
||||
break;
|
||||
case "00턴":
|
||||
$query = "select turnterm from game limit 1";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$admin = MYDB_fetch_array($result);
|
||||
$turnterm = $db->queryFirstField('SELECT turnterm FROM game LIMIT 1');
|
||||
|
||||
for($i=0; $i < count($genlist); $i++) {
|
||||
$turntime = getRandTurn($admin['turnterm']);
|
||||
$cutTurn = cutTurn($turntime, $admin['turnterm']);
|
||||
$query = "update general set turntime='$cutTurn' where no='$genlist[$i]'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
foreach($genlist as $generalID){
|
||||
$turntime = getRandTurn($turnterm);
|
||||
$cutTurn = cutTurn($turntime, $turnterm);
|
||||
$db->update('general', [
|
||||
'turntime'=>$curTurn
|
||||
], '`no` IN %li', $genlist);
|
||||
}
|
||||
break;
|
||||
case "랜덤턴":
|
||||
$query = "select turnterm from game limit 1";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$admin = MYDB_fetch_array($result);
|
||||
|
||||
for($i=0; $i < count($genlist); $i++) {
|
||||
$turntime = getRandTurn($admin['turnterm']);
|
||||
$query = "update general set turntime='$turntime' where no='$genlist[$i]'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
foreach($genlist as $generalID){
|
||||
$turntime = getRandTurn($turnterm);
|
||||
$db->update('general', [
|
||||
'turntime'=>$turntime
|
||||
], '`no` IN %li', $genlist);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -12,7 +12,9 @@ if($session->userGrade < 5) {
|
||||
}
|
||||
|
||||
$btn = Util::getReq('btn');
|
||||
$genlist = Util::getReq('genlist', 'int');
|
||||
$genlist = Util::getReq('genlist', 'array_int');
|
||||
|
||||
extractMissingPostToGlobals();
|
||||
|
||||
$db = DB::db();
|
||||
$connect=$db->get();
|
||||
@@ -29,21 +31,21 @@ switch($btn) {
|
||||
$db->query('update general set block=1,killturn=24 where no IN %li',$genlist);
|
||||
//FIXME: subquery로 하는게 더 빠를 듯.
|
||||
$uid = $db->queryFirstColumn('select owner from general where no IN %li', $genlist);
|
||||
RootDB::db()->query('update MEMBER set block_num=block_num+1,block_date=%s where id IN %ls', $date, $uid);
|
||||
RootDB::db()->query('update member set block_num=block_num+1,block_date=%s where id IN %ls', $date, $uid);
|
||||
break;
|
||||
case "2단계 블럭":
|
||||
$date = date('Y-m-d H:i:s');
|
||||
$db = DB::db();
|
||||
$db->query('update general set block=2,killturn=24 where no IN %li',$genlist);
|
||||
$uid = $db->queryFirstColumn('select owner from general where no IN %li', $genlist);
|
||||
RootDB::db()->query('update MEMBER set block_num=block_num+1,block_date=%s where id IN %ls', $date, $uid);
|
||||
RootDB::db()->query('update member set block_num=block_num+1,block_date=%s where id IN %ls', $date, $uid);
|
||||
break;
|
||||
case "3단계 블럭":
|
||||
$date = date('Y-m-d H:i:s');
|
||||
$db = DB::db();
|
||||
$db->query('update general set block=3,killturn=24 where no IN %li',$genlist);
|
||||
$uid = $db->queryFirstColumn('select owner from general where no IN %li', $genlist);
|
||||
RootDB::db()->query('update MEMBER set block_num=block_num+1,block_date=%s where id IN %ls', $date, $uid);
|
||||
RootDB::db()->query('update member set block_num=block_num+1,block_date=%s where id IN %ls', $date, $uid);
|
||||
break;
|
||||
case "무한삭턴":
|
||||
DB::db()->query('update general set killturn=8000 where no IN %li',$genlist);
|
||||
|
||||
+12
-9
@@ -7,6 +7,15 @@ 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();
|
||||
|
||||
//로그인 검사
|
||||
$session = Session::requireGameLogin()->setReadOnly();
|
||||
|
||||
@@ -33,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";
|
||||
@@ -155,7 +158,7 @@ SELECT
|
||||
A.chemi,
|
||||
A.color,
|
||||
A.tech,
|
||||
A.tricklimit,
|
||||
A.sabotagelimit,
|
||||
A.gold,
|
||||
A.rice,
|
||||
COUNT(B.nation) AS gennum,
|
||||
@@ -230,7 +233,7 @@ for($i=0; $i < $nationCount; $i++) {
|
||||
<td align=center> {$gen['cnt']} </td>
|
||||
<td align=center> {$city['cnt']} </td>
|
||||
<td align=center> {$nation['tech']} </td>
|
||||
<td align=center> {$nation['tricklimit']} </td>
|
||||
<td align=center> {$nation['sabotagelimit']} </td>
|
||||
<td align=center> {$nation['gold']} </td>
|
||||
<td align=center> {$nation['rice']} </td>
|
||||
<td align=center> {$gen['avgg']} </td>
|
||||
@@ -260,7 +263,7 @@ for($i=0; $i < $nationCount; $i++) {
|
||||
?>
|
||||
</table>
|
||||
<table align=center width=1000 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg0>
|
||||
<tr><td><?=getTrickLogRecent(20)?></td></tr>
|
||||
<tr><td><?=getSabotageLogRecent(20)?></td></tr>
|
||||
</table>
|
||||
|
||||
<table align=center width=1760 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px; id=bg0>
|
||||
|
||||
@@ -7,6 +7,8 @@ include "func.php";
|
||||
$btn = Util::getReq('btn');
|
||||
$nation = Util::getReq('nation', 'int');
|
||||
|
||||
extractMissingPostToGlobals();
|
||||
|
||||
//로그인 검사
|
||||
$session = Session::requireGameLogin()->setReadOnly();
|
||||
$userID = Session::getUserID();
|
||||
|
||||
+5
-4
@@ -4,7 +4,11 @@ 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();
|
||||
|
||||
//로그인 검사
|
||||
$session = Session::requireGameLogin()->setReadOnly();
|
||||
@@ -32,9 +36,6 @@ if($session->userGrade < 5) {
|
||||
$db = DB::db();
|
||||
$connect=$db->get();
|
||||
|
||||
if($type == 0) {
|
||||
$type = 0;
|
||||
}
|
||||
$sel[$type] = "selected";
|
||||
|
||||
?>
|
||||
|
||||
+7
-4
@@ -6,7 +6,13 @@ 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();
|
||||
|
||||
//로그인 검사
|
||||
$session = Session::requireGameLogin()->setReadOnly();
|
||||
@@ -38,9 +44,6 @@ if($btn == '정렬하기') {
|
||||
$gen = 0;
|
||||
}
|
||||
|
||||
if($type == 0) {
|
||||
$type = 0;
|
||||
}
|
||||
$sel[$type] = "selected";
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
|
||||
+6
-7
@@ -6,7 +6,9 @@ include "func.php";
|
||||
|
||||
$btn = Util::getReq('btn');
|
||||
$gen = Util::getReq('gen', 'int', 0);
|
||||
$type = Util::getReq('type', 'int');
|
||||
$type = 0;
|
||||
|
||||
extractMissingPostToGlobals();
|
||||
|
||||
//로그인 검사
|
||||
$session = Session::requireGameLogin()->setReadOnly();
|
||||
@@ -38,9 +40,6 @@ if ($btn == '정렬하기') {
|
||||
$gen = 0;
|
||||
}
|
||||
|
||||
if ($type == 0) {
|
||||
$type = 0;
|
||||
}
|
||||
$sel[$type] = "selected";
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
@@ -82,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++) {
|
||||
|
||||
+14
-11
@@ -6,6 +6,8 @@ include "func.php";
|
||||
|
||||
$btn = Util::getReq('btn');
|
||||
|
||||
extractMissingPostToGlobals();
|
||||
|
||||
//로그인 검사
|
||||
$session = Session::requireGameLogin()->setReadOnly();
|
||||
$userID = Session::getUserID();
|
||||
@@ -55,13 +57,14 @@ if ($con >= 2) {
|
||||
<table align=center width=1000 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg0>
|
||||
<?php
|
||||
if (isset($btn) && $btn == "NPC 보기") {
|
||||
//FIXME: query가 너무 적나라.
|
||||
$sel = "npc>=2";
|
||||
} else {
|
||||
$sel = "npc<2";
|
||||
}
|
||||
|
||||
$nationName = [];
|
||||
$nationColor = [];
|
||||
$nationName = ['재야'];
|
||||
$nationColor = ['#000000'];
|
||||
foreach (getAllNationStaticInfo() as $nation) {
|
||||
$nationName[$nation['nation']] = $nation['name'];
|
||||
$nationColor[$nation['nation']] = $nation['color'];
|
||||
@@ -134,9 +137,9 @@ for ($i=0; $i < 21; $i++) {
|
||||
if ($i != 2) {
|
||||
if (isset($gen)) {
|
||||
$name[$k] = $gen['name'];
|
||||
$nation[$k] = $gen['nation'] == 0 ? "재야" : $nationName[$gen['nation']];
|
||||
$nation[$k] = $nationName[$gen['nation']];
|
||||
$data[$k] = $gen['data'];
|
||||
$color[$k] = $gen['nation'] == 0 ? "#FFFFFF" : $nationColor[$gen['nation']];
|
||||
$color[$k] = $nationColor[$gen['nation']];
|
||||
$pic[$k] = $gen['picture'];
|
||||
} else {
|
||||
$name[$k] = "-";
|
||||
@@ -163,7 +166,7 @@ for ($i=0; $i < 21; $i++) {
|
||||
echo "<td align=center> </td>";
|
||||
} else {
|
||||
$imageTemp = GetImageURL($gen['imgsvr']);
|
||||
echo "<td align=center><img src={$imageTemp}/{$pic[$k]}></img></td>";
|
||||
echo "<td align=center><img width='64' height='64' src={$imageTemp}/{$pic[$k]}></td>";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -245,8 +248,8 @@ for ($i=0; $i < 4; $i++) {
|
||||
$gen = MYDB_fetch_array($result);
|
||||
if (isset($gen)) {
|
||||
$name[$k] = $gen['name'];
|
||||
$nation[$k] = $gen['nation'] == 0 ? "재야" : $nationName[$gen['nation']];
|
||||
$color[$k] = $gen['nation'] == 0 ? "#FFFFFF" : $nationColor[$gen['nation']];
|
||||
$nation[$k] = $nationName[$gen['nation']];
|
||||
$color[$k] = $nationColor[$gen['nation']];
|
||||
$pic[$k] = $gen['picture'];
|
||||
} else {
|
||||
$name[$k] = "미발견";
|
||||
@@ -264,7 +267,7 @@ for ($i=0; $i < 4; $i++) {
|
||||
echo "<td align=center> </td>";
|
||||
} else {
|
||||
$imageTemp = GetImageURL($gen['imgsvr']??0);
|
||||
echo "<td align=center><img src={$imageTemp}/{$pic[$k]}></img></td>";
|
||||
echo "<td align=center><img width='64' height='64' src={$imageTemp}/{$pic[$k]}></img></td>";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -297,8 +300,8 @@ for ($i=0; $i < 4; $i++) {
|
||||
$gen = MYDB_fetch_array($result);
|
||||
if (isset($gen)) {
|
||||
$name[$k] = $gen['name'];
|
||||
$nation[$k] = $gen['nation'] == 0 ? "재야" : $nationName[$gen['nation']];
|
||||
$color[$k] = $gen['nation'] == 0 ? "#FFFFFF" : $nationColor[$gen['nation']];
|
||||
$nation[$k] = $nationName[$gen['nation']];
|
||||
$color[$k] = $nationColor[$gen['nation']];
|
||||
$pic[$k] = $gen['picture'];
|
||||
} else {
|
||||
$name[$k] = "미발견";
|
||||
@@ -316,7 +319,7 @@ for ($i=0; $i < 4; $i++) {
|
||||
echo "<td align=center> </td>";
|
||||
} else {
|
||||
$imageTemp = GetImageURL($gen['imgsvr']??0);
|
||||
echo "<td align=center><img src={$imageTemp}/{$pic[$k]}></img></td>";
|
||||
echo "<td align=center><img width='64' height='64' src={$imageTemp}/{$pic[$k]}></img></td>";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,8 @@ include "func.php";
|
||||
|
||||
$select = Util::getReq('select', 'int', 0);
|
||||
|
||||
extractMissingPostToGlobals();
|
||||
|
||||
$db = DB::db();
|
||||
$connect=$db->get();
|
||||
|
||||
|
||||
@@ -6,6 +6,8 @@ include "func.php";
|
||||
|
||||
$select = Util::getReq('select', 'int', 0);
|
||||
|
||||
extractMissingPostToGlobals();
|
||||
|
||||
$db = DB::db();
|
||||
$connect=$db->get();
|
||||
|
||||
|
||||
+34
-18
@@ -3,6 +3,11 @@ namespace sammo;
|
||||
|
||||
include "lib.php";
|
||||
include "func.php";
|
||||
|
||||
$type = Util::getReq('type', 'int', 9);
|
||||
|
||||
extractMissingPostToGlobals();
|
||||
|
||||
//로그인 검사
|
||||
$session = Session::requireGameLogin()->setReadOnly();
|
||||
$userID = Session::getUserID();
|
||||
@@ -13,17 +18,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 +76,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 +90,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 +99,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 +121,24 @@ echo"
|
||||
<td width=45 align=center id=bg1>삭턴</td>
|
||||
<td width=84 align=center id=bg1>벌점</td>
|
||||
</tr>";
|
||||
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 = "<font color=cyan>+{$lbonus}</font>";
|
||||
} 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,16 +151,20 @@ for($j=0; $j < $gencount; $j++) {
|
||||
$intel = "{$general['intel']}";
|
||||
}
|
||||
|
||||
if($general['npc'] >= 2) { $name = "<font color=cyan>{$general['name']}</font>"; }
|
||||
elseif($general['npc'] == 1) { $name = "<font color=skyblue>{$general['name']}</font>"; }
|
||||
else { $name = "{$general['name']}"; }
|
||||
if ($general['npc'] >= 2) {
|
||||
$name = "<font color=cyan>{$general['name']}</font>";
|
||||
} elseif ($general['npc'] == 1) {
|
||||
$name = "<font color=skyblue>{$general['name']}</font>";
|
||||
} else {
|
||||
$name = "{$general['name']}";
|
||||
}
|
||||
|
||||
$general['connect'] = Util::round($general['connect'] / 10) * 10;
|
||||
|
||||
$imageTemp = GetImageURL($general['imgsvr']);
|
||||
echo "
|
||||
<tr>
|
||||
<td align=center><img src={$imageTemp}/{$general['picture']}></img></td>
|
||||
<td align=center><img width='64' height='64' src={$imageTemp}/{$general['picture']}></img></td>
|
||||
<td align=center>$name</td>
|
||||
<td align=center>{$general['age']}세</td>
|
||||
<td align=center>".getGenChar($general['personal'])."</td>
|
||||
@@ -160,12 +173,15 @@ for($j=0; $j < $gencount; $j++) {
|
||||
<td align=center>{$nation}</td>
|
||||
<td align=center>".getHonor($general['experience'])."</td>
|
||||
<td align=center>".getDed($general['dedication'])."</td>
|
||||
<td align=center>"; echo getLevel($general['level']); echo "</td>
|
||||
<td align=center>";
|
||||
echo getLevel($general['level']);
|
||||
echo "</td>
|
||||
<td align=center>$leader</td>
|
||||
<td align=center>$power</td>
|
||||
<td align=center>$intel</td>
|
||||
<td align=center>{$general['killturn']}</td>
|
||||
<td align=center>{$general['connect']}"; echo "<br>【".getConnect($general['connect'])."】</td>
|
||||
<td align=center>{$general['connect']}";
|
||||
echo "<br>【".getConnect($general['connect'])."】</td>
|
||||
</tr>";
|
||||
}
|
||||
echo "
|
||||
|
||||
@@ -21,7 +21,7 @@ increaseRefresh("명예의전당", 2);
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<table align=center width=1000 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=Font-size:13;word-break:break-all; id=bg0>
|
||||
<table align=center width=1000 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=Font-size:13px;word-break:break-all; id=bg0>
|
||||
<tr><td>명 예 의 전 당<br><?=closeButton()?></td></tr>
|
||||
</table>
|
||||
<table align=center width=1000 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg0>
|
||||
@@ -82,7 +82,7 @@ for ($i=0; $i < 21; $i++) {
|
||||
echo "<td align=center> </td>";
|
||||
} else {
|
||||
$imageTemp = GetImageURL($gen['imgsvr']);
|
||||
echo "<td align=center><img src={$imageTemp}/{$pic[$k]}></img></td>";
|
||||
echo "<td align=center><img width='64' height='64' src={$imageTemp}/{$pic[$k]}></img></td>";
|
||||
}
|
||||
*/
|
||||
}
|
||||
@@ -114,7 +114,7 @@ for ($i=0; $i < 21; $i++) {
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
<table align=center width=1000 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=Font-size:13;word-break:break-all; id=bg0>
|
||||
<table align=center width=1000 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg0>
|
||||
<tr><td><?=closeButton()?></td></tr>
|
||||
<tr><td><?=banner()?> </td></tr>
|
||||
</table>
|
||||
|
||||
+5
-3
@@ -4,7 +4,9 @@ namespace sammo;
|
||||
include "lib.php";
|
||||
include "func.php";
|
||||
$btn = Util::getReq('btn');
|
||||
$yearmonth = Util::getReq('yearmonth');
|
||||
$yearmonth = Util::getReq('yearmonth', 'int');
|
||||
|
||||
extractMissingPostToGlobals();
|
||||
|
||||
//로그인 검사
|
||||
$session = Session::requireGameLogin()->setReadOnly();
|
||||
@@ -44,8 +46,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;
|
||||
|
||||
+18
-10
@@ -6,14 +6,17 @@ include "func.php";
|
||||
|
||||
$type = Util::getReq('type', 'int', 1);
|
||||
|
||||
extractMissingPostToGlobals();
|
||||
|
||||
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 +52,12 @@ $sel[$type] = "selected";
|
||||
<?php
|
||||
$nationname = [];
|
||||
$nationname[0] = "-";
|
||||
foreach(getAllNationStaticInfo() as $nation){
|
||||
foreach (getAllNationStaticInfo() as $nation) {
|
||||
$nationname[$nation['nation']] = $nation['name'];
|
||||
}
|
||||
|
||||
switch($type) {
|
||||
switch ($type) {//FIXME: $query 처리 부실
|
||||
default:
|
||||
case 1: $query = "select npc,nation,name,name2,special,special2,personal,leader,power,intel,leader+power+intel as sum,explevel,experience,dedication from general where npc=1 order by binary(name)"; break;
|
||||
case 2: $query = "select npc,nation,name,name2,special,special2,personal,leader,power,intel,leader+power+intel as sum,explevel,experience,dedication from general where npc=1 order by nation"; break;
|
||||
case 3: $query = "select npc,nation,name,name2,special,special2,personal,leader,power,intel,leader+power+intel as sum,explevel,experience,dedication from general where npc=1 order by sum desc"; break;
|
||||
@@ -63,7 +67,7 @@ switch($type) {
|
||||
case 7: $query = "select npc,nation,name,name2,special,special2,personal,leader,power,intel,leader+power+intel as sum,explevel,experience,dedication from general where npc=1 order by experience"; break;
|
||||
case 8: $query = "select npc,nation,name,name2,special,special2,personal,leader,power,intel,leader+power+intel as sum,explevel,experience,dedication from general where npc=1 order by dedication"; 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"
|
||||
@@ -82,13 +86,17 @@ echo"
|
||||
<td width=78 align=center id=bg1>명성</td>
|
||||
<td width=78 align=center id=bg1>계급</td>
|
||||
</tr>";
|
||||
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 = "<font color=cyan>{$general['name']}</font>"; }
|
||||
elseif($general['npc'] == 1) { $name = "<font color=skyblue>{$general['name']}</font>"; }
|
||||
else { $name = "{$general['name']}"; }
|
||||
if ($general['npc'] >= 2) {
|
||||
$name = "<font color=cyan>{$general['name']}</font>";
|
||||
} elseif ($general['npc'] == 1) {
|
||||
$name = "<font color=skyblue>{$general['name']}</font>";
|
||||
} else {
|
||||
$name = "{$general['name']}";
|
||||
}
|
||||
|
||||
echo "
|
||||
<tr>
|
||||
|
||||
+6
-5
@@ -13,7 +13,7 @@ $query = "select year,month,refresh,maxrefresh,maxonline from game limit 1";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
|
||||
$game = MYDB_fetch_array($result);
|
||||
|
||||
$log = [];
|
||||
$log = getRawFileLogRecent(__dir__.'/logs/_traffic.txt', 11, 100);
|
||||
|
||||
$date = [];
|
||||
$year = [];
|
||||
@@ -22,8 +22,9 @@ $refresh = [];
|
||||
$online = [];
|
||||
|
||||
$curonline = getOnlineNum();
|
||||
for ($i=0; $i < 11; $i++) {
|
||||
$parse = explode("|", $log[count($log)-12+$i]);
|
||||
$visibleLogs = min(11, count($log));
|
||||
for ($i=0; $i < $visibleLogs; $i++) {
|
||||
$parse = explode("|", $log[count($log)-$visibleLogs+$i]);
|
||||
$date[$i] = trim($parse[0]);
|
||||
$year[$i] = trim($parse[1]);
|
||||
$month[$i] = trim($parse[2]);
|
||||
@@ -62,7 +63,7 @@ if ($game['maxonline'] < $curonline) {
|
||||
<table align=center border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg0>
|
||||
<tr><td colspan=4 align=center id=bg2><font size=5>접 속 량</font></td></tr>
|
||||
<?php
|
||||
for ($i=0; $i < 11; $i++) {
|
||||
for ($i=0; $i < $visibleLogs; $i++) {
|
||||
$w = round($refresh[$i] / $game['maxrefresh'] * 100, 1);
|
||||
if ($w >= 100) {
|
||||
$w -= 0.1;
|
||||
@@ -132,7 +133,7 @@ $dt = date('H:i');
|
||||
<table align=center border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg0>
|
||||
<tr><td colspan=4 align=center id=bg2><font size=5>접 속 자</font></td></tr>
|
||||
<?php
|
||||
for ($i=0; $i < 11; $i++) {
|
||||
for ($i=0; $i < $visibleLogs; $i++) {
|
||||
$w = round($online[$i] / $game['maxonline'] * 100, 1);
|
||||
if ($w >= 100) {
|
||||
$w -= 0.1;
|
||||
|
||||
+4
-3
@@ -57,7 +57,7 @@ if ($session->userGrade >= 5) {
|
||||
<tr>
|
||||
<td width=48 align=center><input type=submit name=btn value='알림'></td>
|
||||
<td width=98 align=center><input type=submit name=btn value='수정'></td>
|
||||
<td width=848 align=left><input type=text name=title style=width:848;></td>
|
||||
<td width=848 align=left><input type=text name=title style=width:848px;></td>
|
||||
</tr>
|
||||
";
|
||||
}
|
||||
@@ -132,7 +132,7 @@ if ($session->userGrade >= 5) {
|
||||
<tr>
|
||||
<td align=center><input type=submit name=btn value='리셋'></td>
|
||||
<td align=center><input type=submit name=btn value='추가'></td>
|
||||
<td align=left><input type=text name=str style=width:848;></td>
|
||||
<td align=left><input type=text name=str style=width:848px;></td>
|
||||
</tr>
|
||||
";
|
||||
}
|
||||
@@ -168,7 +168,7 @@ if ($me['no'] > 0) {
|
||||
<tr>
|
||||
<td width=108 colspan=2 align=center>-</td>
|
||||
<td width=83 align=center><input type=submit name=btn value='댓글'></td>
|
||||
<td align=left><input type=text name=comment maxlength=60 style=width:798; onkeydown='return captureKey(event)'></td>
|
||||
<td align=left><input type=text name=comment maxlength=60 style=width:798px; onkeydown='return captureKey(event)'></td>
|
||||
</tr>
|
||||
";
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
@@ -7,6 +7,8 @@ include "func.php";
|
||||
$msg = Util::getReq('msg');
|
||||
$msg2 = Util::getReq('msg2');
|
||||
|
||||
extractMissingPostToGlobals();
|
||||
|
||||
//로그인 검사
|
||||
$session = Session::requireGameLogin()->setReadOnly();
|
||||
$userID = Session::getUserID();
|
||||
|
||||
@@ -9,8 +9,14 @@ $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);
|
||||
|
||||
if ($type < 0 || $type > 3) {
|
||||
$type = 0;
|
||||
}
|
||||
|
||||
extractMissingPostToGlobals();
|
||||
|
||||
//로그인 검사
|
||||
$session = Session::requireGameLogin()->setReadOnly();
|
||||
@@ -61,9 +67,6 @@ if ($btn == '정렬하기') {
|
||||
$gen = 0;
|
||||
}
|
||||
|
||||
if ($type == 0) {
|
||||
$type = 0;
|
||||
}
|
||||
$sel = [];
|
||||
$sel[$type] = "selected";
|
||||
|
||||
@@ -96,6 +99,7 @@ $sel[$type] = "selected";
|
||||
<select name=gen size=1>
|
||||
<?php
|
||||
switch ($type) {
|
||||
default:
|
||||
case 0: $query = "select no,name from general where nation='{$me['nation']}' order by turntime desc"; break;
|
||||
case 1: $query = "select no,name from general where nation='{$me['nation']}' order by recwar desc"; break;
|
||||
case 2: $query = "select no,name from general where nation='{$me['nation']}' order by npc,binary(name)"; break;
|
||||
|
||||
+5
-3
@@ -28,6 +28,7 @@ if ($con >= 2) {
|
||||
}
|
||||
|
||||
switch ($admin['tnmt_type']) {
|
||||
default: throw new \RuntimeException('Invalid tnmt_type');break;
|
||||
case 0: $tnmt_type = "<font color=cyan>전력전</font>"; $tp = "tot"; $tp2 = "종합"; $tp3 = "total"; break;
|
||||
case 1: $tnmt_type = "<font color=cyan>통솔전</font>"; $tp = "ldr"; $tp2 = "통솔"; $tp3 = "leader"; break;
|
||||
case 2: $tnmt_type = "<font color=cyan>일기토</font>"; $tp = "pwr"; $tp2 = "무력"; $tp3 = "power"; break;
|
||||
@@ -48,7 +49,7 @@ $str3 = getTournamentTerm();
|
||||
<meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'>
|
||||
<title>베팅장</title>
|
||||
<style>
|
||||
body { color:white; background-color:black; border-width:1; border-color:gray; }
|
||||
body { color:white; background-color:black; border-width:1px; border-color:gray; }
|
||||
table { font-family:'맑은 고딕'; line-height:110%; }
|
||||
font { font-family:'맑은 고딕'; line-height:110%; }
|
||||
input { font-family:'맑은 고딕'; line-height:110%; height:20px }
|
||||
@@ -64,12 +65,12 @@ select { font-family:'굴림'; line-height:100%; }
|
||||
<table align=center width=1120 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg0>
|
||||
<tr><td>베 팅 장<br><?=closeButton()?></td></tr>
|
||||
</table>
|
||||
<table align=center width=1120 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:10;word-break:break-all; id=bg0>
|
||||
<table align=center width=1120 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:10px;word-break:break-all; id=bg0>
|
||||
<tr><td colspan=16><input type=button value='갱신' onclick='location.reload()'></td></tr>
|
||||
<tr><td colspan=16 align=center><font color=white size=6><?=$tnmt_type?> (<?=$str1.", ".$str2.", ".$str3?>)</font></td></tr>
|
||||
<tr><td height=50 colspan=16 align=center id=bg2><font color=limegreen size=6>16강 상황</font><br><font color=orange size=3>(전체 금액 : <?=$admin['bet']?> / 내 투자 금액 : <?=$me['bet']?>)</font></td></tr>
|
||||
</table>
|
||||
<table align=center width=1120 border=0 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:10;word-break:break-all; id=bg0>
|
||||
<table align=center width=1120 border=0 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:10px;word-break:break-all; id=bg0>
|
||||
<tr align=center><td height=10 colspan=16></td></tr>
|
||||
<tr align=center>
|
||||
<?php
|
||||
@@ -96,6 +97,7 @@ $query = "select npc,name,win from tournament where grp>=50 order by grp, grp_no
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
|
||||
$cent = [];
|
||||
$line = [];
|
||||
$gen = [];
|
||||
for ($i=0; $i < 1; $i++) {
|
||||
$cent[$i] = "<font color=white>";
|
||||
}
|
||||
|
||||
@@ -37,11 +37,11 @@ if($me['level'] < 5) {
|
||||
<tr><td>기 밀 실<br><?=backButton()?></td></tr>
|
||||
<form name=form1 method=post action=c_chiefboard.php>
|
||||
<tr><td align=center>
|
||||
제목 <input type=textarea maxlength=50 name=title style=color:white;background-color:black;width:830;>
|
||||
제목 <input type=textarea maxlength=50 name=title style=color:white;background-color:black;width:830px;>
|
||||
</td>
|
||||
</tr>
|
||||
<tr><td>
|
||||
<textarea name=msg style=color:white;background-color:black;width:998;height:200;></textarea><br>
|
||||
<textarea name=msg style=color:white;background-color:black;width:998px;height:200px;></textarea><br>
|
||||
<input type=submit value=저장하기>
|
||||
<input type=hidden name=num value=-1>
|
||||
</td></tr>
|
||||
|
||||
+28
-29
@@ -58,7 +58,7 @@ $nation = MYDB_fetch_array($result);
|
||||
|
||||
$lv = getNationChiefLevel($nation['level']);
|
||||
$turn = [];
|
||||
$gen = [];
|
||||
$gen = [[],[],[],[],[],[],[],[],[],[],[],[]];
|
||||
for($i=12; $i >= $lv; $i--) {
|
||||
$turn[$i] = getCoreTurn($nation, $i);
|
||||
|
||||
@@ -105,7 +105,6 @@ for($i=12; $i >= $lv; $i--) {
|
||||
$turntime[$i] = substr($gen[$i]['turntime'], 14);
|
||||
}
|
||||
|
||||
|
||||
//FIXME: 각 칸을 div로 놓으면 네개씩 출력하는 삽질이 필요없다.
|
||||
|
||||
for($k=0; $k < 2; $k++) {
|
||||
@@ -118,22 +117,22 @@ for($k=0; $k < 2; $k++) {
|
||||
];
|
||||
}
|
||||
|
||||
if ($gen[$l4]['npc'] >= 2) { $gen[$l4]['name'] = "<font color=cyan>".$gen[$l4]['name']."</font>"; }
|
||||
elseif($gen[$l4]['npc'] == 1) { $gen[$l4]['name'] = "<font color=skyblue>".$gen[$l4]['name']."</font>"; }
|
||||
if ($gen[$l3]['npc'] >= 2) { $gen[$l3]['name'] = "<font color=cyan>".$gen[$l3]['name']."</font>"; }
|
||||
elseif($gen[$l3]['npc'] == 1) { $gen[$l3]['name'] = "<font color=skyblue>".$gen[$l3]['name']."</font>"; }
|
||||
if ($gen[$l2]['npc'] >= 2) { $gen[$l2]['name'] = "<font color=cyan>".$gen[$l2]['name']."</font>"; }
|
||||
elseif($gen[$l2]['npc'] == 1) { $gen[$l2]['name'] = "<font color=skyblue>".$gen[$l2]['name']."</font>"; }
|
||||
if ($gen[$l1]['npc'] >= 2) { $gen[$l1]['name'] = "<font color=cyan>".$gen[$l1]['name']."</font>"; }
|
||||
elseif($gen[$l1]['npc'] == 1) { $gen[$l1]['name'] = "<font color=skyblue>".$gen[$l1]['name']."</font>"; }
|
||||
if ($gen[$l4]['npc'] >= 2) { $gen[$l4]['name'] = "<font color=cyan>".($gen[$l4]['name']??'')."</font>"; }
|
||||
elseif($gen[$l4]['npc'] == 1) { $gen[$l4]['name'] = "<font color=skyblue>".($gen[$l4]['name']??'')."</font>"; }
|
||||
if ($gen[$l3]['npc'] >= 2) { $gen[$l3]['name'] = "<font color=cyan>".($gen[$l3]['name']??'')."</font>"; }
|
||||
elseif($gen[$l3]['npc'] == 1) { $gen[$l3]['name'] = "<font color=skyblue>".($gen[$l3]['name']??'')."</font>"; }
|
||||
if ($gen[$l2]['npc'] >= 2) { $gen[$l2]['name'] = "<font color=cyan>".($gen[$l2]['name']??'')."</font>"; }
|
||||
elseif($gen[$l2]['npc'] == 1) { $gen[$l2]['name'] = "<font color=skyblue>".($gen[$l2]['name']??'')."</font>"; }
|
||||
if ($gen[$l1]['npc'] >= 2) { $gen[$l1]['name'] = "<font color=cyan>".($gen[$l1]['name']??'')."</font>"; }
|
||||
elseif($gen[$l1]['npc'] == 1) { $gen[$l1]['name'] = "<font color=skyblue>".($gen[$l1]['name']??'')."</font>"; }
|
||||
|
||||
echo "
|
||||
<tr>
|
||||
<td align=center id=bg1>.</td>
|
||||
<td colspan=2 align=center id=bg1><b>".getLevel($l4, $nation['level'])." : {$gen[$l4]['name']}</b></td>
|
||||
<td colspan=2 align=center id=bg1><b>".getLevel($l3, $nation['level'])." : {$gen[$l3]['name']}</b></td>
|
||||
<td colspan=2 align=center id=bg1><b>".getLevel($l2, $nation['level'])." : {$gen[$l2]['name']}</b></td>
|
||||
<td colspan=2 align=center id=bg1><b>".getLevel($l1, $nation['level'])." : {$gen[$l1]['name']}</b></td>
|
||||
<td colspan=2 align=center id=bg1><b>".getLevel($l4, $nation['level'])." : ".($gen[$l4]['name']??'')."</b></td>
|
||||
<td colspan=2 align=center id=bg1><b>".getLevel($l3, $nation['level'])." : ".($gen[$l3]['name']??'')."</b></td>
|
||||
<td colspan=2 align=center id=bg1><b>".getLevel($l2, $nation['level'])." : ".($gen[$l2]['name']??'')."</b></td>
|
||||
<td colspan=2 align=center id=bg1><b>".getLevel($l1, $nation['level'])." : ".($gen[$l1]['name']??'')."</b></td>
|
||||
<td align=center id=bg1>.</td>
|
||||
</tr>
|
||||
";
|
||||
@@ -144,14 +143,14 @@ for($k=0; $k < 2; $k++) {
|
||||
$turndate[$l2] = substr($totaldate[$l2]??'', 11, 5);
|
||||
$turndate[$l1] = substr($totaldate[$l1]??'', 11, 5);
|
||||
$j = $i + 1;
|
||||
$td4 = $turndate[$l4] ?: "-";
|
||||
$td3 = $turndate[$l3] ?: "-";
|
||||
$td2 = $turndate[$l2] ?: "-";
|
||||
$td1 = $turndate[$l1] ?: "-";
|
||||
$tn4 = $turn[$l4][$i] ?? "-";
|
||||
$tn3 = $turn[$l3][$i] ?? "-";
|
||||
$tn2 = $turn[$l2][$i] ?? "-";
|
||||
$tn1 = $turn[$l1][$i] ?? "-";
|
||||
$td4 = $turndate[$l4]??"-";
|
||||
$td3 = $turndate[$l3]??"-";
|
||||
$td2 = $turndate[$l2]??"-";
|
||||
$td1 = $turndate[$l1]??"-";
|
||||
$tn4 = $turn[$l4][$i]??"-";
|
||||
$tn3 = $turn[$l3][$i]??"-";
|
||||
$tn2 = $turn[$l2][$i]??"-";
|
||||
$tn1 = $turn[$l1][$i]??"-";
|
||||
echo "
|
||||
<tr>
|
||||
<td width=28 align=center id=bg0><b>$j</b></td>
|
||||
@@ -166,20 +165,20 @@ for($k=0; $k < 2; $k++) {
|
||||
<td width=28 align=center id=bg0><b>$j</b></td>
|
||||
</tr>
|
||||
";
|
||||
if($totaldate[$l4] != "") { $totaldate[$l4] = addTurn($totaldate[$l4], $admin['turnterm']); }
|
||||
if($totaldate[$l3] != "") { $totaldate[$l3] = addTurn($totaldate[$l3], $admin['turnterm']); }
|
||||
if($totaldate[$l2] != "") { $totaldate[$l2] = addTurn($totaldate[$l2], $admin['turnterm']); }
|
||||
if($totaldate[$l1] != "") { $totaldate[$l1] = addTurn($totaldate[$l1], $admin['turnterm']); }
|
||||
if($totaldate[$l4]??'') { $totaldate[$l4] = addTurn($totaldate[$l4], $admin['turnterm']); }
|
||||
if($totaldate[$l3]??'') { $totaldate[$l3] = addTurn($totaldate[$l3], $admin['turnterm']); }
|
||||
if($totaldate[$l2]??'') { $totaldate[$l2] = addTurn($totaldate[$l2], $admin['turnterm']); }
|
||||
if($totaldate[$l1]??'') { $totaldate[$l1] = addTurn($totaldate[$l1], $admin['turnterm']); }
|
||||
}
|
||||
if($k == 0) {
|
||||
echo "<form action=processing.php method=post><tr><td colspan=5 align=right>";
|
||||
echo CoreTurnTable();
|
||||
echo "</td><td colspan=5>
|
||||
<input type={$btn2} style=background-color:".GameConst::$basecolor2.";color:white;width:58;font-size:13px; value='미루기▼' onclick='turn(0)'>
|
||||
<input type={$btn2} style=background-color:".GameConst::$basecolor2.";color:white;width:58;font-size:13px; value='▲당기기' onclick='turn(1)'>
|
||||
<input type={$btn2} style=background-color:".GameConst::$basecolor2.";color:white;width:58px;font-size:13px; value='미루기▼' onclick='turn(0)'>
|
||||
<input type={$btn2} style=background-color:".GameConst::$basecolor2.";color:white;width:58px;font-size:13px; value='▲당기기' onclick='turn(1)'>
|
||||
<br>";
|
||||
CoreCommandTable();
|
||||
echo "<input type={$btn} style=background-color:".GameConst::$basecolor2.";color:white;width:55;font-size:13px; value='실 행'></td></tr></form>";
|
||||
echo "<input type={$btn} style=background-color:".GameConst::$basecolor2.";color:white;width:55px;font-size:13px; value='실 행'></td></tr></form>";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,8 @@ include "func.php";
|
||||
|
||||
$citylist = Util::getReq('citylist', 'int');
|
||||
|
||||
extractMissingPostToGlobals();
|
||||
|
||||
//로그인 검사
|
||||
$session = Session::requireGameLogin()->setReadOnly();
|
||||
$userID = Session::getUserID();
|
||||
@@ -30,7 +32,8 @@ $myNation = MYDB_fetch_array($result);
|
||||
<head>
|
||||
<title>도시정보</title>
|
||||
<meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'>
|
||||
<link rel='stylesheet' href='css/common.css' type='text/css'>
|
||||
<link href="../d_shared/common.css" rel="stylesheet">
|
||||
<link href="css/common.css" rel="stylesheet">
|
||||
|
||||
</head>
|
||||
|
||||
@@ -43,7 +46,7 @@ $myNation = MYDB_fetch_array($result);
|
||||
<tr>
|
||||
<td width=998>
|
||||
<form name=cityselect method=get>도시선택 :
|
||||
<select name=citylist size=1 style=color:white;background-color:black;width:798;>
|
||||
<select name=citylist size=1 style=color:white;background-color:black;width:798px;>
|
||||
<?php
|
||||
if(!$citylist){
|
||||
$citylist = $me['city'];
|
||||
|
||||
+2
-2
@@ -224,8 +224,8 @@ if ($budgetricediff > 0) {
|
||||
<form name=form1 method=post action=c_dipcenter.php>
|
||||
<tr><td colspan=2 height=10></td></tr>
|
||||
<tr><td colspan=2 align=center bgcolor=orange>국 가 방 침 & 임관 권유 메세지</td></tr>
|
||||
<tr><td colspan=2 id=bg1>국가 방침 <input type=text <?=$read?> maxlength=500 style=color:white;background-color:black;width:830; name=msg value='<?=$nation['msg']?>'><input type=<?=$btn?> name=btn value=국가방침></td></tr>
|
||||
<tr><td colspan=2 id=bg1>임관 권유 <input type=text <?=$read?> maxlength=500 style=color:white;background-color:black;width:830; name=scoutmsg value='<?=$nation['scoutmsg']?>'><input type=<?=$btn?> name=btn value=임관권유></td></tr>
|
||||
<tr><td colspan=2 id=bg1>국가 방침 <input type=text <?=$read?> maxlength=500 style=color:white;background-color:black;width:830px; name=msg value='<?=$nation['msg']?>'><input type=<?=$btn?> name=btn value=국가방침></td></tr>
|
||||
<tr><td colspan=2 id=bg1>임관 권유 <input type=text <?=$read?> maxlength=500 style=color:white;background-color:black;width:830px; name=scoutmsg value='<?=$nation['scoutmsg']?>'><input type=<?=$btn?> name=btn value=임관권유></td></tr>
|
||||
<tr><td colspan=2>900 x 200px 넘는 크기를 점유할 시 통보없이 제한될 수 있습니다.</td></tr>
|
||||
<tr><td colspan=2 height=10></td></tr>
|
||||
<tr><td colspan=2 align=center bgcolor=green>예 산 & 정 책</td></tr>
|
||||
|
||||
+12
-15
@@ -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 .= "<font color=cyan>◆</font> <font style=color:".newColor($nation['color']).";background-color:{$nation['color']};>{$nation['name']}</font><br>";
|
||||
$powerStr .= "국력 {$nation['power']}<br>";
|
||||
@@ -56,7 +54,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;
|
||||
}
|
||||
@@ -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 "
|
||||
<td align=center width={$width} style=background-color:{$nationcolor[$nationnum[$i]]};color:".newColor($nationcolor[$nationnum[$i]]).";>{$nationname[$nationnum[$i]]}</td>";
|
||||
<td align=center width={$width} style=background-color:".getNationStaticInfo($nationnum[$i])['color'].";color:".newColor(getNationStaticInfo($nationnum[$i])['color']).";>{$nationname[$nationnum[$i]]}</td>";
|
||||
}
|
||||
echo "
|
||||
</tr>";
|
||||
@@ -137,7 +136,7 @@ for($i=0; $i < $nationcount; $i++) {
|
||||
}
|
||||
echo "
|
||||
<tr>
|
||||
<td align=center style=background-color:{$nationcolor[$nationnum[$i]]};color:".newColor($nationcolor[$nationnum[$i]]).";>{$nationname[$nationnum[$i]]}</td>";
|
||||
<td align=center style=background-color:".getNationStaticInfo($nationnum[$i])['color'].";color:".newColor(getNationStaticInfo($nationnum[$i])['color']).";>{$nationname[$nationnum[$i]]}</td>";
|
||||
|
||||
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'
|
||||
>
|
||||
<?php foreach($conflict as $item): ?>
|
||||
@@ -212,12 +211,10 @@ for($i=0; $i < $nationcount; $i++) {
|
||||
align=right
|
||||
style='color:<?=newColor($item['color'])?>;background-color:<?=$item['color']?>;'
|
||||
><?=$item['name']?> </td>
|
||||
<td width=48 align=right><?=$item['percent']?>% </td>
|
||||
<td
|
||||
width='<?=$item['percent']?>%'
|
||||
style='background-color:<?=$item['color']?>;'
|
||||
></td>
|
||||
<td width=*></td>
|
||||
<td width=48 align=right><?=(float)$item['percent']?> % </td>
|
||||
<td width=*><div
|
||||
style='display:inline-block;width:<?=$item['percent']?>%;background-color:<?=$item['color']?>;'
|
||||
> </div></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</table>
|
||||
|
||||
+6
-4
@@ -4,7 +4,12 @@ namespace sammo;
|
||||
include "lib.php";
|
||||
include "func.php";
|
||||
|
||||
$type = Util::getReq('type', 'int');
|
||||
$type = Util::getReq('type', 'int', 7);
|
||||
if ($type <= 0 || $type > 8) {
|
||||
$type = 7;
|
||||
}
|
||||
|
||||
extractMissingPostToGlobals();
|
||||
|
||||
//로그인 검사
|
||||
$session = Session::requireGameLogin()->setReadOnly();
|
||||
@@ -38,9 +43,6 @@ if ($me['level'] == 0 || ($me['level'] == 1 && $me['belong'] < $nation['secretli
|
||||
exit();
|
||||
}
|
||||
|
||||
if ($type == 0) {
|
||||
$type = 7;
|
||||
}
|
||||
$sel = [];
|
||||
$sel[$type] = "selected";
|
||||
|
||||
|
||||
+10
-10
@@ -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);
|
||||
?>
|
||||
<tr>
|
||||
<td width=98 align=center id=bg1><font size=4>".getLevel($i1, $nation['level'])."</font></td>
|
||||
<td width=64 height=64 background={$imageTemp1}/{$level[$i1]['picture']}> </td>
|
||||
<td width=332><font size=4>";echo $level[$i1]['name']==''?"-":$level[$i1]['name']; echo " ({$level[$i1]['belong']}년)</font></td>
|
||||
<td width=98 align=center id=bg1><font size=4>".getLevel($i2, $nation['level'])."</font></td>
|
||||
<td width=64 height=64 background={$imageTemp2}/{$level[$i2]['picture']}> </td>
|
||||
<td width=332><font size=4>";echo $level[$i2]['name']==''?"-":$level[$i2]['name']; echo " ({$level[$i2]['belong']}년)</font></td>
|
||||
<td width=98 align=center id=bg1><font size=4><?=getLevel($i1, $nation['level'])?></font></td>
|
||||
<td width=64 height=64 style='background:no-repeat center url("<?=$imageTemp1?>/<?=$level[$i1]['picture']??'default.jpg'?>");background-size:64px;'></td>
|
||||
<td width=332><font size=4><?=$level[$i1]['name']??'-'?>(<?=$level[$i1]['belong']??'-'?>년)</font></td>
|
||||
<td width=98 align=center id=bg1><font size=4><?=getLevel($i2, $nation['level'])?></font></td>
|
||||
<td width=64 height=64 style='background:no-repeat center url("<?=$imageTemp2?>/<?=$level[$i2]['picture']??'default.jpg'?>");background-size:64px;'></td>
|
||||
<td width=332><font size=4><?=$level[$i2]['name']??'-'?>(<?=$level[$i2]['belong']??'-'?>년)</font></td>
|
||||
</tr>
|
||||
";
|
||||
<?php
|
||||
}
|
||||
|
||||
echo "
|
||||
|
||||
+22
-15
@@ -3,6 +3,14 @@ namespace sammo;
|
||||
|
||||
include "lib.php";
|
||||
include "func.php";
|
||||
|
||||
$type = Util::getReq('type', 'int', 10);
|
||||
if ($type <= 0 || $type > 12) {
|
||||
$type = 10;
|
||||
}
|
||||
|
||||
extractMissingPostToGlobals();
|
||||
|
||||
//로그인 검사
|
||||
$session = Session::requireGameLogin()->setReadOnly();
|
||||
$userID = Session::getUserID();
|
||||
@@ -21,9 +29,6 @@ if ($me['level'] == 0) {
|
||||
exit();
|
||||
}
|
||||
|
||||
if ($type == 0) {
|
||||
$type = 10;
|
||||
}
|
||||
$sel = [$type => "selected"];
|
||||
|
||||
?>
|
||||
@@ -66,19 +71,21 @@ $me = MYDB_fetch_array($result);
|
||||
|
||||
$nation = getNationStaticInfo($me['nation']); //국가정보
|
||||
|
||||
$query = "select *,pop/pop2 as poprate from city where nation='{$me['nation']}'";
|
||||
|
||||
switch ($type) {
|
||||
case 1: $query = "select *,pop/pop2 as poprate from city where nation='{$me['nation']}'"; break;
|
||||
case 2: $query = "select *,pop/pop2 as poprate from city where nation='{$me['nation']}' order by pop desc"; break;
|
||||
case 3: $query = "select *,pop/pop2 as poprate from city where nation='{$me['nation']}' order by poprate desc"; break;
|
||||
case 4: $query = "select *,pop/pop2 as poprate from city where nation='{$me['nation']}' order by rate desc"; break;
|
||||
case 5: $query = "select *,pop/pop2 as poprate from city where nation='{$me['nation']}' order by agri desc"; break;
|
||||
case 6: $query = "select *,pop/pop2 as poprate from city where nation='{$me['nation']}' order by comm desc"; break;
|
||||
case 7: $query = "select *,pop/pop2 as poprate from city where nation='{$me['nation']}' order by secu desc"; break;
|
||||
case 8: $query = "select *,pop/pop2 as poprate from city where nation='{$me['nation']}' order by def desc"; break;
|
||||
case 9: $query = "select *,pop/pop2 as poprate from city where nation='{$me['nation']}' order by wall desc"; break;
|
||||
case 10: $query = "select *,pop/pop2 as poprate from city where nation='{$me['nation']}' order by trade desc"; break;
|
||||
case 11: $query = "select *,pop/pop2 as poprate from city where nation='{$me['nation']}' order by region,level desc"; break;
|
||||
case 12: $query = "select *,pop/pop2 as poprate from city where nation='{$me['nation']}' order by level desc, region"; break;
|
||||
case 1: break;
|
||||
case 2: $query .= " order by pop desc"; break;
|
||||
case 3: $query .= " order by poprate desc"; break;
|
||||
case 4: $query .= " order by rate desc"; break;
|
||||
case 5: $query .= " order by agri desc"; break;
|
||||
case 6: $query .= " order by comm desc"; break;
|
||||
case 7: $query .= " order by secu desc"; break;
|
||||
case 8: $query .= " order by def desc"; break;
|
||||
case 9: $query .= " order by wall desc"; break;
|
||||
case 10: $query .= " order by trade desc"; break;
|
||||
case 11: $query .= " order by region,level desc"; break;
|
||||
case 12: $query .= " order by level desc, region"; break;
|
||||
}
|
||||
$cityresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
|
||||
$citycount = MYDB_num_rows($cityresult);
|
||||
|
||||
+7
-6
@@ -4,7 +4,12 @@ namespace sammo;
|
||||
include "lib.php";
|
||||
include "func.php";
|
||||
|
||||
$type = Util::getReq('type', 'int');
|
||||
$type = Util::getReq('type', 'int', 1);
|
||||
if($type <= 0 || $type > 15) {
|
||||
$type = 1;
|
||||
}
|
||||
|
||||
extractMissingPostToGlobals();
|
||||
|
||||
//로그인 검사
|
||||
$session = Session::requireGameLogin()->setReadOnly();
|
||||
@@ -24,10 +29,6 @@ if($me['level'] == 0) {
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
if($type == 0) {
|
||||
$type = 1;
|
||||
}
|
||||
$sel = [$type => "selected"];
|
||||
|
||||
?>
|
||||
@@ -167,7 +168,7 @@ for($j=0; $j < $gencount; $j++) {
|
||||
$imageTemp = GetImageURL($general['imgsvr']);
|
||||
echo "
|
||||
<tr>
|
||||
<td align=center background={$imageTemp}/{$general['picture']} height=64></td>
|
||||
<td align=center style='background:no-repeat center url(\"{$imageTemp}/{$general['picture']}\");background-size:64px;' height=64></td>
|
||||
<td align=center>$name</td>
|
||||
<td align=center>"; echo getLevel($general['level'], $nationLevel); echo "</td>
|
||||
<td align=center>".getDed($general['dedication'])."</td>
|
||||
|
||||
+19
-2
@@ -5,6 +5,23 @@ include "lib.php";
|
||||
include "func.php";
|
||||
|
||||
$btn = Util::getReq('btn');
|
||||
$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;
|
||||
}
|
||||
|
||||
if($mode < 0 || $mode > 2){
|
||||
$mode = 2;
|
||||
}
|
||||
|
||||
if($tnmt < 0 || $tnmt > 1){
|
||||
$tnmt = 1;
|
||||
}
|
||||
|
||||
//로그인 검사
|
||||
$session = Session::requireGameLogin()->setReadOnly();
|
||||
@@ -89,11 +106,11 @@ function go(type) {
|
||||
<input type=radio name=mode value=1 <?=$me['mode']==1?"checked":""; ?>>○(훈사60)
|
||||
<input type=radio name=mode value=0 <?=$me['mode']==0?"checked":""; ?>>×
|
||||
】<br><br>
|
||||
<input type=<?=$submit?> name=btn style=background-color:<?=GameConst::$basecolor2?>;color:white;width:160;height:30;font-size:13px; value=설정저장><br>
|
||||
<input type=<?=$submit?> name=btn style=background-color:<?=GameConst::$basecolor2?>;color:white;width:160px;height:30px;font-size:13px; value=설정저장><br>
|
||||
∞<font color=orange>설정저장은 이달중 <?=$me['myset']?>회 남았습니다.</font><br><br>
|
||||
</form>
|
||||
휴 가 신 청<br>
|
||||
<input type=button style=background-color:<?=GameConst::$basecolor2?>;color:white;width:160;height:30;font-size:13px; value=휴가신청 onclick='go(0)'>
|
||||
<input type=button style=background-color:<?=GameConst::$basecolor2?>;color:white;width:160px;height:30px;font-size:13px; value=휴가신청 onclick='go(0)'>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
||||
@@ -32,11 +32,11 @@ $me = MYDB_fetch_array($result);
|
||||
<tr><td>회 의 실<br><?=backButton()?></td></tr>
|
||||
<form name=form1 method=post action=c_nationboard.php>
|
||||
<tr><td align=center>
|
||||
제목 <input type=textarea maxlength=50 name=title style=color:white;background-color:black;width:830;>
|
||||
제목 <input type=textarea maxlength=50 name=title style=color:white;background-color:black;width:830px;>
|
||||
</td>
|
||||
</tr>
|
||||
<tr><td>
|
||||
<textarea name=msg style=color:white;background-color:black;width:998;height:200;></textarea><br>
|
||||
<textarea name=msg style=color:white;background-color:black;width:998px;height:200px;></textarea><br>
|
||||
<input type=submit value=저장하기>
|
||||
<input type=hidden name=num value=-1>
|
||||
</td></tr>
|
||||
|
||||
@@ -39,12 +39,12 @@ $nation = MYDB_fetch_array($result);
|
||||
if($me['level'] >= 5) {
|
||||
echo "
|
||||
<form name=form1 method=post action=c_nationrule.php>
|
||||
<textarea name=msg style=color:white;background-color:black;width:998;height:500;>{$nation['rule']}</textarea><br>
|
||||
<textarea name=msg style=color:white;background-color:black;width:998px;height:500px;>{$nation['rule']}</textarea><br>
|
||||
<input type=submit value=저장하기>
|
||||
</form>";
|
||||
} else {
|
||||
echo "
|
||||
<textarea name=msg style=color:white;background-color:black;width:998;height:500; readonly>{$nation['rule']}</textarea><br>";
|
||||
<textarea name=msg style=color:white;background-color:black;width:998px;height:500px; readonly>{$nation['rule']}</textarea><br>";
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -28,6 +28,7 @@ if ($con >= 2) {
|
||||
}
|
||||
|
||||
switch ($admin['tnmt_type']) {
|
||||
default: throw new \RuntimeException('invalid tnmt_type');
|
||||
case 0: $tnmt_type = "<font color=cyan>전력전</font>"; $tp = "tot"; $tp2 = "종합"; $tp3 = "total"; break;
|
||||
case 1: $tnmt_type = "<font color=cyan>통솔전</font>"; $tp = "ldr"; $tp2 = "통솔"; $tp3 = "leader"; break;
|
||||
case 2: $tnmt_type = "<font color=cyan>일기토</font>"; $tp = "pwr"; $tp2 = "무력"; $tp3 = "power"; break;
|
||||
@@ -44,7 +45,7 @@ case 3: $tnmt_type = "<font color=cyan>설전</font>"; $tp = "itl"; $tp2 = "
|
||||
<meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'>
|
||||
<title>토너먼트</title>
|
||||
<style>
|
||||
body { color:white; background-color:black; border-width:1; border-color:gray; }
|
||||
body { color:white; background-color:black; border-width:1px; border-color:gray; }
|
||||
table { font-family:'맑은 고딕'; line-height:110%; }
|
||||
font { font-family:'맑은 고딕'; line-height:110%; }
|
||||
input { font-family:'맑은 고딕'; line-height:110%; height:20px }
|
||||
@@ -219,6 +220,7 @@ for ($i=0; $i < 1; $i++) {
|
||||
$cent[$i] = "<font color=white>";
|
||||
}
|
||||
$line = [];
|
||||
$gen = [];
|
||||
for ($i=0; $i < 2; $i++) {
|
||||
//FIXME: 다시 작성. null인 경우엔 어쩌려고?
|
||||
$general = MYDB_fetch_array($result) ?? [
|
||||
|
||||
+4
-4
@@ -82,7 +82,7 @@ for($i=0; $i < $troopcount; $i++) {
|
||||
<tr>
|
||||
<td align=center rowspan=2><input "; echo $i==0?"checked ":""; echo "type=radio name=troop value='{$troop['troop']}'></td>
|
||||
<td align=center >{$troop['name']}<br>【 $cityname 】</td>
|
||||
<td height=64 background={$imageTemp}/{$picture}> </td>
|
||||
<td height=64 style='background:no-repeat center url(\"{$imageTemp}/{$picture}\");background-size:64px;'> </td>
|
||||
<td rowspan=2 width=662>$genlist</td>
|
||||
<td rowspan=2>$turn</td>
|
||||
</tr>
|
||||
@@ -93,7 +93,7 @@ for($i=0; $i < $troopcount; $i++) {
|
||||
<tr>
|
||||
<td align=center rowspan=2> </td>
|
||||
<td align=center >{$troop['name']}<br>【 $cityname 】</td>
|
||||
<td height=64 background={$imageTemp}/{$picture}> </td>
|
||||
<td height=64 style='background:no-repeat center url(\"{$imageTemp}/{$picture}\");background-size:64px;'> </td>
|
||||
<td rowspan=2 width=662>$genlist</td>
|
||||
<td rowspan=2>";
|
||||
|
||||
@@ -102,7 +102,7 @@ for($i=0; $i < $troopcount; $i++) {
|
||||
$genresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$genCount = MYDB_num_rows($genresult);
|
||||
echo "
|
||||
<select name=gen size=3 style=color:white;background-color:black;font-size:13px;width:98;>";
|
||||
<select name=gen size=3 style=color:white;background-color:black;font-size:13px;width:98px;>";
|
||||
for($k=0; $k < $genCount; $k++) {
|
||||
$general = MYDB_fetch_array($genresult);
|
||||
echo "
|
||||
@@ -110,7 +110,7 @@ for($i=0; $i < $troopcount; $i++) {
|
||||
}
|
||||
echo "
|
||||
</select><br>
|
||||
<input type=submit name=btn value='부 대 추 방' style=width:100;height:25;>";
|
||||
<input type=submit name=btn value='부 대 추 방' style=width:100px;height:25px;>";
|
||||
} else {
|
||||
echo $turn;
|
||||
}
|
||||
|
||||
@@ -24,6 +24,11 @@ $term = Util::getReq('term', 'int');
|
||||
$stuff = Util::getReq('stuff', 'int');
|
||||
$sel = Util::getReq('sel', 'int');
|
||||
|
||||
$msg = '';
|
||||
$msg2 = '';
|
||||
|
||||
extractMissingPostToGlobals();
|
||||
|
||||
//로그인 검사
|
||||
$session = Session::requireGameLogin()->setReadOnly();
|
||||
$userID = Session::getUserID();
|
||||
|
||||
@@ -7,6 +7,7 @@ include "func.php";
|
||||
|
||||
// $btn0~15, $gold0~15
|
||||
|
||||
//FIXME: 으악!!!!! 왜?! idx를 지정하고 gold를 지정하라고!
|
||||
$betTarget = -1;
|
||||
$betGold = -1;
|
||||
for($i=0;$i<16;$i++){
|
||||
@@ -21,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();
|
||||
|
||||
+35
-30
@@ -6,10 +6,12 @@ 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
|
||||
|
||||
extractMissingPostToGlobals();
|
||||
|
||||
//로그인 검사
|
||||
$session = Session::requireGameLogin()->setReadOnly();
|
||||
$userID = Session::getUserID();
|
||||
@@ -17,39 +19,42 @@ $userID = Session::getUserID();
|
||||
$db = DB::db();
|
||||
$connect=$db->get();
|
||||
|
||||
if(getBlockLevel() != 1 && getBlockLevel() != 3) {
|
||||
$query = "select no,nation from general where owner='{$userID}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$me = MYDB_fetch_array($result);
|
||||
if (getBlockLevel() == 1 || getBlockLevel() == 3) {
|
||||
header('location:b_chiefboard.php');
|
||||
die();
|
||||
}
|
||||
|
||||
$title = str_replace("|", " ", $title);
|
||||
$msg = str_replace("|", " ", $msg);
|
||||
$reply = str_replace("|", " ", $reply);
|
||||
$title = trim($title);
|
||||
$msg = trim($msg);
|
||||
$reply = trim($reply);
|
||||
$query = "select no,nation from general where owner='{$userID}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$me = MYDB_fetch_array($result);
|
||||
|
||||
$nation = getNation($me['nation']);
|
||||
$title = str_replace("|", " ", $title);
|
||||
$msg = str_replace("|", " ", $msg);
|
||||
$reply = str_replace("|", " ", $reply);
|
||||
$title = trim($title);
|
||||
$msg = trim($msg);
|
||||
$reply = trim($reply);
|
||||
|
||||
//새글 추가시
|
||||
if($num == -1 && $title != "" && $msg != "") {
|
||||
$num = $nation['coreindex'] + 1;
|
||||
if($num >= 20) { $num = 0; }
|
||||
$msg = $title."|".$msg;
|
||||
$msg = addslashes(SQ2DQ($msg));
|
||||
$date = date('Y-m-d H:i:s');
|
||||
$query = "update nation set coreboard{$num}='$msg',coreboard{$num}_who='{$me['no']}',coreboard{$num}_when='$date' where nation='{$me['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$query = "update nation set coreindex='$num' where nation='{$me['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
//$num에 댓글시
|
||||
} elseif($num >= 0 && $reply != "") {
|
||||
$newmsg = $nation["coreboard{$num}"]."|".$me['no']."|".$reply;
|
||||
$newmsg = addslashes(SQ2DQ($newmsg));
|
||||
$nation = getNation($me['nation']);
|
||||
|
||||
$query = "update nation set coreboard{$num}='$newmsg' where nation='{$me['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
}
|
||||
//새글 추가시
|
||||
if($num == -1 && $title != "" && $msg != "") {
|
||||
$num = $nation['coreindex'] + 1;
|
||||
if($num >= 20) { $num = 0; }
|
||||
$msg = $title."|".$msg;
|
||||
$msg = addslashes(SQ2DQ($msg));
|
||||
$date = date('Y-m-d H:i:s');
|
||||
$query = "update nation set coreboard{$num}='$msg',coreboard{$num}_who='{$me['no']}',coreboard{$num}_when='$date' where nation='{$me['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$query = "update nation set coreindex='$num' where nation='{$me['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
//$num에 댓글시
|
||||
} elseif($num >= 0 && $reply != "") {
|
||||
$newmsg = $nation["coreboard{$num}"]."|".$me['no']."|".$reply;
|
||||
$newmsg = addslashes(SQ2DQ($newmsg));
|
||||
|
||||
$query = "update nation set coreboard{$num}='$newmsg' where nation='{$me['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
}
|
||||
|
||||
header('location:b_chiefboard.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();
|
||||
|
||||
+2
-3
@@ -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];
|
||||
}
|
||||
@@ -33,9 +35,6 @@ if($command < 0) { $command = 0; }
|
||||
if($double < 0) { $double = 0; }
|
||||
if($third < 0) { $third = 0; }
|
||||
if($fourth < 0) { $fourth = 0; }
|
||||
$double = Util::round($double);
|
||||
$third = Util::round($third);
|
||||
$fourth = Util::round($fourth);
|
||||
if($command > 99) { $command = 0; }
|
||||
if($double > 9999) { $double = 9999; }
|
||||
if($third > 9999) { $third = 9999; }
|
||||
|
||||
@@ -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();
|
||||
@@ -43,6 +45,11 @@ if($btn == "임명") {
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$general = MYDB_fetch_array($result);
|
||||
|
||||
if(!$general){
|
||||
header('location:b_myBossInfo.php');
|
||||
exit();
|
||||
}
|
||||
|
||||
//임명할사람이 군주이면 불가, 내가 수뇌부이어야함, 공석아닌때는 국가가 같아야함
|
||||
if($general['level'] == 12 || $meLevel < 5 || ($general['nation'] != $me['nation'] && $genlist != 0)) {
|
||||
|
||||
@@ -54,6 +61,11 @@ if($btn == "임명") {
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$general = MYDB_fetch_array($result);
|
||||
|
||||
if(!$general){
|
||||
header('location:b_myBossInfo.php');
|
||||
exit();
|
||||
}
|
||||
|
||||
//추방할사람이 군주이면 불가, 내가 수뇌부이어야함, 공석아닌때는 국가가 같아야함
|
||||
if($general['level'] == 12 || $meLevel < 5 || ($general['nation'] != $me['nation'] && $outlist != 0)) {
|
||||
header('location:b_myBossInfo.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();
|
||||
|
||||
@@ -4,6 +4,9 @@ namespace sammo;
|
||||
include "lib.php";
|
||||
include "func.php";
|
||||
// $msg
|
||||
$msg = Util::getReq('msg');
|
||||
|
||||
extractMissingPostToGlobals();
|
||||
|
||||
//로그인 검사
|
||||
$session = Session::requireGameLogin()->setReadOnly();
|
||||
|
||||
+93
-37
@@ -6,12 +6,15 @@ include "func.php";
|
||||
// $btn, $msg
|
||||
$btn = Util::getReq('btn');
|
||||
$msg = Util::getReq('msg');
|
||||
$gen = Util::getReq('gen', 'int');
|
||||
$sel = Util::getReq('sel', 'int');
|
||||
|
||||
//관리자용
|
||||
$auto = Util::getReq('gen', 'int');
|
||||
$auto = Util::getReq('auto', 'int');
|
||||
$type = Util::getReq('type', 'int');
|
||||
$gen = Util::getReq('gen', 'int');
|
||||
$sel = Util::getReq('sel', 'int');
|
||||
$trig = Util::getReq('trig', 'int');
|
||||
|
||||
extractMissingPostToGlobals();
|
||||
|
||||
//로그인 검사
|
||||
$session = Session::requireGameLogin()->setReadOnly();
|
||||
@@ -35,22 +38,71 @@ case 2: $tp = "power"; $tp2 = "일기토"; $tp3 = "power"; break;
|
||||
case 3: $tp = "intel"; $tp2 = "설전"; $tp3 = "intel"; break;
|
||||
}
|
||||
|
||||
if($me['tournament'] == 1 && $session->userGrade < 5) {
|
||||
header('locatoin:b_tournament.php');
|
||||
if($btn == '참가') {
|
||||
$query = "select no,name,npc,leader,power,intel,explevel,gold,horse,weap,book from general where no='{$me['no']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$general = MYDB_fetch_array($result);
|
||||
|
||||
//{$admin['develcost']}원 참가비
|
||||
if($general['gold'] < $admin['develcost']) {
|
||||
header('location:b_tournament.php');
|
||||
exit(1);
|
||||
}
|
||||
$general['gold'] -= $admin['develcost'];
|
||||
|
||||
$query = "select grp from tournament where grp<10 group by grp having count(*)=8";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$grpCount = MYDB_num_rows($result);
|
||||
$occupied = [];
|
||||
for($i=0; $i < $grpCount; $i++) {
|
||||
$grp = MYDB_fetch_array($result);
|
||||
$occupied[$grp['grp']] = 1;
|
||||
}
|
||||
$map = [];
|
||||
for($i=0; $i < 8; $i++) {
|
||||
if($occupied[$i] == 0) {
|
||||
$map[] = $i;
|
||||
}
|
||||
}
|
||||
|
||||
if($grpCount < 8) {
|
||||
$grp = $map[rand() % count($map)];
|
||||
$query = "select grp from tournament where grp='$grp'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$grpCount = MYDB_num_rows($result);
|
||||
$query = "insert into tournament (no, npc, name, ldr, pwr, itl, lvl, grp, grp_no, h, w, b) values ('{$general['no']}', '{$general['npc']}', '{$general['name']}', '{$general['leader']}', '{$general['power']}', '{$general['intel']}', '{$general['explevel']}', '$grp', '$grpCount', '{$general['horse']}', '{$general['weap']}', '{$general['book']}')";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$query = "update general set tournament=1,gold='{$general['gold']}' where no='{$general['no']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
}
|
||||
|
||||
$query = "select grp from tournament where grp<10 group by grp having count(*)=8";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$grpCount = MYDB_num_rows($result);
|
||||
if($grpCount >= 8) {
|
||||
$query = "update game set tournament=2, phase=0";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
}
|
||||
header('location:b_tournament.php');
|
||||
die();
|
||||
}
|
||||
|
||||
if($session->userGrade < 5) {
|
||||
header('location:b_tournament.php');
|
||||
exit();
|
||||
}
|
||||
|
||||
if($btn == "자동개최설정" && $session->userGrade >= 5) {
|
||||
if($btn == "자동개최설정") {
|
||||
$db->update('game', ['tnmt_trig'=>$trig], true);
|
||||
} elseif($btn == "개최" && $session->userGrade >= 5) {
|
||||
} elseif($btn == "개최") {
|
||||
startTournament($auto, $type);
|
||||
} elseif($btn == "중단" && $session->userGrade >= 5) {
|
||||
} elseif($btn == "중단") {
|
||||
$db->update('game', [
|
||||
'tnmt_auto'=>0,
|
||||
'tournament'=>0,
|
||||
'phase'=>0
|
||||
], true);
|
||||
} elseif((($btn == "투입" || $btn == "무명투입" || $btn == "쪼렙투입" || $btn == "일반투입" || $btn == "굇수투입" || $btn == "랜덤투입") && $session->userGrade >= 5) || $btn == "참가") {
|
||||
} elseif($btn == "투입" || $btn == "무명투입" || $btn == "쪼렙투입" || $btn == "일반투입" || $btn == "굇수투입" || $btn == "랜덤투입") {
|
||||
if($btn == "투입") {
|
||||
$query = "select no,name,npc,leader,power,intel,explevel,gold,horse,weap,book from general where no='$gen'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
@@ -100,17 +152,6 @@ if($btn == "자동개최설정" && $session->userGrade >= 5) {
|
||||
$general = MYDB_fetch_array($result);
|
||||
$general['gold'] -= $admin['develcost'];
|
||||
//참가
|
||||
} else {
|
||||
$query = "select no,name,npc,leader,power,intel,explevel,gold,horse,weap,book from general where no='{$me['no']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$general = MYDB_fetch_array($result);
|
||||
|
||||
//{$admin['develcost']}원 참가비
|
||||
if($general['gold'] < $admin['develcost']) {
|
||||
header('location:b_tournament.php');
|
||||
exit(1);
|
||||
}
|
||||
$general['gold'] -= $admin['develcost'];
|
||||
}
|
||||
|
||||
$query = "select grp from tournament where grp<10 group by grp having count(*)=8";
|
||||
@@ -146,7 +187,8 @@ if($btn == "자동개최설정" && $session->userGrade >= 5) {
|
||||
$query = "update game set tournament=2, phase=0";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
}
|
||||
} elseif(($btn == "쪼렙전부투입" || $btn == "일반전부투입" || $btn == "굇수전부투입" || $btn == "랜덤전부투입") && $session->userGrade >= 5) {
|
||||
|
||||
} elseif($btn == "쪼렙전부투입" || $btn == "일반전부투입" || $btn == "굇수전부투입" || $btn == "랜덤전부투입") {
|
||||
$z = 0;
|
||||
$code = [];
|
||||
for($i=0; $i < 8; $i++) {
|
||||
@@ -201,25 +243,39 @@ if($btn == "자동개최설정" && $session->userGrade >= 5) {
|
||||
|
||||
$query = "update game set tournament=2, phase=0";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
} elseif($btn == "무명전부투입" && $session->userGrade >= 5) { fillLowGenAll();
|
||||
} elseif($btn == "예선" && $session->userGrade >= 5) { qualify($admin['tnmt_type'], $admin['tournament'], $admin['phase']);
|
||||
} elseif($btn == "예선전부" && $session->userGrade >= 5) { qualifyAll($admin['tnmt_type'], $admin['tournament'], $admin['phase']);
|
||||
} elseif($btn == "추첨" && $session->userGrade >= 5) { selection($admin['tnmt_type'], $admin['tournament'], $admin['phase']);
|
||||
} elseif($btn == "추첨전부" && $session->userGrade >= 5) { selectionAll($admin['tnmt_type'], $admin['tournament'], $admin['phase']);
|
||||
} elseif($btn == "본선" && $session->userGrade >= 5) { finallySingle($admin['tnmt_type'], $admin['tournament'], $admin['phase']);
|
||||
} elseif($btn == "본선전부" && $session->userGrade >= 5) { finallyAll($admin['tnmt_type'], $admin['tournament'], $admin['phase']);
|
||||
} elseif($btn == "배정" && $session->userGrade >= 5) { final16set();
|
||||
} elseif($btn == "베팅마감" && $session->userGrade >= 5) {
|
||||
} elseif($btn == "무명전부투입") {
|
||||
fillLowGenAll();
|
||||
} elseif($btn == "예선") {
|
||||
qualify($admin['tnmt_type'], $admin['tournament'], $admin['phase']);
|
||||
} elseif($btn == "예선전부") {
|
||||
qualifyAll($admin['tnmt_type'], $admin['tournament'], $admin['phase']);
|
||||
} elseif($btn == "추첨") {
|
||||
selection($admin['tnmt_type'], $admin['tournament'], $admin['phase']);
|
||||
} elseif($btn == "추첨전부") {
|
||||
selectionAll($admin['tnmt_type'], $admin['tournament'], $admin['phase']);
|
||||
} elseif($btn == "본선") {
|
||||
finallySingle($admin['tnmt_type'], $admin['tournament'], $admin['phase']);
|
||||
} elseif($btn == "본선전부") {
|
||||
finallyAll($admin['tnmt_type'], $admin['tournament'], $admin['phase']);
|
||||
} elseif($btn == "배정") {
|
||||
final16set();
|
||||
} elseif($btn == "베팅마감") {
|
||||
$dt = date("Y-m-d H:i:s", time() + 60);
|
||||
$query = "update game set tournament='7',phase='0',tnmt_time='$dt'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
} elseif($btn == "16강" && $session->userGrade >= 5) { finalFight($admin['tnmt_type'], $admin['tournament'], $admin['phase'], 16);
|
||||
} elseif($btn == "8강" && $session->userGrade >= 5) { finalFight($admin['tnmt_type'], $admin['tournament'], $admin['phase'], 8);
|
||||
} elseif($btn == "4강" && $session->userGrade >= 5) { finalFight($admin['tnmt_type'], $admin['tournament'], $admin['phase'], 4);
|
||||
} elseif($btn == "결승" && $session->userGrade >= 5) { finalFight($admin['tnmt_type'], $admin['tournament'], $admin['phase'], 2);
|
||||
} elseif($btn == "포상" && $session->userGrade >= 5) { setGift($admin['tnmt_type'], $admin['tournament'], $admin['phase']);
|
||||
} elseif($btn == "회수" && $session->userGrade >= 5) { setRefund();
|
||||
} elseif($btn == "메시지" && $session->userGrade >= 5) {
|
||||
} elseif($btn == "16강") {
|
||||
finalFight($admin['tnmt_type'], $admin['tournament'], $admin['phase'], 16);
|
||||
} elseif($btn == "8강") {
|
||||
finalFight($admin['tnmt_type'], $admin['tournament'], $admin['phase'], 8);
|
||||
} elseif($btn == "4강") {
|
||||
finalFight($admin['tnmt_type'], $admin['tournament'], $admin['phase'], 4);
|
||||
} elseif($btn == "결승") {
|
||||
finalFight($admin['tnmt_type'], $admin['tournament'], $admin['phase'], 2);
|
||||
} elseif($btn == "포상") {
|
||||
setGift($admin['tnmt_type'], $admin['tournament'], $admin['phase']);
|
||||
} elseif($btn == "회수") {
|
||||
setRefund();
|
||||
} elseif($btn == "메시지") {
|
||||
$msg = addslashes(SQ2DQ($msg));
|
||||
$query = "update game set tnmt_msg='$msg'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
|
||||
+6
-3
@@ -6,8 +6,11 @@ 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();
|
||||
|
||||
//로그인 검사
|
||||
$session = Session::requireGameLogin()->setReadOnly();
|
||||
$userID = $session::getUserID();
|
||||
@@ -17,7 +20,6 @@ $db = DB::db();
|
||||
$me = $db->queryFirstRow('SELECT `no`, nation, troop FROM general WHERE `owner`=%i', $userID);
|
||||
|
||||
$name = trim($name);
|
||||
$name = addslashes(SQ2DQ($name));
|
||||
if($btn == "부 대 창 설" && $name != "" && $me['troop'] == 0) {
|
||||
$db->insert('troop',[
|
||||
'name'=>$name,
|
||||
@@ -38,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']);
|
||||
|
||||
+2
-3
@@ -10,6 +10,8 @@ $comment = Util::getReq('comment');
|
||||
$title = Util::getReq('title');
|
||||
$str = Util::getReq('str');
|
||||
|
||||
extractMissingPostToGlobals();
|
||||
|
||||
//로그인 검사
|
||||
$session = Session::requireGameLogin()->setReadOnly();
|
||||
$userID = Session::getUserID();
|
||||
@@ -41,9 +43,6 @@ else if($btn == "댓글" && $comment != "") {
|
||||
$comment = addslashes(SQ2DQ($comment));
|
||||
|
||||
$nation = getNationStaticInfo($me['nation']);
|
||||
if($nation == null) {
|
||||
$nation = ['name' => "재야"];
|
||||
}
|
||||
|
||||
if($admin['votecomment'] != "") { $admin['votecomment'] .= "|"; }
|
||||
$admin['votecomment'] .= "{$nation['name']}:{$me['name']}:{$comment}";
|
||||
|
||||
+147
@@ -0,0 +1,147 @@
|
||||
@charset "UTF-8";
|
||||
|
||||
/*임시용 */
|
||||
|
||||
#container{
|
||||
width:1000px;
|
||||
margin:auto;
|
||||
font-size:13px;
|
||||
}
|
||||
/*임시용 끝*/
|
||||
|
||||
#message_board section{
|
||||
overflow-y:auto;
|
||||
overflow-x:hidden;
|
||||
max-width:498px;
|
||||
}
|
||||
|
||||
.msg_plate{
|
||||
width:100%;
|
||||
border-bottom:groove 0.1em;
|
||||
border-left:groove 0.1em;
|
||||
border-right:groove 0.1em;
|
||||
height:64px;
|
||||
font-size:12px;
|
||||
word-break:break-all;
|
||||
color:white;
|
||||
}
|
||||
|
||||
.msg_plate_private{
|
||||
background-color:#5d1e1a;
|
||||
}
|
||||
|
||||
.msg_plate_public{
|
||||
background-color:#141c65;
|
||||
|
||||
}
|
||||
|
||||
.msg_plate_national, .msg_plate_diplomacy{
|
||||
background-color:#00582c;
|
||||
|
||||
}
|
||||
|
||||
.public_message{
|
||||
height:667px;
|
||||
}
|
||||
|
||||
.private_message{
|
||||
height:667px;
|
||||
}
|
||||
|
||||
.national_message{
|
||||
height:1350px;
|
||||
}
|
||||
|
||||
.msg_icon{
|
||||
float:left;
|
||||
width:64px;
|
||||
height:64px;
|
||||
border-right:groove 0.1em;
|
||||
}
|
||||
|
||||
.msg_time{
|
||||
font-size:0.75em;
|
||||
font-weight:normal;
|
||||
}
|
||||
|
||||
.msg_header{
|
||||
font-weight: bold;
|
||||
margin-bottom:3px;
|
||||
color:white;
|
||||
}
|
||||
|
||||
#msg_input{
|
||||
color:white;
|
||||
background-color:black;
|
||||
font-size:12px;
|
||||
width:720px;
|
||||
height:15px;
|
||||
}
|
||||
|
||||
#mailbox_list{
|
||||
color:white;
|
||||
background-color:black;
|
||||
font-size:12px;
|
||||
width:160px;
|
||||
}
|
||||
|
||||
.board_header{
|
||||
color:white;
|
||||
border:groove 0.1em;
|
||||
}
|
||||
|
||||
.board_side{
|
||||
height:1370px;
|
||||
width:498px;
|
||||
overflow-y: hidden;
|
||||
display:inline-block;
|
||||
border-left:groove 1px;
|
||||
border-right:groove 1px;
|
||||
border-bottom:groove 1px;
|
||||
}
|
||||
|
||||
.msg_body{
|
||||
padding-left:64px;
|
||||
}
|
||||
|
||||
.msg_target{
|
||||
margin:2px 2px 0 2px;
|
||||
padding:2px 3px;
|
||||
display:inline-block;
|
||||
box-shadow: 2px 2px black;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
/*
|
||||
.public_message .msg_target{
|
||||
box-shadow: 2px 2px darkslategrey;
|
||||
}
|
||||
*/
|
||||
|
||||
.msg_target.msg_bright{
|
||||
color:black;
|
||||
}
|
||||
|
||||
.msg_target.msg_dark{
|
||||
color:white;
|
||||
}
|
||||
|
||||
.msg_from_to{
|
||||
display:inline-block;
|
||||
}
|
||||
|
||||
.msg_content{
|
||||
margin-left:10px;
|
||||
margin-right:5px;
|
||||
}
|
||||
|
||||
.msg_prompt{
|
||||
text-align:right;
|
||||
margin-top:5px;
|
||||
margin-right:5px;
|
||||
}
|
||||
|
||||
#mailbox_list option{
|
||||
color:white;
|
||||
background-color:black;
|
||||
}
|
||||
-132
@@ -1,132 +0,0 @@
|
||||
<?php
|
||||
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();
|
||||
//FIXME: 망했음. CriticalFailure. 재 구현.
|
||||
|
||||
$db = DB::db();
|
||||
$connect=$db->get();
|
||||
|
||||
//$when = ($when + 1) * 2;
|
||||
|
||||
$query = "select year,month from game limit 1";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$admin = MYDB_fetch_array($result);
|
||||
|
||||
$query = "select no,name,nation,level,picture,imgsvr from general where owner='{$userID}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$me = MYDB_fetch_array($result);
|
||||
|
||||
$query = "select no,nation,name from general where no='$gen'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$you = MYDB_fetch_array($result);
|
||||
|
||||
$query = "select name,surlimit,color from nation where nation='{$you['nation']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$younation = MYDB_fetch_array($result);
|
||||
|
||||
$query = "select name,gold,rice,surlimit,color,dip{$num} as dipmsg from nation where nation='{$me['nation']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$mynation = MYDB_fetch_array($result);
|
||||
|
||||
$query = "select pop from city where nation='{$me['nation']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$citycount = MYDB_num_rows($result);
|
||||
|
||||
$query = "select city from city where nation='{$me['nation']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$losecitynum = MYDB_num_rows($result);
|
||||
|
||||
$query = "select city from city where nation='{$you['nation']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$wincitynum = MYDB_num_rows($result);
|
||||
|
||||
//아국과의 관계
|
||||
$query = "select state,term from diplomacy where me='{$me['nation']}' and you='{$you['nation']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$dip = MYDB_fetch_array($result);
|
||||
|
||||
//상대국의 제의조건
|
||||
$query = "select reserved from diplomacy where me='{$you['nation']}' and you='{$me['nation']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$dip2 = MYDB_fetch_array($result);
|
||||
|
||||
$mylog = [];
|
||||
$youlog = [];
|
||||
|
||||
if($ok == "수락") {
|
||||
// 서신 보낸 후 멸망,선양 등 했을때.
|
||||
if($me['level'] < 5) {
|
||||
$mylog[] = "<C>●</>수뇌부가 아니므로 불가능합니다. 불가침 실패.";
|
||||
} elseif($dip['term'] == $when*12 && $dip['state'] == 7) {
|
||||
$mylog[] = "<C>●</>이미 수락했습니다. 불가침 실패.";
|
||||
} elseif($losecitynum == 0) {
|
||||
$mylog[] = "<C>●</>방랑군이므로 불가능합니다. 불가침 실패.";
|
||||
} elseif($wincitynum == 0) {
|
||||
$mylog[] = "<C>●</>상대가 방랑군이므로 불가능합니다. 불가침 실패.";
|
||||
} elseif($dip['state'] == 0) {
|
||||
$mylog[] = "<C>●</>아국과 교전중입니다. 불가침 실패.";
|
||||
} elseif($dip['state'] == 1) {
|
||||
$mylog[] = "<C>●</>아국과 선포중입니다. 불가침 실패.";
|
||||
} elseif($dip['state'] == 3 || $dip['state'] == 4) {
|
||||
$mylog[] = "<C>●</>아국과 합병중입니다. 불가침 실패.";
|
||||
} elseif($mynation['dipmsg'] == "") {
|
||||
$mylog[] = "<C>●</>이미 거절했습니다. 불가침 실패.";
|
||||
} else {
|
||||
// $alllog[] = "<C>●</>{$admin['month']}월:<Y>{$me['name']}</>(이)가 <D><b>{$younation['name']}</b></>(와)과 <M>불가침</>에 합의.";
|
||||
// $history[] = "<C>●</>{$admin['year']}년 {$admin['month']}월:<Y><b>【불가침】</b></><D><b>{$mynation['name']}</b></>(이)가 <D><b>{$younation['name']}</b></>(와)과 불가침 조약을 체결했습니다.";
|
||||
|
||||
$youlog[] = "<C>●</><D><b>{$mynation['name']}</b></>(와)과 <C>$when</>년 불가침에 성공했습니다.";
|
||||
$mylog[] = "<C>●</><D><b>{$younation['name']}</b></>(와)과 <C>$when</>년 불가침에 합의했습니다.";
|
||||
pushGeneralHistory($you, "<C>●</>{$admin['year']}년 {$admin['month']}월:<D><b>{$mynation['name']}</b></>(와)과 {$when}년 불가침 성공");
|
||||
pushGeneralHistory($me, "<C>●</>{$admin['year']}년 {$admin['month']}월:<D><b>{$younation['name']}</b></>(와)과 {$when}년 불가침 수락");
|
||||
|
||||
//국메로 저장
|
||||
$msg = "【외교】{$admin['year']}년 {$admin['month']}월:{$younation['name']}(와)과 {$when}년 불가침 합의, 비고: {$dip2['reserved']}";
|
||||
$youmsg = "【외교】{$admin['year']}년 {$admin['month']}월:{$mynation['name']}(와)과 {$when}년 불가침 합의, 비고: {$dip2['reserved']}";
|
||||
|
||||
PushMsg(2, $me['nation'], $me['picture'], $me['imgsvr'], "{$me['name']}:{$mynation['name']}▶", $mynation['color'], $younation['name'], $younation['color'], $msg);
|
||||
PushMsg(3, $you['nation'], $me['picture'], $me['imgsvr'], "{$me['name']}:{$mynation['name']}▶", $mynation['color'], $younation['name'], $younation['color'], $youmsg);
|
||||
|
||||
$when = $when * 12;
|
||||
//외교 변경
|
||||
$query = "update diplomacy set state='7',term='$when',fixed='{$dip2['reserved']}' where me='{$me['nation']}' and you='{$you['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$query = "update diplomacy set state='7',term='$when',fixed='{$dip2['reserved']}' where me='{$you['nation']}' and you='{$me['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
}
|
||||
|
||||
//조건 지움
|
||||
$query = "update diplomacy set reserved='' where me='{$you['nation']}' and you='{$me['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
//현 메세지 지움
|
||||
$query = "update nation set dip{$num}='',dip{$num}_who='0',dip{$num}_when='' where nation='{$me['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
} else {
|
||||
$youlog[] = "<C>●</><Y>{$mynation['name']}</>(이)가 불가침을 거부했습니다.";
|
||||
$mylog[] = "<C>●</><D>{$younation['name']}</>(와)과 불가침을 거부했습니다.";
|
||||
|
||||
//조건 지움
|
||||
$query = "update diplomacy set reserved='' where me='{$you['nation']}' and you='{$me['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
//현 메세지 지움
|
||||
$query = "update nation set dip{$num}='',dip{$num}_who='0',dip{$num}_when='' where nation='{$me['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
}
|
||||
|
||||
pushGenLog($me, $mylog);
|
||||
pushGenLog($you, $youlog);
|
||||
//pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']);
|
||||
//pushWorldHistory($history, $admin['year'], $admin['month']);
|
||||
|
||||
header('location:msglist.php');
|
||||
|
||||
@@ -1,112 +0,0 @@
|
||||
<?php
|
||||
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();
|
||||
|
||||
//FIXME: 망했음. CriticalFailure. 재 구현.
|
||||
|
||||
$db = DB::db();
|
||||
$connect=$db->get();
|
||||
|
||||
$query = "select year,month from game limit 1";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$admin = MYDB_fetch_array($result);
|
||||
|
||||
$query = "select no,name,nation,level,picture,imgsvr from general where owner='{$userID}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$me = MYDB_fetch_array($result);
|
||||
|
||||
$query = "select no,nation from general where no='$gen'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$you = MYDB_fetch_array($result);
|
||||
|
||||
$query = "select name,surlimit,color from nation where nation='{$you['nation']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$younation = MYDB_fetch_array($result);
|
||||
|
||||
$query = "select name,gold,rice,surlimit,color,dip{$num} as dipmsg from nation where nation='{$me['nation']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$mynation = MYDB_fetch_array($result);
|
||||
|
||||
$query = "select pop from city where nation='{$me['nation']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$citycount = MYDB_num_rows($result);
|
||||
|
||||
$query = "select city from city where nation='{$me['nation']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$losecitynum = MYDB_num_rows($result);
|
||||
|
||||
$query = "select city from city where nation='{$you['nation']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$wincitynum = MYDB_num_rows($result);
|
||||
|
||||
//아국과의 관계
|
||||
$query = "select state from diplomacy where me='{$me['nation']}' and you='{$you['nation']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$dip = MYDB_fetch_array($result);
|
||||
|
||||
$mylog = [];
|
||||
$youlog = [];
|
||||
$alllog = [];
|
||||
$history = [];
|
||||
|
||||
if($ok == "수락") {
|
||||
// 서신 보낸 후 멸망,선양 등 했을때.
|
||||
if($me['level'] < 5) {
|
||||
$mylog[] = "<C>●</>수뇌부가 아니므로 불가능합니다. 파기 실패.";
|
||||
} elseif($losecitynum == 0) {
|
||||
$mylog[] = "<C>●</>방랑군이므로 불가능합니다. 파기 실패.";
|
||||
} elseif($wincitynum == 0) {
|
||||
$mylog[] = "<C>●</>상대가 방랑군이므로 불가능합니다. 파기 실패.";
|
||||
} elseif($dip['state'] != 7) {
|
||||
$mylog[] = "<C>●</>아국과 불가침중이 아닙니다. 파기 실패.";
|
||||
} elseif($mynation['dipmsg'] == "") {
|
||||
$mylog[] = "<C>●</>이미 거절했습니다. 파기 실패.";
|
||||
} else {
|
||||
$alllog[] = "<C>●</>{$admin['month']}월:<Y>{$me['name']}</>(이)가 <D><b>{$younation['name']}</b></>(와)과 <M>조약 파기</>에 합의.";
|
||||
$history[] = "<C>●</>{$admin['year']}년 {$admin['month']}월:<Y><b>【파기】</b></><D><b>{$mynation['name']}</b></>(이)가 <D><b>{$younation['name']}</b></>(와)과 불가침을 파기 하였습니다.";
|
||||
$youlog[] = "<C>●</><D><b>{$mynation['name']}</b></>(와)과 파기에 성공했습니다.";
|
||||
$mylog[] = "<C>●</><D><b>{$younation['name']}</b></>(와)과 파기에 합의했습니다.";
|
||||
pushGeneralHistory($you, "<C>●</>{$admin['year']}년 {$admin['month']}월:<D><b>{$mynation['name']}</b></>(와)과 파기 성공");
|
||||
pushGeneralHistory($me, "<C>●</>{$admin['year']}년 {$admin['month']}월:<D><b>{$younation['name']}</b></>(와)과 파기 수락");
|
||||
|
||||
//외교 변경
|
||||
$query = "update diplomacy set state='2',term='0' where me='{$me['nation']}' and you='{$you['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$query = "update diplomacy set state='2',term='0' where me='{$you['nation']}' and you='{$me['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
|
||||
//국메로 저장
|
||||
$msg = "【외교】{$admin['year']}년 {$admin['month']}월:{$younation['name']}(와)과 불가침 파기 동의";
|
||||
$youmsg = "【외교】{$admin['year']}년 {$admin['month']}월:{$mynation['name']}(와)과 불가침 파기 동의";
|
||||
|
||||
PushMsg(2, $me['nation'], $me['picture'], $me['imgsvr'], "{$me['name']}:{$mynation['name']}▶", $mynation['color'], $younation['name'], $younation['color'], $msg);
|
||||
PushMsg(3, $you['nation'], $me['picture'], $me['imgsvr'], "{$me['name']}:{$mynation['name']}▶", $mynation['color'], $younation['name'], $younation['color'], $youmsg);
|
||||
}
|
||||
|
||||
//현 메세지 지움
|
||||
$query = "update nation set dip{$num}='',dip{$num}_who='0',dip{$num}_when='' where nation='{$me['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
} else {
|
||||
$youlog[] = "<C>●</><Y>{$mynation['name']}</>(이)가 파기를 거부했습니다.";
|
||||
$mylog[] = "<C>●</><D>{$younation['name']}</>(와)과 파기를 거부했습니다.";
|
||||
|
||||
//현 메세지 지움
|
||||
$query = "update nation set dip{$num}='',dip{$num}_who='0',dip{$num}_when='' where nation='{$me['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
}
|
||||
|
||||
pushGenLog($me, $mylog);
|
||||
pushGenLog($you, $youlog);
|
||||
pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']);
|
||||
pushWorldHistory($history, $admin['year'], $admin['month']);
|
||||
|
||||
header('location:msglist.php');
|
||||
-117
@@ -1,117 +0,0 @@
|
||||
<?php
|
||||
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();
|
||||
|
||||
//FIXME: 망했음. CriticalFailure. 재 구현.
|
||||
|
||||
$db = DB::db();
|
||||
$connect=$db->get();
|
||||
|
||||
$query = "select year,month from game limit 1";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$admin = MYDB_fetch_array($result);
|
||||
|
||||
$query = "select no,name,nation,level,picture,imgsvr from general where owner='{$userID}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$me = MYDB_fetch_array($result);
|
||||
|
||||
$query = "select no,nation from general where no='$gen'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$you = MYDB_fetch_array($result);
|
||||
|
||||
$query = "select nation,name,surlimit,color from nation where nation='{$you['nation']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$younation = MYDB_fetch_array($result);
|
||||
|
||||
$query = "select nation,name,gold,rice,surlimit,color,dip{$num} as dipmsg from nation where nation='{$me['nation']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$mynation = MYDB_fetch_array($result);
|
||||
|
||||
$query = "select pop from city where nation='{$me['nation']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$citycount = MYDB_num_rows($result);
|
||||
|
||||
$query = "select city from city where nation='{$me['nation']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$losecitynum = MYDB_num_rows($result);
|
||||
|
||||
$query = "select city from city where nation='{$you['nation']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$wincitynum = MYDB_num_rows($result);
|
||||
|
||||
//아국과의 관계
|
||||
$query = "select state from diplomacy where me='{$me['nation']}' and you='{$you['nation']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$dip = MYDB_fetch_array($result);
|
||||
|
||||
$mylog = [];
|
||||
$youlog = [];
|
||||
$alllog = [];
|
||||
$history = [];
|
||||
|
||||
if($ok == "수락") {
|
||||
// 서신 보낸 후 멸망,선양 등 했을때.
|
||||
if($me['level'] < 5) {
|
||||
$mylog[] = "<C>●</>수뇌부가 아니므로 불가능합니다. 종전 실패.";
|
||||
} elseif($losecitynum == 0) {
|
||||
$mylog[] = "<C>●</>방랑군이므로 불가능합니다. 종전 실패.";
|
||||
} elseif($wincitynum == 0) {
|
||||
$mylog[] = "<C>●</>상대가 방랑군이므로 불가능합니다. 종전 실패.";
|
||||
} elseif($dip['state'] != 0 && $dip['state'] != 1) {
|
||||
$mylog[] = "<C>●</>아국과 교전중이 아닙니다. 종전 실패.";
|
||||
} elseif($mynation['dipmsg'] == "") {
|
||||
$mylog[] = "<C>●</>이미 거절했습니다. 불가침 실패.";
|
||||
} else {
|
||||
$alllog[] = "<C>●</>{$admin['month']}월:<Y>{$me['name']}</>(이)가 <D><b>{$younation['name']}</b></>(와)과 <M>종전 합의</> 하였습니다.";
|
||||
$history[] = "<C>●</>{$admin['year']}년 {$admin['month']}월:<Y><b>【종전】</b></><D><b>{$mynation['name']}</b></>(이)가 <D><b>{$younation['name']}</b></>(와)과 <M>종전 합의</> 하였습니다.";
|
||||
$youlog[] = "<C>●</><D><b>{$mynation['name']}</b></>(와)과 종전에 성공했습니다.";
|
||||
$mylog[] = "<C>●</><D><b>{$younation['name']}</b></>(와)과 종전에 합의했습니다.";
|
||||
pushGeneralHistory($you, "<C>●</>{$admin['year']}년 {$admin['month']}월:<D><b>{$mynation['name']}</b></>(와)과 종전 성공");
|
||||
pushGeneralHistory($me, "<C>●</>{$admin['year']}년 {$admin['month']}월:<D><b>{$younation['name']}</b></>(와)과 종전 수락");
|
||||
|
||||
//외교 변경
|
||||
$query = "update diplomacy set state='2',term='0' where me='{$mynation['nation']}' and you='{$younation['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$query = "update diplomacy set state='2',term='0' where me='{$younation['nation']}' and you='{$mynation['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
//외교제한
|
||||
$query = "update nation set surlimit=24 where nation='{$mynation['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$query = "update nation set surlimit=24 where nation='{$younation['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
|
||||
//국메로 저장
|
||||
$msg = "【외교】{$admin['year']}년 {$admin['month']}월:{$younation['name']}(와)과 종전 동의";
|
||||
$youmsg = "【외교】{$admin['year']}년 {$admin['month']}월:{$mynation['name']}(와)과 종전 동의";
|
||||
|
||||
PushMsg(2, $mynation['nation'], $me['picture'], $me['imgsvr'], "{$me['name']}:{$mynation['name']}▶", $mynation['color'], $younation['name'], $younation['color'], $msg);
|
||||
PushMsg(3, $younation['nation'], $me['picture'], $me['imgsvr'], "{$me['name']}:{$mynation['name']}▶", $mynation['color'], $younation['name'], $younation['color'], $youmsg);
|
||||
}
|
||||
|
||||
//현 메세지 지움
|
||||
$query = "update nation set dip{$num}='',dip{$num}_who='0',dip{$num}_when='' where nation='{$me['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
} else {
|
||||
$youlog[] = "<C>●</><Y>{$mynation['name']}</>(이)가 종전을 거부했습니다.";
|
||||
$mylog[] = "<C>●</><D>{$younation['name']}</>(와)과 종전을 거부했습니다.";
|
||||
|
||||
//현 메세지 지움
|
||||
$query = "update nation set dip{$num}='',dip{$num}_who='0',dip{$num}_when='' where nation='{$me['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
}
|
||||
|
||||
pushGenLog($me, $mylog);
|
||||
pushGenLog($you, $youlog);
|
||||
pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']);
|
||||
pushWorldHistory($history, $admin['year'], $admin['month']);
|
||||
|
||||
header('location:msglist.php');
|
||||
-152
@@ -1,152 +0,0 @@
|
||||
<?php
|
||||
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();
|
||||
|
||||
$db = DB::db();
|
||||
$connect=$db->get();
|
||||
|
||||
//FIXME: 망했음. CriticalFailure. 재 구현.
|
||||
|
||||
$query = "select year,month from game limit 1";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$admin = MYDB_fetch_array($result);
|
||||
|
||||
$query = "select no,name,nation,level,picture,imgsvr from general where owner='{$userID}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$me = MYDB_fetch_array($result);
|
||||
|
||||
$query = "select no,name,nation from general where no='$gen'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$you = MYDB_fetch_array($result);
|
||||
|
||||
$query = "select round(avg(power)) as power,round(avg(gennum)) as gennum from nation where level>=1";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$avgnation = MYDB_fetch_array($result);
|
||||
|
||||
$query = "select round(std(power)) as power,round(std(gennum)) as gennum from nation where level>=1";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$stdnation = MYDB_fetch_array($result);
|
||||
|
||||
$query = "select nation,name,gennum,power,surlimit,color from nation where nation='{$you['nation']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$younation = MYDB_fetch_array($result);
|
||||
|
||||
$query = "select nation,name,gennum,power,gold,rice,surlimit,color,dip{$num} as dipmsg from nation where nation='{$me['nation']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$mynation = MYDB_fetch_array($result);
|
||||
|
||||
$query = "select city from city where nation='{$me['nation']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$losecitynum = MYDB_num_rows($result);
|
||||
|
||||
$query = "select city from city where nation='{$you['nation']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$wincitynum = MYDB_num_rows($result);
|
||||
|
||||
//아국과의 관계
|
||||
$query = "select state from diplomacy where me='{$me['nation']}' and you='{$you['nation']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$dip = MYDB_fetch_array($result);
|
||||
//대상국이 외교 진행중(선포중,교전중,합병수락중,통합수락중)일때
|
||||
$query = "select state from diplomacy where me='{$you['nation']}' and (state='0' or state='1' or state='3' or state='5')";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$dipcount = MYDB_num_rows($result);
|
||||
//대상국B이 아국C과 교전중인 국가A와 불가침중일때 불가(A=B 불가침, A=C(아국) 교전, B<-C(아국) 항복)
|
||||
$query = "select you,state from diplomacy where me='{$me['nation']}' and (state='0' or state='1')";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$warcount = MYDB_num_rows($result);
|
||||
// 아국과 교전중인 국가 골라냄
|
||||
$valid = 1;
|
||||
for($i=0; $i < $warcount; $i++) {
|
||||
$acdip = MYDB_fetch_array($result);
|
||||
//교전중 국가A와 대상국B 외교 확인
|
||||
$query = "select state from diplomacy where me='{$acdip['you']}' and you='{$you['nation']}'";
|
||||
$dipresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$abdip = MYDB_fetch_array($dipresult);
|
||||
|
||||
if($abdip['state'] == 7) {
|
||||
$valid = 0;
|
||||
}
|
||||
}
|
||||
|
||||
$mylog = [];
|
||||
$youlog = [];
|
||||
$alllog = [];
|
||||
$history = [];
|
||||
|
||||
if($ok == "수락") {
|
||||
// 서신 보낸 후 멸망 했을때.
|
||||
if($me['level'] < 5) {
|
||||
$mylog[] = "<C>●</>수뇌부가 아니므로 불가능합니다. 통합 실패.";
|
||||
} elseif($mynation['surlimit'] > 0) {
|
||||
$mylog[] = "<C>●</>본국이 외교제한이 지나지 않았습니다. 통합 실패.";
|
||||
} elseif($younation['surlimit'] > 0) {
|
||||
$mylog[] = "<C>●</>상대국이 외교제한이 지나지 않았습니다. 통합 실패.";
|
||||
} elseif($losecitynum == 0) {
|
||||
$mylog[] = "<C>●</>방랑군이므로 불가능합니다. 통합 실패.";
|
||||
} elseif($wincitynum == 0) {
|
||||
$mylog[] = "<C>●</>상대가 방랑군이므로 불가능합니다. 통합 실패.";
|
||||
} elseif($mynation['power']+$younation['power'] > $avgnation['power']+$stdnation['power']) {
|
||||
$mylog[] = "<C>●</>양국 국력이 너무 높습니다. 통합 실패.";
|
||||
} elseif($mynation['gennum']+$younation['gennum'] > $avgnation['gennum']+$stdnation['gennum']) {
|
||||
$mylog[] = "<C>●</>양국 장수가 많습니다. 통합 실패.";
|
||||
} elseif(!isClose($younation['nation'], $mynation['nation'])) {
|
||||
$mylog[] = "<C>●</>인접한 국가가 아니므로 불가능합니다. 통합 실패.";
|
||||
} elseif($dip['state'] == 0) {
|
||||
$mylog[] = "<C>●</>아국과 교전중입니다. 통합 실패.";
|
||||
} elseif($dipcount != 0) {
|
||||
$mylog[] = "<C>●</>상대국이 외교 진행중입니다. 통합 실패.";
|
||||
} elseif($valid == 0) {
|
||||
$mylog[] = "<C>●</>상대국이 아국의 교전국과 불가침중입니다. 통합 실패.";
|
||||
} elseif($mynation['dipmsg'] == "") {
|
||||
$mylog[] = "<C>●</>이미 거절했습니다. 불가침 실패.";
|
||||
} else {
|
||||
$youlog[] = "<C>●</><D><b>{$mynation['name']}</b></>(이)가 통합에 동의했습니다.";
|
||||
$history[] = "<C>●</>{$admin['year']}년 {$admin['month']}월:<Y><b>【통합시도】</b></><D><b>{$mynation['name']}</b></>(와)과 <D><b>{$younation['name']}</b></>(이)가 통합을 시도합니다.";
|
||||
$mylog[] = "<C>●</><D><b>{$younation['name']}</b></>(와)과 통합에 동의했습니다.";
|
||||
$alllog[] = "<C>●</>{$admin['month']}월:<Y>{$me['name']}</>(이)가 <D><b>{$younation['name']}</b></>(와)과 <M>통합</>에 동의하였습니다.";
|
||||
pushGeneralHistory($you, "<C>●</>{$admin['year']}년 {$admin['month']}월:<D><b>{$mynation['name']}</b></>(와)과 통합 시도");
|
||||
pushGeneralHistory($me, "<C>●</>{$admin['year']}년 {$admin['month']}월:<D><b>{$younation['name']}</b></>(와)과 통합 시도");
|
||||
|
||||
//외교 변경
|
||||
$query = "update diplomacy set state='3',term='24' where me='{$mynation['nation']}' and you='{$younation['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$query = "update diplomacy set state='4',term='24' where me='{$younation['nation']}' and you='{$mynation['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
|
||||
//국메로 저장
|
||||
$msg = "【외교】{$admin['year']}년 {$admin['month']}월:{$younation['name']}(와)과 통합에 합의";
|
||||
$youmsg = "【외교】{$admin['year']}년 {$admin['month']}월:{$mynation['name']}(와)과 통합에 합의";
|
||||
|
||||
PushMsg(2, $mynation['nation'], $me['picture'], $me['imgsvr'], "{$me['name']}:{$mynation['name']}▶", $mynation['color'], $younation['name'], $younation['color'], $msg);
|
||||
PushMsg(3, $younation['nation'], $me['picture'], $me['imgsvr'], "{$me['name']}:{$mynation['name']}▶", $mynation['color'], $younation['name'], $younation['color'], $youmsg);
|
||||
}
|
||||
|
||||
//현 메세지 지움
|
||||
$query = "update nation set dip{$num}='',dip{$num}_who='0',dip{$num}_when='' where nation='{$me['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
} else {
|
||||
$youlog[] = "<C>●</><Y>{$mynation['name']}</>(이)가 항복을 거부했습니다.";
|
||||
$mylog[] = "<C>●</><D>{$younation['name']}</>(으)로 항복을 거부했습니다.";
|
||||
|
||||
//현 메세지 지움
|
||||
$query = "update nation set dip{$num}='',dip{$num}_who='0',dip{$num}_when='' where nation='{$me['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
}
|
||||
|
||||
pushGenLog($me, $mylog);
|
||||
pushGenLog($you, $youlog);
|
||||
pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']);
|
||||
pushWorldHistory($history, $admin['year'], $admin['month']);
|
||||
|
||||
header('location:msglist.php');
|
||||
|
||||
-177
@@ -1,177 +0,0 @@
|
||||
<?php
|
||||
namespace sammo;
|
||||
|
||||
//TODO: 등용장 재 디자인.
|
||||
//xxx: 일단 비활성화
|
||||
header('Location:msglist.php');
|
||||
die();
|
||||
|
||||
include "lib.php";
|
||||
include "func.php";
|
||||
//로그인 검사
|
||||
|
||||
$session = Session::requireGameLogin()->setReadOnly();
|
||||
$userID = Session::getUserID();
|
||||
//FIXME: 망했음. CriticalFailure. 재 구현.
|
||||
|
||||
$db = DB::db();
|
||||
$connect=$db->get();
|
||||
|
||||
$query = "select startyear,year,month,killturn from game limit 1";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$admin = MYDB_fetch_array($result);
|
||||
|
||||
$query = "select no,name,nation,nations,level,troop,npc,gold,rice from general where owner='{$userID}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$me = MYDB_fetch_array($result);
|
||||
|
||||
$query = "select no,nation from general where no='$gen'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$you = MYDB_fetch_array($result);
|
||||
|
||||
$query = "select name,nation,level,capital,scout from nation where nation='{$you['nation']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$nation = MYDB_fetch_array($result);
|
||||
|
||||
$mylog = [];
|
||||
$youlog = [];
|
||||
$allog = [];
|
||||
|
||||
if($ok == "수락" && $me['level'] < 12 && $nation['level'] > 0 && $nation['scout'] == 0 && $me['nation'] != $nation['nation'] && $admin['year'] >= $admin['startyear']+3 && strpos($me['nations'], ",{$nation['nation']},") === false) {
|
||||
$youlog[] = "<C>●</><Y>{$me['name']}</> 등용에 성공했습니다.";
|
||||
$alllog[] = "<C>●</>{$admin['month']}월:<Y>{$me['name']}</>(이)가 <D><b>{$nation['name']}</b></>(으)로 <S>망명</>하였습니다.";
|
||||
$mylog[] = "<C>●</><D>{$nation['name']}</>(으)로 망명하여 수도로 이동합니다.";
|
||||
pushGeneralHistory($you, "<C>●</>{$admin['year']}년 {$admin['month']}월:<Y>{$me['name']}</> 등용에 성공");
|
||||
pushGeneralHistory($me, "<C>●</>{$admin['year']}년 {$admin['month']}월:<D>{$nation['name']}</>(으)로 망명");
|
||||
|
||||
// 임관내역 추가
|
||||
$me['nations'] .= "{$nation['nation']},";
|
||||
|
||||
// 국가 변경, 도시 변경, 일반으로, 수도로
|
||||
$query = "update general set killturn='{$admin['killturn']}',belong=1,nation='{$you['nation']}',nations='{$me['nations']}',level=1,city='{$nation['capital']}' where no='{$me['no']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
// 재야가 아니면 명성N*10% 공헌N*10%감소
|
||||
if($me['level'] > 0) {
|
||||
// 1000 1000 남기고 환수
|
||||
if($me['gold'] > 1000) { $gold = $me['gold'] - 1000; $me['gold'] = 1000; } else { $gold = 0; }
|
||||
if($me['rice'] > 1000) { $rice = $me['rice'] - 1000; $me['rice'] = 1000; } else { $rice = 0; }
|
||||
$query = "update general set gold='{$me['gold']}',rice='{$me['rice']}',betray=betray+1,dedication=dedication*(1-0.1*betray),experience=experience*(1-0.1*betray) where no='{$me['no']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$query = "update nation set gold=gold+'$gold',rice=rice+'$rice' where nation='{$me['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
} else {
|
||||
//재야이면 100 100 증가
|
||||
$query = "update general set dedication=dedication+100,experience=experience+100 where no='{$me['no']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
}
|
||||
//유저이면 삭턴 리셋
|
||||
if($me['npc'] < 2) {
|
||||
$query = "update general set killturn='{$admin['killturn']}' where no='{$me['no']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
}
|
||||
|
||||
//태수 군사 시중 해제
|
||||
switch($me['level']) {
|
||||
case 4:
|
||||
$query = "update city set gen1=0 where gen1='{$me['no']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
break;
|
||||
case 3:
|
||||
$query = "update city set gen2=0 where gen2='{$me['no']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
break;
|
||||
case 2:
|
||||
$query = "update city set gen3=0 where gen3='{$me['no']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
break;
|
||||
}
|
||||
|
||||
//등용자 명성, 공헌 상승
|
||||
$query = "update general set dedication=dedication+100,experience=experience+100 where no='{$you['no']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
|
||||
// 부대 처리
|
||||
$query = "select no from troop where troop='{$me['troop']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$troop = MYDB_fetch_array($result);
|
||||
|
||||
//부대장일 경우
|
||||
if($troop['no'] == $me['no']) {
|
||||
// 모두 탈퇴
|
||||
$query = "update general set troop='0' where troop='{$me['troop']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
// 부대 삭제
|
||||
$query = "delete from troop where troop='{$me['troop']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
} else {
|
||||
$query = "update general set troop='0' where no='{$me['no']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
}
|
||||
//국가 기술력 그대로
|
||||
$query = "select no from general where nation='{$nation['nation']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$gencount = MYDB_num_rows($result);
|
||||
$gennum = $gencount;
|
||||
if($gencount < 10) $gencount = 10;
|
||||
|
||||
$query = "update nation set totaltech=tech*'$gencount',gennum='$gennum' where nation='{$nation['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
|
||||
//기존 국가 기술력 그대로
|
||||
$query = "select no from general where nation='{$me['nation']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$gencount = MYDB_num_rows($result);
|
||||
$gennum = $gencount;
|
||||
if($gencount < 10) $gencount = 10;
|
||||
|
||||
$query = "update nation set totaltech=tech*'$gencount',gennum='$gennum' where nation='{$me['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
|
||||
//현 메세지 수정
|
||||
$query = "update general set msg{$num}='{$nation['name']}(으)로 등용 제의 수락',msg{$num}_type='10' where no='{$me['no']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
} elseif($me['level'] == 12) {
|
||||
$mylog[] = "<C>●</>군주입니다. 등용 수락 불가.";
|
||||
|
||||
//현 메세지 지움
|
||||
$query = "update general set msg{$num}='{$nation['name']}(으)로 등용 제의 수락 불가',msg{$num}_type='10' where no='{$me['no']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
} elseif($nation['level'] == 0) {
|
||||
$mylog[] = "<C>●</>없는 국가이거나 방랑군입니다. 등용 수락 불가.";
|
||||
|
||||
//현 메세지 지움
|
||||
$query = "update general set msg{$num}='{$nation['name']}(으)로 등용 제의 수락 불가',msg{$num}_type='10' where no='{$me['no']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
} elseif($nation['scout'] != 0) {
|
||||
$mylog[] = "<C>●</>임관 금지중입니다. 등용 수락 불가.";
|
||||
|
||||
//현 메세지 지움
|
||||
$query = "update general set msg{$num}='{$nation['name']}(으)로 등용 제의 수락 불가',msg{$num}_type='10' where no='{$me['no']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
} elseif($admin['year'] < $admin['startyear']+3) {
|
||||
$mylog[] = "<C>●</>초반 제한중입니다. 등용 수락 불가.";
|
||||
|
||||
//현 메세지 지움
|
||||
$query = "update general set msg{$num}='{$nation['name']}(으)로 등용 제의 수락 불가',msg{$num}_type='10' where no='{$me['no']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
} elseif(strpos($me['nations'], ",{$nation['nation']},") > 0) {
|
||||
$mylog[] = "<C>●</>이미 임관했었던 국가입니다. 등용 수락 불가.";
|
||||
|
||||
//현 메세지 지움
|
||||
$query = "update general set msg{$num}='{$nation['name']}(으)로 등용 제의 수락 불가',msg{$num}_type='10' where no='{$me['no']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
} else {
|
||||
$youlog[] = "<C>●</><Y>{$me['name']}</>(이)가 등용을 거부했습니다.";
|
||||
$mylog[] = "<C>●</><D>{$nation['name']}</>(으)로 망명을 거부했습니다.";
|
||||
|
||||
//현 메세지 지움
|
||||
$query = "update general set msg{$num}='{$nation['name']}(으)로 등용 제의 거부',msg{$num}_type='10' where no='{$me['no']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
}
|
||||
|
||||
pushGenLog($me, $mylog);
|
||||
pushGenLog($you, $youlog);
|
||||
pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']);
|
||||
//pushWorldHistory($history, $admin['year'], $admin['month']);
|
||||
|
||||
header('location:msglist.php');
|
||||
@@ -27,6 +27,8 @@ class DB{
|
||||
if(self::$uDB === null){
|
||||
self::$uDB = new \MeekroDB(self::$host,self::$user,self::$password,self::$dbName,self::$port,self::$encoding);
|
||||
self::$uDB->connect_options[MYSQLI_OPT_INT_AND_FLOAT_NATIVE] = true;
|
||||
|
||||
self::$uDB->error_handler= function(){};
|
||||
self::$uDB->throw_exception_on_error = true;
|
||||
self::$uDB->throw_exception_on_nonsql_error = true;
|
||||
}
|
||||
|
||||
@@ -1,140 +0,0 @@
|
||||
<?php
|
||||
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();
|
||||
//FIXME: 망했음. CriticalFailure. 재 구현.
|
||||
|
||||
$db = DB::db();
|
||||
$connect=$db->get();
|
||||
|
||||
$query = "select year,month from game limit 1";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$admin = MYDB_fetch_array($result);
|
||||
|
||||
$query = "select no,name,nation,level,picture,imgsvr from general where owner='{$userID}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$me = MYDB_fetch_array($result);
|
||||
|
||||
$query = "select no,nation from general where no='$gen'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$you = MYDB_fetch_array($result);
|
||||
|
||||
$query = "select nation,name,power,gold,rice,surlimit,color from nation where nation='{$you['nation']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$younation = MYDB_fetch_array($result);
|
||||
|
||||
$query = "select nation,name,power,surlimit,color,dip{$num} as dipmsg from nation where nation='{$me['nation']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$mynation = MYDB_fetch_array($result);
|
||||
|
||||
$query = "select city from city where nation='{$me['nation']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$losecitynum = MYDB_num_rows($result);
|
||||
|
||||
$query = "select city from city where nation='{$you['nation']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$wincitynum = MYDB_num_rows($result);
|
||||
|
||||
//아국과의 관계
|
||||
$query = "select state from diplomacy where me='{$me['nation']}' and you='{$you['nation']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$dip = MYDB_fetch_array($result);
|
||||
//대상국이 외교 진행중(선포중,교전중,합병수락중,통합수락중)일때
|
||||
$query = "select state from diplomacy where me='{$you['nation']}' and (state='0' or state='1' or state='3' or state='5')";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$dipcount = MYDB_num_rows($result);
|
||||
//대상국B이 아국C과 교전중인 국가A와 불가침중일때 불가(A=B 불가침, A=C(아국) 교전, B<-C(아국) 항복)
|
||||
$query = "select you,state from diplomacy where me='{$me['nation']}' and (state='0' or state='1')";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$warcount = MYDB_num_rows($result);
|
||||
// 아국과 교전중인 국가 골라냄
|
||||
$valid = 1;
|
||||
for($i=0; $i < $warcount; $i++) {
|
||||
$acdip = MYDB_fetch_array($result);
|
||||
//교전중 국가A와 대상국B 외교 확인
|
||||
$query = "select state from diplomacy where me='{$acdip['you']}' and you='{$you['nation']}'";
|
||||
$dipresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$abdip = MYDB_fetch_array($dipresult);
|
||||
|
||||
if($abdip['state'] == 7) {
|
||||
$valid = 0;
|
||||
}
|
||||
}
|
||||
|
||||
$mylog = [];
|
||||
$youlog = [];
|
||||
$alllog = [];
|
||||
$history = [];
|
||||
|
||||
if($ok == "수락") {
|
||||
// 서신 보낸 후 멸망 했을때.
|
||||
if($me['level'] < 5) {
|
||||
$mylog[] = "<C>●</>수뇌부가 아니므로 불가능합니다. 투항 실패.";
|
||||
} elseif($mynation['surlimit'] > 0) {
|
||||
$mylog[] = "<C>●</>본국이 외교제한이 지나지 않았습니다. 투항 실패.";
|
||||
} elseif($younation['surlimit'] > 0) {
|
||||
$mylog[] = "<C>●</>상대국이 외교제한이 지나지 않았습니다. 투항 실패.";
|
||||
// } elseif($losecitynum == 0) {
|
||||
// $mylog[] = "<C>●</>방랑군이므로 불가능합니다. 투항 실패.";
|
||||
} elseif($wincitynum == 0) {
|
||||
$mylog[] = "<C>●</>상대가 방랑군이므로 불가능합니다. 투항 실패.";
|
||||
} elseif($younation['power'] / $mynation['power'] <= 3) {
|
||||
$mylog[] = "<C>●</>아국과 상대국의 국력차이가 크지 않습니다. 투항 실패.";
|
||||
} elseif($losecitynum != 0 && !isClose($younation['nation'], $mynation['nation'])) {
|
||||
$mylog[] = "<C>●</>인접한 국가가 아니므로 불가능합니다. 투항 실패.";
|
||||
} elseif($dip['state'] == 0) {
|
||||
$mylog[] = "<C>●</>아국과 교전중입니다. 투항 실패.";
|
||||
} elseif($dipcount != 0) {
|
||||
$mylog[] = "<C>●</>상대국이 외교 진행중입니다. 투항 실패.";
|
||||
} elseif($valid == 0) {
|
||||
$mylog[] = "<C>●</>상대국이 아국의 교전국과 불가침중입니다. 투항 실패.";
|
||||
} elseif($mynation['dipmsg'] == "") {
|
||||
$mylog[] = "<C>●</>이미 거절했습니다. 불가침 실패.";
|
||||
} else {
|
||||
$youlog[] = "<C>●</><D><b>{$mynation['name']}</b></>(이)가 합병에 동의했습니다.";
|
||||
$history[] = "<C>●</>{$admin['year']}년 {$admin['month']}월:<Y><b>【합병시도】</b></><D><b>{$mynation['name']}</b></>(와)과 <D><b>{$younation['name']}</b></>(이)가 합병을 시도합니다.";
|
||||
$mylog[] = "<C>●</><D><b>{$younation['name']}</b></>(와)과 합병에 동의했습니다.";
|
||||
$alllog[] = "<C>●</>{$admin['month']}월:<Y>{$me['name']}</>(이)가 <D><b>{$younation['name']}</b></>(와)과 <M>합병</>에 동의하였습니다.";
|
||||
pushGeneralHistory($you, "<C>●</>{$admin['year']}년 {$admin['month']}월:<D><b>{$mynation['name']}</b></>(와)과 합병 시도");
|
||||
pushGeneralHistory($me, "<C>●</>{$admin['year']}년 {$admin['month']}월:<D><b>{$younation['name']}</b></>(와)과 합병 시도");
|
||||
|
||||
//외교 변경
|
||||
$query = "update diplomacy set state='5',term='24' where me='{$mynation['nation']}' and you='{$younation['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$query = "update diplomacy set state='6',term='24' where me='{$younation['nation']}' and you='{$mynation['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
|
||||
//국메로 저장
|
||||
$msg = "【외교】{$admin['year']}년 {$admin['month']}월:{$younation['name']}(와)과 합병에 동의";
|
||||
$youmsg = "【외교】{$admin['year']}년 {$admin['month']}월:{$mynation['name']}(와)과 합병에 동의";
|
||||
|
||||
PushMsg(2, $mynation['nation'], $me['picture'], $me['imgsvr'], "{$me['name']}:{$mynation['name']}▶", $mynation['color'], $younation['name'], $younation['color'], $msg);
|
||||
PushMsg(3, $younation['nation'], $me['picture'], $me['imgsvr'], "{$me['name']}:{$mynation['name']}▶", $mynation['color'], $younation['name'], $younation['color'], $youmsg);
|
||||
}
|
||||
|
||||
//현 메세지 지움
|
||||
$query = "update nation set dip{$num}='',dip{$num}_who='0',dip{$num}_when='' where nation='{$me['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
} else {
|
||||
$youlog[] = "<C>●</><Y>{$mynation['name']}</>(이)가 항복을 거부했습니다.";
|
||||
$mylog[] = "<C>●</><D>{$younation['name']}</>(으)로 항복을 거부했습니다.";
|
||||
|
||||
//현 메세지 지움
|
||||
$query = "update nation set dip{$num}='',dip{$num}_who='0',dip{$num}_when='' where nation='{$me['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
}
|
||||
|
||||
pushGenLog($me, $mylog);
|
||||
pushGenLog($you, $youlog);
|
||||
pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']);
|
||||
pushWorldHistory($history, $admin['year'], $admin['month']);
|
||||
|
||||
header('location:msglist.php');
|
||||
+54
-46
@@ -4,7 +4,7 @@ namespace sammo;
|
||||
require_once 'process_war.php';
|
||||
require_once 'func_gamerule.php';
|
||||
require_once 'func_process.php';
|
||||
require_once 'func_process_trick.php';
|
||||
require_once 'func_process_sabotage.php';
|
||||
require_once 'func_process_chief.php';
|
||||
require_once 'func_process_personnel.php';
|
||||
require_once 'func_npc.php';
|
||||
@@ -18,13 +18,12 @@ require_once 'func_time_event.php';
|
||||
require_once('func_template.php');
|
||||
require_once('func_message.php');
|
||||
require_once('func_map.php');
|
||||
require_once('func_diplomacy.php');
|
||||
require_once('func_command.php');
|
||||
|
||||
/**
|
||||
* nationID를 이용하여 국가의 '어지간해선' 변경되지 않는 정보(이름, 색, 성향, 규모, 수도)를 반환해줌
|
||||
*
|
||||
* @param int|null $nationID 국가 코드, -1인 경우 전체, null인 경우 수행하지 않음
|
||||
* @param int|null $nationID 국가 코드, -1인 경우 전체, null인 경우 수행하지 않음. 0인 경우에는 재야임
|
||||
* @param bool $forceRefresh 강제 갱신 여부
|
||||
*
|
||||
* @return array|null nationID에 해당하는 국가가 있을 경우 array 반환. 그외의 경우 null
|
||||
@@ -32,13 +31,24 @@ require_once('func_command.php');
|
||||
function getNationStaticInfo($nationID, $forceRefresh=false)
|
||||
{
|
||||
static $nationList = null;
|
||||
static $freeNation = [
|
||||
'nation'=>0,
|
||||
'name'=>'재야',
|
||||
'color'=>'#000000',
|
||||
'type'=>0,
|
||||
'level'=>0,
|
||||
'capital'=>0
|
||||
];
|
||||
|
||||
if ($forceRefresh) {
|
||||
$nationList = null;
|
||||
}
|
||||
|
||||
if($nationID === null || $nationID == 0){
|
||||
return null;
|
||||
if ($nationID === null) {
|
||||
return null;
|
||||
}
|
||||
if($nationID === 0){
|
||||
return $freeNation;
|
||||
}
|
||||
|
||||
if($nationList === null){
|
||||
@@ -67,11 +77,11 @@ function getAllNationStaticInfo(){
|
||||
return getNationStaticInfo(-1);
|
||||
}
|
||||
|
||||
function GetImageURL($imgsvr) {
|
||||
function GetImageURL($imgsvr, $filepath='') {
|
||||
if($imgsvr == 0) {
|
||||
return ServConfig::$sharedIconPath;
|
||||
return ServConfig::getSharedIconPath($filepath);
|
||||
} else {
|
||||
return AppConf::getUserIconPathWeb();
|
||||
return AppConf::getUserIconPathWeb($filepath);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -158,10 +168,14 @@ function cityInfo() {
|
||||
$tradeStr = $city['trade'] . "%";
|
||||
}
|
||||
|
||||
if(!$nation){
|
||||
$nation = getNationStaticInfo(0);
|
||||
}
|
||||
|
||||
if($nation['color'] == "" ) { $nation['color'] = "#000000"; }
|
||||
echo "<table width=640 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg2>
|
||||
<tr><td colspan=8 align=center style=height:20;color:".newColor($nation['color']).";background-color:{$nation['color']};font-weight:bold;font-size:13px;>【 ".CityConst::$regionMap[$city['region']]." | ".CityConst::$levelMap[$city['level']]." 】 {$city['name']}</td></tr>
|
||||
<tr><td colspan=8 align=center style=height:20;color:".newColor($nation['color']).";background-color:{$nation['color']}><b>";
|
||||
<tr><td colspan=8 align=center style=height:20px;color:".newColor($nation['color']).";background-color:{$nation['color']};font-weight:bold;font-size:13px;>【 ".CityConst::$regionMap[$city['region']]." | ".CityConst::$levelMap[$city['level']]." 】 {$city['name']}</td></tr>
|
||||
<tr><td colspan=8 align=center style=height:20px;color:".newColor($nation['color']).";background-color:{$nation['color']}><b>";
|
||||
|
||||
if($city['nation'] == 0) {
|
||||
echo "공 백 지";
|
||||
@@ -255,7 +269,7 @@ function myNationInfo() {
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$me = MYDB_fetch_array($result);
|
||||
|
||||
$query = "select nation,name,color,power,msg,gold,rice,bill,rate,scout,war,tricklimit,surlimit,tech,totaltech,level,type from nation where nation='{$me['nation']}'";
|
||||
$query = "select nation,name,color,power,msg,gold,rice,bill,rate,scout,war,sabotagelimit,surlimit,tech,totaltech,level,type from nation where nation='{$me['nation']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$nation = MYDB_fetch_array($result);
|
||||
|
||||
@@ -335,14 +349,14 @@ function myNationInfo() {
|
||||
$nation['tech'] = "$techCall / {$nation['tech']}";
|
||||
|
||||
if($me['nation']==0){
|
||||
$nation['tricklimit'] = "<font color=white>해당 없음</font>";
|
||||
$nation['sabotagelimit'] = "<font color=white>해당 없음</font>";
|
||||
$nation['surlimit'] = "<font color=white>해당 없음</font>";
|
||||
$nation['scout'] = "<font color=white>해당 없음</font>";
|
||||
$nation['war'] = "<font color=white>해당 없음</font>";
|
||||
$nation['power'] = "<font color=white>해당 없음</font>";
|
||||
} else {
|
||||
if($nation['tricklimit'] != 0) { $nation['tricklimit'] = "<font color=red>{$nation['tricklimit']}턴</font>"; }
|
||||
else { $nation['tricklimit'] = "<font color=limegreen>가 능</font>"; }
|
||||
if($nation['sabotagelimit'] != 0) { $nation['sabotagelimit'] = "<font color=red>{$nation['sabotagelimit']}턴</font>"; }
|
||||
else { $nation['sabotagelimit'] = "<font color=limegreen>가 능</font>"; }
|
||||
|
||||
if($nation['surlimit'] != 0) { $nation['surlimit'] = "<font color=red>{$nation['surlimit']}턴</font>"; }
|
||||
else { $nation['surlimit'] = "<font color=limegreen>가 능</font>"; }
|
||||
@@ -373,7 +387,7 @@ function myNationInfo() {
|
||||
</tr>
|
||||
<tr>
|
||||
<td align=center id=bg1><b>전 략</b></td>
|
||||
<td align=center>{$nation['tricklimit']}</td>
|
||||
<td align=center>{$nation['sabotagelimit']}</td>
|
||||
<td align=center id=bg1><b>외 교</b></td>
|
||||
<td align=center>{$nation['surlimit']}</td>
|
||||
</tr>
|
||||
@@ -479,7 +493,7 @@ function commandTable() {
|
||||
$develcostE = Util::round($develcostE);
|
||||
|
||||
echo "
|
||||
<select name=commandtype size=1 style=width:260px;color:white;background-color:black;font-size:12;>";
|
||||
<select name=commandtype size=1 style=width:260px;color:white;background-color:black;font-size:12px;>";
|
||||
addCommand("휴 식", 0);
|
||||
addCommand("요 양", 50);
|
||||
commandGroup("========= 내 정 ==========");
|
||||
@@ -858,12 +872,12 @@ function generalInfo($no) {
|
||||
elseif($general['mode'] == 1) { $general['mode'] = "<font color=limegreen>수비 함(훈사60)</font>"; }
|
||||
else { $general['mode'] = "<font color=red>수비 안함</font>"; }
|
||||
|
||||
$weapImage = ServConfig::$gameImagePath."/weap{$general['crewtype']}.jpg";
|
||||
$weapImage = ServConfig::$gameImagePath."/weap{$general['crewtype']}.png";
|
||||
if($admin['show_img_level'] < 2) { $weapImage = ServConfig::$sharedIconPath."/default.jpg"; };
|
||||
$imageTemp = GetImageURL($general['imgsvr']);
|
||||
echo "<table width=498 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg2>
|
||||
<tr>
|
||||
<td width=64 height=64 align=center rowspan=3 background={$imageTemp}/{$general['picture']}> </td>
|
||||
<td width=64 height=64 align=center rowspan=3 style='background:no-repeat center url(\"{$imageTemp}/{$general['picture']}\");background-size:64px;'> </td>
|
||||
<td align=center colspan=9 height=16 style=color:".newColor($nation['color']).";background-color:{$nation['color']};font-weight:bold;font-size:13px;>{$general['name']} 【 {$level} | {$call} | {$color}{$injury}</font> 】 ".substr($general['turntime'], 11)."</td>
|
||||
</tr>
|
||||
<tr height=16>
|
||||
@@ -886,7 +900,7 @@ function generalInfo($no) {
|
||||
<td align=center colspan=2><font size=1>$bookname</font></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align=center height=64 rowspan=3 background={$weapImage}> </td>
|
||||
<td align=center height=64 rowspan=3 style='background:no-repeat center url(\"{$weapImage}\");background-size:64px;'></td>
|
||||
<td align=center id=bg1><b>자금</b></td>
|
||||
<td align=center colspan=2>{$general['gold']}</td>
|
||||
<td align=center id=bg1><b>군량</b></td>
|
||||
@@ -947,8 +961,6 @@ function myInfo2() {
|
||||
}
|
||||
|
||||
function generalInfo2($no) {
|
||||
global $_dexLimit;
|
||||
|
||||
$db = DB::db();
|
||||
$connect=$db->get();
|
||||
|
||||
@@ -974,11 +986,11 @@ function generalInfo2($no) {
|
||||
$dedication = getDed($general['dedication'])." ({$general['dedication']})"; break;
|
||||
}
|
||||
|
||||
$dex0 = $general['dex0'] / $_dexLimit * 100;
|
||||
$dex10 = $general['dex10'] / $_dexLimit * 100;
|
||||
$dex20 = $general['dex20'] / $_dexLimit * 100;
|
||||
$dex30 = $general['dex30'] / $_dexLimit * 100;
|
||||
$dex40 = $general['dex40'] / $_dexLimit * 100;
|
||||
$dex0 = $general['dex0'] / GameConst::$dexLimit * 100;
|
||||
$dex10 = $general['dex10'] / GameConst::$dexLimit * 100;
|
||||
$dex20 = $general['dex20'] / GameConst::$dexLimit * 100;
|
||||
$dex30 = $general['dex30'] / GameConst::$dexLimit * 100;
|
||||
$dex40 = $general['dex40'] / GameConst::$dexLimit * 100;
|
||||
|
||||
if($dex0 > 100) { $dex0 = 100; }
|
||||
if($dex10 > 100) { $dex10 = 100; }
|
||||
@@ -1156,7 +1168,7 @@ function msgprint($msg, $name, $picture, $imgsvr, $when, $num, $type) {
|
||||
<td width=148 align=center id=bg1>$when</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width=64 height=64 valign=top><img src={$imageTemp}/{$picture} width=64 height=64 border=0></td>
|
||||
<td width=64 height=64 valign=top><img width='64' height='64' src={$imageTemp}/{$picture} border=0></td>
|
||||
<td width=932 colspan=2>$message[1]</td>
|
||||
</tr>";
|
||||
for($i=0; $i < $count; $i++) {
|
||||
@@ -1176,7 +1188,7 @@ function msgprint($msg, $name, $picture, $imgsvr, $when, $num, $type) {
|
||||
<form name=reply_form{$num} method=post action=$board>
|
||||
<td width=64 align=center>댓글달기</td>
|
||||
<td width=932 colspan=2>
|
||||
<input type=textarea name=reply maxlength=250 style=color:white;background-color:black;width:830;>
|
||||
<input type=textarea name=reply maxlength=250 style=color:white;background-color:black;width:830px;>
|
||||
<input type=submit value=댓글달기>
|
||||
<input type=hidden name=num value=$num>
|
||||
</td>
|
||||
@@ -1453,13 +1465,13 @@ function checkDelay() {
|
||||
function updateOnline() {
|
||||
$db = DB::db();
|
||||
$connect=$db->get();
|
||||
$nationname = [];
|
||||
$nationname = ["재야"];
|
||||
|
||||
//국가별 이름 매핑
|
||||
foreach(getAllNationStaticInfo() as $nation) {
|
||||
$nationname[$nation['nation']] = $nation['name'];
|
||||
}
|
||||
$nationname[0] = "재야";
|
||||
|
||||
|
||||
//동접수
|
||||
$query = "select no,name,nation from general where lastrefresh > DATE_SUB(NOW(), INTERVAL 5 MINUTE)";
|
||||
@@ -1708,14 +1720,6 @@ function checkTurn() {
|
||||
$query = "update game set turntime='$date'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
|
||||
// 3턴 전 시간
|
||||
$letterdate = subTurn($date, $admin['turnterm'], 3);
|
||||
//기한 지난 외교 메세지 지움(3개월 유지)
|
||||
//if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', '.__LINE__);
|
||||
for($i=0; $i < 5; $i++) {
|
||||
$query = "update nation set dip{$i}='',dip{$i}_who='0',dip{$i}_type='0',dip{$i}_when='' where dip{$i}_when < '$letterdate'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
}
|
||||
// 부상 과도 제한
|
||||
$query = "update general set injury='80' where injury>'80'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
@@ -2211,10 +2215,6 @@ function uniqueItem($general, $log, $vote=0) {
|
||||
|
||||
$nation = getNationStaticInfo($general['nation']);
|
||||
|
||||
if($nation === null) {
|
||||
$nation = ['name' => "재야"];
|
||||
}
|
||||
|
||||
switch($sel) {
|
||||
case 0:
|
||||
$log[] = "<C>●</><C>".getWeapName($it)."</>(을)를 습득했습니다!";
|
||||
@@ -2576,15 +2576,23 @@ function searchDistance(int $from, int $maxDist=99, bool $distForm = false) {
|
||||
}
|
||||
}
|
||||
|
||||
function isClose($nation1, $nation2) {
|
||||
function isClose(int $nation1, int $nation2, bool $includeNoSupply=true) {
|
||||
$db = DB::db();
|
||||
|
||||
$nation1Cities = [];
|
||||
foreach($db->queryFirstColumn('SELECT city FROM city WHERE nation = %i', $nation1) as $city){
|
||||
|
||||
if($includeNoSupply){
|
||||
$supplySql = '';
|
||||
}
|
||||
else{
|
||||
$supplySql = 'AND supply = 1';
|
||||
}
|
||||
|
||||
foreach($db->queryFirstColumn('SELECT city FROM city WHERE nation = %i %l', $nation1, $supplySql) as $city){
|
||||
$nation1Cities[$city] = $city;
|
||||
}
|
||||
|
||||
foreach($db->queryFirstColumn('SELECT city FROM city WHERE nation = %i', $nation2) as $city){
|
||||
foreach($db->queryFirstColumn('SELECT city FROM city WHERE nation = %i %l', $nation2, $supplySql) as $city){
|
||||
foreach(array_keys(CityConst::byID($city)->path) as $adjCity){
|
||||
if(key_exists($adjCity, $nation1Cities)){
|
||||
return true;
|
||||
@@ -2659,7 +2667,7 @@ function CharCritical($rate, $personal) {
|
||||
return $rate;
|
||||
}
|
||||
|
||||
function TrickInjury($city, $type=0) {
|
||||
function SabotageInjury($city, $type=0) {
|
||||
$db = DB::db();
|
||||
$connect=$db->get();
|
||||
$log = [];
|
||||
|
||||
@@ -1,224 +0,0 @@
|
||||
<?php
|
||||
namespace sammo;
|
||||
|
||||
function checkScoutAvailable($messageInfo, $general, $srcGeneral, $startyear, $year){
|
||||
$nationID = $messageInfo['src']['nationID'];
|
||||
|
||||
$srcNation = DB::db()->queryFirstRow('SELECT `level`, `scout` FROM `nation` WHERE `nation` = %i', $nationID);
|
||||
|
||||
$realNationID = $srcGeneral['nation'];
|
||||
|
||||
|
||||
|
||||
if($general['level'] == 12) {
|
||||
return [false, "군주입니다."];
|
||||
}
|
||||
if(!$srcNation || $srcNation['level'] == 0) {
|
||||
return [false, "없는 국가이거나 방랑군입니다."];
|
||||
}
|
||||
if($realNationID != $nationID){
|
||||
return [false, "권유자의 소속이 바뀌었습니다."];
|
||||
}
|
||||
if($srcNation['scout'] != 0) {
|
||||
return [false, "임관 금지중입니다."];
|
||||
}
|
||||
if($year < $startyear+3) {
|
||||
return [false, "초반 제한중입니다."];
|
||||
}
|
||||
if(strpos($general['nations'], ",{$nationID},") > 0) {
|
||||
return [false, "이미 임관했었던 국가입니다."];
|
||||
}
|
||||
|
||||
return [true, null];
|
||||
|
||||
}
|
||||
|
||||
function acceptScout($messageInfo, $general, $msgResponse){
|
||||
$me = $general;
|
||||
$you = DB::db()->queryFirstRow('SELECT `no`, `name`, `nation` FROM `general` WHERE `no` = %i', $messageInfo['src']['id']);
|
||||
|
||||
list($startyear, $year, $month, $killturn) = Util::convertDictToArray(DB::db()->queryFirstRow('SELECT `startyear`, `year`, `month`, `killturn` FROM `game` LIMIT 1'), ['startyear', 'year', 'month', `killturn`]);
|
||||
|
||||
list($avaliableScout, $reason) = checkScoutAvailable($messageInfo, $general, $you, $startyear, $year);
|
||||
|
||||
if(!$msgResponse || !$avaliableScout){
|
||||
return declineScout($messageInfo, $reason);
|
||||
}
|
||||
|
||||
$nation = getNationStaticInfo($messageInfo['src']['nationID']);
|
||||
$generalID = $me['no'];
|
||||
$nationID = $nation['nation'];
|
||||
$nationName = $nation['name'];
|
||||
$myName = $me['name'];
|
||||
|
||||
$mylog = [];
|
||||
$youlog = [];
|
||||
$alllog = [];
|
||||
|
||||
$youlog[] = "<C>●</><Y>{$myName}</> 등용에 성공했습니다.";
|
||||
$alllog[] = "<C>●</>{$month}월:<Y>{$myName}</>(이)가 <D><b>{$nationName}</b></>(으)로 <S>망명</>하였습니다.";
|
||||
$mylog[] = "<C>●</><D>{$nationName}</>(으)로 망명하여 수도로 이동합니다.";
|
||||
pushGeneralHistory($you, "<C>●</>{$year}년 {$month}월:<Y>{$myName}</> 등용에 성공");
|
||||
pushGeneralHistory($me, "<C>●</>{$year}년 {$month}월:<D>{$nationName}</>(으)로 망명");
|
||||
|
||||
$me['nations'] .= "{$nationID},";
|
||||
|
||||
$updateMe = [
|
||||
'belong'=>1,
|
||||
'nation'=>$nationID,
|
||||
'level'=>1,
|
||||
'city'=>$nation['capital'],
|
||||
'troop'=>0
|
||||
];
|
||||
|
||||
|
||||
//처리가 조금 다름.
|
||||
|
||||
$db = DB::db();
|
||||
|
||||
|
||||
if($me['level'] > 0){
|
||||
$updateOldNation = [
|
||||
'totaltech' => $db->sqleval('`tech`*greatest(10, `gennum`-1)'),
|
||||
'gennum' => $db->sqleval('greatest(10, `gennum`-1)')
|
||||
];
|
||||
|
||||
if($me['gold'] > 1000){
|
||||
$updateOldNation['gold'] = $db->sqleval('`gold` + %i', $me['gold'] - 1000);
|
||||
$updateMe['gold'] = 1000;
|
||||
}
|
||||
if($me['rice'] > 1000){
|
||||
$updateOldNation['rice'] = $db->sqleval('`rice` + %i', $me['rice'] - 1000);
|
||||
$updateMe['rice'] = 1000;
|
||||
}
|
||||
|
||||
$updateMe['betray'] = $db->sqleval('`betray` + 1');
|
||||
$updateMe['dedication'] = $db->sqleval('dedication*(1-0.1*betray)');
|
||||
$updateMe['experience'] = $db->sqleval('experience*(1-0.1*betray)');
|
||||
|
||||
$db->update('nation', $updateOldNation, 'nation = %i', $messageInfo['dest']['nationID']);
|
||||
}
|
||||
else{
|
||||
$updateMe['dedication'] = $db->sqleval('dedication + 100');
|
||||
$updateMe['experience'] = $db->sqleval('experience + 100');
|
||||
}
|
||||
|
||||
if($me['npc'] < 2){
|
||||
$updateMe['killturn'] = $killturn;
|
||||
}
|
||||
|
||||
$db->update('general', $updateMe, 'no = %i', $generalID);
|
||||
|
||||
$db->query('UPDATE nation set '.
|
||||
'gennum = greatest(10, (SELECT count(`id`) from general where `nation` = %i_nation)), '.
|
||||
'totaltech = tech * greatest(10, (SELECT count(`id`) from general where `nation` = %i_nation)) '.
|
||||
'where nation=%i_nation', ['nation'=>$nationID]);
|
||||
|
||||
//태수 군사 시중 해제
|
||||
switch($me['level']) {
|
||||
case 4:
|
||||
$db->query('update city set gen1=0 where gen1=%i', $generalID);
|
||||
break;
|
||||
case 3:
|
||||
$db->query('update city set gen3=0 where gen2=%i', $generalID);
|
||||
break;
|
||||
case 2:
|
||||
$db->query('update city set gen3=0 where gen2=%i', $generalID);
|
||||
break;
|
||||
}
|
||||
|
||||
$db->query('UPDATE general left join troop on troop.troop = general.troop set general.troop = 0 where troop.no = %i', $generalID);
|
||||
$db->query('delete from troop where no = %i', $generalID);
|
||||
|
||||
$db->query('UPDATE `message` SET `valid_until`=\'1234-11-22 11:22:33\' WHERE `id` = %i', $messageInfo['id']);
|
||||
$msg = "{$nationName}(으)로 등용 제의 수락";
|
||||
sendRawMessage('private', false, $general['no'], $messageInfo['src'], $messageInfo['dest'], $msg, null, null, ['parent'=>$messageInfo['id']]);
|
||||
|
||||
pushGenLog($me, $mylog);
|
||||
pushGenLog($you, $youlog);
|
||||
pushGeneralPublicRecord($alllog, $year, $month);
|
||||
pushWorldHistory($alllog, $year, $month);
|
||||
|
||||
return [true, 'success'];
|
||||
}
|
||||
|
||||
function declineScout($messageInfo, $reason=null){
|
||||
$me = [
|
||||
'no'=>$messageInfo['dest']['id'],
|
||||
'name'=>$messageInfo['dest']['name']
|
||||
];
|
||||
$you = ['no'=>$messageInfo['src']['id']];
|
||||
|
||||
$nation = getNationStaticInfo($messageInfo['src']['nationID']);
|
||||
$generalID = $me['no'];
|
||||
$nationID = $nation['nation'];
|
||||
$nationName = $nation['name'];
|
||||
$myName = $me['name'];
|
||||
|
||||
$mylog = [];
|
||||
$youlog = [];
|
||||
|
||||
|
||||
$nationName = $messageInfo['src']['nation'];
|
||||
if($reason){
|
||||
$mylog[] = "<C>●</>{$reason} 등용 수락 불가.";
|
||||
$msg = "{$nationName}(으)로 등용 제의 수락 불가";
|
||||
}
|
||||
else{
|
||||
$youlog[] = "<C>●</><Y>{$me['name']}</>(이)가 등용을 거부했습니다.";
|
||||
$mylog[] = "<C>●</><D>{$nationName}</>(으)로 망명을 거부했습니다.";
|
||||
$msg = "{$nationName}(으)로 등용 제의 거부";
|
||||
}
|
||||
|
||||
$db = DB::db();
|
||||
$db->query('UPDATE `message` SET `valid_until`=\'1234-11-22 11:22:33\' WHERE `id` = %i', $messageInfo['id']);
|
||||
|
||||
sendRawMessage('private', false, $you['no'], $messageInfo['src'], $messageInfo['dest'], $msg, null, null, ['parent'=>$messageInfo['id']]);
|
||||
|
||||
pushGenLog($me, $mylog);
|
||||
pushGenLog($you, $youlog);
|
||||
|
||||
return [true, 'success'];
|
||||
}
|
||||
|
||||
function acceptAlly($messageInfo, $general, $msgResponse){
|
||||
return [false, 'NYI'];
|
||||
}
|
||||
|
||||
function declineAlly($messageInfo, $general, $msgResponse){
|
||||
|
||||
}
|
||||
|
||||
function acceptBreakAlly($messageInfo, $general, $msgResponse){
|
||||
|
||||
}
|
||||
|
||||
function declineBreakAlly($messageInfo, $general, $msgResponse){
|
||||
|
||||
}
|
||||
|
||||
function acceptStopWar($messageInfo, $general, $msgResponse){
|
||||
|
||||
}
|
||||
|
||||
function declineStopWar($messageInfo, $general, $msgResponse){
|
||||
|
||||
}
|
||||
|
||||
|
||||
function acceptMergeNations($messageInfo, $general, $msgResponse){
|
||||
|
||||
}
|
||||
|
||||
function declineMergeNations($messageInfo, $general, $msgResponse){
|
||||
|
||||
}
|
||||
|
||||
|
||||
function acceptSurrender($messageInfo, $general, $msgResponse){
|
||||
|
||||
}
|
||||
|
||||
function declineSurrender($messageInfo, $general, $msgResponse){
|
||||
|
||||
}
|
||||
@@ -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),"");
|
||||
@@ -412,7 +413,7 @@ function preUpdateMonthly() {
|
||||
//건국제한, 전략제한, 외교제한-1
|
||||
$query = "update general set makelimit=makelimit-1 where makelimit>'0'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$query = "update nation set tricklimit=tricklimit-1 where tricklimit>'0'";
|
||||
$query = "update nation set sabotagelimit=sabotagelimit-1 where sabotagelimit>'0'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$query = "update nation set surlimit=surlimit-1 where surlimit>'0'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
|
||||
@@ -64,12 +64,12 @@ function getTnmtFightLogAll(int $group) {
|
||||
return join('<br>',getFormattedFileLogAll("logs/fight{$group}.txt"));
|
||||
}
|
||||
|
||||
function pushTrickLog($log) {
|
||||
pushRawFileLog("logs/_tricklog.txt", $log);
|
||||
function pushSabotageLog($log) {
|
||||
pushRawFileLog("logs/_sabotagelog.txt", $log);
|
||||
}
|
||||
|
||||
function getTrickLogRecent($count) {
|
||||
return join('<br>', getFormattedFileLogRecent("logs/_tricklog.txt", $count, 150));
|
||||
function getSabotageLogRecent($count) {
|
||||
return join('<br>', getFormattedFileLogRecent("logs/_sabotagelog.txt", $count, 150));
|
||||
}
|
||||
|
||||
function pushProcessLog($log) {
|
||||
|
||||
+5
-5
@@ -29,12 +29,12 @@ function bar($per, $h=7) {
|
||||
|
||||
$per = round($per, 1);
|
||||
if($per < 1 || $per > 99) { $per = Util::round($per); }
|
||||
$str1 = "<td width={$per}% background=".ServConfig::$gameImagePath."/pb{$h2}.gif></td>";
|
||||
$str2 = "<td width=*% background=".ServConfig::$gameImagePath."/pr{$h2}.gif></td>";
|
||||
$str1 = "<td width='{$per}%' background=".ServConfig::$gameImagePath."/pb{$h2}.gif></td>";
|
||||
$str2 = "<td width='*%' background=".ServConfig::$gameImagePath."/pr{$h2}.gif></td>";
|
||||
if($per <= 0) { $str1 = ""; }
|
||||
elseif($per >= 100) { $str2 = ""; }
|
||||
$str = "
|
||||
<table width=100% height={$h} border={$bd} cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:1;>
|
||||
<table width=100% height={$h} border={$bd} cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black>
|
||||
<tr>{$str1}{$str2}</tr>
|
||||
</table>";
|
||||
return $str;
|
||||
@@ -51,8 +51,8 @@ function Submit($url, $msg="", $msg2="") {
|
||||
echo "a"; // 파폭 버그 때문
|
||||
echo "
|
||||
<form method=post name=f1 action='{$url}'>
|
||||
<input type=hidden name=msg value='{$msg}'>
|
||||
<input type=hidden name=msg2 value='{$msg2}'>
|
||||
<input type=hidden name=msg value=\"{$msg}\">
|
||||
<input type=hidden name=msg2 value=\"{$msg2}\">
|
||||
</form>
|
||||
<script>f1.submit();</script>
|
||||
";
|
||||
|
||||
+13
-347
@@ -1,240 +1,45 @@
|
||||
<?php
|
||||
namespace sammo;
|
||||
|
||||
|
||||
|
||||
function getSingleMessage($messageID){
|
||||
$messageInfo = DB::db()->queryFirstRow('select * from `message` where `id` = %i', $messageID);
|
||||
|
||||
if (!$messageInfo) {
|
||||
return [false, '존재하지 않는 메시지'];
|
||||
}
|
||||
|
||||
return [true, $messageInfo];
|
||||
}
|
||||
|
||||
function getRawMessage($mailbox, $msgType, $limit=30, $fromSeq=null){
|
||||
|
||||
|
||||
$sql = 'select * from `message` where `mailbox` = %i_mailbox and `type` = %s_type and `valid_until` > now()';
|
||||
if($fromSeq !== null){
|
||||
$sql .= ' and `id` > %i_id';
|
||||
}
|
||||
$sql .= ' ORDER BY `id` desc';
|
||||
if($limit > 0){
|
||||
$sql .= ' LIMIT %i_limit';
|
||||
}
|
||||
|
||||
//TODO: table 네임의 prefix를 처리할 수 있도록 개선
|
||||
$result = DB::db()->query($sql, [
|
||||
'mailbox' => $mailbox,
|
||||
'type' => $msgType,
|
||||
'limit' => $limit,
|
||||
'time' => $fromTime
|
||||
]);
|
||||
|
||||
|
||||
return array_map(function ($row){
|
||||
return new Message($row);
|
||||
}, $result);
|
||||
}
|
||||
|
||||
function getMessage($msgType, $nationID=null, $limit=30, $fromSeq=null){
|
||||
$generalID = Session::getInstance()->generalID;
|
||||
if($generalID === null){
|
||||
return [];
|
||||
}
|
||||
|
||||
if($msgType === 'public'){
|
||||
return getRawMessage(9999, 'public', $limit, $fromSeq);
|
||||
}
|
||||
else if($msgType === 'private'){
|
||||
return getRawMessage($generalID, 'private', $limit, $fromSeq);
|
||||
}
|
||||
else if($msgType === 'national'){
|
||||
if($nationID === null){
|
||||
return [];
|
||||
}
|
||||
|
||||
return getRawMessage($nationID + 9000, 'national', $limit, $fromSeq);
|
||||
}
|
||||
else if($msgType === 'diplomacy'){
|
||||
if($nationID === null){
|
||||
return [];
|
||||
}
|
||||
|
||||
return getRawMessage($nationID + 9000, 'diplomacy', $limit, $fromSeq);
|
||||
}
|
||||
else{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
function sendRawMessage($msgType, $isSender, $mailbox, $src, $dest, $msg, $date, $validUntil, $msgOption){
|
||||
|
||||
$srcNation = getNationStaticInfo($src['nation_id']);
|
||||
$destNation = getNationStaticInfo($dest['nation_id']);
|
||||
|
||||
$src['nation'] = Util::array_get($srcNation['name'], '재야');
|
||||
$src['color'] = Util::array_get($srcNation['color'], '#ffffff');
|
||||
|
||||
$dest['nation'] = Util::array_get($destNation['name'], '재야');
|
||||
$dest['color'] = Util::array_get($destNation['color'], '#ffffff');
|
||||
|
||||
if(!$isSender && $mailbox < 9000 && Util::array_get($msgOption['alert'], false)){
|
||||
//TODO:newmsg보단 lastmsg로 datetime을 넣는게 더 나아보임
|
||||
DB::db()->update('general', array(
|
||||
'newmsg' => true
|
||||
), 'no=%i', $dest['id']);
|
||||
}
|
||||
|
||||
if(isset($msgOption['alert'])){
|
||||
unset($msgOption['alert']);
|
||||
}
|
||||
|
||||
DB::db()->insert('message', [
|
||||
'address' => $dest,
|
||||
'type' => $msgType,
|
||||
'src' => $src['id'],
|
||||
'dest' => $dest['id'],
|
||||
'time' => $date,
|
||||
'valid_until' => $validUntil,
|
||||
'message' => Json::encode([
|
||||
'src' => $src,
|
||||
'dest' =>$dest,
|
||||
'text' => $msg,
|
||||
'option' => $msgOption
|
||||
], Json::DELETE_NULL)
|
||||
]);
|
||||
}
|
||||
/**
|
||||
* @param string $msgType
|
||||
* @param mixed[] $src
|
||||
* @param mixed[] $dest
|
||||
* @param null|string $date
|
||||
* @param null|string $validUntil
|
||||
*/
|
||||
function sendMessage($msgType, array $src, array $dest, $msg, $date = null, $validUntil = null, $msgOption = null){
|
||||
if($date === null){
|
||||
$date = (new \Datetime())->format('Y-m-d H:i:s');
|
||||
}
|
||||
|
||||
if($validUntil === null){
|
||||
$validUntil = '9999-12-31 12:59:59';
|
||||
}
|
||||
|
||||
if($msgType === 'public'){
|
||||
//dest는 필요하지 않음
|
||||
$srcMailbox = null;
|
||||
$destMailbox = 9999;
|
||||
$dest['id'] = 9999;
|
||||
}
|
||||
else if($msgType === 'national'){
|
||||
//dest는 nation_id만 필요함
|
||||
$dest['id'] = $dest['nation_id'] + 9000;
|
||||
|
||||
if($src['nation_id'] === $dest['nation_id']){
|
||||
$srcMailbox = null;
|
||||
}
|
||||
else{
|
||||
$srcMailbox = $src['nation_id'] + 9000;
|
||||
}
|
||||
$destMailbox = $dest['nation_id'] + 9000;
|
||||
}
|
||||
else if($msgType === 'diplomacy'){
|
||||
//NOTE:외교 서신의 경우 '동일한 내용'이 두번 가지 않으므로, 별도 처리가 필요함
|
||||
$src['id'] = $dest['nation_id'] + 9000;
|
||||
$dest['id'] = $dest['nation_id'] + 9000;
|
||||
$destMailbox = $dest['id'];
|
||||
}
|
||||
else{
|
||||
//dest는 id, name이 필수
|
||||
$srcMailbox = $src['id'];
|
||||
$destMailbox = $dest['id'];
|
||||
}
|
||||
|
||||
if($srcMailbox !== null){
|
||||
sendRawMessage($msgType, true, $srcMailbox, $src, $dest, $msg, $date, $validUntil, null);
|
||||
}
|
||||
sendRawMessage($msgType, false, $destMailbox, $src, $dest, $msg, $date, $validUntil, null);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
function sendScoutMsg($src, $dest, $date) {
|
||||
|
||||
return false;
|
||||
//$msgType, $isSender, $mailbox, $src, $dest, $msg, $date, $validUntil, $msgOption
|
||||
|
||||
if(!$src || !$src['id'] || !$src['nation_id']){
|
||||
return false;
|
||||
}
|
||||
|
||||
$nation = getNationStaticInfo($src['nation_id']);
|
||||
$nationName = Util::array_get($nation['name'], '재야');
|
||||
|
||||
if(!$dest || !$dest['id']){
|
||||
return false;
|
||||
}
|
||||
|
||||
$msgType = 'private';
|
||||
$option = [
|
||||
"action" => "scout"
|
||||
];
|
||||
|
||||
$msg = "{$src['nation']}(으)로 망명 권유 서신";
|
||||
$validUntil = "9999-12-31 12:59:59";//등용장의 시간 제한 없음
|
||||
|
||||
sendRawMessage('private', false, $dest['id'], $src, $dest, $msg, $date, $validUntil, $option);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
function getMailboxList(){
|
||||
|
||||
$generalNations = [];
|
||||
|
||||
foreach(DB::db()->query('select `no`, `name`, `nation`, `level`, `npc` from `general` where `npc` < 2') as $general)
|
||||
foreach(DB::db()->queryAllLists('select `no`, `name`, `nation`, `level`, `npc` from `general` where `npc` < 2') as $general)
|
||||
{
|
||||
list($generalID, $generalName, $nationID, $level, $npc) = $general;
|
||||
if(!isset($generalNations[$nationID])){
|
||||
$generalNations[$nationID] = [];
|
||||
}
|
||||
|
||||
$isChief = ($level == 12);
|
||||
$obj = [$generalID, $generalName, 0];
|
||||
|
||||
$obj = [$generalID, $generalName];
|
||||
if($isChief){
|
||||
$obj[] = 1;
|
||||
if($level == 12){
|
||||
$obj[2] |= 1;
|
||||
}
|
||||
|
||||
if($npc == 1){
|
||||
$obj[2] |= 2;
|
||||
}
|
||||
|
||||
//TODO: 빙의장 정보 추가
|
||||
$generalNations[$nationID][] = $obj;
|
||||
}
|
||||
|
||||
$neutral = [
|
||||
"nation"=>0,
|
||||
"name"=>"재야",
|
||||
"color"=>"#ffffff"
|
||||
];
|
||||
|
||||
$result = array_map(function($nation) use ($generalNations) {
|
||||
$nationID = $nation['nation'];
|
||||
$mailbox = $nationID + 9000;
|
||||
$nation = $nation['name'];
|
||||
|
||||
$mailbox = $nationID + Message::MAILBOX_NATIONAL;
|
||||
$nationName = $nation['name'];
|
||||
$color = $nation['color'];
|
||||
$generals = Util::array_get($generalNations[$nationID], []);
|
||||
|
||||
return [
|
||||
"nationID"=>$nationID,
|
||||
"mailbox"=>$mailbox,
|
||||
"nation"=>$nationID,
|
||||
"name"=>$nationName,
|
||||
"color"=>$color,
|
||||
"general"=>$generals
|
||||
];
|
||||
}, array_merge([$neutral], getAllNationStaticInfo()));
|
||||
}, array_merge([getNationStaticInfo(0)], getAllNationStaticInfo()));
|
||||
|
||||
return $result;
|
||||
|
||||
@@ -243,70 +48,6 @@ function getMailboxList(){
|
||||
|
||||
//Legacy
|
||||
|
||||
// type : xx,xx(불가침기간,타입)
|
||||
// who : xxxx,xxxx(발신인, 수신인)
|
||||
function DecodeMsg($msg, $type, $who, $date, $bg, $num=0) {
|
||||
$db = DB::db();
|
||||
$connect=$db->get();
|
||||
$userID = Session::getUserID();
|
||||
|
||||
//FIXME: 폐기
|
||||
$query = "select no,nation,name,picture,level from general where owner='{$userID}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$me = MYDB_fetch_array($result);
|
||||
|
||||
// 1 : 전메, 2 : 아국->타국, 3 : 타국->아국
|
||||
// 4 : 합병, 5 : 통합, 6 : 불가침, 7 : 종전, 8 : 파기
|
||||
// 9 : 자신->타인, 10 : 타인 -> 자신, 11 : 등용
|
||||
$category = $type % 100;
|
||||
$term = intdiv($type, 100);
|
||||
$from = intdiv($who, 10000);
|
||||
$to = $who % 10000;
|
||||
|
||||
$query = "select name,picture,imgsvr,nation from general where no='$from'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$sndr = MYDB_fetch_array($result);
|
||||
|
||||
if($sndr['nation'] == 0) {
|
||||
$sndrnation = [];
|
||||
$sndrnation['name'] = '재야';
|
||||
$sndrnation['color'] = '#FFFFFF';
|
||||
} else {
|
||||
$sndrnation = getNationStaticInfo($sndr['nation']);
|
||||
}
|
||||
|
||||
switch($bg) {
|
||||
case 2:
|
||||
case 4: $bgcolor = "#CC6600"; break;
|
||||
}
|
||||
|
||||
if($category == 6) {
|
||||
$query = "select reserved from diplomacy where me='{$sndr['nation']}' and you='{$me['nation']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$dip = MYDB_fetch_array($result);
|
||||
|
||||
ShowMsg($bgcolor, $category, $sndr['picture'], $sndr['imgsvr'], "{$sndr['name']}:{$sndrnation['name']}▶", $sndrnation['color'], $sndr['name'], $sndrnation['color'], $msg, $date, $num, $from, $term, $me['level'], $dip['reserved']);
|
||||
} elseif($category <= 8) {
|
||||
$rcvrnation = getNationStaticInfo($to);
|
||||
|
||||
ShowMsg($bgcolor, $category, $sndr['picture'], $sndr['imgsvr'], "{$sndr['name']}:{$sndrnation['name']}▶", $sndrnation['color'], $rcvrnation['name'], $rcvrnation['color'], $msg, $date, $num, $from, $term, $me['level']);
|
||||
} elseif($category <= 11) {
|
||||
$query = "select name,picture,nation from general where no='$to'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$rcvr = MYDB_fetch_array($result);
|
||||
|
||||
if($rcvr['nation'] == 0) {
|
||||
$rcvrnation = [];
|
||||
$rcvrnation['name'] = '재야';
|
||||
$rcvrnation['color'] = '#FFFFFF';
|
||||
} else {
|
||||
$rcvrnation = getNationStaticInfo($rcvr['nation']);
|
||||
}
|
||||
ShowMsg($bgcolor, $category, $sndr['picture'], $sndr['imgsvr'], "{$sndr['name']}:{$sndrnation['name']}▶", $sndrnation['color'], "{$rcvr['name']}:{$rcvrnation['name']}", $rcvrnation['color'], $msg, $date, $num, $from, $term);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function moveMsg($table, $msgtype, $msgnum, $msg, $type, $who, $when, $column, $value) {
|
||||
$db = DB::db();
|
||||
$connect=$db->get();
|
||||
@@ -315,78 +56,3 @@ function moveMsg($table, $msgtype, $msgnum, $msg, $type, $who, $when, $column, $
|
||||
$query = "update {$table} set {$msgtype}{$msgnum}='$msg',{$msgtype}{$msgnum}_type='$type',{$msgtype}{$msgnum}_who='$who',{$msgtype}{$msgnum}_when='$when' where {$column}='$value'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
}
|
||||
|
||||
function MsgDip($bg) {
|
||||
$db = DB::db();
|
||||
$connect=$db->get();
|
||||
$userID = Session::getUserID();
|
||||
|
||||
$query = "select no,nation from general where owner='{$userID}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$me = MYDB_fetch_array($result);
|
||||
|
||||
$query = "select dip0,dip1,dip2,dip3,dip4,dip0_who,dip1_who,dip2_who,dip3_who,dip4_who,dip0_when,dip1_when,dip2_when,dip3_when,dip4_when,dip0_type,dip1_type,dip2_type,dip3_type,dip4_type from nation where nation='{$me['nation']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$nation = MYDB_fetch_array($result);
|
||||
|
||||
if($nation['dip0']) { echo "\n"; DecodeMsg($nation['dip0'], $nation['dip0_type'], $nation['dip0_who'], $nation['dip0_when'], $bg, 0); }
|
||||
if($nation['dip1']) { echo "\n"; DecodeMsg($nation['dip1'], $nation['dip1_type'], $nation['dip1_who'], $nation['dip1_when'], $bg, 1); }
|
||||
if($nation['dip2']) { echo "\n"; DecodeMsg($nation['dip2'], $nation['dip2_type'], $nation['dip2_who'], $nation['dip2_when'], $bg, 2); }
|
||||
if($nation['dip3']) { echo "\n"; DecodeMsg($nation['dip3'], $nation['dip3_type'], $nation['dip3_who'], $nation['dip3_when'], $bg, 3); }
|
||||
if($nation['dip4']) { echo "\n"; DecodeMsg($nation['dip4'], $nation['dip4_type'], $nation['dip4_who'], $nation['dip4_when'], $bg, 4); }
|
||||
}
|
||||
|
||||
function ShowMsg($bgcolor, $type, $picture, $imgsvr, $me, $mycolor, $you, $youcolor, $msg, $date, $num=0, $who=0, $when=0, $level=0, $note="") {
|
||||
if($msg == "") return;
|
||||
|
||||
$msg = Tag2Code($msg);
|
||||
|
||||
$site = ""; $form = ""; $form2 = "";
|
||||
if($type == 11 || ($type >= 4 && $type <= 8 && $level >= 5)) {
|
||||
$corebutton = " <input type=submit name=ok value=수락 onclick='return confirm(\"정말 수락하시겠습니까?\")'><input type=submit name=ok value=거절 onclick='return confirm(\"정말 거절하시겠습니까?\")'>";
|
||||
} else {
|
||||
$corebutton = " 【수락】【거절】";
|
||||
}
|
||||
if($type == 6) {
|
||||
$corebutton .= "<br>비고: {$note}";
|
||||
}
|
||||
switch($type) {
|
||||
case 1: $sign = ""; $corebutton = ""; break;
|
||||
case 2: $sign = ""; $corebutton = ""; break;
|
||||
case 3: $sign = ""; $corebutton = ""; break;
|
||||
case 4: $sign = ""; $site = "d_surrender.php"; break;
|
||||
case 5: $sign = ""; $site = "d_merge.php"; break;
|
||||
case 6: $sign = ""; $site = "d_ally.php"; break;
|
||||
case 7: $sign = ""; $site = "d_cease.php"; break;
|
||||
case 8: $sign = ""; $site = "d_cancel.php"; break;
|
||||
case 9: $sign = ""; $corebutton = ""; break;
|
||||
case 10: $sign = ""; $corebutton = ""; break;
|
||||
case 11: $sign = ""; $site = "d_scout.php"; break;
|
||||
}
|
||||
$imageTemp = GetImageURL($imgsvr);
|
||||
$naming = "[<font color=$mycolor>$me</font>{$sign}<font color=$youcolor>$you</font>]";
|
||||
$picture = "<img src={$imageTemp}/{$picture}>";
|
||||
if($site != "") {
|
||||
$form = "<form name=scout method=post action={$site}>";
|
||||
$form2 = "</form>";
|
||||
}
|
||||
if($num >= 0) { $num = "<input type=hidden name=num value=$num>"; }
|
||||
else { $num = ""; }
|
||||
if($who > 0) { $who = "<input type=hidden name=gen value=$who>"; }
|
||||
else { $who = ""; }
|
||||
if($when > 0) { $when = "<input type=hidden name=when value=$when>"; }
|
||||
else { $when = ""; }
|
||||
echo "
|
||||
<table width=498 border=1 bordercolordark=gray bordercolorlight=black cellpadding=0 cellspacing=0 bgcolor='$bgcolor' style=font-size:13px;table-layout:fixed;word-break:break-all;>
|
||||
<tr>
|
||||
<td width=64 height=64>$picture</td>
|
||||
$form
|
||||
<td width=434 valign=top><b>$naming</b><font size=1><$date></font> <br>{$msg}{$corebutton}</td>
|
||||
$num
|
||||
$who
|
||||
$when
|
||||
$form2
|
||||
</tr>
|
||||
</table>
|
||||
";
|
||||
}
|
||||
|
||||
+57
-56
@@ -1,7 +1,6 @@
|
||||
<?php
|
||||
namespace sammo;
|
||||
|
||||
|
||||
/**
|
||||
* 장수의 통솔을 받아옴
|
||||
*
|
||||
@@ -167,10 +166,10 @@ function setLeadershipBonus(&$general, $nationLevel){
|
||||
function CriticalScore($score, $type) {
|
||||
switch($type) {
|
||||
case 0:
|
||||
$ratio = (rand()%9 + 20)/10; // 2.0~2.8
|
||||
$ratio = Util::randF()*0.8 + 2.2; // 2.2~3.0
|
||||
break;
|
||||
case 1:
|
||||
$ratio = (rand()%3 + 2)/10; // 0.2~0.4
|
||||
$ratio = Util::randF()*0.2 + 0.2; // 0.2~0.4
|
||||
break;
|
||||
}
|
||||
return Util::round($score * $ratio);
|
||||
@@ -230,20 +229,21 @@ function process_1(&$general, $type) {
|
||||
// 군사 보정
|
||||
if($general['level'] == 3 && $general['no'] == $city['gen2']) { $score *= 1.05; }
|
||||
|
||||
$rd = rand() % 100;
|
||||
$rd = Util::randF();
|
||||
$r = CriticalRatioDomestic($general, 2);
|
||||
|
||||
// 특기보정 : 경작, 상재
|
||||
if($type == 1 && $general['special'] == 1) { $r['succ'] += 10; $score *= 1.1; $admin['develcost'] *= 0.8; }
|
||||
if($type == 2 && $general['special'] == 2) { $r['succ'] += 10; $score *= 1.1; $admin['develcost'] *= 0.8; }
|
||||
|
||||
if($type == 1 && $general['special'] == 1) { $r['succ'] += 0.1; $score *= 1.1; $admin['develcost'] *= 0.8; }
|
||||
if($type == 2 && $general['special'] == 2) { $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;
|
||||
|
||||
if($r['fail'] > $rd) {
|
||||
$score = CriticalScore($score, 1);
|
||||
$log[] = "<C>●</>{$admin['month']}월:{$dtype}{$atype} <span class='ev_failed'>실패</span>하여 <C>$score</> 상승했습니다. <1>$date</>";
|
||||
} elseif($city['rate'] >= 80 && $r['succ'] > $rd) {
|
||||
} elseif($r['succ'] + $r['fail'] > $rd) {
|
||||
$score = CriticalScore($score, 0);
|
||||
$log[] = "<C>●</>{$admin['month']}월:{$dtype}{$atype} <S>성공</>하여 <C>$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;
|
||||
$r = CriticalRatioDomestic($general, 0);
|
||||
$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[] = "<C>●</>{$admin['month']}월:{$dtype}를 <span class='ev_failed'>실패</span>하여 <C>$score</> 상승했습니다. <1>$date</>";
|
||||
} elseif($city['rate'] >= 80 && $r['succ'] > $rd) {
|
||||
} elseif($r['succ'] + $r['fail'] > $rd) {
|
||||
$score = CriticalScore($score, 0);
|
||||
$log[] = "<C>●</>{$admin['month']}월:{$dtype}를 <S>성공</>하여 <C>$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[] = "<C>●</>{$admin['month']}월:선정을 <span class='ev_failed'>실패</span>하여 민심이 <C>$score</> 상승했습니다. <1>$date</>";
|
||||
} elseif($r['succ'] > $rd) {
|
||||
} elseif($r['succ'] + $r['fail'] > $rd) {
|
||||
$score = CriticalScore($score, 0);
|
||||
$log[] = "<C>●</>{$admin['month']}월:선정을 <S>성공</>하여 민심이 <C>$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%
|
||||
$r = CriticalRatioDomestic($general, 0);
|
||||
$rd = Util::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[] = "<C>●</>{$admin['month']}월:{$dtype}를 <span class='ev_failed'>실패</span>하여 <C>$score</> 상승했습니다. <1>$date</>";
|
||||
} elseif($city['rate'] >= 80 && $r['succ'] > $rd) {
|
||||
} elseif($r['succ'] + $r['fail'] > $rd) {
|
||||
$score = CriticalScore($score, 0);
|
||||
$log[] = "<C>●</>{$admin['month']}월:{$dtype}를 <S>성공</>하여 <C>$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[] = "<C>●</>{$admin['month']}월:장려를 <span class='ev_failed'>실패</span>하여 주민이 <C>{$score}0</>명 증가했습니다. <1>$date</>";
|
||||
} elseif($r['succ'] > $rd) {
|
||||
} elseif($r['succ'] + $r['fail'] > $rd) {
|
||||
$score = CriticalScore($score, 0);
|
||||
$log[] = "<C>●</>{$admin['month']}월:장려를 <S>성공</>하여 주민이 <C>{$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%
|
||||
$r = CriticalRatioDomestic($general, 0);
|
||||
$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[] = "<C>●</>{$admin['month']}월:{$dtype}을 <span class='ev_failed'>실패</span>하여 <C>$score</> 강화했습니다. <1>$date</>";
|
||||
} elseif($city['rate'] >= 80 && $r['succ'] > $rd) {
|
||||
} elseif($r['succ'] + $r['fail'] > $rd) {
|
||||
$score = CriticalScore($score, 0);
|
||||
$log[] = "<C>●</>{$admin['month']}월:{$dtype}을 <S>성공</>하여 <C>$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']}'";
|
||||
@@ -849,11 +855,10 @@ function process_11(&$general, $type) {
|
||||
$log = [];
|
||||
$alllog = [];
|
||||
$history = [];
|
||||
global $_defaultatmos, $_defaulttrain, $_defaultatmos2, $_defaulttrain2;
|
||||
$date = substr($general['turntime'],11,5);
|
||||
|
||||
if($type == 1) { $defaultatmos = $_defaultatmos; $defaulttrain = $_defaulttrain; }
|
||||
else { $defaultatmos = $_defaultatmos2; $defaulttrain = $_defaulttrain2; }
|
||||
if($type == 1) { $defaultatmos = GameConst::$defaultAtmosLow; $defaulttrain = GameConst::$defaultTrainLow; }
|
||||
else { $defaultatmos = GameConst::$defaultAtmosHigh; $defaulttrain = GameConst::$defaultTrainHigh; }
|
||||
|
||||
$query = "select year,month,startyear from game limit 1";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
@@ -1001,7 +1006,7 @@ function process_11(&$general, $type) {
|
||||
$exp = $crew;
|
||||
$ded = $crew;
|
||||
// 숙련도 증가
|
||||
addGenDex($general['no'], $armtype, $crew);
|
||||
addGenDex($general['no'], GameConst::$maxAtmosByCommand, GameConst::$maxTrainByCommand, $armtype, $crew);
|
||||
// 성격 보정
|
||||
$exp = CharExperience($exp, $general['personal']);
|
||||
$ded = CharDedication($ded, $general['personal']);
|
||||
@@ -1036,7 +1041,6 @@ function process_13(&$general) {
|
||||
$log = [];
|
||||
$alllog = [];
|
||||
$history = [];
|
||||
global $_maxtrain, $_training, $_atmosing;
|
||||
$date = substr($general['turntime'],11,5);
|
||||
|
||||
$query = "select year,month from game limit 1";
|
||||
@@ -1059,30 +1063,30 @@ function process_13(&$general) {
|
||||
// $log[] = "<C>●</>{$admin['month']}월:고립된 도시입니다. 훈련 실패. <1>$date</>";
|
||||
} elseif($general['crew'] == 0) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:병사가 없습니다. 훈련 실패. <1>$date</>";
|
||||
} elseif($general['train'] >= $_maxtrain) {
|
||||
} elseif($general['train'] >= GameConst::$maxTrainByCommand) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:병사들은 이미 정예병사들입니다. <1>$date</>";
|
||||
// } elseif(intdiv($general['crewtype'], 10) == 4) {
|
||||
// $log[] = "<C>●</>{$admin['month']}월:병기는 훈련이 불가능합니다. <1>$date</>";
|
||||
} else {
|
||||
// 훈련시
|
||||
$score = Util::round(getGeneralLeadership($general, true, true, true) * 100 / $general['crew'] * $_training);
|
||||
$score = Util::round(getGeneralLeadership($general, true, true, true) * 100 / $general['crew'] * GameConst::$trainDelta);
|
||||
|
||||
$log[] = "<C>●</>{$admin['month']}월:훈련치가 <C>$score</> 상승했습니다. <1>$date</>";
|
||||
$exp = 100;
|
||||
$ded = 70;
|
||||
// 숙련도 증가
|
||||
addGenDex($general['no'], $general['crewtype'], Util::round($general['crew']/100));
|
||||
addGenDex($general['no'], GameConst::$maxAtmosByCommand, GameConst::$maxTrainByCommand, $general['crewtype'], Util::round($general['crew']/100));
|
||||
// 성격 보정
|
||||
$exp = CharExperience($exp, $general['personal']);
|
||||
$ded = CharDedication($ded, $general['personal']);
|
||||
|
||||
// 훈련치 변경
|
||||
$score += $general['train'];
|
||||
if($score > $_maxtrain) { $score = $_maxtrain; }
|
||||
if($score > GameConst::$maxTrainByCommand) { $score = GameConst::$maxTrainByCommand; }
|
||||
$query = "update general set train='$score' where no='{$general['no']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
// 사기 약간 감소
|
||||
$score = intval($general['atmos'] * $_atmosing);
|
||||
$score = intval($general['atmos'] * GameConst::$atmosSideEffectByTraining);
|
||||
if($score < 0 ) { $score = 0; }
|
||||
$query = "update general set atmos='$score' where no='{$general['no']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
@@ -1103,7 +1107,6 @@ function process_14(&$general) {
|
||||
$db = DB::db();
|
||||
$connect=$db->get();
|
||||
|
||||
global $_maxatmos, $_training;
|
||||
$log = [];
|
||||
$alllog = [];
|
||||
$history = [];
|
||||
@@ -1131,26 +1134,26 @@ function process_14(&$general) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:병사가 없습니다. 사기진작 실패. <1>$date</>";
|
||||
} elseif($general['gold'] < $general['crew']/100) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:자금이 모자랍니다. 사기진작 실패. <1>$date</>";
|
||||
} elseif($general['atmos'] >= $_maxatmos) {
|
||||
} elseif($general['atmos'] >= GameConst::$maxAtmosByCommand) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:이미 사기는 하늘을 찌를듯 합니다. <1>$date</>";
|
||||
// } elseif(intdiv($general['crewtype'], 10) == 4) {
|
||||
// $log[] = "<C>●</>{$admin['month']}월:병기는 사기 진작이 불가능합니다. <1>$date</>";
|
||||
} else {
|
||||
$score = Util::round(getGeneralLeadership($general, true, true, true)*100 / $general['crew'] * $_training);
|
||||
$score = Util::round(getGeneralLeadership($general, true, true, true)*100 / $general['crew'] * GameConst::$atmosDelta);
|
||||
$gold = $general['gold'] - Util::round($general['crew']/100);
|
||||
|
||||
$log[] = "<C>●</>{$admin['month']}월:사기치가 <C>$score</> 상승했습니다. <1>$date</>";
|
||||
$exp = 100;
|
||||
$ded = 70;
|
||||
// 숙련도 증가
|
||||
addGenDex($general['no'], $general['crewtype'], Util::round($general['crew']/100));
|
||||
addGenDex($general['no'], GameConst::$maxAtmosByCommand, GameConst::$maxTrainByCommand, $general['crewtype'], Util::round($general['crew']/100));
|
||||
// 성격 보정
|
||||
$exp = CharExperience($exp, $general['personal']);
|
||||
$ded = CharDedication($ded, $general['personal']);
|
||||
|
||||
// 사기치 변경 // 자금 감소 // 경험치 상승 // 공헌도, 명성 상승
|
||||
$score += $general['atmos'];
|
||||
if($score > $_maxatmos) { $score = $_maxatmos; }
|
||||
if($score > GameConst::$maxAtmosByCommand) { $score = GameConst::$maxAtmosByCommand; }
|
||||
$general['leader2']++;
|
||||
$query = "update general set resturn='SUCCESS',atmos='$score',gold='$gold',leader2='{$general['leader2']}',dedication=dedication+'$ded',experience=experience+'$exp' where no='{$general['no']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
@@ -1166,7 +1169,6 @@ function process_15(&$general) {
|
||||
$db = DB::db();
|
||||
$connect=$db->get();
|
||||
|
||||
global $_maxatmos, $_maxtrain;
|
||||
$log = [];
|
||||
$alllog = [];
|
||||
$history = [];
|
||||
@@ -1219,7 +1221,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::$maxAtmosByCommand, GameConst::$maxTrainByCommand, $general['crewtype'], Util::round($general['crew']/100 * 3));
|
||||
// 성격 보정
|
||||
$exp = CharExperience($exp, $general['personal']);
|
||||
$ded = CharDedication($ded, $general['personal']);
|
||||
@@ -1249,7 +1251,7 @@ function process_16(&$general) {
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$admin = MYDB_fetch_array($result);
|
||||
|
||||
$query = "select nation,war,tricklimit,tech from nation where nation='{$general['nation']}'";
|
||||
$query = "select nation,war,sabotagelimit,tech from nation where nation='{$general['nation']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$nation = MYDB_fetch_array($result);
|
||||
|
||||
@@ -1264,7 +1266,7 @@ function process_16(&$general) {
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$destcity = MYDB_fetch_array($result);
|
||||
|
||||
$query = "select nation,tricklimit,tech from nation where nation='{$destcity['nation']}'";
|
||||
$query = "select nation,sabotagelimit,tech from nation where nation='{$destcity['nation']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$dnation = MYDB_fetch_array($result);
|
||||
|
||||
@@ -1307,7 +1309,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::$maxAtmosByCommand, GameConst::$maxTrainByCommand, $general['crewtype'], Util::round($general['crew']/100));
|
||||
// 전투 처리
|
||||
$dead = processWar($general, $destcity);
|
||||
|
||||
@@ -1812,17 +1814,17 @@ function process_41(&$general) {
|
||||
|
||||
if($ratio < 33) {
|
||||
// 숙련도 증가
|
||||
addGenDex($general['no'], $general['crewtype'], $crewexp);
|
||||
addGenDex($general['no'], GameConst::$maxAtmosByCommand, GameConst::$maxTrainByCommand, $general['crewtype'], $crewexp);
|
||||
$log[] = "<C>●</>{$admin['month']}월:$crewstr 숙련도 향상이 <span class='ev_failed'>지지부진</span>했습니다. <1>$date</>";
|
||||
} elseif($ratio < 66) {
|
||||
$exp = $exp * 2;
|
||||
// 숙련도 증가
|
||||
addGenDex($general['no'], $general['crewtype'], $crewexp * 2);
|
||||
addGenDex($general['no'], GameConst::$maxAtmosByCommand, GameConst::$maxTrainByCommand, $general['crewtype'], $crewexp * 2);
|
||||
$log[] = "<C>●</>{$admin['month']}월:$crewstr 숙련도가 향상되었습니다. <1>$date</>";
|
||||
} else {
|
||||
$exp = $exp * 3;
|
||||
// 숙련도 증가
|
||||
addGenDex($general['no'], $general['crewtype'], $crewexp * 3);
|
||||
addGenDex($general['no'], GameConst::$maxAtmosByCommand, GameConst::$maxTrainByCommand, $general['crewtype'], $crewexp * 3);
|
||||
$log[] = "<C>●</>{$admin['month']}월:$crewstr 숙련도가 <S>일취월장</>했습니다. <1>$date</>";
|
||||
}
|
||||
|
||||
@@ -2351,7 +2353,6 @@ function process_49(&$general) {
|
||||
$log = [];
|
||||
$alllog = [];
|
||||
$history = [];
|
||||
global $_taxrate;
|
||||
|
||||
$date = substr($general['turntime'],11,5);
|
||||
|
||||
@@ -2387,7 +2388,7 @@ function process_49(&$general) {
|
||||
//특기 보정 : 거상
|
||||
if($general['special'] == 30 && $city['trade'] > 100) { $cost = $amount * (6 * $city['trade']/100 - 5); } // 이익인 경우 5배 이득
|
||||
if($general['special'] == 30 && $city['trade'] < 100) { $cost = $amount * (0.2 * $city['trade']/100 + 0.8); } // 손해인 경우 1/5배 손해
|
||||
$tax = $cost * $_taxrate;
|
||||
$tax = $cost * GameConst::$exchangeFee;
|
||||
$cost = $cost - $tax;
|
||||
} elseif($type == 2) {
|
||||
$dtype = "군량 구입";
|
||||
@@ -2395,11 +2396,11 @@ function process_49(&$general) {
|
||||
//특기 보정 : 거상
|
||||
if($general['special'] == 30 && $city['trade'] < 100) { $cost = $amount * (6 * $city['trade']/100 - 5); } // 이익인 경우 5배 이득
|
||||
if($general['special'] == 30 && $city['trade'] > 100) { $cost = $amount * (0.2 * $city['trade']/100 + 0.8); } // 손해인 경우 1/5배 손해
|
||||
$tax = $cost * $_taxrate;
|
||||
$tax = $cost * GameConst::$exchangeFee;
|
||||
$cost = $cost + $tax;
|
||||
if($general['gold'] < $cost) {
|
||||
$cost = $general['gold'];
|
||||
$tax = $cost * $_taxrate;
|
||||
$tax = $cost * GameConst::$exchangeFee;
|
||||
$amount = ($cost-$tax) * 100 / $city['trade'];
|
||||
//특기 보정 : 거상
|
||||
if($general['special'] == 30 && $city['trade'] < 100) { $amount = ($cost-$tax) / (6 * $city['trade']/100 - 5); } // 이익인 경우 5배 이득
|
||||
@@ -2458,7 +2459,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']}'";
|
||||
|
||||
+433
-357
@@ -291,72 +291,87 @@ function process_27(&$general) {
|
||||
|
||||
|
||||
function process_51(&$general) {
|
||||
|
||||
$db = DB::db();
|
||||
$connect=$db->get();
|
||||
|
||||
$log = [];
|
||||
$alllog = [];
|
||||
$history = [];
|
||||
$date = substr($general['turntime'],11,5);
|
||||
list($year, $month, $turnterm) = $db->queryFirstList('SELECT year,month,turnterm FROM game LIMIT 1');
|
||||
|
||||
$query = "select year,month from game limit 1";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$admin = MYDB_fetch_array($result);
|
||||
|
||||
$query = "select nation,supply from city where city='{$general['city']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$city = MYDB_fetch_array($result);
|
||||
|
||||
$query = "select name,l{$general['level']}turn0 from nation where nation='{$general['nation']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$nation = MYDB_fetch_array($result);
|
||||
|
||||
$command = DecodeCommand($nation["l{$general['level']}turn0"]);
|
||||
$which = $command[1];
|
||||
|
||||
$query = "select nation,name,dip0,dip0_type,dip0_who,dip0_when,dip1,dip1_type,dip1_who,dip1_when,dip2,dip2_type,dip2_who,dip2_when,dip3,dip3_type,dip3_who,dip3_when,dip4,dip4_type,dip4_who,dip4_when from nation where nation='$which'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$younation = MYDB_fetch_array($result);
|
||||
|
||||
if($younation['nation'] == 0) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:멸망한 국가입니다. 권고 실패. <1>$date</>";
|
||||
} elseif($general['level'] < 5) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:수뇌부가 아닙니다. 권고 실패. <1>$date</>";
|
||||
} elseif($city['nation'] != $general['nation']) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:아국이 아닙니다. 권고 실패. <1>$date</>";
|
||||
} elseif($city['supply'] == 0) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:고립된 도시입니다. 권고 실패. <1>$date</>";
|
||||
} else {
|
||||
$log[] = "<C>●</>{$admin['month']}월:<D><b>{$younation['name']}</b></>으로 항복 권고 서신을 보냈습니다.<1>$date</>";
|
||||
$exp = 5;
|
||||
$ded = 5;
|
||||
|
||||
// 성격 보정
|
||||
$exp = CharExperience($exp, $general['personal']);
|
||||
$ded = CharDedication($ded, $general['personal']);
|
||||
|
||||
// 상대에게 발송
|
||||
//먼저 삭제된 칸 중 가장 오래된 칸 찾음
|
||||
$deleted = 4;
|
||||
for($i=0; $i < 5; $i++) {
|
||||
if($younation["dip{$i}"] == "") { $deleted = $i; }
|
||||
}
|
||||
//기존 메세지 한칸씩 뒤로 미룸
|
||||
for($i=$deleted-1; $i >=0; $i--) {
|
||||
moveMsg("nation", "dip", $i+1, $younation["dip{$i}"], $younation["dip{$i}_type"], $younation["dip{$i}_who"], $younation["dip{$i}_when"], "nation", $younation['nation']);
|
||||
}
|
||||
//권고 서신시 장수번호/상대국 번호
|
||||
$me = $general['no'] * 10000 + $younation['nation'];
|
||||
$date = date('Y-m-d H:i:s');
|
||||
$query = "update nation set dip0='{$nation['name']}의 항복 권고 서신',dip0_type='4',dip0_who='$me',dip0_when='$date' where nation='{$younation['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
|
||||
$query = "update general set dedication=dedication+'$ded',experience=experience+'$exp' where no='{$general['no']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
// $log = checkAbility($general, $log);
|
||||
if($general['level'] < 5 || $general['nation']==0) {
|
||||
pushGenLog($general, ["<C>●</>{$month}월:수뇌부가 아닙니다. 권고 실패. <1>$date</>"]);
|
||||
return;
|
||||
}
|
||||
|
||||
pushGenLog($general, $log);
|
||||
$supply = $db->queryFirstField('SELECT supply FROM city WHERE city=%i AND nation=%i', $general['city'], $general['nation']);
|
||||
$myTurn = $db->queryFirstField('SELECT %b FROM nation WHERE nation=%i', "l{$general['level']}turn0", $general['nation']);
|
||||
|
||||
$command = DecodeCommand($myTurn);
|
||||
$which = $command[1];
|
||||
|
||||
$srcNation = getNationStaticInfo($general['nation']);
|
||||
$destNation = getNationStaticInfo($which);
|
||||
|
||||
if($destNation['nation'] == 0) {
|
||||
pushGenLog($general, ["<C>●</>{$month}월:멸망한 국가입니다. 권고 실패. <1>$date</>"]);
|
||||
return;
|
||||
}
|
||||
|
||||
if($supply === null) {
|
||||
pushGenLog($general, ["<C>●</>{$month}월:아국이 아닙니다. 권고 실패. <1>$date</>"]);
|
||||
return;
|
||||
}
|
||||
|
||||
if($supply === 0) {
|
||||
pushGenLog($general, ["<C>●</>{$month}월:고립된 도시입니다. 권고 실패. <1>$date</>"]);
|
||||
return;
|
||||
}
|
||||
|
||||
$exp = 5;
|
||||
$ded = 5;
|
||||
|
||||
// 성격 보정
|
||||
$exp = CharExperience($exp, $general['personal']);
|
||||
$ded = CharDedication($ded, $general['personal']);
|
||||
|
||||
// 상대에게 발송
|
||||
$src = new MessageTarget(
|
||||
$general['no'],
|
||||
$general['name'],
|
||||
$srcNation['nation'],
|
||||
$srcNation['name'],
|
||||
$srcNation['color'],
|
||||
GetImageURL($general['imgsvr'], $general['picture'])
|
||||
);
|
||||
|
||||
$dest = new MessageTarget(
|
||||
0,
|
||||
'',
|
||||
$destNation['nation'],
|
||||
$destNation['name'],
|
||||
$destNation['color']
|
||||
);
|
||||
|
||||
$now = new \DateTime($date);
|
||||
$validUntil = new \DateTime($date);
|
||||
$validMinutes = max(30, $turnterm*3);
|
||||
$validUntil->add(new \DateInterval("PT{$validMinutes}M"));
|
||||
|
||||
$msg = new DiplomaticMessage(
|
||||
Message::MSGTYPE_DIPLOMACY,
|
||||
$src,
|
||||
$dest,
|
||||
"{$srcNation['name']}의 항복 권고 서신",
|
||||
$now,
|
||||
$validUntil,
|
||||
['action'=>DiplomaticMessage::TYPE_SURRENDER]
|
||||
);
|
||||
$msg->send();
|
||||
|
||||
$db->update('general', [
|
||||
'dedication'=>$db->sqleval('dedication+%i', $ded),
|
||||
'experience'=>$db->sqleval('experience+%i', $exp)
|
||||
], 'no=%i', $general['no']);
|
||||
|
||||
pushGenLog($general, ["<C>●</>{$month}월:<D><b>{$destNation['name']}</b></>으로 항복 권고 서신을 보냈습니다.<1>$date</>"]);
|
||||
}
|
||||
|
||||
function process_52(&$general) {
|
||||
@@ -473,155 +488,186 @@ function process_52(&$general) {
|
||||
|
||||
function process_53(&$general) {
|
||||
$db = DB::db();
|
||||
$connect=$db->get();
|
||||
|
||||
$log = [];
|
||||
$alllog = [];
|
||||
$history = [];
|
||||
$date = substr($general['turntime'],11,5);
|
||||
list($year, $month, $turnterm) = $db->queryFirstList('SELECT year,month,turnterm FROM game LIMIT 1');
|
||||
|
||||
$query = "select year,month from game limit 1";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$admin = MYDB_fetch_array($result);
|
||||
if($general['level'] < 5 || $general['nation']==0) {
|
||||
pushGenLog($general, ["<C>●</>{$month}월:수뇌부가 아닙니다. 제의 실패. <1>$date</>"]);
|
||||
return;
|
||||
}
|
||||
|
||||
$supply = $db->queryFirstField('SELECT supply FROM city WHERE city=%i AND nation=%i', $general['city'], $general['nation']);
|
||||
$myTurn = $db->queryFirstField('SELECT %b FROM nation WHERE nation=%i', "l{$general['level']}turn0", $general['nation']);
|
||||
|
||||
$query = "select nation,supply from city where city='{$general['city']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$city = MYDB_fetch_array($result);
|
||||
|
||||
$query = "select name,l{$general['level']}turn0 from nation where nation='{$general['nation']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$nation = MYDB_fetch_array($result);
|
||||
|
||||
$command = DecodeCommand($nation["l{$general['level']}turn0"]);
|
||||
$command = DecodeCommand($myTurn);
|
||||
$which = $command[1];
|
||||
|
||||
$query = "select nation,name,dip0,dip0_type,dip0_who,dip0_when,dip1,dip1_type,dip1_who,dip1_when,dip2,dip2_type,dip2_who,dip2_when,dip3,dip3_type,dip3_who,dip3_when,dip4,dip4_type,dip4_who,dip4_when from nation where nation='$which'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$younation = MYDB_fetch_array($result);
|
||||
$srcNation = getNationStaticInfo($general['nation']);
|
||||
$destNation = getNationStaticInfo($which);
|
||||
|
||||
if($younation['nation'] == 0) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:멸망한 국가입니다. 제의 실패. <1>$date</>";
|
||||
} elseif($general['level'] < 5) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:수뇌부가 아닙니다. 제의 실패. <1>$date</>";
|
||||
} elseif($city['nation'] != $general['nation']) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:아국이 아닙니다. 제의 실패. <1>$date</>";
|
||||
} elseif($city['supply'] == 0) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:고립된 도시입니다. 제의 실패. <1>$date</>";
|
||||
} else {
|
||||
$log[] = "<C>●</>{$admin['month']}월:<D><b>{$younation['name']}</b></>(으)로 통합 제의 서신을 보냈습니다.<1>$date</>";
|
||||
$exp = 5;
|
||||
$ded = 5;
|
||||
|
||||
// 성격 보정
|
||||
$exp = CharExperience($exp, $general['personal']);
|
||||
$ded = CharDedication($ded, $general['personal']);
|
||||
|
||||
// 상대에게 발송
|
||||
//먼저 삭제된 칸 중 가장 오래된 칸 찾음
|
||||
$deleted = 4;
|
||||
for($i=0; $i < 5; $i++) {
|
||||
if($younation["dip{$i}"] == "") { $deleted = $i; }
|
||||
}
|
||||
//기존 메세지 한칸씩 뒤로 미룸
|
||||
for($i=$deleted-1; $i >=0; $i--) {
|
||||
moveMsg("nation", "dip", $i+1, $younation["dip{$i}"], $younation["dip{$i}_type"], $younation["dip{$i}_who"], $younation["dip{$i}_when"], "nation", $younation['nation']);
|
||||
}
|
||||
//권고 서신시 장수번호/상대국 번호
|
||||
$me = $general['no'] * 10000 + $younation['nation'];
|
||||
$date = date('Y-m-d H:i:s');
|
||||
$query = "update nation set dip0='{$nation['name']}의 통합 제의 서신',dip0_type='5',dip0_who='$me',dip0_when='$date' where nation='{$younation['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
|
||||
$query = "update general set dedication=dedication+'$ded',experience=experience+'$exp' where no='{$general['no']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
// $log = checkAbility($general, $log);
|
||||
if($destNation['nation'] == 0) {
|
||||
pushGenLog($general, ["<C>●</>{$month}월:멸망한 국가입니다. 제의 실패. <1>$date</>"]);
|
||||
return;
|
||||
}
|
||||
|
||||
if($supply === null) {
|
||||
pushGenLog($general, ["<C>●</>{$month}월:아국이 아닙니다. 제의 실패. <1>$date</>"]);
|
||||
return;
|
||||
}
|
||||
pushGenLog($general, $log);
|
||||
|
||||
if($supply === 0) {
|
||||
pushGenLog($general, ["<C>●</>{$month}월:고립된 도시입니다. 제의 실패. <1>$date</>"]);
|
||||
return;
|
||||
}
|
||||
|
||||
$exp = 5;
|
||||
$ded = 5;
|
||||
|
||||
// 성격 보정
|
||||
$exp = CharExperience($exp, $general['personal']);
|
||||
$ded = CharDedication($ded, $general['personal']);
|
||||
|
||||
// 상대에게 발송
|
||||
$src = new MessageTarget(
|
||||
$general['no'],
|
||||
$general['name'],
|
||||
$srcNation['nation'],
|
||||
$srcNation['name'],
|
||||
$srcNation['color'],
|
||||
GetImageURL($general['imgsvr'], $general['picture'])
|
||||
);
|
||||
|
||||
$dest = new MessageTarget(
|
||||
0,
|
||||
'',
|
||||
$destNation['nation'],
|
||||
$destNation['name'],
|
||||
$destNation['color']
|
||||
);
|
||||
|
||||
$now = new \DateTime($date);
|
||||
$validUntil = new \DateTime($date);
|
||||
$validMinutes = max(30, $turnterm*3);
|
||||
$validUntil->add(new \DateInterval("PT{$validMinutes}M"));
|
||||
|
||||
$msg = new DiplomaticMessage(
|
||||
Message::MSGTYPE_DIPLOMACY,
|
||||
$src,
|
||||
$dest,
|
||||
"{$srcNation['name']}의 통합 제의 서신",
|
||||
$now,
|
||||
$validUntil,
|
||||
['action'=>DiplomaticMessage::TYPE_MERGE]
|
||||
);
|
||||
$msg->send();
|
||||
|
||||
$db->update('general', [
|
||||
'dedication'=>$db->sqleval('dedication+%i', $ded),
|
||||
'experience'=>$db->sqleval('experience+%i', $exp)
|
||||
], 'no=%i', $general['no']);
|
||||
|
||||
pushGenLog($general, ["<C>●</>{$month}월:<D><b>{$destNation['name']}</b></>(으)로 통합 제의 서신을 보냈습니다.<1>$date</>"]);
|
||||
}
|
||||
|
||||
|
||||
function process_61(&$general) {
|
||||
$db = DB::db();
|
||||
$connect=$db->get();
|
||||
|
||||
$log = [];
|
||||
$alllog = [];
|
||||
$history = [];
|
||||
$date = substr($general['turntime'],11,5);
|
||||
list($year, $month, $turnterm) = $db->queryFirstList('SELECT year,month,turnterm FROM game LIMIT 1');
|
||||
|
||||
$query = "select year,month,develcost,turnterm from game limit 1";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$admin = MYDB_fetch_array($result);
|
||||
|
||||
$query = "select nation,supply from city where city='{$general['city']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$city = MYDB_fetch_array($result);
|
||||
|
||||
$query = "select gold,rice,name,l{$general['level']}turn0 from nation where nation='{$general['nation']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$nation = MYDB_fetch_array($result);
|
||||
|
||||
$command = DecodeCommand($nation["l{$general['level']}turn0"]);
|
||||
$when = $command[2];
|
||||
$which = $command[1];
|
||||
|
||||
if($when < 1) { $when = 1; }
|
||||
elseif($when > 20) { $when = 20; }
|
||||
|
||||
$query = "select nation,name,dip0,dip0_type,dip0_who,dip0_when,dip1,dip1_type,dip1_who,dip1_when,dip2,dip2_type,dip2_who,dip2_when,dip3,dip3_type,dip3_who,dip3_when,dip4,dip4_type,dip4_who,dip4_when from nation where nation='$which'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$younation = MYDB_fetch_array($result);
|
||||
|
||||
if($younation['nation'] == 0) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:멸망한 국가입니다. 제의 실패. <1>$date</>";
|
||||
} elseif($general['level'] < 5) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:수뇌부가 아닙니다. 제의 실패. <1>$date</>";
|
||||
} elseif($city['nation'] != $general['nation']) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:아국이 아닙니다. 제의 실패. <1>$date</>";
|
||||
} elseif($city['supply'] == 0) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:고립된 도시입니다. 제의 실패. <1>$date</>";
|
||||
} else {
|
||||
$log[] = "<C>●</>{$admin['month']}월:<D><b>{$younation['name']}</b></>으로 불가침 제의 서신을 보냈습니다.<1>$date</>";
|
||||
$exp = 5;
|
||||
$ded = 5;
|
||||
|
||||
// 성격 보정
|
||||
$exp = CharExperience($exp, $general['personal']);
|
||||
$ded = CharDedication($ded, $general['personal']);
|
||||
|
||||
// 상대에게 발송
|
||||
//먼저 삭제된 칸 중 가장 오래된 칸 찾음
|
||||
$deleted = 4;
|
||||
for($i=0; $i < 5; $i++) {
|
||||
if($younation["dip{$i}"] == "") { $deleted = $i; }
|
||||
}
|
||||
//기존 메세지 한칸씩 뒤로 미룸
|
||||
for($i=$deleted-1; $i >=0; $i--) {
|
||||
moveMsg("nation", "dip", $i+1, $younation["dip{$i}"], $younation["dip{$i}_type"], $younation["dip{$i}_who"], $younation["dip{$i}_when"], "nation", $younation['nation']);
|
||||
}
|
||||
//권고 서신시 장수번호/상대국 번호
|
||||
$me = $general['no'] * 10000 + $younation['nation'];
|
||||
$type = $when * 100 + 6;
|
||||
$date = date('Y-m-d H:i:s');
|
||||
$query = "update nation set dip0='{$nation['name']}의 {$when}년 불가침 제의 서신',dip0_type='$type',dip0_who='$me',dip0_when='$date' where nation='{$younation['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
|
||||
// 3턴후
|
||||
$date = addTurn($date, $admin['turnterm'], 3);
|
||||
//조건 표시기한 설정
|
||||
$query = "update diplomacy set showing='{$date}' where me='{$general['nation']}' and you='{$younation['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
|
||||
// $admin['develcost']*10씩 차감
|
||||
// $amount = $admin['develcost'];
|
||||
// $query = "update nation set gold=gold-'$amount',rice=rice-'$amount' where nation='{$general['nation']}'";
|
||||
// MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
|
||||
$query = "update general set dedication=dedication+'$ded',experience=experience+'$exp' where no='{$general['no']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
// $log = checkAbility($general, $log);
|
||||
if($general['level'] < 5 || $general['nation']==0) {
|
||||
pushGenLog($general, ["<C>●</>{$month}월:수뇌부가 아닙니다. 제의 실패. <1>$date</>"]);
|
||||
return;
|
||||
}
|
||||
pushGenLog($general, $log);
|
||||
|
||||
$supply = $db->queryFirstField('SELECT supply FROM city WHERE city=%i AND nation=%i', $general['city'], $general['nation']);
|
||||
$myTurn = $db->queryFirstField('SELECT %b FROM nation WHERE nation=%i', "l{$general['level']}turn0", $general['nation']);
|
||||
|
||||
$command = DecodeCommand($myTurn);
|
||||
$which = $command[1];
|
||||
$when = Util::valueFit($command[2], 1, 20);
|
||||
|
||||
$srcNation = getNationStaticInfo($general['nation']);
|
||||
$destNation = getNationStaticInfo($which);
|
||||
|
||||
if($destNation['nation'] == 0) {
|
||||
pushGenLog($general, ["<C>●</>{$month}월:멸망한 국가입니다. 제의 실패. <1>$date</>"]);
|
||||
return;
|
||||
}
|
||||
|
||||
if($supply === null) {
|
||||
pushGenLog($general, ["<C>●</>{$month}월:아국이 아닙니다. 제의 실패. <1>$date</>"]);
|
||||
return;
|
||||
}
|
||||
|
||||
if($supply === 0) {
|
||||
pushGenLog($general, ["<C>●</>{$month}월:고립된 도시입니다. 제의 실패. <1>$date</>"]);
|
||||
return;
|
||||
}
|
||||
|
||||
$exp = 5;
|
||||
$ded = 5;
|
||||
|
||||
// 성격 보정
|
||||
$exp = CharExperience($exp, $general['personal']);
|
||||
$ded = CharDedication($ded, $general['personal']);
|
||||
|
||||
// 상대에게 발송
|
||||
$src = new MessageTarget(
|
||||
$general['no'],
|
||||
$general['name'],
|
||||
$srcNation['nation'],
|
||||
$srcNation['name'],
|
||||
$srcNation['color'],
|
||||
GetImageURL($general['imgsvr'], $general['picture'])
|
||||
);
|
||||
|
||||
$dest = new MessageTarget(
|
||||
0,
|
||||
'',
|
||||
$destNation['nation'],
|
||||
$destNation['name'],
|
||||
$destNation['color']
|
||||
);
|
||||
|
||||
$now = new \DateTime($date);
|
||||
$validUntil = new \DateTime($date);
|
||||
$validMinutes = max(30, $turnterm*3);
|
||||
$validUntil->add(new \DateInterval("PT{$validMinutes}M"));
|
||||
|
||||
//FIXME: 현재 command가 숫자로만 이루어져 있어서 문자열을 처리할 수 없다.
|
||||
//XXX: 으악.
|
||||
//TODO: 커맨드 처리 방식을 json으로 변경
|
||||
$option = $db->queryFirstField('SELECT reserved FROM diplomacy WHERE me=%i AND you=%i', $src->nationID, $dest->nationID);
|
||||
|
||||
$msg = new DiplomaticMessage(
|
||||
Message::MSGTYPE_DIPLOMACY,
|
||||
$src,
|
||||
$dest,
|
||||
"{$srcNation['name']}의 불가침 제의 서신",
|
||||
$now,
|
||||
$validUntil,
|
||||
[
|
||||
'action'=>DiplomaticMessage::TYPE_NO_AGGRESSION,
|
||||
'year'=>$when,
|
||||
'option'=>$option
|
||||
]
|
||||
);
|
||||
$msg->send();
|
||||
|
||||
//NOTE: 현재 내무부 외교란의 비고는 diplomacy가 기준이니까 유지할 필요는 있다.
|
||||
//FIXME: 외교란도 message란의 diplomacy를 참조하든가 하도록.
|
||||
$db->update('diplomacy', [
|
||||
'showing'=>$validUntil->format('Y-m-d H:i:s')
|
||||
], 'me=%i AND you=%i', $src->nationID, $dest->nationID);
|
||||
// 3턴후
|
||||
|
||||
$db->update('general', [
|
||||
'dedication'=>$db->sqleval('dedication+%i', $ded),
|
||||
'experience'=>$db->sqleval('experience+%i', $exp)
|
||||
], 'no=%i', $general['no']);
|
||||
|
||||
pushGenLog($general, ["<C>●</>{$month}월:<D><b>{$destNation['name']}</b></>으로 불가침 제의 서신을 보냈습니다.<1>$date</>"]);
|
||||
}
|
||||
|
||||
function process_62(&$general) {
|
||||
@@ -724,138 +770,168 @@ function process_62(&$general) {
|
||||
|
||||
function process_63(&$general) {
|
||||
$db = DB::db();
|
||||
$connect=$db->get();
|
||||
|
||||
$log = [];
|
||||
$alllog = [];
|
||||
$history = [];
|
||||
$date = substr($general['turntime'],11,5);
|
||||
list($year, $month, $turnterm) = $db->queryFirstList('SELECT year,month,turnterm FROM game LIMIT 1');
|
||||
|
||||
$query = "select year,month from game limit 1";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$admin = MYDB_fetch_array($result);
|
||||
if($general['level'] < 5 || $general['nation']==0) {
|
||||
pushGenLog($general, ["<C>●</>{$month}월:수뇌부가 아닙니다. 제의 실패. <1>$date</>"]);
|
||||
return;
|
||||
}
|
||||
|
||||
$query = "select nation,supply from city where city='{$general['city']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$city = MYDB_fetch_array($result);
|
||||
$supply = $db->queryFirstField('SELECT supply FROM city WHERE city=%i AND nation=%i', $general['city'], $general['nation']);
|
||||
$myTurn = $db->queryFirstField('SELECT %b FROM nation WHERE nation=%i', "l{$general['level']}turn0", $general['nation']);
|
||||
|
||||
$query = "select name,l{$general['level']}turn0 from nation where nation='{$general['nation']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$nation = MYDB_fetch_array($result);
|
||||
|
||||
$command = DecodeCommand($nation["l{$general['level']}turn0"]);
|
||||
$command = DecodeCommand($myTurn);
|
||||
$which = $command[1];
|
||||
|
||||
$query = "select nation,name,dip0,dip0_type,dip0_who,dip0_when,dip1,dip1_type,dip1_who,dip1_when,dip2,dip2_type,dip2_who,dip2_when,dip3,dip3_type,dip3_who,dip3_when,dip4,dip4_type,dip4_who,dip4_when from nation where nation='$which'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$younation = MYDB_fetch_array($result);
|
||||
$srcNation = getNationStaticInfo($general['nation']);
|
||||
$destNation = getNationStaticInfo($which);
|
||||
|
||||
if($younation['nation'] == 0) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:멸망한 국가입니다. 제의 실패. <1>$date</>";
|
||||
} elseif($general['level'] < 5) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:수뇌부가 아닙니다. 제의 실패. <1>$date</>";
|
||||
} elseif($city['nation'] != $general['nation']) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:아국이 아닙니다. 제의 실패. <1>$date</>";
|
||||
} elseif($city['supply'] == 0) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:고립된 도시입니다. 제의 실패. <1>$date</>";
|
||||
} else {
|
||||
$log[] = "<C>●</>{$admin['month']}월:<D><b>{$younation['name']}</b></>으로 종전 제의 서신을 보냈습니다. <1>$date</>";
|
||||
$exp = 5;
|
||||
$ded = 5;
|
||||
|
||||
// 성격 보정
|
||||
$exp = CharExperience($exp, $general['personal']);
|
||||
$ded = CharDedication($ded, $general['personal']);
|
||||
|
||||
// 상대에게 발송
|
||||
//먼저 삭제된 칸 중 가장 오래된 칸 찾음
|
||||
$deleted = 4;
|
||||
for($i=0; $i < 5; $i++) {
|
||||
if($younation["dip{$i}"] == "") { $deleted = $i; }
|
||||
}
|
||||
//기존 메세지 한칸씩 뒤로 미룸
|
||||
for($i=$deleted-1; $i >=0; $i--) {
|
||||
moveMsg("nation", "dip", $i+1, $younation["dip{$i}"], $younation["dip{$i}_type"], $younation["dip{$i}_who"], $younation["dip{$i}_when"], "nation", $younation['nation']);
|
||||
}
|
||||
//권고 서신시 장수번호/상대국 번호
|
||||
$me = $general['no'] * 10000 + $younation['nation'];
|
||||
$date = date('Y-m-d H:i:s');
|
||||
$query = "update nation set dip0='{$nation['name']}의 종전 제의 서신',dip0_type='7',dip0_who='$me',dip0_when='$date' where nation='{$younation['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
|
||||
$query = "update general set dedication=dedication+'$ded',experience=experience+'$exp' where no='{$general['no']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
// $log = checkAbility($general, $log);
|
||||
if($destNation['nation'] == 0) {
|
||||
pushGenLog($general, ["<C>●</>{$month}월:멸망한 국가입니다. 제의 실패. <1>$date</>"]);
|
||||
return;
|
||||
}
|
||||
|
||||
if($supply === null) {
|
||||
pushGenLog($general, ["<C>●</>{$month}월:아국이 아닙니다. 제의 실패. <1>$date</>"]);
|
||||
return;
|
||||
}
|
||||
pushGenLog($general, $log);
|
||||
|
||||
if($supply === 0) {
|
||||
pushGenLog($general, ["<C>●</>{$month}월:고립된 도시입니다. 제의 실패. <1>$date</>"]);
|
||||
return;
|
||||
}
|
||||
|
||||
$exp = 5;
|
||||
$ded = 5;
|
||||
|
||||
// 성격 보정
|
||||
$exp = CharExperience($exp, $general['personal']);
|
||||
$ded = CharDedication($ded, $general['personal']);
|
||||
|
||||
// 상대에게 발송
|
||||
$src = new MessageTarget(
|
||||
$general['no'],
|
||||
$general['name'],
|
||||
$srcNation['nation'],
|
||||
$srcNation['name'],
|
||||
$srcNation['color'],
|
||||
GetImageURL($general['imgsvr'], $general['picture'])
|
||||
);
|
||||
|
||||
$dest = new MessageTarget(
|
||||
0,
|
||||
'',
|
||||
$destNation['nation'],
|
||||
$destNation['name'],
|
||||
$destNation['color']
|
||||
);
|
||||
|
||||
$now = new \DateTime($date);
|
||||
$validUntil = new \DateTime($date);
|
||||
$validMinutes = max(30, $turnterm*3);
|
||||
$validUntil->add(new \DateInterval("PT{$validMinutes}M"));
|
||||
|
||||
$msg = new DiplomaticMessage(
|
||||
Message::MSGTYPE_DIPLOMACY,
|
||||
$src,
|
||||
$dest,
|
||||
"{$srcNation['name']}의 종전 제의 서신",
|
||||
$now,
|
||||
$validUntil,
|
||||
['action'=>DiplomaticMessage::TYPE_STOP_WAR]
|
||||
);
|
||||
$msg->send();
|
||||
|
||||
$db->update('general', [
|
||||
'dedication'=>$db->sqleval('dedication+%i', $ded),
|
||||
'experience'=>$db->sqleval('experience+%i', $exp)
|
||||
], 'no=%i', $general['no']);
|
||||
|
||||
pushGenLog($general, ["<C>●</>{$month}월:<D><b>{$destNation['name']}</b></>으로 종전 제의 서신을 보냈습니다. <1>$date</>"]);
|
||||
}
|
||||
|
||||
function process_64(&$general) {
|
||||
$db = DB::db();
|
||||
$connect=$db->get();
|
||||
|
||||
$log = [];
|
||||
$alllog = [];
|
||||
$history = [];
|
||||
$date = substr($general['turntime'],11,5);
|
||||
list($year, $month, $turnterm) = $db->queryFirstList('SELECT year,month,turnterm FROM game LIMIT 1');
|
||||
|
||||
$query = "select year,month from game limit 1";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$admin = MYDB_fetch_array($result);
|
||||
if($general['level'] < 5 || $general['nation']==0) {
|
||||
pushGenLog($general, ["<C>●</>{$month}월:수뇌부가 아닙니다. 제의 실패. <1>$date</>"]);
|
||||
return;
|
||||
}
|
||||
|
||||
$query = "select nation,supply from city where city='{$general['city']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$city = MYDB_fetch_array($result);
|
||||
$supply = $db->queryFirstField('SELECT supply FROM city WHERE city=%i AND nation=%i', $general['city'], $general['nation']);
|
||||
$myTurn = $db->queryFirstField('SELECT %b FROM nation WHERE nation=%i', "l{$general['level']}turn0", $general['nation']);
|
||||
|
||||
$query = "select name,l{$general['level']}turn0 from nation where nation='{$general['nation']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$nation = MYDB_fetch_array($result);
|
||||
|
||||
$command = DecodeCommand($nation["l{$general['level']}turn0"]);
|
||||
$command = DecodeCommand($myTurn);
|
||||
$which = $command[1];
|
||||
|
||||
$query = "select nation,name,dip0,dip0_type,dip0_who,dip0_when,dip1,dip1_type,dip1_who,dip1_when,dip2,dip2_type,dip2_who,dip2_when,dip3,dip3_type,dip3_who,dip3_when,dip4,dip4_type,dip4_who,dip4_when from nation where nation='$which'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$younation = MYDB_fetch_array($result);
|
||||
$srcNation = getNationStaticInfo($general['nation']);
|
||||
$destNation = getNationStaticInfo($which);
|
||||
|
||||
if($younation['nation'] == 0) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:멸망한 국가입니다. 제의 실패. <1>$date</>";
|
||||
} elseif($general['level'] < 5) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:수뇌부가 아닙니다. 제의 실패. <1>$date</>";
|
||||
} elseif($city['nation'] != $general['nation']) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:아국이 아닙니다. 제의 실패. <1>$date</>";
|
||||
} elseif($city['supply'] == 0) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:고립된 도시입니다. 제의 실패. <1>$date</>";
|
||||
} else {
|
||||
$log[] = "<C>●</>{$admin['month']}월:<D><b>{$younation['name']}</b></>으로 파기 제의 서신을 보냈습니다. <1>$date</>";
|
||||
$exp = 5;
|
||||
$ded = 5;
|
||||
|
||||
// 성격 보정
|
||||
$exp = CharExperience($exp, $general['personal']);
|
||||
$ded = CharDedication($ded, $general['personal']);
|
||||
|
||||
// 상대에게 발송
|
||||
//먼저 삭제된 칸 중 가장 오래된 칸 찾음
|
||||
$deleted = 4;
|
||||
for($i=0; $i < 5; $i++) {
|
||||
if($younation["dip{$i}"] == "") { $deleted = $i; }
|
||||
}
|
||||
//기존 메세지 한칸씩 뒤로 미룸
|
||||
for($i=$deleted-1; $i >=0; $i--) {
|
||||
moveMsg("nation", "dip", $i+1, $younation["dip{$i}"], $younation["dip{$i}_type"], $younation["dip{$i}_who"], $younation["dip{$i}_when"], "nation", $younation['nation']);
|
||||
}
|
||||
//권고 서신시 장수번호/상대국 번호
|
||||
$me = $general['no'] * 10000 + $younation['nation'];
|
||||
$date = date('Y-m-d H:i:s');
|
||||
$query = "update nation set dip0='{$nation['name']}의 불가침 파기 서신',dip0_type='8',dip0_who='$me',dip0_when='$date' where nation='{$younation['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
|
||||
$query = "update general set dedication=dedication+'$ded',experience=experience+'$exp' where no='{$general['no']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
// $log = checkAbility($general, $log);
|
||||
if($destNation['nation'] == 0) {
|
||||
pushGenLog($general, ["<C>●</>{$month}월:멸망한 국가입니다. 제의 실패. <1>$date</>"]);
|
||||
return;
|
||||
}
|
||||
|
||||
if($supply === null) {
|
||||
pushGenLog($general, ["<C>●</>{$month}월:아국이 아닙니다. 제의 실패. <1>$date</>"]);
|
||||
return;
|
||||
}
|
||||
pushGenLog($general, $log);
|
||||
|
||||
if($supply === 0) {
|
||||
pushGenLog($general, ["<C>●</>{$month}월:고립된 도시입니다. 제의 실패. <1>$date</>"]);
|
||||
return;
|
||||
}
|
||||
|
||||
$exp = 5;
|
||||
$ded = 5;
|
||||
|
||||
// 성격 보정
|
||||
$exp = CharExperience($exp, $general['personal']);
|
||||
$ded = CharDedication($ded, $general['personal']);
|
||||
|
||||
// 상대에게 발송
|
||||
$src = new MessageTarget(
|
||||
$general['no'],
|
||||
$general['name'],
|
||||
$srcNation['nation'],
|
||||
$srcNation['name'],
|
||||
$srcNation['color'],
|
||||
GetImageURL($general['imgsvr'], $general['picture'])
|
||||
);
|
||||
|
||||
$dest = new MessageTarget(
|
||||
0,
|
||||
'',
|
||||
$destNation['nation'],
|
||||
$destNation['name'],
|
||||
$destNation['color']
|
||||
);
|
||||
|
||||
$now = new \DateTime($date);
|
||||
$validUntil = new \DateTime($date);
|
||||
$validMinutes = max(30, $turnterm*3);
|
||||
$validUntil->add(new \DateInterval("PT{$validMinutes}M"));
|
||||
|
||||
$msg = new DiplomaticMessage(
|
||||
Message::MSGTYPE_DIPLOMACY,
|
||||
$src,
|
||||
$dest,
|
||||
"{$srcNation['name']}의 불가침 파기 제의 서신",
|
||||
$now,
|
||||
$validUntil,
|
||||
['action'=>DiplomaticMessage::TYPE_CANCEL_NA]
|
||||
);
|
||||
$msg->send();
|
||||
|
||||
$db->update('general', [
|
||||
'dedication'=>$db->sqleval('dedication+%i', $ded),
|
||||
'experience'=>$db->sqleval('experience+%i', $exp)
|
||||
], 'no=%i', $general['no']);
|
||||
|
||||
pushGenLog($general, ["<C>●</>{$month}월:<D><b>{$destNation['name']}</b></>(으)로 불가침 파기 제의 서신을 보냈습니다.<1>$date</>"]);
|
||||
}
|
||||
|
||||
function process_65(&$general) {
|
||||
@@ -1243,7 +1319,7 @@ function process_71(&$general) {
|
||||
$log = [];
|
||||
$alllog = [];
|
||||
$history = [];
|
||||
$tricklog = [];
|
||||
$sabotagelog = [];
|
||||
|
||||
$date = substr($general['turntime'],11,5);
|
||||
|
||||
@@ -1255,7 +1331,7 @@ function process_71(&$general) {
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$city = MYDB_fetch_array($result);
|
||||
|
||||
$query = "select nation,name,type,tricklimit,l{$general['level']}term,l{$general['level']}turn0 from nation where nation='{$general['nation']}'";
|
||||
$query = "select nation,name,type,sabotagelimit,l{$general['level']}term,l{$general['level']}turn0 from nation where nation='{$general['nation']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$nation = MYDB_fetch_array($result);
|
||||
|
||||
@@ -1288,7 +1364,7 @@ function process_71(&$general) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:수뇌부가 아닙니다. 필사즉생 실패. <1>$date</>";
|
||||
} elseif($dipCount == 0) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:전쟁중이 아닙니다. 필사즉생 실패. <1>$date</>";
|
||||
} elseif($nation['tricklimit'] > 0) {
|
||||
} elseif($nation['sabotagelimit'] > 0) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:전략기한이 남았습니다. 필사즉생 실패. <1>$date</>";
|
||||
} elseif($term < $term2) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:필사즉생 수행중... ({$term}/{$term2}) <1>$date</>";
|
||||
@@ -1315,7 +1391,7 @@ function process_71(&$general) {
|
||||
|
||||
// $alllog[] = "<C>●</>{$admin['month']}월:<Y>{$general['name']}</>(이)가 <M>필사즉생</>(을)를 발동하였습니다.";
|
||||
// $history[] = "<C>●</>{$admin['year']}년 {$admin['month']}월:<L><b>【전략】</b></><D><b>{$nation['name']}</b></>(이)가 <M>필사즉생</>(을)를 발동하였습니다.";
|
||||
$tricklog[] = "<C>●</>{$admin['year']}년 {$admin['month']}월:<L><b>【전략】</b></><D><b>{$nation['name']}</b></>(이)가 <M>필사즉생</>(을)를 발동하였습니다.";
|
||||
$sabotagelog[] = "<C>●</>{$admin['year']}년 {$admin['month']}월:<L><b>【전략】</b></><D><b>{$nation['name']}</b></>(이)가 <M>필사즉생</>(을)를 발동하였습니다.";
|
||||
pushGeneralHistory($general, "<C>●</>{$admin['year']}년 {$admin['month']}월:<M>필사즉생</>(을)를 발동");
|
||||
pushNationHistory($nation, "<C>●</>{$admin['year']}년 {$admin['month']}월:<Y>{$general['name']}</>(이)가 <M>필사즉생</>(을)를 발동");
|
||||
|
||||
@@ -1328,7 +1404,7 @@ function process_71(&$general) {
|
||||
if($nation['type'] == 12) { $term3 = $term3 * 2; }
|
||||
|
||||
//전략기한
|
||||
$query = "update nation set tricklimit={$term3} where nation='{$general['nation']}'";
|
||||
$query = "update nation set sabotagelimit={$term3} where nation='{$general['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
|
||||
//경험치, 공헌치
|
||||
@@ -1338,7 +1414,7 @@ function process_71(&$general) {
|
||||
|
||||
// pushWorldHistory($history, $admin['year'], $admin['month']);
|
||||
// pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']);
|
||||
pushTrickLog($tricklog);
|
||||
pushSabotageLog($sabotagelog);
|
||||
pushGenLog($general, $log);
|
||||
}
|
||||
|
||||
@@ -1349,7 +1425,7 @@ function process_72(&$general) {
|
||||
$log = [];
|
||||
$alllog = [];
|
||||
$history = [];
|
||||
$tricklog = [];
|
||||
$sabotagelog = [];
|
||||
|
||||
$date = substr($general['turntime'],11,5);
|
||||
|
||||
@@ -1361,7 +1437,7 @@ function process_72(&$general) {
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$city = MYDB_fetch_array($result);
|
||||
|
||||
$query = "select nation,name,type,tricklimit,l{$general['level']}term,l{$general['level']}turn0 from nation where nation='{$general['nation']}'";
|
||||
$query = "select nation,name,type,sabotagelimit,l{$general['level']}term,l{$general['level']}turn0 from nation where nation='{$general['nation']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$nation = MYDB_fetch_array($result);
|
||||
|
||||
@@ -1401,7 +1477,7 @@ function process_72(&$general) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:수뇌부가 아닙니다. 백성동원 실패. <1>$date</>";
|
||||
} elseif($dipCount == 0) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:전쟁중이 아닙니다. 백성동원 실패. <1>$date</>";
|
||||
} elseif($nation['tricklimit'] > 0) {
|
||||
} elseif($nation['sabotagelimit'] > 0) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:전략기한이 남았습니다. 백성동원 실패. <1>$date</>";
|
||||
} elseif($destcity['nation'] != $general['nation']) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:아국 도시만 가능합니다. 백성동원 실패. <1>$date</>";
|
||||
@@ -1430,7 +1506,7 @@ function process_72(&$general) {
|
||||
|
||||
// $alllog[] = "<C>●</>{$admin['month']}월:<Y>{$general['name']}</>(이)가 <G><b>{$destcity['name']}</b></>에 <M>백성동원</>(을)를 발동하였습니다.";
|
||||
// $history[] = "<C>●</>{$admin['year']}년 {$admin['month']}월:<L><b>【전략】</b></><D><b>{$nation['name']}</b></>(이)가 <G><b>{$destcity['name']}</b></>에 <M>백성동원</>(을)를 발동하였습니다.";
|
||||
$tricklog[] = "<C>●</>{$admin['year']}년 {$admin['month']}월:<L><b>【전략】</b></><D><b>{$nation['name']}</b></>(이)가 <G><b>{$destcity['name']}</b></>에 <M>백성동원</>(을)를 발동하였습니다.";
|
||||
$sabotagelog[] = "<C>●</>{$admin['year']}년 {$admin['month']}월:<L><b>【전략】</b></><D><b>{$nation['name']}</b></>(이)가 <G><b>{$destcity['name']}</b></>에 <M>백성동원</>(을)를 발동하였습니다.";
|
||||
pushGeneralHistory($general, "<C>●</>{$admin['year']}년 {$admin['month']}월:<G><b>{$destcity['name']}</b></>에 <M>백성동원</>(을)를 발동");
|
||||
pushNationHistory($nation, "<C>●</>{$admin['year']}년 {$admin['month']}월:<Y>{$general['name']}</>(이)가 <G><b>{$destcity['name']}</b></>에 <M>백성동원</>(을)를 발동");
|
||||
|
||||
@@ -1443,7 +1519,7 @@ function process_72(&$general) {
|
||||
if($nation['type'] == 12) { $term3 = $term3 * 2; }
|
||||
|
||||
//전략기한
|
||||
$query = "update nation set tricklimit={$term3} where nation='{$general['nation']}'";
|
||||
$query = "update nation set sabotagelimit={$term3} where nation='{$general['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
|
||||
//경험치, 공헌치
|
||||
@@ -1453,7 +1529,7 @@ function process_72(&$general) {
|
||||
|
||||
// pushWorldHistory($history, $admin['year'], $admin['month']);
|
||||
// pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']);
|
||||
pushTrickLog($tricklog);
|
||||
pushSabotageLog($sabotagelog);
|
||||
pushGenLog($general, $log);
|
||||
}
|
||||
|
||||
@@ -1464,7 +1540,7 @@ function process_73(&$general) {
|
||||
$log = [];
|
||||
$alllog = [];
|
||||
$history = [];
|
||||
$tricklog = [];
|
||||
$sabotagelog = [];
|
||||
|
||||
$date = substr($general['turntime'],11,5);
|
||||
|
||||
@@ -1476,7 +1552,7 @@ function process_73(&$general) {
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$city = MYDB_fetch_array($result);
|
||||
|
||||
$query = "select nation,name,type,tricklimit,l{$general['level']}term,l{$general['level']}turn0 from nation where nation='{$general['nation']}'";
|
||||
$query = "select nation,name,type,sabotagelimit,l{$general['level']}term,l{$general['level']}turn0 from nation where nation='{$general['nation']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$nation = MYDB_fetch_array($result);
|
||||
|
||||
@@ -1524,7 +1600,7 @@ function process_73(&$general) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:대상도시가 아국입니다. 수몰 실패. <1>$date</>";
|
||||
} elseif($dip['state'] > 0) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:전쟁중인 상대국에만 가능합니다. 수몰 실패. <1>$date</>";
|
||||
} elseif($nation['tricklimit'] > 0) {
|
||||
} elseif($nation['sabotagelimit'] > 0) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:전략기한이 남았습니다. 수몰 실패. <1>$date</>";
|
||||
} elseif($term < $term2) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:수몰 수행중... ({$term}/{$term2}) <1>$date</>";
|
||||
@@ -1560,7 +1636,7 @@ function process_73(&$general) {
|
||||
|
||||
// $alllog[] = "<C>●</>{$admin['month']}월:<Y>{$general['name']}</>(이)가 <G><b>{$destcity['name']}</b></>에 <M>수몰</>(을)를 발동하였습니다.";
|
||||
// $history[] = "<C>●</>{$admin['year']}년 {$admin['month']}월:<L><b>【전략】</b></><D><b>{$nation['name']}</b></>(이)가 <G><b>{$destcity['name']}</b></>에 <M>수몰</>(을)를 발동하였습니다.";
|
||||
$tricklog[] = "<C>●</>{$admin['year']}년 {$admin['month']}월:<L><b>【전략】</b></><D><b>{$nation['name']}</b></>(이)가 <G><b>{$destcity['name']}</b></>에 <M>수몰</>(을)를 발동하였습니다.";
|
||||
$sabotagelog[] = "<C>●</>{$admin['year']}년 {$admin['month']}월:<L><b>【전략】</b></><D><b>{$nation['name']}</b></>(이)가 <G><b>{$destcity['name']}</b></>에 <M>수몰</>(을)를 발동하였습니다.";
|
||||
pushGeneralHistory($general, "<C>●</>{$admin['year']}년 {$admin['month']}월:<G><b>{$destcity['name']}</b></>에 <M>수몰</>(을)를 발동");
|
||||
pushNationHistory($nation, "<C>●</>{$admin['year']}년 {$admin['month']}월:<Y>{$general['name']}</>(이)가 <D><b>{$destnation['name']}</b></>의 <G><b>{$destcity['name']}</b></>에 <M>수몰</>(을)를 발동");
|
||||
pushNationHistory($destnation, "<C>●</>{$admin['year']}년 {$admin['month']}월:<D><b>{$nation['name']}</b></>의 <Y>{$general['name']}</>(이)가 아국의 <G><b>{$destcity['name']}</b></>에 <M>수몰</>(을)를 발동");
|
||||
@@ -1574,7 +1650,7 @@ function process_73(&$general) {
|
||||
if($nation['type'] == 12) { $term3 = $term3 * 2; }
|
||||
|
||||
//전략기한
|
||||
$query = "update nation set tricklimit={$term3} where nation='{$general['nation']}'";
|
||||
$query = "update nation set sabotagelimit={$term3} where nation='{$general['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
|
||||
//경험치, 공헌치
|
||||
@@ -1584,7 +1660,7 @@ function process_73(&$general) {
|
||||
|
||||
// pushWorldHistory($history, $admin['year'], $admin['month']);
|
||||
// pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']);
|
||||
pushTrickLog($tricklog);
|
||||
pushSabotageLog($sabotagelog);
|
||||
pushGenLog($general, $log);
|
||||
}
|
||||
|
||||
@@ -1595,7 +1671,7 @@ function process_74(&$general) {
|
||||
$log = [];
|
||||
$alllog = [];
|
||||
$history = [];
|
||||
$tricklog = [];
|
||||
$sabotagelog = [];
|
||||
|
||||
$date = substr($general['turntime'],11,5);
|
||||
|
||||
@@ -1607,7 +1683,7 @@ function process_74(&$general) {
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$city = MYDB_fetch_array($result);
|
||||
|
||||
$query = "select nation,name,type,tricklimit,l{$general['level']}term,l{$general['level']}turn0 from nation where nation='{$general['nation']}'";
|
||||
$query = "select nation,name,type,sabotagelimit,l{$general['level']}term,l{$general['level']}turn0 from nation where nation='{$general['nation']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$nation = MYDB_fetch_array($result);
|
||||
|
||||
@@ -1655,7 +1731,7 @@ function process_74(&$general) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:대상도시가 아국입니다. 허보 실패. <1>$date</>";
|
||||
} elseif($dip['state'] > 1) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:선포,전쟁중인 상대국에만 가능합니다. 허보 실패. <1>$date</>";
|
||||
} elseif($nation['tricklimit'] > 0) {
|
||||
} elseif($nation['sabotagelimit'] > 0) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:전략기한이 남았습니다. 허보 실패. <1>$date</>";
|
||||
} elseif($term < $term2) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:허보 수행중... ({$term}/{$term2}) <1>$date</>";
|
||||
@@ -1682,7 +1758,7 @@ function process_74(&$general) {
|
||||
|
||||
// $alllog[] = "<C>●</>{$admin['month']}월:<Y>{$general['name']}</>(이)가 <G><b>{$destcity['name']}</b></>에 <M>허보</>(을)를 발동하였습니다.";
|
||||
// $history[] = "<C>●</>{$admin['year']}년 {$admin['month']}월:<L><b>【전략】</b></><D><b>{$nation['name']}</b></>(이)가 <G><b>{$destcity['name']}</b></>에 <M>허보</>(을)를 발동하였습니다.";
|
||||
$tricklog[] = "<C>●</>{$admin['year']}년 {$admin['month']}월:<L><b>【전략】</b></><D><b>{$nation['name']}</b></>(이)가 <G><b>{$destcity['name']}</b></>에 <M>허보</>(을)를 발동하였습니다.";
|
||||
$sabotagelog[] = "<C>●</>{$admin['year']}년 {$admin['month']}월:<L><b>【전략】</b></><D><b>{$nation['name']}</b></>(이)가 <G><b>{$destcity['name']}</b></>에 <M>허보</>(을)를 발동하였습니다.";
|
||||
pushGeneralHistory($general, "<C>●</>{$admin['year']}년 {$admin['month']}월:<G><b>{$destcity['name']}</b></>에 <M>허보</>(을)를 발동");
|
||||
pushNationHistory($nation, "<C>●</>{$admin['year']}년 {$admin['month']}월:<Y>{$general['name']}</>(이)가 <D><b>{$destnation['name']}</b></>의 <G><b>{$destcity['name']}</b></>에 <M>허보</>(을)를 발동");
|
||||
pushNationHistory($destnation, "<C>●</>{$admin['year']}년 {$admin['month']}월:<D><b>{$nation['name']}</b></>의 <Y>{$general['name']}</>(이)가 아국의 <G><b>{$destcity['name']}</b></>에 <M>허보</>(을)를 발동");
|
||||
@@ -1718,7 +1794,7 @@ function process_74(&$general) {
|
||||
if($nation['type'] == 12) { $term3 = $term3 * 2; }
|
||||
|
||||
//전략기한
|
||||
$query = "update nation set tricklimit={$term3} where nation='{$general['nation']}'";
|
||||
$query = "update nation set sabotagelimit={$term3} where nation='{$general['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
|
||||
//경험치, 공헌치
|
||||
@@ -1728,7 +1804,7 @@ function process_74(&$general) {
|
||||
|
||||
// pushWorldHistory($history, $admin['year'], $admin['month']);
|
||||
// pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']);
|
||||
pushTrickLog($tricklog);
|
||||
pushSabotageLog($sabotagelog);
|
||||
pushGenLog($general, $log);
|
||||
}
|
||||
|
||||
@@ -1739,7 +1815,7 @@ function process_75(&$general) {
|
||||
$log = [];
|
||||
$alllog = [];
|
||||
$history = [];
|
||||
$tricklog = [];
|
||||
$sabotagelog = [];
|
||||
|
||||
$date = substr($general['turntime'],11,5);
|
||||
|
||||
@@ -1751,7 +1827,7 @@ function process_75(&$general) {
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$city = MYDB_fetch_array($result);
|
||||
|
||||
$query = "select nation,name,type,tricklimit,l{$general['level']}term,l{$general['level']}turn0 from nation where nation='{$general['nation']}'";
|
||||
$query = "select nation,name,type,sabotagelimit,l{$general['level']}term,l{$general['level']}turn0 from nation where nation='{$general['nation']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$nation = MYDB_fetch_array($result);
|
||||
|
||||
@@ -1793,7 +1869,7 @@ function process_75(&$general) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:수뇌부가 아닙니다. 피장파장 실패. <1>$date</>";
|
||||
} elseif($dip['state'] > 1) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:선포,전쟁중인 상대국에만 가능합니다. 피장파장 실패. <1>$date</>";
|
||||
} elseif($nation['tricklimit'] > 0) {
|
||||
} elseif($nation['sabotagelimit'] > 0) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:전략기한이 남았습니다. 피장파장 실패. <1>$date</>";
|
||||
} elseif($term < $term2) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:피장파장 수행중... ({$term}/{$term2}) <1>$date</>";
|
||||
@@ -1829,13 +1905,13 @@ function process_75(&$general) {
|
||||
|
||||
// $alllog[] = "<C>●</>{$admin['month']}월:<Y>{$general['name']}</>(이)가 <D><b>{$destnation['name']}</b></>에 <M>피장파장</>(을)를 발동하였습니다.";
|
||||
// $history[] = "<C>●</>{$admin['year']}년 {$admin['month']}월:<L><b>【전략】</b></><D><b>{$nation['name']}</b></>(이)가 <D><b>{$destnation['name']}</b></>에 <M>피장파장</>(을)를 발동하였습니다.";
|
||||
$tricklog[] = "<C>●</>{$admin['year']}년 {$admin['month']}월:<L><b>【전략】</b></><D><b>{$nation['name']}</b></>(이)가 <D><b>{$destnation['name']}</b></>에 <M>피장파장</>(을)를 발동하였습니다.";
|
||||
$sabotagelog[] = "<C>●</>{$admin['year']}년 {$admin['month']}월:<L><b>【전략】</b></><D><b>{$nation['name']}</b></>(이)가 <D><b>{$destnation['name']}</b></>에 <M>피장파장</>(을)를 발동하였습니다.";
|
||||
pushGeneralHistory($general, "<C>●</>{$admin['year']}년 {$admin['month']}월:<D><b>{$destnation['name']}</b></>에 <M>피장파장</>(을)를 발동");
|
||||
pushNationHistory($nation, "<C>●</>{$admin['year']}년 {$admin['month']}월:<Y>{$general['name']}</>(이)가 <D><b>{$destnation['name']}</b></>에 <M>피장파장</>(을)를 발동");
|
||||
pushNationHistory($destnation, "<C>●</>{$admin['year']}년 {$admin['month']}월:<D><b>{$nation['name']}</b></>의 <Y>{$general['name']}</>(이)가 아국에 <M>피장파장</>(을)를 발동");
|
||||
|
||||
//전략기한+60
|
||||
$query = "update nation set tricklimit=tricklimit+60 where nation='{$destnation['nation']}'";
|
||||
$query = "update nation set sabotagelimit=sabotagelimit+60 where nation='{$destnation['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
|
||||
// 국가보정
|
||||
@@ -1844,7 +1920,7 @@ function process_75(&$general) {
|
||||
|
||||
//전략기한, 최소72
|
||||
if($term3 < 72) { $term3 = 72; }
|
||||
$query = "update nation set tricklimit={$term3} where nation='{$general['nation']}'";
|
||||
$query = "update nation set sabotagelimit={$term3} where nation='{$general['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
|
||||
//경험치, 공헌치
|
||||
@@ -1854,7 +1930,7 @@ function process_75(&$general) {
|
||||
|
||||
// pushWorldHistory($history, $admin['year'], $admin['month']);
|
||||
// pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']);
|
||||
pushTrickLog($tricklog);
|
||||
pushSabotageLog($sabotagelog);
|
||||
pushGenLog($general, $log);
|
||||
}
|
||||
|
||||
@@ -1865,7 +1941,7 @@ function process_76(&$general) {
|
||||
$log = [];
|
||||
$alllog = [];
|
||||
$history = [];
|
||||
$tricklog = [];
|
||||
$sabotagelog = [];
|
||||
|
||||
$date = substr($general['turntime'],11,5);
|
||||
|
||||
@@ -1877,7 +1953,7 @@ function process_76(&$general) {
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$city = MYDB_fetch_array($result);
|
||||
|
||||
$query = "select nation,name,type,tricklimit,l{$general['level']}term,l{$general['level']}turn0 from nation where nation='{$general['nation']}'";
|
||||
$query = "select nation,name,type,sabotagelimit,l{$general['level']}term,l{$general['level']}turn0 from nation where nation='{$general['nation']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$nation = MYDB_fetch_array($result);
|
||||
|
||||
@@ -1906,7 +1982,7 @@ function process_76(&$general) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:아국이 아닙니다. 의병모집 실패. <1>$date</>";
|
||||
} elseif($general['level'] < 5) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:수뇌부가 아닙니다. 의병모집 실패. <1>$date</>";
|
||||
} elseif($nation['tricklimit'] > 0) {
|
||||
} elseif($nation['sabotagelimit'] > 0) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:전략기한이 남았습니다. 의병모집 실패. <1>$date</>";
|
||||
} elseif($term < $term2) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:의병모집 수행중... ({$term}/{$term2}) <1>$date</>";
|
||||
@@ -1933,7 +2009,7 @@ function process_76(&$general) {
|
||||
|
||||
// $alllog[] = "<C>●</>{$admin['month']}월:<Y>{$general['name']}</>(이)가 <M>의병모집</>(을)를 발동하였습니다.";
|
||||
// $history[] = "<C>●</>{$admin['year']}년 {$admin['month']}월:<L><b>【전략】</b></><D><b>{$nation['name']}</b></>(이)가 <M>의병모집</>(을)를 발동하였습니다.";
|
||||
$tricklog[] = "<C>●</>{$admin['year']}년 {$admin['month']}월:<L><b>【전략】</b></><D><b>{$nation['name']}</b></>(이)가 <M>의병모집</>(을)를 발동하였습니다.";
|
||||
$sabotagelog[] = "<C>●</>{$admin['year']}년 {$admin['month']}월:<L><b>【전략】</b></><D><b>{$nation['name']}</b></>(이)가 <M>의병모집</>(을)를 발동하였습니다.";
|
||||
pushGeneralHistory($general, "<C>●</>{$admin['year']}년 {$admin['month']}월:<M>의병모집</>(을)를 발동");
|
||||
pushNationHistory($nation, "<C>●</>{$admin['year']}년 {$admin['month']}월:<Y>{$general['name']}</>(이)가 <M>의병모집</>(을)를 발동");
|
||||
|
||||
@@ -2063,7 +2139,7 @@ function process_76(&$general) {
|
||||
if($nation['type'] == 12) { $term3 = $term3 * 2; }
|
||||
|
||||
//전략기한, 국가 기술력 그대로
|
||||
$query = "update nation set tricklimit={$term3},totaltech=tech*'$gencount',gennum='$gennum' where nation='{$general['nation']}'";
|
||||
$query = "update nation set sabotagelimit={$term3},totaltech=tech*'$gencount',gennum='$gennum' where nation='{$general['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
|
||||
//경험치, 공헌치
|
||||
@@ -2073,7 +2149,7 @@ function process_76(&$general) {
|
||||
|
||||
// pushWorldHistory($history, $admin['year'], $admin['month']);
|
||||
// pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']);
|
||||
pushTrickLog($tricklog);
|
||||
pushSabotageLog($sabotagelog);
|
||||
pushGenLog($general, $log);
|
||||
}
|
||||
|
||||
@@ -2084,7 +2160,7 @@ function process_77(&$general) {
|
||||
$log = [];
|
||||
$alllog = [];
|
||||
$history = [];
|
||||
$tricklog = [];
|
||||
$sabotagelog = [];
|
||||
|
||||
$date = substr($general['turntime'],11,5);
|
||||
|
||||
@@ -2096,7 +2172,7 @@ function process_77(&$general) {
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$city = MYDB_fetch_array($result);
|
||||
|
||||
$query = "select nation,name,type,tricklimit,l{$general['level']}term,l{$general['level']}turn0 from nation where nation='{$general['nation']}'";
|
||||
$query = "select nation,name,type,sabotagelimit,l{$general['level']}term,l{$general['level']}turn0 from nation where nation='{$general['nation']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$nation = MYDB_fetch_array($result);
|
||||
|
||||
@@ -2136,7 +2212,7 @@ function process_77(&$general) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:수뇌부가 아닙니다. 이호경식 실패. <1>$date</>";
|
||||
} elseif($dip['state'] > 1) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:선포,전쟁중인 상대국에만 가능합니다. 이호경식 실패. <1>$date</>";
|
||||
} elseif($nation['tricklimit'] > 0) {
|
||||
} elseif($nation['sabotagelimit'] > 0) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:전략기한이 남았습니다. 이호경식 실패. <1>$date</>";
|
||||
} elseif($term < $term2) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:이호경식 수행중... ({$term}/{$term2}) <1>$date</>";
|
||||
@@ -2172,7 +2248,7 @@ function process_77(&$general) {
|
||||
|
||||
// $alllog[] = "<C>●</>{$admin['month']}월:<Y>{$general['name']}</>(이)가 <D><b>{$destnation['name']}</b></>에 <M>이호경식</>(을)를 발동하였습니다.";
|
||||
// $history[] = "<C>●</>{$admin['year']}년 {$admin['month']}월:<L><b>【전략】</b></><D><b>{$nation['name']}</b></>(이)가 <D><b>{$destnation['name']}</b></>에 <M>이호경식</>(을)를 발동하였습니다.";
|
||||
$tricklog[] = "<C>●</>{$admin['year']}년 {$admin['month']}월:<L><b>【전략】</b></><D><b>{$nation['name']}</b></>(이)가 <D><b>{$destnation['name']}</b></>에 <M>이호경식</>(을)를 발동하였습니다.";
|
||||
$sabotagelog[] = "<C>●</>{$admin['year']}년 {$admin['month']}월:<L><b>【전략】</b></><D><b>{$nation['name']}</b></>(이)가 <D><b>{$destnation['name']}</b></>에 <M>이호경식</>(을)를 발동하였습니다.";
|
||||
pushGeneralHistory($general, "<C>●</>{$admin['year']}년 {$admin['month']}월:<D><b>{$destnation['name']}</b></>에 <M>이호경식</>(을)를 발동");
|
||||
pushNationHistory($nation, "<C>●</>{$admin['year']}년 {$admin['month']}월:<Y>{$general['name']}</>(이)가 <D><b>{$destnation['name']}</b></>에 <M>이호경식</>(을)를 발동");
|
||||
pushNationHistory($destnation, "<C>●</>{$admin['year']}년 {$admin['month']}월:<D><b>{$nation['name']}</b></>의 <Y>{$general['name']}</>(이)가 아국에 <M>이호경식</>(을)를 발동");
|
||||
@@ -2191,7 +2267,7 @@ function process_77(&$general) {
|
||||
if($nation['type'] == 12) { $term3 = $term3 * 2; }
|
||||
|
||||
//전략기한
|
||||
$query = "update nation set tricklimit={$term3} where nation='{$general['nation']}'";
|
||||
$query = "update nation set sabotagelimit={$term3} where nation='{$general['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
|
||||
//경험치, 공헌치
|
||||
@@ -2201,7 +2277,7 @@ function process_77(&$general) {
|
||||
|
||||
// pushWorldHistory($history, $admin['year'], $admin['month']);
|
||||
// pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']);
|
||||
pushTrickLog($tricklog);
|
||||
pushSabotageLog($sabotagelog);
|
||||
pushGenLog($general, $log);
|
||||
}
|
||||
|
||||
@@ -2212,7 +2288,7 @@ function process_78(&$general) {
|
||||
$log = [];
|
||||
$alllog = [];
|
||||
$history = [];
|
||||
$tricklog = [];
|
||||
$sabotagelog = [];
|
||||
|
||||
$date = substr($general['turntime'],11,5);
|
||||
|
||||
@@ -2224,7 +2300,7 @@ function process_78(&$general) {
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$city = MYDB_fetch_array($result);
|
||||
|
||||
$query = "select nation,name,type,tricklimit,l{$general['level']}term,l{$general['level']}turn0 from nation where nation='{$general['nation']}'";
|
||||
$query = "select nation,name,type,sabotagelimit,l{$general['level']}term,l{$general['level']}turn0 from nation where nation='{$general['nation']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$nation = MYDB_fetch_array($result);
|
||||
|
||||
@@ -2266,7 +2342,7 @@ function process_78(&$general) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:선포중인 상대국에만 가능합니다. 급습 실패. <1>$date</>";
|
||||
} elseif($dip['term'] < 12) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:선포 12개월 이상인 상대국에만 가능합니다. 급습 실패. <1>$date</>";
|
||||
} elseif($nation['tricklimit'] > 0) {
|
||||
} elseif($nation['sabotagelimit'] > 0) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:전략기한이 남았습니다. 급습 실패. <1>$date</>";
|
||||
} elseif($term < $term2) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:급습 수행중... ({$term}/{$term2}) <1>$date</>";
|
||||
@@ -2302,7 +2378,7 @@ function process_78(&$general) {
|
||||
|
||||
// $alllog[] = "<C>●</>{$admin['month']}월:<Y>{$general['name']}</>(이)가 <D><b>{$destnation['name']}</b></>에 <M>급습</>(을)를 발동하였습니다.";
|
||||
// $history[] = "<C>●</>{$admin['year']}년 {$admin['month']}월:<L><b>【전략】</b></><D><b>{$nation['name']}</b></>(이)가 <D><b>{$destnation['name']}</b></>에 <M>급습</>(을)를 발동하였습니다.";
|
||||
$tricklog[] = "<C>●</>{$admin['year']}년 {$admin['month']}월:<L><b>【전략】</b></><D><b>{$nation['name']}</b></>(이)가 <D><b>{$destnation['name']}</b></>에 <M>급습</>(을)를 발동하였습니다.";
|
||||
$sabotagelog[] = "<C>●</>{$admin['year']}년 {$admin['month']}월:<L><b>【전략】</b></><D><b>{$nation['name']}</b></>(이)가 <D><b>{$destnation['name']}</b></>에 <M>급습</>(을)를 발동하였습니다.";
|
||||
pushGeneralHistory($general, "<C>●</>{$admin['year']}년 {$admin['month']}월:<D><b>{$destnation['name']}</b></>에 <M>급습</>(을)를 발동");
|
||||
pushNationHistory($nation, "<C>●</>{$admin['year']}년 {$admin['month']}월:<Y>{$general['name']}</>(이)가 <D><b>{$destnation['name']}</b></>에 <M>급습</>(을)를 발동");
|
||||
pushNationHistory($destnation, "<C>●</>{$admin['year']}년 {$admin['month']}월:<D><b>{$nation['name']}</b></>의 <Y>{$general['name']}</>(이)가 아국에 <M>급습</>(을)를 발동");
|
||||
@@ -2316,7 +2392,7 @@ function process_78(&$general) {
|
||||
if($nation['type'] == 12) { $term3 = $term3 * 2; }
|
||||
|
||||
//전략기한
|
||||
$query = "update nation set tricklimit={$term3} where nation='{$general['nation']}'";
|
||||
$query = "update nation set sabotagelimit={$term3} where nation='{$general['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
|
||||
//경험치, 공헌치
|
||||
@@ -2326,7 +2402,7 @@ function process_78(&$general) {
|
||||
|
||||
// pushWorldHistory($history, $admin['year'], $admin['month']);
|
||||
// pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']);
|
||||
pushTrickLog($tricklog);
|
||||
pushSabotageLog($sabotagelog);
|
||||
pushGenLog($general, $log);
|
||||
}
|
||||
|
||||
@@ -2348,7 +2424,7 @@ function process_81(&$general) {
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$city = MYDB_fetch_array($result);
|
||||
|
||||
$query = "select nation,can_change_flag,name,type,tricklimit,l{$general['level']}term,l{$general['level']}turn0 from nation where nation='{$general['nation']}'";
|
||||
$query = "select nation,can_change_flag,name,type,sabotagelimit,l{$general['level']}term,l{$general['level']}turn0 from nation where nation='{$general['nation']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$nation = MYDB_fetch_array($result);
|
||||
|
||||
|
||||
@@ -46,6 +46,9 @@ function process_22(&$general) {
|
||||
$exp = CharExperience($exp, $general['personal']);
|
||||
$ded = CharDedication($ded, $general['personal']);
|
||||
|
||||
$msg = ScoutMessage::buildScoutMessage($general['no'], $who, $reason);
|
||||
|
||||
/*
|
||||
sendScoutMsg([
|
||||
'id' => $general['no'],
|
||||
'nation_id' => Util::array_get($general['nation'], 0)
|
||||
@@ -53,7 +56,7 @@ function process_22(&$general) {
|
||||
'id' => $you['no'],
|
||||
'nation_id' => Util::array_get($you['nation'], 0)
|
||||
],$date);
|
||||
|
||||
*/
|
||||
$general['intel2']++;
|
||||
$query = "update general set resturn='SUCCESS',gold=gold-'$cost',intel2='{$general['intel2']}',dedication=dedication+'$ded',experience=experience+'$exp' where no='{$general['no']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
@@ -132,9 +135,15 @@ function process_25(&$general) {
|
||||
} elseif(strpos($general['nations'], ",{$nation['nation']},") > 0) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:이미 임관했었던 국가입니다. 임관 실패. <1>$date</>";
|
||||
} else {
|
||||
$alllog[] = "<C>●</>{$admin['month']}월:<Y>{$general['name']}</>(이)가 <D><b>{$nation['name']}</b></>에 <S>임관</>했습니다.";
|
||||
$log[] = "<C>●</>{$admin['month']}월:<D>{$nation['name']}</>에 임관했습니다. <1>$date</>";
|
||||
pushGeneralHistory($general, "<C>●</>{$admin['year']}년 {$admin['month']}월:<D><b>{$nation['name']}</b></>에 임관");
|
||||
if($where == 99 || $where == 98) {
|
||||
$alllog[] = "<C>●</>{$admin['month']}월:<Y>{$general['name']}</>(이)가 어쩌다보니 <D><b>{$nation['name']}</b></>에 <S>임관</>했습니다.";
|
||||
$log[] = "<C>●</>{$admin['month']}월:<D>{$nation['name']}</>에 랜덤으로 임관했습니다. <1>$date</>";
|
||||
pushGeneralHistory($general, "<C>●</>{$admin['year']}년 {$admin['month']}월:<D><b>{$nation['name']}</b></>에 임관");
|
||||
} else {
|
||||
$alllog[] = "<C>●</>{$admin['month']}월:<Y>{$general['name']}</>(이)가 <D><b>{$nation['name']}</b></>에 <S>임관</>했습니다.";
|
||||
$log[] = "<C>●</>{$admin['month']}월:<D>{$nation['name']}</>에 임관했습니다. <1>$date</>";
|
||||
pushGeneralHistory($general, "<C>●</>{$admin['year']}년 {$admin['month']}월:<D><b>{$nation['name']}</b></>에 임관");
|
||||
}
|
||||
|
||||
if($gencount < 10) { $exp = 700; }
|
||||
else { $exp = 100; }
|
||||
@@ -227,7 +236,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 +246,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;
|
||||
@@ -805,7 +814,7 @@ function process_55(&$general) {
|
||||
'rice'=>GameConst::$baserice,
|
||||
'rate'=>20,
|
||||
'bill'=>100,
|
||||
'tricklimit'=>36,
|
||||
'sabotagelimit'=>36,
|
||||
'surlimit'=>72,
|
||||
'type'=>0,
|
||||
'gennum'=>1
|
||||
|
||||
@@ -9,7 +9,7 @@ function process_32(&$general) {
|
||||
$log = [];
|
||||
$alllog = [];
|
||||
$history = [];
|
||||
global $_firing, $_basefiring, $_firingbase, $_firingpower;
|
||||
|
||||
$date = substr($general['turntime'],11,5);
|
||||
|
||||
$query = "select year,month,develcost from game limit 1";
|
||||
@@ -57,7 +57,7 @@ function process_32(&$general) {
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$intelgen = MYDB_fetch_array($result);
|
||||
|
||||
$ratio = Util::round(((getGeneralIntel($general, true, true, true, false) - getGeneralIntel($intelgen, true, true, true, false)) / $_firing - ($destcity['secu']/$destcity['secu2'])/5 + $_basefiring)*100);
|
||||
$ratio = Util::round(((getGeneralIntel($general, true, true, true, false) - getGeneralIntel($intelgen, true, true, true, false)) / GameConst::$sabotageProbCoefByStat - ($destcity['secu']/$destcity['secu2'])/5 + GameConst::$sabotageDefaultProb)*100);
|
||||
$ratio2 = rand() % 100;
|
||||
|
||||
if($general['item'] == 5) {
|
||||
@@ -93,8 +93,8 @@ function process_32(&$general) {
|
||||
$alllog[] = "<C>●</>{$admin['month']}월:<G><b>{$destcity['name']}</b></>(이)가 불타고 있습니다.";
|
||||
$log[] = "<C>●</>{$admin['month']}월:<G><b>{$destcity['name']}</b></>에 화계가 성공했습니다. <1>$date</>";
|
||||
|
||||
$destcity['agri'] -= rand() % $_firingpower + $_firingbase;
|
||||
$destcity['comm'] -= rand() % $_firingpower + $_firingbase;
|
||||
$destcity['agri'] -= rand() % GameConst::$sabotageAmountCoef + GameConst::$sabotageDefaultAmount;
|
||||
$destcity['comm'] -= rand() % GameConst::$sabotageAmountCoef + GameConst::$sabotageDefaultAmount;
|
||||
if($destcity['agri'] < 0) { $destcity['agri'] = 0; }
|
||||
if($destcity['comm'] < 0) { $destcity['comm'] = 0; }
|
||||
$query = "update city set state=32,agri='{$destcity['agri']}',comm='{$destcity['comm']}' where city='$destination'";
|
||||
@@ -102,7 +102,7 @@ function process_32(&$general) {
|
||||
$query = "update general set firenum=firenum+1 where no='{$general['no']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
|
||||
TrickInjury($destination);
|
||||
SabotageInjury($destination);
|
||||
$exp = rand() % 100 + 201;
|
||||
$ded = rand() % 70 + 141;
|
||||
} else {
|
||||
@@ -134,7 +134,7 @@ function process_33(&$general) {
|
||||
$log = [];
|
||||
$alllog = [];
|
||||
$history = [];
|
||||
global $_firing, $_basefiring, $_firingbase, $_firingpower;
|
||||
|
||||
//탈취는 0까지 무제한
|
||||
$date = substr($general['turntime'],11,5);
|
||||
|
||||
@@ -187,7 +187,7 @@ function process_33(&$general) {
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$powergen = MYDB_fetch_array($result);
|
||||
|
||||
$ratio = Util::round(((getGeneralPower($general, true, true, true, false) - getGeneralPower($powergen, true, true, true, false)) / $_firing - ($destcity['secu']/$destcity['secu2'])/5 + $_basefiring)*100);
|
||||
$ratio = Util::round(((getGeneralPower($general, true, true, true, false) - getGeneralPower($powergen, true, true, true, false)) / GameConst::$sabotageProbCoefByStat - ($destcity['secu']/$destcity['secu2'])/5 + GameConst::$sabotageDefaultProb)*100);
|
||||
$ratio2 = rand() % 100;
|
||||
|
||||
if($general['item'] == 5) {
|
||||
@@ -224,8 +224,8 @@ function process_33(&$general) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:<G><b>{$destcity['name']}</b></>에 탈취가 성공했습니다. <1>$date</>";
|
||||
|
||||
// 탈취 최대 400 * 8
|
||||
$gold = (rand() % $_firingpower + $_firingbase) * $destcity['level'];
|
||||
$rice = (rand() % $_firingpower + $_firingbase) * $destcity['level'];
|
||||
$gold = (rand() % GameConst::$sabotageAmountCoef + GameConst::$sabotageDefaultAmount) * $destcity['level'];
|
||||
$rice = (rand() % GameConst::$sabotageAmountCoef + GameConst::$sabotageDefaultAmount) * $destcity['level'];
|
||||
|
||||
$nation['gold'] -= $gold;
|
||||
$nation['rice'] -= $rice;
|
||||
@@ -254,7 +254,7 @@ function process_33(&$general) {
|
||||
}
|
||||
$log[] = "<C>●</>금<C>$gold</> 쌀<C>$rice</>을 획득했습니다.";
|
||||
|
||||
// TrickInjury($destination);
|
||||
// SabotageInjury($destination);
|
||||
$exp = rand() % 100 + 201;
|
||||
$ded = rand() % 70 + 141;
|
||||
} else {
|
||||
@@ -286,7 +286,7 @@ function process_34(&$general) {
|
||||
$log = [];
|
||||
$alllog = [];
|
||||
$history = [];
|
||||
global $_firing, $_basefiring, $_firingbase, $_firingpower;
|
||||
|
||||
$date = substr($general['turntime'],11,5);
|
||||
|
||||
$query = "select year,month,develcost from game limit 1";
|
||||
@@ -334,7 +334,7 @@ function process_34(&$general) {
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$powergen = MYDB_fetch_array($result);
|
||||
|
||||
$ratio = Util::round(((getGeneralPower($general, true, true, true, false) - getGeneralPower($powergen, true, true, true, false)) / $_firing - ($destcity['secu']/$destcity['secu2'])/5 + $_basefiring)*100);
|
||||
$ratio = Util::round(((getGeneralPower($general, true, true, true, false) - getGeneralPower($powergen, true, true, true, false)) / GameConst::$sabotageProbCoefByStat - ($destcity['secu']/$destcity['secu2'])/5 + GameConst::$sabotageDefaultProb)*100);
|
||||
$ratio2 = rand() % 100;
|
||||
|
||||
if($general['item'] == 5) {
|
||||
@@ -371,8 +371,8 @@ function process_34(&$general) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:<G><b>{$destcity['name']}</b></>에 파괴가 성공했습니다. <1>$date</>";
|
||||
|
||||
// 파괴
|
||||
$destcity['def'] -= rand() % $_firingpower + $_firingbase;
|
||||
$destcity['wall'] -= rand() % $_firingpower + $_firingbase;
|
||||
$destcity['def'] -= rand() % GameConst::$sabotageAmountCoef + GameConst::$sabotageDefaultAmount;
|
||||
$destcity['wall'] -= rand() % GameConst::$sabotageAmountCoef + GameConst::$sabotageDefaultAmount;
|
||||
if($destcity['def'] < 100) { $destcity['def'] = 100; }
|
||||
if($destcity['wall'] < 100) { $destcity['wall'] = 100; }
|
||||
$query = "update city set state=34,def='{$destcity['def']}',wall='{$destcity['wall']}' where city='$destination'";
|
||||
@@ -380,7 +380,7 @@ function process_34(&$general) {
|
||||
$query = "update general set firenum=firenum+1 where no='{$general['no']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
|
||||
TrickInjury($destination);
|
||||
SabotageInjury($destination);
|
||||
$exp = rand() % 100 + 201;
|
||||
$ded = rand() % 70 + 141;
|
||||
} else {
|
||||
@@ -412,7 +412,7 @@ function process_35(&$general) {
|
||||
$log = [];
|
||||
$alllog = [];
|
||||
$history = [];
|
||||
global $_firing, $_basefiring, $_firingbase, $_firingpower;
|
||||
|
||||
$date = substr($general['turntime'],11,5);
|
||||
|
||||
$query = "select year,month,develcost from game limit 1";
|
||||
@@ -458,11 +458,11 @@ function process_35(&$general) {
|
||||
} elseif($dip['state'] >= 7) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:불가침국입니다. <G><b>{$destcity['name']}</b></>에 선동 실패. <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);
|
||||
|
||||
$ratio = Util::round(((getGeneralLeadership($general, true, true, true) - getGeneralLeadership($gen, true, true, true)) / $_firing - ($destcity['secu']/$destcity['secu2'])/5 + $_basefiring)*100);
|
||||
$ratio = Util::round(((getGeneralLeadership($general, true, true, true) - getGeneralLeadership($gen, true, true, true)) / GameConst::$sabotageProbCoefByStat - ($destcity['secu']/$destcity['secu2'])/5 + GameConst::$sabotageDefaultProb)*100);
|
||||
$ratio2 = rand() % 100;
|
||||
|
||||
if($general['item'] == 5) {
|
||||
@@ -499,8 +499,8 @@ function process_35(&$general) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:<G><b>{$destcity['name']}</b></>에 선동이 성공했습니다. <1>$date</>";
|
||||
|
||||
// 선동 최대 10
|
||||
$destcity['secu'] -= rand() % Util::round($_firingpower/2) + $_firingbase;
|
||||
$destcity['rate'] -= rand() % Util::round($_firingpower/50) + $_firingbase/50;
|
||||
$destcity['secu'] -= rand() % Util::round(GameConst::$sabotageAmountCoef/2) + GameConst::$sabotageDefaultAmount;
|
||||
$destcity['rate'] -= rand() % Util::round(GameConst::$sabotageAmountCoef/50) + GameConst::$sabotageDefaultAmount/50;
|
||||
if($destcity['secu'] < 0) { $destcity['secu'] = 0; }
|
||||
if($destcity['rate'] < 0) { $destcity['rate'] = 0; }
|
||||
$query = "update city set state=32,rate='{$destcity['rate']}',secu='{$destcity['secu']}' where city='$destination'";
|
||||
@@ -508,7 +508,7 @@ function process_35(&$general) {
|
||||
$query = "update general set firenum=firenum+1 where no='{$general['no']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
|
||||
TrickInjury($destination);
|
||||
SabotageInjury($destination);
|
||||
$exp = rand() % 100 + 201;
|
||||
$ded = rand() % 70 + 141;
|
||||
} else {
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -713,7 +713,7 @@ function disaster() {
|
||||
$query = "update city set state='$state',pop=pop*{$ratio},rate=rate*{$ratio},agri=agri*{$ratio},comm=comm*{$ratio},secu=secu*{$ratio},def=def*{$ratio},wall=wall*{$ratio} where city='$disastercity[$i]'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
|
||||
TrickInjury($disastercity[$i], 1);
|
||||
SabotageInjury($disastercity[$i], 1);
|
||||
}
|
||||
} else {
|
||||
for($i=0; $i < count($disastercity); $i++) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
+26
-44
@@ -68,6 +68,7 @@ $scenario = $admin['scenario_text'];
|
||||
<script src="js/main.js"></script>
|
||||
<script src="js/base_map.js"></script>
|
||||
<script src="js/map.js"></script>
|
||||
<script src="js/msg.js"></script>
|
||||
<script>
|
||||
$(function(){
|
||||
reloadWorldMap({
|
||||
@@ -80,14 +81,15 @@ $(function(){
|
||||
<link href="css/common.css" rel="stylesheet">
|
||||
<link href="css/main.css" rel="stylesheet">
|
||||
<link href="css/map.css" rel="stylesheet">
|
||||
<link href="css/msg.css" rel="stylesheet">
|
||||
|
||||
|
||||
</head>
|
||||
<body class="img_back">
|
||||
|
||||
<div id="container">
|
||||
<div><?=allButton()?></div>
|
||||
<table align=center width=1000 border=1 cellspacing=0 cellpadding=0 style=font-size:13px;word-break:break-all; id=bg0>
|
||||
<tr><td colspan=5><?=allButton()?></td></tr>
|
||||
<tr height=50>
|
||||
<td colspan=5 align=center><font size=4>삼국지 모의전투 HiDCHe (<font color=cyan><?=$scenario?></font>)</font></td>
|
||||
</tr>
|
||||
@@ -241,13 +243,13 @@ if ($session->userGrade >= 5) {
|
||||
<option value=10>10턴</option>
|
||||
<option value=11>11턴</option>
|
||||
<option value=12>12턴</option>
|
||||
</select><input type=button style=background-color:<?=GameConst::$basecolor2?>;color:white;width:50;font-size:13px; value='반복' onclick='refreshing(this, 2,0)'><input type=button style=background-color:<?=GameConst::$basecolor2?>;color:white;width:80;font-size:13px; value='▼미루기' onclick='refreshing(this, 2,1)'><input type=button style=background-color:<?=GameConst::$basecolor2?>;color:white;width:80;font-size:13px; value='▲당기기' onclick='refreshing(this, 2,2)'>
|
||||
</select><input type=button style=background-color:<?=GameConst::$basecolor2?>;color:white;width:50px;font-size:13px; value='반복' onclick='refreshing(this, 2,0)'><input type=button style=background-color:<?=GameConst::$basecolor2?>;color:white;width:80px;font-size:13px; value='▼미루기' onclick='refreshing(this, 2,1)'><input type=button style=background-color:<?=GameConst::$basecolor2?>;color:white;width:80px;font-size:13px; value='▲당기기' onclick='refreshing(this, 2,2)'>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width=646 align=right>
|
||||
<?php commandTable(); ?>
|
||||
<input id="mainBtnSubmit" type=button style=background-color:<?=GameConst::$basecolor2?>;color:white;width:110;font-size:13px; value='실 행' onclick='refreshing(this, 3,form2)'><input type=button style=background-color:<?=GameConst::$basecolor2?>;color:white;width:110;font-size:13px; value='갱 신' onclick='refreshing(this, 0,0)'><input type=button style=background-color:<?=GameConst::$basecolor2?>;color:white;width:160;font-size:13px; value='로그아웃' onclick=location.replace('logout_process.php')><br>
|
||||
<input id="mainBtnSubmit" type=button style=background-color:<?=GameConst::$basecolor2?>;color:white;width:110px;font-size:13px; value='실 행' onclick='refreshing(this, 3,form2)'><input type=button style=background-color:<?=GameConst::$basecolor2?>;color:white;width:110px;font-size:13px; value='갱 신' onclick='refreshing(this, 0,0)'><input type=button style=background-color:<?=GameConst::$basecolor2?>;color:white;width:160px;font-size:13px; value='로그아웃' onclick=location.replace('logout_process.php')><br>
|
||||
</td>
|
||||
</tr>
|
||||
</form>
|
||||
@@ -271,52 +273,32 @@ if ($session->userGrade >= 5) {
|
||||
<tr><td width=998 colspan=2 align=center id=bg1><b>중원 정세</b></td></tr>
|
||||
<tr><td width=998 colspan=2><?=getWorldHistoryRecent(15)?></td></tr>
|
||||
</table>
|
||||
<table align=center width=1000 border=1 cellspacing=0 cellpadding=0 style=font-size:13px;word-break:break-all; id=bg0>
|
||||
<tr>
|
||||
<td colspan=2>
|
||||
<div class="message_input_form bg0">
|
||||
<select id="mailbox_list" size="1">
|
||||
<div class="message_input_form bg0">
|
||||
<select id="mailbox_list" size="1">
|
||||
|
||||
<select name="genlist" size="1" style="color:white;background-color:black;font-size:13">
|
||||
</select>
|
||||
<input type="textarea" id="msg_input" maxlength="99">
|
||||
<button id="msg_submit">서신전달&갱신</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr><td colspan=2><?=allButton()?></td></tr>
|
||||
<tr><td colspan=2>
|
||||
<div id="message_board">
|
||||
<div class="board_side">
|
||||
<div class="board_header bg0">전체 메시지(최고99자)</div>
|
||||
<section class="public_message">
|
||||
<select name="genlist" size="1" style="color:white;background-color:black;font-size:13">
|
||||
|
||||
</section>
|
||||
<div class="board_header bg0">개인 메시지(최고99자)</div>
|
||||
<section class="private_message">
|
||||
|
||||
</section>
|
||||
</div>
|
||||
<div class="board_side">
|
||||
<section class="diplomacy_message">
|
||||
|
||||
</section>
|
||||
<div class="board_header bg0">국가 메시지(최고99자)</div>
|
||||
<section class="national_message">
|
||||
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
</td></tr>
|
||||
<tr><td colspan=2>
|
||||
</select>
|
||||
<input type="textarea" id="msg_input" maxlength="99">
|
||||
<button id="msg_submit">서신전달&갱신</button><br>
|
||||
내용 없이 '서신전달&갱신'을 누르면 메세지창이 갱신됩니다.
|
||||
</div>
|
||||
<div><?=allButton()?></div>
|
||||
<div id="message_board"><div class="board_side bg0">
|
||||
<div class="board_header bg0">전체 메시지(최고99자)</div>
|
||||
<section class="public_message"></section>
|
||||
<div class="board_header bg0">개인 메시지(최고99자)</div>
|
||||
<section class="private_message"></section>
|
||||
</div><div class="board_side bg0">
|
||||
<section class="diplomacy_message">
|
||||
|
||||
<?php
|
||||
echo allButton();
|
||||
echo banner();
|
||||
?>
|
||||
|
||||
</td></tr>
|
||||
</table>
|
||||
</section>
|
||||
<div class="board_header bg0">국가 메시지(최고99자)</div>
|
||||
<section class="national_message"></section>
|
||||
</div></div>
|
||||
<div style="clear:left;"><?=allButton()?><?=banner()?></div>
|
||||
<?php PrintElapsedTime(); ?>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
@@ -9,7 +9,7 @@ $userID = Session::getUserID();
|
||||
$rootDB = RootDB::db();
|
||||
$db = DB::db();
|
||||
|
||||
$image = $rootDB->queryFirstRow('SELECT picture, imgsvr FROM `MEMBER` WHERE no = %i', $userID);
|
||||
$image = $rootDB->queryFirstRow('SELECT picture, imgsvr FROM `member` WHERE no = %i', $userID);
|
||||
|
||||
if(!$image){
|
||||
Json::die([
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
<?php
|
||||
namespace sammo;
|
||||
|
||||
include('lib.php');
|
||||
include('func.php');
|
||||
|
||||
$session = Session::requireGameLogin([])->setReadOnly();
|
||||
|
||||
$generalID = $session->generalID;
|
||||
|
||||
$jsonPost = WebUtil::parseJsonPost();
|
||||
|
||||
$reqSequence = Util::toInt(Util::array_get($jsonPost['sequence'], 0));
|
||||
|
||||
|
||||
$nationID = DB::db()->queryFirstField(
|
||||
'select `nation` from `general` where no = %i',
|
||||
$generalID
|
||||
);
|
||||
|
||||
|
||||
if($nationID === null){
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>'소속 국가가 없습니다'
|
||||
]);
|
||||
}
|
||||
|
||||
Json::die([
|
||||
'result'=>true,
|
||||
'private'=>getMessage('private', $nationID, 10, $reqSequence),
|
||||
'public'=>getMessage('public', $nationID, 20, $reqSequence),
|
||||
'national'=>getMessage('national', $nationID, 30, $reqSequence),
|
||||
'diplomacy'=>getMessage('diplomacy', $nationID, 10, $reqSequence)
|
||||
]);
|
||||
+1
-1
@@ -98,7 +98,7 @@ $mysqli_obj = $db->get();
|
||||
|
||||
|
||||
$scenarioObj = new Scenario($scenario, false);
|
||||
$startyear = $scenarioObj->getYear();
|
||||
$startyear = $scenarioObj->getYear()??GameConst::$defaultStartYear;
|
||||
|
||||
FileUtil::delInDir("logs");
|
||||
FileUtil::delInDir("data");
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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)) {
|
||||
|
||||
+11
-78
@@ -17,12 +17,10 @@ if (!$generalID) {
|
||||
]);
|
||||
}
|
||||
|
||||
session_write_close(); // 이제 세션 안 쓴다
|
||||
|
||||
$jsonPost = WebUtil::parseJsonPost();
|
||||
|
||||
$msgID = Util::toInt(Util::array_get($jsonPost['msgID'], null), false);
|
||||
$msgResponse = Util::array_get($jsonPost['response'], null);
|
||||
$msgID = Util::toInt($jsonPost['msgID']??null);
|
||||
$msgResponse = $jsonPost['response']??null;
|
||||
|
||||
if ($msgID === null || !is_bool($msgResponse)) {
|
||||
Json::die([
|
||||
@@ -31,7 +29,6 @@ if ($msgID === null || !is_bool($msgResponse)) {
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
$general = DB::db()->queryFirstRow('select `no`, `name`, `nation`, `nations`, `level`, `npc`, `gold`, `rice`, `troop` from `general` where `no` = %i', $generalID);
|
||||
if(!$general){
|
||||
Json::die([
|
||||
@@ -40,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'
|
||||
]);
|
||||
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
namespace sammo;
|
||||
|
||||
include('lib.php');
|
||||
include('func.php');
|
||||
|
||||
$session = Session::requireGameLogin([])->setReadOnly();
|
||||
$userID = Session::getUserID();
|
||||
|
||||
$jsonPost = WebUtil::parseJsonPost();
|
||||
$reqSequence = (int)Util::array_get($jsonPost['sequence'], 0);
|
||||
|
||||
|
||||
list($generalID, $nationID) = DB::db()->queryFirstList(
|
||||
'select `no`, `nation` from `general` where owner = %i',
|
||||
$userID
|
||||
);
|
||||
|
||||
|
||||
if($nationID === null){
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>'장수가 사망했습니다.'
|
||||
]);
|
||||
}
|
||||
|
||||
$result = [];
|
||||
$result['result'] = true;
|
||||
|
||||
$nextSequence = $reqSequence;
|
||||
|
||||
$result['private'] = array_map(function(Message $msg) use (&$nextSequence){
|
||||
if($msg->id > $nextSequence){
|
||||
$nextSequence = $msg->id;
|
||||
}
|
||||
return $msg->toArray();
|
||||
}, Message::getMessagesFromMailBox($generalID, Message::MSGTYPE_PRIVATE, 10, $reqSequence));
|
||||
|
||||
$result['public'] = array_map(function(Message $msg)use (&$nextSequence){
|
||||
if($msg->id > $nextSequence){
|
||||
$nextSequence = $msg->id;
|
||||
}
|
||||
return $msg->toArray();
|
||||
}, Message::getMessagesFromMailBox(Message::MAILBOX_PUBLIC, Message::MSGTYPE_PUBLIC, 10, $reqSequence));
|
||||
|
||||
$result['national'] = array_map(function(Message $msg)use (&$nextSequence){
|
||||
if($msg->id > $nextSequence){
|
||||
$nextSequence = $msg->id;
|
||||
}
|
||||
return $msg->toArray();
|
||||
}, Message::getMessagesFromMailBox(Message::MAILBOX_NATIONAL + $nationID, Message::MSGTYPE_NATIONAL, 20, $reqSequence));
|
||||
|
||||
$result['diplomacy']= array_map(function(Message $msg)use (&$nextSequence){
|
||||
if($msg->id > $nextSequence){
|
||||
$nextSequence = $msg->id;
|
||||
}
|
||||
return $msg->toArray();
|
||||
}, Message::getMessagesFromMailBox(Message::MAILBOX_NATIONAL + $nationID, Message::MSGTYPE_DIPLOMACY, 10, 0));
|
||||
|
||||
$result['sequence'] = $nextSequence;
|
||||
|
||||
Json::die($result);
|
||||
@@ -0,0 +1,188 @@
|
||||
<?php
|
||||
namespace sammo;
|
||||
|
||||
include 'lib.php';
|
||||
include 'func.php';
|
||||
|
||||
$post = WebUtil::parseJsonPost();
|
||||
'@phan-var mixed[] $post';
|
||||
|
||||
$v = new Validator($post);
|
||||
$v->rule('required', ['mailbox','text']);
|
||||
$v->rule('integer', 'mailbox');
|
||||
$v->rule('lengthMin', 'text', 1);
|
||||
|
||||
if(!$v->validate()){
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>$v->errorStr(),
|
||||
'msgID'=>null
|
||||
]);
|
||||
}
|
||||
|
||||
$mailbox = (int)$post['mailbox'];
|
||||
$text = StringUtil::cutStringForWidth($post['text'], 199, '');
|
||||
|
||||
$session = Session::requireGameLogin([
|
||||
'msgID'=>null
|
||||
]);
|
||||
$userID = Session::getUserID();
|
||||
//NOTE: 전송 메시지 시간 계산을 위해 Session을 쓰기 가능 상태로 열어둠.
|
||||
|
||||
increaseRefresh('서신전달', 1);
|
||||
|
||||
if(getBlockLevel() == 1 || getBlockLevel() == 3) {
|
||||
Json::die([
|
||||
'result' => false,
|
||||
'reason' => '차단되었습니다.',
|
||||
'msgID'=>null
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 메시지 전송 코드.
|
||||
*
|
||||
* TODO: 장기적으로 ajax는 한곳에 모을 필요가 있을 듯.
|
||||
*/
|
||||
|
||||
$now = new \DateTime();
|
||||
$unlimited = new \DateTime('9999-12-31');
|
||||
|
||||
$db = DB::db();
|
||||
$me = $db->queryFirstRow('SELECT `no`,`name`,`nation`,`level`,`con`,`picture`,`imgsvr` FROM general WHERE `owner`=%i', $userID);
|
||||
|
||||
if(!$me){
|
||||
$session->logoutGame();
|
||||
Json::die([
|
||||
'result' => false,
|
||||
'reason' => '로그인되지 않았습니다.',
|
||||
'msgID' => null
|
||||
]);
|
||||
}
|
||||
|
||||
$con = checkLimit($me['con']);
|
||||
if($con >= 2) {
|
||||
Json::die([
|
||||
'result' => false,
|
||||
'reason' => '접속 제한입니다.',
|
||||
'msgID' => null
|
||||
]);
|
||||
}
|
||||
|
||||
$me['icon'] = GetImageURL($me['imgsvr'], $me['picture']);
|
||||
|
||||
$srcNation = getNationStaticInfo($me['nation']);
|
||||
|
||||
$src = new MessageTarget($me['no'], $me['name'], $srcNation['nation'], $srcNation['name'], $srcNation['color'], $me['icon']);
|
||||
|
||||
// 전체 메세지
|
||||
if($mailbox == Message::MAILBOX_PUBLIC) {
|
||||
$msg = new Message(
|
||||
Message::MSGTYPE_PUBLIC,
|
||||
$src,
|
||||
$src,
|
||||
$text,
|
||||
$now,
|
||||
$unlimited,
|
||||
[]
|
||||
);
|
||||
$msgID = $msg->send();
|
||||
Json::die([
|
||||
'result' => true,
|
||||
'reason' => 'SUCCESS',
|
||||
'msgID' => $msgID
|
||||
]);
|
||||
|
||||
|
||||
}
|
||||
|
||||
// 국가 메세지
|
||||
if($mailbox >= Message::MAILBOX_NATIONAL) {
|
||||
|
||||
if($me['level'] < 5){
|
||||
$destNationID = $me['nation'];
|
||||
}
|
||||
else{
|
||||
$destNationID = $mailbox - Message::MAILBOX_NATIONAL;
|
||||
}
|
||||
|
||||
$destNation = getNationStaticInfo($destNationID);
|
||||
|
||||
$dest = new MessageTarget(0, '', $destNation['nation'], $destNation['name'], $destNation['color']);
|
||||
|
||||
$msg = new Message(
|
||||
Message::MSGTYPE_NATIONAL,
|
||||
$src,
|
||||
$dest,
|
||||
$text,
|
||||
$now,
|
||||
$unlimited,
|
||||
[]
|
||||
);
|
||||
$msgID = $msg->send();
|
||||
Json::die([
|
||||
'result' => true,
|
||||
'reason' => 'SUCCESS',
|
||||
'msgID' => $msgID
|
||||
]);
|
||||
}
|
||||
|
||||
// 개인 메세지
|
||||
if($mailbox > 0) {
|
||||
$lastMsg = new \DateTime($session->lastMsg??'0000-00-00');
|
||||
|
||||
$msg_interval = $now->getTimestamp() - $lastMsg->getTimestamp();
|
||||
//NOTE: 여기서 유저 레벨을 구별할 코드가 필요할까?
|
||||
if($msg_interval < 2){
|
||||
Json::die([
|
||||
'result' => false,
|
||||
'reason' => '개인메세지는 2초당 1건만 보낼 수 있습니다!',
|
||||
'msgID' => null
|
||||
]);
|
||||
}
|
||||
|
||||
$session->lastMsg = $now->format('Y-m-d H:i:s');
|
||||
|
||||
$destUser = $db->queryFirstRow('SELECT `no`,`name`,`nation`,`con`,`picture`,`imgsvr` FROM general WHERE `no`=%i',$mailbox);
|
||||
|
||||
if(!$destUser){
|
||||
Json::die([
|
||||
'result' => false,
|
||||
'reason' => '존재하지 않는 유저입니다.',
|
||||
'msgID' => null
|
||||
]);
|
||||
}
|
||||
|
||||
$destNation = getNationStaticInfo($destUser['nation']);
|
||||
|
||||
$dest = new MessageTarget(
|
||||
$destUser['no'],
|
||||
$destUser['name'],
|
||||
$destNation['nation'],
|
||||
$destNation['name'],
|
||||
$destNation['color'],
|
||||
GetImageURL($destUser['imgsvr'], $destUser['picture'])
|
||||
);
|
||||
|
||||
$msg = new Message(
|
||||
Message::MSGTYPE_PRIVATE,
|
||||
$src,
|
||||
$dest,
|
||||
$text,
|
||||
$now,
|
||||
$unlimited,
|
||||
[]
|
||||
);
|
||||
$msgID = $msg->send();
|
||||
Json::die([
|
||||
'result' => true,
|
||||
'reason' => 'SUCCESS',
|
||||
'msgID' => $msgID
|
||||
]);
|
||||
}
|
||||
|
||||
Json::die([
|
||||
'result' => false,
|
||||
'reason' => '알 수 없는 에러',
|
||||
'msgID' => null
|
||||
]);
|
||||
@@ -1,159 +0,0 @@
|
||||
<?php
|
||||
namespace sammo;
|
||||
|
||||
include 'lib.php';
|
||||
include 'func.php';
|
||||
|
||||
|
||||
$session = Session::requireGameLogin([
|
||||
'newSeq' => false
|
||||
]);
|
||||
$userID = Session::getUserID();
|
||||
//NOTE: 전송 메시지 시간 계산을 위해 Session을 쓰기 가능 상태로 열어둠.
|
||||
|
||||
/**
|
||||
* 메시지 전송 코드.
|
||||
*
|
||||
* TODO: 장기적으로 ajax는 한곳에 모을 필요가 있을 듯.
|
||||
*/
|
||||
|
||||
$post = WebUtil::parseJsonPost();
|
||||
|
||||
if(!isset($post['genlist']) || !isset($post['msg'])){
|
||||
Json::die([
|
||||
'result' => false,
|
||||
'reason' => '올바르지 않은 호출입니다.',
|
||||
'newSeq' => false
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
'@phan-var mixed[] $post';
|
||||
|
||||
$destMailbox = $post['dest_mailbox'];
|
||||
$msg = $post['msg'];
|
||||
$datetime = new \DateTime();
|
||||
$date = $datetime->format('Y-m-d H:i:s');
|
||||
|
||||
$db = DB::db();
|
||||
$connect=$db->get();
|
||||
|
||||
increaseRefresh('서신전달', 1);
|
||||
|
||||
if(getBlockLevel() == 1 || getBlockLevel() == 3) {
|
||||
Json::die([
|
||||
'result' => false,
|
||||
'reason' => '차단되었습니다.',
|
||||
'newSeq' => false
|
||||
]);
|
||||
}
|
||||
|
||||
$conlimit = $db->queryFirstField('select conlimit from game limit 1');
|
||||
|
||||
$me = $db->queryFirstRow('select `no`,`name`,`nation`,`level`,`con`,`picture`,`imgsvr` from `general` where `owner` = %i', $userID);
|
||||
|
||||
if(!$me){
|
||||
$session->logoutGame();
|
||||
Json::die([
|
||||
'result' => false,
|
||||
'reason' => '로그인되지 않았습니다.',
|
||||
'newSeq' => false
|
||||
]);
|
||||
}
|
||||
|
||||
$con = checkLimit($me['con'], $conlimit);
|
||||
if($con >= 2) {
|
||||
Json::die([
|
||||
'result' => false,
|
||||
'reason' => '접속 제한입니다.',
|
||||
'newSeq' => false
|
||||
]);
|
||||
}
|
||||
|
||||
$msg = StringUtil::cutStringForWidth($msg, 100, '');
|
||||
|
||||
if($msg == ''){
|
||||
Json::die([
|
||||
'result' => true,
|
||||
'reason' => 'SUCCESS',
|
||||
'newSeq' => false
|
||||
]);
|
||||
}
|
||||
|
||||
$src = [
|
||||
'id' => $me['no'],
|
||||
'name' => $me['name'],
|
||||
'icon' => $me['picture'],
|
||||
'nation_id' => $me['nation'],
|
||||
];
|
||||
|
||||
// 전체 메세지
|
||||
if($destMailbox == 9999) {
|
||||
sendMessage('public', $src, [], $msg, $date);
|
||||
// 국가 메세지
|
||||
} elseif($destMailbox >= 9000) {
|
||||
|
||||
if($me['level'] < 5){
|
||||
$real_nation = $me['nation_id'];
|
||||
}
|
||||
else{
|
||||
$real_nation = $destMailbox - 9000;
|
||||
}
|
||||
|
||||
if(!getNationStaticInfo($real_nation)){
|
||||
$real_nation = $me['nation_id'];
|
||||
}
|
||||
|
||||
$dest = [
|
||||
'nation_id' => $real_nation
|
||||
];
|
||||
|
||||
sendMessage('national', $src, $dest, $msg, $date);
|
||||
|
||||
// 개인 메세지
|
||||
} elseif($destMailbox > 0) {
|
||||
$last_msg = new \DateTime($session->last_msg?:'0000-00-00');
|
||||
|
||||
$msg_interval = $datetime->getTimestamp() - $last_msg->getTimestamp();
|
||||
//NOTE: 여기서 유저 레벨을 구별할 코드가 필요할까?
|
||||
if($msg_interval < 2){
|
||||
Json::die([
|
||||
'result' => false,
|
||||
'reason' => '개인메세지는 2초당 1건만 보낼 수 있습니다!',
|
||||
'newSeq' => false
|
||||
]);
|
||||
}
|
||||
|
||||
$destUser = $db->queryFirstRow('select `no`,`name`,`nation` from `general` where `no` = %s',$destMailbox);
|
||||
|
||||
if($destUser == null || empty($destUser)){
|
||||
Json::die([
|
||||
'result' => false,
|
||||
'reason' => '존재하지 않는 유저입니다.',
|
||||
'newSeq' => false
|
||||
]);
|
||||
}
|
||||
|
||||
$session->last_msg = $date;
|
||||
|
||||
$dest = [
|
||||
'id' => $destMailbox,
|
||||
'name' => $destUser['name'],
|
||||
'nation_id' => $destUser['nation']
|
||||
];
|
||||
|
||||
sendMessage('private', $src, $dest, $msg, $date);
|
||||
}
|
||||
else{
|
||||
Json::die([
|
||||
'result' => false,
|
||||
'reason' => '알 수 없는 에러',
|
||||
'newSeq' => false
|
||||
]);
|
||||
}
|
||||
|
||||
Json::die([
|
||||
'result' => true,
|
||||
'reason' => 'SUCCESS',
|
||||
'newSeq' => true
|
||||
]);
|
||||
+2
-2
@@ -14,7 +14,7 @@ if (!$userID) {
|
||||
}
|
||||
|
||||
//회원 테이블에서 정보확인
|
||||
$member = RootDB::db()->queryFirstRow("select no,name,picture,imgsvr,grade from MEMBER where no= %i", $userID);
|
||||
$member = RootDB::db()->queryFirstRow("select no,name,picture,imgsvr,grade from member where no= %i", $userID);
|
||||
|
||||
if (!$member) {
|
||||
MessageBox("잘못된 접근입니다!!!");
|
||||
@@ -98,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 width='64' height='64' src='{$imageTemp}/{$member['picture']}' border=0>
|
||||
</td>
|
||||
<td>
|
||||
<input type=checkbox name=pic value=1 checked>사용
|
||||
|
||||
+13
-9
@@ -20,7 +20,7 @@ $v
|
||||
'character',
|
||||
'pic'
|
||||
])
|
||||
->rule('lengthBetween', 'name', [1, 6])
|
||||
->rule('lengthBetween', 'name', 1, 6)
|
||||
->rule('min', [
|
||||
'leader',
|
||||
'power',
|
||||
@@ -53,11 +53,13 @@ $leader = Util::getReq('leader', 'int', 50);
|
||||
$power = Util::getReq('power', 'int', 50);
|
||||
$intel = Util::getReq('intel', 'int', 50);
|
||||
|
||||
$mylog = [];
|
||||
$join = Util::getReq('join'); //쓸모 없음
|
||||
|
||||
extractMissingPostToGlobals();
|
||||
|
||||
$rootDB = RootDB::db();
|
||||
//회원 테이블에서 정보확인
|
||||
$member = $rootDB->queryFirstRow('SELECT `no`, id, picture, grade, `name` FROM MEMBER WHERE no=%i', $userID);
|
||||
$member = $rootDB->queryFirstRow('SELECT `no`, id, picture, grade, `name` FROM member WHERE no=%i', $userID);
|
||||
|
||||
if (!$member) {
|
||||
MessageBox("잘못된 접근입니다!!!");
|
||||
@@ -69,9 +71,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("<script>
|
||||
@@ -136,7 +138,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;
|
||||
@@ -179,7 +181,7 @@ if ($lastconnect >= $turntime) {
|
||||
}
|
||||
|
||||
//특회 전콘
|
||||
if ($admin['show_img_level'] >= 1 && $member['grade'] >= 1 && $member['picture'] != "" && $pic == 1) {
|
||||
if ($admin['show_img_level'] >= 1 && $member['grade'] >= 1 && $member['picture'] != "" && $pic) {
|
||||
$face = $member['picture'];
|
||||
$imgsvr = $member['imgsvr'];
|
||||
} else {
|
||||
@@ -235,12 +237,14 @@ $me = [
|
||||
'no'=>$generalID
|
||||
];
|
||||
|
||||
$log = [];
|
||||
$mylog = [];
|
||||
|
||||
if ($genius) {
|
||||
$log[0] = "<C>●</>{$admin['month']}월:<G><b>{$cityname}</b></>에서 <Y>{$name}</>(이)라는 기재가 천하에 이름을 알립니다.";
|
||||
$log[1] = "<C>●</>{$admin['month']}월:<C>".getGenSpecial($special2)."</> 특기를 가진 <C>천재</>의 등장으로 온 천하가 떠들썩합니다.";
|
||||
|
||||
$history[0] = "<C>●</>{$admin['year']}년 {$admin['month']}월:<L><b>【천재】</b></><G><b>{$cityname}</b></>에 천재가 등장했습니다.";
|
||||
pushWorldHistory($history, $admin['year'], $admin['month']);
|
||||
pushWorldHistory(["<C>●</>{$admin['year']}년 {$admin['month']}월:<L><b>【천재】</b></><G><b>{$cityname}</b></>에 천재가 등장했습니다."], $admin['year'], $admin['month']);
|
||||
} else {
|
||||
$log[0] = "<C>●</>{$admin['month']}월:<G><b>{$cityname}</b></>에서 <Y>{$name}</>(이)라는 호걸이 천하에 이름을 알립니다.";
|
||||
}
|
||||
|
||||
+398
@@ -0,0 +1,398 @@
|
||||
|
||||
|
||||
function hexToRgb(hex) {
|
||||
var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
|
||||
return result ? {
|
||||
r: parseInt(result[1], 16),
|
||||
g: parseInt(result[2], 16),
|
||||
b: parseInt(result[3], 16)
|
||||
} : null;
|
||||
}
|
||||
|
||||
|
||||
function isBrightColor(color){
|
||||
color = hexToRgb(color);
|
||||
if ((color.r*0.299 + color.g*0.587 + color.b*0.114) > 140){
|
||||
return true;
|
||||
}
|
||||
else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
var messageTemplate = '';
|
||||
var myGeneralID=null;
|
||||
var isChief = false;
|
||||
var sequence =null;
|
||||
var myNation = null;
|
||||
var lastMsg = null;
|
||||
|
||||
var generalList = {};
|
||||
|
||||
function responseMessage(msgID, response){
|
||||
$.ajax({
|
||||
url: 'j_msg_decide_opt.php',
|
||||
type: 'post',
|
||||
dataType:'json',
|
||||
contentType: 'application/json',
|
||||
data: JSON.stringify({
|
||||
msgID:msgID,
|
||||
response:response
|
||||
})
|
||||
}).then(refreshMsg);
|
||||
}
|
||||
|
||||
function refreshMsg(){
|
||||
return redrawMsg(fetchMsg());
|
||||
}
|
||||
|
||||
function fetchMsg(){
|
||||
return $.ajax({
|
||||
url: 'j_msg_get_recent.php',
|
||||
type: 'post',
|
||||
dataType:'json',
|
||||
contentType: 'application/json',
|
||||
data: JSON.stringify({
|
||||
sequence:sequence
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
function redrawMsg(deferred){
|
||||
|
||||
console.log(deferred);
|
||||
|
||||
function registerSequence(obj){
|
||||
if(!obj.result){
|
||||
deferred.reject();
|
||||
return;
|
||||
}
|
||||
sequence = obj.sequence;
|
||||
return obj;
|
||||
}
|
||||
|
||||
function refineMessageObjs(obj){
|
||||
var msgList = [obj.public, obj.private, obj.diplomacy, obj.national];
|
||||
$.each(msgList, function(){
|
||||
if(!this){
|
||||
return true;
|
||||
}
|
||||
|
||||
$.each(this, function(){
|
||||
var msg = this;
|
||||
if(!msg.src.nation){
|
||||
msg.src.nation = '재야';
|
||||
msg.src.color = '#000000';
|
||||
}
|
||||
|
||||
if(!msg.dest.nation){
|
||||
msg.dest.nation = '재야';
|
||||
msg.dest.color = '#000000';
|
||||
}
|
||||
|
||||
msg.src.colorType = isBrightColor(msg.src.color)?'bright':'dark';
|
||||
msg.dest.colorType = isBrightColor(msg.dest.color)?'bright':'dark';
|
||||
});
|
||||
});
|
||||
return obj;
|
||||
}
|
||||
|
||||
function printTemplate(obj){
|
||||
var printList = [
|
||||
[obj.public, $('#message_board .public_message'), 'public'],
|
||||
[obj.private, $('#message_board .private_message'), 'private'],
|
||||
[obj.diplomacy, $('#message_board .diplomacy_message'), 'diplomacy'],
|
||||
[obj.national, $('#message_board .national_message'), 'national'],
|
||||
];
|
||||
|
||||
$.each(printList, function(){
|
||||
var msgSource = this[0];
|
||||
var $msgBoard = this[1];
|
||||
var msgType = this[2];
|
||||
|
||||
if(!msgSource || $msgBoard.length == 0){
|
||||
console.log('No Items', msgSource, $msgBoard);
|
||||
return true;
|
||||
}
|
||||
|
||||
if(msgType == 'diplomacy'){
|
||||
//외교는 항상 새로 그린다
|
||||
$msgBoard.empty();
|
||||
}
|
||||
|
||||
|
||||
var needRefreshLastContact = (msgType == 'private');
|
||||
|
||||
//list의 맨 앞이 가장 최신 메시지임.
|
||||
var $msgs = msgSource.map(function(msg){
|
||||
|
||||
var contactTarget = (msg.src.id != myGeneralID) ? msg.src.id : msg.dest.id;
|
||||
if(needRefreshLastContact && contactTarget != myGeneralID)
|
||||
{
|
||||
needRefreshLastContact = false;
|
||||
$('#last_contact').val(contactTarget).html(generalList[contactTarget].textName).show();
|
||||
}
|
||||
|
||||
msg.msgType = msgType;
|
||||
msg.defaultIcon = pathConfig.sharedIcon+'/default.jpg';
|
||||
var msgHtml = TemplateEngine(messageTemplate, msg);
|
||||
|
||||
|
||||
//만약 이전 메시지와 같은 id가 온 경우 덮어씌운다.
|
||||
//NOTE:현 프로세스 상에서는 같은 id가 와선 안된다.
|
||||
var $existMsg = $('#msg_{0}'.format(msg.id));
|
||||
var $msg = $(msgHtml);
|
||||
if($existMsg.length){
|
||||
console.log('메시지 충돌', $msg, $existMsg);
|
||||
$existMsg.html($msg.html());
|
||||
$msg = $existMsg;
|
||||
}
|
||||
|
||||
if(msg.option && msg.option.parent){
|
||||
//parent는 삭제.
|
||||
$('#msg_{0}'.format(msg.option.parent)).detach();
|
||||
}
|
||||
|
||||
$msg.find('button.prompt_yes').click(function(){
|
||||
if(!confirm("수락하시겠습니까?")){
|
||||
return false;
|
||||
}
|
||||
responseMessage(msg.id, true);
|
||||
|
||||
});
|
||||
|
||||
$msg.find('button.prompt_no').click(function(){
|
||||
if(!confirm("거절하시겠습니까?")){
|
||||
return false;
|
||||
}
|
||||
responseMessage(msg.id, false);
|
||||
});
|
||||
|
||||
if($existMsg.length){
|
||||
return null;
|
||||
}
|
||||
else{
|
||||
return $msg;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
$msgBoard.prepend($msgs);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
deferred
|
||||
.then(registerSequence)
|
||||
.then(refineMessageObjs)
|
||||
.then(printTemplate);
|
||||
}
|
||||
|
||||
function refreshMailboxList(obj){
|
||||
//$.ajax는 data, textStatus, jqXHR를 가진다
|
||||
//when으로 묶었으므로 data를 풀어야함.
|
||||
obj = obj[0];
|
||||
|
||||
|
||||
var $mailboxList = $('#mailbox_list');
|
||||
|
||||
$mailboxList.change(function(){
|
||||
console.log($(this).val());
|
||||
})
|
||||
|
||||
var oldSelected = $mailboxList.val();
|
||||
|
||||
$mailboxList.empty();
|
||||
|
||||
var $lastContact = $('#last_contact');
|
||||
var lastContact = null;
|
||||
if($lastContact.length > 0 && $lastContact.val()>=0){
|
||||
lastContact = {
|
||||
id:$lastContact.val(),
|
||||
textName:$lastContact.html()
|
||||
};
|
||||
$lastContact = null;
|
||||
}
|
||||
|
||||
generalList = {};
|
||||
|
||||
//TODO:수뇌인 경우 각국에 대해 외교 국메를 넣을 수 있어야함.
|
||||
|
||||
$.each(obj.nation, function(){
|
||||
var nation = this;
|
||||
//console.log(nation);
|
||||
var $optgroup = $('<optgroup label="{0}"></optgroup>'.format(nation.name));
|
||||
$optgroup.css('background-color', nation.color);
|
||||
|
||||
if(myNation.mailbox == nation.mailbox){
|
||||
myNation.color = nation.color;
|
||||
}
|
||||
|
||||
if(isBrightColor(nation.color)){
|
||||
$optgroup.css('color', 'black');
|
||||
}
|
||||
else{
|
||||
$optgroup.css('color', 'white');
|
||||
}
|
||||
|
||||
$.each(nation.general, function(){
|
||||
var generalID = this[0];
|
||||
var generalName = this[1];
|
||||
var isNPC = !!(this[2] & 0x2);
|
||||
var isRuler = !!(this[2] & 0x1);
|
||||
|
||||
|
||||
|
||||
if(generalID == myGeneralID){
|
||||
return true;
|
||||
}
|
||||
|
||||
var textName = generalName;
|
||||
if(isRuler){
|
||||
textName = '*{0}*'.format(textName);
|
||||
}
|
||||
|
||||
generalList[generalID] = {
|
||||
id:generalID,
|
||||
name:generalName,
|
||||
textName:textName,
|
||||
isRuler:isRuler,
|
||||
nation:nation.nationID,
|
||||
color:nation.color
|
||||
};
|
||||
|
||||
var $item = $('<option value="{0}">{1}</option>'.format(generalID, textName));
|
||||
$optgroup.append($item);
|
||||
});
|
||||
|
||||
$mailboxList.append($optgroup);
|
||||
});
|
||||
|
||||
var $favorite = $('<optgroup label="즐겨찾기"></optgroup>');
|
||||
|
||||
//아국메시지, 전체메시지
|
||||
var $ourCountry = $('<option value="{0}">【 아국 메세지 】</option>'.format(myNation.mailbox))
|
||||
.css({'background-color':myNation.color, 'color':isBrightColor(myNation.color)?'black':'white'});
|
||||
var $toPublic = $('<option value="9999">【 전체 메세지 】</option>');
|
||||
$favorite.append($ourCountry);
|
||||
$favorite.append($toPublic);
|
||||
|
||||
$lastContact = $('<option id="last_contact" value="-1"></option>').hide();
|
||||
if(lastContact){
|
||||
$lastContact.show().val(lastContact.id).html(lastContact.textName);
|
||||
}
|
||||
$favorite.append($lastContact);
|
||||
//TODO:운영자를 추가하는 코드도 넣을 것.
|
||||
|
||||
$mailboxList.prepend($favorite);
|
||||
|
||||
if(!oldSelected){
|
||||
$mailboxList.val(myNation.mailbox);
|
||||
}
|
||||
else{
|
||||
$mailboxList.val(oldSelected);
|
||||
}
|
||||
}
|
||||
|
||||
function registerGlobal(basicInfo){
|
||||
|
||||
myNation = {
|
||||
'id':basicInfo.myNationID,
|
||||
'mailbox':basicInfo.myNationID+9000,
|
||||
'color':'#000000',
|
||||
'nation':'재야'
|
||||
};
|
||||
lastMsg = {
|
||||
id : basicInfo.lastContact
|
||||
};
|
||||
myGeneralID = basicInfo.generalID;
|
||||
isChief = basicInfo.isChief;
|
||||
}
|
||||
|
||||
function activateMessageForm(){
|
||||
var $msgInput = $('#msg_input');
|
||||
var $msgSubmit = $('#msg_submit');
|
||||
var $mailboxList = $('#mailbox_list');
|
||||
|
||||
$msgInput.keypress(function (e) {
|
||||
var code = (e.keyCode ? e.keyCode : e.which);
|
||||
if (code == 13) {
|
||||
$msgSubmit.trigger('click');
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
$msgSubmit.click(function(){
|
||||
|
||||
var text = $.trim($msgInput.val());
|
||||
$msgInput.val('').focus();
|
||||
|
||||
var targetMailbox = $mailboxList.val();
|
||||
console.log(targetMailbox, text);
|
||||
|
||||
var deferred;
|
||||
|
||||
if(text){
|
||||
deferred = $.ajax({
|
||||
url:'j_msg_submit.php',
|
||||
type: 'post',
|
||||
dataType:'json',
|
||||
contentType: 'application/json',
|
||||
data: JSON.stringify({
|
||||
mailbox:parseInt(targetMailbox),
|
||||
text:text
|
||||
})
|
||||
});
|
||||
}
|
||||
else{
|
||||
deferred = $.Deferred();
|
||||
deferred.resolve({
|
||||
result:true,
|
||||
reason:'no_text'
|
||||
});
|
||||
}
|
||||
|
||||
deferred.then(refreshMsg);
|
||||
});
|
||||
}
|
||||
|
||||
jQuery(function($){
|
||||
|
||||
//tmp_template.html은 추후 msg.js에 통합될 수 있음
|
||||
var getTemplate = $.get('js/templates/message.html',function(obj){
|
||||
messageTemplate = obj;
|
||||
});
|
||||
|
||||
//basic_info.json은 세션값에 따라 동적으로 바뀌는 데이터임.
|
||||
var basicInfo = $.ajax({
|
||||
url:'j_basic_info.php',
|
||||
type: 'post',
|
||||
dataType:'json',
|
||||
contentType: 'application/json',
|
||||
data: JSON.stringify({
|
||||
|
||||
})
|
||||
}).then(registerGlobal);
|
||||
|
||||
//sender_list.json 은 서버측에선 캐시 가능한 데이터임.
|
||||
var senderList = $.ajax({
|
||||
url: 'j_msg_contact_list.php',
|
||||
type: 'post',
|
||||
dataType:'json',
|
||||
contentType: 'application/json',
|
||||
data: JSON.stringify({
|
||||
|
||||
})
|
||||
});
|
||||
|
||||
var MessageList = fetchMsg();
|
||||
|
||||
senderList = $.when(senderList, basicInfo)
|
||||
.then(refreshMailboxList)
|
||||
.then(activateMessageForm);
|
||||
|
||||
$.when(MessageList, getTemplate, basicInfo, senderList)
|
||||
.then(function(){
|
||||
redrawMsg(MessageList);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,35 @@
|
||||
<div
|
||||
class="msg_plate msg_plate_<%msgType%>"
|
||||
id="msg_<%id%>"
|
||||
data-id="<%id%>"
|
||||
>
|
||||
<div class="msg_icon">
|
||||
<%if(src.icon) { %>
|
||||
<img width='64' height='64' src="<%encodeURI(src.icon)%>">
|
||||
<%} else {%>
|
||||
<img width='64' height='64' src="<%encodeURI(defaultIcon)%>">
|
||||
<%}%>
|
||||
</div>
|
||||
<div class="msg_body">
|
||||
<div class="msg_header">
|
||||
<%if(msgType == 'private') {%>
|
||||
<span class="msg_target msg_<%src.colorType%>" style="background-color:<%src.color%>;"><%e(src.name)%>:<%e(src.nation)%></span
|
||||
><span class="msg_from_to">▶</span
|
||||
><span class="msg_target msg_<%dest.colorType%>" style="background-color:<%dest.color%>;"><%e(dest.name)%>:<%e(dest.nation)%></span>
|
||||
<%} else if(msgType == 'national' && src.nation_id == dest.nation_id){%>
|
||||
<span class="msg_target msg_<%src.colorType%>" style="background-color:<%src.color%>;"><%e(src.name)%>:<%e(src.nation)%></span>
|
||||
<%} else if(msgType == 'national' || msgType == 'diplomacy'){%>
|
||||
<span class="msg_target msg_<%src.colorType%>" style="background-color:<%src.color%>;"><%e(src.name)%>:<%e(src.nation)%></span
|
||||
><span class="msg_from_to">▶</span
|
||||
><span class="msg_target msg_<%dest.colorType%>" style="background-color:<%dest.color%>;"><%e(dest.nation)%></span>
|
||||
<%} else {%>
|
||||
<span class="msg_target msg_<%src.colorType%>" style="background-color:<%src.color%>;"><%e(src.name)%>:<%e(src.nation)%></span>
|
||||
<%} %>
|
||||
<span class="msg_time"><<%e(time)%>></span>
|
||||
</div>
|
||||
|
||||
<div class="msg_content"><%e(text)%></div>
|
||||
<%if(this.option && this.option.action) {%>
|
||||
<div class="msg_prompt">
|
||||
<button class="prompt_yes btn_prompt">수락</button> <button class="prompt_no btn_prompt">거절</button>
|
||||
</div><%} %></div></div>
|
||||
+11
-30
@@ -21,34 +21,12 @@ $loader->addClassMap((function () {
|
||||
|
||||
//디버그용 매크로
|
||||
ini_set("session.cache_expire", 10080); // minutes
|
||||
|
||||
|
||||
include "MYDB.php";
|
||||
|
||||
// 각종 변수
|
||||
define('STEP_LOG', true);
|
||||
define('PROCESS_LOG', true);
|
||||
$_startTime = microtime(true);
|
||||
$_upgradeLimit = 30; // 능력치 상승 경험치
|
||||
$_dexLimit = 1000000; // 숙련도 제한치
|
||||
$_defaultatmos = 40; // 초기 사기치
|
||||
$_defaulttrain = 40; // 초기 훈련치
|
||||
$_defaultatmos2 = 70; // 초기 사기치
|
||||
$_defaulttrain2 = 70; // 초기 훈련치
|
||||
$_maxtrain = 100; // 최대 훈련치
|
||||
$_maxatmos = 100; // 인위적으로 올릴 수 있는 최대 사기치
|
||||
$_maximumatmos = 150; // 최대 사기치
|
||||
$_maximumtrain = 110; // 최대 훈련치
|
||||
$_training = 30; // 풀징병시 훈련 1회 상승량
|
||||
$_atmosing = 0.98; // 훈련시 사기 감소율
|
||||
$_basefiring = 0.25; // 계략 기본 성공률
|
||||
$_firing = 300; // 계략시 확률 가중치(수치가 클수록 변화가 적음 : (지력차/$_firing + $_basefiring)
|
||||
$_firingbase = 100; // 계략시 기본 수치 감소량
|
||||
$_firingpower = 400; // 계략시 수치 감소량($_firingbase ~ $_firingpower)
|
||||
$x_goodgenleader = 65; // 명장,지장에 사용될 통솔 제한
|
||||
$x_goodgenpower = 65; // 명장에 사용될 무력 제한
|
||||
$x_goodgenintel = 65; // 지장에 사용될 지력 제한
|
||||
$_taxrate = 0.01; // 군량 매매시 세율
|
||||
|
||||
ob_start();
|
||||
session_cache_limiter('nocache');//NOTE: 캐시가 가능하도록 설정해야 할 수도 있음. 주의!
|
||||
@@ -81,7 +59,7 @@ function PrintElapsedTime()
|
||||
{
|
||||
global $_startTime;
|
||||
$_endTime = round(microtime(true) - $_startTime, 3);
|
||||
echo "<table width=1000 align=center style=font-size:10;><tr><td align=right>경과시간 : {$_endTime}초</td></tr></table>";
|
||||
echo "<table width=1000 align=center style=font-size:10px;><tr><td align=right>경과시간 : {$_endTime}초</td></tr></table>";
|
||||
}
|
||||
|
||||
function LogText($prefix, $variable)
|
||||
@@ -90,30 +68,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();
|
||||
|
||||
@@ -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){
|
||||
|
||||
+28
-41
@@ -10,7 +10,6 @@ function processWar($general, $city) {
|
||||
|
||||
$templates = new \League\Plates\Engine('templates');
|
||||
|
||||
global $_maximumatmos, $_maximumtrain, $_dexLimit;
|
||||
$date = substr($general['turntime'],11,5);
|
||||
|
||||
$query = "select * from game limit 1";
|
||||
@@ -133,7 +132,7 @@ function processWar($general, $city) {
|
||||
// 장수가 없어서 도시 공격하려했으나 병량없을시
|
||||
if($opposecount == 0 && $destnation['nation'] > 0 && $destnation['rice'] <= 0 && $city['supply'] == 1) {
|
||||
$general['train'] += 1; //훈련 상승
|
||||
if($general['train'] > $_maximumtrain) { $general['train'] = $_maximumtrain; }
|
||||
if($general['train'] > GameConst::$maxTrainByWar) { $general['train'] = GameConst::$maxTrainByWar; }
|
||||
$query = "update general set recwar='{$general['turntime']}',train='{$general['train']}',warnum=warnum+1 where no='{$general['no']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
|
||||
@@ -164,7 +163,7 @@ function processWar($general, $city) {
|
||||
$log[] = "<C>●</>".GameUnitConst::byId($general['crewtype'])->name."(으)로 성벽을 <M>공격</>합니다.";
|
||||
|
||||
$general['train'] += 1; //훈련 상승
|
||||
if($general['train'] > $_maximumtrain) { $general['train'] = $_maximumtrain; }
|
||||
if($general['train'] > GameConst::$maxTrainByWar) { $general['train'] = GameConst::$maxTrainByWar; }
|
||||
$query = "update general set recwar='{$general['turntime']}',train='{$general['train']}',warnum=warnum+1 where no='{$general['no']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
|
||||
@@ -272,11 +271,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 +315,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[] = "<C>●</><C>회피</>했다!</>";
|
||||
$myCrew /= 10; // 10%만 소모
|
||||
$myCrew /= 5; // 20%만 소모
|
||||
$avoid = 0;
|
||||
}
|
||||
|
||||
@@ -456,8 +456,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);
|
||||
// 국가보정
|
||||
@@ -574,9 +574,9 @@ function processWar($general, $city) {
|
||||
}
|
||||
|
||||
$general['train'] += 1; //훈련 상승
|
||||
if($general['train'] > $_maximumtrain) { $general['train'] = $_maximumtrain; }
|
||||
if($general['train'] > GameConst::$maxTrainByWar) { $general['train'] = GameConst::$maxTrainByWar; }
|
||||
$oppose['train'] += 1; //훈련 상승
|
||||
if($oppose['train'] > $_maximumtrain) { $oppose['train'] = $_maximumtrain; }
|
||||
if($oppose['train'] > GameConst::$maxTrainByWar) { $oppose['train'] = GameConst::$maxTrainByWar; }
|
||||
|
||||
$query = "update general set recwar='{$general['turntime']}',train='{$general['train']}',warnum=warnum+1 where no='{$general['no']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
@@ -1137,6 +1137,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 +1153,14 @@ function processWar($general, $city) {
|
||||
} else {
|
||||
$batlog[] = "<C>●</><C>회피</>했다!</>";
|
||||
$oppbatlog[] = "<C>●</>상대가 <R>회피</>했다!</>";
|
||||
$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 +1182,7 @@ function processWar($general, $city) {
|
||||
} else {
|
||||
$oppbatlog[] = "<C>●</><C>회피</>했다!</>";
|
||||
$batlog[] = "<C>●</>상대가 <R>회피</>했다!</>";
|
||||
$opCrew /= 10; // 10%만 소모
|
||||
$opCrew /= 5; // 20%만 소모
|
||||
$opAvoid = 0;
|
||||
}
|
||||
}
|
||||
@@ -1329,8 +1331,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 +1354,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);
|
||||
// 국가보정
|
||||
@@ -1395,7 +1397,7 @@ function processWar($general, $city) {
|
||||
$opposecount--;
|
||||
|
||||
$general['atmos'] *= 1.1; //사기 증가
|
||||
if($general['atmos'] > $_maximumatmos) { $general['atmos'] = $_maximumatmos; }
|
||||
if($general['atmos'] > GameConst::$maxAtmosByWar) { $general['atmos'] = GameConst::$maxAtmosByWar; }
|
||||
|
||||
$query = "update general set atmos='{$general['atmos']}',killnum=killnum+1 where no='{$general['no']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
@@ -1442,7 +1444,7 @@ function processWar($general, $city) {
|
||||
}
|
||||
|
||||
$oppose['atmos'] *= 1.1; //사기 증가
|
||||
if($oppose['atmos'] > $_maximumatmos) { $oppose['atmos'] = $_maximumatmos; }
|
||||
if($oppose['atmos'] > GameConst::$maxAtmosByWar) { $oppose['atmos'] = GameConst::$maxAtmosByWar; }
|
||||
|
||||
// 상대장수 경험 등등 증가
|
||||
$opexp = Util::round($opexp / 50 * 0.8);
|
||||
@@ -1548,10 +1550,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 +1564,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;
|
||||
@@ -1714,8 +1702,6 @@ function ConquerCity($game, $general, $city, $nation, $destnation) {
|
||||
$db = DB::db();
|
||||
$connect=$db->get();
|
||||
|
||||
global $_maximumatmos;
|
||||
|
||||
$alllog = [];
|
||||
$log = [];
|
||||
$history = [];
|
||||
@@ -1789,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% 확률로 임관(엔장, 인재, 의병)
|
||||
@@ -1867,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;
|
||||
@@ -1901,7 +1888,7 @@ function ConquerCity($game, $general, $city, $nation, $destnation) {
|
||||
}
|
||||
|
||||
$general['atmos'] *= 1.1; //사기 증가
|
||||
if($general['atmos'] > $_maximumatmos) { $general['atmos'] = $_maximumatmos; }
|
||||
if($general['atmos'] > GameConst::$maxAtmosByWar) { $general['atmos'] = GameConst::$maxAtmosByWar; }
|
||||
|
||||
$conquerNation = getConquerNation($city);
|
||||
|
||||
|
||||
+21
-19
@@ -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();
|
||||
@@ -361,7 +363,7 @@ function calc(cost, formnum) {
|
||||
$defence = $unit->defence + $abil;
|
||||
$speed = $unit->speed;
|
||||
$avoid = $unit->avoid;
|
||||
$weapImage = ServConfig::$gameImagePath."/weap{$i}.jpg";
|
||||
$weapImage = ServConfig::$gameImagePath."/weap{$i}.png";
|
||||
if($admin['show_img_level'] < 2) { $weapImage = ServConfig::$sharedIconPath."/default.jpg"; }
|
||||
|
||||
$baseRiceShort = round($baseRice, 1);
|
||||
@@ -371,7 +373,7 @@ function calc(cost, formnum) {
|
||||
|
||||
echo "
|
||||
<tr height=64 bgcolor=$l>
|
||||
<td background={$weapImage} align=center></td>
|
||||
<td style='background:no-repeat center url(\"{$weapImage}\");background-size:64px;background-color:#222222;' align=center></td>
|
||||
<td align=center>{$name}</td>
|
||||
<td align=center>{$attack}</td>
|
||||
<td align=center>{$defence}</td>
|
||||
@@ -571,7 +573,7 @@ function calc(cost, formnum) {
|
||||
$defence = $unit->defence + $abil;
|
||||
$speed = $unit->speed;
|
||||
$avoid = $unit->avoid;
|
||||
$weapImage = ServConfig::$gameImagePath."/weap{$i}.jpg";
|
||||
$weapImage = ServConfig::$gameImagePath."/weap{$i}.png";
|
||||
if($admin['show_img_level'] < 2) { $weapImage = ServConfig::$sharedIconPath."/default.jpg"; }
|
||||
|
||||
$baseRiceShort = round($baseRice, 1);
|
||||
@@ -581,7 +583,7 @@ function calc(cost, formnum) {
|
||||
|
||||
echo "
|
||||
<tr height=64 bgcolor=$l>
|
||||
<td background={$weapImage} align=center></td>
|
||||
<td style='background:no-repeat center url(\"{$weapImage}\");background-size:64px;background-color:#222222;' align=center></td>
|
||||
<td align=center>{$name}</td>
|
||||
<td align=center>{$attack}</td>
|
||||
<td align=center>{$defence}</td>
|
||||
@@ -972,7 +974,7 @@ function command_25($turn, $command) {
|
||||
$result = MYDB_query($query, $connect) or Error("command_27 ".MYDB_error($connect),"");
|
||||
$me = MYDB_fetch_array($result);
|
||||
|
||||
$query = "select nation,name,color,scout,scoutmsg,tricklimit,gennum from nation order by gennum";
|
||||
$query = "select nation,name,color,scout,scoutmsg,sabotagelimit,gennum from nation order by gennum";
|
||||
$result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
|
||||
$count = MYDB_num_rows($result);
|
||||
|
||||
@@ -1595,22 +1597,22 @@ function command_46($turn, $command) {
|
||||
?>
|
||||
</select>
|
||||
성향 : <select name=third size=1>
|
||||
<option value=1 style=background-color:black;color:white;>".getNationType(1)."</option>
|
||||
<option value=2 style=background-color:black;color:white;>".getNationType(2)."</option>
|
||||
<option value=10 style=background-color:black;color:white;>".getNationType(10)."</option>
|
||||
<option value=3 style=background-color:black;color:white;>".getNationType(3)."</option>
|
||||
<option value=4 style=background-color:black;color:white;>".getNationType(4)."</option>
|
||||
<option value=5 style=background-color:black;color:white;>".getNationType(5)."</option>
|
||||
<option value=6 style=background-color:black;color:white;>".getNationType(6)."</option>
|
||||
<option value=7 style=background-color:black;color:white;>".getNationType(7)."</option>
|
||||
<option value=8 style=background-color:black;color:white;>".getNationType(8)."</option>
|
||||
<option selected value=9 style=background-color:black;color:white;>".getNationType(9)."</option>
|
||||
<option value=11 style=background-color:black;color:white;>".getNationType(11)."</option>
|
||||
<option value=12 style=background-color:black;color:white;>".getNationType(12)."</option>
|
||||
<option value=13 style=background-color:black;color:white;>".getNationType(13)."</option>
|
||||
<option value=1 style=background-color:black;color:white;><?=getNationType(1)?></option>
|
||||
<option value=2 style=background-color:black;color:white;><?=getNationType(2)?></option>
|
||||
<option value=10 style=background-color:black;color:white;><?=getNationType(10)?></option>
|
||||
<option value=3 style=background-color:black;color:white;><?=getNationType(3)?></option>
|
||||
<option value=4 style=background-color:black;color:white;><?=getNationType(4)?></option>
|
||||
<option value=5 style=background-color:black;color:white;><?=getNationType(5)?></option>
|
||||
<option value=6 style=background-color:black;color:white;><?=getNationType(6)?></option>
|
||||
<option value=7 style=background-color:black;color:white;><?=getNationType(7)?></option>
|
||||
<option value=8 style=background-color:black;color:white;><?=getNationType(8)?></option>
|
||||
<option selected value=9 style=background-color:black;color:white;><?=getNationType(9)?></option>
|
||||
<option value=11 style=background-color:black;color:white;><?=getNationType(11)?></option>
|
||||
<option value=12 style=background-color:black;color:white;><?=getNationType(12)?></option>
|
||||
<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]>";
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
<?php
|
||||
namespace sammo;
|
||||
|
||||
class DiplomacticMessage extends Message{
|
||||
|
||||
public function __construct(
|
||||
string $msgType,
|
||||
MessageTarget $src,
|
||||
MessageTarget $dest,
|
||||
string $msg,
|
||||
\DateTime $date,
|
||||
\DateTime $validUntil,
|
||||
array $msgOption
|
||||
)
|
||||
{
|
||||
if ($msgType !== self::MSGTYPE_DIPLOMACY){
|
||||
throw new \InvalidArgumentException('DiplomaticMessage msgType');
|
||||
}
|
||||
parent::__construct(...func_get_args());
|
||||
|
||||
//TODO: 누가, 누구에게 보낸 건지 파싱
|
||||
}
|
||||
|
||||
public function send(){
|
||||
parent::send();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,342 @@
|
||||
<?php
|
||||
namespace sammo;
|
||||
|
||||
class DiplomaticMessage extends Message{
|
||||
|
||||
const ACCEPTED = 1;
|
||||
const DECLINED = -1;
|
||||
const INVALID = 0;
|
||||
|
||||
|
||||
const TYPE_NO_AGGRESSION = 'noAggression'; //불가침
|
||||
const TYPE_CANCEL_NA = 'cancelNA'; //불가침 파기
|
||||
const TYPE_STOP_WAR = 'stopWar'; //종전
|
||||
const TYPE_MERGE = 'merge'; //통합
|
||||
const TYPE_SURRENDER = 'surrender'; //항복
|
||||
|
||||
protected $diplomaticType = '';
|
||||
protected $diplomacyName = '';
|
||||
protected $validDiplomacy = true;
|
||||
|
||||
public function __construct(
|
||||
string $msgType,
|
||||
MessageTarget $src,
|
||||
MessageTarget $dest,
|
||||
string $msg,
|
||||
\DateTime $date,
|
||||
\DateTime $validUntil,
|
||||
array $msgOption
|
||||
)
|
||||
{
|
||||
if ($msgType !== self::MSGTYPE_DIPLOMACY){
|
||||
throw new \InvalidArgumentException('DiplomaticMessage msgType');
|
||||
}
|
||||
|
||||
$this->diplomaticType = Util::array_get($msgOption['action']);
|
||||
switch($this->diplomaticType){
|
||||
case self::TYPE_NO_AGGRESSION: $this->diplomacyName = '불가침'; break;
|
||||
case self::TYPE_CANCEL_NA: $this->diplomacyName = '불가침 파기'; break;
|
||||
case self::TYPE_STOP_WAR: $this->diplomacyName = '종전'; break;
|
||||
case self::TYPE_MERGE: $this->diplomacyName = '통합'; break;
|
||||
case self::TYPE_SURRENDER: $this->diplomacyName = '투항'; break;
|
||||
default: throw \RuntimeException('diplomaticType이 올바르지 않음');
|
||||
}
|
||||
|
||||
parent::__construct(...func_get_args());
|
||||
|
||||
|
||||
if(Util::array_get($msgOption['used'])){
|
||||
$this->validDiplomacy = false;
|
||||
}
|
||||
|
||||
if($this->validUntil < (new \DateTime())){
|
||||
$this->validDiplomacy = false;
|
||||
}
|
||||
}
|
||||
|
||||
protected function checkDiplomaticMessageValidation(array $general){
|
||||
if(!$this->validDiplomacy){
|
||||
return [self::INVALID, '유효하지 않은 외교서신입니다.'];
|
||||
}
|
||||
|
||||
if($this->mailbox !== $this->dest->nationID + static::MAILBOX_NATIONAL){
|
||||
return [self::INVALID, '송신자가 외교서신을 처리할 수 없습니다.'];
|
||||
}
|
||||
|
||||
if(!$general || $general['level'] < 5){
|
||||
return [self::INVALID, '해당 국가의 수뇌가 아닙니다.'];
|
||||
}
|
||||
|
||||
return [self::ACCEPTED, ''];
|
||||
}
|
||||
|
||||
protected function noAggression(){
|
||||
$year = Util::array_get($this->msgOption['year']);
|
||||
$option = Util::array_get($this->msgOption['option'])??'';
|
||||
if($year < 1 || $year > 30){
|
||||
return [self::INVALID, '올바르지 않은 불가침 서신입니다.'];
|
||||
}
|
||||
|
||||
$helper = new Engine\Diplomacy($this->src->nationID, $this->dest->nationID);
|
||||
$chk = $helper->noAggression($year, $option);
|
||||
if($chk[0] !== self::ACCEPTED){
|
||||
return $chk;
|
||||
}
|
||||
|
||||
$youlog[] = "<C>●</><D><b>{$this->dest->nationName}</b></>(와)과 <C>$when</>년 불가침에 성공했습니다.";
|
||||
$mylog[] = "<C>●</><D><b>{$this->src->nationName}</b></>(와)과 <C>$when</>년 불가침에 합의했습니다.";
|
||||
pushGenLog(['no'=>$this->dest->generalID], $mylog);
|
||||
pushGenLog(['no'=>$this->src->generalID], $youlog);
|
||||
pushGeneralHistory(['no'=>$this->src->generalID], "<C>●</>{$helper->year}년 {$helper->month}월:<D><b>{$this->dest->nationName}</b></>(와)과 {$when}년 불가침 성공");
|
||||
pushGeneralHistory(['no'=>$this->dest->generalID], "<C>●</>{$helper->year}년 {$helper->month}월:<D><b>{$this->src->nationName}</b></>(와)과 {$when}년 불가침 수락");
|
||||
|
||||
return $chk;
|
||||
}
|
||||
|
||||
protected function cancelNA(){
|
||||
$helper = new Engine\Diplomacy($this->src->nationID, $this->dest->nationID);
|
||||
$chk = $helper->cancelNA();
|
||||
if($chk[0] !== self::ACCEPTED){
|
||||
return $chk;
|
||||
}
|
||||
|
||||
$alllog[] = "<C>●</>{$helper->month}월:<Y>{$this->dest->generalName}</>(이)가 <D><b>{$this->src->nationName}</b></>(와)과 <M>조약 파기</>에 합의.";
|
||||
$history[] = "<C>●</>{$helper->year}년 {$helper->month}월:<Y><b>【파기】</b></><D><b>{$this->dest->nationName}</b></>(이)가 <D><b>{$this->src->nationName}</b></>(와)과 불가침을 파기 하였습니다.";
|
||||
$youlog[] = "<C>●</><D><b>{$this->dest->nationName}</b></>(와)과 파기에 성공했습니다.";
|
||||
$mylog[] = "<C>●</><D><b>{$this->src->nationName}</b></>(와)과 파기에 합의했습니다.";
|
||||
pushGeneralHistory(['no'=>$this->src->generalID], "<C>●</>{$helper->year}년 {$helper->month}월:<D><b>{$this->dest->nationName}</b></>(와)과 파기 성공");
|
||||
pushGeneralHistory(['no'=>$this->dest->generalID], "<C>●</>{$helper->year}년 {$helper->month}월:<D><b>{$this->src->nationName}</b></>(와)과 파기 수락");
|
||||
|
||||
pushGenLog(['no'=>$this->dest->generalID], $mylog);
|
||||
pushGenLog(['no'=>$this->src->generalID], $youlog);
|
||||
pushGeneralPublicRecord($alllog, $helper->year, $helper->month);
|
||||
pushWorldHistory($history, $helper->year, $helper->month);
|
||||
|
||||
return $chk;
|
||||
}
|
||||
|
||||
protected function stopWar(){
|
||||
$helper = new Engine\Diplomacy($this->src->nationID, $this->dest->nationID);
|
||||
$chk = $helper->stopWar();
|
||||
if($chk[0] !== self::ACCEPTED){
|
||||
return $chk;
|
||||
}
|
||||
|
||||
$alllog[] = "<C>●</>{$helper->month}월:<Y>{$this->dest->generalName}</>(이)가 <D><b>{$this->src->nationName}</b></>(와)과 <M>종전 합의</> 하였습니다.";
|
||||
$history[] = "<C>●</>{$helper->year}년 {$helper->month}월:<Y><b>【종전】</b></><D><b>{$this->dest->nationName}</b></>(이)가 <D><b>{$this->src->nationName}</b></>(와)과 <M>종전 합의</> 하였습니다.";
|
||||
$youlog[] = "<C>●</><D><b>{$this->dest->nationName}</b></>(와)과 종전에 성공했습니다.";
|
||||
$mylog[] = "<C>●</><D><b>{$this->src->nationName}</b></>(와)과 종전에 합의했습니다.";
|
||||
pushGeneralHistory(['no'=>$this->src->generalID], "<C>●</>{$helper->year}년 {$helper->month}월:<D><b>{$this->dest->nationName}</b></>(와)과 종전 성공");
|
||||
pushGeneralHistory(['no'=>$this->dest->generalID], "<C>●</>{$helper->year}년 {$helper->month}월:<D><b>{$this->src->nationName}</b></>(와)과 종전 수락");
|
||||
|
||||
pushGenLog(['no'=>$this->dest->generalID], $mylog);
|
||||
pushGenLog(['no'=>$this->src->generalID], $youlog);
|
||||
pushGeneralPublicRecord($alllog, $helper->year, $helper->month);
|
||||
pushWorldHistory($history, $helper->year, $helper->month);
|
||||
|
||||
return $chk;
|
||||
}
|
||||
|
||||
protected function acceptMerge(){
|
||||
$helper = new Engine\Diplomacy($this->src->nationID, $this->dest->nationID);
|
||||
$chk = $helper->acceptMerge($this->src->generalID, $this->dest->generalID);
|
||||
if($chk[0] !== self::ACCEPTED){
|
||||
return $chk;
|
||||
}
|
||||
|
||||
pushGeneralHistory(
|
||||
['no'=>$this->src->generalID],
|
||||
["<C>●</>{$helper->year}년 {$helper->month}월:<D><b>{$this->dest->nationName}</b></>(와)과 통합 시도"]
|
||||
);
|
||||
pushGeneralHistory(
|
||||
['no'=>$this->dest->generalID],
|
||||
["<C>●</>{$helper->year}년 {$helper->month}월:<D><b>{$this->src->nationName}</b></>(와)과 통합 시도"]
|
||||
);
|
||||
pushGenLog(
|
||||
['no'=>$this->dest->generalID],
|
||||
["<C>●</><D><b>{$this->src->nationName}</b></>(와)과 통합에 동의했습니다."]
|
||||
);
|
||||
pushGenLog(
|
||||
['no'=>$this->src->generalID],
|
||||
["<C>●</><D><b>{$this->dest->nationName}</b></>(이)가 통합에 동의했습니다."]
|
||||
);
|
||||
pushGeneralPublicRecord(
|
||||
["<C>●</>{$helper->month}월:<Y>{$this->dest->generalName}</>(이)가 <D><b>{$this->src->nationName}</b></>(와)과 <M>통합</>에 동의하였습니다."],
|
||||
$helper->year,
|
||||
$helper->month);
|
||||
pushWorldHistory(
|
||||
["<C>●</>{$helper->year}년 {$helper->month}월:<Y><b>【통합시도】</b></><D><b>{$this->dest->nationName}</b></>(와)과 <D><b>{$this->src->nationName}</b></>(이)가 통합을 시도합니다."],
|
||||
$helper->year,
|
||||
$helper->month
|
||||
);
|
||||
|
||||
return $chk;
|
||||
}
|
||||
|
||||
protected function acceptSurrender(){
|
||||
$helper = new Engine\Diplomacy($this->src->nationID, $this->dest->nationID);
|
||||
$chk = $helper->acceptSurrender($this->src->generalID, $this->dest->generalID);
|
||||
if($chk[0] !== self::ACCEPTED){
|
||||
return $chk;
|
||||
}
|
||||
|
||||
pushGeneralHistory(
|
||||
['no'=>$this->src->generalID],
|
||||
"<C>●</>{$helper->year}년 {$helper->month}월:<D><b>{$this->dest->nationName}</b></>(와)과 투항 제의"
|
||||
);
|
||||
pushGeneralHistory(
|
||||
['no'=>$this->dest->generalID],
|
||||
"<C>●</>{$helper->year}년 {$helper->month}월:<D><b>{$this->src->nationName}</b></>(으)로 투항 동의"
|
||||
);
|
||||
pushGenLog(
|
||||
['no'=>$this->dest->generalID],
|
||||
["<C>●</><D><b>{$this->src->nationName}</b></>(으)로 투항에 동의했습니다."]
|
||||
);
|
||||
pushGenLog(
|
||||
['no'=>$this->src->generalID],
|
||||
["<C>●</><D><b>{$this->dest->nationName}</b></>(이)가 투항에 동의했습니다."]
|
||||
);
|
||||
pushGeneralPublicRecord(
|
||||
["<C>●</>{$helper->month}월:<Y>{$this->dest->generalName}</>(이)가 <D><b>{$this->src->nationName}</b></>(으)로 <M>투항</>에 동의하였습니다."],
|
||||
$helper->year,
|
||||
$helper->month);
|
||||
pushWorldHistory(
|
||||
["<C>●</>{$helper->year}년 {$helper->month}월:<Y><b>【투항시도】</b></><D><b>{$this->dest->nationName}</b></>(이)가 <D><b>{$this->src->nationName}</b></>(으)로 투항합니다."],
|
||||
$helper->year,
|
||||
$helper->month
|
||||
);
|
||||
|
||||
return $chk;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int 수행 결과 반환, ACCEPTED(등용장 소모), DECLINED(등용장 소모), INVALID 중 반환
|
||||
*/
|
||||
public function agreeMessage(int $receiverID):int{
|
||||
//NOTE: 올바른 유저가 agreeMessage() 호출을 한건지는 외부에서 체크 필요(Session->userID 등)
|
||||
|
||||
if(!$this->id){
|
||||
throw \RuntimeException('전송되지 않은 메시지에 수락 진행 중');
|
||||
}
|
||||
|
||||
|
||||
|
||||
$db = DB::db();
|
||||
$general = $db->queryFirstRow(
|
||||
'SELECT `name`, `level` FROM general WHERE `no`=%i AND nation=%i',
|
||||
$receiverID,
|
||||
$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], ["<C>●</>{$reason} {$this->diplomacyName} 실패."]);
|
||||
if($result === self::DECLINED){
|
||||
$this->_declineMessage();
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
switch($this->diplomaticType){
|
||||
case self::TYPE_NO_AGGRESSION:
|
||||
list($result, $reason) = $this->noAggression();
|
||||
break;
|
||||
case self::TYPE_CANCEL_NA:
|
||||
list($result, $reason) = $this->cancelNA();
|
||||
break;
|
||||
case self::TYPE_STOP_WAR:
|
||||
list($result, $reason) = $this->stopWar();
|
||||
break;
|
||||
case self::TYPE_MERGE:
|
||||
list($result, $reason) = $this->acceptMerge();
|
||||
break;
|
||||
case self::TYPE_SURRENDER:
|
||||
list($result, $reason) = $this->acceptSurrender();
|
||||
break;
|
||||
default:
|
||||
throw \RuntimeException('diplomaticType이 올바르지 않음');
|
||||
}
|
||||
|
||||
if($result !== self::ACCEPTED){
|
||||
pushGenLog(['no'=>$receiverID], ["<C>●</>{$reason} {$this->diplomacyName} 실패."]);
|
||||
if($result === self::DECLINED){
|
||||
$this->_declineMessage();
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
list(
|
||||
$year,
|
||||
$month
|
||||
) = $db->queryFirstList('SELECT year, month FROM game LIMIT 1');
|
||||
|
||||
|
||||
$this->dest->generalID = $receiverID;
|
||||
$this->dest->generalName = $general['name'];
|
||||
$this->msgOption['used'] = true;
|
||||
$this->invalidate();
|
||||
$this->validDiplomacy = false;
|
||||
|
||||
$newMsg = new Message(
|
||||
self::MSGTYPE_NATIONAL,
|
||||
$this->dest,
|
||||
$this->src,
|
||||
"【외교】{$year}년 {$month}월: {$this->src->nationName}이 {$this->dest->nationName}에게 제안한 {$this->diplomacyName} 동의.",
|
||||
new \DateTime(),
|
||||
new \DateTime('9999-12-31'),
|
||||
[
|
||||
'delete'=>$this->id
|
||||
]
|
||||
);
|
||||
$newMsg->send();
|
||||
|
||||
return self::ACCEPTED;
|
||||
|
||||
}
|
||||
|
||||
protected function _declineMessage(){
|
||||
$this->msgOption['used'] = true;
|
||||
$this->invalidate();
|
||||
$this->validDiplomacy = false;
|
||||
|
||||
return self::DECLINED;
|
||||
}
|
||||
|
||||
public function declineMessage(int $receiverID):int{
|
||||
if(!$this->id){
|
||||
throw \RuntimeException('전송되지 않은 메시지에 거절 진행 중');
|
||||
}
|
||||
|
||||
$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], ["<C>●</>{$reason} {$this->diplomacyName} 거절 불가."]);
|
||||
return $result;
|
||||
}
|
||||
|
||||
pushGenLog(['no'=>$receiverID], "<C>●</><D>{$this->src->nationName}</>의 {$this->diplomacyName} 제안을 거절했습니다.");
|
||||
pushGenLog(['no'=>$this->src->generalID], "<C>●</><Y>{$this->dest->nationName}</>(이)가 {$this->diplomacyName} 제안을 거절했습니다.");
|
||||
$this->_declineMessage();
|
||||
return self::DECLINED;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
namespace sammo\Engine;
|
||||
|
||||
class Battle{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,404 @@
|
||||
<?php
|
||||
namespace sammo\Engine;
|
||||
|
||||
use \sammo\DB;
|
||||
use \sammo\DiplomaticMessage;
|
||||
|
||||
//NOTE: A가 B에게 항복, 통합 서신을 보냈을 때 통합 후 대상이 A이므로 A가 주체임.
|
||||
class Diplomacy{
|
||||
|
||||
protected $srcNation = null;//TODO: 클래스로 변경
|
||||
protected $destNation = null;
|
||||
|
||||
protected $srcToDestDiplomacy = null;
|
||||
protected $destToSrcDiplomacy = null;
|
||||
public $valid = false;
|
||||
|
||||
public $startYear = 0;
|
||||
public $year = 0;
|
||||
public $month = 0;
|
||||
|
||||
public function __construct(int $srcNationID, int $destNationID){
|
||||
if($srcNationID === $destNationID){
|
||||
return;
|
||||
}
|
||||
|
||||
$db = DB::db();
|
||||
$srcNation = $db->queryFirstRow(
|
||||
'SELECT nation, `name`, `power`, capital, gold, rice, surlimit, color, `level` FROM nation WHERE nation=%i',
|
||||
$srcNationID
|
||||
);
|
||||
|
||||
$destNation = $db->queryFirstRow(
|
||||
'SELECT nation, `name`, `power`, capital, gold, rice, surlimit, color, `level` FROM nation WHERE nation=%i',
|
||||
$destNationID
|
||||
);
|
||||
|
||||
if(!$srcNation || !$destNation){
|
||||
return;
|
||||
}
|
||||
|
||||
$this->srcToDestDiplomacy = $db->queryFirstRow(
|
||||
'SELECT * FROM diplomacy WHERE me = %i AND you = %i',
|
||||
$srcNationID,
|
||||
$destNationID
|
||||
);
|
||||
|
||||
$this->destToSrcDiplomacy = $db->queryFirstRow(
|
||||
'SELECT * FROM diplomacy WHERE me = %i AND you = %i',
|
||||
$destNationID,
|
||||
$srcNationID
|
||||
);
|
||||
|
||||
$this->srcNation = $srcNation;
|
||||
$this->destNation = $destNation;
|
||||
$this->valid = true;
|
||||
|
||||
list(
|
||||
$this->startYear,
|
||||
$this->year,
|
||||
$this->month
|
||||
) = $db->queryFirstList('SELECT startyear, year, month FROM game LIMIT 1');
|
||||
|
||||
}
|
||||
|
||||
//방랑군이 아니어야함
|
||||
//상대도 방랑군이 아니어야함
|
||||
|
||||
//불가침시 : 교전중이 아니어야함, 선포중이 아니어야함. (서로) 합병중이 아니어얗.
|
||||
//불가침 파기시 : 불가침 중이어야함.
|
||||
//종전시 : 교전중이거나 선포중이어야함.
|
||||
//합병시 : 양국 다 외교제한이 지나지 않았어야함. 국력, 장수수가 적절해야함. 인접한 국가여야함. 서로 교전중이어선 안됨.
|
||||
// 송신자가 선포, 전쟁중이어선 안됨. 송신자가 C국과 불가침인데 수신자가 C국과 전쟁중이면 안됨
|
||||
//항복시 : 양국 다 외교제한이 지나지 않았어야함. 국력, 장수수가 적절해야함. 인접한 국가여야함. 서로 교전중이어선 안됨.
|
||||
// 송신자가 선포, 전쟁중이어선 안됨. 송신자가 C국과 불가침인데 수신자가 C국과 전쟁중이면 안됨
|
||||
|
||||
protected function checkValidNation(array $prev = [DiplomaticMessage::ACCEPTED, '']){
|
||||
if($prev[0] !== DiplomaticMessage::ACCEPTED){
|
||||
return $prev;
|
||||
}
|
||||
|
||||
if(!$this->srcNation || !$this->destNation || !$this->valid){
|
||||
return [DiplomaticMessage::DECLINED, '올바르지 않은 국가입니다.'];
|
||||
}
|
||||
|
||||
if($this->srcNation['level'] == 0 || $this->destNation['level'] == 0){
|
||||
return [DiplomaticMessage::DECLINED, '방랑군과 외교룰 수행할 수 없습니다.'];
|
||||
}
|
||||
|
||||
return $prev;
|
||||
}
|
||||
|
||||
protected function checkNotWar(array $prev = [DiplomaticMessage::ACCEPTED, '']){
|
||||
if($prev[0] !== DiplomaticMessage::ACCEPTED){
|
||||
return $prev;
|
||||
}
|
||||
|
||||
if($this->srcToDestDiplomacy['state'] == 0 || $this->srcToDestDiplomacy['state'] == 0
|
||||
||$this->destToSrcDiplomacy['state'] == 1 || $this->destToSrcDiplomacy['state'] == 1){
|
||||
return [DiplomaticMessage::DECLINED, '상대국과 선포, 전쟁 중입니다.'];
|
||||
}
|
||||
|
||||
return $prev;
|
||||
}
|
||||
|
||||
protected function checkNonAggressionTreaty(array $prev = [DiplomaticMessage::ACCEPTED, '']){
|
||||
if($prev[0] !== DiplomaticMessage::ACCEPTED){
|
||||
return $prev;
|
||||
}
|
||||
|
||||
if($this->srcToDestDiplomacy['state'] !== 7 || $this->destToSrcDiplomacy['state'] !== 7){
|
||||
return [DiplomaticMessage::DECLINED, '상대국과 불가침 중이 아닙니다.'];
|
||||
}
|
||||
|
||||
return $prev;
|
||||
}
|
||||
|
||||
protected function checkInWar(array $prev = [DiplomaticMessage::ACCEPTED, '']){
|
||||
if($prev[0] !== DiplomaticMessage::ACCEPTED){
|
||||
return $prev;
|
||||
}
|
||||
|
||||
if($this->srcToDestDiplomacy['state'] == 0 || $this->srcToDestDiplomacy['state'] == 0
|
||||
||$this->destToSrcDiplomacy['state'] == 1 || $this->destToSrcDiplomacy['state'] == 1){
|
||||
return $prev;
|
||||
}
|
||||
|
||||
return [DiplomaticMessage::DECLINED, '상대국과 선포, 전쟁 중이 아닙니다.'];
|
||||
}
|
||||
|
||||
protected function checkDiplomacyLimit(array $prev = [DiplomaticMessage::ACCEPTED, '']){
|
||||
if($prev[0] !== DiplomaticMessage::ACCEPTED){
|
||||
return $prev;
|
||||
}
|
||||
|
||||
if($this->destNation['surlimit'] > 0){
|
||||
return [DiplomaticMessage::DECLINED, '본국의 외교 기한이 남아있습니다.'];
|
||||
}
|
||||
|
||||
if($this->srcNation['surlimit'] > 0){
|
||||
return [DiplomaticMessage::DECLINED, '상대국의 외교 기한이 남아있습니다.'];
|
||||
}
|
||||
|
||||
return $prev;
|
||||
}
|
||||
|
||||
protected function checkStrictlyAdjacent(array $prev = [DiplomaticMessage::ACCEPTED, '']){
|
||||
if($prev[0] !== DiplomaticMessage::ACCEPTED){
|
||||
return $prev;
|
||||
}
|
||||
|
||||
if(!\sammo\isClose($this->srcNation['nation'], $this->destNation['nation'], false)){
|
||||
return [DiplomaticMessage::DECLINED, '상대국의 도시들과 보급선이 이어지지 않았습니다.'];
|
||||
}
|
||||
|
||||
return $prev;
|
||||
}
|
||||
|
||||
protected function checkAdjacent(array $prev = [DiplomaticMessage::ACCEPTED, '']){
|
||||
if($prev[0] !== DiplomaticMessage::ACCEPTED){
|
||||
return $prev;
|
||||
}
|
||||
|
||||
if(!\sammo\isClose($this->srcNation['nation'], $this->destNation['nation'], true)){
|
||||
return [DiplomaticMessage::DECLINED, '상대국의 도시와 인접하지 않았습니다.'];
|
||||
}
|
||||
|
||||
return $prev;
|
||||
}
|
||||
|
||||
protected function checkAlreadyMerging(array $prev = [DiplomaticMessage::ACCEPTED, '']){
|
||||
if($prev[0] !== DiplomaticMessage::ACCEPTED){
|
||||
return $prev;
|
||||
}
|
||||
|
||||
if((3 <= $this->srcToDestDiplomacy['state'] && $this->srcToDestDiplomacy['state'] <= 6)
|
||||
||(3 <= $this->destToSrcDiplomacy['state'] && $this->destToSrcDiplomacy['state'] <= 6)){
|
||||
return [DiplomaticMessage::DECLINED, '상대국과 합병 중입니다.'];
|
||||
}
|
||||
|
||||
return $prev;
|
||||
}
|
||||
|
||||
protected function checkSrcNationHasNeutralDiplomacy(array $prev = [DiplomaticMessage::ACCEPTED, '']){
|
||||
if($prev[0] !== DiplomaticMessage::ACCEPTED){
|
||||
return $prev;
|
||||
}
|
||||
|
||||
$db = \sammo\DB::db();
|
||||
|
||||
$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']
|
||||
);
|
||||
|
||||
foreach($states as $state){
|
||||
if($state == 0 || $state == 1){
|
||||
return [DiplomaticMessage::DECLINED, '상대국이 전쟁 중입니다.'];
|
||||
}
|
||||
if(3 <= $state && $state <= 6){
|
||||
return [DiplomaticMessage::DECLINED, '상대국이 합병 중입니다.'];
|
||||
}
|
||||
}
|
||||
|
||||
return $prev;
|
||||
}
|
||||
|
||||
protected function checkContradictoryDiplomacy(array $prev = [DiplomaticMessage::ACCEPTED, '']){
|
||||
if($prev[0] !== DiplomaticMessage::ACCEPTED){
|
||||
return $prev;
|
||||
}
|
||||
|
||||
$db = \sammo\DB::db();
|
||||
|
||||
$cnt = $db->queryFirstField(
|
||||
'SELECT count(dest.you) FROM diplomacy src
|
||||
JOIN diplomacy dest ON src.you = dest.you AND src.me != dest.me
|
||||
WHERE src.state = 7 AND dest.state IN (0, 1) AND src.me = %i AND dest.me = %i',
|
||||
$this->srcNation['nation'],
|
||||
$this->destNation['nation']
|
||||
);
|
||||
|
||||
if($cnt > 0){
|
||||
return [DiplomaticMessage::DECLINED, '상대국이 본국의 교전국과 불가침중입니다.'];
|
||||
}
|
||||
|
||||
return $prev;
|
||||
}
|
||||
|
||||
protected function checkMorePower(array $prev = [DiplomaticMessage::ACCEPTED, '']){
|
||||
if($prev[0] !== DiplomaticMessage::ACCEPTED){
|
||||
return $prev;
|
||||
}
|
||||
|
||||
if($this->srcNation['power'] < $this->destNation['power'] * 3){
|
||||
return [DiplomaticMessage::DECLINED, '상대국과 국력차가 크지 않습니다.'];
|
||||
}
|
||||
|
||||
return $prev;
|
||||
}
|
||||
|
||||
protected function checkMergePower(array $prev = [DiplomaticMessage::ACCEPTED, '']){
|
||||
if($prev[0] !== DiplomaticMessage::ACCEPTED){
|
||||
return $prev;
|
||||
}
|
||||
|
||||
$db = DB::db();
|
||||
list(
|
||||
$powerAvg,
|
||||
$powerStddev,
|
||||
$genAvg,
|
||||
$genStddev
|
||||
) = $db->queryFirstList(
|
||||
'SELECT avg(`power`), std(`power`), avg(`gennum`), std(`gennum`) FROM nation WHERE `level` >= 1'
|
||||
);
|
||||
|
||||
$mergedPower = ($this->srcNation['power'] + $this->destNation['power'])/2;
|
||||
$ZPower = ($mergedPower - $powerAvg) / $powerStddev;
|
||||
if($ZPower >= -0.25){
|
||||
return [DiplomaticMessage::DECLINED, '두 국가의 국력 평균이 상위 60% 보다 높습니다.'];
|
||||
}
|
||||
|
||||
$mergedGeneral = ($this->srcNation['gennum'] + $this->destNation['gennum'])/2;
|
||||
$ZGeneral = ($mergedGeneral - $genAvg) / $genStddev;
|
||||
if($ZGeneral >= -0.67){
|
||||
return [DiplomaticMessage::DECLINED, '두 국가의 장수수 평균이 상위 75% 보다 높습니다.'];
|
||||
}
|
||||
|
||||
return $prev;
|
||||
}
|
||||
|
||||
public function noAggression(int $when, string $option){
|
||||
$chk = $this->checkValidNation();
|
||||
$chk = $this->checkNotWar($chk);
|
||||
$chk = $this->checkAlreadyMerging($chk);
|
||||
|
||||
list($result, $reason) = $chk;
|
||||
if($result !== DiplomaticMessage::ACCEPTED){
|
||||
return $chk;
|
||||
}
|
||||
|
||||
$db = DB::db();
|
||||
$db->update('diplomacy',[
|
||||
'state'=>7,
|
||||
'term'=>$when,
|
||||
'fixed'=>$option
|
||||
],
|
||||
'(me=%i AND you=%i) OR (you=%i AND me=%i)',
|
||||
$this->srcNation['nation'], $this->destNation['nation'],
|
||||
$this->srcNation['nation'], $this->destNation['nation']);
|
||||
|
||||
return $chk;
|
||||
}
|
||||
|
||||
public function cancelNA(){
|
||||
$chk = $this->checkValidNation();
|
||||
$chk = $this->checkNonAggressionTreaty($chk);
|
||||
|
||||
list($result, $reason) = $chk;
|
||||
if($result !== DiplomaticMessage::ACCEPTED){
|
||||
return $chk;
|
||||
}
|
||||
|
||||
$db = DB::db();
|
||||
$db->update('diplomacy',[
|
||||
'state'=>2,
|
||||
'term'=>0,
|
||||
'fixed'=>''
|
||||
],
|
||||
'(me=%i AND you=%i) OR (you=%i AND me=%i)',
|
||||
$this->srcNation['nation'], $this->destNation['nation'],
|
||||
$this->srcNation['nation'], $this->destNation['nation']);
|
||||
|
||||
return $chk;
|
||||
}
|
||||
|
||||
public function stopWar(){
|
||||
$chk = $this->checkValidNation();
|
||||
$chk = $this->checkInWar($chk);
|
||||
|
||||
list($result, $reason) = $chk;
|
||||
if($result !== DiplomaticMessage::ACCEPTED){
|
||||
return $chk;
|
||||
}
|
||||
|
||||
$db = DB::db();
|
||||
$db->update('diplomacy',[
|
||||
'state'=>2,
|
||||
'term'=>0,
|
||||
'fixed'=>''
|
||||
],
|
||||
'(me=%i AND you=%i) OR (you=%i AND me=%i)',
|
||||
$this->srcNation['nation'], $this->destNation['nation'],
|
||||
$this->srcNation['nation'], $this->destNation['nation']);
|
||||
|
||||
return $chk;
|
||||
}
|
||||
|
||||
public function acceptMerge(int $srcGeneral, int $destGeneral){
|
||||
$chk = $this->checkValidNation();
|
||||
$chk = $this->checkDiplomacyLimit($chk);
|
||||
$chk = $this->checkContradictoryDiplomacy($chk);
|
||||
$chk = $this->checkSrcNationHasNeutralDiplomacy($chk);
|
||||
$chk = $this->checkStrictlyAdjacent($chk);
|
||||
$chk = $this->checkMergePower($chk);
|
||||
|
||||
list($result, $reason) = $chk;
|
||||
if($result !== DiplomaticMessage::ACCEPTED){
|
||||
return $chk;
|
||||
}
|
||||
|
||||
$db = DB::db();
|
||||
$db->update('diplomacy',[
|
||||
'state'=>4,
|
||||
'term'=>24,
|
||||
'fixed'=>''
|
||||
],
|
||||
'me=%i AND you=%i',
|
||||
$this->srcNation['nation'], $this->destNation['nation']);
|
||||
|
||||
$db->update('diplomacy',[
|
||||
'state'=>3,
|
||||
'term'=>24,
|
||||
'fixed'=>''
|
||||
],
|
||||
'you=%i AND me=%i',
|
||||
$this->srcNation['nation'], $this->destNation['nation']);
|
||||
|
||||
return $chk;
|
||||
}
|
||||
|
||||
public function acceptSurrender(int $srcGeneral, int $destGeneral){
|
||||
$chk = $this->checkValidNation();
|
||||
$chk = $this->checkDiplomacyLimit($chk);
|
||||
$chk = $this->checkContradictoryDiplomacy($chk);
|
||||
$chk = $this->checkSrcNationHasNeutralDiplomacy($chk);
|
||||
$chk = $this->checkStrictlyAdjacent($chk);
|
||||
$chk = $this->checkMorePower($chk);
|
||||
|
||||
list($result, $reason) = $chk;
|
||||
if($result !== DiplomaticMessage::ACCEPTED){
|
||||
return $chk;
|
||||
}
|
||||
|
||||
$db = DB::db();
|
||||
$db->update('diplomacy',[
|
||||
'state'=>6,
|
||||
'term'=>24,
|
||||
'fixed'=>''
|
||||
],
|
||||
'me=%i AND you=%i',
|
||||
$this->srcNation['nation'], $this->destNation['nation']);
|
||||
|
||||
$db->update('diplomacy',[
|
||||
'state'=>5,
|
||||
'term'=>24,
|
||||
'fixed'=>''
|
||||
],
|
||||
'you=%i AND me=%i',
|
||||
$this->srcNation['nation'], $this->destNation['nation']);
|
||||
|
||||
return $chk;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,205 @@
|
||||
<?php
|
||||
namespace sammo\Engine;
|
||||
|
||||
use \sammo\DB;
|
||||
use \sammo\ScoutMessage;
|
||||
|
||||
/**
|
||||
* 인사(등용, 추방, 임명, 망명) 헬퍼 클래스?
|
||||
* Nation 클래스가 있고 그걸 상속한 구조가 더 나을지도?
|
||||
*/
|
||||
class Personnel{
|
||||
|
||||
protected $nation = null;//TODO: 상속체로 변경.
|
||||
public $valid = false;
|
||||
|
||||
public $startYear = 0;
|
||||
public $year = 0;
|
||||
public $month = 0;
|
||||
public $killturn = 0;
|
||||
|
||||
public function __construct(int $nationID){
|
||||
$db = DB::db();
|
||||
$nation = $db->queryFirstRow(
|
||||
'SELECT nation, `name`, `level`, capital, scout FROM nation WHERE nation=%i',
|
||||
$nationID
|
||||
);
|
||||
|
||||
if(!$nation){
|
||||
return;
|
||||
}
|
||||
|
||||
$this->nation = $nation;
|
||||
$this->valid = true;
|
||||
|
||||
list(
|
||||
$this->startYear,
|
||||
$this->year,
|
||||
$this->month,
|
||||
$this->killturn
|
||||
) = $db->queryFirstList('SELECT startyear, year, month, killturn FROM game LIMIT 1');
|
||||
|
||||
}
|
||||
|
||||
public function checkAgreeValidation(array $general){
|
||||
|
||||
if(!$this->valid){
|
||||
return [ScoutMessage::DECLINED, '이미 멸망한 국가입니다.'];
|
||||
}
|
||||
|
||||
if($this->year < $this->startYear + 3){
|
||||
return [ScoutMessage::INVALID, '초반제한 중입니다.'];
|
||||
}
|
||||
|
||||
if(!$this->nation['scout']){
|
||||
return [ScoutMessage::INVALID, '현재 임관금지 중인 국가입니다.'];
|
||||
}
|
||||
|
||||
if($this->nation['level'] == 0){
|
||||
return [ScoutMessage::DECLINED, '방랑군에는 임관할 수 없습니다.'];
|
||||
}
|
||||
|
||||
if($this->nation['nation'] == $general['nation']){
|
||||
return [ScoutMessage::DECLINED, '이미 같은 국가입니다.'];
|
||||
}
|
||||
|
||||
if($general['level'] == 12){
|
||||
return [ScoutMessage::DECLINED, '군주는 등용장을 수락할 수 없습니다.'];
|
||||
}
|
||||
|
||||
if(strpos($general['nations'], ",{$this->nation['nation']},") >= 0){
|
||||
return [ScoutMessage::DECLINED, '이미 임관했었던 국가입니다.'];
|
||||
}
|
||||
|
||||
return [ScoutMessage::ACCEPTED, ''];
|
||||
}
|
||||
|
||||
public function scoutGeneral(int $generalID){
|
||||
$db = DB::db();
|
||||
|
||||
$general = $db->queryFirstRow(
|
||||
'SELECT `no`, `name`, nation, nations, city, `level`, troop, npc, gold, rice FROM general WHERE `no`=%i',
|
||||
$generalID
|
||||
);
|
||||
|
||||
list($result, $reason) = $this->checkAgreeValidation($general);
|
||||
if($result !== ScoutMessage::ACCEPTED){
|
||||
return [$result, $reason];
|
||||
}
|
||||
|
||||
$scoutNationGeneralCnt = $db->queryFirstField(
|
||||
'SELECT COUNT(`no`) FROM general WHERE nation = %i',
|
||||
$this->nation['nation']
|
||||
);
|
||||
|
||||
$originalNationGeneralCnt = $db->queryFirstField(
|
||||
'SELECT COUNT(`no`) FROM general WHERE nation = %i',
|
||||
$general['nation']
|
||||
);
|
||||
|
||||
$isTroopLeader = false;
|
||||
if($general['troop']){
|
||||
$troopLeader = $db->queryFirstField('SELECT `no` FROM troop WHERE troop = %i', $general['troop']);
|
||||
if($troopLeader == $receiverID){
|
||||
$isTroopLeader = true;
|
||||
}
|
||||
}
|
||||
|
||||
$scoutNationGeneralCnt+=1;
|
||||
if($scoutNationGeneralCnt < 10){
|
||||
$scoutNationGeneralCnt = 10;//XXX: 상수!
|
||||
}
|
||||
|
||||
$originalNationGeneralCnt-=1;
|
||||
if($originalNationGeneralCnt < 10){
|
||||
$originalNationGeneralCnt = 10;//XXX: 상수!
|
||||
}
|
||||
|
||||
// 국가 변경, 도시 변경, 일반으로, 수도로
|
||||
$setValues = [
|
||||
'belong'=>1,
|
||||
'level'=>1,
|
||||
'nation'=>$this->nation['nation'],
|
||||
'city'=>$this->nation['capital'],
|
||||
'nations'=>$db->sqleval('CONCAT(nations, %s)', "{$this->nation['nation']},"),
|
||||
'troop'=>0,
|
||||
];
|
||||
|
||||
$setSenderValues = [
|
||||
'experience'=>$db->sqleval('experience + %i', 100),//XXX: 상수.
|
||||
'dedication'=>$db->sqleval('dedication + %i', 100)
|
||||
];
|
||||
|
||||
$setOriginalNationValues = [
|
||||
'totaltech'=>$db->sqleval('tech * %i', $originalNationGeneralCnt),
|
||||
'gennum'=>$originalNationGeneralCnt
|
||||
];
|
||||
|
||||
$setScoutNationValues = [
|
||||
'totaltech'=>$db->sqleval('tech * %i', $scoutNationGeneralCnt),
|
||||
'gennum'=>$scoutNationGeneralCnt
|
||||
];
|
||||
|
||||
$setOriginalCityValues = [];
|
||||
|
||||
// 재야가 아니면 명성N*10% 공헌N*10%감소
|
||||
if($general['nation'] != 0){
|
||||
// 1000 1000 남기고 환수
|
||||
if($general['gold'] > 1000){//XXX: 상수.
|
||||
$setValues['gold'] = 1000;
|
||||
$setOriginalNationValues['gold'] = $db->sqleval('gold + %i', $general['gold'] - 1000);
|
||||
}
|
||||
|
||||
if($general['rice'] > 1000){//XXX: 상수.
|
||||
$setValues['rice'] = 1000;
|
||||
$setOriginalNationValues['rice'] = $db->sqleval('rice + %i', $general['rice'] - 1000);
|
||||
}
|
||||
|
||||
//관직 해제
|
||||
if(5 <= $general['level'] && $general['level'] <= 11){
|
||||
$setOriginalNationValues["l{$general['level']}set"] = 0;
|
||||
}
|
||||
else if($general['level'] == 4){
|
||||
$setOriginalCityValues['gen1'] = 0;
|
||||
}
|
||||
else if($general['level'] == 3){
|
||||
$setOriginalCityValues['gen2'] = 0;
|
||||
}
|
||||
else if($general['level'] == 2){
|
||||
$setOriginalCityValues['gen3'] = 0;
|
||||
}
|
||||
|
||||
$setValues['betray'] = $db->sqleval('betray + 1');
|
||||
$setValues['experience'] = $db->sqleval('experience * (1 - 0.1 * betray)');//XXX: 상수
|
||||
$setValues['dedication'] = $db->sqleval('dedication * (1 - 0.1 * betray)');//XXX: 상수
|
||||
}
|
||||
else{
|
||||
//재야이면 100 100 증가
|
||||
$setValues['experience'] = $db->sqleval('experience + %i', 100);//XXX: 상수
|
||||
$setValues['dedication'] = $db->sqleval('experience + %i', 100);//XXX: 상수
|
||||
}
|
||||
|
||||
if($me['npc'] < 2){
|
||||
$setValues['killturn'] = $killturn;
|
||||
}
|
||||
|
||||
$db->update('general', $setValues, 'no=%i', $receiverID);
|
||||
$db->update('general', $setSenderValues, 'no=%i', $this->src->generalID);
|
||||
$db->update('nation', $setOriginalNationValues, 'nation=%i', $general['nation']);
|
||||
$db->update('nation', $setScoutNationValues, 'nation=%i', $this->nation['nation']);
|
||||
if($setOriginalCityValues){
|
||||
$db->update('city', $setOriginalCityValues, 'city=%i', $general['city']);
|
||||
}
|
||||
|
||||
if($isTroopLeader){
|
||||
// 모두 탈퇴
|
||||
$db->update('general', [
|
||||
'troop'=>0,
|
||||
], 'troop=%i', $general['troop']);
|
||||
// 부대 삭제
|
||||
$db->delete('troop', 'troop=%i', $general['troop']);
|
||||
}
|
||||
|
||||
return [ScoutMessage::ACCEPTED, ''];
|
||||
}
|
||||
}
|
||||
+27
-25
@@ -15,34 +15,36 @@ class GameConst
|
||||
public static $upgradeLimit = 30;
|
||||
/** @var int 숙련도 제한치*/
|
||||
public static $dexLimit = 1000000;
|
||||
/** @var int 초기 사기치*/
|
||||
public static $defaultatmos = 40;
|
||||
/** @var int 초기 훈련치*/
|
||||
public static $defaulttrain = 40;
|
||||
/** @var int 초기 사기치*/
|
||||
public static $defaultatmos2 = 70;
|
||||
/** @var int 초기 훈련치*/
|
||||
public static $defaulttrain2 = 70;
|
||||
/** @var int 최대 훈련치*/
|
||||
public static $maxtrain = 100;
|
||||
/** @var int 인위적으로 올릴 수 있는 최대 사기치*/
|
||||
public static $maxatmos = 100;
|
||||
/** @var int 최대 사기치*/
|
||||
public static $maximumatmos = 150;
|
||||
/** @var int 최대 훈련치*/
|
||||
public static $maximumtrain = 110;
|
||||
/** @var int 초기 징병 사기치*/
|
||||
public static $defaultAtmosLow = 40;
|
||||
/** @var int 초기 징병 훈련치*/
|
||||
public static $defaultTrainLow = 40;
|
||||
/** @var int 초기 모병 사기치*/
|
||||
public static $defaultAtmosHigh = 70;
|
||||
/** @var int 초기 모병 훈련치*/
|
||||
public static $defaultTrainHigh = 70;
|
||||
/** @var int 사기진작으로 올릴 수 있는 최대 사기치*/
|
||||
public static $maxAtmosByCommand = 100;
|
||||
/** @var int 훈련으로 올릴 수 있는 최대 사기치*/
|
||||
public static $maxTrainByCommand = 100;
|
||||
/** @var int 전투로 올릴 수 있는 최대 사기치*/
|
||||
public static $maxAtmosByWar = 150;
|
||||
/** @var int 전투로 올릴 수 훈련치*/
|
||||
public static $maxTrainByWar = 110;
|
||||
/** @var int 풀징병시 훈련 1회 상승량*/
|
||||
public static $training = 30;
|
||||
public static $trainDelta = 30;
|
||||
/** @var int 풀징병시 훈련 1회 상승량*/
|
||||
public static $atmosDelta = 30;
|
||||
/** @var float 훈련시 사기 감소율*/
|
||||
public static $atmosing = 0.98;
|
||||
public static $atmosSideEffectByTraining = 0.98;
|
||||
/** @var float 계략 기본 성공률*/
|
||||
public static $basefiring = 0.25;
|
||||
/** @var int 계략시 확률 가중치(수치가 클수록 변화가 적음 : (지력차/public static $firing + public static $basefiring)*/
|
||||
public static $firing = 300;
|
||||
public static $sabotageDefaultProb = 0.25;
|
||||
/** @var int 계략시 확률 가중치(수치가 클수록 변화가 적음 : (지력차/$firing + $basefiring)*/
|
||||
public static $sabotageProbCoefByStat = 300;
|
||||
/** @var int 계략시 기본 수치 감소량*/
|
||||
public static $firingbase = 100;
|
||||
/** @var int 계략시 수치 감소량(public static $firingbase ~ public static $firingpower)*/
|
||||
public static $firingpower = 400;
|
||||
public static $sabotageDefaultAmount = 100;
|
||||
/** @var int 계략시 수치 감소량($firingbase ~ $firingpower)*/
|
||||
public static $sabotageAmountCoef = 400;
|
||||
/** @var int 명장,지장에 사용될 통솔 제한*/
|
||||
public static $goodgenleader = 65;
|
||||
/** @var int 명장에 사용될 무력 제한*/
|
||||
@@ -68,7 +70,7 @@ class GameConst
|
||||
/** @var int 최저 병량(긴급시) */
|
||||
public static $minNationalRice = 0;
|
||||
/** @var float 군량 매매시 세율*/
|
||||
public static $taxrate = 0.01;
|
||||
public static $exchangeFee = 0.01;
|
||||
/** @var float 성인 연령 */
|
||||
public static $adultAge = 14;
|
||||
|
||||
|
||||
+82
-29
@@ -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 */
|
||||
@@ -53,7 +53,7 @@ class Message
|
||||
$this->msgOption = $msgOption;
|
||||
}
|
||||
|
||||
public function setSentInfo(int $mailbox, int $messageID) : this
|
||||
public function setSentInfo(int $mailbox, int $messageID) : self
|
||||
{
|
||||
if(!Message::isValidMailBox($mailbox)){
|
||||
throw new \InvalidArgumentException('올바르지 않은 mailbox');
|
||||
@@ -67,7 +67,7 @@ class Message
|
||||
$this->isInboxMail = true;
|
||||
break;
|
||||
}
|
||||
if($mailbox > Message::MAILBOX_NATIONAL){
|
||||
if($mailbox >= Message::MAILBOX_NATIONAL){
|
||||
if($this->msgType === Message::MSGTYPE_DIPLOMACY){
|
||||
$this->isInboxMail = true;
|
||||
break;
|
||||
@@ -104,6 +104,31 @@ class Message
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function toArray():array{
|
||||
if($this->msgType === Message::MSGTYPE_PUBLIC){
|
||||
$src = $this->src->toArray();
|
||||
$dest = [];
|
||||
}
|
||||
else if($this->msgType === Message::MSGTYPE_NATIONAL || $this->msgType === Message::MSGTYPE_DIPLOMACY){
|
||||
$src = $this->src->toArray();
|
||||
$dest = $this->dest->toArray();
|
||||
}
|
||||
else{
|
||||
$src = $this->src->toArray();
|
||||
$dest = $this->dest->toArray();
|
||||
}
|
||||
|
||||
return [
|
||||
'id'=>$this->id,
|
||||
'msgType'=>$this->msgType,
|
||||
'src'=>$src,
|
||||
'dest'=>$dest,
|
||||
'text'=>$this->msg,
|
||||
'option'=>$this->msgOption,
|
||||
'time'=>$this->date->format('Y-m-d H:i:s')
|
||||
];
|
||||
}
|
||||
|
||||
public static function buildFromArray(array $row) : Message
|
||||
{
|
||||
$dbMessage = Json::decode($row['message']);
|
||||
@@ -125,7 +150,7 @@ class Message
|
||||
|
||||
$action = Util::array_get($option['action'], null);
|
||||
if ($msgType === self::MSGTYPE_DIPLOMACY) {
|
||||
$objMessage = new DiplomacticMessage(...$args);
|
||||
$objMessage = new DiplomaticMessage(...$args);
|
||||
} elseif ($action === 'scout') {
|
||||
$objMessage = new ScoutMessage(...$args);
|
||||
} else {
|
||||
@@ -142,9 +167,6 @@ class Message
|
||||
if ($mailbox > self::MAILBOX_PUBLIC) {
|
||||
return false;
|
||||
}
|
||||
if ($mailbox == self::MAILBOX_NATIONAL) {
|
||||
return false;
|
||||
}
|
||||
if ($mailbox <= 0) {
|
||||
return false;
|
||||
}
|
||||
@@ -165,7 +187,8 @@ class Message
|
||||
public static function getMessageByID(int $messageID) : Message
|
||||
{
|
||||
$db = DB::db();
|
||||
$row = $db->queryFirstRow('SELECT * FROM `message` WHERE `id` = %i', $messageID);
|
||||
$now = new \DateTime();
|
||||
$row = $db->queryFirstRow('SELECT * FROM `message` WHERE `id` = %i AND valid_until', $messageID);
|
||||
if (!$row) {
|
||||
return null;
|
||||
}
|
||||
@@ -179,7 +202,7 @@ class Message
|
||||
* @param int $fromSeq 가져오고자 하는 위치. $fromSeq보다 '큰' seq만 가져온다. 따라서 0 이하이면 모두 가져옴.
|
||||
* @return Message[]
|
||||
*/
|
||||
protected static function getMessagesFromMailBox(int $mailbox, string $msgType, int $limit=30, int $fromSeq = 0)
|
||||
public static function getMessagesFromMailBox(int $mailbox, string $msgType, int $limit=30, int $fromSeq = 0)
|
||||
{
|
||||
$db = DB::db();
|
||||
|
||||
@@ -187,9 +210,12 @@ class Message
|
||||
throw new \InvalidArgumentException('올바르지 않은 $msgType');
|
||||
}
|
||||
|
||||
$date = (new \DateTime())->format('Y-m-d H:i:s');
|
||||
|
||||
$where = new \WhereClause('and');
|
||||
$where->add('mailbox = %i', $mailbox);
|
||||
$where->add('type = %s', $msgType);
|
||||
$where->add('valid_until > %s', $date);
|
||||
if ($fromSeq > 0) {
|
||||
$where->add('id > %i', $fromSeq);
|
||||
}
|
||||
@@ -202,10 +228,10 @@ class Message
|
||||
|
||||
return array_map(function ($row) {
|
||||
return static::buildFromArray($row);
|
||||
}, $db->query('SELECT * FROM `message` WHERE %l %?', $where, $limitSql));
|
||||
}, $db->query('SELECT * FROM `message` WHERE %l ORDER BY id DESC %? ', $where, $limitSql));
|
||||
}
|
||||
|
||||
protected function sendRaw(int $mailbox){
|
||||
protected function sendRaw(int $mailbox):array{
|
||||
//NOTE:: 여기선 검증하지 않는다.
|
||||
|
||||
|
||||
@@ -213,7 +239,7 @@ class Message
|
||||
$src_id = $this->src->generalID;
|
||||
$dest_id = self::MAILBOX_PUBLIC;
|
||||
}
|
||||
else if($mailbox > self::MAILBOX_NATIONAL){
|
||||
else if($mailbox >= self::MAILBOX_NATIONAL){
|
||||
$src_id = $this->src->nationID + self::MAILBOX_NATIONAL;
|
||||
$dest_id = $this->dest->nationID + self::MAILBOX_NATIONAL;
|
||||
}
|
||||
@@ -225,15 +251,15 @@ class Message
|
||||
|
||||
$db = DB::db();
|
||||
$db->insert('message', [
|
||||
'address' => $mailbox,
|
||||
'mailbox' => $mailbox,
|
||||
'type' => $this->msgType,
|
||||
'src' => $src_id,
|
||||
'dest' => $dest_id,
|
||||
'time' => $this->date->format('Y-m-d H:i:s'),
|
||||
'valid_until' => $this->validUntil->format('Y-m-d H:i:s'),
|
||||
'message' => Json::encode([
|
||||
'src' => $this->src->toArray(),
|
||||
'dest' =>$this->dest->toArray(),
|
||||
'src'=>($this->src)?($this->src->toArray()):[],
|
||||
'dest'=>($this->dest)?($this->dest->toArray()):[],
|
||||
'text' => $this->msg,
|
||||
'option' => $this->msgOption
|
||||
])
|
||||
@@ -241,11 +267,11 @@ class Message
|
||||
return [$mailbox, $db->insertId()];
|
||||
}
|
||||
|
||||
protected function sendToSender() : int{
|
||||
private function sendToSender():array{
|
||||
if($this->sendCnt > 0){
|
||||
throw new \RuntimeException('이미 전송한 메일입니다.');
|
||||
}
|
||||
if($this->msgType === self::MSGTYPE_PRIVATE){
|
||||
if($this->msgType === self::MSGTYPE_PRIVATE && $this->src->generalID !== $this->dest->generalID){
|
||||
return $this->sendRaw($this->src->generalID);
|
||||
}
|
||||
if($this->msgType === self::MSGTYPE_NATIONAL && $this->src->nationID !== $this->dest->nationID){
|
||||
@@ -254,12 +280,16 @@ class Message
|
||||
return [0, 0];
|
||||
}
|
||||
|
||||
protected function sendToReceiver() : int{
|
||||
private function sendToReceiver() : array{
|
||||
if($this->sendCnt > 1 || $this->isInboxMail){
|
||||
throw new \RuntimeException('이미 전송한 메일입니다.');
|
||||
}
|
||||
|
||||
if($this->msgType === self::MSGTYPE_PRIVATE){
|
||||
//XXX: 알림을 이런식으로 보내는게 맞는가에 대한 의문 있음
|
||||
DB::db()->update('general', [
|
||||
'newmsg'=>1
|
||||
], 'no=%i',$this->dest->generalID);
|
||||
return $this->sendRaw($this->dest->generalID);
|
||||
}
|
||||
|
||||
@@ -274,25 +304,48 @@ class Message
|
||||
throw new \RuntimeException('이곳에 올 수 없습니다.');
|
||||
}
|
||||
|
||||
public function send():int{
|
||||
list($senderMailbox, $sendID) = $this->sendToSender();
|
||||
if($sendID){
|
||||
$this->mailbox = $senderMailbox;
|
||||
$this->isInboxMail = false;
|
||||
$this->id = $sendID;
|
||||
$this->msgOption['senderMessageID'] = $sendID;
|
||||
$this->$sendCnt = 1;
|
||||
public function send(bool $sendDestOnly=false):int{
|
||||
if(!$sendDestOnly){
|
||||
list($senderMailbox, $sendID) = $this->sendToSender();
|
||||
if($sendID){
|
||||
$this->mailbox = $senderMailbox;
|
||||
$this->isInboxMail = false;
|
||||
$this->id = $sendID;
|
||||
$this->msgOption['senderMessageID'] = $sendID;
|
||||
$this->sendCnt = 1;
|
||||
}
|
||||
}
|
||||
|
||||
list($receiverMailbox, $receiveID) = $this->sendToReceiver();
|
||||
if(!$receiveID){
|
||||
if(!$receiveID && !$sendDestOnly){
|
||||
return $sendID;
|
||||
}
|
||||
$this->mailbox = $receiverMailbox;
|
||||
$this->isInboxMail = true;
|
||||
$this->id = $receiveID;
|
||||
$this->msgOption['receiverMessageID'] = $receiveID;
|
||||
$this->$sendCnt = 2;
|
||||
$this->sendCnt = 2;
|
||||
|
||||
return $receiveID;
|
||||
}
|
||||
|
||||
public function invalidate(array $newMsgOption=null){
|
||||
if($newMsgOption !== null){
|
||||
$this->msgOption = $newMsgOption;
|
||||
}
|
||||
|
||||
$this->validUntil = new \DateTime('2000-12-31');
|
||||
|
||||
$db = DB::db();
|
||||
$db->update('message', [
|
||||
'message' => Json::encode([
|
||||
'src' => $this->src->toArray(),
|
||||
'dest' =>$this->dest->toArray(),
|
||||
'text' => $this->msg,
|
||||
'option' => $this->msgOption
|
||||
]),
|
||||
'valid_until'=>$this->validUntil->format('Y-m-d H:i:s'),
|
||||
], 'id=%i', $this->id);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
+72
-19
@@ -1,50 +1,103 @@
|
||||
<?php
|
||||
namespace sammo;
|
||||
|
||||
class MessageTarget {
|
||||
/** @var int */
|
||||
public $generalID;
|
||||
/** @var int */
|
||||
public $nationID;
|
||||
|
||||
class MessageTarget extends Target {
|
||||
/** @var string */
|
||||
public $generalName;
|
||||
/** @var string */
|
||||
public $nationName;
|
||||
/** @var string */
|
||||
public $color;
|
||||
/** @var string */
|
||||
public $icon;
|
||||
|
||||
public function __construct(int $generalID, int $nationID, string $nationName, string $color){
|
||||
public function __construct(
|
||||
int $generalID,
|
||||
string $generalName,
|
||||
int $nationID,
|
||||
string $nationName,
|
||||
string $color,
|
||||
string $icon=''
|
||||
){
|
||||
|
||||
parent::__construct($generalID, $nationID);
|
||||
|
||||
if($mailbox > Message::MAILBOX_NATIONAL){
|
||||
$this->isGeneral = false;
|
||||
}
|
||||
else{
|
||||
$this->isGeneral = true;
|
||||
if(!$icon){
|
||||
$icon = ServConfig::getSharedIconPath().'/default.jpg';
|
||||
}
|
||||
|
||||
$this->generalID = $generalID;
|
||||
$this->nationID = $nationID;
|
||||
$this->generalName = $generalName;
|
||||
$this->nationName = $nationName;
|
||||
$this->color = $color;
|
||||
$this->icon = $icon;
|
||||
}
|
||||
|
||||
public static function buildFromArray(array $arr) : MessageTarget
|
||||
/**
|
||||
* @return MessageTarget
|
||||
*/
|
||||
public static function buildFromArray($arr)
|
||||
{
|
||||
if(!Util::array_get($arr['nation'])){
|
||||
if(!$arr){
|
||||
return null;
|
||||
}
|
||||
if(!Util::array_get($arr['nation_id'])){
|
||||
$arr['nation'] = '재야';
|
||||
$arr['color'] = '#ffffff';
|
||||
$arr['color'] = '#000000';
|
||||
$arr['nation_id'] = 0;
|
||||
}
|
||||
|
||||
return new MessageTarget($arr['id'], $arr['nation_id'], $arr['nation'], $arr['color']);
|
||||
return new MessageTarget(
|
||||
$arr['id'],
|
||||
$arr['name'],
|
||||
$arr['nation_id'],
|
||||
$arr['nation'],
|
||||
$arr['color'],
|
||||
$arr['icon']??''
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* DB 부하 감수하고 일일히 찾아줌.
|
||||
* 게임 로직과 크게 연관이 없는 곳에서 메시지를 생성해야 할 경우에만 사용할 것을 권함.
|
||||
* @return MessageTarget
|
||||
*/
|
||||
public static function buildQuick(int $generalID){
|
||||
$db = DB::db();
|
||||
list(
|
||||
$generalName,
|
||||
$nationID,
|
||||
$imgsvr,
|
||||
$picture
|
||||
) = $db->queryFirstList('SELECT `name`, nation, imgsvr, picture FROM general WHERE `no`=%i', $generalID);
|
||||
|
||||
if($generalName === null){
|
||||
return null;
|
||||
}
|
||||
|
||||
$icon = GetImageURL($imgsvr, $picture);
|
||||
$nation = getNationStaticInfo($nationID);
|
||||
return new MessageTarget($generalID, $generalName, $nationID, $nation['name'], $nation['color'], $icon);
|
||||
}
|
||||
|
||||
public function toArray() : array{
|
||||
return [
|
||||
'id'=>$this->generalID,
|
||||
'name'=>$this->generalName,
|
||||
'nation_id'=>$this->nationID,
|
||||
'nation'=>$this->nationName,
|
||||
'color'=>$this->color
|
||||
'color'=>$this->color,
|
||||
'icon'=>$this->icon
|
||||
];
|
||||
}
|
||||
|
||||
public function toArrayLight() : array{
|
||||
//TODO: 이걸 꼭 연관 배열로 보낼 이유가 없다.
|
||||
//TODO: 아이콘도 축약 가능하다.
|
||||
return [
|
||||
'name'=>$this->generalName,
|
||||
'nation'=>$this->nationName,
|
||||
'color'=>$this->color,
|
||||
'icon'=>$this->icon
|
||||
];
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user