修复bug

This commit is contained in:
hahwu 2024-12-23 17:12:15 +08:00
parent fcf3be65be
commit a2139b3ad4
6 changed files with 62 additions and 99 deletions

View File

@ -299,6 +299,10 @@ func (p *Player) ZeroUpdate(a []interface{}) {
p.PlayMod.getEndlessMod().ZeroUpdate(p.PlayMod.getChargeMod().GetMaxCharge())
p.PushClientRes(p.PlayMod.getEndlessMod().BackData())
// 宠物宝箱
p.PlayMod.getFriendTreasureMod().ZeroUpdate()
p.PushClientRes(p.PlayMod.getFriendTreasureMod().BackData())
p.PlayMod.getChampshipMod().ZeroUpdate()
p.initAcitivity()
ActivityZeroUpdate(p)
@ -353,6 +357,12 @@ func (p *Player) Login() {
func (p *Player) Outline() {
PlayroomMod := p.PlayMod.getPlayroomMod()
PlayroomMod.Outline()
PlayerBaseMod := p.GetPlayerBaseMod()
Now := GoUtil.Now()
Cacumulative := Now - PlayerBaseMod.GetLoginTime()
BaseMod := p.PlayMod.getBaseMod()
BaseMod.Outline(int(Cacumulative))
p.PlayMod.save()
}

View File

@ -3166,19 +3166,7 @@ func ReqPlayroomWrokOutline(args []interface{}) error {
func ReqFriendTreasure(args []interface{}) error {
_, player, _ := ParseArgs(args)
TreasureInfoList := make([]*msg.TreasureInfo, 0)
FriendTreasureMod := player.PlayMod.getFriendTreasureMod()
for _, v := range FriendTreasureMod.GameFriend {
TreasureInfoList = append(TreasureInfoList, v)
}
player.PushClientRes(&msg.ResFriendTreasure{
Status: int32(FriendTreasureMod.Status),
List: TreasureInfoList,
List2: FriendTreasureMod.SelectF,
Star: int32(FriendTreasureMod.Star),
Shift: int32(FriendTreasureMod.Shift),
})
player.PushClientRes(player.PlayMod.getFriendTreasureMod().BackData())
return nil
}
@ -3281,7 +3269,7 @@ func ReqFriendTreasureEnd(args []interface{}) error {
)
return err
}
for _, v := range FriendTreasureMod.GameFriend {
for _, v := range FriendTreasureMod.List {
if v.Status != 1 {
continue
}

View File

@ -36,8 +36,11 @@ func AdminPlayerInfo(args []interface{}) error {
}
res := make(map[string]interface{})
res["Name"] = player.PlayMod.getBaseMod().NickName
res["Decorate"] = player.PlayMod.getDecorateMod().DecorateNum
res["AreaId"] = player.PlayMod.getDecorateMod().GetAreaId()
res["ChargeMoney"] = player.PlayMod.getChargeMod().Charge
res["Level"] = player.GetPlayerBaseMod().GetLevel()
res["Diamond"] = player.GetPlayerBaseMod().GetDiamond()
res["Star"] = player.GetPlayerBaseMod().GetStar()
JsonBuff, err := json.Marshal(res)
if err != nil {
return err

View File

@ -12,13 +12,15 @@ const (
)
type Base struct {
EnergyMul int
IsFirstBuy bool
EnergyBuy int
NickName string
PetName string
FacebookUrl string
LoginBack bool // 回归补偿
EnergyMul int
IsFirstBuy bool
EnergyBuy int
NickName string
PetName string
FacebookUrl string
Cumulative int // 累计在线时间
TodayCumulative int // 今日累计在线时间
LoginBack bool // 回归补偿
}
func (b *Base) InitData(Uid int) {
@ -94,4 +96,10 @@ func (b *Base) BackData() *msg.BaseInfo {
func (b *Base) ZeroUpdate() {
b.EnergyBuy = 0
b.TodayCumulative = 0
}
func (b *Base) Outline(Time int) {
b.TodayCumulative += Time
b.Cumulative += Time
}

View File

@ -381,10 +381,10 @@ func (cb *ChessBorad) PutChessInBag(Grid, ChessId, EmitId int) error {
if err != nil {
return err
}
ChessColor := mergeDataCfg.GetColorById(ChessId)
EmitColorId := mergeDataCfg.GetEmitId(ChessId)
ChessLv := mergeDataCfg.GetLvById(ChessId)
ChessMaxLv := mergeDataCfg.GetMaxLvById(ChessId)
if ChessLv == ChessMaxLv && cb.Retire[ChessColor] == 3 { // 退役发射器 加入荣誉室
if ChessLv == ChessMaxLv && cb.Retire[EmitColorId] == 3 { // 退役发射器 加入荣誉室
cb.AddHonor(ChessId)
return nil
}

View File

@ -9,13 +9,13 @@ import (
)
type FriendTreasureMod struct {
Star int // 星级
Shift int // 挡位
Pos []int
Num int
GameFriend map[int]*msg.TreasureInfo
SelectF []int32 // 选择的好友
Status int
Star int // 星级
Shift int // 挡位
Pos []int
Num int
List map[int]*msg.TreasureInfo
List2 []int32 // 选择的好友
Status int
}
const (
@ -24,8 +24,8 @@ const (
)
func (f *FriendTreasureMod) InitData() {
if f.GameFriend == nil {
f.GameFriend = make(map[int]*msg.TreasureInfo)
if f.List == nil {
f.List = make(map[int]*msg.TreasureInfo)
}
}
@ -33,18 +33,16 @@ func (f *FriendTreasureMod) ZeroUpdate() {
f.Star = 0
f.Shift = 0
f.Pos = nil
f.Num = 0
f.GameFriend = make(map[int]*msg.TreasureInfo)
f.SelectF = nil
f.List = make(map[int]*msg.TreasureInfo)
f.List2 = nil
f.Status = 0
}
func (f *FriendTreasureMod) InitGame(List []*msg.TreasureInfo, List2 []int32) {
for _, v := range List {
f.GameFriend[int(v.Pos)] = v
f.List[int(v.Pos)] = v
}
f.SelectF = List2
f.Num = 0
f.List2 = List2
f.Status = 1
}
@ -56,17 +54,8 @@ func (f *FriendTreasureMod) Flip(Pos int) ([]*item.Item, error) {
if f.Status == 0 {
return nil, fmt.Errorf("game not start")
}
f.Num++
Info := f.GameFriend[Pos]
// if f.Num == f.Shift { // 游戏结束
// ProbAdd := friendTreasureCfg.GetProbAdd(f.Num)
// Reward := []*item.Item{
// {Id: 1, Num: int(float64(f.Star) * float64((1+ProbAdd)/100))},
// }
// f.Star = 0
// f.Shift = 0
// return Reward, nil
// }
f.Shift++
Info := f.List[Pos]
if Info.Type == FRIEND_TYPE_ALIVE && Info.Status == 0 {
ProbMap := friendTreasureCfg.GetChestProb()
@ -101,53 +90,18 @@ func (f *FriendTreasureMod) NotifyStar() *msg.ResFriendTreasureStar {
}
}
// func getFriendList(Alive, NotAlive []int) []*Info {
// FriendList := make([]*Info, 0)
// AllFriend := make([]int, 0)
// AllFriend = append(AllFriend, Alive...)
// AllFriend = append(AllFriend, NotAlive...)
// if len(Alive)+len(NotAlive) < 9 {
// AliveInfo := initInfo(Alive, FRIEND_TYPE_ALIVE)
// NotAliveInfo := initInfo(NotAlive, FRIEND_TYPE_NOT_ALIVE)
// FriendList = append(FriendList, AliveInfo...)
// FriendList = append(FriendList, NotAliveInfo...)
// return FriendList
// }
// if len(Alive) < 3 {
// AliveInfo := initInfo(Alive, FRIEND_TYPE_ALIVE)
// NotAliveInfo := initInfo(NotAlive, FRIEND_TYPE_NOT_ALIVE)
// FriendList = append(FriendList, AliveInfo...)
// FriendList = append(FriendList, NotAliveInfo...)
// interfaceList := make([]interface{}, len(FriendList))
// for i, v := range FriendList {
// interfaceList[i] = v
// }
// randResult := GoUtil.RandSliceNum2(interfaceList, 9)
// result := make([]*Info, len(randResult))
// for i, v := range randResult {
// result[i] = v.(*Info)
// }
// return result
// }
// L1 := GoUtil.RandSliceNum(Alive, 3)
// LastFriend := GoUtil.SubSlices(AllFriend, L1)
// LastAlive := GoUtil.SubSlices(Alive, L1)
// L11 := initInfo(L1, FRIEND_TYPE_ALIVE)
// FriendList = append(FriendList, L11...)
// Num := math.Ceil(6 * float64(len(NotAlive)) / float64(len(LastFriend)))
// L2 := GoUtil.RandSliceNum(NotAlive, int(Num))
// L22 := initInfo(L2, FRIEND_TYPE_NOT_ALIVE)
// FriendList = append(FriendList, L22...)
// L3 := GoUtil.RandSliceNum(LastAlive, 9-len(FriendList))
// L33 := initInfo(L3, FRIEND_TYPE_ALIVE)
// FriendList = append(FriendList, L33...)
// return FriendList
// }
func (f *FriendTreasureMod) BackData() *msg.ResFriendTreasure {
TreasureInfoList := make([]*msg.TreasureInfo, 0)
// func initInfo(Uid []int, Type int) []*Info {
// L := make([]*Info, 0)
// for _, v := range Uid {
// L = append(L, &Info{Uid: v, Type: Type})
// }
// return L
// }
for _, v := range f.List {
TreasureInfoList = append(TreasureInfoList, v)
}
return &msg.ResFriendTreasure{
Status: int32(f.Status),
List: TreasureInfoList,
List2: f.List2,
Star: int32(f.Star),
Shift: int32(f.Shift),
}
}