public static void OnVirtueAccepted(PlayerMobile protector, PlayerMobile protectee) { if (!VirtueHelper.IsSeeker(protector, VirtueName.Justice)) { protector.SendLocalizedMessage(1049610); // You must reach the first path in this virtue to invoke it. } else if (!protector.CanBeginAction(typeof(JusticeVirtue))) { protector.SendLocalizedMessage(1049370); // You must wait a while before offering your protection again. } else if (protector.JusticeProtectors.Count > 0) { protector.SendLocalizedMessage(1049542); // You cannot protect someone while being protected. } else if (protector.Map != Map.Felucca) { protector.SendLocalizedMessage(1049372); // You cannot use this ability here. } else if (protectee.Map != Map.Felucca) { protector.SendLocalizedMessage(1049372); // You cannot use this ability here. } else if (protectee == protector || protectee.Criminal || protectee.Kills >= 5) { protector.SendLocalizedMessage(1049436); // That player cannot be protected. } else if (protectee.JusticeProtectors.Count > 0) { protector.SendLocalizedMessage(1049369); // You cannot protect that player right now. } else { protectee.JusticeProtectors.Add(protector); string args = String.Format("{0}\t{1}", protector.Name, protectee.Name); protectee.SendLocalizedMessage(1049451, args); // You are now being protected by ~1_NAME~. protector.SendLocalizedMessage(1049452, args); // You are now protecting ~2_NAME~. } }
public static void CheckAtrophy(Mobile from) { PlayerMobile pm = from as PlayerMobile; if (pm == null) { return; } try { if ((pm.LastCompassionLoss + LossDelay) < DateTime.UtcNow) { VirtueHelper.Atrophy(from, VirtueName.Compassion, LossAmount); //OSI has no cliloc message for losing compassion. Weird. pm.LastCompassionLoss = DateTime.UtcNow; } } catch { } }
public static void Resurrect(Mobile from) { if (from.Alive) { return; } PlayerMobile pm = from as PlayerMobile; if (pm == null) { return; } if (from.Criminal) { from.SendLocalizedMessage(1052007); // You cannot use this ability while flagged as a criminal. } else if (!VirtueHelper.IsSeeker(from, VirtueName.Sacrifice)) { from.SendLocalizedMessage(1052004); // You cannot use this ability. } else if (pm.AvailableResurrects <= 0) { from.SendLocalizedMessage(1052005); // You do not have any resurrections left. } else { /* * We need to wait for them to accept the gump or they can just use * Sacrifice and cancel to have items in their backpack for free. */ from.CloseGump(typeof(ResurrectGump)); from.SendGump(new ResurrectGump(from, true)); } }
public static void OnVirtueUsed(Mobile from) { if (!from.CheckAlive()) { return; } PlayerMobile protector = from as PlayerMobile; if (protector == null) { return; } if (!VirtueHelper.IsSeeker(protector, VirtueName.Justice)) { protector.SendLocalizedMessage(1049610); // You must reach the first path in this virtue to invoke it. } else if (!protector.CanBeginAction(typeof(JusticeVirtue))) { protector.SendLocalizedMessage(1049370); // You must wait a while before offering your protection again. } else if (protector.JusticeProtectors.Count > 0) { protector.SendLocalizedMessage(1049542); // You cannot protect someone while being protected. } else if (protector.Map != Map.Felucca) { protector.SendLocalizedMessage(1049372); // You cannot use this ability here. } else { protector.BeginTarget(14, false, TargetFlags.None, new TargetCallback(OnVirtueTargeted)); protector.SendLocalizedMessage(1049366); // Choose the player you wish to protect. } }
public static void CheckAtrophy(Mobile from) { PlayerMobile pm = from as PlayerMobile; if (pm == null) { return; } try { if ((pm.LastJusticeLoss + LossDelay) < DateTime.UtcNow) { if (VirtueHelper.Atrophy(from, VirtueName.Justice, LossAmount)) { from.SendLocalizedMessage(1049373); // You have lost some Justice. } pm.LastJusticeLoss = DateTime.UtcNow; } } catch { } }
public static void Sacrifice(Mobile from, object targeted) { if (!from.CheckAlive()) { return; } PlayerMobile pm = from as PlayerMobile; if (pm == null) { return; } Mobile targ = targeted as Mobile; if (targ == null) { return; } if (!ValidateCreature(targ)) { from.SendLocalizedMessage(1052014); // You cannot sacrifice your fame for that creature. } else if (((targ.Hits * 100) / Math.Max(targ.HitsMax, 1)) < 90) { from.SendLocalizedMessage(1052013); // You cannot sacrifice for this monster because it is too damaged. } else if (from.Hidden) { from.SendLocalizedMessage(1052015); // You cannot do that while hidden. } else if (VirtueHelper.IsHighestPath(from, VirtueName.Sacrifice)) { from.SendLocalizedMessage(1052068); // You have already attained the highest path in this virtue. } else if (from.Fame < 2500) { from.SendLocalizedMessage(1052017); // You do not have enough fame to sacrifice. } else if (DateTime.UtcNow < (pm.LastSacrificeGain + GainDelay)) { from.SendLocalizedMessage(1052016); // You must wait approximately one day before sacrificing again. } else { int toGain; if (from.Fame < 5000) { toGain = 500; } else if (from.Fame < 10000) { toGain = 1000; } else { toGain = 2000; } from.Fame = 0; // I have seen the error of my ways! targ.PublicOverheadMessage(MessageType.Regular, 0x3B2, 1052009); from.SendLocalizedMessage(1052010); // You have set the creature free. Timer.DelayCall(TimeSpan.FromSeconds(1.0), new TimerCallback(targ.Delete)); pm.LastSacrificeGain = DateTime.UtcNow; bool gainedPath = false; if (VirtueHelper.Award(from, VirtueName.Sacrifice, toGain, ref gainedPath)) { if (gainedPath) { from.SendLocalizedMessage(1052008); // You have gained a path in Sacrifice! if (pm.AvailableResurrects < 3) { ++pm.AvailableResurrects; } } else { from.SendLocalizedMessage(1054160); // You have gained in sacrifice. } } from.SendLocalizedMessage(1052016); // You must wait approximately one day before sacrificing again. } }
public static void Valor(Mobile from, object targ) { IdolOfTheChampion idol = targ as IdolOfTheChampion; if (idol == null || idol.Deleted || idol.Spawn == null || idol.Spawn.Deleted) { from.SendLocalizedMessage(1054035); // You must target a Champion Idol to challenge the Champion's spawn! } else if (from.Hidden) { from.SendLocalizedMessage(1052015); // You cannot do that while hidden. } else if (idol.Spawn.HasBeenAdvanced) { from.SendLocalizedMessage(1054038); // The Champion of this region has already been challenged! } else { VirtueLevel vl = VirtueHelper.GetLevel(from, VirtueName.Valor); if (idol.Spawn.Active) { if (idol.Spawn.Champion != null) //TODO: Message? { return; } int needed, consumed; switch (idol.Spawn.GetSubLevel()) { case 0: { needed = consumed = 2500; break; } case 1: { needed = consumed = 5000; break; } case 2: { needed = 10000; consumed = 7500; break; } default: { needed = 20000; consumed = 10000; break; } } if (from.Virtues.GetValue((int)VirtueName.Valor) >= needed) { VirtueHelper.Atrophy(from, VirtueName.Valor, consumed); from.SendLocalizedMessage(1054037); // Your challenge is heard by the Champion of this region! Beware its wrath! idol.Spawn.HasBeenAdvanced = true; idol.Spawn.AdvanceLevel(); } else { from.SendLocalizedMessage(1054039); // The Champion of this region ignores your challenge. You must further prove your valor. } } else { if (vl == VirtueLevel.Knight) { VirtueHelper.Atrophy(from, VirtueName.Valor, 11000); from.SendLocalizedMessage(1054037); // Your challenge is heard by the Champion of this region! Beware its wrath! idol.Spawn.EndRestart(); idol.Spawn.HasBeenAdvanced = true; } else { from.SendLocalizedMessage(1054036); // You must be a Knight of Valor to summon the champion's spawn in this manner! } } } }
public VirtueInfoGump(Mobile beholder, VirtueName virtue, int description, string webPage) : base(0, 0) { m_Beholder = beholder; m_Virtue = virtue; m_Desc = description; m_Page = webPage; int value = beholder.Virtues.GetValue((int)virtue); AddPage(0); AddImage(30, 40, 2080); AddImage(47, 77, 2081); AddImage(47, 147, 2081); AddImage(47, 217, 2081); AddImage(47, 267, 2083); AddImage(70, 213, 2091); AddPage(1); int maxValue = VirtueHelper.GetMaxAmount(m_Virtue); int valueDesc; int dots; if (value < 4000) { dots = value / 400; } else if (value < 10000) { dots = (value - 4000) / 600; } else if (value < maxValue) { dots = (value - 10000) / ((maxValue - 10000) / 10); } else { dots = 10; } for (int i = 0; i < 10; ++i) { AddImage(95 + (i * 17), 50, i < dots ? 2362 : 2360); } if (value < 1) { valueDesc = 1052044; // You have not started on the path of this Virtue. } else if (value < 400) { valueDesc = 1052045; // You have barely begun your journey through the path of this Virtue. } else if (value < 2000) { valueDesc = 1052046; // You have progressed in this Virtue, but still have much to do. } else if (value < 3600) { valueDesc = 1052047; // Your journey through the path of this Virtue is going well. } else if (value < 4000) { valueDesc = 1052048; // You feel very close to achieving your next path in this Virtue. } else if (dots < 1) { valueDesc = 1052049; // You have achieved a path in this Virtue. } else if (dots < 9) { valueDesc = 1052047; // Your journey through the path of this Virtue is going well. } else if (dots < 10) { valueDesc = 1052048; // You feel very close to achieving your next path in this Virtue. } else { valueDesc = 1052050; // You have achieved the highest path in this Virtue. } AddHtmlLocalized(157, 73, 200, 40, 1051000 + (int)virtue, false, false); AddHtmlLocalized(75, 95, 220, 140, description, false, false); AddHtmlLocalized(70, 224, 229, 60, valueDesc, false, false); AddButton(65, 277, 1209, 1209, 1, GumpButtonType.Reply, 0); AddButton(280, 43, 4014, 4014, 2, GumpButtonType.Reply, 0); AddHtmlLocalized(83, 275, 400, 40, (webPage == null) ? 1052055 : 1052052, false, false); // This virtue is not yet defined. OR -click to learn more (opens webpage) }