From 34bc35a6b218e8ffde37cb710c084b957cc55bd5 Mon Sep 17 00:00:00 2001 From: xinian Date: Sun, 5 Apr 2026 06:12:32 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E6=B8=B8=E6=88=8F?= =?UTF-8?q?=E5=8D=8F=E8=AE=AE=E5=85=A5=E7=AB=99=E7=BB=93=E6=9E=84=E4=BD=93?= =?UTF-8?q?=E5=AE=9A=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- logic/controller/inbound_fight.go | 143 ++++++++++++++++++++++ logic/controller/inbound_friend_task.go | 52 ++++++++ logic/controller/inbound_item.go | 87 +++++++++++++ logic/controller/inbound_map_room_nono.go | 100 +++++++++++++++ logic/controller/inbound_pet.go | 89 ++++++++++++++ logic/controller/inbound_user.go | 97 +++++++++++++++ 6 files changed, 568 insertions(+) create mode 100644 logic/controller/inbound_fight.go create mode 100644 logic/controller/inbound_friend_task.go create mode 100644 logic/controller/inbound_item.go create mode 100644 logic/controller/inbound_map_room_nono.go create mode 100644 logic/controller/inbound_pet.go create mode 100644 logic/controller/inbound_user.go diff --git a/logic/controller/inbound_fight.go b/logic/controller/inbound_fight.go new file mode 100644 index 000000000..6c86e85e2 --- /dev/null +++ b/logic/controller/inbound_fight.go @@ -0,0 +1,143 @@ +package controller + +import "blazing/logic/service/common" + +type FightNpcMonsterInboundInfo struct { + Head common.TomeeHeader `cmd:"2408" struc:"skip"` + Number uint32 `fieldDesc:"地图刷新怪物结构体对应的序号 1 - 9 的位置序号" ` +} + +type ChallengeBossInboundInfo struct { + Head common.TomeeHeader `cmd:"2411" struc:"skip"` + BossId uint32 `json:"bossId"` +} + +type ReadyToFightInboundInfo struct { + Head common.TomeeHeader `cmd:"2404" struc:"skip"` +} + +type EscapeFightInboundInfo struct { + Head common.TomeeHeader `cmd:"2410" struc:"skip"` +} + +type StartPetWarInboundInfo struct { + Head common.TomeeHeader `cmd:"2431" struc:"skip"` +} + +type StartTwarInboundInfo struct { + Head common.TomeeHeader `cmd:"2429|2415|2425" struc:"skip"` +} + +type ARENA_SET_OWENR struct { + Head common.TomeeHeader `cmd:"2417" struc:"skip"` +} + +type ARENA_FIGHT_OWENR struct { + Head common.TomeeHeader `cmd:"2418" struc:"skip"` +} + +type ARENA_GET_INFO struct { + Head common.TomeeHeader `cmd:"2419" struc:"skip"` +} + +type ARENA_UPFIGHT struct { + Head common.TomeeHeader `cmd:"2420" struc:"skip"` +} + +type ARENA_OWENR_ACCE struct { + Head common.TomeeHeader `cmd:"2422" struc:"skip"` +} + +type PetKingJoinInboundInfo struct { + Head common.TomeeHeader `cmd:"2413" struc:"skip"` + Type uint32 + FightType uint32 +} + +type PeakQueueCancelInboundInfo struct { + Head common.TomeeHeader `cmd:"2459" struc:"skip"` +} + +type PeakBanPickSubmitInboundInfo struct { + Head common.TomeeHeader `cmd:"2460" struc:"skip"` + + SelectedCatchTimesLen uint32 `struc:"sizeof=SelectedCatchTimes"` + SelectedCatchTimes []uint32 `json:"selectedCatchTimes"` + + BanCatchTimesLen uint32 `struc:"sizeof=BanCatchTimes"` + BanCatchTimes []uint32 `json:"banCatchTimes"` +} + +type HandleFightInviteInboundInfo struct { + Head common.TomeeHeader `cmd:"2403" struc:"skip"` + UserID uint32 `json:"userId" codec:"userId,uint"` + Flag uint32 `json:"flag" codec:"flag,uint"` + Mode uint32 `json:"mode" codec:"mode,uint"` +} + +type InviteToFightInboundInfo struct { + Head common.TomeeHeader `cmd:"2401" struc:"skip"` + UserID uint32 + Mode uint32 +} + +type InviteFightCancelInboundInfo struct { + Head common.TomeeHeader `cmd:"2402" struc:"skip"` +} + +type UseSkillInInfo struct { + Head common.TomeeHeader `cmd:"2405" struc:"skip"` + SkillId uint32 +} + +type UseSkillAtInboundInfo struct { + Head common.TomeeHeader `cmd:"7505" struc:"skip"` + SkillId uint32 `json:"skillId"` + ActorIndex uint8 `json:"actorIndex"` + TargetIndex uint8 `json:"targetIndex"` + TargetRelation uint8 `json:"targetRelation"` + AtkType uint8 `json:"atkType"` +} + +type ChangePetInboundInfo struct { + Head common.TomeeHeader `cmd:"2407" struc:"skip"` + CatchTime uint32 `json:"catchTime"` +} + +type CatchMonsterInboundInfo struct { + Head common.TomeeHeader `cmd:"2409" struc:"skip"` + CapsuleId uint32 `json:"capsuleId" fieldDescription:"胶囊id" uint:"true"` +} + +type LoadPercentInboundInfo struct { + Head common.TomeeHeader `cmd:"2441" struc:"skip"` + Percent uint32 `fieldDescription:"加载百分比"` +} + +type UsePetItemInboundInfo struct { + Head common.TomeeHeader `cmd:"2406" struc:"skip"` + CatchTime uint32 `description:"精灵捕获时间" codec:"catchTime"` + ItemId uint32 `description:"使用的物品ID" codec:"itemId"` + Reversed1 uint32 `description:"填充字段 0" codec:"reversed1"` +} + +type ChatInfo struct { + Head common.TomeeHeader `cmd:"50002" struc:"skip"` + Reserve uint32 `json:"reserve" fieldDescription:"填充 默认值为0" uint:"true"` + MessageLen uint32 `struc:"sizeof=Message"` + Message string `json:"message" fieldDescription:"消息内容, 结束符为utf-8的数字0"` +} + +type C2S_FRESH_CHOICE_FIGHT_LEVEL struct { + Head common.TomeeHeader `cmd:"2428|2414" struc:"skip"` + Level uint `json:"level"` +} + +type C2S_OPEN_DARKPORTAL struct { + Head common.TomeeHeader `cmd:"2424" struc:"skip"` + Level uint32 `json:"level"` +} + +type FRESH_LEAVE_FIGHT_LEVEL struct { + Head common.TomeeHeader `cmd:"2430|2416|2426" struc:"skip"` +} diff --git a/logic/controller/inbound_friend_task.go b/logic/controller/inbound_friend_task.go new file mode 100644 index 000000000..6bfdb4f9a --- /dev/null +++ b/logic/controller/inbound_friend_task.go @@ -0,0 +1,52 @@ +package controller + +import "blazing/logic/service/common" + +type SeeOnlineInboundInfo struct { + Head common.TomeeHeader `cmd:"2157" struc:"skip"` + UserIdsLen uint32 `json:"userIdsLen" struc:"sizeof=UserIds"` + UserIds []uint32 `json:"userIds" ` +} + +type FriendAddInboundInfo struct { + Head common.TomeeHeader `cmd:"2151" struc:"skip"` + UserID uint32 `json:"userID"` +} + +type FriendAnswerInboundInfo struct { + Head common.TomeeHeader `cmd:"2152" struc:"skip"` + UserID uint32 `json:"userID"` + Flag uint32 `json:"flag"` +} + +type FriendRemoveInboundInfo struct { + Head common.TomeeHeader `cmd:"2153" struc:"skip"` + UserID uint32 `json:"userID"` +} + +type AcceptTaskInboundInfo struct { + Head common.TomeeHeader `cmd:"2201|2231" struc:"skip"` + TaskId uint32 `json:"taskId" description:"任务ID"` +} + +type AddTaskBufInboundInfo struct { + Head common.TomeeHeader `cmd:"2204|2235" struc:"skip"` + TaskId uint32 `json:"taskId" description:"任务ID"` + TaskList []uint32 `struc:"[20]byte"` +} + +type CompleteTaskInboundInfo struct { + Head common.TomeeHeader `cmd:"2202|2233" struc:"skip"` + TaskId uint32 `json:"taskId" description:"任务ID"` + OutState uint32 `json:"outState" ` +} + +type GetTaskBufInboundInfo struct { + Head common.TomeeHeader `cmd:"2203|2234" struc:"skip"` + TaskId uint32 `json:"taskId" description:"任务ID"` +} + +type DeleteTaskInboundInfo struct { + Head common.TomeeHeader `cmd:"2205|2232" struc:"skip"` + TaskId uint32 `json:"taskId" description:"任务ID"` +} diff --git a/logic/controller/inbound_item.go b/logic/controller/inbound_item.go new file mode 100644 index 000000000..a41e10a0e --- /dev/null +++ b/logic/controller/inbound_item.go @@ -0,0 +1,87 @@ +package controller + +import "blazing/logic/service/common" + +type BuyInboundInfo struct { + Head common.TomeeHeader `cmd:"2601" struc:"skip"` + ItemId int64 `struc:"uint32"` + Count int64 `struc:"uint32"` +} + +type BuyMultiInboundInfo struct { + Head common.TomeeHeader `cmd:"2606" struc:"skip"` + ItemListLen uint32 `struc:"sizeof=ItemIds"` + ItemIds []uint32 `json:"itemIds" description:"购买的物品ID列表"` +} + +type C2S_GOLD_BUY_PRODUCT struct { + Head common.TomeeHeader `cmd:"1104" struc:"skip"` + Type uint32 `json:"type"` + ProductID uint32 `json:"product_id"` + Count int64 `struc:"uint32"` +} + +type ItemListInboundInfo struct { + Head common.TomeeHeader `cmd:"2605|4475" struc:"skip"` + Param1 uint32 + Param2 uint32 + Param3 uint32 +} + +type GoldOnlineRemainInboundInfo struct { + Head common.TomeeHeader `cmd:"1105|1106" struc:"skip"` +} + +type ExpTotalRemainInboundInfo struct { + Head common.TomeeHeader `cmd:"2319" struc:"skip"` +} + +type ChangePlayerClothInboundInfo struct { + Head common.TomeeHeader `cmd:"2604" struc:"skip"` + ClothesLen uint32 `struc:"sizeof=ClothList" fieldDesc:"穿戴装备的信息" json:"clothes_len"` + ClothList []uint32 `description:"玩家装备列表" codec:"list"` +} + +type TalkCountInboundInfo struct { + Head common.TomeeHeader `cmd:"2701" struc:"skip"` + ID uint32 `description:"奖品的Type, 即ID" codec:"uint"` +} + +type TalkCateInboundInfo struct { + Head common.TomeeHeader `cmd:"2702" struc:"skip"` + ID uint32 `description:"奖品的Type, 即ID" codec:"uint"` +} + +type C2S_USE_PET_ITEM_OUT_OF_FIGHT struct { + Head common.TomeeHeader `cmd:"2326" struc:"skip"` + CatchTime uint32 `json:"catch_time"` + ItemID int32 `struc:"uint32"` +} + +type C2S_PET_RESET_NATURE struct { + Head common.TomeeHeader `cmd:"2343" struc:"skip"` + CatchTime uint32 + Nature uint32 + ItemId uint32 +} + +type C2S_ITEM_SALE struct { + Head common.TomeeHeader `cmd:"2602" struc:"skip"` + ItemId uint32 + Amount uint32 +} + +type C2S_USE_SPEEDUP_ITEM struct { + Head common.TomeeHeader `cmd:"2327" struc:"skip"` + ItemID uint32 +} + +type C2S_USE_ENERGY_XISHOU struct { + Head common.TomeeHeader `cmd:"2331" struc:"skip"` + ItemID uint32 +} + +type C2S_USE_AUTO_FIGHT_ITEM struct { + Head common.TomeeHeader `cmd:"2329" struc:"skip"` + ItemID uint32 +} diff --git a/logic/controller/inbound_map_room_nono.go b/logic/controller/inbound_map_room_nono.go new file mode 100644 index 000000000..a8e7b02dc --- /dev/null +++ b/logic/controller/inbound_map_room_nono.go @@ -0,0 +1,100 @@ +package controller + +import ( + "blazing/logic/service/common" + "blazing/modules/player/model" +) + +type EnterMapInboundInfo struct { + Head common.TomeeHeader `cmd:"2001" struc:"skip"` + MapType uint32 + MapId uint32 + Point model.Pos `fieldDesc:"直接给坐标x,y"` +} + +type GetMapHotInboundInfo struct { + Head common.TomeeHeader `cmd:"1004" struc:"skip"` +} + +type LeaveMapInboundInfo struct { + Head common.TomeeHeader `cmd:"2002" struc:"skip"` +} + +type ListMapPlayerInboundInfo struct { + Head common.TomeeHeader `cmd:"2003" struc:"skip"` +} + +type AttackBossInboundInfo struct { + Head common.TomeeHeader `cmd:"2412" struc:"skip"` +} + +type WalkInInfo struct { + Head common.TomeeHeader `cmd:"2101" struc:"skip"` + Flag uint32 + Point model.Pos `fieldDesc:"直接给坐标x,y"` + PathLen uint32 `struc:"sizeof=Path"` + Path string +} + +type FitmentUseringInboundInfo struct { + Head common.TomeeHeader `cmd:"10006" struc:"skip"` + TargetUserID uint32 `json:"targetUserId"` +} + +type PetRoomListInboundInfo struct { + Head common.TomeeHeader `cmd:"2324" struc:"skip"` + TargetUserID uint32 `json:"targetUserId"` +} + +type FitmentAllInboundEmpty struct { + Head common.TomeeHeader `cmd:"10007" struc:"skip"` +} + +type SET_FITMENT struct { + Head common.TomeeHeader `cmd:"10008" struc:"skip"` + RoomID uint32 `json:"roomID"` + FitmentsLen uint32 `json:"fitmentsLen" struc:"sizeof=Fitments"` + Fitments []model.FitmentShowInfo `json:"usedList"` +} + +type C2S_PetShowList struct { + CatchTime uint32 `json:"catchTime"` + PetID uint32 `json:"petID"` +} + +type C2S_PET_ROOM_SHOW struct { + Head common.TomeeHeader `cmd:"2323" struc:"skip"` + PetShowInfoLen uint32 `json:"PetShowInfoLen" struc:"sizeof=PetShowList"` + PetShowList []C2S_PetShowList `json:"PetShowList"` +} + +type C2S_RoomPetInfo struct { + Head common.TomeeHeader `cmd:"2325" struc:"skip"` + UserID uint32 `json:"userID"` + CatchTime uint32 `json:"catchTime"` +} + +type C2S_BUY_FITMENT struct { + Head common.TomeeHeader `cmd:"10004" struc:"skip"` + ID uint32 `json:"id"` + Count uint32 `json:"count"` +} + +type NonoInboundInfo struct { + Head common.TomeeHeader `cmd:"9003" struc:"skip"` + UserID uint32 +} + +type NonoFollowOrHomeInInfo struct { + Head common.TomeeHeader `cmd:"9019" struc:"skip"` + Flag uint32 `fieldDescription:"1为跟随 0为收回 且如果为收回 那么后续结构不需要发送" uint:"true"` +} + +type SwitchFlyingInboundInfo struct { + Head common.TomeeHeader `cmd:"2112" struc:"skip"` + Type uint32 `description:"开关, 0为取消飞行模式, 大于0为开启飞行模式" codec:"auto" uint:"true"` +} + +type PetCureInboundInfo struct { + Head common.TomeeHeader `cmd:"2306" struc:"skip"` +} diff --git a/logic/controller/inbound_pet.go b/logic/controller/inbound_pet.go new file mode 100644 index 000000000..70e29e369 --- /dev/null +++ b/logic/controller/inbound_pet.go @@ -0,0 +1,89 @@ +package controller + +import "blazing/logic/service/common" + +type GetPetInfoInboundInfo struct { + Head common.TomeeHeader `cmd:"2301" struc:"skip"` + CatchTime uint32 +} + +type GetUserBagPetInfoInboundEmpty struct { + Head common.TomeeHeader `cmd:"4483" struc:"skip"` +} + +type SavePetBagOrderInboundInfo struct { + Head common.TomeeHeader `cmd:"4484" struc:"skip"` + + PetListLen uint32 `struc:"int32,sizeof=PetList"` + PetList []uint32 + BackupPetListLen uint32 `struc:"int32,sizeof=BackupPetList"` + BackupPetList []uint32 +} + +type PetReleaseInboundInfo struct { + Head common.TomeeHeader `cmd:"2304" struc:"skip"` + CatchTime uint32 + Flag uint32 `json:"flag" fieldDescription:"0为放入仓库,1为放入背包" autoCodec:"true" uint:"true"` +} + +type PetShowInboundInfo struct { + Head common.TomeeHeader `cmd:"2305" struc:"skip"` + CatchTime uint32 `codec:"catchTime" inboundMessageType:"Pet_Show"` + Flag uint32 `codec:"flag"` +} + +type PetOneCureInboundInfo struct { + Head common.TomeeHeader `cmd:"2310" struc:"skip"` + CatchTime uint32 `json:"catchTime" fieldDescription:"精灵捕捉时间" uint:"true"` +} + +type PET_ROWEI struct { + Head common.TomeeHeader `cmd:"2321" struc:"skip"` + ID uint32 + CatchTime uint32 `json:"catchTime" fieldDescription:"精灵捕捉时间" uint:"true"` +} + +type PET_RETRIEVE struct { + Head common.TomeeHeader `cmd:"2322" struc:"skip"` + CatchTime uint32 `json:"catchTime" fieldDescription:"精灵捕捉时间" uint:"true"` +} + +type PetDefaultInboundInfo struct { + Head common.TomeeHeader `cmd:"2308" struc:"skip"` + CatchTime uint32 `json:"catchTime" fieldDescription:"精灵捕捉时间" uint:"true" autoCodec:"true" inboundMessageType:"Pet_Default"` +} + +type PetSetExpInboundInfo struct { + Head common.TomeeHeader `cmd:"2318" struc:"skip"` + CatchTime uint32 `fieldDescription:"精灵获取时间" uint:"true" autoCodec:"true"` + Exp int64 `struc:"uint32"` +} + +type PetBargeListInboundInfo struct { + Head common.TomeeHeader `cmd:"2309" struc:"skip"` + StartPetId uint32 `description:"开始精灵id" codec:"startPetId"` + EndPetId uint32 `description:"结束精灵id" codec:"endPetId"` +} + +type ChangeSkillInfo struct { + Head common.TomeeHeader `cmd:"2312" struc:"skip"` + CatchTime uint32 `json:"catchTime"` + Reserved uint32 `json:"reserved"` + Reserved1 uint32 `json:"reserved1"` + HasSkill uint32 `json:"hasSkill"` + ReplaceSkill uint32 `json:"replaceSkill"` +} + +type C2S_Skill_Sort struct { + Head common.TomeeHeader `cmd:"2328" struc:"skip"` + CapTm uint32 `json:"capTm"` + Skill [4]uint32 `json:"skill_1"` +} + +type C2S_PetFusion struct { + Head common.TomeeHeader `cmd:"2351" struc:"skip"` + Mcatchtime uint32 `json:"mcatchtime" msgpack:"mcatchtime"` + Auxcatchtime uint32 `json:"auxcatchtime" msgpack:"auxcatchtime"` + Item1 [4]uint32 `json:"item1" msgpack:"item1"` + GoldItem1 [2]uint32 `json:"gold_item1" msgpack:"gold_item1"` +} diff --git a/logic/controller/inbound_user.go b/logic/controller/inbound_user.go new file mode 100644 index 000000000..accd12855 --- /dev/null +++ b/logic/controller/inbound_user.go @@ -0,0 +1,97 @@ +package controller + +import ( + "blazing/cool" + "blazing/logic/service/common" + "blazing/modules/player/model" + "context" + "encoding/hex" + "fmt" + "hash/crc32" +) + +type MAIN_LOGIN_IN struct { + Head common.TomeeHeader `cmd:"1001" struc:"skip"` + Sid []byte `struc:"[16]byte"` +} + +func (l *MAIN_LOGIN_IN) CheakSession() (bool, uint32) { + t1 := hex.EncodeToString(l.Sid) + r, err := cool.CacheManager.Get(context.Background(), fmt.Sprintf("session:%d", l.Head.UserID)) + if err != nil { + return false, 0 + } + if r.String() != t1 { + return false, 0 + } + crc32Table := crc32.MakeTable(crc32.IEEE) + crcValue := crc32.Checksum([]byte(l.Sid), crc32Table) + cool.CacheManager.Remove(context.Background(), fmt.Sprintf("session:%d", l.Head.UserID)) + return true, crcValue +} + +type SimUserInfoInboundInfo struct { + Head common.TomeeHeader `cmd:"2051" struc:"skip"` + UserId uint32 `fieldDescription:"米米号" uint:"true" codec:"true"` +} + +type MoreUserInfoInboundInfo struct { + Head common.TomeeHeader `cmd:"2052" struc:"skip"` + UserId uint32 `fieldDescription:"米米号" uint:"true" codec:"true"` +} + +type AimatInboundInfo struct { + Head common.TomeeHeader `cmd:"2104" struc:"skip"` + ItemId uint32 `description:"物品id 射击激光 物品id为0" codec:"auto" uint:"true"` + ShootType uint32 `description:"射击类型 未知 给0" codec:"auto" uint:"true"` + Point model.Pos `description:"射击的坐标 x y" codec:"auto"` +} + +type ChatInboundInfo struct { + Head common.TomeeHeader `cmd:"2102" struc:"skip"` + Reserve uint32 `json:"reserve" fieldDescription:"填充 默认值为0" uint:"true"` + MessageLen uint32 `struc:"sizeof=Message"` + Message string `json:"message" fieldDescription:"消息内容, 结束符为utf-8的数字0"` +} + +type ChangeColorInboundInfo struct { + Head common.TomeeHeader `cmd:"2063" struc:"skip"` + Color uint32 `codec:"color"` +} + +type ChangeDoodleInboundInfo struct { + Head common.TomeeHeader `cmd:"2062" struc:"skip"` + Id uint32 `codec:"id"` + Color uint32 `codec:"color"` +} + +type ChangeNONOColorInboundInfo struct { + Head common.TomeeHeader `cmd:"9012" struc:"skip"` + Color uint32 `codec:"color"` +} + +type C2SDanceAction struct { + Head common.TomeeHeader `cmd:"2103" struc:"skip"` + Reserve uint32 `struc:"uint32,big"` + Type uint32 `struc:"uint32,big"` +} + +type C2SPEOPLE_TRANSFROM struct { + Head common.TomeeHeader `cmd:"2111" struc:"skip"` + SuitID uint32 `struc:"uint32,big"` +} + +type ChangePlayerNameInboundInfo struct { + Head common.TomeeHeader `cmd:"2061" struc:"skip"` + Nickname string `struc:"[16]byte"` +} + +type ChangeTitleInboundInfo struct { + Head common.TomeeHeader `cmd:"3404" struc:"skip"` + TileID uint32 +} + +type C2S_GET_GIFT_COMPLETE struct { + Head common.TomeeHeader `cmd:"2801" struc:"skip"` + PassText string `struc:"[16]byte"` +}