Initial commit

This commit is contained in:
Ubuntu
2026-06-19 00:00:16 -04:00
commit 73701ff86e
7100 changed files with 1952988 additions and 0 deletions
+15
View File
@@ -0,0 +1,15 @@
namespace Server.Custom.RumorMill
{
public interface IRumor
{
Map RumorMap { get; }
Point3D RumorLocation { get; }
void InitRumor();
void SpreadRumor(Mobile from, Mobile to);
void EndRumor();
}
}
+87
View File
@@ -0,0 +1,87 @@
using System;
namespace Server.Custom.RumorMill.Items
{
public class GoldenCompass : Item
{
[CommandProperty(AccessLevel.GameMaster)]
public IRumor CurrentRumor { get; private set; }
[CommandProperty(AccessLevel.GameMaster)]
public int lastCubit { get; private set; }
[Constructable]
public GoldenCompass() : base(0x1058)
{
Name = "Golden Compass";
Hue = 2734;
Weight = 0.1;
}
public void SetRumor(IRumor r, Mobile to)
{
CurrentRumor = r;
lastCubit = (int)to.GetDistanceToSqrt(CurrentRumor.RumorLocation);
Timer.DelayCall(TimeSpan.FromMinutes(30), () =>
{
CurrentRumor = null;
lastCubit = 0;
to.SendMessage(53, "The compass has lost connection with target!");
});
}
public override void OnDoubleClick(Mobile from)
{
if (CurrentRumor != null)
{
if (from.Map != CurrentRumor.RumorMap)
{
from.SendMessage(53, $"Target is in the lands of {CurrentRumor.RumorMap.Name}!");
return;
}
int currentCubit = (int)from.GetDistanceToSqrt(CurrentRumor.RumorLocation);
if (currentCubit > lastCubit)
{
from.SendMessage(5, "Getting Colder!");
}
else
{
from.SendMessage(40, "Getting Warmer!");
}
lastCubit = currentCubit;
}
else
{
from.SendMessage(53, "No target set, find a vendor with a rumor!");
}
}
public GoldenCompass(Serial serial) : base(serial)
{
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write(0);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
}
}
}
+116
View File
@@ -0,0 +1,116 @@
using System;
using Server.Items;
using Server.Mobiles;
namespace Server.Custom.RumorMill.Mobiles
{
public class MissingNPC : BaseCreature
{
private Gold gold;
public override bool ClickTitle => false;
public override bool IsInvulnerable => true;
public MissingNPC() : base(AIType.AI_Animal, FightMode.None, 0, 0)
{
Title = "the lost";
Female = Utility.RandomBool();
Hue = Utility.RandomSkinHue();
if (Female)
{
Body = 0x191;
Name = NameList.RandomName("female");
AddItem(new FancyDress(Utility.RandomDyedHue()));
}
else
{
Body = 0x190;
Name = NameList.RandomName("male");
AddItem(new LongPants(Utility.RandomNeutralHue()));
AddItem(new FancyShirt(Utility.RandomDyedHue()));
}
AddItem(new Boots(Utility.RandomNeutralHue()));
Utility.AssignRandomHair(this);
Container pack = new Backpack();
if (Utility.RandomDouble() < 0.05)
{
gold = new Gold(5000, 50000);
}
else
{
gold = new Gold(500, 5000);
}
gold.Visible = false;
pack.DropItem(gold);
pack.Movable = false;
AddItem(pack);
}
public override void OnMovement(Mobile m, Point3D oldLocation)
{
if (m.Player && InRange(m, 6) && !InRange(oldLocation, 6) && gold != null)
{
SayTo(m, true, $"{m.Name}, You found me, Thank you!");
SayTo(m, true, $"Here is {gold.Amount} gold for your trouble!");
gold.Visible = true;
m.AddToBackpack(gold);
Timer.DelayCall(TimeSpan.FromSeconds(1), () =>
{
Effects.SendBoltEffect(this);
Delete();
});
}
else
{
base.OnMovement(m, oldLocation);
}
}
public MissingNPC(Serial serial) : base(serial)
{
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write((int)1); // version
writer.Write(gold);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
if (version > 0)
{
gold = reader.ReadItem() as Gold;
}
}
}
}
+86
View File
@@ -0,0 +1,86 @@
using System;
using System.Linq;
using System.Reflection;
using System.Collections.Generic;
namespace Server.Custom.RumorMill
{
internal static class RumorCore
{
private static List<IRumor> _Rumors;
internal static void LoadRumors()
{
_Rumors = new List<IRumor>();
Assembly assembly = Assembly.GetExecutingAssembly();
var iRumorList = assembly.GetTypes()
.Where(t => t.GetInterfaces().Contains(typeof(IRumor)) && t.GetConstructor(Type.EmptyTypes) != null);
foreach (var type in iRumorList)
{
IRumor instance = (IRumor)Activator.CreateInstance(type);
AddRumor(instance);
}
}
private static void AddRumor(IRumor rumor)
{
if (_Rumors != null && !_Rumors.Contains(rumor))
{
_Rumors.Add(rumor);
rumor.InitRumor();
}
}
private static void RemoveRumor(IRumor rumor)
{
if (_Rumors != null && _Rumors.Contains(rumor))
{
_Rumors.Remove(rumor);
rumor.EndRumor();
}
}
internal static void SpreadRumor(Mobile from, Mobile to)
{
if (_Rumors != null && _Rumors.Count > 0)
{
_Rumors[GetRandomRumor()].SpreadRumor(from, to);
}
}
private static int GetRandomRumor()
{
return Utility.RandomMinMax(0, (_Rumors.Count - 1));
}
internal static void ResetRumor(IRumor rumor)
{
if (_Rumors != null && _Rumors.Count > 0)
{
if (_Rumors.Contains(rumor))
{
RemoveRumor(rumor);
AddRumor(rumor);
}
}
}
internal static void RunCleanUp()
{
if (_Rumors != null && _Rumors.Count > 0)
{
for (int i = 0; i < _Rumors.Count; i++)
{
_Rumors[i].EndRumor();
}
}
}
}
}
+181
View File
@@ -0,0 +1,181 @@
using System.Linq;
using Server.Regions;
using Server.Targeting;
using Server.Custom.RumorMill.Items;
namespace Server.Custom.RumorMill
{
internal static class RumorUtility
{
public static void Initialize()
{
RumorCore.LoadRumors();
EventSink.ValidVendorPurchase += EventSink_ValidVendorPurchase;
EventSink.ValidVendorSell += EventSink_ValidVendorSell;
EventSink.Shutdown += EventSink_Shutdown;
EventSink.Crashed += EventSink_Crashed;
}
private static void EventSink_ValidVendorPurchase(ValidVendorPurchaseEventArgs e)
{
TrySpreadRumor(e.Vendor, e.Mobile);
}
private static void EventSink_ValidVendorSell(ValidVendorSellEventArgs e)
{
TrySpreadRumor(e.Vendor, e.Mobile);
}
private static void TrySpreadRumor(Mobile from, Mobile to)
{
if (Utility.RandomDouble() < 0.05 || to.AccessLevel > AccessLevel.Player)
{
RumorCore.SpreadRumor(from, to);
}
}
private static void EventSink_Shutdown(ShutdownEventArgs e)
{
RumorCore.RunCleanUp();
}
private static void EventSink_Crashed(CrashedEventArgs e)
{
RumorCore.RunCleanUp();
}
internal static Map GetRandomMap()
{
return Utility.RandomList(Map.Felucca, Map.Trammel, Map.Ilshenar, Map.Malas, Map.Tokuno, Map.TerMur);
}
internal static Point3D GetAnyLocation(Map map)
{
return GetLocation(map);
}
internal static Point3D GetLandLocation(Map map)
{
return GetLocation(map, true, false);
}
internal static Point3D GetWaterLocation(Map map)
{
return GetLocation(map, false);
}
private static Point3D GetLocation(Map map, bool isLand = true, bool isWater = true)
{
Point3D location = Point3D.Zero;
var mobs = World.Mobiles.Values.Where(m => m.Map == map && ValidateRegion(m)).ToList();
if (mobs != null && mobs.Count > 0)
{
if (isLand && isWater)
{
location = mobs[Utility.Random(mobs.Count - 1)].Location;
}
else
{
if (!isWater)
{
var landMobs = mobs.Where(m => !m.CanSwim).ToList();
if (landMobs != null && landMobs.Count > 0)
{
location = landMobs[Utility.Random(landMobs.Count - 1)].Location;
}
}
else
{
var waterMobs = mobs.Where(m => m.CanSwim).ToList();
if (waterMobs != null && waterMobs.Count > 0)
{
location = waterMobs[Utility.Random(waterMobs.Count - 1)].Location;
}
}
}
}
return location;
}
private static bool ValidateRegion(Mobile m)
{
if (m.Region.IsPartOf(typeof(DungeonRegion)))
{
return false;
}
if (m.Region.IsPartOf(typeof(TownRegion)))
{
return false;
}
if (m.Region.IsPartOf(typeof(HouseRegion)))
{
return false;
}
if (m.Region.IsPartOf(typeof(GuardedRegion)))
{
return false;
}
return true;
}
internal static void RunMessage(IRumor rumor, Mobile from, Mobile to, string subject)
{
if (from.Map != rumor.RumorMap)
{
from.SayTo(to, true, $"I heard of {subject}, in the lands of {rumor.RumorMap.Name}!");
}
else
{
var mobs = rumor.RumorMap.GetMobilesInRange(rumor.RumorLocation, 10).ToList();
if (mobs != null && mobs.Count > 0 && Utility.RandomDouble() < 0.5)
{
from.SayTo(to, true, $"I heard of {subject}, where {mobs[0].Name} roams!");
}
else
{
var items = rumor.RumorMap.GetItemsInRange(rumor.RumorLocation, 10).ToList();
if (items != null && items.Count > 0)
{
from.SayTo(to, true, $"I heard of {subject}, near a {items[0].Name}!");
}
else
{
string name = new LandTarget(rumor.RumorLocation, rumor.RumorMap).Name;
from.SayTo(to, true, $"I heard of {subject}, around some {name}!");
}
}
int distance = (int)from.GetDistanceToSqrt(rumor.RumorLocation);
string direction = from.GetDirectionTo(rumor.RumorLocation).ToString();
from.SayTo(to, true, $"Last seen about {distance} cubits {direction}, from our location!");
var compass = to.Backpack.FindItemByType(typeof(GoldenCompass));
if (compass != null && compass is GoldenCompass gc)
{
gc.SetRumor(rumor, to);
from.SayTo(to, true, $"I've set the location on your golden compass!");
}
}
}
}
}
+48
View File
@@ -0,0 +1,48 @@
using Server.Custom.RumorMill.Items;
namespace Server.Custom.RumorMill.Rumors
{
internal class GoldenCompassRumor : IRumor
{
private GoldenCompass compass;
public Map RumorMap { get; private set; }
public Point3D RumorLocation { get; private set; }
public void InitRumor()
{
compass = new GoldenCompass();
RumorMap = RumorUtility.GetRandomMap();
RumorLocation = RumorUtility.GetLandLocation(RumorMap);
compass.MoveToWorld(RumorLocation, RumorMap);
}
public void SpreadRumor(Mobile from, Mobile to)
{
if (compass != null && compass.Location == RumorLocation)
{
RumorUtility.RunMessage(this, from, to, "a golden compass");
}
else
{
RumorCore.ResetRumor(this);
}
}
public void EndRumor()
{
if (compass.Location == RumorLocation)
{
compass.Delete();
}
compass = null;
RumorLocation = Point3D.Zero;
}
}
}
+55
View File
@@ -0,0 +1,55 @@
using Server.Items;
namespace Server.Custom.RumorMill.Rumors
{
internal class LostGoldRumor : IRumor
{
private Gold gold;
public Map RumorMap { get; private set; }
public Point3D RumorLocation { get; private set; }
public void InitRumor()
{
if (Utility.RandomDouble() < 0.05)
{
gold = new Gold(Utility.RandomMinMax(5000, 50000));
}
else
{
gold = new Gold(Utility.RandomMinMax(50, 5000));
}
RumorMap = RumorUtility.GetRandomMap();
RumorLocation = RumorUtility.GetLandLocation(RumorMap);
gold.MoveToWorld(RumorLocation, RumorMap);
}
public void SpreadRumor(Mobile from, Mobile to)
{
if (gold != null && gold.Location == RumorLocation)
{
RumorUtility.RunMessage(this, from, to, "lost gold");
}
else
{
RumorCore.ResetRumor(this);
}
}
public void EndRumor()
{
if (gold.Location == RumorLocation)
{
gold.Delete();
}
gold = null;
RumorLocation = Point3D.Zero;
}
}
}
+55
View File
@@ -0,0 +1,55 @@
using Server.Items;
namespace Server.Custom.RumorMill.Rumors
{
internal class LostTreasureRumor : IRumor
{
private Item treasure;
public Map RumorMap { get; private set; }
public Point3D RumorLocation { get; private set; }
public void InitRumor()
{
if (Utility.RandomDouble() < 0.05)
{
treasure = new LargeTreasureBag();
}
else
{
treasure = new TreasureBag();
}
RumorMap = RumorUtility.GetRandomMap();
RumorLocation = RumorUtility.GetAnyLocation(RumorMap);
treasure.MoveToWorld(RumorLocation, RumorMap);
}
public void SpreadRumor(Mobile from, Mobile to)
{
if (treasure != null && treasure.Location == RumorLocation)
{
RumorUtility.RunMessage(this, from, to, "lost treasure");
}
else
{
RumorCore.ResetRumor(this);
}
}
public void EndRumor()
{
if (treasure.Location == RumorLocation)
{
treasure.Delete();
}
treasure = null;
RumorLocation = Point3D.Zero;
}
}
}
+48
View File
@@ -0,0 +1,48 @@
using Server.Custom.RumorMill.Mobiles;
namespace Server.Custom.RumorMill.Rumors
{
internal class MissingNPCRumor : IRumor
{
private MissingNPC npc;
public Map RumorMap { get; private set; }
public Point3D RumorLocation { get; private set; }
public void InitRumor()
{
npc = new MissingNPC();
RumorMap = RumorUtility.GetRandomMap();
RumorLocation = RumorUtility.GetLandLocation(RumorMap);
npc.MoveToWorld(RumorLocation, RumorMap);
}
public void SpreadRumor(Mobile from, Mobile to)
{
if (npc != null && !npc.Deleted)
{
RumorUtility.RunMessage(this, from, to, "a lost person");
}
else
{
RumorCore.ResetRumor(this);
}
}
public void EndRumor()
{
if (!npc.Deleted)
{
npc.Delete();
}
npc = null;
RumorLocation = Point3D.Zero;
}
}
}
+47
View File
@@ -0,0 +1,47 @@
using Server.Mobiles;
namespace Server.Custom.RumorMill.Rumors
{
internal class PhoenixRumor : IRumor
{
private Phoenix phoenix;
public Map RumorMap { get; private set; } = Map.Felucca;
public Point3D RumorLocation { get; private set; }
public void InitRumor()
{
phoenix = new Phoenix();
RumorLocation = RumorUtility.GetLandLocation(RumorMap);
phoenix.MoveToWorld(RumorLocation, RumorMap);
}
public void SpreadRumor(Mobile from, Mobile to)
{
if (phoenix != null && !phoenix.Controlled && !phoenix.Deleted)
{
RumorUtility.RunMessage(this, from, to, "a phoenix");
}
else
{
RumorCore.ResetRumor(this);
}
}
public void EndRumor()
{
if (!phoenix.Controlled && !phoenix.Deleted)
{
phoenix.Delete();
}
phoenix = null;
RumorLocation = Point3D.Zero;
}
}
}
+46
View File
@@ -0,0 +1,46 @@
using Server.Mobiles;
namespace Server.Custom.RumorMill.Rumors
{
internal class SeaHorseRumor : IRumor
{
private SeaHorse seaHorse;
public Map RumorMap { get; private set; } = Map.Trammel;
public Point3D RumorLocation { get; private set; }
public void InitRumor()
{
seaHorse = new SeaHorse();
RumorLocation = RumorUtility.GetWaterLocation(RumorMap);
seaHorse.MoveToWorld(RumorLocation, RumorMap);
}
public void SpreadRumor(Mobile from, Mobile to)
{
if (seaHorse != null && !seaHorse.Controlled && !seaHorse.Deleted)
{
RumorUtility.RunMessage(this, from, to, "a sea horse");
}
else
{
RumorCore.ResetRumor(this);
}
}
public void EndRumor()
{
if (!seaHorse.Controlled && !seaHorse.Deleted)
{
seaHorse.Delete();
}
seaHorse = null;
RumorLocation = Point3D.Zero;
}
}
}
+46
View File
@@ -0,0 +1,46 @@
using Server.Mobiles;
namespace Server.Custom.RumorMill.Rumors
{
internal class UnicornRumor : IRumor
{
private Unicorn unicorn;
public Map RumorMap { get; private set; } = Map.Ilshenar;
public Point3D RumorLocation { get; private set; }
public void InitRumor()
{
unicorn = new Unicorn();
RumorLocation = RumorUtility.GetLandLocation(RumorMap);
unicorn.MoveToWorld(RumorLocation, RumorMap);
}
public void SpreadRumor(Mobile from, Mobile to)
{
if (unicorn != null && !unicorn.Controlled && !unicorn.Deleted)
{
RumorUtility.RunMessage(this, from, to, "a unicorn");
}
else
{
RumorCore.ResetRumor(this);
}
}
public void EndRumor()
{
if (!unicorn.Controlled && !unicorn.Deleted)
{
unicorn.Delete();
}
unicorn = null;
RumorLocation = Point3D.Zero;
}
}
}