protected override void OnTarget(Mobile from, object targeted) { if (m_Material.Deleted) { return; } ILoom loom = targeted as ILoom; if (loom == null && targeted is AddonComponent) { loom = ((AddonComponent)targeted).Addon as ILoom; } if (loom != null) { if (!m_Material.IsChildOf(from.Backpack)) { from.SendMessage("Isto precisa estar em sua mochila"); } else if (loom.Phase < 4) { m_Material.Consume(); switch (loom.Phase) { case 0: from.SendMessage("O rolo de tecido acabou de iniciar"); break; case 2: from.SendMessage("O rolo de tecido esta na metade"); break; case 3: from.SendMessage("O rolo de tecido esta quase terminando"); break; } loom.Phase++; if (targeted is Item) { ((Item)targeted).SendLocalizedMessageTo(from, 1010001 + loom.Phase++); } } else { Item create = new BoltOfCloth(); create.Hue = m_Material.Hue; m_Material.Consume(); loom.Phase = 0; from.SendMessage("Voce criou um rolo de tecido"); // You create some cloth and put it in your backpack. from.AddToBackpack(create); } } else { from.SendLocalizedMessage(500367); // Try using that on a loom. } }
protected override void OnTarget(Mobile from, object targeted) { if (m_Material.Deleted) { return; } ILoom loom = targeted as ILoom; if (loom == null && targeted is AddonComponent) { loom = ((AddonComponent)targeted).Addon as ILoom; } if (loom != null) { if (!m_Material.IsChildOf(from.Backpack)) { from.SendAsciiMessage("That must be in your pack for you to use it."); // That must be in your pack for you to use it. } else if (loom.Phase < 4) { m_Material.Consume(); if (targeted is Item) { switch (loom.Phase++) { case 0: from.Send(new AsciiMessage(((Item)targeted).Serial, ((Item)targeted).ItemID, MessageType.Regular, 0, 3, "", "The bolt of cloth has just been started.")); break; case 1: from.Send(new AsciiMessage(((Item)targeted).Serial, ((Item)targeted).ItemID, MessageType.Regular, 0, 3, "", "The bolt of cloth needs quite a bit more.")); break; case 2: from.Send(new AsciiMessage(((Item)targeted).Serial, ((Item)targeted).ItemID, MessageType.Regular, 0, 3, "", "The bolt of cloth needs a little more.")); break; case 3: from.Send(new AsciiMessage(((Item)targeted).Serial, ((Item)targeted).ItemID, MessageType.Regular, 0, 3, "", "The bolt of cloth is almost finished.")); break; } //((Item)targeted).SendLocalizedMessageTo( from, 1010001 + loom.Phase++ ); } } else { Item create = new BoltOfCloth(); create.Hue = m_Material.Hue; m_Material.Consume(); loom.Phase = 0; from.SendAsciiMessage("You create some cloth and put it in your backpack."); // You create some cloth and put it in your backpack. from.AddToBackpack(create); } } else { from.SendAsciiMessage("Try using that on a loom."); // Try using that on a loom. } }
protected override void OnTarget(Mobile from, object targeted) { if (m_Material.Deleted) { return; } ILoom loom = targeted as ILoom; if (loom == null && targeted is AddonComponent) { loom = ((AddonComponent)targeted).Addon as ILoom; } if (loom != null && loom is Item) { Item item = (Item)loom; if (!m_Material.IsChildOf(from.Backpack)) { from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it. } else if (loom.Looming) { from.SendMessage("That loom is being used."); } else { LoomQuotaAttachment att = (LoomQuotaAttachment)XmlAttach.FindAttachment(from, typeof(LoomQuotaAttachment)); if (att == null) { att = new LoomQuotaAttachment(); XmlAttach.AttachTo(from, att); } if (att.getNumLooms() < LoomQuotaAttachment.m_LoomQuotaCap) { att.AddLooms(item); from.PublicOverheadMessage(Server.Network.MessageType.Emote, 51, false, "*looming*"); m_Material.Consume(); loom.BeginLoom(new LoomCallback(BaseClothMaterial.OnLoomLoop), from, m_Material.Hue, m_Material); } else { from.SendMessage("You are too occupied with the " + LoomQuotaAttachment.m_LoomQuotaCap.ToString() + " looms you are running."); } } } else { from.SendLocalizedMessage(500367); // Try using that on a loom. } }
protected override void OnTarget(Mobile from, object targeted) { if (m_Material.Deleted) { return; } ILoom loom = targeted as ILoom; if (loom == null && targeted is AddonComponent) { loom = ((AddonComponent)targeted).Addon as ILoom; } if (loom != null) { if (!m_Material.IsChildOf(from.Backpack)) { from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it. } else if (loom.Phase < 4) { m_Material.Consume(); if (targeted is Item) { ((Item)targeted).SendLocalizedMessageTo(from, 1010001 + loom.Phase++); } } else { Item create = new BoltOfCloth { Hue = m_Material.Hue }; m_Material.Consume(); loom.Phase = 0; from.SendLocalizedMessage(500368); // You create some cloth and put it in your backpack. from.AddToBackpack(create); } } else { from.SendLocalizedMessage(500367); // Try using that on a loom. } }
public static void OnLoomLoop(ILoom loom, Mobile from, int hue, Item thread) { if (loom.Phase > 4) { loom.Phase = 0; Item item = new BoltOfCloth(); item.Hue = hue; from.AddToBackpack(item); from.SendLocalizedMessage(500368); // You create some cloth and put it in your backpack. } LoomQuotaAttachment att = (LoomQuotaAttachment)XmlAttach.FindAttachment(from, typeof(LoomQuotaAttachment)); if (att == null) { att = new LoomQuotaAttachment(); XmlAttach.AttachTo(from, att); } att.RemoveLooms((Item)loom); if (from.NetState == null) // player logged off return; if (thread.Deleted || thread.Amount < 1 || !(thread is BaseClothMaterial)) from.SendMessage("You finished processing all the threads/yarns."); else if (!thread.IsChildOf(from.Backpack)) from.SendMessage("You can not continue without the threads/yarns in your backpack."); else if (loom is Item) { Item loom1 = (Item)loom; if (loom1.Deleted) from.SendMessage("Where did the loom go?"); else if (!from.InRange(loom1.GetWorldLocation(), 3)) from.SendMessage("You are too far away from the loom to continue your work."); else if (loom.Looming) from.SendMessage("That loom is being used."); else { if (att.getNumLooms() < LoomQuotaAttachment.m_LoomQuotaCap) { att.AddLooms(loom1); if (Utility.Random(20 * att.getNumLooms()) < 1) from.PublicOverheadMessage(Server.Network.MessageType.Emote, 51, false, "*looming*"); thread.Consume(); loom.BeginLoom(new LoomCallback(BaseClothMaterial.OnLoomLoop), from, thread.Hue, thread); return; } else from.SendMessage("You are too occupied with the " + LoomQuotaAttachment.m_LoomQuotaCap.ToString() + " looms you are running."); } } }
protected override void OnTarget(Mobile from, object targeted) { if (m_Material.Deleted) { return; } ILoom loom = targeted as ILoom; if (loom == null && targeted is AddonComponent) { loom = ((AddonComponent)targeted).Addon as ILoom; } if (loom != null) { if (!m_Material.IsChildOf(from.Backpack)) { from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it. } else { int cycle = m_Material.Amount; int looms = loom.Phase; int amount = 0; bool sendMessage = false; while (cycle > 0) { cycle--; if (looms >= 4) { looms = 0; amount++; sendMessage = true; } else { looms++; } } m_Material.Delete(); loom.Phase = looms; if (sendMessage) { Item create = new BoltOfCloth(amount); create.Hue = m_Material.Hue; from.AddToBackpack(create); from.SendLocalizedMessage(500368); // You create some cloth and put it in your backpack. if (loom.Phase > 0) { from.SendMessage("The loom still has some incomplete cloth started."); } } else { from.SendMessage("You don't have enough to create a bolt of cloth."); } } } else { from.SendLocalizedMessage(500367); // Try using that on a loom. } }
protected override void OnTarget(Mobile from, object targeted) { if (m_Material.Deleted) { return; } ILoom loom = targeted as ILoom; if (loom == null && targeted is AddonComponent) { loom = ((AddonComponent)targeted).Addon as ILoom; } if (loom != null) { if (!m_Material.IsChildOf(from.Backpack)) { from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it. } else { LokaiSkills skills = LokaiSkillUtilities.XMLGetSkills(from); LokaiSkill lokaiSkill = skills[LokaiSkillName.Weaving]; SuccessRating rating = LokaiSkillUtilities.CheckLokaiSkill(from, lokaiSkill, 0.0, 100.0); if (rating >= SuccessRating.PartialSuccess) { if (loom.Phase < 4) { if (targeted is Item) { ((Item)targeted).SendLocalizedMessageTo(from, 1010001 + loom.Phase++); } m_Material.Consume(); } else { Item create = new BoltOfCloth(); create.Hue = m_Material.Hue; loom.Phase = 0; from.SendLocalizedMessage(500368); // You create some cloth and put it in your backpack. from.AddToBackpack(create); m_Material.Consume(); } } else if (rating == SuccessRating.Failure) { from.SendMessage("You fail, but manage to save your material."); } else if (rating == SuccessRating.HazzardousFailure) { m_Material.Consume(); from.SendMessage("You fail, and some material is lost."); } else if (rating == SuccessRating.CriticalFailure) { m_Material.Consume(); loom.Phase = 0; from.SendMessage("You fail utterly, some material is lost, and you need to start over."); } else if (rating == SuccessRating.TooDifficult) { m_Material.Consume(); loom.Phase = 0; from.SendMessage("You have no idea how to work this thing."); from.SendMessage("You fail utterly, some material is lost, and you need to start over."); } } } else { from.SendLocalizedMessage(500367); // Try using that on a loom. } }
public static void OnLoomLoop(ILoom loom, Mobile from, int hue, Item thread) { if (loom.Phase > 4) { loom.Phase = 0; Item item = new BoltOfCloth(); item.Hue = hue; from.AddToBackpack(item); from.SendLocalizedMessage(500368); // You create some cloth and put it in your backpack. } LoomQuotaAttachment att = (LoomQuotaAttachment)XmlAttach.FindAttachment(from, typeof(LoomQuotaAttachment)); if (att == null) { att = new LoomQuotaAttachment(); XmlAttach.AttachTo(from, att); } att.RemoveLooms((Item)loom); if (from.NetState == null) // player logged off { return; } if (thread.Deleted || thread.Amount < 1 || !(thread is BaseClothMaterial)) { from.SendMessage("You finished processing all the threads/yarns."); } else if (!thread.IsChildOf(from.Backpack)) { from.SendMessage("You can not continue without the threads/yarns in your backpack."); } else if (loom is Item) { Item loom1 = (Item)loom; if (loom1.Deleted) { from.SendMessage("Where did the loom go?"); } else if (!from.InRange(loom1.GetWorldLocation(), 3)) { from.SendMessage("You are too far away from the loom to continue your work."); } else if (loom.Looming) { from.SendMessage("That loom is being used."); } else { if (att.getNumLooms() < LoomQuotaAttachment.m_LoomQuotaCap) { att.AddLooms(loom1); if (Utility.Random(20 * att.getNumLooms()) < 1) { from.PublicOverheadMessage(Server.Network.MessageType.Emote, 51, false, "*looming*"); } thread.Consume(); loom.BeginLoom(new LoomCallback(BaseClothMaterial.OnLoomLoop), from, thread.Hue, thread); return; } else { from.SendMessage("You are too occupied with the " + LoomQuotaAttachment.m_LoomQuotaCap.ToString() + " looms you are running."); } } } }
protected override void OnTarget(Mobile from, object targeted) { if (m_Material.Deleted) { return; } ILoom loom = targeted as ILoom; if (loom == null && targeted is AddonComponent) { loom = ((AddonComponent)targeted).Addon as ILoom; } if (loom != null) { if (!m_Material.IsChildOf(from.Backpack)) { from.SendAsciiMessage("That must be in your pack for you to use it."); } else if (loom.Phase < 4) { m_Material.Consume(); if (targeted is Item) { if (loom.Phase == 0) { ((Item)targeted).SendAsciiMessageTo(from, "The bolt of cloth has just been started."); } else if (loom.Phase == 1) { ((Item)targeted).SendAsciiMessageTo(from, "The bolt of cloth needs quite a bit more."); } else if (loom.Phase == 2) { ((Item)targeted).SendAsciiMessageTo(from, "The bolt of cloth needs a little more."); } else if (loom.Phase == 3) { ((Item)targeted).SendAsciiMessageTo(from, "The bolt of cloth is almost finished."); } loom.Phase = loom.Phase + 1; } } else { Item create = new BoltOfCloth(); create.Hue = m_Material.Hue; m_Material.Consume(); loom.Phase = 0; from.SendAsciiMessage("You create some cloth and put it in your backpack."); from.AddToBackpack(create); } } else { from.SendAsciiMessage("Try using that on a loom."); } }