protected override void OnTarget(Mobile from, object targeted) { if (targeted is Mobile) { Mobile targ = (Mobile)targeted; LokaiSkill lokaiSkill = LokaiSkillUtilities.XMLGetSkills(targ)[m_LokaiSkill]; if (lokaiSkill == null) { return; } if (m_Set) { lokaiSkill.Base = m_Value; CommandLogging.LogChangeProperty(from, targ, String.Format("{0}.Base", m_LokaiSkill), m_Value.ToString()); } from.SendMessage("{0} : {1} (Base: {2})", m_LokaiSkill, lokaiSkill.Value, lokaiSkill.Base); } else { from.SendMessage("That does not have Lokai Skills!"); } }
private static bool AllowPackAnimal(BaseCreature animal, LokaiSkill lokaiSkill) { double skil = lokaiSkill.Value; switch (animal.PackInstinct) { case PackInstinct.Arachnid: return(skil > 40.0 + (Utility.RandomDouble() * 10)); case PackInstinct.Bear: return(skil > 10.0 + (Utility.RandomDouble() * 30)); case PackInstinct.Bull: return(skil > 0.0 + (Utility.RandomDouble() * 20)); case PackInstinct.Canine: return(skil > 0.0 + (Utility.RandomDouble() * 10)); case PackInstinct.Daemon: return(skil > 70.0 + (Utility.RandomDouble() * 20)); case PackInstinct.Equine: return(skil > 10.0 + (Utility.RandomDouble() * 40)); case PackInstinct.Feline: return(skil > 0.0 + (Utility.RandomDouble() * 30)); case PackInstinct.Ostard: return(skil > 20.0 + (Utility.RandomDouble() * 10)); case PackInstinct.None: return(true); } return(false); }
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. } }
public ShowLokaiSkillGump(Mobile mobile, LokaiSkill lokaiSkill, int offset) : base(0, 0) { m_Mobile = mobile; m_LokaiSkill = lokaiSkill; AddPage(0); AddBackground(420, 23 + offset, 128, 38, 9300); AddLabel(436, 31 + offset, 0, m_LokaiSkill.Name); AddButton(422, 36 + offset, 2104, 2103, m_LokaiSkill.LokaiSkillID + 100, GumpButtonType.Reply, 0); }
public bool CanLowerLokaiSkill(LokaiSkill LokaiSkill, int pos, int amount) { if (LokaiSkill.Base - amount >= m_StartValue[pos]) { return(true); } else if (m_Mobile.AccessLevel >= AccessLevel.GameMaster) // Why should we limit a GM? hehe { return(true); } else { return(false); } }
public bool CanRaiseLokaiSkill(LokaiSkill LokaiSkill, int pos, int amount) { if ((m_Points >= amount) && ((LokaiSkill.Base + amount) <= m_LokaiSkills[pos].Cap)) { return(true); } else if (m_Mobile.AccessLevel >= AccessLevel.GameMaster) // Why should we limit a GM? hehe { return(true); } else { return(false); } }
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 EditLokaiSkillGump(Mobile from, Mobile target, LokaiSkill lokaiSkill, LokaiSkillsGumpGroup selected) : base(GumpOffsetX, GumpOffsetY) { m_From = from; m_Target = target; m_LokaiSkill = lokaiSkill; m_Selected = selected; string initialText = m_LokaiSkill.Base.ToString("F1"); AddPage(0); AddBackground(0, 0, BackWidth, BackHeight, BackGumpID); AddImageTiled(BorderSize, BorderSize, TotalWidth - (OldStyle ? SetWidth + OffsetSize : 0), TotalHeight, OffsetGumpID); int x = BorderSize + OffsetSize; int y = BorderSize + OffsetSize; AddImageTiled(x, y, EntryWidth, EntryHeight, EntryGumpID); AddLabelCropped(x + TextOffsetX, y, EntryWidth - TextOffsetX, EntryHeight, TextHue, lokaiSkill.Name); x += EntryWidth + OffsetSize; if (SetGumpID != 0) { AddImageTiled(x, y, SetWidth, EntryHeight, SetGumpID); } x = BorderSize + OffsetSize; y += EntryHeight + OffsetSize; AddImageTiled(x, y, EntryWidth, EntryHeight, EntryGumpID); AddTextEntry(x + TextOffsetX, y, EntryWidth - TextOffsetX, EntryHeight, TextHue, 0, initialText); x += EntryWidth + OffsetSize; if (SetGumpID != 0) { AddImageTiled(x, y, SetWidth, EntryHeight, SetGumpID); } AddButton(x + SetOffsetX, y + SetOffsetY, SetButtonID1, SetButtonID2, 1, GumpButtonType.Reply, 0); }
protected override void OnTarget(Mobile from, object targeted) { from.RevealingAction(); if (targeted is Corpse) { Corpse corpse = targeted as Corpse; if (corpse.Owner != null && corpse.Owner is BaseCreature) { BaseCreature creature = (targeted as Corpse).Owner as BaseCreature; LokaiSkill lokaiSkill = (LokaiSkillUtilities.XMLGetSkills(from)).Butchering; OnCarve(from, corpse, creature, lokaiSkill); } else { from.SendMessage("You may not butcher that type of corpse."); } } else { from.SendMessage("You may not butcher that!"); } }
public virtual void Resource_OnTarget(Mobile from, object targ) { LokaiSkills skills = LokaiSkillUtilities.XMLGetSkills(from); LokaiSkill brewLokaiSkill = skills[LokaiSkillName.Brewing]; LokaiSkill herbLokaiSkill = skills[LokaiSkillName.Herblore]; if (this.grindable) { if (targ is MortarPestle) { Container pack = from.Backpack; if (!(pack == null || pack.Deleted)) { Grind(this, from, LokaiSkillUtilities.CheckLokaiSkill(from, herbLokaiSkill, 0.0, 100.0), grindResult, pack); } } else { from.SendMessage("Try using this on a mortar and pestle."); } } else if (this.cookable) { if (IsHeatSource(targ)) { Container pack = from.Backpack; if (!(pack == null || pack.Deleted)) { Cook(this, from, LokaiSkillUtilities.CheckLokaiSkill(from, brewLokaiSkill, 0.0, 100.0), cookResult, pack); } } else { from.SendMessage("Try using this on a heat source."); } } }
{ public ShowCommerceGump(Mobile mobile, LokaiSkill lokaiSkill, int offset) : base(mobile, lokaiSkill, offset) { }
{ public ShowHypnotismGump(Mobile mobile, LokaiSkill lokaiSkill, int offset) : base(mobile, lokaiSkill, offset) { }
{ public ShowSpeakToAnimalsGump(Mobile mobile, LokaiSkill lokaiSkill, int offset) : base(mobile, lokaiSkill, offset) { }
{ public ShowPickPocketGump(Mobile mobile, LokaiSkill lokaiSkill, int offset) : base(mobile, lokaiSkill, offset) { }
{ public ShowVentriloquismGump(Mobile mobile, LokaiSkill lokaiSkill, int offset) : base(mobile, lokaiSkill, offset) { }
{ public ShowDetectEvilGump(Mobile mobile, LokaiSkill lokaiSkill, int offset) : base(mobile, lokaiSkill, offset) { }
{ public ShowCureDiseaseGump(Mobile mobile, LokaiSkill lokaiSkill, int offset) : base(mobile, lokaiSkill, offset) { }
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 override void OnResponse(NetState state, RelayInfo info) { Mobile m = state.Mobile; if (info.ButtonID > 299) { int change = info.ButtonID - 300; LokaiSkillUtilities.ChangeShowLokaiSkill(change); m.SendGump(new ShowLokaiSkillsGump(m, m_Value)); } else if (info.ButtonID > 199) { LokaiSkillName showAb = (LokaiSkillName)(info.ButtonID - 200); LokaiSkill lokaiSkill = LokaiSkillUtilities.XMLGetSkills(m)[showAb]; int offset = ((int)showAb * 17) - 9; switch (showAb) { case LokaiSkillName.Butchering: m.SendGump(new ShowButcheringGump(m, lokaiSkill, offset)); break; case LokaiSkillName.Skinning: m.SendGump(new ShowSkinningGump(m, lokaiSkill, offset)); break; case LokaiSkillName.DetectEvil: m.SendGump(new ShowDetectEvilGump(m, lokaiSkill, offset)); break; case LokaiSkillName.CureDisease: m.SendGump(new ShowCureDiseaseGump(m, lokaiSkill, offset)); break; case LokaiSkillName.PickPocket: m.SendGump(new ShowPickPocketGump(m, lokaiSkill, offset)); break; case LokaiSkillName.Pilfering: m.SendGump(new ShowPilferingGump(m, lokaiSkill, offset)); break; case LokaiSkillName.Ventriloquism: m.SendGump(new ShowVentriloquismGump(m, lokaiSkill, offset)); break; case LokaiSkillName.Hypnotism: m.SendGump(new ShowHypnotismGump(m, lokaiSkill, offset)); break; case LokaiSkillName.SpeakToAnimals: m.SendGump(new ShowSpeakToAnimalsGump(m, lokaiSkill, offset)); break; case LokaiSkillName.Brewing: m.SendGump(new ShowBrewingGump(m, lokaiSkill, offset)); break; case LokaiSkillName.Commerce: m.SendGump(new ShowCommerceGump(m, lokaiSkill, offset)); break; case LokaiSkillName.Herblore: m.SendGump(new ShowHerbloreGump(m, lokaiSkill, offset)); break; } m.SendGump(new ShowLokaiSkillsGump(m, m_Value)); } else if (info.ButtonID > 99) { int useSkill = info.ButtonID - 100; if (m.Spell == null && !m.Meditating) { if (LokaiSkillInfo.Table[useSkill].Callback != null) { if (m.NextSkillTime <= Core.TickCount || (LokaiSkillName)useSkill == LokaiSkillName.SpeakToAnimals) { m.NextSkillTime = Core.TickCount + (int)LokaiSkillInfo.Table[useSkill].Callback(m).TotalSeconds; } else { m.SendMessage("You must wait to use another skill."); } } else { m.SendMessage("That skill is not yet active."); } } else { m.SendMessage("You are too busy to use that skill now."); } m.SendGump(new ShowLokaiSkillsGump(m, m_Value)); } else if (info.ButtonID == 19) { m.SendGump(new ShowLokaiSkillsGump(m, false)); } else if (info.ButtonID == 29) { m.SendGump(new ShowLokaiSkillsGump(m, true)); } }
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."); } } } }
{ public ShowBrewingGump(Mobile mobile, LokaiSkill lokaiSkill, int offset) : base(mobile, lokaiSkill, offset) { }
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 LokaiSkillsGump(Mobile from, Mobile target, LokaiSkillsGumpGroup selected) : base(GumpOffsetX, GumpOffsetY) { m_From = from; m_Target = target; m_Groups = LokaiSkillsGumpGroup.Groups; m_Selected = selected; int count = m_Groups.Length; if (selected != null) { count += selected.LokaiSkills.Length; } int totalHeight = OffsetSize + ((EntryHeight + OffsetSize) * (count + 1)); AddPage(0); AddBackground(0, 0, BackWidth, BorderSize + totalHeight + BorderSize, BackGumpID); AddImageTiled(BorderSize, BorderSize, TotalWidth - (OldStyle ? SetWidth + OffsetSize : 0), totalHeight, OffsetGumpID); int x = BorderSize + OffsetSize; int y = BorderSize + OffsetSize; int emptyWidth = TotalWidth - PrevWidth - NextWidth - (OffsetSize * 4) - (OldStyle ? SetWidth + OffsetSize : 0); if (OldStyle) { AddImageTiled(x, y, TotalWidth - (OffsetSize * 3) - SetWidth, EntryHeight, HeaderGumpID); } else { AddImageTiled(x, y, PrevWidth, EntryHeight, HeaderGumpID); } x += PrevWidth + OffsetSize; if (!OldStyle) { AddImageTiled(x - (OldStyle ? OffsetSize : 0), y, emptyWidth + (OldStyle ? OffsetSize * 2 : 0), EntryHeight, HeaderGumpID); } x += emptyWidth + OffsetSize; if (!OldStyle) { AddImageTiled(x, y, NextWidth, EntryHeight, HeaderGumpID); } for (int i = 0; i < m_Groups.Length; ++i) { x = BorderSize + OffsetSize; y += EntryHeight + OffsetSize; LokaiSkillsGumpGroup group = m_Groups[i]; AddImageTiled(x, y, PrevWidth, EntryHeight, HeaderGumpID); if (group == selected) { AddButton(x + PrevOffsetX, y + PrevOffsetY, 0x15E2, 0x15E6, GetButtonID(0, i), GumpButtonType.Reply, 0); } else { AddButton(x + PrevOffsetX, y + PrevOffsetY, 0x15E1, 0x15E5, GetButtonID(0, i), GumpButtonType.Reply, 0); } x += PrevWidth + OffsetSize; x -= (OldStyle ? OffsetSize : 0); AddImageTiled(x, y, emptyWidth + (OldStyle ? OffsetSize * 2 : 0), EntryHeight, EntryGumpID); AddLabel(x + TextOffsetX, y, TextHue, group.Name); x += emptyWidth + (OldStyle ? OffsetSize * 2 : 0); x += OffsetSize; if (SetGumpID != 0) { AddImageTiled(x, y, SetWidth, EntryHeight, SetGumpID); } if (group == selected) { int indentMaskX = BorderSize; int indentMaskY = y + EntryHeight + OffsetSize; for (int j = 0; j < group.LokaiSkills.Length; ++j) { LokaiSkill skil = (LokaiSkillUtilities.XMLGetSkills(m_Target))[group.LokaiSkills[j]]; x = BorderSize + OffsetSize; y += EntryHeight + OffsetSize; x += OffsetSize; x += IndentWidth; AddImageTiled(x, y, PrevWidth, EntryHeight, HeaderGumpID); AddButton(x + PrevOffsetX, y + PrevOffsetY, 0x15E1, 0x15E5, GetButtonID(1, j), GumpButtonType.Reply, 0); x += PrevWidth + OffsetSize; x -= (OldStyle ? OffsetSize : 0); AddImageTiled(x, y, emptyWidth + (OldStyle ? OffsetSize * 2 : 0) - OffsetSize - IndentWidth, EntryHeight, EntryGumpID); AddLabel(x + TextOffsetX, y, TextHue, skil == null ? "(null)" : skil.Name); x += emptyWidth + (OldStyle ? OffsetSize * 2 : 0) - OffsetSize - IndentWidth; x += OffsetSize; if (SetGumpID != 0) { AddImageTiled(x, y, SetWidth, EntryHeight, SetGumpID); } if (skil != null) { int buttonID1, buttonID2; int xOffset, yOffset; switch (skil.Lock) { default: case LokaiSkillLock.Up: buttonID1 = 0x983; buttonID2 = 0x983; xOffset = 6; yOffset = 4; break; case LokaiSkillLock.Down: buttonID1 = 0x985; buttonID2 = 0x985; xOffset = 6; yOffset = 4; break; case LokaiSkillLock.Locked: buttonID1 = 0x82C; buttonID2 = 0x82C; xOffset = 5; yOffset = 2; break; } AddButton(x + xOffset, y + yOffset, buttonID1, buttonID2, GetButtonID(2, j), GumpButtonType.Reply, 0); y += 1; x -= OffsetSize; x -= 1; x -= 50; AddImageTiled(x, y, 50, EntryHeight - 2, OffsetGumpID); x += 1; y += 1; AddImageTiled(x, y, 48, EntryHeight - 4, EntryGumpID); AddLabelCropped(x + TextOffsetX, y - 1, 48 - TextOffsetX, EntryHeight - 3, TextHue, skil.Base.ToString("F1")); y -= 2; } } AddImageTiled(indentMaskX, indentMaskY, IndentWidth + OffsetSize, (group.LokaiSkills.Length * (EntryHeight + OffsetSize)) - (i < (m_Groups.Length - 1) ? OffsetSize : 0), BackGumpID + 4); } } }
public override void OnResponse(NetState sender, RelayInfo info) { int buttonID = info.ButtonID - 1; int index = buttonID / 3; int type = buttonID % 3; switch (type) { case 0: { if (index >= 0 && index < m_Groups.Length) { LokaiSkillsGumpGroup newSelection = m_Groups[index]; if (m_Selected != newSelection) { m_From.SendGump(new LokaiSkillsGump(m_From, m_Target, newSelection)); } else { m_From.SendGump(new LokaiSkillsGump(m_From, m_Target, null)); } } break; } case 1: { if (m_Selected != null && index >= 0 && index < m_Selected.LokaiSkills.Length) { LokaiSkill skil = (LokaiSkillUtilities.XMLGetSkills(m_Target))[m_Selected.LokaiSkills[index]]; if (skil != null) { if (m_From.AccessLevel >= AccessLevel.GameMaster) { m_From.SendGump(new EditLokaiSkillGump(m_From, m_Target, skil, m_Selected)); } else { m_From.SendMessage("You may not change that."); m_From.SendGump(new LokaiSkillsGump(m_From, m_Target, m_Selected)); } } else { m_From.SendGump(new LokaiSkillsGump(m_From, m_Target, m_Selected)); } } break; } case 2: { if (m_Selected != null && index >= 0 && index < m_Selected.LokaiSkills.Length) { LokaiSkill skil = (LokaiSkillUtilities.XMLGetSkills(m_Target))[m_Selected.LokaiSkills[index]]; if (skil != null) { if (m_From.AccessLevel >= AccessLevel.GameMaster) { switch (skil.Lock) { case LokaiSkillLock.Up: skil.SetLockNoRelay(LokaiSkillLock.Down); skil.Update(); break; case LokaiSkillLock.Down: skil.SetLockNoRelay(LokaiSkillLock.Locked); skil.Update(); break; case LokaiSkillLock.Locked: skil.SetLockNoRelay(LokaiSkillLock.Up); skil.Update(); break; } } else { m_From.SendMessage("You may not change that."); } m_From.SendGump(new LokaiSkillsGump(m_From, m_Target, m_Selected)); } } break; } } }
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."); } } }
{ public ShowHerbloreGump(Mobile mobile, LokaiSkill lokaiSkill, int offset) : base(mobile, lokaiSkill, offset) { }
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()); }
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."); } }
public IncreaseLokaiSkillsGump(PlayerMobile mobile, LokaiSkillBall ball, bool first, int page) : base(50, 50) { m_Page = page; m_Ball = ball; m_Points = m_Ball.Points; m_Mobile = mobile; m_LokaiSkills = LokaiSkillUtilities.XMLGetSkills(m_Mobile); if (first) { m_StartValue = new double[30]; m_Page = 0; for (int x = 0; x < 30; x++) { m_StartValue[x] = m_LokaiSkills[x].Base; } } m_Mobile.CloseGump(typeof(IncreaseLokaiSkillsGump)); AddPage(0); AddBackground(0, 0, 476, 440, 0x13BE); AddLabel(10, 7, 2100, "Choose Skills"); if (m_Page > 0) { AddButton(275, 7, 250, 251, 2, GumpButtonType.Reply, 0); // Prev Page } if (m_Page < 2) { AddButton(275, 395, 252, 253, 3, GumpButtonType.Reply, 0); // Next Page } AddLabel(160, 7, 2100, "Points Left: " + m_Points.ToString()); // We only need this "if" condition if we want to make them use it all up right now. // if ( m_Points == 0 ) // { AddButton(305, 335, 0xFB7, 0xFB9, 1, GumpButtonType.Reply, 0); // OK button // } AddImage(170, -10, 0x58A); m_StartPos = m_Page * 10; int z = 0; for (int i = m_StartPos; i < m_StartPos + 10; i++) { int y = 20 + (30 * (++z)); if (LokaiSkillUtilities.ShowLokaiSkill(i)) { m_LokaiSkill = m_LokaiSkills[i]; AddLabel(10, y, 2124, m_LokaiSkill.Name.ToString()); AddLabel(170, y, 2100, (((double)m_LokaiSkill.BaseFixedPoint) / 10).ToString()); if (CanLowerLokaiSkill(m_LokaiSkill, i, 1)) { AddButton(220, y, 0x1519, 0x1519, 1000 + i, GumpButtonType.Reply, 0); // Decrease } if (CanRaiseLokaiSkill(m_LokaiSkill, i, 1)) { AddButton(240, y, 0x151A, 0x151A, 2000 + i, GumpButtonType.Reply, 0); // Increase } if (CanLowerLokaiSkill(m_LokaiSkill, i, 5)) { AddButton(200, y - 2, 2229, 2229, 3000 + i, GumpButtonType.Reply, 0); // Decrease by 5 } if (CanRaiseLokaiSkill(m_LokaiSkill, i, 5)) { AddButton(256, y - 2, 2229, 2229, 4000 + i, GumpButtonType.Reply, 0); // Increase by 5 } } } }