1
This commit is contained in:
parent
32d66d96fd
commit
57d2ab0f69
@ -1,11 +1,9 @@
|
||||
package activityCfg
|
||||
|
||||
import (
|
||||
languageCfg "server/conf/language"
|
||||
"server/game/mod/item"
|
||||
GoUtil "server/game_util"
|
||||
"server/gamedata"
|
||||
"server/msg"
|
||||
"server/pkg/github.com/name5566/leaf/log"
|
||||
"strconv"
|
||||
)
|
||||
@ -136,16 +134,6 @@ func GetActivityRewardItems(ActId int) []*item.Item {
|
||||
return nil
|
||||
}
|
||||
|
||||
func GetActivityTitle(ActId int) (string, string) {
|
||||
data, err := gamedata.GetDataByIntKey(CFG_ACTIVITY, ActId)
|
||||
if err != nil {
|
||||
log.Debug("GetActivityTitle err:%v", err)
|
||||
return "", ""
|
||||
}
|
||||
title := gamedata.GetStringValue(data, "Title")
|
||||
return languageCfg.GetLanguage(msg.LANG_TYPE_LANG_CN, title), languageCfg.GetLanguage(msg.LANG_TYPE_LANG_EN, title)
|
||||
}
|
||||
|
||||
func GetActivityRecycleMail(ActId int) (string, string, string) {
|
||||
data, err := gamedata.GetDataByIntKey(CFG_ACTIVITY, ActId)
|
||||
if err != nil {
|
||||
|
||||
@ -460,7 +460,7 @@ func (p *Player) CatnipBackData() {
|
||||
func (p *Player) GetChampshipActivityId() (int, int) {
|
||||
var todayActivityId int
|
||||
var yesterdayActivityId int
|
||||
activiyCfgList := activityCfg.GetActivityListOrigin()
|
||||
activiyCfgList := G_GameLogicPtr.ActivityMgr.GetActivityList()
|
||||
Now := GoUtil.Now()
|
||||
YesterDay := GoUtil.ZeroTimestamp() - 1
|
||||
level := p.GetBaseMod().GetLevel()
|
||||
@ -472,10 +472,10 @@ func (p *Player) GetChampshipActivityId() (int, int) {
|
||||
if v.Level > level {
|
||||
continue
|
||||
}
|
||||
if v.StartTime <= Now && v.EndTime >= Now {
|
||||
if v.Startime <= Now && v.Endtime >= Now {
|
||||
todayActivityId = v.Id
|
||||
}
|
||||
if v.StartTime <= YesterDay && v.EndTime >= YesterDay {
|
||||
if v.Startime <= YesterDay && v.Endtime >= YesterDay {
|
||||
yesterdayActivityId = v.Id
|
||||
}
|
||||
}
|
||||
@ -484,7 +484,7 @@ func (p *Player) GetChampshipActivityId() (int, int) {
|
||||
|
||||
func (p *Player) GetDailyTaskActivityId() int {
|
||||
var activityId int
|
||||
activiyCfgList := activityCfg.GetActivityListOrigin()
|
||||
activiyCfgList := G_GameLogicPtr.ActivityMgr.GetActivityList()
|
||||
Now := GoUtil.Now()
|
||||
level := p.GetBaseMod().GetLevel()
|
||||
activityIds := dailyTaskCfg.GetActivityIds()
|
||||
@ -495,7 +495,7 @@ func (p *Player) GetDailyTaskActivityId() int {
|
||||
if v.Level > level {
|
||||
continue
|
||||
}
|
||||
if v.StartTime <= Now && v.EndTime >= Now {
|
||||
if v.Startime <= Now && v.Endtime >= Now {
|
||||
activityId = v.Id
|
||||
break
|
||||
}
|
||||
|
||||
@ -23,7 +23,7 @@ type ActivityData struct {
|
||||
type ActivityCfg struct {
|
||||
Id int
|
||||
Type int
|
||||
Strartime int64
|
||||
Startime int64
|
||||
Endtime int64
|
||||
Level int
|
||||
Title string
|
||||
@ -35,7 +35,7 @@ type ActivityCfg struct {
|
||||
|
||||
func (ac *ActivityCfg) String() string {
|
||||
return fmt.Sprintf("Id: %d, Type: %d, StartTime: %d, EndTime: %d, Level: %d, Title: %s, MailTitle: %s, MailContent: %s, cfg: %v, Extra: %v",
|
||||
ac.Id, ac.Type, ac.Strartime, ac.Endtime, ac.Level, ac.Title, ac.MailTitle, ac.MailContent, ac.cfg, ac.Extra)
|
||||
ac.Id, ac.Type, ac.Startime, ac.Endtime, ac.Level, ac.Title, ac.MailTitle, ac.MailContent, ac.cfg, ac.Extra)
|
||||
}
|
||||
|
||||
const ()
|
||||
@ -103,7 +103,7 @@ func (r *ActivityMgr) Reload() error {
|
||||
cfg := &ActivityCfg{
|
||||
Id: v.Id,
|
||||
Type: v.Type,
|
||||
Strartime: v.Start_time,
|
||||
Startime: v.Start_time,
|
||||
Endtime: v.End_time,
|
||||
Level: v.Level,
|
||||
Title: v.Title,
|
||||
@ -118,6 +118,9 @@ func (r *ActivityMgr) Reload() error {
|
||||
}
|
||||
|
||||
func unmarshalActivityCfg(atype int, buf []byte) (interface{}, error) {
|
||||
if len(buf) == 0 {
|
||||
return nil, nil
|
||||
}
|
||||
switch atype {
|
||||
case 1:
|
||||
cfg := &protoMsg.MiningCfg{}
|
||||
@ -128,5 +131,4 @@ func unmarshalActivityCfg(atype int, buf []byte) (interface{}, error) {
|
||||
return cfg, nil
|
||||
}
|
||||
return nil, fmt.Errorf("unknown activity type: %d", atype)
|
||||
|
||||
}
|
||||
|
||||
@ -1202,7 +1202,7 @@ func (p *Player) InitActivity() {
|
||||
continue
|
||||
}
|
||||
Status := 1
|
||||
startduration = v.Strartime - now
|
||||
startduration = v.Startime - now
|
||||
endduration = v.Endtime - now + 1
|
||||
if startduration > 0 && (minduration == 0 || minduration > startduration) {
|
||||
minduration = startduration
|
||||
@ -1210,11 +1210,11 @@ func (p *Player) InitActivity() {
|
||||
if endduration > 0 && (minduration == 0 || minduration > endduration) {
|
||||
minduration = endduration
|
||||
}
|
||||
if v.Strartime > now || v.Endtime < now {
|
||||
if v.Startime > now || v.Endtime < now {
|
||||
continue
|
||||
}
|
||||
p.activity[v.Id] = &ActivityInfo{
|
||||
StartT: v.Strartime,
|
||||
StartT: v.Startime,
|
||||
EndT: v.Endtime,
|
||||
Id: v.Id,
|
||||
Type: v.Type,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user