コード例 #1
0
        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();
        }
コード例 #2
0
ファイル: InventoryHandlers.cs プロジェクト: wardev1/WarEmu-1
        static public void F_USE_ITEM(BaseClient client, PacketIn packet)
        {
            GameClient cclient = client as GameClient;

            if (!cclient.IsPlaying())
            {
                return;
            }

            Player Plr = cclient.Plr;

            ushort slot = packet.GetUint16();

            Item item = Plr.ItmInterface.GetItemInSlot(slot);

            if (Plr.Level < item.Info.MinRank)
            {
                Plr.SendLocalizeString("", GameData.Localized_text.TEST_ITEM_PLAYER_LEVEL_TOO_LOW);
                return;
            }
            else if (Plr.Rank < item.Info.MinRenown)
            {
                Plr.SendLocalizeString("", GameData.Localized_text.TEST_ITEM_PLAYER_RENOWN_TOO_LOW);
                return;
            }

            if (item.Info.Type == 31 && item.Info.ScriptName == "HealthPotion") // Potion
            {
                Plr.DealHeal(Plr, (uint)item.Info.MinRank * 100);
                Plr.ItmInterface.DeleteItem(slot, 1, true);
            }
        }
コード例 #3
0
ファイル: InventoryHandlers.cs プロジェクト: wardev1/WarEmu-1
        static public 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
                Plr.CbtInterface.TurnPvp();
                break;

            case 16:     // Buy more bag space
                byte Price = packet.GetUint8();
                if (!Plr.ItmInterface.HasMaxBag())
                {
                    if (Plr.HaveMoney(Plr.ItmInterface.GetBagPrice()))
                    {
                        if (Plr.RemoveMoney(Plr.ItmInterface.GetBagPrice()))
                        {
                            ++Plr.ItmInterface.BagBuy;
                            Plr.ItmInterface.SendMaxInventory(Plr);
                        }
                    }
                }
                break;
            }
        }
コード例 #4
0
        static public void F_BAG_INFO(BaseClient client, PacketIn packet)
        {
            GameClient cclient = client as GameClient;

            if (!cclient.IsPlaying())
            {
                return;
            }

            byte SlotCount = packet.GetUint8();
            byte Price     = packet.GetUint8();

            Player Plr = cclient.Plr;

            if (!Plr.ItmInterface.HasMaxBag())
            {
                if (Plr.HaveMoney(Plr.ItmInterface.GetBagPrice()))
                {
                    if (Plr.RemoveMoney(Plr.ItmInterface.GetBagPrice()))
                    {
                        ++Plr.ItmInterface.BagBuy;
                        Plr.ItmInterface.SendMaxInventory(Plr);
                    }
                }
            }
        }
コード例 #5
0
        public static void F_TRADE_STATUS(BaseClient client, PacketIn packet)
        {
            GameClient cclient = client as GameClient;

            if (!cclient.IsPlaying())
            {
                return;
            }

            cclient.Plr.ItmInterface.HandleTrade(packet);
        }
コード例 #6
0
        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);
        }
コード例 #7
0
        public static void F_MAIL(BaseClient client, PacketIn packet)
        {
            GameClient cclient = client as GameClient;

            if (!cclient.IsPlaying() || !cclient.Plr.IsInWorld())
            {
                return;
            }

            Player Plr = cclient.Plr;

            Plr.MlInterface.CheckMailExpired();

            byte Type = packet.GetUint8();

            switch (Type)
            {
            case 0:     // Mailbox closed
            {
                if (Plr.GldInterface.IsInGuild() && Plr.GldInterface.Guild.GuildVaultUser.Contains(Plr))
                {
                    Plr.GldInterface.Guild.GuildVaultClosed(Plr);
                }

                if (Plr.CurrentSiege != null && Plr.CurrentSiege.SiegeInterface.IsDeployed)
                {
                    Plr.CurrentSiege.SiegeInterface.RemovePlayer(Plr);
                }
            } break;

            case 1:     // Mail sent
            {
                Plr.MlInterface.SendPacketMail(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();
                uint guid = ByteOperations.ByteSwap.Swap(packet.GetUint32());

                Plr.MlInterface.MailInteract((MailInteractType)Type, guid, packet);
            }
            break;
            }
        }
コード例 #8
0
ファイル: GroupHandlers.cs プロジェクト: wardev1/WarEmu-1
        static public void F_GROUP_COMMAND(BaseClient client, PacketIn packet)
        {
            GameClient cclient = client as GameClient;

            if (!cclient.IsPlaying() || !cclient.Plr.IsInWorld())
            {
                return;
            }

            Player Plr = cclient.Plr;

            packet.GetUint32(); // UNK
            byte State = packet.GetUint8();

            switch (State)
            {
            case 2:     // Accept invitation
                if (Plr.Invitation == null)
                {
                    return;
                }
                Plr.Invitation.AcceptInvitation();
                break;

            case 6:     // Decline invitation
                if (Plr.Invitation == null)
                {
                    return;
                }
                Plr.Invitation.DeclineInvitation();
                break;

            case 3:     // Leave group
                if (Plr.GetGroup() == null)
                {
                    return;
                }
                Plr.GetGroup().RemoveMember(Plr);
                Plr.SetGroup(null);
                break;

            case 17:     // Make main
                break;

            default:
                Log.Error("GroupHandler", "Unsupported type: " + State);
                break;
            }
        }
コード例 #9
0
        public static void F_TROPHY_SETLOCATION(BaseClient client, PacketIn packet)
        {
            GameClient cclient = client as GameClient;

            if (!cclient.IsPlaying())
            {
                return;
            }

            packet.GetUint8();
            byte   Trophyslot = packet.GetUint8();
            ushort value      = packet.GetUint16();

            cclient.Plr.ItmInterface.AssignTrophy(Trophyslot, value);
        }
コード例 #10
0
ファイル: TCPServer.cs プロジェクト: wardev1/WarEmu-1
        public Player GetPlayerByName(string Name)
        {
            lock (Clients)
                for (int i = 0; i < Clients.Length; ++i)
                {
                    if (Clients[i] != null)
                    {
                        GameClient Client = (Clients[i] as GameClient);
                        if (Client.IsPlaying() && Client.HasPlayer() && Client.Plr.Name.ToLower() == Name.ToLower())
                        {
                            return(Client.Plr);
                        }
                    }
                }

            return(null);
        }
コード例 #11
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);
        }
コード例 #12
0
        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);
        }
コード例 #13
0
        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;
            }
        }
コード例 #14
0
        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;
            }
        }
コード例 #15
0
        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;
            }
        }
コード例 #16
0
ファイル: MailHandlers.cs プロジェクト: genisaurus/WarEmu
        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;
            }
        }
コード例 #17
0
        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;
            }
        }
コード例 #18
0
        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;
            }
        }
コード例 #19
0
        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
        }
コード例 #20
0
        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;
            }
        }
コード例 #21
0
        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;
            }
        }
コード例 #22
0
        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;
            }
        }