public void UpdateRoom(GamePlayer player) { GamePlayer[] playersSafe = this.GetPlayersSafe(); GamePlayer[] array = playersSafe; for (int i = 0; i < array.Length; i++) { GamePlayer gamePlayer = array[i]; if (gamePlayer != player) { GSPacketIn gSPacketIn = new GSPacketIn(102); gSPacketIn.WriteByte(3); gSPacketIn.WriteInt(gamePlayer.PlayerCharacter.Grade); gSPacketIn.WriteInt(gamePlayer.PlayerCharacter.Hide); gSPacketIn.WriteInt(gamePlayer.PlayerCharacter.Repute); gSPacketIn.WriteInt(gamePlayer.PlayerCharacter.ID); gSPacketIn.WriteString(gamePlayer.PlayerCharacter.NickName); gSPacketIn.WriteByte(gamePlayer.PlayerCharacter.typeVIP); gSPacketIn.WriteInt(gamePlayer.PlayerCharacter.VIPLevel); gSPacketIn.WriteBoolean(gamePlayer.PlayerCharacter.Sex); gSPacketIn.WriteString(gamePlayer.PlayerCharacter.Style); gSPacketIn.WriteString(gamePlayer.PlayerCharacter.Colors); gSPacketIn.WriteString(gamePlayer.PlayerCharacter.Skin); gSPacketIn.WriteInt(gamePlayer.WorldBossX); gSPacketIn.WriteInt(gamePlayer.WorldBossY); gSPacketIn.WriteInt(gamePlayer.PlayerCharacter.FightPower); gSPacketIn.WriteInt(gamePlayer.PlayerCharacter.Win); gSPacketIn.WriteInt(gamePlayer.PlayerCharacter.Total); gSPacketIn.WriteInt(gamePlayer.PlayerCharacter.Offer); gSPacketIn.WriteByte(gamePlayer.WorldBossState); player.SendTCP(gSPacketIn); } } }
public int HandlePacket(GameClient client, GSPacketIn packet) { GSPacketIn gSPacketIn = new GSPacketIn(69, client.Player.PlayerCharacter.ID); byte b = packet.ReadByte(); byte b2 = packet.ReadByte(); GamePlayer[] allPlayersNoGame = WorldMgr.GetAllPlayersNoGame(); int num = allPlayersNoGame.Length; byte b3 = (num > (int)b2) ? b2 : ((byte)num); gSPacketIn.WriteByte(b3); for (int i = (int)(b * b2); i < (int)(b * b2 + b3); i++) { PlayerInfo playerCharacter = allPlayersNoGame[i % num].PlayerCharacter; gSPacketIn.WriteInt(playerCharacter.ID); gSPacketIn.WriteString(playerCharacter.NickName); gSPacketIn.WriteByte(playerCharacter.typeVIP); gSPacketIn.WriteInt(playerCharacter.VIPLevel); gSPacketIn.WriteBoolean(playerCharacter.Sex); gSPacketIn.WriteInt(playerCharacter.Grade); gSPacketIn.WriteInt(playerCharacter.ConsortiaID); gSPacketIn.WriteString(playerCharacter.ConsortiaName); gSPacketIn.WriteInt(playerCharacter.Offer); gSPacketIn.WriteInt(playerCharacter.Win); gSPacketIn.WriteInt(playerCharacter.Total); gSPacketIn.WriteInt(playerCharacter.Escape); gSPacketIn.WriteInt(playerCharacter.Repute); gSPacketIn.WriteInt(playerCharacter.FightPower); gSPacketIn.WriteBoolean(playerCharacter.IsOldPlayer); } client.Out.SendTCP(gSPacketIn); return(0); }
internal void SendGameUpdateShootCount(Player player) { GSPacketIn pkg = new GSPacketIn((byte)ePackageType.GAME_CMD, player.Id); pkg.WriteByte((byte)eTankCmdType.ADDATTACK); pkg.WriteByte((byte)player.ShootCount); SendToAll(pkg); }
private void SendShootTag(bool b, int time) { GSPacketIn pkg = new GSPacketIn(GAME_CMD); pkg.WriteByte((byte)eTankCmdType.FIRE_TAG); pkg.WriteBoolean(b); pkg.WriteByte((byte)time); this.SendTCP(pkg); }
private void SendShootTag(bool b, int time) { GSPacketIn pkg = new GSPacketIn(GAME_CMD); pkg.WriteByte(0x60); pkg.WriteBoolean(b); pkg.WriteByte((byte)time); this.SendTCP(pkg); }
public void Skip() { GSPacketIn pkg = new GSPacketIn(GAME_CMD); pkg.Parameter1 = this.m_playerId; pkg.WriteByte((byte)eTankCmdType.SKIPNEXT); pkg.WriteByte((byte)eTankCmdType.SKIPNEXT); this.SendTCP(pkg); Debug.Log("Send SKIP successfully"); }
internal void SendGameUpdateSealState(Living player, int type) { GSPacketIn pkg = new GSPacketIn((byte)ePackageType.GAME_CMD, player.Id); pkg.Parameter1 = player.Id; pkg.WriteByte((byte)eTankCmdType.SEAL); pkg.WriteByte((byte)type); pkg.WriteBoolean(player.GetSealState()); SendToAll(pkg); }
internal void SendGamePickBox(Living player, int index, int arkType, string goods) { GSPacketIn pkg = new GSPacketIn((byte)ePackageType.GAME_CMD, player.Id); pkg.WriteByte((byte)eTankCmdType.PICK); pkg.WriteByte((byte)index); pkg.WriteByte((byte)arkType); pkg.WriteString(goods); SendToAll(pkg); }
public void CreateRoom() { this.m_lastRecv = 0; GSPacketIn pkg = new GSPacketIn((byte)ePackageType.GAME_ROOM_CREATE); pkg.WriteByte((byte)ConfigMgr.RoomType); pkg.WriteByte((byte)ConfigMgr.TimeType); pkg.WriteString("Kien dep trai!"); //pkg.WriteString("123456"); this.SendTCP(pkg); }
internal void SendPlayerUseProp(Player player, int type, int place, int templateID) { GSPacketIn pkg = new GSPacketIn((byte)ePackageType.GAME_CMD, player.Id); pkg.Parameter1 = player.Id; pkg.WriteByte((byte)eTankCmdType.USING_PROP); pkg.WriteByte((byte)type); pkg.WriteInt(place); pkg.WriteInt(templateID); SendToAll(pkg); }
public void CreateRoom(byte roomType, byte timeType = 2) { this.m_lastRecv = 0; GSPacketIn pkg = new GSPacketIn((byte)ePackageType.GAME_ROOM_CREATE); pkg.WriteByte(roomType); pkg.WriteByte(timeType); pkg.WriteString("Kien dep trai!"); pkg.WriteString(""); this.SendTCP(pkg); }
public void SendChangePlaceItem(eBagType bagType, int place, eBagType toBag, int toPlace, int count) { GSPacketIn pkg = new GSPacketIn((byte)ePackageType.CHANGE_PLACE_ITEM); pkg.WriteByte((byte)bagType); pkg.WriteInt(place); pkg.WriteByte((byte)toBag); pkg.WriteInt(toPlace); pkg.WriteInt(count); this.SendTCP(pkg); }
public int HandlePacket(GameClient client, GSPacketIn packet) { if (client.Player.CurrentRoom == null) { return(0); } int playerId = packet.ReadInt(); GamePlayer playerById = WorldMgr.GetPlayerById(playerId); if (playerById == client.Player) { return(0); } GSPacketIn gSPacketIn = new GSPacketIn(70, client.Player.PlayerCharacter.ID); List <GamePlayer> players = client.Player.CurrentRoom.GetPlayers(); foreach (GamePlayer current in players) { if (current == playerById) { client.Out.SendMessage(eMessageType.ERROR, LanguageMgr.GetTranslation("friendnotinthesameserver.Sameroom", new object[0])); int result = 0; return(result); } } if (playerById != null && playerById.CurrentRoom == null)//__receiveInvite { gSPacketIn.WriteInt(client.Player.PlayerCharacter.ID); gSPacketIn.WriteInt(client.Player.CurrentRoom.RoomId); gSPacketIn.WriteInt(client.Player.CurrentRoom.MapId); gSPacketIn.WriteByte(client.Player.CurrentRoom.TimeMode); gSPacketIn.WriteByte((byte)client.Player.CurrentRoom.RoomType); gSPacketIn.WriteByte((byte)client.Player.CurrentRoom.HardLevel); gSPacketIn.WriteByte((byte)client.Player.CurrentRoom.LevelLimits); gSPacketIn.WriteString(client.Player.PlayerCharacter.NickName); gSPacketIn.WriteByte(client.Player.PlayerCharacter.typeVIP); gSPacketIn.WriteInt(client.Player.PlayerCharacter.VIPLevel); gSPacketIn.WriteString(client.Player.CurrentRoom.Name); gSPacketIn.WriteString(client.Player.CurrentRoom.Password); gSPacketIn.WriteInt(0); gSPacketIn.WriteBoolean(client.Player.CurrentRoom.isOpenBoss); playerById.Out.SendTCP(gSPacketIn); return(0); } if (playerById != null && playerById.CurrentRoom != null && playerById.CurrentRoom != client.Player.CurrentRoom) { client.Out.SendMessage(eMessageType.ERROR, LanguageMgr.GetTranslation("friendnotinthesameserver.Room", new object[0])); return(0); } client.Out.SendMessage(eMessageType.ERROR, LanguageMgr.GetTranslation("friendnotinthesameserver.Fail", new object[0])); return(0); }
public void SendPlayerConsortiaFight(int playerId, int consortiaWin, int consortiaLose, eRoomType roomType, eGameType gameClass, int totalKillHealth, int count) { GSPacketIn pkg = new GSPacketIn(42, playerId); pkg.WriteInt(consortiaWin); pkg.WriteInt(consortiaLose); pkg.WriteInt(count); pkg.WriteByte((byte)roomType); pkg.WriteByte((byte)gameClass); pkg.WriteInt(totalKillHealth); pkg.WriteInt(totalKillHealth); this.SendTCP(pkg); }
public void UsingProp(byte type, int place, int templateId) { GSPacketIn pkg = new GSPacketIn((short)GAME_CMD); pkg.Parameter1 = this.m_playerId; //pkg.Parameter2 = -1; Debug.Log("pkg.Parameter1: " + pkg.Parameter1.ToString() + " lifeTime: " + m_lifeTime.ToString()); pkg.WriteByte((byte)eTankCmdType.USING_PROP); pkg.WriteByte(type); pkg.WriteInt(place); pkg.WriteInt(templateId); this.SendTCP(pkg); Debug.Log("Send USING_PROP successfully"); }
/// <summary> /// /// </summary> /// <param name="player"></param> /// <param name="type">0:加血 1:减血 5:不显示 6:死亡,不播放动画</param> internal void SendGameUpdateHealth(Living player, int type, int value) { //Console.WriteLine("SendGameUpdateHealth {0} : {1} : {2}", player.Name, player.Blood, type); GSPacketIn pkg = new GSPacketIn((byte)ePackageType.GAME_CMD, player.Id); pkg.Parameter1 = player.Id; pkg.WriteByte((byte)eTankCmdType.HEALTH); pkg.WriteByte((byte)type); pkg.WriteInt(player.Blood); pkg.WriteInt(value); pkg.WriteInt(0); SendToAll(pkg); }
public void Move(int x, int y, byte dir) { // Debug.Log("Main Player Moving "+x+" - "+y+" d: "+dir); GSPacketIn pkg = new GSPacketIn(GAME_CMD); pkg.Parameter1 = this.m_playerId; pkg.WriteByte((byte)eTankCmdType.MOVESTART); pkg.WriteByte(0); pkg.WriteInt(x); pkg.WriteInt(y); pkg.WriteByte(dir); pkg.WriteBoolean(m_blood > 0); this.SendTCP(pkg); Debug.Log("Send MOVE successfully"); }
public bool HandleCommand(TankMarryLogicProcessor process, GamePlayer player, GSPacketIn packet) { if (player.CurrentMarryRoom == null || player.CurrentMarryRoom.RoomState != eRoomState.FREE) { return(false); } if (!player.CurrentMarryRoom.Info.GuestInvite && player.PlayerCharacter.ID != player.CurrentMarryRoom.Info.GroomID && player.PlayerCharacter.ID != player.CurrentMarryRoom.Info.BrideID) { return(false); } GSPacketIn gSPacketIn = packet.Clone(); gSPacketIn.ClearContext(); int playerId = packet.ReadInt(); GamePlayer playerById = WorldMgr.GetPlayerById(playerId); if (playerById != null && playerById.CurrentRoom == null && playerById.CurrentMarryRoom == null) { gSPacketIn.WriteByte(4); gSPacketIn.WriteInt(player.PlayerCharacter.ID); gSPacketIn.WriteString(player.PlayerCharacter.NickName); gSPacketIn.WriteInt(player.CurrentMarryRoom.Info.ID); gSPacketIn.WriteString(player.CurrentMarryRoom.Info.Name); gSPacketIn.WriteString(player.CurrentMarryRoom.Info.Pwd); gSPacketIn.WriteInt(player.MarryMap); playerById.Out.SendTCP(gSPacketIn); return(true); } return(false); }
private void RefreshData(GamePlayer player, GSPacketIn packet) { int moneyLamMS = DiceSystemMgr.MoneyLamMS; if (player.RemoveMoney(moneyLamMS) == moneyLamMS) { player.DicePlace.ItemDice = DiceSystemMgr.TaoMoidiem(); ThreadSafeRandom threadSafeRandom = new ThreadSafeRandom(); int num = threadSafeRandom.Next(6, 9); player.DicePlace.LuckIntegral += num; } GSPacketIn gSPacketIn = new GSPacketIn(134); gSPacketIn.WriteByte(3); gSPacketIn.WriteBoolean(player.DicePlace.UserFirstCell); gSPacketIn.WriteInt(player.DicePlace.CurrentPosition); gSPacketIn.WriteInt(player.DicePlace.LuckIntegralLevel); gSPacketIn.WriteInt(player.DicePlace.LuckIntegral); gSPacketIn.WriteInt(0); gSPacketIn.WriteInt(player.DicePlace.ItemDice.Count); foreach (DiceSystemItem current in player.DicePlace.ItemDice) { gSPacketIn.WriteInt(current.TemplateID); gSPacketIn.WriteInt(current.Position); gSPacketIn.WriteInt(current.StrengthLevel); gSPacketIn.WriteInt(current.Count); gSPacketIn.WriteInt(current.Validate); gSPacketIn.WriteBoolean(current.IsBind); } player.Out.SendTCP(gSPacketIn); }
public GSPacketIn SendMarryRoomInfoUpdateToScenePlayers(MarryRoom room) { GSPacketIn gSPacketIn = new GSPacketIn(255); bool flag = room != null; gSPacketIn.WriteBoolean(flag); if (flag) { gSPacketIn.WriteInt(room.Info.ID); gSPacketIn.WriteBoolean(room.Info.IsHymeneal); gSPacketIn.WriteString(room.Info.Name); gSPacketIn.WriteBoolean(!(room.Info.Pwd == "")); gSPacketIn.WriteInt(room.Info.MapIndex); gSPacketIn.WriteInt(room.Info.AvailTime); gSPacketIn.WriteInt(room.Count); gSPacketIn.WriteInt(room.Info.PlayerID); gSPacketIn.WriteString(room.Info.PlayerName); gSPacketIn.WriteInt(room.Info.GroomID); gSPacketIn.WriteString(room.Info.GroomName); gSPacketIn.WriteInt(room.Info.BrideID); gSPacketIn.WriteString(room.Info.BrideName); gSPacketIn.WriteDateTime(room.Info.BeginTime); gSPacketIn.WriteByte((byte)room.RoomState); gSPacketIn.WriteString(room.Info.RoomIntroduction); } this.SendToScenePlayer(gSPacketIn); return(gSPacketIn); }
public void SendConsortiaUserPass(int playerid, string playerName, ConsortiaUserInfo info, bool isInvite, int consortiaRepute, string loginName, int fightpower, int achievementpoint, string honor) { GSPacketIn pkg = new GSPacketIn(128, playerid); pkg.WriteByte(1); pkg.WriteInt(info.ID); pkg.WriteBoolean(isInvite); pkg.WriteInt(info.ConsortiaID); pkg.WriteString(info.ConsortiaName); pkg.WriteInt(info.UserID); pkg.WriteString(info.UserName); pkg.WriteInt(playerid); pkg.WriteString(playerName); pkg.WriteInt(info.DutyID); pkg.WriteString(info.DutyName); pkg.WriteInt(info.Offer); pkg.WriteInt(info.RichesOffer); pkg.WriteInt(info.RichesRob); pkg.WriteDateTime(info.LastDate); pkg.WriteInt(info.Grade); pkg.WriteInt(info.Level); pkg.WriteInt(info.State); pkg.WriteBoolean(info.Sex); pkg.WriteInt(info.Right); pkg.WriteInt(info.Win); pkg.WriteInt(info.Total); pkg.WriteInt(info.Escape); pkg.WriteInt(consortiaRepute); pkg.WriteString(loginName); pkg.WriteInt(fightpower); pkg.WriteInt(achievementpoint); pkg.WriteString(honor); this.SendTCP(pkg); }
public void SendConsortiaDuty(ConsortiaDutyInfo info, int updateType, int consortiaID, int playerID, string playerName, int handleID, string handleName) { GSPacketIn pkg = new GSPacketIn(128); pkg.WriteByte(8); pkg.WriteByte((byte)updateType); pkg.WriteInt(consortiaID); pkg.WriteInt(playerID); pkg.WriteString(playerName); pkg.WriteInt(info.Level); pkg.WriteString(info.DutyName); pkg.WriteInt(info.Right); pkg.WriteInt(handleID); pkg.WriteString(handleName); this.SendTCP(pkg); }
public void HandleMarryRoomDispose(GSPacketIn packet) { int roomId = packet.ReadInt(); MarryRoom[] rooms = MarryRoomMgr.GetAllMarryRoom(); MarryRoom[] array = rooms; for (int i = 0; i < array.Length; i++) { MarryRoom room = array[i]; if (room.Info.ID == roomId) { room.KillAllPlayer(); MarryRoomMgr.RemoveMarryRoom(room); GSPacketIn pkg = new GSPacketIn(254); pkg.WriteInt(roomId); WorldMgr.MarryScene.SendToALL(pkg); room.StopTimer(); GSPacketIn pkg2 = new GSPacketIn(249); pkg2.WriteByte(9); room.SendToAll(pkg2); room.StopTimerForHymeneal(); room.SendUserRemoveLate(); room.SendMarryRoomInfoUpdateToScenePlayers(room); } } }
public void FindTarget() { GSPacketIn pkg = new GSPacketIn((byte)GAME_CMD); pkg.WriteByte((byte)eTankCmdType.BOT_COMMAND); this.SendTCP(pkg); }
internal void SendPlayerMove(Player player, int type, int x, int y, byte dir, bool isLiving, string action) { GSPacketIn pkg = new GSPacketIn((byte)ePackageType.GAME_CMD, player.Id); pkg.Parameter1 = player.Id; pkg.WriteByte((byte)eTankCmdType.MOVESTART); pkg.WriteByte((byte)type); pkg.WriteInt(x); pkg.WriteInt(y); pkg.WriteByte(dir); pkg.WriteBoolean(isLiving); pkg.WriteString(!string.IsNullOrEmpty(action) ? action : "move");//怪物资源的动作 SendToAll(pkg); }
internal void SendAddPhysicalObj(PhysicalObj obj) { GSPacketIn pkg = new GSPacketIn((byte)ePackageType.GAME_CMD); pkg.WriteByte((byte)eTankCmdType.ADD_BOX); pkg.WriteInt(obj.Id); pkg.WriteInt(obj.Type); pkg.WriteInt(obj.X); pkg.WriteInt(obj.Y); pkg.WriteString(obj.Model); pkg.WriteString(obj.CurrentAction); pkg.WriteInt(obj.Scale); pkg.WriteInt(obj.Scale); pkg.WriteInt(obj.Rotation); pkg.WriteInt(0); pkg.WriteInt(0); //var id:int = evt.pkg.readInt(); //var type:int = evt.pkg.readInt(); //var px:int = evt.pkg.readInt(); //var py:int = evt.pkg.readInt(); //var model:String = evt.pkg.readUTF(); //var action:String = evt.pkg.readUTF(); //var pscaleX:int = evt.pkg.readInt(); //var pscaleY:int = evt.pkg.readInt(); //var protation:int = evt.pkg.readInt(); //var layer:int = evt.pkg.readInt(); SendToAll(pkg); }
public int HandlePacket(GameClient client, GSPacketIn packet) { int num = packet.ReadInt(); int num2 = num; if (num2 == 2) { GSPacketIn gSPacketIn = new GSPacketIn(131, client.Player.PlayerCharacter.ID); gSPacketIn.WriteByte(2); gSPacketIn.WriteInt(1); gSPacketIn.WriteInt(1); gSPacketIn.WriteBoolean(false); gSPacketIn.WriteInt(0); gSPacketIn.WriteInt(0); gSPacketIn.WriteInt(0); gSPacketIn.WriteInt(0); gSPacketIn.WriteInt(0); gSPacketIn.WriteBoolean(true); gSPacketIn.WriteBoolean(false); gSPacketIn.WriteBoolean(false); gSPacketIn.WriteBoolean(false); client.Player.Out.SendTCP(gSPacketIn); } else { Console.WriteLine("???labyrinth_cmd: " + (LabyrinthPackageType)num); } return(0); }
public void SendConsortiaUserPass(int playerid, string playerName, ConsortiaUserInfo info, bool isInvite, int consortiaRepute, string loginName, int fightpower) { GSPacketIn pkg = new GSPacketIn((byte)eChatServerPacket.CONSORTIA_RESPONSE, playerid); pkg.WriteByte(1); pkg.WriteInt(info.ID); pkg.WriteBoolean(isInvite); pkg.WriteInt(info.ConsortiaID); pkg.WriteString(info.ConsortiaName); pkg.WriteInt(info.UserID); pkg.WriteString(info.UserName); pkg.WriteInt(playerid); pkg.WriteString(playerName); pkg.WriteInt(info.DutyID); pkg.WriteString(info.DutyName); pkg.WriteInt(info.Offer); pkg.WriteInt(info.RichesOffer); pkg.WriteInt(info.RichesRob); pkg.WriteDateTime(info.LastDate); pkg.WriteInt(info.Grade); pkg.WriteInt(info.Level); pkg.WriteInt(info.State); pkg.WriteBoolean(info.Sex); pkg.WriteInt(info.Right); pkg.WriteInt(info.Win); pkg.WriteInt(info.Total); pkg.WriteInt(info.Escape); pkg.WriteInt(consortiaRepute); pkg.WriteString(loginName); pkg.WriteInt(fightpower); pkg.WriteInt(500); //New pkg.WriteString("Honor"); SendTCP(pkg); }
public void SendPlayerConsortiaFight(int playerId, int consortiaWin, int consortiaLose, Dictionary <int, Player> players, eRoomType roomType, eGameType gameClass, int totalKillHealth) { GSPacketIn pkg = new GSPacketIn((byte)eFightPackageType.PLAYER_CONSORTIAFIGHT, playerId); pkg.WriteInt(consortiaWin); pkg.WriteInt(consortiaLose); pkg.WriteInt(players.Count); for (int i = 0; i < players.Count; i++) { pkg.WriteInt(players[i].PlayerDetail.PlayerCharacter.ID); } pkg.WriteByte((byte)roomType); pkg.WriteByte((byte)gameClass); pkg.WriteInt(totalKillHealth); SendTCP(pkg); }
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); } } } }