Merge branch 'develop' into sdk
This commit is contained in:
commit
e4e02667ce
@ -30,7 +30,7 @@ func init() {
|
||||
func GetEmitTypeProduce(EmitType string) []string {
|
||||
data, err := gamedata.GetDataByKey(CFG_MERGE_EMIT_TYPE, EmitType)
|
||||
if err != nil {
|
||||
log.Debug("GetEmitTypeProduce GetOne EmitType:%s not found", EmitType)
|
||||
// log.Debug("GetEmitTypeProduce GetOne EmitType:%s not found", EmitType)
|
||||
return []string{}
|
||||
}
|
||||
return strings.Split(gamedata.GetStringValue(data, "Produce"), ",")
|
||||
@ -39,7 +39,7 @@ func GetEmitTypeProduce(EmitType string) []string {
|
||||
func GetEmitType2(EmitType string) int {
|
||||
data, err := gamedata.GetDataByKey(CFG_MERGE_EMIT_TYPE, EmitType)
|
||||
if err != nil {
|
||||
log.Debug("GetEmitTypeProduce GetOne EmitType:%s not found", EmitType)
|
||||
// log.Debug("GetEmitTypeProduce GetOne EmitType:%s not found", EmitType)
|
||||
return 0
|
||||
}
|
||||
return gamedata.GetIntValue(data, "Type2")
|
||||
|
||||
@ -640,7 +640,7 @@ func (ad *GameLogic) RegisterNetWorkFunc() {
|
||||
//Gm命令
|
||||
RegisterMsgProcessFunc("ReqGmCommand", ReqGmCommand) // Gm命令
|
||||
|
||||
//卡牌
|
||||
// #region 卡牌
|
||||
RegisterMsgProcessFunc("ReqCardInfo", ReqCardInfo) // 请求卡牌信息
|
||||
RegisterMsgProcessFunc("ReqCardCollectReward", ReqCardCollectReward) //领取卡牌系列收集奖励
|
||||
RegisterMsgProcessFunc("ReqExStarReward", ReqExStarReward) // 兑换收集星星奖励
|
||||
@ -657,6 +657,7 @@ func (ad *GameLogic) RegisterNetWorkFunc() {
|
||||
RegisterMsgProcessFunc("ReqCardSend", ReqCardSend) // 直接赠送卡牌
|
||||
RegisterMsgProcessFunc("ReqGetFriendCard", ReqGetFriendCard) // 领取好友赠送的卡牌
|
||||
RegisterMsgProcessFunc("ReqMasterCard", ReqMasterCard) // 万能卡兑换
|
||||
RegisterMsgProcessFunc("ReqCardHandbookReward", ReqCardHandbookReward) // 卡牌图鉴
|
||||
|
||||
// 日常任务
|
||||
RegisterMsgProcessFunc("ReqGetDailyTaskReward", ReqGetDailyTaskReward) // 领取日常任务奖励
|
||||
@ -765,9 +766,12 @@ func (ad *GameLogic) RegisterNetWorkFunc() {
|
||||
|
||||
// 宠物宝藏
|
||||
RegisterMsgProcessFunc("ReqFriendTreasure", ReqFriendTreasure) // 请求好友宝藏数据
|
||||
RegisterMsgProcessFunc("ReqFriendTreasureStart", ReqFriendTreasureStart) // 开始挖宝
|
||||
RegisterMsgProcessFunc("ReqFriendTreasureFilp", ReqFriendTreasureFilp) // 挖宝
|
||||
RegisterMsgProcessFunc("ReqFriendTreasureEnd", ReqFriendTreasureEnd) // 挖宝
|
||||
RegisterMsgProcessFunc("ReqFriendTreasureStart", ReqFriendTreasureStart) // 开始游戏
|
||||
RegisterMsgProcessFunc("ReqFriendTreasureFilp", ReqFriendTreasureFilp) // 翻牌
|
||||
RegisterMsgProcessFunc("ReqFriendTreasureEnd", ReqFriendTreasureEnd) // 结束游戏
|
||||
|
||||
RegisterMsgProcessFunc("ReqKafkaLog", ReqKafkaLog) // 客户端日志
|
||||
|
||||
}
|
||||
|
||||
func (ad *GameLogic) CreateHttpManager() {
|
||||
|
||||
@ -192,11 +192,11 @@ func LimitedTimeEnergyAdd(p *Player) {
|
||||
}
|
||||
Energy := BaseMod.GetEnergy()
|
||||
MaxEnergy := PlayerBaseMod.GetMaxEnergy()
|
||||
Energy += Addsta
|
||||
if Energy > MaxEnergy {
|
||||
Energy = MaxEnergy
|
||||
}
|
||||
if MaxEnergy > Energy {
|
||||
Energy += Addsta
|
||||
if Energy > MaxEnergy {
|
||||
Energy = MaxEnergy
|
||||
}
|
||||
p.CallEvent(time.Duration(Recover)*time.Second, func() {
|
||||
p.lock.Lock()
|
||||
defer p.lock.Unlock()
|
||||
|
||||
@ -292,7 +292,7 @@ func (p *Player) ZeroUpdate(a []interface{}) {
|
||||
|
||||
// 宠物宝箱
|
||||
p.PlayMod.getFriendTreasureMod().ZeroUpdate()
|
||||
p.PushClientRes(p.PlayMod.getFriendTreasureMod().BackData())
|
||||
// p.PushClientRes(p.PlayMod.getFriendTreasureMod().BackData())
|
||||
|
||||
p.PlayMod.getChampshipMod().ZeroUpdate()
|
||||
p.initAcitivity()
|
||||
|
||||
@ -3286,3 +3286,32 @@ func ReqKafkaLog(args []interface{}) error {
|
||||
})
|
||||
return nil
|
||||
}
|
||||
|
||||
func ReqCardHandbookReward(args []interface{}) error {
|
||||
_, player, buf := ParseArgs(args)
|
||||
req := &msg.ReqCardHandbookReward{}
|
||||
proto.Unmarshal(buf, req)
|
||||
CardMod := player.PlayMod.getCardMod()
|
||||
Items, err := CardMod.GetHandbookReward(int(req.CardId))
|
||||
if err != nil {
|
||||
player.SendErrClienRes(&msg.ResCardHandbookReward{
|
||||
Code: msg.RES_CODE_FAIL,
|
||||
Msg: err.Error(),
|
||||
})
|
||||
return err
|
||||
}
|
||||
err = player.HandleItem(Items, msg.ITEM_POP_LABEL_CardHandbookReward.String())
|
||||
if err != nil {
|
||||
player.SendErrClienRes(&msg.ResCardHandbookReward{
|
||||
Code: msg.RES_CODE_FAIL,
|
||||
Msg: err.Error(),
|
||||
})
|
||||
return err
|
||||
}
|
||||
player.PlayMod.save()
|
||||
player.PushClientRes(&msg.ResCardHandbookReward{
|
||||
Code: msg.RES_CODE_SUCCESS,
|
||||
CardId: req.CardId,
|
||||
})
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -23,12 +23,14 @@ type CardMod struct {
|
||||
ExCard map[int]*CardInfo // 交换卡牌
|
||||
Cache Cache // 缓存卡牌
|
||||
Round int // 轮次
|
||||
Handbook map[int]int // 图鉴
|
||||
}
|
||||
|
||||
type Cache struct {
|
||||
Card map[int]int
|
||||
Master map[int]int
|
||||
ExStar int
|
||||
Card map[int]int
|
||||
Master map[int]int
|
||||
Handbook map[int]int
|
||||
ExStar int
|
||||
}
|
||||
|
||||
const (
|
||||
@ -83,12 +85,18 @@ func (c *CardMod) InitData() {
|
||||
if c.ExCard == nil {
|
||||
c.ExCard = make(map[int]*CardInfo)
|
||||
}
|
||||
if c.Handbook == nil {
|
||||
c.Handbook = make(map[int]int)
|
||||
}
|
||||
if c.Cache.Card == nil {
|
||||
c.Cache.Card = make(map[int]int)
|
||||
}
|
||||
if c.Cache.Master == nil {
|
||||
c.Cache.Master = make(map[int]int)
|
||||
}
|
||||
if c.Cache.Handbook == nil {
|
||||
c.Cache.Handbook = make(map[int]int)
|
||||
}
|
||||
}
|
||||
|
||||
func (c *CardMod) Login(ServerOpenTime int64) {
|
||||
@ -124,6 +132,11 @@ func (c *CardMod) AddCard(Id int) {
|
||||
} else {
|
||||
c.CardList[Id] = 1
|
||||
}
|
||||
_, ok = c.Handbook[Id]
|
||||
if !ok {
|
||||
c.Handbook[Id] = 1
|
||||
c.Cache.Handbook[Id] = 1
|
||||
}
|
||||
c.Cache.Card[Id]++
|
||||
}
|
||||
|
||||
@ -437,15 +450,17 @@ func (c *CardMod) MasterCardEx(Id, CardId int) error {
|
||||
|
||||
func (c *CardMod) NotifyCard() *msg.ResNotifyCard {
|
||||
m := &msg.ResNotifyCard{
|
||||
Card: GoUtil.MapIntToInt32(c.Cache.Card),
|
||||
Master: GoUtil.MapIntToInt32(c.Cache.Master),
|
||||
ExStar: int32(c.Cache.ExStar),
|
||||
Card: GoUtil.MapIntToInt32(c.Cache.Card),
|
||||
Master: GoUtil.MapIntToInt32(c.Cache.Master),
|
||||
Handbook: GoUtil.MapIntToInt32(c.Cache.Handbook),
|
||||
ExStar: int32(c.Cache.ExStar),
|
||||
}
|
||||
// log.Debug("NotifyCard %v", c.Cache.Card)
|
||||
c.Cache = Cache{
|
||||
Card: make(map[int]int),
|
||||
Master: make(map[int]int),
|
||||
ExStar: 0,
|
||||
Card: make(map[int]int),
|
||||
Master: make(map[int]int),
|
||||
Handbook: make(map[int]int),
|
||||
ExStar: 0,
|
||||
}
|
||||
return m
|
||||
}
|
||||
@ -500,3 +515,16 @@ func (c *CardMod) AddGoldTimes() {
|
||||
c.GoldTimes++
|
||||
c.GoldTimes = min(2, c.GoldTimes)
|
||||
}
|
||||
|
||||
func (c *CardMod) GetHandbookReward(CardId int) ([]*item.Item, error) {
|
||||
if v, ok := c.Handbook[CardId]; ok {
|
||||
if v == 2 {
|
||||
return nil, fmt.Errorf("GetHandbookReward already get")
|
||||
}
|
||||
Star := cardCfg.GetStarById(CardId)
|
||||
c.Handbook[CardId] = 2
|
||||
c.Cache.Handbook[CardId] = 2
|
||||
return []*item.Item{item.NewItem(item.ITEM_ENERGY_ID, Star)}, nil
|
||||
}
|
||||
return nil, fmt.Errorf("GetHandbookReward not find card")
|
||||
}
|
||||
|
||||
@ -169,6 +169,7 @@ func (l *LimitedTimeEventMod) ProgressBackData() *msg.ResLimitEventProgress {
|
||||
return &msg.ResLimitEventProgress{
|
||||
Progress: int32(l.Progress),
|
||||
ProgressReward: r,
|
||||
ProgressMax: int32(l.ProgressMax),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -13,7 +13,7 @@ import (
|
||||
type PlayroomMod struct {
|
||||
Collect map[int]int // 装饰
|
||||
Room map[int]int // 房间
|
||||
Status int // 0: 未开始 1: 进行中 2: 结束
|
||||
Status int // 0: 未拜访 1: 拜访
|
||||
Endtime int64 // 结束时间
|
||||
Starttime int64 // 开始时间
|
||||
WorkStatus int // 0: 未开始 1: 进行中 2: 结束
|
||||
@ -34,6 +34,9 @@ type PlayroomMod struct {
|
||||
Flip map[int]int // 翻牌
|
||||
FlipReward []*item.Item // 翻牌奖励
|
||||
WorkOutline int // 是否离线
|
||||
LastFlip int // 上次翻牌奖励档次
|
||||
NoFlip int // 连续未获取最高翻牌奖励次数
|
||||
TodayFlip bool // 今日是否已获得最高档奖励
|
||||
}
|
||||
|
||||
const (
|
||||
@ -98,6 +101,11 @@ func (p *PlayroomMod) InitData() {
|
||||
}
|
||||
}
|
||||
|
||||
func (p *PlayroomMod) ZeroUpdate() {
|
||||
p.TodayFlip = false
|
||||
p.LastFlip = 0
|
||||
}
|
||||
|
||||
func (p *PlayroomMod) GetVisitor() map[int]*Info {
|
||||
return p.Visitor
|
||||
}
|
||||
@ -396,6 +404,24 @@ func (p *PlayroomMod) FlipCard(Pos int) (int, error) {
|
||||
FLIP_TYPE_GOLD: 20,
|
||||
}
|
||||
Prob := GoUtil.RandMap(RandMap)
|
||||
|
||||
/**
|
||||
若玩家同一天内上一次游玩猫猫小金库未能获得金币档位奖励,且当天还未获得过金币档位奖励
|
||||
或玩家已连续三次未能获得金币档位奖励,则启用以下保底逻辑
|
||||
玩家已翻出两个银币或铜币图案的情况下,后续翻牌必然为金币
|
||||
*/
|
||||
check := make(map[int]int)
|
||||
for _, v := range p.Flip {
|
||||
check[v]++
|
||||
}
|
||||
if check[FLIP_TYPE_COPPER] == 2 || check[FLIP_TYPE_SILVER] == 2 {
|
||||
if p.LastFlip != FLIP_TYPE_GOLD && !p.TodayFlip {
|
||||
Prob = FLIP_TYPE_GOLD
|
||||
}
|
||||
if p.NoFlip == 3 {
|
||||
Prob = FLIP_TYPE_GOLD
|
||||
}
|
||||
}
|
||||
p.Flip[Pos] = Prob
|
||||
|
||||
return Prob, nil
|
||||
@ -409,12 +435,17 @@ func (p *PlayroomMod) GetFlipReward() ([]*item.Item, error) {
|
||||
if check[v] == 3 {
|
||||
switch v {
|
||||
case FLIP_TYPE_COPPER:
|
||||
p.NoFlip++
|
||||
Items = append(Items, p.GameReward[FLIP_TYPE_COPPER])
|
||||
case FLIP_TYPE_SILVER:
|
||||
p.NoFlip++
|
||||
Items = append(Items, p.GameReward[FLIP_TYPE_SILVER])
|
||||
case FLIP_TYPE_GOLD:
|
||||
p.NoFlip = 0
|
||||
p.TodayFlip = true
|
||||
Items = append(Items, p.GameReward[FLIP_TYPE_GOLD])
|
||||
}
|
||||
p.LastFlip = v
|
||||
p.Status = STATUS_IDLE
|
||||
p.GameId = 0
|
||||
p.Flip = make(map[int]int)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user