Ejemplo n.º 1
0
        public static void HandleItemUseDecor(WorldSession session, ClientItemUseDecor itemUseDecor)
        {
            Item item = session.Player.Inventory.GetItem(itemUseDecor.ItemGuid);

            if (item == null)
            {
                throw new InvalidPacketValueException();
            }

            HousingDecorInfoEntry entry = GameTableManager.HousingDecorInfo.GetEntry(item.Entry.HousingDecorInfoId);

            if (entry == null)
            {
                throw new InvalidPacketValueException();
            }

            Task <Residence> task = ResidenceManager.GetResidence(session.Player.Name);

            session.EnqueueEvent(new TaskGenericEvent <Residence>(task,
                                                                  residence =>
            {
                if (residence == null)
                {
                    residence = ResidenceManager.CreateResidence(session.Player);
                }

                if (session.Player.Inventory.ItemUse(item))
                {
                    residence.DecorCreate(entry);
                }
            }));
        }
Ejemplo n.º 2
0
        public static void HandleItemUseDecor(WorldSession session, ClientItemUseDecor itemUseDecor)
        {
            Item item = session.Player.Inventory.GetItem(itemUseDecor.ItemGuid);

            if (item == null)
            {
                throw new InvalidPacketValueException();
            }

            HousingDecorInfoEntry entry = GameTableManager.Instance.HousingDecorInfo.GetEntry(item.Info.Entry.HousingDecorInfoId);

            if (entry == null)
            {
                throw new InvalidPacketValueException();
            }

            if (session.Player.Inventory.ItemUse(item))
            {
                session.Player.ResidenceManager.DecorCreate(entry);
            }
        }