Reorganizes Project (#41)

This commit is contained in:
Kamron Batman 2019-08-02 18:13:40 -07:00 committed by GitHub
parent 08bf44af9a
commit 3614a66aee
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3499 changed files with 79 additions and 55 deletions

View file

@ -0,0 +1,54 @@
using Server.Items;
namespace Server.Engines.CannedEvil
{
public class ChampionAltar : PentagramAddon
{
private ChampionSpawn m_Spawn;
public ChampionAltar(ChampionSpawn spawn)
{
m_Spawn = spawn;
}
public ChampionAltar(Serial serial) : base(serial)
{
}
public override void OnAfterDelete()
{
base.OnAfterDelete();
m_Spawn?.Delete();
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write(0); // version
writer.Write(m_Spawn);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
switch (version)
{
case 0:
{
m_Spawn = reader.ReadItem() as ChampionSpawn;
if (m_Spawn == null)
Delete();
break;
}
}
}
}
}

View file

@ -0,0 +1,85 @@
using Server.Items;
namespace Server.Engines.CannedEvil
{
public class ChampionPlatform : BaseAddon
{
private ChampionSpawn m_Spawn;
public ChampionPlatform(ChampionSpawn spawn)
{
m_Spawn = spawn;
for (int x = -2; x <= 2; ++x)
for (int y = -2; y <= 2; ++y)
AddComponent(0x750, x, y, -5);
for (int x = -1; x <= 1; ++x)
for (int y = -1; y <= 1; ++y)
AddComponent(0x750, x, y, 0);
for (int i = -1; i <= 1; ++i)
{
AddComponent(0x751, i, 2, 0);
AddComponent(0x752, 2, i, 0);
AddComponent(0x753, i, -2, 0);
AddComponent(0x754, -2, i, 0);
}
AddComponent(0x759, -2, -2, 0);
AddComponent(0x75A, 2, 2, 0);
AddComponent(0x75B, -2, 2, 0);
AddComponent(0x75C, 2, -2, 0);
}
public ChampionPlatform(Serial serial) : base(serial)
{
}
public void AddComponent(int id, int x, int y, int z)
{
AddonComponent ac = new AddonComponent(id);
ac.Hue = 0x497;
AddComponent(ac, x, y, z);
}
public override void OnAfterDelete()
{
base.OnAfterDelete();
m_Spawn?.Delete();
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write(0); // version
writer.Write(m_Spawn);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
switch (version)
{
case 0:
{
m_Spawn = reader.ReadItem() as ChampionSpawn;
if (m_Spawn == null)
Delete();
break;
}
}
}
}
}

View file

@ -0,0 +1,89 @@
using Server.Engines.CannedEvil;
namespace Server.Items
{
public class ChampionSkull : Item
{
private ChampionSkullType m_Type;
[Constructible]
public ChampionSkull(ChampionSkullType type) : base(0x1AE1)
{
m_Type = type;
LootType = LootType.Cursed;
// TODO: All hue values
switch (type)
{
case ChampionSkullType.Power:
Hue = 0x159;
break;
case ChampionSkullType.Venom:
Hue = 0x172;
break;
case ChampionSkullType.Greed:
Hue = 0x1EE;
break;
case ChampionSkullType.Death:
Hue = 0x025;
break;
case ChampionSkullType.Pain:
Hue = 0x035;
break;
}
}
public ChampionSkull(Serial serial) : base(serial)
{
}
[CommandProperty(AccessLevel.GameMaster)]
public ChampionSkullType Type
{
get => m_Type;
set
{
m_Type = value;
InvalidateProperties();
}
}
public override int LabelNumber => 1049479 + (int)m_Type;
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write(1); // version
writer.Write((int)m_Type);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
switch (version)
{
case 1:
case 0:
{
m_Type = (ChampionSkullType)reader.ReadInt();
break;
}
}
if (version == 0)
{
if (LootType != LootType.Cursed)
LootType = LootType.Cursed;
if (Insured)
Insured = false;
}
}
}
}

View file

@ -0,0 +1,184 @@
using Server.Items;
using Server.Mobiles;
using Server.Targeting;
namespace Server.Engines.CannedEvil
{
public class ChampionSkullBrazier : AddonComponent
{
private Item m_Skull;
private ChampionSkullType m_Type;
public ChampionSkullBrazier(ChampionSkullPlatform platform, ChampionSkullType type) : base(0x19BB)
{
Hue = 0x455;
Light = LightType.Circle300;
Platform = platform;
m_Type = type;
}
public ChampionSkullBrazier(Serial serial) : base(serial)
{
}
[CommandProperty(AccessLevel.GameMaster)]
public ChampionSkullPlatform Platform{ get; private set; }
[CommandProperty(AccessLevel.GameMaster)]
public ChampionSkullType Type
{
get => m_Type;
set
{
m_Type = value;
InvalidateProperties();
}
}
[CommandProperty(AccessLevel.GameMaster)]
public Item Skull
{
get => m_Skull;
set
{
m_Skull = value;
Platform?.Validate();
}
}
public override int LabelNumber => 1049489 + (int)m_Type;
public override void OnDoubleClick(Mobile from)
{
Platform?.Validate();
BeginSacrifice(from);
}
public void BeginSacrifice(Mobile from)
{
if (Deleted)
return;
if (m_Skull?.Deleted == true)
Skull = null;
if (from.Map != Map || !from.InRange(GetWorldLocation(), 3))
{
from.SendLocalizedMessage(500446); // That is too far away.
}
else if (!Harrower.CanSpawn)
{
from.SendMessage("The harrower has already been spawned.");
}
else if (m_Skull == null)
{
from.SendLocalizedMessage(1049485); // What would you like to sacrifice?
from.Target = new SacrificeTarget(this);
}
else
{
SendLocalizedMessageTo(from, 1049487, ""); // I already have my champions awakening skull!
}
}
public void EndSacrifice(Mobile from, ChampionSkull skull)
{
if (Deleted)
return;
if (m_Skull?.Deleted == true)
Skull = null;
if (from.Map != Map || !from.InRange(GetWorldLocation(), 3))
{
from.SendLocalizedMessage(500446); // That is too far away.
}
else if (!Harrower.CanSpawn)
{
from.SendMessage("The harrower has already been spawned.");
}
else if (skull == null)
{
SendLocalizedMessageTo(from, 1049488, ""); // That is not my champions awakening skull!
}
else if (m_Skull != null)
{
SendLocalizedMessageTo(from, 1049487, ""); // I already have my champions awakening skull!
}
else if (!skull.IsChildOf(from.Backpack))
{
from.SendLocalizedMessage(1049486); // You can only sacrifice items that are in your backpack!
}
else
{
if (skull.Type == Type)
{
skull.Movable = false;
skull.MoveToWorld(GetWorldTop(), Map);
Skull = skull;
}
else
{
SendLocalizedMessageTo(from, 1049488, ""); // That is not my champions awakening skull!
}
}
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write(0); // version
writer.Write((int)m_Type);
writer.Write(Platform);
writer.Write(m_Skull);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
switch (version)
{
case 0:
{
m_Type = (ChampionSkullType)reader.ReadInt();
Platform = reader.ReadItem() as ChampionSkullPlatform;
m_Skull = reader.ReadItem();
if (Platform == null)
Delete();
break;
}
}
if (Hue == 0x497)
Hue = 0x455;
if (Light != LightType.Circle300)
Light = LightType.Circle300;
}
private class SacrificeTarget : Target
{
private ChampionSkullBrazier m_Brazier;
public SacrificeTarget(ChampionSkullBrazier brazier) : base(12, false, TargetFlags.None)
{
m_Brazier = brazier;
}
protected override void OnTarget(Mobile from, object targeted)
{
m_Brazier.EndSacrifice(from, targeted as ChampionSkull);
}
}
}
}

View file

@ -0,0 +1,128 @@
using Server.Items;
using Server.Mobiles;
namespace Server.Engines.CannedEvil
{
public class ChampionSkullPlatform : BaseAddon
{
private ChampionSkullBrazier m_Power, m_Enlightenment, m_Venom, m_Pain, m_Greed, m_Death;
[Constructible]
public ChampionSkullPlatform()
{
AddComponent(new AddonComponent(0x71A), -1, -1, -1);
AddComponent(new AddonComponent(0x709), 0, -1, -1);
AddComponent(new AddonComponent(0x709), 1, -1, -1);
AddComponent(new AddonComponent(0x709), -1, 0, -1);
AddComponent(new AddonComponent(0x709), 0, 0, -1);
AddComponent(new AddonComponent(0x709), 1, 0, -1);
AddComponent(new AddonComponent(0x709), -1, 1, -1);
AddComponent(new AddonComponent(0x709), 0, 1, -1);
AddComponent(new AddonComponent(0x71B), 1, 1, -1);
AddComponent(new AddonComponent(0x50F), 0, -1, 4);
AddComponent(m_Power = new ChampionSkullBrazier(this, ChampionSkullType.Power), 0, -1, 5);
AddComponent(new AddonComponent(0x50F), 1, -1, 4);
AddComponent(m_Enlightenment = new ChampionSkullBrazier(this, ChampionSkullType.Enlightenment), 1, -1, 5);
AddComponent(new AddonComponent(0x50F), -1, 0, 4);
AddComponent(m_Venom = new ChampionSkullBrazier(this, ChampionSkullType.Venom), -1, 0, 5);
AddComponent(new AddonComponent(0x50F), 1, 0, 4);
AddComponent(m_Pain = new ChampionSkullBrazier(this, ChampionSkullType.Pain), 1, 0, 5);
AddComponent(new AddonComponent(0x50F), -1, 1, 4);
AddComponent(m_Greed = new ChampionSkullBrazier(this, ChampionSkullType.Greed), -1, 1, 5);
AddComponent(new AddonComponent(0x50F), 0, 1, 4);
AddComponent(m_Death = new ChampionSkullBrazier(this, ChampionSkullType.Death), 0, 1, 5);
AddonComponent comp = new LocalizedAddonComponent(0x20D2, 1049495);
comp.Hue = 0x482;
AddComponent(comp, 0, 0, 5);
comp = new LocalizedAddonComponent(0x0BCF, 1049496);
comp.Hue = 0x482;
AddComponent(comp, 0, 2, -7);
comp = new LocalizedAddonComponent(0x0BD0, 1049497);
comp.Hue = 0x482;
AddComponent(comp, 2, 0, -7);
}
public ChampionSkullPlatform(Serial serial) : base(serial)
{
}
public void Validate()
{
if (Validate(m_Power) && Validate(m_Enlightenment) && Validate(m_Venom) && Validate(m_Pain) &&
Validate(m_Greed) && Validate(m_Death))
{
Mobile harrower = Harrower.Spawn(new Point3D(X, Y, Z + 6), Map);
if (harrower == null)
return;
Clear(m_Power);
Clear(m_Enlightenment);
Clear(m_Venom);
Clear(m_Pain);
Clear(m_Greed);
Clear(m_Death);
}
}
public void Clear(ChampionSkullBrazier brazier)
{
if (brazier != null)
{
Effects.SendBoltEffect(brazier);
brazier.Skull?.Delete();
}
}
public bool Validate(ChampionSkullBrazier brazier)
{
return brazier?.Skull?.Deleted == false;
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write(0); // version
writer.Write(m_Power);
writer.Write(m_Enlightenment);
writer.Write(m_Venom);
writer.Write(m_Pain);
writer.Write(m_Greed);
writer.Write(m_Death);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
switch (version)
{
case 0:
{
m_Power = reader.ReadItem() as ChampionSkullBrazier;
m_Enlightenment = reader.ReadItem() as ChampionSkullBrazier;
m_Venom = reader.ReadItem() as ChampionSkullBrazier;
m_Pain = reader.ReadItem() as ChampionSkullBrazier;
m_Greed = reader.ReadItem() as ChampionSkullBrazier;
m_Death = reader.ReadItem() as ChampionSkullBrazier;
break;
}
}
}
}
}

View file

@ -0,0 +1,12 @@
namespace Server.Engines.CannedEvil
{
public enum ChampionSkullType
{
Power,
Enlightenment,
Venom,
Pain,
Greed,
Death
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,133 @@
using System;
using Server.Mobiles;
namespace Server.Engines.CannedEvil
{
public enum ChampionSpawnType
{
Abyss,
Arachnid,
ColdBlood,
ForestLord,
VerminHorde,
UnholyTerror,
SleepingDragon,
Glade,
Pestilence
}
public class ChampionSpawnInfo
{
public ChampionSpawnInfo(string name, Type champion, string[] levelNames, Type[][] spawnTypes)
{
Name = name;
Champion = champion;
LevelNames = levelNames;
SpawnTypes = spawnTypes;
}
public string Name{ get; }
public Type Champion{ get; }
public Type[][] SpawnTypes{ get; }
public string[] LevelNames{ get; }
public static ChampionSpawnInfo[] Table{ get; } =
{
new ChampionSpawnInfo("Abyss", typeof(Semidar), new[] { "Foe", "Assassin", "Conqueror" }, new[] // Abyss
{
// Abyss
new[] { typeof(GreaterMongbat), typeof(Imp) }, // Level 1
new[] { typeof(Gargoyle), typeof(Harpy) }, // Level 2
new[] { typeof(FireGargoyle), typeof(StoneGargoyle) }, // Level 3
new[] { typeof(Daemon), typeof(Succubus) } // Level 4
}),
new ChampionSpawnInfo("Arachnid", typeof(Mephitis), new[] { "Bane", "Killer", "Vanquisher" }, new[] // Arachnid
{
// Arachnid
new[] { typeof(Scorpion), typeof(GiantSpider) }, // Level 1
new[] { typeof(TerathanDrone), typeof(TerathanWarrior) }, // Level 2
new[] { typeof(DreadSpider), typeof(TerathanMatriarch) }, // Level 3
new[] { typeof(PoisonElemental), typeof(TerathanAvenger) } // Level 4
}),
new ChampionSpawnInfo("Cold Blood", typeof(Rikktor), new[] { "Blight", "Slayer", "Destroyer" },
new[] // Cold Blood
{
// Cold Blood
new[] { typeof(Lizardman), typeof(Snake) }, // Level 1
new[] { typeof(LavaLizard), typeof(OphidianWarrior) }, // Level 2
new[] { typeof(Drake), typeof(OphidianArchmage) }, // Level 3
new[] { typeof(Dragon), typeof(OphidianKnight) } // Level 4
}),
new ChampionSpawnInfo("Forest Lord", typeof(LordOaks), new[] { "Enemy", "Curse", "Slaughterer" },
new[] // Forest Lord
{
// Forest Lord
new[] { typeof(Pixie), typeof(ShadowWisp) }, // Level 1
new[] { typeof(Kirin), typeof(Wisp) }, // Level 2
new[] { typeof(Centaur), typeof(Unicorn) }, // Level 3
new[] { typeof(EtherealWarrior), typeof(SerpentineDragon) } // Level 4
}),
new ChampionSpawnInfo("Vermin Horde", typeof(Barracoon), new[] { "Adversary", "Subjugator", "Eradicator" },
new[] // Vermin Horde
{
// Vermin Horde
new[] { typeof(GiantRat), typeof(Slime) }, // Level 1
new[] { typeof(DireWolf), typeof(Ratman) }, // Level 2
new[] { typeof(HellHound), typeof(RatmanMage) }, // Level 3
new[] { typeof(RatmanArcher), typeof(SilverSerpent) } // Level 4
}),
new ChampionSpawnInfo("Unholy Terror", typeof(Neira), new[] { "Scourge", "Punisher", "Nemesis" },
new[] // Unholy Terror
{
// Unholy Terror
Core.AOS
? new[]
{
typeof(Bogle), typeof(Ghoul), typeof(Shade), typeof(Spectre), typeof(Wraith)
} // Level 1 (Pre-AoS)
: new[] { typeof(Ghoul), typeof(Shade), typeof(Spectre), typeof(Wraith) }, // Level 1
new[] { typeof(BoneMagi), typeof(Mummy), typeof(SkeletalMage) }, // Level 2
new[] { typeof(BoneKnight), typeof(Lich), typeof(SkeletalKnight) }, // Level 3
new[] { typeof(LichLord), typeof(RottingCorpse) } // Level 4
}),
new ChampionSpawnInfo("Sleeping Dragon", typeof(Serado), new[] { "Rival", "Challenger", "Antagonist" }, new[]
{
// Unholy Terror
new[] { typeof(DeathwatchBeetleHatchling), typeof(Lizardman) },
new[] { typeof(DeathwatchBeetle), typeof(Kappa) },
new[] { typeof(LesserHiryu), typeof(RevenantLion) },
new[] { typeof(Hiryu), typeof(Oni) }
}),
new ChampionSpawnInfo("Glade", typeof(Twaulo), new[] { "Banisher", "Enforcer", "Eradicator" }, new[]
{
// Glade
new[] { typeof(Pixie), typeof(ShadowWisp) },
new[] { typeof(Centaur), typeof(MLDryad) },
new[] { typeof(Satyr), typeof(CuSidhe) },
new[] { typeof(FeralTreefellow), typeof(RagingGrizzlyBear) }
}),
new ChampionSpawnInfo("The Corrupt", typeof(Ilhenir), new[] { "Cleanser", "Expunger", "Depurator" }, new[]
{
// Unholy Terror
new[] { typeof(PlagueSpawn), typeof(Bogling) },
new[] { typeof(PlagueBeast), typeof(BogThing) },
new[] { typeof(PlagueBeastLord), typeof(InterredGrizzle) },
new[] { typeof(FetidEssence), typeof(PestilentBandage) }
})
};
public static ChampionSpawnInfo GetInfo(ChampionSpawnType type)
{
int v = (int)type;
if (v < 0 || v >= Table.Length)
v = 0;
return Table[v];
}
}
}

View file

@ -0,0 +1,56 @@
namespace Server.Items
{
public class HarrowerGate : Moongate
{
private Mobile m_Harrower;
public HarrowerGate(Mobile harrower, Point3D loc, Map map, Point3D targLoc, Map targMap) : base(targLoc, targMap)
{
m_Harrower = harrower;
Dispellable = false;
ItemID = 0x1FD4;
Light = LightType.Circle300;
MoveToWorld(loc, map);
}
public HarrowerGate(Serial serial) : base(serial)
{
}
public override int LabelNumber => 1049498; // dark moongate
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write(0); // version
writer.Write(m_Harrower);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
switch (version)
{
case 0:
{
m_Harrower = reader.ReadMobile();
if (m_Harrower == null)
Delete();
break;
}
}
if (Light != LightType.Circle300)
Light = LightType.Circle300;
}
}
}

View file

@ -0,0 +1,20 @@
using System;
namespace Server.Engines.CannedEvil
{
public class RestartTimer : Timer
{
private ChampionSpawn m_Spawn;
public RestartTimer(ChampionSpawn spawn, TimeSpan delay) : base(delay)
{
m_Spawn = spawn;
Priority = TimerPriority.FiveSeconds;
}
protected override void OnTick()
{
m_Spawn.EndRestart();
}
}
}

View file

@ -0,0 +1,20 @@
using System;
namespace Server.Engines.CannedEvil
{
public class SliceTimer : Timer
{
private ChampionSpawn m_Spawn;
public SliceTimer(ChampionSpawn spawn) : base(TimeSpan.FromSeconds(1.0), TimeSpan.FromSeconds(1.0))
{
m_Spawn = spawn;
Priority = TimerPriority.OneSecond;
}
protected override void OnTick()
{
m_Spawn.OnSlice();
}
}
}

View file

@ -0,0 +1,99 @@
using System;
namespace Server.Items
{
public class StarRoomGate : Moongate
{
private bool m_Decays;
private DateTime m_DecayTime;
private Timer m_Timer;
[Constructible]
public StarRoomGate(Point3D loc, Map map, bool decays) : this(decays)
{
MoveToWorld(loc, map);
Effects.PlaySound(loc, map, 0x20E);
}
[Constructible]
public StarRoomGate(bool decays = false) : base(new Point3D(5143, 1774, 0), Map.Felucca)
{
Dispellable = false;
ItemID = 0x1FD4;
if (decays)
{
m_Decays = true;
m_DecayTime = DateTime.UtcNow + TimeSpan.FromMinutes(2.0);
m_Timer = new InternalTimer(this, m_DecayTime);
m_Timer.Start();
}
}
public StarRoomGate(Serial serial) : base(serial)
{
}
public override int LabelNumber => 1049498; // dark moongate
public override void OnAfterDelete()
{
m_Timer?.Stop();
base.OnAfterDelete();
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write(0); // version
writer.Write(m_Decays);
if (m_Decays)
writer.WriteDeltaTime(m_DecayTime);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
switch (version)
{
case 0:
{
m_Decays = reader.ReadBool();
if (m_Decays)
{
m_DecayTime = reader.ReadDeltaTime();
m_Timer = new InternalTimer(this, m_DecayTime);
m_Timer.Start();
}
break;
}
}
}
private class InternalTimer : Timer
{
private Item m_Item;
public InternalTimer(Item item, DateTime end) : base(end - DateTime.UtcNow)
{
m_Item = item;
}
protected override void OnTick()
{
m_Item.Delete();
}
}
}
}