diff --git a/hwe/a_kingdomList.php b/hwe/a_kingdomList.php index 3c3f2e43..0f2c6a25 100644 --- a/hwe/a_kingdomList.php +++ b/hwe/a_kingdomList.php @@ -111,7 +111,7 @@ if ($con >= 2) { } $chief = $chiefs[$chiefLevel] ?? ['name' => '-', 'npc' => 0]; $officerLevelText = getOfficerLevelText($chiefLevel, $nation['level']); - $chiefText = getColoredName($chief['name'], $chief['npc']); + $chiefText = formatName($chief['name'], $chief['npc']); echo "{$officerLevelText} {$chiefText}"; } @@ -178,7 +178,7 @@ if ($con >= 2) { 장수 일람 : "; foreach ($nations[0]['generals'] as $general) { - $generalText = getColoredName($general['name'], $general['npc']); + $generalText = formatName($general['name'], $general['npc']); echo "{$generalText}, "; } echo " diff --git a/hwe/a_npcList.php b/hwe/a_npcList.php index 533e46f8..e226c29c 100644 --- a/hwe/a_npcList.php +++ b/hwe/a_npcList.php @@ -111,7 +111,7 @@ $sel[$type] = "selected"; - + Lv diff --git a/hwe/b_currentCity.php b/hwe/b_currentCity.php index 38d63e50..49458ef1 100644 --- a/hwe/b_currentCity.php +++ b/hwe/b_currentCity.php @@ -364,7 +364,7 @@ $templates = new \League\Plates\Engine('templates'); } $generalsName = array_map(function ($gen) { - return getColoredName($gen['name'], $gen['npc']); + return formatName($gen['name'], $gen['npc']); }, $generals); $enemyCrew = 0; diff --git a/hwe/b_genList.php b/hwe/b_genList.php index 5d8dd06f..1a591fa9 100644 --- a/hwe/b_genList.php +++ b/hwe/b_genList.php @@ -172,7 +172,7 @@ $templates = new \League\Plates\Engine('templates'); $general['expLevelText'] = getExpLevel($general['experience']); - $general['nameText'] = getColoredName($general['name'], $general['npc']); + $general['nameText'] = formatName($general['name'], $general['npc']); $general['modeText'] = formatDefenceTrain($general['defence_train']); $general['crewtypeText'] = GameUnitConst::byId($general['crewtype'])->name ?? '-'; diff --git a/hwe/b_myCityInfo.php b/hwe/b_myCityInfo.php index 864c3173..9022b364 100644 --- a/hwe/b_myCityInfo.php +++ b/hwe/b_myCityInfo.php @@ -71,7 +71,8 @@ $sel = [$type => "selected"]; queryFirstRow('SELECT nation, name, color, type, level, capital, gennum, `power`, `rate` from nation WHERE nation = %i', $nationID); //국가정보 + $nationTypeObj = buildNationTypeClass($nation['type']); $officerList = []; foreach ($db->query('SELECT no,name,npc,city,officer_level,officer_city,belong FROM general WHERE nation = %i AND 2 <= officer_level AND officer_level <= 4', $nationID) as $officer) { @@ -82,6 +83,17 @@ $sel = [$type => "selected"]; $officerList[$officerCityID][$officer['officer_level']] = $officer; } + $generalList = $db->query('SELECT npc, name, city FROM general WHERE nation = %i', $me['nation']); + $cityGeneralList = []; + foreach ($generalList as $general) { + $cityID = $general['city']; + if (!key_exists($cityID, $cityGeneralList)) { + $cityGeneralList[$cityID] = []; + } + + $cityGeneralList[$cityID][] = formatName($general['name'], $general['npc']); + } + $cityList = $db->query('SELECT *,pop/pop_max as poprate from city where nation=%i', $nationID); @@ -171,8 +183,12 @@ $sel = [$type => "selected"]; ]; $cityOfficerList = $officerList[$cityID] ?? []; + $effectiveOfficerCnt = 0; foreach ($cityOfficerList as $cityOfficer) { - $officerName[$cityOfficer['officer_level']] = getColoredName($cityOfficer['name'], $cityOfficer['npc']); + if ($cityOfficer['city'] == $cityID) { + $effectiveOfficerCnt += 1; + } + $officerName[$cityOfficer['officer_level']] = formatName($cityOfficer['name'], $cityOfficer['npc']); } if ($type == 10 && $city['region'] != $region) { @@ -187,62 +203,60 @@ $sel = [$type => "selected"]; $city['trade'] = "- "; } - echo " - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
【 " . CityConst::$regionMap[$city['region']] . " | " . CityConst::$levelMap[$city['level']] . " 】 {$city['name']}
주민{$city['pop']}/{$city['pop_max']}농업{$city['agri']}/{$city['agri_max']}상업{$city['comm']}/{$city['comm_max']}치안{$city['secu']}/{$city['secu_max']}수비{$city['def']}/{$city['def_max']}성벽{$city['wall']}/{$city['wall_max']}
민심" . round($city['trust'], 1) . "시세{$city['trade']}%인구" . round($city['pop'] / $city['pop_max'] * 100, 2) . " %태수"; - echo $officerName[4]; - echo "군사"; - echo $officerName[3]; - echo "종사"; - echo $officerName[2]; - echo "
장수"; - $generalList = $db->query('SELECT npc, name FROM general WHERE city = %i AND nation = %i', $city['city'], $me['nation']); - if (!$generalList) { - echo "-"; - } - foreach ($generalList as $general) { - echo getColoredName($general['name'], $general['npc']) . ', '; - } - echo " -
-"; - } + + $cityGoldIncome = $nation['rate'] / 20 * calcCityGoldIncome($city, $effectiveOfficerCnt, $nation['capital'] == $cityID, $nation['level'], $nationTypeObj); + $cityRiceIncome = $nation['rate'] / 20 * calcCityRiceIncome($city, $effectiveOfficerCnt, $nation['capital'] == $cityID, $nation['level'], $nationTypeObj); + $cityWallIncome = $nation['rate'] / 20 * calcCityWallRiceIncome($city, $effectiveOfficerCnt, $nation['capital'] == $cityID, $nation['level'], $nationTypeObj); + ?> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ | +
주민/인구율%자금 수입군량 수입둔전 수입
농업/상업/치안/수비/성벽/
민심시세%태수군사종사
장수
+ @@ -252,7 +266,7 @@ $sel = [$type => "selected"];
+ - \ No newline at end of file diff --git a/hwe/func.php b/hwe/func.php index 74a29aea..dfbe9057 100644 --- a/hwe/func.php +++ b/hwe/func.php @@ -171,7 +171,7 @@ function cityInfo(General $generalObj) ]; foreach ($db->query('SELECT `officer_level`, `name`, npc, no FROM general WHERE officer_city = %i', $cityID) as $officer) { - $officerName[$officer['officer_level']] = getColoredName($officer['name'], $officer['npc']); + $officerName[$officer['officer_level']] = formatName($officer['name'], $officer['npc']); } $city['officerName'] = $officerName; @@ -199,8 +199,8 @@ function myNationInfo(General $generalObj) $topChiefs = Util::convertArrayToDict($db->query('SELECT officer_level, no, name, npc FROM general WHERE nation = %i AND officer_level >= 11', $nationID), 'officer_level'); - $level12Name = key_exists(12, $topChiefs) ? getColoredName($topChiefs[12]['name'], $topChiefs[12]['npc']) : '-'; - $level11Name = key_exists(11, $topChiefs) ? getColoredName($topChiefs[11]['name'], $topChiefs[11]['npc']) : '-'; + $level12Name = key_exists(12, $topChiefs) ? formatName($topChiefs[12]['name'], $topChiefs[12]['npc']) : '-'; + $level11Name = key_exists(11, $topChiefs) ? formatName($topChiefs[11]['name'], $topChiefs[11]['npc']) : '-'; $impossibleStrategicCommandLists = []; $strategicCommandLists = GameConst::$availableChiefCommand['전략']; diff --git a/hwe/func_converter.php b/hwe/func_converter.php index 568afa49..ad93a95a 100644 --- a/hwe/func_converter.php +++ b/hwe/func_converter.php @@ -692,21 +692,35 @@ function isConsumable(?string $item) : bool{ return $itemClass->isConsumable(); } -function getNameColor(int $npcType):?string{ - if($npcType >= 2){ - return 'cyan'; - } - if($npcType == 1){ +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 getColoredName(string $name, int $npcType):string{ - $color = getNameColor($npcType); + +function formatName(string $name, int $npc): string +{ + $color = getNPCColor($npc); if($color === null){ return $name; } - return "{$name}"; + + return "$name"; } function ConvertLog(?string $str, $type=1) : string { diff --git a/hwe/func_template.php b/hwe/func_template.php index 372c9177..1b89a90b 100644 --- a/hwe/func_template.php +++ b/hwe/func_template.php @@ -231,36 +231,7 @@ function formatLeadershipBonus(int $value): string return "+{$value}"; } -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 -{ - $color = getNPCColor($npc); - if($color === null){ - return $name; - } - - return "$name"; -} function getMapTheme(): string { diff --git a/hwe/sammo/Command/General/che_장수대상임관.php b/hwe/sammo/Command/General/che_장수대상임관.php index 69ba2c56..5b21478e 100644 --- a/hwe/sammo/Command/General/che_장수대상임관.php +++ b/hwe/sammo/Command/General/che_장수대상임관.php @@ -13,7 +13,7 @@ use \sammo\{ }; use function sammo\getAllNationStaticInfo; -use function \sammo\getColoredName; +use function \sammo\formatName; use function \sammo\tryUniqueItemLottery; use function \sammo\getInvitationList; use function \sammo\getNationStaticInfo; diff --git a/hwe/ts/extExpandCity.ts b/hwe/ts/extExpandCity.ts index 03dbf77f..b442b54b 100644 --- a/hwe/ts/extExpandCity.ts +++ b/hwe/ts/extExpandCity.ts @@ -45,6 +45,7 @@ type CityItem = { warn성벽: boolean, $주민: JQuery, + $인구율: JQuery, $농업: JQuery, $상업: JQuery, $치안: JQuery, @@ -294,7 +295,7 @@ $(function () { const loadUser = function () { $.each(cityList, function (idx, val) { if (typeof val.users == "undefined") { - val.obj.append('' + + val.obj.append('
' + '' + '' + '' + @@ -342,8 +343,6 @@ $(function () { if (cityInfo.warn수비) $work.html($work.html().split('수비 강화').join('수비 강화')); if (cityInfo.warn성벽) $work.html($work.html().split('성벽 보수').join('성벽 보수')); - - const $stat = $this.children('.i_stat'); const stat = $stat.text(); @@ -414,9 +413,9 @@ $(function () { } const cityInfo: CityItem = { - 태수:{}, - 군사:{}, - 종사:{}, + 태수: {}, + 군사: {}, + 종사: {}, } as CityItem; //이름 추출 @@ -450,13 +449,13 @@ $(function () { { - const $baseTr = $this.find('tr:eq(1)'); - cityInfo.$주민 = $baseTr.find('td:eq(1)'); - cityInfo.$농업 = $baseTr.find('td:eq(3)'); - cityInfo.$상업 = $baseTr.find('td:eq(5)'); - cityInfo.$치안 = $baseTr.find('td:eq(7)'); - cityInfo.$수비 = $baseTr.find('td:eq(9)'); - cityInfo.$성벽 = $baseTr.find('td:eq(11)'); + cityInfo.$주민 = $this.find('.pop-value'); + cityInfo.$인구율 = $this.find('.pop-prop-value'); + cityInfo.$농업 = $this.find('.agri-value'); + cityInfo.$상업 = $this.find('.comm-value'); + cityInfo.$치안 = $this.find('.secu-value'); + cityInfo.$수비 = $this.find('.def-value'); + cityInfo.$성벽 = $this.find('.wall-value'); let tmpVal; @@ -484,9 +483,18 @@ $(function () { cityInfo.성벽 = parseInt(tmpVal[0]); cityInfo.max성벽 = parseInt(tmpVal[1]); - if (cityInfo.주민 > cityInfo.max주민 * 0.9) { cityInfo.$주민.css('color', 'lightgreen'); } - else if (cityInfo.주민 > cityInfo.max주민 * 0.7) { cityInfo.$주민.css('color', 'yellow'); } - else { cityInfo.$주민.css('color', 'orangered'); } + if (cityInfo.주민 > cityInfo.max주민 * 0.9) { + cityInfo.$주민.css('color', 'lightgreen'); + cityInfo.$인구율.css('color', 'lightgreen'); + } + else if (cityInfo.주민 > cityInfo.max주민 * 0.7) { + cityInfo.$주민.css('color', 'yellow'); + cityInfo.$인구율.css('color', 'yellow'); + } + else { + cityInfo.$주민.css('color', 'orangered'); + cityInfo.$인구율.css('color', 'orangered'); + } if (cityInfo.농업 > cityInfo.max농업 * 0.8) { cityInfo.$농업.css('color', 'lightgreen'); } else if (cityInfo.농업 > cityInfo.max농업 * 0.4) { cityInfo.$농업.css('color', 'yellow'); } @@ -541,16 +549,15 @@ $(function () { //태수,군사,종사 { - const $baseTr = $this.find('tr:eq(2)'); - cityInfo.태수.$obj = $baseTr.find('td:eq(7)'); - cityInfo.군사.$obj = $baseTr.find('td:eq(9)'); - cityInfo.종사.$obj = $baseTr.find('td:eq(11)'); + cityInfo.태수.$obj = $this.find('.officer-4-value'); + cityInfo.군사.$obj = $this.find('.officer-3-value'); + cityInfo.종사.$obj = $this.find('.officer-2-valuet'); } //기타 { - cityInfo.userCnt = $this.find('tr:eq(3) td:eq(1)').text().split(',').length - 1; + cityInfo.userCnt = $this.find('.city-generals').text().split(',').length - 1; } cityInfo.obj = $this; @@ -572,7 +579,7 @@ $(function () { const $sort_more = $('#sort_more'); $sort_more.html('재 정렬 순서 :'); - const sortIt = function(callback: (lhs:CityItem, rhs:CityItem)=>number) { + const sortIt = function (callback: (lhs: CityItem, rhs: CityItem) => number) { let arCity: CityItem[] = []; $('.cityInfo').each(function () { const $this = $(this);
이 름통무지부 대자 금군 량병 종