Beispiel #1
0
 //取得最近目標
 public GVOCall.CityInfo.TargetInfo GetClosestTarget(int User, string NpcName, string NpcName2, string NpcName3, string NpcName4)
 {
     GVOCall.CityInfo.TargetInfo Target = new GVOCall.CityInfo.TargetInfo();
     if (Form1.UsingProcess[User].CityNo != -1)
     {
         float Target_Distance, Min_Distance = 999999;
         for (int NPC_Index = 0; NPC_Index < GVOCall.City[Form1.UsingProcess[User].CityNo]._NPCInfo.Length; NPC_Index++)
         {
             if (GVOCall.City[Form1.UsingProcess[User].CityNo]._NPCInfo[NPC_Index].ID == 0)
             {
                 break;
             }
             else if (GVOCall.City[Form1.UsingProcess[User].CityNo]._NPCInfo[NPC_Index].Name == NpcName || GVOCall.City[Form1.UsingProcess[User].CityNo]._NPCInfo[NPC_Index].Name == NpcName2 || GVOCall.City[Form1.UsingProcess[User].CityNo]._NPCInfo[NPC_Index].Name == NpcName3 || GVOCall.City[Form1.UsingProcess[User].CityNo]._NPCInfo[NPC_Index].Name == NpcName4)
             {
                 Target_Distance = Call.Distance(Call.GetCoordinate(Form1.UsingProcess[User].hWnd), GVOCall.City[Form1.UsingProcess[User].CityNo]._NPCInfo[NPC_Index].Coordinate);
                 //最近的目標
                 if (Min_Distance > Target_Distance)
                 {
                     Target = GVOCall.City[Form1.UsingProcess[User].CityNo]._NPCInfo[NPC_Index];
                 }
             }
         }
     }
     return(Target);
 }
Beispiel #2
0
 public bool GoToNPC(int User, GVOCall.CityInfo.TargetInfo target)
 {
     if (target.Coordinate.IsEmpty)
     {
         return(false);
     }
     else if (Call.Distance(Call.GetTCoordinate(Form1.UsingProcess[User].hWnd), target.Coordinate) > 550)
     {
         if (Form1.UsingProcess[User].Place == 0xC)
         {
             Call.MoveNearbyCoordinate(Form1.UsingProcess[User].hWnd, target.Coordinate, true);
         }
         else
         {
             Console.WriteLine(target.Coordinate + " " + target.cos + "   " + target.sin);
             PointF coordinate = new PointF(target.Coordinate.X + (target.cos > 0 ? 350 : -350) + new Random().Next((int)target.cos * -200, (int)target.cos * 200), target.Coordinate.Y + (target.sin > 0 ? 350 : -350) + new Random().Next((int)target.sin * -200, (int)target.sin * 200));
             Console.WriteLine(coordinate);
             Call.MoveCoordinate(Form1.UsingProcess[User].hWnd, coordinate, true);
         }
     }
     else
     {
         if (!Call.CoordinateChange(Form1.UsingProcess[User].hWnd))
         {
             if (Form1.UsingProcess[User].Place != 0xC && Call.CheckWindows(Form1.UsingProcess[User].hWnd) == null)
             {
                 if (Call.Distance(Call.GetTCoordinate(Form1.UsingProcess[User].hWnd), target.Coordinate) > 250)
                 {
                     Call.MoveNearbyCoordinate(Form1.UsingProcess[User].hWnd, target.Coordinate, true);
                 }
             }
             return(true);
         }
     }
     return(false);
 }