This commit is contained in:
@@ -26,3 +26,10 @@ kuaipao.ai 充了十块 cjf19970621 cjf19970621
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
fastai.fast 575560454@qq.com 575560454
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -12,27 +12,46 @@
|
||||
## 2. JS 可调用的 Go 函数
|
||||
|
||||
1. `useSkill(skillId: number)`
|
||||
- 作用:指定本回合使用技能
|
||||
- 示例:`useSkill(5001)`
|
||||
|
||||
2. `switchPet(catchTime: number)`
|
||||
- 作用:指定本回合切换精灵
|
||||
- 示例:`switchPet(2)`
|
||||
|
||||
## 3. `hookaction` 参数字段
|
||||
|
||||
基础字段:
|
||||
|
||||
1. `hookaction.hookaction: boolean`
|
||||
- effect 链原始判定
|
||||
2. `hookaction.round: number`
|
||||
- 当前回合数
|
||||
3. `hookaction.is_first: boolean`
|
||||
- 是否先手
|
||||
4. `hookaction.our: { pet_id, catch_time, hp, max_hp } | null`
|
||||
- 我方当前精灵
|
||||
5. `hookaction.opp: { pet_id, catch_time, hp, max_hp } | null`
|
||||
- 对方当前精灵
|
||||
6. `hookaction.skills: Array<{ skill_id, pp, can_use }>`
|
||||
- 我方当前技能快照
|
||||
|
||||
AttackValue 映射字段(重点):
|
||||
|
||||
1. `hookaction.our_attack`
|
||||
2. `hookaction.opp_attack`
|
||||
|
||||
结构:
|
||||
|
||||
```ts
|
||||
{
|
||||
skill_id: number;
|
||||
attack_time: number;
|
||||
is_critical: number;
|
||||
lost_hp: number;
|
||||
gain_hp: number;
|
||||
remain_hp: number;
|
||||
max_hp: number;
|
||||
state: number;
|
||||
offensive: number;
|
||||
status: number[]; // 对应 AttackValue.Status[20]
|
||||
prop: number[]; // 对应 AttackValue.Prop[6]
|
||||
}
|
||||
```
|
||||
|
||||
其中:
|
||||
|
||||
- `prop` 索引:`[攻, 防, 特攻, 特防, 速度, 命中]`
|
||||
- 对应值 `> 0` 代表强化,`< 0` 代表下降,`0` 代表无变化
|
||||
|
||||
返回值:
|
||||
|
||||
@@ -42,50 +61,55 @@
|
||||
|
||||
## 4. 脚本示例
|
||||
|
||||
### 4.1 第3回合固定放技能
|
||||
### 4.1 判断对方是否存在强化(你问的这个)
|
||||
|
||||
```js
|
||||
function hookAction(hookaction) {
|
||||
if (!hookaction.hookaction) return false;
|
||||
|
||||
if (hookaction.round === 3) {
|
||||
useSkill(5001);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
```
|
||||
|
||||
### 4.2 低血切宠
|
||||
|
||||
```js
|
||||
function hookAction(hookaction) {
|
||||
if (!hookaction.hookaction) return false;
|
||||
if (!hookaction.our) return true;
|
||||
|
||||
var hpRate = hookaction.our.max_hp > 0 ? hookaction.our.hp / hookaction.our.max_hp : 1;
|
||||
if (hpRate < 0.3) {
|
||||
switchPet(2);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
```
|
||||
|
||||
### 4.3 读取技能可用性后出招
|
||||
|
||||
```js
|
||||
function hookAction(hookaction) {
|
||||
if (!hookaction.hookaction) return false;
|
||||
|
||||
for (var i = 0; i < hookaction.skills.length; i++) {
|
||||
var s = hookaction.skills[i];
|
||||
if (s.can_use && s.skill_id === 5001) {
|
||||
useSkill(s.skill_id);
|
||||
break;
|
||||
var oppAtk = hookaction.opp_attack;
|
||||
var oppHasBuff = false;
|
||||
if (oppAtk && oppAtk.prop) {
|
||||
for (var i = 0; i < oppAtk.prop.length; i++) {
|
||||
if (oppAtk.prop[i] > 0) {
|
||||
oppHasBuff = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (oppHasBuff) {
|
||||
// 对方有强化时,放一个针对技能
|
||||
useSkill(5001);
|
||||
return true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
```
|
||||
|
||||
### 4.2 判断对方是否有异常状态
|
||||
|
||||
```js
|
||||
function hookAction(hookaction) {
|
||||
if (!hookaction.hookaction) return false;
|
||||
|
||||
var oppAtk = hookaction.opp_attack;
|
||||
var hasStatus = false;
|
||||
if (oppAtk && oppAtk.status) {
|
||||
for (var i = 0; i < oppAtk.status.length; i++) {
|
||||
if (oppAtk.status[i] > 0) {
|
||||
hasStatus = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!hasStatus) {
|
||||
// 没有异常时尝试上异常
|
||||
useSkill(6002);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
```
|
||||
@@ -116,6 +140,20 @@ interface BossHookSkillContext {
|
||||
can_use: boolean;
|
||||
}
|
||||
|
||||
interface BossHookAttackContext {
|
||||
skill_id: number;
|
||||
attack_time: number;
|
||||
is_critical: number;
|
||||
lost_hp: number;
|
||||
gain_hp: number;
|
||||
remain_hp: number;
|
||||
max_hp: number;
|
||||
state: number;
|
||||
offensive: number;
|
||||
status: number[];
|
||||
prop: number[];
|
||||
}
|
||||
|
||||
interface BossHookActionContext {
|
||||
hookaction: boolean;
|
||||
round: number;
|
||||
@@ -123,6 +161,8 @@ interface BossHookActionContext {
|
||||
our: BossHookPetContext | null;
|
||||
opp: BossHookPetContext | null;
|
||||
skills: BossHookSkillContext[];
|
||||
our_attack: BossHookAttackContext | null;
|
||||
opp_attack: BossHookAttackContext | null;
|
||||
}
|
||||
|
||||
declare function hookAction(hookaction: BossHookActionContext): boolean;
|
||||
@@ -136,38 +176,8 @@ declare function switchPet(catchTime: number): void;
|
||||
);
|
||||
```
|
||||
|
||||
## 6. Monaco 补全(可选)
|
||||
|
||||
```ts
|
||||
monaco.languages.registerCompletionItemProvider("javascript", {
|
||||
provideCompletionItems() {
|
||||
return {
|
||||
suggestions: [
|
||||
{
|
||||
label: "boss hookAction",
|
||||
kind: monaco.languages.CompletionItemKind.Snippet,
|
||||
insertTextRules:
|
||||
monaco.languages.CompletionItemInsertTextRule.InsertAsSnippet,
|
||||
insertText: [
|
||||
"function hookAction(hookaction) {",
|
||||
" if (!hookaction.hookaction) return false;",
|
||||
" if (hookaction.round >= 3) useSkill(5001);",
|
||||
" return true;",
|
||||
"}",
|
||||
].join("\\n"),
|
||||
documentation: "Boss脚本模板:可读取回合/血量并调用 useSkill/switchPet。",
|
||||
},
|
||||
],
|
||||
};
|
||||
},
|
||||
});
|
||||
```
|
||||
|
||||
## 7. 后端代码
|
||||
## 6. 后端代码
|
||||
|
||||
- 脚本执行器与函数绑定:`modules/config/model/boss_pet.go`
|
||||
- AI 出手转发:`logic/service/fight/input/ai.go`
|
||||
- BOSS 脚本注入:
|
||||
- `logic/controller/fight_boss野怪和地图怪.go`
|
||||
- `logic/controller/fight_塔.go`
|
||||
- AI 出手转发与上下文构建:`logic/service/fight/input/ai.go`
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ import (
|
||||
"github.com/lunixbochs/struc"
|
||||
)
|
||||
|
||||
// Maincontroller 是控制器层共享变量。
|
||||
var Maincontroller = &Controller{} //注入service
|
||||
|
||||
// Controller 分发cmd逻辑实现
|
||||
|
||||
@@ -43,6 +43,7 @@ var masterCupRequiredItems = map[uint32][]ItemS{
|
||||
},
|
||||
}
|
||||
|
||||
// DASHIbei 处理控制器请求。
|
||||
func (h Controller) DASHIbei(req *C2s_MASTER_REWARDS, c *player.Player) (result *S2C_MASTER_REWARDS, err errorcode.ErrorCode) {
|
||||
_ = req
|
||||
result = &S2C_MASTER_REWARDS{}
|
||||
@@ -52,6 +53,7 @@ func (h Controller) DASHIbei(req *C2s_MASTER_REWARDS, c *player.Player) (result
|
||||
return
|
||||
}
|
||||
|
||||
// DASHIbeiR 处理控制器请求。
|
||||
func (h Controller) DASHIbeiR(req *C2s_MASTER_REWARDSR, c *player.Player) (result *S2C_MASTER_REWARDSR, err errorcode.ErrorCode) {
|
||||
result = &S2C_MASTER_REWARDSR{}
|
||||
|
||||
@@ -94,6 +96,7 @@ func (h Controller) DASHIbeiR(req *C2s_MASTER_REWARDSR, c *player.Player) (resul
|
||||
return
|
||||
}
|
||||
|
||||
// ItemS 定义请求或响应数据结构。
|
||||
type ItemS struct {
|
||||
ItemId uint32
|
||||
ItemCnt uint32
|
||||
@@ -137,6 +140,7 @@ func appendMasterCupRewardItems(c *player.Player, result *S2C_MASTER_REWARDSR, i
|
||||
}
|
||||
}
|
||||
|
||||
// C2s_MASTER_REWARDS 定义请求或响应数据结构。
|
||||
type C2s_MASTER_REWARDS struct {
|
||||
Head common.TomeeHeader `cmd:"2611" struc:"skip"` //玩家登录
|
||||
}
|
||||
@@ -147,6 +151,7 @@ type S2C_MASTER_REWARDS struct {
|
||||
Reward []uint32 `json:"Reward"`
|
||||
}
|
||||
|
||||
// C2s_MASTER_REWARDSR 定义请求或响应数据结构。
|
||||
type C2s_MASTER_REWARDSR struct {
|
||||
Head common.TomeeHeader `cmd:"2612" struc:"skip"` //玩家登录
|
||||
ElementType uint32
|
||||
|
||||
@@ -12,6 +12,7 @@ import (
|
||||
"github.com/gogf/gf/v2/util/grand"
|
||||
)
|
||||
|
||||
// EggGamePlay 处理控制器请求。
|
||||
func (h Controller) EggGamePlay(data1 *C2S_EGG_GAME_PLAY, c *player.Player) (result *S2C_EGG_GAME_PLAY, err errorcode.ErrorCode) {
|
||||
|
||||
switch data1.EggNum {
|
||||
|
||||
@@ -37,6 +37,7 @@ func Draw15To10WithBitSet() uint32 {
|
||||
return resultBits
|
||||
}
|
||||
|
||||
// GET_XUANCAI 处理控制器请求。
|
||||
func (h Controller) GET_XUANCAI(data *C2s_GET_XUANCAI, c *player.Player) (result *S2C_GET_XUANCAI, err errorcode.ErrorCode) {
|
||||
result = &S2C_GET_XUANCAI{}
|
||||
selectedCount := 0 // 已选中的数量
|
||||
@@ -74,6 +75,7 @@ func (h Controller) GET_XUANCAI(data *C2s_GET_XUANCAI, c *player.Player) (result
|
||||
|
||||
}
|
||||
|
||||
// C2s_GET_XUANCAI 定义请求或响应数据结构。
|
||||
type C2s_GET_XUANCAI struct {
|
||||
Head common.TomeeHeader `cmd:"60001" struc:"skip"` //玩家登录
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ func (h Controller) TimeMap(data *C2s_SP, c *player.Player) (result *S2C_SP, err
|
||||
|
||||
}
|
||||
|
||||
// C2s_SP 定义请求或响应数据结构。
|
||||
type C2s_SP struct {
|
||||
Head common.TomeeHeader `cmd:"60002" struc:"skip"` //超时空地图
|
||||
}
|
||||
@@ -40,6 +41,7 @@ type S2C_SP struct {
|
||||
MapList []ServerInfo
|
||||
}
|
||||
|
||||
// ServerInfo 定义请求或响应数据结构。
|
||||
type ServerInfo struct {
|
||||
ID uint32 //地图ID
|
||||
PetLen uint32 `struc:"sizeof=Pet"`
|
||||
|
||||
@@ -7,6 +7,7 @@ import (
|
||||
"blazing/logic/service/player"
|
||||
)
|
||||
|
||||
// GetLeiyiTrainStatus 处理控制器请求。
|
||||
func (h Controller) GetLeiyiTrainStatus(data *C2s_LEIYI_TRAIN_GET_STATUS, c *player.Player) (result *S2C_LEIYI_TRAIN_GET_STATUS, err errorcode.ErrorCode) {
|
||||
result = &S2C_LEIYI_TRAIN_GET_STATUS{}
|
||||
|
||||
@@ -19,6 +20,7 @@ func (h Controller) GetLeiyiTrainStatus(data *C2s_LEIYI_TRAIN_GET_STATUS, c *pla
|
||||
|
||||
}
|
||||
|
||||
// C2s_LEIYI_TRAIN_GET_STATUS 定义请求或响应数据结构。
|
||||
type C2s_LEIYI_TRAIN_GET_STATUS struct {
|
||||
Head common.TomeeHeader `cmd:"2393" struc:"skip"` //玩家登录
|
||||
}
|
||||
@@ -28,6 +30,7 @@ type S2C_LEIYI_TRAIN_GET_STATUS struct {
|
||||
Status [10]S2C_LEIYI_TRAIN_GET_STATUS_info `json:"status"`
|
||||
}
|
||||
|
||||
// S2C_LEIYI_TRAIN_GET_STATUS_info 定义请求或响应数据结构。
|
||||
type S2C_LEIYI_TRAIN_GET_STATUS_info struct {
|
||||
// Today uint32 // 今日训练HP次数
|
||||
Current uint32 // 当前训练HP次数
|
||||
|
||||
@@ -35,6 +35,7 @@ func (h Controller) HanLiuQiang(data *C2S_2608, c *player.Player) (result *fight
|
||||
return result, -1
|
||||
}
|
||||
|
||||
// C2S_2608 定义请求或响应数据结构。
|
||||
type C2S_2608 struct {
|
||||
Head common.TomeeHeader `cmd:"2608" struc:"skip"`
|
||||
}
|
||||
|
||||
@@ -70,9 +70,12 @@ func (h Controller) PetMelee(data *StartPetWarInboundInfo, c *player.Player) (re
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// PetKing 处理控制器请求。
|
||||
func (h Controller) PetKing(data *PetKingJoinInboundInfo, c *player.Player) (result *fight.NullOutboundInfo, err errorcode.ErrorCode) {
|
||||
|
||||
c.Fightinfo.Status = info.BattleMode.PET_TOPLEVEL
|
||||
// ElementTypeNumbers 是控制器层共享变量。
|
||||
var ElementTypeNumbers = []int{1, 2, 3, 5, 11, 4, 6, 7, 9}
|
||||
|
||||
switch data.Type {
|
||||
|
||||
@@ -82,6 +82,7 @@ func (h Controller) FreshChoiceFightLevel(data *C2S_FRESH_CHOICE_FIGHT_LEVEL, c
|
||||
return result, 0
|
||||
}
|
||||
|
||||
// FreshLeaveFightLevel 处理控制器请求。
|
||||
func (h Controller) FreshLeaveFightLevel(data *FRESH_LEAVE_FIGHT_LEVEL, c *player.Player) (result *fight.NullOutboundInfo, err errorcode.ErrorCode) {
|
||||
_ = data
|
||||
defer c.GetSpace().EnterMap(c)
|
||||
@@ -92,6 +93,7 @@ func (h Controller) FreshLeaveFightLevel(data *FRESH_LEAVE_FIGHT_LEVEL, c *playe
|
||||
return result, 0
|
||||
}
|
||||
|
||||
// PetTawor 处理控制器请求。
|
||||
func (h Controller) PetTawor(data *StartTwarInboundInfo, c *player.Player) (result *fight.S2C_ChoiceLevelRequestInfo, err errorcode.ErrorCode) {
|
||||
if err = c.CanFight(); err != 0 {
|
||||
return nil, err
|
||||
|
||||
@@ -15,6 +15,7 @@ type PetTOPLEVELnboundInfo struct {
|
||||
|
||||
}
|
||||
|
||||
// JoINtop 处理控制器请求。
|
||||
func (h Controller) JoINtop(data *PetTOPLEVELnboundInfo, c *player.Player) (result *fight.NullOutboundInfo, err errorcode.ErrorCode) {
|
||||
err = pvp.JoinPeakQueue(c, data.Mode)
|
||||
if err != 0 {
|
||||
@@ -23,11 +24,13 @@ func (h Controller) JoINtop(data *PetTOPLEVELnboundInfo, c *player.Player) (resu
|
||||
return nil, -1
|
||||
}
|
||||
|
||||
// CancelPeakQueue 处理控制器请求。
|
||||
func (h Controller) CancelPeakQueue(data *PeakQueueCancelInboundInfo, c *player.Player) (result *fight.NullOutboundInfo, err errorcode.ErrorCode) {
|
||||
pvp.CancelPeakQueue(c)
|
||||
return nil, -1
|
||||
}
|
||||
|
||||
// SubmitPeakBanPick 处理控制器请求。
|
||||
func (h Controller) SubmitPeakBanPick(data *PeakBanPickSubmitInboundInfo, c *player.Player) (result *fight.NullOutboundInfo, err errorcode.ErrorCode) {
|
||||
err = pvp.SubmitBanPick(c, data.SelectedCatchTimes, data.BanCatchTimes)
|
||||
if err != 0 {
|
||||
|
||||
@@ -12,6 +12,7 @@ import (
|
||||
"blazing/logic/service/space"
|
||||
)
|
||||
|
||||
// ARENA_SET_OWENR 定义请求或响应数据结构。
|
||||
type ARENA_SET_OWENR struct {
|
||||
Head common.TomeeHeader `cmd:"2417" struc:"skip"`
|
||||
}
|
||||
@@ -35,6 +36,7 @@ func (h Controller) ArenaSetOwner(data *ARENA_SET_OWENR, c *player.Player) (resu
|
||||
return nil, errorcode.ErrorCodes.ErrChampionExists
|
||||
}
|
||||
|
||||
// ARENA_FIGHT_OWENR 定义请求或响应数据结构。
|
||||
type ARENA_FIGHT_OWENR struct {
|
||||
Head common.TomeeHeader `cmd:"2418" struc:"skip"`
|
||||
}
|
||||
|
||||
@@ -2,56 +2,66 @@ package controller
|
||||
|
||||
import "blazing/logic/service/common"
|
||||
|
||||
// FightNpcMonsterInboundInfo 定义请求或响应数据结构。
|
||||
type FightNpcMonsterInboundInfo struct {
|
||||
Head common.TomeeHeader `cmd:"2408" struc:"skip"`
|
||||
Number uint32 `fieldDesc:"地图刷新怪物结构体对应的序号 1 - 9 的位置序号" `
|
||||
}
|
||||
|
||||
// ChallengeBossInboundInfo 定义请求或响应数据结构。
|
||||
type ChallengeBossInboundInfo struct {
|
||||
Head common.TomeeHeader `cmd:"2411" struc:"skip"`
|
||||
BossId uint32 `json:"bossId"`
|
||||
}
|
||||
|
||||
// ReadyToFightInboundInfo 定义请求或响应数据结构。
|
||||
type ReadyToFightInboundInfo struct {
|
||||
Head common.TomeeHeader `cmd:"2404" struc:"skip"`
|
||||
}
|
||||
|
||||
// EscapeFightInboundInfo 定义请求或响应数据结构。
|
||||
type EscapeFightInboundInfo struct {
|
||||
Head common.TomeeHeader `cmd:"2410" struc:"skip"`
|
||||
}
|
||||
|
||||
// StartPetWarInboundInfo 定义请求或响应数据结构。
|
||||
type StartPetWarInboundInfo struct {
|
||||
Head common.TomeeHeader `cmd:"2431" struc:"skip"`
|
||||
}
|
||||
|
||||
// StartTwarInboundInfo 定义请求或响应数据结构。
|
||||
type StartTwarInboundInfo struct {
|
||||
Head common.TomeeHeader `cmd:"2429|2415|2425" struc:"skip"`
|
||||
}
|
||||
|
||||
|
||||
|
||||
// ARENA_GET_INFO 定义请求或响应数据结构。
|
||||
type ARENA_GET_INFO struct {
|
||||
Head common.TomeeHeader `cmd:"2419" struc:"skip"`
|
||||
}
|
||||
|
||||
// ARENA_UPFIGHT 定义请求或响应数据结构。
|
||||
type ARENA_UPFIGHT struct {
|
||||
Head common.TomeeHeader `cmd:"2420" struc:"skip"`
|
||||
}
|
||||
|
||||
// ARENA_OWENR_ACCE 定义请求或响应数据结构。
|
||||
type ARENA_OWENR_ACCE struct {
|
||||
Head common.TomeeHeader `cmd:"2422" struc:"skip"`
|
||||
}
|
||||
|
||||
// PetKingJoinInboundInfo 定义请求或响应数据结构。
|
||||
type PetKingJoinInboundInfo struct {
|
||||
Head common.TomeeHeader `cmd:"2413" struc:"skip"`
|
||||
Type uint32
|
||||
FightType uint32
|
||||
}
|
||||
|
||||
// PeakQueueCancelInboundInfo 定义请求或响应数据结构。
|
||||
type PeakQueueCancelInboundInfo struct {
|
||||
Head common.TomeeHeader `cmd:"2459" struc:"skip"`
|
||||
}
|
||||
|
||||
// PeakBanPickSubmitInboundInfo 定义请求或响应数据结构。
|
||||
type PeakBanPickSubmitInboundInfo struct {
|
||||
Head common.TomeeHeader `cmd:"2460" struc:"skip"`
|
||||
|
||||
@@ -62,6 +72,7 @@ type PeakBanPickSubmitInboundInfo struct {
|
||||
BanCatchTimes []uint32 `json:"banCatchTimes"`
|
||||
}
|
||||
|
||||
// HandleFightInviteInboundInfo 定义请求或响应数据结构。
|
||||
type HandleFightInviteInboundInfo struct {
|
||||
Head common.TomeeHeader `cmd:"2403" struc:"skip"`
|
||||
UserID uint32 `json:"userId" codec:"userId,uint"`
|
||||
@@ -69,21 +80,25 @@ type HandleFightInviteInboundInfo struct {
|
||||
Mode uint32 `json:"mode" codec:"mode,uint"`
|
||||
}
|
||||
|
||||
// InviteToFightInboundInfo 定义请求或响应数据结构。
|
||||
type InviteToFightInboundInfo struct {
|
||||
Head common.TomeeHeader `cmd:"2401" struc:"skip"`
|
||||
UserID uint32
|
||||
Mode uint32
|
||||
}
|
||||
|
||||
// InviteFightCancelInboundInfo 定义请求或响应数据结构。
|
||||
type InviteFightCancelInboundInfo struct {
|
||||
Head common.TomeeHeader `cmd:"2402" struc:"skip"`
|
||||
}
|
||||
|
||||
// UseSkillInInfo 定义请求或响应数据结构。
|
||||
type UseSkillInInfo struct {
|
||||
Head common.TomeeHeader `cmd:"2405" struc:"skip"`
|
||||
SkillId uint32
|
||||
}
|
||||
|
||||
// UseSkillAtInboundInfo 定义请求或响应数据结构。
|
||||
type UseSkillAtInboundInfo struct {
|
||||
Head common.TomeeHeader `cmd:"7505" struc:"skip"`
|
||||
SkillId uint32 `json:"skillId"`
|
||||
@@ -93,21 +108,25 @@ type UseSkillAtInboundInfo struct {
|
||||
AtkType uint8 `json:"atkType"`
|
||||
}
|
||||
|
||||
// ChangePetInboundInfo 定义请求或响应数据结构。
|
||||
type ChangePetInboundInfo struct {
|
||||
Head common.TomeeHeader `cmd:"2407" struc:"skip"`
|
||||
CatchTime uint32 `json:"catchTime"`
|
||||
}
|
||||
|
||||
// CatchMonsterInboundInfo 定义请求或响应数据结构。
|
||||
type CatchMonsterInboundInfo struct {
|
||||
Head common.TomeeHeader `cmd:"2409" struc:"skip"`
|
||||
CapsuleId uint32 `json:"capsuleId" fieldDescription:"胶囊id" uint:"true"`
|
||||
}
|
||||
|
||||
// LoadPercentInboundInfo 定义请求或响应数据结构。
|
||||
type LoadPercentInboundInfo struct {
|
||||
Head common.TomeeHeader `cmd:"2441" struc:"skip"`
|
||||
Percent uint32 `fieldDescription:"加载百分比"`
|
||||
}
|
||||
|
||||
// UsePetItemInboundInfo 定义请求或响应数据结构。
|
||||
type UsePetItemInboundInfo struct {
|
||||
Head common.TomeeHeader `cmd:"2406" struc:"skip"`
|
||||
CatchTime uint32 `description:"精灵捕获时间" codec:"catchTime"`
|
||||
@@ -115,6 +134,7 @@ type UsePetItemInboundInfo struct {
|
||||
Reversed1 uint32 `description:"填充字段 0" codec:"reversed1"`
|
||||
}
|
||||
|
||||
// ChatInfo 定义请求或响应数据结构。
|
||||
type ChatInfo struct {
|
||||
Head common.TomeeHeader `cmd:"50002" struc:"skip"`
|
||||
Reserve uint32 `json:"reserve" fieldDescription:"填充 默认值为0" uint:"true"`
|
||||
@@ -122,16 +142,19 @@ type ChatInfo struct {
|
||||
Message string `json:"message" fieldDescription:"消息内容, 结束符为utf-8的数字0"`
|
||||
}
|
||||
|
||||
// C2S_FRESH_CHOICE_FIGHT_LEVEL 定义请求或响应数据结构。
|
||||
type C2S_FRESH_CHOICE_FIGHT_LEVEL struct {
|
||||
Head common.TomeeHeader `cmd:"2428|2414" struc:"skip"`
|
||||
Level uint `json:"level"`
|
||||
}
|
||||
|
||||
// C2S_OPEN_DARKPORTAL 定义请求或响应数据结构。
|
||||
type C2S_OPEN_DARKPORTAL struct {
|
||||
Head common.TomeeHeader `cmd:"2424" struc:"skip"`
|
||||
Level uint32 `json:"level"`
|
||||
}
|
||||
|
||||
// FRESH_LEAVE_FIGHT_LEVEL 定义请求或响应数据结构。
|
||||
type FRESH_LEAVE_FIGHT_LEVEL struct {
|
||||
Head common.TomeeHeader `cmd:"2430|2416|2426" struc:"skip"`
|
||||
}
|
||||
|
||||
@@ -2,50 +2,59 @@ package controller
|
||||
|
||||
import "blazing/logic/service/common"
|
||||
|
||||
// SeeOnlineInboundInfo 定义请求或响应数据结构。
|
||||
type SeeOnlineInboundInfo struct {
|
||||
Head common.TomeeHeader `cmd:"2157" struc:"skip"`
|
||||
UserIdsLen uint32 `json:"userIdsLen" struc:"sizeof=UserIds"`
|
||||
UserIds []uint32 `json:"userIds" `
|
||||
}
|
||||
|
||||
// FriendAddInboundInfo 定义请求或响应数据结构。
|
||||
type FriendAddInboundInfo struct {
|
||||
Head common.TomeeHeader `cmd:"2151" struc:"skip"`
|
||||
UserID uint32 `json:"userID"`
|
||||
}
|
||||
|
||||
// FriendAnswerInboundInfo 定义请求或响应数据结构。
|
||||
type FriendAnswerInboundInfo struct {
|
||||
Head common.TomeeHeader `cmd:"2152" struc:"skip"`
|
||||
UserID uint32 `json:"userID"`
|
||||
Flag uint32 `json:"flag"`
|
||||
}
|
||||
|
||||
// FriendRemoveInboundInfo 定义请求或响应数据结构。
|
||||
type FriendRemoveInboundInfo struct {
|
||||
Head common.TomeeHeader `cmd:"2153" struc:"skip"`
|
||||
UserID uint32 `json:"userID"`
|
||||
}
|
||||
|
||||
// AcceptTaskInboundInfo 定义请求或响应数据结构。
|
||||
type AcceptTaskInboundInfo struct {
|
||||
Head common.TomeeHeader `cmd:"2201|2231" struc:"skip"`
|
||||
TaskId uint32 `json:"taskId" description:"任务ID"`
|
||||
}
|
||||
|
||||
// AddTaskBufInboundInfo 定义请求或响应数据结构。
|
||||
type AddTaskBufInboundInfo struct {
|
||||
Head common.TomeeHeader `cmd:"2204|2235" struc:"skip"`
|
||||
TaskId uint32 `json:"taskId" description:"任务ID"`
|
||||
TaskList []uint32 `struc:"[20]byte"`
|
||||
}
|
||||
|
||||
// CompleteTaskInboundInfo 定义请求或响应数据结构。
|
||||
type CompleteTaskInboundInfo struct {
|
||||
Head common.TomeeHeader `cmd:"2202|2233" struc:"skip"`
|
||||
TaskId uint32 `json:"taskId" description:"任务ID"`
|
||||
OutState uint32 `json:"outState" `
|
||||
}
|
||||
|
||||
// GetTaskBufInboundInfo 定义请求或响应数据结构。
|
||||
type GetTaskBufInboundInfo struct {
|
||||
Head common.TomeeHeader `cmd:"2203|2234" struc:"skip"`
|
||||
TaskId uint32 `json:"taskId" description:"任务ID"`
|
||||
}
|
||||
|
||||
// DeleteTaskInboundInfo 定义请求或响应数据结构。
|
||||
type DeleteTaskInboundInfo struct {
|
||||
Head common.TomeeHeader `cmd:"2205|2232" struc:"skip"`
|
||||
TaskId uint32 `json:"taskId" description:"任务ID"`
|
||||
|
||||
@@ -2,18 +2,21 @@ package controller
|
||||
|
||||
import "blazing/logic/service/common"
|
||||
|
||||
// BuyInboundInfo 定义请求或响应数据结构。
|
||||
type BuyInboundInfo struct {
|
||||
Head common.TomeeHeader `cmd:"2601" struc:"skip"`
|
||||
ItemId int64 `struc:"uint32"`
|
||||
Count int64 `struc:"uint32"`
|
||||
}
|
||||
|
||||
// BuyMultiInboundInfo 定义请求或响应数据结构。
|
||||
type BuyMultiInboundInfo struct {
|
||||
Head common.TomeeHeader `cmd:"2606" struc:"skip"`
|
||||
ItemListLen uint32 `struc:"sizeof=ItemIds"`
|
||||
ItemIds []uint32 `json:"itemIds" description:"购买的物品ID列表"`
|
||||
}
|
||||
|
||||
// C2S_GOLD_BUY_PRODUCT 定义请求或响应数据结构。
|
||||
type C2S_GOLD_BUY_PRODUCT struct {
|
||||
Head common.TomeeHeader `cmd:"1104" struc:"skip"`
|
||||
Type uint32 `json:"type"`
|
||||
@@ -21,6 +24,7 @@ type C2S_GOLD_BUY_PRODUCT struct {
|
||||
Count int64 `struc:"uint32"`
|
||||
}
|
||||
|
||||
// ItemListInboundInfo 定义请求或响应数据结构。
|
||||
type ItemListInboundInfo struct {
|
||||
Head common.TomeeHeader `cmd:"2605|4475" struc:"skip"`
|
||||
Param1 uint32
|
||||
@@ -28,36 +32,43 @@ type ItemListInboundInfo struct {
|
||||
Param3 uint32
|
||||
}
|
||||
|
||||
// GoldOnlineRemainInboundInfo 定义请求或响应数据结构。
|
||||
type GoldOnlineRemainInboundInfo struct {
|
||||
Head common.TomeeHeader `cmd:"1105|1106" struc:"skip"`
|
||||
}
|
||||
|
||||
// ExpTotalRemainInboundInfo 定义请求或响应数据结构。
|
||||
type ExpTotalRemainInboundInfo struct {
|
||||
Head common.TomeeHeader `cmd:"2319" struc:"skip"`
|
||||
}
|
||||
|
||||
// ChangePlayerClothInboundInfo 定义请求或响应数据结构。
|
||||
type ChangePlayerClothInboundInfo struct {
|
||||
Head common.TomeeHeader `cmd:"2604" struc:"skip"`
|
||||
ClothesLen uint32 `struc:"sizeof=ClothList" fieldDesc:"穿戴装备的信息" json:"clothes_len"`
|
||||
ClothList []uint32 `description:"玩家装备列表" codec:"list"`
|
||||
}
|
||||
|
||||
// TalkCountInboundInfo 定义请求或响应数据结构。
|
||||
type TalkCountInboundInfo struct {
|
||||
Head common.TomeeHeader `cmd:"2701" struc:"skip"`
|
||||
ID uint32 `description:"奖品的Type, 即ID" codec:"uint"`
|
||||
}
|
||||
|
||||
// TalkCateInboundInfo 定义请求或响应数据结构。
|
||||
type TalkCateInboundInfo struct {
|
||||
Head common.TomeeHeader `cmd:"2702" struc:"skip"`
|
||||
ID uint32 `description:"奖品的Type, 即ID" codec:"uint"`
|
||||
}
|
||||
|
||||
// C2S_USE_PET_ITEM_OUT_OF_FIGHT 定义请求或响应数据结构。
|
||||
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"`
|
||||
}
|
||||
|
||||
// C2S_PET_RESET_NATURE 定义请求或响应数据结构。
|
||||
type C2S_PET_RESET_NATURE struct {
|
||||
Head common.TomeeHeader `cmd:"2343" struc:"skip"`
|
||||
CatchTime uint32
|
||||
@@ -65,22 +76,26 @@ type C2S_PET_RESET_NATURE struct {
|
||||
ItemId uint32
|
||||
}
|
||||
|
||||
// C2S_ITEM_SALE 定义请求或响应数据结构。
|
||||
type C2S_ITEM_SALE struct {
|
||||
Head common.TomeeHeader `cmd:"2602" struc:"skip"`
|
||||
ItemId uint32
|
||||
Amount uint32
|
||||
}
|
||||
|
||||
// C2S_USE_SPEEDUP_ITEM 定义请求或响应数据结构。
|
||||
type C2S_USE_SPEEDUP_ITEM struct {
|
||||
Head common.TomeeHeader `cmd:"2327" struc:"skip"`
|
||||
ItemID uint32
|
||||
}
|
||||
|
||||
// C2S_USE_ENERGY_XISHOU 定义请求或响应数据结构。
|
||||
type C2S_USE_ENERGY_XISHOU struct {
|
||||
Head common.TomeeHeader `cmd:"2331" struc:"skip"`
|
||||
ItemID uint32
|
||||
}
|
||||
|
||||
// C2S_USE_AUTO_FIGHT_ITEM 定义请求或响应数据结构。
|
||||
type C2S_USE_AUTO_FIGHT_ITEM struct {
|
||||
Head common.TomeeHeader `cmd:"2329" struc:"skip"`
|
||||
ItemID uint32
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
"blazing/modules/player/model"
|
||||
)
|
||||
|
||||
// EnterMapInboundInfo 定义请求或响应数据结构。
|
||||
type EnterMapInboundInfo struct {
|
||||
Head common.TomeeHeader `cmd:"2001" struc:"skip"`
|
||||
MapType uint32
|
||||
@@ -12,22 +13,27 @@ type EnterMapInboundInfo struct {
|
||||
Point model.Pos `fieldDesc:"直接给坐标x,y"`
|
||||
}
|
||||
|
||||
// GetMapHotInboundInfo 定义请求或响应数据结构。
|
||||
type GetMapHotInboundInfo struct {
|
||||
Head common.TomeeHeader `cmd:"1004" struc:"skip"`
|
||||
}
|
||||
|
||||
// LeaveMapInboundInfo 定义请求或响应数据结构。
|
||||
type LeaveMapInboundInfo struct {
|
||||
Head common.TomeeHeader `cmd:"2002" struc:"skip"`
|
||||
}
|
||||
|
||||
// ListMapPlayerInboundInfo 定义请求或响应数据结构。
|
||||
type ListMapPlayerInboundInfo struct {
|
||||
Head common.TomeeHeader `cmd:"2003" struc:"skip"`
|
||||
}
|
||||
|
||||
// AttackBossInboundInfo 定义请求或响应数据结构。
|
||||
type AttackBossInboundInfo struct {
|
||||
Head common.TomeeHeader `cmd:"2412" struc:"skip"`
|
||||
}
|
||||
|
||||
// WalkInInfo 定义请求或响应数据结构。
|
||||
type WalkInInfo struct {
|
||||
Head common.TomeeHeader `cmd:"2101" struc:"skip"`
|
||||
Flag uint32
|
||||
@@ -36,20 +42,24 @@ type WalkInInfo struct {
|
||||
Path string
|
||||
}
|
||||
|
||||
// FitmentUseringInboundInfo 定义请求或响应数据结构。
|
||||
type FitmentUseringInboundInfo struct {
|
||||
Head common.TomeeHeader `cmd:"10006" struc:"skip"`
|
||||
TargetUserID uint32 `json:"targetUserId"`
|
||||
}
|
||||
|
||||
// PetRoomListInboundInfo 定义请求或响应数据结构。
|
||||
type PetRoomListInboundInfo struct {
|
||||
Head common.TomeeHeader `cmd:"2324" struc:"skip"`
|
||||
TargetUserID uint32 `json:"targetUserId"`
|
||||
}
|
||||
|
||||
// FitmentAllInboundEmpty 定义请求或响应数据结构。
|
||||
type FitmentAllInboundEmpty struct {
|
||||
Head common.TomeeHeader `cmd:"10007" struc:"skip"`
|
||||
}
|
||||
|
||||
// SET_FITMENT 定义请求或响应数据结构。
|
||||
type SET_FITMENT struct {
|
||||
Head common.TomeeHeader `cmd:"10008" struc:"skip"`
|
||||
RoomID uint32 `json:"roomID"`
|
||||
@@ -57,44 +67,52 @@ type SET_FITMENT struct {
|
||||
Fitments []model.FitmentShowInfo `json:"usedList"`
|
||||
}
|
||||
|
||||
// C2S_PetShowList 定义请求或响应数据结构。
|
||||
type C2S_PetShowList struct {
|
||||
CatchTime uint32 `json:"catchTime"`
|
||||
PetID uint32 `json:"petID"`
|
||||
}
|
||||
|
||||
// C2S_PET_ROOM_SHOW 定义请求或响应数据结构。
|
||||
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"`
|
||||
}
|
||||
|
||||
// C2S_RoomPetInfo 定义请求或响应数据结构。
|
||||
type C2S_RoomPetInfo struct {
|
||||
Head common.TomeeHeader `cmd:"2325" struc:"skip"`
|
||||
UserID uint32 `json:"userID"`
|
||||
CatchTime uint32 `json:"catchTime"`
|
||||
}
|
||||
|
||||
// C2S_BUY_FITMENT 定义请求或响应数据结构。
|
||||
type C2S_BUY_FITMENT struct {
|
||||
Head common.TomeeHeader `cmd:"10004" struc:"skip"`
|
||||
ID uint32 `json:"id"`
|
||||
Count uint32 `json:"count"`
|
||||
}
|
||||
|
||||
// NonoInboundInfo 定义请求或响应数据结构。
|
||||
type NonoInboundInfo struct {
|
||||
Head common.TomeeHeader `cmd:"9003" struc:"skip"`
|
||||
UserID uint32
|
||||
}
|
||||
|
||||
// NonoFollowOrHomeInInfo 定义请求或响应数据结构。
|
||||
type NonoFollowOrHomeInInfo struct {
|
||||
Head common.TomeeHeader `cmd:"9019" struc:"skip"`
|
||||
Flag uint32 `fieldDescription:"1为跟随 0为收回 且如果为收回 那么后续结构不需要发送" uint:"true"`
|
||||
}
|
||||
|
||||
// SwitchFlyingInboundInfo 定义请求或响应数据结构。
|
||||
type SwitchFlyingInboundInfo struct {
|
||||
Head common.TomeeHeader `cmd:"2112" struc:"skip"`
|
||||
Type uint32 `description:"开关, 0为取消飞行模式, 大于0为开启飞行模式" codec:"auto" uint:"true"`
|
||||
}
|
||||
|
||||
// PetCureInboundInfo 定义请求或响应数据结构。
|
||||
type PetCureInboundInfo struct {
|
||||
Head common.TomeeHeader `cmd:"2306" struc:"skip"`
|
||||
}
|
||||
|
||||
@@ -2,15 +2,18 @@ package controller
|
||||
|
||||
import "blazing/logic/service/common"
|
||||
|
||||
// GetPetInfoInboundInfo 定义请求或响应数据结构。
|
||||
type GetPetInfoInboundInfo struct {
|
||||
Head common.TomeeHeader `cmd:"2301" struc:"skip"`
|
||||
CatchTime uint32
|
||||
}
|
||||
|
||||
// GetUserBagPetInfoInboundEmpty 定义请求或响应数据结构。
|
||||
type GetUserBagPetInfoInboundEmpty struct {
|
||||
Head common.TomeeHeader `cmd:"4483" struc:"skip"`
|
||||
}
|
||||
|
||||
// SavePetBagOrderInboundInfo 定义请求或响应数据结构。
|
||||
type SavePetBagOrderInboundInfo struct {
|
||||
Head common.TomeeHeader `cmd:"4484" struc:"skip"`
|
||||
|
||||
@@ -20,51 +23,60 @@ type SavePetBagOrderInboundInfo struct {
|
||||
BackupPetList []uint32
|
||||
}
|
||||
|
||||
// PetReleaseInboundInfo 定义请求或响应数据结构。
|
||||
type PetReleaseInboundInfo struct {
|
||||
Head common.TomeeHeader `cmd:"2304" struc:"skip"`
|
||||
CatchTime uint32
|
||||
Flag uint32 `json:"flag" fieldDescription:"0为放入仓库,1为放入背包" autoCodec:"true" uint:"true"`
|
||||
}
|
||||
|
||||
// PetShowInboundInfo 定义请求或响应数据结构。
|
||||
type PetShowInboundInfo struct {
|
||||
Head common.TomeeHeader `cmd:"2305" struc:"skip"`
|
||||
CatchTime uint32 `codec:"catchTime" inboundMessageType:"Pet_Show"`
|
||||
Flag uint32 `codec:"flag"`
|
||||
}
|
||||
|
||||
// PetOneCureInboundInfo 定义请求或响应数据结构。
|
||||
type PetOneCureInboundInfo struct {
|
||||
Head common.TomeeHeader `cmd:"2310" struc:"skip"`
|
||||
CatchTime uint32 `json:"catchTime" fieldDescription:"精灵捕捉时间" uint:"true"`
|
||||
}
|
||||
|
||||
// PET_ROWEI 定义请求或响应数据结构。
|
||||
type PET_ROWEI struct {
|
||||
Head common.TomeeHeader `cmd:"2321" struc:"skip"`
|
||||
ID uint32
|
||||
CatchTime uint32 `json:"catchTime" fieldDescription:"精灵捕捉时间" uint:"true"`
|
||||
}
|
||||
|
||||
// PET_RETRIEVE 定义请求或响应数据结构。
|
||||
type PET_RETRIEVE struct {
|
||||
Head common.TomeeHeader `cmd:"2322" struc:"skip"`
|
||||
CatchTime uint32 `json:"catchTime" fieldDescription:"精灵捕捉时间" uint:"true"`
|
||||
}
|
||||
|
||||
// PetDefaultInboundInfo 定义请求或响应数据结构。
|
||||
type PetDefaultInboundInfo struct {
|
||||
Head common.TomeeHeader `cmd:"2308" struc:"skip"`
|
||||
CatchTime uint32 `json:"catchTime" fieldDescription:"精灵捕捉时间" uint:"true" autoCodec:"true" inboundMessageType:"Pet_Default"`
|
||||
}
|
||||
|
||||
// PetSetExpInboundInfo 定义请求或响应数据结构。
|
||||
type PetSetExpInboundInfo struct {
|
||||
Head common.TomeeHeader `cmd:"2318" struc:"skip"`
|
||||
CatchTime uint32 `fieldDescription:"精灵获取时间" uint:"true" autoCodec:"true"`
|
||||
Exp int64 `struc:"uint32"`
|
||||
}
|
||||
|
||||
// PetBargeListInboundInfo 定义请求或响应数据结构。
|
||||
type PetBargeListInboundInfo struct {
|
||||
Head common.TomeeHeader `cmd:"2309" struc:"skip"`
|
||||
StartPetId uint32 `description:"开始精灵id" codec:"startPetId"`
|
||||
EndPetId uint32 `description:"结束精灵id" codec:"endPetId"`
|
||||
}
|
||||
|
||||
// ChangeSkillInfo 定义请求或响应数据结构。
|
||||
type ChangeSkillInfo struct {
|
||||
Head common.TomeeHeader `cmd:"2312" struc:"skip"`
|
||||
CatchTime uint32 `json:"catchTime"`
|
||||
@@ -74,12 +86,14 @@ type ChangeSkillInfo struct {
|
||||
ReplaceSkill uint32 `json:"replaceSkill"`
|
||||
}
|
||||
|
||||
// C2S_Skill_Sort 定义请求或响应数据结构。
|
||||
type C2S_Skill_Sort struct {
|
||||
Head common.TomeeHeader `cmd:"2328" struc:"skip"`
|
||||
CapTm uint32 `json:"capTm"`
|
||||
Skill [4]uint32 `json:"skill_1"`
|
||||
}
|
||||
|
||||
// C2S_PetFusion 定义请求或响应数据结构。
|
||||
type C2S_PetFusion struct {
|
||||
Head common.TomeeHeader `cmd:"2351" struc:"skip"`
|
||||
Mcatchtime uint32 `json:"mcatchtime" msgpack:"mcatchtime"`
|
||||
|
||||
@@ -10,11 +10,13 @@ import (
|
||||
"hash/crc32"
|
||||
)
|
||||
|
||||
// MAIN_LOGIN_IN 定义请求或响应数据结构。
|
||||
type MAIN_LOGIN_IN struct {
|
||||
Head common.TomeeHeader `cmd:"1001" struc:"skip"`
|
||||
Sid []byte `struc:"[16]byte"`
|
||||
}
|
||||
|
||||
// CheakSession 处理控制器请求。
|
||||
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))
|
||||
@@ -30,16 +32,19 @@ func (l *MAIN_LOGIN_IN) CheakSession() (bool, uint32) {
|
||||
return true, crcValue
|
||||
}
|
||||
|
||||
// SimUserInfoInboundInfo 定义请求或响应数据结构。
|
||||
type SimUserInfoInboundInfo struct {
|
||||
Head common.TomeeHeader `cmd:"2051" struc:"skip"`
|
||||
UserId uint32 `fieldDescription:"米米号" uint:"true" codec:"true"`
|
||||
}
|
||||
|
||||
// MoreUserInfoInboundInfo 定义请求或响应数据结构。
|
||||
type MoreUserInfoInboundInfo struct {
|
||||
Head common.TomeeHeader `cmd:"2052" struc:"skip"`
|
||||
UserId uint32 `fieldDescription:"米米号" uint:"true" codec:"true"`
|
||||
}
|
||||
|
||||
// AimatInboundInfo 定义请求或响应数据结构。
|
||||
type AimatInboundInfo struct {
|
||||
Head common.TomeeHeader `cmd:"2104" struc:"skip"`
|
||||
ItemId uint32 `description:"物品id 射击激光 物品id为0" codec:"auto" uint:"true"`
|
||||
@@ -47,6 +52,7 @@ type AimatInboundInfo struct {
|
||||
Point model.Pos `description:"射击的坐标 x y" codec:"auto"`
|
||||
}
|
||||
|
||||
// ChatInboundInfo 定义请求或响应数据结构。
|
||||
type ChatInboundInfo struct {
|
||||
Head common.TomeeHeader `cmd:"2102" struc:"skip"`
|
||||
Reserve uint32 `json:"reserve" fieldDescription:"填充 默认值为0" uint:"true"`
|
||||
@@ -54,43 +60,51 @@ type ChatInboundInfo struct {
|
||||
Message string `json:"message" fieldDescription:"消息内容, 结束符为utf-8的数字0"`
|
||||
}
|
||||
|
||||
// ChangeColorInboundInfo 定义请求或响应数据结构。
|
||||
type ChangeColorInboundInfo struct {
|
||||
Head common.TomeeHeader `cmd:"2063" struc:"skip"`
|
||||
Color uint32 `codec:"color"`
|
||||
}
|
||||
|
||||
// ChangeDoodleInboundInfo 定义请求或响应数据结构。
|
||||
type ChangeDoodleInboundInfo struct {
|
||||
Head common.TomeeHeader `cmd:"2062" struc:"skip"`
|
||||
Id uint32 `codec:"id"`
|
||||
Color uint32 `codec:"color"`
|
||||
}
|
||||
|
||||
// ChangeNONOColorInboundInfo 定义请求或响应数据结构。
|
||||
type ChangeNONOColorInboundInfo struct {
|
||||
Head common.TomeeHeader `cmd:"9012" struc:"skip"`
|
||||
Color uint32 `codec:"color"`
|
||||
}
|
||||
|
||||
// C2SDanceAction 定义请求或响应数据结构。
|
||||
type C2SDanceAction struct {
|
||||
Head common.TomeeHeader `cmd:"2103" struc:"skip"`
|
||||
Reserve uint32 `struc:"uint32,big"`
|
||||
Type uint32 `struc:"uint32,big"`
|
||||
}
|
||||
|
||||
// C2SPEOPLE_TRANSFROM 定义请求或响应数据结构。
|
||||
type C2SPEOPLE_TRANSFROM struct {
|
||||
Head common.TomeeHeader `cmd:"2111" struc:"skip"`
|
||||
SuitID uint32 `struc:"uint32,big"`
|
||||
}
|
||||
|
||||
// ChangePlayerNameInboundInfo 定义请求或响应数据结构。
|
||||
type ChangePlayerNameInboundInfo struct {
|
||||
Head common.TomeeHeader `cmd:"2061" struc:"skip"`
|
||||
Nickname string `struc:"[16]byte"`
|
||||
}
|
||||
|
||||
// ChangeTitleInboundInfo 定义请求或响应数据结构。
|
||||
type ChangeTitleInboundInfo struct {
|
||||
Head common.TomeeHeader `cmd:"3404" struc:"skip"`
|
||||
TileID uint32
|
||||
}
|
||||
|
||||
// C2S_GET_GIFT_COMPLETE 定义请求或响应数据结构。
|
||||
type C2S_GET_GIFT_COMPLETE struct {
|
||||
Head common.TomeeHeader `cmd:"2801" struc:"skip"`
|
||||
PassText string `struc:"[16]byte"`
|
||||
|
||||
@@ -39,6 +39,7 @@ func (h Controller) EnterMap(data *EnterMapInboundInfo, c *player.Player) (resul
|
||||
return nil, -1
|
||||
}
|
||||
|
||||
// GetMapHot 处理控制器请求。
|
||||
func (h Controller) GetMapHot(data *GetMapHotInboundInfo, c *player.Player) (result *maphot.OutInfo, err errorcode.ErrorCode) {
|
||||
result = &maphot.OutInfo{
|
||||
HotInfos: space.GetMapHot(),
|
||||
|
||||
@@ -14,6 +14,7 @@ const (
|
||||
nonoPetCureCost int64 = 50
|
||||
)
|
||||
|
||||
// NonoFollowOrHome 处理控制器请求。
|
||||
func (h Controller) NonoFollowOrHome(data *NonoFollowOrHomeInInfo, c *player.Player) (result *nono.NonoFollowOutInfo, err errorcode.ErrorCode) { //这个时候player应该是空的
|
||||
c.Info.NONO.Flag = data.Flag
|
||||
result = &nono.NonoFollowOutInfo{
|
||||
@@ -49,6 +50,7 @@ func (h *Controller) GetNonoInfo(data *NonoInboundInfo, c *player.Player) (resul
|
||||
return
|
||||
}
|
||||
|
||||
// SwitchFlying 处理控制器请求。
|
||||
func (h *Controller) SwitchFlying(data *SwitchFlyingInboundInfo, c *player.Player) (result *nono.SwitchFlyingOutboundInfo, err errorcode.ErrorCode) { //这个时候player应该是空的
|
||||
result = &nono.SwitchFlyingOutboundInfo{
|
||||
UserId: data.Head.UserID,
|
||||
@@ -59,6 +61,7 @@ func (h *Controller) SwitchFlying(data *SwitchFlyingInboundInfo, c *player.Playe
|
||||
return
|
||||
}
|
||||
|
||||
// PlayerPetCure 处理控制器请求。
|
||||
func (h *Controller) PlayerPetCure(data *PetCureInboundInfo, c *player.Player) (result *nono.PetCureOutboundEmpty, err errorcode.ErrorCode) { //这个时候player应该是空的
|
||||
_ = data
|
||||
if c.IsArenaHealLocked() {
|
||||
|
||||
@@ -12,6 +12,7 @@ import (
|
||||
"github.com/jinzhu/copier"
|
||||
)
|
||||
|
||||
// PetELV 处理控制器请求。
|
||||
func (h Controller) PetELV(data *C2S_PET_EVOLVTION, c *player.Player) (result *fight.NullOutboundInfo, err errorcode.ErrorCode) {
|
||||
_, currentPet, found := c.FindPet(data.CacthTime)
|
||||
if !found {
|
||||
|
||||
@@ -63,6 +63,7 @@ func (h Controller) PetEVDiy(data *PetEV, c *player.Player) (result *fight.NullO
|
||||
return result, 0
|
||||
}
|
||||
|
||||
// PetEV 定义请求或响应数据结构。
|
||||
type PetEV struct {
|
||||
Head common.TomeeHeader `cmd:"50001" struc:"skip"`
|
||||
CacthTime uint32 `description:"捕捉时间" codec:"cacthTime"`
|
||||
|
||||
@@ -16,6 +16,7 @@ func (h Controller) PetExt(
|
||||
|
||||
}
|
||||
|
||||
// C2S_NONO_EXE_LIST 定义请求或响应数据结构。
|
||||
type C2S_NONO_EXE_LIST struct {
|
||||
Head common.TomeeHeader `cmd:"9015" struc:"skip"`
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ const (
|
||||
petFusionSoulID = 1000017
|
||||
)
|
||||
|
||||
// PetFusion 处理控制器请求。
|
||||
func (h Controller) PetFusion(data *C2S_PetFusion, c *player.Player) (result *pet.PetFusionInfo, err errorcode.ErrorCode) {
|
||||
result = &pet.PetFusionInfo{
|
||||
SoulID: petFusionSoulID,
|
||||
|
||||
@@ -36,6 +36,7 @@ func (h Controller) GetUserBagPetInfo(
|
||||
return player.GetUserBagPetInfo(), 0
|
||||
}
|
||||
|
||||
// GetPetListInboundEmpty 定义请求或响应数据结构。
|
||||
type GetPetListInboundEmpty struct {
|
||||
Head common.TomeeHeader `cmd:"2303" struc:"skip"`
|
||||
}
|
||||
@@ -48,6 +49,7 @@ func (h Controller) GetPetList(
|
||||
return buildPetListOutboundInfo(player.Info.PetList), 0
|
||||
}
|
||||
|
||||
// GetPetListFreeInboundEmpty 定义请求或响应数据结构。
|
||||
type GetPetListFreeInboundEmpty struct {
|
||||
Head common.TomeeHeader `cmd:"2320" struc:"skip"`
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import (
|
||||
"github.com/samber/lo"
|
||||
)
|
||||
|
||||
// IsCollect 处理控制器请求。
|
||||
func (h Controller) IsCollect(
|
||||
data *pet.C2S_IS_COLLECT, c *player.Player) (result *pet.S2C_IS_COLLECT, err errorcode.ErrorCode) { //这个时候player应该是空的
|
||||
result = &pet.S2C_IS_COLLECT{
|
||||
@@ -49,6 +50,7 @@ var validTypeIDMap = map[int][]uint32{
|
||||
100: {856, 857, 858}, //测试
|
||||
}
|
||||
|
||||
// Collect 处理控制器请求。
|
||||
func (h Controller) Collect(
|
||||
data *pet.C2S_PET_COLLECT, c *player.Player) (result *pet.S2C_PET_COLLECT, err errorcode.ErrorCode) { //这个时候player应该是空的
|
||||
result = &pet.S2C_PET_COLLECT{ID: data.ID}
|
||||
|
||||
@@ -120,6 +120,7 @@ func canBreedPair(maleID, femaleID uint32) bool {
|
||||
return ok
|
||||
}
|
||||
|
||||
// GetEggList 处理控制器请求。
|
||||
func (ctl Controller) GetEggList(
|
||||
data *pet.C2S_GET_EGG_LIST, player *player.Player) (result *pet.S2C_GET_EGG_LIST, err errorcode.ErrorCode) { //这个时候player应该是空的
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ import (
|
||||
"blazing/logic/service/player"
|
||||
)
|
||||
|
||||
// SystemTimeInfo 处理控制器请求。
|
||||
func (h Controller) SystemTimeInfo(data *InInfo, c *player.Player) (result *OutInfo, err errorcode.ErrorCode) {
|
||||
|
||||
return &OutInfo{
|
||||
|
||||
@@ -171,6 +171,7 @@ func (h Controller) ChangePlayerCloth(data *ChangePlayerClothInboundInfo, player
|
||||
return
|
||||
}
|
||||
|
||||
// ChangePlayerName 处理控制器请求。
|
||||
func (h Controller) ChangePlayerName(data *ChangePlayerNameInboundInfo, c *player.Player) (result *user.ChangePlayerNameOutboundInfo, err errorcode.ErrorCode) {
|
||||
newNickname := cool.Filter.Replace(strings.Trim(data.Nickname, "\x00"), '*')
|
||||
|
||||
@@ -183,6 +184,8 @@ func (h Controller) ChangePlayerName(data *ChangePlayerNameInboundInfo, c *playe
|
||||
|
||||
return result, 0
|
||||
}
|
||||
|
||||
// ChangeTile 处理控制器请求。
|
||||
func (h Controller) ChangeTile(data *ChangeTitleInboundInfo, c *player.Player) (result *user.ChangeTitleOutboundInfo, err errorcode.ErrorCode) {
|
||||
result = &user.ChangeTitleOutboundInfo{
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
// CDK 处理控制器请求。
|
||||
func (h Controller) CDK(data *C2S_GET_GIFT_COMPLETE, player *player.Player) (result *user.S2C_GET_GIFT_COMPLETE, err errorcode.ErrorCode) {
|
||||
result = &user.S2C_GET_GIFT_COMPLETE{}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ import (
|
||||
"blazing/modules/config/service"
|
||||
)
|
||||
|
||||
// GetTalkCount 处理控制器请求。
|
||||
func (h Controller) GetTalkCount(data *TalkCountInboundInfo, c *player.Player) (result *item.TalkCountOutboundInfo, err errorcode.ErrorCode) {
|
||||
result = &item.TalkCountOutboundInfo{}
|
||||
talkCount, ok := c.Service.Talk.Cheak(c.Info.MapID, int(data.ID))
|
||||
|
||||
@@ -6,6 +6,7 @@ import (
|
||||
"blazing/logic/service/space/info"
|
||||
)
|
||||
|
||||
// PlayerWalk 处理控制器请求。
|
||||
func (h Controller) PlayerWalk(data *WalkInInfo, c *player.Player) (result *info.WalkOutInfo, err errorcode.ErrorCode) {
|
||||
result = &info.WalkOutInfo{
|
||||
Flag: data.Flag,
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
"blazing/modules/player/model"
|
||||
)
|
||||
|
||||
// FightI 定义 common 服务层依赖的战斗操作接口。
|
||||
type FightI interface {
|
||||
Over(c PlayerI, id model.EnumBattleOverReason) //逃跑
|
||||
UseSkill(c PlayerI, id uint32) //使用技能
|
||||
|
||||
@@ -7,24 +7,25 @@ import (
|
||||
"github.com/gogf/gf/v2/os/glog"
|
||||
)
|
||||
|
||||
// MyWriter 自定义日志写入器,用于逻辑服日志转发。
|
||||
type MyWriter struct {
|
||||
logger *glog.Logger
|
||||
user uint32
|
||||
logger *glog.Logger // 底层 glog 实例。
|
||||
user uint32 // 关联的玩家 ID。
|
||||
}
|
||||
|
||||
// Write 实现 io.Writer,并将日志写入系统日志与底层 logger。
|
||||
func (w *MyWriter) Write(p []byte) (n int, err error) {
|
||||
var (
|
||||
s = string(p)
|
||||
//ctx = context.Background()
|
||||
)
|
||||
|
||||
service.NewBaseSysLogService().RecordLog(w.user, s)
|
||||
return w.logger.Write(p)
|
||||
}
|
||||
|
||||
func init() {
|
||||
cool.Logger.SetWriter(&MyWriter{
|
||||
logger: glog.New(),
|
||||
})
|
||||
cool.Logger.SetAsync(true)
|
||||
|
||||
}
|
||||
|
||||
@@ -8,20 +8,18 @@ import (
|
||||
"github.com/lunixbochs/struc"
|
||||
)
|
||||
|
||||
// TomeeHeader 结构体字段定义
|
||||
// TomeeHeader 定义协议包头。
|
||||
type TomeeHeader struct {
|
||||
Len uint32 `json:"len"`
|
||||
Version byte `json:"version" struc:"[1]byte"`
|
||||
CMD uint32 `json:"cmdId" struc:"uint32"`
|
||||
UserID uint32 `json:"userId"`
|
||||
//Error uint32 `json:"error" struc:"skip"`
|
||||
|
||||
Result uint32 `json:"result"`
|
||||
Data []byte `json:"data" struc:"skip"` //组包忽略此字段// struc:"skip"
|
||||
Res []byte `struc:"skip"`
|
||||
//Return []byte `struc:"skip"` //返回记录
|
||||
Len uint32 `json:"len"` // 包总长度(包头 + 数据体)。
|
||||
Version byte `json:"version" struc:"[1]byte"` // 协议版本。
|
||||
CMD uint32 `json:"cmdId" struc:"uint32"` // 命令 ID。
|
||||
UserID uint32 `json:"userId"` // 玩家 ID。
|
||||
Result uint32 `json:"result"` // 结果码。
|
||||
Data []byte `json:"data" struc:"skip"` // 数据体,序列化时跳过。
|
||||
Res []byte `struc:"skip"` // 预留返回数据,序列化时跳过。
|
||||
}
|
||||
|
||||
// NewTomeeHeader 创建用于下行封包的默认 TomeeHeader。
|
||||
func NewTomeeHeader(cmd uint32, userid uint32) *TomeeHeader {
|
||||
|
||||
return &TomeeHeader{
|
||||
|
||||
@@ -7,6 +7,7 @@ import (
|
||||
"blazing/modules/player/model"
|
||||
)
|
||||
|
||||
// PlayerI 定义战斗与 common 服务依赖的最小玩家能力接口。
|
||||
type PlayerI interface {
|
||||
ApplyPetDisplayInfo(*space.SimpleInfo)
|
||||
GetPlayerCaptureContext() *info.PlayerCaptureContext
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"blazing/logic/service/fight/info"
|
||||
"blazing/logic/service/player"
|
||||
configmodel "blazing/modules/config/model"
|
||||
playermodel "blazing/modules/player/model"
|
||||
"strings"
|
||||
|
||||
"github.com/gogf/gf/v2/util/grand"
|
||||
@@ -146,6 +147,9 @@ func buildBossHookActionContext(our *Input, hookAction bool) *configmodel.BossHo
|
||||
}
|
||||
}
|
||||
|
||||
if our.AttackValue != nil {
|
||||
ctx.OurAttack = convertAttackValue(our.AttackValue)
|
||||
}
|
||||
if our.Opp != nil {
|
||||
if oppPet := our.Opp.CurrentPet(); oppPet != nil {
|
||||
ctx.Opp = &configmodel.BossHookPetContext{
|
||||
@@ -155,11 +159,42 @@ func buildBossHookActionContext(our *Input, hookAction bool) *configmodel.BossHo
|
||||
MaxHp: oppPet.Info.MaxHp,
|
||||
}
|
||||
}
|
||||
if our.Opp.AttackValue != nil {
|
||||
ctx.OppAttack = convertAttackValue(our.Opp.AttackValue)
|
||||
}
|
||||
}
|
||||
|
||||
return ctx
|
||||
}
|
||||
|
||||
func convertAttackValue(src *playermodel.AttackValue) *configmodel.BossHookAttackContext {
|
||||
if src == nil {
|
||||
return nil
|
||||
}
|
||||
status := make([]int8, len(src.Status))
|
||||
for i := range src.Status {
|
||||
status[i] = src.Status[i]
|
||||
}
|
||||
prop := make([]int8, len(src.Prop))
|
||||
for i := range src.Prop {
|
||||
prop[i] = src.Prop[i]
|
||||
}
|
||||
|
||||
return &configmodel.BossHookAttackContext{
|
||||
SkillID: src.SkillID,
|
||||
AttackTime: src.AttackTime,
|
||||
IsCritical: src.IsCritical,
|
||||
LostHp: src.LostHp,
|
||||
GainHp: src.GainHp,
|
||||
RemainHp: src.RemainHp,
|
||||
MaxHp: src.MaxHp,
|
||||
State: src.State,
|
||||
Offensive: src.Offensive,
|
||||
Status: status,
|
||||
Prop: prop,
|
||||
}
|
||||
}
|
||||
|
||||
func applyBossScriptAction(our *Input, ctx *configmodel.BossHookActionContext) bool {
|
||||
if our == nil || ctx == nil {
|
||||
return false
|
||||
|
||||
@@ -43,6 +43,21 @@ type BossHookPetContext struct {
|
||||
MaxHp uint32 `json:"max_hp"`
|
||||
}
|
||||
|
||||
// BossHookAttackContext 参考 AttackValue,为脚本暴露关键战斗面板/结果字段。
|
||||
type BossHookAttackContext struct {
|
||||
SkillID uint32 `json:"skill_id"`
|
||||
AttackTime uint32 `json:"attack_time"`
|
||||
IsCritical uint32 `json:"is_critical"`
|
||||
LostHp uint32 `json:"lost_hp"`
|
||||
GainHp int32 `json:"gain_hp"`
|
||||
RemainHp int32 `json:"remain_hp"`
|
||||
MaxHp uint32 `json:"max_hp"`
|
||||
State uint32 `json:"state"`
|
||||
Offensive float32 `json:"offensive"`
|
||||
Status []int8 `json:"status"`
|
||||
Prop []int8 `json:"prop"`
|
||||
}
|
||||
|
||||
// BossHookActionContext 为 boss 脚本提供可读写的出手上下文。
|
||||
type BossHookActionContext struct {
|
||||
HookAction bool `json:"hookaction"` // effect 链原始 HookAction 判定
|
||||
@@ -51,6 +66,8 @@ type BossHookActionContext struct {
|
||||
Our *BossHookPetContext `json:"our"` // 我方当前精灵
|
||||
Opp *BossHookPetContext `json:"opp"` // 对方当前精灵
|
||||
Skills []BossHookSkillContext `json:"skills"` // 我方技能
|
||||
OurAttack *BossHookAttackContext `json:"our_attack"` // 我方AttackValue快照
|
||||
OppAttack *BossHookAttackContext `json:"opp_attack"` // 对方AttackValue快照
|
||||
Action string `json:"action"` // auto/skill/switch
|
||||
SkillID uint32 `json:"skill_id"` // action=skill
|
||||
CatchTime uint32 `json:"catch_time"` // action=switch
|
||||
@@ -59,22 +76,10 @@ type BossHookActionContext struct {
|
||||
SwitchPetFn func(catchTime uint32) `json:"-"`
|
||||
}
|
||||
|
||||
// TableName 指定BossConfig对应的数据库表名
|
||||
func (*BossConfig) TableName() string {
|
||||
return TableNameBossConfig
|
||||
}
|
||||
func (*BossConfig) TableName() string { return TableNameBossConfig }
|
||||
func (*BossConfig) GroupName() string { return "default" }
|
||||
func NewBossConfig() *BossConfig { return &BossConfig{Model: cool.NewModel()} }
|
||||
|
||||
// GroupName 指定表所属的分组(保持和怪物刷新表一致)
|
||||
func (*BossConfig) GroupName() string {
|
||||
return "default"
|
||||
}
|
||||
|
||||
// NewBossConfig 创建一个新的BossConfig实例(初始化通用Model字段+所有默认值)
|
||||
func NewBossConfig() *BossConfig {
|
||||
return &BossConfig{Model: cool.NewModel()}
|
||||
}
|
||||
|
||||
// init 程序启动时自动创建/同步boss_config表结构
|
||||
func init() {
|
||||
cool.CreateTable(&BossConfig{})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user