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,136 @@
using System;
using Server;
using Server.Mobiles;
using Server.Items;
using System.Linq;
namespace Server.Engines.TreasuresOfKotlCity
{
public class EnergyTileAddon : BaseAddon
{
public DateTime m_NextDeactivation;
[CommandProperty(AccessLevel.GameMaster)]
public DateTime NextDeactivation { get { return m_NextDeactivation; } set { m_NextDeactivation = value; } }
public override BaseAddonDeed Deed { get { return null; } }
[Constructable]
public EnergyTileAddon(int count, Direction direction)
{
int x = 0;
int y = 0;
for (int i = 0; i < count; i++)
{
if (i == 0)
{
AddComponent(new EnergyTileComponent(), x, y, 0);
}
else
{
Movement.Movement.Offset(direction, ref x, ref y);
AddComponent(new EnergyTileComponent(), x, y, 0);
}
}
DeactivateRandom();
}
private void DeactivateRandom()
{
EnergyTileComponent comp = Components[Utility.Random(Components.Count)] as EnergyTileComponent;
foreach (EnergyTileComponent component in Components.OfType<EnergyTileComponent>())
{
if (comp == component)
{
comp.Active = false;
m_NextDeactivation = DateTime.UtcNow + TimeSpan.FromMinutes(120);
}
else if (!component.Active)
{
component.Active = true;
}
}
}
public EnergyTileAddon(Serial serial)
: base(serial)
{
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write(0); // Version
writer.Write(m_NextDeactivation);
Timer.DelayCall(TimeSpan.FromSeconds(10), () =>
{
if (m_NextDeactivation < DateTime.UtcNow)
DeactivateRandom();
});
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
m_NextDeactivation = reader.ReadDateTime();
}
}
public class EnergyTileComponent : AddonComponent
{
private bool m_Active;
[CommandProperty(AccessLevel.GameMaster)]
public bool Active { get { return m_Active; } set { m_Active = value; } }
public EnergyTileComponent() : base(0x9B3A)
{
m_Active = true;
Hue = 2591;
}
public override bool OnMoveOver(Mobile m)
{
if (!m_Active)
return base.OnMoveOver(m);
if (m is PlayerMobile || (m is BaseCreature && ((BaseCreature)m).GetMaster() is PlayerMobile))
{
AOS.Damage(m, Utility.RandomMinMax(100, 150), false, 0, 0, 0, 0, 100);
m.FixedParticles(0x3818, 1, 11, 0x13A8, 0, 0, EffectLayer.Waist);
m.PlaySound(0x665);
}
return base.OnMoveOver(m);
}
public EnergyTileComponent(Serial serial)
: base(serial)
{
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write(0); // Version
writer.Write(m_Active);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
m_Active = reader.ReadBool();
}
}
}

View File

@@ -0,0 +1,354 @@
using System;
using Server;
using Server.Items;
using Server.Gumps;
namespace Server.Engines.TreasuresOfKotlCity
{
public class JournalDrSpector1 : BaseJournal
{
public override TextDefinition Body { get { return 1157036; } }
/*Week 1<br><br>As I begin my journey across this strange land, I am not completely sure how to proceed. My supplies are limited,
* so I will likely need to search for food or find people with whom to trade. I also worry about becoming lost in the wilds. This
* is dangerous, especially without any weapons.<br> <br>I have managed to identify several fixed constellations by which to align
* my sextant. It should give me the means to track my movements and map this new world. I plan to leave copies of my notes for
* others who may come after me. My journey started at 21<32> South 42<34> West. I plan to move north toward a settlement I saw from a
* tree at 8<> South 45<34> West.<br> <br>Week 2<br> <br>The Barako Tribe worship the strength of the Great Apes of this land of Eodon.
* They are a martial people; both sexes train as hunters and warriors. While they prefer to use bludgeoning weapons, one of their
* greatest heroes, Halawa, used a bow to rescue her infant daughter from a silverback gorilla. The tribe has built its home in the
* high trees.<br> <br>It seems that there is great animosity between the Barako and another tribe known as the Kurak. I am going to
* leave before I am caught in the middle of their conflict. I have learned of another settlement at 3<> North 62<36> West which may have
* answers.<br> <br>Week 3<br> <br>The Urali are a strange people. Their skin has a green tint, likely because of diet and dyes. The
* color matches the turtles that are common in the area. Their warriors carry shields made from discarded turtle shells. Like the
* Dragon Turtle they worship, all of their chieftains are women, the strongest shield duelists in the tribe. All of the shamans of
* the tribe are the male descendants of a Shaman named Wamap, who created the spells of protection they still use.<br><br>The Dragon
* Turtle did not seem as intelligent as the draconic creatures of legend, and will thus give me no answers, so I will head out in a
* few days to 17<31> North 54<35> West.*/
public override TextDefinition Title { get { return 1157034; } } // The Journal of Dr. Spector - Collection I
[Constructable]
public JournalDrSpector1()
{
}
public JournalDrSpector1(Serial serial)
: base(serial)
{
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write(0); // Version
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
}
}
public class JournalDrSpector2 : BaseJournal
{
public override TextDefinition Body { get { return 1157037; } }
/*Week 4<br><br>The Sakkhra both imitate and hunt the dinosaurs that thunder constantly in their section of Eodon. Given the great
* size of these creatures, the Sakkhra have chosen to use powerful bows to bring down the creatures from a distance. When the
* dinosaurs wander into their camp, the tribe forces the creature back with spears dipped in poison. In cases of stampede or
* attack, the tribe will also destroy the bridges across the rivers around their settlement. The tribe is the first I<>ve seen
* that grows crops, but they do not show the advancement needed to get me home.<br> <br>While I enjoyed my visit with the Sakkhra,
* I have decided to meet with the next of Eodon<6F>s tribes. The Sakkhra have warned me about the <20>spiritless tribe,<2C> but I believe
* I should have no problems. I will travel to 17<31> South 81<38> West.<br> <br>Week 5<br> <br>The Barrab are very much like the insects
* in desert below: organized, ruthless, and complicated. The Barrab worship the Myrmidex, a terrifying insect species that lives
* underneath Eodon. The visible entrances to their hive are gigantic. Even though the Barrab worship the insects and dress themselves
* in discarded carapaces, the Myrmidex are still aggressive to most humans. The worst criminals of the Barrab tribe are sacrificed
* to the drones in the sand pits below. Like the Myrmidex, the Barrab is a strict matriarchy. I did hear one story of a male shaman
* and chief named Balakai who ruled with the help of magic and alchemy, but I was unable to translate the ending of his story to my
* satisfaction. I did learn that female Barrab shamans get their power from something in the Myrmidex tunnels, though they seemed
* offended when I asked for more information.<br> <br>While the Myrmidex may have answers to my questions, or possibly a Moonstone
* to return me home, I do not wish to be eaten alive by such creatures. I will move on to 20<32> South 67<36> West.*/
public override TextDefinition Title { get { return 1157035; } } // The Journal of Dr. Spector - Collection II
[Constructable]
public JournalDrSpector2()
{
}
public JournalDrSpector2(Serial serial)
: base(serial)
{
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write(0); // Version
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
}
}
public class JournalDrSpector3 : BaseJournal
{
public override TextDefinition Body { get { return 1157054; } }
/*Week 6<br><br>The Kurak may be the rivals of the Barako tribe, but I did not feel any hostility directed at me. While they are
* proud of their tiger totem and the animal they emulate, they were not as cruel as these predator cats. I did manage to see a
* demonstration of the strange claws they use for hunting and combat, and I am glad I stayed on their good side. I learned about
* a strange ruin they avoid, something to do with their ancestors. It is to the east. I plan to visit it after I meet with the
* final tribe of Eodon at 40<34> South 41<34> West.<br><br>Week 7<br><br>The Jukari live among the lava flows in the shadow of a great
* volcanic range that blocks travel to the southeast. The tribe uses the fire and obsidian shards produced by the volcano as their
* weapons, believing these to be gifts from the spirits. I asked if any had traveled into the volcanic range, and they mentioned
* that one of their greatest chieftains walked into the mountains with a sacred hide that protected him from the volcano<6E>s poisonous
* gases. I don<6F>t believe the answers I seek can be found within the volcano. That leaves only the pyramid at 20<32>South 58<35> West.
* <br><br>Week 8<br><br>I have explored every ruin I have come across and spoken with all of the tribes. None can help me return
* through the Ethereal Void to my home. The cracked Moonstone I used to travel did not come with me, and unless I can find another
* one, I will be trapped here. From the ruins and people, I have learned a bit about various Eodon spirits in my time here:<br>Aphazz,
* spirit of emotion and strength<br>Motazz, spirit of battle<Br>Heluzz, spirit of knowledge and visions<br>Fabozz, spirit of nature
* and animals<br>Kukuzz, spirit of healing<br>What is strange is that the Pyramid does not show the symbols or images of any of
* these spirits. It is almost as if someone or something else built it. I must investigate further. I hope to find some way to the
* lower chambers of the Pyramid. */
public override TextDefinition Title { get { return 1157052; } } // The Journal of Dr. Spector - Collection III
[Constructable]
public JournalDrSpector3()
{
}
public JournalDrSpector3(Serial serial)
: base(serial)
{
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write(0); // Version
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
}
}
public class JournalDrSpector4 : BaseJournal
{
public override TextDefinition Body { get { return 1157055; } }
/*Week 9<br><br>In my travels around Eodon, I heard stories of the city of the World-Builders. While the passage at the top of the
* Pyramid was sealed, I found a crack near the base of the structure. As I shimmied into the narrow tunnel, I disturbed a stone
* that was holding up a wall. While I was able to avoid injury, the collapse blocked my way out of the Pyramid. With only a single
* torch, I started my exploration of the lost city. The city was filled with the bones and dried remains of different creatures. I
* recognized human and Myrmidex remains, but in all my time in Eodon, I saw nothing that matches the bipedal reptile skeletons in
* the tunnels. Are these what remain of the World-Builders? In the entire ruined city, only one large crystal had not been smashed
* when the city fell. The vibrant crystal gave off a shifting spectrum of light, and the air around it was charged with energy. It
* was hypnotic, and with no other choice, I put my hand against it. The light of the crystal became brighter and brighter. Even when
* my hand started to burn, I could not pull myself away. I heard a voice in my mind, speaking rapidly in a strange language. As I
* lost consciousness, one word stuck in my mind: Zipactriotl. I woke in a burning jungle clearing. Around me were dead or dying
* Myrmidex, and my hands were burning with a strange blue flame. I did not remember slaughtering those creatures, but I knew I had.
* The tribes had a saying, <20>Killing one Myrmidex brings the wrath of its thousand kin.<2E> How much wrath have I earned by killing so
* many?<br><br>Week 10<br><br>I am different now. My bones have reshaped themselves, and my skin is like armor. There is a charge of
* energy around me, constantly buzzing in my ears. I am blacking out more and more, and I am losing more and more of myself. With
* the changes, hidden parts of the city now allow me access. I have found what appears to be a sort of stasis chamber. I will put
* myself inside and hope someone can help me. */
public override TextDefinition Title { get { return 1157053; } } // The Journal of Dr. Spector - Collection IV
[Constructable]
public JournalDrSpector4()
{
}
public JournalDrSpector4(Serial serial)
: base(serial)
{
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write(0); // Version
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
}
}
public class HistoryOfTheGreatWok1 : BaseJournal
{
public override TextDefinition Body { get { return 1157060; } }
/*The Great Moonstone and the Destruction of the First Home<br><br>Spoken by the Memory of Katalkotl<br><br>Transcribed by Professor
* Ellie Rafkin<br><br>Eodon was not the cradle of the Kotl. Before, there was Akaktolan, the First Home. While much is forgotten,
* it was there where the Kotl learned the fundamentals of magic and lore. The First Home was struck by a great meteorite, and the
* world slipped into an ice age. Those Kotl who survived traveled across the wastes, seeking the source of their suffering. In the
* center of a huge crater, they found a large tenebrous moonstone. The blackrock artifact bent the very shadows around it. All the
* Kotl recognized the raw magic before them. Some shunned the moonstone, turning and walking back into the cold, never to be seen
* again. They were the Mixkotl, the Lost. The rest remained with the moonstone, hoping to unlock its secrets before the end came.
* In the frozen crater, each day of study claimed another life, but eventually, the Kotl learned to wield the moonstone<6E>s power.
* They used it to grasp and manipulate frayed threads of existence. They knit together pieces from before the First Home<6D>s destruction
* into a new world - Eodon. Eodon presented refuge from the cold desolation Akaktolan had become, so the Kotl stepped across the
* threshold into the new reality. When they left, they took the Great Moonstone with them, thus closing the door to the First Home
* forever. */
public override TextDefinition Title { get { return 1157056; } } // History of the Great Work I
[Constructable]
public HistoryOfTheGreatWok1()
{
}
public HistoryOfTheGreatWok1(Serial serial)
: base(serial)
{
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write(0); // Version
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
}
}
public class HistoryOfTheGreatWok2 : BaseJournal
{
public override TextDefinition Body { get { return 1157061; } }
/*The Founding of Kotlan and the Myrmidex<br><br>Spoken by the Memory of Katalkotl<br><br>Transcribed by Professor Ellie Rafkin<br><br>
* While the valley of Eodon was warm and filled with bountiful life and food, it was still untamed and wild. The Kotl wished to r
* ebuild their civilization, so they bored into the earth to tap veins of iron and gold. These tunnels became the oldest parts of
* their city, running for miles under Eodon. To help with the work, they constructed huge golden golems. Powered by the Great
* Moonstone, the Kotl automatons were tireless workers. Soon, the city of Kotlan was a shining marvel at the heart of Eodon. After
* the city was completed, the Kotl settled into a life made easier by the magic of the moonstone. However, they wished to be free
* of all toil. They could never construct or empower enough automatons to take care of every task in the city, so they searched for
* new servants. Finding no intelligent creatures in the world, they decided to create a servitor race. Using the Nowlotl crystal to
* tap into the moonstone<6E>s power and select distant future variations, the Kotl bred such servants from ants. The Myrmidex were this
* failed experiment. The Kotl thought that the Myrmidex might inherit the industrious nature of the ants, but instead, they gained
* only the ants<74> warlike nature. The Myrmidex broke free of their captivity and fled the city of the Kotl. Thus, the World-Builders
* were forced to look elsewhere for their labor.*/
public override TextDefinition Title { get { return 1157057; } } // History of the Great Work II
[Constructable]
public HistoryOfTheGreatWok2()
{
}
public HistoryOfTheGreatWok2(Serial serial)
: base(serial)
{
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write(0); // Version
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
}
}
public class HistoryOfTheGreatWok3 : BaseJournal
{
public override TextDefinition Body { get { return 1157062; } }
/*The Worldwalker and Humanity<br><br>Spoken by the Memory of Katalkotl<br><br>Transcribed by Professor Ellie Rafkin<br><br>After
* the failure of the Myrmidex, the Kotl took more care in their manipulation of living things. They turned the power of the
* moonstone outward beyond Eodon. They constructed the Moon Chamber as a focal point for all of Eodon<6F>s mana. The artificial origin
* of Eodon made travel across the void between worlds difficult. However, with the awesome power of the Great Moonstone, it was
* possible. The Kotl sent their bravest general out across the Ethereal Void: Katalkotl the Worldwalker. He and his warriors traveled
* to dozens of worlds, bringing treasures and curiosities back to Eodon. Eventually, Katalkotl found several worlds with an
* intelligent, but less civilized, species called humans. With unrivalled magic and martial power, Katalkotl<74>s forces brought back
* humans to be servants to the Kotl. Because of the mercurial connection between Eodon and the outer worlds, the humans were from
* many different times and places. Since the Kotl language could not be spoken by the human voice box (and so the Kotl could keep
* the secrets of their power), the Kotl created a single language from various human tongues to communicate with their new servants.
* Out of awe and fear, most of the humans revered and served the World-Builders without complaint. Those of exceptional courage and
* honor even served as defenders of Kotlan. Still some humans rebelled against servitude. Many managed to flee the city of the Kotl.
* Some tried to resist openly and directly, only to be stopped by the automatons. A few succeeded in undermining the rulers of Eodon
* in secret.*/
public override TextDefinition Title { get { return 1157058; } } // History of the Great Work III
[Constructable]
public HistoryOfTheGreatWok3()
{
}
public HistoryOfTheGreatWok3(Serial serial)
: base(serial)
{
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write(0); // Version
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
}
}
public class HistoryOfTheGreatWok4 : BaseJournal
{
public override TextDefinition Body { get { return 1157063; } }
/*The Fall of the World-Builders<br><br>Spoken by the Memory of Katalkotl<br><br>Transcribed by Professor Ellie Rafkin<br><br>Initially,
* the Kotl viewed the escaped Myrmidex as a minor nuisance, like any other beast of Eodon. The Myrmidex should have been no threat to
* the Kotl, who protected their settlements with energy fields powered by the Great Moonstone. Still, the Myrmidex were persistent in
* their aggression. Eventually, the Kotl began planning to exterminate the ant hybrids. The Kotl attempted to grow a new version of
* the Myrmidex, hoping to breed passivity into the species. They planned to send empowered humans directly against the insects. The
* first of these was called Zipactriotl. While the weapon initially killed a countless number of the insects, the human mind inside
* grew dangerously unstable. Still, it was believed that beyond a few scattered insects in the wilds of Eodon, the species was extinct.
* Unfortunately, the Myrmidex queen had simply gone into hiding. In a subterranean hive, she produced a million eggs that hatched into
* an army. The intelligent insects had studied the Kotl and knew the source of their power. Mysteriously, the Myrmidex raided inside
* Kotlan and stole the Great Moonstone. If this initial strike disarmed the Kotl, the Myrmidex then proceeded to break the back of Kotl
* civilization. The surface portions of Kotlan were destroyed, so the World-Builders barricaded themselves in the city<74>s tunnels.
* Expecting to withstand the Myrmidex for months, the Kotl found themselves facing the Myrmidex in days. The insects destroyed
* everything in their path: every crystal, every relic, and any trace of Kotl magic. The Myrmidex killed everyone in the city, Kotl
* and human. Then the Myrmidex left, and the city closed up behind them.*/
public override TextDefinition Title { get { return 1157059; } } // History of the Great Work IV
[Constructable]
public HistoryOfTheGreatWok4()
{
}
public HistoryOfTheGreatWok4(Serial serial)
: base(serial)
{
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write(0); // Version
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
}
}
}

View File

@@ -0,0 +1,325 @@
using System;
using Server;
using Server.Mobiles;
using System.Collections.Generic;
using Server.ContextMenus;
using Server.Items;
namespace Server.Engines.TreasuresOfKotlCity
{
public class KotlBattleSimulator : Item, ISpawner
{
public static KotlBattleSimulator Instance { get; set; }
public static int Levels = 7;
public static Rectangle2D SpawnBounds = new Rectangle2D(500, 2272, 87, 71);
public static Type[] SpawnTypes = new Type[] { typeof(SpectralKotlWarrior), typeof(SpectralMyrmidexWarrior) };
public static TimeSpan BattleDuration = TimeSpan.FromMinutes(60);
public static TimeSpan NextSpawnDuration { get { return TimeSpan.FromSeconds(Utility.RandomMinMax(2, 25)); } }
private bool _Active;
[CommandProperty(AccessLevel.GameMaster)]
public bool Active
{
get { return _Active; }
set
{
bool active = _Active;
_Active = value;
if (!active && _Active)
{
StartSpawn();
}
}
}
[CommandProperty(AccessLevel.GameMaster)]
public int SpawnCount { get { return Spawn != null ? Spawn.Count : 0; } }
[CommandProperty(AccessLevel.GameMaster)]
public int Level { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public int Kills { get; set; }
public List<ISpawnable> Spawn { get; set; }
public bool UnlinkOnTaming { get { return true; } }
public Point3D HomeLocation { get { return new Point3D(544, 2303, 0); } }
public int HomeRange { get { return 30; } }
public int SpawnPerWave { get { return 10 + (Level * 2); } }
public int KillsPerWave { get { return 20 + (Level * 2); } }
public Timer Timer { get; set; }
public KotlBattleSimulator()
: base(40147)
{
Visible = false;
Movable = false;
Instance = this;
}
private void StartSpawn()
{
Kills = 0;
Level = 0;
StartTimer();
for (int i = 0; i < SpawnPerWave; i++)
{
Timer.DelayCall(NextSpawnDuration, DoSpawn);
}
}
public void StartTimer()
{
EndTimer();
Timer = Timer.DelayCall(BattleDuration, EndSimulation);
Timer.Start();
}
public void EndTimer()
{
if (Timer != null)
{
Timer.Stop();
Timer = null;
}
}
public virtual void GetSpawnProperties(ISpawnable spawn, ObjectPropertyList list)
{ }
public virtual void GetSpawnContextEntries(ISpawnable spawn, Mobile user, List<ContextMenuEntry> list)
{ }
public void Remove(ISpawnable spawn)
{
if (Spawn != null && Spawn.Contains(spawn))
{
Kills++;
Spawn.Remove(spawn);
if (Kills >= KillsPerWave)
{
if (Level >= Levels)
{
EndSimulation();
return;
}
else
{
IncreaseLevel();
}
}
Timer.DelayCall(NextSpawnDuration, DoSpawn);
}
}
private void IncreaseLevel()
{
int oldMaxCount = SpawnPerWave;
Level++;
Kills = 0;
int inc = SpawnPerWave - oldMaxCount;
if (inc > 0)
{
for (int i = 0; i < inc; i++)
{
Timer.DelayCall(NextSpawnDuration, DoSpawn);
}
}
}
public void EndSimulation()
{
EndTimer();
if (WheelsOfTime.Instance != null && (WheelsOfTime.Instance.RockBarrier == null || WheelsOfTime.Instance.RockBarrier.Deleted))
{
WheelsOfTime.Instance.RockBarrier = new KotlWallAddon();
}
WheelsOfTime.Instance.RockBarrier.MoveToWorld(WheelsOfTime.RockBarrierLocation, Map.TerMur);
if (WheelsOfTime.Instance != null)
{
WheelsOfTime.Instance.TimeWarpEnds = DateTime.UtcNow + TimeSpan.FromSeconds(10);
}
PowerCoreDockingStation.Stations.ForEach(station =>
{
station.Deactivate();
});
Active = false;
Level = 0;
Kills = 0;
// What about spawn?
ColUtility.Free(Spawn);
}
private void DoSpawn()
{
if (!_Active)
return;
Point3D loc;
do
{
loc = Map.TerMur.GetRandomSpawnPoint(SpawnBounds);
}
while (!Map.TerMur.CanSpawnMobile(loc));
bool strong = Map.Tiles.GetStaticTiles(loc.X, loc.Y, true).Length > 0;
BaseCreature bc;
switch (Utility.Random(2))
{
default:
case 0: bc = new SpectralKotlWarrior(strong); break;
case 1: bc = new SpectralMyrmidexWarrior(strong); break;
}
if (bc != null)
{
bc.Spawner = this;
bc.Home = HomeLocation;
bc.RangeHome = HomeRange;
bc.OnBeforeSpawn(loc, Map.TerMur);
bc.MoveToWorld(loc, Map.TerMur);
bc.OnAfterSpawn();
if (Spawn == null)
Spawn = new List<ISpawnable>();
Spawn.Add(bc);
}
}
public KotlBattleSimulator(Serial serial)
: base(serial)
{
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write(1); // Version
writer.Write(_Active);
writer.Write(Level);
writer.Write(Kills);
if (Spawn != null)
{
writer.Write(Spawn.Count);
Spawn.ForEach(sp => writer.Write(sp as Mobile));
}
else
{
writer.Write(0);
}
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
Instance = this;
_Active = reader.ReadBool();
Level = reader.ReadInt();
Kills = reader.ReadInt();
int count = reader.ReadInt();
for (int i = 0; i < count; i++)
{
BaseCreature bc = reader.ReadMobile() as BaseCreature;
if (bc != null)
{
bc.Spawner = this;
bc.Home = HomeLocation;
bc.RangeHome = HomeRange;
if (Spawn == null)
Spawn = new List<ISpawnable>();
Spawn.Add(bc);
}
}
if (_Active)
{
StartTimer();
if (Spawn == null || Spawn.Count == 0)
{
if (Spawn == null)
Spawn = new List<ISpawnable>();
if (Level >= Levels)
{
EndSimulation();
return;
}
else
{
IncreaseLevel();
}
}
else
{
int toSpawn = Math.Max(0, SpawnPerWave - (Spawn.Count + Kills));
if (toSpawn > 0)
{
for (int i = 0; i < toSpawn; i++)
{
Timer.DelayCall(NextSpawnDuration, DoSpawn);
}
}
}
}
// Teleporter Fix
if (version == 0)
{
Timer.DelayCall(TimeSpan.FromSeconds(20), () =>
{
if (Map != null)
{
IPooledEnumerable eable = Map.GetItemsInRange(new Point3D(644, 2308, 0), 0);
foreach (Item i in eable)
{
if (i is Teleporter)
{
((Teleporter)i).PointDest = new Point3D(543, 2479, 2);
}
}
}
});
}
}
}
}

View File

@@ -0,0 +1,243 @@
using System;
using Server;
using System.Collections.Generic;
using System.Linq;
using Server.Items;
namespace Server.Engines.TreasuresOfKotlCity
{
public class KotlCityPuzzle : BaseAddon
{
public static KotlCityPuzzle Puzzle { get; set; }
public override BaseAddonDeed Deed { get { return null; } }
[CommandProperty(AccessLevel.GameMaster)]
public int Next { get { return _Order == null || _Order.Count == 0 ? -1 : _Order[0]; } }
private List<int> _Order;
private int _Index;
private bool _Complete;
private int _Fails;
[CommandProperty(AccessLevel.GameMaster)]
public bool Complete
{
get { return _Complete; }
set
{
foreach (var comp in Components.OfType<KotlCityPuzzleComponent>().Where(c => (value && c.Active) || (!value && !c.Active)))
comp.Active = !value;
if (_Complete && !value)
{
RandomizeOrder();
}
_Complete = value;
}
}
public KotlCityPuzzle()
{
AddComponent(new KotlCityPuzzleComponent(), 0, 0, 0);
AddComponent(new KotlCityPuzzleComponent(), 1, 0, 0);
AddComponent(new KotlCityPuzzleComponent(), 2, 0, 0);
AddComponent(new KotlCityPuzzleComponent(), 3, 0, 0);
AddComponent(new KotlCityPuzzleComponent(), 4, 0, 0);
AddComponent(new KotlCityPuzzleComponent(), 5, 0, 0);
AddComponent(new KotlCityPuzzleComponent(), 6, 0, 0);
AddComponent(new KotlCityPuzzleComponent(), 7, 0, 0);
AddComponent(new KotlCityPuzzleComponent(), 8, 0, 0);
AddComponent(new KotlCityPuzzleComponent(), 9, 0, 0);
Puzzle = this;
Reset();
}
private void RandomizeOrder()
{
_Order = new List<int>();
var list = new List<int> { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
int count = Utility.RandomMinMax(5, 10);
int ran = 0;
do
{
ran = list[Utility.Random(list.Count)];
_Order.Add(ran);
list.Remove(ran);
}
while (_Order.Count < count);
ColUtility.Free(list);
}
private void Reset()
{
Complete = false;
_Index = 0;
_Fails = 0;
}
public override void OnComponentUsed(AddonComponent component, Mobile from)
{
if (_Complete || !from.InRange(component, 2))
return;
if (_Order == null)
{
RandomizeOrder();
}
KotlCityPuzzleComponent comp = component as KotlCityPuzzleComponent;
if (comp != null && comp.Active)
{
if (comp.Offset.X == _Order[_Index])
{
comp.Active = false;
_Fails = 0;
from.PrivateOverheadMessage(Server.Network.MessageType.Regular, 1154, 1157028, from.NetState); // *You activate the switch!*
if (_Order.Count - 1 == _Index)
{
Complete = true;
if (KotlDoor.Instance != null)
{
KotlDoor.Instance.Locked = false;
from.PrivateOverheadMessage(Server.Network.MessageType.Regular, 1154, 1157019, from.NetState); // *You hear a low hum as the door to the Time Room unseals...*
from.PlaySound(0x667);
Timer.DelayCall(TimeSpan.FromMinutes(5), () =>
{
KotlDoor.Instance.Locked = true;
KotlDoor.Instance.KeyValue = Key.RandomValue();
Reset();
});
}
}
else
{
_Index++;
}
}
else
{
_Fails++;
AOS.Damage(from, Utility.RandomMinMax(100, 150), false, 0, 0, 0, 0, 100);
from.FixedParticles(0x3818, 1, 11, 0x13A8, 0, 0, EffectLayer.Waist);
from.PlaySound(0x665);
from.PrivateOverheadMessage(Server.Network.MessageType.Regular, 1154, 1157029, from.NetState); // *The switch shorts out and electrocutes you! You are vulnerable to more energy damage in your shocked state!*
if (_Fails > 5 && _Fails > Utility.Random(15))
{
component.PrivateOverheadMessage(Server.Network.MessageType.Regular, 1154, 1157031, from.NetState); // *Circuit Fault! Generating new circuit sequence!*
Reset();
}
}
}
}
public KotlCityPuzzle(Serial serial)
: base(serial)
{
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write(0); // Version
writer.Write(Complete);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
Puzzle = this;
Complete = reader.ReadBool();
if (!_Complete)
Reset();
else
{
Timer.DelayCall(TimeSpan.FromMinutes(5), () =>
{
if (KotlDoor.Instance != null)
{
KotlDoor.Instance.Locked = true;
KotlDoor.Instance.KeyValue = Key.RandomValue();
}
Reset();
});
}
}
}
public class KotlCityPuzzleComponent : AddonComponent
{
public override int LabelNumber { get { return 1124182; } }
public bool _Active;
[CommandProperty(AccessLevel.GameMaster)]
public bool Active
{
get { return _Active; }
set
{
_Active = value;
if (_Active && ItemID != 0x9CDE)
{
Effects.PlaySound(this.Location, this.Map, 0x051);
ItemID = 0x9CDE;
}
else if (!_Active && ItemID != 0x9D0B)
{
Effects.PlaySound(this.Location, this.Map, 0x051);
ItemID = 0x9D0B;
}
}
}
public KotlCityPuzzleComponent()
: base(0x9CDE)
{
_Active = true;
}
public KotlCityPuzzleComponent(Serial serial)
: base(serial)
{
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write(0); // Version
writer.Write(_Active);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
_Active = reader.ReadBool();
}
}
}

View File

@@ -0,0 +1,60 @@
using System;
using Server;
using Server.Network;
using Server.Items;
namespace Server.Engines.TreasuresOfKotlCity
{
public class KotlDoor : MetalDoor
{
public static KotlDoor Instance { get; set; }
public KotlDoor()
: base(DoorFacing.EastCW)
{
Hue = 2591;
Locked = true;
KeyValue = Key.RandomValue();
if(Instance == null)
Instance = this;
}
public override void OnDoubleClick(Mobile from)
{
if (!from.InRange(this.GetWorldLocation(), 2))
{
from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
}
else if (Locked)
{
from.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1157017, from.NetState); // *The door is sealed shut. There is likely a switch that controls it nearby.*
}
else
{
Use(from);
}
}
public KotlDoor(Serial serial)
: base(serial)
{
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write(0); // Version
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
if(Instance == null)
Instance = this;
}
}
}

View File

@@ -0,0 +1,97 @@
using System;
using Server;
using Server.Items;
namespace Server.Engines.TreasuresOfKotlCity
{
public class KotlWallAddon : BaseAddon
{
public override BaseAddonDeed Deed { get { return null; } }
[Constructable]
public KotlWallAddon()
{
AddComplexComponent(this, 6270, -1, 3, 0, 2591, -1, "", 1);// 7
AddComplexComponent(this, 6270, -3, 4, 0, 2591, -1, "", 1);// 8
AddComplexComponent(this, 6270, -3, 2, 0, 2591, -1, "", 1);// 9
AddComplexComponent(this, 4943, -3, 1, 0, 2591, -1, "", 1);// 16
AddComplexComponent(this, 4944, -2, 1, 0, 2591, -1, "", 1);// 17
AddComplexComponent(this, 4954, 0, 1, 0, 2591, -1, "", 1);// 18
AddComplexComponent(this, 3117, 1, 4, 0, 2591, -1, "", 1);// 19
AddComplexComponent(this, 18129, 0, 5, 0, 2591, -1, "", 1);// 20
AddComplexComponent(this, 4958, -1, 2, 0, 2591, -1, "", 1);// 21
AddComplexComponent(this, 4957, -1, 3, 0, 2591, -1, "", 1);// 22
AddComplexComponent(this, 4956, -2, 4, 1, 2591, -1, "", 1);// 23
AddComplexComponent(this, 17864, 0, 6, 0, 2591, -1, "", 1);// 25
AddComplexComponent(this, 18116, 0, 2, 0, 2591, -1, "", 1);// 26
AddComplexComponent(this, 18129, 0, 3, 0, 2591, -1, "", 1);// 27
AddComplexComponent(this, 4954, -1, 1, 0, 2591, -1, "", 1);// 28
AddComplexComponent(this, 4954, -2, 6, 0, 2591, -1, "", 1);// 29
AddComplexComponent(this, 4955, -2, 5, 0, 2591, -1, "", 1);// 30
AddComplexComponent(this, 17850, 0, 7, 0, 2591, -1, "", 1);// 31
AddComplexComponent(this, 6270, -3, -3, 0, 2591, -1, "", 1);// 32
AddComplexComponent(this, 4945, -2, 0, 0, 2591, -1, "", 1);// 37
AddComplexComponent(this, 4954, -2, -4, 0, 2591, -1, "", 1);// 38
AddComplexComponent(this, 4955, -2, -5, 0, 2591, -1, "", 1);// 39
AddComplexComponent(this, 4955, 0, 0, 0, 2591, -1, "", 1);// 40
AddComplexComponent(this, 3117, 1, -7, 0, 2591, -1, "", 1);// 41
AddComplexComponent(this, 3117, -1, -1, 0, 2591, -1, "", 1);// 42
AddComplexComponent(this, 18129, 0, -5, 0, 2591, -1, "", 1);// 43
AddComplexComponent(this, 4949, -1, -4, 0, 2591, -1, "", 1);// 44
AddComplexComponent(this, 4955, -1, 0, 0, 2591, -1, "", 1);// 46
AddComplexComponent(this, 17864, 0, -6, 0, 2591, -1, "", 1);// 47
AddComplexComponent(this, 4952, -1, -2, 0, 2591, -1, "", 1);// 48
AddComplexComponent(this, 17850, 0, -7, 0, 2591, -1, "", 1);// 49
AddComplexComponent(this, 4953, -1, -3, 0, 2591, -1, "", 1);// 50
AddComplexComponent(this, 4950, -1, -5, 0, 2591, -1, "", 1);// 51
AddComplexComponent(this, 18111, 0, -4, 0, 2591, -1, "", 1);// 52
AddComplexComponent(this, 4951, -2, -1, 0, 2591, -1, "", 1);// 54
AddComplexComponent(this, 18116, 0, -2, 0, 2591, -1, "", 1);// 55
AddComplexComponent(this, 4948, -1, -7, 0, 2591, -1, "", 1);// 58
AddComplexComponent(this, 4947, -1, -6, 0, 2591, -1, "", 1);// 59
AddComplexComponent(this, 18129, 0, -1, 0, 2591, -1, "", 1);// 60
AddComplexComponent(this, 4962, -2, 7, 0, 2591, -1, "", 1);// 61
}
public KotlWallAddon(Serial serial)
: base(serial)
{
}
private static void AddComplexComponent(BaseAddon addon, int item, int xoffset, int yoffset, int zoffset, int hue, int lightsource)
{
AddComplexComponent(addon, item, xoffset, yoffset, zoffset, hue, lightsource, null, 1);
}
private static void AddComplexComponent(BaseAddon addon, int item, int xoffset, int yoffset, int zoffset, int hue, int lightsource, string name, int amount)
{
AddonComponent ac;
ac = new AddonComponent(item);
if (name != null && name.Length > 0)
ac.Name = name;
if (hue != 0)
ac.Hue = hue;
if (amount > 1)
{
ac.Stackable = true;
ac.Amount = amount;
}
if (lightsource != -1)
ac.Light = (LightType)lightsource;
addon.AddComponent(ac, xoffset, yoffset, zoffset);
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write(0); // Version
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
}
}
}

View File

@@ -0,0 +1,333 @@
using System;
using Server;
using System.Collections.Generic;
using Server.Items;
using System.Linq;
using Server.Mobiles;
namespace Server.Engines.TreasuresOfKotlCity
{
public class PowerCoreDockingStation : BaseAddon
{
public override BaseAddonDeed Deed { get { return null; } }
public static List<PowerCoreDockingStation> Stations { get; set; }
public InternalContainer Chest1 { get; set; }
public InternalContainer Chest2 { get; set; }
public bool Link { get; set; }
private bool _Active;
[CommandProperty(AccessLevel.GameMaster)]
public bool Active
{
get { return _Active; }
set
{
bool active = _Active;
_Active = value;
if (!active && _Active)
{
Activate();
}
else if (active && !_Active)
{
Deactivate();
}
}
}
[Constructable]
public PowerCoreDockingStation() : this(false)
{
}
[Constructable]
public PowerCoreDockingStation(bool link)
{
Link = link;
if (link)
AddStation();
AddComplexComponent(40157, 0, 0, 36, 0, 1124171);// 19
AddComplexComponent(40157, 1, 0, 36, 0, 1124171);// 20
AddComplexComponent(40157, 0, 1, 36, 0, 1124171);// 21
AddComplexComponent(40157, 1, 1, 36, 0, 1124171);// 22
AddComplexComponent(40146, 0, 0, 11, 2591, 1157023);// 23
AddComplexComponent(40173, 1, -1, 0, 2591);// 24
AddComplexComponent(40173, 2, 0, 0, 2591);// 24
AddComplexComponent(40174, 0, 2, 0, 2591);// 24
AddComplexComponent(39736, 1, 0, 11, 2591);// 25
AddComplexComponent(39728, 0, 1, 11, 2591);// 26
AddComplexComponent(39734, 1, 1, 11, 2591);// 27
AddComplexComponent(39730, 0, 0, 11, 2591);// 28
AddComplexComponent(39714, -1, -1, 0, 2591);// 29
AddComplexComponent(39713, -1, 1, 0, 2591);// 30
AddComplexComponent(39713, -1, 0, 0, 2591);// 31
AddComplexComponent(39712, 0, -1, 0, 2591);// 32
AddComplexComponent(39712, 1, -1, 0, 2591);// 33
AddComplexComponent(39713, 1, 0, 0, 2591);// 34
AddComplexComponent(39712, 0, 1, 0, 2591);// 35
AddComplexComponent(39711, 1, 1, 0, 2591);// 36
AddComponent(new AddonComponent(0x9CE5), -1, 2, 0);
Chest1 = new InternalContainer();
Chest1.Addon = this;
Chest2 = new InternalContainer();
Chest2.Addon = this;
}
public void AddStation()
{
if (Stations == null)
Stations = new List<PowerCoreDockingStation>();
if(!Stations.Contains(this))
Stations.Add(this);
}
public override void OnLocationChange(Point3D oldlocation)
{
base.OnLocationChange(oldlocation);
if (Chest1 != null && !Chest1.Deleted)
{
Chest1.MoveToWorld(new Point3D(this.X + 1, this.Y + 1, this.Z + 11), this.Map);
}
if (Chest2 != null && !Chest2.Deleted)
{
Chest2.MoveToWorld(new Point3D(this.X, this.Y + 1, this.Z + 11), this.Map);
}
}
public override void OnMapChange()
{
base.OnMapChange();
if (Chest1 != null)
Chest1.Map = this.Map;
if (Chest2 != null)
Chest2.Map = this.Map;
}
public void Activate()
{
if (Link && Stations != null && Stations.Where(s => s.Active).Count() == Stations.Count)
{
if (!KotlBattleSimulator.Instance.Active)
{
KotlBattleSimulator.Instance.Active = true;
Region r = Region.Find(KotlBattleSimulator.Instance.Location, Map.TerMur);
if (r != null)
{
foreach (PlayerMobile pm in r.GetEnumeratedMobiles().OfType<PlayerMobile>())
pm.SendLocalizedMessage(1157026); // [Kotl City Hologenerator]: Great Battle simulation now active! Proceed to city center!
}
}
}
foreach (var comp in Components)
{
if (comp.ItemID == 40146)
comp.ItemID = 40147;
if (comp.ItemID == 40173)
comp.ItemID = 40142;
if (comp.ItemID == 40174)
comp.ItemID = 40169;
}
}
public void Deactivate()
{
foreach (var comp in Components)
{
if (comp.ItemID == 40147)
comp.ItemID = 40146;
if (comp.ItemID == 40142)
comp.ItemID = 40173;
if (comp.ItemID == 40169)
comp.ItemID = 40174;
}
List<Item> delete = new List<Item>();
if (Chest1 != null)
{
delete.AddRange(Chest1.Items);
}
if (Chest2 != null)
{
delete.AddRange(Chest2.Items);
}
foreach (Item item in delete)
item.Delete();
_Active = false;
}
private void AddComplexComponent(int item, int xoffset, int yoffset, int zoffset, int hue, int localization = 0)
{
AddonComponent ac;
if (localization == 0)
{
ac = new AddonComponent(item);
}
else
{
ac = new LocalizedAddonComponent(item, localization);
}
if (hue != 0)
ac.Hue = hue;
AddComponent(ac, xoffset, yoffset, zoffset);
}
public override void Delete()
{
base.Delete();
if (Chest1 != null && !Chest1.Deleted)
{
Chest1.Delete();
}
if (Chest2 != null && !Chest2.Deleted)
{
Chest2.Delete();
}
if (Stations != null && Stations.Contains(this))
{
Stations.Remove(this);
}
}
public PowerCoreDockingStation(Serial serial)
: base(serial)
{
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write(0); // Version
writer.Write(_Active);
writer.Write(Chest1);
writer.Write(Chest2);
writer.Write(Link);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
_Active = reader.ReadBool();
Chest1 = reader.ReadItem() as InternalContainer;
Chest2 = reader.ReadItem() as InternalContainer;
Link = reader.ReadBool();
if (Link)
AddStation();
if (Chest1 != null)
Chest1.Addon = this;
if (Chest2 != null)
Chest2.Addon = this;
}
public class InternalContainer : BaseContainer
{
public PowerCoreDockingStation Addon { get; set; }
public InternalContainer() : base(16421)
{
Movable = false;
Hue = 2591;
}
public override bool OnDragDrop(Mobile from, Item dropped)
{
return CheckDrop(from, dropped);
}
public override bool OnDragDropInto(Mobile from, Item item, Point3D p)
{
return CheckDrop(from, item);
}
private bool CheckDrop(Mobile from, Item dropped)
{
if (dropped is StasisChamberPowerCore)
{
if (Addon != null && Addon.Active)
{
from.SendLocalizedMessage(1157025); // This power station is already active.
}
else if (Addon != null)
{
base.OnDragDrop(from, dropped);
dropped.Movable = false;
Addon.Active = true;
return true;
}
}
else
{
from.SendLocalizedMessage(1157024); // The docking station only accepts power cores.
}
return false;
}
public override void Delete()
{
base.Delete();
if (Addon != null && !Addon.Deleted)
{
Addon.Delete();
}
}
public InternalContainer(Serial serial)
: base(serial)
{
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write(0); // Version
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
}
}
}
}

View File

@@ -0,0 +1,188 @@
using System;
using Server;
using System.Collections.Generic;
using Server.Items;
namespace Server.Engines.TreasuresOfKotlCity
{
public class KotlRegalChest : LockableContainer, IRevealableItem
{
private Timer m_Timer;
public bool CheckWhenHidden { get { return true; } }
[Constructable]
public KotlRegalChest()
: base(0x4D0C)
{
Movable = false;
Locked = true;
Hue = 2591;
LiftOverride = true;
RequiredSkill = 90;
LockLevel = RequiredSkill - Utility.Random(1, 10);
MaxLockLevel = RequiredSkill;
TrapType = TrapType.MagicTrap;
TrapPower = 100;
Timer.DelayCall(TimeSpan.FromSeconds(1), Fill);
}
public virtual void Fill()
{
Reset();
List<Item> contains = new List<Item>(this.Items);
foreach (var item in contains)
{
item.Delete();
}
ColUtility.Free(contains);
for(int i = 0; i < Utility.RandomMinMax(6, 12); i++)
DropItem(Loot.RandomGem());
DropItem(new Gold(Utility.RandomMinMax(800, 1100)));
if (0.1 > Utility.RandomDouble())
{
DropItem(new StasisChamberPowerCore());
}
if (0.1 > Utility.RandomDouble())
{
DropItem(new CardOfSemidar((CardOfSemidar.CardType)Utility.RandomMinMax(0, 5)));
}
if (0.25 > Utility.RandomDouble())
{
DropItem(new InoperativeAutomatonHead());
}
if (0.1 > Utility.RandomDouble() && Server.Engines.Points.PointsSystem.TreasuresOfKotlCity.Enabled)
{
Item item = Loot.RandomArmorOrShieldOrWeaponOrJewelry(LootPackEntry.IsInTokuno(this), LootPackEntry.IsMondain(this), LootPackEntry.IsStygian(this));
if (item != null)
{
int min, max;
TreasureMapChest.GetRandomItemStat(out min, out max, 1.0);
RunicReforging.GenerateRandomItem(item, null, Utility.RandomMinMax(min, max), 0, ReforgedPrefix.None, ReforgedSuffix.Kotl, this.Map);
DropItem(item);
}
}
if (0.25 > Utility.RandomDouble())
{
Item item;
switch (Utility.Random(8))
{
default:
case 0: item = new JournalDrSpector1(); break;
case 1: item = new JournalDrSpector2(); break;
case 2: item = new JournalDrSpector3(); break;
case 3: item = new JournalDrSpector4(); break;
case 4: item = new HistoryOfTheGreatWok1(); break;
case 5: item = new HistoryOfTheGreatWok2(); break;
case 6: item = new HistoryOfTheGreatWok3(); break;
case 7: item = new HistoryOfTheGreatWok4(); break;
}
DropItem(item);
}
}
public void Reset()
{
EndTimer();
Visible = false;
Locked = true;
RequiredSkill = 90;
LockLevel = RequiredSkill - Utility.Random(1, 10);
MaxLockLevel = RequiredSkill;
TrapType = TrapType.MagicTrap;
TrapPower = 100;
}
public virtual bool CheckReveal(Mobile m)
{
return m.CheckTargetSkill(SkillName.DetectHidden, this, 80.0, 100.0);
}
public virtual void OnRevealed(Mobile m)
{
Visible = true;
}
public virtual bool CheckPassiveDetect(Mobile m)
{
if (m.InRange(this.Location, 4))
{
int skill = (int)m.Skills[SkillName.DetectHidden].Value;
if (skill >= 80 && Utility.Random(300) < skill)
return true;
}
return false;
}
public override void LockPick(Mobile from)
{
TryDelayedLock();
base.LockPick(from);
}
public KotlRegalChest(Serial serial)
: base(serial)
{
}
public void TryDelayedLock()
{
if(Locked || (m_Timer != null && m_Timer.Running))
return;
EndTimer();
m_Timer = Timer.DelayCall(TimeSpan.FromMinutes(Utility.RandomMinMax(10, 15)), Fill);
}
public void EndTimer()
{
if(m_Timer != null)
{
m_Timer.Stop();
m_Timer = null;
}
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write(0); // Version
TryDelayedLock();
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
TryDelayedLock();
}
}
}

View File

@@ -0,0 +1,467 @@
using System;
using Server;
using Server.Mobiles;
using Server.Gumps;
using Server.Network;
namespace Server.Items
{
[FlipableAddon(Direction.South, Direction.East)]
public class SkeletalHangmanAddon : BaseAddon
{
private Mobile _Clicker;
public override BaseAddonDeed Deed { get { return new SkeletalHangmanAddonDeed(); } }
[Constructable]
public SkeletalHangmanAddon()
: this(null)
{
}
public SkeletalHangmanAddon(Mobile clicker)
{
_Clicker = clicker;
AddComponent(new AddonComponent(0x9D39), 0, 0, 0);
AddComponent(new InternalComponent(0x9D38), 0, 1, 0);
}
public virtual void Flip(Mobile from, Direction direction)
{
switch (direction)
{
case Direction.South:
AddComponent(new AddonComponent(0x9D39), 0, 0, 0);
AddComponent(new InternalComponent(0x9D38), 0, 1, 0);
break;
case Direction.East:
AddComponent(new AddonComponent(0x9D3B), 0, 0, 0);
AddComponent(new InternalComponent(0x9D3A), 1, 0, 0);
break;
}
}
public class InternalComponent : AddonComponent
{
public override bool ForceShowProperties { get { return true; } }
public InternalComponent(int id) : base(id)
{
}
public override void AddNameProperty(ObjectPropertyList list)
{
SkeletalHangmanAddon addon = Addon as SkeletalHangmanAddon;
if (addon._Clicker != null)
{
list.Add(1156983, addon._Clicker.Name);
}
else
{
list.Add(1156982);
}
}
public InternalComponent(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();
}
}
public SkeletalHangmanAddon(Serial serial)
: base(serial)
{
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write(0);
writer.Write(_Clicker);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
_Clicker = reader.ReadMobile();
}
}
public class SkeletalHangmanAddonDeed : BaseAddonDeed
{
public override int LabelNumber { get { return 1156982; } } // Skeletal Hangman
public override BaseAddon Addon { get { return new SkeletalHangmanAddon(_Clicker); } }
private Mobile _Clicker;
[Constructable]
public SkeletalHangmanAddonDeed()
{
}
public override void OnDoubleClick(Mobile m)
{
_Clicker = m;
base.OnDoubleClick(m);
}
public SkeletalHangmanAddonDeed(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();
}
}
[FlipableAddon(Direction.South, Direction.East)]
public class KotlSacraficialAltarAddon : BaseAddon
{
public override BaseAddonDeed Deed { get { return new KotlSacraficialAltarAddonDeed(); } }
[Constructable]
public KotlSacraficialAltarAddon()
{
AddComponent(new AddonComponent(0x9D5F), 0, 0, 0);
AddComponent(new AddonComponent(0x9D60), 0, 1, 0);
AddComponent(new AddonComponent(0x9D61), 1, 0, 0);
AddComponent(new AddonComponent(0x9D62), 1, 1, 0);
}
public virtual void Flip(Mobile from, Direction direction)
{
switch (direction)
{
case Direction.East:
AddComponent(new AddonComponent(0x9D5F), 0, 0, 0);
AddComponent(new AddonComponent(0x9D60), 0, 1, 0);
AddComponent(new AddonComponent(0x9D61), 1, 0, 0);
AddComponent(new AddonComponent(0x9D62), 1, 1, 0);
break;
case Direction.South:
AddComponent(new AddonComponent(0x9D63), 0, 0, 0);
AddComponent(new AddonComponent(0x9D64), 1, 0, 0);
AddComponent(new AddonComponent(0x9D65), 0, 1, 0);
AddComponent(new AddonComponent(0x9D66), 1, 1, 0);
break;
}
}
public KotlSacraficialAltarAddon(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();
}
}
public class KotlSacraficialAltarAddonDeed : BaseAddonDeed
{
public override BaseAddon Addon { get { return new KotlSacraficialAltarAddon(); } }
public override int LabelNumber { get { return 1124311; } } // Kotl Sacrificial Altar
[Constructable]
public KotlSacraficialAltarAddonDeed()
{
}
public KotlSacraficialAltarAddonDeed(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();
}
}
public class TreasuresOfKotlRewardDeed : BaseRewardTitleDeed
{
private TextDefinition _Title;
public override TextDefinition Title { get { return _Title; } }
public TreasuresOfKotlRewardDeed(int localization)
{
_Title = localization;
}
public TreasuresOfKotlRewardDeed(Serial serial)
: base(serial)
{
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write(0);
TextDefinition.Serialize(writer, _Title);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
_Title = TextDefinition.Deserialize(reader);
}
}
public class KatalkotlsRing : SilverRing
{
public override int LabelNumber { get { return 1156989; } }
[Constructable]
public KatalkotlsRing()
{
Hue = 2591;
SkillBonuses.SetValues(0, SkillName.MagicResist, 10);
SkillBonuses.SetValues(1, SkillName.Meditation, 10);
Attributes.RegenHits = 5;
Attributes.RegenMana = 3;
Attributes.SpellDamage = 20;
}
public bool HasSkillBonus
{
get { return SkillBonuses.Skill_3_Value != 0; }
}
public override void OnDoubleClick(Mobile m)
{
if (IsChildOf(m.Backpack) && m is PlayerMobile && !HasSkillBonus)
{
BaseGump.SendGump(new ApplySkillBonusGump((PlayerMobile)m, SkillBonuses, Skills, 20, 2));
}
else
{
base.OnDoubleClick(m);
}
}
public override void GetProperties(ObjectPropertyList list)
{
base.GetProperties(list);
if (!HasSkillBonus)
{
list.Add(1155609); // Double Click to Set Skill Bonus
}
}
public static SkillName[] Skills =
{
SkillName.Necromancy,
SkillName.Magery,
SkillName.Bushido,
SkillName.Chivalry,
SkillName.Ninjitsu,
SkillName.Mysticism
};
public KatalkotlsRing(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();
}
}
public class BootsOfEscaping : ThighBoots
{
public override int LabelNumber { get { return 1155607; } } // Boots of Escaping
public BootsOfEscaping()
{
Attributes.BonusDex = 4;
Attributes.RegenStam = 1;
}
public BootsOfEscaping(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();
}
}
public class TalonsOfEscaping : LeatherTalons
{
public override int LabelNumber { get { return 1155682; } } // Talons of Escaping
public TalonsOfEscaping()
{
Attributes.BonusDex = 4;
Attributes.RegenStam = 1;
}
public TalonsOfEscaping(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();
}
}
public class TribalBanner : Item, IFlipable
{
public override int LabelNumber { get { return ItemID + 1084024; } }
public override bool ForceShowProperties { get { return true; } }
public int NorthID { get { return GetTribeID(_Tribe); } }
public int WestID { get { return GetTribeID(_Tribe) + 1; } }
private EodonTribe _Tribe;
[CommandProperty(AccessLevel.GameMaster)]
public EodonTribe Tribe
{
get { return _Tribe; }
set
{
_Tribe = value;
int id = GetTribeID(_Tribe);
if (ItemID != id)
ItemID = id;
InvalidateProperties();
}
}
[Constructable]
public TribalBanner(EodonTribe tribe) : base(GetTribeID(tribe))
{
_Tribe = tribe;
}
public static int GetTribeID(EodonTribe tribe)
{
switch (tribe)
{
default:
case EodonTribe.Jukari: return 0x9D53;
case EodonTribe.Kurak: return 0x9D55;
case EodonTribe.Barako: return 0x9D57;
case EodonTribe.Sakkhra: return 0x9D59;
case EodonTribe.Barrab: return 0x9D5B;
case EodonTribe.Urali: return 0x9D5D;
}
}
public void OnFlip(Mobile from)
{
// lets make sure we have the right ID before we begin
int id = ItemID;
if (id != WestID && id != NorthID)
{
id = WestID;
}
if (id == WestID)
ItemID = NorthID;
else
ItemID = WestID;
}
public TribalBanner(Serial serial)
: base(serial)
{
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write(0);
writer.Write((int)_Tribe);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
_Tribe = (EodonTribe)reader.ReadInt();
}
}
}

View File

@@ -0,0 +1,140 @@
using System;
using Server;
using Server.Items;
using Server.Network;
namespace Server.Engines.TreasuresOfKotlCity
{
public class WheelsOfTime : Item
{
public static TimeSpan TimeWarpDuration = TimeSpan.FromHours(2); // Duration in which you have to activate spawn to do the spawn
public static Point3D RockBarrierLocation = new Point3D(584, 2399, 0);
public static WheelsOfTime Instance { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public BaseAddon RockBarrier { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public DateTime TimeWarpEnds { get; set; }
public Timer Timer { get; set; }
public override int LabelNumber { get { return 1157032; } } // Wheels of Time
public WheelsOfTime()
: base(0x9CEF)
{
Hue = 2655;
Movable = false;
Instance = this;
RockBarrier = new KotlWallAddon();
RockBarrier.MoveToWorld(RockBarrierLocation, Map.TerMur);
TimeWarpEnds = DateTime.MinValue;
}
public override void OnDoubleClick(Mobile from)
{
if (!from.InRange(this.GetWorldLocation(), 1))
{
from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
}
else if (TimeWarpEnds != DateTime.MinValue)
{
from.SendLocalizedMessage(1157021); // The wheels of time have already been set in motion.
}
else
{
from.PrivateOverheadMessage(Server.Network.MessageType.Regular, 1154, 1157020, from.NetState);
from.PlaySound(0x0FF);
ActivateTimeWarp();
}
}
public void ActivateTimeWarp()
{
if (RockBarrier != null)
{
RockBarrier.MoveToWorld(new Point3D(RockBarrier.X, RockBarrier.Y, RockBarrier.Z - 50), Map.TerMur);
}
TimeWarpEnds = DateTime.UtcNow + TimeWarpDuration;
Timer = Timer.DelayCall(TimeSpan.FromMinutes(1), TimeSpan.FromMinutes(1), OnTick);
}
private void OnTick()
{
if (TimeWarpEnds < DateTime.UtcNow)
{
if (Timer != null)
{
Timer.Stop();
Timer = null;
}
Cleanup();
}
}
private void Cleanup()
{
TimeWarpEnds = DateTime.MinValue;
if (KotlBattleSimulator.Instance != null && KotlBattleSimulator.Instance.Active)
{
KotlBattleSimulator.Instance.EndSimulation();
}
if (RockBarrier != null && RockBarrier.Location != RockBarrierLocation)
{
RockBarrier.MoveToWorld(RockBarrierLocation, Map.TerMur);
}
}
public WheelsOfTime(Serial serial)
: base(serial)
{
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write(0); // Version
writer.Write(RockBarrier);
writer.Write(TimeWarpEnds);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
Instance = this;
RockBarrier = reader.ReadItem() as BaseAddon;
TimeWarpEnds = reader.ReadDateTime();
if (TimeWarpEnds != DateTime.MinValue)
{
if (TimeWarpEnds > DateTime.UtcNow)
{
Timer = Timer.DelayCall(TimeSpan.FromMinutes(1), TimeSpan.FromMinutes(1), OnTick);
}
else
{
Timer.DelayCall(TimeSpan.FromSeconds(60), Cleanup);
}
}
if (RockBarrier == null)
{
RockBarrier = new KotlWallAddon();
RockBarrier.MoveToWorld(RockBarrierLocation, Map.TerMur);
}
}
}
}