* generalID, generalName 동작 안하는 문제 해결

* Event 관련 클래스 표기 실수 해결
This commit is contained in:
2018-04-02 01:50:21 +09:00
parent 0cac139f65
commit c0e2ed7013
7 changed files with 26 additions and 22 deletions
+8 -3
View File
@@ -187,6 +187,11 @@ function popIncrease($connect) {
}
function getGoldIncome($connect, $nationNo, $rate, $admin_rate, $type) {
$level2 = [];
$level3 = [];
$level4 = [];
$query = "select no,city from general where nation='$nationNo' and level=4"; // 태수
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$count = MYDB_num_rows($result);
@@ -225,9 +230,9 @@ function getGoldIncome($connect, $nationNo, $rate, $admin_rate, $type) {
$tax1 = ($city['pop'] * $city['comm'] / $city['comm2'] * $ratio / 1000) / 3;
$tax1 *= (1 + $city['secu']/$city['secu2']/10); //치안에 따라 최대 10% 추가
//도시 관직 추가 세수
if($level4[$city['gen1']] == $city['city']) { $tax1 *= 1.05; }
if($level3[$city['gen2']] == $city['city']) { $tax1 *= 1.05; }
if($level2[$city['gen3']] == $city['city']) { $tax1 *= 1.05; }
if(Util::array_get($level4[$city['gen1']]) == $city['city']) { $tax1 *= 1.05; }
if(Util::array_get($level3[$city['gen2']]) == $city['city']) { $tax1 *= 1.05; }
if(Util::array_get($level2[$city['gen3']]) == $city['city']) { $tax1 *= 1.05; }
//수도 추가 세수 130%~105%
if($city['city'] == $nation['capital']) { $tax1 *= 1+(1/3/$nation['level']); };
+3 -4
View File
@@ -2,22 +2,21 @@
namespace sammo;
include('lib.php');
include('func.php');
$result = [
"generalID"=>null,
"myNationID"=>null,
"isChief"=>false
];
$generalID = Session::Instance()->generalID;
$session = Session::Instance()->loginGame()->setReadOnly();
session_write_close();
$generalID = $session->generalID;
if(!$generalID){
Json::die($result);
}
$generalInfo = DB::db()->queryFirstRow('SELECT `nation`, `level` from `general` where `id`=%i', $generalID);
$generalInfo = DB::db()->queryFirstRow('SELECT `nation`, `level` from `general` where `no`=%i', $generalID);
if(!$generalInfo){
Json::die($result);
}
+9 -9
View File
@@ -33,21 +33,21 @@ function reloadWorldMap(option){
var cityPosition = getCityPosition();
//OBJ : startYear, year, month, cityList, nationList, spyList, shownByGeneralList, myCity
var deferred;
function checkReturnObject(obj){
if(!obj.result){
deferred.reject();
return;
var obj = $.Deferred();
obj.reject('fail');
return obj.promise();
}
if(!$.isNumeric(obj.startYear)
||!$.isNumeric(obj.year)
||!$.isNumeric(obj.month)){
deferred.reject();
return;
||!$.isNumeric(obj.month)
){
var obj = $.Deferred();
obj.reject('fail');
return obj.promise();
}
return obj;
@@ -504,7 +504,7 @@ function reloadWorldMap(option){
}
//deferred mode of jQuery. != promise-then.
deferred = $.ajax({
var deferred = $.ajax({
url: option.targetJson,
type: 'post',
dataType:'json',
+1 -1
View File
@@ -7,7 +7,7 @@ class DeleteEvent extends \sammo\Event\Action{
public function __construct(){
}
public function run($env){
public function run($env=null){
$eventID = \sammo\Util::array_get($env['currentEventID']);
if(!$eventID){
+1 -1
View File
@@ -11,7 +11,7 @@ class RegNPC extends \sammo\Event\Action{
string $name,
int $pictureID,
int $nationID,
string $locatedCity,
$locatedCity,
int $leadership,
int $power,
int $intel,
+2 -2
View File
@@ -33,7 +33,7 @@ class Date extends \sammo\Event\Condition{
$this->month = $month;
}
public function eval(array $env=null){
public function eval($env=null){
if($env === null){
return [
'value'=>false,
@@ -50,7 +50,7 @@ class Date extends \sammo\Event\Condition{
}
$lhs = [
$this->$year,
$this->year,
$this->month
];
$rhs = [
+2 -2
View File
@@ -118,10 +118,10 @@ class Session {
public function __get(string $name){
if($name == 'generalID'){
return $this->get(DB::prefix().static::GAME_KEY_GENERAL_ID);
return $this->get(UniqueConst::$serverID.static::GAME_KEY_GENERAL_ID);
}
if($name == 'generalName'){
return $this->get(DB::prefix().static::GAME_KEY_GENERAL_NAME);
return $this->get(UniqueConst::$serverID.static::GAME_KEY_GENERAL_NAME);
}
return $this->get($name);
}