Beispiel #1
0
        public void HouseAdmin(GamePlayer player, string [] args)
        {
            if (player.Client.Account.PrivLevel == (int)ePrivLevel.Admin)
            {
                if (args[1].ToLower() == "restart")
                {
                    HouseMgr.Start(player.Client);
                    return;
                }

                if (args[1].ToLower() == "addhookpoints")
                {
                    if (player.TempProperties.getProperty <bool>(HousingConstants.AllowAddHouseHookpoint, false))
                    {
                        player.TempProperties.removeProperty(HousingConstants.AllowAddHouseHookpoint);
                        DisplayMessage(player.Client, "Add hookpoints turned off!");
                    }
                    else
                    {
                        player.TempProperties.setProperty(HousingConstants.AllowAddHouseHookpoint, true);
                        DisplayMessage(player.Client, "Add hookpoints turned on!");
                    }

                    return;
                }
            }

            ArrayList houses = (ArrayList)HouseMgr.GetHousesCloseToSpot(player.CurrentRegionID, (int)player.Position.X, (int)player.Position.Y, 700);

            if (houses.Count != 1)
            {
                DisplayMessage(player.Client, "You need to stand closer to a house!");
                return;
            }

            if (args[1].ToLower() == "info")
            {
                (houses[0] as House).SendHouseInfo(player);
                return;
            }

            // The following commands are for Admins only

            if (player.Client.Account.PrivLevel != (int)ePrivLevel.Admin)
            {
                return;
            }

            if (args[1].ToLower() == "model")
            {
                int newModel = Convert.ToInt32(args[2]);

                if (newModel < 1 || newModel > 12)
                {
                    DisplayMessage(player.Client, "Valid house models are 1 - 12!");
                    return;
                }

                if (houses.Count == 1 && newModel != (houses[0] as House).Model)
                {
                    HouseMgr.RemoveHouseItems(houses[0] as House);
                    (houses[0] as House).Model = newModel;
                    (houses[0] as House).SaveIntoDatabase();
                    (houses[0] as House).SendUpdate();

                    DisplayMessage(player.Client, "House model changed to " + newModel + "!");
                    GameServer.Instance.LogGMAction(player.Name + " changed house #" + (houses[0] as House).HouseNumber + " model to " + newModel);
                }

                return;
            }

            if (args[1].ToLower() == "remove")
            {
                string confirm = "";

                if (args.Length > 2)
                {
                    confirm = args[2];
                }

                if (confirm != "YES")
                {
                    DisplayMessage(player.Client, "You must confirm this removal with 'YES'");
                    return;
                }

                if (houses.Count == 1)
                {
                    HouseMgr.RemoveHouse(houses[0] as House);
                    DisplayMessage(player.Client, "House removed!");
                    GameServer.Instance.LogGMAction(player.Name + " removed house #" + (houses[0] as House).HouseNumber);
                }

                return;
            }
        }