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