public void UnloadSnowballGame() { InSnowballGame = false; SnowballGameLives = 0; SnowballGameInstance = null; SnowballGameSide = SnowballGame.Teams.Green; }
public static void QuestionResult(Client client, string questionID, string answer) { try { if (questionID.StartsWith("EnterRDungeon") && answer == "Yes") { if (questionID.Split(':')[3] == "") { client.Player.WarpToRDungeon(questionID.Split(':')[1].ToInt(), questionID.Split(':')[2].ToInt(0)); } else if (questionID.Split(':')[3].IsNumeric()) { if (DungeonManager.Dungeons[questionID.Split(':')[3].ToInt()].ScriptList.ContainsKey(2)) { //Story warningStory = DungeonRules.GetEntranceWarning(client, DungeonManager.Dungeons[questionID.Split(':')[3].ToInt()].Name, // DungeonManager.Dungeons[questionID.Split(':')[3].ToInt()].ScriptList[2].Split(';')); } else { client.Player.WarpToRDungeon(questionID.Split(':')[1].ToInt(), questionID.Split(':')[2].ToInt(0)); client.Player.AddDungeonAttempt(questionID.Split(':')[3].ToInt() - 1); } } else { } } if (questionID.StartsWith("Level1RDungeon") && answer == "Yes") { client.Player.BeginTempStatMode(questionID.Split(':')[3].ToInt(), true); client.Player.WarpToRDungeon(questionID.Split(':')[1].ToInt(), questionID.Split(':')[2].ToInt(0)); } if (questionID.StartsWith("SkyDrop") && answer == "Yes") { string[] param = questionID.Split(':'); Messenger.PlayerWarp(client, param[1].ToInt(), param[2].ToInt(), param[3].ToInt()); } if (questionID.StartsWith("SummonGuardian")) { if (answer == "Cancel") { } else if (answer == "Others") { string[] idArray = questionID.Split(':'); int page = idArray[1].ToInt() + 1; string[] choicesNum = idArray[2].Split(';'); if (choicesNum.Length > 1) { List<string> choices = new List<string>(); if (5*page >= choicesNum.Length-1) { page = 0; } for (int i = 5*page; i < choicesNum.Length-1; i++) { if (choices.Count >= 5) { break; } choices.Add("#" + choicesNum[i] + ": " + Pokedex.GetPokemon(choicesNum[i].ToInt()).Name); } choices.Add("Others"); choices.Add("Cancel"); Messenger.AskQuestion(client, "SummonGuardian:"+ page + ":" + idArray[2], "Which ally will you call forth?", -1, choices.ToArray()); } } else { int legendNumber = answer.Substring(1).Split(':')[0].ToInt(); Messenger.PlayerMsg(client, "A light shot up from the Mystery Part, and " + Pokedex.GetPokemon(legendNumber).Name + "'s guardian sign pierced the skies asunder!", Text.Cyan); Messenger.PlaySoundToMap(client.Player.MapID, "magic767.wav"); bool taken = false; for (int i = 0; i < Constants.MAX_ACTIVETEAM; i++) { if (client.Player.Team[i] != null && client.Player.Team[i].Loaded) { if (client.Player.Team[i].Species == legendNumber) { taken = true; break; } } } if (client.Player.PartyID != null) { Party party = PartyManager.FindPlayerParty(client); foreach (string memberID in party.GetMemberCharacters()) { Client n = ClientManager.FindClientFromCharID(memberID); if (n != null) { for (int i = 0; i < Constants.MAX_ACTIVETEAM; i++) { if (n.Player.Team[i] != null && n.Player.Team[i].Loaded) { if (n.Player.Team[i].Species == legendNumber) { taken = true; break; } } } } else { using (DatabaseConnection dbConnection = new DatabaseConnection(DatabaseID.Players)) { List<PMDCP.DatabaseConnector.MySql.DataColumnCollection> rows = dbConnection.Database.RetrieveRows("SELECT D.Species FROM pmdcp_players.recruit_data D " + "WHERE D.CharID = \'" + memberID + "\';"); if (rows != null) { for (int i = 0; i < rows.Count; i++) { if (rows[i]["Species"].ValueString.ToInt() == legendNumber) { taken = true; break; } } } } } } } if (!taken) { int openSlot = client.Player.FindOpenTeamSlot(); if (openSlot > -1) { client.Player.AddToTeamTemp(openSlot, legendNumber, 0, 100, (Constants.MAX_JOB_LIST + openSlot)); Messenger.PlayerMsg(client, Server.Pokedex.Pokedex.GetPokemon(legendNumber).Name + " joined the team!", Text.BrightGreen); Messenger.SendActiveTeam(client); } } else { Messenger.PlayerMsg(client, "But " + Server.Pokedex.Pokedex.GetPokemon(legendNumber).Name + " is already an ally!", Text.BrightGreen); } } } if (questionID.StartsWith("UseItem")) { if (answer == "Yes") { int num = questionID.Split(':')[1].ToInt(); int slot = 0; for (int i = 1; i <= client.Player.Inventory.Count; i++) { if (client.Player.Inventory[i].Num == num && !client.Player.Inventory[i].Sticky) { slot = i; break; } } //Messenger.PlayerMsg(client, "yes" + slot, Text.Blue); if (slot > 0) { client.Player.UseItem(client.Player.Inventory[slot], slot); } } } // Called when a player answers a yes/no question switch (questionID) { case "Appraisal": { if (answer == "Yes") { 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 (client.Player.HasItem(1) >= 150 * boxes) { client.Player.TakeItem(1, 150 * boxes, true); 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) { OpenBox(client, client.Player.Inventory[i], i); } } Messenger.PlaySoundToMap(client.Player.MapID, "magic227.wav"); Story story = new Story(); StoryBuilderSegment segment = StoryBuilder.BuildStory(); StoryBuilder.AppendSaySegment(segment, "All treasure boxes were opened!", -1, 0, 0); segment.AppendToStory(story); StoryManager.PlayStory(client, story); } else { Messenger.PlayerMsg(client, "You do not have enough to open your boxes!", Text.BrightRed); } } } break; case "Unsticky": { if (answer == "Yes") { for (int i = 1; i <= client.Player.Inventory.Count; i++) { if (client.Player.Inventory[i].Sticky) { client.Player.SetItemSticky(i, false); } } Messenger.PlaySoundToMap(client.Player.MapID, "magic231.wav"); //Messenger.PlayerMsg(client, "All sticky items have been cleansed!", Text.Cyan); Story story = new Story(); StoryBuilderSegment segment = StoryBuilder.BuildStory(); StoryBuilder.AppendSaySegment(segment, "All sticky items have been cleansed!", -1, 0, 0); segment.AppendToStory(story); StoryManager.PlayStory(client, story); } } break; case "TradeEgg": { if (answer == "Yes") { int takenItem = 0; for (int i = 1; i <= client.Player.Inventory.Count; i++) { if (client.Player.Inventory[i].Num == 110 || client.Player.Inventory[i].Num == 109 || client.Player.Inventory[i].Num == 131) { takenItem = i; } } Messenger.PlaySoundToMap(client.Player.MapID, "magic693.wav"); client.Player.TakeItemSlot(takenItem, 1, true); client.Player.GiveItem(538, 1, "641;642;643;644;645;646;647;648;649;650;651;652;653;654;655;656;657;" + "661;662;663;664;665;666;667;668;669;670;671;672;673;674;675;676;677", false); //Messenger.PlayerMsg(client, "You were given a gift in exchange for the Egg!", Text.BrightGreen); Story story = new Story(); StoryBuilderSegment segment = StoryBuilder.BuildStory(); StoryBuilder.AppendSaySegment(segment, "You were given a gift in exchange for the Egg!", -1, 0, 0); segment.AppendToStory(story); StoryManager.PlayStory(client, story); } else { Story story = new Story(); StoryBuilderSegment segment = StoryBuilder.BuildStory(); StoryBuilder.AppendSaySegment(segment, "Well, then I hope you take good care of it!", Pokedex.FindByName("Togekiss").ID, 0, 0); segment.AppendToStory(story); StoryManager.PlayStory(client, story); } } break; case "RecallEggMove": { if (answer == "Yes") { client.Player.TakeItem(702, 1, true); Story story = new Story(); StoryBuilderSegment segment = StoryBuilder.BuildStory(); StoryBuilder.AppendSaySegment(segment, "Okay, here goes!", Pokedex.FindByName("Togetic").ID, 0, 0); StoryBuilder.AppendRunScriptAction(segment, 48, "", "", "", true); segment.AppendToStory(story); StoryManager.PlayStory(client, story); } else { Story story = new Story(); StoryBuilderSegment segment = StoryBuilder.BuildStory(); StoryBuilder.AppendSaySegment(segment, "Well, alright then! Let me know when you feel like learning something fun!", Pokedex.FindByName("Togetic").ID, 0, 0); segment.AppendToStory(story); StoryManager.PlayStory(client, story); } } break; case "LearnTutorMove": { int item = 0; if (answer == ItemManager.Items[263].Name) { item = 263; } else if (answer == ItemManager.Items[264].Name) { item = 264; } else if (answer == ItemManager.Items[265].Name) { item = 265; } else if (answer == ItemManager.Items[266].Name) { item = 266; } if (item > 0 && client.Player.HasItem(item) > 0) { client.Player.TakeItem(item, 1, true); Story story = new Story(); StoryBuilderSegment segment = StoryBuilder.BuildStory(); StoryBuilder.AppendSaySegment(segment, "Very well, let us commence!", Pokedex.FindByName("Bronzong").ID, 0, 0); StoryBuilder.AppendRunScriptAction(segment, 71, item.ToString(), "", "", true); segment.AppendToStory(story); StoryManager.PlayStory(client, story); } else { Story story = new Story(); StoryBuilderSegment segment = StoryBuilder.BuildStory(); StoryBuilder.AppendSaySegment(segment, "Very well. I shall wait here until you wish to part with your shards.", Pokedex.FindByName("Bronzong").ID, 0, 0); segment.AppendToStory(story); StoryManager.PlayStory(client, story); } } break; case "ShellBell": { if (answer == "Yes") { int shellCount = 0; int saltCount = 0; for (int i = 1; i <= client.Player.Inventory.Count; i++) { if (client.Player.Inventory[i].Num == 96) { shellCount++; } else if (client.Player.Inventory[i].Num == 102) { saltCount++; } } if (saltCount >= 5 && shellCount >= 5) { for (int i = 0; i < 5; i++) { client.Player.TakeItem(96, 1, true); client.Player.TakeItem(102, 1, true); } Story story = new Story(); StoryBuilderSegment segment = StoryBuilder.BuildStory(); StoryBuilder.AppendSaySegment(segment, "Okay, just give me a moment...", Pokedex.FindByName("Oshawott").ID, 0, 0); StoryBuilder.AppendPauseAction(segment, 1500); StoryBuilder.AppendSaySegment(segment, "Ta-da! Here you go!", Pokedex.FindByName("Oshawott").ID, 0, 0); StoryBuilder.AppendRunScriptAction(segment, 35, "", "", "", true); StoryBuilder.AppendPauseAction(segment, 1000); StoryBuilder.AppendAskQuestionAction(segment, "So what'ja think? You like it?", segment.Segments.Count + 2, segment.Segments.Count + 4, Pokedex.FindByName("Oshawott").ID); StoryBuilder.AppendSaySegment(segment, "Awww, gee... thanks!", Pokedex.FindByName("Oshawott").ID, 0, 0); StoryBuilder.AppendGoToSegmentAction(segment, segment.Segments.Count + 5); StoryBuilder.AppendSaySegment(segment, "Oh...", Pokedex.FindByName("Oshawott").ID, 0, 0); StoryBuilder.AppendPauseAction(segment, 500); StoryBuilder.AppendSaySegment(segment, "I'm sorry...", Pokedex.FindByName("Oshawott").ID, 0, 0); segment.AppendToStory(story); StoryManager.PlayStory(client, story); } } else { Story story = new Story(); StoryBuilderSegment segment = StoryBuilder.BuildStory(); StoryBuilder.AppendSaySegment(segment, "You- you don't?", Pokedex.FindByName("Oshawott").ID, 0, 0); StoryBuilder.AppendSaySegment(segment, "Well... okay...", Pokedex.FindByName("Oshawott").ID, 0, 0); segment.AppendToStory(story); StoryManager.PlayStory(client, story); } } break; case "HouseSpawn": { if (answer == "Yes") { if (client.Player.Map.MapType == Server.Enums.MapType.House && ((House)client.Player.Map).OwnerID == client.Player.CharID) { if (client.Player.HasItem(1) >= 500) { client.Player.TakeItem(1, 500, true); ((House)client.Player.Map).StartX = client.Player.X; ((House)client.Player.Map).StartY = client.Player.Y; client.Player.Map.Save(); Messenger.PlayerMsg(client, "You have set your house's entrance point!", Text.BrightGreen); } else { Messenger.PlayerMsg(client, "You don't have enough " + ItemManager.Items[1].Name + "!", Text.BrightRed); } } else { Messenger.PlayerMsg(client, "You can't set your house entrance here!", Text.BrightRed); } } } break; case "HouseRoof": { if (answer == "Yes") { if (client.Player.Map.MapType == Server.Enums.MapType.House && ((House)client.Player.Map).OwnerID == client.Player.CharID) { if (client.Player.HasItem(1) >= 500) { client.Player.TakeItem(1, 500, true); client.Player.Map.Indoors = !client.Player.Map.Indoors; client.Player.Map.Save(); if (client.Player.Map.Indoors) { Messenger.PlayerMsg(client, "You have closed your house's roof!", Text.BrightGreen); } else { Messenger.PlayerMsg(client, "You have opened your house's roof!", Text.BrightGreen); } Messenger.RefreshMap(client); } else { Messenger.PlayerMsg(client, "You don't have enough " + ItemManager.Items[1].Name + "!", Text.BrightRed); } } else { Messenger.PlayerMsg(client, "You can't set your house entrance here!", Text.BrightRed); } } } break; case "DiglettMission": { if (answer == "Yes") { StoryManager.PlayStory(client, 415); } else { StoryManager.PlayStory(client, 414); } } break; case "FerryTicketUse": {//originally used in place of Keyblocks during exploitations of the Refresh Glitch. if (answer == "Yes") { client.Player.TakeItem(49, 1); Messenger.PlayerWarp(client, 880, 16, 12); } else { Messenger.PlayerMsg(client, "Ok. Come back later!", Text.Yellow); } } break; case "MassWarpAuction": { if (answer == "Yes") { Messenger.PlayerWarp(client, 363, 10, 13); } } break; case "WarptoForlorn": { if (answer == "Yes") { Messenger.PlayerWarp(client, 684, 4, 29); } //if (answer == true) { // NetScript.PlayerWarp(index, 1109, 10, 7); //} } break; case "WarptoTanren": { if (answer == "Yes") { Messenger.PlayerWarp(client, 78, 37, 19); } //if (answer == true) { // NetScript.PlayerWarp(index, 390, 9, 10); //} } break; case "uselotteryticket": { if (answer == "Yes") { Lottery.VerifyWinner(client); } } break; case "buylotteryticket": { if (answer == "Yes") { Lottery.BuyLotteryTicket(client); } } break; case "Fireplace": { if (answer == "Yes") { //Messenger.SpellAnim(452, client.Player.MapID, 15, 4); Messenger.PlaySoundToMap(client.Player.MapID, "magic68.wav"); StoryManager.PlayStory(client, 35); } } break; case "Surf": { if (answer == "Yes") { int surfSlot = -1; for (int i = 0; i < Constants.MAX_PLAYER_MOVES; i++) { if (client.Player.GetActiveRecruit().Moves[i].MoveNum == 462) { surfSlot = i; } } if (surfSlot > -1) { client.Player.GetActiveRecruit().UseMove(surfSlot); } } } break; case "RockClimb": { if (answer == "Yes") { int surfSlot = -1; for (int i = 0; i < Constants.MAX_PLAYER_MOVES; i++) { if (client.Player.GetActiveRecruit().Moves[i].MoveNum == 456) { surfSlot = i; } } if (surfSlot > -1) { client.Player.GetActiveRecruit().UseMove(surfSlot); } } } break; case "AbandonedMansion": { if (answer == "Yes") { StoryManager.PlayStory(client, 297); //NetScript.AskQuestion(index, "AbandonedMansion2", "Only the team leader may enter this dungeon, is that OK?", -1); } } break; case "AbandonedMansion2": { //Debug.Print("---"); if (answer == "Yes") { if (client.Player.MapID == MapManager.GenerateMapID(743)) { if (client.Player.X == 11) { Messenger.PlaySoundToMap(client.Player.MapID, "key.wav"); client.Player.TakeItem(249, 1); Messenger.PlayerMsg(client, "The key dissolves.", Text.Yellow); client.Player.WarpToRDungeon(16, 0); } else if (client.Player.X == 21) { Messenger.PlaySoundToMap(client.Player.MapID, "key.wav"); client.Player.TakeItem(248, 1); Messenger.PlayerMsg(client, "The key dissolves.", Text.Yellow); client.Player.WarpToRDungeon(15, 0); } else if (client.Player.X == 16) { Messenger.PlaySoundToMap(client.Player.MapID, "key.wav"); client.Player.TakeItem(252, 1); Messenger.PlayerMsg(client, "The key dissolves.", Text.Yellow); client.Player.WarpToRDungeon(17, 0); } } } } break; case "WarptoPokehallow": { if (answer == "Yes") { Messenger.PlayerWarp(client, 743, 16, 11); } } break; case "HallowedWell": { if (answer == "Yes") { StoryManager.PlayStory(client, 294); } } break; case "HallowedWell2": { if (answer == "Yes") { Messenger.PlaySoundToMap(client.Player.MapID, "DeepFall.wav"); client.Player.WarpToRDungeon(20, 0); } } break; case "AfterDeath": { switch (answer) { case "Revive": { AskReviveQuestion(client); } break; case "Switch": { AskRecruitSwapQuestion(client); } break; case "Escape": { Messenger.AskQuestion(client, "Escape", "Will you use your Escape Rope to retreat from the dungeon? It will not count as a defeat.", -1); } break; case "Give Up": { GiveUp(client); } break; } } break; case "AfterDeathRevive": { if (answer == ItemManager.Items[489].Name) { ActivateRevivalItem(client, 489); } else if (answer == ItemManager.Items[452].Name) { ActivateRevivalItem(client, 452); } else if (answer == ItemManager.Items[451].Name) { ActivateRevivalItem(client, 451); } else if (answer == ItemManager.Items[450].Name) { ActivateRevivalItem(client, 450); } else if (answer == ItemManager.Items[749].Name) { ActivateRevivalItem(client, 749); } else { AskAfterDeathQuestion(client); } } break; case "AfterDeathSwap": { if (answer.StartsWith("Slot #")) { int slot = answer.Substring(6).ToInt() - 1; int activeSlot = client.Player.ActiveSlot; string name = client.Player.GetActiveRecruit().Name; List<ExtraStatus> passedStatus = GetTeamStatus(client.Player.GetActiveRecruit()); foreach (ExtraStatus status in passedStatus) { client.Player.GetActiveRecruit().VolatileStatus.Add(status); Messenger.BattleMsg(client, status.Name, Text.BrightRed); } client.Player.SwapActiveRecruit(slot, true); client.Player.RestoreRecruitStats(activeSlot); client.Player.RemoveFromTeam(activeSlot); client.Player.Dead = false; PacketHitList hitlist = null; PacketHitList.MethodStart(ref hitlist); PacketBuilder.AppendDead(client, hitlist); PacketHitList.MethodEnded(ref hitlist); Messenger.SendActiveTeam(client); } else { AskAfterDeathQuestion(client); } } break; case "GiveUp": { if (answer == "Yes") { Messenger.MapMsg(client.Player.MapID, client.Player.Name + " has given-up on the exploration!", Text.BrightRed); client.Player.GetActiveRecruit().StatusAilment = Enums.StatusAilment.OK; client.Player.GetActiveRecruit().StatusAilmentCounter = 0; HandleGameOver(client, Enums.KillType.Other); } else if (client.Player.Dead) { AskAfterDeathQuestion(client); } } break; case "Escape": { if (answer == "Yes") { int slot = 0; for (int i = 1; i <= client.Player.Inventory.Count; i++) { if (client.Player.Inventory[i].Num == 350 && !client.Player.Inventory[i].Sticky) { slot = i; break; } } if (slot > 0) { client.Player.TakeItemSlot(slot, 1, true); Escape(client); } else { Messenger.MapMsg(client.Player.MapID, client.Player.Name + " couldn't escape!", Text.BrightRed); } } else if (client.Player.Dead) { AskAfterDeathQuestion(client); } } break; case "TradeItem": { if (answer == "Yes") { int itemTaken = client.Player.FindInvSlot(110); if (client.Player.FindInvSlot(109) > itemTaken) { itemTaken = client.Player.FindInvSlot(109); } if (client.Player.FindInvSlot(131) > itemTaken) { itemTaken = client.Player.FindInvSlot(131); } if (itemTaken > -1) { client.Player.TakeItemSlot(itemTaken, 1, true); client.Player.GiveItem(538, 1, "38;45;125;290;194;299;300;301;302"); } } } break; case "CliffsideTablet": { if (answer == "Yes") { if (client.Player.FindInvSlot(-1) > 0) { client.Player.GiveItem(479, 1); IMap map = client.Player.Map; map.SetTile(10, 1, 0, 10, 3); map.SetTile(10, 1, 0, 10, 4); map.SetAttribute(10, 1, Enums.TileType.Blocked, 0, 0, 0, "0", "0", "0"); Messenger.SendTile(10, 1, map); Messenger.PlayerMsg(client, "You obtained a Tablet!", Text.Yellow); } else { Messenger.PlayerMsg(client, "Your inventory is full...", Text.BrightRed); } } } break; case "TournamentAdminOptions": { if (answer == "Start Tournament") { if (client.Player.Tournament != null) { Tournament tourny = client.Player.Tournament; if (tourny.RegisteredMembers[client].Admin) { if (tourny.IsReadyToStart()) { tourny.StartRound(new MatchUpRules()); Story playerOneStory = new Story(); StoryBuilderSegment playerOneSegment = StoryBuilder.BuildStory(); StoryBuilder.AppendSaySegment(playerOneSegment, "Your match is ready to begin!", -1, 0, 0); StoryBuilder.AppendMovePlayerAction(playerOneSegment, 8, 2, Enums.Speed.Walking, true); playerOneSegment.AppendToStory(playerOneStory); Story playerTwoStory = new Story(); StoryBuilderSegment playerTwoSegment = StoryBuilder.BuildStory(); StoryBuilder.AppendSaySegment(playerTwoSegment, "Your match is ready to begin!", -1, 0, 0); StoryBuilder.AppendMovePlayerAction(playerTwoSegment, 11, 2, Enums.Speed.Walking, true); playerTwoSegment.AppendToStory(playerTwoStory); for (int i = 0; i < tourny.ActiveMatchups.Count; i++) { StoryManager.PlayStory(tourny.ActiveMatchups[i].PlayerOne.Client, playerOneStory); StoryManager.PlayStory(tourny.ActiveMatchups[i].PlayerTwo.Client, playerTwoStory); } } else { Messenger.PlayerMsg(client, "The tournament is not ready to start!", Text.BrightRed); } } } } else if (answer == "Edit Rules") { if (client.Player.Tournament != null) { Tournament tourny = client.Player.Tournament; if (tourny.RegisteredMembers[client].Admin) { Messenger.SendTournamentRulesEditorTo(client, null); } else { Messenger.PlayerMsg(client, "You are not a tournament organizer!", Text.BrightRed); } } } } break; case "SnowballGameNewGame": { if (answer == "Yes") { string waitingGameOwner = SnowballGame.FindWaitingGame(); if (!string.IsNullOrEmpty(waitingGameOwner)) { Messenger.PlayerMsg(client, "Someone else created a game, please join that game.", Text.BrightRed); return; } SnowballGame snowballGame = new SnowballGame(); snowballGame.Init(); snowballGame.CreateGame(client); ActiveSnowballGames.Add(client.Player.CharID, snowballGame); Messenger.MapMsg(client.Player.MapID, client.Player.Name + " created a new game!", Text.BrightGreen); } } break; case "SnowballGameJoinGame": { if (answer == "Yes") { // Join game here SnowballGame.GetWaitingGame().AddToGame(client); } } break; case "SnowballGameStart": { if (answer == "Yes") { // Star game here //Messenger.MapMsg(client.Player.MapID, client.Player.Name + " started the game!", Text.BrightGreen); //Messenger.PlayerMsg(client, "Pretend you started the game.", Text.BrightGreen); SnowballGame.GetWaitingGame().StartGame(client); } } break; case "SwapShopTeamList": { if (answer == "Proceed") { List<string> choices = new List<string>(); choices.Add(Pokedex.GetPokemon(client.Player.Team[0].Species).Name); for (int i = 0; i < Constants.MAX_ACTIVETEAM; i++) { if (client.Player.Team[i] != null && client.Player.Team[i].Loaded) { if (i > 0 && client.Player.Team[i].Species != client.Player.Team[i - 1].Species && client.Player.Team[i].Species != client.Player.Team[0].Species) { choices.Add(Pokedex.GetPokemon(client.Player.Team[i].Species).Name); } } } Messenger.AskQuestion(client, "SwapShopItemList", "Whose list of rare exclusive items do you want to see?", Pokedex.FindByName("Croagunk").ID, choices.ToArray()); } if (answer == "Summary") { List<string> choices = new List<string>(); choices.Add(Pokedex.GetPokemon(client.Player.Team[0].Species).Name); for (int i = 0; i < Constants.MAX_ACTIVETEAM; i++) { if (client.Player.Team[i] != null && client.Player.Team[i].Loaded) { if (i > 0 && client.Player.Team[i].Species != client.Player.Team[i - 1].Species && client.Player.Team[i].Species != client.Player.Team[0].Species) { choices.Add(Pokedex.GetPokemon(client.Player.Team[i].Species).Name); } } } Messenger.AskQuestion(client, "SwapShopItemSummaryList", "Whose list of rare exclusive items do you want to know about?", Pokedex.FindByName("Croagunk").ID, choices.ToArray()); } if (answer == "Cancel") { Story story = new Story(); StoryBuilderSegment segment = StoryBuilder.BuildStory(); StoryBuilder.AppendSaySegment(segment, "You don't wanna swap? Meh-heh-heh... I get it!", Pokedex.FindByName("Croagunk").ID, 0, 0); segment.AppendToStory(story); StoryManager.PlayStory(client, story); } } break; case "SwapShopItemSummaryList" : { int ItemFound = 0; int PokemonID = Pokedex.FindByName(answer).ID; List<string> choices = new List<string>(); for (int i = 998; i < 1838; i++) { if (Pokedex.FindByName(answer).ID == ItemManager.Items[i].ReqData1 || Pokedex.FindByName(answer).ID == ItemManager.Items[i].ReqData2 || Pokedex.FindByName(answer).ID == ItemManager.Items[i].ReqData3 || Pokedex.FindByName(answer).ID == ItemManager.Items[i].ReqData4 || Pokedex.FindByName(answer).ID == ItemManager.Items[i].ReqData5) { if (ItemManager.Items[i].Rarity == 3) { choices.Add(ItemManager.Items[i].Name); ItemFound = ItemFound + 1; } } } choices.Add("Cancel"); if (ItemFound == 0) { Story story = new Story(); StoryBuilderSegment segment = StoryBuilder.BuildStory(); StoryBuilder.AppendSaySegment(segment, "Meh-heh-heh... I'm sorry to disappoint you but I'm afraid that " + answer + " has no rare exclusive items to use at the moment...", Pokedex.FindByName("Croagunk").ID, 0, 0); StoryBuilder.AppendRunScriptAction(segment, 90, "", "", "", true); segment.AppendToStory(story); StoryManager.PlayStory(client, story); } if (ItemFound == 1) { Messenger.AskQuestion(client, "SwapShopItemSummary", "Here is the rare exclusive item that " + answer + " can use...", Pokedex.FindByName("Croagunk").ID, choices.ToArray()); } if (ItemFound > 1) { Messenger.AskQuestion(client, "SwapShopItemSummary", "Here are the rare exclusive items that " + answer + " can use...", Pokedex.FindByName("Croagunk").ID, choices.ToArray()); } } break; case "SwapShopItemList": { int ItemFound = 0; int PokemonID = Pokedex.FindByName(answer).ID; List<string> choices = new List<string>(); for (int i = 998; i < 1838; i++) { if (Pokedex.FindByName(answer).ID == ItemManager.Items[i].ReqData1 || Pokedex.FindByName(answer).ID == ItemManager.Items[i].ReqData2 || Pokedex.FindByName(answer).ID == ItemManager.Items[i].ReqData3 || Pokedex.FindByName(answer).ID == ItemManager.Items[i].ReqData4 || Pokedex.FindByName(answer).ID == ItemManager.Items[i].ReqData5) { if (ItemManager.Items[i].Rarity == 3) { choices.Add(ItemManager.Items[i].Name); ItemFound = ItemFound + 1; } } } choices.Add("Cancel"); if (ItemFound == 0) { Story story = new Story(); StoryBuilderSegment segment = StoryBuilder.BuildStory(); StoryBuilder.AppendSaySegment(segment, "Meh-heh-heh... I'm sorry to disappoint you but I'm afraid that " + answer + " has no rare exclusive items to use at the moment...", Pokedex.FindByName("Croagunk").ID, 0, 0); segment.AppendToStory(story); StoryManager.PlayStory(client, story); } if (ItemFound == 1) { Messenger.AskQuestion(client, "SwapShopReq", "Here is the rare exclusive item that " + answer + " can use...", Pokedex.FindByName("Croagunk").ID, choices.ToArray()); } if (ItemFound > 1) { Messenger.AskQuestion(client, "SwapShopReq", "Here are the rare exclusive items that " + answer + " can use...", Pokedex.FindByName("Croagunk").ID, choices.ToArray()); } } break; case "SwapShopItemSummary": { string ItemReq1; ItemReq1 = ""; string ItemReq2; ItemReq2 = ""; string ItemReq3 = ""; ItemReq3 = ""; string ItemReqAny; ItemReqAny = ""; string ItemYour; ItemYour = ""; int ReqFound = 0; int Item1 = 0; int Item2 = 0; int Item3 = 0; int SwapItemNum = 0; string SwapItem; SwapItem = answer; for (int c = 998; c < 1838; c++) { if (ItemManager.Items[c].Name.Contains(answer)) { int PokemonID = ItemManager.Items[c].ReqData1; SwapItemNum = c; for (int i = 998; i < 1838; i++) { if (PokemonID == ItemManager.Items[i].ReqData1) { if (ItemManager.Items[i].Rarity == 1 || ItemManager.Items[i].Rarity == 2) { ReqFound = ReqFound + 1; if (ReqFound == 1) { ItemReq1 = ItemManager.Items[i].Name; ItemYour = "your "; Item1 = i; } if (ReqFound == 2) { ItemReq2 = ", " + ItemManager.Items[i].Name; Item2 = i; } if (ReqFound == 3) { ItemReq3 = " and " + ItemManager.Items[i].Name; Item3 = i; } } else if (ReqFound == 0) { ItemReqAny = "five different exclusive items"; ItemYour = "any "; } } } } } if (answer != "Cancel") { Story summary = new Story(); StoryBuilderSegment segment = StoryBuilder.BuildStory(); StoryBuilder.AppendSaySegment(segment, "" + answer + "? " + ItemManager.Items[SwapItemNum].Desc, Pokedex.FindByName("Croagunk").ID, 0, 0); StoryBuilder.AppendSaySegment(segment, "In order to obtain " + answer + ", one must swap " + ItemReq1 + ItemReq2 + ItemReq3 + ItemReqAny + " for it.", Pokedex.FindByName("Croagunk").ID, 0, 0); StoryBuilder.AppendRunScriptAction(segment, 90, "", "", "", true); segment.AppendToStory(summary); StoryManager.PlayStory(client, summary); } if (answer == "Cancel") { Story cancel = new Story(); StoryBuilderSegment segment = StoryBuilder.BuildStory(); StoryBuilder.AppendRunScriptAction(segment, 90, "", "", "", true); segment.AppendToStory(cancel); StoryManager.PlayStory(client, cancel); } } break; case "SwapShopReq": { string ItemReq1; ItemReq1 = ""; string ItemReq2; ItemReq2 = ""; string ItemReq3 = ""; ItemReq3 = ""; string ItemReqAny; ItemReqAny = ""; string ItemYour; ItemYour = ""; int ReqFound = 0; int Item1 = 0; int Item2 = 0; int Item3 = 0; int SwapItemNum = 0; string SwapItem; if (answer != "Cancel") { SwapItem = answer; List<string> choices = new List<string>(); choices.Add("Yes, I want to Swap for " + answer); choices.Add("Cancel"); for (int c = 998; c < 1838; c++) { if (ItemManager.Items[c].Name.Contains(answer)) { int PokemonID = ItemManager.Items[c].ReqData1; SwapItemNum = c; for (int i = 998; i < 1838; i++) { if (PokemonID == ItemManager.Items[i].ReqData1) { if (ItemManager.Items[i].Rarity == 1 || ItemManager.Items[i].Rarity == 2) { ReqFound = ReqFound + 1; if (ReqFound == 1) { ItemReq1 = ItemManager.Items[i].Name; ItemYour = "your "; Item1 = i; } if (ReqFound == 2) { ItemReq2 = ", " + ItemManager.Items[i].Name; Item2 = i; } if (ReqFound == 3) { ItemReq3 = " and " + ItemManager.Items[i].Name; Item3 = i; } } else if (ReqFound == 0) { ItemReqAny = "five different exclusive items"; ItemYour = "any "; } } } } } Messenger.AskQuestion(client, "SwapShopActive", "So you want " + answer + " and wanna swap " + ItemYour + ItemReq1 + ItemReq2 + ItemReq3 + ItemReqAny + " for that? It'll cost ya 5000 Poké, too. Is that okay?", Pokedex.FindByName("Croagunk").ID, choices.ToArray()); } else { Story cancel = new Story(); StoryBuilderSegment segment = StoryBuilder.BuildStory(); StoryBuilder.AppendSaySegment(segment, "You don't wanna swap? Meh-heh-heh... I get it!", Pokedex.FindByName("Croagunk").ID, 0, 0); segment.AppendToStory(cancel); StoryManager.PlayStory(client, cancel); } } break; case "SwapShopActive" : { string ItemName; ItemName = answer.Replace("Yes, I want to Swap for ", ""); int ReqFound = 0; int SwapItemNum = 0; int Item1 = 0; int Item2 = 0; int Item3 = 0; int PokemonID = 0; for (int c = 998; c < 1838; c++) { if (ItemManager.Items[c].Name.Contains(ItemName)) { PokemonID = ItemManager.Items[c].ReqData1; SwapItemNum = c; for (int i = 998; i < 1838; i++) { if (PokemonID == ItemManager.Items[i].ReqData1) { if (ItemManager.Items[i].Rarity == 1 || ItemManager.Items[i].Rarity == 2) { ReqFound = ReqFound + 1; if (ReqFound == 1) { Item1 = i; } if (ReqFound == 2) { Item2 = i; } if (ReqFound == 3) { Item3 = i; } } } } } } if (answer != "Cancel") { if (ReqFound > 0) { if (client.Player.HasItem(Item1) > 0 && client.Player.HasItem(Item2) > 0 && client.Player.HasItem(Item3) > 0 && client.Player.HasItem(1) >= 5000) { Messenger.SpellAnim(491, client.Player.MapID, client.Player.X, client.Player.Y); Story story = new Story(); StoryBuilderSegment segment = StoryBuilder.BuildStory(); StoryBuilder.AppendRunScriptAction(segment, 5, "magic162.ogg", "", "", true); StoryBuilder.AppendPauseAction(segment, 500); StoryBuilder.AppendSaySegment(segment, "Meh-heh-heh! Seems that we brewed up a successful swap there! Here... Take your unbelievably valuable " + ItemName + "! Treat it with respect! Meh-heh-heh!", Pokedex.FindByName("Croagunk").ID, 0, 0); StoryBuilder.AppendPauseAction(segment, 500); StoryBuilder.AppendRunScriptAction(segment, 90, "", "", "", true); segment.AppendToStory(story); StoryManager.PlayStory(client, story); client.Player.TakeItem(Item1, 1); client.Player.TakeItem(Item2, 1); client.Player.TakeItem(Item3, 1); client.Player.TakeItem(1, 5000); client.Player.GiveItem(SwapItemNum, 1, "", false); } else { Story no = new Story(); StoryBuilderSegment segment = StoryBuilder.BuildStory(); StoryBuilder.AppendSaySegment(segment, "Meh-heh-heh? I'm sorry... You don't seem to have the required items for the Swap process...", Pokedex.FindByName("Croagunk").ID, 0, 0); StoryBuilder.AppendRunScriptAction(segment, 90, "", "", "", true); segment.AppendToStory(no); StoryManager.PlayStory(client, no); } } else { int ItemCount = 0; int Take1 = 0; int Take2 = 0; int Take3 = 0; int Take4 = 0; int Take5 = 0; for (int b = 1; b <= client.Player.Inventory.Count; b++) { int i = client.Player.Inventory[b].Num; if (i >= 998 && i < 1838) { if (client.Player.HasItem(i) > 0 && ItemCount == 0) { Take1 = i; ItemCount++; } if (client.Player.HasItem(i) > 0 && i != Take1 && ItemCount == 1) { Take2 = i; ItemCount++; } if (client.Player.HasItem(i) > 0 && i != Take1 && i != Take2 && ItemCount == 2) { Take3 = i; ItemCount++; } if (client.Player.HasItem(i) > 0 && i != Take1 && i != Take2 && client.Player.Inventory[b].Num != Take3 && ItemCount == 3) { Take4 = i; ItemCount++; } if (client.Player.HasItem(i) > 0 && i != Take1 && i != Take2 && client.Player.Inventory[b].Num != Take3 && client.Player.Inventory[b].Num != Take4 && ItemCount >= 4) { Take5 = i; ItemCount++; } } } // Messenger.PlayerMsg(client, Take1 + "|" + Take2 + "|" + Take3 + "|" + Take4 + "|" + Take5 + "|" +ItemCount, Text.Yellow); // Debug Message if (ItemCount >= 5 && client.Player.HasItem(1) >= 5000) { Messenger.SpellAnim(491, client.Player.MapID, client.Player.X, client.Player.Y); Story yes = new Story(); StoryBuilderSegment segment = StoryBuilder.BuildStory(); StoryBuilder.AppendRunScriptAction(segment, 5, "magic162.ogg", "", "", true); StoryBuilder.AppendPauseAction(segment, 500); StoryBuilder.AppendSaySegment(segment, "Meh-heh-heh! Seems that we brewed up a successful swap there! Here... Take your unbelievably valuable " + ItemName + "! Treat it with respect! Meh-heh-heh!", Pokedex.FindByName("Croagunk").ID, 0, 0); StoryBuilder.AppendPauseAction(segment, 500); StoryBuilder.AppendRunScriptAction(segment, 90, "", "", "", true); segment.AppendToStory(yes); StoryManager.PlayStory(client, yes); client.Player.TakeItem(Take1, 1, true); client.Player.TakeItem(Take2, 1, true); client.Player.TakeItem(Take3, 1, true); client.Player.TakeItem(Take4, 1, true); client.Player.TakeItem(Take5, 1, true); client.Player.TakeItem(1, 5000, true); client.Player.GiveItem(SwapItemNum, 1, "", false); } else if (ItemCount < 5 || client.Player.HasItem(1) < 5000) { Story no = new Story(); StoryBuilderSegment segment = StoryBuilder.BuildStory(); StoryBuilder.AppendSaySegment(segment, "Meh-heh-heh? I'm sorry... You don't seem to have the required items for the Swap process...", Pokedex.FindByName("Croagunk").ID, 0, 0); StoryBuilder.AppendRunScriptAction(segment, 90, "", "", "", true); segment.AppendToStory(no); StoryManager.PlayStory(client, no); } } } else { Story cancel = new Story(); StoryBuilderSegment segment = StoryBuilder.BuildStory(); StoryBuilder.AppendSaySegment(segment, "You don't wanna swap? Meh-heh-heh... I get it!", Pokedex.FindByName("Croagunk").ID, 0, 0); segment.AppendToStory(cancel); StoryManager.PlayStory(client, cancel); } } break; case "Spiritomb": { if (answer == "Yes") { Messenger.SpellAnim(61, client.Player.MapID, client.Player.X, client.Player.Y); MapNpcPreset npc = new MapNpcPreset(); npc.SpawnX = 10; npc.SpawnY = 5; npc.NpcNum = 1748; npc.MinLevel = 30; npc.MaxLevel = 30; client.Player.Map.SpawnNpc(npc); client.Player.TakeItem(251, 1); } } break; case "Candycane": { if (answer == "Yes") { } else if (answer == "Maybe later.") { Story story = new Story(); StoryBuilderSegment segment = StoryBuilder.BuildStory(); StoryBuilder.AppendSaySegment(segment, "Ah, okay! See you next time!", Pokedex.FindByName("Delibird").ID, 0, 0); segment.AppendToStory(story); StoryManager.PlayStory(client, story); } else if (answer == "Ah, get lost.") { Story story = new Story(); StoryBuilderSegment segment = StoryBuilder.BuildStory(); StoryBuilder.AppendSaySegment(segment, "...", Pokedex.FindByName("Delibird").ID, 0, 0); StoryBuilder.AppendSaySegment(segment, "Delibird will remember this.", -1, 0, 0); segment.AppendToStory(story); StoryManager.PlayStory(client, story); } } break; } } catch (Exception ex) { Messenger.AdminMsg("Error: QuestionResult" + ex.ToString(), Text.Black); } }