Merge branch 'dev' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev
This commit is contained in:
commit
be2f72fa63
@ -46,7 +46,7 @@ func (this *apiComp) Ench(session comm.IUserSession, req *pb.EquipmentEnchReq) (
|
||||
}
|
||||
AttrValue = rand.Int31n(conf.AttrMax - conf.AttrMini)
|
||||
if AttrValue > equip.AdverbEntry[req.Index].Value {
|
||||
equip.AdverbEntry[req.Index].Value = AttrValue
|
||||
equip.AdverbEntry[req.Index].BaseValue = AttrValue
|
||||
}
|
||||
if err = this.module.modelEquipment.ChangeList(session.GetUserId(), equip.Id, map[string]interface{}{
|
||||
"adverbEntry": equip.AdverbEntry,
|
||||
|
@ -52,6 +52,13 @@ func (this *apiComp) Wash(session comm.IUserSession, req *pb.EquipmentWashReq) (
|
||||
this.module.Errorf("升级服务错误 读取副词条配置错误!")
|
||||
return
|
||||
}
|
||||
for i, v := range attrlibrarys { //移除主属性
|
||||
if v.Key == equip.MainEntry.Id {
|
||||
attrlibrarys = append(attrlibrarys[0:i], attrlibrarys[i+1:]...)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
adverbEntry = make([]*pb.EquipmentAttributeEntry, len(equip.AdverbEntry))
|
||||
r := rand.New(rand.NewSource(time.Now().Unix()))
|
||||
for i, v := range r.Perm(len(equip.AdverbEntry)) {
|
||||
|
@ -235,6 +235,13 @@ func (this *modelEquipmentComp) newEquipment(uid string, conf *cfg.GameEquipData
|
||||
return
|
||||
}
|
||||
|
||||
for i, v := range sattr { //移除主属性
|
||||
if v.Key == equipment.MainEntry.Id {
|
||||
sattr = append(sattr[0:i], sattr[i+1:]...)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
for _, v := range conf.Addattrnump {
|
||||
total += int(v)
|
||||
}
|
||||
@ -304,51 +311,56 @@ func (this *modelEquipmentComp) upgradeEquipment(equipment *pb.DB_Equipment, equ
|
||||
iskeep = true
|
||||
}
|
||||
}
|
||||
if v.Key == equipment.MainEntry.Id {
|
||||
iskeep = true
|
||||
}
|
||||
if !iskeep {
|
||||
sattr = append(sattr, v)
|
||||
}
|
||||
}
|
||||
if len(sattr) > 0 {
|
||||
r := rand.New(rand.NewSource(time.Now().Unix()))
|
||||
index := r.Perm(len(sattr))[0]
|
||||
if equip.EquipId == 1 {
|
||||
equipment.AdverbEntry = append(equipment.AdverbEntry, &pb.EquipmentAttributeEntry{
|
||||
Id: sattr[index].Key,
|
||||
Libraryid: sattr[index].Libraryid,
|
||||
Lv: 1,
|
||||
AttrName: sattr[index].Attrkey,
|
||||
Value: sattr[index].Attrvar,
|
||||
})
|
||||
return
|
||||
} else {
|
||||
if equipatt, err = this.module.configure.getEquipAttribute(sattr[index].Attrkey); err != nil {
|
||||
return
|
||||
}
|
||||
equipment.Adverbskill = append(equipment.Adverbskill, &pb.EquipmentSkillEntry{
|
||||
Id: sattr[index].Key,
|
||||
Libraryid: sattr[index].Libraryid,
|
||||
AttrName: sattr[index].Attrkey,
|
||||
SkillId: equipatt.SkillId,
|
||||
Lv: 1,
|
||||
})
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
if equip.EquipId == 1 {
|
||||
var attrlibrary *cfg.GameEquipAttrlibraryData
|
||||
r := rand.New(rand.NewSource(time.Now().Unix()))
|
||||
index := r.Perm(len(sattr))[0]
|
||||
if equip.EquipId == 1 {
|
||||
equipment.AdverbEntry = append(equipment.AdverbEntry, &pb.EquipmentAttributeEntry{
|
||||
Id: sattr[index].Key,
|
||||
Libraryid: sattr[index].Libraryid,
|
||||
Lv: 1,
|
||||
AttrName: sattr[index].Attrkey,
|
||||
Value: sattr[index].Attrvar,
|
||||
})
|
||||
} else {
|
||||
if equipatt, err = this.module.configure.getEquipAttribute(sattr[index].Attrkey); err != nil {
|
||||
return
|
||||
}
|
||||
equipment.Adverbskill = append(equipment.Adverbskill, &pb.EquipmentSkillEntry{
|
||||
Id: sattr[index].Key,
|
||||
Libraryid: sattr[index].Libraryid,
|
||||
AttrName: sattr[index].Attrkey,
|
||||
SkillId: equipatt.SkillId,
|
||||
Lv: 1,
|
||||
})
|
||||
index := r.Perm(len(equipment.AdverbEntry))[0]
|
||||
if attrlibrary, err = this.module.configure.GetEquipmentAttrlibraryConfigureByKey(equipment.AdverbEntry[index].Id); err != nil {
|
||||
return
|
||||
}
|
||||
} else { //随机一个副词条 强化
|
||||
if equip.EquipId == 1 {
|
||||
var attrlibrary *cfg.GameEquipAttrlibraryData
|
||||
r := rand.New(rand.NewSource(time.Now().Unix()))
|
||||
index := r.Perm(len(equipment.AdverbEntry))[0]
|
||||
|
||||
if attrlibrary, err = this.module.configure.GetEquipmentAttrlibraryConfigureByKey(equipment.AdverbEntry[index].Id); err != nil {
|
||||
return
|
||||
}
|
||||
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()))
|
||||
index := r.Perm(len(equipment.Adverbskill))[0]
|
||||
equipment.Adverbskill[index].Lv++
|
||||
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()))
|
||||
index := r.Perm(len(equipment.Adverbskill))[0]
|
||||
equipment.Adverbskill[index].Lv++
|
||||
}
|
||||
return
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user