Ejemplo n.º 1
0
		public GameKeepHookPoint(DBKeepHookPoint dbhookPoint, GameKeepComponent component)
		{
			double angle = component.AbstractKeep.Heading * ((Math.PI * 2) / 360); // angle*2pi/360;
			switch (component.ComponentHeading)
			{
				case 0:
					X = (int)(component.X + Math.Cos(angle) * dbhookPoint.X + Math.Sin(angle) * dbhookPoint.Y);
					Y = (int)(component.Y - Math.Cos(angle) * dbhookPoint.Y + Math.Sin(angle) * dbhookPoint.X);
					break;
				case 1:
					X = (int)(component.X + Math.Cos(angle) * dbhookPoint.Y - Math.Sin(angle) * dbhookPoint.X);
					Y = (int)(component.Y + Math.Cos(angle) * dbhookPoint.X + Math.Sin(angle) * dbhookPoint.Y);
					break;
				case 2:
					X = (int)(component.X - Math.Cos(angle) * dbhookPoint.X - Math.Sin(angle) * dbhookPoint.Y);
					Y = (int)(component.Y + Math.Cos(angle) * dbhookPoint.Y - Math.Sin(angle) * dbhookPoint.X);
					break;
				case 3:
					X = (int)(component.X - Math.Cos(angle) * dbhookPoint.Y + Math.Sin(angle) * dbhookPoint.X);
					Y = (int)(component.Y - Math.Cos(angle) * dbhookPoint.X - Math.Sin(angle) * dbhookPoint.Y);
					break;
			}
			this.Z = component.Z + dbhookPoint.Z;
			this.Heading = (ushort)(component.Heading + dbhookPoint.Heading);
			this.m_index = dbhookPoint.HookPointID;
			this.Component = component;
			m_hookpointTimer = new HookpointTimer(this, this.Component);
		}
Ejemplo n.º 2
0
		public void OnCommand(GameClient client, string[] args)
		{
			if (args.Length < 3)
			{
				DisplaySyntax(client);
				return;
			}
			int id = 0;
			int skin = 0;
			try
			{
				GameKeepComponent comp = client.Player.TargetObject as GameKeepComponent;
				if (comp == null)
				{
					DisplayMessage(client, LanguageMgr.GetTranslation(client.Account.Language, "GMCommands.HookPoint.NoGKCTarget"));
					return;
				}
				skin = Convert.ToInt32(args[1]);
				id = Convert.ToInt32(args[2]);
				DBKeepHookPoint dbkeephp = new DBKeepHookPoint();
				dbkeephp.HookPointID = id;
				dbkeephp.KeepComponentSkinID = skin;
				dbkeephp.X = client.Player.X - comp.X;
				dbkeephp.Y = client.Player.Y - comp.Y;
				dbkeephp.Z = client.Player.Z - comp.Z;
				dbkeephp.Heading = client.Player.Heading - comp.Heading;
				GameServer.Database.AddObject(dbkeephp);
			}
			catch (Exception e)
			{
				DisplayMessage(client, LanguageMgr.GetTranslation(client.Account.Language, "GMCommands.Error", e.Message));
			}
		}