diff --git a/Data/Spawns/camps.map b/Data/Spawns/camps.map new file mode 100644 index 0000000..da9c9ab --- /dev/null +++ b/Data/Spawns/camps.map @@ -0,0 +1,2 @@ +*|brigandcamp||||||821|225|10|1|5|10|-1|4|1|1|0|0|0|0|0 +*|orccamp||||||821|360|3|1|5|10|-1|4|1|1|0|0|0|0|0 diff --git a/Data/Spawns/overworld.map b/Data/Spawns/overworld.map new file mode 100644 index 0000000..4e67cf9 --- /dev/null +++ b/Data/Spawns/overworld.map @@ -0,0 +1,51 @@ +*|spawnbirds|spawncritters|spawnanimals|spawn_a|spawn_b|spawn_c|530|160|0|1|5|10|-1|100|1|50|30|30|10|0|0 +*|spawnbirds|spawncritters|spawnanimals|spawn_a|spawn_b|spawn_c|530|610|0|1|5|10|-1|100|1|50|30|30|15|0|0 +*|spawnbirds|spawncritters|spawnanimals|spawn_a|spawn_b|spawn_c|530|460|0|1|5|10|-1|100|1|50|30|30|15|0|0 +*|spawnbirds|spawncritters|spawnanimals|spawn_a|spawn_b|spawn_c|680|160|0|1|5|10|-1|100|1|50|30|30|15|0|0 +*|spawnbirds|spawncritters|spawnanimals|spawn_a|spawn_b|spawn_c|530|309|47|1|5|10|-1|100|1|50|30|30|15|0|0 +*|spawnbirds|spawnanimals|spawncritters|spawn_a|||852|872|0|1|5|10|-1|50|1|20|10|10|10|0|0 +*|spawnbirds|spawncritters|spawnanimals|spawn_a|spawn_b|spawn_c|380|310|2|1|5|10|-1|100|1|50|30|30|15|0|0 +*|spawnbirds|spawncritters|spawnanimals|spawn_a|spawn_b|spawn_c|831|787|0|1|5|10|-1|80|1|50|30|30|15|0|0 +*|spawnbirds|spawncritters|spawnanimals|spawn_a|spawn_b|spawn_c|830|410|2|1|5|10|-1|50|1|30|20|20|10|0|0 +*|spawnbirds|spawncritters|spawnanimals|spawn_a|spawn_b|spawn_c|89|132|0|1|5|10|-1|100|1|50|30|30|15|0|0 +*|spawnbirds|spawncritters|spawnanimals|spawn_a|spawn_b|spawn_c|830|310|2|1|5|10|-1|100|1|50|30|30|15|0|0 +*|spawnbirds|spawncritters|spawnanimals|spawn_a|spawn_b|spawn_c|830|160|1|1|5|10|-1|100|1|50|30|30|15|0|0 +*|spawnbirds|spawncritters|spawnanimals|spawn_a|spawn_b|spawn_c|689|753|0|1|5|10|-1|50|1|30|15|15|10|0|0 +*|spawnbirds|spawncritters|spawnanimals|spawn_a|spawn_b|spawn_c|680|610|0|1|5|10|-1|50|1|30|15|15|10|0|0 +*|spawnbirds|spawncritters|spawnanimals|spawn_a|spawn_b|spawn_c|682|464|1|1|5|10|-1|100|1|50|30|30|15|0|0 +*|spawnbirds|spawncritters|spawnanimals|spawn_a|spawn_b|spawn_c|676|335|0|1|5|10|-1|100|1|50|30|30|15|0|5 +*|spawnbirds|spawncritters|spawnanimals|spawn_a|spawn_b|spawn_c|380|210|0|1|5|10|-1|100|1|50|30|30|15|10|0 +*|spawnbirds|spawnanimals|spawncritters|spawn_a|horse|llama|960|685|0|1|5|10|-1|50|1|20|10|10|5|1|1 +*|spawnbirds|spawnanimals|spawncritters|horse|llama||971|606|0|1|5|10|-1|20|1|15|5|5|1|1|0 +*|horse|llama|||||907|725|0|1|5|10|-1|20|1|1|1|0|0|0|0 +*|horse|llama|||||752|716|0|1|5|10|-1|20|1|1|1|0|0|0|0 +*|horse|llama|||||841|749|0|1|5|10|-1|20|1|1|1|0|0|0|0 +*|horse|llama|||||688|710|0|1|5|10|-1|20|1|1|1|0|0|0|0 +*|horse|llama|||||792|733|0|1|5|10|-1|20|1|1|1|0|0|0|0 +*|spawnbirds|spawnanimals|spawncritters|spawn_a|||282|400|0|1|5|10|-1|20|1|15|5|5|3|0|0 +*|spawnbirds|spawnanimals|spawncritters|spawn_a|||125|70|0|1|5|10|-1|20|1|15|5|5|3|0|0 +*|spawnbirds|spawnanimals|spawncritters|spawn_a|||197|382|0|1|5|10|-1|20|1|15|5|5|3|0|0 +*|spawnbirds|spawnanimals|spawncritters|spawn_a|||242|394|0|1|5|10|-1|20|1|15|5|5|3|0|0 +*|spawnbirds|spawnanimals|spawncritters|spawn_a|||122|123|0|1|5|10|-1|30|1|15|5|5|0|0|0 +*|spawnbirds|spawnanimals|spawncritters|spawn_a|||135|91|0|1|5|10|-1|30|1|15|5|5|0|0|0 +*|spawnbirds|spawnanimals|spawncritters|spawn_a|||394|864|1|1|5|10|-1|30|1|15|5|5|0|0|0 +*|spawnbirds|spawnanimals|spawncritters|spawn_a|||463|890|1|1|5|10|-1|30|1|15|5|5|0|0|0 +*|spawnbirds|spawnanimals|spawncritters|spawn_a|||452|952|20|1|5|10|-1|30|1|15|5|5|0|0|0 +*|spawnbirds|spawnanimals|spawncritters|spawn_a|||154|143|0|1|5|10|-1|30|1|15|5|5|3|0|0 +*|spawnbirds|spawnanimals|spawncritters|spawn_a|||452|1300|1|1|5|10|-1|30|1|15|5|5|0|0|0 +*|spawnbirds|spawnanimals|spawncritters|spawn_a|||149|1429|1|1|5|10|-1|30|1|15|5|5|0|0|0 +*|spawnbirds|spawnanimals|spawncritters|spawn_a|||615|1381|0|1|5|10|-1|30|1|15|5|5|3|0|0 +*|spawnbirds|spawnanimals|spawncritters|spawn_a|||571|1379|0|1|5|10|-1|30|1|15|5|5|3|0|0 +*|spawnbirds|spawnanimals|spawncritters|spawn_a|||512|1401|0|1|5|10|-1|30|1|15|5|5|3|0|0 +*|spawnbirds|spawnanimals|spawncritters|spawn_a|||135|120|0|1|5|10|-1|30|1|15|5|5|0|0|0 +*|spawnbirds|spawnanimals|spawncritters|spawn_a|||256|1343|0|1|5|10|-1|30|1|15|5|5|0|0|0 +*|spawnbirds|spawnanimals|spawncritters|spawn_a|||438|1357|2|1|5|10|-1|15|1|10|0|5|0|0|0 +*|spawnbirds|spawnanimals|spawncritters|spawn_a|||362|1413|1|1|5|10|-1|30|1|15|5|5|0|0|0 +*|spawnbirds|spawnanimals|spawncritters|spawn_a|||213|1433|1|1|5|10|-1|30|1|15|5|5|3|0|0 +*|spawnbirds|spawnanimals|spawncritters|spawn_a|||269|1441|1|1|5|10|-1|30|1|15|5|5|0|0|0 +*|spawnbirds|spawnanimals|spawncritters|spawn_a|||358|1462|3|1|5|10|-1|30|1|15|5|5|0|0|0 +*|spawnbirds|spawnanimals|spawncritters|spawn_a|||405|1437|1|1|5|10|-1|30|1|15|0|5|0|0|0 +*|spawnbirds|spawnanimals|spawncritters|spawn_a|spawn_d||870|1736|5|1|5|10|-1|30|1|5|5|5|5|2|0 +*|spawnbirds|spawnanimals|spawncritters|spawn_a|spawn_d||988|1674|3|1|5|10|-1|30|1|5|5|5|5|2|0 +*|spawnbirds|spawnanimals|spawncritters|spawn_a|spawn_d||997|1711|3|1|5|10|-1|30|1|5|5|5|5|2|0 +*|spawnbirds|spawncritters|spawnanimals|AncientWyrm|||931|1744|2|1|5|10|-1|20|1|3|3|3|1|0|0 diff --git a/Data/Spawns/townanimals.map b/Data/Spawns/townanimals.map index 03a0bcf..c50f3cd 100644 --- a/Data/Spawns/townanimals.map +++ b/Data/Spawns/townanimals.map @@ -1,45 +1,45 @@ -*|bird|cat|dog|rat|||855|636|0|1|5|10|-1|50|99|30|5|5|5|0|0 -*|bird||||||861|550|3|1|5|10|-1|10|99|5|0|0|0|0|0 -*|bird||||||871|490|0|1|5|10|-1|10|99|5|0|0|0|0|0 -*|bird||||||832|537|0|1|5|10|-1|10|99|5|0|0|0|0|0 -*|crane||||||822|535|0|1|5|10|5|2|99|1|0|0|0|0|0 -*|crane||||||824|546|0|1|5|10|5|2|99|1|0|0|0|0|0 -*|cow||||||871|570|0|1|5|10|1|0|99|1|0|0|0|0|0 -*|bull||||||868|570|0|1|5|10|1|0|99|1|0|0|0|0|0 -*|llama||||||865|570|0|1|5|10|1|0|99|1|0|0|0|0|0 -*|chicken||||||868|574|0|1|5|10|5|2|99|2|0|0|0|0|0 -*|horse||||||861|570|0|1|5|10|1|0|99|1|0|0|0|0|0 -*|bird|dog|cat|rat|||772|652|0|1|5|10|-1|25|99|15|2|2|2|0|0 -*|sheep||||||812|764|0|1|5|10|5|3|99|4|0|0|0|0|0 -*|chicken:sheep||||||849|853|0|1|5|10|4|2|99|4|0|0|0|0|0 -*|bird|cat|dog|rat|||324|1332|0|1|5|10|-1|30|99|20|3|2|2|0|0 -*|bird|cat|dog|rat|||352|1332|0|1|5|10|-1|30|99|20|3|2|2|0|0 -*|bird|cat|dog|rat|||382|1332|0|1|5|10|-1|30|99|20|3|2|2|0|0 -*|cow|bull|horse|chicken|llama|sheep|363|1347|0|1|5|10|-1|5|99|1|1|1|3|1|0 -*|cow|bull|horse|chicken|llama|sheep|358|1354|0|1|5|10|-1|5|99|1|1|1|3|1|0 -*|cow|bull|horse|chicken|llama|sheep|372|1344|0|1|5|10|-1|5|99|1|1|1|3|1|0 -*|bird|cat|dog|rat|||393|936|0|1|5|10|-1|25|99|15|3|3|5|0|0 -*|bird|cat|dog|rat|||1247|365|0|1|5|10|-1|50|99|20|5|5|5|0|0 -*|bird|cat|dog|rat|||1288|291|0|1|5|10|-1|25|99|10|2|2|2|0|0 -*|bird|cat|dog|rat|||1209|431|0|1|5|10|-1|30|99|20|2|2|2|0|0 -*|bird|cat|dog||||1325|377|1|1|5|10|-1|25|99|15|2|2|0|0|0 -*|rat|bird|||||1339|390|1|1|5|10|-1|15|99|3|5|0|0|0|0 -*|rat|bird|||||1339|338|1|1|5|10|-1|15|99|3|5|0|0|0|0 -*|rat|bird|||||1354|360|1|1|5|10|-1|15|99|3|5|0|0|0|0 -*|bird|cat|dog|rat|||1449|793|30|1|5|10|-1|15|99|10|1|1|2|0|0 -*|bird|rat|cat||||1470|797|1|1|5|10|-1|10|99|5|2|1|0|0|0 -*|bird|rat|cat||||1469|762|1|1|5|10|-1|10|99|5|2|1|0|0|0 -*|bird|cat|dog|rat|||1435|826|31|1|5|10|-1|20|99|10|1|1|2|0|0 -*|bird|cat|dog|rat|||1377|826|31|1|5|10|-1|15|99|4|1|0|2|0|0 -*|bird|cat|dog|rat|||1378|748|30|1|5|10|-1|15|99|4|1|0|2|0|0 -*|bird|cat|dog|rat|||1413|743|30|1|5|10|-1|15|99|4|1|0|2|0|0 -*|bird|cat|dog|rat|||1436|761|30|1|5|10|-1|15|99|4|1|1|2|0|0 -*|bird|cat|dog|rat|||1672|1686|0|1|5|10|-1|35|99|20|3|3|6|0|0 -*|bird|rat|dog||||1564|120|2|1|5|10|-1|20|99|10|3|1|0|0|0 -*|bird|rat|dog|cat|||1753|227|2|1|5|10|-1|20|99|10|3|1|1|0|0 -*|llama||||||1781|204|7|1|5|10|1|0|99|1|0|0|0|0|0 -*|bird|rat|dog|cat|||1775|226|2|1|5|10|-1|15|99|10|2|1|1|0|0 -*|horse||||||1783|204|7|1|5|10|1|0|99|1|0|0|0|0|0 -*|cow||||||1786|204|7|1|5|10|1|0|99|1|0|0|0|0|0 -*|sheep|goat|||||1793|209|2|1|5|10|-1|4|99|4|2|0|0|0|0 -*|bird|cat|dog|rat|||1987|122|1|1|5|10|-1|20|99|10|2|2|4|0|0 +*|bird|cat|dog|rat|||855|636|0|1|5|10|-1|50|1|30|5|5|5|0|0 +*|bird||||||861|550|3|1|5|10|-1|10|1|5|0|0|0|0|0 +*|bird||||||871|490|0|1|5|10|-1|10|1|5|0|0|0|0|0 +*|bird||||||832|537|0|1|5|10|-1|10|1|5|0|0|0|0|0 +*|crane||||||822|535|0|1|5|10|5|2|1|1|0|0|0|0|0 +*|crane||||||824|546|0|1|5|10|5|2|1|1|0|0|0|0|0 +*|cow||||||871|570|0|1|5|10|1|0|1|1|0|0|0|0|0 +*|bull||||||868|570|0|1|5|10|1|0|1|1|0|0|0|0|0 +*|llama||||||865|570|0|1|5|10|1|0|1|1|0|0|0|0|0 +*|chicken||||||868|574|0|1|5|10|5|2|1|2|0|0|0|0|0 +*|horse||||||861|570|0|1|5|10|1|0|1|1|0|0|0|0|0 +*|bird|dog|cat|rat|||772|652|0|1|5|10|-1|25|1|15|2|2|2|0|0 +*|sheep||||||812|764|0|1|5|10|5|3|1|4|0|0|0|0|0 +*|chicken:sheep||||||849|853|0|1|5|10|4|2|1|4|0|0|0|0|0 +*|bird|cat|dog|rat|||324|1332|0|1|5|10|-1|30|1|20|3|2|2|0|0 +*|bird|cat|dog|rat|||352|1332|0|1|5|10|-1|30|1|20|3|2|2|0|0 +*|bird|cat|dog|rat|||382|1332|0|1|5|10|-1|30|1|20|3|2|2|0|0 +*|cow|bull|horse|chicken|llama|sheep|363|1347|0|1|5|10|-1|5|1|1|1|1|3|1|0 +*|cow|bull|horse|chicken|llama|sheep|358|1354|0|1|5|10|-1|5|1|1|1|1|3|1|0 +*|cow|bull|horse|chicken|llama|sheep|372|1344|0|1|5|10|-1|5|1|1|1|1|3|1|0 +*|bird|cat|dog|rat|||393|936|0|1|5|10|-1|25|1|15|3|3|5|0|0 +*|bird|cat|dog|rat|||1247|365|0|1|5|10|-1|50|1|20|5|5|5|0|0 +*|bird|cat|dog|rat|||1288|291|0|1|5|10|-1|25|1|10|2|2|2|0|0 +*|bird|cat|dog|rat|||1209|431|0|1|5|10|-1|30|1|20|2|2|2|0|0 +*|bird|cat|dog||||1325|377|1|1|5|10|-1|25|1|15|2|2|0|0|0 +*|rat|bird|||||1339|390|1|1|5|10|-1|15|1|3|5|0|0|0|0 +*|rat|bird|||||1339|338|1|1|5|10|-1|15|1|3|5|0|0|0|0 +*|rat|bird|||||1354|360|1|1|5|10|-1|15|1|3|5|0|0|0|0 +*|bird|cat|dog|rat|||1449|793|30|1|5|10|-1|15|1|10|1|1|2|0|0 +*|bird|rat|cat||||1470|797|1|1|5|10|-1|10|1|5|2|1|0|0|0 +*|bird|rat|cat||||1469|762|1|1|5|10|-1|10|1|5|2|1|0|0|0 +*|bird|cat|dog|rat|||1435|826|31|1|5|10|-1|20|1|10|1|1|2|0|0 +*|bird|cat|dog|rat|||1377|826|31|1|5|10|-1|15|1|4|1|0|2|0|0 +*|bird|cat|dog|rat|||1378|748|30|1|5|10|-1|15|1|4|1|0|2|0|0 +*|bird|cat|dog|rat|||1413|743|30|1|5|10|-1|15|1|4|1|0|2|0|0 +*|bird|cat|dog|rat|||1436|761|30|1|5|10|-1|15|1|4|1|1|2|0|0 +*|bird|cat|dog|rat|||1672|1686|0|1|5|10|-1|35|1|20|3|3|6|0|0 +*|bird|rat|dog||||1564|120|2|1|5|10|-1|20|1|10|3|1|0|0|0 +*|bird|rat|dog|cat|||1753|227|2|1|5|10|-1|20|1|10|3|1|1|0|0 +*|llama||||||1781|204|7|1|5|10|1|0|1|1|0|0|0|0|0 +*|bird|rat|dog|cat|||1775|226|2|1|5|10|-1|15|1|10|2|1|1|0|0 +*|horse||||||1783|204|7|1|5|10|1|0|1|1|0|0|0|0|0 +*|cow||||||1786|204|7|1|5|10|1|0|1|1|0|0|0|0|0 +*|sheep|goat|||||1793|209|2|1|5|10|-1|4|1|4|2|0|0|0|0 +*|bird|cat|dog|rat|||1987|122|1|1|5|10|-1|20|1|10|2|2|4|0|0 diff --git a/Scripts/Commands/BuildWorld.cs b/Scripts/Commands/BuildWorld.cs index b8f872d..dd5335d 100644 --- a/Scripts/Commands/BuildWorld.cs +++ b/Scripts/Commands/BuildWorld.cs @@ -62,8 +62,15 @@ namespace Server.Scripts.Commands CommandSystem.Handle(e.Mobile, String.Format("{0}Decorate", CommandSystem.Prefix)); CommandSystem.Handle(e.Mobile, String.Format("{0}SignGen", CommandSystem.Prefix)); CommandSystem.Handle(e.Mobile, String.Format("{0}TelGen", CommandSystem.Prefix)); + Console.WriteLine( "Spawning Overworld..."); + Server.SpawnGenerator.Parse( e.Mobile, "overworld.map" ); Console.WriteLine( "Spawning Town Animals..."); Server.SpawnGenerator.Parse( e.Mobile, "townanimals.map" ); + Console.WriteLine( "Spawning Camps..." ); + Server.SpawnGenerator.Parse( e.Mobile, "camps.map" ); + Console.WriteLine( "Spawning NPC's..." ); + Console.WriteLine( "Spawning Dungeons..." ); + Console.WriteLine( "The world has been built." ); } } } diff --git a/Scripts/Engines/Spawner/DynamicSpawner/SpawnList.cs b/Scripts/Engines/Spawner/DynamicSpawner/SpawnList.cs new file mode 100644 index 0000000..25a183c --- /dev/null +++ b/Scripts/Engines/Spawner/DynamicSpawner/SpawnList.cs @@ -0,0 +1,619 @@ +using System; +using Server; +using Server.Mobiles; +using Server.Misc; +using Server.Items; +using System.Collections.Generic; + +namespace Server +{ + public enum Terrain + { + None, Water, Cave, Dirt, Forest, Grass, Jungle, Rock, Sand, Swamp, Snow + } + + public class SpawnList + { +//--------------------------------- Critters -------------------------------------------- + + private static Type[] ForestCritters = new Type[] + { + typeof( Rat ), typeof( Rabbit ), typeof( Squirrel) + }; + + private static Type[] DesertCritters = new Type[] + { + typeof( Rabbit ), typeof( Rat ) + }; + + private static Type[] SnowCritters = new Type[] + { + typeof( Rabbit ), typeof( Squirrel ) + }; + + private static Type[] JungleCritters = new Type[] + { + typeof( Rat ) + }; + + private static Type[] FieldCritters = new Type[] + { + typeof( Rat ), typeof( Rabbit ), typeof( Squirrel ) + }; + + private static Type[] SwampCritters = new Type[] + { + typeof( Rat ), typeof( BullFrog ) + }; + + private static Type[] DirtCritters = new Type[] + { + typeof( Rat ) + }; + +//------------------------------------ Birds ----------------------------------------- + + private static Type[] ForestBirds = new Type[] + { + typeof( Bird ) + }; + + private static Type[] DesertBirds = new Type[] + { + typeof( Bird ) + }; + + private static Type[] SnowBirds = new Type[] + { + typeof( Bird ) + }; + + private static Type[] FieldBirds = new Type[] + { + typeof( Bird ) + }; + + private static Type[] JungleBirds = new Type[] + { + typeof( Bird ) + }; + + private static Type[] SwampBirds = new Type[] + { + typeof( Bird ) + }; + + private static Type[] DirtBirds = new Type[] + { + typeof( Bird ) + }; + +//---------------------------------------- Animals ---------------------------------------- + + private static Type[] ForestAnimals = new Type[] + { + typeof( BlackBear ), typeof( Boar ), typeof( BrownBear ), + typeof( Cougar ), typeof( GreatHart ), typeof( TimberWolf ), + typeof( GrizzlyBear), typeof( Hind ), typeof( GreyWolf ), + typeof( Eagle ) + }; + + private static Type[] JungleAnimals = new Type[] + { + typeof( Boar ), typeof( Gorilla ), typeof( Panther ), + }; + + private static Type[] FieldAnimals = new Type[] + { + typeof( BrownBear ), typeof( Goat ), typeof( MountainGoat ), + typeof( Cow ), typeof( Bull ), typeof( GreyWolf ), typeof( Hind ) + }; + + private static Type[] SnowAnimals = new Type[] + { + typeof( PolarBear ), typeof( SnowLeopard ), typeof( Hind ), typeof( GreatHart ), + typeof( Goat ), typeof( Walrus ), typeof( Rabbit ), typeof( WhiteWolf ), + typeof( MountainGoat ), typeof( Eagle ) + }; + + private static Type[] DesertAnimals = new Type[] + { + typeof( Rat ) + }; + + private static Type[] SwampAnimals = new Type[] + { + typeof( Boar ), typeof( BlackBear ), typeof( BullFrog ), typeof( SwampDragon ), + typeof( GreatHart ), typeof( GiantSerpent ), typeof( Alligator ), + typeof( Gaman ) + }; + + private static Type[] DirtAnimals = new Type[] + { + typeof( Boar ), typeof( BlackBear ), typeof( BrownBear ), typeof( GreyWolf ) + }; + +//-------------------------------------- Tier A------------------------------------------------ + + private static Type[] Dirt_A = new Type[] + { + typeof( Brigand ), typeof( Skeleton ), + typeof( Mongbat ), typeof( HeadlessOne ) + }; + + private static Type[] Forest_A = new Type[] + { + typeof( DireWolf ), typeof( GiantRat ), typeof( GiantSpider ), + typeof( GiantToad ), typeof( Ratman ), typeof( Mongbat ), + typeof( Corpser ), typeof( Snake ) + }; + + private static Type[] Jungle_A = new Type[] + { + typeof( Skeleton ), typeof( GiantSpider ), typeof( Snake ), + typeof( GiantRat ), typeof( VampireBat ), typeof( BullFrog ), + typeof( GiantSerpent ), typeof( Mongbat ) + }; + + private static Type[] Snow_A = new Type[] + { + typeof( FrostSpider ), typeof( IceSerpent ), typeof( IceSnake ) + }; + + private static Type[] Field_A = new Type[] + { + typeof( DireWolf ), typeof( Ratman ), typeof( Skeleton ), + typeof( GiantSpider ), typeof( Snake ), typeof( Orc ) + }; + + private static Type[] Desert_A = new Type[] + { + typeof( LavaSnake ), typeof( Skeleton ), typeof( Zombie ), + typeof( DeathwatchBeetleHatchling ) + }; + + private static Type[] Swamp_A = new Type[] + { + typeof( Alligator ), typeof( GiantRat ), typeof( Slime ), typeof( Mongbat ), + typeof( Corpser ), typeof( WhippingVine ) + }; + +//------------------------ Tier B ------------------------------------------------------- + + private static Type[] Dirt_B = new Type[] + { + typeof( SkeletalMage ), typeof( Ghoul ), + typeof( Gazer ), typeof( Gargoyle ), typeof( EarthElemental ) + }; + + private static Type[] Forest_B = new Type[] + { + typeof( Orc ), typeof( OrcCaptain ), typeof( Ratman ), + typeof( Ettin ), typeof( Ogre ), typeof( Troll ), + typeof( Reaper ) + }; + + private static Type[] Jungle_B = new Type[] + { + typeof( Lizardman ), typeof( GiantSerpent ) + }; + + private static Type[] Field_B = new Type[] + { + typeof( Ettin ), typeof( Ogre ), typeof( Troll ), typeof( Gazer ), typeof( DireWolf ) + }; + + private static Type[] Snow_B = new Type[] + { + typeof( IceSerpent ), typeof( SnowElemental ), typeof( FrostOoze ) + }; + + private static Type[] Desert_B = new Type[] + { + typeof( Scorpion ), typeof( HellCat ), typeof( LavaSerpent ), + typeof( LavaLizard ), typeof( HellHound ) + }; + + private static Type[] Swamp_B = new Type[] + { + typeof( Lizardman ), typeof( SwampTentacle ) + }; + +//----------------------------------- Tier C ------------------------------------- + + private static Type[] Dirt_C = new Type[] + { + typeof( Shade ), typeof( Spectre ), typeof( Wraith ), + typeof( AntLion ), typeof( Beetle ) + }; + + private static Type[] Forest_C = new Type[] + { + typeof( Drake ), typeof( OrcishLord ), typeof( RatmanArcher ) + }; + + private static Type[] Jungle_C = new Type[] + { + typeof( Cyclops ), typeof( Bogle ), typeof( Wisp ) + }; + + private static Type[] Field_C = new Type[] + { + typeof( Wisp ), typeof( AirElemental ), typeof( Cyclops ), + typeof( Centaur ) + }; + private static Type[] Snow_C = new Type[] + { + typeof( FrostTroll ), typeof( IceElemental ), + typeof( SnowElemental ) + }; + + private static Type[] Desert_C = new Type[] + { + typeof( GiantBlackWidow ), typeof( Mummy ), typeof( AntLion ), + typeof( SandVortex ), typeof( FireGargoyle ) + }; + + private static Type[] Swamp_C = new Type[] + { + typeof( OphidianMage ), + typeof( OphidianWarrior ), typeof( SwampDragon ) + }; + +//------------------------------------- Tier D ----------------------------------------- + + private static Type[] Dirt_D = new Type[] + { + typeof( Lich ) + }; + private static Type[] Forest_D = new Type[] + { + typeof( RatmanArcher ), typeof( Pixie ), typeof( RatmanMage ) + }; + + private static Type[] Jungle_D = new Type[] + { + typeof( SilverSerpent ) + }; + + private static Type[] Field_D = new Type[] + { + typeof( Centaur ), typeof( Titan ) + }; + + private static Type[] Snow_D = new Type[] + { + typeof( ArcticOgreLord ) + }; + + private static Type[] Desert_D = new Type[] + { + typeof( Dragon ) + }; + + private static Type[] Swamp_D = new Type[] + { + typeof( OphidianKnight ), typeof( AcidElemental ) + }; + +//------------------------------------- Tier E ------------------------------------------ + + private static Type[] Dirt_E = new Type[] + { + typeof( Daemon ), typeof( Dragon ) + }; + + private static Type[] Forest_E = new Type[] + { + typeof( Hiryu ), typeof( LesserHiryu ) + }; + + private static Type[] Jungle_E = new Type[] + { + typeof( Dragon ) + }; + + private static Type[] Field_E = new Type[] + { + typeof( Dragon ) + }; + + private static Type[] Snow_E = new Type[] + { + typeof( IceFiend ), typeof( WhiteWyrm ) + }; + + private static Type[] Desert_E = new Type[] + { + typeof( Succubus ) + }; + + private static Type[] Swamp_E = new Type[] + { + typeof( PoisonElemental ), typeof( AncientWyrm ) + }; + +//---------------------------- End of Mob Definitions -------------------------------------- + + public static Terrain GetTerrain( Map map, Point3D location, int x, int y ) + { + if ( map == Map.Internal || x < 0 || y < 0 ) + return Terrain.None; + + LandTile LTile = map.Tiles.GetLandTile( x, y ); + + int[] WaterTerrain = { 0x00A8, 0x00A9, 0x00AA, 0x00AB, 0x0136, 0x0138 }; + int[] CaveTerrain = { 0x024A, 0x024B, 0x024C, 0x024D, 0x024E, 0x024F, 0x0250, 0x0251, 0x0252, 0x0253, 0x0254, 0x0255, 0x0256, 0x0257, 0x0258, 0x0259, 0x025A, 0x025B, 0x025C, 0x025D, 0x025E, 0x025F, 0x0260, 0x0261, 0x0262, 0x0263, 0x0264, 0x0265, 0x0266, 0x0267, 0x0268, 0x0269, 0x026A, 0x026B, 0x026C, 0x026D, 0x02BC, 0x02BD, 0x02BE, 0x02BF, 0x02C0, 0x02C1, 0x02C2, 0x02C3, 0x02C4, 0x02C5, 0x02C6, 0x02C7, 0x02C8, 0x02C9, 0x02CA, 0x02CB, 0x0245, 0x0246, 0x0247, 0x0248, 0x0249, 0x063B, 0x063C, 0x063D, 0x063E }; + int[] DirtTerrain = { 0x008D, 0x008E, 0x008F, 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, 0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, 0x00DC, 0x00DD, 0x00DE, 0x00DF, 0x00E0, 0x00E1, 0x00E2, 0x00E3, 0x02D0, 0x02D1, 0x02D2, 0x02D3, 0x02D4, 0x02D5, 0x02D6, 0x02D7, 0x02E5, 0x02E6, 0x02E7, 0x02E8, 0x02E9, 0x02EA, 0x02EB, 0x02EC, 0x02ED, 0x02EE, 0x02EF, 0x02F0, 0x02F1, 0x02F2, 0x02F3, 0x02F4, 0x02F5, 0x02F6, 0x02F7, 0x02F8, 0x02F9, 0x02FA, 0x02FB, 0x02FC, 0x02FD, 0x02FE, 0x02FF, 0x0303, 0x0304, 0x0305, 0x0306, 0x0307, 0x0308, 0x0309, 0x030A, 0x030B, 0x030C, 0x030D, 0x030E, 0x030F, 0x0310, 0x0311, 0x0312, 0x0313, 0x0314, 0x0315, 0x0316, 0x0317, 0x0318, 0x0319, 0x031A, 0x031B, 0x031C, 0x031D, 0x031E, 0x031F, 0x06F4, 0x0777, 0x0778, 0x0779, 0x077A, 0x077B, 0x077C, 0x077D, 0x077E, 0x077F, 0x0780, 0x0781, 0x0782, 0x0783, 0x0784, 0x0785, 0x0786, 0x0787, 0x0788, 0x0789, 0x078A, 0x078B, 0x078C, 0x078D, 0x078E, 0x078F, 0x0790, 0x0791, 0x0071, 0x0072, 0x0073, 0x0074, 0x75, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x0082, 0x0083, 0x0085, 0x0086, 0x0087, 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x0141, 0x0142, 0x0143, 0x0144, 0x014C, 0x014D, 0x014E, 0x014F, 0x0169, 0x016A, 0x016B, 0x016C, 0x016D, 0x016E, 0x016F, 0x0170, 0x0171, 0x0172, 0x0173, 0x0174, 0x01DC, 0x01DD, 0x01DE, 0x01DF, 0x01E0, 0x01E1, 0x01E2, 0x01E3, 0x01E4, 0x01E5, 0x01E6, 0x01E7, 0x01EC, 0x01ED, 0x01EE, 0x01EF, 0x0272, 0x0273, 0x0274, 0x0275, 0x027E, 0x027F, 0x0280, 0x0281, 0x032C, 0x032D, 0x032E, 0x032F, 0x033D, 0x033E, 0x033F, 0x0340, 0x0345, 0x0346, 0x0347, 0x0348, 0x0349, 0x034A, 0x034B, 0x034C, 0x0355, 0x0356, 0x0357, 0x0358, 0x0367, 0x0368, 0x0369, 0x036A, 0x036B, 0x036C, 0x036D, 0x036E, 0x0377, 0x0378, 0x0379, 0x037A, 0x038D, 0x038E, 0x038F, 0x0390, 0x0395, 0x0396, 0x0397, 0x0398, 0x0399, 0x039A, 0x039B, 0x039C, 0x03A5, 0x03A6, 0x03A7, 0x03A8, 0x03F6, 0x03F7, 0x03F9, 0x03FA, 0x03FB, 0x03FC, 0x03FD, 0x03FE, 0x03FF, 0x0400, 0x0401, 0x0402, 0x0403, 0x0404, 0x0405, 0x0547, 0x0548, 0x0549, 0x054A, 0x054B, 0x054C, 0x054D, 0x054E, 0x0553, 0x0554, 0x0555, 0x0556, 0x0597, 0x0598, 0x0599, 0x059A, 0x059B, 0x059C, 0x059D, 0x059E, 0x0623, 0x0624, 0x0625, 0x0626, 0x0627, 0x0628, 0x0629, 0x062A, 0x062B, 0x062C, 0x062D, 0x062E, 0x062F, 0x0630, 0x0631, 0x0632, 0x0633, 0x0634, 0x0635, 0x0636, 0x0637, 0x0638, 0x0639, 0x063A, 0x06F3, 0x06F5, 0x06F6, 0x06F7, 0x06F8, 0x06F9, 0x06FA }; + int[] ForestTerrain = { 0x00ED, 0x00EE, 0x00EF, 0x3AF0, 0x3AF1, 0x3AF2, 0x3AF3, 0x3AF4, 0x3AF5, 0x3AF6, 0x3AF7, 0x3AF8, 0x00C4, 0x00C5, 0x00C6, 0x00C7, 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF, 0x00D0, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x00D7, 0x00F0, 0x00F1, 0x00F2, 0x00F3, 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x015D, 0x015E, 0x015F, 0x0160, 0x0161, 0x0162, 0x0163, 0x0164, 0x0165, 0x0166, 0x0167, 0x0168, 0x0324, 0x0325, 0x0326, 0x0327, 0x0328, 0x0329, 0x032A, 0x032B, 0x054F, 0x0550, 0x0551, 0x0552, 0x05F1, 0x05F2, 0x05F3, 0x05F4, 0x05F9, 0x05FA, 0x05FB, 0x05FC, 0x05FD, 0x05FE, 0x05FF, 0x0600, 0x0601, 0x0602, 0x0603, 0x0604, 0x0611, 0x0612, 0x0613, 0x0614, 0x0653, 0x0654, 0x0655, 0x0656, 0x065B, 0x065C, 0x065D, 0x065E, 0x065F, 0x0660, 0x0661, 0x0662, 0x066B, 0x066C, 0x066D, 0x066E, 0x06AF, 0x06B0, 0x06B1, 0x06B2, 0x06B3, 0x06B4, 0x06BB, 0x06BC, 0x06BD, 0x06BE, 0x0709, 0x070A, 0x070B, 0x070C, 0x0715, 0x0716, 0x0717, 0x0718, 0x0719, 0x071A, 0x071B, 0x071C }; + int[] GrassTerrain = { 0x0231, 0x0232, 0x0233, 0x0234, 0x0239, 0x023A, 0x023B, 0x023C, 0x023D, 0x023E, 0x023F, 0x0240, 0x0241, 0x06D2, 0x06D3, 0x06D4, 0x06D5, 0x06D6, 0x06D7, 0x06D8, 0x06D9, 0x3, 0x0004, 0x0005, 0x0006, 0x003B, 0x003C, 0x003D, 0x003E, 0x007D, 0x007E, 0x007F, 0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x01A4, 0x01A5, 0x01A6, 0x01A7, 0x0242, 0x0243, 0x036F, 0x0370, 0x0371, 0x0372, 0x0373, 0x0374, 0x0375, 0x0376, 0x037B, 0x037C, 0x037D, 0x037E, 0x03BF, 0x03C0, 0x03C1, 0x03C2, 0x03C3, 0x03C4, 0x03C5, 0x03C6, 0x03CB, 0x03CC, 0x03CD, 0x03CE, 0x0579, 0x057A, 0x057B, 0x057C, 0x057D, 0x057E, 0x057F, 0x0580, 0x058B, 0x058C, 0x05D7, 0x05D8, 0x05D9, 0x05DA, 0x05DB, 0x05DC, 0x05DD, 0x05DE, 0x05E3, 0x05E4, 0x05E5, 0x05E6, 0x067D, 0x067E, 0x067F, 0x0680, 0x0681, 0x0682, 0x0683, 0x0684, 0x0689, 0x068A, 0x068B, 0x068C, 0x0695, 0x0696, 0x0697, 0x0698, 0x0699, 0x069A, 0x069B, 0x069C, 0x06A1, 0x06A2, 0x06A3, 0x06A4, 0x06B5, 0x06B6, 0x06B7, 0x06B8, 0x06B9, 0x06BA, 0x06BF, 0x06C0, 0x06C1, 0x06C2, 0x06DE, 0x06DF, 0x06E0, 0x06E1 }; + int[] JungleTerrain = { 0x00EC, 0x00FC, 0x00FD, 0x00FE, 0x00FF, 0x072A, 0x00AC, 0x00AD, 0x00AE, 0x00AF, 0x00B0, 0x00B3, 0x00B6, 0x00B9, 0x00BC, 0x00BD, 0x00BE, 0x00BF, 0x0100, 0x0101, 0x0102, 0x0103, 0x0108, 0x0109, 0x010A, 0x010B, 0x01F0, 0x01F1, 0x01F2, 0x01F3, 0x026E, 0x026F, 0x0270, 0x0271, 0x0276, 0x0277, 0x0278, 0x0279, 0x027A, 0x027B, 0x027C, 0x027D, 0x0286, 0x0287, 0x0288, 0x0289, 0x0292, 0x0293, 0x0294, 0x0295, 0x0581, 0x0582, 0x0583, 0x0584, 0x0585, 0x0586, 0x0587, 0x0588, 0x0589, 0x058A, 0x058D, 0x058E, 0x058F, 0x0590, 0x059F, 0x05A0, 0x05A1, 0x05A2, 0x05A3, 0x05A4, 0x05A5, 0x05A6, 0x05B3, 0x05B4, 0x05B5, 0x05B6, 0x05B7, 0x05B8, 0x05B9, 0x05BA, 0x05F5, 0x05F6, 0x05F7, 0x05F8, 0x0605, 0x0606, 0x0607, 0x0608, 0x0609, 0x060A, 0x060B, 0x060C, 0x060D, 0x060E, 0x060F, 0x0610, 0x0615, 0x0616, 0x0617, 0x0618, 0x0727, 0x0728, 0x0729, 0x0733, 0x0734, 0x0735, 0x0736, 0x0737, 0x0738, 0x0739, 0x073A }; + int[] RockTerrain = { 0x00E4, 0x00E5, 0x00E6, 0x00E7, 0x00F4, 0x00F5, 0x00F6, 0x00F7, 0x0104, 0x0105, 0x0106, 0x0107, 0x0110, 0x0111, 0x0112, 0x0113, 0x0122, 0x0123, 0x0124, 0x0125, 0x01D3, 0x01D4, 0x01D5, 0x01D6, 0x01D7, 0x01D8, 0x01D9, 0x01DA, 0x021F, 0x0220, 0x0221, 0x0222, 0x0223, 0x0224, 0x0225, 0x0226, 0x0227, 0x0228, 0x0229, 0x022A, 0x022B, 0x022C, 0x022D, 0x022E, 0x022F, 0x0230, 0x0235, 0x0236, 0x0237, 0x0238, 0x06CD, 0x06CE, 0x06CF, 0x06D0, 0x06D1, 0x06DA, 0x06DB, 0x06DC, 0x06DD, 0x06EB, 0x06EC, 0x06ED, 0x06EE, 0x06EF, 0x06F0, 0x06F1, 0x06F2, 0x06FB, 0x06FC, 0x06FD, 0x06FE, 0x070E, 0x070F, 0x0710, 0x0711, 0x0712, 0x0713, 0x0714, 0x071D, 0x071E, 0x071F, 0x0720, 0x072B, 0x072C, 0x072D, 0x072E, 0x072F, 0x0730, 0x0731, 0x0732, 0x073B, 0x073C, 0x073D, 0x073E, 0x0749, 0x074A, 0x074B, 0x074C, 0x074D, 0x074E, 0x074F, 0x0750, 0x0759, 0x075A, 0x075B, 0x075C, 0x09EC, 0x09ED, 0x09EE, 0x09EF, 0x09F0, 0x09F1, 0x09F2, 0x09F3, 0x09F4, 0x09F5, 0x09F6, 0x09F7, 0x09F8, 0x09F9, 0x09FA, 0x09FB, 0x09FC, 0x09FD, 0x09FE, 0x09FF, 0x0A00, 0x0A01, 0x0A02, 0x0A03, 0x3F39, 0x3F3A, 0x3F3B, 0x3F3C, 0x3F3D, 0x3F3E, 0x3F3F, 0x3F40, 0x3F41, 0x3F42, 0x3F43, 0x3F44, 0x3F45, 0x3F46, 0x3F47, 0x3F48, 0x3F49, 0x3F4A, 0x3F4B, 0x3F4C, 0x3F4D, 0x3F4E, 0x3F4F, 0x3F50, 0x3F51, 0x3F52, 0x3F53, 0x3F54, 0x3F55, 0x3F56, 0x3F57, 0x3F58, 0x3F59, 0x3F5A, 0x3F5B, 0x3F5C, 0x3F5D, 0x3F5E, 0x3F5F, 0x3F60, 0x3F61, 0x3F62, 0x3F63, 0x3F64, 0x3F65, 0x3F66, 0x3F67, 0x3F68, 0x3F82, 0x3F83, 0x3F84, 0x3F85, 0x3F86, 0x3F87, 0x3F88, 0x3F89, 0x3F8A, 0x3F8B, 0x3F8C, 0x3F8D, 0x3F8E, 0x3F8F, 0x3F92, 0x3F93, 0x3F94, 0x3F95, 0x3F96, 0x3F97, 0x3F98, 0x3F99, 0x3F9A, 0x3F9B, 0x3F9C, 0x3F9D, 0x3F9E, 0x3F9F, 0x3FA0, 0x3FA1, 0x3FA2, 0x3FA3, 0x3FA4, 0x3FA5, 0x3FA6, 0x3FA7, 0x3FA8, 0x3FA9, 0x3FAA, 0x3FAB, 0x3FAC, 0x3FAD, 0x3FAE, 0x3FAF, 0x3FB0, 0x3FB1, 0x3FB2, 0x3FB3, 0x3FB4, 0x3FB5, 0x3FB6, 0x3FB7, 0x3FB8, 0x3FB9, 0x3FBA, 0x3FBB, 0x3FBC, 0x3FBD, 0x3FBE, 0x3FBF, 0x3FC0, 0x3FC1, 0x3FC2, 0x3FC3, 0x3FC4, 0x3FC5, 0x3FC6, 0x3FC7, 0x3FC8, 0x3FC9, 0x3FCA, 0x3FCB, 0x3FCC, 0x3FCD, 0x3FCE, 0x3FCF, 0x0436, 0x0437, 0x0438, 0x0439, 0x043A, 0x043B, 0x043C, 0x043D, 0x043E, 0x043F, 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445 }; + int[] SandTerrain = { 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, 0x0030, 0x0031, 0x0032, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x0126, 0x0127, 0x0128, 0x0129, 0x01B9, 0x01BA, 0x01BB, 0x01BC, 0x01BD, 0x01BE, 0x01BF, 0x01C0, 0x01C1, 0x01C2, 0x01C3, 0x01C4, 0x01C5, 0x01C6, 0x01C7, 0x01C8, 0x01C9, 0x01CA, 0x01CB, 0x01CC, 0x01CD, 0x01CE, 0x01CF, 0x01D0, 0x01D1, 0x0016, 0x0017, 0x0018, 0x0019, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x011E, 0x011F, 0x0120, 0x0121, 0x12A, 0x012B, 0x012C, 0x012D, 0x01A8, 0x01A9, 0x01AA, 0x01AB, 0x0282, 0x0283, 0x0284, 0x0285, 0x028A, 0x028B, 0x028C, 0x028D, 0x028E, 0x028F, 0x0290, 0x0291, 0x0335, 0x0336, 0x0337, 0x0338, 0x0339, 0x033A, 0x033B, 0x033C, 0x0341, 0x0342, 0x0343, 0x0344, 0x034D, 0x034E, 0x034F, 0x0350, 0x0351, 0x0352, 0x0353, 0x0354, 0x0359, 0x035A, 0x035B, 0x035C, 0x03B7, 0x03B8, 0x03B9, 0x03BA, 0x03BB, 0x03BC, 0x03BD, 0x03BE, 0x03C7, 0x03C8, 0x03C9, 0x03CA, 0x05A7, 0x05A8, 0x05A9, 0x05AA, 0x05AB, 0x05AC, 0x05AD, 0x05AE, 0x05AF, 0x05B0, 0x05B1, 0x05B2, 0x064B, 0x064C, 0x064D, 0x064E, 0x064F, 0x0650, 0x0651, 0x0652, 0x0657, 0x0658, 0x0659, 0x065A, 0x0663, 0x0664, 0x0665, 0x0666, 0x0667, 0x0668, 0x0669, 0x066A, 0x066F, 0x0670, 0x0671, 0x0672 }; + int[] SwampTerrain = { 0x3D65, 0x3D66, 0x3D67, 0x3D68, 0x3D69, 0x3D6A, 0x3D6B, 0x3D6C, 0x3D6D, 0x3D6E, 0x3D6F, 0x3D70, 0x3D71, 0x3D72, 0x3D73, 0x3D74, 0x3D75, 0x3D76, 0x3D77, 0x3D78, 0x3D79, 0x3D7A, 0x3D7B, 0x3D7C, 0x3D7D, 0x3D7E, 0x3D7F, 0x3D80, 0x3D81, 0x3D82, 0x3D83, 0x3D84, 0x3D85, 0x3D86, 0x3D87, 0x3D88, 0x3D89, 0x3D8A, 0x3D8B, 0x3D8C, 0x3D8D, 0x3D8E, 0x3D8F, 0x3D90, 0x3D91, 0x3D92, 0x3D93, 0x3D94, 0x3D95, 0x3D96, 0x3D97, 0x3D98, 0x3D99, 0x3D9A, 0x3D9B, 0x3D9C, 0x3D9D, 0x3D9E, 0x3D9F, 0x3DA0, 0x3DA1, 0x3DA2, 0x3DA3, 0x3DA4, 0x3DA5, 0x3DA6, 0x3DA7, 0x3DA8, 0x3DA9, 0x3DAA, 0x3DAB, 0x3DAC, 0x3DAD, 0x3DAE, 0x3DAF, 0x3DB0, 0x3DB1, 0x3DB2, 0x3DB3, 0x3DB4, 0x3DB5, 0x3DB6, 0x3DB7, 0x3DB8, 0x3DB9, 0x3DBA, 0x3DBB, 0x3DBC, 0x3DBD, 0x3DBE, 0x3DBF, 0x3DC0, 0x3DC1, 0x3DC2, 0x3DC3, 0x3DC4, 0x3DC5, 0x3DC6, 0x3DC7, 0x3DC8, 0x3DC9, 0x3DCA, 0x3DCB, 0x3DCC, 0x3DCD, 0x3DCE, 0x3DCF, 0x3DD0, 0x3DD1, 0x3DD2, 0x3DD3, 0x3DD4, 0x3DD5, 0x3DD6, 0x3DD7, 0x3DD8, 0x3DD9, 0x3DDA, 0x3DDB, 0x3DDC, 0x3DDD, 0x3DDE, 0x3DDF, 0x3DE0, 0x3DE1, 0x3DE2, 0x3DE3, 0x3DE4, 0x3DE5, 0x3DE6, 0x3DE7, 0x3DE8, 0x3DE9, 0x3DEA, 0x3DEB, 0x3DEC, 0x3DED, 0x3DEE, 0x3DEF, 0x3DF0, 0x3DF1 }; + int[] SnowTerrain = { 0x010C, 0x010D, 0x010E, 0x010F, 0x0114, 0x0115, 0x0116, 0x0117, 0x017C, 0x017D, 0x017E, 0x017F, 0x0180, 0x0181, 0x0182, 0x0183, 0x0184, 0x0185, 0x0186, 0x0187, 0x0188, 0x0189, 0x018A, 0x0755, 0x0756, 0x0757, 0x0758, 0x076D, 0x076E, 0x076F, 0x0770, 0x0771, 0x0772, 0x0773, 0x011A, 0x011B, 0x011C, 0x011D, 0x012E, 0x012F, 0x0130, 0x0131, 0x0179, 0x017A, 0x017B, 0x0385, 0x0386, 0x0387, 0x0388, 0x0389, 0x038A, 0x038B, 0x038C, 0x0391, 0x0392, 0x0393, 0x0394, 0x039D, 0x039E, 0x039F, 0x03A0, 0x03A1, 0x03A2, 0x03A3, 0x03A4, 0x03A9, 0x03AA, 0x03AB, 0x03AC, 0x05BF, 0x05C0, 0x05C1, 0x05C2, 0x05C3, 0x05C4, 0x05C5, 0x05C6, 0x05C7, 0x05C8, 0x05C9, 0x05CA, 0x05CB, 0x05CC, 0x05CD, 0x05CE, 0x05CF, 0x05D0, 0x05D1, 0x05D2, 0x05D3, 0x05D4, 0x05D5, 0x05D6, 0x05DF, 0x05E0, 0x05E1, 0x05E2, 0x0745, 0x0746, 0x0747, 0x0748, 0x0751, 0x0752, 0x0753, 0x0754, 0x075D, 0x075E, 0x075F, 0x0760 }; + + if ( Array.IndexOf( WaterTerrain, LTile.ID ) >= 0 ) + return Terrain.Water; + else if ( Array.IndexOf( CaveTerrain, LTile.ID ) >= 0 ) + return Terrain.Cave; + else if ( Array.IndexOf( DirtTerrain, LTile.ID ) >= 0 ) + return Terrain.Dirt; + else if ( Array.IndexOf( ForestTerrain, LTile.ID ) >= 0 ) + return Terrain.Forest; + else if ( Array.IndexOf( GrassTerrain, LTile.ID ) >= 0 ) + return Terrain.Grass; + else if ( Array.IndexOf( JungleTerrain, LTile.ID ) >= 0 ) + return Terrain.Jungle; + else if ( Array.IndexOf( RockTerrain, LTile.ID ) >= 0 ) + return Terrain.Rock; + else if ( Array.IndexOf( SandTerrain, LTile.ID ) >= 0 ) + return Terrain.Sand; + else if ( Array.IndexOf( SwampTerrain, LTile.ID ) >= 0 ) + return Terrain.Swamp; + else if ( Array.IndexOf( SnowTerrain, LTile.ID ) >= 0 ) + return Terrain.Snow; + + return Terrain.None; + } + + public static Terrain TestAround ( Terrain ground, Map map, int x, int y, int distance ) + { + Point3D p = new Point3D( 9000, 9000, 0 ); + Terrain terrain = Terrain.None; + int i = 8; + int g = 0; + + while ( i > 0 ) + { + i--; + g = Utility.Random(8); + + switch ( g ) + { + case 0: terrain = GetTerrain( map, p, x-distance, y-distance ); break; + case 1: terrain = GetTerrain( map, p, x, y-distance ); break; + case 2: terrain = GetTerrain( map, p, x+distance, y-distance ); break; + case 3: terrain = GetTerrain( map, p, x-distance, y ); break; + case 4: terrain = GetTerrain( map, p, x+distance, y ); break; + case 5: terrain = GetTerrain( map, p, x-distance, y+distance ); break; + case 6: terrain = GetTerrain( map, p, x, y+distance ); break; + case 7: terrain = GetTerrain( map, p, x+distance, y+distance ); break; + } + + if ( terrain != Terrain.Water && terrain != Terrain.Cave && terrain != Terrain.Dirt && terrain != Terrain.Rock ) + return terrain; + } + + return ground; + } + + public static Mobile RandomSpawn( Item spawn, Point3D loc, Map map ) + { + Mobile m = null; + spawn.MoveToWorld( loc, map ); + int tries = 100; + + Terrain terrain = GetTerrain( map, loc, spawn.X, spawn.Y ); + + if ( terrain != Terrain.Water && terrain != Terrain.Cave && terrain != Terrain.Dirt && terrain != Terrain.Rock ) + terrain = TestAround( terrain, map, spawn.X, spawn.Y, 15 ); + + while ( m == null && tries > 0 ) + { + tries--; + + if ( spawn is SpawnCritters ) + { + if ( terrain == Terrain.Forest ) + m = Construct( ForestCritters ) as Mobile; + else if ( terrain == Terrain.Sand ) + m = Construct( DesertCritters ) as Mobile; + else if ( terrain == Terrain.Jungle ) + m = Construct( JungleCritters ) as Mobile; + else if ( terrain == Terrain.Grass ) + m = Construct( FieldCritters ) as Mobile; + else if ( terrain == Terrain.Snow ) + m = Construct( SnowCritters ) as Mobile; + else if ( terrain == Terrain.Swamp ) + m = Construct( SwampCritters ) as Mobile; + else if ( terrain == Terrain.Dirt ) + m = Construct( DirtCritters ) as Mobile; + } + else if ( spawn is SpawnBirds ) + { + if ( terrain == Terrain.Forest ) + m = Construct( ForestBirds ) as Mobile; + else if ( terrain == Terrain.Sand ) + m = Construct( DesertBirds ) as Mobile; + else if ( terrain == Terrain.Jungle ) + m = Construct( JungleBirds ) as Mobile; + else if ( terrain == Terrain.Grass ) + m = Construct( FieldBirds ) as Mobile; + else if ( terrain == Terrain.Snow ) + m = Construct( SnowBirds ) as Mobile; + else if ( terrain == Terrain.Swamp ) + m = Construct( SwampBirds ) as Mobile; + else if ( terrain == Terrain.Dirt ) + m = Construct( DirtBirds ) as Mobile; + } + else if ( spawn is SpawnAnimals ) + { + if ( terrain == Terrain.Forest ) + m = Construct( ForestAnimals ) as Mobile; + else if ( terrain == Terrain.Sand ) + m = Construct( DesertAnimals ) as Mobile; + else if ( terrain == Terrain.Jungle ) + m = Construct( JungleAnimals ) as Mobile; + else if ( terrain == Terrain.Grass ) + m = Construct( FieldAnimals ) as Mobile; + else if ( terrain == Terrain.Snow ) + m = Construct( SnowAnimals ) as Mobile; + else if ( terrain == Terrain.Swamp ) + m = Construct( SwampAnimals ) as Mobile; + else if ( terrain == Terrain.Dirt ) + m = Construct( DirtAnimals ) as Mobile; + } + else if ( spawn is Spawn_A ) + { + if ( terrain == Terrain.Forest ) + m = Construct( Forest_A ) as Mobile; + else if ( terrain == Terrain.Sand ) + m = Construct( Desert_A ) as Mobile; + else if ( terrain == Terrain.Jungle ) + m = Construct( Jungle_A ) as Mobile; + else if ( terrain == Terrain.Grass ) + m = Construct( Field_A ) as Mobile; + else if ( terrain == Terrain.Snow ) + m = Construct( Snow_A ) as Mobile; + else if ( terrain == Terrain.Swamp ) + m = Construct( Swamp_A ) as Mobile; + else if ( terrain == Terrain.Dirt ) + m = Construct( Dirt_A ) as Mobile; + } + else if ( spawn is Spawn_B ) + { + if ( terrain == Terrain.Forest ) + m = Construct( Forest_B ) as Mobile; + else if ( terrain == Terrain.Sand ) + m = Construct( Desert_B ) as Mobile; + else if ( terrain == Terrain.Jungle ) + m = Construct( Jungle_B ) as Mobile; + else if ( terrain == Terrain.Grass ) + m = Construct( Field_B ) as Mobile; + else if ( terrain == Terrain.Snow ) + m = Construct( Snow_B ) as Mobile; + else if ( terrain == Terrain.Swamp ) + m = Construct( Swamp_B ) as Mobile; + else if ( terrain == Terrain.Dirt ) + m = Construct( Dirt_B ) as Mobile; + } + else if ( spawn is Spawn_C ) + { + if ( terrain == Terrain.Forest ) + m = Construct( Forest_C ) as Mobile; + else if ( terrain == Terrain.Sand ) + m = Construct( Desert_C ) as Mobile; + else if ( terrain == Terrain.Jungle ) + m = Construct( Jungle_C ) as Mobile; + else if ( terrain == Terrain.Grass ) + m = Construct( Field_C ) as Mobile; + else if ( terrain == Terrain.Snow ) + m = Construct( Snow_C ) as Mobile; + else if ( terrain == Terrain.Swamp ) + m = Construct( Swamp_C ) as Mobile; + else if ( terrain == Terrain.Dirt ) + m = Construct( Dirt_C ) as Mobile; + } + else if ( spawn is Spawn_D ) + { + if ( terrain == Terrain.Forest ) + m = Construct( Forest_D ) as Mobile; + else if ( terrain == Terrain.Sand ) + m = Construct( Desert_D ) as Mobile; + else if ( terrain == Terrain.Jungle ) + m = Construct( Jungle_D ) as Mobile; + else if ( terrain == Terrain.Grass ) + m = Construct( Field_D ) as Mobile; + else if ( terrain == Terrain.Snow ) + m = Construct( Snow_D ) as Mobile; + else if ( terrain == Terrain.Swamp ) + m = Construct( Swamp_D ) as Mobile; + else if ( terrain == Terrain.Dirt ) + m = Construct( Dirt_D ) as Mobile; + } + else if ( spawn is Spawn_E ) + { + if ( terrain == Terrain.Forest ) + m = Construct( Forest_E ) as Mobile; + else if ( terrain == Terrain.Sand ) + m = Construct( Desert_E ) as Mobile; + else if ( terrain == Terrain.Jungle ) + m = Construct( Jungle_E ) as Mobile; + else if ( terrain == Terrain.Grass ) + m = Construct( Field_E ) as Mobile; + else if ( terrain == Terrain.Snow ) + m = Construct( Snow_E ) as Mobile; + else if ( terrain == Terrain.Swamp ) + m = Construct( Swamp_E ) as Mobile; + else if ( terrain == Terrain.Dirt ) + m = Construct( Dirt_E ) as Mobile; + } + } + + //spawn.Delete(); + return m; + } + + public static Mobile Construct( Type type ) + { + try + { + return Activator.CreateInstance( type ) as Mobile; + } + catch + { + return null; + } + } + + public static Mobile Construct( Type[] types ) + { + if ( types.Length > 0 ) + return Construct( types, Utility.Random( types.Length ) ); + + return null; + } + + public static Mobile Construct( Type[] types, int index ) + { + if ( index >= 0 && index < types.Length ) + return Construct( types[index] ); + + return null; + } + + public static Mobile Construct( params Type[][] types ) + { + int totalLength = 0; + + for ( int i = 0; i < types.Length; ++i ) + totalLength += types[i].Length; + + if ( totalLength > 0 ) + { + int index = Utility.Random( totalLength ); + + for ( int i = 0; i < types.Length; ++i ) + { + if ( index >= 0 && index < types[i].Length ) + return Construct( types[i][index] ); + + index -= types[i].Length; + } + } + + return null; + } + } +} diff --git a/Scripts/Engines/Spawner/DynamicSpawner/SpawnRef.cs b/Scripts/Engines/Spawner/DynamicSpawner/SpawnRef.cs new file mode 100644 index 0000000..83fb5bf --- /dev/null +++ b/Scripts/Engines/Spawner/DynamicSpawner/SpawnRef.cs @@ -0,0 +1,146 @@ +using System; +using Server; + +namespace Server.Items +{ + public abstract class BaseSpawner : Item, ISpawner + { + private Mobile m_TrackedMobile; + + // --- ISpawner Interface Requirements --- + // If true, taming the animal unlinks it and instantly spawns a new wild one! + public bool UnlinkOnTaming { get { return true; } } + public Point3D HomeLocation { get { return this.Location; } } + public int HomeRange { get { return 5; } } + + // The Magic Native Event Trigger + // The server calls this natively the instant the creature dies or is deleted. + public void Remove( ISpawnable spawn ) + { + if ( !this.Deleted ) + this.Delete(); // Deleting the proxy item triggers your PremiumSpawner to respawn! + } + // --------------------------------------- + + public BaseSpawner() : base( 0x6519 ) + { + Name = "spawn ref"; + Visible = false; + Movable = false; + + Timer.DelayCall( TimeSpan.FromSeconds( 1.0 ), new TimerCallback( ExecuteSpawn ) ); + } + + public BaseSpawner( Serial serial ) : base( serial ) + { + } + + public override void Serialize( GenericWriter writer ) + { + base.Serialize( writer ); + writer.Write( (int) 0 ); // version + + writer.Write( m_TrackedMobile ); + } + + public override void Deserialize( GenericReader reader ) + { + base.Deserialize( reader ); + int version = reader.ReadInt(); + m_TrackedMobile = reader.ReadMobile(); + + // Re-link the spawner if the server restarts and the mob is still alive + if ( m_TrackedMobile != null && !m_TrackedMobile.Deleted && m_TrackedMobile.Alive ) + { + if ( m_TrackedMobile is ISpawnable ) + { + ((ISpawnable)m_TrackedMobile).Spawner = this; + } + } + else + { + Timer.DelayCall( TimeSpan.FromSeconds( 1.0 ), new TimerCallback( this.Delete ) ); + } + } + + private void ExecuteSpawn() + { + if ( !this.Deleted && this.Map != null && this.Map != Map.Internal ) + { + Point3D savedLocation = this.Location; + Map savedMap = this.Map; + + m_TrackedMobile = Server.SpawnList.RandomSpawn( this, savedLocation, savedMap ); + + if ( m_TrackedMobile != null ) + { + // Link the newly born mobile to this proxy item! + if ( m_TrackedMobile is ISpawnable ) + { + ((ISpawnable)m_TrackedMobile).Spawner = this; + } + + m_TrackedMobile.MoveToWorld( savedLocation, savedMap ); + + this.Internalize(); + } + else + { + this.Delete(); + } + } + else if ( !this.Deleted ) + { + this.Delete(); + } + } + } + + public class SpawnAnimals : BaseSpawner + { + [Constructable] + public SpawnAnimals(){} public SpawnAnimals( Serial serial ) : base( serial ){} public override void Serialize( GenericWriter writer ){ base.Serialize( writer ); writer.Write( (int) 0 ); } public override void Deserialize( GenericReader reader ){ base.Deserialize( reader ); int version = reader.ReadInt(); } + } + + public class SpawnBirds : BaseSpawner + { + [Constructable] + public SpawnBirds(){} public SpawnBirds( Serial serial ) : base( serial ){} public override void Serialize( GenericWriter writer ){ base.Serialize( writer ); writer.Write( (int) 0 ); } public override void Deserialize( GenericReader reader ){ base.Deserialize( reader ); int version = reader.ReadInt(); } + } + + public class SpawnCritters : BaseSpawner + { + [Constructable] + public SpawnCritters(){} public SpawnCritters( Serial serial ) : base( serial ){} public override void Serialize( GenericWriter writer ){ base.Serialize( writer ); writer.Write( (int) 0 ); } public override void Deserialize( GenericReader reader ){ base.Deserialize( reader ); int version = reader.ReadInt(); } + } + + public class Spawn_A : BaseSpawner + { + [Constructable] + public Spawn_A(){} public Spawn_A( Serial serial ) : base( serial ){} public override void Serialize( GenericWriter writer ){ base.Serialize( writer ); writer.Write( (int) 0 ); } public override void Deserialize( GenericReader reader ){ base.Deserialize( reader ); int version = reader.ReadInt(); } + } + + public class Spawn_B : BaseSpawner + { + [Constructable] + public Spawn_B(){} public Spawn_B( Serial serial ) : base( serial ){} public override void Serialize( GenericWriter writer ){ base.Serialize( writer ); writer.Write( (int) 0 ); } public override void Deserialize( GenericReader reader ){ base.Deserialize( reader ); int version = reader.ReadInt(); } + } + + public class Spawn_C : BaseSpawner + { + [Constructable] + public Spawn_C(){} public Spawn_C( Serial serial ) : base( serial ){} public override void Serialize( GenericWriter writer ){ base.Serialize( writer ); writer.Write( (int) 0 ); } public override void Deserialize( GenericReader reader ){ base.Deserialize( reader ); int version = reader.ReadInt(); } + } + + public class Spawn_D : BaseSpawner + { + [Constructable] + public Spawn_D(){} public Spawn_D( Serial serial ) : base( serial ){} public override void Serialize( GenericWriter writer ){ base.Serialize( writer ); writer.Write( (int) 0 ); } public override void Deserialize( GenericReader reader ){ base.Deserialize( reader ); int version = reader.ReadInt(); } + } + + public class Spawn_E : BaseSpawner + { + [Constructable] + public Spawn_E(){} public Spawn_E( Serial serial ) : base( serial ){} public override void Serialize( GenericWriter writer ){ base.Serialize( writer ); writer.Write( (int) 0 ); } public override void Deserialize( GenericReader reader ){ base.Deserialize( reader ); int version = reader.ReadInt(); } + } +} diff --git a/Scripts/Engines/Spawner/DynamicSpawner/SpawnRef.cs.bak b/Scripts/Engines/Spawner/DynamicSpawner/SpawnRef.cs.bak new file mode 100644 index 0000000..0ad881e --- /dev/null +++ b/Scripts/Engines/Spawner/DynamicSpawner/SpawnRef.cs.bak @@ -0,0 +1,148 @@ +using System; +using Server; + +namespace Server.Items +{ + public abstract class BaseSpawner : Item + { + private Mobile m_TrackedMobile; + private Timer m_TrackerTimer; + + public BaseSpawner() : base( 0x6519 ) + { + Name = "spawn ref"; + Visible = false; + Movable = false; + // Snappy 1-second timer to place the mob + Timer.DelayCall( TimeSpan.FromSeconds( 1.0 ), new TimerCallback( ExecuteSpawn ) ); + } + + public BaseSpawner( Serial serial ) : base( serial ) + { + } + + public override void Serialize( GenericWriter writer ) + { + base.Serialize( writer ); + writer.Write( (int) 0 ); // version + + // Save the mobile we are tracking in case the server restarts + writer.Write( m_TrackedMobile ); + } + + public override void Deserialize( GenericReader reader ) + { + base.Deserialize( reader ); + int version = reader.ReadInt(); + m_TrackedMobile = reader.ReadMobile(); + + if ( m_TrackedMobile != null && !m_TrackedMobile.Deleted ) + { + StartTracking(); + } + else + { + // Clean up abandoned proxies on restart + Timer.DelayCall( TimeSpan.FromSeconds( 1.0 ), new TimerCallback( this.Delete ) ); + } + } + + private void ExecuteSpawn() + { + if ( !this.Deleted && this.Map != null && this.Map != Map.Internal ) + { + Point3D savedLocation = this.Location; + Map savedMap = this.Map; + + m_TrackedMobile = Server.SpawnList.RandomSpawn( this, savedLocation, savedMap ); + + if ( m_TrackedMobile != null ) + { + m_TrackedMobile.MoveToWorld( savedLocation, savedMap ); + + // Hide this proxy item in the void instead of deleting it + this.Internalize(); + StartTracking(); + } + else + { + this.Delete(); + } + } + else if ( !this.Deleted ) + { + this.Delete(); + } + } + + private void StartTracking() + { + if ( m_TrackerTimer != null ) + m_TrackerTimer.Stop(); + + // Ping every 5 seconds to check if the animal is still alive + m_TrackerTimer = Timer.DelayCall( TimeSpan.FromSeconds( 5.0 ), TimeSpan.FromSeconds( 5.0 ), new TimerCallback( TrackMobile ) ); + } + + private void TrackMobile() + { + if ( m_TrackedMobile == null || m_TrackedMobile.Deleted || !m_TrackedMobile.Alive ) + { + if ( m_TrackerTimer != null ) + m_TrackerTimer.Stop(); + + // Kill this proxy item so the Premium Spawner knows it's time to respawn! + if ( !this.Deleted ) + this.Delete(); + } + } + } + + public class SpawnAnimals : BaseSpawner + { + [Constructable] + public SpawnAnimals(){} public SpawnAnimals( Serial serial ) : base( serial ){} public override void Serialize( GenericWriter writer ){ base.Serialize( writer ); writer.Write( (int) 0 ); } public override void Deserialize( GenericReader reader ){ base.Deserialize( reader ); int version = reader.ReadInt(); } + } + + public class SpawnBirds : BaseSpawner + { + [Constructable] + public SpawnBirds(){} public SpawnBirds( Serial serial ) : base( serial ){} public override void Serialize( GenericWriter writer ){ base.Serialize( writer ); writer.Write( (int) 0 ); } public override void Deserialize( GenericReader reader ){ base.Deserialize( reader ); int version = reader.ReadInt(); } + } + + public class SpawnCritters : BaseSpawner + { + [Constructable] + public SpawnCritters(){} public SpawnCritters( Serial serial ) : base( serial ){} public override void Serialize( GenericWriter writer ){ base.Serialize( writer ); writer.Write( (int) 0 ); } public override void Deserialize( GenericReader reader ){ base.Deserialize( reader ); int version = reader.ReadInt(); } + } + + public class Spawn_A : BaseSpawner + { + [Constructable] + public Spawn_A(){} public Spawn_A( Serial serial ) : base( serial ){} public override void Serialize( GenericWriter writer ){ base.Serialize( writer ); writer.Write( (int) 0 ); } public override void Deserialize( GenericReader reader ){ base.Deserialize( reader ); int version = reader.ReadInt(); } + } + + public class Spawn_B : BaseSpawner + { + [Constructable] + public Spawn_B(){} public Spawn_B( Serial serial ) : base( serial ){} public override void Serialize( GenericWriter writer ){ base.Serialize( writer ); writer.Write( (int) 0 ); } public override void Deserialize( GenericReader reader ){ base.Deserialize( reader ); int version = reader.ReadInt(); } + } + + public class Spawn_C : BaseSpawner + { + [Constructable] + public Spawn_C(){} public Spawn_C( Serial serial ) : base( serial ){} public override void Serialize( GenericWriter writer ){ base.Serialize( writer ); writer.Write( (int) 0 ); } public override void Deserialize( GenericReader reader ){ base.Deserialize( reader ); int version = reader.ReadInt(); } + } + + public class Spawn_D : BaseSpawner + { + [Constructable] + public Spawn_D(){} public Spawn_D( Serial serial ) : base( serial ){} public override void Serialize( GenericWriter writer ){ base.Serialize( writer ); writer.Write( (int) 0 ); } public override void Deserialize( GenericReader reader ){ base.Deserialize( reader ); int version = reader.ReadInt(); } + } + + public class Spawn_E : BaseSpawner + { + [Constructable] + public Spawn_E(){} public Spawn_E( Serial serial ) : base( serial ){} public override void Serialize( GenericWriter writer ){ base.Serialize( writer ); writer.Write( (int) 0 ); } public override void Deserialize( GenericReader reader ){ base.Deserialize( reader ); int version = reader.ReadInt(); } + } +}