수비 기호 표시 추가

This commit is contained in:
2020-06-18 01:05:34 +09:00
parent b4e274682a
commit 0ddc8588f8
2 changed files with 278 additions and 275 deletions
+4 -5
View File
@@ -93,11 +93,10 @@ var availableDieImmediately = <?=$availableDieImmediately?'true':'false'?>;
∞<span style='color:orange'>수뇌가 되었을 때 휴식 턴이어도 적당한 턴을 알아서 넣는 것을 허용합니다.</span><br><br> ∞<span style='color:orange'>수뇌가 되었을 때 휴식 턴이어도 적당한 턴을 알아서 넣는 것을 허용합니다.</span><br><br>
<?php endif; ?> <?php endif; ?>
수비 【<select id='defence_train' name='defence_train'> 수비 【<select id='defence_train' name='defence_train'>
<option value=90 <?=$me->getVar('defence_train')==90?"selected":""; ?>>☆(훈사90)</option> <?php foreach([90, 80, 60, 40] as $targetDefenceTrain): ?>
<option value=80 <?=$me->getVar('defence_train')==80?"selected":""; ?>>◎(훈사80)</option> <option value='<?=$targetDefenceTrain?>' <?=$me->getVar('defence_train')==$targetDefenceTrain?"selected":""; ?>><?=formatDefenceTrain($targetDefenceTrain)?>(훈사<?=$targetDefenceTrain?>)</option>
<option value=60 <?=$me->getVar('defence_train')==60?"selected":""; ?>>○(훈사60)</option> <?php endforeach; ?>
<option value=40 <?=$me->getVar('defence_train')==40?"selected":""; ?>>△(훈사40)</option> <option value=999 <?=$me->getVar('defence_train')==999?"selected":""; ?>><?=formatDefenceTrain(999)?>[훈련, 사기 -3]</option>
<option value=999 <?=$me->getVar('defence_train')==999?"selected":""; ?>>×[훈련, 사기 -3]</option>
</select> </select>
】<br><br> 】<br><br>
<input type=<?=$submit?> id='set_my_setting' name=btn style=background-color:<?=GameConst::$basecolor2?>;color:white;width:160px;height:30px;font-size:13px; value=설정저장><br> <input type=<?=$submit?> id='set_my_setting' name=btn style=background-color:<?=GameConst::$basecolor2?>;color:white;width:160px;height:30px;font-size:13px; value=설정저장><br>
+274 -270
View File
@@ -1,270 +1,274 @@
<?php <?php
namespace sammo; namespace sammo;
/** /**
* 템플릿 생성과 관련된 함수들을 모아두는 파일 * 템플릿 생성과 관련된 함수들을 모아두는 파일
* *
* NOTE: 아직 converter와 명확한 구분이 되어있지 않음. * NOTE: 아직 converter와 명확한 구분이 되어있지 않음.
* TODO: legacy template들을 전부 template 폴더로 모아둘 필요 있음 * TODO: legacy template들을 전부 template 폴더로 모아둘 필요 있음
* TODO: side effect를 제거 * TODO: side effect를 제거
*/ */
/** /**
* 관리자 권한이 필요함을 출력. * 관리자 권한이 필요함을 출력.
* @return void * @return void
*/ */
function requireAdminPermissionHTML() function requireAdminPermissionHTML()
{ {
ob_start(); ob_start();
?> ?>
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<title>관리메뉴</title> <title>관리메뉴</title>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=1024" /> <meta name="viewport" content="width=1024" />
<?= WebUtil::printCSS('../d_shared/common.css') ?> <?= WebUtil::printCSS('../d_shared/common.css') ?>
<?= WebUtil::printCSS('css/common.css') ?> <?= WebUtil::printCSS('css/common.css') ?>
</head> </head>
<body> <body>
관리자가 아닙니다.<br> 관리자가 아닙니다.<br>
<?= banner() ?> <?= banner() ?>
</body> </body>
</html> </html>
<?php <?php
return ob_get_clean(); return ob_get_clean();
} }
function turnTable() function turnTable()
{ {
$turnList = []; $turnList = [];
$turnList[] = "<option selected value='0'>1턴</option>"; $turnList[] = "<option selected value='0'>1턴</option>";
foreach (Util::range(1, GameConst::$maxTurn) as $turnIdx) { foreach (Util::range(1, GameConst::$maxTurn) as $turnIdx) {
$turnText = $turnIdx + 1; $turnText = $turnIdx + 1;
$turnList[] = "<option value='{$turnIdx}'>{$turnText}턴</option>"; $turnList[] = "<option value='{$turnIdx}'>{$turnText}턴</option>";
} }
$turnText = join("\n", $turnList); $turnText = join("\n", $turnList);
return " return "
<select id='generalTurnSelector' name=turn[] size=11 multiple> <select id='generalTurnSelector' name=turn[] size=11 multiple>
<option value='-3'>전체</option> <option value='-3'>전체</option>
<option value='-1'>홀턴</option> <option value='-1'>홀턴</option>
<option value='-2'>짝턴</option> <option value='-2'>짝턴</option>
{$turnText} {$turnText}
</select> </select>
"; ";
} }
function chiefTurnTable() function chiefTurnTable()
{ {
$turnList = []; $turnList = [];
$turnList[] = "<option selected value='0'>1턴</option>"; $turnList[] = "<option selected value='0'>1턴</option>";
foreach (Util::range(1, GameConst::$maxChiefTurn) as $turnIdx) { foreach (Util::range(1, GameConst::$maxChiefTurn) as $turnIdx) {
$turnText = $turnIdx + 1; $turnText = $turnIdx + 1;
$turnList[] = "<option value='{$turnIdx}'>{$turnText}턴</option>"; $turnList[] = "<option value='{$turnIdx}'>{$turnText}턴</option>";
} }
$turnText = join("\n", $turnList); $turnText = join("\n", $turnList);
return " return "
<select id='chiefTurnSelector' name=turn[] size=6 multiple> <select id='chiefTurnSelector' name=turn[] size=6 multiple>
{$turnText} {$turnText}
</select> </select>
"; ";
} }
function displayiActionObjInfo(?iAction $action) function displayiActionObjInfo(?iAction $action)
{ {
if ($action === null) { if ($action === null) {
$info = ''; $info = '';
$text = '-'; $text = '-';
} else { } else {
$info = $action->getInfo(); $info = $action->getInfo();
$text = $action->getName(); $text = $action->getName();
} }
$templates = new \League\Plates\Engine(__DIR__ . '/templates'); $templates = new \League\Plates\Engine(__DIR__ . '/templates');
return $templates->render('tooltip', [ return $templates->render('tooltip', [
'text' => $text, 'text' => $text,
'info' => $info, 'info' => $info,
]); ]);
} }
function displayCharInfo(string $type): string function displayCharInfo(string $type): string
{ {
$class = buildPersonalityClass($type); $class = buildPersonalityClass($type);
$info = $class->getInfo(); $info = $class->getInfo();
$text = $class->getName(); $text = $class->getName();
$templates = new \League\Plates\Engine(__DIR__ . '/templates'); $templates = new \League\Plates\Engine(__DIR__ . '/templates');
return $templates->render('tooltip', [ return $templates->render('tooltip', [
'text' => $text, 'text' => $text,
'info' => $info, 'info' => $info,
]); ]);
} }
function displaySpecialWarInfo(?string $type): string function displaySpecialWarInfo(?string $type): string
{ {
$class = buildGeneralSpecialWarClass($type); $class = buildGeneralSpecialWarClass($type);
$info = $class->getInfo(); $info = $class->getInfo();
$name = $class->getName(); $name = $class->getName();
$templates = new \League\Plates\Engine(__DIR__ . '/templates'); $templates = new \League\Plates\Engine(__DIR__ . '/templates');
return $templates->render('tooltip', [ return $templates->render('tooltip', [
'text' => $name, 'text' => $name,
'info' => $info, 'info' => $info,
]); ]);
} }
function displaySpecialDomesticInfo(?string $type): string function displaySpecialDomesticInfo(?string $type): string
{ {
$class = buildGeneralSpecialDomesticClass($type); $class = buildGeneralSpecialDomesticClass($type);
$info = $class->getInfo(); $info = $class->getInfo();
$name = $class->getName(); $name = $class->getName();
$templates = new \League\Plates\Engine(__DIR__ . '/templates'); $templates = new \League\Plates\Engine(__DIR__ . '/templates');
return $templates->render('tooltip', [ return $templates->render('tooltip', [
'text' => $name, 'text' => $name,
'info' => $info, 'info' => $info,
]); ]);
} }
function allButton(bool $seizeNPCMode) function allButton(bool $seizeNPCMode)
{ {
if ($seizeNPCMode) { if ($seizeNPCMode) {
$site = "a_npcList.php"; $site = "a_npcList.php";
$call = "빙의일람"; $call = "빙의일람";
} else { } else {
$site = "a_vote.php"; $site = "a_vote.php";
$call = "설문조사"; $call = "설문조사";
} }
if (\file_exists(__DIR__ . "/d_setting/templates/allButton.php")) { if (\file_exists(__DIR__ . "/d_setting/templates/allButton.php")) {
$templates = new \League\Plates\Engine(__DIR__ . '/d_setting/templates'); $templates = new \League\Plates\Engine(__DIR__ . '/d_setting/templates');
} else { } else {
$templates = new \League\Plates\Engine(__DIR__ . '/templates'); $templates = new \League\Plates\Engine(__DIR__ . '/templates');
} }
return $templates->render('allButton', [ return $templates->render('allButton', [
'call' => $call, 'call' => $call,
'site' => $site 'site' => $site
]); ]);
} }
function commandButton() function commandButton()
{ {
$session = Session::getInstance(); $session = Session::getInstance();
$userID = Session::getUserID(); $userID = Session::getUserID();
if (!$session->isGameLoggedIn()) { if (!$session->isGameLoggedIn()) {
return ''; return '';
} }
$db = DB::db(); $db = DB::db();
$me = $db->queryFirstRow("select no,nation,officer_level,belong,permission,penalty from general where owner=%i", $userID); $me = $db->queryFirstRow("select no,nation,officer_level,belong,permission,penalty from general where owner=%i", $userID);
$nation = $db->queryFirstRow("select nation,level,color,secretlimit from nation where nation=%i", $me['nation']) ?? [ $nation = $db->queryFirstRow("select nation,level,color,secretlimit from nation where nation=%i", $me['nation']) ?? [
'nation' => 0, 'nation' => 0,
'level' => 0, 'level' => 0,
'secretlimit' => 99, 'secretlimit' => 99,
'color' => '#000000' 'color' => '#000000'
]; ];
$bgColor = Util::array_get($nation['color']) ?: '#000000'; $bgColor = Util::array_get($nation['color']) ?: '#000000';
$fgColor = newColor($bgColor); $fgColor = newColor($bgColor);
$templates = new \League\Plates\Engine(__DIR__ . '/templates'); $templates = new \League\Plates\Engine(__DIR__ . '/templates');
$showSecret = false; $showSecret = false;
$permission = checkSecretPermission($me); $permission = checkSecretPermission($me);
if ($permission >= 1) { if ($permission >= 1) {
$showSecret = true; $showSecret = true;
} else if ($me['officer_level'] == 0) { } else if ($me['officer_level'] == 0) {
$showSecret = false; $showSecret = false;
} }
return $templates->render('commandButton', [ return $templates->render('commandButton', [
'bgColor' => $bgColor, 'bgColor' => $bgColor,
'fgColor' => $fgColor, 'fgColor' => $fgColor,
'meLevel' => $me['officer_level'], 'meLevel' => $me['officer_level'],
'nationLevel' => $nation['level'], 'nationLevel' => $nation['level'],
'showSecret' => $showSecret, 'showSecret' => $showSecret,
'permission' => $permission, 'permission' => $permission,
]); ]);
} }
function formatWounded(int $value, int $wound): string function formatWounded(int $value, int $wound): string
{ {
if ($wound == 0) { if ($wound == 0) {
return "$value"; return "$value";
} }
$woundedValue = intdiv($value * (100 - $wound), 100); $woundedValue = intdiv($value * (100 - $wound), 100);
return "<font color=red>$woundedValue</font>"; return "<font color=red>$woundedValue</font>";
} }
function formatDefenceTrain(int $value): string function formatDefenceTrain(int $value): string
{ {
if ($value === 999) { if ($value === 999) {
return "×"; return "×";
} else if ($value >= 80) { } else if ($value >= 90){
return ""; return "";
} else { } else if ($value >= 80) {
return ""; return "";
} } else if ($value >= 60) {
} return "○";
} else{
function formatLeadershipBonus(int $value): string return "△";
{ }
if ($value == 0) { }
return '';
} function formatLeadershipBonus(int $value): string
return "<font color=cyan>+{$value}</font>"; {
} if ($value == 0) {
return '';
function formatName(string $name, int $npc): string }
{ return "<font color=cyan>+{$value}</font>";
if ($npc == 1) { }
$name = "<font color='skyblue'>$name</font>";
} else if ($npc > 1) { function formatName(string $name, int $npc): string
$name = "<font color='cyan'>$name</font>"; {
} if ($npc == 1) {
return $name; $name = "<font color='skyblue'>$name</font>";
} } else if ($npc > 1) {
$name = "<font color='cyan'>$name</font>";
function getMapHtml(?string $mapTheme = null) }
{ return $name;
$templates = new \League\Plates\Engine(__DIR__ . '/templates'); }
if ($mapTheme === null) { function getMapHtml(?string $mapTheme = null)
$db = DB::db(); {
$gameStor = KVStorage::getStorage($db, 'game_env'); $templates = new \League\Plates\Engine(__DIR__ . '/templates');
$mapTheme = $gameStor->map_theme ?? 'che';
} if ($mapTheme === null) {
$db = DB::db();
return $templates->render('map', [ $gameStor = KVStorage::getStorage($db, 'game_env');
'mapTheme' => $mapTheme $mapTheme = $gameStor->map_theme ?? 'che';
]); }
}
return $templates->render('map', [
function getInvitationList(array $nationList) 'mapTheme' => $mapTheme
{ ]);
$templates = new \League\Plates\Engine(__DIR__ . '/templates'); }
foreach ($nationList as &$nation) { function getInvitationList(array $nationList)
$nation['textColor'] = newColor($nation['color']); {
} $templates = new \League\Plates\Engine(__DIR__ . '/templates');
return $templates->render('invitationList', [
'nationList' => $nationList foreach ($nationList as &$nation) {
]); $nation['textColor'] = newColor($nation['color']);
} }
return $templates->render('invitationList', [
'nationList' => $nationList
]);
}