diff --git a/hwe/ts/battle_simulator.ts b/hwe/ts/battle_simulator.ts index 08b2ae1c..3b26abd4 100644 --- a/hwe/ts/battle_simulator.ts +++ b/hwe/ts/battle_simulator.ts @@ -893,7 +893,7 @@ $(function ($) { } showBattleResult(result); - }, function (result) { + }, function () { alert('전투 개시 실패!'); }); } @@ -933,7 +933,7 @@ $(function ($) { } reorderDefender(result.order); - }, function (result) { + }, function () { alert('재정렬 실패!'); }); } @@ -968,7 +968,7 @@ $(function ($) { }); - $('#importModal').on('show.bs.modal', function (e) { + $('#importModal').on('show.bs.modal', function () { if (!initGeneralList) { const $list = $('#modalSelector'); diff --git a/hwe/ts/build_exports.json b/hwe/ts/build_exports.json index b0c31118..4f185db8 100644 --- a/hwe/ts/build_exports.json +++ b/hwe/ts/build_exports.json @@ -19,7 +19,6 @@ "currentCity": "currentCity.ts", "hallOfFame": "hallOfFame.ts", "history": "history.ts", - "join": "legacy/join.ts", "select_general_from_pool": "select_general_from_pool.ts", "extKingdoms": "extKingdoms.ts", "common": "common_deprecated.ts" diff --git a/hwe/ts/helpTexts.ts b/hwe/ts/helpTexts.ts index 684d2062..6823c65f 100644 --- a/hwe/ts/helpTexts.ts +++ b/hwe/ts/helpTexts.ts @@ -1,5 +1,4 @@ -import { template } from "lodash"; -import { NationPolicy, NPCChiefActions, NPCGeneralActions } from "./defs"; +import { NPCChiefActions, NPCGeneralActions } from "./defs"; export const NPCPriorityBtnHelpMessage: { [v in NPCChiefActions | NPCGeneralActions]: string; diff --git a/hwe/ts/legacy/join.ts b/hwe/ts/legacy/join.ts deleted file mode 100644 index 21b468bf..00000000 --- a/hwe/ts/legacy/join.ts +++ /dev/null @@ -1,213 +0,0 @@ -import $ from 'jquery'; -import { exportWindow } from '../util/exportWindow'; -import { mb_strwidth } from '../util/mb_strwidth'; -import { unwrap_any } from '../util/unwrap_any'; - -declare const defaultStatTotal: number; -declare const defaultStatMax: number; -declare const defaultStatMin: number; -declare const charInfoText: Record; -$(function ($) { - const $leadership = $('#leadership'); - const $strength = $('#strength'); - const $intel = $('#intel'); - - function abilityRand(): void { - let leadership = Math.random() * 65 + 10; - let strength = Math.random() * 65 + 10; - let intel = Math.random() * 65 + 10; - const rate = leadership + strength + intel; - - leadership = Math.floor(leadership / rate * defaultStatTotal); - strength = Math.floor(strength / rate * defaultStatTotal); - intel = Math.floor(intel / rate * defaultStatTotal); - - - while (leadership + strength + intel < defaultStatTotal) { - leadership += 1; - } - - if (leadership > defaultStatMax || strength > defaultStatMax || intel > defaultStatMax || leadership < defaultStatMin || strength < defaultStatMin || intel < defaultStatMin) { - return abilityRand(); - } - - $leadership.val(leadership); - $strength.val(strength); - $intel.val(intel); - } - - - function abilityLeadpow() { - let leadership = Math.random() * 6; - let strength = Math.random() * 6; - let intel = Math.random() * 1; - const rate = leadership + strength + intel; - - leadership = Math.floor(leadership / rate * defaultStatTotal); - strength = Math.floor(strength / rate * defaultStatTotal); - intel = Math.floor(intel / rate * defaultStatTotal); - - while (leadership + strength + intel < defaultStatTotal) { - strength += 1; - } - - if (intel < defaultStatMin) { - leadership -= defaultStatMin - intel; - intel = defaultStatMin; - } - - if (leadership > defaultStatMax) { - strength += leadership - defaultStatMax; - leadership = defaultStatMax; - } - - if (strength > defaultStatMax) { - leadership += strength - defaultStatMax; - strength = defaultStatMax; - } - - if (leadership > defaultStatMax) { - intel += leadership - defaultStatMax; - leadership = defaultStatMax; - } - - $leadership.val(leadership); - $strength.val(strength); - $intel.val(intel); - } - - function abilityLeadint() { - let leadership = Math.random() * 6; - let strength = Math.random() * 1; - let intel = Math.random() * 6; - const rate = leadership + strength + intel; - - leadership = Math.floor(leadership / rate * defaultStatTotal); - strength = Math.floor(strength / rate * defaultStatTotal); - intel = Math.floor(intel / rate * defaultStatTotal); - - while (leadership + strength + intel < defaultStatTotal) { - intel += 1; - } - - if (strength < defaultStatMin) { - leadership -= defaultStatMin - strength; - strength = defaultStatMin; - } - - if (leadership > defaultStatMax) { - intel += leadership - defaultStatMax; - leadership = defaultStatMax; - } - - if (intel > defaultStatMax) { - leadership += intel - defaultStatMax; - intel = defaultStatMax; - } - - if (leadership > defaultStatMax) { - strength += leadership - defaultStatMax; - leadership = defaultStatMax; - } - - $leadership.val(leadership); - $strength.val(strength); - $intel.val(intel); - } - - function abilityPowint() { - let leadership = Math.random() * 1; - let strength = Math.random() * 6; - let intel = Math.random() * 6; - const rate = leadership + strength + intel; - - leadership = Math.floor(leadership / rate * defaultStatTotal); - strength = Math.floor(strength / rate * defaultStatTotal); - intel = Math.floor(intel / rate * defaultStatTotal); - - while (leadership + strength + intel < defaultStatTotal) { - intel += 1; - } - - if (leadership < defaultStatMin) { - strength -= defaultStatMin - leadership; - leadership = defaultStatMin; - } - - if (strength > defaultStatMax) { - intel += strength - defaultStatMax; - strength = defaultStatMax; - } - - if (intel > defaultStatMax) { - strength += intel - defaultStatMax; - intel = defaultStatMax; - } - - if (strength > defaultStatMax) { - leadership += strength - defaultStatMax; - strength = defaultStatMax; - } - - $leadership.val(leadership); - $strength.val(strength); - $intel.val(intel); - } - - exportWindow(abilityRand, 'abilityRand'); - exportWindow(abilityLeadpow, 'abilityLeadpow'); - exportWindow(abilityLeadint, 'abilityLeadint'); - exportWindow(abilityPowint, 'abilityPowint'); - - const $charInfoText = $('#charInfoText'); - const $selChar = $('#selChar'); - $selChar.change(function () { - const $this = $(this); - const char = unwrap_any($this.val()); - if (char in charInfoText) { - $charInfoText.html(charInfoText[char]); - } - else { - $charInfoText.html(''); - } - }); - - const $generalName = $('#generalName'); - $generalName.on('change keyup paste', function () { - const generalName = unwrap_any($generalName.val()); - const len = mb_strwidth(generalName); - if (len == 0 || len > 18) { - $generalName.css('color', 'red'); - } - else { - $generalName.css('color', 'white'); - } - }); - - $('#join_form').submit(function () { - const generalName = unwrap_any($generalName.val()); - if (mb_strwidth(generalName) > 18) { - alert('장수 이름이 너무 깁니다!'); - return false; - } - const currentStatTotal = parseInt(unwrap_any($leadership.val())) + parseInt(unwrap_any($strength.val())) + parseInt(unwrap_any($intel.val())); - if (currentStatTotal < defaultStatTotal) { - if (!confirm(`현재 능력치 총합은 ${currentStatTotal}으로, ${defaultStatTotal}보다 낮습니다. 그래도 생성할까요?`)) { - return false; - } - } - return true; - }); - - const randomGenType = Math.floor(Math.random() * 7); - if (randomGenType < 3) { - abilityLeadpow(); - } - else if (randomGenType < 6) { - abilityLeadint(); - } - else { - abilityPowint(); - } - -}); \ No newline at end of file diff --git a/hwe/ts/map.ts b/hwe/ts/map.ts index 49f135e9..61cd1ff2 100644 --- a/hwe/ts/map.ts +++ b/hwe/ts/map.ts @@ -516,7 +516,7 @@ export async function reloadWorldMap(option: loadMapOption, drawTarget = '.world //터치스크린 탭 if (!option.neutralView && is_touch_device()) { - $objs.on('touchstart', function (e) { + $objs.on('touchstart', function () { if (window.sam_toggleSingleTap) { return true; } diff --git a/hwe/ts/myPage.ts b/hwe/ts/myPage.ts index 055af084..009dd203 100644 --- a/hwe/ts/myPage.ts +++ b/hwe/ts/myPage.ts @@ -171,6 +171,7 @@ $(function ($) { }); $('#set_my_setting').on('click', async function (e) { + e.preventDefault(); let result: InvalidResponse; try { @@ -186,6 +187,9 @@ $(function ($) { }) }); result = response.data; + if(!result.result){ + throw result.reason; + } } catch (e) { console.log(e); diff --git a/hwe/ts/select_npc.ts b/hwe/ts/select_npc.ts index 210df15c..3b5b3e9a 100644 --- a/hwe/ts/select_npc.ts +++ b/hwe/ts/select_npc.ts @@ -203,7 +203,7 @@ function printGenerals(value: NPCToken) { const time = Date.now() + value.pickMoreSeconds * 1000; $('#btn_pick_more').data('available', time).prop('disabled', true); - const pick = $.map(value.pick, function (value, key) { + const pick = $.map(value.pick, function (value) { return value; });