feat: Vue3로 새롭게 작성한 메인 페이지 (#229)
- v_front.php - API 추가 - General/GetFrontInfo - Global/GetGlobalMenu - DTO 추가 - MenuItem, MenuMulti, MenuSplit - 글로벌 메뉴 출력 방식 변경 - d_setting/GlobalMenu.php Reviewed-on: https://storage.hided.net/gitea/devsam/core/pulls/229
This commit was merged in pull request #229.
This commit is contained in:
+232
-78
@@ -1,96 +1,250 @@
|
||||
import type { CityID, CrewTypeID, GameCityDefault, GameConstType, GameUnitType, GameIActionKey, GameIActionCategory, GameIActionInfo } from "@/defs/GameObj";
|
||||
import type { diplomacyState, MapResult, SimpleNationObj } from "@/defs";
|
||||
import type {
|
||||
CityID,
|
||||
CrewTypeID,
|
||||
GameCityDefault,
|
||||
GameConstType,
|
||||
GameUnitType,
|
||||
GameIActionKey,
|
||||
GameIActionCategory,
|
||||
GameIActionInfo,
|
||||
} from "@/defs/GameObj";
|
||||
import type { diplomacyState, MapResult, NationLevel, SimpleNationObj } from "@/defs";
|
||||
import type { GeneralListItemP0, GeneralListItemP1, NationNotice } from "./Nation";
|
||||
import type { VoteInfo } from "./Vote";
|
||||
|
||||
export interface GetConstResponse {
|
||||
result: true;
|
||||
cacheKey: string;
|
||||
data: {
|
||||
gameConst: GameConstType;
|
||||
gameUnitConst: Record<CrewTypeID, GameUnitType>;
|
||||
cityConst: Record<CityID, GameCityDefault>;
|
||||
cityConstMap: {
|
||||
region: Record<number | string, string | number>;
|
||||
level: Record<number | string, string | number>; //defs.CityLevelText
|
||||
};
|
||||
iActionInfo: Record<
|
||||
GameIActionCategory,
|
||||
Record<
|
||||
GameIActionKey,
|
||||
GameIActionInfo
|
||||
>
|
||||
>;
|
||||
iActionKeyMap: {
|
||||
availableNationType: "nationType";
|
||||
neutralNationType: "nationType";
|
||||
defaultSpecialDomestic: "specialDomestic";
|
||||
availableSpecialDomestic: "specialDomestic";
|
||||
optionalSpecialDomestic: "specialDomestic";
|
||||
defaultSpecialWar: "specialWar";
|
||||
availableSpecialWar: "specialWar";
|
||||
optionalSpecialWar: "specialWar";
|
||||
neutralPersonality: "personality";
|
||||
availablePersonality: "personality";
|
||||
optionalPersonality: "personality";
|
||||
allItems: "item";
|
||||
};
|
||||
result: true;
|
||||
cacheKey: string;
|
||||
data: {
|
||||
gameConst: GameConstType;
|
||||
gameUnitConst: Record<CrewTypeID, GameUnitType>;
|
||||
cityConst: Record<CityID, GameCityDefault>;
|
||||
cityConstMap: {
|
||||
region: Record<number | string, string | number>;
|
||||
level: Record<number | string, string | number>; //defs.CityLevelText
|
||||
};
|
||||
iActionInfo: Record<GameIActionCategory, Record<GameIActionKey, GameIActionInfo>>;
|
||||
iActionKeyMap: {
|
||||
availableNationType: "nationType";
|
||||
neutralNationType: "nationType";
|
||||
defaultSpecialDomestic: "specialDomestic";
|
||||
availableSpecialDomestic: "specialDomestic";
|
||||
optionalSpecialDomestic: "specialDomestic";
|
||||
defaultSpecialWar: "specialWar";
|
||||
availableSpecialWar: "specialWar";
|
||||
optionalSpecialWar: "specialWar";
|
||||
neutralPersonality: "personality";
|
||||
availablePersonality: "personality";
|
||||
optionalPersonality: "personality";
|
||||
allItems: "item";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
export type HistoryObj = {
|
||||
server_id: string,
|
||||
year: number;
|
||||
month: number;
|
||||
map: MapResult,
|
||||
global_history: string[],
|
||||
global_action: string[],
|
||||
nations: {
|
||||
capital: number,
|
||||
cities: string[],
|
||||
color: string,
|
||||
gennum: number,
|
||||
level: number,
|
||||
name: string,
|
||||
nation: number,
|
||||
power: number,
|
||||
type: GameIActionKey
|
||||
}[],
|
||||
}
|
||||
server_id: string;
|
||||
year: number;
|
||||
month: number;
|
||||
map: MapResult;
|
||||
global_history: string[];
|
||||
global_action: string[];
|
||||
nations: {
|
||||
capital: number;
|
||||
cities: string[];
|
||||
color: string;
|
||||
gennum: number;
|
||||
level: number;
|
||||
name: string;
|
||||
nation: number;
|
||||
power: number;
|
||||
type: GameIActionKey;
|
||||
}[];
|
||||
};
|
||||
|
||||
export type GetHistoryResponse = {
|
||||
result: true;
|
||||
data: HistoryObj & {
|
||||
hash: string;
|
||||
//no: number,
|
||||
};
|
||||
}
|
||||
result: true;
|
||||
data: HistoryObj & {
|
||||
hash: string;
|
||||
//no: number,
|
||||
};
|
||||
};
|
||||
|
||||
export type GetCurrentHistoryResponse = {
|
||||
result: true;
|
||||
data: HistoryObj;
|
||||
}
|
||||
|
||||
result: true;
|
||||
data: HistoryObj;
|
||||
};
|
||||
|
||||
export type GetDiplomacyResponse = {
|
||||
result: true;
|
||||
nations: SimpleNationObj[];
|
||||
conflict: [number, Record<number, number>][];
|
||||
diplomacyList: Record<number, Record<number, diplomacyState>>;
|
||||
myNationID: number;
|
||||
}
|
||||
result: true;
|
||||
nations: SimpleNationObj[];
|
||||
conflict: [number, Record<number, number>][];
|
||||
diplomacyList: Record<number, Record<number, diplomacyState>>;
|
||||
myNationID: number;
|
||||
};
|
||||
|
||||
export type ExecuteResponse = {
|
||||
result: true;
|
||||
updated: boolean;
|
||||
locked: boolean;
|
||||
lastExecuted: string;
|
||||
result: true;
|
||||
updated: boolean;
|
||||
locked: boolean;
|
||||
lastExecuted: string;
|
||||
};
|
||||
|
||||
export type GetRecentRecordResponse = {
|
||||
result: true;
|
||||
history: [number, string][];
|
||||
global: [number, string][];
|
||||
general: [number, string][];
|
||||
flushHistory: 1 | 0;
|
||||
flushGlobal: 1 | 0;
|
||||
flushGeneral: 1 | 0;
|
||||
result: true;
|
||||
history: [number, string][];
|
||||
global: [number, string][];
|
||||
general: [number, string][];
|
||||
flushHistory: 1 | 0;
|
||||
flushGlobal: 1 | 0;
|
||||
flushGeneral: 1 | 0;
|
||||
};
|
||||
|
||||
export type AutorunUserMode = "develop" | "warp" | "recruit" | "recruit_high" | "train" | "battle" | "chief";
|
||||
|
||||
export type GetFrontInfoResponse = {
|
||||
result: true;
|
||||
recentRecord: Omit<GetRecentRecordResponse, "result">;
|
||||
global: {
|
||||
scenarioText: string;
|
||||
extendedGeneral: 1 | 0;
|
||||
isFiction: 1 | 0;
|
||||
npcMode: 2 | 1 | 0;
|
||||
joinMode: "onlyRandom" | "full";
|
||||
startyear: number;
|
||||
year: number;
|
||||
month: number;
|
||||
autorunUser: {
|
||||
limit_minutes: number,
|
||||
options: Record<AutorunUserMode, number>,
|
||||
};
|
||||
turnterm: number;
|
||||
lastExecuted: string;
|
||||
lastVoteID: number;
|
||||
develCost: number;
|
||||
noticeMsg: number;
|
||||
onlineNations: string; //TODO: string[]으로 변경
|
||||
onlineUserCnt: number;
|
||||
apiLimit: number;
|
||||
auctionCount: number;
|
||||
isTournamentActive: boolean;
|
||||
isTournamentApplicationOpen: boolean;
|
||||
isBettingActive: boolean;
|
||||
isLocked: boolean;
|
||||
tournamentType: null | 0 | 1 | 2 | 3;
|
||||
tournamentState: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10;
|
||||
tournamentTime: string;
|
||||
genCount: [number, number][];
|
||||
generalCntLimit: number;
|
||||
serverCnt: number;
|
||||
lastVote: VoteInfo | null;
|
||||
};
|
||||
general: GeneralListItemP1 & {
|
||||
permission: number;
|
||||
troopInfo?: {
|
||||
leader: {
|
||||
city: number;
|
||||
reservedCommand: GeneralListItemP1["reservedCommand"];
|
||||
};
|
||||
name: string;
|
||||
};
|
||||
};
|
||||
nation: {
|
||||
id: number;
|
||||
name: string;
|
||||
population: {
|
||||
cityCnt: number;
|
||||
now: number;
|
||||
max: number;
|
||||
};
|
||||
crew: {
|
||||
generalCnt: number;
|
||||
now: number;
|
||||
max: number;
|
||||
};
|
||||
type: {
|
||||
raw: GameIActionKey;
|
||||
name: string;
|
||||
pros: string;
|
||||
cons: string;
|
||||
};
|
||||
color: string;
|
||||
level: NationLevel
|
||||
capital: number;
|
||||
gold: number;
|
||||
rice: number;
|
||||
tech: number;
|
||||
gennum: number;
|
||||
power: number;
|
||||
bill: number;
|
||||
taxRate: number;
|
||||
onlineGen: string;
|
||||
notice: NationNotice;
|
||||
topChiefs: Record<
|
||||
11 | 12,
|
||||
{
|
||||
officer_level: number;
|
||||
no: number;
|
||||
name: string;
|
||||
npc: GeneralListItemP0["npc"];
|
||||
}
|
||||
>;
|
||||
diplomaticLimit: number;
|
||||
strategicCmdLimit: number;
|
||||
impossibleStrategicCommand: [string, number][];
|
||||
prohibitScout: 1 | 0;
|
||||
prohibitWar: 1 | 0;
|
||||
};
|
||||
city: {
|
||||
id: number;
|
||||
name: string;
|
||||
nationInfo: {
|
||||
id: number;
|
||||
name: string;
|
||||
color: string;
|
||||
};
|
||||
level: number;
|
||||
trust: number;
|
||||
pop: [number, number];
|
||||
agri: [number, number];
|
||||
comm: [number, number];
|
||||
secu: [number, number];
|
||||
def: [number, number];
|
||||
wall: [number, number];
|
||||
trade: null | number;
|
||||
officerList: Record<
|
||||
2 | 3 | 4,
|
||||
{
|
||||
officer_level: 2 | 3 | 4;
|
||||
name: string;
|
||||
npc: GeneralListItemP0["npc"];
|
||||
} | null
|
||||
>;
|
||||
};
|
||||
};
|
||||
|
||||
export type MenuItem = {
|
||||
type: 'item';
|
||||
name: string;
|
||||
url: string;
|
||||
icon?: string;
|
||||
newTab?: boolean;
|
||||
condHightlightVar?: string;
|
||||
condShowVar?: string;
|
||||
}
|
||||
|
||||
export type MenuSplit = {
|
||||
type: 'split';
|
||||
main: MenuItem;
|
||||
subMenu: MenuItem[];
|
||||
}
|
||||
|
||||
export type MenuMulti = {
|
||||
type: 'multi';
|
||||
name: string;
|
||||
subMenu: MenuItem[];
|
||||
}
|
||||
|
||||
export type GetMenuResponse = {
|
||||
result: true;
|
||||
menu: (MenuItem | MenuSplit | MenuMulti)[];
|
||||
}
|
||||
@@ -150,12 +150,23 @@ export type LiteNationInfoResponse = ValidResponse & {
|
||||
nation: NationStaticItem;
|
||||
};
|
||||
|
||||
export type NationInfoFull = ValidResponse & {
|
||||
nation: NationItem;
|
||||
isFull: true,
|
||||
impossibleStrategicCommandLists: [string, number][];
|
||||
troops: Record<number, string>;
|
||||
}
|
||||
|
||||
export type NationNotice = {
|
||||
date: string,
|
||||
msg: string,
|
||||
author: string,
|
||||
authorID: number,
|
||||
}
|
||||
|
||||
export type NationInfoResponse =
|
||||
| (ValidResponse & {
|
||||
nation: NationStaticItem;
|
||||
isFull?: false;
|
||||
})
|
||||
| (ValidResponse & {
|
||||
nation: NationItem;
|
||||
impossibleStrategicCommandLists: [string, number][];
|
||||
troops: Record<number, string>;
|
||||
});
|
||||
| NationInfoFull;
|
||||
|
||||
Reference in New Issue
Block a user