protected void HandleAllowUserLogin(object stateInfo) { try { GSPacketIn packet = (GSPacketIn)stateInfo; int playerid = packet.ReadInt(); if (packet.ReadBoolean()) { GamePlayer player = LoginMgr.LoginClient(playerid); if (player != null) { if (player.Login()) { this.SendUserOnline(playerid, player.PlayerCharacter.ConsortiaID); WorldMgr.OnPlayerOnline(playerid, player.PlayerCharacter.ConsortiaID, player.AreaID, true); } else { player.Client.Disconnect(); this.SendUserOffline(playerid, 0); } } else { this.SendUserOffline(playerid, 0); } } } catch (Exception e) { GameServer.log.Error("HandleAllowUserLogin", e); } }
public int HandlePacket(GameClient client, GSPacketIn packet) { bool result = packet.ReadBoolean(); if (client.Player.CurrentGame != null && client.Player.CurrentGame.GameState == eGameState.LOAD && client.Player.CurrentGame.GameMode == eGameMode.FLAG) { packet.ClientID = (client.Player.PlayerCharacter.ID); if (result) { if (!client.Player.CurrentGame.Data.FlagPlayer.Contains(client.Player)) { client.Player.CurrentGame.Data.FlagPlayer.Add(client.Player); } } else { if (client.Player.CurrentGame.Data.FlagPlayer.Contains(client.Player)) { client.Player.CurrentGame.Data.FlagPlayer.Remove(client.Player); } } client.Player.CurrentGame.SendToAll(packet); } return(0); }
private void HandlePlayerMessage(GSPacketIn pkg) { BaseGame baseGame = GameMgr.FindGame(pkg.ClientID); if (baseGame != null) { Player player = baseGame.FindPlayer(pkg.ReadInt()); bool flag = pkg.ReadBoolean(); string str = pkg.ReadString(); if (player != null) { GSPacketIn gSPacketIn = new GSPacketIn(19); gSPacketIn.ClientID = player.PlayerDetail.PlayerCharacter.ID; gSPacketIn.WriteByte(5); gSPacketIn.WriteBoolean(false); gSPacketIn.WriteString(player.PlayerDetail.PlayerCharacter.NickName); gSPacketIn.WriteString(str); if (flag) { baseGame.SendToTeam(pkg, player.Team); return; } baseGame.SendToAll(gSPacketIn); } } }
public int HandlePacket(GameClient client, GSPacketIn packet) { if (client.Player.CurrentMarryRoom != null && client.Player.PlayerCharacter.ID == client.Player.CurrentMarryRoom.Info.PlayerID) { string name = packet.ReadString(); bool flag = packet.ReadBoolean(); string pwd = packet.ReadString(); string roomIntroduction = packet.ReadString(); MarryRoom currentMarryRoom = client.Player.CurrentMarryRoom; currentMarryRoom.Info.RoomIntroduction = roomIntroduction; currentMarryRoom.Info.Name = name; if (flag) { currentMarryRoom.Info.Pwd = pwd; } using (PlayerBussiness playerBussiness = new PlayerBussiness()) { playerBussiness.UpdateMarryRoomInfo(currentMarryRoom.Info); } currentMarryRoom.SendMarryRoomInfoUpdateToScenePlayers(currentMarryRoom); client.Player.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("MarryRoomInfoUpdateHandler.Successed", new object[0])); return(0); } return(1); }
public void HandleCommand(BaseGame game, Player player, GSPacketIn packet) { if (game is PVEGame) { PVEGame pVEGame = game as PVEGame; int num = packet.ReadInt(); bool flag = packet.ReadBoolean(); if (flag) { if (num == 1) { if (player.PlayerDetail.RemoveMoney(100) > 0) { pVEGame.WantTryAgain = 1; game.SendToAll(packet); player.PlayerDetail.LogAddMoney(AddMoneyType.Game, AddMoneyType.Game_TryAgain, player.PlayerDetail.PlayerCharacter.ID, 100, player.PlayerDetail.PlayerCharacter.Money); } else { player.PlayerDetail.SendInsufficientMoney(2); } } else { pVEGame.WantTryAgain = 0; game.SendToAll(packet); } pVEGame.CheckState(0); } } }
public int HandlePacket(GameClient client, GSPacketIn packet) { if (client.Player.PlayerCharacter.ConsortiaID == 0) { return(0); } int banUserID = packet.ReadInt(); bool isBanChat = packet.ReadBoolean(); int userID = 0; string userName = ""; bool result = false; string msg = "ConsortiaIsBanChatHandler.Failed"; using (ConsortiaBussiness db = new ConsortiaBussiness()) { if (db.UpdateConsortiaIsBanChat(banUserID, client.Player.PlayerCharacter.ConsortiaID, client.Player.PlayerCharacter.ID, isBanChat, ref userID, ref userName, ref msg)) { msg = "ConsortiaIsBanChatHandler.Success"; result = true; GameServer.Instance.LoginServer.SendConsortiaBanChat(userID, userName, client.Player.PlayerCharacter.ID, client.Player.PlayerCharacter.NickName, isBanChat); } } packet.WriteBoolean(result); packet.WriteString(LanguageMgr.GetTranslation(msg)); client.Out.SendTCP(packet); return(0); }
protected void HandleAllowUserLogin(object stateInfo) { try { GSPacketIn gSPacketIn = (GSPacketIn)stateInfo; int num = gSPacketIn.ReadInt(); if (gSPacketIn.ReadBoolean()) { GamePlayer gamePlayer = LoginMgr.LoginClient(num); if (gamePlayer != null) { if (gamePlayer.Login()) { this.SendUserOnline(num, gamePlayer.PlayerCharacter.ConsortiaID); WorldMgr.OnPlayerOnline(num, gamePlayer.PlayerCharacter.ConsortiaID); } else { gamePlayer.Client.Disconnect(); this.SendUserOffline(num, 0); } } else { this.SendUserOffline(num, 0); } } } catch (Exception exception) { GameServer.log.Error("HandleAllowUserLogin", exception); } }
private void HandlePlayerMessage(GSPacketIn pkg) { BaseGame game = GameMgr.FindGame(pkg.ClientID); if (game != null) { Player player = game.FindPlayer(pkg.ReadInt()); bool team = pkg.ReadBoolean(); string msg = pkg.ReadString(); if (player != null) { GSPacketIn pkg1 = new GSPacketIn((byte)eFightPackageType.CHAT); pkg1.ClientID = player.PlayerDetail.PlayerCharacter.ID; pkg1.WriteByte(5); pkg1.WriteBoolean(false); pkg1.WriteString(player.PlayerDetail.PlayerCharacter.NickName); pkg1.WriteString(msg); if (team) { game.SendToTeam(pkg, player.Team); } else { game.SendToAll(pkg1); } } } }
public void HandleCommand(BaseGame game, Player player, GSPacketIn packet) { if (game is PVEGame) { PVEGame pve = game as PVEGame; int tryAgain = packet.ReadInt(); bool isHost = packet.ReadBoolean(); if (isHost == true) { if (tryAgain == 1) { if (player.PlayerDetail.RemoveMoney(100) > 0) { //退回关卡结算 pve.WantTryAgain = 1; game.SendToAll(packet); player.PlayerDetail.LogAddMoney(AddMoneyType.Game, AddMoneyType.Game_TryAgain, player.PlayerDetail.PlayerCharacter.ID, 100, player.PlayerDetail.PlayerCharacter.Money); } else { player.PlayerDetail.SendInsufficientMoney((int)eBattleRemoveMoneyType.TryAgain); } } else { //退回房间 pve.WantTryAgain = 0; game.SendToAll(packet); } pve.CheckState(0); } } }
public int HandlePacket(GameClient client, GSPacketIn packet) { packet.ReadBoolean(); string str = packet.ReadString(); int num = 200; if (client.Player.PlayerCharacter.Money >= num) { client.Player.RemoveMoney(num); GSPacketIn gSPacketIn = new GSPacketIn(123); gSPacketIn.WriteString(str); GameServer.Instance.LoginServer.SendPacket(gSPacketIn); client.Player.LastChatTime = DateTime.Now; GamePlayer[] allPlayers = WorldMgr.GetAllPlayers(); for (int i = 0; i < allPlayers.Length; i++) { GamePlayer gamePlayer = allPlayers[i]; gSPacketIn.ClientID = gamePlayer.PlayerCharacter.ID; gamePlayer.Out.SendTCP(gSPacketIn); } } else { client.Out.SendMessage(eMessageType.ChatERROR, LanguageMgr.GetTranslation("Xu không đủ!", new object[0])); } return(0); }
public void HandleCommand(BaseGame game, Player player, GSPacketIn packet) { if (player.IsAttacking) { GSPacketIn pkg = packet.Clone(); pkg.ClientID = player.PlayerDetail.PlayerCharacter.ID; pkg.Parameter1 = player.Id; game.SendToAll(pkg, player.PlayerDetail); byte type = packet.ReadByte(); int tx = packet.ReadInt(); int ty = packet.ReadInt(); byte dir = packet.ReadByte(); bool isLiving = packet.ReadBoolean(); switch (type) { case 0: case 1: player.SetXY(tx, ty); player.StartFalling(true); if (player.Y - ty > 1 || player.IsLiving != isLiving) { game.SendPlayerMove(player, 3, player.X, player.Y, 0, player.IsLiving, null); } break; } } }
public int HandlePacket(GameClient client, GSPacketIn packet) { if (client.Player.PlayerCharacter.MarryInfoID == 0) { return(1); } bool isPublishEquip = packet.ReadBoolean(); string introduction = packet.ReadString(); int marryInfoID = client.Player.PlayerCharacter.MarryInfoID; string translateId = "MarryInfoUpdateHandler.Fail"; using (PlayerBussiness playerBussiness = new PlayerBussiness()) { MarryInfo marryInfoSingle = playerBussiness.GetMarryInfoSingle(marryInfoID); if (marryInfoSingle == null) { translateId = "MarryInfoUpdateHandler.Msg1"; } else { marryInfoSingle.IsPublishEquip = isPublishEquip; marryInfoSingle.Introduction = introduction; marryInfoSingle.RegistTime = DateTime.Now; if (playerBussiness.UpdateMarryInfo(marryInfoSingle)) { translateId = "MarryInfoUpdateHandler.Succeed"; } } client.Out.SendMarryInfoRefresh(marryInfoSingle, marryInfoID, marryInfoSingle != null); client.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation(translateId, new object[0])); } return(0); }
public override int HandlePacket(GamePlayer player, GSPacketIn packet) { int result2; if (player.PlayerCharacter.ConsortiaID == 0) { result2 = 1; } else { bool state = packet.ReadBoolean(); bool result = false; string msg = "CONSORTIA_APPLY_STATE.Failed"; using (ConsortiaBussiness db = new ConsortiaBussiness()) { if (db.UpdateConsotiaApplyState(player.PlayerCharacter.ConsortiaID, player.PlayerCharacter.ID, state, ref msg)) { msg = "CONSORTIA_APPLY_STATE.Success"; result = true; } } packet.WriteBoolean(result); packet.WriteString(LanguageMgr.GetTranslation(msg, new object[0])); player.Out.SendTCP(packet); result2 = 0; } return(result2); }
private void HandlePlayerMessage(GSPacketIn pkg) { BaseGame game = GameMgr.FindGame(pkg.ClientID); if (game != null) { Player player = game.FindPlayer(pkg.ReadInt()); bool team = pkg.ReadBoolean(); byte channl = pkg.ReadByte(); string msg = pkg.ReadString(); if (player != null) { GSPacketIn pkg2 = new GSPacketIn(19); pkg2.ClientID = player.PlayerDetail.PlayerCharacter.ID; pkg2.WriteInt(player.PlayerDetail.AreaID); pkg2.WriteByte(channl); pkg2.WriteBoolean(team); pkg2.WriteString(player.PlayerDetail.PlayerCharacter.NickName); pkg2.WriteString(msg); if (team) { game.SendToTeam(pkg2, player.Team, player.PlayerDetail); } else { game.SendToAll(pkg2); } } } }
public void HandleReload(GSPacketIn pkg) { eReloadType eReloadType = (eReloadType)pkg.ReadInt(); int num = pkg.ReadInt(); bool flag = pkg.ReadBoolean(); Console.WriteLine((string)(object)num + (object)" " + ((object)eReloadType).ToString() + " is reload " + (string)(flag ? (object)"succeed!" : (object)"fail")); }
public void HandleReload(GSPacketIn pkg) { eReloadType type = (eReloadType)pkg.ReadInt(); int serverID = pkg.ReadInt(); bool result = pkg.ReadBoolean(); Console.WriteLine(serverID + " " + type.ToString() + " is reload " + (result ? "succeed!" : "fail")); }
public int HandlePacket(GameClient client, GSPacketIn packet) { if (client.Player.CurrentRoom != null && client.Player == client.Player.CurrentRoom.Host) { RoomMgr.UpdateRoomPos(client.Player.CurrentRoom, packet.ReadByte(), packet.ReadBoolean()); } return(0); }
public override int HandlePacket(GamePlayer player, GSPacketIn packet) { if (player.CurrentRoom != null && player == player.CurrentRoom.Host) { RoomMgr.UpdateRoomPos(player.CurrentRoom, (int)packet.ReadByte(), packet.ReadBoolean()); } return(0); }
//修改: Xiaov //时间: 2009-11-7 //描述: 用户与用户之间私聊<已测试> public int HandlePacket(GameClient client, GSPacketIn packet) { int receiverID = packet.ReadInt(); //int senderID = packet.ReadInt(); string receiver = packet.ReadString(); string sender = packet.ReadString(); string msg = packet.ReadString(); bool isAutoReply = packet.ReadBoolean(); if (receiverID == 0) { using (PlayerBussiness db = new PlayerBussiness()) { PlayerInfo info = db.GetUserSingleByNickName(receiver); if (info != null) { receiverID = info.ID; } } } if (receiverID != 0) { GSPacketIn pkg = packet.Clone(); pkg.ClearContext(); pkg.WriteInt(receiverID); pkg.ClientID = (client.Player.PlayerCharacter.ID); //pkg.WriteInt(senderID); pkg.WriteString(receiver); pkg.WriteString(sender); pkg.WriteString(msg); pkg.WriteBoolean(false); GamePlayer player = Managers.WorldMgr.GetPlayerById(receiverID); if (player != null) { if (player.IsBlackFriend(client.Player.PlayerCharacter.ID)) { return(1); } player.Out.SendTCP(pkg); } else { GameServer.Instance.LoginServer.SendPacket(pkg); } client.Out.SendTCP(pkg); } else { client.Out.SendMessage(eMessageType.ERROR, LanguageMgr.GetTranslation("UserPrivateChatHandler.NoUser")); } return(1); }
public int HandlePacket(GameClient client, GSPacketIn packet) { bool flag = packet.ReadBoolean(); if (!client.Player.PlayerCharacter.IsMarried) { return(1); } if (client.Player.PlayerCharacter.HasBagPassword && client.Player.PlayerCharacter.IsLocked) { client.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("Bag.Locked", new object[0])); return(0); } if (client.Player.PlayerCharacter.IsCreatedMarryRoom) { client.Player.Out.SendMessage(eMessageType.ChatNormal, LanguageMgr.GetTranslation("DivorceApplyHandler.Msg2", new object[0])); return(1); } int num = GameProperties.PRICE_DIVORCED; if (flag) { num = GameProperties.PRICE_DIVORCED_DISCOUNT; } if (client.Player.PlayerCharacter.Money < num) { client.Player.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("DivorceApplyHandler.Msg1", new object[0])); return(1); } client.Player.RemoveMoney(num); LogMgr.LogMoneyAdd(LogMoneyType.Marry, LogMoneyType.Marry_Unmarry, client.Player.PlayerCharacter.ID, num, client.Player.PlayerCharacter.Money, 0, 0, 0, 0, "", "", ""); CountBussiness.InsertSystemPayCount(client.Player.PlayerCharacter.ID, num, 0, 0, 3); using (PlayerBussiness playerBussiness = new PlayerBussiness()) { PlayerInfo userSingleByUserID = playerBussiness.GetUserSingleByUserID(client.Player.PlayerCharacter.SpouseID); if (userSingleByUserID == null || userSingleByUserID.Sex == client.Player.PlayerCharacter.Sex) { return(1); } MarryApplyInfo marryApplyInfo = new MarryApplyInfo(); marryApplyInfo.UserID = client.Player.PlayerCharacter.SpouseID; marryApplyInfo.ApplyUserID = client.Player.PlayerCharacter.ID; marryApplyInfo.ApplyUserName = client.Player.PlayerCharacter.NickName; marryApplyInfo.ApplyType = 3; marryApplyInfo.LoveProclamation = ""; marryApplyInfo.ApplyResult = false; int num2 = 0; if (playerBussiness.SavePlayerMarryNotice(marryApplyInfo, 0, ref num2)) { GameServer.Instance.LoginServer.SendUpdatePlayerMarriedStates(userSingleByUserID.ID); client.Player.LoadMarryProp(); } } client.Player.QuestInventory.ClearMarryQuest(); client.Player.Out.SendPlayerDivorceApply(client.Player, true, true); client.Player.SendMessage(LanguageMgr.GetTranslation("DivorceApplyHandler.Msg3", new object[0])); return(0); }
private void HandlePlayerOnGameOver(GSPacketIn pkg) { GamePlayer player = WorldMgr.GetPlayerById(pkg.ClientID); if (player != null && player.CurrentRoom != null && player.CurrentRoom.Game != null) { player.OnGameOver(player.CurrentRoom.Game, pkg.ReadBoolean(), pkg.ReadInt(), pkg.ReadBoolean(), pkg.ReadBoolean()); } }
public override int HandlePacket(GamePlayer player, GSPacketIn packet) { packet.ClientID = player.PlayerCharacter.ID; bool state = packet.ReadBoolean(); GameServer.Instance.LoginServer.SendPacket(packet); WorldMgr.ChangePlayerState(packet.ClientID, state, player.PlayerCharacter.ConsortiaID); return(0); }
public void HandleCommand(BaseGame game, Player player, GSPacketIn packet) { if (game is PVEGame && game.GameState != eGameState.Playing) { PVEGame pveGame = game as PVEGame; pveGame.IsPassDrama = packet.ReadBoolean(); pveGame.CheckState(0); } }
private void HandlePlayerOnMissionOver(GSPacketIn pkg) { GamePlayer player = WorldMgr.GetPlayerById(pkg.ClientID); AbstractGame game = player.CurrentRoom.Game; if (player != null) { player.OnMissionOver(game, pkg.ReadBoolean(), pkg.ReadInt(), pkg.ReadInt()); } }
private void HandlePlayerOnKillingLiving(GSPacketIn pkg) { GamePlayer playerById = WorldMgr.GetPlayerById(pkg.ClientID); AbstractGame game = playerById.CurrentRoom.Game; if (playerById != null) { playerById.OnKillingLiving(game, pkg.ReadInt(), pkg.ClientID, pkg.ReadBoolean(), pkg.ReadInt()); } }
public int HandlePacket(GameClient client, GSPacketIn packet) { bool flag = packet.ReadBoolean(); BaseRoom currentRoom = client.Player.CurrentRoom; if (flag && currentRoom != null) { RoomMgr.StartGameMission(currentRoom); } return(0); }
private void HandlePlayerAddTemplate1(GSPacketIn pkg) { GamePlayer playerById = WorldMgr.GetPlayerById(pkg.ClientID); if (playerById != null) { ItemTemplateInfo itemTemplateInfo = ItemMgr.FindItemTemplate(pkg.ReadInt()); eBageType bagType = (eBageType)pkg.ReadByte(); if (itemTemplateInfo != null) { int count = pkg.ReadInt(); ItemInfo itemInfo = ItemInfo.CreateFromTemplate(itemTemplateInfo, count, 118); itemInfo.Count = count; itemInfo.ValidDate = pkg.ReadInt(); itemInfo.IsBinds = pkg.ReadBoolean(); itemInfo.IsUsed = pkg.ReadBoolean(); playerById.AddTemplate(itemInfo, bagType, itemInfo.Count); } } }
public void HandleASSState(GSPacketIn packet) { bool state = packet.ReadBoolean(); AntiAddictionMgr.SetASSState(state); GamePlayer[] players = WorldMgr.GetAllPlayers(); foreach (GamePlayer p in players) { p.Out.SendAASControl(state, p.IsAASInfo, p.IsMinor); } }
public int HandlePacket(GameClient client, GSPacketIn packet) { bool result = packet.ReadBoolean(); int UserID = packet.ReadInt(); int AnswerId = packet.ReadInt(); //答复对话框ID //先判断自已有没有结婚 if (result && client.Player.PlayerCharacter.IsMarried) { client.Player.Out.SendMessage(eMessageType.ChatERROR, LanguageMgr.GetTranslation("MarryApplyReplyHandler.Msg2")); } using (PlayerBussiness db = new PlayerBussiness()) { PlayerInfo tempSpouse = db.GetUserSingleByUserID(UserID); //发送好人卡 if (!result) { SendGoodManCard(tempSpouse.NickName, tempSpouse.ID, client.Player.PlayerCharacter.NickName, client.Player.PlayerCharacter.ID, db); GameServer.Instance.LoginServer.SendUpdatePlayerMarriedStates(tempSpouse.ID); } //判断对方有没有结婚 if (tempSpouse == null || tempSpouse.Sex == client.Player.PlayerCharacter.Sex) { return(1); } if (tempSpouse.IsMarried) { client.Player.Out.SendMessage(eMessageType.ChatNormal, LanguageMgr.GetTranslation("MarryApplyReplyHandler.Msg3")); } MarryApplyInfo info = new MarryApplyInfo(); info.UserID = UserID; info.ApplyUserID = client.Player.PlayerCharacter.ID; info.ApplyUserName = client.Player.PlayerCharacter.NickName; info.ApplyType = 2; info.LoveProclamation = ""; info.ApplyResult = result; int id = 0; if (db.SavePlayerMarryNotice(info, AnswerId, ref id)) { if (result) { client.Player.Out.SendMarryApplyReply(client.Player, tempSpouse.ID, tempSpouse.NickName, result, false, id); client.Player.LoadMarryProp(); SendSYSMessages(client.Player, tempSpouse); } GameServer.Instance.LoginServer.SendUpdatePlayerMarriedStates(tempSpouse.ID); return(0); } } return(1); }
private void HandlePlayerAddTemplate1(GSPacketIn pkg) { GamePlayer player = WorldMgr.GetPlayerById(pkg.ClientID); if (player != null) { ItemTemplateInfo template = ItemMgr.FindItemTemplate(pkg.ReadInt()); eBageType type = (eBageType)pkg.ReadByte(); if (template != null) { int Count = pkg.ReadInt(); ItemInfo item = ItemInfo.CreateFromTemplate(template, Count, (int)ItemAddType.FightGet); item.Count = Count; item.ValidDate = pkg.ReadInt(); item.IsBinds = pkg.ReadBoolean(); item.IsUsed = pkg.ReadBoolean(); player.AddTemplate(item, type, item.Count); } } }