public override void OnAttach() { base.OnAttach(); // apply the mod if (AttachedTo is PlayerMobile) { // for players just add it immediately // lookup the virtue type VirtueName g = (VirtueName)0; bool valid = true; bool gainedPath = false; try { g = (VirtueName)Enum.Parse(typeof(VirtueName), Virtue, true); } catch { valid = false; } if (valid) { VirtueHelper.Award((Mobile)AttachedTo, g, Value, ref gainedPath); ((Mobile)AttachedTo).SendMessage("Receive {0}", OnIdentify((Mobile)AttachedTo)); if (gainedPath) { ((Mobile)AttachedTo).SendMessage("You have gained a path in {0}", Virtue); } } else { ((Mobile)AttachedTo).SendMessage("{0}: no such Virtue", Virtue); } // and then remove the attachment Timer.DelayCall(TimeSpan.Zero, new TimerCallback(Delete)); //Delete(); } else if (AttachedTo is Item) { // dont allow item attachments Delete(); } }
public void GiveValor(ArrayList toGive) { if (chance_valor_award >= Utility.RandomDouble()) { for (int i = 0; i < toGive.Count; ++i) { PlayerMobile pm = (PlayerMobile)toGive[i % toGive.Count]; if (VirtueHelper.IsHighestPath(pm, VirtueName.Valor)) { pm.SendLocalizedMessage(1054031); // You have achieved the highest path in Valor and can no longer gain any further. } else { bool path = false; VirtueHelper.Award(pm, VirtueName.Valor, ValorPoints, ref path); pm.SendLocalizedMessage(1054030); // You have gained in Valor! } } } }
public override void OnDoubleClick(Mobile from) { if (Table.ContainsKey(from) && Table[from] > DateTime.UtcNow) { from.SendLocalizedMessage(1053004); // You must wait about a day before you can gain in compassion again. return; } Table.Remove(from); bool gainedPath = false; if (VirtueHelper.Award(from, VirtueName.Compassion, 1000, ref gainedPath)) { from.SendLocalizedMessage(1053002); // You have gained in compassion. if (gainedPath) { from.SendLocalizedMessage(1053005); // You have achieved a path in compassion! } Table[from] = DateTime.UtcNow + TimeSpan.FromDays(1.0); Consume(); } }
public static void CheckAtrophy(Mobile from) { if (from is not PlayerMobile pm) { return; } try { if (pm.LastValorLoss + LossDelay < Core.Now) { if (VirtueHelper.Atrophy(from, VirtueName.Valor, LossAmount)) { from.SendLocalizedMessage(1054040); // You have lost some Valor. } pm.LastValorLoss = Core.Now; } } catch { // ignored } }
public void GivePowerScrolls() { List <Mobile> toGive = new List <Mobile>(); List <DamageStore> rights = GetLootingRights(); for (int i = rights.Count - 1; i >= 0; --i) { DamageStore ds = rights[i]; if (ds.m_HasRight) { toGive.Add(ds.m_Mobile); } } if (toGive.Count == 0) { return; } // Randomize for (int i = 0; i < toGive.Count; ++i) { int rand = Utility.Random(toGive.Count); Mobile hold = toGive[i]; toGive[i] = toGive[rand]; toGive[rand] = hold; } for (int i = 0; i < ChampionSystem.StatScrollAmount; ++i) { Mobile m = toGive[i % toGive.Count]; m.SendLocalizedMessage(1049524); // You have received a scroll of power! m.AddToBackpack(new StatCapScroll(m_StatCap + RandomStatScrollLevel())); if (m is PlayerMobile) { PlayerMobile pm = (PlayerMobile)m; for (int j = 0; j < pm.JusticeProtectors.Count; ++j) { Mobile prot = pm.JusticeProtectors[j]; if (prot.Map != m.Map || prot.Murderer || prot.Criminal || !JusticeVirtue.CheckMapRegion(m, prot)) { continue; } int chance = 0; switch (VirtueHelper.GetLevel(prot, VirtueName.Justice)) { case VirtueLevel.Seeker: chance = 60; break; case VirtueLevel.Follower: chance = 80; break; case VirtueLevel.Knight: chance = 100; break; } if (chance > Utility.Random(100)) { prot.SendLocalizedMessage(1049368); // You have been rewarded for your dedication to Justice! prot.AddToBackpack(new StatCapScroll(m_StatCap + RandomStatScrollLevel())); } } } } }
public override void OnResponse(NetState state, RelayInfo info) { var from = state.Mobile; from.CloseGump <ResurrectGump>(); if (info.ButtonID != 1 && info.ButtonID != 2) { return; } if (from.Map?.CanFit(from.Location, 16, false, false) != true) { from.SendLocalizedMessage(502391); // Thou can not be resurrected there! return; } if (m_Price > 0) { if (info.IsSwitched(1)) { if (Banker.Withdraw(from, m_Price)) { from.SendLocalizedMessage( 1060398, m_Price.ToString() ); // ~1_AMOUNT~ gold has been withdrawn from your bank box. from.SendLocalizedMessage( 1060022, Banker.GetBalance(from).ToString() ); // You have ~1_AMOUNT~ gold in cash remaining in your bank box. } else { from.SendLocalizedMessage( 1060020 ); // Unfortunately, you do not have enough cash in your bank to cover the cost of the healing. return; } } else { from.SendLocalizedMessage(1060019); // You decide against paying the healer, and thus remain dead. return; } } from.PlaySound(0x214); from.FixedEffect(0x376A, 10, 16); from.Resurrect(); if (m_Healer != null && from != m_Healer) { var level = VirtueHelper.GetLevel(m_Healer, VirtueName.Compassion); from.Hits = level switch { VirtueLevel.Seeker => AOS.Scale(from.HitsMax, 20), VirtueLevel.Follower => AOS.Scale(from.HitsMax, 40), VirtueLevel.Knight => AOS.Scale(from.HitsMax, 80), _ => from.Hits }; } if (m_FromSacrifice && from is PlayerMobile mobile) { mobile.AvailableResurrects -= 1; var pack = mobile.Backpack; var corpse = mobile.Corpse; if (pack != null && corpse != null) { var items = new List <Item>(corpse.Items); for (var i = 0; i < items.Count; ++i) { var item = items[i]; if (item.Layer != Layer.Hair && item.Layer != Layer.FacialHair && item.Movable) { pack.DropItem(item); } } } } if (from.Fame > 0) { var amount = from.Fame / 10; Titles.AwardFame(from, -amount, true); } if (!Core.AOS && from.ShortTermMurders >= 5) { var loss = (100.0 - (4.0 + from.ShortTermMurders / 5.0)) / 100.0; // 5 to 15% loss if (loss < 0.85) { loss = 0.85; } else if (loss > 0.95) { loss = 0.95; } if (from.RawStr * loss > 10) { from.RawStr = (int)(from.RawStr * loss); } if (from.RawInt * loss > 10) { from.RawInt = (int)(from.RawInt * loss); } if (from.RawDex * loss > 10) { from.RawDex = (int)(from.RawDex * loss); } for (var s = 0; s < from.Skills.Length; s++) { if (from.Skills[s].Base * loss > 35) { from.Skills[s].Base *= loss; } } } if (from.Alive && m_HitsScalar > 0) { from.Hits = (int)(from.HitsMax * m_HitsScalar); } } }
public virtual void GivePowerScrolls() { if (this.Map != Map.Felucca) { return; } List <Mobile> toGive = new List <Mobile>(); List <DamageStore> rights = GetLootingRights(); for (int i = rights.Count - 1; i >= 0; --i) { DamageStore ds = rights[i]; if (ds.m_HasRight && InRange(ds.m_Mobile, 100) && ds.m_Mobile.Map == this.Map) { toGive.Add(ds.m_Mobile); } } if (toGive.Count == 0) { return; } for (int i = 0; i < toGive.Count; i++) { Mobile m = toGive[i]; if (!(m is PlayerMobile)) { continue; } bool gainedPath = false; int pointsToGain = 800; if (VirtueHelper.Award(m, VirtueName.Valor, pointsToGain, ref gainedPath)) { if (gainedPath) { m.SendLocalizedMessage(1054032); // You have gained a path in Valor! } else { m.SendLocalizedMessage(1054030); // You have gained in Valor! } //No delay on Valor gains } } // Randomize - PowerScrolls for (int i = 0; i < toGive.Count; ++i) { int rand = Utility.Random(toGive.Count); Mobile hold = toGive[i]; toGive[i] = toGive[rand]; toGive[rand] = hold; } for (int i = 0; i < ChampionSystem.PowerScrollAmount; ++i) { Mobile m = toGive[i % toGive.Count]; PowerScroll ps = CreateRandomPowerScroll(); m.SendLocalizedMessage(1049524); // You have received a scroll of power! GivePowerScrollTo(m, ps, this); } if (Core.TOL) { // Randomize - Primers for (int i = 0; i < toGive.Count; ++i) { int rand = Utility.Random(toGive.Count); Mobile hold = toGive[i]; toGive[i] = toGive[rand]; toGive[rand] = hold; } for (int i = 0; i < ChampionSystem.PowerScrollAmount; ++i) { Mobile m = toGive[i % toGive.Count]; SkillMasteryPrimer p = CreateRandomPrimer(); m.SendLocalizedMessage(1156209); // You have received a mastery primer! GivePowerScrollTo(m, p, this); } } ColUtility.Free(toGive); }
public void GivePowerScrolls() { List <Mobile> toGive = new List <Mobile>(); List <DamageStore> rights = BaseCreature.GetLootingRights(this.DamageEntries, this.HitsMax); for (int i = rights.Count - 1; i >= 0; --i) { DamageStore ds = rights[i]; if (ds.m_HasRight) { toGive.Add(ds.m_Mobile); } } if (toGive.Count == 0) { return; } // Randomize for (int i = 0; i < toGive.Count; ++i) { int rand = Utility.Random(toGive.Count); Mobile hold = toGive[i]; toGive[i] = toGive[rand]; toGive[rand] = hold; } for (int i = 0; i < 16; ++i) { int level; double random = Utility.RandomDouble(); if (0.1 >= random) { level = 25; } else if (0.25 >= random) { level = 20; } else if (0.45 >= random) { level = 15; } else if (0.70 >= random) { level = 10; } else { level = 5; } Mobile m = toGive[i % toGive.Count]; m.SendLocalizedMessage(1049524); // You have received a scroll of power! m.AddToBackpack(new StatCapScroll(225 + level)); if (m is PlayerMobile) { PlayerMobile pm = (PlayerMobile)m; for (int j = 0; j < pm.JusticeProtectors.Count; ++j) { Mobile prot = (Mobile)pm.JusticeProtectors[j]; if (prot.Map != m.Map || prot.Kills >= 5 || prot.Criminal || !JusticeVirtue.CheckMapRegion(m, prot)) { continue; } int chance = 0; switch (VirtueHelper.GetLevel(prot, VirtueName.Justice)) { case VirtueLevel.Seeker: chance = 60; break; case VirtueLevel.Follower: chance = 80; break; case VirtueLevel.Knight: chance = 100; break; } if (chance > Utility.Random(100)) { prot.SendLocalizedMessage(1049368); // You have been rewarded for your dedication to Justice! prot.AddToBackpack(new StatCapScroll(225 + level)); } } } } }
public virtual bool CheckAtDestination() { EDI dest = GetDestination(); if (dest == null) { return(false); } Mobile escorter = GetEscorter(); if (escorter == null) { return(false); } if (dest.Contains(Location)) { Say(1042809, escorter.Name); // We have arrived! I thank thee, ~1_PLAYER_NAME~! I have no further need of thy services. Here is thy pay. // not going anywhere m_Destination = null; m_DestinationString = null; Container cont = escorter.Backpack; if (cont == null) { cont = escorter.BankBox; } Gold gold = new Gold(500, 1000); if (cont == null || !cont.TryDropItem(escorter, gold, false)) { gold.MoveToWorld(escorter.Location, escorter.Map); } StopFollow(); SetControlMaster(null); m_EscortTable.Remove(escorter); BeginDelete(); Misc.Titles.AwardFame(escorter, 10, true); bool gainedPath = false; PlayerMobile pm = escorter as PlayerMobile; if (pm != null) { if (pm.CompassionGains > 0 && Core.Now > pm.NextCompassionDay) { pm.NextCompassionDay = DateTime.MinValue; pm.CompassionGains = 0; } if (pm.CompassionGains >= 5) // have already gained 5 points in one day, can gain no more { pm.SendLocalizedMessage(1053004); // You must wait about a day before you can gain in compassion again. } else if (VirtueHelper.Award(pm, VirtueName.Compassion, 1, ref gainedPath)) { if (gainedPath) { pm.SendLocalizedMessage(1053005); // You have achieved a path in compassion! } else { pm.SendLocalizedMessage(1053002); // You have gained in compassion. } pm.NextCompassionDay = Core.Now + TimeSpan.FromDays(1.0); // in one day CompassionGains gets reset to 0 ++pm.CompassionGains; } else { pm.SendLocalizedMessage(1053003); // You have achieved the highest path of compassion and can no longer gain any further. } } return(true); } return(false); }
public static void GiveScrollTo(Mobile killer, SpecialScroll scroll) { if (scroll == null || killer == null) //sanity { return; } if (scroll is ScrollofTranscendence) { killer.SendLocalizedMessage(1094936); // You have received a Scroll of Transcendence! } else { killer.SendLocalizedMessage(1049524); // You have received a scroll of power! } if (killer.Alive) { killer.AddToBackpack(scroll); } else { if (killer.Corpse != null && !killer.Corpse.Deleted) { killer.Corpse.DropItem(scroll); } else { killer.AddToBackpack(scroll); } } // Justice reward PlayerMobile pm = (PlayerMobile)killer; for (int j = 0; j < pm.JusticeProtectors.Count; ++j) { Mobile prot = (Mobile)pm.JusticeProtectors[j]; if (prot.Map != killer.Map || prot.Kills >= 5 || prot.Criminal || !JusticeVirtue.CheckMapRegion(killer, prot)) { continue; } int chance = 0; switch (VirtueHelper.GetLevel(prot, VirtueName.Justice)) { case VirtueLevel.Seeker: chance = 60; break; case VirtueLevel.Follower: chance = 80; break; case VirtueLevel.Knight: chance = 100; break; } if (chance > Utility.Random(100)) { try { prot.SendLocalizedMessage(1049368); // You have been rewarded for your dedication to Justice! SpecialScroll scrollDupe = Activator.CreateInstance(scroll.GetType()) as SpecialScroll; if (scrollDupe != null) { scrollDupe.Skill = scroll.Skill; scrollDupe.Value = scroll.Value; prot.AddToBackpack(scrollDupe); } } catch {} } } }
public void GivePowerScrolls() { if (Map != Map.Felucca) { return; } List <Mobile> toGive = new List <Mobile>(); List <DamageStore> rights = BaseCreature.GetLootingRights(this.DamageEntries, this.HitsMax); for (int i = rights.Count - 1; i >= 0; --i) { DamageStore ds = rights[i]; if (ds.m_HasRight) { toGive.Add(ds.m_Mobile); } } if (toGive.Count == 0) { return; } for (int i = 0; i < toGive.Count; i++) { Mobile m = toGive[i]; if (!(m is PlayerMobile)) { continue; } bool gainedPath = false; int pointsToGain = 800; if (VirtueHelper.Award(m, VirtueName.Valor, pointsToGain, ref gainedPath)) { if (gainedPath) { m.SendLocalizedMessage(1054032); // You have gained a path in Valor! } else { m.SendLocalizedMessage(1054030); // You have gained in Valor! } //No delay on Valor gains } } // Randomize for (int i = 0; i < toGive.Count; ++i) { int rand = Utility.Random(toGive.Count); Mobile hold = toGive[i]; toGive[i] = toGive[rand]; toGive[rand] = hold; } for (int i = 0; i < 6; ++i) { Mobile m = toGive[i % toGive.Count]; PowerScroll ps = CreateRandomPowerScroll(); GivePowerScrollTo(m, ps); } }
public override void OnResponse(GameClient state, RelayInfo info) { Mobile from = state.Mobile; from.CloseGump(typeof(ResurrectGump)); if (info.ButtonID == 2) { if (from.Map == null || !from.Map.CanFit(from.Location, 16, false, false)) { from.SendLocalizedMessage(502391); // Thou can not be resurrected there! return; } if (m_Price > 0) { if (info.IsSwitched(1)) { if (Banker.Withdraw(from, m_Price)) { from.SendLocalizedMessage(1060398, m_Price.ToString()); // ~1_AMOUNT~ gold has been withdrawn from your bank box. from.SendLocalizedMessage(1060022, Banker.GetBalance(from).ToString()); // You have ~1_AMOUNT~ gold in cash remaining in your bank box. } else { from.SendLocalizedMessage(1060020); // Unfortunately, you do not have enough cash in your bank to cover the cost of the healing. return; } } else { from.SendLocalizedMessage(1060019); // You decide against paying the healer, and thus remain dead. return; } } from.PlaySound(0x214); from.Resurrect(m_Healer); if (from is PlayerMobile) { ((PlayerMobile)from).CheckKRStartingQuestStep(26); } if (m_Healer != null && from != m_Healer) { VirtueLevel level = VirtueHelper.GetLevel(m_Healer, VirtueName.Compassion); switch (level) { case VirtueLevel.Seeker: from.Hits = AOS.Scale(from.HitsMax, 20); break; case VirtueLevel.Follower: from.Hits = AOS.Scale(from.HitsMax, 40); break; case VirtueLevel.Knight: from.Hits = AOS.Scale(from.HitsMax, 80); break; } } if (m_FromSacrifice && from is PlayerMobile) { ((PlayerMobile)from).AvailableResurrects -= 1; Container pack = from.Backpack; Container corpse = from.Corpse; if (pack != null && corpse != null) { ArrayList items = new ArrayList(corpse.Items); for (int i = 0; i < items.Count; ++i) { Item item = (Item)items[i]; if (item.Movable && item.LootType != LootType.Cursed) { pack.DropItem(item); } } } } if (from.Fame > 0) { int amount = from.Fame / 10; Misc.Titles.AwardFame(from, -amount, true); } } }
public virtual void GivePowerScrollTo(Mobile m, Item item) { if (m == null) //sanity { return; } if (m.Alive) { m.AddToBackpack(item); } else { if (m.Corpse != null && !m.Corpse.Deleted) { m.Corpse.DropItem(item); } else { m.AddToBackpack(item); } } if (item is PowerScroll && m is PlayerMobile) { PlayerMobile pm = (PlayerMobile)m; for (int j = 0; j < pm.JusticeProtectors.Count; ++j) { Mobile prot = pm.JusticeProtectors[j]; if (prot.Map != m.Map || prot.Murderer || prot.Criminal || !JusticeVirtue.CheckMapRegion(m, prot) || !prot.InRange(this, 100)) { continue; } int chance = 0; switch (VirtueHelper.GetLevel(prot, VirtueName.Justice)) { case VirtueLevel.Seeker: chance = 60; break; case VirtueLevel.Follower: chance = 80; break; case VirtueLevel.Knight: chance = 100; break; } if (chance > Utility.Random(100)) { var powerScroll = CreateRandomPowerScroll(); prot.SendLocalizedMessage(1049368); // You have been rewarded for your dedication to Justice! if (prot.Alive) { prot.AddToBackpack(powerScroll); } else { if (prot.Corpse != null && !prot.Corpse.Deleted) { prot.Corpse.DropItem(powerScroll); } else { prot.AddToBackpack(powerScroll); } } } } } }
public virtual void GivePowerScrolls() { if (Map == null || (RestrictedToFelucca && Map.Rules != MapRules.FeluccaRules)) { return; } List <Mobile> toGive = new List <Mobile>(); List <DamageStore> rights = GetLootingRights(); for (int i = rights.Count - 1; i >= 0; --i) { DamageStore ds = rights[i]; if (ds.m_HasRight && InRange(ds.m_Mobile, 100) && ds.m_Mobile.Map == Map) { toGive.Add(ds.m_Mobile); } } if (toGive.Count == 0) { return; } for (int i = 0; i < toGive.Count; i++) { Mobile m = toGive[i]; if (!(m is PlayerMobile)) { continue; } bool gainedPath = false; int pointsToGain = 800; if (VirtueHelper.Award(m, VirtueName.Valor, pointsToGain, ref gainedPath)) { if (gainedPath) { m.SendLocalizedMessage(1054032); // You have gained a path in Valor! } else { m.SendLocalizedMessage(1054030); // You have gained in Valor! } //No delay on Valor gains } } // Randomize - PowerScrolls for (int i = 0; i < toGive.Count; ++i) { int rand = Utility.Random(toGive.Count); Mobile hold = toGive[i]; toGive[i] = toGive[rand]; toGive[rand] = hold; } for (int i = 0; i < PowerScrollAmount; ++i) { Mobile m = toGive[i % toGive.Count]; var ps = CreateRandomPowerScroll(); GiveItemMessage(m, ps); GivePowerScrollTo(m, ps); } // Randomize - Primers for (int i = 0; i < toGive.Count; ++i) { int rand = Utility.Random(toGive.Count); Mobile hold = toGive[i]; toGive[i] = toGive[rand]; toGive[rand] = hold; } for (int i = 0; i < PowerScrollAmount; ++i) { Mobile m = toGive[i % toGive.Count]; SkillMasteryPrimer p = CreateRandomPrimer(); GiveItemMessage(m, p); GivePowerScrollTo(m, p); } ColUtility.Free(toGive); }
public override void OnResponse(NetState state, RelayInfo info) { Mobile from = state.Mobile; from.CantWalk = false; from.CloseGump(typeof(ResurrectGump)); if (info.ButtonID == 1 || info.ButtonID == 2) { if (from.Map == null || !from.Map.CanFit(from.Location, 16, false, false)) { from.SendLocalizedMessage(502391); // Thou can not be resurrected there! return; } if (m_Healer != null && (m_Healer is BaseHealer) && !from.InRange(m_Healer.Location, 5)) { from.SendMessage("You've strayed too far from the healer!"); return; } if (m_Price > 0) { if (info.IsSwitched(1)) { if (Banker.Withdraw(from, m_Price)) { from.SendLocalizedMessage(1060398, m_Price.ToString()); // ~1_AMOUNT~ gold has been withdrawn from your bank box. from.SendLocalizedMessage(1060022, Banker.GetBalance(from).ToString()); // You have ~1_AMOUNT~ gold in cash remaining in your bank box. } else { from.SendLocalizedMessage(1060020); // Unfortunately, you do not have enough cash in your bank to cover the cost of the healing. return; } } else { from.SendLocalizedMessage(1060019); // You decide against paying the healer, and thus remain dead. return; } } from.PlaySound(0x214); from.FixedEffect(0x376A, 10, 16); from.Resurrect(); TAVUtilities.FindCorpse(from); if (m_Healer != null && from != m_Healer) { VirtueLevel level = VirtueHelper.GetLevel(m_Healer, VirtueName.Compassion); switch (level) { case VirtueLevel.Seeker: from.Hits = AOS.Scale(from.HitsMax, 20); break; case VirtueLevel.Follower: from.Hits = AOS.Scale(from.HitsMax, 40); break; case VirtueLevel.Knight: from.Hits = AOS.Scale(from.HitsMax, 80); break; } Misc.Titles.AwardFame(m_Healer, 2500, true); } Mobile m = from; Misc.Titles.AwardFame(from, -100, true); // TODO: Proper fame loss /* * if ( !Core.AOS && from.ShortTermMurders >= 5 ) * { * double loss = (100.0 - ( 4.0 + (from.ShortTermMurders/5.0))) / 100.0;//5 to 15% loss * if ( loss < 0.85 ) * loss = 0.85; * else if ( loss > 0.95 ) * loss = 0.95; * * if ( from.RawStr * loss > 10 ) * from.RawStr = (int)(from.RawStr * loss); * if ( from.RawInt * loss > 10 ) * from.RawInt = (int)(from.RawInt * loss); * if ( from.RawDex * loss > 10 ) * from.RawDex = (int)(from.RawDex * loss); * * for (int s=0;s<from.Skills.Length;s++) * { * if ( from.Skills[s].Base * loss > 35 ) * from.Skills[s].Base *= loss; * } * } */ } }
public void GiveClothingBlessDeed() { if (Map != Map.Felucca) { return; } ArrayList toGive = new ArrayList(); ArrayList rights = BaseCreature.GetLootingRights(this.DamageEntries, this.HitsMax); for (int i = rights.Count - 1; i >= 0; --i) { DamageStore ds = (DamageStore)rights[i]; if (ds.m_HasRight) { toGive.Add(ds.m_Mobile); } } if (toGive.Count == 0) { return; } // Randomize for (int i = 0; i < toGive.Count; ++i) { int rand = Utility.Random(toGive.Count); object hold = toGive[i]; toGive[i] = toGive[rand]; toGive[rand] = hold; } for (int i = 0; i < 6; ++i) { Mobile m = (Mobile)toGive[i % toGive.Count]; ClothingBlessDeed cbd = new ClothingBlessDeed(); m.SendMessage("You have received a Clothing Bless Deed!"); // You have received a Clothing Bless Deed! m.AddToBackpack(cbd); if (m is PlayerMobile) { PlayerMobile pm = (PlayerMobile)m; for (int j = 0; j < pm.JusticeProtectors.Count; ++j) { Mobile prot = (Mobile)pm.JusticeProtectors[j]; if (prot.Map != m.Map || prot.Kills >= 5 || prot.Criminal || !JusticeVirtue.CheckMapRegion(m, prot)) { continue; } int chance = 0; switch (VirtueHelper.GetLevel(prot, VirtueName.Justice)) { case VirtueLevel.Seeker: chance = 60; break; case VirtueLevel.Follower: chance = 80; break; case VirtueLevel.Knight: chance = 100; break; } if (chance > Utility.Random(100)) { prot.SendLocalizedMessage(1049368); // You have been rewarded for your dedication to Justice! prot.AddToBackpack(new ClothingBlessDeed()); } } } } }
public override void OnResponse(NetState state, RelayInfo info) { Mobile from = state.Mobile; from.CloseGump(typeof(ResurrectGump)); if (ResurrectMessage.SilverSapling == this.m_Msg && 1 == info.ButtonID) { PlayerMobile pm = from as PlayerMobile; if (null != pm && pm.Region.IsPartOf("Abyss")) { pm.Location = pm.SSSeedLocation; pm.Map = pm.SSSeedMap; if (null != pm.Corpse) { pm.Corpse.Location = pm.Location; pm.Corpse.Map = pm.Map; } pm.Resurrect(); } return; } if (info.ButtonID == 1 || info.ButtonID == 2) { if (from.Map == null || !from.Map.CanFit(from.Location, 16, false, false)) { from.SendLocalizedMessage(502391); // Thou can not be resurrected there! return; } if (this.m_Price > 0) { if (info.IsSwitched(1)) { if (Banker.Withdraw(from, this.m_Price)) { from.SendLocalizedMessage(1060398, this.m_Price.ToString()); // ~1_AMOUNT~ gold has been withdrawn from your bank box. from.SendLocalizedMessage(1060022, Banker.GetBalance(from).ToString()); // You have ~1_AMOUNT~ gold in cash remaining in your bank box. } else { from.SendLocalizedMessage(1060020); // Unfortunately, you do not have enough cash in your bank to cover the cost of the healing. return; } } else { from.SendLocalizedMessage(1060019); // You decide against paying the healer, and thus remain dead. return; } } from.PlaySound(0x214); from.FixedEffect(0x376A, 10, 16); from.Resurrect(); if (this.m_Healer != null && from != this.m_Healer) { VirtueLevel level = VirtueHelper.GetLevel(this.m_Healer, VirtueName.Compassion); switch (level) { case VirtueLevel.Seeker: from.Hits = AOS.Scale(from.HitsMax, 20); break; case VirtueLevel.Follower: from.Hits = AOS.Scale(from.HitsMax, 40); break; case VirtueLevel.Knight: from.Hits = AOS.Scale(from.HitsMax, 80); break; } } if (this.m_FromSacrifice && from is PlayerMobile) { ((PlayerMobile)from).AvailableResurrects -= 1; Container pack = from.Backpack; Container corpse = from.Corpse; if (pack != null && corpse != null) { List <Item> items = new List <Item>(corpse.Items); for (int i = 0; i < items.Count; ++i) { Item item = items[i]; if (item.Layer != Layer.Hair && item.Layer != Layer.FacialHair && item.Movable) { pack.DropItem(item); } } } } if (from.Fame > 0) { int amount = from.Fame / 10; Misc.Titles.AwardFame(from, -amount, true); } if (!Core.AOS && from.ShortTermMurders >= 5) { double loss = (100.0 - (4.0 + (from.ShortTermMurders / 5.0))) / 100.0; // 5 to 15% loss if (loss < 0.85) { loss = 0.85; } else if (loss > 0.95) { loss = 0.95; } if (from.RawStr * loss > 10) { from.RawStr = (int)(from.RawStr * loss); } if (from.RawInt * loss > 10) { from.RawInt = (int)(from.RawInt * loss); } if (from.RawDex * loss > 10) { from.RawDex = (int)(from.RawDex * loss); } for (int s = 0; s < from.Skills.Length; s++) { if (from.Skills[s].Base * loss > 35) { from.Skills[s].Base *= loss; } } } if (from.Alive && this.m_HitsScalar > 0) { from.Hits = (int)(from.HitsMax * this.m_HitsScalar); } } }
public void GivePowerScrolls() { if (Map != Map.Felucca) { return; } var toGive = new List <Mobile>(); var rights = GetLootingRights(DamageEntries, HitsMax); for (var i = rights.Count - 1; i >= 0; --i) { var ds = rights[i]; if (ds.m_HasRight) { toGive.Add(ds.m_Mobile); } } if (toGive.Count == 0) { return; } for (var i = 0; i < toGive.Count; i++) { var m = toGive[i]; if (m is not PlayerMobile) { continue; } var gainedPath = false; var pointsToGain = 800; if (VirtueHelper.Award(m, VirtueName.Valor, pointsToGain, ref gainedPath)) { if (gainedPath) { m.SendLocalizedMessage(1054032); // You have gained a path in Valor! } else { m.SendLocalizedMessage(1054030); // You have gained in Valor! } // No delay on Valor gains } } // Randomize toGive.Shuffle(); for (var i = 0; i < 6; ++i) { var m = toGive[i % toGive.Count]; var ps = CreateRandomPowerScroll(); GivePowerScrollTo(m, ps); } }
public void OnSlice() { if (!m_Active || Deleted) { return; } if (m_Champion != null) { if (m_Champion.Deleted) { RegisterDamageTo(m_Champion); if (m_Champion is BaseChampion) { AwardArtifact(((BaseChampion)m_Champion).GetArtifact()); } m_DamageEntries.Clear(); if (m_Altar != null) { m_Altar.Hue = 0x455; if (m_Altar.Map == Map.Felucca) { new StarRoomGate(true, m_Altar.Location, m_Altar.Map); } } m_Champion = null; Stop(); m_HasBeenAdvanced = false; BeginRestart(m_RestartDelay); } else { if (m_Champion.Region != m_Region) { m_Champion.MoveToWorld(new Point3D(X, Y, Z - 15), Map); } } } else { int kills = m_Kills; for (int i = 0; i < m_Creatures.Count; ++i) { Mobile creature = m_Creatures[i]; if (creature.Deleted) { if (creature.Corpse != null && !creature.Corpse.Deleted) { ((Corpse)creature.Corpse).BeginDecay(TimeSpan.FromMinutes(1.0)); } m_Creatures.RemoveAt(i); --i; ++m_Kills; RegisterDamageTo(creature); Mobile killer = creature.FindMostRecentDamager(false); if (killer is BaseCreature) { killer = ((BaseCreature)killer).GetMaster(); } if (killer is PlayerMobile && killer.Alive && killer.Region == m_Region) { if (creature.Fame > Utility.Random(1000000)) { if (Map == Map.Felucca && Utility.RandomBool()) { PowerScroll ps = PowerScroll.CreateRandomNoCraft(5, 5); ps.LootType = LootType.Blessed; killer.SendLocalizedMessage(1049524); // You have received a scroll of power! killer.AddToBackpack(ps); } else { ScrollOfTranscendence sot; if (this.Map.Rules == MapRules.FeluccaRules) { sot = ScrollOfTranscendence.CreateRandom(6, 10); } else { sot = ScrollOfTranscendence.CreateRandom(1, 5); } killer.SendLocalizedMessage(1094936); // You have received a Scroll of Transcendence! killer.AddToBackpack(sot); } } int mobSubLevel = GetSubLevelFor(creature) + 1; if (mobSubLevel >= 0) { bool gainedPath = false; int pointsToGain = mobSubLevel * 40; if (VirtueHelper.Award(killer, VirtueName.Valor, pointsToGain, ref gainedPath)) { if (gainedPath) { killer.SendLocalizedMessage(1054032); // You have gained a path in Valor! } else { killer.SendLocalizedMessage(1054030); // You have gained in Valor! } // No delay on Valor gains } } #region Champion Monster Titles int type = -1; switch (m_Type) { case ChampionSpawnType.ColdBlood: type = 0; break; case ChampionSpawnType.ForestLord: type = 1; break; case ChampionSpawnType.Arachnid: type = 2; break; case ChampionSpawnType.Abyss: type = 3; break; case ChampionSpawnType.VerminHorde: type = 4; break; case ChampionSpawnType.UnholyTerror: type = 5; break; case ChampionSpawnType.SleepingDragon: type = 6; break; case ChampionSpawnType.Corrupt: type = 7; break; case ChampionSpawnType.Glade: type = 8; break; case ChampionSpawnType.Unliving: type = 9; break; case ChampionSpawnType.Pit: type = 10; break; } BaseCreature bc = creature as BaseCreature; if (bc != null && type != -1) { bc.CalculateTitlesScore((PlayerMobile)killer, bc.SpawnLevel, type); } #endregion } } } // Only really needed once. if (m_Kills > kills) { InvalidateProperties(); } double n = m_Kills / (double)MaxKills; int p = (int)(n * 100); if (p >= 90) { AdvanceLevel(); } else if (p > 0) { SetWhiteSkullCount(p / 20); } if (DateTime.Now >= m_ExpireTime) { Expire(); } if (DateTime.Now >= m_KickTime) { KickGhosts(); } Respawn(); } }
public static void GivePowerScrollTo(Mobile m, PowerScroll ps) { if (ps == null || m == null) // sanity { return; } m.SendLocalizedMessage(1049524); // You have received a scroll of power! if (!Core.SE || m.Alive) { m.AddToBackpack(ps); } else { if (m.Corpse?.Deleted == false) { m.Corpse.DropItem(ps); } else { m.AddToBackpack(ps); } } if (m is not PlayerMobile pm) { return; } for (var j = 0; j < pm.JusticeProtectors.Count; ++j) { var prot = pm.JusticeProtectors[j]; if (prot.Map != pm.Map || prot.Kills >= 5 || prot.Criminal || !JusticeVirtue.CheckMapRegion(pm, prot)) { continue; } var chance = VirtueHelper.GetLevel(prot, VirtueName.Justice) switch { VirtueLevel.Seeker => 60, VirtueLevel.Follower => 80, VirtueLevel.Knight => 100, _ => 0 }; if (chance > Utility.Random(100)) { var powerScroll = new PowerScroll(ps.Skill, ps.Value); prot.SendLocalizedMessage(1049368); // You have been rewarded for your dedication to Justice! if (!Core.SE || prot.Alive) { prot.AddToBackpack(powerScroll); } else { if (prot.Corpse?.Deleted == false) { prot.Corpse.DropItem(powerScroll); } else { prot.AddToBackpack(powerScroll); } } } } }
public static void GivePowerScrollTo(Mobile m, PowerScroll ps) { if (ps == null || m == null) //sanity { return; } m.SendLocalizedMessage(1049524); // You have received a scroll of power! if (!Core.SE || m.Alive) { m.AddToBackpack(ps); } else { if (m.Corpse != null && !m.Corpse.Deleted) { m.Corpse.DropItem(ps); } else { m.AddToBackpack(ps); } } if (m is PlayerMobile) { PlayerMobile pm = (PlayerMobile)m; for (int j = 0; j < pm.JusticeProtectors.Count; ++j) { Mobile prot = pm.JusticeProtectors[j]; if (prot.Map != m.Map || prot.Kills >= 5 || prot.Criminal || !JusticeVirtue.CheckMapRegion(m, prot)) { continue; } int chance = 0; switch (VirtueHelper.GetLevel(prot, VirtueName.Justice)) { case VirtueLevel.Seeker: chance = 60; break; case VirtueLevel.Follower: chance = 80; break; case VirtueLevel.Knight: chance = 100; break; } if (chance > Utility.Random(100)) { PowerScroll powerScroll = new PowerScroll(ps.Skill, ps.Value); prot.SendLocalizedMessage(1049368); // You have been rewarded for your dedication to Justice! if (!Core.SE || prot.Alive) { prot.AddToBackpack(powerScroll); } else { if (prot.Corpse != null && !prot.Corpse.Deleted) { prot.Corpse.DropItem(powerScroll); } else { prot.AddToBackpack(powerScroll); } } } } } }
public void GivePowerScrolls() { //if ( Map != Map.Felucca ) //return; ArrayList toGive = new ArrayList(); //ArrayList arraylist = Aggressors; for (int i = 0; i < /*Attacker.*/ Aggressors.Count; ++i) //for ( int i = 0; i < arraylist.Count; ++i ) { AggressorInfo info = (AggressorInfo)/*Attacker.*/ Aggressors[i]; //AggressorInfo info = (AggressorInfo)arraylist[i]; if (info.Attacker.Player && info.Attacker.Alive && (DateTime.Now - info.LastCombatTime) < TimeSpan.FromSeconds(30.0) && !toGive.Contains(info.Attacker)) { toGive.Add(info.Attacker); } } //arraylist = Aggressed; for (int i = 0; i < /*owner.*/ Aggressors.Count; ++i) //for ( int i = 0; i < arraylist.Count; ++i ) { //AggressorInfo info = (AggressorInfo)arraylist[i]; AggressorInfo info = (AggressorInfo)/*Defender.*/ Aggressors[i]; if (info.Defender.Player && info.Defender.Alive && (DateTime.Now - info.LastCombatTime) < TimeSpan.FromSeconds(30.0) && !toGive.Contains(info.Defender)) { toGive.Add(info.Defender); } } if (toGive.Count == 0) { return; } // Randomize for (int i = 0; i < toGive.Count; ++i) { int rand = Utility.Random(toGive.Count); object hold = toGive[i]; toGive[i] = toGive[rand]; toGive[rand] = hold; } for (int i = 0; i < 3; ++i) { int level; double random = Utility.RandomDouble(); if (0.1 >= random) { level = 20; } else if (0.4 >= random) { level = 15; } else { level = 10; } Mobile m = (Mobile)toGive[i % toGive.Count]; PowerScroll ps = PowerScroll.CreateRandomNoCraft(level, level); m.SendLocalizedMessage(1049524); // You have received a scroll of power! m.AddToBackpack(ps); if (m is PlayerMobile) { PlayerMobile pm = (PlayerMobile)m; for (int j = 0; j < pm.JusticeProtectors.Count; ++j) { Mobile prot = (Mobile)pm.JusticeProtectors[j]; if (prot.Map != m.Map || prot.Kills >= 5 || prot.Criminal) { continue; } int chance = 0; switch (VirtueHelper.GetLevel(prot, VirtueName.Justice)) { case VirtueLevel.Seeker: chance = 60; break; case VirtueLevel.Follower: chance = 80; break; case VirtueLevel.Knight: chance = 100; break; } if (chance > Utility.Random(100)) { prot.SendLocalizedMessage(1049368); // You have been rewarded for your dedication to Justice! prot.AddToBackpack(new PowerScroll(ps.Skill, ps.Value)); } } } } }
public void OnSlice() { if (!m_Active || Deleted) { return; } if (m_Champion != null) { if (m_Champion.Deleted) { RegisterDamageTo(m_Champion); if (m_Champion is BaseChampion) { AwardArtifact(((BaseChampion)m_Champion).GetArtifact()); } m_DamageEntries.Clear(); if (m_Platform != null) { m_Platform.Hue = 0x497; } if (m_Altar != null) { m_Altar.Hue = 0; if (!Core.ML || Map == Map.Felucca) { new StarRoomGate(true, m_Altar.Location, m_Altar.Map); } } m_Champion = null; Stop(); BeginRestart(m_RestartDelay); } } else { int kills = m_Kills; for (int i = 0; i < m_Creatures.Count; ++i) { Mobile m = m_Creatures[i]; if (m.Deleted) { if (m.Corpse != null && !m.Corpse.Deleted) { ((Corpse)m.Corpse).BeginDecay(TimeSpan.FromMinutes(1)); } m_Creatures.RemoveAt(i); --i; ++m_Kills; Mobile killer = m.FindMostRecentDamager(false); RegisterDamageTo(m); if (killer is BaseCreature) { killer = ((BaseCreature)killer).GetMaster(); } if (killer is PlayerMobile) { #region Scroll of Transcendence if (Core.ML) { if (Map == Map.Felucca) { if (Utility.RandomDouble() < 0.001) { PlayerMobile pm = (PlayerMobile)killer; double random = Utility.Random(49); if (random <= 24) { ScrollofTranscendence SoTF = CreateRandomSoT(true); GiveScrollTo(pm, (SpecialScroll)SoTF); } else { PowerScroll PS = PowerScroll.CreateRandomNoCraft(5, 5); GiveScrollTo(pm, (SpecialScroll)PS); } } } if (Map == Map.Ilshenar || Map == Map.Tokuno || Map == Map.Malas) { if (Utility.RandomDouble() < 0.0015) { killer.SendLocalizedMessage(1094936); // You have received a Scroll of Transcendence! ScrollofTranscendence SoTT = CreateRandomSoT(false); killer.AddToBackpack(SoTT); } } } #endregion int mobSubLevel = GetSubLevelFor(m) + 1; if (mobSubLevel >= 0) { bool gainedPath = false; int pointsToGain = mobSubLevel * 40; if (VirtueHelper.Award(killer, VirtueName.Valor, pointsToGain, ref gainedPath)) { if (gainedPath) { m.SendLocalizedMessage(1054032); // You have gained a path in Valor! } else { m.SendLocalizedMessage(1054030); // You have gained in Valor! } //No delay on Valor gains } PlayerMobile.ChampionTitleInfo info = ((PlayerMobile)killer).ChampionTitles; info.Award(m_Type, mobSubLevel); } } } } // Only really needed once. if (m_Kills > kills) { InvalidateProperties(); } double n = m_Kills / (double)MaxKills; int p = (int)(n * 100); if (p >= 90) { AdvanceLevel(); } else if (p > 0) { SetWhiteSkullCount(p / 20); } if (DateTime.UtcNow >= m_ExpireTime) { Expire(); } Respawn(); } }
public void GivePowerScrolls(ArrayList toGive) { if (NoKillAwards) { return; } if (Map != Map.Felucca) { return; } for (int i = 0; i < toGive.Count; i++) { Mobile m = (Mobile)toGive[i]; if (!m.Alive && m.Corpse == null) { toGive.Remove(m); } } for (int i = 0; i < 6; ++i) { int level; double random = Utility.RandomDouble(); if (0.1 >= random) { level = 20; } else if (0.4 >= random) { level = 15; } else { level = 10; } Mobile m = (Mobile)toGive[i % toGive.Count]; PowerScroll ps = PowerScroll.CreateRandomNoCraft(level, level); if (m.AccessLevel > AccessLevel.Player) { ps.Cheater_Name = String.Format("This item received by GM {0}", m.Name); } m.SendLocalizedMessage(1049524); // You have received a scroll of power! if (m.Alive) { m.AddToBackpack(ps); } else { Container corpse = m.Corpse; if (corpse != null) { corpse.DropItem(ps); } } if (m is PlayerMobile) { PlayerMobile pm = (PlayerMobile)m; for (int j = 0; j < pm.JusticeProtectors.Count; ++j) { Mobile prot = (Mobile)pm.JusticeProtectors[j]; if (prot.Map != m.Map || prot.Kills >= 5 || prot.Criminal || !JusticeVirtue.CheckMapRegion(m, prot)) { continue; } int chance = 0; switch (VirtueHelper.GetLevel(prot, VirtueName.Justice)) { case VirtueLevel.Seeker: chance = 60; break; case VirtueLevel.Follower: chance = 80; break; case VirtueLevel.Knight: chance = 100; break; } if (chance > Utility.Random(100)) { PowerScroll pps = PowerScroll.CreateRandomNoCraft(level, level); prot.SendLocalizedMessage(1049368); // You have been rewarded for your dedication to Justice! prot.AddToBackpack(pps); } } } } }
public void OnSlice() { if (!m_Active || Deleted) { return; } if (m_Champion != null) { if (m_Champion.Deleted) { if (m_Platform != null) { m_Platform.Hue = 0x497; } if (m_Altar != null) { m_Altar.Hue = 0; new StarRoomGate(true, m_Altar.Location, m_Altar.Map); } m_Champion = null; Stop(); BeginRestart(m_RestartDelay); } } else { int kills = m_Kills; for (int i = 0; i < m_Creatures.Count; ++i) { Mobile m = m_Creatures[i]; if (m.Deleted) { m_Creatures.RemoveAt(i); --i; ++m_Kills; Mobile killer = m.FindMostRecentDamager(false); if (killer is BaseCreature) { killer = ((BaseCreature)killer).GetMaster(); } if (killer is PlayerMobile) { int mobSubLevel = GetSubLevelFor(m) + 1; if (mobSubLevel >= 0) { bool gainedPath = false; int pointsToGain = mobSubLevel * 40; if (VirtueHelper.Award(killer, VirtueName.Valor, pointsToGain, ref gainedPath)) { if (gainedPath) { m.SendLocalizedMessage(1054032); // You have gained a path in Valor! } else { m.SendLocalizedMessage(1054030); // You have gained in Valor! } //No delay on Valor gains } PlayerMobile.ChampionTitleInfo info = ((PlayerMobile)killer).ChampionTitles; info.Award(m_Type, mobSubLevel); } } } } // Only really needed once. if (m_Kills > kills) { InvalidateProperties(); } double n = m_Kills / (double)MaxKills; int p = (int)(n * 100); if (p >= 90) { AdvanceLevel(); } else if (p > 0) { SetWhiteSkullCount(p / 20); } if (DateTime.Now >= m_ExpireTime) { Expire(); } Respawn(); } }
public override bool CheckAtDestination() { EDI dest = GetDestination(); if (dest == null) { return(false); } Mobile escorter = GetEscorter(); if (escorter == null) { return(false); } if (dest.Contains(Location)) { Say("You have brought me home, I thank thee mortal and I hope this token of my appreciation helps you, now farewell!", escorter.Name); // not going anywhere Destination = null; //DestinationString = null; escorter.AddToBackpack(new SpiritGem()); StopFollow(); SetControlMaster(null); EscortTable.Remove(escorter); BeginDelete(); Misc.Titles.AwardFame(escorter, 10, true); bool gainedPath = false; PlayerMobile pm = escorter as PlayerMobile; if (pm != null) { if (pm.CompassionGains > 0 && DateTime.Now > pm.NextCompassionDay) { pm.NextCompassionDay = DateTime.MinValue; pm.CompassionGains = 0; } if (pm.CompassionGains >= 5) // have already gained 5 points in one day, can gain no more { pm.SendLocalizedMessage(1053004); // You must wait about a day before you can gain in compassion again. } else if (VirtueHelper.Award(pm, VirtueName.Compassion, 1, ref gainedPath)) { if (gainedPath) { pm.SendLocalizedMessage(1053005); // You have achieved a path in compassion! } else { pm.SendLocalizedMessage(1053002); // You have gained in compassion. } pm.NextCompassionDay = DateTime.Now + TimeSpan.FromDays(1.0); // in one day CompassionGains gets reset to 0 ++pm.CompassionGains; } else { pm.SendLocalizedMessage(1053003); // You have achieved the highest path of compassion and can no longer gain any further. } } return(true); } return(false); }
public override void OnTalk(PlayerMobile player, bool contextMenu) { this.Direction = this.GetDirectionTo(player); QuestSystem qs = player.Quest; if (qs is WitchApprenticeQuest) { if (qs.IsObjectiveInProgress(typeof(FindApprenticeObjective))) { this.PlaySound(0x259); this.PlaySound(0x206); qs.AddConversation(new HagDuringCorpseSearchConversation()); } else { QuestObjective obj = qs.FindObjective(typeof(FindGrizeldaAboutMurderObjective)); if (obj != null && !obj.Completed) { this.PlaySound(0x420); this.PlaySound(0x20); obj.Complete(); } else if (qs.IsObjectiveInProgress(typeof(KillImpsObjective)) || qs.IsObjectiveInProgress(typeof(FindZeefzorpulObjective))) { this.PlaySound(0x259); this.PlaySound(0x206); qs.AddConversation(new HagDuringImpSearchConversation()); } else { obj = qs.FindObjective(typeof(ReturnRecipeObjective)); if (obj != null && !obj.Completed) { this.PlaySound(0x258); this.PlaySound(0x41B); obj.Complete(); } else if (qs.IsObjectiveInProgress(typeof(FindIngredientObjective))) { this.PlaySound(0x259); this.PlaySound(0x206); qs.AddConversation(new HagDuringIngredientsConversation()); } else { obj = qs.FindObjective(typeof(ReturnIngredientsObjective)); if (obj != null && !obj.Completed) { Container cont = GetNewContainer(); cont.DropItem(new BlackPearl(30)); cont.DropItem(new Bloodmoss(30)); cont.DropItem(new Garlic(30)); cont.DropItem(new Ginseng(30)); cont.DropItem(new MandrakeRoot(30)); cont.DropItem(new Nightshade(30)); cont.DropItem(new SulfurousAsh(30)); cont.DropItem(new SpidersSilk(30)); cont.DropItem(new Cauldron()); cont.DropItem(new MoonfireBrew()); cont.DropItem(new TreasureMap(Utility.RandomMinMax(1, 4), this.Map)); cont.DropItem(new Gold(2000, 2200)); if (Utility.RandomBool()) { BaseWeapon weapon = Loot.RandomWeapon(); if (Core.AOS) { BaseRunicTool.ApplyAttributesTo(weapon, 2, 20, 30); } else { weapon.DamageLevel = (WeaponDamageLevel)BaseCreature.RandomMinMaxScaled(2, 3); weapon.AccuracyLevel = (WeaponAccuracyLevel)BaseCreature.RandomMinMaxScaled(2, 3); weapon.DurabilityLevel = (WeaponDurabilityLevel)BaseCreature.RandomMinMaxScaled(2, 3); } cont.DropItem(weapon); } else { Item item; if (Core.AOS) { item = Loot.RandomArmorOrShieldOrJewelry(); if (item is BaseArmor) { BaseRunicTool.ApplyAttributesTo((BaseArmor)item, 2, 20, 30); } else if (item is BaseJewel) { BaseRunicTool.ApplyAttributesTo((BaseJewel)item, 2, 20, 30); } } else { BaseArmor armor = Loot.RandomArmorOrShield(); item = armor; armor.ProtectionLevel = (ArmorProtectionLevel)BaseCreature.RandomMinMaxScaled(2, 3); armor.Durability = (ArmorDurabilityLevel)BaseCreature.RandomMinMaxScaled(2, 3); } cont.DropItem(item); } if (player.BAC > 0) { cont.DropItem(new HangoverCure()); } if (player.PlaceInBackpack(cont)) { bool gainedPath = false; if (VirtueHelper.Award(player, VirtueName.Sacrifice, 250, ref gainedPath)) // TODO: Check amount on OSI. { player.SendLocalizedMessage(1054160); // You have gained in sacrifice. } this.PlaySound(0x253); this.PlaySound(0x20); obj.Complete(); } else { cont.Delete(); player.SendLocalizedMessage(1046260); // You need to clear some space in your inventory to continue with the quest. Come back here when you have more space in your inventory. } } } } } } else { QuestSystem newQuest = new WitchApprenticeQuest(player); bool inRestartPeriod = false; if (qs != null) { newQuest.AddConversation(new DontOfferConversation()); } else if (QuestSystem.CanOfferQuest(player, typeof(WitchApprenticeQuest), out inRestartPeriod)) { this.PlaySound(0x20); this.PlaySound(0x206); newQuest.SendOffer(); } else if (inRestartPeriod) { this.PlaySound(0x259); this.PlaySound(0x206); newQuest.AddConversation(new RecentlyFinishedConversation()); } } }
public void GivePowerScrolls() { var toGive = new List <Mobile>(); var rights = GetLootingRights(DamageEntries, HitsMax); for (var i = rights.Count - 1; i >= 0; --i) { var ds = rights[i]; if (ds.m_HasRight) { toGive.Add(ds.m_Mobile); } } if (toGive.Count == 0) { return; } toGive.Shuffle(); for (var i = 0; i < 16; ++i) { int level; var random = Utility.RandomDouble(); if (random <= 0.1) { level = 25; } else if (random <= 0.25) { level = 20; } else if (random <= 0.45) { level = 15; } else if (random <= 0.70) { level = 10; } else { level = 5; } var m = toGive[i % toGive.Count]; m.SendLocalizedMessage(1049524); // You have received a scroll of power! m.AddToBackpack(new StatCapScroll(225 + level)); if (m is PlayerMobile pm) { for (var j = 0; j < pm.JusticeProtectors.Count; ++j) { var prot = pm.JusticeProtectors[j]; if (prot.Map != pm.Map || prot.Kills >= 5 || prot.Criminal || !JusticeVirtue.CheckMapRegion(pm, prot)) { continue; } var chance = VirtueHelper.GetLevel(prot, VirtueName.Justice) switch { VirtueLevel.Seeker => 60, VirtueLevel.Follower => 80, VirtueLevel.Knight => 100, _ => 0 }; if (chance > Utility.Random(100)) { prot.SendLocalizedMessage(1049368); // You have been rewarded for your dedication to Justice! prot.AddToBackpack(new StatCapScroll(225 + level)); } } } } }
public virtual bool CheckAtDestination() { if (m_Quest != null) { EscortObjective escort = GetObjective(); if (escort == null) { return(false); } Mobile escorter = GetEscorter(); if (escorter == null) { return(false); } if (escort.Region != null && escort.Region.Contains(Location)) { Say(1042809, escorter.Name); // We have arrived! I thank thee, ~1_PLAYER_NAME~! I have no further need of thy services. Here is thy pay. escort.Complete(); if (m_Quest.Completed) { escorter.SendLocalizedMessage(1046258, null, 0x23); // Your quest is complete. if (QuestHelper.AnyRewards(m_Quest)) { escorter.SendGump(new MondainQuestGump(m_Quest, MondainQuestGump.Section.Rewards, false, true)); } else { m_Quest.GiveRewards(); } escorter.PlaySound(m_Quest.CompleteSound); StopFollow(); m_EscortTable.Remove(escorter); m_DeleteTimer = Timer.DelayCall(TimeSpan.FromSeconds(5.0), new TimerCallback(Delete)); // fame Misc.Titles.AwardFame(escorter, escort.Fame, true); // compassion bool gainedPath = false; PlayerMobile pm = escorter as PlayerMobile; if (pm != null) { if (pm.CompassionGains > 0 && DateTime.Now > pm.NextCompassionDay) { pm.NextCompassionDay = DateTime.MinValue; pm.CompassionGains = 0; } if (pm.CompassionGains >= 5) // have already gained 5 times in one day, can gain no more { pm.SendLocalizedMessage(1053004); // You must wait about a day before you can gain in compassion again. } else if (VirtueHelper.Award(pm, VirtueName.Compassion, escort.Compassion, ref gainedPath)) { pm.SendLocalizedMessage(1074949, null, 0x2A); // You have demonstrated your compassion! Your kind actions have been noted. if (gainedPath) { pm.SendLocalizedMessage(1053005); // You have achieved a path in compassion! } else { pm.SendLocalizedMessage(1053002); // You have gained in compassion. } pm.NextCompassionDay = DateTime.Now + TimeSpan.FromDays(1.0); // in one day CompassionGains gets reset to 0 ++pm.CompassionGains; } else { pm.SendLocalizedMessage(1053003); // You have achieved the highest path of compassion and can no longer gain any further. } } } else { escorter.PlaySound(m_Quest.UpdateSound); } return(true); } } else if (!m_Checked) { Region region = GetDestination(); if (region != null && region.Contains(Location)) { m_DeleteTimer = Timer.DelayCall(TimeSpan.FromSeconds(5.0), new TimerCallback(Delete)); m_Checked = true; } } return(false); }
static void Main(string[] args) { ObjectOptions.ToolTipDelay = 500; Self.Backpack.DoubleClick(); Stealth.Client.Wait(1000); Stealth.Client.AddItemToContainer += OnAdd; Stealth.Client.ClilocSpeech += OnClilocSpeech; Stealth.Client.Speech += OnSpeech; ConsoleMessage("Target loot bag"); LootBag = RequestTarget(); LootBag.DoubleClick(); Stealth.Client.Wait(1000); List <Item> _backpackItems = new List <Item>(); List <uint> _findList = new List <uint>(); Stealth.Client.FindTypeEx(0xFFFF, 0xFFFF, Self.Backpack.Serial.Value, true); if (!(Stealth.Client.GetFindCount() == 0)) { _findList = Stealth.Client.GetFindList(); } foreach (uint _item in _findList) { Stealth.Client.Ignore(_item); Scanner.Ignore(_item); } ConsoleMessage("starting loot routine...", ConsoleColor.DarkYellow); Looting = true; LootingItems = false; Scanner.Initialize(); Scanner.Range = 5; Scanner.VerticalRange = 5; Stealth.Client.SetFindDistance(5); Stealth.Client.SetFindVertical(5); Stealth.Client.SetMoveThroughNPC(0); var _virtuehelper = VirtueHelper.GetVirtues(); var _targethelper = TargetHelper.GetTarget(); while (Stealth.Client.GetConnectedStatus()) { try { #region Combat Stealth.Client.ClearBadLocationList(); var _monster = Item.Find(typeof(FanDancer), 0x0, false).OrderBy(x => x.Distance).ToList(); //ConsoleMessage("{0},{1}", Self.Location.X, Self.Location.Y); _virtuehelper.Request(); /* * If current target is dead, find a new target * if new target is 100% hp, honor target * else follow current target until it's dead if we're not looting * */ if (CurrentTarget == null || CurrentTarget.Dead || !CurrentTarget.Valid) { if (_monster.Any()) { CurrentTarget = _monster.First().Cast <Mobile>(); ConsoleMessage("Current target set to: {0}", ConsoleColor.Magenta, CurrentTarget.Serial.Value.ToString()); Stealth.Client.UseVirtue(Virtue.Honor); Stealth.Client.WaitTargetObject(CurrentTarget.Serial.Value); Self.Attack(CurrentTarget.Serial); } } //entrance room /*if (((ushort)CurrentTarget.Location.X >= 79 && (ushort)CurrentTarget.Location.X <= 97) * && ((ushort)CurrentTarget.Location.Y >= 326 && (ushort)CurrentTarget.Location.Y <= 344))*/ //bloody room /*if (((ushort)CurrentTarget.Location.X >= 104 && (ushort)CurrentTarget.Location.X <= 115) * && ((ushort)CurrentTarget.Location.Y >= 640 && (ushort)CurrentTarget.Location.Y <= 660))*/ if (((ushort)CurrentTarget.Location.X >= 79 && (ushort)CurrentTarget.Location.X <= 97) && ((ushort)CurrentTarget.Location.Y >= 326 && (ushort)CurrentTarget.Location.Y <= 344)) { Self.Movement.newMoveXY((ushort)CurrentTarget.Location.X, (ushort)CurrentTarget.Location.Y, true, 0, true); Self.Attack(CurrentTarget.Serial); } /* For leafblade * if (Self.Mana > 35 && Self.HealthPercent > 70) * Self.UseSecondaryAbility(); * else if (Self.Mana > 35 && Self.HealthPercent < 70) * Self.UsePrimaryAbility(); */ if (Self.Mana > 35) { Self.UsePrimaryAbility(); } //if (Self.HealthPercent < 50) //Self.Cast("Evasion"); //if (Self.HealthPercent < 80 && !Confidence) //Self.Cast("Confidence"); #endregion #region Loot var _corpses = Item.Find(typeof(Corpse), 0x0, false).OrderBy(x => x.Distance).ToList(); if (_corpses.Count > 0) { foreach (Corpse _corpse in _corpses) { if (_corpse.Distance < 3) { LootCorpse(_corpse); Scanner.Ignore(_corpse.Serial); } else {/* * if (((ushort)_corpse.Location.X >= 79 && (ushort)_corpse.Location.X <= 97) * && ((ushort)_corpse.Location.Y >= 326 && (ushort)_corpse.Location.Y <= 344))*/ //Bloody room /*if (((ushort)_corpse.Location.X >= 104 && (ushort)_corpse.Location.X <= 115) * && ((ushort)_corpse.Location.Y >= 640 && (ushort)_corpse.Location.Y <= 660))*/ if (((ushort)_corpse.Location.X >= 79 && (ushort)_corpse.Location.X <= 97) && ((ushort)_corpse.Location.Y >= 326 && (ushort)_corpse.Location.Y <= 344)) { Self.Movement.MoveXYZ((ushort)_corpse.Location.X, (ushort)_corpse.Location.Y, (sbyte)_corpse.Location.Z, 1, 1, true); LootCorpse(_corpse); Scanner.Ignore(_corpse.Serial); } } } } #endregion Thread.Sleep(2000); } catch (Exception ex) { ConsoleMessage("Error in main routine: {0}", ex.StackTrace); } } }