protected override void OnTarget(Mobile from, object targeted) { if (m_RawFlax.Deleted) { return; } ISpinningWheel wheel = targeted as ISpinningWheel; if (wheel == null && targeted is AddonComponent) { wheel = ((AddonComponent)targeted).Addon as ISpinningWheel; } if (wheel is Item) { Item item = (Item)wheel; if (!m_RawFlax.IsChildOf(from.Backpack)) { from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it. } else if (wheel.Spinning) { from.SendLocalizedMessage(502656); // That spinning wheel is being used. } else { LokaiSkills skills = LokaiSkillUtilities.XMLGetSkills(from); LokaiSkill lokaiSkill = (LokaiSkillUtilities.XMLGetSkills(from)).Spinning; SuccessRating rating = LokaiSkillUtilities.CheckLokaiSkill(from, lokaiSkill, 0.0, 100.0); if (rating >= SuccessRating.PartialSuccess) { m_RawFlax.Consume(); wheel.BeginSpin(new SpinCallback(RawFlax.OnSpun), from, m_RawFlax.Hue); } else if (rating == SuccessRating.Failure) { from.SendMessage("You fail, but manage to save your Raw Flax."); } else if (rating == SuccessRating.HazzardousFailure || rating == SuccessRating.CriticalFailure) { m_RawFlax.Consume(); from.SendMessage("You fail, and some Raw Flax is lost."); } else if (rating == SuccessRating.TooDifficult) { m_RawFlax.Consume(); from.SendMessage("You have no idea how to use this thing."); from.SendMessage("You fail utterly, some Raw Flax is lost."); } } } else { from.SendLocalizedMessage(502658); // Use that on a spinning wheel. } }
private static Item RandomSpellbook(SuccessRating rating) { Spellbook item = null; switch (Utility.Random(5)) { default: item = new Spellbook(); break; case 1: item = new NecromancerSpellbook(); break; case 2: item = new BookOfBushido(); break; case 3: item = new BookOfChivalry(); break; case 4: item = new BookOfNinjitsu(); break; } if (item == null) { return(null); } else { switch (item.SpellbookType) { case SpellbookType.Regular: { switch (rating) { default: { item.Content = 0xFFFF; break; } case SuccessRating.Success: { item.Content = 0xFFFFFFFF; break; } case SuccessRating.CompleteSuccess: { item.Content = 0xFFFFFFFFFFFF; break; } case SuccessRating.ExceptionalSuccess: { item.Content = ulong.MaxValue; break; } } break; } default: item.Content = (1ul << item.BookCount) - 1; break; } } return(item); }
protected override void OnTarget(Mobile from, object targeted) { if (targeted is ResourceItem) { ResourceItem item = targeted as ResourceItem; if (hr.IsNeeded(item)) { LokaiSkill lokaiSkill = (LokaiSkillUtilities.XMLGetSkills(from)).Construction; SuccessRating rating = LokaiSkillUtilities.CheckLokaiSkill(from, lokaiSkill, 0.0, 100.0); if (rating >= SuccessRating.PartialSuccess) { from.SendMessage("You successfully added the Resource."); hr.AddResource(item); } else { from.SendMessage("You failed to add the Resource."); switch (rating) { case SuccessRating.HazzardousFailure: { break; } //TODO: take damage or lose resource case SuccessRating.CriticalFailure: { break; } //TODO: lose the resource and take damage case SuccessRating.TooDifficult: { break; } //TODO: "you have no idea..." default: { break; } } } } else { from.SendMessage("That resource is not needed for this house."); } } else { from.SendMessage("That is not a Resource Item!"); } from.SendGump(new HouseRecipeGump(hr, from)); }
public static void RideEthereal(Mobile from, Item ethereal) { bool newride = true; if (m_RideTime.ContainsKey(from)) { if (m_RideTime[from] >= DateTime.Now) { newride = false; } else { m_RideTime.Remove(from); } } LokaiSkills skills = LokaiSkillUtilities.XMLGetSkills(from); if (newride) { int MinLevel = 20; int MaxLevel = 100; int fame = 0; if (Core.Debug) { from.SendMessage("TEST: RIDING AN ETHEREAL MOUNT"); } SuccessRating rating = LokaiSkillUtilities.CheckLokaiSkill(from, skills.AnimalRiding, MinLevel, MaxLevel); if (rating <= SuccessRating.Failure) { int scalar = from.TotalWeight / (from.Dex + from.Str); double penaltyTime = 0.0; if (Core.Debug) { from.SendMessage("TEST: RIDING FAILED CHECK."); } IMount mount = ethereal as IMount; if (mount != null) { mount.Rider = null; from.SendMessage("You were dismounted."); } switch (rating) { case SuccessRating.HazzardousFailure: { if (Utility.RandomBool()) { from.Damage(Utility.Random(5 * scalar)); from.SendMessage("You took some damage!"); fame = -200 * Utility.Random(1, 2); Misc.Titles.AwardFame(from, fame, true); penaltyTime = 4.0; } break; } case SuccessRating.CriticalFailure: { if (Utility.RandomBool()) { from.Damage(Utility.Random(15 * scalar)); from.SendMessage("You took serious damage!"); fame = -400 * Utility.Random(1, 2); Misc.Titles.AwardFame(from, fame, true); penaltyTime = 10.0; } break; } case SuccessRating.TooDifficult: { from.SendMessage("This mount is too difficult for you!"); break; } default: break; } m_RideTime.Add(from, DateTime.Now.AddSeconds(FAILSECONDS + penaltyTime)); } else { double bonusTime = 0.0; if (Core.Debug) { from.SendMessage("TEST: RIDING SUCCEEDED CHECK."); } switch (rating) { case SuccessRating.ExceptionalSuccess: { if (Utility.RandomBool()) { fame = 400 * Utility.Random(1, 2); Misc.Titles.AwardFame(from, fame, true); bonusTime = 20.0; } break; } case SuccessRating.CompleteSuccess: { if (Utility.RandomBool()) { fame = 200 * Utility.Random(1, 2); Misc.Titles.AwardFame(from, fame, true); bonusTime = 10.0; } break; } case SuccessRating.Success: { if (Utility.RandomBool()) { fame = 100 * Utility.Random(1, 2); Misc.Titles.AwardFame(from, fame, true); bonusTime = 4.0; } break; } case SuccessRating.TooEasy: { from.SendMessage("This mount does not provide enough of a challenge for you."); bonusTime = 120.0; break; } default: break; } m_RideTime.Add(from, DateTime.Now.AddSeconds(RIDESECONDS + bonusTime)); } skills.LastLokaiSkillCheck[(int)LokaiSkillName.AnimalRiding] = rating; } else { SuccessRating rating = skills.LastCheck(LokaiSkillName.AnimalRiding); if (rating <= SuccessRating.Failure) { double wait = ((TimeSpan)(m_RideTime[from] - DateTime.Now)).TotalSeconds; if (Core.Debug) { from.SendMessage("TEST: FAILED LAST RIDING CHECK."); } IMount mount = ethereal as IMount; if (mount != null) { mount.Rider = null; if (rating > SuccessRating.TooDifficult) { from.SendMessage("You must wait {0} seconds before you attempt this again.", wait.ToString("F1")); } else { from.SendMessage("This mount is too difficult for you!"); } } } } }
protected override void OnTarget(Mobile from, object targeted) { if (targeted is StaticTarget) { StaticTarget target = targeted as StaticTarget; if (target.Location.CompareTo(from.Location) > 2) { from.SendMessage("You are too far away to do that."); return; } PilferFlags flags = PilferTarget(target, from); if (flags != PilferFlags.None) { if (Core.Debug) { from.SendMessage("TEST: pilfering target: {0}.", flags.ToString()); } List <PilferFlags> list = new List <PilferFlags>(); foreach (PilferFlags flag in Enum.GetValues(typeof(PilferFlags))) { if (flag != PilferFlags.None && GetFlag(flag, flags)) { list.Add(flag); } } if (list.Count > 0) { PilferFlags pilfer = PilferFlags.None; if (list.Count > 1) { pilfer = list[Utility.Random(list.Count)]; } else { pilfer = list[0]; } ///TEST FOR SUCCESSRATING /// --------------------- LokaiSkill lokaiSkill = (LokaiSkillUtilities.XMLGetSkills(from)).Pilfering; SuccessRating rating = LokaiSkillUtilities.CheckLokaiSkill(from, lokaiSkill, 0.0, 100.0); ///IF SUCCESSFUL /// ------------ if (rating >= SuccessRating.PartialSuccess) { CreateItem(pilfer, rating, from); } else { from.SendMessage("You fail to pilfer anything."); } } else { from.SendMessage("There is nothing to pilfer there."); } } else { from.SendMessage("There is nothing to pilfer there."); } } }
private static void CreateItem(PilferFlags pilfer, SuccessRating rating, Mobile from) { switch (pilfer) { case PilferFlags.ArcheryWeapon: { Item item = Loot.RandomRangedWeapon(); if (item == null || !from.AddToBackpack(item)) { from.SendMessage("Unable to add item to backpack."); } else { from.SendMessage("You pilfer {0} {1}.", StartsWithVowel(item.DefaultName) ? "an" : "a", item.DefaultName); } break; } case PilferFlags.Armor: { Item item = Loot.RandomArmorOrHat(); if (item == null || !from.AddToBackpack(item)) { from.SendMessage("Unable to add item to backpack."); } else { from.SendMessage("You pilfer {0} {1}.", StartsWithVowel(item.DefaultName) ? "an" : "a", item.DefaultName); } break; } case PilferFlags.Clothes: { Item item = Loot.RandomClothing(from.Map == Map.Tokuno, true); if (item == null || !from.AddToBackpack(item)) { from.SendMessage("Unable to add item to backpack."); } else { from.SendMessage("You pilfer {0} {1}.", StartsWithVowel(item.DefaultName) ? "an" : "a", item.DefaultName); } break; } case PilferFlags.Food: { Item item = RandomFood(); if (item == null || !from.AddToBackpack(item)) { from.SendMessage("Unable to add item to backpack."); } else { from.SendMessage("You pilfer {0} {1}.", StartsWithVowel(item.DefaultName) ? "an" : "a", item.DefaultName); } break; } case PilferFlags.Jewel: { Item item = Loot.RandomJewelry(); if (item == null || !from.AddToBackpack(item)) { from.SendMessage("Unable to add item to backpack."); } else { from.SendMessage("You pilfer {0} {1}.", StartsWithVowel(item.DefaultName) ? "an" : "a", item.DefaultName); } break; } case PilferFlags.MetalWeapon: { Item item = Loot.RandomWeapon(); if (item == null || !from.AddToBackpack(item)) { from.SendMessage("Unable to add item to backpack."); } else { from.SendMessage("You pilfer {0} {1}.", StartsWithVowel(item.DefaultName) ? "an" : "a", item.DefaultName); } break; } case PilferFlags.Potion: { Item item = Loot.RandomPotion(); if (item == null || !from.AddToBackpack(item)) { from.SendMessage("Unable to add item to backpack."); } else { from.SendMessage("You pilfer {0} {1}.", StartsWithVowel(item.DefaultName) ? "an" : "a", item.DefaultName); } break; } case PilferFlags.Reagent: { Item item = Loot.RandomPossibleReagent(); if (item == null || !from.AddToBackpack(item)) { from.SendMessage("Unable to add item to backpack."); } else { from.SendMessage("You pilfer {0} {1}.", StartsWithVowel(item.DefaultName) ? "an" : "a", item.DefaultName); } break; } case PilferFlags.Scroll: { int max = 0; SpellbookType book = (SpellbookType)Utility.Random(2); if (book == SpellbookType.Regular) { max = Loot.RegularScrollTypes.Length; switch (rating) { case SuccessRating.PartialSuccess: { max /= 8; break; } case SuccessRating.Success: { max /= 4; break; } case SuccessRating.CompleteSuccess: { max /= 2; break; } case SuccessRating.ExceptionalSuccess: { break; } } } if (book == SpellbookType.Necromancer) { max = Loot.SENecromancyScrollTypes.Length; } Item item = Loot.RandomScroll(0, max, book); if (item == null || !from.AddToBackpack(item)) { from.SendMessage("Unable to add item to backpack."); } else { from.SendMessage("You pilfer {0} {1}.", StartsWithVowel(item.DefaultName) ? "an" : "a", item.DefaultName); } break; } case PilferFlags.Spellbook: { Item item = RandomSpellbook(rating); if (item == null || !from.AddToBackpack(item)) { from.SendMessage("Unable to add item to backpack."); } else { from.SendMessage("You pilfer {0} {1}.", StartsWithVowel(item.DefaultName) ? "an" : "a", item.DefaultName); } break; } case PilferFlags.Wand: { BaseWand item = Loot.RandomWand(); if (item == null || !from.AddToBackpack(item)) { from.SendMessage("Unable to add item to backpack."); } else { from.SendMessage("You pilfer {0} {1}.", StartsWithVowel(item.Effect.ToString()) ? "an" : "a", item.Effect.ToString()); } break; } } }
private bool PickTry(Mobile from, Mobile mobile, SuccessRating rating, LokaiSkill lokaiSkill, Container pack) { bool pickGold, pickItem; bool pickNone = false; Item[] goldItems = pack.FindItemsByType(typeof(Gold)); int goldAmount = 0; foreach (Item item in goldItems) { goldAmount += item.Amount; } List <Item> pickables = new List <Item>(); Search(pack, ref pickables); if (pickables.Count > 0) { pickItem = true; } else { pickItem = false; } if (goldAmount > 0) { pickGold = true; } else { pickGold = false; } if (!pickGold && !pickItem) { pickNone = true; } else if (pickGold && pickItem) { pickGold = Utility.RandomBool(); pickItem = !pickGold; } if (rating >= SuccessRating.PartialSuccess) { if (pickNone) { from.NextSkillTime = Core.TickCount; from.SendMessage("Their pockets are empty."); } else if (pickGold) { int pickAmount = Math.Min((int)(4 * lokaiSkill.Value), (int)(goldAmount / 1000)); if ((INFINITE_GOLD && !(mobile is PlayerMobile) || (goldAmount > 10 && pickAmount < 10))) { pickAmount = Utility.Random(6) + 5; } if (goldAmount > 100 && rating >= SuccessRating.CompleteSuccess && pickAmount < 100) { pickAmount = Utility.Random(61) + 40; } if (goldAmount > 500 && rating >= SuccessRating.ExceptionalSuccess && pickAmount < 500) { pickAmount = Utility.Random(301) + 200; } if (from.AddToBackpack(new Gold(pickAmount))) { if ((mobile is PlayerMobile && pack.ConsumeTotal(typeof(Gold), pickAmount) || (!INFINITE_GOLD && pack.ConsumeTotal(typeof(Gold), pickAmount)))) { from.SendMessage("You were able to pick {0} gold from their pocket!", pickAmount.ToString()); } else { from.SendMessage("You find {0} gold in their pocket!", pickAmount.ToString()); } } } else { int random = Utility.Random(pickables.Count); if (random >= pickables.Count) { random = 0; } Item itemToPick = pickables[random]; if (pickables[random].Amount > 1 && from.AddToBackpack(itemToPick)) { itemToPick.Amount = 1; pickables[random].Amount--; } else { if (from.AddToBackpack(itemToPick)) { pack.OnItemRemoved(pickables[random]); } } } } else if (rating == SuccessRating.Failure) { from.SendMessage("You fail."); } else if (rating == SuccessRating.HazzardousFailure || rating == SuccessRating.CriticalFailure) { from.SendMessage("You fail utterly."); } else if (rating == SuccessRating.TooDifficult) { from.SendMessage("You do not have the necessary lokaiSkill to attempt this."); } double caughtChance = 1.0; switch (rating) { case SuccessRating.CriticalFailure: caughtChance = 0.95; break; case SuccessRating.HazzardousFailure: caughtChance = 0.8; break; case SuccessRating.Failure: caughtChance = 0.65; break; case SuccessRating.PartialSuccess: caughtChance = 0.5; break; case SuccessRating.Success: caughtChance = 0.3; break; case SuccessRating.CompleteSuccess: caughtChance = 0.1; break; case SuccessRating.ExceptionalSuccess: caughtChance = 0.05; break; case SuccessRating.TooEasy: caughtChance = -0.01; break; default: break; } return(caughtChance < Utility.RandomDouble()); }
public static void Cook(TreeResourceItem resource, Mobile from, SuccessRating rating, TreeProduct product, Container pack) { switch (rating) { case SuccessRating.PartialSuccess: case SuccessRating.Success: case SuccessRating.CompleteSuccess: case SuccessRating.ExceptionalSuccess: case SuccessRating.TooEasy: { TreeProductItem item = new TreeProductItem(product); if (item.ItemID == 0x183B && !pack.ConsumeTotal(typeof(LargeEmptyFlask), 1)) { from.SendMessage("You need an empty flask in your pack to store the {0}. The resource was lost.", item.Name); resource.Consume(1); item.Delete(); } else if (item.ItemID == 0x1604 && !pack.ConsumeTotal(typeof(EmptyWoodenBowl), 1)) { from.SendMessage("You need an empty bowl in your pack to store the {0}. The resource was lost.", item.Name); resource.Consume(1); item.Delete(); } else if (from.AddToBackpack(item) || item.DropToWorld(from, from.Location)) { from.SendMessage("You cook the resource and turn it in to {0}.", item.Name); resource.Consume(1); } else { from.SendMessage("Unable to create the {0}.", item.Name); item.Delete(); } break; } case SuccessRating.Failure: { from.SendMessage("You fail to cook the resource."); break; } case SuccessRating.HazzardousFailure: { from.SendMessage("You burn the resource and are left with nothing usable."); resource.Consume(1); break; } case SuccessRating.CriticalFailure: case SuccessRating.TooDifficult: { from.SendMessage("You burn the resource and your hands too!"); from.Damage(Utility.RandomMinMax(1, 5)); from.Animate(34, 5, 1, true, false, 0); from.Emote("Ouch!"); resource.Consume(1); break; } case SuccessRating.LokaiSkillNotEnabled: { from.SendMessage("This lokaiSkill is not enabled."); // Should never happen, but just in case... break; } } }
public static SuccessRating CheckLokaiSkill(Mobile from, LokaiSkill lokaiSkill, double minLokaiSkill, double maxLokaiSkill) { double value = lokaiSkill.Value; if (value < minLokaiSkill) { return(SuccessRating.TooDifficult); // Too difficult } else if (value >= maxLokaiSkill) { return(SuccessRating.TooEasy); // No challenge } double chance = (value - minLokaiSkill) / (maxLokaiSkill - minLokaiSkill); if (LokaiSkillUtilities.XMLGetSkills(from).Cap == 0) { return(SuccessRating.LokaiSkillNotEnabled); } SuccessRating rating = SuccessRating.PartialSuccess; double random = Utility.RandomDouble(); bool success = (chance >= random); double gc = (double)(LokaiSkillUtilities.XMLGetSkills(from).Cap - LokaiSkillUtilities.XMLGetSkills(from).Total) / LokaiSkillUtilities.XMLGetSkills(from).Cap; gc += (lokaiSkill.Cap - lokaiSkill.Base) / lokaiSkill.Cap; gc /= 2; gc += (1.0 - chance) * (success ? 0.5 : (Core.AOS ? 0.0 : 0.2)); gc /= 2; if (gc < 0.01) { gc = 0.01; } if (from is BaseCreature && ((BaseCreature)from).Controlled) { gc *= 2; } if (from.Alive && (gc >= Utility.RandomDouble() || lokaiSkill.Base < 10.0)) { Gain(from, lokaiSkill); } if (chance - random <= -0.9) { rating = SuccessRating.CriticalFailure; } else if (chance - random <= -0.6) { rating = SuccessRating.HazzardousFailure; } else if (chance - random <= 0.0) { rating = SuccessRating.Failure; } else if (chance - random <= 0.15) { rating = SuccessRating.PartialSuccess; } else if (chance - random <= 0.45) { rating = SuccessRating.Success; } else if (chance - random <= 0.75) { rating = SuccessRating.CompleteSuccess; } else if (chance - random <= 0.9) { rating = SuccessRating.ExceptionalSuccess; } return(rating); }
protected override void OnTick() { m_Count++; if (isCreature) { DamageEntry de = m_Creature.FindMostRecentDamageEntry(false); bool alreadyOwned = m_Creature.Owners.Contains(m_From); if (!m_From.InRange(m_Creature, 6)) { m_From.NextSkillTime = Core.TickCount; m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, true, "You are too far away to continue hypnotizing.", m_From.NetState); Stop(); } else if (!m_From.CheckAlive()) { m_From.NextSkillTime = Core.TickCount; m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, true, "You are dead, and cannot continue hypnotizing.", m_From.NetState); Stop(); } else if (!m_Creature.CheckAlive()) { m_From.NextSkillTime = Core.TickCount; m_From.PrivateOverheadMessage(MessageType.Regular, 0x3B2, true, "The creature is dead, so you cannot continue hypnotizing it.", m_From.NetState); Stop(); } else if (m_Creature.Controlled && m_Creature.ControlMaster == m_From) { m_From.NextSkillTime = Core.TickCount; m_From.PrivateOverheadMessage(MessageType.Regular, 0x3B2, true, "The creature will already obey you.", m_From.NetState); Stop(); } else if (!m_From.CanSee(m_Creature) || !m_From.InLOS(m_Creature)) { m_From.NextSkillTime = Core.TickCount; m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, true, "You do not have a clear path to the creature you are hypnotizing, and must cease your attempt.", m_From.NetState); Stop(); } else if (m_Creature.Frozen && m_Creature.Paralyzed) { m_From.NextSkillTime = Core.TickCount; m_From.PrivateOverheadMessage(MessageType.Regular, 0x3B2, true, "It appears to be already in a trance.", m_From.NetState); Stop(); } else if (m_Count < m_FullCount) { m_From.RevealingAction(); switch (Utility.Random(5)) { case 0: m_From.PublicOverheadMessage(MessageType.Regular, 0x3B2, true, "You are getting sleepy....", false); break; case 1: m_From.PublicOverheadMessage(MessageType.Regular, 0x3B2, true, "Look into my eyes....", false); break; case 2: m_From.PublicOverheadMessage(MessageType.Regular, 0x3B2, true, "Look deep into my eyes....", false); break; case 3: m_From.PublicOverheadMessage(MessageType.Regular, 0x3B2, true, "Your eyes are getting very heavy....", false); break; case 4: m_From.PublicOverheadMessage(MessageType.Regular, 0x3B2, true, "Sleepy....very sleepy....", false); break; } if (!alreadyOwned) // Passively check animal lore for gain { m_From.CheckTargetSkill(SkillName.AnimalLore, m_Creature, 0.0, 120.0); } } else { m_From.RevealingAction(); m_From.NextSkillTime = Core.TickCount; double minSkill = (double)m_Creature.Int / 3.0; if (minSkill < -10.0) { minSkill = -10.0; } if (minSkill > 90.0) { minSkill = 90.0; } minSkill += 8.3; LokaiSkill lokaiSkill = LokaiSkillUtilities.XMLGetSkills(m_From).Hypnotism; SuccessRating rating = LokaiSkillUtilities.CheckLokaiSkill(m_From, lokaiSkill, minSkill, alreadyOwned ? minSkill : minSkill + 40); if (rating >= SuccessRating.PartialSuccess) { if (rating == SuccessRating.TooEasy) { m_From.SendLocalizedMessage(502797); // That wasn't even challenging. } else { m_From.SendMessage("You succeed in hypnotizing the creature."); } double duration = 15.0; switch (rating) { case SuccessRating.PartialSuccess: break; case SuccessRating.Success: duration += 5.0; break; case SuccessRating.CompleteSuccess: duration += 15.0; break; case SuccessRating.ExceptionalSuccess: duration += 25.0; break; case SuccessRating.TooEasy: duration += 45; break; } m_Creature.Freeze(TimeSpan.FromSeconds(duration)); m_Creature.Paralyze(TimeSpan.FromSeconds(duration)); m_Creature.Pacify(m_From, DateTime.Now.AddSeconds(duration)); } else { m_From.SendMessage("You fail to hypnotize the creature."); } } } else { DamageEntry de = m_Mobile.FindMostRecentDamageEntry(false); if (!m_From.InRange(m_Mobile, 6)) { m_From.NextSkillTime = Core.TickCount; m_Mobile.PrivateOverheadMessage(MessageType.Regular, 0x3B2, true, "You are too far away to continue hypnotizing.", m_From.NetState); Stop(); } else if (!m_From.CheckAlive()) { m_From.NextSkillTime = Core.TickCount; m_Mobile.PrivateOverheadMessage(MessageType.Regular, 0x3B2, true, "You are dead, and cannot continue hypnotizing.", m_From.NetState); Stop(); } else if (!m_From.CanSee(m_Mobile) || !m_From.InLOS(m_Mobile)) { m_From.NextSkillTime = Core.TickCount; m_Mobile.PrivateOverheadMessage(MessageType.Regular, 0x3B2, true, "You do not have a clear path to the person you are hypnotizing, and must cease your attempt.", m_From.NetState); Stop(); } else if (!m_Mobile.CheckAlive()) { m_From.NextSkillTime = Core.TickCount; m_From.PrivateOverheadMessage(MessageType.Regular, 0x3B2, true, "The person is dead, so you cannot continue hypnotizing them.", m_From.NetState); Stop(); } else if (m_Mobile is BaseEscortable && ((BaseEscortable)m_Mobile).Controlled && ((BaseEscortable)m_Mobile).ControlMaster == m_From) { m_From.NextSkillTime = Core.TickCount; m_From.PrivateOverheadMessage(MessageType.Regular, 0x3B2, true, "They will already obey you.", m_From.NetState); Stop(); } else if (m_Mobile.Frozen && m_Mobile.Paralyzed) { m_From.NextSkillTime = Core.TickCount; m_From.PrivateOverheadMessage(MessageType.Regular, 0x3B2, true, "They appear to be already in a trance.", m_From.NetState); Stop(); } else if (m_Count < m_FullCount) { m_From.RevealingAction(); switch (Utility.Random(5)) { case 0: m_From.PublicOverheadMessage(MessageType.Regular, 0x3B2, true, "You are getting sleepy....", false); break; case 1: m_From.PublicOverheadMessage(MessageType.Regular, 0x3B2, true, "Look into my eyes....", false); break; case 2: m_From.PublicOverheadMessage(MessageType.Regular, 0x3B2, true, "Look deep into my eyes....", false); break; case 3: m_From.PublicOverheadMessage(MessageType.Regular, 0x3B2, true, "Your eyes are getting very heavy....", false); break; case 4: m_From.PublicOverheadMessage(MessageType.Regular, 0x3B2, true, "Sleepy....very sleepy....", false); break; } m_From.CheckTargetSkill(SkillName.EvalInt, m_Mobile, 0.0, 120.0); } else { m_From.RevealingAction(); m_From.NextSkillTime = Core.TickCount; m_From.CheckTargetSkill(SkillName.EvalInt, m_Mobile, 0.0, 120.0); double minSkill = (double)m_Mobile.Int / 3.0; if (minSkill < -10.0) { minSkill = -10.0; } if (minSkill > 90.0) { minSkill = 90.0; } minSkill += 10.0; LokaiSkill lokaiSkill = LokaiSkillUtilities.XMLGetSkills(m_From).Hypnotism; SuccessRating rating = LokaiSkillUtilities.CheckLokaiSkill(m_From, lokaiSkill, minSkill, minSkill + 40); if (rating >= SuccessRating.PartialSuccess) { double duration = 15.0; switch (rating) { case SuccessRating.PartialSuccess: break; case SuccessRating.Success: duration += 5.0; break; case SuccessRating.CompleteSuccess: duration += 15.0; break; case SuccessRating.ExceptionalSuccess: duration += 25.0; break; case SuccessRating.TooEasy: duration += 45; break; } m_From.SendMessage("You successfully put your subject in a trance."); Mobile master = null; if (m_Mobile is BaseEscortable) { BaseEscortable target = (BaseEscortable)m_Mobile; if (((BaseEscortable)m_Mobile).Controlled) { master = target.ControlMaster; } target.Controlled = true; target.ControlMaster = m_From; m_From.SendMessage("The target will obey you for {0} seconds.", duration.ToString("F1")); new EscortableTimer(m_From, master, target, (int)duration).Start(); } else { m_Mobile.Freeze(TimeSpan.FromSeconds(duration)); m_Mobile.Paralyze(TimeSpan.FromSeconds(duration)); m_Mobile.SendMessage("You have been hypnotized!"); m_From.SendGump(new HypnotismGump(m_From, m_Mobile, duration, 1)); } } else { m_From.SendMessage("You fail to hypnotize your subject."); } } } }
public override void OnResponse(Mobile from, string text) { if (targeted is Item && ((Item)targeted).Parent != null) { targeted = ((Item)targeted).Parent; OnResponse(from, text); } LokaiSkills skills = LokaiSkillUtilities.XMLGetSkills(from); LokaiSkill lokaiSkill = (LokaiSkillUtilities.XMLGetSkills(from)).Ventriloquism; if (targeted is Mobile) { Mobile mob = (Mobile)targeted; if (mob == from) { from.SendMessage("That's not much of a trick."); } else if (!mob.Alive || mob.Deleted || mob.Hidden) { from.SendMessage("I don't know who or what you mean."); } else if (!from.InRange(mob.Location, 5)) { from.SendMessage("They are too far away."); } else if (!from.CanSee(mob)) { from.SendMessage("You can't see them well enough to make them talk."); } else { double distance = Math.Sqrt((double)((mob.X - from.X) * (mob.X - from.X) + (double)((mob.Y - from.Y) * (mob.Y - from.Y)))); double minLokaiSkill = 10.0 + (distance * 5.0); double maxLokaiSkill = 75.0 + (distance * 5.0); SuccessRating rating = LokaiSkillUtilities.CheckLokaiSkill(from, lokaiSkill, minLokaiSkill, maxLokaiSkill); if (rating >= SuccessRating.PartialSuccess) { mob.PublicOverheadMessage(MessageType.Emote, 0, false, text); } else { from.Say(text); from.SendMessage("Your attempt at ventriloquism fails."); } } } else if (targeted is Item) { Item item = (Item)targeted; if (!from.InRange(item.Location, 5)) { from.SendMessage("That is too far away."); } else if (!from.CanSee(item)) { from.SendMessage("You can't see that well enough to make it talk."); } else { double distance = Math.Sqrt((double)((item.X - from.X) * (item.X - from.X) + (double)((item.Y - from.Y) * (item.Y - from.Y)))); double minLokaiSkill = 0.0 + (distance * 5.0); double maxLokaiSkill = 65.0 + (distance * 5.0); SuccessRating rating = LokaiSkillUtilities.CheckLokaiSkill(from, lokaiSkill, minLokaiSkill, maxLokaiSkill); if (rating >= SuccessRating.PartialSuccess) { item.PublicOverheadMessage(MessageType.Emote, 0, false, text); } else { from.Say(text); from.SendMessage("Your attempt at ventriloquism fails."); } } } else if (targeted is StaticTarget) { StaticTarget stat = (StaticTarget)targeted; if (!from.InRange(stat.Location, 5)) { from.SendMessage("That is too far away."); } else { double distance = Math.Sqrt((double)((stat.X - from.X) * (stat.X - from.X) + (double)((stat.Y - from.Y) * (stat.Y - from.Y)))); double minLokaiSkill = -10.0 + (distance * 5.0); double maxLokaiSkill = 55.0 + (distance * 5.0); SuccessRating rating = LokaiSkillUtilities.CheckLokaiSkill(from, lokaiSkill, minLokaiSkill, maxLokaiSkill); if (rating >= SuccessRating.PartialSuccess) { IPoint3D p = targeted as IPoint3D; Item item = new Item(stat.ItemID); if (p == null) { from.SendMessage("Unable to target that."); return; } if (p is Item) { p = ((Item)p).GetWorldTop(); if (Core.Debug) { from.SendMessage("TEMP: Set Point3D to ((Item)p).GetWorldTop()."); } } else { p = new Point3D(stat.X, stat.Y, stat.Z - item.ItemData.CalcHeight); if (Core.Debug) { from.SendMessage("TEMP: IPoint3D was not an Item."); } } item.MoveToWorld(new Point3D(p), from.Map); item.PublicOverheadMessage(MessageType.Emote, 0, false, text); new InternalTimer(from, item).Start(); } else { from.Say(text); from.SendMessage("Your attempt at ventriloquism fails."); } } } }
private static string Translate(Mobile speaker, Mobile hearer, string speech) { LokaiSkill lokaiSkill = LokaiSkillUtilities.XMLGetSkills(hearer).Linguistics; SuccessRating rating = LokaiSkillUtilities.CheckLokaiSkill(hearer, lokaiSkill, 10, 100); if (rating >= SuccessRating.Success) { return(speech); } int percent = 0; switch (rating) { case SuccessRating.PartialSuccess: percent = 50; break; case SuccessRating.Failure: percent = 20; break; case SuccessRating.HazzardousFailure: percent = 10; break; case SuccessRating.CriticalFailure: percent = 5; break; } StringBuilder phrase = new StringBuilder(""); string[] words = speech.Split(' '); if (words.Length > 0) { if (percent < Utility.Random(100)) { if (m_Words.Contains(words[0])) { phrase.Append(m_ForeignWords[m_Words.IndexOf(words[0])]); } else { phrase.Append(m_ForeignWords[Utility.Random(m_ForeignWords.Length)]); // temporary } } else { phrase.Append(words[0]); } if (words.Length > 1) { for (int x = 1; x < words.Length; x++) { phrase.Append(" "); if (percent < Utility.Random(100)) { if (m_Words.Contains(words[x])) { phrase.Append(m_ForeignWords[m_Words.IndexOf(words[x])]); } else { phrase.Append(m_ForeignWords[Utility.Random(m_ForeignWords.Length)]); // temporary } } else { phrase.Append(words[x]); } phrase.Append(" "); } } } return(phrase.ToString()); }
public void ProcessSuccess(SuccessRating rating, Instruction action) { if (action != null) { ResultTextList.Add(string.Format("{0} at {1}", rating.ToString(), action.Action.ToString())); action.IsSuccess = rating; switch (action.Action) { case ActionType.Abduct: switch (action.IsSuccess) { case SuccessRating.GoodSuccess: case SuccessRating.GreatSuccess: case SuccessRating.NormalSuccess: int newIndex = 0; for (int i = 0; i < 8; i++) { newIndex = i; if (cultists[i] == null) { i = 10; } } cultists[newIndex] = new Cultist() { PersonID = (int)action.TargetID, Instruction = null }; ++numberOfCultists; sacrificeCandidates.Remove(sacrificeCandidates.Find(sa => sa.PersonID == action.TargetID)); break; case SuccessRating.BadFailure: case SuccessRating.TerribleFailure: case SuccessRating.Failure: break; } peoplePool.activePool[(int)action.TargetID].Active = false; break; case ActionType.Investigate: switch (action.IsSuccess) { case SuccessRating.GoodSuccess: case SuccessRating.GreatSuccess: case SuccessRating.NormalSuccess: if (sacrificeCandidates.Exists(sa => sa.PersonID == action.TargetID)) { var sacrifice = sacrificeCandidates.Find(sa => sa.PersonID == action.TargetID); sacrifice.IndepthInvestigated = true; Person sac = GetPerson(sacrifice.PersonID); sac.FlavourText = flavourPool.GetInvestigationValue(sac.assets.Profession, sac.assets.Sin) + " " + flavourPool.GetInvestigationValue(sac.assets.Profession, sac.assets.Virtue); } else { var cultist = cultistCandidates.Find(cult => cult.PersonID == action.TargetID); cultist.IndepthInvestigated = true; Person cu = GetPerson(cultist.PersonID); cu.FlavourText = flavourPool.GetInvestigationValue(cu.assets.Profession, cu.assets.Sin) + " " + flavourPool.GetInvestigationValue(cu.assets.Profession, cu.assets.Virtue); } break; case SuccessRating.BadFailure: case SuccessRating.TerribleFailure: case SuccessRating.Failure: break; } break; case ActionType.Recruit: switch (action.IsSuccess) { case SuccessRating.GoodSuccess: case SuccessRating.GreatSuccess: case SuccessRating.NormalSuccess: int newIndex = 0; for (int i = 0; i < 8; i++) { newIndex = i; if (cultists[i] == null) { i = 10; } } cultists[newIndex] = new Cultist() { PersonID = (int)action.TargetID, Instruction = null }; ++numberOfCultists; break; case SuccessRating.BadFailure: case SuccessRating.TerribleFailure: case SuccessRating.Failure: break; } peoplePool.activePool[(int)action.TargetID].Active = false; cultistCandidates.Remove(cultistCandidates.Find(cult => cult.PersonID == action.TargetID)); break; case ActionType.None: break; default: break; } } }
protected override void OnTarget(Mobile from, object targeted) { from.RevealingAction(); LokaiSkill lokaiSkill = (LokaiSkillUtilities.XMLGetSkills(from)).PickPocket; if (targeted is Mobile) { Mobile mobile = targeted as Mobile; Container pack = mobile.Backpack; if (!from.InRange(mobile.Location, 1)) { from.NextSkillTime = Core.TickCount; from.SendMessage("You are too far away to do that."); return; } else if (pack == null) { from.NextSkillTime = Core.TickCount; from.SendMessage("That target has no backpack."); return; } else if (!from.CheckAlive()) { from.NextSkillTime = Core.TickCount; from.SendMessage("You cannot do that while you are dead."); return; } else if (!mobile.CheckAlive()) { from.NextSkillTime = Core.TickCount; from.SendMessage("That is dead, so you cannot do that."); return; } else if (mobile == from) { from.NextSkillTime = Core.TickCount; from.SendMessage("You wish to pick your own pocket?"); return; } else { bool withoutNotice = true; if (targeted is PlayerMobile) { if (ALLOW_PLAYER_THEFT) { SuccessRating rating = LokaiSkillUtilities.CheckLokaiSkill(from, lokaiSkill, 40.0, 100.0); withoutNotice = PickTry(from, mobile, rating, lokaiSkill, pack); } else { from.SendMessage("Pick-pocketing players is not allowed around here!"); } } else if (targeted is BaseVendor) { SuccessRating rating = LokaiSkillUtilities.CheckLokaiSkill(from, lokaiSkill, 0.0, 60.0); withoutNotice = PickTry(from, mobile, rating, lokaiSkill, pack); } else if (targeted is BaseCreature && (!((targeted as BaseCreature).Controlled && (targeted as BaseCreature).ControlMaster == from))) { SuccessRating rating = LokaiSkillUtilities.CheckLokaiSkill(from, lokaiSkill, 20.0, 80.0); withoutNotice = PickTry(from, mobile, rating, lokaiSkill, pack); } else { from.NextSkillTime = Core.TickCount; from.SendMessage("You may not pick their pocket."); return; } if (!withoutNotice) { if (mobile is PlayerMobile) { from.CriminalAction(true); from.OnHarmfulAction(mobile, from.Criminal); } else if (mobile is BaseVendor) { mobile.Direction = mobile.GetDirectionTo(from); from.Direction = from.GetDirectionTo(mobile); mobile.Animate(31, 5, 1, true, false, 0); mobile.Say(Utility.RandomList(1005560, 1013046, 1079127, 1013038, 1013039, 1010634)); from.Animate(20, 5, 1, true, false, 0); from.Damage(Math.Max((Utility.Random(3) + 3), (int)(from.Hits / (Utility.Random(8) + 8)))); } else if (mobile is BaseCreature) { (mobile as BaseCreature).AggressiveAction(from, from.Criminal); } } } } else { from.SendMessage("That does not have a pocket you can pick."); } }
public static void SailBoat(Mobile from, BaseBoat boat) { bool newsail = true; if (m_SailTime.ContainsKey(from)) { if (m_SailTime[from] >= DateTime.Now) { newsail = false; } else { m_SailTime.Remove(from); } } if (newsail) { int MinLevel = 10; int MaxLevel = 100; //if (Core.Debug) from.SendMessage("TEST: SAILING IN A BOAT"); Mobile sailor = from; LokaiSkills skils = LokaiSkillUtilities.XMLGetSkills(sailor); List <Mobile> crew = GetMobilesOn(boat); SuccessRating rating = SuccessRating.LokaiSkillNotEnabled; foreach (Mobile seaman in crew) { skils = LokaiSkillUtilities.XMLGetSkills(sailor); LokaiSkills seamanAbs = LokaiSkillUtilities.XMLGetSkills(seaman); if (seamanAbs.Sailing.Value > skils.Sailing.Value) { sailor = seaman; } MinLevel--; MaxLevel--; if ((MinLevel == 5 && (boat is SmallBoat || boat is SmallDragonBoat)) || (MinLevel == 0 && (boat is MediumBoat || boat is MediumDragonBoat)) || (MinLevel == -5 && (boat is LargeBoat || boat is LargeDragonBoat))) { break; } } int count = 0; foreach (Mobile seaman in crew) { if ((count == 5 && (boat is SmallBoat || boat is SmallDragonBoat)) || (count == 10 && (boat is MediumBoat || boat is MediumDragonBoat)) || (count == 15 && (boat is LargeBoat || boat is LargeDragonBoat))) { break; } else { count++; skils = LokaiSkillUtilities.XMLGetSkills(seaman); if (seaman != sailor) { rating = LokaiSkillUtilities.CheckLokaiSkill(seaman, skils.Sailing, MinLevel, MaxLevel); if (rating >= SuccessRating.PartialSuccess) { seaman.SendMessage("You did your part."); } else { seaman.SendMessage("You could have been more helpful."); } } } } skils = LokaiSkillUtilities.XMLGetSkills(sailor); rating = LokaiSkillUtilities.CheckLokaiSkill(sailor, skils.Sailing, MinLevel, MaxLevel); if (rating <= SuccessRating.Failure) { int severity = 25; if (rating == SuccessRating.HazzardousFailure) { severity += 4; } else if (rating == SuccessRating.CriticalFailure) { severity += 8; } bool crash = false; foreach (Mobile seaman in crew) { if (!m_SailTime.ContainsKey(seaman)) { m_SailTime.Add(seaman, DateTime.Now.AddSeconds(FAILSECONDS)); } } switch (Utility.Random(severity)) { case 0: case 1: case 2: boat.StartMove(Direction.Down, true); goto case 24; case 3: case 4: case 5: boat.StartMove(Direction.East, true); goto case 24; case 6: case 7: case 8: boat.StartMove(Direction.Left, true); goto case 24; case 9: case 10: case 11: boat.StartMove(Direction.North, true); goto case 24; case 12: case 13: case 14: boat.StartMove(Direction.Right, true); goto case 24; case 15: case 16: case 17: boat.StartMove(Direction.South, true); goto case 24; case 18: case 19: case 20: boat.StartMove(Direction.Up, true); goto case 24; case 21: case 22: case 23: boat.StartMove(Direction.West, true); goto case 24; case 24: boat.StartTurn(Utility.RandomList(2, -2, -4), false); goto case 99; case 99: { foreach (Mobile mobile in crew) { MightGetSick(mobile); } break; } default: crash = true; break; } if (crash) { boat.LowerAnchor(false); List <Item> items = CheckForItems(boat); BaseDockedBoat dboat = boat.DockedBoat; foreach (Mobile seaman in crew) { seaman.SendMessage("The boat runs aground at some nearby land."); boat.RemoveKeys(seaman); if (seaman == boat.Owner) { if (dboat != null) { seaman.AddToBackpack(dboat); } } } boat.Delete(); foreach (Mobile seaman in crew) { Strand(seaman); } if (items.Count > 0) { for (int v = 0; v < items.Count; v++) { int x = from.X + Utility.Random(7) - 3; int y = from.Y + Utility.Random(7) - 3; items[v].MoveToWorld(new Point3D(x, y, from.Z)); } } } else { foreach (Mobile seaman in crew) { seaman.SendMessage("You go off course slightly."); } } } else { //if (Core.Debug) from.SendMessage("TEST: SAILING SUCCESSFUL."); foreach (Mobile seaman in crew) { seaman.SendMessage("You feel the gentle breeze of the open sea."); if (!m_SailTime.ContainsKey(seaman)) { m_SailTime.Add(seaman, DateTime.Now.AddSeconds(SAILSECONDS)); } } } } }
protected override void OnTarget(Mobile from, object targeted) { Container cont = from.Backpack; if (targeted is Item && cont != null && ((Item)targeted).IsChildOf(cont)) { IShopSellInfo[] info = m_Vendor.GetSellInfo(); Item item = targeted as Item; int totalCost = 0; string name = null; foreach (IShopSellInfo ssi in info) { if (ssi.IsSellable(item)) { totalCost = ssi.GetBuyPriceFor(item); name = ssi.GetNameFor(item); break; } } if (name == null) { m_Vendor.SayTo(from, "I won't buy that."); } else if (totalCost == 0) { m_Vendor.SayTo(from, "I won't negotiate on free items."); } else { int commerceCost = totalCost; string commerceSkill = "non-existent"; LokaiSkill lokaiSkill = (LokaiSkillUtilities.XMLGetSkills(from)).Commerce; SuccessRating rating = LokaiSkillUtilities.CheckLokaiSkill(from, lokaiSkill, 0.0, 100.0); switch (rating) { case SuccessRating.CriticalFailure: commerceCost = (int)(totalCost / CriticalFailure); commerceSkill = "horrible"; break; case SuccessRating.HazzardousFailure: commerceCost = (int)(totalCost / HazzardousFailure); commerceSkill = "terrible"; break; case SuccessRating.Failure: commerceCost = (int)(totalCost / Failure); commerceSkill = "lousy"; break; case SuccessRating.PartialSuccess: commerceCost = (int)(totalCost / PartialSuccess); commerceSkill = "mediocre"; break; case SuccessRating.Success: commerceCost = (int)(totalCost / Success); commerceSkill = "good"; break; case SuccessRating.CompleteSuccess: commerceCost = (int)(totalCost / CompleteSuccess); commerceSkill = "adept"; break; case SuccessRating.ExceptionalSuccess: commerceCost = (int)(totalCost / ExceptionalSuccess); commerceSkill = "exceptional"; break; case SuccessRating.TooEasy: commerceCost = (int)(totalCost / TooEasy); commerceSkill = "unquestionable"; break; default: case SuccessRating.TooDifficult: commerceCost = (int)(totalCost / TooDifficult); commerceSkill = "non-existent"; break; } m_Vendor.SayTo(from, "Normally, I would pay {0} for that (1), but due to your {2} commerce skill, I am paying you {3}.", totalCost, name, commerceSkill, commerceCost); totalCost = commerceCost; item.Consume(); if (totalCost > 1000) { from.AddToBackpack(new BankCheck(totalCost)); } else if (totalCost > 0) { from.AddToBackpack(new Gold(totalCost)); } } } else { from.SendMessage("You can only sell items in your backpack."); } }
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 OnCarve(Mobile from, Corpse corpse, BaseCreature mob, LokaiSkill lokaiSkill) { if (corpse.Carved) { return; } int feathers = mob.Feathers; int wool = mob.Wool; int meat = mob.Meat; int hides = mob.Hides; int scales = mob.Scales; if ((feathers == 0 && wool == 0 && meat == 0 && hides == 0 && scales == 0) || mob.Summoned || mob.IsBonded) { from.SendLocalizedMessage(500485); // You see nothing useful to carve from the corpse. } else { if (Core.ML && from.Race == Race.Human) { hides = (int)Math.Ceiling(hides * 1.1); //10% Bonus Only applies to Hides, Ore & Logs } if (corpse.Map == Map.Felucca) { feathers *= 2; wool *= 2; hides *= 2; } int ratingFactor = 10; int skinFactor = 10; SuccessRating rating = LokaiSkillUtilities.CheckLokaiSkill(from, lokaiSkill, 0.0, 100.0); switch (rating) { case SuccessRating.CriticalFailure: skinFactor = 3; ratingFactor = 0; break; case SuccessRating.HazzardousFailure: skinFactor = 6; ratingFactor = 0; break; case SuccessRating.Failure: skinFactor = 9; ratingFactor = 0; break; case SuccessRating.PartialSuccess: skinFactor = 11; ratingFactor = 0; break; case SuccessRating.Success: skinFactor = 14; ratingFactor = 3; break; case SuccessRating.CompleteSuccess: skinFactor = 17; ratingFactor = 6; break; case SuccessRating.ExceptionalSuccess: case SuccessRating.TooEasy: skinFactor = 20; ratingFactor = 9; break; default: case SuccessRating.TooDifficult: skinFactor = 0; ratingFactor = 0; break; } feathers *= skinFactor; wool *= skinFactor; hides *= skinFactor; scales *= skinFactor; meat *= ratingFactor; feathers /= 10; wool /= 10; hides /= 10; scales /= 10; meat /= 10; new Blood(0x122D).MoveToWorld(corpse.Location, corpse.Map); if (feathers != 0) { corpse.DropItem(new Feather(feathers)); from.SendLocalizedMessage(500479); // You pluck the bird. The feathers are now on the corpse. } if (wool != 0) { corpse.DropItem(new Wool(wool)); from.SendLocalizedMessage(500483); // You shear it, and the wool is now on the corpse. } if (meat != 0) { if (mob.MeatType == MeatType.Ribs) { corpse.DropItem(new RawRibs(meat)); } else if (mob.MeatType == MeatType.Bird) { corpse.DropItem(new RawBird(meat)); } else if (mob.MeatType == MeatType.LambLeg) { corpse.DropItem(new RawLambLeg(meat)); } from.SendLocalizedMessage(500467); // You carve some meat, which remains on the corpse. } if (hides != 0) { if (mob.HideType == HideType.Regular) { corpse.DropItem(new Hides(hides)); } else if (mob.HideType == HideType.Spined) { corpse.DropItem(new SpinedHides(hides)); } else if (mob.HideType == HideType.Horned) { corpse.DropItem(new HornedHides(hides)); } else if (mob.HideType == HideType.Barbed) { corpse.DropItem(new BarbedHides(hides)); } from.SendLocalizedMessage(500471); // You skin it, and the hides are now in the corpse. } if (scales != 0) { ScaleType sc = mob.ScaleType; switch (sc) { case ScaleType.Red: corpse.DropItem(new RedScales(scales)); break; case ScaleType.Yellow: corpse.DropItem(new YellowScales(scales)); break; case ScaleType.Black: corpse.DropItem(new BlackScales(scales)); break; case ScaleType.Green: corpse.DropItem(new GreenScales(scales)); break; case ScaleType.White: corpse.DropItem(new WhiteScales(scales)); break; case ScaleType.Blue: corpse.DropItem(new BlueScales(scales)); break; case ScaleType.All: { corpse.DropItem(new RedScales(scales)); corpse.DropItem(new YellowScales(scales)); corpse.DropItem(new BlackScales(scales)); corpse.DropItem(new GreenScales(scales)); corpse.DropItem(new WhiteScales(scales)); corpse.DropItem(new BlueScales(scales)); break; } } from.SendMessage("You cut away some scales, but they remain on the corpse."); } corpse.Carved = true; if (corpse.IsCriminalAction(from)) { from.CriminalAction(true); } } }
public static TimeSpan OnUse(Mobile from) { if (from.NextSkillTime > Core.TickCount) { double time = (double)(from.NextSkillTime - Core.TickCount); from.SendMessage("You must wait another {0} seconds before using this lokaiSkill.", time.ToString("F1")); return(TimeSpan.FromSeconds(time)); } LokaiSkill lokaiSkill = (LokaiSkillUtilities.XMLGetSkills(from)).SpeakToAnimals; List <BaseCreature> animals = new List <BaseCreature>(); int Max = from.FollowersMax - from.Followers; int Cur = 0; foreach (Mobile mob in from.GetMobilesInRange(10)) { if (mob is BaseCreature) { BaseCreature creature = mob as BaseCreature; if (creature.AI == AIType.AI_Animal && AllowPackAnimal(creature, lokaiSkill) && !creature.Controlled && creature.Combatant != from) { if (Cur >= Max) { break; } Cur++; animals.Add(creature); } } } if (animals.Count <= 0) { from.SendMessage("You are unable to find any animals nearby with which you can speak."); from.NextSkillTime = Core.TickCount + (int)TimeSpan.FromSeconds(4.0).TotalSeconds; } else { SuccessRating rating = LokaiSkillUtilities.CheckLokaiSkill(from, lokaiSkill, 0.0, 100.0); if (rating >= SuccessRating.PartialSuccess) { int count = 3; switch (rating) { case SuccessRating.PartialSuccess: count++; break; case SuccessRating.Success: count += 3; break; case SuccessRating.CompleteSuccess: count += 6; break; case SuccessRating.ExceptionalSuccess: count += 9; break; case SuccessRating.TooEasy: count += 12; break; } from.PublicOverheadMessage(MessageType.Emote, 0x47, true, "** Begins to call to the animals. **"); from.FixedParticles(0x376A, 9, 32, 5030, EffectLayer.Waist); new InternalTimer(from, count, count + 5, animals).Start(); } else { from.SendMessage("You fail to speak to the surrounding animals."); } } return(TimeSpan.FromSeconds(3.0)); }