Add in your Jump handler, before assigning the new coordinates:
The intersection methods used (taken from [Only registered and activated users can see links. Click Here To Register...]):
Of course, you need to use your own methods for checking if the guild gates were opened, and your own client pullback method, don't post things like "not work".
Code:
#region Guild War walls jump
if (client.Map.MapID == 1038)
{
Rectangle GuildWarWallsRectange = new Rectangle(0, 0, 223, 211);
Point LeftGateEntranceLeft = new Point(164, 212);
Point LeftGateEntranceRight = new Point(168, 212);
Point LeftGateExitLeft = new Point(149, 201);
Point LeftGateExitRight = new Point(168, 201);
Point RightGateEntranceDown = new Point(224, 182);
Point RightGateEntranceUp = new Point(224, 177);
Point RightGateExitDown = new Point(214, 178);
Point RightGateExitUp = new Point(214, 166);
if ((GuildWarWallsRectange.Contains(new Point(JumpX,JumpY)) && !GuildWarWallsRectange.Contains(new Point(client.X, client.Y))) ||
(!GuildWarWallsRectange.Contains(new Point(JumpX, JumpY)) && (GuildWarWallsRectange.Contains(new Point(client.X, client.Y)) && client.X != 216 && client.Y != 203)))
{
#region jump from one side to the other of the walls
Point startJump = new Point(client.X, client.Y);
Point endJump = new Point(JumpX, JumpY);
bool jumpThroughLeftGate = false;
bool jumpThroughRightGate = false;
if (Tournaments.GuildWars.GW.LeftGateOpen)
{
jumpThroughLeftGate = DoLinesIntersect(startJump, endJump, LeftGateEntranceLeft, LeftGateEntranceRight) || DoLinesIntersect(startJump, endJump, LeftGateExitLeft, LeftGateExitRight);
}
if (Tournaments.GuildWars.GW.RightGateOpen)
{
jumpThroughRightGate = DoLinesIntersect(startJump, endJump, RightGateEntranceDown, RightGateEntranceUp) || DoLinesIntersect(startJump, endJump, RightGateExitDown, RightGateEntranceUp);
}
if (!jumpThroughRightGate && !jumpThroughLeftGate)
{
client.Pullback(false);
return;
}
#endregion
}
}
#endregion
The intersection methods used (taken from [Only registered and activated users can see links. Click Here To Register...]):
Code:
/// <summary>
/// Tests if two line segments intersect or not.
public static bool DoLinesIntersect(Point p1, Point p2, Point p3, Point p4)
{
// Get the segments' parameters.
float dx12 = p2.X - p1.X;
float dy12 = p2.Y - p1.Y;
float dx34 = p4.X - p3.X;
float dy34 = p4.Y - p3.Y;
// Solve for t1 and t2
float denominator = (dy12 * dx34 - dx12 * dy34);
float t1 =
((p1.X - p3.X) * dy34 + (p3.Y - p1.Y) * dx34)
/ denominator;
if (float.IsInfinity(t1))
{
// The lines are parallel (or close enough to it).
return false;
}
float t2 =
((p3.X - p1.X) * dy12 + (p1.Y - p3.Y) * dx12)
/ -denominator;
// The segments intersect if t1 and t2 are between 0 and 1.
return
((t1 >= 0) && (t1 <= 1) &&
(t2 >= 0) && (t2 <= 1));
}
Of course, you need to use your own methods for checking if the guild gates were opened, and your own client pullback method, don't post things like "not work".