diff --git a/src/server/conf/mail/mailCfg.go b/src/server/conf/mail/mailCfg.go index 181d4813..c2e3294a 100644 --- a/src/server/conf/mail/mailCfg.go +++ b/src/server/conf/mail/mailCfg.go @@ -22,8 +22,10 @@ const ( type TriggerMail struct { Id int Title string + SubTitle string Content string EnglistTitle string + SubTitleEn string EnglistContent string Items []*item.Item Trigger []string diff --git a/src/server/game/GameLogic.go b/src/server/game/GameLogic.go index 09ff2c32..1262468c 100644 --- a/src/server/game/GameLogic.go +++ b/src/server/game/GameLogic.go @@ -15,8 +15,8 @@ import ( l "log" "server/db" "server/game/internal" - MsgMod "server/game/mod/msg" // Ensure this package exists and is correctly referenced - MsqMod "server/game/mod/msg" + + MsgMod "server/game/mod/msg" "server/msg" "time" @@ -269,7 +269,7 @@ func (ad *GameLogic) SetUserData(Uid int, Op int, Data interface{}) { ad.FriendMgr.Send(&MsgMod.Msg{ From: Uid, To: Uid, - Type: MsqMod.HANDLE_TYPE_VAR_USER_SET, + Type: MsgMod.HANDLE_TYPE_VAR_USER_SET, SendT: GoUtil.Now(), Extra: VarOpration{Type: Op, Data: Data}, }) diff --git a/src/server/game/Gm.go b/src/server/game/Gm.go index 4011f53e..b90bd3ea 100644 --- a/src/server/game/Gm.go +++ b/src/server/game/Gm.go @@ -90,6 +90,7 @@ func ReqGmCommand_(player *Player, Command string) error { VarMod := player.PlayMod.getVarMod() VarMod.DailyResetTime = 0 player.ZeroUpdate(nil) + player.LoginBackData() case "addChampshipLog": num, _ := strconv.Atoi(arg[1]) player.AddLog(num, friend.LOG_TYPE_PLAYROOM_CHAMPSHIP, fmt.Sprintf("%d_%d", 1, 1)) @@ -388,6 +389,25 @@ func ReqGmCommand_(player *Player, Command string) error { EndTime: EndTime, Num: int32(Times), }) + case "sendMail": + MailMod := player.PlayMod.getMailMod() + title := `MMM圣诞节奖励` + content := `测试` + MailMod.Send(title, "副标题", content, title, "副标题", content, []*item.Item{ + { + Id: item.ITEM_DIAMOND_ID, + Num: 10, + }, + { + Id: item.ITEM_ENERGY_ID, + Num: 10, + }, + { + Id: item.ITEM_STAR_ID, + Num: 10, + }, + }, 2) + player.PushClientRes(MailMod.BackData()) case "recoverUser": file, err := os.OpenFile(conf.Server.GameConfPath+"user.info", os.O_RDWR|os.O_CREATE, 0666) if err != nil { diff --git a/src/server/game/PlayerFunc.go b/src/server/game/PlayerFunc.go index 17f7c3f5..b7657fcc 100644 --- a/src/server/game/PlayerFunc.go +++ b/src/server/game/PlayerFunc.go @@ -245,7 +245,7 @@ func handle(p *Player, m *msg.Msg) error { MailMod := p.PlayMod.getMailMod() mt, mc, mt_en, mc_en := mailCfg.GetChargeSendMail(PlayerSimpleData.Name) Items := ChargeItem(p, C.ChargeId) - MailId := MailMod.Send(mt, mc, mt_en, mc_en, Items, mail.MAIL_TYPE_GIFT) + MailId := MailMod.Send(mt, "", mc, mt_en, "", mc_en, Items, mail.MAIL_TYPE_GIFT) p.AddLog(m.From, friend.LOG_TYPE_CHARGE_SEND, fmt.Sprintf("%d", MailId)) p.PushClientRes(MailMod.NotifyMail(MailId)) case msg.HANDLE_TYPE_CHARGE_RECEIVE: // 收到好友的感谢信 @@ -256,7 +256,7 @@ func handle(p *Player, m *msg.Msg) error { PlayerSimpleData := G_GameLogicPtr.GetResSimplePlayerByUid(m.From) MailMod := p.PlayMod.getMailMod() mt, mc, mt_en, mc_en := mailCfg.GetChargeReceiveMail(PlayerSimpleData.Name, Content) - MailId := MailMod.Send(mt, mc, mt_en, mc_en, nil, mail.MAIL_TYPE_NORMAL) + MailId := MailMod.Send(mt, "", mc, mt_en, "", mc_en, nil, mail.MAIL_TYPE_NORMAL) p.AddLog(m.From, friend.LOG_TYPE_CHARGE_RECEIVE, fmt.Sprintf("%d", MailId)) p.PushClientRes(MailMod.NotifyMail(MailId)) case msg.HANDLE_TYPE_WISHLIST_SEND: // 发送愿望单请求 @@ -385,7 +385,7 @@ func SyncMailMsg(p *Player) { continue } MailMod.ServerMail = append(MailMod.ServerMail, v.Id) - MailMod.Send(v.Title, v.Content, v.TitleEn, v.ContentEn, v.Items, v.Mail_type) + MailMod.Send(v.Title, "", v.Content, v.TitleEn, "", v.ContentEn, v.Items, v.Mail_type) } p.PushClientRes(MailMod.BackData()) } @@ -846,30 +846,7 @@ func EmitRetireTrigger2(p *Player) { } func LoignBack(p *Player) { - BaseMod := p.PlayMod.getBaseMod() - if BaseMod.LoginBack { - return - } - PlayBaseMod := p.GetPlayerBaseMod() - Num1, Num2 := mailCfg.GetLoginBack(PlayBaseMod.Data.UserName) - Items := make([]*item.Item, 0) - if Num1 != 0 { - Items = append(Items, &item.Item{Id: item.ITEM_DIAMOND_ID, Num: Num1}) - } - if Num2 != 0 { - Items = append(Items, &item.Item{Id: item.ITEM_DIAMOND_ID, Num: Num2}) - } - if len(Items) != 0 { - MailMod := p.PlayMod.getMailMod() - MailMod.Send("Test Players' Refund", - `Welcome back to our game! - Here comes your refund for your scene progress and payment in test version! - Have fun in new version!`, "Test Players' Refund", - `Welcome back to our game! - Here comes your refund for your scene progress and payment in test version! - Have fun in new version!`, Items, mail.MAIL_TYPE_NORMAL) - } - BaseMod.LoginBack = true + } func Benchmark(player *Player) { diff --git a/src/server/game/Trigger.go b/src/server/game/Trigger.go index ecdec575..24d4682f 100644 --- a/src/server/game/Trigger.go +++ b/src/server/game/Trigger.go @@ -51,7 +51,7 @@ func (player *Player) MailTrigger(Tr *quest.Trigger) bool { Content := languageCfg.GetLanguage(BaseMod.Lang, v.Content) TitleEn := languageCfg.GetLanguage(msg.LANG_TYPE_LANG_EN, v.Title) ContentEn := languageCfg.GetLanguage(msg.LANG_TYPE_LANG_EN, v.Content) - MailMod.Send(Title, Content, TitleEn, ContentEn, v.Items, mail.MAIL_TYPE_NORMAL) + MailMod.Send(Title, "", Content, TitleEn, "", ContentEn, v.Items, mail.MAIL_TYPE_NORMAL) MailMod.AddTriggerMail(v.Id) tr = true } diff --git a/src/server/game/mod/limitedTimeEvent/LimitedTimeEvent.go b/src/server/game/mod/limitedTimeEvent/LimitedTimeEvent.go index c164d1e4..5b38d74f 100644 --- a/src/server/game/mod/limitedTimeEvent/LimitedTimeEvent.go +++ b/src/server/game/mod/limitedTimeEvent/LimitedTimeEvent.go @@ -185,23 +185,14 @@ func (l *LimitedTimeEventMod) GetMoneyCatReward(ChessList []int) []*item.Item { Star := mergeDataCfg.GetMergeStar(ChessList) d := L.D.(*MoneyCat) mul := d.Mul - // 超时 - if d.EndTime > 0 && GoUtil.Now() >= d.EndTime { - NextMul1, _ := limitedTimeEventCfg.GetMoneyCat(1) - NextMul2, Cd := limitedTimeEventCfg.GetMoneyCat(2) - d.EndTime = int64(Cd) + GoUtil.Now() - d.Mul = NextMul2 - d.Id = 2 - Star = int(math.Ceil(float64(Star) * (NextMul1 - 1))) - } else { - MaxId := limitedTimeEventCfg.GetMoneyCatMax() - NextId := min(d.Id+1, MaxId) - NextMul, Cd := limitedTimeEventCfg.GetMoneyCat(NextId) - d.Id = NextId - d.Mul = NextMul - d.EndTime = GoUtil.Now() + int64(Cd) - Star = int(math.Ceil(float64(Star) * (mul - 1))) - } + + MaxId := limitedTimeEventCfg.GetMoneyCatMax() + NextId := min(d.Id+1, MaxId) + NextMul, Cd := limitedTimeEventCfg.GetMoneyCat(NextId) + d.Id = NextId + d.Mul = NextMul + d.EndTime = GoUtil.Now() + int64(Cd) + Star = int(math.Ceil(float64(Star) * (mul - 1))) return []*item.Item{{Id: item.ITEM_STAR_ID, Num: Star}} } diff --git a/src/server/game/mod/mail/Mail.go b/src/server/game/mod/mail/Mail.go index 9bb90471..2e1a07f5 100644 --- a/src/server/game/mod/mail/Mail.go +++ b/src/server/game/mod/mail/Mail.go @@ -26,15 +26,17 @@ const ( ) type MailInfo struct { - Title string // 邮件标题 - Content string // 邮件内容 - TitleEn string // 邮件标题英文 - ContentEn string // 邮件内容英文 - Items []*item.Item // 邮件道具 - Type int //邮件类型 - Send int64 // 发送时间 - Del int64 // 删除时间 - Status int + Title string // 邮件标题 + SubTitle string // 邮件副标题 + Content string // 邮件内容 + TitleEn string // 邮件标题英文 + SubTitleEn string // 邮件副标题英文 + ContentEn string // 邮件内容英文 + Items []*item.Item // 邮件道具 + Type int //邮件类型 + Send int64 // 发送时间 + Del int64 // 删除时间 + Status int } func (m *MailMod) InitData() { @@ -44,16 +46,18 @@ func (m *MailMod) InitData() { } // 发送邮件 -func (m *MailMod) Send(Title, Content, TitleEn, ContentEn string, Items []*item.Item, t int) int { +func (m *MailMod) Send(Title, SubTitle, Content, TitleEn, SubTitleEn, ContentEn string, Items []*item.Item, t int) int { m.AutoId++ m.List[m.AutoId] = &MailInfo{ - Title: Title, - Content: Content, - TitleEn: TitleEn, - ContentEn: ContentEn, - Items: Items, - Send: GoUtil.Now(), - Type: t, + Title: Title, + SubTitle: SubTitle, + Content: Content, + TitleEn: TitleEn, + SubTitleEn: SubTitleEn, + ContentEn: ContentEn, + Items: Items, + Send: GoUtil.Now(), + Type: t, } return m.AutoId } @@ -106,15 +110,17 @@ func (m *MailMod) BackData() *msg.ResMailList { continue } res.MailList[int32(k)] = &msg.MailInfo{ - Id: int32(k), - Title: v.Title, - Content: v.Content, - TitleEn: v.TitleEn, - ContentEn: v.ContentEn, - Items: item.ItemToMsg(v.Items), - Status: int32(v.Status), - Time: int32(v.Send), - Type: int32(v.Type), + Id: int32(k), + Title: v.Title, + SubTitle: v.SubTitle, + Content: v.Content, + TitleEn: v.TitleEn, + SubTitleEn: v.SubTitleEn, + ContentEn: v.ContentEn, + Items: item.ItemToMsg(v.Items), + Status: int32(v.Status), + Time: int32(v.Send), + Type: int32(v.Type), } } return res diff --git a/src/server/msg/Gameapi.pb.go b/src/server/msg/Gameapi.pb.go index 88eff7a6..6336d976 100644 --- a/src/server/msg/Gameapi.pb.go +++ b/src/server/msg/Gameapi.pb.go @@ -13815,15 +13815,17 @@ func (x *ResMailList) GetMailList() map[int32]*MailInfo { type MailInfo struct { state protoimpl.MessageState `protogen:"open.v1"` - Id int32 `protobuf:"varint,1,opt,name=Id,proto3" json:"Id,omitempty"` // 邮件id - Title string `protobuf:"bytes,2,opt,name=Title,proto3" json:"Title,omitempty"` // 标题 - Content string `protobuf:"bytes,3,opt,name=Content,proto3" json:"Content,omitempty"` // 内容 - Time int32 `protobuf:"varint,4,opt,name=Time,proto3" json:"Time,omitempty"` // 时间 - Status int32 `protobuf:"varint,5,opt,name=Status,proto3" json:"Status,omitempty"` // 0 未读 1 已读 2 已领取 3 已删除 - Items []*ItemInfo `protobuf:"bytes,6,rep,name=Items,proto3" json:"Items,omitempty"` // 奖励 - Type int32 `protobuf:"varint,7,opt,name=Type,proto3" json:"Type,omitempty"` //邮件类型 1普通邮件 2节日邮件 3 礼包邮件 - TitleEn string `protobuf:"bytes,8,opt,name=TitleEn,proto3" json:"TitleEn,omitempty"` // 英文标题 - ContentEn string `protobuf:"bytes,9,opt,name=ContentEn,proto3" json:"ContentEn,omitempty"` // 英文内容 + Id int32 `protobuf:"varint,1,opt,name=Id,proto3" json:"Id,omitempty"` // 邮件id + Title string `protobuf:"bytes,2,opt,name=Title,proto3" json:"Title,omitempty"` // 标题 + Content string `protobuf:"bytes,3,opt,name=Content,proto3" json:"Content,omitempty"` // 内容 + Time int32 `protobuf:"varint,4,opt,name=Time,proto3" json:"Time,omitempty"` // 时间 + Status int32 `protobuf:"varint,5,opt,name=Status,proto3" json:"Status,omitempty"` // 0 未读 1 已读 2 已领取 3 已删除 + Items []*ItemInfo `protobuf:"bytes,6,rep,name=Items,proto3" json:"Items,omitempty"` // 奖励 + Type int32 `protobuf:"varint,7,opt,name=Type,proto3" json:"Type,omitempty"` //邮件类型 1普通邮件 2节日邮件 3 礼包邮件 + TitleEn string `protobuf:"bytes,8,opt,name=TitleEn,proto3" json:"TitleEn,omitempty"` // 英文标题 + ContentEn string `protobuf:"bytes,9,opt,name=ContentEn,proto3" json:"ContentEn,omitempty"` // 英文内容 + SubTitle string `protobuf:"bytes,10,opt,name=SubTitle,proto3" json:"SubTitle,omitempty"` // 子标题 + SubTitleEn string `protobuf:"bytes,11,opt,name=SubTitleEn,proto3" json:"SubTitleEn,omitempty"` // 英文子标题 unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -13921,6 +13923,20 @@ func (x *MailInfo) GetContentEn() string { return "" } +func (x *MailInfo) GetSubTitle() string { + if x != nil { + return x.SubTitle + } + return "" +} + +func (x *MailInfo) GetSubTitleEn() string { + if x != nil { + return x.SubTitleEn + } + return "" +} + type MailNotify struct { state protoimpl.MessageState `protogen:"open.v1"` Info *MailInfo `protobuf:"bytes,1,opt,name=Info,proto3" json:"Info,omitempty"` @@ -23619,7 +23635,7 @@ const file_proto_Gameapi_proto_rawDesc = "" + "\bMailList\x18\x01 \x03(\v2#.tutorial.ResMailList.MailListEntryR\bMailList\x1aO\n" + "\rMailListEntry\x12\x10\n" + "\x03key\x18\x01 \x01(\x05R\x03key\x12(\n" + - "\x05value\x18\x02 \x01(\v2\x12.tutorial.MailInfoR\x05value:\x028\x01\"\xec\x01\n" + + "\x05value\x18\x02 \x01(\v2\x12.tutorial.MailInfoR\x05value:\x028\x01\"\xa8\x02\n" + "\bMailInfo\x12\x0e\n" + "\x02Id\x18\x01 \x01(\x05R\x02Id\x12\x14\n" + "\x05Title\x18\x02 \x01(\tR\x05Title\x12\x18\n" + @@ -23629,7 +23645,12 @@ const file_proto_Gameapi_proto_rawDesc = "" + "\x05Items\x18\x06 \x03(\v2\x12.tutorial.ItemInfoR\x05Items\x12\x12\n" + "\x04Type\x18\a \x01(\x05R\x04Type\x12\x18\n" + "\aTitleEn\x18\b \x01(\tR\aTitleEn\x12\x1c\n" + - "\tContentEn\x18\t \x01(\tR\tContentEn\"4\n" + + "\tContentEn\x18\t \x01(\tR\tContentEn\x12\x1a\n" + + "\bSubTitle\x18\n" + + " \x01(\tR\bSubTitle\x12\x1e\n" + + "\n" + + "SubTitleEn\x18\v \x01(\tR\n" + + "SubTitleEn\"4\n" + "\n" + "MailNotify\x12&\n" + "\x04Info\x18\x01 \x01(\v2\x12.tutorial.MailInfoR\x04Info\"\x1d\n" +