feat: 100기 NPC 동조 및 후보 추첨 기능 개선과 초기 능력치 계산 로직 추가
This commit is contained in:
@@ -32,6 +32,9 @@ type CardItem = {
|
||||
leadership?: number,
|
||||
strength?: number,
|
||||
intel?: number,
|
||||
initialLeadership?: number,
|
||||
initialStrength?: number,
|
||||
initialIntel?: number,
|
||||
dex?: number[],
|
||||
}
|
||||
|
||||
@@ -42,7 +45,8 @@ type GeneralPoolResponse = {
|
||||
}
|
||||
|
||||
declare const characterInfo: Record<string, { name: string, info: string }>;
|
||||
declare const hasGeneralID: number;
|
||||
declare const hasGeneralID: number;
|
||||
declare const isCentennialAllStar: boolean;
|
||||
declare let currentGeneralInfo: CardItem | undefined;
|
||||
declare const cards: Record<string, CardItem>;
|
||||
declare const validCustomOption: string[];
|
||||
@@ -51,9 +55,13 @@ const templateGeneralCard = '<div class="general_card">\
|
||||
<h4 class="bg1 with_border"><%generalName%></h4>\
|
||||
<h4><img src="<%iconPath%>" height=64 width=64></h4><p>\
|
||||
<%if(event100Growth){%><b>195년 최종 동조 목표</b><br><%}%>\
|
||||
<%if(leadership){%>\
|
||||
<%leadership%> / <%strength%> / <%intel%><br>\
|
||||
<%}%>\
|
||||
<%if(leadership){%>\
|
||||
<%leadership%> / <%strength%> / <%intel%><br>\
|
||||
<%}%>\
|
||||
<%if(initialLeadership){%>\
|
||||
<b>시작 능력치</b><br>\
|
||||
<%initialLeadership%> / <%initialStrength%> / <%initialIntel%><br>\
|
||||
<%}%>\
|
||||
<%if(personalText){%><%personalText%><br><%}%>\
|
||||
<%if(specialDomesticText||specialWarText){%>\
|
||||
<%specialDomesticText%> / <%specialWarText%><br>\
|
||||
@@ -107,9 +115,12 @@ async function pickGeneral(this: HTMLElement, e: JQuery.Event) {
|
||||
url: 'j_update_picked_general.php',
|
||||
method: 'post',
|
||||
responseType: 'json',
|
||||
data: convertFormData({
|
||||
pick: unwrap_any<string>($btn.val())
|
||||
})
|
||||
data: convertFormData({
|
||||
pick: unwrap_any<string>($btn.val()),
|
||||
picture_source: unwrap_any<string>(
|
||||
$('input[name="reselect_picture_source"]:checked').val() ?? 'selected'
|
||||
)
|
||||
})
|
||||
});
|
||||
result = response.data;
|
||||
if (!result.result) {
|
||||
@@ -138,23 +149,25 @@ async function buildGeneral(e: JQuery.Event) {
|
||||
|
||||
let result: InvalidResponse;
|
||||
try {
|
||||
const response = await axios({
|
||||
url: 'j_select_picked_general.php',
|
||||
method: 'post',
|
||||
responseType: 'json',
|
||||
data: convertFormData({
|
||||
pick: unwrap(currentGeneralInfo).uniqueName,
|
||||
use_own_picture: $('#use_own_picture').is(':checked'),
|
||||
leadership: parseInt(unwrap_any<string>($('#leadership').val())),
|
||||
strength: parseInt(unwrap_any<string>(
|
||||
$(unwrap(currentGeneralInfo).event100Growth ? '#strength' : '#leadership').val()
|
||||
)),
|
||||
intel: parseInt(unwrap_any<string>(
|
||||
$(unwrap(currentGeneralInfo).event100Growth ? '#intel' : '#leadership').val()
|
||||
)),
|
||||
personal: unwrap_any<string>($('#selChar').val())
|
||||
})
|
||||
})
|
||||
const formData: Record<string, string|number|boolean> = {
|
||||
pick: unwrap(currentGeneralInfo).uniqueName,
|
||||
use_own_picture: $('#use_own_picture').is(':checked'),
|
||||
picture_source: unwrap_any<string>(
|
||||
$('input[name="picture_source"]:checked').val() ?? 'selected'
|
||||
),
|
||||
personal: unwrap_any<string>($('#selChar').val())
|
||||
};
|
||||
if (!isCentennialAllStar) {
|
||||
formData.leadership = parseInt(unwrap_any<string>($('#leadership').val()));
|
||||
formData.strength = parseInt(unwrap_any<string>($('#leadership').val()));
|
||||
formData.intel = parseInt(unwrap_any<string>($('#leadership').val()));
|
||||
}
|
||||
const response = await axios({
|
||||
url: 'j_select_picked_general.php',
|
||||
method: 'post',
|
||||
responseType: 'json',
|
||||
data: convertFormData(formData)
|
||||
})
|
||||
result = response.data;
|
||||
if (!result.result) {
|
||||
throw result.reason;
|
||||
@@ -200,9 +213,12 @@ function printGenerals(value: GeneralPoolResponse) {
|
||||
|
||||
const emptyCard = {
|
||||
'leadership': null,
|
||||
'strength': null,
|
||||
'intel': null,
|
||||
'personalText': null,
|
||||
'strength': null,
|
||||
'intel': null,
|
||||
'initialLeadership': null,
|
||||
'initialStrength': null,
|
||||
'initialIntel': null,
|
||||
'personalText': null,
|
||||
'specialDomesticText': null,
|
||||
'specialWarText': null,
|
||||
'dex': null
|
||||
|
||||
Reference in New Issue
Block a user