177 lines
5.3 KiB
Go
177 lines
5.3 KiB
Go
![]() |
package logic
|
||
|
|
||
|
//type PlayerRigComponent struct {
|
||
|
// ItemId uint32 `bson:"item_id" key:"1"`
|
||
|
// Id uint32 `bson:"id"`
|
||
|
// StarId uint32 `json:"star_id"`
|
||
|
// Type uint32 `bson:"type"`
|
||
|
// Setup bool `bson:"setup"`
|
||
|
//}
|
||
|
//
|
||
|
//func (this *PlayerRigComponent) BuildMsgRigComponent() *proto.RigComponent {
|
||
|
// return &proto.RigComponent{ItemId: this.ItemId, Id: this.Id, StarId: this.StarId, Type: this.Type, Setup: this.Setup}
|
||
|
//}
|
||
|
//
|
||
|
//func (this *Player) checkComponentUnlock(unlockType, unlockArg uint32) {
|
||
|
// var componentTables = this.manager.tables.RigComponentExtend.List()
|
||
|
//
|
||
|
// var changeList []*proto.RigComponentChange
|
||
|
// for _, componentTable := range componentTables {
|
||
|
// if uint32(componentTable.UnlockType) != unlockType {
|
||
|
// continue
|
||
|
// }
|
||
|
//
|
||
|
// if unlockArg != uint32(componentTable.UnlockArg) {
|
||
|
// continue
|
||
|
// }
|
||
|
//
|
||
|
// if componentTable.TaskId > 0 {
|
||
|
// this.AddTask(componentTable.TaskId)
|
||
|
// continue
|
||
|
// }
|
||
|
//
|
||
|
// var componentStarsTable = this.manager.tables.RigComponentStarExtend.Get(componentTable.ItemId, 0)
|
||
|
// if componentStarsTable == nil {
|
||
|
// continue
|
||
|
// }
|
||
|
//
|
||
|
// var component = this.addRigComponent(componentTable, componentStarsTable)
|
||
|
//
|
||
|
// if component != nil {
|
||
|
// changeList = append(changeList, &proto.RigComponentChange{RigComponent: component.BuildMsgRigComponent(), ChangeType: uint32(proto.ChangeTypeAdd)})
|
||
|
// }
|
||
|
// }
|
||
|
//
|
||
|
// if len(changeList) > 0 {
|
||
|
// _ = this.Send(proto.ModIdRig, proto.MsgIdRigComponentChange, &proto.MsgRigComponentChangeListAck{List: changeList})
|
||
|
//
|
||
|
// this.UpdateRigAttrs()
|
||
|
// }
|
||
|
//}
|
||
|
//
|
||
|
//func (this *Player) TaskComponentUnlock(taskId uint32) {
|
||
|
// var componentTables = this.manager.tables.RigComponent.List()
|
||
|
//
|
||
|
// var changeList []*proto.RigComponentChange
|
||
|
// for _, componentTable := range componentTables {
|
||
|
// if uint32(componentTable.TaskId) != taskId {
|
||
|
// continue
|
||
|
// }
|
||
|
//
|
||
|
// var componentStarsTable = this.manager.tables.RigComponentStarExtend.Get(componentTable.ItemId, 0)
|
||
|
// if componentStarsTable == nil {
|
||
|
// continue
|
||
|
// }
|
||
|
//
|
||
|
// var component = this.addRigComponent(componentTable, componentStarsTable)
|
||
|
//
|
||
|
// if component != nil {
|
||
|
// changeList = append(changeList, &proto.RigComponentChange{RigComponent: component.BuildMsgRigComponent(), ChangeType: uint32(proto.ChangeTypeAdd)})
|
||
|
// }
|
||
|
// }
|
||
|
//
|
||
|
// if len(changeList) > 0 {
|
||
|
// _ = this.Send(proto.ModIdRig, proto.MsgIdRigComponentChange, &proto.MsgRigComponentChangeListAck{List: changeList})
|
||
|
//
|
||
|
// this.UpdateRigAttrs()
|
||
|
// }
|
||
|
//}
|
||
|
//
|
||
|
//func (this *Player) addRigComponent(componentTable *data.RigComponent, componentStarTable *data.RigComponentStar) *PlayerRigComponent {
|
||
|
// if _, ok := this.RigComponent[uint32(componentTable.ItemId)]; ok {
|
||
|
// return nil
|
||
|
// }
|
||
|
//
|
||
|
// var component = &PlayerRigComponent{ItemId: uint32(componentTable.ItemId), Id: uint32(componentTable.Id), StarId: uint32(componentStarTable.Id), Type: uint32(componentTable.Type)}
|
||
|
//
|
||
|
// this.RigComponent[component.ItemId] = component
|
||
|
// this.SaveModel(component)
|
||
|
//
|
||
|
// this.CheckRigTrammelsStatus(uint32(componentTable.ItemId), uint32(componentTable.Level), uint32(componentStarTable.StarLevel))
|
||
|
// this.CheckAchievement(proto.AchievementTypeComponents, 0, 1)
|
||
|
//
|
||
|
// return component
|
||
|
//}
|
||
|
//
|
||
|
//func (this *Player) SetupRigComponent(tipe uint32, component *PlayerRigComponent) {
|
||
|
// var setupId = uint32(0)
|
||
|
// var list []*proto.RigComponentChange
|
||
|
//
|
||
|
// var p *uint32
|
||
|
// var sf string
|
||
|
//
|
||
|
// switch proto.EquipType(tipe) {
|
||
|
// case proto.EquipTypeHead:
|
||
|
// p = &this.Rig.Head
|
||
|
// sf = "rig.head"
|
||
|
// case proto.EquipTypeBody:
|
||
|
// p = &this.Rig.Body
|
||
|
// sf = "rig.body"
|
||
|
// case proto.EquipTypeTail:
|
||
|
// p = &this.Rig.Tail
|
||
|
// sf = "rig.tail"
|
||
|
// }
|
||
|
//
|
||
|
// setupId = *p
|
||
|
// if component == nil {
|
||
|
// if setupId == 0 {
|
||
|
// return
|
||
|
// }
|
||
|
// *p = 0
|
||
|
// } else {
|
||
|
// *p = component.ItemId
|
||
|
//
|
||
|
// component.Setup = true
|
||
|
// this.SaveModel(component)
|
||
|
//
|
||
|
// list = append(list, &proto.RigComponentChange{RigComponent: component.BuildMsgRigComponent(), ChangeType: uint32(proto.ChangeTypeChange)})
|
||
|
// }
|
||
|
//
|
||
|
// this.SaveField(sf, *p)
|
||
|
//
|
||
|
// if setupId > 0 {
|
||
|
// if setupComponent := this.RigComponent[setupId]; setupComponent != nil {
|
||
|
// setupComponent.Setup = false
|
||
|
// this.SaveModel(setupComponent)
|
||
|
//
|
||
|
// list = append(list, &proto.RigComponentChange{RigComponent: setupComponent.BuildMsgRigComponent(), ChangeType: uint32(proto.ChangeTypeChange)})
|
||
|
// }
|
||
|
// }
|
||
|
//
|
||
|
// _ = this.Send(proto.ModIdRig, proto.MsgIdRigComponentChange, &proto.MsgRigComponentChangeListAck{
|
||
|
// List: list,
|
||
|
// })
|
||
|
//
|
||
|
// this.UpdateRigAttrs()
|
||
|
//}
|
||
|
//
|
||
|
//func (this *Player) GetRigCompnentLevels(equipType proto.EquipType) (levels uint32) {
|
||
|
// for _, component := range this.RigComponent {
|
||
|
// if proto.EquipType(component.Type) == equipType {
|
||
|
// var componentTable = this.manager.tables.RigComponent.Get(int(component.Id))
|
||
|
// if componentTable != nil {
|
||
|
// levels += uint32(componentTable.Level)
|
||
|
// }
|
||
|
// }
|
||
|
// }
|
||
|
// return
|
||
|
//}
|
||
|
//
|
||
|
//func (this *Player) GetAllRigCompnentLevels() (levels uint32) {
|
||
|
// for _, component := range this.RigComponent {
|
||
|
// var componentTable = this.manager.tables.RigComponent.Get(int(component.Id))
|
||
|
// if componentTable != nil {
|
||
|
// levels += uint32(componentTable.Level)
|
||
|
// }
|
||
|
// }
|
||
|
// return
|
||
|
//}
|
||
|
//
|
||
|
//func (this *Player) BuildMsgRigComponentListAck() *proto.MsgRigComponentListAck {
|
||
|
// var ack = new(proto.MsgRigComponentListAck)
|
||
|
// for _, component := range this.RigComponent {
|
||
|
// ack.List = append(ack.List, component.BuildMsgRigComponent())
|
||
|
// }
|
||
|
// return ack
|
||
|
//}
|