diff --git a/Distribution/Data/regions.json b/Distribution/Data/regions.json index cbfdc9540..ac64853f0 100644 --- a/Distribution/Data/regions.json +++ b/Distribution/Data/regions.json @@ -2109,7 +2109,7 @@ { "$type": "NewbieDungeonRegion", "Map": "Underworld", - "Name": "New Player Dungeon", + "Name": "the New Player Dungeon", "Priority": 60, "Area": [ { "x1": 2561, "y1": 546, "x2": 2831, "y2": 795 } diff --git a/Projects/UOContent/Engines/DailyDungeonManager.cs b/Projects/UOContent/Engines/DailyDungeonManager.cs new file mode 100644 index 000000000..a15ff080e --- /dev/null +++ b/Projects/UOContent/Engines/DailyDungeonManager.cs @@ -0,0 +1,96 @@ +using System; +using Server; +using Server.Commands; + +namespace Server.Custom +{ + public static class DailyDungeonManager + { + public static string ActiveDungeon { get; private set; } + + private static readonly string[] DungeonRoster = + { + "the Dungeon Deceit", "the Dungeon Despise", "the Dungeon Destard", + "the Dungeon Covetous", "the Dungeon Shame", "the Dungeon Hythloth" + }; + + public static void Initialize() + { + CommandSystem.Register("dotd", AccessLevel.Player, DotD_OnCommand); + CommandSystem.Register("ForceDungeonSwap", AccessLevel.GameMaster, ForceSwap_OnCommand); + RotateDungeon(); + Timer.DelayCall(TimeSpan.FromHours(24), TimeSpan.FromHours(24), RotateDungeon); + } + + public static bool IsActive(Region region) + { + if (region == null || string.IsNullOrEmpty(ActiveDungeon)) + { + return false; + } + + Region current = region; + while (current != null) + { + if (current.Name == ActiveDungeon) + { + return true; + } + + current = current.Parent; + } + + if (region.Name != null && region.Name.StartsWith(ActiveDungeon)) + { + return true; + } + + return false; + } + public static void RotateDungeon() + { + string oldDungeon = ActiveDungeon; + string newDungeon; + + do + { + newDungeon = DungeonRoster[Utility.Random(DungeonRoster.Length)]; + } + while (newDungeon == oldDungeon && DungeonRoster.Length > 1); + + ActiveDungeon = newDungeon; + + World.Broadcast(1161, true, $"The magical energies of the world have shifted. {ActiveDungeon} is now the Dungeon of the Day!"); + } + + [Usage("ForceDungeonSwap")] + [Description("Forces the Dungeon of the Day to rotate immediately.")] + private static void ForceSwap_OnCommand(CommandEventArgs e) + { + RotateDungeon(); + e.Mobile.SendMessage("You have forced the daily dungeon to rotate."); + } + + [Usage("dotd")] + [Description("Displays the current Dungeon of the Day and its active bonuses.")] + private static void DotD_OnCommand(CommandEventArgs e) + { + Mobile m = e.Mobile; + + if (string.IsNullOrEmpty(ActiveDungeon)) + { + m.SendMessage(38, "The magical energies are still shifting. There is no active dungeon today."); + return; + } + + string displayName = ActiveDungeon; + if (displayName.StartsWith("the Dungeon ")) + { + displayName = displayName.Substring(12); + } + + m.SendMessage(1161, $"*** Dungeon of the Day: {displayName} ***"); + m.SendMessage(259, "Active Bonuses: Increased Skill gains, extra gold drops, and a chance for rare items!"); + } + } +} diff --git a/Projects/UOContent/Mobiles/BaseCreature.cs b/Projects/UOContent/Mobiles/BaseCreature.cs index 797f7b34e..ff69a251b 100644 --- a/Projects/UOContent/Mobiles/BaseCreature.cs +++ b/Projects/UOContent/Mobiles/BaseCreature.cs @@ -26,6 +26,7 @@ using Server.Spells.Necromancy; using Server.Spells.Sixth; using Server.Spells.Spellweaving; using Server.Targeting; +using Server.Custom; namespace Server.Mobiles { @@ -3652,6 +3653,23 @@ namespace Server.Mobiles killer = pet.ControlMaster; } + Region deathRegion = Region.Find(c.Location, c.Map); + + if (DailyDungeonManager.IsActive(deathRegion)) + { + c.DropItem(new Server.Items.Gold(Utility.RandomMinMax(100, 300))); + + if (Utility.RandomDouble() <= 0.05) + { + c.DropItem(new Server.Items.SpecialHairDye()); + } + + if (killer != null) + { + killer.SendMessage(38, "You have killed a daily mob and earned bonus loot!"); + } + } + if (killer is PlayerMobile pm) { int goldFound = c.GetAmount(typeof(Gold)); diff --git a/Projects/UOContent/Skills/SkillCheck.cs b/Projects/UOContent/Skills/SkillCheck.cs index fb7b8b105..45b518861 100644 --- a/Projects/UOContent/Skills/SkillCheck.cs +++ b/Projects/UOContent/Skills/SkillCheck.cs @@ -3,6 +3,7 @@ using System.Runtime.CompilerServices; using Server.Factions; using Server.Mobiles; using Server.Regions; +using Server.Custom; namespace Server.Misc; @@ -147,6 +148,10 @@ public static class SkillCheck { gc *= 3.0; } + else if (DailyDungeonManager.IsActive(from.Region)) + { + gc *= 2.0; + } if (gc >= Utility.RandomDouble()) {