increaseRefresh 수정

파일마다 Session 받아오는 코드가 잘못 된 경우 수정
This commit is contained in:
2018-04-05 01:34:56 +09:00
parent fae86dbff8
commit b3e621fbfd
26 changed files with 71 additions and 1056 deletions
-188
View File
@@ -1,156 +1,6 @@
<?php
namespace sammo;
include('func_regnpc.php');
function RegGenerals($init,$life,$fiction,$turnterm,$startyear,$year,$npc_mark,$genLists){
static $gencount = 1000;
$name = $npc_mark.$name;
foreach($genLists as $genInfo){
$genInfo[] = '';//$msg 대비
list(
$affinity,$name,$img,$picture,$nation,
$city,$leader,$power,$intel,$level,
$bornyear,$deadyear,$personal,$special,
$msg) = $genInfo;
$gencount += 1;
RegGeneral($init,$life,$fiction,$turnterm,$startyear,$year,
$gencount,$affinity,$name,$img,$picture,$nation,
$city,$leader,$power,$intel,$level,
$bornyear,$deadyear,$personal,$special,
$msg);
}
}
function RegGeneral($init,$life,$fiction,$turnterm,$startyear,$year,$gencount,$affinity,$name,$img,$picture,$nation,
$city,$leader,$power,$intel,$level,
$bornyear,$deadyear,$personal,$special,
$msg="") {
$alllog = [];
//$name = "ⓝ".$name;
$npc = 2;
if($city == "-") {
$city = rand(1, count(CityConst::all()));
} else {
$city = CityConst::byName($city)->id;
}
if($affinity == 0 || $fiction == 1) { $affinity = rand() % 150 + 1; }
if($life == 1) { $bornyear = 160; $deadyear = 300; }
if($init != 0 && $startyear > $bornyear+14 && $startyear <= $deadyear) {
if($deadyear <= $startyear+3) $deadyear += 5;
$turntime = getRandTurn($turnterm);
if($personal != "-") { $personal = CharCall($personal); }
else { $personal = rand() % 10; }
if($fiction == 1) { $special = SpecCall("-"); }
else { $special = SpecCall($special); }
if($special >= 40) { $special2 = $special; $special = 0; }
else { $special2 = 0; }
if($picture == 0) { $picture = 1001 + rand() % 400; }
if($picture == -1) { $picture = 'default'; }
$picture = "{$picture}.jpg";
if($img < 3) { $picture = 'default.jpg'; }
$age = $startyear - $bornyear;
$specage = $age + 1;
$specage2 = $age + 1;
$killturn = ($deadyear - $startyear) * 12 + (rand() % 12);
$experience = $age * 100;
$dedication = $age * 100;
if($nation != 0 && $level == 0) $level = 1;
} elseif($year == $bornyear+14 && $year < $deadyear) {
$count = DB::db()->queryFirstField('SELECT count(`no`) from `general` where `name` = %s' , $name);
if ($count == 0) {
$turntime = getRandTurn($turnterm);
if ($personal != "-") {
$personal = CharCall($personal);
} else {
$personal = rand() % 10;
}
if ($fiction == 1) {
$special = SpecCall("-");
} else {
$special = SpecCall($special);
}
if ($special >= 40) {
$special2 = $special;
$special = 0;
} else {
$special2 = 0;
}
if ($picture == 0) {
$picture = 1001 + rand() % 400;
}
$picture = "{$picture}.jpg";
if ($img < 3) {
$picture = 'default.jpg';
}
$age = $year - $bornyear;
$specage = $age + 1;
$specage2 = $age + 1;
$killturn = ($deadyear - $year) * 12 + (rand() % 12);
$experience = $age * 100;
$dedication = $age * 100;
$nation = 0;
$level = 0;
$alllog[0] = "<C>●</>1월:<Y>$name</>(이)가 성인이 되어 <S>등장</>했습니다.";
}
else{
return;
}
}
else{
return;
}
//장수
DB::db()->insert('general',[
'npcid'=>$gencount,
'npc'=>$npc,
'npc_org'=>$npc,
'affinity'=>$affinity,
'name'=>$name,
'picture'=>$picture,
'nation'=>$nation,
'city'=>$city,
'leader'=>$leader,
'power'=>$power,
'intel'=>$intel,
'experience'=>$experience,
'dedication'=>$dedication,
'level'=>$level,
'gold'=>1000,
'rice'=>1000,
'crew'=>0,
'crewtype'=>0,
'train'=>0,
'atmos'=>0,
'weap'=>0,
'book'=>0,
'horse'=>0,
'turntime'=>$turntime,
'killturn'=>$killturn,
'age'=>$age,
'belong'=>1,
'personal'=>$personal,
'special'=>$special,
'specage'=>$specage,
'special2'=>$special2,
'specage2'=>$specage2,
'npcmsg'=>$msg,
'makelimit'=>0,
'bornyear'=>$bornyear,
'deadyear'=>$deadyear
]);
pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']);
}
function SetDevelop($connect, $genType, $no, $city, $tech) {
$query = "select rate,pop/pop2*100 as po,comm/comm2*100 as co,def/def2*100 as de,wall/wall2*100 as wa,secu/secu2*100 as se,agri/agri2*100 as ag from city where city='$city'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
@@ -1068,44 +918,6 @@ function processAI($connect, $no) {
//종전하기, 지급율
//$command = $fourth * 100000000 + $type * 100000 + $crew * 100 + 11;
function RegNation($name, $color, $gold, $rice, $scoutmsg, $tech, $gencount, $type, $level) {
//TODO: 삭제
$type = NationCharCall($type);
$totaltech = $tech * $gencount;
DB::db()->insert('nation', [
'name'=>$name,
'color'=>$color,
'gold'=>$gold,
'rice'=>$rice,
'bill'=>100,
'rate'=>15,
'scout'=>0,
'war'=>0,
'tricklimit'=>24,
'surlimit'=>72,
'scoutmsg'=>$scoutmsg,
'tech'=>$tech,
'totaltech'=>$totaltech,
'type'=>$type,
'level'=>$level,
'gennum'=>$gencount
]);
}
function RegCity($nation, $name, $cap=0) {
//TODO: 삭제
$city = CityConst::byName($name)->id;
DB::db()->update('city', [
'nation'=>$nation,
], 'city=%i',$city);
if($cap > 0){
DB::db()->update('nation', ['capital'=>city], 'nation = %i', $nation);
}
refreshNationStaticInfo();
}
function Promotion($connect, $nation, $level) {
$lv = getNationChiefLevel($level);