Example #1
0
        public static void AppendHideNPCsAction(StoryBuilderSegment story)
        {
            StorySegment segment = new StorySegment();

            segment.Action = Enums.StoryAction.HideNPCs;
            story.Segments.Add(segment);
        }
Example #2
0
 public static void AppendChangeWeatherAction(StoryBuilderSegment story, Enums.Weather weather)
 {
     StorySegment segment = new StorySegment();
     segment.Action = Enums.StoryAction.ChangeWeather;
     segment.AddParameter("Weather", ((int)weather).ToString());
     story.Segments.Add(segment);
 }
Example #3
0
        public static void AppendShowPlayersAction(StoryBuilderSegment story)
        {
            StorySegment segment = new StorySegment();

            segment.Action = Enums.StoryAction.ShowPlayers;
            story.Segments.Add(segment);
        }
Example #4
0
        public static void AppendStopMusicAction(StoryBuilderSegment story)
        {
            StorySegment segment = new StorySegment();

            segment.Action = Enums.StoryAction.StopMusic;
            story.Segments.Add(segment);
        }
Example #5
0
        public static void AppendPauseAction(StoryBuilderSegment story, int length)
        {
            StorySegment segment = new StorySegment();

            segment.Action = Enums.StoryAction.Pause;
            segment.AddParameter("Length", length.ToString());
            story.Segments.Add(segment);
        }
Example #6
0
 public static void AppendChangeFNPCDirAction(StoryBuilderSegment story, string id, Enums.Direction direction)
 {
     StorySegment segment = new StorySegment();
     segment.Action = Enums.StoryAction.ChangeFNPCDir;
     segment.AddParameter("ID", id);
     segment.AddParameter("Direction", ((int)direction).ToString());
     story.Segments.Add(segment);
 }
Example #7
0
        public static void AppendDeleteFNPCAction(StoryBuilderSegment story, string id)
        {
            StorySegment segment = new StorySegment();

            segment.Action = Enums.StoryAction.DeleteFNPC;
            segment.AddParameter("ID", id);
            story.Segments.Add(segment);
        }
Example #8
0
        public static void AppendChangeWeatherAction(StoryBuilderSegment story, Enums.Weather weather)
        {
            StorySegment segment = new StorySegment();

            segment.Action = Enums.StoryAction.ChangeWeather;
            segment.AddParameter("Weather", ((int)weather).ToString());
            story.Segments.Add(segment);
        }
Example #9
0
        public static void AppendMapVisibilityAction(StoryBuilderSegment story, bool visible)
        {
            StorySegment segment = new StorySegment();

            segment.Action = Enums.StoryAction.MapVisibility;
            segment.AddParameter("Visible", visible.ToString());
            story.Segments.Add(segment);
        }
Example #10
0
        public static void AppendShowBackgroundAction(StoryBuilderSegment story, string file)
        {
            StorySegment segment = new StorySegment();

            segment.Action = Enums.StoryAction.ShowBackground;
            segment.AddParameter("File", file);
            story.Segments.Add(segment);
        }
Example #11
0
        public static void AppendPlayerPadlockAction(StoryBuilderSegment story, string state)
        {
            StorySegment segment = new StorySegment();

            segment.Action = Enums.StoryAction.PlayerPadlock;
            segment.AddParameter("MovementState", state);
            story.Segments.Add(segment);
        }
Example #12
0
        public static void AppendHideImageAction(StoryBuilderSegment story, string imageID)
        {
            StorySegment segment = new StorySegment();

            segment.Action = Enums.StoryAction.HideImage;
            segment.AddParameter("ImageID", imageID);
            story.Segments.Add(segment);
        }
Example #13
0
        public static void AppendWaitForMapAction(StoryBuilderSegment story, string map)
        {
            StorySegment segment = new StorySegment();

            segment.Action = Enums.StoryAction.WaitForMap;
            segment.AddParameter("MapID", map);
            story.Segments.Add(segment);
        }
Example #14
0
        public static void AppendChangeFNPCDirAction(StoryBuilderSegment story, string id, Enums.Direction direction)
        {
            StorySegment segment = new StorySegment();

            segment.Action = Enums.StoryAction.ChangeFNPCDir;
            segment.AddParameter("ID", id);
            segment.AddParameter("Direction", ((int)direction).ToString());
            story.Segments.Add(segment);
        }
Example #15
0
        public static void AppendGoToSegmentAction(StoryBuilderSegment story, int segment)
        {
            StorySegment tempSegment = new StorySegment();

            tempSegment.Action = Enums.StoryAction.GoToSegment;
            tempSegment.AddParameter("Segment", segment.ToString());

            story.Segments.Add(tempSegment);
        }
Example #16
0
        public static void AppendFNPCEmotionAction(StoryBuilderSegment story, string id, int emotion)
        {
            StorySegment segment = new StorySegment();

            segment.Action = Enums.StoryAction.FNPCEmotion;
            segment.AddParameter("ID", id);
            segment.AddParameter("Emotion", emotion.ToString());
            story.Segments.Add(segment);
        }
Example #17
0
        public static void AppendWarpFNPCAction(StoryBuilderSegment story, string id, int x, int y)
        {
            StorySegment segment = new StorySegment();

            segment.Action = Enums.StoryAction.WarpFNPC;
            segment.AddParameter("ID", id);
            segment.AddParameter("X", x.ToString());
            segment.AddParameter("Y", y.ToString());
            story.Segments.Add(segment);
        }
Example #18
0
        public static void AppendPlayMusicAction(StoryBuilderSegment story, string file, bool honorSettings, bool loop)
        {
            StorySegment segment = new StorySegment();

            segment.Action = Enums.StoryAction.PlayMusic;
            segment.AddParameter("File", file);
            segment.AddParameter("HonorSettings", honorSettings.ToString());
            segment.AddParameter("Loop", loop.ToString());
            story.Segments.Add(segment);
        }
Example #19
0
        public static void AppendShowImageAction(StoryBuilderSegment story, string file, string imageID, int x, int y)
        {
            StorySegment segment = new StorySegment();

            segment.Action = Enums.StoryAction.ShowImage;
            segment.AddParameter("File", file);
            segment.AddParameter("ImageID", imageID);
            segment.AddParameter("X", x.ToString());
            segment.AddParameter("Y", y.ToString());
            story.Segments.Add(segment);
        }
Example #20
0
        public static void AppendAskQuestionAction(StoryBuilderSegment story, string question, int segmentOnYes, int segmentOnNo, int mugshot)
        {
            StorySegment segment = new StorySegment();
            segment.Action = Enums.StoryAction.AskQuestion;
            segment.AddParameter("Question", question);
            segment.AddParameter("SegmentOnYes", segmentOnYes.ToString());
            segment.AddParameter("SegmentOnNo", segmentOnNo.ToString());
            segment.AddParameter("Mugshot", mugshot.ToString());

            story.Segments.Add(segment);
        }
Example #21
0
        public static void AppendSaySegment(StoryBuilderSegment story, string text, int mugshot, int speed, int pauseLocation)
        {
            StorySegment segment = new StorySegment();

            segment.Action = Enums.StoryAction.Say;
            segment.AddParameter("Text", text);
            segment.AddParameter("Mugshot", mugshot.ToString());
            segment.Parameters.Add("Speed", speed.ToString());
            segment.Parameters.Add("PauseLocation", pauseLocation.ToString());
            story.Segments.Add(segment);
        }
Example #22
0
 public static void AppendCreateFNPCAction(StoryBuilderSegment story, string id, string parentMapID, int x, int y, int sprite)
 {
     StorySegment segment = new StorySegment();
     segment.Action = Enums.StoryAction.CreateFNPC;
     segment.AddParameter("ID", id);
     segment.AddParameter("ParentMapID", parentMapID);
     segment.AddParameter("X", x.ToString());
     segment.AddParameter("Y", y.ToString());
     segment.AddParameter("Sprite", sprite.ToString());
     story.Segments.Add(segment);
 }
Example #23
0
        public static void AppendMoveFNPCAction(StoryBuilderSegment story, string id, int x, int y, Enums.Speed speed, bool pause)
        {
            StorySegment segment = new StorySegment();

            segment.Action = Enums.StoryAction.MoveFNPC;
            segment.AddParameter("ID", id);
            segment.AddParameter("X", x.ToString());
            segment.AddParameter("Y", y.ToString());
            segment.AddParameter("Speed", ((int)speed).ToString());
            segment.AddParameter("Pause", pause.ToIntString());
            story.Segments.Add(segment);
        }
Example #24
0
        public static void AppendMovePlayerAction(StoryBuilderSegment story, int targetX, int targetY, Enums.Speed speed, bool pause)
        {
            StorySegment segment = new StorySegment();

            segment.Action = Enums.StoryAction.MovePlayer;
            segment.AddParameter("X", targetX.ToString());
            segment.AddParameter("Y", targetY.ToString());
            segment.AddParameter("Speed", ((int)speed).ToString());
            segment.AddParameter("Pause", pause.ToString());

            story.Segments.Add(segment);
        }
Example #25
0
        public static void AppendRunScriptAction(StoryBuilderSegment story, int scriptIndex, string param1, string param2, string param3, bool pause)
        {
            StorySegment segment = new StorySegment();

            segment.Action = Enums.StoryAction.RunScript;
            segment.AddParameter("ScriptIndex", scriptIndex.ToString());
            segment.AddParameter("ScriptParam1", param1);
            segment.AddParameter("ScriptParam2", param2);
            segment.AddParameter("ScriptParam3", param3);
            segment.AddParameter("Pause", pause.ToIntString());
            story.Segments.Add(segment);
        }
Example #26
0
        public static void AppendAskQuestionAction(StoryBuilderSegment story, string question, int segmentOnYes, int segmentOnNo, int mugshot)
        {
            StorySegment segment = new StorySegment();

            segment.Action = Enums.StoryAction.AskQuestion;
            segment.AddParameter("Question", question);
            segment.AddParameter("SegmentOnYes", segmentOnYes.ToString());
            segment.AddParameter("SegmentOnNo", segmentOnNo.ToString());
            segment.AddParameter("Mugshot", mugshot.ToString());

            story.Segments.Add(segment);
        }
Example #27
0
        public static void AppendCreateFNPCAction(StoryBuilderSegment story, string id, string parentMapID, int x, int y, int sprite)
        {
            StorySegment segment = new StorySegment();

            segment.Action = Enums.StoryAction.CreateFNPC;
            segment.AddParameter("ID", id);
            segment.AddParameter("ParentMapID", parentMapID);
            segment.AddParameter("X", x.ToString());
            segment.AddParameter("Y", y.ToString());
            segment.AddParameter("Sprite", sprite.ToString());
            story.Segments.Add(segment);
        }
Example #28
0
        public static void AppendEntranceReqs(Story story, string dungeonName, string[] reqString)
        {
            //if (DungeonManager.Dungeons[dungeonIndex].ScriptList.ContainsKey(2)) {

            StorySegment segment = new StorySegment();

            if (reqString.Length == 1) {
                string req = GetRequirementString(reqString[0].Split(','));
                string start = req.Substring(0, 1).ToLower();
                segment.Action = Enums.StoryAction.Say;
                segment.AddParameter("Text", "Notice: In order to enter " + dungeonName + ", " + start + req.Substring(1, req.Length - 1));
                segment.AddParameter("Mugshot", "-1");
                segment.Parameters.Add("Speed", "0");
                segment.Parameters.Add("PauseLocation", "0");
                story.Segments.Add(segment);
                return;
            } else {

                segment.Action = Enums.StoryAction.Say;
                segment.AddParameter("Text", "Notice: You must meet certain requirements before entering " + dungeonName + ".");
                segment.AddParameter("Mugshot", "-1");
                segment.Parameters.Add("Speed", "0");
                segment.Parameters.Add("PauseLocation", "0");
                story.Segments.Add(segment);
            }

            for (int i = 0; i < reqString.Length; i++) {

                string req = GetRequirementString(reqString[i].Split(','));

                segment = new StorySegment();
                segment.Action = Enums.StoryAction.Say;

                if (i == reqString.Length - 1) {
                    string start = req.Substring(0, 1).ToLower();
                    segment.AddParameter("Text", "Also, " + start + req.Substring(1, req.Length - 1));
                } else {
                    segment.AddParameter("Text", req + "..");
                }

                segment.AddParameter("Mugshot", "-1");
                segment.Parameters.Add("Speed", "0");
                segment.Parameters.Add("PauseLocation", "0");
                story.Segments.Add(segment);
            }

            //} else {
            //	return null;
            //}
        }
Example #29
0
        public static void AppendAskQuestionAction(StoryBuilderSegment story, string question, string questionID, int mugshot, string[] options)
        {
            StorySegment segment = new StorySegment();
            segment.Action = Enums.StoryAction.AskQuestion;
            segment.AddParameter("Question", question);
            segment.AddParameter("SegmentOnYes", "-1");
            segment.AddParameter("SegmentOnNo", "-1");
            segment.AddParameter("Mugshot", mugshot.ToString());
            StringBuilder optionsString = new StringBuilder();
            for (int i = 0; i < options.Length; i++) {
                optionsString.Append(options[i]);
                optionsString.Append("\\");
            }
            segment.AddParameter("Options", optionsString.ToString());
            segment.AddParameter("QuestionID", questionID);

            story.Segments.Add(segment);
        }
Example #30
0
        public static void AppendAskQuestionAction(StoryBuilderSegment story, string question, string questionID, int mugshot, string[] options)
        {
            StorySegment segment = new StorySegment();

            segment.Action = Enums.StoryAction.AskQuestion;
            segment.AddParameter("Question", question);
            segment.AddParameter("SegmentOnYes", "-1");
            segment.AddParameter("SegmentOnNo", "-1");
            segment.AddParameter("Mugshot", mugshot.ToString());
            StringBuilder optionsString = new StringBuilder();

            for (int i = 0; i < options.Length; i++)
            {
                optionsString.Append(options[i]);
                optionsString.Append("\\");
            }
            segment.AddParameter("Options", optionsString.ToString());
            segment.AddParameter("QuestionID", questionID);

            story.Segments.Add(segment);
        }
Example #31
0
 public static void AppendMapVisibilityAction(StoryBuilderSegment story, bool visible)
 {
     StorySegment segment = new StorySegment();
     segment.Action = Enums.StoryAction.MapVisibility;
     segment.AddParameter("Visible", visible.ToString());
     story.Segments.Add(segment);
 }
Example #32
0
 public static void AppendWarpFNPCAction(StoryBuilderSegment story, string id, int x, int y)
 {
     StorySegment segment = new StorySegment();
     segment.Action = Enums.StoryAction.WarpFNPC;
     segment.AddParameter("ID", id);
     segment.AddParameter("X", x.ToString());
     segment.AddParameter("Y", y.ToString());
     story.Segments.Add(segment);
 }
Example #33
0
        public static Story CreatePreDungeonStory(Client client, string param1, string param2, string param3, bool random)
        {
            Story story = new Story();

            StorySegment segment = new StorySegment();
            segment.Action = Enums.StoryAction.PlayerPadlock;
            segment.AddParameter("MovementState", "Lock");
            story.Segments.Add(segment);

            if (param3 == "") {
                //continuing a dungeon

                segment = new StorySegment();
                segment.Action = Enums.StoryAction.AskQuestion;
                segment.AddParameter("Question", "Will you go on?");
                segment.AddParameter("SegmentOnYes", (story.Segments.Count + 2).ToString());
                segment.AddParameter("SegmentOnNo", (story.Segments.Count + 3).ToString());
                segment.AddParameter("Mugshot", "-1");
                story.Segments.Add(segment);
            } else {

                string dungeonName = "";
                string reqString = "";
                string restrictionString = "";

                if (param3.IsNumeric()) {
                    //official dungeon

                    dungeonName = DungeonManager.Dungeons[param3.ToInt() - 1].Name;

                    if (DungeonManager.Dungeons[param3.ToInt() - 1].ScriptList.ContainsKey(1)) {
                        reqString = DungeonManager.Dungeons[param3.ToInt() - 1].ScriptList[1];
                    }

                    if (DungeonManager.Dungeons[param3.ToInt() - 1].ScriptList.ContainsKey(2)) {
                        restrictionString = DungeonManager.Dungeons[param3.ToInt() - 1].ScriptList[2];
                    }
                } else {
                    //unofficial dungeon

                    dungeonName = param3.Split(':')[0];
                    reqString = param3.Split(':')[1];
                    restrictionString = param3.Split(':')[2];
                }

                if (CheckDungeonRequirements(client, reqString.Split(';'))) {

                    if (restrictionString != "") {

                        AppendEntranceWarning(story, dungeonName, restrictionString.Split(';'));

                        segment = new StorySegment();
                        segment.Action = Enums.StoryAction.AskQuestion;
                        segment.AddParameter("Question", "Will you enter " + dungeonName + "?");
                        segment.AddParameter("SegmentOnYes", "3");
                        segment.AddParameter("SegmentOnNo", (story.Segments.Count + 4).ToString());
                        segment.AddParameter("Mugshot", "-1");
                        story.Segments.Insert(1, segment);

                        segment = new StorySegment();
                        segment.Action = Enums.StoryAction.AskQuestion;
                        segment.AddParameter("Question", "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);

                    } else {

                        segment = new StorySegment();
                        segment.Action = Enums.StoryAction.AskQuestion;
                        segment.AddParameter("Question", "Will you enter " + dungeonName + "?");
                        segment.AddParameter("SegmentOnYes", (story.Segments.Count + 2).ToString());
                        segment.AddParameter("SegmentOnNo", (story.Segments.Count + 3).ToString());
                        segment.AddParameter("Mugshot", "-1");
                        story.Segments.Insert(1, segment);

                    }

                } else {

                    AppendEntranceReqs(story, dungeonName, reqString.Split(';'));

                    segment = new StorySegment();
                    segment.Action = Enums.StoryAction.GoToSegment;
                    segment.AddParameter("Segment", (story.Segments.Count + 3).ToString());

                    story.Segments.Add(segment);

                    segment = new StorySegment();
                    segment.Action = Enums.StoryAction.AskQuestion;
                    segment.AddParameter("Question", "Will you enter " + dungeonName + "?");
                    segment.AddParameter("SegmentOnYes", "3");
                    segment.AddParameter("SegmentOnNo", (story.Segments.Count + 3).ToString());
                    segment.AddParameter("Mugshot", "-1");
                    story.Segments.Insert(1, segment);

                }

            }

            segment = new StorySegment();
            segment.Action = Enums.StoryAction.RunScript;
            if (random) {
                segment.AddParameter("ScriptIndex", "42");
            } else {
                segment.AddParameter("ScriptIndex", "52");
            }
            segment.AddParameter("ScriptParam1", param1);
            segment.AddParameter("ScriptParam2", param2);
            segment.AddParameter("ScriptParam3", param3);
            segment.AddParameter("Pause", "1");
            story.Segments.Add(segment);

            segment = new StorySegment();
            segment.Action = Enums.StoryAction.PlayerPadlock;
            segment.AddParameter("MovementState", "Unlock");
            story.Segments.Add(segment);

            foreach (StorySegment segments in story.Segments) {
                //Messenger.AdminMsg(segments.Action.ToString(), Text.Black);
            }

            return story;
        }
Example #34
0
 public static void AppendSaySegment(StoryBuilderSegment story, string text, int mugshot, int speed, int pauseLocation)
 {
     StorySegment segment = new StorySegment();
     segment.Action = Enums.StoryAction.Say;
     segment.AddParameter("Text", text);
     segment.AddParameter("Mugshot", mugshot.ToString());
     segment.Parameters.Add("Speed", speed.ToString());
     segment.Parameters.Add("PauseLocation", pauseLocation.ToString());
     story.Segments.Add(segment);
 }
Example #35
0
 public static void AppendPlayMusicAction(StoryBuilderSegment story, string file, bool honorSettings, bool loop)
 {
     StorySegment segment = new StorySegment();
     segment.Action = Enums.StoryAction.PlayMusic;
     segment.AddParameter("File", file);
     segment.AddParameter("HonorSettings", honorSettings.ToString());
     segment.AddParameter("Loop", loop.ToString());
     story.Segments.Add(segment);
 }
Example #36
0
 public static void AppendPauseAction(StoryBuilderSegment story, int length)
 {
     StorySegment segment = new StorySegment();
     segment.Action = Enums.StoryAction.Pause;
     segment.AddParameter("Length", length.ToString());
     story.Segments.Add(segment);
 }
Example #37
0
 public static void AppendMoveFNPCAction(StoryBuilderSegment story, string id, int x, int y, Enums.Speed speed, bool pause)
 {
     StorySegment segment = new StorySegment();
     segment.Action = Enums.StoryAction.MoveFNPC;
     segment.AddParameter("ID", id);
     segment.AddParameter("X", x.ToString());
     segment.AddParameter("Y", y.ToString());
     segment.AddParameter("Speed", ((int)speed).ToString());
     segment.AddParameter("Pause", pause.ToIntString());
     story.Segments.Add(segment);
 }
Example #38
0
        public static void AppendMovePlayerAction(StoryBuilderSegment story, int targetX, int targetY, Enums.Speed speed, bool pause)
        {
            StorySegment segment = new StorySegment();
            segment.Action = Enums.StoryAction.MovePlayer;
            segment.AddParameter("X", targetX.ToString());
            segment.AddParameter("Y", targetY.ToString());
            segment.AddParameter("Speed", ((int)speed).ToString());
            segment.AddParameter("Pause", pause.ToString());

            story.Segments.Add(segment);
        }
Example #39
0
        public static void ScriptedSign(Client client, int script, string string1, string string2, string string3, Enums.Direction dir)
        {
            try {
                switch (script) {
                    case 0: {
                            //Messenger.PlayerMsg(index, "High scores for: Pit of 100 Trials", Text.Black);
                            //for (int i = 0; i < 10; i++) {
                            //    int scoreFloor = ((CXmlEditor)ObjectFactory.GetObject("pitof100trialsscores")).TryGetAttributeValue("score" + i.ToString(), "Scores", "floor").ToInt(-1);
                            //    if (scoreFloor > -1) {
                            //        NetScript.PlayerMsg(index, (i + 1).ToString() + ". Player: " + ((CXmlEditor)ObjectFactory.GetObject("pitof100trialsscores")).TryGetAttributeValue("score" + i.ToString(), "Scores", "player") + ", Floor: " + (scoreFloor + 1).ToString(), Text.Grey);
                            //    } else {
                            //        NetScript.PlayerMsg(index, (i + 1).ToString() + ". No score registered.", Text.Grey);
                            //    }
                            //}
                        }
                        break;
                    case 1: {
                            if (dir == Enums.Direction.Up) {
                                Messenger.PlayerMsg(client, "Read the back of this sign to win a prize!", Text.Yellow);
                            } else if (dir == Enums.Direction.Down) {
                                Messenger.PlayerMsg(client, "Read the front of this sign to learn how to win a prize!", Text.Yellow);
                            } else if (dir == Enums.Direction.Left) {
                                Messenger.PlayerMsg(client, "You didn't even think to read the sign from the right? WELL YOU SHOULD NEXT TIME", Text.Yellow);
                            } else {
                                Messenger.PlayerMsg(client, "Of course, reading this sign from the left is the way to go.", Text.Yellow);
                            }
                        }
                        break;
                    case 2: {
                            IMap map = client.Player.Map;
                            if (dir == Enums.Direction.Up) {
                                if (map.Tile[client.Player.X, client.Player.Y - 2].Type == Enums.TileType.Walkable) {
                                    client.Player.Y -= 2;
                                    //Messenger.SendPlayerXY(client);
                                    Messenger.PlaySoundToMap(client.Player.MapID, "magic19.wav");
                                } else {
                                    Messenger.PlayerMsg(client, "You can't jump here!", Text.BrightRed);
                                }
                            } else if (dir == Enums.Direction.Down) {
                                if (map.Tile[client.Player.X, client.Player.Y + 2].Type == Enums.TileType.Walkable) {
                                    client.Player.Y += 2;
                                    //Messenger.SendPlayerXY(client);
                                    Messenger.PlaySoundToMap(client.Player.MapID, "magic19.wav");
                                } else {
                                    Messenger.PlayerMsg(client, "You can't jump here!", Text.BrightRed);
                                }
                            } else if (dir == Enums.Direction.Left) {
                                if (map.Tile[client.Player.X - 2, client.Player.Y].Type == Enums.TileType.Walkable) {
                                    client.Player.X -= 2;
                                    //Messenger.SendPlayerXY(client);
                                    Messenger.PlaySoundToMap(client.Player.MapID, "magic19.wav");
                                } else {
                                    Messenger.PlayerMsg(client, "You can't jump here!", Text.BrightRed);
                                }
                            } else {
                                if (map.Tile[client.Player.X + 2, client.Player.Y].Type == Enums.TileType.Walkable) {
                                    client.Player.X += 2;
                                    //Messenger.SendPlayerXY(client);
                                    Messenger.PlaySoundToMap(client.Player.MapID, "magic19.wav");
                                } else {
                                    Messenger.PlayerMsg(client, "You can't jump here!", Text.BrightRed);
                                }
                            }

                        }
                        break;
                    case 3: {
                            StoryManager.PlayStory(client, 36);
                        }
                        break;
                    case 4: {//FFF warp
                            if (client.Player.GetDungeonCompletionCount(5) == 0) {
                                StoryManager.PlayStory(client, 157);
                            } else {
                                StoryManager.PlayStory(client, 158);
                            }
                        }
                        break;
                    case 5: {// Lottery Board
                            if (dir == Enums.Direction.Up) {
                                if (DateTime.Now.DayOfWeek != Lottery.LOTTERY_DAY) {
                                    if (client.Player.HasItem(1) >= 25) {
                                        //if (DateTime.Now.DayOfWeek != LOTTERY_DAY) {
                                        //    NetScript.PlayerMsg(index, "Remember: There is no draw today. Come back on " + LOTTERY_DAY.ToString() + " to enter in the draw!", Text.Grey);
                                        //}
                                        Messenger.AskQuestion(client, "buylotteryticket", "Would you like to purchase one lottery ticket for 25 Poké?", -1);
                                    } else {
                                        //NetScript.PlayerMsg(index, "There is no draw today. Come back on " + LOTTERY_DAY.ToString(), Text.BrightRed);
                                        Messenger.PlayerMsg(client, "You don't have enough money to buy a lottery ticket!", Text.BrightRed);
                                    }
                                } else if (client.Player.HasItem(381) > 0) {
                                    Messenger.AskQuestion(client, "uselotteryticket", "Would you like to use your lottery ticket?", -1);
                                    //} else if (ObjectFactory.GetPlayer(index).HasItem(1) >= 25) {
                                    //    NetScript.AskQuestion(index, "buylotteryticket", "Would you like to purchase one lottery ticket for 25 Poké?", -1);
                                } else {
                                    Messenger.PlayerMsg(client, "Come back tomorrow to purchase next week's lottery tickets.", Text.BrightRed);
                                }
                            }
                        }
                        break;
                    case 6: {//for rock climb
                            Messenger.PlayerMsg(client, "This wall is very rocky... perhaps there is some way to scale it?", Text.Grey);
                        }
                        break;
                    case 7: {//for waterfall
                            Messenger.PlayerMsg(client, "A waterfall crashes down with a mighty roar...", Text.Grey);
                        }
                        break;
                    case 8: {//for west wing
                            if (client.Player.HasItem(249) > 0) {
                                Messenger.AskQuestion(client, "AbandonedMansion", "Will you use the West Wing Key?", -1);
                            } else {
                                StoryManager.PlayStory(client, 298);
                            }
                        }
                        break;
                    case 9: {//chamber tile; doesn't do anything here

                        }
                        break;
                    case 10: {//chamber key
                            int slot = 0;
                            for (int i = 1; i <= client.Player.Inventory.Count; i++) {
                                if (client.Player.Inventory[i].Num == 356 && !client.Player.Inventory[i].Sticky) {
                                    slot = i;
                                    break;
                                }
                            }
                            if (slot > 0) {
                                Messenger.AskQuestion(client, "UseItem:356", "Will you use your Silver Key to open the chamber?", -1);
                            }
                        }
                        break;
                    case 11: {//secret room
                            if (client.Player.HasItem(250) > 0) {
                                StoryManager.PlayStory(client, 299);
                            } else {
                                StoryManager.PlayStory(client, 300);
                            }
                        }
                        break;
                    case 12: {//Hallowed Well

                                Story story = new Story();
                                StorySegment segment = new StorySegment();
                                segment.Action = Enums.StoryAction.Say;
                                segment.AddParameter("Text", "This well makes you feel uneasy...  It's feels as though it wants to suck you in...");
                                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.Say;
                                segment.AddParameter("Text", "Something shiny seems to glint from the bottom...");
                                segment.AddParameter("Mugshot", "-1");
                                segment.Parameters.Add("Speed", "0");
                                segment.Parameters.Add("PauseLocation", "0");
                                story.Segments.Add(segment);

                        StoryManager.PlayStory(client, story);

                            //Messenger.AskQuestion(client, "HallowedWell", "Will you jump into the well?", -1);
                        }
                        break;
                    case 13: {//for the Dive Whirlpool itself
                            Messenger.PlayerMsg(client, "A powerful whirlpool is pulling pulling everything into the depths...", Text.Grey);
                        }
                        break;
                    case 14: {
                            Messenger.AskQuestion(client, "CliffsideTablet", "Will you rip one of the tablets off the wall?", -1);
                        }
                        break;
                    case 15: {
                            if (client.Player.HasItem(479) > 0) {
                                StoryManager.PlayStory(client, 121);
                            } else {
                                StoryManager.PlayStory(client, 120);
                            }
                        }
                        break;
                    case 16: { // Register for tournament
                            if (client.Player.Tournament == null) {
                                if (TournamentManager.Tournaments.Count > 0) {
                                    Story story = new Story();
                                    StoryBuilderSegment segment = StoryBuilder.BuildStory();
                                    StoryBuilder.AppendSaySegment(segment, "Hello! I can help you join a tournament!", -1, 0, 0);
                                    StoryBuilder.AppendAskQuestionAction(segment, "Would you like to join a tournament?", 3, 5, -1);
                                    // "Yes" section
                                    StoryBuilder.AppendRunScriptAction(segment, 55, "", "", "", true);
                                    StoryBuilder.AppendGoToSegmentAction(segment, 6);
                                    // "No" section
                                    StoryBuilder.AppendSaySegment(segment, "Come back if you want to join a tournament!", -1, 0, 0);
                                    StoryBuilder.AppendPauseAction(segment, 1);

                                    segment.AppendToStory(story);
                                    StoryManager.PlayStory(client, story);
                                } else {
                                    Story story = new Story();
                                    StoryBuilderSegment segment = StoryBuilder.BuildStory();
                                    StoryBuilder.AppendSaySegment(segment, "Sorry! No tournaments have been created yet! Come back when one has been made!", -1, 0, 0);

                                    segment.AppendToStory(story);
                                    StoryManager.PlayStory(client, story);
                                }
                            }
                        }
                        break;
                    case 17: {
                            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) {
                                Messenger.AskQuestion(client, "Surf", "Water currents lead into the distance... Would you like to use Surf?", -1);
                            }

                        }
                        break;
                    case 18: { // Start the tournament
                            if (client.Player.Tournament != null) {
                                Tournament tourny = client.Player.Tournament;
                                if (tourny.RegisteredMembers[client].Admin) {
                                    Messenger.AskQuestion(client, "TournamentAdminOptions", "What would you like to do?", -1, new string[] { "Start Tournament", "Edit Rules" });
                                }
                            }
                        }
                        break;
                    case 19: {
                            //if (client.Player.HasItem(479) > 0) {
                            StoryManager.PlayStory(client, 184);
                            //} else {
                            //    StoryManager.PlayStory(client, 120);
                            //}
                        }
                        break;
                    case 20: {
                            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) {
                                Messenger.AskQuestion(client, "RockClimb", "This wall is very rocky.  Would you like to use Rock Climb?", -1);
                            }

                        }
                        break;
                    case 21: {
                            if (SnowballGame.IsGameOwner(client) == false) {
                                string waitingGameOwner = SnowballGame.FindWaitingGame();
                                if (string.IsNullOrEmpty(waitingGameOwner)) {
                                    // There are no games waiting to start
                                    Messenger.AskQuestion(client, "SnowballGameNewGame", "Would you like to create a new game?", -1);
                                } else {
                                    // There is a game waiting to start! Join in!
                                    Messenger.AskQuestion(client, "SnowballGameJoinGame", "Would you like to join the game?", -1);
                                }
                            } else {
                                Messenger.AskQuestion(client, "SnowballGameStart", "Would you like to start the game with these players?", -1);
                            }
                        }
                        break;

                }
            } catch (Exception ex) {
                Messenger.AdminMsg("Error: ScriptedSign", Text.Black);
            }
        }
Example #40
0
 public static void AppendPlayerPadlockAction(StoryBuilderSegment story, string state)
 {
     StorySegment segment = new StorySegment();
     segment.Action = Enums.StoryAction.PlayerPadlock;
     segment.AddParameter("MovementState", state);
     story.Segments.Add(segment);
 }
Example #41
0
        public static void LoadStory(int storyNum, PMDCP.DatabaseConnector.MySql.MySql database)
        {
            if (stories.Stories.ContainsKey(storyNum) == false)
            {
                stories.Stories.Add(storyNum, new Story(storyNum.ToString()));
            }
            Story story = new Story(storyNum.ToString());

            string query = "SELECT revision, " +
                           "name, " +
                           "story_start, " +
                           "is_sandboxed, " +
                           "zone_id " +
                           "FROM story WHERE story.num = \'" + storyNum + "\'";

            DataColumnCollection row = database.RetrieveRow(query);

            if (row != null)
            {
                story.Revision    = row["revision"].ValueString.ToInt();
                story.Name        = row["name"].ValueString;
                story.StoryStart  = row["story_start"].ValueString.ToInt();
                story.IsSandboxed = row["is_sandboxed"].ValueString.ToBool();
                story.ZoneID      = row["zone_id"].ValueString.ToInt();
            }

            query = "SELECT segment, " +
                    "action, " +
                    "checkpoint " +
                    "FROM story_segment WHERE story_segment.num = \'" + storyNum + "\'";

            List <DataColumnCollection> columnCollections = database.RetrieveRows(query);

            if (columnCollections == null)
            {
                columnCollections = new List <DataColumnCollection>();
            }
            foreach (DataColumnCollection columnCollection in columnCollections)
            {
                StorySegment segment = new StorySegment();

                int segmentNum = columnCollection["segment"].ValueString.ToInt();

                segment.Action = (Enums.StoryAction)columnCollection["action"].ValueString.ToInt();
                bool isCheckpoint = columnCollection["checkpoint"].ValueString.ToBool();

                string query2 = "SELECT param_key, " +
                                "param_val " +
                                "FROM story_param WHERE story_param.num = \'" + storyNum + "\' AND story_param.segment = \'" + segmentNum + "\'";

                List <DataColumnCollection> columnCollections2 = database.RetrieveRows(query2);
                if (columnCollections2 == null)
                {
                    columnCollections2 = new List <DataColumnCollection>();
                }
                foreach (DataColumnCollection columnCollection2 in columnCollections2)
                {
                    string paramKey = columnCollection2["param_key"].ValueString;
                    string paramVal = columnCollection2["param_val"].ValueString;
                    segment.Parameters.Add(paramKey, paramVal);
                }
                story.Segments.Add(segment);

                if (isCheckpoint)
                {
                    story.ExitAndContinue.Add(segmentNum);
                }
            }

            stories.Stories[storyNum] = story;
        }
Example #42
0
 public static void AppendRunScriptAction(StoryBuilderSegment story, int scriptIndex, string param1, string param2, string param3, bool pause)
 {
     StorySegment segment = new StorySegment();
     segment.Action = Enums.StoryAction.RunScript;
     segment.AddParameter("ScriptIndex", scriptIndex.ToString());
     segment.AddParameter("ScriptParam1", param1);
     segment.AddParameter("ScriptParam2", param2);
     segment.AddParameter("ScriptParam3", param3);
     segment.AddParameter("Pause", pause.ToIntString());
     story.Segments.Add(segment);
 }
Example #43
0
 public static void AppendShowImageAction(StoryBuilderSegment story, string file, string imageID, int x, int y)
 {
     StorySegment segment = new StorySegment();
     segment.Action = Enums.StoryAction.ShowImage;
     segment.AddParameter("File", file);
     segment.AddParameter("ImageID", imageID);
     segment.AddParameter("X", x.ToString());
     segment.AddParameter("Y", y.ToString());
     story.Segments.Add(segment);
 }
Example #44
0
 public static void AppendShowBackgroundAction(StoryBuilderSegment story, string file)
 {
     StorySegment segment = new StorySegment();
     segment.Action = Enums.StoryAction.ShowBackground;
     segment.AddParameter("File", file);
     story.Segments.Add(segment);
 }
Example #45
0
 public static void AppendStopMusicAction(StoryBuilderSegment story)
 {
     StorySegment segment = new StorySegment();
     segment.Action = Enums.StoryAction.StopMusic;
     story.Segments.Add(segment);
 }
Example #46
0
 public static void AppendShowPlayersAction(StoryBuilderSegment story)
 {
     StorySegment segment = new StorySegment();
     segment.Action = Enums.StoryAction.ShowPlayers;
     story.Segments.Add(segment);
 }
Example #47
0
 public static void AppendFNPCEmotionAction(StoryBuilderSegment story, string id, int emotion)
 {
     StorySegment segment = new StorySegment();
     segment.Action = Enums.StoryAction.FNPCEmotion;
     segment.AddParameter("ID", id);
     segment.AddParameter("Emotion", emotion.ToString());
     story.Segments.Add(segment);
 }
Example #48
0
 public static void AppendWaitForMapAction(StoryBuilderSegment story, string map)
 {
     StorySegment segment = new StorySegment();
     segment.Action = Enums.StoryAction.WaitForMap;
     segment.AddParameter("MapID", map);
     story.Segments.Add(segment);
 }
Example #49
0
        public static void AppendGoToSegmentAction(StoryBuilderSegment story, int segment)
        {
            StorySegment tempSegment = new StorySegment();
            tempSegment.Action = Enums.StoryAction.GoToSegment;
            tempSegment.AddParameter("Segment", segment.ToString());

            story.Segments.Add(tempSegment);
        }
Example #50
0
 public static void AppendHideImageAction(StoryBuilderSegment story, string imageID)
 {
     StorySegment segment = new StorySegment();
     segment.Action = Enums.StoryAction.HideImage;
     segment.AddParameter("ImageID", imageID);
     story.Segments.Add(segment);
 }
Example #51
0
 public static void AppendHideNPCsAction(StoryBuilderSegment story)
 {
     StorySegment segment = new StorySegment();
     segment.Action = Enums.StoryAction.HideNPCs;
     story.Segments.Add(segment);
 }
Example #52
0
        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);
            }
        }
Example #53
0
        public static void AppendEntranceWarning(Story story, string dungeonName, string[] restrictionString)
        {
            //if (DungeonManager.Dungeons[dungeonIndex].ScriptList.ContainsKey(2)) {

            StorySegment segment = new StorySegment();

            if (restrictionString.Length == 1) {

                segment.Action = Enums.StoryAction.Say;
                segment.AddParameter("Text", "Caution!  " + GetWarningString(restrictionString[0].Split(',')));
                segment.AddParameter("Mugshot", "-1");
                segment.Parameters.Add("Speed", "0");
                segment.Parameters.Add("PauseLocation", "0");
                story.Segments.Add(segment);
                return;
            } else {

                segment.Action = Enums.StoryAction.Say;
                segment.AddParameter("Text", "Caution!  There are certain restrictions to entering " + dungeonName + ".");
                segment.AddParameter("Mugshot", "-1");
                segment.Parameters.Add("Speed", "0");
                segment.Parameters.Add("PauseLocation", "0");
                story.Segments.Add(segment);
            }

            for (int i = 0; i < restrictionString.Length; i++) {

                string warning = GetWarningString(restrictionString[i].Split(','));

                segment = new StorySegment();
                segment.Action = Enums.StoryAction.Say;

                if (i == restrictionString.Length - 1) {
                    string start = warning.Substring(0, 1).ToLower();
                    segment.AddParameter("Text", "Also, " + start + warning.Substring(1, warning.Length - 1));
                } else {
                    segment.AddParameter("Text", warning + "..");
                }

                segment.AddParameter("Mugshot", "-1");
                segment.Parameters.Add("Speed", "0");
                segment.Parameters.Add("PauseLocation", "0");
                story.Segments.Add(segment);
            }

            //} else {
            //	return null;
            //}
        }
Example #54
0
 public static void AppendDeleteFNPCAction(StoryBuilderSegment story, string id)
 {
     StorySegment segment = new StorySegment();
     segment.Action = Enums.StoryAction.DeleteFNPC;
     segment.AddParameter("ID", id);
     story.Segments.Add(segment);
 }
        public static void LoadStory(int storyNum, MySql database)
        {
            if (stories.Stories.ContainsKey(storyNum) == false)
                stories.Stories.Add(storyNum, new Story(storyNum.ToString()));
            Story story = new Story(storyNum.ToString());

            string query = "SELECT revision, " +
                "name, " +
                "story_start " +
                "FROM story WHERE story.num = \'" + storyNum + "\'";

            DataColumnCollection row = database.RetrieveRow(query);
            if (row != null)
            {
                story.Revision = row["revision"].ValueString.ToInt();
                story.Name = row["name"].ValueString;
                story.StoryStart = row["story_start"].ValueString.ToInt();
            }

            query = "SELECT segment, " +
                "action, " +
                "checkpoint " +
                "FROM story_segment WHERE story_segment.num = \'" + storyNum + "\'";

            List<DataColumnCollection> columnCollections = database.RetrieveRows(query);
            if (columnCollections == null) columnCollections = new List<DataColumnCollection>();
            foreach (DataColumnCollection columnCollection in columnCollections)
            {

                StorySegment segment = new StorySegment();

                int segmentNum = columnCollection["segment"].ValueString.ToInt();

                segment.Action = (Enums.StoryAction)columnCollection["action"].ValueString.ToInt();
                bool isCheckpoint = columnCollection["checkpoint"].ValueString.ToBool();

                string query2 = "SELECT param_key, " +
                    "param_val " +
                    "FROM story_param WHERE story_param.num = \'" + storyNum + "\' AND story_param.segment = \'" + segmentNum + "\'";

                List<DataColumnCollection> columnCollections2 = database.RetrieveRows(query2);
                if (columnCollections2 == null) columnCollections2 = new List<DataColumnCollection>();
                foreach (DataColumnCollection columnCollection2 in columnCollections2)
                {
                    string paramKey = columnCollection2["param_key"].ValueString;
                    string paramVal = columnCollection2["param_val"].ValueString;
                    segment.Parameters.Add(paramKey, paramVal);
                }
                story.Segments.Add(segment);

                if (isCheckpoint)
                {
                    story.ExitAndContinue.Add(segmentNum);
                }
            }

            stories.Stories[storyNum] = story;
        }