Overwrite

Complete Overwrite of the Folder with the free shard. ServUO 57.3 has been added.
This commit is contained in:
Unstable Kitsune
2023-11-28 23:20:26 -05:00
parent 3cd54811de
commit b918192e4e
11608 changed files with 2644205 additions and 47 deletions

View File

@@ -0,0 +1,77 @@
using System;
using Server.Mobiles;
using System.Linq;
namespace Server.Items
{
public class AncientWall : Item
{
[Constructable]
public AncientWall()
: base(0x175)
{
Movable = false;
}
public bool IsInsidePyramid(Mobile from)
{
return Map.Malas.GetMobilesInBounds(new Rectangle2D(1808, 1784, 31, 31)).OfType<PlayerMobile>().Any(x => x == from);
}
public override void OnDoubleClick(Mobile from)
{
if (IsInsidePyramid(from))
{
from.SendLocalizedMessage(1061603); // You hear a metallic click, and the ancient stone block rises up into the ceiling.
InternalTimer timer = new InternalTimer(this);
timer.Start();
Z -= 50;
}
else
{
from.SendLocalizedMessage(501287); // That is locked, but is usable from the inside.
}
}
public AncientWall(Serial serial)
: base(serial)
{
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write((int)0); // version
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
if (Z != -110)
{
Z = -110;
}
}
private class InternalTimer : Timer
{
private AncientWall wall;
public InternalTimer(AncientWall m_wall)
: base(TimeSpan.FromMinutes(1.0))
{
wall = m_wall;
}
protected override void OnTick()
{
wall.Z += 50;
}
}
}
}

View File

@@ -0,0 +1,43 @@
using Server;
using Server.Commands;
using Server.Items;
using Server.Mobiles;
namespace Server.Engines
{
public static class GenerateForgottenPyramid
{
public static void Initialize()
{
CommandSystem.Register("GenForgottenPyramid", AccessLevel.Administrator, Generate_ForgottenPyramid);
}
public static void Generate_ForgottenPyramid(CommandEventArgs e)
{
Generate(e.Mobile);
}
public static void Generate(Mobile m)
{
if (Map.Malas.FindItem<XmlSpawner>(new Point3D(1821, 1797, -110)) == null)
{
XmlSpawner sp = new XmlSpawner("Sphynx");
sp.SpawnRange = 10;
sp.HomeRange = 15;
sp.MoveToWorld(new Point3D(1821, 1797, -110), Map.Malas);
sp.Respawn();
}
if (Map.Malas.FindItem<AncientWall>(new Point3D(1824, 1783, -110)) == null)
{
Item item = new AncientWall();
item.MoveToWorld(new Point3D(1824, 1783, -110), Map.Malas);
}
if (m != null)
{
m.SendMessage("Forgotten Pyramid generation complete.");
}
}
}
}

View File

@@ -0,0 +1,188 @@
using System;
using Server;
using System.Collections.Generic;
using Server.Network;
using Server.ContextMenus;
using Server.Gumps;
using Server.Engines.SphynxFortune;
namespace Server.Mobiles
{
public class Sphynx : BaseCreature
{
[Constructable]
public Sphynx()
: base(AIType.AI_Mage, FightMode.Aggressor, 10, 1, 0.2, 0.4)
{
Body = 788;
Name = "The Sphynx";
SetStr(1001, 1200);
SetDex(176, 195);
SetInt(301, 400);
SetHits(1001, 1200);
SetStam(176, 195);
SetMana(301, 400);
SetDamage(10, 15);
SetDamageType(ResistanceType.Physical, 85);
SetDamageType(ResistanceType.Energy, 15);
SetResistance(ResistanceType.Physical, 60, 80);
SetResistance(ResistanceType.Fire, 30, 50);
SetResistance(ResistanceType.Cold, 40, 60);
SetResistance(ResistanceType.Poison, 40, 50);
SetResistance(ResistanceType.Energy, 40, 50);
SetSkill(SkillName.Wrestling, 90.1, 100.0);
SetSkill(SkillName.Tactics, 90.1, 100.0);
SetSkill(SkillName.MagicResist, 100.5, 150.0);
SetSkill(SkillName.Magery, 95.5, 100.0);
SetSkill(SkillName.Anatomy, 25.1, 50.0);
SetSkill(SkillName.EvalInt, 90.1, 100.0);
SetSkill(SkillName.Meditation, 95.1, 120.0);
SetSkill(SkillName.DetectHidden, 100.0);
Fame = 15000;
Karma = 0;
PackGold(1000, 1200);
}
public override void GenerateLoot()
{
AddLoot(LootPack.Rich, 2);
}
public override void AddCustomContextEntries(Mobile from, List<ContextMenuEntry> list)
{
if (from.Alive)
list.Add(new AskAboutFutureEntry(from, this));
base.AddCustomContextEntries(from, list);
}
public Sphynx(Serial serial)
: base(serial)
{
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write((int)0);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
}
public class AskAboutFutureEntry : ContextMenuEntry
{
private Sphynx m_Sphynx;
private Mobile m;
public AskAboutFutureEntry(Mobile from, Sphynx Sphynx)
: base(6199, 8)
{
m_Sphynx = Sphynx;
m = from;
Enabled = !SphynxFortune.UnderEffect(from);
}
public override void OnClick()
{
m.CloseGump(typeof(SphynxGump));
m.SendGump(new SphynxGump(m_Sphynx));
}
}
public class SphynxGump : Gump
{
private Sphynx Sphynx;
public SphynxGump(Sphynx s)
: base(150, 50)
{
Sphynx = s;
AddPage(0);
Closable = false;
AddImage(0, 0, 0xE10);
AddImageTiled(0, 14, 15, 200, 0xE13);
AddImageTiled(380, 14, 14, 200, 0xE15);
AddImage(0, 201, 0xE16);
AddImageTiled(15, 201, 370, 16, 0xE17);
AddImageTiled(15, 0, 370, 16, 0xE11);
AddImage(380, 0, 0xE12);
AddImage(380, 201, 0xE18);
AddImageTiled(15, 15, 365, 190, 0xA40);
AddRadio(30, 140, 0x25FF, 0x2602, false, 1);
AddHtmlLocalized(65, 145, 300, 25, 1060863, 0xFFFFFF, false, false); // Pay for the reading.
AddRadio(30, 175, 0x25FF, 0x2602, true, 0);
AddHtmlLocalized(65, 178, 300, 25, 1060862, 0xFFFFFF, false, false); // No thanks. I decide my own destiny!
AddHtmlLocalized(30, 20, 360, 35, 1060864, 0xFFFFFF, false, false); // Interested in your fortune, are you? The ancient Sphynx can read the future for you - for a price of course...
AddImage(65, 72, 0x15E5);
AddImageTiled(80, 90, 200, 1, 0x2393);
AddImageTiled(95, 92, 200, 1, 0x23C5);
AddLabel(90, 70, 0x66D, "5000");
AddHtmlLocalized(140, 70, 100, 25, 1023823, 0xFFFFFF, false, false); // gold coins
AddButton(290, 175, 0xF7, 0xF8, 2, GumpButtonType.Reply, 0);
AddImageTiled(15, 14, 365, 1, 0x2393);
AddImageTiled(380, 14, 1, 190, 0x2391);
AddImageTiled(15, 205, 365, 1, 0x2393);
AddImageTiled(15, 14, 1, 190, 0x2391);
AddImageTiled(0, 0, 395, 1, 0x23C5);
AddImageTiled(394, 0, 1, 217, 0x23C3);
AddImageTiled(0, 216, 395, 1, 0x23C5);
AddImageTiled(0, 0, 1, 217, 0x23C3);
AddHtmlLocalized(30, 105, 340, 40, 1060865, 0x1DB2D, false, false); // Do you accept this offer? The funds will be withdrawn from your backpack.
}
public override void OnResponse(NetState sender, RelayInfo info)
{
Mobile from = sender.Mobile;
if (info.ButtonID == 2)
{
if (info.IsSwitched(1))
{
if (Banker.Deposit(from, 5000, true))
{
SphynxFortune.ApplyFortune(from, Sphynx);
SphynxFortune.ApplyFortune(from, Sphynx);
from.UpdateResistances();
}
else
{
from.SendLocalizedMessage(1061006); // You haven't got the coin to make the proper donation to the Sphynx. Your fortune has not been read.
}
}
else
{
from.SendLocalizedMessage(1061007); // You decide against having your fortune told.
}
}
}
}
}
}

View File

@@ -0,0 +1,265 @@
using Server;
using Server.Network;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
namespace Server.Engines.SphynxFortune
{
public class SphynxFortuneArray
{
public Mobile Mobile { get; set; }
public DateTime Date { get; set; }
public EnumType Type { get; set; }
public EnumTypeValue TypeValue { get; set; }
public int Value { get; set; }
}
public enum EnumTypeValue
{
Physical,
Fire,
Cold,
Poison,
Energy,
Luck,
EnhancePotions,
DefendChance,
RegenMana
}
public enum EnumType
{
ResistanceType,
AosAttribute
}
public class SphynxFortune
{
public static string FilePath = Path.Combine("Saves/Misc/SphynxFortune", "Persistence.bin");
private static List<SphynxFortuneArray> Fountains = new List<SphynxFortuneArray>();
private static Timer m_Timer;
public static void Configure()
{
EventSink.WorldSave += OnSave;
EventSink.WorldLoad += OnLoad;
}
public static void ApplyFortune(Mobile from, Mobile m)
{
int cliloc = 0;
switch (Utility.Random(20))
{
case 0:
{
Fountains.Add(new SphynxFortuneArray { Mobile = from, Date = DateTime.UtcNow, Type = EnumType.ResistanceType, TypeValue = EnumTypeValue.Physical, Value = Utility.RandomMinMax(1, 10) });
cliloc = 1060886; // Your endurance shall protect you from your enemies blows.
break;
}
case 1:
{
Fountains.Add(new SphynxFortuneArray { Mobile = from, Date = DateTime.UtcNow, Type = EnumType.ResistanceType, TypeValue = EnumTypeValue.Physical, Value = Utility.RandomMinMax(-1, -15) });
cliloc = 1060901; // Your wounds in battle shall run deep.
break;
}
case 2:
{
Fountains.Add(new SphynxFortuneArray { Mobile = from, Date = DateTime.UtcNow, Type = EnumType.ResistanceType, TypeValue = EnumTypeValue.Fire, Value = Utility.RandomMinMax(1, 10) });
cliloc = 1060887; // A smile will be upon your lips, as you gaze into the infernos.
break;
}
case 3:
{
Fountains.Add(new SphynxFortuneArray { Mobile = from, Date = DateTime.UtcNow, Type = EnumType.ResistanceType, TypeValue = EnumTypeValue.Fire, Value = Utility.RandomMinMax(-1, -15) });
cliloc = 1060902; // The fires of the abyss shall tear asunder your flesh!
break;
}
case 4:
{
Fountains.Add(new SphynxFortuneArray { Mobile = from, Date = DateTime.UtcNow, Type = EnumType.ResistanceType, TypeValue = EnumTypeValue.Cold, Value = Utility.RandomMinMax(1, 10) });
cliloc = 1060888; // The ice of ages will embrace you, and you will embrace it alike.
break;
}
case 5:
{
Fountains.Add(new SphynxFortuneArray { Mobile = from, Date = DateTime.UtcNow, Type = EnumType.ResistanceType, TypeValue = EnumTypeValue.Cold, Value = Utility.RandomMinMax(-1, -15) });
cliloc = 1060903; // Winters touch shall be your undoing.
break;
}
case 6:
{
Fountains.Add(new SphynxFortuneArray { Mobile = from, Date = DateTime.UtcNow, Type = EnumType.ResistanceType, TypeValue = EnumTypeValue.Poison, Value = Utility.RandomMinMax(1, 10) });
cliloc = 1060889; // Your blood runs pure and strong.
break;
}
case 7:
{
Fountains.Add(new SphynxFortuneArray { Mobile = from, Date = DateTime.UtcNow, Type = EnumType.ResistanceType, TypeValue = EnumTypeValue.Poison, Value = Utility.RandomMinMax(-1, -15) });
cliloc = 1060904; // Your veins will freeze with poisons chill.
break;
}
case 8:
{
Fountains.Add(new SphynxFortuneArray { Mobile = from, Date = DateTime.UtcNow, Type = EnumType.ResistanceType, TypeValue = EnumTypeValue.Energy, Value = Utility.RandomMinMax(1, 10) });
cliloc = 1060890; // Your flesh shall endure the power of storms.
break;
}
case 9:
{
Fountains.Add(new SphynxFortuneArray { Mobile = from, Date = DateTime.UtcNow, Type = EnumType.ResistanceType, TypeValue = EnumTypeValue.Energy, Value = Utility.RandomMinMax(-1, -15) });
cliloc = 1060905; // The wise will seek to avoid the anger of storms.
break;
}
case 10:
{
Fountains.Add(new SphynxFortuneArray { Mobile = from, Date = DateTime.UtcNow, Type = EnumType.AosAttribute, TypeValue = EnumTypeValue.Luck, Value = Utility.RandomMinMax(10, 50) });
cliloc = 1060891; // Seek riches and they will seek you.
break;
}
case 11:
{
Fountains.Add(new SphynxFortuneArray { Mobile = from, Date = DateTime.UtcNow, Type = EnumType.AosAttribute, TypeValue = EnumTypeValue.Luck, Value = Utility.RandomMinMax(-10, -50) });
cliloc = 1060901; // Your wounds in battle shall run deep.
break;
}
case 12:
{
Fountains.Add(new SphynxFortuneArray { Mobile = from, Date = DateTime.UtcNow, Type = EnumType.AosAttribute, TypeValue = EnumTypeValue.EnhancePotions, Value = Utility.RandomMinMax(5, 25) });
cliloc = 1060892; // The power of alchemy shall thrive within you.
break;
}
case 13:
{
Fountains.Add(new SphynxFortuneArray { Mobile = from, Date = DateTime.UtcNow, Type = EnumType.AosAttribute, TypeValue = EnumTypeValue.EnhancePotions, Value = Utility.RandomMinMax(-5, -25) });
cliloc = 1060907; // The strength of alchemy will fail you.
break;
}
case 14:
{
Fountains.Add(new SphynxFortuneArray { Mobile = from, Date = DateTime.UtcNow, Type = EnumType.AosAttribute, TypeValue = EnumTypeValue.Luck, Value = Utility.RandomMinMax(10, 100) });
cliloc = 1060893; // Fate smiles upon you this day.
break;
}
case 15:
{
Fountains.Add(new SphynxFortuneArray { Mobile = from, Date = DateTime.UtcNow, Type = EnumType.AosAttribute, TypeValue = EnumTypeValue.Luck, Value = Utility.RandomMinMax(-10, -100) });
cliloc = 1060908; // Only fools take risks in fates shadow.
break;
}
case 16:
{
Fountains.Add(new SphynxFortuneArray { Mobile = from, Date = DateTime.UtcNow, Type = EnumType.AosAttribute, TypeValue = EnumTypeValue.DefendChance, Value = Utility.RandomMinMax(1, 10) });
cliloc = 1060894; // A keen mind in battle will help you avoid injury.
break;
}
case 17:
{
Fountains.Add(new SphynxFortuneArray { Mobile = from, Date = DateTime.UtcNow, Type = EnumType.AosAttribute, TypeValue = EnumTypeValue.DefendChance, Value = Utility.RandomMinMax(-1, -10) });
cliloc = 1060909; // Your lack of focus in battle shall be your undoing.
break;
}
case 18:
{
Fountains.Add(new SphynxFortuneArray { Mobile = from, Date = DateTime.UtcNow, Type = EnumType.AosAttribute, TypeValue = EnumTypeValue.RegenMana, Value = Utility.RandomMinMax(1, 3) });
cliloc = 1060895; // The flow of the ether is strong within you.
break;
}
case 19:
{
Fountains.Add(new SphynxFortuneArray { Mobile = from, Date = DateTime.UtcNow, Type = EnumType.AosAttribute, TypeValue = EnumTypeValue.RegenMana, Value = Utility.RandomMinMax(-1, -3) });
cliloc = 1060910; // Your connection with the ether is weak, take heed.
break;
}
}
m.PrivateOverheadMessage(MessageType.Regular, 0x3B2, cliloc, from.NetState);
}
public static bool UnderEffect(Mobile from)
{
return Fountains.Any(x => x.Mobile == from);
}
public static int GetResistanceBonus(Mobile from, ResistanceType type)
{
return Fountains.Where(x => x.Mobile == from && (x.Type == EnumType.ResistanceType) && Enum.GetName(typeof(ResistanceType), type) == x.TypeValue.ToString()).Sum(y => y.Value);
}
public static int GetAosAttributeBonus(Mobile from, AosAttribute type)
{
return Fountains.Where(x => x.Mobile == from && (x.Type == EnumType.AosAttribute) && Enum.GetName(typeof(AosAttribute), type) == x.TypeValue.ToString()).Sum(y => y.Value);
}
public static void DefragTables()
{
Fountains.ForEach(x =>
{
if (DateTime.UtcNow > x.Date + TimeSpan.FromHours(24))
{
x.Mobile.SendLocalizedMessage(1060859); // The effects of the Sphynx have worn off.
}
});
Fountains.RemoveAll(x => DateTime.UtcNow > x.Date + TimeSpan.FromHours(24));
}
public static void StartTimer()
{
if (m_Timer != null && m_Timer.Running)
return;
m_Timer = Timer.DelayCall(TimeSpan.FromMinutes(1), TimeSpan.FromMinutes(1), new TimerCallback(DefragTables));
m_Timer.Start();
}
public static void OnSave(WorldSaveEventArgs e)
{
Persistence.Serialize(
FilePath,
writer =>
{
writer.Write((int)0);
writer.Write(Fountains.Count);
Fountains.ForEach(s =>
{
writer.Write(s.Mobile);
writer.Write(s.Date);
writer.Write((int)s.Type);
writer.Write((int)s.TypeValue);
writer.Write(s.Value);
});
});
}
public static void OnLoad()
{
Persistence.Deserialize(
FilePath,
reader =>
{
int version = reader.ReadInt();
int count = reader.ReadInt();
for (int i = count; i > 0; i--)
{
Mobile m = reader.ReadMobile();
DateTime dt = reader.ReadDateTime();
EnumType et = (EnumType)reader.ReadInt();
EnumTypeValue etv = (EnumTypeValue)reader.ReadInt();
int value = reader.ReadInt();
if (m != null)
{
Fountains.Add(new SphynxFortuneArray { Mobile = m, Date = dt, Type = et, TypeValue = etv, Value = value });
}
}
});
StartTimer();
}
}
}