This commit is contained in:
liwei1dao 2023-11-10 18:53:33 +08:00
commit 5ecb4acce3
37 changed files with 119 additions and 15 deletions

View File

@ -2,9 +2,11 @@ package entertainment
import (
"context"
"crypto/rand"
"go_dreamfactory/comm"
"go_dreamfactory/modules"
"go_dreamfactory/pb"
"math/big"
"go_dreamfactory/lego/core"
@ -89,17 +91,18 @@ func (this *matchComp) MatchNotic(players map[string]interface{}) (err error) {
if robots, err := this.module.ModuleTools.RandRobotConfig(1); err == nil {
if len(robots) > 0 {
p2 = &pb.PlayerData{
Userinfo: &pb.BaseUserInfo{
Uid: "999",
Sid: "",
Name: robots[0].Name,
Gender: robots[0].Sex,
Skin: robots[0].Showid,
Aframe: "",
Title: "",
Lv: robots[0].Lvshow,
},
Cardid: this.module.configure.GetRobotGameConsumeHero(),
Userinfo: &pb.BaseUserInfo{Uid: "999", Sid: "", Name: robots[0].Name, Gender: robots[0].Sex, Skin: robots[0].Showid, Aframe: "", Title: "", Lv: robots[0].Lvshow},
Cardid: this.module.configure.GetRobotGameConsumeHero(),
}
n1, _ := rand.Int(rand.Reader, big.NewInt(100)) // AI 玩家积分波动
if n1.Int64()%2 == 0 {
p2.Consumeexp = p1.Consumeexp + int32(n1.Int64())
} else {
p2.Consumeexp = p1.Consumeexp - int32(n1.Int64())
if p2.Consumeexp < 0 { // 负数过滤
n1, _ := rand.Int(rand.Reader, big.NewInt(100))
p2.Consumeexp = int32(n1.Int64())
}
}
}
}

View File

@ -73,5 +73,8 @@ func (this *apiComp) WeekReward(session comm.IUserSession, req *pb.ParkourWeekRe
return
}
session.SendMsg(string(this.module.GetType()), "weekreward", &pb.CapturesheepWeekRewardResp{Id: req.Id, Award: award})
go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {
this.module.WriteUserLog(session.GetUserId(), "CapturesheepWeekRewardReq", award)
})
return
}

View File

@ -581,6 +581,9 @@ func (this *Parkour) overtimer(task *timewheel.Task, args ...interface{}) {
},
Award: award[v.GetUserId()],
})
go this.AsynHandleSession(v, func(session comm.IUserSession) {
this.WriteUserLog(session.GetUserId(), "ParkourRaceOverPush", award[v.GetUserId()])
})
sessions = append(sessions, v)
}

View File

@ -64,6 +64,7 @@ func (this *apiComp) GetGymBuff(session comm.IUserSession, req *pb.PracticeGetGy
session.SendMsg(string(this.module.GetType()), "getgymbuff", &pb.PracticeGetGymBuffResp{Buffid: buff.Id, Award: award})
go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {
this.module.ModuleBuried.TriggerBuried(session, tasks...)
this.module.WriteUserLog(session.GetUserId(), "PracticeGetGymBuffReq", award)
})
return
}

View File

@ -91,6 +91,7 @@ func (this *apiComp) NPCBattkleFinish(session comm.IUserSession, req *pb.Practic
go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {
this.module.ModuleBuried.TriggerBuried(session, tasks...)
this.module.WriteUserLog(session.GetUserId(), "PracticeNPCBattkleFinishReq", award)
})
return
}

View File

@ -305,6 +305,7 @@ func (this *apiComp) Receive(session comm.IUserSession, req *pb.PracticeReceiveR
go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {
this.module.ModuleBuried.TriggerBuried(session, tasks...)
this.module.WriteUserLog(session.GetUserId(), "PracticeReceiveReq", award)
})
return
}

View File

@ -86,5 +86,9 @@ func (this *apiComp) BuyGift(session comm.IUserSession, req *pb.PrivilegeBuyGift
Data: vip,
Res: atno,
})
go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {
this.module.WriteUserLog(session.GetUserId(), "PrivilegeBuyGiftReq", atno)
})
return
}

View File

@ -238,6 +238,7 @@ func (this *apiComp) Buy(session comm.IUserSession, req *pb.ShopBuyReq) (errdata
if len(tasks) > 0 {
go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {
this.module.ModuleBuried.TriggerBuried(session, tasks...)
this.module.WriteUserLog(session.GetUserId(), "ShopBuyResq", award)
})
}
return

View File

@ -168,5 +168,8 @@ func (this *apiComp) Receive(session comm.IUserSession, req *pb.ShopCenterReceiv
}
}
session.SendMsg(string(this.module.GetType()), "receive", &pb.ShopCenterReceiveResp{Fid: req.Fid, Pid: req.Pid, Award: award})
go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {
this.module.WriteUserLog(session.GetUserId(), "ShopCenterReceiveReq", award)
})
return
}

View File

@ -59,5 +59,8 @@ func (this *apiComp) AtlasAward(session comm.IUserSession, req *pb.SmithyAtlasAw
Data: atlas,
Reward: atno,
})
go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {
this.module.WriteUserLog(session.GetUserId(), "SmithyAtlasAwardReq", atno)
})
return
}

View File

@ -374,6 +374,7 @@ func (this *apiComp) ForgeEquip(session comm.IUserSession, req *pb.SmithyForgeEq
go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {
this.module.ModuleBuried.TriggerBuried(session, tasks...)
this.module.WriteUserLog(session.GetUserId(), "SmithyForgeEquipReq", atno)
})
return

View File

@ -60,5 +60,9 @@ func (this *apiComp) TaskAward(session comm.IUserSession, req *pb.SmithyTaskAwar
TaskId: req.TaskId,
Reward: atno,
})
go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {
this.module.WriteUserLog(session.GetUserId(), "SmithyTaskAwardReq", atno)
})
return
}

View File

@ -70,5 +70,9 @@ func (this *apiComp) Sell(session comm.IUserSession, req *pb.SmithySellReq) (err
}
session.SendMsg(string(this.module.GetType()), "sell", rsp)
go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {
this.module.WriteUserLog(session.GetUserId(), "SmithySellReq", atno)
})
return
}

View File

@ -315,6 +315,9 @@ func (this *Smithy) GmSmithyAtlas(session comm.IUserSession) {
if equip, errdata := this.ModuleEquipment.QueryEquipment(session.GetUserId(), ids...); errdata == nil {
this.modelAtlas.CheckActivateEquipAtlas(session.GetUserId(), equip, 1)
}
go this.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {
this.WriteUserLog(session.GetUserId(), "GmSmithyAtlas", atno)
})
}
if len(szLibrary) > 0 {
@ -323,4 +326,5 @@ func (this *Smithy) GmSmithyAtlas(session comm.IUserSession) {
}
}
}

View File

@ -91,5 +91,9 @@ func (this *apiComp) Activityreceive(session comm.IUserSession, req *pb.SociatyA
SociatyId: sociaty.Id,
Reward: atno,
})
go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {
this.module.WriteUserLog(session.GetUserId(), "SociatyActivityReceiveReq", atno)
})
return
}

View File

@ -121,5 +121,9 @@ func (this *apiComp) Receive(session comm.IUserSession, req *pb.SociatyReceiveRe
}
session.SendMsg(string(this.module.GetType()), SociatySubTypeReceive, rsp)
go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {
this.module.WriteUserLog(session.GetUserId(), "SociatyReceiveReq", atno)
})
return
}

View File

@ -108,5 +108,8 @@ func (this *apiComp) Sign(session comm.IUserSession, req *pb.SociatySignReq) (er
}
session.SendMsg(string(this.module.GetType()), SociatySubTypeSign, rsp)
go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {
this.module.WriteUserLog(session.GetUserId(), "SociatySignReq", atno)
})
return
}

View File

@ -628,10 +628,15 @@ func (this *apiComp) Event(session comm.IUserSession, req *pb.StonehengeEventReq
}
}
}
if len(tasks) > 0 {
go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {
go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {
if len(tasks) > 0 {
this.module.ModuleBuried.TriggerBuried(session, tasks...)
})
}
}
if len(reward) > 0 {
this.module.WriteUserLog(session.GetUserId(), "StonehengeEventReq", reward)
}
})
return
}

View File

@ -109,5 +109,9 @@ func (this *apiComp) Finish(session comm.IUserSession, req *pb.StonehengeFinishR
Curintegral: curintegral,
Reward: atno,
})
go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {
this.module.WriteUserLog(session.GetUserId(), "StonehengeFinishReq", atno)
})
return
}

View File

@ -81,5 +81,9 @@ func (this *apiComp) Draw(session comm.IUserSession, req *pb.TurntableDrawReq) (
Atno: atno,
Drawkey: drawkey,
})
go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {
this.module.WriteUserLog(session.GetUserId(), "TurntableDrawReq", atno)
})
return
}

View File

@ -56,5 +56,8 @@ func (this *apiComp) LatticeFinish(session comm.IUserSession, req *pb.UiGameLatt
Data: list,
Atno: atno,
})
go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {
this.module.WriteUserLog(session.GetUserId(), "UiGameLatticeFinishReq", atno)
})
return
}

View File

@ -138,5 +138,8 @@ func (this *apiComp) LatticeGrid(session comm.IUserSession, req *pb.UiGameLattic
Data: list,
Atno: atno,
})
go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {
this.module.WriteUserLog(session.GetUserId(), "UiGameLatticeGridReq", atno)
})
return
}

View File

@ -64,5 +64,8 @@ func (this *apiComp) LatticeReward(session comm.IUserSession, req *pb.UiGameLatt
Data: list,
Atno: atno,
})
go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {
this.module.WriteUserLog(session.GetUserId(), "UiGameLatticeRewardReq", atno)
})
return
}

View File

@ -56,5 +56,8 @@ func (this *apiComp) MinerFinish(session comm.IUserSession, req *pb.UiGameMinerF
Data: list,
Atno: atno,
})
go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {
this.module.WriteUserLog(session.GetUserId(), "UiGameMinerFinishReq", atno)
})
return
}

View File

@ -60,5 +60,8 @@ func (this *apiComp) MinerKey(session comm.IUserSession, req *pb.UiGameMinerKeyR
Data: list,
Atno: atno,
})
go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {
this.module.WriteUserLog(session.GetUserId(), "UiGameMinerKeyReq", atno)
})
return
}

View File

@ -65,5 +65,9 @@ func (this *apiComp) PuzzleGrid(session comm.IUserSession, req *pb.UiGamePuzzleG
Data: list,
Atno: atno,
})
go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {
this.module.WriteUserLog(session.GetUserId(), "UiGamePuzzleGridReq", atno)
})
return
}

View File

@ -48,5 +48,9 @@ func (this *apiComp) PuzzleReward(session comm.IUserSession, req *pb.UiGamePuzzl
Data: list,
Atno: atno,
})
go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {
this.module.WriteUserLog(session.GetUserId(), "UiGamePuzzleRewardReq", atno)
})
return
}

View File

@ -80,5 +80,8 @@ func (this *apiComp) LvReward(session comm.IUserSession, req *pb.VentureLvReward
Data: ventureLv,
Atno: atno,
})
go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {
this.module.WriteUserLog(session.GetUserId(), "VentureLvRewardReq", atno)
})
return
}

View File

@ -70,5 +70,8 @@ func (this *apiComp) SignReward(session comm.IUserSession, req *pb.VentureSignRe
Sign: sign,
Atno: atno,
})
go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {
this.module.WriteUserLog(session.GetUserId(), "VentureSignRewardReq", atno)
})
return
}

View File

@ -251,6 +251,7 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.VikingChal
if len(tasks) > 0 {
go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {
this.module.ModuleBuried.TriggerBuried(session, tasks...)
this.module.WriteUserLog(session.GetUserId(), "VikingChallengeOverReq", szAtno)
})
}
return

View File

@ -35,5 +35,8 @@ func (this *apiComp) Award(session comm.IUserSession, req *pb.WhackamoleAwardReq
}
session.SendMsg(string(this.module.GetType()), "award", &pb.WhackamoleAwardResp{Id: req.Id, Award: award})
go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {
this.module.WriteUserLog(session.GetUserId(), "WhackamoleAwardReq", award)
})
return
}

View File

@ -102,6 +102,7 @@ func (this *apiComp) BattleFinish(session comm.IUserSession, req *pb.WTaskBattle
if len(tasks) > 0 {
go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {
this.module.ModuleBuried.TriggerBuried(session, tasks...)
this.module.WriteUserLog(session.GetUserId(), "WTaskBattleFinishReq", atno)
})
}
return

View File

@ -117,6 +117,7 @@ func (this *apiComp) BoxReceive(session comm.IUserSession, req *pb.WTaskBoxRecei
if len(tasks) > 0 {
go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {
this.module.ModuleBuried.TriggerBuried(session, tasks...)
this.module.WriteUserLog(session.GetUserId(), "WTaskBoxReceiveReq", award)
})
}
return

View File

@ -71,5 +71,8 @@ func (this *apiComp) ChapterReward(session comm.IUserSession, req *pb.WTaskChapt
// })
// }
session.SendMsg(string(this.module.GetType()), "chapterreward", &pb.WTaskChapterRewardResp{Group: req.Group, Award: award})
go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {
this.module.WriteUserLog(session.GetUserId(), "WTaskChapterRewardReq", award)
})
return
}

View File

@ -94,6 +94,7 @@ func (this *apiComp) EventComplete(session comm.IUserSession, req *pb.WTaskEvent
go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {
this.module.ModuleBuried.TriggerBuried(session, tasks...)
this.module.WriteUserLog(session.GetUserId(), "WTaskEventCompleteReq", award)
})
return
}

View File

@ -85,5 +85,9 @@ func (this *apiComp) Exchange(session comm.IUserSession, req *pb.WTaskExchangeRe
return
}
session.SendMsg(string(this.module.GetType()), "exchange", &pb.WTaskExchangeResp{Eid: req.Eid, Award: award})
go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {
this.module.WriteUserLog(session.GetUserId(), "WTaskExchangeReq", award)
})
return
}

View File

@ -152,6 +152,7 @@ func (this *apiComp) Finish(session comm.IUserSession, req *pb.WTaskFinishReq) (
}
go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {
this.module.ModuleSys.CheckOpenCond(session.Clone(), comm.OpencondTypeWorldtaskid, req.Tid)
this.module.WriteUserLog(session.GetUserId(), "WTaskFinishReq", award)
})
return
}