Packet Structure for Tempest Blade, Vortex and bomb for pirate

03/26/2013 07:33 xmen01235#1
Anyone knows the packet structure of those skills being mentioned above. I mean the packet that send the character to certain coordinate once these skills will be activated.
04/01/2013 12:28 xmen01235#2
Figure it out already, it is just a matter of trigonometric formula.

DeltaY= CurrentY - TargetY
DeltaX= CurrentX- TargetX
Slope = DeltaY/DeltaX
Angle = Inv(tan(Slope))

DeltaYfinal=Maxdistance*sin(Angle)=CurrentY - FinalY
Therefore, FinalY=CurrentY - Maxdistance*sin(Angle)

DeltaXfinal=Maxdistance*cos(Angle)=CurrentX - FinalX
Therefore, FinalX=CurrentX - Maxdistance*cos(Angle)

For Tempest Blade Maxdistance = 10.

I will post the code later when I will reach home.

Code:
        
Public class coords
{
      private int _x;
      private int _y;
      
      public coords(){}
      ~coords(){}

      public int X
      {
            get{return this._x;}
            set{this._x=value;} 
      }
      public int Y
      {
            get{return this._y;}
            set{this._y=value;} 
      }

}

private static coords GetTempestBladeCoord(ushort X1, ushort X2, ushort Y1, ushort Y2, byte MaxDistance)
{
     coords tmp = new coords();
     double dx = X1 - X2, dy = Y1 - Y2;
     double angle;
            
     if (dx == 0) angle = 90;
     else if (dy == 0) angle = 0;
     else angle = Math.Atan(Math.Abs(dy) / Math.Abs(dx)) * 180 / Math.PI;
            
     double dxf = Math.Round(Math.Cos(angle * Math.PI / 180) * (double)MaxDistance);
     double dyf = Math.Round(Math.Sin(angle * Math.PI / 180) * (double)MaxDistance);

     if (X1 > X2) tmp.X = (int)((double)X1 - dxf);              
     else tmp.X = (int)((double)X1 + dxf);

     if (Y1 > Y2) tmp.Y = (int)((double)Y1 - dyf);
     else tmp.Y = (int)((double)Y1 + dyf);

     return tmp;
}
Application:
Code:
coords tmpcoord = GetTempestBladeCoord(myHero.CoordX, maction.AimX, myHero.CoordY, maction.AimY, 10);