コード例 #1
0
ファイル: BasicMap.cs プロジェクト: SupaFresh/Server
        public bool WillSpawnNow(MapNpcPreset npc)
        {
            int NPCNum = npc.NpcNum;

            if (NPCNum <= 0)
            {
                return(false);
            }

            if (NpcManager.Npcs[NPCNum].SpawnWeather != Enums.Weather.Ambiguous)
            {
                if (this.Weather != NpcManager.Npcs[NPCNum].SpawnWeather)
                {
                    return(false);
                }
            }

            switch (Globals.ServerTime)
            {
            case Enums.Time.Dawn:
            {
                if (NpcManager.Npcs[NPCNum].SpawnsAtDawn)
                {
                    return(true);
                }
            }
            break;

            case Enums.Time.Day:
            {
                if (NpcManager.Npcs[NPCNum].SpawnsAtDay)
                {
                    return(true);
                }
            }
            break;

            case Enums.Time.Dusk:
            {
                if (NpcManager.Npcs[NPCNum].SpawnsAtDusk)
                {
                    return(true);
                }
            }
            break;

            case Enums.Time.Night:
            {
                if (NpcManager.Npcs[NPCNum].SpawnsAtNight)
                {
                    return(true);
                }
            }
            break;
            }

            return(false);
        }
コード例 #2
0
 public RDungeonFloor()
 {
     Traps = new List<int>();
     Weather = new List<Enums.Weather>();
     Npc = new MapNpcPreset[Constants.MAX_MAP_NPCS];
     for (int i = 0; i < Npc.Length; i++) {
         Npc[i] = new MapNpcPreset();
     }
     Items = new int[16];
     options = new GeneratorOptions();
 }
コード例 #3
0
ファイル: MapCloner.cs プロジェクト: ScruffyKnight/PMU-Server
        public static void CloneMapNpcs(IMap sourceMap, IMap destinationMap)
        {
            for (int i = 0; i < sourceMap.Npc.Count; i++) {
                MapNpcPreset newNpc = new MapNpcPreset();
                newNpc.NpcNum = sourceMap.Npc[i].NpcNum;
                newNpc.MinLevel = sourceMap.Npc[i].MinLevel;
                newNpc.MaxLevel = sourceMap.Npc[i].MaxLevel;
                newNpc.SpawnX = sourceMap.Npc[i].SpawnX;
                newNpc.SpawnY = sourceMap.Npc[i].SpawnY;
                newNpc.AppearanceRate = sourceMap.Npc[i].AppearanceRate;
                newNpc.StartStatus = sourceMap.Npc[i].StartStatus;
                newNpc.StartStatusCounter = sourceMap.Npc[i].StartStatusCounter;
                newNpc.StartStatusChance = sourceMap.Npc[i].StartStatusChance;

                destinationMap.Npc.Add(newNpc);
            }
        }
コード例 #4
0
ファイル: MapCloner.cs プロジェクト: PMDShift/Server
        public static void CloneMapNpcs(IMap sourceMap, IMap destinationMap)
        {
            for (int i = 0; i < sourceMap.Npc.Count; i++)
            {
                MapNpcPreset newNpc = new MapNpcPreset();
                newNpc.NpcNum             = sourceMap.Npc[i].NpcNum;
                newNpc.MinLevel           = sourceMap.Npc[i].MinLevel;
                newNpc.MaxLevel           = sourceMap.Npc[i].MaxLevel;
                newNpc.SpawnX             = sourceMap.Npc[i].SpawnX;
                newNpc.SpawnY             = sourceMap.Npc[i].SpawnY;
                newNpc.AppearanceRate     = sourceMap.Npc[i].AppearanceRate;
                newNpc.StartStatus        = sourceMap.Npc[i].StartStatus;
                newNpc.StartStatusCounter = sourceMap.Npc[i].StartStatusCounter;
                newNpc.StartStatusChance  = sourceMap.Npc[i].StartStatusChance;

                destinationMap.Npc.Add(newNpc);
            }
        }
コード例 #5
0
ファイル: Main.cs プロジェクト: MandL27/Server
 public static void AddNpcToMap(IMap map, int npcNum, int minLevel, int maxLevel, int appearanceRate)
 {
     MapNpcPreset npc = new MapNpcPreset();
     npc.NpcNum = npcNum;
     npc.MinLevel = minLevel;
     npc.MaxLevel = maxLevel;
     npc.AppearanceRate = appearanceRate;
     map.Npc.Add(npc);
 }
コード例 #6
0
ファイル: Main.cs プロジェクト: MandL27/Server
 public static void SpawnNpcToMap(IMap map, int npcNum, int minLevel, int maxLevel, int spawnX, int spawnY, PacketHitList packetlist)
 {
     PacketHitList.MethodStart(ref packetlist);
     MapNpcPreset npc = new MapNpcPreset();
     npc.SpawnX = spawnX;
     npc.SpawnY = spawnY;
     npc.NpcNum = npcNum;
     npc.MinLevel = minLevel;
     npc.MaxLevel = maxLevel;
     map.SpawnNpc(npc);
     PacketHitList.MethodEnded(ref packetlist);
 }
コード例 #7
0
 public static void SpawnNpcs(Client client, IMap imap)
 {
     //new NPC code
     //hack it in for now, make it clean later...
     int rand;
     int[] npcs = new int[] { 558, 559, 560, 571, 572, 854, 855, 856, 857, 858, 859, 860, 861, 862, 863 };
     if (imap.MaxX == 19) imap.MaxNpcs = 8;
     else imap.MaxNpcs = 16;
     imap.MinNpcs = 2;
     imap.NpcSpawnTime = 300;
     for (int i = 1; i <= 9; i++) {
         MapNpcPreset npc = new MapNpcPreset();
         rand = Server.Math.Rand(0, npcs.Length);
         npc.NpcNum = npcs[rand];
         if (npcs[rand] == 859) {
             npc.MinLevel = 10;
             npc.MaxLevel = 10;
         } else {
             npc.MinLevel = 70;
             npc.MaxLevel = 100;
         }
         npc.AppearanceRate = 100;
         imap.Npc.Add(npc);
     }
     if (imap.MaxX == 19) {
         rand = Server.Math.Rand(0, 20);
         if (rand == 0) { //no NPCs
             //do nothing
         } else if (rand > 0 && rand <= 3) { //1 NPC
             imap.MinNpcs = 1;
         } else if (rand > 3 && rand <= 9) { //2 NPCs
             imap.MinNpcs = 2;
         } else if (rand > 9 && rand <= 15) { //3 NPCs
             imap.MinNpcs = 3;
         } else if (rand > 15 && rand <= 18) { //4 NPCs
             imap.MinNpcs = 4;
         } else { //rand == 19, 5 NPCs
             imap.MinNpcs = 5;
         }
     } else {
         rand = Server.Math.Rand(0,25);
         if (rand == 0) { //no NPCs
             //do nothing
         } else if (rand > 0 && rand <= 2) { //1 NPC
             imap.MinNpcs = 1;
         } else if (rand > 2 && rand <= 5) { //2 NPCs
             imap.MinNpcs = 2;
         } else if (rand > 5 && rand <= 9) { //3 NPCs
             imap.MinNpcs = 3;
         } else if (rand > 9 && rand <= 14) { //4 NPCs
             imap.MinNpcs = 4;
         } else if (rand > 14 && rand <= 18) { //5 NPCs
             imap.MinNpcs = 5;
         } else if (rand > 18 && rand <= 21) { //6 NPCs
             imap.MinNpcs = 6;
         } else if (rand > 21 && rand <= 23) { //7 NPCs
             imap.MinNpcs = 7;
         } else { //rand == 24, 8 NPCs
             imap.MinNpcs = 8;
         }
        	}
 }
コード例 #8
0
ファイル: BasicMap.cs プロジェクト: SupaFresh/Server
 public MapNpc SpawnNpc(MapNpcPreset npc)
 {
     return(SpawnNpc(npc, false));
 }
コード例 #9
0
ファイル: BasicMap.cs プロジェクト: MandL27/Server
 public void SpawnNpc(MapNpcPreset npc)
 {
     SpawnNpc(npc, false);
 }
コード例 #10
0
ファイル: BasicMap.cs プロジェクト: MandL27/Server
        public bool WillSpawnNow(MapNpcPreset npc)
        {
            int NPCNum = npc.NpcNum;
            if (NPCNum <= 0) return false;

            switch (Globals.ServerTime) {
                case Enums.Time.Dawn: {
                        if (NpcManager.Npcs[NPCNum].SpawnsAtDawn) {
                            return true;
                        }
                    }
                    break;
                case Enums.Time.Day: {
                        if (NpcManager.Npcs[NPCNum].SpawnsAtDay) {
                            return true;
                        }
                    }
                    break;
                case Enums.Time.Dusk: {
                        if (NpcManager.Npcs[NPCNum].SpawnsAtDusk) {
                            return true;
                        }
                    }
                    break;
                case Enums.Time.Night: {
                        if (NpcManager.Npcs[NPCNum].SpawnsAtNight) {
                            return true;
                        }
                    }
                    break;
            }

            return false;
        }
コード例 #11
0
 public void Remove(MapNpcPreset npcPreset)
 {
     npcPresets.Remove(npcPreset);
     rawMap.Npc.Remove(npcPreset.RawNpcPreset);
 }
コード例 #12
0
ファイル: RDungeonManager.cs プロジェクト: pzaps/Server
        public static RDungeon LoadRDungeon(int dungeonNum)
        {
            RDungeon dungeon = new RDungeon(dungeonNum);
            string FilePath = IO.Paths.RDungeonsFolder + "rdungeon" + dungeonNum.ToString() + ".dat";
            using (System.IO.StreamReader reader = new System.IO.StreamReader(FilePath)) {
                while (!(reader.EndOfStream)) {
                    string[] parse = reader.ReadLine().Split('|');
                    switch (parse[0].ToLower()) {
                        case "rdungeondata":
                            if (parse[1].ToLower() != "v4") {
                                reader.Close();
                                reader.Dispose();
                                return null;
                            }
                            break;
                        case "data":
                            dungeon.DungeonName = parse[1];
                            dungeon.Direction = (Enums.Direction)parse[2].ToInt();
                            dungeon.MaxFloors = parse[3].ToInt();
                            dungeon.Recruitment = parse[4].ToBool();
                            dungeon.Exp = parse[5].ToBool();
                            dungeon.WindTimer = parse[6].ToInt();
                            dungeon.RDungeonIndex = parse[7].ToInt();
                            break;
                        case "floor": {
                                RDungeonFloor floor = new RDungeonFloor();
                                floor.Options.TrapMin = parse[1].ToInt();
                                floor.Options.TrapMax = parse[2].ToInt();
                                floor.Options.ItemMin = parse[3].ToInt();
                                floor.Options.ItemMax = parse[4].ToInt();
                                floor.Options.Intricacy = parse[5].ToInt();
                                floor.Options.RoomWidthMin = parse[6].ToInt();
                                floor.Options.RoomWidthMax = parse[7].ToInt();
                                floor.Options.RoomLengthMin = parse[8].ToInt();
                                floor.Options.RoomLengthMax = parse[9].ToInt();
                                floor.Options.HallTurnMin = parse[10].ToInt();
                                floor.Options.HallTurnMax = parse[11].ToInt();
                                floor.Options.HallVarMin = parse[12].ToInt();
                                floor.Options.HallVarMax = parse[13].ToInt();
                                floor.Options.WaterFrequency = parse[14].ToInt();
                                floor.Options.Craters = parse[15].ToInt();
                                floor.Options.CraterMinLength = parse[16].ToInt();
                                floor.Options.CraterMaxLength = parse[17].ToInt();
                                floor.Options.CraterFuzzy = parse[18].ToBool();
                                floor.Options.MinChambers = parse[19].ToInt();
                                floor.Options.MaxChambers = parse[20].ToInt();

                                floor.Darkness = parse[21].ToInt();
                                floor.GoalType = (Enums.RFloorGoalType)parse[22].ToInt();
                                floor.GoalMap = parse[23].ToInt();
                                floor.GoalX = parse[24].ToInt();
                                floor.GoalY = parse[25].ToInt();
                                floor.Music = parse[26];

                                #region terrain

                                #region wall
                                floor.StairsX = parse[27].ToInt();
                                floor.StairsSheet = parse[28].ToInt();

                                floor.mGroundX = parse[29].ToInt();
                                floor.mGroundSheet = parse[30].ToInt();

                                floor.mTopLeftX = parse[31].ToInt();
                                floor.mTopLeftSheet = parse[32].ToInt();
                                floor.mTopCenterX = parse[33].ToInt();
                                floor.mTopCenterSheet = parse[34].ToInt();
                                floor.mTopRightX = parse[35].ToInt();
                                floor.mTopRightSheet = parse[36].ToInt();

                                floor.mCenterLeftX = parse[37].ToInt();
                                floor.mCenterLeftSheet = parse[38].ToInt();
                                floor.mCenterCenterX = parse[39].ToInt();
                                floor.mCenterCenterSheet = parse[40].ToInt();
                                floor.mCenterRightX = parse[41].ToInt();
                                floor.mCenterRightSheet = parse[42].ToInt();

                                floor.mBottomLeftX = parse[43].ToInt();
                                floor.mBottomLeftSheet = parse[44].ToInt();
                                floor.mBottomCenterX = parse[45].ToInt();
                                floor.mBottomCenterSheet = parse[46].ToInt();
                                floor.mBottomRightX = parse[47].ToInt();
                                floor.mBottomRightSheet = parse[48].ToInt();

                                floor.mInnerTopLeftX = parse[49].ToInt();
                                floor.mInnerTopLeftSheet = parse[50].ToInt();
                                floor.mInnerBottomLeftX = parse[51].ToInt();
                                floor.mInnerBottomLeftSheet = parse[52].ToInt();

                                floor.mInnerTopRightX = parse[53].ToInt();
                                floor.mInnerTopRightSheet = parse[54].ToInt();
                                floor.mInnerBottomRightX = parse[55].ToInt();
                                floor.mInnerBottomRightSheet = parse[56].ToInt();

                                floor.mColumnTopX = parse[57].ToInt();
                                floor.mColumnTopSheet = parse[58].ToInt();
                                floor.mColumnCenterX = parse[59].ToInt();
                                floor.mColumnCenterSheet = parse[60].ToInt();
                                floor.mColumnBottomX = parse[61].ToInt();
                                floor.mColumnBottomSheet = parse[62].ToInt();

                                floor.mRowLeftX = parse[63].ToInt();
                                floor.mRowLeftSheet = parse[64].ToInt();
                                floor.mRowCenterX = parse[65].ToInt();
                                floor.mRowCenterSheet = parse[66].ToInt();
                                floor.mRowRightX = parse[67].ToInt();
                                floor.mRowRightSheet = parse[68].ToInt();

                                floor.mIsolatedWallX = parse[69].ToInt();
                                floor.mIsolatedWallSheet = parse[70].ToInt();

                                floor.mGroundAltX = parse[71].ToInt();
                                floor.mGroundAltSheet = parse[72].ToInt();
                                floor.mGroundAlt2X = parse[73].ToInt();
                                floor.mGroundAlt2Sheet = parse[74].ToInt();

                                floor.mTopLeftAltX = parse[75].ToInt();
                                floor.mTopLeftAltSheet = parse[76].ToInt();
                                floor.mTopCenterAltX = parse[77].ToInt();
                                floor.mTopCenterAltSheet = parse[78].ToInt();
                                floor.mTopRightAltX = parse[79].ToInt();
                                floor.mTopRightAltSheet = parse[80].ToInt();

                                floor.mCenterLeftAltX = parse[81].ToInt();
                                floor.mCenterLeftAltSheet = parse[82].ToInt();
                                floor.mCenterCenterAltX = parse[83].ToInt();
                                floor.mCenterCenterAltSheet = parse[84].ToInt();
                                floor.mCenterCenterAlt2X = parse[85].ToInt();
                                floor.mCenterCenterAlt2Sheet = parse[86].ToInt();
                                floor.mCenterRightAltX = parse[87].ToInt();
                                floor.mCenterRightAltSheet = parse[88].ToInt();

                                floor.mBottomLeftAltX = parse[89].ToInt();
                                floor.mBottomLeftAltSheet = parse[90].ToInt();
                                floor.mBottomCenterAltX = parse[91].ToInt();
                                floor.mBottomCenterAltSheet = parse[92].ToInt();
                                floor.mBottomRightAltX = parse[93].ToInt();
                                floor.mBottomRightAltSheet = parse[94].ToInt();

                                floor.mInnerTopLeftAltX = parse[95].ToInt();
                                floor.mInnerTopLeftAltSheet = parse[96].ToInt();
                                floor.mInnerBottomLeftAltX = parse[97].ToInt();
                                floor.mInnerBottomLeftAltSheet = parse[98].ToInt();

                                floor.mInnerTopRightAltX = parse[99].ToInt();
                                floor.mInnerTopRightAltSheet = parse[100].ToInt();
                                floor.mInnerBottomRightAltX = parse[101].ToInt();
                                floor.mInnerBottomRightAltSheet = parse[102].ToInt();

                                floor.mColumnTopAltX = parse[103].ToInt();
                                floor.mColumnTopAltSheet = parse[104].ToInt();
                                floor.mColumnCenterAltX = parse[105].ToInt();
                                floor.mColumnCenterAltSheet = parse[106].ToInt();
                                floor.mColumnBottomAltX = parse[107].ToInt();
                                floor.mColumnBottomAltSheet = parse[108].ToInt();

                                floor.mRowLeftAltX = parse[109].ToInt();
                                floor.mRowLeftAltSheet = parse[110].ToInt();
                                floor.mRowCenterAltX = parse[111].ToInt();
                                floor.mRowCenterAltSheet = parse[112].ToInt();
                                floor.mRowRightAltX = parse[113].ToInt();
                                floor.mRowRightAltSheet = parse[114].ToInt();

                                floor.mIsolatedWallAltX = parse[115].ToInt();
                                floor.mIsolatedWallAltSheet = parse[116].ToInt();

                                #endregion

                                #region water

                                floor.mWaterX = parse[117].ToInt();
                                floor.mWaterSheet = parse[118].ToInt();
                                floor.mWaterAnimX = parse[119].ToInt();
                                floor.mWaterAnimSheet = parse[120].ToInt();

                                floor.mShoreTopLeftX = parse[121].ToInt();
                                floor.mShoreTopLeftSheet = parse[122].ToInt();
                                floor.mShoreTopRightX = parse[123].ToInt();
                                floor.mShoreTopRightSheet = parse[124].ToInt();
                                floor.mShoreBottomRightX = parse[125].ToInt();
                                floor.mShoreBottomRightSheet = parse[126].ToInt();
                                floor.mShoreBottomLeftX = parse[127].ToInt();
                                floor.mShoreBottomLeftSheet = parse[128].ToInt();
                                floor.mShoreDiagonalForwardX = parse[129].ToInt();
                                floor.mShoreDiagonalForwardSheet = parse[130].ToInt();
                                floor.mShoreDiagonalBackX = parse[131].ToInt();
                                floor.mShoreDiagonalBackSheet = parse[132].ToInt();

                                floor.mShoreTopX = parse[133].ToInt();
                                floor.mShoreTopSheet = parse[134].ToInt();
                                floor.mShoreRightX = parse[135].ToInt();
                                floor.mShoreRightSheet = parse[136].ToInt();
                                floor.mShoreBottomX = parse[137].ToInt();
                                floor.mShoreBottomSheet = parse[138].ToInt();
                                floor.mShoreLeftX = parse[139].ToInt();
                                floor.mShoreLeftSheet = parse[140].ToInt();
                                floor.mShoreVerticalX = parse[141].ToInt();
                                floor.mShoreVerticalSheet = parse[142].ToInt();
                                floor.mShoreHorizontalX = parse[143].ToInt();
                                floor.mShoreHorizontalSheet = parse[144].ToInt();

                                floor.mShoreInnerTopLeftX = parse[145].ToInt();
                                floor.mShoreInnerTopLeftSheet = parse[146].ToInt();
                                floor.mShoreInnerTopRightX = parse[147].ToInt();
                                floor.mShoreInnerTopRightSheet = parse[148].ToInt();
                                floor.mShoreInnerBottomRightX = parse[149].ToInt();
                                floor.mShoreInnerBottomRightSheet = parse[150].ToInt();
                                floor.mShoreInnerBottomLeftX = parse[151].ToInt();
                                floor.mShoreInnerBottomLeftSheet = parse[152].ToInt();

                                floor.mShoreInnerTopX = parse[153].ToInt();
                                floor.mShoreInnerTopSheet = parse[154].ToInt();
                                floor.mShoreInnerRightX = parse[155].ToInt();
                                floor.mShoreInnerRightSheet = parse[156].ToInt();
                                floor.mShoreInnerBottomX = parse[157].ToInt();
                                floor.mShoreInnerBottomSheet = parse[158].ToInt();
                                floor.mShoreInnerLeftX = parse[159].ToInt();
                                floor.mShoreInnerLeftSheet = parse[160].ToInt();

                                floor.mShoreSurroundedX = parse[161].ToInt();
                                floor.mShoreSurroundedSheet = parse[162].ToInt();

                                floor.mShoreTopLeftAnimX = parse[163].ToInt();
                                floor.mShoreTopLeftAnimSheet = parse[164].ToInt();
                                floor.mShoreTopRightAnimX = parse[165].ToInt();
                                floor.mShoreTopRightAnimSheet = parse[166].ToInt();
                                floor.mShoreBottomRightAnimX = parse[167].ToInt();
                                floor.mShoreBottomRightAnimSheet = parse[168].ToInt();
                                floor.mShoreBottomLeftAnimX = parse[169].ToInt();
                                floor.mShoreBottomLeftAnimSheet = parse[170].ToInt();
                                floor.mShoreDiagonalForwardAnimX = parse[171].ToInt();
                                floor.mShoreDiagonalForwardAnimSheet = parse[172].ToInt();
                                floor.mShoreDiagonalBackAnimX = parse[173].ToInt();
                                floor.mShoreDiagonalBackAnimSheet = parse[174].ToInt();

                                floor.mShoreTopAnimX = parse[175].ToInt();
                                floor.mShoreTopAnimSheet = parse[176].ToInt();
                                floor.mShoreRightAnimX = parse[177].ToInt();
                                floor.mShoreRightAnimSheet = parse[178].ToInt();
                                floor.mShoreBottomAnimX = parse[179].ToInt();
                                floor.mShoreBottomAnimSheet = parse[180].ToInt();
                                floor.mShoreLeftAnimX = parse[181].ToInt();
                                floor.mShoreLeftAnimSheet = parse[182].ToInt();
                                floor.mShoreVerticalAnimX = parse[183].ToInt();
                                floor.mShoreVerticalAnimSheet = parse[184].ToInt();
                                floor.mShoreHorizontalAnimX = parse[185].ToInt();
                                floor.mShoreHorizontalAnimSheet = parse[186].ToInt();

                                floor.mShoreInnerTopLeftAnimX = parse[187].ToInt();
                                floor.mShoreInnerTopLeftAnimSheet = parse[188].ToInt();
                                floor.mShoreInnerTopRightAnimX = parse[189].ToInt();
                                floor.mShoreInnerTopRightAnimSheet = parse[190].ToInt();
                                floor.mShoreInnerBottomRightAnimX = parse[191].ToInt();
                                floor.mShoreInnerBottomRightAnimSheet = parse[192].ToInt();
                                floor.mShoreInnerBottomLeftAnimX = parse[193].ToInt();
                                floor.mShoreInnerBottomLeftAnimSheet = parse[194].ToInt();

                                floor.mShoreInnerTopAnimX = parse[195].ToInt();
                                floor.mShoreInnerTopAnimSheet = parse[196].ToInt();
                                floor.mShoreInnerRightAnimX = parse[197].ToInt();
                                floor.mShoreInnerRightAnimSheet = parse[198].ToInt();
                                floor.mShoreInnerBottomAnimX = parse[199].ToInt();
                                floor.mShoreInnerBottomAnimSheet = parse[200].ToInt();
                                floor.mShoreInnerLeftAnimX = parse[201].ToInt();
                                floor.mShoreInnerLeftAnimSheet = parse[202].ToInt();

                                floor.mShoreSurroundedAnimX = parse[203].ToInt();
                                floor.mShoreSurroundedAnimSheet = parse[204].ToInt();

                                #endregion
                                #endregion

                                floor.GroundTile.Type = (Enums.TileType)parse[205].ToInt();
                                floor.GroundTile.Data1 = parse[206].ToInt();
                                floor.GroundTile.Data2 = parse[207].ToInt();
                                floor.GroundTile.Data3 = parse[208].ToInt();
                                floor.GroundTile.String1 = parse[209];
                                floor.GroundTile.String2 = parse[210];
                                floor.GroundTile.String3 = parse[211];

                                floor.HallTile.Type = (Enums.TileType)parse[212].ToInt();
                                floor.HallTile.Data1 = parse[213].ToInt();
                                floor.HallTile.Data2 = parse[214].ToInt();
                                floor.HallTile.Data3 = parse[215].ToInt();
                                floor.HallTile.String1 = parse[216];
                                floor.HallTile.String2 = parse[217];
                                floor.HallTile.String3 = parse[218];

                                floor.WaterTile.Type = (Enums.TileType)parse[219].ToInt();
                                floor.WaterTile.Data1 = parse[220].ToInt();
                                floor.WaterTile.Data2 = parse[221].ToInt();
                                floor.WaterTile.Data3 = parse[222].ToInt();
                                floor.WaterTile.String1 = parse[223];
                                floor.WaterTile.String2 = parse[224];
                                floor.WaterTile.String3 = parse[225];

                                floor.WallTile.Type = (Enums.TileType)parse[226].ToInt();
                                floor.WallTile.Data1 = parse[227].ToInt();
                                floor.WallTile.Data2 = parse[228].ToInt();
                                floor.WallTile.Data3 = parse[229].ToInt();
                                floor.WallTile.String1 = parse[230];
                                floor.WallTile.String2 = parse[231];
                                floor.WallTile.String3 = parse[232];

                                floor.NpcSpawnTime = parse[233].ToInt();
                                floor.NpcMin = parse[234].ToInt();
                                floor.NpcMax = parse[235].ToInt();

                                int maxItems = parse[236].ToInt();
                                int maxNpcs = parse[237].ToInt();
                                int maxSpecialTiles = parse[238].ToInt();
                                int maxWeather = parse[239].ToInt();
                                int maxChambers = parse[240].ToInt();

                                int n = 241;

                                RDungeonItem item;
                                MapNpcPreset npc;
                                RDungeonTrap specialTile;
                                Server.RDungeons.RDungeonPresetChamber presetChamber;

                                for (int i = 0; i < maxItems; i++) {
                                        item = new RDungeonItem();
                                    item.ItemNum = parse[n].ToInt();
                                    item.MinAmount = parse[n+1].ToInt();
                                    item.MaxAmount = parse[n+2].ToInt();
                                    item.AppearanceRate = parse[n+3].ToInt();
                                    item.StickyRate = parse[n+4].ToInt();
                                    item.Tag = parse[n+5];
                                    item.Hidden = parse[n+6].ToBool();
                                    item.OnGround = parse[n+7].ToBool();
                                    item.OnWater = parse[n+8].ToBool();
                                    item.OnWall = parse[n+9].ToBool();
                                    floor.Items.Add(item);
                                    n += 10;
                                }

                                for (int i = 0; i < maxNpcs; i++) {
                                    npc = new MapNpcPreset();
                                    npc.NpcNum = parse[n].ToInt();
                                    npc.MinLevel = parse[n + 1].ToInt();
                                    npc.MaxLevel = parse[n + 2].ToInt();
                                    npc.AppearanceRate = parse[n + 3].ToInt();
                                    npc.StartStatus = (Enums.StatusAilment)parse[n + 4].ToInt();
                                    npc.StartStatusCounter = parse[n + 5].ToInt();
                                    npc.StartStatusChance = parse[n + 6].ToInt();
                                    floor.Npcs.Add(npc);
                                    n+= 7;
                                }

                                for (int i = 0; i < maxSpecialTiles; i++) {
                                        specialTile = new RDungeonTrap();
                                        specialTile.SpecialTile.Type = (Enums.TileType)parse[n].ToInt();
                                        specialTile.SpecialTile.Data1 = parse[n + 1].ToInt();
                                        specialTile.SpecialTile.Data2 = parse[n + 2].ToInt();
                                        specialTile.SpecialTile.Data3 = parse[n + 3].ToInt();
                                        specialTile.SpecialTile.String1 = parse[n + 4];
                                        specialTile.SpecialTile.String2 = parse[n + 5];
                                        specialTile.SpecialTile.String3 = parse[n + 6];
                                        specialTile.SpecialTile.Ground = parse[n + 7].ToInt();
                                        specialTile.SpecialTile.GroundSet = parse[n + 8].ToInt();
                                        specialTile.SpecialTile.GroundAnim = parse[n + 9].ToInt();
                                        specialTile.SpecialTile.GroundAnimSet = parse[n + 10].ToInt();
                                        specialTile.SpecialTile.Mask = parse[n + 11].ToInt();
                                        specialTile.SpecialTile.MaskSet = parse[n + 12].ToInt();
                                        specialTile.SpecialTile.Anim	 = parse[n + 13].ToInt();
                                        specialTile.SpecialTile.AnimSet = parse[n + 14].ToInt();
                                        specialTile.SpecialTile.Mask2 = parse[n + 15].ToInt();
                                        specialTile.SpecialTile.Mask2Set = parse[n + 16].ToInt();
                                        specialTile.SpecialTile.M2Anim = parse[n + 17].ToInt();
                                        specialTile.SpecialTile.M2AnimSet = parse[n + 18].ToInt();
                                        specialTile.SpecialTile.Fringe = parse[n + 19].ToInt();
                                        specialTile.SpecialTile.FringeSet = parse[n + 20].ToInt();
                                        specialTile.SpecialTile.FAnim = parse[n + 21].ToInt();
                                        specialTile.SpecialTile.FAnimSet = parse[n + 22].ToInt();
                                        specialTile.SpecialTile.Fringe2 = parse[n + 23].ToInt();
                                        specialTile.SpecialTile.Fringe2Set = parse[n + 24].ToInt();
                                        specialTile.SpecialTile.F2Anim = parse[n + 25].ToInt();
                                        specialTile.SpecialTile.F2AnimSet = parse[n + 26].ToInt();
                                        specialTile.SpecialTile.RDungeonMapValue = parse[n + 27].ToInt();
                                        specialTile.AppearanceRate = parse[n + 28].ToInt();
                                        floor.SpecialTiles.Add(specialTile);
                                    n+= 29;
                                }

                                for (int i = 0; i < maxWeather; i++) {
                                    floor.Weather.Add((Enums.Weather)parse[n].ToInt());
                                    n++;
                                }
                                for (int i = 0; i < maxChambers; i++)
                                {
                                    presetChamber = new Server.RDungeons.RDungeonPresetChamber();
                                    presetChamber.ChamberNum = parse[n].ToInt();
                                    presetChamber.String1 = parse[n + 1];
                                    presetChamber.String2 = parse[n + 2];
                                    presetChamber.String3 = parse[n + 3];
                                    n += 3;
                                }
                                dungeon.Floors.Add(floor);
                            }
                            break;

                    }
                }
            }
            return dungeon;
        }
コード例 #13
0
ファイル: BasicMap.cs プロジェクト: MystikalPooka/PJOFiles
 public void RemoveNpc(int mapNpcNum)
 {
     Npc[mapNpcNum] = new MapNpcPreset();
 }
コード例 #14
0
ファイル: MapInteractions.cs プロジェクト: pzaps/Server
        public static void CreateChamber(RDungeonMap map, DungeonArrayFloor arrayFloor, int chamberNum, string string1, string string2, string string3)
        {
            try {
                bool started = false;
                //Messenger.AdminMsg(chamberNum.ToString(), Text.Black);
                switch (chamberNum) {
                    case 1: {//pre-mapped
                        DungeonArrayRoom room = arrayFloor.Rooms[arrayFloor.Chamber.X, arrayFloor.Chamber.Y];
                        string[] start = string2.Split(':');
                        string[] end = string3.Split(':');
                        int sourceX = start[0].ToInt();
                        int sourceY = start[1].ToInt();
                        int xDiff = end[0].ToInt() - sourceX + 1;
                        int yDiff = end[1].ToInt() - sourceY + 1;

                        IMap sourceMap = MapManager.RetrieveMap(string1.ToInt());
                        for (int x = 0; x < xDiff; x++) {
                            for (int y = 0; y < yDiff; y++) {
                                MapCloner.CloneTile(sourceMap, sourceX + x, sourceY + y, map.Tile[room.StartX + x, room.StartY + y]);
                                arrayFloor.MapArray[room.StartX + x, room.StartY + y] = sourceMap.Tile[sourceX + x, sourceY + y].RDungeonMapValue;
                            }
                        }
                        }
                        break;
                    case 2: {//no chamber

                        }
                        break;
                    case 3: {//chamber that accepts start and end

                        }
                        break;
                    case 4: {//Ice Puzzle
                            int startX = 0;
                            int startY = 0;
                            string[] parse = string1.Split(':');
                            bool start = false;
                            bool end = false;
                            if (parse[0] == "1") {
                                start = true;
                            }
                            if (parse[1] == "1") {
                                end = true;
                            }
                            if (start && end) {
                                for (int x = 0; x < map.MaxX; x++) {
                                    for (int y = 0; y < map.MaxY; y++) {
                                        map.Tile[x, y].Type = Enums.TileType.Blocked;
                                        arrayFloor.MapArray[x, y] = 1025;
                                    }
                                }
                            }

                            DungeonArrayRoom room = arrayFloor.Rooms[arrayFloor.Chamber.X, arrayFloor.Chamber.Y];
                            parse = string3.Split(':');
                            int xDiff = room.EndX - room.StartX + 1;
                            int yDiff = room.EndY - room.StartY + 1;
                            int[,] intArray = new int[xDiff - 2, yDiff-2];

                            if (start && end) {

                                intArray = RandomIce.GenIcePuzzle(xDiff - 2, yDiff-2, parse[2].ToInt(), parse[3].ToInt(), parse[4].ToInt(), parse[5].ToInt(), parse[6].ToInt(), false, false);
                            } else if (end) {
                                intArray = RandomIce.GenIcePuzzle(xDiff - 2, yDiff-2, parse[2].ToInt(), parse[3].ToInt(), parse[4].ToInt(), parse[5].ToInt(), parse[6].ToInt(), true, false);
                            }

                            //put it on the map
                            for (int y = 0; y < yDiff; y++) {
                                for (int x = 0; x < xDiff; x++) {
                                    if (x == 0 || x == xDiff - 1 || y == 0 || y == yDiff - 1) {
                                        map.Tile[room.StartX + x, room.StartY + y].Type = Enums.TileType.Slippery;
                                        arrayFloor.MapArray[room.StartX + x, room.StartY + y] = 2;
                                    } else if (intArray[x-1,y-1] == RandomIce.START) {

                                        map.Tile[room.StartX + x, room.StartY + y].Type = Enums.TileType.Walkable;
                                        arrayFloor.MapArray[room.StartX + x, room.StartY + y] = 6;
                                        startX = x;
                                        startY = y;
                                        started = true;
                                    } else if (intArray[x-1,y-1] == RandomIce.END) {

                                        map.Tile[room.StartX + x, room.StartY + y].Type = Enums.TileType.RDungeonGoal;
                                        arrayFloor.MapArray[room.StartX + x, room.StartY + y] = 7;
                                    } else if (intArray[x-1,y-1] == RandomIce.BLOCK) {
                                        map.Tile[room.StartX + x, room.StartY + y].Type = Enums.TileType.Blocked;
                                        arrayFloor.MapArray[room.StartX + x, room.StartY + y] = 1;
                                    } else if (intArray[x-1,y-1] == RandomIce.GROUND) {
                                        map.Tile[room.StartX + x, room.StartY + y].Type = Enums.TileType.Hallway;
                                        arrayFloor.MapArray[room.StartX + x, room.StartY + y] = 3;
                                    } else {
                                        map.Tile[room.StartX + x, room.StartY + y].Type = Enums.TileType.Slippery;
                                        arrayFloor.MapArray[room.StartX + x, room.StartY + y] = 2;
                                    }

                                }
                            }

                            if (!start && end) {
                                if (startX == 1) {
                                    map.Tile[room.StartX + startX - 1, room.StartY + startY].Type = Enums.TileType.Walkable;
                                    arrayFloor.MapArray[room.StartX + startX - 1, room.StartY + startY] = 6;
                                } else if (startX == xDiff - 2) {
                                    map.Tile[room.StartX + startX + 1, room.StartY + startY].Type = Enums.TileType.Walkable;
                                    arrayFloor.MapArray[room.StartX + startX + 1, room.StartY + startY] = 6;
                                    }
                                if (startY == 1) {
                                    map.Tile[room.StartX + startX, room.StartY + startY - 1].Type = Enums.TileType.Walkable;
                                    arrayFloor.MapArray[room.StartX + startX, room.StartY + startY - 1] = 6;
                                } else if (startY == yDiff - 2) {
                                    map.Tile[room.StartX + startX, room.StartY + startY + 1].Type = Enums.TileType.Walkable;
                                    arrayFloor.MapArray[room.StartX + startX, room.StartY + startY + 1] = 6;
                                }
                            }

                            if (start && end) {
                                map.Tile[room.StartX, room.StartY].Type = Enums.TileType.Scripted;
                                map.Tile[room.StartX, room.StartY].Data1 = 15;
                                map.Tile[room.StartX, room.StartY].Data3 = 1;
                                arrayFloor.MapArray[room.StartX, room.StartY] = 4;
                            } else if (end) {
                                map.Tile[room.StartX, room.StartY].Type = Enums.TileType.Walkable;
                                arrayFloor.MapArray[room.StartX, room.StartY] = 3;
                                map.Tile[room.EndX, room.EndY].Type = Enums.TileType.Walkable;
                                arrayFloor.MapArray[room.EndX, room.EndY] = 3;
                            }
                            if (!started && start) {
                                Messenger.AdminMsg("Bad puzzle generated", Text.Red);
                            }
                        }
                        break;
                    case 10: {//pre-mapped locked chamber
                        DungeonArrayRoom room = arrayFloor.Rooms[arrayFloor.Chamber.X, arrayFloor.Chamber.Y];

                        //IMap sourceMap = MapManager.RetrieveMap(string1.ToInt());
                        for (int x = 0; x < 5; x++) {
                            for (int y = 0; y < 5; y++) {
                                if (x == 2 && y == 3) {
                                    map.Tile[room.StartX + x, room.StartY + y].Type = Enums.TileType.ScriptedSign;
                                    map.Tile[room.StartX + x, room.StartY + y].Mask2 = 6;
                                    map.Tile[room.StartX + x, room.StartY + y].Mask2Set = 4;
                                    map.Tile[room.StartX + x, room.StartY + y].Data1 = 10;
                                    map.Tile[room.StartX + x, room.StartY + y].String1 = "-2:-3";
                                    map.Tile[room.StartX + x, room.StartY + y].String2 = "2:1";
                                    arrayFloor.MapArray[room.StartX + x, room.StartY + y] = 1025;
                                } else if (x == 0 || y == 0 || x == 4 || y == 4) {
                                    arrayFloor.MapArray[room.StartX + x, room.StartY + y] = 4;
                                } else if (x == 1 || y == 1 || x == 3 || y == 3) {
                                    map.Tile[room.StartX + x, room.StartY + y].Type = Enums.TileType.Blocked;
                                    arrayFloor.MapArray[room.StartX + x, room.StartY + y] = 1025;
                                } else if (x == 2 && y == 2) {
                                    map.Tile[room.StartX + x, room.StartY + y].Type = Enums.TileType.ScriptedSign;
                                    map.Tile[room.StartX + x, room.StartY + y].Data1 = 9;
                                    map.Tile[room.StartX + x, room.StartY + y].String1 = string1;
                                    map.Tile[room.StartX + x, room.StartY + y].String2 = string2;
                                    map.Tile[room.StartX + x, room.StartY + y].String3 = "3";
                                    arrayFloor.MapArray[room.StartX + x, room.StartY + y] = 1025;
                                }

                            }
                        }
                        }
                        break;
                    case 11: {//3x3 kecleon shop
                        DungeonArrayRoom room = arrayFloor.Rooms[arrayFloor.Chamber.X, arrayFloor.Chamber.Y];

                        //IMap sourceMap = MapManager.RetrieveMap(string1.ToInt());
                        //Messenger.AdminMsg("Room creating", Text.Red);
                        for (int x = 0; x < 7; x++) {
                            for (int y = 0; y < 7; y++) {
                                if (x <= 1 || y <= 1 || x >= 5 || y >= 5) {
                                    //free space
                                    arrayFloor.MapArray[room.StartX + x, room.StartY + y] = 4;
                                } else if (x == 2 || y == 2 || x == 4 || y == 4) {
                                    if (Server.Math.Rand(0,2) == 0) {
                                        //shop
                                        int itemNum = 0;
                                        int itemVal = 1;
                                        string tag = "";
                                        int price = 1;
                                        string[] itemSelection = string2.Split(';');
                                        string[] priceSelection = string3.Split(';');
                                        int chosenIndex = Server.Math.Rand(0, itemSelection.Length);
                                        string[] chosenItem = itemSelection[chosenIndex].Split(',');
                                        if (chosenItem[0].IsNumeric()) {
                                            if (chosenItem.Length == 2 && chosenItem[1].IsNumeric()) {
                                                itemNum = chosenItem[0].ToInt();
                                                itemVal = chosenItem[1].ToInt();
                                                price = priceSelection[chosenIndex].ToInt();
                                            } else if (chosenItem.Length == 3 && chosenItem[2].IsNumeric()) {
                                                itemNum = chosenItem[0].ToInt();
                                                itemVal = chosenItem[1].ToInt();
                                                tag = chosenItem[2];
                                                price = priceSelection[chosenIndex].ToInt();
                                            } else {
                                                itemNum = chosenItem[0].ToInt();
                                                price = priceSelection[chosenIndex].ToInt();
                                            }
                                        }
                                        map.Tile[room.StartX + x, room.StartY + y].Type = Enums.TileType.DropShop;
                                        map.Tile[room.StartX + x, room.StartY + y].Mask2 = 67;
                                        map.Tile[room.StartX + x, room.StartY + y].Mask2Set = 0;
                                        map.Tile[room.StartX + x, room.StartY + y].Data1 = price; //price per unit
                                        map.Tile[room.StartX + x, room.StartY + y].Data2 = itemNum; //item
                                        map.Tile[room.StartX + x, room.StartY + y].Data3 = itemVal; //amount
                                        map.Tile[room.StartX + x, room.StartY + y].String1 = "";//no tag//no charID
                                        map.Tile[room.StartX + x, room.StartY + y].String2 = "";//no tag
                                        arrayFloor.MapArray[room.StartX + x, room.StartY + y] = 1027;
                                    } else {
                                        map.Tile[room.StartX + x, room.StartY + y].Type = Enums.TileType.DropShop;
                                        map.Tile[room.StartX + x, room.StartY + y].Mask2 = 67;
                                        map.Tile[room.StartX + x, room.StartY + y].Mask2Set = 0;
                                        map.Tile[room.StartX + x, room.StartY + y].Data1 = 0; //price per unit
                                        map.Tile[room.StartX + x, room.StartY + y].Data2 = 0; //item
                                        map.Tile[room.StartX + x, room.StartY + y].Data2 = 0; //amount
                                        map.Tile[room.StartX + x, room.StartY + y].String1 = "";//no tag//no charID
                                        map.Tile[room.StartX + x, room.StartY + y].String2 = "";//no tag
                                        arrayFloor.MapArray[room.StartX + x, room.StartY + y] = 1027;
                                    }
                                } else if (x == 3 && y == 3) {
                                    map.Tile[room.StartX + x, room.StartY + y].Type = Enums.TileType.NPCAvoid;
                                    map.Tile[room.StartX + x, room.StartY + y].Mask2 = 67;
                                    map.Tile[room.StartX + x, room.StartY + y].Mask2Set = 0;
                                    arrayFloor.MapArray[room.StartX + x, room.StartY + y] = 1027;
                                    MapNpcPreset npc = new MapNpcPreset();
                                    npc.SpawnX = room.StartX + x;
                                    npc.SpawnY = room.StartY + y;
                                    npc.NpcNum = 32;
                                    npc.MinLevel = 100;
                                    npc.MaxLevel = 100;
                                    map.Npc.Add(npc);
                                }

                            }
                        }
                        //Messenger.AdminMsg("Room created: " + map.Name, Text.Red);
                        }
                        break;
                    default: {
                            if (arrayFloor.Start.X == arrayFloor.Chamber.X && arrayFloor.Start.Y == arrayFloor.Chamber.Y) {
                                DungeonArrayRoom room = arrayFloor.Rooms[arrayFloor.Start.X, arrayFloor.Start.Y];
                                arrayFloor.MapArray[room.StartX, room.StartY] = DungeonArrayFloor.STARTTILE;
                            }
                            if (arrayFloor.End.X == arrayFloor.Chamber.X && arrayFloor.End.Y == arrayFloor.Chamber.Y) {
                                DungeonArrayRoom room = arrayFloor.Rooms[arrayFloor.End.X, arrayFloor.End.Y];
                                arrayFloor.MapArray[room.StartX + 1, room.StartY] = DungeonArrayFloor.ENDTILE;
                            }
                        }
                        break;
                }
            } catch (Exception e) {
                Messenger.AdminMsg(e.ToString(), Text.Black);
            }
        }
コード例 #15
0
ファイル: BasicMap.cs プロジェクト: MystikalPooka/PJOFiles
        public void SpawnNpc(MapNpcPreset npc, bool checkSight)
        {
            int  NPCNum  = 0;
            int  X       = 0;
            int  Y       = 0;
            bool Spawned = false;

            // Check for empty NPC slot
            int npcSlot = FindOpenNpcSlot();

            if (npcSlot < 0 || npcSlot >= Constants.MAX_MAP_NPCS)
            {
                return;
            }

            NPCNum = npc.NpcNum;
            if (NPCNum > 0)
            {
                ActiveNpc[npcSlot].Num    = NPCNum;
                ActiveNpc[npcSlot].Target = null;

                ActiveNpc[npcSlot].Name = NpcManager.Npcs[NPCNum].Name;
                ActiveNpc[npcSlot].Form = NpcManager.Npcs[NPCNum].Form;

                //if (NpcManager.Npcs[NPCNum].ShinyChance != 0 && Server.Math.Rand(0, NpcManager.Npcs[NPCNum].ShinyChance) == 0) ActiveNpc[npcSlot].Shiny = true;
                ActiveNpc[npcSlot].Sex = Pokedex.Pokedex.GetPokemonForm(NpcManager.Npcs[NPCNum].Species, ActiveNpc[npcSlot].Form).GenerateLegalSex();

                ActiveNpc[npcSlot].AttackTimer = new TickCount(Core.GetTickCount().Tick);
                ActiveNpc[npcSlot].PauseTimer  = new TickCount(Core.GetTickCount().Tick);

                //if (Npc[npcSlot].MinLevel == -1) {
                //Npc[npcSlot].MinLevel = NpcManager.Npcs[Npc[npcSlot].NpcNum].RecruitLevel;
                if (npc.MinLevel <= 0)
                {
                    npc.MinLevel = 1;
                    npc.MaxLevel = 1;
                }// else {
                //        Console.WriteLine("Npc found!");
                //    }
                //}
                ActiveNpc[npcSlot].Level = Server.Math.Rand(npc.MinLevel, npc.MaxLevel + 1);
                //set initial stats
                ActiveNpc[npcSlot].CalculateOriginalSprite();
                ActiveNpc[npcSlot].CalculateOriginalStats();
                ActiveNpc[npcSlot].CalculateOriginalType();
                ActiveNpc[npcSlot].CalculateOriginalAbility();
                //ActiveNpc[npcSlot].CalculateOriginalMobility();


                ActiveNpc[npcSlot].HP = ActiveNpc[npcSlot].MaxHP;

                ActiveNpc[npcSlot].Direction = (Enums.Direction)Server.Math.Rand(0, 4);

                ActiveNpc[npcSlot].GenerateMoveset();

                if (Moral == Enums.MapMoral.None)
                {
                    ActiveNpc[npcSlot].GenerateHeldItem();
                }

                if (Server.Math.Rand(0, 100) < npc.StartStatusChance)
                {
                    ActiveNpc[npcSlot].StatusAilment        = npc.StartStatus;
                    ActiveNpc[npcSlot].StatusAilmentCounter = npc.StartStatusCounter;
                }

                if (npc.SpawnX < 0 | npc.SpawnY < 0)
                {
                    // We'll try 100 times to randomly place the sprite
                    for (int i = 1; i <= 50; i++)
                    {
                        if (Tile[X, Y].Type == Enums.TileType.Walkable || Tile[X, Y].Type == Enums.TileType.Slow)
                        {
                            if (checkSight)
                            {
                                bool seen = false;
                                foreach (Client client in GetClients())
                                {
                                    if (CanCharacterSeeDestination(client.Player.GetActiveRecruit(), X, Y))
                                    {
                                        seen = true;
                                        break;
                                    }
                                }
                                if (!seen)
                                {
                                    ActiveNpc[npcSlot].X = X;
                                    ActiveNpc[npcSlot].Y = Y;
                                    Spawned = true;
                                    break;
                                }
                            }
                            else
                            {
                                ActiveNpc[npcSlot].X = X;
                                ActiveNpc[npcSlot].Y = Y;
                                Spawned = true;
                                break;
                            }
                        }
                    }

                    for (int i = 1; i <= 50; i++)
                    {
                        X = Server.Math.Rand(0, MaxX + 1);
                        Y = Server.Math.Rand(0, MaxY + 1);

                        // Check if the tile is walkable
                        if (Tile[X, Y].Type == Enums.TileType.Walkable)
                        {
                            ActiveNpc[npcSlot].X = X;
                            ActiveNpc[npcSlot].Y = Y;
                            Spawned = true;
                            break;
                        }
                    }
                }
                else
                {
                    // We no longer subtract one because Rand is ListIndex -1.
                    ActiveNpc[npcSlot].X = npc.SpawnX;
                    ActiveNpc[npcSlot].Y = npc.SpawnY;
                    Spawned = true;
                }

                // Didn't spawn, so now we'll just try to find a free tile
                if (!Spawned)
                {
                    for (Y = 0; Y <= MaxY; Y++)
                    {
                        for (X = 0; X <= MaxX; X++)
                        {
                            if (Tile[X, Y].Type == Enums.TileType.Walkable)
                            {
                                ActiveNpc[npcSlot].X = X;
                                ActiveNpc[npcSlot].Y = Y;
                                Spawned = true;
                            }
                        }
                    }
                }

                // If we suceeded in spawning then send it to everyone
                if (Spawned)
                {
                    PacketHitList hitlist = null;
                    PacketHitList.MethodStart(ref hitlist);
                    PacketBuilder.AppendNpcSpawn(MapManager.RetrieveActiveMap(MapID), hitlist, npcSlot);

                    Scripting.ScriptManager.InvokeFunction("OnNpcSpawn", MapManager.RetrieveActiveMap(MapID), npc, ActiveNpc[npcSlot], hitlist);

                    PacketHitList.MethodEnded(ref hitlist);
                }
            }
        }
コード例 #16
0
ファイル: BasicMap.cs プロジェクト: MystikalPooka/PJOFiles
 public void SpawnNpc(MapNpcPreset npc)
 {
     SpawnNpc(npc, false);
 }
コード例 #17
0
ファイル: Commands.cs プロジェクト: blastboy/Server
        public static void Commands(Client client, Command command)
        {
            try
            {
                string joinedArgs = JoinArgs(command.CommandArgs);
                PacketHitList hitlist = null;
                PacketHitList.MethodStart(ref hitlist);

                switch (command[0])
                {
                    case "/savelogs":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Scripter))
                            {
                                Logger.SaveLogs();
                                Messenger.PlayerMsg(client, "Logs have been saved.", Text.BrightGreen);
                            }
                        }
                        break;
                    case "/textstory":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Scripter))
                            {
                                Story story = new Story();

                                StoryBuilderSegment segment = new StoryBuilderSegment();

                                StoryBuilder.AppendSaySegment(segment, joinedArgs, 25, 0, 0);

                                segment.AppendToStory(story);

                                foreach (Client i in client.Player.Map.GetClients())
                                {
                                    StoryManager.PlayStory(i, story);
                                }
                            }
                        }
                        break;
                    case "/spawnminions":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Scripter))
                            {
                                for (int i = 0; i < joinedArgs.ToInt(); i++)
                                {
                                    MapNpcPreset npc = new MapNpcPreset();
                                    npc.SpawnX = 22; //-1;
                                    npc.SpawnY = 32; //-1;
                                    npc.NpcNum = 1368;
                                    npc.MinLevel = 90;
                                    npc.MaxLevel = 100;
                                    client.Player.Map.SpawnNpc(npc);
                                }
                            }
                        }
                        break;
                    case "/serverstatus":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Moniter))
                            {
                                Server.Globals.ServerStatus = joinedArgs;
                                Server.Logging.ChatLogger.AppendToChatLog("Staff", "[Server Status] " + client.Player.Name + " changed the server status to: '" + joinedArgs + "'");
                            }
                        }
                        break;
                    case "/togglequiz":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Moniter))
                            {
                                InQuiz = !InQuiz;
                                QuestionReady = false;
                                Messenger.AdminMsg("[Staff] In Quiz: " + InQuiz.ToString(), Text.BrightBlue);
                            }
                        }
                        break;
                    case "/questionready":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Moniter))
                            {
                                QuestionReady = true;
                                Messenger.AdminMsg("[Staff] Question Ready: " + QuestionReady.ToString(), Text.BrightGreen);
                                for (int a = 8; a >= 0; a--)
                                {
                                    Messenger.MapMsg(client.Player.MapID, "You can answer in: " + a, Text.BrightGreen);
                                    System.Threading.Thread.Sleep(1000);
                                    CanAnswer = false;
                                }

                                Messenger.MapMsg(client.Player.MapID, "You can now buzz in!", Text.BrightGreen);
                                CanAnswer = true;
                            }
                        }
                        break;
                    case "/yatterman":
                        {
                            if (client.Player.CharID.Substring(1).ToInt() % 2 == 0)
                            {
                                Messenger.PlayerMsg(client, "All of the PINK", System.Drawing.Color.LimeGreen);
                            }
                            else
                            {
                                Messenger.PlayerMsg(client, "Slightly less PINK", Text.White);
                            }
                        }
                        break;
                    case "/glomp":
                        {
                            if (client.Player.Muted == false)
                            {
                                if (client.Player.CharID.Substring(1).ToInt() % 2 == 0)
                                {
                                    Messenger.MapMsg(client.Player.MapID, "Plusle Power! " + client.Player.Name + " used Glomp!", Text.Red);
                                }
                                else
                                {
                                    Messenger.MapMsg(client.Player.MapID, "Minun Power! " + client.Player.Name + " used Glomp!", Text.Cyan);
                                }

                            }
                            else
                            {
                                Messenger.PlayerMsg(client, "You are muted!", Text.BrightRed);
                            }

                        }
                        break;

                    case "/setquizanswer":
                        {
                            if (InQuiz)
                            {
                                if (Ranks.IsAllowed(client, Enums.Rank.Moniter))
                                {
                                    QuizAnswer = joinedArgs.ToLower();
                                    Messenger.AdminMsg("[Staff] Quiz answer set to: " + QuizAnswer, Text.BrightBlue);
                                }
                            }

                        }
                        break;
                    case "/buzz":
                        {
                            if (InQuiz && QuestionReady && CanAnswer)
                            {
                                //QuestionReady = false;
                                foreach (Client i in client.Player.Map.GetClients())
                                {
                                    if (i.IsPlaying())
                                    {

                                        Messenger.BattleMsg(i, client.Player.Name + " has answered with: " + joinedArgs, Text.BrightGreen);

                                        /* Story story = new Story();

                                         StoryBuilderSegment segment = new StoryBuilderSegment();

                                         StoryBuilder.AppendSaySegment(segment, client.Player.Name + " has buzzed in! " + client.Player.Name + "'s answer is...", -1, 0, 0);
                                         StoryBuilder.AppendSaySegment(segment, joinedArgs, -1, 0, 0);

                                         segment.AppendToStory(story);

                                         StoryManager.PlayStory(i, story);*/
                                    }

                                }
                                if (CanAnswer && joinedArgs.ToLower() == QuizAnswer)
                                {
                                    foreach (Client i in client.Player.Map.GetClients())
                                    {
                                        Messenger.PlayerMsg(i, client.Player.Name + " has answered correctly! The answer was: " + QuizAnswer, Text.Yellow);

                                    }
                                    QuestionReady = false;
                                    QuizAnswer = "";
                                }
                            }
                        }
                        break;
                    /*case "/plaza": {
                            //if (Ranks.IsAllowed(client, Server.Enums.Rank.Moniter)) {
                            IMap map = client.Player.Map;
                            //if (map.MapType == Enums.MapType.Standard && map.Name.StartsWith("Exbel")) {
                            //	exPlayer.Get(client).PlazaEntranceMap = client.Player.MapID;
                            //	exPlayer.Get(client).PlazaEntranceX = client.Player.X;
                            //	exPlayer.Get(client).PlazaEntranceY = client.Player.Y;

                            //	Messenger.PlayerWarp(client, 1777, 16, 20);
                            //	Messenger.PlayerMsg(client, "Welcome to the plaza!", Text.BrightGreen);
                            //} else {
                                Messenger.PlayerMsg(client, "You cannot enter the plaza from here!", Text.BrightRed);
                            //}
                        }
                        break;*/
                    //case "/leaveplaza": {
                    //        IMap map = client.Player.Map;
                    //        if (map.Name == "Delite Plaza") {
                    //            if (!string.IsNullOrEmpty(exPlayer.Get(client).PlazaEntranceMap)) {
                    //                Messenger.PlayerWarp(client, exPlayer.Get(client).PlazaEntranceMap, exPlayer.Get(client).PlazaEntranceX, exPlayer.Get(client).PlazaEntranceY);
                    //            }
                    //        }
                    //    }
                    //    break;
                    case "/endgame":
                        {
                            if (exPlayer.Get(client).SnowballGameInstance.GameLeader == client)
                            {
                                exPlayer.Get(client).SnowballGameInstance.EndGame();
                                Messenger.PlayerMsg(client, "You have ended the game.", Text.Yellow);
                            }
                        }
                        break;
                    case "/snowballplayers":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Moniter))
                            {
                                if (Main.ActiveSnowballGames.Count > 0)
                                {
                                    Messenger.PlayerMsg(client, "Blue Team:", Text.Yellow);
                                    foreach (Client teamClient in Main.ActiveSnowballGames.Values[0].BlueTeam)
                                    {
                                        Messenger.PlayerMsg(client, teamClient.Player.Name, Text.Yellow);
                                    }
                                    Messenger.PlayerMsg(client, "Green Team:", Text.Yellow);
                                    foreach (Client teamClient in Main.ActiveSnowballGames.Values[0].GreenTeam)
                                    {
                                        Messenger.PlayerMsg(client, teamClient.Player.Name, Text.Yellow);
                                    }
                                }
                            }
                        }
                        break;
                    case "/gmmode":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Developer))
                            {
                                Server.Globals.GMOnly = !Server.Globals.GMOnly;
                                Messenger.PlayerMsg(client, "GM Only Mode Active: " + Server.Globals.GMOnly, Text.Yellow);
                            }
                        }
                        break;
                    case "/copymap":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Scripter))
                            {
                                IMap baseMap = MapManager.RetrieveMap(command[1]);
                                IMap destinationMap = MapManager.RetrieveMap(command[2], true);
                                MapCloner.CloneMapTileProperties(baseMap, destinationMap);
                                MapCloner.CloneMapTiles(baseMap, destinationMap);
                                destinationMap.Revision++;
                                destinationMap.Save();
                                Messenger.PlayerWarp(client, destinationMap, 25, 25);
                            }
                        }
                        break;
                    case "/packetcaching":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Scripter))
                            {
                                Server.Globals.PacketCaching = !Server.Globals.PacketCaching;
                                Messenger.PlayerMsg(client, "Packet caching is: " + (Server.Globals.PacketCaching ? "on!" : "off!"), Text.BrightGreen);
                            }
                        }
                        break;
                    case "/foolsstory":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Scripter))
                            {
                                foreach (Client i in ClientManager.GetClients())
                                {
                                    //if (i != client) {
                                    StoryManager.PlayStory(i, 369 - 1);
                                    //}
                                }
                            }
                        }
                        break;
                    case "/foolsmode":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Scripter))
                            {
                                Server.Globals.FoolsMode = !Server.Globals.FoolsMode;
                                Messenger.SendDataToAll(TcpPacket.CreatePacket("foolsmode", Server.Globals.FoolsMode.ToIntString()));
                                Messenger.PlayerMsg(client, "April fool's mode is: " + (Server.Globals.FoolsMode ? "on!" : "off!"), Text.BrightGreen);
                            }
                        }
                        break;
                    case "/lokmovementall":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Scripter))
                            {
                                Messenger.AdminMsg("[Staff] Movement locked...", Text.BrightBlue);
                                foreach (Client i in ClientManager.GetClients())
                                {
                                    if (i.IsPlaying() && Ranks.IsDisallowed(i, Enums.Rank.Moniter))
                                    {
                                        i.Player.MovementLocked = true;

                                        Messenger.PlayerMsg(i, "Movement has been locked, temporarily", Text.BrightGreen);
                                    }
                                }
                            }
                        }
                        break;
                    case "/unlokmovementall":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Scripter))
                            {
                                Messenger.AdminMsg("[Staff] Movement unlocked...", Text.BrightBlue);
                                foreach (Client i in ClientManager.GetClients())
                                {
                                    if (i.IsPlaying())
                                    {
                                        i.Player.MovementLocked = false;

                                        Messenger.PlayerMsg(i, "Movement has been unlocked [Debugging]", Text.BrightGreen);
                                    }
                                }
                            }
                        }
                        break;
                    case "/lokmovementmap":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Scripter))
                            {
                                Messenger.AdminMsg("[Staff] Movement locked...", Text.BrightBlue);
                                foreach (Client i in client.Player.Map.GetClients())
                                {
                                    if (i.IsPlaying() && Ranks.IsDisallowed(i, Enums.Rank.Moniter))
                                    {
                                        i.Player.MovementLocked = true;

                                        Messenger.PlayerMsg(i, "You find yourself stuck to the floor!", Text.BrightGreen);
                                    }
                                }
                            }
                        }
                        break;
                    case "/unlokmovementmap":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Scripter))
                            {
                                Messenger.AdminMsg("[Staff] Movement unlocked...", Text.BrightBlue);
                                foreach (Client i in client.Player.Map.GetClients())
                                {
                                    if (i.IsPlaying())
                                    {
                                        i.Player.MovementLocked = false;

                                        Messenger.PlayerMsg(i, "You can move again!", Text.BrightGreen);
                                    }
                                }
                            }
                        }
                        break;
                    case "/currentsection":
                        {
                            if (exPlayer.Get(client).StoryEnabled)
                            {
                                if (command.CommandArgs.Count == 2)
                                {
                                    client.Player.StoryHelper.SaveSetting("[MainStory]-CurrentSection", joinedArgs.ToInt().ToString());
                                }
                                Messenger.PlayerMsg(client, "Current section: " + client.Player.StoryHelper.ReadSetting("[MainStory]-CurrentSection").ToInt().ToString(), Text.BrightGreen);
                            }
                        }
                        break;
                    case "/resetstory":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Moniter))
                            {
                                StoryHelper.ResetStory(client);
                            }

                        }
                        break;
                    case "/storymode":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Moniter))
                            {
                                exPlayer.Get(client).StoryEnabled = !exPlayer.Get(client).StoryEnabled;
                                Messenger.PlayerMsg(client, "Story mode is now " + (exPlayer.Get(client).StoryEnabled ? "on!" : "off!"), Text.BrightGreen);
                            }
                        }
                        break;

                    case "/staffauction":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Mapper))
                            {
                                if (Auction.StaffAuction == false)
                                {
                                    Auction.StaffAuction = true;
                                    Messenger.AdminMsg("[Staff] Staff-only auction mode is now active.", Text.BrightBlue);
                                }
                                else if (Auction.StaffAuction == true)
                                {
                                    Auction.StaffAuction = false;
                                    Messenger.AdminMsg("[Staff] Staff-only auction mode is now disabled.", Text.BrightBlue);
                                }
                            }
                        }

                        break;
                    case "/itemowners":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Moniter))
                            {
                                IMap map = client.Player.Map;

                                for (int i = 0; i < map.ActiveItem.Length; i++)
                                {
                                    if ((map.ActiveItem[i].Num > 0))
                                    {
                                        Messenger.PlayerMsg(client, i + ". \'" + map.ActiveItem[i].TimeDropped.Tick + "\'", Text.BrightGreen);
                                    }
                                }
                            }
                        }
                        break;
                    //case "/dungeonopen": {
                    //        Messenger.PlayerMsg(client, "Dungeon Unlocked: " + DungeonRules.IsDungeonUnlocked(client, joinedArgs.ToInt()), Text.BrightGreen);
                    //    }
                    //    break;
                    case "/givejob":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Scripter))
                            {
                                //if (!client.Player.JobList.HasCompletedMission("0|-1|1|1|7|0|0|1|1|1|-1|1|0|3|0|0|-1|-1|-1|-1|0|-1|-1|-1|")) {
                                //client.Player.JobList.AddJob("0|-1|0|0|7|0|0|3|1|9|-1|46|0|3|0|0|-1|-1|-1|-1|0|-1|-1|-1|");

                                Messenger.PlayerMsg(client, "Job added!", Text.BrightGreen);
                                Messenger.SendJobList(client);
                            }
                        }
                        break;
                    case "/dungeonnpcs":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Moniter))
                            {
                                IMap map = client.Player.Map;

                                for (int i = 0; i < map.Npc.Count; i++)
                                {
                                    if ((map.Npc[i].NpcNum > 0))
                                    {
                                        Messenger.PlayerMsg(client, map.Npc[i].NpcNum.ToString(), Text.BrightGreen);
                                    }
                                }
                            }
                        }
                        break;
                    case "/rdstartcheck":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Moniter))
                            {
                                for (int i = 0; i < 10; i++)
                                {
                                    RDungeonMap map = RDungeonFloorGen.GenerateFloor(client, 54, 49, RDungeonManager.RDungeons[54].Floors[49].Options);
                                    Messenger.PlayerMsg(client, i.ToString(), Text.Black);
                                }
                            }
                        }
                        break;
                    case "/activemaps":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Moniter))
                            {
                                IMap[] activeMaps = MapManager.ToArray();
                                Messenger.PlayerMsg(client, "Active Maps: " + activeMaps.Length.ToString(), Text.BrightGreen);
                                foreach (IMap map in activeMaps)
                                {
                                    Messenger.PlayerMsg(client, map.Name, Text.Yellow);
                                    int total = 0;
                                    foreach (MapPlayer playerOnMap in map.PlayersOnMap.GetPlayers())
                                    {
                                        //Messenger.PlayerMsg(client, "-" + playerOnMap, Text.Yellow);
                                        total++;
                                    }
                                    Messenger.PlayerMsg(client, "Total in map: " + total, Text.Red);
                                }
                            }
                        }
                        break;
                    case "/daynight":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Scripter))
                            {
                                Server.Events.World.TimedEventManager.TimedEvents["DayCycle"].OnTimeElapsed(Server.Core.GetTickCount());
                                Messenger.PlayerMsg(client, Server.Globals.ServerTime.ToString(), Text.BrightGreen);
                                //}
                            }
                        }
                        break;
                    case "/currenttime":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Moniter))
                            {
                                TimeSpan time = new TimeSpan(0, 0, 0, 0, client.Player.MissionBoard.LastGenTime);
                                Messenger.PlayerMsg(client, time.TotalSeconds.ToString(), Text.BrightGreen);
                                time = new TimeSpan(0, 0, 0, 0, Server.Core.GetTickCount().Tick);
                                Messenger.PlayerMsg(client, time.TotalSeconds.ToString(), Text.BrightGreen);
                                //}
                            }
                        }
                        break;
                    case "/tournyplayers":
                        {
                            Tournament tourny = client.Player.Tournament;
                            if (tourny != null)
                            {
                                if (tourny.RegisteredMembers[client] != null)
                                {
                                    if (tourny.RegisteredMembers[client].Admin)
                                    {
                                        tourny.PlayersNeeded = joinedArgs.ToInt();
                                        Messenger.PlayerMsg(client, "The current player requirement is: " + tourny.PlayersNeeded.ToString(), Text.BrightGreen);
                                    }
                                }
                            }
                        }
                        break;
                    case "/createtourny":
                        {
                            Tournament tourny = TournamentManager.CreateTournament(client, joinedArgs, "s1193", 10, 10);
                            tourny.AddCombatMap("s1194");
                        }
                        break;
                    case "/jointourny":
                        {
                            Tournament tourny = TournamentManager.Tournaments[joinedArgs.ToInt()];
                            tourny.RegisterPlayer(client);
                        }
                        break;
                    case "/estlevel":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Scripter))
                            {
                                exPlayer.Get(client).ElectrolockLevel = joinedArgs.ToInt();
                                Messenger.PlayerMsg(client, "EST level set to: " + joinedArgs.ToInt(), Text.BrightGreen);
                            }
                        }
                        break;
                    case "/april":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Scripter))
                            {
                                //TimeZoneInfo easternZone = TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time");
                                //DateTime easternTime = TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow, easternZone);

                                //var tomorrow1am = easternTime.AddDays(1).Date;
                                //double totalHours = (int)( tomorrow1am - easternTime).TotalHours;
                                //Messenger.PlayerMsg(client, "Time: " + totalHours.ToString(), Text.Red);

                            }
                            break;
                        }
                    case "/restartserver":
                        {
                            if (Ranks.IsDisallowed(client, Enums.Rank.Admin))
                            {
                                Messenger.HackingAttempt(client, "Admin Cloning");
                                return;
                            }
                            Server.Logging.ChatLogger.AppendToChatLog("Staff", "[Server] Server restart initiated by: " + client.Player.Name);
                            RestartServer();
                        }
                        break;
                    case "/checktime":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Moniter))
                            {
                                Client n = ClientManager.FindClient(joinedArgs);
                                if (n != null)
                                {
                                    Messenger.PlayerMsg(client, joinedArgs + "'s total play time: " + n.Player.Statistics.TotalPlayTime.ToString(), Text.BrightGreen);
                                }
                                else
                                {
                                    Messenger.PlayerMsg(client, "Player is offline.", Text.Grey);
                                }
                            }
                        }
                        break;
                    case "/lastlogin":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Moniter))
                            {
                                string playerName = command[1];

                                using (DatabaseConnection dbConnection = new DatabaseConnection(DatabaseID.Players))
                                {
                                    IDataColumn[] columns = dbConnection.Database.RetrieveRow("characteristics", "CharID", "Name=\"" + playerName + "\"");
                                    if (columns != null)
                                    {
                                        string charID = (string)columns[0].Value;
                                        string lastLogin = (string)dbConnection.Database.RetrieveRow("character_statistics", "LastLogin", "CharID=\"" + charID + "\"")[0].Value;
                                        Messenger.PlayerMsg(client, playerName + "'s last login: "******"Staff", "[Info Request] " + client.Player.Name + " checked " + playerName + "'s last login");
                                    }
                                }
                            }

                        }
                        break;
                    case "/checkparty":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Moniter))
                            {
                                Party party = PartyManager.FindParty(client.Player.PartyID);
                                int onlineClients = 0;
                                if (party != null)
                                {
                                    foreach (Client client2 in party.GetOnlineMemberClients())
                                    {
                                        onlineClients++;
                                    }
                                    Messenger.PlayerMsg(client, "Members: " + onlineClients, Text.BrightBlue);
                                }
                                else
                                {
                                    Messenger.PlayerMsg(client, "No Party", Text.BrightBlue);
                                }
                            }
                        }
                        break;
                    case "/playtime":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Moniter))
                            {
                                TimeSpan longestPlayTime = new TimeSpan();
                                string playerName = "";
                                foreach (Client i in ClientManager.GetClients())
                                {
                                    if (i.IsPlaying())
                                    {
                                        TimeSpan currentTime = i.Player.Statistics.TotalPlayTime + (DateTime.UtcNow - i.Player.Statistics.LoginTime);
                                        if (currentTime > longestPlayTime)
                                        {
                                            playerName = i.Player.Name;
                                            longestPlayTime = currentTime;
                                        }
                                    }
                                }
                                Messenger.PlayerMsg(client, "Longest play time:\n" + playerName + " (" + longestPlayTime.ToString() + ")", Text.BrightBlue);
                            }
                        }
                        break;
                    case "/fastshutdown":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Moniter))
                            {
                                Messenger.PlayerMsg(client, "[SECRET] Fast shutdown started.", Text.BrightRed);
                                using (DatabaseConnection dbConnection = new DatabaseConnection(DatabaseID.Players))
                                {
                                    foreach (Client i in ClientManager.GetClients())
                                    {
                                        if (i.IsPlaying())
                                        {
                                            i.Player.SaveCharacterData(dbConnection);
                                            i.Player.SavingLocked = true;
                                        }
                                    }
                                }

                                Messenger.PlayerMsg(client, "Everyone saved, shutting down...", Text.BrightRed);
                                Environment.Exit(0);
                            }
                        }
                        break;
                    case "/shutdown":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Moniter))
                            {
                                int waitingTime = 30;
                                string messageText = "";
                                if (!string.IsNullOrEmpty(joinedArgs))
                                {
                                    messageText = joinedArgs;
                                }
                                for (int i = waitingTime; i >= 1; i--)
                                {
                                    Server.Globals.ServerStatus = "Please prepare for a server shutdown for maintenance. It will begin in " + i + " seconds." + messageText;
                                    System.Threading.Thread.Sleep(1000);
                                }
                                Messenger.AdminMsg("[Staff] Server shutdown in progress... Saving all players...", Text.BrightBlue);
                                Server.Logging.ChatLogger.AppendToChatLog("Staff", "[Server] Server shutdown initiated by: " + client.Player.Name);
                                Server.Globals.ServerStatus = "Saving your data... Please wait...";
                                try
                                {
                                    using (DatabaseConnection dbConnection = new DatabaseConnection(DatabaseID.Players))
                                    {
                                        foreach (Client i in ClientManager.GetClients())
                                        {
                                            if (i.IsPlaying())
                                            {
                                                i.Player.SaveCharacterData(dbConnection);
                                                i.Player.SavingLocked = true;

                                                Messenger.PlayerMsg(i, "You saved the game!", Text.BrightGreen);
                                            }
                                        }
                                    }
                                    Messenger.PlayerMsg(client, "Everyone has been saved!", Text.Yellow);
                                }
                                catch { }
                                System.Threading.Thread shutdownTimerThread = new System.Threading.Thread(delegate()
                                {
                                    waitingTime = 30;
                                    for (int i = waitingTime; i >= 1; i--)
                                    {
                                        Server.Globals.ServerStatus = "The server will be shutting down in " + i + " seconds.";
                                        System.Threading.Thread.Sleep(1000);
                                    }
                                    Environment.Exit(0);
                                }
                                );
                                shutdownTimerThread.Start();
                            }
                        }
                        break;
                    case "/warn*":
                    case "/warn":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Moniter))
                            {
                                Client n;
                                string[] subCommand = command[0].Split('*');
                                if (subCommand.Length > 1)
                                {
                                    n = ClientManager.FindClient(command[1], true);
                                }
                                else
                                {
                                    n = ClientManager.FindClient(command[1]);
                                }
                                if (n != null)
                                {
                                    Messenger.PlayerMsg(n, "You have been warned by a staff member: " + command[2] /* + "\n-" + client.Player.Name*/, System.Drawing.Color.Orange);
                                    Messenger.AdminMsg("[Staff] " + client.Player.Name + " has warned " + n.Player.Name + ": " + command[2], Text.BrightBlue);
                                    Server.Logging.ChatLogger.AppendToChatLog("Staff", "[Warning Issued] " + client.Player.Name + " warned " + n.Player.Name + " with message: " + command[2]);
                                }
                                else
                                {
                                    Messenger.PlayerMsg(client, "Player is offline.", Text.Grey);
                                }
                            }
                        }
                        break;
                    case "/getcharinfo":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Moniter))
                            {
                                using (DatabaseConnection dbConnection = new DatabaseConnection(DatabaseID.Players))
                                {
                                    CharacterInformation charInfo = PlayerManager.RetrieveCharacterInformation(dbConnection, joinedArgs);
                                    if (charInfo != null)
                                    {
                                        Messenger.PlayerMsg(client, "Info for " + charInfo.Name + ":", Text.Yellow);
                                        Messenger.PlayerMsg(client, "Account: " + charInfo.Account, Text.Yellow);
                                        Messenger.PlayerMsg(client, "CharID: " + charInfo.ID, Text.Yellow);
                                        Messenger.PlayerMsg(client, "Char Slot: " + charInfo.Slot, Text.Yellow);
                                        Server.Logging.ChatLogger.AppendToChatLog("Staff", "[Info Request] " + client.Player.Name + " checked the character information for: " + command[1]);
                                    }
                                }
                            }
                        }
                        break;
                    case "/clearjoblist":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Moniter))
                            {
                                Client n = ClientManager.FindClient(joinedArgs);
                                if (n != null)
                                {
                                    n.Player.JobList.JobList.Clear();
                                    Messenger.SendJobList(n);
                                    Messenger.PlayerMsg(n, "Your job list has been cleared!", Text.BrightGreen);
                                    Messenger.PlayerMsg(client, "You have cleared " + joinedArgs + "'s job list!", Text.BrightGreen);
                                    //Messenger.PlayerMsg(client, joinedArgs + " ID is: " + n.Player.CharID, Text.BrightGreen);
                                }
                                else
                                {
                                    Messenger.PlayerMsg(client, "Player is offline.", Text.Grey);
                                }
                            }
                        }
                        break;
                    case "/void":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Moniter))
                            {
                                Messenger.PlayerWarpToVoid(client);
                            }
                        }
                        break;
                    case "/voidplayer*":
                    case "/voidplayer":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Moniter))
                            {
                                string playerName = command[1];
                                Client n;
                                string[] subCommand = command[0].Split('*');
                                if (subCommand.Length > 1)
                                {
                                    n = ClientManager.FindClient(playerName, true);
                                }
                                else
                                {
                                    n = ClientManager.FindClient(playerName);
                                }

                                if (n != null)
                                {
                                    Messenger.PlayerWarpToVoid(n);
                                    Messenger.GlobalMsg(n.Player.Name + " has been swallowed by the void...", Text.Red);
                                }
                                else
                                {
                                    Messenger.PlayerMsg(client, playerName + " could not be found.", Text.Green);
                                }
                            }
                        }
                        break;
                    case "/unvoid":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Moniter))
                            {

                                string playerName = command[1];
                                Client n;
                                n = ClientManager.FindClient(playerName);
                                IMap map = n.Player.Map;
                                if (map.MapType == Enums.MapType.Void)
                                {
                                    Server.Maps.Void @void = map as Server.Maps.Void;
                                    @void.SafeExit = true;
                                    Messenger.PlayerWarp(n, 1015, 25, 25);
                                    Messenger.PlayerMsg(n, "You have been unvoided.", Text.BrightGreen);
                                    Messenger.PlayerMsg(client, playerName + " has been unvoided.", Text.BrightGreen);
                                }
                            }
                        }
                        break;
                    case "/getid":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Moniter))
                            {
                                Client n = ClientManager.FindClient(joinedArgs);
                                if (n != null)
                                {
                                    Messenger.PlayerMsg(client, joinedArgs + " ID is: " + n.Player.CharID, Text.BrightGreen);
                                }
                                else
                                {
                                    Messenger.PlayerMsg(client, "Player is offline.", Text.Grey);
                                }
                            }
                        }
                        break;
                    case "/regenboard":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Moniter))
                            {
                                client.Player.MissionBoard.GenerateMission();
                                Server.Logging.ChatLogger.AppendToChatLog("Staff", "[Missions] " + client.Player.Name + " regenerated their mission board.");
                            }
                        }
                        break;
                    case "/who":
                        {
                            int count = 0;
                            foreach (Client i in ClientManager.GetClients())
                            {
                                if (i.TcpClient.Socket.Connected && i.IsPlaying())
                                {
                                    count++;
                                }
                            }
                            Messenger.PlayerMsg(client, "Players online: " + count, Text.Yellow);
                        }
                        break;
                    case "/saveall":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Moniter))
                            {
                                using (DatabaseConnection dbConnection = new DatabaseConnection(DatabaseID.Players))
                                {
                                    try
                                    {
                                        foreach (Client i in ClientManager.GetClients())
                                        {
                                            i.Player.SaveCharacterData(dbConnection);
                                            Messenger.PlayerMsg(i, "You saved the game!", Text.BrightGreen);
                                        }
                                    }
                                    catch (Exception ex)
                                    {
                                        Messenger.PlayerMsg(client, ex.ToString(), Text.BrightRed);
                                    }
                                }
                                Messenger.PlayerMsg(client, "Everyone has been saved!", Text.Yellow);
                            }
                        }
                        break;
                    case "/isveteran":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Moniter))
                            {
                                Client n = ClientManager.FindClient(joinedArgs);
                                if (n != null)
                                {
                                    Messenger.PlayerMsg(client, n.Player.Veteran.ToString(), Text.Yellow);
                                }
                            }
                        }
                        break;
                    case "/explode":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Moniter))
                            {
                                Messenger.GlobalMsg(client.Player.Name + " has exploded.", Text.BrightRed);
                            }
                        }
                        break;

                    case "/silentkick*":
                    case "/silentkick":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Moniter))
                            {
                                string playerName = command[1];
                                Client kickedClient;
                                string[] subCommand = command[0].Split('*');
                                if (subCommand.Length > 1)
                                {
                                    kickedClient = ClientManager.FindClient(playerName, true);
                                }
                                else
                                {
                                    kickedClient = ClientManager.FindClient(playerName);
                                }
                                if (kickedClient != null)
                                {
                                    if (command.CommandArgs.Count > 2 && !String.IsNullOrEmpty(command[2]))
                                    {
                                        Messenger.AdminMsg("[Staff] " + kickedClient.Player.Name + " has been disconnected silently from the server by " + client.Player.Name + "! " + "Reason: " + command[2], Text.BrightBlue);
                                        kickedClient.CloseConnection();
                                        Server.Logging.ChatLogger.AppendToChatLog("Staff", "[Kick] " + client.Player.Name + " silently kicked " + playerName + " from the server with reason: " + command[2]);
                                    }
                                    else
                                    {
                                        Messenger.AdminMsg("[Staff] " + kickedClient.Player.Name + " has been disconnected silently from the server by " + client.Player.Name + "!", Text.BrightBlue);
                                        Server.Logging.ChatLogger.AppendToChatLog("Staff", "[Kick] " + client.Player.Name + " silently kicked " + playerName + " from the server.");
                                        kickedClient.CloseConnection();
                                    }
                                }
                                else
                                {
                                    Messenger.PlayerMsg(client, "Unable to find player!", Text.BrightRed);
                                }
                            }
                        }
                        break;
                    case "/kick*":
                    case "/kick":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Moniter))
                            {
                                string playerName = command[1];
                                Client kickedClient;
                                string[] subCommand = command[0].Split('*');
                                if (subCommand.Length > 1)
                                {
                                    kickedClient = ClientManager.FindClient(playerName, true);
                                }
                                else
                                {
                                    kickedClient = ClientManager.FindClient(playerName);
                                }
                                if (kickedClient != null)
                                {
                                    if (command.CommandArgs.Count > 2 && !String.IsNullOrEmpty(command[2]))
                                    {
                                        Messenger.AdminMsg(kickedClient.Player.Name + " has been kicked from the server by " + client.Player.Name + "!" + " Reason: " + command[2], Text.BrightBlue);
                                        Messenger.PlainMsg(kickedClient, "You have been kicked from the server!  Reason: " + command[2], Enums.PlainMsgType.MainMenu);
                                        kickedClient.CloseConnection();
                                        Server.Logging.ChatLogger.AppendToChatLog("Staff", "[Kick] " + client.Player.Name + " kicked " + playerName + " from the server with reason: " + command[2]);
                                    }
                                    else
                                    {
                                        Messenger.AdminMsg("[Staff] " + kickedClient.Player.Name + " has been kicked from the server by " + client.Player.Name, Text.BrightBlue);
                                        Messenger.PlainMsg(kickedClient, "You have been kicked from the server!", Enums.PlainMsgType.MainMenu);
                                        kickedClient.CloseConnection();
                                        Server.Logging.ChatLogger.AppendToChatLog("Staff", "[Kick] " + client.Player.Name + " kicked " + playerName + " from the server.");
                                    }
                                }
                                else
                                {
                                    Messenger.PlayerMsg(client, "Unable to find player!", Text.BrightRed);
                                }
                            }
                        }
                        break;
                    case "/ban*":
                    case "/ban":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Moniter))
                            {
                                string playerName = command[1];
                                string banTimeDays = "-----";
                                Client bannedClient;
                                string[] subCommand = command[0].Split('*');
                                if (subCommand.Length > 1)
                                {
                                    bannedClient = ClientManager.FindClient(playerName, true);
                                }
                                else
                                {
                                    bannedClient = ClientManager.FindClient(playerName);
                                }

                                if (command.CommandArgs.Count > 2 && command[2].IsNumeric())
                                {
                                    banTimeDays = DateTime.Now.AddDays(Convert.ToDouble(command[2])).ToString();
                                }

                                if (bannedClient != null)
                                {
                                    using (DatabaseConnection dbConnection = new DatabaseConnection(DatabaseID.Players))
                                    {
                                        Bans.BanPlayer(dbConnection, bannedClient.IP.ToString(), bannedClient.Player.CharID,
                                            bannedClient.Player.AccountName + "/" + bannedClient.Player.Name, bannedClient.MacAddress, bannedClient.BiosId,
                                            client.Player.CharID, client.IP.ToString(), banTimeDays, Enums.BanType.Ban);
                                        Messenger.AdminMsg("[Staff] " + bannedClient.Player.Name + " has been banned by " + client.Player.Name + "!", Text.BrightBlue);
                                        PlayerInfoReport(bannedClient);
                                        Messenger.PlainMsg(bannedClient, "You have been banned!", Enums.PlainMsgType.MainMenu);
                                        bannedClient.CloseConnection();
                                        Server.Logging.ChatLogger.AppendToChatLog("Staff", "[Ban] " + client.Player.Name + " banned " + playerName + ".");
                                    }
                                }
                                else
                                {
                                    using (DatabaseConnection dbConnection = new DatabaseConnection(DatabaseID.Players))
                                    {
                                        IDataColumn[] columns = dbConnection.Database.RetrieveRow("characteristics", "CharID", "Name=\"" + playerName + "\"");
                                        if (columns != null)
                                        {
                                            string charID = (string)columns[0].Value;
                                            string foundIP = (string)dbConnection.Database.RetrieveRow("character_statistics", "LastIPAddressUsed", "CharID=\"" + charID + "\"")[0].Value;
                                            string foundMac = (string)dbConnection.Database.RetrieveRow("character_statistics", "LastMacAddressUsed", "CharID=\"" + charID + "\"")[0].Value;
                                            string storedUUID = (string)dbConnection.Database.RetrieveRow("character_statistics", "StoredUUID", "CharID=\"" + charID + "\"")[0].Value;
                                            //get previous IP and mac
                                            Bans.BanPlayer(dbConnection, foundIP, charID, playerName, foundMac, storedUUID,
                                                client.Player.CharID, client.IP.ToString(), banTimeDays, Enums.BanType.Ban);
                                            Messenger.AdminMsg("[Staff] " + bannedClient.Player.Name + " has been banned by " + client.Player.Name + "!", Text.BrightBlue);
                                            Server.Logging.ChatLogger.AppendToChatLog("Staff", "[Ban] " + client.Player.Name + " banned " + playerName + ".");
                                        }
                                        else
                                        {
                                            Messenger.PlayerMsg(client, "Unable to find player!", Text.BrightRed);
                                        }
                                    }
                                }
                            }
                        }
                        break;
                    case "/htest":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Scripter))
                            {
                                Messenger.OpenVisitHouseMenu(client);
                            }
                        }
                        break;
                    case "/emptyhouse":
                        {
                            IMap map = client.Player.Map;
                            if (map.MapType == Server.Enums.MapType.House && ((House)map).OwnerID == client.Player.CharID)
                            {
                                List<Client> clientList = new List<Client>();

                                foreach (Client n in client.Player.Map.GetClients())
                                {
                                    if (n != client && Ranks.IsDisallowed(client, Enums.Rank.Moniter))
                                    {
                                        clientList.Add(n);
                                    }
                                }

                                foreach (Client n in clientList)
                                {
                                    if (!string.IsNullOrEmpty(exPlayer.Get(n).HousingCenterMap))
                                    {
                                        Messenger.PlayerWarp(n, exPlayer.Get(n).HousingCenterMap, exPlayer.Get(n).HousingCenterX, exPlayer.Get(n).HousingCenterY);
                                    }
                                }
                                Messenger.PlayerMsg(client, "All visitors have been kicked from your house!", Text.Yellow);
                            }
                            else
                            {
                                Messenger.PlayerMsg(client, "You aren't in your house!", Text.BrightRed);
                            }
                        }
                        break;
                    case "/leavehouse":
                        {
                            IMap map = client.Player.Map;
                            if (map.MapType == Server.Enums.MapType.House)
                            {
                                if (!string.IsNullOrEmpty(exPlayer.Get(client).HousingCenterMap))
                                {
                                    Messenger.PlayerWarp(client, exPlayer.Get(client).HousingCenterMap, exPlayer.Get(client).HousingCenterX, exPlayer.Get(client).HousingCenterY);
                                }
                            }
                        }
                        break;
                    case "/houseentrance":
                        {
                            IMap map = client.Player.Map;
                            if (map.MapType == Server.Enums.MapType.House && ((House)map).OwnerID == client.Player.CharID)
                            {
                                //Messenger.AskQuestion(client, "HouseSpawn", "Will you set your house's entrance here?", -1);
                                Messenger.AskQuestion(client, "HouseSpawn", "Will you set your house's entrance here?  It will cost 500 Poké.", -1);
                            }
                            else
                            {
                                Messenger.PlayerMsg(client, "You can't set your house entrance here!", Text.BrightRed);
                            }
                        }
                        break;
                    case "/houseroof":
                        {
                            IMap map = client.Player.Map;
                            if (map.MapType == Server.Enums.MapType.House && ((House)map).OwnerID == client.Player.CharID)
                            {
                                if (map.Indoors)
                                {
                                    Messenger.AskQuestion(client, "HouseRoof", "Will you open your house's roof and expose it to time and weather conditions?  It will cost 500 Poké.", -1);
                                }
                                else
                                {
                                    Messenger.AskQuestion(client, "HouseRoof", "Will you close your house to time and weather conditions?  It will cost 500 Poké.", -1);
                                }
                            }
                            else
                            {
                                Messenger.PlayerMsg(client, "You can't set your house roof here!", Text.BrightRed);
                            }
                        }
                        break;
                    case "/houseweather":
                        {
                            IMap map = client.Player.Map;
                            if (client.Player.ExplorerRank >= Enums.ExplorerRank.Silver)
                            {
                                if (map.MapType == Server.Enums.MapType.House && ((House)map).OwnerID == client.Player.CharID)
                                {
                                    if (map.Indoors)
                                    {
                                        Messenger.PlayerMsg(client, "You can't set your house weather unless you open your house with /houseroof", Text.BrightRed);
                                    }
                                    else
                                    {
                                        Messenger.OpenChangeWeatherMenu(client);
                                    }
                                }
                                else
                                {
                                    Messenger.PlayerMsg(client, "You can't set your house weather here!", Text.BrightRed);
                                }
                            }
                            else
                            {
                                Messenger.PlayerMsg(client, "You can't expand your house until your Explorer Rank is Silver or higher.", Text.BrightRed);
                            }
                        }
                        break;
                    case "/houselight":
                        {
                            IMap map = client.Player.Map;
                            if (client.Player.ExplorerRank >= Enums.ExplorerRank.Silver)
                            {
                                if (map.MapType == Server.Enums.MapType.House && ((House)map).OwnerID == client.Player.CharID)
                                {
                                    Messenger.OpenChangeDarknessMenu(client);
                                }
                                else
                                {
                                    Messenger.PlayerMsg(client, "You can't set your house lights here!", Text.BrightRed);
                                }
                            }
                            else
                            {
                                Messenger.PlayerMsg(client, "You can't expand your house until your Explorer Rank is Silver or higher.", Text.BrightRed);
                            }
                        }
                        break;
                    case "/houseexpand":
                        {
                            IMap map = client.Player.Map;
                            if (client.Player.ExplorerRank >= Enums.ExplorerRank.Gold)
                            {
                                if (map.MapType == Server.Enums.MapType.House && ((House)map).OwnerID == client.Player.CharID)
                                {
                                    Messenger.OpenChangeBoundsMenu(client);
                                }
                                else
                                {
                                    Messenger.PlayerMsg(client, "You can't expand your house here!", Text.BrightRed);
                                }
                            }
                            else
                            {
                                Messenger.PlayerMsg(client, "You can't expand your house until your Explorer Rank is Gold or higher.", Text.BrightRed);
                            }
                        }
                        break;
                    case "/houseshop":
                        {
                            IMap map = client.Player.Map;
                            if (client.Player.ExplorerRank >= Enums.ExplorerRank.Bronze)
                            {
                                if (map.MapType == Server.Enums.MapType.House && ((House)map).OwnerID == client.Player.CharID)
                                {
                                    Messenger.OpenAddShopMenu(client);
                                }
                                else
                                {
                                    Messenger.PlayerMsg(client, "You can't place a shop here!", Text.BrightRed);
                                }
                            }
                            else
                            {
                                Messenger.PlayerMsg(client, "You can't expand your house until your Explorer Rank is Bronze or higher.", Text.BrightRed);
                            }
                        }
                        break;
                    case "/housesign":
                        {
                            IMap map = client.Player.Map;
                            if (client.Player.Muted)
                            {
                                Messenger.PlayerMsg(client, "You are muted!", Text.BrightRed);
                                return;
                            }
                            if (client.Player.ExplorerRank >= Enums.ExplorerRank.Bronze)
                            {
                                if (map.MapType == Server.Enums.MapType.House && ((House)map).OwnerID == client.Player.CharID)
                                {
                                    Messenger.OpenAddSignMenu(client);
                                }
                                else
                                {
                                    Messenger.PlayerMsg(client, "You can't place a sign here!", Text.BrightRed);
                                }
                            }
                            else
                            {
                                Messenger.PlayerMsg(client, "You can't expand your house until your Explorer Rank is Bronze or higher.", Text.BrightRed);
                            }
                        }
                        break;
                    case "/housesound":
                        {
                            IMap map = client.Player.Map;
                            if (client.Player.ExplorerRank >= Enums.ExplorerRank.Bronze)
                            {
                                if (map.MapType == Server.Enums.MapType.House && ((House)map).OwnerID == client.Player.CharID)
                                {
                                    Messenger.OpenAddSoundMenu(client);
                                }
                                else
                                {
                                    Messenger.PlayerMsg(client, "You can't place a sound tile here!", Text.BrightRed);
                                }
                            }
                            else
                            {
                                Messenger.PlayerMsg(client, "You can't expand your house until your Explorer Rank is Bronze or higher.", Text.BrightRed);
                            }
                        }
                        break;
                    case "/housenotice":
                        {
                            IMap map = client.Player.Map;
                            if (client.Player.Muted)
                            {
                                Messenger.PlayerMsg(client, "You are muted!", Text.BrightRed);
                                return;
                            }
                            if (client.Player.ExplorerRank >= Enums.ExplorerRank.Bronze)
                            {
                                if (map.MapType == Server.Enums.MapType.House && ((House)map).OwnerID == client.Player.CharID)
                                {
                                    Messenger.OpenAddNoticeMenu(client);
                                }
                                else
                                {
                                    Messenger.PlayerMsg(client, "You can't place a notice tile here!", Text.BrightRed);
                                }
                            }
                            else
                            {
                                Messenger.PlayerMsg(client, "You can't expand your house until your Explorer Rank is Bronze or higher.", Text.BrightRed);
                            }
                        }
                        break;

                    //test2

                    case "/darktest":
                        {
                            /*if (Ranks.IsAllowed(client, Enums.Rank.Scripter)) {
                                foreach (Client i in ClientManager.GetClients()) {
                                    if (i.IsPlaying() && i.Player.AccountName == "Dandy") {
                                        i.Player.Access = Enums.Rank.Mapper;
                                    }
                                }
                            }*/
                            break;
                        }

                    //mapkill

                    case "/kipz":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Scripter))
                            {
                                if (client.Player.MapID == MapManager.GenerateMapID(1129))
                                {
                                    IMap map = client.Player.Map;
                                    foreach (Client i in map.GetClients())
                                    {
                                        StoryManager.PlayStory(i, 94);
                                    }
                                }
                            }
                        }
                        break;
                    case "/stafflist":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Moniter))
                            {
                                Messenger.PlayerMsg(client, "The staff that are currently online are:", Text.Green);
                                foreach (Client i in ClientManager.GetClients())
                                {
                                    if (Ranks.IsAllowed(i, Enums.Rank.Moniter))
                                    {
                                        Messenger.PlayerMsg(client, "(" + i.Player.Access.ToString() + ")" + i.Player.Name, Text.Green);
                                    }
                                }
                            }
                        }
                        break;
                    case "/isitrandom":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Moniter))
                            {
                                int rand = Server.Math.Rand(0, 10);
                                Messenger.PlayerMsg(client, rand.ToString(), Text.Green);

                            }
                        }
                        break;
                    case "/rdungeonscriptgoal":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Scripter))
                            {
                                RDungeonScriptGoal(client, joinedArgs.ToInt(), 0, 0);
                            }
                        }
                        break;
                    case "/fdh":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Scripter))
                            {
                                for (int i = 1; i <= 2000; i++)
                                {
                                    //for (int x = 0; x <= MapManager.RetrieveMapGeneralInfo(i).MaxX; x++) {
                                    //    for (int y = 0; y <= MapManager.RetrieveMapGeneralInfo(i).MaxY; y++) {
                                    // TODO: map tile info [Scripts]
                                    /* Can't get info on a nonactive map's tiles...
                                    if (NetScript.GetAttribute(i, x, y) == Enums.TileType.Shop /*|| NetScript.GetAttribute(i, x, y) == Enums.TileType.Warp) {
                                        if (NetScript.GetTileData1(i, x, y) == /*243 joinedArg.ToInt()) {
                                            NetScript.PlayerMsg(client, "Found warp! On Map " + i.ToString() + " X: " + x.ToString() + " Y: " + y.ToString(), Text.Yellow);
                                            //return;
                                        }
                                    }
                                    */
                                    //    }
                                    //}
                                }
                            }
                        }
                        break;
                    case "/findaccount":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Moniter))
                            {
                                foreach (Client i in ClientManager.GetClients())
                                {
                                    if (i.Player.AccountName.ToLower() == joinedArgs.ToLower())
                                    {
                                        Messenger.PlayerMsg(client, "Found account! [" + i.Player.AccountName + "/" + i.Player.Name + "]", Text.BrightGreen);
                                    }
                                }
                            }
                        }
                        break;
                    case "/cc":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Scripter))
                            {
                                Client n = ClientManager.FindClient(joinedArgs);
                                n.CloseConnection();
                                Messenger.PlayerMsg(client, "CC/ " + n.Player.Name, Text.Blue);
                            }
                            else
                            {
                                Messenger.PlayerMsg(client, "That is not a valid command!", Text.BrightRed);
                            }
                        }
                        break;
                    case "/regenlotto":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Scripter))
                            {
                                Lottery.ForceGenLottoNumbers();
                                Messenger.PlayerMsg(client, "Lottery numbers regenerated!", Text.Yellow);
                            }
                        }
                        break;
                    case "/lottostats":
                        {
                            // TODO: /lottostats lottery
                            if (Ranks.IsAllowed(client, Enums.Rank.Scripter))
                            {
                                Messenger.PlayerMsg(client, "Lottery Stats:", Text.BrightGreen);
                                Messenger.PlayerMsg(client, "Lottery Payout: " + Lottery.LotteryPayout, Text.BrightGreen);
                                Messenger.PlayerMsg(client, "Lottery Earnings: " + Lottery.LotteryEarnings, Text.BrightGreen);
                                Messenger.PlayerMsg(client, "Last Lottery Earnings: " + Lottery.LastLotteryEarnings, Text.BrightGreen);
                                Messenger.PlayerMsg(client, "Total Lottery Earnings: " + Lottery.TotalLotteryEarnings, Text.BrightGreen);
                            }
                        }
                        break;
                    //debug
                    //testbuff
                    case "/playeros":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Scripter))
                            {
                                Client n = ClientManager.FindClient(joinedArgs);
                                Messenger.PlayerMsg(client, n.Player.Name + " OS info:", Text.Yellow);
                                Messenger.PlayerMsg(client, n.Player.GetOSVersion(), Text.Yellow);
                                Messenger.PlayerMsg(client, ".NET info:", Text.Yellow);
                                Messenger.PlayerMsg(client, n.Player.GetDotNetVersion(), Text.Yellow);
                                Messenger.PlayerMsg(client, "Client info:", Text.Yellow);
                                Messenger.PlayerMsg(client, n.Player.GetClientEdition(), Text.Yellow);
                            }
                            else
                            {
                                Messenger.PlayerMsg(client, "That is not a valid command!", Text.BrightRed);
                            }
                        }
                        break;
                    case "/lounge":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Moniter))
                            {
                                Messenger.PlayerWarp(client, 1466, 39, 21);
                                Messenger.PlayerMsg(client, "Welcome to the staff headquarters!", Text.Yellow);
                                //110
                            }
                        }
                        break;
                    case "/gccollect":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Moniter))
                            {
                                GC.Collect();
                                Messenger.PlayerMsg(client, "Garbage collected!", Text.BrightGreen);
                            }
                        }
                        break;
                    case "/adminmsg":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Mapper))
                            {
                                //DatabaseManager.OptionsDB.SaveSetting("Generic", "AdminMsg", joinedArgs);
                                //Messenger.PlayerMsg(client, "Admin message changed to: \"" + joinedArgs + "\"", Text.BrightGreen);
                            }
                        }
                        break;
                    case "/motd":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Mapper))
                            {
                                Server.Settings.MOTD = joinedArgs;
                                Messenger.GlobalMsg("MOTD changed to: " + joinedArgs, Text.BrightCyan);
                                Server.Settings.SaveMOTD();
                                Server.Logging.ChatLogger.AppendToChatLog("Staff", "[MOTD] " + client.Player.Name + " set the MOTD to: " + joinedArgs);
                            }
                        }
                        break;

                    #region CTF Commands
                    case "/ctfcreate":
                        {
                            if (client.Player.MapID == MapManager.GenerateMapID(CTF.HUBMAP))
                            {
                                if (ActiveCTF == null)
                                {
                                    ActiveCTF = new CTF(CTF.CTFGameState.NotStarted);
                                }
                                if (ActiveCTF.GameState == CTF.CTFGameState.NotStarted)
                                {
                                    ActiveCTF.CreateGame(client);
                                    return;
                                }
                                else
                                {
                                    Messenger.PlayerMsg(client, "A game of Capture The Flag is already started!", Text.BrightRed);
                                }
                            }
                        }
                        break;
                    case "/ctfjoin":
                        {
                            if (client.Player.Muted)
                            {
                                Messenger.PlayerMsg(client, "You cannot join the game because you are muted!", Text.BrightRed);
                            }
                            if (client.Player.MapID == MapManager.GenerateMapID(CTF.HUBMAP))
                            {
                                if (ActiveCTF == null)
                                {
                                    Messenger.PlayerMsg(client, "No game has been started yet!", Text.BrightRed);
                                }
                                else if (ActiveCTF.GameState == CTF.CTFGameState.WaitingForPlayers)
                                {
                                    if (exPlayer.Get(client).InCTF == false)
                                    {
                                        ActiveCTF.AddToGame(client);
                                    }
                                    else
                                    {
                                        Messenger.PlayerMsg(client, "You have already joined the game!", Text.BrightRed);
                                    }
                                }
                                else
                                {
                                    if (ActiveCTF.GameState == CTF.CTFGameState.Started)
                                    {
                                        Messenger.PlayerMsg(client, "There is already a game of Capture The Flag that has been started!", Text.BrightRed);
                                    }
                                    else
                                    {
                                        Messenger.PlayerMsg(client, "No game of Capture The Flag has been created yet!", Text.BrightRed);
                                    }
                                }
                            }
                        }
                        break;
                    case "/ctfleave":
                        {
                            if (client.Player.MapID == MapManager.GenerateMapID(CTF.REDMAP) || client.Player.MapID == MapManager.GenerateMapID(CTF.BLUEMAP))
                            {
                                ActiveCTF.RemoveFromGame(client);
                            }
                        }
                        break;
                    case "/ctfstart":
                        {
                            if (ActiveCTF.GameLeader == client)
                            {
                                ActiveCTF.StartGame();
                                ActiveCTF.CTFMsg("This game of Capture The Flag has started.", Text.Yellow);
                                ActiveCTF.CTFMsg("This game will have " + ActiveCTF.BlueFlags + " flags!", Text.Yellow);
                            }
                        }
                        break;
                    case "/ctfflags":
                        {
                            if (ActiveCTF.GameLeader == client && ActiveCTF.GameState == CTF.CTFGameState.WaitingForPlayers)
                            {
                                ActiveCTF.RedFlags = joinedArgs.ToInt();
                                ActiveCTF.BlueFlags = joinedArgs.ToInt();
                                Messenger.PlayerMsg(client, "This game will have " + ActiveCTF.BlueFlags + " flags!", Text.Yellow);
                            }
                        }
                        break;
                    case "/ctfend":
                        {
                            if (ActiveCTF.GameLeader == client)
                            {
                                ActiveCTF.EndGame(client);
                                Messenger.PlayerMsg(client, "You have ended the game.", Text.Yellow);
                            }
                        }
                        break;
                    case "/ctfforceend":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Moniter))
                            {
                                ActiveCTF.EndGame(client.Player.Name);
                                Messenger.PlayerMsg(client, "You have ended the game.", Text.Yellow);
                            }
                        }
                        break;
                    case "/ctf":
                        {
                            if (ActiveCTF.GameState == CTF.CTFGameState.Started)
                            {
                                if (exPlayer.Get(client).InCTF)
                                {
                                    ActiveCTF.CTFMsg(client.Player.Name + " [CTF]: " + joinedArgs, Text.Grey);
                                }
                            }
                        }
                        break;
                    case "/ctft":
                        {
                            if (ActiveCTF.GameState == CTF.CTFGameState.Started)
                            {
                                if (exPlayer.Get(client).InCTF)
                                {
                                    ActiveCTF.CTFTMsg(client, client.Player.Name + " [CTF Team]: " + joinedArgs, Text.Grey);
                                }
                            }
                        }
                        break;
                    case "/ctfgen":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Scripter))
                            {
                                RDungeonMap dungeonMap = RDungeonFloorGen.GenerateFloor(client, 39, 0, RDungeonManager.RDungeons[39].Floors[0].Options);
                                Messenger.PlayerWarp(client, dungeonMap, dungeonMap.StartX, dungeonMap.StartY);
                            }
                        }
                        break;
                    #endregion CTF Commands
                    case "/checkstack":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Moniter))
                            {
                                Client n = ClientManager.FindClient(command[1]);
                                if (n == null)
                                {
                                    Messenger.PlayerMsg(client, "Player is offline.", Text.Grey);
                                }
                                else if (command[2].ToInt() <= 0)
                                {
                                    Messenger.PlayerMsg(client, "Invalid item number.", Text.BrightRed);
                                }
                                else if (n == client)
                                {
                                    Messenger.PlayerMsg(client, "Your amount of " + ItemManager.Items[command[2].ToInt()].Name + ": " + n.Player.HasItem(command[2].ToInt()).ToString(), Text.Yellow);
                                }
                                else
                                {
                                    Messenger.PlayerMsg(client, n.Player.Name + "'s amount of " + ItemManager.Items[command[2].ToInt()].Name + ": " + n.Player.HasItem(command[2].ToInt()).ToString(), Text.Yellow);
                                }
                            }
                        }
                        break;
                    case "/checkinv*":
                    case "/checkinv":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Moniter))
                            {
                                Client n;
                                string[] subCommand = command[0].Split('*');
                                if (subCommand.Length > 1)
                                {
                                    n = ClientManager.FindClient(joinedArgs, true);
                                }
                                else
                                {
                                    n = ClientManager.FindClient(joinedArgs);
                                }
                                Messenger.PlayerMsg(client, n.Player.Name + "'s Inventory:", Text.Yellow);
                                InventoryItem item;
                                for (int i = 1; i <= n.Player.MaxInv; i++)
                                {
                                    item = n.Player.Inventory[i];
                                    int amount = 0;
                                    string msg = item.Num + " ";
                                    if (item.Num > 0)
                                    {
                                        msg += ItemManager.Items[item.Num].Name;
                                        amount = item.Amount;
                                    }
                                    if (amount > 0)
                                    {
                                        msg += " (" + amount.ToString() + ")";
                                    }
                                    if (item.Tag != "")
                                    {
                                        msg += " [" + item.Tag + "]";
                                    }
                                    if (msg != "")
                                    {
                                        Messenger.PlayerMsg(client, msg, Text.Yellow);
                                    }
                                }
                            }
                        }
                        break;
                    case "/clearinv":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Moniter))
                            {
                                for (int i = 1; i <= client.Player.MaxInv; i++)
                                {
                                    client.Player.TakeItemSlot(i, client.Player.Inventory[i].Amount, true);
                                }
                                Messenger.PlayerMsg(client, "Inventory Cleared", Text.Yellow);
                            }
                        }
                        break;
                    case "/checkbank*":
                    case "/checkbank":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Moniter))
                            {
                                Client n;
                                string[] subCommand = command[0].Split('*');
                                if (subCommand.Length > 1)
                                {
                                    n = ClientManager.FindClient(joinedArgs, true);
                                }
                                else
                                {
                                    n = ClientManager.FindClient(joinedArgs);
                                }
                                Messenger.PlayerMsg(client, n.Player.Name + "'s Bank:", Text.Yellow);
                                InventoryItem item;
                                for (int i = 1; i <= n.Player.MaxBank; i++)
                                {
                                    item = n.Player.Bank[i];
                                    int amount = 0;
                                    string msg = "";
                                    if (item.Num > 0)
                                    {
                                        msg = ItemManager.Items[item.Num].Name;
                                        amount = item.Amount;
                                    }
                                    if (amount > 0)
                                    {
                                        msg += " (" + amount.ToString() + ")";
                                    }
                                    if (msg != "")
                                    {
                                        Messenger.PlayerMsg(client, msg, Text.Yellow);
                                    }
                                }
                            }
                        }
                        break;
                    case "/checktile":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Moniter))
                            {
                                Tile tile = client.Player.Map.Tile[client.Player.X, client.Player.Y];
                                Messenger.PlayerMsg(client, tile.Type.ToString(), Text.Yellow);
                                Messenger.PlayerMsg(client, "Ground: " + tile.GroundSet + ":" + tile.Ground, Text.Yellow);
                                Messenger.PlayerMsg(client, "GroundAnim: " + tile.GroundAnimSet + ":" + tile.GroundAnim, Text.Yellow);
                                Messenger.PlayerMsg(client, "Mask: " + tile.MaskSet + ":" + tile.Mask, Text.Yellow);
                                Messenger.PlayerMsg(client, "MaskAnim: " + tile.AnimSet + ":" + tile.Anim, Text.Yellow);
                                Messenger.PlayerMsg(client, "Mask2: " + tile.Mask2Set + ":" + tile.Mask2, Text.Yellow);
                                Messenger.PlayerMsg(client, "Mask2Anim: " + tile.M2AnimSet + ":" + tile.M2Anim, Text.Yellow);
                                Messenger.PlayerMsg(client, "Fringe: " + tile.FringeSet + ":" + tile.Fringe, Text.Yellow);
                                Messenger.PlayerMsg(client, "FringeAnim: " + tile.FAnimSet + ":" + tile.FAnim, Text.Yellow);
                                Messenger.PlayerMsg(client, "Fringe2: " + tile.Fringe2Set + ":" + tile.Fringe2, Text.Yellow);
                                Messenger.PlayerMsg(client, "Fringe2Anim: " + tile.F2AnimSet + ":" + tile.F2Anim, Text.Yellow);
                                Messenger.PlayerMsg(client, "Data1: " + tile.Data1, Text.Yellow);
                                Messenger.PlayerMsg(client, "Data2: " + tile.Data2, Text.Yellow);
                                Messenger.PlayerMsg(client, "Data3: " + tile.Data3, Text.Yellow);
                                Messenger.PlayerMsg(client, "String1: " + tile.String1, Text.Yellow);
                                Messenger.PlayerMsg(client, "String2: " + tile.String2, Text.Yellow);
                                Messenger.PlayerMsg(client, "String3: " + tile.String3, Text.Yellow);
                            }
                        }
                        break;
                    case "/checkmoves":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Moniter))
                            {
                                Client n = ClientManager.FindClient(joinedArgs);
                                Messenger.PlayerMsg(client, n.Player.Name + "'s Moves:", Text.Yellow);
                                for (int i = 0; i < Constants.MAX_ACTIVETEAM; i++)
                                {
                                    if (n.Player.Team[i] != null && n.Player.Team[i].Loaded)
                                    {
                                        Messenger.PlayerMsg(client, "Team #" + i + ": " + Pokedex.GetPokemon(n.Player.Team[i].Species).Name, Text.Yellow);
                                        for (int j = 0; j < 4; j++)
                                        {
                                            if (n.Player.Team[i].Moves[j].MoveNum > 0)
                                            {
                                                Messenger.PlayerMsg(client, MoveManager.Moves[n.Player.Team[i].Moves[j].MoveNum].Name, Text.Yellow);
                                            }
                                        }
                                    }
                                }
                            }
                        }
                        break;
                    case "/checkmissions":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Moniter))
                            {
                                Client n = ClientManager.FindClient(joinedArgs);
                                Messenger.PlayerMsg(client, n.Player.Name + "'s Mission Board:", Text.Yellow);
                                foreach (WonderMail mail in n.Player.MissionBoard.BoardMissions)
                                {
                                    Messenger.PlayerMsg(client, mail.Title, Text.Yellow);
                                }
                                Messenger.PlayerMsg(client, n.Player.Name + "'s Job List:", Text.Yellow);
                                foreach (WonderMailJob job in n.Player.JobList.JobList)
                                {
                                    Messenger.PlayerMsg(client, job.Mission.Title, Text.Yellow);
                                }
                            }
                        }
                        break;
                    //checkpts ~ what pts? THERE ARE NO PTS ANYMORE
                    #region Auction Commands
                    case "/masswarpauction":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Scripter))
                            {
                                foreach (Client i in ClientManager.GetClients())
                                {
                                    Messenger.AskQuestion(i, "MassWarpAuction", client.Player.Name + " is inviting you to join an auction!  Would you like to play?", -1);
                                }
                            }
                        }
                        break;
                    case "/createauction":
                        {
                            if (client.Player.MapID == Auction.AUCTION_MAP)
                            {
                                if (!Auction.StaffAuction)
                                {
                                    Auction.CreateAuction(client);
                                }
                                else if (Auction.StaffAuction && Ranks.IsAllowed(client, Enums.Rank.Mapper))
                                {
                                    Auction.CreateAuction(client);
                                }
                                else
                                {
                                    Messenger.PlayerMsg(client, "A staff held auction is in progress. You may not create an auction at this time!", Text.BrightRed);
                                }

                            }

                        }
                        break;
                    case "/startauction":
                        {
                            Auction.StartAuction(client);
                        }
                        break;
                    case "/endauction":
                        {
                            Auction.EndAuction(client);
                        }
                        break;
                    case "/auctionadminhelp":
                        {
                            Auction.SayHelp(client);
                        }
                        break;
                    case "/auctionhelp":
                        {
                            Auction.SayPlayerHelp(client);
                        }
                        break;
                    case "/checkbidder":
                        {
                            Auction.CheckBidder(client);
                        }
                        break;
                    case "/setauctionitem":
                        {
                            Auction.SetAuctionItem(client, joinedArgs);
                        }
                        break;
                    case "/setauctionminbid":
                        {
                            Auction.SetAuctionMinBid(client, joinedArgs.ToInt());
                        }
                        break;
                    case "/setbidincrement":
                        {
                            Auction.SetBidIncrement(client, joinedArgs.ToInt());
                        }
                        break;
                    case "/bid":
                        {
                            if (client.Player.HasItem(1) >= joinedArgs.ToInt())
                            {
                                Auction.UpdateBids(client, joinedArgs.ToInt());
                            }
                            else
                            {
                                Messenger.PlayerMsg(client, "You don't have enough Poké!", Text.BrightRed);
                            }
                        }
                        break;

                    #endregion Auction Commands
                    case "/reward":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Admin))
                            {
                                foreach (Client i in client.Player.Map.GetClients())
                                {
                                    //	i.Player.GiveItem(746, 1);
                                    i.Player.GiveItem(133, 3);
                                    Messenger.PlayerMsg(i, "You have been awarded three event tokens for participating!", Text.BrightGreen);
                                }
                            }
                        }
                        break;
                    case "/givetokens":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Moniter))
                            {
                                Client n;
                                n = ClientManager.FindClient(command[1]);
                                int numTokens = command[2].ToInt();

                                n.Player.GiveItem(133, numTokens);
                                Messenger.PlayerMsg(n, client.Player.Name + " has awarded you " + numTokens + " event tokens!", Text.BrightGreen);
                                Messenger.AdminMsg("[Staff] " + client.Player.Name + " has given " + n.Player.Name + " " + numTokens + " event tokens!", Text.BrightBlue);
                            }
                        }
                        break;
                    case "/setname*":
                    case "/setname":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Admin))
                            {
                                Client n;
                                string newName = command[2];
                                string[] subCommand = command[0].Split('*');
                                if (subCommand.Length > 1)
                                {
                                    n = ClientManager.FindClient(command[1], true); // Attempt to find our player if they have a difficult name
                                }
                                else
                                {
                                    n = ClientManager.FindClient(command[1]);
                                }

                                n.Player.Name = newName;
                                Messenger.SendPlayerData(n);
                            }
                        }
                        break;

                    case "/setguild":
                        {
                            try
                            {
                                if (Ranks.IsAllowed(client, Enums.Rank.Admin))
                                {
                                    using (DatabaseConnection dbConnection = new DatabaseConnection(DatabaseID.Players))
                                    {
                                        Client n = ClientManager.FindClient(command[1]);
                                        string guildName = command[2];
                                        if (n != null)
                                        {
                                            // DataManager.Players.PlayerDataManager.AddGuildMember(dbConnection.Database, guildName, n.Player.CharID);
                                            // DataManager.Players.PlayerDataManager.SetGuildAccess(dbConnection.Database, n.Player.CharID, (int)Enums.GuildRank.Founder);
                                            // n.Player.GuildName = guildName;
                                            //  n.Player.GuildAccess = Enums.GuildRank.Founder;

                                            // DataManager.Players.PlayerDataManager.RemoveGuildMember(dbConnection.Database, n.Player.CharID);
                                            n.Player.GuildName = command[2];
                                            // n.Player.GuildAccess = Enums.GuildRank.None;

                                            Messenger.SendPlayerGuild(n);
                                        }
                                    }
                                }
                            }
                            catch (Exception ex) { }
                        }
                        break;
                    //case "/checkowner": {
                    //        if (Ranks.IsAllowed(client, Enums.Rank.Moniter)) {
                    //            if (client.Player.Map.Owner != null) {
                    //                Messenger.PlayerMsg(client, "The owner of this place is: " + client.Player.Map.Owner, Text.Yellow);
                    //            }
                    //        }
                    //    }
                    //    break;
                    //blockpm
                    //closeserver
                    //closeall
                    //closenonplayers

                    case "/hb":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Admin))
                            {
                                string playerMap = client.Player.MapID;
                                Messenger.MapMsg(playerMap, "H", Text.Blue);
                                Messenger.MapMsg(playerMap, "A", Text.Green);
                                Messenger.MapMsg(playerMap, "P", Text.Cyan);
                                Messenger.MapMsg(playerMap, "P", Text.Red);
                                Messenger.MapMsg(playerMap, "Y", Text.Magenta);
                                Messenger.MapMsg(playerMap, "-", Text.Grey);
                                Messenger.MapMsg(playerMap, "B", Text.Brown);
                                Messenger.MapMsg(playerMap, "I", Text.BrightBlue);
                                Messenger.MapMsg(playerMap, "R", Text.BrightGreen);
                                Messenger.MapMsg(playerMap, "T", Text.BrightCyan);
                                Messenger.MapMsg(playerMap, "H", Text.BrightRed);
                                Messenger.MapMsg(playerMap, "D", Text.Pink);
                                Messenger.MapMsg(playerMap, "A", Text.Yellow);
                                Messenger.MapMsg(playerMap, "Y", Text.Blue);
                                Messenger.MapMsg(playerMap, joinedArgs + "!", Text.White);
                                Messenger.PlaySoundToMap(client.Player.MapID, "magic7.wav");
                            }
                        }
                        break;
                    case "/pk":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Moniter))
                            {
                                if (command.CommandArgs.Count >= 2)
                                {
                                    Client n = ClientManager.FindClient(joinedArgs);
                                    if (n != null)
                                    {
                                        //n.Player.PK = !n.Player.PK;
                                        Messenger.SendPlayerData(n);
                                    }
                                }
                            }
                        }
                        break;
                    case "/eat":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Admin))
                            {
                                if (command.CommandArgs.Count >= 2)
                                {
                                    Client n = ClientManager.FindClient(joinedArgs);
                                    if (n != null)
                                    {
                                        Messenger.GlobalMsg(client.Player.Name + " has eaten " + n.Player.Name + "!", Text.Yellow);
                                        Messenger.PlayerWarp(n, 509, 11, 8);
                                        //} else if (n == index) {
                                        //    NetScript.PlayerMsg(index, "You cant eat yourself!", Text.BrightRed);
                                    }
                                    else if (n == null)
                                    {
                                        Messenger.PlayerMsg(client, "Player is offline.", Text.Grey);
                                    }
                                }
                                else
                                {
                                    Messenger.PlayerMsg(client, "You have to pick somebody to eat!", Text.Black);
                                }
                            }
                        }
                        break;
                    case "/._.":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Admin))
                            {
                                if (command.CommandArgs.Count >= 2)
                                {
                                    Client n = ClientManager.FindClient(joinedArgs);
                                    if (n != null)
                                    {
                                        Messenger.GlobalMsg(client.Player.Name + " has stared into the eternal soul of " + n.Player.Name + "!", System.Drawing.Color.MidnightBlue);
                                        Messenger.PlayerWarp(n, 2000, 9, 6);
                                        //} else if (n == index) {
                                        //    NetScript.PlayerMsg(index, "You cant eat yourself!", Text.BrightRed);
                                    }
                                    else if (n == null)
                                    {
                                        Messenger.PlayerMsg(client, "Player is offline.", Text.Grey);
                                    }
                                }
                                else
                                {
                                    Messenger.PlayerMsg(client, "You have to pick somebody to stare into the eternal soul of!", Text.Black);
                                }
                            }
                        }
                        break;
                    case "/addnews":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Mapper))
                            {
                                if (command.CommandArgs.Count >= 2)
                                {
                                    try
                                    {
                                        Server.Settings.AddNews(joinedArgs);
                                        Messenger.GlobalMsg("Updated News: " + joinedArgs, Text.Yellow);
                                    }
                                    catch (Exception ex)
                                    {
                                        Messenger.PlayerMsg(client, ex.ToString(), Text.Red);
                                    }
                                    Messenger.PlayerMsg(client, "News updated!", Text.Yellow);
                                }
                                else
                                {
                                    Messenger.PlayerMsg(client, "The new news cant be blank!", Text.BrightRed);
                                }
                            }
                        }
                        break;
                    case "/reloadnews":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Mapper))
                            {
                                Server.Settings.LoadNews();
                                Messenger.PlayerMsg(client, "News have been reloaded!", Text.Yellow);
                            }
                        }
                        break;
                    case "/news":
                        {
                            Messenger.PlayerMsg(client, "Latest News:", Text.Yellow);
                            for (int i = 0; i < Server.Settings.News.Count; i++)
                            {
                                Messenger.PlayerMsg(client, Server.Settings.News[i], Text.Yellow);
                            }

                        }
                        break;
                    case "/givemove":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Developer))
                            {
                                Client n = ClientManager.FindClient(command[1]);
                                if (n != null)
                                {
                                    int moveNum;
                                    if (command[2].IsNumeric() && command[2].ToInt() > 1 && command[2].ToInt() <= MoveManager.Moves.MaxMoves)
                                    {
                                        moveNum = command[2].ToInt();
                                        n.Player.GetActiveRecruit().LearnNewMove(moveNum);
                                        Messenger.PlayerMsg(client, "You have taught " + n.Player.Name + " the move " + MoveManager.Moves[moveNum].Name, Text.Yellow);
                                        Server.Logging.ChatLogger.AppendToChatLog("Staff", "[Move Given] " + client.Player.Name + " gave " + n.Player.Name + " the move " + MoveManager.Moves[moveNum].Name);

                                    }
                                    else
                                    {
                                        moveNum = -1;
                                        for (int i = 1; i <= MoveManager.Moves.MaxMoves; i++)
                                        {
                                            if (MoveManager.Moves[i].Name.ToLower().StartsWith(command[2].ToLower()))
                                            {
                                                moveNum = i;
                                            }
                                        }
                                        if (moveNum > -1)
                                        {

                                            n.Player.GetActiveRecruit().LearnNewMove(moveNum);
                                            Messenger.PlayerMsg(client, "You have taught " + n.Player.Name + " the move " + MoveManager.Moves[moveNum].Name, Text.Yellow);
                                            Server.Logging.ChatLogger.AppendToChatLog("Staff", "[Move Given] " + client.Player.Name + " gave " + n.Player.Name + " the move " + MoveManager.Moves[moveNum].Name);
                                        }
                                    }
                                    Messenger.SendPlayerMoves(n);
                                }
                            }
                        }
                        break;
                    //global
                    //fakeadmin
                    //serverontime, obsolete
                    case "/hunt":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Moniter))
                            {
                                if (client.Player.ProtectionOff)
                                {
                                    client.Player.ProtectionOff = false;
                                    client.Player.Hunted = false;
                                    Messenger.PlayerMsg(client, "You are no longer hunted.", Text.BrightGreen);
                                }
                                else
                                {
                                    client.Player.ProtectionOff = true;
                                    client.Player.Hunted = true;
                                    Messenger.PlayerMsg(client, "You are now hunted.", Text.BrightGreen);
                                }
                                PacketBuilder.AppendHunted(client, hitlist);
                            }
                        }
                        break;
                    case "/learnmove":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Mapper))
                            {
                                int move = command[1].ToInt();
                                if (move <= MoveManager.Moves.MaxMoves)
                                {
                                    client.Player.GetActiveRecruit().LearnNewMove(move);
                                    Server.Logging.ChatLogger.AppendToChatLog("Staff", "[Move Given] " + client.Player.Name + " gave themselves the move: " + MoveManager.Moves[move].Name);
                                }
                                Messenger.SendPlayerMoves(client);
                            }
                        }
                        break;
                    case "/give":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Developer))
                            {
                                Client n = ClientManager.FindClient(command[1]);
                                int itemAmount = command[2].ToInt();
                                string item = command[3];
                                if (itemAmount == 0)
                                {
                                    Messenger.PlayerMsg(client, "Invalid item amount.", Text.BrightRed);
                                }
                                else if (n == null)
                                {
                                    Messenger.PlayerMsg(client, "Player is offline.", Text.Grey);
                                }
                                else
                                {
                                    if (item.IsNumeric())
                                    {
                                        if (item.ToInt() <= 0 || item.ToInt() > Server.Items.ItemManager.Items.MaxItems)
                                        {
                                            Messenger.PlayerMsg(client, "Invalid item number.", Text.BrightRed);
                                        }
                                        else
                                        {
                                            if (ItemManager.Items[item.ToInt()].StackCap <= 1)
                                            {
                                                for (int i = itemAmount; i > 0; i--)
                                                {
                                                    n.Player.GiveItem(item.ToInt(), 1);
                                                }
                                                Messenger.PlayerMsg(client, "You have given " + n.Player.Name + " " + itemAmount.ToString() + " " + ItemManager.Items[item.ToInt()].Name + "!", Text.Yellow);
                                                Messenger.PlayerMsg(n, client.Player.Name + " has given you " + itemAmount.ToString() + " " + ItemManager.Items[item.ToInt()].Name + "!", Text.Yellow);
                                                Server.Logging.ChatLogger.AppendToChatLog("Staff", "[Item Given] " + client.Player.Name + " gave " + n.Player.Name + " " + itemAmount + " " + ItemManager.Items[item.ToInt()].Name);
                                            }
                                            else
                                            {
                                                n.Player.GiveItem(item.ToInt(), itemAmount);
                                                Messenger.PlayerMsg(client, "You have given " + n.Player.Name + " " + itemAmount.ToString() + " " + ItemManager.Items[item.ToInt()].Name + "!", Text.Yellow);
                                                Messenger.PlayerMsg(n, client.Player.Name + " has given you " + itemAmount.ToString() + " " + ItemManager.Items[item.ToInt()].Name + "!", Text.Yellow);
                                                Server.Logging.ChatLogger.AppendToChatLog("Staff", "[Item Given] " + client.Player.Name + " gave " + n.Player.Name + " " + itemAmount + " " + ItemManager.Items[item.ToInt()].Name);
                                            }
                                        }
                                    }
                                    else
                                    {
                                        int itemNum = -1;
                                        for (int i = Server.Items.ItemManager.Items.MaxItems; i > 0; i--)
                                        {
                                            if (ItemManager.Items[i].Name.ToLower().StartsWith(item.ToLower()))
                                            {
                                                itemNum = i;
                                            }
                                        }
                                        if (itemNum == -1)
                                        {
                                            Messenger.PlayerMsg(client, "Unable to find an item that starts with " + item, Text.Yellow);
                                        }
                                        else
                                        {
                                            n.Player.GiveItem(itemNum, itemAmount);
                                            Messenger.PlayerMsg(client, "You have given " + n.Player.Name + " " + itemAmount.ToString() + " " + ItemManager.Items[item.ToInt()].Name + "!", Text.Yellow);
                                            Messenger.PlayerMsg(n, client.Player.Name + " has given you " + itemAmount.ToString() + " " + ItemManager.Items[item.ToInt()].Name + "!", Text.Yellow);
                                            Server.Logging.ChatLogger.AppendToChatLog("Staff", "[Item Given] " + client.Player.Name + " gave " + n.Player.Name + " " + itemAmount + " " + ItemManager.Items[item.ToInt()].Name);
                                        }
                                    }
                                }

                            }
                        }
                        break;
                    case "/take":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Developer))
                            {
                                Client n = ClientManager.FindClient(command[1]);
                                int itemAmount = command[2].ToInt();
                                string item = command[3];
                                if (itemAmount == 0)
                                {
                                    Messenger.PlayerMsg(client, "Invalid item amount.", Text.BrightRed);
                                }
                                else if (n == null)
                                {
                                    Messenger.PlayerMsg(client, "Player is offline.", Text.Grey);
                                }
                                else
                                {
                                    if (item.IsNumeric())
                                    {
                                        if (item.ToInt() <= 0 || item.ToInt() > Server.Items.ItemManager.Items.MaxItems)
                                        {
                                            Messenger.PlayerMsg(client, "Invalid item number.", Text.BrightRed);
                                        }
                                        else
                                        {
                                            n.Player.TakeItem(item.ToInt(), itemAmount);
                                            Messenger.PlayerMsg(client, "You have taken " + itemAmount.ToString() + " " + ItemManager.Items[item.ToInt()].Name + " from " + n.Player.Name + "!", Text.Yellow);
                                            Server.Logging.ChatLogger.AppendToChatLog("Staff", "[Item Taken] " + client.Player.Name + " took " + itemAmount + " " + ItemManager.Items[item.ToInt()].Name + " from " + n.Player.Name);
                                            //NetScript.PlayerMsg(player, NetScript.GetPlayerName(index) + " has given you " +  itemAmount.ToString() + " " + NetScript.GetItemName(item.ToInt()) + "!", Text.Yellow);
                                        }
                                    }
                                    else
                                    {
                                        int itemNum = -1;
                                        for (int i = Server.Items.ItemManager.Items.MaxItems; i > 0; i--)
                                        {
                                            if (ItemManager.Items[i].Name.ToLower().StartsWith(item.ToLower()))
                                            {
                                                itemNum = i;
                                            }
                                        }
                                        if (itemNum == -1)
                                        {
                                            Messenger.PlayerMsg(client, "Unable to find an item that starts with " + item, Text.Yellow);
                                        }
                                        else
                                        {
                                            n.Player.TakeItem(itemNum, itemAmount);
                                            Messenger.PlayerMsg(client, "You have taken " + itemAmount.ToString() + " " + ItemManager.Items[item.ToInt()].Name + " from " + n.Player.Name + "!", Text.Yellow);
                                            Server.Logging.ChatLogger.AppendToChatLog("Staff", "[Item Taken] " + client.Player.Name + " took " + itemAmount + " " + ItemManager.Items[item.ToInt()].Name + " from " + n.Player.Name);
                                            //NetScript.PlayerMsg(player, NetScript.GetPlayerName(index) + " has given you " +  itemAmount.ToString() + " " + NetScript.GetItemName(itemNum) + "!", Text.Yellow);
                                        }
                                    }
                                }
                            }
                        }
                        break;
                    case "/save":
                        {
                            if (client.Player.SavingLocked == false)
                            {
                                using (DatabaseConnection dbConnection = new DatabaseConnection(DatabaseID.Players))
                                {
                                    client.Player.SaveCharacterData(dbConnection);
                                }
                                Messenger.PlayerMsg(client, "You have saved the game!", Text.BrightGreen);
                            }
                            else
                            {
                                Messenger.PlayerMsg(client, "You cannot save right now!", Text.BrightRed);
                            }
                        }
                        break;
                    //damageturn ~ obsolete because nothing targets anything anymore
                    case "/s":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Scripter))
                            {
                                foreach (Client i in ClientManager.GetClients())
                                {
                                    if (i.IsPlaying() && i.Player.Access == Enums.Rank.Scripter)
                                    {
                                        Messenger.PlayerMsg(i, client.Player.Name + " [Script Chat]: " + joinedArgs, System.Drawing.Color.MediumSlateBlue);

                                    }
                                }

                            }
                        }
                        break;
                    case "/g":
                        {
                            if (!string.IsNullOrEmpty(client.Player.GuildName) && !string.IsNullOrEmpty(joinedArgs) && client.Player.Muted == false)
                            {
                                OnChatMessageRecieved(client, joinedArgs, Enums.ChatMessageType.Guild);
                                Server.Logging.ChatLogger.AppendToChatLog("Guild Chat/" + client.Player.GuildName, client.Player.Name + ": " + joinedArgs);
                                /*
                                List<System.Drawing.Color> textChoices = new List<System.Drawing.Color>();

                                textChoices.Add(Text.Blue);
                                textChoices.Add(Text.Green);
                                textChoices.Add(Text.Cyan);
                                textChoices.Add(Text.Red);
                                textChoices.Add(Text.Magenta);
                                textChoices.Add(Text.Grey);
                                textChoices.Add(Text.Brown);
                                textChoices.Add(Text.BrightBlue);
                                textChoices.Add(Text.BrightGreen);
                                textChoices.Add(Text.BrightCyan);
                                textChoices.Add(Text.BrightRed);
                                textChoices.Add(Text.Pink);
                                textChoices.Add(Text.Yellow);
                                textChoices.Add(Text.Blue);
                                */
                                foreach (Client i in ClientManager.GetClients())
                                {
                                    if (i.IsPlaying() && (Ranks.IsAllowed(i, Enums.Rank.Moniter) || i.Player.GuildName == client.Player.GuildName))
                                    {
                                        Messenger.PlayerMsg(i, client.Player.Name + " [" + client.Player.GuildName + "]: " + joinedArgs, System.Drawing.Color.MediumSpringGreen);

                                    }
                                }

                            }
                        }
                        break;
                    case "/finditemend":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Moniter))
                            {
                                int itemsFound = 0;
                                for (int i = 0; i < Server.Items.ItemManager.Items.MaxItems; i++)
                                {
                                    if (ItemManager.Items[i].Name.ToLower().EndsWith(joinedArgs.ToLower()))
                                    {
                                        Messenger.PlayerMsg(client, ItemManager.Items[i].Name + "'s number is " + i.ToString(), Text.Yellow);
                                        itemsFound++;
                                        //return;
                                    }
                                }
                                if (itemsFound == 0)
                                {
                                    Messenger.PlayerMsg(client, "Unable to find an item that starts with '" + joinedArgs + "'", Text.Yellow);
                                }
                            }
                        }
                        break;
                    case "/finditem":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Moniter))
                            {
                                int itemsFound = 0;
                                if (String.IsNullOrEmpty(joinedArgs))
                                {
                                    Messenger.PlayerMsg(client, "Type in an item name.", Text.Yellow);
                                }
                                else
                                {
                                    for (int i = 0; i < Server.Items.ItemManager.Items.MaxItems; i++)
                                    {
                                        if (ItemManager.Items[i].Name.ToLower().Contains(joinedArgs.ToLower()))
                                        {
                                            Messenger.PlayerMsg(client, ItemManager.Items[i].Name + "'s number is " + i.ToString(), Text.Yellow);
                                            itemsFound++;
                                            //return;
                                        }
                                    }
                                    if (itemsFound == 0)
                                    {
                                        Messenger.PlayerMsg(client, "Unable to find an item that starts with '" + joinedArgs + "'", Text.Yellow);
                                    }
                                }
                            }
                        }
                        break;

                    case "/itemcheck":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Scripter))
                            {
                                for (int i = 810; i <= 810; i++)
                                {

                                    ItemManager.Items[i].Name = "Poké Flute";
                                    Messenger.SendUpdateItemToAll(i);
                                    //ItemManager.SaveItem(i);
                                    Messenger.PlayerMsg(client, i + ": " + ItemManager.Items[i].Name, Text.Yellow);

                                }

                            }
                        }
                        break;
                    case "/itemreq":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Mapper))
                            {
                                for (int i = 1; i <= 1900; i++)
                                {

                                }

                            }
                        }
                        break;
                    case "/itemdesc":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Admin))
                            {
                                for (int i = 612; i <= 628; i++)
                                {
                                    if (ItemManager.Items[i].ScriptedReq == 1)
                                    {
                                        ItemManager.Items[i].Desc = "A treasure for " + (Enums.PokemonType)ItemManager.Items[i].ReqData1 + "-Types.  Give it to a team member to prevent damage from " +
                                            (Enums.PokemonType)ItemManager.Items[i].Data2 + "-type attacks for the team's " + (Enums.PokemonType)ItemManager.Items[i].ReqData1 + "-Type team members.";
                                        Messenger.SendUpdateItemToAll(i);
                                        ItemManager.SaveItem(i);
                                        Messenger.PlayerMsg(client, ItemManager.Items[i].Name, Text.Yellow);
                                    }
                                }
                            }

                        }
                        break;
                    case "/findnpc":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Moniter))
                            {
                                int npcsFound = 0;
                                if (String.IsNullOrEmpty(joinedArgs))
                                {
                                    Messenger.PlayerMsg(client, "Type in an npc name.", Text.Yellow);
                                }
                                else
                                {
                                    for (int i = 1; i <= Server.Npcs.NpcManager.Npcs.MaxNpcs; i++)
                                    {
                                        if (NpcManager.Npcs[i].Name.ToLower().Contains(joinedArgs.ToLower()))
                                        {
                                            Messenger.PlayerMsg(client, NpcManager.Npcs[i].Name + "'s number is " + i.ToString(), Text.Yellow);
                                            npcsFound++;
                                            //return;
                                        }
                                    }
                                    if (npcsFound == 0)
                                    {
                                        Messenger.PlayerMsg(client, "Unable to find an npc that starts with '" + joinedArgs + "'", Text.Yellow);
                                    }
                                }
                            }
                        }
                        break;
                    case "/findnpcuse":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Moniter))
                            {
                                if (joinedArgs.IsNumeric())
                                {
                                    int npcNum = joinedArgs.ToInt();
                                    if (npcNum > 0 && npcNum <= Server.Npcs.NpcManager.Npcs.MaxNpcs)
                                    {
                                        int itemsFound = 0;
                                        Messenger.PlayerMsg(client, "NPC# " + npcNum + " (" + NpcManager.Npcs[npcNum].Name + ") is found in RDungeons:", Text.Yellow);
                                        for (int i = 0; i < RDungeonManager.RDungeons.Count; i++)
                                        {
                                            int rangeStart = -1;
                                            for (int j = 0; j < RDungeonManager.RDungeons[i].Floors.Count; j++)
                                            {
                                                bool npcFoundOnFloor = false;
                                                for (int k = 0; k < RDungeonManager.RDungeons[i].Floors[j].Npcs.Count; k++)
                                                {
                                                    //Messenger.PlayerMsg(client, "--" + k.ToString(), Text.Yellow);
                                                    if (RDungeonManager.RDungeons[i].Floors[j].Npcs[k].NpcNum == npcNum)
                                                    {
                                                        itemsFound++;
                                                        npcFoundOnFloor = true;
                                                        break;
                                                    }
                                                }
                                                if (npcFoundOnFloor)
                                                {
                                                    if (rangeStart == -1) rangeStart = j;
                                                }
                                                else
                                                {
                                                    if (rangeStart != -1)
                                                    {
                                                        int rangeEnd = j;
                                                        if (rangeEnd - rangeStart == 1)
                                                        {
                                                            Messenger.PlayerMsg(client, RDungeonManager.RDungeons[i].DungeonName + " F" + (rangeStart + 1), Text.Yellow);
                                                        }
                                                        else
                                                        {
                                                            Messenger.PlayerMsg(client, RDungeonManager.RDungeons[i].DungeonName + " F" + (rangeStart + 1) + "-F" + rangeEnd, Text.Yellow);
                                                        }
                                                        rangeStart = -1;
                                                    }
                                                }
                                            }
                                            if (rangeStart != -1)
                                            {
                                                int rangeEnd = RDungeonManager.RDungeons[i].Floors.Count;
                                                if (rangeEnd - rangeStart == 1)
                                                {
                                                    Messenger.PlayerMsg(client, RDungeonManager.RDungeons[i].DungeonName + " F" + (rangeStart + 1), Text.Yellow);
                                                }
                                                else
                                                {
                                                    Messenger.PlayerMsg(client, RDungeonManager.RDungeons[i].DungeonName + " F" + (rangeStart + 1) + "-F" + rangeEnd, Text.Yellow);
                                                }
                                                rangeStart = -1;
                                            }
                                        }
                                        if (itemsFound <= 0)
                                        {
                                            Messenger.PlayerMsg(client, "[None]", Text.Yellow);
                                        }
                                    }
                                    else
                                    {
                                        Messenger.PlayerMsg(client, "Input Out of Range", Text.Yellow);
                                    }
                                }
                                else
                                {
                                    Messenger.PlayerMsg(client, "Input invalid.", Text.Yellow);
                                }
                            }
                        }
                        break;
                    case "/finditemuse":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Moniter))
                            {
                                if (joinedArgs.IsNumeric())
                                {
                                    int npcNum = joinedArgs.ToInt();
                                    if (npcNum > 0 && npcNum <= Server.Items.ItemManager.Items.MaxItems)
                                    {
                                        int itemsFound = 0;
                                        Messenger.PlayerMsg(client, "Item# " + npcNum + " (" + ItemManager.Items[npcNum].Name + ") is found in RDungeons:", Text.Yellow);
                                        for (int i = 0; i < RDungeonManager.RDungeons.Count; i++)
                                        {
                                            int rangeStart = -1;
                                            for (int j = 0; j < RDungeonManager.RDungeons[i].Floors.Count; j++)
                                            {
                                                bool itemFoundOnFloor = false;
                                                for (int k = 0; k < RDungeonManager.RDungeons[i].Floors[j].Items.Count; k++)
                                                {
                                                    //Messenger.PlayerMsg(client, "--" + k.ToString(), Text.Yellow);
                                                    if (RDungeonManager.RDungeons[i].Floors[j].Items[k].ItemNum == npcNum)
                                                    {
                                                        itemsFound++;
                                                        itemFoundOnFloor = true;
                                                        break;
                                                    }
                                                }
                                                if (itemFoundOnFloor)
                                                {
                                                    if (rangeStart == -1) rangeStart = j;
                                                }
                                                else
                                                {
                                                    if (rangeStart != -1)
                                                    {
                                                        int rangeEnd = j;
                                                        if (rangeEnd - rangeStart == 1)
                                                        {
                                                            Messenger.PlayerMsg(client, RDungeonManager.RDungeons[i].DungeonName + " F" + (rangeStart + 1), Text.Yellow);
                                                        }
                                                        else
                                                        {
                                                            Messenger.PlayerMsg(client, RDungeonManager.RDungeons[i].DungeonName + " F" + (rangeStart + 1) + "-F" + rangeEnd, Text.Yellow);
                                                        }
                                                        rangeStart = -1;
                                                    }
                                                }
                                            }
                                            if (rangeStart != -1)
                                            {
                                                int rangeEnd = RDungeonManager.RDungeons[i].Floors.Count;
                                                if (rangeEnd - rangeStart == 1)
                                                {
                                                    Messenger.PlayerMsg(client, RDungeonManager.RDungeons[i].DungeonName + " F" + (rangeStart + 1), Text.Yellow);
                                                }
                                                else
                                                {
                                                    Messenger.PlayerMsg(client, RDungeonManager.RDungeons[i].DungeonName + " F" + (rangeStart + 1) + "-F" + rangeEnd, Text.Yellow);
                                                }
                                                rangeStart = -1;
                                            }
                                        }
                                        if (itemsFound <= 0)
                                        {
                                            Messenger.PlayerMsg(client, "[None]", Text.Yellow);
                                        }
                                    }
                                    else
                                    {
                                        Messenger.PlayerMsg(client, "Input Out of Range", Text.Yellow);
                                    }
                                }
                                else
                                {
                                    Messenger.PlayerMsg(client, "Input invalid.", Text.Yellow);
                                }
                            }
                        }
                        break;
                    case "/finddex":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Moniter))
                            {
                                int npcsFound = 0;
                                for (int i = 1; i <= Constants.TOTAL_POKEMON; i++)
                                {
                                    if (Pokedex.GetPokemon(i).Name.ToLower().Contains(joinedArgs.ToLower()))
                                    {
                                        foreach (PokemonForm form in Pokedex.GetPokemon(i).Forms)
                                        {
                                            Messenger.PlayerMsg(client, Pokedex.GetPokemon(i).Name + "'s dex number is " + i, Text.Yellow);
                                        }
                                        npcsFound++;
                                        //return;
                                    }
                                }
                                if (npcsFound == 0)
                                {
                                    Messenger.PlayerMsg(client, "Unable to find an Pokemon that starts with '" + joinedArgs + "'", Text.Yellow);
                                }
                            }
                        }
                        break;
                    //case "/findmap": {
                    //        //how to check inactive maps?
                    //        if (Ranks.IsAllowed(client, Enums.Rank.Mapper)) {
                    //            int mapsFound = 0;
                    //            if (!string.IsNullOrEmpty(joinedArgs)) {
                    //                for (int i = 1; i <= Server.Settings.MaxMaps; i++) {
                    //                    MapGeneralInfo generalInfo = MapManager.RetrieveMapGeneralInfo(i);
                    //                    if (generalInfo.Name.ToLower().StartsWith(joinedArgs.ToLower())) {
                    //                        Messenger.PlayerMsg(client, generalInfo.Name + "'s number is " + i.ToString(), Text.Yellow);
                    //                        mapsFound++;
                    //                        //return;
                    //                    }
                    //                }
                    //                if (mapsFound == 0) {
                    //                    Messenger.PlayerMsg(client, "Unable to find a map that starts with '" + joinedArgs + "'", Text.Yellow);
                    //                }
                    //            }
                    //        }
                    //    }
                    //    break;
                    case "/findmove":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Moniter))
                            {
                                int movesFound = 0;
                                for (int i = 1; i <= MoveManager.Moves.MaxMoves; i++)
                                {
                                    if (MoveManager.Moves[i].Name.ToLower().Contains(joinedArgs.ToLower()))
                                    {
                                        Messenger.PlayerMsg(client, MoveManager.Moves[i].Name + "'s number is " + i.ToString(), Text.Yellow);
                                        movesFound++;
                                        //return;
                                    }
                                }
                                if (movesFound == 0)
                                {
                                    Messenger.PlayerMsg(client, "Unable to find a move that starts with '" + joinedArgs + "'", Text.Yellow);
                                }
                            }
                        }
                        break;
                    case "/findmoverange":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Moniter) && joinedArgs.IsNumeric())
                            {
                                Enums.MoveRange range = (Enums.MoveRange)joinedArgs.ToInt();
                                int movesFound = 0;
                                Messenger.PlayerMsg(client, "Moves with " + range + " range", Text.Yellow);
                                for (int i = 1; i <= MoveManager.Moves.MaxMoves; i++)
                                {
                                    if (MoveManager.Moves[i].RangeType == range && !String.IsNullOrEmpty(MoveManager.Moves[i].Name))
                                    {
                                        Messenger.PlayerMsg(client, "#" + i + ": " + MoveManager.Moves[i].Name, Text.Yellow);
                                        movesFound++;
                                        //return;
                                    }
                                }
                                if (movesFound == 0)
                                {
                                    Messenger.PlayerMsg(client, "[None]", Text.Yellow);
                                }
                            }
                        }
                        break;
                    case "/findrdungeon":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Moniter))
                            {
                                int itemsFound = 0;
                                for (int i = 0; i < RDungeonManager.RDungeons.Count; i++)
                                {
                                    if (RDungeonManager.RDungeons[i].DungeonName.ToLower().Contains(joinedArgs.ToLower()))
                                    {
                                        Messenger.PlayerMsg(client, RDungeonManager.RDungeons[i].DungeonName + "'s number is " + (i + 1).ToString(), Text.Yellow);
                                        itemsFound++;
                                        //return;
                                    }
                                }
                                if (itemsFound == 0)
                                {
                                    Messenger.PlayerMsg(client, "Unable to find a random dungeon that starts with '" + joinedArgs + "'", Text.Yellow);
                                }
                            }
                        }
                        break;
                    case "/finddungeon":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Moniter))
                            {
                                int itemsFound = 0;
                                for (int i = 1; i < DungeonManager.Dungeons.Count; i++)
                                {
                                    if (DungeonManager.Dungeons[i].Name.ToLower().Contains(joinedArgs.ToLower()))
                                    {
                                        Messenger.PlayerMsg(client, DungeonManager.Dungeons[i].Name + "'s number is " + i.ToString(), Text.Yellow);
                                        itemsFound++;
                                        //return;
                                    }
                                }
                                if (itemsFound == 0)
                                {
                                    Messenger.PlayerMsg(client, "Unable to find a dungeon that starts with '" + joinedArgs + "'", Text.Yellow);
                                }
                            }
                        }
                        break;
                    case "/addfriend":
                        {
                            client.Player.AddFriend(joinedArgs);
                        }
                        break;
                    case "/removefriend":
                        {
                            client.Player.RemoveFriend(joinedArgs);
                        }
                        break;
                    //storytile
                    //clearstorytile
                    case "/unlockstory":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Moniter))
                            {
                                client.Player.SetStoryState(command[1].ToInt() - 1, false);
                                Messenger.PlayerMsg(client, "Chapter " + (command[1].ToInt()) + " has been unlocked!", Text.Yellow);
                            }
                        }
                        break;
                    case "/setstorystate":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Mapper))
                            {
                                client.Player.SetStoryState(command[1].ToInt() - 1, command[2].ToBool());
                                Messenger.PlayerMsg(client, "Chapter " + (command[1].ToInt()) + " has been set!", Text.Yellow);
                            }
                        }
                        break;
                    case "/resetstats":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Admin))
                            {
                                Client n = ClientManager.FindClient(joinedArgs);
                                if (n != null)
                                {
                                    n.Player.Team[0].AtkBonus = 0;
                                    n.Player.Team[0].DefBonus = 0;
                                    n.Player.Team[0].SpclAtkBonus = 0;
                                    n.Player.Team[0].SpclDefBonus = 0;
                                    n.Player.Team[0].SpdBonus = 0;
                                    Messenger.PlayerMsg(client, "Stats have been reset for " + n.Player.Name + "!", Text.Green);
                                    Messenger.PlayerMsg(n, "Your stats have been reset!", Text.Green);
                                }
                            }
                        }
                        break;
                    case "/recruitnum":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Admin))
                            {
                                Client n = ClientManager.FindClient(joinedArgs);
                                if (n != null)
                                {
                                    Messenger.PlayerMsg(client, n.Player.GetActiveRecruit().RecruitIndex.ToString(), Text.Green);
                                }
                            }
                        }
                        break;
                    case "/storytest":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Mapper))
                            {
                                Messenger.PlayerWarp(client, 500, 7, 9);
                                Messenger.PlayerMsg(client, "Welcome to the story test map!", Text.Yellow);
                            }
                        }
                        break;
                    case "/teststory":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Mapper))
                            {

                                client.Player.SetStoryState(joinedArgs.ToInt() - 1, false);

                                StoryManager.PlayStory(client, joinedArgs.ToInt() - 1);
                            }
                        }
                        break;
                    case "/teststorybreak":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Mapper))
                            {

                                Messenger.ForceEndStoryTo(client);
                                client.Player.MovementLocked = false;
                            }
                        }
                        break;

                    case "/findlockedstory":
                        {
                            // TODO: /findlockedstory [What's this do?]
                        }
                        break;
                    //muteadmin
                    case "/mute*":
                    case "/mute":
                        {
                            Client n;
                            string[] subCommand = command[0].Split('*');
                            if (subCommand.Length > 1)
                            {
                                n = ClientManager.FindClient(joinedArgs, true);
                            }
                            else
                            {
                                n = ClientManager.FindClient(joinedArgs);
                            }
                            if (Ranks.IsAllowed(client, Enums.Rank.Moniter) && n != null)
                            {
                                n.Player.Muted = true;
                                n.Player.Status = "MUTED";
                                Messenger.PlayerMsg(n, "You have been muted.", Text.Green);
                                Messenger.AdminMsg("[Staff] " + client.Player.Name + " has muted " + n.Player.Name + ".", Text.BrightBlue);
                                Server.Logging.ChatLogger.AppendToChatLog("Staff", "[Mute Issued] " + client.Player.Name + " muted " + n.Player.Name);

                                PlayerInfoReport(n);

                                Messenger.SendPlayerData(n);
                            }
                        }
                        break;
                    case "/permamute*":
                    case "/permamute":
                        {
                            try
                            {
                                if (Ranks.IsAllowed(client, Enums.Rank.Moniter))
                                {
                                    string playerName = command[1];
                                    string muteTimeDays = "-----";
                                    Client bannedClient;

                                    string[] subCommand = command[0].Split('*');

                                    if (subCommand.Length > 1)
                                    {
                                        bannedClient = ClientManager.FindClient(playerName, true);
                                    }
                                    else
                                    {
                                        bannedClient = ClientManager.FindClient(playerName);
                                    }

                                    if (command.CommandArgs.Count > 2 && command[2].IsNumeric())
                                    {
                                        muteTimeDays = DateTime.Now.AddDays(Convert.ToDouble(command[2])).ToString();
                                    }

                                    if (bannedClient != null)
                                    {
                                        bannedClient.Player.Muted = true;
                                        bannedClient.Player.Status = "MUTED";
                                        Messenger.PlayerMsg(bannedClient, "You have been permamuted.", Text.Green);
                                        Messenger.AdminMsg("[Staff] " + client.Player.Name + " has permamuted " + bannedClient.Player.Name + ".", Text.BrightBlue);
                                        Server.Logging.ChatLogger.AppendToChatLog("Staff", "[Permamute Issued] " + client.Player.Name + " muted " + bannedClient.Player.Name);
                                        PlayerInfoReport(bannedClient);
                                        Messenger.SendPlayerData(bannedClient);
                                        using (DatabaseConnection dbConnection = new DatabaseConnection(DatabaseID.Players))
                                        {
                                            Bans.BanPlayer(dbConnection, bannedClient.IP.ToString(), bannedClient.Player.CharID,
                                                bannedClient.Player.AccountName + "/" + bannedClient.Player.Name, bannedClient.MacAddress, bannedClient.BiosId,
                                                client.Player.CharID, client.IP.ToString(), muteTimeDays, Enums.BanType.Mute);
                                        }
                                    }
                                    else
                                    {
                                        using (DatabaseConnection dbConnection = new DatabaseConnection(DatabaseID.Players))
                                        {
                                            IDataColumn[] columns = dbConnection.Database.RetrieveRow("characteristics", "CharID", "Name=\"" + playerName + "\"");
                                            if (columns != null)
                                            {
                                                string charID = (string)columns[0].Value;
                                                string foundIP = (string)dbConnection.Database.RetrieveRow("character_statistics", "LastIPAddressUsed", "CharID=\"" + charID + "\"")[0].Value;
                                                string foundMac = (string)dbConnection.Database.RetrieveRow("character_statistics", "LastMacAddressUsed", "CharID=\"" + charID + "\"")[0].Value;
                                                string storedUUID = (string)dbConnection.Database.RetrieveRow("character_statistics", "StoredUUID", "CharID=\"" + charID + "\"")[0].Value;
                                                //get previous IP and mac
                                                Bans.BanPlayer(dbConnection, foundIP, charID, playerName, foundMac, storedUUID,
                                                    client.Player.CharID, client.IP.ToString(), muteTimeDays, Enums.BanType.Mute);
                                                Messenger.AdminMsg("[Staff] " + client.Player.Name + " has permamuted " + bannedClient.Player.Name + ".", Text.BrightBlue);
                                                Server.Logging.ChatLogger.AppendToChatLog("Staff", "[Permamute Issued] " + client.Player.Name + " muted " + bannedClient.Player.Name);
                                            }
                                            else
                                            {
                                                Messenger.PlayerMsg(client, "Unable to find player!", Text.BrightRed);
                                            }
                                        }
                                    }
                                }
                            }
                            catch (Exception ex)
                            {
                                Messenger.AdminMsg("Error: Permamute", Text.White);
                                Messenger.AdminMsg(ex.ToString(), Text.White);
                            }
                        }
                        break;
                    case "/unmute*":
                    case "/unmute":
                        {
                            Client n;
                            string[] subCommand = command[0].Split('*');
                            if (subCommand.Length > 1)
                            {
                                n = ClientManager.FindClient(joinedArgs, true);
                            }
                            else
                            {
                                n = ClientManager.FindClient(joinedArgs);
                            }
                            if (Ranks.IsAllowed(client, Enums.Rank.Moniter) && n != null)
                            {
                                n.Player.Muted = false;
                                n.Player.Status = "";
                                Messenger.PlayerMsg(n, "You have been unmuted.", Text.Green);
                                Messenger.AdminMsg("[Staff] " + client.Player.Name + " has unmuted " + n.Player.Name + ".", Text.BrightBlue);
                                Server.Logging.ChatLogger.AppendToChatLog("Staff", "[Unmute] " + client.Player.Name + " unmuted " + n.Player.Name);
                                Messenger.SendPlayerData(n);
                                using (DatabaseConnection dbConnection = new DatabaseConnection(DatabaseID.Players))
                                {
                                    Bans.RemoveBan(dbConnection, "BannedPlayerID", n.Player.CharID);
                                }
                            }
                        }
                        break;
                    case "/kill":
                        {
                            // TODO: /kill [Scripts]
                            Messenger.PlayerMsg(client, "That is (kinda) not a valid command!", Text.BrightRed);
                        }
                        break;
                    case "/jail":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Moniter))
                            {
                                if (command.CommandArgs.Count == 2)
                                {
                                    Client n = ClientManager.FindClient(joinedArgs);
                                    if (n != null)
                                    {
                                        if (n != client)
                                        {
                                            string mapID = n.Player.MapID;
                                            if (mapID == MapManager.GenerateMapID(666))
                                            {
                                                Messenger.PlayerMsg(client, "The player is already in jail!", Text.BrightRed);
                                            }
                                            else
                                            {
                                                Messenger.PlayerWarp(n, 666, 10, 12);
                                                Messenger.PlayerMsg(n, "You have been jailed! " + "Please wait for " + client.Player.Name + " or another online staff member to assess the situation.", Text.Yellow);
                                                Messenger.AdminMsg("[Staff] " + n.Player.Name + " has been sent to jail by " + client.Player.Name + "!", Text.BrightBlue);
                                                Server.Logging.ChatLogger.AppendToChatLog("Staff", "[Jail] " + client.Player.Name + " jailed " + n.Player.Name);
                                            }
                                        }
                                        else
                                        {
                                            Messenger.PlayerMsg(client, "You can't jail yourself!", Text.BrightRed);
                                        }
                                    }
                                    else
                                    {
                                        Messenger.PlayerMsg(client, "Player is offline.", Text.Grey);
                                    }
                                }
                            }
                        }
                        break;
                    case "/unjail":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Moniter))
                            {
                                if (command.CommandArgs.Count == 2)
                                {
                                    Client n = ClientManager.FindClient(joinedArgs);
                                    if (n != null)
                                    {
                                        if (n != client)
                                        {
                                            string mapID = n.Player.MapID;
                                            if (mapID != MapManager.GenerateMapID(666))
                                            {
                                                Messenger.PlayerMsg(client, "The player is not in jail!", Text.BrightRed);
                                            }
                                            else
                                            {
                                                Messenger.PlayerWarp(n, Crossroads, 25, 25);
                                                Messenger.PlayerMsg(n, "You have been unjailed by " + client.Player.Name + "!", Text.Yellow);
                                                Messenger.AdminMsg("[Staff] " + n.Player.Name + " has been freed from jail by " + client.Player.Name + "!", Text.BrightBlue);
                                                Server.Logging.ChatLogger.AppendToChatLog("Staff", "[Unjail] " + client.Player.Name + " unjailed " + n.Player.Name);
                                            }
                                        }
                                        else
                                        {
                                            Messenger.PlayerMsg(client, "You can't unjail yourself!", Text.BrightRed);
                                        }
                                    }
                                    else
                                    {
                                        Messenger.PlayerMsg(client, "Player is offline.", Text.Grey);
                                    }
                                }
                            }
                        }
                        break;
                    //warphere
                    case "/tostartall":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Moniter))
                            {
                                //if (command[1].IsNumeric()) {
                                List<Client> clientList = new List<Client>();

                                foreach (Client n in client.Player.Map.GetClients())
                                {
                                    clientList.Add(n);
                                }

                                foreach (Client n in clientList)
                                {
                                    Messenger.PlayerWarp(n, 1015, 25, 25);
                                    n.Player.Dead = false;
                                    PacketBuilder.AppendDead(n, hitlist);
                                    Messenger.PlayerMsg(n, "You have been warped to the crossroads by " + client.Player.Name + "!", Text.BrightGreen);
                                    Messenger.PlayerMsg(client, n.Player.Name + " has been warped to the crossroads!", Text.BrightGreen);
                                }

                                //} else {

                                //}

                            }
                        }
                        break;
                    case "/tostart*":
                    case "/tostart":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Moniter))
                            {
                                string playerName = joinedArgs;
                                Client n;
                                string[] subCommand = command[0].Split('*');
                                if (subCommand.Length > 1)
                                {
                                    n = ClientManager.FindClient(playerName, true);
                                }
                                else
                                {
                                    n = ClientManager.FindClient(playerName);
                                }
                                if (n != null)
                                {
                                    Messenger.PlayerWarp(n, 1015, 25, 25);
                                    n.Player.Dead = false;
                                    PacketBuilder.AppendDead(n, hitlist);
                                    Messenger.PlayerMsg(n, "You have been warped to the crossroads by " + client.Player.Name + "!", Text.BrightGreen);
                                    Messenger.PlayerMsg(client, n.Player.Name + " has been warped to the crossroads!", Text.BrightGreen);
                                    Server.Logging.ChatLogger.AppendToChatLog("Staff", "[Warp Event] " + client.Player.Name + " warped " + n.Player.Name + " to The Crossroads.");
                                }
                                else
                                {
                                    Messenger.PlayerMsg(client, "Player is offline.", Text.Grey);
                                }
                            }
                        }
                        break;
                    case "/world":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Moniter))
                            {
                                Messenger.PlayerWarp(client, 538, 10, 17);
                                Messenger.PlayerMsg(client, "Welcome to the World Map!", Text.BrightGreen);
                            }
                        }
                        break;
                    case "/warpto":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Mapper))
                            {
                                if (command[1].IsNumeric())
                                {

                                    Messenger.PlayerWarp(client, command[1].ToInt(), client.Player.X, client.Player.Y);
                                    Server.Logging.ChatLogger.AppendToChatLog("Staff", "[Warp Event] " + client.Player.Name + " warped to map " + command[1] + " - " + client.Player.Map.Name);
                                }
                                else
                                {
                                    // TODO: /warpto findmap method [Scripts]
                                    //findmap method

                                }
                            }
                        }
                        break;
                    case "/warpmeto*":
                    case "/warpmeto":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Moniter))
                            {
                                Client target;
                                string[] subCommand = command[0].Split('*');
                                if (subCommand.Length > 1)
                                {
                                    target = ClientManager.FindClient(joinedArgs, true);
                                }
                                else
                                {
                                    target = ClientManager.FindClient(joinedArgs);
                                }
                                if (target != null)
                                {
                                    Messenger.PlayerWarp(client, target.Player.GetCurrentMap(), target.Player.X, target.Player.Y);
                                    Server.Logging.ChatLogger.AppendToChatLog("Staff", "[Warp Event] " + client.Player.Name + " warped to " + target.Player.Name + " on map: " + target.Player.MapID + " - " + target.Player.Map.Name);
                                }
                                else
                                {
                                    Messenger.PlayerMsg(client, "Player could not be found.", Text.Green);
                                }
                            }
                        }
                        break;
                    case "/warptome*":
                    case "/warptome":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Moniter))
                            {
                                Client target;
                                string[] subCommand = command[0].Split('*');
                                if (subCommand.Length > 1)
                                {
                                    target = ClientManager.FindClient(joinedArgs, true);
                                }
                                else
                                {
                                    target = ClientManager.FindClient(joinedArgs);
                                }
                                if (target != null)
                                {
                                    Messenger.PlayerWarp(target, client.Player.GetCurrentMap(), client.Player.X, client.Player.Y);
                                    Server.Logging.ChatLogger.AppendToChatLog("Staff", "[Warp Event] " + client.Player.Name + " warped " + target.Player.Name + " to them on map:" + client.Player.MapID + " - " + client.Player.Map.Name);
                                }
                                else
                                {
                                    Messenger.PlayerMsg(client, "Player could not be found.", Text.Green);
                                }
                            }
                        }
                        break;
                    //masswarp
                    case "/help":
                        {
                            //...
                        }
                        break;
                    case "/viewemotes":
                        {
                            //will make the command when we make the emotes
                        }
                        break;
                    case "/map*":
                    case "/map":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Moniter))
                            {
                                string playerName = command[1];
                                Client n;
                                string[] subCommand = command[0].Split('*');
                                if (subCommand.Length > 1)
                                {
                                    n = ClientManager.FindClient(playerName, true);
                                }
                                else
                                {
                                    n = ClientManager.FindClient(playerName);
                                }

                                if (n != null)
                                {
                                    Messenger.PlayerMsg(client, n.Player.Name + " is at Map " + n.Player.MapID, Text.Green);
                                    Messenger.PlayerMsg(client, n.Player.Map.Name, Text.Green);
                                    Messenger.PlayerMsg(client, n.Player.X + ", " + n.Player.Y, Text.Green);
                                    Server.Logging.ChatLogger.AppendToChatLog("Staff", "[Info Request] " + client.Player.Name + " checked " + n.Player.Name + "'s map.");
                                }
                                else
                                {
                                    Messenger.PlayerMsg(client, playerName + " could not be found.", Text.Green);
                                }
                            }
                        }
                        break;
                    case "/tcpid":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Scripter))
                            {
                                string playerName = command[1];
                                Client n;
                                string[] subCommand = command[0].Split('*');
                                if (subCommand.Length > 1)
                                {
                                    n = ClientManager.FindClient(playerName, true);
                                }
                                else
                                {
                                    n = ClientManager.FindClient(playerName);
                                }

                                if (n != null)
                                {
                                    Messenger.PlayerMsg(client, n.TcpID.EndPoint.ToString(), Text.Yellow);
                                    Messenger.PlayerMsg(client, ClientManager.GetClient(n.TcpID).Player.Name, Text.Yellow);
                                }
                            }
                        }
                        break;
                    case "/playerin":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Moniter))
                            {
                                //if (command[1].IsNumeric()) {
                                //Messenger.PlayerMsg(client, "Players in this map :", Text.Yellow);
                                //foreach (MapPlayer playerOnMap in client.Player.Map.PlayersOnMap.GetPlayers()) {
                                //    Messenger.PlayerMsg(client, playerOnMap.PlayerID, Text.Yellow);
                                //}
                                int count = 0;
                                foreach (Client i in client.Player.Map.GetClients())
                                {
                                    count++;
                                    //Messenger.PlayerMsg(client, i.Player.Name, Text.Yellow);
                                }
                                Messenger.PlayerMsg(client, "Clients in this map: " + count, Text.Yellow);
                                //foreach (Client i in client.Player.Map.GetClients()) {
                                //Messenger.PlayerMsg(client, i.Player.Name, Text.Yellow);
                                //}

                                //} else {

                                //}

                            }
                        }
                        break;
                    case "/playerindungeon":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Moniter))
                            {
                                if (command[1].IsNumeric())
                                {
                                    foreach (Client i in ClientManager.GetClients())
                                    {
                                        if (i.IsPlaying() && i.Player.Map.MapType == Enums.MapType.RDungeonMap
                                            && ((RDungeonMap)i.Player.Map).RDungeonIndex == command[1].ToInt() - 1)
                                        {
                                            Messenger.PlayerMsg(client, i.Player.Name + " is on Floor " + (((RDungeonMap)i.Player.Map).RDungeonFloor + 1), Text.BrightCyan);
                                        }
                                    }
                                }
                                else
                                {

                                }
                            }
                        }
                        break;
                    case "/playerintc":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Moniter))
                            {

                                foreach (Client i in ClientManager.GetClients())
                                {
                                    if (i.IsPlaying() && i.Player.Map.MapType == Enums.MapType.RDungeonMap
                                        && ((RDungeonMap)i.Player.Map).RDungeonIndex >= 70 && ((RDungeonMap)i.Player.Map).RDungeonIndex <= 86)
                                    {
                                        Messenger.PlayerMsg(client, i.Player.Name + " is on #" + (((RDungeonMap)i.Player.Map).RDungeonIndex + 1), Text.BrightCyan);
                                        Messenger.PlayerMsg(client, "-Floor " + (((RDungeonMap)i.Player.Map).RDungeonFloor + 1), Text.Yellow);
                                    }
                                }

                            }
                        }
                        break;
                    case "/playerindungeons":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Moniter))
                            {
                                int total = 0;
                                foreach (Client i in ClientManager.GetClients())
                                {
                                    if (i.IsPlaying() && i.Player.Map.Moral == Enums.MapMoral.None)
                                    {

                                        Messenger.PlayerMsg(client, i.Player.Name + " is at " + i.Player.Map.Name, Text.BrightCyan);
                                        total++;
                                    }
                                }
                                Messenger.PlayerMsg(client, "Total: " + total, Text.BrightCyan);

                            }
                        }
                        break;
                    case "/hp":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Moniter))
                            {
                                Client n = ClientManager.FindClient(joinedArgs);
                                if (n != null)
                                {
                                    Messenger.PlayerMsg(client, n.Player.Name + "'s HP: " + n.Player.GetActiveRecruit().HP.ToString(), Text.Yellow);
                                }
                                else
                                {
                                    Messenger.PlayerMsg(client, "Player is offline", Text.Grey);
                                }
                            }
                        }
                        break;
                    case "/playerid":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Moniter))
                            {

                                Client n = ClientManager.FindClient(joinedArgs);
                                if (n != null)
                                {
                                    Messenger.PlayerMsg(client, n.Player.Name + "'s ID: " + n.Player.CharID, Text.Yellow);
                                }
                            }
                        }
                        break;
                    case "/forceswap":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Moniter))
                            {

                                Client n = ClientManager.FindClient(command[1]);
                                if (n != null)
                                {
                                    int slot = 0;
                                    //for (int i = 0; i < Constants.MAX_ACTIVETEAM; i++) {
                                    if (n.Player.Team[command[2].ToInt()] != null && n.Player.Team[command[2].ToInt()].Loaded)
                                    {
                                        slot = command[2].ToInt();
                                    }
                                    //}
                                    n.Player.SwapActiveRecruit(slot);
                                }
                                else
                                {
                                    Messenger.PlayerMsg(client, "Player is offline", Text.Grey);
                                }
                            }
                        }
                        break;
                    case "/info*":
                    case "/info":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Moniter))
                            {
                                Client n;
                                string[] subCommand = command[0].Split('*');
                                if (subCommand.Length > 1)
                                {
                                    n = ClientManager.FindClient(joinedArgs, true);
                                }
                                else
                                {
                                    n = ClientManager.FindClient(joinedArgs);
                                }

                                if (n != null)
                                {
                                    Messenger.PlayerMsg(client, "Account: " + n.Player.AccountName + ", Name: " + n.Player.Name, Text.Yellow);
                                    for (int i = 0; i < Constants.MAX_ACTIVETEAM; i++)
                                    {
                                        if (n.Player.Team[i] != null && n.Player.Team[i].Loaded)
                                        {
                                            Messenger.PlayerMsg(client, "Team #" + i + ": " + Pokedex.GetPokemon(n.Player.Team[i].Species).Name + " Lv." + n.Player.Team[i].Level, Text.Yellow);
                                            Messenger.PlayerMsg(client, "HP: " + n.Player.Team[i].HP + "/" + n.Player.Team[i].MaxHP, Text.Yellow);
                                            Messenger.PlayerMsg(client, "Exp: " + n.Player.Team[i].Exp + "/" + n.Player.Team[i].GetNextLevel(), Text.Yellow);
                                            Messenger.PlayerMsg(client, "Atk/Sp.Atk: " + n.Player.Team[i].Atk + "/" + n.Player.Team[i].SpclAtk, Text.Yellow);
                                            Messenger.PlayerMsg(client, "Def/Sp.Def: " + n.Player.Team[i].Def + "/" + n.Player.Team[i].SpclDef, Text.Yellow);
                                            Messenger.PlayerMsg(client, "Speed: " + n.Player.Team[i].Spd, Text.Yellow);
                                        }
                                    }
                                    Server.Logging.ChatLogger.AppendToChatLog("Staff", "[Info Request] " + client.Player.Name + " checked " + n.Player.Name + "'s team information.");
                                }
                                else
                                {
                                    Messenger.PlayerMsg(client, "Player is offline", Text.Grey);
                                }
                            }
                        }
                        break;
                    case "/statusinfo":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Moniter))
                            {

                                Client n = ClientManager.FindClient(joinedArgs);
                                if (n != null)
                                {

                                    for (int i = 0; i < Constants.MAX_ACTIVETEAM; i++)
                                    {
                                        if (n.Player.Team[i] != null && n.Player.Team[i].Loaded)
                                        {
                                            Messenger.PlayerMsg(client, "Team #" + i + ": " + Pokedex.GetPokemon(n.Player.Team[i].Species).Name + "/" + n.Player.Team[i].StatusAilment, Text.Yellow);
                                            for (int j = 0; j < n.Player.Team[i].VolatileStatus.Count; j++)
                                            {
                                                Messenger.PlayerMsg(client, n.Player.Team[i].VolatileStatus[j].Name +
                                                    "/" + n.Player.Team[i].VolatileStatus[j].Counter + "/" + n.Player.Team[i].VolatileStatus[j].Tag, Text.Yellow);
                                            }
                                        }
                                    }
                                }
                                else
                                {
                                    Messenger.PlayerMsg(client, "Player is offline", Text.Grey);
                                }
                            }
                        }
                        break;
                    case "/getip*":
                    case "/getip":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Moniter))
                            {

                                string playerName = command[1];
                                Client n;
                                string[] subCommand = command[0].Split('*');
                                if (subCommand.Length > 1)
                                {
                                    n = ClientManager.FindClient(playerName, true);
                                }
                                else
                                {
                                    n = ClientManager.FindClient(playerName);
                                }

                                if (n != null)
                                {
                                    if (Ranks.IsAllowed(n, Enums.Rank.ServerHost))
                                    {
                                        Messenger.PlayerMsg(client, n.Player.Name + "'s IP: 46.4.166.141", Text.Yellow);
                                    }
                                    else
                                    {
                                        Messenger.PlayerMsg(client, n.Player.Name + "'s IP: " + n.IP.ToString(), Text.Yellow);
                                    }
                                    Messenger.PlayerMsg(client, n.Player.Name + "'s MAC: " + n.MacAddress, Text.Yellow);
                                    Server.Logging.ChatLogger.AppendToChatLog("Staff", "[Info Request] " + client.Player.Name + " checked " + n.Player.Name + "'s IP/MAC.");

                                }
                                else
                                {
                                    Messenger.PlayerMsg(client, "Player is offline", Text.Grey);
                                }
                            }
                        }
                        break;
                    case "/findip":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Moniter))
                            {
                                Messenger.PlayerMsg(client, "Searching for players with the IP: \"" + joinedArgs + "\"", Text.BrightBlue);
                                foreach (Client n in ClientManager.GetClients())
                                {
                                    if (n.IsPlaying())
                                    {
                                        if (n.IP.ToString().StartsWith(joinedArgs))
                                        {
                                            Messenger.PlayerMsg(client, n.Player.AccountName + "/" + n.Player.Name + ": " + n.IP.ToString(), Text.BrightGreen);
                                        }
                                    }
                                }
                            }
                        }
                        break;
                    //getindex; no indexes
                    //poke, hug, praise, yawn, wave
                    case "/praise":
                        {
                            if (client.Player.Muted == false)
                            {
                                Messenger.MapMsg(client.Player.MapID, client.Player.Name + " gave praise to " + joinedArgs + "!", Text.Green);
                            }
                            else
                            {
                                Messenger.PlayerMsg(client, "You have been muted!", Text.BrightRed);
                            }
                        }
                        break;
                    case "/hug":
                        {
                            if (client.Player.Muted == false)
                            {
                                if (command.CommandArgs.Count >= 2)
                                {
                                    Messenger.MapMsg(client.Player.MapID, client.Player.Name + " has hugged " + command[1] + "!", Text.White);
                                }
                                else
                                {
                                    Messenger.PlayerMsg(client, "You have to pick somebody to hug!", Text.BrightRed);
                                }
                            }
                            else
                            {
                                Messenger.PlayerMsg(client, "You have been muted!", Text.BrightRed);
                            }
                        }
                        break;

                    case "/notepad":
                        {
                            if (client.Player.Muted == false)
                            {
                                if (command.CommandArgs.Count >= 2)
                                {
                                    if (command[1].ToLower() != "artmax")
                                    {
                                        Messenger.MapMsg(client.Player.MapID, client.Player.Name + " threw a notepad at " + command[1] + "!", Text.Yellow);
                                    }
                                    else
                                    {
                                        Messenger.MapMsg(client.Player.MapID, client.Player.Name + " threw a notepad at " + command[1] + " (nuclear strike!)", Text.Yellow);
                                    }
                                }
                                else
                                {
                                    Messenger.PlayerMsg(client, "You have to pick somebody to throw a notepad at!", Text.BrightRed);
                                }
                            }
                            else
                            {
                                Messenger.PlayerMsg(client, "You have been muted!", Text.BrightRed);
                            }
                        }
                        break;
                    case "/time":
                        {
                            Messenger.PlayerMsg(client, "It is currently: " + Server.Globals.ServerTime, Text.BrightGreen);
                        }
                        break;

                    case "/me":
                        {
                            if (client.Player.Muted == false)
                            {
                                if (command.CommandArgs.Count >= 2)
                                {
                                    Messenger.MapMsg(client.Player.MapID, client.Player.Name + " " + joinedArgs, Text.BrightBlue);
                                }
                                else
                                {
                                    Messenger.PlayerMsg(client, "You have to include something to say besides your name!", Text.BrightRed);
                                }
                            }
                            else
                            {
                                Messenger.PlayerMsg(client, "You have been muted!", Text.BrightRed);
                            }
                        }
                        break;

                    case "/poke":
                        {
                            if (client.Player.Muted == false)
                            {
                                if (command.CommandArgs.Count >= 2)
                                {
                                    Messenger.MapMsg(client.Player.MapID, client.Player.Name + " poked " + command[1] + ".", Text.Yellow);
                                }
                                else
                                {
                                    Messenger.PlayerMsg(client, "You have to pick somebody to poke!", Text.BrightRed);
                                }
                            }
                            else
                            {
                                Messenger.PlayerMsg(client, "You have been muted!", Text.BrightRed);
                            }
                        }
                        break;
                    case "/yawn":
                        {
                            if (client.Player.Muted == false)
                            {
                                Messenger.MapMsg(client.Player.MapID, client.Player.Name + " let out a loud yawn " + joinedArgs + "~", Text.BrightBlue);
                            }
                            else
                            {
                                Messenger.PlayerMsg(client, "You have been muted!", Text.BrightRed);
                            }
                        }
                        break;
                    case "/wave":
                        {
                            if (client.Player.Muted == false)
                            {
                                Messenger.MapMsg(client.Player.MapID, client.Player.Name + " waved at " + joinedArgs + ".", Text.BrightGreen);
                            }
                            else
                            {
                                Messenger.PlayerMsg(client, "You have been muted!", Text.BrightRed);
                            }
                        }
                        break;
                    case "/away":
                        {
                            if (client.Player.Muted == true)
                            {
                                Messenger.PlayerMsg(client, "You have been muted!", Text.BrightRed);
                            }
                            else if (client.Player.MapID == "s791" || client.Player.MapID == "s792")
                            {
                                Messenger.PlayerMsg(client, "You cannot be away while playing Capture The Flag!", Text.BrightRed);
                            }
                            else if (client.Player.Status.ToLower() == "away")
                            {
                                client.Player.Status = "";
                                Messenger.GlobalMsg(client.Player.Name + " has returned from being away.", Text.Yellow);
                                Messenger.SendPlayerData(client);
                            }
                            else
                            {
                                client.Player.Status = "Away";
                                Messenger.GlobalMsg(client.Player.Name + " is now away.", Text.Yellow);
                                Messenger.SendPlayerData(client);
                            }
                        }
                        break;
                    case "/wb*":
                    case "/wb":
                        {
                            if (client.Player.Muted == false)
                            {
                                if (command.CommandArgs.Count >= 2)
                                {
                                    Client n;
                                    string[] subCommand = command[0].Split('*');
                                    if (subCommand.Length > 1)
                                    {
                                        n = ClientManager.FindClient(joinedArgs, true);
                                    }
                                    else
                                    {
                                        n = ClientManager.FindClient(joinedArgs);
                                    }
                                    if (n != null)
                                    {
                                        Messenger.MapMsg(client.Player.MapID, client.Player.Name + " welcomes " + n.Player.Name + " back to " + Settings.GameNameShort + "!", Text.White);
                                    }
                                    else if (n == null)
                                    {
                                        Messenger.PlayerMsg(client, "Player is offline.", Text.Grey);
                                    }
                                }
                                else
                                {
                                    Messenger.PlayerMsg(client, "Pick someone to welcome back.", Text.Black);
                                }
                            }
                            else
                            {
                                Messenger.PlayerMsg(client, "You have been muted!", Text.BrightRed);
                            }
                        }
                        break;
                    case "/pichu!":
                        {
                            if (client.Player.Muted == false)
                            {
                                if (client.Player.GetActiveRecruit().Species == 172)
                                {
                                    Messenger.PlaySoundToMap(client.Player.MapID, "Pichu!.wav");
                                }
                            }
                        }
                        break;
                    case "/muwaha":
                        {
                            if (client.Player.Muted == false)
                            {
                                Messenger.PlaySoundToMap(client.Player.MapID, "magic1268.wav");
                            }
                        }
                        break;
                    case "/status":
                        {
                            if (client.Player.Muted == true)
                            {
                                Messenger.PlayerMsg(client, "You have been muted!", Text.BrightRed);
                            }
                            else if (exPlayer.Get(client).InCTF == false && exPlayer.Get(client).InSnowballGame == false
                                       && joinedArgs != "MUTED")
                            {
                                if (!string.IsNullOrEmpty(joinedArgs))
                                {
                                    string status = joinedArgs;
                                    if (joinedArgs.Length > 10)
                                    {
                                        status = joinedArgs.Substring(0, 10);
                                    }
                                    client.Player.Status = status;
                                    Messenger.SendPlayerData(client);
                                }
                                else
                                {
                                    client.Player.Status = "";
                                    Messenger.SendPlayerData(client);
                                }
                            }
                        }
                        break;
                    case "/giveup":
                        {
                            GiveUp(client);
                        }
                        break;
                    case "/watch":
                        {
                            if (client.Player.MapID == MapManager.GenerateMapID(660) || client.Player.MapID == MapManager.GenerateMapID(1718))
                            {
                                TcpPacket packet = new TcpPacket("focusonpoint");
                                packet.AppendParameters(15, 15);
                                Messenger.SendDataTo(client, packet);
                                client.Player.MovementLocked = true;
                            }
                        }
                        break;

                    case "/stopwatch":
                        {
                            if (client.Player.MapID == MapManager.GenerateMapID(660) || client.Player.MapID == MapManager.GenerateMapID(1718))
                            {
                                TcpPacket packet = new TcpPacket("focusonpoint");
                                packet.AppendParameters(-1, -1);
                                Messenger.SendDataTo(client, packet);
                                client.Player.MovementLocked = false;
                            }
                        }
                        break;
                    case "/sethouse":
                        {
                            if (exPlayer.Get(client).IsValidPlayerSpawn(client.Player.MapID) == true
                                && client.Player.Map.Tile[client.Player.X, client.Player.Y].Type != Enums.TileType.Blocked)
                            {
                                exPlayer.Get(client).SpawnMap = client.Player.MapID;
                                exPlayer.Get(client).SpawnX = client.Player.X;
                                exPlayer.Get(client).SpawnY = client.Player.Y;
                                Messenger.PlayerMsg(client, "Spawn point saved!", Text.Yellow);
                            }
                            else
                            {
                                Messenger.PlayerMsg(client, "This is not a valid spawn point!", Text.BrightRed);
                            }
                        }
                        break;
                    case "/rstart":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Moniter))
                            {
                                if (command[1].IsNumeric())
                                {
                                    int floor = 1;
                                    if (command.CommandArgs.Count > 2 && command[2].IsNumeric())
                                    {
                                        floor = command[2].ToInt();
                                    }
                                    //RDungeonManager.LoadRDungeon(command[1].ToInt() - 1);
                                    client.Player.WarpToRDungeon(command[1].ToInt() - 1, floor - 1);
                                    Server.Logging.ChatLogger.AppendToChatLog("Staff", "[RDungeon Warp] " + client.Player.Name + " warped to " + RDungeonManager.RDungeons[command[1].ToInt() - 1].DungeonName + ", Floor: " + floor);

                                }
                            }
                        }
                        break;

                    case "/findstory":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Moniter))
                            {
                                int storiesFound = 0;
                                if (String.IsNullOrEmpty(joinedArgs))
                                {
                                    Messenger.PlayerMsg(client, "This is not the story you are looking for. (Because you didn't specify anything!)", Text.Yellow);
                                }
                                else
                                {
                                    for (int i = 0; i < Server.Stories.StoryManagerBase.Stories.MaxStories; i++)
                                    {
                                        if (StoryManagerBase.Stories[i].Name.ToLower().Contains(joinedArgs.ToLower()))
                                        {
                                            Messenger.PlayerMsg(client, StoryManagerBase.Stories[i].Name + "'s number is " + i.ToString(), Text.Yellow);
                                            storiesFound++;
                                            //return;
                                        }
                                    }
                                    if (storiesFound == 0)
                                    {
                                        Messenger.PlayerMsg(client, "Unable to find a story that starts with '" + joinedArgs + "'", Text.Yellow);
                                    }
                                }
                            }

                        }
                        break;
                    case "/nextfloor":
                        {
                            try
                            {
                                if (Ranks.IsAllowed(client, Enums.Rank.Moniter))
                                {
                                    if (client.Player.Map.MapType == Enums.MapType.RDungeonMap && ((RDungeonMap)client.Player.Map).RDungeonIndex > -1)
                                    {
                                        client.Player.WarpToRDungeon(((RDungeonMap)client.Player.Map).RDungeonIndex, ((RDungeonMap)client.Player.Map).RDungeonFloor + 1);
                                    }

                                }
                            }
                            catch (Exception ex)
                            {
                                Messenger.AdminMsg("nextfloor error", Text.Pink);
                                Messenger.AdminMsg(ex.ToString(), Text.Pink);
                            }
                        }
                        break;
                    case "/confuse":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Scripter))
                            {
                                AddExtraStatus(client.Player.GetActiveRecruit(), client.Player.Map, "Confusion", 5, null, "", hitlist);
                                //Confuse(client.Player.GetActiveRecruit(), client.Player.Map, 5, null);
                            }
                        }
                        break;
                    case "/hittime":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Scripter))
                            {
                                client.Player.GetActiveRecruit().TimeMultiplier = 500;
                                PacketBuilder.AppendTimeMultiplier(client, hitlist);
                            }
                        }
                        break;
                    case "/visible":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Scripter))
                            {
                                PacketBuilder.AppendVisibility(client, hitlist, false);
                            }
                        }
                        break;
                    case "/infoexp":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Admin))
                            {
                                Messenger.PlayerMsg(client, client.Player.ExplorerRank.ToString(), Text.BrightRed);
                            }
                        }
                        break;
                    case "/testexp":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Admin))
                            {
                                client.Player.MissionExp += command[1].ToInt();
                                MissionManager.ExplorerRankUp(client);
                            }
                        }
                        break;
                    case "/fixrank":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Moniter))
                            {
                                Client n = ClientManager.FindClient(joinedArgs);
                                if (n != null)
                                {
                                    n.Player.ExplorerRank = Enums.ExplorerRank.Normal;
                                    MissionManager.ExplorerRankUp(n);
                                    Messenger.PlayerMsg(client, n.Player.Name + "'s rank is fixed now!", Text.Yellow);
                                }
                                else
                                {
                                    Messenger.PlayerMsg(client, "Player is offline", Text.Grey);
                                }
                            }
                        }
                        break;
                    case "/;":
                        {
                            if (client.Player.Muted)
                            {
                                Messenger.PlayerMsg(client, "You are muted!", Text.BrightRed);
                                return;
                            }
                            hitlist.AddPacketToMap(client.Player.Map, PacketBuilder.CreateSoundPacket("Magic675.wav"), client.Player.X, client.Player.Y, 10);
                            PacketBuilder.AppendEmote(client, 9, 1, 2, hitlist);
                        }
                        break;
                    case "/'":
                        {
                            if (client.Player.Muted)
                            {
                                Messenger.PlayerMsg(client, "You are muted!", Text.BrightRed);
                                return;
                            }
                            hitlist.AddPacketToMap(client.Player.Map, PacketBuilder.CreateSoundPacket("Magic664.wav"), client.Player.X, client.Player.Y, 10);
                            PacketBuilder.AppendEmote(client, 6, 2, 1, hitlist);
                        }
                        break;
                    case "/*":
                        {
                            if (client.Player.Muted)
                            {
                                Messenger.PlayerMsg(client, "You are muted!", Text.BrightRed);
                                return;
                            }
                            hitlist.AddPacketToMap(client.Player.Map, PacketBuilder.CreateSoundPacket("Magic678.wav"), client.Player.X, client.Player.Y, 10);
                            PacketBuilder.AppendEmote(client, 5, 2, 1, hitlist);
                        }
                        break;
                    case "/)":
                        {
                            if (client.Player.Muted)
                            {
                                Messenger.PlayerMsg(client, "You are muted!", Text.BrightRed);
                                return;
                            }
                            PacketBuilder.AppendEmote(client, 7, 2, 1, hitlist);
                        }
                        break;
                    case "/))":
                        {
                            if (client.Player.Muted)
                            {
                                Messenger.PlayerMsg(client, "You are muted!", Text.BrightRed);
                                return;
                            }
                            hitlist.AddPacketToMap(client.Player.Map, PacketBuilder.CreateSoundPacket("Magic721.wav"), client.Player.X, client.Player.Y, 10);
                            PacketBuilder.AppendEmote(client, 7, 2, 7, hitlist);
                        }
                        break;
                    case "/)))":
                        {
                            if (client.Player.Muted)
                            {
                                Messenger.PlayerMsg(client, "You are muted!", Text.BrightRed);
                                return;
                            }
                            hitlist.AddPacketToMap(client.Player.Map, PacketBuilder.CreateSoundPacket("Magic657.wav"), client.Player.X, client.Player.Y, 10);
                            PacketBuilder.AppendEmote(client, 7, 2, 8, hitlist);
                        }
                        break;
                    case "/.":
                        {
                            if (client.Player.Muted)
                            {
                                Messenger.PlayerMsg(client, "You are muted!", Text.BrightRed);
                                return;
                            }
                            hitlist.AddPacketToMap(client.Player.Map, PacketBuilder.CreateSoundPacket("Magic700.wav"), client.Player.X, client.Player.Y, 10);
                            PacketBuilder.AppendEmote(client, 12, 2, 1, hitlist);
                        }
                        break;
                    case "/..":
                        {
                            if (client.Player.Muted)
                            {
                                Messenger.PlayerMsg(client, "You are muted!", Text.BrightRed);
                                return;
                            }
                            hitlist.AddPacketToMap(client.Player.Map, PacketBuilder.CreateSoundPacket("Magic700.wav"), client.Player.X, client.Player.Y, 10);
                            PacketBuilder.AppendEmote(client, 12, 2, 2, hitlist);
                        }
                        break;
                    case "/...":
                        {
                            if (client.Player.Muted)
                            {
                                Messenger.PlayerMsg(client, "You are muted!", Text.BrightRed);
                                return;
                            }
                            hitlist.AddPacketToMap(client.Player.Map, PacketBuilder.CreateSoundPacket("Magic700.wav"), client.Player.X, client.Player.Y, 10);
                            PacketBuilder.AppendEmote(client, 12, 2, 3, hitlist);
                        }
                        break;
                    case "/!":
                        {
                            if (client.Player.Muted)
                            {
                                Messenger.PlayerMsg(client, "You are muted!", Text.BrightRed);
                                return;
                            }
                            hitlist.AddPacketToMap(client.Player.Map, PacketBuilder.CreateSoundPacket("Magic667.wav"), client.Player.X, client.Player.Y, 10);
                            PacketBuilder.AppendEmote(client, 13, 2, 1, hitlist);
                        }
                        break;
                    case "/?":
                        {
                            if (client.Player.Muted)
                            {
                                Messenger.PlayerMsg(client, "You are muted!", Text.BrightRed);
                                return;
                            }
                            hitlist.AddPacketToMap(client.Player.Map, PacketBuilder.CreateSoundPacket("Magic665.wav"), client.Player.X, client.Player.Y, 10);
                            PacketBuilder.AppendEmote(client, 8, 2, 1, hitlist);
                        }
                        break;
                    case "/!?":
                        {
                            if (client.Player.Muted)
                            {
                                Messenger.PlayerMsg(client, "You are muted!", Text.BrightRed);
                                return;
                            }
                            hitlist.AddPacketToMap(client.Player.Map, PacketBuilder.CreateSoundPacket("Magic671.wav"), client.Player.X, client.Player.Y, 10);
                            PacketBuilder.AppendEmote(client, 11, 2, 1, hitlist);
                        }
                        break;
                    case "/+":
                        {
                            if (client.Player.Muted)
                            {
                                Messenger.PlayerMsg(client, "You are muted!", Text.BrightRed);
                                return;
                            }
                            hitlist.AddPacketToMap(client.Player.Map, PacketBuilder.CreateSoundPacket("Magic674.wav"), client.Player.X, client.Player.Y, 10);
                            PacketBuilder.AppendEmote(client, 10, 2, 1, hitlist);
                        }
                        break;
                    case "/testailment":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Moniter))
                            {
                                if (command[1].IsNumeric() && command[1].ToInt() >= 0 && command[1].ToInt() < 6)
                                {

                                    SetStatusAilment(client.Player.GetActiveRecruit(), client.Player.Map, (Enums.StatusAilment)(command[1].ToInt()), 1, null);
                                    //    for (int i = 0; i < Constants.MAX_MAP_NPCS; i++)
                                    //    {
                                    //        if (client.Player.Map.ActiveNpc[i].Num > 0)
                                    //        {
                                    //            client.Player.Map.ActiveNpc[i].ChangeStatusAilment((Enums.StatusAilment)(command[1].ToInt()), 1);
                                    //        }
                                    //    }
                                }
                            }
                        }
                        break;
                    case "/addvstatus":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Moniter))
                            {
                                if (command[1].IsNumeric())
                                {
                                    ExtraStatus status = new ExtraStatus();
                                    status.Name = client.Player.GetActiveRecruit().VolatileStatus.Count.ToString();
                                    status.Emoticon = command[1].ToInt();
                                    client.Player.GetActiveRecruit().VolatileStatus.Add(status);
                                    PacketBuilder.AppendVolatileStatus(client, hitlist);

                                    IMap clientMap = client.Player.Map;
                                    for (int i = 0; i < Constants.MAX_MAP_NPCS; i++)
                                    {
                                        if (clientMap.ActiveNpc[i].Num > 0)
                                        {
                                            clientMap.ActiveNpc[i].VolatileStatus.Add(status);
                                            PacketBuilder.AppendNpcVolatileStatus(MapManager.RetrieveActiveMap(clientMap.ActiveNpc[i].MapID), hitlist, i);
                                        }
                                    }
                                }
                            }
                        }
                        break;
                    case "/removevstatus":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Moniter))
                            {
                                client.Player.GetActiveRecruit().VolatileStatus.Clear();
                                PacketBuilder.AppendVolatileStatus(client, hitlist);

                                IMap clientMap = client.Player.Map;
                                for (int i = 0; i < Constants.MAX_MAP_NPCS; i++)
                                {
                                    if (clientMap.ActiveNpc[i].Num > 0)
                                    {
                                        clientMap.ActiveNpc[i].VolatileStatus.Clear();
                                        PacketBuilder.AppendNpcVolatileStatus(MapManager.RetrieveActiveMap(clientMap.ActiveNpc[i].MapID), hitlist, i);
                                    }
                                }
                            }
                        }
                        break;
                    /*case "/diagonal": {
                            if (Ranks.IsAllowed(client, Enums.Rank.Moniter)) {
                                IMap clientMap = client.Player.Map;
                                for (int i = 0; i < Constants.MAX_MAP_NPCS; i++) {
                                    if (clientMap.ActiveNpc[i].Num > 0) {
                                        clientMap.ActiveNpc[i].X += 3;
                                        clientMap.ActiveNpc[i].Y += 3;
                                        PacketBuilder.AppendNpcXY(MapManager.RetrieveActiveMap(clientMap.ActiveNpc[i].MapID), hitlist, i);
                                    }
                                }
                            }
                        }
                        break;*/
                    case "/checkailment":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Moniter))
                            {
                                Messenger.PlayerMsg(client, client.Player.GetActiveRecruit().StatusAilment.ToString() + client.Player.GetActiveRecruit().StatusAilmentCounter.ToString(), Text.BrightRed);
                            }
                        }
                        break;
                    case "/checkdungeons":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Moniter))
                            {
                                Client n = ClientManager.FindClient(joinedArgs);
                                if (n != null)
                                {
                                    Messenger.PlayerMsg(client, n.Player.Name + "'s completed dungeons:", Text.Yellow);
                                    for (int i = 0; i < Server.Dungeons.DungeonManager.Dungeons.Count; i++)
                                    {
                                        Messenger.PlayerMsg(client, Server.Dungeons.DungeonManager.Dungeons[i].Name + ": " + n.Player.GetDungeonCompletionCount(i), Text.Yellow);
                                    }
                                }
                                else
                                {
                                    Messenger.PlayerMsg(client, "Player is offline", Text.Grey);
                                }
                            }
                        }
                        break;
                    case "/testegg":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Admin))
                            {

                            }
                        }
                        break;
                    case "/speedlimit":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Scripter))
                            {
                                if (command[1].IsNumeric() && command[1].ToInt() >= 0 && command[1].ToInt() < 7)
                                {

                                    client.Player.GetActiveRecruit().SpeedLimit = (Enums.Speed)(command[1].ToInt());
                                    PacketBuilder.AppendSpeedLimit(client, hitlist);
                                }
                            }
                        }
                        break;
                    case "/testdeath":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Scripter))
                            {
                                client.Player.Hunted = false;
                                PacketBuilder.AppendHunted(client, hitlist);
                                client.Player.Dead = true;
                                PacketBuilder.AppendDead(client, hitlist);

                                AskAfterDeathQuestion(client);
                            }
                        }
                        break;
                    case "/mobile":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Admin))
                            {
                                if (command[1].IsNumeric())
                                {
                                    client.Player.GetActiveRecruit().Mobility[command[1].ToInt()] = true;
                                    PacketBuilder.AppendMobility(client, hitlist);
                                }
                            }
                        }
                        break;
                    case "/immobile":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Admin))
                            {
                                if (command[1].IsNumeric())
                                {
                                    client.Player.GetActiveRecruit().Mobility[command[1].ToInt()] = false;
                                    PacketBuilder.AppendMobility(client, hitlist);
                                }
                            }
                        }
                        break;
                    case "/createparty":
                        {
                            PartyManager.CreateNewParty(client);
                        }
                        break;
                    case "/joinparty":
                        {
                            if (client.Player.PartyID == null)
                            {
                                Party party = PartyManager.FindPlayerParty(ClientManager.FindClient(joinedArgs));
                                PartyManager.JoinParty(party, client);
                            }
                            else
                            {
                                Messenger.PlayerMsg(client, "You are already in a party!", Text.BrightRed);
                            }
                        }
                        break;
                    case "/leaveparty":
                        {
                            if (client.Player.PartyID != null)
                            {
                                if (client.Player.Map.Moral == Enums.MapMoral.None)
                                {
                                    Messenger.PlayerMsg(client, "You can't leave the party here!", Text.BrightRed);
                                }
                                else
                                {
                                    Party party = PartyManager.FindPlayerParty(client);
                                    PartyManager.RemoveFromParty(party, client);
                                }
                            }
                            else
                            {
                                Messenger.PlayerMsg(client, "You are not in a party!", Text.BrightRed);
                            }
                        }
                        break;
                    case "/myparty":
                        {
                            if (client.Player.PartyID != null)
                            {
                                Party party = PartyManager.FindPlayerParty(client);
                                Messenger.PlayerMsg(client, "Players in your party:", Text.Black);
                                foreach (Client i in party.GetOnlineMemberClients())
                                {
                                    Messenger.PlayerMsg(client, i.Player.Name, Text.White);
                                }
                            }
                            else
                            {
                                Messenger.PlayerMsg(client, "You are not in a party!", Text.BrightRed);
                            }
                        }
                        break;
                    case "/kickparty":
                        {
                            try
                            {
                                if (client.Player.PartyID != null)
                                {
                                    Client targetPlayer = ClientManager.FindClient(command[1]);
                                    if (targetPlayer.Player.PartyID == client.Player.PartyID)
                                    {

                                        Party party = PartyManager.FindPlayerParty(client);
                                        if (party.GetLeader() == client)
                                        {
                                            Client n = ClientManager.FindClient(joinedArgs);
                                            if (n != null)
                                            {
                                                if (n.Player.Map.Moral == Enums.MapMoral.None)
                                                {
                                                    Messenger.PlayerMsg(client, "The party member can't be kicked there!", Text.BrightRed);
                                                }
                                                else
                                                {
                                                    PartyManager.RemoveFromParty(party, n);
                                                }
                                            }
                                            else
                                            {
                                                Messenger.PlayerMsg(client, "Unable to find player.", Text.BrightRed);
                                            }
                                        }
                                        else
                                        {
                                            Messenger.PlayerMsg(client, "You are not the party leader!", Text.BrightRed);
                                        }
                                    }
                                    else
                                    {
                                        Messenger.PlayerMsg(client, "Player is not in your party!", Text.BrightRed);
                                    }
                                }
                                else
                                {
                                    Messenger.PlayerMsg(client, "You are not in a party!", Text.BrightRed);
                                }
                            }
                            catch (Exception ex)
                            {
                                Messenger.AdminMsg(ex.ToString(), Text.White);
                            }
                        }
                        break;
                    case "/moduleswitch":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Scripter))
                            {
                                client.Player.SetActiveExpKitModule(Enums.ExpKitModules.Counter);
                            }
                        }
                        break;
                    case "/sticky":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Admin))
                            {
                                if (command[1].IsNumeric())
                                {
                                    client.Player.SetItemSticky(command[1].ToInt(), true);
                                }
                            }
                        }
                        break;
                    case "/thticky":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Admin))
                            {
                                if (command[1].IsNumeric())
                                {
                                    client.Player.SetItemSticky(command[1].ToInt(), false);
                                }
                            }
                        }
                        break;
                    case "/trade":
                        {
                            Client n = ClientManager.FindClient(joinedArgs);
                            if (n != null)
                            {
                                if (n.Player.MapID == client.Player.MapID)
                                {
                                    client.Player.RequestTrade(n);
                                    Messenger.PlayerMsg(client, "You have asked " + n.Player.Name + " to trade with you!", Text.BrightGreen);
                                }
                            }
                            else
                            {
                                Messenger.PlayerMsg(client, "Player is offline.", Text.Grey);
                            }
                        }
                        break;
                    case "/editemoticon":
                    case "/editemotions":
                        {
                            // Prevent Hacking
                            if (Ranks.IsDisallowed(client, Enums.Rank.Developer))
                            {
                                Server.Network.Messenger.HackingAttempt(client, "Admin Cloning");
                            }
                            else
                            {
                                Messenger.SendDataTo(client, TcpPacket.CreatePacket("emoticoneditor"));
                            }
                        }
                        break;
                    case "/edititem":
                        {
                            // Prevent Hacking
                            if (Ranks.IsDisallowed(client, Enums.Rank.Developer))
                            {
                                Server.Network.Messenger.HackingAttempt(client, "Admin Cloning");
                            }
                            else
                            {
                                if (command[1].IsNumeric())
                                {
                                    int n = command[1].ToInt();

                                    // Prevent hacking
                                    if (n < 0 | n > Server.Items.ItemManager.Items.MaxItems)
                                    {
                                        Messenger.HackingAttempt(client, "Invalid Item Index");
                                        return;
                                    }

                                    Messenger.SendEditItemTo(client, n);
                                }

                            }
                        }
                        break;
                    case "/edititems":
                        {
                            // Prevent Hacking
                            if (Ranks.IsDisallowed(client, Enums.Rank.Developer))
                            {
                                Server.Network.Messenger.HackingAttempt(client, "Admin Cloning");
                            }
                            else
                            {
                                Messenger.SendItemEditor(client);
                            }
                        }
                        break;
                    case "/editmove":
                        {
                            // Prevent Hacking
                            if (Ranks.IsDisallowed(client, Enums.Rank.Developer))
                            {
                                Server.Network.Messenger.HackingAttempt(client, "Admin Cloning");
                            }
                            else
                            {
                                if (command[1].IsNumeric())
                                {
                                    int n = command[1].ToInt(-1);

                                    // Prevent hacking
                                    if (n < 0 | n > MoveManager.Moves.MaxMoves)
                                    {
                                        Messenger.HackingAttempt(client, "Invalid Move Index");
                                        return;
                                    }

                                    Messenger.SendEditMoveTo(client, n);
                                }

                            }
                        }
                        break;
                    case "/editmoves":
                        {
                            // Prevent Hacking
                            if (Ranks.IsDisallowed(client, Enums.Rank.Developer))
                            {
                                Server.Network.Messenger.HackingAttempt(client, "Admin Cloning");
                            }
                            else
                            {
                                Messenger.SendDataTo(client, TcpPacket.CreatePacket("moveeditor"));
                            }
                        }
                        break;
                    case "/editdungeon":
                        {
                            // Prevent Hacking
                            if (Ranks.IsDisallowed(client, Enums.Rank.Mapper))
                            {
                                Server.Network.Messenger.HackingAttempt(client, "Admin Cloning");
                            }
                            else
                            {
                                if (command[1].IsNumeric())
                                {
                                    if (command[1].ToInt() < 0 && command[1].ToInt() >= DungeonManager.Dungeons.Count)
                                    {
                                        Server.Network.Messenger.HackingAttempt(client, "Invalid Dungeon Number");
                                    }
                                    Messenger.SendEditDungeonTo(client, command[1].ToInt());
                                }
                            }
                        }
                        break;
                    case "/editdungeons":
                        {
                            // Prevent Hacking
                            if (Ranks.IsDisallowed(client, Enums.Rank.Mapper))
                            {
                                Server.Network.Messenger.HackingAttempt(client, "Admin Cloning");
                            }
                            else
                            {
                                Messenger.SendDataTo(client, TcpPacket.CreatePacket("dungeoneditor"));
                            }
                        }
                        break;
                    case "/editnpc":
                        {
                            // Prevent Hacking
                            if (Ranks.IsDisallowed(client, Enums.Rank.Developer))
                            {
                                Server.Network.Messenger.HackingAttempt(client, "Admin Cloning");
                            }
                            else
                            {
                                if (command[1].IsNumeric())
                                {
                                    int n = command[1].ToInt();

                                    // Prevent hacking
                                    /*if (n < 0 || n > Server.Npcs.NpcManager.Npcs.MaxNpcs) {
                                        Messenger.HackingAttempt(client, "Invalid Npc Index");
                                        return;
                                    }*/
                                    Messenger.SendNpcAiTypes(client);
                                    Messenger.SendEditNpcTo(client, n);
                                }

                            }
                        }
                        break;
                    case "/editnpcs":
                        {
                            // Prevent Hacking
                            if (Ranks.IsDisallowed(client, Enums.Rank.Mapper))
                            {
                                Server.Network.Messenger.HackingAttempt(client, "Admin Cloning");
                            }
                            else
                            {
                                Messenger.SendDataTo(client, TcpPacket.CreatePacket("npceditor"));
                            }
                        }
                        break;
                    case "/editrdungeon":
                        {
                            // Prevent Hacking
                            if (Ranks.IsDisallowed(client, Enums.Rank.Mapper))
                            {
                                Server.Network.Messenger.HackingAttempt(client, "Admin Cloning");
                            }
                            else
                            {
                                if (command[1].IsNumeric())
                                {
                                    int n = command[1].ToInt();
                                    if (n < 0 || n > RDungeonManager.RDungeons.Count - 1)
                                    {
                                        Messenger.PlayerMsg(client, "Invalid dungeon client", Text.BrightRed);
                                        return;
                                    }

                                    Messenger.SendEditRDungeonTo(client, n);
                                }

                            }
                        }
                        break;
                    case "/editrdungeons":
                        {
                            // Prevent Hacking
                            if (Ranks.IsDisallowed(client, Enums.Rank.Mapper))
                            {
                                Server.Network.Messenger.HackingAttempt(client, "Admin Cloning");
                            }
                            else
                            {
                                Messenger.SendDataTo(client, TcpPacket.CreatePacket("rdungeoneditor"));
                            }
                        }
                        break;
                    case "/editstory":
                    case "/editstories":
                        {
                            // Prevent Hacking
                            if (Ranks.IsDisallowed(client, Enums.Rank.Mapper))
                            {
                                Server.Network.Messenger.HackingAttempt(client, "Admin Cloning");
                            }
                            else
                            {
                                Messenger.SendDataTo(client, TcpPacket.CreatePacket("storyeditor"));
                            }
                        }
                        break;
                    case "/mapreport":
                        {
                            // Prevent hacking
                            //if (Ranks.IsDisallowed(client, Enums.Rank.Mapper)) {
                            //Messenger.HackingAttempt(client, "Admin Cloning");
                            //return;
                            //}
                            // TODO: Fix MapReport to work with on-demand map loading system
                            //TcpPacket packet = new TcpPacket("mapreport");
                            //for (int i = 1; i <= Server.Settings.MaxMaps; i++) {
                            //packet.AppendParameter(MapManager.Maps[i].Name);
                            //packet.AppendParameter("-Not Implemented-");
                            //}

                            //Messenger.SendDataTo(client, packet);
                        }
                        break;
                    case "/editevolutions":
                    case "/editevolution":
                        {
                            // Prevent Hacking
                            if (Ranks.IsDisallowed(client, Enums.Rank.Mapper))
                            {
                                Server.Network.Messenger.HackingAttempt(client, "Admin Cloning");
                            }
                            else
                            {
                                Messenger.SendDataTo(client, TcpPacket.CreatePacket("evolutioneditor"));
                            }
                        }
                        break;
                    case "/editshop":
                    case "/editshops":
                        {
                            // Prevent Hacking
                            if (Ranks.IsDisallowed(client, Enums.Rank.Mapper))
                            {
                                Server.Network.Messenger.HackingAttempt(client, "Admin Cloning");
                            }
                            else
                            {
                                Messenger.SendDataTo(client, TcpPacket.CreatePacket("shopeditor"));
                            }
                        }
                        break;
                    case "/testrecall":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Developer))
                            {
                                Messenger.SendRecallMenu(client, false);
                            }

                        }
                        break;
                    case "/test":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Scripter))
                            {
                                Debug.RunTest(client);
                            }
                        }
                        break;
                    case "/setform":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Scripter))
                            {
                                client.Player.GetActiveRecruit().SetForm(command[1].ToInt());
                                Messenger.SendPlayerData(client);
                                Messenger.SendActiveTeam(client);
                                Messenger.SendStats(client);
                            }
                        }
                        break;
                    case "/setgender":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Moniter))
                            {
                                Client n = ClientManager.FindClient(command[1]);
                                if (n != null)
                                {
                                    n.Player.GetActiveRecruit().Sex = (Enums.Sex)command[2].ToInt();
                                    RefreshCharacterTraits(n.Player.GetActiveRecruit(), n.Player.Map, hitlist);
                                    Messenger.SendPlayerData(n);
                                    Messenger.SendActiveTeam(n);
                                    Messenger.SendStats(n);
                                    Messenger.PlayerMsg(client, n.Player.Name + "'s " + n.Player.GetActiveRecruit().Name + "'s gender was set to " + ((Enums.Sex)command[2].ToInt()).ToString(), Text.Pink);
                                    Server.Logging.ChatLogger.AppendToChatLog("Staff", "[Characteristics] " + client.Player.Name + " changed the gender of " + n.Player.Name + "'s " + n.Player.GetActiveRecruit().Name + " to " + ((Enums.Sex)command[2].ToInt()).ToString());
                                }
                                else
                                {
                                    Messenger.PlayerMsg(client, "Player is offline", Text.Grey);
                                }
                            }
                        }
                        break;
                    case "/offlinetostart":
                        {
                            try
                            {
                                if (Ranks.IsAllowed(client, Enums.Rank.Moniter))
                                {
                                    using (DatabaseConnection dbConnection = new DatabaseConnection(DatabaseID.Players))
                                    {
                                        dbConnection.Database.ExecuteNonQuery("UPDATE mdx_players.location " +
                                            "JOIN mdx_players.characteristics ON mdx_players.characteristics.CharID = mdx_players.location.CharID " +
                                            "SET mdx_players.location.Map = \'s1015\' " +
                                            "WHERE characteristics.Name = \'" + command[1] + "\';");
                                        Messenger.PlayerMsg(client, "Character has been offline-warped to the crossroads", Text.Yellow);
                                    }
                                }
                            }
                            catch (Exception ex)
                            {
                                Messenger.PlayerMsg(client, ex.ToString(), Text.Black);
                            }
                        }
                        break;
                    case "/fixhouse":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Moniter))
                            {
                                Client n = ClientManager.FindClient(command[1]);
                                if (n != null)
                                {
                                    string houseID = MapManager.GenerateHouseID(n.Player.CharID, 0);
                                    // Make an empty house
                                    DataManager.Maps.HouseMap rawHouse = new DataManager.Maps.HouseMap(houseID);
                                    rawHouse.Owner = n.Player.CharID;
                                    rawHouse.Room = 0;
                                    IMap map = new House(rawHouse);
                                    map.Moral = Enums.MapMoral.House;
                                    map.Name = n.Player.Name + "'s House";
                                    map.Save();
                                    Messenger.PlayerMsg(client, n.Player.Name + "'s house is cleared.", Text.Pink);
                                }
                                else
                                {
                                    Messenger.PlayerMsg(client, "Player is offline", Text.Grey);
                                }
                            }
                        }
                        break;
                    case "/addmaps":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Admin))
                            {

                                for (int i = 2002; i <= 3000; i++)
                                {
                                    // Make an empty house
                                    DataManager.Maps.Map rawMap = new DataManager.Maps.Map("s" + i);
                                    Server.Maps.Map map = new Server.Maps.Map(rawMap);
                                    map.Save();
                                    Messenger.PlayerMsg(client, "Map " + i + " added.", Text.Pink);
                                }
                                Messenger.PlayerMsg(client, "Maps added.", Text.Pink);
                            }
                        }
                        break;
                    case "/copycharacter":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Scripter))
                            {
                                //try {
                                //    using (DatabaseConnection dbConnection = new DatabaseConnection(DatabaseID.Players)) {
                                //
                                //        PlayerDataManager.CopyCharacter(dbConnection.Database, command[1], command[2]);
                                //        Messenger.PlayerMsg(client, "Character copied from " + command[1] + " to " + command[2], Text.Black);
                                //    }
                                //} catch (Exception ex) {
                                //    Messenger.PlayerMsg(client, ex.ToString(), Text.Black);
                                //}
                            }

                        }
                        break;
                    case "/addnpcs":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Scripter))
                            {
                                for (int i = 2002; i <= 3000; i++)
                                {
                                    NpcManager.SaveNpc(i);
                                    Messenger.PlayerMsg(client, "NPC " + i + " added.", Text.BrightGreen);
                                }
                            }
                        }
                        break;
                    default:
                        {
                            Messenger.PlayerMsg(client, "That is not a valid command.", Text.BrightRed);
                        }
                        break;
                }

                PacketHitList.MethodEnded(ref hitlist);
            }
            catch (Exception ex)
            {
                Messenger.AdminMsg("Error: Command (" + command.CommandArgs[0] + ")", Text.Black);
                //Messenger.AdminMsg(ex.ToString(), Text.Black);
            }
        }
コード例 #18
0
ファイル: Main.cs プロジェクト: MandL27/Server
        public static void StoryScript(Client client, int scriptNum, string param1, string param2, string param3, bool paused)
        {
            // Called when a script from a story is run
            try {

            switch (scriptNum) {
                case 0: {
                        Messenger.SendPlayerData(client);
                    }
                    break;
                case 1: {
                        if (client.Player.Map.MapType != Enums.MapType.Instanced) return;
                        InstancedMap map = client.Player.Map as InstancedMap;
                        MapNpcPreset npc = new MapNpcPreset();
                        string[] loc = param1.Split(':');

                        string[] lvl = param3.Split(':');
                        npc.SpawnX = loc[0].ToInt();
                        npc.SpawnY = loc[1].ToInt();
                        npc.NpcNum = param2.ToInt();
                        npc.MinLevel = lvl[0].ToInt(); // TODO: Adjust npc level
                        npc.MaxLevel = lvl[1].ToInt(); // TODO: Adjust npc level
                        //Messenger.AdminMsg(npc.SpawnX+"/"+npc.SpawnY+"/"+npc.NpcNum+"/"+npc.MinLevel+"/"+npc.MaxLevel, Text.Pink);
                        map.SpawnNpc(npc);

                    }
                    break;
                case 2: {
                        if (client.Player.Map.MapType != Enums.MapType.Instanced) return;
                        InstancedMap map = client.Player.Map as InstancedMap;
                        string[] loc = param1.Split(':');
                        map.SetTile(loc[0].ToInt(), loc[1].ToInt(), 3, 4, 3);
                        map.SetAttribute(loc[0].ToInt(), loc[1].ToInt(), Enums.TileType.Scripted, 46, 0, 0, param2, "-1", "");
                        Messenger.SendTile(loc[0].ToInt(), loc[1].ToInt(), map);
                    }
                    break;
                case 3: {
                        if (client.Player.Map.MapType != Enums.MapType.Instanced) return;
                        InstancedMap map = client.Player.Map as InstancedMap;
                        string[] loc = param1.Split(':');
                        string[] dest = param2.Split(':');
                        map.SetTile(loc[0].ToInt(), loc[1].ToInt(), 3, 4, 3);
                        map.SetAttribute(loc[0].ToInt(), loc[1].ToInt(), Enums.TileType.Warp, dest[0].ToInt(), dest[1].ToInt(), dest[2].ToInt(), "", "", "");
                        Messenger.SendTile(loc[0].ToInt(), loc[1].ToInt(), map);
                    }
                    break;
                case 4: {
                        IMap map = client.Player.Map;
                        map.Npc[1].SpawnX = 9;
                        map.Npc[1].SpawnY = 7;
                        map.Npc[2].SpawnX = 6;
                        map.Npc[2].SpawnY = 11;
                        map.Npc[3].SpawnX = 13;
                        map.Npc[3].SpawnY = 11;
                        map.Npc[1].NpcNum = 306;
                        map.Npc[2].NpcNum = 259;
                        map.Npc[3].NpcNum = 259;
                        //map.SetNpc(0, 500);
                        //map.SetNpc(1, 500);
                        //map.SetNpc(2, 500);
                        for (int i = 1; i <= 3; i++) {
                            //map.SpawnNpc(i);
                        }
                    }
                    break;
                case 5: {
                        //sound
                        Messenger.PlaySoundToMap(client.Player.Map.MapID, param1);
                    }
                    break;
                case 6: {
                        IMap map = client.Player.Map;
                        map.Npc[1].SpawnX = 9;
                        map.Npc[1].SpawnY = 3;
                        map.Npc[1].NpcNum = 337;
                        //map.SpawnNpc(1);
                    }
                    break;
                case 7: {// Luxio Tribe Battle
                        // 167 - Luxio
                        // 177 - Luxray
                        // 5 luxio, 1 luxray
                        IMap map = client.Player.Map;
                        map.Npc[1].SpawnX = 10;
                        map.Npc[1].SpawnY = 5;
                        map.Npc[2].SpawnX = 7;
                        map.Npc[2].SpawnY = 6;
                        map.Npc[3].SpawnX = 12;
                        map.Npc[3].SpawnY = 6;
                        map.Npc[4].SpawnX = 7;
                        map.Npc[4].SpawnY = 8;
                        map.Npc[5].SpawnX = 12;
                        map.Npc[5].SpawnY = 8;
                        map.Npc[6].SpawnX = 12;
                        map.Npc[6].SpawnY = 9;
                        map.Npc[7].SpawnX = 10;
                        map.Npc[7].SpawnY = 7;
                        map.Npc[1].NpcNum = 177;
                        for (int i = 2; i <= 7; i++) {
                            map.Npc[i].NpcNum = 167;
                        }
                        for (int i = 1; i <= 7; i++) {
                            //map.SpawnNpc(i);
                        }
                    }
                    break;
                case 8: {
                        client.Player.GiveItem(159, 1);
                    }
                    break;
                case 9: {
                        client.Player.SetStoryState(157, false);
                    }
                    break;
                case 10: {//Start Registeel Battle: First wave of bronzongs
                        BossBattles.StartBossWave(client, "Registeel", 1);
                    }
                    break;
                case 11: {//Registeel Battle: second wave of bronzongs
                        BossBattles.StartBossWave(client, "Registeel", 2);
                    }
                    break;
                case 12: {//Registeel Battle: Registeel itself
                        BossBattles.StartBossWave(client, "Registeel", 3);
                    }
                    break;
                case 13: {//leaving Forlorn Tower by fee
                        int amount = client.Player.HasItem(1);
                        if (amount > 0) {
                            client.Player.TakeItem(1, (amount / 2));
                        }
                        Messenger.PlayerWarp(client, 684, 13, 20);
                    }
                    break;
                case 14: {
                        if (exPlayer.Get(client).StoryEnabled) {
                            int currentSection = client.Player.StoryHelper.ReadSetting("[MainStory]-CurrentSection").ToInt();
                            client.Player.StoryHelper.SaveSetting("[MainStory]-CurrentSection", (currentSection + 1).ToString());
                        }
                    }
                    break;
                case 15: {//murkrows attack (wave 1)
                        IMap map = client.Player.Map;

                        map.SetAttribute(7, 10, Enums.TileType.Scripted, 3, 0, 0, "", "", "");
                        map.SetAttribute(13, 10, Enums.TileType.Scripted, 3, 0, 0, "", "", "");
                        map.SetAttribute(7, 14, Enums.TileType.Scripted, 3, 0, 0, "", "", "");
                        map.SetAttribute(13, 14, Enums.TileType.Scripted, 3, 0, 0, "", "", "");
                        map.SetAttribute(4, 18, Enums.TileType.Scripted, 3, 0, 0, "", "", "");
                        map.SetAttribute(16, 18, Enums.TileType.Scripted, 3, 0, 0, "", "", "");
                        map.SetAttribute(4, 8, Enums.TileType.Scripted, 3, 0, 0, "", "", "");
                        map.SetAttribute(16, 8, Enums.TileType.Scripted, 3, 0, 0, "", "", "");

                        map.SetNpcSpawnPoint(1, 3, 10);
                        map.SetNpcSpawnPoint(2, 4, 11);
                        map.SetNpcSpawnPoint(3, 6, 10);
                        map.SetNpcSpawnPoint(4, 7, 11);
                        map.SetNpcSpawnPoint(5, 8, 10);
                        map.SetNpcSpawnPoint(6, 9, 11);
                        map.SetNpcSpawnPoint(7, 10, 10);
                        map.SetNpcSpawnPoint(8, 11, 11);
                        map.SetNpcSpawnPoint(9, 12, 10);
                        map.SetNpcSpawnPoint(10, 13, 11);
                        map.SetNpcSpawnPoint(11, 14, 10);
                        map.SetNpcSpawnPoint(12, 16, 11);
                        map.SetNpcSpawnPoint(13, 17, 10);

                        for (int i = 1; i <= 13; i++) {
                            map.Npc[i].NpcNum = 224;
                        }

                        //map.SpawnNpc(1);
                        //map.SpawnNpc(2);
                        //map.SpawnNpc(3);
                        //map.SpawnNpc(4);
                        //map.SpawnNpc(5);
                        //map.SpawnNpc(6);
                        //map.SpawnNpc(7);
                        //map.SpawnNpc(8);
                        //map.SpawnNpc(9);
                        //map.SpawnNpc(10);
                        //map.SpawnNpc(11);
                        //map.SpawnNpc(12);
                        //map.SpawnNpc(13);

                    }
                    break;
                case 16: {//murkrows attack (ambush)
                        IMap map = client.Player.Map;

                        map.SetAttribute(7, 10, Enums.TileType.Scripted, 3, 0, 0, "", "", "");
                        map.SetAttribute(13, 10, Enums.TileType.Scripted, 3, 0, 0, "", "", "");
                        map.SetAttribute(7, 14, Enums.TileType.Scripted, 3, 0, 0, "", "", "");
                        map.SetAttribute(13, 14, Enums.TileType.Scripted, 3, 0, 0, "", "", "");
                        map.SetAttribute(4, 18, Enums.TileType.Scripted, 3, 0, 0, "", "", "");
                        map.SetAttribute(16, 18, Enums.TileType.Scripted, 3, 0, 0, "", "", "");
                        map.SetAttribute(4, 8, Enums.TileType.Scripted, 3, 0, 0, "", "", "");
                        map.SetAttribute(16, 8, Enums.TileType.Scripted, 3, 0, 0, "", "", "");

                        map.SetNpcSpawnPoint(1, 9, 7);
                        map.SetNpcSpawnPoint(2, 10, 7);
                        map.SetNpcSpawnPoint(3, 11, 7);
                        map.SetNpcSpawnPoint(4, 9, 8);
                        map.SetNpcSpawnPoint(5, 11, 8);
                        map.SetNpcSpawnPoint(6, 9, 9);
                        map.SetNpcSpawnPoint(7, 10, 9);
                        map.SetNpcSpawnPoint(8, 11, 9);
                        map.SetNpcSpawnPoint(9, 8, 8);
                        map.SetNpcSpawnPoint(10, 8, 9);
                        map.SetNpcSpawnPoint(11, 12, 8);
                        map.SetNpcSpawnPoint(12, 12, 9);
                        map.SetNpcSpawnPoint(13, 10, 10);

                        for (int i = 1; i <= 13; i++) {
                            map.Npc[i].NpcNum = 220;
                        }

                        //map.SpawnNpc(1);
                        //map.SpawnNpc(2);
                        //map.SpawnNpc(3);
                        //map.SpawnNpc(4);
                        //map.SpawnNpc(5);
                        //map.SpawnNpc(6);
                        //map.SpawnNpc(7);
                        //map.SpawnNpc(8);
                        //map.SpawnNpc(9);
                        //map.SpawnNpc(10);
                        //map.SpawnNpc(11);
                        //map.SpawnNpc(12);
                        //map.SpawnNpc(13);

                        if (client.Player.GetActiveRecruit().HeldItem.Num != 142) {
                            Messenger.BattleMsg(client, "There was a trap underneath!", Text.BrightRed);
                            Messenger.BattleMsg(client, "The trap exploded!", Text.BrightRed);
                            //Messenger.SpellAnim(497, client.Player.MapID, client.Player.X, client.Player.Y);
                            //DamagePlayer(client, Convert.ToInt32((client.Player.GetActiveRecruit().HP + 0.5) / 2), Enums.KillType.Npc);

                            Messenger.PlaySoundToMap(client.Player.MapID, "magic64.wav");
                            Messenger.BattleMsg(client, "The trap drained all your PP!", Text.BrightRed);
                            //Messenger.SpellAnim(493, client.Player.MapID, client.Player.X, client.Player.Y);
                            for (int i = 0; i < client.Player.GetActiveRecruit().Moves.Length; i++) {
                                client.Player.GetActiveRecruit().Moves[i].CurrentPP = 0;
                                //Messenger.SendMovePPUpdate(client, i);
                            }
                            Messenger.PlaySound(client, "PP Zero.wav");
                            Messenger.BattleMsg(client, "Poison spikes shot out!", Text.BrightRed);
                            //Messenger.SpellAnim(496, client.Player.MapID, client.Player.X, client.Player.Y);
                            Messenger.PlaySoundToMap(client.Player.MapID, "magic23.wav");
                            SetStatusAilment(client.Player.GetActiveRecruit(), client.Player.Map, Enums.StatusAilment.Poison, 1, null);
                            Messenger.BattleMsg(client, "Mud splashed up from the ground!", Text.BrightRed);
                            //Messenger.SpellAnim(495, client.Player.MapID, client.Player.X, client.Player.Y);
                            Messenger.PlaySoundToMap(client.Player.MapID, "magic65.wav");
                            switch (Server.Math.Rand(0, 4)) {
                                case 0: {
                                        client.Player.GetActiveRecruit().AttackBuff = 0;
                                    }
                                    break;
                                case 1: {
                                        client.Player.GetActiveRecruit().DefenseBuff = 0;
                                    }
                                    break;
                                case 2: {
                                        client.Player.GetActiveRecruit().SpAtkBuff = 0;
                                    }
                                    break;
                                case 3: {
                                        client.Player.GetActiveRecruit().SpeedBuff = 0;
                                    }
                                    break;
                            }
                            //Messenger.SpellAnim(494, client.Player.MapID, client.Player.X, client.Player.Y);
                            //Grimy(client);
                            Messenger.PlaySoundToMap(client.Player.MapID, "Magic65.wav");
                            //PlayerInvDrop(client);
                            Messenger.MapMsg(client.Player.MapID, client.Player.Name + " tripped!", Text.BrightRed);
                            Messenger.PlaySoundToMap(client.Player.MapID, "magic55.wav");
                            Messenger.BattleMsg(client, "You were pelted with chestnuts!", Text.BrightRed);
                            //DamagePlayer(client, 50, Enums.KillType.Npc);

                            Messenger.PlaySoundToMap(client.Player.MapID, "pain.wav");
                            Messenger.BattleMsg(client, "The trap broke down...", Text.Black);
                        }
                    }
                    break;
                case 17: {//murkrows and honchkrow attack
                        IMap map = client.Player.Map;
                        map.SetNpcSpawnPoint(1, 6, 9);
                        map.SetNpcSpawnPoint(2, 14, 9);
                        map.SetNpcSpawnPoint(3, 6, 11);
                        map.SetNpcSpawnPoint(4, 14, 11);
                        map.SetNpcSpawnPoint(5, 5, 13);
                        map.SetNpcSpawnPoint(6, 15, 13);
                        map.SetNpcSpawnPoint(7, 6, 15);
                        map.SetNpcSpawnPoint(8, 14, 15);
                        map.SetNpcSpawnPoint(9, 8, 14);
                        map.SetNpcSpawnPoint(10, 12, 14);
                        map.SetNpcSpawnPoint(11, 6, 18);
                        map.SetNpcSpawnPoint(12, 14, 18);
                        map.SetNpcSpawnPoint(13, 10, 16);
                        map.SetNpcSpawnPoint(14, 10, 7);

                        map.SetNpc(1, 220);
                        map.SetNpc(2, 220);
                        map.SetNpc(3, 220);
                        map.SetNpc(4, 220);
                        map.SetNpc(5, 220);
                        map.SetNpc(6, 220);
                        map.SetNpc(7, 220);
                        map.SetNpc(8, 220);
                        map.SetNpc(9, 220);
                        map.SetNpc(10, 220);
                        map.SetNpc(11, 220);
                        map.SetNpc(12, 220);
                        map.SetNpc(13, 220);
                        map.SetNpc(14, 221);

                        //map.SpawnNpc(1);
                        //map.SpawnNpc(2);
                        //map.SpawnNpc(3);
                        //map.SpawnNpc(4);
                        //map.SpawnNpc(5);
                        //map.SpawnNpc(6);
                        //map.SpawnNpc(7);
                        //map.SpawnNpc(8);
                        //map.SpawnNpc(9);
                        //map.SpawnNpc(10);
                        //map.SpawnNpc(11);
                        //map.SpawnNpc(12);
                        //map.SpawnNpc(13);
                        //map.SpawnNpc(14);

                    }
                    break;
                case 18: {//honchkrow defeated, warp opens.
                        IMap map = client.Player.Map;
                        map.SetTile(10, 6, 96, 4, 3);
                        map.SetTile(10, 5, 112576, 9, 3);
                        map.SetTile(10, 4, 112128, 9, 3);
                        // Left old code in case I did the math wrong...
                        //map.SetTile(10, 5, 128, 8032, 9, 3);
                        //map.SetTile(10, 4, 128, 8000, 9, 3);
                        map.SetAttribute(10, 6, Enums.TileType.Scripted, 46, 0, 0, "16", "683", "9:16");
                        Messenger.SendTile(10, 4, map);
                        Messenger.SendTile(10, 5, map);
                        Messenger.SendTile(10, 6, map);
                    }
                    break;
                case 19: {//daniel's fireplace question
                        if (client.Player.GetActiveRecruit().HasMove(452)) {
                            Messenger.AskQuestion(client, "Fireplace", "Will you use Rock Smash on the fireplace?", -1);
                        }
                    }
                    break;
                case 20: {//go into abandoned mansion
                        Messenger.AskQuestion(client, "AbandonedMansion2", "Only the team leader may enter this dungeon, is that OK?", -1);

                    }
                    break;
                case 21: {//vs. gengar
                        IMap map = client.Player.Map;
                        if (map.MapType != Enums.MapType.Instanced) {
                            client.CloseConnection();
                            return;
                        }
                        map.SetNpcSpawnPoint(1, 11, 6);
                        map.SetNpcSpawnPoint(2, 12, 8);
                        map.SetNpcSpawnPoint(3, 14, 8);
                        map.SetNpc(1, 804);
                        map.SetNpc(2, 809);
                        map.SetNpc(3, 812);
                        //map.SpawnNpc(1);
                        //map.SpawnNpc(2);
                        //map.SpawnNpc(3);

                    }
                    break;
                case 22: {//vs. Rotom
                        IMap map = client.Player.Map;

                        if (map.Name == "West Wing End") {
                            InstancedMap mapa = new InstancedMap(MapManager.GenerateMapID("i"));
                            MapCloner.CloneMapTiles(MapManager.RetrieveMap(825), mapa);
                            Messenger.PlayerWarp(client, mapa, 9, 10);
                            mapa.SetNpcSpawnPoint(1, 9, 3);
                            mapa.SetNpc(1, 806);
                            //mapa.SpawnNpc(1);

                        } else if (map.Name == "East Wing End") {

                            InstancedMap mapa = new InstancedMap(MapManager.GenerateMapID("i"));
                            MapCloner.CloneMapTiles(MapManager.RetrieveMap(826), mapa);
                            Messenger.PlayerWarp(client, mapa, 10, 10);
                            mapa.SetNpcSpawnPoint(1, 10, 3);
                            mapa.SetNpc(1, 807);
                            //mapa.SpawnNpc(1);

                        }
                    }
                    break;
                case 23: {//go into Hallowed Well
                        Messenger.AskQuestion(client, "HallowedWell2", "Only the team leader may enter this dungeon, and no Pokémon may be recruited.  Is that OK?", -1);
                    }
                    break;
                case 24: {//spiritomb battle
                        client.Player.TakeItem(251, 1);
                        IMap map = client.Player.Map;
                        map.SetNpcSpawnPoint(1, 9, 8);
                        map.SetNpc(1, 805);
                        //map.SpawnNpc(1);
                    }
                    break;
                case 25: {//spiritomb joins
                        // Fixed, uncomment when needed
                        // TODO: Spritomb joins
                        //client.Player.AddToRecruitmentBank(37, 209, 40, (ulong)1, 1, 0, 0, 40, 55, 10, 40, 1, 805, "Spiritomb");
                        Messenger.PlaySoundToMap(client.Player.MapID, "JoinGame.wav");
                    }
                    break;
                case 26: {//learn wish
                        client.Player.GetActiveRecruit().LearnNewMove(268);
                    }
                    break;
                case 27: {//vs. Articuno*
                        IMap map = client.Player.Map;
                        map.SetNpc(1, 440);
                        map.SetNpcSpawnPoint(1, 12, 11);
                        //map.SpawnNpc(1);
                    }
                    break;
                case 28: {//Give Natural Gift
                        Messenger.PlayerMsg(client, "You were given a Natural Gift!", Text.Yellow);
                        client.Player.GiveItem(232, 1);
                    }
                    break;
                case 29: {//Give Holly Present
                        Messenger.PlayerMsg(client, "You were given a Holly Present!", Text.Yellow);
                        client.Player.GiveItem(233, 1);
                    }
                    break;
                case 30: {//Give Mystery Gift
                        Messenger.PlayerMsg(client, "You were given a Mystery Gift!", Text.Yellow);
                        client.Player.GiveItem(234, 1);
                    }
                    break;
                case 31: {//Give PMDCP Present
                        Messenger.PlayerMsg(client, "You were given a PMDCP Present!", Text.Yellow);
                        client.Player.GiveItem(231, 1);
                    }
                    break;
                case 32: {//take white herb
                        Messenger.PlayerMsg(client, "You gave away some Candy Canes.", Text.Yellow);
                        client.Player.TakeItem(212, 12);
                    }
                    break;
                case 33: {//take soft string
                        Messenger.PlayerMsg(client, "You gave away some Soft String.", Text.Yellow);
                        client.Player.TakeItem(208, 20);
                    }
                    break;
                case 34: {//take soft snow
                        Messenger.PlayerMsg(client, "You gave away some Soft Snow.", Text.Yellow);
                        client.Player.TakeItem(209, 50);
                    }
                    break;
                case 35: {//Take ornaments
                        client.Player.GiveItem(174, 1);
                        Messenger.PlayerMsg(client, "You obtained a Shell Bell!", Text.Yellow);
                    }
                    break;
                case 36: {//vs. Heatran
                        IMap map = client.Player.Map;
                        map.SetNpc(1, 404);
                        map.SetNpcSpawnPoint(1, 12, 11);
                        //map.SpawnNpc(1);
                    }
                    break;
                case 37: {//vs. Xatu
                        BossBattles.RunPostIntroStoryBossBattle(client, "Pitch-Black Pit");
                    }
                    break;
                case 38: {
                        BossBattles.RunPostIntroStoryBossBattle(client, "TinyGrotto");
                    }
                    break;
                case 39: {

                    BossBattles.RunBossBattleCleanup(client, client.Player.Map.Name);
                    }
                    break;
                case 40: {
                        client.Player.GiveItem(779, 1, "");
                    }
                    break;
                case 41: { // Post intro boss battle for Seaside Cavern
                        BossBattles.RunPostIntroStoryBossBattle(client, "SeasideCavern");
                    }
                    break;
                case 42: { // enter dungeon (random)

                        DungeonRules.StartRDungeon(client, param1, param2, param3);
                    }
                    break;
                case 43: {
                        BossBattles.StartBossWave(client, "ElectrostasisTowerA1", 1);
                    }
                    break;
                case 44: {
                        BossBattles.RunBossBattleCleanup(client, "ElectrostasisTowerA1");
                    }
                    break;
                case 45: {
                        BossBattles.RunPostIntroStoryBossBattle(client, "ElectrostasisTowerA2");
                    }
                    break;
                case 46: {
                        //battle fossil & battle egg
                        int npcNum = -1;
                        switch (param1.ToInt()) {
                            case 138: //omanyte
                                npcNum = 272;
                            break;
                            case 140: //kabuto
                                npcNum = 250;
                            break;
                            case 142: //aerodactyl
                                npcNum = 132;
                            break;
                            case 345: //lileep
                                npcNum = 956;
                            break;
                            case 347: //anorith
                                npcNum = 957;
                            break;
                            case 408: //cranidos
                                npcNum = 959;
                            break;
                            case 410: //shieldon
                                npcNum = 958;
                            break;
                            case 566: //archen
                                npcNum = 973;
                            break;
                            break;
                            //case 566: //tirtouga
                            //	npcNum = 979;
                            //break;
                        }
                        if (npcNum > 0) {

                            MapNpcPreset npc = new MapNpcPreset();
                            npc.SpawnX = 9;
                            npc.SpawnY = 3;
                            npc.NpcNum = npcNum;
                            npc.MinLevel = param2.ToInt();
                            npc.MaxLevel = param2.ToInt();
                            client.Player.Map.SpawnNpc(npc);
                        }
                    }
                    break;
                case 47: {//egg hatch
                        int item = -1;
                        string[] recruitArgs = null;
                        for (int i = 1; i <= client.Player.MaxInv; i++) {
                            if (client.Player.Inventory[i].Num == 131) {
                                string[] eggArgs = client.Player.Inventory[i].Tag.Split(';');
                                if (eggArgs.Length <= 1 || !eggArgs[1].IsNumeric()) {
                                    client.Player.TakeItemSlot(i, 1, true);
                                } else {
                                    int step = eggArgs[1].ToInt();
                                    if (step <= 1) {
                                        item = i;
                                        recruitArgs = eggArgs[0].Split(',');
                                    }
                                    break;
                                }
                            }
                        }

                        if (item != -1) {

                            Recruit recruit = new Recruit(client);
                            //recruit.SpriteOverride = -1;
                            recruit.Level = 1;
                            recruit.Species = recruitArgs[0].ToInt();
                            recruit.Sex = Pokedex.GetPokemonForm(recruitArgs[0].ToInt()).GenerateLegalSex();
                            recruit.Name = Pokedex.GetPokemon(recruitArgs[0].ToInt()).Name;
                            recruit.NpcBase = 0;

                            recruit.GenerateMoveset();

                            //for egg moves, where applicable
                            List<int> eggMoves = GenerateEggMoveset(recruit.Species, recruit.Form, -1);

                            for (int i = 0; i < 4; i++) {
                                if (eggMoves.Count > 0) {
                                    int moveNum = eggMoves[Server.Math.Rand(0, eggMoves.Count)];
                                    recruit.Moves[i] = new RecruitMove();
                                    recruit.Moves[i].MoveNum = moveNum;
                                    recruit.Moves[i].MaxPP = Server.Moves.MoveManager.Moves[moveNum].MaxPP;
                                    recruit.Moves[i].CurrentPP = recruit.Moves[i].MaxPP;
                                    eggMoves.Remove(moveNum);
                                }
                            }

                            for (int i = 0; i < 4; i++) {
                                if (eggMoves.Contains(client.Player.GetActiveRecruit().Moves[i].MoveNum)) {
                                    int moveNum = client.Player.GetActiveRecruit().Moves[i].MoveNum;
                                    recruit.Moves[i] = new RecruitMove();
                                    recruit.Moves[i].MoveNum = moveNum;
                                    recruit.Moves[i].MaxPP = Server.Moves.MoveManager.Moves[moveNum].MaxPP;
                                    recruit.Moves[i].CurrentPP = recruit.Moves[i].MaxPP;
                                    eggMoves.Remove(client.Player.GetActiveRecruit().Moves[i].MoveNum);
                                }
                            }

                            int openSlot = client.Player.FindOpenTeamSlot();
                            int recruitIndex = -1;
                            using (DatabaseConnection dbConnection = new DatabaseConnection(DatabaseID.Players)) {
                                recruitIndex = client.Player.AddToRecruitmentBank(dbConnection, recruit);
                            }

                            if (recruitIndex != -1) {
                                client.Player.AddToTeam(recruitIndex, openSlot);
                                client.Player.Team[openSlot].HP = client.Player.Team[openSlot].MaxHP;
                                Messenger.BattleMsg(client, "You have recruited a new team member!", Text.BrightGreen);

                                Messenger.SendActiveTeam(client);
                            }

                            client.Player.TakeItemSlot(item, 1, true);

                            if (recruitArgs.Length > 1) client.Player.GiveItem(recruitArgs[1].ToInt(), 1);

                        }

                    }
                    break;
                case 48: {//teach egg move

                        int species = client.Player.GetActiveRecruit().Species;

                        if (Server.Evolutions.EvolutionManager.FindPreEvolution(species) > -1) {
                            species = Server.Evolutions.EvolutionManager.FindPreEvolution(species);
                        }
                        if (Server.Evolutions.EvolutionManager.FindPreEvolution(species) > -1) {
                            species = Server.Evolutions.EvolutionManager.FindPreEvolution(species);
                        }

                        List<int> eggMoves = GenerateEggMoveset(species, client.Player.GetActiveRecruit().Form, -1);

                        Messenger.PlayerMsg(client, "Poof!", Text.BrightGreen);
                        Messenger.PlaySound(client, "magic22.wav");
                        Messenger.SpellAnim(504, client.Player.MapID, client.Player.X, client.Player.Y);
                        if (eggMoves.Count > 0) {
                            client.Player.GetActiveRecruit().LearnNewMove(eggMoves[Server.Math.Rand(0, eggMoves.Count)]);
                            Messenger.SendPlayerMoves(client);
                        } else {
                            Messenger.PlayerMsg(client, "But nothing happened...", Text.Grey);
                        }

                    }
                    break;
                case 49: {//take egg

                        int item = -1;
                        string[] recruitArgs = null;
                        for (int i = 1; i <= client.Player.MaxInv; i++) {
                            if (client.Player.Inventory[i].Num == 131) {
                                string[] eggArgs = client.Player.Inventory[i].Tag.Split(';');
                                if (eggArgs.Length <= 1 || !eggArgs[1].IsNumeric()) {
                                    client.Player.TakeItemSlot(i, 1, true);
                                } else {
                                    int step = eggArgs[1].ToInt();
                                    if (step <= 1) {
                                        item = i;
                                        recruitArgs = eggArgs[0].Split(',');
                                    }
                                    break;
                                }
                            }
                        }

                        if (item != -1) {
                            client.Player.TakeItemSlot(item, 1, true);
                        }

                    }
                    break;
                case 50: {
                        BossBattles.StartBossWave(client, "ElectrostasisTowerA1", 2);
                    }
                    break;
                case 51: {
                        BossBattles.RunPostIntroStoryBossBattle(client, "CliffsideRelic");
                    }
                    break;
                case 52: {//enter dungeon (normal map)
                        DungeonRules.StartDungeon(client, param1, param2, param3);
                    }
                    break;
                case 53: {
                        BossBattles.RunPostIntroStoryBossBattle(client, "ThunderstormForest");
                    }
                    break;
                case 54: {
                        BossBattles.RunPostIntroStoryBossBattle(client, "ThunderstormForestPart2");
                    }
                    break;
                case 55: { // Open tournament listing
                        Messenger.SendTournamentListingTo(client, null);
                    }
                    break;
                case 56: {
                        BossBattles.RunPostIntroStoryBossBattle(client, "SourRootMini");
                    }
                    break;
                case 57: {//start boss battle
                        BossBattles.PrepareBossRoom(client, (InstancedMap)client.Player.Map);
                    }
                    break;
                case 58: {
                        BossBattles.RunPostIntroStoryBossBattle(client, "SourRoot");
                    }
                    break;
                case 59: {//run post intro story boss battle

                        BossBattles.RunPostIntroStoryBossBattle(client, param1);
                    }
                    break;
                case 60: {
                        BossBattles.RunPostIntroStoryBossBattle(client, "SaunaCavernMini");
                    }
                    break;
                case 61: {//enter arena
                        for (int i = 1; i <= client.Player.MaxInv; i++) {
                            if (client.Player.Inventory[i].Num > 0
                                && ItemManager.Items[client.Player.Inventory[i].Num].Type != Enums.ItemType.Held && ItemManager.Items[client.Player.Inventory[i].Num].Type != Enums.ItemType.HeldByParty
                                && ItemManager.Items[client.Player.Inventory[i].Num].Type != Enums.ItemType.HeldInBag) {
                                bool held = false;

                                for (int j = 0; j < Constants.MAX_ACTIVETEAM; j++) {
                                    if (client.Player.Team[j] != null
                                        && client.Player.Team[j].HeldItemSlot == i) {
                                        held = true;
                                    }

                                }

                                if (!held) {
                                    int slot = i;
                                    int amount = client.Player.Inventory[slot].Amount;
                                    int X = client.Player.Inventory[slot].Num;
                                    string tag = client.Player.Inventory[slot].Tag;
                                    int j = client.Player.FindBankSlot(X, amount);
                                    if (j == -1) {
                                        Messenger.PlayerMsg(client, "The storage can't store all items!", Text.BrightRed);
                                        return;
                                    }

                                    client.Player.TakeItemSlot(slot, amount, true);
                                    client.Player.GiveBankItem(X, amount, tag, j);

                                }
                            }
                        }
                        Messenger.PlayerMsg(client, "Items were sent to storage!", Text.Yellow);
                        EnterArena(client, client.Player.GetActiveRecruit(), client.Player.Map, param2, param3, null);
                    }
                    break;
                case 62: {
                        BossBattles.RunPostIntroStoryBossBattle(client, "SaunaCavern");
                    }
                    break;
                case 64: {
                        BossBattles.RunPostIntroStoryBossBattle(client, "CrystalRuins");
                    }
                    break;
                case 66: {
                        BossBattles.RunPostIntroStoryBossBattle(client, "FrozenCitadel");
                    }
                    break;
                case 68: {
                        BossBattles.RunPostIntroStoryBossBattle(client, "SouthernSea");
                    }
                    break;
                case 69: {
                        BossBattles.RunPostIntroStoryBossBattle(client, "LenilePit");
                    }
                    break;
                case 70: {
                        Messenger.PlayerWarp(client, 1035, 9, 7);
                    }
                    break;
                case 71: {//teach tutor move
                        int species = client.Player.GetActiveRecruit().Species;

                        List<int> eggMoves = GenerateTutorMoveset(species, client.Player.GetActiveRecruit().Form, param1.ToInt());

                        Messenger.PlayerMsg(client, "GOOOOONG!", Text.BrightGreen);
                        Messenger.PlaySound(client, "magic1011.wav");
                        Messenger.SpellAnim(498, client.Player.MapID, client.Player.X, client.Player.Y);
                        if (eggMoves.Count > 0) {
                            client.Player.GetActiveRecruit().LearnNewMove(eggMoves[Server.Math.Rand(0, eggMoves.Count)]);
                            Messenger.SendPlayerMoves(client);
                        } else {
                            Messenger.PlayerMsg(client, "But nothing happened...", Text.Grey);
                        }
                    }
                    break;

               }
            } catch (Exception ex) {
                Messenger.AdminMsg("Error: StoryScript " + scriptNum + ": " + param1 + "-" + param2 + "-" + param3, Text.Black);

                Messenger.AdminMsg(ex.ToString(), Text.Black);
            }
        }
コード例 #19
0
        public static void LoadRDungeon(int dungeonNum, MySql database)
        {
            RDungeon dungeon = new RDungeon(dungeonNum);

            string query = "SELECT name, " +
                "up, " +
                "allow_recruit, " +
                "allow_exp, " +
                "time_limit " +
                "FROM rdungeon WHERE rdungeon.num = \'" + dungeonNum + "\'";

            DataColumnCollection row = database.RetrieveRow(query);
            if (row != null)
            {
                dungeon.DungeonName = row["name"].ValueString;
                bool isUp = row["up"].ValueString.ToBool();
                if (isUp)
                {
                    dungeon.Direction = Enums.Direction.Up;
                }
                else
                {
                    dungeon.Direction = Enums.Direction.Down;
                }
                dungeon.Recruitment = row["allow_recruit"].ValueString.ToBool();
                dungeon.Exp = row["allow_exp"].ValueString.ToBool();
                dungeon.WindTimer = row["time_limit"].ValueString.ToInt();
            }

            query = "SELECT floor_num, " +
                "trap_min, " +
                "trap_max, " +
                "item_min, " +
                "item_max, " +
                "intricacy, " +
                "room_width_min, " +
                "room_width_max, " +
                "room_length_min, " +
                "room_length_max, " +
                "hall_turn_min, " +
                "hall_turn_max, " +
                "hall_var_min, " +
                "hall_var_max, " +
                "water_chance, " +
                "craters, " +
                "crater_min, " +
                "crater_max, " +
                "crater_fuzz, " +
                "npc_respawn, " +
                "npc_min, " +
                "npc_max, " +
                "stairs, " +
                "ground, " +
                "ground_alt1, " +
                "ground_alt2, " +
                "top_left, " +
                "top_center, " +
                "top_right, " +
                "center_left, " +
                "center_center, " +
                "center_right, " +
                "bottom_left, " +
                "bottom_center, " +
                "bottom_right, " +
                "top_left_in, " +
                "top_right_in, " +
                "bottom_left_in, " +
                "bottom_right_in, " +
                "col_top, " +
                "col_center, " +
                "col_bottom, " +
                "row_left, " +
                "row_center, " +
                "row_right, " +
                "isolated, " +
                "stairs_set, " +
                "ground_set, " +
                "ground_alt1_set, " +
                "ground_alt2_set, " +
                "top_left_set, " +
                "top_center_set, " +
                "top_right_set, " +
                "center_left_set, " +
                "center_center_set, " +
                "center_right_set, " +
                "bottom_left_set, " +
                "bottom_center_set, " +
                "bottom_right_set, " +
                "top_left_in_set, " +
                "top_right_in_set, " +
                "bottom_left_in_set, " +
                "bottom_right_in_set, " +
                "col_top_set, " +
                "col_center_set, " +
                "col_bottom_set, " +
                "row_left_set, " +
                "row_center_set, " +
                "row_right_set, " +
                "isolated_set, " +
                "top_left_alt, " +
                "top_center_alt, " +
                "top_right_alt, " +
                "center_left_alt, " +
                "center_center_alt1, " +
                "center_center_alt2, " +
                "center_right_alt, " +
                "bottom_left_alt, " +
                "bottom_center_alt, " +
                "bottom_right_alt, " +
                "top_left_in_alt, " +
                "top_right_in_alt, " +
                "bottom_left_in_alt, " +
                "bottom_right_in_alt, " +
                "col_top_alt, " +
                "col_center_alt, " +
                "col_bottom_alt, " +
                "row_left_alt, " +
                "row_center_alt, " +
                "row_right_alt, " +
                "isolated_alt, " +
                "top_left_alt_set, " +
                "top_center_alt_set, " +
                "top_right_alt_set, " +
                "center_left_alt_set, " +
                "center_center_alt1_set, " +
                "center_center_alt2_set, " +
                "center_right_alt_set, " +
                "bottom_left_alt_set, " +
                "bottom_center_alt_set, " +
                "bottom_right_alt_set, " +
                "top_left_in_alt_set, " +
                "top_right_in_alt_set, " +
                "bottom_left_in_alt_set, " +
                "bottom_right_in_alt_set, " +
                "col_top_alt_set, " +
                "col_center_alt_set, " +
                "col_bottom_alt_set, " +
                "row_left_alt_set, " +
                "row_center_alt_set, " +
                "row_right_alt_set, " +
                "isolated_alt_set, " +
                "water, " +
                "shore_top_left, " +
                "shore_top_right, " +
                "shore_bottom_left, " +
                "shore_bottom_right, " +
                "shore_diag_forth, " +
                "shore_diag_back, " +
                "shore_top, " +
                "shore_left, " +
                "shore_right, " +
                "shore_bottom, " +
                "shore_vert, " +
                "shore_horiz, " +
                "shore_top_left_in, " +
                "shore_top_right_in, " +
                "shore_bottom_left_in, " +
                "shore_bottom_right_in, " +
                "shore_top_in, " +
                "shore_left_in, " +
                "shore_right_in, " +
                "shore_bottom_in, " +
                "shore_isolated, " +
                "water_set, " +
                "shore_top_left_set, " +
                "shore_top_right_set, " +
                "shore_bottom_left_set, " +
                "shore_bottom_right_set, " +
                "shore_diag_forth_set, " +
                "shore_diag_back_set, " +
                "shore_top_set, " +
                "shore_left_set, " +
                "shore_right_set, " +
                "shore_bottom_set, " +
                "shore_vert_set, " +
                "shore_horiz_set, " +
                "shore_top_left_in_set, " +
                "shore_top_right_in_set, " +
                "shore_bottom_left_in_set, " +
                "shore_bottom_right_in_set, " +
                "shore_top_in_set, " +
                "shore_left_in_set, " +
                "shore_right_in_set, " +
                "shore_bottom_in_set, " +
                "shore_isolated_set, " +
                "water_anim, " +
                "shore_top_left_anim, " +
                "shore_top_right_anim, " +
                "shore_bottom_left_anim, " +
                "shore_bottom_right_anim, " +
                "shore_diag_forth_anim, " +
                "shore_diag_back_anim, " +
                "shore_top_anim, " +
                "shore_left_anim, " +
                "shore_right_anim, " +
                "shore_bottom_anim, " +
                "shore_vert_anim, " +
                "shore_horiz_anim, " +
                "shore_top_left_in_anim, " +
                "shore_top_right_in_anim, " +
                "shore_bottom_left_in_anim, " +
                "shore_bottom_right_in_anim, " +
                "shore_top_in_anim, " +
                "shore_left_in_anim, " +
                "shore_right_in_anim, " +
                "shore_bottom_in_anim, " +
                "shore_isolated_anim, " +
                "water_anim_set, " +
                "shore_top_left_anim_set, " +
                "shore_top_right_anim_set, " +
                "shore_bottom_left_anim_set, " +
                "shore_bottom_right_anim_set, " +
                "shore_diag_forth_anim_set, " +
                "shore_diag_back_anim_set, " +
                "shore_top_anim_set, " +
                "shore_left_anim_set, " +
                "shore_right_anim_set, " +
                "shore_bottom_anim_set, " +
                "shore_vert_anim_set, " +
                "shore_horiz_anim_set, " +
                "shore_top_left_in_anim_set, " +
                "shore_top_right_in_anim_set, " +
                "shore_bottom_left_in_anim_set, " +
                "shore_bottom_right_in_anim_set, " +
                "shore_top_in_anim_set, " +
                "shore_left_in_anim_set, " +
                "shore_right_in_anim_set, " +
                "shore_bottom_in_anim_set, " +
                "shore_isolated_anim_set, " +
                "ground_type, " +
                "ground_data1, " +
                "ground_data2, " +
                "ground_data3, " +
                "ground_string1, " +
                "ground_string2, " +
                "ground_string3, " +
                "hall_type, " +
                "hall_data1, " +
                "hall_data2, " +
                "hall_data3, " +
                "hall_string1, " +
                "hall_string2, " +
                "hall_string3, " +
                "water_type, " +
                "water_data1, " +
                "water_data2, " +
                "water_data3, " +
                "water_string1, " +
                "water_string2, " +
                "water_string3, " +
                "wall_type, " +
                "wall_data1, " +
                "wall_data2, " +
                "wall_data3, " +
                "wall_string1, " +
                "wall_string2, " +
                "wall_string3, " +
                "goal_type, " +
                "goal_map, " +
                "goal_x, " +
                "goal_y, " +
                "darkness, " +
                "music " +
                "FROM rdungeon_floor WHERE rdungeon_floor.num = \'" + dungeonNum + "\'";

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

                int floorNum = columnCollection["floor_num"].ValueString.ToInt();
                floor.Options.TrapMin = columnCollection["trap_min"].ValueString.ToInt();
                floor.Options.TrapMax = columnCollection["trap_max"].ValueString.ToInt();
                floor.Options.ItemMin = columnCollection["item_min"].ValueString.ToInt();
                floor.Options.ItemMax = columnCollection["item_max"].ValueString.ToInt();
                floor.Options.Intricacy = columnCollection["intricacy"].ValueString.ToInt();
                floor.Options.RoomWidthMin = columnCollection["room_width_min"].ValueString.ToInt();
                floor.Options.RoomWidthMax = columnCollection["room_width_max"].ValueString.ToInt();
                floor.Options.RoomLengthMin = columnCollection["room_length_min"].ValueString.ToInt();
                floor.Options.RoomLengthMax = columnCollection["room_length_max"].ValueString.ToInt();
                floor.Options.HallTurnMin = columnCollection["hall_turn_min"].ValueString.ToInt();
                floor.Options.HallTurnMax = columnCollection["hall_turn_max"].ValueString.ToInt();
                floor.Options.HallVarMin = columnCollection["hall_var_min"].ValueString.ToInt();
                floor.Options.HallVarMax = columnCollection["hall_var_max"].ValueString.ToInt();
                floor.Options.WaterFrequency = columnCollection["water_chance"].ValueString.ToInt();
                floor.Options.Craters = columnCollection["craters"].ValueString.ToInt();
                floor.Options.CraterMinLength = columnCollection["crater_min"].ValueString.ToInt();
                floor.Options.CraterMaxLength = columnCollection["crater_max"].ValueString.ToInt();
                floor.Options.CraterFuzzy = columnCollection["crater_fuzz"].ValueString.ToBool();

                floor.NpcSpawnTime = columnCollection["npc_respawn"].ValueString.ToInt();
                floor.NpcMin = columnCollection["npc_min"].ValueString.ToInt();
                floor.NpcMax = columnCollection["npc_max"].ValueString.ToInt();

                floor.StairsX = columnCollection["stairs"].ValueString.ToInt();
                floor.mGroundX = columnCollection["ground"].ValueString.ToInt();
                floor.mGroundAltX = columnCollection["ground_alt1"].ValueString.ToInt();
                floor.mGroundAlt2X = columnCollection["ground_alt2"].ValueString.ToInt();
                floor.mTopLeftX = columnCollection["top_left"].ValueString.ToInt();
                floor.mTopCenterX = columnCollection["top_center"].ValueString.ToInt();
                floor.mTopRightX = columnCollection["top_right"].ValueString.ToInt();
                floor.mCenterLeftX = columnCollection["center_left"].ValueString.ToInt();
                floor.mCenterCenterX = columnCollection["center_center"].ValueString.ToInt();
                floor.mCenterRightX = columnCollection["center_right"].ValueString.ToInt();
                floor.mBottomLeftX = columnCollection["bottom_left"].ValueString.ToInt();
                floor.mBottomCenterX = columnCollection["bottom_center"].ValueString.ToInt();
                floor.mBottomRightX = columnCollection["bottom_right"].ValueString.ToInt();
                floor.mInnerTopLeftX = columnCollection["top_left_in"].ValueString.ToInt();
                floor.mInnerTopRightX = columnCollection["top_right_in"].ValueString.ToInt();
                floor.mInnerBottomLeftX = columnCollection["bottom_left_in"].ValueString.ToInt();
                floor.mInnerBottomRightX = columnCollection["bottom_right_in"].ValueString.ToInt();
                floor.mColumnTopX = columnCollection["col_top"].ValueString.ToInt();
                floor.mColumnCenterX = columnCollection["col_center"].ValueString.ToInt();
                floor.mColumnBottomX = columnCollection["col_bottom"].ValueString.ToInt();
                floor.mRowLeftX = columnCollection["row_left"].ValueString.ToInt();
                floor.mRowCenterX = columnCollection["row_center"].ValueString.ToInt();
                floor.mRowRightX = columnCollection["row_right"].ValueString.ToInt();
                floor.mIsolatedWallX = columnCollection["isolated"].ValueString.ToInt();

                floor.StairsSheet = columnCollection["stairs_set"].ValueString.ToInt();
                floor.mGroundSheet = columnCollection["ground_set"].ValueString.ToInt();
                floor.mGroundAltSheet = columnCollection["ground_alt1_set"].ValueString.ToInt();
                floor.mGroundAlt2Sheet = columnCollection["ground_alt2_set"].ValueString.ToInt();
                floor.mTopLeftSheet = columnCollection["top_left_set"].ValueString.ToInt();
                floor.mTopCenterSheet = columnCollection["top_center_set"].ValueString.ToInt();
                floor.mTopRightSheet = columnCollection["top_right_set"].ValueString.ToInt();
                floor.mCenterLeftSheet = columnCollection["center_left_set"].ValueString.ToInt();
                floor.mCenterCenterSheet = columnCollection["center_center_set"].ValueString.ToInt();
                floor.mCenterRightSheet = columnCollection["center_right_set"].ValueString.ToInt();
                floor.mBottomLeftSheet = columnCollection["bottom_left_set"].ValueString.ToInt();
                floor.mBottomCenterSheet = columnCollection["bottom_center_set"].ValueString.ToInt();
                floor.mBottomRightSheet = columnCollection["bottom_right_set"].ValueString.ToInt();
                floor.mInnerTopLeftSheet = columnCollection["top_left_in_set"].ValueString.ToInt();
                floor.mInnerTopRightSheet = columnCollection["top_right_in_set"].ValueString.ToInt();
                floor.mInnerBottomLeftSheet = columnCollection["bottom_left_in_set"].ValueString.ToInt();
                floor.mInnerBottomRightSheet = columnCollection["bottom_right_in_set"].ValueString.ToInt();
                floor.mColumnTopSheet = columnCollection["col_top_set"].ValueString.ToInt();
                floor.mColumnCenterSheet = columnCollection["col_center_set"].ValueString.ToInt();
                floor.mColumnBottomSheet = columnCollection["col_bottom_set"].ValueString.ToInt();
                floor.mRowLeftSheet = columnCollection["row_left_set"].ValueString.ToInt();
                floor.mRowCenterSheet = columnCollection["row_center_set"].ValueString.ToInt();
                floor.mRowRightSheet = columnCollection["row_right_set"].ValueString.ToInt();
                floor.mIsolatedWallSheet = columnCollection["isolated_set"].ValueString.ToInt();

                floor.mTopLeftAltX = columnCollection["top_left_alt"].ValueString.ToInt();
                floor.mTopCenterAltX = columnCollection["top_center_alt"].ValueString.ToInt();
                floor.mTopRightAltX = columnCollection["top_right_alt"].ValueString.ToInt();
                floor.mCenterLeftAltX = columnCollection["center_left_alt"].ValueString.ToInt();
                floor.mCenterCenterAltX = columnCollection["center_center_alt1"].ValueString.ToInt();
                floor.mCenterCenterAlt2X = columnCollection["center_center_alt2"].ValueString.ToInt();
                floor.mCenterRightAltX = columnCollection["center_right_alt"].ValueString.ToInt();
                floor.mBottomLeftAltX = columnCollection["bottom_left_alt"].ValueString.ToInt();
                floor.mBottomCenterAltX = columnCollection["bottom_center_alt"].ValueString.ToInt();
                floor.mBottomRightAltX = columnCollection["bottom_right_alt"].ValueString.ToInt();
                floor.mInnerTopLeftAltX = columnCollection["top_left_in_alt"].ValueString.ToInt();
                floor.mInnerTopRightAltX = columnCollection["top_right_in_alt"].ValueString.ToInt();
                floor.mInnerBottomLeftAltX = columnCollection["bottom_left_in_alt"].ValueString.ToInt();
                floor.mInnerBottomRightAltX = columnCollection["bottom_right_in_alt"].ValueString.ToInt();
                floor.mColumnTopAltX = columnCollection["col_top_alt"].ValueString.ToInt();
                floor.mColumnCenterAltX = columnCollection["col_center_alt"].ValueString.ToInt();
                floor.mColumnBottomAltX = columnCollection["col_bottom_alt"].ValueString.ToInt();
                floor.mRowLeftAltX = columnCollection["row_left_alt"].ValueString.ToInt();
                floor.mRowCenterAltX = columnCollection["row_center_alt"].ValueString.ToInt();
                floor.mRowRightAltX = columnCollection["row_right_alt"].ValueString.ToInt();
                floor.mIsolatedWallAltX = columnCollection["isolated_alt"].ValueString.ToInt();

                floor.mTopLeftAltSheet = columnCollection["top_left_alt_set"].ValueString.ToInt();
                floor.mTopCenterAltSheet = columnCollection["top_center_alt_set"].ValueString.ToInt();
                floor.mTopRightAltSheet = columnCollection["top_right_alt_set"].ValueString.ToInt();
                floor.mCenterLeftAltSheet = columnCollection["center_left_alt_set"].ValueString.ToInt();
                floor.mCenterCenterAltSheet = columnCollection["center_center_alt1_set"].ValueString.ToInt();
                floor.mCenterCenterAlt2Sheet = columnCollection["center_center_alt2_set"].ValueString.ToInt();
                floor.mCenterRightAltSheet = columnCollection["center_right_alt_set"].ValueString.ToInt();
                floor.mBottomLeftAltSheet = columnCollection["bottom_left_alt_set"].ValueString.ToInt();
                floor.mBottomCenterAltSheet = columnCollection["bottom_center_alt_set"].ValueString.ToInt();
                floor.mBottomRightAltSheet = columnCollection["bottom_right_alt_set"].ValueString.ToInt();
                floor.mInnerTopLeftAltSheet = columnCollection["top_left_in_alt_set"].ValueString.ToInt();
                floor.mInnerTopRightAltSheet = columnCollection["top_right_in_alt_set"].ValueString.ToInt();
                floor.mInnerBottomLeftAltSheet = columnCollection["bottom_left_in_alt_set"].ValueString.ToInt();
                floor.mInnerBottomRightAltSheet = columnCollection["bottom_right_in_alt_set"].ValueString.ToInt();
                floor.mColumnTopAltSheet = columnCollection["col_top_alt_set"].ValueString.ToInt();
                floor.mColumnCenterAltSheet = columnCollection["col_center_alt_set"].ValueString.ToInt();
                floor.mColumnBottomAltSheet = columnCollection["col_bottom_alt_set"].ValueString.ToInt();
                floor.mRowLeftAltSheet = columnCollection["row_left_alt_set"].ValueString.ToInt();
                floor.mRowCenterAltSheet = columnCollection["row_center_alt_set"].ValueString.ToInt();
                floor.mRowRightAltSheet = columnCollection["row_right_alt_set"].ValueString.ToInt();
                floor.mIsolatedWallAltSheet = columnCollection["isolated_alt_set"].ValueString.ToInt();

                floor.mWaterX = columnCollection["water"].ValueString.ToInt();
                floor.mShoreTopLeftX = columnCollection["shore_top_left"].ValueString.ToInt();
                floor.mShoreTopRightX = columnCollection["shore_top_right"].ValueString.ToInt();
                floor.mShoreBottomLeftX = columnCollection["shore_bottom_left"].ValueString.ToInt();
                floor.mShoreBottomRightX = columnCollection["shore_bottom_right"].ValueString.ToInt();
                floor.mShoreDiagonalForwardX = columnCollection["shore_diag_forth"].ValueString.ToInt();
                floor.mShoreDiagonalBackX = columnCollection["shore_diag_back"].ValueString.ToInt();
                floor.mShoreTopX = columnCollection["shore_top"].ValueString.ToInt();
                floor.mShoreLeftX = columnCollection["shore_left"].ValueString.ToInt();
                floor.mShoreRightX = columnCollection["shore_right"].ValueString.ToInt();
                floor.mShoreBottomX = columnCollection["shore_bottom"].ValueString.ToInt();
                floor.mShoreVerticalX = columnCollection["shore_vert"].ValueString.ToInt();
                floor.mShoreHorizontalX = columnCollection["shore_horiz"].ValueString.ToInt();
                floor.mShoreInnerTopLeftX = columnCollection["shore_top_left_in"].ValueString.ToInt();
                floor.mShoreInnerTopRightX = columnCollection["shore_top_right_in"].ValueString.ToInt();
                floor.mShoreInnerBottomLeftX = columnCollection["shore_bottom_left_in"].ValueString.ToInt();
                floor.mShoreInnerBottomRightX = columnCollection["shore_bottom_right_in"].ValueString.ToInt();
                floor.mShoreInnerTopX = columnCollection["shore_top_in"].ValueString.ToInt();
                floor.mShoreInnerLeftX = columnCollection["shore_left_in"].ValueString.ToInt();
                floor.mShoreInnerRightX = columnCollection["shore_right_in"].ValueString.ToInt();
                floor.mShoreInnerBottomX = columnCollection["shore_bottom_in"].ValueString.ToInt();
                floor.mShoreSurroundedX = columnCollection["shore_isolated"].ValueString.ToInt();

                floor.mWaterSheet = columnCollection["water_set"].ValueString.ToInt();
                floor.mShoreTopLeftSheet = columnCollection["shore_top_left_set"].ValueString.ToInt();
                floor.mShoreTopRightSheet = columnCollection["shore_top_right_set"].ValueString.ToInt();
                floor.mShoreBottomLeftSheet = columnCollection["shore_bottom_left_set"].ValueString.ToInt();
                floor.mShoreBottomRightSheet = columnCollection["shore_bottom_right_set"].ValueString.ToInt();
                floor.mShoreDiagonalForwardSheet = columnCollection["shore_diag_forth_set"].ValueString.ToInt();
                floor.mShoreDiagonalBackSheet = columnCollection["shore_diag_back_set"].ValueString.ToInt();
                floor.mShoreTopSheet = columnCollection["shore_top_set"].ValueString.ToInt();
                floor.mShoreLeftSheet = columnCollection["shore_left_set"].ValueString.ToInt();
                floor.mShoreRightSheet = columnCollection["shore_right_set"].ValueString.ToInt();
                floor.mShoreBottomSheet = columnCollection["shore_bottom_set"].ValueString.ToInt();
                floor.mShoreVerticalSheet = columnCollection["shore_vert_set"].ValueString.ToInt();
                floor.mShoreHorizontalSheet = columnCollection["shore_horiz_set"].ValueString.ToInt();
                floor.mShoreInnerTopLeftSheet = columnCollection["shore_top_left_in_set"].ValueString.ToInt();
                floor.mShoreInnerTopRightSheet = columnCollection["shore_top_right_in_set"].ValueString.ToInt();
                floor.mShoreInnerBottomLeftSheet = columnCollection["shore_bottom_left_in_set"].ValueString.ToInt();
                floor.mShoreInnerBottomRightSheet = columnCollection["shore_bottom_right_in_set"].ValueString.ToInt();
                floor.mShoreInnerTopSheet = columnCollection["shore_top_in_set"].ValueString.ToInt();
                floor.mShoreInnerLeftSheet = columnCollection["shore_left_in_set"].ValueString.ToInt();
                floor.mShoreInnerRightSheet = columnCollection["shore_right_in_set"].ValueString.ToInt();
                floor.mShoreInnerBottomSheet = columnCollection["shore_bottom_in_set"].ValueString.ToInt();
                floor.mShoreSurroundedSheet = columnCollection["shore_isolated_set"].ValueString.ToInt();

                floor.mWaterAnimX = columnCollection["water_anim"].ValueString.ToInt();
                floor.mShoreTopLeftAnimX = columnCollection["shore_top_left_anim"].ValueString.ToInt();
                floor.mShoreTopRightAnimX = columnCollection["shore_top_right_anim"].ValueString.ToInt();
                floor.mShoreBottomLeftAnimX = columnCollection["shore_bottom_left_anim"].ValueString.ToInt();
                floor.mShoreBottomRightAnimX = columnCollection["shore_bottom_right_anim"].ValueString.ToInt();
                floor.mShoreDiagonalForwardAnimX = columnCollection["shore_diag_forth_anim"].ValueString.ToInt();
                floor.mShoreDiagonalBackAnimX = columnCollection["shore_diag_back_anim"].ValueString.ToInt();
                floor.mShoreTopAnimX = columnCollection["shore_top_anim"].ValueString.ToInt();
                floor.mShoreLeftAnimX = columnCollection["shore_left_anim"].ValueString.ToInt();
                floor.mShoreRightAnimX = columnCollection["shore_right_anim"].ValueString.ToInt();
                floor.mShoreBottomAnimX = columnCollection["shore_bottom_anim"].ValueString.ToInt();
                floor.mShoreVerticalAnimX = columnCollection["shore_vert_anim"].ValueString.ToInt();
                floor.mShoreHorizontalAnimX = columnCollection["shore_horiz_anim"].ValueString.ToInt();
                floor.mShoreInnerTopLeftAnimX = columnCollection["shore_top_left_in_anim"].ValueString.ToInt();
                floor.mShoreInnerTopRightAnimX = columnCollection["shore_top_right_in_anim"].ValueString.ToInt();
                floor.mShoreInnerBottomLeftAnimX = columnCollection["shore_bottom_left_in_anim"].ValueString.ToInt();
                floor.mShoreInnerBottomRightAnimX = columnCollection["shore_bottom_right_in_anim"].ValueString.ToInt();
                floor.mShoreInnerTopAnimX = columnCollection["shore_top_in_anim"].ValueString.ToInt();
                floor.mShoreInnerLeftAnimX = columnCollection["shore_left_in_anim"].ValueString.ToInt();
                floor.mShoreInnerRightAnimX = columnCollection["shore_right_in_anim"].ValueString.ToInt();
                floor.mShoreInnerBottomAnimX = columnCollection["shore_bottom_in_anim"].ValueString.ToInt();
                floor.mShoreSurroundedAnimX = columnCollection["shore_isolated_anim"].ValueString.ToInt();

                floor.mWaterAnimSheet = columnCollection["water_anim_set"].ValueString.ToInt();
                floor.mShoreTopLeftAnimSheet = columnCollection["shore_top_left_anim_set"].ValueString.ToInt();
                floor.mShoreTopRightAnimSheet = columnCollection["shore_top_right_anim_set"].ValueString.ToInt();
                floor.mShoreBottomLeftAnimSheet = columnCollection["shore_bottom_left_anim_set"].ValueString.ToInt();
                floor.mShoreBottomRightAnimSheet = columnCollection["shore_bottom_right_anim_set"].ValueString.ToInt();
                floor.mShoreDiagonalForwardAnimSheet = columnCollection["shore_diag_forth_anim_set"].ValueString.ToInt();
                floor.mShoreDiagonalBackAnimSheet = columnCollection["shore_diag_back_anim_set"].ValueString.ToInt();
                floor.mShoreTopAnimSheet = columnCollection["shore_top_anim_set"].ValueString.ToInt();
                floor.mShoreLeftAnimSheet = columnCollection["shore_left_anim_set"].ValueString.ToInt();
                floor.mShoreRightAnimSheet = columnCollection["shore_right_anim_set"].ValueString.ToInt();
                floor.mShoreBottomAnimSheet = columnCollection["shore_bottom_anim_set"].ValueString.ToInt();
                floor.mShoreVerticalAnimSheet = columnCollection["shore_vert_anim_set"].ValueString.ToInt();
                floor.mShoreHorizontalAnimSheet = columnCollection["shore_horiz_anim_set"].ValueString.ToInt();
                floor.mShoreInnerTopLeftAnimSheet = columnCollection["shore_top_left_in_anim_set"].ValueString.ToInt();
                floor.mShoreInnerTopRightAnimSheet = columnCollection["shore_top_right_in_anim_set"].ValueString.ToInt();
                floor.mShoreInnerBottomLeftAnimSheet = columnCollection["shore_bottom_left_in_anim_set"].ValueString.ToInt();
                floor.mShoreInnerBottomRightAnimSheet = columnCollection["shore_bottom_right_in_anim_set"].ValueString.ToInt();
                floor.mShoreInnerTopAnimSheet = columnCollection["shore_top_in_anim_set"].ValueString.ToInt();
                floor.mShoreInnerLeftAnimSheet = columnCollection["shore_left_in_anim_set"].ValueString.ToInt();
                floor.mShoreInnerRightAnimSheet = columnCollection["shore_right_in_anim_set"].ValueString.ToInt();
                floor.mShoreInnerBottomAnimSheet = columnCollection["shore_bottom_in_anim_set"].ValueString.ToInt();
                floor.mShoreSurroundedAnimSheet = columnCollection["shore_isolated_anim_set"].ValueString.ToInt();

                floor.GroundTile.Type = (Enums.TileType)columnCollection["ground_type"].ValueString.ToInt();
                floor.GroundTile.Data1 = columnCollection["ground_data1"].ValueString.ToInt();
                floor.GroundTile.Data2 = columnCollection["ground_data2"].ValueString.ToInt();
                floor.GroundTile.Data3 = columnCollection["ground_data3"].ValueString.ToInt();
                floor.GroundTile.String1 = columnCollection["ground_string1"].ValueString;
                floor.GroundTile.String2 = columnCollection["ground_string2"].ValueString;
                floor.GroundTile.String3 = columnCollection["ground_string3"].ValueString;

                floor.HallTile.Type = (Enums.TileType)columnCollection["hall_type"].ValueString.ToInt();
                floor.HallTile.Data1 = columnCollection["hall_data1"].ValueString.ToInt();
                floor.HallTile.Data2 = columnCollection["hall_data2"].ValueString.ToInt();
                floor.HallTile.Data3 = columnCollection["hall_data3"].ValueString.ToInt();
                floor.HallTile.String1 = columnCollection["hall_string1"].ValueString;
                floor.HallTile.String2 = columnCollection["hall_string2"].ValueString;
                floor.HallTile.String3 = columnCollection["hall_string3"].ValueString;

                floor.WaterTile.Type = (Enums.TileType)columnCollection["water_type"].ValueString.ToInt();
                floor.WaterTile.Data1 = columnCollection["water_data1"].ValueString.ToInt();
                floor.WaterTile.Data2 = columnCollection["water_data2"].ValueString.ToInt();
                floor.WaterTile.Data3 = columnCollection["water_data3"].ValueString.ToInt();
                floor.WaterTile.String1 = columnCollection["water_string1"].ValueString;
                floor.WaterTile.String2 = columnCollection["water_string2"].ValueString;
                floor.WaterTile.String3 = columnCollection["water_string3"].ValueString;

                floor.WallTile.Type = (Enums.TileType)columnCollection["wall_type"].ValueString.ToInt();
                floor.WallTile.Data1 = columnCollection["wall_data1"].ValueString.ToInt();
                floor.WallTile.Data2 = columnCollection["wall_data2"].ValueString.ToInt();
                floor.WallTile.Data3 = columnCollection["wall_data3"].ValueString.ToInt();
                floor.WallTile.String1 = columnCollection["wall_string1"].ValueString;
                floor.WallTile.String2 = columnCollection["wall_string2"].ValueString;
                floor.WallTile.String3 = columnCollection["wall_string3"].ValueString;

                floor.GoalType = (Enums.RFloorGoalType)columnCollection["goal_type"].ValueString.ToInt();
                floor.GoalMap = columnCollection["goal_map"].ValueString.ToInt();
                floor.GoalX = columnCollection["goal_x"].ValueString.ToInt();
                floor.GoalY = columnCollection["goal_y"].ValueString.ToInt();
                floor.Darkness = columnCollection["darkness"].ValueString.ToInt();
                floor.Music = columnCollection["music"].ValueString;

                string query2 = "SELECT item_index, " +
                    "item_num, " +
                    "min_val, " +
                    "max_val, " +
                    "chance, " +
                    "sticky_chance, " +
                    "tag, " +
                    "hidden, " +
                    "on_ground, " +
                    "on_water, " +
                    "on_wall " +
                    "FROM rdungeon_item WHERE rdungeon_item.num = \'" + dungeonNum + "\' AND rdungeon_item.floor_num = \'" + floorNum + "\'";

                List<DataColumnCollection> columnCollections2 = database.RetrieveRows(query2);
                if (columnCollections2 == null) columnCollections2 = new List<DataColumnCollection>();
                foreach (DataColumnCollection columnCollection2 in columnCollections2)
                {
                    RDungeonItem item = new RDungeonItem();
                    int itemInd = columnCollection2["item_index"].ValueString.ToInt();
                    item.ItemNum = columnCollection2["item_num"].ValueString.ToInt();
                    item.MinAmount = columnCollection2["min_val"].ValueString.ToInt();
                    item.MaxAmount = columnCollection2["max_val"].ValueString.ToInt();
                    item.AppearanceRate = columnCollection2["chance"].ValueString.ToInt();
                    item.StickyRate = columnCollection2["sticky_chance"].ValueString.ToInt();
                    item.Tag = columnCollection2["tag"].ValueString;
                    item.Hidden = columnCollection2["hidden"].ValueString.ToBool();
                    item.OnGround = columnCollection2["on_ground"].ValueString.ToBool();
                    item.OnWater = columnCollection2["on_water"].ValueString.ToBool();
                    item.OnWall = columnCollection2["on_wall"].ValueString.ToBool();

                    floor.Items.Add(item);
                }

                query2 = "SELECT npc_index, " +
                    "npc_num, " +
                    "min_level, " +
                    "max_level, " +
                    "chance, " +
                    "status, " +
                    "status_counter, " +
                    "status_chance " +
                    "FROM rdungeon_npc WHERE rdungeon_npc.num = \'" + dungeonNum + "\' AND rdungeon_npc.floor_num = \'" + floorNum + "\'";

                columnCollections2 = database.RetrieveRows(query2);
                if (columnCollections2 == null) columnCollections2 = new List<DataColumnCollection>();
                foreach (DataColumnCollection columnCollection2 in columnCollections2)
                {
                    MapNpcPreset npc = new MapNpcPreset();
                    int npcInd = columnCollection2["npc_index"].ValueString.ToInt();
                    npc.NpcNum = columnCollection2["npc_num"].ValueString.ToInt();
                    npc.MinLevel = columnCollection2["min_level"].ValueString.ToInt();
                    npc.MaxLevel = columnCollection2["max_level"].ValueString.ToInt();
                    npc.AppearanceRate = columnCollection2["chance"].ValueString.ToInt();
                    npc.StartStatus = (Enums.StatusAilment)columnCollection2["status"].ValueString.ToInt();
                    npc.StartStatusCounter = columnCollection2["status_counter"].ValueString.ToInt();
                    npc.StartStatusChance = columnCollection2["status_chance"].ValueString.ToInt();

                    floor.Npcs.Add(npc);
                }

                query2 = "SELECT tile_index, " +
                    "tile_type, " +
                    "data1, " +
                    "data2, " +
                    "data3, " +
                    "string1, " +
                    "string2, " +
                    "string3, " +
                    "ground, " +
                    "mask1, " +
                    "mask2, " +
                    "fringe1, " +
                    "fringe2, " +
                    "ground_set, " +
                    "mask1_set, " +
                    "mask2_set, " +
                    "fringe1_set, " +
                    "fringe2_set, " +
                    "ground_anim, " +
                    "mask1_anim, " +
                    "mask2_anim, " +
                    "fringe1_anim, " +
                    "fringe2_anim, " +
                    "ground_anim_set, " +
                    "mask1_anim_set, " +
                    "mask2_anim_set, " +
                    "fringe1_anim_set, " +
                    "fringe2_anim_set, " +
                    "rdungeon_value, " +
                    "chance " +
                    "FROM rdungeon_tile WHERE rdungeon_tile.num = \'" + dungeonNum + "\' AND rdungeon_tile.floor_num = \'" + floorNum + "\'";

                columnCollections2 = database.RetrieveRows(query2);
                if (columnCollections2 == null) columnCollections2 = new List<DataColumnCollection>();
                foreach (DataColumnCollection columnCollection2 in columnCollections2)
                {
                    RDungeonTrap tile = new RDungeonTrap();
                    int tileInd = columnCollection2["tile_index"].ValueString.ToInt();
                    tile.Type = (Enums.TileType)columnCollection2["tile_type"].ValueString.ToInt();
                    tile.Data1 = columnCollection2["data1"].ValueString.ToInt();
                    tile.Data2 = columnCollection2["data2"].ValueString.ToInt();
                    tile.Data3 = columnCollection2["data3"].ValueString.ToInt();
                    tile.String1 = columnCollection2["string1"].ValueString;
                    tile.String2 = columnCollection2["string2"].ValueString;
                    tile.String3 = columnCollection2["string3"].ValueString;
                    tile.Ground = columnCollection2["ground"].ValueString.ToInt();
                    tile.Mask = columnCollection2["mask1"].ValueString.ToInt();
                    tile.Mask2 = columnCollection2["mask2"].ValueString.ToInt();
                    tile.Fringe = columnCollection2["fringe1"].ValueString.ToInt();
                    tile.Fringe2 = columnCollection2["fringe2"].ValueString.ToInt();
                    tile.GroundSet = columnCollection2["ground_set"].ValueString.ToInt();
                    tile.MaskSet = columnCollection2["mask1_set"].ValueString.ToInt();
                    tile.Mask2Set = columnCollection2["mask2_set"].ValueString.ToInt();
                    tile.FringeSet = columnCollection2["fringe1_set"].ValueString.ToInt();
                    tile.Fringe2Set = columnCollection2["fringe2_set"].ValueString.ToInt();
                    tile.GroundAnim = columnCollection2["ground_anim"].ValueString.ToInt();
                    tile.Anim = columnCollection2["mask1_anim"].ValueString.ToInt();
                    tile.M2Anim = columnCollection2["mask2_anim"].ValueString.ToInt();
                    tile.FAnim = columnCollection2["fringe1_anim"].ValueString.ToInt();
                    tile.F2Anim = columnCollection2["fringe2_anim"].ValueString.ToInt();
                    tile.GroundAnimSet = columnCollection2["ground_anim_set"].ValueString.ToInt();
                    tile.AnimSet = columnCollection2["mask1_anim_set"].ValueString.ToInt();
                    tile.M2AnimSet = columnCollection2["mask2_anim_set"].ValueString.ToInt();
                    tile.FAnimSet = columnCollection2["fringe1_anim_set"].ValueString.ToInt();
                    tile.F2AnimSet = columnCollection2["fringe2_anim_set"].ValueString.ToInt();
                    tile.RDungeonMapValue = columnCollection2["rdungeon_value"].ValueString.ToInt();
                    tile.AppearanceRate = columnCollection2["chance"].ValueString.ToInt();

                    floor.SpecialTiles.Add(tile);
                }

                query2 = "SELECT weather_index, " +
                    "weather_type " +
                    "FROM rdungeon_weather WHERE rdungeon_weather.num = \'" + dungeonNum + "\' AND rdungeon_weather.floor_num = \'" + floorNum + "\'";

                columnCollections2 = database.RetrieveRows(query2);
                if (columnCollections2 == null) columnCollections2 = new List<DataColumnCollection>();
                foreach (DataColumnCollection columnCollection2 in columnCollections2)
                {

                    int weatherInd = columnCollection2["weather_index"].ValueString.ToInt();
                    Enums.Weather weather = (Enums.Weather)columnCollection2["weather_type"].ValueString.ToInt();

                    floor.Weather.Add(weather);
                }

                query2 = "SELECT chamber_index, " +
                    "chamber_num, " +
                    "string1, " +
                    "string2, " +
                    "string3 " +
                    "FROM rdungeon_chamber WHERE rdungeon_chamber.num = \'" + dungeonNum + "\' AND rdungeon_chamber.floor_num = \'" + floorNum + "\'";

                columnCollections2 = database.RetrieveRows(query2);
                if (columnCollections2 == null) columnCollections2 = new List<DataColumnCollection>();
                foreach (DataColumnCollection columnCollection2 in columnCollections2)
                {
                    RDungeonPresetChamber chamber = new RDungeonPresetChamber();
                    int chamberInd = columnCollection2["chamber_index"].ValueString.ToInt();
                    chamber.ChamberNum = columnCollection2["chamber_num"].ValueString.ToInt();
                    chamber.String1 = columnCollection2["string1"].ValueString;
                    chamber.String2 = columnCollection2["string2"].ValueString;
                    chamber.String3 = columnCollection2["string3"].ValueString;

                    floor.Options.Chambers.Add(chamber);
                }

                dungeon.Floors.Add(floor);
            }

            rdungeons.RDungeons.Add(dungeonNum, dungeon);
        }
コード例 #20
0
ファイル: MapInteractions.cs プロジェクト: pzaps/Server
        public static void SpawnNpcInRange(IMap map, int x, int y, int range, PacketHitList hitlist)
        {
            if (map.Npc.Count == 0) return;

            if (map.SpawnMarker >= map.Npc.Count) map.SpawnMarker = map.Npc.Count - 1;

            for (int i = 0; i < 100; i++) {
                if (Server.Math.Rand(0, 100) < map.Npc[map.SpawnMarker].AppearanceRate && map.WillSpawnNow(map.Npc[map.SpawnMarker])) {
                    break;
                }
                map.SpawnMarker++;
                if (map.SpawnMarker >= map.Npc.Count) map.SpawnMarker = 0;
            }

            MapNpcPreset spawningNpc = new MapNpcPreset();
            spawningNpc.NpcNum = map.Npc[map.SpawnMarker].NpcNum;
            spawningNpc.MinLevel = map.Npc[map.SpawnMarker].MinLevel;
            spawningNpc.MaxLevel = map.Npc[map.SpawnMarker].MaxLevel;
            spawningNpc.StartStatus = Enums.StatusAilment.OK;

            for (int i = 1; i <= 500; i++) {
                int X = Server.Math.Rand(x - range, x + range + 1);
                int Y = Server.Math.Rand(y - range, y + range + 1);

                // Check if the tile is walkable
                if (X >= 0 && X <= map.MaxX && Y >= 0 && Y <= map.MaxY && map.Tile[X, Y].Type == Enums.TileType.Walkable) {
                    spawningNpc.SpawnX = X;
                    spawningNpc.SpawnY = Y;
                    break;
                }
            }

            if (spawningNpc.SpawnX > -1) map.SpawnNpc(spawningNpc);

            map.SpawnMarker++;
            if (map.SpawnMarker >= map.Npc.Count) map.SpawnMarker = 0;
        }
コード例 #21
0
ファイル: BasicMap.cs プロジェクト: SupaFresh/Server
 public MapNpc SpawnNpc(MapNpcPreset npc, bool checkSight)
 {
     return(SpawnNpc(npc, checkSight, true));
 }
コード例 #22
0
 public void Add(MapNpcPreset npcPreset)
 {
     npcPresets.Add(npcPreset);
     rawMap.Npc.Add(npcPreset.RawNpcPreset);
 }
コード例 #23
0
 public void Add(MapNpcPreset npcPreset)
 {
     npcPresets.Add(npcPreset);
     rawMap.Npc.Add(npcPreset.RawNpcPreset);
 }
コード例 #24
0
 public void Remove(MapNpcPreset npcPreset)
 {
     npcPresets.Remove(npcPreset);
     rawMap.Npc.Remove(npcPreset.RawNpcPreset);
 }
コード例 #25
0
ファイル: BossBattles.cs プロジェクト: Festivo/Scripts
        public static void RunPostIntroStoryBossBattle(Client client, string tag)
        {
            if (client.Player.Map.MapType != Enums.MapType.Instanced) return;
            InstancedMap map = client.Player.Map as InstancedMap;
            switch (map.MapBase) {
                case 1287: {//Tiny Grotto Depths

                        //if (map.Name == "Tiny Grotto Depths") {
                        MapNpcPreset npc = new MapNpcPreset();
                        npc.SpawnX = 9;
                        npc.SpawnY = 3;
                        npc.NpcNum = 502;
                        npc.MinLevel = 6;
                        npc.MaxLevel = 6;
                        map.SpawnNpc(npc);
                        //}
                    }
                    break;
                case 114: { //sour root miniboss

                        //if (map.Name == "Sour Root Chamber") {
                        MapNpcPreset npc = new MapNpcPreset();
                        npc.SpawnX = 7;
                        npc.SpawnY = 5;
                        npc.NpcNum = 481;
                        npc.MinLevel = 14;
                        npc.MaxLevel = 14;
                        map.SpawnNpc(npc);
                        //}
                    }
                    break;
                case 115: { // sour root boss

                        //if (map.Name == "Sour Root Lair") {
                        MapNpcPreset npc = new MapNpcPreset();
                        npc.SpawnX = 10;
                        npc.SpawnY = 3;
                        npc.NpcNum = 480;
                        npc.MinLevel = 17;
                        npc.MaxLevel = 17;
                        map.SpawnNpc(npc);
                        //}
                    }
                    break;
                case 255: { // seaside cavern

                        //if (map.Name == "Seaside Cavern Pit") {
                        MapNpcPreset npc = new MapNpcPreset();
                        npc.SpawnX = 9;
                        npc.SpawnY = 5;
                        npc.NpcNum = 487;
                        npc.MaxLevel = 15;
                        npc.MinLevel = 15;
                        map.SpawnNpc(npc);
                        //}
                    }
                    break;
                //                case "ElectrostasisTowerA1": {
                //
                //                        if (map.Name == "Electrostasis Tower Chamber") {
                //                            int nosepassLevel = 1;
                //                            map.Npc[1].SpawnX = 8;
                //                            map.Npc[1].SpawnY = 24;
                //                            map.Npc[1].NpcNum = 587;
                //map.Npc[1].Level = nosepassLevel;

                //                            map.Npc[2].SpawnX = 13;
                //                            map.Npc[2].SpawnY = 22;
                //                            map.Npc[2].NpcNum = 587;
                //map.Npc[2].Level = nosepassLevel;

                //                            map.Npc[3].SpawnX = 7;
                //                            map.Npc[3].SpawnY = 20;
                //                            map.Npc[3].NpcNum = 587;
                //map.Npc[3].Level = nosepassLevel;

                //                            map.Npc[4].SpawnX = 15;
                //                            map.Npc[4].SpawnY = 19;
                //                            map.Npc[4].NpcNum = 587;
                //map.Npc[4].Level = nosepassLevel;

                //                            for (int i = 1; i <= 4; i++) {
                //map.SpawnNpc(map.Npc[i]);
                //                                map.ActiveNpc[i].Target = client;
                //                            }
                //                        }
                //                    }
                //                    break;
                case 1288: { // cliffside

                        //if (map.Name == "Cliffside Relic") {
                        MapNpcPreset npc = new MapNpcPreset();
                        npc.SpawnX = 9;
                        npc.SpawnY = 3;
                        npc.NpcNum = 397;
                        npc.MinLevel = 30;
                        npc.MaxLevel = 30;
                        map.SpawnNpc(npc);
                        //}
                    }
                    break;
                case 531: { // thunderstorm forest

                        if (tag == "ThunderstormForest") {
                            MapNpcPreset npc = new MapNpcPreset();
                            npc.SpawnX = 9;
                            npc.SpawnY = 6;
                            npc.NpcNum = 139;
                            npc.MinLevel = 20;
                            npc.MaxLevel = 20;
                            map.SpawnNpc(npc);
                        } else if (tag == "ThunderstormForestPart2") {
                            MapNpcPreset npc = new MapNpcPreset();
                            npc.SpawnX = 9;
                            npc.SpawnY = 6;
                            npc.NpcNum = 177;
                            npc.MinLevel = 30;
                            npc.MaxLevel = 30;
                            map.SpawnNpc(npc);
                        }
                    }
                    break;
                case 1248: { // sauna cave miniboss

                        //if (map.Name == "Sauna Cavern Chamber") {
                        MapNpcPreset npc = new MapNpcPreset();
                        npc.SpawnX = 9;
                        npc.SpawnY = 6;
                        npc.NpcNum = 381;
                        npc.MinLevel = 40;
                        npc.MaxLevel = 40;
                        map.SpawnNpc(npc);
                        //}
                    }
                    break;
                case 1263: { //sauna cave boss

                        //if (map.Name == "Sauna Cavern Source") {
                        MapNpcPreset npc = new MapNpcPreset();
                        npc.SpawnX = 11;
                        npc.SpawnY = 4;
                        npc.NpcNum = 389;
                        npc.MinLevel = 45;
                        npc.MaxLevel = 45;
                        map.SpawnNpc(npc);
                        //}
                    }
                    break;
                case 1526: { //Deep Winden Forest Clearing

                        //if (map.Name == "Deep Winden Forest Clearing") {
                        MapNpcPreset npc = new MapNpcPreset();
                        npc.SpawnX = 9;
                        npc.SpawnY = 8;
                        npc.MinLevel = 40;
                        npc.MaxLevel = 40;
                        npc.NpcNum = 1060;

                        map.SpawnNpc(npc);

                        MapNpcPreset minion = new MapNpcPreset();
                        npc.SpawnX = 8;
                        npc.SpawnY = 6;
                        npc.MinLevel = 35;
                        npc.MaxLevel = 35;

                        map.SpawnNpc(minion);

                        minion.SpawnX = 10;

                        map.SpawnNpc(minion);

                        minion.SpawnX = 11;
                        minion.SpawnY = 7;

                        map.SpawnNpc(minion);

                        minion.SpawnX = 7;

                        map.SpawnNpc(minion);
                        //}
                    }
                    break;
                case 1744: { //Inferno Volcano Core

                        //if (map.Name == "Inferno Volcano Core") {
                        MapNpcPreset npc = new MapNpcPreset();
                        npc.SpawnX = 9;
                        npc.SpawnY = 4;
                        npc.MinLevel = 80;
                        npc.MaxLevel = 80;
                        npc.NpcNum = 1220;

                        map.SpawnNpc(npc);
                        //}
                    }
                    break;
                case 1745: { //Mysterious Jungle Undergrowth

                        //if (map.Name == "Mysterious Jungle Undergrowth") {
                        MapNpcPreset npc = new MapNpcPreset();
                        npc.SpawnX = 10;
                        npc.SpawnY = 7;
                        npc.MinLevel = 85;
                        npc.MaxLevel = 85;
                        npc.NpcNum = 1219;

                        map.SpawnNpc(npc);
                        //}
                    }
                    break;
                case 1392: { //crystal ruins

                        //if (map.Name == "Crystal Ruins Hall") {
                        MapNpcPreset npc = new MapNpcPreset();
                        npc.SpawnX = 10;
                        npc.SpawnY = 5;
                        npc.NpcNum = 145;
                        npc.MinLevel = 45;
                        npc.MaxLevel = 45;
                        map.SpawnNpc(npc);
                        //}
                    }
                    break;
                case 1394: { //crystal castle

                        //if (map.Name == "Crystal Castle Throne") {
                        MapNpcPreset npc = new MapNpcPreset();
                        npc.SpawnX = 10;
                        npc.SpawnY = 4;
                        npc.NpcNum = 578;
                        npc.MinLevel = 55;
                        npc.MaxLevel = 55;

                        map.SpawnNpc(npc);

                        MapNpcPreset minion = new MapNpcPreset();
                        minion.SpawnX = 6;
                        minion.SpawnY = 5;
                        minion.NpcNum = 812;
                        minion.MinLevel = 55;
                        minion.MaxLevel = 55;

                        map.SpawnNpc(minion);

                        minion.SpawnX = 14;

                        map.SpawnNpc(minion);
                        //}
                    }
                    break;
                case 1362: { // southern sea

                        //if (map.Name == "Southern Sea Depths") {
                        MapNpcPreset npc = new MapNpcPreset();
                        npc.SpawnX = 7;
                        npc.SpawnY = 9;
                        npc.NpcNum = 640;
                        npc.MinLevel = 60;
                        npc.MaxLevel = 60;
                        map.SpawnNpc(npc);
                        npc.SpawnX = 10;
                        npc.SpawnY = 9;
                        npc.NpcNum = 641;
                        map.SpawnNpc(npc);
                        //}
                    }
                    break;
                case 1994: { // Boss Rush Test Map

                        //if (map.Name == "Boss Rush Test Map") {
                        MapNpcPreset npc = new MapNpcPreset();
                        npc.SpawnX = 9;
                        npc.SpawnY = 5;
                        npc.NpcNum = 1401;
                        npc.MinLevel = 30;
                        npc.MaxLevel = 30;
                        map.SpawnNpc(npc);
                        npc.SpawnX = 10;
                        npc.SpawnY = 4;
                        npc.NpcNum = 1402;
                        map.SpawnNpc(npc);
                        npc.SpawnX = 8;
                        npc.SpawnY = 4;
                        npc.NpcNum = 1403;
                        map.SpawnNpc(npc);
                        //}
                    }
                    break;
                case 1990: { // Boss Rush 2

                        //if (map.Name == "Boss Rush 2") {
                        MapNpcPreset npc = new MapNpcPreset();
                        npc.SpawnX = 9;
                        npc.SpawnY = 7;
                        npc.NpcNum = 1404;
                        npc.MinLevel = 30;
                        npc.MaxLevel = 30;
                        map.SpawnNpc(npc);
                        npc.SpawnX = 8;
                        npc.SpawnY = 8;
                        npc.NpcNum = 1405;
                        map.SpawnNpc(npc);
                        npc.SpawnX = 10;
                        npc.SpawnY = 8;
                        npc.NpcNum = 1406;
                        map.SpawnNpc(npc);
                        //}
                    }
                    break;
                case 539: { // Boss Rush 4

                        //if (map.Name == "Boss Rush 4") {
                        MapNpcPreset npc = new MapNpcPreset();
                        npc.SpawnX = 10;
                        npc.SpawnY = 6;
                        npc.NpcNum = 1410;
                        npc.MinLevel = 30;
                        npc.MaxLevel = 30;
                        map.SpawnNpc(npc);
                        npc.SpawnX = 10;
                        npc.SpawnY = 3;
                        npc.NpcNum = 1411;
                        map.SpawnNpc(npc);
                        npc.SpawnX = 16;
                        npc.SpawnY = 5;
                        npc.NpcNum = 1412;
                        map.SpawnNpc(npc);
                        npc.SpawnX = 4;
                        npc.SpawnY = 5;
                        npc.NpcNum = 1413;
                        map.SpawnNpc(npc);
                        //}
                    }
                    break;
                case 496: { // Boss Rush 5

                        //if (map.Name == "Boss Rush 4") {
                        MapNpcPreset npc = new MapNpcPreset();
                        npc.SpawnX = 9;
                        npc.SpawnY = 10;
                        npc.NpcNum = 1414;
                        npc.MinLevel = 30;
                        npc.MaxLevel = 30;
                        map.SpawnNpc(npc);
                        npc.SpawnX = 10;
                        npc.SpawnY = 10;
                        npc.NpcNum = 1415;
                        map.SpawnNpc(npc);
                        npc.SpawnX = 7;
                        npc.SpawnY = 8;
                        npc.NpcNum = 1416;
                        map.SpawnNpc(npc);
                        npc.SpawnX = 12;
                        npc.SpawnY = 8;
                        npc.NpcNum = 1417;
                        map.SpawnNpc(npc);
                        //}
                    }
                    break;
                case 1292: { //barricade miniboss

                        map.SetAttribute(5, 9, Enums.TileType.Walkable, 0, 0, 0, "", "", "");
                        Messenger.SendTile(5, 9, map);

                        map.SetTile(5, 10, 5, 4, 1);
                        map.SetAttribute(5, 10, Enums.TileType.Blocked, 0, 0, 0, "", "", "");
                        Messenger.SendTile(5, 10, map);
                        bool test = false;
                        if (Ranks.IsAllowed(client, Enums.Rank.Mapper) && test) {
                            Messenger.PlayerMsg(client, "This is a test battle to investigate the freezes in the Mt. Barricade Mini boss battle", Text.Black);
                            MapNpcPreset npc = new MapNpcPreset();
                            //Hariyama
                            npc.NpcNum = 1;
                            npc.MinLevel = 50;
                            npc.MaxLevel = 50;
                            npc.SpawnX = 5;
                            npc.SpawnY = 6;
                            map.SpawnNpc(npc);
                            npc.SpawnX = 10;
                            npc.SpawnY = 2;
                            map.SpawnNpc(npc);
                            npc.SpawnX = 12;
                            npc.SpawnY = 11;
                            map.SpawnNpc(npc);
                            npc.MinLevel = 40;
                            npc.MaxLevel = 40;
                            npc.SpawnX = 10;
                            npc.SpawnY = 5;
                            map.SpawnNpc(npc);
                            npc.SpawnX = 14;
                            npc.SpawnY = 7;
                            map.SpawnNpc(npc);
                            npc.SpawnX = 8;
                            npc.SpawnY = 8;
                            map.SpawnNpc(npc);
                        } else {
                            MapNpcPreset npc = new MapNpcPreset();
                            //Hariyama
                            npc.NpcNum = 472;
                            npc.MinLevel = 50;
                            npc.MaxLevel = 50;
                            npc.SpawnX = 5;
                            npc.SpawnY = 6;
                            map.SpawnNpc(npc);
                            npc.SpawnX = 10;
                            npc.SpawnY = 2;
                            map.SpawnNpc(npc);
                            npc.SpawnX = 12;
                            npc.SpawnY = 11;
                            map.SpawnNpc(npc);

                            //Makuhita
                            npc.NpcNum = 183;
                            npc.MinLevel = 40;
                            npc.MaxLevel = 40;
                            npc.SpawnX = 10;
                            npc.SpawnY = 5;
                            map.SpawnNpc(npc);
                            npc.SpawnX = 14;
                            npc.SpawnY = 7;
                            map.SpawnNpc(npc);
                            npc.SpawnX = 8;
                            npc.SpawnY = 8;
                            map.SpawnNpc(npc);
                        }
                    }
                    break;
                case 1294: { //barricade

                        //if (map.Name == "Mt. Barricade Peak") {

                        MapNpcPreset npc = new MapNpcPreset();

                        //Tyranitar
                        npc.NpcNum = 421;
                        npc.MinLevel = 55;
                        npc.MaxLevel = 55;
                        npc.SpawnX = 17;
                        npc.SpawnY = 12;
                        map.SpawnNpc(npc);

                        //Skarmory
                        npc.NpcNum = 438;
                        npc.MinLevel = 50;
                        npc.MaxLevel = 50;
                        npc.SpawnX = 14;
                        npc.SpawnY = 13;
                        map.SpawnNpc(npc);
                        npc.SpawnX = 19;
                        npc.SpawnY = 13;
                        map.SpawnNpc(npc);

                        //Gliscor
                        npc.NpcNum = 437;
                        npc.MinLevel = 50;
                        npc.MaxLevel = 50;
                        npc.SpawnX = 14;
                        npc.SpawnY = 16;
                        map.SpawnNpc(npc);
                        npc.SpawnX = 19;
                        npc.SpawnY = 16;
                        map.SpawnNpc(npc);

                        //Pupitar
                        npc.NpcNum = 439;
                        npc.MinLevel = 45;
                        npc.MaxLevel = 45;
                        npc.SpawnX = 13;
                        npc.SpawnY = 17;
                        map.SpawnNpc(npc);
                        npc.SpawnX = 20;
                        npc.SpawnY = 17;
                        map.SpawnNpc(npc);

                        //Larvitar
                        npc.NpcNum = 416;
                        npc.MinLevel = 40;
                        npc.MaxLevel = 40;
                        npc.SpawnX = 13;
                        npc.SpawnY = 18;
                        map.SpawnNpc(npc);
                        npc.SpawnX = 16;
                        npc.SpawnY = 20;
                        map.SpawnNpc(npc);
                        npc.SpawnX = 18;
                        npc.SpawnY = 20;
                        map.SpawnNpc(npc);
                        npc.SpawnX = 20;
                        npc.SpawnY = 18;
                        map.SpawnNpc(npc);
                        //}
                    }
                    break;
                case 1335: { //abandoned attic

                        //if (map.Name == "Abandoned Attic End") {
                        MapNpcPreset npc = new MapNpcPreset();

                        //litwicks
                        npc.NpcNum = 840;
                        npc.MinLevel = 13;
                        npc.MaxLevel = 13;
                        npc.SpawnX = 5;
                        npc.SpawnY = 7;
                        map.SpawnNpc(npc);
                        npc.SpawnX = 7;
                        map.SpawnNpc(npc);
                        npc.SpawnX = 9;
                        map.SpawnNpc(npc);
                        npc.SpawnX = 11;
                        map.SpawnNpc(npc);
                        npc.SpawnX = 13;
                        map.SpawnNpc(npc);
                        npc.SpawnX = 5;

                        //lampents
                        npc.NpcNum = 841;
                        npc.MinLevel = 20;
                        npc.MaxLevel = 20;
                        npc.SpawnX = 7;
                        npc.SpawnY = 4;
                        map.SpawnNpc(npc);
                        npc.SpawnX = 11;
                        map.SpawnNpc(npc);

                        //chandelure
                        npc.SpawnX = 9;
                        npc.SpawnY = 3;
                        npc.NpcNum = 845;
                        npc.MinLevel = 28;
                        npc.MaxLevel = 28;
                        map.SpawnNpc(npc);
                        //}
                    }
                    break;
                case 718: { //abandoned basement

                        //if (map.Name == "Abandoned Basement Pit") {
                        MapNpcPreset npc = new MapNpcPreset();

                        //rotom
                        npc.SpawnX = 9;
                        npc.SpawnY = 4;
                        npc.MinLevel = 30;
                        npc.MaxLevel = 30;
                        if (Server.Math.Rand(0, 2) == 0) {
                            npc.NpcNum = 806;
                        } else {
                            npc.NpcNum = 807;
                        }
                        map.SpawnNpc(npc);
                        //}
                    }
                    break;
                case 534: {

                        //if (map.Name == "Lenile Cavern Pit") {
                        MapNpcPreset npc = new MapNpcPreset();

                        //lapras
                        npc.SpawnX = 10;
                        npc.SpawnY = 4;
                        npc.MinLevel = 45;
                        npc.MaxLevel = 45;
                        npc.NpcNum = 886;
                        map.SpawnNpc(npc);
                        //}
                    }
                    break;
                case 1563: { //pitch black pit

                        //if (map.Name == "Pitch-Black Pit") {
                        MapNpcPreset npc = new MapNpcPreset();

                        //Xatu
                        npc.SpawnX = 10;
                        npc.SpawnY = 3;
                        npc.MinLevel = 100;
                        npc.MaxLevel = 100;
                        npc.NpcNum = 579;
                        map.SpawnNpc(npc);

                        //Ninetales
                        npc.SpawnX = 4;
                        npc.SpawnY = 7;
                        npc.MinLevel = 83;
                        npc.MaxLevel = 83;
                        npc.NpcNum = 855;
                        map.SpawnNpc(npc);

                        //Drapion
                        npc.SpawnX = 15;
                        npc.SpawnY = 7;
                        npc.MinLevel = 90;
                        npc.MaxLevel = 90;
                        npc.NpcNum = 856;
                        map.SpawnNpc(npc);
                        //}
                    }
                    break;
                case 1048: {//Exbel Woods Clearing

                        //if (map.Name == "Exbel Woods Clearing") {
                        MapNpcPreset npc = new MapNpcPreset();
                        npc.SpawnX = 9;
                        npc.SpawnY = 6;
                        npc.NpcNum = 963;
                        npc.MinLevel = 5;
                        npc.MaxLevel = 5;
                        map.SpawnNpc(npc);
                        //}
                    }
                    break;
                case 1851: {//Beach Bunker

                        //if (map.Name == "Tiny Grotto Depths") {
                        MapNpcPreset npc = new MapNpcPreset();
                        npc.SpawnX = 9;
                        npc.SpawnY = 7;
                        npc.NpcNum = 150;
                        npc.MinLevel = 60;
                        npc.MaxLevel = 60;
                        map.SpawnNpc(npc);
                        npc.SpawnX = 8;
                        npc.SpawnY = 7;
                        npc.NpcNum = 954;
                        npc.MinLevel = 55;
                        npc.MaxLevel = 55;
                        map.SpawnNpc(npc);
                        npc.SpawnX = 10;
                        npc.SpawnY = 7;
                        npc.NpcNum = 954;
                        npc.MinLevel = 55;
                        npc.MaxLevel = 55;
                        map.SpawnNpc(npc);
                        npc.SpawnX = 7;
                        npc.SpawnY = 5;
                        npc.NpcNum = 955;
                        npc.MinLevel = 55;
                        npc.MaxLevel = 55;
                        map.SpawnNpc(npc);
                        npc.SpawnX = 11;
                        npc.SpawnY = 9;
                        npc.NpcNum = 955;
                        npc.MinLevel = 55;
                        npc.MaxLevel = 55;
                        map.SpawnNpc(npc);
                        //}
                    }
                    break;
                case 1722: { //articuno
                        MapNpcPreset npc = new MapNpcPreset();

                        //articuno
                        npc.SpawnX = 9;
                        npc.SpawnY = 5;
                        npc.MinLevel = 45;
                        npc.MaxLevel = 45;
                        npc.NpcNum = 1061;
                        map.SpawnNpc(npc);
                        //}
                    }
                    break;
                case 1765: {//Inferno Volcano
                        //if (map.Name == "Inferno Volcano") {
                        MapNpcPreset npc = new MapNpcPreset();

                        //Torkoal
                        npc.SpawnX = 10;
                        npc.SpawnY = 2;
                        npc.MinLevel = 70;
                        npc.MaxLevel = 70;
                        npc.NpcNum = 1221;
                        map.SpawnNpc(npc);

                        //Magmar
                        npc.SpawnX = 8;
                        npc.SpawnY = 4;
                        npc.MinLevel = 70;
                        npc.MaxLevel = 70;
                        npc.NpcNum = 1222;
                        map.SpawnNpc(npc);

                        //Ninetales
                        npc.SpawnX = 10;
                        npc.SpawnY = 4;
                        npc.MinLevel = 70;
                        npc.MaxLevel = 70;
                        npc.NpcNum = 1223;
                        map.SpawnNpc(npc);

                        //Flareon
                        npc.SpawnX = 12;
                        npc.SpawnY = 4;
                        npc.MinLevel = 70;
                        npc.MaxLevel = 70;
                        npc.NpcNum = 1224;
                        map.SpawnNpc(npc);

                        //Magcargo
                        npc.SpawnX = 12;
                        npc.SpawnY = 6;
                        npc.MinLevel = 70;
                        npc.MaxLevel = 70;
                        npc.NpcNum = 1225;
                        map.SpawnNpc(npc);

                        //Camerupt
                        npc.SpawnX = 14;
                        npc.SpawnY = 6;
                        npc.MinLevel = 70;
                        npc.MaxLevel = 70;
                        npc.NpcNum = 1226;
                        map.SpawnNpc(npc);

                        //Charizard
                        npc.SpawnX = 10;
                        npc.SpawnY = 8;
                        npc.MinLevel = 70;
                        npc.MaxLevel = 70;
                        npc.NpcNum = 1227;
                        map.SpawnNpc(npc);

                        //Magmortar
                        npc.SpawnX = 12;
                        npc.SpawnY = 8;
                        npc.MinLevel = 70;
                        npc.MaxLevel = 70;
                        npc.NpcNum = 1228;
                        map.SpawnNpc(npc);

                        //Rapidash
                        npc.SpawnX = 10;
                        npc.SpawnY = 10;
                        npc.MinLevel = 70;
                        npc.MaxLevel = 70;
                        npc.NpcNum = 1229;
                        map.SpawnNpc(npc);

                        //Typhlosion
                        npc.SpawnX = 8;
                        npc.SpawnY = 8;
                        npc.MinLevel = 70;
                        npc.MaxLevel = 70;
                        npc.NpcNum = 1230;
                        map.SpawnNpc(npc);

                        //Houndoom
                        npc.SpawnX = 8;
                        npc.SpawnY = 6;
                        npc.MinLevel = 70;
                        npc.MaxLevel = 70;
                        npc.NpcNum = 1231;
                        map.SpawnNpc(npc);

                        //Infernape
                        npc.SpawnX = 6;
                        npc.SpawnY = 6;
                        npc.MinLevel = 70;
                        npc.MaxLevel = 70;
                        npc.NpcNum = 1232;
                        map.SpawnNpc(npc);
                        //}
                    }
                    break;
                case 1701: { //Flareon
                        MapNpcPreset npc = new MapNpcPreset();

                        //Flareon
                        npc.SpawnX = 9;
                        npc.SpawnY = 4;
                        npc.MinLevel = 72;
                        npc.MaxLevel = 72;
                        npc.NpcNum = 1195;
                        map.SpawnNpc(npc);
                        //}
                    }
                    break;
                case 1702: { //Leafeon
                        MapNpcPreset npc = new MapNpcPreset();

                        //Leafeon
                        npc.SpawnX = 10;
                        npc.SpawnY = 5;
                        npc.MinLevel = 72;
                        npc.MaxLevel = 72;
                        npc.NpcNum = 1196;
                        map.SpawnNpc(npc);
                        //}
                    }
                    break;
                case 1703: { //Vaporeon
                        MapNpcPreset npc = new MapNpcPreset();

                        //Vaporeon
                        npc.SpawnX = 9;
                        npc.SpawnY = 4;
                        npc.MinLevel = 72;
                        npc.MaxLevel = 72;
                        npc.NpcNum = 1197;
                        map.SpawnNpc(npc);
                        //}
                    }
                    break;
                case 1704: { //Glaceon
                        MapNpcPreset npc = new MapNpcPreset();

                        //Glaceon
                        npc.SpawnX = 9;
                        npc.SpawnY = 5;
                        npc.MinLevel = 72;
                        npc.MaxLevel = 72;
                        npc.NpcNum = 1198;
                        map.SpawnNpc(npc);
                        //}
                    }
                    break;
                case 1705: { //Jolteon
                        MapNpcPreset npc = new MapNpcPreset();

                        //Jolteon
                        npc.SpawnX = 10;
                        npc.SpawnY = 5;
                        npc.MinLevel = 72;
                        npc.MaxLevel = 72;
                        npc.NpcNum = 1199;
                        map.SpawnNpc(npc);
                        //}
                    }
                    break;
                case 1706: { //Umbreon
                        MapNpcPreset npc = new MapNpcPreset();

                        //Umbreon
                        npc.SpawnX = 10;
                        npc.SpawnY = 4;
                        npc.MinLevel = 72;
                        npc.MaxLevel = 72;
                        npc.NpcNum = 1200;
                        map.SpawnNpc(npc);
                        //}
                    }
                    break;
                case 1707: { //Espeon
                        MapNpcPreset npc = new MapNpcPreset();

                        //Espeon
                        npc.SpawnX = 10;
                        npc.SpawnY = 4;
                        npc.MinLevel = 72;
                        npc.MaxLevel = 72;
                        npc.NpcNum = 1201;
                        map.SpawnNpc(npc);
                        //}
                    }
                    break;
                case 1708: { //Ho-oh
                        MapNpcPreset npc = new MapNpcPreset();

                        //Ho-oh
                        npc.SpawnX = 10;
                        npc.SpawnY = 7;
                        npc.MinLevel = 80;
                        npc.MaxLevel = 80;
                        npc.NpcNum = 1202;
                        map.SpawnNpc(npc);
                        //}
                    }
                    break;
                case 1692: { //Hitmonchan
                        MapNpcPreset npc = new MapNpcPreset();

                        //Hitmonchan
                        npc.SpawnX = 10;
                        npc.SpawnY = 7;
                        npc.MinLevel = 50;
                        npc.MaxLevel = 50;
                        npc.NpcNum = 1233;
                        map.SpawnNpc(npc);
                        //}
                    }
                    break;
                case 1694: { //Hitmonlee
                        MapNpcPreset npc = new MapNpcPreset();

                        //Hitmonlee
                        npc.SpawnX = 10;
                        npc.SpawnY = 7;
                        npc.MinLevel = 50;
                        npc.MaxLevel = 50;
                        npc.NpcNum = 1234;
                        map.SpawnNpc(npc);
                        //}
                    }
                    break;
                case 1715: { //Tanren Dojo Hollow
                        MapNpcPreset npc = new MapNpcPreset();

                        //Hitmontop
                        npc.SpawnX = 10;
                        npc.SpawnY = 7;
                        npc.MinLevel = 60;
                        npc.MaxLevel = 60;
                        npc.NpcNum = 1235;
                        map.SpawnNpc(npc);

                        //Hitmonlee
                        npc.SpawnX = 8;
                        npc.SpawnY = 6;
                        npc.MinLevel = 60;
                        npc.MaxLevel = 60;
                        npc.NpcNum = 1234;
                        map.SpawnNpc(npc);

                        //Hitmonchan
                        npc.SpawnX = 11;
                        npc.SpawnY = 6;
                        npc.MinLevel = 60;
                        npc.MaxLevel = 60;
                        npc.NpcNum = 1233;
                        map.SpawnNpc(npc);
                        //}
                    }
                    break;
                case 982: { //Honeydrop Meadow Clearing

                        //if (map.Name == "Honeydrop Meadow Clearing") {
                        MapNpcPreset npc = new MapNpcPreset();
                        npc.SpawnX = 9;
                        npc.SpawnY = 4;
                        npc.MinLevel = 32;
                        npc.MaxLevel = 32;
                        npc.NpcNum = 1397;

                        map.SpawnNpc(npc);

                        MapNpcPreset minion = new MapNpcPreset();
                        npc.SpawnX = 10;
                        npc.SpawnY = 4;
                        npc.MinLevel = 21;
                        npc.MaxLevel = 21;
                        npc.NpcNum = 1398;

                        map.SpawnNpc(minion);

                        minion.SpawnX = 8;

                        map.SpawnNpc(minion);

                        minion.SpawnX = 8;
                        minion.SpawnY = 3;

                        map.SpawnNpc(minion);

                        minion.SpawnX = 9;

                        map.SpawnNpc(minion);

                        minion.SpawnX = 10;

                        map.SpawnNpc(minion);

                        minion.SpawnY = 5;

                        map.SpawnNpc(minion);

                        minion.SpawnX = 9;
                        minion.SpawnY = 5;

                        map.SpawnNpc(minion);

                        minion.SpawnX = 8;
                        minion.SpawnY = 5;

                        map.SpawnNpc(minion);
                        //}
                    }
                    break;
                case 1754: { //Tanren Mines, Dead End

                        //if (map.Name == "Tanren Mines, Dead End") {
                        MapNpcPreset minion = new MapNpcPreset();
                        minion.SpawnX = 9;
                        minion.SpawnY = 7;
                        minion.MinLevel = 50;
                        minion.MaxLevel = 50;
                        minion.NpcNum = 1503;

                        map.SpawnNpc(minion);

                        minion.SpawnX = 10;

                        map.SpawnNpc(minion);

                        minion.SpawnX = 8;

                        map.SpawnNpc(minion);

                        minion.SpawnX = 8;
                        minion.SpawnY = 6;

                        map.SpawnNpc(minion);

                        minion.SpawnX = 9;

                        map.SpawnNpc(minion);

                        minion.SpawnX = 10;

                        map.SpawnNpc(minion);

                        minion.SpawnX = 11;

                        map.SpawnNpc(minion);

                        minion.SpawnX = 7;

                        map.SpawnNpc(minion);

                        minion.SpawnX = 4;
                        minion.SpawnY = 7;

                        map.SpawnNpc(minion);

                        minion.SpawnX = 5;

                        map.SpawnNpc(minion);

                        minion.SpawnY = 8;

                        map.SpawnNpc(minion);

                        minion.SpawnX = 4;

                        map.SpawnNpc(minion);

                        minion.SpawnX = 13;

                        map.SpawnNpc(minion);

                        minion.SpawnX = 14;

                        map.SpawnNpc(minion);

                        minion.SpawnY = 7;

                        map.SpawnNpc(minion);

                        minion.SpawnX = 13;

                        map.SpawnNpc(minion);
                        //}
                    }
                    break;
                case 1007: { //Tanren Mines Ancient Cavern

                        map.SetAttribute(12, 12, Enums.TileType.Walkable, 0, 0, 0, "", "", "");
                        Messenger.SendTile(12, 12, map);

                        map.SetTile(12, 13, 5, 4, 1);
                        map.SetAttribute(12, 13, Enums.TileType.Blocked, 0, 0, 0, "", "", "");
                        Messenger.SendTile(12, 13, map);

                        MapNpcPreset npc = new MapNpcPreset();
                        //Regirock
                        npc.NpcNum = 1529;
                        npc.MinLevel = 65;
                        npc.MaxLevel = 65;
                        npc.SpawnX = 11;
                        npc.SpawnY = 12;
                        map.SpawnNpc(npc);
                    }
                    break;

            }
        }
コード例 #26
0
ファイル: BasicMap.cs プロジェクト: MandL27/Server
 public void RemoveNpc(int mapNpcNum)
 {
     Npc[mapNpcNum] = new MapNpcPreset();
 }
コード例 #27
0
        public static RDungeonMap GenerateFloor(Client client, int dungeonIndex, int floorNum, GeneratorOptions options)
        {
            RDungeon dungeon = RDungeonManager.RDungeons[dungeonIndex];
            RDungeonFloor floor = dungeon.Floors[floorNum];

            //decide on a chamber
            RDungeonChamberReq req = null;
            int chamber = -1;
            if (options.Chambers.Count > 0) {
                chamber = Math.Rand(0, options.Chambers.Count);
                req = (RDungeonChamberReq)Scripting.ScriptManager.InvokeFunction("GetChamberReq", options.Chambers[chamber].ChamberNum, options.Chambers[chamber].String1, options.Chambers[chamber].String2, options.Chambers[chamber].String3);
            }

            // Generate the ASCII map

            DungeonArrayFloor arrayFloor = new DungeonArrayFloor(options, req);
            //int[,] arrayMap = ASCIIFloorGen.GenASCIIMap(options);

            //ASCIIFloorGen.TextureDungeon(arrayMap);

            System.Diagnostics.Stopwatch watch = new System.Diagnostics.Stopwatch();

            watch.Start();

            // Prepare the base map
            DataManager.Maps.RDungeonMap rDungeonMap = new DataManager.Maps.RDungeonMap(MapManager.GenerateMapID(RDungeonMap.ID_PREFIX));
            rDungeonMap.MaxX = arrayFloor.MapArray.GetUpperBound(0);
            rDungeonMap.MaxY = arrayFloor.MapArray.GetUpperBound(1);
            rDungeonMap.Tile = new DataManager.Maps.Tile[rDungeonMap.MaxX + 1, rDungeonMap.MaxY + 1];
            rDungeonMap.RDungeonIndex = dungeonIndex;
            rDungeonMap.RDungeonFloor = floorNum;

            RDungeonMap map = new RDungeonMap(rDungeonMap);

            for (int x = 0; x <= rDungeonMap.Tile.GetUpperBound(0); x++) {
                for (int y = 0; y <= rDungeonMap.Tile.GetUpperBound(1); y++) {
                    AmbiguateTile(map.Tile[x,y]);
                }
            }

            map.Name = GenerateName(dungeonIndex, floorNum);

            map.Revision = 0;
            map.OriginalDarkness = floor.Darkness;
            map.HungerEnabled = true;
            map.RecruitEnabled = dungeon.Recruitment;
            map.ExpEnabled = dungeon.Exp;
            map.TimeLimit = dungeon.WindTimer;
            map.DungeonIndex = dungeon.DungeonIndex;
            map.MinNpcs = floor.NpcMin;
            map.MaxNpcs = floor.NpcMax;
            map.NpcSpawnTime = floor.NpcSpawnTime;

            if (Globals.ServerWeather != Enums.Weather.Ambiguous) {
                map.Weather = Globals.ServerWeather;
            } else if (floor.Weather.Count > 0) {
                map.Weather = floor.Weather[Server.Math.Rand(0, floor.Weather.Count)];
            }

            map.Music = floor.Music;

            //texture chamber
            if (arrayFloor.Chamber.X != -1 && arrayFloor.Chamber.Y != -1) {
                Scripting.ScriptManager.InvokeSub("CreateChamber", map, arrayFloor, options.Chambers[chamber].ChamberNum, options.Chambers[chamber].String1, options.Chambers[chamber].String2, options.Chambers[chamber].String3);
            }

            DungeonArrayFloor.TextureDungeon(arrayFloor.MapArray);

            for (int x = 0; x <= rDungeonMap.Tile.GetUpperBound(0); x++) {
                for (int y = 0; y <= rDungeonMap.Tile.GetUpperBound(1); y++) {
                    map.Tile[x, y].RDungeonMapValue = arrayFloor.MapArray[x, y];
                }
            }

            TextureDungeonMap(map);

            //block borders
            for (int y = 0; y <= map.MaxY; y++) {
                map.Tile[0, y].Type = Enums.TileType.Blocked;
                map.Tile[map.MaxX, y].Type = Enums.TileType.Blocked;
            }
            for (int x = 0; x <= map.MaxX; x++) {
                map.Tile[x, 0].Type = Enums.TileType.Blocked;
                map.Tile[x, map.MaxY].Type = Enums.TileType.Blocked;
            }

            watch.Stop();

            foreach (MapNpcPreset npc in floor.Npcs) {
                MapNpcPreset newNpc = new MapNpcPreset();
                newNpc.NpcNum = npc.NpcNum;
                newNpc.MinLevel = npc.MinLevel;
                newNpc.MaxLevel = npc.MaxLevel;
                newNpc.SpawnX = npc.SpawnX;
                newNpc.SpawnY = npc.SpawnY;
                newNpc.AppearanceRate = npc.AppearanceRate;
                newNpc.StartStatus = npc.StartStatus;
                newNpc.StartStatusCounter = npc.StartStatusCounter;
                newNpc.StartStatusChance = npc.StartStatusChance;
                map.Npc.Add(newNpc);
            }

            map.SpawnItems();
            int n = Server.Math.Rand(options.ItemMin, options.ItemMax + 1);
            if (floor.Items.Count == 0) {
                n = 0;
            } else if (n > Constants.MAX_MAP_ITEMS) {
                n = Constants.MAX_MAP_ITEMS;
            }
            int slot = 0;
            int itemX = -1, itemY = -1;
            for (int i = 0; i < n; i++) {
                for (int j = 0; j < 100; j++) {
                    bool spawned = false;
                    if (Server.Math.Rand(0, 100) < floor.Items[slot].AppearanceRate) {
                        arrayFloor.GenItem(floor.Items[slot].OnGround, floor.Items[slot].OnWater, floor.Items[slot].OnWall, ref itemX, ref itemY);
                        if (itemX > -1) {
                            map.SpawnItem(floor.Items[slot].ItemNum, Server.Math.Rand(floor.Items[slot].MinAmount, floor.Items[slot].MaxAmount + 1),
                                          (Server.Math.Rand(0, 100) < floor.Items[slot].StickyRate), floor.Items[slot].Hidden, floor.Items[slot].Tag, itemX, itemY, null);
                            spawned = true;
                        }

                    }
                    slot++;
                    if (slot >= floor.Items.Count) slot = 0;
                    if (spawned) break;
                }
            }

            //map.SpawnNpcs();
            map.NpcSpawnWait = new TickCount(Core.GetTickCount().Tick);

            return map;
        }
コード例 #28
0
ファイル: BasicMap.cs プロジェクト: MandL27/Server
        public void SpawnNpc(MapNpcPreset npc, bool checkSight)
        {
            int NPCNum = 0;
            int X = 0;
            int Y = 0;
            bool Spawned = false;

            // Check for empty NPC slot
            int npcSlot = FindOpenNpcSlot();

            if (npcSlot < 0 || npcSlot >= Constants.MAX_MAP_NPCS) {
                return;
            }

            NPCNum = npc.NpcNum;
            if (NPCNum > 0) {

                ActiveNpc[npcSlot].Num = NPCNum;
                ActiveNpc[npcSlot].Target = null;

                ActiveNpc[npcSlot].Name = NpcManager.Npcs[NPCNum].Name;
                ActiveNpc[npcSlot].Form = NpcManager.Npcs[NPCNum].Form;

                //if (NpcManager.Npcs[NPCNum].ShinyChance != 0 && Server.Math.Rand(0, NpcManager.Npcs[NPCNum].ShinyChance) == 0) ActiveNpc[npcSlot].Shiny = true;
                ActiveNpc[npcSlot].Sex = Pokedex.Pokedex.GetPokemonForm(NpcManager.Npcs[NPCNum].Species, ActiveNpc[npcSlot].Form).GenerateLegalSex();

                ActiveNpc[npcSlot].AttackTimer = new TickCount(Core.GetTickCount().Tick);
                ActiveNpc[npcSlot].PauseTimer = new TickCount(Core.GetTickCount().Tick);

                //if (Npc[npcSlot].MinLevel == -1) {
                //Npc[npcSlot].MinLevel = NpcManager.Npcs[Npc[npcSlot].NpcNum].RecruitLevel;
                if (npc.MinLevel <= 0) {
                    npc.MinLevel = 1;
                    npc.MaxLevel = 1;
                }// else {
                //        Console.WriteLine("Npc found!");
                //    }
                //}
                ActiveNpc[npcSlot].Level = Server.Math.Rand(npc.MinLevel, npc.MaxLevel + 1);
                //set initial stats
                ActiveNpc[npcSlot].CalculateOriginalSprite();
                ActiveNpc[npcSlot].CalculateOriginalStats();
                ActiveNpc[npcSlot].CalculateOriginalType();
                ActiveNpc[npcSlot].CalculateOriginalAbility();
                //ActiveNpc[npcSlot].CalculateOriginalMobility();

                if (Server.Math.Rand(0, 1000) < 1)
                {
                    ActiveNpc[npcSlot].Shiny = Enums.Coloration.Shiny;
                }

                ActiveNpc[npcSlot].HP = ActiveNpc[npcSlot].MaxHP;

                ActiveNpc[npcSlot].Direction = (Enums.Direction)Server.Math.Rand(0, 4);

                ActiveNpc[npcSlot].GenerateMoveset();

                if (Moral == Enums.MapMoral.None) {
                    ActiveNpc[npcSlot].GenerateHeldItem();
                }

                if (Server.Math.Rand(0, 100) < npc.StartStatusChance) {
                    ActiveNpc[npcSlot].StatusAilment = npc.StartStatus;
                    ActiveNpc[npcSlot].StatusAilmentCounter = npc.StartStatusCounter;
                }

                if (npc.SpawnX < 0 | npc.SpawnY < 0) {
                    // We'll try 100 times to randomly place the sprite
                    for (int i = 1; i <= 50; i++) {
                        if (Tile[X, Y].Type == Enums.TileType.Walkable || Tile[X, Y].Type == Enums.TileType.Slow) {

                            if (checkSight) {
                                bool seen = false;
                                foreach (Client client in GetClients()) {
                                    if (CanCharacterSeeDestination(client.Player.GetActiveRecruit(), X, Y)) {
                                        seen = true;
                                        break;
                                    }
                                }
                                if (!seen) {
                                    ActiveNpc[npcSlot].X = X;
                                    ActiveNpc[npcSlot].Y = Y;
                                    Spawned = true;
                                    break;
                                }
                            } else {
                                ActiveNpc[npcSlot].X = X;
                                ActiveNpc[npcSlot].Y = Y;
                                Spawned = true;
                                break;
                            }
                        }
                    }

                    for (int i = 1; i <= 50; i++) {
                        X = Server.Math.Rand(0, MaxX + 1);
                        Y = Server.Math.Rand(0, MaxY + 1);

                        // Check if the tile is walkable
                        if (Tile[X, Y].Type == Enums.TileType.Walkable) {

                            ActiveNpc[npcSlot].X = X;
                            ActiveNpc[npcSlot].Y = Y;
                            Spawned = true;
                            break;
                        }
                    }
                } else {
                    // We no longer subtract one because Rand is ListIndex -1.
                    ActiveNpc[npcSlot].X = npc.SpawnX;
                    ActiveNpc[npcSlot].Y = npc.SpawnY;
                    Spawned = true;
                }

                // Didn't spawn, so now we'll just try to find a free tile
                if (!Spawned) {
                    for (Y = 0; Y <= MaxY; Y++) {
                        for (X = 0; X <= MaxX; X++) {
                            if (Tile[X, Y].Type == Enums.TileType.Walkable) {
                                ActiveNpc[npcSlot].X = X;
                                ActiveNpc[npcSlot].Y = Y;
                                Spawned = true;
                            }
                        }
                    }
                }

                // If we suceeded in spawning then send it to everyone
                if (Spawned) {
                    PacketHitList hitlist = null;
                    PacketHitList.MethodStart(ref hitlist);
                    PacketBuilder.AppendNpcSpawn(MapManager.RetrieveActiveMap(MapID), hitlist, npcSlot);

                    Scripting.ScriptManager.InvokeFunction("OnNpcSpawn", MapManager.RetrieveActiveMap(MapID), npc, ActiveNpc[npcSlot], hitlist);

                    PacketHitList.MethodEnded(ref hitlist);
                }

            }
        }
コード例 #29
0
ファイル: Main.cs プロジェクト: MandL27/Server
        public static void OnNpcSpawn(IMap map, MapNpcPreset npc, MapNpc spawnedNpc, PacketHitList hitlist)
        {
            try {
                if (spawnedNpc.Num == 0) return;
                bool listed = false;
                for (int i = 0; i < map.Npc.Count; i++) {
                    if (map.Npc[i].NpcNum == spawnedNpc.Num) {
                        listed = true;
                        break;
                    }
                }
                if (!listed && map.MapType == Enums.MapType.RDungeonMap) {
                    //Messenger.AdminMsg("[Admin] An unlisted NPC " + NpcManager.Npcs[spawnedNpc.Num].Name + " spawned on " + map.Name, Text.Red);
                    //map.ActiveNpc[spawnedNpc.MapSlot] = new MapNpc(map.MapID, spawnedNpc.MapSlot);
                    //hitlist.AddPacketToMap(map, TcpPacket.CreatePacket("npcdead", spawnedNpc.MapSlot));
                }
                Client sprinko = ClientManager.FindClient("Sprinko");
                if (sprinko != null && sprinko.Player.Map == map) {
                    Messenger.PlayerMsg(sprinko, "Npc Spawned:" + spawnedNpc.Num, Text.Pink);

                }

                switch (spawnedNpc.Num) {
                    case 33:
                    case 230:
                    case 244:
                    case 245: {//friendly npcs
                            AddExtraStatus(spawnedNpc, map, "Immobilize", 0, null, "", hitlist, false);
                        }
                        break;
                    case 32: {//kecleon

                            map.Npc.Remove(npc);
                        }
                        break;
                    case 1233: {//hitmonchan

                            map.Npc.Remove(npc);
                            spawnedNpc.DefenseBuff = 3;
                            spawnedNpc.SpDefBuff = 3;
                            spawnedNpc.MaxHPBonus = 300;
                            spawnedNpc.AttackBuff = 1;
                            spawnedNpc.SpeedBuff = 8;
                            spawnedNpc.HP = spawnedNpc.MaxHP;

                        }
                        break;
                    case 1234: {//hitmonlee

                            map.Npc.Remove(npc);
                            spawnedNpc.DefenseBuff = 1;
                            spawnedNpc.SpDefBuff = 1;
                            spawnedNpc.MaxHPBonus = 340;
                            spawnedNpc.AttackBuff = 3;
                            spawnedNpc.SpeedBuff = 8;
                            spawnedNpc.HP = spawnedNpc.MaxHP;

                        }
                        break;
                    case 1235: {//hitmontop

                            map.Npc.Remove(npc);
                            spawnedNpc.DefenseBuff = 3;
                            spawnedNpc.SpDefBuff = 3;
                            spawnedNpc.MaxHPBonus = 480;
                            spawnedNpc.AttackBuff = 3;
                            spawnedNpc.SpeedBuff = 10;
                            spawnedNpc.HP = spawnedNpc.MaxHP;

                        }
                        break;
                    case 306: {//regice
                            foreach (Client n in map.GetClients()) {
                                StoryManager.PlayStory(n, 259);
                            }
                            map.Npc.Remove(npc);
                            spawnedNpc.DefenseBuff = 10;
                            spawnedNpc.SpDefBuff = 10;
                            spawnedNpc.MaxHPBonus = 550;
                            spawnedNpc.SpAtkBuff = 5;
                            spawnedNpc.SpeedBuff = 10;
                            spawnedNpc.HP = spawnedNpc.MaxHP;

                        }
                        break;
                    case 1401: {//Vespiquen (Boss Rush)

                            map.Npc.Remove(npc);
                            spawnedNpc.DefenseBuff = 1;
                            spawnedNpc.SpDefBuff = 1;
                            spawnedNpc.MaxHPBonus = 150;
                            spawnedNpc.HP = spawnedNpc.MaxHP;

                        }
                        break;
                    case 1402: {//Roselia (Boss Rush)

                            map.Npc.Remove(npc);
                            spawnedNpc.DefenseBuff = 1;
                            spawnedNpc.SpDefBuff = 1;
                            spawnedNpc.MaxHPBonus = 100;
                            spawnedNpc.HP = spawnedNpc.MaxHP;

                        }
                        break;
                    case 1403: {//Vileplume (Boss Rush)

                            map.Npc.Remove(npc);
                            spawnedNpc.DefenseBuff = 1;
                            spawnedNpc.SpDefBuff = 1;
                            spawnedNpc.MaxHPBonus = 100;
                            spawnedNpc.HP = spawnedNpc.MaxHP;

                        }
                        break;
                    case 1404: {//Rhyperior (Boss Rush)

                            map.Npc.Remove(npc);
                            spawnedNpc.DefenseBuff = 2;
                            spawnedNpc.SpDefBuff = 2;
                            spawnedNpc.MaxHPBonus = 195;
                            spawnedNpc.AttackBuff = 1;
                            spawnedNpc.HP = spawnedNpc.MaxHP;

                        }
                        break;
                    case 1405: {//Golem (Boss Rush)

                            map.Npc.Remove(npc);
                            spawnedNpc.DefenseBuff = 2;
                            spawnedNpc.SpDefBuff = 2;
                            spawnedNpc.MaxHPBonus = 165;
                            spawnedNpc.HP = spawnedNpc.MaxHP;

                        }
                        break;
                    case 1406: {//Rhydon (Boss Rush)

                            map.Npc.Remove(npc);
                            spawnedNpc.DefenseBuff = 2;
                            spawnedNpc.SpDefBuff = 2;
                            spawnedNpc.MaxHPBonus = 165;
                            spawnedNpc.HP = spawnedNpc.MaxHP;

                        }
                        break;
                    case 1407: {//Lapras (Boss Rush)

                            map.Npc.Remove(npc);
                            spawnedNpc.DefenseBuff = 2;
                            spawnedNpc.SpDefBuff = 3;
                            spawnedNpc.MaxHPBonus = 335;
                            spawnedNpc.HP = spawnedNpc.MaxHP;

                        }
                        break;
                    case 1408: {//Gorebyss (Boss Rush)

                            map.Npc.Remove(npc);
                            spawnedNpc.DefenseBuff = 2;
                            spawnedNpc.SpDefBuff = 2;
                            spawnedNpc.MaxHPBonus = 235;
                            spawnedNpc.HP = spawnedNpc.MaxHP;

                        }
                        break;
                    case 1409: {//Huntail (Boss Rush)

                            map.Npc.Remove(npc);
                            spawnedNpc.DefenseBuff = 2;
                            spawnedNpc.SpDefBuff = 2;
                            spawnedNpc.MaxHPBonus = 215;
                            spawnedNpc.AttackBuff = 1;
                            spawnedNpc.HP = spawnedNpc.MaxHP;

                        }
                        break;
                    case 1410: {//Regice (Boss Rush)

                            map.Npc.Remove(npc);
                            spawnedNpc.DefenseBuff = 2;
                            spawnedNpc.SpDefBuff = 1;
                            spawnedNpc.MaxHPBonus = 150;
                            spawnedNpc.HP = spawnedNpc.MaxHP;

                        }
                        break;
                    case 1411: {//Froslass (Boss Rush)

                            map.Npc.Remove(npc);
                            spawnedNpc.DefenseBuff = 1;
                            spawnedNpc.SpDefBuff = 1;
                            spawnedNpc.EvasionBuff = 1;
                            spawnedNpc.MaxHPBonus = 100;
                            spawnedNpc.HP = spawnedNpc.MaxHP;

                        }
                        break;
                    case 1412: {//Beartic (Boss Rush)

                            map.Npc.Remove(npc);
                            spawnedNpc.DefenseBuff = 2;
                            spawnedNpc.SpDefBuff = 2;
                            spawnedNpc.AttackBuff = 2;
                            spawnedNpc.MaxHPBonus = 200;
                            spawnedNpc.HP = spawnedNpc.MaxHP;

                        }
                        break;
                    case 1413: {//Umbreon (Boss Rush)

                            map.Npc.Remove(npc);
                            spawnedNpc.DefenseBuff = 1;
                            spawnedNpc.SpDefBuff = 2;
                            spawnedNpc.MaxHPBonus = 200;
                            spawnedNpc.HP = spawnedNpc.MaxHP;

                        }
                        break;
                    case 1414: {//Mogok (Boss Rush)

                            map.Npc.Remove(npc);
                            spawnedNpc.DefenseBuff = 4;
                            spawnedNpc.SpDefBuff = 4;
                            spawnedNpc.AttackBuff = 5;
                            spawnedNpc.SpeedBuff = 10;
                            spawnedNpc.MaxHPBonus = 450;
                            spawnedNpc.HP = spawnedNpc.MaxHP;

                        }
                        break;
                    case 1415: {//Silvan (Boss Rush)

                            map.Npc.Remove(npc);
                            spawnedNpc.DefenseBuff = 3;
                            spawnedNpc.SpDefBuff = 5;
                            spawnedNpc.AttackBuff = 6;
                            spawnedNpc.SpAtkBuff = 5;
                            spawnedNpc.SpeedBuff = 10;
                            spawnedNpc.MaxHPBonus = 400;
                            spawnedNpc.HP = spawnedNpc.MaxHP;

                        }
                        break;
                    case 1416: {//Erkenwald (Boss Rush)

                            map.Npc.Remove(npc);
                            spawnedNpc.DefenseBuff = 2;
                            spawnedNpc.SpDefBuff = 2;
                            spawnedNpc.AttackBuff = 3;
                            spawnedNpc.SpAtkBuff = 3;
                            spawnedNpc.SpeedBuff = 10;
                            spawnedNpc.MaxHPBonus = 400;
                            spawnedNpc.HP = spawnedNpc.MaxHP;

                        }
                        break;
                    case 1417: {//Alistar (Boss Rush)

                            map.Npc.Remove(npc);
                            spawnedNpc.DefenseBuff = 3;
                            spawnedNpc.SpDefBuff = 3;
                            spawnedNpc.MaxHPBonus = 300;
                            spawnedNpc.SpAtkBuff = 3;
                            spawnedNpc.HP = spawnedNpc.MaxHP;

                        }
                        break;
                    case 1397: {//Vespiquen

                            map.Npc.Remove(npc);
                            spawnedNpc.DefenseBuff = 1;
                            spawnedNpc.SpDefBuff = 1;
                            spawnedNpc.MaxHPBonus = 325;
                            spawnedNpc.AttackBuff = 2;
                            spawnedNpc.SpeedBuff = 10;
                            spawnedNpc.HP = spawnedNpc.MaxHP;

                        }
                        break;
                    case 177: {//Luxray

                            map.Npc.Remove(npc);
                            spawnedNpc.DefenseBuff = 2;
                            spawnedNpc.SpDefBuff = 1;
                            spawnedNpc.MaxHPBonus = 200;
                            spawnedNpc.SpAtkBuff = 1;
                            spawnedNpc.AttackBuff = 2;
                            spawnedNpc.EvasionBuff = 2;
                            spawnedNpc.SpeedBuff = 10;
                            spawnedNpc.HP = spawnedNpc.MaxHP;

                        }
                        break;
                    case 1192: {//Entei
                            foreach (Client n in map.GetClients()) {
                                StoryManager.PlayStory(n, 381);
                            }
                            map.Npc.Remove(npc);
                            spawnedNpc.DefenseBuff = 3;
                            spawnedNpc.SpDefBuff = 3;
                            spawnedNpc.MaxHPBonus = 300;
                            spawnedNpc.SpAtkBuff = 3;
                            spawnedNpc.AttackBuff = 3;
                            spawnedNpc.HP = spawnedNpc.MaxHP;

                        }
                        break;
                    case 1194: {//Suicune
                            foreach (Client n in map.GetClients()) {
                                StoryManager.PlayStory(n, 382);
                            }
                            map.Npc.Remove(npc);
                            spawnedNpc.DefenseBuff = 3;
                            spawnedNpc.SpDefBuff = 3;
                            spawnedNpc.MaxHPBonus = 300;
                            spawnedNpc.SpAtkBuff = 3;
                            spawnedNpc.AttackBuff = 3;
                            spawnedNpc.HP = spawnedNpc.MaxHP;

                        }
                        break;
                    case 1193: {//Raikou
                            foreach (Client n in map.GetClients()) {
                                StoryManager.PlayStory(n, 380);
                            }
                            map.Npc.Remove(npc);
                            spawnedNpc.DefenseBuff = 3;
                            spawnedNpc.SpDefBuff = 3;
                            spawnedNpc.MaxHPBonus = 300;
                            spawnedNpc.SpAtkBuff = 3;
                            spawnedNpc.AttackBuff = 3;
                            spawnedNpc.HP = spawnedNpc.MaxHP;

                        }
                        break;
                    case 1195: {//Flareon

                            map.Npc.Remove(npc);
                            spawnedNpc.DefenseBuff = 2;
                            spawnedNpc.SpDefBuff = 4;
                            spawnedNpc.MaxHPBonus = 350;
                            spawnedNpc.AttackBuff = 3;
                            spawnedNpc.SpeedBuff = 8;
                            spawnedNpc.SpAtkBuff = 1;
                            spawnedNpc.HP = spawnedNpc.MaxHP;

                        }
                        break;
                    case 1196: {//Leafeon

                            map.Npc.Remove(npc);
                            spawnedNpc.DefenseBuff = 3;
                            spawnedNpc.SpDefBuff = 3;
                            spawnedNpc.MaxHPBonus = 385;
                            spawnedNpc.AttackBuff = 3;
                            spawnedNpc.SpeedBuff = 7;
                            spawnedNpc.HP = spawnedNpc.MaxHP;

                        }
                        break;
                    case 1197: {//Vaporeon

                            map.Npc.Remove(npc);
                            spawnedNpc.DefenseBuff = 3;
                            spawnedNpc.SpDefBuff = 5;
                            spawnedNpc.MaxHPBonus = 425;
                            spawnedNpc.SpAtkBuff = 2;
                            spawnedNpc.SpeedBuff = 9;
                            spawnedNpc.HP = spawnedNpc.MaxHP;

                        }
                        break;
                    case 1198: {//Glaceon

                            map.Npc.Remove(npc);
                            spawnedNpc.DefenseBuff = 1;
                            spawnedNpc.SpDefBuff = 2;
                            spawnedNpc.MaxHPBonus = 350;
                            spawnedNpc.SpAtkBuff = 4;
                            spawnedNpc.EvasionBuff = 2;
                            spawnedNpc.AccuracyBuff = 3;
                            spawnedNpc.SpeedBuff = 6;
                            spawnedNpc.HP = spawnedNpc.MaxHP;

                        }
                        break;
                    case 1199: {//Jolteon

                            map.Npc.Remove(npc);
                            spawnedNpc.DefenseBuff = 1;
                            spawnedNpc.SpDefBuff = 1;
                            spawnedNpc.MaxHPBonus = 300;
                            spawnedNpc.SpAtkBuff = 4;
                            spawnedNpc.SpeedBuff = 9;
                            spawnedNpc.EvasionBuff = 2;
                            spawnedNpc.HP = spawnedNpc.MaxHP;

                        }
                        break;
                    case 1200: {//Umbreon

                            map.Npc.Remove(npc);
                            spawnedNpc.DefenseBuff = 3;
                            spawnedNpc.SpDefBuff = 2;
                            spawnedNpc.MaxHPBonus = 500;
                            spawnedNpc.AttackBuff = 2;
                            spawnedNpc.SpeedBuff = 4;
                            spawnedNpc.HP = spawnedNpc.MaxHP;

                        }
                        break;
                    case 1201: {//Espeon

                            map.Npc.Remove(npc);
                            spawnedNpc.DefenseBuff = 2;
                            spawnedNpc.SpDefBuff = 2;
                            spawnedNpc.MaxHPBonus = 350;
                            spawnedNpc.SpAtkBuff = 2;
                            spawnedNpc.SpeedBuff = 8;
                            spawnedNpc.EvasionBuff = 1;
                            spawnedNpc.HP = spawnedNpc.MaxHP;

                        }
                        break;
                    case 1202: {//Ho-Oh

                            map.Npc.Remove(npc);
                            spawnedNpc.DefenseBuff = 3;
                            spawnedNpc.SpDefBuff = 4;
                            spawnedNpc.MaxHPBonus = 850;
                            spawnedNpc.AttackBuff = 3;
                            spawnedNpc.SpeedBuff = 10;
                            spawnedNpc.HP = spawnedNpc.MaxHP;

                        }
                        break;
                    case 806: {//rotom

                            spawnedNpc.MaxHPBonus = 200;
                            spawnedNpc.AttackBuff = 1;
                            spawnedNpc.SpAtkBuff = 1;
                            spawnedNpc.HP = spawnedNpc.MaxHP;
                        }
                        break;
                    case 807: {//rotom

                            spawnedNpc.MaxHPBonus = 200;
                            spawnedNpc.AttackBuff = 1;
                            spawnedNpc.SpAtkBuff = 1;
                            spawnedNpc.HP = spawnedNpc.MaxHP;
                        }
                        break;
                    case 434: {//rotom

                            spawnedNpc.MaxHPBonus = 200;
                            spawnedNpc.AttackBuff = 1;
                            spawnedNpc.SpAtkBuff = 1;
                            spawnedNpc.HP = spawnedNpc.MaxHP;
                        }
                        break;
                    case 422: {//rotom

                            spawnedNpc.MaxHPBonus = 200;
                            spawnedNpc.AttackBuff = 1;
                            spawnedNpc.SpAtkBuff = 1;
                            spawnedNpc.HP = spawnedNpc.MaxHP;
                        }
                        break;
                    case 886: {//lapras

                            spawnedNpc.MaxHPBonus = 550;
                            spawnedNpc.SpeedBuff = 3;
                            spawnedNpc.SpDefBuff = 3;
                            spawnedNpc.DefenseBuff = 3;
                            spawnedNpc.SpAtkBuff = 3;
                            spawnedNpc.HP = spawnedNpc.MaxHP;
                        }
                        break;
                    case 397: {//golem

                            spawnedNpc.DefenseBuff = 1;
                            spawnedNpc.SpeedBuff = 8;
                            spawnedNpc.SpDefBuff = 1;
                            spawnedNpc.AttackBuff = 3;
                            spawnedNpc.MaxHPBonus = 250;
                            spawnedNpc.HP = spawnedNpc.MaxHP;
                        }
                        break;
                    case 578: {//froslass

                            spawnedNpc.MaxHPBonus = 350;
                            spawnedNpc.SpeedBuff = 7;
                            spawnedNpc.SpAtkBuff = 3;
                            spawnedNpc.EvasionBuff = 3;
                            spawnedNpc.HP = spawnedNpc.MaxHP;
                        }
                        break;
                    case 1527: {//Nidoking

                            spawnedNpc.MaxHPBonus = 350;
                            spawnedNpc.SpeedBuff = 10;
                            spawnedNpc.SpAtkBuff = 3;
                            spawnedNpc.DefenseBuff = 2;
                            spawnedNpc.SpDefBuff = 2;
                            spawnedNpc.HP = spawnedNpc.MaxHP;
                        }
                        break;
                    case 1528: {//Nidoking

                            spawnedNpc.MaxHPBonus = 400;
                            spawnedNpc.SpeedBuff = 10;
                            spawnedNpc.SpAtkBuff = 1;
                            spawnedNpc.DefenseBuff = 3;
                            spawnedNpc.SpDefBuff = 3;
                            spawnedNpc.HP = spawnedNpc.MaxHP;
                        }
                        break;
                    case 1529: {//Regirock

                            spawnedNpc.MaxHPBonus = 850;
                            spawnedNpc.SpeedBuff = 10;
                            spawnedNpc.AttackBuff = 3;
                            spawnedNpc.DefenseBuff = 2;
                            spawnedNpc.SpDefBuff = 4;
                            spawnedNpc.HP = spawnedNpc.MaxHP;
                        }
                        break;
                    case 1521: {//Steelix

                            spawnedNpc.MaxHPBonus = 255;
                            spawnedNpc.SpDefBuff = 4;
                            spawnedNpc.AttackBuff = 1;
                            spawnedNpc.DefenseBuff = 2;
                            spawnedNpc.HP = spawnedNpc.MaxHP;
                        }
                        break;
                    case 1523: {//Aggron

                            spawnedNpc.MaxHPBonus = 155;
                            spawnedNpc.SpDefBuff = 3;
                            spawnedNpc.AttackBuff = 1;
                            spawnedNpc.DefenseBuff = 2;
                            spawnedNpc.HP = spawnedNpc.MaxHP;
                        }
                        break;
                    case 1522: {//Golem

                            spawnedNpc.MaxHPBonus = 125;
                            spawnedNpc.SpDefBuff = 2;
                            spawnedNpc.AttackBuff = 1;
                            spawnedNpc.DefenseBuff = 2;
                            spawnedNpc.HP = spawnedNpc.MaxHP;
                        }
                        break;
                    case 1520: {//Crobat

                            spawnedNpc.MaxHPBonus = 100;
                            spawnedNpc.SpDefBuff = 2;
                            spawnedNpc.AttackBuff = 3;
                            spawnedNpc.DefenseBuff = 1;
                            spawnedNpc.HP = spawnedNpc.MaxHP;
                        }
                        break;
                    case 389: {//rhyperior

                            spawnedNpc.MaxHPBonus = 400;
                            spawnedNpc.AttackBuff = 2;
                            spawnedNpc.SpeedBuff = 8;
                            spawnedNpc.DefenseBuff = 2;
                            spawnedNpc.SpDefBuff = 2;
                            spawnedNpc.HP = spawnedNpc.MaxHP;
                        }
                        break;
                    case 145: {//mamoswine

                            spawnedNpc.MaxHPBonus = 400;
                            spawnedNpc.AttackBuff = 2;
                            spawnedNpc.SpeedBuff = 6;
                            spawnedNpc.DefenseBuff = 2;
                            spawnedNpc.SpDefBuff = 2;
                            spawnedNpc.HP = spawnedNpc.MaxHP;
                        }
                        break;
                    case 381: {//rhydon

                            spawnedNpc.MaxHPBonus = 250;
                            spawnedNpc.SpeedBuff = 6;
                            spawnedNpc.AttackBuff = 1;
                            spawnedNpc.SpDefBuff = 1;
                            spawnedNpc.HP = spawnedNpc.MaxHP;
                        }
                        break;
                    case 640: {//huntail

                            spawnedNpc.MaxHPBonus = 200;
                            spawnedNpc.SpAtkBuff = 3;
                            spawnedNpc.HP = spawnedNpc.MaxHP;
                        }
                        break;
                    case 641: {//gorebyss

                            spawnedNpc.MaxHPBonus = 250;
                            spawnedNpc.SpDefBuff = 2;
                            spawnedNpc.HP = spawnedNpc.MaxHP;
                        }
                        break;
                    case 579: {//xatu

                            spawnedNpc.MaxHPBonus = 200;
                            spawnedNpc.SpAtkBuff = 4;
                            spawnedNpc.HP = spawnedNpc.MaxHP;
                        }
                        break;
                    case 481: {//weepinbell

                            spawnedNpc.MaxHPBonus = 125;
                            spawnedNpc.AttackBuff = 1;
                            spawnedNpc.DefenseBuff = 1;
                            spawnedNpc.SpeedBuff = 3;
                            spawnedNpc.HP = spawnedNpc.MaxHP;
                        }
                        break;
                    case 1220: {//Groundon

                            spawnedNpc.MaxHPBonus = 775;
                            spawnedNpc.SpeedBuff = 10;
                            spawnedNpc.SpDefBuff = 6;
                            spawnedNpc.DefenseBuff = 6;
                            spawnedNpc.AttackBuff = 5;
                            spawnedNpc.SpAtkBuff = 5;
                            spawnedNpc.HP = spawnedNpc.MaxHP;
                        }
                        break;
                    case 1060: {//Abomsnow

                            spawnedNpc.MaxHPBonus = 400;
                            spawnedNpc.SpeedBuff = 1;
                            spawnedNpc.SpDefBuff = 2;
                            spawnedNpc.DefenseBuff = 2;
                            spawnedNpc.HP = spawnedNpc.MaxHP;
                        }
                        break;
                    case 480: {//vileplume

                            spawnedNpc.MaxHPBonus = 200;
                            spawnedNpc.SpAtkBuff = 2;
                            spawnedNpc.DefenseBuff = 1;
                            spawnedNpc.SpDefBuff = 1;
                            spawnedNpc.SpeedBuff = 6;
                            spawnedNpc.HP = spawnedNpc.MaxHP;
                        }
                        break;
                    case 1046: {//beartic
                            spawnedNpc.MaxHPBonus = 450;
                            spawnedNpc.HP = spawnedNpc.MaxHP;
                            spawnedNpc.DefenseBuff = 2;
                            spawnedNpc.SpDefBuff = 2;
                            spawnedNpc.EvasionBuff = 1;
                            spawnedNpc.AttackBuff = 2;
                            spawnedNpc.SpeedBuff = 4;
                        }
                        break;
                    case 1047: {//umbreon
                            spawnedNpc.MaxHPBonus = 450;
                            spawnedNpc.HP = spawnedNpc.MaxHP;
                            spawnedNpc.DefenseBuff = 4;
                            spawnedNpc.SpDefBuff = 4;
                            spawnedNpc.AttackBuff = 2;
                            spawnedNpc.SpeedBuff = 6;
                        }
                        break;
                    case 1048: {//hitmonlee
                            spawnedNpc.MaxHPBonus = 300;
                            spawnedNpc.HP = spawnedNpc.MaxHP;
                            spawnedNpc.AttackBuff = 5;
                            spawnedNpc.DefenseBuff = 2;
                            spawnedNpc.SpDefBuff = 2;
                            spawnedNpc.SpeedBuff = 8;
                        }
                        break;
                    case 1049: {//grumpig
                            spawnedNpc.MaxHPBonus = 250;
                            spawnedNpc.HP = spawnedNpc.MaxHP;
                            spawnedNpc.SpAtkBuff = 5;
                            spawnedNpc.DefenseBuff = 2;
                            spawnedNpc.SpDefBuff = 2;
                            spawnedNpc.SpeedBuff = 6;
                        }
                        break;
                    case 1050: {//clefable
                            spawnedNpc.MaxHPBonus = 250;
                            spawnedNpc.HP = spawnedNpc.MaxHP;
                            spawnedNpc.EvasionBuff = 3;
                            spawnedNpc.SpDefBuff = 2;
                            spawnedNpc.DefenseBuff = 2;
                            spawnedNpc.SpeedBuff = 8;
                        }
                        break;
                    case 800: {//mew
                            map.Npc.Remove(npc);
                            spawnedNpc.MaxHPBonus = 50;
                            spawnedNpc.HP = spawnedNpc.MaxHP;
                            spawnedNpc.AttackBuff = 1;
                            spawnedNpc.DefenseBuff = 1;
                            spawnedNpc.SpAtkBuff = 1;
                            spawnedNpc.SpDefBuff = 1;
                            spawnedNpc.AccuracyBuff = 1;
                            spawnedNpc.EvasionBuff = 1;
                            AddExtraStatus(spawnedNpc, null, map, "Invisible", 1000, null, "", hitlist, false);
                            TargetCollection targets = MoveProcessor.GetTargetsInRange(Enums.MoveRange.Floor, 0, map, null, spawnedNpc.X, spawnedNpc.Y, Enums.Direction.Up, true, true, true);
                            for (int i = 0; i < targets.Count; i++) {
                                if (targets[i].CharacterType == Enums.CharacterType.Recruit) {
                                    Messenger.PlayMusic(((Recruit)targets[i]).Owner, "PMDB) Friend Area ~ Final Island.ogg");
                                }
                            }
                        }
                        break;
                    case 846: {//zorua

                            map.Npc.Remove(npc);
                        }
                        break;
                    case 1394: {//Scyther

                            map.Npc.Remove(npc);
                        }
                        break;
                    case 1395: {//Pinsir

                            map.Npc.Remove(npc);
                        }
                        break;
                    case 936: {//vanilluxe
                            //foreach (Client n in map.GetClients()) {
                            //    StoryManager.PlayStory(n, 187);
                            //}
                            map.Npc.Remove(npc);
                            spawnedNpc.MaxHPBonus = 200;
                            spawnedNpc.HP = spawnedNpc.MaxHP;
                        }
                        break;
                    case 1061: {//ARTICUNO
                            //map.Npc.Remove(npc);
                            spawnedNpc.MaxHPBonus = 300;
                            spawnedNpc.HP = spawnedNpc.MaxHP;
                            if (map.PlayersOnMap.Count == 1) {
                                InventoryItem item = new InventoryItem();
                                item.Num = 156;
                                item.Tag = "144";
                                spawnedNpc.GiveItem(item);
                            }
                        }
                        break;
                }

                if ((map.MapType == Enums.MapType.RDungeonMap) && spawnedNpc.HeldItem == null) {
                    if (((RDungeonMap)map).RDungeonIndex != 21
                    && ((RDungeonMap)map).RDungeonIndex != 22) {
                        if (Server.Math.Rand(0, 50) <= 0) {
                            //create a chest
                            InventoryItem item = new InventoryItem();
                            item.Num = Server.Math.Rand(531, 542);
                            if (item.Num == 533) item.Num = 542;
                            List<int> possibleItems = new List<int>();
                            if (Server.Math.Rand(0, 31) < 5) {
                                //2* item
                                for (int i = 1001; i <= 1838; i++) {
                                    if (ItemManager.Items[i].Rarity == 2 && !ItemManager.Items[i].Name.EndsWith("`")) {
                                        possibleItems.Add(i);
                                    }
                                }
                            } else {
                                //1* item
                                for (int i = 1001; i <= 1838; i++) {
                                    if (ItemManager.Items[i].Rarity == 1 && !ItemManager.Items[i].Name.EndsWith("`")) {
                                        possibleItems.Add(i);
                                    }
                                }
                            }
                            item.Tag = possibleItems[Server.Math.Rand(0, possibleItems.Count)].ToString();
                            spawnedNpc.GiveItem(item);
                        }
                    }
                }

                if (map.MapType == Enums.MapType.RDungeonMap && spawnedNpc.HeldItem == null) {
                    if (((RDungeonMap)map).RDungeonIndex == 50 && ((RDungeonMap)map).RDungeonFloor >= 2) {
                        if (Server.Math.Rand(0, 10) == 0) {
                            InventoryItem item = new InventoryItem();
                            item.Num = Server.Math.Rand(244, 249);
                            if (item.Num == 247) item.Num = 213;
                            if (item.Num == 248) item.Num = 224;
                            spawnedNpc.GiveItem(item);
                        }
                    } else if (((RDungeonMap)map).RDungeonIndex == 17 && ((RDungeonMap)map).RDungeonFloor >= 25
                    || ((RDungeonMap)map).RDungeonIndex == 18) {
                        if (Server.Math.Rand(0, 10) == 0) {
                            InventoryItem item = new InventoryItem();
                            item.Num = 259;

                            switch (Server.Math.Rand(0, 5)) {
                                case 0: {
                                        item.Tag = "151";
                                    }
                                    break;
                                case 1: {
                                        item.Tag = "251";
                                    }
                                    break;
                                case 2: {
                                        item.Tag = "385";
                                    }
                                    break;
                                case 3: {
                                        item.Tag = "490";
                                    }
                                    break;
                                case 4: {
                                        item.Tag = "492";
                                    }
                                    break;
                            }

                            spawnedNpc.GiveItem(item);
                        }
                    }
                }

                if (HasAbility(spawnedNpc, "Pickup") && map.MapType == Enums.MapType.RDungeonMap && spawnedNpc.HeldItem == null) {
                    RDungeonFloor floor = RDungeonManager.RDungeons[((RDungeonMap)map).RDungeonIndex].Floors[((RDungeonMap)map).RDungeonFloor];
                    if (floor.Items.Count > 0) {
                        int rand = Server.Math.Rand(0, floor.Items.Count);
                        if (Server.Math.Rand(0, 200) <= floor.Items[rand].AppearanceRate) {
                            int amount = (floor.Items[rand].MinAmount + floor.Items[rand].MaxAmount) / 2;
                            InventoryItem item = new InventoryItem();
                            item.Num = floor.Items[rand].ItemNum;
                            item.Amount = amount;
                            item.Tag = floor.Items[rand].Tag;
                            spawnedNpc.GiveItem(item);
                        }
                    }
                }

                if (HasAbility(spawnedNpc, "Honey Gather") && map.MapType == Enums.MapType.RDungeonMap && spawnedNpc.HeldItem == null) {
                    RDungeonFloor floor = RDungeonManager.RDungeons[((RDungeonMap)map).RDungeonIndex].Floors[((RDungeonMap)map).RDungeonFloor];
                    if (Server.Math.Rand(0, 400) <= spawnedNpc.Level) {
                        InventoryItem item = new InventoryItem();
                        item.Num = 11;
                        spawnedNpc.GiveItem(item);
                    }
                }

                if (HasAbility(spawnedNpc, "Illusion")) {
                    TargetCollection friendlyTargets = MoveProcessor.GetTargetsInRange(Enums.MoveRange.Floor, 0, map, spawnedNpc, spawnedNpc.X, spawnedNpc.Y, Enums.Direction.Up, false, true, false);
                    if (friendlyTargets.Friends.Count > 0) {
                        AddExtraStatus(spawnedNpc, map, "Illusion", friendlyTargets[Server.Math.Rand(0, friendlyTargets.Friends.Count)].Sprite, null, "", hitlist);
                    }
                }

                if (spawnedNpc.HasActiveItem(213)) {
                    AddExtraStatus(spawnedNpc, map, "Illusion", 25, null, "", hitlist, false);
                }
                if (spawnedNpc.HasActiveItem(224)) {
                    AddExtraStatus(spawnedNpc, map, "Illusion", 300, null, "", hitlist, false);
                }
                if (spawnedNpc.HasActiveItem(244)) {
                    AddExtraStatus(spawnedNpc, map, "Illusion", 387, null, "", hitlist, false);
                }
                if (spawnedNpc.HasActiveItem(245)) {
                    AddExtraStatus(spawnedNpc, map, "Illusion", 390, null, "", hitlist, false);
                }
                if (spawnedNpc.HasActiveItem(246)) {
                    AddExtraStatus(spawnedNpc, map, "Illusion", 393, null, "", hitlist, false);
                }
                //if (spawnedNpc.HasActiveItem(259) && spawnedNpc.HeldItem.Num == 259 && map.Moral == Enums.MapMoral.House) {
                //    AddExtraStatus(spawnedNpc, map, "Illusion", spawnedNpc.HeldItem.Tag.ToInt(), null, "", hitlist);
                //}

                RefreshCharacterTraits(spawnedNpc, map, hitlist);

                if (map.Tile[spawnedNpc.X, spawnedNpc.Y].Type == Enums.TileType.Arena || map.Moral == Enums.MapMoral.None || map.Moral == Enums.MapMoral.NoPenalty) {
                    if (HasAbility(spawnedNpc, "Sand Stream")) {
                        SetMapWeather(map, Enums.Weather.Sandstorm, hitlist);
                    } else if (HasAbility(spawnedNpc, "Snow Warning")) {
                        SetMapWeather(map, Enums.Weather.Hail, hitlist);
                    } else if (HasAbility(spawnedNpc, "Drizzle")) {
                        SetMapWeather(map, Enums.Weather.Raining, hitlist);
                    } else if (HasAbility(spawnedNpc, "Drought")) {
                        SetMapWeather(map, Enums.Weather.Sunny, hitlist);
                    } else if (HasAbility(spawnedNpc, "Air Lock")) {
                        SetMapWeather(map, Enums.Weather.None, hitlist);
                    } else if (HasAbility(spawnedNpc, "Cloud Nine")) {
                        SetMapWeather(map, Enums.Weather.None, hitlist);
                    }
                }

                if (HasAbility(spawnedNpc, "Download")) {
                    int totalDef = 0;
                    int totalSpDef = 0;
                    TargetCollection targets = MoveProcessor.GetTargetsInRange(Enums.MoveRange.Floor, 0, map, spawnedNpc, spawnedNpc.X, spawnedNpc.Y, Enums.Direction.Up, true, false, false);
                    for (int i = 0; i < targets.Foes.Count; i++) {
                        totalDef += targets.Foes[i].Def;
                        totalSpDef += targets.Foes[i].SpclDef;
                    }

                    if (totalDef < totalSpDef) {
                        ChangeAttackBuff(spawnedNpc, map, 1, hitlist);
                    } else {
                        ChangeSpAtkBuff(spawnedNpc, map, 1, hitlist);
                    }
                }

                if (HasAbility(spawnedNpc, "Stench")) {
                    if (map.NpcSpawnWait == null) map.NpcSpawnWait = Core.GetTickCount();
                    map.NpcSpawnWait = new TickCount(map.NpcSpawnWait.Tick + map.NpcSpawnTime * 500);
                }

                if (HasAbility(spawnedNpc, "Illuminate")) {
                    if (map.NpcSpawnWait == null) map.NpcSpawnWait = Core.GetTickCount();
                    map.NpcSpawnWait = new TickCount(map.NpcSpawnWait.Tick - map.NpcSpawnTime * 500);
                }

                //if (MapManager.ActiveMaps[spawnedNpc.MapID].MapType == Enums.MapType.RDungeonMap) {
                //	RDungeonMap map = (RDungeonMap)MapManager.ActiveMaps[spawnedNpc.MapID];
                //	if (map.RDungeonIndex == 34 && map.RDungeonFloor > 8) {
                //		if (Server.Math.Rand(0, 20) == 0 && !MapContainsNpc(map, 306)) {
                //			foreach(Client n in map.GetClients()) {
                //				StoryManager.PlayStory(n, 185);
                //			}
                //		}
                //	}
                //}
            } catch (Exception ex) {
                Messenger.AdminMsg("Error: OnNpcSpawn", Text.Black);
                Messenger.AdminMsg(map.Name + " with " + spawnedNpc.Num + " from " + spawnedNpc.MapSlot, Text.Pink);
                Messenger.AdminMsg(ex.ToString(), Text.Black);
            }
        }
コード例 #30
0
        public static void SpawnNpcsBad(Client client, IMap imap)
        {
            //super-hack-ish code, just making it work
            int rand, n;
            int[] npcs = new int[] { 558, 559, 560, 571, 572, 854, 855, 856, 857, 858, 859, 860, 861, 862, 863 };

            if (imap.MaxX == 19) {
                rand = Server.Math.Rand(0, 20);
                if (rand == 0) { //no NPCs
                    n = 0;
                } else if (rand > 0 && rand <= 3) { //1 NPC
                    n = 1;
                } else if (rand > 3 && rand <= 9) { //2 NPCs
                    n = 2;
                } else if (rand > 9 && rand <= 15) { //3 NPCs
                    n = 3;
                } else if (rand > 15 && rand <= 18) { //4 NPCs
                    n = 4;
                } else { //rand == 19, 5 NPCs
                    n = 5;
                }
            }
            else {
                rand = Server.Math.Rand(0,25);
                if (rand == 0) { //no NPCs
                    n = 0;
                } else if (rand > 0 && rand <= 2) { //1 NPC
                    n = 1;
                } else if (rand > 2 && rand <= 5) { //2 NPCs
                    n = 2;
                } else if (rand > 5 && rand <= 9) { //3 NPCs
                    n = 3;
                } else if (rand > 9 && rand <= 14) { //4 NPCs
                    n = 4;
                } else if (rand > 14 && rand <= 18) { //5 NPCs
                    n = 5;
                } else if (rand > 18 && rand <= 21) { //6 NPCs
                    n = 6;
                } else if (rand > 21 && rand <= 23) { //7 NPCs
                    n = 7;
                } else { //rand == 24, 8 NPCs
                    n = 8;
                }
               	}

               	for (int i = 1; i <= n; i++) {
                MapNpcPreset npc = new MapNpcPreset();
                rand = Server.Math.Rand(0, npcs.Length);
                npc.NpcNum = npcs[rand];
                if (npcs[rand] == 859) {
                    npc.MinLevel = 10;
                    npc.MaxLevel = 10;
                } else {
                    npc.MinLevel = 50;
                    npc.MaxLevel = 80;
                }
                //npc.AppearanceRate = 100;
                imap.SpawnNpc(npc);
            }
        }
コード例 #31
0
ファイル: Main.cs プロジェクト: MandL27/Server
        public static void QuestionResult(Client client, string questionID, string answer)
        {
            try {
                if (questionID.StartsWith("EnterRDungeon") && answer == "Yes") {
                    if (questionID.Split(':')[3] == "") {
                        client.Player.WarpToRDungeon(questionID.Split(':')[1].ToInt(), questionID.Split(':')[2].ToInt(0));
                    } else if (questionID.Split(':')[3].IsNumeric()) {
                        if (DungeonManager.Dungeons[questionID.Split(':')[3].ToInt()].ScriptList.ContainsKey(2)) {
                            //Story warningStory = DungeonRules.GetEntranceWarning(client, DungeonManager.Dungeons[questionID.Split(':')[3].ToInt()].Name,
                            //	DungeonManager.Dungeons[questionID.Split(':')[3].ToInt()].ScriptList[2].Split(';'));
                        } else {
                            client.Player.WarpToRDungeon(questionID.Split(':')[1].ToInt(), questionID.Split(':')[2].ToInt(0));
                            client.Player.AddDungeonAttempt(questionID.Split(':')[3].ToInt() - 1);
                        }
                    } else {

                    }

                }
                if (questionID.StartsWith("Level1RDungeon") && answer == "Yes") {
                    client.Player.BeginTempStatMode(questionID.Split(':')[3].ToInt(), true);
                    client.Player.WarpToRDungeon(questionID.Split(':')[1].ToInt(), questionID.Split(':')[2].ToInt(0));
                }
                if (questionID.StartsWith("SkyDrop") && answer == "Yes") {
                    string[] param = questionID.Split(':');
                    Messenger.PlayerWarp(client, param[1].ToInt(), param[2].ToInt(), param[3].ToInt());
                }

                if (questionID.StartsWith("SummonGuardian")) {

                    if (answer == "Cancel") {

                    } else if (answer == "Others") {
                        string[] idArray = questionID.Split(':');
                        int page = idArray[1].ToInt() + 1;
                            string[] choicesNum = idArray[2].Split(';');
                                if (choicesNum.Length > 1) {
                                    List<string> choices = new List<string>();
                                    if (5*page >= choicesNum.Length-1) {
                                        page = 0;
                                    }
                                    for (int i = 5*page; i < choicesNum.Length-1; i++) {
                                        if (choices.Count >= 5) {
                                            break;
                                        }
                                        choices.Add("#" + choicesNum[i] + ": " + Pokedex.GetPokemon(choicesNum[i].ToInt()).Name);
                                    }
                                    choices.Add("Others");
                                    choices.Add("Cancel");

                                    Messenger.AskQuestion(client, "SummonGuardian:"+ page + ":" + idArray[2], "Which ally will you call forth?", -1, choices.ToArray());
                                }
                    } else {
                    int legendNumber = answer.Substring(1).Split(':')[0].ToInt();

                    Messenger.PlayerMsg(client, "A light shot up from the Mystery Part, and " + Pokedex.GetPokemon(legendNumber).Name + "'s guardian sign pierced the skies asunder!", Text.Cyan);
                    Messenger.PlaySoundToMap(client.Player.MapID, "magic767.wav");
                    bool taken = false;
                    for (int i = 0; i < Constants.MAX_ACTIVETEAM; i++) {
                        if (client.Player.Team[i] != null && client.Player.Team[i].Loaded) {
                            if (client.Player.Team[i].Species == legendNumber) {
                                taken = true;
                                break;
                            }
                        }
                    }
                    if (client.Player.PartyID != null) {
                        Party party = PartyManager.FindPlayerParty(client);
                        foreach (string memberID in party.GetMemberCharacters()) {
                            Client n = ClientManager.FindClientFromCharID(memberID);
                            if (n != null) {
                                for (int i = 0; i < Constants.MAX_ACTIVETEAM; i++) {
                                    if (n.Player.Team[i] != null && n.Player.Team[i].Loaded) {
                                        if (n.Player.Team[i].Species == legendNumber) {
                                            taken = true;
                                            break;
                                        }
                                    }
                                }
                            } else {
                                using (DatabaseConnection dbConnection = new DatabaseConnection(DatabaseID.Players)) {
                                    List<PMDCP.DatabaseConnector.MySql.DataColumnCollection> rows = dbConnection.Database.RetrieveRows("SELECT D.Species FROM pmdcp_players.recruit_data D " +
                                    "WHERE D.CharID = \'" + memberID + "\';");
                                    if (rows != null) {
                                    for (int i = 0; i < rows.Count; i++) {
                                        if (rows[i]["Species"].ValueString.ToInt() == legendNumber) {
                                            taken = true;
                                            break;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                                if (!taken) {
                                int openSlot = client.Player.FindOpenTeamSlot();
                                    if (openSlot > -1) {
                                        client.Player.AddToTeamTemp(openSlot,
                                            legendNumber,
                                            0,
                                            100, (Constants.MAX_JOB_LIST + openSlot));
                                        Messenger.PlayerMsg(client, Server.Pokedex.Pokedex.GetPokemon(legendNumber).Name +
                                            " joined the team!", Text.BrightGreen);
                                        Messenger.SendActiveTeam(client);

                                    }
                                } else {
                                    Messenger.PlayerMsg(client, "But " + Server.Pokedex.Pokedex.GetPokemon(legendNumber).Name +
                                            " is already an ally!", Text.BrightGreen);
                                }
                            }
                }

                if (questionID.StartsWith("UseItem")) {
                            if (answer == "Yes") {
                                int num = questionID.Split(':')[1].ToInt();
                                int slot = 0;
                                for (int i = 1; i <= client.Player.Inventory.Count; i++) {
                                    if (client.Player.Inventory[i].Num == num && !client.Player.Inventory[i].Sticky) {
                                        slot = i;
                                        break;
                                    }
                                }
                                //Messenger.PlayerMsg(client, "yes" + slot, Text.Blue);
                                if (slot > 0) {
                                    client.Player.UseItem(client.Player.Inventory[slot], slot);
                                }
                            }
                }

                // Called when a player answers a yes/no question
                switch (questionID) {
                    case "Appraisal": {
                            if (answer == "Yes") {
                                int boxes = 0;
                                for (int i = 1; i <= client.Player.Inventory.Count; i++) {
                                    if (client.Player.Inventory[i].Num != 0
                                        && ItemManager.Items[client.Player.Inventory[i].Num].Type == Enums.ItemType.Scripted
                                        && ItemManager.Items[client.Player.Inventory[i].Num].Data1 == 12
                                        && !client.Player.Inventory[i].Sticky) {
                                        boxes++;
                                    }
                                }
                                if (client.Player.HasItem(1) >= 150 * boxes) {
                                    client.Player.TakeItem(1, 150 * boxes, true);
                                    for (int i = 1; i <= client.Player.Inventory.Count; i++) {
                                        if (client.Player.Inventory[i].Num != 0
                                            && ItemManager.Items[client.Player.Inventory[i].Num].Type == Enums.ItemType.Scripted
                                            && ItemManager.Items[client.Player.Inventory[i].Num].Data1 == 12
                                            && !client.Player.Inventory[i].Sticky) {
                                            OpenBox(client, client.Player.Inventory[i], i);
                                        }
                                    }
                                    Messenger.PlaySoundToMap(client.Player.MapID, "magic227.wav");
                                    Story story = new Story();
                                    StoryBuilderSegment segment = StoryBuilder.BuildStory();
                                    StoryBuilder.AppendSaySegment(segment, "All treasure boxes were opened!", -1, 0, 0);
                                    segment.AppendToStory(story);
                                    StoryManager.PlayStory(client, story);
                                } else {
                                    Messenger.PlayerMsg(client, "You do not have enough to open your boxes!", Text.BrightRed);
                                }
                            }
                        }
                        break;
                    case "Unsticky": {
                            if (answer == "Yes") {
                                for (int i = 1; i <= client.Player.Inventory.Count; i++) {
                                    if (client.Player.Inventory[i].Sticky) {
                                        client.Player.SetItemSticky(i, false);
                                    }
                                }
                                Messenger.PlaySoundToMap(client.Player.MapID, "magic231.wav");
                                //Messenger.PlayerMsg(client, "All sticky items have been cleansed!", Text.Cyan);
                                Story story = new Story();
                                StoryBuilderSegment segment = StoryBuilder.BuildStory();
                                StoryBuilder.AppendSaySegment(segment, "All sticky items have been cleansed!", -1, 0, 0);
                                segment.AppendToStory(story);
                                StoryManager.PlayStory(client, story);
                            }
                        }
                        break;
                    case "TradeEgg": {
                            if (answer == "Yes") {
                                int takenItem = 0;
                                for (int i = 1; i <= client.Player.Inventory.Count; i++) {
                                    if (client.Player.Inventory[i].Num == 110 || client.Player.Inventory[i].Num == 109 || client.Player.Inventory[i].Num == 131) {
                                        takenItem = i;
                                    }
                                }
                                Messenger.PlaySoundToMap(client.Player.MapID, "magic693.wav");
                                client.Player.TakeItemSlot(takenItem, 1, true);
                                client.Player.GiveItem(538, 1, "641;642;643;644;645;646;647;648;649;650;651;652;653;654;655;656;657;" +
                                    "661;662;663;664;665;666;667;668;669;670;671;672;673;674;675;676;677", false);
                                //Messenger.PlayerMsg(client, "You were given a gift in exchange for the Egg!", Text.BrightGreen);
                                Story story = new Story();
                                StoryBuilderSegment segment = StoryBuilder.BuildStory();
                                StoryBuilder.AppendSaySegment(segment, "You were given a gift in exchange for the Egg!", -1, 0, 0);
                                segment.AppendToStory(story);
                                StoryManager.PlayStory(client, story);

                            } else {
                                Story story = new Story();
                                StoryBuilderSegment segment = StoryBuilder.BuildStory();
                                StoryBuilder.AppendSaySegment(segment, "Well, then I hope you take good care of it!", Pokedex.FindByName("Togekiss").ID, 0, 0);
                                segment.AppendToStory(story);
                                StoryManager.PlayStory(client, story);
                            }
                        }
                        break;
                    case "RecallEggMove": {
                            if (answer == "Yes") {

                                client.Player.TakeItem(702, 1, true);
                                Story story = new Story();
                                StoryBuilderSegment segment = StoryBuilder.BuildStory();
                                StoryBuilder.AppendSaySegment(segment, "Okay, here goes!", Pokedex.FindByName("Togetic").ID, 0, 0);
                                StoryBuilder.AppendRunScriptAction(segment, 48, "", "", "", true);
                                segment.AppendToStory(story);
                                StoryManager.PlayStory(client, story);

                            } else {
                                Story story = new Story();
                                StoryBuilderSegment segment = StoryBuilder.BuildStory();
                                StoryBuilder.AppendSaySegment(segment, "Well, alright then!  Let me know when you feel like learning something fun!", Pokedex.FindByName("Togetic").ID, 0, 0);
                                segment.AppendToStory(story);
                                StoryManager.PlayStory(client, story);
                            }
                        }
                        break;
                    case "LearnTutorMove": {
                            int item = 0;
                            if (answer == ItemManager.Items[263].Name) {
                                item = 263;
                            } else if (answer == ItemManager.Items[264].Name) {
                                item = 264;
                            } else if (answer == ItemManager.Items[265].Name) {
                                item = 265;
                            } else if (answer == ItemManager.Items[266].Name) {
                                item = 266;
                            }

                            if (item > 0 && client.Player.HasItem(item) > 0) {
                                client.Player.TakeItem(item, 1, true);
                                Story story = new Story();
                                StoryBuilderSegment segment = StoryBuilder.BuildStory();
                                StoryBuilder.AppendSaySegment(segment, "Very well, let us commence!", Pokedex.FindByName("Bronzong").ID, 0, 0);
                                StoryBuilder.AppendRunScriptAction(segment, 71, item.ToString(), "", "", true);
                                segment.AppendToStory(story);
                                StoryManager.PlayStory(client, story);

                            } else {
                                Story story = new Story();
                                StoryBuilderSegment segment = StoryBuilder.BuildStory();
                                StoryBuilder.AppendSaySegment(segment, "Very well.  I shall wait here until you wish to part with your shards.", Pokedex.FindByName("Bronzong").ID, 0, 0);
                                segment.AppendToStory(story);
                                StoryManager.PlayStory(client, story);
                            }
                        }
                        break;
                    case "ShellBell": {
                            if (answer == "Yes") {
                                int shellCount = 0;
                                int saltCount = 0;
                                for (int i = 1; i <= client.Player.Inventory.Count; i++) {
                                    if (client.Player.Inventory[i].Num == 96) {
                                        shellCount++;
                                    } else if (client.Player.Inventory[i].Num == 102) {
                                        saltCount++;
                                    }
                                }

                                if (saltCount >= 5 && shellCount >= 5) {
                                    for (int i = 0; i < 5; i++) {
                                        client.Player.TakeItem(96, 1, true);
                                        client.Player.TakeItem(102, 1, true);
                                    }

                                    Story story = new Story();
                                    StoryBuilderSegment segment = StoryBuilder.BuildStory();
                                    StoryBuilder.AppendSaySegment(segment, "Okay, just give me a moment...", Pokedex.FindByName("Oshawott").ID, 0, 0);
                                    StoryBuilder.AppendPauseAction(segment, 1500);
                                    StoryBuilder.AppendSaySegment(segment, "Ta-da!  Here you go!", Pokedex.FindByName("Oshawott").ID, 0, 0);
                                    StoryBuilder.AppendRunScriptAction(segment, 35, "", "", "", true);
                                    StoryBuilder.AppendPauseAction(segment, 1000);

                                    StoryBuilder.AppendAskQuestionAction(segment, "So what'ja think?  You like it?", segment.Segments.Count + 2, segment.Segments.Count + 4, Pokedex.FindByName("Oshawott").ID);

                                    StoryBuilder.AppendSaySegment(segment, "Awww, gee... thanks!", Pokedex.FindByName("Oshawott").ID, 0, 0);
                                    StoryBuilder.AppendGoToSegmentAction(segment, segment.Segments.Count + 5);
                                    StoryBuilder.AppendSaySegment(segment, "Oh...", Pokedex.FindByName("Oshawott").ID, 0, 0);
                                    StoryBuilder.AppendPauseAction(segment, 500);
                                    StoryBuilder.AppendSaySegment(segment, "I'm sorry...", Pokedex.FindByName("Oshawott").ID, 0, 0);

                                    segment.AppendToStory(story);
                                    StoryManager.PlayStory(client, story);
                                }
                            } else {
                                Story story = new Story();
                                StoryBuilderSegment segment = StoryBuilder.BuildStory();
                                StoryBuilder.AppendSaySegment(segment, "You- you don't?", Pokedex.FindByName("Oshawott").ID, 0, 0);
                                StoryBuilder.AppendSaySegment(segment, "Well... okay...", Pokedex.FindByName("Oshawott").ID, 0, 0);
                                segment.AppendToStory(story);
                                StoryManager.PlayStory(client, story);
                            }
                        }
                        break;
                    case "HouseSpawn": {
                            if (answer == "Yes") {
                                if (client.Player.Map.MapType == Server.Enums.MapType.House &&
                                    ((House)client.Player.Map).OwnerID == client.Player.CharID) {
                                        if (client.Player.HasItem(1) >= 500) {
                                            client.Player.TakeItem(1, 500, true);
                                            ((House)client.Player.Map).StartX = client.Player.X;
                                            ((House)client.Player.Map).StartY = client.Player.Y;
                                            client.Player.Map.Save();
                                            Messenger.PlayerMsg(client, "You have set your house's entrance point!", Text.BrightGreen);
                                        } else {
                                            Messenger.PlayerMsg(client, "You don't have enough " + ItemManager.Items[1].Name + "!", Text.BrightRed);
                                        }
                                } else {
                                    Messenger.PlayerMsg(client, "You can't set your house entrance here!", Text.BrightRed);
                                }
                            }
                        }
                        break;
                    case "HouseRoof": {
                            if (answer == "Yes") {
                                if (client.Player.Map.MapType == Server.Enums.MapType.House &&
                                    ((House)client.Player.Map).OwnerID == client.Player.CharID) {
                                        if (client.Player.HasItem(1) >= 500) {
                                            client.Player.TakeItem(1, 500, true);
                                            client.Player.Map.Indoors = !client.Player.Map.Indoors;
                                            client.Player.Map.Save();
                                            if (client.Player.Map.Indoors) {
                                                Messenger.PlayerMsg(client, "You have closed your house's roof!", Text.BrightGreen);
                                            } else {
                                                Messenger.PlayerMsg(client, "You have opened your house's roof!", Text.BrightGreen);
                                            }
                                            Messenger.RefreshMap(client);
                                        } else {
                                            Messenger.PlayerMsg(client, "You don't have enough " + ItemManager.Items[1].Name + "!", Text.BrightRed);
                                        }
                                } else {
                                    Messenger.PlayerMsg(client, "You can't set your house entrance here!", Text.BrightRed);
                                }
                            }
                        }
                        break;
                    case "DiglettMission": {
                            if (answer == "Yes") {
                                StoryManager.PlayStory(client, 415);
                            } else {
                                StoryManager.PlayStory(client, 414);
                            }
                        }
                        break;
                    case "FerryTicketUse": {//originally used in place of Keyblocks during exploitations of the Refresh Glitch.
                            if (answer == "Yes") {
                                client.Player.TakeItem(49, 1);
                                Messenger.PlayerWarp(client, 880, 16, 12);
                            } else {
                                Messenger.PlayerMsg(client, "Ok. Come back later!", Text.Yellow);
                            }
                        }
                        break;
                    case "MassWarpAuction": {
                            if (answer == "Yes") {
                                Messenger.PlayerWarp(client, 363, 10, 13);
                            }
                        }
                        break;
                    case "WarptoForlorn": {
                            if (answer == "Yes") {
                                Messenger.PlayerWarp(client, 684, 4, 29);
                            }
                            //if (answer == true) {
                            //    NetScript.PlayerWarp(index, 1109, 10, 7);
                            //}
                        }
                        break;
                    case "WarptoTanren": {
                            if (answer == "Yes") {
                                Messenger.PlayerWarp(client, 78, 37, 19);
                            }
                            //if (answer == true) {
                            //    NetScript.PlayerWarp(index, 390, 9, 10);
                            //}
                        }
                        break;
                    case "uselotteryticket": {
                            if (answer == "Yes") {
                                Lottery.VerifyWinner(client);
                            }
                        }
                        break;
                    case "buylotteryticket": {
                            if (answer == "Yes") {
                                Lottery.BuyLotteryTicket(client);
                            }
                        }
                        break;
                    case "Fireplace": {
                            if (answer == "Yes") {
                                //Messenger.SpellAnim(452, client.Player.MapID, 15, 4);
                                Messenger.PlaySoundToMap(client.Player.MapID, "magic68.wav");
                                StoryManager.PlayStory(client, 35);
                            }
                        }
                        break;
                    case "Surf": {
                            if (answer == "Yes") {
                                int surfSlot = -1;
                                for (int i = 0; i < Constants.MAX_PLAYER_MOVES; i++) {
                                    if (client.Player.GetActiveRecruit().Moves[i].MoveNum == 462) {
                                        surfSlot = i;
                                    }
                                }

                                if (surfSlot > -1) {
                                    client.Player.GetActiveRecruit().UseMove(surfSlot);
                                }
                            }
                        }
                        break;
                    case "RockClimb": {
                            if (answer == "Yes") {
                                int surfSlot = -1;
                                for (int i = 0; i < Constants.MAX_PLAYER_MOVES; i++) {
                                    if (client.Player.GetActiveRecruit().Moves[i].MoveNum == 456) {
                                        surfSlot = i;
                                    }
                                }

                                if (surfSlot > -1) {
                                    client.Player.GetActiveRecruit().UseMove(surfSlot);
                                }
                            }
                        }
                        break;
                    case "AbandonedMansion": {
                            if (answer == "Yes") {
                                StoryManager.PlayStory(client, 297);
                                //NetScript.AskQuestion(index, "AbandonedMansion2", "Only the team leader may enter this dungeon, is that OK?", -1);
                            }
                        }
                        break;
                    case "AbandonedMansion2": {
                            //Debug.Print("---");
                            if (answer == "Yes") {
                                if (client.Player.MapID == MapManager.GenerateMapID(743)) {
                                    if (client.Player.X == 11) {
                                        Messenger.PlaySoundToMap(client.Player.MapID, "key.wav");
                                        client.Player.TakeItem(249, 1);
                                        Messenger.PlayerMsg(client, "The key dissolves.", Text.Yellow);
                                        client.Player.WarpToRDungeon(16, 0);
                                    } else if (client.Player.X == 21) {
                                        Messenger.PlaySoundToMap(client.Player.MapID, "key.wav");
                                        client.Player.TakeItem(248, 1);
                                        Messenger.PlayerMsg(client, "The key dissolves.", Text.Yellow);
                                        client.Player.WarpToRDungeon(15, 0);
                                    } else if (client.Player.X == 16) {
                                        Messenger.PlaySoundToMap(client.Player.MapID, "key.wav");
                                        client.Player.TakeItem(252, 1);
                                        Messenger.PlayerMsg(client, "The key dissolves.", Text.Yellow);
                                        client.Player.WarpToRDungeon(17, 0);
                                    }
                                }
                            }
                        }
                        break;
                    case "WarptoPokehallow": {
                            if (answer == "Yes") {
                                Messenger.PlayerWarp(client, 743, 16, 11);
                            }
                        }
                        break;
                    case "HallowedWell": {
                            if (answer == "Yes") {
                                StoryManager.PlayStory(client, 294);
                            }
                        }
                        break;
                    case "HallowedWell2": {
                            if (answer == "Yes") {
                                Messenger.PlaySoundToMap(client.Player.MapID, "DeepFall.wav");
                                client.Player.WarpToRDungeon(20, 0);
                            }
                        }
                        break;
                    case "AfterDeath": {
                        switch (answer) {
                            case "Revive": {
                                    AskReviveQuestion(client);
                                }
                                break;
                            case "Switch": {
                                    AskRecruitSwapQuestion(client);
                                }
                                break;
                            case "Escape": {
                                    Messenger.AskQuestion(client, "Escape", "Will you use your Escape Rope to retreat from the dungeon?  It will not count as a defeat.", -1);
                                }
                                break;
                            case "Give Up": {
                                    GiveUp(client);
                                }
                                break;
                            }

                        }
                        break;
                    case "AfterDeathRevive": {
                            if (answer == ItemManager.Items[489].Name) {
                                ActivateRevivalItem(client, 489);
                            } else if (answer == ItemManager.Items[452].Name) {
                                ActivateRevivalItem(client, 452);
                            } else if (answer == ItemManager.Items[451].Name) {
                                ActivateRevivalItem(client, 451);
                            } else if (answer == ItemManager.Items[450].Name) {
                                ActivateRevivalItem(client, 450);
                            } else if (answer == ItemManager.Items[749].Name) {
                                ActivateRevivalItem(client, 749);
                            } else {
                                AskAfterDeathQuestion(client);
                            }
                        }
                        break;
                    case "AfterDeathSwap": {
                        if (answer.StartsWith("Slot #")) {
                            int slot = answer.Substring(6).ToInt() - 1;
                            int activeSlot = client.Player.ActiveSlot;
                            string name = client.Player.GetActiveRecruit().Name;

                            List<ExtraStatus> passedStatus = GetTeamStatus(client.Player.GetActiveRecruit());

                            foreach (ExtraStatus status in passedStatus) {
                                client.Player.GetActiveRecruit().VolatileStatus.Add(status);
                                Messenger.BattleMsg(client, status.Name, Text.BrightRed);
                            }

                            client.Player.SwapActiveRecruit(slot, true);
                            client.Player.RestoreRecruitStats(activeSlot);

                            client.Player.RemoveFromTeam(activeSlot);

                            client.Player.Dead = false;
                            PacketHitList hitlist = null;
                            PacketHitList.MethodStart(ref hitlist);
                            PacketBuilder.AppendDead(client, hitlist);
                            PacketHitList.MethodEnded(ref hitlist);

                            Messenger.SendActiveTeam(client);
                        } else {
                            AskAfterDeathQuestion(client);
                        }
                        }
                        break;
                    case "GiveUp": {
                            if (answer == "Yes") {
                                Messenger.MapMsg(client.Player.MapID, client.Player.Name + " has given-up on the exploration!", Text.BrightRed);
                                client.Player.GetActiveRecruit().StatusAilment = Enums.StatusAilment.OK;
                                client.Player.GetActiveRecruit().StatusAilmentCounter = 0;
                                HandleGameOver(client, Enums.KillType.Other);
                            } else if (client.Player.Dead) {
                                AskAfterDeathQuestion(client);
                            }
                        }
                        break;
                    case "Escape": {
                            if (answer == "Yes") {
                                int slot = 0;

                                for (int i = 1; i <= client.Player.Inventory.Count; i++) {
                                    if (client.Player.Inventory[i].Num == 350 && !client.Player.Inventory[i].Sticky) {
                                        slot = i;
                                        break;
                                    }
                                }

                                if (slot > 0) {
                                    client.Player.TakeItemSlot(slot, 1, true);
                                    Escape(client);
                                } else {
                                    Messenger.MapMsg(client.Player.MapID, client.Player.Name + " couldn't escape!", Text.BrightRed);
                                }

                            } else if (client.Player.Dead) {
                                AskAfterDeathQuestion(client);
                            }
                        }
                        break;
                    case "TradeItem": {
                            if (answer == "Yes") {
                                int itemTaken = client.Player.FindInvSlot(110);
                                if (client.Player.FindInvSlot(109) > itemTaken) {
                                    itemTaken = client.Player.FindInvSlot(109);
                                }
                                if (client.Player.FindInvSlot(131) > itemTaken) {
                                    itemTaken = client.Player.FindInvSlot(131);
                                }
                                if (itemTaken > -1) {
                                    client.Player.TakeItemSlot(itemTaken, 1, true);
                                    client.Player.GiveItem(538, 1, "38;45;125;290;194;299;300;301;302");
                                }
                            }
                        }
                        break;
                    case "CliffsideTablet": {
                            if (answer == "Yes") {
                                if (client.Player.FindInvSlot(-1) > 0) {
                                    client.Player.GiveItem(479, 1);
                                    IMap map = client.Player.Map;
                                    map.SetTile(10, 1, 0, 10, 3);
                                    map.SetTile(10, 1, 0, 10, 4);
                                    map.SetAttribute(10, 1, Enums.TileType.Blocked, 0, 0, 0, "0", "0", "0");
                                    Messenger.SendTile(10, 1, map);
                                    Messenger.PlayerMsg(client, "You obtained a Tablet!", Text.Yellow);
                                } else {
                                    Messenger.PlayerMsg(client, "Your inventory is full...", Text.BrightRed);
                                }
                            }
                        }
                        break;
                    case "TournamentAdminOptions": {
                            if (answer == "Start Tournament") {
                                if (client.Player.Tournament != null) {
                                    Tournament tourny = client.Player.Tournament;
                                    if (tourny.RegisteredMembers[client].Admin) {
                                        if (tourny.IsReadyToStart()) {
                                            tourny.StartRound(new MatchUpRules());

                                            Story playerOneStory = new Story();
                                            StoryBuilderSegment playerOneSegment = StoryBuilder.BuildStory();
                                            StoryBuilder.AppendSaySegment(playerOneSegment, "Your match is ready to begin!", -1, 0, 0);
                                            StoryBuilder.AppendMovePlayerAction(playerOneSegment, 8, 2, Enums.Speed.Walking, true);
                                            playerOneSegment.AppendToStory(playerOneStory);

                                            Story playerTwoStory = new Story();
                                            StoryBuilderSegment playerTwoSegment = StoryBuilder.BuildStory();
                                            StoryBuilder.AppendSaySegment(playerTwoSegment, "Your match is ready to begin!", -1, 0, 0);
                                            StoryBuilder.AppendMovePlayerAction(playerTwoSegment, 11, 2, Enums.Speed.Walking, true);
                                            playerTwoSegment.AppendToStory(playerTwoStory);

                                            for (int i = 0; i < tourny.ActiveMatchups.Count; i++) {
                                                StoryManager.PlayStory(tourny.ActiveMatchups[i].PlayerOne.Client, playerOneStory);
                                                StoryManager.PlayStory(tourny.ActiveMatchups[i].PlayerTwo.Client, playerTwoStory);
                                            }
                                        } else {
                                            Messenger.PlayerMsg(client, "The tournament is not ready to start!", Text.BrightRed);
                                        }
                                    }
                                }
                            } else if (answer == "Edit Rules") {
                                if (client.Player.Tournament != null) {
                                    Tournament tourny = client.Player.Tournament;
                                    if (tourny.RegisteredMembers[client].Admin) {
                                        Messenger.SendTournamentRulesEditorTo(client, null);
                                    } else {
                                        Messenger.PlayerMsg(client, "You are not a tournament organizer!", Text.BrightRed);
                                    }
                                }
                            }
                        }
                        break;
                   case "SnowballGameNewGame": {
                   			if (answer == "Yes") {
                   				string waitingGameOwner = SnowballGame.FindWaitingGame();
                   				if (!string.IsNullOrEmpty(waitingGameOwner)) {
                   					Messenger.PlayerMsg(client, "Someone else created a game, please join that game.", Text.BrightRed);
                   					return;
                   				}
                   				SnowballGame snowballGame = new SnowballGame();
                   				snowballGame.Init();
                   				snowballGame.CreateGame(client);

                   				ActiveSnowballGames.Add(client.Player.CharID, snowballGame);
                   				Messenger.MapMsg(client.Player.MapID, client.Player.Name + " created a new game!", Text.BrightGreen);
                   			}
                       }
                       break;
                   case "SnowballGameJoinGame": {
                   			if (answer == "Yes") {
                   				// Join game here

                   				SnowballGame.GetWaitingGame().AddToGame(client);
                   			}
                       }
                       break;
                   case "SnowballGameStart": {
                   			if (answer == "Yes") {
                   				// Star game here

                   				//Messenger.MapMsg(client.Player.MapID, client.Player.Name + " started the game!", Text.BrightGreen);
                   				//Messenger.PlayerMsg(client, "Pretend you started the game.", Text.BrightGreen);
                   				SnowballGame.GetWaitingGame().StartGame(client);
                   			}
                       }
                       break;
                   case "SwapShopTeamList": {
                         if (answer == "Proceed") {

                         List<string> choices = new List<string>();
                         choices.Add(Pokedex.GetPokemon(client.Player.Team[0].Species).Name);
                  		   for (int i = 0; i < Constants.MAX_ACTIVETEAM; i++) {
                     		  if (client.Player.Team[i] != null && client.Player.Team[i].Loaded) {
                      		    if (i > 0 && client.Player.Team[i].Species != client.Player.Team[i - 1].Species && client.Player.Team[i].Species != client.Player.Team[0].Species) {
                       			   choices.Add(Pokedex.GetPokemon(client.Player.Team[i].Species).Name);
                          }
                       }
                       }
                          Messenger.AskQuestion(client, "SwapShopItemList", "Whose list of rare exclusive items do you want to see?", Pokedex.FindByName("Croagunk").ID, choices.ToArray());
                           }
                         if (answer == "Summary") {

                         List<string> choices = new List<string>();
                         choices.Add(Pokedex.GetPokemon(client.Player.Team[0].Species).Name);
                  		   for (int i = 0; i < Constants.MAX_ACTIVETEAM; i++) {
                     		  if (client.Player.Team[i] != null && client.Player.Team[i].Loaded) {
                      		    if (i > 0 && client.Player.Team[i].Species != client.Player.Team[i - 1].Species && client.Player.Team[i].Species != client.Player.Team[0].Species) {
                       			   choices.Add(Pokedex.GetPokemon(client.Player.Team[i].Species).Name);
                          }
                       }
                       }
                          Messenger.AskQuestion(client, "SwapShopItemSummaryList", "Whose list of rare exclusive items do you want to know about?", Pokedex.FindByName("Croagunk").ID, choices.ToArray());
                           }
                         if (answer == "Cancel") {
                          Story story = new Story();
                          StoryBuilderSegment segment = StoryBuilder.BuildStory();
                          StoryBuilder.AppendSaySegment(segment, "You don't wanna swap? Meh-heh-heh... I get it!", Pokedex.FindByName("Croagunk").ID, 0, 0);
                          segment.AppendToStory(story);
                          StoryManager.PlayStory(client, story);
                            }
                         }
                        break;
                      case "SwapShopItemSummaryList" : {
                      int ItemFound = 0;
                      int PokemonID = Pokedex.FindByName(answer).ID;
                      List<string> choices = new List<string>();
                      for (int i = 998; i < 1838; i++) {

                        if (Pokedex.FindByName(answer).ID == ItemManager.Items[i].ReqData1 || Pokedex.FindByName(answer).ID == ItemManager.Items[i].ReqData2 || Pokedex.FindByName(answer).ID == ItemManager.Items[i].ReqData3 || Pokedex.FindByName(answer).ID == ItemManager.Items[i].ReqData4 || Pokedex.FindByName(answer).ID == ItemManager.Items[i].ReqData5) {
                          if (ItemManager.Items[i].Rarity == 3) {
                            choices.Add(ItemManager.Items[i].Name);
                            ItemFound = ItemFound + 1;
                            }
                          }
                          }
                      choices.Add("Cancel");
                     if (ItemFound == 0) {
                          Story story = new Story();
                          StoryBuilderSegment segment = StoryBuilder.BuildStory();
                          StoryBuilder.AppendSaySegment(segment, "Meh-heh-heh... I'm sorry to disappoint you but I'm afraid that " + answer + " has no rare exclusive items to use at the moment...", Pokedex.FindByName("Croagunk").ID, 0, 0);
                          StoryBuilder.AppendRunScriptAction(segment, 90, "", "", "", true);
                          segment.AppendToStory(story);
                          StoryManager.PlayStory(client, story);
                       }
                     if (ItemFound == 1) {
                      Messenger.AskQuestion(client, "SwapShopItemSummary", "Here is the rare exclusive item that " + answer + " can use...", Pokedex.FindByName("Croagunk").ID, choices.ToArray());
                       }
                     if (ItemFound > 1) {
                      Messenger.AskQuestion(client, "SwapShopItemSummary", "Here are the rare exclusive items that " + answer + " can use...", Pokedex.FindByName("Croagunk").ID, choices.ToArray());
                      }
                      }
                        break;
                      case "SwapShopItemList": {
                      int ItemFound = 0;
                      int PokemonID = Pokedex.FindByName(answer).ID;
                      List<string> choices = new List<string>();
                      for (int i = 998; i < 1838; i++) {

                        if (Pokedex.FindByName(answer).ID == ItemManager.Items[i].ReqData1 || Pokedex.FindByName(answer).ID == ItemManager.Items[i].ReqData2 || Pokedex.FindByName(answer).ID == ItemManager.Items[i].ReqData3 || Pokedex.FindByName(answer).ID == ItemManager.Items[i].ReqData4 || Pokedex.FindByName(answer).ID == ItemManager.Items[i].ReqData5) {
                          if (ItemManager.Items[i].Rarity == 3) {
                            choices.Add(ItemManager.Items[i].Name);
                            ItemFound = ItemFound + 1;
                            }
                          }
                          }
                      choices.Add("Cancel");
                     if (ItemFound == 0) {
                          Story story = new Story();
                          StoryBuilderSegment segment = StoryBuilder.BuildStory();
                          StoryBuilder.AppendSaySegment(segment, "Meh-heh-heh... I'm sorry to disappoint you but I'm afraid that " + answer + " has no rare exclusive items to use at the moment...", Pokedex.FindByName("Croagunk").ID, 0, 0);
                          segment.AppendToStory(story);
                          StoryManager.PlayStory(client, story);
                       }
                     if (ItemFound == 1) {
                      Messenger.AskQuestion(client, "SwapShopReq", "Here is the rare exclusive item that " + answer + " can use...", Pokedex.FindByName("Croagunk").ID, choices.ToArray());
                       }
                     if (ItemFound > 1) {
                      Messenger.AskQuestion(client, "SwapShopReq", "Here are the rare exclusive items that " + answer + " can use...", Pokedex.FindByName("Croagunk").ID, choices.ToArray());
                      }
                      }
                        break;
                      case "SwapShopItemSummary": {
                      string ItemReq1;
                      ItemReq1 = "";
                      string ItemReq2;
                      ItemReq2 = "";
                      string ItemReq3 = "";
                      ItemReq3 = "";
                      string ItemReqAny;
                      ItemReqAny = "";
                      string ItemYour;
                      ItemYour = "";
                      int ReqFound = 0;
                      int Item1 = 0;
                      int Item2 = 0;
                      int Item3 = 0;
                      int SwapItemNum = 0;
                      string SwapItem;
                      SwapItem = answer;
                      for (int c = 998; c < 1838; c++) {
                            if (ItemManager.Items[c].Name.Contains(answer)) {
                            int PokemonID = ItemManager.Items[c].ReqData1;
                            SwapItemNum = c;
                        for (int i = 998; i < 1838; i++) {
                         if (PokemonID == ItemManager.Items[i].ReqData1) {
                           if (ItemManager.Items[i].Rarity == 1 || ItemManager.Items[i].Rarity == 2) {
                            ReqFound = ReqFound + 1;
                              if (ReqFound == 1) {
                              ItemReq1 = ItemManager.Items[i].Name;
                              ItemYour = "your ";
                              Item1 = i;
                              }
                              if (ReqFound == 2) {
                              ItemReq2 = ", " + ItemManager.Items[i].Name;
                              Item2 = i;
                              }
                              if (ReqFound == 3) {
                              ItemReq3 = " and " + ItemManager.Items[i].Name;
                              Item3 = i;
                              }
                          } else if (ReqFound == 0) {
                          ItemReqAny = "five different exclusive items";
                          ItemYour = "any ";
                          }
                          }
                          }
                          }
                          }
                          if (answer != "Cancel") {
                          Story summary = new Story();
                          StoryBuilderSegment segment = StoryBuilder.BuildStory();
                          StoryBuilder.AppendSaySegment(segment, "" + answer + "? " + ItemManager.Items[SwapItemNum].Desc, Pokedex.FindByName("Croagunk").ID, 0, 0);
                          StoryBuilder.AppendSaySegment(segment, "In order to obtain " + answer + ", one must swap " + ItemReq1 + ItemReq2 + ItemReq3 + ItemReqAny + " for it.", Pokedex.FindByName("Croagunk").ID, 0, 0);
                          StoryBuilder.AppendRunScriptAction(segment, 90, "", "", "", true);

                          segment.AppendToStory(summary);
                          StoryManager.PlayStory(client, summary);
                         }
                          if (answer == "Cancel") {
                          Story cancel = new Story();
                          StoryBuilderSegment segment = StoryBuilder.BuildStory();
                          StoryBuilder.AppendRunScriptAction(segment, 90, "", "", "", true);
                          segment.AppendToStory(cancel);
                          StoryManager.PlayStory(client, cancel);
                          }

                  }
                        break;
                      case "SwapShopReq": {
                      string ItemReq1;
                      ItemReq1 = "";
                      string ItemReq2;
                      ItemReq2 = "";
                      string ItemReq3 = "";
                      ItemReq3 = "";
                      string ItemReqAny;
                      ItemReqAny = "";
                      string ItemYour;
                      ItemYour = "";
                      int ReqFound = 0;
                      int Item1 = 0;
                      int Item2 = 0;
                      int Item3 = 0;
                      int SwapItemNum = 0;
                      string SwapItem;
                      if (answer != "Cancel") {
                      SwapItem = answer;
                      List<string> choices = new List<string>();
                      choices.Add("Yes, I want to Swap for " + answer);
                      choices.Add("Cancel");
                      for (int c = 998; c < 1838; c++) {
                            if (ItemManager.Items[c].Name.Contains(answer)) {
                            int PokemonID = ItemManager.Items[c].ReqData1;
                            SwapItemNum = c;
                        for (int i = 998; i < 1838; i++) {
                         if (PokemonID == ItemManager.Items[i].ReqData1) {
                           if (ItemManager.Items[i].Rarity == 1 || ItemManager.Items[i].Rarity == 2) {
                            ReqFound = ReqFound + 1;
                              if (ReqFound == 1) {
                              ItemReq1 = ItemManager.Items[i].Name;
                              ItemYour = "your ";
                              Item1 = i;
                              }
                              if (ReqFound == 2) {
                              ItemReq2 = ", " + ItemManager.Items[i].Name;
                              Item2 = i;
                              }
                              if (ReqFound == 3) {
                              ItemReq3 = " and " + ItemManager.Items[i].Name;
                              Item3 = i;
                              }
                          } else if (ReqFound == 0) {
                          ItemReqAny = "five different exclusive items";
                          ItemYour = "any ";
                          }
                          }
                          }
                          }
                          }

                             Messenger.AskQuestion(client, "SwapShopActive", "So you want " + answer + " and wanna swap " + ItemYour + ItemReq1 + ItemReq2 + ItemReq3 + ItemReqAny + " for that? It'll cost ya 5000 Poké, too. Is that okay?", Pokedex.FindByName("Croagunk").ID, choices.ToArray());
                             }
                          else {
                          Story cancel = new Story();
                          StoryBuilderSegment segment = StoryBuilder.BuildStory();
                          StoryBuilder.AppendSaySegment(segment, "You don't wanna swap? Meh-heh-heh... I get it!", Pokedex.FindByName("Croagunk").ID, 0, 0);
                          segment.AppendToStory(cancel);
                          StoryManager.PlayStory(client, cancel);
                          }

                  }
                        break;
                      case "SwapShopActive" : {
                             string ItemName;
                             ItemName = answer.Replace("Yes, I want to Swap for ", "");
                             int ReqFound = 0;
                             int SwapItemNum = 0;
                             int Item1 = 0;
                             int Item2 = 0;
                             int Item3 = 0;
                             int PokemonID = 0;
                      for (int c = 998; c < 1838; c++) {
                            if (ItemManager.Items[c].Name.Contains(ItemName)) {
                             PokemonID = ItemManager.Items[c].ReqData1;
                            SwapItemNum = c;
                        for (int i = 998; i < 1838; i++) {
                         if (PokemonID == ItemManager.Items[i].ReqData1) {
                           if (ItemManager.Items[i].Rarity == 1 || ItemManager.Items[i].Rarity == 2) {
                            ReqFound = ReqFound + 1;
                              if (ReqFound == 1) {
                              Item1 = i;
                              }
                              if (ReqFound == 2) {
                              Item2 = i;
                              }
                              if (ReqFound == 3) {
                              Item3 = i;
                              }
                          }
                          }
                          }
                          }
                          }
                          if (answer != "Cancel") {
                              if (ReqFound > 0) {
                                      if (client.Player.HasItem(Item1) > 0 && client.Player.HasItem(Item2) > 0 && client.Player.HasItem(Item3) > 0 && client.Player.HasItem(1) >= 5000) {
                              		  Messenger.SpellAnim(491, client.Player.MapID, client.Player.X, client.Player.Y);
                                      Story story = new Story();
                                      StoryBuilderSegment segment = StoryBuilder.BuildStory();
                                      StoryBuilder.AppendRunScriptAction(segment, 5, "magic162.ogg", "", "", true);
                                      StoryBuilder.AppendPauseAction(segment, 500);
                                      StoryBuilder.AppendSaySegment(segment, "Meh-heh-heh! Seems that we brewed up a successful swap there! Here... Take your unbelievably valuable " + ItemName + "! Treat it with respect! Meh-heh-heh!", Pokedex.FindByName("Croagunk").ID, 0, 0);
                                      StoryBuilder.AppendPauseAction(segment, 500);
                                      StoryBuilder.AppendRunScriptAction(segment, 90, "", "", "", true);
                                      segment.AppendToStory(story);
                                      StoryManager.PlayStory(client, story);
                                      client.Player.TakeItem(Item1, 1);
                                      client.Player.TakeItem(Item2, 1);
                                      client.Player.TakeItem(Item3, 1);
                                      client.Player.TakeItem(1, 5000);
                                      client.Player.GiveItem(SwapItemNum, 1, "", false);
                                    }
                                    else {
                                      Story no = new Story();
                                      StoryBuilderSegment segment = StoryBuilder.BuildStory();
                                      StoryBuilder.AppendSaySegment(segment, "Meh-heh-heh? I'm sorry... You don't seem to have the required items for the Swap process...", Pokedex.FindByName("Croagunk").ID, 0, 0);
                                      StoryBuilder.AppendRunScriptAction(segment, 90, "", "", "", true);
                                      segment.AppendToStory(no);
                                      StoryManager.PlayStory(client, no);
                                      }
                                      }
                               else {
                               int ItemCount = 0;
                               int Take1 = 0;
                               int Take2 = 0;
                               int Take3 = 0;
                               int Take4 = 0;
                               int Take5 = 0;
                                for (int b = 1; b <= client.Player.Inventory.Count; b++) {
                                int i = client.Player.Inventory[b].Num;
                                 if (i >= 998 && i < 1838) {
                                     if (client.Player.HasItem(i) > 0 && ItemCount == 0) {
                                      Take1 = i;
                                      ItemCount++;
                                      }
                                     if (client.Player.HasItem(i) > 0 && i != Take1 && ItemCount == 1) {
                                      Take2 = i;
                                      ItemCount++;
                                      }
                                     if (client.Player.HasItem(i) > 0 && i != Take1 && i != Take2 && ItemCount == 2) {
                                      Take3 = i;
                                      ItemCount++;
                                      }
                                     if (client.Player.HasItem(i) > 0 && i != Take1 && i != Take2 && client.Player.Inventory[b].Num != Take3 && ItemCount == 3) {
                                      Take4 = i;
                                      ItemCount++;
                                      }
                                     if (client.Player.HasItem(i) > 0 && i != Take1 && i != Take2 && client.Player.Inventory[b].Num != Take3 && client.Player.Inventory[b].Num != Take4 && ItemCount >= 4) {
                                      Take5 = i;
                                      ItemCount++;
                                      }
                                      }
                               }
                                  //  Messenger.PlayerMsg(client, Take1 + "|" + Take2 + "|" + Take3 + "|" + Take4 + "|" + Take5 + "|" +ItemCount, Text.Yellow); // Debug Message
                                   if (ItemCount >= 5 && client.Player.HasItem(1) >= 5000) {
                                        Messenger.SpellAnim(491, client.Player.MapID, client.Player.X, client.Player.Y);
                                        Story yes = new Story();
                                        StoryBuilderSegment segment = StoryBuilder.BuildStory();
                                        StoryBuilder.AppendRunScriptAction(segment, 5, "magic162.ogg", "", "", true);
                                        StoryBuilder.AppendPauseAction(segment, 500);
                                        StoryBuilder.AppendSaySegment(segment, "Meh-heh-heh! Seems that we brewed up a successful swap there! Here... Take your unbelievably valuable " + ItemName + "! Treat it with respect! Meh-heh-heh!", Pokedex.FindByName("Croagunk").ID, 0, 0);
                                        StoryBuilder.AppendPauseAction(segment, 500);
                                        StoryBuilder.AppendRunScriptAction(segment, 90, "", "", "", true);
                                        segment.AppendToStory(yes);
                                        StoryManager.PlayStory(client, yes);
                                        client.Player.TakeItem(Take1, 1, true);
                                        client.Player.TakeItem(Take2, 1, true);
                                        client.Player.TakeItem(Take3, 1, true);
                                        client.Player.TakeItem(Take4, 1, true);
                                        client.Player.TakeItem(Take5, 1, true);
                                        client.Player.TakeItem(1, 5000, true);
                                        client.Player.GiveItem(SwapItemNum, 1, "", false);
                                        } else if (ItemCount < 5 || client.Player.HasItem(1) < 5000) {
                                          Story no = new Story();
                                          StoryBuilderSegment segment = StoryBuilder.BuildStory();
                                          StoryBuilder.AppendSaySegment(segment, "Meh-heh-heh? I'm sorry... You don't seem to have the required items for the Swap process...", Pokedex.FindByName("Croagunk").ID, 0, 0);
                                          StoryBuilder.AppendRunScriptAction(segment, 90, "", "", "", true);
                                     	  segment.AppendToStory(no);
                                     	  StoryManager.PlayStory(client, no);
                                    }
                                    }
                                    }
                          else {
                          Story cancel = new Story();
                          StoryBuilderSegment segment = StoryBuilder.BuildStory();
                          StoryBuilder.AppendSaySegment(segment, "You don't wanna swap? Meh-heh-heh... I get it!", Pokedex.FindByName("Croagunk").ID, 0, 0);
                          segment.AppendToStory(cancel);
                          StoryManager.PlayStory(client, cancel);
                          }
                        }
                        break;
                      case "Spiritomb": {
                      		if (answer == "Yes") {
                      			Messenger.SpellAnim(61, client.Player.MapID, client.Player.X, client.Player.Y);
                                MapNpcPreset npc = new MapNpcPreset();
                                npc.SpawnX = 10;
                                npc.SpawnY = 5;
                                npc.NpcNum = 1748;
                                npc.MinLevel = 30;
                                npc.MaxLevel = 30;
                                client.Player.Map.SpawnNpc(npc);
                                client.Player.TakeItem(251, 1);
                            }
                        }
                        break;
                    case "Candycane": {
                        if (answer == "Yes") {

                        } else if (answer == "Maybe later.") {
              						Story story = new Story();
                          		StoryBuilderSegment segment = StoryBuilder.BuildStory();
                          		StoryBuilder.AppendSaySegment(segment, "Ah, okay! See you next time!", Pokedex.FindByName("Delibird").ID, 0, 0);
                          		segment.AppendToStory(story);
                          		StoryManager.PlayStory(client, story);

                        } else if (answer == "Ah, get lost.") {
                                Story story = new Story();
                          		StoryBuilderSegment segment = StoryBuilder.BuildStory();
                          		StoryBuilder.AppendSaySegment(segment, "...", Pokedex.FindByName("Delibird").ID, 0, 0);
                          		StoryBuilder.AppendSaySegment(segment, "Delibird will remember this.", -1, 0, 0);
                          		segment.AppendToStory(story);
                          		StoryManager.PlayStory(client, story);
                        }
                    }
                    break;

                    }
            } catch (Exception ex) {
                Messenger.AdminMsg("Error: QuestionResult" + ex.ToString(), Text.Black);
            }
        }
コード例 #32
0
ファイル: MessageProcessor.cs プロジェクト: MandL27/Server
        internal static void ProcessData(Client client, string[] parse)
        {
            //string[] parse = data.Split(TcpPacket.SEP_CHAR);
            if (client.Player == null)
            {
                if (parse[0].ToLower() == "requestnews")
                {
                    Messenger.SendNews(client);
                    client.InitializeClientSystem();
                    return;
                }
            }
            if (client.Player == null)
            {
                Messenger.PlainMsg(client, "Unable to initialize connection. Please retry.", Enums.PlainMsgType.MainMenu);
                return;
            }
            if (!client.Player.LoggedIn)
            {
                #region Not Logged In
                switch (parse[0].ToLower())
                {
                    case "clienterror":
                        {
                            string error = parse[1];
                            error += "\r\n\r\n------- ERROR REPORT END -------\r\n\r\n";
                            Logging.Logger.AppendToLog("/Client Error Logs/" + DateTime.Now.ToShortDateString().Replace("/", "-") + "/log.txt", error);
                        }
                        break;
                    case "requestnews":
                        Messenger.SendNews(client);
                        client.InitializeClientSystem();
                        break;
                    #region Logging In
                    case "login":
                        {
                            if (Globals.ServerClosed)
                            {
                                Messenger.PlainMsg(client, "Server is closed at the moment!", Enums.PlainMsgType.MainMenu);
                                return;
                            }
                            if (ClientManager.CanLogin(parse[1]))
                            {
                                using (DatabaseConnection dbConnection = new DatabaseConnection(DatabaseID.Players))
                                {
                                    // Check if the account exists
                                    if (PlayerManager.AccountExists(dbConnection, parse[1]) == false)
                                    {
                                        Messenger.PlainMsg(client, "This account does not exist.", Enums.PlainMsgType.MainMenu);
                                        return;
                                    }
                                    // Check the client version
                                    if (parse[3].ToInt() < Constants.CLIENT_VERSION)
                                    {
                                        Messenger.PlainMsg(client, "Your client is outdated. Please update your client.", Enums.PlainMsgType.MainMenu);
                                        return;
                                    }
                                    // Verify that the client used is a valid one
                                    if (parse[10] != "PMDCPCore")
                                    {
                                        Messenger.PlainMsg(client, "Bad client version! Did you edit the source code?", Enums.PlainMsgType.MainMenu);
                                        return;
                                    }

            #if !DEBUG
                                    if (ClientManager.IsMacAddressConnected(parse[11])) {
                                        Messenger.PlainMsg(client, "You are already playing on this computer!", Enums.PlainMsgType.MainMenu);
                                        return;
                                    }

            #endif

                                    string password = Security.Hash.GenerateMD5Hash(parse[2]).Trim();
                                    if (PlayerManager.IsPasswordCorrect(dbConnection, parse[1], password))
                                    {

                                        client.SetMacAddress(parse[11]);
                                        client.SetBiosIdentification(parse[12]);
                                        // Check if they aren't banned
                                        if (Bans.IsIPBanned(dbConnection, client) == Enums.BanType.Ban || Bans.IsMacBanned(dbConnection, client) == Enums.BanType.Ban)
                                        {
                                            Logging.ChatLogger.AppendToChatLog("Staff", "IP: " + client.IP + " Mac: " + client.MacAddress + " attempted to log on, but was banned.");
                                            Messenger.PlainMsg(client, "You can't enter this world!", Enums.PlainMsgType.MainMenu);
                                            client.SetMacAddress("");
                                            client.SetBiosIdentification("");
                                            return;
                                        }

                                        client.Player.AccountName = parse[1];

                                        client.Player.SetSystemInfo(parse[8], parse[9], parse[10]);
                                        Messenger.SendChars(dbConnection, client);
                                    }
                                    else
                                    {
                                        Messenger.PlainMsg(client, "Invalid password.", Enums.PlainMsgType.MainMenu);
                                    }
                                }
                            }
                            else
                            {
                                Messenger.PlainMsg(client, "You are already in the Pokémon world!", Enums.PlainMsgType.MainMenu);
                            }
                        }
                        break;
                    case "charlistrequest":
                        {
                            using (DatabaseConnection dbConnection = new DatabaseConnection(DatabaseID.Players))
                            {
                                Messenger.SendChars(dbConnection, client);
                            }
                        }
                        break;
                    case "usechar":
                        {
                            int charNum = parse[1].ToInt();
                            if (charNum < 1 || charNum > 3)
                                return;
                            using (DatabaseConnection dbConnection = new DatabaseConnection(DatabaseID.Players))
                            {
                                if (client.Player.CharacterExists(dbConnection, charNum))
                                {
                                    client.Player.LoadCharacter(dbConnection, parse[1].ToInt(1));
                                    if (Globals.GMOnly)
                                    {
                                        if (client.Player.Access == Enums.Rank.Normal)
                                        {
                                            Messenger.PlainMsg(client, "The server is only open to GMs at the moment!", Enums.PlainMsgType.MainMenu);
                                            client.CloseConnection();
                                            //PlayerManager.Players.RemovePlayer(client);
                                            //PlayerManager.Players.AddPlayer(client);
                                            return;
                                        }
                                    }

                                    if (ClientManager.IsCharacterLoggedIn(client.Player.CharID))
                                    {
                                        Messenger.PlainMsg(client, "You are already playing on this computer!", Enums.PlainMsgType.MainMenu);
                                        return;
                                    }

                                    if (Bans.IsCharacterBanned(dbConnection, client.Player.CharID) == Enums.BanType.Ban)
                                    {
                                        Messenger.PlainMsg(client, "This character can't enter the Pokémon world!", Enums.PlainMsgType.MainMenu);
                                        client.Player = new Player(client);
                                        client.CloseConnection();
                                        return;
                                    }

                                    client.Player.Statistics.HandleLogin(client.Player.GetOSVersion(), client.Player.GetDotNetVersion(), client.MacAddress, client.IP);

                                    Messenger.SendJoinGame(client);

                                    //Globals.ServerUI.AddLog(PlayerManager.Players.GetPlayer(client).mLogin + "/" + PlayerManager.Players.GetPlayer(client).mName + " has started playing!");
                                }
                                else
                                {
                                    Messenger.PlainMsg(client, "This character hasn't been sent to the Pokémon world yet!", Enums.PlainMsgType.Chars);
                                    return;
                                }
                            }
                        }
                        break;
                    #endregion
                    #region Account Editing
                    case "gatglasses":
                        {//typo?  then again, we don't need classes...
                            Messenger.SendNewCharClasses(client);
                        }
                        break;
                    case "createaccount":
                        {
                            if (client.Player.LoggedIn == false)
                            {
                                string name = parse[1];
                                string password = parse[2];
                                string email = parse[3];

                                for (int i = 0; i < name.Length; i++)
                                {
                                    int n = (int)Convert.ToChar(name.Substring(i, 1));

                                    if (n == 32 && (i == 0 || i == name.Length - 1))
                                    {
                                        Messenger.PlainMsg(client, "Names cannot begin or end with spaces.", Enums.PlainMsgType.NewAccount);
                                        return;
                                    }

                                    if ((n >= 65 & n <= 90) | (n >= 97 & n <= 122) | (n == 95) | (n == 32) | (n >= 48 & n <= 57))
                                    {
                                    }
                                    else
                                    {
                                        Messenger.PlainMsg(client, "Invalid name, only letters, numbers, spaces, and _ allowed in names.", Enums.PlainMsgType.NewAccount);
                                        return;
                                    }
                                }

                                if (name.Length < 3 || name.Length > 24)
                                {
                                    Messenger.PlainMsg(client, "Name must be between 3 and 24 letters long.", Enums.PlainMsgType.NewAccount);
                                    return;
                                }

                                // TODO: Add email support to account creation [HIGH]
                                //if (Email.Email.IsValidEmail(email) == false) {
                                //    Messenger.PlainMsg(client, "Invalid email.", Enums.PlainMsgType.NewAccount);
                                //    return;
                                //}

                                using (DatabaseConnection dbConnection = new DatabaseConnection(DatabaseID.Players))
                                {
                                    int result = PlayerManager.CreateNewAccount(dbConnection, name, password, "");
                                    if (result == -1)
                                    {
                                        Messenger.PlainMsg(client, "An error occurred while creating your account.", Enums.PlainMsgType.MainMenu);
                                    }
                                    else if (result == 0)
                                    {
                                        Messenger.PlainMsg(client, "Your account has been created!", Enums.PlainMsgType.MainMenu);
                                    }
                                    else if (result == 1)
                                    {
                                        Messenger.PlainMsg(client, "That account already exists!", Enums.PlainMsgType.MainMenu);
                                    }
                                }
                            }
                        }
                        break;
                    case "addchar":
                        {
                            string name = parse[1].Trim();
                            int sex = parse[2].ToInt(-1);
                            //int CharClass = parse[3].ToInt(-1); ((This should be removed too))
                            //int CharNum = parse[4].ToInt(-1);
                            int charNum = parse[3].ToInt(-1);

                            for (int i = 0; i < name.Length; i++)
                            {
                                int n = (int)Convert.ToChar(name.Substring(i, 1));

                                if (n == 32 && (i == 0 || i == name.Length - 1))
                                {
                                    Messenger.PlainMsg(client, "Names cannot begin or end with spaces.", Enums.PlainMsgType.NewChar);
                                    return;
                                }

                                if ((n >= 65 && n <= 90) || (n >= 97 && n <= 122) || (n == 95) || (n == 32) || (n >= 48 && n <= 57))
                                {
                                }
                                else
                                {
                                    //Messenger.SendNewCharClasses(client); ((More classes?))
                                    Messenger.PlainMsg(client, "Invalid name, only letters, numbers, spaces, and _ allowed in names.", Enums.PlainMsgType.NewChar);
                                    return;
                                }
                            }

                            if (name.Length < 3 || name.Length > 24)
                            {
                                Messenger.PlainMsg(client, "Name must be between 3 and 24 letters long.", Enums.PlainMsgType.NewChar);
                                return;
                            }

                            if (charNum < 1 || charNum > 3)
                            {
                                Messenger.PlainMsg(client, "Invalid character number", Enums.PlainMsgType.Chars);
                                return;
                            }

                            if ((sex < (int)Enums.Sex.Genderless) || (sex > (int)Enums.Sex.Female))
                            {
                                Messenger.PlainMsg(client, "Invalid gender", Enums.PlainMsgType.Chars);
                                return;
                            }

                            //if (CharClass < 0 || CharClass > Settings.MaxClasses) {
                            //Messenger.PlainMsg(client, "Invalid class", Enums.PlainMsgType.Chars);
                            //return;
                            //} ((this should be removed. We no longer use classes in the Add Character Window))

                            using (DatabaseConnection dbConnection = new DatabaseConnection(DatabaseID.Players))
                            {
                                if (client.Player.CharacterExists(dbConnection, charNum))
                                {
                                    Messenger.PlainMsg(client, "That character is already in the Pokémon world!", Enums.PlainMsgType.NewChar);
                                    return;
                                }

                                if (PlayerManager.CharacterNameExists(dbConnection, name))
                                {
                                    Messenger.PlainMsg(client, "There's already a character with that name!", Enums.PlainMsgType.NewChar);
                                    return;
                                }

                                client.Player.CreateCharacter(dbConnection, name, (Enums.Sex)sex, charNum, false);
                            }
                        }
                        break;
                    case "delchar":
                        {
                            int charNum = parse[1].ToInt(-1);

                            if (charNum < 1 || charNum > 3)
                            {
                                Messenger.PlainMsg(client, "Invalid character number", Enums.PlainMsgType.Chars);
                                return;
                            }

                            using (DatabaseConnection dbConnection = new DatabaseConnection(DatabaseID.Players))
                            {
                                if (client.Player.CharacterExists(dbConnection, charNum))
                                {
                                    PlayerManager.DeleteCharacter(dbConnection, client.Player.AccountName, charNum);
                                    Messenger.SendChars(dbConnection, client);
                                    Messenger.PlainMsg(client, "The character has been sent back from the Pokémon world, never to return.", Enums.PlainMsgType.Chars);
                                }
                                else
                                {
                                    Messenger.PlainMsg(client, "That character doesn't exist!", Enums.PlainMsgType.Chars);
                                }
                            }
                        }
                        break;
                    case "deleteaccount":
                        {
                            string name = parse[1];
                            string password = parse[2];

                            using (DatabaseConnection dbConnection = new DatabaseConnection(DatabaseID.Players))
                            {
                                if (PlayerManager.AccountExists(dbConnection, name) == false)
                                {
                                    Messenger.PlainMsg(client, "That account does not exist", Enums.PlainMsgType.MainMenu);
                                    return;
                                }

                                if (PlayerManager.IsPasswordCorrect(dbConnection, name, password) == false)
                                {
                                    Messenger.PlainMsg(client, "Incorrect password", Enums.PlainMsgType.MainMenu);
                                    return;
                                }

                                PlayerManager.DeleteAccount(dbConnection, name);
                            }
                            Messenger.PlainMsg(client, "Your account has been deleted!", Enums.PlainMsgType.MainMenu);
                        }
                        break;
                    case "passchange":
                        {
                            string name = parse[1];
                            string oldPass = Security.Hash.GenerateMD5Hash(parse[2]);
                            string newPass = Security.Hash.GenerateMD5Hash(parse[3]);

                            using (DatabaseConnection dbConnection = new DatabaseConnection(DatabaseID.Players))
                            {
                                if (PlayerManager.IsPasswordCorrect(dbConnection, name, oldPass))
                                {
                                    PlayerManager.ChangeAccountPassword(dbConnection, name, oldPass, newPass);
                                    client.Player = new Player(client);
                                    Messenger.PlainMsg(client, "Your password has been changed!", Enums.PlainMsgType.AccountOptions);
                                }
                                else
                                {
                                    Messenger.PlainMsg(client, "Unable to change password.", Enums.PlainMsgType.AccountOptions);
                                }
                            }
                        }
                        break;
                    #endregion
                }
                #endregion
            }
            else
            {
                #region Logged In
                switch (parse[0].ToLower())
                {
                    #region Movement
                    case "playermove":
                        {
                            if (client.Player.GettingMap)
                            {
                                return;
                            }
                            int dir = parse[1].ToInt();
                            int speed = parse[2].ToInt();

                            if (dir < 0 || dir > 3)
                            {
                                return;
                            }
                            if (speed < 0 || speed > 7)
                            {
                                return;
                            }

                            MovementProcessor.ProcessMovement(client, (Enums.Direction)dir, (Enums.Speed)speed, false);
                        }
                        break;
                    case "critmove":
                        {
                            if (client.Player.GettingMap)
                            {
                                return;
                            }
                            int dir = parse[1].ToInt();
                            int speed = parse[2].ToInt();

                            if (dir < 0 || dir > 3)
                            {
                                return;
                            }
                            if (speed < 0 || speed > 7)
                            {
                                return;
                            }

                            MovementProcessor.ProcessMovement(client, (Enums.Direction)dir, (Enums.Speed)speed, true);
                        }
                        break;
                    case "playerdir":
                        {
                            if (client.Player.GettingMap)
                            {
                                return;
                            }
                            int dir = parse[1].ToInt();
                            if (dir < 0 || dir > 3)
                            {
                                return;
                            }

                            client.Player.Direction = (Enums.Direction)dir;
                            PacketHitList hitlist = null;
                            PacketHitList.MethodStart(ref hitlist);
                            PacketBuilder.AppendPlayerDirExcept(client, hitlist);
                            PacketHitList.MethodEnded(ref hitlist);
                        }
                        break;
                    case "requestnewmap":
                        {
                            //if (client.Player.Map.MapType != Enums.MapType.Instanced) {
                            int dir = parse[1].ToInt();

                            if (dir < 0 || dir > 3)
                            {
                                return;
                            }

                            if (MovementProcessor.WillWalkOnWarp(client, (Enums.Direction)dir))
                            {
                                MovementProcessor.ProcessMovement(client, (Enums.Direction)dir, (Enums.Speed)1, true);
                            }
                            else
                            {
                                PacketHitList hitlist = null;
                                PacketHitList.MethodStart(ref hitlist);
                                PacketBuilder.AppendOwnXY(client, hitlist);
                                PacketBuilder.AppendPlayerLock(client, hitlist, false);
                                PacketHitList.MethodEnded(ref hitlist);
                            }
                        }
                        break;
                    case "needmap":
                        {
                            Messenger.NeedMapCheck(client, parse[1].ToBool());
                        }
                        break;
                    case "needmapseamless":
                        {
                            bool[] results = new bool[parse[1].ToInt()];
                            int n = 2;
                            for (int i = 0; i < results.Length; i++)
                            {
                                results[i] = parse[n].ToBool();
                                n += 1;
                            }
                            Messenger.NeedMapCheck(client, results);
                        }
                        break;
                    case "refresh":
                        {
                            Messenger.RefreshMap(client);
                        }
                        break;
                    case "maploaded":
                        {
                            client.Player.Map.ProcessingPaused = true;
                        }
                        break;
                    #endregion
                    #region Attacking
                    case "attack":
                        {
                            if (client.Player.GettingMap) return;
                            client.Player.GetActiveRecruit().UseMove(-1);

                        }
                        break;
                    #endregion
                    #region Attacking - Moves
                    case "forgetspell":
                        {
                            // Spell slot
                            int n = parse[1].ToInt(-1);
                            // Prevent subscript out of range
                            if (n < 0 | n > Constants.MAX_PLAYER_MOVES)
                            {
                                Messenger.HackingAttempt(client, "Invalid Move Slot");
                                return;
                            }

                            if (client.Player.GetActiveRecruit().Moves[n].MoveNum == 0)
                            {
                                Messenger.PlayerMsg(client, "No move here.", Text.Red);
                            }
                            else
                            {
                                Messenger.PlayerMsg(client, "You have forgotten the move \"" + MoveManager.Moves[client.Player.GetActiveRecruit().Moves[n].MoveNum].Name.Trim() + "\"", Text.Green);
                                client.Player.GetActiveRecruit().Moves[n].MoveNum = 0;
                                client.Player.GetActiveRecruit().Moves[n].CurrentPP = -1;
                                client.Player.GetActiveRecruit().Moves[n].MaxPP = -1;
                                Messenger.SendPlayerMoves(client);
                            }

                        }
                        break;
                    case "swapmoves":
                        {
                            int oldMoveSlot = parse[1].ToInt(-1);
                            int newMoveSlot = parse[2].ToInt(-1);
                            if (oldMoveSlot > -1 && oldMoveSlot < 4 && newMoveSlot > -1 && newMoveSlot < 4)
                            {
                                RecruitMove oldMove = client.Player.GetActiveRecruit().Moves[oldMoveSlot];
                                RecruitMove newMove = client.Player.GetActiveRecruit().Moves[newMoveSlot];
                                client.Player.GetActiveRecruit().Moves[oldMoveSlot] = newMove;
                                client.Player.GetActiveRecruit().Moves[newMoveSlot] = oldMove;

                                Messenger.SendPlayerMoves(client);
                            }
                        }
                        break;
                    case "shiftspell":
                        {
                            // Spell slot
                            int n = parse[1].ToInt(-1);

                            // Prevent subscript out of range
                            if (n < 0 | n > Constants.MAX_PLAYER_MOVES)
                            {
                                Messenger.HackingAttempt(client, "Invalid Move Slot");
                                return;
                            }

                            //if (client.Player.GetActiveRecruit().Moves[n].MoveNum == 0) //~no need to check for blank space; you can move blank spaces
                            //{
                            //Messenger.PlayerMsg(client, "No move here.", Text.Red);
                            //}
                            //else
                            //{
                            int movingSpell = client.Player.GetActiveRecruit().Moves[n].MoveNum;
                            int movingSpellCurrentPP = client.Player.GetActiveRecruit().Moves[n].CurrentPP;
                            int movingSpellMaxPP = client.Player.GetActiveRecruit().Moves[n].MaxPP;

                            if (parse[2].ToBool() && n > 0)//shifting up
                            {
                                client.Player.GetActiveRecruit().Moves[n].MoveNum = client.Player.GetActiveRecruit().Moves[n - 1].MoveNum;
                                client.Player.GetActiveRecruit().Moves[n - 1].MoveNum = movingSpell;

                                client.Player.GetActiveRecruit().Moves[n].CurrentPP = client.Player.GetActiveRecruit().Moves[n - 1].CurrentPP;
                                client.Player.GetActiveRecruit().Moves[n - 1].CurrentPP = movingSpellCurrentPP;

                                client.Player.GetActiveRecruit().Moves[n].MaxPP = client.Player.GetActiveRecruit().Moves[n - 1].MaxPP;
                                client.Player.GetActiveRecruit().Moves[n - 1].MaxPP = movingSpellMaxPP;

                                Scripting.ScriptManager.InvokeSub("OnMoveSwapped", client, n, n - 1);
                            }
                            else if (n < 3)//shifting down
                            {
                                client.Player.GetActiveRecruit().Moves[n].MoveNum = client.Player.GetActiveRecruit().Moves[n + 1].MoveNum;
                                client.Player.GetActiveRecruit().Moves[n + 1].MoveNum = movingSpell;

                                client.Player.GetActiveRecruit().Moves[n].CurrentPP = client.Player.GetActiveRecruit().Moves[n + 1].CurrentPP;
                                client.Player.GetActiveRecruit().Moves[n + 1].CurrentPP = movingSpellCurrentPP;

                                client.Player.GetActiveRecruit().Moves[n].MaxPP = client.Player.GetActiveRecruit().Moves[n + 1].MaxPP;
                                client.Player.GetActiveRecruit().Moves[n + 1].MaxPP = movingSpellMaxPP;

                                Scripting.ScriptManager.InvokeSub("OnMoveSwapped", client, n, n + 1);
                            }

                            Messenger.SendPlayerMoves(client);
                            //}
                        }
                        break;
                    case "cast":
                        {
                            if (client.Player.GettingMap) return;
                            client.Player.GetActiveRecruit().UseMove(parse[1].ToInt(-1));
                        }
                        break;
                    #endregion
                    #region Messages
                    case "broadcastmsg":
                        if (CanSayMsg(client, parse[1]))
                        {
                            Scripting.ScriptManager.InvokeSub("OnChatMessageRecieved", client, parse[1], Enums.ChatMessageType.Global);

                            Logging.ChatLogger.AppendToChatLog("Global", client.Player.Name + ": " + parse[1]);

                            string playerName = client.Player.Name;
                            if (client.Player.Access != Enums.Rank.Normal)
                            {
                                playerName = "[c][" + Ranks.GetRankColor(client.Player.Access).ToArgb() + "]" + client.Player.Name + "[/c]";
                            }

                            Messenger.GlobalMsg("[Global] " + playerName + ": " + parse[1], Text.DarkGrey);
                        }
                        break;
                    case "saymsg":
                        if (CanSayMsg(client, parse[1]))
                        {
                            Scripting.ScriptManager.InvokeSub("OnChatMessageRecieved", client, parse[1], Enums.ChatMessageType.Map);

                            Logging.ChatLogger.AppendToChatLog("Maps/Map " + client.Player.MapID, client.Player.Name + ": " + parse[1]);

                            string playerName = client.Player.Name;
                            if (client.Player.Access != Enums.Rank.Normal)
                            {
                                playerName = "[c][" + Ranks.GetRankColor(client.Player.Access).ToArgb() + "]" + client.Player.Name + "[/c]";
                            }

                            PacketHitList hitList = null;
                            PacketHitList.MethodStart(ref hitList);
                            IMap playerMap = client.Player.GetCurrentMap();
                            hitList.AddPacketToMap(playerMap, PacketBuilder.CreateChatMsg(playerName + ": " + parse[1], Text.White));
                            hitList.AddPacketToMap(playerMap, PacketBuilder.CreateSpeechBubble(parse[1], client));
                            PacketHitList.MethodEnded(ref hitList);
                        }
                        break;
                    case "emotemsg":
                        if (CanSayMsg(client, parse[1]))
                        {
                            Scripting.ScriptManager.InvokeSub("OnChatMessageRecieved", client, parse[1], Enums.ChatMessageType.MeMsg);

                            Logging.ChatLogger.AppendToChatLog("Maps/Map " + client.Player.MapID, "(MeMsg) " + client.Player.Name + " " + parse[1]);

                            string playerName = client.Player.Name;
                            if (client.Player.Access != Enums.Rank.Normal)
                            {
                                playerName = "[c][" + Ranks.GetRankColor(client.Player.Access).ToArgb() + "]" + client.Player.Name + "[/c]";
                            }

                            Messenger.MapMsg(client.Player.MapID, playerName + " " + parse[1], Text.Blue);
                        }
                        break;
                    case "globalmsg":
                        if (CanSayMsg(client, parse[1]))
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Moniter))
                            {
                                Scripting.ScriptManager.InvokeSub("OnChatMessageRecieved", client, parse[1], Enums.ChatMessageType.Announcement);

                                Logging.ChatLogger.AppendToChatLog("Global", "(Announcement) " + client.Player.Name + ": " + parse[1]);

                                string playerName = client.Player.Name;
                                if (client.Player.Access != Enums.Rank.Normal)
                                {
                                    playerName = "[c][" + Ranks.GetRankColor(client.Player.Access).ToArgb() + "]" + client.Player.Name + "[/c]";
                                }

                                Messenger.GlobalMsg("(Announcement) " + playerName + ": " + parse[1], Text.Green);
                            }
                        }
                        break;
                    case "adminmsg":
                        if (CanSayMsg(client, parse[1]))
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Moniter))
                            {

                                Scripting.ScriptManager.InvokeSub("OnChatMessageRecieved", client, parse[1], Enums.ChatMessageType.Staff);

                                Logging.ChatLogger.AppendToChatLog("Staff", client.Player.Name + ": " + parse[1]);

                                string playerName = client.Player.Name;
                                if (client.Player.Access != Enums.Rank.Normal)
                                {
                                    playerName = "[c][" + Ranks.GetRankColor(client.Player.Access).ToArgb() + "]" + client.Player.Name + "[/c]";
                                }

                                Messenger.AdminMsg("[Staff] " + playerName + ": " + parse[1], Text.Cyan);
                            }
                        }
                        break;
                    case "guildmsg":
                        if (CanSayMsg(client, parse[1]) && !string.IsNullOrEmpty(client.Player.GuildName))
                        {
                            Scripting.ScriptManager.InvokeSub("OnChatMessageRecieved", client, parse[1], Enums.ChatMessageType.Guild);

                            //Messenger.PlayerMsg(client, client.Player[client].mName + " (" + client.Player[client].mGuildName + ") " + parse[1], Text.Green);
                            Logging.ChatLogger.AppendToChatLog("Guild Chat/" + client.Player.GuildName, "(" + client.Player.GuildName + ") " + client.Player.Name + parse[1]);

                            string playerName = client.Player.Name;
                            if (client.Player.Access != Enums.Rank.Normal)
                            {
                                playerName = "[c][" + Ranks.GetRankColor(client.Player.Access).ToArgb() + "]" + client.Player.Name + "[/c]";
                            }

                            foreach (Client i in ClientManager.GetClients())
                            {
                                if (i.Player.GuildName == client.Player.GuildName)
                                {
                                    Messenger.PlayerMsg(i, "(" + client.Player.GuildName + ") " + playerName + parse[1], Text.Green);
                                }
                            }
                        }
                        break;
                    case "playermsg":
                        {
                            if (CanSayMsg(client, parse[2]))
                            {
                                Client msgto = ClientManager.FindClient(parse[1]);
                                if (msgto == null)
                                {
                                    Messenger.PlayerMsg(client, "Player is offline.", Text.Grey);
                                }
                                else if (msgto == client)
                                {
                                    string sexString = "";
                                    if (client.Player.GetActiveRecruit().Sex == Enums.Sex.Genderless)
                                    {
                                        sexString = "it";
                                    }
                                    else if (client.Player.GetActiveRecruit().Sex == Enums.Sex.Male)
                                    {
                                        sexString = "him";
                                    }
                                    else if (client.Player.GetActiveRecruit().Sex == Enums.Sex.Female)
                                    {
                                        sexString = "her";
                                    }
                                    Messenger.MapMsg(client.Player.MapID, client.Player.Name + " begins to mumble to " + sexString + "self, what a wierdo...", Text.White);
                                }
                                else
                                {
                                    Scripting.ScriptManager.InvokeSub("OnChatMessageRecieved", client, parse[2], Enums.ChatMessageType.PM);

                                    Logging.ChatLogger.AppendToChatLog("PM/" + client.Player.Name, "(" + client.Player.Name + " tells " + msgto.Player.Name + ") " + parse[2]);

                                    string playerName = client.Player.Name;
                                    if (client.Player.Access != Enums.Rank.Normal)
                                    {
                                        playerName = "[c][" + Ranks.GetRankColor(client.Player.Access).ToArgb() + "]" + client.Player.Name + "[/c]";
                                    }

                                    string playerToName = msgto.Player.Name;
                                    if (msgto.Player.Access != Enums.Rank.Normal)
                                    {
                                        playerToName = "[c][" + Ranks.GetRankColor(msgto.Player.Access).ToArgb() + "]" + msgto.Player.Name + "[/c]";
                                    }

                                    Messenger.PlayerMsg(client, "You tell " + playerToName + ", '" + parse[2] + "'", Text.Pink);
                                    Messenger.PlayerMsg(msgto, playerName + " tells you, '" + parse[2] + "'", Text.Pink);
                                }

                            }
                        }
                        break;
                    #endregion
                    #region Recruits
                    case "requestactivecharswap":
                        {//perhaps put a time requirement for switching...
                            if (client.Player.GettingMap) return;
                            //if (client.Player.PK == false) {
                            client.Player.SwapActiveRecruit(parse[1].ToInt(1));
                            //} else {
                            //    Messenger.PlayerMsg(client, "An outlaw can't switch Pokémon!", Text.BrightRed);
                            //}
                        }
                        break;
                    case "switchleader":
                        {
                            if (client.Player.Map.Tile[client.Player.X, client.Player.Y].Type == Enums.TileType.Assembly)
                            {
                                //if (client.Player.PK == false) {
                                client.Player.SwapLeader(parse[1].ToInt(1));

                                //} else {
                                //    Messenger.PlayerMsg(client, "An outlaw can't switch leaders!", Text.BrightRed);
                                //}
                            }
                            else
                            {
                                Messenger.HackingAttempt(client, "Player not in Assembly");
                            }
                        }
                        break;
                    case "addtoteam":
                        if (client.Player.Map.Tile[client.Player.X, client.Player.Y].Type == Enums.TileType.Assembly)
                        {
                            int teamSlot = parse[1].ToInt(-1);
                            client.Player.AddToTeam(parse[2].ToInt(-1), teamSlot);
                            if (client.Player.Team[teamSlot] != null && client.Player.Team[teamSlot].Loaded)
                            {
                                client.Player.Team[teamSlot].HP = client.Player.Team[teamSlot].MaxHP;
                            }
                            Messenger.SendActiveTeam(client);
                            Messenger.SendStats(client);
                            Messenger.SendAllRecruits(client);
                        }
                        else
                        {
                            Messenger.SendPlayerData(client);
                            Messenger.HackingAttempt(client, "Player not in Assembly");
                        }
                        break;
                    case "removefromteam":
                        client.Player.RemoveFromTeam(parse[1].ToInt(-1));

                        break;
                    case "standby":
                        client.Player.RemoveFromTeam(parse[1].ToInt(-1));
                        Messenger.SendAllRecruits(client);
                        break;
                    case "releaserecruit":
                        client.Player.RequestedRecruit = new Recruit(client);
                        client.Player.RequestedRecruit.RecruitIndex = parse[1].ToInt(-1);
                        Messenger.AskQuestion(client, "ReleasePokemon", "Are you sure you want to release this recruit?", -1);
                        break;
                    case "changerecruitname":
                        if (client.Player.Map.Tile[client.Player.X, client.Player.Y].Type == Enums.TileType.Assembly)
                        {
                            if (client.Player.Muted == false)
                            {
                                if (parse[2].Length >= 3 && parse[2].Length <= 24)
                                {
                                    client.Player.ChangeRecruitName(parse[1].ToInt(-1), parse[2]);
                                }
                                else
                                {
                                    Messenger.PlayerMsg(client, "Name must be between 3 and 24 letters long.", Text.BrightRed);
                                }
                            }
                            else
                            {
                                Messenger.PlayerMsg(client, "You cannot change nicknames while muted!", Text.BrightRed);
                            }
                        }
                        else
                        {
                            Messenger.SendPlayerData(client);
                            Messenger.HackingAttempt(client, "Player not in Assembly");
                        }
                        break;
                    #endregion
                    #region Missions
                    case "acceptmission":
                        {
                            if (client.Player.Map.Moral == Enums.MapMoral.House || client.Player.Map.Moral == Enums.MapMoral.Safe)
                            {
                                int slot = parse[1].ToInt(-1);
                                if (slot > -1 && slot < client.Player.MissionBoard.BoardMissions.Count)
                                {
                                    bool taken = client.Player.JobList.AddJob(new WonderMails.WonderMailJob(client.Player.MissionBoard.BoardMissions[slot]));
                                    if (taken)
                                    {
                                        client.Player.MissionBoard.BoardMissions.RemoveAt(slot);
                                        Messenger.SendRemovedMission(client, slot);
                                        Messenger.SendNewJob(client);
                                    }
                                }
                            }
                            else
                            {
                                Messenger.PlayerMsg(client, "You can't accept a job here!", Text.BrightRed);
                            }
                        }
                        break;
                    case "startmission":
                        {
                            if (client.Player.Map.Moral == Enums.MapMoral.House || client.Player.Map.Moral == Enums.MapMoral.Safe)
                            {
                                int slot = parse[1].ToInt(-1);
                                if (slot > -1 && slot < client.Player.JobList.JobList.Count)
                                {
                                    client.Player.JobList.JobList[slot].Accepted = Enums.JobStatus.Taken;
                                    Messenger.SendJobAccept(client, slot);
                                }
                            }
                            else
                            {
                                Messenger.PlayerMsg(client, "You can't take a job here!", Text.BrightRed);
                            }
                        }
                        break;
                    case "deletejob":
                        {
                            if (client.Player.Map.Moral == Enums.MapMoral.House || client.Player.Map.Moral == Enums.MapMoral.Safe)
                            {
                                int slot = parse[1].ToInt(-1);
                                if (slot > -1 && slot < client.Player.JobList.JobList.Count)
                                {
                                    client.Player.JobList.RemoveJob(slot);
                                    Messenger.SendDeleteJob(client, slot);
                                }
                            }
                            else
                            {
                                Messenger.PlayerMsg(client, "You can't delete a job here!", Text.BrightRed);
                            }
                        }
                        break;
                    case "sendmission":
                        {
                            if (client.Player.Map.Moral == Enums.MapMoral.House || client.Player.Map.Moral == Enums.MapMoral.Safe)
                            {
                                Client target = ClientManager.FindClient(parse[2]);
                                if (target != null)
                                {
                                    if (target != client)
                                    {
                                        int slot = parse[1].ToInt(-1);
                                        if (target.Player.GetDungeonCompletionCount(client.Player.JobList.JobList[slot].Mission.DungeonIndex) > 0)
                                        {
                                            if (target.Player.JobList.JobList.Count < Constants.MAX_JOB_LIST)
                                            {
                                                if (Combat.MoveProcessor.IsInAreaRange(1, client.Player.X, client.Player.Y, target.Player.X, target.Player.Y))
                                                {

                                                    if (slot > -1 && slot < client.Player.JobList.JobList.Count)
                                                    {
                                                        client.Player.JobList.JobList[slot].SendsRemaining--;
                                                        if (client.Player.JobList.JobList[slot].SendsRemaining <= 0)
                                                        {
                                                            //send sends remaining
                                                            Messenger.SendRemainingJobSends(client, slot);
                                                        }
                                                        target.Player.JobList.AddJobSimple(new WonderMails.WonderMailJob(client.Player.JobList.JobList[slot]));
                                                        Messenger.PlayerMsg(client, "A Wonder Mail was sent to " + target.Player.Name + "!", Text.BrightGreen);
                                                        Messenger.PlayerMsg(target, client.Player.Name + " has sent you a Wonder Mail!", Text.BrightGreen);
                                                        Messenger.SendNewJob(target);
                                                    }

                                                }
                                                else
                                                {
                                                    Messenger.PlayerMsg(client, "You have to stand next to the player to send a Wonder Mail.", Text.BrightRed);
                                                }
                                            }
                                            else
                                            {
                                                Messenger.PlayerMsg(client, "That player's job list is full.", Text.BrightRed);
                                            }
                                        }
                                        else
                                        {
                                            Messenger.PlayerMsg(client, "That player has not yet completed the dungeon specified in the Wonder Mail.", Text.BrightRed);
                                        }
                                    }
                                    else
                                    {
                                        Messenger.PlayerMsg(client, "You can't send a Wonder Mail to yourself!", Text.BrightRed);
                                    }
                                }
                                else
                                {
                                    Messenger.PlayerMsg(client, "There's no one online with that name.", Text.BrightRed);
                                }
                            }
                            else
                            {
                                Messenger.PlayerMsg(client, "You can't send a Wonder Mail here!", Text.BrightRed);
                            }
                        }
                        break;
                    case "canceljob":
                        {
                            if (client.Player.Map.Moral == Enums.MapMoral.House || client.Player.Map.Moral == Enums.MapMoral.Safe)
                            {
                                int slot = parse[1].ToInt(-1);
                                if (slot > -1 && slot < client.Player.JobList.JobList.Count)
                                {
                                    client.Player.JobList.JobList[slot].Accepted = Enums.JobStatus.Suspended;
                                    Messenger.SendJobAccept(client, slot);
                                }
                            }
                            else
                            {
                                Messenger.PlayerMsg(client, "You can't cancel a job here!", Text.BrightRed);
                            }
                        }
                        break;
                    //case "requestmissioncode": {
                    //        int slot = parse[1].ToInt(-1);
                    //        if (slot > -1 && slot < client.Player.JobList.JobList.Count) {
                    //            if (client.Player.JobList.JobList[slot] != null) {
                    //                WonderMails.IssuedWonderMailEntry entry = WonderMails.WonderMailSystem.FindIssuedWonderMailByCode(client.Player.JobList.JobList[slot].Mission.EncryptedCode);
                    //                if (entry == null) {
                    //                    // This code has not yet been issued
                    //                } else {

                    //                }

                    //                Messenger.SendMissionCode(client, client.Player.JobList.JobList[slot].Mission);
                    //            }
                    //        }
                    //    }
                    //    break;
                    #endregion
                    #region Misc
                    case "ping":
                        //Messenger.SendDataTo(client, TcpPacket.CreatePacket("ping"));
                        break;
                    case "search":
                        {
                            int X = parse[1].ToInt(-1);
                            int Y = parse[2].ToInt(-1);

                            IMap map = client.Player.GetCurrentMap();

                            // Prevent subscript out of range
                            if (X < 0 || X > map.MaxX || Y < 0 || Y > map.MaxY)
                            {
                                return;
                            }

                            // Check for a player
                            foreach (Client i in map.GetClients())
                            {
                                if (i.IsPlaying() && map == i.Player.Map && i.Player.X == X && i.Player.Y == Y)
                                {
                                    // Consider the player
                                    if (MovementProcessor.CanCharacterSeeCharacter(map, client.Player.GetActiveRecruit(), i.Player.GetActiveRecruit()))
                                    {
                                        if (MovementProcessor.CanCharacterIdentifyCharacter(map, client.Player.GetActiveRecruit(), i.Player.GetActiveRecruit()))
                                        {
                                            if (i == client)
                                            {
                                                Messenger.PlayerMsg(client, "You look upon yourself.", Text.Yellow);
                                            }
                                            else
                                            {
                                                Messenger.PlayerMsg(client, "You see " + i.Player.Name + ".", Text.Yellow);
                                                if (i.Player.GetActiveRecruit().Level >= client.Player.GetActiveRecruit().Level + 5)
                                                {
                                                    Messenger.PlayerMsg(client, "This Pokémon appears to be much more experienced than you.", Text.BrightRed);
                                                }
                                                else if (i.Player.GetActiveRecruit().Level > client.Player.GetActiveRecruit().Level)
                                                {
                                                    Messenger.PlayerMsg(client, "This Pokémon appears to be slightly more experienced than you.", Text.Yellow);
                                                }
                                                else if (i.Player.GetActiveRecruit().Level == client.Player.GetActiveRecruit().Level)
                                                {
                                                    Messenger.PlayerMsg(client, "This Pokémon seems to be about as experienced as you.", Text.White);
                                                }
                                                else if (client.Player.GetActiveRecruit().Level >= i.Player.GetActiveRecruit().Level + 5)
                                                {
                                                    Messenger.PlayerMsg(client, "This Pokémon appears much less experienced than you.", Text.BrightBlue);
                                                }
                                                else if (client.Player.GetActiveRecruit().Level > i.Player.GetActiveRecruit().Level)
                                                {
                                                    Messenger.PlayerMsg(client, "This Pokémon appears slightly less experienced than you.", Text.Yellow);
                                                }
                                            }
                                            return;
                                        }
                                        else
                                        {
                                            Messenger.PlayerMsg(client, "You see a Pokémon.", Text.Yellow);
                                            return;
                                        }
                                    }
                                }
                            }

                            // Check for an npc
                            for (int i = 0; i < Constants.MAX_MAP_NPCS; i++)
                            {
                                if (map.ActiveNpc[i].Num > 0)
                                {
                                    if (map.ActiveNpc[i].X == X && map.ActiveNpc[i].Y == Y)
                                    {
                                        if (MovementProcessor.CanCharacterSeeCharacter(map, client.Player.GetActiveRecruit(), map.ActiveNpc[i]))
                                        {
                                            if (MovementProcessor.CanCharacterIdentifyCharacter(map, client.Player.GetActiveRecruit(), map.ActiveNpc[i]))
                                            {
                                                Messenger.PlayerMsg(client, "You see a " + NpcManager.Npcs[map.ActiveNpc[i].Num].Name.Trim() + ".", Text.Yellow);

                                                if (!map.RecruitEnabled)
                                                {
                                                    Messenger.PlayerMsg(client, NpcManager.Npcs[map.ActiveNpc[i].Num].Name.Trim() + " cannot be recruited in this area.", Text.Yellow);

                                                }
                                                else if (map.ActiveNpc[i].Level >= client.Player.GetActiveRecruit().Level)
                                                {
                                                    Messenger.PlayerMsg(client, NpcManager.Npcs[map.ActiveNpc[i].Num].Name.Trim() + "'s level is too high for you to recruit it.", Text.Yellow);

                                                }
                                                else if (NpcManager.Npcs[map.ActiveNpc[i].Num].RecruitRate != 0)
                                                {
                                                    int recruitRate = NpcManager.Npcs[map.ActiveNpc[i].Num].RecruitRate;
                                                    //Messenger.PlayerMsg(client, NpcManager.Npcs[map.ActiveNpc[i].Num].Name.Trim() + "'s recruit rate is " + NpcManager.Npcs[map.ActiveNpc[i].Num].RecruitRate + " (+" + client.Player.GetRecruitBonus() + ")", Text.Yellow);
                                                    Messenger.PlayerMsg(client, "You have a " + (recruitRate / 10f) + "% of recruiting " + NpcManager.Npcs[map.ActiveNpc[i].Num].Name.Trim() + "!", Text.Yellow);
                                                }
                                                else
                                                {
                                                    Messenger.PlayerMsg(client, NpcManager.Npcs[map.ActiveNpc[i].Num].Name.Trim() + " is not recruitable.", Text.Yellow);
                                                }
                                                return;
                                            }
                                            else
                                            {
                                                Messenger.PlayerMsg(client, "You see a Pokémon.", Text.Yellow);
                                                return;
                                            }
                                        }
                                    }
                                }
                            }

                            for (int i = 0; i < Constants.MAX_MAP_ITEMS; i++)
                            {
                                if (map.ActiveItem[i].Num > 0/* && !map.ActiveItem[i].Hidden*/)
                                {
                                    if (map.ActiveItem[i].X == X && map.ActiveItem[i].Y == Y)
                                    {
                                        if (MovementProcessor.CanCharacterSeeDestination(map, client.Player.GetActiveRecruit(), X, Y) && !map.ActiveItem[i].Hidden)
                                        {
                                            if (MovementProcessor.CanCharacterIdentifyDestination(map, client.Player.GetActiveRecruit(), X, Y) && !map.ActiveItem[i].Hidden)
                                            {
                                                if (map.ActiveItem[i].Sticky)
                                                {
                                                    Messenger.PlayerMsg(client, "You see a x" + ItemManager.Items[map.ActiveItem[i].Num].Name.Trim() + ".", Text.Yellow);
                                                    return;
                                                }
                                                else
                                                {
                                                    Messenger.PlayerMsg(client, "You see a " + ItemManager.Items[map.ActiveItem[i].Num].Name.Trim() + ".", Text.Yellow);
                                                    return;
                                                }
                                            }
                                            else
                                            {
                                                Messenger.PlayerMsg(client, "You notice an item.", Text.Yellow);
                                                return;
                                            }
                                        }
                                    }
                                }
                            }

                            Scripting.ScriptManager.InvokeSub("OnClick", client, map, X, Y);
                        }
                        break;
                    case "mapgetitem":
                        {
                            // Check for scripted signs
                            if (client.Player.GettingMap) return;
                            IMap map = client.Player.GetCurrentMap();
                            int newX = client.Player.X;
                            int newY = client.Player.Y;
                            Enums.Direction dir = client.Player.Direction;
                            switch (client.Player.Direction)
                            {
                                case Enums.Direction.Up:
                                    newY--;
                                    break;
                                case Enums.Direction.Down:
                                    newY++;
                                    break;
                                case Enums.Direction.Left:
                                    newX--;
                                    break;
                                case Enums.Direction.Right:
                                    newX++;
                                    break;
                            }
                            if (newX >= 0 && newX < map.MaxX && newY >= 0 && newY < map.MaxY)
                            {
                                if (map.Tile[newX, newY].Type == Enums.TileType.ScriptedSign)
                                {
                                    Scripting.ScriptManager.InvokeSub("ScriptedSign", client, map.Tile[newX, newY].Data1, map.Tile[newX, newY].String1, map.Tile[newX, newY].String2, map.Tile[newX, newY].String3, dir);
                                }
                                else if (map.Tile[newX, newY].Type == Enums.TileType.Key)
                                {
                                    bool moveUsed = false;
                                    for (int i = 0; i < client.Player.GetActiveRecruit().Moves.Length; i++)
                                    {
                                        if (client.Player.GetActiveRecruit().Moves[i].MoveNum > -1)
                                        {
                                            Move move = MoveManager.Moves[client.Player.GetActiveRecruit().Moves[i].MoveNum];
                                            if (move.KeyItem > 0)
                                            {
                                                if (move.KeyItem == map.Tile[newX, newY].Data1)
                                                {
                                                    Messenger.AskQuestion(client, "UseMoveKeyOnEnter", "Would you like to use " + move.Name + "?", -1, new string[] { "Yes", "No" });
                                                    moveUsed = true;
                                                    break;
                                                }
                                            }
                                        }
                                    }
                                    if (moveUsed == false)
                                    {
                                        for (int i = 1; i <= client.Player.MaxInv; i++)
                                        {
                                            if (client.Player.Inventory[i].Num == map.Tile[newX, newY].Data1)
                                            {
                                                if (ItemManager.Items[client.Player.Inventory[i].Num].Type == Enums.ItemType.Key)
                                                {
                                                    Messenger.AskQuestion(client, "UseKeyOnEnter", "Would you like to use your " + ItemManager.Items[client.Player.Inventory[i].Num].Name + " to unlock the door?", -1, new string[] { "Yes", "No" });
                                                    break;
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                            client.Player.PickupItem();
                        }
                        break;
                    case "mapdropitem":
                        {
                            if (client.Player.GettingMap) return;
                            int invNum = parse[1].ToInt();
                            int amount = parse[2].ToInt();

                            // Prevent hacking
                            if (invNum < 1 || invNum > client.Player.MaxInv || client.Player.Inventory[invNum].Num <= 0)
                            {
                                Messenger.HackingAttempt(client, "Invalid InvNum: " + invNum);
                                return;
                            }

                            // Prevent hacking
                            if (ItemManager.Items[client.Player.Inventory[invNum].Num].Type == Enums.ItemType.Currency || ItemManager.Items[client.Player.Inventory[invNum].Num].StackCap > 0)
                            {
                                // Check if money and if it is we want to make sure that they aren't trying to drop 0 value
                                if (amount <= 0)
                                {
                                    Messenger.PlayerMsg(client, "You must drop more than 0!", Text.BrightRed);
                                    return;
                                }

                                if (amount > client.Player.Inventory[invNum].Amount)
                                {
                                    Messenger.PlayerMsg(client, "You dont have that much to drop!", Text.BrightRed);
                                    return;
                                }
                            }

                            // Prevent hacking
                            if (ItemManager.Items[client.Player.Inventory[invNum].Num].Type != Enums.ItemType.Currency && ItemManager.Items[client.Player.Inventory[invNum].Num].StackCap > 0)
                            {
                                if (amount > client.Player.Inventory[invNum].Amount)
                                {
                                    Messenger.HackingAttempt(client, "Item amount modification");
                                    return;
                                }
                            }

                            client.Player.DropItem(invNum, amount);
                            //Messenger.SendStats(client);
                        }
                        break;
                    case "adventurelog":
                        {
                            Messenger.SendAdventureLog(client);
                        }
                        break;
                    case "checkarrows":
                        {
                            //int n = ArrowManagerBase.Arrows[parse[1].ToInt()].Pic;
                            //Messenger.SendDataToMap(client.Player.MapID, TcpPacket.CreatePacket("checkarrows", client.ToString(), n.ToString()));
                        }
                        break;
                    case "checkemoticons":
                        {
                            if (client.Player.Muted == false)
                            {
                                int n = EmoticonManagerBase.Emoticons[parse[1].ToInt()].Pic;
                                Messenger.SendDataToMap(client.Player.MapID, TcpPacket.CreatePacket("checkemoticons", client.ToString(), n.ToString()));
                            }
                        }
                        break;
                    case "clienterror":
                        {
                            string error = parse[1];
                            error += "\r\n\r\n------- ERROR REPORT END -------\r\n\r\n";
                            Logging.Logger.AppendToLog("/Client Error Logs/" + DateTime.Now.ToShortDateString().Replace("/", "-") + "/log.txt", error);
                        }
                        break;
                    #endregion
                    #region Scripts
                    case "hotscript1":
                        Scripting.ScriptManager.InvokeSub("HotScript1", client);
                        break;
                    case "hotscript2":
                        Scripting.ScriptManager.InvokeSub("HotScript2", client);
                        break;
                    case "hotscript3":
                        Scripting.ScriptManager.InvokeSub("HotScript3", client);
                        break;
                    case "hotscript4":
                        Scripting.ScriptManager.InvokeSub("HotScript4", client);
                        break;
                    case "questionresult":
                        if (!string.IsNullOrEmpty(client.Player.QuestionID))
                        {
                            string id = client.Player.QuestionID;
                            client.Player.QuestionID = "";

                            if (id.StartsWith("DropItem:"))
                            {
                                if (parse[1] == "Yes")
                                {
                                    string[] parseID = id.Split(':');
                                    int itemSlot = parseID[1].ToInt();
                                    int amount = parseID[2].ToInt();
                                    if (client.Player.Inventory[itemSlot].Num <= 0) return;
                                    if (client.Player.Inventory[itemSlot].Amount < amount) return;
                                    if (amount == 0) amount = 1;
                                    int payout = ItemManager.Items[client.Player.Inventory[itemSlot].Num].Price * amount;
                                    if (client.Player.FindInvSlot(1, payout) == -1)
                                    {
                                        Messenger.PlayerMsg(client, "You can't carry any more " + ItemManager.Items[1].Name + ".", Text.BrightRed);
                                        return;
                                    }
                                    client.Player.GiveItem(1, payout);
                                    Messenger.PlayerMsg(client, "Trade successful!", Text.Yellow);
                                    client.Player.TakeItemSlot(itemSlot, amount, true);
                                    //client.Player.DropItem(itemSlot, amount, null, true);
                                }
                            }

                            switch (id)
                            {
                                case "BuyItem":
                                    {
                                        if (parse[1] == "Yes")
                                        {
                                            if (client.Player.HasItem(1) < client.Player.Map.Tile[client.Player.X, client.Player.Y].Data1)
                                            {
                                                Messenger.PlayerMsg(client, "You don't have enough " + ItemManager.Items[1].Name + " to buy this item!", Text.BrightRed);
                                                return;
                                            }

                                            if (String.IsNullOrEmpty(client.Player.Map.Tile[client.Player.X, client.Player.Y].String1))
                                            {
                                                Messenger.PlayerMsg(client, "Trade successful!", Text.Yellow);
                                                client.Player.PickupItem(true);
                                                client.Player.TakeItem(1, client.Player.Map.Tile[client.Player.X, client.Player.Y].Data1, true);
                                            }
                                            else
                                            {
                                                int slot = client.Player.FindInvSlot(1);
                                                if (slot == -1 || client.Player.Inventory[slot].Num != 1) return;
                                                Messenger.PlayerMsg(client, "Trade successful!", Text.Yellow);
                                                client.Player.PickupItem(true);
                                                client.Player.DropItem(slot, client.Player.Map.Tile[client.Player.X, client.Player.Y].Data1, null, true);
                                            }
                                        }
                                    }
                                    break;
                                case "CreateGuild":
                                    {
                                        #region CreateGuild Result
                                        if (parse[1] == "Cancel")
                                        {
                                            client.Player.GuildName = "";
                                        }
                                        #endregion
                                    }
                                    break;
                                case "GuildStepDown":
                                    {
                                        #region GuildStepDown Result
                                        if (parse[1] == "Yes")
                                        {
                                            Guilds.GuildManager.GuildStepDown(client);
                                        }
                                        #endregion
                                    }
                                    break;
                                case "DisbandGuild":
                                    {
                                        #region DisbandGuild Result
                                        if (parse[1] == "Yes")
                                        {
                                            Guilds.GuildManager.DisbandGuild(client);
                                        }
                                        #endregion
                                    }
                                    break;
                                case "RecruitPokemon":
                                    {
                                        #region RecruitPokemon Result
                                        if (parse[1] == "Yes")
                                        {
                                            int openSlot = client.Player.FindOpenTeamSlot();
                                            int recruitIndex = 0;
                                            if (openSlot != -1)
                                            {
                                                if (client.Player.RequestedRecruit.Level > 0)
                                                {
                                                    using (DatabaseConnection dbConnection = new DatabaseConnection(DatabaseID.Players))
                                                    {
                                                        recruitIndex = client.Player.AddToRecruitmentBank(dbConnection, client.Player.RequestedRecruit);
                                                    }

                                                    if (recruitIndex != -1)
                                                    {
                                                        client.Player.AddToTeam(recruitIndex, openSlot);
                                                        client.Player.Team[openSlot].HP = client.Player.Team[openSlot].MaxHP;
                                                        Messenger.BattleMsg(client, "You have recruited a new team member!", Text.BrightGreen);

                                                        Messenger.SendActiveTeam(client);
                                                    }
                                                    else
                                                    {
                                                        Messenger.BattleMsg(client, "You cant recruit! You have too many team members in the assembly!", Text.BrightRed);
                                                    }
                                                }
                                                else
                                                {
                                                    Messenger.BattleMsg(client, "You cant recruit! Error 2", Text.BrightRed);
                                                }
                                            }
                                            else
                                            {
                                                Messenger.BattleMsg(client, "You cant recruit! Your team is full!", Text.BrightRed);
                                            }
                                        }
                                        else
                                        {
                                            client.Player.RequestedRecruit = null;
                                        }

                                        client.Player.RequestedRecruit = null;
                                        #endregion
                                    }
                                    break;
                                case "ReleasePokemon":
                                    {
                                        #region ReleasePokemon Result
                                        if (parse[1] == "Yes")
                                        {

                                            using (DatabaseConnection dbConnection = new DatabaseConnection(DatabaseID.Players))
                                            {
                                                client.Player.ReleaseRecruit(dbConnection, client.Player.RequestedRecruit.RecruitIndex);
                                            }

                                        }
                                        client.Player.RequestedRecruit = null;
                                        #endregion
                                    }
                                    break;
                                case "MovesFull":
                                    {
                                        #region MovesFull Result
                                        if (parse[1] == "Yes")
                                        {
                                            bool allowLearn = true;
                                            if (client.Player.GetActiveRecruit().MoveItem != -1)
                                            {
                                                if (client.Player.HasItem(client.Player.GetActiveRecruit().MoveItem, true) > 0)
                                                {
                                                    client.Player.TakeItem(client.Player.GetActiveRecruit().MoveItem, 0, true);
                                                }
                                                else
                                                {
                                                    allowLearn = false;
                                                }
                                            }
                                            if (allowLearn)
                                            {
                                                Messenger.OpenMoveForgetMenu(client);
                                            }
                                            client.Player.GetActiveRecruit().MoveItem = -1;
                                        }
                                        else
                                        {
                                            client.Player.GetActiveRecruit().MoveItem = -1;
                                            Messenger.PlayerMsg(client, "You chose to not learn this move.", Text.White);
                                        }
                                        #endregion
                                    }
                                    break;
                                case "PlayerTradeRequest":
                                    {
                                        #region PlayerTradeRequest Result
                                        if (parse[1] == "Yes")
                                        {
                                            Client tradePartner = ClientManager.FindClientFromCharID(client.Player.TradePartner);
                                            if (tradePartner != null)
                                            {
                                                tradePartner.Player.TradePartner = client.Player.CharID;
                                                Messenger.OpenTradeMenu(client);
                                            }
                                        }
                                        #endregion
                                    }
                                    break;
                                case "SingleEvolution":
                                    {
                                        #region SingleEvolution Result

                                        PacketHitList hitlist = null;
                                        PacketHitList.MethodStart(ref hitlist);

                                        if (parse[1] == "Yes")
                                        {
                                            int speciesNum = client.Player.GetActiveRecruit().Species;
                                            int evoIndex = -1;
                                            for (int z = 0; z < EvolutionManager.Evolutions.MaxEvos; z++)
                                            {
                                                if (EvolutionManager.Evolutions[z].Species == speciesNum)
                                                {
                                                    evoIndex = z;
                                                }
                                            }
                                            if (evoIndex == -1) return;

                                            List<int> viableEvos = EvolutionManager.FindViableEvolutions(client, evoIndex);
                                            if (viableEvos.Count == 1)
                                            {
                                                EvolutionBranch evo = Evolutions.EvolutionManager.Evolutions[evoIndex].Branches[viableEvos[0]];
                                                client.Player.GetActiveRecruit().SetSpecies(evo.NewSpecies);
                                                if (client.Player.GetActiveRecruit().RecruitIndex > -2)
                                                {
                                                    client.Player.PokemonCaught(client.Player.GetActiveRecruit().Species);
                                                }
                                                PacketBuilder.AppendPlayerData(client, hitlist);
                                                Messenger.SendActiveTeam(client);
                                                PacketBuilder.AppendStats(client, hitlist);
                                                hitlist.AddPacket(client, PacketBuilder.CreateChatMsg("You have evolved into " + Pokedex.Pokedex.GetPokemon(client.Player.GetActiveRecruit().Species).Name + "! Congratulations!", Text.Yellow));
                                                Scripting.ScriptManager.InvokeFunction("OnEvoDone", client, evo.ReqScript, evo.Data1, evo.Data2, evo.Data3);
                                            }

                                        }

                                        PacketHitList.MethodEnded(ref hitlist);

                                        #endregion
                                    }
                                    break;
                                case "BranchEvolution":
                                    {
                                        #region BranchEvolution Result
                                        PacketHitList hitlist = null;
                                        PacketHitList.MethodStart(ref hitlist);
                                        if (parse[1] == "Cancel") return;
                                        int speciesNum = client.Player.GetActiveRecruit().Species;
                                        int evoIndex = -1;
                                        for (int z = 0; z < EvolutionManager.Evolutions.MaxEvos; z++)
                                        {
                                            if (EvolutionManager.Evolutions[z].Species == speciesNum)
                                            {
                                                evoIndex = z;
                                            }
                                        }
                                        if (evoIndex == -1) return;

                                        for (int i = 0; i <= EvolutionManager.Evolutions[evoIndex].Branches.Count; i++)
                                        {
                                            bool canEvolve = Scripting.ScriptManager.InvokeFunction("ScriptedEvoReq", client, EvolutionManager.Evolutions[evoIndex].Branches[i].ReqScript, EvolutionManager.Evolutions[evoIndex].Branches[i].Data1, EvolutionManager.Evolutions[evoIndex].Branches[i].Data2, EvolutionManager.Evolutions[evoIndex].Branches[i].Data3).ToBool();
                                            if (canEvolve && EvolutionManager.Evolutions[evoIndex].Branches[i].Name == parse[1])
                                            {
                                                EvolutionBranch evo = Evolutions.EvolutionManager.Evolutions[evoIndex].Branches[i];
                                                client.Player.GetActiveRecruit().SetSpecies(evo.NewSpecies);
                                                if (client.Player.GetActiveRecruit().RecruitIndex > -2)
                                                {
                                                    client.Player.PokemonCaught(client.Player.GetActiveRecruit().Species);
                                                }
                                                PacketBuilder.AppendPlayerData(client, hitlist);
                                                Messenger.SendActiveTeam(client);
                                                PacketBuilder.AppendStats(client, hitlist);
                                                hitlist.AddPacket(client, PacketBuilder.CreateChatMsg("You have evolved into " + Pokedex.Pokedex.GetPokemon(client.Player.GetActiveRecruit().Species).Name + "! Congratulations!", Text.Yellow));
                                                Scripting.ScriptManager.InvokeFunction("OnEvoDone", client, evo.ReqScript, evo.Data1, evo.Data2, evo.Data3);
                                                break;
                                            }
                                        }

                                        PacketHitList.MethodEnded(ref hitlist);

                                        //Scripting.ScriptManager.InvokeFunction("EvoDone", player.Client, Evolutions[evoIndex].Branches[i].ReqScript, Evolutions[evoIndex].Branches[i].Data1, Evolutions[evoIndex].Branches[i].Data2, Evolutions[evoIndex].Branches[i].Data3)
                                        #endregion
                                    }
                                    break;
                                case "UseKeyOnEnter":
                                    {
                                        #region UseKeyOnEnter Result
                                        if (parse[1] == "Yes")
                                        {
                                            IMap map = client.Player.GetCurrentMap();
                                            int newX = client.Player.X;
                                            int newY = client.Player.Y;
                                            Enums.Direction dir = client.Player.Direction;
                                            switch (client.Player.Direction)
                                            {
                                                case Enums.Direction.Up:
                                                    newY--;
                                                    break;
                                                case Enums.Direction.Down:
                                                    newY++;
                                                    break;
                                                case Enums.Direction.Left:
                                                    newX--;
                                                    break;
                                                case Enums.Direction.Right:
                                                    newX++;
                                                    break;
                                            }
                                            if (newX >= 0 && newX < map.MaxX && newY >= 0 && newY < map.MaxY)
                                            {
                                                if (map.Tile[newX, newY].Type == Enums.TileType.Key)
                                                {
                                                    for (int i = 1; i <= client.Player.MaxInv; i++)
                                                    {
                                                        if (client.Player.Inventory[i].Num == map.Tile[newX, newY].Data1)
                                                        {
                                                            client.Player.UseItem(client.Player.Inventory[i], i);
                                                            break;
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                        else if (parse[1] == "No")
                                        {

                                        }
                                        #endregion
                                    }
                                    break;
                                case "UseMoveKeyOnEnter":
                                    {
                                        #region UseKeyOnEnter Result
                                        if (parse[1] == "Yes")
                                        {
                                            IMap map = client.Player.GetCurrentMap();
                                            int newX = client.Player.X;
                                            int newY = client.Player.Y;
                                            Enums.Direction dir = client.Player.Direction;
                                            switch (client.Player.Direction)
                                            {
                                                case Enums.Direction.Up:
                                                    newY--;
                                                    break;
                                                case Enums.Direction.Down:
                                                    newY++;
                                                    break;
                                                case Enums.Direction.Left:
                                                    newX--;
                                                    break;
                                                case Enums.Direction.Right:
                                                    newX++;
                                                    break;
                                            }
                                            if (newX >= 0 && newX < map.MaxX && newY >= 0 && newY < map.MaxY)
                                            {
                                                if (map.Tile[newX, newY].Type == Enums.TileType.Key)
                                                {
                                                    for (int i = 0; i < client.Player.GetActiveRecruit().Moves.Length; i++)
                                                    {
                                                        if (client.Player.GetActiveRecruit().Moves[i].MoveNum > -1)
                                                        {
                                                            Move move = MoveManager.Moves[client.Player.GetActiveRecruit().Moves[i].MoveNum];
                                                            if (move.KeyItem > 0)
                                                            {
                                                                if (move.KeyItem == map.Tile[newX, newY].Data1)
                                                                {
                                                                    client.Player.GetActiveRecruit().UseMoveKey(map, move, i);
                                                                    break;
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                        #endregion
                                    }
                                    break;
                                default:
                                    {
                                        Scripting.ScriptManager.InvokeSub("QuestionResult", client, id, parse[1]);
                                    }
                                    break;
                            }
                        }
                        break;
                    case "checkcommands":
                        if (!client.Player.Dead)
                        {
                            Scripting.ScriptManager.InvokeSub("Commands", client, CommandProcessor.ParseCommand(parse[1].Trim()));
                        }
                        break;
                    case "reloadscripts":
                        {
                            if (Ranks.IsDisallowed(client, Enums.Rank.Scripter))
                            {
                                Messenger.HackingAttempt(client, "Admin cloning");
                            }
                            else
                            {
                                Scripting.ScriptManager.Reload();
                                Messenger.PlayerMsg(client, "Scripts reloaded!", Text.Yellow);
                            }
                        }
                        break;
                    #endregion
                    #region Tile Checks
                    case "buysprite":
                        {
                            IMap map = client.Player.GetCurrentMap();
                            if (map.Tile[client.Player.X, client.Player.Y].Type != Enums.TileType.SpriteChange)
                            {
                                Messenger.PlayerMsg(client, "You need to be on a sprite tile to buy it!", Text.BrightRed);
                                return;
                            }

                            if (map.Tile[client.Player.X, client.Player.Y].Data2 == 0)
                            {
                                client.Player.GetActiveRecruit().SetSpecies(map.Tile[client.Player.X, client.Player.Y].Data1);
                                Messenger.SendStats(client);
                                Messenger.SendInventory(client);
                                Messenger.SendActiveTeam(client);
                                Messenger.SendPlayerData(client);
                                return;
                            }

                            for (int i = 0; i <= client.Player.MaxInv; i++)
                            {
                                if (client.Player.Inventory[i].Num == map.Tile[client.Player.X, client.Player.Y].Data2)
                                {
                                    if (ItemManager.Items[client.Player.Inventory[i].Num].Type == Enums.ItemType.Currency)
                                    {
                                        if (client.Player.Inventory[i].Amount >= map.Tile[client.Player.X, client.Player.Y].Data3)
                                        {
                                            client.Player.TakeItemSlot(i, map.Tile[client.Player.X, client.Player.Y].Data3, true);
                                            Messenger.PlayerMsg(client, "You have bought a new sprite!", Text.BrightGreen);
                                            client.Player.GetActiveRecruit().SetSpecies(map.Tile[client.Player.X, client.Player.Y].Data1);
                                            Messenger.SendStats(client);
                                            //Messenger.SendDataToMap(client.Player.mMap, "checksprite" + TcpManager.SEP_CHAR + client.ToString() + TcpManager.SEP_CHAR + client.Player.GetActiveChar().mSprite.ToString() + TcpManager.SEP_CHAR + TcpManager.END_CHAR);
                                            Messenger.SendInventory(client);
                                            Messenger.SendActiveTeam(client);
                                            Messenger.SendPlayerData(client);
                                        }
                                    }
                                    else
                                    {
                                        if (client.Player.GetItemSlotHolder(i) == -1)
                                        {
                                            client.Player.TakeItemSlot(i, 1, true);
                                            Messenger.PlayerMsg(client, "You have bought a new sprite!", Text.BrightGreen);
                                            client.Player.GetActiveRecruit().SetSpecies(map.Tile[client.Player.X, client.Player.Y].Data1);
                                            Messenger.SendStats(client);
                                            //Messenger.SendDataToMap(client.Player.mMap, "checksprite" + TcpManager.SEP_CHAR + client.ToString() + TcpManager.SEP_CHAR + client.Player.GetActiveChar().mSprite.ToString() + TcpManager.SEP_CHAR + TcpManager.END_CHAR);
                                            Messenger.SendInventory(client);
                                            Messenger.SendActiveTeam(client);
                                            Messenger.SendPlayerData(client);
                                        }
                                    }
                                    if (client.Player.GetItemSlotHolder(i) == -1)
                                    {
                                        return;
                                    }
                                }
                            }

                            Messenger.PlayerMsg(client, "You dont have enough to buy this sprite!", Text.BrightRed);
                        }
                        break;
                    case "buyhouse":
                        {
                            // TODO: Remake "buyhouse" packet processor
                            //IMap map;
                            //if (client.Player.Map != -2) {
                            //    map = MapManager.Maps[client.Player.Map];
                            //} else {
                            //    Messenger.PlayerMsg(client, "You can't buy an instanced map!", Text.BrightRed);
                            //    return;
                            //}
                            //if (map.Tile[client.Player.X, client.Player.Y].Type != Enums.TileType.House) {
                            //    Messenger.PlayerMsg(client, "You need to be on a house tile to buy it!", Text.BrightRed);
                            //    return;
                            //}

                            //if (map.Tile[client.Player.X, client.Player.Y].Data1 == 0) {
                            //    Messenger.PlayerMsg(client, "You have bought a new house!", Text.BrightGreen);
                            //    map.Owner = client.Player.Name;
                            //    map.Name = client.Player.Name + "'s House";
                            //    map.Revision = map.Revision + 1;
                            //    map.Save();
                            //    //MapManager.SaveMap(map.MapNum);
                            //    Messenger.SendDataToMap(map.MapID, TcpPacket.CreatePacket("checkformap", map.MapID.ToString(), map.Revision.ToString()));
                            //    return;
                            //}

                            //for (int i = 1; i <= Constants.MAX_INV; i++) {
                            //    if (client.Player.Inventory[i].Num == map.Tile[client.Player.X, client.Player.Y].Data1) {
                            //        if (ItemManager.Items[client.Player.Inventory[i].Num].Type == Enums.ItemType.Currency) {
                            //            if (client.Player.Inventory[i].Val >= map.Tile[client.Player.X, client.Player.Y].Data2) {
                            //                client.Player.Inventory[i].Val -= map.Tile[client.Player.X, client.Player.Y].Data2;
                            //                if (client.Player.Inventory[i].Val <= 0) {
                            //                    client.Player.Inventory[i].Val = 0;
                            //                }
                            //                Messenger.PlayerMsg(client, "You have bought a new house!", Text.BrightGreen);
                            //                map.Owner = client.Player.Name;
                            //                map.Name = client.Player.Name + "'s House";
                            //                map.Revision = map.Revision + 1;
                            //                map.Save();
                            //                //MapManager.SaveMap(map.MapNum);
                            //                Messenger.SendDataToMap(map.MapNum, TcpPacket.CreatePacket("CHECKFORMAP", map.MapNum.ToString(), map.Revision.ToString()));
                            //                Messenger.SendInventory(client);
                            //            }
                            //        } else {
                            //            if (client.Player.Weapon != i & client.Player.Weapon != i & client.Player.Shield != i & client.Player.Helmet != i & client.Player.Legs != i & client.Player.Ring != i & client.Player.Necklace != i) {
                            //                client.Player.Inventory[i].Num = 0;
                            //                Messenger.PlayerMsg(client, "You now own a new house!", Text.BrightGreen);
                            //                map.Owner = client.Player.Name;
                            //                map.Name = client.Player.Name + "'s House";
                            //                map.Revision = map.Revision + 1;
                            //                MapManager.SaveMap(map.MapNum);
                            //                Messenger.SendDataToMap(map.MapNum, TcpPacket.CreatePacket("CHECKFORMAP", map.MapNum.ToString(), map.Revision.ToString()));
                            //                Messenger.SendInventory(client);
                            //            }
                            //        }
                            //        if (client.Player.Weapon != i & client.Player.Weapon != i & client.Player.Shield != i & client.Player.Helmet != i & client.Player.Legs != i & client.Player.Ring != i & client.Player.Necklace != i) {
                            //            return;
                            //        }
                            //    }
                            //}

                            //Messenger.PlayerMsg(client, "You dont have enough to buy this house!", Text.BrightRed);
                        }
                        break;
                    #endregion
                    #region Story
                    case "needstory":
                        {
                            if (parse[1] == "yes")
                            {
                                Messenger.SendUpdateStoryTo(client, parse[2].ToInt());
                                if (client.Player.SegmentToStart > -1)
                                {
                                    Messenger.SendStartStoryTo(client, parse[2].ToInt(), client.Player.SegmentToStart);
                                }
                                else
                                {
                                    Messenger.SendStartStoryTo(client, parse[2].ToInt());
                                }
                            }
                            else if (parse[1] == "no")
                            {
                                if (client.Player.SegmentToStart > -1)
                                {
                                    Messenger.SendStartStoryTo(client, parse[2].ToInt(), client.Player.SegmentToStart);
                                }
                                else
                                {
                                    Messenger.SendStartStoryTo(client, parse[2].ToInt());
                                }
                            }
                        }
                        break;
                    case "updatesegment":
                        {
                            client.Player.CurrentSegment = parse[1].ToInt(-1);
                        }
                        break;
                    case "actonaction":
                        {
                            int storyNum = -1;
                            if (client.Player.CurrentChapter != null && !string.IsNullOrEmpty(client.Player.CurrentChapter.ID))
                            {
                                storyNum = client.Player.CurrentChapter.ID.ToInt(-1);
                            }
                            if (client.Player.CurrentChapter != null)
                            {
                                StorySegment story = client.Player.CurrentChapter.Segments[client.Player.CurrentSegment];
                                switch (story.Action)
                                {
                                    case Enums.StoryAction.RunScript:
                                        {
                                            Stories.StoryManager.RunScript(client, story.Parameters.GetValue("ScriptIndex").ToInt(),
                                                story.Parameters.GetValue("ScriptParam1"),
                                                story.Parameters.GetValue("ScriptParam2"),
                                                story.Parameters.GetValue("ScriptParam3"),
                                                story.Parameters.GetValue("Pause").ToBool());
                                        }
                                        break;
                                    case Enums.StoryAction.Padlock:
                                        {
                                            if (storyNum > -1)
                                            {
                                                if (story.Parameters.GetValue("State") == "Unlock")
                                                {
                                                    client.Player.SetStoryState(storyNum, false);
                                                }
                                                else if (story.Parameters.GetValue("State") == "Lock")
                                                {
                                                    client.Player.SetStoryState(storyNum, true);
                                                }
                                            }
                                        }
                                        break;
                                    case Enums.StoryAction.Warp:
                                        {
                                            int X, Y;
                                            if (story.Parameters.GetValue("X") == "-1")
                                            {
                                                X = client.Player.X;
                                            }
                                            else
                                            {
                                                int tmpX = story.Parameters.GetValue("X").ToInt(-1);
                                                if (tmpX > -1)
                                                {
                                                    X = tmpX;
                                                }
                                                else
                                                {
                                                    X = client.Player.X;
                                                }
                                            }
                                            if (story.Parameters.GetValue("Y") == "-1")
                                            {
                                                Y = client.Player.Y;
                                            }
                                            else
                                            {
                                                int tmpY = story.Parameters.GetValue("Y").ToInt(-1);
                                                if (tmpY > -1)
                                                {
                                                    Y = tmpY;
                                                }
                                                else
                                                {
                                                    Y = client.Player.Y;
                                                }
                                            }
                                            Messenger.PlayerWarp(client, story.Parameters.GetValue("MapID"), X, Y);
                                        }
                                        break;
                                }
                            }
                        }
                        break;
                    case "chaptercomplete":
                        {
                            client.Player.CurrentChapter = null;
                            client.Player.CurrentSegment = -1;
                            if (client.Player.StoryPlaybackCache.Count > 0)
                            {
                                if (!string.IsNullOrEmpty(client.Player.StoryPlaybackCache[0].ID) && client.Player.StoryPlaybackCache[0].ID.IsNumeric())
                                {
                                    StoryManager.PlayStory(client, client.Player.StoryPlaybackCache[0].ID.ToInt());
                                }
                                else
                                {
                                    StoryManager.PlayStory(client, client.Player.StoryPlaybackCache[0]);
                                }
                                client.Player.StoryPlaybackCache.RemoveAt(0);
                            }
                        }
                        break;
                    case "storyloadingcomplete":
                        {
                            client.Player.LoadingStory = false;
                        }
                        break;
                    #endregion
                    #region Editors

                    #region Random Dungeons
                    case "requesteditrdungeon":
                        {
                            if (Ranks.IsDisallowed(client, Enums.Rank.Mapper))
                            {
                                Messenger.HackingAttempt(client, "Admin cloning");
                                return;
                            }
                            Messenger.SendRDungeonEditor(client);
                        }
                        break;
                    case "addnewrdungeon":
                        {
                            if (Ranks.IsDisallowed(client, Enums.Rank.Mapper))
                            {
                                Messenger.HackingAttempt(client, "Admin cloning");
                                return;
                            }
                            Messenger.SendAddRDungeonToAll(RDungeonManager.AddRDungeon());
                        }
                        break;
                    case "editrdungeon":
                        {
                            if (Ranks.IsDisallowed(client, Enums.Rank.Mapper))
                            {
                                Messenger.HackingAttempt(client, "Admin cloning");
                                return;
                            }
                            int n = parse[1].ToInt();
                            if (n < 0 || n > RDungeonManager.RDungeons.Count - 1)
                            {
                                Messenger.PlayerMsg(client, "Invalid dungeon client", Text.BrightRed);
                                return;
                            }

                            Messenger.SendEditRDungeonTo(client, n);
                        }
                        break;
                    case "saverdungeon":
                        {//adjust to new variables
                            if (Ranks.IsDisallowed(client, Enums.Rank.Mapper))
                            {
                                Messenger.HackingAttempt(client, "Admin cloning");
                                return;
                            }

                            int z = parse[1].ToInt();

                            RDungeonManager.RDungeons[z].DungeonName = parse[2];
                            RDungeonManager.RDungeons[z].Direction = (Enums.Direction)parse[3].ToInt();
                            int maxFloors = parse[4].ToInt();
                            RDungeonManager.RDungeons[z].Recruitment = parse[5].ToBool();
                            RDungeonManager.RDungeons[z].Exp = parse[6].ToBool();
                            RDungeonManager.RDungeons[z].WindTimer = parse[7].ToInt();
                            RDungeonManager.RDungeons[z].DungeonIndex = parse[8].ToInt();
                            int n = 9;
                            RDungeonManager.RDungeons[z].Floors.Clear();
                            for (int i = 0; i < maxFloors; i++)
                            {
                                RDungeonManager.RDungeons[z].Floors.Add(new RDungeonFloor());
                                RDungeonManager.RDungeons[z].Floors[i].Options.TrapMin = parse[n].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].Options.TrapMax = parse[n + 1].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].Options.ItemMin = parse[n + 2].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].Options.ItemMax = parse[n + 3].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].Options.Intricacy = parse[n + 4].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].Options.RoomWidthMin = parse[n + 5].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].Options.RoomWidthMax = parse[n + 6].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].Options.RoomLengthMin = parse[n + 7].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].Options.RoomLengthMax = parse[n + 8].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].Options.HallTurnMin = parse[n + 9].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].Options.HallTurnMax = parse[n + 10].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].Options.HallVarMin = parse[n + 11].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].Options.HallVarMax = parse[n + 12].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].Options.WaterFrequency = parse[n + 13].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].Options.Craters = parse[n + 14].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].Options.CraterMinLength = parse[n + 15].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].Options.CraterMaxLength = parse[n + 16].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].Options.CraterFuzzy = parse[n + 17].ToBool();
                                RDungeonManager.RDungeons[z].Floors[i].Options.MinChambers = parse[n + 18].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].Options.MaxChambers = parse[n + 19].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].Darkness = parse[n + 20].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].GoalType = (Enums.RFloorGoalType)parse[n + 21].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].GoalMap = parse[n + 22].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].GoalX = parse[n + 23].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].GoalY = parse[n + 24].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].Music = parse[n + 25];

                                n += 26;

                                RDungeonManager.RDungeons[z].Floors[i].StairsX = parse[n].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].StairsSheet = parse[n + 1].ToInt();

                                RDungeonManager.RDungeons[z].Floors[i].mGroundX = parse[n + 2].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mGroundSheet = parse[n + 3].ToInt();

                                RDungeonManager.RDungeons[z].Floors[i].mTopLeftX = parse[n + 4].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mTopLeftSheet = parse[n + 5].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mTopCenterX = parse[n + 6].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mTopCenterSheet = parse[n + 7].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mTopRightX = parse[n + 8].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mTopRightSheet = parse[n + 9].ToInt();

                                RDungeonManager.RDungeons[z].Floors[i].mCenterLeftX = parse[n + 10].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mCenterLeftSheet = parse[n + 11].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mCenterCenterX = parse[n + 12].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mCenterCenterSheet = parse[n + 13].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mCenterRightX = parse[n + 14].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mCenterRightSheet = parse[n + 15].ToInt();

                                RDungeonManager.RDungeons[z].Floors[i].mBottomLeftX = parse[n + 16].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mBottomLeftSheet = parse[n + 17].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mBottomCenterX = parse[n + 18].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mBottomCenterSheet = parse[n + 19].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mBottomRightX = parse[n + 20].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mBottomRightSheet = parse[n + 21].ToInt();

                                RDungeonManager.RDungeons[z].Floors[i].mInnerTopLeftX = parse[n + 22].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mInnerTopLeftSheet = parse[n + 23].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mInnerBottomLeftX = parse[n + 24].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mInnerBottomLeftSheet = parse[n + 25].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mInnerTopRightX = parse[n + 26].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mInnerTopRightSheet = parse[n + 27].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mInnerBottomRightX = parse[n + 28].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mInnerBottomRightSheet = parse[n + 29].ToInt();

                                RDungeonManager.RDungeons[z].Floors[i].mIsolatedWallX = parse[n + 30].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mIsolatedWallSheet = parse[n + 31].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mColumnTopX = parse[n + 32].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mColumnTopSheet = parse[n + 33].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mColumnCenterX = parse[n + 34].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mColumnCenterSheet = parse[n + 35].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mColumnBottomX = parse[n + 36].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mColumnBottomSheet = parse[n + 37].ToInt();

                                RDungeonManager.RDungeons[z].Floors[i].mRowLeftX = parse[n + 38].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mRowLeftSheet = parse[n + 39].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mRowCenterX = parse[n + 40].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mRowCenterSheet = parse[n + 41].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mRowRightX = parse[n + 42].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mRowRightSheet = parse[n + 43].ToInt();

                                n += 44;

                                RDungeonManager.RDungeons[z].Floors[i].mGroundAltX = parse[n].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mGroundAltSheet = parse[n + 1].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mGroundAlt2X = parse[n + 2].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mGroundAlt2Sheet = parse[n + 3].ToInt();

                                RDungeonManager.RDungeons[z].Floors[i].mTopLeftAltX = parse[n + 4].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mTopLeftAltSheet = parse[n + 5].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mTopCenterAltX = parse[n + 6].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mTopCenterAltSheet = parse[n + 7].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mTopRightAltX = parse[n + 8].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mTopRightAltSheet = parse[n + 9].ToInt();

                                RDungeonManager.RDungeons[z].Floors[i].mCenterLeftAltX = parse[n + 10].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mCenterLeftAltSheet = parse[n + 11].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mCenterCenterAltX = parse[n + 12].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mCenterCenterAltSheet = parse[n + 13].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mCenterCenterAlt2X = parse[n + 14].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mCenterCenterAlt2Sheet = parse[n + 15].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mCenterRightAltX = parse[n + 16].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mCenterRightAltSheet = parse[n + 17].ToInt();

                                RDungeonManager.RDungeons[z].Floors[i].mBottomLeftAltX = parse[n + 18].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mBottomLeftAltSheet = parse[n + 19].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mBottomCenterAltX = parse[n + 20].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mBottomCenterAltSheet = parse[n + 21].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mBottomRightAltX = parse[n + 22].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mBottomRightAltSheet = parse[n + 23].ToInt();

                                RDungeonManager.RDungeons[z].Floors[i].mInnerTopLeftAltX = parse[n + 24].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mInnerTopLeftAltSheet = parse[n + 25].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mInnerBottomLeftAltX = parse[n + 26].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mInnerBottomLeftAltSheet = parse[n + 27].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mInnerTopRightAltX = parse[n + 28].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mInnerTopRightAltSheet = parse[n + 29].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mInnerBottomRightAltX = parse[n + 30].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mInnerBottomRightAltSheet = parse[n + 31].ToInt();

                                RDungeonManager.RDungeons[z].Floors[i].mIsolatedWallAltX = parse[n + 32].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mIsolatedWallAltSheet = parse[n + 33].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mColumnTopAltX = parse[n + 34].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mColumnTopAltSheet = parse[n + 35].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mColumnCenterAltX = parse[n + 36].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mColumnCenterAltSheet = parse[n + 37].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mColumnBottomAltX = parse[n + 38].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mColumnBottomAltSheet = parse[n + 39].ToInt();

                                RDungeonManager.RDungeons[z].Floors[i].mRowLeftAltX = parse[n + 40].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mRowLeftAltSheet = parse[n + 41].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mRowCenterAltX = parse[n + 42].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mRowCenterAltSheet = parse[n + 43].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mRowRightAltX = parse[n + 44].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mRowRightAltSheet = parse[n + 45].ToInt();

                                n += 46;

                                RDungeonManager.RDungeons[z].Floors[i].mWaterX = parse[n].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mWaterSheet = parse[n + 1].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mWaterAnimX = parse[n + 2].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mWaterAnimSheet = parse[n + 3].ToInt();

                                RDungeonManager.RDungeons[z].Floors[i].mShoreTopLeftX = parse[n + 4].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mShoreTopLeftSheet = parse[n + 5].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mShoreTopRightX = parse[n + 6].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mShoreTopRightSheet = parse[n + 7].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mShoreBottomRightX = parse[n + 8].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mShoreBottomRightSheet = parse[n + 9].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mShoreBottomLeftX = parse[n + 10].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mShoreBottomLeftSheet = parse[n + 11].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mShoreDiagonalForwardX = parse[n + 12].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mShoreDiagonalForwardSheet = parse[n + 13].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mShoreDiagonalBackX = parse[n + 14].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mShoreDiagonalBackSheet = parse[n + 15].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mShoreTopX = parse[n + 16].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mShoreTopSheet = parse[n + 17].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mShoreRightX = parse[n + 18].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mShoreRightSheet = parse[n + 19].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mShoreBottomX = parse[n + 20].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mShoreBottomSheet = parse[n + 21].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mShoreLeftX = parse[n + 22].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mShoreLeftSheet = parse[n + 23].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mShoreVerticalX = parse[n + 24].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mShoreVerticalSheet = parse[n + 25].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mShoreHorizontalX = parse[n + 26].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mShoreHorizontalSheet = parse[n + 27].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mShoreInnerTopLeftX = parse[n + 28].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mShoreInnerTopLeftSheet = parse[n + 29].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mShoreInnerTopRightX = parse[n + 30].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mShoreInnerTopRightSheet = parse[n + 31].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mShoreInnerBottomRightX = parse[n + 32].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mShoreInnerBottomRightSheet = parse[n + 33].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mShoreInnerBottomLeftX = parse[n + 34].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mShoreInnerBottomLeftSheet = parse[n + 35].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mShoreInnerTopX = parse[n + 36].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mShoreInnerTopSheet = parse[n + 37].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mShoreInnerRightX = parse[n + 38].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mShoreInnerRightSheet = parse[n + 39].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mShoreInnerBottomX = parse[n + 40].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mShoreInnerBottomSheet = parse[n + 41].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mShoreInnerLeftX = parse[n + 42].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mShoreInnerLeftSheet = parse[n + 43].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mShoreSurroundedX = parse[n + 44].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mShoreSurroundedSheet = parse[n + 45].ToInt();

                                RDungeonManager.RDungeons[z].Floors[i].mShoreTopLeftAnimX = parse[n + 46].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mShoreTopLeftAnimSheet = parse[n + 47].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mShoreTopRightAnimX = parse[n + 48].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mShoreTopRightAnimSheet = parse[n + 49].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mShoreBottomRightAnimX = parse[n + 50].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mShoreBottomRightAnimSheet = parse[n + 51].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mShoreBottomLeftAnimX = parse[n + 52].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mShoreBottomLeftAnimSheet = parse[n + 53].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mShoreDiagonalForwardAnimX = parse[n + 54].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mShoreDiagonalForwardAnimSheet = parse[n + 55].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mShoreDiagonalBackAnimX = parse[n + 56].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mShoreDiagonalBackAnimSheet = parse[n + 57].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mShoreTopAnimX = parse[n + 58].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mShoreTopAnimSheet = parse[n + 59].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mShoreRightAnimX = parse[n + 60].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mShoreRightAnimSheet = parse[n + 61].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mShoreBottomAnimX = parse[n + 62].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mShoreBottomAnimSheet = parse[n + 63].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mShoreLeftAnimX = parse[n + 64].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mShoreLeftAnimSheet = parse[n + 65].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mShoreVerticalAnimX = parse[n + 66].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mShoreVerticalAnimSheet = parse[n + 67].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mShoreHorizontalAnimX = parse[n + 68].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mShoreHorizontalAnimSheet = parse[n + 69].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mShoreInnerTopLeftAnimX = parse[n + 70].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mShoreInnerTopLeftAnimSheet = parse[n + 71].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mShoreInnerTopRightAnimX = parse[n + 72].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mShoreInnerTopRightAnimSheet = parse[n + 73].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mShoreInnerBottomRightAnimX = parse[n + 74].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mShoreInnerBottomRightAnimSheet = parse[n + 75].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mShoreInnerBottomLeftAnimX = parse[n + 76].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mShoreInnerBottomLeftAnimSheet = parse[n + 77].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mShoreInnerTopAnimX = parse[n + 78].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mShoreInnerTopAnimSheet = parse[n + 79].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mShoreInnerRightAnimX = parse[n + 80].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mShoreInnerRightAnimSheet = parse[n + 81].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mShoreInnerBottomAnimX = parse[n + 82].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mShoreInnerBottomAnimSheet = parse[n + 83].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mShoreInnerLeftAnimX = parse[n + 84].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mShoreInnerLeftAnimSheet = parse[n + 85].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mShoreSurroundedAnimX = parse[n + 86].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].mShoreSurroundedAnimSheet = parse[n + 87].ToInt();

                                n += 88;

                                RDungeonManager.RDungeons[z].Floors[i].GroundTile.Type = (Enums.TileType)parse[n].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].GroundTile.Data1 = parse[n + 1].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].GroundTile.Data2 = parse[n + 2].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].GroundTile.Data3 = parse[n + 3].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].GroundTile.String1 = parse[n + 4];
                                RDungeonManager.RDungeons[z].Floors[i].GroundTile.String2 = parse[n + 5];
                                RDungeonManager.RDungeons[z].Floors[i].GroundTile.String3 = parse[n + 6];

                                RDungeonManager.RDungeons[z].Floors[i].HallTile.Type = (Enums.TileType)parse[n + 7].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].HallTile.Data1 = parse[n + 8].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].HallTile.Data2 = parse[n + 9].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].HallTile.Data3 = parse[n + 10].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].HallTile.String1 = parse[n + 11];
                                RDungeonManager.RDungeons[z].Floors[i].HallTile.String2 = parse[n + 12];
                                RDungeonManager.RDungeons[z].Floors[i].HallTile.String3 = parse[n + 13];

                                RDungeonManager.RDungeons[z].Floors[i].WaterTile.Type = (Enums.TileType)parse[n + 14].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].WaterTile.Data1 = parse[n + 15].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].WaterTile.Data2 = parse[n + 16].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].WaterTile.Data3 = parse[n + 17].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].WaterTile.String1 = parse[n + 18];
                                RDungeonManager.RDungeons[z].Floors[i].WaterTile.String2 = parse[n + 19];
                                RDungeonManager.RDungeons[z].Floors[i].WaterTile.String3 = parse[n + 20];

                                RDungeonManager.RDungeons[z].Floors[i].WallTile.Type = (Enums.TileType)parse[n + 21].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].WallTile.Data1 = parse[n + 22].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].WallTile.Data2 = parse[n + 23].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].WallTile.Data3 = parse[n + 24].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].WallTile.String1 = parse[n + 25];
                                RDungeonManager.RDungeons[z].Floors[i].WallTile.String2 = parse[n + 26];
                                RDungeonManager.RDungeons[z].Floors[i].WallTile.String3 = parse[n + 27];

                                RDungeonManager.RDungeons[z].Floors[i].NpcSpawnTime = parse[n + 28].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].NpcMin = parse[n + 29].ToInt();
                                RDungeonManager.RDungeons[z].Floors[i].NpcMax = parse[n + 30].ToInt();

                                n += 31;

                                RDungeonManager.RDungeons[z].Floors[i].Items.Clear();
                                for (int item = 0; item < parse[n].ToInt(); item++)
                                {
                                    RDungeonItem newItem = new RDungeonItem();
                                    newItem.ItemNum = parse[n + item * 10 + 1].ToInt();
                                    newItem.MinAmount = parse[n + item * 10 + 2].ToInt();
                                    newItem.MaxAmount = parse[n + item * 10 + 3].ToInt();
                                    newItem.AppearanceRate = parse[n + item * 10 + 4].ToInt();
                                    newItem.StickyRate = parse[n + item * 10 + 5].ToInt();
                                    newItem.Tag = parse[n + item * 10 + 6];
                                    newItem.Hidden = parse[n + item * 10 + 7].ToBool();
                                    newItem.OnGround = parse[n + item * 10 + 8].ToBool();
                                    newItem.OnWater = parse[n + item * 10 + 9].ToBool();
                                    newItem.OnWall = parse[n + item * 10 + 10].ToBool();

                                    RDungeonManager.RDungeons[z].Floors[i].Items.Add(newItem);
                                }
                                n += RDungeonManager.RDungeons[z].Floors[i].Items.Count * 10 + 1;

                                RDungeonManager.RDungeons[z].Floors[i].Npcs.Clear();
                                for (int npc = 0; npc < parse[n].ToInt(); npc++)
                                {
                                    MapNpcPreset newNpc = new MapNpcPreset();
                                    newNpc.NpcNum = parse[n + npc * 7 + 1].ToInt();
                                    newNpc.MinLevel = parse[n + npc * 7 + 2].ToInt();
                                    newNpc.MaxLevel = parse[n + npc * 7 + 3].ToInt();
                                    newNpc.AppearanceRate = parse[n + npc * 7 + 4].ToInt();
                                    newNpc.StartStatus = (Enums.StatusAilment)parse[n + npc * 7 + 5].ToInt();
                                    newNpc.StartStatusCounter = parse[n + npc * 7 + 6].ToInt();
                                    newNpc.StartStatusChance = parse[n + npc * 7 + 7].ToInt();

                                    RDungeonManager.RDungeons[z].Floors[i].Npcs.Add(newNpc);
                                }
                                n += RDungeonManager.RDungeons[z].Floors[i].Npcs.Count * 7 + 1;

                                RDungeonManager.RDungeons[z].Floors[i].SpecialTiles.Clear();
                                for (int traps = 0; traps < parse[n].ToInt(); traps++)
                                {
                                    RDungeonTrap newTile = new RDungeonTrap();
                                    newTile.Type = (Enums.TileType)parse[n + traps * 29 + 1].ToInt();
                                    newTile.Data1 = parse[n + traps * 29 + 2].ToInt();
                                    newTile.Data2 = parse[n + traps * 29 + 3].ToInt();
                                    newTile.Data3 = parse[n + traps * 29 + 4].ToInt();
                                    newTile.String1 = parse[n + traps * 29 + 5];
                                    newTile.String2 = parse[n + traps * 29 + 6];
                                    newTile.String3 = parse[n + traps * 29 + 7];
                                    newTile.Ground = parse[n + traps * 29 + 8].ToInt();
                                    newTile.GroundSet = parse[n + traps * 29 + 9].ToInt();
                                    newTile.GroundAnim = parse[n + traps * 29 + 10].ToInt();
                                    newTile.GroundAnimSet = parse[n + traps * 29 + 11].ToInt();
                                    newTile.Mask = parse[n + traps * 29 + 12].ToInt();
                                    newTile.MaskSet = parse[n + traps * 29 + 13].ToInt();
                                    newTile.Anim = parse[n + traps * 29 + 14].ToInt();
                                    newTile.AnimSet = parse[n + traps * 29 + 15].ToInt();
                                    newTile.Mask2 = parse[n + traps * 29 + 16].ToInt();
                                    newTile.Mask2Set = parse[n + traps * 29 + 17].ToInt();
                                    newTile.M2Anim = parse[n + traps * 29 + 18].ToInt();
                                    newTile.M2AnimSet = parse[n + traps * 29 + 19].ToInt();
                                    newTile.Fringe = parse[n + traps * 29 + 20].ToInt();
                                    newTile.FringeSet = parse[n + traps * 29 + 21].ToInt();
                                    newTile.FAnim = parse[n + traps * 29 + 22].ToInt();
                                    newTile.FAnimSet = parse[n + traps * 29 + 23].ToInt();
                                    newTile.Fringe2 = parse[n + traps * 29 + 24].ToInt();
                                    newTile.Fringe2Set = parse[n + traps * 29 + 25].ToInt();
                                    newTile.F2Anim = parse[n + traps * 29 + 26].ToInt();
                                    newTile.F2AnimSet = parse[n + traps * 29 + 27].ToInt();
                                    newTile.RDungeonMapValue = parse[n + traps * 29 + 28].ToInt();

                                    newTile.AppearanceRate = parse[n + traps * 29 + 29].ToInt();

                                    RDungeonManager.RDungeons[z].Floors[i].SpecialTiles.Add(newTile);

                                }
                                n += RDungeonManager.RDungeons[z].Floors[i].SpecialTiles.Count * 29 + 1;

                                RDungeonManager.RDungeons[z].Floors[i].Weather.Clear();
                                for (int weather = 0; weather < parse[n].ToInt(); weather++)
                                {
                                    RDungeonManager.RDungeons[z].Floors[i].Weather.Add((Enums.Weather)parse[n + 1 + weather].ToInt());

                                }
                                n += RDungeonManager.RDungeons[z].Floors[i].Weather.Count + 1;

                                RDungeonManager.RDungeons[z].Floors[i].Options.Chambers.Clear();
                                for (int chamber = 0; chamber < parse[n].ToInt(); chamber++)
                                {
                                    RDungeonPresetChamber newChamber = new RDungeonPresetChamber();
                                    newChamber.ChamberNum = parse[n + chamber * 4 + 1].ToInt();
                                    newChamber.String1 = parse[n + chamber * 4 + 2];
                                    newChamber.String2 = parse[n + chamber * 4 + 3];
                                    newChamber.String3 = parse[n + chamber * 4 + 4];

                                    RDungeonManager.RDungeons[z].Floors[i].Options.Chambers.Add(newChamber);
                                }
                                n += RDungeonManager.RDungeons[z].Floors[i].Options.Chambers.Count * 4 + 1;

                            }
                            Messenger.SendUpdateRDungeonToAll(z);
                            RDungeonManager.SaveRDungeon(z);

                        }
                        break;
                    #endregion
                    #region Maps
                    case "mapreportrequest":
                        {
                            // Prevent hacking
                            if (Ranks.IsDisallowed(client, Enums.Rank.Mapper))
                            {
                                Messenger.HackingAttempt(client, "Admin Cloning");
                                return;
                            }
                            TcpPacket packet = new TcpPacket("mapreport");
                            packet.AppendParameter(MapManager.StandardMapCount);
                            using (DatabaseConnection dbConnection = new DatabaseConnection(DatabaseID.Data))
                            {
                                for (int i = 1; i <= MapManager.StandardMapCount; i++)
                                {
                                    //packet.AppendParameter(MapManager.Maps[i].Name);
                                    packet.AppendParameter(DataManager.Maps.MapDataManager.GetMapName(dbConnection.Database, MapManager.GenerateMapID(i)));
                                }
                            }

                            Messenger.SendDataTo(client, packet);
                        }
                        break;
                    case "requesteditmap":
                        if (Ranks.IsDisallowed(client, Enums.Rank.Mapper))
                        {
                            Messenger.HackingAttempt(client, "Admin cloning");
                            return;
                        }
                        if (client.Player.Map.MapType == Enums.MapType.Instanced)
                        {
                            int mapBase = ((InstancedMap)client.Player.Map).MapBase;
                            if (mapBase > 0)
                            {
                                client.Player.BeginUninstancedWarp();
                                Messenger.PlayerWarp(client, mapBase, client.Player.X, client.Player.Y);
                                client.Player.EndUninstancedWarp();
                                Messenger.PlayerMsg(client, "You have been warped to the original map to edit it!", Text.BrightBlue);
                                return;
                            }
                        }
                        if (client.Player.Map.MapType != Enums.MapType.Standard && client.Player.Map.MapType != Enums.MapType.House)
                        {
                            Messenger.PlayerMsg(client, "You can't edit a non-standard map!", Text.BrightRed);
                            return;
                        }
                        client.Player.InMapEditor = true;
                        Messenger.SendDataTo(client, TcpPacket.CreatePacket("editmap"));
                        Messenger.SendMapLatestPropertiesTo(client);
                        break;
                    case "requestedithouse":
                        {
                            if (client.Player.Map.MapType == Enums.MapType.House)
                            {
                                House house = client.Player.Map as House;
                                if (house.OwnerID != client.Player.CharID)
                                {
                                    Messenger.PlayerMsg(client, "This is not your house!", Text.BrightRed);
                                    return;
                                }
                                Messenger.SendDataTo(client, TcpPacket.CreatePacket("edithouse"));
                            }
                            else
                            {
                                Messenger.PlayerMsg(client, "This is not a house!", Text.BrightRed);
                            }
                        }
                        break;
                    case "mapdata":
                        {
                            if (Ranks.IsDisallowed(client, Enums.Rank.Mapper))
                            {
                                if (client.Player.Map.MapType == Enums.MapType.House)
                                {
                                    if (((House)client.Player.Map).OwnerID != client.Player.CharID)
                                    {
                                        return;
                                    }
                                }
                                else
                                {
                                    return;
                                }
                            }

                            if (client.Player.Map.MapType != Enums.MapType.Standard && client.Player.Map.MapType != Enums.MapType.House)
                            {
                                Messenger.PlayerMsg(client, "You can't edit a non-standard map!", Text.BrightRed);
                                return;
                            }

                            IMap map = null;
                            string mapID = "s0";
                            int n = 0;
                            int X = 0;
                            int Y = 0;
                            n = 1;

                            mapID = client.Player.MapID;
                            if (mapID != parse[n])
                            {
                                Messenger.PlayerMsg(client, "Error Saving: Incorrect Map [Error 3]", Text.BrightRed);
                                return;
                            }
                            if (client.Player.Map.MapType == Enums.MapType.Standard)
                            {
                                map = new Map(new DataManager.Maps.Map(mapID));
                            }
                            else if (client.Player.Map.MapType == Enums.MapType.House)
                            {
                                House houseMap = client.Player.Map as House;

                                DataManager.Maps.HouseMap newHouseMap = new DataManager.Maps.HouseMap(MapManager.GenerateHouseID(houseMap.OwnerID, houseMap.Room));
                                newHouseMap.Owner = houseMap.OwnerID;
                                newHouseMap.Room = houseMap.Room;
                                newHouseMap.StartX = ((House)client.Player.Map).StartX;
                                newHouseMap.StartY = ((House)client.Player.Map).StartY;
                                map = new House(newHouseMap);

                            }
                            map.IsSaving = true;

                            int revision = MapManager.RetrieveActiveMap(mapID).Revision;
                            map.Name = parse[n + 1];
                            map.Revision = revision + 1;
                            map.Moral = (Enums.MapMoral)parse[n + 3].ToInt();
                            map.Up = parse[n + 4].ToInt();
                            map.Down = parse[n + 5].ToInt();
                            map.Left = parse[n + 6].ToInt();
                            map.Right = parse[n + 7].ToInt();
                            map.Music = parse[n + 8];
                            map.Indoors = parse[n + 9].ToBool();
                            map.Weather = (Enums.Weather)parse[n + 10].ToInt();
                            map.MaxX = parse[n + 11].ToInt();
                            map.MaxY = parse[n + 12].ToInt();
                            map.OriginalDarkness = parse[n + 13].ToInt();
                            map.HungerEnabled = parse[n + 14].ToBool();
                            map.RecruitEnabled = parse[n + 15].ToBool();
                            map.ExpEnabled = parse[n + 16].ToBool();
                            map.TimeLimit = parse[n + 17].ToInt();
                            map.MinNpcs = parse[n + 18].ToInt();
                            map.MaxNpcs = parse[n + 19].ToInt();
                            map.NpcSpawnTime = parse[n + 20].ToInt();

                            if (map.MapType == Enums.MapType.Standard)
                            {
                                ((Map)map).Instanced = parse[n + 21].ToBool();
                            }

                            map.Tile = new TileCollection(map.BaseMap, map.MaxX, map.MaxY);

                            n += 22;

                            for (Y = 0; Y <= map.MaxY; Y++)
                            {
                                for (X = 0; X <= map.MaxX; X++)
                                {
                                    map.Tile[X, Y].Ground = parse[n].ToInt();
                                    map.Tile[X, Y].GroundAnim = parse[n + 1].ToInt();
                                    map.Tile[X, Y].Mask = parse[n + 2].ToInt();
                                    map.Tile[X, Y].Anim = parse[n + 3].ToInt();
                                    map.Tile[X, Y].Mask2 = parse[n + 4].ToInt();
                                    map.Tile[X, Y].M2Anim = parse[n + 5].ToInt();
                                    map.Tile[X, Y].Fringe = parse[n + 6].ToInt();
                                    map.Tile[X, Y].FAnim = parse[n + 7].ToInt();
                                    map.Tile[X, Y].Fringe2 = parse[n + 8].ToInt();
                                    map.Tile[X, Y].F2Anim = parse[n + 9].ToInt();
                                    map.Tile[X, Y].Type = (Enums.TileType)parse[n + 10].ToInt();
                                    map.Tile[X, Y].Data1 = parse[n + 11].ToInt();
                                    map.Tile[X, Y].Data2 = parse[n + 12].ToInt();
                                    map.Tile[X, Y].Data3 = parse[n + 13].ToInt();
                                    map.Tile[X, Y].String1 = parse[n + 14];
                                    map.Tile[X, Y].String2 = parse[n + 15];
                                    map.Tile[X, Y].String3 = parse[n + 16];
                                    map.Tile[X, Y].RDungeonMapValue = parse[n + 17].ToInt();
                                    map.Tile[X, Y].GroundSet = parse[n + 18].ToInt();
                                    map.Tile[X, Y].GroundAnimSet = parse[n + 19].ToInt();
                                    map.Tile[X, Y].MaskSet = parse[n + 20].ToInt();
                                    map.Tile[X, Y].AnimSet = parse[n + 21].ToInt();
                                    map.Tile[X, Y].Mask2Set = parse[n + 22].ToInt();
                                    map.Tile[X, Y].M2AnimSet = parse[n + 23].ToInt();
                                    map.Tile[X, Y].FringeSet = parse[n + 24].ToInt();
                                    map.Tile[X, Y].FAnimSet = parse[n + 25].ToInt();
                                    map.Tile[X, Y].Fringe2Set = parse[n + 26].ToInt();
                                    map.Tile[X, Y].F2AnimSet = parse[n + 27].ToInt();
                                    n += 28;

                                    if (map.MapType == Enums.MapType.House)
                                    {
                                        if (map.Tile[X, Y].Type == Enums.TileType.Warp || map.Tile[X, Y].Type == Enums.TileType.Item)
                                        {
                                            Messenger.PlayerMsg(client, "Invalid map tile placed!", Text.BrightRed);
                                            return;
                                        }
                                    }
                                }
                            }

                            int npcCount = parse[n].ToInt();
                            n++;

                            for (X = 0; X < npcCount; X++)
                            {
                                MapNpcPreset newNpc = new MapNpcPreset();
                                newNpc.NpcNum = parse[n].ToInt();
                                newNpc.SpawnX = parse[n + 1].ToInt();
                                newNpc.SpawnY = parse[n + 2].ToInt();
                                newNpc.MinLevel = parse[n + 3].ToInt();
                                newNpc.MaxLevel = parse[n + 4].ToInt();
                                newNpc.AppearanceRate = parse[n + 5].ToInt();
                                newNpc.StartStatus = (Enums.StatusAilment)parse[n + 6].ToInt();
                                newNpc.StartStatusCounter = parse[n + 7].ToInt();
                                newNpc.StartStatusChance = parse[n + 8].ToInt();

                                map.Npc.Add(newNpc);
                                n += 9;
                            }

                            for (int i = 0; i < Constants.MAX_MAP_NPCS; i++)
                            {
                                map.ClearActiveNpc(i);
                            }

                            // Clear out it all
                            for (int i = 0; i < Constants.MAX_MAP_ITEMS; i++)
                            {
                                map.SpawnItemSlot(i, -1, 0, false, false, "", map.ActiveItem[i].X, map.ActiveItem[i].Y, null);
                                map.ClearActiveItem(i);
                            }

                            map.RemakePlayersList();
                            MapManager.UpdateActiveMap(mapID, map);
                            //MapManager.Maps[mapID] = map;
                            // Save the map
                            map.Save();
                            map.IsSaving = false;
                            // Respawn
                            map.SpawnItems();
                            map.SpawnNpcs();

                            // Refresh map for everyone online
                            foreach (Client i in map.GetClients())
                            {
                                if (i.IsPlaying())
                                {
                                    if (Ranks.IsAllowed(i, Enums.Rank.Mapper))
                                    {
                                        if (map.MapType == Enums.MapType.Standard)
                                        {
                                            Map standardMap = map as Map;
                                            if (standardMap != null)
                                            {
                                                Messenger.SendMapNameUpdate(i, standardMap.MapNum, standardMap.Name);
                                            }
                                        }
                                    }
                                    if (i.Player.MapID == map.MapID)
                                    {
                                        i.Player.InvalidateCachedMap();
                                        Messenger.SendCheckForMap(i);
                                    }
                                }
                            }
                        }
                        break;
                    case "scriptedtileinforequest":
                        {
                            Messenger.SendScriptedTileInfoTo(client, (string)Scripting.ScriptManager.InvokeFunction("ScriptedTileInfo", client, parse[1].ToInt()));
                        }
                        break;
                    case "scriptedsigninforequest":
                        {
                            Messenger.SendScriptedSignInfoTo(client, (string)Scripting.ScriptManager.InvokeFunction("ScriptedSignInfo", client, parse[1].ToInt()));
                        }
                        break;
                    case "mobilityinforequest":
                        {
                            Messenger.SendMobilityInfoTo(client, (string)Scripting.ScriptManager.InvokeFunction("MobilityInfo", client, parse[1].ToInt()));
                        }
                        break;
                    #endregion
                    #region Live Map Editor
                    case "exitmapeditor":
                        {
                            client.Player.InMapEditor = false;
                        }
                        break;
                    case "mapeditortileplaced":
                        {
                            if (Ranks.IsDisallowed(client, Enums.Rank.Mapper))
                            {
                                if (client.Player.Map.MapType == Enums.MapType.House)
                                {
                                    if (((House)client.Player.Map).OwnerID != client.Player.CharID)
                                    {
                                        return;
                                    }
                                }
                                else
                                {
                                    return;
                                }
                            }

                            if (client.Player.Map.MapType != Enums.MapType.Standard && client.Player.Map.MapType != Enums.MapType.House)
                            {
                                Messenger.PlayerMsg(client, "You can't edit a non-standard map!", Text.BrightRed);
                                return;
                            }

                            int x = parse[1].ToInt();
                            int y = parse[2].ToInt();
                            int layer = parse[3].ToInt();
                            int set = parse[4].ToInt();
                            int tile = parse[5].ToInt();

                            IMap map = client.Player.Map;
                            foreach (Client mapper in map.GetClients())
                            {
                                // We only want to check the mappers
                                if (Ranks.IsAllowed(mapper, Enums.Rank.Mapper))
                                {
                                    if (mapper != client)
                                    {
                                        // We're on the same map...
                                        if (mapper.Player.InMapEditor)
                                        {
                                            // We have the map editor open...
                                            Messenger.SendLiveMapEditorTilePlacedData(mapper, x, y, layer, set, tile);
                                        }
                                    }
                                }
                            }
                        }
                        break;
                    case "mapeditorattribplaced":
                        {
                            if (Ranks.IsDisallowed(client, Enums.Rank.Mapper))
                            {
                                if (client.Player.Map.MapType == Enums.MapType.House)
                                {
                                    if (((House)client.Player.Map).OwnerID != client.Player.CharID)
                                    {
                                        return;
                                    }
                                }
                                else
                                {
                                    return;
                                }
                            }

                            if (client.Player.Map.MapType != Enums.MapType.Standard && client.Player.Map.MapType != Enums.MapType.House)
                            {
                                Messenger.PlayerMsg(client, "You can't edit a non-standard map!", Text.BrightRed);
                                return;
                            }

                            int x = parse[1].ToInt();
                            int y = parse[2].ToInt();
                            int type = parse[3].ToInt();
                            int data1 = parse[4].ToInt();
                            int data2 = parse[5].ToInt();
                            int data3 = parse[6].ToInt();
                            string string1 = parse[7];
                            string string2 = parse[8];
                            string string3 = parse[9];
                            int dungeonValue = parse[10].ToInt();

                            IMap map = client.Player.Map;
                            foreach (Client mapper in map.GetClients())
                            {
                                // We only want to check the mappers
                                if (Ranks.IsAllowed(mapper, Enums.Rank.Mapper))
                                {
                                    if (mapper != client)
                                    {
                                        // We're on the same map...
                                        if (mapper.Player.InMapEditor)
                                        {
                                            // We have the map editor open...
                                            Messenger.SendLiveMapEditorAttributePlacedData(mapper, x, y, type, data1, data2, data3,
                                                string1, string2, string3, dungeonValue);
                                        }
                                    }
                                }
                            }
                        }
                        break;
                    case "mapeditorfilllayer":
                        {
                            if (Ranks.IsDisallowed(client, Enums.Rank.Mapper))
                            {
                                if (client.Player.Map.MapType == Enums.MapType.House)
                                {
                                    if (((House)client.Player.Map).OwnerID != client.Player.CharID)
                                    {
                                        return;
                                    }
                                }
                                else
                                {
                                    return;
                                }
                            }

                            if (client.Player.Map.MapType != Enums.MapType.Standard && client.Player.Map.MapType != Enums.MapType.House)
                            {
                                Messenger.PlayerMsg(client, "You can't edit a non-standard map!", Text.BrightRed);
                                return;
                            }

                            int layer = parse[1].ToInt();
                            int set = parse[2].ToInt();
                            int tile = parse[3].ToInt();

                            IMap map = client.Player.Map;
                            foreach (Client mapper in map.GetClients())
                            {
                                // We only want to check the mappers
                                if (Ranks.IsAllowed(mapper, Enums.Rank.Mapper))
                                {
                                    if (mapper != client)
                                    {
                                        // We're on the same map...
                                        if (mapper.Player.InMapEditor)
                                        {
                                            // We have the map editor open...
                                            Messenger.SendLiveMapEditorFillLayerData(mapper, layer, set, tile);
                                        }
                                    }
                                }
                            }
                        }
                        break;
                    case "mapeditorfillattribute":
                        {
                            if (Ranks.IsDisallowed(client, Enums.Rank.Mapper))
                            {
                                if (client.Player.Map.MapType == Enums.MapType.House)
                                {
                                    if (((House)client.Player.Map).OwnerID != client.Player.CharID)
                                    {
                                        return;
                                    }
                                }
                                else
                                {
                                    return;
                                }
                            }

                            if (client.Player.Map.MapType != Enums.MapType.Standard && client.Player.Map.MapType != Enums.MapType.House)
                            {
                                Messenger.PlayerMsg(client, "You can't edit a non-standard map!", Text.BrightRed);
                                return;
                            }

                            int type = parse[1].ToInt();
                            int data1 = parse[2].ToInt();
                            int data2 = parse[3].ToInt();
                            int data3 = parse[4].ToInt();
                            string string1 = parse[5];
                            string string2 = parse[6];
                            string string3 = parse[7];
                            int dungeonValue = parse[8].ToInt();

                            IMap map = client.Player.Map;
                            foreach (Client mapper in map.GetClients())
                            {
                                // We only want to check the mappers
                                if (Ranks.IsAllowed(mapper, Enums.Rank.Mapper))
                                {
                                    if (mapper != client)
                                    {
                                        // We're on the same map...
                                        if (mapper.Player.InMapEditor)
                                        {
                                            // We have the map editor open...
                                            Messenger.SendLiveMapEditorFillAttributeData(mapper, type, data1, data2, data3,
                                                string1, string2, string3, dungeonValue);
                                        }
                                    }
                                }
                            }
                        }
                        break;
                    #endregion
                    #region Items
                    case "requestedititem":
                        if (Ranks.IsDisallowed(client, Enums.Rank.Developer))
                        {
                            Messenger.HackingAttempt(client, "Admin cloning");
                            return;
                        }
                        Messenger.SendItemEditor(client);
                        break;
                    //case "edititem": { ~unneeded due to the info already being clientside
                    //        int n = -1;
                    //        if (Ranks.IsDisallowed(client, Enums.Rank.Developer)) {
                    //            Messenger.HackingAttempt(client, "Admin cloning");
                    //            return;
                    //        }

                    //        n = parse[1].ToInt();

                    //        if (n < 0 || n > Items.ItemManager.Items.MaxItems) {
                    //            Messenger.HackingAttempt(client, "Invalid item client");
                    //            return;
                    //        }

                    // record in log here
                    //        Messenger.SendEditItemTo(client, n);
                    //    }
                    //    break;
                    case "saveitem":
                        {
                            int n = -1;
                            if (Ranks.IsDisallowed(client, Enums.Rank.Developer))
                            {
                                Messenger.HackingAttempt(client, "Admin cloning");
                                return;
                            }

                            n = parse[1].ToInt();

                            if (n < 0 || n >= Items.ItemManager.Items.MaxItems)
                            {
                                Messenger.HackingAttempt(client, "Admin cloning");
                                return;
                            }

                            ItemManager.Items[n].Name = parse[2];
                            ItemManager.Items[n].Desc = parse[3];
                            ItemManager.Items[n].Pic = parse[4].ToInt();
                            ItemManager.Items[n].Type = (Enums.ItemType)parse[5].ToInt();
                            ItemManager.Items[n].Data1 = parse[6].ToInt();
                            ItemManager.Items[n].Data2 = parse[7].ToInt();
                            ItemManager.Items[n].Data3 = parse[8].ToInt();
                            ItemManager.Items[n].Price = parse[9].ToInt();
                            ItemManager.Items[n].StackCap = parse[10].ToInt();
                            ItemManager.Items[n].Bound = parse[11].ToBool();
                            ItemManager.Items[n].Loseable = parse[12].ToBool();
                            ItemManager.Items[n].Rarity = parse[13].ToInt();
                            ItemManager.Items[n].ReqData1 = parse[14].ToInt();
                            ItemManager.Items[n].ReqData2 = parse[15].ToInt();
                            ItemManager.Items[n].ReqData3 = parse[16].ToInt();
                            ItemManager.Items[n].ReqData4 = parse[17].ToInt();
                            ItemManager.Items[n].ReqData5 = parse[18].ToInt();
                            ItemManager.Items[n].ScriptedReq = parse[19].ToInt();

                            ItemManager.Items[n].AddHP = parse[20].ToInt();
                            ItemManager.Items[n].AddPP = parse[21].ToInt();
                            ItemManager.Items[n].AddAttack = parse[22].ToInt();
                            ItemManager.Items[n].AddDefense = parse[23].ToInt();
                            ItemManager.Items[n].AddSpAtk = parse[24].ToInt();
                            ItemManager.Items[n].AddSpDef = parse[25].ToInt();
                            ItemManager.Items[n].AddSpeed = parse[26].ToInt();
                            ItemManager.Items[n].AddEXP = parse[27].ToInt();
                            ItemManager.Items[n].AttackSpeed = parse[28].ToInt();
                            ItemManager.Items[n].RecruitBonus = parse[29].ToInt();

                            Messenger.SendUpdateItemToAll(n);
                            ItemManager.SaveItem(n);
                        }
                        break;
                    #endregion
                    #region Stories
                    case "requesteditstory":
                        if (Ranks.IsDisallowed(client, Enums.Rank.Mapper))
                        {
                            Messenger.HackingAttempt(client, "Admin cloning");
                            return;
                        }

                        Messenger.SendDataTo(client, TcpPacket.CreatePacket("storyeditor"));
                        break;
                    case "savestory":
                        {
                            if (Ranks.IsDisallowed(client, Enums.Rank.Mapper))
                            {
                                Messenger.HackingAttempt(client, "Admin cloning");
                                return;
                            }

                            int n = parse[1].ToInt();

                            if (n < 0 || n > Stories.StoryManager.Stories.MaxStories)
                            {
                                Messenger.HackingAttempt(client, "Invalid story client");
                                return;
                            }
                            Story story = new Story(StoryManager.Stories[n].ID);
                            story.Name = parse[2];
                            story.StoryStart = parse[3].ToInt();
                            story.Revision = StoryManager.Stories[n].Revision + 1;

                            int totalSegments = parse[4].ToInt();
                            int z = 5;
                            for (int i = 0; i < totalSegments; i++)
                            {
                                story.Segments.Add(new StorySegment());
                                int totalParameters = parse[z].ToInt();
                                story.Segments[i].Action = (Enums.StoryAction)parse[z + 1].ToInt();
                                z += 2;
                                for (int a = 0; a < totalParameters; a++)
                                {
                                    story.Segments[i].AddParameter(parse[z], parse[z + 1]);
                                    z += 2;
                                }
                            }
                            int exitContinueCount = parse[z].ToInt();
                            z++;
                            for (int i = 0; i < exitContinueCount; i++)
                            {
                                story.ExitAndContinue.Add(parse[z].ToInt(1));
                                z++;
                            }
                            StoryManager.Stories.Stories[n] = story;
                            Messenger.SendUpdateStoryNameToAll(n);
                            StoryManager.SaveStory(n);
                        }
                        break;
                    case "editstory":
                        {
                            if (Ranks.IsDisallowed(client, Enums.Rank.Mapper))
                            {
                                Messenger.HackingAttempt(client, "Admin cloning");
                                return;
                            }
                            int n = parse[1].ToInt();
                            if (n < 0 || n > Stories.StoryManager.Stories.MaxStories)
                            {
                                Messenger.HackingAttempt(client, "Invalid story client");
                                return;
                            }
                            Messenger.SendEditStoryTo(client, n);
                        }
                        break;
                    case "requeststory":
                        Messenger.SendUpdateStoryTo(client, parse[1].ToInt());
                        break;
                    #endregion
                    #region Evolutions
                    case "requesteditevo":
                        // Prevent hacking
                        if (Ranks.IsDisallowed(client, Enums.Rank.Developer))
                        {
                            Messenger.HackingAttempt(client, "Admin Cloning");
                            return;
                        }

                        Messenger.SendDataTo(client, TcpPacket.CreatePacket("evoeditor"));
                        break;
                    case "editevo":
                        {

                            // Prevent hacking
                            if (Ranks.IsDisallowed(client, Enums.Rank.Developer))
                            {
                                Messenger.HackingAttempt(client, "Admin Cloning");
                                return;
                            }

                            // The evo #
                            int n = parse[1].ToInt(-1);

                            // Prevent hacking
                            if (n < 0 || n > Evolutions.EvolutionManager.Evolutions.MaxEvos)
                            {
                                Messenger.HackingAttempt(client, "Invalid Evolution Index");
                                return;
                            }

                            Messenger.SendEditEvoTo(client, n);
                        }
                        break;
                    case "saveevo":
                        {
                            // Prevent hacking
                            if (Ranks.IsDisallowed(client, Enums.Rank.Developer))
                            {
                                Messenger.HackingAttempt(client, "Admin Cloning");
                                return;
                            }

                            int n = parse[1].ToInt(-1);

                            // Prevent hacking
                            if (n < 0 | n > Evolutions.EvolutionManager.Evolutions.MaxEvos)
                            {
                                Messenger.HackingAttempt(client, "Invalid Evolution Index");
                                return;
                            }
                            Evolution evo = new Evolution();

                            evo.Name = parse[2];
                            evo.Species = parse[3].ToInt();
                            int z = 5;
                            for (int i = 0; i < parse[4].ToInt(); i++)
                            {
                                evo.Branches.Add(new EvolutionBranch());
                                evo.Branches[i].Name = parse[z];
                                evo.Branches[i].NewSpecies = parse[z + 1].ToInt();
                                evo.Branches[i].ReqScript = parse[z + 2].ToInt();
                                evo.Branches[i].Data1 = parse[z + 3].ToInt();
                                evo.Branches[i].Data2 = parse[z + 4].ToInt();
                                evo.Branches[i].Data3 = parse[z + 5].ToInt();
                                z += 6;
                            }
                            EvolutionManager.Evolutions[n] = evo;

                            Messenger.SendUpdateEvoToAll(n);
                            Evolutions.EvolutionManager.SaveEvo(n);
                        }
                        break;
                    #endregion
                    #region NPCs
                    case "requesteditnpc":

                        // Prevent hacking
                        if (Ranks.IsDisallowed(client, Enums.Rank.Developer))
                        {
                            Messenger.HackingAttempt(client, "Admin Cloning");
                            return;
                        }

                        Messenger.SendDataTo(client, TcpPacket.CreatePacket("NPCEDITOR"));
                        break;
                    // :::::::::::::::::::::
                    // :: Edit npc packet ::
                    // :::::::::::::::::::::
                    case "editnpc":
                        {

                            // Prevent hacking
                            if (Ranks.IsDisallowed(client, Enums.Rank.Developer))
                            {
                                Messenger.HackingAttempt(client, "Admin Cloning");
                                return;
                            }

                            // The npc #
                            int n = parse[1].ToInt(-1);

                            // Prevent hacking
                            if (n < 0 | n > Npcs.NpcManager.Npcs.MaxNpcs)
                            {
                                Messenger.HackingAttempt(client, "Invalid NPC Index");
                                return;
                            }

                            Messenger.SendNpcAiTypes(client);
                            Messenger.SendEditNpcTo(client, n);
                        }
                        break;
                    case "addnewnpc":
                        {
                            if (Ranks.IsDisallowed(client, Enums.Rank.Developer))
                            {
                                Messenger.HackingAttempt(client, "Admin cloning");
                                return;
                            }
                            Messenger.SendAddNpcToAll(NpcManager.AddNpc());
                        }
                        break;
                    // :::::::::::::::::::::
                    // :: Save npc packet ::
                    // :::::::::::::::::::::
                    case "savenpc":
                        {
                            // Prevent hacking
                            if (Ranks.IsDisallowed(client, Enums.Rank.Developer))
                            {
                                Messenger.HackingAttempt(client, "Admin Cloning");
                                return;
                            }

                            int n = parse[1].ToInt(-1);

                            // Prevent hacking
                            if (n < 0 | n > Npcs.NpcManager.Npcs.MaxNpcs)
                            {
                                Messenger.HackingAttempt(client, "Invalid NPC Index");
                                return;
                            }

                            Npc npc = new Npc();

                            // Update the npc
                            npc.Name = parse[2];
                            npc.AttackSay = parse[3];
                            npc.Form = parse[4].ToInt();
                            npc.Species = parse[5].ToInt();
                            npc.ShinyChance = parse[6].ToInt();
                            npc.Behavior = (Enums.NpcBehavior)parse[7].ToInt();
                            npc.RecruitRate = parse[8].ToInt();
                            npc.AIScript = parse[9];
                            npc.SpawnsAtDawn = parse[10].ToBool();
                            npc.SpawnsAtDay = parse[11].ToBool();
                            npc.SpawnsAtDusk = parse[12].ToBool();
                            npc.SpawnsAtNight = parse[13].ToBool();

                            int z = 14;
                            // Load npc moves
                            for (int i = 0; i < npc.Moves.Length; i++)
                            {
                                npc.Moves[i] = parse[z].ToInt();

                                z += 1;
                            }
                            // Load npc drops
                            for (int i = 0; i < npc.Drops.Length; i++)
                            {
                                npc.Drops[i] = new NpcDrop();
                                npc.Drops[i].ItemNum = parse[z].ToInt();
                                npc.Drops[i].ItemValue = parse[z + 1].ToInt();
                                npc.Drops[i].Chance = parse[z + 2].ToInt();
                                npc.Drops[i].Tag = parse[z + 3];

                                z += 4;
                            }
                            NpcManager.Npcs[n] = npc;
                            // Save it
                            Messenger.SendUpdateNpcToAll(n);
                            NpcManager.SaveNpc(n);
                        }
                        break;
                    #endregion
                    #region Shops
                    case "requesteditshop":
                        // Prevent hacking
                        if (Ranks.IsDisallowed(client, Enums.Rank.Developer))
                        {
                            Messenger.HackingAttempt(client, "Admin Cloning");
                            return;
                        }

                        Messenger.SendDataTo(client, TcpPacket.CreatePacket("shopeditor"));
                        break;
                    // ::::::::::::::::::::::
                    // :: Edit shop packet ::
                    // ::::::::::::::::::::::
                    case "editshop":
                        {
                            // Prevent hacking
                            if (Ranks.IsDisallowed(client, Enums.Rank.Developer))
                            {
                                Messenger.HackingAttempt(client, "Admin Cloning");
                                return;
                            }

                            // The shop #
                            int n = parse[1].ToInt(-1);
                            // Prevent hacking
                            if (n < 0 || n > Shops.ShopManager.Shops.MaxShops)
                            {
                                Messenger.HackingAttempt(client, "Invalid Shop Index");
                                return;
                            }

                            Messenger.SendEditShopTo(client, n);
                        }
                        break;
                    // ::::::::::::::::::::::
                    // :: Save shop packet ::
                    // ::::::::::::::::::::::
                    case "saveshop":
                        {
                            // Prevent hacking
                            if (Ranks.IsDisallowed(client, Enums.Rank.Developer))
                            {
                                Messenger.HackingAttempt(client, "Admin Cloning");
                                return;
                            }

                            int ShopNum = parse[1].ToInt(-1);
                            // Prevent hacking
                            if (ShopNum < 0 || ShopNum > Shops.ShopManager.Shops.MaxShops)
                            {
                                Messenger.HackingAttempt(client, "Invalid Shop Index");
                                return;
                            }

                            Shop shop = new Shop();

                            // Update the shop
                            shop.Name = parse[2];
                            shop.JoinSay = parse[3];
                            shop.LeaveSay = parse[4];
                            //shop.FixesItems = parse[5].ToBool(); ;
                            int n = 5;

                            for (int i = 0; i < Constants.MAX_TRADES; i++)
                            {
                                shop.Items[i].GiveItem = parse[n].ToInt();
                                shop.Items[i].GiveValue = parse[n + 1].ToInt();
                                shop.Items[i].GetItem = parse[n + 2].ToInt();
                                //shop.Sections[z].Items[i].GetValue = parse[n + 3].ToInt();
                                n = n + 3;
                            }

                            ShopManager.Shops[ShopNum] = shop;
                            // Save it
                            Messenger.SendUpdateShopToAll(ShopNum);
                            ShopManager.SaveShop(ShopNum);
                        }
                        break;
                    #endregion
                    #region Moves
                    case "requesteditmove":
                        // Prevent hacking
                        if (Ranks.IsDisallowed(client, Enums.Rank.Developer))
                        {
                            Messenger.HackingAttempt(client, "Admin Cloning");
                            return;
                        }

                        Messenger.SendDataTo(client, TcpPacket.CreatePacket("moveeditor"));
                        break;
                    // :::::::::::::::::::::::
                    // :: Edit move packet ::
                    // :::::::::::::::::::::::
                    case "editmove":
                        {
                            // Prevent hacking
                            if (Ranks.IsDisallowed(client, Enums.Rank.Developer))
                            {
                                Messenger.HackingAttempt(client, "Admin Cloning");
                                return;
                            }

                            // The spell #
                            int n = parse[1].ToInt(-1);

                            // Prevent hacking
                            if (n < 0 | n > Moves.MoveManager.Moves.MaxMoves)
                            {
                                Messenger.HackingAttempt(client, "Invalid Move Index");
                                return;
                            }

                            Messenger.SendEditMoveTo(client, n);
                        }
                        break;
                    // :::::::::::::::::::::::
                    // :: Save move packet ::
                    // :::::::::::::::::::::::
                    case "savemove":
                        { //
                            // Prevent hacking
                            if (Ranks.IsDisallowed(client, Enums.Rank.Developer))
                            {
                                Messenger.HackingAttempt(client, "Admin Cloning");
                                return;
                            }

                            // Move #
                            int n = parse[1].ToInt(-1);

                            // Prevent hacking
                            if (n < 0 | n > Moves.MoveManager.Moves.MaxMoves)
                            {
                                Messenger.HackingAttempt(client, "Invalid Move Index");
                                return;
                            }

                            Move move = new Move();

                            // Update the spell
                            move.Name = parse[2];
                            move.MaxPP = parse[3].ToInt();
                            move.EffectType = (Enums.MoveType)parse[4].ToInt();
                            move.Element = (Enums.PokemonType)parse[5].ToInt();
                            move.MoveCategory = (Enums.MoveCategory)parse[6].ToInt();
                            move.TargetType = (Enums.MoveTarget)parse[7].ToInt();
                            move.RangeType = (Enums.MoveRange)parse[8].ToInt();
                            move.Range = parse[9].ToInt();

                            move.Data1 = parse[10].ToInt();
                            move.Data2 = parse[11].ToInt();
                            move.Data3 = parse[12].ToInt();

                            move.Accuracy = parse[13].ToInt();

                            move.HitTime = parse[14].ToInt();
                            move.HitFreeze = parse[15].ToBool();

                            move.AdditionalEffectData1 = parse[16].ToInt();
                            move.AdditionalEffectData2 = parse[17].ToInt();
                            move.AdditionalEffectData3 = parse[18].ToInt();
                            move.PerPlayer = parse[19].ToBool();
                            move.KeyItem = parse[20].ToInt();

                            move.Sound = parse[21].ToInt();

                            move.AttackerAnim.AnimationType = (Enums.MoveAnimationType)parse[22].ToInt();
                            move.AttackerAnim.AnimationIndex = parse[23].ToInt();
                            move.AttackerAnim.FrameSpeed = parse[24].ToInt();
                            move.AttackerAnim.Repetitions = parse[25].ToInt();

                            move.TravelingAnim.AnimationType = (Enums.MoveAnimationType)parse[26].ToInt();
                            move.TravelingAnim.AnimationIndex = parse[27].ToInt();
                            move.TravelingAnim.FrameSpeed = parse[28].ToInt();
                            move.TravelingAnim.Repetitions = parse[29].ToInt();

                            move.DefenderAnim.AnimationType = (Enums.MoveAnimationType)parse[30].ToInt();
                            move.DefenderAnim.AnimationIndex = parse[31].ToInt();
                            move.DefenderAnim.FrameSpeed = parse[32].ToInt();
                            move.DefenderAnim.Repetitions = parse[33].ToInt();

                            MoveManager.Moves[n] = move;

                            // Save it
                            Messenger.SendUpdateMoveToAll(n);
                            MoveManager.SaveMove(n);
                        }
                        break;
                    #endregion
                    #region Arrows
                    case "requesteditarrow":
                        // Prevent hacking
                        if (Ranks.IsDisallowed(client, Enums.Rank.Developer))
                        {
                            Messenger.HackingAttempt(client, "Admin Cloning");
                            return;
                        }
                        Messenger.SendArrowEditor(client);
                        break;
                    case "editarrow":
                        {
                            // Prevent hacking
                            //if (Ranks.IsDisallowed(client, Enums.Rank.Developer)) {
                            //    Messenger.HackingAttempt(client, "Admin Cloning");
                            //    return;
                            //}
                            //int n = parse[1].ToInt(-1);
                            //if (n < 0 | n > Constants.MAX_ARROWS) {
                            //    Messenger.HackingAttempt(client, "Invalid arrow Index");
                            //    return;
                            //}
                            //Messenger.SendEditArrowTo(client, n);
                        }
                        break;
                    case "savearrow":
                        {
                            // Prevent hacking
                            //if (Ranks.IsDisallowed(client, Enums.Rank.Developer)) {
                            //    Messenger.HackingAttempt(client, "Admin Cloning");
                            //    return;
                            //}
                            //int n = parse[1].ToInt(-1);
                            //if (n < 0 | n > Constants.MAX_ARROWS) {
                            //    Messenger.HackingAttempt(client, "Invalid arrow Index");
                            //    return;
                            //}
                            //ArrowManagerBase.Arrows[n].Name = parse[2];
                            //ArrowManagerBase.Arrows[n].Pic = parse[3].ToInt();
                            //ArrowManagerBase.Arrows[n].Range = parse[4].ToInt();
                            //ArrowManagerBase.Arrows[n].Amount = parse[5].ToInt();
                            //Messenger.SendUpdateArrowToAll(n);
                            //ArrowManagerBase.SaveArrows();
                        }
                        break;
                    #endregion
                    #region Scripts
                    case "requesteditscript":
                        {
                            if (Ranks.IsDisallowed(client, Enums.Rank.Scripter))
                            {
                                Messenger.HackingAttempt(client, "Admin cloning");
                                Messenger.AdminMsg("All Admins: " + client.Player.Name + " has attempted to access the script editor", Text.BrightRed);
                            }
                            else
                            {
                                Scripting.Editor.EditorHelper.InitTempScript(client);
                                if (parse[1].ToBool() == false)
                                {
                                    Messenger.SendDataTo(client, TcpPacket.CreatePacket("scriptsyntax", System.IO.File.ReadAllText(IO.Paths.ScriptsFolder + "CSharp.syn")));
                                }
                                Messenger.SendDataTo(client, TcpPacket.CreatePacket("scripteditstart"));
                                Messenger.SendDataTo(client, TcpPacket.CreatePacket("scripteditdata", "Main.cs", System.IO.File.ReadAllText(IO.Paths.ScriptsFolder + "Main.cs").Replace(TcpPacket.SEP_CHAR, '/')));
                                Scripting.Editor.EditorHelper.SendScriptClasses(client);
                                TcpPacket filelistPacket = new TcpPacket("scriptfilelist");
                                Scripting.Editor.EditorHelper.AppendFileListToPacket(client, filelistPacket);
                                filelistPacket.FinalizePacket();
                                Messenger.SendDataTo(client, filelistPacket);
                                client.Player.InScriptEditor = true;
                            }
                        }
                        break;
                    case "savescript":
                        if (Ranks.IsDisallowed(client, Enums.Rank.Scripter))
                        {
                            Messenger.HackingAttempt(client, "Admin Cloning");
                            return;
                        }
                        else
                        {
                            System.IO.File.WriteAllText(Scripting.Editor.EditorHelper.GetTempFolder(client) + parse[1] + ".cs", parse[2]);
                            Messenger.PlayerMsg(client, "File Saved! (Temp)", Text.Yellow);
                        }
                        break;
                    case "finalizescript":
                        if (Ranks.IsDisallowed(client, Enums.Rank.Scripter))
                        {
                            Messenger.HackingAttempt(client, "Admin Cloning");
                            return;
                        }
                        else
                        {
                            bool testVal = Scripting.ScriptManager.TestCompile(Scripting.Editor.EditorHelper.GetTempFolder(client));
                            if (testVal)
                            {
                                Scripting.Editor.EditorHelper.SaveScript(client);
                                Messenger.PlayerMsg(client, "Script Compiled and Saved!", Text.Yellow);
                                Scripting.Editor.EditorHelper.SendScriptErrors(client);
                            }
                            else
                            {
                                Messenger.PlayerMsg(client, "Error during script compilation... Script was not saved.", Text.Yellow);
                                Scripting.Editor.EditorHelper.SendScriptErrors(client);
                            }
                        }
                        break;
                    case "savetemp":
                        if (Ranks.IsDisallowed(client, Enums.Rank.Scripter))
                        {
                            Messenger.HackingAttempt(client, "Admin Cloning.");
                            return;
                        }
                        else
                        {
                            Scripting.Editor.EditorHelper.SaveTempScript(client, parse[1], parse[2]);
                        }
                        break;
                    case "compilescript":
                        if (Ranks.IsDisallowed(client, Enums.Rank.Scripter))
                        {
                            Messenger.HackingAttempt(client, "Admin Cloning.");
                            return;
                        }
                        else
                        {
                            bool testVal = Scripting.ScriptManager.TestCompile(Scripting.Editor.EditorHelper.GetTempFolder(client));
                            if (testVal)
                            {
                                Scripting.Editor.EditorHelper.SaveScript(client);
                                Messenger.PlayerMsg(client, "Script Compiled and Saved!", Text.Yellow);
                                Scripting.Editor.EditorHelper.SendScriptErrors(client);
                            }
                            else
                            {
                                Messenger.PlayerMsg(client, "Error during script compilation... Script was not saved.", Text.Yellow);
                                Scripting.Editor.EditorHelper.SendScriptErrors(client);
                            }
                        }
                        break;
                    case "scripteditexit":
                        if (Ranks.IsDisallowed(client, Enums.Rank.Scripter))
                        {
                            return;
                        }
                        else
                        {
                            client.Player.InScriptEditor = false;
                            if (System.IO.Directory.Exists(Scripting.Editor.EditorHelper.GetTempFolder(client)))
                            {
                                System.IO.Directory.Delete(Scripting.Editor.EditorHelper.GetTempFolder(client), true);
                            }
                        }
                        break;
                    case "getscriptclasses":
                        if (Ranks.IsDisallowed(client, Enums.Rank.Scripter))
                        {
                            Messenger.HackingAttempt(client, "Admin Cloning");
                            return;
                        }
                        else
                        {
                            Scripting.Editor.EditorHelper.SendScriptClasses(client);
                        }
                        break;
                    case "getscriptmethods":
                        if (Ranks.IsDisallowed(client, Enums.Rank.Scripter))
                        {
                            Messenger.HackingAttempt(client, "Admin Cloning");
                            return;
                        }
                        else
                        {
                            Scripting.Editor.EditorHelper.SendScriptMethods(client, parse[1]);
                        }
                        break;
                    case "getscriptparam":
                        if (Ranks.IsDisallowed(client, Enums.Rank.Scripter))
                        {
                            Messenger.HackingAttempt(client, "Admin Cloning");
                            return;
                        }
                        else
                        {
                            Scripting.Editor.EditorHelper.SendScriptParameters(client, parse[1], parse[2], parse[3].ToInt(1));
                        }
                        break;
                    case "requestscriptsyntax":
                        if (Ranks.IsDisallowed(client, Enums.Rank.Scripter))
                        {
                            Messenger.HackingAttempt(client, "Admin Cloning");
                            return;
                        }
                        else
                        {
                            Messenger.SendDataTo(client, TcpPacket.CreatePacket("scriptsyntax", System.IO.File.ReadAllText(IO.Paths.ScriptsFolder + "CSharp.syn")));
                        }
                        break;
                    case "requesteditscriptfile":
                        if (Ranks.IsDisallowed(client, Enums.Rank.Scripter))
                        {
                            Messenger.HackingAttempt(client, "Admin Cloning");
                            return;
                        }
                        else
                        {
                            Messenger.SendDataTo(client, TcpPacket.CreatePacket("scriptfiledata", parse[1], Scripting.Editor.EditorHelper.GetScriptFile(client, parse[1])));
                        }
                        break;
                    case "requestfilelist":
                        if (Ranks.IsDisallowed(client, Enums.Rank.Scripter))
                        {
                            Messenger.HackingAttempt(client, "Admin Cloning");
                            return;
                        }
                        else
                        {
                            TcpPacket filelistPacket = new TcpPacket("scriptfilelist");
                            Scripting.Editor.EditorHelper.AppendFileListToPacket(client, filelistPacket);
                            filelistPacket.FinalizePacket();
                            Messenger.SendDataTo(client, filelistPacket);
                        }
                        break;
                    case "addnewclass":
                        if (Ranks.IsDisallowed(client, Enums.Rank.Scripter))
                        {
                            Messenger.HackingAttempt(client, "Admin Cloning");
                            return;
                        }
                        else
                        {
                            Scripting.Editor.EditorHelper.AddNewClass(client, parse[1]);
                            TcpPacket filelistPacket = new TcpPacket("scriptfilelist");
                            Scripting.Editor.EditorHelper.AppendFileListToPacket(client, filelistPacket);
                            filelistPacket.FinalizePacket();
                            Messenger.SendDataTo(client, filelistPacket);
                        }
                        break;

                    #endregion
                    #region Dungeons
                    case "requesteditdungeon":
                        {
                            if (Ranks.IsDisallowed(client, Enums.Rank.Mapper))
                            {
                                Messenger.HackingAttempt(client, "Admin cloning");
                                return;
                            }

                            Messenger.SendDataTo(client, TcpPacket.CreatePacket("dungeoneditor"));
                        }
                        break;
                    case "addnewdungeon":
                        {
                            if (Ranks.IsDisallowed(client, Enums.Rank.Mapper))
                            {
                                Messenger.HackingAttempt(client, "Admin cloning");
                                return;
                            }

                            DungeonManager.AddDungeon();
                            Messenger.SendAddDungeonToAll(DungeonManager.Dungeons.Count - 1);
                        }
                        break;
                    case "savedungeon":
                        {
                            if (Ranks.IsDisallowed(client, Enums.Rank.Mapper))
                            {
                                Messenger.HackingAttempt(client, "Admin cloning");
                                return;
                            }
                            int n = parse[1].ToInt();

                            if (n < 0 || n > DungeonManager.Dungeons.Count)
                            {
                                return;
                            }

                            Dungeons.Dungeon dungeon = new Dungeon();

                            dungeon.Name = parse[2];
                            dungeon.AllowsRescue = parse[3].ToBool();

                            int scriptCount = parse[4].ToInt();

                            int z = 5;

                            for (int i = 0; i < scriptCount; i++)
                            {
                                dungeon.ScriptList.Add(parse[z].ToInt(), parse[z + 1]);
                                z += 2;
                            }

                            int standardMapCount = parse[z].ToInt();
                            z++;

                            for (int i = 0; i < standardMapCount; i++)
                            {
                                StandardDungeonMap map = new StandardDungeonMap();
                                map.Difficulty = (Enums.JobDifficulty)parse[z].ToInt();
                                map.IsBadGoalMap = parse[z + 1].ToBool();
                                map.MapNum = parse[z + 2].ToInt();
                                z += 3;
                                dungeon.StandardMaps.Add(map);
                            }

                            int randomMapCount = parse[z].ToInt();
                            z++;
                            for (int i = 0; i < randomMapCount; i++)
                            {
                                RandomDungeonMap map = new RandomDungeonMap();
                                map.Difficulty = (Enums.JobDifficulty)parse[z].ToInt();
                                map.IsBadGoalMap = parse[z + 1].ToBool();
                                map.RDungeonIndex = parse[z + 2].ToInt();
                                map.RDungeonFloor = parse[z + 3].ToInt();
                                z += 4;
                                dungeon.RandomMaps.Add(map);
                            }

                            DungeonManager.Dungeons[n] = dungeon;
                            DungeonManager.SaveDungeon(n);
                            Messenger.SendUpdateDungeonToAll(n);
                        }
                        break;
                    case "editdungeon":
                        {
                            if (Ranks.IsDisallowed(client, Enums.Rank.Mapper))
                            {
                                Messenger.HackingAttempt(client, "Admin cloning");
                                return;
                            }

                            int n = parse[1].ToInt();

                            if (n < 0 || n > DungeonManager.Dungeons.Count)
                            {
                                Messenger.HackingAttempt(client, "Invalid dungeon client");
                                return;
                            }

                            Messenger.SendEditDungeonTo(client, n);
                        }
                        break;
                    #endregion
                    #region Missions
                    case "requesteditmission":
                        {
                            if (Ranks.IsDisallowed(client, Enums.Rank.Developer))
                            {
                                Messenger.HackingAttempt(client, "Admin cloning");
                                return;
                            }

                            Messenger.SendDataTo(client, TcpPacket.CreatePacket("missioneditor"));
                        }
                        break;
                    case "savemission":
                        {
                            WonderMails.MissionPool missionPool = new WonderMails.MissionPool();

                            int difficulty = parse[1].ToInt() - 1;

                            int clientCount = parse[2].ToInt();
                            int n = 3;
                            for (int i = 0; i < clientCount; i++)
                            {
                                WonderMails.MissionClientData missionClient = new WonderMails.MissionClientData();
                                missionClient.Species = parse[n].ToInt();
                                missionClient.Form = parse[n + 1].ToInt();
                                missionPool.MissionClients.Add(missionClient);

                                n += 2;

                            }

                            int enemyCount = parse[n].ToInt();
                            n++;

                            for (int i = 0; i < enemyCount; i++)
                            {
                                WonderMails.MissionEnemyData missionEnemy = new WonderMails.MissionEnemyData();
                                missionEnemy.NpcNum = parse[n].ToInt();
                                missionPool.Enemies.Add(missionEnemy);

                                n++;
                            }

                            int rewardCount = parse[n].ToInt();
                            n++;

                            for (int i = 0; i < rewardCount; i++)
                            {

                                WonderMails.MissionRewardData missionReward = new WonderMails.MissionRewardData(); ;
                                missionReward.ItemNum = parse[n].ToInt();
                                missionReward.Amount = parse[n + 1].ToInt();
                                missionReward.Tag = parse[n + 2];
                                missionPool.Rewards.Add(missionReward);

                                n += 3;

                            }

                            WonderMails.WonderMailManager.Missions[difficulty] = missionPool;
                            using (DatabaseConnection dbConnection = new DatabaseConnection(DatabaseID.Data))
                            {
                                WonderMails.WonderMailManager.SaveMissionPool(dbConnection, difficulty);
                            }
                        }
                        break;
                    case "editmission":
                        {
                            if (Ranks.IsDisallowed(client, Enums.Rank.Developer))
                            {
                                Messenger.HackingAttempt(client, "Admin cloning");
                                return;
                            }

                            int n = parse[1].ToInt();

                            if (n < 0 || n > 16)
                            {
                                Messenger.HackingAttempt(client, "Invalid mission client");
                                return;
                            }

                            Messenger.SendEditMissionTo(client, n - 1);
                        }
                        break;
                    #endregion

                    #endregion
                    #region Online List
                    case "whosonline":
                        Messenger.SendWhosOnline(client);
                        break;
                    case "onlinelist":
                        Messenger.SendOnlineList(client);
                        break;
                    case "playerinforequest":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Moniter))
                            {
                                string name = parse[1];
                                Client i = ClientManager.FindClient(name);
                                if (i != null)
                                {
                                    Messenger.PlayerMsg(client, "Account: " + i.Player.AccountName.Trim() + ", " + i.Player.Name.Trim(), Text.BrightGreen);
                                    Messenger.PlayerMsg(client, "-=- Stats for " + i.Player.Name + " -=-", Text.BrightGreen);
                                    Messenger.PlayerMsg(client, "Level: " + i.Player.GetActiveRecruit().Level.ToString() + " Exp: " + i.Player.GetActiveRecruit().Exp.ToString() + "/" + i.Player.GetActiveRecruit().GetNextLevel().ToString(), Text.BrightGreen);
                                    Messenger.PlayerMsg(client, "HP: " + i.Player.GetActiveRecruit().HP.ToString() + "/" + i.Player.GetMaxHP().ToString(), Text.BrightGreen);
                                    Messenger.PlayerMsg(client, "Atk: " + i.Player.GetActiveRecruit().Atk.ToString() + "  Def: " + i.Player.GetActiveRecruit().Def.ToString() + "  Sp.Atk: " + i.Player.GetActiveRecruit().SpclAtk.ToString() + "  Sp.Def: " + i.Player.GetActiveRecruit().SpclDef.ToString() + "  Speed: " + i.Player.GetActiveRecruit().Spd.ToString(), Text.BrightGreen);
                                    Messenger.PlayerMsg(client, "Species: " + i.Player.GetActiveRecruit().Species.ToString() + " [" + Pokedex.Pokedex.GetPokemon(i.Player.GetActiveRecruit().Species).Name + "]    Sprite: " + i.Player.GetActiveRecruit().Sprite.ToString(), Text.BrightGreen);
                                }
                                else
                                {
                                    Messenger.PlayerMsg(client, "Player is offline.", Text.Grey);
                                }
                            }
                        }
                        break;
                    case "getstats":
                        {
                            Messenger.PlayerMsg(client, "-=- Stats for " + client.Player.Name + " -=-", Text.BrightGreen);
                            Messenger.PlayerMsg(client, "Level: " + client.Player.GetActiveRecruit().Level.ToString() + " Exp: " + client.Player.GetActiveRecruit().Exp.ToString() + "/" + client.Player.GetActiveRecruit().GetNextLevel().ToString(), Text.BrightGreen);
                            Messenger.PlayerMsg(client, "HP: " + client.Player.GetActiveRecruit().HP.ToString() + "/" + client.Player.GetMaxHP().ToString(), Text.BrightGreen);
                            Messenger.PlayerMsg(client, "Atk: " + client.Player.GetActiveRecruit().Atk.ToString() + "  Def: " + client.Player.GetActiveRecruit().Def.ToString() + "  Sp.Str: " + client.Player.GetActiveRecruit().SpclAtk.ToString() + "  Sp.Def: " + client.Player.GetActiveRecruit().SpclDef.ToString() + "  Speed: " + client.Player.GetActiveRecruit().Spd.ToString(), Text.BrightGreen);
                            Messenger.PlayerMsg(client, "Species: " + Pokedex.Pokedex.GetPokemon(client.Player.GetActiveRecruit().Species).Name, Text.BrightGreen);
                        }
                        break;
                    #endregion
                    #region Admin Commands
                    case "setaccess":
                        {
                            // Prevent hacking
                            if (Ranks.IsDisallowed(client, Enums.Rank.Admin))
                            {
                                Messenger.HackingAttempt(client, "Admin Cloning");
                                return;
                            }

                            // The client
                            Client n = ClientManager.FindClient(parse[1]);
                            // The access
                            int i = parse[2].ToInt(-1);

                            // Check for invalid access level
                            if (i >= 0 || i <= 3)
                            {
                                if (client.Player.Name != n.Player.Name)
                                {
                                    // Check if player is on
                                    if (n != null)
                                    {
                                        if (Ranks.IsAllowed(client, (Enums.Rank)i))
                                        {
                                            if (Ranks.IsDisallowed(n, Enums.Rank.Moniter))
                                            {
                                                Messenger.GlobalMsg(n.Player.Name + " has been blessed with administrative access.", Text.BrightBlue);
                                            }

                                            n.Player.Access = (Enums.Rank)i;
                                            Messenger.SendPlayerData(n);

                                            if (Ranks.IsAllowed(n, Enums.Rank.Mapper))
                                            {
                                                n.Player.AddExpKitModule(new AvailableExpKitModule(Enums.ExpKitModules.MapReport, true));
                                            }
                                            else
                                            {
                                                if (n.Player.AvailableExpKitModules.Contains(Enums.ExpKitModules.MapReport))
                                                {
                                                    n.Player.RemoveExpKitModule(Enums.ExpKitModules.MapReport);
                                                }
                                            }
                                        }
                                        else
                                        {
                                            Messenger.PlayerMsg(client, "You cannot set someone's access higher than yours!", Text.BrightRed);
                                        }
                                    }
                                    else
                                    {
                                        Messenger.PlayerMsg(client, "Player is not online.", Text.White);
                                    }
                                }
                                else
                                {
                                    Messenger.PlayerMsg(client, "You cant change your access.", Text.Red);
                                }
                            }
                            else
                            {
                                Messenger.PlayerMsg(client, "Invalid access level.", Text.Red);
                            }

                        }
                        break;
                    case "setmotd":
                        {
                            // Prevent hacking
                            if (Ranks.IsDisallowed(client, Enums.Rank.Mapper))
                            {
                                Messenger.HackingAttempt(client, "Admin Cloning");
                                return;
                            }

                            Settings.MOTD = parse[1];
                            Messenger.GlobalMsg("MOTD changed to: " + parse[1], Text.BrightCyan);
                            Settings.SaveMOTD();
                        }
                        break;
                    case "restartserver":
                        {
                            // Prevent hacking
                            if (Ranks.IsDisallowed(client, Enums.Rank.ServerHost))
                            {
                                Messenger.HackingAttempt(client, "Admin Cloning");
                                return;
                            }

                            using (DatabaseConnection dbConnection = new DatabaseConnection(DatabaseID.Players))
                            {
                                foreach (Client i in ClientManager.GetClients())
                                {
                                    if (i.IsPlaying())
                                    {
                                        i.Player.SaveCharacterData(dbConnection);
                                    }
                                }
                            }
                            PlayerManager.SavingEnabled = false;

                            System.Windows.Forms.Application.Restart();
                            System.Environment.Exit(0);
                        }
                        break;
                    case "setsprite":
                        {
                            if (Ranks.IsDisallowed(client, Enums.Rank.Mapper))
                            {
                                Messenger.HackingAttempt(client, "Admin cloning");
                                return;
                            }
                            else
                            {
                                int n = parse[1].ToInt(-1);
                                if (n > -1)
                                {
                                    client.Player.GetActiveRecruit().SetSpecies(n);
                                    Messenger.SendPlayerData(client);
                                    Messenger.SendActiveTeam(client);
                                    Messenger.SendStats(client);
                                }
                            }
                        }
                        break;
                    case "setplayersprite":
                        {
                            if (Ranks.IsDisallowed(client, Enums.Rank.Admin))
                            {
                                Messenger.HackingAttempt(client, "Admin cloning");
                                return;
                            }
                            else
                            {
                                int n = parse[2].ToInt(-1);
                                Client player = ClientManager.FindClient(parse[1]);
                                if (n > -1 && player != null)
                                {
                                    player.Player.GetActiveRecruit().SetSpecies(n);
                                    Messenger.SendPlayerData(player);
                                    Messenger.SendActiveTeam(player);
                                    Messenger.SendStats(player);
                                }
                            }
                        }
                        break;
                    case "maprespawn":
                        {
                            if (Ranks.IsDisallowed(client, Enums.Rank.Mapper))
                            {
                                Messenger.HackingAttempt(client, "Admin cloning");
                                return;
                            }
                            else
                            {
                                IMap map = client.Player.GetCurrentMap();
                                for (int i = 0; i < Constants.MAX_MAP_ITEMS; i++)
                                {
                                    map.SpawnItemSlot(i, -1, 0, false, false, "", map.ActiveItem[i].X, map.ActiveItem[i].Y, null);
                                    map.ClearActiveItem(i);
                                }
                                map.SpawnItems();

                                // Respawn NPCs
                                for (int i = 0; i < Constants.MAX_MAP_NPCS; i++)
                                {
                                    map.ClearActiveNpc(i);
                                }
                                map.SpawnNpcs();
                                Messenger.PlayerMsg(client, "Map respawned.", Text.Blue);
                            }
                        }
                        break;
                    case "kickplayer":
                        {
                            if (Ranks.IsDisallowed(client, Enums.Rank.Moniter))
                            {
                                Messenger.HackingAttempt(client, "Admin cloning");
                                return;
                            }
                            else
                            {
                                Client n = ClientManager.FindClient(parse[1]);
                                if (n == client)
                                {
                                    Messenger.PlayerMsg(client, "You can't kick yourself!", Text.BrightRed);
                                }
                                else if (n == null)
                                {
                                    Messenger.PlayerMsg(client, "Player is offline.", Text.Grey);
                                }
                                else if (Ranks.IsAllowed(n, client.Player.Access))
                                {
                                    Messenger.PlayerMsg(client, "That is a higher access admin than you!", Text.BrightRed);
                                }
                                else
                                {
                                    //Messenger.GlobalMsg(n.Player.Name + " has been kicked from " + Settings.GameName + " by " + client.Player.Name + "!", Text.White);
                                    //Messenger.AlertMsg(n, "You have been kicked by " + client.Player.Name + "!");
                                    Messenger.PlayerMsg(client, n.Player.Name + " has been kicked from the server!", Text.BrightGreen);
                                    Messenger.PlainMsg(n, "You have been kicked from the server!", Enums.PlainMsgType.MainMenu);
                                    n.CloseConnection();
                                }
                            }
                        }
                        break;
                    case "banplayer":
                        {
                            if (Ranks.IsDisallowed(client, Enums.Rank.Mapper))
                            {
                                Messenger.HackingAttempt(client, "Admin cloning");
                                return;
                            }
                            else
                            {
                                Client n = ClientManager.FindClient(parse[1]);
                                if (n == client)
                                {
                                    Messenger.PlayerMsg(client, "You can't kick yourself!", Text.BrightRed);
                                }
                                else if (n == null)
                                {
                                    Messenger.PlayerMsg(client, "Player is offline.", Text.Grey);
                                }
                                else if (Ranks.IsAllowed(n, client.Player.Access))
                                {
                                    Messenger.PlayerMsg(client, "That is a higher access admin than you!", Text.BrightRed);
                                }
                                else
                                {
                                    //  Add banning to scripts
                                    //Messenger.GlobalMsg(n.Player.Name + " has been banned from " + Settings.GameName + " by " + client.Player.Name + "!", Text.White);
                                    //PlayerManager.AddToBanList(((System.Net.IPEndPoint)n.TcpClient.Socket.RemoteEndPoint).Address.ToString(), client.Player.Name, n.Player.Name);
                                    //Messenger.AlertMsg(n, "You have been kicked by " + client.Player.Name + "!");
                                }
                            }
                        }
                        break;
                    case "banlist":
                        {
                            if (Ranks.IsDisallowed(client, Enums.Rank.Moniter))
                            {
                                Messenger.HackingAttempt(client, "Admin cloning");
                                return;
                            }
                            else
                            {
                                // TODO: Display ban list
                                //if (PlayerManager.Bans.Count > 0) {
                                //    string list = "";
                                //    for (int i = 0; i < PlayerManager.Bans.Count; i++) {
                                //        list += i.ToString() + ". IP: " + PlayerManager.Bans[i].BannedIP + ", Banned By: " + PlayerManager.Bans[i].BannedBy + ", Banned Player: " + PlayerManager.Bans[i].BannedAccount + "\r\n";
                                //    }
                                //    Messenger.PlayerMsg(client, list, Text.BrightBlue);
                                //} else {
                                //    Messenger.PlayerMsg(client, "There are no bans.", Text.BrightBlue);
                                //}
                            }
                        }
                        break;
                    // TODO: Unban all players/unban single player [MEDIUM]
                    case "banlistdestroy":
                        {

                        }
                        break;
                    case "warpto":
                        {
                            if (Ranks.IsDisallowed(client, Enums.Rank.Mapper))
                            {
                                Messenger.HackingAttempt(client, "Admin cloning");
                                return;
                            }
                            else
                            {
                                Messenger.PlayerWarp(client, parse[1].ToInt(), client.Player.X, client.Player.Y);
                            }
                        }
                        break;
                    case "warptome":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Mapper))
                            {
                                Client n = ClientManager.FindClient(parse[1]);
                                if (n != null)
                                {
                                    Messenger.PlayerWarp(n, client.Player.Map, client.Player.X, client.Player.Y);
                                }
                            }
                        }
                        break;

                    case "warpmeto":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Mapper))
                            {
                                Client n = ClientManager.FindClient(parse[1]);
                                if (n != null)
                                {
                                    Messenger.PlayerWarp(client, n.Player.Map, n.Player.X, n.Player.Y);
                                }
                            }
                        }
                        break;
                    case "warploc":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Mapper) || client.Player.Map.MapType == Enums.MapType.House && ((House)client.Player.Map).OwnerID == client.Player.CharID)
                            {
                                Messenger.PlayerXYWarp(client, parse[1].ToInt(), parse[2].ToInt());
                            }
                        }
                        break;
                    case "arrowhit":
                        {
                            // TODO: Easy way to damage any player. Modify arrow code to be processed server-side [HIGH]
                            int n = parse[1].ToInt();
                            int z = parse[2].ToInt();
                            int x = parse[3].ToInt();
                            int y = parse[4].ToInt();

                            // BattleProcessor.ArrowHit(client, (Enums.TargetType)n, z);
                        }
                        break;
                    case "saveplayer":
                        {
                            using (DatabaseConnection dbConnection = new DatabaseConnection(DatabaseID.Players))
                            {
                                client.Player.SaveCharacterData(dbConnection);
                            }
                            Messenger.PlayerMsg(client, "You have saved the game.", Text.Yellow);
                        }
                        break;
                    case "solid":
                        {
                            if (client.Player.Solid == true)
                            {
                                client.Player.Solid = false;
                                Messenger.PlayerMsg(client, "You can run through players now.", Text.Yellow);
                            }
                            else
                            {
                                client.Player.Solid = true;
                                Messenger.PlayerMsg(client, "You can no longer run through players.", Text.Yellow);
                            }
                            Messenger.SendPlayerData(client);
                        }
                        break;
                    case "weather":
                        {
                            if (Ranks.IsAllowed(client, Enums.Rank.Developer))
                            {
                                int weather = parse[1].ToInt(-1);
                                if (weather > -1 && weather < 13)
                                {
                                    Globals.ServerWeather = (Enums.Weather)weather;
                                    if (Globals.ServerWeather != Enums.Weather.Ambiguous)
                                    {
                                        IMap[] mapArray = MapManager.ToArray();
                                        for (int i = 0; i < mapArray.Length; i++)
                                        {
                                            mapArray[i].Weather = Globals.ServerWeather;
                                        }
                                    }
                                    Messenger.SendWeatherToAll();
                                }
                            }
                            else
                            {
                                Messenger.HackingAttempt(client, "Admin Cloning [Changing Weather]");
                            }
                        }
                        break;
                    #endregion
                    #region Friends List
                    case "sendfriendslist":
                        client.Player.SendFriendsList();
                        break;
                    case "addfriend":
                        client.Player.AddFriend(parse[1]);
                        break;
                    case "removefriend":
                        client.Player.RemoveFriend(parse[1]);
                        break;
                    #endregion
                    #region Guild
                    case "guildpromote":
                        {

                            if (client.Player.GuildAccess < Enums.GuildRank.Founder)
                            {
                                Messenger.PlayerMsg(client, "You are not the owner of this guild!", Text.BrightRed);
                                return;
                            }

                            ListPair<string, int> members;
                            using (DatabaseConnection dbConnection = new DatabaseConnection(DatabaseID.Players))
                            {
                                members = DataManager.Players.PlayerDataManager.LoadGuild(dbConnection.Database, client.Player.GuildName);

                                if (parse[1].ToInt() > members.Count)
                                {
                                    Messenger.PlayerMsg(client, "That player doesn't seem to be in the guild anymore.", Text.BrightRed);
                                    return;
                                }

                                int adminCount = 0;
                                for (int i = 0; i < members.Count; i++)
                                {
                                    if (members.ValueByIndex(i) > 1)
                                    {
                                        adminCount++;
                                    }
                                }

                                if (client.Player.HasItem(1) < Guilds.GuildManager.PROMOTE_PRICE * adminCount)
                                {
                                    Messenger.PlayerMsg(client, "You need " + Guilds.GuildManager.PROMOTE_PRICE * adminCount + " " + ItemManager.Items[1].Name + " to promote a member.", Text.BrightRed);
                                    return;
                                }

                                client.Player.TakeItem(1, Guilds.GuildManager.PROMOTE_PRICE * adminCount, true);
                                DataManager.Players.PlayerDataManager.SetGuildAccess(dbConnection.Database, members.KeyByIndex(parse[1].ToInt()), (int)Enums.GuildRank.Admin);
                                Messenger.PlayerMsg(client, "The player has been promoted.", Text.Blue);

                            }

                            Client target = ClientManager.FindClientFromCharID(members.KeyByIndex(parse[1].ToInt()));

                            if (target != null)
                            {
                                //Set the player's New access level
                                target.Player.GuildAccess = Enums.GuildRank.Admin;
                                //send the guild access data to all
                                Messenger.SendPlayerGuild(target);
                            }
                            //send the update to all possible guild members
                            Messenger.SendFullGuildUpdate(client.Player.GuildName);
                        }
                        break;
                    case "guilddemote":
                        {

                            if (client.Player.GuildAccess < Enums.GuildRank.Founder)
                            {
                                Messenger.PlayerMsg(client, "You are not the owner of this guild!", Text.BrightRed);
                                return;
                            }
                            ListPair<string, int> members;
                            using (DatabaseConnection dbConnection = new DatabaseConnection(DatabaseID.Players))
                            {
                                members = DataManager.Players.PlayerDataManager.LoadGuild(dbConnection.Database, client.Player.GuildName);

                                if (parse[1].ToInt() > members.Count)
                                {
                                    Messenger.PlayerMsg(client, "That player doesn't seem to be in the guild anymore.", Text.BrightRed);
                                    return;
                                }

                                DataManager.Players.PlayerDataManager.SetGuildAccess(dbConnection.Database, members.KeyByIndex(parse[1].ToInt()), (int)Enums.GuildRank.Member);
                                Messenger.PlayerMsg(client, "The player has been demoted.", Text.Blue);
                            }

                            Client target = ClientManager.FindClientFromCharID(members.KeyByIndex(parse[1].ToInt()));

                            if (target != null)
                            {
                                //Set the player's New access level
                                target.Player.GuildAccess = Enums.GuildRank.Member;
                                //send the guild access data to all
                                Messenger.SendPlayerGuild(target);
                            }
                            //send the update to all possible guild members
                            Messenger.SendFullGuildUpdate(client.Player.GuildName);
                        }
                        break;
                    // Disown
                    case "guilddisown":
                        {

                            if (client.Player.GuildAccess < Enums.GuildRank.Admin)
                            {
                                Messenger.PlayerMsg(client, "Your guild rank isn't high enough to disown players!", Text.BrightRed);
                                return;
                            }
                            ListPair<string, int> members;
                            using (DatabaseConnection dbConnection = new DatabaseConnection(DatabaseID.Players))
                            {
                                members = DataManager.Players.PlayerDataManager.LoadGuild(dbConnection.Database, client.Player.GuildName);

                                if (parse[1].ToInt() > members.Count)
                                {
                                    Messenger.PlayerMsg(client, "That player doesn't seem to be in the guild anymore.", Text.BrightRed);
                                    return;
                                }

                                DataManager.Players.PlayerDataManager.RemoveGuildMember(dbConnection.Database, members.KeyByIndex(parse[1].ToInt()));
                                Messenger.PlayerMsg(client, "The player has been disowned.", Text.Blue);
                            }

                            Client target = ClientManager.FindClientFromCharID(members.KeyByIndex(parse[1].ToInt()));

                            if (target != null)
                            {
                                target.Player.GuildName = "";
                                target.Player.GuildAccess = Enums.GuildRank.None;
                                //send the guild access data to all
                                Messenger.SendPlayerGuild(target);
                            }
                            //send the update to all possible guild members
                            Messenger.SendFullGuildUpdate(client.Player.GuildName);
                        }
                        break;
                    // Leave Guild
                    case "guildleave":
                        {
                            // Check if they can leave
                            if (string.IsNullOrEmpty(client.Player.GuildName))
                            {
                                Messenger.PlayerMsg(client, "You are not in a guild.", Text.BrightRed);
                                return;
                            }
                            bool stepDown = false;
                            if (client.Player.GuildAccess > Enums.GuildRank.Member)
                            {
                                stepDown = true;
                            }

                            int index = -1;
                            using (DatabaseConnection dbConnection = new DatabaseConnection(DatabaseID.Players))
                            {
                                ListPair<string, int> members = DataManager.Players.PlayerDataManager.LoadGuild(dbConnection.Database, client.Player.GuildName);

                                index = members.IndexOfKey(client.Player.CharID);

                                int founders = 0;
                                for (int i = 0; i < members.Count; i++)
                                {
                                    if (members.ValueByIndex(i) == (int)Enums.GuildRank.Founder) founders++;
                                }

                                if (founders == 1 && client.Player.GuildAccess == Enums.GuildRank.Founder)
                                {
                                    Messenger.AskQuestion(client, "DisbandGuild", "As the sole founder of this guild, if you step down, the guild will be disbanded.  Is that OK?", -1);
                                }
                                else if (stepDown)
                                {
                                    Messenger.AskQuestion(client, "GuildStepDown", "Are you sure you want to step down from your current guild position?", -1);
                                }
                                else
                                {
                                    Messenger.AskQuestion(client, "GuildStepDown", "Are you sure you want to leave the guild?", -1);
                                }
                            }
                        }
                        break;
                    // Make A New Guild
                    case "makeguild":
                        {
                            string name = parse[1].Trim();

                            Guilds.GuildManager.RegisterGuild(client, name);

                        }
                        break;
                    case "guildmember":
                        {

                            if (client.Player.GuildAccess < Enums.GuildRank.Admin)
                            {
                                Messenger.PlayerMsg(client, "Your guild rank isn't high enough to add players!", Text.BrightRed);
                                return;
                            }

                            //find character ID from name in database
                            string charID;
                            string guild;
                            Client target = null;
                            using (DatabaseConnection dbConnection = new DatabaseConnection(DatabaseID.Players))
                            {
                                charID = DataManager.Players.PlayerDataManager.RetrieveCharacterID(dbConnection.Database, parse[1]);

                                if (String.IsNullOrEmpty(charID))
                                {
                                    Messenger.PlayerMsg(client, "The player could not be found.", Text.BrightRed);
                                    return;
                                }

                                target = ClientManager.FindClientFromCharID(charID);

                                if (target == null)
                                {
                                    Messenger.PlayerMsg(client, "That player isn't online!", Text.BrightRed);
                                    return;
                                }

                                if (target.Player.MapID != client.Player.MapID || target.Player.X != client.Player.X || target.Player.Y != client.Player.Y)
                                {
                                    Messenger.PlayerMsg(client, "The joining player needs to be with you on the same tile!", Text.BrightRed);
                                    return;
                                }

                                guild = DataManager.Players.PlayerDataManager.GetGuildName(dbConnection.Database, charID);

                                if (!String.IsNullOrEmpty(guild))
                                {
                                    Messenger.PlayerMsg(client, "That player is already in a guild!", Text.BrightRed);
                                    return;
                                }

                                ListPair<string, int> members = DataManager.Players.PlayerDataManager.LoadGuild(dbConnection.Database, client.Player.GuildName);

                                if (client.Player.HasItem(1) < Guilds.GuildManager.RECRUIT_PRICE * members.Count)
                                {
                                    Messenger.PlayerMsg(client, "You need " + Guilds.GuildManager.RECRUIT_PRICE * members.Count + " " + ItemManager.Items[1].Name + " to add a member.", Text.BrightRed);
                                    return;
                                }

                                client.Player.TakeItem(1, Guilds.GuildManager.RECRUIT_PRICE * members.Count, true);
                                DataManager.Players.PlayerDataManager.AddGuildMember(dbConnection.Database, client.Player.GuildName, charID);
                                Messenger.PlayerMsg(client, "The player has been added to the guild!", Text.Blue);
                            }

                            if (target != null)
                            {
                                target.Player.GuildName = client.Player.GuildName;
                                target.Player.GuildAccess = Enums.GuildRank.Member;
                                //send the guild access data to all
                                Messenger.SendPlayerGuild(target);
                            }
                            //send the update to all possible guild members
                            Messenger.SendFullGuildUpdate(client.Player.GuildName);
                        }
                        break;
                    #endregion
                    #region Items
                    case "useitem":
                        {
                            if (client.Player.GettingMap) return;
                            int invNum = parse[1].ToInt(-1);
                            if (invNum != -1 && (invNum < 1 || invNum > client.Player.MaxInv))
                            {
                                Messenger.HackingAttempt(client, "Invalid InvNum");
                                return;
                            }

                            client.Player.UseItem(client.Player.Inventory[invNum], invNum);
                        }
                        break;
                    case "throwitem":
                        {
                            if (client.Player.GettingMap) return;
                            int invNum = parse[1].ToInt(-1);
                            if (invNum != -1 && (invNum < 1 || invNum > client.Player.MaxInv))
                            {
                                Messenger.HackingAttempt(client, "Invalid InvNum");
                                return;
                            }
                            client.Player.ThrowItem(client.Player.Inventory[parse[1].ToInt(-1)], parse[1].ToInt(-1));
                        }
                        break;
                    case "holditem":
                        {
                            client.Player.HoldItem(parse[1].ToInt(-1));
                        }
                        break;
                    case "removeitem":
                        {
                            client.Player.RemoveItem(parse[1].ToInt(-1));
                        }
                        break;
                    case "swapinvitems":
                        {
                            int oldInvSlot = parse[1].ToInt(-1);
                            int newInvSlot = parse[2].ToInt(-1);
                            if (oldInvSlot > 0 && oldInvSlot <= client.Player.MaxInv && newInvSlot > 0 && newInvSlot <= client.Player.MaxInv)
                            {
                                InventoryItem oldItem = client.Player.Inventory[oldInvSlot];
                                InventoryItem newItem = client.Player.Inventory[newInvSlot];

                                oldItem.Updated = true;
                                newItem.Updated = true;

                                client.Player.Inventory[oldInvSlot] = newItem;
                                client.Player.Inventory[newInvSlot] = oldItem;

                                int[] teamHeldItems = new int[client.Player.Team.Length];
                                bool heldItemsUpdated = false;
                                for (int i = 0; i < client.Player.Team.Length; i++)
                                {
                                    if (client.Player.Team[i].Loaded)
                                    {
                                        teamHeldItems[i] = client.Player.Team[i].HeldItemSlot;
                                    }
                                }
                                for (int i = 0; i < teamHeldItems.Length; i++)
                                {
                                    if (teamHeldItems[i] == oldInvSlot)
                                    {
                                        client.Player.Team[i].HeldItemSlot = newInvSlot;
                                        heldItemsUpdated = true;
                                    }
                                    else if (teamHeldItems[i] == newInvSlot)
                                    {
                                        client.Player.Team[i].HeldItemSlot = oldInvSlot;
                                        heldItemsUpdated = true;
                                    }
                                }

                                PacketHitList hitlist = null;
                                PacketHitList.MethodStart(ref hitlist);

                                Messenger.SendInventoryUpdate(client, oldInvSlot, hitlist);
                                Messenger.SendInventoryUpdate(client, newInvSlot, hitlist);
                                if (heldItemsUpdated)
                                {
                                    PacketBuilder.AppendWornEquipment(client, hitlist);
                                }

                                PacketHitList.MethodEnded(ref hitlist);
                            }
                        }
                        break;
                    #endregion
                    #region Shops
                    case "shoprequest":
                        {
                            if (client.Player.Map.Tile[client.Player.X, client.Player.Y].Type == Enums.TileType.Shop)
                            {
                                if (client.Player.Map.Tile[client.Player.X, client.Player.Y].Data1 > 0)
                                {
                                    Messenger.SendTrade(client, client.Player.Map.Tile[client.Player.X, client.Player.Y].Data1);
                                }
                                else
                                {
                                    Messenger.PlayerMsg(client, "There is no shop here.", Text.BrightRed);
                                }
                            }
                        }
                        break;
                    case "shopleave":
                        {
                            if (client.Player.Map.Tile[client.Player.X, client.Player.Y].Type == Enums.TileType.Shop && client.Player.Map.Tile[client.Player.X, client.Player.Y].Data1 > 0)
                            {
                                int shopNum = client.Player.Map.Tile[client.Player.X, client.Player.Y].Data1;
                                if (Shops.ShopManager.Shops[shopNum].LeaveSay.Trim() != "")
                                {
                                    Messenger.PlayerMsg(client, Shops.ShopManager.Shops[shopNum].LeaveSay.Trim(), Text.Yellow);
                                }
                            }
                        }
                        break;
                    case "traderequest":
                        {
                            // Trade num
                            int n = parse[1].ToInt();
                            int z = parse[2].ToInt();

                            // Prevent hacking
                            if ((z < 0) || (z > Constants.MAX_TRADES))
                            {
                                Messenger.HackingAttempt(client, "Trade Request Modification (index)");
                                return;
                            }
                            if (client.Player.Map.Tile[client.Player.X, client.Player.Y].Type != Enums.TileType.Shop)
                            {
                                Messenger.HackingAttempt(client, "Trade Request Modification (tile)");
                                return;
                            }

                            // Index for shop
                            int i = client.Player.GetCurrentMap().Tile[client.Player.X, client.Player.Y].Data1;

                            // Check if inv full
                            if (i <= 0) return;
                            int X = client.Player.FindInvSlot(ShopManager.Shops[i].Items[z].GetItem, n);
                            if (X == -1)
                            {
                                Messenger.PlayerMsg(client, "Trade unsuccessful, inventory full.", Text.BrightRed);
                                return;
                            }
                            if (n == 0)
                            {
                                if (ItemManager.Items[ShopManager.Shops[i].Items[z].GetItem].StackCap > 0)
                                {
                                    Messenger.PlayerMsg(client, "You must buy more than 0!", Text.BrightRed);
                                    return;
                                }
                                else
                                {
                                    n = 1;
                                }

                            }

                            if (ItemManager.Items[ShopManager.Shops[i].Items[z].GetItem].Rarity > (int)client.Player.ExplorerRank + 1)
                            {
                                Messenger.PlayerMsg(client, "Your Explorer Rank is not high enough to receive this item!", Text.BrightRed);
                                return;
                            }

                            // Check if they have the item
                            if (client.Player.HasItem(ShopManager.Shops[i].Items[z].GiveItem) >= ShopManager.Shops[i].Items[z].GiveValue * n)
                            {
                                client.Player.TakeItem(ShopManager.Shops[i].Items[z].GiveItem, ShopManager.Shops[i].Items[z].GiveValue * n);
                                client.Player.GiveItem(ShopManager.Shops[i].Items[z].GetItem, n);
                                Messenger.PlayerMsg(client, "The trade was successful!", Text.Yellow);
                                Messenger.SendInventory(client);
                            }
                            else
                            {
                                Messenger.PlayerMsg(client, "Trade unsuccessful.", Text.BrightRed);
                            }
                        }
                        break;
                    case "sellitem":
                        {//sell multiples
                            int sellItemNum = parse[2].ToInt();
                            int SellItemAmount = parse[1].ToInt();

                            // Prevent hacking
                            if ((sellItemNum < 0) || (sellItemNum >= ItemManager.Items.MaxItems))
                            {
                                Messenger.HackingAttempt(client, "Trade Request Modification");
                                return;
                            }
                            if (client.Player.Map.Tile[client.Player.X, client.Player.Y].Type != Enums.TileType.Shop)
                            {
                                Messenger.HackingAttempt(client, "Trade Request Modification");
                                return;
                            }
                            if (ItemManager.Items[sellItemNum].Price <= 0)
                            {
                                Messenger.PlayerMsg(client, "You can't sell that!", Text.BrightRed);
                                break;
                            }

                            if (SellItemAmount <= 0)
                            {
                                if (ItemManager.Items[sellItemNum].StackCap > 0)
                                {
                                    Messenger.PlayerMsg(client, "You must sell more than 0!", Text.BrightRed);
                                    break;
                                }
                                else
                                {
                                    SellItemAmount = 1;
                                }
                            }
                            if (client.Player.HasItem(sellItemNum) > 0)
                            {
                                if (client.Player.HasItem(sellItemNum) < SellItemAmount)
                                {
                                    Messenger.PlayerMsg(client, "You can't sell more than you have!", Text.BrightRed);
                                    break;
                                }
                                client.Player.TakeItem(sellItemNum, SellItemAmount);
                                client.Player.GiveItem(1, ItemManager.Items[sellItemNum].Price * SellItemAmount);
                                Messenger.SendInventory(client);
                                Messenger.PlayerMsg(client, "You have sold " + SellItemAmount + " " + Items.ItemManager.Items[sellItemNum].Name + "!", Text.BrightGreen);
                                //Messenger.SendDataTo(client, TcpPacket.CreatePacket("updatesell"));
                            }
                        }
                        break;
                    case "moverecall":
                        {
                            int recallMove = parse[1].ToInt();
                            // Prevent hacking
                            if ((recallMove <= 0) || (recallMove > MoveManager.Moves.MaxMoves))
                            {
                                Messenger.HackingAttempt(client, "Move Recall Out of Range :" + recallMove);
                                return;
                            }
                            if (client.Player.Map.Tile[client.Player.X, client.Player.Y].Type != Enums.TileType.LinkShop)
                            {
                                return;
                            }

                            int priceItem = client.Player.Map.Tile[client.Player.X, client.Player.Y].Data1;
                            int priceAmount = client.Player.Map.Tile[client.Player.X, client.Player.Y].Data2;
                            bool earlierEvo = (client.Player.Map.Tile[client.Player.X, client.Player.Y].Data3 == 1);
                            if (Items.ItemManager.Items[priceItem].StackCap <= 0 && Items.ItemManager.Items[priceItem].Type != Enums.ItemType.Currency)
                            {
                                priceAmount = 1;
                            }

                            for (int i = 0; i < 4; i++)
                            {
                                if (client.Player.GetActiveRecruit().Moves[i].MoveNum == recallMove)
                                {
                                    Messenger.PlayerMsg(client, "You already know this move.", Text.BrightRed);
                                    return;
                                }
                            }

                            if (earlierEvo)
                            {
                                int species = EvolutionManager.FindPreEvolution(client.Player.GetActiveRecruit().Species);

                                while (species > -1)
                                {

                                    Pokedex.PokemonForm pokemon = Pokedex.Pokedex.GetPokemonForm(species, client.Player.GetActiveRecruit().Form);
                                    if (pokemon != null)
                                    {
                                        for (int n = 0; n < pokemon.LevelUpMoves.Count; n++)
                                        {
                                            if (pokemon.LevelUpMoves[n].Level <= client.Player.GetActiveRecruit().Level)
                                            {
                                                if (pokemon.LevelUpMoves[n].Move == recallMove)
                                                {
                                                    if (client.Player.HasItem(priceItem) >= priceAmount)
                                                    {
                                                        client.Player.TakeItem(priceItem, priceAmount);
                                                        client.Player.GetActiveRecruit().LearnNewMove(recallMove);
                                                        Messenger.SendPlayerMoves(client);
                                                    }
                                                    else
                                                    {
                                                        Messenger.PlayerMsg(client, "You do not have enough to recall a move!", Text.BrightRed);
                                                    }
                                                    return;
                                                }
                                            }
                                        }
                                    }

                                    species = EvolutionManager.FindPreEvolution(species);
                                }
                            }
                            else
                            {
                                Pokedex.PokemonForm pokemon = Pokedex.Pokedex.GetPokemonForm(client.Player.GetActiveRecruit().Species, client.Player.GetActiveRecruit().Form);
                                if (pokemon != null)
                                {
                                    for (int n = 0; n < pokemon.LevelUpMoves.Count; n++)
                                    {
                                        if (pokemon.LevelUpMoves[n].Level <= client.Player.GetActiveRecruit().Level && pokemon.LevelUpMoves[n].Move == recallMove)
                                        {

                                            if (client.Player.HasItem(priceItem) >= priceAmount)
                                            {
                                                client.Player.TakeItem(priceItem, priceAmount);
                                                client.Player.GetActiveRecruit().LearnNewMove(recallMove);
                                                Messenger.SendPlayerMoves(client);
                                            }
                                            else
                                            {
                                                Messenger.PlayerMsg(client, "You do not have enough to recall a move!", Text.BrightRed);
                                            }
                                            return;

                                        }
                                    }

                                }
                            }

                        }
                        break;
                    #endregion
                    #region Bank
                    case "bankdeposit":
                        {
                            if (client.Player.Map.Tile[client.Player.X, client.Player.Y].Type == Enums.TileType.Bank)
                            {
                                int slot = parse[1].ToInt();
                                int amount = parse[2].ToInt();
                                int X = client.Player.Inventory[slot].Num;
                                string tag = client.Player.Inventory[slot].Tag;
                                int i = client.Player.FindBankSlot(X, amount);
                                if (i == -1)
                                {
                                    Messenger.StorageMessage(client, "The storage is full!");
                                    return;
                                }

                                if (amount > client.Player.Inventory[slot].Amount)
                                {
                                    Messenger.StorageMessage(client, "You cant deposit more than you have!");
                                    return;
                                }

                                if (ItemManager.Items[X].Type == Enums.ItemType.Currency || ItemManager.Items[X].StackCap > 0)
                                {//handle clientside
                                    if (amount <= 0)
                                    {
                                        Messenger.StorageMessage(client, "You must deposit more than 0!");
                                        return;
                                    }
                                }

                                client.Player.TakeItemSlot(slot, amount, true);
                                client.Player.GiveBankItem(X, amount, tag, i);
                            }
                            else
                            {
                                Messenger.HackingAttempt(client, "Player not in Storage");
                            }
                            //Messenger.SendBank(client);
                        }
                        break;
                    case "bankwithdraw":
                        {
                            if (client.Player.Map.Tile[client.Player.X, client.Player.Y].Type == Enums.TileType.Bank)
                            {
                                int slot = parse[1].ToInt();
                                int i = client.Player.Bank[parse[1].ToInt()].Num;
                                string tag = client.Player.Bank[parse[1].ToInt()].Tag;
                                int TempVal = parse[2].ToInt();
                                int X = client.Player.FindInvSlot(i, TempVal);
                                if (X == -1)
                                {
                                    Messenger.StorageMessage(client, "There's no more room in your bag!");
                                    return;
                                }

                                if (TempVal > client.Player.Bank[slot].Amount)
                                {
                                    Messenger.StorageMessage(client, "You cant withdraw more than you have!");
                                    return;
                                }

                                if (ItemManager.Items[i].Type == Enums.ItemType.Currency || ItemManager.Items[i].StackCap > 0)
                                {//handle clientside
                                    if (TempVal <= 0)
                                    {
                                        Messenger.StorageMessage(client, "You must withdraw more than 0!");
                                        return;
                                    }
                                }

                                client.Player.GiveItem(i, TempVal, tag, false);
                                client.Player.TakeBankItem(slot, TempVal);
                            }
                            else
                            {
                                Messenger.HackingAttempt(client, "Player not in Storage");
                            }
                            //Messenger.SendBank(client);
                        }
                        break;
                    case "bankwithdrawmenu":
                        {
                            Messenger.SendBank(client);
                        }
                        break;
                    #endregion
                    #region Custom Menus
                    case "picclick":
                    case "lblclick":
                    case "txtclick":
                    case "menuclosed":
                        client.Player.CustomMenuManager.ProcessTCP(parse);
                        break;
                    #endregion
                    #region Housing
                    case "housevisitrequest":
                        {
                            string ownerName = parse[1];
                            // Now, find the owner ID using the char list...
                            string ownerID;
                            using (DatabaseConnection dbConnection = new DatabaseConnection(DatabaseID.Players))
                            {
                                ownerID = PlayerManager.RetrieveCharacterID(dbConnection, ownerName);
                            }
                            if (!string.IsNullOrEmpty(ownerID))
                            {
                                Messenger.PlayerWarpToHouse(client, ownerID, 0);
                            }
                            else
                            {
                                Messenger.PlayerMsg(client, "There is no house owned by a player of that name.", Text.BrightRed);
                            }
                        }
                        break;
                    case "addshoprequest":
                        {
                            IMap map = client.Player.Map;
                            if (map.MapType != Server.Enums.MapType.House || ((House)map).OwnerID != client.Player.CharID)
                            {
                                Messenger.PlayerMsg(client, "You can't place a shop tile here.", Text.BrightRed);
                                return;
                            }
                            int price = parse[1].ToInt();
                            if (client.Player.HasItem(1) < price / House.SHOP_PRICE)
                            {
                                Messenger.PlayerMsg(client, "You need " + price / House.SHOP_PRICE + " " + ItemManager.Items[1].Name + " to place a shop tile.", Text.BrightRed);
                                return;
                            }
                            client.Player.TakeItem(1, price / House.SHOP_PRICE, true);

                            map.Tile[client.Player.X, client.Player.Y].Type = Enums.TileType.DropShop;
                            map.Tile[client.Player.X, client.Player.Y].Data1 = price;
                            map.Tile[client.Player.X, client.Player.Y].Data2 = 0;
                            map.Tile[client.Player.X, client.Player.Y].Data3 = 0;
                            map.Tile[client.Player.X, client.Player.Y].String1 = client.Player.CharID;
                            map.Tile[client.Player.X, client.Player.Y].String2 = "";
                            map.Tile[client.Player.X, client.Player.Y].String3 = "";

                            Messenger.PlayerMsg(client, "A shop tile has been placed!  You can now sell items for " + parse[1].ToInt() + " " + ItemManager.Items[1].Name + " by dropping your items on the tile.", Text.BrightGreen);

                            Messenger.RefreshMap(client);
                        }
                        break;
                    case "addnoticerequest":
                        {
                            IMap map = client.Player.Map;
                            if (map.MapType != Server.Enums.MapType.House || ((House)map).OwnerID != client.Player.CharID)
                            {
                                Messenger.PlayerMsg(client, "You can't place a special tile here.", Text.BrightRed);
                                return;
                            }

                            int totalLength = parse[1].Length + parse[2].Length;
                            if (client.Player.HasItem(1) < House.NOTICE_PRICE)
                            {
                                Messenger.PlayerMsg(client, "You need " + (House.NOTICE_PRICE + House.WORD_PRICE * totalLength) + " " + ItemManager.Items[1].Name + " to place a special tile.", Text.BrightRed);
                                return;
                            }
                            client.Player.TakeItem(1, House.NOTICE_PRICE + House.WORD_PRICE * totalLength, true);

                            map.Tile[client.Player.X, client.Player.Y].Type = Enums.TileType.Notice;
                            map.Tile[client.Player.X, client.Player.Y].Data1 = 0;
                            map.Tile[client.Player.X, client.Player.Y].Data2 = 0;
                            map.Tile[client.Player.X, client.Player.Y].Data3 = 0;
                            map.Tile[client.Player.X, client.Player.Y].String1 = parse[1];
                            map.Tile[client.Player.X, client.Player.Y].String2 = parse[2];
                            map.Tile[client.Player.X, client.Player.Y].String3 = parse[3];

                            //Messenger.SendTile(client.Player.X, client.Player.Y, client.Player.Map);
                            Messenger.PlayerMsg(client, "A notice tile has been placed!  Step on it to read what it says.", Text.BrightGreen);

                            Messenger.RefreshMap(client);
                        }
                        break;
                    case "addsoundrequest":
                        {
                            IMap map = client.Player.Map;
                            if (map.MapType != Server.Enums.MapType.House || ((House)map).OwnerID != client.Player.CharID)
                            {
                                Messenger.PlayerMsg(client, "You can't place a special tile here.", Text.BrightRed);
                                return;
                            }

                            if (client.Player.HasItem(1) < House.SOUND_PRICE)
                            {
                                Messenger.PlayerMsg(client, "You need " + House.SOUND_PRICE + " " + ItemManager.Items[1].Name + " to place a special tile.", Text.BrightRed);
                                return;
                            }
                            client.Player.TakeItem(1, House.SOUND_PRICE, true);

                            map.Tile[client.Player.X, client.Player.Y].Type = Enums.TileType.Sound;
                            map.Tile[client.Player.X, client.Player.Y].Data1 = 0;
                            map.Tile[client.Player.X, client.Player.Y].Data2 = 0;
                            map.Tile[client.Player.X, client.Player.Y].Data3 = 0;
                            map.Tile[client.Player.X, client.Player.Y].String1 = parse[1];
                            map.Tile[client.Player.X, client.Player.Y].String2 = "";
                            map.Tile[client.Player.X, client.Player.Y].String3 = "";

                            //Messenger.SendTile(client.Player.X, client.Player.Y, client.Player.Map);
                            Messenger.PlayerMsg(client, "A sound tile has been placed!  Step on it to play a sound.", Text.BrightGreen);

                            Messenger.RefreshMap(client);
                        }
                        break;
                    case "addsignrequest":
                        {

                            IMap map = client.Player.Map;
                            if (map.MapType != Server.Enums.MapType.House || ((House)map).OwnerID != client.Player.CharID)
                            {
                                Messenger.PlayerMsg(client, "You can't place a special tile here.", Text.BrightRed);
                                return;
                            }
                            int totalLength = parse[1].Length + parse[2].Length + parse[3].Length;
                            if (client.Player.HasItem(1) < House.WORD_PRICE * totalLength)
                            {
                                Messenger.PlayerMsg(client, "You need " + House.WORD_PRICE * totalLength + " " + ItemManager.Items[1].Name + " to place a special tile.", Text.BrightRed);
                                return;
                            }
                            client.Player.TakeItem(1, House.WORD_PRICE * totalLength, true);

                            map.Tile[client.Player.X, client.Player.Y].Type = Enums.TileType.Sign;
                            map.Tile[client.Player.X, client.Player.Y].Data1 = 0;
                            map.Tile[client.Player.X, client.Player.Y].Data2 = 0;
                            map.Tile[client.Player.X, client.Player.Y].Data3 = 0;
                            map.Tile[client.Player.X, client.Player.Y].String1 = parse[1];
                            map.Tile[client.Player.X, client.Player.Y].String2 = parse[2];
                            map.Tile[client.Player.X, client.Player.Y].String3 = parse[3];

                            //Messenger.SendTile(client.Player.X, client.Player.Y, client.Player.Map);
                            Messenger.PlayerMsg(client, "A sign tile has been placed!  Press Enter to read signs.", Text.BrightGreen);

                            Messenger.RefreshMap(client);
                        }
                        break;
                    case "weatherrequest":
                        {

                            IMap map = client.Player.Map;
                            if (map.MapType != Server.Enums.MapType.House || ((House)map).OwnerID != client.Player.CharID)
                            {
                                Messenger.PlayerMsg(client, "You can't change the weather here.", Text.BrightRed);
                                return;
                            }

                            if (client.Player.HasItem(1) < House.WEATHER_PRICE)
                            {
                                Messenger.PlayerMsg(client, "You need " + House.WEATHER_PRICE + " " + ItemManager.Items[1].Name + " to change the weather.", Text.BrightRed);
                                return;
                            }
                            client.Player.TakeItem(1, House.WEATHER_PRICE, true);

                            map.Weather = (Enums.Weather)parse[1].ToInt();

                            //Messenger.SendTile(client.Player.X, client.Player.Y, client.Player.Map);
                            Messenger.PlayerMsg(client, "The house's weather has been changed!", Text.BrightGreen);

                            Messenger.RefreshMap(client);
                        }
                        break;
                    case "darknessrequest":
                        {
                            IMap map = client.Player.Map;
                            if (map.MapType != Server.Enums.MapType.House || ((House)map).OwnerID != client.Player.CharID)
                            {
                                Messenger.PlayerMsg(client, "You can't change the lights here.", Text.BrightRed);
                                return;
                            }

                            if (client.Player.HasItem(1) < House.LIGHT_PRICE)
                            {
                                Messenger.PlayerMsg(client, "You need " + House.LIGHT_PRICE + " " + ItemManager.Items[1].Name + " to change the lights.", Text.BrightRed);
                                return;
                            }
                            client.Player.TakeItem(1, House.LIGHT_PRICE, true);

                            map.Darkness = parse[1].ToInt();

                            //Messenger.SendTile(client.Player.X, client.Player.Y, client.Player.Map);
                            Messenger.PlayerMsg(client, "The house's lights have been changed!", Text.BrightGreen);

                            Messenger.RefreshMap(client);
                        }
                        break;
                    case "expansionrequest":
                        {
                            IMap map = client.Player.Map;
                            if (map.MapType != Server.Enums.MapType.House || ((House)map).OwnerID != client.Player.CharID)
                            {
                                Messenger.PlayerMsg(client, "You can't expand your house here.", Text.BrightRed);
                                return;
                            }
                            int x = parse[1].ToInt();
                            int y = parse[2].ToInt();
                            int total = ((x + 1) * (y + 1) - (map.MaxX + 1) * (map.MaxY + 1)) * House.TILE_PRICE;
                            if (total > 0)
                            {
                                if (client.Player.HasItem(1) < total)
                                {
                                    Messenger.PlayerMsg(client, "You need " + total + " " + ItemManager.Items[1].Name + " to expand your house.", Text.BrightRed);
                                    return;
                                }
                                client.Player.TakeItem(1, total, true);
                            }

                            if (client.Player.X > x) client.Player.X = x;
                            if (client.Player.Y > y) client.Player.Y = y;
                            int oldX = map.MaxX;
                            int oldY = map.MaxY;
                            TileCollection tiles = new TileCollection(map.BaseMap, x, y);

                            for (int Y = 0; Y <= y && Y <= oldY; Y++)
                            {
                                for (int X = 0; X <= x && X <= oldX; X++)
                                {
                                    tiles[X, Y].Ground = map.Tile[X, Y].Ground;
                                    tiles[X, Y].GroundAnim = map.Tile[X, Y].GroundAnim;
                                    tiles[X, Y].Mask = map.Tile[X, Y].Mask;
                                    tiles[X, Y].Anim = map.Tile[X, Y].Anim;
                                    tiles[X, Y].Mask2 = map.Tile[X, Y].Mask2;
                                    tiles[X, Y].M2Anim = map.Tile[X, Y].M2Anim;
                                    tiles[X, Y].Fringe = map.Tile[X, Y].Fringe;
                                    tiles[X, Y].FAnim = map.Tile[X, Y].FAnim;
                                    tiles[X, Y].Fringe2 = map.Tile[X, Y].Fringe2;
                                    tiles[X, Y].F2Anim = map.Tile[X, Y].F2Anim;
                                    tiles[X, Y].Type = map.Tile[X, Y].Type;
                                    tiles[X, Y].Data1 = map.Tile[X, Y].Data1;
                                    tiles[X, Y].Data2 = map.Tile[X, Y].Data2;
                                    tiles[X, Y].Data3 = map.Tile[X, Y].Data3;
                                    tiles[X, Y].String1 = map.Tile[X, Y].String1;
                                    tiles[X, Y].String2 = map.Tile[X, Y].String2;
                                    tiles[X, Y].String3 = map.Tile[X, Y].String3;
                                    tiles[X, Y].RDungeonMapValue = map.Tile[X, Y].RDungeonMapValue;
                                    tiles[X, Y].GroundSet = map.Tile[X, Y].GroundSet;
                                    tiles[X, Y].GroundAnimSet = map.Tile[X, Y].GroundAnimSet;
                                    tiles[X, Y].MaskSet = map.Tile[X, Y].MaskSet;
                                    tiles[X, Y].AnimSet = map.Tile[X, Y].AnimSet;
                                    tiles[X, Y].Mask2Set = map.Tile[X, Y].Mask2Set;
                                    tiles[X, Y].M2AnimSet = map.Tile[X, Y].M2AnimSet;
                                    tiles[X, Y].FringeSet = map.Tile[X, Y].FringeSet;
                                    tiles[X, Y].FAnimSet = map.Tile[X, Y].FAnimSet;
                                    tiles[X, Y].Fringe2Set = map.Tile[X, Y].Fringe2Set;
                                    tiles[X, Y].F2AnimSet = map.Tile[X, Y].F2AnimSet;
                                }
                            }
                            map.Tile = tiles;

                            Messenger.PlayerMsg(client, "The house's boundaries have been changed!", Text.BrightGreen);

                            Messenger.RefreshMap(client);
                        }
                        break;
                    #endregion
                    #region Moves
                    case "overwritemove":
                        {
                            if (client.Player.GetActiveRecruit().LearningMove != -1)
                            {
                                int moveSlot = parse[1].ToInt(-1);
                                if (moveSlot != -1 && moveSlot >= 0 && moveSlot <= 3)
                                {
                                    if (client.Player.GetActiveRecruit().Moves[moveSlot].MoveNum > 0)
                                    {
                                        client.Player.GetActiveRecruit().Moves[moveSlot].MoveNum = client.Player.GetActiveRecruit().LearningMove;
                                        client.Player.GetActiveRecruit().Moves[moveSlot].MaxPP = MoveManager.Moves[client.Player.GetActiveRecruit().Moves[moveSlot].MoveNum].MaxPP;
                                        client.Player.GetActiveRecruit().Moves[moveSlot].CurrentPP = client.Player.GetActiveRecruit().Moves[moveSlot].MaxPP;
                                        Messenger.PlayerMsg(client, "You have learned a new move!", Text.Yellow);
                                        Messenger.SendPlayerMoves(client);
                                    }
                                }
                            }
                        }
                        break;
                    #endregion
                    #region ExpKit
                    case "activekitmodule":
                        {
                            Enums.ExpKitModules module = (Enums.ExpKitModules)parse[1].ToInt();
                            if (client.Player.AvailableExpKitModules.Contains(module))
                            {
                                client.Player.ActiveExpKitModule = module;
                            }
                        }
                        break;
                    #endregion
                    #region Trading
                    case "settradeitem":
                        {
                            if (!string.IsNullOrEmpty(client.Player.TradePartner))
                            {
                                Client tradePartner = ClientManager.FindClientFromCharID(client.Player.TradePartner);
                                if (tradePartner != null && tradePartner.Player.TradePartner == client.Player.CharID)
                                {
                                    int slot = parse[1].ToInt();
                                    int amount = parse[2].ToInt();

                                    if (slot > -1)
                                    {
                                        if (ItemManager.Items[client.Player.Inventory[slot].Num].Type != Enums.ItemType.Currency && ItemManager.Items[client.Player.Inventory[slot].Num].StackCap <= 0)
                                        {
                                            amount = 1;
                                        }
                                        if (ItemManager.Items[client.Player.Inventory[slot].Num].Bound)
                                        {
                                            Messenger.PlayerMsg(client, "This item cannot be traded!", Text.BrightRed);
                                            slot = -1;
                                            amount = 0;
                                        }
                                        else if (client.Player.Inventory[slot].Sticky)
                                        {
                                            Messenger.PlayerMsg(client, "You cannot trade a sticky item!", Text.BrightRed);
                                            slot = -1;
                                            amount = 0;
                                        }
                                        else if (ItemManager.Items[client.Player.Inventory[slot].Num].Rarity > (int)tradePartner.Player.ExplorerRank + 1)
                                        {
                                            Messenger.PlayerMsg(client, "The other person does not have a high enough Explorer Rank to receive this item.", Text.BrightRed);
                                            slot = -1;
                                            amount = 0;
                                        }
                                        else if (amount == 0 && (ItemManager.Items[client.Player.Inventory[slot].Num].Type == Enums.ItemType.Currency || ItemManager.Items[client.Player.Inventory[slot].Num].StackCap > 0))
                                        {
                                            Messenger.PlayerMsg(client, "You must trade more than 0!", Text.BrightRed);
                                            slot = -1;
                                            amount = 0;
                                        }
                                        else if (amount > client.Player.Inventory[slot].Amount && (ItemManager.Items[client.Player.Inventory[slot].Num].Type == Enums.ItemType.Currency || ItemManager.Items[client.Player.Inventory[slot].Num].StackCap > 0))
                                        {
                                            Messenger.PlayerMsg(client, "You cannot trade more than you have!", Text.BrightRed);
                                            slot = -1;
                                            amount = 0;
                                        }
                                        else if (tradePartner.Player.FindInvSlot(client.Player.Inventory[slot].Num) == -1)
                                        {
                                            Messenger.PlayerMsg(client, "The other person does not have enough space to receive this item.", Text.BrightRed);
                                            slot = -1;
                                            amount = 0;
                                        }
                                    }
                                    client.Player.SetTradeItem = slot;
                                    client.Player.SetTradeAmount = amount;

                                    client.Player.ReadyToTrade = false;
                                    tradePartner.Player.ReadyToTrade = false;
                                    Messenger.SendTradeUnconfirm(client);
                                    Messenger.SendTradeUnconfirm(tradePartner);

                                    if (slot > -1)
                                    {
                                        string itemName = Items.ItemManager.Items[client.Player.Inventory[slot].Num].Name;
                                        if (ItemManager.Items[client.Player.Inventory[slot].Num].Type == Enums.ItemType.Currency || ItemManager.Items[client.Player.Inventory[slot].Num].StackCap > 0)
                                        {
                                            itemName += " (" + amount + ")";
                                        }
                                        Messenger.SendTradeSetItemUpdate(tradePartner, client.Player.Inventory[slot].Num, amount, false);
                                        Messenger.SendTradeSetItemUpdate(client, client.Player.Inventory[slot].Num, amount, true);
                                    }
                                    else
                                    {
                                        Messenger.SendTradeSetItemUpdate(tradePartner, -1, 0, false);
                                        Messenger.SendTradeSetItemUpdate(client, -1, 0, true);
                                    }
                                }
                            }
                        }
                        break;
                    case "readytotrade":
                        {
                            if (!string.IsNullOrEmpty(client.Player.TradePartner))
                            {
                                Client tradePartner = ClientManager.FindClientFromCharID(client.Player.TradePartner);
                                if (tradePartner != null && tradePartner.Player.TradePartner == client.Player.CharID)
                                {
                                    int myItem = client.Player.SetTradeItem;
                                    int myAmount = client.Player.SetTradeAmount;
                                    int partnersItem = tradePartner.Player.SetTradeItem;
                                    int partnersAmount = tradePartner.Player.SetTradeAmount;

                                    if (ItemManager.Items[client.Player.Inventory[myItem].Num].Type != Enums.ItemType.Currency && ItemManager.Items[client.Player.Inventory[myItem].Num].StackCap <= 0)
                                    {
                                        myAmount = 1;
                                    }

                                    if (ItemManager.Items[client.Player.Inventory[myItem].Num].Bound)
                                    {
                                        Messenger.PlayerMsg(client, "This item cannot be traded!", Text.BrightRed);
                                        client.Player.SetTradeItem = -1;
                                        client.Player.SetTradeAmount = 0;
                                    }
                                    else if (client.Player.Inventory[myItem].Sticky)
                                    {
                                        Messenger.PlayerMsg(client, "You cannot trade a sticky item!", Text.BrightRed);
                                        client.Player.SetTradeItem = -1;
                                        client.Player.SetTradeAmount = 0;
                                    }
                                    else if (ItemManager.Items[client.Player.Inventory[myItem].Num].Rarity > (int)tradePartner.Player.ExplorerRank + 1)
                                    {
                                        Messenger.PlayerMsg(client, "The other person does not have a high enough Explorer Rank to receive this item.", Text.BrightRed);
                                        client.Player.SetTradeItem = -1;
                                        client.Player.SetTradeAmount = 0;
                                    }
                                    else if (client.Player.SetTradeAmount == 0 && (ItemManager.Items[client.Player.Inventory[myItem].Num].Type == Enums.ItemType.Currency || ItemManager.Items[client.Player.Inventory[myItem].Num].StackCap > 0))
                                    {
                                        Messenger.PlayerMsg(client, "You must trade more than 0!", Text.BrightRed);
                                        client.Player.SetTradeItem = -1;
                                        client.Player.SetTradeAmount = 0;
                                    }
                                    else if (client.Player.SetTradeAmount > client.Player.Inventory[client.Player.SetTradeItem].Amount && (ItemManager.Items[client.Player.Inventory[myItem].Num].Type == Enums.ItemType.Currency || ItemManager.Items[client.Player.Inventory[myItem].Num].StackCap > 0))
                                    {
                                        Messenger.PlayerMsg(client, "You cannot trade more than you have!", Text.BrightRed);
                                        client.Player.SetTradeItem = -1;
                                        client.Player.SetTradeAmount = 0;
                                    }
                                    else if (tradePartner.Player.FindInvSlot(client.Player.Inventory[myItem].Num) == -1)
                                    {
                                        Messenger.PlayerMsg(client, "The other person does not have enough space to receive this item.", Text.BrightRed);
                                        client.Player.SetTradeItem = -1;
                                        client.Player.SetTradeAmount = 0;
                                    }

                                    if (myItem > -1 && partnersItem > -1)
                                    {

                                        client.Player.ReadyToTrade = true;
                                    }
                                    //TODO: Allow Empty Trading

                                    // Both players have confirmed the trade
                                    if (client.Player.ReadyToTrade && tradePartner.Player.ReadyToTrade)
                                    {
                                        // Start the trade!
                                        int clientItemNum = client.Player.Inventory[client.Player.SetTradeItem].Num;
                                        string clientItemTag = client.Player.Inventory[client.Player.SetTradeItem].Tag;
                                        int clientItemAmount = client.Player.SetTradeAmount;
                                        int partnerItemNum = tradePartner.Player.Inventory[tradePartner.Player.SetTradeItem].Num;
                                        string partnerItemTag = tradePartner.Player.Inventory[tradePartner.Player.SetTradeItem].Tag;
                                        int partnerItemAmount = tradePartner.Player.SetTradeAmount;

                                        tradePartner.Player.ReadyToTrade = false;
                                        client.Player.ReadyToTrade = false;

                                        // Take items from both players.
                                        client.Player.TakeItemSlot(client.Player.SetTradeItem, clientItemAmount, true);
                                        tradePartner.Player.TakeItemSlot(tradePartner.Player.SetTradeItem, partnerItemAmount, true);
                                        // Give items to both players
                                        client.Player.GiveItem(partnerItemNum, partnerItemAmount, partnerItemTag);
                                        tradePartner.Player.GiveItem(clientItemNum, clientItemAmount, clientItemTag);
                                        // Save both players' inventory to prevent cloning!
                                        using (DatabaseConnection dbConnection = new DatabaseConnection(DatabaseID.Players))
                                        {
                                            client.Player.SaveCharacterData(dbConnection);
                                            tradePartner.Player.SaveCharacterData(dbConnection);
                                        }

                                        //Messenger.SendInventoryUpdate(client, client.Player.SetTradeItem);
                                        //Messenger.SendInventoryUpdate(tradePartner, tradePartner.Player.SetTradeItem);

                                        client.Player.SetTradeItem = -1;
                                        client.Player.SetTradeAmount = 0;
                                        tradePartner.Player.SetTradeItem = -1;
                                        tradePartner.Player.SetTradeAmount = 0;

                                        Messenger.SendTradeComplete(client);
                                        Messenger.SendTradeComplete(tradePartner);
                                    }

                                }
                            }
                        }
                        break;
                    case "endplayertrade":
                        {
                            client.Player.EndTrade(true);
                        }
                        break;
                    #endregion
                    #region Tournament
                    case "jointournament":
                        {
                            Tournament tourny = TournamentManager.Tournaments[parse[1]];
                            if (tourny != null)
                            {
                                tourny.RegisterPlayer(client);
                            }
                        }
                        break;
                    case "viewtournamentrules":
                        {
                            Tournament tourny = TournamentManager.Tournaments[parse[1]];
                            if (tourny != null)
                            {
                                Messenger.SendTournamentRulesTo(client, null, tourny);
                            }
                        }
                        break;
                    case "savetournamentrules":
                        {
                            Tournament tourny = client.Player.Tournament;
                            if (tourny != null)
                            {
                                if (tourny.RegisteredMembers[client].Admin)
                                {
                                    tourny.Rules.SleepClause = parse[1].ToBool();
                                    tourny.Rules.AccuracyClause = parse[2].ToBool();
                                    tourny.Rules.SpeciesClause = parse[3].ToBool();
                                    tourny.Rules.FreezeClause = parse[4].ToBool();
                                    tourny.Rules.OHKOClause = parse[5].ToBool();
                                    tourny.Rules.SelfKOClause = parse[6].ToBool();
                                }
                            }
                        }
                        break;
                    case "spectatetournament":
                        {
                            Tournament tourny = TournamentManager.Tournaments[parse[1]];
                            if (client.Player.Tournament != null)
                            {
                                Tournament playerTourny = client.Player.Tournament;
                                playerTourny.RegisteredMembers.Remove(client);
                            }
                            tourny.RegisterSpectator(client);
                        }
                        break;
                    #endregion
                }
                #endregion

            }
        }
コード例 #33
0
        public static void ConvertV3ToV4(int num)
        {
            DataConverter.RDungeons.V4.RDungeon rdungeonV4 = new Server.DataConverter.RDungeons.V4.RDungeon(num);

            DataConverter.RDungeons.V3.RDungeon rdungeonV3 = Server.DataConverter.RDungeons.V3.RDungeonManager.LoadRDungeon(num);

            rdungeonV4.DungeonName = rdungeonV3.DungeonName;
            rdungeonV4.Direction = rdungeonV3.Direction;
            rdungeonV4.MaxFloors = rdungeonV3.MaxFloors;
            rdungeonV4.Recruitment = rdungeonV3.Recruitment;
            rdungeonV4.Exp = rdungeonV3.Exp;
            rdungeonV4.WindTimer = rdungeonV3.WindTimer;
            rdungeonV4.DungeonIndex = 0;

            for (int i = 0; i < rdungeonV3.Floors.Count; i++)
            {
                DataConverter.RDungeons.V4.RDungeonFloor floor = new DataConverter.RDungeons.V4.RDungeonFloor();

                floor.Options.TrapMin = rdungeonV3.Floors[i].Options.TrapMin;
                floor.Options.TrapMax = rdungeonV3.Floors[i].Options.TrapMax;
                floor.Options.ItemMin = 5;
                floor.Options.ItemMax = 8;
                floor.Options.Intricacy = 6;
                floor.Options.RoomWidthMin = rdungeonV3.Floors[i].Options.RoomWidthMin;
                floor.Options.RoomWidthMax = rdungeonV3.Floors[i].Options.RoomWidthMax;
                floor.Options.RoomLengthMin = rdungeonV3.Floors[i].Options.RoomLengthMin;
                floor.Options.RoomLengthMax = rdungeonV3.Floors[i].Options.RoomLengthMax;
                floor.Options.HallTurnMin = rdungeonV3.Floors[i].Options.HallTurnMin;
                floor.Options.HallTurnMax = rdungeonV3.Floors[i].Options.HallTurnMax;
                floor.Options.HallVarMin = rdungeonV3.Floors[i].Options.HallVarMin;
                floor.Options.HallVarMax = rdungeonV3.Floors[i].Options.HallVarMax;
                floor.Options.WaterFrequency = rdungeonV3.Floors[i].Options.WaterFrequency;
                floor.Options.Craters = rdungeonV3.Floors[i].Options.Craters;
                floor.Options.CraterMinLength = rdungeonV3.Floors[i].Options.CraterMinLength;
                floor.Options.CraterMaxLength = rdungeonV3.Floors[i].Options.CraterMaxLength;
                floor.Options.CraterFuzzy = rdungeonV3.Floors[i].Options.CraterFuzzy;
                floor.Options.MinChambers = 0;
                floor.Options.MaxChambers = 0;

                floor.Darkness = -1;
                floor.GoalType = rdungeonV3.Floors[i].GoalType;
                floor.GoalMap = rdungeonV3.Floors[i].GoalMap;
                floor.GoalX = rdungeonV3.Floors[i].GoalX;
                floor.GoalY = rdungeonV3.Floors[i].GoalY;
                floor.Music = rdungeonV3.Floors[i].Music;

                floor.StairsX = rdungeonV3.Floors[i].StairsX;
                floor.StairsSheet = rdungeonV3.Floors[i].StairsSheet;

                floor.mGroundX = rdungeonV3.Floors[i].mGroundX;
                floor.mGroundSheet = rdungeonV3.Floors[i].mGroundSheet;

                floor.mTopLeftX = rdungeonV3.Floors[i].mTopLeftX;
                floor.mTopLeftSheet = rdungeonV3.Floors[i].mTopLeftSheet;
                floor.mTopCenterX = rdungeonV3.Floors[i].mTopCenterX;
                floor.mTopCenterSheet = rdungeonV3.Floors[i].mTopCenterSheet;
                floor.mTopRightX = rdungeonV3.Floors[i].mTopRightX;
                floor.mTopRightSheet = rdungeonV3.Floors[i].mTopRightSheet;

                floor.mCenterLeftX = rdungeonV3.Floors[i].mCenterLeftX;
                floor.mCenterLeftSheet = rdungeonV3.Floors[i].mCenterLeftSheet;
                floor.mCenterCenterX = rdungeonV3.Floors[i].mCenterCenterX;
                floor.mCenterCenterSheet = rdungeonV3.Floors[i].mCenterCenterSheet;
                floor.mCenterRightX = rdungeonV3.Floors[i].mCenterRightX;
                floor.mCenterRightSheet = rdungeonV3.Floors[i].mCenterRightSheet;

                floor.mBottomLeftX = rdungeonV3.Floors[i].mBottomLeftX;
                floor.mBottomLeftSheet = rdungeonV3.Floors[i].mBottomLeftSheet;
                floor.mBottomCenterX = rdungeonV3.Floors[i].mBottomCenterX;
                floor.mBottomCenterSheet = rdungeonV3.Floors[i].mBottomCenterSheet;
                floor.mBottomRightX = rdungeonV3.Floors[i].mBottomRightX;
                floor.mBottomRightSheet = rdungeonV3.Floors[i].mBottomRightSheet;

                floor.mInnerTopLeftX = rdungeonV3.Floors[i].mInnerTopLeftX;
                floor.mInnerTopLeftSheet = rdungeonV3.Floors[i].mInnerTopLeftSheet;
                floor.mInnerBottomLeftX = rdungeonV3.Floors[i].mInnerBottomLeftX;
                floor.mInnerBottomLeftSheet = rdungeonV3.Floors[i].mInnerBottomLeftSheet;
                floor.mInnerTopRightX = rdungeonV3.Floors[i].mInnerTopRightX;
                floor.mInnerTopRightSheet = rdungeonV3.Floors[i].mInnerTopRightSheet;
                floor.mInnerBottomRightX = rdungeonV3.Floors[i].mInnerBottomRightX;
                floor.mInnerBottomRightSheet = rdungeonV3.Floors[i].mInnerBottomRightSheet;

                floor.mIsolatedWallX = rdungeonV3.Floors[i].mIsolatedWallX;
                floor.mIsolatedWallSheet = rdungeonV3.Floors[i].mIsolatedWallSheet;

                floor.mColumnTopX = rdungeonV3.Floors[i].mColumnTopX;
                floor.mColumnTopSheet = rdungeonV3.Floors[i].mColumnTopSheet;
                floor.mColumnCenterX = rdungeonV3.Floors[i].mColumnCenterX;
                floor.mColumnCenterSheet = rdungeonV3.Floors[i].mColumnCenterSheet;
                floor.mColumnBottomX = rdungeonV3.Floors[i].mColumnBottomX;
                floor.mColumnBottomSheet = rdungeonV3.Floors[i].mColumnBottomSheet;

                floor.mRowLeftX = rdungeonV3.Floors[i].mRowLeftX;
                floor.mRowLeftSheet = rdungeonV3.Floors[i].mRowLeftSheet;
                floor.mRowCenterX = rdungeonV3.Floors[i].mRowCenterX;
                floor.mRowCenterSheet = rdungeonV3.Floors[i].mRowCenterSheet;
                floor.mRowRightX = rdungeonV3.Floors[i].mRowRightX;
                floor.mRowRightSheet = rdungeonV3.Floors[i].mRowRightSheet;

                floor.mGroundAltX= rdungeonV3.Floors[i].mGroundAltX;
                floor.mGroundAltSheet = rdungeonV3.Floors[i].mGroundAltSheet;
                floor.mGroundAlt2X = rdungeonV3.Floors[i].mGroundAlt2X;
                floor.mGroundAlt2Sheet = rdungeonV3.Floors[i].mGroundAlt2Sheet;

                floor.mTopLeftAltX= rdungeonV3.Floors[i].mTopLeftAltX;
                floor.mTopLeftAltSheet = rdungeonV3.Floors[i].mTopLeftAltSheet;
                floor.mTopCenterAltX= rdungeonV3.Floors[i].mTopCenterAltX;
                floor.mTopCenterAltSheet = rdungeonV3.Floors[i].mTopCenterAltSheet;
                floor.mTopRightAltX= rdungeonV3.Floors[i].mTopRightAltX;
                floor.mTopRightAltSheet = rdungeonV3.Floors[i].mTopRightAltSheet;

                floor.mCenterLeftAltX= rdungeonV3.Floors[i].mCenterLeftAltX;
                floor.mCenterLeftAltSheet = rdungeonV3.Floors[i].mCenterLeftAltSheet;
                floor.mCenterCenterAltX= rdungeonV3.Floors[i].mCenterCenterAltX;
                floor.mCenterCenterAltSheet = rdungeonV3.Floors[i].mCenterCenterAltSheet;
                floor.mCenterCenterAlt2X = rdungeonV3.Floors[i].mCenterCenterAlt2X;
                floor.mCenterCenterAlt2Sheet = rdungeonV3.Floors[i].mCenterCenterAlt2Sheet;
                floor.mCenterRightAltX= rdungeonV3.Floors[i].mCenterRightAltX;
                floor.mCenterRightAltSheet = rdungeonV3.Floors[i].mCenterRightAltSheet;

                floor.mBottomLeftAltX= rdungeonV3.Floors[i].mBottomLeftAltX;
                floor.mBottomLeftAltSheet = rdungeonV3.Floors[i].mBottomLeftAltSheet;
                floor.mBottomCenterAltX= rdungeonV3.Floors[i].mBottomCenterAltX;
                floor.mBottomCenterAltSheet = rdungeonV3.Floors[i].mBottomCenterAltSheet;
                floor.mBottomRightAltX= rdungeonV3.Floors[i].mBottomRightAltX;
                floor.mBottomRightAltSheet = rdungeonV3.Floors[i].mBottomRightAltSheet;

                floor.mInnerTopLeftAltX= rdungeonV3.Floors[i].mInnerTopLeftAltX;
                floor.mInnerTopLeftAltSheet = rdungeonV3.Floors[i].mInnerTopLeftAltSheet;
                floor.mInnerBottomLeftAltX= rdungeonV3.Floors[i].mInnerBottomLeftAltX;
                floor.mInnerBottomLeftAltSheet = rdungeonV3.Floors[i].mInnerBottomLeftAltSheet;
                floor.mInnerTopRightAltX= rdungeonV3.Floors[i].mInnerTopRightAltX;
                floor.mInnerTopRightAltSheet = rdungeonV3.Floors[i].mInnerTopRightAltSheet;
                floor.mInnerBottomRightAltX= rdungeonV3.Floors[i].mInnerBottomRightAltX;
                floor.mInnerBottomRightAltSheet = rdungeonV3.Floors[i].mInnerBottomRightAltSheet;

                floor.mIsolatedWallAltX= rdungeonV3.Floors[i].mIsolatedWallAltX;
                floor.mIsolatedWallAltSheet = rdungeonV3.Floors[i].mIsolatedWallAltSheet;

                floor.mColumnTopAltX= rdungeonV3.Floors[i].mColumnTopAltX;
                floor.mColumnTopAltSheet = rdungeonV3.Floors[i].mColumnTopAltSheet;
                floor.mColumnCenterAltX= rdungeonV3.Floors[i].mColumnCenterAltX;
                floor.mColumnCenterAltSheet = rdungeonV3.Floors[i].mColumnCenterAltSheet;
                floor.mColumnBottomAltX= rdungeonV3.Floors[i].mColumnBottomAltX;
                floor.mColumnBottomAltSheet = rdungeonV3.Floors[i].mColumnBottomAltSheet;

                floor.mRowLeftAltX= rdungeonV3.Floors[i].mRowLeftAltX;
                floor.mRowLeftAltSheet = rdungeonV3.Floors[i].mRowLeftAltSheet;
                floor.mRowCenterAltX= rdungeonV3.Floors[i].mRowCenterAltX;
                floor.mRowCenterAltSheet = rdungeonV3.Floors[i].mRowCenterAltSheet;
                floor.mRowRightAltX= rdungeonV3.Floors[i].mRowRightAltX;
                floor.mRowRightAltSheet = rdungeonV3.Floors[i].mRowRightAltSheet;

                floor.mWaterX = rdungeonV3.Floors[i].mWaterX;
                floor.mWaterSheet = rdungeonV3.Floors[i].mWaterSheet;
                floor.mWaterAnimX = rdungeonV3.Floors[i].mWaterAnimX;
                floor.mWaterAnimSheet = rdungeonV3.Floors[i].mWaterAnimSheet;

                floor.mShoreTopLeftX = rdungeonV3.Floors[i].mShoreTopLeftX;
                floor.mShoreTopLeftSheet = rdungeonV3.Floors[i].mShoreTopLeftSheet;
                floor.mShoreTopRightX = rdungeonV3.Floors[i].mShoreTopRightX;
                floor.mShoreTopRightSheet = rdungeonV3.Floors[i].mShoreTopRightSheet;
                floor.mShoreBottomRightX = rdungeonV3.Floors[i].mShoreBottomRightX;
                floor.mShoreBottomRightSheet = rdungeonV3.Floors[i].mShoreBottomRightSheet;
                floor.mShoreBottomLeftX = rdungeonV3.Floors[i].mShoreBottomLeftX;
                floor.mShoreBottomLeftSheet = rdungeonV3.Floors[i].mShoreBottomLeftSheet;
                floor.mShoreDiagonalForwardX = rdungeonV3.Floors[i].mShoreDiagonalForwardX;
                floor.mShoreDiagonalForwardSheet = rdungeonV3.Floors[i].mShoreDiagonalForwardSheet;
                floor.mShoreDiagonalBackX = rdungeonV3.Floors[i].mShoreDiagonalBackX;
                floor.mShoreDiagonalBackSheet = rdungeonV3.Floors[i].mShoreDiagonalBackSheet;
                floor.mShoreTopX = rdungeonV3.Floors[i].mShoreTopX;
                floor.mShoreTopSheet = rdungeonV3.Floors[i].mShoreTopSheet;
                floor.mShoreRightX = rdungeonV3.Floors[i].mShoreRightX;
                floor.mShoreRightSheet = rdungeonV3.Floors[i].mShoreRightSheet;
                floor.mShoreBottomX = rdungeonV3.Floors[i].mShoreBottomX;
                floor.mShoreBottomSheet = rdungeonV3.Floors[i].mShoreBottomSheet;
                floor.mShoreLeftX = rdungeonV3.Floors[i].mShoreLeftX;
                floor.mShoreLeftSheet = rdungeonV3.Floors[i].mShoreLeftSheet;
                floor.mShoreVerticalX = rdungeonV3.Floors[i].mShoreVerticalX;
                floor.mShoreVerticalSheet = rdungeonV3.Floors[i].mShoreVerticalSheet;
                floor.mShoreHorizontalX = rdungeonV3.Floors[i].mShoreHorizontalX;
                floor.mShoreHorizontalSheet = rdungeonV3.Floors[i].mShoreHorizontalSheet;
                floor.mShoreInnerTopLeftX = rdungeonV3.Floors[i].mShoreInnerTopLeftX;
                floor.mShoreInnerTopLeftSheet = rdungeonV3.Floors[i].mShoreInnerTopLeftSheet;
                floor.mShoreInnerTopRightX = rdungeonV3.Floors[i].mShoreInnerTopRightX;
                floor.mShoreInnerTopRightSheet = rdungeonV3.Floors[i].mShoreInnerTopRightSheet;
                floor.mShoreInnerBottomRightX = rdungeonV3.Floors[i].mShoreInnerBottomRightX;
                floor.mShoreInnerBottomRightSheet = rdungeonV3.Floors[i].mShoreInnerBottomRightSheet;
                floor.mShoreInnerBottomLeftX = rdungeonV3.Floors[i].mShoreInnerBottomLeftX;
                floor.mShoreInnerBottomLeftSheet = rdungeonV3.Floors[i].mShoreInnerBottomLeftSheet;
                floor.mShoreInnerTopX = rdungeonV3.Floors[i].mShoreInnerTopX;
                floor.mShoreInnerTopSheet = rdungeonV3.Floors[i].mShoreInnerTopSheet;
                floor.mShoreInnerRightX = rdungeonV3.Floors[i].mShoreInnerRightX;
                floor.mShoreInnerRightSheet = rdungeonV3.Floors[i].mShoreInnerRightSheet;
                floor.mShoreInnerBottomX = rdungeonV3.Floors[i].mShoreInnerBottomX;
                floor.mShoreInnerBottomSheet = rdungeonV3.Floors[i].mShoreInnerBottomSheet;
                floor.mShoreInnerLeftX = rdungeonV3.Floors[i].mShoreInnerLeftX;
                floor.mShoreInnerLeftSheet = rdungeonV3.Floors[i].mShoreInnerLeftSheet;
                floor.mShoreSurroundedX = rdungeonV3.Floors[i].mShoreSurroundedX;
                floor.mShoreSurroundedSheet = rdungeonV3.Floors[i].mShoreSurroundedSheet;

                floor.mShoreTopLeftAnimX = rdungeonV3.Floors[i].mShoreTopLeftAnimX;
                floor.mShoreTopLeftAnimSheet = rdungeonV3.Floors[i].mShoreTopLeftAnimSheet;
                floor.mShoreTopRightAnimX = rdungeonV3.Floors[i].mShoreTopRightAnimX;
                floor.mShoreTopRightAnimSheet = rdungeonV3.Floors[i].mShoreTopRightAnimSheet;
                floor.mShoreBottomRightAnimX = rdungeonV3.Floors[i].mShoreBottomRightAnimX;
                floor.mShoreBottomRightAnimSheet = rdungeonV3.Floors[i].mShoreBottomRightAnimSheet;
                floor.mShoreBottomLeftAnimX = rdungeonV3.Floors[i].mShoreBottomLeftAnimX;
                floor.mShoreBottomLeftAnimSheet = rdungeonV3.Floors[i].mShoreBottomLeftAnimSheet;
                floor.mShoreDiagonalForwardAnimX = rdungeonV3.Floors[i].mShoreDiagonalForwardAnimX;
                floor.mShoreDiagonalForwardAnimSheet = rdungeonV3.Floors[i].mShoreDiagonalForwardAnimSheet;
                floor.mShoreDiagonalBackAnimX = rdungeonV3.Floors[i].mShoreDiagonalBackAnimX;
                floor.mShoreDiagonalBackAnimSheet = rdungeonV3.Floors[i].mShoreDiagonalBackAnimSheet;
                floor.mShoreTopAnimX = rdungeonV3.Floors[i].mShoreTopAnimX;
                floor.mShoreTopAnimSheet = rdungeonV3.Floors[i].mShoreTopAnimSheet;
                floor.mShoreRightAnimX = rdungeonV3.Floors[i].mShoreRightAnimX;
                floor.mShoreRightAnimSheet = rdungeonV3.Floors[i].mShoreRightAnimSheet;
                floor.mShoreBottomAnimX = rdungeonV3.Floors[i].mShoreBottomAnimX;
                floor.mShoreBottomAnimSheet = rdungeonV3.Floors[i].mShoreBottomAnimSheet;
                floor.mShoreLeftAnimX = rdungeonV3.Floors[i].mShoreLeftAnimX;
                floor.mShoreLeftAnimSheet = rdungeonV3.Floors[i].mShoreLeftAnimSheet;
                floor.mShoreVerticalAnimX = rdungeonV3.Floors[i].mShoreVerticalAnimX;
                floor.mShoreVerticalAnimSheet = rdungeonV3.Floors[i].mShoreVerticalAnimSheet;
                floor.mShoreHorizontalAnimX = rdungeonV3.Floors[i].mShoreHorizontalAnimX;
                floor.mShoreHorizontalAnimSheet = rdungeonV3.Floors[i].mShoreHorizontalAnimSheet;
                floor.mShoreInnerTopLeftAnimX = rdungeonV3.Floors[i].mShoreInnerTopLeftAnimX;
                floor.mShoreInnerTopLeftAnimSheet = rdungeonV3.Floors[i].mShoreInnerTopLeftAnimSheet;
                floor.mShoreInnerTopRightAnimX = rdungeonV3.Floors[i].mShoreInnerTopRightAnimX;
                floor.mShoreInnerTopRightAnimSheet = rdungeonV3.Floors[i].mShoreInnerTopRightAnimSheet;
                floor.mShoreInnerBottomRightAnimX = rdungeonV3.Floors[i].mShoreInnerBottomRightAnimX;
                floor.mShoreInnerBottomRightAnimSheet = rdungeonV3.Floors[i].mShoreInnerBottomRightAnimSheet;
                floor.mShoreInnerBottomLeftAnimX = rdungeonV3.Floors[i].mShoreInnerBottomLeftAnimX;
                floor.mShoreInnerBottomLeftAnimSheet = rdungeonV3.Floors[i].mShoreInnerBottomLeftAnimSheet;
                floor.mShoreInnerTopAnimX = rdungeonV3.Floors[i].mShoreInnerTopAnimX;
                floor.mShoreInnerTopAnimSheet = rdungeonV3.Floors[i].mShoreInnerTopAnimSheet;
                floor.mShoreInnerRightAnimX = rdungeonV3.Floors[i].mShoreInnerRightAnimX;
                floor.mShoreInnerRightAnimSheet = rdungeonV3.Floors[i].mShoreInnerRightAnimSheet;
                floor.mShoreInnerBottomAnimX = rdungeonV3.Floors[i].mShoreInnerBottomAnimX;
                floor.mShoreInnerBottomAnimSheet = rdungeonV3.Floors[i].mShoreInnerBottomAnimSheet;
                floor.mShoreInnerLeftAnimX = rdungeonV3.Floors[i].mShoreInnerLeftAnimX;
                floor.mShoreInnerLeftAnimSheet = rdungeonV3.Floors[i].mShoreInnerLeftAnimSheet;
                floor.mShoreSurroundedAnimX = rdungeonV3.Floors[i].mShoreSurroundedAnimX;
                floor.mShoreSurroundedAnimSheet = rdungeonV3.Floors[i].mShoreSurroundedAnimSheet;

                floor.GroundTile = rdungeonV3.Floors[i].GroundTile;
                floor.HallTile = rdungeonV3.Floors[i].HallTile;
                floor.WaterTile = rdungeonV3.Floors[i].WaterTile;
                floor.WallTile = rdungeonV3.Floors[i].WallTile;

                floor.NpcSpawnTime = rdungeonV3.Floors[i].NpcSpawnTime;
                floor.NpcMin = rdungeonV3.Floors[i].NpcMin;
                floor.NpcMax = rdungeonV3.Floors[i].NpcMax;

                RDungeons.V4.RDungeonItem item;
                MapNpcPreset npc;
                RDungeons.V4.RDungeonTrap specialTile;

                for (int j = 0; j < rdungeonV3.Floors[i].Items.Count; j++)
                {
                    if (rdungeonV3.Floors[i].Items[j].ItemNum > 0)
                    {
                        item = new RDungeons.V4.RDungeonItem();
                        item.ItemNum = rdungeonV3.Floors[i].Items[j].ItemNum;
                        item.MinAmount = rdungeonV3.Floors[i].Items[j].MinAmount;
                        item.MaxAmount = rdungeonV3.Floors[i].Items[j].MaxAmount;
                        item.AppearanceRate = rdungeonV3.Floors[i].Items[j].AppearanceRate;
                        item.StickyRate = rdungeonV3.Floors[i].Items[j].StickyRate;
                        item.Tag = rdungeonV3.Floors[i].Items[j].Tag;
                        item.Hidden = rdungeonV3.Floors[i].Items[j].Hidden;
                        item.OnGround = rdungeonV3.Floors[i].Items[j].OnGround;
                        item.OnWater = rdungeonV3.Floors[i].Items[j].OnWater;
                        item.OnWall = rdungeonV3.Floors[i].Items[j].OnWall;
                        floor.Items.Add(item);
                    }

                }
                for (int j = 0; j < rdungeonV3.Floors[i].Npcs.Count; j++)
                {
                    if (rdungeonV3.Floors[i].Npcs[j].NpcNum > 0)
                    {
                        npc = new MapNpcPreset();
                        npc.NpcNum = rdungeonV3.Floors[i].Npcs[j].NpcNum;
                        npc.MinLevel = rdungeonV3.Floors[i].Npcs[j].MinLevel;
                        npc.MaxLevel = rdungeonV3.Floors[i].Npcs[j].MinLevel;
                        npc.AppearanceRate = rdungeonV3.Floors[i].Npcs[j].AppearanceRate;
                        floor.Npcs.Add(npc);
                    }

                }
                foreach (Tile j in rdungeonV3.Floors[i].SpecialTiles)
                {
                    specialTile = new RDungeons.V4.RDungeonTrap();
                    specialTile.SpecialTile = j;
                    specialTile.AppearanceRate = 100;
                    floor.SpecialTiles.Add(specialTile);
                }

                foreach (Enums.Weather j in rdungeonV3.Floors[i].Weather)
                {
                    floor.Weather.Add(j);
                }

                rdungeonV4.Floors.Add(floor);
            }

            Server.DataConverter.RDungeons.V4.RDungeonManager.SaveRDungeon(rdungeonV4, num);
        }