static public void F_CONNECT(Connection conn, PacketIn packet) { Log.Debug("F_CONNECT"); packet.Skip(8); UInt32 Tag = packet.GetUint32(); string Token = packet.GetString(80); packet.Skip(21); string Username = packet.GetString(23); Log.Debug("New Connection : " + Token + ",User="******"Emulator"); Out.WriteByte(0); Out.WriteUInt16(0); conn.SendTCP(Out); }
static public void F_PLAYER_ENTER_FULL(BaseClient client, PacketIn packet) { GameClient cclient = client as GameClient; UInt16 SID; byte unk1, serverID, characterSlot; SID = packet.GetUint16(); unk1 = packet.GetUint8(); serverID = packet.GetUint8(); string CharName = packet.GetString(24); packet.Skip(2); string Language = packet.GetString(2); packet.Skip(4); characterSlot = packet.GetUint8(); Log.Success("F_PLAYER_ENTER_FULL", "Entrer en jeu de : " + CharName + ",Slot=" + characterSlot); if (Program.Rm.RealmId != serverID) { cclient.Disconnect(); } else { PacketOut Out = new PacketOut((byte)Opcodes.S_PID_ASSIGN); Out.WriteUInt16R((ushort)cclient.Id); cclient.SendTCP(Out); } }
public static void F_AUCTION_SEARCH_QUERY(BaseClient client, PacketIn packet) { GameClient cclient = (GameClient)client; if (!cclient.IsPlaying() || !cclient.Plr.IsInWorld()) { return; } Player plr = cclient.Plr; packet.Skip(3); byte NumOfSearches = packet.GetUint8(); // Why? packet.Skip(12); // Item Level byte MinLevel = packet.GetUint8(); byte MaxLevel = packet.GetUint8(); byte Rarity = packet.GetUint8(); byte career = packet.GetUint8(); packet.Skip(6); byte NumTypes = packet.GetUint8(); List <byte> Types = new List <byte>(); for (byte i = 0; i < NumTypes; i++) { Types.Add(packet.GetUint8()); } byte NumSlots = packet.GetUint8(); List <byte> Slots = new List <byte>(); for (byte i = 0; i < NumSlots; i++) { Slots.Add(packet.GetUint8()); } bool IsStatistic = packet.GetUint8() == 1; byte Stat = 0; if (IsStatistic) { Stat = packet.GetUint8(); } string SearchTerm = packet.GetPascalString(); string Character = packet.GetPascalString().Replace("^M", string.Empty).Replace("^F", string.Empty); AuctionHouse.SendAuctions(plr, SearchTerm, Character, MinLevel, MaxLevel, Rarity, career, Types, Slots, Stat); cclient.IsPlaying(); }
static public void F_CONNECT(BaseClient client, PacketIn packet) { GameClient cclient = client as GameClient; packet.Skip(8); UInt32 Tag = packet.GetUint32(); string Token = packet.GetString(80); packet.Skip(21); string Username = packet.GetString(23); // TODO AuthResult Result = Program.AcctMgr.CheckToken(Username, Token); if (Result != AuthResult.AUTH_SUCCESS) { Log.Error("F_CONNECT", "Invalid Token =" + Username); cclient.Disconnect(); } else { cclient._Account = Program.AcctMgr.GetAccount(Username); if (cclient._Account == null) { Log.Error("F_CONNECT", "Invalid Account =" + Username); cclient.Disconnect(); } else { //Log.Success("F_CONNECT", "MeId=" + cclient.Id); GameClient Other = (cclient.Server as TCPServer).GetClientByAccount(cclient, cclient._Account.AccountId); if (Other != null) { Other.Disconnect(); } { PacketOut Out = new PacketOut((byte)Opcodes.S_CONNECTED); Out.WriteUInt32(0); Out.WriteUInt32(Tag); Out.WriteByte(Program.Rm.RealmId); Out.WriteUInt32(0);// this was 1// setting this at 0 removes the server population box Out.WritePascalString(Username); Out.WritePascalString(Program.Rm.Name); Out.WriteByte(0); Out.WriteUInt16(0); cclient.SendPacket(Out); } } } }
static public void F_CONNECT(BaseClient client, PacketIn packet) { GameClient cclient = client as GameClient; packet.Skip(8); UInt32 Tag = packet.GetUint32(); string Token = packet.GetString(80); packet.Skip(21); string Username = packet.GetString(23); Log.Debug("Connect", "Connexion avec : " + Token + ",User="******"F_CONNECT", "MeId=" + cclient.Id); GameClient Other = (cclient.Server as TCPServer).GetClientByAccount(cclient, cclient._Account.AccountId); if (Other != null) { Other.Disconnect(); } PacketOut Out = new PacketOut((byte)Opcodes.S_CONNECTED); Out.WriteUInt32(0); Out.WriteUInt32(Tag); Out.WriteByte(Program.Rm.RealmId); Out.WriteUInt32(0); Out.WritePascalString(Username); Out.WritePascalString(Program.Rm.Name); Out.WriteByte(0); Out.WriteUInt16(0); cclient.SendTCP(Out); } } }
public int HandlePacket(BaseClient bcclient, PacketIn packet) { LobbyClient client = bcclient as LobbyClient; packet.Skip(25); string Username = packet.GetParsedString(); Log.Notice("ASK_LOGIN", "Account: " + Username); try { client.Account = Databases.AccountTable.SingleOrDefault(a => a.Username == Username); if (client.Account.Verifier.Length <= 2 || client.Account.Salt.Length <= 2) { Register(client); } client.Salt = new FrameWork.NetWork.Crypto.BigInteger(client.Account.Salt, 16).ToByteArrayUnsigned(); client.Verifier = new FrameWork.NetWork.Crypto.BigInteger(client.Account.Verifier, 16); Log.Succes("ASK_LOGIN", "Account exists: " + client.Account.Username); LOGIN_SALT.Send(client); } catch (ArgumentNullException) { Log.Error("ASK_LOGIN", "Database is busy"); LOGIN_FAILED.Send(client, (int)ResponseCodes.RC_DATABASE_BUSY); client.Disconnect(); } catch (Exception e) { Log.Error("ASK_LOGIN", "Account is not found"); Log.Debug("ASK_LOGIN", e.ToString()); LOGIN_FAILED.Send(client, (int)ResponseCodes.RC_LOGIN_INVALID_ACCOUNT); client.Disconnect(); } return(0); }
protected override void OnReceive(byte[] Packet) { lock (this) { PacketIn packet = new PacketIn(Packet, 0, Packet.Length); long byteLeft = packet.Length; while (byteLeft > 0) { if (!m_expectData) { long StartPos = packet.Position; m_expectSize = packet.DecodeMythicSize(); long EndPos = packet.Position; long Diff = EndPos - StartPos; byteLeft -= Diff; if (m_expectSize <= 0) { return; } if (byteLeft <= 0) { return; } Opcode = packet.GetUint8(); byteLeft -= 1; m_expectData = true; } else { m_expectData = false; if (byteLeft >= m_expectSize) { long Pos = packet.Position; packet.Opcode = Opcode; packet.Size = (ulong)m_expectSize; _srvr.HandlePacket(this, packet); byteLeft -= m_expectSize; packet.Position = Pos; packet.Skip(m_expectSize); } else { Log.Error("OnReceive", "Data count incorrect :" + byteLeft + " != " + m_expectSize); } } } packet.Dispose(); } }
static public void HandlePacket(BaseClient client, PacketIn packet) { LobbyClient cclient = client as LobbyClient; packet.Skip(24); string Email = packet.GetUnicodeString().ToUpper(); Log.Notice("ASK_LOGIN", "Authentification de : " + Email); SendLoginResult(cclient, Email, Program.CharMgr.LoadAccount(Email)); }
public static void F_AUCTION_POST_ITEM(BaseClient client, PacketIn packet) { GameClient cclient = (GameClient)client; if (!cclient.IsPlaying() || !cclient.Plr.IsInWorld()) { return; } Player plr = cclient.Plr; if (AuctionHouse.PlayerAuctionCount(plr.CharacterId) >= AuctionHouse.MAX_AUCTIONS_PER_CHAR) { plr.SendMessage("You have reached the maximum of " + AuctionHouse.MAX_AUCTIONS_PER_CHAR + " auctions.", ChatLogFilters.CHATLOGFILTERS_USER_ERROR); return; } ushort slot = packet.GetUint16(); packet.Skip(2); uint price = packet.GetUint32(); if (plr.ItmInterface.GetItemInSlot(slot) == null) { return; } if (plr.ItmInterface.GetItemInSlot(slot).BoundtoPlayer || plr.ItmInterface.GetItemInSlot(slot).Info.Bind == 1) { plr.SendLocalizeString(plr.ItmInterface.GetItemInSlot(slot).Info.Name, ChatLogFilters.CHATLOGFILTERS_USER_ERROR, GameData.Localized_text.TEXT_AUCTION_ITEM_IS_BOUND); return; } Auction auction = new Auction { Item = plr.ItmInterface.GetItemInSlot(slot).Info, ItemId = plr.ItmInterface.GetItemInSlot(slot).Info.Entry, _Talismans = plr.ItmInterface.GetItemInSlot(slot).GetTalismans(), PrimaryDye = plr.ItmInterface.GetItemInSlot(slot).GetPrimaryDye(), SecondaryDye = plr.ItmInterface.GetItemInSlot(slot).GetSecondaryDye(), Count = plr.ItmInterface.GetItemInSlot(slot).Count, Seller = plr.Info, SellerId = plr.CharacterId, SellPrice = price, StartTime = (uint)TCPManager.GetTimeStamp(), Realm = plr.Info.Realm, AuctionId = (uint)AuctionHouse.GenerateAuctionGUID() }; AuctionHouse.AddAuction(auction); plr.ItmInterface.DeleteItem(slot); }
static public void F_PLAYER_INFO(BaseClient client, PacketIn packet) { GameClient cclient = client as GameClient; if (cclient.Plr == null) { return; } if (!cclient.Plr.IsInWorld()) { return; } packet.Skip(2); UInt16 Oid = packet.GetUint16(); packet.Skip(1); byte Faction = packet.GetUint8(); cclient.Plr.CbtInterface.SetTarget(cclient.Plr.Region.GetObject(Oid) as Unit); }
public static void F_PLAYER_ENTER_FULL(BaseClient client, PacketIn packet) { GameClient cclient = (GameClient)client; ushort SID; byte unk1, serverID, characterSlot; SID = packet.GetUint16(); unk1 = packet.GetUint8(); serverID = packet.GetUint8(); string CharName = packet.GetString(24); packet.Skip(2); string Language = packet.GetString(2); packet.Skip(4); characterSlot = packet.GetUint8(); Log.Debug("F_PLAYER_ENTER_FULL", "Enter the game : " + CharName + ",Slot=" + characterSlot); if (Program.Rm.RealmId != serverID) { cclient.Disconnect("Requested realm ID does not match this server's ID"); } else { PacketOut Out = new PacketOut((byte)Opcodes.S_PID_ASSIGN, 2); Out.WriteUInt16R((ushort)cclient.Id); cclient.SendPacket(Out); if (cclient.Plr != null) { cclient.Plr.DisconnectType = Player.EDisconnectType.Unclean; } } }
public static void F_SWITCH_ATTACK_MODE(BaseClient client, PacketIn packet) { GameClient cclient = (GameClient)client; if (!cclient.HasPlayer()) { return; } if (cclient.Plr.WeaponStance != WeaponStance.Standard) { packet.Skip(1); cclient.Plr.WeaponStance = (WeaponStance)packet.ReadByte(); } cclient.Plr.CbtInterface.IsAttacking = !cclient.Plr.CbtInterface.IsAttacking; }
public int HandlePacket(BaseClient bcclient, PacketIn packet) { LobbyClient client = bcclient as LobbyClient; packet.Skip(24); String Email = packet.GetParsedString(); Log.Notice("ASK_LOGIN", "Account: " + Email); Account account; try { account = new Account(Email); } catch (ArgumentNullException) { Log.Error("ASK_LOGIN", "Database is busy"); ANS_LOGIN_FAILED.Send(client, (int)ResponseCodes.RC_DATABASE_BUSY); client.Disconnect(); return 0; } catch (Exception e) { Log.Error("ASK_LOGIN", "Account's not found"); Log.Debug("ASK_LOGIN", e.ToString()); ANS_LOGIN_FAILED.Send(client, (int)ResponseCodes.RC_LOGIN_INVALID_ACCOUNT); client.Disconnect(); return 0; } Log.Succes("ASK_LOGIN", "Account exists"); client.Account = account; if (client.Account.extrn_login == 1) { if (client.Account.Verifier.Length <= 2 || client.Account.Salt.Length <= 2) Register(client); client.Salt = new FrameWork.NetWork.Crypto.BigInteger(client.Account.Salt, 16).ToByteArrayUnsigned(); client.Verifier = new FrameWork.NetWork.Crypto.BigInteger(client.Account.Verifier, 16); LOGIN_SALT.Send(client); return 0; } else { ANS_LOGIN_FAILED.Send(client, (int)ResponseCodes.RC_LOGIN_APB_INACTIVATED); client.Disconnect(); return 0; } }
public static void F_PLAYERORG_APPROVAL(BaseClient client, PacketIn packet) { GameClient cclient = client as GameClient; if (!cclient.IsPlaying() || !cclient.Plr.IsInWorld()) { return; } packet.Skip(1); Boolean accepted = packet.GetUint8() == 1; Player Plr = cclient.Plr; if (Plr.GldInterface.invite == null) { return; } Plr.GldInterface.invite.InviteResponse(Plr, accepted); }
static public void F_RENAME_CHARACTER(BaseClient client, PacketIn packet) { GameClient cclient = client as GameClient; packet.Skip(3); string OldName = packet.GetString(24); string NewName = packet.GetString(24); Log.Success("F_RENAME_CHARACTER", "Renaming: '" + OldName + "' To: '" + NewName + "'"); if (NewName.Length > 2 && !CharMgr.NameIsUsed(NewName)) { Character Char = CharMgr.GetCharacter(OldName); if (Char == null || Char.AccountId != cclient._Account.AccountId) { Log.Error("CharacterRename", "Hack: Tried to rename character which account dosen't own"); cclient.Disconnect(); return; } Char.Name = NewName; CharMgr.Database.SaveObject(Char); // Wrong response? Perhaps needs to send F_REQUEST_CHAR_RESPONSE again. PacketOut Out = new PacketOut((byte)Opcodes.F_SEND_CHARACTER_RESPONSE); Out.WritePascalString(cclient._Account.Username); cclient.SendPacket(Out); } else { // Wrong response? PacketOut Out = new PacketOut((byte)Opcodes.F_SEND_CHARACTER_ERROR); Out.WritePascalString(cclient._Account.Username); cclient.SendPacket(Out); } }
public static void F_AUCTION_BID_ITEM(BaseClient client, PacketIn packet) { GameClient cclient = (GameClient)client; if (!cclient.IsPlaying() || !cclient.Plr.IsInWorld()) { return; } uint price = packet.GetUint32(); packet.GetUint32(); // unk // item id // 10 bytes which are sent along with the item list, might be a very long number however lets take the first 8 ulong Id = packet.GetUint64(); packet.Skip(2); // last byte ranges from 01 - 03? a flag? packet.GetUint32(); // unk AuctionHouse.BuyOutAuction(cclient.Plr, Id, price); }
static public void F_SOCIAL_NETWORK(BaseClient client, PacketIn packet) { GameClient cclient = client as GameClient; if (!cclient.IsPlaying() || !cclient.Plr.IsInWorld()) { return; } Player Plr = cclient.Plr; byte Type = packet.GetUint8(); switch (Type) { case 11: // Inspection { Player Target = Plr.CbtInterface.GetTarget() as Player; if (Target == null) { Plr.SendLocalizeString("", GameData.Localized_text.TEXT_SN_LISTS_ERR_PLAYER_NOT_FOUND); } else { Target.ItmInterface.SendInspect(Plr); } } break; case 8: { packet.Skip(1); byte NameSize = packet.GetUint8(); packet.Skip(1); string Name = packet.GetString(NameSize); byte GuildSize = packet.GetUint8(); packet.Skip(1); string GuildName = packet.GetString(GuildSize); packet.Skip(1); UInt16 Career = packet.GetUint16(); packet.Skip(4); UInt16 ZoneId = packet.GetUint16(); while (ZoneId > 256) { ZoneId -= 256; } while (packet.GetUint8() != 0xFF) { ; } packet.Skip(2 + (ZoneId == 255 ? 0 : 1)); byte MinLevel = packet.GetUint8(); byte MaxLevel = packet.GetUint8(); Plr.SocInterface.SendPlayers(Player.GetPlayers(Name, GuildName, Career, ZoneId, MinLevel, MaxLevel)); } 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; } }
public static void F_INTERACT_QUEUE(BaseClient client, PacketIn packet) { GameClient cclient = (GameClient)client; if (!cclient.IsPlaying() || !cclient.Plr.IsInWorld()) { return; } Player player = cclient.Plr; packet.Skip(5); byte command = packet.GetUint8(); ushort scenarioId = packet.GetUint16(); switch (command) { case 1: // signed up if (!player.ScnInterface.IsBlocked()) { WorldMgr.ScenarioMgr.EnqueuePlayer(player, scenarioId); } break; case 2: // leave queue player.ScnInterface.PendingScenario?.EnqueueScenarioAction(new ScenarioQueueAction(EScenarioQueueAction.RemovePendingPlayer, player)); if (scenarioId != 0) { if (player.WorldGroup != null) { WorldMgr.ScenarioMgr.DequeueGroup(player.WorldGroup, scenarioId); } WorldMgr.ScenarioMgr.DequeuePlayer(player, scenarioId); } break; case 3: // click join scenario if (player.ScnInterface.PendingScenario == null) { player.SendClientMessage("Scenario join failure: No pending scenario.", ChatLogFilters.CHATLOGFILTERS_USER_ERROR); } else { player.ScnInterface.PendingScenario?.EnqueueScenarioAction(new ScenarioQueueAction(EScenarioQueueAction.AddPlayer, player)); } break; case 4: //give me more time player.ScnInterface.PendingScenario?.EnqueueScenarioAction(new ScenarioQueueAction(EScenarioQueueAction.AddPendingPlayer, player)); break; case 7: // group queue if (player.WorldGroup == null) { break; } WorldMgr.ScenarioMgr.EnqueueGroup(player.WorldGroup, scenarioId); // 7: "No bracket for your current level." // 9: "Not all players same bracket." // 10: "Just Leveled" // 11: "Just Leveled with prompt" // 12: "Rank too low" // 13: "Rank too high" // 14: "RR too low" // 16: Instance full // 17: // 19: Trial Account Blocked break; } }
static public void F_CREATE_CHARACTER(BaseClient client, PacketIn packet) { GameClient cclient = client as GameClient; CreateInfo Info; Info.slot = packet.GetUint8(); Info.race = packet.GetUint8(); Info.career = packet.GetUint8(); Info.sex = packet.GetUint8(); Info.model = packet.GetUint8(); Info.NameSize = packet.GetUint16(); packet.Skip(2); byte[] Traits = new byte[8]; packet.Read(Traits, 0, Traits.Length); packet.Skip(7); string Name = packet.GetString(Info.NameSize); if (!CharMgr.NameIsUsed(Name)) { CharacterInfo CharInfo = CharMgr.GetCharacterInfo(Info.career); if (CharInfo == null) { Log.Error("ON_CREATE", "Can not find career :" + Info.career); return; } Log.Success("OnCreate", "Creating new Character : " + Name); Character Char = new Character(); Char.AccountId = cclient._Account.AccountId; Char.bTraits = Traits; Char.Career = Info.career; Char.CareerLine = CharInfo.CareerLine; Char.ModelId = Info.model; Char.Name = Name; Char.Race = Info.race; Char.Realm = CharInfo.Realm; Char.RealmId = Program.Rm.RealmId; Char.Sex = Info.sex; if (!CharMgr.CreateChar(Char)) { Log.Error("CreateCharacter", "Hack : can not create more than 10 characters!"); return; } Character_items Citm = null; CharacterInfo_item[] Items = CharMgr.GetCharacterInfoItem(Char.CareerLine); for (int i = 0; i < Items.Length; ++i) { if (Items[i] == null) { continue; } Citm = new Character_items(); Citm.Counts = Items[i].Count; Citm.CharacterId = Char.CharacterId; Citm.Entry = Items[i].Entry; Citm.ModelId = Items[i].ModelId; Citm.SlotId = Items[i].SlotId; CharMgr.CreateItem(Citm); } Character_value CInfo = new Character_value(); CInfo.CharacterId = Char.CharacterId; CInfo.Level = 1; CInfo.Money = 0; CInfo.Online = false; CInfo.RallyPoint = CharInfo.RallyPt; CInfo.RegionId = CharInfo.Region; CInfo.Renown = 0; CInfo.RenownRank = 1; CInfo.RestXp = 0; CInfo.Skills = CharInfo.Skills; CInfo.Speed = 100; CInfo.WorldO = CharInfo.WorldO; CInfo.WorldX = CharInfo.WorldX; CInfo.WorldY = CharInfo.WorldY; CInfo.WorldZ = CharInfo.WorldZ; CInfo.Xp = 0; CInfo.ZoneId = CharInfo.ZoneId; CharMgr.Database.AddObject(CInfo); Char.Value = new Character_value[1] { CInfo }; } PacketOut Out = new PacketOut((byte)Opcodes.F_SEND_CHARACTER_RESPONSE); Out.WritePascalString(cclient._Account.Username); cclient.SendTCP(Out); }
static public void F_MAIL(BaseClient client, PacketIn packet) { GameClient cclient = client as GameClient; if (!cclient.IsPlaying() || !cclient.Plr.IsInWorld()) { return; } Player Plr = cclient.Plr; byte Type = packet.GetUint8(); switch (Type) { case 0: // Mailbox closed { } break; case 1: // Mail sent { Plr.MlInterface.BuildMail(packet); } break; case 2: // Open mail case 3: // Return mail case 4: // Delete mail case 5: // Mark as read/unread case 7: // Take Item case 8: // Take money { byte Page = packet.GetUint8(); UInt32 Guid = ByteOperations.ByteSwap.Swap(packet.GetUint32()); Character_mail Mail = Plr.MlInterface.GetMail(Guid); switch (Type) { case 2: if (!Mail.Opened) { Mail.Opened = true; CharMgr.SaveMail(Mail); Plr.MlInterface.SendMailCounts(); Plr.MlInterface.SendMailBox(); } Plr.MlInterface.SendMail(Mail); break; case 3: //TODO Plr.MlInterface.SendResult(GameData.MailResult.TEXT_MAIL_RESULT11); break; case 4: Plr.MlInterface.RemoveMail(Mail); Plr.MlInterface.SendMailCounts(); Plr.MlInterface.SendMailBox(); break; case 5: packet.Skip(4); Mail.Opened = (packet.GetUint8() == 1); CharMgr.SaveMail(Mail); Plr.MlInterface.SendMailCounts(); Plr.MlInterface.SendMailBox(); break; case 7: packet.Skip(4); byte itemnum = packet.GetUint8(); if (Mail.Items.Count < itemnum + 1) { return; } UInt16 FreeSlot = Plr.ItmInterface.GetFreeInventorySlot(); if (FreeSlot == 0) { Plr.SendLocalizeString("", GameData.Localized_text.TEXT_OVERAGE_CANT_TAKE_ATTACHMENTS); return; } KeyValuePair <uint, ushort> item = Mail.Items.ElementAt(itemnum); Plr.ItmInterface.CreateItem(item.Key, item.Value); Mail.Items.Remove(item); CharMgr.SaveMail(Mail); Plr.MlInterface.SendMailUpdate(Mail); Plr.MlInterface.SendMail(Mail); break; case 8: if (Mail.Money > 0) { Plr.AddMoney(Mail.Money); Mail.Money = 0; } // Take as many items as you can before inventory is full List <KeyValuePair <uint, ushort> > ToRemove = new List <KeyValuePair <uint, ushort> >(); foreach (KeyValuePair <uint, ushort> curritem in Mail.Items) { UInt16 Slot = Plr.ItmInterface.GetFreeInventorySlot(); if (Slot == 0) { Plr.SendLocalizeString("", GameData.Localized_text.TEXT_OVERAGE_CANT_TAKE_ATTACHMENTS); break; } Plr.ItmInterface.CreateItem(curritem.Key, curritem.Value); ToRemove.Add(curritem); } foreach (KeyValuePair <uint, ushort> remove in ToRemove) { Mail.Items.Remove(remove); } CharMgr.SaveMail(Mail); Plr.MlInterface.SendMailUpdate(Mail); Plr.MlInterface.SendMail(Mail); break; } } break; } }
public void MailInteract(MailInteractType type, uint guid, PacketIn packet) { lock (_lockObject) { Character_mail mail = _mails.FirstOrDefault(match => match.Guid == guid); if (mail == null) { return; } switch (type) { case MailInteractType.OpenMail: if (!mail.Opened) { if (mail.ReadDate == 0) { mail.ReadDate = (uint)TCPManager.GetTimeStamp(); } mail.Opened = true; SendMailCount(); SendMailBox(); } SendMail(mail); break; case MailInteractType.ReturnMail: SendResult(ReturnMail(mail)); SendMailCount(); SendMailBox(); break; case MailInteractType.DeleteMail: CharMgr.DeleteMail(mail); SendMailCount(); SendMailBox(); break; case MailInteractType.ChangeReadMarker: packet.Skip(4); mail.Opened = packet.GetUint8() == 1; SendMailCount(); SendMailBox(); break; case MailInteractType.TakeItem: if (mail.Cr && mail.Money > 0) { if (!_Owner.GetPlayer().RemoveMoney(mail.Money)) { _Owner.GetPlayer().SendLocalizeString("", ChatLogFilters.CHATLOGFILTERS_USER_ERROR, Localized_text.TEXT_AUCTION_NOT_ENOUGH_MONEY); return; } MailHandlers.SendCOD(mail.SenderName, _Owner.GetPlayer(), mail.Money); mail.Money = 0; } packet.Skip(4); byte itemnum = packet.GetUint8(); if (mail.Items.Count < itemnum + 1) { return; } MailItem item = mail.Items.ElementAt(itemnum); ushort freeSlot = _Owner.GetPlayer().ItmInterface.GetFreeInventorySlot(ItemService.GetItem_Info(item.id), false); if (freeSlot == 0) { _Owner.GetPlayer().SendLocalizeString("", ChatLogFilters.CHATLOGFILTERS_USER_ERROR, Localized_text.TEXT_OVERAGE_CANT_TAKE_ATTACHMENTS); return; } _Owner.GetPlayer().ItmInterface.CreateItem(ItemService.GetItem_Info(item.id), item.count, item.talisman, item.primary_dye, item.secondary_dye, false); mail.Items.Remove(item); mail.Dirty = true; CharMgr.Database.SaveObject(mail); SendMailUpdate(mail); SendMail(mail); break; case MailInteractType.TakeAll: if (mail.Money > 0) { if (mail.Cr) { if (!_Owner.GetPlayer().RemoveMoney(mail.Money)) { _Owner.GetPlayer().SendLocalizeString("", ChatLogFilters.CHATLOGFILTERS_USER_ERROR, Localized_text.TEXT_AUCTION_NOT_ENOUGH_MONEY); return; } MailHandlers.SendCOD(mail.SenderName, _Owner.GetPlayer(), mail.Money); } else { _Owner.GetPlayer().AddMoney(mail.Money); } mail.Money = 0; } // Take as many items as you can before inventory is full List <MailItem> toRemove = new List <MailItem>(); foreach (MailItem curritem in mail.Items) { ushort slot = _Owner.GetPlayer().ItmInterface.GetFreeInventorySlot(ItemService.GetItem_Info(curritem.id)); if (slot == 0) { _Owner.GetPlayer().SendLocalizeString("", ChatLogFilters.CHATLOGFILTERS_USER_ERROR, Localized_text.TEXT_OVERAGE_CANT_TAKE_ATTACHMENTS); break; } _Owner.GetPlayer().ItmInterface.CreateItem(ItemService.GetItem_Info(curritem.id), curritem.count, curritem.talisman, curritem.primary_dye, curritem.secondary_dye, false); toRemove.Add(curritem); } foreach (MailItem remove in toRemove) { mail.Items.Remove(remove); } mail.Dirty = true; CharMgr.Database.SaveObject(mail); SendMailUpdate(mail); SendMail(mail); break; } } }
public static void F_CREATE_CHARACTER(BaseClient client, PacketIn packet) { GameClient cclient = (GameClient)client; CreateInfo Info; Info.slot = packet.GetUint8(); Info.race = packet.GetUint8(); Info.career = packet.GetUint8(); Info.sex = packet.GetUint8(); Info.model = packet.GetUint8(); Info.NameSize = packet.GetUint16(); packet.Skip(2); byte[] traits = new byte[8]; packet.Read(traits, 0, traits.Length); packet.Skip(7); string name = packet.GetString(Info.NameSize); ushort duplicate = 0; for (int i = 0; i < name.Length; i++) { if (i != 0) { if (name[i] == name[i - 1]) { duplicate++; } else { duplicate = 0; } if (duplicate > 3) { break; } } } if (name.Length > 2 && !CharMgr.NameIsUsed(name) && CharMgr.AllowName(name) && !CharMgr.NameIsDeleted(name) && duplicate < 3) { CharacterInfo CharInfo = CharMgr.GetCharacterInfo(Info.career); if (CharInfo == null) { Log.Error("ON_CREATE", "Can not find career :" + Info.career); } else { //Log.Success("OnCreate", "New Character : " + Name); Character Char = new Character { AccountId = cclient._Account.AccountId, bTraits = traits, Career = Info.career, CareerLine = CharInfo.CareerLine, ModelId = Info.model, Name = name, Race = Info.race, Realm = CharInfo.Realm, RealmId = Program.Rm.RealmId, Sex = Info.sex, FirstConnect = true }; if (!CharMgr.CreateChar(Char)) { Log.Error("CreateCharacter", "Hack : can not create more than 10 characters!"); } else { List <CharacterInfo_item> Items = CharMgr.GetCharacterInfoItem(Char.CareerLine); foreach (CharacterInfo_item Itm in Items) { if (Itm == null) { continue; } CharacterItem Citm = new CharacterItem { Counts = Itm.Count, CharacterId = Char.CharacterId, Entry = Itm.Entry, ModelId = Itm.ModelId, SlotId = Itm.SlotId, PrimaryDye = 0, SecondaryDye = 0 }; CharMgr.CreateItem(Citm); } Character_value CInfo = new Character_value { CharacterId = Char.CharacterId, Level = 1, Money = 2000, Online = false, RallyPoint = CharInfo.RallyPt, RegionId = CharInfo.Region, Renown = 0, RenownRank = 1, RestXp = 0, Skills = CharInfo.Skills, Speed = 100, PlayedTime = 0, WorldO = CharInfo.WorldO, WorldX = CharInfo.WorldX, WorldY = CharInfo.WorldY, WorldZ = CharInfo.WorldZ, Xp = 0, ZoneId = CharInfo.ZoneId }; CharMgr.Database.AddObject(CInfo); Program.AcctMgr.UpdateRealmCharacters(Program.Rm.RealmId, (uint)CharMgr.Database.GetObjectCount <Character>(" Realm=1"), (uint)CharMgr.Database.GetObjectCount <Character>(" Realm=2")); CharacterClientData clientData = new CharacterClientData { CharacterId = Char.CharacterId }; CharMgr.Database.AddObject(clientData); Char.Value = CInfo; Char.ClientData = clientData; PacketOut Out = new PacketOut((byte)Opcodes.F_SEND_CHARACTER_RESPONSE, 32); Out.WritePascalString(cclient._Account.Username); cclient.SendPacket(Out); } } } else { PacketOut Out = new PacketOut((byte)Opcodes.F_SEND_CHARACTER_ERROR, 64); Out.FillString(cclient._Account.Username, 24); Out.WriteStringBytes("You have entered a duplicate or invalid name. Please enter a new name."); cclient.SendPacket(Out); } }
static public void F_CREATE_CHARACTER(BaseClient client, PacketIn packet) { GameClient cclient = client as GameClient; CreateInfo Info; Info.slot = packet.GetUint8(); Info.race = packet.GetUint8(); Info.career = packet.GetUint8(); Info.sex = packet.GetUint8(); Info.model = packet.GetUint8(); Info.NameSize = packet.GetUint16(); packet.Skip(2); byte[] Traits = new byte[8]; packet.Read(Traits, 0, Traits.Length); packet.Skip(7); string Name = packet.GetString(Info.NameSize); if (Name.Length > 2 && !CharMgr.NameIsUsed(Name)) { CharacterInfo CharInfo = CharMgr.GetCharacterInfo(Info.career); if (CharInfo == null) { Log.Error("ON_CREATE", "Can not find career :" + Info.career); } else { Log.Success("OnCreate", "New Character : " + Name); Character Char = new Character(); Char.AccountId = cclient._Account.AccountId; Char.bTraits = Traits; Char.Career = Info.career; Char.CareerLine = CharInfo.CareerLine; Char.ModelId = Info.model; Char.Name = Name; Char.Race = Info.race; Char.Realm = CharInfo.Realm; Char.RealmId = Program.Rm.RealmId; Char.Sex = Info.sex; Char.FirstConnect = true; if (!CharMgr.CreateChar(Char)) { Log.Error("CreateCharacter", "Hack : can not create more than 10 characters!"); } else { Character_item Citm = null; List <CharacterInfo_item> Items = CharMgr.GetCharacterInfoItem(Char.CareerLine); foreach (CharacterInfo_item Itm in Items) { if (Itm == null) { continue; } Citm = new Character_item(); Citm.Counts = Itm.Count; Citm.CharacterId = Char.CharacterId; Citm.Entry = Itm.Entry; Citm.ModelId = Itm.ModelId; Citm.SlotId = Itm.SlotId; CharMgr.CreateItem(Citm); } Character_value CInfo = new Character_value(); CInfo.CharacterId = Char.CharacterId; CInfo.Level = 1; CInfo.Money = 0; CInfo.Online = false; CInfo.RallyPoint = CharInfo.RallyPt; CInfo.RegionId = CharInfo.Region; CInfo.Renown = 0; CInfo.RenownRank = 1; CInfo.RestXp = 0; CInfo.Skills = CharInfo.Skills; CInfo.Speed = 100; CInfo.WorldO = CharInfo.WorldO; CInfo.WorldX = CharInfo.WorldX; CInfo.WorldY = CharInfo.WorldY; CInfo.WorldZ = CharInfo.WorldZ; CInfo.Xp = 0; CInfo.ZoneId = CharInfo.ZoneId; CharMgr.Database.AddObject(CInfo); Program.AcctMgr.UpdateRealmCharacters(Program.Rm.RealmId, (uint)CharMgr.Database.GetObjectCount <Character>(" Realm=1"), (uint)CharMgr.Database.GetObjectCount <Character>(" Realm=2")); Char.Value = CInfo; PacketOut Out = new PacketOut((byte)Opcodes.F_SEND_CHARACTER_RESPONSE); Out.WritePascalString(cclient._Account.Username); cclient.SendPacket(Out); } } } else { PacketOut Out = new PacketOut((byte)Opcodes.F_SEND_CHARACTER_ERROR); Out.WritePascalString(cclient._Account.Username); cclient.SendPacket(Out); } }
public static void F_USE_ITEM(BaseClient client, PacketIn packet) { GameClient cclient = client as GameClient; if (!cclient.IsPlaying()) { return; } Player Plr = cclient.Plr; if (Plr.AbtInterface.IsOnGlobalCooldown()) { return; } ushort slot = packet.GetUint16(); Item item = Plr.ItmInterface.GetItemInSlot(slot); if (item == null || item._Count == 0) { return; } if (!item.CanBeUsedBy(Plr)) { return; } if ((Item.ItemType)item.Info.Type == Item.ItemType.Quest) { Plr.QtsInterface.HandleEvent(Objective_Type.QUEST_USE_ITEM, item.Info.Entry, 1); } if (item.Info.Entry == 86203 || item.Info.Entry == 86207 || item.Info.Entry == 86211 || item.Info.Entry == 86215 || item.Info.Entry == 86219 || item.Info.Entry == 86223) // siege oil { Keep keep = Plr.Region.Bttlfront.GetClosestKeep(Plr.WorldPosition); if (keep.Realm == Plr.Realm) { keep.SpawnOil(Plr, slot); } } if (item.ModelId == 1566 || item.ModelId == 3850) // currency conversion boxes { Plr.ItmInterface.OpenBox(slot, item); } #region Loot bags if (item.Info.Entry == 9980 || item.Info.Entry == 9940 || item.Info.Entry == 9941 || item.Info.Entry == 9942 || item.Info.Entry == 9943) // lootbags { packet.Skip(5); byte mode = packet.GetUint8(); if (mode == 0) { Plr.ItmInterface.SendMysteryBag(slot); } else { Plr.ItmInterface.GetItemfromMysterybag(slot, mode); } } #endregion // Banner hack for standards. if (item.ModelId >= 6188 && item.ModelId < 6194) { Plr.Standard(item.Info.SpellId); } if (item.Info.Crafts.Length > 0 && CraftingApoInterface.GetCraft(5, item.Info.Crafts) == 4 && (CraftingApoInterface.GetCraft(8, item.Info.Crafts) < 5 || CraftingApoInterface.GetCraft(8, item.Info.Crafts) == 18)) { CultivationInterface.ReapResin(Plr, slot); } #region Dye if (item.Info.Type == 27) { Item dye = Plr.ItmInterface.GetItemInSlot(slot); if (dye == null) { return; } byte prisek = packet.GetUint8(); packet.Skip(4); byte Slot = packet.GetUint8(); Item itemtodye = Plr.ItmInterface.GetItemInSlot(Slot); if (dye.Info.BaseColor1 == 0) { Plr.ItmInterface.RemoveDye(itemtodye, prisek == 1, prisek == 2); } else { if (prisek == 1) { Plr.ItmInterface.DyeItem(itemtodye, dye.Info.BaseColor1, 0); } else { Plr.ItmInterface.DyeItem(itemtodye, 0, dye.Info.BaseColor1); } } Plr.ItmInterface.DeleteItem(slot, 1); } #endregion if (item.Info.SpellId == 0) { return; } #region Ability Cast if (!Plr.AbtInterface.CanCastCooldown(item.Info.SpellId)) { Plr.SendLocalizeString("", ChatLogFilters.CHATLOGFILTERS_USER_ERROR, Localized_text.TEXT_ITEM_CANT_BE_USED_YET); return; } if (!Plr.AbtInterface.StartCast(Plr, item.Info.SpellId, 1, item.Info.Unk27?[19] ?? 0, item.Info.ObjectLevel)) { return; } if (item.Info.MaxStack > 1) { Plr.ItmInterface.DeleteItem(slot, 1); } WorldMgr.GeneralScripts.OnWorldPlayerEvent("USE_ITEM", Plr, item); #endregion }
public static void F_HELP_DATA(BaseClient client, PacketIn packet) { GameClient cclient = client as GameClient; if (!cclient.IsPlaying() || !cclient.Plr.IsInWorld()) { return; } Player Plr = cclient.Plr; GameData.HelpType Type = (GameData.HelpType)packet.GetUint8(); switch (Type) { case GameData.HelpType.HELPTYPE_CREATE_APPEAL_VIOLATION_REPORT: // Violation Report case GameData.HelpType.HELPTYPE_CREATE_APPEAL_NAMING_VIOLATION: // Name Violation case GameData.HelpType.HELPTYPE_CREATE_APPEAL_GOLD_SELLER: // Gold Seller { GameData.AppealTopic Category = (GameData.AppealTopic)packet.GetUint8(); ushort ReportTypeSize = packet.GetUint16R(); packet.Skip(2); string ReportType = ""; if (ReportTypeSize > 0) { ReportType = packet.GetString(ReportTypeSize - 1); } packet.Skip(1); ushort MessageSize = packet.GetUint16R(); packet.Skip(2); string Message = ""; if (MessageSize > 0) { Message = packet.GetString(MessageSize - 1); } packet.Skip(1); ushort NameSize = packet.GetUint16R(); packet.Skip(2); string Name = packet.GetString(NameSize - 1); Bug_report report = new Bug_report(); report.Time = (uint)TCPManager.GetTimeStamp(); report.AccountId = (uint)Plr.Client._Account.AccountId; report.CharacterId = Plr.CharacterId; //fix for when someone right clicks chat to report or report spam on mails, because mythic thought it was good to classify these as goldsellers... if (Message.StartsWith("[") || Message.StartsWith($"\n[") || Message.StartsWith($"\n [")) { report.Type = 2; // Violation report report.Category = 4; //Violation report report.ReportType = "General"; //General subcategory of violation report } else { report.Type = (byte)Type; report.Category = (byte)Category; report.ReportType = ReportType; } if (Message.Contains(";")) { Message = Message.Replace(';', ':'); } if (Message.Contains("^")) { Message = Message.Replace('^', ' '); } report.Message = Message; report.ZoneId = Plr.Zone.Info.ZoneId; report.X = (ushort)(Plr.X / 64); report.Y = (ushort)(Plr.Y / 64); report.Assigned = "nobody"; report.Fields.Add(new KeyValuePair <uint, string>(0, Name.Replace("|", "").Replace(":", ""))); //lets not allow players to report server automated mails if (Message.Contains("[Mail Subject]: Public Quest Loot [Mail Message Body]: You won a Public Quest Loot Bag") || Message.Contains("[Mail Subject]: Medallion Reward [Mail Message Body]: You've received a medallion reward for your realm's victory in a recent battle in which you were a participant.") || Message.Contains(" [Mail Message Body]: Your mail expired and has been returned to you.")) { Plr.SendClientMessage("This is a server generated mail, this ticket will be discarded.", ChatLogFilters.CHATLOGFILTERS_USER_ERROR); break; } CharMgr.Database.AddObject(report); lock (CharMgr._report) CharMgr._report.Add(report); Plr.SendLocalizeString("", ChatLogFilters.CHATLOGFILTERS_MISC, GameData.Localized_text.TEXT_COPTER_GENERAL_FEEDBACK_SENT); foreach (Player plr in GmMgr.GmList) { plr.SendClientMessage("NEW_TICKET", ChatLogFilters.CHATLOGFILTERS_CHANNEL_9); } } break; case GameData.HelpType.HELPTYPE_CREATE_APPEAL_NON_VALIDATED: // CSR Appeal { GameData.AppealTopic Category = (GameData.AppealTopic)packet.GetUint8(); ushort MessageSize = packet.GetUint16R(); packet.Skip(2); string Message = ""; if (MessageSize > 0) { Message = packet.GetString(MessageSize - 1); } packet.Skip(1); byte FieldsCount = packet.GetUint8(); Bug_report report = new Bug_report(); report.Time = (uint)TCPManager.GetTimeStamp(); report.AccountId = (uint)Plr.Client._Account.AccountId; report.CharacterId = Plr.CharacterId; report.Type = (byte)Type; report.Category = (byte)Category; if (Message.Contains(";")) { Message = Message.Replace(';', ':'); } if (Message.Contains("^")) { Message = Message.Replace('^', ' '); } report.Message = Message; report.ZoneId = Plr.Zone.Info.ZoneId; report.X = (ushort)(Plr.X / 64); report.Y = (ushort)(Plr.Y / 64); report.Assigned = "nobody"; for (int i = 0; i < FieldsCount; i++) { GameData.HelpField FieldType = (GameData.HelpField)packet.GetUint8(); ushort FieldSize = packet.GetUint16R(); packet.Skip(2); string Field = packet.GetString(FieldSize - 1); packet.Skip(1); report.Fields.Add(new KeyValuePair <uint, string>((byte)FieldType, Field.Replace("|", "").Replace(":", ""))); } CharMgr.Database.AddObject(report); lock (CharMgr._report) CharMgr._report.Add(report); Plr.SendLocalizeString("", ChatLogFilters.CHATLOGFILTERS_MISC, GameData.Localized_text.TEXT_COPTER_GENERAL_FEEDBACK_SENT); foreach (Player plr in GmMgr.GmList) { plr.SendClientMessage("NEW_TICKET", ChatLogFilters.CHATLOGFILTERS_CHANNEL_9); } } break; case GameData.HelpType.HELPTYPE_CREATE_BUG_REPORT: // Bug Report case GameData.HelpType.HELPTYPE_CREATE_FEEDBACK: // Feedback { byte Category = packet.GetUint8(); ushort MessageSize = packet.GetUint16R(); packet.Skip(2); string Message = ""; if (MessageSize > 0) { Message = packet.GetString(MessageSize - 1); } Bug_report report = new Bug_report(); report.Time = (uint)TCPManager.GetTimeStamp(); report.AccountId = (uint)Plr.Client._Account.AccountId; report.CharacterId = Plr.CharacterId; report.Type = (byte)Type; report.Category = Category; if (Message.Contains(";")) { Message = Message.Replace(';', ':'); } if (Message.Contains("^")) { Message = Message.Replace('^', ' '); } report.Message = Message; report.ZoneId = Plr.Zone.Info.ZoneId; report.X = (ushort)(Plr.X / 64); report.Y = (ushort)(Plr.Y / 64); report.Assigned = "nobody"; CharMgr.Database.AddObject(report); lock (CharMgr._report) CharMgr._report.Add(report); Plr.SendLocalizeString("", ChatLogFilters.CHATLOGFILTERS_USER_ERROR, GameData.Localized_text.TEXT_COPTER_GENERAL_FEEDBACK_SENT); foreach (Player plr in GmMgr.GmList) { plr.SendClientMessage("NEW_TICKET", ChatLogFilters.CHATLOGFILTERS_CHANNEL_9); } } break; } }
public void SendPacketMail(PacketIn packet) { Player plr = GetPlayer(); if (plr == null) { return; } if (_nextSend >= TCPManager.GetTimeStamp()) { SendResult(MailResult.TEXT_MAIL_RESULT6); return; } // Recipient read packet.Skip(1); byte nameSize = packet.GetUint8(); string name = packet.GetString(nameSize); // Subject (client is limited to send 30 chars but its probably a ushort anyway) ushort subjectSize = ByteSwap.Swap(packet.GetUint16()); string subject = packet.GetString(subjectSize); // Message ushort messageSize = ByteSwap.Swap(packet.GetUint16()); string message = packet.GetString(messageSize); // Money uint money = ByteSwap.Swap(packet.GetUint32()); // COD? byte cr = packet.GetUint8(); // Item byte itemsToSendCount = packet.GetUint8(); var isBlackMarket = ((name.ToLower() == "black market") || (name.ToLower() == "blackmarket")); List <ushort> itemSlots = new List <ushort>(); var itemList = new List <Item>(); for (byte i = 0; i < itemsToSendCount; ++i) { ushort itemSlot = ByteSwap.Swap(packet.GetUint16()); packet.Skip(2); Item item = plr.ItmInterface.GetItemInSlot(itemSlot); if (item == null || item.Info == null) { SendResult(MailResult.TEXT_MAIL_RESULT16); return; } // Allow black market items to be sent in mail if (!isBlackMarket) { if (item.BoundtoPlayer || item.Info.Bind == 1) { SendResult(MailResult.TEXT_MAIL_RESULT9); return; } } itemSlots.Add(itemSlot); itemList.Add(item); } if (isBlackMarket) { _logger.Debug($"Sending mail to the BLACK MARKET. Number items {itemsToSendCount}"); // Ensure that what is being sent is a warlord item if (itemsToSendCount == 0) { SendResult(MailResult.TEXT_MAIL_RESULT9); return; } var blackMarketManager = new BlackMarketManager(); // Sending multiple items. foreach (var item in itemList) { if (blackMarketManager.IsItemOnBlackMarket(item.Info.Entry)) { _logger.Info($"Sending {item.Info.Name} ({item.Info.Entry}) to BlackMarket"); blackMarketManager.SendBlackMarketReward(plr, item.Info.Entry); plr.SendClientMessage($"Trusting to your luck, you have sent {string.Join(",", itemList.Select(x => x.Info.Name))} to the Black Market, hoping for just recompense."); _logger.Debug($"Email Sent."); plr.ItmInterface.RemoveItems(item.Info.Entry, 1); _logger.Info($"Removed {item.Info.Name} ({item.Info.Entry}) from {plr.Name}"); plr.SendClientMessage($"A suspicious looking package has arrived in your mail.", ChatLogFilters.CHATLOGFILTERS_LOOT); } else { _logger.Debug($"{MailResult.TEXT_MAIL_RESULT9}"); return; } } SendResult(MailResult.TEXT_MAIL_RESULT4); } else { Character receiver = CharMgr.GetCharacter(Player.AsCharacterName(name), false); if (receiver == null || receiver.Realm != (byte)plr.Realm) { SendResult(MailResult.TEXT_MAIL_RESULT7); return; } if (receiver.Name == plr.Name) // You cannot mail yourself { plr.SendLocalizeString("", ChatLogFilters.CHATLOGFILTERS_USER_ERROR, Localized_text.TEXT_PLAYER_CANT_MAIL_YOURSELF); return; } if ((cr == 0 && !plr.HasMoney(money)) || !plr.RemoveMoney((cr == 0 ? money : 0) + MAIL_PRICE)) { SendResult(MailResult.TEXT_MAIL_RESULT8); return; } SendMail(receiver, subject, message, money, cr == 1, itemSlots); _logger.Info($"Sending mail {subject} to {receiver.Name} from {plr.Name}. Money={money}, Item Count={itemSlots.Count}"); foreach (var itemSlot in itemSlots) { _logger.Info($"Item : {itemSlot}"); } } }
public static void F_GROUP_COMMAND(BaseClient client, PacketIn packet) { GameClient cclient = (GameClient)client; if (!cclient.IsPlaying() || !cclient.Plr.IsInWorld()) { return; } Player player = cclient.Plr; Group worldGroup = cclient.Plr.WorldGroup; uint groupId = 0; bool isLeader = false; if (worldGroup != null) { lock (worldGroup) { if (worldGroup != null) { if (worldGroup._warbandHandler != null) { lock (worldGroup._warbandHandler) { if (worldGroup._warbandHandler != null) { groupId = worldGroup._warbandHandler.ZeroIndexGroupId; isLeader = worldGroup._warbandHandler.Leader == player; } } } else { groupId = worldGroup.GroupId; isLeader = worldGroup.Leader == player; } } } } packet.Skip(3); // unk byte subGroup = packet.GetUint8(); byte state = packet.GetUint8(); switch (state) { case 2: // Accept invitation player.GrpInterface.AcceptInvitation(); break; case 6: // Decline invitation player.GrpInterface.RejectInvitation(); break; case 3: // Leave group if (groupId != 0) { Group.EnqueueGroupAction(groupId, new GroupAction(EGroupAction.PlayerLeave, player)); } break; case 4: // loot roundrobin if (groupId != 0 && isLeader) { Group.EnqueueGroupAction(groupId, new GroupAction(EGroupAction.ChangeLootOption, player, subGroup.ToString())); } break; case 5: // Set master looter Player newMasterLooter; lock (Player._Players) Player.PlayersByCharId.TryGetValue(subGroup, out newMasterLooter); if (newMasterLooter != null) { if (groupId != 0 && isLeader) { Group.EnqueueGroupAction(groupId, new GroupAction(EGroupAction.ChangeMasterLooter, player, newMasterLooter.Name)); } } break; case 10: // switch leader Player newLeader; lock (Player._Players) Player.PlayersByCharId.TryGetValue(subGroup, out newLeader); if (newLeader != null) { if (groupId != 0 && isLeader) { Group.EnqueueGroupAction(groupId, new GroupAction(EGroupAction.ChangeLeader, cclient.Plr, newLeader.Name)); } } break; case 12: if (groupId != 0 && isLeader) { Group.EnqueueGroupAction(groupId, new GroupAction(EGroupAction.ChangeNeedOnUse, player)); } break; case 13: player.ScnInterface.Scenario.AddPlayerToGroup(player, subGroup); break; case 14: player.ScnInterface.Scenario.RemovePlayerFromGroup(player); break; case 15: // Warband invitation acceptance player.GrpInterface.AcceptInvitation(); break; case 16: // Warband invitation rejection player.GrpInterface.RejectInvitation(); break; case 17: // Make set mainassist Player newMainAssist; lock (Player._Players) Player.PlayersByCharId.TryGetValue(subGroup, out newMainAssist); if (newMainAssist != null) { if (groupId != 0 && isLeader) { Group.EnqueueGroupAction(groupId, new GroupAction(EGroupAction.ChangeMainAssist, player, newMainAssist.Name)); } } break; case 18: // autolootinrvr if (groupId != 0) { Group.EnqueueGroupAction(groupId, new GroupAction(EGroupAction.ChangeAutoLoot, player)); } break; default: Log.Error("GroupHandler", "Unsupported type: " + state); break; } }
static public void F_INTERACT_QUEUE(BaseClient client, PacketIn packet) { GameClient cclient = client as GameClient; if (!cclient.IsPlaying() || !cclient.Plr.IsInWorld()) { return; } Player Plr = cclient.Plr; packet.Skip(5); byte State = packet.GetUint8(); UInt16 Scenario = packet.GetUint16(); switch (State) { /// <summary> /// This will put you in the queue for a scenario /// STATE 1 YOUR IN SCENARIO QUEUE /// THIS MAKES IT FLASH THE ICON /// </summary> case 1: // signed up Log.Success("ScenariosHandlers", Plr.Name + " has joined scenario queue " + Scenario); PacketOut Out1 = new PacketOut((byte)Opcodes.F_INTERACT_RESPONSE); Out1.WriteByte(9); // scenario Out1.WriteByte(6); //STATE//0=scenaro list) 1=in queue) 2=removed from qeue)6=scenaro ready Out1.WriteUInt16(0); //unknown Out1.WriteUInt16(0x0834); //Serpent's Passage SCENARO//ScenarioID List in Scenarios//0x089C Out1.WriteUInt16(0); //unknown Out1.WriteUInt16(0x07D0); //Gates of Ekrund SCENARO//ScenarioID Plr.SendPacket(Out1); /* * * Log.Success("ScenariosHandlers", Plr.Name + " has joined scenario queue " + Scenario); * //WorldMgr.ScenarioMgr.ScenarioJoin(Plr, Scenario); * PacketOut Out1 = new PacketOut((byte)Opcodes.F_INTERACT_RESPONSE); * Out1.WriteByte(9);// scenario * Out1.WriteByte(1);//STATE//0=scenaro list) 1=in queue) 2=removed from qeue)6=scenaro ready * Out1.WriteUInt16(0);//unknown * Out1.WriteUInt16(0x089C);//Serpent's Passage SCENARO//ScenarioID List in Scenarios//0x089C * Plr.SendPacket(Out1); * */ break; default: Log.Error("ScenariosHandlers", "Unhandled state: " + State); break; /// <summary> /// This leaves queue for a scenario /// STATE 2 You are no longer in the queue /// THIS REMOVES U FROM THE QUEUE NEED TO ADD STRING// THAT SHOWS JOIN AND LEAVE IN CHAT BOX /// </summary> case 2: Log.Success("ScenariosHandlers", Plr.Name + " leaves scenario queue " + Scenario); PacketOut Out2 = new PacketOut((byte)Opcodes.F_INTERACT_RESPONSE); Out2.WriteByte(9); Out2.WriteByte(2); Out2.WriteUInt16(0); // Out2.WriteUInt16(0x0834); Plr.SendPacket(Out2); break; /// <summary> /// This makes the scenario ready for you to join /// STATE 6 The scenario is ready for you to join /// </summary> case 3: Log.Success("ScenariosHandlers", Plr.Name + " join scenario " + Scenario); PacketOut Out3 = new PacketOut((byte)Opcodes.F_INTERACT_RESPONSE); Out3.WriteByte(9); Out3.WriteByte(6); Out3.WriteUInt16(0); Out3.WriteUInt16(0x07D0); //Out3.WriteUInt16(0x089C);//Serpent's Passage SCENARO//ScenarioID Out3.WriteUInt16(0); Out3.WriteUInt16(0x0834); //Nordenwatch SCENARO//ScenarioID Plr.SendPacket(Out3); //Plr.Teleport(234, 631034, 359179, (UInt16)12176, (UInt16)154);//Serpent's Passage Plr.Teleport(130, 364585, 360055, (UInt16)7180, (UInt16)89); // i added all this// ports to nordenwatch scenaro // Plr.Teleport(30, 194972, 198481, (UInt16)18024, (UInt16)47);//gates of ekrund break; } }
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_SOCIAL_NETWORK(BaseClient client, PacketIn packet) { GameClient cclient = client as GameClient; if (!cclient.IsPlaying() || !cclient.Plr.IsInWorld()) { return; } Player Plr = cclient.Plr; byte Type = packet.GetUint8(); switch (Type) { case 7: // World Groups { } break; case 8: { packet.Skip(1); byte NameSize = packet.GetUint8(); packet.Skip(1); string Name = packet.GetString(NameSize); byte GuildSize = packet.GetUint8(); packet.Skip(1); string GuildName = packet.GetString(GuildSize); packet.Skip(1); ushort Career = packet.GetUint16(); packet.Skip(4); ushort ZoneId = packet.GetUint16(); while (ZoneId > 256) { ZoneId -= 256; } while (packet.GetUint8() != 0xFF) { ; } packet.Skip(2 + (ZoneId == 255 ? 0 : 1)); byte MinLevel = packet.GetUint8(); byte MaxLevel = packet.GetUint8(); Plr.SocInterface.SendPlayers(Player.GetPlayers(Name, GuildName, Career, ZoneId, MinLevel, MaxLevel, cclient.Plr), Plr.GmLevel != 0); //cant hide location/details from gm } break; case 11: // Inspection { Player Target = Plr.CbtInterface.GetTarget(GameData.TargetTypes.TARGETTYPES_TARGET_ALLY) as Player; if (Target == null) { Plr.SendLocalizeString("", ChatLogFilters.CHATLOGFILTERS_USER_ERROR, GameData.Localized_text.TEXT_SN_LISTS_ERR_PLAYER_NOT_FOUND); } else if (!Target.Info.Anonymous || Plr.GmLevel > 0) //do not allow inspect of anonymous players, unless by gm { Target.ItmInterface.SendInspect(Plr); } else { Plr.SendLocalizeString("", ChatLogFilters.CHATLOGFILTERS_USER_ERROR, GameData.Localized_text.TEXT_UNABLE_TO_INSPECT_PLAYER_EQUIP); } } break; case 13: // Nearby Groups { Group.SendWorldGroups(Plr); } break; case 18: // AFK { packet.Skip(1); bool AFKState = packet.GetUint8() == 1; // Went afk manually. bool AutoAFK = packet.GetUint8() == 1; // Kick them from SC if this happens? //Use Plr.IsAFK = AFKState; Plr.IsAutoAFK = AutoAFK; //remove a player from an SC if they are in one and afk is toggled. if ((Plr.IsAFK || Plr.IsAutoAFK) && Plr.ScnInterface.Scenario != null) { Plr.SendClientMessage("You have been removed from the scenario due to afk", ChatLogFilters.CHATLOGFILTERS_USER_ERROR); Plr.ScnInterface.Scenario.RemovePlayer(Plr, true); } byte length = packet.GetUint8(); packet.Skip(1); string message = packet.GetString(length); if (message != null) { Plr.AFKMessage = message; } else { Plr.AFKMessage = ""; } } break; } }