增加分离器
This commit is contained in:
parent
0d3b0733d2
commit
282fd732f1
@ -616,6 +616,37 @@ func ReqBuyChessBagGrid(args []interface{}) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func ReqSeparateChess(args []interface{}) error {
|
||||
_, player, buf := ParseArgs(args)
|
||||
req := &msg.ReqSeparateChess{}
|
||||
proto.Unmarshal(buf, req)
|
||||
ChessMod := player.PlayMod.getChessMod()
|
||||
err := ChessMod.SeparateChess(int(req.ChessId))
|
||||
if err != nil {
|
||||
player.SendErrClienRes(&msg.ResSeparateChess{
|
||||
Code: msg.RES_CODE_FAIL,
|
||||
Msg: err.Error(),
|
||||
})
|
||||
return err
|
||||
}
|
||||
data := &PlayerChessData{}
|
||||
err = data.UpdateChessData(player, req.MChessData)
|
||||
if err != nil {
|
||||
player.SendErrClienRes(&msg.ResSeparateChess{
|
||||
Code: msg.RES_CODE_FAIL,
|
||||
Msg: err.Error(),
|
||||
})
|
||||
return err
|
||||
}
|
||||
player.PlayMod.save()
|
||||
player.PushClientRes(ChessMod.BackData())
|
||||
player.PushClientRes(&msg.ResSeparateChess{
|
||||
Code: msg.RES_CODE_SUCCESS,
|
||||
})
|
||||
player.UpdateUserInfo()
|
||||
return nil
|
||||
}
|
||||
|
||||
// 棋子转换
|
||||
func ReqChessEx(args []interface{}) error {
|
||||
_, player, buf := ParseArgs(args)
|
||||
|
||||
@ -18,6 +18,7 @@ const (
|
||||
ChessBoradMaxNum = 63
|
||||
CHESS_SOURCE_CHEST = 705
|
||||
CHESS_HIGH_SOURCE_CHEST = 706
|
||||
CHESS_SEPARATE = 707 // 分解器
|
||||
)
|
||||
|
||||
type ChessBorad struct {
|
||||
@ -509,3 +510,27 @@ func (cb *ChessBorad) SourceChest(ChessId int) ([]*item.Item, error) {
|
||||
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (cb *ChessBorad) SeparateChess(ChessId int) error {
|
||||
ChessLv := mergeDataCfg.GetLvById(ChessId)
|
||||
if ChessLv == 1 {
|
||||
return errors.New("chess lv is 1")
|
||||
}
|
||||
ChessType := mergeDataCfg.GetTypeById(ChessId)
|
||||
if ChessType != "Product" {
|
||||
return errors.New("chess type is not product")
|
||||
}
|
||||
err := cb.RemoveChess(ChessId)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = cb.RemoveChess(CHESS_SEPARATE)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
ChessColor := mergeDataCfg.GetColorById(ChessId)
|
||||
NewChess := mergeDataCfg.GetChessIdByLvAndColor(ChessLv-1, ChessColor)
|
||||
cb.AddChess(NewChess)
|
||||
cb.AddChess(NewChess)
|
||||
return nil
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user