public static double GetPoints(Item item) { if (item is IVvVItem && ((IVvVItem)item).IsVvVItem) { return(0); } double points = 0; Type type = item.GetType(); if (Entries.ContainsKey(type)) { points = Entries[type]; // Kind of ametuar, but if this arrizes more, we'll make a seperate function if (item is SOS && ((SOS)item).IsAncient) { points = 2500; } if (item.Stackable) { points = points * item.Amount; } return(points); } else { if (item is RunicHammer) { RunicHammer hammer = (RunicHammer)item; if (hammer.Resource == CraftResource.DullCopper) { points = 5 * hammer.UsesRemaining; } else if (hammer.Resource == CraftResource.ShadowIron) { points = 10 * hammer.UsesRemaining; } else if (hammer.Resource == CraftResource.Copper) { points = 25 * hammer.UsesRemaining; } else if (hammer.Resource == CraftResource.Bronze) { points = 100 * hammer.UsesRemaining; } else if (hammer.Resource == CraftResource.Gold) { points = 250 * hammer.UsesRemaining; } else if (hammer.Resource == CraftResource.Agapite) { points = 1000 * hammer.UsesRemaining; } else if (hammer.Resource == CraftResource.Verite) { points = 4000 * hammer.UsesRemaining; } else if (hammer.Resource == CraftResource.Valorite) { points = 8000 * hammer.UsesRemaining; } } else if (item is RunicSewingKit) { RunicSewingKit sewing = (RunicSewingKit)item; if (sewing.Resource == CraftResource.SpinedLeather) { points = 10 * sewing.UsesRemaining; } else if (sewing.Resource == CraftResource.HornedLeather) { points = 100 * sewing.UsesRemaining; } else if (sewing.Resource == CraftResource.BarbedLeather) { points = 400 * sewing.UsesRemaining; } } else if (item is PowerScroll) { PowerScroll ps = (PowerScroll)item; if (ps.Value == 105) { points = 50; } else if (ps.Value == 110) { points = 100; } else if (ps.Value == 115) { points = 500; } else if (ps.Value == 120) { points = 2500; } } else if (item is ScrollOfTranscendence) { SpecialScroll sot = (SpecialScroll)item; points = sot.Value / 0.1 * 2; } else if (item is Bait) { Bait bait = (Bait)item; points = 10 * bait.UsesRemaining; } else if (item is TreasureMap) { TreasureMap tmap = (TreasureMap)item; if (TreasureMapInfo.NewSystem) { switch (tmap.Level) { default: case 0: case 1: return(50); case 2: return(250); case 3: return(750); case 4: return(1000); } } else { switch (tmap.Level) { default: case 0: return(25); case 1: return(50); case 2: return(100); case 3: return(250); case 4: return(500); case 5: return(750); case 6: case 7: return(1000); } } } else if (item is MidnightBracers && item.LootType == LootType.Cursed) { points = 5000; } else if (item is MonsterStatuette) { MonsterStatuette ms = (MonsterStatuette)item; if (ms.Type == MonsterStatuetteType.Slime) { points = 5000; } } else if (item is PigmentsOfTokuno || item is LesserPigmentsOfTokuno) { BasePigmentsOfTokuno pigments = (BasePigmentsOfTokuno)item; points = 500 * pigments.UsesRemaining; } else if (item is ICombatEquipment) { points = GetPointsForEquipment(item); } if (item.LootType != LootType.Blessed && points < 100 && item is IShipwreckedItem && ((IShipwreckedItem)item).IsShipwreckedItem) { points = 100; } return(points); } }
public void GivePowerScrolls() { if (Map != Map.Felucca) { return; } List <Mobile> toGive = new List <Mobile>(); List <DamageStore> rights = GetLootingRights(DamageEntries, 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 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 PlayerMobile pm)) { return; } for (int j = 0; j < pm.JusticeProtectors.Count; ++j) { Mobile 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)) { 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?.Deleted == false) { prot.Corpse.DropItem(powerScroll); } else { prot.AddToBackpack(powerScroll); } } } } }
public static void GivePowerScrollTo(Mobile m) { if (m == null) //sanity { return; } PowerScroll ps = CreateRandomPowerScroll(); 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 = CreateRandomPowerScroll(); 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 static double GetPoints(Item item) { double points = 0; Type type = item.GetType(); if (Entries.ContainsKey(type)) { points = Entries[type]; if (item.Stackable) { points = points * item.Amount; } return(points); } else { if (item is RunicHammer) { RunicHammer hammer = (RunicHammer)item; if (hammer.Resource == CraftResource.DullCopper) { points = 5 * hammer.UsesRemaining; } else if (hammer.Resource == CraftResource.ShadowIron) { points = 10 * hammer.UsesRemaining; } else if (hammer.Resource == CraftResource.Copper) { points = 25 * hammer.UsesRemaining; } else if (hammer.Resource == CraftResource.Bronze) { points = 100 * hammer.UsesRemaining; } else if (hammer.Resource == CraftResource.Gold) { points = 250 * hammer.UsesRemaining; } else if (hammer.Resource == CraftResource.Agapite) { points = 1000 * hammer.UsesRemaining; } else if (hammer.Resource == CraftResource.Verite) { points = 4000 * hammer.UsesRemaining; } else if (hammer.Resource == CraftResource.Valorite) { points = 8000 * hammer.UsesRemaining; } } else if (item is RunicSewingKit) { RunicSewingKit sewing = (RunicSewingKit)item; if (sewing.Resource == CraftResource.SpinedLeather) { points = 10 * sewing.UsesRemaining; } else if (sewing.Resource == CraftResource.HornedLeather) { points = 100 * sewing.UsesRemaining; } else if (sewing.Resource == CraftResource.BarbedLeather) { points = 400 * sewing.UsesRemaining; } } else if (item is PowerScroll) { PowerScroll ps = (PowerScroll)item; if (ps.Value == 105) { points = 50; } else if (ps.Value == 110) { points = 100; } else if (ps.Value == 115) { points = 500; } else if (ps.Value == 120) { points = 2500; } } else if (item is ScrollofTranscendence) { SpecialScroll sot = (SpecialScroll)item; points = sot.Value / 0.1 * 2; } else if (item is Bait) { Bait bait = (Bait)item; points = 10 * bait.UsesRemaining; } else if (item is TreasureMap) { TreasureMap tmap = (TreasureMap)item; if (tmap.Level == 1) { points = 50; } else if (tmap.Level == 2) { points = 100; } else if (tmap.Level == 3) { points = 250; } else if (tmap.Level == 4) { points = 500; } else if (tmap.Level == 5) { points = 750; } else if (tmap.Level == 6) { points = 1000; } } else if (item is MidnightBracers && item.LootType == LootType.Cursed) { points = 5000; } else if (item is MonsterStatuette) { MonsterStatuette ms = (MonsterStatuette)item; if (ms.Type == MonsterStatuetteType.Slime) { points = 5000; } } else if (item is PigmentsOfTokuno || item is LesserPigmentsOfTokuno) { BasePigmentsOfTokuno pigments = (BasePigmentsOfTokuno)item; points = 500 * pigments.UsesRemaining; } return(points); } }
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.Map == this.Map && m.InRange(this, 90)) || (!m.Alive && m.Corpse == null)) { toGive.Remove(m); } } if (toGive.Count == 0) { return; } for (int i = 0; i < 6; ++i) { int level; double random = Utility.RandomDouble(); /* Powerscroll type chance: * - 80% chance to get a 110 powerscroll * - 15% chance to get a 115 powerscroll * - 5% chance to get a 120 powerscroll */ if (0.05 >= random) { level = 20; } else if (0.2 >= 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! 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.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)) { PowerScroll pps = PowerScroll.CreateRandomNoCraft(level, level); prot.SendLocalizedMessage(1049368); // You have been rewarded for your dedication to Justice! prot.AddToBackpack(pps); } } } } }
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); } // 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); } }
public override void GivePowerScrolls() { if (ChampSpawn == null && !AlwaysDropScrolls) { return; } var scores = new Dictionary <Mobile, double>(Scores); var toReceiveScroll = new List <Mobile>(); // first find all eligible receivers var eligibleMobs = new List <Mobile>(); var eligibleMobScores = new List <double>(); List <KeyValuePair <Mobile, double> > orderedscores = scores.ToList(); orderedscores.Sort((firstPair, nextPair) => firstPair.Value.CompareTo(nextPair.Value)); orderedscores.Reverse(); double totalScores = 0.0; var sb = new StringBuilder(); sb.Append("========== " + DateTime.Now + " Champion " + GetType() + " Report ==============\r\n"); sb.Append( "Score\tEligible\tName\tAccount\tAddress\tStr\tInt\tDex\tTaming\tProvocation\tMagery\tArchery\tMace\tFencing\tSwords\tLumberjack\tWrestling\tAnatomy\r\n"); foreach (KeyValuePair <Mobile, double> pair in scores) { Mobile mob = pair.Key; if (mob == null) { continue; } bool eligible = IsEligible(mob); sb.Append( pair.Value + "\t" + eligible + "\t" + mob + "\t" + mob.Account + "\t" + mob.Address + "\t" + mob.Str + "\t" + mob.Int + "\t" + mob.Dex + "\t" + mob.Skills.AnimalTaming.Value + "\t" + mob.Skills.Provocation.Value + "\t" + mob.Skills.Magery.Value + "\t" + mob.Skills.Archery.Value + "\t" + mob.Skills.Macing.Value + "\t" + mob.Skills.Fencing.Value + "\t" + mob.Skills.Swords.Value + "\t" + mob.Skills.Lumberjacking.Value + "\t" + mob.Skills.Wrestling.Value + "\t" + mob.Skills.Anatomy.Value + "\r\n"); if (!eligible) { continue; } eligibleMobs.Add(mob); eligibleMobScores.Add(pair.Value); totalScores += pair.Value; } for (int powerScrollIndex = 0; powerScrollIndex < ChampionGlobals.CSOptions.PowerScrollsToGive; powerScrollIndex++) { double currentTestValue = 0.0; double roll = Utility.RandomDouble() * totalScores; for (int i = 0; i < eligibleMobScores.Count; i++) { currentTestValue += eligibleMobScores[i]; if (roll > currentTestValue) { continue; } toReceiveScroll.Add(eligibleMobs[i]); totalScores -= eligibleMobScores[i]; // remove them from eligible list now eligibleMobs.RemoveAt(i); eligibleMobScores.RemoveAt(i); break; } } foreach (PlayerMobile mobile in scores.Keys.OfType <PlayerMobile>()) { PlayerMobile mobile1 = mobile; Timer.DelayCall( TimeSpan.FromMinutes(1), () => { var scrollgump = new PlayerScoresScrollGump(mobile1, onAccept: x => { var scoreboard = new PlayerScoreResultsGump(mobile1, this, scores, toReceiveScroll). Send <PlayerScoreResultsGump>(); }).Send <PlayerScoresScrollGump>(); }); } foreach (Mobile luckyPlayer in toReceiveScroll) { PowerScroll ps = CreateRandomPowerScroll(Expansion); if (ps == null) { continue; } GivePowerScrollTo(luckyPlayer, ps); sb.Append(luckyPlayer + " received powerScoll " + ps.Skill + " " + ps.Value + "\r\n"); } foreach (PlayerMobile pm in orderedscores.Select(kvp => kvp.Key as PlayerMobile)) { TitleHue titlehue; CustomTitles.TryGetHue(1196, out titlehue); TitleProfile p = CustomTitles.EnsureProfile(pm); if (pm != null && titlehue != null && p != null && !p.Contains(titlehue)) { p.Add(titlehue); pm.SendMessage(titlehue.Hue, "You have been granted the title hue: " + titlehue.Hue); sb.Append(pm + " received titlehue " + titlehue.Hue + "\r\n"); break; } } LoggingCustom.Log("ChampionScores/" + IOUtility.GetSafeFileName(GetType().FullName) + ".log", sb.ToString()); }
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() { if (Map != Map.Felucca) { return; } ArrayList toGive = new ArrayList(); 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 = (Mobile)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); 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]; PowerScroll ps = CreateRandomPowerScroll(); 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) { ((Container)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 = (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)) { ps = CreateRandomPowerScroll(); prot.SendLocalizedMessage(1049368); // You have been rewarded for your dedication to Justice! if (!Core.SE || prot.Alive) { prot.AddToBackpack(ps); } else { if (prot.Corpse != null && !prot.Corpse.Deleted) { ((Container)prot.Corpse).DropItem(ps); } else { prot.AddToBackpack(ps); } } } } } } }