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 Server.Items;
namespace Server.Engines.SorcerersDungeon
{
[CorpseName("an abominable snowmans corpse")]
public class AbominableSnowman : BaseCreature
{
[Constructable]
public AbominableSnowman()
: base(AIType.AI_Melee, FightMode.Closest, 10, 1, 0.2, 0.4)
{
Name = "the abominable snowman";
Body = 241;
BaseSoundID = 367;
Hue = 1150;
SetStr(800);
SetDex(150);
SetInt(1200);
SetHits(8000);
SetDamage(21, 27);
SetDamageType(ResistanceType.Physical, 50);
SetDamageType(ResistanceType.Cold, 50);
SetResistance(ResistanceType.Physical, 60, 70);
SetResistance(ResistanceType.Fire, 40, 50);
SetResistance(ResistanceType.Cold, 100);
SetResistance(ResistanceType.Poison, 60, 70);
SetResistance(ResistanceType.Energy, 60, 70);
SetSkill(SkillName.Anatomy, 115, 120);
SetSkill(SkillName.Poisoning, 120);
SetSkill(SkillName.MagicResist, 115, 120);
SetSkill(SkillName.Tactics, 100.0);
SetSkill(SkillName.Wrestling, 120, 130);
Fame = 12000;
Karma = -12000;
SetWeaponAbility(WeaponAbility.ConcussionBlow);
SetWeaponAbility(WeaponAbility.CrushingBlow);
SetSpecialAbility(SpecialAbility.TrueFear);
}
public AbominableSnowman(Serial serial)
: base(serial)
{
}
public override bool AlwaysMurderer { get { return true; } }
public override Poison PoisonImmune { get { return Poison.Deadly; } }
public override void GenerateLoot()
{
AddLoot(LootPack.UltraRich, 2);
}
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();
}
}
}

View File

@@ -0,0 +1,75 @@
using System;
using Server.Mobiles;
namespace Server.Engines.SorcerersDungeon
{
[CorpseName("a garish gingerman corpse")]
public class GarishGingerman : BaseCreature
{
[Constructable]
public GarishGingerman()
: base(AIType.AI_Mage, FightMode.Closest, 10, 1, 0.2, 0.4)
{
Name = "a garish gingerman";
Body = 14;
BaseSoundID = 268;
Hue = 1461;
SetStr(400);
SetDex(150);
SetInt(1200);
SetHits(8000);
SetDamage(21, 27);
SetDamageType(ResistanceType.Physical, 50);
SetDamageType(ResistanceType.Energy, 50);
SetResistance(ResistanceType.Physical, 60, 70);
SetResistance(ResistanceType.Fire, 40, 50);
SetResistance(ResistanceType.Cold, 80, 90);
SetResistance(ResistanceType.Poison, 60, 70);
SetResistance(ResistanceType.Energy, 100);
SetSkill(SkillName.EvalInt, 120);
SetSkill(SkillName.Magery, 120);
SetSkill(SkillName.Meditation, 100);
SetSkill(SkillName.MagicResist, 200);
SetSkill(SkillName.Tactics, 100.0);
SetSkill(SkillName.Wrestling, 120);
Fame = 12000;
Karma = -12000;
SetMagicalAbility(MagicalAbility.MageryMastery);
}
public GarishGingerman(Serial serial)
: base(serial)
{
}
public override bool AlwaysMurderer { get { return true; } }
public override Poison PoisonImmune { get { return Poison.Deadly; } }
public override void GenerateLoot()
{
AddLoot(LootPack.UltraRich, 2);
}
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();
}
}
}

View File

@@ -0,0 +1,83 @@
using System;
using Server.Mobiles;
using Server.Items;
namespace Server.Engines.SorcerersDungeon
{
[CorpseName("the corpse of a headless elf")]
public class HeadlessElf : BaseCreature
{
[Constructable]
public HeadlessElf()
: base(AIType.AI_Mage, FightMode.Closest, 10, 1, 0.2, 0.4)
{
Name = "a headless elf";
Race = Race.Elf;
Body = 31;
Hue = Race.RandomSkinHue();
BaseSoundID = 0x39D;
SetStr(700, 800);
SetDex(90, 100);
SetInt(450, 500);
SetHits(8000);
SetDamage(21, 27);
SetDamageType(ResistanceType.Physical, 60);
SetDamageType(ResistanceType.Fire, 20);
SetDamageType(ResistanceType.Energy, 20);
SetResistance(ResistanceType.Physical, 70, 80);
SetResistance(ResistanceType.Fire, 70, 80);
SetResistance(ResistanceType.Cold, 60, 70);
SetResistance(ResistanceType.Poison, 60, 70);
SetResistance(ResistanceType.Energy, 60, 70);
SetSkill(SkillName.Anatomy, 130, 140);
SetSkill(SkillName.Poisoning, 120);
SetSkill(SkillName.MagicResist, 130, 140);
SetSkill(SkillName.Tactics, 130, 140);
SetSkill(SkillName.Wrestling, 120, 130);
SetSkill(SkillName.Parry, 20, 30);
SetSkill(SkillName.Magery, 110, 120);
SetSkill(SkillName.EvalInt, 110, 120);
SetSkill(SkillName.Meditation, 110, 120);
SetSkill(SkillName.Focus, 120, 130);
Fame = 12000;
Karma = -12000;
SetMagicalAbility(MagicalAbility.WrestlingMastery);
}
public HeadlessElf(Serial serial)
: base(serial)
{
}
public override bool AlwaysMurderer { get { return true; } }
public override Poison PoisonImmune { get { return Poison.Deadly; } }
public override void GenerateLoot()
{
AddLoot(LootPack.UltraRich, 2);
}
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();
}
}
}

View File

@@ -0,0 +1,85 @@
using System;
using Server.Mobiles;
using Server.Items;
namespace Server.Engines.SorcerersDungeon
{
[CorpseName("a jack in the box corpse")]
public class JackInTheBox : BaseCreature
{
[Constructable]
public JackInTheBox()
: base(AIType.AI_NecroMage, FightMode.Closest, 10, 1, 0.2, 0.4)
{
Name = "jack in the box";
Body = 1428;
SetStr(200, 300);
SetDex(150, 200);
SetInt(700, 800);
SetHits(8000);
SetDamage(21, 27);
SetDamageType(ResistanceType.Physical, 100);
SetResistance(ResistanceType.Physical, 70, 80);
SetResistance(ResistanceType.Fire, 70, 80);
SetResistance(ResistanceType.Cold, 70, 80);
SetResistance(ResistanceType.Poison, 60, 70);
SetResistance(ResistanceType.Energy, 40, 50);
SetSkill(SkillName.Anatomy, 25);
SetSkill(SkillName.MagicResist, 120);
SetSkill(SkillName.Tactics, 100, 110);
SetSkill(SkillName.Wrestling, 130, 140);
SetSkill(SkillName.Parry, 20, 30);
SetSkill(SkillName.Magery, 120);
SetSkill(SkillName.EvalInt, 120);
SetSkill(SkillName.Necromancy, 120);
SetSkill(SkillName.SpiritSpeak, 120);
SetSkill(SkillName.Meditation, 120);
SetSkill(SkillName.Focus, 70, 80);
Fame = 12000;
Karma = -12000;
SetWeaponAbility(WeaponAbility.ArmorIgnore);
SetWeaponAbility(WeaponAbility.BleedAttack);
}
public JackInTheBox(Serial serial)
: base(serial)
{
}
public override bool AlwaysMurderer { get { return true; } }
public override Poison PoisonImmune { get { return Poison.Deadly; } }
public override int GetIdleSound() { return 0x218; }
public override int GetAngerSound() { return 0x26C; }
public override int GetDeathSound() { return 0x211; }
public override int GetAttackSound() { return 0x232; }
public override int GetHurtSound() { return 0x140; }
public override void GenerateLoot()
{
AddLoot(LootPack.UltraRich, 2);
}
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();
}
}
}

View File

@@ -0,0 +1,271 @@
using System;
using Server.Mobiles;
using Server.Items;
namespace Server.Engines.SorcerersDungeon
{
[CorpseName("the corpse of jack the pumpkin king")]
public class JackThePumpkinKing : BaseCreature
{
[Constructable]
public JackThePumpkinKing()
: base(AIType.AI_NecroMage, FightMode.Closest, 10, 1, 0.2, 0.4)
{
Name = "jack";
Title = "the pumpkin king";
Body = 0x190;
Hue = Race.RandomSkinHue();
SetStr(500);
SetDex(200);
SetInt(1200);
SetHits(26000);
SetDamage(22, 26);
SetDamageType(ResistanceType.Physical, 100);
SetResistance(ResistanceType.Physical, 70, 80);
SetResistance(ResistanceType.Fire, 70, 80);
SetResistance(ResistanceType.Cold, 70, 80);
SetResistance(ResistanceType.Poison, 60, 70);
SetResistance(ResistanceType.Energy, 40, 50);
SetSkill(SkillName.Anatomy, 25);
SetSkill(SkillName.MagicResist, 120);
SetSkill(SkillName.Tactics, 100, 110);
SetSkill(SkillName.Wrestling, 130, 140);
SetSkill(SkillName.Parry, 20, 30);
SetSkill(SkillName.Magery, 120);
SetSkill(SkillName.EvalInt, 120);
SetSkill(SkillName.Necromancy, 120);
SetSkill(SkillName.SpiritSpeak, 120);
SetSkill(SkillName.Meditation, 120);
SetSkill(SkillName.Focus, 70, 80);
Fame = 12000;
Karma = -12000;
SetWearable(new ClothNinjaHood(), 1281);
SetWearable(new BoneChest(), 1175);
SetWearable(new BoneArms(), 1175);
SetWearable(new BoneGloves(), 1175);
SetWearable(new ThighBoots());
SetWearable(new Scepter());
}
private bool m_InHere;
// gleefully stolen from DemonKnight
public override void OnDamage(int amount, Mobile from, bool willKill)
{
if (from != null && from != this && !m_InHere)
{
m_InHere = true;
AOS.Damage(from, this, Utility.RandomMinMax(8, 20), 100, 0, 0, 0, 0);
MovingEffect(from, Utility.RandomMinMax(0xC6A, 0xC6C), 10, 0, false, false, 0, 0);
PlaySound(0x491);
if (0.05 > Utility.RandomDouble())
Timer.DelayCall(TimeSpan.FromSeconds(1.0), new TimerStateCallback(CreatePumpkin_Callback), from);
m_InHere = false;
}
}
public virtual void CreatePumpkin_Callback(object state)
{
Mobile from = (Mobile)state;
Map map = from.Map;
if (map == null)
return;
int count = Utility.RandomMinMax(1, 3);
for (int i = 0; i < count; ++i)
{
int x = from.X + Utility.RandomMinMax(-1, 1);
int y = from.Y + Utility.RandomMinMax(-1, 1);
int z = from.Z;
if (!map.CanFit(x, y, z, 16, false, true))
{
z = map.GetAverageZ(x, y);
if (z == from.Z || !map.CanFit(x, y, z, 16, false, true))
continue;
}
UnholyPumpkin bone = new UnholyPumpkin();
bone.Hue = 0;
bone.Name = "unholy pumpkin";
bone.ItemID = Utility.RandomMinMax(0xC6A, 0xC6C);
bone.MoveToWorld(new Point3D(x, y, z), map);
}
}
public JackThePumpkinKing(Serial serial)
: base(serial)
{
}
public override bool AlwaysMurderer { get { return true; } }
public override Poison PoisonImmune { get { return Poison.Deadly; } }
public override void GenerateLoot()
{
AddLoot(LootPack.UltraRich, 2);
}
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 UnholyPumpkin : Item, ICarvable
{
private SpawnTimer m_Timer;
[Constructable]
public UnholyPumpkin()
: base(0xF7E)
{
Movable = false;
m_Timer = new SpawnTimer(this);
m_Timer.Start();
}
public UnholyPumpkin(Serial serial)
: base(serial)
{
}
public override string DefaultName
{
get
{
return "unholy pumpkin";
}
}
public bool Carve(Mobile from, Item item)
{
Effects.PlaySound(GetWorldLocation(), Map, 0x48F);
Effects.SendLocationEffect(GetWorldLocation(), Map, 0x3728, 10, 10, 0, 0);
if (0.3 > Utility.RandomDouble())
{
from.SendMessage("You destroy the pumpkin.");
Gold gold = new Gold(25, 100);
gold.MoveToWorld(GetWorldLocation(), Map);
Delete();
m_Timer.Stop();
}
else
{
from.SendMessage("You damage the pumpkin.");
}
return true;
}
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();
m_Timer = new SpawnTimer(this);
m_Timer.Start();
}
private class SpawnTimer : Timer
{
private readonly Item m_Item;
public SpawnTimer(Item item)
: base(TimeSpan.FromSeconds(Utility.RandomMinMax(5, 10)))
{
Priority = TimerPriority.FiftyMS;
m_Item = item;
}
protected override void OnTick()
{
if (m_Item.Deleted)
return;
Mobile spawn;
switch (Utility.Random(12))
{
default:
case 0:
spawn = new Skeleton();
break;
case 1:
spawn = new Zombie();
break;
case 2:
spawn = new Wraith();
break;
case 3:
spawn = new Spectre();
break;
case 4:
spawn = new Ghoul();
break;
case 5:
spawn = new Mummy();
break;
case 6:
spawn = new Bogle();
break;
case 7:
spawn = new RottingCorpse();
break;
case 8:
spawn = new BoneKnight();
break;
case 9:
spawn = new SkeletalKnight();
break;
case 10:
spawn = new Lich();
break;
case 11:
spawn = new LichLord();
break;
}
spawn.MoveToWorld(m_Item.Location, m_Item.Map);
m_Item.Delete();
}
}
}
}

View File

@@ -0,0 +1,76 @@
using System;
using Server.Mobiles;
namespace Server.Engines.SorcerersDungeon
{
[CorpseName("a nightmare fairys corpse")]
public class NightmareFairy : BaseCreature
{
[Constructable]
public NightmareFairy()
: base(AIType.AI_Mage, FightMode.Closest, 10, 1, 0.2, 0.4)
{
Name = "a nightmare fairy";
Body = 176;
BaseSoundID = 0x467;
Hue = 1910;
SetStr(400);
SetDex(150);
SetInt(1200);
SetHits(8000);
SetDamage(21, 27);
SetDamageType(ResistanceType.Physical, 50);
SetDamageType(ResistanceType.Energy, 50);
SetResistance(ResistanceType.Physical, 60, 70);
SetResistance(ResistanceType.Fire, 40, 50);
SetResistance(ResistanceType.Cold, 80, 90);
SetResistance(ResistanceType.Poison, 60, 70);
SetResistance(ResistanceType.Energy, 100);
SetSkill(SkillName.EvalInt, 120);
SetSkill(SkillName.Magery, 120);
SetSkill(SkillName.Meditation, 100);
SetSkill(SkillName.MagicResist, 200);
SetSkill(SkillName.Tactics, 100.0);
SetSkill(SkillName.Wrestling, 120);
Fame = 12000;
Karma = -12000;
SetSpecialAbility(SpecialAbility.LifeLeech);
SetSpecialAbility(SpecialAbility.LifeDrain);
}
public NightmareFairy(Serial serial)
: base(serial)
{
}
public override bool AlwaysMurderer { get { return true; } }
public override Poison PoisonImmune { get { return Poison.Deadly; } }
public override void GenerateLoot()
{
AddLoot(LootPack.UltraRich, 2);
}
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();
}
}
}

View File

@@ -0,0 +1,92 @@
using System;
using Server.Mobiles;
namespace Server.Engines.SorcerersDungeon
{
[CorpseName("a rabid reindeers corpse")]
public class RabidReindeer : BaseCreature
{
[Constructable]
public RabidReindeer()
: base(AIType.AI_Melee, FightMode.Closest, 10, 1, 0.2, 0.4)
{
Name = "a rabid reindeer";
Body = 0xEA;
Hue = 2707;
SetStr(800);
SetDex(150);
SetInt(1200);
SetHits(8000);
SetDamage(22, 29);
SetDamageType(ResistanceType.Physical, 50);
SetDamageType(ResistanceType.Cold, 50);
SetResistance(ResistanceType.Physical, 60, 70);
SetResistance(ResistanceType.Fire, 40, 50);
SetResistance(ResistanceType.Cold, 100);
SetResistance(ResistanceType.Poison, 60, 70);
SetResistance(ResistanceType.Energy, 60, 70);
SetSkill(SkillName.Anatomy, 115, 120);
SetSkill(SkillName.Poisoning, 120);
SetSkill(SkillName.MagicResist, 115, 120);
SetSkill(SkillName.Tactics, 100.0);
SetSkill(SkillName.Wrestling, 120, 130);
Fame = 12000;
Karma = -12000;
SetSpecialAbility(SpecialAbility.VenomousBite);
}
public override int Meat { get { return 6; } }
public override int Hides { get { return 15; } }
public override int GetAttackSound()
{
return 0x82;
}
public override int GetHurtSound()
{
return 0x83;
}
public override int GetDeathSound()
{
return 0x84;
}
public RabidReindeer(Serial serial)
: base(serial)
{
}
public override Poison HitPoison { get { return Poison.Lethal; } }
public override bool AlwaysMurderer { get { return true; } }
public override Poison PoisonImmune { get { return Poison.Lethal; } }
public override void GenerateLoot()
{
AddLoot(LootPack.UltraRich, 2);
}
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();
}
}
}

View File

@@ -0,0 +1,75 @@
using System;
using Server.Mobiles;
namespace Server.Engines.SorcerersDungeon
{
[CorpseName("a stocking serpent corpse")]
public class StockingSerpent : BaseCreature
{
[Constructable]
public StockingSerpent()
: base(AIType.AI_Melee, FightMode.Closest, 10, 1, 0.2, 0.4)
{
Name = "a stocking serpent";
Body = 0x509;
BaseSoundID = 0xDB;
Hue = 1459;
SetStr(800);
SetDex(150);
SetInt(1200);
SetHits(8000);
SetDamage(22, 29);
SetDamageType(ResistanceType.Physical, 50);
SetDamageType(ResistanceType.Cold, 50);
SetResistance(ResistanceType.Physical, 60, 70);
SetResistance(ResistanceType.Fire, 40, 50);
SetResistance(ResistanceType.Cold, 100);
SetResistance(ResistanceType.Poison, 60, 70);
SetResistance(ResistanceType.Energy, 60, 70);
SetSkill(SkillName.Anatomy, 115, 120);
SetSkill(SkillName.Poisoning, 120);
SetSkill(SkillName.MagicResist, 115, 120);
SetSkill(SkillName.Tactics, 100.0);
SetSkill(SkillName.Wrestling, 120, 130);
Fame = 12000;
Karma = -12000;
SetSpecialAbility(SpecialAbility.ViciousBite);
}
public StockingSerpent(Serial serial)
: base(serial)
{
}
public override Poison HitPoison { get { return Poison.Lethal; } }
public override bool AlwaysMurderer { get { return true; } }
public override Poison PoisonImmune { get { return Poison.Lethal; } }
public override void GenerateLoot()
{
AddLoot(LootPack.UltraRich, 2);
}
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();
}
}
}

View File

@@ -0,0 +1,75 @@
using System;
using Server.Mobiles;
namespace Server.Engines.SorcerersDungeon
{
[CorpseName("a twisted holiday tree corpse")]
public class TwistedHolidayTree : BaseCreature
{
[Constructable]
public TwistedHolidayTree()
: base(AIType.AI_Mage, FightMode.Closest, 10, 1, 0.2, 0.4)
{
Name = "a twisted holidy tree";
Body = 47;
BaseSoundID = 442;
Hue = 1175;
SetStr(400);
SetDex(150);
SetInt(1200);
SetHits(8000);
SetDamage(21, 27);
SetDamageType(ResistanceType.Physical, 50);
SetDamageType(ResistanceType.Energy, 50);
SetResistance(ResistanceType.Physical, 60, 70);
SetResistance(ResistanceType.Fire, 40, 50);
SetResistance(ResistanceType.Cold, 80, 90);
SetResistance(ResistanceType.Poison, 60, 70);
SetResistance(ResistanceType.Energy, 100);
SetSkill(SkillName.EvalInt, 200);
SetSkill(SkillName.Magery, 120);
SetSkill(SkillName.Meditation, 100);
SetSkill(SkillName.MagicResist, 200);
SetSkill(SkillName.Tactics, 100.0);
SetSkill(SkillName.Wrestling, 120);
Fame = 12000;
Karma = -12000;
SetAreaEffect(AreaEffect.ExplosiveGoo);
}
public TwistedHolidayTree(Serial serial)
: base(serial)
{
}
public override bool AlwaysMurderer { get { return true; } }
public override Poison PoisonImmune { get { return Poison.Deadly; } }
public override void GenerateLoot()
{
AddLoot(LootPack.UltraRich, 2);
}
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();
}
}
}

View File

@@ -0,0 +1,125 @@
using System.Linq;
using System;
using System.Collections.Generic;
using Server;
using Server.Items;
using Server.Engines.Points;
namespace Server.Engines.SorcerersDungeon
{
public static class SorcerersDungeonGenerate
{
private static void OnWorldSave(WorldSaveEventArgs e)
{
CheckEnabled(true);
}
public static void CheckEnabled(bool timed = false)
{
var sd = PointsSystem.SorcerersDungeon;
if (sd.Enabled && !sd.InSeason)
{
if (timed)
{
Timer.DelayCall(TimeSpan.FromSeconds(30), () =>
{
Utility.WriteConsoleColor(ConsoleColor.Green, "Disabling Treasures of Scorcerer's Dungeon");
Remove();
sd.Enabled = false;
});
}
else
{
Utility.WriteConsoleColor(ConsoleColor.Green, "Auto Disabling Treasures of Scorcerer's Dungeon");
Remove();
sd.Enabled = false;
}
}
else if (!sd.Enabled && sd.InSeason)
{
if (timed)
{
Timer.DelayCall(TimeSpan.FromSeconds(30), () =>
{
Utility.WriteConsoleColor(ConsoleColor.Green, "Enabling Treasures of Scorcerer's Dungeon");
Generate();
sd.Enabled = true;
});
}
else
{
Utility.WriteConsoleColor(ConsoleColor.Green, "Auto Enabling Treasures of Scorcerer's Dungeon");
Generate();
sd.Enabled = true;
}
}
}
public static void Generate()
{
Map map = Map.Ilshenar;
if (SorcerersDungeonResearcher.Instance == null)
{
SorcerersDungeonResearcher.Instance = new SorcerersDungeonResearcher();
SorcerersDungeonResearcher.Instance.MoveToWorld(new Point3D(536, 456, -53), map);
}
if (map.FindItem<Static>(new Point3D(546, 460, 6)) == null)
{
Static st = new Static(0x9D2B);
st.MoveToWorld(new Point3D(546, 460, 6), map);
st = new Static(0x9D2C);
st.MoveToWorld(new Point3D(548, 460, 6), map);
st = new Static(0x9D2D);
st.MoveToWorld(new Point3D(548, 458, 6), map);
}
if (map.FindItem<Static>(new Point3D(545, 462, -53)) == null)
{
var st = new Static(0x9F34);
st.MoveToWorld(new Point3D(545, 462, -53), map);
}
if (map.FindItem<Static>(new Point3D(550, 462, -53)) == null)
{
var st = new Static(0x9F34);
st.MoveToWorld(new Point3D(550, 462, -53), map);
}
if (map.FindItem<Static>(new Point3D(545, 463, -55)) == null)
{
var st = new Static(0x9F28);
st.MoveToWorld(new Point3D(545, 463, -55), map);
}
if (map.FindItem<Static>(new Point3D(550, 463, -55)) == null)
{
var st = new Static(0x9F24);
st.MoveToWorld(new Point3D(550, 463, -55), map);
}
if (TOSDSpawner.Instance == null)
{
var spawner = new TOSDSpawner();
spawner.BeginTimer();
}
}
public static void Remove()
{
if (TOSDSpawner.Instance != null)
{
TOSDSpawner.Instance.Deactivate();
}
}
}
}

View File

@@ -0,0 +1,86 @@
using System;
using Server.Mobiles;
namespace Server.Items
{
public class HeroOfTheUnlovedTitleDeed : BaseRewardTitleDeed
{
public override TextDefinition Title { get { return 1157649; } } // Hero of the Unloved
[Constructable]
public HeroOfTheUnlovedTitleDeed()
{
}
public HeroOfTheUnlovedTitleDeed(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 v = reader.ReadInt();
}
}
public class SaviorOfTheDementedTitleDeed : BaseRewardTitleDeed
{
public override TextDefinition Title { get { return 1157651; } } // Savior of the Demented
[Constructable]
public SaviorOfTheDementedTitleDeed()
{
}
public SaviorOfTheDementedTitleDeed(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 v = reader.ReadInt();
}
}
public class SlayerOfThePumpkinKingTitleDeed : BaseRewardTitleDeed
{
public override TextDefinition Title { get { return 1157650; } } // Slayer of the Pumpkin King
[Constructable]
public SlayerOfThePumpkinKingTitleDeed()
{
}
public SlayerOfThePumpkinKingTitleDeed(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 v = reader.ReadInt();
}
}
}

View File

@@ -0,0 +1,63 @@
using System;
using Server;
using Server.Events.Halloween;
namespace Server.Items
{
public class JackInTheBox : Item
{
public override int LabelNumber { get { return 1157655; } } // Jack in the Box
private DateTime _LastUse;
[Constructable]
public JackInTheBox()
: base(0x9F64)
{
}
public override void OnDoubleClick(Mobile from)
{
if (_LastUse + TimeSpan.FromSeconds(20) < DateTime.UtcNow)
{
ItemID = 0x9F64;
Effects.PlaySound(GetWorldLocation(), Map, 1661);
Timer.DelayCall(TimeSpan.FromSeconds(9), () =>
{
ItemID = 0x9F65;
Timer.DelayCall(TimeSpan.FromSeconds(5), () =>
{
ItemID = 0x9F64;
});
});
_LastUse = DateTime.UtcNow;
}
else
{
from.SendLocalizedMessage(501789); // You must wait before trying again.
}
}
public JackInTheBox(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 v = reader.ReadInt();
}
}
}

View File

@@ -0,0 +1,317 @@
using System;
using Server;
using Server.Events.Halloween;
namespace Server.Items
{
public class JacksBagOfTricks : Item
{
public override int LabelNumber { get { return 1157656; } } // Jack's Bag of Tricks
private DateTime _NextUse;
[CommandProperty(AccessLevel.GameMaster)]
public DateTime NextUse
{
get { return _NextUse; }
set { _NextUse = value; }
}
[Constructable]
public JacksBagOfTricks()
: base(0x9F85)
{
}
public override void OnDoubleClick(Mobile from)
{
if (DateTime.Now.Month == 10 || from.AccessLevel > AccessLevel.Player)
{
if (_NextUse < DateTime.UtcNow)
{
Item item = null;
if (0.1 > Utility.RandomDouble())
{
item = HolidaySettings.RandomTreat;
}
else
{
switch (Utility.Random(6))
{
case 0: item = new RancidReindeerMeat(); break;
case 1: item = new GlassyCandyCane(); break;
case 2: item = new NamedSeveredElfEars(); break;
case 3: item = new SuspiciousGiftBox(); break;
case 4: item = new InsultingDoll(); break;
case 5: item = new SpikedEggnog(); break;
}
}
if (item != null)
{
if (from.Backpack == null || !from.Backpack.TryDropItem(from, item, false))
item.MoveToWorld(from.Location, from.Map);
NextUse = DateTime.UtcNow + TimeSpan.FromDays(1);
}
}
else
{
from.SendLocalizedMessage(1157633); // You have already used this today.
}
}
else
{
from.SendLocalizedMessage(1157632); // This only works during the Month of October.
}
}
public JacksBagOfTricks(Serial serial)
: base(serial)
{
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write((int)0);
writer.Write(NextUse);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int v = reader.ReadInt();
NextUse = reader.ReadDateTime();
}
}
[Flipable(0x1E90, 0x1E91)]
public class RancidReindeerMeat : Item
{
public override int LabelNumber { get { return 1157634; } } // Rancid Reindeer Meat
[Constructable]
public RancidReindeerMeat()
: base(0x1E90)
{
Hue = 2707;
}
public RancidReindeerMeat(Serial serial)
: base(serial)
{
}
public override void OnDoubleClick(Mobile m)
{
if (IsChildOf(m.Backpack))
{
PrivateOverheadMessage(Server.Network.MessageType.Regular, 0, 1157635, m.NetState); // *It smells terrible!*
}
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write((int)0);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int v = reader.ReadInt();
}
}
[Flipable(0x9DC3, 0x9DC4)]
public class GlassyCandyCane : Item
{
public override int LabelNumber { get { return 1157636; } } // Glass Candy Cane
[Constructable]
public GlassyCandyCane()
: base(0x9DC3)
{
Hue = 1927;
}
public GlassyCandyCane(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 v = reader.ReadInt();
}
}
[Flipable(0x312D, 0x312E)]
public class NamedSeveredElfEars : Item
{
private string _Name;
[Constructable]
public NamedSeveredElfEars()
: base(0x312D)
{
_Name = _Names[Utility.Random(_Names.Length)];
}
public override void AddNameProperty(ObjectPropertyList list)
{
list.Add(1157637, _Name); // The Severed Ears of an Elf Named ~1_NAME~
}
private string[] _Names =
{
"Alabaster Snowball", "Pepper Minstix", "Wunorse Openslae", "Sugarplum Mary"
};
public override void OnDoubleClick(Mobile m)
{
if (IsChildOf(m.Backpack))
{
PrivateOverheadMessage(Server.Network.MessageType.Regular, 0, 1157638, m.NetState); // *You hear the faint jingle of cheery bells...*
}
}
public NamedSeveredElfEars(Serial serial)
: base(serial)
{
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write((int)0);
writer.Write(_Name);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int v = reader.ReadInt();
_Name = reader.ReadString();
}
}
public class SuspiciousGiftBox : Container
{
public override int LabelNumber { get { return 1157639; } } // Suspicious Gift Box
[Constructable]
public SuspiciousGiftBox()
: base(0x232A)
{
Hue = 1976;
}
public override void OnDoubleClick(Mobile m)
{
if (IsChildOf(m.Backpack))
{
PrivateOverheadMessage(Server.Network.MessageType.Regular, 0, 1157640, m.NetState); // Uh oh...
}
}
public SuspiciousGiftBox(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 v = reader.ReadInt();
}
}
[Flipable(0x48E2, 0x48E3)]
public class InsultingDoll : Item
{
public override int LabelNumber { get { return 1157641; } } // Insulting Doll
[Constructable]
public InsultingDoll()
: base(0x48E2)
{
Hue = 1933;
}
public override void OnDoubleClick(Mobile m)
{
if (IsChildOf(m.Backpack))
{
PrivateOverheadMessage(Server.Network.MessageType.Regular, 0, Utility.RandomMinMax(1157642, 1157646), m.NetState);
}
}
public InsultingDoll(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 v = reader.ReadInt();
}
}
public class SpikedEggnog : Item
{
public override int LabelNumber { get { return 1157647; } } // Spiked Egg Nog
[Constructable]
public SpikedEggnog()
: base(0x142A)
{
Hue = 2711;
}
public SpikedEggnog(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 v = reader.ReadInt();
}
}
}

View File

@@ -0,0 +1,86 @@
using System;
using Server;
using Server.Events.Halloween;
namespace Server.Items
{
public class ShackledHeartOfThePumpkinKing : Item
{
public override int LabelNumber { get { return 1157653; } } // Shackled Heart of the Pumpkin King
private Timer Timer { get; set; }
[Constructable]
public ShackledHeartOfThePumpkinKing()
: base(0x4A9C)
{
}
public override void OnDoubleClick(Mobile m)
{
if (Timer == null)
{
m.SendLocalizedMessage(1157631); // Thou shall know the pain of a chained heart...
m.SendSound(Utility.RandomMinMax(0x423, 0x427));
Timer = new InternalTimer(m, this);
}
else
{
m.SendLocalizedMessage(1157630); // You are already bleeding!
}
}
private class InternalTimer : Timer
{
public Mobile Owner { get; set; }
public ShackledHeartOfThePumpkinKing Heart { get; set; }
public int Ticks { get; set; }
public InternalTimer(Mobile m, ShackledHeartOfThePumpkinKing heart)
: base(TimeSpan.FromSeconds(2), TimeSpan.FromSeconds(2))
{
Owner = m;
Heart = heart;
Start();
}
protected override void OnTick()
{
if (!Owner.Alive || Owner.Map == Map.Internal || Ticks++ >= 5)
{
Stop();
Heart.Timer = null;
}
else
{
Owner.PlaySound(0x133);
var blood = new Blood();
blood.ItemID = Utility.Random(0x122A, 5);
blood.MoveToWorld(Owner.Location, Owner.Map);
}
}
}
public ShackledHeartOfThePumpkinKing(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 v = reader.ReadInt();
}
}
}

View File

@@ -0,0 +1,26 @@
using Server;
using System;
using Server.Mobiles;
using Server.Gumps;
using Server.Engines.Points;
namespace Server.Engines.SorcerersDungeon
{
public class SorcerersDungeonRewardGump : BaseRewardGump
{
public SorcerersDungeonRewardGump(Mobile owner, PlayerMobile user)
: base(owner, user, SorcerersDungeonRewards.Rewards, 1158744)
{
}
public override double GetPoints(Mobile m)
{
return PointsSystem.SorcerersDungeon.GetPoints(m);
}
public override void RemovePoints(double points)
{
PointsSystem.SorcerersDungeon.DeductPoints(User, points);
}
}
}

View File

@@ -0,0 +1,151 @@
using System;
using System.Collections.Generic;
using Server;
using Server.Items;
using Server.Mobiles;
using Server.Commands;
using Server.Engines.Points;
using Server.Engines.SeasonalEvents;
namespace Server.Engines.SorcerersDungeon
{
public class SorcerersDungeonData : PointsSystem
{
public override PointsType Loyalty { get { return PointsType.SorcerersDungeon; } }
public override TextDefinition Name { get { return m_Name; } }
public override bool AutoAdd { get { return true; } }
public override double MaxPoints { get { return double.MaxValue; } }
public override bool ShowOnLoyaltyGump { get { return false; } }
public bool Enabled { get; set; }
private TextDefinition m_Name = null;
public bool InSeason { get { return SeasonalEventSystem.IsActive(EventType.SorcerersDungeon); } }
public SorcerersDungeonData()
{
DungeonPoints = new Dictionary<Mobile, int>();
}
public override void SendMessage(PlayerMobile from, double old, double points, bool quest)
{
from.SendLocalizedMessage(1156902, ((int)points).ToString()); // You have turned in ~1_COUNT~ artifacts of the Kotl
}
public override void ProcessKill(Mobile victim, Mobile damager)
{
var bc = victim as BaseCreature;
if (bc == null)
return;
if (TOSDSpawner.Instance != null)
{
TOSDSpawner.Instance.OnCreatureDeath(bc);
}
if (!Enabled || bc.Controlled || bc.Summoned || !damager.Alive)
return;
Region r = bc.Region;
if (damager is PlayerMobile && r.IsPartOf("Sorcerer's Dungeon"))
{
if (!DungeonPoints.ContainsKey(damager))
DungeonPoints[damager] = 0;
int fame = bc.Fame / 4;
int luck = Math.Max(0, ((PlayerMobile)damager).RealLuck);
DungeonPoints[damager] += (int)(fame * (1 + Math.Sqrt(luck) / 100));
int x = DungeonPoints[damager];
const double A = 0.000863316841;
const double B = 0.00000425531915;
double chance = A * Math.Pow(10, B * x);
if (chance > Utility.RandomDouble())
{
Item i = Loot.RandomArmorOrShieldOrWeaponOrJewelry(LootPackEntry.IsInTokuno(bc), LootPackEntry.IsMondain(bc), LootPackEntry.IsStygian(bc));
if (i != null)
{
RunicReforging.GenerateRandomItem(i, damager, Math.Max(100, RunicReforging.GetDifficultyFor(bc)), RunicReforging.GetLuckForKiller(bc), ReforgedPrefix.None, ReforgedSuffix.EnchantedOrigin);
damager.PlaySound(0x5B4);
damager.SendLocalizedMessage(1157613); // You notice some of your fallen foes' equipment to be of enchanted origin and decide it may be of some value...
if (!damager.PlaceInBackpack(i))
{
if (damager.BankBox != null && damager.BankBox.TryDropItem(damager, i, false))
damager.SendLocalizedMessage(1079730); // The item has been placed into your bank box.
else
{
damager.SendLocalizedMessage(1072523); // You find an artifact, but your backpack and bank are too full to hold it.
i.MoveToWorld(damager.Location, damager.Map);
}
}
DungeonPoints.Remove(damager);
}
}
}
}
public Dictionary<Mobile, int> DungeonPoints { get; set; }
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write(0);
writer.Write(Enabled);
if (TOSDSpawner.Instance != null)
{
writer.Write(0);
TOSDSpawner.Instance.Serialize(writer);
}
else
{
writer.Write(1);
}
writer.Write(DungeonPoints.Count);
foreach (KeyValuePair<Mobile, int> kvp in DungeonPoints)
{
writer.Write(kvp.Key);
writer.Write(kvp.Value);
}
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
Enabled = reader.ReadBool();
if (reader.ReadInt() == 0)
{
var spawner = new TOSDSpawner();
spawner.Deserialize(reader);
}
int count = reader.ReadInt();
for (int i = 0; i < count; i++)
{
Mobile m = reader.ReadMobile();
int points = reader.ReadInt();
if (m != null && points > 0)
DungeonPoints[m] = points;
}
}
}
}

View File

@@ -0,0 +1,118 @@
using Server;
using System;
using Server.Mobiles;
using Server.Items;
using Server.Engines.Points;
namespace Server.Engines.SorcerersDungeon
{
public class SorcerersDungeonResearcher : BaseTurnInMobile
{
public override int TitleLocalization { get { return 1157657; } } // Artifacts of Enchanted Origin
public override int CancelLocalization { get { return 1157616; } } // Bring me items of Enchanted Origin and I will reward you with valuable items.
public override int TurnInLocalization { get { return 1158763; } } // Turn In Artifacts of Enchanted Origin
public override int ClaimLocalization { get { return 1155593; } } // Claim Rewards
public static SorcerersDungeonResearcher Instance { get; set; }
[Constructable]
public SorcerersDungeonResearcher() : base("the Researcher")
{
}
public override void InitBody()
{
base.InitBody();
Name = NameList.RandomName("male");
Hue = Utility.RandomSkinHue();
Body = 0x190;
HairItemID = 0x2047;
HairHue = 0x46D;
}
public override void InitOutfit()
{
SetWearable(new FancyShirt(), 1255);
SetWearable(new JinBaori(), 2722);
SetWearable(new Kilt(), 2012);
SetWearable(new LongPants(), 1775);
SetWearable(new ThighBoots(1908));
SetWearable(new Necklace());
// QuiverOfInfinityBase
Item item = new HeroOfTheUnlovedTitleDeed();
item.Movable = false;
PackItem(item);
item = new SaviorOfTheDementedTitleDeed();
item.Movable = false;
PackItem(item);
item = new SlayerOfThePumpkinKingTitleDeed();
item.Movable = false;
PackItem(item);
item = new SterlingSilverRing();
item.Movable = false;
PackItem(item);
item = new TalonsOfEscaping();
item.Movable = false;
PackItem(item);
item = new BootsOfEscaping();
item.Movable = false;
PackItem(item);
}
public override void GetProperties(ObjectPropertyList list)
{
base.GetProperties(list);
list.Add(1157617); // Artifacts of Enchanted Origin Trader
}
public override void AwardPoints(PlayerMobile pm, Item item, int amount)
{
PointsSystem.SorcerersDungeon.AwardPoints(pm, amount);
}
public override bool IsRedeemableItem(Item item)
{
if (item is ICombatEquipment && ((ICombatEquipment)item).ReforgedSuffix == ReforgedSuffix.EnchantedOrigin)
return true;
return false;
}
public override void SendRewardGump(Mobile m)
{
if (m.Player && m.CheckAlive())
m.SendGump(new SorcerersDungeonRewardGump(this, m as PlayerMobile));
}
public SorcerersDungeonResearcher(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();
if (Map == Map.Ilshenar)
{
Instance = this;
}
}
}
}

View File

@@ -0,0 +1,34 @@
using Server;
using System;
using System.Collections.Generic;
using System.Linq;
using Server.Items;
namespace Server.Engines.SorcerersDungeon
{
public static class SorcerersDungeonRewards
{
public static List<CollectionItem> Rewards { get; set; }
public static void Initialize()
{
Rewards = new List<CollectionItem>();
Rewards.Add(new CollectionItem(typeof(JacksBagOfTricks), 0x9F85, 1157656, 0, 75));
Rewards.Add(new CollectionItem(typeof(SerpentsJawbone), 0x9F74, 1157654, 0, 50));
Rewards.Add(new CollectionItem(typeof(JackInTheBox), 0x9F64, 1157655, 0, 20));
Rewards.Add(new CollectionItem(typeof(ShackledHeartOfThePumpkinKing), 0x4A9C, 1157653, 0, 20)); // wtf does this do?
Rewards.Add(new CollectionItem(typeof(HeroOfTheUnlovedTitleDeed), 0x14F0, 1157649, 0, 20));
Rewards.Add(new CollectionItem(typeof(SaviorOfTheDementedTitleDeed), 0x14F0, 1157651, 0, 30));
Rewards.Add(new CollectionItem(typeof(SlayerOfThePumpkinKingTitleDeed), 0x14F0, 1157650, 0, 50));
Rewards.Add(new CollectionItem(typeof(SterlingSilverRing), 0x1F09, 1155606, 0, 50));
Rewards.Add(new CollectionItem(typeof(TalonsOfEscaping), 0x41D8, 1155682, 0, 50));
Rewards.Add(new CollectionItem(typeof(BootsOfEscaping), 0x1711, 1155607, 0, 50));
}
public static bool IsTokunoDyable(Type t)
{
return Rewards.FirstOrDefault(item => item.Type == t) != null;
}
}
}

View File

@@ -0,0 +1,366 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Server;
using Server.Mobiles;
using Server.Items;
using Server.Commands;
using Server.Gumps;
namespace Server.Engines.SorcerersDungeon
{
public class TOSDSpawner
{
public static void Initialize()
{
CommandSystem.Register("TOSDSpawner", AccessLevel.Administrator, e =>
{
if (e.Mobile is PlayerMobile)
{
if (Instance != null)
{
BaseGump.SendGump(new TOSDSpawnerGump((PlayerMobile)e.Mobile));
}
else
{
e.Mobile.SendMessage("This spawner is not set up at this time. Enabled Treasures of Sorcerer's Dungeon to enable the spawner.");
}
}
});
if (Instance != null)
{
Instance.BeginTimer();
}
}
public static TOSDSpawner Instance { get; set; }
public BaseCreature Boss { get; set; }
public int Index { get; set; }
public int KillCount { get; set; }
public List<BaseCreature> Spawn { get; set; }
public bool Spawning { get; set; }
public Timer Timer { get; set; }
public List<TOSDSpawnEntry> Entries { get; set; }
public TOSDSpawner()
{
Instance = this;
Entries = new List<TOSDSpawnEntry>();
Spawn = new List<BaseCreature>();
BuildEntries();
Activate();
}
private void Activate()
{
foreach (var rec in Entries.Select(e => e.SpawnArea))
{
IPooledEnumerable eable = Map.Ilshenar.GetItemsInBounds(rec);
foreach (Item item in eable)
{
if (item is XmlSpawner)
{
((XmlSpawner)item).DoReset = true;
}
}
}
}
public void Deactivate()
{
foreach (var rec in Entries.Select(e => e.SpawnArea))
{
IPooledEnumerable eable = Map.Ilshenar.GetItemsInBounds(rec);
foreach (Item item in eable)
{
if (item is XmlSpawner)
{
((XmlSpawner)item).DoRespawn = true;
}
}
}
EndTimer();
foreach (var bc in Spawn)
{
bc.Delete();
}
Instance = null;
}
public void BeginTimer()
{
EndTimer();
Timer = Timer.DelayCall(TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(1), OnTick);
Timer.Start();
}
public void EndTimer()
{
if (Timer != null)
{
Timer.Stop();
Timer = null;
}
}
private void OnTick()
{
if (Spawning)
{
return;
}
if (Boss != null && Boss.Deleted)
{
if (Index == Entries.Count - 1)
{
Index = 0;
}
else
{
Index++;
}
Reset();
}
else if (Boss == null && KillCount >= Entries[Index].ToKill)
{
DoSpawn(Entries[Index].Boss, true);
}
else if (Spawn.Count < Entries[Index].MaxSpawn && (Boss == null || Entries[Index].SpawnArea.Contains(Boss)))
{
Spawning = true;
Timer.DelayCall(TimeSpan.FromSeconds(Utility.RandomMinMax(3, 8)), () =>
{
DoSpawn(Entries[Index].Spawn[Utility.Random(Entries[Index].Spawn.Length)], false);
Spawning = false;
});
}
}
public void DoSpawn(Type t, bool boss)
{
var spawn = Activator.CreateInstance(t) as BaseCreature;
for (int i = 0; i < 20; i++)
{
var p = Map.Ilshenar.GetRandomSpawnPoint(Entries[Index].SpawnArea);
if (Map.Ilshenar.CanSpawnMobile(p))
{
spawn.MoveToWorld(p, Map.Ilshenar);
if (boss)
{
Boss = spawn;
}
else
{
AddSpawn(spawn);
}
return;
}
}
spawn.Delete();
}
public void AddSpawn(BaseCreature bc)
{
Spawn.Add(bc);
}
public void OnCreatureDeath(BaseCreature bc)
{
if (Spawn.Contains(bc))
{
Spawn.Remove(bc);
KillCount++;
}
}
public void Reset()
{
ColUtility.Free(Spawn);
Boss = null;
Spawning = false;
KillCount = 0;
EndTimer();
Timer.DelayCall(TimeSpan.FromMinutes(Utility.RandomMinMax(1, 3)), () =>
{
BeginTimer();
});
}
public void Serialize(GenericWriter writer)
{
writer.Write(0);
writer.Write(Boss);
writer.Write(KillCount);
writer.Write(Index);
writer.Write(Spawn.Count);
foreach (var bc in Spawn)
{
writer.Write(bc);
}
}
public void Deserialize(GenericReader reader)
{
reader.ReadInt(); // version
Boss = reader.ReadMobile() as BaseCreature;
KillCount = reader.ReadInt();
Index = reader.ReadInt();
int count = reader.ReadInt();
for(int i = 0; i < count; i++)
{
var bc = reader.ReadMobile() as BaseCreature;
if(bc != null)
{
AddSpawn(bc);
}
}
}
public void BuildEntries()
{
Entries.Add(new TOSDSpawnEntry(typeof(NightmareFairy), new Type[] { typeof(Zombie), typeof(Skeleton), typeof(Gargoyle), typeof(Lich), typeof(LichLord) }, new Rectangle2D(327, 26, 29, 32), 80, 15));
Entries.Add(new TOSDSpawnEntry(typeof(JackInTheBox), new Type[] { typeof(Zombie), typeof(Skeleton), typeof(Gargoyle), typeof(Lich), typeof(LichLord) }, new Rectangle2D(296, 10, 17, 26), 80, 15));
Entries.Add(new TOSDSpawnEntry(typeof(HeadlessElf), new Type[] { typeof(Zombie), typeof(Skeleton), typeof(Gargoyle), typeof(Lich), typeof(LichLord) }, new Rectangle2D(271, 4, 20, 33), 80, 15));
Entries.Add(new TOSDSpawnEntry(typeof(AbominableSnowman), new Type[] { typeof(Zombie), typeof(Skeleton), typeof(Gargoyle), typeof(Lich), typeof(LichLord) }, new Rectangle2D(227, 39, 21, 19), 80, 15));
Entries.Add(new TOSDSpawnEntry(typeof(TwistedHolidayTree), new Type[] { typeof(Zombie), typeof(Skeleton), typeof(Gargoyle), typeof(Lich), typeof(LichLord) }, new Rectangle2D(251, 68, 25, 32), 80, 15));
Entries.Add(new TOSDSpawnEntry(typeof(RabidReindeer), new Type[] { typeof(Zombie), typeof(Skeleton), typeof(Gargoyle), typeof(Lich), typeof(LichLord) }, new Rectangle2D(144, 5, 23, 19), 80, 15));
Entries.Add(new TOSDSpawnEntry(typeof(GarishGingerman), new Type[] { typeof(Zombie), typeof(Skeleton), typeof(Gargoyle), typeof(Lich), typeof(LichLord) }, new Rectangle2D(60, 53, 13, 34), 80, 15));
Entries.Add(new TOSDSpawnEntry(typeof(StockingSerpent), new Type[] { typeof(Zombie), typeof(Skeleton), typeof(Gargoyle), typeof(Lich), typeof(LichLord) }, new Rectangle2D(152, 48, 16, 23), 80, 15));
Entries.Add(new TOSDSpawnEntry(typeof(JackThePumpkinKing), new Type[] { typeof(Zombie), typeof(Skeleton), typeof(Gargoyle), typeof(Lich), typeof(LichLord) }, new Rectangle2D(291, 73, 37, 36), 80, 15));
}
}
public class TOSDSpawnEntry
{
public Type Boss { get; set; }
public Type[] Spawn { get; set; }
public Rectangle2D SpawnArea { get; set; }
public int ToKill { get; set; }
public int MaxSpawn { get; set; }
public TOSDSpawnEntry(Type boss, Type[] spawn, Rectangle2D area, int toKill, int maxSpawn)
{
Boss = boss;
Spawn = spawn;
SpawnArea = area;
ToKill = toKill;
MaxSpawn = maxSpawn;
}
}
public class TOSDSpawnerGump : BaseGump
{
public TOSDSpawnerGump(PlayerMobile pm)
: base(pm, 50, 50)
{
}
public override void AddGumpLayout()
{
AddBackground(0, 0, 500, 300, 9300);
AddHtml(0, 10, 500, 20, Center("Treasures of Sorcerer's Dungeon Spawner"), false, false);
var spawner = TOSDSpawner.Instance;
if (spawner == null)
{
AddHtml(10, 40, 150, 20, "Spawner Disabled", false, false);
}
else
{
int y = 60;
AddLabel(10, 40, 0, "Go");
AddLabel(40, 40, 0, "Boss");
AddLabel(240, 40, 0, "Current");
AddLabel(320, 40, 0, "Max");
AddLabel(400, 40, 0, "Killed");
for (int i = 0; i < spawner.Entries.Count; i++)
{
var entry = spawner.Entries[i];
var hue = i == spawner.Index ? "green" : "red";
AddButton(7, y, 1531, 1532, i + 100, GumpButtonType.Reply, 0);
AddHtml(40, y, 200, 20, Color(hue, entry.Boss.Name), false, false);
AddHtml(320, y, 80, 20, Color(hue, entry.MaxSpawn.ToString()), false, false);
if (hue == "green")
{
AddHtml(240, y, 80, 20, Color(hue, spawner.Spawn.Count.ToString()), false, false);
AddHtml(400, y, 80, 20, Color(hue, spawner.KillCount.ToString()), false, false);
}
else
{
AddHtml(240, y, 80, 20, Color(hue, "0"), false, false);
AddHtml(400, y, 80, 20, Color(hue, "0"), false, false);
}
y += 22;
}
}
}
public override void OnResponse(RelayInfo info)
{
if (info.ButtonID > 0)
{
int id = info.ButtonID - 100;
var spawner = TOSDSpawner.Instance;
if (spawner != null && id >= 0 && id < spawner.Entries.Count)
{
var entry = spawner.Entries[id];
do
{
var p = Map.Ilshenar.GetRandomSpawnPoint(entry.SpawnArea);
if (Map.Ilshenar.CanSpawnMobile(p))
{
User.MoveToWorld(p, Map.Ilshenar);
Refresh();
break;
}
}
while (true);
}
}
}
}
}