npcmatch -> affinity

This commit is contained in:
2018-03-28 18:15:52 +09:00
parent b7237140c8
commit e4c1ca7f34
14 changed files with 46 additions and 46 deletions
+3 -3
View File
@@ -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',
+3 -3
View File
@@ -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',
+3 -3
View File
@@ -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',
+3 -3
View File
@@ -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',
+2 -2
View File
@@ -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 {
+10 -10
View File
@@ -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);
+3 -3
View File
@@ -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','',
+3 -3
View File
@@ -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','',
+2 -2
View File
@@ -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,
+2 -2
View File
@@ -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);
+3 -3
View File
@@ -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',
+6 -6
View File
@@ -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',
+2 -2
View File
@@ -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);
+1 -1
View File
@@ -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',