Esempio n. 1
0
        // GEARS
        /*            packet.Id = *((uint*)(ptr + 4));
            packet.Data1 = *((uint*)(ptr + 8));
            packet.Action = *((ItemAction*)(ptr + 12));
            packet.Timestamp = *((SystemTime*)(ptr + 16));
            packet.Data2 = *((uint*)(ptr + 20));
            packet.Gear1 = *((uint*)(ptr + 32));
            packet.Gear2 = *((uint*)(ptr + 36));
            packet.Gear3 = *((uint*)(ptr + 40));
            packet.Gear4 = *((uint*)(ptr + 44));
            packet.Gear5 = *((uint*)(ptr + 48));
            packet.Gear6 = *((uint*)(ptr + 52));
            packet.Gear7 = *((uint*)(ptr + 56));
            packet.Gear8 = *((uint*)(ptr + 60));
            packet.Gear9 = *((uint*)(ptr + 64));
            packet.Gear16 = *((uint*)(ptr + 68));
            packet.Gear15 = *((uint*)(ptr + 72));
            packet.Gear17 = *((uint*)(ptr + 76));
            packet.Gear18 = *((uint*)(ptr + 80)); */
        /// <summary>
        /// Handling the ItemPacket.
        /// </summary>
        /// <param name="client">The client.</param>
        /// <param name="packet">The packet.</param>
        public static void Handle(Entities.GameClient client, DataPacket packet)
        {
            using (var item = new ItemPacket(packet))
            {
                if (item.Action != Enums.ItemAction.Ping)
                {
                    if (client.Trade.Trading)
                        return;
                }
                switch (item.Action)
                {
                        #region Ping : 27
                    case Enums.ItemAction.Ping:
                        Item.Ping.Handle(client, item);
                        break;
                        #endregion
                        #region Drop : 37
                    case Enums.ItemAction.Drop:
                        Item.Drop.Handle(client, item);
                        break;
                        #endregion
                        #region Buy : 1
                    case Enums.ItemAction.Buy:
                        Item.Buy.Handle(client, item);
                        break;
                        #endregion
                        #region Sell : 2
                    case Enums.ItemAction.Sell:
                        Item.Sell.Handle(client, item);
                        break;
                        #endregion
                        #region Use
                    case Enums.ItemAction.Use:
                        Item.Use.Handle(client, item);
                        break;
                        #endregion
                        #region Unequip : ?
                    case Enums.ItemAction.Unequip:
                        Item.Unequip.Handle(client, item);
                        break;
                        #endregion
                        #region Improve : ?
                    case Enums.ItemAction.Improve:
                        Item.Improve.Handle(client, item);
                        break;
                        #endregion
                        #region Uplev : ?
                    case Enums.ItemAction.Uplev:
                        Item.Uplev.Handle(client, item);
                        break;
                        #endregion
                        #region ActivateAccessory : ?
                    case Enums.ItemAction.ActivateAccessory:
                        Item.ActivateAccessory.Handle(client, item);
                        break;
                        #endregion
                        #region QueryMoneySaved : ?
                    case Enums.ItemAction.QueryMoneySaved:
                        Item.QueryMoneySaved.Handle(client, item);
                        break;
                        #endregion
                        #region SaveMoney : ?
                    case Enums.ItemAction.SaveMoney:
                        Item.SaveMoney.Handle(client, item);
                        break;
                        #endregion
                        #region DrawMoney : ?
                    case Enums.ItemAction.DrawMoney:
                        Item.DrawMoney.Handle(client, item);
                        break;
                        #endregion
                        #region Bless : ?
                    case Enums.ItemAction.Bless:
                        Item.Bless.Handle(client, item);
                        break;
                        #endregion
                        #region BoothAdd : ?
                    case Enums.ItemAction.BoothAdd:
                        Item.BoothAdd.Handle(client, item);
                        break;
                        #endregion
                        #region BoothAddCP : ?
                    case Enums.ItemAction.BoothAddCP:
                        Item.BoothAddCP.Handle(client, item);
                        break;
                        #endregion
                        #region BoothBuy : ?
                    case Enums.ItemAction.BoothBuy:
                        Item.BoothBuy.Handle(client, item);
                        break;
                        #endregion
                        #region BoothDelete : ?
                    case Enums.ItemAction.BoothDelete:
                        Item.BoothDelete.Handle(client, item);
                        break;
                        #endregion
                        #region BoothDelete : ?
                    case Enums.ItemAction.BoothQuery:
                        Item.BoothQuery.Handle(client, item);
                        break;
                        #endregion

                        #region default
                    default:
                        Console.WriteLine("Unhandled item packet: {0} User: {1}", item.Action, client.Name);
                        break;
                        #endregion
                }
            }
        }
Esempio n. 2
0
        // GEARS

        /*            packet.Id = *((uint*)(ptr + 4));
         * packet.Data1 = *((uint*)(ptr + 8));
         * packet.Action = *((ItemAction*)(ptr + 12));
         * packet.Timestamp = *((SystemTime*)(ptr + 16));
         * packet.Data2 = *((uint*)(ptr + 20));
         * packet.Gear1 = *((uint*)(ptr + 32));
         * packet.Gear2 = *((uint*)(ptr + 36));
         * packet.Gear3 = *((uint*)(ptr + 40));
         * packet.Gear4 = *((uint*)(ptr + 44));
         * packet.Gear5 = *((uint*)(ptr + 48));
         * packet.Gear6 = *((uint*)(ptr + 52));
         * packet.Gear7 = *((uint*)(ptr + 56));
         * packet.Gear8 = *((uint*)(ptr + 60));
         * packet.Gear9 = *((uint*)(ptr + 64));
         * packet.Gear16 = *((uint*)(ptr + 68));
         * packet.Gear15 = *((uint*)(ptr + 72));
         * packet.Gear17 = *((uint*)(ptr + 76));
         * packet.Gear18 = *((uint*)(ptr + 80)); */

        /// <summary>
        /// Handling the ItemPacket.
        /// </summary>
        /// <param name="client">The client.</param>
        /// <param name="packet">The packet.</param>
        public static void Handle(Entities.GameClient client, DataPacket packet)
        {
            using (var item = new ItemPacket(packet))
            {
                if (item.Action != Enums.ItemAction.Ping)
                {
                    if (client.Trade.Trading)
                    {
                        return;
                    }
                }
                switch (item.Action)
                {
                    #region Ping : 27
                case Enums.ItemAction.Ping:
                    Item.Ping.Handle(client, item);
                    break;

                    #endregion
                    #region Drop : 37
                case Enums.ItemAction.Drop:
                    Item.Drop.Handle(client, item);
                    break;

                    #endregion
                    #region Buy : 1
                case Enums.ItemAction.Buy:
                    Item.Buy.Handle(client, item);
                    break;

                    #endregion
                    #region Sell : 2
                case Enums.ItemAction.Sell:
                    Item.Sell.Handle(client, item);
                    break;

                    #endregion
                    #region Use
                case Enums.ItemAction.Use:
                    Item.Use.Handle(client, item);
                    break;

                    #endregion
                    #region Unequip : ?
                case Enums.ItemAction.Unequip:
                    Item.Unequip.Handle(client, item);
                    break;

                    #endregion
                    #region Improve : ?
                case Enums.ItemAction.Improve:
                    Item.Improve.Handle(client, item);
                    break;

                    #endregion
                    #region Uplev : ?
                case Enums.ItemAction.Uplev:
                    Item.Uplev.Handle(client, item);
                    break;

                    #endregion
                    #region ActivateAccessory : ?
                case Enums.ItemAction.ActivateAccessory:
                    Item.ActivateAccessory.Handle(client, item);
                    break;

                    #endregion
                    #region QueryMoneySaved : ?
                case Enums.ItemAction.QueryMoneySaved:
                    Item.QueryMoneySaved.Handle(client, item);
                    break;

                    #endregion
                    #region SaveMoney : ?
                case Enums.ItemAction.SaveMoney:
                    Item.SaveMoney.Handle(client, item);
                    break;

                    #endregion
                    #region DrawMoney : ?
                case Enums.ItemAction.DrawMoney:
                    Item.DrawMoney.Handle(client, item);
                    break;

                    #endregion
                    #region Bless : ?
                case Enums.ItemAction.Bless:
                    Item.Bless.Handle(client, item);
                    break;

                    #endregion
                    #region BoothAdd : ?
                case Enums.ItemAction.BoothAdd:
                    Item.BoothAdd.Handle(client, item);
                    break;

                    #endregion
                    #region BoothAddCP : ?
                case Enums.ItemAction.BoothAddCP:
                    Item.BoothAddCP.Handle(client, item);
                    break;

                    #endregion
                    #region BoothBuy : ?
                case Enums.ItemAction.BoothBuy:
                    Item.BoothBuy.Handle(client, item);
                    break;

                    #endregion
                    #region BoothDelete : ?
                case Enums.ItemAction.BoothDelete:
                    Item.BoothDelete.Handle(client, item);
                    break;

                    #endregion
                    #region BoothDelete : ?
                case Enums.ItemAction.BoothQuery:
                    Item.BoothQuery.Handle(client, item);
                    break;
                    #endregion

                    #region default
                default:
                    Console.WriteLine("Unhandled item packet: {0} User: {1}", item.Action, client.Name);
                    break;
                    #endregion
                }
            }
        }