Compare commits

...

2 Commits

Author SHA1 Message Date
sk 481860d9bc 修改注释 2024-05-25 15:03:17 +08:00
sk 0d252cebc5 添加道具类型 2024-05-25 14:47:23 +08:00
9 changed files with 172 additions and 128 deletions

View File

@ -187,78 +187,87 @@ const (
)
const (
GainWay_NewPlayer int32 = 0 //0.新建角色
GainWay_Pay = 1 //1.后台增加(主要是充值)
GainWay_ByPMCmd = 2 //2.pm命令
GainWay_MatchBreakBack = 3 //3.退赛退还
GainWay_MatchSystemSupply = 4 //4.比赛奖励
GainWay_Exchange = 5 //5.兑换
GainWay_ServiceFee = 6 //6.桌费
GainWay_CoinSceneWin = 7 //7.金豆场赢取
GainWay_CoinSceneLost = 8 //8.金豆场输
GainWay_CoinSceneEnter = 9 //9.进入金币场预扣
GainWay_ShopBuy = 10 //10.商城购买或者兑换
GainWay_CoinSceneLeave = 11 //11.金豆场回兑
GainWay_HundredSceneWin = 12 //12.万人场赢取
GainWay_HundredSceneLost = 13 //13.万人场输
GainWay_MessageAttach = 14 //14.邮件
GainWay_SafeBoxSave = 15 //15.保险箱存入
GainWay_SafeBoxTakeOut = 16 //16.保险箱取出
GainWay_Fishing = 17 //17.捕鱼
GainWay_CoinSceneExchange = 18 //18.金豆场兑换
GainWay_UpgradeAccount = 19 //19.升级账号
GainWay_API_AddCoin = 20 //20.API操作钱包
GainWay_GoldCome = 21 //21.财神降临
GainWay_Transfer_System2Thrid = 22 //22.系统平台转入到第三方平台的金币
GainWay_Transfer_Thrid2System = 23 //23.第三方平台转入到系统平台的金币
GainWay_RebateTask = 24 //24.返利获取
GainWay_IOSINSTALLSTABLE = 25 //25.ios安装奖励
GainWay_VirtualChange = 26 //26.德州虚拟账变
GainWay_CreatePrivateScene = 27 //27.创建私有房间
GainWay_PrivateSceneReturn = 28 //28.解散私有房间返还
GainWay_OnlineRandCoin = 29 //29.红包雨
GainWay_Expire = 30 //30.到期清理
GainWay_PromoterBind = 31 //31.手动绑定推广员
GainWay_GradeShopReturn = 32 //32.积分商城撤单退还积分
GainWay_Api_In = 33 //33.转移金币
GainWay_Api_Out = 34 //34.转移金币
GainWay_Shop_Buy = 35 //35.购买记录
GainWay_MAIL_MTEM = 36 //36.邮件领取道具
GainWay_Item_Sale = 37 //37.道具出售
GainWay_ReliefFund = 38 //38.领取救济金
GainWay_Shop_Revoke = 39 //39.撤单
GainWay_ActSign = 40 //40.签到
GainWay_NewPlayer int32 = 0 //新建角色
GainWay_Pay = 1 //后台增加(主要是充值)
GainWay_ByPMCmd = 2 //pm命令
GainWay_MatchBreakBack = 3 //退赛退还
GainWay_MatchSystemSupply = 4 //比赛奖励
GainWay_Exchange = 5 //兑换
GainWay_ServiceFee = 6 //桌费
GainWay_CoinSceneWin = 7 //金豆场赢取
GainWay_CoinSceneLost = 8 //金豆场输
GainWay_CoinSceneEnter = 9 //进入金币场预扣
GainWay_ShopBuy = 10 //商城购买或者兑换
GainWay_CoinSceneLeave = 11 //金豆场回兑
GainWay_HundredSceneWin = 12 //万人场赢取
GainWay_HundredSceneLost = 13 //万人场输
GainWay_MessageAttach = 14 //邮件
GainWay_SafeBoxSave = 15 //保险箱存入
GainWay_SafeBoxTakeOut = 16 //保险箱取出
GainWay_Fishing = 17 //捕鱼
GainWay_CoinSceneExchange = 18 //金豆场兑换
GainWay_UpgradeAccount = 19 //升级账号
GainWay_API_AddCoin = 20 //API操作钱包
GainWay_GoldCome = 21 //财神降临
GainWay_Transfer_System2Thrid = 22 //系统平台转入到第三方平台的金币
GainWay_Transfer_Thrid2System = 23 //第三方平台转入到系统平台的金币
GainWay_RebateTask = 24 //返利获取
GainWay_IOSINSTALLSTABLE = 25 //ios安装奖励
GainWay_VirtualChange = 26 //德州虚拟账变
GainWay_CreatePrivateScene = 27 //创建私有房间
GainWay_PrivateSceneReturn = 28 //解散私有房间返还
GainWay_OnlineRandCoin = 29 //红包雨
GainWay_Expire = 30 //到期清理
GainWay_PromoterBind = 31 //手动绑定推广员
GainWay_GradeShopReturn = 32 //积分商城撤单退还积分
GainWay_Api_In = 33 //转移金币
GainWay_Api_Out = 34 //转移金币
GainWay_Shop_Buy = 35 //购买记录
GainWay_MAIL_MTEM = 36 //邮件领取道具
GainWay_Item_Sale = 37 //道具出售
GainWay_ReliefFund = 38 //领取救济金
GainWay_Shop_Revoke = 39 //撤单
GainWay_ActSign = 40 //
GainWay_MatchSignup = 41 //比赛报名费用
GainWay_MatchSeason = 42 //比赛赛季奖励
GainWay_ActSignNew = 43 //43.新签到
GainWay_ActTurnplate = 44 //44.轮盘
GainWay_ActBlindBox = 45 //45.盲盒
GainWay_ActFirstPay = 46 //46.首充
GainWay_VIPGift = 47 //47.vip礼包
GainWay_ActContinuousPay = 48 //48.连续充值
GainWay_ActJybAward = 49 //49.礼包码兑换
GainWay_LeaveDeduct = 50 //50.离开扣分
GainWay_LeaveCombat = 51 //51.离开补偿
GainWay_RankMatch = 52 //52.排位赛段位奖励
GainWay_AddBag = 53 //53 增加背包接口调用
GainWay_SmallRocket = 54 //54.小火箭收入
GainWay_BindTel = 55 //55.绑定手机号
GainWay_ReliefFund2 = 56 //56.救济金看视频双倍领取
GainWay_ActTurnplate2 = 57 //57.轮盘看视频双倍领取
GainWay_ActSignNew2 = 58 //58.签到看视频双倍领取
GainWay_ItemUse = 59 //59.道具使用
GainWay_PhoneScore = 60 //60.积分抽奖活动
GainWay_RankReward = 61 //61.段位奖励
GainWay_TaskReward = 62 //62.任务奖励
GainWay_Interact = 63 //63.房间内互动效果
GainWay_Collect = 64 //64.集卡活动
GainWay_WeekCardAward = 65 //65.周卡每日奖励
GainWay_PigrankTakeCoin = 66 //66.存钱罐领取耗费钻石
GainWay_PigrankGainCoin = 67 //67.存钱罐打开获取金币
GainWay_ItemMove = 68 //68.道具赠送
GainWay_RoleUpgrade = 69 //69.角色升级
GainWay_PetUpgrade = 70 //70.宠物升级
GainWay_Game = 71 //71.玩游戏获得
GainWay_ActSignNew = 43 //新签到
GainWay_ActTurnplate = 44 //轮盘
GainWay_ActBlindBox = 45 //盲盒
GainWay_ActFirstPay = 46 //首充
GainWay_VIPGift = 47 //vip礼包
GainWay_ActContinuousPay = 48 //连续充值
GainWay_ActJybAward = 49 //礼包码兑换
GainWay_LeaveDeduct = 50 //离开扣分
GainWay_LeaveCombat = 51 //离开补偿
GainWay_RankMatch = 52 //排位赛段位奖励
GainWay_AddBag = 53 //增加背包接口调用
GainWay_SmallRocket = 54 //小火箭收入
GainWay_BindTel = 55 //绑定手机号
GainWay_ReliefFund2 = 56 //救济金看视频双倍领取
GainWay_ActTurnplate2 = 57 //轮盘看视频双倍领取
GainWay_ActSignNew2 = 58 //签到看视频双倍领取
GainWay_ItemUse = 59 //道具使用
GainWay_PhoneScore = 60 //积分抽奖活动
GainWay_RankReward = 61 //
GainWay_TaskReward = 62 //
GainWay_Interact = 63 //房间内互动效果
GainWay_Collect = 64 //集卡活动
GainWay_WeekCardAward = 65 //周卡奖励
GainWay_PigrankTakeCoin = 66 //存钱罐领取耗费钻石
GainWay_PigrankGainCoin = 67 //存钱罐打开获取金币
GainWay_ItemMove = 68 //道具赠送
GainWay_RoleUpgrade = 69 //角色升级
GainWay_PetUpgrade = 70 //宠物升级
GainWay_Game = 71 //游戏掉落
GainWayItemCollectLogin = 73 //集卡活动登录
GainWayItemCollectExchange = 74 //集卡活动兑换
GainWayItemPhoneScoreExchange = 75 //抽手机活动兑换
GainWayItemTaskInvite = 78 //邀请任务
GainWayItemTaskNewPlayer = 79 //新手任务
GainWayItemTaskAchievement = 80 //成就任务
GainWayItemTaskEveryDay = 81 //每日任务
GainWayItemWeekActive = 82 //周活跃奖励
GainWayContinueSign = 83 //累计签到
)
// 后台选择 金币变化类型 的充值 类型id号起始

View File

@ -359,7 +359,7 @@ type PlayerData struct {
Coin int64 //金豆
CoinPayTs int64 //金豆冲账时间戳
CoinPayTotal int64 //在线总充值金额
MoneyPayTotal int64 //在线总充值金额(实充)
MoneyPayTotal int64 //VIP经验值注意这里是没有乘充V比之前的值
CoinExchangeTotal int64 //总提现金额 兑换
SafeBoxCoin int64 //保险箱金币
SafeBoxPassword string //保险箱密码

View File

@ -74,7 +74,7 @@ func CSUpBagInfo(s *netlib.Session, packetid int, data interface{}, sid int64) e
ItemId: msg.ItemId,
ItemNum: int64(msg.ItemNum),
}}
BagMgrSingleton.AddItems(p, items, 0, common.GainWay_AddBag, "system", "测试", 0, 0, false)
BagMgrSingleton.AddItems(p, items, 0, common.GainWay_ItemUse, "system", "测试", 0, 0, false)
return nil
}
}
@ -112,23 +112,41 @@ func CSUpBagInfo(s *netlib.Session, packetid int, data interface{}, sid int64) e
items := map[int32]*Item{}
var useFunc func()
saleFunc := func() {
saleFunc := func(gainWay int32, oper, remark string) {
if gainWay == 0 {
gainWay = common.GainWay_ItemUse
}
if oper == "" {
oper = "player"
}
if remark == "" {
remark = "道具使用"
}
// 使用道具,减少道具
BagMgrSingleton.AddItem(p, int64(item.ItemId), int64(-msg.ItemNum), 0, common.GainWay_ItemUse, "player", "道具使用", 0, 0, false)
BagMgrSingleton.AddItem(p, int64(item.ItemId), int64(-msg.ItemNum), 0, gainWay, oper, remark, 0, 0, false)
pack.RetCode = bag.OpResultCode_OPRC_Sucess
pack.NowItemId = item.ItemId
pack.NowItemNum = item.ItemNum
}
gainFunc := func() {
gainFunc := func(gainWay int32, oper, remark string) {
for i := 0; i < int(msg.ItemNum); i++ {
useFunc()
}
if gainWay == 0 {
gainWay = common.GainWay_ItemUse
}
if oper == "" {
oper = "player"
}
if remark == "" {
remark = "道具使用"
}
if len(items) > 0 {
var itemArr []*Item
for _, v := range items {
itemArr = append(itemArr, v)
}
BagMgrSingleton.AddItems(p, itemArr, 0, common.GainWay_ItemUse, "player", "道具使用", 0, 0, false)
BagMgrSingleton.AddItems(p, itemArr, 0, gainWay, oper, remark, 0, 0, false)
for _, v := range itemArr {
pack.Infos = append(pack.Infos, &bag.ItemInfo{
ItemId: v.ItemId,
@ -141,7 +159,7 @@ func CSUpBagInfo(s *netlib.Session, packetid int, data interface{}, sid int64) e
switch item.ItemId {
case common.ItemIDGiftBox:
saleFunc()
saleFunc(0, "", "")
useFunc = func() {
sum := 0
for _, v := range srvdata.PBDB_GiftBoxMgr.Datas.GetArr() {
@ -172,10 +190,10 @@ func CSUpBagInfo(s *netlib.Session, packetid int, data interface{}, sid int64) e
}
}
}
gainFunc()
gainFunc(0, "", "")
case common.ItemIDCollectBox:
saleFunc()
saleFunc(0, "", "")
useFunc = func() {
sum := 0
for _, v := range srvdata.PBDB_CollectBoxMgr.Datas.GetArr() {
@ -206,7 +224,7 @@ func CSUpBagInfo(s *netlib.Session, packetid int, data interface{}, sid int64) e
}
}
}
gainFunc()
gainFunc(common.GainWay_Collect, "player", "集卡活动")
default:
logger.Logger.Warnf("道具使用未定义", msg.ItemId)
@ -373,10 +391,10 @@ func CSPropExchange(s *netlib.Session, packetid int, data interface{}, sid int64
}
// 扣除背包物品
for _, item := range costItems {
BagMgrSingleton.AddItem(p, int64(item.ItemId), -item.ItemNum, 0, common.GainWay_Collect, "system", "集卡活动兑换", 0, 0, false)
BagMgrSingleton.AddItem(p, int64(item.ItemId), -item.ItemNum, 0, common.GainWayItemCollectExchange, "system", "集卡活动兑换", 0, 0, false)
}
// 增加背包物品
BagMgrSingleton.AddItems(p, items, 0, common.GainWay_Collect, "system", "集卡活动兑换", 0, 0, false)
BagMgrSingleton.AddItems(p, items, 0, common.GainWayItemCollectExchange, "system", "集卡活动兑换", 0, 0, false)
for _, v := range items {
pack.Items = append(pack.Items, &bag.PropInfo{
ItemId: v.ItemId,

View File

@ -254,7 +254,7 @@ func CSRMAward(s *netlib.Session, packetId int, data interface{}, sid int64) err
ItemId: v.Id,
ItemNum: int64(v.Num),
}
BagMgrSingleton.AddItems(p, []*Item{item}, 0, common.GainWay_RankReward, "system", "段位奖励", 0, 0, false)
BagMgrSingleton.AddItems(p, []*Item{item}, 0, common.GainWay_RankMatch, "system", "段位奖励", 0, 0, false)
}
}
}

View File

@ -71,7 +71,7 @@ func IsTaskReward(p *Player, id int32) bool {
return false
}
func SendReward(p *Player, m map[int64]int64) {
func SendReward(p *Player, m map[int64]int64, tp int32) {
var items []*Item
for k, v := range m {
items = append(items, &Item{
@ -79,7 +79,20 @@ func SendReward(p *Player, m map[int64]int64) {
ItemNum: v,
})
}
BagMgrSingleton.AddItems(p, items, 0, common.GainWay_TaskReward, "system", "任务奖励", 0, 0, false)
gain := int32(0)
switch tp {
case 1:
gain = common.GainWayItemTaskEveryDay
case 2:
gain = common.GainWayItemWeekActive
case 3:
gain = common.GainWayItemTaskNewPlayer
case 4:
gain = common.GainWayItemTaskInvite
case 5:
gain = common.GainWayItemTaskAchievement
}
BagMgrSingleton.AddItems(p, items, 0, gain, "system", "任务奖励", 0, 0, false)
}
func CSTaskList(s *netlib.Session, packetId int, data interface{}, sid int64) error {
@ -142,7 +155,7 @@ func CSTaskReward(s *netlib.Session, packetId int, data interface{}, sid int64)
p.WelfData.Task[msg.GetId()].Ts = time.Now().Unix()
data := srvdata.PBDB_TaskMgr.GetData(msg.GetId())
if data != nil {
SendReward(p, data.Award)
SendReward(p, data.Award, msg.Tp)
}
ret.OpCode = taskproto.OpResultCode_OPRC_Success
}

View File

@ -9,7 +9,6 @@ import (
"mongo.games.com/game/protocol/server"
"mongo.games.com/game/srvdata"
"mongo.games.com/goserver/core/logger"
"strconv"
"time"
)
@ -114,41 +113,41 @@ func (this *ActSignMgr) CanSign(player *Player, signIndex int) activity.OpResult
return activity.OpResultCode_ActSign_OPRC_Activity_Sign_Sucess
}
func (this *ActSignMgr) Sign(player *Player, signIndex int, signType int32) activity.OpResultCode_ActSign {
errCode := this.CanSign(player, signIndex)
if errCode != activity.OpResultCode_ActSign_OPRC_Activity_Sign_Sucess {
return errCode
}
signConfig := this.GetConfig(signIndex)
if signConfig == nil {
return activity.OpResultCode_ActSign_OPRC_Activity_Sign_Error
}
player.SignData.LastSignTickets = time.Now().Unix()
player.SignData.SignIndex = signIndex
logger.Logger.Info("签到成功: ", signConfig)
grade := signConfig.Grade
switch signType {
case 0: //普通签到
case 1: //双倍签到
grade *= 2
}
switch signConfig.Type {
case 1: //金币
player.AddCoin(int64(grade), 0, common.GainWay_ActSign, strconv.Itoa(signIndex), time.Now().Format("2006-01-02 15:04:05"))
case 2: //钻石
player.AddDiamond(int64(grade), 0, common.GainWay_ActSign, strconv.Itoa(signIndex), time.Now().Format("2006-01-02 15:04:05"))
case 3: //道具
item := &Item{
ItemId: signConfig.Item_Id,
ItemNum: int64(grade),
}
BagMgrSingleton.AddItems(player, []*Item{item}, 0, common.GainWay_ActSign, strconv.Itoa(signIndex), time.Now().Format("2006-01-02 15:04:05"), 0, 0, false)
}
return activity.OpResultCode_ActSign_OPRC_Activity_Sign_Sucess
}
//func (this *ActSignMgr) Sign(player *Player, signIndex int, signType int32) activity.OpResultCode_ActSign {
// errCode := this.CanSign(player, signIndex)
// if errCode != activity.OpResultCode_ActSign_OPRC_Activity_Sign_Sucess {
// return errCode
// }
//
// signConfig := this.GetConfig(signIndex)
// if signConfig == nil {
// return activity.OpResultCode_ActSign_OPRC_Activity_Sign_Error
// }
//
// player.SignData.LastSignTickets = time.Now().Unix()
// player.SignData.SignIndex = signIndex
//
// logger.Logger.Info("签到成功: ", signConfig)
// grade := signConfig.Grade
// switch signType {
// case 0: //普通签到
// case 1: //双倍签到
// grade *= 2
// }
// switch signConfig.Type {
// case 1: //金币
// player.AddCoin(int64(grade), 0, common.GainWay_ActSign, strconv.Itoa(signIndex), time.Now().Format("2006-01-02 15:04:05"))
// case 2: //钻石
// player.AddDiamond(int64(grade), 0, common.GainWay_ActSign, strconv.Itoa(signIndex), time.Now().Format("2006-01-02 15:04:05"))
// case 3: //道具
// item := &Item{
// ItemId: signConfig.Item_Id,
// ItemNum: int64(grade),
// }
// BagMgrSingleton.AddItems(player, []*Item{item}, 0, common.GainWay_ActSign, strconv.Itoa(signIndex), time.Now().Format("2006-01-02 15:04:05"), 0, 0, false)
// }
// return activity.OpResultCode_ActSign_OPRC_Activity_Sign_Sucess
//}
func init() {
mgo.SetStats(true)

View File

@ -302,7 +302,7 @@ func (this *Player) OnLogined() {
//测试用
if !this.IsRob {
old := this.VIP
this.VIP = this.GetVIPLevel(this.CoinPayTotal)
this.VIP = this.GetVIPLevel()
if old != this.VIP {
this.dirty = true
}
@ -2409,7 +2409,7 @@ func (this *Player) UpdateVip() {
if this.IsRob {
return
}
this.VIP = this.GetVIPLevel(this.CoinPayTotal)
this.VIP = this.GetVIPLevel()
//clubManager.UpdateVip(this)
}
@ -3790,7 +3790,7 @@ func (this *Player) GetCurrentVIPExp(vipcfg ...*webapi_proto.VIPcfgDataList) (ex
return // 默认
}
func (this *Player) GetVIPLevel(CoinPayTotal int64) int32 {
func (this *Player) GetVIPLevel() int32 {
if this.IsRob {
return 0
}
@ -4229,7 +4229,6 @@ func (this *Player) BindTelReward() {
ItemNum: v,
})
}
}
BagMgrSingleton.AddItems(this, items, 0, common.GainWay_BindTel, "system", "绑定手机号", 0, 0, false)
}
@ -4479,7 +4478,7 @@ func (this *Player) CollectTask(taskId int32, num int64) {
ItemNum: num,
ObtainTime: time.Now().Unix(),
})
BagMgrSingleton.AddItems(this, items, 0, common.GainWay_Collect, "system", oper, 0, 0, false)
BagMgrSingleton.AddItems(this, items, 0, common.GainWayItemCollectLogin, "system", oper, 0, 0, false)
default:
}
}

View File

@ -522,9 +522,14 @@ func (this *ShopMgr) GetCostNum(p *Player, shop *model.ShopInfo, vipShopId int32
func (this *ShopMgr) shopAddItem(p *Player, shopInfo *model.ShopInfo, vipShopId int32) {
name := shopInfo.GetName()
gainWay := common.GainWay_Shop_Buy
if shopInfo.ConstType == ShopConsumePhoneScore {
gainWay = common.GainWayItemPhoneScoreExchange
}
for _, info := range shopInfo.GetItems() {
item := &Item{ItemId: info.ItemId, ItemNum: info.ItemNum, ObtainTime: time.Now().Unix()}
BagMgrSingleton.AddItems(p, []*Item{item}, 0, common.GainWay_Shop_Buy, "system", name, 0, 0, false)
BagMgrSingleton.AddItems(p, []*Item{item}, 0, int32(gainWay), "system", name, 0, 0, false)
}
// 获得道具,检查是否显示红点

View File

@ -519,6 +519,7 @@ func DrawWelfareDate(dates []*webapi_proto.WelfareDate, p *Player, gainWay int32
giveType = model.SystemFreeGive_GiveType_ActSign
} else { //累签
giveType = model.SystemFreeGive_GiveType_ActContinuousSign
gainWay = common.GainWayContinueSign
}
}
for _, v := range dates {