From e4c1ca7f34bca0c677ea631d831a051df5ee3e8f Mon Sep 17 00:00:00 2001 From: hide_d Date: Wed, 28 Mar 2018 18:15:52 +0900 Subject: [PATCH] npcmatch -> affinity --- twe/event_1.php | 6 +++--- twe/event_2.php | 6 +++--- twe/event_3.php | 6 +++--- twe/event_4.php | 6 +++--- twe/func.php | 4 ++-- twe/func_npc.php | 20 ++++++++++---------- twe/func_process_chief.php | 6 +++--- twe/func_process_personnel.php | 6 +++--- twe/join_post.php | 4 ++-- twe/scenario_2.php | 4 ++-- twe/scenario_22.php | 6 +++--- twe/scenario_24.php | 12 ++++++------ twe/scenario_3.php | 4 ++-- twe/schema.php | 2 +- 14 files changed, 46 insertions(+), 46 deletions(-) diff --git a/twe/event_1.php b/twe/event_1.php index ef715b0a..d914fd3b 100644 --- a/twe/event_1.php +++ b/twe/event_1.php @@ -217,21 +217,21 @@ function RegGeneral3($connect,$turnterm,$gencount,$nation,$level,$name,$leader,$ $experience = $age * 100; $dedication = $age * 100; $npc = 5; - $npcmatch = 999; + $affinity = 999; $picture = 'default.jpg'; $crew = $leader * 100; $crewtype = rand() % 3; //장수 @MYDB_query(" insert into general ( - npcid,npc,npc_org,npcmatch,name,picture,nation,city, + npcid,npc,npc_org,affinity,name,picture,nation,city, leader,power,intel,experience,dedication, level,gold,rice,crew,crewtype,train,atmos,tnmt, weap,book,horse,turntime,killturn,age,belong,personal,special,specage,special2,specage2,npcmsg, makelimit, dex0, dex10, dex20, dex30, dex40 ) values ( - '$gencount','$npc','$npc','$npcmatch','$name','$picture','$nation','$city', + '$gencount','$npc','$npc','$affinity','$name','$picture','$nation','$city', '$leader','$power','$intel','$experience','$dedication', '$level','99999','99999','$crew','$crewtype','100','100','0', '6','6','6','$turntime','$killturn','$age','1', diff --git a/twe/event_2.php b/twe/event_2.php index 62e38ba9..a46fa650 100644 --- a/twe/event_2.php +++ b/twe/event_2.php @@ -221,7 +221,7 @@ function RegGeneral3($connect,$turnterm,$gencount,$nation,$level,$name,$leader,$ $experience = $age * 100; $dedication = $age * 100; $npc = 5; - $npcmatch = 999; + $affinity = 999; $picture = 'default.jpg'; $crew = $leader * 100; $crewtype = rand() % 3; @@ -233,14 +233,14 @@ function RegGeneral3($connect,$turnterm,$gencount,$nation,$level,$name,$leader,$ //장수 @MYDB_query(" insert into general ( - npcid,npc,npc_org,npcmatch,name,picture,nation,city, + npcid,npc,npc_org,affinity,name,picture,nation,city, leader,power,intel,experience,dedication, level,gold,rice,crew,crewtype,train,atmos,tnmt, weap,book,horse,turntime,killturn,age,belong,personal,special,specage,special2,specage2,npcmsg, makelimit, dex0, dex10, dex20, dex30, dex40 ) values ( - '$gencount','$npc','$npc','$npcmatch','$name','$picture','$nation','$city', + '$gencount','$npc','$npc','$affinity','$name','$picture','$nation','$city', '$leader','$power','$intel','$experience','$dedication', '$level','99999','99999','$crew','$crewtype','100','100','0', '0','0','0','$turntime','$killturn','$age','1', diff --git a/twe/event_3.php b/twe/event_3.php index 188c6bca..0a15e07d 100644 --- a/twe/event_3.php +++ b/twe/event_3.php @@ -80,7 +80,7 @@ function RegGeneral3($connect,$turnterm,$gencount,$nation,$level,$name,$leader,$ $experience = $age * 100; $dedication = $age * 100; $npc = 2; - $npcmatch = rand() % 150 + 1; + $affinity = rand() % 150 + 1; $picture = 'default.jpg'; $crew = 0; $crewtype = rand() % 3; @@ -92,14 +92,14 @@ function RegGeneral3($connect,$turnterm,$gencount,$nation,$level,$name,$leader,$ //장수 @MYDB_query(" insert into general ( - npcid,npc,npc_org,npcmatch,name,picture,nation,city, + npcid,npc,npc_org,affinity,name,picture,nation,city, leader,power,intel,experience,dedication, level,gold,rice,crew,crewtype,train,atmos,tnmt, weap,book,horse,turntime,killturn,age,belong,personal,special,specage,special2,specage2,npcmsg, makelimit, dex0, dex10, dex20, dex30, dex40 ) values ( - '$gencount','$npc','$npc','$npcmatch','$name','$picture','$nation','$city', + '$gencount','$npc','$npc','$affinity','$name','$picture','$nation','$city', '$leader','$power','$intel','$experience','$dedication', '$level','1000','1000','$crew','$crewtype','100','100','0', '0','0','0','$turntime','$killturn','$age','1', diff --git a/twe/event_4.php b/twe/event_4.php index acc5183b..b1424132 100644 --- a/twe/event_4.php +++ b/twe/event_4.php @@ -113,7 +113,7 @@ function RegGeneral4($connect,$turnterm,$gencount,$nation,$level,$name,$leader,$ $experience = 0; $dedication = 0; $npc = 3; - $npcmatch = rand() % 150 + 1; + $affinity = rand() % 150 + 1; $picture = 'pic_3.jpg'; $crew = 0; $crewtype = rand() % 3; @@ -125,14 +125,14 @@ function RegGeneral4($connect,$turnterm,$gencount,$nation,$level,$name,$leader,$ //장수 @MYDB_query(" insert into general ( - npcid,npc,npc_org,npcmatch,name,picture,nation,city, + npcid,npc,npc_org,affinity,name,picture,nation,city, leader,power,intel,experience,dedication, level,gold,rice,crew,crewtype,train,atmos, weap,book,horse,turntime,killturn,age,belong,personal,special,specage,special2,specage2,npcmsg, makelimit, dex0, dex10, dex20, dex30, dex40 ) values ( - '$gencount','$npc','$npc','$npcmatch','$name','$picture','$nation','$city', + '$gencount','$npc','$npc','$affinity','$name','$picture','$nation','$city', '$leader','$power','$intel','$experience','$dedication', '$level','1000','1000','$crew','$crewtype','100','100', '0','0','0','$turntime','$killturn','$age','1', diff --git a/twe/func.php b/twe/func.php index 995afba1..66a9af85 100644 --- a/twe/func.php +++ b/twe/func.php @@ -2401,7 +2401,7 @@ function updateTurntime($connect, $no) { $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); - $query = "select no,name,name2,nation,troop,age,turntime,killturn,level,deadyear,npc,npc_org,npcmatch,npcid from general where no='$no'"; + $query = "select no,name,name2,nation,troop,age,turntime,killturn,level,deadyear,npc,npc_org,affinity,npcid from general where no='$no'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $general = MYDB_fetch_array($result); @@ -2924,7 +2924,7 @@ function nextRuler($connect, $general) { //npc or npc유저인 경우 후계 찾기 if($general['npc'] > 0) { - $query = "select no,name,nation,IF(ABS(npcmatch-'{$general['npcmatch']}')>75,150-ABS(npcmatch-'{$general['npcmatch']}'),ABS(npcmatch-'{$general['npcmatch']}')) as npcmatch2 from general where nation='{$general['nation']}' and level!=12 and npc>0 order by npcmatch2,rand() limit 0,1"; + $query = "select no,name,nation,IF(ABS(affinity-'{$general['affinity']}')>75,150-ABS(affinity-'{$general['affinity']}'),ABS(affinity-'{$general['affinity']}')) as npcmatch2 from general where nation='{$general['nation']}' and level!=12 and npc>0 order by npcmatch2,rand() limit 0,1"; $npcresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $npccount = MYDB_num_rows($npcresult); } else { diff --git a/twe/func_npc.php b/twe/func_npc.php index 221c4ef4..e858c704 100644 --- a/twe/func_npc.php +++ b/twe/func_npc.php @@ -11,7 +11,7 @@ function RegGenerals($init,$life,$fiction,$turnterm,$startyear,$year,$npc_mark,$ foreach($genLists as $genInfo){ $genInfo[] = '';//$msg 대비 list( - $npcmatch,$name,$img,$picture,$nation, + $affinity,$name,$img,$picture,$nation, $city,$leader,$power,$intel,$level, $bornyear,$deadyear,$personal,$special, $msg) = $genInfo; @@ -19,14 +19,14 @@ function RegGenerals($init,$life,$fiction,$turnterm,$startyear,$year,$npc_mark,$ $gencount += 1; RegGeneral($init,$life,$fiction,$turnterm,$startyear,$year, - $gencount,$npcmatch,$name,$img,$picture,$nation, + $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,$npcmatch,$name,$img,$picture,$nation, +function RegGeneral($init,$life,$fiction,$turnterm,$startyear,$year,$gencount,$affinity,$name,$img,$picture,$nation, $city,$leader,$power,$intel,$level, $bornyear,$deadyear,$personal,$special, $msg="") { @@ -39,7 +39,7 @@ function RegGeneral($init,$life,$fiction,$turnterm,$startyear,$year,$gencount,$n } else { $city = CityCall($city); } - if($npcmatch == 0 || $fiction == 1) { $npcmatch = rand() % 150 + 1; } + 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; @@ -114,7 +114,7 @@ function RegGeneral($init,$life,$fiction,$turnterm,$startyear,$year,$gencount,$n 'npcid'=>$gencount, 'npc'=>$npc, 'npc_org'=>$npc, - 'npcmatch'=>$npcmatch, + 'affinity'=>$affinity, 'name'=>$name, 'picture'=>$picture, 'nation'=>$nation, @@ -317,7 +317,7 @@ function processAI($connect, $no) { $isStart = 0; } - $query = "select no,turn0,npcid,name,nation,nations,city,level,npcmsg,personal,leader,intel,power,gold,rice,crew,train,atmos,npc,npcmatch,mode,injury,picture,imgsvr,killturn,makelimit,dex0,dex10,dex20,dex30,dex40 from general where no='$no'"; + $query = "select no,turn0,npcid,name,nation,nations,city,level,npcmsg,personal,leader,intel,power,gold,rice,crew,train,atmos,npc,affinity,mode,injury,picture,imgsvr,killturn,makelimit,dex0,dex10,dex20,dex30,dex40 from general where no='$no'"; $result = MYDB_query($query, $connect) or Error("processAI01 ".MYDB_error($connect),""); $general = MYDB_fetch_array($result); @@ -460,7 +460,7 @@ function processAI($connect, $no) { } $result = MYDB_query($query, $connect) or Error("processAI06 ".MYDB_error($connect),""); $rulerCount = MYDB_num_rows($result); - if($rulerCount > 0 && $general['npcmatch'] != 999 && $general['makelimit'] == 0) { + if($rulerCount > 0 && $general['affinity'] != 999 && $general['makelimit'] == 0) { $ruler = MYDB_fetch_array($result); $command = EncodeCommand(0, 0, $ruler['nation'], 25); //임관 } else { @@ -476,13 +476,13 @@ function processAI($connect, $no) { $ratio = round($npcCount / ($nonCount + $npcCount) * 100); $ratio = round($ratio * 1.0); //NPC우선임관 - $query = "select nation,ABS(IF(ABS(npcmatch-'{$general['npcmatch']}')>75,150-ABS(npcmatch-'{$general['npcmatch']}'),ABS(npcmatch-'{$general['npcmatch']}'))) as npcmatch2 from general where level=12 and npc>0 and nation not in (0{$general['nations']}0) order by npcmatch2,rand() limit 0,1"; + $query = "select nation,ABS(IF(ABS(affinity-'{$general['affinity']}')>75,150-ABS(affinity-'{$general['affinity']}'),ABS(affinity-'{$general['affinity']}'))) as npcmatch2 from general where level=12 and npc>0 and nation not in (0{$general['nations']}0) order by npcmatch2,rand() limit 0,1"; $result = MYDB_query($query, $connect) or Error("processAI06 ".MYDB_error($connect),""); $rulerCount = MYDB_num_rows($result); - if($rulerCount > 0 && $general['npcmatch'] != 999 && rand()%100 < $ratio && $general['makelimit'] == 0) { // 엔국 비율대로 임관(50% : 50%) + if($rulerCount > 0 && $general['affinity'] != 999 && rand()%100 < $ratio && $general['makelimit'] == 0) { // 엔국 비율대로 임관(50% : 50%) $ruler = MYDB_fetch_array($result); $command = EncodeCommand(0, 0, $ruler['nation'], 25); //임관 - } elseif($general['npcmatch'] != 999 && $general['makelimit'] == 0) { // NPC국가 없으면 유저국 임관 + } elseif($general['affinity'] != 999 && $general['makelimit'] == 0) { // NPC국가 없으면 유저국 임관 $query = "select nation from general where level=12 and npc=0 order by rand() limit 0,1"; $result = MYDB_query($query, $connect) or Error("processAI06 ".MYDB_error($connect),""); $ruler = MYDB_fetch_array($result); diff --git a/twe/func_process_chief.php b/twe/func_process_chief.php index e3b6803d..ea5be3d4 100644 --- a/twe/func_process_chief.php +++ b/twe/func_process_chief.php @@ -1928,7 +1928,7 @@ function process_76($connect, &$general) { } $npccount = 10000 + $npcid; - $npcmatch = rand() % 150 + 1; + $affinity = rand() % 150 + 1; $name = "ⓖ의병장{$npcid}"; $picture = 'default.jpg'; $turntime = getRandTurn($admin['turnterm']); @@ -1939,14 +1939,14 @@ function process_76($connect, &$general) { @MYDB_query(" insert into general ( - npcid,npc,npc_org,npcmatch,name,picture,nation, + npcid,npc,npc_org,affinity,name,picture,nation, city,leader,power,intel,experience,dedication, level,gold,rice,crew,crewtype,train,atmos,tnmt, weap,book,horse,turntime,killturn,age,belong,personal,special,specage,special2,specage2,npcmsg, makelimit,bornyear,deadyear, dex0, dex10, dex20, dex30, dex40 ) values ( - '$npccount','$npc','$npc','$npcmatch','$name','$picture','{$nation['nation']}', + '$npccount','$npc','$npc','$affinity','$name','$picture','{$nation['nation']}', '{$general['city']}','$leader','$power','$intel','{$avgGen['exp']}','{$avgGen['ded']}', '1','100','100','0','0','0','0','0', '0','0','0','$turntime','$killturn','{$avgGen['age']}','1','$personal','0','0','0','0','', diff --git a/twe/func_process_personnel.php b/twe/func_process_personnel.php index 6cf0baeb..ba7b149c 100644 --- a/twe/func_process_personnel.php +++ b/twe/func_process_personnel.php @@ -351,7 +351,7 @@ function process_29($connect, &$general) { $npc = 3; $npcid = $admin['npccount']; $npccount = 10000 + $npcid; - $npcmatch = rand() % 150 + 1; + $affinity = rand() % 150 + 1; $picture = 'default.jpg'; $turntime = getRandTurn($admin['turnterm']); $personal = rand() % 10; @@ -367,14 +367,14 @@ function process_29($connect, &$general) { @MYDB_query(" insert into general ( - npcid,npc,npc_org,npcmatch,name,picture,nation, + npcid,npc,npc_org,affinity,name,picture,nation, city,leader,power,intel,experience,dedication, level,gold,rice,crew,crewtype,train,atmos,tnmt, weap,book,horse,turntime,killturn,age,belong,personal,special,specage,special2,specage2,npcmsg, makelimit,bornyear,deadyear, dex0, dex10, dex20, dex30, dex40 ) values ( - '$npccount','$npc','$npc','$npcmatch','$name','$picture','$scoutNation', + '$npccount','$npc','$npc','$affinity','$name','$picture','$scoutNation', '{$general['city']}','$leader','$power','$intel','{$avgGen['exp']}','{$avgGen['ded']}', '$scoutLevel','100','100','0','0','0','0','0', '0','0','0','$turntime','$killturn','$age','1','$personal','0','$specage','0','$specage2','', diff --git a/twe/join_post.php b/twe/join_post.php index 2511b1f0..643b345e 100644 --- a/twe/join_post.php +++ b/twe/join_post.php @@ -185,7 +185,7 @@ if($id_num) { //성격 랜덤시 if($character == 11) $character = rand()%10; //상성 랜덤 - $npcmatch = rand()%150 + 1; + $affinity = rand()%150 + 1; ########## 회원정보 테이블에 입력값을 등록한다. ########## $db->insert('general', [ @@ -196,7 +196,7 @@ if($id_num) { 'nation' => 0, 'city' => $city, 'troop' => 0, - 'npcmatch' => $npcmatch, + 'affinity' => $affinity, 'leader' => $leader, 'power' => $power, 'intel' => $intel, diff --git a/twe/scenario_2.php b/twe/scenario_2.php index e3710fe2..1b0a24a3 100644 --- a/twe/scenario_2.php +++ b/twe/scenario_2.php @@ -946,13 +946,13 @@ $query = "update diplomacy set state=7,term=48 where you=20 and (me=2 or me=4 or MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); //////////////////////////외교 끝////////////////////////////////////////////////// -function RegGenX($connect,$npcmatch,$name,$img,$picture,$nation,$city,$leader,$power,$intel,$level,$bornyear,$deadyear,$personal,$special, +function RegGenX($connect,$affinity,$name,$img,$picture,$nation,$city,$leader,$power,$intel,$level,$bornyear,$deadyear,$personal,$special, $msg=""){ static $gencount = 1000; $gencount += 1; global $connect, $fiction, $turnterm,$startyear, $year; - RegGeneral($connect,1,0,$fiction,$turnterm,$startyear,$year,$gencount,$npcmatch,$name,$img,$picture,$nation, + RegGeneral($connect,1,0,$fiction,$turnterm,$startyear,$year,$gencount,$affinity,$name,$img,$picture,$nation, $city,$leader,$power,$intel,$level, $bornyear,$deadyear,$personal,$special, $msg); diff --git a/twe/scenario_22.php b/twe/scenario_22.php index 1ad26e35..ad1fc1c7 100644 --- a/twe/scenario_22.php +++ b/twe/scenario_22.php @@ -131,18 +131,18 @@ function RegGeneral2($connect,$turnterm,$gencount,$name,$leader,$power,$intel,$p $experience = $age * 100; $dedication = $age * 100; $npc = 2; - $npcmatch = rand()%150 + 1; + $affinity = rand()%150 + 1; $picture = 'default.jpg'; //장수 @MYDB_query(" insert into general ( - npcid,npc,npc_org,npcmatch,name,picture,nation,city, + npcid,npc,npc_org,affinity,name,picture,nation,city, leader,power,intel,experience,dedication, level,gold,rice,crew,crewtype,train,atmos, weap,book,horse,turntime,killturn,age,belong,personal,special,specage,special2,specage2,npcmsg, makelimit ) values ( - '$gencount','$npc','$npc','$npcmatch','$name','$picture','0', + '$gencount','$npc','$npc','$affinity','$name','$picture','0', '$city','$leader','$power','$intel','$experience','$dedication', '0','1000','1000','0','0','0','0', '0','0','0','$turntime','$killturn','$age','1', diff --git a/twe/scenario_24.php b/twe/scenario_24.php index 0d6a98f7..8060eba7 100644 --- a/twe/scenario_24.php +++ b/twe/scenario_24.php @@ -263,18 +263,18 @@ function RegGeneral2($connect,$turnterm,$gencount,$name,$leader,$power,$intel,$p $experience = $age * 100; $dedication = $age * 100; $npc = 2; - $npcmatch = rand()%150 + 1; + $affinity = rand()%150 + 1; $picture = 'default.jpg'; //장수 @MYDB_query(" insert into general ( - npcid,npc,npc_org,npcmatch,name,picture,nation,level,city, + npcid,npc,npc_org,affinity,name,picture,nation,level,city, leader,power,intel,experience,dedication, gold,rice,crew,crewtype,train,atmos, weap,book,horse,turntime,killturn,age,belong,personal,special,specage,special2,specage2,npcmsg, makelimit ) values ( - '$gencount','$npc','$npc','$npcmatch','$name','$picture','1','1','$city', + '$gencount','$npc','$npc','$affinity','$name','$picture','1','1','$city', '$leader','$power','$intel','$experience','$dedication', '2000','2000','0','0','0','0', '0','0','0','$turntime','$killturn','$age','1', @@ -300,18 +300,18 @@ function RegGeneral3($connect,$turnterm,$gencount,$nation,$level,$name,$leader,$ $experience = $age * 100; $dedication = $age * 100; $npc = 2; - $npcmatch = 999; + $affinity = 999; $picture = 'default.jpg'; //장수 @MYDB_query(" insert into general ( - npcid,npc,npc_org,npcmatch,name,picture,nation,city, + npcid,npc,npc_org,affinity,name,picture,nation,city, leader,power,intel,experience,dedication, level,gold,rice,crew,crewtype,train,atmos, weap,book,horse,turntime,killturn,age,belong,personal,special,specage,special2,specage2,npcmsg, makelimit ) values ( - '$gencount','$npc','$npc','$npcmatch','$name','$picture','$nation','$city', + '$gencount','$npc','$npc','$affinity','$name','$picture','$nation','$city', '$leader','$power','$intel','$experience','$dedication', '$level','2000','2000','0','0','0','0', '0','0','0','$turntime','$killturn','$age','1', diff --git a/twe/scenario_3.php b/twe/scenario_3.php index 61c1a03e..7d2ecccc 100644 --- a/twe/scenario_3.php +++ b/twe/scenario_3.php @@ -991,13 +991,13 @@ $query = "update diplomacy set state=7,term=60 where you=6 and me=9"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); //////////////////////////외교 끝////////////////////////////////////////////////// -function RegGenX($connect,$npcmatch,$name,$img,$picture,$nation,$city,$leader,$power,$intel,$level,$bornyear,$deadyear,$personal,$special, +function RegGenX($connect,$affinity,$name,$img,$picture,$nation,$city,$leader,$power,$intel,$level,$bornyear,$deadyear,$personal,$special, $msg=""){ static $gencount = 1000; $gencount += 1; global $connect, $fiction, $turnterm,$startyear, $year; - RegGeneral($connect,1,0,$fiction,$turnterm,$startyear,$year,$gencount,$npcmatch,$name,$img,$picture,$nation, + RegGeneral($connect,1,0,$fiction,$turnterm,$startyear,$year,$gencount,$affinity,$name,$img,$picture,$nation, $city,$leader,$power,$intel,$level, $bornyear,$deadyear,$personal,$special, $msg); diff --git a/twe/schema.php b/twe/schema.php index 5b5d0a6b..167e6692 100644 --- a/twe/schema.php +++ b/twe/schema.php @@ -15,7 +15,7 @@ CREATE TABLE `general` ( `npcid` INT(5) NULL DEFAULT NULL, `npc` INT(1) NULL DEFAULT '0', `npc_org` INT(1) NULL DEFAULT '0', - `npcmatch` INT(3) NULL DEFAULT '0', + `affinity` INT(3) NULL DEFAULT '0', `bornyear` INT(3) NULL DEFAULT '180', `deadyear` INT(3) NULL DEFAULT '300', `newmsg` INT(1) NULL DEFAULT '0',