示例#1
0
        public void setproperty(Client player, int id, string msg)
        {
            AccountController account = player.getData("ACCOUNT");

            if (account == null)
            {
                return;
            }
            if (!AdminController.AdminRankCheck("setproperty", account))
            {
                return;
            }

            PropertyController PropertyController = EntityManager.GetProperty(id);

            if (PropertyController == null)
            {
                API.sendNotificationToPlayer(player, "You specified an invalid property.");
                return;
            }

            if (msg.ToLower() == "interior")
            {
                PropertyController.PropertyData.IntPosX = player.position.X;
                PropertyController.PropertyData.IntPosY = player.position.Y;
                PropertyController.PropertyData.IntPosZ = player.position.Z;

                PropertyController.InteriorMarker.position    = player.position - new Vector3(0.0f, 0.0f, 1.0f);
                PropertyController.InteriorTextLabel.position = player.position + new Vector3(0.0f, 0.0f, 0.5f);
                API.deleteColShape(PropertyController.InteteriorColShape);
                PropertyController.CreateColShape();
                ContextFactory.Instance.SaveChanges();
            }
            else if (msg.ToLower() == "exterior")
            {
                PropertyController.PropertyData.ExtPosX = player.position.X;
                PropertyController.PropertyData.ExtPosY = player.position.Y;
                PropertyController.PropertyData.ExtPosZ = player.position.Z;

                PropertyController.ExteriorMarker.position    = player.position - new Vector3(0.0f, 0.0f, 1.0f);
                PropertyController.ExteriorTextLabel.position = player.position + new Vector3(0.0f, 0.0f, 0.5f);
                API.deleteColShape(PropertyController.ExteriorColShape);
                PropertyController.CreateColShape();
                ContextFactory.Instance.SaveChanges();
            }
            else if (msg.ToLower() == "ipl")
            {
                PropertyController.PropertyData.IPL = msg;
                ContextFactory.Instance.SaveChanges();
            }
            else if (msg.ToLower() == "enterable")
            {
                bool IsEnterable = PropertyController.PropertyData.Enterable;
                PropertyController.PropertyData.Enterable = !IsEnterable;
                API.sendChatMessageToPlayer(player, "You set the property to: " + (IsEnterable ? "Enterable" : "Closed"));
                ContextFactory.Instance.SaveChanges();
            }
            else
            {
                API.sendChatMessageToPlayer(player, "~r~ERROR: ~w~You specified an invalid option.");
            }
        }