//change to use Enums.Direction public static void GetDungeonRoom(Client client, int dir) { //gets the room type from a table //dir: 1=up,2=down,3=left,4=right Enums.Direction direc; if (dir == 1) { direc = Enums.Direction.Up; } else if (dir == 2) { direc = Enums.Direction.Down; } else if (dir == 3) { direc = Enums.Direction.Left; } else { //dir = 4 direc = Enums.Direction.Right; } ChangeDungeonCoords(client, direc); int x = 0, y = 0; switch (dir) { case 1: { x = client.Player.X; if (x > 19) x = x - 14; //adjust for maze maps y = 12; } break; case 2: { x = client.Player.X; if (x > 19) x = x - 14; y = 2; } break; case 3: { x = 17; y = client.Player.Y; if (y > 14) y = y - 10; } break; case 4: { x = 2; y = client.Player.Y; if (y > 14) y = y - 10; } break; } if (client.Player.IsInParty()) { Server.Players.Parties.Party party = Server.Players.Parties.PartyManager.FindPlayerParty(client); foreach (Client member in party.GetOnlineMemberClients() ) { //check if they're in the same room if (client != member && exPlayer.Get(client).DungeonX == exPlayer.Get(member).DungeonX && exPlayer.Get(client).DungeonY == exPlayer.Get(member).DungeonY) { Messenger.PlayerWarp(client, member.Player.Map, x, y); return; } } } Room rtype = GetRoomType(client); int roomType; if (rtype == Room.One) roomType = 1; else if (rtype == Room.Two) roomType = 2; else if (rtype == Room.Three) roomType = 3; else if (rtype == Room.Four || rtype == Room.Heal) roomType = 4; else if (rtype == Room.Random) roomType = 5; else if (rtype == Room.Maze) roomType = 7; else if (rtype == Room.End) roomType = 6; else // rtype == Room.Error return; int smallType = roomType % 10; //explanation of roomTypes: normally # of openings //5 = random, 0 = preset/special //1, 2, 3, 4, 5 = not against an edge //6 = preset, not randomized //+10 is locked //+20 is against right edge //+40 is against left edge //+80 is against bottom edge //+160 is against top edge //modifiers stack, so +210 = top-right corner, locked int DungeonMaxX = exPlayer.Get(client).DungeonMaxX; int DungeonMaxY = exPlayer.Get(client).DungeonMaxY; int mapNum = 1; int rand; int[] one = new int[4] { 1549, 1547, 1548, 1550 }; int[] two = new int[6] { 1553, 1551, 1552, 1554, 1555, 1556 }; int[] three = new int[4] { 1557, 1560, 1558, 1559 }; int four = 1561; switch (smallType) { case 1: { // mapNum = one[dir - 1]; } break; case 2: { // rand = Server.Math.Rand(1, 4); switch (dir) { case 1: { mapNum = two[rand * 2 - 2]; } break; case 2: { if (rand == 1) { mapNum = two[rand]; } else { mapNum = two[rand + 1]; } } break; case 3: { if (rand == 3) { mapNum = two[rand + 2]; } else { mapNum = two[rand]; } } break; case 4: { if (rand == 1) { mapNum = two[rand - 1]; } else { mapNum = two[rand * 2 - 1]; } } break; } } break; case 3: { rand = Server.Math.Rand(1, 4); mapNum = three[(dir + rand) % 4]; } break; case 4: { // mapNum = four; } break; case 5: { //random rand = Server.Math.Rand(1, 11); switch (rand) { case 1: case 9: case 10: mapNum = one[dir - 1]; break; case 2: case 3: case 4: { rand = rand - 1; switch (dir) { case 1: { mapNum = two[rand * 2 - 2]; } break; case 2: { if (rand == 1) { mapNum = two[rand]; } else { mapNum = two[rand + 1]; } } break; case 3: { if (rand == 3) { mapNum = two[rand + 2]; } else { mapNum = two[rand]; } } break; case 4: { if (rand == 1) { mapNum = two[rand - 1]; } else { mapNum = two[rand * 2 - 1]; } } break; } } break; case 5: case 6: case 7: { rand = rand - 4; mapNum = three[(dir + rand) % 4]; } break; case 8: mapNum = four; break; } } break; case 6: { mapNum = 1562; } break; case 7: { mapNum = 1543; //maze map } break; } InstancedMap imap = new InstancedMap(MapManager.GenerateMapID("i")); if (mapNum == 1543) { GenerateMaze(client, direc); return; } MapCloner.CloneMapTiles(MapManager.RetrieveMap(mapNum), imap); //if (mapNum == 1562 /*&& exPlayer.Get(client).DungeonID == 20*/) { //replace the boss warps //imap.SetAttribute(9, 3, Enums.TileType.Scripted, 41, 0, 0, "Xatu", "", ""); //imap.SetAttribute(10, 3, Enums.TileType.Scripted, 41, 0, 0, "Xatu", "", ""); //} if (smallType != 6) { DecorateMap(client, imap); //SpawnNpcs(client, imap); //SpawnItems(client, imap); } Messenger.PlayerWarp(client, imap, x, y); if (smallType != 6) { SpawnItems(client, imap); SpawnNpcsBad(client, imap); UnlockRoom(client, imap); //will only unlock if no enemies } }
public void StartGame(Client client) { if (client == GameLeader) { InstancedMap map = new InstancedMap(MapManager.GenerateMapID("i")); IMap originalMap = MapManager.RetrieveMap(1945); map.MapBase = 1945; map.Moral = Enums.MapMoral.Safe; MapCloner.CloneMapTileProperties(originalMap, map); MapCloner.CloneMapTiles(originalMap, map); ArenaMap = map; bool swapSides = false; foreach (Client playerClient in BlueTeam) { Messenger.PlayerMsg(playerClient, "You are on the Blue Team", Text.Yellow); int x; int y; if (swapSides) { x = BLUEX2; y = BLUEY2; } else { x = BLUEX1; y = BLUEY1; } swapSides = !swapSides; RemoveSnowballs(playerClient); playerClient.Player.GiveItem(446, 999); Messenger.PlayerMsg(playerClient, "You were given 999 snowballs! Use them well!", Text.BrightBlue); playerClient.Player.Status = PLAYERLIVES + " Lives";; Messenger.SendPlayerData(playerClient); Messenger.PlayerWarp(playerClient, map, x, y); } swapSides = false; foreach (Client playerClient in GreenTeam) { Messenger.PlayerMsg(playerClient, "You are on the Green Team", Text.Yellow); int x; int y; if (swapSides) { x = GREENX2; y = GREENY2; } else { x = GREENX1; y = GREENY1; } swapSides = !swapSides; RemoveSnowballs(playerClient); playerClient.Player.GiveItem(446, 999); Messenger.PlayerMsg(playerClient, "You were given 999 snowballs! Use them well!", Text.BrightGreen); playerClient.Player.Status = PLAYERLIVES + " Lives";; Messenger.SendPlayerData(playerClient); Messenger.PlayerWarp(playerClient, map, x, y); } } }
public void WarpToHub(Client client) { if (hubMap == null) { hubMap = MapCloner.CreateInstancedMap(MapManager.RetrieveMap(hub.MapID)); } Messenger.PlayerWarp(client, hubMap, hub.X, hub.Y); }
public static void GenerateMaze(Client client, Server.Enums.Direction dir) { //generates a brand-new maze map for the player and sends it as their current map //warning: code copy-pasted (and revised) from C++, so it won't be neat int x; int y; int r; int[] order = new int[4]; InstancedMap imap = new InstancedMap(MapManager.GenerateMapID("i")); MapCloner.CloneMapTiles(MapManager.RetrieveMap(1543), imap); //Server.Enums.TileType[,] maze = new Server.Enums.TileType[47,35]; int[,] cells = new int[22,16]; for(int i = 2; i < 45; i++) { //initialize map for (int j = 2; j < 33; j++) { //maze[i,j] = Server.Enums.TileType.Blocked; imap.SetAttribute(i, j, Server.Enums.TileType.Blocked, 0, 0, 0, "", "", ""); imap.SetTile(i, j, 446, 9, 1); } } for(int i = 0; i < 22; i++) { //initialize cells used for prim's algorithm for (int j = 0; j < 16; j++) { cells[i,j] = 0; } } List<int> list1 = new List<int>(); x = Server.Math.Rand(1,22); y = Server.Math.Rand(1,16); cells[x,y] = 2; //maze[2*(x+1),2*(y+1)] = Server.Enums.TileType.Walkable; imap.SetAttribute(2*(x+1), 2*(y+1), Server.Enums.TileType.Walkable, 0, 0, 0, "", "", ""); imap.SetTile(2*(x+1), 2*(y+1), 0, 0, 1); order = GenerateOrder(); for (int i = 0; i < 4; i++) { switch(order[i]) { case 1: //up if (y > 0) { cells[x,y-1] = 1; list1.Add(x + 22*(y-1)); } break; case 2: //right if (x < 21) { cells[x+1,y] = 1; list1.Add(x+1 + 22*y); } break; case 3: //down if (y < 15) { cells[x,y+1] = 1; list1.Add(x + 22*(y+1)); } break; case 4: //left if (x > 0) { cells[x-1,y] = 1; list1.Add(x-1 + 22*y); } break; } } while(list1.Count > 0) { //Messenger.PlayerMsg(client, list1.Count.ToString(), Text.Black); if (Server.Math.Rand(1,3) > 1) { //take random item from list r = Server.Math.Rand(0, list1.Count); x = list1[r]; list1.RemoveAt(r); } else { //take last element x = list1.Last(); list1.RemoveAt(list1.Count-1); } y = x / 22; x = x % 22; //attach it to random neighbor and add neighbors to queue in random order order = GenerateOrder(); for(int i = 0; i < 4; i++) { switch(order[i]) { case 1: //up if (y > 0) { if (cells[x,y-1] == 0) { //add to queue cells[x,y-1] = 1; list1.Add(x + 22*(y-1)); } else if (cells[x,y-1] == 2 && cells[x,y] == 1) { //attach cells[x,y] = 2; //maze[2*(x+1),2*(y+1)-1] = Server.Enums.TileType.Walkable; //maze[2*(x+1),2*(y+1)] = Server.Enums.TileType.Walkable; imap.SetAttribute(2*(x+1), 2*(y+1)-1, Server.Enums.TileType.Walkable, 0, 0, 0, "", "", ""); imap.SetTile(2*(x+1), 2*(y+1)-1, 0, 0, 1); imap.SetAttribute(2*(x+1), 2*(y+1), Server.Enums.TileType.Walkable, 0, 0, 0, "", "", ""); imap.SetTile(2*(x+1), 2*(y+1), 0, 0, 1); } } break; case 2: //right if (x < 21) { if (cells[x+1,y] == 0) { //add to queue cells[x+1,y] = 1; list1.Add(x+1 + 22*y); } else if (cells[x+1,y] == 2 && cells[x,y] == 1) { //attach cells[x,y] = 2; //maze[2*(x+1)+1,2*(y+1)] = Server.Enums.TileType.Walkable; //maze[2*(x+1),2*(y+1)] = Server.Enums.TileType.Walkable; imap.SetAttribute(2*(x+1)+1, 2*(y+1), Server.Enums.TileType.Walkable, 0, 0, 0, "", "", ""); imap.SetTile(2*(x+1)+1, 2*(y+1), 0, 0, 1); imap.SetAttribute(2*(x+1), 2*(y+1), Server.Enums.TileType.Walkable, 0, 0, 0, "", "", ""); imap.SetTile(2*(x+1), 2*(y+1), 0, 0, 1); } } break; case 3: //down if (y < 15) { if (cells[x,y+1] == 0) { //add to queue cells[x,y+1] = 1; list1.Add(x + 22*(y+1)); } else if (cells[x,y+1] == 2 && cells[x,y] == 1) { //attach cells[x,y] = 2; //maze[2*(x+1),2*(y+1)+1] = Server.Enums.TileType.Walkable; //maze[2*(x+1),2*(y+1)] = Server.Enums.TileType.Walkable; imap.SetAttribute(2*(x+1), 2*(y+1)+1, Server.Enums.TileType.Walkable, 0, 0, 0, "", "", ""); imap.SetTile(2*(x+1), 2*(y+1)+1, 0, 0, 1); imap.SetAttribute(2*(x+1), 2*(y+1), Server.Enums.TileType.Walkable, 0, 0, 0, "", "", ""); imap.SetTile(2*(x+1), 2*(y+1), 0, 0, 1); } } break; case 4: //left if (x > 0) { if (cells[x-1,y] == 0) { //add to queue cells[x-1,y] = 1; list1.Add(x-1 + 22*y); } else if (cells[x-1,y] == 2 && cells[x,y] == 1) { //attach cells[x,y] = 2; //maze[2*(x+1)-1,2*(y+1)] = Server.Enums.TileType.Walkable; //maze[2*(x+1),2*(y+1)] = Server.Enums.TileType.Walkable; imap.SetAttribute(2*(x+1)-1, 2*(y+1), Server.Enums.TileType.Walkable, 0, 0, 0, "", "", ""); imap.SetTile(2*(x+1)-1, 2*(y+1), 0, 0, 1); imap.SetAttribute(2*(x+1), 2*(y+1), Server.Enums.TileType.Walkable, 0, 0, 0, "", "", ""); imap.SetTile(2*(x+1), 2*(y+1), 0, 0, 1); } } break; } } } imap.SetTile(23, 32, 0, 0, 1); imap.SetAttribute(23, 32, Server.Enums.TileType.Walkable, 0, 0, 0, "", "", ""); imap.SetTile(23, 2, 0, 0, 1); imap.SetAttribute(23, 32, Server.Enums.TileType.Walkable, 0, 0, 0, "", "", ""); imap.SetTile(2, 17, 0, 0, 1); imap.SetAttribute(23, 32, Server.Enums.TileType.Walkable, 0, 0, 0, "", "", ""); imap.SetTile(44, 17, 0, 0, 1); imap.SetAttribute(44, 17, Server.Enums.TileType.Walkable, 0, 0, 0, "", "", ""); DecorateMap(client, imap); //make decoratemap use map's max x/y? //warp player to maze if (dir == Server.Enums.Direction.Up) { x = client.Player.X + 14; if (x > 24) x = 24; y = 32; } else if (dir == Server.Enums.Direction.Down) { x = client.Player.X + 14; if (x > 24) x = 24; y = 2; } else if (dir == Server.Enums.Direction.Left) { x = 44; y = client.Player.Y + 10; } else { //dir == Server.Enums.Direction.Right x = 2; y = client.Player.Y + 10; } Messenger.PlayerWarp(client, imap, x, y); }
public static void StoryScript(Client client, int scriptNum, string param1, string param2, string param3, bool paused) { // Called when a script from a story is run try { switch (scriptNum) { case 0: { Messenger.SendPlayerData(client); } break; case 1: { if (client.Player.Map.MapType != Enums.MapType.Instanced) return; InstancedMap map = client.Player.Map as InstancedMap; MapNpcPreset npc = new MapNpcPreset(); string[] loc = param1.Split(':'); string[] lvl = param3.Split(':'); npc.SpawnX = loc[0].ToInt(); npc.SpawnY = loc[1].ToInt(); npc.NpcNum = param2.ToInt(); npc.MinLevel = lvl[0].ToInt(); // TODO: Adjust npc level npc.MaxLevel = lvl[1].ToInt(); // TODO: Adjust npc level //Messenger.AdminMsg(npc.SpawnX+"/"+npc.SpawnY+"/"+npc.NpcNum+"/"+npc.MinLevel+"/"+npc.MaxLevel, Text.Pink); map.SpawnNpc(npc); } break; case 2: { if (client.Player.Map.MapType != Enums.MapType.Instanced) return; InstancedMap map = client.Player.Map as InstancedMap; string[] loc = param1.Split(':'); map.SetTile(loc[0].ToInt(), loc[1].ToInt(), 3, 4, 3); map.SetAttribute(loc[0].ToInt(), loc[1].ToInt(), Enums.TileType.Scripted, 46, 0, 0, param2, "-1", ""); Messenger.SendTile(loc[0].ToInt(), loc[1].ToInt(), map); } break; case 3: { if (client.Player.Map.MapType != Enums.MapType.Instanced) return; InstancedMap map = client.Player.Map as InstancedMap; string[] loc = param1.Split(':'); string[] dest = param2.Split(':'); map.SetTile(loc[0].ToInt(), loc[1].ToInt(), 3, 4, 3); map.SetAttribute(loc[0].ToInt(), loc[1].ToInt(), Enums.TileType.Warp, dest[0].ToInt(), dest[1].ToInt(), dest[2].ToInt(), "", "", ""); Messenger.SendTile(loc[0].ToInt(), loc[1].ToInt(), map); } break; case 4: { IMap map = client.Player.Map; map.Npc[1].SpawnX = 9; map.Npc[1].SpawnY = 7; map.Npc[2].SpawnX = 6; map.Npc[2].SpawnY = 11; map.Npc[3].SpawnX = 13; map.Npc[3].SpawnY = 11; map.Npc[1].NpcNum = 306; map.Npc[2].NpcNum = 259; map.Npc[3].NpcNum = 259; //map.SetNpc(0, 500); //map.SetNpc(1, 500); //map.SetNpc(2, 500); for (int i = 1; i <= 3; i++) { //map.SpawnNpc(i); } } break; case 5: { //sound Messenger.PlaySoundToMap(client.Player.Map.MapID, param1); } break; case 6: { IMap map = client.Player.Map; map.Npc[1].SpawnX = 9; map.Npc[1].SpawnY = 3; map.Npc[1].NpcNum = 337; //map.SpawnNpc(1); } break; case 7: {// Luxio Tribe Battle // 167 - Luxio // 177 - Luxray // 5 luxio, 1 luxray IMap map = client.Player.Map; map.Npc[1].SpawnX = 10; map.Npc[1].SpawnY = 5; map.Npc[2].SpawnX = 7; map.Npc[2].SpawnY = 6; map.Npc[3].SpawnX = 12; map.Npc[3].SpawnY = 6; map.Npc[4].SpawnX = 7; map.Npc[4].SpawnY = 8; map.Npc[5].SpawnX = 12; map.Npc[5].SpawnY = 8; map.Npc[6].SpawnX = 12; map.Npc[6].SpawnY = 9; map.Npc[7].SpawnX = 10; map.Npc[7].SpawnY = 7; map.Npc[1].NpcNum = 177; for (int i = 2; i <= 7; i++) { map.Npc[i].NpcNum = 167; } for (int i = 1; i <= 7; i++) { //map.SpawnNpc(i); } } break; case 8: { client.Player.GiveItem(159, 1); } break; case 9: { client.Player.SetStoryState(157, false); } break; case 10: {//Start Registeel Battle: First wave of bronzongs BossBattles.StartBossWave(client, "Registeel", 1); } break; case 11: {//Registeel Battle: second wave of bronzongs BossBattles.StartBossWave(client, "Registeel", 2); } break; case 12: {//Registeel Battle: Registeel itself BossBattles.StartBossWave(client, "Registeel", 3); } break; case 13: {//leaving Forlorn Tower by fee int amount = client.Player.HasItem(1); if (amount > 0) { client.Player.TakeItem(1, (amount / 2)); } Messenger.PlayerWarp(client, 684, 13, 20); } break; case 14: { if (exPlayer.Get(client).StoryEnabled) { int currentSection = client.Player.StoryHelper.ReadSetting("[MainStory]-CurrentSection").ToInt(); client.Player.StoryHelper.SaveSetting("[MainStory]-CurrentSection", (currentSection + 1).ToString()); } } break; case 15: {//murkrows attack (wave 1) IMap map = client.Player.Map; map.SetAttribute(7, 10, Enums.TileType.Scripted, 3, 0, 0, "", "", ""); map.SetAttribute(13, 10, Enums.TileType.Scripted, 3, 0, 0, "", "", ""); map.SetAttribute(7, 14, Enums.TileType.Scripted, 3, 0, 0, "", "", ""); map.SetAttribute(13, 14, Enums.TileType.Scripted, 3, 0, 0, "", "", ""); map.SetAttribute(4, 18, Enums.TileType.Scripted, 3, 0, 0, "", "", ""); map.SetAttribute(16, 18, Enums.TileType.Scripted, 3, 0, 0, "", "", ""); map.SetAttribute(4, 8, Enums.TileType.Scripted, 3, 0, 0, "", "", ""); map.SetAttribute(16, 8, Enums.TileType.Scripted, 3, 0, 0, "", "", ""); map.SetNpcSpawnPoint(1, 3, 10); map.SetNpcSpawnPoint(2, 4, 11); map.SetNpcSpawnPoint(3, 6, 10); map.SetNpcSpawnPoint(4, 7, 11); map.SetNpcSpawnPoint(5, 8, 10); map.SetNpcSpawnPoint(6, 9, 11); map.SetNpcSpawnPoint(7, 10, 10); map.SetNpcSpawnPoint(8, 11, 11); map.SetNpcSpawnPoint(9, 12, 10); map.SetNpcSpawnPoint(10, 13, 11); map.SetNpcSpawnPoint(11, 14, 10); map.SetNpcSpawnPoint(12, 16, 11); map.SetNpcSpawnPoint(13, 17, 10); for (int i = 1; i <= 13; i++) { map.Npc[i].NpcNum = 224; } //map.SpawnNpc(1); //map.SpawnNpc(2); //map.SpawnNpc(3); //map.SpawnNpc(4); //map.SpawnNpc(5); //map.SpawnNpc(6); //map.SpawnNpc(7); //map.SpawnNpc(8); //map.SpawnNpc(9); //map.SpawnNpc(10); //map.SpawnNpc(11); //map.SpawnNpc(12); //map.SpawnNpc(13); } break; case 16: {//murkrows attack (ambush) IMap map = client.Player.Map; map.SetAttribute(7, 10, Enums.TileType.Scripted, 3, 0, 0, "", "", ""); map.SetAttribute(13, 10, Enums.TileType.Scripted, 3, 0, 0, "", "", ""); map.SetAttribute(7, 14, Enums.TileType.Scripted, 3, 0, 0, "", "", ""); map.SetAttribute(13, 14, Enums.TileType.Scripted, 3, 0, 0, "", "", ""); map.SetAttribute(4, 18, Enums.TileType.Scripted, 3, 0, 0, "", "", ""); map.SetAttribute(16, 18, Enums.TileType.Scripted, 3, 0, 0, "", "", ""); map.SetAttribute(4, 8, Enums.TileType.Scripted, 3, 0, 0, "", "", ""); map.SetAttribute(16, 8, Enums.TileType.Scripted, 3, 0, 0, "", "", ""); map.SetNpcSpawnPoint(1, 9, 7); map.SetNpcSpawnPoint(2, 10, 7); map.SetNpcSpawnPoint(3, 11, 7); map.SetNpcSpawnPoint(4, 9, 8); map.SetNpcSpawnPoint(5, 11, 8); map.SetNpcSpawnPoint(6, 9, 9); map.SetNpcSpawnPoint(7, 10, 9); map.SetNpcSpawnPoint(8, 11, 9); map.SetNpcSpawnPoint(9, 8, 8); map.SetNpcSpawnPoint(10, 8, 9); map.SetNpcSpawnPoint(11, 12, 8); map.SetNpcSpawnPoint(12, 12, 9); map.SetNpcSpawnPoint(13, 10, 10); for (int i = 1; i <= 13; i++) { map.Npc[i].NpcNum = 220; } //map.SpawnNpc(1); //map.SpawnNpc(2); //map.SpawnNpc(3); //map.SpawnNpc(4); //map.SpawnNpc(5); //map.SpawnNpc(6); //map.SpawnNpc(7); //map.SpawnNpc(8); //map.SpawnNpc(9); //map.SpawnNpc(10); //map.SpawnNpc(11); //map.SpawnNpc(12); //map.SpawnNpc(13); if (client.Player.GetActiveRecruit().HeldItem.Num != 142) { Messenger.BattleMsg(client, "There was a trap underneath!", Text.BrightRed); Messenger.BattleMsg(client, "The trap exploded!", Text.BrightRed); //Messenger.SpellAnim(497, client.Player.MapID, client.Player.X, client.Player.Y); //DamagePlayer(client, Convert.ToInt32((client.Player.GetActiveRecruit().HP + 0.5) / 2), Enums.KillType.Npc); Messenger.PlaySoundToMap(client.Player.MapID, "magic64.wav"); Messenger.BattleMsg(client, "The trap drained all your PP!", Text.BrightRed); //Messenger.SpellAnim(493, client.Player.MapID, client.Player.X, client.Player.Y); for (int i = 0; i < client.Player.GetActiveRecruit().Moves.Length; i++) { client.Player.GetActiveRecruit().Moves[i].CurrentPP = 0; //Messenger.SendMovePPUpdate(client, i); } Messenger.PlaySound(client, "PP Zero.wav"); Messenger.BattleMsg(client, "Poison spikes shot out!", Text.BrightRed); //Messenger.SpellAnim(496, client.Player.MapID, client.Player.X, client.Player.Y); Messenger.PlaySoundToMap(client.Player.MapID, "magic23.wav"); SetStatusAilment(client.Player.GetActiveRecruit(), client.Player.Map, Enums.StatusAilment.Poison, 1, null); Messenger.BattleMsg(client, "Mud splashed up from the ground!", Text.BrightRed); //Messenger.SpellAnim(495, client.Player.MapID, client.Player.X, client.Player.Y); Messenger.PlaySoundToMap(client.Player.MapID, "magic65.wav"); switch (Server.Math.Rand(0, 4)) { case 0: { client.Player.GetActiveRecruit().AttackBuff = 0; } break; case 1: { client.Player.GetActiveRecruit().DefenseBuff = 0; } break; case 2: { client.Player.GetActiveRecruit().SpAtkBuff = 0; } break; case 3: { client.Player.GetActiveRecruit().SpeedBuff = 0; } break; } //Messenger.SpellAnim(494, client.Player.MapID, client.Player.X, client.Player.Y); //Grimy(client); Messenger.PlaySoundToMap(client.Player.MapID, "Magic65.wav"); //PlayerInvDrop(client); Messenger.MapMsg(client.Player.MapID, client.Player.Name + " tripped!", Text.BrightRed); Messenger.PlaySoundToMap(client.Player.MapID, "magic55.wav"); Messenger.BattleMsg(client, "You were pelted with chestnuts!", Text.BrightRed); //DamagePlayer(client, 50, Enums.KillType.Npc); Messenger.PlaySoundToMap(client.Player.MapID, "pain.wav"); Messenger.BattleMsg(client, "The trap broke down...", Text.Black); } } break; case 17: {//murkrows and honchkrow attack IMap map = client.Player.Map; map.SetNpcSpawnPoint(1, 6, 9); map.SetNpcSpawnPoint(2, 14, 9); map.SetNpcSpawnPoint(3, 6, 11); map.SetNpcSpawnPoint(4, 14, 11); map.SetNpcSpawnPoint(5, 5, 13); map.SetNpcSpawnPoint(6, 15, 13); map.SetNpcSpawnPoint(7, 6, 15); map.SetNpcSpawnPoint(8, 14, 15); map.SetNpcSpawnPoint(9, 8, 14); map.SetNpcSpawnPoint(10, 12, 14); map.SetNpcSpawnPoint(11, 6, 18); map.SetNpcSpawnPoint(12, 14, 18); map.SetNpcSpawnPoint(13, 10, 16); map.SetNpcSpawnPoint(14, 10, 7); map.SetNpc(1, 220); map.SetNpc(2, 220); map.SetNpc(3, 220); map.SetNpc(4, 220); map.SetNpc(5, 220); map.SetNpc(6, 220); map.SetNpc(7, 220); map.SetNpc(8, 220); map.SetNpc(9, 220); map.SetNpc(10, 220); map.SetNpc(11, 220); map.SetNpc(12, 220); map.SetNpc(13, 220); map.SetNpc(14, 221); //map.SpawnNpc(1); //map.SpawnNpc(2); //map.SpawnNpc(3); //map.SpawnNpc(4); //map.SpawnNpc(5); //map.SpawnNpc(6); //map.SpawnNpc(7); //map.SpawnNpc(8); //map.SpawnNpc(9); //map.SpawnNpc(10); //map.SpawnNpc(11); //map.SpawnNpc(12); //map.SpawnNpc(13); //map.SpawnNpc(14); } break; case 18: {//honchkrow defeated, warp opens. IMap map = client.Player.Map; map.SetTile(10, 6, 96, 4, 3); map.SetTile(10, 5, 112576, 9, 3); map.SetTile(10, 4, 112128, 9, 3); // Left old code in case I did the math wrong... //map.SetTile(10, 5, 128, 8032, 9, 3); //map.SetTile(10, 4, 128, 8000, 9, 3); map.SetAttribute(10, 6, Enums.TileType.Scripted, 46, 0, 0, "16", "683", "9:16"); Messenger.SendTile(10, 4, map); Messenger.SendTile(10, 5, map); Messenger.SendTile(10, 6, map); } break; case 19: {//daniel's fireplace question if (client.Player.GetActiveRecruit().HasMove(452)) { Messenger.AskQuestion(client, "Fireplace", "Will you use Rock Smash on the fireplace?", -1); } } break; case 20: {//go into abandoned mansion Messenger.AskQuestion(client, "AbandonedMansion2", "Only the team leader may enter this dungeon, is that OK?", -1); } break; case 21: {//vs. gengar IMap map = client.Player.Map; if (map.MapType != Enums.MapType.Instanced) { client.CloseConnection(); return; } map.SetNpcSpawnPoint(1, 11, 6); map.SetNpcSpawnPoint(2, 12, 8); map.SetNpcSpawnPoint(3, 14, 8); map.SetNpc(1, 804); map.SetNpc(2, 809); map.SetNpc(3, 812); //map.SpawnNpc(1); //map.SpawnNpc(2); //map.SpawnNpc(3); } break; case 22: {//vs. Rotom IMap map = client.Player.Map; if (map.Name == "West Wing End") { InstancedMap mapa = new InstancedMap(MapManager.GenerateMapID("i")); MapCloner.CloneMapTiles(MapManager.RetrieveMap(825), mapa); Messenger.PlayerWarp(client, mapa, 9, 10); mapa.SetNpcSpawnPoint(1, 9, 3); mapa.SetNpc(1, 806); //mapa.SpawnNpc(1); } else if (map.Name == "East Wing End") { InstancedMap mapa = new InstancedMap(MapManager.GenerateMapID("i")); MapCloner.CloneMapTiles(MapManager.RetrieveMap(826), mapa); Messenger.PlayerWarp(client, mapa, 10, 10); mapa.SetNpcSpawnPoint(1, 10, 3); mapa.SetNpc(1, 807); //mapa.SpawnNpc(1); } } break; case 23: {//go into Hallowed Well Messenger.AskQuestion(client, "HallowedWell2", "Only the team leader may enter this dungeon, and no Pokémon may be recruited. Is that OK?", -1); } break; case 24: {//spiritomb battle client.Player.TakeItem(251, 1); IMap map = client.Player.Map; map.SetNpcSpawnPoint(1, 9, 8); map.SetNpc(1, 805); //map.SpawnNpc(1); } break; case 25: {//spiritomb joins // Fixed, uncomment when needed // TODO: Spritomb joins //client.Player.AddToRecruitmentBank(37, 209, 40, (ulong)1, 1, 0, 0, 40, 55, 10, 40, 1, 805, "Spiritomb"); Messenger.PlaySoundToMap(client.Player.MapID, "JoinGame.wav"); } break; case 26: {//learn wish client.Player.GetActiveRecruit().LearnNewMove(268); } break; case 27: {//vs. Articuno* IMap map = client.Player.Map; map.SetNpc(1, 440); map.SetNpcSpawnPoint(1, 12, 11); //map.SpawnNpc(1); } break; case 28: {//Give Natural Gift Messenger.PlayerMsg(client, "You were given a Natural Gift!", Text.Yellow); client.Player.GiveItem(232, 1); } break; case 29: {//Give Holly Present Messenger.PlayerMsg(client, "You were given a Holly Present!", Text.Yellow); client.Player.GiveItem(233, 1); } break; case 30: {//Give Mystery Gift Messenger.PlayerMsg(client, "You were given a Mystery Gift!", Text.Yellow); client.Player.GiveItem(234, 1); } break; case 31: {//Give PMDCP Present Messenger.PlayerMsg(client, "You were given a PMDCP Present!", Text.Yellow); client.Player.GiveItem(231, 1); } break; case 32: {//take white herb Messenger.PlayerMsg(client, "You gave away some Candy Canes.", Text.Yellow); client.Player.TakeItem(212, 12); } break; case 33: {//take soft string Messenger.PlayerMsg(client, "You gave away some Soft String.", Text.Yellow); client.Player.TakeItem(208, 20); } break; case 34: {//take soft snow Messenger.PlayerMsg(client, "You gave away some Soft Snow.", Text.Yellow); client.Player.TakeItem(209, 50); } break; case 35: {//Take ornaments client.Player.GiveItem(174, 1); Messenger.PlayerMsg(client, "You obtained a Shell Bell!", Text.Yellow); } break; case 36: {//vs. Heatran IMap map = client.Player.Map; map.SetNpc(1, 404); map.SetNpcSpawnPoint(1, 12, 11); //map.SpawnNpc(1); } break; case 37: {//vs. Xatu BossBattles.RunPostIntroStoryBossBattle(client, "Pitch-Black Pit"); } break; case 38: { BossBattles.RunPostIntroStoryBossBattle(client, "TinyGrotto"); } break; case 39: { BossBattles.RunBossBattleCleanup(client, client.Player.Map.Name); } break; case 40: { client.Player.GiveItem(779, 1, ""); } break; case 41: { // Post intro boss battle for Seaside Cavern BossBattles.RunPostIntroStoryBossBattle(client, "SeasideCavern"); } break; case 42: { // enter dungeon (random) DungeonRules.StartRDungeon(client, param1, param2, param3); } break; case 43: { BossBattles.StartBossWave(client, "ElectrostasisTowerA1", 1); } break; case 44: { BossBattles.RunBossBattleCleanup(client, "ElectrostasisTowerA1"); } break; case 45: { BossBattles.RunPostIntroStoryBossBattle(client, "ElectrostasisTowerA2"); } break; case 46: { //battle fossil & battle egg int npcNum = -1; switch (param1.ToInt()) { case 138: //omanyte npcNum = 272; break; case 140: //kabuto npcNum = 250; break; case 142: //aerodactyl npcNum = 132; break; case 345: //lileep npcNum = 956; break; case 347: //anorith npcNum = 957; break; case 408: //cranidos npcNum = 959; break; case 410: //shieldon npcNum = 958; break; case 566: //archen npcNum = 973; break; break; //case 566: //tirtouga // npcNum = 979; //break; } if (npcNum > 0) { MapNpcPreset npc = new MapNpcPreset(); npc.SpawnX = 9; npc.SpawnY = 3; npc.NpcNum = npcNum; npc.MinLevel = param2.ToInt(); npc.MaxLevel = param2.ToInt(); client.Player.Map.SpawnNpc(npc); } } break; case 47: {//egg hatch int item = -1; string[] recruitArgs = null; for (int i = 1; i <= client.Player.MaxInv; i++) { if (client.Player.Inventory[i].Num == 131) { string[] eggArgs = client.Player.Inventory[i].Tag.Split(';'); if (eggArgs.Length <= 1 || !eggArgs[1].IsNumeric()) { client.Player.TakeItemSlot(i, 1, true); } else { int step = eggArgs[1].ToInt(); if (step <= 1) { item = i; recruitArgs = eggArgs[0].Split(','); } break; } } } if (item != -1) { Recruit recruit = new Recruit(client); //recruit.SpriteOverride = -1; recruit.Level = 1; recruit.Species = recruitArgs[0].ToInt(); recruit.Sex = Pokedex.GetPokemonForm(recruitArgs[0].ToInt()).GenerateLegalSex(); recruit.Name = Pokedex.GetPokemon(recruitArgs[0].ToInt()).Name; recruit.NpcBase = 0; recruit.GenerateMoveset(); //for egg moves, where applicable List<int> eggMoves = GenerateEggMoveset(recruit.Species, recruit.Form, -1); for (int i = 0; i < 4; i++) { if (eggMoves.Count > 0) { int moveNum = eggMoves[Server.Math.Rand(0, eggMoves.Count)]; recruit.Moves[i] = new RecruitMove(); recruit.Moves[i].MoveNum = moveNum; recruit.Moves[i].MaxPP = Server.Moves.MoveManager.Moves[moveNum].MaxPP; recruit.Moves[i].CurrentPP = recruit.Moves[i].MaxPP; eggMoves.Remove(moveNum); } } for (int i = 0; i < 4; i++) { if (eggMoves.Contains(client.Player.GetActiveRecruit().Moves[i].MoveNum)) { int moveNum = client.Player.GetActiveRecruit().Moves[i].MoveNum; recruit.Moves[i] = new RecruitMove(); recruit.Moves[i].MoveNum = moveNum; recruit.Moves[i].MaxPP = Server.Moves.MoveManager.Moves[moveNum].MaxPP; recruit.Moves[i].CurrentPP = recruit.Moves[i].MaxPP; eggMoves.Remove(client.Player.GetActiveRecruit().Moves[i].MoveNum); } } int openSlot = client.Player.FindOpenTeamSlot(); int recruitIndex = -1; using (DatabaseConnection dbConnection = new DatabaseConnection(DatabaseID.Players)) { recruitIndex = client.Player.AddToRecruitmentBank(dbConnection, recruit); } if (recruitIndex != -1) { client.Player.AddToTeam(recruitIndex, openSlot); client.Player.Team[openSlot].HP = client.Player.Team[openSlot].MaxHP; Messenger.BattleMsg(client, "You have recruited a new team member!", Text.BrightGreen); Messenger.SendActiveTeam(client); } client.Player.TakeItemSlot(item, 1, true); if (recruitArgs.Length > 1) client.Player.GiveItem(recruitArgs[1].ToInt(), 1); } } break; case 48: {//teach egg move int species = client.Player.GetActiveRecruit().Species; if (Server.Evolutions.EvolutionManager.FindPreEvolution(species) > -1) { species = Server.Evolutions.EvolutionManager.FindPreEvolution(species); } if (Server.Evolutions.EvolutionManager.FindPreEvolution(species) > -1) { species = Server.Evolutions.EvolutionManager.FindPreEvolution(species); } List<int> eggMoves = GenerateEggMoveset(species, client.Player.GetActiveRecruit().Form, -1); Messenger.PlayerMsg(client, "Poof!", Text.BrightGreen); Messenger.PlaySound(client, "magic22.wav"); Messenger.SpellAnim(504, client.Player.MapID, client.Player.X, client.Player.Y); if (eggMoves.Count > 0) { client.Player.GetActiveRecruit().LearnNewMove(eggMoves[Server.Math.Rand(0, eggMoves.Count)]); Messenger.SendPlayerMoves(client); } else { Messenger.PlayerMsg(client, "But nothing happened...", Text.Grey); } } break; case 49: {//take egg int item = -1; string[] recruitArgs = null; for (int i = 1; i <= client.Player.MaxInv; i++) { if (client.Player.Inventory[i].Num == 131) { string[] eggArgs = client.Player.Inventory[i].Tag.Split(';'); if (eggArgs.Length <= 1 || !eggArgs[1].IsNumeric()) { client.Player.TakeItemSlot(i, 1, true); } else { int step = eggArgs[1].ToInt(); if (step <= 1) { item = i; recruitArgs = eggArgs[0].Split(','); } break; } } } if (item != -1) { client.Player.TakeItemSlot(item, 1, true); } } break; case 50: { BossBattles.StartBossWave(client, "ElectrostasisTowerA1", 2); } break; case 51: { BossBattles.RunPostIntroStoryBossBattle(client, "CliffsideRelic"); } break; case 52: {//enter dungeon (normal map) DungeonRules.StartDungeon(client, param1, param2, param3); } break; case 53: { BossBattles.RunPostIntroStoryBossBattle(client, "ThunderstormForest"); } break; case 54: { BossBattles.RunPostIntroStoryBossBattle(client, "ThunderstormForestPart2"); } break; case 55: { // Open tournament listing Messenger.SendTournamentListingTo(client, null); } break; case 56: { BossBattles.RunPostIntroStoryBossBattle(client, "SourRootMini"); } break; case 57: {//start boss battle BossBattles.PrepareBossRoom(client, (InstancedMap)client.Player.Map); } break; case 58: { BossBattles.RunPostIntroStoryBossBattle(client, "SourRoot"); } break; case 59: {//run post intro story boss battle BossBattles.RunPostIntroStoryBossBattle(client, param1); } break; case 60: { BossBattles.RunPostIntroStoryBossBattle(client, "SaunaCavernMini"); } break; case 61: {//enter arena for (int i = 1; i <= client.Player.MaxInv; i++) { if (client.Player.Inventory[i].Num > 0 && ItemManager.Items[client.Player.Inventory[i].Num].Type != Enums.ItemType.Held && ItemManager.Items[client.Player.Inventory[i].Num].Type != Enums.ItemType.HeldByParty && ItemManager.Items[client.Player.Inventory[i].Num].Type != Enums.ItemType.HeldInBag) { bool held = false; for (int j = 0; j < Constants.MAX_ACTIVETEAM; j++) { if (client.Player.Team[j] != null && client.Player.Team[j].HeldItemSlot == i) { held = true; } } if (!held) { int slot = i; int amount = client.Player.Inventory[slot].Amount; int X = client.Player.Inventory[slot].Num; string tag = client.Player.Inventory[slot].Tag; int j = client.Player.FindBankSlot(X, amount); if (j == -1) { Messenger.PlayerMsg(client, "The storage can't store all items!", Text.BrightRed); return; } client.Player.TakeItemSlot(slot, amount, true); client.Player.GiveBankItem(X, amount, tag, j); } } } Messenger.PlayerMsg(client, "Items were sent to storage!", Text.Yellow); EnterArena(client, client.Player.GetActiveRecruit(), client.Player.Map, param2, param3, null); } break; case 62: { BossBattles.RunPostIntroStoryBossBattle(client, "SaunaCavern"); } break; case 64: { BossBattles.RunPostIntroStoryBossBattle(client, "CrystalRuins"); } break; case 66: { BossBattles.RunPostIntroStoryBossBattle(client, "FrozenCitadel"); } break; case 68: { BossBattles.RunPostIntroStoryBossBattle(client, "SouthernSea"); } break; case 69: { BossBattles.RunPostIntroStoryBossBattle(client, "LenilePit"); } break; case 70: { Messenger.PlayerWarp(client, 1035, 9, 7); } break; case 71: {//teach tutor move int species = client.Player.GetActiveRecruit().Species; List<int> eggMoves = GenerateTutorMoveset(species, client.Player.GetActiveRecruit().Form, param1.ToInt()); Messenger.PlayerMsg(client, "GOOOOONG!", Text.BrightGreen); Messenger.PlaySound(client, "magic1011.wav"); Messenger.SpellAnim(498, client.Player.MapID, client.Player.X, client.Player.Y); if (eggMoves.Count > 0) { client.Player.GetActiveRecruit().LearnNewMove(eggMoves[Server.Math.Rand(0, eggMoves.Count)]); Messenger.SendPlayerMoves(client); } else { Messenger.PlayerMsg(client, "But nothing happened...", Text.Grey); } } break; } } catch (Exception ex) { Messenger.AdminMsg("Error: StoryScript " + scriptNum + ": " + param1 + "-" + param2 + "-" + param3, Text.Black); Messenger.AdminMsg(ex.ToString(), Text.Black); } }
public static void SaveInstancedMap(DatabaseConnection dbConnection, string mapID, InstancedMap map) { for (int i = 0; i < Constants.MAX_MAP_NPCS; i++) { map.ActiveNpc[i].Save(); } MapDataManager.SaveInstancedMap(dbConnection.Database, mapID, map.baseMap); }
public static void RDungeonScriptGoal(Client client, int scriptNum, int param1, int param2) { try { switch (scriptNum) { case 0: { int SparkSlot = client.Player.FindInvSlot(484); if (SparkSlot > 0) { StoryManager.PlayStory(client, 38); } else { Messenger.PlayerWarp(client, 72, 9, 8); } } break; case 1: { Messenger.PlayerWarp(client, 586, 10, 35); } break; case 2: {//give a prize MapStatus status = client.Player.Map.TempStatus.GetStatus("TotalTime"); if (status != null) { if (status.Counter < 15) { param1 += 3; } else if (status.Counter < 40) { param1 += 2; } else if (status.Counter < 80) { param1 += 1; } Messenger.PlayerMsg(client, "Got to the next floor in " + ((double)status.Counter / 2)+ " seconds.", Text.Yellow); Messenger.PlayerMsg(client, "A gift appeared in your bag!", Text.BrightGreen); if (param1 == 5) { client.Player.GiveItem(533, 1, "573;575;577;566;561;450"); } else if (param1 == 4) { client.Player.GiveItem(533, 1, "215;444;66;170;299;356;467"); } else if (param1 == 3) { client.Player.GiveItem(533, 1, "398;101;76;68;299;452;68"); } else if (param1 >= 1) { client.Player.GiveItem(533, 1, "451;61;400;355;99"); } else { client.Player.GiveItem(533, 1, "21;489;497;98"); } } client.Player.WarpToRDungeon(((RDungeonMap)client.Player.Map).RDungeonIndex, ((RDungeonMap)client.Player.Map).RDungeonFloor + 1); } break; case 3: {//End of East wing client.Player.SwapActiveRecruit(0); client.Player.RemoveFromTeam(1); client.Player.RemoveFromTeam(2); client.Player.RemoveFromTeam(3); //NetScript.BattleMsg(index, "Your team members returned home!", Text.BrightRed, 0); Messenger.SendActiveTeam(client); InstancedMap map = new InstancedMap(MapManager.GenerateMapID("i")); MapCloner.CloneMapTiles(MapManager.RetrieveMap(718), map); Messenger.PlayerWarp(client, map, 9, 10); Messenger.PlaySound(client, "Warp.wav"); } break; case 4: {//End of abandoned mansion client.Player.SwapActiveRecruit(0); client.Player.RemoveFromTeam(1); client.Player.RemoveFromTeam(2); client.Player.RemoveFromTeam(3); //NetScript.BattleMsg(index, "Your team members returned home!", Text.BrightRed, 0); Messenger.SendActiveTeam(client); InstancedMap map = new InstancedMap(MapManager.GenerateMapID("i")); MapCloner.CloneMapTiles(MapManager.RetrieveMap(716), map); Messenger.PlayerWarp(client, map, 9, 10); Messenger.PlaySound(client, "Warp.wav"); } break; case 5: {//End of abandoned attic client.Player.SwapActiveRecruit(0); client.Player.RemoveFromTeam(1); client.Player.RemoveFromTeam(2); client.Player.RemoveFromTeam(3); //NetScript.BattleMsg(index, "Your team members returned home!", Text.BrightRed, 0); Messenger.SendActiveTeam(client); InstancedMap map = new InstancedMap(MapManager.GenerateMapID("i")); MapCloner.CloneMapTiles(MapManager.RetrieveMap(728), map); Messenger.PlayerWarp(client, map, 13, 10); Messenger.PlaySound(client, "Warp (Escape).wav"); } break; case 6: {//Abandoned attic? loops client.Player.WarpToRDungeon(19, 6); Messenger.PlaySound(client, "magic3.wav"); StoryManager.PlayStory(client, 293); } break; case 7: {//Hallowed Well Bottom //ObjectFactory.GetPlayer(index).IncrementDungeonCompletionCount(9, 1); if (client.Player.Timers.TimerExists("Wind")) { client.Player.Timers.RemoveTimer("Wind"); } client.Player.IncrementDungeonCompletionCount(19, 1); InstancedMap map = new InstancedMap(MapManager.GenerateMapID("i")); MapCloner.CloneMapTiles(MapManager.RetrieveMap(832), map); if (client.Player.GetDungeonCompletionCount(19) < 2) { map.SetAttribute(10, 7, Enums.TileType.Item, 247, 1, 0, "", "", ""); } else { map.SetAttribute(10, 7, Enums.TileType.Item, 520, 1, 0, "", "", ""); } Messenger.PlayerWarp(client, map, 10, 11); } break; case 8: {//spiritomb room in hallowed well InstancedMap map = new InstancedMap(MapManager.GenerateMapID("i")); MapCloner.CloneMapTiles(MapManager.RetrieveMap(835), map); Messenger.PlayerWarp(client, map, 9, 13); if (client.Player.HasItem(251) > 0) { StoryManager.PlayStory(client, 302); } else { map.SetAttribute(9, 2, Enums.TileType.Scripted, 36, 0, 0, "21", "30", ""); map.SetTile(9, 2, 96, 0, 4, 1); Messenger.SendTile(9, 2, map); StoryManager.PlayStory(client, 301); } } break; case 9: {//golden apple room in hallowed well InstancedMap map = new InstancedMap(MapManager.GenerateMapID("i")); MapCloner.CloneMapTiles(MapManager.RetrieveMap(834), map); Messenger.PlayerWarp(client, map, 10, 12); } break; case 10: {//golden fang room in hallowed well InstancedMap map = new InstancedMap(MapManager.GenerateMapID("i")); MapCloner.CloneMapTiles(MapManager.RetrieveMap(833), map); Messenger.PlayerWarp(client, map, 10, 11); } break; case 11: {//heatran battle //BossBattles.StartBossBattle(client, "Heatran"); } break; case 12: { //BossBattles.StartBossBattle(client, "TinyGrotto"); } break; case 13: { //BossBattles.StartBossBattle(client, "CliffsideRelic"); } break; case 14: { //completed tanren tunnel client.Player.IncrementDungeonCompletionCount(24, 1); DungeonRules.ExitDungeon(client, 1328, 4, 16); } break; case 15: { client.Player.EndTempStatMode(); exPlayer.Get(client).WarpToSpawn(false); } break; case 16: {//completed marowak training dojo client.Player.IncrementDungeonCompletionCount(10, 1); //Messenger.PlayerWarp(client, 50, 10, 8); DungeonRules.ExitDungeon(client, 50, 10, 8); } break; case 17: { //completed winden pass client.Player.IncrementDungeonCompletionCount(4, 1); //Messenger.PlayerWarp(client, 921, 17, 21); DungeonRules.ExitDungeon(client, 921, 17, 21); } break; case 18: { client.Player.IncrementDungeonCompletionCount(11, 1); //Messenger.PlayerWarp(client, 50, 10, 8); DungeonRules.ExitDungeon(client, 1734, 13, 19); } break; case 19: {//key-activated next-floor if (client.Player.Map.Tile[client.Player.X, client.Player.Y].Data1 == 1) { PartyManager.AttemptPartyWarp(client, (Client warpClient) => { exPlayer.Get(warpClient).FirstMapLoaded = false; if (warpClient.Player.Map.MapType == Enums.MapType.RDungeonMap) warpClient.Player.WarpToRDungeon(((RDungeonMap)warpClient.Player.Map).RDungeonIndex, ((RDungeonMap)warpClient.Player.Map).RDungeonFloor + 1); }); } else { int slot = 0; for (int i = 1; i <= client.Player.Inventory.Count; i++) { if (client.Player.Inventory[i].Num == param1 && !client.Player.Inventory[i].Sticky) { slot = i; break; } } if (slot > 0) { Messenger.AskQuestion(client, "UseItem:"+param1, "Will you use your " + ItemManager.Items[param1].Name + " to open the staircase?", -1); } else { Messenger.PlaySoundToMap(client.Player.MapID, "magic132.wav"); Messenger.PlayerMsg(client, "The staircase is sealed... It seems to need a key.", Text.BrightRed); } } } break; case 20: { //BossBattles.StartBossBattle(client, "CrystalRuins"); } break; case 21: {//day/night dungeon variation int RDungeonIndex = param1 - 1; if (Server.Globals.ServerTime == Enums.Time.Night || Server.Globals.ServerTime == Enums.Time.Dusk) { RDungeonIndex = param2 - 1; } PartyManager.AttemptPartyWarp(client, (Client warpClient) => { exPlayer.Get(warpClient).FirstMapLoaded = false; if (warpClient.Player.Map.MapType == Enums.MapType.RDungeonMap) warpClient.Player.WarpToRDungeon(((RDungeonMap)warpClient.Player.Map).RDungeonIndex, ((RDungeonMap)warpClient.Player.Map).RDungeonFloor + 1); }); } break; case 22: {//switch-activated next-floor if (client.Player.Map.Tile[client.Player.X, client.Player.Y].Data1 == 1) { PartyManager.AttemptPartyWarp(client, (Client warpClient) => { exPlayer.Get(warpClient).FirstMapLoaded = false; warpClient.Player.WarpToRDungeon(param1 - 1, param2 - 1); }); } else { Messenger.PlayerMsg(client, "The passage to the next floor won't open until the switches are pressed...", Text.BrightRed); Messenger.PlaySoundToMap(client.Player.MapID, "magic132.wav"); } } break; case 23: {//switch-activated dungeon end if (client.Player.Map.Tile[client.Player.X, client.Player.Y].Data1 == 1) { PartyManager.AttemptPartyWarp(client, (Client warpClient) => { Messenger.PlayerWarp(warpClient, 1426, 18, 43); int players = (warpClient.Player.Map.PlayersOnMap.Count - 1) % 4; warpClient.Player.Map.SpawnItem(533, 1, false, false, "373;374;375;376;377;378;379;382", 17 + 2 * (players % 2), 11 + 2 * (players / 2), warpClient); if (warpClient.Player.Map.ActiveItem[players].Num != 0) { warpClient.Player.Map.ActiveItem[players].TimeDropped = new TickCount(Core.GetTickCount().Tick + 600000); } }); } else { Messenger.PlayerMsg(client, "The passage to the rooftop won't open until the switches are pressed...", Text.BrightRed); Messenger.PlaySoundToMap(client.Player.MapID, "magic132.wav"); } } break; case 24: {//switch-deactivated end-Harmonic-Tower Messenger.PlayerMsg(client, "The passage to the next floor won't open until the switches are pressed...", Text.BrightRed); } break; case 25: {//end of Harmonic Tower } break; case 26: {//end of Mineral Cave client.Player.IncrementDungeonCompletionCount(15, 1); DungeonRules.ExitDungeon(client, 1361, 6, 7); if (client.Player.Map.MapType == Enums.MapType.Instanced && ((InstancedMap) client.Player.Map).MapBase == 1361) { client.Player.Map.SpawnItem(49, 1, false, false, "", 8, 8, null); } } break; case 27: {//completed Mt. barricade client.Player.IncrementDungeonCompletionCount(18, 1); //Messenger.PlayerWarp(client, 50, 10, 8); DungeonRules.ExitDungeon(client, 1015, 25, 25); } break; case 28: {//tanren chambers int x = -1, y = -1, mapNum = -1, itemX = -1, itemY = -1; InstancedMap iMap = null; switch (param1) { case 0: {//bottom mapNum = 301; x = 25; y = 46; itemX = 25; itemY = 25; } break; case 1: {//depth 1 mapNum = 302; x = 9; y = 10; itemX = 9; itemY = 7; } break; case 2: {//depth 2 mapNum = 303; x = 9; y = 10; itemX = 9; itemY = 6; } break; case 3: {//depth 3 mapNum = 304; x = 9; y = 10; itemX = 9; itemY = 7; } break; } if (mapNum > -1) { string mapID = MapManager.GenerateMapID("i"); bool warp = PartyManager.AttemptPartyWarp(client, (Client warpClient) => { if (iMap == null) { iMap = new InstancedMap(mapID); IMap baseMap = MapManager.RetrieveMap(mapNum); MapCloner.CloneMapTiles(baseMap, iMap); MapCloner.CloneMapNpcs(baseMap, iMap); MapCloner.CloneMapGeneralProperties(baseMap, iMap); iMap.MapBase = mapNum; } Messenger.PlayerWarp(warpClient, iMap, x, y); }); if (warp) { int itemNum = 533; string tag = ""; switch (param2) {//determines reward //Normal case 0: itemNum = 171; break; case 1: tag = "125;355;277;726,1;143;53,20;806,15;716"; break; case 2: tag = "711;452;113;467;136;139;543;170"; break; case 3: tag = "717;327;739,3;15;690;117;353;400"; break; case 4: tag = "399;544;47;260;354;248;451;404"; break; case 5: tag = "329;175;397;21;13;191;47;307"; break; case 6: tag = "759;489;167;144;172;372;16;704"; break; case 7: tag = "489;92;82;497;306;11;151;93"; break; //Elecric case 8: tag = "715;430;806,20;350;88;253;726,5;803"; break; case 9: tag = "716;452;53,15;369;726,1;158;355;18"; break; case 10: tag = "711;454;275;698;298;260;303"; break; case 11: tag = "717;83;327;260;354;249;451;544"; break; case 12: tag = "757;183;167;307;77;719;744,3;421"; break; //Water case 13: tag = "715;427;806,20;350;88;253;726,5;803"; break; case 14: tag = "716;452;806,10;355;101;301;158;718"; break; case 15: tag = "711;796;333;272;349;370;120,1,150;801"; break; case 16: tag = "314;455;442;260;354;249;96"; break; case 17: tag = "751;489;154;372;112;172;157;460"; break; //Grass case 18: tag = "715;424;806,20;350;88;253;726,5;803"; break; case 19: tag = "716;452;53,15;726,1;355;189;72;630"; break; case 20: tag = "711;794;274;457;458;187;184"; break; case 21: tag = "717;120,1,120;327;463;260;451;298;404"; break; case 22: tag = "100;154;721,10;324;397;47;21;810"; break; //Fire case 23: tag = "715;420;806,20;350;88;253;726,5;803"; break; case 24: tag = "716;452;806,10;459;355;94;302;805"; break; case 25: tag = "64;453;273;334;451;47;442;481"; break; case 26: tag = "758;183;167;741,3;441;163;686;134"; break; case 27: tag = "82;489;410;132;304;60,15;345,10;497"; break; //Psychic case 28: tag = "715;425;806,20;350;398;253;726,5;803"; break; case 29: tag = "711;452;143;440;726,1;355;467;468"; break; case 30: tag = "717;498;327;276;466;353;451;298"; break; case 31: tag = "107;742,3;354;249;13;90;99;790"; break; case 32: tag = "761;727,3;293;16;172;719;704;421"; break; //Dark case 33: tag = "715;418;806,20;350;398;253;726,5;803"; break; case 34: tag = "711;143;689;690;280;353;383;456"; break; case 35: tag = "451;12;354;742,3;249;90;44;790"; break; case 36: tag = "810;324;397;45;312;47;701;13"; break; case 37: tag = "760;167;134;16;738,3;172;704;700"; break; //Ghost case 38: tag = "715;428;806,20;350;398;253;726,5;803"; break; case 39: tag = "716;452;143;461;355;469;125;18"; break; case 40: tag = "711;558;462;120,1,150;720;62,10;801"; break; case 41: tag = "717;97;327;283;465;353;383;120,1,128"; break; case 42: tag = "752;727,3;293;744,3"; break; //Fighting case 43: tag = "715;419;806,20;350;398;253;726,5;803"; break; case 44: tag = "711;452;799;143;281;355;72;409"; break; case 45: tag = "717;289;464;353;451;298;120,1,110;303"; break; case 46: tag = "58;47;324;481;21;701;447;699"; break; case 47: tag = "756;167;741,3;144;16;172;421"; break; //Flying case 48: tag = "715;426;53,25;350;398;253;726,5;803"; break; case 49: tag = "711;797;282;260;451;120,1,130;806,7;303"; break; case 50: tag = "95;685;397;47;701;810;396;699"; break; //Steel case 51: tag = "715;297;53,25;350;88;253;726,5;803"; break; case 52: tag = "711;791;288;433;401;120,1,150;720"; break; case 53: tag = "68;176;544;99;354;451;191;90"; break; case 54: tag = "754;183;741,3;134;16;441;744,3;686"; break; //Poison case 55: tag = "715;429;53,25;350;398;253;726,5;803"; break; case 56: tag = "711;452;339;355;170;286;72;630"; break; case 57: tag = "122;481;45;154;248;169;810;99"; break; //Ice case 58: tag = "715;416;53,25;350;88;253;726,5;803"; break; case 59: tag = "716;452;290;215;355;371;349;72"; break; case 60: tag = "717;337;444;442;353;451;120,1,120;285"; break; case 61: tag = "106;742,3;299;312;47;744,4;84;810"; break; //Ground case 62: tag = "715;296;53,25;350;398;253;726,5;803"; break; case 63: tag = "711;452;688;355;120,1,160;72;720;409"; break; case 64: tag = "67;278;84;99;248;102;47;300"; break; //Bug case 65: tag = "715;423;53,25;350;88;253;726,5;803"; break; case 66: tag = "711;792;353;480;120,1,150;260;720;801"; break; case 67: tag = "71;279;99;354;451;248;481;90"; break; case 68: tag = "753;721,10;183;144;411;134;16;441"; break; //Dragon case 69: tag = "715;417;53,25;350;398;253;726,5;803"; break; case 70: tag = "711;327;380;284;260;184;303;690"; break; case 71: tag = "76;45;47;312;701;744,4;111;789"; break; //Rock case 72: tag = "715;295;53,25;350;88;253;726,5;803"; break; case 73: tag = "716;160;355;349;370;336;371;72"; break; case 74: tag = "717;793;544;353;451;53,8;120,1,120;287"; break; case 75: tag = "108;685;397;300;744,4;47;447;789"; break; } iMap.SpawnItem(itemNum, 0, false, false, tag, itemX, itemY, null); if (client.Player.Name == "Hayarotle" || client.Player.Name == "Sprinko") { Messenger.PlayerMsg(client, "Possible items:", Text.Black); string[] itemSelection = tag.Split(';'); for (int i = 0; i < itemSelection.Length; i++) { string[] chosenItem = itemSelection[i].Split(','); if (chosenItem[0].IsNumeric()) { if (chosenItem.Length == 2 && chosenItem[1].IsNumeric()) { Messenger.PlayerMsg(client, chosenItem[1] + " " + ItemManager.Items[chosenItem[0].ToInt()].Name, Text.Yellow); } else if (chosenItem.Length == 3 && chosenItem[2].IsNumeric()) { Messenger.PlayerMsg(client, "a " + ItemManager.Items[chosenItem[0].ToInt()].Name, Text.Yellow); } else { Messenger.PlayerMsg(client, "a " + ItemManager.Items[chosenItem[0].ToInt()].Name, Text.Yellow); } } } } } } } break; } } catch (Exception ex) { Messenger.AdminMsg("Error: RDungeonScriptGoal", Text.Black); Messenger.AdminMsg(ex.ToString(), Text.Black); } }
public static void PrepareBossRoom(Client client, InstancedMap bossMap) { if (bossMap.TempStatus.GetStatus("Boss") != null) return; switch (bossMap.MapBase) { //mt. barricade case 1294: { IMap map = client.Player.Map; map.SetAttribute(13, 18, Enums.TileType.Walkable, 0, 0, 0, "", "", ""); Messenger.SendTile(13, 18, map); map.SetAttribute(14, 18, Enums.TileType.Walkable, 0, 0, 0, "", "", ""); Messenger.SendTile(14, 18, map); map.SetAttribute(15, 18, Enums.TileType.Walkable, 0, 0, 0, "", "", ""); Messenger.SendTile(15, 18, map); map.SetAttribute(16, 18, Enums.TileType.Walkable, 0, 0, 0, "", "", ""); Messenger.SendTile(16, 18, map); map.SetAttribute(17, 18, Enums.TileType.Walkable, 0, 0, 0, "", "", ""); Messenger.SendTile(17, 18, map); map.SetAttribute(18, 18, Enums.TileType.Walkable, 0, 0, 0, "", "", ""); Messenger.SendTile(18, 18, map); map.SetAttribute(19, 18, Enums.TileType.Walkable, 0, 0, 0, "", "", ""); Messenger.SendTile(19, 18, map); map.SetAttribute(20, 18, Enums.TileType.Walkable, 0, 0, 0, "", "", ""); Messenger.SendTile(20, 18, map); map.SetTile(17, 10, 3751, 7, 3); map.SetAttribute(17, 10, Enums.TileType.Blocked, 0, 0, 0, "", "", ""); Messenger.SendTile(17, 10, map); map.SetTile(20, 12, 3751, 7, 3); map.SetAttribute(20, 12, Enums.TileType.Blocked, 0, 0, 0, "", "", ""); Messenger.SendTile(20, 12, map); map.SetTile(12, 14, 3751, 7, 3); map.SetAttribute(12, 14, Enums.TileType.Blocked, 0, 0, 0, "", "", ""); Messenger.SendTile(12, 14, map); map.SetTile(23, 23, 3751, 7, 3); map.SetAttribute(23, 23, Enums.TileType.Blocked, 0, 0, 0, "", "", ""); Messenger.SendTile(23, 23, map); map.SetTile(14, 19, 3751, 7, 3); map.SetAttribute(14, 19, Enums.TileType.Blocked, 0, 0, 0, "", "", ""); Messenger.SendTile(14, 19, map); map.SetTile(14, 12, 3750, 7, 3); map.SetAttribute(14, 12, Enums.TileType.Blocked, 0, 0, 0, "", "", ""); Messenger.SendTile(14, 12, map); map.SetTile(19, 15, 3750, 7, 3); map.SetAttribute(19, 15, Enums.TileType.Blocked, 0, 0, 0, "", "", ""); Messenger.SendTile(19, 15, map); map.SetTile(13, 16, 3750, 7, 3); map.SetAttribute(13, 16, Enums.TileType.Blocked, 0, 0, 0, "", "", ""); Messenger.SendTile(13, 16, map); map.SetTile(10, 21, 3750, 7, 3); map.SetAttribute(10, 21, Enums.TileType.Blocked, 0, 0, 0, "", "", ""); Messenger.SendTile(10, 21, map); map.SetTile(19, 19, 3750, 7, 3); map.SetAttribute(19, 19, Enums.TileType.Blocked, 0, 0, 0, "", "", ""); Messenger.SendTile(19, 19, map); map.SetTile(22, 18, 3750, 7, 3); map.SetAttribute(22, 18, Enums.TileType.Blocked, 0, 0, 0, "", "", ""); Messenger.SendTile(22, 18, map); map.SetTile(18, 21, 3750, 7, 3); map.SetAttribute(18, 21, Enums.TileType.Blocked, 0, 0, 0, "", "", ""); Messenger.SendTile(18, 21, map); Messenger.PlaySoundToMap(client.Player.MapID, "magic660.wav"); } break; } }
public static void StartBossBattle(Client client, InstancedMap bossMap) { if (bossMap.TempStatus.GetStatus("Boss") != null) return; switch (bossMap.MapBase) { case 1422: {//regice // Currently in mission, warp to normal map // TODO: Add regice code here [Scripts] //if (client.Player.ActiveMission != null && client.Player.ActiveMission.WonderMail.Code == "regicecode") { // Messenger.PlayerWarp(client, 1422, 10, 22); // StoryManager.PlayStory(client, 994); //} else {// Not in mission, warp to instanced map // //if (Ranks.IsAllowed(index, Enums.Rank.Moniter)) { // InstancedMap map = new InstancedMap(MapManager.GenerateMapID("i")); // MapCloner.CloneMapTiles(MapManager.RetrieveMap(1422), map); // map.MapBase = 1422; // Messenger.PlayerWarp(client, map, 10, 21); // StoryManager.PlayStory(client, 989); // //} //} } break; case 914: {//jirachi InstancedMap map = new InstancedMap(MapManager.GenerateMapID("i")); MapCloner.CloneMapTiles(MapManager.RetrieveMap(914), map); map.MapBase = 914; Messenger.PlayerWarp(client, map, 9, 12); StoryManager.PlayStory(client, 149); } break; case 89: {//steelix InstancedMap map = new InstancedMap(MapManager.GenerateMapID("i")); MapCloner.CloneMapTiles(MapManager.RetrieveMap(89), map); map.MapBase = 89; Messenger.PlayerWarp(client, map, 9, 11); map.SetNpcSpawnPoint(1, 9, 5); map.SetNpc(1, 465); //map.SpawnNpc(1); } break; case 590: {//dynamo InstancedMap map = new InstancedMap(MapManager.GenerateMapID("i")); MapCloner.CloneMapTiles(MapManager.RetrieveMap(590), map); map.MapBase = 590; Messenger.PlayerWarp(client, map, 10, 7); map.SetNpc(1, 276); map.SetNpc(2, 277); map.SetNpc(3, 278); //map.SpawnNpc(1); //map.SpawnNpc(2); //map.SpawnNpc(3); } break; case 569: {//groudon InstancedMap map = new InstancedMap(MapManager.GenerateMapID("i")); MapCloner.CloneMapTiles(MapManager.RetrieveMap(569), map); map.MapBase = 569; Messenger.PlayerWarp(client, map, 10, 13); StoryManager.PlayStory(client, 154); } break; case 667: {//honchkrow InstancedMap map = new InstancedMap(MapManager.GenerateMapID("i")); MapCloner.CloneMapTiles(MapManager.RetrieveMap(667), map); map.MapBase = 667; //NetScript.LockPlayer(index); Messenger.PlayerWarp(client, map, 10, 20); //if (Ranks.IsDisallowed(index, Enums.Rank.StoryWriter)) { if (client.Player.GetDungeonCompletionCount(15) < 1) { StoryManager.PlayStory(client, 159); } else { StoryManager.PlayStory(client, 162); } } break; case 424: {//hermi cave //ObjectFactory.GetPlayer(index).IncrementDungeonCompletionCount(9, 1); InstancedMap map = new InstancedMap(MapManager.GenerateMapID("i")); MapCloner.CloneMapTiles(MapManager.RetrieveMap(424), map); map.MapBase = 424; if (client.Player.GetDungeonCompletionCount(9) < 2) { map.SetAttribute(9, 16, Enums.TileType.Item, 370, 1, 0, "", "", ""); map.SetAttribute(10, 16, Enums.TileType.Item, 371, 1, 0, "", "", ""); } else { map.SetAttribute(9, 15, Enums.TileType.Item, 263, 4, 0, "", "", ""); map.SetAttribute(10, 15, Enums.TileType.Item, 264, 4, 0, "", "", ""); map.SetAttribute(8, 16, Enums.TileType.Item, 265, 4, 0, "", "", ""); map.SetAttribute(11, 16, Enums.TileType.Item, 266, 4, 0, "", "", ""); map.SetAttribute(8, 17, Enums.TileType.Item, 266, 4, 0, "", "", ""); map.SetAttribute(11, 17, Enums.TileType.Item, 265, 4, 0, "", "", ""); map.SetAttribute(9, 18, Enums.TileType.Item, 264, 4, 0, "", "", ""); map.SetAttribute(10, 18, Enums.TileType.Item, 263, 4, 0, "", "", ""); map.SetAttribute(9, 16, Enums.TileType.Blocked, 0, 0, 0, "", "", ""); map.SetAttribute(10, 16, Enums.TileType.Blocked, 0, 0, 0, "", "", ""); map.SetAttribute(9, 17, Enums.TileType.Blocked, 0, 0, 0, "", "", ""); map.SetAttribute(10, 17, Enums.TileType.Blocked, 0, 0, 0, "", "", ""); map.SetTile(9, 15, 118400, 7, 5); map.SetTile(10, 15, 118432, 7, 5); map.SetTile(9, 16, 118848, 7, 5); map.SetTile(10, 16, 118880, 7, 5); map.SetTile(9, 17, 119296, 7, 5); map.SetTile(10, 17, 119328, 7, 5); //map.SetTile(9, 15, 128, 8448, 7, 5); //map.SetTile(10, 15, 160, 8448, 7, 5); //map.SetTile(9, 16, 128, 8480, 7, 5); //map.SetTile(10, 16, 160, 8480, 7, 5); //map.SetTile(9, 17, 128, 8512, 7, 5); //map.SetTile(10, 17, 160, 8512, 7, 5); map.SetAttribute(9, 23, Enums.TileType.Story, 147, 2, 0, "", "", ""); } Messenger.PlayerWarp(client, map, 9, 30); //if (ObjectFactory.GetPlayer(index).GetDungeonCompletionCount(9) >= 2) { // NetScript.PlaySound(index, "magic68.wav"); //NetScript.PlayStory(index, 147); //} } break; case 503: {//registeel InstancedMap map = new InstancedMap(MapManager.GenerateMapID("i")); MapCloner.CloneMapTiles(MapManager.RetrieveMap(503), map); map.MapBase = 503; Messenger.PlayerWarp(client, map, 9, 12); StoryManager.PlayStory(client, 37); } break; case 1108: {//mysterious jungle InstancedMap map = new InstancedMap(MapManager.GenerateMapID("i")); MapCloner.CloneMapTiles(MapManager.RetrieveMap(1108), map); map.MapBase = 1108; Messenger.PlayerWarp(client, map, 10, 13); if (client.Player.HasItem(479) > 0) { StoryManager.PlayStory(client, 165); } else { StoryManager.PlayStory(client, 164); } } break; case 174: {//pokemas //InstancedMap map = new InstancedMap(MapManager.GenerateMapID("i")); //MapCloner.CloneMapTiles(MapManager.RetrieveMap(174), map); //map.MapBase = 174; //Messenger.PlayerWarp(client, map, 12, 19); //StoryManager.PlayStory(client, 170); } break; case 465: {//heatran InstancedMap map = new InstancedMap(MapManager.GenerateMapID("i")); MapCloner.CloneMapTiles(MapManager.RetrieveMap(465), map); map.MapBase = 465; Messenger.PlayerWarp(client, map, 10, 27); map.SetNpc(1, 404); map.SetNpcSpawnPoint(1, 10, 6); //map.SpawnNpc(1); } break; case 1563: {//xatu //InstancedMap map = new InstancedMap(MapManager.GenerateMapID("i")); //MapCloner.CloneMapTiles(MapManager.RetrieveMap(1563), map); //map.MapBase = 1563; //Messenger.PlayerWarp(client, map, 7, 3); StoryManager.PlayStory(client, 175); } break; //case "Darkrai": { // //instanced map // //warp // //story // } // break; case 1287: {//tiny grotto //InstancedMap map = new InstancedMap(MapManager.GenerateMapID("i")); //MapCloner.CloneMapTiles(MapManager.RetrieveMap(1287), map); //MapCloner.CloneMapGeneralProperties(MapManager.RetrieveMap(1287), map); //map.MapBase = 1287; //Messenger.PlayerWarp(client, map, 9, 10); StoryManager.PlayStory(client, 102); //map.SetNpc(0, 502); //map.SetNpcSpawnPoint(0, 9, 3); } break; case 114: {//sour root mini //InstancedMap map = new InstancedMap(MapManager.GenerateMapID("i")); //MapCloner.CloneMapTiles(MapManager.RetrieveMap(114), map); //MapCloner.CloneMapGeneralProperties(MapManager.RetrieveMap(114), map); //map.MapBase = 114; //Messenger.PlayerWarp(client, map, 7, 12); StoryManager.PlayStory(client, 138); } break; case 115: {//sour root //InstancedMap map = new InstancedMap(MapManager.GenerateMapID("i")); //MapCloner.CloneMapTiles(MapManager.RetrieveMap(115), map); //MapCloner.CloneMapGeneralProperties(MapManager.RetrieveMap(115), map); //map.MapBase = 115; //Messenger.PlayerWarp(client, map, 10, 10); StoryManager.PlayStory(client, 136); } break; case 255: {//seaside cavern //InstancedMap map = new InstancedMap(MapManager.GenerateMapID("i")); //MapCloner.CloneMapTiles(MapManager.RetrieveMap(255), map); //MapCloner.CloneMapGeneralProperties(MapManager.RetrieveMap(255), map); //map.MapBase = 255; //map.SetTile(9, 4, 6, 0, 4, 3); //map.SetAttribute(9, 4, Server.Enums.TileType.Blocked, 0, 0, 0, "", "", ""); //Messenger.PlayerWarp(client, map, 9, 9); StoryManager.PlayStory(client, 115); } break; case 1609: { InstancedMap map = new InstancedMap(MapManager.GenerateMapID("i")); IMap originalMap = MapManager.RetrieveMap(1609); MapCloner.CloneMapTileProperties(originalMap, map); MapCloner.CloneMapTiles(originalMap, map); Messenger.PlayerWarp(client, map, 11, 29); } break; case 1288: {//cliffside //InstancedMap map = new InstancedMap(MapManager.GenerateMapID("i")); //MapCloner.CloneMapTiles(MapManager.RetrieveMap(1288), map); //MapCloner.CloneMapGeneralProperties(MapManager.RetrieveMap(1288), map); //map.MapBase = 1288; //Messenger.PlayerWarp(client, map, 10, 10); StoryManager.PlayStory(client, 118); } break; case 531: {//thunderstorm forest //InstancedMap map = new InstancedMap(MapManager.GenerateMapID("i")); //MapCloner.CloneMapTiles(MapManager.RetrieveMap(531), map); //MapCloner.CloneMapGeneralProperties(MapManager.RetrieveMap(531), map); //map.MapBase = 531; //Messenger.PlayerWarp(client, map, 9, 13); StoryManager.PlayStory(client, 122); } break; case 1248: {//sauna cavern mini //InstancedMap map = new InstancedMap(MapManager.GenerateMapID("i")); //MapCloner.CloneMapTiles(MapManager.RetrieveMap(1248), map); //MapCloner.CloneMapGeneralProperties(MapManager.RetrieveMap(1248), map); //map.MapBase = 1248; //Messenger.PlayerWarp(client, map, 9, 12); StoryManager.PlayStory(client, 142); } break; case 1263: {//sauna cavern //InstancedMap map = new InstancedMap(MapManager.GenerateMapID("i")); //MapCloner.CloneMapTiles(MapManager.RetrieveMap(1263), map); //MapCloner.CloneMapGeneralProperties(MapManager.RetrieveMap(1263), map); //map.MapBase = 1263; //Messenger.PlayerWarp(client, map, 10, 12); StoryManager.PlayStory(client, 140); } break; case 1392: {//crystal ruins //InstancedMap map = new InstancedMap(MapManager.GenerateMapID("i")); //MapCloner.CloneMapTiles(MapManager.RetrieveMap(1392), map); //MapCloner.CloneMapGeneralProperties(MapManager.RetrieveMap(1392), map); //map.MapBase = 1392; //Messenger.PlayerWarp(client, map, 9, 11); StoryManager.PlayStory(client, 186); } break; case 1394: {//frozen citadel //InstancedMap map = new InstancedMap(MapManager.GenerateMapID("i")); //MapCloner.CloneMapTiles(MapManager.RetrieveMap(1394), map); //MapCloner.CloneMapGeneralProperties(MapManager.RetrieveMap(1394), map); //map.MapBase = 1394; //Messenger.PlayerWarp(client, map, 10, 10); StoryManager.PlayStory(client, 188); } break; case 1362: {//southern sea //InstancedMap map = new InstancedMap(MapManager.GenerateMapID("i")); //MapCloner.CloneMapTiles(MapManager.RetrieveMap(1362), map); //MapCloner.CloneMapGeneralProperties(MapManager.RetrieveMap(1362), map); //map.MapBase = 1362; //Messenger.PlayerWarp(client, map, 9, 12); StoryManager.PlayStory(client, 144); } break; case 1335: {//Chandalure StoryManager.PlayStory(client, 217); } break; case 718: {//rotom forme StoryManager.PlayStory(client, 215); } break; case 534: {//lapras StoryManager.PlayStory(client, 216); } break; case 1638: {//skylift StoryManager.PlayStory(client, 197); } break; case 1048: {//Exbel Woods Clearing StoryManager.PlayStory(client, 196); } break; case 1851: {//beach bunker StoryManager.PlayStory(client, 203); } break; case 1637: {//snowveil lair StoryManager.PlayStory(client, 326); } break; case 1670: {//snowveil pit StoryManager.PlayStory(client, 328); } break; case 1662: {//snowveil end StoryManager.PlayStory(client, 330); } break; case 1722: {//articuno StoryManager.PlayStory(client, 170); } break; case 1526: {//Deep Winden Forest Clearing StoryManager.PlayStory(client, 322); } break; case 1744: {//Inferno Volcano Core StoryManager.PlayStory(client, 393); } break; case 1745: {//Mysterious Jungle Undergrowth StoryManager.PlayStory(client, 346); } break; case 1765: {//Inferno Volcano StoryManager.PlayStory(client, 141); } break; case 1701: {//Sacred Tower, Fiery Passage StoryManager.PlayStory(client, 370); } break; case 1702: {//Sacred Tower, Garden Passage StoryManager.PlayStory(client, 371); } break; case 1703: {//Sacred Tower, Aquatic Passage StoryManager.PlayStory(client, 372); } break; case 1704: {//Sacred Tower, Frigid Passage StoryManager.PlayStory(client, 373); } break; case 1705: {//Sacred Tower, Electrical Passage StoryManager.PlayStory(client, 374); } break; case 1706: {//Sacred Tower, Malign Passage StoryManager.PlayStory(client, 375); } break; case 1707: {//Sacred Tower, Esoteric Passage StoryManager.PlayStory(client, 376); } break; case 1708: {//Sacred Spire StoryManager.PlayStory(client, 378); } break; case 1692: {//Tanren Dojo, Hitmonchan StoryManager.PlayStory(client, 247); } break; case 1694: {//Tanren Dojo, Hitmonlee StoryManager.PlayStory(client, 267); } break; case 1715: {//Tanren Dojo, Hitmontop StoryManager.PlayStory(client, 323); } break; case 982: {//Honeydrop Meadow Clearing StoryManager.PlayStory(client, 352); } break; case 1994: {//Boss Rush 1 StoryManager.PlayStory(client, 354); } break; case 1990: {//Boss Rush 2 StoryManager.PlayStory(client, 355); } break; case 1983: {//Boss Rush 3 StoryManager.PlayStory(client, 356); } break; case 539: {//Boss Rush 4 StoryManager.PlayStory(client, 357); } break; case 496: {//Boss Rush 5 StoryManager.PlayStory(client, 358); } break; case 1786: {//Boggy Wastes Chamber StoryManager.PlayStory(client, 360); } break; case 787: {//Boggy Wastes Lair StoryManager.PlayStory(client, 362); } break; case 1754: {//Tanren Mines, Dead End StoryManager.PlayStory(client, 425); } break; case 1954: {//Tanren Mines Vestibule StoryManager.PlayStory(client, 210); } break; case 1136: {//Tanren Mines End StoryManager.PlayStory(client, 214); } break; } }
public static void ScriptedTile(IMap map, ICharacter character, int script, string param1, string param2, string param3, PacketHitList hitlist) { try { PacketHitList.MethodStart(ref hitlist); Client client = null; if (character.CharacterType == Enums.CharacterType.Recruit) { client = ((Recruit)character).Owner; } switch (script) { case 0: { if (character.CharacterType == Enums.CharacterType.Recruit) { hitlist.AddPacket(((Recruit)character).Owner, PacketBuilder.CreateChatMsg("Empty Script", Text.Black)); } } break; case 1: { // Story runner if (exPlayer.Get(client).StoryEnabled) { int storyNum = param1.ToInt() - 1; if (client.Player.GetStoryState(storyNum) == false) { StoryManager.PlayStory(client, storyNum); } } } break; case 2: {//Explosion trap if (WillTrapActivate(character, map, character.X, character.Y)) { RevealTrap(map, character.X, character.Y, hitlist); hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(character.Name + " stepped on an Explosion Trap!", Text.BrightRed), character.X, character.Y, 10); ActivateTrap(map, character.X, character.Y, script, hitlist); } } break; case 3: {//Chestnut Trap if (WillTrapActivate(character, map, character.X, character.Y)) { RevealTrap(map, character.X, character.Y, hitlist); hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(character.Name + " stepped on a Chestnut Trap!", Text.BrightRed), character.X, character.Y, 10); ActivateTrap(map, character.X, character.Y, script, hitlist); } } break; case 4: {//PP-Zero Trap if (WillTrapActivate(character, map, character.X, character.Y)) { RevealTrap(map, character.X, character.Y, hitlist); hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(character.Name + " stepped on an PP-Zero Trap!", Text.BrightRed), character.X, character.Y, 10); ActivateTrap(map, character.X, character.Y, script, hitlist); } } break; case 5: {//Grimy Trap if (WillTrapActivate(character, map, character.X, character.Y)) { RevealTrap(map, character.X, character.Y, hitlist); hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(character.Name + " stepped on a Grimy Trap!", Text.BrightRed), character.X, character.Y, 10); ActivateTrap(map, character.X, character.Y, script, hitlist); } } break; case 6: {//Poison Trap if (WillTrapActivate(character, map, character.X, character.Y)) { RevealTrap(map, character.X, character.Y, hitlist); hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(character.Name + " stepped on a Poison Trap!", Text.BrightRed), character.X, character.Y, 10); ActivateTrap(map, character.X, character.Y, script, hitlist); } } break; case 7: {//Random Trap if (WillTrapActivate(character, map, character.X, character.Y)) { RevealTrap(map, character.X, character.Y, hitlist); hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(character.Name + " stepped on a Random Trap!", Text.BrightRed), character.X, character.Y, 10); ActivateTrap(map, character.X, character.Y, script, hitlist); if (Server.Math.Rand(0, 10) + 6 < map.Tile[character.X, character.Y].Data2) { RemoveTrap(map, character.X, character.Y, hitlist); } } } break; case 8: {//Appraisal; if (client != null) { int boxes = 0; for (int i = 1; i <= client.Player.Inventory.Count; i++) { if (client.Player.Inventory[i].Num != 0 && ItemManager.Items[client.Player.Inventory[i].Num].Type == Enums.ItemType.Scripted && ItemManager.Items[client.Player.Inventory[i].Num].Data1 == 12 && !client.Player.Inventory[i].Sticky) { boxes++; } } if (boxes > 0) { Messenger.AskQuestion(client, "Appraisal", "Will you have your boxes opened? It will cost " + 150 * boxes + " Poké.", -1); } else { Story story = new Story(); StoryBuilderSegment segment = StoryBuilder.BuildStory(); StoryBuilder.AppendSaySegment(segment, "You can bring your treasure boxes here to have them opened for 150 Poké each.", -1, 0, 0); segment.AppendToStory(story); StoryManager.PlayStory(client, story); } } } break; case 9: {//Un-sticky; if (client != null) { Messenger.AskQuestion(client, "Unsticky", "Will you have your sticky items cleansed?", -1); } } break; case 10: {//Full heal if (client != null) { for (int i = 0; i < Constants.MAX_ACTIVETEAM; i++) { if (client.Player.Team[i].Loaded) { // Yes, there needs to be a check client.Player.Team[i].HP = client.Player.Team[i].MaxHP; client.Player.Team[i].RestoreBelly(); client.Player.Team[i].StatusAilment = Enums.StatusAilment.OK; client.Player.Team[i].StatusAilmentCounter = 0; for (int j = 0; j < 4; j++) { if (client.Player.GetActiveRecruit().Moves[i].MoveNum != 0) { client.Player.Team[i].Moves[j].CurrentPP = client.Player.Team[i].Moves[j].MaxPP; } } } } hitlist.AddPacket(client, PacketBuilder.CreateBattleMsg("The entire party was fully healed!", Text.BrightGreen)); hitlist.AddPacket(client, PacketBuilder.CreateSoundPacket("magic25.wav")); PacketBuilder.AppendPlayerMoves(client, hitlist); PacketBuilder.AppendActiveTeamNum(client, hitlist); PacketBuilder.AppendStatusAilment(client, hitlist); } } break; case 11: {//Warp out of Destiny Cavern if (client != null) { if (Settings.NewCharForm > 0) { //for (int i = 0; i < 4; i++) { client.Player.GetActiveRecruit().GenerateMoveset(); client.Player.GetActiveRecruit().HP = client.Player.GetActiveRecruit().MaxHP; //if (client.Player.Team[i].Loaded) {//does there need to be a check for if the team member of the slot is there? // client.Player.Team[i].HP = client.Player.Team[i].MaxHP; for (int j = 0; j < Constants.MAX_PLAYER_MOVES; j++) { if (client.Player.GetActiveRecruit().Moves[j].MoveNum != 0) { client.Player.GetActiveRecruit().Moves[j].CurrentPP = client.Player.GetActiveRecruit().Moves[j].MaxPP; } } //} //} //Messenger.PlayerWarp(client, 1, 10, 7); exPlayer.Get(client).SpawnMap = "s1035"; exPlayer.Get(client).SpawnX = 9; exPlayer.Get(client).SpawnY = 7; StoryManager.PlayStory(client, 639); //StoryManager.PlayStory(client, 640); //} else { // StoryManager.PlayStory(client, StoryConstruction.CreateIntroStory(client)); //} } } } break; case 12: {//Next floor of a different dungeon if (client != null && map.MapType == Enums.MapType.RDungeonMap && ((RDungeonMap)map).RDungeonIndex > -1) { PartyManager.AttemptPartyWarp(client, (Client warpClient) => { warpClient.Player.WarpToRDungeon(param1.ToInt() - 1, ((RDungeonMap)map).RDungeonFloor + 1); }); } } break; case 13: {//drop from the sky if (client != null) { Messenger.AskQuestion(client, "SkyDrop:" + param1 + ":" + param2, "Will you land at " + param3 + "?", -1); } } break; case 14: {//Fly if (client != null) { Messenger.PlayerMsg(client, "A strong updraft can be felt from here...", Text.Grey); //Messenger.PlaySound(client, "Magic632.wav"); hitlist.AddPacket(client, PacketBuilder.CreateSoundPacket("Magic632.wav")); } } break; case 15: {// Warp Trap if (WillTrapActivate(character, map, character.X, character.Y)) { RevealTrap(map, character.X, character.Y, hitlist); hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(character.Name + " stepped on a Warp Trap!", Text.BrightRed), character.X, character.Y, 10); ActivateTrap(map, character.X, character.Y, script, hitlist); } } break; case 16: {// Pokemon Trap (unfinished) if (WillTrapActivate(character, map, character.X, character.Y)) { RevealTrap(map, character.X, character.Y, hitlist); hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(character.Name + " stepped on a Pokémon Trap!", Text.BrightRed), character.X, character.Y, 10); ActivateTrap(map, character.X, character.Y, script, hitlist); RemoveTrap(map, character.X, character.Y, hitlist); } } break; case 17: {// Spikes if (WillTrapActivate(character, map, character.X, character.Y)) { RevealTrap(map, character.X, character.Y, hitlist); hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(character.Name + " stepped on the Spikes!", Text.BrightRed), character.X, character.Y, 10); ActivateTrap(map, character.X, character.Y, script, hitlist); } } break; case 18: {// Toxic spikes if (WillTrapActivate(character, map, character.X, character.Y)) { RevealTrap(map, character.X, character.Y, hitlist); hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(character.Name + " stepped on the Toxic Spikes!", Text.BrightRed), character.X, character.Y, 10); ActivateTrap(map, character.X, character.Y, script, hitlist); } } break; case 19: { // Stealth Rock if (WillTrapActivate(character, map, character.X, character.Y)) { RevealTrap(map, character.X, character.Y, hitlist); hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(character.Name + " stepped on a Stealth Rock Trap!", Text.BrightRed), character.X, character.Y, 10); ActivateTrap(map, character.X, character.Y, script, hitlist); } } break; case 20: { // Void if (client != null) { if (Ranks.IsAllowed(client, Enums.Rank.Scripter)) { Messenger.PlayerWarpToVoid(client); } } } break; case 21: {//completed level x dungeon if (client != null) { client.Player.EndTempStatMode(); exPlayer.Get(client).WarpToSpawn(false); } } break; case 22: { //Anti-suicide; doesn't do anything here } break; case 23: {//sticky trap if (WillTrapActivate(character, map, character.X, character.Y)) { RevealTrap(map, character.X, character.Y, hitlist); hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(character.Name + " stepped on a Sticky Trap!", Text.BrightRed), character.X, character.Y, 10); ActivateTrap(map, character.X, character.Y, script, hitlist); } } break; case 24: {//Admin-only if (client != null) { if (Ranks.IsDisallowed(client, Enums.Rank.Moniter)) { BlockPlayer(client); Messenger.PlayerMsg(client, "You must be an Admin to get through!", Text.BrightRed); } } } break; case 25: {//mud trap if (WillTrapActivate(character, map, character.X, character.Y)) { RevealTrap(map, character.X, character.Y, hitlist); hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(character.Name + " stepped on a Mud Trap!", Text.BrightRed), character.X, character.Y, 10); ActivateTrap(map, character.X, character.Y, script, hitlist); if (Server.Math.Rand(0, 10) + 2 < map.Tile[character.X, character.Y].Data2) { RemoveTrap(map, character.X, character.Y, hitlist); } } } break; case 26: {//wonder tile if (WillTrapActivate(character, map, character.X, character.Y)) { RevealTrap(map, character.X, character.Y, hitlist); hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(character.Name + " stepped on a Wonder Tile!", Text.BrightGreen), character.X, character.Y, 10); ActivateTrap(map, character.X, character.Y, script, hitlist); } } break; case 27: {//activation if (client != null) { List<int> switches = new List<int>(); foreach (Client i in map.GetClients()) { if (i.Player.Map.Tile[i.Player.X, i.Player.Y].Type == Enums.TileType.Scripted && i.Player.Map.Tile[i.Player.X, i.Player.Y].Data1 == 27) { if (!switches.Contains(i.Player.Map.Tile[i.Player.X, i.Player.Y].Data2)) { switches.Add(i.Player.Map.Tile[i.Player.X, i.Player.Y].Data2); } } } hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(character.Name + " stepped on a switch!", Text.BrightGreen), character.X, character.Y, 50); if (switches.Count >= param1.ToInt()) { for (int x = 0; x < map.MaxX; x++) { for (int y = 0; y < map.MaxY; y++) { if (map.Tile[x, y].Type == Enums.TileType.RDungeonGoal) { map.Tile[x, y].Mask2Set = 4; map.Tile[x, y].Mask2 = 1; map.Tile[x, y].Data1 = 1; map.TempChange = true; hitlist.AddPacketToMap(map, PacketBuilder.CreateTilePacket(x, y, map)); } else if (map.Tile[x, y].Type == Enums.TileType.Scripted && map.Tile[x, y].Data1 == 27) { map.Tile[x, y].Type = Enums.TileType.Walkable; map.Tile[x, y].Fringe = 0; map.Tile[x, y].FAnim = 0; hitlist.AddPacketToMap(map, PacketBuilder.CreateTilePacket(x, y, map)); } } } hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg("The passage to the next floor was opened!", Text.BrightGreen), character.X, character.Y, 50); hitlist.AddPacketToMap(map, PacketBuilder.CreateSoundPacket("Magic127.wav"), character.X, character.Y, 50); hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleDivider(), character.X, character.Y, 50); } else if (param1.ToInt() - switches.Count == 1) { hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg("1 more needs to be pressed at the same time...", Text.BrightGreen), character.X, character.Y, 50); hitlist.AddPacketToMap(map, PacketBuilder.CreateSoundPacket("Magic126.wav"), character.X, character.Y, 50); hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleDivider(), character.X, character.Y, 50); } else { hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg((param1.ToInt() - switches.Count) + " more need to be pressed at the same time...", Text.BrightGreen), character.X, character.Y, 50); hitlist.AddPacketToMap(map, PacketBuilder.CreateSoundPacket("Magic126.wav"), character.X, character.Y, 50); hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleDivider(), character.X, character.Y, 50); } } } break; case 28: {//Trip Trap if (WillTrapActivate(character, map, character.X, character.Y)) { RevealTrap(map, character.X, character.Y, hitlist); hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(character.Name + " stepped on a Trip Trap!", Text.BrightRed), character.X, character.Y, 10); ActivateTrap(map, character.X, character.Y, script, hitlist); } } break; case 29: {//CTF Red Flag Tile if (ActiveCTF.GameState == CTF.CTFGameState.Started) { if (exPlayer.Get(client).InCTF) { if (exPlayer.Get(client).CTFSide != CTF.Teams.Red) { if (ActiveCTF.RedFlags > 0) { if (ActiveCTF.RedFlagHolder == null) { if (exPlayer.Get(client).CTFState == CTF.PlayerState.Free) { exPlayer.Get(client).CTFState = CTF.PlayerState.HoldingFlag; ActiveCTF.RedFlagHolder = client; ActiveCTF.RedFlags--; ActiveCTF.CTFMsg(client.Player.Name + " has stolen a red flag!", Text.Yellow); } } else { Messenger.PlayerMsg(client, ActiveCTF.RedFlagHolder.Player.Name + " is already holding a flag!", Text.Yellow); } } else { Messenger.PlayerMsg(client, "The red team has no more flags!", Text.Yellow); } } } } } break; case 30: {//CTF Blue Flag Tile if (ActiveCTF.GameState == CTF.CTFGameState.Started) { if (exPlayer.Get(client).InCTF && exPlayer.Get(client).CTFSide != CTF.Teams.Blue) { if (ActiveCTF.BlueFlags > 0) { if (ActiveCTF.BlueFlagHolder == null) { if (exPlayer.Get(client).CTFState == CTF.PlayerState.Free) { exPlayer.Get(client).CTFState = CTF.PlayerState.HoldingFlag; ActiveCTF.BlueFlagHolder = client; ActiveCTF.BlueFlags--; ActiveCTF.CTFMsg(client.Player.Name + " has stolen a blue flag!", Text.Yellow); } } else { Messenger.PlayerMsg(client, ActiveCTF.BlueFlagHolder.Player.Name + " is already holding a flag!", Text.Yellow); } } else { Messenger.PlayerMsg(client, "The blue team has no more flags!", Text.Yellow); } } } } break; case 31: {//CTF Red Flag Check if (ActiveCTF.GameState == CTF.CTFGameState.Started) { ActiveCTF.CheckFlag(client, CTF.Teams.Blue); } } break; case 32: {//CTF Blue Flag Check if (ActiveCTF.GameState == CTF.CTFGameState.Started) { ActiveCTF.CheckFlag(client, CTF.Teams.Red); } } break; case 33: {//R Dungeon Goal for secret rooms; doesn't do anything here client.Player.WarpToRDungeon(param1.ToInt() - 1, param2.ToInt() - 1); //if (client.Player.Map.MapType == Enums.MapType.RDungeonMap && ((RDungeonMap)client.Player.Map).RDungeonIndex > -1) { // client.Player.WarpToDungeon(((RDungeonMap)client.Player.Map).RDungeonIndex, ((RDungeonMap)client.Player.Map).RDungeonFloor + 1); //} } break; case 34: {//Reveals stairs when stepped on //if (client.Player.JobList.HasCompletedMission("dsksanasd984r487") == false) { // client.Player.JobList.AddJob("dsksanasd984r487"); //} else { // Messenger.PlayerMsg(client, "There are no special missions that you can play. Come back later!", Text.BrightRed); //} if (character.CharacterType != Enums.CharacterType.MapNpc) { RevealTrap(map, character.X, character.Y, hitlist); map.Tile[character.X, character.Y].Data1 = 35; hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg("Stairs appeared!", Text.BrightRed), character.X, character.Y, 10); } } break; case 35: {//R Dungeon secret room if (client != null && map.MapType == Enums.MapType.RDungeonMap && ((RDungeonMap)map).RDungeonIndex > -1) { InstancedMap iMap = null; PartyManager.AttemptPartyWarp(client, (Client warpClient) => { if (iMap == null) { iMap = new InstancedMap(MapManager.GenerateMapID("i")); IMap baseMap = MapManager.RetrieveMap(param1.ToInt()); MapCloner.CloneMapTiles(baseMap, iMap); MapCloner.CloneMapNpcs(baseMap, iMap); MapCloner.CloneMapGeneralProperties(baseMap, iMap); iMap.MapBase = param1.ToInt(); iMap.SpawnItems(); for (int x = 0; x < iMap.MaxX; x++) { for (int y = 0; y < iMap.MaxY; y++) { if (iMap.Tile[x, y].Type == Enums.TileType.Scripted && iMap.Tile[x, y].Data1 == 33) { //iMap.Tile[x, y].Data1 = 36; iMap.Tile[x, y].String1 = (((RDungeonMap)map).RDungeonIndex + 1).ToString(); iMap.Tile[x, y].String2 = (((RDungeonMap)map).RDungeonFloor + 2).ToString(); } else if (iMap.Tile[x, y].Type == Enums.TileType.Item) { iMap.Tile[x, y].Type = Enums.TileType.Walkable; } } } } Messenger.PlayerWarp(warpClient, iMap, param2.ToInt(), param3.ToInt()); }); } } break; case 36: {// Dungeon Entrance (Random) if (client != null) { //RDungeonManager.LoadRDungeon(param1.ToInt() - 1); Story story = DungeonRules.CreatePreDungeonStory(client, param1, param2, param3, true); StoryManager.PlayStory(client, story); //if (param3 == "") { // Messenger.AskQuestion(client, "EnterRDungeon:" + (param1.ToInt() - 1) + ":" + (param2.ToInt() - 1) + ":" + param3, "Will you go on?", -1); //} else if (param3.IsNumeric()) { // if (param3.ToInt() > 0) { //normal dungeon, has dungeon entry // Messenger.AskQuestion(client, "EnterRDungeon:" + (param1.ToInt() - 1) + ":" + (param2.ToInt() - 1) + ":" + param3, "Will you enter " + DungeonManager.Dungeons[param3.ToInt() - 1].Name + "?", -1); // } //} else { //Event dungeon; does not have an official dungeon entry // Messenger.AskQuestion(client, "EnterRDungeon:" + (param1.ToInt() - 1) + ":" + (param2.ToInt() - 1) + ":" + param3, "Will you go enter " + param3 + "?", -1); //} } } break; case 37: { // Dungeon Entrance (mapped) if (client != null) { Story story = DungeonRules.CreatePreDungeonStory(client, param1, param2, param3, false); StoryManager.PlayStory(client, story); } } break; case 38: {// Housing Center if (client != null) { exPlayer.Get(client).HousingCenterMap = client.Player.MapID; exPlayer.Get(client).HousingCenterX = client.Player.X; exPlayer.Get(client).HousingCenterY = client.Player.Y; Messenger.OpenVisitHouseMenu(client); } } break; case 39: { // Pitfall trap if (WillTrapActivate(character, map, character.X, character.Y)) { RevealTrap(map, character.X, character.Y, hitlist); hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(character.Name + " stepped on a Pitfall Trap!", Text.BrightRed), character.X, character.Y, 10); ActivateTrap(map, character.X, character.Y, script, hitlist); } } break; case 40: { // Evolution block tile if (client != null) { if (exPlayer.Get(client).EvolutionActive == false) { BlockPlayer(client); // Messenger.PlayerMsg(client, "You can't enter this room!", Text.BrightRed); } } } break; case 41: { // Boss battle if (client != null) { //BossBattles.StartBossBattle(client, param1); } } break; case 42: { // Seal Trap if (WillTrapActivate(character, map, character.X, character.Y)) { RevealTrap(map, character.X, character.Y, hitlist); hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(character.Name + " stepped on a Seal Trap!", Text.BrightRed), character.X, character.Y, 10); ActivateTrap(map, character.X, character.Y, script, hitlist); } } break; case 43: { // Slow Trap if (WillTrapActivate(character, map, character.X, character.Y)) { RevealTrap(map, character.X, character.Y, hitlist); hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(character.Name + " stepped on a Slow Trap!", Text.BrightRed), character.X, character.Y, 10); ActivateTrap(map, character.X, character.Y, script, hitlist); } } break; case 44: { // Spin Trap if (WillTrapActivate(character, map, character.X, character.Y)) { RevealTrap(map, character.X, character.Y, hitlist); hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(character.Name + " stepped on a Spin Trap!", Text.BrightRed), character.X, character.Y, 10); ActivateTrap(map, character.X, character.Y, script, hitlist); } } break; case 45: { // DungeonAttempted if (client != null) { int dungeonIndex = param1.ToInt(); int warpMap = param2.ToInt(); int warpX = param3.Split(':')[0].ToInt(); int warpY = param3.Split(':')[1].ToInt(); //Messenger.AskQuestion(client, "EnterDungeon:" + param1, "Will you enter " + DungeonManager.Dungeons[param1.ToInt()].Name + "?", -1); client.Player.AddDungeonAttempt(dungeonIndex - 1); Messenger.PlayerWarp(client, warpMap, warpX, warpY); } } break; case 46: {//Dungeon completion count incrementer if (client != null) { PartyManager.AttemptPartyWarp(client, (Client warpClient) => { int dungeonIndex = param1.ToInt(); int warpMap = param2.ToInt(); int warpX = param3.Split(':')[0].ToInt(); int warpY = param3.Split(':')[1].ToInt(); if (dungeonIndex > 0) { warpClient.Player.IncrementDungeonCompletionCount(dungeonIndex - 1, 1); PostDungeonCompletion(warpClient, dungeonIndex); } exPlayer.Get(warpClient).FirstMapLoaded = false; DungeonRules.ExitDungeon(warpClient, warpMap, warpX, warpY); }); } } break; case 47: {//Dungeon exit without increment } break; case 48: { // Removes snowballs if (client != null) { if (client.Player.HasItem(152) > 0) { client.Player.TakeItem(152, 1); } } } break; case 49: { // Sweet scent trap (summon) if (WillTrapActivate(character, map, character.X, character.Y)) { RevealTrap(map, character.X, character.Y, hitlist); hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(character.Name + " stepped on a Summon Trap!", Text.BrightRed), character.X, character.Y, 10); ActivateTrap(map, character.X, character.Y, script, hitlist); RemoveTrap(map, character.X, character.Y, hitlist); } } break; case 50: { // GRUUUUUDGE Trap (Grudge) if (WillTrapActivate(character, map, character.X, character.Y)) { RevealTrap(map, character.X, character.Y, hitlist); hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(character.Name + " stepped on a Grudge Trap!", Text.BrightRed), character.X, character.Y, 10); ActivateTrap(map, character.X, character.Y, script, hitlist); RemoveTrap(map, character.X, character.Y, hitlist); } } break; case 51: { // SelfDestruct Trap if (WillTrapActivate(character, map, character.X, character.Y)) { RevealTrap(map, character.X, character.Y, hitlist); hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(character.Name + " stepped on a Selfdestruct Trap!", Text.BrightRed), character.X, character.Y, 10); ActivateTrap(map, character.X, character.Y, script, hitlist); } } break; case 52: { // Sleep Trap /slumber if (WillTrapActivate(character, map, character.X, character.Y)) { RevealTrap(map, character.X, character.Y, hitlist); hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(character.Name + " stepped on a Slumber Trap!", Text.BrightRed), character.X, character.Y, 10); ActivateTrap(map, character.X, character.Y, script, hitlist); } } break; case 53: { // Fan Trap /Gust if (WillTrapActivate(character, map, character.X, character.Y)) { RevealTrap(map, character.X, character.Y, hitlist); hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(character.Name + " stepped on a Gust Trap!", Text.BrightRed), character.X, character.Y, 10); ActivateTrap(map, character.X, character.Y, script, hitlist); } } break; case 54: { // Arena if (client != null) { bool canEnter = true; for (int i = 1; i <= client.Player.MaxInv; i++) { if (client.Player.Inventory[i].Num > 0 && ItemManager.Items[client.Player.Inventory[i].Num].Type != Enums.ItemType.Held && ItemManager.Items[client.Player.Inventory[i].Num].Type != Enums.ItemType.HeldByParty && ItemManager.Items[client.Player.Inventory[i].Num].Type != Enums.ItemType.HeldInBag) { bool held = false; for (int j = 0; j < Constants.MAX_ACTIVETEAM; j++) { if (client.Player.Team[j] != null && client.Player.Team[j].HeldItemSlot == i) { held = true; } } if (!held) canEnter = false; } } if (!canEnter) { Story story = new Story(); StorySegment segment = new StorySegment(); segment.Action = Enums.StoryAction.Say; segment.AddParameter("Text", "Notice: You can only enter the arena with held-effect, team-effect, or bag-effect items. Any other item must be held by a team member."); segment.AddParameter("Mugshot", "-1"); segment.Parameters.Add("Speed", "0"); segment.Parameters.Add("PauseLocation", "0"); story.Segments.Add(segment); segment = new StorySegment(); segment.Action = Enums.StoryAction.AskQuestion; segment.AddParameter("Question", "All items that do not fit arena restrictions will be sent to storage. Is that OK?"); segment.AddParameter("SegmentOnYes", (story.Segments.Count + 2).ToString()); segment.AddParameter("SegmentOnNo", (story.Segments.Count + 3).ToString()); segment.AddParameter("Mugshot", "-1"); story.Segments.Add(segment); segment = new StorySegment(); segment.Action = Enums.StoryAction.RunScript; segment.AddParameter("ScriptIndex", "61"); segment.AddParameter("ScriptParam1", param1); segment.AddParameter("ScriptParam2", param2); segment.AddParameter("ScriptParam3", param3); segment.AddParameter("Pause", "1"); story.Segments.Add(segment); StoryManager.PlayStory(client, story); } else { EnterArena(client, character, map, param2, param3, hitlist); } } } break; case 55: { // Staff Elevator if (client != null) { if (Ranks.IsAllowed(client, Enums.Rank.Moniter)) { // TODO: OpenStaffElevator(client); } } } break; case 56: { // Pitch-Black Abyss warps if (client != null) { //if DungeonMap.Length < 1 //GenerateMap /*Enums.Direction dir; if (param1.ToInt() == 1) { dir = Enums.Direction.Up; } else if (param1.ToInt() == 2) { dir = Enums.Direction.Down; } else if (param1.ToInt() == 3) { dir = Enums.Direction.Left; } else { //param1.ToInt() = 4 dir = Enums.Direction.Right; }*/ //switch to use dir when done rewriting GetDungeonRoom if (exPlayer.Get(client).DungeonGenerated == false) { PitchBlackAbyss.GenerateMap(client); } PitchBlackAbyss.GetDungeonRoom(client, param1.ToInt()); } } break; case 57: { // Pitch-Black Abyss entrance if (client != null) { if (client.Player.MapID == MapManager.GenerateMapID(1545)) { //easy PBA PitchBlackAbyss.InitializeMap(client, PitchBlackAbyss.Difficulty.Easy); PitchBlackAbyss.GenerateMap(client); Story story = DungeonRules.CreatePreDungeonStory(client, "1546", "9:9", "22", false); StoryManager.PlayStory(client, story); } } } break; case 58: { // Electrostasis Tower Electrolock tile if (client != null) { ElectrostasisTower.SteppedOnElectrolock(client, param1.ToInt()); } } break; case 59: { // Electrostasis Tower Sublevel Setter if (client != null) { string[] splitData = param2.Split(':'); ElectrostasisTower.SetSublevelCheckpoint(client, param1.ToInt(), splitData[0], splitData[1].ToInt(), splitData[2].ToInt()); } } break; case 60: { // Warp to tournament hub if (client != null) { if (client.Player.Tournament != null) { client.Player.Tournament.WarpToHub(client); } } } break; case 61: { // Warp to tournament combat map if (client != null) { if (client.Player.Tournament != null && client.Player.TournamentMatchUp != null) { client.Player.TournamentMatchUp.WarpToCombatMap(client); } } } break; case 62: { // Open tournament spectator selection list if (client != null) { if (client.Player.Tournament == null) { Messenger.SendTournamentSpectateListingTo(client, null); } else { client.Player.Tournament.WarpToHub(client); } } } break; case 63: { // Leave tournament waiting room if (client != null) { if (client.Player.TournamentMatchUp == null) { // Prevent leaving if the player is in a match-up if (client.Player.Tournament != null) { client.Player.Tournament.RemoveRegisteredPlayer(client); } Messenger.PlayerWarp(client, 1192, 10, 10); } } } break; case 64: { if (exPlayer.Get(client).StoryEnabled) { int[] rangeStart; int[] rangeEnd; string[] data1 = param1.Split('!'); string[] data2 = param2.Split(':'); rangeStart = new int[data1.Length]; rangeEnd = new int[data1.Length]; for (int i = 0; i < data1.Length; i++) { string[] vals = data1[i].Split(':'); rangeStart[i] = vals[0].ToInt(); rangeEnd[i] = vals[1].ToInt(); } int currentStorySection = client.Player.StoryHelper.ReadSetting("[MainStory]-CurrentSection").ToInt(); for (int i = 0; i < rangeStart.Length; i++) { if (currentStorySection >= rangeStart[i] && currentStorySection <= rangeEnd[i]) { BlockPlayer(client); Messenger.PlayerMsg(client, data2[i], Text.BrightRed); break; } } } } break; case 65: {//dungeon completion block if (client != null) { if (client.Player.GetDungeonCompletionCount(param1.ToInt() - 1) < 1) { BlockPlayer(client); Messenger.PlayerMsg(client, "You must complete " + DungeonManager.Dungeons[param1.ToInt() - 1].Name + " to get through!", Text.BrightRed); } } } break; case 66: {// Delite Plaza exit warp if (!string.IsNullOrEmpty(exPlayer.Get(client).PlazaEntranceMap)) { Messenger.PlayerWarp(client, exPlayer.Get(client).PlazaEntranceMap, exPlayer.Get(client).PlazaEntranceX, exPlayer.Get(client).PlazaEntranceY); exPlayer.Get(client).PlazaEntranceMap = null; exPlayer.Get(client).PlazaEntranceX = 0; exPlayer.Get(client).PlazaEntranceY = 0; } else { Messenger.PlayerWarp(client, 737, 6, 41); } } break; case 67: {// Auction master + bid winner only if (client.Player.CharID != Auction.AuctionMaster && client.Player.CharID != Auction.LastAuctionMaster && client.Player.Name != Auction.HighestBidder && Ranks.IsDisallowed(client, Enums.Rank.Moniter)) { BlockPlayer(client); } } break; case 68: {// key-blocked next floor of different dungeon if (client != null) { int slot = 0; for (int i = 1; i <= client.Player.Inventory.Count; i++) { if (client.Player.Inventory[i].Num == param2.ToInt() && !client.Player.Inventory[i].Sticky) { slot = i; break; } } if (slot > 0) { Messenger.AskQuestion(client, "UseItem:" + param2, "Will you use your " + ItemManager.Items[param2.ToInt()].Name + " on this tile?", -1); } else { Messenger.PlaySoundToMap(client.Player.MapID, "magic132.wav"); //Messenger.PlayerMsg(client, Server.RDungeons.RDungeonManager.RDungeons[param1.ToInt()-1].DungeonName, Text.Pink); Messenger.PlayerMsg(client, "There is a peculiar marking on the floor... It seems to need a key.", Text.BrightRed); } } } break; case 69: {// next floor of different dungeon if (client != null) { PartyManager.AttemptPartyWarp(client, (Client warpClient) => { warpClient.Player.WarpToRDungeon(param1.ToInt() - 1, ((RDungeonMap)warpClient.Player.Map).RDungeonFloor + 1); }); } } break; case 70: { // Shocker Trap if (WillTrapActivate(character, map, character.X, character.Y)) { RevealTrap(map, character.X, character.Y, hitlist); hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(character.Name + " stepped on a Shocker Trap!", Text.BrightRed), character.X, character.Y, 10); ActivateTrap(map, character.X, character.Y, script, hitlist); } } break; case 71: {// fossil revival if (client != null) { if (Server.Globals.ServerTime != Enums.Time.Night) { Story story = new Story(); StoryBuilderSegment segment = StoryBuilder.BuildStory(); if (string.IsNullOrEmpty(param1)) { StoryBuilder.AppendSaySegment(segment, "The light of " + Server.Globals.ServerTime.ToString().ToLower() + " is seeping down from above.", -1, 0, 0); } else if (param1.ToInt() == 1) { StoryBuilder.AppendSaySegment(segment, "A bizzare light of " + Server.Globals.ServerTime.ToString().ToLower() + " is seeping down from above.", -1, 0, 0); } segment.AppendToStory(story); StoryManager.PlayStory(client, story); } else { int slot = 0; int itemNum = -1; for (int i = 1; i <= client.Player.Inventory.Count; i++) { if (string.IsNullOrEmpty(param1)) { if (client.Player.Inventory[i].Num >= 791 && client.Player.Inventory[i].Num <= 799 && !client.Player.Inventory[i].Sticky) { slot = i; itemNum = client.Player.Inventory[i].Num; break; } } else if (param1.ToInt() == 1) { if (client.Player.Inventory[i].Num == 846 && !client.Player.Inventory[i].Sticky) { slot = i; itemNum = client.Player.Inventory[i].Num; break; } } } if (slot > 0) { if (string.IsNullOrEmpty(param1)) { Messenger.AskQuestion(client, "UseItem:" + itemNum, "Red moonlight is pouring down from above... Will you hold up your " + ItemManager.Items[itemNum].Name + " to the light?", -1); } else if (param1.ToInt() == 1) { Messenger.AskQuestion(client, "UseItem:" + itemNum, "Your Wonder Egg is emanating a strong aura. Will you hold up your " + ItemManager.Items[itemNum].Name + " to the light?", -1); } Messenger.PlaySoundToMap(client.Player.MapID, "magic848.wav"); } else { Story story = new Story(); StoryBuilderSegment segment = StoryBuilder.BuildStory(); if (string.IsNullOrEmpty(param1)) { StoryBuilder.AppendSaySegment(segment, "Red moonlight is pouring down from above...", -1, 0, 0); } else if (param1.ToInt() == 1) { StoryBuilder.AppendSaySegment(segment, "A bizzare light is seeping down from above...", -1, 0, 0); } segment.AppendToStory(story); StoryManager.PlayStory(client, story); Messenger.PlaySoundToMap(client.Player.MapID, "magic848.wav"); } } } } break; case 72: { // Warp to hard mode entrance if (client != null) { if (Ranks.IsAllowed(client, Enums.Rank.Moniter)) { Messenger.PlayerWarp(client, param1.ToInt(), param2.ToInt(), param3.ToInt()); } } } break; case 73: { // Warp from hard mode entrance if (client != null) { if (Ranks.IsAllowed(client, Enums.Rank.Moniter)) { Messenger.PlayerWarp(client, param1.ToInt(), param2.ToInt(), param3.ToInt()); } } } break; case 74: { // Tanren Arena if (client != null) { bool canEnter = true; for (int i = 1; i <= client.Player.MaxInv; i++) { if (client.Player.Inventory[i].Num > 0 && ItemManager.Items[client.Player.Inventory[i].Num].Type != Enums.ItemType.Held && ItemManager.Items[client.Player.Inventory[i].Num].Type != Enums.ItemType.HeldByParty && ItemManager.Items[client.Player.Inventory[i].Num].Type != Enums.ItemType.HeldInBag) { bool held = false; for (int j = 0; j < Constants.MAX_ACTIVETEAM; j++) { if (client.Player.Team[j] != null && client.Player.Team[j].HeldItemSlot == i) { held = true; } } if (!held) canEnter = false; } } if (!canEnter) { Story story = new Story(); StorySegment segment = new StorySegment(); segment.Action = Enums.StoryAction.Say; segment.AddParameter("Text", "Notice: You can only enter the arena with held-effect, team-effect, or bag-effect items. Any other item must be held by a team member."); segment.AddParameter("Mugshot", "-1"); segment.Parameters.Add("Speed", "0"); segment.Parameters.Add("PauseLocation", "0"); story.Segments.Add(segment); segment = new StorySegment(); segment.Action = Enums.StoryAction.AskQuestion; segment.AddParameter("Question", "All items that do not fit arena restrictions will be sent to storage. Is that OK?"); segment.AddParameter("SegmentOnYes", (story.Segments.Count + 2).ToString()); segment.AddParameter("SegmentOnNo", (story.Segments.Count + 3).ToString()); segment.AddParameter("Mugshot", "-1"); story.Segments.Add(segment); segment = new StorySegment(); segment.Action = Enums.StoryAction.RunScript; segment.AddParameter("ScriptIndex", "61"); segment.AddParameter("ScriptParam1", param1); segment.AddParameter("ScriptParam2", param2); segment.AddParameter("ScriptParam3", param3); segment.AddParameter("Pause", "1"); story.Segments.Add(segment); StoryManager.PlayStory(client, story); } else { client.Player.BeginTempStatMode(50, true); EnterArena(client, character, map, param2, param3, hitlist); } } } break; case 75: { for (int i = 1; i <= client.Player.MaxInv; i++) { if (client.Player.Inventory[i].Num > -1) { BlockPlayer(client); Messenger.PlayerMsg(client, "You cannot have any items in your inventory!", Text.Red); break; } } for (int j = 1; j < Constants.MAX_ACTIVETEAM; j++) { if (client.Player.Team[j] != null) { BlockPlayer(client); Messenger.PlayerMsg(client, "You cannot have any team members in your team!", Text.Red); break; } } } break; case 76: {//Dive if (client != null) { Messenger.PlayerMsg(client, "The water goes pretty deep here...", Text.Grey); //Messenger.PlaySound(client, "Magic477.wav"); hitlist.AddPacket(client, PacketBuilder.CreateSoundPacket("Magic477.wav")); } } break; case 77: { // Asks a question if (client != null) { int slot = 0; int itemNum = -1; int npcToSpawn = param1.ToInt(); int itemToUse = param2.ToInt(); string questionAsked = param3; for (int i = 1; i <= client.Player.Inventory.Count; i++) { if (client.Player.Inventory[i].Num == param2.ToInt() && !client.Player.Inventory[i].Sticky) { slot = i; itemNum = client.Player.Inventory[i].Num; break; } } if (slot > 0) { Messenger.AskQuestion(client, "UseItem:" + itemNum, param3, -1); } } } break; case 78: {// warp everyone to respective locations if (client != null) { IMap sourceMap = client.Player.Map; Tile clientTile = sourceMap.Tile[client.Player.X, client.Player.Y]; if (client.Player.PartyID == null) { Messenger.PlayerWarp(client, clientTile.String1.ToInt(), clientTile.String2.ToInt(), clientTile.String3.ToInt()); } else { bool warp = true; Party party = PartyManager.FindPlayerParty(client); foreach (Client member in party.GetOnlineMemberClients()) { Tile tile = sourceMap.Tile[member.Player.X, member.Player.Y]; if (/*!member.Player.Dead &&*/ member.Player.MapID == client.Player.MapID && (clientTile.Type != tile.Type || clientTile.Data1 != tile.Data1 || clientTile.String1 != tile.String1)) { warp = false; } } if (warp) { foreach (Client member in party.GetOnlineMemberClients()) { if (member.Player.Map != sourceMap) continue; Tile tile = sourceMap.Tile[member.Player.X, member.Player.Y]; Messenger.PlayerWarp(member, tile.String1.ToInt(), tile.String2.ToInt(), tile.String3.ToInt()); } } else { Messenger.PlayerMsg(client, "All surviving players must be on the East or West stairs in order to continue.", Text.WhiteSmoke); } } } } break; } PacketHitList.MethodEnded(ref hitlist); } catch (Exception ex) { Messenger.AdminMsg("Error: ScriptedTile", Text.Black); Messenger.AdminMsg(script + ", " + param1 + " " + param2 + " " + param3, Text.Black); Messenger.AdminMsg(map.Name, Text.Black); Messenger.AdminMsg(ex.ToString(), Text.Black); } }
public static InstancedMap CreateInstancedMap(IMap sourceMap) { DataManager.Maps.InstancedMap dmInstancedMap = new DataManager.Maps.InstancedMap(MapManager.GenerateMapID("i")); InstancedMap iMap = new InstancedMap(dmInstancedMap); CloneMapTileProperties(sourceMap, iMap); CloneMapTiles(sourceMap, iMap); CloneMapGeneralProperties(sourceMap, iMap); CloneMapNpcs(sourceMap, iMap); return iMap; }