static public void HandlePacket(BaseClient client, PacketIn packet) { LobbyClient cclient = client as LobbyClient; byte freeslot = Program.CharMgr.GetFreeSlot(cclient.Account.Id); if (freeslot == 0 || cclient.CreateChar == null) { ANS_CHARACTER_CREATE.Send(cclient); } else { cclient.CreateChar.SlotId = freeslot; cclient.CreateChar.Faction = packet.GetUint8(); cclient.CreateChar.Gender = packet.GetUint8(); cclient.CreateChar.Version = (int)packet.GetUint32R(); cclient.CreateChar.Seconds = (int)packet.GetUint32R(); byte[] Custom = new byte[packet.Length - packet.Position]; packet.Read(Custom, 0, Custom.Length); cclient.CreateChar.Custom = BitConverter.ToString(Custom); Program.CharMgr.CreateCharacter(cclient.CreateChar); ANS_CHARACTER_CREATE.Send(cclient); } }
protected override void OnReceive(byte[] Packet) { lock (this) { PacketIn packet = new PacketIn(Packet, 0, Packet.Length); packet.Size = packet.GetUint32R(); packet = DeCrypt(packet); packet.Opcode = packet.GetUint32R(); Server.HandlePacket(this, packet); } }
static public void HandlePacket(BaseClient client, PacketIn packet) { LobbyClient cclient = (LobbyClient)client; UInt32 WorldUid = packet.GetUint32R(); string Name = packet.GetUnicodeString(); PacketOut Out = new PacketOut((UInt32)Opcodes.ANS_CHARACTER_NAME_CHECK); if (CheckName(Name) == 0) { cclient.CreateChar = new DBCharacter(); cclient.CreateChar.AcctId = cclient.Account.Id; cclient.CreateChar.Name = Name; if (cclient.Account.WorldId != WorldUid) { Program.CharMgr.SetAccountWorld(cclient.Account.Id, (int)WorldUid); } Out.WriteUInt32(0); } else { cclient.CreateChar = null; Out.WriteUInt32(1); } cclient.SendTCP(Out); }
static public void HandlePacket(BaseClient client, PacketIn packet) { WorldClient cclient = (WorldClient)client; UInt32 AcctId = packet.GetUint32R(); Log.Debug("AskWorldEnter", "New client, Account = " + AcctId); cclient.Account = Program.CharMgr.GetAccount((int)AcctId); cclient.Character = Program.CharMgr.GetInfoForEnter((int)AcctId); PacketOut Out = new PacketOut((UInt32)Opcodes.ANS_WORLD_ENTER); if (cclient.Account == null || cclient.Character == null) { Out.WriteInt32R(1); } else { Out.WriteInt32R(0); Out.WriteInt32R(cclient.Character.Character.Id); Out.WriteInt32R(cclient.Account.Points); // Points Out.WriteByte(1); Out.WriteInt64R(TCPManager.GetTimeStamp()); Out.WriteFloat(5.00f); // fMarketPlaceMinimumBidPct Out.WriteByte(0); // GroupPublic Out.WriteByte(0); // GroupInvite Out.WriteInt32R(Program.FileMgr.GetFileVersion(cclient.Account.Id, 1, false, Program.Config.WorldName, cclient.Character.Character.Name)); // ConfigFileVersion Out.WriteInt32R(Program.FileMgr.GetFileVersion(cclient.Account.Id, 2, false, Program.Config.WorldName, cclient.Character.Character.Name)); Out.WriteInt32R(Program.FileMgr.GetFileVersion(cclient.Account.Id, 3, false, Program.Config.WorldName, cclient.Character.Character.Name)); Out.WriteInt32R(Program.FileMgr.GetFileVersion(cclient.Account.Id, 4, false, Program.Config.WorldName, cclient.Character.Character.Name)); Out.WriteInt32R(Program.FileMgr.GetFileVersion(cclient.Account.Id, 5, false, Program.Config.WorldName, cclient.Character.Character.Name)); Out.WriteByte(1); // Tutorial Complete Out.WriteByte(0); // lookInForGroup } cclient.SendTCP(Out); }
static public void HandlePacket(BaseClient client, PacketIn packet) { LobbyClient cclient = (LobbyClient)client; byte FileId = packet.GetUint8(); UInt32 Version = packet.GetUint32R(); 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(cclient.Account.Id, FileId, File); PacketOut Out = new PacketOut((UInt32)Opcodes.ANS_CONFIGFILE_SAVE); Out.WriteUInt32R(0); Out.WriteByte(FileId); Out.Write(File, 0, File.Length); cclient.SendTCP(Out); }
public static void F_BAG_INFO(BaseClient client, PacketIn packet) { GameClient cclient = client as GameClient; if (!cclient.IsPlaying()) { return; } byte Type = packet.GetUint8(); Player Plr = cclient.Plr; switch (Type) { case 3: // Toggle Pvp ((CombatInterface_Player)Plr.CbtInterface).TogglePvPFlag(); break; case 16: // Buy more bag space { byte Price = packet.GetUint8(); if (!Plr.ItmInterface.HasMaxBag) { if (Plr.HasMoney(Plr.ItmInterface.GetBagPrice())) { if (Plr.RemoveMoney(Plr.ItmInterface.GetBagPrice())) { ++Plr.ItmInterface.BagBuy; Plr.ItmInterface.SendMaxInventory(Plr); } } } } break; case 17: // Buy more bank space { uint Price = packet.GetUint32R(); if (!Plr.ItmInterface.HasMaxBank) { if (Plr.HasMoney(Plr.ItmInterface.GetBankPrice())) { if (Plr.RemoveMoney(Plr.ItmInterface.GetBankPrice())) { ++Plr.ItmInterface.BankBuy; Plr.ItmInterface.SendMaxInventory(Plr); } } } } break; case 18: // Alternate Appereance { byte Slot = packet.GetUint8(); packet.Skip(2); ushort SlotItem = packet.GetUint16(); Plr.ItmInterface.HandleAltAppearance(Slot, SlotItem); } break; case 27: // Barber { packet.Skip(5); byte[] Traits = new byte[8]; packet.Read(Traits, 0, Traits.Length); Plr.Info.bTraits = Traits; CharMgr.Database.SaveObject(Plr.Info); } break; } }
public static void F_GUILD_COMMAND(BaseClient client, PacketIn packet) { GameClient cclient = client as GameClient; if (!cclient.IsPlaying() || !cclient.Plr.IsInWorld()) { return; } Player Plr = cclient.Plr; packet.Skip(2); UInt16 Target = packet.GetUint16(); // ? uint CharacterId = packet.GetUint32(); byte State = packet.GetUint8(); //Log.Info("state ",""+State); switch (State) { case 1: // Accepted Invite { if (Plr.GldInterface.invitedTo == null) { Plr.SendLocalizeString("", ChatLogFilters.CHATLOGFILTERS_USER_ERROR, GameData.Localized_text.TEXT_GUILD_INVITE_ERR_NOINVITE); return; } Plr.GldInterface.Guild = Plr.GldInterface.invitedTo; Plr.GldInterface.invitedTo = null; Plr.GldInterface.Guild.JoinGuild(Plr); } break; case 2: // Declined Invite { Plr.GldInterface.invitedTo = null; } break; case 3: // Leave Guild { if (!Plr.GldInterface.IsInGuild()) { return; } if (Plr.GldInterface.Guild.Info.LeaderId == Plr.CharacterId) { // wrong message Plr.SendLocalizeString("", ChatLogFilters.CHATLOGFILTERS_USER_ERROR, GameData.Localized_text.TEXT_ALLIANCE_INVITE_ERROR); return; } Guild_member GldMem = Plr.GldInterface.Guild.Info.Members[Plr.CharacterId]; Plr.GldInterface.Guild.LeaveGuild(GldMem, false); } break; case 5: // Promote { if (!Plr.GldInterface.IsInGuild()) { return; } Plr.GldInterface.Guild.PromoteMember(Plr, CharacterId); } break; case 6: // Demote { if (!Plr.GldInterface.IsInGuild()) { return; } Plr.GldInterface.Guild.DemoteMember(Plr, CharacterId); } break; case 7: // Assign as leader { if (!Plr.GldInterface.IsInGuild()) { return; } Plr.GldInterface.Guild.AssignLeader(Plr, CharacterId); } break; case 9: // Guild NPC { PacketOut Out = new PacketOut((byte)Opcodes.F_INTERACT_RESPONSE, 4); Out.WriteByte(0x0e); Out.WriteByte(1); Out.WriteByte(1); Out.WriteByte(0); Plr.SendPacket(Out); Log.Info("GUILd", "CREATE"); } break; case 10: // Create guild { packet.Skip(1); String name = packet.GetStringToZero(); if (Plr.GldInterface.IsInGuild()) { Plr.SendLocalizeString("", ChatLogFilters.CHATLOGFILTERS_USER_ERROR, GameData.Localized_text.TEXT_GUILDNPC_INVALIDREQ_GUILDED); } else if (Guild.GetGuild(name) != null) { Plr.SendLocalizeString("", ChatLogFilters.CHATLOGFILTERS_USER_ERROR, GameData.Localized_text.TEXT_GUILDNPC_BAD_NAME); } else if (Plr.GmLevel > 0) { new GuildInvitation(Plr, name); } else if (Plr.WorldGroup == null) { Plr.SendLocalizeString("", ChatLogFilters.CHATLOGFILTERS_USER_ERROR, GameData.Localized_text.TEXT_GUILDNPC_INVALIDREQ_NOTGROUPED); } else if (Plr.WorldGroup.GetLeader() != Plr) { Plr.SendLocalizeString("", ChatLogFilters.CHATLOGFILTERS_USER_ERROR, GameData.Localized_text.TEXT_GUILDNPC_INVALIDREQ_NOTLEADER); } else if (!Plr.WorldGroup.HasMaxMembers) { Plr.SendLocalizeString("", ChatLogFilters.CHATLOGFILTERS_USER_ERROR, GameData.Localized_text.TEXT_GUILDNPC_INVALIDREQ_NUMPLAYERS); } else { foreach (Player groupMember in Plr.WorldGroup.GetPlayerList()) { if (groupMember.GldInterface.IsInGuild()) { Plr.SendLocalizeString("", ChatLogFilters.CHATLOGFILTERS_USER_ERROR, GameData.Localized_text.TEXT_GUILDNPC_INVALIDREQ_GUILDED); return; } } new GuildInvitation(Plr, name); } } break; case 16: // Accepted Alliance Invite { if (Plr.GldInterface.AllianceinvitedTo > 0) // alli invite { Plr.GldInterface.Guild.JoinAlliance(Plr.GldInterface.AllianceinvitedTo); Plr.GldInterface.AllianceinvitedTo = 0; } else if (Plr.GldInterface.AllianceFormGuildId > 0) // alli form { Plr.GldInterface.Guild.FormAlliance(Plr.GldInterface.AllianceFormName, Plr.GldInterface.AllianceFormGuildId); Plr.GldInterface.AllianceFormGuildId = 0; Plr.GldInterface.AllianceFormName = ""; } else { Plr.SendLocalizeString("", ChatLogFilters.CHATLOGFILTERS_USER_ERROR, GameData.Localized_text.TEXT_GUILD_INVITE_ERR_NOINVITE); return; } } break; case 17: // Declined Alliance Invite { //CharMgr.GetCharacter().SendLocalizeString("", ChatLogFilters.CHATLOGFILTERS_SAY, GameData.Localized_text.TEXT_ALLIANCE_INVITE_DECLINED); Plr.GldInterface.AllianceinvitedTo = 0; } break; case 21: // buy tactic { if (!Plr.GldInterface.IsInGuild()) { return; } packet.Skip(1); string spell = packet.GetStringToZero(); Plr.GldInterface.Guild.TrainGuildTactics((byte)CharacterId, ushort.Parse(spell)); } break; case 22: // calendar create { if (!Plr.GldInterface.IsInGuild()) { return; } packet.Skip(156); UInt32 begin = packet.GetUint32(); UInt32 end = packet.GetUint32(); String name = packet.GetPascalString(); String description = packet.GetPascalString(); byte alliance = packet.GetUint8(); byte locked = packet.GetUint8(); Plr.GldInterface.Guild.CreateEvent(Plr.GetPlayer().CharacterId, begin, end, name, description, alliance, locked); } break; case 23: // calendar save { if (!Plr.GldInterface.IsInGuild()) { return; } packet.Skip(151); byte eventid = packet.GetUint8(); uint guildid = packet.GetUint32R(); UInt32 begin = packet.GetUint32(); UInt32 end = packet.GetUint32(); String name = packet.GetPascalString(); String description = packet.GetPascalString(); byte alliance = packet.GetUint8(); byte locked = packet.GetUint8(); Plr.GldInterface.Guild.EventEdit(Plr, eventid, guildid, begin, end, name, description, alliance, locked); } break; case 24: // calendar delete { if (!Plr.GldInterface.IsInGuild()) { return; } packet.Skip(151); byte eventid = packet.GetUint8(); uint guildid = packet.GetUint32R(); Plr.GldInterface.Guild.DeleteEvent(Plr, eventid, guildid); } break; case 25: // calendar signup { if (!Plr.GldInterface.IsInGuild()) { return; } packet.Skip(151); byte eventid = packet.GetUint8(); uint guildid = packet.GetUint32R(); Plr.GldInterface.Guild.EventSignup(Plr, eventid, guildid); } break; case 26: // calendar signup cancel { if (!Plr.GldInterface.IsInGuild()) { return; } packet.Skip(151); byte eventid = packet.GetUint8(); uint guildid = packet.GetUint32R(); Plr.GldInterface.Guild.EventSignupCancel(Plr, eventid, guildid); } break; case 27: // calendar signup kick { if (!Plr.GldInterface.IsInGuild()) { return; } packet.Skip(151); byte eventid = packet.GetUint8(); uint guildid = packet.GetUint32R(); uint characterid = packet.GetUint32R(); Plr.GldInterface.Guild.EventSignupKick(Plr, eventid, guildid, characterid); } break; case 28: // calendar signup approved { if (!Plr.GldInterface.IsInGuild()) { return; } packet.Skip(151); byte eventid = packet.GetUint8(); uint guildid = packet.GetUint32R(); uint charid = packet.GetUint32R(); Plr.GldInterface.Guild.EventSignupApproved(Plr, eventid, guildid, charid); } break; case 29: // banner save { packet.Skip(151); byte banner = packet.GetUint8(); byte post = packet.GetUint8(); packet.Skip(1); ushort spell1 = packet.GetUint16R(); packet.Skip(2); ushort spell2 = packet.GetUint16R(); packet.Skip(2); ushort spell3 = packet.GetUint16R(); Plr.GldInterface.Guild.SaveBanner((byte)(banner - 1), post, spell1, spell2, spell3); } break; case 30: // reserve banner { packet.Skip(151); ushort emblem = packet.GetUint16R(); ushort pattern = packet.GetUint16R(); byte color1 = packet.GetUint8(); byte color2 = packet.GetUint8(); byte shape = packet.GetUint8(); Plr.GldInterface.Guild.ReserveBanner(Plr, emblem, pattern, color1, color2, shape); } break; case 37: //close guild vault { Plr.GldInterface.Guild.GuildVaultClosed(Plr); } break; case 38: // Drop item to guild vault { packet.Skip(151); byte sourceVault = packet.GetUint8(); // will be > 0 if item transfer from player to vault ushort itemSlot = packet.GetUint16R(); packet.Skip(2); byte destVault = packet.GetUint8(); ushort slot = packet.GetUint16R(); //Log.Info("slot", "" + slot + " vault " + Vault+" unk:"+Itemslot); if (sourceVault != 0 && destVault != 0) { Plr.GldInterface.Guild.MoveVaultItem(Plr, sourceVault, itemSlot, destVault, slot); } else if (sourceVault == 0) { Plr.GldInterface.Guild.DepositVaultItem(Plr, destVault, slot, itemSlot); } else { Plr.GldInterface.Guild.WithdrawVaultItem(Plr, sourceVault, itemSlot, slot); } } break; case 39: // Deposit money to guild vault { packet.Skip(151); uint Money = packet.GetUint32R(); Plr.GldInterface.Guild.DepositMoney(Plr, Money); } break; case 40: // Withdraw money to guild vault { packet.Skip(151); uint Money = packet.GetUint32R(); Plr.GldInterface.Guild.WithdrawMoney(Plr, Money); } break; case 41: // Lock item in guild vault { packet.Skip(151); byte Vault = packet.GetUint8(); byte slot = packet.GetUint8(); // Log.Info("slot", "" + slot + " vault " + Vault); Plr.GldInterface.Guild.LockVaultItem(Plr, Vault, slot, 0); } break; case 42: // cancel guild vault item move { packet.Skip(151); byte Vault = packet.GetUint8(); byte slot = packet.GetUint8(); // Log.Info("slot", "" + slot + " vault " + Vault); Plr.GldInterface.Guild.ReleaseVaultItemLock(Plr, Vault, slot); } break; case 46: // Update recruit page save { if (!Plr.GldInterface.IsInGuild()) { return; } packet.Skip(152); String BriefDescription = packet.GetPascalString(); //might be ushort for size String Summary = packet.GetString(packet.GetUint16()); byte PlayStyle = packet.GetUint8(); byte Atmosphere = packet.GetUint8(); uint CareersNeeded = packet.GetUint32(); packet.Skip(3); byte RanksNeeded = packet.GetUint8(); packet.Skip(3); byte Interests = packet.GetUint8(); packet.Skip(3); byte ActivelyRecruiting = packet.GetUint8(); //packet.Skip(6); Plr.GldInterface.Guild.SetRecruitmentInfo(BriefDescription, Summary, PlayStyle, Atmosphere, CareersNeeded, RanksNeeded, Interests, ActivelyRecruiting); } break; case 47: // Search guilds { packet.Skip(151); byte Style = packet.GetUint8(); byte Atmosphere = packet.GetUint8(); packet.Skip(7); byte MyLevelCareer = packet.GetUint8(); packet.Skip(2); ushort Pop = packet.GetUint16(); packet.Skip(3); byte Online = packet.GetUint8(); packet.Skip(3); byte Rank = packet.GetUint8(); Plr.GldInterface.SendGuilds(Guild.GetGuilds(Plr.Realm, Style, Atmosphere, MyLevelCareer, Plr.Level, Plr.Info.Career, Pop, Online, Rank)); } break; case 52: // guild tactic respec { Plr.GldInterface.Guild.GuildsTacticRespec(Plr); } break; case 53: // Buy Guild Vault Slot { packet.Skip(151); byte Vault = packet.GetUint8(); uint Money = packet.GetUint32R(); // Log.Info("", "vault " + Vault+" prize"+Money); Plr.GldInterface.Guild.BuyVaultSlot(Plr, Vault, Money); } break; } }