diff --git a/Data/Common.map b/Data/Common.map deleted file mode 100644 index 9466dcd..0000000 --- a/Data/Common.map +++ /dev/null @@ -1,864 +0,0 @@ -3 --stairs: 5170 1569 1 --healer: 575 537 3 --healer: 682 297 3 --baker: 1514 611 3 -+ruins: 1586 1004 3 abandoned building -+landmark: 478 1531 3 abandoned mage tower -+ruins: 412 1363 3 abandoned tower -+landmark: 575 1140 3 abandoned tower --bank: 652 820 0 Abbey Banker --inn: 610 810 0 Abbey Innkeeper -+scenic: 1738 174 3 the Abyss --painter: 4525 1060 0 Academy of Arts --provisioner: 5737 3262 0 Adventure Outfitters --tailor: 1981 2838 0 Adventurer's Clothing --provisioner: 535 867 0 The Adventurer's Friend --tailor: 1355 3779 0 Adventurer's Needle --provisioner: 2992 638 0 The Adventurer's Supplies --inn: 3672 2654 1 The Albatross --tavern: 3668 2652 2 The Albatross Bar and Grill --mage: 5301 88 0 The Alchemist of Wind -+Terrain: 1460 448 3 Alexandrella's Bowl --shipwright: 3632 2640 1 Anchors Aweigh -+ruins: 1516 542 3 Ancient Citadel -+landmark: 221 1363 3 ancient wyrm's lair -+scenic: 1414 317 3 ancient wyrm's lair --arms: 808 697 3 Anglo-In-Lem --arms: 808 586 3 Angra-Char-In-Lem --gypsystable: 1225 563 3 animal pen --gypsystable: 1388 428 3 animal pen -+shrine: 3359 2679 2 Ank of Sacrifice --point of interest: 3746 2576 2 Archer Targets --arms: 1497 614 3 an armourer --armourers guild: 3587 2601 2 Armoury --arms: 1637 1693 0 Artistic Armour --rogues guild: 1442 1662 0 Artists' Guild --bank: 854 680 3 Atri-Aur --bank: 855 603 3 Atri-Aur --tinker: 766 641 3 Atri-Ben-In-Ailem --baker: 1880 2802 0 Baked Delights --baker: 3755 2227 0 Baker's Dozen --baker: 1364 3732 0 Baker's Dozen -+ruins: 512 546 3 bandit town -+landmark: 437 1558 3 bandstand -+scenic: 748 489 3 bandstand --gypsybank: 1226 554 3 a bank --bank: 1610 556 3 a bank --bank: 1813 2825 0 Bank of Britannia: Trinsic Branch --bank: 3734 2149 0 Bank of Magincia --bank: 2503 552 0 Bank of Minoc --bank: 3764 1317 0 Bank of Nujel'm --bank: 3695 2511 1 Bank of Ocllo --bank: 587 2146 0 Bank of Skara Brae --bardic guild: 3740 1197 0 Bardic Guild --bardic guild: 3666 2531 2 Bardic Guild --bardic guild: 3665 2531 1 The Bardic Guild --inn: 5197 4060 0 The Barely Inn --tavern: 2475 397 0 The Barnacle --point of interest: 1962 2691 0 Barracks --point of interest: 1937 2711 0 Barracks --point of interest: 1938 2688 0 Barracks -+Island: 2122 2755 0 Barrier Isle --stable: 571 2119 0 Beasts of Burden -+Terrain: 5542 2999 0 Beggars Gorge --provisioner: 826 679 3 Ben-In-Lem --provisioner: 824 602 3 Ben-In-Lem --tanner: 1431 1612 0 The Best Hides of Britain -+ruins: 1249 955 3 Bet-Lem Reg --tanner: 3602 2615 1 Better Leather Tannery --blacksmith: 3007 3408 0 Blacksmith --blacksmith: 3594 2595 2 Blacksmith --bowyer: 590 2205 0 Bloody Bowman --carpenter: 565 1011 0 Bloody Thumb Woodworks --tavern: 1498 1691 0 The Blue Boar --inn: 3671 2615 2 The Bountiful Harvest --inn: 3673 2614 1 The Bountiful Harvest --butcher: 582 2186 0 Bountiful Meats --bowyer: 3745 2585 2 Bowyers --baker: 3683 2171 0 The Bread Basket --bridge: 1789 2923 0 bridge --bridge: 1778 2848 0 bridge -+landmark: 1123 1236 3 brigand tower -+town: 1546 1634 0 Britain -+graveyard: 1371 1482 0 Britain Cemetery --docks: 1470 1765 0 Britain Docks -+moongate: 1336 1997 0 Britain Moongate --library: 1409 1590 0 Britain Public Library --blacksmiths guild: 1348 1778 0 Britain's Blacksmith Guild --provisioner: 1469 1668 0 Britain's Premier Provisioners and Fish Shoppe --reagents: 3013 3353 0 Britainian Herbs --point of interest: 1507 1567 0 Britannia Animal Care -+landmark: 295 764 0 Britannia Prison --provisioner: 1850 2796 0 Britannia Provisions --docks: 1437 1761 0 Britain Docks --docks: 1484 1755 0 Britain Docks -+landmark: 4511 1376 0 Britannia Royal Zoo --inn: 2967 3408 0 The Broken Arrow Inn --warriors guild: 1939 2739 0 The Brotherhood of Trinsic --weapons guild: 1362 3700 0 Brothers In Arms --mage: 2885 651 0 The Bubbling Brew --point of interest: 2667 2087 0 Buccaneer's Bath -+town: 2720 2110 0 Buccaneer's Den --docks: 2752 2155 0 Buccaneer's Den Docks --tanner: 2707 2178 0 Buccaneer's Den Leatherworks -+moongate: 2711 2234 1 Buccaneer's Den Moongate --stable: 1510 1543 0 The Bucking Horse Stables --vet: 1509 1571 0 Britannia Animal Care --carpenter: 628 2160 0 Builder's Delight --inn: 5310 34 0 bunkhouse --other: 1288 769 3 Burning Corpse --beekeeper: 2959 707 0 The Busy Bees --gypsymaiden: 1400 434 3 provisioner.. --butcher: 2991 779 0 The Butcher's Knife --provisioner: 2838 868 0 The Adventurer's Friend --arms: 1475 3865 0 Call to Arms -+scenic: 768 1284 3 campfire --carpenter: 3642 2504 2 Carpenters of Haven --carpenter: 5691 3209 0 The Carpentry House --tavern: 1427 1716 0 The Cat's Lair --cavalry guild: 1578 1558 0 Cavalry Guild -+dungeon: 314 1329 3 cave passage -+dungeon: 226 1336 3 cave passage -+graveyard: 2437 1104 0 cemetery -+graveyard: 5696 3660 0 cemetery passage --exit: 533 1532 3 central dungeon -+dungeon: 576 1156 3 central dungeon -+dungeon: 664 929 3 central dungeon --exit: 155 1474 3 central dungeon --exit: 4 1267 3 central dungeon --point of interest: 1538 1597 0 The Chamber of Virtue -+champion: 462 926 3 Champ "Humility" -+champion: 1645 1108 3 Champ "Lord Oaks and the Forest Queen" -+champion: 383 329 3 Champ "Valor" -+champion: 5511 2360 1 Champ 1 "Ice West" -+champion: 5559 3757 1 Champ 10 "Wild" (Lord Oaks) -+champion: 5982 3882 1 Champ 11 "Khaldun" -+champion: 5724 3991 1 Champ 12 "Tortoise" -+champion: 6038 2400 1 Champ 2 "Ice East" -+champion: 5549 2640 1 Champ 3 "Oasis" -+champion: 5636 2916 1 Champ 4 "Desert" -+champion: 6035 2944 1 Champ 5 "Terra Sanctum" -+champion: 5267 3171 1 Champ 6 "Marble" -+champion: 5281 3368 1 Champ 7 "Damwin" -+champion: 5954 3475 1 Champ 8 "Hopper's Boog" -+champion: 5207 3637 1 Champ 9 "City of Death" -+champion: 5178 708 1 Champ Deceit: Neira (Unholy Terror) -+champion: 5259 837 1 Champ Destard: Rikktor (Cold Blood) -+champion: 5557 826 1 Champ of Despice: Barracoon (Vermin Horde) -+champion: 5814 1351 1 Champ of Fire: Semidar (Abyss) -+champion: 5189 1605 1 Champ of the Tera-Keep: Mephistis (Arachnid) --warriors guild: 2841 907 0 The Champion's of Light -+moongate: 1721 218 3 Chaos -+shrine: 1749 234 3 Chaos -+shrine: 1458 844 0 Chaos --point of interest: 3727 1361 0 The Chessboard -+Body of Water: 5260 3737 0 Cibilo Creek --gate: 1370 3868 0 City Gate --gate: 1475 3690 0 City Gate --gate: 3657 1202 0 City Gates -+ruins: 5219 3645 0 City of the Dead --butcher: 1449 1723 0 The Cleaver --painter: 2906 710 0 The Colored Canvass -+marble patio: 3599 2491 2 Companion Hall -+moongate: 1215 467 3 Compassion -+shrine: 1210 477 3 Compassion -+shrine: 1858 874 0 Compassion -+landmark: 1091 703 3 Controller Tower --guild: 2948 3349 0 Counselor's Guild --guild: 3721 2177 0 Counselor's Guild --guild: 610 2128 0 Counselor's Guild --guild: 2434 438 0 Counselor's Guild --guild: 1498 1518 0 Counselor's Guild --guild: 3769 1190 0 Counselor's Guild --guild: 616 980 0 Counselor's Guild --guild: 4478 1126 0 Counselor's Guild --guild: 1418 3703 0 Counselor's Guild --guild: 2843 944 0 Counselor's Guild --guild: 1893 2838 0 Counselor's Guild --guild: 1628 1664 0 Counselor's Guild --guild: 3667 2502 1 Counselor's Guild Hall -+landmark: 370 899 0 Court of Truth -+town: 2263 1237 0 Cove --docks: 2256 1181 0 Cove Dock -+dungeon: 2499 916 0 Covetous --exit: 5456 1863 0 Covetous --customs: 1476 1745 0 Customs --blacksmith: 2637 2090 0 Cutlass Smithing -+Terrain: 5139 2903 0 Cyclops Valley -+landmark: 758 208 3 cyclopse camp --exit: 1014 1507 3 cyclopse dungeon -+dungeon: 904 1362 3 cyclopse dungeon -+scenic: 747 247 3 cyclopse garden -+landmark: 907 1283 3 cyclopse's pyramid --bridge: 1521 1673 0 Cypress Bridge -+landmark: 894 1000 3 dam -+Terrain: 5265 3270 0 Damwin Thicket -+Terrain: 429 1433 3 dead forest --arms: 1359 3763 0 Deadly Intentions --point of interest: 3715 1383 0 Debtor's Prison -+dungeon: 4111 429 0 Deceit --exit: 5188 638 0 Deceit --healer: 647 1087 0 Deep Forest Healing -+town: 5227 3978 0 Delucia --stable: 5297 4007 0 Delucia Stable --tailor: 5234 4025 0 Delucia Tailor -+Terrain: 966 637 3 Desert -+town: 1506 622 3 Desert Outpost -+town: 1608 550 3 Desert Outpost -+dungeon: 1296 1082 0 Despise --exit: 5588 632 0 Despise -+dungeon: 1176 2635 0 Destard --exit: 5244 1007 0 Destard --inn: 665 665 3 The Deuce's Vinculum Inn --tavern: 2972 3425 0 The Dog and Lion Pub --point of interest: 39 688 3 Dragon's Egg -+dungeon: 940 502 3 Dragon's Lair --point of interest: 1397 3744 0 The Dueling Pit --bank: 1655 1606 0 East Britain Bank -+scenic: 2587 492 0 The East Mines --point of interest: 1608 1622 0 East Side Park --bridge: 2083 2796 0 East Trinsic Bridge -+dungeon: 349 1428 3 Elemental Arena --exit: 20 1197 3 Elemental Arena -+Terrain: 312 1442 3 Elemental Canyon -+landmark: 635 851 0 Empath Abbey --mages guild: 4545 860 0 Encyclopedia Magicka --mage: 1843 2711 0 Encyclopedia Magicka --gate: 1200 704 3 Entrance -+landmark: 5165 246 0 entrance -+dungeon: 1236 583 3 Entrance to Central Area -+dungeon: 710 667 3 Entrance to Central Area --reagents: 1498 1659 0 Ethereal Goods -+dungeon: 1363 1032 3 Etherial Tombs --exit: 1982 1106 3 Etherial Tombs --healer: 1364 1051 3 etherial warrior castle healer -+dungeon: 1140 593 3 Exit to Ilshenar -+dungeon: 911 451 3 Exit to Ilshenar --inn: 606 2243 0 The Falconer's Inn --jeweler: 3661 2183 0 The Family Jewels --other: 3708 2588 2 Farm --other: 3739 2563 2 Farm --other: 3731 2635 2 Farm --market: 4481 1085 0 Farmer's Market --market: 1392 3824 0 Farmer's Market --market: 611 2157 0 Farmer's Market --market: 3019 766 0 Farmer's Market --provisioner: 2216 1192 0 The Farmer's Market --butcher: 4395 1137 0 The Fatted Calf --butcher: 1455 4026 0 Finest Cuts -+dungeon: 2922 3402 0 Fire -+dungeon: 5757 2909 0 Fire --exit: 5687 1424 0 Fire (B) --exit: 5792 1415 0 Fire (LL) --theater: 3685 2477 1 First Academy of Music --bank: 1425 1690 0 The First Bank of Britain --bank: 4471 1156 0 First Bank of Moonglow and Tinker's Guild --blacksmith: 1395 3705 0 First Defense --library: 1494 1715 0 The First Library of Britain --stable: 2010 2807 0 First Trinsic Stablery --tavern: 3012 3457 0 Fisherman's Brew --fishermans guild: 2963 813 0 The Fisherman's Guild --fishermans guild: 3685 2256 0 Fisherman's Guild and Supplies --market: 3013 781 0 Fisherman's Warf -+scenic: 1589 1190 3 flowstone -+scenic: 596 946 3 a flowstone surrounded by runes --blacksmith: 1261 582 3 a forge -+scenic: 1606 1265 3 forge --blacksmith: 2471 564 0 The Forgery --point of interest: 792 641 3 Fountain -+landmark: 447 1526 3 fountain --other: 5331 707 1 from Ancient Wyrm's Lair - Teleporter --other: 5201 1564 1 from Despice- and Ancient-Wyrm-Teleporter --other: 5164 1009 1 from Despice-Teleporter --other: 5606 802 1 from Fire-and Deceit-Teleporter --other: 5171 1586 1 from Starroom-Teleporter --other: 5814 3548 1 from Teleporter T1 "Ice West" --other: 5958 2345 1 from Teleporter T2 "Ice East" --other: 5522 3921 1 from Teleporter T3 "Ice East" --other: 6089 2400 1 from Teleporter T4 Northeast of "Ice East" --other: 5490 2348 1 from Teleporter T5 South of Papua --other: 5972 2418 1 from Teleporter T6 East of Delucia --other: 5143 1774 1 from Tera- Keep-Teleporter --other: 5876 1378 1 from Tera-Keep-Teleporter --carpenter: 1435 3820 0 From Tree to Yew --shipwright: 3667 2252 0 The Furled Sail --tinker: 2899 790 0 The Gadget's Corner --tinker: 1404 3805 0 Gadgets and Things --point of interest: 3633 2597 2 Garden with Waterfall -+landmark: 946 427 3 Gargoyle Mining Camp -+teleporter: 2618 980 0 gate to Buccaneer's Den -+teleporter: 2728 2133 0 gate to mainland --point of interest: 1635 1561 0 Gazebo --tinker: 2461 457 0 Gears and Gadgets -+Body of Water: 5804 3468 0 The Gentle River -+Body of Water: 5838 3766 0 The Gentle River -+scenic: 1197 1034 3 giant yew tree --jeweler: 1655 1642 0 A Girl's Best Friend -+Terrain: 1352 664 3 glacier --miners guild: 2505 432 0 The Golden Pick Axe --baker: 1450 1617 0 Good Eats --arms: 654 2163 0 Gore Galore -+graveyard: 327 889 3 graveyard -+graveyard: 3649 2859 2 Graveyard -+graveyard: 3404 2653 2 graveyard --tavern: 3730 2218 0 Great Horns Tavern --bowyer: 624 1147 0 Great Oak Bowyer --shipwright: 634 1038 0 Great Oak Vessels --bridge: 1383 1746 0 Gung Farmer's Bridge -+scenic: 2533 654 0 Gypsy Camp -+town: 1240 565 3 gypsy caravan -+town: 1380 425 3 gypsy caravan --blacksmith: 1418 1547 0 The Hammer and Anvil --carpenter: 2917 798 0 The Hammer and Nail --arms: 3632 2595 1 Hammer and Steel Smithy --armourers guild: 1437 3884 0 Hand of Death -+scenic: 1675 965 3 harpy nest -+town: 3664 2558 2 Haven --blacksmith: 3645 2617 2 The Haven Blacksmith --tinker: 3667 2506 2 Haven Clockworks and Tinker Shop --docks: 3655 2665 2 Haven Docks -+moongate: 3763 2771 2 Haven Moongate --library: 3615 2476 2 Haven Public Library --thieves guild: 3693 2509 2 The Haven Thieves' Guild -+scenic: 1201 762 3 Hay Fields -+scenic: 1269 727 3 Hay Fields --healer: 5191 3989 0 a Healer --healer: 1472 1607 0 Healer of Britain --healer: 2709 2130 0 Healer of Buccaneer's Den --healer: 3687 2227 0 Healer of Magincia --healer: 3629 2608 1 Healer of Ocllo --healer: 623 2218 0 Healer of Skara Brae --healer: 2920 856 0 Healer of Vesper --healer: 532 958 0 Healer of Yew --healer: 284 536 3 healer's hut --fortuneteller: 1235 543 3 healer's hut --fortuneteller: 1407 428 3 healer's hut --healer: 1628 548 3 healer's hut --healer: 1518 619 3 healer's hut --healer: 3665 2581 2 The Healers of Haven --healer: 2577 599 0 The Healing Hand --healer: 2245 1231 0 The Healing Hand --healer: 5737 3222 0 The Healing Hand --healer: 1093 955 3 a healing temple --arms: 1443 1650 0 Heavy Metal Armorer -+scenic: 1146 2215 0 Hedge Maze --reagents: 4416 1133 0 Herbal Splendor -+moongate: 722 1366 3 Honesty -+shrine: 719 1351 3 Honesty -+shrine: 4212 563 0 Honesty -+moongate: 744 724 3 Honor -+shrine: 748 731 3 Honor -+shrine: 1723 3527 0 Honor --blacksmith: 1937 2771 0 Honorable Arms -+Terrain: 5978 3447 0 Hoppers Bog --tavern: 1452 3770 0 The Horse's Head -+moongate: 281 1016 3 Humility -+shrine: 287 1013 3 Humility -+shrine: 4274 3697 0 Humility -+landmark: 3715 2838 2 Hunters Cabin --mage: 5296 3978 0 Hut of Magics -+dungeon: 4722 3814 0 Hythloth --exit: 5904 16 0 Hythloth -+dungeon: 5203 2328 0 Ice -+dungeon: 1996 80 0 Ice --exit: 5882 243 0 Ice (B) --exit: 5875 147 0 Ice (LL) --exit: 84 750 3 Ilshenar Central Area --healer: 872 586 3 In-Mani-Lem --mage: 1590 1654 0 Incantations & Enchantments --inn: 1620 554 3 an inn --inn: 2778 966 0 The Ironwood Inn --arms: 2865 852 0 The Ironworks -+teleporter: 2494 3576 0 island temple portal -+Body of Water: 5274 2883 0 J'Fer Sok --point of interest: 1855 2769 0 Jail -+landmark: 5291 1169 0 jail --jeweler: 3778 1172 0 Jewel of the Isle --jeweler: 1605 541 3 a jeweler -+town: 1359 3671 0 Jhelom --arms: 1456 3850 0 Jhelom Armory --bank: 1317 3773 0 Jhelom Bank and Jeweler -+graveyard: 1283 3731 0 Jhelom Cemetery --docks: 1512 3989 0 Jhelom Docks --docks: 1372 3908 0 Jhelom Docks --docks: 1504 3693 0 Jhelom Docks --docks: 1125 3687 0 Jhelom Docks --healer: 1416 3779 0 Jhelom Healer --library: 1387 3771 0 Jhelom Library --mage: 1425 3980 0 Jhelom Mage -+moongate: 1500 3772 0 Jhelom Moongate --tailor: 1455 4006 0 Jhelom's Fine Tailoring --baker: 554 991 0 The Jolly Baker --inn: 5775 3161 0 The Just Inn -+moongate: 987 1011 3 Justice -+shrine: 985 1005 3 Justice -+shrine: 1300 633 0 Justice --tavern: 1935 2796 0 The Keg and Anchor -+dungeon: 6009 3775 1 Khaldun -+dungeon: 5882 3819 1 Khaldun --theater: 1449 1590 0 The King's Men Theater --jeweler: 859 698 3 Klar-Lap-In-Lem -+Terrain: 5382 2343 0 Kos Heb -+Terrain: 5954 2363 0 Kos Heb -+ruins: 1200 1127 3 Lakeshire/Mireg --guild: 872 686 3 Lap-In-Lem --guild: 792 617 3 Lap-In-Lem --provisioner: 3673 2595 2 Last Chance Provisioners --provisioner: 3635 2573 1 Last Chance Provisioners -+Terrain: 480 882 3 lava vent --library: 5238 144 0 The Learned Mage -+Body of Water: 1688 840 3 Lenmir Antinmolas --library: 868 657 3 Librum --library: 869 625 3 Librum -+landmark: 3457 3056 2 Lighthouse -+landmark: 5671 2391 0 lighthouse passage --mage: 3632 2573 2 The Little Shop of Magic -+ruins: 292 1356 3 lizard man camp --gate: 401 1251 3 lizzardman gate --gate: 367 1261 3 lizzardman gate -+landmark: 3595 2865 2 Loggers Camp -+landmark: 1530 1428 0 Lord Blackthorn's Castle -+landmark: 1323 1624 0 Lord British's Castle --bard: 1455 1557 0 Lord British's Conservatory of Music --tailor: 1385 1593 0 Lord British's Tailor --arms: 1365 1575 0 The Lord's Arms --tailor: 1467 1686 0 The Lord's Clothiers -+landmark: 4312 1000 0 The Lyceaeum --gypsybank: 1405 439 3 a bank --fortuneteller: 1394 441 3 a mage --mage: 1505 611 3 a mage --baker: 5351 56 0 Mage's Appetite --baker: 4392 1068 0 Mage's Bread --bridge: 1520 1578 0 Mage's Bridge --carpenter: 4416 1085 0 The Mage's Seat --provisioner: 5154 97 0 Mage's Things --mage: 602 2180 0 Mages' Menagerie --mage: 2918 672 0 The Magical Light --reagents: 5215 117 0 Magical Supplies --reagents: 2992 844 0 The Magician's Friend -+town: 3735 2200 0 Magincia --docks: 3674 2293 0 Magincia Docks --miners guild: 3665 2140 0 Magincia Miner's Guild -+moongate: 3564 2140 0 Magincia Moongate --point of interest: 3796 2259 0 Magincia Parliment --mage: 3704 2222 0 Magincia's Magicka --gate: 1477 1638 0 The Main Gate --shipwright: 2994 815 0 The Majestic Boat --shipwright: 3636 2642 2 Mapmaker's of Haven --tavern: 2901 908 0 The Marsh Hall --illusionists guild: 4626 1207 0 Masters of Illusion --miners guild: 2455 487 0 The Matewan -+scenic: 753 493 3 memorial to Gwenno --merchants guild: 1474 1597 0 The Merchant's Guild --merchants guild: 3703 2249 0 The Merchant's Guild --other: 1947 2677 0 Mess Hall --arms: 4392 1117 0 The Mighty Axe -+Minax's Fortress: 5778 3376 1 Minax's Fortress --miners guild: 1417 1578 0 The Miner's Guild --miners guild: 3754 2704 2 Miners -+landmark: 2590 532 0 Mining Camp -+landmark: 3498 2844 2 Mining Cave -+landmark: 3610 2740 2 Mining Cave -+town: 2502 522 0 Minoc -+moongate: 2702 692 0 Minoc Moongate --point of interest: 2429 528 0 Minoc Town Hall --bank: 2881 684 0 The Mint of Vesper -+landmark: 821 1060 3 Mistas --inn: 774 1144 3 Mistas Regsit -+landmark: 3589 2808 2 Mongbat Tower -+landmark: 1668 292 3 Montor -+town: 4457 1117 0 Moonglow -+graveyard: 4541 1319 0 Moonglow Cemetery --docks: 4406 1038 0 Moonglow Docks --healer: 4388 1082 0 Moonglow Healer -+moongate: 4468 1284 0 Moonglow Moongate --reagents: 4412 1111 0 Moonglow Reagent Shop --inn: 4484 1064 0 Moonglow Student Hostel --mage: 4448 1090 0 Moonglow's Finest Alchemy --arms: 586 2170 0 More Than Just Mail --inn: 1360 3815 0 The Morning Star Inn -+Terrain: 3690 2760 2 Mountain Pass -+dungeon: 1457 1329 3 mushroom caves --exit: 1478 1495 3 mushroom caves --other: 2891 744 0 The Musician's Hall --mage: 659 2141 0 Mystic Treasures --bard: 2424 555 0 The Mystical Lute --tavern: 3769 1218 0 Mystical Spirits --baker: 5746 3200 0 Nature's Best Baked Goods --exit: 2188 319 3 ne dungeon -+dungeon: 1788 569 3 ne dungeon --provisioner: 1441 3796 0 Needful Things --warriors guild: 2482 428 0 The New World Order --docks: 2940 3410 0 North Docks -+scenic: 2452 79 0 The North Mines --inn: 1458 1525 0 The North Side Inn --bridge: 1550 1529 0 The Northern Bridge --baker: 3610 2572 1 Now You're Cookin' -+Terrain: 420 1196 3 Nox Tereg -+town: 3600 1231 0 Nujel'm --blacksmith: 3546 1185 0 Nujel'm Blacksmith --fletcher: 3546 1194 0 Nujel'm Bowry --butcher: 3555 1171 0 Nujel'm Butcher -+graveyard: 3529 1141 0 Nujel'm Cemetery --point of interest: 3723 1396 0 Nujel'm Court --point of interest: 3690 1284 0 Nujel'm Palace --tanner: 3545 1178 0 Nujel'm Tannery --theater: 3739 1231 0 Nujel'm Theater -+dungeon: 548 454 3 nw dungeon --exit: 427 112 3 nw dungeon -+dungeon: 556 427 3 nw dungeon --carpenter: 2513 477 0 The Oak Throne --shipwright: 1416 1754 0 The Oaken Oar -+Body of Water: 993 620 3 Oasis -+Terrain: 5543 2618 0 oasis --fishermans guild: 1437 3750 0 Ocean's Treasure -+town: 3664 2558 1 Ocllo --docks: 3633 2654 1 Ocllo Docks --docks: 3654 2664 1 Ocllo Docks --library: 3612 2466 1 Ocllo Public Library -+landmark: 3519 2787 2 Old Mine Entrance - Closed --provisioner: 2456 428 0 The Old Miners' Supplies --blacksmith: 630 2194 0 On Guard Armoury -+ruins: 5765 2618 0 Ophidian Lair -+landmark: 18 950 3 The Oracle -+dungeon: 1014 1434 0 Orc Cave -+ruins: 632 1484 0 Orc Fort -+ruins: 2176 1372 0 Orc Fort -+ruins: 5211 3611 0 Orc Fort -+scenic: 1183 1188 3 orchard --miners guild: 2855 734 0 The Ore of Vesper --painter: 3638 2499 1 Paint and More --library: 2003 2726 0 Paladin's Library -+town: 5751 3231 0 Papua --docks: 5827 3256 0 Papua dock --tailor: 5754 3273 0 Papua Tailor --point of interest: 1893 2763 0 park --point of interest: 5251 58 0 park -+Terrain: 1028 272 3 Pass of Karnaugh -+landmark: 881 1303 3 passage -+landmark: 857 1312 3 passage -+dungeon: 6075 3330 0 passage to Britain -+dungeon: 1628 3318 0 passage to Delucia -+landmark: 2775 893 0 passage to Lost Cemetery -+landmark: 2404 218 0 passage to Lost Lands -+landmark: 6084 3674 0 passage to North Mines -+dungeon: 5150 4063 0 passage to Trinsic -+dungeon: 5138 3665 0 passage to Trinsic --jeweler: 1447 3981 0 The Pearl of Jhelom --jeweler: 1895 2809 0 The Pearl of Trinsic --inn: 2715 2098 0 The Peg Leg Inn --theater: 1424 4016 0 Performing Arts Centre --shipwright: 5805 3270 0 Pier 39 --thieves guild: 2659 2194 0 Pirate's Den --tavern: 2680 2238 0 The Pirate's Plunder --provisioner: 2735 2254 0 Pirate's Provisioners --bank: 2731 2188 0 A Place Fer Yer Stuff --baker: 2975 3358 0 Plenty O' Dough -+scenic: 1548 1192 3 pool --gate: 1421 1633 0 Poor Gate -+Body of Water: 495 370 3 Pormir Felwis -+Body of Water: 706 469 3 Pormir Harm -+Body of Water: 1128 816 3 Pormir Priin "River of Unity" -+teleporter: 5905 4069 0 portal to island temple -+teleporter: 5733 3190 0 portal to Moonglow (recsu) -+teleporter: 4540 845 0 portal to Papua (recdu) -+landmark: 826 777 3 Power Core --jeweler: 1451 1679 0 Premier Gems --butcher: 3714 2651 2 The Prime Cut Butcher Shop --provisioner: 1602 1712 0 Profuse Provisions --provisioner: 1598 539 3 a provisioner --blacksmith: 3554 1202 0 Public Smithing --fletcher: 1470 1578 0 Quality Fletching --fletcher: 2861 812 0 The Ranger's Tool --warriors guild: 3740 2692 2 Rangers Cabin --archers guild: 554 2145 0 Rangers' Guild -+landmark: 645 817 3 ratman lair --exit: 1348 1510 3 ratman mine -+dungeon: 1030 1154 3 ratman mine -+ruins: 1069 1151 3 ratman village -+scenic: 1280 734 3 Reagent Garden --reagents: 5714 3202 0 The Reagent Shop --provisioner: 1852 2831 0 Red's Curious Goods -+landmark: 1362 1073 3 Reg Volom --inn: 3732 1306 0 Restful Slumber --healer: 369 1432 3 resurrection tree --arms: 5805 3300 0 The Revenge Shoppe --point of interest: 1280 779 3 Ridgeback Pen --tailor: 1547 1659 0 The Right Fit --bridge: 1512 1705 0 River's Gate Bridge -+Body of Water: 5360 3396 0 The Ru -+Body of Water: 5457 3831 0 The Ru -+ruins: 1084 651 3 Ruined Castle -+ruins: 653 933 3 ruined tower -+ruins: 875 524 3 Ruined Villa -+ruins: 337 864 3 ruins --inn: 2033 2801 0 The Rusty Anchor -+moongate: 1174 1286 3 Sacrifice -+shrine: 1171 1288 3 Sacrifice -+shrine: 3355 289 0 Sacrifice --shipwright: 1452 3747 0 Sailor's Keeper -+Terrain: 5724 2923 0 Sak Teb --tavern: 1620 1586 0 The Salty Dog -+landmark: 1044 519 3 Savage Camp -+landmark: 1238 733 3 Savage Clan Settlement --carpenter: 1430 1597 0 The Saw Horse --tailor: 4458 1060 0 Scholar's Cut --provisioner: 4417 1064 0 The Scholar's Goods --inn: 4401 1165 0 The Scholar's Inn -+dungeon: 1747 1235 3 se dungeon --exit: 2114 830 3 se dungeon -+Body of Water: 5937 2660 0 Sea of Harmony --shipwright: 3700 1214 0 Seaborne Ships --customs: 3717 1228 1 Seaborne Ships --library: 5243 179 0 Seat of Knowledge --bank: 3620 2617 2 The Second Bank of Haven --arms: 4440 1162 0 Second Defense Armory --arms: 1441 3719 0 Second Skin --inn: 5165 30 0 Seeker's Inn --point of interest: 1541 1685 0 Senator Robin's House and Office --butcher: 2912 3485 0 Serpent Hold Meats -+landmark: 2986 2887 0 Serpent Pillar (doracron) -+landmark: 425 3279 0 Serpent Pillar (doracron) -+landmark: 5974 2694 0 Serpent Pillar (sueacron) -+landmark: 5266 2757 0 Serpent Pillar (sueacron) --warriors guild: 3031 3350 0 Serpent Warriors --arms: 3018 3433 0 Serpent's Arms -+town: 3025 3498 0 Serpent's Hold --bank: 2880 3472 0 Serpent's Hold Bank --healer: 2997 3428 0 Serpent's Hold Healer --stable: 3036 3464 0 Serpent's Hold Stablery --mage: 3002 3350 0 Serpent's Spells -+dungeon: 811 874 3 Serpentine Passage -+Terrain: 5470 3515 0 Serpents Cousins --stable: 2905 3517 0 Serpents Hold Stablery -+dungeon: 1492 1641 0 sewer entrance --baker: 3628 2540 2 The Shakin' Bakery -+Body of Water: 5902 3106 0 Shallow Sea --exit: 5396 129 0 Shame -+dungeon: 512 1559 0 Shame --inn: 554 2178 0 The Shattered Skull --tailor: 650 2180 0 Shear Pleasure --provisioner: 1318 1328 3 sheep farm --jeweler: 2882 723 0 The Shimmering Jewel --arms: 1895 2653 0 Shining Path Armory -+shrine: 1106 404 3 Shrine of the Virtues --tavern: 3736 1255 0 The Silver Bow --bowyer: 3054 3369 0 Silver Serpent Bows --tailor: 2881 3503 0 Silver Serpent Tailors -+town: 595 2263 0 Skara Brae --docks: 648 2235 0 Skara Brae Docks --docks: 672 2235 0 Skara Brae Docks -+moongate: 645 2068 0 Skara Brae Moongate --point of interest: 565 2213 0 Skara Brae Town Hall --tailor: 896 610 3 Skis-In-Lem --butcher: 2438 410 0 The Slaughtered Cow -+landmark: 1442 1122 3 small lumber camp -+Body of Water: 5789 2430 0 Sok' Gah --shipwright: 2026 2845 0 Sons Of The Sea --mage: 1485 1550 0 The Sorcerer's Delight --sorcerers guild: 4684 1412 0 The Sorcerer's Guild --mage: 3628 2541 1 The Sorceror's Guild --stable: 1296 1759 0 Sosarian Steeds --docks: 3006 3465 0 South Dock --gate: 2003 2921 0 South Gate --butcher: 5700 3279 0 The Southside Butchery --stable: 5671 3287 0 Southside Stables -+dungeon: 1420 910 3 spider dungeon --exit: 1787 993 3 spider dungeon -+dungeon: 1490 879 3 spider dungeon -+Terrain: 1447 964 3 spider wood --tailor: 2961 621 0 The Spinning Wheel --tailor: 2840 885 0 The Spinning Wheel -+moongate: 1532 1340 3 Spirituality -+shrine: 1526 1340 3 Spirituality -+shrine: 1595 2490 0 Spirituality --stable: 1499 619 3 the stables --stable: 2526 375 0 Stables --stable: 1385 1658 0 The Stables --inn: 3695 2160 0 The Stag and Lion -+moongate: 5153 1760 1 Standard-Moongate -+teleporter: 5173 1589 1 Starroom -+landmark: 466 1584 3 statue -+scenic: 1701 291 3 statue room --point of interest: 2465 522 0 statues -+scenic: 728 475 3 stepping stones --tailor: 3667 2586 1 A Stitch In Time --tailor: 3687 2477 2 A Stitch in Time Tailor Shop --tailor: 3666 2235 0 Stitchin' Time --jeweler: 5662 3150 0 Strange Rocks --arms: 1481 1584 0 Strength and Steel --tanner: 2524 524 0 The Stretched Hide --bowyer: 564 968 0 The Sturdy Bow --provisioner: 578 2227 0 Sundry Supplies --shipwright: 592 2277 0 Superior Ships --provisioner: 3008 3389 0 Supplies --provisioner: 5219 4012 0 The Supply Depot --provisioner: 2530 551 0 The Survival Shop -+Terrain: 1124 739 3 Swamp --inn: 1493 1619 0 Sweet Dreams --butcher: 3708 2649 1 Sweet Meat -+teleporter: 5443 2325 1 T1 to the Southeast of Papua -+teleporter: 6053 2407 1 T2 to the Northwest of Champ 2 "Ice East" -+teleporter: 5996 2367 1 T3 to the East of Delucia -+teleporter: 6080 2340 1 T4 to the South of this Point -+teleporter: 5731 3420 1 T5 to "Ice West" -+teleporter: 5503 3971 1 T6 to "Ice East" --tailor: 1600 552 3 a tailor --tailor: 3774 1265 0 Tailor of the Isle --tanner: 517 986 0 The Tanned Hide --tanner: 2860 999 0 Tanner's Shop -+teleporter: 4442 1122 0 teleporter park -+teleporter: 1414 3829 0 teleporters -+scenic: 4708 1116 0 Telescope --guild: 894 673 3 Ter-An-Eks-Por --mage: 840 571 3 Ter-Ort-Lem --inn: 840 707 3 Ter-Zu -+dungeon: 5426 3120 0 Terathan Keep --exit: 5340 1599 0 Terathan Keep -+Body of Water: 1620 420 3 Termir Flam "The Lake of Fire" -+Body of Water: 1316 1120 3 Termir Ilshen "Ilshen's Lake" -+landmark: 580 420 3 Terort Skitas "Temple of Knowledge" -+Terrain: 6028 2933 0 Terra Sanctum --tinker: 3720 2126 0 The Tic-Toc Shop --tinker: 1253 588 3 a tinker --tinker: 2940 3500 0 Tinker of the Isle --tinkers guild: 1422 1654 0 Tinker's Guild --tinkers guild: 1848 2680 0 Tinker's Guild --tinker: 5726 3243 0 Tinker's Paradise -+teleporter: 5506 814 1 to Ancient Wyrm's Lair (Destard lvl 3) -+teleporter: 5682 1437 1 to Ancient Wyrm's Lair (Destard lvl 3) --exit: 6031 1500 0 to Britain -+teleporter: 5682 1440 1 to Champ "Despice" -+teleporter: 5265 683 1 to Champ "Despice" -+teleporter: 5360 1540 1 to Champ "Fire" -+teleporter: 5265 669 1 to Champ "Fire" -+teleporter: 5145 973 1 to Champ "Terathan Keep" -+teleporter: 5506 817 1 to Champ "Terathan Keep" -+teleporter: 5140 1773 1 to Champ "Terathan Keep" --exit: 6026 1344 0 to City of the Dead -+teleporter: 5356 1540 1 to Deceit (lvl 4) -+teleporter: 5140 973 1 to Deceit (lvl 4) --exit: 6004 1379 0 to Delucia --exit: 6141 1430 0 to Hoppers Bog -+landmark: 318 789 0 to lighthouse -+landmark: 1958 2068 0 to Lost Lands -+landmark: 5126 3144 0 to Marble Building -+teleporter: 5199 71 0 to park -+teleporter: 1516 879 3 to Reg Volom (the island) -+teleporter: 1363 1105 3 to spider dungeon --exit: 5191 152 0 to surface -+teleporter: 5217 18 0 to town --exit: 5899 1410 0 to Trinsic forest -+Body of Water: 5771 4050 0 Tortoise Lagoon -+landmark: 1675 1074 3 tower --gate: 2281 1210 0 town gate --point of interest: 3732 2583 2 Training Dummies --point of interest: 1972 2698 0 Training Ground -+landmark: 1256 865 0 Training Tower --inn: 1844 2735 0 The Traveler's Inn -+scenic: 1038 701 3 Tribal Berry Orchard --mage: 5731 3183 0 Tricks of the Trade -+town: 1879 2766 0 Trinsic --butcher: 1991 2887 0 The Trinsic Cut --docks: 2072 2856 0 Trinsic Docks --tanner: 1991 2867 0 Trinsic Fine Skins --healer: 1911 2805 0 Trinsic Healer --point of interest: 1895 2719 0 Trinsic Meeting Hall -+moongate: 1829 2949 0 Trinsic Moongate --bank: 1897 2684 0 Trinsic Royal Bank --stable: 1822 2739 0 Trinsic Stablery --warriors guild: 2019 2748 0 Trinsic Training Hall --inn: 1566 1049 3 Twin Oaks Tavern --baker: 2998 760 0 The Twisted Oven -+ruins: 856 463 3 undead camp -+ruins: 360 1140 3 undead fort --tavern: 1547 1768 0 The Unicorn's Horn -+landmark: 3610 2585 2 Uzeraan's Mansion --point of interest: 3595 2588 2 Uzeraan, Keeper of Quests -+moongate: 528 216 3 Valor -+shrine: 529 212 3 Valor -+shrine: 2491 3933 0 Valor -+scenic: 1211 763 3 Vegetable Patch -+landmark: 836 641 3 Ver Lor Reg -+town: 2884 839 0 Vesper -+graveyard: 2753 867 0 Vesper Cemetery --customs: 2944 934 0 Vesper Customs --docks: 3017 827 0 Vesper Docks --docks: 3034 827 0 Vesper Docks --point of interest: 2743 980 0 Vesper Guard Tower --point of interest: 2923 981 0 Vesper Museum --inn: 2962 885 0 Vesper Youth Hostel --carpenter: 2627 2100 0 Violente Woodworks --bridge: 1520 1628 0 Virtue's Pass --point of interest: 948 492 3 Volcano -+scenic: 1651 2890 0 Volcano Tunnel --arms: 2533 576 0 Warrior's Battle Gear --blacksmith: 1419 3859 0 Warrior's Bounty --arms: 2835 805 0 Warrior's Companion --arms: 2217 1170 0 The Warrior's Supplies --warriors guild: 3058 3400 0 The Warriors' Guild --warriors guild: 1341 1733 0 The Warriors' Guild --gate: 5313 3970 0 Watch Gates --point of interest: 1619 1760 0 The Watch Tower --point of interest: 5265 3939 0 Watch Tower and Keep -+landmark: 917 993 3 watchpost --point of interest: 2212 1115 0 watchtower -+scenic: 1712 3005 0 waterfall --inn: 1585 1591 0 The Wayfarer's Inn --weapons guild: 3731 2578 2 Weaponsmith --gate: 1831 2779 0 West Trinsic Gate -+dungeon: 1361 890 0 Wind -+town: 5252 104 0 Wind --mage: 5148 60 0 Wind Alchemy --bank: 5346 74 0 Wind Bank --healer: 5263 129 0 Wind Healer --tailor: 5203 86 0 Windy Clothes --inn: 5218 175 0 Windy Inn -+dungeon: 652 1301 3 wisp dungeon -+dungeon: 2042 226 0 Wrong --exit: 5825 632 0 Wrong -+Terrain: 5604 2742 0 Y'Nah Teb --bank: 5275 3977 0 Ye Olde Eleventh Bank --bank: 5669 3131 0 Ye Olde Loan and Savings --point of interest: 618 886 0 Ye Olde Winery -+town: 504 942 0 Yew -+graveyard: 722 1117 0 Yew Cemetery --point of interest: 553 826 0 Yew Mill -+moongate: 771 754 0 Yew Moongate --butcher: 529 1008 0 Yew's Finest Cuts --blacksmith: 792 665 3 Zhel-In-Lem --blacksmith: 5225 4000 0 Zoot's Hammer --bank: 989 520 4 --blacksmith: 976 512 4 --tailor: 976 527 4 --tanner: 978 528 4 --chivalrykeeper: 1016 514 4 --chivalrykeeper: 961 517 4 --holymage: 1004 528 4 --reagents: 1004 526 4 --tinker: 1003 512 4 --carpenter: 1004 514 4 --jeweler: 995 510 4 --provisioner: 991 510 4 --inn: 989 527 4 --stable: 1027 494 4 --healer: 1029 520 4 --healer: 950 520 4 --blacksmith: 1977 1365 4 --stable: 1992 1315 4 --provisioner: 2011 1326 4 --baker: 2017 1356 4 --tavern: 2027 1353 4 --mage: 2023 1379 4 --reagents: 2025 1387 4 --jeweler: 2045 1397 4 --bank: 2048 1343 4 --inn: 2037 1311 4 --tinker: 2066 1282 4 --carpenter: 2060 1283 4 --tailor: 2083 1322 4 --tanner: 2078 1327 4 --healer: 2068 1372 4 --inn: 1056 1434 4 --tavern: 1051 1434 4 \ No newline at end of file diff --git a/Scripts/Engines/Spawner/PremiumSpawner/PSCount.cs b/Scripts/Engines/Spawner/PremiumSpawner/PSCount.cs new file mode 100644 index 0000000..1eb4b1d --- /dev/null +++ b/Scripts/Engines/Spawner/PremiumSpawner/PSCount.cs @@ -0,0 +1,45 @@ +using System; +using System.IO; +using Server; +using System.Text; +using System.Collections.Generic; +using System.Net; +using Server.Mobiles; +using Server.Network; +using Server.Commands; + +namespace Server.Commands +{ + public class PSpawnerCount + { + public static void Initialize() + { + Register( "pscount", AccessLevel.Administrator, new CommandEventHandler( Clearall_OnCommand ) ); + } + + public static void Register( string command, AccessLevel access, CommandEventHandler handler ) + { + CommandSystem.Register( command, access, handler ); + } + + [Usage( "pscount" )] + [Description( "Count PremiumSpawners." )] + public static void Clearall_OnCommand( CommandEventArgs e ) + { + Mobile from = e.Mobile; + DateTime time = DateTime.Now; + + List pspawnerlist = new List(); + + foreach ( Item pspawner in World.Items.Values ) + { + if ( pspawner.Parent == null && pspawner is PremiumSpawner) + { + pspawnerlist.Add( pspawner ); + } + } + + from.SendMessage( "Premium Spawners: {0}", pspawnerlist.Count ); + } + } +} \ No newline at end of file diff --git a/Scripts/Engines/Spawner/PremiumSpawner/PremiumSpawner.cs b/Scripts/Engines/Spawner/PremiumSpawner/PremiumSpawner.cs new file mode 100644 index 0000000..b6ef9fe --- /dev/null +++ b/Scripts/Engines/Spawner/PremiumSpawner/PremiumSpawner.cs @@ -0,0 +1,1515 @@ +//Engine r147 +using System; +using System.Collections; +using System.Collections.Generic; +using System.IO; +using System.Reflection; +using System.Text; +using Server; +using Server.Commands; +using Server.Items; +using Server.Network; +using CPA = Server.CommandPropertyAttribute; + +namespace Server.Mobiles +{ + public class PremiumSpawner : Item + { + private int m_Team; + private int m_HomeRange; // = old SpawnRange + private int m_WalkingRange = -1; // = old HomeRange + private int m_SpawnID = 99; + private int m_Count; + private int m_CountA; + private int m_CountB; + private int m_CountC; + private int m_CountD; + private int m_CountE; + private TimeSpan m_MinDelay; + private TimeSpan m_MaxDelay; + private List m_CreaturesName; // creatures to be spawned + private List m_Creatures; // spawned creatures + private List m_CreaturesNameA; + private List m_CreaturesA; + private List m_CreaturesNameB; + private List m_CreaturesB; + private List m_CreaturesNameC; + private List m_CreaturesC; + private List m_CreaturesNameD; + private List m_CreaturesD; + private List m_CreaturesNameE; + private List m_CreaturesE; + private DateTime m_End; + private InternalTimer m_Timer; + private bool m_Running; + private bool m_Water; + private bool m_Group; + private WayPoint m_WayPoint; + + public bool IsFull{ get{ return ( m_Creatures != null && m_Creatures.Count >= m_Count ); } } + public bool IsFulla{ get{ return ( m_CreaturesA != null && m_CreaturesA.Count >= m_CountA ); } } + public bool IsFullb{ get{ return ( m_CreaturesB != null && m_CreaturesB.Count >= m_CountB ); } } + public bool IsFullc{ get{ return ( m_CreaturesC != null && m_CreaturesC.Count >= m_CountC ); } } + public bool IsFulld{ get{ return ( m_CreaturesD != null && m_CreaturesD.Count >= m_CountD ); } } + public bool IsFulle{ get{ return ( m_CreaturesE != null && m_CreaturesE.Count >= m_CountE ); } } + + public List CreaturesName + { + get { return m_CreaturesName; } + set + { + m_CreaturesName = value; + if ( m_CreaturesName.Count < 1 ) + Stop(); + + InvalidateProperties(); + } + } + + public List SubSpawnerA + { + get { return m_CreaturesNameA; } + set + { + m_CreaturesNameA = value; + if ( m_CreaturesNameA.Count < 1 ) + Stop(); + + InvalidateProperties(); + } + } + + public List SubSpawnerB + { + get { return m_CreaturesNameB; } + set + { + m_CreaturesNameB = value; + if ( m_CreaturesNameB.Count < 1 ) + Stop(); + + InvalidateProperties(); + } + } + + public List SubSpawnerC + { + get { return m_CreaturesNameC; } + set + { + m_CreaturesNameC = value; + if ( m_CreaturesNameC.Count < 1 ) + Stop(); + + InvalidateProperties(); + } + } + + public List SubSpawnerD + { + get { return m_CreaturesNameD; } + set + { + m_CreaturesNameD = value; + if ( m_CreaturesNameD.Count < 1 ) + Stop(); + + InvalidateProperties(); + } + } + + public List SubSpawnerE + { + get { return m_CreaturesNameE; } + set + { + m_CreaturesNameE = value; + if ( m_CreaturesNameE.Count < 1 ) + Stop(); + + InvalidateProperties(); + } + } + + public List Creatures + { + get { return m_Creatures; } + set + { + m_Creatures = value; + if ( m_Creatures.Count < 1 ) + Stop(); + + InvalidateProperties(); + } + } + + public List CreaturesA + { + get { return m_CreaturesA; } + set + { + m_CreaturesA = value; + if ( m_CreaturesA.Count < 1 ) + Stop(); + + InvalidateProperties(); + } + } + + public List CreaturesB + { + get { return m_CreaturesB; } + set + { + m_CreaturesB = value; + if ( m_CreaturesB.Count < 1 ) + Stop(); + + InvalidateProperties(); + } + } + + public List CreaturesC + { + get { return m_CreaturesC; } + set + { + m_CreaturesC = value; + if ( m_CreaturesC.Count < 1 ) + Stop(); + + InvalidateProperties(); + } + } + + public List CreaturesD + { + get { return m_CreaturesD; } + set + { + m_CreaturesD = value; + if ( m_CreaturesD.Count < 1 ) + Stop(); + + InvalidateProperties(); + } + } + + public List CreaturesE + { + get { return m_CreaturesE; } + set + { + m_CreaturesE = value; + if ( m_CreaturesE.Count < 1 ) + Stop(); + + InvalidateProperties(); + } + } + + public virtual int CreaturesNameCount { get { return m_CreaturesName.Count; } } + public virtual int CreaturesNameCountA { get { return m_CreaturesNameA.Count; } } + public virtual int CreaturesNameCountB { get { return m_CreaturesNameB.Count; } } + public virtual int CreaturesNameCountC { get { return m_CreaturesNameC.Count; } } + public virtual int CreaturesNameCountD { get { return m_CreaturesNameD.Count; } } + public virtual int CreaturesNameCountE { get { return m_CreaturesNameE.Count; } } + + public override void OnAfterDuped( Item newItem ) + { + PremiumSpawner s = newItem as PremiumSpawner; + + if ( s == null ) + return; + + s.m_CreaturesName = new List( m_CreaturesName ); + s.m_CreaturesNameA = new List( m_CreaturesNameA ); + s.m_CreaturesNameB = new List( m_CreaturesNameB ); + s.m_CreaturesNameC = new List( m_CreaturesNameC ); + s.m_CreaturesNameD = new List( m_CreaturesNameD ); + s.m_CreaturesNameE = new List( m_CreaturesNameE ); + } + + [CommandProperty( AccessLevel.GameMaster )] + public int Count + { + get { return m_Count; } + set { m_Count = value; InvalidateProperties(); } + } + + [CommandProperty( AccessLevel.GameMaster )] + public int CountA + { + get { return m_CountA; } + set { m_CountA = value; InvalidateProperties(); } + } + + [CommandProperty( AccessLevel.GameMaster )] + public int CountB + { + get { return m_CountB; } + set { m_CountB = value; InvalidateProperties(); } + } + + [CommandProperty( AccessLevel.GameMaster )] + public int CountC + { + get { return m_CountC; } + set { m_CountC = value; InvalidateProperties(); } + } + + [CommandProperty( AccessLevel.GameMaster )] + public int CountD + { + get { return m_CountD; } + set { m_CountD = value; InvalidateProperties(); } + } + + [CommandProperty( AccessLevel.GameMaster )] + public int CountE + { + get { return m_CountE; } + set { m_CountE = value; InvalidateProperties(); } + } + + [CommandProperty( AccessLevel.GameMaster )] + public WayPoint WayPoint + { + get + { + return m_WayPoint; + } + set + { + m_WayPoint = value; + } + } + + [CommandProperty( AccessLevel.GameMaster )] + public bool Running + { + get { return m_Running; } + set + { + if ( value ) + Start(); + else + Stop(); + + InvalidateProperties(); + } + } + + [CommandProperty( AccessLevel.GameMaster )] + public int HomeRange + { + get { return m_HomeRange; } + set { m_HomeRange = value; InvalidateProperties(); } + } + + [CommandProperty( AccessLevel.GameMaster )] + public int WalkingRange + { + get { return m_WalkingRange; } + set { m_WalkingRange = value; InvalidateProperties(); } + } + + [CommandProperty( AccessLevel.GameMaster )] + public int SpawnID + { + get { return m_SpawnID; } + set { m_SpawnID = value; InvalidateProperties(); } + } + + [CommandProperty( AccessLevel.GameMaster )] + public int Team + { + get { return m_Team; } + set { m_Team = value; InvalidateProperties(); } + } + + [CommandProperty( AccessLevel.GameMaster )] + public TimeSpan MinDelay + { + get { return m_MinDelay; } + set { m_MinDelay = value; InvalidateProperties(); } + } + + [CommandProperty( AccessLevel.GameMaster )] + public TimeSpan MaxDelay + { + get { return m_MaxDelay; } + set { m_MaxDelay = value; InvalidateProperties(); } + } + + [CommandProperty( AccessLevel.GameMaster )] + public TimeSpan NextSpawn + { + get + { + if ( m_Running ) + return m_End - DateTime.Now; + else + return TimeSpan.FromSeconds( 0 ); + } + set + { + Start(); + DoTimer( value ); + } + } + + [CommandProperty( AccessLevel.GameMaster )] + public bool Group + { + get { return m_Group; } + set { m_Group = value; InvalidateProperties(); } + } + + [Constructable] + public PremiumSpawner( int amount, int subamountA, int subamountB, int subamountC, int subamountD, int subamountE, int spawnid, int minDelay, int maxDelay, int team, int homeRange, int walkingRange, string creatureName, string creatureNameA, string creatureNameB, string creatureNameC, string creatureNameD, string creatureNameE ) : base( 0x1f13 ) + { + List creaturesName = new List(); + creaturesName.Add( creatureName ); + + List creatureNameAA = new List(); + creaturesName.Add( creatureNameA ); + + List creatureNameBB = new List(); + creaturesName.Add( creatureNameB ); + + List creatureNameCC = new List(); + creaturesName.Add( creatureNameC ); + + List creatureNameDD = new List(); + creaturesName.Add( creatureNameD ); + + List creatureNameEE = new List(); + creaturesName.Add( creatureNameE ); + + InitSpawn( amount, subamountA, subamountB, subamountC, subamountD, subamountE, spawnid, TimeSpan.FromMinutes( minDelay ), TimeSpan.FromMinutes( maxDelay ), team, homeRange, walkingRange, creaturesName, creatureNameAA, creatureNameBB, creatureNameCC, creatureNameDD, creatureNameEE ); + } + + [Constructable] + public PremiumSpawner( string creatureName ) : base( 0x1f13 ) + { + List creaturesName = new List(); + creaturesName.Add( creatureName ); + + List creatureNameAA = new List(); + List creatureNameBB = new List(); + List creatureNameCC = new List(); + List creatureNameDD = new List(); + List creatureNameEE = new List(); + + InitSpawn( 1, 0, 0, 0, 0, 0, 99, TimeSpan.FromMinutes( 5 ), TimeSpan.FromMinutes( 10 ), 0, 4, -1, creaturesName, creatureNameAA, creatureNameBB, creatureNameCC, creatureNameDD, creatureNameEE ); + } + + [Constructable] + public PremiumSpawner() : base( 0x1f13 ) + { + List creaturesName = new List(); + + List creatureNameAA = new List(); + List creatureNameBB = new List(); + List creatureNameCC = new List(); + List creatureNameDD = new List(); + List creatureNameEE = new List(); + + InitSpawn( 1, 0, 0, 0, 0, 0, 99, TimeSpan.FromMinutes( 5 ), TimeSpan.FromMinutes( 10 ), 0, 4, -1, creaturesName, creatureNameAA, creatureNameBB, creatureNameCC, creatureNameDD, creatureNameEE ); + } + + public PremiumSpawner( int amount, int subamountA, int subamountB, int subamountC, int subamountD, int subamountE, int spawnid, TimeSpan minDelay, TimeSpan maxDelay, int team, int homeRange, int walkingRange, List creaturesName, List creatureNameAA, List creatureNameBB, List creatureNameCC, List creatureNameDD, List creatureNameEE ) + : base( 0x1f13 ) + { + InitSpawn( amount, subamountA, subamountB, subamountC, subamountD, subamountE, spawnid, minDelay, maxDelay, team, homeRange, walkingRange, creaturesName, creatureNameAA, creatureNameBB, creatureNameCC, creatureNameDD, creatureNameEE ); + } + + public override string DefaultName + { + get { return "PremiumSpawner"; } + } + + public void InitSpawn( int amount, int subamountA, int subamountB, int subamountC, int subamountD, int subamountE, int SpawnID, TimeSpan minDelay, TimeSpan maxDelay, int team, int homeRange, int walkingRange, List creaturesName, List creatureNameAA, List creatureNameBB, List creatureNameCC, List creatureNameDD, List creatureNameEE ) + { + Name = "PremiumSpawner"; + m_SpawnID = SpawnID; + Visible = false; + Movable = false; + m_Running = true; + m_Water = false; + m_Group = false; + m_MinDelay = minDelay; + m_MaxDelay = maxDelay; + m_Count = amount; + m_CountA = subamountA; + m_CountB = subamountB; + m_CountC = subamountC; + m_CountD = subamountD; + m_CountE = subamountE; + m_Team = team; + m_HomeRange = homeRange; + m_WalkingRange = walkingRange; + m_CreaturesName = creaturesName; + m_CreaturesNameA = creatureNameAA; + m_CreaturesNameB = creatureNameBB; + m_CreaturesNameC = creatureNameCC; + m_CreaturesNameD = creatureNameDD; + m_CreaturesNameE = creatureNameEE; + m_Creatures = new List(); + m_CreaturesA = new List(); + m_CreaturesB = new List(); + m_CreaturesC = new List(); + m_CreaturesD = new List(); + m_CreaturesE = new List(); + DoTimer( TimeSpan.FromSeconds( 1 ) ); + } + + public PremiumSpawner( Serial serial ) : base( serial ) + { + } + + public override void OnDoubleClick( Mobile from ) + { + if ( from.AccessLevel < AccessLevel.GameMaster ) + return; + + PremiumSpawnerGump g = new PremiumSpawnerGump( this ); + from.SendGump( g ); + } + + public override void GetProperties( ObjectPropertyList list ) + { + base.GetProperties( list ); + + if ( m_Running ) + { + list.Add( 1060742 ); // active + + list.Add( 1060656, m_Count.ToString() ); + list.Add( 1061169, m_HomeRange.ToString() ); + list.Add( 1060658, "walking range\t{0}", m_WalkingRange ); + + list.Add( 1060663, "SpawnID\t{0}", m_SpawnID.ToString() ); + +// list.Add( 1060659, "group\t{0}", m_Group ); +// list.Add( 1060660, "team\t{0}", m_Team ); + list.Add( 1060661, "speed\t{0} to {1}", m_MinDelay, m_MaxDelay ); + + for ( int i = 0; i < 2 && i < m_CreaturesName.Count; ++i ) + list.Add( 1060662 + i, "{0}\t{1}", m_CreaturesName[i], CountCreatures( Creatures, m_CreaturesName[i] ) ); + } + else + { + list.Add( 1060743 ); // inactive + } + } + + public override void OnSingleClick( Mobile from ) + { + base.OnSingleClick( from ); + + if ( m_Running ) + LabelTo( from, "[Running]" ); + else + LabelTo( from, "[Off]" ); + } + + public void SpawnWater() + { + } + + public void Start() + { + if ( !m_Running ) + { + if ( m_CreaturesName.Count > 0 || m_CreaturesNameA.Count > 0 || m_CreaturesNameB.Count > 0 || m_CreaturesNameC.Count > 0 || m_CreaturesNameD.Count > 0 || m_CreaturesNameE.Count > 0 ) + { + m_Running = true; + DoTimer(); + } + } + } + + public void Stop() + { + if ( m_Running ) + { + m_Timer.Stop(); + m_Running = false; + RemoveCreatures(m_Creatures); + RemoveCreatures(m_CreaturesA); + RemoveCreatures(m_CreaturesB); + RemoveCreatures(m_CreaturesC); + RemoveCreatures(m_CreaturesD); + RemoveCreatures(m_CreaturesE); + } + } + + public static string ParseType( string s ) + { + return s.Split( null, 2 )[0]; + } + + public void Defrag( List m_Beings ) + { + bool removed = false; + + for ( int i = 0; i < m_Beings.Count; ++i ) + { + IEntity e = m_Beings[i]; + + if ( e is Item ) + { + Item item = (Item)e; + + if ( item.Deleted || item.Parent != null ) + { + m_Beings.RemoveAt( i ); + --i; + removed = true; + } + } + else if ( e is Mobile ) + { + Mobile m = (Mobile)e; + + if ( m.Deleted ) + { + m_Beings.RemoveAt( i ); + --i; + removed = true; + } + else if ( m is BaseCreature ) + { + BaseCreature bc = (BaseCreature)m; + if ( bc.Controlled || bc.IsStabled ) + { + m_Beings.RemoveAt( i ); + --i; + removed = true; + } + } + } + else + { + m_Beings.RemoveAt( i ); + --i; + removed = true; + } + } + + if ( removed ) + InvalidateProperties(); + } + + public void OnTick() + { + DoTimer(); + + if ( m_Group ) + { + Defrag(m_Creatures); + Defrag(m_CreaturesA); + Defrag(m_CreaturesB); + Defrag(m_CreaturesC); + Defrag(m_CreaturesD); + Defrag(m_CreaturesE); + + if ( m_Creatures.Count == 0 || m_CreaturesA.Count == 0 || m_CreaturesB.Count == 0 || m_CreaturesC.Count == 0 || m_CreaturesD.Count == 0 || m_CreaturesE.Count == 0 ) + { + Respawn(); + } + else + { + return; + } + } + else + { + Spawn(CreaturesNameCount, m_Creatures, m_Count, m_CreaturesName); + Spawn(CreaturesNameCountA, m_CreaturesA, m_CountA, m_CreaturesNameA); + Spawn(CreaturesNameCountB, m_CreaturesB, m_CountB, m_CreaturesNameB); + Spawn(CreaturesNameCountC, m_CreaturesC, m_CountC, m_CreaturesNameC); + Spawn(CreaturesNameCountD, m_CreaturesD, m_CountD, m_CreaturesNameD); + Spawn(CreaturesNameCountE, m_CreaturesE, m_CountE, m_CreaturesNameE); + } + } + + public void Respawn() // remove all creatures and spawn all again + { + RemoveCreatures(m_Creatures); + RemoveCreatures(m_CreaturesA); + RemoveCreatures(m_CreaturesB); + RemoveCreatures(m_CreaturesC); + RemoveCreatures(m_CreaturesD); + RemoveCreatures(m_CreaturesE); + + for ( int i = 0; i < m_Count; i++ ) + Spawn(CreaturesNameCount, m_Creatures, m_Count, m_CreaturesName); + for ( int i = 0; i < m_CountA; i++ ) + Spawn(CreaturesNameCountA, m_CreaturesA, m_CountA, m_CreaturesNameA); + for ( int i = 0; i < m_CountB; i++ ) + Spawn(CreaturesNameCountB, m_CreaturesB, m_CountB, m_CreaturesNameB); + for ( int i = 0; i < m_CountC; i++ ) + Spawn(CreaturesNameCountC, m_CreaturesC, m_CountC, m_CreaturesNameC); + for ( int i = 0; i < m_CountD; i++ ) + Spawn(CreaturesNameCountD, m_CreaturesD, m_CountD, m_CreaturesNameD); + for ( int i = 0; i < m_CountE; i++ ) + Spawn(CreaturesNameCountE, m_CreaturesE, m_CountE, m_CreaturesNameE); + } + + public void Spawn( int CreatNameCount, List m_Creat, int m_Countt, List m_CreatName ) + { + if ( CreatNameCount > 0 ) + SpawnTwo( Utility.Random( CreatNameCount ), CreatNameCount, m_Creat, m_Countt, m_CreatName ); + + } + + // Used only by PremiumSpawnerGump(line 415-45) + // BROKEN + public void SpawnFromGump( List m_subspawnName, List m_subspawn, int subCount, int subNameCount, string creatureName ) + { + for ( int i = 0; i < m_subspawnName.Count; i++ ) + { + if ( m_subspawnName[i] == creatureName ) + { + SpawnTwo( i, subNameCount, m_subspawn, subCount, m_subspawnName ); + break; + } + } + } + + protected virtual IEntity CreateSpawnedObject( int index, List m_CreatName ) + { + if ( index >= m_CreatName.Count ) + return null; + + Type type = ScriptCompiler.FindTypeByName( ParseType( m_CreatName[index] ) ); + + if ( type != null ) + { + try + { + return Build( CommandSystem.Split( m_CreatName[index] ) ); + } + catch + { + } + } + + return null; + } + + public static IEntity Build( string[] args ) + { + string name = args[0]; + + Add.FixArgs( ref args ); + + string[,] props = null; + + for ( int i = 0; i < args.Length; ++i ) + { + if ( Insensitive.Equals( args[i], "set" ) ) + { + int remains = args.Length - i - 1; + + if ( remains >= 2 ) + { + props = new string[remains / 2, 2]; + + remains /= 2; + + for ( int j = 0; j < remains; ++j ) + { + props[j, 0] = args[i + (j * 2) + 1]; + props[j, 1] = args[i + (j * 2) + 2]; + } + + Add.FixSetString( ref args, i ); + } + + break; + } + } + + Type type = ScriptCompiler.FindTypeByName( name ); + + if ( !Add.IsEntity( type ) ) { + return null; + } + + PropertyInfo[] realProps = null; + + if ( props != null ) + { + realProps = new PropertyInfo[props.GetLength( 0 )]; + + PropertyInfo[] allProps = type.GetProperties( BindingFlags.Static | BindingFlags.Instance | BindingFlags.Public ); + + for ( int i = 0; i < realProps.Length; ++i ) + { + PropertyInfo thisProp = null; + + string propName = props[i, 0]; + + for ( int j = 0; thisProp == null && j < allProps.Length; ++j ) + { + if ( Insensitive.Equals( propName, allProps[j].Name ) ) + thisProp = allProps[j]; + } + + if ( thisProp != null ) + { + CPA attr = Properties.GetCPA( thisProp ); + + if ( attr != null && AccessLevel.GameMaster >= attr.WriteLevel && thisProp.CanWrite && !attr.ReadOnly ) + realProps[i] = thisProp; + } + } + } + + ConstructorInfo[] ctors = type.GetConstructors(); + + for ( int i = 0; i < ctors.Length; ++i ) + { + ConstructorInfo ctor = ctors[i]; + + if ( !Add.IsConstructable( ctor, AccessLevel.GameMaster ) ) + continue; + + ParameterInfo[] paramList = ctor.GetParameters(); + + if ( args.Length == paramList.Length ) + { + object[] paramValues = Add.ParseValues( paramList, args ); + + if ( paramValues == null ) + continue; + + object built = ctor.Invoke( paramValues ); + + if ( built != null && realProps != null ) + { + for ( int j = 0; j < realProps.Length; ++j ) + { + if ( realProps[j] == null ) + continue; + + string result = Properties.InternalSetValue( built, realProps[j], props[j, 1] ); + } + } + + return (IEntity)built; + } + } + + return null; + } + + public void SpawnTwo( int index, int CreatNameCount, List m_Creat, int m_Countt, List m_CreatName ) + { + Map map = Map; + + if ( map == null || map == Map.Internal || CreatNameCount == 0 || index >= CreatNameCount || Parent != null ) + return; + + Defrag(m_Creatures); + Defrag(m_CreaturesA); + Defrag(m_CreaturesB); + Defrag(m_CreaturesC); + Defrag(m_CreaturesD); + Defrag(m_CreaturesE); + + if ( m_Creat.Count >= m_Countt ) + return; + + + IEntity ent = CreateSpawnedObject( index, m_CreatName ); + + if ( ent is Mobile ) + { + Mobile m = (Mobile)ent; + + if ( m.CanSwim ) + { + m_Water = true; + } + else + { + m_Water = false; + } + + m_Creat.Add( m ); + + + Point3D loc = ( m is BaseVendor ? this.Location : GetSpawnPosition() ); + + if ( m is WanderingHealer || m is EvilWanderingHealer || m is EvilHealer ) + { + loc = GetSpawnPosition(); + } + + m.OnBeforeSpawn( loc, map ); + InvalidateProperties(); + + + m.MoveToWorld( loc, map ); + + if ( m is BaseCreature ) + { + BaseCreature c = (BaseCreature)m; + + if( m_WalkingRange >= 0 ) + c.RangeHome = m_WalkingRange; + else + c.RangeHome = m_HomeRange; + + c.CurrentWayPoint = m_WayPoint; + + if ( m_Team > 0 ) + c.Team = m_Team; + + c.Home = this.Location; + } + + m.OnAfterSpawn(); + } + else if ( ent is Item ) + { + Item item = (Item)ent; + + m_Creat.Add( item ); + + Point3D loc = GetSpawnPosition(); + + item.OnBeforeSpawn( loc, map ); + InvalidateProperties(); + + item.MoveToWorld( loc, map ); + + item.OnAfterSpawn(); + } + } + + public Point3D GetSpawnPosition() + { + Map map = Map; + + if ( map == null ) + return Location; + + // Try 10 times to find a Spawnable location. + for ( int i = 0; i < 10; i++ ) + { + int x, y; + + if ( m_HomeRange > 0 ) { + x = Location.X + (Utility.Random( (m_HomeRange * 2) + 1 ) - m_HomeRange); + y = Location.Y + (Utility.Random( (m_HomeRange * 2) + 1 ) - m_HomeRange); + } else { + x = Location.X; + y = Location.Y; + } + + int z = Map.GetAverageZ( x, y ); + + if ( m_Water ) + { + TileMatrix tiles = Map.Tiles; + LandTile _tile = tiles.GetLandTile(x,y); + int id = _tile.ID; + if((id >= 168 && id <= 171) || id == 100) + { + return new Point3D( x, y, this.Z ); + } + else + { + continue; + } + } + + if ( Map.CanSpawnMobile( new Point2D( x, y ), this.Z ) ) + return new Point3D( x, y, this.Z ); + else if ( Map.CanSpawnMobile( new Point2D( x, y ), z ) ) + return new Point3D( x, y, z ); + } + + return this.Location; + } + + public void DoTimer() + { + if ( !m_Running ) + return; + + int minSeconds = (int)m_MinDelay.TotalSeconds; + int maxSeconds = (int)m_MaxDelay.TotalSeconds; + + TimeSpan delay = TimeSpan.FromSeconds( Utility.RandomMinMax( minSeconds, maxSeconds ) ); + DoTimer( delay ); + } + + public void DoTimer( TimeSpan delay ) + { + if ( !m_Running ) + return; + + m_End = DateTime.Now + delay; + + if ( m_Timer != null ) + m_Timer.Stop(); + + m_Timer = new InternalTimer( this, delay ); + m_Timer.Start(); + } + + private class InternalTimer : Timer + { + private PremiumSpawner m_PremiumSpawner; + + public InternalTimer( PremiumSpawner spawner, TimeSpan delay ) : base( delay ) + { + if ( spawner.IsFull || spawner.IsFulla || spawner.IsFullb || spawner.IsFullc || spawner.IsFulld || spawner.IsFulle ) + Priority = TimerPriority.FiveSeconds; + else + Priority = TimerPriority.OneSecond; + + m_PremiumSpawner = spawner; + } + + protected override void OnTick() + { + if ( m_PremiumSpawner != null ) + if ( !m_PremiumSpawner.Deleted ) + m_PremiumSpawner.OnTick(); + } + } + + // Used only by PremiumSpawnerGump (except 1st, used here too) + public int CountCreatures( List m_subspawn, string creatureName ) + { + Defrag(m_subspawn); + + int count = 0; + + for ( int i = 0; i < m_subspawn.Count; ++i ) + if ( Insensitive.Equals( creatureName, m_subspawn[i].GetType().Name ) ) + ++count; + + return count; + } + + // Used only by PremiumSpawnerGump (lines 446-76) + // BROKEN + public void RemoveCreaturesFromGump( List m_subspawn, string creatureName ) + { + Defrag(m_subspawn); + + for ( int i = 0; i < m_subspawn.Count; ++i ) + { + IEntity e = m_subspawn[i]; + + if ( Insensitive.Equals( creatureName, e.GetType().Name ) ) + e.Delete(); + } + + InvalidateProperties(); + } + + // Used only here + public void RemoveCreatures( List m_Creatur ) + { + Defrag(m_Creatur); + + for ( int i = 0; i < m_Creatur.Count; ++i ) + m_Creatur[i].Delete(); + + InvalidateProperties(); + } + + //Used by PremiumSpawnerGump + public void BringToHome( List m_Beings ) + { + for ( int i = 0; i < m_Beings.Count; ++i ) + { + IEntity e = m_Beings[i]; + + if ( e is Mobile ) + { + Mobile m = (Mobile)e; + + m.MoveToWorld( Location, Map ); + } + else if ( e is Item ) + { + Item item = (Item)e; + + item.MoveToWorld( Location, Map ); + } + } + } + + //Used by PremiumSpawnerGump + public void BringToHome() + { + Defrag(m_Creatures); + Defrag(m_CreaturesA); + Defrag(m_CreaturesB); + Defrag(m_CreaturesC); + Defrag(m_CreaturesD); + Defrag(m_CreaturesE); + + BringToHome(m_Creatures); + BringToHome(m_CreaturesA); + BringToHome(m_CreaturesB); + BringToHome(m_CreaturesC); + BringToHome(m_CreaturesD); + BringToHome(m_CreaturesE); + } + + public override void OnDelete() + { + base.OnDelete(); + + RemoveCreatures(m_Creatures); + RemoveCreatures(m_CreaturesA); + RemoveCreatures(m_CreaturesB); + RemoveCreatures(m_CreaturesC); + RemoveCreatures(m_CreaturesD); + RemoveCreatures(m_CreaturesE); + if ( m_Timer != null ) + m_Timer.Stop(); + } + + public override void Serialize( GenericWriter writer ) + { + base.Serialize( writer ); + + writer.Write( (int) 4 ); // version + writer.Write( m_WalkingRange ); + + writer.Write( m_SpawnID ); + writer.Write( m_CountA ); + writer.Write( m_CountB ); + writer.Write( m_CountC ); + writer.Write( m_CountD ); + writer.Write( m_CountE ); + + writer.Write( m_WayPoint ); + + writer.Write( m_Group ); + + writer.Write( m_MinDelay ); + writer.Write( m_MaxDelay ); + writer.Write( m_Count ); + writer.Write( m_Team ); + writer.Write( m_HomeRange ); + writer.Write( m_Running ); + + if ( m_Running ) + writer.WriteDeltaTime( m_End ); + + writer.Write( m_CreaturesName.Count ); + + for ( int i = 0; i < m_CreaturesName.Count; ++i ) + writer.Write( m_CreaturesName[i] ); + + writer.Write( m_CreaturesNameA.Count ); + + for ( int i = 0; i < m_CreaturesNameA.Count; ++i ) + writer.Write( (string)m_CreaturesNameA[i] ); + + writer.Write( m_CreaturesNameB.Count ); + + for ( int i = 0; i < m_CreaturesNameB.Count; ++i ) + writer.Write( (string)m_CreaturesNameB[i] ); + + writer.Write( m_CreaturesNameC.Count ); + + for ( int i = 0; i < m_CreaturesNameC.Count; ++i ) + writer.Write( (string)m_CreaturesNameC[i] ); + + writer.Write( m_CreaturesNameD.Count ); + + for ( int i = 0; i < m_CreaturesNameD.Count; ++i ) + writer.Write( (string)m_CreaturesNameD[i] ); + + writer.Write( m_CreaturesNameE.Count ); + + for ( int i = 0; i < m_CreaturesNameE.Count; ++i ) + writer.Write( (string)m_CreaturesNameE[i] ); + + writer.Write( m_Creatures.Count ); + + for ( int i = 0; i < m_Creatures.Count; ++i ) + { + IEntity e = m_Creatures[i]; + + if ( e is Item ) + writer.Write( (Item)e ); + else if ( e is Mobile ) + writer.Write( (Mobile)e ); + else + writer.Write( Serial.MinusOne ); + } + + writer.Write( m_CreaturesA.Count ); + + for ( int i = 0; i < m_CreaturesA.Count; ++i ) + { + IEntity e = m_CreaturesA[i]; + + if ( e is Item ) + writer.Write( (Item)e ); + else if ( e is Mobile ) + writer.Write( (Mobile)e ); + else + writer.Write( Serial.MinusOne ); + } + + writer.Write( m_CreaturesB.Count ); + + for ( int i = 0; i < m_CreaturesB.Count; ++i ) + { + IEntity e = m_CreaturesB[i]; + + if ( e is Item ) + writer.Write( (Item)e ); + else if ( e is Mobile ) + writer.Write( (Mobile)e ); + else + writer.Write( Serial.MinusOne ); + } + + writer.Write( m_CreaturesC.Count ); + + for ( int i = 0; i < m_CreaturesC.Count; ++i ) + { + IEntity e = m_CreaturesC[i]; + + if ( e is Item ) + writer.Write( (Item)e ); + else if ( e is Mobile ) + writer.Write( (Mobile)e ); + else + writer.Write( Serial.MinusOne ); + } + + writer.Write( m_CreaturesD.Count ); + + for ( int i = 0; i < m_CreaturesD.Count; ++i ) + { + IEntity e = m_CreaturesD[i]; + + if ( e is Item ) + writer.Write( (Item)e ); + else if ( e is Mobile ) + writer.Write( (Mobile)e ); + else + writer.Write( Serial.MinusOne ); + } + + writer.Write( m_CreaturesE.Count ); + + for ( int i = 0; i < m_CreaturesE.Count; ++i ) + { + IEntity e = m_CreaturesE[i]; + + if ( e is Item ) + writer.Write( (Item)e ); + else if ( e is Mobile ) + writer.Write( (Mobile)e ); + else + writer.Write( Serial.MinusOne ); + } + + } + + private static WarnTimer m_WarnTimer; + + public override void Deserialize( GenericReader reader ) + { + base.Deserialize( reader ); + + int version = reader.ReadInt(); + + switch ( version ) + { + case 4: + { + m_WalkingRange = reader.ReadInt(); + m_SpawnID = reader.ReadInt(); + m_CountA = reader.ReadInt(); + m_CountB = reader.ReadInt(); + m_CountC = reader.ReadInt(); + m_CountD = reader.ReadInt(); + m_CountE = reader.ReadInt(); + + goto case 3; + } + case 3: + case 2: + { + m_WayPoint = reader.ReadItem() as WayPoint; + + goto case 1; + } + + case 1: + { + m_Group = reader.ReadBool(); + + goto case 0; + } + + case 0: + { + m_MinDelay = reader.ReadTimeSpan(); + m_MaxDelay = reader.ReadTimeSpan(); + m_Count = reader.ReadInt(); + m_Team = reader.ReadInt(); + m_HomeRange = reader.ReadInt(); + m_Running = reader.ReadBool(); + + TimeSpan ts = TimeSpan.Zero; + + if ( m_Running ) + ts = reader.ReadDeltaTime() - DateTime.Now; + + int size = reader.ReadInt(); + m_CreaturesName = new List( size ); + for ( int i = 0; i < size; ++i ) + { + string creatureString = reader.ReadString(); + + m_CreaturesName.Add( creatureString ); + string typeName = ParseType( creatureString ); + + if ( ScriptCompiler.FindTypeByName( typeName ) == null ) + { + if ( m_WarnTimer == null ) + m_WarnTimer = new WarnTimer(); + + m_WarnTimer.Add( Location, Map, typeName ); + } + } + + int sizeA = reader.ReadInt(); + m_CreaturesNameA = new List( sizeA ); + for ( int i = 0; i < sizeA; ++i ) + { + string creatureString = reader.ReadString(); + + m_CreaturesNameA.Add( creatureString ); + string typeName = ParseType( creatureString ); + + if ( ScriptCompiler.FindTypeByName( typeName ) == null ) + { + if ( m_WarnTimer == null ) + m_WarnTimer = new WarnTimer(); + + m_WarnTimer.Add( Location, Map, typeName ); + } + } + + int sizeB = reader.ReadInt(); + m_CreaturesNameB = new List( sizeB ); + for ( int i = 0; i < sizeB; ++i ) + { + string creatureString = reader.ReadString(); + + m_CreaturesNameB.Add( creatureString ); + string typeName = ParseType( creatureString ); + + if ( ScriptCompiler.FindTypeByName( typeName ) == null ) + { + if ( m_WarnTimer == null ) + m_WarnTimer = new WarnTimer(); + + m_WarnTimer.Add( Location, Map, typeName ); + } + } + + int sizeC = reader.ReadInt(); + m_CreaturesNameC = new List( sizeC ); + for ( int i = 0; i < sizeC; ++i ) + { + string creatureString = reader.ReadString(); + + m_CreaturesNameC.Add( creatureString ); + string typeName = ParseType( creatureString ); + + if ( ScriptCompiler.FindTypeByName( typeName ) == null ) + { + if ( m_WarnTimer == null ) + m_WarnTimer = new WarnTimer(); + + m_WarnTimer.Add( Location, Map, typeName ); + } + } + + int sizeD = reader.ReadInt(); + m_CreaturesNameD = new List( sizeD ); + for ( int i = 0; i < sizeD; ++i ) + { + string creatureString = reader.ReadString(); + + m_CreaturesNameD.Add( creatureString ); + string typeName = ParseType( creatureString ); + + if ( ScriptCompiler.FindTypeByName( typeName ) == null ) + { + if ( m_WarnTimer == null ) + m_WarnTimer = new WarnTimer(); + + m_WarnTimer.Add( Location, Map, typeName ); + } + } + + int sizeE = reader.ReadInt(); + m_CreaturesNameE = new List( sizeE ); + for ( int i = 0; i < sizeE; ++i ) + { + string creatureString = reader.ReadString(); + + m_CreaturesNameE.Add( creatureString ); + string typeName = ParseType( creatureString ); + + if ( ScriptCompiler.FindTypeByName( typeName ) == null ) + { + if ( m_WarnTimer == null ) + m_WarnTimer = new WarnTimer(); + + m_WarnTimer.Add( Location, Map, typeName ); + } + } + + int count = reader.ReadInt(); + m_Creatures = new List( count ); + for ( int i = 0; i < count; ++i ) + { + IEntity e = World.FindEntity( reader.ReadInt() ); + + if ( e != null ) + m_Creatures.Add( e ); + } + + int countA = reader.ReadInt(); + m_CreaturesA = new List( countA ); + for ( int i = 0; i < countA; ++i ) + { + IEntity e = World.FindEntity( reader.ReadInt() ); + + if ( e != null ) + m_CreaturesA.Add( e ); + } + + int countB = reader.ReadInt(); + m_CreaturesB = new List( countB ); + for ( int i = 0; i < countB; ++i ) + { + IEntity e = World.FindEntity( reader.ReadInt() ); + + if ( e != null ) + m_CreaturesB.Add( e ); + } + + int countC = reader.ReadInt(); + m_CreaturesC = new List( countC ); + for ( int i = 0; i < countC; ++i ) + { + IEntity e = World.FindEntity( reader.ReadInt() ); + + if ( e != null ) + m_CreaturesC.Add( e ); + } + + int countD = reader.ReadInt(); + m_CreaturesD = new List( countD ); + for ( int i = 0; i < countD; ++i ) + { + IEntity e = World.FindEntity( reader.ReadInt() ); + + if ( e != null ) + m_CreaturesD.Add( e ); + } + + int countE = reader.ReadInt(); + m_CreaturesE = new List( countE ); + for ( int i = 0; i < countE; ++i ) + { + IEntity e = World.FindEntity( reader.ReadInt() ); + + if ( e != null ) + m_CreaturesE.Add( e ); + } + + if ( m_Running ) + DoTimer( ts ); + + break; + } + } + + if ( version < 3 && Weight == 0 ) + Weight = -1; + } + + private class WarnTimer : Timer + { + private List m_List; + + private class WarnEntry + { + public Point3D m_Point; + public Map m_Map; + public string m_Name; + + public WarnEntry( Point3D p, Map map, string name ) + { + m_Point = p; + m_Map = map; + m_Name = name; + } + } + + public WarnTimer() : base( TimeSpan.FromSeconds( 1.0 ) ) + { + m_List = new List(); + Start(); + } + + public void Add( Point3D p, Map map, string name ) + { + m_List.Add( new WarnEntry( p, map, name ) ); + } + + protected override void OnTick() + { + try + { + Console.WriteLine( "Warning: {0} bad spawns detected, logged: 'PremiumBadspawn.log'", m_List.Count ); + + using ( StreamWriter op = new StreamWriter( "PremiumBadspawn.log", true ) ) + { + op.WriteLine( "# Bad spawns : {0}", DateTime.Now ); + op.WriteLine( "# Format: X Y Z F Name" ); + op.WriteLine(); + + foreach ( WarnEntry e in m_List ) + op.WriteLine( "{0}\t{1}\t{2}\t{3}\t{4}", e.m_Point.X, e.m_Point.Y, e.m_Point.Z, e.m_Map, e.m_Name ); + + op.WriteLine(); + op.WriteLine(); + } + } + catch + { + } + } + } + } +} diff --git a/Scripts/Engines/Spawner/PremiumSpawner/PremiumSpawnerGump.cs b/Scripts/Engines/Spawner/PremiumSpawner/PremiumSpawnerGump.cs new file mode 100644 index 0000000..29f9825 --- /dev/null +++ b/Scripts/Engines/Spawner/PremiumSpawner/PremiumSpawnerGump.cs @@ -0,0 +1,496 @@ +//Engine r120 +using System; +using System.Collections; +using Server.Network; +using Server.Gumps; +using System.Collections.Generic; + +namespace Server.Mobiles +{ + public class PremiumSpawnerGump : Gump + { + private PremiumSpawner m_Spawner; + + public void AddBlackAlpha( int x, int y, int width, int height ) + { + AddImageTiled( x, y, width, height, 2624 ); + AddAlphaRegion( x, y, width, height ); + } + + public PremiumSpawnerGump( PremiumSpawner spawner ) : base( 50, 50 ) + { + m_Spawner = spawner; + + AddPage( 1 ); + + AddBackground( 0, 0, 350, 360, 5054 ); + + AddLabel( 80, 1, 52, "Creatures List 1" ); + + AddLabel( 215, 3, 52, "PREMIUM SPAWNER" ); + AddBlackAlpha( 213, 23, 125, 270 ); + + AddButton( 260, 40, 0xFB7, 0xFB9, 1000, GumpButtonType.Reply, 0 ); + AddLabel( 260, 60, 52, "Okay" ); + + AddButton( 260, 90, 0xFB4, 0xFB6, 200, GumpButtonType.Reply, 0 ); + AddLabel( 232, 110, 52, "Bring to Home" ); + + AddButton( 260, 140, 0xFA8, 0xFAA, 300, GumpButtonType.Reply, 0 ); + AddLabel( 232, 160, 52, "Total Respawn" ); + + AddButton( 260, 190, 0xFAB, 0xFAD, 400, GumpButtonType.Reply, 0 ); + AddLabel( 245, 210, 52, "Properties" ); + + AddButton( 260, 240, 0xFB1, 0xFB3, 500, GumpButtonType.Reply, 0 ); + AddLabel( 256, 260, 52, "Cancel" ); + + AddButton( 230, 320, 5603, 5607, 0, GumpButtonType.Page, 6 ); + AddButton( 302, 320, 5601, 5605, 0, GumpButtonType.Page, 2 ); + AddLabel( 258, 320, 52, "- 1 -" ); + + for ( int i = 0; i < 15; i++ ) + { + // AddButton ( x, y, image, imageOnClick, ButtonID ) + AddButton( 5, ( 22 * i ) + 20, 0xFA5, 0xFA7, (1 + i), GumpButtonType.Reply, 0 ); // > (spawn this creature) + AddButton( 38, ( 22 * i ) + 20, 0xFA2, 0xFA4, (91 + i), GumpButtonType.Reply, 0 ); // X (remove this creature) + + AddImageTiled( 71, ( 22 * i ) + 20, 119, 23, 0xA40 ); + AddImageTiled( 72, ( 22 * i ) + 21, 117, 21, 0xBBC ); + + string str = ""; + + if ( i < spawner.CreaturesName.Count ) + { + str = (string)spawner.CreaturesName[i]; + int count = m_Spawner.CountCreatures( m_Spawner.Creatures, str ); + + AddLabel( 192, ( 22 * i ) + 20, 0, count.ToString() ); + } + + AddTextEntry( 75, ( 22 * i ) + 21, 114, 21, 0, 101 + i, str ); + } + + AddPage( 2 ); + + AddBackground( 0, 0, 350, 360, 5054 ); + + AddLabel( 80, 1, 52, "Creatures List 2" ); + + AddLabel( 215, 3, 52, "PREMIUM SPAWNER" ); + AddBlackAlpha( 213, 23, 125, 270 ); + + AddButton( 260, 40, 0xFB7, 0xFB9, 1000, GumpButtonType.Reply, 0 ); + AddLabel( 260, 60, 52, "Okay" ); + + AddButton( 260, 90, 0xFB4, 0xFB6, 200, GumpButtonType.Reply, 0 ); + AddLabel( 232, 110, 52, "Bring to Home" ); + + AddButton( 260, 140, 0xFA8, 0xFAA, 300, GumpButtonType.Reply, 0 ); + AddLabel( 232, 160, 52, "Total Respawn" ); + + AddButton( 260, 190, 0xFAB, 0xFAD, 400, GumpButtonType.Reply, 0 ); + AddLabel( 245, 210, 52, "Properties" ); + + AddButton( 260, 240, 0xFB1, 0xFB3, 500, GumpButtonType.Reply, 0 ); + AddLabel( 256, 260, 52, "Cancel" ); + + AddButton( 230, 320, 5603, 5607, 0, GumpButtonType.Page, 1 ); + AddButton( 302, 320, 5601, 5605, 0, GumpButtonType.Page, 3 ); + AddLabel( 258, 320, 52, "- 2 -" ); + + for ( int i = 0; i < 15; i++ ) + { + AddButton( 5, ( 22 * i ) + 20, 0xFA5, 0xFA7, (16 + i), GumpButtonType.Reply, 0 ); + AddButton( 38, ( 22 * i ) + 20, 0xFA2, 0xFA4, (106 + i), GumpButtonType.Reply, 0 ); + + AddImageTiled( 71, ( 22 * i ) + 20, 119, 23, 0xA40 ); + AddImageTiled( 72, ( 22 * i ) + 21, 117, 21, 0xBBC ); + + string str = ""; + + if ( i < spawner.SubSpawnerA.Count ) + { + str = (string)spawner.SubSpawnerA[i]; + int count = m_Spawner.CountCreatures( m_Spawner.CreaturesA, str ); + + AddLabel( 192, ( 22 * i ) + 20, 0, count.ToString() ); + } + + AddTextEntry( 75, ( 22 * i ) + 21, 114, 21, 0, 201 + i, str ); + } + + AddPage( 3 ); + + AddBackground( 0, 0, 350, 360, 5054 ); + + AddLabel( 80, 1, 52, "Creatures List 3" ); + + AddLabel( 215, 3, 52, "PREMIUM SPAWNER" ); + AddBlackAlpha( 213, 23, 125, 270 ); + + AddButton( 260, 40, 0xFB7, 0xFB9, 1000, GumpButtonType.Reply, 0 ); + AddLabel( 260, 60, 52, "Okay" ); + + AddButton( 260, 90, 0xFB4, 0xFB6, 200, GumpButtonType.Reply, 0 ); + AddLabel( 232, 110, 52, "Bring to Home" ); + + AddButton( 260, 140, 0xFA8, 0xFAA, 300, GumpButtonType.Reply, 0 ); + AddLabel( 232, 160, 52, "Total Respawn" ); + + AddButton( 260, 190, 0xFAB, 0xFAD, 400, GumpButtonType.Reply, 0 ); + AddLabel( 245, 210, 52, "Properties" ); + + AddButton( 260, 240, 0xFB1, 0xFB3, 500, GumpButtonType.Reply, 0 ); + AddLabel( 256, 260, 52, "Cancel" ); + + AddButton( 230, 320, 5603, 5607, 0, GumpButtonType.Page, 2 ); + AddButton( 302, 320, 5601, 5605, 0, GumpButtonType.Page, 4 ); + AddLabel( 258, 320, 52, "- 3 -" ); + + for ( int i = 0; i < 15; i++ ) + { + AddButton( 5, ( 22 * i ) + 20, 0xFA5, 0xFA7, (31 + i), GumpButtonType.Reply, 0 ); + AddButton( 38, ( 22 * i ) + 20, 0xFA2, 0xFA4, (121 + i), GumpButtonType.Reply, 0 ); + + AddImageTiled( 71, ( 22 * i ) + 20, 119, 23, 0xA40 ); + AddImageTiled( 72, ( 22 * i ) + 21, 117, 21, 0xBBC ); + + string str = ""; + + if ( i < spawner.SubSpawnerB.Count ) + { + str = (string)spawner.SubSpawnerB[i]; + int count = m_Spawner.CountCreatures( m_Spawner.CreaturesB, str ); + + AddLabel( 192, ( 22 * i ) + 20, 0, count.ToString() ); + } + + AddTextEntry( 75, ( 22 * i ) + 21, 114, 21, 0, 301 + i, str ); + } + + AddPage( 4 ); + + AddBackground( 0, 0, 350, 360, 5054 ); + + AddLabel( 80, 1, 52, "Creatures List 4" ); + + AddLabel( 215, 3, 52, "PREMIUM SPAWNER" ); + AddBlackAlpha( 213, 23, 125, 270 ); + + AddButton( 260, 40, 0xFB7, 0xFB9, 1000, GumpButtonType.Reply, 0 ); + AddLabel( 260, 60, 52, "Okay" ); + + AddButton( 260, 90, 0xFB4, 0xFB6, 200, GumpButtonType.Reply, 0 ); + AddLabel( 232, 110, 52, "Bring to Home" ); + + AddButton( 260, 140, 0xFA8, 0xFAA, 300, GumpButtonType.Reply, 0 ); + AddLabel( 232, 160, 52, "Total Respawn" ); + + AddButton( 260, 190, 0xFAB, 0xFAD, 400, GumpButtonType.Reply, 0 ); + AddLabel( 245, 210, 52, "Properties" ); + + AddButton( 260, 240, 0xFB1, 0xFB3, 500, GumpButtonType.Reply, 0 ); + AddLabel( 256, 260, 52, "Cancel" ); + + AddButton( 230, 320, 5603, 5607, 0, GumpButtonType.Page, 3 ); + AddButton( 302, 320, 5601, 5605, 0, GumpButtonType.Page, 5 ); + AddLabel( 258, 320, 52, "- 4 -" ); + + for ( int i = 0; i < 15; i++ ) + { + AddButton( 5, ( 22 * i ) + 20, 0xFA5, 0xFA7, (46 + i), GumpButtonType.Reply, 0 ); + AddButton( 38, ( 22 * i ) + 20, 0xFA2, 0xFA4, (136 + i), GumpButtonType.Reply, 0 ); + + AddImageTiled( 71, ( 22 * i ) + 20, 119, 23, 0xA40 ); + AddImageTiled( 72, ( 22 * i ) + 21, 117, 21, 0xBBC ); + + string str = ""; + + if ( i < spawner.SubSpawnerC.Count ) + { + str = (string)spawner.SubSpawnerC[i]; + int count = m_Spawner.CountCreatures( m_Spawner.CreaturesC, str ); + + AddLabel( 192, ( 22 * i ) + 20, 0, count.ToString() ); + } + + AddTextEntry( 75, ( 22 * i ) + 21, 114, 21, 0, 401 + i, str ); + } + + AddPage( 5 ); + + AddBackground( 0, 0, 350, 360, 5054 ); + + AddLabel( 80, 1, 52, "Creatures List 5" ); + + AddLabel( 215, 3, 52, "PREMIUM SPAWNER" ); + AddBlackAlpha( 213, 23, 125, 270 ); + + AddButton( 260, 40, 0xFB7, 0xFB9, 1000, GumpButtonType.Reply, 0 ); + AddLabel( 260, 60, 52, "Okay" ); + + AddButton( 260, 90, 0xFB4, 0xFB6, 200, GumpButtonType.Reply, 0 ); + AddLabel( 232, 110, 52, "Bring to Home" ); + + AddButton( 260, 140, 0xFA8, 0xFAA, 300, GumpButtonType.Reply, 0 ); + AddLabel( 232, 160, 52, "Total Respawn" ); + + AddButton( 260, 190, 0xFAB, 0xFAD, 400, GumpButtonType.Reply, 0 ); + AddLabel( 245, 210, 52, "Properties" ); + + AddButton( 260, 240, 0xFB1, 0xFB3, 500, GumpButtonType.Reply, 0 ); + AddLabel( 256, 260, 52, "Cancel" ); + + AddButton( 230, 320, 5603, 5607, 0, GumpButtonType.Page, 4 ); + AddButton( 302, 320, 5601, 5605, 0, GumpButtonType.Page, 6 ); + AddLabel( 258, 320, 52, "- 5 -" ); + + for ( int i = 0; i < 15; i++ ) + { + AddButton( 5, ( 22 * i ) + 20, 0xFA5, 0xFA7, (61 + i), GumpButtonType.Reply, 0 ); + AddButton( 38, ( 22 * i ) + 20, 0xFA2, 0xFA4, (151 + i), GumpButtonType.Reply, 0 ); + + AddImageTiled( 71, ( 22 * i ) + 20, 119, 23, 0xA40 ); + AddImageTiled( 72, ( 22 * i ) + 21, 117, 21, 0xBBC ); + + string str = ""; + + if ( i < spawner.SubSpawnerD.Count ) + { + str = (string)spawner.SubSpawnerD[i]; + int count = m_Spawner.CountCreatures( m_Spawner.CreaturesD, str ); + + AddLabel( 192, ( 22 * i ) + 20, 0, count.ToString() ); + } + + AddTextEntry( 75, ( 22 * i ) + 21, 114, 21, 0, 501 + i, str ); + } + + AddPage( 6 ); + + AddBackground( 0, 0, 350, 360, 5054 ); + + AddLabel( 80, 1, 52, "Creatures List 6" ); + + AddLabel( 215, 3, 52, "PREMIUM SPAWNER" ); + AddBlackAlpha( 213, 23, 125, 270 ); + + AddButton( 260, 40, 0xFB7, 0xFB9, 1000, GumpButtonType.Reply, 0 ); + AddLabel( 260, 60, 52, "Okay" ); + + AddButton( 260, 90, 0xFB4, 0xFB6, 200, GumpButtonType.Reply, 0 ); + AddLabel( 232, 110, 52, "Bring to Home" ); + + AddButton( 260, 140, 0xFA8, 0xFAA, 300, GumpButtonType.Reply, 0 ); + AddLabel( 232, 160, 52, "Total Respawn" ); + + AddButton( 260, 190, 0xFAB, 0xFAD, 400, GumpButtonType.Reply, 0 ); + AddLabel( 245, 210, 52, "Properties" ); + + AddButton( 260, 240, 0xFB1, 0xFB3, 500, GumpButtonType.Reply, 0 ); + AddLabel( 256, 260, 52, "Cancel" ); + + AddButton( 230, 320, 5603, 5607, 0, GumpButtonType.Page, 5 ); + AddButton( 302, 320, 5601, 5605, 0, GumpButtonType.Page, 1 ); + AddLabel( 258, 320, 52, "- 6 -" ); + + for ( int i = 0; i < 15; i++ ) + { + AddButton( 5, ( 22 * i ) + 20, 0xFA5, 0xFA7, (76 + i), GumpButtonType.Reply, 0 ); + AddButton( 38, ( 22 * i ) + 20, 0xFA2, 0xFA4, (166 + i), GumpButtonType.Reply, 0 ); + + AddImageTiled( 71, ( 22 * i ) + 20, 119, 23, 0xA40 ); + AddImageTiled( 72, ( 22 * i ) + 21, 117, 21, 0xBBC ); + + string str = ""; + + if ( i < spawner.SubSpawnerE.Count ) + { + str = (string)spawner.SubSpawnerE[i]; + int count = m_Spawner.CountCreatures( m_Spawner.CreaturesE, str ); + + AddLabel( 192, ( 22 * i ) + 20, 0, count.ToString() ); + } + + AddTextEntry( 75, ( 22 * i ) + 21, 114, 21, 0, 601 + i, str ); + } + + } + + public List CreateArray( RelayInfo info, Mobile from, int TextIndex ) + { + List creaturesName = new List(); + + for ( int i = 0; i < 15; i++ ) + { + TextRelay te = info.GetTextEntry( TextIndex + i ); + + if ( te != null ) + { + string str = te.Text; + + if ( str.Length > 0 ) + { + str = str.Trim(); + + string t = Spawner.ParseType( str ); + + Type type = ScriptCompiler.FindTypeByName( t ); + + if ( type != null ) + creaturesName.Add( str ); + else + from.SendMessage( "{0} is not a valid type name.", t ); + } + } + } + + return creaturesName; + } + + public string GetEntry( int Type, RelayInfo info ) + { + TextRelay entry = info.GetTextEntry( Type ); + return entry.Text; + } + + public override void OnResponse( NetState state, RelayInfo info ) + { + if ( m_Spawner.Deleted ) + return; + + switch ( info.ButtonID ) + { + case 0: // Cancel (mouse's right button click anywhere on the gump) + { + break; + } + case 200: // Bring everything home + { + m_Spawner.BringToHome(); + break; + } + case 300: // Total respawn + { + // 1st save changes + m_Spawner.CreaturesName = CreateArray( info, state.Mobile, 100 ); + m_Spawner.SubSpawnerA = CreateArray( info, state.Mobile, 200 ); + m_Spawner.SubSpawnerB = CreateArray( info, state.Mobile, 300 ); + m_Spawner.SubSpawnerC = CreateArray( info, state.Mobile, 400 ); + m_Spawner.SubSpawnerD = CreateArray( info, state.Mobile, 500 ); + m_Spawner.SubSpawnerE = CreateArray( info, state.Mobile, 600 ); + // then respwan + m_Spawner.Respawn(); + m_Spawner.Running = true; + break; + } + case 400: // Props + { + state.Mobile.SendGump( new PropertiesGump( state.Mobile, m_Spawner ) ); + state.Mobile.SendGump( new PremiumSpawnerGump( m_Spawner ) ); + break; + } + case 500: // Cancel button + { + break; + } + case 1000: // Okay + { + m_Spawner.CreaturesName = CreateArray( info, state.Mobile, 100 ); + m_Spawner.SubSpawnerA = CreateArray( info, state.Mobile, 200 ); + m_Spawner.SubSpawnerB = CreateArray( info, state.Mobile, 300 ); + m_Spawner.SubSpawnerC = CreateArray( info, state.Mobile, 400 ); + m_Spawner.SubSpawnerD = CreateArray( info, state.Mobile, 500 ); + m_Spawner.SubSpawnerE = CreateArray( info, state.Mobile, 600 ); + m_Spawner.Running = true; + break; + } + default: + { //ButtonID: 1-90 spawn; 91-180 remove + int ID = info.ButtonID; + + int Type = 0; + + // Spawn creature + if ( (ID >= 1) && (ID <= 15) ) + { + Type += 100 + ID; + m_Spawner.SpawnFromGump( m_Spawner.CreaturesName, m_Spawner.Creatures, m_Spawner.Count, m_Spawner.CreaturesNameCount, GetEntry(Type, info) ); + } + else if ( (ID >= 16) && (ID <= 30) ) + { + Type += 200 + ID - 15; + m_Spawner.SpawnFromGump( m_Spawner.SubSpawnerA, m_Spawner.CreaturesA, m_Spawner.CountA, m_Spawner.CreaturesNameCountA, GetEntry(Type, info) ); + } + else if ( (ID >= 31) && (ID <= 45) ) + { + Type += 300 + ID - 30; + m_Spawner.SpawnFromGump( m_Spawner.SubSpawnerB, m_Spawner.CreaturesB, m_Spawner.CountB, m_Spawner.CreaturesNameCountB, GetEntry(Type, info) ); + } + else if ( (ID >= 46) && (ID <= 60) ) + { + Type += 400 + ID - 45; + m_Spawner.SpawnFromGump( m_Spawner.SubSpawnerC, m_Spawner.CreaturesC, m_Spawner.CountC, m_Spawner.CreaturesNameCountC, GetEntry(Type, info) ); + } + else if ( (ID >= 61) && (ID <= 75) ) + { + Type += 500 + ID - 60; + m_Spawner.SpawnFromGump( m_Spawner.SubSpawnerD, m_Spawner.CreaturesD, m_Spawner.CountD, m_Spawner.CreaturesNameCountD, GetEntry(Type, info) ); + } + else if ( (ID >= 76) && (ID <= 90) ) + { + Type += 600 + ID - 75; + m_Spawner.SpawnFromGump( m_Spawner.SubSpawnerE, m_Spawner.CreaturesE, m_Spawner.CountE, m_Spawner.CreaturesNameCountE, GetEntry(Type, info) ); + } + // Remove creature + else if ( (ID >= 91) && (ID <= 105) ) + { + Type += 100 + ID - 90; + m_Spawner.RemoveCreaturesFromGump( m_Spawner.Creatures, GetEntry(Type, info) ); + } + else if ( (ID >= 106) && (ID <= 120) ) + { + Type += 200 + ID - 105; + m_Spawner.RemoveCreaturesFromGump( m_Spawner.CreaturesA, GetEntry(Type, info) ); + } + else if ( (ID >= 121) && (ID <= 135) ) + { + Type += 300 + ID - 120; + m_Spawner.RemoveCreaturesFromGump( m_Spawner.CreaturesB, GetEntry(Type, info) ); + } + else if ( (ID >= 136) && (ID <= 150) ) + { + Type += 400 + ID - 135; + m_Spawner.RemoveCreaturesFromGump( m_Spawner.CreaturesC, GetEntry(Type, info) ); + } + else if ( (ID >= 151) && (ID <= 165) ) + { + Type += 500 + ID - 150; + m_Spawner.RemoveCreaturesFromGump( m_Spawner.CreaturesD, GetEntry(Type, info) ); + } + else if ( (ID >= 166) && (ID <= 180) ) + { + Type += 600 + ID - 165; + m_Spawner.RemoveCreaturesFromGump( m_Spawner.CreaturesE, GetEntry(Type, info) ); + } + + string entry = GetEntry(Type, info); + + if ( entry != null && entry.Length > 0 ) + { + m_Spawner.CreaturesName = CreateArray( info, state.Mobile, 100 ); + m_Spawner.SubSpawnerA = CreateArray( info, state.Mobile, 200 ); + m_Spawner.SubSpawnerB = CreateArray( info, state.Mobile, 300 ); + m_Spawner.SubSpawnerC = CreateArray( info, state.Mobile, 400 ); + m_Spawner.SubSpawnerD = CreateArray( info, state.Mobile, 500 ); + m_Spawner.SubSpawnerE = CreateArray( info, state.Mobile, 600 ); + m_Spawner.Running = true; + } + + break; + } + } + } + } +} diff --git a/Scripts/Engines/Spawner/PremiumSpawner/PremiumSpawnerGumps.cs b/Scripts/Engines/Spawner/PremiumSpawner/PremiumSpawnerGumps.cs new file mode 100644 index 0000000..bd19b80 --- /dev/null +++ b/Scripts/Engines/Spawner/PremiumSpawner/PremiumSpawnerGumps.cs @@ -0,0 +1,419 @@ +// Engine r117 +using System; +using System.Collections; +using System.IO; +using Server; +using Server.Mobiles; +using Server.Items; +using Server.Commands; +using Server.Network; +using Server.Gumps; +using Server.Regions; + +namespace Server.Commands +{ + public class OptionsGumps + { + public OptionsGumps() + { + } + + public static void Initialize() + { + CommandSystem.Register( "GumpSaveRegion", AccessLevel.Administrator, new CommandEventHandler( OptionsGumps1_OnCommand ) ); + CommandSystem.Register( "GumpSaveCoordinate", AccessLevel.Administrator, new CommandEventHandler( OptionsGumps2_OnCommand ) ); + CommandSystem.Register( "GumpRemoveID", AccessLevel.Administrator, new CommandEventHandler( OptionsGumps3_OnCommand ) ); + CommandSystem.Register( "GumpRemoveCoordinate", AccessLevel.Administrator, new CommandEventHandler( OptionsGumps4_OnCommand ) ); + CommandSystem.Register( "GumpRemoveRegion", AccessLevel.Administrator, new CommandEventHandler( OptionsGumps5_OnCommand ) ); + } + + [Usage( "[GumpSaveRegion" )] + [Description( "Gump to Save inside Region" )] + private static void OptionsGumps1_OnCommand( CommandEventArgs e ) + { + e.Mobile.SendGump( new GumpSaveRegion( e ) ); + } + + [Usage( "[GumpSaveCoordinate" )] + [Description( "Gump to save by coordinates" )] + private static void OptionsGumps2_OnCommand( CommandEventArgs e ) + { + e.Mobile.SendGump( new GumpSaveCoordinate( e ) ); + } + + [Usage( "[GumpRemoveID" )] + [Description( "Gump to remove by ID" )] + private static void OptionsGumps3_OnCommand( CommandEventArgs e ) + { + e.Mobile.SendGump( new GumpRemoveID( e ) ); + } + + [Usage( "[GumpRemoveCoordinate" )] + [Description( "Gump to remove by coordinates" )] + private static void OptionsGumps4_OnCommand( CommandEventArgs e ) + { + e.Mobile.SendGump( new GumpRemoveCoordinate( e ) ); + } + + [Usage( "[GumpRemoveRegion" )] + [Description( "Gump to remove inside region" )] + private static void OptionsGumps5_OnCommand( CommandEventArgs e ) + { + e.Mobile.SendGump( new GumpRemoveRegion( e ) ); + } + } +} + +namespace Server.Gumps +{ + public class GumpSaveRegion : Gump + { + private CommandEventArgs m_CommandEventArgs; + + public GumpSaveRegion( CommandEventArgs e ) : base( 50,50 ) + { + m_CommandEventArgs = e; + Closable = true; + Dragable = true; + Mobile from = e.Mobile; + + AddPage(1); + //x, y, width, hight + AddBackground( 0, 0, 232, 210, 5054 ); + + AddImageTiled( 15, 30, 120, 20, 3004 ); + AddTextEntry( 15, 30, 120, 20, 0, 0, @"region to save"); + AddLabel( 15, 10, 52, "Enter a Region:" ); + AddButton( 140, 32, 0x15E1, 0x15E5, 101, GumpButtonType.Reply, 0 ); + + AddLabel( 15, 60, 52, "Tip:" ); + AddHtml( 15, 80, 200, 110, "This will SAVE the spawners, in a specified region, to Data/Nerun's Distro/Spawns/'region name'.map. Type [where if you don't know the region you are. Copy to the text box the name of the region. You also can open Data/Regions.xml to a full list of regions.
Example: you type [where and appear 'your region is town of Britain'. Type 'Britain' in text box.", true, true ); + } + + public override void OnResponse(NetState state, RelayInfo info) + { + Mobile from = state.Mobile; + + switch ( info.ButtonID ) + { + case 0: // close the gump + { + break; + } + + case 101: + { + TextRelay oRegion = info.GetTextEntry( 0 ); + string sRegion = oRegion.Text; + if( sRegion != "" ) + { + string prefix = Server.Commands.CommandSystem.Prefix; + CommandSystem.Handle( from, String.Format( "{0}Spawngen save {1}", prefix, sRegion ) ); + } + else + { + from.SendMessage( "You must specify a region!" ); + string prefix = Server.Commands.CommandSystem.Prefix; + CommandSystem.Handle( from, String.Format( "{0}GumpSaveRegion", prefix ) ); + } + break; + } + } + } + } + + public class GumpRemoveRegion : Gump + { + private CommandEventArgs m_CommandEventArgs; + + public GumpRemoveRegion( CommandEventArgs e ) : base( 50,50 ) + { + m_CommandEventArgs = e; + Closable = true; + Dragable = true; + Mobile from = e.Mobile; + + AddPage(1); + + AddBackground( 0, 0, 232, 210, 5054 ); + + AddImageTiled( 15, 30, 120, 20, 3004 ); + AddTextEntry( 15, 30, 120, 20, 0, 0, @"region to remove"); + AddLabel( 15, 10, 52, "Enter a Region:" ); + AddButton( 140, 32, 0x15E1, 0x15E5, 101, GumpButtonType.Reply, 0 ); + + AddLabel( 15, 60, 52, "Tip:" ); + AddHtml( 15, 80, 200, 110, "This will REMOVE the spawners, in a specified region. Type [where if you don't know the region you are. Copy to the text box the name of the region. You also can open Data/Regions.xml to a full list of regions.
Example: you type [where and appear 'your region is town of Britain'. Type 'Britain' in text box.", true, true ); + } + + public override void OnResponse(NetState state, RelayInfo info) + { + Mobile from = state.Mobile; + + switch ( info.ButtonID ) + { + case 0: // close the gump + { + break; + } + + case 101: + { + TextRelay oRegion = info.GetTextEntry( 0 ); + string sRegion = oRegion.Text; + if( sRegion != "" ) + { + string prefix = Server.Commands.CommandSystem.Prefix; + CommandSystem.Handle( from, String.Format( "{0}Spawngen remove {1}", prefix, sRegion ) ); + } + else + { + from.SendMessage( "You must specify a region!" ); + string prefix = Server.Commands.CommandSystem.Prefix; + CommandSystem.Handle( from, String.Format( "{0}GumpRemoveRegion", prefix ) ); + } + break; + } + } + } + } + + public class GumpRemoveID : Gump + { + private CommandEventArgs m_CommandEventArgs; + + public GumpRemoveID( CommandEventArgs e ) : base( 50,50 ) + { + m_CommandEventArgs = e; + Closable = true; + Dragable = true; + Mobile from = e.Mobile; + + AddPage(1); + + AddBackground( 0, 0, 232, 210, 5054 ); + + AddImageTiled( 15, 30, 120, 20, 3004 ); + AddTextEntry( 15, 30, 120, 20, 0, 0, @"SpawnID to remove"); + AddLabel( 15, 10, 52, "Enter a SpawnID:" ); + AddButton( 140, 32, 0x15E1, 0x15E5, 101, GumpButtonType.Reply, 0 ); + + AddLabel( 15, 60, 52, "Tip:" ); + AddHtml( 15, 80, 200, 110, "This command was made to UNLOAD your own custom maps. This will REMOVE the spawners with the specified ID. Type '[get spawnid' in a spawner to know your ID. Remember: 'By Hand' spawns, i.e., those done with '[add premiumspawner' have ID = 1.", true, true ); + } + + public override void OnResponse(NetState state, RelayInfo info) + { + Mobile from = state.Mobile; + + switch ( info.ButtonID ) + { + case 0: // close the gump + { + break; + } + + case 101: + { + TextRelay oID = info.GetTextEntry( 0 ); + string sID = oID.Text; + if( sID != "" ) + { + try + { + int UnloadID = Convert.ToInt32( sID ); + string prefix = Server.Commands.CommandSystem.Prefix; + CommandSystem.Handle( from, String.Format( "{0}Spawngen unload {1}", prefix, UnloadID ) ); + } + catch + { + from.SendMessage( "SpawnID must be a number!" ); + string prefix = Server.Commands.CommandSystem.Prefix; + CommandSystem.Handle( from, String.Format( "{0}GumpRemoveID", prefix ) ); + } + } + + else + { + from.SendMessage( "You must specify an SpawnID!" ); + string prefix = Server.Commands.CommandSystem.Prefix; + CommandSystem.Handle( from, String.Format( "{0}GumpRemoveID", prefix ) ); + } + break; + } + } + } + } + + public class GumpSaveCoordinate : Gump + { + private CommandEventArgs m_CommandEventArgs; + + public GumpSaveCoordinate( CommandEventArgs e ) : base( 50,50 ) + { + m_CommandEventArgs = e; + Closable = true; + Dragable = true; + Mobile from = e.Mobile; + + AddPage(1); + + AddBackground( 0, 0, 232, 235, 5054 ); + + AddImageTiled( 15, 30, 37, 20, 3004 ); + AddTextEntry( 15, 30, 37, 20, 0, 0, @"X1"); + + AddImageTiled( 57, 30, 37, 20, 3004 ); + AddTextEntry( 57, 30, 37, 20, 0, 1, @"Y1"); + + AddImageTiled( 15, 55, 37, 20, 3004 ); + AddTextEntry( 15, 55, 37, 20, 0, 2, @"X2"); + + AddImageTiled( 57, 55, 37, 20, 3004 ); + AddTextEntry( 57, 55, 37, 20, 0, 3, @"Y2"); + + AddLabel( 15, 10, 52, "Enter Coordinates:" ); + AddButton( 140, 32, 0x15E1, 0x15E5, 101, GumpButtonType.Reply, 0 ); + + AddLabel( 15, 85, 52, "Tip:" ); + AddHtml( 15, 105, 200, 110, "This will SAVE spawners inside specified coordinates. You can use [where in the first point and again [where in the second point to get the X and Y coordinates. You need 2: X1, Y1 for first point and X2, Y2 for the second point. The objective is determine a 'box'. This command will save all spawners inside this box.", true, true ); + } + + public override void OnResponse(NetState state, RelayInfo info) + { + Mobile from = state.Mobile; + + switch ( info.ButtonID ) + { + case 0: // close the gump + { + break; + } + + case 101: + { + TextRelay oX1 = info.GetTextEntry( 0 ); + TextRelay oY1 = info.GetTextEntry( 1 ); + TextRelay oX2 = info.GetTextEntry( 2 ); + TextRelay oY2 = info.GetTextEntry( 3 ); + string sX1 = oX1.Text; + string sY1 = oY1.Text; + string sX2 = oX2.Text; + string sY2 = oY2.Text; + if( sX1 != "" && sY1 != "" && sX2 != "" && sY2 != "" ) + { + try + { + int iX1 = Convert.ToInt32( sX1 ); + int iY1 = Convert.ToInt32( sY1 ); + int iX2 = Convert.ToInt32( sX2 ); + int iY2 = Convert.ToInt32( sY2 ); + string prefix = Server.Commands.CommandSystem.Prefix; + CommandSystem.Handle( from, String.Format( "{0}Spawngen save {1} {2} {3} {4}", prefix, iX1, iY1, iX2, iY2 ) ); + } + catch + { + from.SendMessage( "Coordinates must be numbers!" ); + string prefix = Server.Commands.CommandSystem.Prefix; + CommandSystem.Handle( from, String.Format( "{0}GumpSaveCoordinate", prefix ) ); + } + } + + else + { + from.SendMessage( "You must specify all coordinates!" ); + string prefix = Server.Commands.CommandSystem.Prefix; + CommandSystem.Handle( from, String.Format( "{0}GumpSaveCoordinate", prefix ) ); + } + break; + } + } + } + } + + public class GumpRemoveCoordinate : Gump + { + private CommandEventArgs m_CommandEventArgs; + + public GumpRemoveCoordinate( CommandEventArgs e ) : base( 50,50 ) + { + m_CommandEventArgs = e; + Closable = true; + Dragable = true; + Mobile from = e.Mobile; + + AddPage(1); + + AddBackground( 0, 0, 232, 235, 5054 ); + + AddImageTiled( 15, 30, 37, 20, 3004 ); + AddTextEntry( 15, 30, 37, 20, 0, 0, @"X1"); + + AddImageTiled( 57, 30, 37, 20, 3004 ); + AddTextEntry( 57, 30, 37, 20, 0, 1, @"Y1"); + + AddImageTiled( 15, 55, 37, 20, 3004 ); + AddTextEntry( 15, 55, 37, 20, 0, 2, @"X2"); + + AddImageTiled( 57, 55, 37, 20, 3004 ); + AddTextEntry( 57, 55, 37, 20, 0, 3, @"Y2"); + + AddLabel( 15, 10, 52, "Enter Coordinates:" ); + AddButton( 140, 32, 0x15E1, 0x15E5, 101, GumpButtonType.Reply, 0 ); + + AddLabel( 15, 85, 52, "Tip:" ); + AddHtml( 15, 105, 200, 110, "This will REMOVE spawners inside specified coordinates. You can use [where in the first point and again [where in the second point to get the X and Y coordinates. You need 2: X1, Y1 for first point and X2, Y2 for the second point. The objective is determine a 'box'. This command will remove all spawners inside this box.", true, true ); + } + + public override void OnResponse(NetState state, RelayInfo info) + { + Mobile from = state.Mobile; + + switch ( info.ButtonID ) + { + case 0: // close the gump + { + break; + } + + case 101: + { + TextRelay oX1 = info.GetTextEntry( 0 ); + TextRelay oY1 = info.GetTextEntry( 1 ); + TextRelay oX2 = info.GetTextEntry( 2 ); + TextRelay oY2 = info.GetTextEntry( 3 ); + string sX1 = oX1.Text; + string sY1 = oY1.Text; + string sX2 = oX2.Text; + string sY2 = oY2.Text; + if( sX1 != "" && sY1 != "" && sX2 != "" && sY2 != "" ) + { + try + { + int iX1 = Convert.ToInt32( sX1 ); + int iY1 = Convert.ToInt32( sY1 ); + int iX2 = Convert.ToInt32( sX2 ); + int iY2 = Convert.ToInt32( sY2 ); + string prefix = Server.Commands.CommandSystem.Prefix; + CommandSystem.Handle( from, String.Format( "{0}Spawngen remove {1} {2} {3} {4}", prefix, iX1, iY1, iX2, iY2 ) ); + } + catch + { + from.SendMessage( "Coordinates must be numbers!" ); + string prefix = Server.Commands.CommandSystem.Prefix; + CommandSystem.Handle( from, String.Format( "{0}GumpRemoveCoordinate", prefix ) ); + } + } + + else + { + from.SendMessage( "You must specify all coordinates!" ); + string prefix = Server.Commands.CommandSystem.Prefix; + CommandSystem.Handle( from, String.Format( "{0}GumpRemoveCoordinate", prefix ) ); + } + break; + } + } + } + } +} \ No newline at end of file diff --git a/Scripts/Engines/Spawner/PremiumSpawner/PremiumSpawnerMainGump.cs b/Scripts/Engines/Spawner/PremiumSpawner/PremiumSpawnerMainGump.cs new file mode 100644 index 0000000..07221ef --- /dev/null +++ b/Scripts/Engines/Spawner/PremiumSpawner/PremiumSpawnerMainGump.cs @@ -0,0 +1,288 @@ +// Engine r153 +using System; +using Server; +using Server.Gumps; +using Server.Network; +using Server.Commands; + +namespace Server.Gumps +{ + public class PremiumSpawnerMainGump : Gump + { + public static void Initialize() + { + CommandSystem.Register("PremiumSpawner", AccessLevel.Administrator, new CommandEventHandler(PremiumSpawner_OnCommand)); + CommandSystem.Register("Spawner", AccessLevel.Administrator, new CommandEventHandler(PremiumSpawner_OnCommand)); + } + + [Usage("PremiumSpawner")] + [Aliases( "Spawner" )] + [Description("PremiumSpawner main gump.")] + public static void PremiumSpawner_OnCommand(CommandEventArgs e) + { + Mobile from = e.Mobile; + + if (from.HasGump(typeof(PremiumSpawnerMainGump))) + from.CloseGump(typeof(PremiumSpawnerMainGump)); + from.SendGump(new PremiumSpawnerMainGump(from)); + } + + public PremiumSpawnerMainGump(Mobile from) : this() + { + } + + public void AddBlackAlpha( int x, int y, int width, int height ) + { + AddImageTiled( x, y, width, height, 2624 ); + AddAlphaRegion( x, y, width, height ); + } + + public PremiumSpawnerMainGump() : base( 0, 0 ) + { + this.Closable=true; + this.Disposable=true; + this.Dragable=true; + //PAGE 1 + AddPage(1); + AddBackground(93, 68, 256, 423, 9200); + AddHtml( 98, 75, 244, 44, " PREMIUM SPAWNER
" + "by Nerun Rev.154", (bool)true, (bool)false); + AddBlackAlpha(100, 124, 241, 71); + AddLabel(109, 126, 52, @"WORLD CREATION"); + AddLabel(126, 148, 52, @"Let there be light (Create World)"); + AddLabel(126, 170, 52, @"Apocalypse now (Clear All Facets)"); + AddButton(109, 151, 1210, 1209, 101, GumpButtonType.Reply, 0); + AddButton(109, 173, 1210, 1209, 102, GumpButtonType.Reply, 0); + AddBlackAlpha(100, 200, 241, 89); + AddLabel(109, 202, 52, @"SELECT SPAWNS BY EXPANSION"); + AddLabel(126, 224, 52, @"UO Classic spawns (pre-T2A)"); + AddLabel(126, 244, 52, @"UO Mondain's Legacy spawns"); + AddLabel(126, 264, 52, @"UO KR, SA and HS spawns"); + //AddLabel(238, 224, 52, @"UO:ML spawns"); + //AddLabel(238, 244, 52, @"UO:KR, SA and HS spawns"); + //AddLabel(238, 264, 52, @"teste"); + AddButton(109, 227, 1210, 1209, 103, GumpButtonType.Reply, 0); + AddButton(109, 247, 1210, 1209, 104, GumpButtonType.Reply, 0); + AddButton(109, 267, 1210, 1209, 105, GumpButtonType.Reply, 0); + //AddButton(221, 227, 1210, 1209, 106, GumpButtonType.Reply, 0); + //AddButton(221, 247, 1210, 1209, 107, GumpButtonType.Reply, 0); + //AddButton(221, 267, 1210, 1209, 108, GumpButtonType.Reply, 0); + AddBlackAlpha(100, 294, 241, 89); + AddLabel(109, 296, 52, @"REMOVE SPAWNS BY EXPANSION"); + AddLabel(126, 318, 52, @"UO Classic spawns (pre-T2A)"); + AddLabel(126, 338, 52, @"UO Mondain's Legacy spawns"); + AddLabel(126, 358, 52, @"UO KR, SA and HS spawns"); + //AddLabel(238, 318, 52, @"Ter Mur"); + //AddLabel(238, 338, 52, @"Tokuno"); + //AddLabel(238, 358, 52, @"Trammel"); + AddButton(109, 321, 1210, 1209, 109, GumpButtonType.Reply, 0); + AddButton(109, 341, 1210, 1209, 110, GumpButtonType.Reply, 0); + AddButton(109, 361, 1210, 1209, 111, GumpButtonType.Reply, 0); + //AddButton(221, 321, 1210, 1209, 112, GumpButtonType.Reply, 0); + //AddButton(221, 341, 1210, 1209, 113, GumpButtonType.Reply, 0); + //AddButton(221, 361, 1210, 1209, 114, GumpButtonType.Reply, 0); + AddBlackAlpha(100, 388, 241, 68); + AddLabel(109, 391, 52, @"SMART PLAYER RANGE SENSITIVE"); + AddLabel(126, 413, 52, @"Generate Spawns' Overseer"); + AddLabel(126, 432, 52, @"Remove Spawns' Overseer"); + AddButton(109, 416, 1210, 1209, 115, GumpButtonType.Reply, 0); + AddButton(109, 435, 1210, 1209, 116, GumpButtonType.Reply, 0); + //Page change + AddLabel(207, 463, 200, @"1/3"); + AddButton(235, 465, 5601, 5605, 0, GumpButtonType.Page, 2); //advance + + // PAGE 2 + AddPage(2); + AddBackground(93, 68, 256, 423, 9200); + AddHtml( 98, 75, 244, 44, " PREMIUM SPAWNER
" + "by Nerun Rev.154", (bool)true, (bool)false); + AddBlackAlpha(100, 124, 241, 114); + AddLabel(109, 126, 52, @"SAVE SPAWNERS"); + AddLabel(126, 148, 52, @"All spawns (spawns.map)"); + AddLabel(126, 170, 52, @"'By hand' spawns (byhand.map)"); + AddLabel(126, 192, 52, @"Spawns inside region (region.map)"); + AddLabel(126, 214, 52, @"Spawns inside coordinates"); + AddButton(109, 151, 1210, 1209, 117, GumpButtonType.Reply, 0); + AddButton(109, 173, 1210, 1209, 118, GumpButtonType.Reply, 0); + AddButton(109, 195, 1210, 1209, 119, GumpButtonType.Reply, 0); + AddButton(109, 217, 1210, 1209, 120, GumpButtonType.Reply, 0); + AddBlackAlpha(100, 244, 241, 134); + AddLabel(109, 246, 52, @"REMOVE SPAWNERS"); + AddLabel(126, 268, 52, @"All spawners in ALL facets"); + AddLabel(126, 290, 52, @"All spawners in THIS facet"); + AddLabel(126, 312, 52, @"Remove spawners by SpawnID"); + AddLabel(126, 334, 52, @"Remove inside coordinates"); + AddLabel(126, 355, 52, @"Remove spawners inside region"); + AddButton(109, 271, 1210, 1209, 121, GumpButtonType.Reply, 0); + AddButton(109, 293, 1210, 1209, 122, GumpButtonType.Reply, 0); + AddButton(109, 315, 1210, 1209, 123, GumpButtonType.Reply, 0); + AddButton(109, 337, 1210, 1209, 124, GumpButtonType.Reply, 0); + AddButton(109, 358, 1210, 1209, 125, GumpButtonType.Reply, 0); + AddBlackAlpha(100, 385, 241, 71); + AddLabel(109, 387, 52, @"EDITOR"); + AddLabel(126, 408, 52, @"Spawn Editor (edit, find and list"); + AddLabel(126, 427, 52, @"all PremiumSpawners in the world)"); + AddButton(109, 411, 1210, 1209, 126, GumpButtonType.Reply, 0); + //Page change + AddLabel(207, 463, 200, @"2/3"); + AddButton(189, 465, 5603, 5607, 0, GumpButtonType.Page, 1); //back + AddButton(235, 465, 5601, 5605, 0, GumpButtonType.Page, 3); //advance + + //PAGE 3 + AddPage(3); + AddBackground(93, 68, 256, 423, 9200); + AddHtml( 98, 75, 244, 44, " PREMIUM SPAWNER
" + "by Nerun Rev.154", (bool)true, (bool)false); + AddBlackAlpha(101, 124, 241, 47); + AddLabel(109, 126, 52, @"CONVERSION UTILITY"); + AddLabel(127, 148, 52, @"RunUO Spawners to Premium"); + AddButton(110, 151, 1210, 1209, 127, GumpButtonType.Reply, 0); + AddBlackAlpha(101, 177, 241, 134); + AddLabel(109, 179, 52, @"CUSTOM REGIONS IN A BOX"); + AddLabel(127, 201, 52, @"Add a Region Controler"); + AddLabel(127, 222, 52, @"(double-click the Region"); + AddLabel(127, 243, 52, @"Controller to configure it region."); + AddLabel(127, 264, 52, @"Every Controller control one"); + AddLabel(127, 286, 52, @"region. Don't forget to prop)"); + AddButton(110, 204, 1210, 1209, 128, GumpButtonType.Reply, 0); + //Page change + AddLabel(207, 463, 200, @"3/3"); + AddButton(189, 465, 5603, 5607, 0, GumpButtonType.Page, 2); //back + } + + public static void DoThis( Mobile from, string command) + { + string prefix = Server.Commands.CommandSystem.Prefix; + CommandSystem.Handle( from, String.Format( "{0}{1}", prefix, command ) ); + CommandSystem.Handle( from, String.Format( "{0}spawner", prefix ) ); + } + + public override void OnResponse(NetState sender, RelayInfo info) + { + Mobile from = sender.Mobile; + + switch(info.ButtonID) + { + case 0: + { + //Quit + break; + } + case 101: + { + DoThis( from, "createworld" ); + break; + } + case 102: + { + DoThis( from, "clearall" ); + break; + } + case 103: + { + from.Say( "SPAWNING UO Classic..." ); + DoThis( from, "spawngen uoclassic/UOClassic.map" ); + break; + } + case 104: + { + DoThis( from, "SpawnUOML" ); + break; + } + case 105: + { + DoThis( from, "SpawnCurrent" ); + break; + } + //DoThis( from106, "" ); + //DoThis( from107, "" ); + //DoThis( from108, "" ); + case 109: + { + DoThis( from, "spawngen unload 1000" ); + break; + } + case 110: + { + DoThis( from, "UnloadUOML" ); + break; + } + case 111: + { + DoThis( from, "UnloadCurrent" ); + break; + } + //DoThis( from112, "" ); + //DoThis( from113, "" ); + //DoThis( from114, "" ); + case 115: + { + DoThis( from, "GenSeers" ); + break; + } + case 116: + { + DoThis( from, "RemSeers" ); + break; + } + case 117: + { + DoThis( from, "spawngen save" ); + break; + } + case 118: + { + DoThis( from, "spawngen savebyhand" ); + break; + } + case 119: + { + DoThis( from, "GumpSaveRegion" ); + break; + } + case 120: + { + DoThis( from, "GumpSaveCoordinate" ); + break; + } + case 121: + { + DoThis( from, "spawngen remove" ); + break; + } + case 122: + { + DoThis( from, "spawngen cleanfacet" ); + break; + } + case 123: + { + DoThis( from, "GumpRemoveID" ); + break; + } + case 124: + { + DoThis( from, "GumpRemoveCoordinate" ); + break; + } + case 125: + { + DoThis( from, "GumpRemoveRegion" ); + break; + } + case 126: + { + DoThis( from, "SpawnEditor" ); + break; + } + case 127: + { + DoThis( from, "RunUOSpawnerExporter" ); + break; + } + case 128: + { + DoThis( from, "Add RegionControl" ); + break; + } + } + } + } +} diff --git a/Scripts/Engines/Spawner/PremiumSpawner/RunUOSpawnerExporter.cs b/Scripts/Engines/Spawner/PremiumSpawner/RunUOSpawnerExporter.cs new file mode 100644 index 0000000..52e0f05 --- /dev/null +++ b/Scripts/Engines/Spawner/PremiumSpawner/RunUOSpawnerExporter.cs @@ -0,0 +1,161 @@ +//Engine r154 +using System; +using System.IO; +using System.Text; +using System.Collections.Generic; +using Server; +using Server.Mobiles; +using Server.Items; + +namespace Server.Commands +{ + public class RunUOSpawnerExporter + { + public const bool Enabled = true; + + public static bool IsLinux + { + get + { + int p = (int) Environment.OSVersion.Platform; + return (p == 4) || (p == 6) || (p == 128); + } + } + + public static void Initialize() + { + CommandSystem.Register( "RunUOSpawnerExporter" , AccessLevel.Administrator, new CommandEventHandler( RunUOSpawnerExporter_OnCommand ) ); + CommandSystem.Register( "RSE" , AccessLevel.Administrator, new CommandEventHandler( RunUOSpawnerExporter_OnCommand ) ); + } + + public static int ConvertToInt( TimeSpan ts ) + { + return ( ( ts.Hours * 60 ) + ts.Minutes + (ts.Seconds/60) ); + } + + [Usage( "RunUOSpawnerExporter" )] + [Aliases( "RSE" )] + [Description( "Convert RunUO Spawners to PremiumSpawners." )] + public static void RunUOSpawnerExporter_OnCommand( CommandEventArgs e ) + { + Map map = e.Mobile.Map; + List list = new List(); + + string bar = "\\"; + + if (IsLinux == true) + bar = "/"; + + string path = @"."+bar+"Data"+bar+"Nerun's Distro"+bar+"Spawns"+bar; + + if ( !Directory.Exists( path ) ) + Directory.CreateDirectory( path ); + + using ( StreamWriter op = new StreamWriter( String.Format( path+"{0}-exported.map", map ) ) ) + { + + if ( map == null || map == Map.Internal ) + { + e.Mobile.SendMessage( "You may not run that command here." ); + return; + } + + e.Mobile.SendMessage( "Converting Spawners..." ); + + op.WriteLine( "#######################################" ); + op.WriteLine( "## Converted By RunUOSpawnerExporter ##" ); + op.WriteLine( "## Developed by Nerun ##" ); + op.WriteLine( "#######################################" ); + + foreach ( Item item in World.Items.Values ) + { + if ( item.Map == map && item.Parent == null && item is Spawner ) + list.Add( item ); + } + + foreach ( Spawner spawner in list ) + { + string mapfinal = ""; + + string walkrange = ""; + + if(map == Map.Maps[0]) + { + mapfinal = "1"; + } + else if(map == Map.Maps[1]) + { + mapfinal = "2"; + } + else if(map == Map.Maps[2]) + { + mapfinal = "3"; + } + else if(map == Map.Maps[3]) + { + mapfinal = "4"; + } + else if(map == Map.Maps[4]) + { + mapfinal = "5"; + } + else + { + mapfinal = "6"; + } + + if( spawner.WalkingRange == -1 ) + { + walkrange = spawner.HomeRange.ToString(); + } + else + { + walkrange = spawner.WalkingRange.ToString(); + } + + int MinDelay = ConvertToInt(spawner.MinDelay); + + if (MinDelay < 1) + { + MinDelay = 1; + } + + int MaxDelay = ConvertToInt(spawner.MaxDelay); + + if (MaxDelay < MinDelay) + { + MaxDelay = MinDelay; + } + + string towrite = "*|"; + + if( spawner.SpawnNames.Count > 0 ) + { + towrite = "*|" + spawner.SpawnNames[0]; + + for ( int i = 1; i < spawner.SpawnNames.Count; ++i ) + { + towrite = towrite + ":" + spawner.SpawnNames[i].ToString(); + } + } + + if ( spawner.SpawnNames.Count > 0 && spawner.Running == true ) + { + op.WriteLine( "{0}||||||{1}|{2}|{3}|{4}|{5}|{6}|{7}|{8}|1|{9}|0|0|0|0|0", towrite, spawner.X, spawner.Y, spawner.Z, mapfinal, MinDelay, MaxDelay, walkrange, spawner.HomeRange, spawner.Count); + } + + if( spawner.SpawnNames.Count == 0 ) + { + op.WriteLine( "## Void: {0}||||||{1}|{2}|{3}|{4}|{5}|{6}|{7}|{8}|1|{9}|0|0|0|0|0", towrite, spawner.X, spawner.Y, spawner.Z, mapfinal, MinDelay, MaxDelay, walkrange, spawner.HomeRange, spawner.Count); + } + + if( spawner.SpawnNames.Count > 0 && spawner.Running == false ) + { + op.WriteLine( "## Inactive: {0}||||||{1}|{2}|{3}|{4}|{5}|{6}|{7}|{8}|1|{9}|0|0|0|0|0", towrite, spawner.X, spawner.Y, spawner.Z, mapfinal, MinDelay, MaxDelay, walkrange, spawner.HomeRange, spawner.Count); + } + } + e.Mobile.SendMessage( String.Format( "You exported {0} RunUO Spawner{1} from this facet.", list.Count, list.Count == 1 ? "" : "s" ) ); + } + } + } +} diff --git a/Scripts/Engines/Spawner/PremiumSpawner/SpawnEditor.cs b/Scripts/Engines/Spawner/PremiumSpawner/SpawnEditor.cs new file mode 100644 index 0000000..c3b3ff4 --- /dev/null +++ b/Scripts/Engines/Spawner/PremiumSpawner/SpawnEditor.cs @@ -0,0 +1,1017 @@ +///////////////////////////////////// +// SPAWN EDITOR // +// This SpawnEditor is a huge mod // +// of "ZenArcher's SpawnEditor v2" // +// By Nerun // +///////////////////////////////////// +using System; +using System.IO; +using System.Collections; +using System.Collections.Generic; +using Server; +using Server.Items; +using Server.Mobiles; +using Server.Network; +using Server.Regions; +using Server.Commands; + +namespace Server.Gumps +{ + public class SpawnEditorGump : Gump + { + private int m_page; + private ArrayList m_tempList; + public Item m_selSpawner; + + public int page + { + get{ return m_page; } + set{ m_page = value; } + } + + public Item selSpawner + { + get{ return m_selSpawner; } + set{ m_selSpawner = value; } + } + + public ArrayList tempList + { + get{ return m_tempList; } + set{ m_tempList = value; } + } + + public static void Initialize() + { + CommandSystem.Register( "SpawnEditor", AccessLevel.GameMaster, new CommandEventHandler( SpawnEditor_OnCommand ) ); + CommandSystem.Register( "Editor", AccessLevel.GameMaster, new CommandEventHandler( SpawnEditor_OnCommand ) ); + } + + public static void Register( string command, AccessLevel access, CommandEventHandler handler ) + { + CommandSystem.Register( command, access, handler ); + } + + [Usage( "SpawnEditor" )] + [Aliases( "Editor" )] + [Description( "Used to find and edit spawns" )] + public static void SpawnEditor_OnCommand( CommandEventArgs e ) + { + Mobile from = e.Mobile; + SpawnEditor_OnCommand( from ); + } + + public static void SpawnEditor_OnCommand( Mobile from ) + { + ArrayList worldList = new ArrayList(); + ArrayList facetList = new ArrayList(); + + Type type = ScriptCompiler.FindTypeByName( "PremiumSpawner", true ); + + if ( type == typeof( Item ) || type.IsSubclassOf( typeof( Item ) ) ) + { + bool isAbstract = type.IsAbstract; + + foreach ( Item item in World.Items.Values ) + { + if ( isAbstract ? item.GetType().IsSubclassOf( type ) : item.GetType() == type ) + worldList.Add( item ); + } + } + + foreach( PremiumSpawner worldSpnr in worldList ) + { + if( worldSpnr.Map == from.Map ) + facetList.Add( worldSpnr ); + } + +//TODO: Sort spawner list + + SpawnEditor_OnCommand( from, 0, facetList ); + } + + public static void SpawnEditor_OnCommand( Mobile from, int page, ArrayList currentList ) + { + SpawnEditor_OnCommand( from, page, currentList, 0 ); + } + + public static void SpawnEditor_OnCommand( Mobile from, int page, ArrayList currentList, int selected ) + { + SpawnEditor_OnCommand( from, page, currentList, selected, null ); + } + + public static void SpawnEditor_OnCommand( Mobile from, int page, ArrayList currentList, int selected, Item selSpawner ) + { + from.SendGump( new SpawnEditorGump( from, page, currentList, selected, selSpawner ) ); + } + + public SpawnEditorGump( Mobile from, int page, ArrayList currentList, int selected, Item spwnr ) : base( 50, 40 ) + { + tempList = new ArrayList(); + Mobile m = from; + m_page = page; + Region r = from.Region; + Map map = from.Map; + int buttony = 60; + int buttonID = 1; + int listnum = 0; + + tempList = currentList; + + selSpawner = spwnr; + + AddPage(0); + + AddBackground( 0, 0, 600, 450, 5054 ); + AddImageTiled( 8, 8, 584, 40, 2624 ); + AddAlphaRegion( 8, 8, 584, 40 ); + AddImageTiled( 8, 50, 250, 396, 2624 ); + AddAlphaRegion( 8, 50, 250, 396 ); + AddImageTiled( 260, 50, 332, 396, 2624 ); + AddAlphaRegion( 260, 50, 332, 396 ); + AddLabel( 220, 20, 52, "PREMIUM SPAWNER EDITOR" ); + AddButton( 550, 405, 0x158A, 0x158B, 10002, GumpButtonType.Reply, 1 ); //Quit Button + AddButton( 275, 412, 0x845, 0x846, 10008, GumpButtonType.Reply, 0 ); // Refresh button + AddLabel( 300, 410, 52, "Refresh" ); + + if( currentList.Count == 0 ) + AddLabel( 50, 210, 52, "No Premium Spawners Found" ); + else + { + if( page == 0 ) + { + if( currentList.Count < 15 ) + listnum = currentList.Count; + else + listnum = 15; + + for( int x = 0; x < listnum; x++ ) + { + Item spawnr = null; + + if( currentList[x] is Item ) + spawnr = currentList[x] as Item; + + string gumpMsg = ""; + + Point3D spawnr3D = new Point3D( ( new Point2D( spawnr.X, spawnr.Y ) ), spawnr.Z ); + Region spawnrRegion = Region.Find( spawnr3D, map ); + + if( spawnrRegion.ToString() == "" ) + gumpMsg = "PremiumSpawner at " + spawnr.X.ToString() + ", " + spawnr.Y.ToString(); + else + gumpMsg = spawnrRegion.ToString(); + + AddButton( 25, buttony, 0x845, 0x846, buttonID, GumpButtonType.Reply, 0 ); + AddLabel( 55, buttony, 52, gumpMsg ); + buttony += 25; + buttonID += 1; + } + } + + else if( page > 0 ) + { + if( currentList.Count < 15 + ( 15 * page ) ) + listnum = currentList.Count; + else + listnum = 15 + ( 15 * page ); + + for( int x = 15 * page; x < listnum; x++ ) + { + Item spawnr = null; + buttonID = x+1; + + if( currentList[x] is Item ) + spawnr = currentList[x] as Item; + + string gumpMsg = ""; + + Point3D spawnr3D = new Point3D( ( new Point2D( spawnr.X, spawnr.Y ) ), spawnr.Z ); + Region spawnrRegion = Region.Find( spawnr3D, map ); + + if( spawnrRegion.ToString() == "" ) + gumpMsg = "PremiumSpawner at " + spawnr.X.ToString() + ", " + spawnr.Y.ToString(); + else + gumpMsg = spawnrRegion.ToString(); + + AddButton( 25, buttony, 0x845, 0x846, buttonID, GumpButtonType.Reply, 0 ); + AddLabel( 55, buttony, 52, gumpMsg ); + buttony += 25; + } + } + } + + if( page == 0 && currentList.Count > 15 ) + AddButton( 450, 20, 0x15E1, 0x15E5, 10000, GumpButtonType.Reply, 0 ); + else if( page > 0 && currentList.Count > 15 + ( page * 15 ) ) + AddButton( 450, 20, 0x15E1, 0x15E5, 10000, GumpButtonType.Reply, 0 ); + + if( page != 0 ) + AddButton( 150, 20, 0x15E3, 0x15E7, 10001, GumpButtonType.Reply, 0 ); + + int pageNum = (int)currentList.Count / 15; + int rem = currentList.Count % 15; + int totPages = 0; + + string stotPages = ""; + + if( rem > 0 ) + { + totPages = pageNum + 1; + stotPages = totPages.ToString(); + } + else + stotPages = pageNum.ToString(); + + string pageText = "Page " + ( page + 1 ) + " of " + stotPages; + + AddLabel( 40, 20, 52, pageText ); + + if( selected == 0 ) + InitializeStartingRightPanel(); + else if( selected == 1 ) + InitializeSelectedRightPanel(); + } + + public void InitializeStartingRightPanel() + { + AddLabel( 275, 65, 52, "Filter to current region only" ); + AddButton( 500, 65, 0x15E1, 0x15E5, 10003, GumpButtonType.Reply, 0 ); + + AddTextField( 275, 140, 50, 20, 0 ); + AddLabel( 275, 115, 52, "Filter by Distance" ); + AddButton( 500, 115, 0x15E1, 0x15E5, 10004, GumpButtonType.Reply, 0 ); + + AddTextField( 275, 190, 120, 20, 1 ); + AddLabel( 275, 165, 52, "Search Spawners by Creature" ); + AddButton( 500, 165, 0x15E1, 0x15E5, 10009, GumpButtonType.Reply, 0 ); + + AddTextField( 275, 240, 50, 20, 2 ); + AddLabel( 275, 215, 52, "Search Spawners by SpawnID" ); + AddButton( 500, 215, 0x15E1, 0x15E5, 10010, GumpButtonType.Reply, 0 ); + } + + public void InitializeSelectedRightPanel() + { + string spX = selSpawner.X.ToString(); + string spY = selSpawner.Y.ToString(); + string spnText = "PremiumSpawner at " + spX + ", " + spY; + + AddLabel( 350, 65, 52, spnText ); + + PremiumSpawner initSpn = selSpawner as PremiumSpawner; + int strNum = 0; + string spns = "Containing: "; + string spnsNEW = ""; + string spns1 = ""; + string spns2 = ""; + string spns3 = ""; + + for( int i = 0; i < initSpn.CreaturesName.Count; i++ ) + { + if( strNum == 0 ) + { + if( i < initSpn.CreaturesName.Count - 1 ) + { + if( spns.Length + initSpn.CreaturesName[i].ToString().Length < 50 ) + spnsNEW += (string)initSpn.CreaturesName[i] + ", "; + else + { + strNum = 1; + spns1 += (string)initSpn.CreaturesName[i] + ", "; + } + } + else + spnsNEW += (string)initSpn.CreaturesName[i]; + } + else if( strNum == 1 ) + { + if( i < initSpn.CreaturesName.Count - 1 ) + { + if( spns1.Length + initSpn.CreaturesName[i].ToString().Length < 50 ) + spns1 += (string)initSpn.CreaturesName[i] + ", "; + else + { + strNum = 2; + spns2 += (string)initSpn.CreaturesName[i] + ", "; + } + } + else + { + if( spns1.Length + initSpn.CreaturesName[i].ToString().Length < 50 ) + spns1 += (string)initSpn.CreaturesName[i]; + else + { + strNum = 3; + spns2 += (string)initSpn.CreaturesName[i]; + } + } + } + else if( strNum == 2 ) + { + if( i < initSpn.CreaturesName.Count - 1 ) + { + if( spns2.Length + initSpn.CreaturesName[i].ToString().Length < 50 ) + spns2 += (string)initSpn.CreaturesName[i] + ", "; + else + { + strNum = 3; + spns3 += (string)initSpn.CreaturesName[i] + ", "; + } + } + else + { + if( spns2.Length + initSpn.CreaturesName[i].ToString().Length < 50 ) + spns2 += (string)initSpn.CreaturesName[i]; + else + { + strNum = 4; + spns3 += (string)initSpn.CreaturesName[i]; + } + } + } + else if( strNum == 3 ) + { + if( i < initSpn.CreaturesName.Count - 1 ) + spns3 += (string)initSpn.CreaturesName[i] + ", "; + else + spns3 += (string)initSpn.CreaturesName[i]; + } + } + + string spnsNEWa = ""; + string spns1a = ""; + string spns2a = ""; + string spns3a = ""; + + for( int i = 0; i < initSpn.SubSpawnerA.Count; i++ ) + { + if( strNum == 0 ) + { + if( i < initSpn.SubSpawnerA.Count - 1 ) + { + if( spns.Length + initSpn.SubSpawnerA[i].ToString().Length < 50 ) + spnsNEWa += (string)initSpn.SubSpawnerA[i] + ", "; + else + { + strNum = 1; + spns1a += (string)initSpn.SubSpawnerA[i] + ", "; + } + } + else + spnsNEWa += (string)initSpn.SubSpawnerA[i]; + } + else if( strNum == 1 ) + { + if( i < initSpn.SubSpawnerA.Count - 1 ) + { + if( spns1a.Length + initSpn.SubSpawnerA[i].ToString().Length < 50 ) + spns1a += (string)initSpn.SubSpawnerA[i] + ", "; + else + { + strNum = 2; + spns2a += (string)initSpn.SubSpawnerA[i] + ", "; + } + } + else + { + if( spns1a.Length + initSpn.SubSpawnerA[i].ToString().Length < 50 ) + spns1a += (string)initSpn.SubSpawnerA[i]; + else + { + strNum = 3; + spns2a += (string)initSpn.SubSpawnerA[i]; + } + } + } + else if( strNum == 2 ) + { + if( i < initSpn.SubSpawnerA.Count - 1 ) + { + if( spns2a.Length + initSpn.SubSpawnerA[i].ToString().Length < 50 ) + spns2a += (string)initSpn.SubSpawnerA[i] + ", "; + else + { + strNum = 3; + spns3a += (string)initSpn.SubSpawnerA[i] + ", "; + } + } + else + { + if( spns2a.Length + initSpn.SubSpawnerA[i].ToString().Length < 50 ) + spns2a += (string)initSpn.SubSpawnerA[i]; + else + { + strNum = 4; + spns3a += (string)initSpn.SubSpawnerA[i]; + } + } + } + else if( strNum == 3 ) + { + if( i < initSpn.SubSpawnerA.Count - 1 ) + spns3a += (string)initSpn.SubSpawnerA[i] + ", "; + else + spns3a += (string)initSpn.SubSpawnerA[i]; + } + } + + string spnsNEWb = ""; + string spns1b = ""; + string spns2b = ""; + string spns3b = ""; + + for( int i = 0; i < initSpn.SubSpawnerB.Count; i++ ) + { + if( strNum == 0 ) + { + if( i < initSpn.SubSpawnerB.Count - 1 ) + { + if( spns.Length + initSpn.SubSpawnerB[i].ToString().Length < 50 ) + spnsNEWb += (string)initSpn.SubSpawnerB[i] + ", "; + else + { + strNum = 1; + spns1b += (string)initSpn.SubSpawnerB[i] + ", "; + } + } + else + spnsNEWb += (string)initSpn.SubSpawnerB[i]; + } + else if( strNum == 1 ) + { + if( i < initSpn.SubSpawnerB.Count - 1 ) + { + if( spns1b.Length + initSpn.SubSpawnerB[i].ToString().Length < 50 ) + spns1b += (string)initSpn.SubSpawnerB[i] + ", "; + else + { + strNum = 2; + spns2b += (string)initSpn.SubSpawnerB[i] + ", "; + } + } + else + { + if( spns1b.Length + initSpn.SubSpawnerB[i].ToString().Length < 50 ) + spns1b += (string)initSpn.SubSpawnerB[i]; + else + { + strNum = 3; + spns2b += (string)initSpn.SubSpawnerB[i]; + } + } + } + else if( strNum == 2 ) + { + if( i < initSpn.SubSpawnerB.Count - 1 ) + { + if( spns2b.Length + initSpn.SubSpawnerB[i].ToString().Length < 50 ) + spns2b += (string)initSpn.SubSpawnerB[i] + ", "; + else + { + strNum = 3; + spns3b += (string)initSpn.SubSpawnerB[i] + ", "; + } + } + else + { + if( spns2b.Length + initSpn.SubSpawnerB[i].ToString().Length < 50 ) + spns2b += (string)initSpn.SubSpawnerB[i]; + else + { + strNum = 4; + spns3b += (string)initSpn.SubSpawnerB[i]; + } + } + } + else if( strNum == 3 ) + { + if( i < initSpn.SubSpawnerB.Count - 1 ) + spns3b += (string)initSpn.SubSpawnerB[i] + ", "; + else + spns3b += (string)initSpn.SubSpawnerB[i]; + } + } + + string spnsNEWc = ""; + string spns1c = ""; + string spns2c = ""; + string spns3c = ""; + + for( int i = 0; i < initSpn.SubSpawnerC.Count; i++ ) + { + if( strNum == 0 ) + { + if( i < initSpn.SubSpawnerC.Count - 1 ) + { + if( spns.Length + initSpn.SubSpawnerC[i].ToString().Length < 50 ) + spnsNEWc += (string)initSpn.SubSpawnerC[i] + ", "; + else + { + strNum = 1; + spns1c += (string)initSpn.SubSpawnerC[i] + ", "; + } + } + else + spnsNEWc += (string)initSpn.SubSpawnerC[i]; + } + else if( strNum == 1 ) + { + if( i < initSpn.SubSpawnerC.Count - 1 ) + { + if( spns1c.Length + initSpn.SubSpawnerC[i].ToString().Length < 50 ) + spns1c += (string)initSpn.SubSpawnerC[i] + ", "; + else + { + strNum = 2; + spns2c += (string)initSpn.SubSpawnerC[i] + ", "; + } + } + else + { + if( spns1c.Length + initSpn.SubSpawnerC[i].ToString().Length < 50 ) + spns1c += (string)initSpn.SubSpawnerC[i]; + else + { + strNum = 3; + spns2c += (string)initSpn.SubSpawnerC[i]; + } + } + } + else if( strNum == 2 ) + { + if( i < initSpn.SubSpawnerC.Count - 1 ) + { + if( spns2c.Length + initSpn.SubSpawnerC[i].ToString().Length < 50 ) + spns2c += (string)initSpn.SubSpawnerC[i] + ", "; + else + { + strNum = 3; + spns3c += (string)initSpn.SubSpawnerC[i] + ", "; + } + } + else + { + if( spns2c.Length + initSpn.SubSpawnerC[i].ToString().Length < 50 ) + spns2c += (string)initSpn.SubSpawnerC[i]; + else + { + strNum = 4; + spns3c += (string)initSpn.SubSpawnerC[i]; + } + } + } + else if( strNum == 3 ) + { + if( i < initSpn.SubSpawnerC.Count - 1 ) + spns3c += (string)initSpn.SubSpawnerC[i] + ", "; + else + spns3c += (string)initSpn.SubSpawnerC[i]; + } + } + + string spnsNEWd = ""; + string spns1d = ""; + string spns2d = ""; + string spns3d = ""; + + for( int i = 0; i < initSpn.SubSpawnerD.Count; i++ ) + { + if( strNum == 0 ) + { + if( i < initSpn.SubSpawnerD.Count - 1 ) + { + if( spns.Length + initSpn.SubSpawnerD[i].ToString().Length < 50 ) + spnsNEWd += (string)initSpn.SubSpawnerD[i] + ", "; + else + { + strNum = 1; + spns1d += (string)initSpn.SubSpawnerD[i] + ", "; + } + } + else + spnsNEWd += (string)initSpn.SubSpawnerD[i]; + } + else if( strNum == 1 ) + { + if( i < initSpn.SubSpawnerD.Count - 1 ) + { + if( spns1d.Length + initSpn.SubSpawnerD[i].ToString().Length < 50 ) + spns1d += (string)initSpn.SubSpawnerD[i] + ", "; + else + { + strNum = 2; + spns2d += (string)initSpn.SubSpawnerD[i] + ", "; + } + } + else + { + if( spns1d.Length + initSpn.SubSpawnerD[i].ToString().Length < 50 ) + spns1d += (string)initSpn.SubSpawnerD[i]; + else + { + strNum = 3; + spns2d += (string)initSpn.SubSpawnerD[i]; + } + } + } + else if( strNum == 2 ) + { + if( i < initSpn.SubSpawnerD.Count - 1 ) + { + if( spns2d.Length + initSpn.SubSpawnerD[i].ToString().Length < 50 ) + spns2d += (string)initSpn.SubSpawnerD[i] + ", "; + else + { + strNum = 3; + spns3d += (string)initSpn.SubSpawnerD[i] + ", "; + } + } + else + { + if( spns2d.Length + initSpn.SubSpawnerD[i].ToString().Length < 50 ) + spns2d += (string)initSpn.SubSpawnerD[i]; + else + { + strNum = 4; + spns3d += (string)initSpn.SubSpawnerD[i]; + } + } + } + else if( strNum == 3 ) + { + if( i < initSpn.SubSpawnerD.Count - 1 ) + spns3d += (string)initSpn.SubSpawnerD[i] + ", "; + else + spns3d += (string)initSpn.SubSpawnerD[i]; + } + } + + string spnsNEWe = ""; + string spns1e = ""; + string spns2e = ""; + string spns3e = ""; + + for( int i = 0; i < initSpn.SubSpawnerE.Count; i++ ) + { + if( strNum == 0 ) + { + if( i < initSpn.SubSpawnerE.Count - 1 ) + { + if( spns.Length + initSpn.SubSpawnerE[i].ToString().Length < 50 ) + spnsNEWe += (string)initSpn.SubSpawnerE[i] + ", "; + else + { + strNum = 1; + spns1e += (string)initSpn.SubSpawnerE[i] + ", "; + } + } + else + spnsNEWe += (string)initSpn.SubSpawnerE[i]; + } + else if( strNum == 1 ) + { + if( i < initSpn.SubSpawnerE.Count - 1 ) + { + if( spns1e.Length + initSpn.SubSpawnerE[i].ToString().Length < 50 ) + spns1e += (string)initSpn.SubSpawnerE[i] + ", "; + else + { + strNum = 2; + spns2e += (string)initSpn.SubSpawnerE[i] + ", "; + } + } + else + { + if( spns1e.Length + initSpn.SubSpawnerE[i].ToString().Length < 50 ) + spns1e += (string)initSpn.SubSpawnerE[i]; + else + { + strNum = 3; + spns2e += (string)initSpn.SubSpawnerE[i]; + } + } + } + else if( strNum == 2 ) + { + if( i < initSpn.SubSpawnerE.Count - 1 ) + { + if( spns2e.Length + initSpn.SubSpawnerE[i].ToString().Length < 50 ) + spns2e += (string)initSpn.SubSpawnerE[i] + ", "; + else + { + strNum = 3; + spns3e += (string)initSpn.SubSpawnerE[i] + ", "; + } + } + else + { + if( spns2e.Length + initSpn.SubSpawnerE[i].ToString().Length < 50 ) + spns2e += (string)initSpn.SubSpawnerE[i]; + else + { + strNum = 4; + spns3e += (string)initSpn.SubSpawnerE[i]; + } + } + } + else if( strNum == 3 ) + { + if( i < initSpn.SubSpawnerE.Count - 1 ) + spns3e += (string)initSpn.SubSpawnerE[i] + ", "; + else + spns3e += (string)initSpn.SubSpawnerE[i]; + } + } + + AddLabel( 275, 85, 52, spns ); + AddLabel( 280, 110, 52, "[1]" ); + AddLabel( 280, 180, 52, "[2]" ); + AddLabel( 280, 250, 52, "[3]" ); + AddLabel( 425, 110, 52, "[4]" ); + AddLabel( 425, 180, 52, "[5]" ); + AddLabel( 425, 250, 52, "[6]" ); + AddHtml( 300, 110, 115, 65, spnsNEW, true, true ); + AddHtml( 300, 180, 115, 65, spnsNEWa, true, true ); + AddHtml( 300, 250, 115, 65, spnsNEWb, true, true ); + AddHtml( 445, 110, 115, 65, spnsNEWc, true, true ); + AddHtml( 445, 180, 115, 65, spnsNEWd, true, true ); + AddHtml( 445, 250, 115, 65, spnsNEWe, true, true ); + if( spns1 != "" ) + AddLabel( 275, 105, 200, spns1 ); + + if( spns2 != "" ) + AddLabel( 275, 125, 200, spns2 ); + + if( spns3 != "" ) + AddLabel( 275, 145, 200, spns3 ); + + AddLabel( 320, 320, 52, "Go to Spawner" ); + AddButton( 525, 320, 0x15E1, 0x15E5, 10005, GumpButtonType.Reply, 1 ); + AddLabel( 320, 345, 52, "Delete Selected Spawner" ); + AddButton( 525, 345, 0x15E1, 0x15E5, 10006, GumpButtonType.Reply, 0 ); + AddLabel( 320, 370, 52, "Edit Spawns" ); + AddButton( 525, 370, 0x15E1, 0x15E5, 10007, GumpButtonType.Reply, 0 ); + } + + public List CreateArray( RelayInfo info, Mobile from ) + { + List creaturesName = new List(); + + for ( int i = 0; i < 13; i++ ) + { + TextRelay te = info.GetTextEntry( i ); + + if ( te != null ) + { + string str = te.Text; + + if ( str.Length > 0 ) + { + str = str.Trim(); + + Type type = SpawnerType.GetType( str ); + + if ( type != null ) + creaturesName.Add( str ); + else + AddLabel( 70, 230, 39, "Invalid Search String" ); + } + } + } + + return creaturesName; + } + + public override void OnResponse( NetState state, RelayInfo info ) + { + Mobile from = state.Mobile; + int buttonNum = 0; + ArrayList currentList = new ArrayList( tempList ); + int page = m_page; + + if( info.ButtonID > 0 && info.ButtonID < 10000 ) + buttonNum = 1; + else + buttonNum = info.ButtonID; + + switch( buttonNum ) + { + case 0: + { + //Close + break; + } + case 1: + { + selSpawner = currentList[ info.ButtonID - 1 ] as Item; + SpawnEditor_OnCommand( from, page, currentList, 1, selSpawner ); + break; + } + case 10000: + { + if( m_page * 10 < currentList.Count ) + { + page = m_page += 1; + SpawnEditor_OnCommand( from, page, currentList ); + } + break; + } + case 10001: + { + if( m_page != 0 ) + { + page = m_page -= 1; + SpawnEditor_OnCommand( from, page, currentList ); + } + break; + } + case 10002: + { + //Close + break; + } + case 10003: // Filter to current region only + { + FilterByRegion( from, tempList, from.Region, from.Map, page ); + break; + } + case 10004: // Filter by Distance + { + TextRelay oDis = info.GetTextEntry( 0 ); + string sDis = ( oDis == null ? "" : oDis.Text.Trim() ); + if( sDis != "" ) + { + try + { + int distance = Convert.ToInt32( sDis ); + FilterByDistance( tempList, from, distance, page ); } + catch + { + from.SendMessage( "Distance must be a number" ); + SpawnEditor_OnCommand( from, page, currentList ); + } + } + else + { + from.SendMessage( "You must specify a distance" ); + SpawnEditor_OnCommand( from, page, currentList ); + } + break; + } + case 10005: // Go to Spawner + { + from.Location = new Point3D( selSpawner.X, selSpawner.Y, selSpawner.Z ); + SpawnEditor_OnCommand( from, page, currentList, 1, selSpawner ); + break; + } + case 10006: // Delete Selected Spawner + { + selSpawner.Delete(); + SpawnEditor_OnCommand( from ); + break; + } + case 10007: // Edit Spawns (Premium Sapwner Gump) + { + from.SendGump( new PremiumSpawnerGump( selSpawner as PremiumSpawner ) ); + SpawnEditor_OnCommand( from, page, currentList, 1, selSpawner ); + break; + } + case 10008: // Refresh button + { + SpawnEditor_OnCommand( from ); + break; + } + case 10009: // Search Spawners by Creature + { + TextRelay oSearch = info.GetTextEntry( 1 ); + string sSearch = ( oSearch == null ? null : oSearch.Text.Trim() ); + SearchByName( tempList, from, sSearch, page ); + break; + } + case 10010: // Search Spawners by SpawnID + { + TextRelay oID = info.GetTextEntry( 2 ); + string sID = ( oID == null ? "" : oID.Text.Trim() ); + if( sID != "" ) + { + try + { + int SearchID = Convert.ToInt32( sID ); + SearchByID( tempList, from, SearchID, page ); } + catch + { + from.SendMessage( "SpawnID must be a number" ); + SpawnEditor_OnCommand( from, page, currentList ); + } + } + else + { + from.SendMessage( "You must specify a SpawnID" ); + SpawnEditor_OnCommand( from, page, currentList ); + } + break; + } + } + } + + + public static void FilterByRegion( Mobile from, ArrayList facetList, Region regr, Map regmap, int page ) + { + ArrayList filregList = new ArrayList(); + + foreach( Item regItem in facetList ) + { + Point2D p2 = new Point2D( regItem.X, regItem.Y ); + Point3D p = new Point3D( p2, regItem.Z ); + + if( Region.Find( p, regmap ) == regr ) + filregList.Add( regItem ); + } + + from.SendGump( new SpawnEditorGump( from, 0, filregList, 0, null ) ); + } + + public static void FilterByDistance( ArrayList currentList, Mobile m, int dis, int page ) + { + ArrayList fildisList = new ArrayList(); + + for( int z = 0; z < currentList.Count; z ++ ) + { + Item disItem = currentList[z] as Item; + + if( disItem.X >= m.X - dis && disItem.X <= m.X + dis && disItem.Y >= m.Y - dis && disItem.Y <= m.Y + dis ) + fildisList.Add( disItem ); + } + + m.SendGump( new SpawnEditorGump( m, 0, fildisList, 0, null ) ); + } + + public static void SearchByName( ArrayList currentList, Mobile from, string search, int page ) + { + ArrayList searchList = new ArrayList(); + + foreach( PremiumSpawner spn in currentList ) + { + foreach( string str in spn.CreaturesName ) + { + if( str.ToLower().IndexOf( search ) >= 0 ) + searchList.Add( spn ); + } + + foreach( string str in spn.SubSpawnerA ) + { + if( str.ToLower().IndexOf( search ) >= 0 ) + searchList.Add( spn ); + } + + foreach( string str in spn.SubSpawnerB ) + { + if( str.ToLower().IndexOf( search ) >= 0 ) + searchList.Add( spn ); + } + + foreach( string str in spn.SubSpawnerC ) + { + if( str.ToLower().IndexOf( search ) >= 0 ) + searchList.Add( spn ); + } + + foreach( string str in spn.SubSpawnerD ) + { + if( str.ToLower().IndexOf( search ) >= 0 ) + searchList.Add( spn ); + } + + foreach( string str in spn.SubSpawnerE ) + { + if( str.ToLower().IndexOf( search ) >= 0 ) + searchList.Add( spn ); + } + } + + from.SendGump( new SpawnEditorGump( from, 0, searchList, 0, null ) ); + } + + public static void SearchByID( ArrayList currentList, Mobile from, int SearchID, int page ) + { + ArrayList searchList = new ArrayList(); + + foreach( PremiumSpawner spn in currentList ) + { + if ( ((PremiumSpawner)spn).SpawnID == SearchID ) + { + searchList.Add( spn ); + } + } + + from.SendGump( new SpawnEditorGump( from, 0, searchList, 0, null ) ); + } + + public void AddTextField( int x, int y, int width, int height, int index ) + { + AddBackground( x - 2, y - 2, width + 4, height + 4, 0x2486 ); + AddTextEntry( x + 2, y + 2, width - 4, height - 4, 0, index, "" ); + } + } +} diff --git a/Scripts/Engines/Spawner/PremiumSpawner/SpawnGen.cs b/Scripts/Engines/Spawner/PremiumSpawner/SpawnGen.cs new file mode 100644 index 0000000..2ba86dc --- /dev/null +++ b/Scripts/Engines/Spawner/PremiumSpawner/SpawnGen.cs @@ -0,0 +1,642 @@ +//Engine r117 +using System; +using System.Collections; +using System.Collections.Generic; +using System.IO; +using System.Text; +using Server; +using Server.Mobiles; +using Server.Items; +using Server.Network; +using Server.Commands; +using Server.Regions; + +namespace Server +{ + public class SpawnGenerator + { + private static int m_Count; + private static int m_MapOverride = -1; + private static int m_IDOverride = -1; + private static double m_MinTimeOverride = -1; + private static double m_MaxTimeOverride = -1; + private const bool TotalRespawn = true; + private const int Team = 0; + + public static void Initialize() + { + CommandSystem.Register( "SpawnGen", AccessLevel.Administrator, new CommandEventHandler( SpawnGen_OnCommand ) ); + } + + [Usage( "SpawnGen []|[unload ]|[remove |]|[save |][savebyhand][cleanfacet]" )] + [Description( "Complex command, it generate and remove spawners." )] + private static void SpawnGen_OnCommand( CommandEventArgs e ) + { + //wrong use + if ( e.ArgString == null || e.ArgString == "" ) + { + e.Mobile.SendMessage( "Usage: SpawnGen []|[remove ||]|[save ||]" ); + } + //[spawngen remove and [spawngen remove region + else if ( e.Arguments[0].ToLower() == "remove" && e.Arguments.Length == 2 ) + { + Remove( e.Mobile, e.Arguments[1].ToLower() ); + } + //[spawngen remove x1 y1 x2 y2 + else if ( e.Arguments[0].ToLower() == "remove" && e.Arguments.Length == 5 ) + { + int x1 = Utility.ToInt32( e.Arguments[1] ); + int y1 = Utility.ToInt32( e.Arguments[2] ); + int x2 = Utility.ToInt32( e.Arguments[3] ); + int y2 = Utility.ToInt32( e.Arguments[4] ); + RemoveByCoord( e.Mobile, x1, y1, x2, y2 ); + } + //[spawngen remove + else if ( e.ArgString.ToLower() == "remove" ) + { + Remove( e.Mobile, "" ); + } + //[spawngen save and [spawngen save region + else if ( e.Arguments[0].ToLower() == "save" && e.Arguments.Length == 2 ) + { + Save( e.Mobile, e.Arguments[1].ToLower() ); + } + //[spawngen unload SpawnID + else if ( e.Arguments[0].ToLower() == "unload" && e.Arguments.Length == 2 ) + { + int ID = Utility.ToInt32( e.Arguments[1] ); + Unload( ID ); + } + //[spawngen savebyhand + else if ( e.Arguments[0].ToLower() == "savebyhand" ) + { + SaveByHand(); + } + //[spawngen cleanfacet + else if ( e.Arguments[0].ToLower() == "cleanfacet" ) + { + CleanFacet( e.Mobile ); + } + ////[spawngen save x1 y1 x2 y2 + else if ( e.Arguments[0].ToLower() == "save" && e.Arguments.Length == 5 ) + { + int x1 = Utility.ToInt32( e.Arguments[1] ); + int y1 = Utility.ToInt32( e.Arguments[2] ); + int x2 = Utility.ToInt32( e.Arguments[3] ); + int y2 = Utility.ToInt32( e.Arguments[4] ); + SaveByCoord( e.Mobile, x1, y1, x2, y2 ); + } + //[spawngen save + else if ( e.ArgString.ToLower() == "save" ) + { + Save( e.Mobile, "" ); + } + else + { + Parse( e.Mobile, e.ArgString ); + } + } + + public static void Talk( string alfa ) + { + World.Broadcast( 0x35, true, "Spawns are being {0}, please wait.", alfa ); + } + + public static string GetRegion(Item item) + { + Region re = Region.Find(item.Location, item.Map); + string regname = re.ToString().ToLower(); + return regname; + } + + //[spawngen remove and [spawngen remove region + private static void Remove( Mobile from, string region ) + { + DateTime aTime = DateTime.Now; + int count = 0; + List itemtodo = new List(); + + string prefix = Server.Commands.CommandSystem.Prefix; + + if( region == null || region == "" ) + { + CommandSystem.Handle( from, String.Format( "{0}Global remove where premiumspawner", prefix ) ); + } + else + { + foreach( Item itemdel in World.Items.Values ) + { + if( itemdel is PremiumSpawner && itemdel.Map == from.Map ) + { + if( GetRegion(itemdel) == region ) + { + itemtodo.Add(itemdel); + count += 1; + } + } + } + + GenericRemove( itemtodo, count, aTime); + } + } + + //[spawngen unload SpawnID + private static void Unload( int ID ) + { + DateTime aTime = DateTime.Now; + int count = 0; + List itemtodo = new List(); + + foreach ( Item itemremove in World.Items.Values ) + { + if ( itemremove is PremiumSpawner && ((PremiumSpawner)itemremove).SpawnID == ID ) + { + itemtodo.Add( itemremove ); + count +=1; + } + } + + GenericRemove( itemtodo, count, aTime); + } + + //[spawngen remove x1 y1 x2 y2 + private static void RemoveByCoord( Mobile from, int x1, int y1, int x2, int y2 ) + { + DateTime aTime = DateTime.Now; + int count = 0; + List itemtodo = new List(); + + foreach ( Item itemremove in World.Items.Values ) + { + if ( itemremove is PremiumSpawner && ( ( itemremove.X >= x1 && itemremove.X <= x2 ) && ( itemremove.Y >= y1 && itemremove.Y <= y2 ) && itemremove.Map == from.Map ) ) + { + itemtodo.Add( itemremove ); + count +=1; + } + } + + GenericRemove( itemtodo, count, aTime); + } + + //[spawngen cleanfacet + //this is the old [SpawnRem + public static void CleanFacet( Mobile from ) + { + DateTime aTime = DateTime.Now; + int count = 0; + List itemtodo = new List(); + + foreach ( Item itemremove in World.Items.Values ) + { + if ( itemremove is PremiumSpawner && itemremove.Map == from.Map && itemremove.Parent == null ) + { + itemtodo.Add( itemremove ); + count +=1; + } + } + + GenericRemove( itemtodo, count, aTime); + } + + private static void GenericRemove( List colecao, int count, DateTime aTime ) + { + if( colecao.Count == 0 ) + { + World.Broadcast( 0x35, true, "There are no PremiumSpawners to be removed." ); + } + else + { + Talk("removed"); + + foreach ( Item item in colecao ) + { + item.Delete(); + } + + DateTime bTime = DateTime.Now; + World.Broadcast( 0x35, true, "{0} PremiumSpawners have been removed in {1:F1} seconds.", count, (bTime - aTime).TotalSeconds ); + } + } + + //[spawngen save and [spawngen save region + private static void Save( Mobile from, string region ) + { + DateTime aTime = DateTime.Now; + int count = 0; + List itemtodo = new List(); + string mapanome = region; + + if( region == "" ) + mapanome = "Spawns"; + + foreach ( Item itemsave in World.Items.Values ) + { + if ( itemsave is PremiumSpawner && ( region == null || region == "" ) ) + { + itemtodo.Add( itemsave ); + count +=1; + } + + else if ( itemsave is PremiumSpawner && itemsave.Map == from.Map ) + { + if ( GetRegion(itemsave) == region ) + { + itemtodo.Add( itemsave ); + count += 1; + } + } + } + + GenericSave( itemtodo, mapanome, count, aTime ); + } + + //[spawngen SaveByHand + private static void SaveByHand() + { + DateTime aTime = DateTime.Now; + int count = 0; + List itemtodo = new List(); + string mapanome = "SpawnsByHand"; + + foreach ( Item itemsave in World.Items.Values ) + { + if ( itemsave is PremiumSpawner && ((PremiumSpawner)itemsave).SpawnID == 99 ) + { + itemtodo.Add( itemsave ); + count +=1; + } + } + + GenericSave( itemtodo, mapanome, count, aTime ); + } + + //[spawngen save x1 y1 x2 y2 + private static void SaveByCoord( Mobile from, int x1, int y1, int x2, int y2 ) + { + DateTime aTime = DateTime.Now; + int count = 0; + List itemtodo = new List(); + string mapanome = "SpawnsByCoords"; + + foreach ( Item itemsave in World.Items.Values ) + { + if ( itemsave is PremiumSpawner && ( ( itemsave.X >= x1 && itemsave.X <= x2 ) && ( itemsave.Y >= y1 && itemsave.Y <= y2 ) && itemsave.Map == from.Map ) ) + { + itemtodo.Add( itemsave ); + count +=1; + } + } + + GenericSave( itemtodo, mapanome, count, aTime ); + } + + private static void GenericSave( List colecao, string mapa, int count, DateTime startTime ) + { + List itemssave = new List( colecao ); + string mapanome = mapa; + + if( itemssave.Count == 0 ) + { + World.Broadcast( 0x35, true, "There are no PremiumSpawners to be saved." ); + } + else + { + Talk("saved"); + + if ( !Directory.Exists( "Data/Spawns" ) ) + Directory.CreateDirectory( "Data/Spawns" ); + + string escreva = "Data/Spawns/" + mapanome + ".map"; + + using ( StreamWriter op = new StreamWriter( escreva ) ) + { + foreach ( PremiumSpawner itemsave2 in itemssave ) + { + int mapnumber = 0; + switch ( itemsave2.Map.ToString() ) + { + case "Vaelen": + mapnumber = 1; + break; + case "Trammel": + mapnumber = 2; + break; + case "Ilshenar": + mapnumber = 3; + break; + case "Malas": + mapnumber = 4; + break; + case "Tokuno": + mapnumber = 5; + break; + case "TerMur": + mapnumber = 6; + break; + default: + mapnumber = 7; + Console.WriteLine( "Monster Parser: Warning, unknown map {0}", itemsave2.Map ); + break; + } + + string timer1a = itemsave2.MinDelay.ToString(); + string[] timer1b = timer1a.Split( ':' ); //Broke the string hh:mm:ss in an array (hh, mm, ss) + int timer1c = ( Utility.ToInt32( timer1b[0] ) * 60 ) + Utility.ToInt32( timer1b[1] ); //multiply hh * 60 to find mm, then add mm + string timer1d = timer1c.ToString(); + if ( Utility.ToInt32( timer1b[0] ) == 0 && Utility.ToInt32( timer1b[1] ) == 0 ) //If hh and mm are 0, use seconds, else drop ss + timer1d = Utility.ToInt32( timer1b[2] ) + "s"; + + string timer2a = itemsave2.MaxDelay.ToString(); + string[] timer2b = timer2a.Split( ':' ); + int timer2c = ( Utility.ToInt32( timer2b[0] ) * 60 ) + Utility.ToInt32( timer2b[1] ); + string timer2d = timer2c.ToString(); + if ( Utility.ToInt32( timer2b[0] ) == 0 && Utility.ToInt32( timer2b[1] ) == 0 ) + timer2d = Utility.ToInt32( timer2b[2] ) + "s"; + + string towrite = ""; + string towriteA = ""; + string towriteB = ""; + string towriteC = ""; + string towriteD = ""; + string towriteE = ""; + + if ( itemsave2.CreaturesName.Count > 0 ) + towrite = itemsave2.CreaturesName[0].ToString(); + + if ( itemsave2.SubSpawnerA.Count > 0 ) + towriteA = itemsave2.SubSpawnerA[0].ToString(); + + if ( itemsave2.SubSpawnerB.Count > 0 ) + towriteB = itemsave2.SubSpawnerB[0].ToString(); + + if ( itemsave2.SubSpawnerC.Count > 0 ) + towriteC = itemsave2.SubSpawnerC[0].ToString(); + + if ( itemsave2.SubSpawnerD.Count > 0 ) + towriteD = itemsave2.SubSpawnerD[0].ToString(); + + if ( itemsave2.SubSpawnerE.Count > 0 ) + towriteE = itemsave2.SubSpawnerE[0].ToString(); + + for ( int i = 1; i < itemsave2.CreaturesName.Count; ++i ) + { + if ( itemsave2.CreaturesName.Count > 0 ) + towrite = towrite + ":" + itemsave2.CreaturesName[i].ToString(); + } + + for ( int i = 1; i < itemsave2.SubSpawnerA.Count; ++i ) + { + if ( itemsave2.SubSpawnerA.Count > 0 ) + towriteA = towriteA + ":" + itemsave2.SubSpawnerA[i].ToString(); + } + + for ( int i = 1; i < itemsave2.SubSpawnerB.Count; ++i ) + { + if ( itemsave2.SubSpawnerB.Count > 0 ) + towriteB = towriteB + ":" + itemsave2.SubSpawnerB[i].ToString(); + } + + for ( int i = 1; i < itemsave2.SubSpawnerC.Count; ++i ) + { + if ( itemsave2.SubSpawnerC.Count > 0 ) + towriteC = towriteC + ":" + itemsave2.SubSpawnerC[i].ToString(); + } + + for ( int i = 1; i < itemsave2.SubSpawnerD.Count; ++i ) + { + if ( itemsave2.SubSpawnerD.Count > 0 ) + towriteD = towriteD + ":" + itemsave2.SubSpawnerD[i].ToString(); + } + + for ( int i = 1; i < itemsave2.SubSpawnerE.Count; ++i ) + { + if ( itemsave2.SubSpawnerE.Count > 0 ) + towriteE = towriteE + ":" + itemsave2.SubSpawnerE[i].ToString(); + } + + op.WriteLine( "*|{0}|{1}|{2}|{3}|{4}|{5}|{6}|{7}|{8}|{9}|{10}|{11}|{12}|{13}|{14}|{15}|{16}|{17}|{18}|{19}|{20}", towrite, towriteA, towriteB, towriteC, towriteD, towriteE, itemsave2.X, itemsave2.Y, itemsave2.Z, mapnumber, timer1d, timer2d, itemsave2.WalkingRange, itemsave2.HomeRange, itemsave2.SpawnID, itemsave2.Count, itemsave2.CountA, itemsave2.CountB, itemsave2.CountC, itemsave2.CountD, itemsave2.CountE ); + } + } + + DateTime endTime = DateTime.Now; + World.Broadcast( 0x35, true, "{0} spawns have been saved. The entire process took {1:F1} seconds.", count, (endTime - startTime).TotalSeconds ); + } + } + + public static void Parse( Mobile from, string filename ) + { + string monster_path1 = Path.Combine( Core.BaseDirectory, "Data/Spawns" ); + string monster_path = Path.Combine( monster_path1, filename ); + m_Count = 0; + + if ( File.Exists( monster_path ) ) + { + from.SendMessage( "Spawning {0}...", filename ); + m_MapOverride = -1; + m_IDOverride = -1; + m_MinTimeOverride = -1; + m_MaxTimeOverride = -1; + + using ( StreamReader ip = new StreamReader( monster_path ) ) + { + string line; + + while ( (line = ip.ReadLine()) != null ) + { + string[] split = line.Split( '|' ); + string[] splitA = line.Split( ' ' ); + + if ( splitA.Length == 2 ) + { + if ( splitA[0].ToLower() == "overridemap" ) + m_MapOverride = Utility.ToInt32( splitA[1] ); + if ( splitA[0].ToLower() == "overrideid" ) + m_IDOverride = Utility.ToInt32( splitA[1] ); + if ( splitA[0].ToLower() == "overridemintime" ) + m_MinTimeOverride = Utility.ToDouble( splitA[1] ); + if ( splitA[0].ToLower() == "overridemaxtime" ) + m_MaxTimeOverride = Utility.ToDouble( splitA[1] ); + } + + if ( split.Length < 19 ) + continue; + + switch( split[0].ToLower() ) + { + //Comment Line + case "##": + break; + //Place By class + case "*": + PlaceNPC( split[2].Split(':'), split[3].Split(':'), split[4].Split(':'), split[5].Split(':'), split[6].Split(':'), split[7], split[8], split[9], split[10], split[11], split[12], split[14], split[13], split[15], split[16], split[17], split[18], split[19], split[20], split[21], split[1].Split(':') ); + break; + //Place By Type + case "r": + PlaceNPC( split[2].Split(':'), split[3].Split(':'), split[4].Split(':'), split[5].Split(':'), split[6].Split(':'), split[7], split[8], split[9], split[10], split[11], split[12], split[14], split[13], split[15], split[16], split[17], split[18], split[19], split[20], split[1], "bloodmoss", "sulfurousash", "spiderssilk", "mandrakeroot", "gravedust", "nightshade", "ginseng", "garlic", "batwing", "pigiron", "noxcrystal", "daemonblood", "blackpearl"); + break; + } + } + } + + m_MapOverride = -1; + m_IDOverride = -1; + m_MinTimeOverride = -1; + m_MaxTimeOverride = -1; + + from.SendMessage( "Done, added {0} spawners",m_Count ); + } + else + { + from.SendMessage( "{0} not found!", monster_path ); + } + } + + public static void PlaceNPC( string[] fakespawnsA, string[] fakespawnsB, string[] fakespawnsC, string[] fakespawnsD, string[] fakespawnsE, string sx, string sy, string sz, string sm, string smintime, string smaxtime, string swalkingrange, string shomerange, string sspawnid, string snpccount, string sfakecountA, string sfakecountB, string sfakecountC, string sfakecountD, string sfakecountE, params string[] types ) + { + if ( types.Length == 0 ) + return; + + int x = Utility.ToInt32( sx ); + int y = Utility.ToInt32( sy ); + int z = Utility.ToInt32( sz ); + int map = Utility.ToInt32( sm ); + + //MinTime + string samintime = smintime; + + if ( smintime.Contains("s") || smintime.Contains("m") || smintime.Contains("h") ) + samintime = smintime.Remove(smintime.Length - 1); + + double dmintime = Utility.ToDouble( samintime ); + + if ( m_MinTimeOverride != -1 ) + dmintime = m_MinTimeOverride; + + TimeSpan mintime = TimeSpan.FromMinutes( dmintime ); + + if ( smintime.Contains("s") ) + mintime = TimeSpan.FromSeconds( dmintime ); + else if ( smintime.Contains("m") ) + mintime = TimeSpan.FromMinutes( dmintime ); + else if ( smintime.Contains("h") ) + mintime = TimeSpan.FromHours( dmintime ); + + //MaxTime + + string samaxtime = smaxtime; + + if ( smaxtime.Contains("s") || smaxtime.Contains("m") || smaxtime.Contains("h") ) + samaxtime = smaxtime.Remove(smaxtime.Length - 1); + + double dmaxtime = Utility.ToDouble( samaxtime ); + + if ( m_MaxTimeOverride != -1 ) + { + if ( m_MaxTimeOverride < dmintime ) + dmaxtime = dmintime; + else + dmaxtime = m_MaxTimeOverride; + } + + TimeSpan maxtime = TimeSpan.FromMinutes( dmaxtime ); + + if ( smaxtime.Contains("s") ) + maxtime = TimeSpan.FromSeconds( dmaxtime ); + else if ( smaxtime.Contains("m") ) + maxtime = TimeSpan.FromMinutes( dmaxtime ); + else if ( smaxtime.Contains("h") ) + maxtime = TimeSpan.FromHours( dmaxtime ); + + // + int homerange = Utility.ToInt32( shomerange ); + int walkingrange = Utility.ToInt32( swalkingrange ); + int spawnid = Utility.ToInt32( sspawnid ); + int npccount = Utility.ToInt32( snpccount ); + int fakecountA = Utility.ToInt32( sfakecountA ); + int fakecountB = Utility.ToInt32( sfakecountB ); + int fakecountC = Utility.ToInt32( sfakecountC ); + int fakecountD = Utility.ToInt32( sfakecountD ); + int fakecountE = Utility.ToInt32( sfakecountE ); + + if ( m_MapOverride != -1 ) + map = m_MapOverride; + + if ( m_IDOverride != -1 ) + spawnid = m_IDOverride; + + switch ( map ) + { + case 0://Trammel and Felucca + MakeSpawner( types, fakespawnsA, fakespawnsB, fakespawnsC, fakespawnsD, fakespawnsE, x, y, z, Map.Felucca, mintime, maxtime, walkingrange, homerange, spawnid, npccount, fakecountA, fakecountB, fakecountC, fakecountD, fakecountE ); + MakeSpawner( types, fakespawnsA, fakespawnsB, fakespawnsC, fakespawnsD, fakespawnsE, x, y, z, Map.Trammel, mintime, maxtime, walkingrange, homerange, spawnid, npccount, fakecountA, fakecountB, fakecountC, fakecountD, fakecountE ); + break; + case 1://Felucca + MakeSpawner( types, fakespawnsA, fakespawnsB, fakespawnsC, fakespawnsD, fakespawnsE, x, y, z, Map.Felucca, mintime, maxtime, walkingrange, homerange, spawnid, npccount, fakecountA, fakecountB, fakecountC, fakecountD, fakecountE ); + break; + case 2://Trammel + MakeSpawner( types, fakespawnsA, fakespawnsB, fakespawnsC, fakespawnsD, fakespawnsE, x, y, z, Map.Trammel, mintime, maxtime, walkingrange, homerange, spawnid, npccount, fakecountA, fakecountB, fakecountC, fakecountD, fakecountE ); + break; + case 3://Ilshenar + MakeSpawner( types, fakespawnsA, fakespawnsB, fakespawnsC, fakespawnsD, fakespawnsE, x, y, z, Map.Ilshenar, mintime, maxtime, walkingrange, homerange, spawnid, npccount, fakecountA, fakecountB, fakecountC, fakecountD, fakecountE ); + break; + case 4://Malas + MakeSpawner( types, fakespawnsA, fakespawnsB, fakespawnsC, fakespawnsD, fakespawnsE, x, y, z, Map.Malas, mintime, maxtime, walkingrange, homerange, spawnid, npccount, fakecountA, fakecountB, fakecountC, fakecountD, fakecountE ); + break; + case 5://Tokuno + MakeSpawner( types, fakespawnsA, fakespawnsB, fakespawnsC, fakespawnsD, fakespawnsE, x, y, z, Map.Maps[4], mintime, maxtime, walkingrange, homerange, spawnid, npccount, fakecountA, fakecountB, fakecountC, fakecountD, fakecountE ); + break; + case 6://TerMur + MakeSpawner( types, fakespawnsA, fakespawnsB, fakespawnsC, fakespawnsD, fakespawnsE, x, y, z, Map.Maps[5], mintime, maxtime, walkingrange, homerange, spawnid, npccount, fakecountA, fakecountB, fakecountC, fakecountD, fakecountE ); + break; + + default: + Console.WriteLine( "Spawn Parser: Warning, unknown map {0}", map ); + break; + } + } + + private static void MakeSpawner( string[] types, string[] fakespawnsA, string[] fakespawnsB, string[] fakespawnsC, string[] fakespawnsD, string[] fakespawnsE, int x, int y, int z, Map map, TimeSpan mintime, TimeSpan maxtime, int walkingrange, int homerange, int spawnid, int npccount, int fakecountA, int fakecountB, int fakecountC, int fakecountD, int fakecountE ) + { + if ( types.Length == 0 ) + return; + + List tipos = new List( types ); + List noneA = new List(); + List noneB = new List(); + List noneC = new List(); + List noneD = new List(); + List noneE = new List(); + + if ( fakespawnsA[0] != "" ) + noneA = new List( fakespawnsA ); + + if ( fakespawnsB[0] != "" ) + noneB = new List( fakespawnsB ); + + if ( fakespawnsC[0] != "" ) + noneC = new List( fakespawnsC ); + + if ( fakespawnsD[0] != "" ) + noneD = new List( fakespawnsD ); + + if ( fakespawnsE[0] != "" ) + noneE = new List( fakespawnsE ); + + PremiumSpawner spawner = new PremiumSpawner( npccount, fakecountA, fakecountB, fakecountC, fakecountD, fakecountE, spawnid, mintime, maxtime, Team, walkingrange, homerange, tipos, noneA, noneB, noneC, noneD, noneE ); + + spawner.MoveToWorld( new Point3D( x, y, z ), map ); + + if ( TotalRespawn ) + { + spawner.Respawn(); + + if ( ((PremiumSpawner)spawner).SpawnID == 132 ) // if is ChampionSpawn + { + spawner.BringToHome(); + } + } + + m_Count++; + } + } +} diff --git a/Scripts/Engines/Spawner/PremiumSpawner/SpawnMaps.cs b/Scripts/Engines/Spawner/PremiumSpawner/SpawnMaps.cs new file mode 100644 index 0000000..b277a9d --- /dev/null +++ b/Scripts/Engines/Spawner/PremiumSpawner/SpawnMaps.cs @@ -0,0 +1,412 @@ +// Engine r133 +#define RunUo2_0 +using System; +using System.Collections.Generic; +using Server; +using Server.Gumps; +using Server.Network; +using Server.Commands; + +namespace Server.Gumps +{ + public class SpawnCurrentGump : Gump + { + Mobile caller; + + public static void Initialize() + { +#if(RunUo2_0) + CommandSystem.Register("SpawnCurrent", AccessLevel.Administrator, new CommandEventHandler(SpawnCurrent_OnCommand)); +#else + Register("SpawnCurrent", AccessLevel.Administrator, new CommandEventHandler(SpawnCurrent_OnCommand)); +#endif + } + + [Usage("SpawnCurrent")] + [Description("Generate PremiumSpawners around the world with a gump.")] + public static void SpawnCurrent_OnCommand(CommandEventArgs e) + { + Mobile from = e.Mobile; + + if (from.HasGump(typeof(SpawnCurrentGump))) + from.CloseGump(typeof(SpawnCurrentGump)); + from.SendGump(new SpawnCurrentGump(from)); + } + + public SpawnCurrentGump(Mobile from) : this() + { + caller = from; + } + + public void AddBlackAlpha( int x, int y, int width, int height ) + { + AddImageTiled( x, y, width, height, 2624 ); + AddAlphaRegion( x, y, width, height ); + } + + public SpawnCurrentGump() : base( 30, 30 ) + { + this.Closable=true; + this.Disposable=true; + this.Dragable=true; + AddPage(1); + AddBackground(58, 22, 474, 540, 9200); + AddImage(305, 306, 1418); // Castle + AddBlackAlpha(66, 30, 458, 33); + AddLabel(213, 37, 52, @"SELECT MAPS TO SPAWN"); + AddBlackAlpha(66, 87, 239, 447); + AddLabel(69, 67, 200, @"DUNGEONS"); + AddLabel(69, 90, 52, @"Blighted Grove"); + AddLabel(69, 112, 52, @"Britain Sewer"); + AddLabel(69, 133, 52, @"Covetous"); + AddLabel(69, 154, 52, @"Deceit"); + AddLabel(69, 174, 52, @"Despise"); + AddLabel(69, 196, 52, @"Destard"); + AddLabel(69, 217, 52, @"Fire"); + AddLabel(69, 237, 52, @"Graveyards"); + AddLabel(69, 258, 52, @"Hythloth"); + AddLabel(69, 280, 52, @"Ice"); + AddLabel(69, 301, 52, @"Khaldun"); + AddLabel(69, 322, 52, @"Orc Caves"); + AddLabel(69, 343, 52, @"Painted Caves"); + AddLabel(69, 363, 52, @"Palace of Paroxysmus"); + AddLabel(69, 384, 52, @"Prism of Light"); + AddLabel(69, 405, 52, @"Sanctuary"); + AddLabel(69, 427, 52, @"Shame"); + AddLabel(69, 448, 52, @"Solen Hive"); + AddLabel(69, 469, 52, @"Terathan Keep"); + AddLabel(69, 489, 52, @"Trinsic Passage"); + AddLabel(69, 510, 52, @"Wrong"); + AddLabel(194, 66, 200, @"Felucca"); + AddCheck(210, 91, 210, 211, true, 201); + AddCheck(210, 112, 210, 211, true, 202); + AddCheck(210, 133, 210, 211, true, 203); + AddCheck(210, 154, 210, 211, true, 204); + AddCheck(210, 175, 210, 211, true, 205); + AddCheck(210, 196, 210, 211, true, 206); + AddCheck(210, 217, 210, 211, true, 207); + AddCheck(210, 238, 210, 211, true, 208); + AddCheck(210, 259, 210, 211, true, 209); + AddCheck(210, 280, 210, 211, true, 210); + AddCheck(210, 301, 210, 211, true, 228); + AddCheck(210, 322, 210, 211, true, 212); + AddCheck(210, 343, 210, 211, true, 214); + AddCheck(210, 364, 210, 211, true, 215); + AddCheck(210, 385, 210, 211, true, 216); + AddCheck(210, 406, 210, 211, true, 217); + AddCheck(210, 427, 210, 211, true, 219); + AddCheck(210, 448, 210, 211, true, 220); + AddCheck(210, 469, 210, 211, true, 221); + AddCheck(210, 490, 210, 211, true, 224); + AddCheck(210, 511, 210, 211, true, 227); + AddLabel(250, 66, 200, @"Trammel"); + AddCheck(268, 91, 210, 211, true, 101); + AddCheck(268, 112, 210, 211, true, 102); + AddCheck(268, 133, 210, 211, true, 103); + AddCheck(268, 154, 210, 211, true, 104); + AddCheck(268, 175, 210, 211, true, 105); + AddCheck(268, 196, 210, 211, true, 106); + AddCheck(268, 217, 210, 211, true, 107); + AddCheck(268, 238, 210, 211, true, 108); + AddCheck(268, 259, 210, 211, true, 109); + AddCheck(268, 280, 210, 211, true, 110); + //There is no Khaldun in Trammel (ID 128 reserved) + AddCheck(268, 322, 210, 211, true, 112); + AddCheck(268, 343, 210, 211, true, 114); + AddCheck(268, 364, 210, 211, true, 115); + AddCheck(268, 385, 210, 211, true, 116); + AddCheck(268, 406, 210, 211, true, 117); + AddCheck(268, 427, 210, 211, true, 119); + AddCheck(268, 448, 210, 211, true, 120); + AddCheck(268, 469, 210, 211, true, 121); + AddCheck(268, 490, 210, 211, true, 124); + AddCheck(268, 511, 210, 211, true, 127); + AddBlackAlpha(311, 87, 213, 70); + AddLabel(315, 67, 200, @"TOWNS"); + AddLabel(315, 91, 52, @"Animals"); + AddLabel(315, 112, 52, @"People (*)"); + AddLabel(315, 133, 52, @"Vendors"); + AddLabel(413, 66, 200, @"Felucca"); + AddCheck(429, 91, 210, 211, true, 222); + AddCheck(429, 112, 210, 211, true, 223); + AddCheck(429, 133, 210, 211, true, 225); + AddLabel(469, 66, 200, @"Trammel"); + AddCheck(487, 91, 210, 211, true, 122); + AddCheck(487, 112, 210, 211, true, 123); + AddCheck(487, 133, 210, 211, true, 125); + AddBlackAlpha(311, 183, 213, 114); + AddLabel(315, 162, 200, @"OUTDOORS"); + AddLabel(316, 187, 52, @"Animals"); + AddLabel(316, 207, 52, @"Lost Lands"); + AddLabel(316, 229, 52, @"Spawns"); + AddLabel(316, 249, 52, @"Reagents"); + AddLabel(316, 270, 52, @"Sea Life"); + AddLabel(413, 162, 200, @"Felucca"); + AddCheck(429, 187, 210, 211, true, 226); + AddCheck(429, 208, 210, 211, true, 211); + AddCheck(429, 229, 210, 211, true, 213); + AddCheck(429, 250, 210, 211, true, 229); + AddCheck(429, 271, 210, 211, true, 218); + AddLabel(469, 162, 200, @"Trammel"); + AddCheck(487, 187, 210, 211, true, 126); + AddCheck(487, 208, 210, 211, true, 111); + AddCheck(487, 229, 210, 211, true, 113); + AddCheck(487, 250, 210, 211, true, 129); + AddCheck(487, 271, 210, 211, true, 118); + AddLabel(316, 305, 200, @"(*) Escortables, Hireables,"); + AddLabel(316, 324, 200, @"Town Criers, Order and Chaos"); + AddLabel(316, 344, 200, @"guards etc."); + // END + AddLabel(361, 453, 52, @"Page: 1/2"); //Page + AddButton(423, 455, 5601, 5605, 0, GumpButtonType.Page, 2); // Change Page + + //PAGE 2 + AddPage(2); + AddBackground(58, 22, 474, 540, 9200); + AddImage(305, 306, 1418); // Castle + AddBlackAlpha(66, 30, 458, 33); + AddLabel(213, 37, 52, @"SELECT MAPS TO SPAWN"); + AddBlackAlpha(66, 87, 174, 300); + AddLabel(74, 67, 200, @"ILSHENAR"); + AddLabel(74, 90, 52, @"Ancient Lair"); + AddLabel(74, 112, 52, @"Ankh"); + AddLabel(74, 133, 52, @"Blood"); + AddLabel(74, 154, 52, @"Exodus"); + AddLabel(74, 174, 52, @"Mushroom"); + AddLabel(74, 196, 52, @"Outdoors"); + AddLabel(74, 217, 52, @"Ratman Cave"); + AddLabel(74, 237, 52, @"Rock"); + AddLabel(74, 258, 52, @"Sorcerers"); + AddLabel(74, 280, 52, @"Spectre"); + AddLabel(74, 301, 52, @"Towns"); + AddLabel(74, 322, 52, @"Twisted Weald"); + AddLabel(74, 343, 52, @"Vendors"); + AddLabel(74, 363, 52, @"Wisp"); + AddCheck(215, 91, 210, 211, true, 301); + AddCheck(215, 112, 210, 211, true, 302); + AddCheck(215, 133, 210, 211, true, 303); + AddCheck(215, 154, 210, 211, true, 304); + AddCheck(215, 175, 210, 211, true, 305); + AddCheck(215, 196, 210, 211, true, 306); + AddCheck(215, 217, 210, 211, true, 307); + AddCheck(215, 238, 210, 211, true, 308); + AddCheck(215, 259, 210, 211, true, 309); + AddCheck(215, 280, 210, 211, true, 310); + AddCheck(215, 301, 210, 211, true, 311); + AddCheck(215, 322, 210, 211, true, 314); + AddCheck(215, 343, 210, 211, true, 312); + AddCheck(215, 364, 210, 211, true, 313); + AddBlackAlpha(66, 414, 174, 133); + AddLabel(74, 393, 200, @"TOKUNO"); + AddLabel(74, 416, 52, @"Fan Dancers Dojo"); + AddLabel(74, 438, 52, @"Outdoors"); + AddLabel(74, 459, 52, @"Towns Life"); + AddLabel(74, 480, 52, @"Vendors"); + AddLabel(74, 500, 52, @"Wild Life"); + AddLabel(74, 522, 52, @"Yomutso Mines"); + AddCheck(215, 417, 210, 211, true, 501); + AddCheck(215, 438, 210, 211, true, 502); + AddCheck(215, 459, 210, 211, true, 503); + AddCheck(215, 480, 210, 211, true, 504); + AddCheck(215, 501, 210, 211, true, 505); + AddCheck(215, 522, 210, 211, true, 506); + AddBlackAlpha(246, 87, 174, 178); + AddLabel(253, 67, 200, @"MALAS"); + AddLabel(253, 90, 52, @"Bedlam"); + AddLabel(253, 112, 52, @"Citadel"); + AddLabel(253, 133, 52, @"Doom"); + AddLabel(253, 154, 52, @"Labyrinth"); + AddLabel(253, 174, 52, @"North (*)"); + AddLabel(253, 196, 52, @"Orc Forts"); + AddLabel(253, 217, 52, @"South (*)"); + AddLabel(253, 238, 52, @"Vendors"); + AddCheck(394, 91, 210, 211, true, 408); + AddCheck(394, 112, 210, 211, true, 406); + AddCheck(394, 133, 210, 211, true, 401); + AddCheck(394, 154, 210, 211, true, 407); + AddCheck(394, 175, 210, 211, true, 402); + AddCheck(394, 196, 210, 211, true, 403); + AddCheck(394, 217, 210, 211, true, 404); + AddCheck(394, 238, 210, 211, true, 405); + AddLabel(428, 91, 200, @"(*) Wild"); + AddLabel(428, 109, 200, @"Animals and"); + AddLabel(428, 129, 200, @"monsters."); + AddBlackAlpha(246, 292, 174, 117); + AddLabel(253, 272, 200, @"TER MUR"); + AddLabel(253, 295, 52, @"Abyss"); + AddLabel(253, 316, 52, @"TerMur"); + AddLabel(253, 337, 52, @"Underworld"); + AddLabel(253, 358, 52, @"Vendors"); + AddCheck(394, 296, 210, 211, true, 601); + AddCheck(394, 317, 210, 211, true, 602); + AddCheck(394, 338, 210, 211, true, 603); + AddCheck(394, 359, 210, 211, true, 604); + //END + AddLabel(381, 453, 52, @"Page: 2/2"); //Page + AddButton(361, 455, 5603, 5607, 0, GumpButtonType.Page, 1); //Change Page + AddButton(282, 452, 240, 239, 1, GumpButtonType.Reply, 0); // Apply + } + + public static void SpawnThis( Mobile from, List ListSwitches, int switche, int map, string mapfile) + { + string folder = ""; + + if( map == 1 ) + folder = "felucca"; + else if( map == 2) + folder = "trammel"; + else if( map == 3) + folder = "ilshenar"; + else if( map == 4) + folder = "malas"; + else if( map == 5) + folder = "tokuno"; + else if( map == 6) + folder = "termur"; + + string prefix = Server.Commands.CommandSystem.Prefix; + + if( ListSwitches.Contains( switche ) == true ) + CommandSystem.Handle( from, String.Format( "{0}Spawngen {1}/{2}.map", prefix, folder, mapfile ) ); + } + + public override void OnResponse(NetState sender, RelayInfo info) + { + Mobile from = sender.Mobile; + + switch(info.ButtonID) + { + case 0: //Closed or Cancel + { + break; + } + default: + { + // Make sure that the APPLY button was pressed + if( info.ButtonID == 1 ) + { + // Get the array of switches selected + List Selections = new List( info.Switches ); + + //TRAMMEL + from.Say( "SPAWNING TRAMMEL..." ); + // DUNGEONS + SpawnThis(from, Selections, 101, 2, "BlightedGrove"); + SpawnThis(from, Selections, 102, 2, "BritainSewer"); + SpawnThis(from, Selections, 103, 2, "Covetous"); + SpawnThis(from, Selections, 104, 2, "Deceit"); + SpawnThis(from, Selections, 105, 2, "Despise"); + SpawnThis(from, Selections, 106, 2, "Destard"); + SpawnThis(from, Selections, 107, 2, "Fire"); + SpawnThis(from, Selections, 108, 2, "Graveyards"); + SpawnThis(from, Selections, 109, 2, "Hythloth"); + SpawnThis(from, Selections, 110, 2, "Ice"); + //There is no Khaldun (118) + SpawnThis(from, Selections, 112, 2, "OrcCaves"); + SpawnThis(from, Selections, 114, 2, "PaintedCaves"); + SpawnThis(from, Selections, 115, 2, "PalaceOfParoxysmus"); + SpawnThis(from, Selections, 116, 2, "PrismOfLight"); + SpawnThis(from, Selections, 117, 2, "Sanctuary"); + SpawnThis(from, Selections, 119, 2, "Shame"); + SpawnThis(from, Selections, 120, 2, "SolenHive"); + SpawnThis(from, Selections, 121, 2, "TerathanKeep"); + SpawnThis(from, Selections, 124, 2, "TrinsicPassage"); + SpawnThis(from, Selections, 127, 2, "Wrong"); + //TOWNS + SpawnThis(from, Selections, 122, 2, "TownsLife"); + SpawnThis(from, Selections, 123, 2, "TownsPeople"); + SpawnThis(from, Selections, 125, 2, "Vendors"); + //OUTDOORS + SpawnThis(from, Selections, 126, 2, "WildLife"); + SpawnThis(from, Selections, 111, 2, "LostLands"); + SpawnThis(from, Selections, 113, 2, "Outdoors"); + SpawnThis(from, Selections, 129, 2, "Reagents"); + SpawnThis(from, Selections, 118, 2, "SeaLife"); + + //FELUCCA + from.Say( "SPAWNING FELUCCA..." ); + // DUNGEONS + SpawnThis(from, Selections, 201, 1, "BlightedGrove"); + SpawnThis(from, Selections, 202, 1, "BritainSewer"); + SpawnThis(from, Selections, 203, 1, "Covetous"); + SpawnThis(from, Selections, 204, 1, "Deceit"); + SpawnThis(from, Selections, 205, 1, "Despise"); + SpawnThis(from, Selections, 206, 1, "Destard"); + SpawnThis(from, Selections, 207, 1, "Fire"); + SpawnThis(from, Selections, 208, 1, "Graveyards"); + SpawnThis(from, Selections, 209, 1, "Hythloth"); + SpawnThis(from, Selections, 210, 1, "Ice"); + SpawnThis(from, Selections, 229, 1, "Khaldun"); + SpawnThis(from, Selections, 212, 1, "OrcCaves"); + SpawnThis(from, Selections, 214, 1, "PaintedCaves"); + SpawnThis(from, Selections, 215, 1, "PalaceOfParoxysmus"); + SpawnThis(from, Selections, 216, 1, "PrismOfLight"); + SpawnThis(from, Selections, 217, 1, "Sanctuary"); + SpawnThis(from, Selections, 219, 1, "Shame"); + SpawnThis(from, Selections, 220, 1, "SolenHive"); + SpawnThis(from, Selections, 221, 1, "TerathanKeep"); + SpawnThis(from, Selections, 224, 1, "TrinsicPassage"); + SpawnThis(from, Selections, 227, 1, "Wrong"); + //TOWNS + SpawnThis(from, Selections, 222, 1, "TownsLife"); + SpawnThis(from, Selections, 223, 1, "TownsPeople"); + SpawnThis(from, Selections, 225, 1, "Vendors"); + //OUTDOORS + SpawnThis(from, Selections, 226, 1, "WildLife"); + SpawnThis(from, Selections, 211, 1, "LostLands"); + SpawnThis(from, Selections, 213, 1, "Outdoors"); + SpawnThis(from, Selections, 229, 1, "Reagents"); + SpawnThis(from, Selections, 218, 1, "SeaLife"); + + //ILSHENAR + from.Say( "SPAWNING ILSHENAR..." ); + SpawnThis(from, Selections, 301, 3, "Ancientlair"); + SpawnThis(from, Selections, 302, 3, "Ankh"); + SpawnThis(from, Selections, 303, 3, "Blood"); + SpawnThis(from, Selections, 304, 3, "Exodus"); + SpawnThis(from, Selections, 305, 3, "Mushroom"); + SpawnThis(from, Selections, 306, 3, "Outdoors"); + SpawnThis(from, Selections, 307, 3, "Ratmancave"); + SpawnThis(from, Selections, 308, 3, "Rock"); + SpawnThis(from, Selections, 309, 3, "Sorcerers"); + SpawnThis(from, Selections, 310, 3, "Spectre"); + SpawnThis(from, Selections, 311, 3, "Towns"); + SpawnThis(from, Selections, 314, 3, "TwistedWeald"); + SpawnThis(from, Selections, 312, 3, "Vendors"); + SpawnThis(from, Selections, 313, 3, "Wisp"); + + //MALAS + from.Say( "SPAWNING MALAS..." ); + SpawnThis(from, Selections, 408, 4, "Bedlam"); + SpawnThis(from, Selections, 406, 4, "Citadel"); + SpawnThis(from, Selections, 401, 4, "Doom"); + SpawnThis(from, Selections, 407, 4, "Labyrinth"); + SpawnThis(from, Selections, 402, 4, "North"); + SpawnThis(from, Selections, 403, 4, "OrcForts"); + SpawnThis(from, Selections, 404, 4, "South"); + SpawnThis(from, Selections, 405, 4, "Vendors"); + + //TOKUNO + from.Say( "SPAWNING TOKUNO..." ); + SpawnThis(from, Selections, 501, 5, "FanDancersDojo"); + SpawnThis(from, Selections, 502, 5, "Outdoors"); + SpawnThis(from, Selections, 503, 5, "TownsLife"); + SpawnThis(from, Selections, 504, 5, "Vendors"); + SpawnThis(from, Selections, 505, 5, "WildLife"); + SpawnThis(from, Selections, 506, 5, "YomutsoMines"); + + //TER MUR + from.Say( "SPAWNING TER MUR..." ); + SpawnThis(from, Selections, 601, 6, "Abyss"); + SpawnThis(from, Selections, 602, 6, "TerMur"); + SpawnThis(from, Selections, 603, 6, "Underworld"); + SpawnThis(from, Selections, 604, 6, "Vendors"); + + from.Say( "SPAWN GENERATION COMPLETED" ); + } + break; + } + } + } + } +} \ No newline at end of file diff --git a/Scripts/Engines/Spawner/PremiumSpawner/SpawnMapsUOML.cs b/Scripts/Engines/Spawner/PremiumSpawner/SpawnMapsUOML.cs new file mode 100644 index 0000000..6f44cf7 --- /dev/null +++ b/Scripts/Engines/Spawner/PremiumSpawner/SpawnMapsUOML.cs @@ -0,0 +1,393 @@ +// Engine r93 +#define RunUo2_0 +using System; +using System.Collections.Generic; +using Server; +using Server.Gumps; +using Server.Network; +using Server.Commands; + +namespace Server.Gumps +{ + public class SpawnUOMLGump : Gump + { + Mobile caller; + + public static void Initialize() + { +#if(RunUo2_0) + CommandSystem.Register("SpawnUOML", AccessLevel.Administrator, new CommandEventHandler(SpawnUOML_OnCommand)); +#else + Register("SpawnUOML", AccessLevel.Administrator, new CommandEventHandler(SpawnUOML_OnCommand)); +#endif + } + + [Usage("SpawnUOML")] + [Description("Generate PremiumSpawners around the world with a gump.")] + public static void SpawnUOML_OnCommand(CommandEventArgs e) + { + Mobile from = e.Mobile; + + if (from.HasGump(typeof(SpawnUOMLGump))) + from.CloseGump(typeof(SpawnUOMLGump)); + from.SendGump(new SpawnUOMLGump(from)); + } + + public SpawnUOMLGump(Mobile from) : this() + { + caller = from; + } + + public void AddBlackAlpha( int x, int y, int width, int height ) + { + AddImageTiled( x, y, width, height, 2624 ); + AddAlphaRegion( x, y, width, height ); + } + + public SpawnUOMLGump() : base( 30, 30 ) + { + this.Closable=true; + this.Disposable=true; + this.Dragable=true; + AddPage(1); + AddBackground(58, 22, 474, 540, 9200); + AddImage(305, 306, 1418); // Castle + AddBlackAlpha(66, 30, 458, 33); + AddLabel(213, 37, 52, @"SELECT MAPS TO SPAWN"); + AddBlackAlpha(66, 87, 239, 447); + AddLabel(69, 67, 200, @"DUNGEONS"); + AddLabel(69, 90, 52, @"Blighted Grove"); + AddLabel(69, 112, 52, @"Britain Sewer"); + AddLabel(69, 133, 52, @"Covetous"); + AddLabel(69, 154, 52, @"Deceit"); + AddLabel(69, 174, 52, @"Despise"); + AddLabel(69, 196, 52, @"Destard"); + AddLabel(69, 217, 52, @"Fire"); + AddLabel(69, 237, 52, @"Graveyards"); + AddLabel(69, 258, 52, @"Hythloth"); + AddLabel(69, 280, 52, @"Ice"); + AddLabel(69, 301, 52, @"Khaldun"); + AddLabel(69, 322, 52, @"Orc Caves"); + AddLabel(69, 343, 52, @"Painted Caves"); + AddLabel(69, 363, 52, @"Palace of Paroxysmus"); + AddLabel(69, 384, 52, @"Prism of Light"); + AddLabel(69, 405, 52, @"Sanctuary"); + AddLabel(69, 427, 52, @"Shame"); + AddLabel(69, 448, 52, @"Solen Hive"); + AddLabel(69, 469, 52, @"Terathan Keep"); + AddLabel(69, 489, 52, @"Trinsic Passage"); + AddLabel(69, 510, 52, @"Wrong"); + AddLabel(194, 66, 200, @"Felucca"); + AddCheck(210, 91, 210, 211, true, 201); + AddCheck(210, 112, 210, 211, true, 202); + AddCheck(210, 133, 210, 211, true, 203); + AddCheck(210, 154, 210, 211, true, 204); + AddCheck(210, 175, 210, 211, true, 205); + AddCheck(210, 196, 210, 211, true, 206); + AddCheck(210, 217, 210, 211, true, 207); + AddCheck(210, 238, 210, 211, true, 208); + AddCheck(210, 259, 210, 211, true, 209); + AddCheck(210, 280, 210, 211, true, 210); + AddCheck(210, 301, 210, 211, true, 228); + AddCheck(210, 322, 210, 211, true, 212); + AddCheck(210, 343, 210, 211, true, 214); + AddCheck(210, 364, 210, 211, true, 215); + AddCheck(210, 385, 210, 211, true, 216); + AddCheck(210, 406, 210, 211, true, 217); + AddCheck(210, 427, 210, 211, true, 219); + AddCheck(210, 448, 210, 211, true, 220); + AddCheck(210, 469, 210, 211, true, 221); + AddCheck(210, 490, 210, 211, true, 224); + AddCheck(210, 511, 210, 211, true, 227); + AddLabel(250, 66, 200, @"Trammel"); + AddCheck(268, 91, 210, 211, true, 101); + AddCheck(268, 112, 210, 211, true, 102); + AddCheck(268, 133, 210, 211, true, 103); + AddCheck(268, 154, 210, 211, true, 104); + AddCheck(268, 175, 210, 211, true, 105); + AddCheck(268, 196, 210, 211, true, 106); + AddCheck(268, 217, 210, 211, true, 107); + AddCheck(268, 238, 210, 211, true, 108); + AddCheck(268, 259, 210, 211, true, 109); + AddCheck(268, 280, 210, 211, true, 110); + //There is no Khaldun in Trammel (ID 128 reserved) + AddCheck(268, 322, 210, 211, true, 112); + AddCheck(268, 343, 210, 211, true, 114); + AddCheck(268, 364, 210, 211, true, 115); + AddCheck(268, 385, 210, 211, true, 116); + AddCheck(268, 406, 210, 211, true, 117); + AddCheck(268, 427, 210, 211, true, 119); + AddCheck(268, 448, 210, 211, true, 120); + AddCheck(268, 469, 210, 211, true, 121); + AddCheck(268, 490, 210, 211, true, 124); + AddCheck(268, 511, 210, 211, true, 127); + AddBlackAlpha(311, 87, 213, 70); + AddLabel(315, 67, 200, @"TOWNS"); + AddLabel(315, 91, 52, @"Animals"); + AddLabel(315, 112, 52, @"People (*)"); + AddLabel(315, 133, 52, @"Vendors"); + AddLabel(413, 66, 200, @"Felucca"); + AddCheck(429, 91, 210, 211, true, 222); + AddCheck(429, 112, 210, 211, true, 223); + AddCheck(429, 133, 210, 211, true, 225); + AddLabel(469, 66, 200, @"Trammel"); + AddCheck(487, 91, 210, 211, true, 122); + AddCheck(487, 112, 210, 211, true, 123); + AddCheck(487, 133, 210, 211, true, 125); + AddBlackAlpha(311, 183, 213, 114); + AddLabel(315, 162, 200, @"OUTDOORS"); + AddLabel(316, 187, 52, @"Animals"); + AddLabel(316, 207, 52, @"Lost Lands"); + AddLabel(316, 229, 52, @"Spawns"); + AddLabel(316, 249, 52, @"Reagents"); + AddLabel(316, 270, 52, @"Sea Life"); + AddLabel(413, 162, 200, @"Felucca"); + AddCheck(429, 187, 210, 211, true, 226); + AddCheck(429, 208, 210, 211, true, 211); + AddCheck(429, 229, 210, 211, true, 213); + AddCheck(429, 250, 210, 211, true, 229); + AddCheck(429, 271, 210, 211, true, 218); + AddLabel(469, 162, 200, @"Trammel"); + AddCheck(487, 187, 210, 211, true, 126); + AddCheck(487, 208, 210, 211, true, 111); + AddCheck(487, 229, 210, 211, true, 113); + AddCheck(487, 250, 210, 211, true, 129); + AddCheck(487, 271, 210, 211, true, 118); + AddLabel(316, 305, 200, @"(*) Escortables, Hireables,"); + AddLabel(316, 324, 200, @"Town Criers, Order and Chaos"); + AddLabel(316, 344, 200, @"guards etc."); + // END + AddLabel(361, 453, 52, @"Page: 1/2"); //Page + AddButton(423, 455, 5601, 5605, 0, GumpButtonType.Page, 2); // Change Page + + //PAGE 2 + AddPage(2); + AddBackground(58, 22, 474, 540, 9200); + AddImage(305, 306, 1418); // Castle + AddBlackAlpha(66, 30, 458, 33); + AddLabel(213, 37, 52, @"SELECT MAPS TO SPAWN"); + AddBlackAlpha(66, 87, 174, 300); + AddLabel(74, 67, 200, @"ILSHENAR"); + AddLabel(74, 90, 52, @"Ancient Lair"); + AddLabel(74, 112, 52, @"Ankh"); + AddLabel(74, 133, 52, @"Blood"); + AddLabel(74, 154, 52, @"Exodus"); + AddLabel(74, 174, 52, @"Mushroom"); + AddLabel(74, 196, 52, @"Outdoors"); + AddLabel(74, 217, 52, @"Ratman Cave"); + AddLabel(74, 237, 52, @"Rock"); + AddLabel(74, 258, 52, @"Sorcerers"); + AddLabel(74, 280, 52, @"Spectre"); + AddLabel(74, 301, 52, @"Towns"); + AddLabel(74, 322, 52, @"Twisted Weald"); + AddLabel(74, 343, 52, @"Vendors"); + AddLabel(74, 363, 52, @"Wisp"); + AddCheck(215, 91, 210, 211, true, 301); + AddCheck(215, 112, 210, 211, true, 302); + AddCheck(215, 133, 210, 211, true, 303); + AddCheck(215, 154, 210, 211, true, 304); + AddCheck(215, 175, 210, 211, true, 305); + AddCheck(215, 196, 210, 211, true, 306); + AddCheck(215, 217, 210, 211, true, 307); + AddCheck(215, 238, 210, 211, true, 308); + AddCheck(215, 259, 210, 211, true, 309); + AddCheck(215, 280, 210, 211, true, 310); + AddCheck(215, 301, 210, 211, true, 311); + AddCheck(215, 322, 210, 211, true, 314); + AddCheck(215, 343, 210, 211, true, 312); + AddCheck(215, 364, 210, 211, true, 313); + AddBlackAlpha(66, 414, 174, 133); + AddLabel(74, 393, 200, @"TOKUNO"); + AddLabel(74, 416, 52, @"Fan Dancers Dojo"); + AddLabel(74, 438, 52, @"Outdoors"); + AddLabel(74, 459, 52, @"Towns Life"); + AddLabel(74, 480, 52, @"Vendors"); + AddLabel(74, 500, 52, @"Wild Life"); + AddLabel(74, 522, 52, @"Yomutso Mines"); + AddCheck(215, 417, 210, 211, true, 501); + AddCheck(215, 438, 210, 211, true, 502); + AddCheck(215, 459, 210, 211, true, 503); + AddCheck(215, 480, 210, 211, true, 504); + AddCheck(215, 501, 210, 211, true, 505); + AddCheck(215, 522, 210, 211, true, 506); + AddBlackAlpha(246, 87, 174, 178); + AddLabel(253, 67, 200, @"MALAS"); + AddLabel(253, 90, 52, @"Bedlam"); + AddLabel(253, 112, 52, @"Citadel"); + AddLabel(253, 133, 52, @"Doom"); + AddLabel(253, 154, 52, @"Labyrinth"); + AddLabel(253, 174, 52, @"North (*)"); + AddLabel(253, 196, 52, @"Orc Forts"); + AddLabel(253, 217, 52, @"South (*)"); + AddLabel(253, 238, 52, @"Vendors"); + AddCheck(394, 91, 210, 211, true, 408); + AddCheck(394, 112, 210, 211, true, 406); + AddCheck(394, 133, 210, 211, true, 401); + AddCheck(394, 154, 210, 211, true, 407); + AddCheck(394, 175, 210, 211, true, 402); + AddCheck(394, 196, 210, 211, true, 403); + AddCheck(394, 217, 210, 211, true, 404); + AddCheck(394, 238, 210, 211, true, 405); + AddLabel(428, 91, 200, @"(*) Wild"); + AddLabel(428, 109, 200, @"Animals and"); + AddLabel(428, 129, 200, @"monsters."); + //END + AddLabel(381, 453, 52, @"Page: 2/2"); //Page + AddButton(361, 455, 5603, 5607, 0, GumpButtonType.Page, 1); //Change Page + AddButton(282, 452, 240, 239, 1, GumpButtonType.Reply, 0); // Apply + } + + public static void SpawnThis( Mobile from, List ListSwitches, int switche, int map, string mapfile) + { + string folder = ""; + + if( map == 1 ) + folder = "felucca"; + else if( map == 2) + folder = "trammel"; + else if( map == 3) + folder = "ilshenar"; + else if( map == 4) + folder = "malas"; + else if( map == 5) + folder = "tokuno"; + + string prefix = Server.Commands.CommandSystem.Prefix; + + if( ListSwitches.Contains( switche ) == true ) + CommandSystem.Handle( from, String.Format( "{0}Spawngen uoml/{1}/{2}.map", prefix, folder, mapfile ) ); + } + + public override void OnResponse(NetState sender, RelayInfo info) + { + Mobile from = sender.Mobile; + + switch(info.ButtonID) + { + case 0: //Closed or Cancel + { + break; + } + default: + { + // Make sure that the APPLY button was pressed + if( info.ButtonID == 1 ) + { + // Get the array of switches selected + List Selections = new List( info.Switches ); + + //TRAMMEL + from.Say( "SPAWNING TRAMMEL..." ); + // DUNGEONS + SpawnThis(from, Selections, 101, 2, "BlightedGrove"); + SpawnThis(from, Selections, 102, 2, "BritainSewer"); + SpawnThis(from, Selections, 103, 2, "Covetous"); + SpawnThis(from, Selections, 104, 2, "Deceit"); + SpawnThis(from, Selections, 105, 2, "Despise"); + SpawnThis(from, Selections, 106, 2, "Destard"); + SpawnThis(from, Selections, 107, 2, "Fire"); + SpawnThis(from, Selections, 108, 2, "Graveyards"); + SpawnThis(from, Selections, 109, 2, "Hythloth"); + SpawnThis(from, Selections, 110, 2, "Ice"); + //There is no Khaldun (118) + SpawnThis(from, Selections, 112, 2, "OrcCaves"); + SpawnThis(from, Selections, 114, 2, "PaintedCaves"); + SpawnThis(from, Selections, 115, 2, "PalaceOfParoxysmus"); + SpawnThis(from, Selections, 116, 2, "PrismOfLight"); + SpawnThis(from, Selections, 117, 2, "Sanctuary"); + SpawnThis(from, Selections, 119, 2, "Shame"); + SpawnThis(from, Selections, 120, 2, "SolenHive"); + SpawnThis(from, Selections, 121, 2, "TerathanKeep"); + SpawnThis(from, Selections, 124, 2, "TrinsicPassage"); + SpawnThis(from, Selections, 127, 2, "Wrong"); + //TOWNS + SpawnThis(from, Selections, 122, 2, "TownsLife"); + SpawnThis(from, Selections, 123, 2, "TownsPeople"); + SpawnThis(from, Selections, 125, 2, "Vendors"); + //OUTDOORS + SpawnThis(from, Selections, 126, 2, "WildLife"); + SpawnThis(from, Selections, 111, 2, "LostLands"); + SpawnThis(from, Selections, 113, 2, "Outdoors"); + SpawnThis(from, Selections, 129, 2, "Reagents"); + SpawnThis(from, Selections, 118, 2, "SeaLife"); + + //FELUCCA + from.Say( "SPAWNING FELUCCA..." ); + // DUNGEONS + SpawnThis(from, Selections, 201, 1, "BlightedGrove"); + SpawnThis(from, Selections, 202, 1, "BritainSewer"); + SpawnThis(from, Selections, 203, 1, "Covetous"); + SpawnThis(from, Selections, 204, 1, "Deceit"); + SpawnThis(from, Selections, 205, 1, "Despise"); + SpawnThis(from, Selections, 206, 1, "Destard"); + SpawnThis(from, Selections, 207, 1, "Fire"); + SpawnThis(from, Selections, 208, 1, "Graveyards"); + SpawnThis(from, Selections, 209, 1, "Hythloth"); + SpawnThis(from, Selections, 210, 1, "Ice"); + SpawnThis(from, Selections, 229, 1, "Khaldun"); + SpawnThis(from, Selections, 212, 1, "OrcCaves"); + SpawnThis(from, Selections, 214, 1, "PaintedCaves"); + SpawnThis(from, Selections, 215, 1, "PalaceOfParoxysmus"); + SpawnThis(from, Selections, 216, 1, "PrismOfLight"); + SpawnThis(from, Selections, 217, 1, "Sanctuary"); + SpawnThis(from, Selections, 219, 1, "Shame"); + SpawnThis(from, Selections, 220, 1, "SolenHive"); + SpawnThis(from, Selections, 221, 1, "TerathanKeep"); + SpawnThis(from, Selections, 224, 1, "TrinsicPassage"); + SpawnThis(from, Selections, 227, 1, "Wrong"); + //TOWNS + SpawnThis(from, Selections, 222, 1, "TownsLife"); + SpawnThis(from, Selections, 223, 1, "TownsPeople"); + SpawnThis(from, Selections, 225, 1, "Vendors"); + //OUTDOORS + SpawnThis(from, Selections, 226, 1, "WildLife"); + SpawnThis(from, Selections, 211, 1, "LostLands"); + SpawnThis(from, Selections, 213, 1, "Outdoors"); + SpawnThis(from, Selections, 229, 1, "Reagents"); + SpawnThis(from, Selections, 218, 1, "SeaLife"); + + //ILSHENAR + from.Say( "SPAWNING ILSHENAR..." ); + SpawnThis(from, Selections, 301, 3, "Ancientlair"); + SpawnThis(from, Selections, 302, 3, "Ankh"); + SpawnThis(from, Selections, 303, 3, "Blood"); + SpawnThis(from, Selections, 304, 3, "Exodus"); + SpawnThis(from, Selections, 305, 3, "Mushroom"); + SpawnThis(from, Selections, 306, 3, "Outdoors"); + SpawnThis(from, Selections, 307, 3, "Ratmancave"); + SpawnThis(from, Selections, 308, 3, "Rock"); + SpawnThis(from, Selections, 309, 3, "Sorcerers"); + SpawnThis(from, Selections, 310, 3, "Spectre"); + SpawnThis(from, Selections, 311, 3, "Towns"); + SpawnThis(from, Selections, 314, 3, "TwistedWeald"); + SpawnThis(from, Selections, 312, 3, "Vendors"); + SpawnThis(from, Selections, 313, 3, "Wisp"); + + //MALAS + from.Say( "SPAWNING MALAS..." ); + SpawnThis(from, Selections, 408, 4, "Bedlam"); + SpawnThis(from, Selections, 406, 4, "Citadel"); + SpawnThis(from, Selections, 401, 4, "Doom"); + SpawnThis(from, Selections, 407, 4, "Labyrinth"); + SpawnThis(from, Selections, 402, 4, "North"); + SpawnThis(from, Selections, 403, 4, "OrcForts"); + SpawnThis(from, Selections, 404, 4, "South"); + SpawnThis(from, Selections, 405, 4, "Vendors"); + + //TOKUNO + from.Say( "SPAWNING TOKUNO..." ); + SpawnThis(from, Selections, 501, 5, "FanDancersDojo"); + SpawnThis(from, Selections, 502, 5, "Outdoors"); + SpawnThis(from, Selections, 503, 5, "TownsLife"); + SpawnThis(from, Selections, 504, 5, "Vendors"); + SpawnThis(from, Selections, 505, 5, "WildLife"); + SpawnThis(from, Selections, 506, 5, "YomutsoMines"); + + from.Say( "SPAWN GENERATION COMPLETED" ); + } + break; + } + } + } + } +} \ No newline at end of file diff --git a/Scripts/Engines/Spawner/PremiumSpawner/SpawnsOverseer.cs b/Scripts/Engines/Spawner/PremiumSpawner/SpawnsOverseer.cs new file mode 100644 index 0000000..071109f --- /dev/null +++ b/Scripts/Engines/Spawner/PremiumSpawner/SpawnsOverseer.cs @@ -0,0 +1,369 @@ +/************************* + * By Nerun * + * Engine r103 * + ************************* + */ + +using System; +using System.IO; +using Server; +using Server.Mobiles; +using System.Collections.Generic; +using Server.Network; + +namespace Server.Items +{ + public class SpawnsOverseer : Item + { + private int m_Range; + private int m_InRangeDelay; + private int m_OutRangeDelay; + private int m_Overseeing; + private CheckTimer m_Timer; + private bool m_Enable; + private bool m_Gatekeeper; + private TimeSpan m_CurrentDelay; // players out dungeon + private DateTime m_End; + + [CommandProperty( AccessLevel.GameMaster )] + public bool Enable + { + get { return m_Enable; } + set + { + if ( value ) + Begin(); + + else + End(); + + InvalidateProperties(); + } + } + + [CommandProperty( AccessLevel.GameMaster )] + public bool Gatekeeper + { + get { return m_Gatekeeper; } + set { m_Gatekeeper = value; InvalidateProperties(); } + } + + [CommandProperty( AccessLevel.GameMaster )] + public int Range + { + get { return m_Range; } + set { m_Range = value; InvalidateProperties(); } + } + + [CommandProperty( AccessLevel.GameMaster )] + public TimeSpan CurrentDelay + { + get { return m_CurrentDelay; } + set { m_CurrentDelay = value; InvalidateProperties(); } + } + + [CommandProperty( AccessLevel.GameMaster )] + public TimeSpan NextDelay + { + get + { + if ( m_Enable ) + return m_End - DateTime.Now; + else + return TimeSpan.FromSeconds( 0 ); + } + set + { + Begin(); + DoTimer( value ); + } + } + + [CommandProperty( AccessLevel.GameMaster )] + public int InRangeDelay + { + get { return m_InRangeDelay; } + set { m_InRangeDelay = value; InvalidateProperties(); } + } + + [CommandProperty( AccessLevel.GameMaster )] + public int OutRangeDelay + { + get { return m_OutRangeDelay; } + set { m_OutRangeDelay = value; InvalidateProperties(); } + } + + [CommandProperty( AccessLevel.GameMaster )] + public int Overseeing + { + get { return m_Overseeing; } + set { m_Overseeing = value; InvalidateProperties(); } + } + + public void Begin() + { + if ( !m_Enable ) + { + m_Enable = true; + DoTimer(); + } + } + + public void End() + { + if ( m_Enable ) + { + m_Timer.Stop(); + m_Enable = false; + } + } + + public void Restart() + { + if ( m_Enable ) + { + m_Timer.Stop(); + DoTimer(); + } + } + + public void DoTimer() + { + if ( !m_Enable ) + return; + + int mSeconds = (int)m_CurrentDelay.TotalSeconds; + + TimeSpan delay = TimeSpan.FromSeconds( mSeconds ); + DoTimer( delay ); + } + + public void DoTimer( TimeSpan delay ) + { + if ( !m_Enable ) + return; + + if ( m_Timer != null ) + m_Timer.Stop(); + + m_End = DateTime.Now + delay; + + m_Timer = new CheckTimer( this, delay ); + m_Timer.Start(); + } + + [Constructable] + public SpawnsOverseer() : this( 20, 30, 5, 0 ) + { + } + + [Constructable] + public SpawnsOverseer( int startrange ) : this( startrange, 30, 5, 0 ) + { + } + + [Constructable] + public SpawnsOverseer( int startrange, int startIRD, int startORD, int startOverseeing ) : base( 0x1F1E ) + { + InitSeer( startrange, startIRD, startORD, startOverseeing ); + } + + private void InitSeer( int startrange, int startIRD, int startORD, int startOverseeing ) + { + Name = "Spawns' Overseer"; + Movable = false; + Light = LightType.Circle150; + Weight = 1; + Visible = false; + Enable = true; + Gatekeeper = false; + Range = startrange; + CurrentDelay = TimeSpan.FromSeconds( 5 ); + InRangeDelay = startIRD; //minutes + OutRangeDelay = startORD; //seconds + Overseeing = startOverseeing; //PremiumSpawners under control + } + + public override void GetProperties( ObjectPropertyList list ) + { + base.GetProperties( list ); + + if ( m_Enable ) + { + list.Add( 1060742 ); // active + + list.Add( 1060662, "Range\t{0}", Range.ToString() ); + list.Add( 1060663, "In Range Delay\t{0} min", InRangeDelay.ToString() ); + list.Add( 1060661, "Out Range Delay\t{0} sec", OutRangeDelay.ToString() ); + list.Add( 1060658, "Overseeing\t{0} PremiumSpawners", Overseeing.ToString() ); + } + else + { + list.Add( 1060743 ); // inactive + } + } + + private class CheckTimer : Timer + { + private SpawnsOverseer m_SpawnsOverseer; + + public CheckTimer( SpawnsOverseer Crystal, TimeSpan delay ) : base( delay, delay ) + { + Priority = TimerPriority.OneSecond; + + m_SpawnsOverseer = Crystal; + } + + protected override void OnTick() + { + if ( ( m_SpawnsOverseer != null ) && ( !m_SpawnsOverseer.Deleted ) ) + { + m_SpawnsOverseer.OnTickDoThis(); + } + + else + { + Stop(); + } + } + } + + public void OnTickDoThis() + { + + if ( this.Gatekeeper == false) // Gatekeeper mode OFF + { + List ClosePremiumSpawners = new List(); + + List ClosePlayers = new List(); + + List MobsCleaning = new List(); + + List ItemsCleaning = new List(); + + foreach ( Item item in this.GetItemsInRange( Range ) ) + { + if( item is PremiumSpawner ) + ClosePremiumSpawners.Add( item ); + } + + if ( ClosePremiumSpawners.Count > 0 ) + { + this.Overseeing = ClosePremiumSpawners.Count; + + foreach ( Mobile m in this.GetMobilesInRange( Range ) ) + { + if( m is PlayerMobile && m.AccessLevel == AccessLevel.Player || m is PlayerMobile && m.AccessLevel > AccessLevel.Player && m.Hidden == false ) // if player or GM not hidden + ClosePlayers.Add( m ); + } + + if ( ClosePlayers.Count > 0 ) // at least one player close + { + this.CurrentDelay = TimeSpan.FromMinutes( InRangeDelay ); // time to new check + Restart(); + + foreach ( Item pspawner in ClosePremiumSpawners ) // for each PremiumSpawner close (in the List) + { + if ( ((PremiumSpawner)pspawner).Running == false ) // if it is inactive + { + ((PremiumSpawner)pspawner).Running = true; // activate it! + ((PremiumSpawner)pspawner).NextSpawn = TimeSpan.FromSeconds( 1 ); // and do a total respawn of it! + } + } + } + + else if ( ClosePlayers.Count <= 0 ) // nobody close + { + this.CurrentDelay = TimeSpan.FromSeconds( OutRangeDelay ); // time to new check + Restart(); + + foreach ( Item pspawner in ClosePremiumSpawners ) // for each PremiumSpawner close (in the List) + { + if ( ((PremiumSpawner)pspawner).Running == true ) // if it is active + { + ((PremiumSpawner)pspawner).Running = false; // make inactive! + + // NOW delete items and mobiles (not only the spawned, but all movable in range) + + foreach ( Mobile mobdel in this.GetMobilesInRange( Range ) ) + { + if( mobdel is BaseCreature || mobdel is TownCrier ) + MobsCleaning.Add( mobdel ); + } + + if ( MobsCleaning.Count > 0 ) + { + foreach ( Mobile mDel in MobsCleaning ) + mDel.Delete(); + } + + foreach ( Item itemdel in this.GetItemsInRange( Range ) ) + { + if( itemdel.Movable == true ) //se for um item móvel (não decoração) + ItemsCleaning.Add( itemdel ); + } + + if ( ItemsCleaning.Count > 0 ) + { + foreach ( Item iDel in ItemsCleaning ) + iDel.Delete(); + } + } + } + } + } + + else if ( ClosePremiumSpawners.Count <= 0 ) // if SpawnsOverseer has no PremiumSpawner to seer, deactivate it + { + this.Enable = false; + this.CurrentDelay = TimeSpan.FromSeconds( OutRangeDelay ); + this.Overseeing = ClosePremiumSpawners.Count; + } + } + + else // Gatekeeper mode ON + { + + } + } + + public SpawnsOverseer( Serial serial ) : base( serial ) + { + } + + public override void Serialize( GenericWriter writer ) + { + base.Serialize( writer ); + + writer.Write( (int) 0 ); + + writer.Write( m_Range ); + writer.Write( m_InRangeDelay ); + writer.Write( m_OutRangeDelay ); + writer.Write( m_Overseeing ); + writer.Write( m_Gatekeeper ); + writer.Write( m_Enable ); + if ( m_Enable ) + writer.WriteDeltaTime( m_End ); + } + + public override void Deserialize( GenericReader reader ) + + { + base.Deserialize( reader ); + + int version = reader.ReadInt(); + + m_Range = reader.ReadInt(); + m_InRangeDelay = reader.ReadInt(); + m_OutRangeDelay = reader.ReadInt(); + m_Overseeing = reader.ReadInt(); + m_Gatekeeper = reader.ReadBool(); + m_Enable = reader.ReadBool(); + TimeSpan ts = TimeSpan.Zero; + if ( m_Enable ) + ts = reader.ReadDeltaTime() - DateTime.Now; + DoTimer( ts ); + } + } +} diff --git a/Scripts/Engines/Spawner/PremiumSpawner/SpawnsOverseerCommand.cs b/Scripts/Engines/Spawner/PremiumSpawner/SpawnsOverseerCommand.cs new file mode 100644 index 0000000..1bef0d4 --- /dev/null +++ b/Scripts/Engines/Spawner/PremiumSpawner/SpawnsOverseerCommand.cs @@ -0,0 +1,459 @@ +// Engine r117 +using System; +using System.IO; +using System.Collections; +using System.Collections.Generic; +using Server; +using Server.Items; +using Server.Mobiles; + +namespace Server.Commands +{ + public class GenOverseer + { + public static void Initialize() + { + CommandSystem.Register( "GenSeers", AccessLevel.Administrator, new CommandEventHandler( GenOverseer_OnCommand ) ); + CommandSystem.Register( "GenOverseers", AccessLevel.Administrator, new CommandEventHandler( GenOverseer_OnCommand ) ); + CommandSystem.Register( "GenSeer", AccessLevel.Administrator, new CommandEventHandler( GenOverseer_OnCommand ) ); + CommandSystem.Register( "GenOverseer", AccessLevel.Administrator, new CommandEventHandler( GenOverseer_OnCommand ) ); + } + + [Usage( "GenSeers" )] + [Aliases( "GenSeer, GenOverseer and GenOverseers" )] + [Description( "Generates Spawns' Overseers around the world." )] + private static void GenOverseer_OnCommand( CommandEventArgs e ) + { + m_Mobile = e.Mobile; + m_Count = 0; + + m_Mobile.SendMessage( "Generating Spawns' Overseers, please wait." ); + + Generate( "Data/Nerun's Distro/Spawns/overseers/trammel", Map.Trammel ); + Generate( "Data/Nerun's Distro/Spawns/overseers/felucca", Map.Felucca ); + Generate( "Data/Nerun's Distro/Spawns/overseers/ilshenar", Map.Ilshenar ); + Generate( "Data/Nerun's Distro/Spawns/overseers/malas", Map.Malas ); + Generate( "Data/Nerun's Distro/Spawns/overseers/tokuno", Map.Tokuno ); + Generate( "Data/Nerun's Distro/Spawns/overseers/termur", Map.TerMur ); + + m_Mobile.SendMessage( "Spawns' Overseers generation complete. {0} seers were generated.", m_Count ); + } + + public static void Generate( string folder, params Map[] maps ) + { + if ( !Directory.Exists( folder ) ) + return; + + string[] files = Directory.GetFiles( folder, "*.cfg" ); + + for ( int i = 0; i < files.Length; ++i ) + { + ArrayList list = DecorationListSeers.ReadAll( files[i] ); + + for ( int j = 0; j < list.Count; ++j ) + m_Count += ((DecorationListSeers)list[j]).Generate( maps ); + } + } + + private static Mobile m_Mobile; + private static int m_Count; + } + + public class DecorationListSeers + { + private Type m_Type; + private int m_ItemID; + private string[] m_Params; + private ArrayList m_Entries; + + public DecorationListSeers() + { + } + + private static Type typeofStatic = typeof( Static ); + private static Type typeofLocalizedStatic = typeof( LocalizedStatic ); + + public Item Construct() + { + Item item; + + try + { + if ( m_Type == typeofStatic ) + { + item = new Static( m_ItemID ); + } + else if ( m_Type == typeofLocalizedStatic ) + { + int labelNumber = 0; + + for ( int i = 0; i < m_Params.Length; ++i ) + { + if ( m_Params[i].StartsWith( "LabelNumber" ) ) + { + int indexOf = m_Params[i].IndexOf( '=' ); + + if ( indexOf >= 0 ) + { + labelNumber = Utility.ToInt32( m_Params[i].Substring( ++indexOf ) ); + break; + } + } + } + + item = new LocalizedStatic( m_ItemID, labelNumber ); + } + else + { + item = (Item)Activator.CreateInstance( m_Type ); + } + } + catch ( Exception e ) + { + throw new Exception( String.Format( "Bad type: {0}", m_Type ), e ); + } + + if ( item is Server.Items.SpawnsOverseer ) + { + Server.Items.SpawnsOverseer sp = (Server.Items.SpawnsOverseer)item; + + for ( int i = 0; i < m_Params.Length; ++i ) + { + if ( m_Params[i].StartsWith( "Range" ) ) + { + int indexOf = m_Params[i].IndexOf( '=' ); + + if ( indexOf >= 0 ) + sp.Range = Utility.ToInt32( m_Params[i].Substring( ++indexOf ) ); + } + else if ( m_Params[i].StartsWith( "InRangeDelay" ) ) + { + int indexOf = m_Params[i].IndexOf( '=' ); + + if ( indexOf >= 0 ) + sp.InRangeDelay = Utility.ToInt32( m_Params[i].Substring( ++indexOf ) ); + } + else if ( m_Params[i].StartsWith( "OutRangeDelay" ) ) + { + int indexOf = m_Params[i].IndexOf( '=' ); + + if ( indexOf >= 0 ) + sp.OutRangeDelay = Utility.ToInt32( m_Params[i].Substring( ++indexOf ) ); + } + } + } + + item.Movable = false; + + for ( int i = 0; i < m_Params.Length; ++i ) + { + if ( m_Params[i].StartsWith( "Light" ) ) + { + int indexOf = m_Params[i].IndexOf( '=' ); + + if ( indexOf >= 0 ) + item.Light = (LightType)Enum.Parse( typeof( LightType ), m_Params[i].Substring( ++indexOf ), true ); + } + else if ( m_Params[i].StartsWith( "Hue" ) ) + { + int indexOf = m_Params[i].IndexOf( '=' ); + + if ( indexOf >= 0 ) + { + int hue = Utility.ToInt32( m_Params[i].Substring( ++indexOf ) ); + + if ( item is DyeTub ) + ((DyeTub)item).DyedHue = hue; + else + item.Hue = hue; + } + } + else if ( m_Params[i].StartsWith( "Name" ) ) + { + int indexOf = m_Params[i].IndexOf( '=' ); + + if ( indexOf >= 0 ) + item.Name = m_Params[i].Substring( ++indexOf ); + } + else if ( m_Params[i].StartsWith( "Amount" ) ) + { + int indexOf = m_Params[i].IndexOf( '=' ); + + if ( indexOf >= 0 ) + { + // Must supress stackable warnings + + bool wasStackable = item.Stackable; + + item.Stackable = true; + item.Amount = Utility.ToInt32( m_Params[i].Substring( ++indexOf ) ); + item.Stackable = wasStackable; + } + } + } + + return item; + } + + private static Queue m_DeleteQueue = new Queue(); + + private static bool FindItem( int x, int y, int z, Map map, Item srcItem ) + { + int itemID = srcItem.ItemID; + + bool res = false; + + IPooledEnumerable eable; + + if ( (TileData.ItemTable[itemID & TileData.MaxItemValue].Flags & TileFlag.LightSource) != 0 ) + { + eable = map.GetItemsInRange( new Point3D( x, y, z ), 0 ); + + LightType lt = srcItem.Light; + string srcName = srcItem.ItemData.Name; + + foreach ( Item item in eable ) + { + if ( item.Z == z ) + { + if ( item.ItemID == itemID ) + { + if ( item.Light != lt ) + m_DeleteQueue.Enqueue( item ); + else + res = true; + } + else if ( (item.ItemData.Flags & TileFlag.LightSource) != 0 && item.ItemData.Name == srcName ) + { + m_DeleteQueue.Enqueue( item ); + } + } + } + } + else + { + eable = map.GetItemsInRange( new Point3D( x, y, z ), 0 ); + + foreach ( Item item in eable ) + { + if ( item.Z == z && item.ItemID == itemID ) + { + eable.Free(); + return true; + } + } + } + + eable.Free(); + + while ( m_DeleteQueue.Count > 0 ) + ((Item)m_DeleteQueue.Dequeue()).Delete(); + + return res; + } + + public int Generate( Map[] maps ) + { + int count = 0; + + Item item = null; + + for ( int i = 0; i < m_Entries.Count; ++i ) + { + DecorationEntrySeers entry = (DecorationEntrySeers)m_Entries[i]; + Point3D loc = entry.Location; + string extra = entry.Extra; + + for ( int j = 0; j < maps.Length; ++j ) + { + if ( item == null ) + item = Construct(); + + if ( item == null ) + continue; + + if ( FindItem( loc.X, loc.Y, loc.Z, maps[j], item ) ) + { + } + else + { + item.MoveToWorld( loc, maps[j] ); + ++count; + + item = null; + } + } + } + + if ( item != null ) + item.Delete(); + + return count; + } + + public static ArrayList ReadAll( string path ) + { + using ( StreamReader ip = new StreamReader( path ) ) + { + ArrayList list = new ArrayList(); + + for ( DecorationListSeers v = Read( ip ); v != null; v = Read( ip ) ) + list.Add( v ); + + return list; + } + } + + private static string[] m_EmptyParams = new string[0]; + + public static DecorationListSeers Read( StreamReader ip ) + { + string line; + + while ( (line = ip.ReadLine()) != null ) + { + line = line.Trim(); + + if ( line.Length > 0 && !line.StartsWith( "#" ) ) + break; + } + + if ( string.IsNullOrEmpty( line ) ) + return null; + + DecorationListSeers list = new DecorationListSeers(); + + int indexOf = line.IndexOf( ' ' ); + + list.m_Type = ScriptCompiler.FindTypeByName( line.Substring( 0, indexOf++ ), true ); + + if ( list.m_Type == null ) + throw new ArgumentException( String.Format( "Type not found for header: '{0}'", line ) ); + + line = line.Substring( indexOf ); + indexOf = line.IndexOf( '(' ); + if ( indexOf >= 0 ) + { + list.m_ItemID = Utility.ToInt32( line.Substring( 0, indexOf - 1 ) ); + + string parms = line.Substring( ++indexOf ); + + if ( line.EndsWith( ")" ) ) + parms = parms.Substring( 0, parms.Length - 1 ); + + list.m_Params = parms.Split( ';' ); + + for ( int i = 0; i < list.m_Params.Length; ++i ) + list.m_Params[i] = list.m_Params[i].Trim(); + } + else + { + list.m_ItemID = Utility.ToInt32( line ); + list.m_Params = m_EmptyParams; + } + + list.m_Entries = new ArrayList(); + + while ( (line = ip.ReadLine()) != null ) + { + line = line.Trim(); + + if ( line.Length == 0 ) + break; + + if ( line.StartsWith( "#" ) ) + continue; + + list.m_Entries.Add( new DecorationEntrySeers( line ) ); + } + + return list; + } + } + + public class DecorationEntrySeers + { + private Point3D m_Location; + private string m_Extra; + + public Point3D Location{ get{ return m_Location; } } + public string Extra{ get{ return m_Extra; } } + + public DecorationEntrySeers( string line ) + { + string x, y, z; + + Pop( out x, ref line ); + Pop( out y, ref line ); + Pop( out z, ref line ); + + m_Location = new Point3D( Utility.ToInt32( x ), Utility.ToInt32( y ), Utility.ToInt32( z ) ); + m_Extra = line; + } + + public void Pop( out string v, ref string line ) + { + int space = line.IndexOf( ' ' ); + + if ( space >= 0 ) + { + v = line.Substring( 0, space++ ); + line = line.Substring( space ); + } + else + { + v = line; + line = ""; + } + } + } + + public class RemOverseer + { + public static void Initialize() + { + CommandSystem.Register( "RemOverseers", AccessLevel.Administrator, new CommandEventHandler( RemOverseers_OnCommand ) ); + CommandSystem.Register( "RemSeers", AccessLevel.Administrator, new CommandEventHandler( RemOverseers_OnCommand ) ); + CommandSystem.Register( "RemOverseer", AccessLevel.Administrator, new CommandEventHandler( RemOverseers_OnCommand ) ); + CommandSystem.Register( "RemSeer", AccessLevel.Administrator, new CommandEventHandler( RemOverseers_OnCommand ) ); + } + + [Usage( "RemSeers" )] + [Aliases( "RemSeer, RemOverseer, RemOverseers" )] + [Description( "Remove all Overseers in all facets." )] + public static void RemOverseers_OnCommand( CommandEventArgs e ) + { + Mobile from = e.Mobile; + World.Broadcast( 0x35, true, "Overseers are being removed, please wait." ); + DateTime startTime = DateTime.Now; + int count = 0; + List itemsremove = new List(); + + foreach ( Item itemremove in World.Items.Values ) + { + if ( itemremove is SpawnsOverseer && itemremove.Parent == null ) + { + itemsremove.Add( itemremove ); + count +=1; + } + } + + foreach ( Item itemremove2 in itemsremove ) + { + itemremove2.Delete(); + } + + foreach ( Item premiums in World.Items.Values ) + { + if ( premiums is PremiumSpawner && premiums.Parent == null && ((PremiumSpawner)premiums).Running == false ) + { + ((PremiumSpawner)premiums).Running = true; + ((PremiumSpawner)premiums).NextSpawn = TimeSpan.FromSeconds( 1 ); + } + } + + DateTime endTime = DateTime.Now; + World.Broadcast( 0x35, true, "{0} Overseers has been removed in {1:F1} seconds.", count, (endTime - startTime).TotalSeconds ); + } + } +} diff --git a/Scripts/Gumps/AdminGump.cs b/Scripts/Gumps/AdminGump.cs index 17fc78d..7f83a00 100644 --- a/Scripts/Gumps/AdminGump.cs +++ b/Scripts/Gumps/AdminGump.cs @@ -370,7 +370,7 @@ namespace Server.Gumps AddButtonLabeled( 20, 175, GetButtonID( 3, 101 ), "Teleporters" ); AddButtonLabeled( 220, 175, GetButtonID( 3, 102 ), "Moongates" ); - AddButtonLabeled( 20, 200, GetButtonID( 3, 103 ), "Vendors" ); + AddButtonLabeled( 20, 200, GetButtonID( 3, 103 ), "--Empty--" ); AddButtonLabeled( 220, 200, GetButtonID( 3, 106 ), "Decoration" ); AddButtonLabeled( 20, 225, GetButtonID( 3, 104 ), "Doors" ); @@ -1763,7 +1763,7 @@ namespace Server.Gumps case 100: InvokeCommand( "DocGen" ); notice = "Documentation has been generated."; break; case 101: InvokeCommand( "TelGen" ); notice = "Teleporters have been generated."; break; case 102: InvokeCommand( "MoonGen" ); notice = "Moongates have been generated."; break; - case 103: InvokeCommand( "UOAMVendors" ); notice = "Vendor spawners have been generated."; break; + case 103: InvokeCommand( "" ); notice = "--Empty--."; break; case 104: InvokeCommand( "DoorGen" ); notice = "Doors have been generated."; break; case 105: InvokeCommand( "SignGen" ); notice = "Signs have been generated."; break; case 106: InvokeCommand( "Decorate" ); notice = "Decoration has been generated."; break; @@ -3048,4 +3048,4 @@ namespace Server.Gumps } } } -} \ No newline at end of file +} diff --git a/Scripts/Misc/uoamVendors.cs b/Scripts/Misc/uoamVendors.cs deleted file mode 100644 index d9ace08..0000000 --- a/Scripts/Misc/uoamVendors.cs +++ /dev/null @@ -1,353 +0,0 @@ -using System; -using System.Collections; -using System.IO; -using Server.Mobiles; -using Server.Items; -using Server.Commands; - -// Version 0.8 - -namespace Server -{ - public class UOAMVendorGenerator - { - private static int m_Count; - - //configuration - private const int NPCCount = 2;//2 npcs per type (so a mage spawner will spawn 2 npcs, a alchemist and herbalist spawner will spawn 4 npcs total) - private const int HomeRange = 5;//How far should they wander? - private const bool TotalRespawn = true;//Should we spawn them up right away? - private static TimeSpan MinTime = TimeSpan.FromMinutes( 2.5 );//min spawn time - private static TimeSpan MaxTime = TimeSpan.FromMinutes( 10.0 );//max spawn time - private const int Team = 0;//"team" the npcs are on - - public static void Initialize() - { - CommandSystem.Register( "UOAMVendors", AccessLevel.Administrator, new CommandEventHandler( Generate_OnCommand ) ); - } - - [Usage( "UOAMVendors" )] - [Description( "Generates vendor spawners from Data/Common.MAP (taken from UOAutoMap)" )] - private static void Generate_OnCommand( CommandEventArgs e ) - { - Parse( e.Mobile ); - } - - public static void Parse( Mobile from ) - { - string vendor_path = Path.Combine( Core.BaseDirectory, "Data/Common.map" ); - m_Count = 0; - - if ( File.Exists( vendor_path ) ) - { - ArrayList list = new ArrayList(); - from.SendMessage( "Generating Vendors..." ); - - using ( StreamReader ip = new StreamReader( vendor_path ) ) - { - string line; - - while ( (line = ip.ReadLine()) != null ) - { - int indexOf = line.IndexOf( ':' ); - - if ( indexOf == -1 ) - continue; - - string type = line.Substring( 0, ++indexOf ).Trim(); - string sub = line.Substring( indexOf ).Trim(); - - string[] split = sub.Split( ' ' ); - - if ( split.Length < 3 ) - continue; - - split = new string[]{ type, split[0], split[1], split[2] }; - - switch(split[0].ToLower()) - { - case "-healer:": - PlaceNPC( split[1], split[2], split[3], "Healer", "HealerGuildmaster" ); - break; - case "-baker:": - PlaceNPC( split[1], split[2], split[3], "Baker" ); - break; - case "-vet:": - PlaceNPC( split[1], split[2], split[3], "Veterinarian" ); - break; - case "-gypsymaiden:": - PlaceNPC( split[1], split[2], split[3], "GypsyMaiden" ); - break; - case "-gypsybank:": - PlaceNPC( split[1], split[2], split[3], "GypsyBanker" ); - break; - case "-bank:": - PlaceNPC( split[1], split[2], split[3], "Banker", "Minter" ); - break; - case "-inn:": - PlaceNPC( split[1], split[2], split[3], "Innkeeper" ); - break; - case "-provisioner:": - PlaceNPC( split[1], split[2], split[3], "Provisioner", "Cobbler" ); - break; - case "-tailor:": - PlaceNPC( split[1], split[2], split[3], "Tailor", "Weaver", "TailorGuildmaster" ); - break; - case "-tavern:": - PlaceNPC( split[1], split[2], split[3], "Tavernkeeper", "Waiter", "Cook", "Barkeeper" ); - break; - case "-reagents:": - PlaceNPC( split[1], split[2], split[3], "Herbalist", "Alchemist", "CustomHairstylist" ); - break; - case "-fortuneteller:": - PlaceNPC( split[1], split[2], split[3], "FortuneTeller" ); - break; - case "-holymage:": - PlaceNPC( split[1], split[2], split[3], "HolyMage" ); - break; - case "-chivalrykeeper:": - PlaceNPC( split[1], split[2], split[3], "KeeperOfChivalry" ); - break; - case "-mage:": - PlaceNPC( split[1], split[2], split[3], "Mage", "Alchemist", "MageGuildmaster" ); - break; - case "-arms:": - PlaceNPC( split[1], split[2], split[3], "Armorer", "Weaponsmith" ); - break; - case "-tinker:": - PlaceNPC( split[1], split[2], split[3], "Tinker", "TinkerGuildmaster" ); - break; - case "-gypsystable:": - PlaceNPC( split[1], split[2], split[3], "GypsyAnimalTrainer" ); - break; - case "-stable:": - PlaceNPC( split[1], split[2], split[3], "AnimalTrainer" ); - break; - case "-blacksmith:": - PlaceNPC( split[1], split[2], split[3], "Blacksmith", "BlacksmithGuildmaster" ); - break; - case "-bowyer:": - case "-fletcher:": - PlaceNPC( split[1], split[2], split[3], "Bowyer" ); - break; - case "-carpenter:": - PlaceNPC( split[1], split[2], split[3], "Carpenter", "Architect", "RealEstateBroker" ); - break; - case "-butcher:": - PlaceNPC( split[1], split[2], split[3], "Butcher" ); - break; - case "-jeweler:": - PlaceNPC( split[1], split[2], split[3], "Jeweler" ); - break; - case "-tanner:": - PlaceNPC( split[1], split[2], split[3], "Tanner", "Furtrader" ); - break; - case "-bard:": - PlaceNPC( split[1], split[2], split[3], "Bard", "BardGuildmaster" ); - break; - case "-market:": - PlaceNPC( split[1], split[2], split[3], "Butcher", "Farmer" ); - break; - case "-library:": - PlaceNPC( split[1], split[2], split[3], "Scribe" ); - break; - case "-shipwright:": - PlaceNPC( split[1], split[2], split[3], "Shipwright", "Mapmaker" ); - break; - case "-docks:": - PlaceNPC( split[1], split[2], split[3], "Fisherman" ); - break; - - case "-beekeeper:": - PlaceNPC( split[1], split[2], split[3], "Beekeeper" ); - break; - - - // Guilds & Misc - case "-tinkers guild:": - PlaceNPC( split[1], split[2], split[3], "TinkerGuildmaster" ); - break; - case "-blacksmiths guild:": - PlaceNPC( split[1], split[2], split[3], "BlacksmithGuildmaster" ); - break; - case "-sorcerors guild:": - PlaceNPC( split[1], split[2], split[3], "MageGuildmaster" ); - break; - case "-customs:": break; - case "-painter:": break; - case "-theater:": break; - case "-warriors guild:": - PlaceNPC( split[1], split[2], split[3], "WarriorGuildmaster" ); - break; - case "-archers guild:": - PlaceNPC( split[1], split[2], split[3], "RangerGuildmaster" ); - break; - case "-thieves guild:": - PlaceNPC( split[1], split[2], split[3], "ThiefGuildmaster" ); - break; - case "-miners guild:": - PlaceNPC( split[1], split[2], split[3], "MinerGuildmaster" ); - break; - case "-fishermans guild:": - PlaceNPC( split[1], split[2], split[3], "FisherGuildmaster" ); - break; - case "-merchants guild:": - PlaceNPC( split[1], split[2], split[3], "MerchantGuildmaster" ); - break; - case "-illusionists guild:": break; - case "-armourers guild:": break; - case "-sorcerers guild:": break; - case "-mages guild:": - PlaceNPC( split[1], split[2], split[3], "MageGuildmaster" ); - break; - case "-weapons guild:": break; - case "-bardic guild:": - PlaceNPC( split[1], split[2], split[3], "BardGuildmaster" ); - break; - case "-rogues guild:": - break; - - // Skip - case "+landmark:": - case "-point of interest:": - case "+shrine:": - case "+moongate:": - case "+dungeon:": - case "+scenic:": - case "-gate:": - case "+Body of Water:": - case "+ruins:": - case "+teleporter:": - case "+Terrain:": - case "-exit:": - case "-bridge:": - case "-other:": - case "+champion:": - case "-stairs:": - case "-guild:": - case "+graveyard:": - case "+Island:": - case "+town:": - break; - /*default: - Console.WriteLine(split[0]); - break;*/ - } - } - } - from.SendMessage( "Done, added {0} spawners",m_Count ); - } - else - { - from.SendMessage( "{0} not found!", vendor_path ); - } - } - - public static void PlaceNPC( string sx, string sy, string sm, params string[] types ) - { - if ( types.Length == 0 ) - return; - - int x = Utility.ToInt32( sx ); - int y = Utility.ToInt32( sy ); - int map = Utility.ToInt32( sm ); - - switch ( map ) - { - case 0://Trammel and Felucca - MakeSpawner( types, x, y, Map.Felucca ); - MakeSpawner( types, x, y, Map.Trammel ); - break; - case 1://Felucca - MakeSpawner( types, x, y, Map.Felucca ); - break; - case 2: - MakeSpawner( types, x, y, Map.Trammel ); - break; - case 3: - MakeSpawner( types, x, y, Map.Ilshenar ); - break; - case 4: - MakeSpawner( types, x, y, Map.Malas ); - break; - default: - Console.WriteLine( "UOAM Vendor Parser: Warning, unknown map {0}", map ); - break; - } - } - - public static int GetSpawnerZ( int x, int y, Map map ) - { - int z = map.GetAverageZ( x, y ); - - if ( map.CanFit( x, y, z, 16, false, false, true ) ) - return z; - - for ( int i = 1; i <= 20; ++i ) - { - if ( map.CanFit( x, y, z + i, 16, false, false, true ) ) - return z + i; - - if ( map.CanFit( x, y, z - i, 16, false, false, true ) ) - return z - i; - } - - return z; - } - - private static Queue m_ToDelete = new Queue(); - - public static void ClearSpawners( int x, int y, int z, Map map ) - { - IPooledEnumerable eable = map.GetItemsInRange( new Point3D( x, y, z ), 0 ); - - foreach ( Item item in eable ) - { - if ( item is Spawner && item.Z == z ) - m_ToDelete.Enqueue( item ); - } - - eable.Free(); - - while ( m_ToDelete.Count > 0 ) - ((Item)m_ToDelete.Dequeue()).Delete(); - } - - private static void MakeSpawner( string[] types, int x, int y, Map map ) - { - if ( types.Length == 0 ) - return; - - int z = GetSpawnerZ( x, y, map ); - - ClearSpawners( x, y, z, map ); - - for ( int i = 0; i < types.Length; ++i ) - { - bool isGuildmaster = ( types[i].EndsWith( "Guildmaster" ) ); - - Spawner sp = new Spawner( types[i] ); - - if ( isGuildmaster ) - sp.Count = 1; - else - sp.Count = NPCCount; - - sp.MinDelay = MinTime; - sp.MaxDelay = MaxTime; - sp.Team = Team; - sp.HomeRange = HomeRange; - - sp.MoveToWorld( new Point3D( x, y, z ), map ); - - if ( TotalRespawn ) - { - sp.Respawn(); - sp.BringToHome(); - } - - ++m_Count; - } - } - } -}