Ejemplo n.º 1
0
        /// <summary>
        /// Does the player want to Log the offset location of the missing housepoint
        /// </summary>
        /// <param name="player">The player</param>
        /// <param name="response">1 = yes 0 = no</param>
        private void LogLocation(GamePlayer player, byte response)
        {
            if (response != 0x01)
            {
                return;
            }

            if (player.CurrentHouse == null)
            {
                return;
            }

            var a = new HouseHookpointOffset
            {
                HouseModel  = player.CurrentHouse.Model,
                HookpointID = _position,
                X           = player.X - player.CurrentHouse.X,
                Y           = player.Y - player.CurrentHouse.Y,
                Z           = player.Z - 25000,
                Heading     = player.Heading - player.CurrentHouse.Heading
            };

            if (GameServer.Database.AddObject(a) && House.AddNewOffset(a))
            {
                ChatUtil.SendSystemMessage(player, "Scripts.Player.Housing.HookPointLogged", _position);

                string action = string.Format("HOUSING: {0} logged new HouseHookpointOffset for model {1}, position {2}, offset {3}, {4}, {5}",
                                              player.Name, a.HouseModel, a.HookpointID, a.X, a.Y, a.Z);

                log.Debug(action);
                GameServer.Instance.LogGMAction(action);
            }
            else
            {
                log.Error(
                    string.Format(
                        "HOUSING: Player {0} error adding HouseHookpointOffset for model {1}, position {2}, offset {3}, {4}, {5}",
                        player.Name, a.HouseModel, a.HookpointID, a.X, a.Y, a.Z));

                ChatUtil.SendSystemMessage(player, "Error adding position " + _position + ", error recorded in server error Log.");
            }
        }