Merge branch 'develop' into sdk

This commit is contained in:
hahwu 2026-01-16 16:11:48 +08:00
commit 09e2142a6c
8 changed files with 113 additions and 86 deletions

View File

@ -922,6 +922,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

View File

@ -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,
})
}
// 活动模块 零点更新

View File

@ -377,6 +377,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{})

View File

@ -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 gameand 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()

View File

@ -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)
}

View File

@ -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
}

View File

@ -17,7 +17,7 @@ func Test(t *testing.T) {
}
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)

View 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()
}