update
This commit is contained in:
parent
a0050bd44d
commit
63efa84183
|
|
@ -579,11 +579,18 @@ type PlayerDataForWeb struct {
|
|||
WinTimes int32
|
||||
}
|
||||
|
||||
type WebItem struct {
|
||||
Id int64
|
||||
N int64
|
||||
Name string
|
||||
}
|
||||
|
||||
type WebPlayerDataParam struct {
|
||||
*PlayerData
|
||||
RankScore map[int64]int64
|
||||
PlayerPoolUpper, PlayerPoolLower, PlayerPoolCurrent, PlayerPoolOdds int64
|
||||
RoleAdded, VipAdded, VipExp int64
|
||||
Items []*WebItem
|
||||
}
|
||||
|
||||
func ConvertPlayerDataToWebData(param *WebPlayerDataParam) *webapi.PlayerData {
|
||||
|
|
@ -653,6 +660,13 @@ func ConvertPlayerDataToWebData(param *WebPlayerDataParam) *webapi.PlayerData {
|
|||
pdfw.InviteScore = param.InviteScore
|
||||
pdfw.Channel = param.Channel
|
||||
pdfw.LastChannel = param.LastChannel
|
||||
for _, v := range param.Items {
|
||||
pdfw.Items = append(pdfw.Items, &webapi.ItemInfo{
|
||||
ItemId: int32(v.Id),
|
||||
ItemNum: v.N,
|
||||
Name: v.Name,
|
||||
})
|
||||
}
|
||||
return pdfw
|
||||
}
|
||||
func (this *PlayerData) IsMarkFlag(flag int) bool {
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -201,6 +201,7 @@ message PlayerData{
|
|||
int64 InviteScore = 52;//邀请积分
|
||||
string Channel = 53; // 首次安装渠道
|
||||
string LastChannel = 54; // 最近使用的包渠道
|
||||
repeated ItemInfo Items = 55; // 背包物品
|
||||
}
|
||||
|
||||
message RoomInfo{
|
||||
|
|
|
|||
2
public
2
public
|
|
@ -1 +1 @@
|
|||
Subproject commit a7fc5af077865e1daf27c8e04ff3247aa643a815
|
||||
Subproject commit 8d7ca1974d29e5d5c3100a7024e353c992505a7b
|
||||
|
|
@ -256,9 +256,11 @@ func (this *BagMgr) AddItems(p *Player, addItems []*Item, add int64, gainWay int
|
|||
|
||||
// 道具日志
|
||||
if !noLog {
|
||||
num := v.ItemNum
|
||||
logType := ItemObtain
|
||||
if v.ItemNum < 0 {
|
||||
logType = ItemConsume
|
||||
num = -v.ItemNum
|
||||
}
|
||||
log := model.NewItemLogEx(model.ItemParam{
|
||||
Platform: p.Platform,
|
||||
|
|
@ -266,7 +268,7 @@ func (this *BagMgr) AddItems(p *Player, addItems []*Item, add int64, gainWay int
|
|||
LogType: int32(logType),
|
||||
ItemId: v.ItemId,
|
||||
ItemName: item.Name,
|
||||
Count: v.ItemNum,
|
||||
Count: num,
|
||||
Remark: remark,
|
||||
TypeId: gainWay,
|
||||
GameId: gameId,
|
||||
|
|
@ -277,7 +279,7 @@ func (this *BagMgr) AddItems(p *Player, addItems []*Item, add int64, gainWay int
|
|||
}
|
||||
}
|
||||
|
||||
if v.ItemId == common.ItemIDWeekScore && v.ItemNum != 0 {
|
||||
if v.ItemId == common.ItemIDWeekScore && v.ItemNum > 0 {
|
||||
TaskSubjectSingleton.Touch(common.TaskTypeActivityScore, &TaskData{
|
||||
SnId: p.SnId,
|
||||
Num: v.ItemNum,
|
||||
|
|
@ -335,9 +337,11 @@ func (this *BagMgr) AddItemsOffline(platform string, snid int32, addItems []*Ite
|
|||
if itemData == nil {
|
||||
continue
|
||||
}
|
||||
num := v.ItemNum
|
||||
logType := ItemObtain
|
||||
if v.ItemNum < 0 {
|
||||
logType = ItemConsume
|
||||
num = -v.ItemNum
|
||||
}
|
||||
log := model.NewItemLogEx(model.ItemParam{
|
||||
Platform: findPlayer.Platform,
|
||||
|
|
@ -345,7 +349,7 @@ func (this *BagMgr) AddItemsOffline(platform string, snid int32, addItems []*Ite
|
|||
LogType: int32(logType),
|
||||
ItemId: v.ItemId,
|
||||
ItemName: itemData.Name,
|
||||
Count: v.ItemNum,
|
||||
Count: num,
|
||||
Remark: remark,
|
||||
TypeId: gainWay,
|
||||
GameId: gameId,
|
||||
|
|
|
|||
|
|
@ -2448,6 +2448,7 @@ func init() {
|
|||
platform := msg.GetPlatform()
|
||||
player := PlayerMgrSington.GetPlayerBySnId(id)
|
||||
var playerRankScore *model.PlayerRankSeason
|
||||
var playerBagInfo *model.BagInfo
|
||||
if player == nil {
|
||||
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
|
||||
data, _ := model.GetPlayerDataBySnId(platform, id, true, false)
|
||||
|
|
@ -2461,6 +2462,7 @@ func init() {
|
|||
if len(ret.List) > 0 {
|
||||
playerRankScore = ret.List[0]
|
||||
}
|
||||
playerBagInfo = model.GetBagInfo(id, platform)
|
||||
return data
|
||||
}), task.CompleteNotifyWrapper(func(data interface{}, t task.Task) {
|
||||
playerData, ok := data.(*model.PlayerData)
|
||||
|
|
@ -2469,7 +2471,11 @@ func init() {
|
|||
pack.Tag = webapiproto.TagCode_FAILED
|
||||
} else {
|
||||
pack.Tag = webapiproto.TagCode_SUCCESS
|
||||
pdfw := model.ConvertPlayerDataToWebData(getPlayerDataParam(playerData, playerRankScore))
|
||||
pdfw := model.ConvertPlayerDataToWebData(getPlayerDataParam(&playerDataParam{
|
||||
P: playerData,
|
||||
Season: playerRankScore,
|
||||
Items: playerBagInfo,
|
||||
}))
|
||||
|
||||
pdfw.Online = false
|
||||
pack.PlayerData = pdfw
|
||||
|
|
@ -2482,7 +2488,7 @@ func init() {
|
|||
} else {
|
||||
if len(platform) > 0 && player.Platform == platform {
|
||||
pack.Tag = webapiproto.TagCode_SUCCESS
|
||||
pwdf := model.ConvertPlayerDataToWebData(getPlayerDataParam(player.PlayerData, nil))
|
||||
pwdf := model.ConvertPlayerDataToWebData(getPlayerDataParam(&playerDataParam{player.PlayerData, nil, nil}))
|
||||
pwdf.Online = player.IsOnLine()
|
||||
if pwdf != nil {
|
||||
if player.scene != nil && player.scene.sceneId != common.DgSceneId && !player.scene.IsTestScene() {
|
||||
|
|
@ -2520,10 +2526,11 @@ func init() {
|
|||
pack.Tag = webapiproto.TagCode_SUCCESS
|
||||
var leavePlayer []int32
|
||||
var playerRankScore = map[int32]*model.PlayerRankSeason{}
|
||||
var playerItems = map[int32]*model.BagInfo{}
|
||||
for _, snid := range msg.GetSnIds() {
|
||||
player := PlayerMgrSington.GetPlayerBySnId(snid)
|
||||
if player != nil {
|
||||
pwdf := model.ConvertPlayerDataToWebData(getPlayerDataParam(player.PlayerData, nil))
|
||||
pwdf := model.ConvertPlayerDataToWebData(getPlayerDataParam(&playerDataParam{player.PlayerData, nil, nil}))
|
||||
if pwdf != nil {
|
||||
pwdf.Online = true
|
||||
if player.scene != nil && player.scene.sceneId != common.DgSceneId {
|
||||
|
|
@ -2545,13 +2552,17 @@ func init() {
|
|||
})
|
||||
for _, v := range ret.List {
|
||||
playerRankScore[v.SnId] = v
|
||||
//todo 优化
|
||||
items := model.GetBagInfo(v.SnId, msg.GetPlatform())
|
||||
playerItems[v.SnId] = items
|
||||
}
|
||||
|
||||
return model.GetPlayerDatasBySnIds(msg.Platform, leavePlayer, false)
|
||||
}), task.CompleteNotifyWrapper(func(data interface{}, t task.Task) {
|
||||
if data != nil {
|
||||
playerDatas, _ := data.([]*model.PlayerData)
|
||||
for _, v := range playerDatas {
|
||||
pdfw := model.ConvertPlayerDataToWebData(getPlayerDataParam(v, playerRankScore[v.SnId]))
|
||||
pdfw := model.ConvertPlayerDataToWebData(getPlayerDataParam(&playerDataParam{v, playerRankScore[v.SnId], playerItems[v.SnId]}))
|
||||
if pdfw != nil {
|
||||
pdfw.Online = false
|
||||
pack.PlayerData = append(pack.PlayerData, pdfw)
|
||||
|
|
@ -2972,7 +2983,7 @@ func init() {
|
|||
for i := start; i < end; i++ {
|
||||
p := players[i]
|
||||
if p != nil {
|
||||
pb := model.ConvertPlayerDataToWebData(getPlayerDataParam(p.PlayerData, nil))
|
||||
pb := model.ConvertPlayerDataToWebData(getPlayerDataParam(&playerDataParam{p.PlayerData, nil, nil}))
|
||||
if p.scene != nil {
|
||||
pb.GameFreeId = p.scene.dbGameFree.Id
|
||||
pb.SceneId = int32(p.scene.sceneId)
|
||||
|
|
@ -4372,48 +4383,83 @@ func init() {
|
|||
}))
|
||||
}
|
||||
|
||||
func getPlayerDataParam(p *model.PlayerData, season *model.PlayerRankSeason) *model.WebPlayerDataParam {
|
||||
if p == nil {
|
||||
type playerDataParam struct {
|
||||
P *model.PlayerData
|
||||
Season *model.PlayerRankSeason
|
||||
Items *model.BagInfo
|
||||
}
|
||||
|
||||
func getPlayerDataParam(param *playerDataParam) *model.WebPlayerDataParam {
|
||||
if param.P == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
data := PlatformMgrSingleton.GetConfig(p.Platform).PlayerPool
|
||||
data := PlatformMgrSingleton.GetConfig(param.P.Platform).PlayerPool
|
||||
|
||||
rankScore := make(map[int64]int64)
|
||||
if season == nil {
|
||||
rankScore = RankMgrSingleton.GetPlayerRankScoreInt64(p.SnId)
|
||||
if param.Season == nil {
|
||||
rankScore = RankMgrSingleton.GetPlayerRankScoreInt64(param.P.SnId)
|
||||
} else {
|
||||
for k, v := range season.RankType {
|
||||
for k, v := range param.Season.RankType {
|
||||
if v != nil {
|
||||
rankScore[int64(k)] = v.Score
|
||||
}
|
||||
}
|
||||
}
|
||||
var items []*model.WebItem
|
||||
if param.Items == nil {
|
||||
b := BagMgrSingleton.GetBagInfo(param.P.SnId)
|
||||
for _, v := range b.BagItem {
|
||||
e := srvdata.PBDB_GameItemMgr.GetData(v.ItemId)
|
||||
if e == nil {
|
||||
continue
|
||||
}
|
||||
items = append(items, &model.WebItem{
|
||||
Id: int64(e.Id),
|
||||
N: v.ItemNum,
|
||||
Name: e.Name,
|
||||
})
|
||||
}
|
||||
} else {
|
||||
for _, v := range param.Items.BagItem {
|
||||
e := srvdata.PBDB_GameItemMgr.GetData(v.ItemId)
|
||||
if e == nil {
|
||||
continue
|
||||
}
|
||||
items = append(items, &model.WebItem{
|
||||
Id: int64(e.Id),
|
||||
N: v.ItemNum,
|
||||
Name: e.Name,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
//人物加成
|
||||
award := int32(0)
|
||||
level := p.Roles.ModUnlock[2000002]
|
||||
level := param.P.Roles.ModUnlock[2000002]
|
||||
if level > 0 {
|
||||
roleInfo := srvdata.RolePetMgrSington.GetRoleByRoleIdAndLevel(2000002, level)
|
||||
if roleInfo != nil {
|
||||
award = roleInfo.Award
|
||||
}
|
||||
}
|
||||
vipAdded := VipMgrSington.GetVipDiamondExtra(p.Platform, p.VIP)
|
||||
vipAdded := VipMgrSington.GetVipDiamondExtra(param.P.Platform, param.P.VIP)
|
||||
var vipExp int64
|
||||
vipConfig := VipMgrSington.GetVIPcfg(p.Platform)
|
||||
vipConfig := VipMgrSington.GetVIPcfg(param.P.Platform)
|
||||
if vipConfig != nil {
|
||||
vipExp = int64(float64(p.MoneyPayTotal) * vipConfig.MoneyRatio)
|
||||
vipExp = int64(float64(param.P.MoneyPayTotal) * vipConfig.MoneyRatio)
|
||||
}
|
||||
ret := &model.WebPlayerDataParam{
|
||||
PlayerData: p,
|
||||
PlayerData: param.P,
|
||||
RankScore: rankScore,
|
||||
PlayerPoolUpper: p.GetPoolUpper(data),
|
||||
PlayerPoolLower: p.GetPoolLower(data),
|
||||
PlayerPoolCurrent: p.GetPoolCurrent(),
|
||||
PlayerPoolOdds: p.GetPoolOdds(data),
|
||||
PlayerPoolUpper: param.P.GetPoolUpper(data),
|
||||
PlayerPoolLower: param.P.GetPoolLower(data),
|
||||
PlayerPoolCurrent: param.P.GetPoolCurrent(),
|
||||
PlayerPoolOdds: param.P.GetPoolOdds(data),
|
||||
RoleAdded: int64(award),
|
||||
VipAdded: int64(vipAdded),
|
||||
VipExp: vipExp,
|
||||
Items: items,
|
||||
}
|
||||
|
||||
return ret
|
||||
|
|
|
|||
Loading…
Reference in New Issue