猫咪闪促
This commit is contained in:
parent
b1af9103bf
commit
0ac249ad30
@ -47,7 +47,7 @@ func ADPetWorkFire(p *Player, ChargeId int) {
|
||||
}
|
||||
}
|
||||
p.PlayMod.save()
|
||||
p.PushClientRes(ChargeMod.BackData())
|
||||
p.ChargeBackData()
|
||||
}
|
||||
|
||||
func ActivityFire(p *Player, ChargeId int) {
|
||||
@ -154,7 +154,7 @@ func ChargeFire(p *Player, ChargeId int) {
|
||||
log.Debug("ChargeFire err : %s", err)
|
||||
}
|
||||
p.PlayMod.save()
|
||||
p.PushClientRes(ChargeMod.BackData())
|
||||
p.ChargeBackData()
|
||||
}
|
||||
|
||||
func ChargeItem(p *Player, ChargeId int) []*item.Item {
|
||||
|
||||
@ -540,7 +540,7 @@ func ReqGmCommand_(player *Player, Command string) error {
|
||||
case "resetWeekly":
|
||||
ChargeMod := player.PlayMod.getChargeMod()
|
||||
ChargeMod.WeeklyDiscount = make(map[int]int)
|
||||
player.PushClientRes(ChargeMod.BackData())
|
||||
player.ChargeBackData()
|
||||
PlayroomMod := player.PlayMod.getPlayroomMod()
|
||||
PlayroomMod.WeeklyDiscount = make(map[int]int)
|
||||
PlayroomBackData(player)
|
||||
|
||||
@ -76,6 +76,15 @@ func LimitedTimeEventTrigger(p *Player, AddEventId int) {
|
||||
p.PushClientRes(p.PlayMod.getOrderMod().BackData())
|
||||
case limitedTimeEvent.EVENT_TYPE_CARD_FESTIVAL:
|
||||
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())
|
||||
|
||||
@ -327,7 +327,7 @@ func (p *Player) ZeroUpdate(a []interface{}) {
|
||||
ChessMod := p.PlayMod.getChessMod()
|
||||
ChargeMod := p.PlayMod.getChargeMod()
|
||||
ChargeMod.ZeroUpdate(ChessMod.GetEmitList())
|
||||
p.PushClientRes(p.PlayMod.getChargeMod().BackData())
|
||||
p.ChargeBackData()
|
||||
|
||||
// 无尽礼包
|
||||
p.PlayMod.getEndlessMod().ZeroUpdate(p.PlayMod.getChargeMod().GetMaxCharge(), p.PlayMod.getBaseMod().GetLevel())
|
||||
@ -344,6 +344,9 @@ func (p *Player) ZeroUpdate(a []interface{}) {
|
||||
// playroom
|
||||
PlayroomMod := p.PlayMod.getPlayroomMod()
|
||||
PlayroomMod.ZeroUpdate()
|
||||
if ChargeMod.IsWeeklyDiscountDay() {
|
||||
PlayroomMod.ResetWeeklyDiscount()
|
||||
}
|
||||
PlayroomBackData(p)
|
||||
p.PlayMod.getChampshipMod().ZeroUpdate()
|
||||
p.initAcitivity()
|
||||
@ -375,7 +378,7 @@ func (p *Player) NoonUpdate(a []interface{}) {
|
||||
ChessMod := p.PlayMod.getChessMod()
|
||||
// 礼包充值
|
||||
p.PlayMod.getChargeMod().NoonUpdate(ChessMod.GetEmitList())
|
||||
p.PushClientRes(p.PlayMod.getChargeMod().BackData())
|
||||
p.ChargeBackData()
|
||||
p.PlayMod.save()
|
||||
}
|
||||
|
||||
@ -414,17 +417,30 @@ func (p *Player) Login() {
|
||||
ChargeMod.WeeklyEndTime = WeeklyEndTime
|
||||
}
|
||||
if WeeklyStartTime > now {
|
||||
go func() {
|
||||
time.Sleep(time.Duration(WeeklyStartTime-now) * time.Second)
|
||||
p.CallEvent(time.Duration(WeeklyStartTime-now)*time.Second, func() {
|
||||
ChargeMod.WeeklyEndTime = WeeklyEndTime
|
||||
p.PushClientRes(ChargeMod.BackData())
|
||||
ChargeMod.ResetWeeklyDiscount()
|
||||
PlayroomMod := p.PlayMod.getPlayroomMod()
|
||||
PlayroomMod.ResetWeeklyDiscount()
|
||||
p.ChargeBackData()
|
||||
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 {
|
||||
FriendMod := p.PlayMod.getFriendMod()
|
||||
FriendMod.AddActLog(friend.ACT_LOG_TYPE_LOST_USER_RETURN, "")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
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.SevenLogin.BackData())
|
||||
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.Endless.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.Guide.BackData())
|
||||
p.BackDataActivity()
|
||||
p.ChargeBackData()
|
||||
BackChampship(p)
|
||||
BackUserInfo(p)
|
||||
}
|
||||
|
||||
@ -2,8 +2,10 @@ package game
|
||||
|
||||
import (
|
||||
"server/GoUtil"
|
||||
chargeCfg "server/conf/charge"
|
||||
playroomCfg "server/conf/playroom"
|
||||
"server/game/mod/item"
|
||||
"server/game/mod/limitedTimeEvent"
|
||||
proto "server/msg"
|
||||
)
|
||||
|
||||
@ -125,7 +127,9 @@ func PlayroomBackData(p *Player) {
|
||||
}
|
||||
weeklyDiscount := make(map[int32]*proto.WeeklyDiscountInfo)
|
||||
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()
|
||||
for k, v := range w1 {
|
||||
limitNum := PlayroomMod.WeeklyDiscount[k]
|
||||
@ -196,7 +200,6 @@ func PlayroomVisit(p *Player, Uid int) {
|
||||
r.Chip = int32(data.Chip)
|
||||
r.Kiss = int32(data.Kiss)
|
||||
r.DressSet = GoUtil.MapIntToInt32(PlayerData.DressSet)
|
||||
|
||||
p.PushClientRes(r)
|
||||
}
|
||||
|
||||
@ -229,3 +232,65 @@ func BackUserInfo(p *Player) {
|
||||
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.TriggerChargeUnlock(int(BaseMod.Level), ChessMod.GetEmitList())
|
||||
player.PushClientRes(ChargeMod.BackData())
|
||||
player.ChargeBackData()
|
||||
OrderMod := player.PlayMod.getOrderMod()
|
||||
player.TriggerOrder(BaseMod.Level, order.TRIGGER_TYPE_LV, ChessMod.GetOrderEmit(), player.PlayMod.getBaseMod().GetEnergyMul())
|
||||
player.PushClientRes(OrderMod.BackData())
|
||||
|
||||
@ -23,6 +23,7 @@ import (
|
||||
"server/game/mod/card"
|
||||
"server/game/mod/friend"
|
||||
"server/game/mod/item"
|
||||
"server/game/mod/limitedTimeEvent"
|
||||
"server/game/mod/mail"
|
||||
"server/game/mod/msg"
|
||||
"server/game/mod/order"
|
||||
@ -320,7 +321,7 @@ func handle(p *Player, m *msg.Msg) error {
|
||||
ChargeMod := p.PlayMod.getChargeMod()
|
||||
ChargeMod.AddWishCount()
|
||||
p.AddLog(m.From, friend.LOG_TYPE_WISH, "", m.SendT)
|
||||
p.PushClientRes(ChargeMod.BackData())
|
||||
p.ChargeBackData()
|
||||
case msg.HANDLE_TYPE_PLAYROOM_KISS: // playroom亲吻
|
||||
p.NotifyPlayroomKiss()
|
||||
case msg.HANDLE_TYPE_CATNIP_INVITE: // 邀请好友参与猫咪游戏
|
||||
@ -953,7 +954,7 @@ func EmitRetireTrigger2(p *Player) {
|
||||
ChessMod.FinishRetire(k)
|
||||
ChargeMod := p.PlayMod.getChargeMod()
|
||||
ChargeMod.InitChessShop(ChessMod.GetEmitList())
|
||||
p.PushClientRes(ChargeMod.BackData())
|
||||
p.ChargeBackData()
|
||||
continue
|
||||
}
|
||||
OrderMod.CreateCleanOrder(ChessList)
|
||||
@ -1564,3 +1565,9 @@ func (player *Player) GetPlayroomClean() map[int]int {
|
||||
}
|
||||
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)
|
||||
BaseMod := player.PlayMod.getBaseMod()
|
||||
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())
|
||||
if err != nil {
|
||||
player.SendErrClienRes(&msg.ResBuyEnergy{
|
||||
@ -1487,7 +1487,7 @@ func ReqBuyEnergy(player *Player, buf []byte) error {
|
||||
player.PushClientRes(&msg.ResBuyEnergy{
|
||||
Code: msg.RES_CODE_SUCCESS,
|
||||
})
|
||||
player.PushClientRes(ChargeMod.BackData())
|
||||
player.ChargeBackData()
|
||||
player.TeLog("buy_energy_diamond", map[string]interface{}{
|
||||
"diamond_cost": Diamond,
|
||||
"energy_num": Energy,
|
||||
@ -2529,7 +2529,7 @@ func ReqFreeShop(player *Player, buf []byte) error {
|
||||
return err
|
||||
}
|
||||
player.PlayMod.save()
|
||||
player.PushClientRes(ChargeMod.BackData())
|
||||
player.ChargeBackData()
|
||||
player.PushClientRes(&msg.ResFreeShop{
|
||||
Code: msg.RES_CODE_SUCCESS,
|
||||
})
|
||||
@ -2546,7 +2546,7 @@ func ReqBuyChessShop(player *Player, buf []byte) error {
|
||||
req := &msg.ReqBuyChessShop{}
|
||||
proto.Unmarshal(buf, req)
|
||||
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 {
|
||||
player.SendErrClienRes(&msg.ResBuyChessShop{
|
||||
Code: msg.RES_CODE_FAIL,
|
||||
@ -2577,7 +2577,7 @@ func ReqBuyChessShop(player *Player, buf []byte) error {
|
||||
"cost_num": -LostItem[0].Num,
|
||||
})
|
||||
player.PlayMod.save()
|
||||
player.PushClientRes(ChargeMod.BackData())
|
||||
player.ChargeBackData()
|
||||
player.PushClientRes(&msg.ResBuyChessShop{
|
||||
Code: msg.RES_CODE_SUCCESS,
|
||||
})
|
||||
@ -2594,7 +2594,7 @@ func ReqBuyChessShop2(player *Player, buf []byte) error {
|
||||
req := &msg.ReqBuyChessShop2{}
|
||||
proto.Unmarshal(buf, req)
|
||||
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 {
|
||||
player.SendErrClienRes(&msg.ResBuyChessShop2{
|
||||
Code: msg.RES_CODE_FAIL,
|
||||
@ -2635,7 +2635,7 @@ func ReqBuyChessShop2(player *Player, buf []byte) error {
|
||||
"cost_num": LostItem[0].Num,
|
||||
})
|
||||
player.PlayMod.save()
|
||||
player.PushClientRes(ChargeMod.BackData())
|
||||
player.ChargeBackData()
|
||||
player.PushClientRes(&msg.ResBuyChessShop2{
|
||||
Code: msg.RES_CODE_SUCCESS,
|
||||
})
|
||||
@ -2662,7 +2662,7 @@ func ReqRefreshChessShop(player *Player, buf []byte) error {
|
||||
return err
|
||||
}
|
||||
player.PlayMod.save()
|
||||
player.PushClientRes(ChargeMod.BackData())
|
||||
player.ChargeBackData()
|
||||
player.TeLog("refresh_store_diamond", map[string]interface{}{
|
||||
"diamond_cost": 20,
|
||||
})
|
||||
@ -4163,8 +4163,7 @@ func ReqPlayroomShop(player *Player, buf []byte) error {
|
||||
req := &msg.ReqPlayroomShop{}
|
||||
proto.Unmarshal(buf, req)
|
||||
PlayroomMod := player.PlayMod.getPlayroomMod()
|
||||
ChargeMod := player.PlayMod.getChargeMod()
|
||||
AddItems, LoseItem, err := PlayroomMod.ShopBuy(int(req.Id), int(req.Num), ChargeMod.IsWeeklyDiscountDay())
|
||||
AddItems, LoseItem, err := PlayroomMod.ShopBuy(int(req.Id), int(req.Num), player.IsWeeklyDiscount())
|
||||
if err != nil {
|
||||
player.SendErrClienRes(&msg.ResPlayroomShop{
|
||||
Code: msg.RES_CODE_FAIL,
|
||||
|
||||
@ -136,8 +136,8 @@ func (c *ChargeMod) ZeroUpdate(Emit []int) {
|
||||
c.SpecialShop[i] = &SepcialShop{Grade: SpecialGrade, Count: SpecialShopCount}
|
||||
}
|
||||
c.WishList.SendList = make([]int64, 0)
|
||||
c.WeeklyDiscount = make(map[int]int)
|
||||
if c.IsWeeklyDiscountDay() && c.WeeklyEndTime < Now {
|
||||
c.WeeklyDiscount = make(map[int]int)
|
||||
c.WeeklyEndTime = GoUtil.ZeroTimestamp() + 7*24*3600
|
||||
}
|
||||
c.InitChessShop(Emit)
|
||||
@ -285,63 +285,63 @@ func (c *ChargeMod) FireFreeShop() ([]*item.Item, error) {
|
||||
}
|
||||
|
||||
// 返回数据
|
||||
func (c *ChargeMod) BackData() *msg.ResCharge {
|
||||
SpecialShop := make(map[int32]*msg.ResSpecialShop)
|
||||
ChessShop := make(map[int32]*msg.ResChessShop)
|
||||
for k, v := range c.SpecialShop {
|
||||
SpecialShop[int32(k)] = &msg.ResSpecialShop{
|
||||
Grade: int32(v.Grade),
|
||||
Count: int32(v.Count),
|
||||
}
|
||||
}
|
||||
// func (c *ChargeMod) BackData() *msg.ResCharge {
|
||||
// SpecialShop := make(map[int32]*msg.ResSpecialShop)
|
||||
// ChessShop := make(map[int32]*msg.ResChessShop)
|
||||
// for k, v := range c.SpecialShop {
|
||||
// SpecialShop[int32(k)] = &msg.ResSpecialShop{
|
||||
// Grade: int32(v.Grade),
|
||||
// Count: int32(v.Count),
|
||||
// }
|
||||
// }
|
||||
|
||||
for k, v := range c.ChessShop {
|
||||
ChessShop[int32(k)] = &msg.ResChessShop{
|
||||
Diamond: int32(v.Diamond),
|
||||
Count: int32(v.Count),
|
||||
ChessId: int32(v.Id),
|
||||
}
|
||||
}
|
||||
resWish := &msg.WishList{}
|
||||
if c.WishList != nil {
|
||||
resWish = &msg.WishList{
|
||||
Id: int32(c.WishList.ItemId),
|
||||
Count: int32(c.WishList.Count),
|
||||
Uid: c.WishList.SendList,
|
||||
}
|
||||
}
|
||||
WeeklyDiscount := make(map[int32]*msg.WeeklyDiscountInfo)
|
||||
WeeklyDiscountInfo := chargeCfg.GetWeeklyInfoAll()
|
||||
if c.IsWeeklyDiscountDay() {
|
||||
for k, v := range WeeklyDiscountInfo {
|
||||
LimitNum := c.WeeklyDiscount[k]
|
||||
WeeklyDiscount[int32(k)] = &msg.WeeklyDiscountInfo{
|
||||
Discount: int32(v.Discount),
|
||||
Count: int32(v.WeeklyLimit - LimitNum),
|
||||
Id: int32(k),
|
||||
}
|
||||
}
|
||||
}
|
||||
return &msg.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: c.WeeklyEndTime,
|
||||
}
|
||||
}
|
||||
// for k, v := range c.ChessShop {
|
||||
// ChessShop[int32(k)] = &msg.ResChessShop{
|
||||
// Diamond: int32(v.Diamond),
|
||||
// Count: int32(v.Count),
|
||||
// ChessId: int32(v.Id),
|
||||
// }
|
||||
// }
|
||||
// resWish := &msg.WishList{}
|
||||
// if c.WishList != nil {
|
||||
// resWish = &msg.WishList{
|
||||
// Id: int32(c.WishList.ItemId),
|
||||
// Count: int32(c.WishList.Count),
|
||||
// Uid: c.WishList.SendList,
|
||||
// }
|
||||
// }
|
||||
// WeeklyDiscount := make(map[int32]*msg.WeeklyDiscountInfo)
|
||||
// WeeklyDiscountInfo := chargeCfg.GetWeeklyInfoAll()
|
||||
// if c.IsWeeklyDiscountDay() {
|
||||
// for k, v := range WeeklyDiscountInfo {
|
||||
// LimitNum := c.WeeklyDiscount[k]
|
||||
// WeeklyDiscount[int32(k)] = &msg.WeeklyDiscountInfo{
|
||||
// Discount: int32(v.Discount),
|
||||
// Count: int32(v.WeeklyLimit - LimitNum),
|
||||
// Id: int32(k),
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return &msg.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: c.WeeklyEndTime,
|
||||
// }
|
||||
// }
|
||||
|
||||
func (c *ChargeMod) InitChessShop(Emit []int) {
|
||||
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
|
||||
if c.IsWeeklyDiscountDay() {
|
||||
if IsWeeklyDiscount {
|
||||
LimitNum := c.WeeklyDiscount[0]
|
||||
Discount, WeeklyLimit := chargeCfg.GetWeeklyInfo(0)
|
||||
if LimitNum < WeeklyLimit {
|
||||
@ -419,7 +419,7 @@ func (c *ChargeMod) BuyEnergy() ([]*item.Item, []*item.Item, int) {
|
||||
}, 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]
|
||||
if !ok {
|
||||
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--
|
||||
diamond := v.Diamond
|
||||
if c.IsWeeklyDiscountDay() {
|
||||
if IsWeeklyDiscount {
|
||||
LimitNum := c.WeeklyDiscount[Chess]
|
||||
Discount, WeeklyLimit := chargeCfg.GetWeeklyInfo(Chess)
|
||||
if LimitNum < WeeklyLimit {
|
||||
@ -521,6 +521,13 @@ func (c *ChargeMod) IsWeeklyDiscountDay() bool {
|
||||
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 {
|
||||
res := &msg.LogoutPetWork{
|
||||
WorkTime: c.LastWorkTime,
|
||||
@ -529,3 +536,11 @@ func (c *ChargeMod) PetWorkBackData() *msg.LogoutPetWork {
|
||||
c.LastWorkTime = 0
|
||||
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,
|
||||
}
|
||||
}
|
||||
|
||||
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.TodayVisitedUsers = make([]int, 0)
|
||||
p.ADItem = make(map[int]*ItemInfo)
|
||||
p.WeeklyDiscount = make(map[int]int)
|
||||
p.InitDailyTask()
|
||||
}
|
||||
|
||||
@ -1116,3 +1115,7 @@ func (p *PlayroomMod) AdWatch(Id int) error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *PlayroomMod) ResetWeeklyDiscount() {
|
||||
p.WeeklyDiscount = make(map[int]int)
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user