diff --git a/hwe/d_setting/GlobalMenu.orig.php b/hwe/d_setting/GlobalMenu.orig.php new file mode 100644 index 00000000..53c203dd --- /dev/null +++ b/hwe/d_setting/GlobalMenu.orig.php @@ -0,0 +1,53 @@ + true, + 'menu' => array_map(function (DTO $dto) { + return $dto->toArray(); + }, GlobalMenu::getMenu()), + ]; + } + public function tryCache(): ?APICacheResult + { + $version = GlobalMenu::version; + return new APICacheResult( + null, + "v{$version}", + 60 * 60 * 6, + true + ); + } +} diff --git a/hwe/sammo/DTO/MenuItem.php b/hwe/sammo/DTO/MenuItem.php new file mode 100644 index 00000000..1c3f1231 --- /dev/null +++ b/hwe/sammo/DTO/MenuItem.php @@ -0,0 +1,26 @@ +type = 'item'; + } +} \ No newline at end of file diff --git a/hwe/sammo/DTO/MenuMulti.php b/hwe/sammo/DTO/MenuMulti.php new file mode 100644 index 00000000..e3275e9a --- /dev/null +++ b/hwe/sammo/DTO/MenuMulti.php @@ -0,0 +1,19 @@ +type = 'multi'; + } +} \ No newline at end of file diff --git a/hwe/sammo/DTO/MenuSplit.php b/hwe/sammo/DTO/MenuSplit.php new file mode 100644 index 00000000..a01df416 --- /dev/null +++ b/hwe/sammo/DTO/MenuSplit.php @@ -0,0 +1,20 @@ +type = 'split'; + } +} \ No newline at end of file diff --git a/hwe/sammo/GlobalMenu.php b/hwe/sammo/GlobalMenu.php new file mode 100644 index 00000000..11c2fa02 --- /dev/null +++ b/hwe/sammo/GlobalMenu.php @@ -0,0 +1,53 @@ +, + GetGlobalMenu: GET as APICallT, }, InheritAction: { BuyHiddenBuff: PUT as APICallT<{ diff --git a/hwe/ts/defs/API/Global.ts b/hwe/ts/defs/API/Global.ts index 4ad0618a..fbc0ff69 100644 --- a/hwe/ts/defs/API/Global.ts +++ b/hwe/ts/defs/API/Global.ts @@ -218,3 +218,29 @@ export type GetFrontInfoResponse = { >; }; }; + +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'; + subMenu: MenuItem[]; +} + +export type GetMenuResponse = { + result: true; + menu: (MenuItem | MenuSplit | MenuMulti)[]; +} \ No newline at end of file