protected virtual void GenerateTreasure() { Item item = null; AddLoot(LootPack.Food, m_FoodQuantity); AddLoot(LootPack.Junk, m_JunkQuantity); AddLoot(LootPack.UtilityItems, m_UtilityQuantity); AddLoot(LootPack.Regs, m_RegsQuantity); AddLoot(LootPack.NecroRegs, m_NecroRegsQuantity); AddLoot(LootPack.LeatherAr, m_LeatherARQuantity); AddLoot(LootPack.ChainAr, m_ChainARQuantity); AddLoot(LootPack.RingAr, m_RingARQuantity); AddLoot(LootPack.PlateAr, m_PlateARQuantity); //AddLoot(LootPack.Scrolls, m_ScrollsQuantity); if (m_GoldQuantity >= 1) { item = new Gold(m_GoldQuantity + Utility.Random(1, 5)); this.DropItem(item); } if (m_SpecialItemsQuantity >= 1) { for (int i = 0; i < m_SpecialItemsQuantity; ++i) { this.DropItem(Dupe.DupeItem(null, cont.Items[Utility.Random(0, cont.Items.Count - 1)], true)); } } }
public override IEntity GetEntity() { if (Item != null && !Item.Deleted) { return(Dupe.DupeItem(Item)); } return(_Init ? base.GetEntity() : null); }
protected override void OnTarget(Mobile from, object targeted) { if (targeted is Item) { foreach (Mobile m in World.Mobiles.Values) { Item i = Dupe.DupeItem(null, (Item)targeted, true); m.AddToBackpack(i); } } else { from.SendMessage("Ceci n'est pas un item."); } }
/// <summary> /// Augmente le rang du joueur de 1 si c'est possible, et lui donne le stock lié à son nouveau rang. /// Si le rang est == à 1, on vérifie si il n'a pas déjà eu son stock de départ. /// </summary> /// <param name="m">Le mobile à rankup.</param> public void RankUp(Mobile m) { if (m_Mobiles.ContainsKey(m)) { if (m_Mobiles[m] >= 0 && m_Mobiles[m] < RANKMAX) { m_Mobiles[m]++; if (!(m_RegisteredMobiles.Contains(m)) || m_Mobiles[m] != 1) // Si le nouveau rang est == 1, cela veut dire que l'ancien était 0. { if (Containers[m_Mobiles[m]] != null) { Item i = Dupe.DupeItem(m, Containers[m_Mobiles[m]], true); // On dupe le container lié au rang du mobile. i.Visible = true; m.Backpack.AddItem(i); } } } } }
public Fetichisme(Mobile Target) : base(AIType.AI_Animal, FightMode.None, 10, 1, 0.1, 0.1) { Name = Target.Name; Hue = Target.Hue; Body = Target.Body; SetStr(Target.Str); SetDex(Target.Dex); SetInt(Target.Int); SetHits(Target.HitsMax); Hits = Target.Hits; Mana = Target.Mana; Stam = Target.Stam; if (Target.Weapon != null) { BaseWeapon weapon = (BaseWeapon)Target.Weapon; SetDamage((int)weapon.MinDamage - 5, (int)weapon.MaxDamage + 5); } else { SetDamage(10, 30); } //SetSkill(SkillName.EvalInt, Target.Skills[SkillName.EvalInt].Value); SetSkill(SkillName.ArtMagique, Target.Skills[SkillName.ArtMagique].Value); //SetSkill(SkillName.MagicResist, Target.Skills[SkillName.MagicResist].Value); SetSkill(SkillName.Tactiques, Target.Skills[SkillName.Tactiques].Value); SetSkill(SkillName.Anatomie, Target.Skills[SkillName.Anatomie].Value); //SetSkill(SkillName.Swords, Target.Skills[SkillName.Swords].Value); //SetSkill(SkillName.Macing, Target.Skills[SkillName.Macing].Value); //SetSkill(SkillName.Archery, Target.Skills[SkillName.Archery].Value); //SetSkill(SkillName.Fencing, Target.Skills[SkillName.Fencing].Value); VirtualArmor = Target.VirtualArmor; ControlSlots = 1; ArrayList PossessItems = new ArrayList(Target.Items); try { for (int i = 0; i < PossessItems.Count; i++) { Item item = (Item)PossessItems[i]; if (Array.IndexOf(ItemLayers, item.Layer) != -1) { Item itemb = Dupe.DupeItem(Target, item, false); if (itemb != null) { this.EquipItem(itemb); } } } } catch (Exception e) { Console.WriteLine("Possess: MoveItems Exception: {0}", e.Message); } FocusMob = Target; Combatant = Target; }
public Copie(Mobile caster, Mobile lacopie) : base(AIType.AI_Animal, FightMode.None, 10, 1, 0.1, 0.1) { m_Caster = caster; Name = lacopie.Name; Hue = lacopie.Hue; Body = lacopie.Body; SetStr(lacopie.Str); SetDex(lacopie.Dex); SetInt(lacopie.Int); SetHits(lacopie.HitsMax / 2); if (lacopie.Weapon != null) { BaseWeapon weapon = (BaseWeapon)lacopie.Weapon; SetDamage((int)weapon.MinDamage - 5, (int)weapon.MaxDamage + 5); } else { SetDamage(10, 30); } //SetSkill(SkillName.EvalInt, lacopie.Skills[SkillName.EvalInt].Value); SetSkill(SkillName.ArtMagique, lacopie.Skills[SkillName.ArtMagique].Value); //SetSkill(SkillName.MagicResist, lacopie.Skills[SkillName.MagicResist].Value); SetSkill(SkillName.Tactiques, lacopie.Skills[SkillName.Tactiques].Value); SetSkill(SkillName.Anatomie, lacopie.Skills[SkillName.Anatomie].Value); SetSkill(SkillName.Epee, lacopie.Skills[SkillName.Epee].Value); SetSkill(SkillName.ArmeContondante, lacopie.Skills[SkillName.ArmeContondante].Value); SetSkill(SkillName.ArmeDistance, lacopie.Skills[SkillName.ArmeDistance].Value); SetSkill(SkillName.ArmePerforante, lacopie.Skills[SkillName.ArmePerforante].Value); VirtualArmor = lacopie.VirtualArmor; ControlSlots = 2; ArrayList PossessItems = new ArrayList(lacopie.Items); try { for (int i = 0; i < PossessItems.Count; i++) { Item item = (Item)PossessItems[i]; if (Array.IndexOf(ItemLayers, item.Layer) != -1) { Item itemb = Dupe.DupeItem(this, item, false); if (itemb != null) { this.EquipItem(itemb); } } } } catch (Exception e) { Console.WriteLine("Possess: MoveItems Exception: {0}", e.Message); } new CopieTimer(this as Copie).Start(); m_CopieTable[Caster] = this; Aggro = false; }
public void CompleteCraft(int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool, CustomCraft customCraft) { int badCraft = craftSystem.CanCraft(from, tool, m_Type); if (badCraft > 0) { if (tool != null && !tool.Deleted && tool.UsesRemaining > 0) { from.SendGump(new CraftGump(from, craftSystem, tool, badCraft)); } else { from.SendLocalizedMessage(badCraft); } return; } int checkResHue = 0, checkMaxAmount = 0; object checkMessage = null; // Not enough resource to craft it if (!ConsumeRes(from, typeRes, craftSystem, ref checkResHue, ref checkMaxAmount, ConsumeType.None, ref checkMessage)) { if (tool != null && !tool.Deleted && tool.UsesRemaining > 0) { from.SendGump(new CraftGump(from, craftSystem, tool, checkMessage)); } else if (checkMessage is int && (int)checkMessage > 0) { from.SendLocalizedMessage((int)checkMessage); } else if (checkMessage is string) { from.SendMessage((string)checkMessage); } return; } else if (!ConsumeAttributes(from, ref checkMessage, false)) { if (tool != null && !tool.Deleted && tool.UsesRemaining > 0) { from.SendGump(new CraftGump(from, craftSystem, tool, checkMessage)); } else if (checkMessage is int && (int)checkMessage > 0) { from.SendLocalizedMessage((int)checkMessage); } else if (checkMessage is string) { from.SendMessage((string)checkMessage); } return; } bool toolBroken = false; int ignored = 1; int endquality = 1; bool allRequiredSkills = true; if (CheckSkills(from, typeRes, craftSystem, ref ignored, ref allRequiredSkills)) { // Resource int resHue = 0; int maxAmount = 0; object message = null; // Not enough resource to craft it if (!ConsumeRes(from, typeRes, craftSystem, ref resHue, ref maxAmount, ConsumeType.All, ref message)) { if (tool != null && !tool.Deleted && tool.UsesRemaining > 0) { from.SendGump(new CraftGump(from, craftSystem, tool, message)); } else if (message is int && (int)message > 0) { from.SendLocalizedMessage((int)message); } else if (message is string) { from.SendMessage((string)message); } return; } else if (!ConsumeAttributes(from, ref message, true)) { if (tool != null && !tool.Deleted && tool.UsesRemaining > 0) { from.SendGump(new CraftGump(from, craftSystem, tool, message)); } else if (message is int && (int)message > 0) { from.SendLocalizedMessage((int)message); } else if (message is string) { from.SendMessage((string)message); } return; } tool.UsesRemaining--; if (craftSystem is DefBlacksmithy) { AncientSmithyHammer hammer = from.FindItemOnLayer(Layer.OneHanded) as AncientSmithyHammer; if (hammer != null && hammer != tool) { hammer.UsesRemaining--; if (hammer.UsesRemaining < 1) { hammer.Delete(); } } } if (tool.UsesRemaining < 1) { toolBroken = true; } if (toolBroken) { tool.Delete(); } int num = 0; Item item; if (customCraft != null) { item = customCraft.CompleteCraft(out num); } else if (typeof(MapItem).IsAssignableFrom(ItemType) && from.Map != Map.Trammel && from.Map != Map.Felucca) { item = new IndecipherableMap(); from.SendLocalizedMessage(1070800); // The map you create becomes mysteriously indecipherable. } else { item = Activator.CreateInstance(ItemType) as Item; } if (item != null) { if (item is ICraftable) { endquality = ((ICraftable)item).OnCraft(quality, makersMark, from, craftSystem, typeRes, tool, this, resHue); //TEST: CHECK THIS if (craftSystem is DefCarpentry) { item.Hue = resHue; } } else if (item.Hue == 0 && resHue != 0) { item.Hue = resHue; } if (maxAmount > 0) { if (!item.Stackable && item is IUsesRemaining) { ((IUsesRemaining)item).UsesRemaining *= maxAmount; } else { item.Amount = maxAmount; } } item.CraftedBy = from; item.CrafterName = from.RawName; item.ItemGroup = ItemGroupType.Crafted; if (m_Count > 1) { if (item.Stackable) { item.Amount = m_Count; from.AddToBackpack(item); } else { for (int a = 0; a < m_Count; a++) { Item duplicate = Dupe.DupeItem(item); if (duplicate != null) { from.AddToBackpack(duplicate); } } } } else { from.AddToBackpack(item); } if (from.AccessLevel > AccessLevel.Player) { CommandLogging.WriteLine(from, "Crafting {0} with craft system {1}", CommandLogging.Format(item), craftSystem.GetType().Name); } } if (num == 0) { num = craftSystem.PlayEndingEffect(from, false, true, toolBroken, endquality, makersMark, this); } bool queryFactionImbue = false; int availableSilver = 0; if (tool != null && !tool.Deleted && tool.UsesRemaining > 0) { from.SendGump(new CraftGump(from, craftSystem, tool, num)); } else if (num > 0) { from.SendLocalizedMessage(num); } } else if (!allRequiredSkills) { if (tool != null && !tool.Deleted && tool.UsesRemaining > 0) { from.SendGump(new CraftGump(from, craftSystem, tool, 1044153)); } else { from.SendLocalizedMessage(1044153); // You don't have the required skills to attempt this item. } } else { ConsumeType consumeType = (UseAllRes ? ConsumeType.Half : ConsumeType.All); int resHue = 0; int maxAmount = 0; object message = null; // Not enough resource to craft it if (!ConsumeRes(from, typeRes, craftSystem, ref resHue, ref maxAmount, consumeType, ref message, true)) { if (tool != null && !tool.Deleted && tool.UsesRemaining > 0) { from.SendGump(new CraftGump(from, craftSystem, tool, message)); } else if (message is int && (int)message > 0) { from.SendLocalizedMessage((int)message); } else if (message is string) { from.SendMessage((string)message); } return; } tool.UsesRemaining--; if (tool.UsesRemaining < 1) { toolBroken = true; } if (toolBroken) { tool.Delete(); } int num = craftSystem.PlayEndingEffect(from, true, true, toolBroken, endquality, false, this); if (tool != null && !tool.Deleted && tool.UsesRemaining > 0) { from.SendGump(new CraftGump(from, craftSystem, tool, num)); } else if (num > 0) { from.SendLocalizedMessage(num); } } }