Пример #1
0
		public static bool AddNewOffset(HouseHookpointOffset o)
		{
			if (o.HookpointID <= HousingConstants.MaxHookpointLocations)
			{
				HousingConstants.RelativeHookpointsCoords[o.HouseModel][o.HookpointID] = new[] {o.X, o.Y, o.Z, o.Heading};
				return true;
			}

			log.Error("[Housing]: HouseHookPointOffset exceeds array size.  Model " + o.HouseModel + ", hookpoint " + o.HookpointID);

			return false;
		}
		/// <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.");
			}
		}