game: npc 색상 분리

This commit is contained in:
2022-02-05 07:43:27 +00:00
committed by Gitea
parent d2f6c34e85
commit b5fa2aef91
11 changed files with 67 additions and 97 deletions
+4 -4
View File
@@ -59,10 +59,10 @@ $db = DB::db();
if ($general['block'] > 0) {
$style .= "background-color:red;";
}
if ($general['npc'] >= 2) {
$style .= "color:cyan;";
} elseif ($general['npc'] == 1) {
$style .= "color:skyblue;";
$npcColor = getNPCColor($general['npc']);
if($npcColor !== null){
$style .= "color:{$npcColor};";
}
echo "
+4 -7
View File
@@ -70,13 +70,10 @@ function colorBlockedName($general)
if ($general['block'] > 0) {
$style .= "background-color:red;";
}
if ($general['npc'] >= 2) {
$style .= "color:cyan;";
} elseif ($general['npc'] == 1) {
$style .= "color:skyblue;";
}
if ($general['con'] > $conlimit) {
$style .= "color:red;";
$npcColor = getNPCColor($general['npc']);
if($npcColor !== null){
$style .= "color:{$npcColor};";
}
echo "
+1 -7
View File
@@ -155,13 +155,7 @@ if ($gameStor->isunited) {
if ($general['npc'] >= 2) {
$name = "<font color=cyan>{$general['name']}</font>";
} elseif ($general['npc'] == 1) {
$name = "<font color=skyblue>{$general['name']}</font>";
} else {
$name = "{$general['name']}";
}
$name = formatName($general['name'], $general['npc']);
if (key_exists($general['owner'], $ownerNameList)) {
$name = $name . '<br><small>(' . $ownerNameList[$general['owner']] . ')</small>';
+1 -7
View File
@@ -145,13 +145,7 @@ if ($con >= 2) {
<tr>
<td colspan=8> 장수 일람 : ";
foreach ($generals as $general) {
if ($general['npc'] >= 2) {
echo "<font color=cyan>{$general['name']}</font>, ";
} elseif ($general['npc'] == 1) {
echo "<font color=skyblue>{$general['name']}</font>, ";
} else {
echo "{$general['name']}, ";
}
echo formatName($general['name'], $general['npc']).', ';
}
echo "
</td>
+6 -25
View File
@@ -132,11 +132,8 @@ if ($str3) {
if ($general['name'] == "") {
$general['name'] = "-";
}
if ($general['npc'] >= 2) {
$general['name'] = "<font color=cyan>" . $general['name'] . "</font>";
} elseif ($general['npc'] == 1) {
$general['name'] = "<font color=skyblue>" . $general['name'] . "</font>";
}
$general['name'] = formatName($general['name'], $general['npc']);
echo "<td colspan=16>{$general['name']}</td>";
}
@@ -162,11 +159,7 @@ if ($str3) {
if ($general['name'] == "") {
$general['name'] = "-";
}
if ($general['npc'] >= 2) {
$general['name'] = "<font color=cyan>" . $general['name'] . "</font>";
} elseif ($general['npc'] == 1) {
$general['name'] = "<font color=skyblue>" . $general['name'] . "</font>";
}
$general['name'] = formatName($general['name'], $general['npc']);
if ($general['win'] > 0) {
$line[$i] = "<font color=red>";
$cent[intdiv($i, 2)] = "<font color=red>";
@@ -208,11 +201,7 @@ if ($str3) {
if ($general['name'] == "") {
$general['name'] = "-";
}
if ($general['npc'] >= 2) {
$general['name'] = "<font color=cyan>" . $general['name'] . "</font>";
} elseif ($general['npc'] == 1) {
$general['name'] = "<font color=skyblue>" . $general['name'] . "</font>";
}
$general['name'] = formatName($general['name'], $general['npc']);
if ($general['win'] > 0) {
$line[$i] = "<font color=red>";
$cent[intdiv($i, 2)] = "<font color=red>";
@@ -254,11 +243,7 @@ if ($str3) {
if ($general['name'] == "") {
$general['name'] = "-";
}
if ($general['npc'] >= 2) {
$general['name'] = "<font color=cyan>" . $general['name'] . "</font>";
} elseif ($general['npc'] == 1) {
$general['name'] = "<font color=skyblue>" . $general['name'] . "</font>";
}
$general['name'] = formatName($general['name'], $general['npc']);
if ($general['win'] > 0) {
$line[$i] = "<font color=red>";
$cent[intdiv($i, 2)] = "<font color=red>";
@@ -300,11 +285,7 @@ if ($str3) {
if ($general['name'] == "") {
$general['name'] = "-";
}
if ($general['npc'] >= 2) {
$general['name'] = "<font color=cyan>" . $general['name'] . "</font>";
} elseif ($general['npc'] == 1) {
$general['name'] = "<font color=skyblue>" . $general['name'] . "</font>";
}
$general['name'] = formatName($general['name'], $general['npc']);
if ($general['win'] > 0) {
$line[$i] = "<font color=red>";
$cent[intdiv($i, 2)] = "<font color=red>";
+1 -7
View File
@@ -146,13 +146,7 @@ if ($gameStor->isunited) {
$intel = "{$general['intel']}";
}
if ($general['npc'] >= 2) {
$name = "<font color=cyan>{$general['name']}</font>";
} elseif ($general['npc'] == 1) {
$name = "<font color=skyblue>{$general['name']}</font>";
} else {
$name = "{$general['name']}";
}
$name = formatName($general['name'], $general['npc']);
if (key_exists($general['owner'], $ownerNameList)) {
$name = $name . '<br><small>(' . $ownerNameList[$general['owner']] . ')</small>';
+5 -25
View File
@@ -240,11 +240,7 @@ switch ($admin['tnmt_type']) {
if ($general['name'] == "") {
$general['name'] = "-";
}
if ($general['npc'] >= 2) {
$general['name'] = "<font color=cyan>" . $general['name'] . "</font>";
} elseif ($general['npc'] == 1) {
$general['name'] = "<font color=skyblue>" . $general['name'] . "</font>";
}
$general['name'] = formatName($general['name'], $general['npc']);
echo "<td colspan=16>{$general['name']}</td>";
}
@@ -270,11 +266,7 @@ switch ($admin['tnmt_type']) {
if ($general['name'] == "") {
$general['name'] = "-";
}
if ($general['npc'] >= 2) {
$general['name'] = "<font color=cyan>" . $general['name'] . "</font>";
} elseif ($general['npc'] == 1) {
$general['name'] = "<font color=skyblue>" . $general['name'] . "</font>";
}
$general['name'] = formatName($general['name'], $general['npc']);
if ($general['win'] > 0) {
$line[$i] = "<font color=red>";
$cent[intdiv($i, 2)] = "<font color=red>";
@@ -316,11 +308,7 @@ switch ($admin['tnmt_type']) {
if ($general['name'] == "") {
$general['name'] = "-";
}
if ($general['npc'] >= 2) {
$general['name'] = "<font color=cyan>" . $general['name'] . "</font>";
} elseif ($general['npc'] == 1) {
$general['name'] = "<font color=skyblue>" . $general['name'] . "</font>";
}
$general['name'] = formatName($general['name'], $general['npc']);
if ($general['win'] > 0) {
$line[$i] = "<font color=red>";
$cent[intdiv($i, 2)] = "<font color=red>";
@@ -363,11 +351,7 @@ switch ($admin['tnmt_type']) {
if ($general['name'] == "") {
$general['name'] = "-";
}
if ($general['npc'] >= 2) {
$general['name'] = "<font color=cyan>" . $general['name'] . "</font>";
} elseif ($general['npc'] == 1) {
$general['name'] = "<font color=skyblue>" . $general['name'] . "</font>";
}
$general['name'] = formatName($general['name'], $general['npc']);
if ($general['win'] > 0) {
$line[$i] = "<font color=red>";
$cent[intdiv($i, 2)] = "<font color=red>";
@@ -409,11 +393,7 @@ switch ($admin['tnmt_type']) {
if ($general['name'] == "") {
$general['name'] = "-";
}
if ($general['npc'] >= 2) {
$general['name'] = "<font color=cyan>" . $general['name'] . "</font>";
} elseif ($general['npc'] == 1) {
$general['name'] = "<font color=skyblue>" . $general['name'] . "</font>";
}
$general['name'] = formatName($general['name'], $general['npc']);
if ($general['win'] > 0) {
$line[$i] = "<font color=red>";
$cent[intdiv($i, 2)] = "<font color=red>";
+26 -5
View File
@@ -215,14 +215,35 @@ function formatLeadershipBonus(int $value): string
return "<font color=cyan>+{$value}</font>";
}
function getNPCColor(int $npc): ?string{
if ($npc == 1) {
return 'skyblue';
}
if ($npc == 4){
return 'deepskyblue';
}
if ($npc == 5){
return 'darkcyan';
}
if ($npc == 6){
return 'mediumaquamarine';
}
if ($npc > 1) {
return 'cyan';
}
return null;
}
function formatName(string $name, int $npc): string
{
if ($npc == 1) {
$name = "<font color='skyblue'>$name</font>";
} else if ($npc > 1) {
$name = "<font color='cyan'>$name</font>";
$color = getNPCColor($npc);
if($color === null){
return $name;
}
return $name;
return "<span style='color:{$color}'>$name</span>";
}
function getMapTheme(): string
+2 -4
View File
@@ -261,10 +261,8 @@ function printRow($k, $npc, $name, $abil, $tgame, $win, $draw, $lose, $gd, $gl,
$k += 1;
if ($prmt > 0) {
$name = "<font color=orange>" . $name . "</font>";
} elseif ($npc >= 2) {
$name = "<font color=cyan>" . $name . "</font>";
} elseif ($npc == 1) {
$name = "<font color=skyblue>" . $name . "</font>";
} else if($npc > 0){
$name = formatName($name, $npc);
}
echo "<tr align=center><td class='bg2'>$k</td><td style='font-size:80%;'>$name</td><td>$abil</td><td>$tgame</td><td>$win</td><td>$draw</td><td>$lose</td><td>$gd</td><td>$gl</td></tr>";
}
+10 -1
View File
@@ -79,7 +79,16 @@ function br2nl (text) {
}
*/
export function getNpcColor(npcType: number): 'cyan' | 'skyblue' | null {
export function getNpcColor(npcType: number): 'skyblue' | 'cyan' | 'deepskyblue' | 'darkcyan' | 'mediumaquamarine' | null {
if (npcType == 6){
return 'mediumaquamarine';
}
if (npcType == 5){
return 'darkcyan';
}
if (npcType == 4){
return 'deepskyblue';
}
if (npcType >= 2) {
return 'cyan';
}
+7 -5
View File
@@ -306,10 +306,8 @@ function printGeneralList(value: GeneralListResponse) {
if (general.reserved == 1) {
general.userCSS = 'color:violet';
} else if (general.npc >= 2) {
general.userCSS = 'color:cyan';
} else if (general.npc == 1) {
general.userCSS = 'color:skyblue';
} else if (general.npc > 0) {
general.userCSS = `color:${getNPCColor(general.npc)}`;
}
if (general.ownerName) {
@@ -458,4 +456,8 @@ $(function ($) {
_printGeneralList();
})
});
});
function getNPCColor(npc: number) {
throw new Error('Function not implemented.');
}