上传装备附魔系统
This commit is contained in:
parent
831f7c0619
commit
2a2f210466
@ -23,6 +23,8 @@ func (this *apiComp) Ench(session comm.IUserSession, req *pb.EquipmentEnchReq) (
|
||||
var (
|
||||
equip *pb.DB_Equipment
|
||||
conf *cfg.GameEquipEnchantingData
|
||||
hero *pb.DBHero
|
||||
equipments []*pb.DB_Equipment
|
||||
AttrValue int32
|
||||
err error
|
||||
)
|
||||
@ -54,6 +56,29 @@ func (this *apiComp) Ench(session comm.IUserSession, req *pb.EquipmentEnchReq) (
|
||||
code = pb.ErrorCode_SystemError
|
||||
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})
|
||||
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 {
|
||||
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++
|
||||
} else {
|
||||
r := rand.New(rand.NewSource(time.Now().Unix()))
|
||||
|
Loading…
Reference in New Issue
Block a user