Merge branch 'dev' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev
This commit is contained in:
commit
d2c8d44823
File diff suppressed because it is too large
Load Diff
@ -147,6 +147,8 @@ type (
|
|||||||
AddEquipment(session IUserSession, equip *pb.DB_Equipment) (code pb.ErrorCode)
|
AddEquipment(session IUserSession, equip *pb.DB_Equipment) (code pb.ErrorCode)
|
||||||
//出售装备
|
//出售装备
|
||||||
SellEquipments(session IUserSession, equs []string) (code pb.ErrorCode, atno []*pb.UserAtno)
|
SellEquipments(session IUserSession, equs []string) (code pb.ErrorCode, atno []*pb.UserAtno)
|
||||||
|
//回收装备接口
|
||||||
|
RecycleEquipments(session IUserSession, equs []string, discount int32) (code pb.ErrorCode, atno []*pb.UserAtno)
|
||||||
}
|
}
|
||||||
IMainline interface {
|
IMainline interface {
|
||||||
ModifyMainlineDataByNanduID(uid string, nandu, id int32) (code pb.ErrorCode)
|
ModifyMainlineDataByNanduID(uid string, nandu, id int32) (code pb.ErrorCode)
|
||||||
|
@ -229,6 +229,59 @@ func (this *Equipment) SellEquipments(session comm.IUserSession, equs []string)
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//回收装备接口
|
||||||
|
func (this *Equipment) RecycleEquipments(session comm.IUserSession, equs []string, discount int32) (code pb.ErrorCode, atno []*pb.UserAtno) {
|
||||||
|
var (
|
||||||
|
err error
|
||||||
|
equipments []*pb.DB_Equipment
|
||||||
|
confs []*cfg.GameEquipData
|
||||||
|
sale [][]*cfg.Gameatn
|
||||||
|
)
|
||||||
|
if equipments, err = this.modelEquipment.QueryUserEquipmentsByIds(session.GetUserId(), equs); err != nil {
|
||||||
|
code = pb.ErrorCode_ReqParameterError
|
||||||
|
return
|
||||||
|
}
|
||||||
|
confs = make([]*cfg.GameEquipData, len(equipments))
|
||||||
|
sale = make([][]*cfg.Gameatn, len(equipments))
|
||||||
|
for i, v := range equipments {
|
||||||
|
if v.HeroId != "" || v.Islock {
|
||||||
|
code = pb.ErrorCode_EquipmentNoCanSell
|
||||||
|
this.Errorf("NoCanSell %v", v)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if confs[i], err = this.configure.GetEquipmentConfigureById(v.CId); err != nil {
|
||||||
|
this.Errorln(err)
|
||||||
|
code = pb.ErrorCode_EquipmentOnFoundEquipment
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if confs[i].SmithySale == nil || len(confs[i].SmithySale) == 0 {
|
||||||
|
code = pb.ErrorCode_EquipmentNoCanSell
|
||||||
|
return
|
||||||
|
}
|
||||||
|
sale[i] = make([]*cfg.Gameatn, len(confs[i].Sale))
|
||||||
|
for n, s := range confs[i].SmithySale {
|
||||||
|
_s := &cfg.Gameatn{
|
||||||
|
A: s.A,
|
||||||
|
T: s.T,
|
||||||
|
N: int32(math.Floor(float64(s.N) * float64(discount) / float64(100))),
|
||||||
|
}
|
||||||
|
sale[i][n] = _s
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sales := make([]*cfg.Gameatn, 0)
|
||||||
|
for _, v := range sale {
|
||||||
|
sales = append(sales, v...)
|
||||||
|
}
|
||||||
|
if code, atno = this.DispenseAtno(session, sales, true); code != pb.ErrorCode_Success {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if code = this.DelEquipments(session, equs, true); code != pb.ErrorCode_Success {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
//Evens--------------------------------------------------------------------------------------------------------------------------------
|
//Evens--------------------------------------------------------------------------------------------------------------------------------
|
||||||
//推送道具变化消息
|
//推送道具变化消息
|
||||||
func (this *Equipment) equipmentsChangePush(session comm.IUserSession, items []*pb.DB_Equipment) (err error) {
|
func (this *Equipment) equipmentsChangePush(session comm.IUserSession, items []*pb.DB_Equipment) (err error) {
|
||||||
|
@ -27,6 +27,7 @@ type GameEquipData struct {
|
|||||||
Ico string
|
Ico string
|
||||||
UseSkip int32
|
UseSkip int32
|
||||||
Sale []*Gameatn
|
Sale []*Gameatn
|
||||||
|
SmithySale []*Gameatn
|
||||||
Salecoef float32
|
Salecoef float32
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -92,6 +93,20 @@ func (_v *GameEquipData)Deserialize(_buf map[string]interface{}) (err error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
var _arr_ []interface{}
|
||||||
|
var _ok_ bool
|
||||||
|
if _arr_, _ok_ = _buf["smithy_sale"].([]interface{}); !_ok_ { err = errors.New("smithy_sale error"); return }
|
||||||
|
|
||||||
|
_v.SmithySale = make([]*Gameatn, 0, len(_arr_))
|
||||||
|
|
||||||
|
for _, _e_ := range _arr_ {
|
||||||
|
var _list_v_ *Gameatn
|
||||||
|
{ var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _e_.(map[string]interface{}); !_ok_ { err = errors.New("_list_v_ error"); return }; if _list_v_, err = DeserializeGameatn(_x_); err != nil { return } }
|
||||||
|
_v.SmithySale = append(_v.SmithySale, _list_v_)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["salecoef"].(float64); !_ok_ { err = errors.New("salecoef error"); return }; _v.Salecoef = float32(_tempNum_) }
|
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["salecoef"].(float64); !_ok_ { err = errors.New("salecoef error"); return }; _v.Salecoef = float32(_tempNum_) }
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user