猫咪闪促
This commit is contained in:
parent
b1af9103bf
commit
0ac249ad30
@ -47,7 +47,7 @@ func ADPetWorkFire(p *Player, ChargeId int) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
p.PlayMod.save()
|
p.PlayMod.save()
|
||||||
p.PushClientRes(ChargeMod.BackData())
|
p.ChargeBackData()
|
||||||
}
|
}
|
||||||
|
|
||||||
func ActivityFire(p *Player, ChargeId int) {
|
func ActivityFire(p *Player, ChargeId int) {
|
||||||
@ -154,7 +154,7 @@ func ChargeFire(p *Player, ChargeId int) {
|
|||||||
log.Debug("ChargeFire err : %s", err)
|
log.Debug("ChargeFire err : %s", err)
|
||||||
}
|
}
|
||||||
p.PlayMod.save()
|
p.PlayMod.save()
|
||||||
p.PushClientRes(ChargeMod.BackData())
|
p.ChargeBackData()
|
||||||
}
|
}
|
||||||
|
|
||||||
func ChargeItem(p *Player, ChargeId int) []*item.Item {
|
func ChargeItem(p *Player, ChargeId int) []*item.Item {
|
||||||
|
|||||||
@ -540,7 +540,7 @@ func ReqGmCommand_(player *Player, Command string) error {
|
|||||||
case "resetWeekly":
|
case "resetWeekly":
|
||||||
ChargeMod := player.PlayMod.getChargeMod()
|
ChargeMod := player.PlayMod.getChargeMod()
|
||||||
ChargeMod.WeeklyDiscount = make(map[int]int)
|
ChargeMod.WeeklyDiscount = make(map[int]int)
|
||||||
player.PushClientRes(ChargeMod.BackData())
|
player.ChargeBackData()
|
||||||
PlayroomMod := player.PlayMod.getPlayroomMod()
|
PlayroomMod := player.PlayMod.getPlayroomMod()
|
||||||
PlayroomMod.WeeklyDiscount = make(map[int]int)
|
PlayroomMod.WeeklyDiscount = make(map[int]int)
|
||||||
PlayroomBackData(player)
|
PlayroomBackData(player)
|
||||||
|
|||||||
@ -76,6 +76,15 @@ func LimitedTimeEventTrigger(p *Player, AddEventId int) {
|
|||||||
p.PushClientRes(p.PlayMod.getOrderMod().BackData())
|
p.PushClientRes(p.PlayMod.getOrderMod().BackData())
|
||||||
case limitedTimeEvent.EVENT_TYPE_CARD_FESTIVAL:
|
case limitedTimeEvent.EVENT_TYPE_CARD_FESTIVAL:
|
||||||
p.PlayMod.getCardMod().CreateCardFestival()
|
p.PlayMod.getCardMod().CreateCardFestival()
|
||||||
|
case limitedTimeEvent.EVENT_TYPE_CAT_DAY_SALE: // 猫咪大甩卖
|
||||||
|
ChargeMod := p.PlayMod.getChargeMod()
|
||||||
|
PlayroomMod := p.PlayMod.getPlayroomMod()
|
||||||
|
if !ChargeMod.IsWeeklyDiscountDay() {
|
||||||
|
ChargeMod.ResetWeeklyDiscount()
|
||||||
|
PlayroomMod.ResetWeeklyDiscount()
|
||||||
|
}
|
||||||
|
|
||||||
|
p.ChargeBackData()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
p.PushClientRes(p.PlayMod.getLimitedTimeEventMod().BackData())
|
p.PushClientRes(p.PlayMod.getLimitedTimeEventMod().BackData())
|
||||||
|
|||||||
@ -327,7 +327,7 @@ func (p *Player) ZeroUpdate(a []interface{}) {
|
|||||||
ChessMod := p.PlayMod.getChessMod()
|
ChessMod := p.PlayMod.getChessMod()
|
||||||
ChargeMod := p.PlayMod.getChargeMod()
|
ChargeMod := p.PlayMod.getChargeMod()
|
||||||
ChargeMod.ZeroUpdate(ChessMod.GetEmitList())
|
ChargeMod.ZeroUpdate(ChessMod.GetEmitList())
|
||||||
p.PushClientRes(p.PlayMod.getChargeMod().BackData())
|
p.ChargeBackData()
|
||||||
|
|
||||||
// 无尽礼包
|
// 无尽礼包
|
||||||
p.PlayMod.getEndlessMod().ZeroUpdate(p.PlayMod.getChargeMod().GetMaxCharge(), p.PlayMod.getBaseMod().GetLevel())
|
p.PlayMod.getEndlessMod().ZeroUpdate(p.PlayMod.getChargeMod().GetMaxCharge(), p.PlayMod.getBaseMod().GetLevel())
|
||||||
@ -344,6 +344,9 @@ func (p *Player) ZeroUpdate(a []interface{}) {
|
|||||||
// playroom
|
// playroom
|
||||||
PlayroomMod := p.PlayMod.getPlayroomMod()
|
PlayroomMod := p.PlayMod.getPlayroomMod()
|
||||||
PlayroomMod.ZeroUpdate()
|
PlayroomMod.ZeroUpdate()
|
||||||
|
if ChargeMod.IsWeeklyDiscountDay() {
|
||||||
|
PlayroomMod.ResetWeeklyDiscount()
|
||||||
|
}
|
||||||
PlayroomBackData(p)
|
PlayroomBackData(p)
|
||||||
p.PlayMod.getChampshipMod().ZeroUpdate()
|
p.PlayMod.getChampshipMod().ZeroUpdate()
|
||||||
p.initAcitivity()
|
p.initAcitivity()
|
||||||
@ -375,7 +378,7 @@ func (p *Player) NoonUpdate(a []interface{}) {
|
|||||||
ChessMod := p.PlayMod.getChessMod()
|
ChessMod := p.PlayMod.getChessMod()
|
||||||
// 礼包充值
|
// 礼包充值
|
||||||
p.PlayMod.getChargeMod().NoonUpdate(ChessMod.GetEmitList())
|
p.PlayMod.getChargeMod().NoonUpdate(ChessMod.GetEmitList())
|
||||||
p.PushClientRes(p.PlayMod.getChargeMod().BackData())
|
p.ChargeBackData()
|
||||||
p.PlayMod.save()
|
p.PlayMod.save()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -414,17 +417,30 @@ func (p *Player) Login() {
|
|||||||
ChargeMod.WeeklyEndTime = WeeklyEndTime
|
ChargeMod.WeeklyEndTime = WeeklyEndTime
|
||||||
}
|
}
|
||||||
if WeeklyStartTime > now {
|
if WeeklyStartTime > now {
|
||||||
go func() {
|
p.CallEvent(time.Duration(WeeklyStartTime-now)*time.Second, func() {
|
||||||
time.Sleep(time.Duration(WeeklyStartTime-now) * time.Second)
|
|
||||||
ChargeMod.WeeklyEndTime = WeeklyEndTime
|
ChargeMod.WeeklyEndTime = WeeklyEndTime
|
||||||
p.PushClientRes(ChargeMod.BackData())
|
ChargeMod.ResetWeeklyDiscount()
|
||||||
|
PlayroomMod := p.PlayMod.getPlayroomMod()
|
||||||
|
PlayroomMod.ResetWeeklyDiscount()
|
||||||
|
p.ChargeBackData()
|
||||||
PlayroomBackData(p)
|
PlayroomBackData(p)
|
||||||
}()
|
}, "WeeklyDiscountStart")
|
||||||
|
}
|
||||||
|
if WeeklyEndTime > now {
|
||||||
|
p.CallEvent(time.Duration(WeeklyEndTime-now)*time.Second, func() {
|
||||||
|
ChargeMod.WeeklyEndTime = 0
|
||||||
|
p.ChargeBackData()
|
||||||
|
PlayroomBackData(p)
|
||||||
|
LimitEventMod := p.PlayMod.getLimitedTimeEventMod()
|
||||||
|
LimitEventMod.EndCatDaySale()
|
||||||
|
p.PushClientRes(LimitEventMod.BackData())
|
||||||
|
}, "WeeklyDiscountEnd")
|
||||||
}
|
}
|
||||||
if Duration > 604800 {
|
if Duration > 604800 {
|
||||||
FriendMod := p.PlayMod.getFriendMod()
|
FriendMod := p.PlayMod.getFriendMod()
|
||||||
FriendMod.AddActLog(friend.ACT_LOG_TYPE_LOST_USER_RETURN, "")
|
FriendMod.AddActLog(friend.ACT_LOG_TYPE_LOST_USER_RETURN, "")
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *Player) Outline() {
|
func (p *Player) Outline() {
|
||||||
@ -879,7 +895,6 @@ func (p *Player) LoginBackData() {
|
|||||||
p.PushClientRes(p.PlayMod.mod_list.DailyTask.BackData())
|
p.PushClientRes(p.PlayMod.mod_list.DailyTask.BackData())
|
||||||
p.PushClientRes(p.PlayMod.mod_list.SevenLogin.BackData())
|
p.PushClientRes(p.PlayMod.mod_list.SevenLogin.BackData())
|
||||||
p.PushClientRes(p.PlayMod.mod_list.LimitedTimeEvent.ProgressBackData())
|
p.PushClientRes(p.PlayMod.mod_list.LimitedTimeEvent.ProgressBackData())
|
||||||
p.PushClientRes(p.PlayMod.mod_list.Charge.BackData())
|
|
||||||
p.PushClientRes(p.PlayMod.mod_list.Charge.PetWorkBackData())
|
p.PushClientRes(p.PlayMod.mod_list.Charge.PetWorkBackData())
|
||||||
p.PushClientRes(p.PlayMod.mod_list.Endless.BackData())
|
p.PushClientRes(p.PlayMod.mod_list.Endless.BackData())
|
||||||
p.PushClientRes(p.PlayMod.mod_list.PiggyBank.BackData())
|
p.PushClientRes(p.PlayMod.mod_list.PiggyBank.BackData())
|
||||||
@ -890,6 +905,7 @@ func (p *Player) LoginBackData() {
|
|||||||
p.PushClientRes(p.PlayMod.mod_list.Friend.BubbleBackData())
|
p.PushClientRes(p.PlayMod.mod_list.Friend.BubbleBackData())
|
||||||
p.PushClientRes(p.PlayMod.mod_list.Guide.BackData())
|
p.PushClientRes(p.PlayMod.mod_list.Guide.BackData())
|
||||||
p.BackDataActivity()
|
p.BackDataActivity()
|
||||||
|
p.ChargeBackData()
|
||||||
BackChampship(p)
|
BackChampship(p)
|
||||||
BackUserInfo(p)
|
BackUserInfo(p)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,8 +2,10 @@ package game
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"server/GoUtil"
|
"server/GoUtil"
|
||||||
|
chargeCfg "server/conf/charge"
|
||||||
playroomCfg "server/conf/playroom"
|
playroomCfg "server/conf/playroom"
|
||||||
"server/game/mod/item"
|
"server/game/mod/item"
|
||||||
|
"server/game/mod/limitedTimeEvent"
|
||||||
proto "server/msg"
|
proto "server/msg"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -125,7 +127,9 @@ func PlayroomBackData(p *Player) {
|
|||||||
}
|
}
|
||||||
weeklyDiscount := make(map[int32]*proto.WeeklyDiscountInfo)
|
weeklyDiscount := make(map[int32]*proto.WeeklyDiscountInfo)
|
||||||
ChargeMod := p.PlayMod.getChargeMod()
|
ChargeMod := p.PlayMod.getChargeMod()
|
||||||
if ChargeMod.IsWeeklyDiscountDay() {
|
LimitedEventMod := p.PlayMod.getLimitedTimeEventMod()
|
||||||
|
// 优惠日开启或者猫咪闪促开启
|
||||||
|
if ChargeMod.IsWeeklyDiscountDay() || LimitedEventMod.CheckExist(limitedTimeEvent.EVENT_TYPE_CAT_DAY_SALE) {
|
||||||
w1 := playroomCfg.GetShopWeeklyLimit()
|
w1 := playroomCfg.GetShopWeeklyLimit()
|
||||||
for k, v := range w1 {
|
for k, v := range w1 {
|
||||||
limitNum := PlayroomMod.WeeklyDiscount[k]
|
limitNum := PlayroomMod.WeeklyDiscount[k]
|
||||||
@ -196,7 +200,6 @@ func PlayroomVisit(p *Player, Uid int) {
|
|||||||
r.Chip = int32(data.Chip)
|
r.Chip = int32(data.Chip)
|
||||||
r.Kiss = int32(data.Kiss)
|
r.Kiss = int32(data.Kiss)
|
||||||
r.DressSet = GoUtil.MapIntToInt32(PlayerData.DressSet)
|
r.DressSet = GoUtil.MapIntToInt32(PlayerData.DressSet)
|
||||||
|
|
||||||
p.PushClientRes(r)
|
p.PushClientRes(r)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -229,3 +232,65 @@ func BackUserInfo(p *Player) {
|
|||||||
AddCode: BaseMod.AddCode,
|
AddCode: BaseMod.AddCode,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (p *Player) ChargeBackData() {
|
||||||
|
c := p.PlayMod.getChargeMod()
|
||||||
|
LimitedEvnetMod := p.PlayMod.getLimitedTimeEventMod()
|
||||||
|
SpecialShop := make(map[int32]*proto.ResSpecialShop)
|
||||||
|
ChessShop := make(map[int32]*proto.ResChessShop)
|
||||||
|
for k, v := range c.SpecialShop {
|
||||||
|
SpecialShop[int32(k)] = &proto.ResSpecialShop{
|
||||||
|
Grade: int32(v.Grade),
|
||||||
|
Count: int32(v.Count),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for k, v := range c.ChessShop {
|
||||||
|
ChessShop[int32(k)] = &proto.ResChessShop{
|
||||||
|
Diamond: int32(v.Diamond),
|
||||||
|
Count: int32(v.Count),
|
||||||
|
ChessId: int32(v.Id),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
resWish := &proto.WishList{}
|
||||||
|
if c.WishList != nil {
|
||||||
|
resWish = &proto.WishList{
|
||||||
|
Id: int32(c.WishList.ItemId),
|
||||||
|
Count: int32(c.WishList.Count),
|
||||||
|
Uid: c.WishList.SendList,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
WeeklyDiscount := make(map[int32]*proto.WeeklyDiscountInfo)
|
||||||
|
WeeklyDiscountInfo := chargeCfg.GetWeeklyInfoAll()
|
||||||
|
// 优惠日开启或者猫咪闪促开启
|
||||||
|
if c.IsWeeklyDiscountDay() || LimitedEvnetMod.CheckExist(limitedTimeEvent.EVENT_TYPE_CAT_DAY_SALE) {
|
||||||
|
for k, v := range WeeklyDiscountInfo {
|
||||||
|
LimitNum := c.WeeklyDiscount[k]
|
||||||
|
WeeklyDiscount[int32(k)] = &proto.WeeklyDiscountInfo{
|
||||||
|
Discount: int32(v.Discount),
|
||||||
|
Count: int32(v.WeeklyLimit - LimitNum),
|
||||||
|
Id: int32(k),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CatDaySaleEndTime := LimitedEvnetMod.GetCatDaySaleEndTime()
|
||||||
|
p.PushClientRes(&proto.ResCharge{
|
||||||
|
Charge: float32(c.Charge),
|
||||||
|
Total: int32(c.Total),
|
||||||
|
First: GoUtil.MapIntToSlice(c.EnergyShop),
|
||||||
|
SpecialShop: SpecialShop,
|
||||||
|
FreeShop: int32(c.FreeShop),
|
||||||
|
ChessShop: ChessShop,
|
||||||
|
Gift: GoUtil.MapIntToInt32(c.Gift),
|
||||||
|
Ad: c.Ad,
|
||||||
|
SpecialCharge: float32(c.SpecialCharge),
|
||||||
|
SpecialChargeWeek: int32(GoUtil.FullWeeksSince(c.LastSpecialCharge)),
|
||||||
|
TodayCharge: float32(c.TodayCharge),
|
||||||
|
MonthCharge: float32(c.MonthCharge),
|
||||||
|
Wish: resWish,
|
||||||
|
AdEndTime: c.AdEndTime,
|
||||||
|
WeeklyDiscount: WeeklyDiscount,
|
||||||
|
PetWorkRemainTime: c.PetWorkTime,
|
||||||
|
WeeklyEndTime: max(c.WeeklyEndTime, CatDaySaleEndTime),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|||||||
@ -524,7 +524,7 @@ func (p *PlayerBaseData) AddExp(player *Player, exp int, pexp int) (int, error)
|
|||||||
}
|
}
|
||||||
ChargeMod := player.PlayMod.getChargeMod()
|
ChargeMod := player.PlayMod.getChargeMod()
|
||||||
ChargeMod.TriggerChargeUnlock(int(BaseMod.Level), ChessMod.GetEmitList())
|
ChargeMod.TriggerChargeUnlock(int(BaseMod.Level), ChessMod.GetEmitList())
|
||||||
player.PushClientRes(ChargeMod.BackData())
|
player.ChargeBackData()
|
||||||
OrderMod := player.PlayMod.getOrderMod()
|
OrderMod := player.PlayMod.getOrderMod()
|
||||||
player.TriggerOrder(BaseMod.Level, order.TRIGGER_TYPE_LV, ChessMod.GetOrderEmit(), player.PlayMod.getBaseMod().GetEnergyMul())
|
player.TriggerOrder(BaseMod.Level, order.TRIGGER_TYPE_LV, ChessMod.GetOrderEmit(), player.PlayMod.getBaseMod().GetEnergyMul())
|
||||||
player.PushClientRes(OrderMod.BackData())
|
player.PushClientRes(OrderMod.BackData())
|
||||||
|
|||||||
@ -23,6 +23,7 @@ import (
|
|||||||
"server/game/mod/card"
|
"server/game/mod/card"
|
||||||
"server/game/mod/friend"
|
"server/game/mod/friend"
|
||||||
"server/game/mod/item"
|
"server/game/mod/item"
|
||||||
|
"server/game/mod/limitedTimeEvent"
|
||||||
"server/game/mod/mail"
|
"server/game/mod/mail"
|
||||||
"server/game/mod/msg"
|
"server/game/mod/msg"
|
||||||
"server/game/mod/order"
|
"server/game/mod/order"
|
||||||
@ -320,7 +321,7 @@ func handle(p *Player, m *msg.Msg) error {
|
|||||||
ChargeMod := p.PlayMod.getChargeMod()
|
ChargeMod := p.PlayMod.getChargeMod()
|
||||||
ChargeMod.AddWishCount()
|
ChargeMod.AddWishCount()
|
||||||
p.AddLog(m.From, friend.LOG_TYPE_WISH, "", m.SendT)
|
p.AddLog(m.From, friend.LOG_TYPE_WISH, "", m.SendT)
|
||||||
p.PushClientRes(ChargeMod.BackData())
|
p.ChargeBackData()
|
||||||
case msg.HANDLE_TYPE_PLAYROOM_KISS: // playroom亲吻
|
case msg.HANDLE_TYPE_PLAYROOM_KISS: // playroom亲吻
|
||||||
p.NotifyPlayroomKiss()
|
p.NotifyPlayroomKiss()
|
||||||
case msg.HANDLE_TYPE_CATNIP_INVITE: // 邀请好友参与猫咪游戏
|
case msg.HANDLE_TYPE_CATNIP_INVITE: // 邀请好友参与猫咪游戏
|
||||||
@ -953,7 +954,7 @@ func EmitRetireTrigger2(p *Player) {
|
|||||||
ChessMod.FinishRetire(k)
|
ChessMod.FinishRetire(k)
|
||||||
ChargeMod := p.PlayMod.getChargeMod()
|
ChargeMod := p.PlayMod.getChargeMod()
|
||||||
ChargeMod.InitChessShop(ChessMod.GetEmitList())
|
ChargeMod.InitChessShop(ChessMod.GetEmitList())
|
||||||
p.PushClientRes(ChargeMod.BackData())
|
p.ChargeBackData()
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
OrderMod.CreateCleanOrder(ChessList)
|
OrderMod.CreateCleanOrder(ChessList)
|
||||||
@ -1564,3 +1565,9 @@ func (player *Player) GetPlayroomClean() map[int]int {
|
|||||||
}
|
}
|
||||||
return Item
|
return Item
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (player *Player) IsWeeklyDiscount() bool {
|
||||||
|
ChargeMod := player.PlayMod.getChargeMod()
|
||||||
|
LimitEventMod := player.PlayMod.getLimitedTimeEventMod()
|
||||||
|
return ChargeMod.IsWeeklyDiscountDay() || LimitEventMod.CheckExist(limitedTimeEvent.EVENT_TYPE_CAT_DAY_SALE)
|
||||||
|
}
|
||||||
|
|||||||
@ -1473,7 +1473,7 @@ func ReqBuyEnergy(player *Player, buf []byte) error {
|
|||||||
proto.Unmarshal(buf, req)
|
proto.Unmarshal(buf, req)
|
||||||
BaseMod := player.PlayMod.getBaseMod()
|
BaseMod := player.PlayMod.getBaseMod()
|
||||||
ChargeMod := player.PlayMod.getChargeMod()
|
ChargeMod := player.PlayMod.getChargeMod()
|
||||||
Item, Energy, Diamond := ChargeMod.BuyEnergy()
|
Item, Energy, Diamond := ChargeMod.BuyEnergy(player.IsWeeklyDiscount())
|
||||||
err := player.HandleItem(Item, msg.ITEM_POP_LABEL_BuyEnergy.String())
|
err := player.HandleItem(Item, msg.ITEM_POP_LABEL_BuyEnergy.String())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
player.SendErrClienRes(&msg.ResBuyEnergy{
|
player.SendErrClienRes(&msg.ResBuyEnergy{
|
||||||
@ -1487,7 +1487,7 @@ func ReqBuyEnergy(player *Player, buf []byte) error {
|
|||||||
player.PushClientRes(&msg.ResBuyEnergy{
|
player.PushClientRes(&msg.ResBuyEnergy{
|
||||||
Code: msg.RES_CODE_SUCCESS,
|
Code: msg.RES_CODE_SUCCESS,
|
||||||
})
|
})
|
||||||
player.PushClientRes(ChargeMod.BackData())
|
player.ChargeBackData()
|
||||||
player.TeLog("buy_energy_diamond", map[string]interface{}{
|
player.TeLog("buy_energy_diamond", map[string]interface{}{
|
||||||
"diamond_cost": Diamond,
|
"diamond_cost": Diamond,
|
||||||
"energy_num": Energy,
|
"energy_num": Energy,
|
||||||
@ -2529,7 +2529,7 @@ func ReqFreeShop(player *Player, buf []byte) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
player.PlayMod.save()
|
player.PlayMod.save()
|
||||||
player.PushClientRes(ChargeMod.BackData())
|
player.ChargeBackData()
|
||||||
player.PushClientRes(&msg.ResFreeShop{
|
player.PushClientRes(&msg.ResFreeShop{
|
||||||
Code: msg.RES_CODE_SUCCESS,
|
Code: msg.RES_CODE_SUCCESS,
|
||||||
})
|
})
|
||||||
@ -2546,7 +2546,7 @@ func ReqBuyChessShop(player *Player, buf []byte) error {
|
|||||||
req := &msg.ReqBuyChessShop{}
|
req := &msg.ReqBuyChessShop{}
|
||||||
proto.Unmarshal(buf, req)
|
proto.Unmarshal(buf, req)
|
||||||
ChargeMod := player.PlayMod.getChargeMod()
|
ChargeMod := player.PlayMod.getChargeMod()
|
||||||
LostItem, Item, _, err := ChargeMod.BuyChess(int(req.Id))
|
LostItem, Item, _, err := ChargeMod.BuyChess(int(req.Id), player.IsWeeklyDiscount())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
player.SendErrClienRes(&msg.ResBuyChessShop{
|
player.SendErrClienRes(&msg.ResBuyChessShop{
|
||||||
Code: msg.RES_CODE_FAIL,
|
Code: msg.RES_CODE_FAIL,
|
||||||
@ -2577,7 +2577,7 @@ func ReqBuyChessShop(player *Player, buf []byte) error {
|
|||||||
"cost_num": -LostItem[0].Num,
|
"cost_num": -LostItem[0].Num,
|
||||||
})
|
})
|
||||||
player.PlayMod.save()
|
player.PlayMod.save()
|
||||||
player.PushClientRes(ChargeMod.BackData())
|
player.ChargeBackData()
|
||||||
player.PushClientRes(&msg.ResBuyChessShop{
|
player.PushClientRes(&msg.ResBuyChessShop{
|
||||||
Code: msg.RES_CODE_SUCCESS,
|
Code: msg.RES_CODE_SUCCESS,
|
||||||
})
|
})
|
||||||
@ -2594,7 +2594,7 @@ func ReqBuyChessShop2(player *Player, buf []byte) error {
|
|||||||
req := &msg.ReqBuyChessShop2{}
|
req := &msg.ReqBuyChessShop2{}
|
||||||
proto.Unmarshal(buf, req)
|
proto.Unmarshal(buf, req)
|
||||||
ChargeMod := player.PlayMod.getChargeMod()
|
ChargeMod := player.PlayMod.getChargeMod()
|
||||||
LostItem, _, ChessId, err := ChargeMod.BuyChess(int(req.Id))
|
LostItem, _, ChessId, err := ChargeMod.BuyChess(int(req.Id), player.IsWeeklyDiscount())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
player.SendErrClienRes(&msg.ResBuyChessShop2{
|
player.SendErrClienRes(&msg.ResBuyChessShop2{
|
||||||
Code: msg.RES_CODE_FAIL,
|
Code: msg.RES_CODE_FAIL,
|
||||||
@ -2635,7 +2635,7 @@ func ReqBuyChessShop2(player *Player, buf []byte) error {
|
|||||||
"cost_num": LostItem[0].Num,
|
"cost_num": LostItem[0].Num,
|
||||||
})
|
})
|
||||||
player.PlayMod.save()
|
player.PlayMod.save()
|
||||||
player.PushClientRes(ChargeMod.BackData())
|
player.ChargeBackData()
|
||||||
player.PushClientRes(&msg.ResBuyChessShop2{
|
player.PushClientRes(&msg.ResBuyChessShop2{
|
||||||
Code: msg.RES_CODE_SUCCESS,
|
Code: msg.RES_CODE_SUCCESS,
|
||||||
})
|
})
|
||||||
@ -2662,7 +2662,7 @@ func ReqRefreshChessShop(player *Player, buf []byte) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
player.PlayMod.save()
|
player.PlayMod.save()
|
||||||
player.PushClientRes(ChargeMod.BackData())
|
player.ChargeBackData()
|
||||||
player.TeLog("refresh_store_diamond", map[string]interface{}{
|
player.TeLog("refresh_store_diamond", map[string]interface{}{
|
||||||
"diamond_cost": 20,
|
"diamond_cost": 20,
|
||||||
})
|
})
|
||||||
@ -4163,8 +4163,7 @@ func ReqPlayroomShop(player *Player, buf []byte) error {
|
|||||||
req := &msg.ReqPlayroomShop{}
|
req := &msg.ReqPlayroomShop{}
|
||||||
proto.Unmarshal(buf, req)
|
proto.Unmarshal(buf, req)
|
||||||
PlayroomMod := player.PlayMod.getPlayroomMod()
|
PlayroomMod := player.PlayMod.getPlayroomMod()
|
||||||
ChargeMod := player.PlayMod.getChargeMod()
|
AddItems, LoseItem, err := PlayroomMod.ShopBuy(int(req.Id), int(req.Num), player.IsWeeklyDiscount())
|
||||||
AddItems, LoseItem, err := PlayroomMod.ShopBuy(int(req.Id), int(req.Num), ChargeMod.IsWeeklyDiscountDay())
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
player.SendErrClienRes(&msg.ResPlayroomShop{
|
player.SendErrClienRes(&msg.ResPlayroomShop{
|
||||||
Code: msg.RES_CODE_FAIL,
|
Code: msg.RES_CODE_FAIL,
|
||||||
|
|||||||
@ -136,8 +136,8 @@ func (c *ChargeMod) ZeroUpdate(Emit []int) {
|
|||||||
c.SpecialShop[i] = &SepcialShop{Grade: SpecialGrade, Count: SpecialShopCount}
|
c.SpecialShop[i] = &SepcialShop{Grade: SpecialGrade, Count: SpecialShopCount}
|
||||||
}
|
}
|
||||||
c.WishList.SendList = make([]int64, 0)
|
c.WishList.SendList = make([]int64, 0)
|
||||||
c.WeeklyDiscount = make(map[int]int)
|
|
||||||
if c.IsWeeklyDiscountDay() && c.WeeklyEndTime < Now {
|
if c.IsWeeklyDiscountDay() && c.WeeklyEndTime < Now {
|
||||||
|
c.WeeklyDiscount = make(map[int]int)
|
||||||
c.WeeklyEndTime = GoUtil.ZeroTimestamp() + 7*24*3600
|
c.WeeklyEndTime = GoUtil.ZeroTimestamp() + 7*24*3600
|
||||||
}
|
}
|
||||||
c.InitChessShop(Emit)
|
c.InitChessShop(Emit)
|
||||||
@ -285,63 +285,63 @@ func (c *ChargeMod) FireFreeShop() ([]*item.Item, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 返回数据
|
// 返回数据
|
||||||
func (c *ChargeMod) BackData() *msg.ResCharge {
|
// func (c *ChargeMod) BackData() *msg.ResCharge {
|
||||||
SpecialShop := make(map[int32]*msg.ResSpecialShop)
|
// SpecialShop := make(map[int32]*msg.ResSpecialShop)
|
||||||
ChessShop := make(map[int32]*msg.ResChessShop)
|
// ChessShop := make(map[int32]*msg.ResChessShop)
|
||||||
for k, v := range c.SpecialShop {
|
// for k, v := range c.SpecialShop {
|
||||||
SpecialShop[int32(k)] = &msg.ResSpecialShop{
|
// SpecialShop[int32(k)] = &msg.ResSpecialShop{
|
||||||
Grade: int32(v.Grade),
|
// Grade: int32(v.Grade),
|
||||||
Count: int32(v.Count),
|
// Count: int32(v.Count),
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
for k, v := range c.ChessShop {
|
// for k, v := range c.ChessShop {
|
||||||
ChessShop[int32(k)] = &msg.ResChessShop{
|
// ChessShop[int32(k)] = &msg.ResChessShop{
|
||||||
Diamond: int32(v.Diamond),
|
// Diamond: int32(v.Diamond),
|
||||||
Count: int32(v.Count),
|
// Count: int32(v.Count),
|
||||||
ChessId: int32(v.Id),
|
// ChessId: int32(v.Id),
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
resWish := &msg.WishList{}
|
// resWish := &msg.WishList{}
|
||||||
if c.WishList != nil {
|
// if c.WishList != nil {
|
||||||
resWish = &msg.WishList{
|
// resWish = &msg.WishList{
|
||||||
Id: int32(c.WishList.ItemId),
|
// Id: int32(c.WishList.ItemId),
|
||||||
Count: int32(c.WishList.Count),
|
// Count: int32(c.WishList.Count),
|
||||||
Uid: c.WishList.SendList,
|
// Uid: c.WishList.SendList,
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
WeeklyDiscount := make(map[int32]*msg.WeeklyDiscountInfo)
|
// WeeklyDiscount := make(map[int32]*msg.WeeklyDiscountInfo)
|
||||||
WeeklyDiscountInfo := chargeCfg.GetWeeklyInfoAll()
|
// WeeklyDiscountInfo := chargeCfg.GetWeeklyInfoAll()
|
||||||
if c.IsWeeklyDiscountDay() {
|
// if c.IsWeeklyDiscountDay() {
|
||||||
for k, v := range WeeklyDiscountInfo {
|
// for k, v := range WeeklyDiscountInfo {
|
||||||
LimitNum := c.WeeklyDiscount[k]
|
// LimitNum := c.WeeklyDiscount[k]
|
||||||
WeeklyDiscount[int32(k)] = &msg.WeeklyDiscountInfo{
|
// WeeklyDiscount[int32(k)] = &msg.WeeklyDiscountInfo{
|
||||||
Discount: int32(v.Discount),
|
// Discount: int32(v.Discount),
|
||||||
Count: int32(v.WeeklyLimit - LimitNum),
|
// Count: int32(v.WeeklyLimit - LimitNum),
|
||||||
Id: int32(k),
|
// Id: int32(k),
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
return &msg.ResCharge{
|
// return &msg.ResCharge{
|
||||||
Charge: float32(c.Charge),
|
// Charge: float32(c.Charge),
|
||||||
Total: int32(c.Total),
|
// Total: int32(c.Total),
|
||||||
First: GoUtil.MapIntToSlice(c.EnergyShop),
|
// First: GoUtil.MapIntToSlice(c.EnergyShop),
|
||||||
SpecialShop: SpecialShop,
|
// SpecialShop: SpecialShop,
|
||||||
FreeShop: int32(c.FreeShop),
|
// FreeShop: int32(c.FreeShop),
|
||||||
ChessShop: ChessShop,
|
// ChessShop: ChessShop,
|
||||||
Gift: GoUtil.MapIntToInt32(c.Gift),
|
// Gift: GoUtil.MapIntToInt32(c.Gift),
|
||||||
Ad: c.Ad,
|
// Ad: c.Ad,
|
||||||
SpecialCharge: float32(c.SpecialCharge),
|
// SpecialCharge: float32(c.SpecialCharge),
|
||||||
SpecialChargeWeek: int32(GoUtil.FullWeeksSince(c.LastSpecialCharge)),
|
// SpecialChargeWeek: int32(GoUtil.FullWeeksSince(c.LastSpecialCharge)),
|
||||||
TodayCharge: float32(c.TodayCharge),
|
// TodayCharge: float32(c.TodayCharge),
|
||||||
MonthCharge: float32(c.MonthCharge),
|
// MonthCharge: float32(c.MonthCharge),
|
||||||
Wish: resWish,
|
// Wish: resWish,
|
||||||
AdEndTime: c.AdEndTime,
|
// AdEndTime: c.AdEndTime,
|
||||||
WeeklyDiscount: WeeklyDiscount,
|
// WeeklyDiscount: WeeklyDiscount,
|
||||||
PetWorkRemainTime: c.PetWorkTime,
|
// PetWorkRemainTime: c.PetWorkTime,
|
||||||
WeeklyEndTime: c.WeeklyEndTime,
|
// WeeklyEndTime: c.WeeklyEndTime,
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
func (c *ChargeMod) InitChessShop(Emit []int) {
|
func (c *ChargeMod) InitChessShop(Emit []int) {
|
||||||
if len(Emit) == 0 {
|
if len(Emit) == 0 {
|
||||||
@ -401,9 +401,9 @@ func (c *ChargeMod) InitChessShop(Emit []int) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *ChargeMod) BuyEnergy() ([]*item.Item, []*item.Item, int) {
|
func (c *ChargeMod) BuyEnergy(IsWeeklyDiscount bool) ([]*item.Item, []*item.Item, int) {
|
||||||
diamond := 40
|
diamond := 40
|
||||||
if c.IsWeeklyDiscountDay() {
|
if IsWeeklyDiscount {
|
||||||
LimitNum := c.WeeklyDiscount[0]
|
LimitNum := c.WeeklyDiscount[0]
|
||||||
Discount, WeeklyLimit := chargeCfg.GetWeeklyInfo(0)
|
Discount, WeeklyLimit := chargeCfg.GetWeeklyInfo(0)
|
||||||
if LimitNum < WeeklyLimit {
|
if LimitNum < WeeklyLimit {
|
||||||
@ -419,7 +419,7 @@ func (c *ChargeMod) BuyEnergy() ([]*item.Item, []*item.Item, int) {
|
|||||||
}, diamond
|
}, diamond
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *ChargeMod) BuyChess(Chess int) ([]*item.Item, []*item.Item, int, error) {
|
func (c *ChargeMod) BuyChess(Chess int, IsWeeklyDiscount bool) ([]*item.Item, []*item.Item, int, error) {
|
||||||
v, ok := c.ChessShop[Chess]
|
v, ok := c.ChessShop[Chess]
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil, nil, 0, fmt.Errorf("BuyChess chess id not exist id:%d", Chess)
|
return nil, nil, 0, fmt.Errorf("BuyChess chess id not exist id:%d", Chess)
|
||||||
@ -430,7 +430,7 @@ func (c *ChargeMod) BuyChess(Chess int) ([]*item.Item, []*item.Item, int, error)
|
|||||||
}
|
}
|
||||||
v.Count--
|
v.Count--
|
||||||
diamond := v.Diamond
|
diamond := v.Diamond
|
||||||
if c.IsWeeklyDiscountDay() {
|
if IsWeeklyDiscount {
|
||||||
LimitNum := c.WeeklyDiscount[Chess]
|
LimitNum := c.WeeklyDiscount[Chess]
|
||||||
Discount, WeeklyLimit := chargeCfg.GetWeeklyInfo(Chess)
|
Discount, WeeklyLimit := chargeCfg.GetWeeklyInfo(Chess)
|
||||||
if LimitNum < WeeklyLimit {
|
if LimitNum < WeeklyLimit {
|
||||||
@ -521,6 +521,13 @@ func (c *ChargeMod) IsWeeklyDiscountDay() bool {
|
|||||||
return Weekday == Day || c.WeeklyEndTime > GoUtil.Now()
|
return Weekday == Day || c.WeeklyEndTime > GoUtil.Now()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *ChargeMod) ResetWeeklyDiscount() {
|
||||||
|
if c.IsWeeklyDiscountDay() {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
c.WeeklyDiscount = make(map[int]int)
|
||||||
|
}
|
||||||
|
|
||||||
func (c *ChargeMod) PetWorkBackData() *msg.LogoutPetWork {
|
func (c *ChargeMod) PetWorkBackData() *msg.LogoutPetWork {
|
||||||
res := &msg.LogoutPetWork{
|
res := &msg.LogoutPetWork{
|
||||||
WorkTime: c.LastWorkTime,
|
WorkTime: c.LastWorkTime,
|
||||||
@ -529,3 +536,11 @@ func (c *ChargeMod) PetWorkBackData() *msg.LogoutPetWork {
|
|||||||
c.LastWorkTime = 0
|
c.LastWorkTime = 0
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *ChargeMod) GetWeeklyEndTime() int64 {
|
||||||
|
return c.WeeklyEndTime
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *ChargeMod) SetWeeklyEndTime(EndTime int64) {
|
||||||
|
c.WeeklyEndTime = EndTime
|
||||||
|
}
|
||||||
|
|||||||
@ -557,3 +557,14 @@ func getLimitEventMsg(t int, e *LTEInfo) *msg.LimitEvent {
|
|||||||
Param: Param,
|
Param: Param,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (l LimitedTimeEventMod) EndCatDaySale() {
|
||||||
|
delete(l.EventList, EVENT_TYPE_CAT_DAY_SALE)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (l LimitedTimeEventMod) GetCatDaySaleEndTime() int64 {
|
||||||
|
if l.EventList[EVENT_TYPE_CAT_DAY_SALE] == nil {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
return l.EventList[EVENT_TYPE_CAT_DAY_SALE].StartT + l.EventList[EVENT_TYPE_CAT_DAY_SALE].Remian
|
||||||
|
}
|
||||||
|
|||||||
@ -307,7 +307,6 @@ func (p *PlayroomMod) ZeroUpdate() {
|
|||||||
p.DailyTaskReward = make([]int, 0)
|
p.DailyTaskReward = make([]int, 0)
|
||||||
p.TodayVisitedUsers = make([]int, 0)
|
p.TodayVisitedUsers = make([]int, 0)
|
||||||
p.ADItem = make(map[int]*ItemInfo)
|
p.ADItem = make(map[int]*ItemInfo)
|
||||||
p.WeeklyDiscount = make(map[int]int)
|
|
||||||
p.InitDailyTask()
|
p.InitDailyTask()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1116,3 +1115,7 @@ func (p *PlayroomMod) AdWatch(Id int) error {
|
|||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (p *PlayroomMod) ResetWeeklyDiscount() {
|
||||||
|
p.WeeklyDiscount = make(map[int]int)
|
||||||
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user