Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e858ad0c33 | ||
|
|
fb1acfa09c | ||
|
|
033466edcc | ||
|
|
3a472506cf | ||
|
|
cea015bd4d | ||
|
|
8aaf161fd0 | ||
|
|
1529ab6469 | ||
|
|
1a3b456f39 | ||
|
|
ac3672a87e | ||
|
|
a866cb63a4 | ||
|
|
943251c56f | ||
|
|
4d2b10b979 | ||
|
|
c87614ab2d | ||
|
|
67dee551b6 | ||
|
|
2ee20ce92c | ||
|
|
cd8ec0687f | ||
|
|
6881b531d7 | ||
|
|
2eae9b2062 | ||
|
|
b055baa7d3 | ||
|
|
fc0ad32335 | ||
|
|
42cd2fafdd | ||
|
|
6220d030dc | ||
|
|
8961dd60a2 | ||
|
|
2726bc13c4 | ||
|
|
967c14a972 | ||
|
|
74d86b7897 | ||
|
|
5a176568e9 | ||
|
|
279478c15b | ||
|
|
f5f7c81c20 | ||
|
|
3c2499580c | ||
|
|
45a104f9c0 | ||
|
|
a5b0c7f99f | ||
|
|
643a2822a0 | ||
|
|
be8e22309f | ||
|
|
8273c3f231 | ||
|
|
e9ceb0bdd6 | ||
|
|
c204f36aa7 | ||
|
|
869ee4b233 | ||
|
|
f0c6243964 | ||
|
|
b46a197a5c | ||
|
|
d39c04da76 | ||
|
|
22f1f3c227 | ||
|
|
2b3efd0924 | ||
|
|
3004b20c87 | ||
|
|
5c8194b36d | ||
|
|
e487846c56 | ||
|
|
0437d45997 | ||
|
|
8dd5154de3 | ||
|
|
bc519284fb | ||
|
|
19e06cc12e | ||
|
|
16e5601651 | ||
|
|
8f9077dff8 | ||
|
|
9831685bb9 | ||
|
|
1412834b60 | ||
|
|
b8636763c1 | ||
|
|
fe4823bb8d | ||
|
|
7ef9a2fdca | ||
|
|
9f627ca2f8 | ||
|
|
2404ab2047 | ||
|
|
50d1c4cd34 | ||
|
|
269a40ca9d | ||
|
|
2a814dbbf9 |
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name":"sammo-hid/sammo",
|
||||
"description":"삼국지 모의전투 HiD",
|
||||
"description":"삼국지 모의전투 HiDCHe",
|
||||
"license": [
|
||||
"MIT",
|
||||
"GPL-2.0-or-later",
|
||||
|
||||
@@ -0,0 +1,152 @@
|
||||
/*
|
||||
jQuery Redirect v1.1.1
|
||||
|
||||
Copyright (c) 2013-2017 Miguel Galante
|
||||
Copyright (c) 2011-2013 Nemanja Avramovic, www.avramovic.info
|
||||
|
||||
Licensed under CC BY-SA 4.0 License: http://creativecommons.org/licenses/by-sa/4.0/
|
||||
|
||||
This means everyone is allowed to:
|
||||
|
||||
Share - copy and redistribute the material in any medium or format
|
||||
Adapt - remix, transform, and build upon the material for any purpose, even commercially.
|
||||
Under following conditions:
|
||||
|
||||
Attribution - You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
|
||||
ShareAlike - If you remix, transform, or build upon the material, you must distribute your contributions under the same license as the original.
|
||||
|
||||
*/
|
||||
(function ($) {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* jQuery Redirect
|
||||
* @param {string} url - Url of the redirection
|
||||
* @param {Object} values - (optional) An object with the data to send. If not present will look for values as QueryString in the target url.
|
||||
* @param {string} method - (optional) The HTTP verb can be GET or POST (defaults to POST)
|
||||
* @param {string} target - (optional) The target of the form. "_blank" will open the url in a new window.
|
||||
* @param {boolean} traditional - (optional) This provides the same function as jquery's ajax function. The brackets are omitted on the field name if its an array. This allows arrays to work with MVC.net among others.
|
||||
* @param {boolean} redirectTop - (optional) If its called from a iframe, force to navigate the top window.
|
||||
*/
|
||||
$.redirect = function (url, values, method, target, traditional, redirectTop) {
|
||||
redirectTop = redirectTop || false;
|
||||
var generatedForm = $.redirect.getForm(url, values, method, target, traditional);
|
||||
$('body', redirectTop ? window.top.document : undefined).append(generatedForm.form);
|
||||
generatedForm.submit();
|
||||
};
|
||||
|
||||
|
||||
$.redirect.getForm = function (url, values, method, target, traditional) {
|
||||
method = (method && ["GET", "POST", "PUT", "DELETE"].indexOf(method.toUpperCase()) !== -1) ? method.toUpperCase() : 'POST';
|
||||
|
||||
url = url.split("#");
|
||||
var hash = url[1] ? ("#" + url[1]) : "";
|
||||
url = url[0];
|
||||
|
||||
if (!values) {
|
||||
var obj = $.parseUrl(url);
|
||||
url = obj.url;
|
||||
values = obj.params;
|
||||
}
|
||||
|
||||
values = removeNulls(values);
|
||||
|
||||
var form = $('<form>')
|
||||
.attr("method", method)
|
||||
.attr("action", url + hash);
|
||||
|
||||
|
||||
if (target) {
|
||||
form.attr("target", target);
|
||||
}
|
||||
|
||||
var submit = form[0].submit;
|
||||
iterateValues(values, [], form, null, traditional);
|
||||
|
||||
return { form: form, submit: function () { submit.call(form[0]); } };
|
||||
}
|
||||
//Utility Functions
|
||||
/**
|
||||
* Url and QueryString Parser.
|
||||
* @param {string} url - a Url to parse.
|
||||
* @returns {object} an object with the parsed url with the following structure {url: URL, params:{ KEY: VALUE }}
|
||||
*/
|
||||
$.parseUrl = function (url) {
|
||||
|
||||
if (url.indexOf('?') === -1) {
|
||||
return {
|
||||
url: url,
|
||||
params: {}
|
||||
};
|
||||
}
|
||||
var parts = url.split('?'),
|
||||
query_string = parts[1],
|
||||
elems = query_string.split('&');
|
||||
url = parts[0];
|
||||
|
||||
var i, pair, obj = {};
|
||||
for (i = 0; i < elems.length; i += 1) {
|
||||
pair = elems[i].split('=');
|
||||
obj[pair[0]] = pair[1];
|
||||
}
|
||||
|
||||
return {
|
||||
url: url,
|
||||
params: obj
|
||||
};
|
||||
};
|
||||
|
||||
//Private Functions
|
||||
var getInput = function (name, value, parent, array, traditional) {
|
||||
var parentString;
|
||||
if (parent.length > 0) {
|
||||
parentString = parent[0];
|
||||
var i;
|
||||
for (i = 1; i < parent.length; i += 1) {
|
||||
parentString += "[" + parent[i] + "]";
|
||||
}
|
||||
|
||||
if (array) {
|
||||
if (traditional)
|
||||
name = parentString;
|
||||
else
|
||||
name = parentString + "[" + name + "]";
|
||||
} else {
|
||||
name = parentString + "[" + name + "]";
|
||||
}
|
||||
}
|
||||
|
||||
return $("<input>").attr("type", "hidden")
|
||||
.attr("name", name)
|
||||
.attr("value", value);
|
||||
};
|
||||
|
||||
var iterateValues = function (values, parent, form, isArray, traditional) {
|
||||
var i, iterateParent = [];
|
||||
Object.keys(values).forEach(function (i) {
|
||||
if (typeof values[i] === "object") {
|
||||
iterateParent = parent.slice();
|
||||
iterateParent.push(i);
|
||||
iterateValues(values[i], iterateParent, form, Array.isArray(values[i]), traditional);
|
||||
} else {
|
||||
form.append(getInput(i, values[i], parent, isArray, traditional));
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
var removeNulls = function (values) {
|
||||
var propNames = Object.getOwnPropertyNames(values);
|
||||
for (var i = 0; i < propNames.length; i++) {
|
||||
var propName = propNames[i];
|
||||
if (values[propName] === null || values[propName] === undefined) {
|
||||
delete values[propName];
|
||||
} else if (typeof values[propName] === 'object') {
|
||||
values[propName] = removeNulls(values[propName]);
|
||||
} else if (values[propName].length < 1) {
|
||||
delete values[propName];
|
||||
}
|
||||
}
|
||||
return values;
|
||||
};
|
||||
|
||||
}(window.jQuery || window.Zepto || window.jqlite));
|
||||
+64
-4
@@ -7,6 +7,44 @@ mb_internal_encoding("UTF-8");
|
||||
mb_http_output('UTF-8');
|
||||
mb_regex_encoding('UTF-8');
|
||||
|
||||
function getFriendlyErrorType($type)
|
||||
{
|
||||
switch($type)
|
||||
{
|
||||
case E_ERROR: // 1 //
|
||||
return 'E_ERROR';
|
||||
case E_WARNING: // 2 //
|
||||
return 'E_WARNING';
|
||||
case E_PARSE: // 4 //
|
||||
return 'E_PARSE';
|
||||
case E_NOTICE: // 8 //
|
||||
return 'E_NOTICE';
|
||||
case E_CORE_ERROR: // 16 //
|
||||
return 'E_CORE_ERROR';
|
||||
case E_CORE_WARNING: // 32 //
|
||||
return 'E_CORE_WARNING';
|
||||
case E_COMPILE_ERROR: // 64 //
|
||||
return 'E_COMPILE_ERROR';
|
||||
case E_COMPILE_WARNING: // 128 //
|
||||
return 'E_COMPILE_WARNING';
|
||||
case E_USER_ERROR: // 256 //
|
||||
return 'E_USER_ERROR';
|
||||
case E_USER_WARNING: // 512 //
|
||||
return 'E_USER_WARNING';
|
||||
case E_USER_NOTICE: // 1024 //
|
||||
return 'E_USER_NOTICE';
|
||||
case E_STRICT: // 2048 //
|
||||
return 'E_STRICT';
|
||||
case E_RECOVERABLE_ERROR: // 4096 //
|
||||
return 'E_RECOVERABLE_ERROR';
|
||||
case E_DEPRECATED: // 8192 //
|
||||
return 'E_DEPRECATED';
|
||||
case E_USER_DEPRECATED: // 16384 //
|
||||
return 'E_USER_DEPRECATED';
|
||||
}
|
||||
return "{$type}";
|
||||
}
|
||||
|
||||
function logErrorByCustomHandler(int $errno, string $errstr, string $errfile, int $errline, array $errcontext){
|
||||
if (!(error_reporting() & $errno)) {
|
||||
// This error code is not included in error_reporting, so let it fall
|
||||
@@ -15,10 +53,32 @@ function logErrorByCustomHandler(int $errno, string $errstr, string $errfile, in
|
||||
}
|
||||
|
||||
$date = date("Ymd_His");
|
||||
$e = new \Exception();
|
||||
|
||||
file_put_contents(ROOT.'/d_log/err_log.txt',"$date, $errno, $errstr, $errfile, $errline\n", FILE_APPEND);
|
||||
|
||||
/* Don't execute PHP internal error handler */
|
||||
//return true;
|
||||
$data = Json::encode([
|
||||
'date'=>$date,
|
||||
'err'=>getFriendlyErrorType($errno),
|
||||
'errstr'=>$errstr,
|
||||
'trace'=>explode("\n", $e->getTraceAsString())
|
||||
], Json::PRETTY);
|
||||
|
||||
file_put_contents(ROOT.'/d_log/err_log.txt',"$data\n", FILE_APPEND);
|
||||
}
|
||||
set_error_handler("\sammo\logErrorByCustomHandler");
|
||||
|
||||
|
||||
function logExceptionByCustomHandler(\Throwable $e){
|
||||
|
||||
$date = date("Ymd_His");
|
||||
|
||||
$data = Json::encode([
|
||||
'date'=>$date,
|
||||
'err'=>get_class($e),
|
||||
'errstr'=>$e->getMessage(),
|
||||
'trace'=>explode("\n", $e->getTraceAsString())
|
||||
], Json::PRETTY);
|
||||
|
||||
file_put_contents(ROOT.'/d_log/err_log.txt',"$data\n", FILE_APPEND);
|
||||
throw $e;
|
||||
}
|
||||
set_exception_handler('\\sammo\\logExceptionByCustomHandler');
|
||||
@@ -20,7 +20,7 @@ require(__dir__.'/../vendor/autoload.php');
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1 class="row justify-content-md-center">삼국지 모의전투 HiD 설치</h1>
|
||||
<h1 class="row justify-content-md-center">삼국지 모의전투 HiDCHe 설치</h1>
|
||||
<div class="row justify-content-md-center">
|
||||
|
||||
<div class="col col-12 col-md-10 col-lg-7">
|
||||
|
||||
@@ -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->throw_exception_on_error = true;
|
||||
self::$uDB->throw_exception_on_nonsql_error = true;
|
||||
}
|
||||
return self::$uDB;
|
||||
}
|
||||
|
||||
+1
-1
@@ -38,7 +38,7 @@ $plock = MYDB_fetch_array($result);
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>삼국지 모의전투 PHP (유기체서버)</title>
|
||||
<title>삼국지 모의전투 HiDCHe</title>
|
||||
<meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'>
|
||||
<link rel='stylesheet' href='../d_shared/common.css' type='text/css'>
|
||||
<link rel='stylesheet' href='css/common.css' type='text/css'>
|
||||
|
||||
+3
-4
@@ -7,8 +7,8 @@ include "func.php";
|
||||
|
||||
$session = Session::requireGameLogin()->setReadOnly();
|
||||
if($session->userGrade < 5){
|
||||
//echo "<script>location.replace('_119.php');</script>";
|
||||
echo '_119.php';//TODO:debug all and replace
|
||||
header('location:_119.php');
|
||||
die();
|
||||
}
|
||||
|
||||
$v = new Validator($_POST);
|
||||
@@ -20,6 +20,7 @@ if(!$v->validate()){
|
||||
Error($v->errorStr());
|
||||
}
|
||||
|
||||
$btn = Util::getReq('btn');
|
||||
$minute = Util::getReq('minute', 'int');
|
||||
$minute2 = Util::getReq('minute2', 'int');
|
||||
|
||||
@@ -67,6 +68,4 @@ case "락풀기":
|
||||
break;
|
||||
}
|
||||
|
||||
//echo "<script>location.replace('_119.php');</script>";
|
||||
//echo '_119.php';//TODO:debug all and replace
|
||||
header('Location:_119.php');
|
||||
@@ -7,8 +7,8 @@ include "func.php";
|
||||
$session = Session::requireGameLogin()->setReadOnly();
|
||||
|
||||
if ($session->userGrade < 5) {
|
||||
//echo "<script>location.replace('_admin1.php');</script>";
|
||||
echo '_admin1.php';//TODO:debug all and replace
|
||||
header('location:_admin1.php');
|
||||
die();
|
||||
}
|
||||
|
||||
$v = new Validator($_POST);
|
||||
@@ -17,11 +17,12 @@ $v->rule('integer', [
|
||||
'minutes2'
|
||||
])->rule('dateFormat', [
|
||||
'starttime'
|
||||
]);
|
||||
], 'Y-m-d H:i:s');
|
||||
if (!$v->validate()) {
|
||||
Error($v->errorStr());
|
||||
}
|
||||
|
||||
$btn = Util::getReq('btn');
|
||||
$log = Util::getReq('log');
|
||||
$starttime = Util::getReq('starttime', 'string', (new \DateTime())->format('Y-m-d H:i:s'));
|
||||
$maxgeneral = Util::getReq('maxgeneral', 'int', GameConst::$defaultMaxGeneral);
|
||||
@@ -117,5 +118,4 @@ switch ($btn) {
|
||||
break;
|
||||
}
|
||||
|
||||
//echo "<script>location.replace('_admin1.php');</script>";
|
||||
echo '_admin1.php';//TODO:debug all and replace
|
||||
header('location:_admin1.php');
|
||||
@@ -4,11 +4,11 @@ namespace sammo;
|
||||
include "lib.php";
|
||||
include "func.php";
|
||||
|
||||
|
||||
$btn = Util::getReq('btn');
|
||||
$weap = Util::getReq('weap', 'int');
|
||||
|
||||
//로그인 검사
|
||||
$session = Session::requireLogin()->loginGame();
|
||||
$session = Session::requireLogin()->loginGame()->setReadOnly();
|
||||
|
||||
if($session->userGrade < 5) {
|
||||
header('location:_admin2.php');
|
||||
@@ -303,6 +303,4 @@ switch($btn) {
|
||||
break;
|
||||
}
|
||||
|
||||
//echo "<script>location.replace('_admin2.php');</script>";
|
||||
echo '_admin2.php';//TODO:debug all and replace
|
||||
|
||||
header('location:_admin2.php');
|
||||
@@ -7,10 +7,13 @@ include "func.php";
|
||||
$session = Session::requireGameLogin()->setReadOnly();
|
||||
|
||||
if($session->userGrade < 5) {
|
||||
//echo "<script>location.replace('_admin4.php');</script>";
|
||||
echo '_admin4.php';//TODO:debug all and replace
|
||||
header('location:_admin4.php');
|
||||
die();
|
||||
}
|
||||
|
||||
$btn = Util::getReq('btn');
|
||||
$genlist = Util::getReq('genlist', 'int');
|
||||
|
||||
$db = DB::db();
|
||||
$connect=$db->get();
|
||||
|
||||
@@ -57,6 +60,5 @@ switch($btn) {
|
||||
break;
|
||||
}
|
||||
|
||||
//echo "<script>location.replace('_admin4.php');</script>";
|
||||
echo '_admin4.php'; //TODO:debug all and replace
|
||||
header('location:_admin4.php');
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ namespace sammo;
|
||||
include "lib.php";
|
||||
include "func.php";
|
||||
|
||||
$btn = Util::getReq('btn');
|
||||
$nation = Util::getReq('nation', 'int');
|
||||
|
||||
//로그인 검사
|
||||
@@ -11,8 +12,8 @@ $session = Session::requireGameLogin()->setReadOnly();
|
||||
$userID = Session::getUserID();
|
||||
|
||||
if($session->userGrade < 5) {
|
||||
//echo "<script>location.replace('_admin5.php');</script>";
|
||||
echo '_admin5.php';//TODO:debug all and replace
|
||||
header('location:_admin5.php');
|
||||
die();
|
||||
}
|
||||
|
||||
$db = DB::db();
|
||||
@@ -34,7 +35,6 @@ switch($btn) {
|
||||
break;
|
||||
}
|
||||
|
||||
//echo "<script>location.replace('_admin5.php');</script>";
|
||||
echo '_admin5.php';//TODO:debug all and replace
|
||||
header('location:_admin5.php');
|
||||
|
||||
|
||||
|
||||
+8
-5
@@ -3,6 +3,9 @@ namespace sammo;
|
||||
|
||||
include "lib.php";
|
||||
include "func.php";
|
||||
|
||||
$type = Util::getReq('type', 'int');
|
||||
|
||||
//로그인 검사
|
||||
$session = Session::requireGameLogin()->setReadOnly();
|
||||
|
||||
@@ -48,11 +51,11 @@ $sel[$type] = "selected";
|
||||
<tr><td>접 속 정 보<br><?=closeButton()?></td></tr>
|
||||
<tr><td><form name=form1 method=post>정렬순서 :
|
||||
<select name=type size=1>
|
||||
<option <?=$sel[0]?> value=0>접속률</option>
|
||||
<option <?=$sel[1]?> value=1>총갱신</option>
|
||||
<option <?=$sel[2]?> value=2>갱신/턴</option>
|
||||
<option <?=$sel[3]?> value=3>총로그인</option>
|
||||
<option <?=$sel[4]?> value=4>갱신/로그인</option>
|
||||
<option <?=$sel[0]??''?> value=0>접속률</option>
|
||||
<option <?=$sel[1]??''?> value=1>총갱신</option>
|
||||
<option <?=$sel[2]??''?> value=2>갱신/턴</option>
|
||||
<option <?=$sel[3]??''?> value=3>총로그인</option>
|
||||
<option <?=$sel[4]??''?> value=4>갱신/로그인</option>
|
||||
</select>
|
||||
<input type=submit value='정렬하기'></form>
|
||||
</td></tr>
|
||||
|
||||
+9
-4
@@ -3,6 +3,11 @@ namespace sammo;
|
||||
|
||||
include "lib.php";
|
||||
include "func.php";
|
||||
|
||||
$btn = Util::getReq('btn');
|
||||
$gen = Util::getReq('gen', 'int', 0);
|
||||
$type = Util::getReq('type', 'int');
|
||||
|
||||
//로그인 검사
|
||||
$session = Session::requireGameLogin()->setReadOnly();
|
||||
|
||||
@@ -53,10 +58,10 @@ $sel[$type] = "selected";
|
||||
<form name=form1 method=post>
|
||||
정렬순서 :
|
||||
<select name=type size=1>
|
||||
<option <?=$sel[0]?> value=0>최근턴</option>
|
||||
<option <?=$sel[1]?> value=1>최근전투</option>
|
||||
<option <?=$sel[2]?> value=2>장수명</option>
|
||||
<option <?=$sel[3]?> value=3>전투수</option>
|
||||
<option <?=$sel[0]??''?> value=0>최근턴</option>
|
||||
<option <?=$sel[1]??''?> value=1>최근전투</option>
|
||||
<option <?=$sel[2]??''?> value=2>장수명</option>
|
||||
<option <?=$sel[3]??''?> value=3>전투수</option>
|
||||
</select>
|
||||
<input type=submit name=btn value='정렬하기'>
|
||||
대상장수 :
|
||||
|
||||
+6
-1
@@ -3,6 +3,11 @@ namespace sammo;
|
||||
|
||||
include "lib.php";
|
||||
include "func.php";
|
||||
|
||||
$btn = Util::getReq('btn');
|
||||
$gen = Util::getReq('gen', 'int', 0);
|
||||
$type = Util::getReq('type', 'int');
|
||||
|
||||
//로그인 검사
|
||||
$session = Session::requireGameLogin()->setReadOnly();
|
||||
|
||||
@@ -53,7 +58,7 @@ $sel[$type] = "selected";
|
||||
<form name=form1 method=post>
|
||||
정렬순서 :
|
||||
<select name=type size=1>
|
||||
<option <?=$sel[0]?> value=0>상태</option>
|
||||
<option <?=$sel[0]??''?> value=0>상태</option>
|
||||
</select>
|
||||
<input type=submit name=btn value='정렬하기'>
|
||||
</form>
|
||||
|
||||
+12
-12
@@ -194,8 +194,8 @@ if($isgen == "장수공격" || $isgen == "성벽공격" || $isgen == "장수평
|
||||
$mykillnum = 0; $mydeathnum = 0;
|
||||
while($phase < $warphase) {
|
||||
$phase++;
|
||||
$myAtt = getAtt($game, $general, $tech1, 0);
|
||||
$myDef = getDef($game, $general, $tech1);
|
||||
$myAtt = getAtt($general, $tech1, 0);
|
||||
$myDef = getDef($general, $tech1);
|
||||
$cityAtt = getCityAtt($city);
|
||||
$cityDef = getCityDef($city);
|
||||
|
||||
@@ -355,7 +355,7 @@ if($isgen == "장수공격" || $isgen == "성벽공격" || $isgen == "장수평
|
||||
|
||||
// 도시쌀 소모 계산
|
||||
$opexp = Util::round($opexp / 50);
|
||||
$rice = Util::round($opexp * 4 * getCrewtypeRice($game, 0, 0) * ($train3/100 - 0.2));
|
||||
$rice = Util::round($opexp * 4 * getCrewtypeRice(0, 0) * ($train3/100 - 0.2));
|
||||
|
||||
//원래대로 스케일링
|
||||
$city['def'] = Util::round($city['def'] / 10);
|
||||
@@ -385,10 +385,10 @@ if($isgen == "장수공격" || $isgen == "성벽공격" || $isgen == "장수평
|
||||
while($phase < $warphase) {
|
||||
$phase++;
|
||||
|
||||
$myAtt = getAtt($game, $general, $tech1, 0);
|
||||
$myDef = getDef($game, $general, $tech1);
|
||||
$opAtt = getAtt($game, $oppose, $tech2, 0);
|
||||
$opDef = getDef($game, $oppose, $tech2);
|
||||
$myAtt = getAtt($general, $tech1, 0);
|
||||
$myDef = getDef($general, $tech1);
|
||||
$opAtt = getAtt($oppose, $tech2, 0);
|
||||
$opDef = getDef($oppose, $tech2);
|
||||
// 감소할 병사 수
|
||||
$myCrew = GameConst::$armperphase + $opAtt - $myDef;
|
||||
$opCrew = GameConst::$armperphase + $myAtt - $opDef;
|
||||
@@ -747,9 +747,9 @@ if($isgen == "장수공격" || $isgen == "성벽공격" || $isgen == "장수평
|
||||
|
||||
// 공헌, 명성 상승
|
||||
$exp = Util::round($exp / 50);
|
||||
$ricing = ($exp * 5 * getCrewtypeRice($game, $general['crewtype'], $tech1));
|
||||
$msg .= "★ 【공격장수】공헌 상승 : $exp 쌀 소비 : {$exp}x5x".getCrewtypeRice($game, $general['crewtype'], $tech1)." = $ricing<br>";
|
||||
// $msg2 .= "★ 【공격장수】공헌 상승 : $exp 쌀 소비 : {$exp}x5x".getCrewtypeRice($game, $general['crewtype'], $tech1)." = $ricing<br>";
|
||||
$ricing = ($exp * 5 * getCrewtypeRice($general['crewtype'], $tech1));
|
||||
$msg .= "★ 【공격장수】공헌 상승 : $exp 쌀 소비 : {$exp}x5x".getCrewtypeRice($general['crewtype'], $tech1)." = $ricing<br>";
|
||||
// $msg2 .= "★ 【공격장수】공헌 상승 : $exp 쌀 소비 : {$exp}x5x".getCrewtypeRice($general['crewtype'], $tech1)." = $ricing<br>";
|
||||
|
||||
$msg = ConvertLog($msg, 1);
|
||||
|
||||
@@ -771,11 +771,11 @@ if($isgen == "장수공격" || $isgen == "성벽공격" || $isgen == "장수평
|
||||
$msg2 .= "{$simulCount}회 평균<br>";
|
||||
$msg2 .= "<S>★</>병사수 변화 : <C>-$mydeathnumSum</> vs <C>-$mykillnumSum</> ";
|
||||
$msg2 .= "<R>★</>【성벽】내정 감소량 : $expSum2 【성벽】쌀 소모 : $ricingSum2<br>";
|
||||
$msg2 .= "★ 【공격장수】공헌 상승 : $expSum 쌀 소비 : {$expSum}x5x".getCrewtypeRice($game, $general['crewtype'], $tech1)." = $ricingSum<br>";
|
||||
$msg2 .= "★ 【공격장수】공헌 상승 : $expSum 쌀 소비 : {$expSum}x5x".getCrewtypeRice($general['crewtype'], $tech1)." = $ricingSum<br>";
|
||||
} elseif($isgen == "장수평균") {
|
||||
$msg2 .= "{$simulCount}회 평균<br>";
|
||||
$msg2 .= "<S>★</>병사수 변화 : <C>-$mydeathnumSum</> vs <C>-$mykillnumSum</> ";
|
||||
$msg2 .= "★ 【공격장수】공헌 상승 : $expSum 쌀 소비 : {$expSum}x5x".getCrewtypeRice($game, $general['crewtype'], $tech1)." = $ricingSum<br>";
|
||||
$msg2 .= "★ 【공격장수】공헌 상승 : $expSum 쌀 소비 : {$expSum}x5x".getCrewtypeRice($general['crewtype'], $tech1)." = $ricingSum<br>";
|
||||
}
|
||||
|
||||
$msg2 = ConvertLog($msg2, 1);
|
||||
|
||||
+12
-6
@@ -3,6 +3,9 @@ namespace sammo;
|
||||
|
||||
include "lib.php";
|
||||
include "func.php";
|
||||
|
||||
$btn = Util::getReq('btn');
|
||||
|
||||
//로그인 검사
|
||||
$session = Session::requireGameLogin()->setReadOnly();
|
||||
$userID = Session::getUserID();
|
||||
@@ -179,10 +182,13 @@ for ($i=0; $i < 21; $i++) {
|
||||
echo "</tr><tr>";
|
||||
|
||||
for ($k=0; $k < 10; $k++) {
|
||||
if ($i == 5 || $i == 7 || $i == 20) {
|
||||
if($data[$k] === '-'){
|
||||
//do Nothing
|
||||
}
|
||||
else if ($i == 5 || $i == 7 || $i == 20) {
|
||||
$data[$k] = intdiv($data[$k], 100).".".($data[$k]%100)." %";
|
||||
}
|
||||
if ($i >= 13 && $i <= 16) {
|
||||
else if ($i >= 13 && $i <= 16) {
|
||||
$data[$k] = intdiv($data[$k], 100).".".($data[$k]%100)." %";
|
||||
}
|
||||
echo "<td align=center>{$data[$k]}</td>";
|
||||
@@ -211,10 +217,10 @@ $call = array(
|
||||
);
|
||||
|
||||
$func = array(
|
||||
"getHorseName",
|
||||
"getWeapName",
|
||||
"getBookName",
|
||||
"getItemName"
|
||||
"\\sammo\\getHorseName",
|
||||
"\\sammo\\getWeapName",
|
||||
"\\sammo\\getBookName",
|
||||
"\\sammo\\getItemName"
|
||||
);
|
||||
|
||||
for ($i=0; $i < 4; $i++) {
|
||||
|
||||
+19
-5
@@ -4,7 +4,8 @@ namespace sammo;
|
||||
include "lib.php";
|
||||
include "func.php";
|
||||
$btn = Util::getReq('btn');
|
||||
$yearmonth = $_POST['yearmonth'];
|
||||
$yearmonth = Util::getReq('yearmonth');
|
||||
|
||||
//로그인 검사
|
||||
$session = Session::requireGameLogin()->setReadOnly();
|
||||
$userID = Session::getUserID();
|
||||
@@ -38,6 +39,7 @@ $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "
|
||||
$history = MYDB_fetch_array($result);
|
||||
$e = ($history['year']*12) + $history['month'];
|
||||
|
||||
//FIXME: $yearmonth가 올바르지 않을 경우에 처리가 필요.
|
||||
if (!$yearmonth) {
|
||||
$year = $admin['year'];
|
||||
$month = $admin['month'] - 1;
|
||||
@@ -74,8 +76,15 @@ if ($month <= 0) {
|
||||
<head>
|
||||
<meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'>
|
||||
<title>연감</title>
|
||||
<script src="../e_lib/jquery-3.2.1.min.js"></script>
|
||||
<script src="../d_shared/common_path.js"></script>
|
||||
<script src="js/common.js"></script>
|
||||
<script src="js/base_map.js"></script>
|
||||
<script src="js/map.js"></script>
|
||||
|
||||
<link rel='stylesheet' href='../d_shared/common.css' type='text/css'>
|
||||
<link rel='stylesheet' href='css/common.css' type='text/css'>
|
||||
<link href="css/map.css" rel="stylesheet">
|
||||
|
||||
</head>
|
||||
|
||||
@@ -117,9 +126,8 @@ $history = MYDB_fetch_array($result);
|
||||
<tr><td colspan=5 align=center id=bg1>중 원 지 도</td></tr>
|
||||
<tr height=520>
|
||||
<td width=698>
|
||||
<iframe src='map_history.php?year=<?=$year?>&month=<?=$month?>' width=698 height=520 frameborder=0 marginwidth=0 marginheight=0 topmargin=0 scrolling=no>
|
||||
</iframe>
|
||||
</td>
|
||||
<?=getMapHtml();?>
|
||||
|
||||
<td width=98 valign=top><?=$history['nation']?></td>
|
||||
<td width=78 valign=top><?=$history['power']?></td>
|
||||
<td width=58 valign=top><?=$history['gen']?></td>
|
||||
@@ -142,7 +150,13 @@ $history = MYDB_fetch_array($result);
|
||||
<tr><td><?=closeButton()?></td></tr>
|
||||
<tr><td><?=banner()?> </td></tr>
|
||||
</table>
|
||||
<script>
|
||||
reloadWorldMap({
|
||||
targetJson:'j_map_history.php?year=<?=$year?>&month=<?=$month?>',
|
||||
showMe:false,
|
||||
neutralView:true
|
||||
});
|
||||
</script>
|
||||
<?php PrintElapsedTime(); ?>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
||||
+8
-8
@@ -34,14 +34,14 @@ $sel[$type] = "selected";
|
||||
<tr><td>빙 의 일 람<br><?=closeButton()?></td></tr>
|
||||
<tr><td><form name=form1 method=post>정렬순서 :
|
||||
<select name=type size=1>
|
||||
<option <?=$sel[1]?> value=1>이름</option>
|
||||
<option <?=$sel[2]?> value=2>국가</option>
|
||||
<option <?=$sel[3]?> value=3>종능</option>
|
||||
<option <?=$sel[4]?> value=4>통솔</option>
|
||||
<option <?=$sel[5]?> value=5>무력</option>
|
||||
<option <?=$sel[6]?> value=6>지력</option>
|
||||
<option <?=$sel[7]?> value=7>명성</option>
|
||||
<option <?=$sel[8]?> value=8>계급</option>
|
||||
<option <?=$sel[1]??''?> value=1>이름</option>
|
||||
<option <?=$sel[2]??''?> value=2>국가</option>
|
||||
<option <?=$sel[3]??''?> value=3>종능</option>
|
||||
<option <?=$sel[4]??''?> value=4>통솔</option>
|
||||
<option <?=$sel[5]??''?> value=5>무력</option>
|
||||
<option <?=$sel[6]??''?> value=6>지력</option>
|
||||
<option <?=$sel[7]??''?> value=7>명성</option>
|
||||
<option <?=$sel[8]??''?> value=8>계급</option>
|
||||
</select>
|
||||
<input type=submit value='정렬하기'></form>
|
||||
</td></tr>
|
||||
|
||||
+2
-2
@@ -45,7 +45,7 @@ $(function(){
|
||||
|
||||
});
|
||||
</script>
|
||||
<link href="../d_shared/common.css" red="stylesheet">
|
||||
<link href="../d_shared/common.css" rel="stylesheet">
|
||||
<link href="css/normalize.css" rel="stylesheet">
|
||||
<link href="css/common.css" rel="stylesheet">
|
||||
<link href="css/map.css" rel="stylesheet">
|
||||
@@ -59,7 +59,7 @@ $(function(){
|
||||
<table align=center width=1200 height=520 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg0>
|
||||
<tr height=520>
|
||||
<td width=498 valign=top>
|
||||
<?php getGeneralPublicRecordRecent(34); ?>
|
||||
<?=getGeneralPublicRecordRecent(34)?>
|
||||
</td>
|
||||
<td width=698>
|
||||
<?=getMapHtml()?>
|
||||
|
||||
@@ -8,7 +8,10 @@ $v = new Validator($_POST + $_GET);
|
||||
$v->rule('required', 'gen')
|
||||
->rule('integer', 'gen');
|
||||
|
||||
$btn = Util::getReq('btn');
|
||||
$gen = Util::getReq('gen', 'int');
|
||||
$type = Util::getReq('type', 'int');
|
||||
|
||||
//로그인 검사
|
||||
$session = Session::requireGameLogin()->setReadOnly();
|
||||
$userID = Session::getUserID();
|
||||
@@ -83,10 +86,10 @@ $sel[$type] = "selected";
|
||||
<form name=form1 method=post>
|
||||
정렬순서 :
|
||||
<select name=type size=1>
|
||||
<option <?=$sel[0]?> value=0>최근턴</option>
|
||||
<option <?=$sel[1]?> value=1>최근전투</option>
|
||||
<option <?=$sel[2]?> value=2>장수명</option>
|
||||
<option <?=$sel[3]?> value=3>전투수</option>
|
||||
<option <?=$sel[0]??''?> value=0>최근턴</option>
|
||||
<option <?=$sel[1]??''?> value=1>최근전투</option>
|
||||
<option <?=$sel[2]??''?> value=2>장수명</option>
|
||||
<option <?=$sel[3]??''?> value=3>전투수</option>
|
||||
</select>
|
||||
<input type=submit name=btn value='정렬하기'>
|
||||
대상장수 :
|
||||
|
||||
+22
-12
@@ -105,9 +105,19 @@ for($i=12; $i >= $lv; $i--) {
|
||||
$turntime[$i] = substr($gen[$i]['turntime'], 14);
|
||||
}
|
||||
|
||||
|
||||
//FIXME: 각 칸을 div로 놓으면 네개씩 출력하는 삽질이 필요없다.
|
||||
|
||||
for($k=0; $k < 2; $k++) {
|
||||
$l4 = 12 - $k; $l3 = 10 - $k; $l2 = 8 - $k; $l1 = 6 - $k;
|
||||
|
||||
if(!isset($gen[$l4])){
|
||||
$gen[$l4] = [
|
||||
'npc'=>0,
|
||||
'name'=>0
|
||||
];
|
||||
}
|
||||
|
||||
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>"; }
|
||||
@@ -129,19 +139,19 @@ for($k=0; $k < 2; $k++) {
|
||||
";
|
||||
|
||||
for($i=0; $i < 12; $i++) {
|
||||
$turndate[$l4] = substr($totaldate[$l4], 11, 5);
|
||||
$turndate[$l3] = substr($totaldate[$l3], 11, 5);
|
||||
$turndate[$l2] = substr($totaldate[$l2], 11, 5);
|
||||
$turndate[$l1] = substr($totaldate[$l1], 11, 5);
|
||||
$turndate[$l4] = substr($totaldate[$l4]??'', 11, 5);
|
||||
$turndate[$l3] = substr($totaldate[$l3]??'', 11, 5);
|
||||
$turndate[$l2] = substr($totaldate[$l2]??'', 11, 5);
|
||||
$turndate[$l1] = substr($totaldate[$l1]??'', 11, 5);
|
||||
$j = $i + 1;
|
||||
$td4 = ($turndate[$l4] == "") ? "-" : $turndate[$l4];
|
||||
$td3 = ($turndate[$l3] == "") ? "-" : $turndate[$l3];
|
||||
$td2 = ($turndate[$l2] == "") ? "-" : $turndate[$l2];
|
||||
$td1 = ($turndate[$l1] == "") ? "-" : $turndate[$l1];
|
||||
$tn4 = ($turn[$l4][$i] == "") ? "-" : $turn[$l4][$i];
|
||||
$tn3 = ($turn[$l3][$i] == "") ? "-" : $turn[$l3][$i];
|
||||
$tn2 = ($turn[$l2][$i] == "") ? "-" : $turn[$l2][$i];
|
||||
$tn1 = ($turn[$l1][$i] == "") ? "-" : $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>
|
||||
|
||||
+37
-40
@@ -3,6 +3,9 @@ namespace sammo;
|
||||
|
||||
include "lib.php";
|
||||
include "func.php";
|
||||
|
||||
$citylist = Util::getReq('citylist', 'int');
|
||||
|
||||
//로그인 검사
|
||||
$session = Session::requireGameLogin()->setReadOnly();
|
||||
$userID = Session::getUserID();
|
||||
@@ -42,7 +45,9 @@ $myNation = MYDB_fetch_array($result);
|
||||
<form name=cityselect method=get>도시선택 :
|
||||
<select name=citylist size=1 style=color:white;background-color:black;width:798;>
|
||||
<?php
|
||||
if(!array_key_exists('citylist', $_REQUEST) || $_REQUEST['citylist'] == '') { $_REQUEST['citylist'] = $me['city']; }
|
||||
if(!$citylist){
|
||||
$citylist = $me['city'];
|
||||
}
|
||||
|
||||
// 재야일때는 현재 도시만
|
||||
$valid = 0;
|
||||
@@ -52,7 +57,7 @@ if($me['level'] == 0) {
|
||||
$city = MYDB_fetch_array($cityresult);
|
||||
echo "
|
||||
<option value={$city['city']}";
|
||||
if($city['city'] == $_REQUEST['citylist']) { echo " selected"; $valid = 1; }
|
||||
if($city['city'] == $citylist) { echo " selected"; $valid = 1; }
|
||||
echo ">==================================================【".StringUtil::padString($city['name'], 4, '_')."】";
|
||||
if($city['nation'] == 0) echo "공백지";
|
||||
elseif($me['nation'] == $city['nation']) echo "본국==";
|
||||
@@ -68,7 +73,7 @@ if($me['level'] == 0) {
|
||||
$city = MYDB_fetch_array($cityresult);
|
||||
echo "
|
||||
<option value={$city['city']}";
|
||||
if($city['city'] == $_REQUEST['citylist']) { echo " selected"; $valid = 1; }
|
||||
if($city['city'] == $citylist) { echo " selected"; $valid = 1; }
|
||||
echo ">==================================================【".StringUtil::padString($city['name'], 4, '_')."】";
|
||||
if($city['nation'] == 0) echo "공백지";
|
||||
elseif($me['nation'] == $city['nation']) echo "본국==";
|
||||
@@ -85,7 +90,7 @@ if($me['level'] == 0) {
|
||||
$city = MYDB_fetch_array($cityresult);
|
||||
echo "
|
||||
<option value={$city['city']}";
|
||||
if($city['city'] == $_REQUEST['citylist']) { echo " selected"; $valid = 1; }
|
||||
if($city['city'] == $citylist) { echo " selected"; $valid = 1; }
|
||||
echo ">==================================================【".StringUtil::padString($city['name'], 4, '_')."】";
|
||||
if($city['nation'] == 0) echo "공백지";
|
||||
elseif($me['nation'] == $city['nation']) echo "본국==";
|
||||
@@ -111,7 +116,7 @@ if($myNation['level'] > 0) {
|
||||
$city = MYDB_fetch_array($cityresult);
|
||||
echo "
|
||||
<option value={$city['city']}";
|
||||
if($city['city'] == $_REQUEST['citylist']) { echo " selected"; $valid = 1; }
|
||||
if($city['city'] == $citylist) { echo " selected"; $valid = 1; }
|
||||
echo ">==================================================【".StringUtil::padString($city['name'], 4, '_')."】";
|
||||
if($city['nation'] == 0) echo "공백지";
|
||||
elseif($me['nation'] == $city['nation']) echo "본국==";
|
||||
@@ -131,28 +136,21 @@ echo "
|
||||
</table>
|
||||
<br>";
|
||||
|
||||
unset($city);
|
||||
|
||||
// 첩보된 도시까지만 허용
|
||||
if($valid == 0 && $session->userGrade < 5) {
|
||||
$_REQUEST['citylist'] = $me['city'];
|
||||
$citylist = $me['city'];
|
||||
}
|
||||
|
||||
$query = "select * from city where city='{$_REQUEST['citylist']}'"; // 도시 이름 목록
|
||||
$cityresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$city = MYDB_fetch_array($cityresult);
|
||||
|
||||
$city = $db->queryFirstRow('SELECT * FROM city WHERE city=%i', $citylist);
|
||||
$nation = getNationStaticInfo($city['nation']);
|
||||
|
||||
$query = "select name from general where no='{$city['gen1']}'"; // 태수 이름
|
||||
$genresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$gen1 = MYDB_fetch_array($genresult);
|
||||
|
||||
$query = "select name from general where no='{$city['gen2']}'"; // 군사 이름
|
||||
$genresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$gen2 = MYDB_fetch_array($genresult);
|
||||
|
||||
$query = "select name from general where no='{$city['gen3']}'"; // 시중 이름
|
||||
$genresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$gen3 = MYDB_fetch_array($genresult);
|
||||
//태수, 군사, 시중
|
||||
$gen1 = $db->queryFirstRow('SELECT `name`, npc FROM general WHERE `no`=%i', $city['gen1']);
|
||||
$gen2 = $db->queryFirstRow('SELECT `name`, npc FROM general WHERE `no`=%i', $city['gen2']);
|
||||
$gen3 = $db->queryFirstRow('SELECT `name`, npc FROM general WHERE `no`=%i', $city['gen3']);
|
||||
|
||||
if($city['trade'] == 0) {
|
||||
$city['trade'] = "- ";
|
||||
@@ -163,44 +161,43 @@ if($city['trade'] == 0) {
|
||||
<tr><td><?=backButton()?></td></tr>
|
||||
</table>
|
||||
|
||||
<?php
|
||||
echo "
|
||||
<table align=center width=1000 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg2>
|
||||
<tr>
|
||||
<td colspan=12 align=center style=color:".newColor($nation['color'])."; bgcolor={$nation['color']}>【 ".CityConst::$regionMap[$city['region']]." | ".CityConst::$levelMap[$city['level']]." 】 {$city['name']}</td>
|
||||
<td colspan=12 align=center style=color:"<?=newColor($nation['color'])?>"; bgcolor=<?=$nation['color']?>>【 <?=CityConst::$regionMap[$city['region']]?> | <?=CityConst::$levelMap[$city['level']]?> 】 <?=$city['name']?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align=center width=48 id=bg1>주민</td>
|
||||
<td align=center width=112>{$city['pop']}/{$city['pop2']}</td>
|
||||
<td align=center width=112><?=$city['pop']?>/<?=$city['pop2']?></td>
|
||||
<td align=center width=48 id=bg1>농업</td>
|
||||
<td align=center width=108>{$city['agri']}/{$city['agri2']}</td>
|
||||
<td align=center width=108><?=$city['agri']?>/<?=$city['agri2']?></td>
|
||||
<td align=center width=48 id=bg1>상업</td>
|
||||
<td align=center width=108>{$city['comm']}/{$city['comm2']}</td>
|
||||
<td align=center width=108><?=$city['comm']?>/<?=$city['comm2']?></td>
|
||||
<td align=center width=48 id=bg1>치안</td>
|
||||
<td align=center width=108>{$city['secu']}/{$city['secu2']}</td>
|
||||
<td align=center width=108><?=$city['secu']?>/<?=$city['secu2']?></td>
|
||||
<td align=center width=48 id=bg1>수비</td>
|
||||
<td align=center width=108>{$city['def']}/{$city['def2']}</td>
|
||||
<td align=center width=108><?=$city['def']?>/<?=$city['def2']?></td>
|
||||
<td align=center width=48 id=bg1>성벽</td>
|
||||
<td align=center width=108>{$city['wall']}/{$city['wall2']}</td>
|
||||
<td align=center width=108><?=$city['wall']?>/<?=$city['wall2']?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align=center id=bg1>민심</td>
|
||||
<td align=center>{$city['rate']}</td>
|
||||
<td align=center><?=$city['rate']?></td>
|
||||
<td align=center id=bg1>시세</td>
|
||||
<td align=center>{$city['trade']}%</td>
|
||||
<td align=center><?=$city['trade']?>%</td>
|
||||
<td align=center id=bg1>인구</td>
|
||||
<td align=center>".round($city['pop']/$city['pop2']*100, 2)." %</td>
|
||||
<td align=center><?=round($city['pop']/$city['pop2']*100, 2)?>%</td>
|
||||
<td align=center id=bg1>태수</td>
|
||||
<td align=center>";echo $gen1['name']==''?"-":"{$gen1['name']}";echo "</td>
|
||||
<td align=center><?=$gen1['name']??'-'?></td>
|
||||
<td align=center id=bg1>군사</td>
|
||||
<td align=center>";echo $gen2['name']==''?"-":"{$gen2['name']}";echo "</td>
|
||||
<td align=center><?=$gen2['name']??'-'?></td>
|
||||
<td align=center id=bg1>시중</td>
|
||||
<td align=center>";echo $gen3['name']==''?"-":"{$gen3['name']}";echo "</td>
|
||||
<td align=center><?=$gen3['name']??'-'?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align=center id=bg1>장수</td>
|
||||
<td colspan=11>";
|
||||
$query = "select name from general where city='{$city['city']}' and nation='{$city['nation']}'"; // 장수 목록
|
||||
<td colspan=11>
|
||||
<?php
|
||||
$query = "select name, npc from general where city='{$city['city']}' and nation='{$city['nation']}'"; // 장수 목록
|
||||
$genresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$gencount = MYDB_num_rows($genresult);
|
||||
if($gencount == 0) echo "-";
|
||||
@@ -208,11 +205,11 @@ echo "
|
||||
$general = MYDB_fetch_array($genresult);
|
||||
echo "{$general['name']}, ";
|
||||
}
|
||||
echo "
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>";
|
||||
|
||||
</table>
|
||||
<?php
|
||||
$query = "select npc,mode,no,picture,imgsvr,name,injury,leader,power,intel,level,nation,crewtype,crew,train,atmos,term,turn0,turn1,turn2,turn3,turn4,turn5 from general where city='{$city['city']}' order by dedication desc"; // 장수 목록
|
||||
$genresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$gencount = MYDB_num_rows($genresult);
|
||||
|
||||
+76
-70
@@ -49,6 +49,30 @@ for($i=0; $i < $nationcount; $i++) {
|
||||
$cityStr .= "속령 $citycount<br>";
|
||||
}
|
||||
|
||||
$realConflict = [];
|
||||
foreach ($db->queryAllLists('SELECT city, `name`, conflict FROM city WHERE conflict!=%s', '{}') as list(
|
||||
$cityID,
|
||||
$cityName,
|
||||
$rawConflict
|
||||
))
|
||||
{
|
||||
$conflict = Json::decode($city['conflict']);
|
||||
if (count($conflict)<2) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$sum = array_sum($conflict);
|
||||
|
||||
foreach ($conflict as $nationID=>$killnum) {
|
||||
$conflict['percent'] = round(100*$killnum / $sum, 1);
|
||||
$conflict['name'] = $nationname[$nationID];
|
||||
$conflict['color'] = $nationcolor[$nationID];
|
||||
}
|
||||
|
||||
$realConflict[] = [$cityID, $cityName, $conflict];
|
||||
};
|
||||
|
||||
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
@@ -72,7 +96,7 @@ $(function(){
|
||||
});
|
||||
</script>
|
||||
<link href="css/normalize.css" rel="stylesheet">
|
||||
<link href="../d_shared/common.css" red="stylesheet">
|
||||
<link href="../d_shared/common.css" rel="stylesheet">
|
||||
<link href="css/common.css" rel="stylesheet">
|
||||
<link href="css/map.css" rel="stylesheet">
|
||||
|
||||
@@ -152,78 +176,60 @@ for($i=0; $i < $nationcount; $i++) {
|
||||
?>
|
||||
<tr><td colspan=<?=$nationcount+1?> align=center>불가침 : <font color=limegreen>@</font>, 통합 : <font color=cyan>○</font>, 합병 : <font color=skyblue>◎</font>, 통상 : ㆍ, 선포 : <font color=magenta>▲</font>, 교전 : <font color=red>★</font></td></tr>
|
||||
</table>
|
||||
<?php
|
||||
$query = "select city,name,conflict,conflict2 from city where conflict like '%|%'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$citycount = MYDB_num_rows($result);
|
||||
|
||||
if($citycount != 0) {
|
||||
echo "
|
||||
<?php if ($realConflict) : ?>
|
||||
|
||||
<br>
|
||||
<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 colspan=2 align=center bgcolor=magenta>분 쟁 현 황</td></tr>";
|
||||
}
|
||||
|
||||
for($i=0; $i < $citycount; $i++) {
|
||||
$city = MYDB_fetch_array($result);
|
||||
|
||||
if($city['conflict'] != "") {
|
||||
$nation = explode("|", $city['conflict']);
|
||||
$killnum = explode("|", $city['conflict2']);
|
||||
|
||||
$seq = mySort($killnum); // 큰 순서대로 순서를 구한다.
|
||||
|
||||
$sum = 0;
|
||||
for($k=0; $k < count($killnum); $k++) {
|
||||
$sum += $killnum[$k];
|
||||
}
|
||||
echo "
|
||||
<tr>
|
||||
<td align=center width=48>{$city['name']}</td>
|
||||
<td width=948>";
|
||||
for($k=0; $k < count($nation); $k++) {
|
||||
$per = 100*$killnum[$seq[$k]] / $sum;
|
||||
$graph1 = $per / 100 * 798;
|
||||
$per = round($per, 1);
|
||||
echo "
|
||||
<table border=0 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg0>
|
||||
<tr>
|
||||
<td width=98 align=right style=color:".newColor($nationcolor[$nation[$seq[$k]]]).";background-color:{$nationcolor[$nation[$seq[$k]]]};>{$nationname[$nation[$seq[$k]]]} </td>
|
||||
<td width=48 align=right>{$per}% </td>
|
||||
<td width=$graph1 style=background-color:{$nationcolor[$nation[$seq[$k]]]};></td>
|
||||
<td width=*></td>
|
||||
</tr>
|
||||
</table>";
|
||||
}
|
||||
echo "
|
||||
</td>
|
||||
</tr>
|
||||
<tr><td colspan=2 height=5 id=bg1></td></tr>";
|
||||
}
|
||||
}
|
||||
|
||||
function mySort($killnum) {
|
||||
$seq = [];
|
||||
for($i=0; $i < count($killnum); $i++) {
|
||||
$seq[$i] = $i;
|
||||
}
|
||||
for($i=0; $i < count($killnum); $i++) {
|
||||
$max = 0;
|
||||
for($k=0; $k < count($killnum); $k++) {
|
||||
if($max < $killnum[$k]) {
|
||||
$max = $killnum[$k];
|
||||
$index = $k;
|
||||
}
|
||||
}
|
||||
$seq[$i] = $index;
|
||||
$killnum[$index] = 0;
|
||||
}
|
||||
return $seq;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<table
|
||||
align='center'
|
||||
width=1000
|
||||
border=1
|
||||
cellspacing=0
|
||||
cellpadding=0
|
||||
bordercolordark='gray'
|
||||
bordercolorlight='black'
|
||||
style='font-size:13px;word-break:break-all;'
|
||||
class='bg0'
|
||||
>
|
||||
<tr><td colspan=2 align=center bgcolor=magenta>분 쟁 현 황</td></tr>
|
||||
<?php foreach($realConflict as list($cityID, $cityName, $conflict)): ?>
|
||||
<tr>
|
||||
<td align=center width=48><?=$cityName?></td>
|
||||
<td width=948>
|
||||
<table
|
||||
border=0
|
||||
cellspacing=0
|
||||
cellpadding=0
|
||||
bordercolordark='gray'
|
||||
bordercolorlight='black'
|
||||
style='font-size:13px;word-break:break-all;'
|
||||
class='bg0'
|
||||
>
|
||||
<?php foreach($conflict as $item): ?>
|
||||
<tr>
|
||||
<td
|
||||
width=98
|
||||
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>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</table>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
<tr><td colspan=2 height=5 id=bg1></td></tr>
|
||||
</table>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<br>
|
||||
<table class="bg0" align=center width=1000 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style="font-size:13px;word-break:break-all;">
|
||||
<tr>
|
||||
|
||||
+12
-9
@@ -3,6 +3,9 @@ namespace sammo;
|
||||
|
||||
include "lib.php";
|
||||
include "func.php";
|
||||
|
||||
$type = Util::getReq('type', 'int');
|
||||
|
||||
//로그인 검사
|
||||
$session = Session::requireGameLogin()->setReadOnly();
|
||||
$userID = Session::getUserID();
|
||||
@@ -60,14 +63,14 @@ $sel[$type] = "selected";
|
||||
<tr><td>암 행 부<br><?=closeButton()?></td></tr>
|
||||
<tr><td><form name=form1 method=post>정렬순서 :
|
||||
<select name=type size=1>
|
||||
<option <?=$sel[1]?> value=1>자금</option>
|
||||
<option <?=$sel[2]?> value=2>군량</option>
|
||||
<option <?=$sel[3]?> value=3>도시</option>
|
||||
<option <?=$sel[4]?> value=4>병종</option>
|
||||
<option <?=$sel[5]?> value=5>병사</option>
|
||||
<option <?=$sel[6]?> value=6>삭제턴</option>
|
||||
<option <?=$sel[7]?> value=7>턴</option>
|
||||
<option <?=$sel[8]?> value=8>부대</option>
|
||||
<option <?=$sel[1]??''?> value=1>자금</option>
|
||||
<option <?=$sel[2]??''?> value=2>군량</option>
|
||||
<option <?=$sel[3]??''?> value=3>도시</option>
|
||||
<option <?=$sel[4]??''?> value=4>병종</option>
|
||||
<option <?=$sel[5]??''?> value=5>병사</option>
|
||||
<option <?=$sel[6]??''?> value=6>삭제턴</option>
|
||||
<option <?=$sel[7]??''?> value=7>턴</option>
|
||||
<option <?=$sel[8]??''?> value=8>부대</option>
|
||||
</select>
|
||||
<input type=submit value='정렬하기'></form>
|
||||
</td></tr>
|
||||
@@ -116,7 +119,7 @@ echo"
|
||||
for ($j=0; $j < $gencount; $j++) {
|
||||
$general = MYDB_fetch_array($genresult);
|
||||
$city = CityConst::byID($general['city'])->name;
|
||||
$troop = $troopName[$general['troop']] == "" ? "-" : $troopName[$general['troop']];
|
||||
$troop = $troopName[$general['troop']]??'-';
|
||||
|
||||
if ($general['level'] == 12) {
|
||||
$lbonus = $nation['level'] * 2;
|
||||
|
||||
+12
-12
@@ -43,18 +43,18 @@ $sel = [$type => "selected"];
|
||||
<tr><td>세 력 도 시<br><?=backButton()?></td></tr>
|
||||
<tr><td><form name=form1 method=post>정렬순서 :
|
||||
<select name=type size=1>
|
||||
<option <?=$sel[1]?> value=1>기본</option>
|
||||
<option <?=$sel[2]?> value=2>인구</option>
|
||||
<option <?=$sel[3]?> value=3>인구율</option>
|
||||
<option <?=$sel[4]?> value=4>민심</option>
|
||||
<option <?=$sel[5]?> value=5>농업</option>
|
||||
<option <?=$sel[6]?> value=6>상업</option>
|
||||
<option <?=$sel[7]?> value=7>치안</option>
|
||||
<option <?=$sel[8]?> value=8>수비</option>
|
||||
<option <?=$sel[9]?> value=9>성벽</option>
|
||||
<option <?=$sel[10]?> value=10>시세</option>
|
||||
<option <?=$sel[11]?> value=11>지역</option>
|
||||
<option <?=$sel[12]?> value=12>규모</option>
|
||||
<option <?=$sel[1]??''?> value=1>기본</option>
|
||||
<option <?=$sel[2]??''?> value=2>인구</option>
|
||||
<option <?=$sel[3]??''?> value=3>인구율</option>
|
||||
<option <?=$sel[4]??''?> value=4>민심</option>
|
||||
<option <?=$sel[5]??''?> value=5>농업</option>
|
||||
<option <?=$sel[6]??''?> value=6>상업</option>
|
||||
<option <?=$sel[7]??''?> value=7>치안</option>
|
||||
<option <?=$sel[8]??''?> value=8>수비</option>
|
||||
<option <?=$sel[9]??''?> value=9>성벽</option>
|
||||
<option <?=$sel[10]??''?> value=10>시세</option>
|
||||
<option <?=$sel[11]??''?> value=11>지역</option>
|
||||
<option <?=$sel[12]??''?> value=12>규모</option>
|
||||
</select>
|
||||
<input type=submit value='정렬하기'></form>
|
||||
</td></tr>
|
||||
|
||||
+57
-31
@@ -3,6 +3,9 @@ namespace sammo;
|
||||
|
||||
include "lib.php";
|
||||
include "func.php";
|
||||
|
||||
$type = Util::getReq('type', 'int');
|
||||
|
||||
//로그인 검사
|
||||
$session = Session::requireGameLogin()->setReadOnly();
|
||||
$userID = Session::getUserID();
|
||||
@@ -44,21 +47,21 @@ $sel = [$type => "selected"];
|
||||
<tr><td>세 력 장 수<br><?=backButton()?></td></tr>
|
||||
<tr><td><form name=form1 method=post>정렬순서 :
|
||||
<select name=type size=1>
|
||||
<option <?=$sel[1]?> value=1>관직</option>
|
||||
<option <?=$sel[2]?> value=2>계급</option>
|
||||
<option <?=$sel[3]?> value=3>명성</option>
|
||||
<option <?=$sel[4]?> value=4>통솔</option>
|
||||
<option <?=$sel[5]?> value=5>무력</option>
|
||||
<option <?=$sel[6]?> value=6>지력</option>
|
||||
<option <?=$sel[7]?> value=7>자금</option>
|
||||
<option <?=$sel[8]?> value=8>군량</option>
|
||||
<option <?=$sel[9]?> value=9>병사</option>
|
||||
<option <?=$sel[10]?> value=10>벌점</option>
|
||||
<option <?=$sel[11]?> value=11>성격</option>
|
||||
<option <?=$sel[12]?> value=12>내특</option>
|
||||
<option <?=$sel[13]?> value=13>전특</option>
|
||||
<option <?=$sel[14]?> value=14>사관</option>
|
||||
<option <?=$sel[15]?> value=15>NPC</option>
|
||||
<option <?=$sel[1]??''?> value=1>관직</option>
|
||||
<option <?=$sel[2]??''?> value=2>계급</option>
|
||||
<option <?=$sel[3]??''?> value=3>명성</option>
|
||||
<option <?=$sel[4]??''?> value=4>통솔</option>
|
||||
<option <?=$sel[5]??''?> value=5>무력</option>
|
||||
<option <?=$sel[6]??''?> value=6>지력</option>
|
||||
<option <?=$sel[7]??''?> value=7>자금</option>
|
||||
<option <?=$sel[8]??''?> value=8>군량</option>
|
||||
<option <?=$sel[9]??''?> value=9>병사</option>
|
||||
<option <?=$sel[10]??''?> value=10>벌점</option>
|
||||
<option <?=$sel[11]??''?> value=11>성격</option>
|
||||
<option <?=$sel[12]??''?> value=12>내특</option>
|
||||
<option <?=$sel[13]??''?> value=13>전특</option>
|
||||
<option <?=$sel[14]??''?> value=14>사관</option>
|
||||
<option <?=$sel[15]??''?> value=15>NPC</option>
|
||||
</select>
|
||||
<input type=submit value='정렬하기'></form>
|
||||
</td></tr>
|
||||
@@ -66,23 +69,46 @@ $sel = [$type => "selected"];
|
||||
<?php
|
||||
|
||||
$nationLevel = DB::db()->queryFirstField('select level from nation where nation = %i', $me['nation']);
|
||||
$orderByText = '';//FIXME: 쿼리 재작성
|
||||
switch($type) {
|
||||
case 1: $query = "select npc,special,special2,personal,picture,imgsvr,name,level,dedication,experience,injury,leader,power,intel,gold,rice,belong,connect,killturn from general where nation='{$me['nation']}' order by level desc"; break;
|
||||
case 2: $query = "select npc,special,special2,personal,picture,imgsvr,name,level,dedication,experience,injury,leader,power,intel,gold,rice,belong,connect,killturn from general where nation='{$me['nation']}' order by dedication desc"; break;
|
||||
case 3: $query = "select npc,special,special2,personal,picture,imgsvr,name,level,dedication,experience,injury,leader,power,intel,gold,rice,belong,connect,killturn from general where nation='{$me['nation']}' order by experience desc"; break;
|
||||
case 4: $query = "select npc,special,special2,personal,picture,imgsvr,name,level,dedication,experience,injury,leader,power,intel,gold,rice,belong,connect,killturn from general where nation='{$me['nation']}' order by leader desc"; break;
|
||||
case 5: $query = "select npc,special,special2,personal,picture,imgsvr,name,level,dedication,experience,injury,leader,power,intel,gold,rice,belong,connect,killturn from general where nation='{$me['nation']}' order by power desc"; break;
|
||||
case 6: $query = "select npc,special,special2,personal,picture,imgsvr,name,level,dedication,experience,injury,leader,power,intel,gold,rice,belong,connect,killturn from general where nation='{$me['nation']}' order by intel desc"; break;
|
||||
case 7: $query = "select npc,special,special2,personal,picture,imgsvr,name,level,dedication,experience,injury,leader,power,intel,gold,rice,belong,connect,killturn from general where nation='{$me['nation']}' order by gold desc"; break;
|
||||
case 8: $query = "select npc,special,special2,personal,picture,imgsvr,name,level,dedication,experience,injury,leader,power,intel,gold,rice,belong,connect,killturn from general where nation='{$me['nation']}' order by rice desc"; break;
|
||||
case 9: $query = "select npc,special,special2,personal,picture,imgsvr,name,level,dedication,experience,injury,leader,power,intel,gold,rice,belong,connect,killturn from general where nation='{$me['nation']}' order by crew desc"; break;
|
||||
case 10: $query = "select npc,special,special2,personal,picture,imgsvr,name,level,dedication,experience,injury,leader,power,intel,gold,rice,belong,connect,killturn from general where nation='{$me['nation']}' order by connect desc"; break;
|
||||
case 11: $query = "select npc,special,special2,personal,picture,imgsvr,name,level,dedication,experience,injury,leader,power,intel,gold,rice,belong,connect,killturn from general where nation='{$me['nation']}' order by personal"; break;
|
||||
case 12: $query = "select npc,special,special2,personal,picture,imgsvr,name,level,dedication,experience,injury,leader,power,intel,gold,rice,belong,connect,killturn from general where nation='{$me['nation']}' order by special desc"; break;
|
||||
case 13: $query = "select npc,special,special2,personal,picture,imgsvr,name,level,dedication,experience,injury,leader,power,intel,gold,rice,belong,connect,killturn from general where nation='{$me['nation']}' order by special2 desc"; break;
|
||||
case 14: $query = "select npc,special,special2,personal,picture,imgsvr,name,level,dedication,experience,injury,leader,power,intel,gold,rice,belong,connect,killturn from general where nation='{$me['nation']}' order by belong desc"; break;
|
||||
case 15: $query = "select npc,special,special2,personal,picture,imgsvr,name,level,dedication,experience,injury,leader,power,intel,gold,rice,belong,connect,killturn from general where nation='{$me['nation']}' order by npc desc"; break;
|
||||
case 1: $orderByText = " order by level desc"; break;
|
||||
case 2: $orderByText = " order by dedication desc"; break;
|
||||
case 3: $orderByText = " order by experience desc"; break;
|
||||
case 4: $orderByText = " order by leader desc"; break;
|
||||
case 5: $orderByText = " order by power desc"; break;
|
||||
case 6: $orderByText = " order by intel desc"; break;
|
||||
case 7: $orderByText = " order by gold desc"; break;
|
||||
case 8: $orderByText = " order by rice desc"; break;
|
||||
case 9: $orderByText = " order by crew desc"; break;
|
||||
case 10: $orderByText = " order by connect desc"; break;
|
||||
case 11: $orderByText = " order by personal"; break;
|
||||
case 12: $orderByText = " order by special desc"; break;
|
||||
case 13: $orderByText = " order by special2 desc"; break;
|
||||
case 14: $orderByText = " order by belong desc"; break;
|
||||
case 15: $orderByText = " order by npc desc"; break;
|
||||
}
|
||||
$query =
|
||||
"select
|
||||
npc,
|
||||
special,
|
||||
special2,
|
||||
personal,
|
||||
picture,
|
||||
imgsvr,
|
||||
name,
|
||||
level,
|
||||
dedication,
|
||||
experience,
|
||||
injury,
|
||||
leader,
|
||||
power,
|
||||
intel,
|
||||
gold,
|
||||
rice,
|
||||
belong,
|
||||
connect,
|
||||
killturn
|
||||
from general where nation='{$me['nation']}' ".$orderByText;
|
||||
$genresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$gencount = MYDB_num_rows($genresult);
|
||||
|
||||
@@ -143,7 +169,7 @@ for($j=0; $j < $gencount; $j++) {
|
||||
<tr>
|
||||
<td align=center background={$imageTemp}/{$general['picture']} height=64></td>
|
||||
<td align=center>$name</td>
|
||||
<td align=center>"; echo getLevel($general['level'], $nation['level']); echo "</td>
|
||||
<td align=center>"; echo getLevel($general['level'], $nationLevel); echo "</td>
|
||||
<td align=center>".getDed($general['dedication'])."</td>
|
||||
<td align=center>".getHonor($general['experience'])."</td>
|
||||
<td align=center>".getBill($general['dedication'])."</td>
|
||||
|
||||
+5
-3
@@ -3,6 +3,9 @@ namespace sammo;
|
||||
|
||||
include "lib.php";
|
||||
include "func.php";
|
||||
|
||||
$btn = Util::getReq('btn');
|
||||
|
||||
//로그인 검사
|
||||
$session = Session::requireGameLogin()->setReadOnly();
|
||||
$userID = Session::getUserID();
|
||||
@@ -47,13 +50,12 @@ $me = MYDB_fetch_array($result);
|
||||
<head>
|
||||
<meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'>
|
||||
<title>내정보</title>
|
||||
<link href="../d_shared/common.css" red="stylesheet">
|
||||
<link href="../d_shared/common.css" rel="stylesheet">
|
||||
<link rel=stylesheet href="css/common.css">
|
||||
<script type="text/javascript">
|
||||
function go(type) {
|
||||
if(type == 0){
|
||||
//location.replace('c_vacation.php');
|
||||
console.log('c_vacation.php');//TODO:debug all and replace
|
||||
location.replace('c_vacation.php');
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
+42
-18
@@ -82,7 +82,7 @@ if ($session->userGrade >= 5) {
|
||||
}
|
||||
|
||||
if ($admin['tournament'] == 0) {
|
||||
echo "
|
||||
?>
|
||||
<select name=auto size=1 style=color:white;background-color:black;>
|
||||
<option style=color:white; value=0>수동진행</option>
|
||||
<option style=color:white; value=1>12분 05일</option>
|
||||
@@ -101,18 +101,19 @@ if ($session->userGrade >= 5) {
|
||||
</select>
|
||||
<input type=submit name=btn value='개최'>
|
||||
<select name=trig size=1 style=color:white;background-color:black;>
|
||||
<option style=color:white; value=0 {$sel[0]}>수동진행</option>
|
||||
<option style=color:white; value=1 {$sel[1]}>12분 05일</option>
|
||||
<option style=color:white; value=2 {$sel[2]}>07분 10시</option>
|
||||
<option style=color:white; value=3 {$sel[3]}>03분 04시</option>
|
||||
<option style=color:white; value=4 {$sel[4]}>01분 82분</option>
|
||||
<option style=color:white; value=5 {$sel[5]}>30초 41분</option>
|
||||
<option style=color:white; value=6 {$sel[6]}>15초 21분</option>
|
||||
<option style=color:white; value=7 {$sel[7]}>05초 07분</option>
|
||||
<option style=color:white; value=0 <?=$sel[0]??''?>>수동진행</option>
|
||||
<option style=color:white; value=1 <?=$sel[1]??''?>>12분 05일</option>
|
||||
<option style=color:white; value=2 <?=$sel[2]??''?>>07분 10시</option>
|
||||
<option style=color:white; value=3 <?=$sel[3]??''?>>03분 04시</option>
|
||||
<option style=color:white; value=4 <?=$sel[4]??''?>>01분 82분</option>
|
||||
<option style=color:white; value=5 <?=$sel[5]??''?>>30초 41분</option>
|
||||
<option style=color:white; value=6 <?=$sel[6]??''?>>15초 21분</option>
|
||||
<option style=color:white; value=7 <?=$sel[7]??''?>>05초 07분</option>
|
||||
</select>
|
||||
<input type=submit name=btn value='자동개최설정'>
|
||||
<input type=submit name=btn value='포상'>
|
||||
<input type=submit name=btn value='회수'>";
|
||||
<input type=submit name=btn value='회수'>
|
||||
<?php
|
||||
} else {
|
||||
echo "<input type=submit name=btn value='중단' onclick='return confirm(\"진짜 중단하시겠습니까?\")'>";
|
||||
}
|
||||
@@ -191,7 +192,11 @@ echo "
|
||||
$query = "select npc,name,win from tournament where grp>=60 order by grp, grp_no";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
|
||||
for ($i=0; $i < 1; $i++) {
|
||||
$general = MYDB_fetch_array($result);
|
||||
$general = MYDB_fetch_array($result) ?? [
|
||||
'name'=>'',
|
||||
'npc'=>0,
|
||||
'win'=>0
|
||||
];
|
||||
if ($general['name'] == "") {
|
||||
$general['name'] = "-";
|
||||
}
|
||||
@@ -215,7 +220,13 @@ for ($i=0; $i < 1; $i++) {
|
||||
}
|
||||
$line = [];
|
||||
for ($i=0; $i < 2; $i++) {
|
||||
$general = MYDB_fetch_array($result);
|
||||
//FIXME: 다시 작성. null인 경우엔 어쩌려고?
|
||||
$general = MYDB_fetch_array($result) ?? [
|
||||
'name'=>'',
|
||||
'npc'=>0,
|
||||
'win'=>0
|
||||
];
|
||||
|
||||
if ($general['name'] == "") {
|
||||
$general['name'] = "-";
|
||||
}
|
||||
@@ -256,7 +267,11 @@ for ($i=0; $i < 2; $i++) {
|
||||
$cent[$i] = "<font color=white>";
|
||||
}
|
||||
for ($i=0; $i < 4; $i++) {
|
||||
$general = MYDB_fetch_array($result);
|
||||
$general = MYDB_fetch_array($result) ?? [
|
||||
'name'=>'',
|
||||
'npc'=>0,
|
||||
'win'=>0
|
||||
];
|
||||
if ($general['name'] == "") {
|
||||
$general['name'] = "-";
|
||||
}
|
||||
@@ -297,7 +312,11 @@ for ($i=0; $i < 4; $i++) {
|
||||
$cent[$i] = "<font color=white>";
|
||||
}
|
||||
for ($i=0; $i < 8; $i++) {
|
||||
$general = MYDB_fetch_array($result);
|
||||
$general = MYDB_fetch_array($result) ?? [
|
||||
'name'=>'',
|
||||
'npc'=>0,
|
||||
'win'=>0
|
||||
];
|
||||
if ($general['name'] == "") {
|
||||
$general['name'] = "-";
|
||||
}
|
||||
@@ -338,7 +357,11 @@ for ($i=0; $i < 8; $i++) {
|
||||
$cent[$i] = "<font color=white>";
|
||||
}
|
||||
for ($i=0; $i < 16; $i++) {
|
||||
$general = MYDB_fetch_array($result);
|
||||
$general = MYDB_fetch_array($result) ?? [
|
||||
'name'=>'',
|
||||
'npc'=>0,
|
||||
'win'=>0
|
||||
];
|
||||
if ($general['name'] == "") {
|
||||
$general['name'] = "-";
|
||||
}
|
||||
@@ -377,10 +400,11 @@ $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "
|
||||
$betting = MYDB_fetch_array($result);
|
||||
$bet = [];
|
||||
for ($i=0; $i < 16; $i++) {
|
||||
$bet[$i] = @round($betting['bet'] / $betting["bet{$i}"], 2);
|
||||
if ($bet[$i] == 0) {
|
||||
$bet[$i] = "∞";
|
||||
if($betting['bet'] == 0){
|
||||
$bet[$i] = '∞';
|
||||
continue;
|
||||
}
|
||||
$bet[$i] = round($betting['bet'] / $betting["bet{$i}"], 2);
|
||||
}
|
||||
|
||||
echo "
|
||||
|
||||
@@ -15,6 +15,7 @@ $v->rule('integer', [
|
||||
'sel'
|
||||
]);
|
||||
|
||||
$btn = Util::getReq('btn');
|
||||
$amount = Util::getReq('amount', 'int');
|
||||
$cost = Util::getReq('cost', 'int');
|
||||
$topv = Util::getReq('topv', 'int');
|
||||
|
||||
@@ -52,10 +52,4 @@ if(getBlockLevel() != 1 && getBlockLevel() != 3) {
|
||||
}
|
||||
}
|
||||
|
||||
//echo "<script>location.replace('b_chiefboard.php');</script>";
|
||||
echo 'b_chiefboard.php';//TODO:debug all and replace
|
||||
?>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
header('location:b_chiefboard.php');
|
||||
+2
-7
@@ -23,12 +23,9 @@ $query = "select no,nation,level from general where owner='{$userID}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$me = MYDB_fetch_array($result);
|
||||
|
||||
$btn = $_POST['btn'];
|
||||
|
||||
//내가 수뇌부이어야함
|
||||
if($me['level'] < 5) {
|
||||
//echo "<script>location.replace('b_myBossInfo.php');</script>";
|
||||
echo 'b_myBossInfo.php';//TODO:debug all and replace
|
||||
header('location:b_myBossInfo.php');
|
||||
exit();
|
||||
}
|
||||
|
||||
@@ -69,7 +66,5 @@ if($btn == "국가방침") {
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
}
|
||||
|
||||
//echo "<script>location.replace('b_dipcenter.php');</script>";
|
||||
echo 'b_dipcenter.php';//TODO:debug all and replace
|
||||
|
||||
header('location:b_dipcenter.php');
|
||||
|
||||
|
||||
+26
-17
@@ -61,9 +61,13 @@ if($command == 46) {
|
||||
$query['turn'.$turnIdx] = $comStr;
|
||||
}
|
||||
$db->update('general', $query, 'owner=%i', $userID);
|
||||
header('Location:index.php');
|
||||
header('Location:./');
|
||||
die();
|
||||
|
||||
}
|
||||
|
||||
//통합제의
|
||||
} elseif($command == 53) {
|
||||
if($command == 53) {
|
||||
$query = "select nation,level from general where owner='{$userID}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$me = MYDB_fetch_array($result);
|
||||
@@ -87,10 +91,12 @@ if($command == 46) {
|
||||
$query = "update nation set {$str} where nation='{$me['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
}
|
||||
//echo "<script>location.replace('b_chiefcenter.php');</script>";
|
||||
echo 'b_chiefcenter.php';//TODO:debug all and replace
|
||||
header('location:b_chiefcenter.php');
|
||||
die();
|
||||
}
|
||||
|
||||
//불가침
|
||||
} elseif($command == 61) {
|
||||
if($command == 61) {
|
||||
$query = "select nation,level from general where owner='{$userID}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$me = MYDB_fetch_array($result);
|
||||
@@ -113,13 +119,16 @@ if($command == 46) {
|
||||
$query = "update nation set {$str} where nation='{$me['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
}
|
||||
//echo "<script>location.replace('b_chiefcenter.php');</script>";
|
||||
echo 'b_chiefcenter.php';//TODO:debug all and replace
|
||||
|
||||
header('location:b_chiefcenter.php');
|
||||
die();
|
||||
}
|
||||
|
||||
//포상, 몰수, 발령, 항복권고, 원조
|
||||
//선전포고, 종전, 파기, 초토화, 천도, 증축, 감축
|
||||
//백성동원, 수몰, 허보, 피장파장, 의병모집, 이호경식, 급습
|
||||
//국기변경
|
||||
} elseif($command == 23 || $command == 24 || $command == 27 || $command == 51 || $command == 52 || $command > 60) {
|
||||
if($command == 23 || $command == 24 || $command == 27 || $command == 51 || $command == 52 || $command > 60) {
|
||||
$query = "select no,nation,level from general where owner='{$userID}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$me = MYDB_fetch_array($result);
|
||||
@@ -135,15 +144,15 @@ if($command == 46) {
|
||||
$query = "update nation set {$str} where nation='{$me['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
}
|
||||
//echo "<script>location.replace('b_chiefcenter.php');</script>";
|
||||
echo 'b_chiefcenter.php';//TODO:debug all and replace
|
||||
} else {
|
||||
$query = [];
|
||||
foreach($turn as $turnIdx){
|
||||
$query['turn'.$turnIdx] = $comStr;
|
||||
}
|
||||
$db->update('general', $query, 'owner=%i', $userID);
|
||||
header('Location:index.php');
|
||||
header('location:b_chiefcenter.php');
|
||||
die();
|
||||
}
|
||||
|
||||
//일반 턴
|
||||
$query = [];
|
||||
foreach($turn as $turnIdx){
|
||||
$query['turn'.$turnIdx] = $comStr;
|
||||
}
|
||||
$db->update('general', $query, 'owner=%i', $userID);
|
||||
header('Location:./');
|
||||
|
||||
|
||||
+21
-12
@@ -33,7 +33,7 @@ $ruler = MYDB_fetch_array($result);
|
||||
|
||||
//수뇌가 아니면 아무것도 할 수 없음
|
||||
if($meLevel < 5){
|
||||
echo 'b_myBossInfo.php';//TODO:debug all and replace
|
||||
header('location:b_myBossInfo.php');
|
||||
exit();
|
||||
}
|
||||
|
||||
@@ -45,8 +45,8 @@ if($btn == "임명") {
|
||||
|
||||
//임명할사람이 군주이면 불가, 내가 수뇌부이어야함, 공석아닌때는 국가가 같아야함
|
||||
if($general['level'] == 12 || $meLevel < 5 || ($general['nation'] != $me['nation'] && $genlist != 0)) {
|
||||
//echo "<script>location.replace('b_myBossInfo.php');</script>";
|
||||
echo 'b_myBossInfo.php';//TODO:debug all and replace
|
||||
|
||||
header('location:b_myBossInfo.php');
|
||||
exit();
|
||||
}
|
||||
} elseif($btn == "추방") {
|
||||
@@ -56,15 +56,14 @@ if($btn == "임명") {
|
||||
|
||||
//추방할사람이 군주이면 불가, 내가 수뇌부이어야함, 공석아닌때는 국가가 같아야함
|
||||
if($general['level'] == 12 || $meLevel < 5 || ($general['nation'] != $me['nation'] && $outlist != 0)) {
|
||||
//echo "<script>location.replace('b_myBossInfo.php');</script>";
|
||||
echo 'b_myBossInfo.php';//TODO:debug all and replace
|
||||
header('location:b_myBossInfo.php');
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
//나와 대상 장수는 국가가 같아야 함
|
||||
if($me['nation'] != $general['nation']){
|
||||
echo 'b_myBossInfo.php';//TODO:debug all and replace
|
||||
header('location:b_myBossInfo.php');
|
||||
exit();
|
||||
}
|
||||
|
||||
@@ -188,7 +187,11 @@ if($btn == "추방") {
|
||||
pushGenLog($general, $log);
|
||||
pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']);
|
||||
}
|
||||
} elseif($btn == "임명" && $level >= 5 && $level <= 11) {
|
||||
header('location:b_myBossInfo.php');
|
||||
die();
|
||||
}
|
||||
|
||||
if($btn == "임명" && $level >= 5 && $level <= 11) {
|
||||
$query = "select l{$level}set,level,chemi from nation where nation='{$me['nation']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$nation = MYDB_fetch_array($result);
|
||||
@@ -235,7 +238,12 @@ if($btn == "추방") {
|
||||
}
|
||||
}
|
||||
}
|
||||
} elseif($btn == "임명" && $level >= 2 && $level <= 4 && $citylist > 0) {
|
||||
header('location:b_myBossInfo.php');
|
||||
die();
|
||||
}
|
||||
|
||||
|
||||
if($btn == "임명" && $level >= 2 && $level <= 4 && $citylist > 0) {
|
||||
switch($level) {
|
||||
case 4: $lv = 1; break;
|
||||
case 3: $lv = 2; break;
|
||||
@@ -246,8 +254,7 @@ if($btn == "추방") {
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$city = MYDB_fetch_array($result);
|
||||
if(!$city){
|
||||
//echo "<script>location.replace('b_myBossInfo.php');</script>";
|
||||
echo 'b_myBossInfo.php';//TODO:debug all and replace
|
||||
header('location:b_myBossInfo.php');
|
||||
die();
|
||||
}
|
||||
$oldlist = $city["gen{$lv}"];
|
||||
@@ -283,9 +290,11 @@ if($btn == "추방") {
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
}
|
||||
}
|
||||
header('location:b_myBossInfo.php');
|
||||
die();
|
||||
}
|
||||
|
||||
//echo "<script>location.replace('b_myBossInfo.php');</script>";
|
||||
echo 'b_myBossInfo.php';//TODO:debug all and replace
|
||||
|
||||
header('location:b_myBossInfo.php');
|
||||
|
||||
|
||||
|
||||
@@ -50,11 +50,4 @@ if(getBlockLevel() != 1 && getBlockLevel() != 3) {
|
||||
}
|
||||
}
|
||||
|
||||
//echo "<script>location.replace('b_nationboard.php');</script>";
|
||||
echo 'b_nationboard.php';//TODO:debug all and replace
|
||||
|
||||
?>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
header('location:b_nationboard.php');
|
||||
|
||||
@@ -21,6 +21,4 @@ $msg = addslashes(SQ2DQ($msg));
|
||||
$query = "update nation set rule='$msg' where nation='{$me['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
|
||||
//echo "<script>location.replace('b_nationrule.php');</script>";
|
||||
echo 'b_nationrule.php';//TODO:debug all and replace
|
||||
|
||||
header('location:b_nationrule.php');
|
||||
+11
-5
@@ -4,6 +4,8 @@ namespace sammo;
|
||||
include "lib.php";
|
||||
include "func.php";
|
||||
// $btn, $msg
|
||||
$btn = Util::getReq('btn');
|
||||
$msg = Util::getReq('msg');
|
||||
$gen = Util::getReq('gen', 'int');
|
||||
$sel = Util::getReq('sel', 'int');
|
||||
|
||||
@@ -33,7 +35,10 @@ case 2: $tp = "power"; $tp2 = "일기토"; $tp3 = "power"; break;
|
||||
case 3: $tp = "intel"; $tp2 = "설전"; $tp3 = "intel"; break;
|
||||
}
|
||||
|
||||
if($me['tournament'] == 1 && $session->userGrade < 5) { echo "<script>location.replace('b_tournament.php');</script>"; exit(); }
|
||||
if($me['tournament'] == 1 && $session->userGrade < 5) {
|
||||
header('locatoin:b_tournament.php');
|
||||
exit();
|
||||
}
|
||||
|
||||
if($btn == "자동개최설정" && $session->userGrade >= 5) {
|
||||
$db->update('game', ['tnmt_trig'=>$trig], true);
|
||||
@@ -101,7 +106,10 @@ if($btn == "자동개최설정" && $session->userGrade >= 5) {
|
||||
$general = MYDB_fetch_array($result);
|
||||
|
||||
//{$admin['develcost']}원 참가비
|
||||
if($general['gold'] < $admin['develcost']) { echo "<script>location.replace('b_tournament.php');</script>"; exit(1); }
|
||||
if($general['gold'] < $admin['develcost']) {
|
||||
header('location:b_tournament.php');
|
||||
exit(1);
|
||||
}
|
||||
$general['gold'] -= $admin['develcost'];
|
||||
}
|
||||
|
||||
@@ -216,7 +224,5 @@ if($btn == "자동개최설정" && $session->userGrade >= 5) {
|
||||
$query = "update game set tnmt_msg='$msg'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
}
|
||||
?>
|
||||
|
||||
<!--<script>location.replace('b_tournament.php');</script> //TODO:debug all and replace -->
|
||||
b_tournament.php
|
||||
header('location:b_tournament.php');
|
||||
+2
-2
@@ -19,6 +19,6 @@ $admin['killturn'] *= 3;
|
||||
$query = "update general set killturn='{$admin['killturn']}' where owner='{$userID}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
|
||||
//echo "<script>location.replace('b_myPage.php');</script>";
|
||||
echo 'b_myPage.php'; //TODO:debug all and replace
|
||||
|
||||
header('location:b_myPage.php');
|
||||
|
||||
|
||||
+2
-5
@@ -56,8 +56,7 @@ else if($btn == "댓글" && $comment != "") {
|
||||
}
|
||||
|
||||
if($session->userGrade < 5){
|
||||
echo "<!--<script>location.replace('a_vote.php');</script>"; //TODO:debug all and replace -->
|
||||
echo 'a_vote.php ';
|
||||
header('location:a_vote.php');
|
||||
die();
|
||||
}
|
||||
|
||||
@@ -96,7 +95,5 @@ if($btn == "수정") {
|
||||
$query = "update game set voteopen=2";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
}
|
||||
?>
|
||||
|
||||
<!--<script>location.replace('a_vote.php');</script>"; //TODO:debug all and replace -->
|
||||
a_vote.php
|
||||
header('location:a_vote.php');
|
||||
@@ -48,6 +48,10 @@ select { font-family:'굴림'; line-height:100%; }
|
||||
content:"◆";
|
||||
}
|
||||
|
||||
.small_war_log{
|
||||
display:inline-block;
|
||||
}
|
||||
|
||||
.small_war_log .war_type_attack{
|
||||
color:cyan;
|
||||
}
|
||||
|
||||
+1
-1
@@ -128,5 +128,5 @@ pushGenLog($you, $youlog);
|
||||
//pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']);
|
||||
//pushWorldHistory($history, $admin['year'], $admin['month']);
|
||||
|
||||
echo "<script>location.replace('msglist.php');</script>";
|
||||
header('location:msglist.php');
|
||||
|
||||
|
||||
+1
-2
@@ -109,5 +109,4 @@ pushGenLog($you, $youlog);
|
||||
pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']);
|
||||
pushWorldHistory($history, $admin['year'], $admin['month']);
|
||||
|
||||
echo "<script>location.replace('msglist.php');</script>";
|
||||
|
||||
header('location:msglist.php');
|
||||
|
||||
+1
-2
@@ -114,5 +114,4 @@ pushGenLog($you, $youlog);
|
||||
pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']);
|
||||
pushWorldHistory($history, $admin['year'], $admin['month']);
|
||||
|
||||
echo "<script>location.replace('msglist.php');</script>";
|
||||
|
||||
header('location:msglist.php');
|
||||
|
||||
+1
-1
@@ -148,5 +148,5 @@ pushGenLog($you, $youlog);
|
||||
pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']);
|
||||
pushWorldHistory($history, $admin['year'], $admin['month']);
|
||||
|
||||
echo "<script>location.replace('msglist.php');</script>";
|
||||
header('location:msglist.php');
|
||||
|
||||
|
||||
+1
-2
@@ -174,5 +174,4 @@ pushGenLog($you, $youlog);
|
||||
pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']);
|
||||
//pushWorldHistory($history, $admin['year'], $admin['month']);
|
||||
|
||||
echo "<script>location.replace('msglist.php');</script>";
|
||||
|
||||
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->throw_exception_on_error = true;
|
||||
self::$uDB->throw_exception_on_nonsql_error = true;
|
||||
}
|
||||
return self::$uDB;
|
||||
}
|
||||
|
||||
+1
-2
@@ -137,5 +137,4 @@ pushGenLog($you, $youlog);
|
||||
pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']);
|
||||
pushWorldHistory($history, $admin['year'], $admin['month']);
|
||||
|
||||
echo "<script>location.replace('msglist.php');</script>";
|
||||
|
||||
header('location:msglist.php');
|
||||
+23
-7
@@ -75,11 +75,25 @@ function GetImageURL($imgsvr) {
|
||||
}
|
||||
}
|
||||
|
||||
function checkLimit($con, $conlimit) {
|
||||
/**
|
||||
* @param null|int $con 장수의 벌점
|
||||
* @param null|int $conlimit 최대 벌점
|
||||
*/
|
||||
function checkLimit($con = null, $conlimit = null) {
|
||||
$session = Session::getInstance();
|
||||
if($session->userGrade>=4){
|
||||
return 0;
|
||||
}
|
||||
|
||||
$db = DB::db();
|
||||
|
||||
if($con === null){
|
||||
$con = $db->queryFirstField('SELECT con FROM general WHERE `owner`=%i', Session::getUserID());
|
||||
}
|
||||
if($conlimit === null){
|
||||
$conlimit = $db->queryFirstField('SELECT conlimit FROM game LIMIT 1');
|
||||
}
|
||||
|
||||
if($con > $conlimit) {
|
||||
return 2;
|
||||
//접속제한 90%이면 경고문구
|
||||
@@ -1334,7 +1348,7 @@ function updateTraffic() {
|
||||
|
||||
$date = date('Y-m-d H:i:s');
|
||||
//일시|년|월|총갱신|접속자|최다갱신자
|
||||
file_put_contents(__dir__."logs/_traffic.txt",
|
||||
file_put_contents(__dir__."/logs/_traffic.txt",
|
||||
StringUtil::padStringAlignRight($date,20," ")
|
||||
."|".StringUtil::padStringAlignRight($game['year'],3," ")
|
||||
."|".StringUtil::padStringAlignRight($game['month'],2," ")
|
||||
@@ -1349,7 +1363,7 @@ function CheckOverhead() {
|
||||
$db = DB::db();
|
||||
$admin = $db->queryFirstRow('SELECT turnterm, conlimit from GAME LIMIT 1');
|
||||
|
||||
$con = $admin['turnterm'] * 6;
|
||||
$con = Util::round(pow($admin['turnterm'], 0.6) * 3) * 10;
|
||||
|
||||
|
||||
if($con != $admin['conlimit']){
|
||||
@@ -1513,7 +1527,7 @@ function checkTurn() {
|
||||
// 파일락 해제
|
||||
if(!flock($fp, LOCK_UN)) { return; }
|
||||
// 세마포어 해제
|
||||
//if(!@sem_release($sema)) { echo "치명적 에러! 유기체에게 문의하세요!"; exit(1); }
|
||||
//if(!@sem_release($sema)) { echo "치명적 에러! Hide_D에게 문의하세요!"; exit(1); }
|
||||
|
||||
pushLockLog(["- checkTurn() 입 : ".date('Y-m-d H:i:s')." : ".$session->userName]);
|
||||
|
||||
@@ -2143,13 +2157,12 @@ function CheckHall($no) {
|
||||
function uniqueItem($general, $log, $vote=0) {
|
||||
$db = DB::db();
|
||||
$connect=$db->get();
|
||||
$log = [];
|
||||
$alllog = [];
|
||||
$history = [];
|
||||
$occupied = [];
|
||||
$item = [];
|
||||
|
||||
if($general['npc'] >= 2 || $general['betray'] > 1) { return $log; }
|
||||
if($general['npc'] >= 2) { return $log; }
|
||||
if($general['weap'] > 6 || $general['book'] > 6 || $general['horse'] > 6 || $general['item'] > 6) { return $log; }
|
||||
|
||||
$query = "select year,month,scenario from game limit 1";
|
||||
@@ -2532,6 +2545,9 @@ function searchDistance(int $from, int $maxDist=99, bool $distForm = false) {
|
||||
|
||||
while(!$queue->isEmpty()){
|
||||
list($cityID, $dist) = $queue->dequeue();
|
||||
if(key_exists($cityID, $cities)){
|
||||
continue;
|
||||
}
|
||||
|
||||
if(!key_exists($dist, $distanceList)){
|
||||
$distanceList[$dist] = [];
|
||||
@@ -2540,7 +2556,7 @@ function searchDistance(int $from, int $maxDist=99, bool $distForm = false) {
|
||||
|
||||
$cities[$cityID] = $dist;
|
||||
if($dist >= $maxDist){
|
||||
return;
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach(array_keys(CityConst::byID($cityID)->path) as $connCityID){
|
||||
|
||||
+32
-16
@@ -14,9 +14,9 @@ function getTurn($general, $type, $font=1) {
|
||||
$turn[2] = $general["turn2"];
|
||||
$turn[3] = $general["turn3"];
|
||||
$turn[4] = $general["turn4"];
|
||||
$turn[5] = $general["turn5"];
|
||||
}
|
||||
if($type >= 2) {
|
||||
$turn[5] = $general["turn5"];
|
||||
$turn[6] = $general["turn6"];
|
||||
$turn[7] = $general["turn7"];
|
||||
$turn[8] = $general["turn8"];
|
||||
@@ -694,9 +694,8 @@ function command_Single($turn, $command) {
|
||||
}
|
||||
$query = "update general set {$str} where owner='{$userID}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
//echo "<script>location.replace('commandlist.php');</script>";
|
||||
echo 'commandlist.php';//TODO:debug all and replace
|
||||
|
||||
|
||||
header('location:commandlist.php');
|
||||
}
|
||||
|
||||
function command_Chief($turn, $command) {
|
||||
@@ -719,23 +718,40 @@ function command_Chief($turn, $command) {
|
||||
$query = "update nation set {$str} where nation='{$me['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
}
|
||||
//echo "<script>location.replace('b_chiefcenter.php');</script>";
|
||||
echo 'b_chiefcenter.php';//TODO:debug all and replace
|
||||
header('location:b_chiefcenter.php');
|
||||
}
|
||||
|
||||
function command_Other($turn, $commandtype) {
|
||||
$db = DB::db();
|
||||
$connect=$db->get();
|
||||
|
||||
echo "<form name=form1 action=processing.php method=post target=_parent>";
|
||||
$count = count($turn);
|
||||
for($i=0; $i < $count; $i++) {
|
||||
echo "<input type=hidden name=turn[] value=$turn[$i]>";
|
||||
$target = "processing.php?commandtype={$commandtype}";
|
||||
foreach($turn as $turnItem){
|
||||
$target.="&turn[]={$turnItem}";
|
||||
}
|
||||
echo "<input type=hidden name=commandtype value={$commandtype}>";
|
||||
echo "</form>";
|
||||
echo "a"; // 없으면 파폭에서 아래 스크립트 실행 안됨
|
||||
echo "<script>form1.submit();</script>";
|
||||
$target.="&".mt_rand();
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="ko">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||
<script>
|
||||
parent.moveProcessing(<?=$commandtype?>, <?=Json::encode($turn)?>);
|
||||
</script>
|
||||
</head>
|
||||
<body style="background-color:black;">
|
||||
|
||||
</body>
|
||||
</html>
|
||||
<?php
|
||||
|
||||
/*
|
||||
<form name='form1' action='processing.php' method='post' target=_parent>
|
||||
<?php foreach($turn as $turnItem): ?>
|
||||
<input type='hidden' name='turn[]' value='<?=$turnItem?>'>
|
||||
<?php endforeach; ?>
|
||||
<input type=hidden name=commandtype value=<?=$commandtype?>>
|
||||
</form>
|
||||
<script>*/
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -174,6 +174,7 @@ function getGenSpecial($type) {
|
||||
case 73: $call = '의술'; break;
|
||||
case 74: $call = '격노'; break;
|
||||
case 75: $call = '척사'; break;
|
||||
default: $call = null;
|
||||
}
|
||||
return $call;
|
||||
}
|
||||
@@ -398,7 +399,8 @@ function getBill(int $dedication) : int{
|
||||
function getCost(int $armtype) : int {
|
||||
//FIXME: 정말로 side effect가 없으려면 query는 밖으로 이동해야함.
|
||||
//TODO: 병종 값이 column으로 들어있는건 전혀 옳지 않음. key->value 형태로 바꿔야함
|
||||
return DB::db()->queryFirstColumn('select %b from game limit 1', sprintf('cst%d', $armtype));
|
||||
|
||||
return GameUnitConst::byID($armtype)->cost;
|
||||
}
|
||||
|
||||
function TechLimit($startyear, $year, $tech) : int {
|
||||
|
||||
+66
-34
@@ -237,7 +237,7 @@ function SetNationFront($nationNo) {
|
||||
|
||||
if($adj){
|
||||
$db->update('city', [
|
||||
'front'=>0
|
||||
'front'=>1
|
||||
], 'nation=%i and city in %li', $nationNo, array_keys($adj));
|
||||
}
|
||||
}
|
||||
@@ -382,7 +382,7 @@ function preUpdateMonthly() {
|
||||
}
|
||||
pushWorldHistory($history, $admin['year'], $admin['month']);
|
||||
//민심30이하 공백지 처리
|
||||
$query = "update city set nation='0',gen1='0',gen2='0',gen3='0',conflict='',conflict2='',term=0,front=0 where rate<='30' and supply='0'";
|
||||
$query = "update city set nation='0',gen1='0',gen2='0',gen3='0',conflict='{}',term=0,front=0 where rate<='30' and supply='0'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
|
||||
// 우선 병사수/100 만큼 소비
|
||||
@@ -440,7 +440,7 @@ function preUpdateMonthly() {
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$query = "update city set term=term-1 where term>0";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$query = "update city set conflict='',conflict2='' where term=0";
|
||||
$query = "update city set conflict='{}' where term=0";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$query = "update city set state=0 where state=41";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
@@ -753,7 +753,7 @@ function checkMerge() {
|
||||
$query = "delete from nation where nation='{$me['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
// 아국 모든 도시들 상대국 소속으로
|
||||
$query = "update city set nation='{$you['nation']}',gen1='0',gen2='0',gen3='0',conflict='',conflict2='' where nation='{$me['nation']}'";
|
||||
$query = "update city set nation='{$you['nation']}',gen1='0',gen2='0',gen3='0',conflict='{}' where nation='{$me['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
// 아국 모든 장수들 일반으로 하고 상대국 소속으로, 수도로 이동
|
||||
$query = "update general set belong=1,level=1,nation='{$you['nation']}' where nation='{$me['nation']}'";
|
||||
@@ -884,7 +884,7 @@ function checkSurrender() {
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$king = MYDB_fetch_array($result);
|
||||
// 아국 모든 도시들 상대국 소속으로
|
||||
$query = "update city set nation='{$you['nation']}',gen1='0',gen2='0',gen3='0',conflict='',conflict2='' where nation='{$me['nation']}'";
|
||||
$query = "update city set nation='{$you['nation']}',gen1='0',gen2='0',gen3='0',conflict='{}' where nation='{$me['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
// 제의국 모든 장수들 공헌도0.95, 명성0.95
|
||||
$query = "update general set dedication=dedication*0.95,experience=experience*0.95 where nation='{$you['nation']}'";
|
||||
@@ -1050,12 +1050,16 @@ function checkStatistic() {
|
||||
|
||||
$nationName .= $nation['name'].'('.getNationType($nation['type']).'), ';
|
||||
$power_hist .= "{$nation['name']}({$nation['power']}/{$nation['gennum']}/{$city['cnt']}/{$city['pop']}/{$city['pop2']}/{$nation['goldrice']}/{$general['goldrice']}/{$general['abil']}/{$general['dex']}/{$general['expded']}), ";
|
||||
|
||||
if(!isset($nationHists[$nation['type']])){
|
||||
$nationHists[$nation['type']] = 0;
|
||||
}
|
||||
$nationHists[$nation['type']]++;
|
||||
}
|
||||
|
||||
$nationHist = '';
|
||||
for($i=1; $i <= 13; $i++) {
|
||||
if(!$nationHists[$i]) { $nationHists[$i] = '-'; }
|
||||
if(!Util::array_get($nationHists[$i])) { $nationHists[$i] = '-'; }
|
||||
$nationHist .= getNationType($i)."({$nationHists[$i]}), ";
|
||||
}
|
||||
|
||||
@@ -1073,6 +1077,18 @@ function checkStatistic() {
|
||||
for($i=0; $i < $generalCount; $i++) {
|
||||
$general = MYDB_fetch_array($result);
|
||||
|
||||
if(!isset($personalHists[$general['personal']])){
|
||||
$personalHists[$general['personal']] = 0;
|
||||
}
|
||||
|
||||
if(!isset($specialHists[$general['special']])){
|
||||
$specialHists[$general['special']] = 0;
|
||||
}
|
||||
|
||||
if(!isset($specialHists2[$general['special2']])){
|
||||
$specialHists2[$general['special2']] = 0;
|
||||
}
|
||||
|
||||
$personalHists[$general['personal']]++;
|
||||
$specialHists[$general['special']]++;
|
||||
$specialHists2[$general['special2']]++;
|
||||
@@ -1082,14 +1098,14 @@ function checkStatistic() {
|
||||
|
||||
$personalHist = '';
|
||||
for($i=0; $i < 11; $i++) {
|
||||
if(!$personalHists[$i]) { $personalHists[$i] = '-'; }
|
||||
if(!Util::array_get($personalHists[$i])) { $personalHists[$i] = '-'; }
|
||||
$personalHist .= getGenChar($i)."({$personalHists[$i]}), ";
|
||||
}
|
||||
$specialHist = '';
|
||||
for($i=0; $i < 40; $i++) {
|
||||
$call = getGenSpecial($i);
|
||||
if($call) {
|
||||
if(!$specialHists[$i]) { $specialHists[$i] = '-'; }
|
||||
if(!Util::array_get($specialHists[$i])) { $specialHists[$i] = '-'; }
|
||||
|
||||
$specialHist .= $call."({$specialHists[$i]}), ";
|
||||
}
|
||||
@@ -1099,7 +1115,7 @@ function checkStatistic() {
|
||||
for($i=40; $i < 80; $i++) {
|
||||
$call = getGenSpecial($i);
|
||||
if($call) {
|
||||
if(!$specialHists2[$i]) { $specialHists2[$i] = '-'; }
|
||||
if(!Util::array_get($specialHists2[$i])) { $specialHists2[$i] = '-'; }
|
||||
|
||||
$specialHist .= $call."({$specialHists2[$i]}), ";
|
||||
}
|
||||
@@ -1278,31 +1294,47 @@ function checkEmperior() {
|
||||
|
||||
$nationHistory = DB::db()->queryFirstField('SELECT `history` FROM `nation` WHERE `nation` = %i', $nation['nation']);
|
||||
|
||||
$query = "
|
||||
insert into emperior (
|
||||
phase,
|
||||
nation_count, nation_name, nation_hist,
|
||||
gen_count, personal_hist, special_hist,
|
||||
name, type, color, year, month, power, gennum, citynum,
|
||||
pop, poprate, gold, rice,
|
||||
l12name, l12pic, l11name, l11pic,
|
||||
l10name, l10pic, l9name, l9pic,
|
||||
l8name, l8pic, l7name, l7pic,
|
||||
l6name, l6pic, l5name, l5pic,
|
||||
tiger, eagle, gen, history
|
||||
) values (
|
||||
'-',
|
||||
'$statNC', '{$statNation['nation_name']}', '{$statNation['nation_hist']}',
|
||||
'$statGC', '{$statGeneral['personal_hist']}', '{$statGeneral['special_hist']}',
|
||||
'{$nation['name']}', '{$nation['type']}', '{$nation['color']}', '{$admin['year']}', '{$admin['month']}', '{$nation['power']}', '{$nation['gennum']}', '$allcount',
|
||||
'$pop', '$poprate', '{$nation['gold']}', '{$nation['rice']}',
|
||||
'{$level12['name']}', '{$level12['picture']}', '{$level11['name']}', '{$level11['picture']}',
|
||||
'{$level10['name']}', '{$level10['picture']}', '{$level9['name']}', '{$level9['picture']}',
|
||||
'{$level8['name']}', '{$level8['picture']}', '{$level7['name']}', '{$level7['picture']}',
|
||||
'{$level6['name']}', '{$level6['picture']}', '{$level5['name']}', '{$level5['picture']}',
|
||||
'$tigerstr', '$eaglestr', '$gen', '{$nationHistory}'
|
||||
)";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$db->insert('emperior', [
|
||||
'phase'=>'-',
|
||||
'nation_count'=>$statNC,
|
||||
'nation_name'=>$statNation['nation_name'],
|
||||
'nation_hist'=>$statNation['nation_hist'],
|
||||
'gen_count'=>$statGC,
|
||||
'personal_hist'=>$statGeneral['personal_hist'],
|
||||
'special_hist'=>$statGeneral['special_hist'],
|
||||
'name'=>$nation['name'],
|
||||
'type'=>$nation['type'],
|
||||
'color'=>$nation['color'],
|
||||
'year'=>$admin['year'],
|
||||
'month'=>$admin['month'],
|
||||
'power'=>$nation['power'],
|
||||
'gennum'=>$nation['gennum'],
|
||||
'citynum'=>$allcount,
|
||||
'pop'=>$pop,
|
||||
'poprate'=>$poprate,
|
||||
'gold'=>$nation['gold'],
|
||||
'rice'=>$nation['rice'],
|
||||
'l12name'=>$level12['name'],
|
||||
'l12pic'=>$level12['picture'],
|
||||
'l11name'=>$level11['name'],
|
||||
'l11pic'=>$level11['picture'],
|
||||
'l10name'=>$level10['name'],
|
||||
'l10pic'=>$level10['picture'],
|
||||
'l9name'=>$level9['name'],
|
||||
'l9pic'=>$level9['picture'],
|
||||
'l8name'=>$level8['name'],
|
||||
'l8pic'=>$level8['picture'],
|
||||
'l7name'=>$level7['name'],
|
||||
'l7pic'=>$level7['picture'],
|
||||
'l6name'=>$level6['name'],
|
||||
'l6pic'=>$level6['picture'],
|
||||
'l5name'=>$level5['name'],
|
||||
'l5pic'=>$level5['picture'],
|
||||
'tiger'=>$tigerstr,
|
||||
'eagle'=>$eaglestr,
|
||||
'gen'=>$gen,
|
||||
'history'=>$nationHistory
|
||||
]);
|
||||
|
||||
$history = ["<C>●</>{$admin['year']}년 {$admin['month']}월:<Y><b>【통일】</b></><D><b>{$nation['name']}</b></>(이)가 전토를 통일하였습니다."];
|
||||
pushWorldHistory($history, $admin['year'], $admin['month']);
|
||||
|
||||
+21
-4
@@ -43,6 +43,19 @@ function getFormattedFileLogAll(string $path){
|
||||
}, getRawFileLogAll($path));
|
||||
}
|
||||
|
||||
function eraseTnmtFightLogAll(){
|
||||
foreach(range(0, 49) as $i){
|
||||
eraseTnmtFightLog($i);
|
||||
}
|
||||
}
|
||||
|
||||
function eraseTnmtFightLog(int $group){
|
||||
$filepath = "logs/fight{$group}.txt";
|
||||
if(file_exists($filepath)){
|
||||
@unlink($filepath);
|
||||
}
|
||||
}
|
||||
|
||||
function pushTnmtFightLog(int $group, $log) {
|
||||
pushRawFileLog("logs/fight{$group}.txt", $log);
|
||||
}
|
||||
@@ -84,7 +97,7 @@ function pushAuctionLog($log) {
|
||||
}
|
||||
|
||||
function getAuctionLogRecent(int $count) {
|
||||
return join('<br>', getFormattedFileLogRecent("logs/_auctionlog.txt", $count, 300));
|
||||
return join('<br>', array_reverse(getFormattedFileLogRecent("logs/_auctionlog.txt", $count, 300)));
|
||||
}
|
||||
|
||||
function pushGenLog($general, $log) {
|
||||
@@ -93,7 +106,7 @@ function pushGenLog($general, $log) {
|
||||
}
|
||||
|
||||
function getGenLogRecent(int $no, int $count) {
|
||||
return join('<br>', getFormattedFileLogRecent("logs/gen{$no}.txt", $count, 300));
|
||||
return join('<br>', array_reverse(getFormattedFileLogRecent("logs/gen{$no}.txt", $count, 300)));
|
||||
}
|
||||
|
||||
function pushBatRes($general, $log) {
|
||||
@@ -102,7 +115,7 @@ function pushBatRes($general, $log) {
|
||||
}
|
||||
|
||||
function getBatResRecent(int $no, int $count) {
|
||||
return join('<br>', getFormattedFileLogRecent("logs/batres{$no}.txt", $count, 300));
|
||||
return join('<br>', array_reverse(getFormattedFileLogRecent("logs/batres{$no}.txt", $count, 300)));
|
||||
}
|
||||
|
||||
function pushBatLog($general, $log) {
|
||||
@@ -111,11 +124,14 @@ function pushBatLog($general, $log) {
|
||||
}
|
||||
|
||||
function getBatLogRecent(int $no, int $count) {
|
||||
return join('<br>', getFormattedFileLogRecent("logs/batlog{$no}.txt", $count, 300));
|
||||
return join('<br>', array_reverse(getFormattedFileLogRecent("logs/batlog{$no}.txt", $count, 300)));
|
||||
}
|
||||
|
||||
//DB-based
|
||||
function pushNationHistory($nation, $history) {
|
||||
if(!$nation || !$nation['nation']){
|
||||
return;
|
||||
}
|
||||
DB::db()->query("UPDATE nation set history=concat(%s, history) where nation=%i",
|
||||
$history.'<br>', $nation['nation']);
|
||||
}
|
||||
@@ -226,6 +242,7 @@ function getGeneralPublicRecordWithDate($year, $month) {
|
||||
if(!$texts){
|
||||
return ConvertLog("<C>●</>{$month}월: 기록 없음");
|
||||
}
|
||||
return join('<br>', $texts);
|
||||
}
|
||||
|
||||
function LogHistory($isFirst=0) {
|
||||
|
||||
+6
-7
@@ -41,11 +41,10 @@ function bar($per, $h=7) {
|
||||
}
|
||||
|
||||
|
||||
function OptionsForCitys() {
|
||||
foreach(CityConst::all() as $city){
|
||||
echo "
|
||||
<option value={$city->id}>{$city->name}</option>";
|
||||
}
|
||||
function optionsForCities() {
|
||||
return join('', array_map(function($city){
|
||||
return "<option value='{$city->id}'>{$city->name}</option>";
|
||||
}, CityConst::all()));
|
||||
}
|
||||
|
||||
function Submit($url, $msg="", $msg2="") {
|
||||
@@ -71,7 +70,7 @@ function GetNationColors() {
|
||||
|
||||
function backButton() {
|
||||
return "
|
||||
<input type=button value='돌아가기' onclick=location.replace('index.php')><br>
|
||||
<input type=button value='돌아가기' onclick=location.replace('./')><br>
|
||||
";
|
||||
}
|
||||
|
||||
@@ -88,7 +87,7 @@ function closeButton() {
|
||||
}
|
||||
|
||||
|
||||
function printCitysName(int $cityNo, int $maxDistance=1) {
|
||||
function printCitiesBasedOnDistance(int $cityNo, int $maxDistance=1) {
|
||||
$distanceList = searchDistance($cityNo, $maxDistance, true);
|
||||
|
||||
for($dist = 1; $dist <= $maxDistance; $dist++){
|
||||
|
||||
+2
-42
@@ -1,47 +1,7 @@
|
||||
<?php
|
||||
namespace sammo;
|
||||
|
||||
class Message{
|
||||
//기본 정보
|
||||
public $id;
|
||||
public $mailbox;
|
||||
public $type;
|
||||
public $isSender;
|
||||
/** @var mixed[] */
|
||||
public $src;
|
||||
/** @var mixed[] */
|
||||
public $dest;
|
||||
public $time;
|
||||
public $text;
|
||||
public $option;
|
||||
|
||||
function __construct($row){
|
||||
$db_message = $row['message'];
|
||||
$this->id = $row['id'];
|
||||
$this->mailbox = $row['mailbox'];
|
||||
$this->type = $row['type'];
|
||||
$this->isSender = $row['is_sender'] != 0;
|
||||
$this->src = $db_message['src'];
|
||||
|
||||
if($this->src['nation'] === null){
|
||||
$this->src['nation'] = '재야';
|
||||
$this->src['color'] = '#FFFFFF';
|
||||
$this->src['nation_id'] = null;
|
||||
}
|
||||
|
||||
$this->dest = $db_message['dest'];
|
||||
|
||||
if($this->dest['nation'] === null){
|
||||
$this->dest['nation'] = '재야';
|
||||
$this->dest['color'] = '#FFFFFF';
|
||||
$this->dest['nation_id'] = null;
|
||||
}
|
||||
|
||||
$this->time = $row['time'];
|
||||
$this->text = $db_message['text'];
|
||||
$this->option = $db_message['option'];
|
||||
}
|
||||
}
|
||||
|
||||
function getSingleMessage($messageID){
|
||||
$messageInfo = DB::db()->queryFirstRow('select * from `message` where `id` = %i', $messageID);
|
||||
@@ -135,7 +95,6 @@ function sendRawMessage($msgType, $isSender, $mailbox, $src, $dest, $msg, $date,
|
||||
DB::db()->insert('message', [
|
||||
'address' => $dest,
|
||||
'type' => $msgType,
|
||||
'is_sender' => $isSender,
|
||||
'src' => $src['id'],
|
||||
'dest' => $dest['id'],
|
||||
'time' => $date,
|
||||
@@ -205,6 +164,7 @@ function sendMessage($msgType, array $src, array $dest, $msg, $date = null, $val
|
||||
|
||||
function sendScoutMsg($src, $dest, $date) {
|
||||
|
||||
return false;
|
||||
//$msgType, $isSender, $mailbox, $src, $dest, $msg, $date, $validUntil, $msgOption
|
||||
|
||||
if(!$src || !$src['id'] || !$src['nation_id']){
|
||||
@@ -317,7 +277,7 @@ function DecodeMsg($msg, $type, $who, $date, $bg, $num=0) {
|
||||
|
||||
switch($bg) {
|
||||
case 2:
|
||||
case 4: $bgcolor = "CC6600"; break;
|
||||
case 4: $bgcolor = "#CC6600"; break;
|
||||
}
|
||||
|
||||
if($category == 6) {
|
||||
|
||||
+1
-1
@@ -274,7 +274,7 @@ function processAI($no) {
|
||||
}
|
||||
}
|
||||
|
||||
//유기체메시지 출력 하루 6번
|
||||
//운영자메시지 출력 하루 6번..?
|
||||
//특별 메세지 있는 경우 출력 하루 4번
|
||||
switch($admin['turnterm']) {
|
||||
case 0: $term = 1; break;
|
||||
|
||||
@@ -1253,11 +1253,10 @@ function process_16(&$general) {
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$nation = MYDB_fetch_array($result);
|
||||
|
||||
$query = "select path,nation,supply from city where city='{$general['city']}'";
|
||||
$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);
|
||||
|
||||
$path = explode("|", $city['path']);
|
||||
$command = DecodeCommand($general['turn0']);
|
||||
$destination = $command[1];
|
||||
|
||||
@@ -1273,15 +1272,18 @@ function process_16(&$general) {
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$dip = MYDB_fetch_array($result);
|
||||
|
||||
for($i=0; $i < count($path); $i++) {
|
||||
if($path[$i] == $destination) { $valid = 1; }
|
||||
if(key_exists($destination, CityConst::byID($general['city'])->path)){
|
||||
$nearCity = true;
|
||||
}
|
||||
else{
|
||||
$nearCity = false;
|
||||
}
|
||||
|
||||
if($admin['year'] < $admin['startyear']+3) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:현재 초반 제한중입니다. <G><b>{$destcity['name']}</b></>(으)로 출병 실패. <1>$date</>";
|
||||
// } elseif($city['supply'] == 0) {
|
||||
// $log[] = "<C>●</>{$admin['month']}월:고립된 도시입니다. <G><b>{$destcity['name']}</b></>(으)로 출병 실패. <1>$date</>";
|
||||
} elseif(!$valid) {
|
||||
} elseif(!$nearCity) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:인접도시가 아닙니다. <G><b>{$destcity['name']}</b></>(으)로 출병 실패. <1>$date</>";
|
||||
} elseif($general['level'] == 0) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:재야입니다. <G><b>{$destcity['name']}</b></>(으)로 출병 실패. <1>$date</>";
|
||||
@@ -1590,7 +1592,7 @@ function process_30(&$general) {
|
||||
|
||||
if($destination == $general['city']){
|
||||
$log[] = "<C>●</>{$admin['month']}월:같은 도시입니다. <G><b>{$destcity['name']}</b></>(으)로 강행 실패. <1>$date</>";
|
||||
} elseif(!key_exists($dist[$destination], $dist)) {
|
||||
} elseif(!key_exists($destination, $dist)) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:거리가 멉니다. <G><b>{$destcity['name']}</b></>(으)로 강행 실패. <1>$date</>";
|
||||
} elseif($general['gold'] < $cost) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:자금이 부족합니다. <G><b>{$destcity['name']}</b></>(으)로 강행 실패. <1>$date</>";
|
||||
@@ -2189,7 +2191,7 @@ function process_44(&$general) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:자금이 없습니다. 헌납 실패. <1>$date</>";
|
||||
} elseif($what == 2 && $general['rice'] <= 0) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:군량이 없습니다. 헌납 실패. <1>$date</>";
|
||||
} elseif($general['nation'] != $city['nation'] && $nation['level'] != 0) {
|
||||
} elseif($general['nation'] != $city['nation']) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:아국이 아닙니다. 헌납 실패. <1>$date</>";
|
||||
} elseif($city['supply'] == 0) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:고립된 도시입니다. 헌납 실패. <1>$date</>";
|
||||
|
||||
@@ -935,7 +935,7 @@ function process_65(&$general) {
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
|
||||
//성 공백지로
|
||||
$query = "update city set pop=pop*0.1,rate=50,agri=agri*0.1,comm=comm*0.1,secu=secu*0.1,nation='0',front='0',gen1='0',gen2='0',gen3='0',conflict='',conflict2='' where city='{$destcity['city']}'";
|
||||
$query = "update city set pop=pop*0.1,rate=50,agri=agri*0.1,comm=comm*0.1,secu=secu*0.1,nation='0',front='0',gen1='0',gen2='0',gen3='0',conflict='{}' where city='{$destcity['city']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
|
||||
//경험치, 공헌치
|
||||
|
||||
@@ -604,7 +604,7 @@ function process_46(&$general) {
|
||||
$nation = getNationStaticInfo($general['nation']);
|
||||
|
||||
// 현 도시 소속지로
|
||||
$query = "update city set nation='{$nation['nation']}',conflict='',conflict2='' where city='{$general['city']}'";
|
||||
$query = "update city set nation='{$nation['nation']}',conflict='{}' where city='{$general['city']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
|
||||
$log[] = "<C>●</>{$admin['month']}월:<D><b>{$nation['name']}</b></>(을)를 건국하였습니다. <1>$date</>";
|
||||
@@ -673,7 +673,7 @@ function process_47(&$general) {
|
||||
//분쟁기록 모두 지움
|
||||
DeleteConflict($general['nation']);
|
||||
// 국명, 색깔 바꿈 국가 레벨 0, 성향리셋, 기술0
|
||||
$query = "update nation set name='{$general['name']}',color='330000',level='0',type='0',tech='0',totaltech='0',capital='0' where nation='{$general['nation']}'";
|
||||
$query = "update nation set name='{$general['name']}',color='#330000',level='0',type='0',tech='0',totaltech='0',capital='0' where nation='{$general['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
// 본인 빼고 건국/임관제한
|
||||
$query = "update general set makelimit='12' where no!='{$general['no']}' and nation='{$general['nation']}'";
|
||||
@@ -685,7 +685,7 @@ function process_47(&$general) {
|
||||
$query = "update general set level=1 where nation='{$general['nation']}' and level <= 11";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
// 전 도시 공백지로
|
||||
$query = "update city set nation='0',front='0',gen1='0',gen2='0',gen3='0',conflict='',conflict2='' where nation='{$general['nation']}'";
|
||||
$query = "update city set nation='0',front='0',gen1='0',gen2='0',gen3='0',conflict='{}' where nation='{$general['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
// 외교 리셋
|
||||
$query = "update diplomacy set state='2',term='0' where me='{$general['nation']}' or you='{$general['nation']}'";
|
||||
|
||||
@@ -232,12 +232,7 @@ function startTournament($auto, $type) {
|
||||
$db = DB::db();
|
||||
$connect=$db->get();
|
||||
|
||||
for($i=0; $i<50; $i++){
|
||||
$filepath = "logs/fight{$i}.txt";
|
||||
if(file_exists($filepath)){
|
||||
@unlink($filepath);
|
||||
}
|
||||
}
|
||||
eraseTnmtFightLogAll();
|
||||
|
||||
switch($auto) {
|
||||
case 1: $unit = 60; break;
|
||||
@@ -760,6 +755,8 @@ function fight($tnmt_type, $tnmt, $phs, $group, $g1, $g2, $type) {
|
||||
$db = DB::db();
|
||||
$connect=$db->get();
|
||||
|
||||
eraseTnmtFightLog($group);
|
||||
|
||||
$query = "select *,(ldr+pwr+itl)*7/15 as tot,h,w,b from tournament where grp='$group' and grp_no='$g1'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$gen1 = MYDB_fetch_array($result);
|
||||
|
||||
+6
-11
@@ -4,7 +4,7 @@ namespace sammo;
|
||||
include "lib.php";
|
||||
include "func.php";
|
||||
|
||||
$session = Session::requireLogin()->loginGame();
|
||||
$session = Session::requireLogin()->loginGame()->setReadOnly();
|
||||
$userID = Session::getUserID();
|
||||
|
||||
increaseRefresh("메인", 1);
|
||||
@@ -31,12 +31,6 @@ if ($me === null) {
|
||||
header('Location: ../');
|
||||
die();
|
||||
}
|
||||
if (!$session->generalID) {
|
||||
$session = Session::requireGameLogin();
|
||||
}
|
||||
$session->setReadOnly();
|
||||
$userID = Session::getUserID();
|
||||
|
||||
|
||||
if ($me['newmsg'] == 1 || $me['newvote'] == 1) {
|
||||
$db->update('general', [
|
||||
@@ -68,6 +62,7 @@ $scenario = $admin['scenario_text'];
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<script src="../e_lib/jquery-3.2.1.min.js"></script>
|
||||
<script src="../e_lib/jquery.redirect.js"></script>
|
||||
<script src="../d_shared/common_path.js"></script>
|
||||
<script src="js/common.js"></script>
|
||||
<script src="js/main.js"></script>
|
||||
@@ -81,7 +76,7 @@ $(function(){
|
||||
});
|
||||
</script>
|
||||
<link href="css/normalize.css" rel="stylesheet">
|
||||
<link href="../d_shared/common.css" red="stylesheet">
|
||||
<link href="../d_shared/common.css" rel="stylesheet">
|
||||
<link href="css/common.css" rel="stylesheet">
|
||||
<link href="css/main.css" rel="stylesheet">
|
||||
<link href="css/map.css" rel="stylesheet">
|
||||
@@ -94,7 +89,7 @@ $(function(){
|
||||
<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>삼국지 모의전투 PHP 유기체서버 (<font color=cyan><?=$scenario?></font>)</font></td>
|
||||
<td colspan=5 align=center><font size=4>삼국지 모의전투 HiDCHe (<font color=cyan><?=$scenario?></font>)</font></td>
|
||||
</tr>
|
||||
<?php
|
||||
$valid = 0;
|
||||
@@ -223,7 +218,7 @@ if ($session->userGrade >= 5) {
|
||||
<td width=698 height=520 colspan=2>
|
||||
<?=getMapHtml()?>
|
||||
</td>
|
||||
<td width=298 rowspan=4><iframe name=commandlist src='commandlist.php' width=298 height=700 frameborder=0 marginwidth=0 marginheight=0 topmargin=0 scrolling=no></iframe></td>
|
||||
<td width=298 rowspan=4><iframe seamless="seamless" name=commandlist src='commandlist.php' width=298 height=700 frameborder=0 marginwidth=0 marginheight=0 topmargin=0 scrolling=no></iframe></td>
|
||||
</tr>
|
||||
<form name=form2 action=preprocessing.php method=post target=commandlist>
|
||||
<tr>
|
||||
@@ -252,7 +247,7 @@ if ($session->userGrade >= 5) {
|
||||
<tr>
|
||||
<td width=646 align=right>
|
||||
<?php commandTable(); ?>
|
||||
<input 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: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>
|
||||
</td>
|
||||
</tr>
|
||||
</form>
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@ if($session->userGrade < 5){
|
||||
</head>
|
||||
<body>
|
||||
<div class="container" style="min-width:720px;">
|
||||
<h1 class="row justify-content-md-center">삼국지 모의전투 HiD 리셋</h1>
|
||||
<h1 class="row justify-content-md-center">삼국지 모의전투 HiDCHe 리셋</h1>
|
||||
<div class="row justify-content-md-center">
|
||||
|
||||
<div class="col col-lg-8" >
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@ if($session->userGrade == 5){
|
||||
</head>
|
||||
<body>
|
||||
<div class="container" style="min-width:720px;">
|
||||
<h1 class="row justify-content-md-center">삼국지 모의전투 HiD 리셋</h1>
|
||||
<h1 class="row justify-content-md-center">삼국지 모의전투 HiDCHe 리셋</h1>
|
||||
<div class="row justify-content-md-center">
|
||||
|
||||
<div class="col col-lg-8" >
|
||||
|
||||
@@ -12,7 +12,7 @@ if($session->userGrade < 5){
|
||||
}
|
||||
|
||||
|
||||
$scenarioIdx = Util::toInt(Util::array_get($_GET['scenarioIdx']));
|
||||
$scenarioIdx = Util::getReq('scenarioIdx', 'int');
|
||||
|
||||
if ($scenarioIdx !== null) {
|
||||
//TODO: preview 지도 출력
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
namespace sammo;
|
||||
|
||||
include "lib.php";
|
||||
include "func.php";
|
||||
|
||||
$year = Util::getReq('year', 'int');
|
||||
$month = Util::getReq('month', 'int');
|
||||
|
||||
$url = '/a_history.php';
|
||||
|
||||
if(!strpos($_SERVER['HTTP_REFERER'], $url)) {
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>'Invalid Referer'
|
||||
]);
|
||||
}
|
||||
|
||||
if(!$year || !$month) {
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>'year, month가 지정되지 않았습니다'
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
//로그인 검사
|
||||
$session = Session::requireGameLogin([])->setReadOnly();
|
||||
|
||||
$db = DB::db();
|
||||
$connect=$db->get();
|
||||
|
||||
$map = $db->queryFirstField('SELECT map FROM history WHERE year=%i AND month=%i', $year, $month);
|
||||
|
||||
if(!$map){
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>'해당하는 연월의 지도가 없습니다'
|
||||
]);
|
||||
}
|
||||
|
||||
Json::die($map, Json::PASS_THROUGH);
|
||||
+1
-1
@@ -31,7 +31,7 @@ $connect=$db->get();
|
||||
<head>
|
||||
<title>장수생성</title>
|
||||
<meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'>
|
||||
<link href="../d_shared/common.css" red="stylesheet">
|
||||
<link href="../d_shared/common.css" rel="stylesheet">
|
||||
<link rel='stylesheet' href="css/common.css">
|
||||
<script type="text/javascript" src="../e_lib/jquery-3.2.1.min.js"></script>
|
||||
<script type="text/javascript" src="js/join.js"></script>
|
||||
|
||||
+1
-1
@@ -276,6 +276,6 @@ $rootDB->insert('member_log', [
|
||||
<script>
|
||||
window.alert('정상적으로 회원 가입되었습니다. 장수명 : <?=$name?> \n튜토리얼을 꼭 읽어보세요!');
|
||||
</script>
|
||||
<script>location.replace('index.php');</script>
|
||||
<script>location.replace('./');</script>
|
||||
|
||||
|
||||
|
||||
@@ -39,6 +39,11 @@ function refreshing(obj, arg1, arg2) {
|
||||
}
|
||||
}
|
||||
|
||||
function moveProcessing(commandtype, turn){
|
||||
console.log(commandtype, turn);
|
||||
$.redirect("processing.php",{ commandtype: commandtype, turn: turn}, 'post');
|
||||
}
|
||||
|
||||
function go(type) {
|
||||
if(type == 1) location.replace('b_nationboard.php');
|
||||
else if(type == 2) location.replace('b_troop.php');
|
||||
@@ -73,4 +78,8 @@ jQuery(function($){
|
||||
console.log(target, msg);
|
||||
return false;
|
||||
});
|
||||
|
||||
$('#mainBtnSubmit').click(function(){
|
||||
|
||||
});
|
||||
});
|
||||
+13
-10
@@ -19,13 +19,6 @@ $loader->addClassMap((function () {
|
||||
})());
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
체섭용 인클루드 파일
|
||||
******************************************************************************/
|
||||
|
||||
// W3C P3P 규약설정
|
||||
// @header ("P3P : CP=\"ALL CURa ADMa DEVa TAIa OUR BUS IND PHY ONL UNI PUR FIN COM NAV INT DEM CNT STA POL HEA PRE LOC OTC\"");
|
||||
|
||||
//디버그용 매크로
|
||||
ini_set("session.cache_expire", 10080); // minutes
|
||||
|
||||
@@ -62,7 +55,7 @@ session_cache_limiter('nocache');//NOTE: 캐시가 가능하도록 설정해야
|
||||
//FIXME: 이곳에서 설정하면 안될 듯 하다. 옮기자.
|
||||
|
||||
// 에러 메세지 출력
|
||||
function Error($message, $url="")
|
||||
function Error($message='', $url="")
|
||||
{
|
||||
if (!$url) {
|
||||
$url = $_SERVER['REQUEST_URI'];
|
||||
@@ -102,13 +95,23 @@ function extractSuperGlobals()
|
||||
if (isset($_POST) && count($_POST) > 0) {
|
||||
LogText($_SERVER['REQUEST_URI'], $_POST);
|
||||
|
||||
extract($_POST, EXTR_SKIP);
|
||||
foreach($_POST as $key=>$val){
|
||||
if(isset($GLOBALS[$key])){
|
||||
continue;
|
||||
}
|
||||
$GLOBALS[$key]=$val;
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($_GET) && count($_GET) > 0) {
|
||||
LogText($_SERVER['REQUEST_URI'], $_GET);
|
||||
|
||||
extract($_POST, EXTR_SKIP);
|
||||
foreach($_GET as $key=>$val){
|
||||
if(isset($GLOBALS[$key])){
|
||||
continue;
|
||||
}
|
||||
$GLOBALS[$key]=$val;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
<?php
|
||||
namespace sammo;
|
||||
|
||||
$year = $_GET['year'];
|
||||
$month = $_GET['month'];
|
||||
|
||||
$url = '/a_history.php';
|
||||
|
||||
if(!strpos($_SERVER['HTTP_REFERER'], $url)) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if(!$year || !$month) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
include "lib.php";
|
||||
include "func.php";
|
||||
//로그인 검사
|
||||
$session = Session::requireGameLogin()->setReadOnly();
|
||||
|
||||
$db = DB::db();
|
||||
$connect=$db->get();
|
||||
|
||||
$query = "select map from history where year='$year' and month='$month'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$history = MYDB_fetch_array($result);
|
||||
|
||||
if(!$history['map']) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
$map = $history['map'];
|
||||
$map = str_replace('<_quot_>', "'", $map);
|
||||
$map = str_replace('<_dquot_>', '"', $map);
|
||||
|
||||
echo $map;
|
||||
@@ -11,12 +11,13 @@ $db = DB::db();
|
||||
$connect=$db->get();
|
||||
|
||||
$turn = Util::getReq('turn', 'array_int');
|
||||
$sel = Util::getReq('sel', 'int');
|
||||
$commandtype = Util::getReq('commandtype', 'int');
|
||||
|
||||
increaseRefresh("턴입력", 1);
|
||||
|
||||
if(!$turn || $commandtype === null){
|
||||
header('location:index.php');
|
||||
header('location:./');
|
||||
die();
|
||||
}
|
||||
|
||||
@@ -30,8 +31,7 @@ $me = MYDB_fetch_array($result);
|
||||
|
||||
$con = checkLimit($me['con'], $admin['conlimit']);
|
||||
if($con >= 2) {
|
||||
//echo "<script>window.top.main.location.replace('index.php');</script>";
|
||||
echo 'index.php';//TODO:debug all and replace
|
||||
header('location:./');
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
+180
-171
@@ -86,7 +86,14 @@ function processWar($general, $city) {
|
||||
|
||||
$query = "select nation,level,name,rice,capital,tech,type from nation where nation='{$city['nation']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$destnation = MYDB_fetch_array($result);
|
||||
$destnation = MYDB_fetch_array($result) ?: [
|
||||
'nation'=>0,
|
||||
'capital'=>0,
|
||||
'level'=>0,
|
||||
'rice'=>2000,
|
||||
'type'=>0,
|
||||
'tech'=>0
|
||||
];
|
||||
|
||||
//장수수 구함
|
||||
$query = "select no from general where nation='{$general['nation']}'";
|
||||
@@ -147,7 +154,7 @@ function processWar($general, $city) {
|
||||
$query = "update city set agri=agri*0.5,comm=comm*0.5,secu=secu*0.5 where city='{$city['city']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
|
||||
$city = addConflict($city, $general['nation'], 1);
|
||||
$city = addConflict($city, $general['nation'], 1);//NOTE: 이 경우 두 국가가 분쟁 중인 경우에는 병량패퇴의 이득이 없다.
|
||||
|
||||
ConquerCity($game, $general, $city, $nation, $destnation);
|
||||
break;
|
||||
@@ -172,8 +179,8 @@ function processWar($general, $city) {
|
||||
} else {
|
||||
$lbonus = 0;
|
||||
}
|
||||
$myAtt = getAtt($game, $general, $nation['tech'], $lbonus);
|
||||
$myDef = getDef($game, $general, $nation['tech']);
|
||||
$myAtt = getAtt($general, $nation['tech'], $lbonus);
|
||||
$myDef = getDef($general, $nation['tech']);
|
||||
$cityAtt = getCityAtt($city);
|
||||
$cityDef = getCityDef($city);
|
||||
|
||||
@@ -297,10 +304,7 @@ function processWar($general, $city) {
|
||||
|
||||
//크리
|
||||
$rd = rand() % 100; // 0 ~ 99
|
||||
$ratio = CriticalRatio3(
|
||||
getGeneralLeadership($general, false, true, true, false),
|
||||
getGeneralPower($general, false, true, true, false),
|
||||
getGeneralIntel($general, false, true, true, false));
|
||||
$ratio = CriticalRatio3($general);
|
||||
// 특기보정 : 무쌍, 필살
|
||||
if($general['special2'] == 61) { $ratio += 10; }
|
||||
if($general['special2'] == 71) { $ratio += 20; }
|
||||
@@ -389,7 +393,7 @@ function processWar($general, $city) {
|
||||
// 성격 보정
|
||||
$myRice = CharExperience($myRice, $general['personal']);
|
||||
// 쌀 소모
|
||||
$myRice = ($myRice * 5 * getCrewtypeRice($game, $general['crewtype'], $nation['tech']));
|
||||
$myRice = ($myRice * 5 * getCrewtypeRice($general['crewtype'], $nation['tech']));
|
||||
// 결과 쌀
|
||||
$myRice = $general['rice'] - $myRice;
|
||||
|
||||
@@ -412,14 +416,14 @@ function processWar($general, $city) {
|
||||
'killed_crew' => -$mykillnum
|
||||
];
|
||||
|
||||
$res = $templates->render('small_war_log',[
|
||||
$res = str_replace(["\r\n", "\r", "\n"], '', $templates->render('small_war_log',[
|
||||
'year'=>$year,
|
||||
'month'=>$month,
|
||||
'war_type'=>'siege',
|
||||
'war_type_str'=>'성',
|
||||
'me' => $render_attacker,
|
||||
'you' => $render_defender,
|
||||
]);
|
||||
]));
|
||||
|
||||
$log[] = $res;//TODO: $log를 출력할 때 date에 대해선 숨겨야 함.
|
||||
$batlog[] = $res;
|
||||
@@ -429,7 +433,7 @@ function processWar($general, $city) {
|
||||
|
||||
// 도시쌀 소모 계산
|
||||
$opexp = Util::round($opexp / 50 * 0.8);
|
||||
$rice = Util::round($opexp * 5 * getCrewtypeRice($game, 0, 0) * ($game['city_rate']/100 - 0.2));
|
||||
$rice = Util::round($opexp * 5 * getCrewtypeRice(0, 0) * ($game['city_rate']/100 - 0.2));
|
||||
$destnation['rice'] -= $rice;
|
||||
if($destnation['rice'] < 0) { $destnation['rice'] = 0; }
|
||||
$query = "update nation set rice='{$destnation['rice']}' where nation='{$destnation['nation']}'";
|
||||
@@ -466,8 +470,12 @@ function processWar($general, $city) {
|
||||
// 죽은수 기술로 누적
|
||||
$num = Util::round($mykillnum * 0.01);
|
||||
// 국가보정
|
||||
if($destnation['type'] == 3 || $destnation['type'] == 13) { $num *= 1.1; }
|
||||
if($destnation['type'] == 5 || $destnation['type'] == 6 || $destnation['type'] == 7 || $destnation['type'] == 8 || $destnation['type'] == 12) { $num *= 0.9; }
|
||||
if($destnation['type'] == 3 || $destnation['type'] == 13){
|
||||
$num *= 1.1;
|
||||
}
|
||||
if($destnation['type'] == 5 || $destnation['type'] == 6 || $destnation['type'] == 7 || $destnation['type'] == 8 || $destnation['type'] == 12) {
|
||||
$num *= 0.9;
|
||||
}
|
||||
// 부드러운 기술 제한
|
||||
if(TechLimit($game['startyear'], $year, $destnation['tech'])) { $num = intdiv($num, 4); }
|
||||
$query = "update nation set totaltech=totaltech+'$num',tech=totaltech/'$destgencount' where nation='{$destnation['nation']}'";
|
||||
@@ -638,8 +646,8 @@ function processWar($general, $city) {
|
||||
} else {
|
||||
$lbonus = 0;
|
||||
}
|
||||
$myAtt = getAtt($game, $general, $nation['tech'], $lbonus);
|
||||
$myDef = getDef($game, $general, $nation['tech']);
|
||||
$myAtt = getAtt($general, $nation['tech'], $lbonus);
|
||||
$myDef = getDef($general, $nation['tech']);
|
||||
|
||||
if($oppose['level'] == 12) {
|
||||
$opplbonus = $destnation['level'] * 2;
|
||||
@@ -648,8 +656,8 @@ function processWar($general, $city) {
|
||||
} else {
|
||||
$opplbonus = 0;
|
||||
}
|
||||
$opAtt = getAtt($game, $oppose, $destnation['tech'], $opplbonus);
|
||||
$opDef = getDef($game, $oppose, $destnation['tech']);
|
||||
$opAtt = getAtt($oppose, $destnation['tech'], $opplbonus);
|
||||
$opDef = getDef($oppose, $destnation['tech']);
|
||||
// 감소할 병사 수
|
||||
$myCrew = GameConst::$armperphase + $opAtt - $myDef;
|
||||
$opCrew = GameConst::$armperphase + $myAtt - $opDef;
|
||||
@@ -1032,10 +1040,10 @@ function processWar($general, $city) {
|
||||
}
|
||||
|
||||
//레벨 보정
|
||||
$myCrew = $myCrew * ((100 - $general['explevel']/3)/100);
|
||||
$opCrew = $opCrew / ((100 - $general['explevel']/3)/100);
|
||||
$myCrew = $myCrew / ((100 - $oppose['explevel']/3)/100);
|
||||
$opCrew = $opCrew * ((100 - $oppose['explevel']/3)/100);
|
||||
$myCrew = $myCrew * (max(1, 100 - $general['explevel']/3)/100);
|
||||
$opCrew = $opCrew / (max(1, 100 - $general['explevel']/3)/100);
|
||||
$myCrew = $myCrew / (max(1, 100 - $oppose['explevel']/3)/100);
|
||||
$opCrew = $opCrew * (max(1, 100 - $oppose['explevel']/3)/100);
|
||||
|
||||
// 특기보정 : 기병, 돌격, 무쌍, 보병, 견고, 척사, 의술(청낭서, 태평청령)
|
||||
if($general['special2'] == 52) { $opCrew *= 1.20; }
|
||||
@@ -1078,10 +1086,7 @@ function processWar($general, $city) {
|
||||
|
||||
//크리
|
||||
$rd = rand() % 100; // 0 ~ 99
|
||||
$ratio = CriticalRatio3(
|
||||
getGeneralLeadership($general, false, true, true, false),
|
||||
getGeneralPower($general, false, true, true, false),
|
||||
getGeneralIntel($general, false, true, true, false));
|
||||
$ratio = CriticalRatio3($general);
|
||||
// 특기보정 : 무쌍, 필살
|
||||
if($general['special2'] == 61) { $ratio += 10; }
|
||||
if($general['special2'] == 71) { $ratio += 20; }
|
||||
@@ -1103,10 +1108,7 @@ function processWar($general, $city) {
|
||||
}
|
||||
//크리
|
||||
$rd = rand() % 100; // 0 ~ 99
|
||||
$ratio = CriticalRatio3(
|
||||
getGeneralLeadership($oppose, false, true, true, false),
|
||||
getGeneralPower($oppose, false, true, true, false),
|
||||
getGeneralIntel($oppose, false, true, true, false));
|
||||
$ratio = CriticalRatio3($oppose);
|
||||
// 특기보정 : 필살
|
||||
if($oppose['special2'] == 71) { $ratio += 20; }
|
||||
if($ratio >= $rd && $opAvoid == 1) {
|
||||
@@ -1255,7 +1257,7 @@ function processWar($general, $city) {
|
||||
// 성격 보정
|
||||
$myRice = CharExperience($myRice, $general['personal']);
|
||||
// 쌀 소모
|
||||
$myRice = ($myRice * 5 * getCrewtypeRice($game, $general['crewtype'], $nation['tech']));
|
||||
$myRice = ($myRice * 5 * getCrewtypeRice($general['crewtype'], $nation['tech']));
|
||||
// 결과 쌀
|
||||
$myRice = $general['rice'] - $myRice;
|
||||
|
||||
@@ -1264,7 +1266,7 @@ function processWar($general, $city) {
|
||||
// 성격 보정
|
||||
$opRice = CharExperience($opRice, $oppose['personal']);
|
||||
// 쌀 소모
|
||||
$opRice = ($opRice * 5 * getCrewtypeRice($game, $oppose['crewtype'], $destnation['tech']));
|
||||
$opRice = ($opRice * 5 * getCrewtypeRice($oppose['crewtype'], $destnation['tech']));
|
||||
// 결과 쌀
|
||||
$opRice = $oppose['rice'] - $opRice;
|
||||
|
||||
@@ -1288,23 +1290,23 @@ function processWar($general, $city) {
|
||||
'killed_crew' => -$opdeathnum
|
||||
];
|
||||
|
||||
$res = $templates->render('small_war_log',[
|
||||
$res = str_replace(["\r\n", "\r", "\n"], '', $templates->render('small_war_log',[
|
||||
'year'=>$year,
|
||||
'month'=>$month,
|
||||
'war_type'=>'attack',
|
||||
'war_type_str'=>'공',
|
||||
'me' => $render_attacker,
|
||||
'you' => $render_defender,
|
||||
]);
|
||||
]));
|
||||
|
||||
$oppres = $templates->render('small_war_log',[
|
||||
$oppres = str_replace(["\r\n", "\r", "\n"], '', $templates->render('small_war_log',[
|
||||
'year'=>$year,
|
||||
'month'=>$month,
|
||||
'war_type'=>'defense',
|
||||
'war_type_str'=>'수',
|
||||
'me' => $render_defender,
|
||||
'you' => $render_attacker,
|
||||
]);
|
||||
]));
|
||||
|
||||
$log[] = $res;
|
||||
$batlog[] = $res;
|
||||
@@ -1404,7 +1406,7 @@ function processWar($general, $city) {
|
||||
// 성격 보정
|
||||
$opexp = CharExperience($opexp, $oppose['personal']);
|
||||
// 쌀 소모
|
||||
$oppose['rice'] -= ($opexp * 5 * getCrewtypeRice($game, $oppose['crewtype'], $destnation['tech']));
|
||||
$oppose['rice'] -= ($opexp * 5 * getCrewtypeRice($oppose['crewtype'], $destnation['tech']));
|
||||
if($oppose['rice'] < 0) { $oppose['rice'] = 0; }
|
||||
|
||||
$query = "update general set deathnum=deathnum+1,rice='{$oppose['rice']}',experience=experience+'$opexp',dedication=dedication+'$opexp' where no='{$oppose['no']}'";
|
||||
@@ -1414,6 +1416,7 @@ function processWar($general, $city) {
|
||||
pushGenLog($oppose, $opplog);
|
||||
pushBatLog($oppose, $oppbatlog);
|
||||
pushBatRes($oppose, $oppbatres);
|
||||
unset($oppose);
|
||||
unset($opplog);
|
||||
unset($oppbatlog);
|
||||
unset($oppbatres);
|
||||
@@ -1446,7 +1449,7 @@ function processWar($general, $city) {
|
||||
// 성격 보정
|
||||
$opexp = CharExperience($opexp, $oppose['personal']);
|
||||
// 쌀 소모
|
||||
$oppose['rice'] -= ($opexp * 5 * getCrewtypeRice($game, $oppose['crewtype'], $destnation['tech']));
|
||||
$oppose['rice'] -= ($opexp * 5 * getCrewtypeRice($oppose['crewtype'], $destnation['tech']));
|
||||
if($oppose['rice'] < 0) { $oppose['rice'] = 0; }
|
||||
|
||||
$query = "update general set rice='{$oppose['rice']}',leader2='{$oppose['leader2']}',power2='{$oppose['power2']}',intel2='{$oppose['intel2']}',atmos='{$oppose['atmos']}',experience=experience+'$opexp',dedication=dedication+'$opexp',killnum=killnum+1 where no='{$oppose['no']}'";
|
||||
@@ -1477,16 +1480,20 @@ function processWar($general, $city) {
|
||||
}
|
||||
}
|
||||
|
||||
// 상대장수 경험 등등 증가(페이즈 초과시)
|
||||
$opexp = Util::round($opexp / 50 * 0.8);
|
||||
// 성격 보정
|
||||
$opexp = CharExperience($opexp, $oppose['personal']);
|
||||
// 쌀 소모
|
||||
$oppose['rice'] -= ($opexp * 5 * getCrewtypeRice($game, $oppose['crewtype'], $destnation['tech']));
|
||||
if($oppose['rice'] < 0) { $oppose['rice'] = 0; }
|
||||
if(isset($oppose)){
|
||||
//마지막 페이즈에 장수가 전멸하지 않은 경우. 쌀 소모 후속 처리
|
||||
|
||||
$query = "update general set rice='{$oppose['rice']}',experience=experience+'$opexp',dedication=dedication+'$opexp' where no='{$oppose['no']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
// 상대장수 경험 등등 증가(페이즈 초과시)
|
||||
$opexp = Util::round($opexp / 50 * 0.8);
|
||||
// 성격 보정
|
||||
$opexp = CharExperience($opexp, $oppose['personal']);
|
||||
// 쌀 소모
|
||||
$oppose['rice'] -= ($opexp * 5 * getCrewtypeRice($oppose['crewtype'], $destnation['tech']));
|
||||
if($oppose['rice'] < 0) { $oppose['rice'] = 0; }
|
||||
|
||||
$query = "update general set rice='{$oppose['rice']}',experience=experience+'$opexp',dedication=dedication+'$opexp' where no='{$oppose['no']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
}
|
||||
|
||||
// 경험치 상승
|
||||
if(intdiv($general['crewtype'], 10) == 3) { // 귀병
|
||||
@@ -1504,7 +1511,7 @@ function processWar($general, $city) {
|
||||
// 성격 보정
|
||||
$exp = CharExperience($exp, $general['personal']);
|
||||
// 쌀 소모
|
||||
$general['rice'] -= ($exp * 5 * getCrewtypeRice($game, $general['crewtype'], $nation['tech']));
|
||||
$general['rice'] -= ($exp * 5 * getCrewtypeRice($general['crewtype'], $nation['tech']));
|
||||
if($general['rice'] < 0) { $general['rice'] = 0; }
|
||||
|
||||
$query = "update general set rice='{$general['rice']}',dedication=dedication+'$exp',experience=experience+'$exp' where no='{$general['no']}'";
|
||||
@@ -1520,8 +1527,39 @@ function processWar($general, $city) {
|
||||
return $deadAmount;
|
||||
}
|
||||
|
||||
function CriticalRatio3($leader, $power, $intel) {
|
||||
return 15; //15% 고정
|
||||
|
||||
function CriticalRatio3($general) {
|
||||
// 무장 무력 : 65 5%, 70 10%, 75 15%, 80 20%
|
||||
// 지장 지력 : 65 5%, 70 8%, 75 10%, 80 13%
|
||||
//충차장 통솔: 65 5%, 70 8%, 75 10%, 80 13%
|
||||
|
||||
$crewtype = intdiv($general['crewtype'], 10);
|
||||
|
||||
if($crewtype == 3){ //지장
|
||||
$mainstat = getGeneralIntel($general, false, true, true, false);
|
||||
}
|
||||
else if($crewtype == 4){ //병기
|
||||
$mainstat = getGeneralLeadership($general, false, true, true, false);
|
||||
}
|
||||
else{ //무장
|
||||
$mainstat = getGeneralPower($general, false, true, true, false);
|
||||
}
|
||||
|
||||
$ratio = max($mainstat - 65, 0);
|
||||
|
||||
if ($crewtype >= 3) {
|
||||
$ratio /= 2;
|
||||
}
|
||||
else{
|
||||
$ratio *= 0.7;
|
||||
}
|
||||
|
||||
$ratio = round($ratio);
|
||||
$ratio += 5;
|
||||
|
||||
if($ratio > 50) $ratio = 50;
|
||||
|
||||
return $ratio;
|
||||
}
|
||||
|
||||
function CriticalRatio2($leader, $power, $intel) {
|
||||
@@ -1553,9 +1591,9 @@ function getCrew($crew, $youatmos, $mytrain) {
|
||||
return $crew;
|
||||
}
|
||||
|
||||
function getCrewtypeRice($game, $crewtype, $tech) {
|
||||
function getCrewtypeRice($crewtype, $tech) {
|
||||
if(!$crewtype) { $crewtype = 0; }
|
||||
$cost = $game["ric{$crewtype}"] / 10;
|
||||
$cost = GameUnitConst::byID($crewtype)->rice / 10;
|
||||
return $cost * getTechCost($tech);
|
||||
}
|
||||
|
||||
@@ -1563,7 +1601,7 @@ function getCrewtypeRice($game, $crewtype, $tech) {
|
||||
// 표준 공 / 수 반환 수치는 약 0이 되게 (100~550)
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
||||
function getAtt($game, $general, $tech, $lbonus) {
|
||||
function getAtt($general, $tech, $lbonus) {
|
||||
$att = GameUnitConst::byID($general['crewtype'])->attack + getTechAbil($tech);
|
||||
|
||||
$general['lbonus'] = $lbonus;
|
||||
@@ -1582,7 +1620,7 @@ function getAtt($game, $general, $tech, $lbonus) {
|
||||
return $att;
|
||||
}
|
||||
|
||||
function getDef($game, $general, $tech) {
|
||||
function getDef($general, $tech) {
|
||||
$def = GameUnitConst::byID($general['crewtype'])->defence + getTechAbil($tech);
|
||||
|
||||
$crew = ($general['crew'] / (7000 / 30)) + 70; // 5000명일때 91점 7000명일때 100점 10000명일때 113점
|
||||
@@ -1606,94 +1644,69 @@ function getRate($game, $type, $dtype) {
|
||||
return $game[$t];
|
||||
}
|
||||
|
||||
function addConflict($city, $nationnum, $mykillnum) {
|
||||
function addConflict($city, $nationID, $mykillnum) {
|
||||
$db = DB::db();
|
||||
$connect=$db->get();
|
||||
|
||||
$nationlist = [];
|
||||
$killnum = [];
|
||||
$killnum = [0];
|
||||
|
||||
$query = "select year,month from game limit 1";
|
||||
$result = MYDB_query($query, $connect) or Error("addConflict ".MYDB_error($connect),"");
|
||||
$game = MYDB_fetch_array($result);
|
||||
list($year, $month) = $db->queryFirstList('SELECT year, month FROM game LIMIT 1');
|
||||
|
||||
if($city['conflict']){
|
||||
$nationlist = array_map('intval', explode("|", $city['conflict']));
|
||||
$killnum = array_map('intval', explode("|", $city['conflict2']));
|
||||
$conflict = Json::decode($city['conflict']);
|
||||
|
||||
if(!$conflict || $city['def'] == 0){ // 선타, 막타 보너스
|
||||
$mykillnum *= 1.05;
|
||||
}
|
||||
|
||||
for($i=0; $i < count($nationlist); $i++) {
|
||||
if($nationlist[$i] == $nationnum) break;
|
||||
if (!$conflict) {
|
||||
$conflict[$nationID] = $mykillnum;
|
||||
}
|
||||
if($i != 0 && $i == count($nationlist)) { // 두번째 나라부터 분쟁 가담 메시지 출력
|
||||
$nation = getNationStaticInfo($nationnum);
|
||||
|
||||
pushWorldHistory(["<C>●</>{$game['year']}년 {$game['month']}월:<M><b>【분쟁】</b></><D><b>{$nation['name']}</b></>(이)가 <G><b>{$city['name']}</b></> 공략에 가담하여 분쟁이 발생하고 있습니다."]);
|
||||
else if(key_exists($nationID, $conflict)){
|
||||
$conflict[$nationID] += $mykillnum;
|
||||
arsort($conflict);
|
||||
}
|
||||
else{
|
||||
$conflict[$nationID] = $mykillnum;
|
||||
arsort($conflict);
|
||||
|
||||
$nationlist[$i] = $nationnum;
|
||||
if($i == 0 || $city['def'] == 0) { // 선타, 막타 보너스
|
||||
$killnum[$i] += Util::round($mykillnum * 1.05);
|
||||
} else {
|
||||
$killnum[$i] += $mykillnum;
|
||||
$nation = getNationStaticInfo($nationID);
|
||||
pushWorldHistory(["<C>●</>{$year}년 {$month}월:<M><b>【분쟁】</b></><D><b>{$nation['name']}</b></>(이)가 <G><b>{$city['name']}</b></> 공략에 가담하여 분쟁이 발생하고 있습니다."]);
|
||||
}
|
||||
$city['conflict'] = implode("|", $nationlist);
|
||||
$city['conflict2'] = implode("|", $killnum);
|
||||
|
||||
$rawConflict = Json::encode($conflict);
|
||||
$city['conflict'] = $rawConflict;
|
||||
|
||||
$query = "update city set conflict='{$city['conflict']}',conflict2='{$city['conflict2']}' where city='{$city['city']}'";
|
||||
MYDB_query($query, $connect) or Error("addConflict ".MYDB_error($connect),"");
|
||||
$db->update('city', [
|
||||
'conflict'=>$rawConflict
|
||||
], 'city=%i',$city['city']);
|
||||
|
||||
return $city;
|
||||
}
|
||||
|
||||
function DeleteConflict($nation) {
|
||||
$db = DB::db();
|
||||
$connect=$db->get();
|
||||
|
||||
$query = "select city,conflict,conflict2 from city where conflict!=''";
|
||||
$result = MYDB_query($query, $connect) or Error("addConflict ".MYDB_error($connect),"");
|
||||
$cityNum = MYDB_num_rows($result);
|
||||
foreach($db->queryAllLists('SELECT city, conflict FROM city WHERE conflict!=%s', '{}') as list($cityID, $rawConflict)){
|
||||
$conflict = Json::decode($rawConflict);
|
||||
|
||||
$nation = "$nation";
|
||||
for($k=0; $k < $cityNum; $k++) {
|
||||
$city = MYDB_fetch_array($result);
|
||||
|
||||
if(strpos($city['conflict'], $nation)) {
|
||||
$nationlist = explode("|", $city['conflict']);
|
||||
$killnum = explode("|", $city['conflict2']);
|
||||
|
||||
$count = count($nationlist);
|
||||
for($i=0; $i < $count; $i++) {
|
||||
if($nationlist[$i] == $nation) {
|
||||
unset($nationlist[$i]);
|
||||
unset($killnum[$i]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
$conflict = implode("|", $nationlist);
|
||||
$conflict2 = implode("|", $killnum);
|
||||
|
||||
$query = "update city set conflict='$conflict',conflict2='$conflict2' where city='{$city['city']}'";
|
||||
MYDB_query($query, $connect) or Error("addConflict ".MYDB_error($connect),"");
|
||||
if(!$conflict || !is_array($conflict)){
|
||||
continue;
|
||||
}
|
||||
if(!key_exists($nation, $conflict)){
|
||||
continue;
|
||||
}
|
||||
|
||||
unset($conflict[$nation]);
|
||||
|
||||
$db->update('city', [
|
||||
'conflict'=>Json::encode($conflict)
|
||||
], 'city=%i', $cityID);
|
||||
}
|
||||
}
|
||||
|
||||
function getConquerNation($city) : int {
|
||||
$db = DB::db();
|
||||
$connect=$db->get();
|
||||
|
||||
$nationlist = array_map('intval', explode("|", (string)$city['conflict']));
|
||||
$killnum = array_map('intval', explode("|", (string)$city['conflict2']));
|
||||
|
||||
$max = 0;
|
||||
for($i=0; $i < count($nationlist); $i++) {
|
||||
if($max <= $killnum[$i]) {
|
||||
$max = $killnum[$i];
|
||||
$index = $i;
|
||||
}
|
||||
}
|
||||
return $nationlist[$index];
|
||||
$conflict = Json::decode($city['conflict']);
|
||||
return Util::array_first_key($conflict);
|
||||
}
|
||||
|
||||
function ConquerCity($game, $general, $city, $nation, $destnation) {
|
||||
@@ -1737,7 +1750,7 @@ function ConquerCity($game, $general, $city, $nation, $destnation) {
|
||||
$history[] = "<C>●</>{$year}년 {$month}월:<R><b>【멸망】</b></><D><b>{$losenation['name']}</b></>(이)가 멸망하였습니다.";
|
||||
pushNationHistory($nation, "<C>●</>{$year}년 {$month}월:<D><b>{$losenation['name']}</b></>(을)를 정복");
|
||||
|
||||
$query = "select no from general where nation='{$general['nation']}' and level='12'";
|
||||
$query = "select no, nation from general where nation='{$general['nation']}' and level='12'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$ruler = MYDB_fetch_array($result);
|
||||
|
||||
@@ -1826,7 +1839,7 @@ function ConquerCity($game, $general, $city, $nation, $destnation) {
|
||||
$query = "update general set dedication=dedication*0.5,experience=experience*0.9 where nation='{$city['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
// 전 도시 공백지로
|
||||
$query = "update city set nation='0',gen1='0',gen2='0',gen3='0',conflict='',conflict2='',term=0 where nation='{$city['nation']}'";
|
||||
$query = "update city set nation='0',gen1='0',gen2='0',gen3='0',conflict='{}',term=0 where nation='{$city['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
// 전 장수 소속 무소속으로, 재야로, 부대 탈퇴
|
||||
$query = "update general set nation='0',belong='0',level='0',troop='0' where nation='{$city['nation']}'";
|
||||
@@ -1849,56 +1862,13 @@ function ConquerCity($game, $general, $city, $nation, $destnation) {
|
||||
// 멸망이 아니면
|
||||
} else {
|
||||
// 태수,군사,시중은 일반으로...
|
||||
$query = "update general set level='1' where no='{$city['gen1']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$query = "update general set level='1' where no='{$city['gen2']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$query = "update general set level='1' where no='{$city['gen3']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$db->update('general',[
|
||||
'level'=>1
|
||||
], 'no IN %li',[$city['gen1'], $city['gen2'], $city['gen3']]);
|
||||
|
||||
//수도였으면 긴급 천도
|
||||
if($destnation['capital'] == $city['city']) {
|
||||
$distList = searchDistance($city['city'], 99, true);
|
||||
|
||||
$cities = [];
|
||||
foreach(
|
||||
DB::db()->query(
|
||||
'SELECT city, pop FROM city WHERE nation=%i and city!=%i',
|
||||
$destnation['nation'],
|
||||
$city['city']
|
||||
) as $row
|
||||
){
|
||||
$cities[$row['city']] = $row;
|
||||
};
|
||||
|
||||
$distKeys = array_keys($distList);
|
||||
sort($distKeys);
|
||||
|
||||
$minCity = 0;
|
||||
|
||||
foreach($distKeys as $dist){
|
||||
$hasTarget = false;
|
||||
$maxCityPop = 0;
|
||||
|
||||
foreach($distList[$dist] as $cityID){
|
||||
$city = $cities[$cityID];
|
||||
'@phan-var array<string,mixed> $city';
|
||||
if($city['nation'] != $destnation['nation']){
|
||||
continue;
|
||||
}
|
||||
|
||||
if($city['pop'] <= $maxCityPop){
|
||||
continue;
|
||||
}
|
||||
|
||||
$hasTarget = true;
|
||||
$minCity = $cityID;
|
||||
$maxCityPop = $city['pop'];
|
||||
}
|
||||
|
||||
if($hasTarget){
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!isset($destnation['capital']) && $destnation['capital'] == $city['city']) {
|
||||
$minCity = findNextCapital($city['city'], $destnation['nation']);
|
||||
|
||||
$minCityName = CityConst::byID($minCity)->name;
|
||||
|
||||
@@ -1941,11 +1911,11 @@ function ConquerCity($game, $general, $city, $nation, $destnation) {
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
if($city['level'] > 3) {
|
||||
// 도시 소속 변경, 태수,군사,시중 초기화
|
||||
$query = "update city set supply=1,conflict='',term=0,conflict2='',agri=agri*0.7,comm=comm*0.7,secu=secu*0.7,def=1000,wall=1000,nation='{$general['nation']}',gen1=0,gen2=0,gen3=0 where city='{$city['city']}'";
|
||||
$query = "update city set supply=1,conflict='{}',term=0,agri=agri*0.7,comm=comm*0.7,secu=secu*0.7,def=1000,wall=1000,nation='{$general['nation']}',gen1=0,gen2=0,gen3=0 where city='{$city['city']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
} else {
|
||||
// 도시 소속 변경, 태수,군사,시중 초기화
|
||||
$query = "update city set supply=1,conflict='',term=0,conflict2='',agri=agri*0.7,comm=comm*0.7,secu=secu*0.7,def=def2/2,wall=wall2/2,nation='{$general['nation']}',gen1=0,gen2=0,gen3=0 where city='{$city['city']}'";
|
||||
$query = "update city set supply=1,conflict='{}',term=0,agri=agri*0.7,comm=comm*0.7,secu=secu*0.7,def=def2/2,wall=wall2/2,nation='{$general['nation']}',gen1=0,gen2=0,gen3=0 where city='{$city['city']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
}
|
||||
//전방설정
|
||||
@@ -1968,7 +1938,7 @@ function ConquerCity($game, $general, $city, $nation, $destnation) {
|
||||
$query = [
|
||||
'supply'=>1,
|
||||
'term'=>0,
|
||||
'conflict2'=>'',
|
||||
'conflict'=>'{}',
|
||||
'agri'=>$db->sqleval('agri*0.7'),
|
||||
'comm'=>$db->sqleval('comm*0.7'),
|
||||
'secu'=>$db->sqleval('secu*0.7'),
|
||||
@@ -1996,3 +1966,42 @@ function ConquerCity($game, $general, $city, $nation, $destnation) {
|
||||
pushWorldHistory($history);
|
||||
}
|
||||
|
||||
function findNextCapital(int $capitalID, int $nationID):int{
|
||||
$distList = searchDistance($capitalID, 99, true);
|
||||
|
||||
$cities = [];
|
||||
foreach(
|
||||
DB::db()->query(
|
||||
'SELECT city, pop FROM city WHERE nation=%i and city!=%i',
|
||||
$nationID,
|
||||
$capitalID
|
||||
) as $row
|
||||
){
|
||||
$cities[$row['city']] = $row['pop'];
|
||||
};
|
||||
|
||||
|
||||
|
||||
foreach($distList as $dist=>$distSubList){
|
||||
$maxCityPop = 0;
|
||||
$minCity = 0;
|
||||
|
||||
foreach($distSubList as $cityID){
|
||||
if(!key_exists($cityID, $cities)){
|
||||
continue;
|
||||
}
|
||||
$cityPop = $cities[$cityID];
|
||||
|
||||
if($cityPop < $maxCityPop){
|
||||
continue;
|
||||
}
|
||||
$minCity = $cityID;
|
||||
$maxCityPop = $cityPop;
|
||||
}
|
||||
|
||||
if($minCity){
|
||||
return $minCity;
|
||||
}
|
||||
}
|
||||
throw new \RuntimeException('도시가 남지 않았는데 긴천을 시도하고 있습니다');
|
||||
}
|
||||
+33
-30
@@ -4,6 +4,10 @@ namespace sammo;
|
||||
include "lib.php";
|
||||
include "func.php";
|
||||
//로그인 검사
|
||||
|
||||
$commandtype = Util::getReq('commandtype', 'int', 0);
|
||||
$turn = Util::getReq('turn', 'array_int', [0]);
|
||||
|
||||
$session = Session::requireGameLogin()->setReadOnly();
|
||||
|
||||
$db = DB::db();
|
||||
@@ -120,7 +124,6 @@ function starter($name, $type=0) {
|
||||
<script src="../e_lib/jquery-3.2.1.min.js"></script>
|
||||
<script src="../d_shared/common_path.js"></script>
|
||||
<script src="js/common.js"></script>
|
||||
<script src="js/main.js"></script>
|
||||
<script src="js/base_map.js"></script>
|
||||
<script src="js/map.js"></script>
|
||||
<script>
|
||||
@@ -139,7 +142,7 @@ $(function(){
|
||||
});
|
||||
</script>
|
||||
<link href="css/normalize.css" rel="stylesheet">
|
||||
<link href="../d_shared/common.css" red="stylesheet">
|
||||
<link href="../d_shared/common.css" rel="stylesheet">
|
||||
<link href="css/common.css" rel="stylesheet">
|
||||
<link href="css/main.css" rel="stylesheet">
|
||||
<link href="css/map.css" rel="stylesheet">
|
||||
@@ -188,8 +191,8 @@ function command_99($turn) {
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
}
|
||||
}
|
||||
//echo "<script>location.replace('b_chiefcenter.php');</script>";
|
||||
echo 'b_chiefcenter.php';//TODO:debug all and replace
|
||||
|
||||
header('location:b_chiefcenter.php');
|
||||
}
|
||||
|
||||
function command_11($turn, $command) {
|
||||
@@ -677,7 +680,7 @@ function command_16($turn, $command) {
|
||||
{$currentcity['name']} =>
|
||||
<select name=double size=1 style=color:white;background-color:black>";
|
||||
|
||||
OptionsForCitys();
|
||||
echo optionsForCities();
|
||||
|
||||
echo "
|
||||
</select>
|
||||
@@ -693,7 +696,7 @@ function command_16($turn, $command) {
|
||||
</form>
|
||||
";
|
||||
|
||||
printCitysName($currentcity['city'], 1);
|
||||
printCitiesBasedOnDistance($currentcity['city'], 1);
|
||||
|
||||
ender();
|
||||
}
|
||||
@@ -721,7 +724,7 @@ function command_21($turn, $command) {
|
||||
{$currentcity['name']} =>
|
||||
<select name=double size=1 style=color:white;background-color:black>";
|
||||
|
||||
OptionsForCitys();
|
||||
echo optionsForCities();
|
||||
|
||||
echo "
|
||||
</select>
|
||||
@@ -736,7 +739,7 @@ function command_21($turn, $command) {
|
||||
</form>
|
||||
";
|
||||
|
||||
printCitysName($currentcity['city'], 1);
|
||||
printCitiesBasedOnDistance($currentcity['city'], 1);
|
||||
|
||||
ender();
|
||||
}
|
||||
@@ -1074,7 +1077,7 @@ function command_27($turn, $command) {
|
||||
=>
|
||||
<select name=double size=1 style=color:white;background-color:black>";
|
||||
|
||||
OptionsForCitys();
|
||||
echo optionsForCities();
|
||||
|
||||
echo "
|
||||
</select>
|
||||
@@ -1115,7 +1118,7 @@ function command_30($turn, $command) {
|
||||
{$currentcity['name']} =>
|
||||
<select name=double size=1 style=color:white;background-color:black>";
|
||||
|
||||
OptionsForCitys();
|
||||
echo optionsForCities();
|
||||
|
||||
echo "
|
||||
</select>
|
||||
@@ -1130,7 +1133,7 @@ echo "
|
||||
</form>
|
||||
";
|
||||
|
||||
printCitysName($currentcity['city'], 3);
|
||||
printCitiesBasedOnDistance($currentcity['city'], 3);
|
||||
|
||||
ender();
|
||||
}
|
||||
@@ -1158,7 +1161,7 @@ function command_31($turn, $command) {
|
||||
{$currentcity['name']} =>
|
||||
<select name=double size=1 style=color:white;background-color:black>";
|
||||
|
||||
OptionsForCitys();
|
||||
echo optionsForCities();
|
||||
|
||||
echo "
|
||||
</select>
|
||||
@@ -1177,7 +1180,7 @@ function command_31($turn, $command) {
|
||||
모든 도시가 가능하지만 많은 정보를 얻을 수 있는<br>
|
||||
";
|
||||
|
||||
printCitysName($currentcity['city'], 2);
|
||||
printCitiesBasedOnDistance($currentcity['city'], 2);
|
||||
|
||||
ender();
|
||||
}
|
||||
@@ -1204,7 +1207,7 @@ function command_32($turn, $command) {
|
||||
{$currentcity['name']} =>
|
||||
<select name=double size=1 style=color:white;background-color:black>";
|
||||
|
||||
OptionsForCitys();
|
||||
echo optionsForCities();
|
||||
|
||||
echo "
|
||||
</select>
|
||||
@@ -1219,7 +1222,7 @@ function command_32($turn, $command) {
|
||||
</form>
|
||||
";
|
||||
|
||||
printCitysName($currentcity['city'], 2);
|
||||
printCitiesBasedOnDistance($currentcity['city'], 2);
|
||||
|
||||
ender();
|
||||
}
|
||||
@@ -1246,7 +1249,7 @@ function command_33($turn, $command) {
|
||||
{$currentcity['name']} =>
|
||||
<select name=double size=1 style=color:white;background-color:black>";
|
||||
|
||||
OptionsForCitys();
|
||||
echo optionsForCities();
|
||||
|
||||
echo "
|
||||
</select>
|
||||
@@ -1261,7 +1264,7 @@ function command_33($turn, $command) {
|
||||
</form>
|
||||
";
|
||||
|
||||
printCitysName($currentcity['city'], 2);
|
||||
printCitiesBasedOnDistance($currentcity['city'], 2);
|
||||
|
||||
ender();
|
||||
}
|
||||
@@ -1288,7 +1291,7 @@ function command_34($turn, $command) {
|
||||
{$currentcity['name']} =>
|
||||
<select name=double size=1 style=color:white;background-color:black>";
|
||||
|
||||
OptionsForCitys();
|
||||
echo optionsForCities();
|
||||
|
||||
echo "
|
||||
</select>
|
||||
@@ -1303,7 +1306,7 @@ function command_34($turn, $command) {
|
||||
</form>
|
||||
";
|
||||
|
||||
printCitysName($currentcity['city'], 2);
|
||||
printCitiesBasedOnDistance($currentcity['city'], 2);
|
||||
|
||||
ender();
|
||||
}
|
||||
@@ -1330,7 +1333,7 @@ function command_35($turn, $command) {
|
||||
{$currentcity['name']} =>
|
||||
<select name=double size=1 style=color:white;background-color:black>";
|
||||
|
||||
OptionsForCitys();
|
||||
echo optionsForCities();
|
||||
|
||||
echo "
|
||||
</select>
|
||||
@@ -1345,7 +1348,7 @@ function command_35($turn, $command) {
|
||||
</form>
|
||||
";
|
||||
|
||||
printCitysName($currentcity['city'], 2);
|
||||
printCitiesBasedOnDistance($currentcity['city'], 2);
|
||||
|
||||
ender();
|
||||
}
|
||||
@@ -1372,7 +1375,7 @@ function command_36($turn, $command) {
|
||||
{$currentcity['name']} =>
|
||||
<select name=double size=1 style=color:white;background-color:black>";
|
||||
|
||||
OptionsForCitys();
|
||||
echo optionsForCities();
|
||||
|
||||
echo "
|
||||
</select>
|
||||
@@ -1387,7 +1390,7 @@ function command_36($turn, $command) {
|
||||
</form>
|
||||
";
|
||||
|
||||
printCitysName($currentcity['city'], 2);
|
||||
printCitiesBasedOnDistance($currentcity['city'], 2);
|
||||
|
||||
ender();
|
||||
}
|
||||
@@ -2286,7 +2289,7 @@ echo "<br>
|
||||
<form name=form1 action=c_double.php method=post>
|
||||
<select name=double size=1 style=color:white;background-color:black>";
|
||||
|
||||
OptionsForCitys();
|
||||
echo optionsForCities();
|
||||
|
||||
echo "
|
||||
</select>
|
||||
@@ -2327,7 +2330,7 @@ echo "<br>
|
||||
<form name=form1 action=c_double.php method=post>
|
||||
<select name=double size=1 style=color:white;background-color:black>";
|
||||
|
||||
OptionsForCitys();
|
||||
echo optionsForCities();
|
||||
|
||||
echo "
|
||||
</select>
|
||||
@@ -2368,7 +2371,7 @@ echo "<br>
|
||||
<form name=form1 action=c_double.php method=post>
|
||||
<select name=double size=1 style=color:white;background-color:black>";
|
||||
|
||||
OptionsForCitys();
|
||||
echo optionsForCities();
|
||||
|
||||
echo "
|
||||
</select>
|
||||
@@ -2409,7 +2412,7 @@ echo "<br>
|
||||
<form name=form1 action=c_double.php method=post>
|
||||
<select name=double size=1 style=color:white;background-color:black>";
|
||||
|
||||
OptionsForCitys();
|
||||
echo optionsForCities();
|
||||
|
||||
echo "
|
||||
</select>
|
||||
@@ -2450,7 +2453,7 @@ echo "<br>
|
||||
<form name=form1 action=c_double.php method=post>
|
||||
<select name=double size=1 style=color:white;background-color:black>";
|
||||
|
||||
OptionsForCitys();
|
||||
echo optionsForCities();
|
||||
|
||||
echo "
|
||||
</select>
|
||||
@@ -2491,7 +2494,7 @@ echo "<br>
|
||||
<form name=form1 action=c_double.php method=post>
|
||||
<select name=double size=1 style=color:white;background-color:black>";
|
||||
|
||||
OptionsForCitys();
|
||||
echo optionsForCities();
|
||||
|
||||
echo "
|
||||
</select>
|
||||
@@ -2532,7 +2535,7 @@ echo "<br>
|
||||
<form name=form1 action=c_double.php method=post>
|
||||
<select name=double size=1 style=color:white;background-color:black>";
|
||||
|
||||
OptionsForCitys();
|
||||
echo optionsForCities();
|
||||
|
||||
echo "
|
||||
</select>
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
<?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();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -19,7 +19,7 @@ class RegNPC extends \sammo\Event\Action{
|
||||
int $death = 300,
|
||||
$ego = null,
|
||||
string $char = '',
|
||||
string $text = ''
|
||||
$text = ''
|
||||
){
|
||||
$this->npc = new \sammo\Scenario\NPC(
|
||||
$affinity,
|
||||
@@ -34,7 +34,7 @@ class RegNPC extends \sammo\Event\Action{
|
||||
$death,
|
||||
$ego,
|
||||
$char,
|
||||
$text
|
||||
$text?:''
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ class EventHandler{
|
||||
|
||||
$resultAction = [];
|
||||
foreach($this->actions as $action){
|
||||
$resultAction[] = $action->run();
|
||||
$resultAction[] = $action->run($env);
|
||||
}
|
||||
$result['action'] = $resultAction;
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ namespace sammo;
|
||||
class GameConst
|
||||
{
|
||||
/** @var string 버전 */
|
||||
public static $title = "삼국지 모의전투 PHP HideD";
|
||||
public static $title = "삼국지 모의전투 PHP HiDCHe";
|
||||
/** @var string 코드 아래에 붙는 설명 코드 */
|
||||
public static $banner = "KOEI의 이미지를 사용, 응용하였습니다 / 제작 : HideD(hided62@gmail.com)";
|
||||
/** @var string 코드 아래에 붙는 설명 코드 */
|
||||
@@ -80,4 +80,7 @@ class GameConst
|
||||
public static $defaultMaxGenius = 5;
|
||||
/** @var int 초기 시작 년도. 실제 값은 시나리오에서 정해지므로 딱히 의미는 없음. */
|
||||
public static $defaultStartYear = 180;
|
||||
|
||||
/** @var int 최대 턴(현재는 DB상 24턴으로 고정) */
|
||||
public static $maxTurn = 24;
|
||||
}
|
||||
|
||||
@@ -63,8 +63,7 @@ class GameUnitDetail{
|
||||
}
|
||||
|
||||
if($this->recruitType == 2){
|
||||
$cityLevel = CityConst::byID($this->id)->level;
|
||||
$cityLevel = CityConst::$regionMap[$cityLevel];
|
||||
$cityLevel = CityConst::byID($this->recruitCondition)->level;
|
||||
|
||||
if(!key_exists($this->recruitCondition, $ownCities)){
|
||||
return false;
|
||||
|
||||
@@ -0,0 +1,298 @@
|
||||
<?php
|
||||
namespace sammo;
|
||||
|
||||
class Message
|
||||
{
|
||||
const MAILBOX_PUBLIC = 9999;
|
||||
const MAILBOX_NATIONAL = 9000;
|
||||
|
||||
const MSGTYPE_PUBLIC = 'public';
|
||||
const MSGTYPE_PRIVATE = 'private';
|
||||
const MSGTYPE_NATIONAL = 'national';
|
||||
const MSGTYPE_DIPLOMACY = 'diplomacy';
|
||||
|
||||
//기본 정보
|
||||
public $mailbox = null;
|
||||
public $id = null;
|
||||
public $isInboxMail = false;
|
||||
|
||||
protected $sendCnt = 0;
|
||||
|
||||
public $msgType;
|
||||
/** @var MessageTarget */
|
||||
public $src;
|
||||
/** @var MessageTarget */
|
||||
public $dest;
|
||||
public $msg;
|
||||
/** @var \DateTime */
|
||||
public $date;
|
||||
/** @var \DateTime */
|
||||
public $validUntil;
|
||||
|
||||
public $msgOption;
|
||||
|
||||
public function __construct(
|
||||
string $msgType,
|
||||
MessageTarget $src,
|
||||
MessageTarget $dest,
|
||||
string $msg,
|
||||
\DateTime $date,
|
||||
\DateTime $validUntil,
|
||||
array $msgOption
|
||||
) {
|
||||
if (!static::isValidMsgType($msgType)) {
|
||||
throw new \InvalidArgumentException('올바르지 않은 msgType');
|
||||
}
|
||||
|
||||
$this->msgType = $msgType;
|
||||
$this->src = $src;
|
||||
$this->dest = $dest;
|
||||
$this->msg = $msg;
|
||||
$this->date = $date;
|
||||
$this->validUntil = $validUntil;
|
||||
$this->msgOption = $msgOption;
|
||||
}
|
||||
|
||||
public function setSentInfo(int $mailbox, int $messageID) : this
|
||||
{
|
||||
if(!Message::isValidMailBox($mailbox)){
|
||||
throw new \InvalidArgumentException('올바르지 않은 mailbox');
|
||||
}
|
||||
|
||||
do{
|
||||
if($mailbox === Message::MAILBOX_PUBLIC){
|
||||
if($this->msgType !== Message::MSGTYPE_PUBLIC){
|
||||
throw new \InvalidArgumentException('올바르지 않은 mailbox, msgType !== MSGTYPE_PUBLIC');
|
||||
}
|
||||
$this->isInboxMail = true;
|
||||
break;
|
||||
}
|
||||
if($mailbox > Message::MAILBOX_NATIONAL){
|
||||
if($this->msgType === Message::MSGTYPE_DIPLOMACY){
|
||||
$this->isInboxMail = true;
|
||||
break;
|
||||
}
|
||||
if ($this->msgType !== Message::MSGTYPE_NATIONAL) {
|
||||
throw new \InvalidArgumentException('올바르지 않은 mailbox, msgType not in (MSGTYPE_DIPLOMACY, MSGTYPE_NATIONAL)');
|
||||
}
|
||||
if($this->dest->nationID + Message::MAILBOX_NATIONAL === $mailbox){
|
||||
$this->isInboxMail = true;
|
||||
break;
|
||||
}
|
||||
if($this->src->nationID + Message::MAILBOX_NATIONAL === $mailbox){
|
||||
$this->isInboxMail = false;
|
||||
break;
|
||||
}
|
||||
throw new \InvalidArgumentException('송신, 수신국 둘 중의 어느 메일함도 아닙니다');
|
||||
}
|
||||
if($this->msgType !== Message::MSGTYPE_PRIVATE){
|
||||
throw new \InvalidArgumentException('올바르지 않은 mailbox, msgType !== MSGTYPE_PRIVATE');
|
||||
}
|
||||
if($this->dest->generalID === $mailbox){
|
||||
$this->isInboxMail = true;
|
||||
break;
|
||||
}
|
||||
if($this->src->generalID === $mailbox){
|
||||
$this->isInboxMail = false;
|
||||
break;
|
||||
}
|
||||
throw new \InvalidArgumentException('송신자, 수신자 둘 중의 어느 메일함도 아닙니다');
|
||||
}while(false);
|
||||
|
||||
$this->id = $messageID;
|
||||
$this->mailbox = $mailbox;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public static function buildFromArray(array $row) : Message
|
||||
{
|
||||
$dbMessage = Json::decode($row['message']);
|
||||
|
||||
$msgType = $row['type'];
|
||||
$src = MessageTarget::buildFromArray($dbMessage['src']);
|
||||
$dest = MessageTarget::buildFromArray($dbMessage['dest']);
|
||||
$option = Util::array_get($dbMessage['option'], []);
|
||||
|
||||
$args = [
|
||||
$msgType,
|
||||
$src,
|
||||
$dest,
|
||||
$dbMessage['text'],
|
||||
new \DateTime($row['time']),
|
||||
new \DateTime($row['valid_until']),
|
||||
$option
|
||||
];
|
||||
|
||||
$action = Util::array_get($option['action'], null);
|
||||
if ($msgType === self::MSGTYPE_DIPLOMACY) {
|
||||
$objMessage = new DiplomacticMessage(...$args);
|
||||
} elseif ($action === 'scout') {
|
||||
$objMessage = new ScoutMessage(...$args);
|
||||
} else {
|
||||
$objMessage = new Message(...$args);
|
||||
}
|
||||
|
||||
$objMessage->setSentInfo($row['mailbox'], $row['id']);
|
||||
|
||||
return $objMessage;
|
||||
}
|
||||
|
||||
protected static function isValidMailBox(int $mailbox): bool
|
||||
{
|
||||
if ($mailbox > self::MAILBOX_PUBLIC) {
|
||||
return false;
|
||||
}
|
||||
if ($mailbox == self::MAILBOX_NATIONAL) {
|
||||
return false;
|
||||
}
|
||||
if ($mailbox <= 0) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
protected static function isValidMsgType(string $msgType): bool
|
||||
{
|
||||
switch ($msgType) {
|
||||
case static::MSGTYPE_PUBLIC: return true;
|
||||
case static::MSGTYPE_PRIVATE: return true;
|
||||
case static::MSGTYPE_NATIONAL: return true;
|
||||
case static::MSGTYPE_DIPLOMACY: return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function getMessageByID(int $messageID) : Message
|
||||
{
|
||||
$db = DB::db();
|
||||
$row = $db->queryFirstRow('SELECT * FROM `message` WHERE `id` = %i', $messageID);
|
||||
if (!$row) {
|
||||
return null;
|
||||
}
|
||||
return static::buildFromArray($row);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $mailbox 메일 사서함.
|
||||
* @param string $msgType 메일 타입. MSGTYPE 중 하나.
|
||||
* @param int $limit 가져오고자 하는 수. 0 이하의 값이면 모두.
|
||||
* @param int $fromSeq 가져오고자 하는 위치. $fromSeq보다 '큰' seq만 가져온다. 따라서 0 이하이면 모두 가져옴.
|
||||
* @return Message[]
|
||||
*/
|
||||
protected static function getMessagesFromMailBox(int $mailbox, string $msgType, int $limit=30, int $fromSeq = 0)
|
||||
{
|
||||
$db = DB::db();
|
||||
|
||||
if (!static::isValidMsgType($msgType)) {
|
||||
throw new \InvalidArgumentException('올바르지 않은 $msgType');
|
||||
}
|
||||
|
||||
$where = new \WhereClause('and');
|
||||
$where->add('mailbox = %i', $mailbox);
|
||||
$where->add('type = %s', $msgType);
|
||||
if ($fromSeq > 0) {
|
||||
$where->add('id > %i', $fromSeq);
|
||||
}
|
||||
|
||||
if ($limit > 0) {
|
||||
$limitSql = $db->sqleval('LIMIT %i', $limit);
|
||||
} else {
|
||||
$limitSql = new \MeekroDBEval('');
|
||||
}
|
||||
|
||||
return array_map(function ($row) {
|
||||
return static::buildFromArray($row);
|
||||
}, $db->query('SELECT * FROM `message` WHERE %l %?', $where, $limitSql));
|
||||
}
|
||||
|
||||
protected function sendRaw(int $mailbox){
|
||||
//NOTE:: 여기선 검증하지 않는다.
|
||||
|
||||
|
||||
if($mailbox === self::MAILBOX_PUBLIC){
|
||||
$src_id = $this->src->generalID;
|
||||
$dest_id = self::MAILBOX_PUBLIC;
|
||||
}
|
||||
else if($mailbox > self::MAILBOX_NATIONAL){
|
||||
$src_id = $this->src->nationID + self::MAILBOX_NATIONAL;
|
||||
$dest_id = $this->dest->nationID + self::MAILBOX_NATIONAL;
|
||||
}
|
||||
else{
|
||||
$src_id = $this->src->generalID;
|
||||
$dest_id = $this->dest->generalID;
|
||||
}
|
||||
|
||||
|
||||
$db = DB::db();
|
||||
$db->insert('message', [
|
||||
'address' => $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(),
|
||||
'text' => $this->msg,
|
||||
'option' => $this->msgOption
|
||||
])
|
||||
]);
|
||||
return [$mailbox, $db->insertId()];
|
||||
}
|
||||
|
||||
protected function sendToSender() : int{
|
||||
if($this->sendCnt > 0){
|
||||
throw new \RuntimeException('이미 전송한 메일입니다.');
|
||||
}
|
||||
if($this->msgType === self::MSGTYPE_PRIVATE){
|
||||
return $this->sendRaw($this->src->generalID);
|
||||
}
|
||||
if($this->msgType === self::MSGTYPE_NATIONAL && $this->src->nationID !== $this->dest->nationID){
|
||||
return $this->sendRaw($this->src->nationID + self::MAILBOX_NATIONAL);
|
||||
}
|
||||
return [0, 0];
|
||||
}
|
||||
|
||||
protected function sendToReceiver() : int{
|
||||
if($this->sendCnt > 1 || $this->isInboxMail){
|
||||
throw new \RuntimeException('이미 전송한 메일입니다.');
|
||||
}
|
||||
|
||||
if($this->msgType === self::MSGTYPE_PRIVATE){
|
||||
return $this->sendRaw($this->dest->generalID);
|
||||
}
|
||||
|
||||
if($this->msgType === self::MSGTYPE_NATIONAL || $this->msgType === self::MSGTYPE_DIPLOMACY){
|
||||
return $this->sendRaw($this->dest->nationID + self::MAILBOX_NATIONAL);
|
||||
}
|
||||
|
||||
if($this->msgType === self::MSGTYPE_PUBLIC){
|
||||
return $this->sendRaw(self::MAILBOX_PUBLIC);
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
list($receiverMailbox, $receiveID) = $this->sendToReceiver();
|
||||
if(!$receiveID){
|
||||
return $sendID;
|
||||
}
|
||||
$this->mailbox = $receiverMailbox;
|
||||
$this->isInboxMail = true;
|
||||
$this->id = $receiveID;
|
||||
$this->msgOption['receiverMessageID'] = $receiveID;
|
||||
$this->$sendCnt = 2;
|
||||
|
||||
return $receiveID;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
namespace sammo;
|
||||
|
||||
class MessageTarget {
|
||||
/** @var int */
|
||||
public $generalID;
|
||||
/** @var int */
|
||||
public $nationID;
|
||||
|
||||
/** @var string */
|
||||
public $nationName;
|
||||
/** @var string */
|
||||
public $color;
|
||||
|
||||
public function __construct(int $generalID, int $nationID, string $nationName, string $color){
|
||||
|
||||
|
||||
if($mailbox > Message::MAILBOX_NATIONAL){
|
||||
$this->isGeneral = false;
|
||||
}
|
||||
else{
|
||||
$this->isGeneral = true;
|
||||
}
|
||||
|
||||
$this->generalID = $generalID;
|
||||
$this->nationID = $nationID;
|
||||
$this->nationName = $nationName;
|
||||
$this->color = $color;
|
||||
}
|
||||
|
||||
public static function buildFromArray(array $arr) : MessageTarget
|
||||
{
|
||||
if(!Util::array_get($arr['nation'])){
|
||||
$arr['nation'] = '재야';
|
||||
$arr['color'] = '#ffffff';
|
||||
$arr['nation_id'] = 0;
|
||||
}
|
||||
|
||||
return new MessageTarget($arr['id'], $arr['nation_id'], $arr['nation'], $arr['color']);
|
||||
}
|
||||
|
||||
public function toArray() : array{
|
||||
return [
|
||||
'id'=>$this->generalID,
|
||||
'nation_id'=>$this->nationID,
|
||||
'nation'=>$this->nationName,
|
||||
'color'=>$this->color
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
<?php
|
||||
namespace sammo;
|
||||
|
||||
class ScoutMessage extends Message{
|
||||
|
||||
public function __construct(
|
||||
string $msgType,
|
||||
MessageTarget $src,
|
||||
MessageTarget $dest,
|
||||
string $msg,
|
||||
\DateTime $date,
|
||||
\DateTime $validUntil,
|
||||
array $msgOption
|
||||
)
|
||||
{
|
||||
if ($msgType !== self::MSGTYPE_PRIVATE){
|
||||
throw new \InvalidArgumentException('DiplomaticMessage msgType');
|
||||
}
|
||||
parent::__construct(...func_get_args());
|
||||
|
||||
//TODO: 누가, 누구에게 보낸 건지 파싱
|
||||
}
|
||||
|
||||
public static function generateScoutMessage(int $srcGeneralID, int $destGeneralID, &$reason = null, \DateTime $date = null): Message{
|
||||
if($srcGeneralID == $destGeneralID){
|
||||
if($reason !== null){
|
||||
$reason = '같은 장수에게 등용장을 보낼 수 없습니다';
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
$db = DB::db();
|
||||
$srcGeneral = $db->queryFirstRow('SELECT nation FROM nation WHERE `no`=%i', $srcGeneralID);
|
||||
$destGeneral = $db->queryFirstRow('SELECT nation, `level` FROM nation WHERE `no`=%i', $destGeneralID);
|
||||
if($date === null){
|
||||
$date = new DateTime();
|
||||
}
|
||||
|
||||
if($destGeneral['level'] == 12){
|
||||
if($reason !== null){
|
||||
$reason = '군주에게 등용장을 보낼 수 없습니다';
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
if(!$srcGeneral['nation']){
|
||||
if($reason !== null){
|
||||
$reason = '재야 상태일 때에는 등용장을 보낼 수 없습니다';
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
if($srcGeneral['nation'] === $destGeneral['nation']){
|
||||
if($reason !== null){
|
||||
$reason = '같은 소속의 장수에게 등용장을 보낼 수 없습니다';
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
$srcNationInfo = getNationStaticInfo($srcGeneral['nation']);
|
||||
$destNationInfo = getNationStaticInfo($destGeneral['nation']);
|
||||
|
||||
$src = new MessageTarget(
|
||||
$srcGeneralID,
|
||||
$srcGeneral['nation'],
|
||||
$srcNationInfo['name'],
|
||||
$srcNationInfo['color']
|
||||
);
|
||||
|
||||
$dest = new MessageTarget(
|
||||
$destGeneralID,
|
||||
$destGeneral['nation'],
|
||||
Util::array_get($srcNationInfo['name'], ''),
|
||||
Util::array_get($srcNationInfo['color'], '')
|
||||
);
|
||||
|
||||
$msg = "{$src->nationName}(으)로 망명 권유 서신";
|
||||
$validUntil = new \DateTime("9999-12-31 12:59:59");
|
||||
|
||||
$msgOption = [
|
||||
'action'=>'scout'
|
||||
];
|
||||
|
||||
return new ScoutMessage(Message::MSGTYPE_PRIVATE, $src, $dest, $msg, $date, $validUntil, $msgOption);
|
||||
}
|
||||
|
||||
public function send(){
|
||||
$this->sendToReceiver();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,213 @@
|
||||
<?php
|
||||
namespace sammo;
|
||||
|
||||
//TODO: 나중에는 각 내특, 전특이 클래스로 가야함
|
||||
class SpecialityConst{
|
||||
//const GENERIC = 0x0;
|
||||
const DISABLED = 0x1;
|
||||
|
||||
const STAT_LEADERSHIP = 0x2;
|
||||
const STAT_POWER = 0x4;
|
||||
const STAT_INTEL = 0x8;
|
||||
|
||||
const ARMY_FOOTMAN = 0x100;
|
||||
const ARMY_ARCHER = 0x200;
|
||||
const ARMY_CAVALRY = 0x400;
|
||||
const ARMY_WIZARD = 0x800;
|
||||
const ARMY_SIEGE = 0x1000;
|
||||
|
||||
const REQ_DEXTERITY = 0x4000;
|
||||
|
||||
private $invDomestic = null;
|
||||
private $invWar = null;
|
||||
|
||||
private function __construct(){
|
||||
}
|
||||
|
||||
//음수 : 절대값 %, 양수 : 상대적 비중
|
||||
const DOMESTIC = [
|
||||
1 => ['경작', 1, self::STAT_INTEL],
|
||||
2 => ['상재', 1, self::STAT_INTEL],
|
||||
3 => ['발명', 1, self::STAT_INTEL],
|
||||
|
||||
10 => ['축성', 1, self::STAT_POWER],
|
||||
11 => ['수비', 1, self::STAT_POWER],
|
||||
12 => ['통찰', 1, self::STAT_POWER],
|
||||
|
||||
20 => ['인덕', 1, self::STAT_LEADERSHIP],
|
||||
|
||||
30 => ['거상', -2.5, self::DISABLED],
|
||||
31 => ['귀모', -2.5, self::STAT_LEADERSHIP | self::STAT_POWER | self::STAT_INTEL],
|
||||
];
|
||||
|
||||
const WAR = [
|
||||
40 => ['귀병', 1, self::STAT_INTEL | self::ARMY_WIZARD | self::REQ_DEXTERITY],
|
||||
|
||||
41 => ['신산', 1, self::STAT_INTEL | self::ARMY_WIZARD],
|
||||
42 => ['환술', -5, self::STAT_INTEL | self::ARMY_WIZARD],
|
||||
43 => ['집중', 1, self::STAT_INTEL | self::ARMY_WIZARD],
|
||||
44 => ['신중', 1, self::STAT_INTEL | self::ARMY_WIZARD],
|
||||
45 => ['반계', 1, self::STAT_INTEL | self::ARMY_WIZARD],
|
||||
|
||||
50 => ['보병', 1, self::STAT_LEADERSHIP | self::STAT_POWER | self::REQ_DEXTERITY | self::ARMY_FOOTMAN],
|
||||
51 => ['궁병', 1, self::STAT_LEADERSHIP | self::STAT_POWER | self::REQ_DEXTERITY | self::ARMY_ARCHER],
|
||||
52 => ['기병', 1, self::STAT_LEADERSHIP | self::STAT_POWER | self::REQ_DEXTERITY | self::ARMY_CAVALRY],
|
||||
53 => ['공성', 1, self::STAT_LEADERSHIP | self::STAT_POWER | self::REQ_DEXTERITY | self::ARMY_SIEGE],
|
||||
|
||||
60 => ['돌격', 1, self::STAT_LEADERSHIP | self::STAT_POWER],
|
||||
61 => ['무쌍', 1, self::STAT_LEADERSHIP | self::STAT_POWER],
|
||||
62 => ['견고', 1, self::STAT_LEADERSHIP | self::STAT_POWER],
|
||||
63 => ['위압', 1, self::STAT_LEADERSHIP | self::STAT_POWER],
|
||||
|
||||
70 => ['저격', 1, self::STAT_LEADERSHIP | self::STAT_POWER | self::STAT_INTEL],
|
||||
71 => ['필살', 1, self::STAT_LEADERSHIP | self::STAT_POWER | self::STAT_INTEL],
|
||||
72 => ['징병', 1, self::STAT_LEADERSHIP | self::STAT_POWER | self::STAT_INTEL],
|
||||
73 => ['의술', -2, self::STAT_LEADERSHIP | self::STAT_POWER | self::STAT_INTEL],
|
||||
74 => ['격노', 1, self::STAT_LEADERSHIP | self::STAT_POWER | self::STAT_INTEL],
|
||||
75 => ['척사', 1, self::STAT_LEADERSHIP | self::STAT_POWER | self::STAT_INTEL],
|
||||
];
|
||||
|
||||
public static function getInvDomestic(string $name){
|
||||
if(static::$invDomestic !== null){
|
||||
return static::$invDomestic[$name]??null;
|
||||
}
|
||||
|
||||
$invDomestic = [];
|
||||
foreach(static::DOMESTIC as $key=>$val){
|
||||
$nameKey = $val[0];
|
||||
$val[0] = $key;
|
||||
$invDomestic[$nameKey] = $val;
|
||||
}
|
||||
static::$invDomestic = $invDomestic;
|
||||
|
||||
return static::$invDomestic[$name]??null;
|
||||
}
|
||||
|
||||
public static function getInvWar(string $name){
|
||||
if(static::$invWar !== null){
|
||||
return static::$invWar[$name]??null;
|
||||
}
|
||||
|
||||
$invWar = [];
|
||||
foreach(static::War as $key=>$val){
|
||||
$nameKey = $val[0];
|
||||
$val[0] = $key;
|
||||
$invWar[$nameKey] = $val;
|
||||
}
|
||||
static::$invWar = $invWar;
|
||||
|
||||
return static::$invWar[$name]??null;
|
||||
}
|
||||
|
||||
private static function calcCondGeneric(array $general) : int {
|
||||
$myCond = 0;
|
||||
|
||||
if ($leader * 0.95 > $power && $leader * 0.95 > $intel) {
|
||||
$myCond |= STAT_LEADERSHIP;
|
||||
}
|
||||
else if($power >= $intel){
|
||||
$myCond |= STAT_POWER;
|
||||
}
|
||||
else {
|
||||
$myCond |= STAT_INTEL;
|
||||
}
|
||||
|
||||
return $myCond;
|
||||
}
|
||||
|
||||
private static function calcCondDexterity(array $general) : int {
|
||||
$dex = [
|
||||
static::ARMY_FOOTMAN => $general['dex0'],
|
||||
static::ARMY_ARCHER => $general['dex10'],
|
||||
static::ARMY_CAVALRY => $general['dex20'],
|
||||
static::ARMY_WIZARD => $general['dex30'],
|
||||
static::ARMY_SIEGE => $general['dex40'],
|
||||
];
|
||||
|
||||
$dexSum = array_sum($dex);
|
||||
$dexBase = Util::round(sqrt($dexSum) / 4);
|
||||
|
||||
if(Util::randBool(0.8)){
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(mt_rand(0, 99) < $dexBase){
|
||||
return 0;
|
||||
}
|
||||
|
||||
if($dexSum){
|
||||
return array_rand($dex);
|
||||
}
|
||||
|
||||
return array_keys($dex, max($dex))[0];
|
||||
}
|
||||
|
||||
public static function pickSpecialDomestic(array $general) : int{
|
||||
$pAbs = [];
|
||||
$pRel = [];
|
||||
|
||||
$myCond = static::calcCondGeneric($general);
|
||||
|
||||
foreach(self::DOMESTIC as $id=>list($name, $weight, $cond)){
|
||||
if(!($cond & $myCond)){
|
||||
continue;
|
||||
}
|
||||
|
||||
if($weight < 0){
|
||||
$pAbs[$id] = -$weight;
|
||||
}
|
||||
else{
|
||||
$pRel[$id] = $weight;
|
||||
}
|
||||
}
|
||||
|
||||
if($pAbs){
|
||||
$pAbs[0] = max(0, 100 - array_sum($pAbs));
|
||||
$id = Util::choiceRandomUsingWeight($pAbs);
|
||||
if($id){
|
||||
return $id;
|
||||
}
|
||||
}
|
||||
|
||||
return Util::choiceRandomUsingWeight($pRel);
|
||||
}
|
||||
|
||||
public static function pickSpecialWar(array $general) : int{
|
||||
$reqDex = [];
|
||||
$pAbs = [];
|
||||
$pRel = [];
|
||||
|
||||
$myCond = static::calcCondGeneric($general);
|
||||
$myCond |= static::calcCondDexterity($general);
|
||||
|
||||
foreach(self::WAR as $id=>list($name, $weight, $cond)){
|
||||
if(!($cond & $myCond)){
|
||||
continue;
|
||||
}
|
||||
|
||||
if($cond & self::REQ_DEXTERITY){
|
||||
$reqDex[$id] = $weight;
|
||||
}
|
||||
else if($weight < 0){
|
||||
$pAbs[$id] = -$weight;
|
||||
}
|
||||
else{
|
||||
$pRel[$id] = $weight;
|
||||
}
|
||||
}
|
||||
|
||||
if($reqDex){
|
||||
return Util::choiceRandomUsingWeight($reqDex);
|
||||
}
|
||||
|
||||
if($pAbs){
|
||||
$pAbs[0] = max(0, 100 - array_sum($pAbs));
|
||||
$id = Util::choiceRandomUsingWeight($pAbs);
|
||||
if($id){
|
||||
return $id;
|
||||
}
|
||||
}
|
||||
|
||||
return Util::choiceRandomUsingWeight($pRel);
|
||||
}
|
||||
}
|
||||
+26
-5
@@ -54,7 +54,7 @@ CREATE TABLE `general` (
|
||||
`turntime` DATETIME NULL DEFAULT NULL,
|
||||
`recwar` DATETIME NULL DEFAULT NULL,
|
||||
`makenation` CHAR(255) NULL DEFAULT NULL,
|
||||
`makelimit` INT(2) NULL DEFAULT '24',
|
||||
`makelimit` INT(2) NULL DEFAULT '0',
|
||||
`killturn` INT(3) NULL DEFAULT NULL,
|
||||
`lastconnect` DATETIME NULL DEFAULT NULL,
|
||||
`lastrefresh` DATETIME NULL DEFAULT NULL,
|
||||
@@ -319,8 +319,7 @@ create table city (
|
||||
state int(2) default 0,
|
||||
region int(2) default 0,
|
||||
term int(1) default 0,
|
||||
conflict char(255) default '',
|
||||
conflict2 char(255) default '',
|
||||
conflict varchar(500) default '{}'
|
||||
|
||||
PRIMARY KEY (city),
|
||||
KEY (nation)
|
||||
@@ -422,7 +421,6 @@ CREATE TABLE `message` (
|
||||
`id` INT(11) NOT NULL AUTO_INCREMENT,
|
||||
`mailbox` INT(11) NOT NULL COMMENT '9999 == public, >= 9000 national',
|
||||
`type` ENUM('private','national','public','diplomacy') NOT NULL,
|
||||
`is_sender` BIT(1) NOT NULL,
|
||||
`src` INT(11) NOT NULL,
|
||||
`dest` INT(11) NOT NULL,
|
||||
`time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
@@ -464,7 +462,7 @@ create table if not exists emperior (
|
||||
special_hist text default '',
|
||||
name char(64) default '',
|
||||
type char(64) default '',
|
||||
color char(6) default '',
|
||||
color char(7) default '',
|
||||
year int(4) default 0,
|
||||
month int(2) default 0,
|
||||
power int(8) default 0,
|
||||
@@ -490,6 +488,29 @@ create table if not exists emperior (
|
||||
PRIMARY KEY (no)
|
||||
) ENGINE=INNODB ROW_FORMAT=COMPRESSED DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
INSERT IGNORE INTO `hall` (`type`, `rank`) VALUES
|
||||
( 0, 0), ( 0, 1), ( 0, 2), ( 0, 3), ( 0, 4), ( 0, 5), ( 0, 6), ( 0, 7), ( 0, 8), ( 0, 9),
|
||||
( 1, 0), ( 1, 1), ( 1, 2), ( 1, 3), ( 1, 4), ( 1, 5), ( 1, 6), ( 1, 7), ( 1, 8), ( 1, 9),
|
||||
( 2, 0), ( 2, 1), ( 2, 2), ( 2, 3), ( 2, 4), ( 2, 5), ( 2, 6), ( 2, 7), ( 2, 8), ( 2, 9),
|
||||
( 3, 0), ( 3, 1), ( 3, 2), ( 3, 3), ( 3, 4), ( 3, 5), ( 3, 6), ( 3, 7), ( 3, 8), ( 3, 9),
|
||||
( 4, 0), ( 4, 1), ( 4, 2), ( 4, 3), ( 4, 4), ( 4, 5), ( 4, 6), ( 4, 7), ( 4, 8), ( 4, 9),
|
||||
( 5, 0), ( 5, 1), ( 5, 2), ( 5, 3), ( 5, 4), ( 5, 5), ( 5, 6), ( 5, 7), ( 5, 8), ( 5, 9),
|
||||
( 6, 0), ( 6, 1), ( 6, 2), ( 6, 3), ( 6, 4), ( 6, 5), ( 6, 6), ( 6, 7), ( 6, 8), ( 6, 9),
|
||||
( 7, 0), ( 7, 1), ( 7, 2), ( 7, 3), ( 7, 4), ( 7, 5), ( 7, 6), ( 7, 7), ( 7, 8), ( 7, 9),
|
||||
( 8, 0), ( 8, 1), ( 8, 2), ( 8, 3), ( 8, 4), ( 8, 5), ( 8, 6), ( 8, 7), ( 8, 8), ( 8, 9),
|
||||
( 9, 0), ( 9, 1), ( 9, 2), ( 9, 3), ( 9, 4), ( 9, 5), ( 9, 6), ( 9, 7), ( 9, 8), ( 9, 9),
|
||||
(10, 0), (10, 1), (10, 2), (10, 3), (10, 4), (10, 5), (10, 6), (10, 7), (10, 8), (10, 9),
|
||||
(11, 0), (11, 1), (11, 2), (11, 3), (11, 4), (11, 5), (11, 6), (11, 7), (11, 8), (11, 9),
|
||||
(12, 0), (12, 1), (12, 2), (12, 3), (12, 4), (12, 5), (12, 6), (12, 7), (12, 8), (12, 9),
|
||||
(13, 0), (13, 1), (13, 2), (13, 3), (13, 4), (13, 5), (13, 6), (13, 7), (13, 8), (13, 9),
|
||||
(14, 0), (14, 1), (14, 2), (14, 3), (14, 4), (14, 5), (14, 6), (14, 7), (14, 8), (14, 9),
|
||||
(15, 0), (15, 1), (15, 2), (15, 3), (15, 4), (15, 5), (15, 6), (15, 7), (15, 8), (15, 9),
|
||||
(16, 0), (16, 1), (16, 2), (16, 3), (16, 4), (16, 5), (16, 6), (16, 7), (16, 8), (16, 9),
|
||||
(17, 0), (17, 1), (17, 2), (17, 3), (17, 4), (17, 5), (17, 6), (17, 7), (17, 8), (17, 9),
|
||||
(18, 0), (18, 1), (18, 2), (18, 3), (18, 4), (18, 5), (18, 6), (18, 7), (18, 8), (18, 9),
|
||||
(19, 0), (19, 1), (19, 2), (19, 3), (19, 4), (19, 5), (19, 6), (19, 7), (19, 8), (19, 9),
|
||||
(20, 0), (20, 1), (20, 2), (20, 3), (20, 4), (20, 5), (20, 6), (20, 7), (20, 8), (20, 9);
|
||||
|
||||
###########################################################################
|
||||
## 외교 테이블
|
||||
###########################################################################
|
||||
|
||||
@@ -19,13 +19,15 @@
|
||||
운영자가 처리할 때까지 기다려주세요
|
||||
</main>
|
||||
<div class="with_border">
|
||||
<button style='width:200px;height:2em;font-size:1.2em;' onclick="location.replace('index.php')">몇 초 뒤 눌러주세요</button>
|
||||
<button style='width:200px;height:2em;font-size:1.2em;' onclick="location.replace('./')">몇 초 뒤 눌러주세요</button>
|
||||
</div>
|
||||
<div class="with_border">
|
||||
<?=$message?>
|
||||
</div>
|
||||
<div class="with_border">
|
||||
<pre>
|
||||
<?php debug_print_backtrace(); ?>
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
<div class="small_war_log">
|
||||
<span class="o_diamond">
|
||||
|
||||
</span>
|
||||
<span class="date">
|
||||
<span class="year"><?=$year?></span>년
|
||||
<div class="small_war_log"
|
||||
><span class="o_diamond"></span
|
||||
><span class="date"
|
||||
><span class="year"><?=$year?></span>년
|
||||
<span class="month"><?=$month?></span>월:
|
||||
</span>
|
||||
<span class="war_type war_type_<?=$war_type?>"><?=$war_type_str?></span>
|
||||
@@ -16,9 +14,9 @@
|
||||
</span>
|
||||
|
||||
<span class="crew_plate">
|
||||
<span class="remain_crew"><?=$me['remain']?></span>
|
||||
<span class="remain_crew"><?=$me['remain_crew']?></span>
|
||||
<span class="killed_plate">
|
||||
(<span class="killed_crew"><?=$me['killed']?></span>)
|
||||
(<span class="killed_crew"><?=$me['killed_crew']?></span>)
|
||||
</span>
|
||||
</span>
|
||||
</span>
|
||||
@@ -27,9 +25,9 @@
|
||||
|
||||
<span class="you">
|
||||
<span class="crew_plate">
|
||||
<span class="remain_crew"><?=$you['remain']?></span>
|
||||
<span class="remain_crew"><?=$you['remain_crew']?></span>
|
||||
<span class="killed_plate">
|
||||
(<span class="killed_crew"><?=$you['killed']?></span>)
|
||||
(<span class="killed_crew"><?=$you['killed_crew']?></span>)
|
||||
</span>
|
||||
</span>
|
||||
|
||||
|
||||
+31
-66
@@ -5,6 +5,12 @@ include "lib.php";
|
||||
include "func.php";
|
||||
//로그인 검사
|
||||
|
||||
$type = Util::getReq('type', 'int', 0);
|
||||
$sel = Util::getReq('sel', 'int', 1);
|
||||
|
||||
if($sel <= 0 || $sel > 12){
|
||||
$sel = 1;
|
||||
}
|
||||
|
||||
$session = Session::requireGameLogin()->setReadOnly();
|
||||
$userID = Session::getUserID();
|
||||
@@ -14,87 +20,46 @@ $connect=$db->get();
|
||||
|
||||
increaseRefresh("턴반복", 1);
|
||||
|
||||
$query = "select conlimit from game limit 1";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$admin = MYDB_fetch_array($result);
|
||||
$myActionCnt = $db->queryFirstField('SELECT con FROM general WHERE `owner`=%i', $userID);
|
||||
$conLimit = $db->queryFirstField('SELECT conlimit FROM game LIMIT 1');
|
||||
|
||||
$query = "select no,name,nation,con from general where owner='{$userID}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$me = MYDB_fetch_array($result);
|
||||
|
||||
$con = checkLimit($me['con'], $admin['conlimit']);
|
||||
$con = checkLimit($myActionCnt, $conLimit);
|
||||
if($con >= 2) {
|
||||
//echo "<script>window.top.main.location.replace('index.php');</script>";
|
||||
echo 'index.php';//TODO:debug all and replace
|
||||
header('location:commandlist.php');
|
||||
exit();
|
||||
}
|
||||
|
||||
switch($type) {
|
||||
case 0:
|
||||
/*
|
||||
for($i=0; $i < $sel; $i++) {
|
||||
$k = $i + $sel;
|
||||
$query = "update general set ";
|
||||
while(1) {
|
||||
$query .= "turn{$k}=turn{$i}";
|
||||
$k += $sel;
|
||||
if($k >= 24) break;
|
||||
$query .= ",";
|
||||
}
|
||||
$query .= " where owner='{$userID}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
case 0://반복
|
||||
$valueMap = [];
|
||||
foreach(range($sel, GameConst::$maxTurn - 1) as $idx){
|
||||
$src = $idx % $sel;
|
||||
$valueMap['turn'.$idx] = $db->sqleval('%b', 'turn'.$src);
|
||||
}
|
||||
*/
|
||||
$query = "update general set ";
|
||||
for($i=0; $i < $sel; $i++) {
|
||||
$k = $i + $sel;
|
||||
while(1) {
|
||||
$query .= "turn{$k}=turn{$i}";
|
||||
$k += $sel;
|
||||
if($i < $sel-1 || $k < 24) { $query .= ","; }
|
||||
if($k >= 24) break;
|
||||
}
|
||||
}
|
||||
$query .= " where owner='{$userID}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$db->update('general', $valueMap, 'owner=%i', $userID);
|
||||
break;
|
||||
case 1:
|
||||
$i = 23 - $sel;
|
||||
$k = 23;
|
||||
$query = "update general set ";
|
||||
while(1) {
|
||||
$query .= "turn{$k}=turn{$i},";
|
||||
$i--; $k--;
|
||||
if($i < 0) break;
|
||||
$valueMap = [];
|
||||
foreach(range(GameConst::$maxTurn -1, $sel, -1) as $idx){
|
||||
$src = $idx - $sel;
|
||||
$valueMap['turn'.$idx] = $db->sqleval('%b', 'turn'.$src);
|
||||
}
|
||||
while(1) {
|
||||
$query .= "turn{$k}=0";
|
||||
$k--;
|
||||
if($k < 0) break;
|
||||
$query .= ",";
|
||||
foreach(range($sel -1, 0, -1) as $idx){
|
||||
$valueMap['turn'.$idx] = EncodeCommand(0, 0, 0, 0);
|
||||
}
|
||||
$query .= " where owner='{$userID}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$db->update('general', $valueMap, 'owner=%i', $userID);
|
||||
break;
|
||||
case 2:
|
||||
$i = 0;
|
||||
$k = $sel;
|
||||
$query = "update general set ";
|
||||
while(1) {
|
||||
$query .= "turn{$i}=turn{$k},";
|
||||
$i++; $k++;
|
||||
if($k >= 24) break;
|
||||
$valueMap = [];
|
||||
foreach(range(0, GameConst::$maxTurn - $sel - 1) as $idx){
|
||||
$src = $idx + $sel;
|
||||
$valueMap['turn'.$idx] = $db->sqleval('%b', 'turn'.$src);
|
||||
}
|
||||
while(1) {
|
||||
$query .= "turn{$i}=0";
|
||||
$i++;
|
||||
if($i >= 24) break;
|
||||
$query .= ",";
|
||||
foreach(range(GameConst::$maxTurn - $sel, GameConst::$maxTurn - 1) as $idx){
|
||||
$valueMap['turn'.$idx] = EncodeCommand(0, 0, 0, 0);
|
||||
}
|
||||
$query .= " where owner='{$userID}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$db->update('general', $valueMap, 'owner=%i', $userID);
|
||||
break;
|
||||
}
|
||||
|
||||
//echo "<script>location.replace('commandlist.php');</script>";
|
||||
echo 'commandlist.php';//TODO:debug all and replace
|
||||
header('location:commandlist.php');
|
||||
|
||||
@@ -16,5 +16,4 @@ $me = MYDB_fetch_array($result);
|
||||
|
||||
updateCommand($me['no'], 2);
|
||||
|
||||
//echo "<script>location.replace('b_chiefcenter.php');</script>";
|
||||
echo 'b_chiefcenter.php';//TODO:debug all and replace
|
||||
header('location:b_chiefcenter.php');
|
||||
|
||||
@@ -16,6 +16,4 @@ $me = MYDB_fetch_array($result);
|
||||
|
||||
backupdateCommand($me['no'], 2);
|
||||
|
||||
//echo "<script>location.replace('b_chiefcenter.php');</script>";
|
||||
echo 'b_chiefcenter.php';//TODO:debug all and replace
|
||||
|
||||
header('location:b_chiefcenter.php');
|
||||
|
||||
@@ -8,7 +8,7 @@ $userID = Session::getUserID();
|
||||
|
||||
// 외부 파라미터
|
||||
// $_POST['pw'] : PW
|
||||
$pw = $_POST['pw'];
|
||||
$pw = Util::getReq('pw');
|
||||
|
||||
if(!$pw){
|
||||
Json::die([
|
||||
|
||||
@@ -13,9 +13,9 @@ if($session->userGrade < 6){
|
||||
}
|
||||
|
||||
// 외부 파라미터
|
||||
// $_POST['action'] : 처리종류
|
||||
// $_POST['user_id'] : 유저 이름
|
||||
// $_POST['param'] : 추가 파라미터
|
||||
// action : 처리종류
|
||||
// user_id : 유저 이름
|
||||
// param : 추가 파라미터
|
||||
|
||||
$action = Util::getReq('action');
|
||||
$userID = Util::getReq('user_id');
|
||||
|
||||
+5
-9
@@ -4,7 +4,7 @@ namespace sammo;
|
||||
require(__dir__.'/../vendor/autoload.php');
|
||||
|
||||
WebUtil::setHeaderNoCache();
|
||||
$category = Util::array_get($_GET['category'], 0);
|
||||
$category = Util::getReq('category', 0);
|
||||
//FIXME: 겨우 category 구분을 위해 php를 써야하는가? JavaScript로 바꾸자
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
@@ -82,7 +82,7 @@ if ($category == 0) {
|
||||
<tr><td height=50 bgcolor=yellow align=center><b><font color=black size=5>시 작 하 기</font></b></td></tr>
|
||||
<tr>
|
||||
<td>
|
||||
<font class=intro>◈ 본 튜토리얼은 『삼국지 모의전투』(이하 삼모전) 『유기체서버』(이하 체섭)를 처음 접하시는 초보 유저(이하 뉴비)분들을 위한 길잡이입니다^^ 위에서부터 아래로 읽어나가며 따라하다보면 금방 뉴비신세는 벗어날 수 있답니다~ 세부사항은 『레퍼런스 게시판』을 참고하시면 됩니다! 그럼 시작해볼까요?<br>
|
||||
<font class=intro>◈ 본 튜토리얼은 『삼국지 모의전투』(이하 삼모전) 『HiDCHe』(구 유기체서버, 이하 체섭)를 처음 접하시는 초보 유저(이하 뉴비)분들을 위한 길잡이입니다^^ 위에서부터 아래로 읽어나가며 따라하다보면 금방 뉴비신세는 벗어날 수 있답니다~ 세부사항은 『레퍼런스 게시판』을 참고하시면 됩니다! 그럼 시작해볼까요?<br>
|
||||
<br>
|
||||
◈ 우선 예약턴제 전략 웹게임인 『체섭』의 컨셉 & 모토를 이해해봅시다.</font><br>
|
||||
<br>
|
||||
@@ -154,7 +154,7 @@ if ($category == 0) {
|
||||
<br>
|
||||
<font class=bullet>☞</font> 닉네임을 입력합니다.<br>
|
||||
<br>
|
||||
<font class=bullet>※</font> 닉네임이란 게임 내에서 사용되는 캐릭터 이름이 아닙니다. 단지 온라인에서 본인의 이름처럼 사용할 수 있는 것이면 됩니다. 그냥 평소 온라인에서 즐겨 쓰는 닉네임을 사용하시면 좋습니다. IRC 등에서 본인을 나타낼 수있는 목적으로 충분합니다. 참고로 운영자는 유기체라는 닉네임을 사용합니다^^<br>
|
||||
<font class=bullet>※</font> 닉네임이란 게임 내에서 사용되는 캐릭터 이름이 아닙니다. 단지 온라인에서 본인의 이름처럼 사용할 수 있는 것이면 됩니다. 그냥 평소 온라인에서 즐겨 쓰는 닉네임을 사용하시면 좋습니다. IRC 등에서 본인을 나타낼 수있는 목적으로 충분합니다. 참고로 운영자는 Hide_D라는 닉네임을 사용합니다^^<br>
|
||||
<br>
|
||||
<font class=bullet>☞</font> 필독사항을 읽고 동의란에 체크를 합니다.<br>
|
||||
<br>
|
||||
@@ -255,11 +255,7 @@ if ($category == 0) {
|
||||
<br>
|
||||
<font class=bullet>☞</font> 비밀번호를 변경할 수 있습니다.<br>
|
||||
<br>
|
||||
<font class=bullet>☞</font> 닉네임은 함부로 변경할 수 없으며, 특별히 바꾸고 싶은 경우는 IRC에서 유기체에게 문의해 주세요~<br>
|
||||
<br>
|
||||
<font class=bullet>☞</font> 참여하신 참여회원이라면 64x64크기의 자신만의 얼굴을 업로드하여 플레이할 수 있습니다.<br>
|
||||
<br>
|
||||
<font class=bullet>☞</font> 아래에는 참여내역이 표시됩니다. 서버의 운영은 꽤 많은 자금이 드는 일이므로 유저 여러분들의 힘을 모아서 운영하고 있습니다. 몇천원도 좋습니다. 참여의 행복을 느껴보시고 참여회원의 혜택도 누려보세요~ 하지만 여긴 상업적 목적의 게임이 아니므로 참여의 댓가를 바라기보단 순수한 참여의 참뜻을 느껴보시길 바랍니다~^^ 참여해주신 분들에게 유기체는 항상 감사하게 생각하고 있습니다.<br>
|
||||
<font class=bullet>☞</font> 닉네임은 함부로 변경할 수 없으며, 특별히 바꾸고 싶은 경우는 관리자에게 문의해 주세요~<br>
|
||||
<br>
|
||||
<font class=intro>◈ 자, 이제 본격적으로 게임에 들어가볼까요! 지금은 연습이므로 풰섭이나 퉤섭중에서 하나에 캐릭터를 생성하고 입장해봅시다.</font><br>
|
||||
</td>
|
||||
@@ -454,7 +450,7 @@ if ($category == 0) {
|
||||
<font class=bullet>☞</font> 6. 보낼 메세지를 입력합니다.<br>
|
||||
<font class=bullet>☞</font> 7. 엔터나 버튼을 눌러서 메세지를 보냅니다.<br>
|
||||
<font class=bullet>☞</font> 8. 전체 메세지, 국가 메세지, 개인 메세지가 표시됩니다.<br>
|
||||
<font class=bullet>☞</font> 9. 현재 버젼과 유기체의 연락처, 도움주신분들입니다.<br>
|
||||
<font class=bullet>☞</font> 9. 현재 버젼과 Hide_D의 연락처, 도움주신분들입니다.<br>
|
||||
<font class=bullet>☞</font> 10. 좋은 건의나 패치에 도움 주신분들을 적어드립니다~<br>
|
||||
<div class=clear></div>
|
||||
<br>
|
||||
|
||||
@@ -24,7 +24,7 @@ if ($session->isLoggedIn()) {
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||
<title>삼국지 모의전투 HiD 서버</title>
|
||||
<title>삼국지 모의전투 HiDCHe</title>
|
||||
<script src="e_lib/jquery-3.2.1.min.js"></script>
|
||||
<script src="e_lib/bootstrap.bundle.min.js"></script>
|
||||
<script src="e_lib/jquery.validate.min.js"></script>
|
||||
@@ -111,7 +111,7 @@ function postOAuthResult(result){
|
||||
<body>
|
||||
<div class="vertical-center">
|
||||
<div class="container">
|
||||
<h1 class="row justify-content-md-center">삼국지 모의전투 HiD</h1>
|
||||
<h1 class="row justify-content-md-center">삼국지 모의전투 HiDCHe</h1>
|
||||
<div class="row justify-content-md-center">
|
||||
<div class="col" style="max-width:450px;">
|
||||
<div class="card">
|
||||
|
||||
-234
@@ -1,234 +0,0 @@
|
||||
function ClearContent(sel) {
|
||||
$(sel).html("");
|
||||
}
|
||||
|
||||
function Open(url) {
|
||||
window.open(url);
|
||||
}
|
||||
|
||||
function Replace(url) {
|
||||
//location.replace(url);
|
||||
console.log('this',url);
|
||||
}
|
||||
|
||||
function ReplaceFrame(url) {
|
||||
console.log('top',url);
|
||||
window.top.location.replace(url);
|
||||
|
||||
}
|
||||
|
||||
function ImportStyle(href) {
|
||||
var CSS = document.createElement('link');
|
||||
CSS.rel = 'stylesheet';
|
||||
CSS.type = 'text/css';
|
||||
CSS.media = 'screen';
|
||||
CSS.href = href;
|
||||
document.getElementsByTagName('head')[0].appendChild(CSS);
|
||||
}
|
||||
|
||||
function ImportView(sel, url) {
|
||||
var html = $.ajax({
|
||||
url: url,
|
||||
async: false
|
||||
});
|
||||
$(sel).append(html.responseText);
|
||||
}
|
||||
|
||||
function ImportAction(sel, url) {
|
||||
var tag = "<script type=\"text/javascript\" src=\"" + url + "\"></script>";
|
||||
$(sel).append(tag);
|
||||
}
|
||||
|
||||
function ImportAction(url) {
|
||||
// 비동기라서 동기화된 함수로 변경
|
||||
// 추후 cache: true, 로 변경
|
||||
// $.getScript(url, function() { eval(initFunc); });
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: url,
|
||||
cache: true,
|
||||
async: false,
|
||||
dataType: 'script'
|
||||
});
|
||||
}
|
||||
|
||||
function GetJSON(url, data, callback) {
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: url,
|
||||
cache: true,
|
||||
async: true,
|
||||
data: data,
|
||||
success: callback,
|
||||
dataType: 'json',
|
||||
error: Error
|
||||
});
|
||||
}
|
||||
|
||||
function GetJSONSync(url, data, callback) {
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: url,
|
||||
cache: true,
|
||||
async: false,
|
||||
data: data,
|
||||
success: callback,
|
||||
dataType: 'json',
|
||||
error: Error
|
||||
});
|
||||
}
|
||||
|
||||
function PostJSON(url, data, callback) {
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: url,
|
||||
cache: true,
|
||||
async: true,
|
||||
data: data,
|
||||
success: callback,
|
||||
dataType: 'json',
|
||||
error: Error
|
||||
});
|
||||
}
|
||||
|
||||
function PostJSONSync(url, data, callback) {
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: url,
|
||||
cache: true,
|
||||
async: false,
|
||||
data: data,
|
||||
success: callback,
|
||||
dataType: 'json',
|
||||
error: Error
|
||||
});
|
||||
}
|
||||
|
||||
function Error(xhr, textStatus, errorThrown) {
|
||||
// alert(xhr.status);
|
||||
alert(xhr.responseText);
|
||||
// alert(textStatus);
|
||||
// alert(errorThrown);
|
||||
/*
|
||||
if(xhr.status == 404) {
|
||||
alert("처리 프로그램이 없습니다!");
|
||||
alert(xhr.responseText);
|
||||
} else if(xhr.status == 500) {
|
||||
alert("처리 프로그램이 오류입니다!");
|
||||
alert(xhr.responseText);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
function IsNumber(input) {
|
||||
var check = /(^\d+$)/;
|
||||
return check.test(input);
|
||||
}
|
||||
|
||||
function Second(time, amount) {
|
||||
var h = parseInt(time.substr(0, 2), 10);
|
||||
var m = parseInt(time.substr(3, 2), 10);
|
||||
var s = parseInt(time.substr(6, 2), 10);
|
||||
s += amount;
|
||||
|
||||
if(amount > 0) {
|
||||
if(s > 60) { m += Math.floor(s/60); s = s%60; }
|
||||
if(m > 60) { h += Math.floor(m/60); m = m%60; }
|
||||
if(h > 24) { h = h%24; }
|
||||
} else {
|
||||
if(s < 0) { m += Math.floor(s/60); s = 60+s%60; }
|
||||
if(m < 0) { h += Math.floor(m/60); m = 60+m%60; }
|
||||
if(h < 0) { h = 24+h%24; }
|
||||
}
|
||||
|
||||
if(h < 10) h = "0"+h;
|
||||
if(m < 10) m = "0"+m;
|
||||
if(s < 10) s = "0"+s;
|
||||
|
||||
var newTime = h+":"+m+":"+s;
|
||||
return newTime;
|
||||
}
|
||||
|
||||
function ExitButton(obj) {
|
||||
$(obj).each(function() {
|
||||
$(this).css("background", "transparent url(../e_image/button/exit0x26x25.png) no-repeat");
|
||||
$(this).mouseover(function () { $(this).css("background", "transparent url(../e_image/button/exit1x26x25.png) no-repeat" ); });
|
||||
$(this).mouseout(function () { $(this).css("background", "transparent url(../e_image/button/exit0x26x25.png) no-repeat"); });
|
||||
$(this).mousedown(function () { $(this).css("background", "transparent url(../e_image/button/exit2x26x25.png) no-repeat"); });
|
||||
$(this).mouseup(function () { $(this).css("background", "transparent url(../e_image/button/exit1x26x25.png) no-repeat"); });
|
||||
});
|
||||
}
|
||||
|
||||
function Button(obj, w) {
|
||||
$(obj).each(function() {
|
||||
$(this).css("background", "transparent url(../e_image/button/button0x"+w+"x20.png) no-repeat");
|
||||
$(this).mouseover(function () { $(this).css("background", "transparent url(../e_image/button/button1x"+w+"x20.png) no-repeat" ); });
|
||||
$(this).mouseout(function () { $(this).css("background", "transparent url(../e_image/button/button0x"+w+"x20.png) no-repeat"); });
|
||||
$(this).mousedown(function () { $(this).css("background", "transparent url(../e_image/button/button2x"+w+"x20.png) no-repeat"); });
|
||||
$(this).mouseup(function () { $(this).css("background", "transparent url(../e_image/button/button1x"+w+"x20.png) no-repeat"); });
|
||||
});
|
||||
}
|
||||
|
||||
function Disable(obj, w) {
|
||||
$(obj).each(function() {
|
||||
$(this).css("background", "transparent url(../e_image/button/button3x"+w+"x20.png) no-repeat");
|
||||
$(this).css("color", "#CCCCCC");
|
||||
$(this).css("font-style", "italic");
|
||||
$(this).css("cursor", "default");
|
||||
$(this).attr("disabled", "true");
|
||||
});
|
||||
}
|
||||
|
||||
function Enable(obj, w) {
|
||||
$(obj).each(function() {
|
||||
$(this).css("background", "transparent url(../e_image/button/button0x"+w+"x20.png) no-repeat");
|
||||
$(this).css("color", "#FFFFFF");
|
||||
$(this).css("font-style", "normal");
|
||||
$(this).css("cursor", "pointer");
|
||||
$(this).attr("disabled", "");
|
||||
});
|
||||
}
|
||||
|
||||
function Drag(obj) {
|
||||
var _ox = $(obj).offset().left;
|
||||
var _oy = $(obj).offset().top;
|
||||
|
||||
$(obj).attr("_x", 0);
|
||||
$(obj).attr("_y", 0);
|
||||
$(obj).attr("_ox", _ox);
|
||||
$(obj).attr("_oy", _oy);
|
||||
|
||||
$(obj).bind("dragstart", function(event) {
|
||||
$(this).attr("_x", $(this).scrollLeft());
|
||||
$(this).attr("_y", $(this).scrollTop());
|
||||
});
|
||||
|
||||
$(obj).bind("dragend", function(event) {
|
||||
$(this).attr("_x", $(this).scrollLeft());
|
||||
$(this).attr("_y", $(this).scrollTop());
|
||||
});
|
||||
|
||||
$(obj).bind("drag", function(event) {
|
||||
var _x = parseInt($(this).attr("_x"));
|
||||
var _y = parseInt($(this).attr("_y"));
|
||||
var _ox = parseInt($(this).attr("_ox"));
|
||||
var _oy = parseInt($(this).attr("_oy"));
|
||||
|
||||
$(this).scrollLeft(_x + _ox - event.offsetX);
|
||||
$(this).scrollTop(_y + _oy - event.offsetY);
|
||||
});
|
||||
}
|
||||
|
||||
function ScrollTo(obj, x, y) {
|
||||
var w = $(obj).width();
|
||||
var h = $(obj).height();
|
||||
|
||||
$(obj).scrollLeft(x - w/2);
|
||||
$(obj).scrollTop(y - h/2);
|
||||
}
|
||||
|
||||
function CheckIE6PNG() {
|
||||
if($.browser.msie == true && $.browser.version == "6.0") {
|
||||
DD_belatedPNG.fix(".png");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ if($canJoin != 'Y'){
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1 class="row justify-content-md-center">삼국지 모의전투 HiD</h1>
|
||||
<h1 class="row justify-content-md-center">삼국지 모의전투 HiDCHe</h1>
|
||||
<div class="row justify-content-md-center">
|
||||
<div class="col col-12 col-md-10 col-lg-7">
|
||||
<div class="card">
|
||||
|
||||
@@ -7,7 +7,7 @@ use \kakao\Kakao_REST_API_Helper as Kakao_REST_API_Helper;
|
||||
|
||||
WebUtil::setHeaderNoCache();
|
||||
|
||||
$auth_code = Util::array_get($_GET['code']);
|
||||
$auth_code = Util::getReq('code');
|
||||
if(!$auth_code){
|
||||
|
||||
header('Location:oauth_fail.html');
|
||||
|
||||
@@ -6,6 +6,7 @@ class Json
|
||||
const PRETTY = 1;
|
||||
const DELETE_NULL = 2;
|
||||
const NO_CACHE = 4;
|
||||
const PASS_THROUGH = 8;
|
||||
|
||||
public static function encode($value, $flag = 0)
|
||||
{
|
||||
@@ -33,6 +34,9 @@ class Json
|
||||
|
||||
header('Content-Type: application/json');
|
||||
|
||||
if($flag & static::PASS_THROUGH){
|
||||
die($value);
|
||||
}
|
||||
die(Json::encode($value, $flag));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -141,9 +141,15 @@ class Session
|
||||
public function __get(string $name)
|
||||
{
|
||||
if ($name == 'generalID') {
|
||||
if (!class_exists('\\sammo\\UniqueConst')){
|
||||
return null;
|
||||
}
|
||||
return $this->get(UniqueConst::$serverID.static::GAME_KEY_GENERAL_ID);
|
||||
}
|
||||
if ($name == 'generalName') {
|
||||
if (!class_exists('\\sammo\\UniqueConst')){
|
||||
return null;
|
||||
}
|
||||
return $this->get(UniqueConst::$serverID.static::GAME_KEY_GENERAL_NAME);
|
||||
}
|
||||
return $this->get($name);
|
||||
|
||||
@@ -103,6 +103,9 @@ class StringUtil
|
||||
}
|
||||
|
||||
$textLen = mb_strwidth($str, 'UTF-8');
|
||||
if($maxsize <= $textLen){
|
||||
return $str;
|
||||
}
|
||||
|
||||
$fillTextCnt = intdiv($maxsize - $textLen, $chLen);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user