Ejemplo n.º 1
0
        public void UnequipItem(CharacterItemRecord item, byte newposition, ItemRecord template, uint quantity)
        {
            var existing = Items.ExistingItem(item);

            if (existing == null)
            {
                item.Position = newposition;
                SaveTask.UpdateElement(item);
                ItemEffectsProvider.RemoveEffects(Character.Client, item.GetEffects());
                RemoveItemSkin(item, template);
            }
            else
            {
                if (item.UID != existing.UID)
                {
                    existing.Quantity += quantity;
                    RemoveItem(item.UID, item.Quantity);
                    ItemEffectsProvider.RemoveEffects(Character.Client, item.GetEffects());
                    RemoveItemSkin(item, template);
                }
                else
                {
                    Character.NotificationError("Spamming ItemMove!");
                }
            }
            Character.RefreshGroupInformations();
        }
Ejemplo n.º 2
0
        private void ApplyItemSetEffects(ItemSetRecord itemSet, int count, bool equiped)
        {
            if (equiped)
            {
                if (count >= 2)
                {
                    if (count >= 3)
                    {
                        ItemEffectsProvider.RemoveEffects(Character, itemSet.GetSetEffects(count - 2));
                    }

                    ItemEffectsProvider.AddEffects(Character, itemSet.GetSetEffects(count - 1));
                    OnSetUpdated(itemSet, count - 1);
                }
            }
            else
            {
                if (count >= 1)
                {
                    if (count >= 2)
                    {
                        ItemEffectsProvider.AddEffects(Character, itemSet.GetSetEffects(count - 1));
                    }

                    ItemEffectsProvider.RemoveEffects(Character, itemSet.GetSetEffects(count));
                    OnSetUpdated(itemSet, count);
                }
            }
        }
Ejemplo n.º 3
0
        public void ToggleMount()
        {
            var mount = Mount;

            if (mount != null)
            {
                if (!mount.Toggled)
                {
                    Unequip(CharacterInventoryPositionEnum.ACCESSORY_POSITION_PETS);
                    Character.Look = Character.Look.GetMountLook(mount.Template.Look);
                    ItemEffectsProvider.AddEffects(Character, mount.Effects.ToList <Effect>());
                }
                else
                {
                    Character.Look = Character.Look.GetMountDriverLook();
                    Character.Look.SetBones(1);
                    ItemEffectsProvider.RemoveEffects(Character, mount.Effects.ToList <Effect>());
                }

                mount.Toggled = !mount.Toggled;
                mount.UpdateElement();
                Character.Client.Send(new MountRidingMessage(mount.Toggled));
                Character.RefreshStats();
                Character.RefreshActorOnMap();
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Appelée lorsque la position d'un item a été modifié
        /// </summary>
        /// <param name="item"></param>
        /// <param name="lastPosition"></param>
        private void OnItemMoved(CharacterItemRecord item, CharacterInventoryPositionEnum lastPosition)
        {
            bool flag  = lastPosition != CharacterInventoryPositionEnum.INVENTORY_POSITION_NOT_EQUIPED;
            bool flag2 = item.IsEquiped();


            if (flag2 && !flag)
            {
                ItemEffectsProvider.AddEffects(Character, item.Effects);
            }

            if (!flag2 && flag)
            {
                ItemEffectsProvider.RemoveEffects(Character, item.Effects);
            }

            if (item.AppearanceId != 0)
            {
                UpdateLook(item, flag2);
            }

            if (item.Template.HasSet) // Si il y a une panoplie
            {
                int num = CountItemSetEquiped(item.Template.ItemSet);

                if (flag2) //Si on vient d'équiper l'objet
                {
                    ApplyItemSetEffects(item.Template.ItemSet, num, flag2);
                }
                else
                {
                    ApplyItemSetEffects(item.Template.ItemSet, num, flag2);
                }
            }
        }