forked from Wangsheng-Funeral-Parlor/HuTao-GS
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Unlock all cook recipes(CANNOT cook)
GetCompoundData packet need fix
- Loading branch information
Showing
9 changed files
with
170 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import Loader from '$/gameData/loader' | ||
import CookDataGroup, { RecipeData, BonusData } from '@/types/gameData/CookData' | ||
|
||
class CookDataLoader extends Loader { | ||
declare data: CookDataGroup | ||
|
||
constructor() { | ||
super('CookData', []) | ||
} | ||
|
||
async getData(): Promise<CookDataGroup> { | ||
return super.getData() | ||
} | ||
|
||
async getRecipe(id: number): Promise<RecipeData> { | ||
return (await this.getRecipeList()).find(data => data.Id === id) | ||
} | ||
|
||
async getRecipeBonus(recipeId: number): Promise<BonusData[]> { | ||
return (await this.getBonusList()).filter(data => data.RecipeId === recipeId) || [] | ||
} | ||
|
||
async getRecipeList(): Promise<RecipeData[]> { | ||
return (await this.getData())?.Recipe || [] | ||
} | ||
|
||
async getBonusList(): Promise<BonusData[]> { | ||
return (await this.getData())?.Bonus || [] | ||
} | ||
} | ||
|
||
let loader: CookDataLoader | ||
export default (() => loader = loader || new CookDataLoader())() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import Packet, { PacketInterface, PacketContext } from '#/packet' | ||
import { CookRecipeData } from '@/types/proto/CookRecipeData' | ||
import CookData from '$/gameData/data/CookData' | ||
|
||
export interface CookDataNotify { | ||
recipeDataList: CookRecipeData[] | ||
upgrade: number | ||
} | ||
|
||
class CookDataPacket extends Packet implements PacketInterface { | ||
constructor() { | ||
super('CookData') | ||
} | ||
|
||
async sendNotify(context: PacketContext): Promise<void> { | ||
const cookRecipeList = await CookData.getRecipeList() | ||
|
||
const recipeDataList = cookRecipeList.map(recipe => ({ | ||
recipeId: recipe.Id, | ||
proficiency: recipe.MaxProficiency | ||
})) | ||
|
||
const notifyData: CookDataNotify = { | ||
recipeDataList, | ||
upgrade: 3 // what??? | ||
} | ||
|
||
await super.sendNotify(context, notifyData) | ||
} | ||
} | ||
|
||
let packet: CookDataPacket | ||
export default (() => packet = packet || new CookDataPacket())() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import Packet, { PacketInterface, PacketContext } from '#/packet' | ||
|
||
export interface CookGradeDataNotify { | ||
grade: number | ||
} | ||
|
||
class CookGradeDataPacket extends Packet implements PacketInterface { | ||
constructor() { | ||
super('CookGradeData') | ||
} | ||
|
||
async sendNotify(context: PacketContext): Promise<void> { | ||
const notifyData: CookGradeDataNotify = { | ||
grade: 3 // what??? | ||
} | ||
|
||
await super.sendNotify(context, notifyData) | ||
} | ||
} | ||
|
||
let packet: CookGradeDataPacket | ||
export default (() => packet = packet || new CookGradeDataPacket())() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import Packet, { PacketInterface, PacketContext } from '#/packet' | ||
import { CompoundQueueData } from '@/types/proto/CompoundQueueData' | ||
import { RetcodeEnum } from '@/types/proto/enum' | ||
|
||
export interface GetCompoundDataReq { } | ||
|
||
export interface GetCompoundDataRsp { | ||
retcode: RetcodeEnum | ||
unlockCompoundList?: number[] | ||
compoundQueDataList?: CompoundQueueData[] | ||
} | ||
|
||
class GetCompoundDataPacket extends Packet implements PacketInterface { | ||
constructor() { | ||
super('GetCompoundData') | ||
} | ||
|
||
async request(context: PacketContext, data: GetCompoundDataReq): Promise<void> { | ||
await this.response(context, { retcode: RetcodeEnum.RET_UNKNOWN_ERROR }) | ||
} | ||
|
||
async response(context: PacketContext, data: GetCompoundDataRsp): Promise<void> { | ||
await super.response(context, data) | ||
} | ||
} | ||
|
||
let packet: GetCompoundDataPacket | ||
export default (() => packet = packet || new GetCompoundDataPacket())() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
export interface RecipeData { | ||
Id: number // RecipeId | ||
FoodType: string | ||
CookMethod: string | ||
IsDefaultUnlocked: boolean | ||
MaxProficiency: number | ||
QualityOutputVec: { | ||
id?: number | ||
count?: number | ||
}[] | ||
InputVec: { | ||
id?: number | ||
count?: number | ||
}[] | ||
|
||
RankLevel?: number | ||
Icon?: string | ||
NameTextMapHash?: number | ||
DescTextMapHash?: number | ||
EffectDesc?: number[] | ||
QteParam?: string | ||
QteQualityWeightVec?: number[] | ||
} | ||
|
||
export interface BonusData { | ||
RecipeId: number | ||
AvatarId: number | ||
BonusType: string | ||
ParamVec: number[] | ||
ComplexParamVec: number[] | ||
} | ||
|
||
export default interface CookDataGroup { | ||
Recipe: RecipeData[] | ||
Bonus: BonusData[] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export interface CompoundQueueData { | ||
outputCount: number | ||
compoundId: number | ||
outputTime: number | ||
waitCount: number | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export interface CookRecipeData { | ||
proficiency: number | ||
recipeId: number | ||
} |