public byte[] GetBuffer() { PacketOut outpack = new PacketOut(); outpack.WriteBuff(InternalPacket.HEAD); outpack.WriteUInt16(mParam); outpack.WriteUInt32(gameid); outpack.WriteUInt32(sortid); outpack.WriteBuff(item.GetBuffer()); //outpack.WriteInt32(playerid); //outpack.WriteUInt32(itemid); //outpack.WriteUInt16(postion); //outpack.WriteByte(stronglv); //outpack.WriteByte(gemcount); //outpack.WriteUInt32(gem1); //outpack.WriteUInt32(gem2); //outpack.WriteString(forgename); //outpack.WriteUInt16(amount); //outpack.WriteInt32(war_ghost_exp); //outpack.WriteByte(di_attack); //outpack.WriteByte(shui_attack); //outpack.WriteByte(huo_attack); //outpack.WriteByte(feng_attack); //outpack.WriteInt32(property); //outpack.WriteByte(gem3); //outpack.WriteInt32(god_strong); //outpack.WriteInt32(god_exp); outpack.WriteBuff(InternalPacket.TAIL); return outpack.GetBuffer(); }
public int HandlePacket(BaseClient client, PacketIn packet) { WorldClient cclient = (WorldClient)client; PacketOut Out = new PacketOut((UInt32)Opcodes.LFG); if (cclient.LFG == 0) { MySqlCommand cmd = new MySqlCommand("UPDATE `clientstatus` SET `lfg` = 1 WHERE `name` = @name", WorldServer.Database.Connection.Instance); try { cmd.Prepare(); cmd.Parameters.AddWithValue("@name", cclient.Name); cmd.ExecuteNonQuery(); } catch (MySqlException e) { FrameWork.Logger.Log.Error("MySQL", e.ToString()); } finally { cmd.Dispose(); } cclient.LFG = 1; Out.WriteByte(1); } else if (cclient.LFG == 1) { MySqlCommand cmd = new MySqlCommand("UPDATE `clientstatus` SET `lfg` = 0 WHERE `name` = @name", WorldServer.Database.Connection.Instance); try { cmd.Prepare(); cmd.Parameters.AddWithValue("@name", cclient.Name); cmd.ExecuteNonQuery(); } catch (MySqlException e) { FrameWork.Logger.Log.Error("MySQL", e.ToString()); } finally { cmd.Dispose(); } cclient.LFG = 0; Out.WriteByte(0); } cclient.Send(Out); return 0; }
public static void Send(LobbyClient client) { PacketOut Out = new PacketOut((UInt32)Opcodes.ANS_LOGIN_SUCCESS); Out.WriteParsedString("Welcome to rebornAPB", 48); Out.WriteUInt32Reverse(client.Account.IsAdmin); Out.WriteInt64Reverse(TCPManager.GetTimeStamp()); Out.WriteByte(0x13); Out.WriteByte(0x29); Out.WriteUInt16Reverse(0x12); Out.WriteByte(0x0E); Out.WriteByte(0x07); Out.WriteUInt16Reverse(9999); Out.WriteInt32Reverse(1450); Out.WriteUInt32Reverse((uint)client.Account.RTW_Points); for (int i = 1; i < 6; ++i) Out.WriteInt32Reverse(Program.FileMgr.GetFileVersion((int)client.Account.Index, i, true, "", "")); Out.WriteInt32Reverse(0); Out.WriteUInt16(0x957D); Out.WriteUInt16(0x0400); Out.WriteUInt16(0x5052); Out.WriteUInt16(0x4F45); Out.WriteUInt16(0x552E); Out.WriteUInt16(0x3232); Out.WriteUInt16(0x3738); Out.WriteUInt16(0x3031); Out.WriteUInt16(0); Out.WriteUInt16(0x0067); Out.WriteUInt64(0x526C624331313256); Out.WriteUInt64(0x486E314100000000); Out.WriteUInt16(0); Out.WriteStringBytes(""); Out.WriteByte(0); client.Send(Out); }
public int HandlePacket(BaseClient client, PacketIn packet) { LobbyClient cclient = client as LobbyClient; byte slotId = packet.GetUint8(); Character Info = cclient.Characters.Get(slotId); MySqlCommand cmd = new MySqlCommand("DELETE FROM `clientstatus` WHERE `name` = @name", Connection.Instance); try { cmd.Prepare(); cmd.Parameters.AddWithValue("@name", Info.Name); cmd.ExecuteNonQuery(); } catch (MySqlException) { } finally { cmd.Dispose(); } PacketOut Out = new PacketOut((UInt32)Opcodes.ANS_CHARACTER_INFO); if (Info == null) Out.WriteUInt32Reverse((uint)ResponseCodes.RC_FAILED); else { Out.WriteUInt32Reverse((uint)ResponseCodes.RC_SUCCESS); Out.WriteByte(Info.Slot); Out.WriteByte(Info.Gender); Out.WriteUInt32Reverse(Info.Playtime); Out.WriteUInt32Reverse(Info.Rank); Out.WriteByte(Info.Threat); Out.WriteUInt32Reverse(Info.Money); Out.WriteParsedString("APB-EMU", 60); byte[] Custom = Info.getCustom(); Out.Write(Custom, 0, Custom.Length); } cclient.Send(Out); return 0; }
public int HandlePacket(BaseClient client, PacketIn packet) { LobbyClient cclient = client as LobbyClient; UInt32 WorldUid = packet.GetUint32Reversed(); string Name = packet.GetParsedString(); PacketOut Out = new PacketOut((UInt32)Opcodes.ANS_CHARACTER_NAME_CHECK); if (Databases.CharacterTable.Count(c => c.Name == Name) == 0) { cclient.Pending = new CharacterEntry(); cclient.Pending.Index = Databases.CharacterTable.GenerateIndex(); cclient.Pending.AccountIndex = cclient.Account.Index; cclient.Pending.Name = Name; cclient.Pending.World = (int)WorldUid; cclient.Pending.Rank = 1; cclient.Pending.Money = 0; cclient.Pending.Threat = 1; cclient.Pending.Playtime = 0; cclient.Pending.Clan = "APB-EMU"; cclient.Pending.IsOnline = 0; cclient.Pending.DistrictID = 0; cclient.Pending.DistrictType = 0; cclient.Pending.LFG = 0; cclient.Pending.IsGroupPublic = 0; cclient.Pending.GroupInvite = 0; cclient.Pending.GroupStatus = 0; Out.WriteUInt32Reverse((uint)ResponseCodes.RC_SUCCESS); } else { cclient.Pending = default(CharacterEntry); Out.WriteUInt32Reverse((uint)ResponseCodes.RC_CHARACTER_NAME_CHECK_IN_USE); } cclient.Send(Out); return 0; }
public byte[] Encrypt(PacketOut packet) { byte[] data = packet.ToArray(); Log.Info("[SERVER PRE-ENCRYPT]", this.DumpData(data)); encryption.Process(data, 4, data.Length - 4); return data; }
public int HandlePacket(BaseClient client, PacketIn packet) { LobbyClient cclient = (LobbyClient)client; Byte slotId = packet.GetUint8(); Character character = cclient.Characters.Get(slotId); if (character == null) Log.Error(cclient.Account.Email, "Wrong slot specified!"); World.World info = null; lock (Program.worldListener.Worlds) { Program.worldListener.Worlds.TryGetValue(character.WorldId, out info); } PacketOut Out = new PacketOut((UInt32)Opcodes.ANS_WORLD_ENTER); if (info == null) Out.WriteUInt32Reverse(1); else { info.Send(new AccountEnter(cclient.Account.Id, character.Id, cclient.SessionId)); Out.WriteUInt32Reverse((uint)ResponseCodes.RC_SUCCESS); Out.WriteByte(info.IP1); Out.WriteByte(info.IP2); Out.WriteByte(info.IP3); Out.WriteByte(info.IP4); Out.WriteUInt16Reverse((UInt16)info.Port); Out.WriteInt64Reverse(TCPManager.GetTimeStamp()); } cclient.Send(Out); return 0; }
public int HandlePacket(BaseClient client, PacketIn packet) { LobbyClient cclient = (LobbyClient)client; Byte slotId = packet.GetUint8(); CharacterEntry character = Databases.CharacterTable.SingleOrDefault(c => c.AccountIndex == cclient.Account.Index && c.Slot == slotId); if (character.Index < 1) Log.Error(cclient.Account.Username, "Wrong slot specified!"); World.World info = null; lock (Program.worldListener.Worlds) { Program.worldListener.Worlds.TryGetValue((uint)character.World, out info); } PacketOut Out = new PacketOut((UInt32)Opcodes.ANS_WORLD_ENTER); if (info == null) Out.WriteUInt32Reverse(1); else { info.Send(new AccountEnter((uint)cclient.Account.Index, (uint)character.Index, cclient.SessionId)); Out.WriteUInt32Reverse((uint)ResponseCodes.RC_SUCCESS); Out.WriteByte(info.IP1); Out.WriteByte(info.IP2); Out.WriteByte(info.IP3); Out.WriteByte(info.IP4); Out.WriteUInt16Reverse((UInt16)info.Port); Out.WriteInt64Reverse(TCPManager.GetTimeStamp()); } cclient.Send(Out); return 0; }
public int HandlePacket(BaseClient client, PacketIn packet) { LobbyClient cclient = client as LobbyClient; cclient.Characters.Delete(packet.GetUint8()); PacketOut Out = new PacketOut((UInt32)Opcodes.ANS_CHARACTER_DELETE); Out.WriteUInt32Reverse((uint)ResponseCodes.RC_SUCCESS); cclient.Send(Out); return 0; }
public int HandlePacket(BaseClient client, PacketIn packet) { LobbyClient cclient = (LobbyClient)client; byte FileId = packet.GetUint8(); PacketOut Out = new PacketOut((UInt32)Opcodes.ANS_CONFIGFILE_LOAD); Out.WriteInt32Reverse((int)ResponseCodes.RC_SUCCESS); Out.WriteByte(FileId); byte[] Result = ZlibMgr.Compress(Program.FileMgr.GetFileByte((int)cclient.Account.Id, FileId, true, "", "")); cclient.Send(Out); return 0; }
static public void Send(LobbyClient client) { PacketOut Out = new PacketOut((UInt32)Opcodes.ANS_CHARACTER_CREATE); if (client.Pending == null) Out.WriteInt32Reverse((int)ResponseCodes.RC_FAILED); else { Out.WriteInt32Reverse((int)ResponseCodes.RC_SUCCESS); Out.WriteInt32Reverse(client.Pending.Slot); } client.Pending = null; client.Send(Out); }
public static void Send(LobbyClient client) { Log.Debug("LOGIN_SALT", "Sent to " + client.Account.Username); client.serverModulus = Auth.computeServerModulus(client.Verifier); PacketOut Out = new PacketOut((UInt32)Opcodes.LOGIN_SALT); Out.WriteUInt32Reverse((uint)client.Account.Index); Out.Write(client.serverModulus.B.ToByteArrayUnsigned(), 0, 64); Out.WriteByte(0x40); Out.WriteByte(0); Out.Write(client.Salt, 0, 10); client.Send(Out); }
static public void Send(LobbyClient client) { PacketOut Out = new PacketOut((UInt32)Opcodes.ANS_CHARACTER_CREATE); if (client.Pending.Index < 1) Out.WriteInt32Reverse((int)ResponseCodes.RC_FAILED); else { Out.WriteInt32Reverse((int)ResponseCodes.RC_SUCCESS); Out.WriteInt32Reverse(client.Pending.Slot); } client.Pending = default(CharacterEntry); client.Send(Out); System.Threading.Thread.Sleep(200); client.Disconnect(); }
static public void Send(LobbyClient client) { PacketOut Out = new PacketOut((UInt32)Opcodes.LOGIN_PUZZLE); Out.WriteInt32Reverse(Program.Version[0]); Out.WriteInt32Reverse(Program.Version[1]); Out.WriteInt32Reverse(Program.Version[2]); Out.WriteInt32Reverse(Program.Build); Out.WriteByte(0x05); for (int i = 0; i < client.ECrypt.Key.Length; i++) Out.WriteByte(client.ECrypt.Key[i]); Out.WriteUInt32Reverse(0); Out.WriteUInt32Reverse(0); Out.WriteUInt32Reverse(0); client.SendTCP(Out); }
/// <summary> /// Safe method of logging you out /// </summary> /// <returns></returns> private void CreateLogoutPacket() { PacketOut o = new PacketOut(27); o.FinalizeLengthAndChecksum(); m_cGameConnection.SendTCP(o); m_cGameConnection.Disconnect(); if (m_tPingThread != null && m_tPingThread.ThreadState == System.Threading.ThreadState.Running) { m_tPingThread.Abort(); } if (IsConnected) { m_cGameConnection.Disconnect(); } }
public int HandlePacket(BaseClient client, PacketIn packet) { LobbyClient cclient = (LobbyClient)client; byte FileId = packet.GetUint8(); uint Version = packet.GetUint32Reversed(); byte[] File = new byte[packet.Length - packet.Position]; packet.Read(File, 0, File.Length); PacketOut Out = new PacketOut((uint)Opcodes.ANS_CONFIGFILE_SAVE); Out.WriteUInt32Reverse((uint)ResponseCodes.RC_SUCCESS); Out.WriteByte(FileId); Out.Write(File, 0, File.Length); cclient.Send(Out); return(0); }
public static void CMSG_GetCharSummaryListReq(BaseClient client, PacketIn packet) { Log.Debug("LServ", "GetCharSummaryListReq"); Client cclient = (Client)client; PacketOut Out = new PacketOut((byte)Opcodes.SMSG_GetCharSummaryListReply); Out.Write(new byte[] { 0x08, 00 }); cclient.SendTCPCuted(Out); if (Program.Config.SeverOnFinish) { cclient.Disconnect("Transaction complete"); } }
public void Send(PacketOut packet) { Console.Write("Sent:"); for (int i = 0; i < packet.ToArray().Length; i++) Console.Write(" " + packet.ToArray()[i]); Console.WriteLine(); byte[] toSend = Crypto.Encrypt(packet); MemoryStream tcpOut = new MemoryStream(); tcpOut.WriteByte((Byte)((toSend.Length & 0xffff) & 0xff)); tcpOut.WriteByte((Byte)((toSend.Length & 0xffff) >> 8)); tcpOut.WriteByte((Byte)((toSend.Length >> 16) & 0xff)); tcpOut.WriteByte((Byte)(toSend.Length >> 24)); tcpOut.Write(toSend, 4, toSend.Length - 4); SendTCP(tcpOut.ToArray()); tcpOut.Dispose(); toSend = null; }
public int HandlePacket(BaseClient client, PacketIn packet) { WorldClient cclient = (WorldClient)client; cclient.Character.IsOnline = 0; cclient.Character.LFG = 0; cclient.Character.DistrictID = 0; cclient.Character.DistrictType = 0; cclient.Character.GroupInvite = 0; cclient.Character.GroupStatus = 0; cclient.Character.IsGroupPublic = 0; Databases.CharacterTable.Update(cclient.Character); PacketOut Out = new PacketOut((UInt32)Opcodes.LOGOUT); cclient.Send(Out); cclient.Disconnect(); return 0; }
protected void NotifyImmune(Unit caster, ushort abilityEntry) { PacketOut Out = new PacketOut((byte)Opcodes.F_CAST_PLAYER_EFFECT, 10); Out.WriteUInt16(caster.Oid); Out.WriteUInt16(Oid); Out.WriteUInt16(abilityEntry); Out.WriteByte(0); Out.WriteByte((byte)CombatEvent.COMBATEVENT_IMMUNE); Out.WriteByte(5); Out.WriteByte(0); DispatchPacketUnreliable(Out, true, this); }
public void AttemptClear() { foreach (NPCAbility ab in AbtInterface.NPCAbilities) { PacketOut Out = new PacketOut((byte)Opcodes.F_PET_INFO, 12); Out.WriteUInt16(Oid); Out.WriteUInt16(CbtInterface.GetTarget(TargetTypes.TARGETTYPES_TARGET_ENEMY)?.Oid ?? 0); // Pet target? Out.WriteUInt16(ab.Entry); Out.WriteByte(FollowMode); // 1 stay 2= heel Out.WriteByte(AIMode); // 3 passive // 4 guard // 5 Aggressive Out.WriteByte((byte)PetUpdateType.RemoveAbility); Out.WriteByte(0); Out.WriteByte(0); Owner.SendPacket(Out); } }
public void SendQuests() { PacketOut Out = new PacketOut((byte)Opcodes.F_QUEST_LIST); Out.WriteByte((byte)_Quests.Count); foreach (Character_quest Quest in _Quests.Values) { Out.WriteUInt16(Quest.QuestID); Out.WriteByte(0); Out.WritePascalString(Quest.Quest.Name); Out.WriteByte(0); } Log.Info("QuestInterface", "Sended Quest : " + _Quests.Count); GetPlayer().SendPacket(Out); }
public void SendQuestUpdate(Character_quest Quest, Character_Objectives Obj) { if (GetPlayer() == null) { return; } PacketOut Out = new PacketOut((byte)Opcodes.F_QUEST_UPDATE); Out.WriteUInt16(Quest.QuestID); Out.WriteByte(Convert.ToByte(Quest.IsDone())); Out.WriteByte(Obj.Objective.num); Out.WriteByte((byte)Obj.Count); Out.WriteUInt16(0); GetPlayer().SendPacket(Out); }
static public void HandlePacket(BaseClient client, PacketIn packet) { LobbyClient cclient = (LobbyClient)client; byte FileId = packet.GetUint8(); PacketOut Out = new PacketOut((UInt32)Opcodes.ANS_CONFIGFILE_LOAD); Out.WriteInt32R(0); Out.WriteByte(FileId); byte[] Result = ZlibMgr.Compress( Program.FileMgr.GetFileByte(cclient.Account.Id, FileId, true, "", ""), zlibConst.Z_DEFAULT_COMPRESSION, 0); cclient.SendTCP(Out); }
/*public override void SendMeTo(Player plr) * { * //if ((byte)plr.Realm != Info.Type) * return; * * //SendCurrentStage(plr); * //SendStageInfo(plr); * /* * if(!started && ended) * SendReinitTime(plr, TIME_PQ_RESET); */ // TODO // Send Quest Info && Current Stage && Current Players /*}*/ public void SendReinitTime(Player player, ushort time) { PacketOut Out = new PacketOut((byte)Opcodes.F_OBJECTIVE_INFO); Out.WriteUInt32(Info.Entry); Out.WriteByte(1); Out.WriteByte(2); Out.WriteByte(1); Out.WriteUInt16(0); Out.WritePascalString(Info.Name); Out.WriteUInt16(0); Out.WriteUInt16(time); // LastUpdatedTime in seconds Out.WriteUInt16(0); Out.WriteUInt16(0); player.SendPacket(Out); }
protected override void BuffEnded(bool wasRemoved, bool wasManual) { if (Interlocked.CompareExchange(ref BuffEndLock, 1, 0) != 0) { return; } BuffHasExpired = true; WasManuallyRemoved = wasManual; if (wasRemoved) { BuffState = (byte)EBuffState.Removed; } else { BuffState = (byte)EBuffState.Ended; } Interlocked.Exchange(ref BuffEndLock, 0); if (_target != null) { if (wasRemoved) { _target.NotifyInteractionBroken(this); } else { _target.NotifyInteractionComplete(this); } if (!HasSentEnd) { PacketOut Out = new PacketOut((byte)Opcodes.F_SET_ABILITY_TIMER, 12); Out.WriteByte(0); Out.WriteByte(1); Out.WriteByte(1); Out.Fill(0, 9); ((Player)Caster).SendPacket(Out); } ((Player)Caster).KneelDown(_target.Oid, false); } _buffInterface.RemoveEventSubscription(this, (byte)BuffCombatEvents.ReceivingDamage); _buffInterface.RemoveEventSubscription(this, (byte)BuffCombatEvents.AbilityStarted); }
public int HandlePacket(BaseClient client, PacketIn packet) { WorldClient cclient = (WorldClient)client; UInt32 accountId = packet.GetUint32Reversed(); Log.Debug("AskWorldEnter", "New client! Account = " + accountId); cclient.Account = Databases.AccountTable.SingleOrDefault(a => a.Index == accountId); cclient.Character = Databases.CharacterTable.SingleOrDefault(c => c.AccountIndex == accountId); lock (Program.expectingAccounts) { Program.expectingAccounts.TryGetValue(accountId, out cclient.account); } PacketOut Out = new PacketOut((UInt32)Opcodes.ANS_WORLD_ENTER); if (cclient.account == null) Out.WriteInt32Reverse((int)ResponseCodes.RC_FAILED); else { Out.WriteInt32Reverse((int)ResponseCodes.RC_SUCCESS); Out.WriteUInt32Reverse(cclient.account.Character); Out.WriteUInt32Reverse((uint)cclient.Account.RTW_Points); Out.WriteByte(cclient.Account.IsAdmin); Out.WriteInt64Reverse(TCPManager.GetTimeStamp()); Out.WriteFloat(5.00f); Out.WriteByte(0); Out.WriteByte(0); Out.WriteInt32Reverse(Program.FileMgr.GetFileVersion((int)accountId, 1, false, Program.WorldName, cclient.account.Character.ToString())); Out.WriteInt32Reverse(Program.FileMgr.GetFileVersion((int)accountId, 2, false, Program.WorldName, cclient.account.Character.ToString())); Out.WriteInt32Reverse(Program.FileMgr.GetFileVersion((int)accountId, 3, false, Program.WorldName, cclient.account.Character.ToString())); Out.WriteInt32Reverse(Program.FileMgr.GetFileVersion((int)accountId, 4, false, Program.WorldName, cclient.account.Character.ToString())); Out.WriteInt32Reverse(Program.FileMgr.GetFileVersion((int)accountId, 5, false, Program.WorldName, cclient.account.Character.ToString())); Out.WriteByte(1); Out.WriteByte(cclient.Character.LFG); } cclient.Crypto = new TCP.Encryption(cclient.account.SessionId); cclient.Send(new DISTRICT_LIST()); cclient.Send(Out); lock (Program.expectingAccounts) { foreach (KeyValuePair<uint, Acc> a in Program.expectingAccounts) { if (a.Value == cclient.account) { Program.expectingAccounts.Remove(a.Key); break; } } } return 0; }
public void SendMessage(UInt16 Oid, string NameSender, string Text, SystemData.ChatLogFilters Filter) { PacketOut Out = new PacketOut((byte)Opcodes.F_CHAT); Out.WriteUInt16(Oid); Out.WriteByte((byte)Filter); Out.Fill(0, 4); Out.WritePascalString(NameSender); Out.WriteUInt16((ushort)(Text.Length + 1)); Out.WriteStringBytes(Text); Out.WriteByte(0); int a = Text.IndexOf("<LINK"); int b = Text.IndexOf("ITEM:"); if (a >= 0 && b > 0) { Out.WriteByte(1); long p = Out.Position; Out.WriteByte(0); int Count = 0; while (a >= 0 && b >= 0) { int Pos = b + 5; int LastPos = Text.IndexOf(" ", Pos) - 1; string Value = Text.Substring(Pos, LastPos - Pos); uint ItemId = uint.Parse(Value); Item_Info Info = WorldMgr.GetItem_Info(ItemId); if (Info != null) { ++Count; Out.WriteByte(3); Item.BuildItem(ref Out, null, Info, 0, 1); } a = Text.IndexOf("<LINK", Pos); b = Text.IndexOf("ITEM:", Pos); } Out.Position = p; Out.WriteByte((byte)Count); Out.Position = Out.Length; } SendPacket(Out); }
public void SendHotSpots(Player Plr) { List <Tuple <Point3D, int> > HotSpots = GetHotSpots(); PacketOut Out = new PacketOut((byte)Opcodes.F_UPDATE_HOT_SPOT); Out.WriteByte((byte)HotSpots.Count); Out.WriteByte(3); // 3 - multipul hotspots Out.WriteUInt16(ZoneId); for (int i = 0; i < HotSpots.Count; i++) { Out.WriteByte((byte)i); Out.WriteUInt16((ushort)HotSpots[i].Item1.X); Out.WriteUInt16((ushort)HotSpots[i].Item1.Y); if (HotSpots[i].Item2 >= LARGE_FIGHT) { Out.WriteByte(0); // 24 or more } else if (HotSpots[i].Item2 >= MEDIUM_FIGHT) { Out.WriteByte(2); // 16 or more } else { Out.WriteByte(1); // 8 or more } } if (Plr == null) { lock (Players) foreach (Player pPlr in Players) { if (pPlr == null || pPlr.IsDisposed || !pPlr.IsInWorld()) { continue; } pPlr.SendPacket(Out); } } else { Plr.SendPacket(Out); } }
public async Task BuildPendingUpdateData() { List <Task> tasks = new List <Task>(); PacketOut pkt = new PacketOut(RealmOp.SMSG_UPDATE_OBJECT); foreach (var updatedata in State.PendingUpdateData) { pkt.Reset(RealmOp.SMSG_UPDATE_OBJECT); pkt.Write((UInt32)1); pkt.Write(updatedata); tasks.Add(SendPacket(pkt)); } State.PendingUpdateData.Clear(); await Task.WhenAll(tasks); }
public async Task SendLoginEffect() { PacketOut p = new PacketOut(RealmOp.SMSG_SPELL_GO); p.Write(pGUID); //caster p.Write(pGUID); //target? p.Write((byte)1); //counter p.Write((UInt32)836); //LOGINEFFECT p.Write((UInt32)256); //flags p.Write(Time.GetMSTime()); p.Write((byte)1); //hit 1 person p.Write(oGUID); //hit me p.Write((byte)0); //missed 0 people p.Write((UInt32)2); //targetmask unit p.Write(pGUID); //targetted unit was me await SendPacket(p); }
public int HandlePacket(BaseClient client, PacketIn packet) { WorldClient cclient = (WorldClient)client; MySqlCommand cmd = new MySqlCommand("DELETE FROM `clientstatus` WHERE `name` = @name", WorldServer.Database.Connection.Instance); try { cmd.Prepare(); cmd.Parameters.AddWithValue("@name", cclient.Name); cmd.ExecuteNonQuery(); } catch (MySqlException e) { Log.Error("MySQL", e.ToString()); } finally { cmd.Dispose(); } PacketOut Out = new PacketOut((UInt32)Opcodes.LOGOUT); cclient.Send(Out); cclient.Disconnect(); return 0; }
public void SendSocialList(List <Character_social> socials, SocialListType Type) { PacketOut Out = new PacketOut((byte)Opcodes.F_SOCIAL_NETWORK); Out.WriteUInt16(0); Out.WriteByte((byte)Type); Out.WriteByte((byte)socials.Count); Out.WriteByte(0); foreach (Character_social social in socials) { BuildPlayerInfo(ref Out, social); Out.WriteByte(0); } _player.SendPacket(Out); }
/// <summary> /// Sends a buff effect start packet. /// </summary> /// <param name="plr">Player that initiated the command</param> /// <param name="values">List of command arguments (after command name)</param> /// <returns>True if command was correctly handled, false if operation was canceled</returns> public static bool SendCastPlayerStart(Player plr, ref List <string> values) { PacketOut Out = new PacketOut((byte)Opcodes.F_CAST_PLAYER_EFFECT); Out.WriteUInt16(plr.Oid); Out.WriteUInt16(plr.Oid); Out.WriteUInt16((ushort)GetInt(ref values)); // 00 00 07 D D Out.WriteByte((byte)GetInt(ref values)); Out.WriteByte(0); Out.WriteByte(1); //7 Out.WriteZigZag(100); Out.WriteZigZag(100); Out.WriteByte(0); plr.SendPacket(Out); return(true); }
public override void NotifyClientLoaded() { if (CareerResource == 1 && _fakeBuffEntry == 8550) { PacketOut Out = new PacketOut((byte)Opcodes.F_CAST_PLAYER_EFFECT, 10); Out.WriteUInt16(myPlayer.Oid); Out.WriteUInt16(myPlayer.Oid); Out.WriteUInt16(_fakeBuffEntry); // 00 00 07 D D Out.WriteByte(0); Out.WriteByte(0); Out.WriteByte(1); Out.WriteByte(0); myPlayer.SendPacket(Out); } }
public void UpdateGlow(Player plr) { _glowObject.VfxState = (byte)OwningRealm; PacketOut Out = new PacketOut((byte)Opcodes.F_UPDATE_STATE, 20); Out.WriteUInt16(_glowObject.Oid); Out.WriteByte(6); //state Out.WriteByte(0); Out.WriteByte(0); Out.WriteByte(8); Out.WriteByte(0); Out.WriteByte(_glowObject.VfxState); Out.Fill(0, 10); plr.SendPacket(Out); }
public void SendQuest(Character_quest CQuest) { if (CQuest == null) { Log.Error("QuestsInterface", "SendQuest CQuest == null"); return; } PacketOut Packet = new PacketOut((byte)Opcodes.F_QUEST_INFO); Packet.WriteUInt16(CQuest.QuestID); Packet.WriteByte(0); // Quest Type (database is wrong) BuildQuestHeader(Packet, CQuest.Quest, true); Dictionary <Item_Info, uint> Rewards = GenerateRewards(CQuest.Quest, GetPlayer()); Packet.WriteByte(CQuest.Quest.ChoiceCount); Packet.WriteByte(0); Packet.WriteByte((byte)Rewards.Count); foreach (KeyValuePair <Item_Info, uint> Kp in Rewards) { Item.BuildItem(ref Packet, null, Kp.Key, 0, (ushort)Kp.Value); } Packet.WriteByte(0); BuildObjectives(Packet, CQuest._Objectives); foreach (Quest_Map Map in CQuest.Quest.Maps) { Packet.WriteByte(Map.Id); Packet.WritePascalString(Map.Name); Packet.WritePascalString(Map.Description); Packet.WriteUInt16(Map.ZoneId); Packet.WriteUInt16(Map.Icon); Packet.WriteUInt16(Map.X); Packet.WriteUInt16(Map.Y); Packet.WriteUInt16(Map.Unk); Packet.WriteByte(Map.When); } Packet.WriteByte(0); GetPlayer().SendPacket(Packet); }
public void SendPacket(PacketOut Out) { if (_Client == null) { return; } if (IsInWorld()) { lock (_PacketOut) _PacketOut.Add(Out); } else { _Client.SendTCP(Out); } }
protected void SendBounceEnd() { #region Init Effects packet PacketOut Out = new PacketOut((byte)Opcodes.F_INIT_EFFECTS); Out.WriteByte(1); Out.WriteByte(2); Out.WriteUInt16(0); Out.WriteUInt16(Target.Oid); Out.WriteUInt16(BuffId); Out.WriteUInt16R(_buffInfo.Entry); Out.WriteByte(0); if (Target.IsPlayer()) { ((Player)Target).DispatchPacket(Out, true); } else if (Caster.IsPlayer()) { ((Player)Caster).DispatchPacket(Out, true); } #endregion if (HasSentEnd) { return; } #region Appearance / Animation // Buff appearance / animation Out = new PacketOut((byte)Opcodes.F_CAST_PLAYER_EFFECT); Out.WriteUInt16(Caster.Oid); Out.WriteUInt16(Target.Oid); Out.WriteUInt16(_buffInfo.Entry == 3016 ? (ushort)1601 : (ushort)8557); // 00 00 07 D D Out.WriteByte((byte)previousPlayers.Count); Out.WriteByte(0); // Combat Event not used here Out.WriteByte(0); // Start/End Out.WriteByte(0); // Packet end Target.DispatchPacketUnreliable(Out, true, Target); #endregion }
public void SendSkills() { PacketOut Out = new PacketOut((byte)Opcodes.F_CHARACTER_INFO); Out.WriteByte(3); // Skills Out.Fill(0, 3); Out.WriteByte(_Info.CareerLine); Out.WriteByte(_Info.Race); Out.WriteUInt32R(_Value.Skills); Out.WriteUInt16(_Value.RallyPoint); SendPacket(Out); Scenarios s = new Scenarios(); s.SendScenarios(this); }
static public void F_OPEN_GAME(BaseClient client, PacketIn packet) { GameClient cclient = client as GameClient; PacketOut Out = new PacketOut((byte)Opcodes.S_GAME_OPENED); if (cclient.Plr == null) { Out.WriteByte(1); } else { Out.WriteByte(0); } cclient.SendTCP(Out); }
public void SendRankUpdate(Player Plr) { PacketOut Out = new PacketOut((byte)Opcodes.F_PLAYER_RANK_UPDATE); Out.WriteByte((byte)Level); Out.WriteByte(0x20); Out.WriteUInt16(Oid); if (Plr == null) { DispatchPacket(Out, true); } else { Plr.SendPacket(Out); } }
public void Attack(Object target) { PacketOut packet = new PacketOut(WorldServerOpCode.CMSG_SET_SELECTION); if (objectMgr.getPlayerObject() != null) { packet.Write(target.Guid.GetNewGuid()); } Send(packet); packet = new PacketOut(WorldServerOpCode.CMSG_ATTACKSWING); if (objectMgr.getPlayerObject() != null) { packet.Write(target.Guid.GetNewGuid()); } Send(packet); }
public static void BuildQuestInProgress(PacketOut Out, Quest q, bool particular) { Out.WritePascalString(q.Name); if (q.ProgressText.Length > 0) { Out.WriteUInt16((ushort)q.ProgressText.Length); Out.WriteStringBytes(q.ProgressText); } else { Out.WriteUInt16((ushort)q.Particular.Length); Out.WriteStringBytes(q.Particular); } Out.WriteByte(1); }
static public void BuildQuestInProgress(PacketOut Out, Quest Q, bool Particular) { Out.WritePascalString(Q.Name); if (Q.ProgressText.Length > 0) { Out.WriteUInt16((UInt16)Q.ProgressText.Length); Out.WriteStringBytes(Q.ProgressText); } else { Out.WriteUInt16((UInt16)Q.Particular.Length); Out.WriteStringBytes(Q.Particular); } Out.WriteByte(1); }
public void SendQuests() { List <Character_quest> Quests = _Quests.Values.ToList <Character_quest>().FindAll(q => q.Done == false); PacketOut Out = new PacketOut((byte)Opcodes.F_QUEST_LIST); Out.WriteByte((byte)Quests.Count); foreach (Character_quest Quest in Quests) { Out.WriteUInt16(Quest.QuestID); Out.WriteByte(0); Out.WritePascalString(Quest.Quest.Name); Out.WriteByte(0); } GetPlayer().SendPacket(Out); }
public override void SendMeTo(Player plr) { PacketOut Out = new PacketOut((byte)Opcodes.F_CREATE_STATIC, 128); Out.WriteUInt16(Oid); Out.WriteUInt16(0); Out.WriteUInt16(Heading); Out.WriteUInt16((ushort)WorldPosition.Z); Out.WriteUInt32((uint)WorldPosition.X); Out.WriteUInt32((uint)WorldPosition.Y); Out.WriteUInt16((ushort)_spawn.DisplayID); Out.WriteByte((byte)(_spawn.GetUnk(0) >> 8)); Out.WriteByte((byte)Realm); Out.WriteUInt16(_spawn.GetUnk(1)); Out.WriteUInt16(_spawn.GetUnk(2)); Out.WriteByte(_spawn.Unk1); int flags = _spawn.GetUnk(3); Out.WriteUInt16((ushort)flags); Out.WriteByte(_spawn.Unk2); Out.WriteUInt32(_spawn.Unk3); Out.WriteUInt16(_spawn.GetUnk(4)); Out.WriteUInt16(_spawn.GetUnk(5)); Out.WriteUInt32(_spawn.Unk4); Out.WritePascalString(Name); if (_spawn.DoorId != 0) { Out.WriteByte(0x04); Out.WriteUInt32(_spawn.DoorId); } else { Out.WriteByte(0x00); } plr.SendPacket(Out); base.SendMeTo(plr); }
public int HandlePacket(BaseClient client, PacketIn packet) { LobbyClient cclient = (LobbyClient)client; byte FileId = packet.GetUint8(); UInt32 Version = packet.GetUint32Reversed(); byte[] File = new byte[packet.Length - packet.Position]; packet.Read(File, 0, File.Length); File = ZlibMgr.Decompress(File); Log.Debug("ConfigSave", "Config saved! FileId = " + FileId + " | Version = " + Version + " | Size = " + File.Length); Program.FileMgr.SaveInfo((int)cclient.Account.Index, FileId, File); PacketOut Out = new PacketOut((UInt32)Opcodes.ANS_CONFIGFILE_SAVE); Out.WriteUInt32Reverse((uint)ResponseCodes.RC_SUCCESS); Out.WriteByte(FileId); Out.Write(File, 0, File.Length); cclient.Send(Out); return 0; }
public void SetLootable(bool Value, Player Looter) { PacketOut Out = new PacketOut((byte)Opcodes.F_UPDATE_STATE); Out.WriteUInt16(Oid); Out.WriteByte(9); Out.WriteByte((byte)(Value ? 1 : 0)); Out.Fill(0, 6); if (Looter != null) { Looter.SendPacket(Out); } else { DispatchPacket(Out, false); } }
public static void Send(LobbyClient client) { PacketOut Out = new PacketOut((UInt32)Opcodes.LOGIN_PUZZLE); if(Program.version == GameVersion.RTW_CB) { Out.WriteInt32Reverse(0); Out.WriteInt32Reverse(6); Out.WriteInt32Reverse(0); Out.WriteInt32Reverse(509927); } else if(Program.version == GameVersion.RTW_DVD) { Out.WriteInt32Reverse(1); Out.WriteInt32Reverse(1); Out.WriteInt32Reverse(0); Out.WriteInt32Reverse(534979); } else if (Program.version == GameVersion.RTW_LAST) { Out.WriteInt32Reverse(1); Out.WriteInt32Reverse(4); Out.WriteInt32Reverse(1); Out.WriteInt32Reverse(555239); } else if (Program.version == GameVersion.G1_LATEST) { Out.WriteInt32Reverse(1); Out.WriteInt32Reverse(19); Out.WriteInt32Reverse(4); Out.WriteInt32Reverse(766569); } else if (Program.version == GameVersion.G1_ENGUPD) { Out.WriteInt32Reverse(2); Out.WriteInt32Reverse(0); Out.WriteInt32Reverse(0); Out.WriteInt32Reverse(750394); } Out.WriteByte(0x05); for (int i = 0; i < client.ECrypt.Key.Length; i++) Out.WriteByte(client.ECrypt.Key[i]); Out.WriteUInt32Reverse(0); Out.WriteUInt32Reverse(0); Out.WriteUInt32Reverse(0); client.SendTCP(Out); }
public int HandlePacket(BaseClient client, PacketIn packet) { LobbyClient cclient = client as LobbyClient; Byte slot = packet.GetUint8(); foreach(CharacterEntry ch in cclient.Characters) { if(ch.Slot == slot) { cclient.Characters.Remove(ch); Databases.CharacterTable.Remove(ch); break; } } PacketOut Out = new PacketOut((UInt32)Opcodes.ANS_CHARACTER_DELETE); Out.WriteUInt32Reverse((uint)ResponseCodes.RC_SUCCESS); cclient.Send(Out); return 0; }
public int HandlePacket(BaseClient client, PacketIn packet) { WorldClient cclient = (WorldClient)client; PacketOut Out = new PacketOut((UInt32)Opcodes.LFG); if (cclient.Character.LFG == 0) { cclient.Character.LFG = 1; Databases.CharacterTable.Update(cclient.Character); Out.WriteByte(1); } else if (cclient.Character.LFG == 1) { cclient.Character.LFG = 0; Databases.CharacterTable.Update(cclient.Character); Out.WriteByte(0); } cclient.Send(Out); return 0; }
static public void Send(LobbyClient client) { PacketOut Out = new PacketOut((UInt32)Opcodes.WORLD_LIST); Out.WriteInt32Reverse((int)ResponseCodes.RC_SUCCESS); lock (Program.worldListener.Worlds) { Out.WriteUInt16Reverse((UInt16)Program.worldListener.Worlds.Count); foreach (KeyValuePair<UInt32, World.World> info in Program.worldListener.Worlds) { Out.WriteUInt32Reverse((UInt32)info.Key); Out.WriteParsedString(info.Value.Name, 32); Out.WriteByte(1); Out.WriteByte(info.Value.Population); Out.WriteByte(info.Value.EnforcerRecommended ? (Byte)1 : (Byte)0); Out.WriteByte(info.Value.CriminalRecommended ? (Byte)1 : (Byte)0); } } client.Send(Out); }
public int HandlePacket(BaseClient client, PacketIn packet) { LobbyClient cclient = client as LobbyClient; UInt32 WorldUid = packet.GetUint32Reversed(); string Name = packet.GetParsedString(); PacketOut Out = new PacketOut((UInt32)Opcodes.ANS_CHARACTER_NAME_CHECK); if (isValid(Name) && !cclient.Characters.Exists(Name)) { cclient.Pending = new Character(); cclient.Pending.Name = Name; cclient.Pending.WorldId = WorldUid; Out.WriteUInt32Reverse((uint)ResponseCodes.RC_SUCCESS); } else { cclient.Pending = null; Out.WriteUInt32Reverse((uint)ResponseCodes.RC_CHARACTER_NAME_CHECK_IN_USE); } cclient.Send(Out); return 0; }
public int HandlePacket(BaseClient client, PacketIn packet) { LobbyClient cclient = client as LobbyClient; byte slotId = packet.GetUint8(); CharacterEntry Info = Databases.CharacterTable.SingleOrDefault(c => c.AccountIndex == cclient.Account.Index && c.Slot == slotId); PacketOut Out = new PacketOut((UInt32)Opcodes.ANS_CHARACTER_INFO); if (Info.Index < 1) Out.WriteUInt32Reverse((uint)ResponseCodes.RC_FAILED); else { Out.WriteUInt32Reverse((uint)ResponseCodes.RC_SUCCESS); Out.WriteByte(Info.Slot); Out.WriteByte(Info.Gender); Out.WriteUInt32Reverse((uint)Info.Playtime); Out.WriteUInt32Reverse((uint)Info.Rank); Out.WriteByte(Info.Threat); Out.WriteUInt32Reverse((uint)Info.Money); Out.WriteParsedString(Info.Clan, 60); byte[] Custom = getCustom(Info); Out.Write(Custom, 0, Custom.Length); } cclient.Send(Out); return 0; }
static public void Send(LobbyClient client) { client.Characters = new Characters(client.Account.Id); PacketOut Out = new PacketOut((UInt32)Opcodes.CHARACTER_LIST); Out.WriteByte(client.Characters.Length); lock (Program.worldListener.Worlds) { foreach (KeyValuePair<Byte, Character> pair in client.Characters.List) { Out.WriteByte(pair.Value.Slot); Out.WriteByte(pair.Value.Faction); Out.WriteByte(1); Out.WriteUInt32Reverse(pair.Value.WorldId); World.World info = null; Program.worldListener.Worlds.TryGetValue(pair.Value.WorldId, out info); if (info != null) Out.WriteParsedString(info.Name, 32); else Out.WriteParsedString("(undefined)", 32); Out.WriteParsedString(pair.Value.Name, 32); } } client.Send(Out); if (client.Characters.Length <= 0) WORLD_LIST.Send(client); }
static public void Send(LobbyClient client) { client.Characters = Databases.CharacterTable.Select(c => c.AccountIndex == client.Account.Index); PacketOut Out = new PacketOut((UInt32)Opcodes.CHARACTER_LIST); Out.WriteByte((Byte)client.Characters.Count); lock (Program.worldListener.Worlds) { foreach (CharacterEntry chr in client.Characters) { Out.WriteByte(chr.Slot); Out.WriteByte(chr.Faction); Out.WriteByte(1); Out.WriteUInt32Reverse((uint)chr.World); World.World info = null; Program.worldListener.Worlds.TryGetValue((uint)chr.World, out info); if (info != null) Out.WriteParsedString(info.Name, 32); else Out.WriteParsedString("(undefined)", 32); Out.WriteParsedString(chr.Name, 32); } } client.Send(Out); if (client.Characters.Count <= 0) WORLD_LIST.Send(client); }
public int HandlePacket(BaseClient client, PacketIn packet) { WorldClient cclient = (WorldClient)client; UInt32 accountId = packet.GetUint32Reversed(); cclient.AccountId = accountId; Log.Debug("AskWorldEnter", "New client! Account = " + accountId); Acc account = null; lock (Program.expectingAccounts) Program.expectingAccounts.TryGetValue(accountId, out account); #region Character stuff MySqlCommand cmd = new MySqlCommand("SELECT * FROM `characters` WHERE `id` = @id", WorldServer.Database.Connection.Instance); try { cmd.Prepare(); cmd.Parameters.AddWithValue("@id", account.Character.ToString()); cmd.ExecuteNonQuery(); MySqlDataReader reader = cmd.ExecuteReader(); try { while (reader.Read()) { cclient.CharacterId = getID(reader); cclient.Name = getName(reader); cclient.Faction = getFaction(reader); cclient.Gender = getGender(reader); cclient.Rank = getRank(reader); cclient.Money = getMoney(reader); cclient.Threat = getThreat(reader); cclient.Playtime = getPlayTime(reader); cclient.Clan = getClan(reader); cclient.districtID = 0; cclient.districtType = 0; cclient.groupInvite = 0; cclient.groupStatus = 0; cclient.groupPublic = 0; } } catch (MySqlException e) { Log.Error("MySQL", e.ToString()); } finally { reader.Dispose(); } } catch (MySqlException e) { Log.Error("MySQL", e.ToString()); } finally { cmd.Dispose(); } #endregion #region Account stuff MySqlCommand cmd2 = new MySqlCommand("SELECT * FROM `accounts` WHERE `id` = @id", WorldServer.Database.Connection.Instance); try { cmd2.Prepare(); cmd2.Parameters.AddWithValue("@id", accountId.ToString()); cmd2.ExecuteNonQuery(); MySqlDataReader reader2 = cmd2.ExecuteReader(); try { while (reader2.Read()) { cclient.Email = getEmail(reader2); cclient.isGM = getGm(reader2); cclient.isBanned = getBanned(reader2); cclient.Points = getPoints(reader2); } } catch (MySqlException e) { Log.Error("MySQL", e.ToString()); } finally { reader2.Dispose(); } } catch (MySqlException e) { Log.Error("MySQL", e.ToString()); } finally { cmd2.Dispose(); } #endregion #region Client status MySqlCommand cmd3 = new MySqlCommand("INSERT INTO `clientstatus` VALUES(@name, 0, 0, 1, 0, 0, 0, 0)", WorldServer.Database.Connection.Instance); try { cmd3.Prepare(); cmd3.Parameters.AddWithValue("@name", cclient.Name); cmd3.ExecuteNonQuery(); } catch (MySqlException e) { Log.Error("MySQL", e.ToString()); } finally { cmd3.Dispose(); } #endregion PacketOut Out = new PacketOut((UInt32)Opcodes.ANS_WORLD_ENTER); if (account == null) Out.WriteInt32Reverse((int)ResponseCodes.RC_FAILED); else { Out.WriteInt32Reverse((int)ResponseCodes.RC_SUCCESS); Out.WriteUInt32Reverse(account.Character); Out.WriteUInt32Reverse(cclient.Points); Out.WriteByte(cclient.isGM); Out.WriteInt64Reverse(TCPManager.GetTimeStamp()); Out.WriteFloat(5.00f); Out.WriteByte(0); Out.WriteByte(0); Out.WriteInt32Reverse(Program.FileMgr.GetFileVersion((int)accountId, 1, false, Program.WorldName, account.Character.ToString())); Out.WriteInt32Reverse(Program.FileMgr.GetFileVersion((int)accountId, 2, false, Program.WorldName, account.Character.ToString())); Out.WriteInt32Reverse(Program.FileMgr.GetFileVersion((int)accountId, 3, false, Program.WorldName, account.Character.ToString())); Out.WriteInt32Reverse(Program.FileMgr.GetFileVersion((int)accountId, 4, false, Program.WorldName, account.Character.ToString())); Out.WriteInt32Reverse(Program.FileMgr.GetFileVersion((int)accountId, 5, false, Program.WorldName, account.Character.ToString())); Out.WriteByte(1); Out.WriteByte(cclient.LFG); } cclient.Crypto = new TCP.Encryption(account.SessionId); cclient.Send(new DISTRICT_LIST()); cclient.Send(Out); return 0; }
public byte[] BuildCharacters() { PacketOut Out = new PacketOut((byte)0); Out.Position = 0; Out.WriteUInt16(GetCharacterCount()); Character Char = null; for (int i = 0; i < MAX_CHARS; ++i) { Char = Chars[i]; if (Char == null) Out.Write(new byte[280], 0, 280); else { Out.FillString(Char.Name, 48); Out.WriteByte(Char.Info[0].Level); Out.WriteByte(Char.Career); Out.WriteByte(Char.Realm); Out.WriteByte(Char.Sex); Out.WriteByte(Char.ModelId); Out.WriteUInt16(Char.Info[0].ZoneId); Out.Write(new byte[5], 0, 5); Character_items Item = null; for (UInt16 SlotId = 14; SlotId < 30; ++SlotId) { Item = Char.GetItemInSlot(SlotId); if (Item == null) Out.WriteUInt16(0); else Out.WriteUInt16Reverse(Item.ModelId); Out.Write(new byte[6], 0, 6); } Out.Write(new byte[6], 0, 6); for (int j = 0; j < 5; ++j) { Out.Write(new byte[6], 0, 6); Out.WriteUInt16(0xFF00); } for (UInt16 SlotId = 10; SlotId < 13; ++SlotId) { Item = Char.GetItemInSlot(SlotId); Out.WriteUInt16(0); if (Item == null) Out.WriteUInt16(0); else Out.WriteUInt16Reverse(Item.ModelId); } Out.Write(new byte[10], 0, 10); Out.WriteUInt16(0xFF00); Out.WriteByte(0); Out.WriteByte(Char.Race); Out.WriteUInt16(0); Out.Write(Char.bTraits, 0, Char.bTraits.Length); Out.Write(new byte[10], 0, 10); } } return Out.ToArray(); }
public byte[] BuildRealms(uint sequence) { try { PacketOut Out = new PacketOut((byte)0); Out.Position = 0; Out.WriteUInt32(sequence); Out.WriteUInt16(0); lock (_Realms) { Log.Info("BuildRealm", "Envoi de " + _Realms.Count + " royaumes"); Out.WriteUInt32((uint)_Realms.Count); foreach (Realm Rm in _Realms.Values) { Out.WriteByte(Rm.RealmId); Out.WriteByte((byte)(Rm.RpcId != 0 ? 1 : 0)); Out.WriteUInt32(1); Out.WriteByte(Rm.RealmId); Out.WriteByte(Rm.RealmId); Out.WriteString("[" + Rm.Language + "] " + Rm.Name); Out.WriteUInt32(19); Out.WriteString("setting.allow_trials"); Out.WriteString(Rm.AllowTrials); Out.WriteString("setting.charxferavailable"); Out.WriteString(Rm.CharfxerAvailable); Out.WriteString("setting.language"); Out.WriteString(Rm.Language); Out.WriteString("setting.legacy"); Out.WriteString(Rm.Legacy); Out.WriteString("setting.manualbonus.realm.destruction"); Out.WriteString(Rm.BonusDestruction); Out.WriteString("setting.manualbonus.realm.order"); Out.WriteString(Rm.BonusOrder); Out.WriteString("setting.name"); Out.WriteString(Rm.Name); Out.WriteString("setting.net.address"); Out.WriteString(Rm.Adresse); Out.WriteString("setting.net.port"); Out.WriteString(Rm.Port.ToString()); Out.WriteString("setting.redirect"); Out.WriteString(Rm.Redirect); Out.WriteString("setting.region"); Out.WriteString(Rm.Region); Out.WriteString("setting.retired"); Out.WriteString(Rm.Retired); Out.WriteString("status.queue.Destruction.waiting"); Out.WriteString(Rm.WaitingDestruction); Out.WriteString("status.queue.Order.waiting"); Out.WriteString(Rm.WaitingOrder); Out.WriteString("status.realm.destruction.density"); Out.WriteString(Rm.DensityDestruction); Out.WriteString("status.realm.order.density"); Out.WriteString(Rm.DensityOrder); Out.WriteString("status.servertype.openrvr"); Out.WriteString(Rm.OpenRvr); Out.WriteString("status.servertype.rp"); Out.WriteString(Rm.Rp); Out.WriteString("status.status"); Out.WriteString(Rm.Status); } } Out.WriteUInt32(0); return Out.ToArray(); } catch (Exception e) { return new byte[0]; } }