成就任务

This commit is contained in:
sk 2024-04-26 10:47:59 +08:00
parent b6aa7bec3c
commit a6e65f236f
10 changed files with 32 additions and 514 deletions

View File

@ -719,6 +719,7 @@ const (
TaskActivityTypeWeek = 2 // 每周任务
TaskActivityTypeNovice = 3 // 新手任务
TaskActivityTypeInvite = 4 // 邀请任务
TaskActivityTypeAchieve = 5 // 成就任务
)
const HeadRange = 3 // 机器人头像id范围

2
public

@ -1 +1 @@
Subproject commit e593140357deb0370e57e09fff1820fa419d4d88
Subproject commit b3c791a33ee4a8739fca055f43d24009b6c1ef34

View File

@ -444,14 +444,14 @@ func (this *CSPlatFormHandler) Process(s *netlib.Session, packetid int, data int
ExchangeAlipayMax: proto.Int32(platform.ExchangeAlipayMax),
ExchangeMultiple: proto.Int32(platform.ExchangeMultiple),
}
rebateTask := RebateInfoMgrSington.rebateTask[p.Platform]
if rebateTask != nil {
scPlatForm.Rebate = &login_proto.RebateCfg{
RebateSwitch: proto.Bool(rebateTask.RebateSwitch),
ReceiveMode: proto.Int32(int32(rebateTask.ReceiveMode)),
NotGiveOverdue: proto.Int32(int32(rebateTask.NotGiveOverdue)),
}
}
//rebateTask := RebateInfoMgrSington.rebateTask[p.Platform]
//if rebateTask != nil {
// scPlatForm.Rebate = &login_proto.RebateCfg{
// RebateSwitch: proto.Bool(rebateTask.RebateSwitch),
// ReceiveMode: proto.Int32(int32(rebateTask.ReceiveMode)),
// NotGiveOverdue: proto.Int32(int32(rebateTask.NotGiveOverdue)),
// }
//}
if platform.ClubConfig != nil { //俱乐部配置
scPlatForm.Club = &login_proto.ClubCfg{
IsOpenClub: proto.Bool(platform.ClubConfig.IsOpenClub),

View File

@ -553,6 +553,7 @@ func init() {
}
return nil
}))
netlib.RegisterFactory(int(server_proto.SSPacketID_PACKET_GW_JACKPOTCOIN), netlib.PacketFactoryWrapper(func() interface{} {
return &server_proto.GWGameJackCoin{}
}))

View File

@ -61,7 +61,7 @@ func IsTaskReward(p *Player, id int32) bool {
return true
}
case common.TaskActivityTypeNovice, common.TaskActivityTypeInvite:
case common.TaskActivityTypeNovice, common.TaskActivityTypeInvite, common.TaskActivityTypeAchieve:
if data.Ts > 0 {
return true
}
@ -175,11 +175,9 @@ func CSTaskDebugInc(s *netlib.Session, packetId int, data interface{}, sid int64
id := msg.GetId()
taskType := int32(-1)
for _, v := range srvdata.PBDB_TaskMgr.Datas.GetArr() {
if v.Id == id {
taskType = v.TaskType
break
}
d := srvdata.PBDB_TaskMgr.GetData(id)
if d != nil {
taskType = d.TaskType
}
p.ResetTaskN(taskType)

View File

@ -184,54 +184,6 @@ func (this *EtcdMgr) InitBlackList() {
this.InitAndWatch(initFunc, watchFunc)
}
// 初始化返利数据
func (this *EtcdMgr) InitRebateConfig() {
initFunc := func() int64 {
if model.GameParamData.UseEtcd {
logger.Logger.Info("ETCD 初始化返利数据 拉取数据:", etcd.ETCDKEY_CONFIG_REBATE)
res, err := this.GetValueWithPrefix(etcd.ETCDKEY_CONFIG_REBATE)
if err == nil {
for i := int64(0); i < res.Count; i++ {
var RebateTasks *RebateTask
err = json.Unmarshal(res.Kvs[i].Value, &RebateTasks)
if err == nil {
RebateInfoMgrSington.rebateTask[RebateTasks.Platform] = RebateTasks
} else {
logger.Logger.Errorf("etcd desc WithPrefix(%v) panic:%v", etcd.ETCDKEY_CONFIG_REBATE, err)
}
}
if res.Header != nil {
return res.Header.Revision
}
} else {
logger.Logger.Errorf("etcd get WithPrefix(%v) panic:%v", etcd.ETCDKEY_CONFIG_REBATE, err)
}
}
return -1
}
// 监控数据变动
watchFunc := func(ctx context.Context, revision int64) {
this.GoWatch(ctx, revision, etcd.ETCDKEY_CONFIG_REBATE, func(res clientv3.WatchResponse) error {
for _, ev := range res.Events {
switch ev.Type {
case clientv3.EventTypeDelete:
case clientv3.EventTypePut:
var RebateTasks *RebateTask
err := json.Unmarshal(ev.Kv.Value, &RebateTasks)
if err == nil {
RebateInfoMgrSington.rebateTask[RebateTasks.Platform] = RebateTasks
} else {
logger.Logger.Errorf("etcd desc WithPrefix(%v) panic:%v", etcd.ETCDKEY_CONFIG_REBATE, err)
}
}
}
return nil
})
}
this.InitAndWatch(initFunc, watchFunc)
}
// 初始化代理数据
func (this *EtcdMgr) InitPromoterConfig() {
initFunc := func() int64 {

View File

@ -2246,10 +2246,8 @@ func (this *Player) OnDayTimer(login, continuous bool, t int) {
// 重置每日任务
if this.WelfData != nil {
if this.WelfData.Task != nil {
for _, v := range srvdata.PBDB_TaskMgr.Datas.GetArr() {
if v.GetActivityType() == common.TaskActivityTypeEveryDay {
this.WelfData.Task[v.GetId()] = &model.TaskData{}
}
for _, v := range srvdata.TaskMgr.Get(common.TaskActivityTypeEveryDay) {
this.WelfData.Task[v.GetId()] = &model.TaskData{}
}
this.WelfData.Task[common.TaskIDInvitePlayGame] = &model.TaskData{}
this.WelfData.Task[common.TaskIDInviteFirstLogin] = &model.TaskData{}
@ -2315,10 +2313,8 @@ func (this *Player) OnWeekTimer() {
// 重置周任务
if this.WelfData != nil {
if this.WelfData.Task != nil {
for _, v := range srvdata.PBDB_TaskMgr.Datas.GetArr() {
if v.GetActivityType() == common.TaskActivityTypeWeek {
this.WelfData.Task[v.GetId()] = &model.TaskData{}
}
for _, v := range srvdata.TaskMgr.Get(common.TaskActivityTypeWeek) {
this.WelfData.Task[v.GetId()] = &model.TaskData{}
}
}
}
@ -3541,151 +3537,6 @@ func (this *Player) RedirectByGame(packetid int, rawpack interface{}) bool {
return false
}
// func (this *Player) GetMatchAr(matchId int32) *model.MatchAchievement {
// if this.MatchAchievement == nil {
// this.MatchAchievement = make(map[int32]*model.MatchAchievement)
// }
// if ar, exist := this.MatchAchievement[matchId]; exist {
// return ar
// }
// ar := &model.MatchAchievement{MatchId: matchId, CreateTs: int32(time.Now().Unix())}
// this.MatchAchievement[matchId] = ar
// return ar
// }
//func (this *Player) InitLayered() {
// logger.Logger.Trace("(this *Player) InitLayered")
// if this.IsRob {
// return
// }
// this.layered = make(map[int]bool)
// task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
// return LogicLevelMgrSington.SendPostBySnIds(this.Platform, []int32{this.SnId})
// }), task.CompleteNotifyWrapper(func(data interface{}, t task.Task) {
// if data != nil {
// newData := data.([]NewMsg)
// for _, d := range newData {
// cnf := LogicLevelMgrSington.GetConfig(d.Platform)
// if cnf == nil {
// continue
// }
// this.layerlevels = d.Levels
// for _, v := range d.Levels {
// if td, ok := cnf.LogicLevelInfo[int32(v)]; ok {
// if td.StartAct == 1 {
// for _, id := range td.CheckActIds {
// this.layered[int(id)] = true
// }
// }
// }
// }
// }
// }
// //this.ActStateSend2Client()
// }), "SendPostBySnIds").Start()
// ////
// for k, v := range this.layered {
// logger.Logger.Tracef("InitLayered....id=%v %v", k, v)
// }
//
//}
func (this *Player) ActStateSend2Client() {
logger.Logger.Trace("(this *Player) ActStateSend2Client")
actSwitchCfg := make([]int32, common.ActId_Max)
for i := 0; i < common.ActId_Max; i++ {
isOpen := true
switch i {
//case common.ActId_OnlineReward:
// cfg, ok := ActOnlineRewardMgrSington.Configs[this.Platform]
// if !ok || cfg.StartAct <= 0 {
// isOpen = false
// }
//case common.ActId_GoldTask:
// plateFormConfig := ActGoldTaskMgrSington.GetPlateFormConfig(this.Platform)
// if plateFormConfig == nil || plateFormConfig.StartAct == 0 {
// isOpen = false
// }
//case common.ActId_GoldCome:
// plateFormConfig := ActGoldComeMgrSington.GetPlateFormConfig(this.Platform)
// if plateFormConfig == nil || plateFormConfig.StartAct == 0 {
// isOpen = false
// }
//case common.ActId_LuckyTurntable:
// cfg, ok := ActLuckyTurntableMgrSington.Configs[this.Platform]
// if !ok || cfg == nil || cfg.StartAct <= 0 {
// isOpen = false
// }
//case common.ActId_Yeb:
// cfg, ok := ActYebMgrSington.Configs[this.Platform]
// if !ok || cfg == nil || cfg.StartAct <= 0 {
// isOpen = false
// }
//case common.ActId_Card:
// cfg, ok := ActCardMgrSington.Configs[this.Platform]
// if !ok || cfg == nil || cfg.StartAct <= 0 {
// isOpen = false
// }
case common.ActId_RebateTask:
rebateTask := RebateInfoMgrSington.rebateTask[this.Platform]
if rebateTask != nil && !rebateTask.RebateSwitch {
isOpen = false
}
//case common.ActId_VipLevelBonus:
// config := ActVipMgrSington.GetConfig(this.Platform)
// if config == nil || config.StartAct == 0 {
// isOpen = false
// }
//case common.ActId_Sign:
// config := ActSignMgrSington.GetConfig(this.Platform)
// if config == nil || config.StartAct == 0 {
// isOpen = false
// }
//case common.ActId_Task:
// config := ActTaskMgrSington.GetPlatformConfig(this.Platform)
// if config == nil || config.StartAct == 0 {
// isOpen = false
// }
case common.ExchangeId_Bank:
platform := PlatformMgrSingleton.GetPlatform(this.Platform)
if platform == nil || !platform.IsMarkFlag(int32(BindBackCard)) {
isOpen = false
}
case common.ExchangeId_Alipay:
platform := PlatformMgrSingleton.GetPlatform(this.Platform)
if platform == nil || !platform.IsMarkFlag(int32(BindAlipay)) {
isOpen = false
}
case common.ExchangeId_Wechat:
platform := PlatformMgrSingleton.GetPlatform(this.Platform)
if platform == nil || !platform.IsMarkFlag(int32(BindWeiXin)) {
isOpen = false
}
}
if !isOpen {
actSwitchCfg[i] = 1
continue
}
open, ok := this.layered[i]
if ok && open {
actSwitchCfg[i] = 1
}
}
pack := &login_proto.SCActSwitchCfg{
ActSwitchCfg: actSwitchCfg, // 0开 1关 默认开
}
proto.SetDefaults(pack)
logger.Logger.Trace("ActStateSend2Client: ", this.SnId, pack)
this.SendToClient(int(login_proto.LoginPacketID_PACKET_SC_ACTSWITCHCFG), pack)
}
func (this *Player) ModifyActSwitch() {
logger.Logger.Trace("====================ModifyActSwitch==================")
//this.ActStateSend2Client()
}
// SyncPlayerDataToGateSrv 玩家信息同步到网关
func (this *Player) SyncPlayerDataToGateSrv(pd *model.PlayerData) {
var buf bytes.Buffer
@ -4608,10 +4459,7 @@ func (this *Player) ResetTaskN(tp int32) {
return
}
for _, v := range srvdata.PBDB_TaskMgr.Datas.GetArr() {
if v.GetTaskType() != tp {
continue
}
for _, v := range srvdata.TaskMgr.Get(tp) {
data := this.WelfData.Task[v.GetId()]
if data != nil {
data.N = 0
@ -4624,10 +4472,7 @@ func (this *Player) ResetTask(tp int32) {
return
}
for _, v := range srvdata.PBDB_TaskMgr.Datas.GetArr() {
if v.GetTaskType() != tp {
continue
}
for _, v := range srvdata.TaskMgr.Get(tp) {
this.WelfData.Task[v.GetId()] = &model.TaskData{}
}
}

View File

@ -1,275 +0,0 @@
package main
import (
"encoding/json"
"mongo.games.com/game/common"
"mongo.games.com/game/model"
"mongo.games.com/game/srvdata"
"mongo.games.com/game/webapi"
"mongo.games.com/goserver/core/logger"
"strconv"
)
//返利任务
type RebateTask struct {
Platform string //平台名称
RebateSwitch bool //返利开关
RebateManState int //返利是开启个人返利 0 关闭 1 开启
ReceiveMode int //领取方式 0实时领取 1次日领取
NotGiveOverdue int //0不过期 1过期不给 2过期邮件给
RebateGameCfg map[string]*RebateGameCfg //key为GameDif
RebateGameThirdCfg map[string]*RebateGameThirdCfg //第三方key
Version int //活动版本 后台控制
}
type RebateGameCfg struct {
BaseCoin [3]int32 //返利基准
RebateRate [3]int32 //返利比率 万分比
GameId int32 //游戏id
GameMode int32 //游戏类型
MaxRebateCoin int64 //最高返利
}
type RebateGameThirdCfg struct {
BaseCoin [3]int32 //返利基准
RebateRate [3]int32 //返利比率
ThirdName string //第三方key
ThirdShowName string //前端显示name
MaxRebateCoin int64 //最高返利
ThirdId string //三方游戏id
}
type RebateInfo struct {
rebateTask map[string]*RebateTask
}
var RebateInfoMgrSington = &RebateInfo{
rebateTask: make(map[string]*RebateTask),
}
func (this *RebateInfo) Init() {
}
func (this *RebateInfo) Update() {
}
func (this *RebateInfo) Shutdown() {
}
func (this *RebateInfo) ModuleName() string {
return "RebateTask"
}
func (this *RebateInfo) UpdateRebateDataByApi(platform string, RebateInfo RebateInfos, isThirdName bool) {
rebateTask := this.rebateTask[platform]
if rebateTask == nil {
this.rebateTask[platform] = &RebateTask{}
rebateTask = this.rebateTask[platform]
}
rebateTask.Platform = RebateInfo.Platform
rebateTask.RebateSwitch = RebateInfo.RebateSwitch
rebateTask.Version = RebateInfo.Version
rebateTask.NotGiveOverdue = RebateInfo.NotGiveOverdue
rebateTask.ReceiveMode = RebateInfo.ReceiveMode
rebateTask.RebateManState = RebateInfo.RebateManState
if !isThirdName {
rebateTask.RebateGameCfg = make(map[string]*RebateGameCfg)
for _, v := range RebateInfo.RebateGameCfg {
for _, dfm := range srvdata.PBDB_GameFreeMgr.Datas.Arr {
if dfm.GetGameId() == v.GameId && dfm.GetGameMode() == v.GameMode {
rebateTask.RebateGameCfg[dfm.GetGameDif()] = v
break
}
}
}
} else {
rebateTask.RebateGameThirdCfg = make(map[string]*RebateGameThirdCfg)
for _, v := range RebateInfo.RebateGameThirdCfg {
thirdId := strconv.Itoa(int(ThirdPltGameMappingConfig.FindThirdIdByThird(v.ThirdName)))
rebateTask.RebateGameThirdCfg[thirdId] = v
}
}
}
// 返利数据初始化
func (this *RebateInfo) LoadRebateData() {
//构建默认的平台数据
//this.CreateDefaultPlatform()
//获取平台返利数据 getGameRebateConfig
type ApiResult struct {
Tag int
Msg []RebateInfos
}
if !model.GameParamData.UseEtcd {
rebateBuff, err := webapi.API_GetGameRebateConfig(common.GetAppId())
if err == nil {
logger.Logger.Trace("API_GetGameRebateConfig:", string(rebateBuff))
ar := ApiResult{}
err = json.Unmarshal(rebateBuff, &ar)
if err == nil && ar.Tag == 0 {
for _, v := range ar.Msg {
rebateTask := this.rebateTask[v.Platform]
if rebateTask == nil {
this.rebateTask[v.Platform] = &RebateTask{
Platform: v.Platform,
RebateSwitch: v.RebateSwitch,
ReceiveMode: v.ReceiveMode,
RebateManState: v.RebateManState,
NotGiveOverdue: v.NotGiveOverdue,
Version: v.Version,
}
rebateTask = this.rebateTask[v.Platform]
}
rebateTask.RebateGameCfg = make(map[string]*RebateGameCfg)
rebateTask.RebateGameThirdCfg = make(map[string]*RebateGameThirdCfg)
for _, v := range v.RebateGameCfg {
for _, dfm := range srvdata.PBDB_GameFreeMgr.Datas.Arr {
if dfm.GetGameId() == v.GameId && dfm.GetGameMode() == v.GameMode {
rebateTask.RebateGameCfg[dfm.GetGameDif()] = v
break
}
}
}
for _, v := range v.RebateGameThirdCfg {
thirdId := strconv.Itoa(int(ThirdPltGameMappingConfig.FindThirdIdByThird(v.ThirdName)))
v.ThirdId = thirdId
rebateTask.RebateGameThirdCfg[thirdId] = v
}
}
} else {
logger.Logger.Error("Unmarshal RebateTask data error:", err)
}
} else {
logger.Logger.Error("Get RebateTask data error:", err)
}
} else {
EtcdMgrSington.InitRebateConfig()
}
}
// ///////////////////////////////////////////////////////////////////////
// 对应客户端
const (
//棋牌类
KaiYuanChessGame = 6 //开元棋牌
SelfChessGame = 7 //博乐棋牌
FGChessGame = 11 //FG棋牌
WWGChessGame = 12 //WWG棋牌
//电子类
FGElectronicGame = 4 //FG电子
WWGElectronicGame = 5 //WWG电子
)
// //////////////////////////////////
// /个人信息
type TotalInfo struct {
GameTotalNum int32 //游戏总局数
GameMostPartake string //参与最多游戏名字
GameMostProfit string //单局最多盈利游戏名字
CreateRoomNum int32 //创建房间总数
CreateRoomMost string //创建房间最多游戏名字
CreateClubNum int32 //创建俱乐部数量
CreateClubRoomMost string //创建包间最多游戏名字
TeamNum int32 //团队人数
AchievementTotal int32 //推广总业绩
RewardTotal int32 //推广总奖励
}
// /手动洗码
type CodeCoinRecord struct {
GameName string //游戏名称
GameBetCoin int64 //游戏洗码量
Rate int32 //比例
Coin int32 //洗码金额
}
type CodeCoinTotal struct {
TotalCoin int64 //总计游戏投注
CodeCoinRecord []*CodeCoinRecord
PageNo int //当前页
PageSize int //每页数量
PageNum int //总页数
}
// /投注记录
type BetCoinRecord struct {
Ts int64 //时间戳
GameName string //游戏名称
RecordId string //注单号
BetCoin int64 //投注金额
ReceivedCoin int64 //已派奖
}
type BetCoinTotal struct {
BetCoinRecord []*BetCoinRecord
PageNo int //当前页
PageSize int //每页数量
PageNum int //总页数
}
// /账户明细
type CoinDetailed struct {
Ts int64 //时间戳
CoinType int64 //交易类型
Income int64 //收入
Disburse int64 //支出
Coin int64 //金额
}
type CoinDetailedTotal struct {
RechargeCoin int64 //充值
ExchangeCoin int64 //兑换
ClubAddCoin int64 //俱乐部加币
RebateCoin int64 //返利
Activity int64 //活动获取
CoinDetailed []*CoinDetailed
PageNo int //当前页
PageSize int //每页数量
PageNum int //总页数
}
// /个人报表
type ReportForm struct {
ShowType int //标签 棋牌游戏等等
ProfitCoin int64 //盈利总额
BetCoin int64 //有效投注总额
FlowCoin int64 //流水总额
}
// //////////////////////////////////
type HallGameType struct {
GameId int32
GameMode int32
}
type GameConfig struct {
Platform string
IsKnowType bool
BigGameType map[int32]map[int32][]*HallGameType
}
//func (this *PersonInfo) FormatConfig(platform string, btl []*protocol.BigTagList) {
// if this.PlatformType[platform] == nil || (this.PlatformType[platform] != nil && !this.PlatformType[platform].IsKnowType) {
// gcf := &GameConfig{
// Platform: platform,
// IsKnowType: true,
// }
// for _, bigTag := range btl {
// gcf.BigGameType[bigTag.GetBigTagId()] = make(map[int32][]*HallGameType)
// for _, smallTag := range bigTag.SmallTagList {
// gcf.BigGameType[bigTag.GetBigTagId()][smallTag.GetSmallTagId()] = []*HallGameType{}
// bs := gcf.BigGameType[bigTag.GetBigTagId()][smallTag.GetSmallTagId()]
// for _, v := range smallTag.GameType {
// bs = append(bs, &HallGameType{GameId: v.GetGameId(), GameMode: v.GetGameMode()})
// }
// }
// }
// this.PlatformType[platform] = gcf
// }
//}
type PersonInfo struct {
PlatformType map[string]*GameConfig
}
var PersonInfoMgrSingTon = &PersonInfo{
PlatformType: make(map[string]*GameConfig),
}
func init() {
//RegisterParallelLoadFunc("平台返利数据", func() error {
// RebateInfoMgrSington.LoadRebateData()
// return nil
//})
}

View File

@ -157,11 +157,7 @@ func (t *TaskHandle) AllTask(id int, data any) {
logger.Logger.Tracef("AllTask taskID:%v %v", id, p.WelfData.Task[int32(id)])
change := map[int32][]*taskproto.TaskData{}
for _, v := range srvdata.PBDB_TaskMgr.Datas.GetArr() {
// 任务类型
if int(v.TaskType) != id {
continue
}
for _, v := range srvdata.TaskMgr.Get(int32(id)) {
if !info.Debug {
// 游戏类型
switch v.GetGameType() {

View File

@ -54,16 +54,16 @@ type WebAPITranscateHandler struct {
var WebAPIStats = make(map[string]*model.APITransactStats)
// 返利配置
type RebateInfos struct {
Platform string //平台名称
RebateSwitch bool //返利开关
RebateManState int //返利是开启个人返利 0 关闭 1 开启
ReceiveMode int //领取方式 0实时领取 1次日领取
NotGiveOverdue int //0不过期 1过期不给 2过期邮件给
RebateGameCfg []*RebateGameCfg //key为"gameid"+"gamemode"
RebateGameThirdCfg []*RebateGameThirdCfg //第三方key
Version int //活动版本 后台控制
}
//type RebateInfos struct {
// Platform string //平台名称
// RebateSwitch bool //返利开关
// RebateManState int //返利是开启个人返利 0 关闭 1 开启
// ReceiveMode int //领取方式 0实时领取 1次日领取
// NotGiveOverdue int //0不过期 1过期不给 2过期邮件给
// RebateGameCfg []*RebateGameCfg //key为"gameid"+"gamemode"
// RebateGameThirdCfg []*RebateGameThirdCfg //第三方key
// Version int //活动版本 后台控制
//}
func (this *WebAPITranscateHandler) OnExcute(tNode *transact.TransNode, ud interface{}) transact.TransExeResult {
logger.Logger.Trace("WebAPITranscateHandler.OnExcute ")