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