怪物死亡和世界宝箱随机掉落

This commit is contained in:
flswld
2023-03-29 14:59:53 +08:00
parent 13ee58cac9
commit ecec5a67ed
41 changed files with 875 additions and 709 deletions

View File

@@ -11,7 +11,7 @@ import (
pb "google.golang.org/protobuf/proto"
)
func (g *GameManager) GCGLogin(player *model.Player) {
func (g *Game) GCGLogin(player *model.Player) {
// player.SceneId = 1076
// player.Pos.X = 8.974
// player.Pos.Y = 0
@@ -33,7 +33,7 @@ func (g *GameManager) GCGLogin(player *model.Player) {
}
// GCGTavernInit GCG酒馆初始化
func (g *GameManager) GCGTavernInit(player *model.Player) {
func (g *Game) GCGTavernInit(player *model.Player) {
// if player.SceneId == 1076 {
// // GCG酒馆信息通知
// g.SendMsg(cmd.GCGTCTavernInfoNotify, player.PlayerID, player.ClientSeq, g.PacketGCGTCTavernInfoNotify(player))
@@ -43,7 +43,7 @@ func (g *GameManager) GCGTavernInit(player *model.Player) {
}
// GCGStartChallenge GCG开始挑战
func (g *GameManager) GCGStartChallenge(player *model.Player) {
func (g *Game) GCGStartChallenge(player *model.Player) {
// GCG开始游戏通知
// gcgStartChallengeByCheckRewardRsp := &proto.GCGStartChallengeByCheckRewardRsp{
// ExceededItemTypeList: make([]uint32, 0, 0),
@@ -59,7 +59,7 @@ func (g *GameManager) GCGStartChallenge(player *model.Player) {
game := GCG_MANAGER.CreateGame(30101, []*model.Player{player})
// GCG游戏简要信息通知
GAME_MANAGER.SendMsg(cmd.GCGGameBriefDataNotify, player.PlayerID, player.ClientSeq,
GAME.SendMsg(cmd.GCGGameBriefDataNotify, player.PlayerID, player.ClientSeq,
g.PacketGCGGameBriefDataNotify(player, proto.GCGGameBusinessType_GCG_GAME_GUIDE_GROUP, game))
// 玩家进入GCG界面
@@ -67,7 +67,7 @@ func (g *GameManager) GCGStartChallenge(player *model.Player) {
}
// GCGAskDuelReq GCG决斗请求
func (g *GameManager) GCGAskDuelReq(player *model.Player, payloadMsg pb.Message) {
func (g *Game) GCGAskDuelReq(player *model.Player, payloadMsg pb.Message) {
// 获取玩家所在的游戏
game, ok := GCG_MANAGER.gameMap[player.GCGCurGameGuid]
if !ok {
@@ -258,11 +258,11 @@ func (g *GameManager) GCGAskDuelReq(player *model.Player, payloadMsg pb.Message)
// })
// }
GAME_MANAGER.SendMsg(cmd.GCGAskDuelRsp, player.PlayerID, player.ClientSeq, gcgAskDuelRsp)
GAME.SendMsg(cmd.GCGAskDuelRsp, player.PlayerID, player.ClientSeq, gcgAskDuelRsp)
}
// GCGInitFinishReq GCG初始化完成请求
func (g *GameManager) GCGInitFinishReq(player *model.Player, payloadMsg pb.Message) {
func (g *Game) GCGInitFinishReq(player *model.Player, payloadMsg pb.Message) {
// 获取玩家所在的游戏
game, ok := GCG_MANAGER.gameMap[player.GCGCurGameGuid]
if !ok {
@@ -279,14 +279,14 @@ func (g *GameManager) GCGInitFinishReq(player *model.Player, payloadMsg pb.Messa
// 更改操控者加载状态
gameController.loadState = ControllerLoadState_InitFinish
GAME_MANAGER.SendMsg(cmd.GCGInitFinishRsp, player.PlayerID, player.ClientSeq, &proto.GCGInitFinishRsp{})
GAME.SendMsg(cmd.GCGInitFinishRsp, player.PlayerID, player.ClientSeq, &proto.GCGInitFinishRsp{})
// 检查所有玩家是否已加载完毕
game.CheckAllInitFinish()
}
// GCGOperationReq GCG游戏客户端操作请求
func (g *GameManager) GCGOperationReq(player *model.Player, payloadMsg pb.Message) {
func (g *Game) GCGOperationReq(player *model.Player, payloadMsg pb.Message) {
req := payloadMsg.(*proto.GCGOperationReq)
// 获取玩家所在的游戏
@@ -309,7 +309,7 @@ func (g *GameManager) GCGOperationReq(player *model.Player, payloadMsg pb.Messag
// 操作者是否拥有该卡牌
cardInfo := gameController.GetCharCardByGuid(op.CardGuid)
if cardInfo == nil {
GAME_MANAGER.SendError(cmd.GCGOperationRsp, player, &proto.GCGOperationRsp{}, proto.Retcode_RET_GCG_SELECT_HAND_CARD_GUID_ERROR)
GAME.SendError(cmd.GCGOperationRsp, player, &proto.GCGOperationRsp{}, proto.Retcode_RET_GCG_SELECT_HAND_CARD_GUID_ERROR)
return
}
// 操控者选择角色牌
@@ -356,11 +356,11 @@ func (g *GameManager) GCGOperationReq(player *model.Player, payloadMsg pb.Messag
gcgOperationRsp := &proto.GCGOperationRsp{
OpSeq: req.OpSeq,
}
GAME_MANAGER.SendMsg(cmd.GCGOperationRsp, player.PlayerID, player.ClientSeq, gcgOperationRsp)
GAME.SendMsg(cmd.GCGOperationRsp, player.PlayerID, player.ClientSeq, gcgOperationRsp)
}
// PacketGCGSkillPreviewNotify GCG游戏技能预览通知
func (g *GameManager) PacketGCGSkillPreviewNotify(game *GCGGame, controller *GCGController) *proto.GCGSkillPreviewNotify {
func (g *Game) PacketGCGSkillPreviewNotify(game *GCGGame, controller *GCGController) *proto.GCGSkillPreviewNotify {
selectedCharCard := controller.GetSelectedCharCard()
// 确保玩家选择了角色牌
if selectedCharCard == nil {
@@ -449,7 +449,7 @@ func (g *GameManager) PacketGCGSkillPreviewNotify(game *GCGGame, controller *GCG
}
// SendGCGMessagePackNotify 发送GCG游戏消息包通知
func (g *GameManager) SendGCGMessagePackNotify(controller *GCGController, serverSeq uint32, msgPackList []*proto.GCGMessagePack) {
func (g *Game) SendGCGMessagePackNotify(controller *GCGController, serverSeq uint32, msgPackList []*proto.GCGMessagePack) {
// 确保加载完成
if controller.loadState != ControllerLoadState_InitFinish {
return
@@ -462,7 +462,7 @@ func (g *GameManager) SendGCGMessagePackNotify(controller *GCGController, server
// 根据操控者的类型发送消息包
switch controller.controllerType {
case ControllerType_Player:
GAME_MANAGER.SendMsg(cmd.GCGMessagePackNotify, controller.player.PlayerID, controller.player.ClientSeq, gcgMessagePackNotify)
GAME.SendMsg(cmd.GCGMessagePackNotify, controller.player.PlayerID, controller.player.ClientSeq, gcgMessagePackNotify)
case ControllerType_AI:
controller.ai.ReceiveGCGMessagePackNotify(gcgMessagePackNotify)
default:
@@ -472,7 +472,7 @@ func (g *GameManager) SendGCGMessagePackNotify(controller *GCGController, server
}
// PacketGCGGameBriefDataNotify GCG游戏简要数据通知
func (g *GameManager) PacketGCGGameBriefDataNotify(player *model.Player, businessType proto.GCGGameBusinessType, game *GCGGame) *proto.GCGGameBriefDataNotify {
func (g *Game) PacketGCGGameBriefDataNotify(player *model.Player, businessType proto.GCGGameBusinessType, game *GCGGame) *proto.GCGGameBriefDataNotify {
gcgGameBriefDataNotify := &proto.GCGGameBriefDataNotify{
GcgBriefData: &proto.GCGGameBriefData{
BusinessType: businessType,
@@ -507,7 +507,7 @@ func (g *GameManager) PacketGCGGameBriefDataNotify(player *model.Player, busines
}
// PacketGCGTavernNpcInfoNotify GCG酒馆NPC信息通知
func (g *GameManager) PacketGCGTavernNpcInfoNotify(player *model.Player) *proto.GCGTavernNpcInfoNotify {
func (g *Game) PacketGCGTavernNpcInfoNotify(player *model.Player) *proto.GCGTavernNpcInfoNotify {
gcgTavernNpcInfoNotify := &proto.GCGTavernNpcInfoNotify{
WeekNpcList: make([]*proto.GCGTavernNpcInfo, 0, 0),
ConstNpcList: make([]*proto.GCGTavernNpcInfo, 0, 0),
@@ -521,7 +521,7 @@ func (g *GameManager) PacketGCGTavernNpcInfoNotify(player *model.Player) *proto.
}
// PacketGCGTCTavernInfoNotify GCG酒馆信息通知
func (g *GameManager) PacketGCGTCTavernInfoNotify(player *model.Player) *proto.GCGTCTavernInfoNotify {
func (g *Game) PacketGCGTCTavernInfoNotify(player *model.Player) *proto.GCGTCTavernInfoNotify {
gcgTCTavernInfoNotify := &proto.GCGTCTavernInfoNotify{
LevelId: 0,
IsLastDuelWin: false,
@@ -535,7 +535,7 @@ func (g *GameManager) PacketGCGTCTavernInfoNotify(player *model.Player) *proto.G
}
// PacketGCGTCTavernChallengeDataNotify GCG酒馆挑战数据
func (g *GameManager) PacketGCGTCTavernChallengeDataNotify(player *model.Player) *proto.GCGTCTavernChallengeDataNotify {
func (g *Game) PacketGCGTCTavernChallengeDataNotify(player *model.Player) *proto.GCGTCTavernChallengeDataNotify {
gcgTCTavernChallengeDataNotify := &proto.GCGTCTavernChallengeDataNotify{
TavernChallengeList: make([]*proto.GCGTCTavernChallengeData, 0, 0),
}
@@ -550,7 +550,7 @@ func (g *GameManager) PacketGCGTCTavernChallengeDataNotify(player *model.Player)
}
// PacketGCGBasicDataNotify GCG基础数据通知
func (g *GameManager) PacketGCGBasicDataNotify(player *model.Player) *proto.GCGBasicDataNotify {
func (g *Game) PacketGCGBasicDataNotify(player *model.Player) *proto.GCGBasicDataNotify {
gcgBasicDataNotify := &proto.GCGBasicDataNotify{
Level: player.GCGInfo.Level,
Exp: player.GCGInfo.Exp,
@@ -560,7 +560,7 @@ func (g *GameManager) PacketGCGBasicDataNotify(player *model.Player) *proto.GCGB
}
// PacketGCGLevelChallengeNotify GCG等级挑战通知
func (g *GameManager) PacketGCGLevelChallengeNotify(player *model.Player) *proto.GCGLevelChallengeNotify {
func (g *Game) PacketGCGLevelChallengeNotify(player *model.Player) *proto.GCGLevelChallengeNotify {
gcgLevelChallengeNotify := &proto.GCGLevelChallengeNotify{
UnlockBossChallengeList: make([]*proto.GCGBossChallengeData, 0, 0),
UnlockWorldChallengeList: player.GCGInfo.UnlockWorldChallengeList,
@@ -586,7 +586,7 @@ func (g *GameManager) PacketGCGLevelChallengeNotify(player *model.Player) *proto
}
// PacketGCGDSBanCardNotify GCG禁止的卡牌通知
func (g *GameManager) PacketGCGDSBanCardNotify(player *model.Player) *proto.GCGDSBanCardNotify {
func (g *Game) PacketGCGDSBanCardNotify(player *model.Player) *proto.GCGDSBanCardNotify {
gcgDSBanCardNotify := &proto.GCGDSBanCardNotify{
CardList: player.GCGInfo.BanCardList,
}
@@ -594,7 +594,7 @@ func (g *GameManager) PacketGCGDSBanCardNotify(player *model.Player) *proto.GCGD
}
// PacketGCGDSDataNotify GCG数据通知
func (g *GameManager) PacketGCGDSDataNotify(player *model.Player) *proto.GCGDSDataNotify {
func (g *Game) PacketGCGDSDataNotify(player *model.Player) *proto.GCGDSDataNotify {
gcgDSDataNotify := &proto.GCGDSDataNotify{
CurDeckId: player.GCGInfo.CurDeckId,
DeckList: make([]*proto.GCGDSDeckData, 0, len(player.GCGInfo.DeckList)),