Beispiel #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="type"></param>
        /// <param name="slot"></param>
        /// <returns></returns>
        public static bool CanPlaceInSlot(ItemTypeEnum type, ItemSlotEnum slot)
        {
            if (slot < ItemSlotEnum.SLOT_AMULET || slot > ItemSlotEnum.SLOT_BOOST_FOLLOWER)
            {
                return(false);
            }

            return(((GetSlotByType(type) | ItemSlotEnum.SLOT_INVENTORY) & slot) == slot);
        }
 /// <summary>
 ///
 /// </summary>
 /// <param name="item"></param>
 /// <param name="quantity"></param>
 /// <param name="slot"></param>
 /// <returns></returns>
 public ItemDAO MoveQuantity(ItemDAO item, int quantity, ItemSlotEnum slot = ItemSlotEnum.SLOT_INVENTORY)
 {
     if (quantity >= item.Quantity)
     {
         return(RemoveItem(item.Id, item.Quantity));
     }
     item.Quantity -= quantity;
     OnItemQuantity(item.Id, item.Quantity);
     return(item.Clone(quantity));
 }
        public InventoryItemModel GetItemInSlot(ItemSlotEnum Slot)
        {
            return(ItemsCache.Values.FirstOrDefault(x => x.Slot == Slot));

            /*foreach (var item in this.Items)
             *  if (item.Slot == Slot)
             *      return item;
             *
             * return null;*/
        }
        public bool TryMergeItem(int TemplateId, string Stats, ItemSlotEnum Slot, int Quantity = 1, InventoryItemModel RemoveItem = null)
        {
            if (Slot < ItemSlotEnum.SLOT_AMULETTE || Slot > ItemSlotEnum.SLOT_BOUCLIER)
            {
                var ItemsCopy = this.ItemsCache.ToArray();

                foreach (var Item in ItemsCopy)
                {
                    if (Item.Value.GetStats().ToItemStats() == Stats && Item.Value.TemplateID == TemplateId && Item.Value.Slot == Slot)
                    {
                        if (RemoveItem != null)
                        {
                            InventoryItemTable.removeItem(RemoveItem.ID);
                            Player.Send(new ObjectRemoveMessage(RemoveItem.ID));
                        }

                        this.UpdateObjectquantity(Item.Value, Item.Value.Quantity + Quantity);
                        return(true);
                    }
                }
            }

            return(false);
        }
Beispiel #5
0
        public static bool CanPlaceInSlot(ItemTypeEnum Type, ItemSlotEnum Slot)
        {
            switch (Type)
            {
            case ItemTypeEnum.ITEM_TYPE_AMULETTE:
                if (Slot == ItemSlotEnum.SLOT_AMULETTE)
                {
                    return(true);
                }
                break;

            case ItemTypeEnum.ITEM_TYPE_ARC:
            case ItemTypeEnum.ITEM_TYPE_BAGUETTE:
            case ItemTypeEnum.ITEM_TYPE_BATON:
            case ItemTypeEnum.ITEM_TYPE_DAGUES:
            case ItemTypeEnum.ITEM_TYPE_EPEE:
            case ItemTypeEnum.ITEM_TYPE_MARTEAU:
            case ItemTypeEnum.ITEM_TYPE_PELLE:
            case ItemTypeEnum.ITEM_TYPE_HACHE:
            case ItemTypeEnum.ITEM_TYPE_OUTIL:
            case ItemTypeEnum.ITEM_TYPE_PIOCHE:
            case ItemTypeEnum.ITEM_TYPE_FAUX:
            case ItemTypeEnum.ITEM_TYPE_PIERRE_AME:
                if (Slot == ItemSlotEnum.SLOT_ARME)
                {
                    return(true);
                }
                break;

            case ItemTypeEnum.ITEM_TYPE_ANNEAU:
                if (Slot == ItemSlotEnum.SLOT_ANNEAU_D || Slot == ItemSlotEnum.SLOT_ANNEAU_G)
                {
                    return(true);
                }
                break;

            case ItemTypeEnum.ITEM_TYPE_CEINTURE:
                if (Slot == ItemSlotEnum.SLOT_CEINTURE)
                {
                    return(true);
                }
                break;

            case ItemTypeEnum.ITEM_TYPE_BOTTES:
                if (Slot == ItemSlotEnum.SLOT_BOTTES)
                {
                    return(true);
                }
                break;

            case ItemTypeEnum.ITEM_TYPE_COIFFE:
                if (Slot == ItemSlotEnum.SLOT_COIFFE)
                {
                    return(true);
                }
                break;

            case ItemTypeEnum.ITEM_TYPE_CAPE:
                if (Slot == ItemSlotEnum.SLOT_CAPE)
                {
                    return(true);
                }
                break;

            case ItemTypeEnum.ITEM_TYPE_FAMILIER:
                if (Slot == ItemSlotEnum.SLOT_FAMILIER)
                {
                    return(true);
                }
                break;

            case ItemTypeEnum.ITEM_TYPE_DOFUS:
                if (Slot == ItemSlotEnum.SLOT_DOFUS_1 ||
                    Slot == ItemSlotEnum.SLOT_DOFUS_2 ||
                    Slot == ItemSlotEnum.SLOT_DOFUS_3 ||
                    Slot == ItemSlotEnum.SLOT_DOFUS_4 ||
                    Slot == ItemSlotEnum.SLOT_DOFUS_5 ||
                    Slot == ItemSlotEnum.SLOT_DOFUS_6)
                {
                    return(true);
                }
                break;

            case ItemTypeEnum.ITEM_TYPE_BOUCLIER:
                if (Slot == ItemSlotEnum.SLOT_BOUCLIER)
                {
                    return(true);
                }
                break;
            }

            return(false);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="item"></param>
        /// <param name="slot"></param>
        /// <param name="quantity"></param>
        public void MoveItem(ItemDAO item, ItemSlotEnum slot, int quantity = 1)
        {
            if (slot == item.Slot)
                return;

            if (quantity > item.Quantity || quantity < 1)
                quantity = item.Quantity;

            if (item.IsEquiped && !ItemDAO.IsEquipedSlot(slot))
            {
                if (item.IsBoostEquiped)
                    Entity.Statistics.UnMerge(StatsType.TYPE_BOOST, item.Statistics);
                else
                    Entity.Statistics.UnMerge(StatsType.TYPE_ITEM, item.Statistics);

                if (item.Slot == ItemSlotEnum.SLOT_WEAPON)
                {
                    Entity.Dispatch(WorldMessage.JOB_TOOL_EQUIPPED());
                }

                item.SlotId = (int)slot;
                m_entityLookRefresh = true;
                bool merged = AddItem(MoveQuantity(item, 1));

                RemoveSet(item);

                // send new stats
                if (Entity.Type == EntityTypeEnum.TYPE_CHARACTER)
                {
                    Entity.MovementHandler.Dispatch(WorldMessage.ENTITY_OBJECT_ACTUALIZE(Entity));

                    CachedBuffer = true;
                    if (!merged)
                        Dispatch(WorldMessage.OBJECT_MOVE_SUCCESS(item.Id, item.SlotId));
                    Dispatch(WorldMessage.ACCOUNT_STATS((CharacterEntity)Entity));
                    if (item.Template.SetId != 0)
                        Dispatch(WorldMessage.ITEM_SET(item.Template.Set, Items.Where(entry => entry.Template.SetId == item.Template.SetId && entry.IsEquiped)));
                    CachedBuffer = false;
                }
                return;
            }
            else if (!item.IsEquiped && ItemDAO.IsEquipedSlot(slot))
            {
                if (!ItemTemplateDAO.CanPlaceInSlot((ItemTypeEnum)item.Template.Type, slot))
                {
                    base.Dispatch(WorldMessage.OBJECT_MOVE_ERROR());
                    return;
                }

                // level required
                if (Entity.Level < item.Template.Level)
                {
                    base.Dispatch(WorldMessage.OBJECT_MOVE_ERROR_REQUIRED_LEVEL());
                    return;
                }

                // Already equiped template
                if (HasTemplateEquiped(item.TemplateId))
                {
                    base.Dispatch(WorldMessage.OBJECT_MOVE_ERROR_ALREADY_EQUIPED());
                    return;
                }

                if (Entity.Type == EntityTypeEnum.TYPE_CHARACTER)
                {
                    if (!item.SatisfyConditions((CharacterEntity)Entity))
                    {
                        base.Dispatch(WorldMessage.INFORMATION_MESSAGE(InformationTypeEnum.ERROR, InformationEnum.ERROR_CONDITIONS_UNSATISFIED));
                        return;
                    }
                }

                var equipedItem = Items.Find(entry => entry.SlotId == (int)slot && entry.Id != item.Id);

                // already equiped in slot ? remove it
                if (equipedItem != null)
                {
                    MoveItem(equipedItem, ItemSlotEnum.SLOT_INVENTORY);
                }

                m_entityLookRefresh = true;
                var newItem = MoveQuantity(item, 1);
                newItem.SlotId = (int)slot;
                AddItem(newItem, false);

                AddSet(newItem);

                if (item.IsBoostEquiped)
                    Entity.Statistics.Merge(StatsType.TYPE_BOOST, item.Statistics);
                else
                    Entity.Statistics.Merge(StatsType.TYPE_ITEM, item.Statistics);

                // send new stats
                if (Entity.Type == EntityTypeEnum.TYPE_CHARACTER)
                {
                    Entity.MovementHandler.Dispatch(WorldMessage.ENTITY_OBJECT_ACTUALIZE(Entity));

                    base.CachedBuffer = true;
                    Entity.MovementHandler.Dispatch(WorldMessage.ENTITY_OBJECT_ACTUALIZE(Entity));
                    base.Dispatch(WorldMessage.ACCOUNT_STATS((CharacterEntity)Entity));
                    if(item.Template.SetId != 0)
                        base.Dispatch(WorldMessage.ITEM_SET(item.Template.Set, Items.Where(entry => entry.Template.SetId == item.Template.SetId && entry.IsEquiped)));
                    if (newItem.Slot == ItemSlotEnum.SLOT_WEAPON)
                    {
                        var character = (CharacterEntity)Entity;
                        character.CharacterJobs.ToolEquipped(item.TemplateId);
                    }
                    base.CachedBuffer = false;
                }
            }
            else
            {
                var newItem = MoveQuantity(item, quantity);
                newItem.SlotId = (int)slot;
                if(!AddItem(newItem, false))
                   base.Dispatch(WorldMessage.OBJECT_MOVE_SUCCESS(item.Id, item.SlotId));
            }
        }
Beispiel #7
0
        public override void Execute(WorldClient Client, CommandParameters parameters)
        {
            if (Settings.AppSettings.GetBoolElement("NpcShop.Fm"))
            {
                if ((Program.currentTimeMillis() - Client.lastCheckPoint) < 3000)
                {
                    return;
                }
                if (parameters.Lenght < 2)
                {
                    Client.Send(new ChatGameMessage("Syntaxe invalide : .fm coiffe/cape pa/po/pm", "682B2B"));
                    return;
                }
                ItemSlotEnum Slot = ItemSlotEnum.SLOT_ITEMBAR_13;
                if (parameters.GetParameter(0) == "coiffe")
                {
                    Slot = ItemSlotEnum.SLOT_COIFFE;
                }
                else if (parameters.GetParameter(0) == "cape")
                {
                    Slot = ItemSlotEnum.SLOT_CAPE;
                }
                else
                {
                    Client.Send(new ChatGameMessage("Liste disponnible : coiffe/cape", "682B2B"));
                    return;
                }
                var Effect = EffectEnum.AddPods;
                switch (parameters.GetParameter(1))
                {
                case "pa":
                    Effect = EffectEnum.AddPA;
                    break;

                case "pm":
                    Effect = EffectEnum.AddPM;
                    break;

                case "po":
                    Effect = EffectEnum.AddPO;
                    break;

                default:
                    Client.Send(new ChatGameMessage("Liste disponnible : pa/pm/po", "682B2B"));
                    return;
                }
                var Points = AccountTable.getPoints(Client.Account);
                if (Settings.AppSettings.GetIntElement("NpcShop.FmCost") > Points)
                {
                    Client.Send(new ChatGameMessage("Il vous manque " + (Settings.AppSettings.GetIntElement("NpcShop.FmCost") - Points) + " points pour utiliser ce privilege", "682B2B"));
                    return;
                }
                var Object = Client.Character.InventoryCache.GetItemInSlot(Slot);
                if (Object == null)
                {
                    Client.Send(new ChatGameMessage("Vous ne portez pas de " + parameters.GetParameter(0), "682B2B"));
                    return;
                }
                if (Client.GetFight() != null)
                {
                    Client.Send(new ChatGameMessage("Impossible en combat", "682B2B"));
                    return;
                }
                if (Object.GetStats().GetEffectFM(Effect).Total != 0)
                {
                    Client.Send(new ChatGameMessage("Votre " + parameters.GetParameter(0) + " donne déjà un " + parameters.GetParameter(1), "682B2B"));
                    return;
                }
                if (Effect != EffectEnum.AddPO)
                {
                    if (Object.GetStats().GetEffectFM(EffectEnum.AddPM).Total != 0 || Object.GetStats().GetEffectFM(EffectEnum.AddPA).Total != 0)
                    {
                        Client.Send(new ChatGameMessage("Votre " + parameters.GetParameter(0) + " donne déjà un pa ou un pm", "682B2B"));
                        return;
                    }
                }
                AccountTable.SubstractPoints(Client.Account.ID, Settings.AppSettings.GetIntElement("NpcShop.FmCost"));
                Client.Character.GetStats().UnMerge(Object.GetStats());
                Object.GetStats().AddItem(Effect, 1);
                Client.Character.GetStats().Merge(Object.GetStats());

                Client.Send(new ObjectRemoveMessage(Object.ID));
                Client.Send(new ObjectAddInventoryMessage(Object));
                Client.Send(new FmMoveMessage("KO+" + Object.ID + "|1|" + Object.TemplateID + "|" + Object.GetStats().ToItemStats().Replace(";", "#")));
                Client.Send(new FmCMessage("K;" + Object.TemplateID));
                InventoryItemTable.Update(Object);
                Client.Send(new ChatGameMessage("Votre " + Object.Template.Name + " donne désormais +1" + parameters.GetParameter(1).ToUpper() + " en plus de ses jets habituels !", "FF0000"));
                Client.Send(new AccountStatsMessage(Client.Character));
                Client.lastCheckPoint = Program.currentTimeMillis();
                return;
            }
            else
            {
                Client.Send(new ChatGameMessage("Fromagerie desactivée", "046380"));
            }
        }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="item"></param>
 /// <param name="quantity"></param>
 /// <param name="slot"></param>
 /// <returns></returns>
 public ItemDAO MoveQuantity(ItemDAO item, int quantity, ItemSlotEnum slot = ItemSlotEnum.SLOT_INVENTORY)
 {
     if(quantity >= item.Quantity)
         return RemoveItem(item.Id, item.Quantity);
     item.Quantity -= quantity;
     OnItemQuantity(item.Id, item.Quantity);
     return item.Clone(quantity);
 }
Beispiel #9
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="quantity"></param>
 /// <param name="slot"></param>
 /// <param name="maxJet"></param>
 /// <returns></returns>
 public ItemDAO Create(int quantity = 1, ItemSlotEnum slot = ItemSlotEnum.SLOT_INVENTORY, bool maxJet = false)
 {
     return(InventoryItemRepository.Instance.Create(Id, -1, quantity, GenerateStats(maxJet), slot));
 }
Beispiel #10
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public ItemDAO Create(int templateId, long ownerId, int quantity, GenericStats statistics, ItemSlotEnum slot = ItemSlotEnum.SLOT_INVENTORY)
        {
            var instance = new ItemDAO();

            instance.Id            = NextItemId;
            instance.OwnerId       = -1;
            instance.TemplateId    = templateId;
            instance.Quantity      = quantity;
            instance.Effects       = statistics.Serialize();
            instance.StringEffects = statistics.ToItemStats();
            instance.SlotId        = (int)slot;

            base.Created(instance);

            return(instance);
        }
Beispiel #11
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="character"></param>
        /// <param name="parameters"></param>
        /// <returns></returns>
        public override bool Process(Entity.CharacterEntity character, Dictionary <string, string> parameters)
        {
            var itemId   = int.Parse(parameters["itemId"]);
            var template = ItemTemplateRepository.Instance.GetById(itemId);

            if (template == null)
            {
                return(false);
            }

            ItemSlotEnum slot = ItemSlotEnum.SLOT_INVENTORY;

            switch ((ItemTypeEnum)template.Type)
            {
            case ItemTypeEnum.TYPE_TRANSFORM:
                slot = ItemSlotEnum.SLOT_BOOST_MUTATION;
                break;

            case ItemTypeEnum.TYPE_PERSO_SUIVEUR:
                slot = ItemSlotEnum.SLOT_BOOST_FOLLOWER;
                break;

            case ItemTypeEnum.TYPE_BENEDICTION:
                if (character.Inventory.Items.Any(entry => entry.Slot == ItemSlotEnum.SLOT_BOOST_BENEDICTION))
                {
                    slot = ItemSlotEnum.SLOT_BOOST_BENEDICTION_1;
                }
                else
                {
                    slot = ItemSlotEnum.SLOT_BOOST_BENEDICTION;
                }
                break;

            case ItemTypeEnum.TYPE_MALEDICTION:
                if (character.Inventory.Items.Any(entry => entry.Slot == ItemSlotEnum.SLOT_BOOST_MALEDICTION))
                {
                    slot = ItemSlotEnum.SLOT_BOOST_MALEDICTION_1;
                }
                else
                {
                    slot = ItemSlotEnum.SLOT_BOOST_MALEDICTION;
                }
                break;

            case ItemTypeEnum.TYPE_RP_BUFF:
                slot = ItemSlotEnum.SLOT_BOOST_ROLEPLAY_BUFF;
                break;

            case ItemTypeEnum.TYPE_BOOST_FOOD:
                slot = ItemSlotEnum.SLOT_BOOST_FOOD;
                break;
            }

            if (character.Inventory.Items.Any(entry => entry.Slot == slot || entry.TemplateId == itemId))
            {
                character.Dispatch(WorldMessage.IM_ERROR_MESSAGE(InformationEnum.ERROR_CONDITIONS_UNSATISFIED));
                return(false);
            }

            var item = template.Create(1, slot);

            character.CachedBuffer = true;
            character.Statistics.Merge(StatsType.TYPE_BOOST, item.Statistics);
            character.Inventory.AddItem(item);
            character.SendAccountStats();
            character.CachedBuffer = false;

            return(true);
        }
Beispiel #12
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="item"></param>
        /// <param name="slot"></param>
        /// <param name="quantity"></param>
        public void MoveItem(ItemDAO item, ItemSlotEnum slot, int quantity = 1)
        {
            if (slot == item.Slot)
            {
                return;
            }

            if (quantity > item.Quantity || quantity < 1)
            {
                quantity = item.Quantity;
            }

            if (item.IsEquiped && !ItemDAO.IsEquipedSlot(slot))
            {
                if (item.IsBoostEquiped)
                {
                    Entity.Statistics.UnMerge(StatsType.TYPE_BOOST, item.Statistics);
                }
                else
                {
                    Entity.Statistics.UnMerge(StatsType.TYPE_ITEM, item.Statistics);
                }

                if (item.Slot == ItemSlotEnum.SLOT_WEAPON)
                {
                    Entity.Dispatch(WorldMessage.JOB_TOOL_EQUIPPED());
                }

                item.SlotId         = (int)slot;
                m_entityLookRefresh = true;
                bool merged = AddItem(MoveQuantity(item, 1));

                RemoveSet(item);

                // send new stats
                if (Entity.Type == EntityTypeEnum.TYPE_CHARACTER)
                {
                    Entity.MovementHandler.Dispatch(WorldMessage.ENTITY_OBJECT_ACTUALIZE(Entity));

                    CachedBuffer = true;
                    if (!merged)
                    {
                        Dispatch(WorldMessage.OBJECT_MOVE_SUCCESS(item.Id, item.SlotId));
                    }
                    Dispatch(WorldMessage.ACCOUNT_STATS((CharacterEntity)Entity));
                    if (item.Template.SetId != 0)
                    {
                        Dispatch(WorldMessage.ITEM_SET(item.Template.Set, Items.Where(entry => entry.Template.SetId == item.Template.SetId && entry.IsEquiped)));
                    }
                    CachedBuffer = false;
                }
                return;
            }
            else if (!item.IsEquiped && ItemDAO.IsEquipedSlot(slot))
            {
                if (!ItemTemplateDAO.CanPlaceInSlot((ItemTypeEnum)item.Template.Type, slot))
                {
                    base.Dispatch(WorldMessage.OBJECT_MOVE_ERROR());
                    return;
                }

                // level required
                if (Entity.Level < item.Template.Level)
                {
                    base.Dispatch(WorldMessage.OBJECT_MOVE_ERROR_REQUIRED_LEVEL());
                    return;
                }

                // Already equiped template
                if (HasTemplateEquiped(item.TemplateId))
                {
                    base.Dispatch(WorldMessage.OBJECT_MOVE_ERROR_ALREADY_EQUIPED());
                    return;
                }

                if (Entity.Type == EntityTypeEnum.TYPE_CHARACTER)
                {
                    if (!item.SatisfyConditions((CharacterEntity)Entity))
                    {
                        base.Dispatch(WorldMessage.INFORMATION_MESSAGE(InformationTypeEnum.ERROR, InformationEnum.ERROR_CONDITIONS_UNSATISFIED));
                        return;
                    }
                }

                var equipedItem = Items.Find(entry => entry.SlotId == (int)slot && entry.Id != item.Id);

                // already equiped in slot ? remove it
                if (equipedItem != null)
                {
                    MoveItem(equipedItem, ItemSlotEnum.SLOT_INVENTORY);
                }

                m_entityLookRefresh = true;
                var newItem = MoveQuantity(item, 1);
                newItem.SlotId = (int)slot;
                AddItem(newItem, false);

                AddSet(newItem);

                if (item.IsBoostEquiped)
                {
                    Entity.Statistics.Merge(StatsType.TYPE_BOOST, item.Statistics);
                }
                else
                {
                    Entity.Statistics.Merge(StatsType.TYPE_ITEM, item.Statistics);
                }

                // send new stats
                if (Entity.Type == EntityTypeEnum.TYPE_CHARACTER)
                {
                    Entity.MovementHandler.Dispatch(WorldMessage.ENTITY_OBJECT_ACTUALIZE(Entity));

                    base.CachedBuffer = true;
                    Entity.MovementHandler.Dispatch(WorldMessage.ENTITY_OBJECT_ACTUALIZE(Entity));
                    base.Dispatch(WorldMessage.ACCOUNT_STATS((CharacterEntity)Entity));
                    if (item.Template.SetId != 0)
                    {
                        base.Dispatch(WorldMessage.ITEM_SET(item.Template.Set, Items.Where(entry => entry.Template.SetId == item.Template.SetId && entry.IsEquiped)));
                    }
                    if (newItem.Slot == ItemSlotEnum.SLOT_WEAPON)
                    {
                        var character = (CharacterEntity)Entity;
                        character.CharacterJobs.ToolEquipped(item.TemplateId);
                    }
                    base.CachedBuffer = false;
                }
            }
            else
            {
                var newItem = MoveQuantity(item, quantity);
                newItem.SlotId = (int)slot;
                if (!AddItem(newItem, false))
                {
                    base.Dispatch(WorldMessage.OBJECT_MOVE_SUCCESS(item.Id, item.SlotId));
                }
            }
        }
Beispiel #13
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="slot"></param>
 /// <returns></returns>
 public static bool IsBoostSlot(ItemSlotEnum slot)
 {
     return(slot >= ItemSlotEnum.SLOT_BOOST_MUTATION && slot <= ItemSlotEnum.SLOT_BOOST_FOLLOWER);
 }
Beispiel #14
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="slot"></param>
 /// <returns></returns>
 public static bool IsEquipedSlot(ItemSlotEnum slot)
 {
     return(slot >= ItemSlotEnum.SLOT_AMULET && slot <= ItemSlotEnum.SLOT_BOOST_FOLLOWER);
 }
Beispiel #15
0
        public void MoveItem(int Guid, ItemSlotEnum Slot, bool Packet, int Quantity = 1)
        {
            var Item = this.get(Guid);

            // Item inexistant
            if (Item == null)
            {
                return;
            }

            // Meme endroit ?
            if (Item.Slot == Slot)
            {
                return;
            }

            // Veu equiper un item
            if (Slot > ItemSlotEnum.SLOT_INVENTAIRE && Slot <= ItemSlotEnum.SLOT_BOUCLIER)
            {
                if (Item.Template.Type == 113)
                {
                    if (this.GetItemInSlot(Slot) == null)
                    {
                        this.Player.Send(new TextInformationMessage(TextInformationTypeEnum.ERREUR, 161));
                        return;
                    }
                    if (Item.Quantity > 1)
                    {
                        if (Quantity > Item.Quantity)
                        {
                            Quantity = Item.Quantity;
                        }
                        int newQ = Item.Quantity - Quantity;
                        if (newQ > 0)
                        {
                            InventoryItemTable.TryCreateItem(Item.TemplateID, this.Player, newQ, -1, Item.GetStats().ToItemStats());
                            UpdateObjectquantity(Item, Quantity);
                        }
                    }
                    var EquipedItemB = this.GetItemInSlot(Slot);

                    var SpeakingTestItem = SpeakingTable.Cache.Values.FirstOrDefault(x => x != null && x.LinkedItem == Item.ID && x.Associated == 0);

                    if (SpeakingTestItem != null)
                    {
                        EquipedItemB.SpeakingID     = SpeakingTestItem.ID;
                        SpeakingTestItem.Stats      = EquipedItemB.GetStats().ToItemStats();
                        SpeakingTestItem.LinkedItem = EquipedItemB.ID;
                        SpeakingTestItem.Associated = 1;
                        remove(Item.ID);
                        Player.Send(new ObjectRemoveMessage(Item.ID));
                        Player.Send(new ObjectRefreshMessage(EquipedItemB));
                        Player.myMap.SendToMap(new ObjectActualiseMessage(Player));
                        if (Player.Client.GetFight() != null)
                        {
                            Player.Client.GetFight().SendToFight(new ObjectActualiseMessage(Player));
                        }
                        return;
                    }

                    var    ID        = DatabaseCache.nextSpeakingId++;
                    String Date      = DateTime.Now.Month + "" + DateTime.Now.Day;
                    String InterDate = (DateTime.Now.Month + 3) + "" + DateTime.Now.Day;
                    String Time      = DateTime.Now.Hour + "" + DateTime.Now.Minute;

                    Speaking newItem = new Speaking(ID, DateTime.Now.Year, int.Parse(Date), int.Parse(Time), 1, 1, EquipedItemB.Template.Type, EquipedItemB.ID, 0, DateTime.Now.Year, int.Parse(InterDate), int.Parse(Time), DateTime.Now.Year, int.Parse(Date), int.Parse(Time), 1, Item.TemplateID, Item.ID, EquipedItemB.GetStats().ToItemStats());
                    SpeakingTable.New(newItem);
                    EquipedItemB.SpeakingID = ID;
                    remove(Item.ID);
                    Player.Send(new ObjectRemoveMessage(Item.ID));
                    Player.Send(new ObjectRefreshMessage(EquipedItemB));
                    Player.myMap.SendToMap(new ObjectActualiseMessage(Player));
                    if (Player.Client.GetFight() != null)
                    {
                        Player.Client.GetFight().SendToFight(new ObjectActualiseMessage(Player));
                    }
                    return;
                }

                // Il peu placer l'item dans le slot desiré ?
                if (!ItemTemplateModel.CanPlaceInSlot(ItemTemplateTable.GetTemplate(Item.TemplateID).ItemType, Slot))
                {
                    return;
                }

                // Level requis
                if (ItemTemplateTable.GetTemplate(Item.TemplateID).Level > Player.Level)
                {
                    if (Packet)
                    {
                        Player.Send(new ObjectMoveFailMessage(ObjectMoveFailReasonEnum.REASON_LEVEL_REQUIRED));
                    }
                    return;
                }

                if (!ItemTemplateTable.GetTemplate(Item.TemplateID).Criterions.Equals("") && !ConditionParser.validConditions(this.Player, ItemTemplateTable.GetTemplate(Item.TemplateID).Criterions))
                {
                    this.Player.Send(new ImMessage("119|43"));
                    return;
                }

                var EquipedItem = this.GetItemInSlot(Slot);

                // Si item deja equipé dans le slot
                if (EquipedItem != null)
                {
                    // Deplacement dans l'inventaire
                    Player.GetStats().UnMerge(EquipedItem.GetStats());
                    this.Player.Life    -= EquipedItem.GetStats().GetTotal(EffectEnum.AddVitalite);
                    EquipedItem.Position = -1;
                    Player.Send(new ObjectMoveSucessMessage(EquipedItem.ID, -1));
                }

                // Template deja equipé
                if (this.HasTemplateEquiped(Item.TemplateID))
                {
                    if (Packet)
                    {
                        Player.Send(new ObjectMoveFailMessage(ObjectMoveFailReasonEnum.REASON_ALREADY_EQUIPED));
                    }
                    return;
                }

                /*var simlarItem = this.getSimilarInventoryItem(Item);
                 * if (simlarItem != null)
                 * {
                 *  this.UpdateObjectquantity(simlarItem, simlarItem.Quantity + Item.Quantity);
                 *  remove(Item.ID);
                 *  InventoryItemTable.removeItem(Item.ID);
                 *  Player.Send(new ObjectRemoveMessage(Item.ID));
                 *
                 * }
                 * else*/
                if (Item.Quantity > 1)
                {
                    var NewItem = InventoryItemTable.TryCreateItem(Item.TemplateID, this.Player, 1, (short)Slot, Item.Effects);
                    this.UpdateObjectquantity(Item, Item.Quantity - 1);
                }
                else
                {
                    // On modifi la position et fusionne les stats
                    Item.Position = (short)Slot;
                    Player.Send(new ObjectMoveSucessMessage(Item.ID, (short)Slot));
                    Player.Send(new ObjectMoveSucessMessage(Item.ID, (short)Item.Position));
                }

                if (GetItemInSlot(ItemSlotEnum.SLOT_ARME) != null)
                {
                    Player.Send(new ObjectTaskMessage(-1));
                }

                Player.GetStats().Merge(Item.GetStats());
                this.Player.Life += Item.GetStats().GetTotal(EffectEnum.AddVitalite);
                this.Player.Life += Item.GetStats().GetTotal(EffectEnum.AddVie);
                if (Packet)
                {
                    Player.Client.Send(new AccountStatsMessage(Player));
                    Player.myMap.SendToMap(new ObjectActualiseMessage(Player));
                    if (Player.Client.GetFight() != null)
                    {
                        Player.Client.GetFight().SendToFight(new ObjectActualiseMessage(Player));
                    }
                }
            }
            else
            {
                var NeedActualise = false;

                // Si l'item est equipé, on deduit les stats
                if (Item.Slot > ItemSlotEnum.SLOT_INVENTAIRE && Item.Slot < ItemSlotEnum.SLOT_BOUCLIER)
                {
                    // Retire les stats
                    Player.GetStats().UnMerge(Item.GetStats());
                    this.Player.Life -= Item.GetStats().GetTotal(EffectEnum.AddVitalite);
                    this.Player.Life -= Item.GetStats().GetTotal(EffectEnum.AddVie);
                    if (Player.Life <= 0)
                    {
                        Player.Life = 1;
                    }
                    if (Packet)
                    {
                        Player.Client.Send(new AccountStatsMessage(this.Player));
                        NeedActualise = true;
                    }
                }

                // On tente de fusionner
                if (!this.TryMergeItem(Item.TemplateID, Item.Effects, Slot, Item.Quantity, Item))
                {
                    Item.Position = (short)Slot;
                    if (Packet)
                    {
                        Player.Send(new ObjectMoveSucessMessage(Item.ID, (short)Item.Position));
                    }
                }

                if (NeedActualise)
                {
                    Player.myMap.SendToMap(new ObjectActualiseMessage(Player));
                    if (Player.Client.GetFight() != null)
                    {
                        Player.Client.GetFight().SendToFight(new ObjectActualiseMessage(Player));
                    }
                }
            }
            onMoveItem(Item);
        }