public override bool Drop(BasePlayerItem dropOnItem) { if (Owner.IsInFight()) { return(false); } var compatibleEffect = Effects.FirstOrDefault(x => x.EffectId == EffectsEnum.Effect_Compatible) as EffectInteger; if (compatibleEffect == null) { return(false); } if (dropOnItem.Template.TypeId != compatibleEffect.Value) { return(false); } if (dropOnItem.Effects.Any(x => x.EffectId == EffectsEnum.Effect_LivingObjectId || x.EffectId == EffectsEnum.Effect_Appearance || x.EffectId == EffectsEnum.Effect_Apparence_Wrapper)) { return(false); } dropOnItem.Effects.Add(new EffectInteger(EffectsEnum.Effect_Apparence_Wrapper, (short)Template.Id)); dropOnItem.Invalidate(); Owner.Inventory.RefreshItem(dropOnItem); dropOnItem.OnObjectModified(); Owner.UpdateLook(); InventoryHandler.SendWrapperObjectAssociatedMessage(Owner.Client, dropOnItem); return(true); }
public override bool Drop(BasePlayerItem dropOnItem) { var allowedItemType = new[] { ItemTypeEnum.AMULETTE, ItemTypeEnum.ARC, ItemTypeEnum.BAGUETTE, ItemTypeEnum.BÂTON, ItemTypeEnum.DAGUE, ItemTypeEnum.ÉPÉE, ItemTypeEnum.MARTEAU, ItemTypeEnum.PELLE, ItemTypeEnum.ANNEAU, ItemTypeEnum.CEINTURE, ItemTypeEnum.BOTTES, ItemTypeEnum.CHAPEAU, ItemTypeEnum.CAPE, ItemTypeEnum.HACHE, ItemTypeEnum.PIOCHE, ItemTypeEnum.FAUX, ItemTypeEnum.SAC_À_DOS }; if (!allowedItemType.Contains((ItemTypeEnum)dropOnItem.Template.TypeId)) { Owner.SendServerMessage("L'amélioration a échouée : Vous ne pouvez pas améliorer ce type d'objet."); return(false); } if (Effects.Any(x => x.EffectId == EffectsEnum.Effect_AddRange || x.EffectId == EffectsEnum.Effect_AddRange_136)) { if (dropOnItem.Effects.Exists(x => x.EffectId == EffectsEnum.Effect_AddRange || x.EffectId == EffectsEnum.Effect_AddRange_136)) { Owner.SendServerMessage("L'amélioration a échouée : L'objet possède déjà un PO."); return(false); } } else { if (dropOnItem.Effects.Exists(x => x.EffectId == EffectsEnum.Effect_AddMP || x.EffectId == EffectsEnum.Effect_AddMP_128 || x.EffectId == EffectsEnum.Effect_AddAP_111)) { Owner.SendServerMessage("L'amélioration a échouée : L'objet possède déjà un PA, ou un PM."); return(false); } } ApplyEffects(dropOnItem, ItemEffectHandler.HandlerOperation.UNAPPLY); dropOnItem.Effects.AddRange(Effects); dropOnItem.Invalidate(); Owner.Inventory.RefreshItem(dropOnItem); dropOnItem.OnObjectModified(); ApplyEffects(dropOnItem, ItemEffectHandler.HandlerOperation.APPLY); Owner.RefreshStats(); Owner.SendServerMessage("Votre objet a été amélioré avec succès !"); return(true); }