锦标赛死循环bug修复,奖励补发

This commit is contained in:
hahwu 2026-05-11 16:39:02 +08:00
parent a9c99da5ab
commit 544314bebe
6 changed files with 954 additions and 4 deletions

View File

@ -115,11 +115,15 @@ func (c *ChampshipMgr) Init() {
now := GoUtil.Now()
zeroTime := GoUtil.ZeroTimestamp()
activityCfg := G_GameLogicPtr.ActivityMgr.GetActivityListByType(activity.ACT_TYPE_CHAMPION)
t := c.mDispatr.AfterFunc(time.Duration(activityCfg.Endtime-now)*time.Second, func() {
remainDuration := activityCfg.Endtime - now
if remainDuration <= 0 {
remainDuration = GoUtil.NextZeroTimestampDuration()
}
t := c.mDispatr.AfterFunc(time.Duration(remainDuration)*time.Second, func() {
c.ZeroUpdate()
})
dispterTimer["zero"] = t
log.Debug("ChampshipMgr init success, activity endtime:%d, now:%d, remain:%d, next zero update time:%s", activityCfg.Endtime, now, activityCfg.Endtime-now, GoUtil.FormatTime(activityCfg.Endtime))
log.Debug("ChampshipMgr init success, activity endtime:%d, now:%d, remain:%d, next zero update time:%s", activityCfg.Endtime, now, remainDuration, GoUtil.FormatTime(activityCfg.Endtime))
remain := now - zeroTime
remain1 := 1800 - remain%1800
@ -202,11 +206,14 @@ func (c *ChampshipMgr) ReloadActivity() {
t.Stop()
}
timeDuration := activityCfg.Endtime - GoUtil.Now()
if timeDuration <= 0 {
timeDuration = GoUtil.NextZeroTimestampDuration()
}
t = c.mDispatr.AfterFunc(time.Duration(timeDuration)*time.Second, func() {
c.ZeroUpdate()
})
dispterTimer["zero"] = t
log.Debug("ChampshipMgr reload activity success, activity endtime:%d, now:%d, remain:%d, next zero update time:%s", activityCfg.Endtime, GoUtil.Now(), activityCfg.Endtime-GoUtil.Now(), GoUtil.FormatTime(activityCfg.Endtime))
log.Debug("ChampshipMgr reload activity success, activity endtime:%d, now:%d, remain:%d, next zero update time:%s", activityCfg.Endtime, GoUtil.Now(), timeDuration, GoUtil.FormatTime(GoUtil.Now()+timeDuration))
}
func (c *ChampshipMgr) ZeroUpdate() (interface{}, error) {
@ -250,12 +257,15 @@ func (c *ChampshipMgr) ZeroUpdate() (interface{}, error) {
}
data.mu.Unlock()
timeDuration := activityCfg.Endtime - GoUtil.Now()
if timeDuration <= 0 {
timeDuration = GoUtil.NextZeroTimestampDuration()
}
t := c.mDispatr.AfterFunc(time.Duration(timeDuration)*time.Second, func() {
c.ZeroUpdate()
})
dispterTimer["zero"] = t
now := GoUtil.Now()
log.Debug("ChampshipMgr init success, activity endtime:%d, now:%d, remain:%d, next zero update time:%s", activityCfg.Endtime, now, activityCfg.Endtime-now, GoUtil.FormatTime(activityCfg.Endtime))
log.Debug("ChampshipMgr init success, activity endtime:%d, now:%d, remain:%d, next zero update time:%s", activityCfg.Endtime, now, timeDuration, GoUtil.FormatTime(timeDuration+now))
c.mDispatr.AfterFunc(time.Duration(timeDuration+1800)*time.Second, func() {
c.ZeroNotifyAll()
})

View File

@ -33,3 +33,57 @@ func (p *Player) Compensation20250910() {
})
p.PlayMod.save()
}
func (p *Player) Compensation20260511() {
compensationMod := p.PlayMod.getCompensationMod()
if compensationMod.Is20260511() {
return // 已经领取过补偿
}
items := compensationMod.Compensation20260511(int(p.M_DwUin))
if len(items) == 0 {
return // 没有补偿物品
}
MailMod := p.PlayMod.getMailMod()
MailMod.SendMail(&mail.MailStruct{
Title: "1774929600",
SubTitle: "",
Content: `尊敬的玩家
对于锦标赛奖励发放延迟我们深表歉意
目前奖励已补发至您的账户请尽快领取避免错过福利
非常感谢您的耐心与理解
如遇到任何问题我们的团队随时为您提供帮助
此致,
Meowment 团队`,
TitleEn: "Reward Reissue Notice",
SubTitleEn: "",
ContentEn: `Dear player,
We sincerely apologize for the delay in delivering your Pets' Championship rewards.
They have now been reissued to your account please claim them soon so you dont miss out.
Thank you so much for your patience and understanding!
If you run into any issues, our team is here to help.
Thanks,
Meowment Team`,
TitlePtBr: "Aviso de Reemissão de Recompensas",
ContentPtBr: `Caro jogador,
Pedimos sinceras desculpas pelo atraso na entrega das suas recompensas do Campeonato de Pets.
As recompensas foram reenviadas para sua conta resgate-as em breve para não perder.
Agradecemos muito sua paciência e compreensão!
Se encontrar qualquer problema, nossa equipe estará disponível para ajudar.
Atenciosamente,
Equipe Meowment`,
TitleEsLatam: "Aviso de Reemisión de Recompensas",
ContentEsLatam: `Estimado jugador,
Lamentamos sinceramente el retraso en la entrega de tus recompensas del Campeonato de Mascotas.
Ya han sido reenviadas a tu cuenta. Por favor, reclámalas pronto para no perderlas.
Muchas gracias por tu paciencia y comprensión.
Si tienes cualquier problema, nuestro equipo está aquí para ayudarte.
Saludos,
Equipo Meowment`,
Items: items,
Type: mail.MAIL_TYPE_NORMAL,
})
p.PlayMod.save()
}

View File

@ -7,6 +7,7 @@ import (
type Compensation struct {
C20250910 bool // 2025年7月16日补偿
C20260511 bool // 2026年5月11日补偿
}
func (c *Compensation) InitData() {
@ -21,6 +22,35 @@ func (c *Compensation) Set20250910() {
c.C20250910 = true
}
func (c *Compensation) Is20260511() bool {
return c.C20260511
}
func (c *Compensation) Set20260511() {
c.C20260511 = true
}
func (c *Compensation) Compensation20260511(uid int) []*item.Item {
c.Set20260511()
rank := Compensation20260511_user[uid]
if rank == 0 {
return nil
}
for _, cfg := range Compensation20260511_cfg {
if rank < cfg.Min || rank > cfg.Max {
continue
}
items := make([]*item.Item, 0, len(cfg.Items))
for _, itemCfg := range cfg.Items {
items = append(items, item.NewItem(itemCfg.Id, itemCfg.Num))
}
return items
}
return nil
}
func (c *Compensation) Compensation20250910(userName string) []*item.Item {
c.Set20250910()
// 获取补偿物品
@ -64,3 +94,818 @@ As an apology, weve prepared a compensation pack for you—please check it.
Thank you for being with us, and we hope this new version brings you even more fun!
If you have any questions, feel free to reach out to us anytime. Enjoy the game! `,
}
var Compensation20260511_Mail_Config = MailConfig{
Title: "Reward Reissue Notice",
Content: `Dear player,
We sincerely apologize for the delay in delivering your Pets' Championship rewards.
They have now been reissued to your account please claim them soon so you dont miss out.
Thank you so much for your patience and understanding!
If you run into any issues, our team is here to help.
Thanks,
Meowment Team`,
}
var Compensation20260511_user = map[int]int{
100031: 11,
100058: 8,
101376: 20,
101607: 13,
101734: 2,
102191: 11,
102603: 5,
104135: 24,
104329: 22,
105776: 22,
105800: 16,
106166: 24,
106590: 8,
106627: 11,
106662: 23,
106816: 6,
106996: 5,
107087: 18,
107187: 5,
107225: 8,
107342: 14,
107374: 15,
107746: 6,
107823: 18,
108417: 26,
108498: 11,
108753: 12,
108953: 13,
109329: 18,
109401: 16,
109404: 10,
109757: 6,
109902: 30,
109940: 19,
109944: 5,
109984: 14,
110154: 20,
110192: 10,
110238: 14,
110282: 15,
110482: 22,
110513: 4,
110715: 13,
110801: 16,
111047: 16,
111185: 4,
111289: 5,
111297: 4,
111375: 24,
111449: 13,
111462: 24,
111569: 13,
111578: 18,
111588: 14,
111726: 5,
111791: 22,
111806: 23,
111879: 11,
111923: 25,
111975: 9,
112116: 12,
112133: 27,
112148: 24,
112169: 6,
112232: 8,
112236: 14,
112571: 8,
112732: 19,
112983: 23,
113072: 13,
113076: 2,
113537: 5,
113632: 20,
113777: 8,
114041: 12,
114117: 16,
114404: 7,
114441: 22,
114447: 7,
114467: 22,
114501: 8,
114564: 8,
114752: 15,
114774: 10,
114805: 21,
114835: 9,
114937: 15,
115021: 12,
115028: 8,
115070: 26,
115169: 9,
115200: 15,
115275: 12,
115281: 14,
115394: 5,
115409: 13,
115418: 21,
115474: 17,
115494: 24,
115515: 5,
115607: 15,
115622: 17,
115693: 15,
115698: 6,
115792: 12,
115856: 13,
115859: 8,
115861: 23,
115972: 9,
116036: 12,
116092: 12,
116167: 14,
116195: 16,
116209: 14,
116213: 13,
116216: 18,
116280: 11,
116294: 8,
116393: 20,
116418: 15,
116437: 7,
116457: 11,
116544: 11,
116699: 15,
116717: 16,
116733: 17,
116785: 23,
116828: 12,
116929: 27,
116965: 17,
117013: 4,
117021: 14,
117029: 17,
117094: 18,
117320: 4,
117381: 12,
117445: 16,
117581: 19,
117615: 15,
117635: 20,
117647: 1,
117702: 13,
117760: 15,
117793: 22,
117818: 16,
117829: 6,
117890: 10,
117967: 6,
117973: 13,
117998: 2,
118026: 11,
118058: 16,
118093: 15,
118139: 23,
118232: 22,
118250: 18,
118257: 8,
118270: 17,
118295: 5,
118328: 21,
118335: 3,
118375: 11,
118440: 11,
118483: 18,
118512: 11,
118517: 6,
118532: 4,
118594: 22,
118614: 11,
118705: 11,
118744: 12,
118765: 23,
118838: 4,
118851: 18,
118981: 11,
119048: 23,
119260: 18,
119281: 14,
119370: 11,
119467: 21,
119513: 14,
119620: 13,
119653: 14,
119661: 11,
119842: 19,
119881: 17,
120033: 8,
120054: 4,
120090: 11,
120151: 6,
120195: 19,
120203: 8,
120226: 7,
120246: 11,
120286: 9,
120389: 20,
120452: 4,
120627: 15,
120768: 10,
120811: 25,
120886: 5,
120969: 15,
121060: 24,
121088: 18,
121169: 11,
121213: 9,
121262: 10,
121471: 6,
121479: 7,
121497: 14,
121556: 19,
121585: 14,
121724: 20,
121734: 16,
121796: 18,
121804: 20,
121819: 22,
121873: 20,
121892: 8,
121985: 17,
122077: 3,
122448: 17,
122494: 17,
122592: 9,
122621: 12,
122626: 21,
122676: 13,
122704: 12,
122729: 25,
122753: 20,
122822: 5,
122836: 20,
122867: 13,
122901: 13,
122922: 16,
122924: 23,
122931: 12,
122979: 18,
123048: 12,
123118: 15,
123217: 30,
123222: 21,
123241: 14,
123279: 14,
123323: 4,
123336: 18,
123356: 12,
123387: 16,
123606: 15,
123654: 16,
123931: 12,
124057: 22,
124084: 5,
124095: 12,
124223: 4,
124240: 14,
124265: 13,
124373: 22,
124529: 21,
124567: 10,
124628: 11,
124675: 10,
124706: 17,
124717: 27,
124720: 17,
124841: 14,
125025: 10,
125079: 23,
125098: 15,
125109: 7,
125139: 13,
125176: 4,
125216: 22,
125222: 10,
125255: 8,
125276: 18,
125286: 15,
125339: 4,
125398: 16,
125407: 18,
125462: 11,
125475: 25,
125481: 11,
125527: 26,
125600: 2,
125631: 21,
125677: 22,
125690: 19,
125736: 7,
125740: 26,
125805: 15,
125939: 15,
125965: 21,
126010: 12,
126011: 23,
126107: 10,
126163: 4,
126205: 7,
126207: 11,
126215: 6,
126226: 4,
126231: 5,
126293: 16,
126308: 4,
126313: 23,
126323: 4,
126341: 5,
126354: 7,
126364: 8,
126385: 13,
126413: 20,
126424: 17,
126449: 13,
126514: 5,
126585: 17,
126595: 18,
126614: 6,
126627: 23,
126631: 10,
126672: 15,
126684: 17,
126712: 18,
126727: 28,
126733: 14,
126735: 9,
126743: 16,
126754: 9,
126801: 23,
126804: 7,
126843: 7,
126862: 13,
126877: 11,
126899: 9,
126909: 11,
126929: 7,
126970: 25,
126976: 3,
127028: 6,
127051: 4,
127072: 17,
127074: 15,
127121: 3,
127218: 19,
127246: 15,
127247: 9,
127265: 15,
127317: 4,
127351: 12,
127352: 9,
127370: 24,
127393: 11,
127403: 26,
127434: 5,
127453: 10,
127464: 7,
127498: 6,
127528: 15,
127575: 20,
127607: 14,
127655: 9,
127734: 20,
127844: 4,
127939: 18,
128010: 13,
128019: 14,
128094: 20,
128126: 7,
128131: 25,
128233: 17,
128277: 12,
128307: 22,
128334: 5,
128369: 16,
128376: 10,
128407: 10,
128423: 10,
128429: 11,
128452: 15,
128471: 21,
128501: 14,
128556: 16,
128559: 6,
128615: 16,
128651: 15,
128683: 13,
128701: 2,
128711: 7,
128796: 4,
128818: 19,
128833: 16,
128840: 6,
128856: 16,
128869: 7,
128873: 25,
128974: 15,
128996: 12,
129021: 23,
129071: 22,
129072: 27,
129167: 5,
129188: 3,
129245: 23,
129267: 19,
129296: 9,
129345: 17,
129346: 16,
129366: 28,
129454: 9,
129468: 9,
129482: 15,
129484: 26,
129523: 27,
129549: 11,
129553: 6,
129594: 4,
129663: 8,
129701: 28,
129705: 5,
129752: 16,
129785: 12,
129806: 11,
129816: 15,
129832: 23,
129834: 18,
129871: 15,
129878: 11,
129921: 16,
129923: 9,
129957: 6,
129986: 13,
130031: 7,
130034: 11,
130050: 13,
130053: 5,
130065: 16,
130087: 19,
130117: 17,
130124: 11,
130131: 6,
130151: 18,
130182: 11,
130188: 20,
130213: 27,
130224: 13,
130348: 29,
130372: 9,
130392: 9,
130395: 18,
130397: 26,
130421: 18,
130429: 13,
130434: 27,
130447: 17,
130461: 3,
130524: 11,
130530: 7,
130557: 13,
130621: 4,
130667: 19,
130702: 8,
130722: 17,
130794: 23,
130818: 7,
130827: 16,
130831: 29,
130864: 6,
130889: 11,
130902: 17,
130903: 8,
130929: 12,
130945: 9,
130980: 22,
130996: 4,
131016: 12,
131037: 28,
131043: 10,
131046: 11,
131050: 19,
131056: 4,
131070: 10,
131096: 7,
131143: 12,
131205: 14,
131225: 26,
131236: 10,
131257: 18,
131287: 6,
131299: 15,
131301: 24,
131323: 16,
131329: 23,
131343: 12,
131379: 12,
131380: 18,
131382: 5,
131392: 18,
131418: 19,
131422: 12,
131423: 5,
131489: 23,
131495: 6,
131528: 15,
131535: 14,
131561: 9,
131566: 16,
131587: 18,
131612: 6,
131617: 11,
131631: 8,
131661: 11,
131670: 20,
131679: 6,
131701: 17,
131715: 27,
131716: 16,
131718: 6,
131728: 12,
131769: 21,
131790: 19,
131798: 20,
131802: 29,
131808: 5,
131828: 16,
131849: 15,
131861: 12,
131890: 14,
131900: 20,
131904: 24,
131921: 13,
131926: 22,
131950: 19,
131957: 4,
131966: 16,
131981: 3,
132039: 19,
132045: 21,
132065: 19,
132111: 4,
132204: 13,
132214: 19,
132228: 17,
132239: 14,
132249: 10,
132283: 14,
132301: 8,
132304: 12,
132345: 30,
132383: 9,
132387: 4,
132400: 14,
132436: 14,
132448: 9,
132450: 7,
132463: 23,
132467: 17,
132485: 8,
132488: 16,
132499: 15,
132505: 10,
132549: 13,
132585: 11,
132615: 4,
132619: 13,
132673: 18,
132711: 3,
132726: 3,
132761: 4,
132807: 9,
132819: 17,
132829: 8,
132830: 12,
132891: 16,
132909: 16,
132959: 15,
132961: 7,
133029: 8,
133032: 24,
133052: 17,
133053: 19,
133066: 11,
133092: 8,
133101: 9,
133120: 19,
133121: 4,
133156: 12,
133170: 14,
133199: 15,
133200: 11,
133241: 7,
133267: 9,
133282: 18,
133283: 13,
133320: 19,
133328: 17,
133352: 16,
133357: 4,
133359: 14,
133365: 20,
133370: 6,
133374: 3,
133399: 15,
133409: 13,
133428: 19,
133430: 12,
133431: 6,
133435: 12,
133437: 17,
133456: 15,
133493: 13,
133500: 16,
133501: 5,
133508: 11,
133552: 8,
133594: 13,
133606: 14,
133674: 7,
133698: 7,
133702: 14,
133708: 14,
133719: 13,
133744: 10,
133769: 18,
133779: 18,
133839: 2,
133849: 19,
133863: 16,
133874: 20,
133878: 16,
133911: 5,
133937: 7,
133938: 10,
133941: 14,
133970: 12,
133988: 14,
134011: 5,
134050: 20,
134051: 10,
134072: 7,
134108: 9,
134113: 13,
134116: 7,
134148: 20,
134162: 17,
134171: 3,
134184: 4,
134228: 9,
134238: 16,
134247: 12,
134262: 16,
134263: 11,
134273: 12,
134282: 4,
134290: 24,
134293: 15,
134295: 11,
134309: 2,
134320: 20,
134326: 8,
134347: 7,
134353: 15,
134359: 10,
134361: 9,
134370: 12,
134374: 30,
134384: 13,
134410: 13,
134456: 8,
134465: 18,
134499: 23,
134500: 15,
134507: 5,
134509: 15,
134531: 6,
134552: 3,
134593: 23,
134608: 16,
134624: 18,
134628: 12,
134629: 17,
134636: 20,
134658: 5,
134669: 12,
134672: 16,
134679: 13,
134686: 12,
134691: 12,
134746: 11,
134789: 8,
134820: 8,
134911: 13,
134935: 10,
134942: 10,
134951: 26,
134976: 7,
134993: 19,
135006: 14,
135013: 19,
135014: 13,
135028: 8,
135042: 6,
135045: 18,
135052: 17,
135061: 16,
135071: 5,
135075: 20,
135109: 13,
135115: 19,
135116: 7,
135117: 10,
135126: 16,
135135: 12,
135141: 26,
135193: 25,
135224: 18,
135267: 10,
}
var Compensation20260511_Mail_Item = map[int][]*item.Item{}
type Compensation20260511_RankList struct {
Id int `json:"Id"`
Min int `json:"Min"`
Max int `json:"Max"`
Items []*item.Item `json:"Items"`
}
var Compensation20260511_cfg = []Compensation20260511_RankList{
{
Id: 1,
Min: 1,
Max: 1,
Items: []*item.Item{{Id: 100001, Num: 750}, {Id: 101487, Num: 25}, {Id: 100007, Num: 1}},
},
{
Id: 2,
Min: 2,
Max: 2,
Items: []*item.Item{{Id: 100001, Num: 375}, {Id: 101487, Num: 12}, {Id: 100007, Num: 1}},
},
{
Id: 3,
Min: 3,
Max: 3,
Items: []*item.Item{{Id: 100001, Num: 250}, {Id: 101487, Num: 10}, {Id: 100007, Num: 1}},
},
{
Id: 4,
Min: 4,
Max: 4,
Items: []*item.Item{{Id: 100001, Num: 125}, {Id: 101487, Num: 8}, {Id: 100006, Num: 1}},
},
{
Id: 5,
Min: 5,
Max: 5,
Items: []*item.Item{{Id: 100001, Num: 100}, {Id: 101487, Num: 6}, {Id: 100006, Num: 1}},
},
{
Id: 6,
Min: 6,
Max: 6,
Items: []*item.Item{{Id: 100001, Num: 75}, {Id: 101487, Num: 5}, {Id: 100006, Num: 1}},
},
{
Id: 7,
Min: 7,
Max: 7,
Items: []*item.Item{{Id: 100001, Num: 70}, {Id: 101487, Num: 4}, {Id: 100006, Num: 1}},
},
{
Id: 8,
Min: 8,
Max: 8,
Items: []*item.Item{{Id: 100001, Num: 65}, {Id: 101487, Num: 3}, {Id: 100006, Num: 1}},
},
{
Id: 9,
Min: 9,
Max: 9,
Items: []*item.Item{{Id: 100001, Num: 60}, {Id: 101487, Num: 2}, {Id: 100006, Num: 1}},
},
{
Id: 10,
Min: 10,
Max: 10,
Items: []*item.Item{{Id: 100001, Num: 55}, {Id: 101487, Num: 1}, {Id: 100006, Num: 1}},
},
{
Id: 11,
Min: 11,
Max: 15,
Items: []*item.Item{{Id: 100001, Num: 20}, {Id: 100002, Num: 90}},
},
{
Id: 12,
Min: 16,
Max: 50,
Items: []*item.Item{{Id: 100002, Num: 90}},
},
}

View File

@ -9,6 +9,7 @@ import (
"server/game/mod/charge"
"server/game/mod/chess"
"server/game/mod/collect"
"server/game/mod/compensation"
dailyTask "server/game/mod/daily_task"
"server/game/mod/decorate"
"server/game/mod/endless"
@ -120,3 +121,7 @@ func (p *Player) GetInviteMod() *invite.InviteMod {
func (p *Player) GetCatReturnGiftMod() *catreturngift.CatReturnGiftMod {
return &p.PlayMod.mod_list.CatReturnGift
}
func (p *Player) GetCompensationMod() *compensation.Compensation {
return p.PlayMod.getCompensationMod()
}

View File

@ -121,6 +121,10 @@ func (p *Player) Stop() {
}
func (p *Player) CallEvent(Duration time.Duration, F func(), Label string) {
if Duration <= 0 {
log.Error("CallEvent error, duration must be greater than 0, player id %d, type : %s, duration: %d", p.M_DwUin, Label, int(Duration.Seconds()))
return
}
log.Debug("add ticker event player id %d; type : %s, duration: %d, endtime: %s", p.M_DwUin, Label, int(Duration.Seconds()), GoUtil.FormatTime(GoUtil.Now()+int64(Duration.Seconds())))
if v, ok := p.timerList[Label]; ok {
v.Stop()

View File

@ -0,0 +1,32 @@
package unit
import (
"server/game/mod/compensation"
"testing"
)
func TestCompensation20260511(t *testing.T) {
// 创建一个玩家实例
player := getTestPlayer(t)
player.M_DwUin = 100031 // 设置玩家的唯一标识符,确保在补偿列表中有对应的记录
// 调用补偿函数
player.Compensation20260511()
// 验证玩家是否正确领取了补偿
compensationMod := player.GetCompensationMod()
if !compensationMod.Is20260511() {
t.Errorf("玩家未正确领取补偿")
}
// 验证邮件是否发送成功
mailMod := player.GetMailMod()
mails := mailMod.List // 假设有一个方法可以获取玩家的邮件列表
found := false
for _, m := range mails {
if m.Title == compensation.Compensation20260511_Mail_Config.Title {
found = true
break
}
}
if !found {
t.Errorf("补偿邮件未发送成功")
}
}