버그 수정
This commit is contained in:
+13
-10
@@ -114,22 +114,25 @@ function getBlockLevel() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getRandGenName() {
|
function getRandGenName() {
|
||||||
$first = array('가', '간', '감', '강', '고', '공', '공손', '곽', '관', '괴', '교', '금', '노', '뇌', '능', '도', '동', '두',
|
$first = ['가', '간', '감', '강', '고', '공', '공손', '곽', '관', '괴', '교', '금', '노', '뇌', '능', '도', '동', '두',
|
||||||
'등', '마', '맹', '문', '미', '반', '방', '부', '비', '사', '사마', '서', '설', '성', '소', '손', '송', '순', '신', '심',
|
'등', '마', '맹', '문', '미', '반', '방', '부', '비', '사', '사마', '서', '설', '성', '소', '손', '송', '순', '신', '심',
|
||||||
'악', '안', '양', '엄', '여', '염', '오', '왕', '요', '우', '원', '위', '유', '육', '윤', '이', '장', '저', '전', '정',
|
'악', '안', '양', '엄', '여', '염', '오', '왕', '요', '우', '원', '위', '유', '육', '윤', '이', '장', '저', '전', '정',
|
||||||
'제갈', '조', '종', '주', '진', '채', '태사', '하', '하후', '학', '한', '향', '허', '호', '화', '황',
|
'제갈', '조', '종', '주', '진', '채', '태사', '하', '하후', '학', '한', '향', '허', '호', '화', '황',
|
||||||
'공손', '손', '왕', '유', '장', '조');
|
'공손', '손', '왕', '유', '장', '조'];
|
||||||
$last = array('가', '간', '강', '거', '건', '검', '견', '경', '공', '광', '권', '규', '녕', '단', '대', '도', '등', '람',
|
$middle = [''];
|
||||||
|
$last = [
|
||||||
|
'가', '간', '강', '거', '건', '검', '견', '경', '공', '광', '권', '규', '녕', '단', '대', '도', '등', '람',
|
||||||
'량', '례', '로', '료', '모', '민', '박', '범', '보', '비', '사', '상', '색', '서', '소', '속', '송', '수', '순', '습',
|
'량', '례', '로', '료', '모', '민', '박', '범', '보', '비', '사', '상', '색', '서', '소', '속', '송', '수', '순', '습',
|
||||||
'승', '양', '연', '영', '온', '옹', '완', '우', '웅', '월', '위', '유', '윤', '융', '이', '익', '임', '정', '제', '조',
|
'승', '양', '연', '영', '온', '옹', '완', '우', '웅', '월', '위', '유', '윤', '융', '이', '익', '임', '정', '제', '조',
|
||||||
'주', '준', '지', '찬', '책', '충', '탁', '택', '통', '패', '평', '포', '합', '해', '혁', '현', '화', '환', '회', '횡',
|
'주', '준', '지', '찬', '책', '충', '탁', '택', '통', '패', '평', '포', '합', '해', '혁', '현', '화', '환', '회', '횡',
|
||||||
'후', '훈', '휴', '흠', '흥');
|
'후', '훈', '휴', '흠', '흥'
|
||||||
|
];
|
||||||
|
|
||||||
$firstname = $first[rand()%count($first)];
|
$firstname = Util::choiceRandom($first);
|
||||||
$lastname = $last[rand()%count($last)];
|
$middlename = Util::choiceRandom($middle);
|
||||||
|
$lastname = Util::choiceRandom($last);
|
||||||
|
|
||||||
$fullname = "{$firstname}{$lastname}";
|
return "{$firstname}{$middlename}{$lastname}";
|
||||||
return $fullname;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1307,7 +1310,7 @@ function addAge() {
|
|||||||
|
|
||||||
if($admin['year'] >= $admin['startyear']+3) {
|
if($admin['year'] >= $admin['startyear']+3) {
|
||||||
foreach($db->query('SELECT no,name,nation,leader,power,intel from general where specage<=age and special=%s', GameConst::$defaultSpecialDomestic) as $general){
|
foreach($db->query('SELECT no,name,nation,leader,power,intel from general where specage<=age and special=%s', GameConst::$defaultSpecialDomestic) as $general){
|
||||||
$special = getSpecial($general['leader'], $general['power'], $general['intel']);
|
$special = SpecialityConst::pickSpecialDomestic($general);
|
||||||
$specialClass = getGeneralSpecialDomesticClass($special);
|
$specialClass = getGeneralSpecialDomesticClass($special);
|
||||||
$specialText = $specialClass::$name;
|
$specialText = $specialClass::$name;
|
||||||
$db->update('general', [
|
$db->update('general', [
|
||||||
@@ -1319,7 +1322,7 @@ function addAge() {
|
|||||||
pushGenLog($general, "<C>●</>특기 【<b><L>{$specialText}</></b>】{$josaUl} 익혔습니다!");
|
pushGenLog($general, "<C>●</>특기 【<b><L>{$specialText}</></b>】{$josaUl} 익혔습니다!");
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach($db->query('SELECT no,name,nation,leader,power,intel,npc,dex0,dex10,dex20,dex30,dex40 from general where spec2age<=age and special2=%s', GameConst::$defaultSpecialWar) as $general){
|
foreach($db->query('SELECT no,name,nation,leader,power,intel,npc,dex0,dex10,dex20,dex30,dex40 from general where specage2<=age and special2=%s', GameConst::$defaultSpecialWar) as $general){
|
||||||
$special2 = SpecialityConst::pickSpecialWar($general);
|
$special2 = SpecialityConst::pickSpecialWar($general);
|
||||||
$specialClass = getGeneralSpecialWarClass($special2);
|
$specialClass = getGeneralSpecialWarClass($special2);
|
||||||
$specialText = $specialClass::$name;
|
$specialText = $specialClass::$name;
|
||||||
|
|||||||
+12
-127
@@ -1,6 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace sammo;
|
namespace sammo;
|
||||||
|
|
||||||
|
use Monolog\Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 게임 룰에 해당하는 함수 모음
|
* 게임 룰에 해당하는 함수 모음
|
||||||
*/
|
*/
|
||||||
@@ -53,117 +55,6 @@ function getCityLevelList():array{
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 게임 내부에 사용하는 유틸리티 함수들을 분리
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
// 0 1 2 3 4 5 6 7
|
|
||||||
// 0 -, 경작, 상재, 발명 = 3 지력내정
|
|
||||||
// 10 축성, 수비, 통찰 = 3 무력내정
|
|
||||||
// 20 인덕 = 1 통솔내정
|
|
||||||
// 30 거상, 귀모 = 2 공통내정
|
|
||||||
|
|
||||||
//TODO: 클래스로 이동
|
|
||||||
function getSpecial($leader, $power, $intel) {
|
|
||||||
throw new \sammo\NotImplementedException();
|
|
||||||
//통장
|
|
||||||
if($leader*0.9 > $power && $leader*0.9 > $intel) {
|
|
||||||
$type = array('che_인덕', 'che_귀모');
|
|
||||||
$special = $type[array_rand($type)];
|
|
||||||
// 귀모는 50% * 5% = 2.5%
|
|
||||||
if($special == 31 && Util::randBool(0.95)) {
|
|
||||||
$special = 'che_인덕';
|
|
||||||
}
|
|
||||||
//무장
|
|
||||||
} elseif($power >= $intel) {
|
|
||||||
$type = array('che_축성', 'che_수비', 'che_통찰', 'che_귀모');
|
|
||||||
$special = $type[array_rand($type)];
|
|
||||||
// 귀모는 그중에 25% * 10% = 2.5%
|
|
||||||
if($special == 'che_귀모' && Util::randBool(0.9)) {
|
|
||||||
$type = array('che_축성', 'che_수비', 'che_통찰');
|
|
||||||
$special = $type[array_rand($type)];
|
|
||||||
}
|
|
||||||
//지장
|
|
||||||
} elseif($intel > $power) {
|
|
||||||
$type = array('che_상재', 'che_경작', 'che_발명', 'che_귀모');
|
|
||||||
$special = $type[array_rand($type)];
|
|
||||||
// 거상, 귀모는 그중에 25% * 10% = 2.5%
|
|
||||||
if($special == 'che_귀모' && Util::randBool(0.9)) {
|
|
||||||
$type = array('che_상재', 'che_경작', 'che_발명');
|
|
||||||
$special = $type[array_rand($type)];
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
//귀모. 다만 이쪽으로 빠지지 않음.
|
|
||||||
$special = 'che_귀모';
|
|
||||||
}
|
|
||||||
return $special;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 0 1 2 3 4 5 6 7
|
|
||||||
// 40 귀병, 신산, 환술, 집중, 신중, 반계 = 6 지력전투
|
|
||||||
// 50 보병, 궁병, 기병, 공성 = 4 무력전투
|
|
||||||
// 60 돌격, 무쌍, 견고, 위압 = 4 무장전투
|
|
||||||
// 70 저격, 필살, 징병, 의술, 격노, 척사 = 6 공통전투
|
|
||||||
|
|
||||||
function getSpecial2($leader, $power, $intel, $nodex=1, $dex0=0, $dex10=0, $dex20=0, $dex30=0, $dex40=0) {
|
|
||||||
throw new \sammo\NotImplementedException();
|
|
||||||
$special2 = 70;
|
|
||||||
// 숙련 10,000: 25%, 40,000: 50%, 100,000: 79%, 160,000: 100%
|
|
||||||
$dex = sqrt($dex0 + $dex10 + $dex20 + $dex30 + $dex40);
|
|
||||||
$dex = Util::round($dex / 4);
|
|
||||||
// 숙련 10,000: 75%, 40,000: 50%, 100,000: 21%, 160,000: 0%
|
|
||||||
// 그중 20%만
|
|
||||||
if($nodex == 0 && rand()%100 < 20 && rand()%100 > $dex) {
|
|
||||||
if(max($dex0, $dex10, $dex20, $dex30, $dex40) == $dex0) {
|
|
||||||
$special2 = 50;
|
|
||||||
// 숙련이 아얘 없을시 재분배
|
|
||||||
if($dex0 <= 0) {
|
|
||||||
if($power >= $intel) {
|
|
||||||
$special2 = 50 + rand()%4;
|
|
||||||
} else {
|
|
||||||
$special2 = 40;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} elseif(max($dex0, $dex10, $dex20, $dex30, $dex40) == $dex10) {
|
|
||||||
$special2 = 51;
|
|
||||||
} elseif(max($dex0, $dex10, $dex20, $dex30, $dex40) == $dex20) {
|
|
||||||
$special2 = 52;
|
|
||||||
} elseif(max($dex0, $dex10, $dex20, $dex30, $dex40) == $dex30) {
|
|
||||||
$special2 = 40;
|
|
||||||
} elseif(max($dex0, $dex10, $dex20, $dex30, $dex40) == $dex40) {
|
|
||||||
$special2 = 53;
|
|
||||||
}
|
|
||||||
//무장
|
|
||||||
} elseif($power >= $intel) {
|
|
||||||
$type = array(60, 61, 62, 63, 70, 71, 72, 73, 74, 75);
|
|
||||||
$special2 = $type[rand()%10];
|
|
||||||
// 의술은 그중에 10% * 20% = 2%
|
|
||||||
if(($special2 == 73) && rand()%100 > 20) {
|
|
||||||
$type = array(60, 61, 62, 63, 70, 71, 72, 74, 75);
|
|
||||||
$special2 = $type[rand()%9];
|
|
||||||
}
|
|
||||||
//지장
|
|
||||||
} elseif($intel > $power) {
|
|
||||||
$type = array(41, 42, 43, 44, 45, 70, 71, 72, 73, 74, 75);
|
|
||||||
$special2 = $type[rand()%11];
|
|
||||||
// 환술은 그중에 9% * 50% = 4.5%
|
|
||||||
if(($special2 == 42) && rand()%100 > 50) {
|
|
||||||
$type = array(41, 43, 44, 45, 70, 71, 72, 74, 75);
|
|
||||||
$special2 = $type[rand()%9];
|
|
||||||
}
|
|
||||||
// 의술은 그중에 9% * 20% = 1.8%
|
|
||||||
if(($special2 == 73) && rand()%100 > 20) {
|
|
||||||
$type = array(41, 42, 43, 44, 45, 70, 71, 72, 74, 75);
|
|
||||||
$special2 = $type[rand()%10];
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$type = array(70, 71, 72, 73, 74, 75);
|
|
||||||
$special2 = $type[rand()%6];
|
|
||||||
}
|
|
||||||
return $special2;
|
|
||||||
}
|
|
||||||
|
|
||||||
function getGenDex($general, $type) {
|
function getGenDex($general, $type) {
|
||||||
//XXX: 지금은 동작하지만.. 병종 구성이 보궁기귀차 에서 바뀌면...
|
//XXX: 지금은 동작하지만.. 병종 구성이 보궁기귀차 에서 바뀌면...
|
||||||
$ntype = GameUnitConst::byId($type)->armType * 10;
|
$ntype = GameUnitConst::byId($type)->armType * 10;
|
||||||
@@ -660,29 +551,23 @@ function postUpdateMonthly() {
|
|||||||
function checkWander() {
|
function checkWander() {
|
||||||
$db = DB::db();
|
$db = DB::db();
|
||||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||||
$connect=$db->get();
|
|
||||||
|
|
||||||
$admin = $gameStor->getValues(['year', 'month']);
|
$admin = $gameStor->getValues(['year', 'month']);
|
||||||
|
|
||||||
$needRefresh = false;
|
$wanderers = $db->queryFirstColumn('SELECT general.`no` FROM general LEFT JOIN nation ON general.nation = nation.nation WHERE nation.`level` = 0 AND general.`level` = 12');
|
||||||
|
|
||||||
// 국가정보, 장수수
|
foreach($wanderers as $wandererID){
|
||||||
foreach(getAllNationStaticInfo() as $nation){
|
$wanderer = General::createGeneralObjFromDB($wandererID);
|
||||||
if($nation['level'] != 0){
|
|
||||||
continue;
|
$wanderCmd = buildGeneralCommandClass('che_해산', $wanderer, $admin);
|
||||||
|
if($wanderCmd->isRunnable()){
|
||||||
|
$logger = $wanderer->getLogger();
|
||||||
|
$logger->pushGeneralActionLog('초반 제한후 방랑군은 자동 해산됩니다.', ActionLogger::PLAIN);
|
||||||
|
$wanderCmd->run();
|
||||||
}
|
}
|
||||||
|
|
||||||
$needRefresh = true;
|
|
||||||
|
|
||||||
$query = "select no,name,nation,level,turntime from general where nation='{$nation['nation']}' and level=12";
|
|
||||||
$kingResult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
$king = MYDB_fetch_array($kingResult);
|
|
||||||
|
|
||||||
pushGenLog($king, ["<C>●</>초반 제한후 방랑군은 자동 해산됩니다."]);
|
|
||||||
process_56($king);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if($needRefresh){
|
if($wanderers){
|
||||||
refreshNationStaticInfo();
|
refreshNationStaticInfo();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+81
-83
@@ -5,7 +5,6 @@ namespace sammo;
|
|||||||
function processTournament() {
|
function processTournament() {
|
||||||
$db = DB::db();
|
$db = DB::db();
|
||||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||||
$connect=$db->get();
|
|
||||||
|
|
||||||
$admin = $gameStor->getValues(['tournament', 'phase', 'tnmt_type', 'tnmt_auto', 'tnmt_time']);
|
$admin = $gameStor->getValues(['tournament', 'phase', 'tnmt_type', 'tnmt_auto', 'tnmt_time']);
|
||||||
$now = new \DateTime();
|
$now = new \DateTime();
|
||||||
@@ -116,7 +115,6 @@ function processTournament() {
|
|||||||
function getTournamentTerm() {
|
function getTournamentTerm() {
|
||||||
$db = DB::db();
|
$db = DB::db();
|
||||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||||
$connect=$db->get();
|
|
||||||
|
|
||||||
$tnmt_auto = $gameStor->tnmt_auto;
|
$tnmt_auto = $gameStor->tnmt_auto;
|
||||||
|
|
||||||
@@ -136,7 +134,6 @@ function getTournamentTerm() {
|
|||||||
function getTournamentTime() {
|
function getTournamentTime() {
|
||||||
$db = DB::db();
|
$db = DB::db();
|
||||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||||
$connect=$db->get();
|
|
||||||
|
|
||||||
list($tnmt, $tnmt_time) = $gameStor->getValuesAsArray(['tournament', 'tnmt_time']);
|
list($tnmt, $tnmt_time) = $gameStor->getValuesAsArray(['tournament', 'tnmt_time']);
|
||||||
$dt = substr($tnmt_time, 11, 5);
|
$dt = substr($tnmt_time, 11, 5);
|
||||||
@@ -154,21 +151,20 @@ function getTournamentTime() {
|
|||||||
return $tnmt;
|
return $tnmt;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getTournament($tnmt) {
|
function getTournament(int $tnmt) {
|
||||||
switch($tnmt) {
|
return [
|
||||||
case 0: $tnmt = "<font color=magenta>경기 없음</font>"; break;
|
"<font color=magenta>경기 없음</font>",
|
||||||
case 1: $tnmt = "<font color=orange>참가 모집중</font>"; break;
|
"<font color=orange>참가 모집중</font>",
|
||||||
case 2: $tnmt = "<font color=orange>예선 진행중</font>"; break;
|
"<font color=orange>예선 진행중</font>",
|
||||||
case 3: $tnmt = "<font color=orange>본선 추첨중</font>"; break;
|
"<font color=orange>본선 추첨중</font>",
|
||||||
case 4: $tnmt = "<font color=orange>본선 진행중</font>"; break;
|
"<font color=orange>본선 진행중</font>",
|
||||||
case 5: $tnmt = "<font color=orange>16강 배정중</font>"; break;
|
"<font color=orange>16강 배정중</font>",
|
||||||
case 6: $tnmt = "<font color=orange>베팅 진행중</font>"; break;
|
"<font color=orange>베팅 진행중</font>",
|
||||||
case 7: $tnmt = "<font color=orange>16강 진행중</font>"; break;
|
"<font color=orange>16강 진행중</font>",
|
||||||
case 8: $tnmt = "<font color=orange>8강 진행중</font>"; break;
|
"<font color=orange>8강 진행중</font>",
|
||||||
case 9: $tnmt = "<font color=orange>4강 진행중</font>"; break;
|
"<font color=orange>4강 진행중</font>",
|
||||||
case 10: $tnmt = "<font color=orange>결승 진행중</font>"; break;
|
"<font color=orange>결승 진행중</font>",
|
||||||
}
|
][$tnmt]??"TOURNAMENT_TYPE_ERR_{$tnmt}";
|
||||||
return $tnmt;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function printRow($k, $npc, $name, $abil, $tgame, $win, $draw, $lose, $gd, $gl, $prmt) {
|
function printRow($k, $npc, $name, $abil, $tgame, $win, $draw, $lose, $gd, $gl, $prmt) {
|
||||||
@@ -233,9 +229,6 @@ function printFighting($tournament, $phase) {
|
|||||||
function startTournament($auto, $type) {
|
function startTournament($auto, $type) {
|
||||||
$db = DB::db();
|
$db = DB::db();
|
||||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||||
$connect=$db->get();
|
|
||||||
|
|
||||||
$prevWinner = $gameStor->prev_winner;
|
|
||||||
|
|
||||||
eraseTnmtFightLogAll();
|
eraseTnmtFightLogAll();
|
||||||
|
|
||||||
@@ -294,25 +287,24 @@ function startTournament($auto, $type) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$history = [];
|
$history = [];
|
||||||
switch($type) {
|
[$typeText, $genTypeText] = [
|
||||||
case 0: $history[] = "<S>◆</>{$admin['year']}년 {$admin['month']}월: $openerText<C>전력전</> 대회가 개최됩니다! 천하의 <span class='ev_highlight'>영웅</span>들을 모집하고 있습니다!"; break;
|
['전력전','영웅'],
|
||||||
case 1: $history[] = "<S>◆</>{$admin['year']}년 {$admin['month']}월: $openerText<C>통솔전</> 대회가 개최됩니다! 천하의 <span class='ev_highlight'>명사</span>들을 모집하고 있습니다!"; break;
|
['통솔전','명사'],
|
||||||
case 2: $history[] = "<S>◆</>{$admin['year']}년 {$admin['month']}월: $openerText<C>일기토</> 대회가 개최됩니다! 천하의 <span class='ev_highlight'>용사</span>들을 모집하고 있습니다!"; break;
|
['일기토','용사'],
|
||||||
case 3: $history[] = "<S>◆</>{$admin['year']}년 {$admin['month']}월: $openerText<C>설전</> 대회가 개최됩니다! 천하의 <span class='ev_highlight'>책사</span>들을 모집하고 있습니다!"; break;
|
['설전','책사'],
|
||||||
}
|
][$type];
|
||||||
|
|
||||||
|
$history[] = "<S>◆</>{$admin['year']}년 {$admin['month']}월:{$openerText}<C>{$typeText}</> 대회가 개최됩니다! 천하의 <span class='ev_highlight'>{$genTypeText}</span>들을 모집하고 있습니다!";
|
||||||
|
|
||||||
pushWorldHistory($history, $admin['year'], $admin['month']);
|
pushWorldHistory($history, $admin['year'], $admin['month']);
|
||||||
}
|
}
|
||||||
|
|
||||||
function fillLowGenAll() {
|
function fillLowGenAll() {
|
||||||
$db = DB::db();
|
$db = DB::db();
|
||||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||||
$connect=$db->get();
|
|
||||||
|
|
||||||
$general = [];
|
|
||||||
$grpCount = [];
|
$grpCount = [];
|
||||||
|
|
||||||
$develcost = $gameStor->develcost;
|
|
||||||
|
|
||||||
$dummyGeneral = [
|
$dummyGeneral = [
|
||||||
'no'=>0,
|
'no'=>0,
|
||||||
'npc'=>2,
|
'npc'=>2,
|
||||||
@@ -321,65 +313,71 @@ function fillLowGenAll() {
|
|||||||
'power'=>10,
|
'power'=>10,
|
||||||
'intel'=>10,
|
'intel'=>10,
|
||||||
'explevel'=>10,
|
'explevel'=>10,
|
||||||
'horse'=>$general['horse'],
|
'horse'=>0,
|
||||||
'weap'=>$general['weap'],
|
'weap'=>0,
|
||||||
'book'=>$general['book']
|
'book'=>0
|
||||||
];
|
];
|
||||||
|
|
||||||
for($i=0; $i < 8; $i++) {
|
for($i=0;$i<8;$i++){
|
||||||
$grpCount[$i] = $db->queryFirstField('SELECT count(grp) FROM tournament WHERE grp=%i', $i);
|
$grpCount[$i] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//자동신청하고, 돈 있고, 아직 참가 안한 장수
|
foreach($db->queryAllLists('SELECT grp, count(grp) FROM tournament GROUP BY grp') as [$grpIdx, $grpCnt]){
|
||||||
$query = "select no,npc,name,leader,power,intel,explevel from general where tnmt='1' and tournament='0' order by rand() limit 0,64";
|
$grpCount[$grpIdx] = $grpCnt;
|
||||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
$genCount = MYDB_num_rows($result);
|
|
||||||
|
|
||||||
$valid = 1;
|
|
||||||
while($valid == 1) {
|
|
||||||
$valid = 0;
|
|
||||||
//조마다 돌아가며
|
|
||||||
for($i=0; $i < 8; $i++) {
|
|
||||||
//비었으면 채우기
|
|
||||||
if($grpCount[$i] < 8) {
|
|
||||||
//자동신청 장수 있으면 채우기
|
|
||||||
if ($genCount > 0) {
|
|
||||||
$genCount--;
|
|
||||||
$general = MYDB_fetch_array($result);
|
|
||||||
$db->update('general', [
|
|
||||||
'tournament'=>1
|
|
||||||
], 'no=%i', $general['no']);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
$general = $dummyGeneral;
|
|
||||||
}
|
|
||||||
|
|
||||||
$db->insert('tournament', [
|
|
||||||
'no'=>$general['no'],
|
|
||||||
'npc'=>$general['npc'],
|
|
||||||
'name'=>$general['name'],
|
|
||||||
'ldr'=>$general['leader'],
|
|
||||||
'pwr'=>$general['power'],
|
|
||||||
'itl'=>$general['intel'],
|
|
||||||
'lvl'=>$general['explevel'],
|
|
||||||
'grp'=>$i,
|
|
||||||
'grp_no'=>$grpCount[$i],
|
|
||||||
'h'=>$general['horse'],
|
|
||||||
'w'=>$general['weap'],
|
|
||||||
'b'=>$general['book']
|
|
||||||
]);
|
|
||||||
|
|
||||||
$grpCount[$i]++;
|
|
||||||
}
|
|
||||||
//덜 찼으면 루프 다시
|
|
||||||
if($grpCount[$i] < 8) {
|
|
||||||
$valid = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$gameStor->tournament = 2;
|
$gameStor->tournament = 2;
|
||||||
$gameStor->phase = 0;
|
$gameStor->phase = 0;
|
||||||
|
|
||||||
|
$currentJoinerCnt = sum($grpCount);
|
||||||
|
if($currentJoinerCnt == 64){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$toBeFilledCnt = 8*8-$currentJoinerCnt;
|
||||||
|
|
||||||
|
//자동신청하고, 돈 있고, 아직 참가 안한 장수
|
||||||
|
$freeJoiners = $db->query(
|
||||||
|
'SELECT no,npc,name,leader,power,intel,explevel,horse,weap,book from general where tnmt=1 and tournament=0 order by rand() limit %d',
|
||||||
|
$toBeFilledCnt
|
||||||
|
);
|
||||||
|
|
||||||
|
$joinersValues = [];
|
||||||
|
$joinersIdx = [];
|
||||||
|
|
||||||
|
foreach($freeJoiners as $general){
|
||||||
|
$grpIdx = array_keys($grpCount, min($grpCount))[0];
|
||||||
|
$grpCnt = $grpCount[$grpIdx];
|
||||||
|
$joinersValues[] = [
|
||||||
|
'no'=>$general['no'],
|
||||||
|
'npc'=>$general['npc'],
|
||||||
|
'name'=>$general['name'],
|
||||||
|
'ldr'=>$general['leader'],
|
||||||
|
'pwr'=>$general['power'],
|
||||||
|
'itl'=>$general['intel'],
|
||||||
|
'lvl'=>$general['explevel'],
|
||||||
|
'grp'=>$grpIdx,
|
||||||
|
'grp_no'=>$grpCnt,
|
||||||
|
'h'=>$general['horse'],
|
||||||
|
'w'=>$general['weap'],
|
||||||
|
'b'=>$general['book']
|
||||||
|
];
|
||||||
|
|
||||||
|
$joinersIdx[] = $general['no'];
|
||||||
|
$grpCount[$grpIdx] += 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach($grpCount as $grpIdx=>$grpCnt){
|
||||||
|
while($grpCnt < 8){
|
||||||
|
$joinersValues[] = $dummyGeneral;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$db->update('general', [
|
||||||
|
'tournament'=>1
|
||||||
|
], 'no IN %li', $joinersIdx);
|
||||||
|
|
||||||
|
$db->insert('tournament', $joinersValues);
|
||||||
}
|
}
|
||||||
|
|
||||||
//0 경기없음
|
//0 경기없음
|
||||||
@@ -590,7 +588,7 @@ function final16set() {
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
$db->update('tournament', [
|
$db->update('tournament', [
|
||||||
'prmt=0'
|
'prmt'=>0
|
||||||
], true);
|
], true);
|
||||||
|
|
||||||
$gameStor->tournament=6;
|
$gameStor->tournament=6;
|
||||||
|
|||||||
+1
-1
@@ -274,7 +274,7 @@ else if($session->userGrade == 4){
|
|||||||
<tr>
|
<tr>
|
||||||
<td align=right style="'width:650px;border:none;">
|
<td align=right style="'width:650px;border:none;">
|
||||||
<?php printCommandTable($generalObj)?>
|
<?php printCommandTable($generalObj)?>
|
||||||
<input id="mainBtnSubmit" type=button style=background-color:<?=GameConst::$basecolor2?>;color:white;width:110px;font-size:13px; value='실 행' onclick='refreshing(this, 3,form2)'><input type=button style=background-color:<?=GameConst::$basecolor2?>;color:white;width:110px;font-size:13px; value='갱 신' onclick='refreshing(this, 0,0)'><input type=button style=background-color:<?=GameConst::$basecolor2?>;color:white;width:160px;font-size:13px; value='로비로' onclick=location.replace('../')><br>
|
<input id="mainBtnSubmit" type=button style=background-color:<?=GameConst::$basecolor2?>;color:white;width:110px;font-size:13px; value='실 행' onclick='refreshing(this, 3,form2)'><input type=button id='do_refresh' style=background-color:<?=GameConst::$basecolor2?>;color:white;width:110px;font-size:13px; value='갱 신'><input type=button style=background-color:<?=GameConst::$basecolor2?>;color:white;width:160px;font-size:13px; value='로비로' onclick="location.replace('../')"><br>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
+10
-1
@@ -160,7 +160,16 @@ $age = 20 + ($pleader + $ppower + $pintel) * 2 - (mt_rand(0, 1));
|
|||||||
// 아직 남았고 천재등록상태이면 특기 부여
|
// 아직 남았고 천재등록상태이면 특기 부여
|
||||||
if ($genius) {
|
if ($genius) {
|
||||||
$specage2 = $age;
|
$specage2 = $age;
|
||||||
$special2 = getSpecial2($leader, $power, $intel);
|
$special2 = SpecialityConst::pickSpecialWar([
|
||||||
|
'leader'=>$leader,
|
||||||
|
'power'=>$power,
|
||||||
|
'intel'=>$intel,
|
||||||
|
'dex0'=>0,
|
||||||
|
'dex10'=>0,
|
||||||
|
'dex20'=>0,
|
||||||
|
'dex30'=>0,
|
||||||
|
'dex40'=>0
|
||||||
|
]);
|
||||||
} else {
|
} else {
|
||||||
$specage2 = Util::valueFit(Util::round((GameConst::$retirementYear - $age)/4 - $relYear / 2), 3) + $age;
|
$specage2 = Util::valueFit(Util::round((GameConst::$retirementYear - $age)/4 - $relYear / 2), 3) + $age;
|
||||||
$special2 = 0;
|
$special2 = 0;
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
jQuery(function($){
|
||||||
|
|
||||||
|
$('#do_refresh').click(function(){
|
||||||
|
document.location.reload();
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -49,7 +49,7 @@ abstract class BaseCommand{
|
|||||||
|
|
||||||
protected $alternative = null;
|
protected $alternative = null;
|
||||||
|
|
||||||
static protected $isInitStatic = false;
|
static protected $isInitStatic = true;
|
||||||
protected static function initStatic(){
|
protected static function initStatic(){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -255,9 +255,9 @@ class che_랜덤임관 extends Command\GeneralCommand{
|
|||||||
|
|
||||||
$relYear = $env['year'] - $env['startyear'];
|
$relYear = $env['year'] - $env['startyear'];
|
||||||
if($general->getVar('npc') == 1 || $relYear >= 3){
|
if($general->getVar('npc') == 1 || $relYear >= 3){
|
||||||
$joinedNations = Join::decode($general->getVar('nations'));
|
$joinedNations = Json::decode($general->getVar('nations'));
|
||||||
$joinedNations[] = $destNationID;
|
$joinedNations[] = $destNationID;
|
||||||
$general->setVar('nations', Join::encode($joinedNations));
|
$general->setVar('nations', Json::encode($joinedNations));
|
||||||
}
|
}
|
||||||
|
|
||||||
$general->increaseVar('experience', $exp);
|
$general->increaseVar('experience', $exp);
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ class che_모병 extends che_징병{
|
|||||||
static protected $actionName = '모병';
|
static protected $actionName = '모병';
|
||||||
static protected $costOffset = 2;
|
static protected $costOffset = 2;
|
||||||
|
|
||||||
|
static protected $isInitStatic = false;
|
||||||
protected static function initStatic()
|
protected static function initStatic()
|
||||||
{
|
{
|
||||||
static::$defaultTrain = GameConst::$defaultTrainHigh;
|
static::$defaultTrain = GameConst::$defaultTrainHigh;
|
||||||
|
|||||||
@@ -162,9 +162,9 @@ class che_임관 extends Command\GeneralCommand{
|
|||||||
|
|
||||||
$relYear = $env['year'] - $env['startyear'];
|
$relYear = $env['year'] - $env['startyear'];
|
||||||
if($general->getVar('npc') == 1 || $relYear >= 3){
|
if($general->getVar('npc') == 1 || $relYear >= 3){
|
||||||
$joinedNations = Join::decode($general->getVar('nations'));
|
$joinedNations = Json::decode($general->getVar('nations'));
|
||||||
$joinedNations[] = $destNationID;
|
$joinedNations[] = $destNationID;
|
||||||
$general->setVar('nations', Join::encode($joinedNations));
|
$general->setVar('nations', Json::encode($joinedNations));
|
||||||
}
|
}
|
||||||
|
|
||||||
$general->increaseVar('experience', $exp);
|
$general->increaseVar('experience', $exp);
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ class che_징병 extends Command\GeneralCommand{
|
|||||||
protected $reqCrewType;
|
protected $reqCrewType;
|
||||||
protected $currCrewType;
|
protected $currCrewType;
|
||||||
|
|
||||||
|
static protected $isInitStatic = false;
|
||||||
protected static function initStatic()
|
protected static function initStatic()
|
||||||
{
|
{
|
||||||
static::$defaultTrain = GameConst::$defaultTrainLow;
|
static::$defaultTrain = GameConst::$defaultTrainLow;
|
||||||
|
|||||||
+28
-4
@@ -1253,18 +1253,42 @@ class GeneralAI{
|
|||||||
}
|
}
|
||||||
|
|
||||||
if($general->getVar('rice') < $baseArmRice && $general->getVar('gold') >= $baseArmGold * 3){
|
if($general->getVar('rice') < $baseArmRice && $general->getVar('gold') >= $baseArmGold * 3){
|
||||||
return ['che_군량매매', ['buyRice'=>true, 'amount'=> $general->getVar('gold') - $baseArmGold]];
|
return [
|
||||||
|
'che_군량매매',
|
||||||
|
[
|
||||||
|
'buyRice'=>true,
|
||||||
|
'amount'=> Util::toInt($general->getVar('gold') - $baseArmGold)
|
||||||
|
]
|
||||||
|
];
|
||||||
}
|
}
|
||||||
if($general->getVar('gold') < $baseArmGold && $general->getVar('gold') >= $baseArmRice * 3){
|
if($general->getVar('gold') < $baseArmGold && $general->getVar('gold') >= $baseArmRice * 3){
|
||||||
return ['che_군량매매', ['buyRice'=>false, 'amount'=> $general->getVar('rice') - $baseArmRice]];
|
return [
|
||||||
|
'che_군량매매',
|
||||||
|
[
|
||||||
|
'buyRice'=>false,
|
||||||
|
'amount'=> Util::toInt($general->getVar('rice') - $baseArmRice)
|
||||||
|
]
|
||||||
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
if($general->getVar('rice') < $this->baseDevelCost && $general->getVar('gold') >= $this->baseDevelCost * 3){
|
if($general->getVar('rice') < $this->baseDevelCost && $general->getVar('gold') >= $this->baseDevelCost * 3){
|
||||||
return ['che_군량매매', ['buyRice'=>true, 'amount'=> $general->getVar('gold') - $this->baseDevelCost]];
|
return [
|
||||||
|
'che_군량매매',
|
||||||
|
[
|
||||||
|
'buyRice'=>true,
|
||||||
|
'amount'=> Util::toInt($general->getVar('gold') - $this->baseDevelCost)
|
||||||
|
]
|
||||||
|
];
|
||||||
}
|
}
|
||||||
if($general->getVar('gold') < $this->baseDevelCost && $general->getVar('gold') >= $this->baseDevelCost * 3){
|
if($general->getVar('gold') < $this->baseDevelCost && $general->getVar('gold') >= $this->baseDevelCost * 3){
|
||||||
return ['che_군량매매', ['buyRice'=>false, 'amount'=> $general->getVar('rice') - $this->baseDevelCost]];
|
return [
|
||||||
|
'che_군량매매',
|
||||||
|
[
|
||||||
|
'buyRice'=>false,
|
||||||
|
'amount'=> Util::toInt($general->getVar('rice') - $this->baseDevelCost)
|
||||||
|
]
|
||||||
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -229,7 +229,7 @@ class NPC{
|
|||||||
$duplicateCnt = $db->queryFirstField('SELECT count(no) FROM general WHERE name LIKE %s', $name.'%') + 1;
|
$duplicateCnt = $db->queryFirstField('SELECT count(no) FROM general WHERE name LIKE %s', $name.'%') + 1;
|
||||||
|
|
||||||
if($duplicateCnt > 1){
|
if($duplicateCnt > 1){
|
||||||
$name = "{$name}($duplicateCnt}";
|
$name = "{$name}{$duplicateCnt}";
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->realName = $name;
|
$this->realName = $name;
|
||||||
|
|||||||
Reference in New Issue
Block a user