修改问题和战斗相关
This commit is contained in:
parent
09538cc2ba
commit
2990de6624
2
go.mod
2
go.mod
@ -1,6 +1,6 @@
|
|||||||
module ecs
|
module ecs
|
||||||
|
|
||||||
go 1.24.3
|
go 1.24
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/json-iterator/go v1.1.12
|
github.com/json-iterator/go v1.1.12
|
||||||
|
8
go.sum
8
go.sum
@ -86,15 +86,11 @@ github.com/xuri/nfp v0.0.1/go.mod h1:WwHg+CVyzlv/TX9xqBFXEZAuxOPxn2k1GNHwG41IIUQ
|
|||||||
github.com/youmark/pkcs8 v0.0.0-20240726163527-a2c0da244d78 h1:ilQV1hzziu+LLM3zUTJ0trRztfwgjqKnBWNtSRkbmwM=
|
github.com/youmark/pkcs8 v0.0.0-20240726163527-a2c0da244d78 h1:ilQV1hzziu+LLM3zUTJ0trRztfwgjqKnBWNtSRkbmwM=
|
||||||
github.com/youmark/pkcs8 v0.0.0-20240726163527-a2c0da244d78/go.mod h1:aL8wCCfTfSfmXjznFBSZNN13rSJjlIOI1fUNAtF7rmI=
|
github.com/youmark/pkcs8 v0.0.0-20240726163527-a2c0da244d78/go.mod h1:aL8wCCfTfSfmXjznFBSZNN13rSJjlIOI1fUNAtF7rmI=
|
||||||
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
|
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
|
||||||
go.mongodb.org/mongo-driver v1.17.3 h1:TQyXhnsWfWtgAhMtOgtYHMTkZIfBTpMTsMnd9ZBeHxQ=
|
|
||||||
go.mongodb.org/mongo-driver v1.17.3/go.mod h1:Hy04i7O2kC4RS06ZrhPRqj/u4DTYkFDAAccj+rVKqgQ=
|
|
||||||
go.mongodb.org/mongo-driver v1.17.4 h1:jUorfmVzljjr0FLzYQsGP8cgN/qzzxlY9Vh0C9KFXVw=
|
go.mongodb.org/mongo-driver v1.17.4 h1:jUorfmVzljjr0FLzYQsGP8cgN/qzzxlY9Vh0C9KFXVw=
|
||||||
go.mongodb.org/mongo-driver v1.17.4/go.mod h1:Hy04i7O2kC4RS06ZrhPRqj/u4DTYkFDAAccj+rVKqgQ=
|
go.mongodb.org/mongo-driver v1.17.4/go.mod h1:Hy04i7O2kC4RS06ZrhPRqj/u4DTYkFDAAccj+rVKqgQ=
|
||||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||||
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||||
golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4=
|
golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4=
|
||||||
golang.org/x/crypto v0.38.0 h1:jt+WWG8IZlBnVbomuhg2Mdq0+BBQaHbtqHEFEigjUV8=
|
|
||||||
golang.org/x/crypto v0.38.0/go.mod h1:MvrbAqul58NNYPKnOra203SB9vpuZW0e+RRZV+Ggqjw=
|
|
||||||
golang.org/x/crypto v0.39.0 h1:SHs+kF4LP+f+p14esP5jAoDpHU8Gu/v9lFRK6IT5imM=
|
golang.org/x/crypto v0.39.0 h1:SHs+kF4LP+f+p14esP5jAoDpHU8Gu/v9lFRK6IT5imM=
|
||||||
golang.org/x/crypto v0.39.0/go.mod h1:L+Xg3Wf6HoL4Bn4238Z6ft6KfEpN0tJGo53AAPC632U=
|
golang.org/x/crypto v0.39.0/go.mod h1:L+Xg3Wf6HoL4Bn4238Z6ft6KfEpN0tJGo53AAPC632U=
|
||||||
golang.org/x/image v0.25.0 h1:Y6uW6rH1y5y/LK1J8BPWZtr6yZ7hrsy6hFrXjgsc2fQ=
|
golang.org/x/image v0.25.0 h1:Y6uW6rH1y5y/LK1J8BPWZtr6yZ7hrsy6hFrXjgsc2fQ=
|
||||||
@ -111,8 +107,6 @@ golang.org/x/net v0.40.0/go.mod h1:y0hY0exeL2Pku80/zKK7tpntoX23cqL3Oa6njdgRtds=
|
|||||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.14.0 h1:woo0S4Yywslg6hp4eUFjTVOyKt0RookbpAHG4c1HmhQ=
|
|
||||||
golang.org/x/sync v0.14.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
|
|
||||||
golang.org/x/sync v0.15.0 h1:KWH3jNZsfyT6xfAfKiz6MRNmd46ByHDYaZ7KSkCtdW8=
|
golang.org/x/sync v0.15.0 h1:KWH3jNZsfyT6xfAfKiz6MRNmd46ByHDYaZ7KSkCtdW8=
|
||||||
golang.org/x/sync v0.15.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
|
golang.org/x/sync v0.15.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
|
||||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
@ -140,8 +134,6 @@ golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ=
|
|||||||
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
||||||
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
|
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
|
||||||
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
|
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
|
||||||
golang.org/x/text v0.25.0 h1:qVyWApTSYLk/drJRO5mDlNYskwQznZmkpV2c8q9zls4=
|
|
||||||
golang.org/x/text v0.25.0/go.mod h1:WEdwpYrmk1qmdHvhkSTNPm3app7v4rsT8F2UD6+VHIA=
|
|
||||||
golang.org/x/text v0.26.0 h1:P42AVeLghgTYr4+xUnTRKDMqpar+PtX7KWuNQL21L8M=
|
golang.org/x/text v0.26.0 h1:P42AVeLghgTYr4+xUnTRKDMqpar+PtX7KWuNQL21L8M=
|
||||||
golang.org/x/text v0.26.0/go.mod h1:QK15LZJUUQVJxhz7wXgxSy/CJaTFjd0G+YLonydOVQA=
|
golang.org/x/text v0.26.0/go.mod h1:QK15LZJUUQVJxhz7wXgxSy/CJaTFjd0G+YLonydOVQA=
|
||||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||||
|
@ -135,6 +135,9 @@ const (
|
|||||||
// TipLineupsAlreadyMax 需要上级天赋满级
|
// TipLineupsAlreadyMax 需要上级天赋满级
|
||||||
TipLineupsAlreadyMax StringTipError = "LineupsAlreadyMax"
|
TipLineupsAlreadyMax StringTipError = "LineupsAlreadyMax"
|
||||||
|
|
||||||
|
// TipLineupCanNotDelete 阵容无法删除
|
||||||
|
TipLineupCanNotDelete StringTipError = "LineupCanNotDelete"
|
||||||
|
|
||||||
// ----------------------- 关卡模块 -----------------------
|
// ----------------------- 关卡模块 -----------------------
|
||||||
|
|
||||||
// TipCopyNotFound 找不到副本
|
// TipCopyNotFound 找不到副本
|
||||||
|
@ -30,7 +30,7 @@ message HeroListAck {
|
|||||||
// 有新英雄增加,英雄数据发生改变,或者英雄被消耗掉需要从列表删除时返回的消息
|
// 有新英雄增加,英雄数据发生改变,或者英雄被消耗掉需要从列表删除时返回的消息
|
||||||
message HeroChange {
|
message HeroChange {
|
||||||
ChangeType ChangeType = 1;
|
ChangeType ChangeType = 1;
|
||||||
Hero Hero = 2;
|
Hero Hero = 2; //ChangeType=ChangeType.Delete时, Hero中只有Uid有值,用于索引删除
|
||||||
}
|
}
|
||||||
|
|
||||||
// MsgId.ModHeroChang: 5002
|
// MsgId.ModHeroChang: 5002
|
||||||
|
@ -30,7 +30,7 @@ message ItemListAck {
|
|||||||
// 其他类似带Change的消息基本都是这样的操作。
|
// 其他类似带Change的消息基本都是这样的操作。
|
||||||
message ItemChange {
|
message ItemChange {
|
||||||
ChangeType ChangeType = 1;
|
ChangeType ChangeType = 1;
|
||||||
Item Item = 2;
|
Item Item = 2; //ChangeType=ChangeType.Delete时, Item中只有Uid有值,用于索引删除
|
||||||
}
|
}
|
||||||
|
|
||||||
// MsgId.ModItemChange: 6002
|
// MsgId.ModItemChange: 6002
|
||||||
@ -84,7 +84,7 @@ message EquipListAck {
|
|||||||
|
|
||||||
message EquipChange {
|
message EquipChange {
|
||||||
ChangeType ChangeType = 1;
|
ChangeType ChangeType = 1;
|
||||||
Equip Equip = 2;
|
Equip Equip = 2; //ChangeType=ChangeType.Delete时, Equip中只有Uid有值,用于索引删除
|
||||||
}
|
}
|
||||||
|
|
||||||
// MsgId.ModEquipChange: 6012
|
// MsgId.ModEquipChange: 6012
|
||||||
@ -126,7 +126,7 @@ message TreasureListAck {
|
|||||||
|
|
||||||
message TreasureChange {
|
message TreasureChange {
|
||||||
ChangeType ChangeType = 1;
|
ChangeType ChangeType = 1;
|
||||||
Treasure Treasure = 2;
|
Treasure Treasure = 2; //ChangeType=ChangeType.Delete时, Treasure中只有Uid有值,用于索引删除
|
||||||
}
|
}
|
||||||
|
|
||||||
// MsgId.ModItemTreasureChange = 6022;
|
// MsgId.ModItemTreasureChange = 6022;
|
||||||
|
@ -113,14 +113,14 @@ message LineupHeroChangeReq {
|
|||||||
uint64 HeroUid = 3;
|
uint64 HeroUid = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
// MsgId.ModRoleBattleHeroPosition = 2008;
|
// MsgId.ModRoleLineupHeroPosition = 2008;
|
||||||
// 阵容英雄布阵位置变更请求
|
// 阵容英雄布阵位置变更请求
|
||||||
message LineupHeroPositionReq {
|
message LineupHeroPositionReq {
|
||||||
uint64 LineupUid = 1;
|
uint64 LineupUid = 1;
|
||||||
repeated uint32 PositionList = 3; // 阵容英雄列表中前,6个英雄新布阵位置,布阵位置的顺序和阵容英雄列表是不一样的,布阵位置调整不影响英雄在阵容列表中的顺序。
|
repeated uint32 PositionList = 3; // 阵容英雄列表中前,6个英雄新布阵位置,布阵位置的顺序和阵容英雄列表是不一样的,布阵位置调整不影响英雄在阵容列表中的顺序。
|
||||||
}
|
}
|
||||||
|
|
||||||
// MsgId.ModRoleBattleHeroEquip = 2009;
|
// MsgId.ModRoleLineupHeroEquip = 2009;
|
||||||
// 阵容英雄装备变更请求
|
// 阵容英雄装备变更请求
|
||||||
message LineupHeroEquipReq {
|
message LineupHeroEquipReq {
|
||||||
uint64 LineupUid = 1;
|
uint64 LineupUid = 1;
|
||||||
@ -129,7 +129,7 @@ message LineupHeroEquipReq {
|
|||||||
uint64 EquipUid = 4; // 传0为卸下装备
|
uint64 EquipUid = 4; // 传0为卸下装备
|
||||||
}
|
}
|
||||||
|
|
||||||
// MsgId.ModRoleBattleHeroTreasure = 2010;
|
// MsgId.ModRoleLineupHeroTreasure = 2010;
|
||||||
// 阵容英雄宝物变更请求
|
// 阵容英雄宝物变更请求
|
||||||
message LineupHeroTreasureReq {
|
message LineupHeroTreasureReq {
|
||||||
uint64 LineupUid = 1;
|
uint64 LineupUid = 1;
|
||||||
@ -138,7 +138,7 @@ message LineupHeroTreasureReq {
|
|||||||
uint64 TreasureUid = 4; // 传0为卸下宝物
|
uint64 TreasureUid = 4; // 传0为卸下宝物
|
||||||
}
|
}
|
||||||
|
|
||||||
// MsgId.ModRoleBattleHeroArtifact = 2011;
|
// MsgId.ModRoleLineupHeroArtifact = 2011;
|
||||||
// 阵容英雄神兵变更请求
|
// 阵容英雄神兵变更请求
|
||||||
message LineupHeroArtifactReq {
|
message LineupHeroArtifactReq {
|
||||||
uint64 LineupUid = 1;
|
uint64 LineupUid = 1;
|
||||||
@ -146,7 +146,7 @@ message LineupHeroArtifactReq {
|
|||||||
uint64 ArtifactUid = 3;
|
uint64 ArtifactUid = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
// MsgId.ModRoleBattleHeroMounts = 2012;
|
// MsgId.ModRoleLineupHeroMounts = 2012;
|
||||||
// 阵容英雄坐骑变更请求
|
// 阵容英雄坐骑变更请求
|
||||||
message LineupHeroMountsReq {
|
message LineupHeroMountsReq {
|
||||||
uint64 LineupUid = 1;
|
uint64 LineupUid = 1;
|
||||||
@ -154,7 +154,7 @@ message LineupHeroMountsReq {
|
|||||||
uint64 MountsUid = 3;
|
uint64 MountsUid = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
// MsgId.ModRoleBattleHeroGeneral = 2013;
|
// MsgId.ModRoleLineupHeroGeneral = 2013;
|
||||||
// 阵容英雄名将变更请求
|
// 阵容英雄名将变更请求
|
||||||
message LineupHeroGeneralReq {
|
message LineupHeroGeneralReq {
|
||||||
uint64 LineupUid = 1;
|
uint64 LineupUid = 1;
|
||||||
@ -162,7 +162,7 @@ message LineupHeroGeneralReq {
|
|||||||
uint64 GeneralUid = 3;
|
uint64 GeneralUid = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
// MsgId.ModRoleBattleHeroOrnament = 2014;
|
// MsgId.ModRoleLineupHeroOrnament = 2014;
|
||||||
// 阵容英雄饰品变更请求
|
// 阵容英雄饰品变更请求
|
||||||
message LineupHeroOrnamentReq {
|
message LineupHeroOrnamentReq {
|
||||||
uint64 LineupUid = 1;
|
uint64 LineupUid = 1;
|
||||||
@ -178,6 +178,14 @@ message LineupHelperChangeReq{
|
|||||||
uint64 HeroUid = 3; //填0为卸下
|
uint64 HeroUid = 3; //填0为卸下
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MsgId.ModRoleLineupEquipInlay = 2016;
|
||||||
|
// 阵容英雄装备变更请求
|
||||||
|
message LineupEquipInlayReq {
|
||||||
|
uint64 LineupUid = 1;
|
||||||
|
uint32 Index = 2;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
message Lineup {
|
message Lineup {
|
||||||
uint64 Uid = 1; // 唯一ID(可以此字段排序,越晚创建的UID会越大)
|
uint64 Uid = 1; // 唯一ID(可以此字段排序,越晚创建的UID会越大)
|
||||||
string Name = 2; // 阵容名称
|
string Name = 2; // 阵容名称
|
||||||
@ -194,7 +202,7 @@ message LineupListAck {
|
|||||||
|
|
||||||
message LineupChange {
|
message LineupChange {
|
||||||
ChangeType ChangeType = 1;
|
ChangeType ChangeType = 1;
|
||||||
Lineup Lineup = 2;
|
Lineup Lineup = 2; //ChangeType=ChangeType.Delete时, Lineup中只有Uid有值,用于索引删除
|
||||||
}
|
}
|
||||||
|
|
||||||
// MsgId.ModRoleLineupChange = 2022;
|
// MsgId.ModRoleLineupChange = 2022;
|
||||||
|
@ -125,6 +125,12 @@ enum MsgId {
|
|||||||
// 援助变更
|
// 援助变更
|
||||||
ModRoleLineupHelperChange = 2015;
|
ModRoleLineupHelperChange = 2015;
|
||||||
|
|
||||||
|
// 装备镶嵌
|
||||||
|
ModRoleLineupEquipInlay = 2016;
|
||||||
|
|
||||||
|
// 装备镶嵌
|
||||||
|
ModRoleLineupTreasureInlay = 2017;
|
||||||
|
|
||||||
// 阵容列表
|
// 阵容列表
|
||||||
ModRoleLineupList = 2021;
|
ModRoleLineupList = 2021;
|
||||||
|
|
||||||
|
40
servers/game/data/skill.go
Normal file
40
servers/game/data/skill.go
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
package data
|
||||||
|
|
||||||
|
import json "github.com/json-iterator/go"
|
||||||
|
|
||||||
|
type Skill struct {
|
||||||
|
Id int `json:"id"`
|
||||||
|
SkillType int `json:"skill_type"`
|
||||||
|
SkillBuff []int `json:"skill_buff"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type SkillTable struct {
|
||||||
|
l []*Skill
|
||||||
|
m map[int]*Skill
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *SkillTable) load(buf []byte) error {
|
||||||
|
var err = json.Unmarshal(buf, &this.l)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
this.m = make(map[int]*Skill)
|
||||||
|
for i := range this.l {
|
||||||
|
this.m[this.l[i].Id] = this.l[i]
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *SkillTable) List() []*Skill {
|
||||||
|
return this.l
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *SkillTable) Get(i int) *Skill {
|
||||||
|
return this.l[i]
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *SkillTable) Find(id int) *Skill {
|
||||||
|
return this.m[id]
|
||||||
|
}
|
40
servers/game/data/skill_buff.go
Normal file
40
servers/game/data/skill_buff.go
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
package data
|
||||||
|
|
||||||
|
import json "github.com/json-iterator/go"
|
||||||
|
|
||||||
|
type SkillBuff struct {
|
||||||
|
Id int `json:"id"`
|
||||||
|
SkillBuffType int `json:"SkillBuff_type"`
|
||||||
|
SkillBuffBuff []int `json:"SkillBuff_buff"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type SkillBuffTable struct {
|
||||||
|
l []*SkillBuff
|
||||||
|
m map[int]*SkillBuff
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *SkillBuffTable) load(buf []byte) error {
|
||||||
|
var err = json.Unmarshal(buf, &this.l)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
this.m = make(map[int]*SkillBuff)
|
||||||
|
for i := range this.l {
|
||||||
|
this.m[this.l[i].Id] = this.l[i]
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *SkillBuffTable) List() []*SkillBuff {
|
||||||
|
return this.l
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *SkillBuffTable) Get(i int) *SkillBuff {
|
||||||
|
return this.l[i]
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *SkillBuffTable) Find(id int) *SkillBuff {
|
||||||
|
return this.m[id]
|
||||||
|
}
|
@ -34,6 +34,8 @@ type Tables struct {
|
|||||||
Monster MonsterTable
|
Monster MonsterTable
|
||||||
Scene SceneTable
|
Scene SceneTable
|
||||||
ServerConfig ServerConfigTable
|
ServerConfig ServerConfigTable
|
||||||
|
Skill SkillTable
|
||||||
|
SkillBuff SkillBuffTable
|
||||||
Treasure TreasureTable
|
Treasure TreasureTable
|
||||||
TreasureLevel TreasureLevelTable
|
TreasureLevel TreasureLevelTable
|
||||||
TreasureRefine TreasureRefineTable
|
TreasureRefine TreasureRefineTable
|
||||||
|
@ -61,3 +61,15 @@ func (this *UpgradeMasterTable) Find1(tipe int) []*UpgradeMaster {
|
|||||||
func (this *UpgradeMasterTable) Find2(tipe, level int) *UpgradeMaster {
|
func (this *UpgradeMasterTable) Find2(tipe, level int) *UpgradeMaster {
|
||||||
return this.m2[util.Compose2uint32(uint32(tipe), uint32(level))]
|
return this.m2[util.Compose2uint32(uint32(tipe), uint32(level))]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *UpgradeMasterTable) FindMax(tipe, minLevel int) *UpgradeMaster {
|
||||||
|
var l = this.Find1(tipe)
|
||||||
|
var t *UpgradeMaster
|
||||||
|
for i := range l {
|
||||||
|
if l[i].NeedLevel >= minLevel {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
t = l[i]
|
||||||
|
}
|
||||||
|
return t
|
||||||
|
}
|
||||||
|
@ -124,7 +124,7 @@ func (this *PlayerHandler) GmCommand(player *logic.Player, msg *net.Message) {
|
|||||||
player.WipeModel(item)
|
player.WipeModel(item)
|
||||||
|
|
||||||
_ = player.Send(uint16(pb.ModId_ModuleItem), uint16(pb.MsgId_ModItemChange), &pb.ItemChangeListAck{
|
_ = player.Send(uint16(pb.ModId_ModuleItem), uint16(pb.MsgId_ModItemChange), &pb.ItemChangeListAck{
|
||||||
ChangeList: []*pb.ItemChange{{Item: item.BuildMsgItem(), ChangeType: pb.ChangeType_Delete}},
|
ChangeList: []*pb.ItemChange{{ChangeType: pb.ChangeType_Delete, Item: item.BuildMsgItem(true)}},
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ import (
|
|||||||
"ecs/servers/game/logic"
|
"ecs/servers/game/logic"
|
||||||
"github.com/oylshe1314/framework/net"
|
"github.com/oylshe1314/framework/net"
|
||||||
"github.com/oylshe1314/framework/util"
|
"github.com/oylshe1314/framework/util"
|
||||||
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -320,6 +321,7 @@ func (this *PlayerHandler) LineupHeroEquip(player *logic.Player, msg *net.Messag
|
|||||||
}
|
}
|
||||||
|
|
||||||
var lineupHeroList []*pb.LineupHero
|
var lineupHeroList []*pb.LineupHero
|
||||||
|
var heroChangeList []*pb.HeroChange
|
||||||
var equipChangeList []*pb.EquipChange
|
var equipChangeList []*pb.EquipChange
|
||||||
|
|
||||||
if lineupHero.Equip[req.EquipType] != 0 {
|
if lineupHero.Equip[req.EquipType] != 0 {
|
||||||
@ -338,6 +340,12 @@ func (this *PlayerHandler) LineupHeroEquip(player *logic.Player, msg *net.Messag
|
|||||||
player.SaveArray("lineup.heroes", int(req.Index), lineupHero)
|
player.SaveArray("lineup.heroes", int(req.Index), lineupHero)
|
||||||
lineupHeroList = append(lineupHeroList, lineupHero.BuildMsgLineupHero(req.Index))
|
lineupHeroList = append(lineupHeroList, lineupHero.BuildMsgLineupHero(req.Index))
|
||||||
|
|
||||||
|
if hero, ok := player.Hero[lineupHero.HeroUid]; ok {
|
||||||
|
if player.UpdateHeroAttrs(hero) {
|
||||||
|
heroChangeList = append(heroChangeList, &pb.HeroChange{ChangeType: pb.ChangeType_Changed, Hero: hero.BuildMsgHero()})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if equip != nil {
|
if equip != nil {
|
||||||
if equip.HeroUid != 0 {
|
if equip.HeroUid != 0 {
|
||||||
util.SliceFindValue(lineup.Heroes[:], func(i int) bool {
|
util.SliceFindValue(lineup.Heroes[:], func(i int) bool {
|
||||||
@ -351,6 +359,11 @@ func (this *PlayerHandler) LineupHeroEquip(player *logic.Player, msg *net.Messag
|
|||||||
preLineupHero.Equip[req.EquipType] = 0
|
preLineupHero.Equip[req.EquipType] = 0
|
||||||
player.SaveArray("lineup.heroes", i, preLineupHero)
|
player.SaveArray("lineup.heroes", i, preLineupHero)
|
||||||
lineupHeroList = append(lineupHeroList, preLineupHero.BuildMsgLineupHero(uint32(i)))
|
lineupHeroList = append(lineupHeroList, preLineupHero.BuildMsgLineupHero(uint32(i)))
|
||||||
|
if preHero, ok := player.Hero[preLineupHero.HeroUid]; ok {
|
||||||
|
if player.UpdateHeroAttrs(preHero) {
|
||||||
|
heroChangeList = append(heroChangeList, &pb.HeroChange{ChangeType: pb.ChangeType_Changed, Hero: preHero.BuildMsgHero()})
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
@ -370,6 +383,7 @@ func (this *PlayerHandler) LineupHeroEquip(player *logic.Player, msg *net.Messag
|
|||||||
ChangeList: []*pb.LineupChange{{ChangeType: pb.ChangeType_Changed, Lineup: lineup.BuildMsgLineup()}},
|
ChangeList: []*pb.LineupChange{{ChangeType: pb.ChangeType_Changed, Lineup: lineup.BuildMsgLineup()}},
|
||||||
})
|
})
|
||||||
_ = player.Send(uint16(pb.ModId_ModuleItem), uint16(pb.MsgId_ModItemEquipChange), &pb.EquipChangeListAck{ChangeList: equipChangeList})
|
_ = player.Send(uint16(pb.ModId_ModuleItem), uint16(pb.MsgId_ModItemEquipChange), &pb.EquipChangeListAck{ChangeList: equipChangeList})
|
||||||
|
_ = player.Send(uint16(pb.ModId_ModuleHero), uint16(pb.MsgId_ModHeroChange), &pb.HeroChangeListAck{ChangeList: heroChangeList})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -439,6 +453,7 @@ func (this *PlayerHandler) LineupHeroTreasure(player *logic.Player, msg *net.Mes
|
|||||||
}
|
}
|
||||||
|
|
||||||
var lineupHeroList []*pb.LineupHero
|
var lineupHeroList []*pb.LineupHero
|
||||||
|
var heroChangeList []*pb.HeroChange
|
||||||
var equipChangeList []*pb.TreasureChange
|
var equipChangeList []*pb.TreasureChange
|
||||||
|
|
||||||
if lineupHero.Treasure[req.TreasureType] != 0 {
|
if lineupHero.Treasure[req.TreasureType] != 0 {
|
||||||
@ -457,6 +472,12 @@ func (this *PlayerHandler) LineupHeroTreasure(player *logic.Player, msg *net.Mes
|
|||||||
player.SaveArray("lineup.heroes", int(req.Index), lineupHero)
|
player.SaveArray("lineup.heroes", int(req.Index), lineupHero)
|
||||||
lineupHeroList = append(lineupHeroList, lineupHero.BuildMsgLineupHero(req.Index))
|
lineupHeroList = append(lineupHeroList, lineupHero.BuildMsgLineupHero(req.Index))
|
||||||
|
|
||||||
|
if hero, ok := player.Hero[lineupHero.HeroUid]; ok {
|
||||||
|
if player.UpdateHeroAttrs(hero) {
|
||||||
|
heroChangeList = append(heroChangeList, &pb.HeroChange{ChangeType: pb.ChangeType_Changed, Hero: hero.BuildMsgHero()})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if treasure != nil {
|
if treasure != nil {
|
||||||
if treasure.HeroUid != 0 {
|
if treasure.HeroUid != 0 {
|
||||||
util.SliceFindValue(lineup.Heroes[:], func(i int) bool {
|
util.SliceFindValue(lineup.Heroes[:], func(i int) bool {
|
||||||
@ -470,6 +491,12 @@ func (this *PlayerHandler) LineupHeroTreasure(player *logic.Player, msg *net.Mes
|
|||||||
preLineupHero.Treasure[req.TreasureType] = 0
|
preLineupHero.Treasure[req.TreasureType] = 0
|
||||||
player.SaveArray("lineup.heroes", i, preLineupHero)
|
player.SaveArray("lineup.heroes", i, preLineupHero)
|
||||||
lineupHeroList = append(lineupHeroList, preLineupHero.BuildMsgLineupHero(uint32(i)))
|
lineupHeroList = append(lineupHeroList, preLineupHero.BuildMsgLineupHero(uint32(i)))
|
||||||
|
|
||||||
|
if preHero, ok := player.Hero[preLineupHero.HeroUid]; ok {
|
||||||
|
if player.UpdateHeroAttrs(preHero) {
|
||||||
|
heroChangeList = append(heroChangeList, &pb.HeroChange{ChangeType: pb.ChangeType_Changed, Hero: preHero.BuildMsgHero()})
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
@ -489,6 +516,7 @@ func (this *PlayerHandler) LineupHeroTreasure(player *logic.Player, msg *net.Mes
|
|||||||
ChangeList: []*pb.LineupChange{{ChangeType: pb.ChangeType_Changed, Lineup: lineup.BuildMsgLineup()}},
|
ChangeList: []*pb.LineupChange{{ChangeType: pb.ChangeType_Changed, Lineup: lineup.BuildMsgLineup()}},
|
||||||
})
|
})
|
||||||
_ = player.Send(uint16(pb.ModId_ModuleItem), uint16(pb.MsgId_ModItemTreasureChange), &pb.TreasureChangeListAck{ChangeList: equipChangeList})
|
_ = player.Send(uint16(pb.ModId_ModuleItem), uint16(pb.MsgId_ModItemTreasureChange), &pb.TreasureChangeListAck{ChangeList: equipChangeList})
|
||||||
|
_ = player.Send(uint16(pb.ModId_ModuleHero), uint16(pb.MsgId_ModHeroChange), &pb.HeroChangeListAck{ChangeList: heroChangeList})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -540,6 +568,17 @@ func (this *PlayerHandler) LineupHelperChange(player *logic.Player, msg *net.Mes
|
|||||||
_ = player.Send(uint16(pb.ModId_ModuleRole), uint16(pb.MsgId_ModRoleLineupChange), &pb.LineupChangeListAck{
|
_ = player.Send(uint16(pb.ModId_ModuleRole), uint16(pb.MsgId_ModRoleLineupChange), &pb.LineupChangeListAck{
|
||||||
ChangeList: []*pb.LineupChange{{ChangeType: pb.ChangeType_Changed, Lineup: lineup.BuildMsgLineup()}},
|
ChangeList: []*pb.LineupChange{{ChangeType: pb.ChangeType_Changed, Lineup: lineup.BuildMsgLineup()}},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
player.SendLineupHeroChange(lineup)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *PlayerHandler) LineupEquipInlay(player *logic.Player, msg *net.Message) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *PlayerHandler) LineupTreasureInlay(player *logic.Player, msg *net.Message) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *PlayerHandler) LineupCreate(player *logic.Player, msg *net.Message) {
|
func (this *PlayerHandler) LineupCreate(player *logic.Player, msg *net.Message) {
|
||||||
@ -631,7 +670,7 @@ func (this *PlayerHandler) LineupChangeName(player *logic.Player, msg *net.Messa
|
|||||||
player.SaveModel(lineup)
|
player.SaveModel(lineup)
|
||||||
|
|
||||||
_ = player.Send(uint16(pb.ModId_ModuleRole), uint16(pb.MsgId_ModRoleLineupChange), &pb.LineupChangeListAck{
|
_ = player.Send(uint16(pb.ModId_ModuleRole), uint16(pb.MsgId_ModRoleLineupChange), &pb.LineupChangeListAck{
|
||||||
ChangeList: []*pb.LineupChange{{ChangeType: pb.ChangeType_Changed, Lineup: lineup.BuildMsgLineup()}},
|
ChangeList: []*pb.LineupChange{{ChangeType: pb.ChangeType_Add, Lineup: lineup.BuildMsgLineup()}},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -657,13 +696,35 @@ func (this *PlayerHandler) LineupActivate(player *logic.Player, msg *net.Message
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
lineup.Active = true
|
if lineup.Active {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
var lineupChangeList []*pb.LineupChange
|
||||||
|
|
||||||
|
var preLineup *logic.PlayerLineup
|
||||||
|
for _, v := range player.Lineup {
|
||||||
|
if v.Active {
|
||||||
|
preLineup = v
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if preLineup != nil {
|
||||||
|
preLineup.Active = false
|
||||||
player.SaveModel(lineup)
|
player.SaveModel(lineup)
|
||||||
|
lineupChangeList = append(lineupChangeList, &pb.LineupChange{ChangeType: pb.ChangeType_Changed, Lineup: preLineup.BuildMsgLineup()})
|
||||||
|
}
|
||||||
|
|
||||||
|
lineup.Active = true
|
||||||
|
player.SaveModel(lineup)
|
||||||
|
lineupChangeList = append(lineupChangeList, &pb.LineupChange{ChangeType: pb.ChangeType_Changed, Lineup: lineup.BuildMsgLineup()})
|
||||||
|
|
||||||
_ = player.Send(uint16(pb.ModId_ModuleRole), uint16(pb.MsgId_ModRoleLineupChange), &pb.LineupChangeListAck{
|
_ = player.Send(uint16(pb.ModId_ModuleRole), uint16(pb.MsgId_ModRoleLineupChange), &pb.LineupChangeListAck{
|
||||||
ChangeList: []*pb.LineupChange{{ChangeType: pb.ChangeType_Changed, Lineup: lineup.BuildMsgLineup()}},
|
ChangeList: []*pb.LineupChange{{ChangeType: pb.ChangeType_Changed, Lineup: lineup.BuildMsgLineup()}},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
player.SendLineupHeroChange(preLineup, lineup)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *PlayerHandler) LineupDelete(player *logic.Player, msg *net.Message) {
|
func (this *PlayerHandler) LineupDelete(player *logic.Player, msg *net.Message) {
|
||||||
@ -681,20 +742,45 @@ func (this *PlayerHandler) LineupDelete(player *logic.Player, msg *net.Message)
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
var lineup = player.Lineup[req.Uid]
|
var delLineup = player.Lineup[req.Uid]
|
||||||
if lineup == nil {
|
if delLineup == nil {
|
||||||
this.logger.Error("Player lineup not found, req.Uid: ", req.Uid)
|
this.logger.Error("Player lineup not found, req.Uid: ", req.Uid)
|
||||||
_ = player.TipNotice(proto.TipLineupNotFound)
|
_ = player.TipNotice(proto.TipLineupNotFound)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
delete(player.Lineup, req.Uid)
|
if len(player.Lineup) == 1 {
|
||||||
|
this.logger.Error("Player lineup can not delete, len(player.Lineup) == 1")
|
||||||
|
_ = player.TipNotice(proto.TipLineupCanNotDelete)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
var lineupChangeList []*pb.LineupChange
|
||||||
|
|
||||||
|
delLineup.Active = false
|
||||||
|
delete(player.Lineup, delLineup.Uid)
|
||||||
|
player.WipeModel(delLineup)
|
||||||
|
lineupChangeList = append(lineupChangeList, &pb.LineupChange{ChangeType: pb.ChangeType_Delete, Lineup: delLineup.BuildMsgLineup()})
|
||||||
|
|
||||||
|
var lineupList = make([]*logic.PlayerLineup, 0, len(player.Lineup))
|
||||||
|
for _, v := range player.Lineup {
|
||||||
|
lineupList = append(lineupList, v)
|
||||||
|
}
|
||||||
|
|
||||||
|
sort.Slice(lineupList, func(i, j int) bool {
|
||||||
|
return lineupList[i].Uid < lineupList[j].Uid
|
||||||
|
})
|
||||||
|
|
||||||
|
var lineup = lineupList[0]
|
||||||
|
lineup.Active = true
|
||||||
player.WipeModel(lineup)
|
player.WipeModel(lineup)
|
||||||
|
lineupChangeList = append(lineupChangeList, &pb.LineupChange{ChangeType: pb.ChangeType_Changed, Lineup: lineup.BuildMsgLineup()})
|
||||||
|
|
||||||
_ = player.Send(uint16(pb.ModId_ModuleRole), uint16(pb.MsgId_ModRoleLineupChange), &pb.LineupChangeListAck{
|
_ = player.Send(uint16(pb.ModId_ModuleRole), uint16(pb.MsgId_ModRoleLineupChange), &pb.LineupChangeListAck{
|
||||||
ChangeList: []*pb.LineupChange{{ChangeType: pb.ChangeType_Delete, Lineup: lineup.BuildMsgLineup()}},
|
ChangeList: lineupChangeList,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
player.SendLineupHeroChange(delLineup, lineup)
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -175,7 +175,7 @@ func (this *PlayerManager) storeChanges(player *Player) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (this *PlayerManager) tick(player *Player, now, elapsed int64) int64 {
|
func (this *PlayerManager) tick(player *Player, now, elapsed int64) int64 {
|
||||||
player.lock() // lock
|
player.lock()
|
||||||
defer player.unlock()
|
defer player.unlock()
|
||||||
|
|
||||||
this.clearChanges(player)
|
this.clearChanges(player)
|
||||||
@ -185,7 +185,6 @@ func (this *PlayerManager) tick(player *Player, now, elapsed int64) int64 {
|
|||||||
var e = util.UnixMilli()
|
var e = util.UnixMilli()
|
||||||
|
|
||||||
this.storeChanges(player)
|
this.storeChanges(player)
|
||||||
|
|
||||||
return e - b
|
return e - b
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -236,7 +235,7 @@ func (this *PlayerManager) NewPlayer() *Player {
|
|||||||
Artifact: map[uint64]*PlayerArtifact{},
|
Artifact: map[uint64]*PlayerArtifact{},
|
||||||
//Achievement: map[uint64]*PlayerAchievement{},
|
//Achievement: map[uint64]*PlayerAchievement{},
|
||||||
//BattlePass: map[uint32]*PlayerBattlePass{},
|
//BattlePass: map[uint32]*PlayerBattlePass{},
|
||||||
//Cdkey: map[string]*PlayerCdkey{},
|
//CdKey: map[string]*PlayerCdKey{},
|
||||||
//CopyPassed: map[uint32]*PlayerCopyPassed{},
|
//CopyPassed: map[uint32]*PlayerCopyPassed{},
|
||||||
//CopySpeed: map[uint32]*PlayerCopySpeed{},
|
//CopySpeed: map[uint32]*PlayerCopySpeed{},
|
||||||
//CopyStatus: map[uint64]*PlayerCopyStatus{},
|
//CopyStatus: map[uint64]*PlayerCopyStatus{},
|
||||||
|
@ -4,6 +4,7 @@ import (
|
|||||||
"ecs/proto/pb"
|
"ecs/proto/pb"
|
||||||
"ecs/servers/game/data"
|
"ecs/servers/game/data"
|
||||||
"github.com/oylshe1314/framework/util"
|
"github.com/oylshe1314/framework/util"
|
||||||
|
"math"
|
||||||
"slices"
|
"slices"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -23,7 +24,10 @@ type PlayerHero struct {
|
|||||||
attrs Attrs
|
attrs Attrs
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *PlayerHero) BuildMsgHero() *pb.Hero {
|
func (this *PlayerHero) BuildMsgHero(deleted ...bool) *pb.Hero {
|
||||||
|
if len(deleted) > 0 && deleted[0] {
|
||||||
|
return &pb.Hero{Uid: this.Uid}
|
||||||
|
}
|
||||||
return &pb.Hero{
|
return &pb.Hero{
|
||||||
Uid: this.Uid,
|
Uid: this.Uid,
|
||||||
Id: this.Id,
|
Id: this.Id,
|
||||||
@ -234,16 +238,50 @@ func (this *Player) calcHeroEquipsAttrs(hero *PlayerHero, lineup *PlayerLineup,
|
|||||||
if lineup == nil || lineupHero == nil {
|
if lineup == nil || lineupHero == nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var minLevel uint32
|
||||||
|
var minRefineLevel uint32
|
||||||
|
var masterTable *data.UpgradeMaster
|
||||||
|
|
||||||
|
minLevel = math.MaxUint32
|
||||||
for _, equipUid := range lineupHero.Equip {
|
for _, equipUid := range lineupHero.Equip {
|
||||||
if equipUid == 0 {
|
if equipUid == 0 {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
var equip = this.Equip[equipUid]
|
if equip := this.Equip[equipUid]; equip != nil {
|
||||||
var equipLevelTable = this.manager.tables.EquipLevel.Find3(int(equip.Id), int(equip.Level))
|
var equipLevelTable = this.manager.tables.EquipLevel.Find3(int(equip.Id), int(equip.Level))
|
||||||
if equipLevelTable != nil {
|
if equipLevelTable != nil {
|
||||||
attrs[equipLevelTable.AttrType] += uint64(equipLevelTable.AttrValue)
|
attrs[equipLevelTable.AttrType] += uint64(equipLevelTable.AttrValue)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if equip.Level < minLevel {
|
||||||
|
minLevel = equip.Level
|
||||||
|
}
|
||||||
|
if equip.RefineLevel < minRefineLevel {
|
||||||
|
minRefineLevel = equip.RefineLevel
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
masterTable = this.manager.tables.UpgradeMaster.FindMax(int(pb.UpgradeMasterType_MasterEquipUpgrade), int(minLevel))
|
||||||
|
if masterTable != nil {
|
||||||
|
attrs[masterTable.AttrType1] = uint64(masterTable.AttrValue1)
|
||||||
|
attrs[masterTable.AttrType2] = uint64(masterTable.AttrValue2)
|
||||||
|
attrs[masterTable.AttrType3] = uint64(masterTable.AttrValue3)
|
||||||
|
attrs[masterTable.AttrType4] = uint64(masterTable.AttrValue4)
|
||||||
|
attrs[masterTable.AttrType5] = uint64(masterTable.AttrValue5)
|
||||||
|
attrs[masterTable.AttrType6] = uint64(masterTable.AttrValue6)
|
||||||
|
}
|
||||||
|
|
||||||
|
masterTable = this.manager.tables.UpgradeMaster.FindMax(int(pb.UpgradeMasterType_MasterEquipUpgrade), int(minRefineLevel))
|
||||||
|
if masterTable != nil {
|
||||||
|
attrs[masterTable.AttrType1] = uint64(masterTable.AttrValue1)
|
||||||
|
attrs[masterTable.AttrType2] = uint64(masterTable.AttrValue2)
|
||||||
|
attrs[masterTable.AttrType3] = uint64(masterTable.AttrValue3)
|
||||||
|
attrs[masterTable.AttrType4] = uint64(masterTable.AttrValue4)
|
||||||
|
attrs[masterTable.AttrType5] = uint64(masterTable.AttrValue5)
|
||||||
|
attrs[masterTable.AttrType6] = uint64(masterTable.AttrValue6)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -252,16 +290,50 @@ func (this *Player) calcHeroTreasuresAttrs(hero *PlayerHero, lineup *PlayerLineu
|
|||||||
if lineup == nil || lineupHero == nil {
|
if lineup == nil || lineupHero == nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var minLevel uint32
|
||||||
|
var minRefineLevel uint32
|
||||||
|
var masterTable *data.UpgradeMaster
|
||||||
|
|
||||||
|
minLevel = math.MaxUint32
|
||||||
for _, treasureUid := range lineupHero.Treasure {
|
for _, treasureUid := range lineupHero.Treasure {
|
||||||
if treasureUid == 0 {
|
if treasureUid == 0 {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
var treasure = this.Treasure[treasureUid]
|
if treasure := this.Treasure[treasureUid]; treasure != nil {
|
||||||
var treasureLevelTable = this.manager.tables.TreasureLevel.Find3(int(treasure.Id), int(treasure.Level))
|
var treasureLevelTable = this.manager.tables.TreasureLevel.Find3(int(treasure.Id), int(treasure.Level))
|
||||||
if treasureLevelTable != nil {
|
if treasureLevelTable != nil {
|
||||||
attrs[treasureLevelTable.AttrType] += uint64(treasureLevelTable.AttrValue)
|
attrs[treasureLevelTable.AttrType] += uint64(treasureLevelTable.AttrValue)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if treasure.Level < minLevel {
|
||||||
|
minLevel = treasure.Level
|
||||||
|
}
|
||||||
|
if treasure.RefineLevel < minRefineLevel {
|
||||||
|
minRefineLevel = treasure.RefineLevel
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
masterTable = this.manager.tables.UpgradeMaster.FindMax(int(pb.UpgradeMasterType_MasterTreasureUpgrade), int(minLevel))
|
||||||
|
if masterTable != nil {
|
||||||
|
attrs[masterTable.AttrType1] = uint64(masterTable.AttrValue1)
|
||||||
|
attrs[masterTable.AttrType2] = uint64(masterTable.AttrValue2)
|
||||||
|
attrs[masterTable.AttrType3] = uint64(masterTable.AttrValue3)
|
||||||
|
attrs[masterTable.AttrType4] = uint64(masterTable.AttrValue4)
|
||||||
|
attrs[masterTable.AttrType5] = uint64(masterTable.AttrValue5)
|
||||||
|
attrs[masterTable.AttrType6] = uint64(masterTable.AttrValue6)
|
||||||
|
}
|
||||||
|
|
||||||
|
masterTable = this.manager.tables.UpgradeMaster.FindMax(int(pb.UpgradeMasterType_MasterTreasureRefine), int(minRefineLevel))
|
||||||
|
if masterTable != nil {
|
||||||
|
attrs[masterTable.AttrType1] = uint64(masterTable.AttrValue1)
|
||||||
|
attrs[masterTable.AttrType2] = uint64(masterTable.AttrValue2)
|
||||||
|
attrs[masterTable.AttrType3] = uint64(masterTable.AttrValue3)
|
||||||
|
attrs[masterTable.AttrType4] = uint64(masterTable.AttrValue4)
|
||||||
|
attrs[masterTable.AttrType5] = uint64(masterTable.AttrValue5)
|
||||||
|
attrs[masterTable.AttrType6] = uint64(masterTable.AttrValue6)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -288,14 +360,12 @@ func (this *Player) calcHeroAttrs(hero *PlayerHero, attrsList ...Attrs) bool {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for i := range newAttrs {
|
if newAttrs == hero.attrs {
|
||||||
if hero.attrs[i] != newAttrs[i] {
|
return false
|
||||||
hero.attrs = newAttrs
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false
|
hero.attrs = newAttrs
|
||||||
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *Player) updateHeroAttrs(hero *PlayerHero, lineup *PlayerLineup, lineupHero *PlayerLineupHero) bool {
|
func (this *Player) updateHeroAttrs(hero *PlayerHero, lineup *PlayerLineup, lineupHero *PlayerLineupHero) bool {
|
||||||
|
@ -12,7 +12,10 @@ type PlayerItem struct {
|
|||||||
Expired int64 `bson:"expired"`
|
Expired int64 `bson:"expired"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *PlayerItem) BuildMsgItem() *pb.Item {
|
func (this *PlayerItem) BuildMsgItem(deleted ...bool) *pb.Item {
|
||||||
|
if len(deleted) > 0 && deleted[0] {
|
||||||
|
return &pb.Item{ItemId: this.Id}
|
||||||
|
}
|
||||||
return &pb.Item{ItemId: this.Id, ItemNum: this.Num, Expired: this.Expired}
|
return &pb.Item{ItemId: this.Id, ItemNum: this.Num, Expired: this.Expired}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -194,17 +197,19 @@ func (this *Player) reduceItem(itemId, itemNum uint32, logType LogType) {
|
|||||||
|
|
||||||
item.Num -= itemNum
|
item.Num -= itemNum
|
||||||
|
|
||||||
|
var deleted = false
|
||||||
var changeType pb.ChangeType
|
var changeType pb.ChangeType
|
||||||
if item.Num == 0 {
|
if item.Num == 0 {
|
||||||
delete(this.Item, item.Id)
|
delete(this.Item, item.Id)
|
||||||
this.WipeModel(item)
|
this.WipeModel(item)
|
||||||
|
deleted = true
|
||||||
changeType = pb.ChangeType_Delete
|
changeType = pb.ChangeType_Delete
|
||||||
} else {
|
} else {
|
||||||
this.SaveModel(item)
|
this.SaveModel(item)
|
||||||
changeType = pb.ChangeType_Changed
|
changeType = pb.ChangeType_Changed
|
||||||
}
|
}
|
||||||
|
|
||||||
_ = this.Send(uint16(pb.ModId_ModuleItem), uint16(pb.MsgId_ModItemChange), &pb.ItemChangeListAck{ChangeList: []*pb.ItemChange{{Item: item.BuildMsgItem(), ChangeType: changeType}}})
|
_ = this.Send(uint16(pb.ModId_ModuleItem), uint16(pb.MsgId_ModItemChange), &pb.ItemChangeListAck{ChangeList: []*pb.ItemChange{{Item: item.BuildMsgItem(deleted), ChangeType: changeType}}})
|
||||||
|
|
||||||
//if logType > LogTypeNone {
|
//if logType > LogTypeNone {
|
||||||
// this.manager.eventManager.PlayerItemConsume(this, logType, itemId, itemNum)
|
// this.manager.eventManager.PlayerItemConsume(this, logType, itemId, itemNum)
|
||||||
|
@ -15,7 +15,10 @@ type PlayerLineup struct {
|
|||||||
Helper [8]uint64 `bson:"helper"`
|
Helper [8]uint64 `bson:"helper"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *PlayerLineup) BuildMsgLineup() *pb.Lineup {
|
func (this *PlayerLineup) BuildMsgLineup(deleted ...bool) *pb.Lineup {
|
||||||
|
if len(deleted) > 0 && deleted[0] {
|
||||||
|
return &pb.Lineup{Uid: this.Uid}
|
||||||
|
}
|
||||||
var msg = &pb.Lineup{Uid: this.Uid, Name: this.Name, Active: this.Active}
|
var msg = &pb.Lineup{Uid: this.Uid, Name: this.Name, Active: this.Active}
|
||||||
if this.Active {
|
if this.Active {
|
||||||
msg.HeroList = make([]*pb.LineupHero, 8)
|
msg.HeroList = make([]*pb.LineupHero, 8)
|
||||||
@ -31,11 +34,46 @@ func (this *PlayerLineup) BuildMsgLineup() *pb.Lineup {
|
|||||||
return msg
|
return msg
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *Player) SendLineupHeroChange(lineups ...*PlayerLineup) {
|
||||||
|
var heroChangeList []*pb.HeroChange
|
||||||
|
for _, lineup := range lineups {
|
||||||
|
if lineup == nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, lineupHero := range lineup.Heroes {
|
||||||
|
if lineupHero == nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
if hero, ok := this.Hero[lineupHero.HeroUid]; ok {
|
||||||
|
if lineup.Active {
|
||||||
|
if this.updateHeroAttrs(hero, lineup, lineupHero) {
|
||||||
|
heroChangeList = append(heroChangeList, &pb.HeroChange{ChangeType: pb.ChangeType_Changed, Hero: hero.BuildMsgHero()})
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if this.updateHeroAttrs(hero, nil, nil) {
|
||||||
|
heroChangeList = append(heroChangeList, &pb.HeroChange{ChangeType: pb.ChangeType_Changed, Hero: hero.BuildMsgHero()})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_ = this.Send(uint16(pb.ModId_ModuleHero), uint16(pb.MsgId_ModHeroChange), pb.HeroChangeListAck{
|
||||||
|
ChangeList: heroChangeList,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
func (this *Player) SendUpgradeMaster(masterType pb.UpgradeMasterType, preLevel, curLevel uint32, heroUid uint64) {
|
func (this *Player) SendUpgradeMaster(masterType pb.UpgradeMasterType, preLevel, curLevel uint32, heroUid uint64) {
|
||||||
if heroUid == 0 {
|
if heroUid == 0 {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var hero = this.Hero[heroUid]
|
||||||
|
if hero == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
var masterTables = this.manager.tables.UpgradeMaster.Find1(int(masterType))
|
var masterTables = this.manager.tables.UpgradeMaster.Find1(int(masterType))
|
||||||
if len(masterTables) == 0 {
|
if len(masterTables) == 0 {
|
||||||
return
|
return
|
||||||
@ -68,7 +106,7 @@ func (this *Player) SendUpgradeMaster(masterType pb.UpgradeMasterType, preLevel,
|
|||||||
}
|
}
|
||||||
|
|
||||||
var lineupHero = util.SliceFindValue(lineup.Heroes[:], func(i int) bool {
|
var lineupHero = util.SliceFindValue(lineup.Heroes[:], func(i int) bool {
|
||||||
return lineup.Heroes[i] != nil && lineup.Heroes[i].HeroUid == heroUid
|
return lineup.Heroes[i] != nil && lineup.Heroes[i].HeroUid == hero.Uid
|
||||||
})
|
})
|
||||||
if lineupHero == nil {
|
if lineupHero == nil {
|
||||||
return
|
return
|
||||||
@ -125,6 +163,12 @@ func (this *Player) SendUpgradeMaster(masterType pb.UpgradeMasterType, preLevel,
|
|||||||
}
|
}
|
||||||
|
|
||||||
_ = this.Send(uint16(pb.ModId_ModuleRole), uint16(pb.MsgId_ModRoleUpgradeMaster), ack)
|
_ = this.Send(uint16(pb.ModId_ModuleRole), uint16(pb.MsgId_ModRoleUpgradeMaster), ack)
|
||||||
|
|
||||||
|
if this.updateHeroAttrs(hero, lineup, lineupHero) {
|
||||||
|
_ = this.Send(uint16(pb.ModId_ModuleHero), uint16(pb.MsgId_ModHeroChange), pb.HeroChangeListAck{
|
||||||
|
ChangeList: []*pb.HeroChange{{ChangeType: pb.ChangeType_Changed, Hero: hero.BuildMsgHero()}},
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *Player) BuildMsgLineupListAck() *pb.LineupListAck {
|
func (this *Player) BuildMsgLineupListAck() *pb.LineupListAck {
|
||||||
|
@ -16,7 +16,10 @@ type PlayerTreasure struct {
|
|||||||
HeroUid uint64 `bson:"hero_id"`
|
HeroUid uint64 `bson:"hero_id"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *PlayerTreasure) BuildMsgTreasure() *pb.Treasure {
|
func (this *PlayerTreasure) BuildMsgTreasure(deleted ...bool) *pb.Treasure {
|
||||||
|
if len(deleted) > 0 && deleted[0] {
|
||||||
|
return &pb.Treasure{Uid: this.Uid}
|
||||||
|
}
|
||||||
return &pb.Treasure{
|
return &pb.Treasure{
|
||||||
Uid: this.Uid,
|
Uid: this.Uid,
|
||||||
Id: this.Id,
|
Id: this.Id,
|
||||||
|
@ -163,6 +163,8 @@ func (this *gameServer) Init() (err error) {
|
|||||||
this.playerManager.Handler(uint16(pb.ModId_ModuleRole), uint16(pb.MsgId_ModRoleLineupHeroGeneral), this.playerHandler.LineupHeroGeneral)
|
this.playerManager.Handler(uint16(pb.ModId_ModuleRole), uint16(pb.MsgId_ModRoleLineupHeroGeneral), this.playerHandler.LineupHeroGeneral)
|
||||||
this.playerManager.Handler(uint16(pb.ModId_ModuleRole), uint16(pb.MsgId_ModRoleLineupHeroOrnament), this.playerHandler.LineupHeroOrnament)
|
this.playerManager.Handler(uint16(pb.ModId_ModuleRole), uint16(pb.MsgId_ModRoleLineupHeroOrnament), this.playerHandler.LineupHeroOrnament)
|
||||||
this.playerManager.Handler(uint16(pb.ModId_ModuleRole), uint16(pb.MsgId_ModRoleLineupHelperChange), this.playerHandler.LineupHelperChange)
|
this.playerManager.Handler(uint16(pb.ModId_ModuleRole), uint16(pb.MsgId_ModRoleLineupHelperChange), this.playerHandler.LineupHelperChange)
|
||||||
|
this.playerManager.Handler(uint16(pb.ModId_ModuleRole), uint16(pb.MsgId_ModRoleLineupEquipInlay), this.playerHandler.LineupEquipInlay)
|
||||||
|
this.playerManager.Handler(uint16(pb.ModId_ModuleRole), uint16(pb.MsgId_ModRoleLineupTreasureInlay), this.playerHandler.LineupTreasureInlay)
|
||||||
this.playerManager.Handler(uint16(pb.ModId_ModuleRole), uint16(pb.MsgId_ModRoleLineupCreate), this.playerHandler.LineupCreate)
|
this.playerManager.Handler(uint16(pb.ModId_ModuleRole), uint16(pb.MsgId_ModRoleLineupCreate), this.playerHandler.LineupCreate)
|
||||||
this.playerManager.Handler(uint16(pb.ModId_ModuleRole), uint16(pb.MsgId_ModRoleLineupChangeName), this.playerHandler.LineupChangeName)
|
this.playerManager.Handler(uint16(pb.ModId_ModuleRole), uint16(pb.MsgId_ModRoleLineupChangeName), this.playerHandler.LineupChangeName)
|
||||||
this.playerManager.Handler(uint16(pb.ModId_ModuleRole), uint16(pb.MsgId_ModRoleLineupActivate), this.playerHandler.LineupActivate)
|
this.playerManager.Handler(uint16(pb.ModId_ModuleRole), uint16(pb.MsgId_ModRoleLineupActivate), this.playerHandler.LineupActivate)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user