Merge branch 'sdk' into online
This commit is contained in:
commit
ef62a9ba63
@ -213,13 +213,12 @@ func (ad *GameLogic) NewAccountInsertDataToDB() bool {
|
||||
Uid: insertId,
|
||||
EventName: "register",
|
||||
})
|
||||
G_GameLogicPtr.AddLog(&Log{
|
||||
Uid: insertId,
|
||||
EventName: "register_info",
|
||||
Param: map[string]interface{}{
|
||||
"username": ad.Db_AccountInfo.UserName,
|
||||
},
|
||||
})
|
||||
// 创建玩家日志
|
||||
player := new(Player)
|
||||
BaseMod := player.PlayMod.getBaseMod()
|
||||
BaseMod.Account = ad.Db_AccountInfo.UserName
|
||||
player.TeLog("register", nil)
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
@ -922,6 +921,7 @@ func Destroy() {
|
||||
log.Debug("服务器下线")
|
||||
if G_GameLogicPtr != nil {
|
||||
G_GameLogicPtr.M_Players.Range(func(k, v interface{}) bool {
|
||||
v.(*Player).PushAndSendClienRes(&msg.ForceKickOut{})
|
||||
v.(*Player).ClearData()
|
||||
log.Debug("palyer %d 断开连接 写入数据", k)
|
||||
return true
|
||||
|
||||
@ -1,12 +1,11 @@
|
||||
package game
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
activityCfg "server/conf/activity"
|
||||
catnipCfg "server/conf/catnip"
|
||||
guesscolorCfg "server/conf/guess_color"
|
||||
itemCfg "server/conf/item"
|
||||
languageCfg "server/conf/language"
|
||||
mailCfg "server/conf/mail"
|
||||
miningCfg "server/conf/mining"
|
||||
passCfg "server/conf/pass"
|
||||
raceCfg "server/conf/race"
|
||||
@ -92,12 +91,28 @@ func (p *Player) ActivityLogin() {
|
||||
// 发送活动邮件
|
||||
func (p *Player) SendActivityMail(ItemId, ItemNum, ActivityId int, RewardItems []*item.Item) {
|
||||
MailMod := p.PlayMod.getMailMod()
|
||||
ItemName, ItemNameEn := itemCfg.GetItemName(ItemId)
|
||||
ActivityTitle, ActivityTitleEn := activityCfg.GetActivityTitle(ActivityId)
|
||||
mt, mc, mt_en, mc_en := mailCfg.GetRecallMail(ActivityTitle, ActivityTitleEn, ItemName, ItemNameEn)
|
||||
activity_title_key, mail_title_key, mail_content_key := activityCfg.GetActivityRecycleMail(ActivityId)
|
||||
activity_title_zh := languageCfg.GetLanguage(msg.LANG_TYPE_LANG_CN, activity_title_key)
|
||||
activity_title_en := languageCfg.GetLanguage(msg.LANG_TYPE_LANG_EN, activity_title_key)
|
||||
activity_title_pt := languageCfg.GetLanguage(msg.LANG_TYPE_LANG_PTBR, activity_title_key)
|
||||
mt_zh := languageCfg.GetLanguage(msg.LANG_TYPE_LANG_CN, mail_title_key)
|
||||
mc_zh := languageCfg.GetLanguage(msg.LANG_TYPE_LANG_CN, mail_content_key)
|
||||
mt_en := languageCfg.GetLanguage(msg.LANG_TYPE_LANG_EN, mail_title_key)
|
||||
mc_en := languageCfg.GetLanguage(msg.LANG_TYPE_LANG_EN, mail_content_key)
|
||||
mt_pt := languageCfg.GetLanguage(msg.LANG_TYPE_LANG_PTBR, activity_title_key)
|
||||
mc_pt := languageCfg.GetLanguage(msg.LANG_TYPE_LANG_PTBR, mail_content_key)
|
||||
Items := []*item.Item{item.NewItem(ItemId, ItemNum)}
|
||||
Items = append(Items, RewardItems...)
|
||||
MailMod.Send(mt, "", mc, mt_en, "", mc_en, Items, mail.MAIL_TYPE_NORMAL)
|
||||
MailMod.SendMail(&mail.MailStruct{
|
||||
Title: fmt.Sprintf(mt_zh, activity_title_zh),
|
||||
Content: fmt.Sprintf(mc_zh, activity_title_zh),
|
||||
TitleEn: fmt.Sprintf(mt_en, activity_title_en),
|
||||
ContentEn: fmt.Sprintf(mc_en, activity_title_en),
|
||||
TitlePtBr: fmt.Sprintf(mt_pt, activity_title_pt),
|
||||
ContentPtBr: fmt.Sprintf(mc_pt, activity_title_pt),
|
||||
Items: Items,
|
||||
Type: mail.MAIL_TYPE_NORMAL,
|
||||
})
|
||||
}
|
||||
|
||||
// 活动模块 零点更新
|
||||
|
||||
@ -182,10 +182,7 @@ func HandleClientReq(args []interface{}) {
|
||||
p.(*Player).PlayMod.getBaseMod().DiviceId = detail.Device //加锁
|
||||
p.(*Player).PushClientRes(ResLogin)
|
||||
p.(*Player).LoginBackData()
|
||||
G_GameLogicPtr.AddLog(&Log{
|
||||
Uid: p.(*Player).M_DwUin,
|
||||
EventName: "Login_log",
|
||||
})
|
||||
p.(*Player).TeLog("Login_log", nil)
|
||||
}
|
||||
p.(*Player).ProcessTrigger()
|
||||
case "ReqServerTime": // 获取服务器时间
|
||||
|
||||
@ -380,6 +380,7 @@ func ReqGmCommand_(player *Player, Command string) error {
|
||||
player.PlayMod.ClearData(player)
|
||||
case "logout":
|
||||
player.PushAndSendClienRes(&msg.ForceKickOut{})
|
||||
player.ClearData()
|
||||
case "resetFriend":
|
||||
FriendMod := player.PlayMod.getFriendMod()
|
||||
FriendMod.FriendList = make(map[int]struct{})
|
||||
|
||||
@ -15,6 +15,7 @@ import (
|
||||
userCfg "server/conf/user"
|
||||
"server/game/mod/activity"
|
||||
"server/game/mod/card"
|
||||
"server/game/mod/decorate"
|
||||
"server/game/mod/friend"
|
||||
"server/game/mod/item"
|
||||
limitedTimeEvent "server/game/mod/limited_time_event"
|
||||
@ -849,6 +850,71 @@ func (player *Player) FixOrderBug() {
|
||||
}
|
||||
}
|
||||
|
||||
func (player *Player) FixDecorate() {
|
||||
DecorateMod := player.PlayMod.getDecorateMod()
|
||||
area_id := DecorateMod.GetAreaId()
|
||||
progress := DecorateMod.GetProgress()
|
||||
if GoUtil.InArray(area_id, []int{3, 4, 5}) && progress >= 20 {
|
||||
items := []*item.Item{}
|
||||
for i := progress + 1; i <= 25; i++ {
|
||||
if area_id == 3 && i == 25 {
|
||||
items = append(items, item.NewItem(item.ITEM_ENERGY_ID, 50))
|
||||
items = append(items, item.NewItem(101449, 1))
|
||||
}
|
||||
if area_id == 4 && i == 22 {
|
||||
items = append(items, item.NewItem(906, 1))
|
||||
}
|
||||
if area_id == 4 && i == 25 {
|
||||
items = append(items, item.NewItem(item.ITEM_ENERGY_ID, 50))
|
||||
items = append(items, item.NewItem(101452, 1))
|
||||
}
|
||||
if area_id == 5 && i == 25 {
|
||||
items = append(items, item.NewItem(item.ITEM_ENERGY_ID, 50))
|
||||
items = append(items, item.NewItem(101450, 1))
|
||||
}
|
||||
}
|
||||
title := "Game Update & Thank-You Gift"
|
||||
content := `Hi there!
|
||||
|
||||
Thanks so much for your continued support!
|
||||
We've made a few updates to the game—and as a small thank-you, we've prepared a special gift for you.
|
||||
|
||||
Happy merging!
|
||||
|
||||
Meowment Team`
|
||||
title_ptbr := "Atualização do Jogo e Presente de Agradecimento"
|
||||
content_ptbr := `Olá!
|
||||
|
||||
Muito obrigado pelo seu apoio contínuo!
|
||||
Fizemos algumas atualizações no jogo — e como forma de agradecimento, preparamos um presente especial para você.
|
||||
|
||||
Boa diversão nas combinações!
|
||||
|
||||
Equipe Meowment `
|
||||
|
||||
MailMod := player.PlayMod.getMailMod()
|
||||
MailMod.SendMail(&mail.MailStruct{
|
||||
Title: title,
|
||||
Content: content,
|
||||
TitleEn: title,
|
||||
ContentEn: content,
|
||||
TitlePtBr: title_ptbr,
|
||||
ContentPtBr: content_ptbr,
|
||||
Items: items,
|
||||
Type: mail.MAIL_TYPE_NORMAL,
|
||||
})
|
||||
DecorateMod.AreaId = area_id + 1
|
||||
DecorateMod.FinishList = make(map[int]struct{})
|
||||
DecorateMod.Progress = 0
|
||||
DecorateMod.PartCost = make(map[int]*decorate.PartCostInfo)
|
||||
DecorateMod.PartClassPool = []int{}
|
||||
DecorateMod.PartPool = make(map[int]int)
|
||||
DecorateMod.InitData()
|
||||
log.Debug("player id : %d fix decorate old area id : %d old progress : %d", player.M_DwUin, area_id, progress)
|
||||
player.PushClientRes(DecorateMod.BackData())
|
||||
}
|
||||
}
|
||||
|
||||
func (player *Player) CreatePetOrder() {
|
||||
BaseMod := player.PlayMod.getBaseMod()
|
||||
ChessMod := player.PlayMod.getChessMod()
|
||||
|
||||
@ -634,15 +634,14 @@ func LoggingMiddleware() MessageMiddleware {
|
||||
return func(next MessageHandlerFunc) MessageHandlerFunc {
|
||||
return func(message *msg.Msg) (interface{}, error) {
|
||||
start := time.Now()
|
||||
log.Debug("[Middleware] Processing message : %v, time: %v", message, start)
|
||||
|
||||
// log.Debug("[Middleware] Processing message : %v, time: %v", message, start)
|
||||
result, err := next(message)
|
||||
|
||||
duration := time.Since(start)
|
||||
if err != nil {
|
||||
log.Error("[Middleware] Message : %v failed, duration: %v, error: %v", message, duration, err)
|
||||
log.Error("[Middleware] Message handle type: %d; type: %d failed, duration: %v, error: %v", message.HandleType, message.Type, duration, err)
|
||||
} else {
|
||||
log.Debug("[Middleware] Message : %v success, duration: %v", message, duration)
|
||||
log.Debug("[Middleware] Message handle type: %d; type: %d success, duration: %v", message.HandleType, message.Type, duration)
|
||||
}
|
||||
|
||||
return result, err
|
||||
|
||||
@ -284,65 +284,6 @@ func (c *ChargeMod) FireFreeShop() ([]*item.Item, error) {
|
||||
return chargeCfg.GetFreeShopReward(c.FreeShop), nil
|
||||
}
|
||||
|
||||
// 返回数据
|
||||
// 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,
|
||||
// }
|
||||
// }
|
||||
|
||||
func (c *ChargeMod) InitChessShop(Emit []int) {
|
||||
if len(Emit) == 0 {
|
||||
return
|
||||
@ -366,26 +307,12 @@ func (c *ChargeMod) InitChessShop(Emit []int) {
|
||||
ChessLv := mergeDataCfg.GetLvById(c)
|
||||
DynamicLv := mergeDataCfg.GetAdjust(v, p, 0)
|
||||
ChessLv += DynamicLv
|
||||
Diamond := math.Round(math.Pow(2, float64(ChessLv-1)) / 18)
|
||||
Diamond := math.Round(math.Pow(2, float64(ChessLv-1)) / 5)
|
||||
Diamond = max(1, Diamond)
|
||||
RandList = append(RandList, &Rand{ChessId: c, Diamond: int(Diamond)})
|
||||
}
|
||||
}
|
||||
//ColorList = append(ColorList, ProduceList...)
|
||||
}
|
||||
// for _, v := range ColorList {
|
||||
// ColorType := mergeDataCfg.GetColorType(v)
|
||||
// r := make([]*Rand, 0)
|
||||
// switch ColorType {
|
||||
// case mergeDataCfg.CHESS_PRODUCT_MAIN_TYPE:
|
||||
// r = getChessMainRand(v)
|
||||
// case mergeDataCfg.CHESS_PRODUCT_SECONDARY_TYPE:
|
||||
// r = getChessSecondaryRand(v)
|
||||
// case mergeDataCfg.CHESS_PRODUCT_SUB_TYPE:
|
||||
// r = getChessSubRand(v)
|
||||
// }
|
||||
// RandList = append(RandList, r...)
|
||||
// }
|
||||
randList := make([]interface{}, len(RandList))
|
||||
for k, v := range RandList {
|
||||
randList[k] = v
|
||||
@ -450,10 +377,6 @@ func (c *ChargeMod) BuyChess(Chess int, IsWeeklyDiscount bool) ([]*item.Item, []
|
||||
}
|
||||
|
||||
func (c *ChargeMod) TriggerChargeUnlock(Lv int, Emit []int) {
|
||||
//UnlockLv := chargeCfg.GetUnlockShopLv()
|
||||
// if Lv != UnlockLv {
|
||||
// return
|
||||
// }
|
||||
c.InitChessShop(Emit)
|
||||
}
|
||||
|
||||
|
||||
@ -62,7 +62,7 @@ func (f *FriendTreasureMod) Flip(Pos int) ([]*item.Item, int64, error) {
|
||||
}
|
||||
f.Shift++
|
||||
Info := f.List[Pos]
|
||||
log.Debug("pos:%v, info:%v", Pos, Info)
|
||||
//log.Debug("pos:%v, info:%v", Pos, Info)
|
||||
if Info.Uid != 0 {
|
||||
log.Debug("uid:%v", Info.Uid)
|
||||
f.Uids = append(f.Uids, Info.Uid)
|
||||
|
||||
@ -259,7 +259,7 @@ func (p *Player) InitPlayer(UserName string) error {
|
||||
ChessMod := p.PlayMod.getChessMod()
|
||||
ChargeMod.FixBug(ChessMod.GetEmitList())
|
||||
p.FixOrderBug()
|
||||
|
||||
p.FixDecorate()
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -432,10 +432,11 @@ func (p *Player) Outline() {
|
||||
BaseMod.Outline(int(Cacumulative))
|
||||
p.PlayMod.save()
|
||||
p.TeLog("logout", map[string]interface{}{
|
||||
"order_list": p.PlayMod.getOrderMod().GetOrderList(),
|
||||
"after_level": p.PlayMod.getBaseMod().GetLevel(),
|
||||
"tmp_diamond": p.PlayMod.getBaseMod().GetDiamond(),
|
||||
"tmp_energy": p.PlayMod.getBaseMod().GetEnergy(),
|
||||
"caccumulative": Cacumulative,
|
||||
"order_list": p.PlayMod.getOrderMod().GetOrderList(),
|
||||
"after_level": p.PlayMod.getBaseMod().GetLevel(),
|
||||
"tmp_diamond": p.PlayMod.getBaseMod().GetDiamond(),
|
||||
"tmp_energy": p.PlayMod.getBaseMod().GetEnergy(),
|
||||
})
|
||||
p.UpdateUserInfo()
|
||||
}
|
||||
@ -1052,7 +1053,10 @@ func (p *Player) TeLog(Type string, Param map[string]interface{}) {
|
||||
Param: Param,
|
||||
})
|
||||
agent := p.GetAgent()
|
||||
if agent != nil {
|
||||
if Param == nil {
|
||||
Param = make(map[string]interface{})
|
||||
}
|
||||
if agent != nil && Param != nil {
|
||||
Param["Ip"] = agent.RemoteAddr().String()
|
||||
}
|
||||
//Param["#zone_offset"] = -5
|
||||
|
||||
@ -11,7 +11,7 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
FEISHU_WEBHOOK = "https://gadmin.bywaystudios.com/api/feishu/notify"
|
||||
FEISHU_WEBHOOK = "https://gadmin.bywaystudios.com/api/alibaba/game/notify"
|
||||
FEISHU_ORDER = "https://gadmin.bywaystudios.com/api/feishu/notify/order"
|
||||
)
|
||||
|
||||
@ -21,10 +21,9 @@ func SendFeishuFatal(PlayerId int, FuncName string, msg string) error {
|
||||
stack := make([]byte, 1024)
|
||||
length := runtime.Stack(stack, false)
|
||||
payload := map[string]interface{}{
|
||||
"notify_msg": fmt.Sprintf("游戏接口出错 %s:%d", conf.Server.GameName, PlayerId),
|
||||
"host": FuncName,
|
||||
"event_name": fmt.Sprintf("%s\nStack trace:\n%s", msg, stack[:length]),
|
||||
"severity": "High",
|
||||
"notify_msg": fmt.Sprintf("游戏接口出错 %s:%d[炸弹][炸弹][炸弹]", conf.Server.GameName, PlayerId),
|
||||
"func_name": FuncName,
|
||||
"stack": fmt.Sprintf("%s\nStack trace:\n%s", msg, stack[:length]),
|
||||
"alarm_time": time.Unix(time.Now().Unix(), 0).Format("2006-01-02 15:04:05"),
|
||||
}
|
||||
|
||||
|
||||
@ -5,17 +5,19 @@ import (
|
||||
activityCfg "server/conf/activity"
|
||||
languageCfg "server/conf/language"
|
||||
userCfg "server/conf/user"
|
||||
GoUtil "server/game_util"
|
||||
"server/msg"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func Test(t *testing.T) {
|
||||
GoUtil.SendFeishuFatal(0, "Test", "error")
|
||||
i := userCfg.GetEnergyMulByLv(1)
|
||||
fmt.Println(i)
|
||||
}
|
||||
|
||||
func TestGetActivityRecycleMail(t *testing.T) {
|
||||
title, mailTitle, mailContent := activityCfg.GetActivityRecycleMail(1)
|
||||
title, mailTitle, mailContent := activityCfg.GetActivityRecycleMail(7)
|
||||
fmt.Println("title:", title)
|
||||
fmt.Println("mailTitle:", mailTitle)
|
||||
fmt.Println("mailContent:", mailContent)
|
||||
|
||||
21
src/server/test/fix_test.go
Normal file
21
src/server/test/fix_test.go
Normal file
@ -0,0 +1,21 @@
|
||||
package test
|
||||
|
||||
import (
|
||||
"server/game"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestFixDecorate(t *testing.T) {
|
||||
// Initialize player
|
||||
p := new(game.Player)
|
||||
p.FixDecorate()
|
||||
|
||||
//
|
||||
p.InitPlayer("202601K111")
|
||||
p.FixDecorate()
|
||||
|
||||
DecorateMod := p.GetDecorateMod()
|
||||
DecorateMod.AreaId = 3
|
||||
DecorateMod.Progress = 22
|
||||
p.FixDecorate()
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user