心愿单活动
This commit is contained in:
parent
dd7840ffbd
commit
e5e75f9436
@ -16,6 +16,7 @@ const (
|
|||||||
CFG_FREE_SHOP = "FreeShop"
|
CFG_FREE_SHOP = "FreeShop"
|
||||||
CFG_CHARGE_CONST = "ChargeConst"
|
CFG_CHARGE_CONST = "ChargeConst"
|
||||||
CFG_CHARGE_GIFT = "ChargeGift"
|
CFG_CHARGE_GIFT = "ChargeGift"
|
||||||
|
CFG_CHARGE_WISH = "ChargeWish"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
@ -26,6 +27,7 @@ func init() {
|
|||||||
gamedata.InitCfg(CFG_FREE_SHOP)
|
gamedata.InitCfg(CFG_FREE_SHOP)
|
||||||
gamedata.InitCfg(CFG_CHARGE_CONST)
|
gamedata.InitCfg(CFG_CHARGE_CONST)
|
||||||
gamedata.InitCfg(CFG_CHARGE_GIFT)
|
gamedata.InitCfg(CFG_CHARGE_GIFT)
|
||||||
|
gamedata.InitCfg(CFG_CHARGE_WISH)
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetMoneyCharge(ChargeId int) float64 {
|
func GetMoneyCharge(ChargeId int) float64 {
|
||||||
@ -251,3 +253,11 @@ func GetChargeInfo(ChargeId int) (float64, string) {
|
|||||||
}
|
}
|
||||||
return gamedata.GetFloatValue(data, "Money"), gamedata.GetStringValue(data, "Unit")
|
return gamedata.GetFloatValue(data, "Money"), gamedata.GetStringValue(data, "Unit")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func GetWishCount(ItemId int) int {
|
||||||
|
data, err := gamedata.GetDataByIntKey(CFG_CHARGE_WISH, ItemId)
|
||||||
|
if err != nil {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
return gamedata.GetIntValue(data, "Wish")
|
||||||
|
}
|
||||||
|
|||||||
@ -4017,7 +4017,7 @@ func ReqAddWish(player *Player, buf []byte) error {
|
|||||||
req := &msg.ReqAddWish{}
|
req := &msg.ReqAddWish{}
|
||||||
proto.Unmarshal(buf, req)
|
proto.Unmarshal(buf, req)
|
||||||
ChargeMod := player.PlayMod.getChargeMod()
|
ChargeMod := player.PlayMod.getChargeMod()
|
||||||
Items, err := ChargeMod.AddWish(int(req.Id))
|
Items, err := ChargeMod.AddWish(int(req.Id), int(req.Type))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
player.SendErrClienRes(&msg.ResAddWish{
|
player.SendErrClienRes(&msg.ResAddWish{
|
||||||
Code: msg.RES_CODE_FAIL,
|
Code: msg.RES_CODE_FAIL,
|
||||||
|
|||||||
@ -62,7 +62,12 @@ var ChessDiamondCfg = map[int]int{
|
|||||||
const (
|
const (
|
||||||
SPECIAL_TYPE_1 = 1 // 特惠礼包1
|
SPECIAL_TYPE_1 = 1 // 特惠礼包1
|
||||||
SPECIAL_TYPE_2 = 2 // 特惠礼包2
|
SPECIAL_TYPE_2 = 2 // 特惠礼包2
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
PLAYROOM_SHOP = 1 // playroom商店
|
||||||
|
CHESS_SHOP = 2 // 棋子商店
|
||||||
|
ENERGY_SHOP = 3 // 能量商店
|
||||||
)
|
)
|
||||||
|
|
||||||
func (c *ChargeMod) InitData() {
|
func (c *ChargeMod) InitData() {
|
||||||
@ -316,8 +321,12 @@ func (c *ChargeMod) TriggerChargeUnlock(Lv int, Emit []int) {
|
|||||||
c.InitChessShop(Emit)
|
c.InitChessShop(Emit)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *ChargeMod) AddWish(Id int) ([]*item.Item, error) {
|
func (c *ChargeMod) AddWish(Id, Type int) ([]*item.Item, error) {
|
||||||
ItemId, _ := playroomCfg.GetShopItem(Id)
|
ItemId := 0
|
||||||
|
switch Type {
|
||||||
|
case PLAYROOM_SHOP:
|
||||||
|
ItemId, _ = playroomCfg.GetShopItem(Id)
|
||||||
|
}
|
||||||
if ItemId == 0 {
|
if ItemId == 0 {
|
||||||
return nil, fmt.Errorf("AddWish itemid not exist id:%d", Id)
|
return nil, fmt.Errorf("AddWish itemid not exist id:%d", Id)
|
||||||
}
|
}
|
||||||
@ -337,8 +346,7 @@ func (c *ChargeMod) GetWish() ([]*item.Item, error) {
|
|||||||
if c.WishList.ItemId == 0 {
|
if c.WishList.ItemId == 0 {
|
||||||
return nil, fmt.Errorf("AddWishCount itemid not exist")
|
return nil, fmt.Errorf("AddWishCount itemid not exist")
|
||||||
}
|
}
|
||||||
// TODO 需要修改成chargeCfg
|
Max := chargeCfg.GetWishCount(c.WishList.ItemId)
|
||||||
Max := playroomCfg.GetShopWish(c.WishList.ItemId)
|
|
||||||
if c.WishList.Count < Max {
|
if c.WishList.Count < Max {
|
||||||
return nil, fmt.Errorf("AddWishCount count max")
|
return nil, fmt.Errorf("AddWishCount count max")
|
||||||
}
|
}
|
||||||
@ -361,8 +369,7 @@ func (c *ChargeMod) AddWishCount() {
|
|||||||
if c.WishList.ItemId == 0 {
|
if c.WishList.ItemId == 0 {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// TODO 需要修改成chargeCfg
|
Max := chargeCfg.GetWishCount(c.WishList.ItemId)
|
||||||
Max := playroomCfg.GetShopWish(c.WishList.ItemId)
|
|
||||||
if c.WishList.Count >= Max {
|
if c.WishList.Count >= Max {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user