vue: join 생성 완료 메시지
This commit is contained in:
-182
@@ -1,182 +0,0 @@
|
|||||||
<?php
|
|
||||||
namespace sammo;
|
|
||||||
|
|
||||||
include "lib.php";
|
|
||||||
include "func.php";
|
|
||||||
|
|
||||||
$session = Session::requireLogin()->setReadOnly();
|
|
||||||
$userID = Session::getUserID();
|
|
||||||
|
|
||||||
if (!$userID) {
|
|
||||||
MessageBox("잘못된 접근입니다!!!");
|
|
||||||
echo "<script>history.go(-1);</script>";
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
//회원 테이블에서 정보확인
|
|
||||||
$member = RootDB::db()->queryFirstRow("select no,name,picture,imgsvr,grade from member where no= %i", $userID);
|
|
||||||
|
|
||||||
if (!$member) {
|
|
||||||
MessageBox("잘못된 접근입니다!!!");
|
|
||||||
echo "<script>history.go(-1);</script>";
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
$db = DB::db();
|
|
||||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
|
||||||
$admin = $gameStor->getValues(['block_general_create','show_img_level','maxgeneral']);
|
|
||||||
if($admin['block_general_create']){
|
|
||||||
MessageBox("잘못된 접근입니다!!!");
|
|
||||||
echo "<script>history.go(-1);</script>";
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title><?=UniqueConst::$serverName?>: 장수생성</title>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
||||||
<meta name="viewport" content="width=1024" />
|
|
||||||
<script>
|
|
||||||
var defaultStatTotal = <?=GameConst::$defaultStatTotal?>;
|
|
||||||
var defaultStatMin = <?=GameConst::$defaultStatMin?>;
|
|
||||||
var defaultStatMax = <?=GameConst::$defaultStatMax?>;
|
|
||||||
|
|
||||||
var charInfoText = <?php
|
|
||||||
|
|
||||||
$charInfoText = [];
|
|
||||||
foreach(GameConst::$availablePersonality as $personalityID){
|
|
||||||
$personalityInfo = buildPersonalityClass($personalityID)->getInfo();
|
|
||||||
$charInfoText[$personalityID] = $personalityInfo;
|
|
||||||
}
|
|
||||||
echo Json::encode((object)$charInfoText);
|
|
||||||
?>;
|
|
||||||
</script>
|
|
||||||
<?=WebUtil::printCSS('../e_lib/bootstrap.min.css')?>
|
|
||||||
<?=WebUtil::printCSS('../d_shared/common.css')?>
|
|
||||||
<?=WebUtil::printCSS('css/common.css')?>
|
|
||||||
<?=WebUtil::printJS('../d_shared/common_path.js')?>
|
|
||||||
<?=WebUtil::printJS('dist_js/vendors.js')?>
|
|
||||||
<?=WebUtil::printJS('dist_js/common.js')?>
|
|
||||||
<?=WebUtil::printJS('dist_js/join.js')?>
|
|
||||||
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<table align=center width=1000 class='tb_layout bg0'>
|
|
||||||
<tr><td>장 수 생 성<br><?=backButton()?></td></tr>
|
|
||||||
</table>
|
|
||||||
<table align=center width=1000 class='tb_layout bg0'>
|
|
||||||
<tr><td align=center><?=info(0)?></td></tr>
|
|
||||||
</table>
|
|
||||||
<?php
|
|
||||||
|
|
||||||
$gencount = $db->queryFirstField('SELECT count(no) FROM general WHERE npc<2');
|
|
||||||
|
|
||||||
if ($gencount >= $admin['maxgeneral']) {
|
|
||||||
echo "<script>alert('더 이상 등록할 수 없습니다.');</script>";
|
|
||||||
echo "<script>history.go(-1);</script>";
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
$nationList = $db->query('SELECT nation,`name`,color,scout FROM nation');
|
|
||||||
shuffle($nationList);
|
|
||||||
$nationList = Util::convertArrayToDict($nationList, 'nation');
|
|
||||||
//NOTE: join 안할것임
|
|
||||||
$scoutMsgs = KVStorage::getValuesFromInterNamespace($db, 'nation_env', 'scout_msg');
|
|
||||||
foreach($scoutMsgs as $nationID=>$scoutMsg){
|
|
||||||
$nationList[$nationID]['scoutmsg'] = $scoutMsg;
|
|
||||||
}
|
|
||||||
|
|
||||||
echo getInvitationList($nationList);
|
|
||||||
?>
|
|
||||||
|
|
||||||
<form id='join_form' name=form1 method=post action=join_post.php>
|
|
||||||
<table align=center width=1000 class='tb_layout bg0'>
|
|
||||||
<tr>
|
|
||||||
<td colspan=3 align=center class='bg1'>장수 생성</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td width=498 align=right class='bg1'>장수명</td>
|
|
||||||
<td colspan=2>
|
|
||||||
<input id="generalName" type=text name=name maxlength=18 size=18 style="color:white;background-color:black;" value="<?=$member['name']?>">(전각 9글자, 반각 18글자 이내)
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<?php
|
|
||||||
if ($admin['show_img_level'] >= 1 && $member['grade'] >= 1 && $member['picture'] != "") {
|
|
||||||
$imageTemp = GetImageURL($member['imgsvr']);
|
|
||||||
echo "
|
|
||||||
<tr>
|
|
||||||
<td align=right class='bg1'>전콘 사용 여부</td>
|
|
||||||
<td width=64 height=64>
|
|
||||||
<img width='64' height='64' src='{$imageTemp}/{$member['picture']}' border='0'>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<input type=checkbox name=pic value=1 checked>사용
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
";
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
<tr>
|
|
||||||
<td align=center colspan=3>
|
|
||||||
계정관리에서 자신만을 표현할 수 있는 아이콘을 업로드 해보세요!
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td width=498 align=right class='bg1'>성격</td>
|
|
||||||
<td colspan=2>
|
|
||||||
<select id="selChar" name=character size=1 maxlength=15 style=color:white;background-color:black;>
|
|
||||||
<option selected value='Random'>????</option>
|
|
||||||
<?php foreach(GameConst::$availablePersonality as $personalityID): ?>
|
|
||||||
<?php $personalityName = buildPersonalityClass($personalityID)->getName(); ?>
|
|
||||||
<option value='<?=$personalityID?>'><?=$personalityName?></option>
|
|
||||||
<?php endforeach; ?>
|
|
||||||
</select> <span id="charInfoText"></span>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td width=498 align=right class='bg1'>통솔</td>
|
|
||||||
<td colspan=2><input type="number" name="leadership" id="leadership" value="50"></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td width=498 align=right class='bg1'>무력</td>
|
|
||||||
<td colspan=2><input type="number" name="strength" id="strength" value="50"></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td width=498 align=right class='bg1'>지력</td>
|
|
||||||
<td colspan=2><input type="number" name="intel" id="intel" value="50"></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td width=498 align=right class='bg1'>능력치 조정</td>
|
|
||||||
<td colspan=2>
|
|
||||||
<input type=button value=랜덤형 onclick=abilityRand()>
|
|
||||||
<input type=button value=통솔무력형 onclick=abilityLeadpow()>
|
|
||||||
<input type=button value=통솔지력형 onclick=abilityLeadint()>
|
|
||||||
<input type=button value=무력지력형 onclick=abilityPowint()>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td align=center colspan=3>
|
|
||||||
<font color=orange>모든 능력치는 ( <?=GameConst::$defaultStatMin?> <= 능력치 <= <?=GameConst::$defaultStatMax?> ) 사이로 잡으셔야 합니다.<br>
|
|
||||||
그 외의 능력치는 가입되지 않습니다.</font>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td align=center colspan=3>
|
|
||||||
능력치의 총합은 <?=GameConst::$defaultStatTotal?>입니다. 가입후 0~10의 능력치 보너스를 받게 됩니다.<br>
|
|
||||||
임의의 도시에서 재야로 시작하며 건국과 임관은 게임 내에서 실행합니다.
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td width=498 align=right><input type=submit name=join value=장수생성></td>
|
|
||||||
<td colspan=2><input type=reset name=reset value=다시입력></td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
</form>
|
|
||||||
<table align=center width=1000 class='tb_layout bg0'>
|
|
||||||
<tr><td><?=backButton()?></td></tr>
|
|
||||||
<tr><td><?=banner()?> </td></tr>
|
|
||||||
</table>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -1,410 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace sammo;
|
|
||||||
|
|
||||||
include "lib.php";
|
|
||||||
include "func.php";
|
|
||||||
|
|
||||||
function dieMsg(string $msg)
|
|
||||||
{
|
|
||||||
$jmsg = Json::encode($msg);
|
|
||||||
echo "<html><head><style>html,body{background:black;}</style><script>alert({$jmsg});history.go(-1);</script></head><body></body></html>";
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
$v = new Validator($_POST);
|
|
||||||
$v
|
|
||||||
->rule('required', [
|
|
||||||
'name',
|
|
||||||
'leadership',
|
|
||||||
'strength',
|
|
||||||
'intel'
|
|
||||||
])
|
|
||||||
->rule('integer', [
|
|
||||||
'leadership',
|
|
||||||
'strength',
|
|
||||||
'intel',
|
|
||||||
])
|
|
||||||
->rule('stringWidthBetween', 'name', 1, 18)
|
|
||||||
->rule('min', [
|
|
||||||
'leadership',
|
|
||||||
'strength',
|
|
||||||
'intel'
|
|
||||||
], GameConst::$defaultStatMin)
|
|
||||||
->rule('max', [
|
|
||||||
'leadership',
|
|
||||||
'strength',
|
|
||||||
'intel'
|
|
||||||
], GameConst::$defaultStatMax)
|
|
||||||
->rule('in', 'character', array_merge(GameConst::$availablePersonality, ['Random']))
|
|
||||||
->rule('in', 'inheritSpecial', GameConst::$availableSpecialWar)
|
|
||||||
->rule('integer', 'inheritTurntime')
|
|
||||||
->rule('min', 'inheritTurntime', 0)
|
|
||||||
->rule('in', 'inheritCity', array_keys(CityConst::all()))
|
|
||||||
->rule('integerArray', 'inheritBonusStat');
|
|
||||||
|
|
||||||
if (!$v->validate()) {
|
|
||||||
dieMsg($v->errorStr());
|
|
||||||
}
|
|
||||||
|
|
||||||
$session = Session::requireLogin()->setReadOnly();
|
|
||||||
$userID = Session::getUserID();
|
|
||||||
//NOTE: 이 페이지에서는 세션에 데이터를 등록하지 않음. 로그인은 이후에.
|
|
||||||
|
|
||||||
$name = Util::getPost('name');
|
|
||||||
$name = htmlspecialchars($name);
|
|
||||||
$name = StringUtil::removeSpecialCharacter($name);
|
|
||||||
$name = WebUtil::htmlPurify($name);
|
|
||||||
$name = StringUtil::textStrip($name);
|
|
||||||
$pic = (int)Util::getPost('pic', 'bool', 0);
|
|
||||||
$character = Util::getPost('character');
|
|
||||||
|
|
||||||
$leadership = Util::getPost('leadership', 'int', 50);
|
|
||||||
$strength = Util::getPost('strength', 'int', 50);
|
|
||||||
$intel = Util::getPost('intel', 'int', 50);
|
|
||||||
|
|
||||||
$inheritSpecial = Util::getPost('inheritSpecial');
|
|
||||||
$inheritTurntime = Util::getPost('inheritTurntime', 'int');
|
|
||||||
$inheritCity = Util::getPost('inheritCity', 'int');
|
|
||||||
$inheritBonusStat = Util::getPost('inheritBonusStat', 'array_int');
|
|
||||||
|
|
||||||
$join = Util::getPost('join'); //쓸모 없음
|
|
||||||
|
|
||||||
$rootDB = RootDB::db();
|
|
||||||
//회원 테이블에서 정보확인
|
|
||||||
$member = $rootDB->queryFirstRow('SELECT `no`, id, picture, grade, `name`, imgsvr FROM member WHERE no=%i', $userID);
|
|
||||||
|
|
||||||
if (!$member) {
|
|
||||||
dieMsg("잘못된 접근입니다!!!");
|
|
||||||
}
|
|
||||||
|
|
||||||
$db = DB::db();
|
|
||||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
|
||||||
$gameStor->cacheValues(['year', 'month', 'maxgeneral', 'scenario', 'show_img_level', 'turnterm', 'turntime', 'genius', 'npcmode']);
|
|
||||||
########## 동일 정보 존재여부 확인. ##########
|
|
||||||
|
|
||||||
$gencount = $db->queryFirstField('SELECT count(`no`) FROM general WHERE npc<2');
|
|
||||||
$oldGeneral = $db->queryFirstField('SELECT `no` FROM general WHERE `owner`=%i', $userID);
|
|
||||||
$oldName = $db->queryFirstField('SELECT `no` FROM general WHERE `name`=%s', $name);
|
|
||||||
|
|
||||||
if ($oldGeneral) {
|
|
||||||
dieMsg("이미 등록하셨습니다!");
|
|
||||||
}
|
|
||||||
if ($oldName) {
|
|
||||||
dieMsg("이미 있는 장수입니다. 다른 이름으로 등록해 주세요!");
|
|
||||||
}
|
|
||||||
if ($gameStor->maxgeneral <= $gencount) {
|
|
||||||
dieMsg("더이상 등록할 수 없습니다!");
|
|
||||||
}
|
|
||||||
if ($name == '') {
|
|
||||||
dieMsg("이름이 짧습니다. 다시 가입해주세요!");
|
|
||||||
}
|
|
||||||
if (mb_strwidth($name) > 18) {
|
|
||||||
dieMsg("이름이 유효하지 않습니다. 다시 가입해주세요!");
|
|
||||||
}
|
|
||||||
if ($leadership + $strength + $intel > GameConst::$defaultStatTotal) {
|
|
||||||
dieMsg("능력치가 " . GameConst::$defaultStatTotal . "을 넘어섰습니다. 다시 가입해주세요!");
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($inheritBonusStat) {
|
|
||||||
if (count($inheritBonusStat) != 3) {
|
|
||||||
dieMsg("보너스 능력치가 잘못 지정되었습니다. 다시 가입해주세요!");
|
|
||||||
}
|
|
||||||
$sum = array_sum($inheritBonusStat);
|
|
||||||
if ($sum < GameConst::$bornMinStatBonus || GameConst::$bornMaxStatBonus > 5) {
|
|
||||||
dieMsg("보너스 능력치 합이 잘못 지정되었습니다. 다시 가입해주세요!");
|
|
||||||
}
|
|
||||||
foreach ($inheritBonusStat as $stat) {
|
|
||||||
if ($stat < 0) {
|
|
||||||
dieMsg("보너스 능력치가 음수입니다. 다시 가입해주세요!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$admin = $gameStor->getValues(['scenario', 'turnterm', 'turntime', 'show_img_level', 'startyear', 'year']);
|
|
||||||
|
|
||||||
$inheritTotalPoint = resetInheritanceUser($userID);
|
|
||||||
$inheritRequiredPoint = 0;
|
|
||||||
|
|
||||||
if ($inheritCity !== null) {
|
|
||||||
$inheritRequiredPoint += GameConst::$inheritBornCityPoint;
|
|
||||||
}
|
|
||||||
if ($inheritBonusStat !== null) {
|
|
||||||
$inheritRequiredPoint += GameConst::$inheritBornMaxBonusStat;
|
|
||||||
}
|
|
||||||
if ($inheritSpecial !== null) {
|
|
||||||
$inheritRequiredPoint += GameConst::$inheritBornSpecialPoint;
|
|
||||||
}
|
|
||||||
if ($inheritTurntime !== null) {
|
|
||||||
$inheritRequiredPoint += GameConst::$inheritBornTurntimePoint;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($inheritTotalPoint < $inheritRequiredPoint) {
|
|
||||||
dieMsg("유산 포인트가 부족합니다. 다시 가입해주세요!");
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($inheritSpecial !== null && $gameStor->genius == 0) {
|
|
||||||
dieMsg("이미 천재가 모두 나타났습니다. 다시 가입해주세요!");
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($inheritCity !== null && !key_exists($inheritCity, CityConst::all())) {
|
|
||||||
dieMsg("도시가 잘못 지정되었습니다. 다시 가입해주세요!");
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($inheritSpecial) {
|
|
||||||
$genius = true;
|
|
||||||
} else {
|
|
||||||
// 현재 1%
|
|
||||||
$genius = Util::randBool(0.01);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($genius && $gameStor->genius > 0) {
|
|
||||||
$gameStor->genius = $gameStor->genius - 1;
|
|
||||||
} else {
|
|
||||||
$genius = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($inheritCity !== null) {
|
|
||||||
$city = $inheritCity;
|
|
||||||
} else {
|
|
||||||
// 공백지에서만 태어나게
|
|
||||||
$city = $db->queryFirstField("select city from city where level>=5 and level<=6 and nation=0 order by rand() limit 0,1");
|
|
||||||
if (!$city) {
|
|
||||||
$city = $db->queryFirstField("select city from city where level>=5 and level<=6 order by rand() limit 0,1");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($inheritBonusStat) {
|
|
||||||
[$pleadership, $pstrength, $pintel] = $inheritBonusStat;
|
|
||||||
} else {
|
|
||||||
$pleadership = 0;
|
|
||||||
$pstrength = 0;
|
|
||||||
$pintel = 0;
|
|
||||||
foreach (Util::range(Util::randRangeInt(GameConst::$bornMinStatBonus, GameConst::$bornMaxStatBonus)) as $statIdx) {
|
|
||||||
switch (Util::choiceRandomUsingWeight([$leadership, $strength, $intel])) {
|
|
||||||
case 0:
|
|
||||||
$pleadership++;
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
$pstrength++;
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
$pintel++;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$leadership = $leadership + $pleadership;
|
|
||||||
$strength = $strength + $pstrength;
|
|
||||||
$intel = $intel + $pintel;
|
|
||||||
|
|
||||||
$relYear = Util::valueFit($admin['year'] - $admin['startyear'], 0);
|
|
||||||
|
|
||||||
$age = 20 + ($pleadership + $pstrength + $pintel) * 2 - (mt_rand(0, 1));
|
|
||||||
// 아직 남았고 천재등록상태이면 특기 부여
|
|
||||||
if ($genius) {
|
|
||||||
$specage2 = $age;
|
|
||||||
if ($inheritSpecial) {
|
|
||||||
$special2 = $inheritSpecial;
|
|
||||||
} else {
|
|
||||||
$special2 = SpecialityHelper::pickSpecialWar([
|
|
||||||
'leadership' => $leadership,
|
|
||||||
'strength' => $strength,
|
|
||||||
'intel' => $intel,
|
|
||||||
'dex1' => 0,
|
|
||||||
'dex2' => 0,
|
|
||||||
'dex3' => 0,
|
|
||||||
'dex4' => 0,
|
|
||||||
'dex5' => 0
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$specage2 = Util::valueFit(Util::round((GameConst::$retirementYear - $age) / 6 - $relYear / 2), 3) + $age;
|
|
||||||
$special2 = GameConst::$defaultSpecialWar;
|
|
||||||
}
|
|
||||||
//내특
|
|
||||||
$specage = Util::valueFit(Util::round((GameConst::$retirementYear - $age) / 12 - $relYear / 2), 3) + $age;
|
|
||||||
$special = GameConst::$defaultSpecialDomestic;
|
|
||||||
|
|
||||||
if ($admin['scenario'] >= 1000) {
|
|
||||||
$specage2 = $age + 3;
|
|
||||||
$specage = $age + 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($relYear < 3) {
|
|
||||||
$experience = 0;
|
|
||||||
} else {
|
|
||||||
$expGenCount = $db->queryFirstField('SELECT count(*) FROM general WHERE nation != 0 AND npc < 4');
|
|
||||||
$targetGenOrder = Util::round($expGenCount * 0.2);
|
|
||||||
$experience = $db->queryFirstField(
|
|
||||||
'SELECT experience FROM general WHERE nation != 0 AND npc < 4 ORDER BY experience ASC LIMIT %i, 1',
|
|
||||||
$targetGenOrder - 1
|
|
||||||
);
|
|
||||||
$experience *= 0.8;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($inheritTurntime === null) {
|
|
||||||
$inheritTurntime = $inheritTurntime % ($gameStor->turnterm * 60);
|
|
||||||
$inheritTurntime += Util::randRangeInt(0, 999999) / 1000000;
|
|
||||||
$turntime = cutTurn($admin['turntime'], $admin['turnterm']);
|
|
||||||
$turntime = TimeUtil::nowAddSeconds($inheritTurntime, true);
|
|
||||||
} else {
|
|
||||||
$turntime = getRandTurn($admin['turnterm'], new \DateTimeImmutable($admin['turntime']));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
$now = TimeUtil::now(true);
|
|
||||||
if ($now >= $turntime) {
|
|
||||||
$turntime = addTurn($turntime, $admin['turnterm']);
|
|
||||||
}
|
|
||||||
|
|
||||||
//특회 전콘
|
|
||||||
if ($admin['show_img_level'] >= 1 && $member['grade'] >= 1 && $member['picture'] != "" && $pic) {
|
|
||||||
$face = $member['picture'];
|
|
||||||
$imgsvr = $member['imgsvr'];
|
|
||||||
} else {
|
|
||||||
$face = "default.jpg";
|
|
||||||
$imgsvr = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
//성격 랜덤시
|
|
||||||
if (!in_array($character, GameConst::$availablePersonality)) {
|
|
||||||
$character = Util::choiceRandom(GameConst::$availablePersonality);
|
|
||||||
}
|
|
||||||
//상성 랜덤
|
|
||||||
$affinity = rand() % 150 + 1;
|
|
||||||
|
|
||||||
########## 회원정보 테이블에 입력값을 등록한다. ##########
|
|
||||||
$db->insert('general', [
|
|
||||||
'owner' => $userID,
|
|
||||||
'name' => $name,
|
|
||||||
'owner_name' => $member['name'],
|
|
||||||
'picture' => $face,
|
|
||||||
'imgsvr' => $imgsvr,
|
|
||||||
'nation' => 0,
|
|
||||||
'city' => $city,
|
|
||||||
'troop' => 0,
|
|
||||||
'affinity' => $affinity,
|
|
||||||
'leadership' => $leadership,
|
|
||||||
'strength' => $strength,
|
|
||||||
'intel' => $intel,
|
|
||||||
'experience' => $experience,
|
|
||||||
'dedication' => 0,
|
|
||||||
'gold' => GameConst::$defaultGold,
|
|
||||||
'rice' => GameConst::$defaultRice,
|
|
||||||
'crew' => 0,
|
|
||||||
'train' => 0,
|
|
||||||
'atmos' => 0,
|
|
||||||
'officer_level' => 0,
|
|
||||||
'turntime' => $turntime,
|
|
||||||
'killturn' => 6,
|
|
||||||
'lastconnect' => $now,
|
|
||||||
'lastrefresh' => $now,
|
|
||||||
'crewtype' => GameUnitConst::DEFAULT_CREWTYPE,
|
|
||||||
'makelimit' => 0,
|
|
||||||
'age' => $age,
|
|
||||||
'startage' => $age,
|
|
||||||
'personal' => $character,
|
|
||||||
'specage' => $specage,
|
|
||||||
'special' => $special,
|
|
||||||
'specage2' => $specage2,
|
|
||||||
'special2' => $special2
|
|
||||||
]);
|
|
||||||
$generalID = $db->insertId();
|
|
||||||
$turnRows = [];
|
|
||||||
foreach (Util::range(GameConst::$maxTurn) as $turnIdx) {
|
|
||||||
$turnRows[] = [
|
|
||||||
'general_id' => $generalID,
|
|
||||||
'turn_idx' => $turnIdx,
|
|
||||||
'action' => '휴식',
|
|
||||||
'arg' => null,
|
|
||||||
'brief' => '휴식'
|
|
||||||
];
|
|
||||||
}
|
|
||||||
$db->insert('general_turn', $turnRows);
|
|
||||||
|
|
||||||
$rank_data = [];
|
|
||||||
foreach (array_keys(General::RANK_COLUMN) as $rankColumn) {
|
|
||||||
$rank_data[] = [
|
|
||||||
'general_id' => $generalID,
|
|
||||||
'nation_id' => 0,
|
|
||||||
'type' => $rankColumn,
|
|
||||||
'value' => 0
|
|
||||||
];
|
|
||||||
}
|
|
||||||
$db->insert('rank_data', $rank_data);
|
|
||||||
$db->insert('betting', [
|
|
||||||
'general_id' => $generalID,
|
|
||||||
]);
|
|
||||||
$cityname = CityConst::byID($city)->name;
|
|
||||||
|
|
||||||
$me = [
|
|
||||||
'no' => $generalID
|
|
||||||
];
|
|
||||||
|
|
||||||
$log = [];
|
|
||||||
$mylog = [];
|
|
||||||
|
|
||||||
$logger = new ActionLogger($generalID, 0, $gameStor->year, $gameStor->month);
|
|
||||||
|
|
||||||
$josaRa = JosaUtil::pick($name, '라');
|
|
||||||
$speicalText = getGeneralSpecialWarName($special2);
|
|
||||||
if ($genius) {
|
|
||||||
|
|
||||||
$logger->pushGlobalActionLog("<G><b>{$cityname}</b></>에서 <Y>{$name}</>{$josaRa}는 기재가 천하에 이름을 알립니다.");
|
|
||||||
$logger->pushGlobalActionLog("<C>{$speicalText}</> 특기를 가진 <C>천재</>의 등장으로 온 천하가 떠들썩합니다.");
|
|
||||||
$logger->pushGlobalHistoryLog("<L><b>【천재】</b></><G><b>{$cityname}</b></>에 천재가 등장했습니다.");
|
|
||||||
} else {
|
|
||||||
$logger->pushGlobalActionLog("<G><b>{$cityname}</b></>에서 <Y>{$name}</>{$josaRa}는 호걸이 천하에 이름을 알립니다.");
|
|
||||||
}
|
|
||||||
|
|
||||||
$logger->pushGeneralHistoryLog("<Y>{$name}</>, <G>{$cityname}</>에서 큰 뜻을 품다.");
|
|
||||||
$logger->pushGeneralActionLog("삼국지 모의전투 PHP의 세계에 오신 것을 환영합니다 ^o^", ActionLogger::PLAIN);
|
|
||||||
$logger->pushGeneralActionLog("처음 하시는 경우에는 <D>도움말</>을 참고하시고,", ActionLogger::PLAIN);
|
|
||||||
$logger->pushGeneralActionLog("문의사항이 있으시면 게시판에 글을 남겨주시면 되겠네요~", ActionLogger::PLAIN);
|
|
||||||
$logger->pushGeneralActionLog("부디 즐거운 삼모전 되시길 바랍니다 ^^", ActionLogger::PLAIN);
|
|
||||||
$logger->pushGeneralActionLog("통솔 <C>$pleadership</> 무력 <C>$pstrength</> 지력 <C>$pintel</> 의 보너스를 받으셨습니다.", ActionLogger::PLAIN);
|
|
||||||
$logger->pushGeneralActionLog("연령은 <C>$age</>세로 시작합니다.", ActionLogger::PLAIN);
|
|
||||||
|
|
||||||
if ($genius) {
|
|
||||||
$logger->pushGeneralActionLog("축하합니다! 천재로 태어나 처음부터 <C>{$speicalText}</> 특기를 가지게 됩니다!", ActionLogger::PLAIN);
|
|
||||||
$logger->pushGeneralHistoryLog("<C>{$speicalText}</> 특기를 가진 천재로 탄생.");
|
|
||||||
}
|
|
||||||
|
|
||||||
$logger->flush();
|
|
||||||
|
|
||||||
pushAdminLog(["가입 : {$userID} // {$name} // {$generalID}" . getenv("REMOTE_ADDR")]);
|
|
||||||
|
|
||||||
$rootDB->insert('member_log', [
|
|
||||||
'member_no' => $userID,
|
|
||||||
'date' => TimeUtil::now(),
|
|
||||||
'action_type' => 'make_general',
|
|
||||||
'action' => Json::encode([
|
|
||||||
'server' => DB::prefix(),
|
|
||||||
'type' => 'general',
|
|
||||||
'generalID' => $generalID,
|
|
||||||
'generalName' => $name
|
|
||||||
])
|
|
||||||
]);
|
|
||||||
|
|
||||||
?>
|
|
||||||
<html>
|
|
||||||
|
|
||||||
<head>
|
|
||||||
<style>
|
|
||||||
html,
|
|
||||||
body {
|
|
||||||
background: black;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
<script>
|
|
||||||
window.alert('정상적으로 회원 가입되었습니다. 장수명 : <?= $name ?> \n위키와 팁/강좌 게시판을 꼭 읽어보세요!');
|
|
||||||
location.replace('./');
|
|
||||||
</script>
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
</body>
|
|
||||||
|
|
||||||
</html>
|
|
||||||
+24
-13
@@ -295,20 +295,31 @@ export default defineComponent({
|
|||||||
this.args.intel = Math.floor(stats.total / 3);
|
this.args.intel = Math.floor(stats.total / 3);
|
||||||
},
|
},
|
||||||
async submitForm() {
|
async submitForm() {
|
||||||
|
//검증은 언제 되어야 하는가?
|
||||||
const args = clone(this.args);
|
const args = clone(this.args);
|
||||||
console.log(args);
|
let result: InvalidResponse;
|
||||||
const response = await axios({
|
try {
|
||||||
url: "api.php",
|
const response = await axios({
|
||||||
method: 'post',
|
url: "api.php",
|
||||||
responseType: 'json',
|
method: "post",
|
||||||
data: {
|
responseType: "json",
|
||||||
path: ["General", "Join"],
|
data: {
|
||||||
args,
|
path: ["General", "Join"],
|
||||||
},
|
args,
|
||||||
});
|
},
|
||||||
console.log(response);
|
});
|
||||||
const result:InvalidResponse = response.data;
|
result = response.data;
|
||||||
console.log(result);
|
if(!result.result){
|
||||||
|
throw result.reason;
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e);
|
||||||
|
alert(`실패했습니다: ${e}`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
alert('정상적으로 생성되었습니다. \n위키와 팁/강좌 게시판을 꼭 읽어보세요!');
|
||||||
|
location.href = './';
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user