上传装备附魔系统
This commit is contained in:
parent
831f7c0619
commit
2a2f210466
@ -21,10 +21,12 @@ func (this *apiComp) EnchCheck(session comm.IUserSession, req *pb.EquipmentEnchR
|
|||||||
//附魔
|
//附魔
|
||||||
func (this *apiComp) Ench(session comm.IUserSession, req *pb.EquipmentEnchReq) (code pb.ErrorCode, data proto.Message) {
|
func (this *apiComp) Ench(session comm.IUserSession, req *pb.EquipmentEnchReq) (code pb.ErrorCode, data proto.Message) {
|
||||||
var (
|
var (
|
||||||
equip *pb.DB_Equipment
|
equip *pb.DB_Equipment
|
||||||
conf *cfg.GameEquipEnchantingData
|
conf *cfg.GameEquipEnchantingData
|
||||||
AttrValue int32
|
hero *pb.DBHero
|
||||||
err error
|
equipments []*pb.DB_Equipment
|
||||||
|
AttrValue int32
|
||||||
|
err error
|
||||||
)
|
)
|
||||||
if code = this.EnchCheck(session, req); code != pb.ErrorCode_Success {
|
if code = this.EnchCheck(session, req); code != pb.ErrorCode_Success {
|
||||||
return
|
return
|
||||||
@ -54,6 +56,29 @@ func (this *apiComp) Ench(session comm.IUserSession, req *pb.EquipmentEnchReq) (
|
|||||||
code = pb.ErrorCode_SystemError
|
code = pb.ErrorCode_SystemError
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if equip.HeroId != "" {
|
||||||
|
if hero, code = this.module.ModuleHero.GetHeroByObjID(session.GetUserId(), equip.HeroId); code != pb.ErrorCode_Success {
|
||||||
|
this.module.Errorf("Upgrade code:%d", code)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
for i, v := range hero.EquipID {
|
||||||
|
if v != "" {
|
||||||
|
if v != equip.Id {
|
||||||
|
if equipments[i], err = this.module.modelEquipment.QueryUserEquipmentsById(session.GetUserId(), v); err != nil {
|
||||||
|
log.Errorf("Upgrade err:%v", err)
|
||||||
|
code = pb.ErrorCode_EquipmentOnFoundEquipment
|
||||||
|
return
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
equipments[i] = equip
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if code = this.module.ModuleHero.UpdateEquipment(session, hero, equipments); code != pb.ErrorCode_Success {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
session.SendMsg(string(this.module.GetType()), "ench", &pb.EquipmentEnchResp{Issucc: true, Equipment: equip})
|
session.SendMsg(string(this.module.GetType()), "ench", &pb.EquipmentEnchResp{Issucc: true, Equipment: equip})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -339,7 +339,10 @@ func (this *modelEquipmentComp) upgradeEquipment(equipment *pb.DB_Equipment, equ
|
|||||||
if attrlibrary, err = this.module.configure.GetEquipmentAttrlibraryConfigureByKey(equipment.AdverbEntry[index].Id); err != nil {
|
if attrlibrary, err = this.module.configure.GetEquipmentAttrlibraryConfigureByKey(equipment.AdverbEntry[index].Id); err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
equipment.AdverbEntry[index].Value = equipment.AdverbEntry[index].BaseValue + int32(float64(attrlibrary.Addition[equipment.AdverbEntry[index].Lv-1])/1000.0*float64(equipment.AdverbEntry[index].BaseValue))
|
value := equipment.AdverbEntry[index].BaseValue + int32(float64(attrlibrary.Addition[equipment.AdverbEntry[index].Lv-1])/1000.0*float64(equipment.AdverbEntry[index].BaseValue))
|
||||||
|
if equipment.AdverbEntry[index].Value < value {
|
||||||
|
equipment.AdverbEntry[index].Value = value
|
||||||
|
}
|
||||||
equipment.AdverbEntry[index].Lv++
|
equipment.AdverbEntry[index].Lv++
|
||||||
} else {
|
} else {
|
||||||
r := rand.New(rand.NewSource(time.Now().Unix()))
|
r := rand.New(rand.NewSource(time.Now().Unix()))
|
||||||
|
Loading…
Reference in New Issue
Block a user