增加宝物、神兵功能

This commit is contained in:
sk 2025-06-04 18:31:07 +08:00
parent 339ef4e293
commit ad32706409
5 changed files with 13 additions and 4 deletions

View File

@ -23,7 +23,7 @@ func (this *BattlePassSeasonTableExtend) init() error {
} }
for _, d := range this.l { for _, d := range this.l {
beginTime, err := util.ParseUnitx(time.DateTime, d.BeginTime) beginTime, err := util.ParseUnix(time.DateTime, d.BeginTime)
if err != nil { if err != nil {
return err return err
} }

View File

@ -223,6 +223,7 @@ func (this *PlayerManager) NewPlayer() *Player {
return &Player{ return &Player{
manager: this, manager: this,
//BattlePassReward: []*PlayerBattlePassRewrad{}, //BattlePassReward: []*PlayerBattlePassRewrad{},
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{},
@ -252,6 +253,7 @@ func (this *PlayerManager) NewPlayer() *Player {
//StorePool: map[uint32]*PlayerStorePool{}, //StorePool: map[uint32]*PlayerStorePool{},
//Task: map[uint32]*PlayerTask{}, //Task: map[uint32]*PlayerTask{},
//TaskActive: map[uint32]*PlayerTaskActive{}, //TaskActive: map[uint32]*PlayerTaskActive{},
Treasure: map[uint64]*PlayerTreasure{},
} }
} }

View File

@ -73,7 +73,6 @@ type Player struct {
Hero map[uint32]*PlayerHero `bson:"hero"` Hero map[uint32]*PlayerHero `bson:"hero"`
Item map[uint32]*PlayerItem `bson:"item"` Item map[uint32]*PlayerItem `bson:"item"`
Equip map[uint64]*PlayerEquip `bson:"rig_equip"` Equip map[uint64]*PlayerEquip `bson:"rig_equip"`
//GiftPack map[uint32]*PlayerGiftPack `bson:"gift_pack"` //GiftPack map[uint32]*PlayerGiftPack `bson:"gift_pack"`
//Mail map[uint64]*PlayerMail `bson:"mail"` //Mail map[uint64]*PlayerMail `bson:"mail"`
Money map[uint32]*PlayerMoney `bson:"money"` Money map[uint32]*PlayerMoney `bson:"money"`
@ -93,7 +92,7 @@ type Player struct {
//StorePool map[uint32]*PlayerStorePool `bson:"store_pool"` //StorePool map[uint32]*PlayerStorePool `bson:"store_pool"`
//Task map[uint32]*PlayerTask `bson:"task"` //Task map[uint32]*PlayerTask `bson:"task"`
//TaskActive map[uint32]*PlayerTaskActive `bson:"task_active"` //TaskActive map[uint32]*PlayerTaskActive `bson:"task_active"`
Treasure map[uint64]*PlayerTreasures `bson:"treasures"` Treasure map[uint64]*PlayerTreasure `bson:"treasures"`
//Temporary //Temporary
Temp PlayerTemp `bson:"-" json:"-"` Temp PlayerTemp `bson:"-" json:"-"`

View File

@ -18,6 +18,10 @@ func (this *Player) checkCorrect(firstLogin bool, cur *GameTime) {
} }
func (this *Player) checkCorrectModules(cur *GameTime) { func (this *Player) checkCorrectModules(cur *GameTime) {
if this.Artifact == nil {
this.Artifact = make(map[uint64]*PlayerArtifact)
this.SaveField("achievement", this.Artifact)
}
//if this.Achievement == nil { //if this.Achievement == nil {
// this.Achievement = make(map[uint64]*PlayerAchievement) // this.Achievement = make(map[uint64]*PlayerAchievement)
// this.SaveField("achievement", this.Achievement) // this.SaveField("achievement", this.Achievement)
@ -134,6 +138,10 @@ func (this *Player) checkCorrectModules(cur *GameTime) {
// this.TaskActive = make(map[uint32]*PlayerTaskActive) // this.TaskActive = make(map[uint32]*PlayerTaskActive)
// this.SaveField("task_active", this.TaskActive) // this.SaveField("task_active", this.TaskActive)
//} //}
if this.Treasure == nil {
this.Treasure = make(map[uint64]*PlayerTreasure)
this.SaveField("achievement", this.Treasure)
}
} }
func (this *Player) initRole(cur *GameTime) { func (this *Player) initRole(cur *GameTime) {

View File

@ -1,6 +1,6 @@
package logic package logic
type PlayerTreasures struct { type PlayerTreasure struct {
Uid uint64 `bson:"uid" key:"1"` Uid uint64 `bson:"uid" key:"1"`
Id uint32 `bson:"id"` Id uint32 `bson:"id"`
} }