• Visit Rebornbuddy
  • Visit Panda Profiles
  • Visit LLamamMagic
  • [Plugin] Ant Radar

    Discussion in 'Archives' started by XantX, Oct 5, 2014.

    Thread Status:
    Not open for further replies.
    1. XantX

      XantX New Member

      Joined:
      Oct 5, 2014
      Messages:
      15
      Likes Received:
      0
      Trophy Points:
      0
      Well, since Spike doesn't want to release his version of Radar that early. I decided to code my own version of his radar.

      Limit of the Radar is 150 game units left and right of your character.. How far is that? well, Check your skills and get a rough estimate

      Let me know what else u guys want!

      Features
      • Show Ores
      • Show Trees
      • Show Mobs
      • Show Everything
      • Hide Text on Radar
      • Fixed position of GameWorld
      • Show Same Faction
      • Show Other Faction
      • Clicking on Radar will set the map position of the game world
      • Scaling of system
      • Direction of where you are walking
      • Shows Plants that can be harvested
      • Shows Schooling fish - Doesn't work that well, I tested, Seagulls appear before the fish, I believe its the way the game is coded.
      • Shows Tradepack - With Z index at the bottom of the sea. Anything above 30 should be saveable.
      • Shows Thunderstruck Trees - not tested with a real thunderstruck
      • Shows Animals To Be Butchered
      • Sunken Treasure Chest - found 3 - at 1 shot - 6/oct/2014
      • Zoom Function - sometimes the radar is too small
      • Doesn't crash when changing characters

      Features To Come
      • Illegal Farms - Trees / Livestock / Plants
      • Able to hook up to start / stop scripts when something is detected
      • Show Ships
      • Show Other Character stats

      Credits
      • Spikes (For Radar v2)
      • 2face (For Base and ideas on what people wanted)

      if you like to donate
      View attachment 145197

      Get the code -> Pastebin.com
       
      Last edited: Oct 6, 2014
    2. Sintal1ty

      Sintal1ty New Member

      Joined:
      Jun 7, 2012
      Messages:
      74
      Likes Received:
      1
      Trophy Points:
      0
      This didn't compile for me so I fixed it ;)
      Code:
      using System;
      using System.Drawing;
      using System.Windows.Forms;
      using System.Threading;
      using System.Collections.Generic;
      using System.Linq;
      using ArcheBuddy.Bot.Classes;
      
      namespace AntRadar
      {
          public class AntRadar : Core
          {
              
              // Archege uses Y Bottom = 0;
              // Radar uses Y Top = 0;
              
              public static string GetPluginAuthor()
              {
                  return "XantX";
              }
      
              public static string GetPluginVersion()
              {
                  return "1.0.0.0";
              }
      
              public static string GetPluginDescription()
              {
                  return "ant's Radar Plugin";
              } 
      
              private Form f;   
              private Label label;
              private Thread formThread;   
      
              System.Windows.Forms.Timer t = new System.Windows.Forms.Timer();
              int WIDTH                    = 600;
              int HEIGHT                   = 600;
              int HAND                     = 150;
              int u; //in degree
              int cx, cy; //center of the circle
              int x, y; //HAND coordinate
              int tx, ty, lim = 20;
              double myLastX, myLastY;
              Bitmap bmp;
              Graphics g;     
              private System.Windows.Forms.PictureBox pictureBox1;
      
              Double rOriginX;
              Double rOriginY; 
              Double rOriginZ;
              
              Creature creature = null;    
              int doodX;
              int doodY; 
          
              double myPrevX   = 0;
              double myPrevY   = 0;   
              double prevAngle = 90;
                       
              // Create font and brush.
              Font drawFont        = new Font("Courier", 11);
              SolidBrush drawBrush = new SolidBrush(Color.White);   
              Skill skill          = null;    
              
              ToolBarButton tbb1  = new ToolBarButton();
              ToolBarButton tbb2  = new ToolBarButton(); 
              ToolBarButton tbb3  = new ToolBarButton();    
              ToolBarButton tbb4  = new ToolBarButton(); 
              ToolBarButton tbb5  = new ToolBarButton();
              ToolBarButton tbb6  = new ToolBarButton();
              ToolBarButton tbb7  = new ToolBarButton();
              ToolBarButton tbb8  = new ToolBarButton();
              ToolBarButton tbb9  = new ToolBarButton();
              ToolBarButton tbb10 = new ToolBarButton();
              
              Pen p  = new Pen(Color.Green, 1f);
              Pen p2 = new Pen(Color.Red, 2f); 
              Pen p3 = new Pen(Color.Blue, 3f);
              
              private void InitializeForm()
              {
                  f                 = new Form();
                  f.Width           = 500;
                  f.Height          = 500;
                  f.Text            = "ant's Archeage Radar";
                  f.FormBorderStyle = FormBorderStyle.Sizable;
                  f.MaximizeBox     = false;
                  f.MinimizeBox     = false;
                  f.TopMost         = true;
                  
                  pictureBox1 = new System.Windows.Forms.PictureBox();
                  ((System.ComponentModel.ISupportInitialize)(pictureBox1)).BeginInit();
                  f.SuspendLayout();
                  //
                  // pictureBox1
                  //
                  pictureBox1.Dock     = System.Windows.Forms.DockStyle.Fill;
                  pictureBox1.Location = new System.Drawing.Point(0, 0);
                  pictureBox1.Name     = "pictureBox1";
                  pictureBox1.Size     = new System.Drawing.Size(WIDTH, HEIGHT);
                  pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
                  pictureBox1.TabIndex = 0;
                  pictureBox1.TabStop  = false;
                  //
                  // Form1
                  //
                  f.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
                  f.AutoScaleMode       = System.Windows.Forms.AutoScaleMode.Font;
                  f.ClientSize          = new System.Drawing.Size(WIDTH-14, HEIGHT - 75);
                  f.Controls.Add(pictureBox1);
                  f.Name          = "Ant Radar";
                  f.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
                  f.Text          = "Ant Radar";
                  ((System.ComponentModel.ISupportInitialize)(pictureBox1)).EndInit();
                  f.ResumeLayout(false);
                  
                  //create Bitmap
                  bmp = new Bitmap(WIDTH + 1, HEIGHT + 1);
                  //background color
                  f.BackColor = Color.Black;
                  //center
                  cx = WIDTH / 2;
                  cy = HEIGHT / 2;
                  //initial degree of HAND
                  u = 0;
                  //timer                
                  
                  t.Interval = 250; //in millisecond
                  t.Tick += new EventHandler(this.t_Tick);
                  t.Start();   
                  
                  pictureBox1.Click += PBox_Click;    
                  
                  ToolBar toolBar1 = new ToolBar();    
                  tbb1.Text        = "Ore";  
                  tbb2.Text        = "Trees";
                  tbb3.Text        = "Mobs";  
                  tbb4.Text        = "Everything - Debug";     
                  tbb5.Text        = "Hide Text";
                  tbb6.Text        = "Fixed World";
                  tbb7.Text        = "Player - Friendly";
                  tbb8.Text        = "Player - Enemy";
                  
                  tbb1.Style = ToolBarButtonStyle.ToggleButton;
                  tbb2.Style = ToolBarButtonStyle.ToggleButton;  
                  tbb3.Style = ToolBarButtonStyle.ToggleButton;    
                  tbb4.Style = ToolBarButtonStyle.ToggleButton;
                  tbb5.Style = ToolBarButtonStyle.ToggleButton;
                  tbb6.Style = ToolBarButtonStyle.ToggleButton;
                  tbb7.Style = ToolBarButtonStyle.ToggleButton;
                  tbb8.Style = ToolBarButtonStyle.ToggleButton;            
                  
                  toolBar1.Buttons.Add(tbb1);   
                  toolBar1.Buttons.Add(tbb2);
                  toolBar1.Buttons.Add(tbb3);
                  toolBar1.Buttons.Add(tbb4);
                  toolBar1.Buttons.Add(tbb5);
                  toolBar1.Buttons.Add(tbb6);
                  toolBar1.Buttons.Add(tbb7);
                  toolBar1.Buttons.Add(tbb8);            
                  f.Controls.Add(toolBar1); 
              }     
              
              public Skill getDoodadSkill(DoodadObject dood){   
                  Skill sk = null; 
                  if(dood != null){
                      foreach(var obj in dood.getUseSkills()){
                          sk = obj;    
                      }
                  }
                  return sk;
              }
              
              public void PBox_Click(object sender, EventArgs e)
              {                                                                                                                        
                  Point cursorPos = f.PointToClient(Cursor.Position);      
                  //Double z        = getZFromHeightMap(cursorPos.X + rOriginX, cursorPos.Y + rOriginY); 
                  //MoveTo(cursorPos.X + rOriginX, cursorPos.Y + rOriginY, z); 
                  //Thread.Sleep(250);
                  
                  // HARDCODED
                  cursorPos.X -= WIDTH / 2;
                  cursorPos.Y -= HEIGHT / 2;
                  cursorPos.X /= 2;
                  cursorPos.Y /= 2;
                  
                  
                  //Log(cursorPos.X.ToString());
                  //Log(cursorPos.Y.ToString());
                  
                  // Not sure how to get the correct Z position
                  SetMapPos((rOriginX + cursorPos.X),(rOriginY - cursorPos.Y),me.Z);                 
                  //Log((cursorPos.X + me.X).ToString() + " " + (cursorPos.Y + me.Y).ToString());
              }     
              
              public void drawOre()
              {
                  foreach(var dood in getDoodads())
                  {          
                      skill = getDoodadSkill(dood);
                      if(skill != null && (skill.name == "Mine Ore"))
                      {  
                          drawWorldDot(dood.X,dood.Y,dood.Z,dood.name,Color.Blue);
                      }  
                   }
              }
            
              public void drawTrees()
              {
                  foreach(var dood in getDoodads())
                  {          
                      skill = getDoodadSkill(dood);
                      if(skill != null && (skill.name == "Chop Tree"))
                      {   
                          drawWorldDot(dood.X,dood.Y,dood.Z,dood.name,Color.Blue);
                      }  
                   }
              }   
              
              public void drawAllObjects()
              {
                  foreach(var dood in getDoodads())
                  {                
                      drawWorldDot(dood.X, dood.Y, dood.Z , dood.name, Color.Blue);   
                  }
              }
               
              
              public void drawWorldDot(double x, double y, double z, String text, Color color)
              { 
                  double relx,rely,relz;
                  relx = x - rOriginX;
                  rely = y - rOriginY;
                  relz = z - me.Z;
                  
                  double scale = WIDTH / 400 * 0.8;
                  
                  relx *= scale;
                  rely *= scale;
                  relz *= scale;
                  //  +  "[" + x.ToString() + "," + y.ToString() + "," + z.ToString() + "]"
                  drawDot(cx + (int)relx , cy + -(int)rely ,text,color);
              }
           
              public void drawDot(int x, int y, String text, Color color)
              { 
                  p2.Color = color;
                  g.DrawEllipse(p2, x, y, 2, 2);
                  if (tbb5.Pushed)    
                      g.DrawString("", drawFont, drawBrush, x - (6 * (text.Count()/2)), y);
                  else
                      g.DrawString(text, drawFont, drawBrush, x - (6 * (text.Count()/2)), y);
              }
              
              
              public void drawCreatures()
              {     
                  foreach(var obj in getCreatures())
                  {      
                      if(obj.type == BotTypes.Npc)
                      {
                          drawWorldDot(obj.X,obj.Y,obj.Z,obj.name,Color.Orange);
                      }
                      
                   }
              }
              
              public void drawFriendlies()
              {     
                  foreach(var obj in getCreatures())
                  {      
                      if(obj.type == BotTypes.Player && obj.factionId == me.factionId)
                      {  
                          drawWorldDot(obj.X,obj.Y,obj.Z,obj.name,Color.Aquamarine);
                      }                
                   }
              }
              
              public void drawEnemies()
              {     
                  foreach(var obj in getCreatures())
                  {      
                      if(obj.type == BotTypes.Player && obj.factionId != me.factionId)
                      {  
                          drawWorldDot(obj.X,obj.Y,obj.Z,obj.name,Color.Red);
                      }
                   }
              }
              
              
              public void drawSelf()
              {
                  drawWorldDot(me.X, me.Y, me.Z, "Me", Color.White);    
                   
                   // draw the line in which you are looking
                   double diffy, diffx, angle;
                   diffx     = me.X - myLastX;
                   diffy     = me.Y - myLastY;
                   
                   angle     = Math.Atan2(diffy,diffx);
                   double vx,vy;
                   if (angle != 0)
                   {
                      vx = Math.Cos(angle);
                      vy = Math.Sin(angle);
                      prevAngle = angle;
                   }
                   else
                   {
                      vx = Math.Cos(prevAngle);
                      vy = Math.Sin(prevAngle); 
                   }
                   vx *= 75;
                   vy *= 75;
                   
                   myLastX = me.X;
                   myLastY = me.Y;
                   g.DrawLine(p3,new Point(cx + (int)(me.X - rOriginX),cy - (int)(me.Y - rOriginY)),new Point((int)(cx+vx + (int)(me.X - rOriginX)),(int)(cy-vy) - (int)(me.Y - rOriginY)));
              }
               
              public void drawNSEW()
              {
                  //draw perpendicular line
                  g.DrawLine(p, new Point(cx, 0), new Point(cx, HEIGHT)); // UP-DOWN
                  g.DrawLine(p, new Point(0, cy), new Point(WIDTH, cy)); //LEFT-RIGHT
                  drawDot(cx,HEIGHT-25,"S",Color.Green);
                  drawDot(cx,0,"N",Color.Green);
                  drawDot(WIDTH-25,cy,"E",Color.Green);
                  drawDot(0,cy,"W",Color.Green);
              }
              
              
              private void t_Tick(object sender, EventArgs e)
              {   
                  if (!tbb6.Pushed)
                  {
                      rOriginX = me.X;
                      rOriginY = me.Y;
                      rOriginZ = me.Z;
                  }
      
                  //Log(angle(me.target, me).ToString());
                  
                  g = Graphics.FromImage(bmp);   
                  g.Clear(Color.Black);
                  
                  drawNSEW();
                  drawSelf();
                  
                  if(tbb4.Pushed)
                  {
                      drawAllObjects();
                      pictureBox1.Image = bmp;
                      g.Dispose();  
                      return;
                  }
                  
                  if(tbb1.Pushed)
                  {
                      drawOre();    
                  }
      
                  if(tbb2.Pushed)
                  {
                      drawTrees();    
                  } 
                  
                  if(tbb3.Pushed)
                  {
                       drawCreatures();
                  }
                   
                  if(tbb7.Pushed)
                  {
                      drawFriendlies();
                  }
                   
                  if(tbb8.Pushed)
                  {
                      drawEnemies();
                  }
                                  
                  //load bitmap in picturebox1
                  pictureBox1.Image = bmp;
                  g.Dispose();
                  
              }  
              
              private void RunForm()
              {         
                  try
                  {
                      InitializeForm();
                      Console.WriteLine("InitializeForm done");
                      Application.Run(f);
                  }
                  catch (Exception error)
                  {
                      Log(error.ToString());
                  }
              }
              
              public void PluginStop()
              {    
                             
                  try
                  {
                      if (f != null)
                      {
                          f.Invoke(new Action(() => f.Close()));
                          f.Invoke(new Action(() => f.Dispose()));
                      }
                      if (formThread.ThreadState == System.Threading.ThreadState.Running)
                      {
                          formThread.Abort();
                          formThread.Join();
                      }
                  }
                  catch (Exception error)
                  {
                      Log("Ant Radar Exited");
                  }
                  
              }
              
              public void PluginRun()
              {     
                  Log("Start Of Ant Radar");
                  formThread = new Thread(RunForm);
                  formThread.SetApartmentState(ApartmentState.STA);
                  formThread.Start();
                  while (true)
                      Thread.Sleep(100);
      
                  if (!tbb6.Pushed)
                  {
                      rOriginX = me.X;
                      rOriginY = me.Y;
                      rOriginZ = me.Z;
                  }
      
                  g = Graphics.FromImage(bmp);   
                  g.Clear(Color.Black);
                  
                  drawNSEW();
                  drawSelf();
                  
                  if(tbb4.Pushed)
                  {
                      drawAllObjects();
                      pictureBox1.Image = bmp;
                      g.Dispose();  
                      return;
                  }
                  
                  if(tbb1.Pushed)
                  {
                      drawOre();    
                  }
      
                  if(tbb2.Pushed)
                  {
                      drawTrees();    
                  } 
                  
                  if(tbb3.Pushed)
                  {
                       drawCreatures();
                  }
                   
                  if(tbb7.Pushed)
                  {
                      drawFriendlies();
                  }
                   
                  if(tbb8.Pushed)
                  {
                      drawEnemies();
                  }
                                  
                  //load bitmap in picturebox1
                  pictureBox1.Image = bmp;
                  g.Dispose();
                  
              }  
          }
      }
      
       
    3. XantX

      XantX New Member

      Joined:
      Oct 5, 2014
      Messages:
      15
      Likes Received:
      0
      Trophy Points:
      0
      All you did was copy and paste the stuffs down from t_tick? What was the error?
       
    4. Sintal1ty

      Sintal1ty New Member

      Joined:
      Jun 7, 2012
      Messages:
      74
      Likes Received:
      1
      Trophy Points:
      0
      No I removed duplicate Name spaces and removed added brackets.
      Your copy and pasted code first compile
      Code:
      12:44:51 AM: c:\Users\Fucked\Downloads\Plugins\AntRadar\AntRadar.cs(438,13) : error CS0116: A namespace cannot directly contain members such as fields or methods
      12:44:51 AM: c:\Users\Fucked\Downloads\Plugins\AntRadar\AntRadar.cs(488,9) : error CS1022: Type or namespace definition, or end-of-file expected
      Ok Removed
      Code:
              }
          }
      } 
      Lines 435-438

      Recompile code

      Code:
      12:46:10 AM: c:\Users\Fucked\Downloads\Plugins\AntRadar\AntRadar.cs(488,22) : error CS0111: Type 'AntRadar.AntRadar' already defines a member called 'RunForm' with the same parameter types
      12:46:10 AM: c:\Users\Fucked\Downloads\Plugins\AntRadar\AntRadar.cs(502,21) : error CS0111: Type 'AntRadar.AntRadar' already defines a member called 'PluginStop' with the same parameter types
      12:46:10 AM: c:\Users\Fucked\Downloads\Plugins\AntRadar\AntRadar.cs(525,21) : error CS0111: Type 'AntRadar.AntRadar' already defines a member called 'PluginRun' with the same parameter types
      Delete Lines 437 - 533

      RESULT >
      Code:
      12:48:12 AM: Compilation is successful: C:\Users\Fucked\Downloads\Plugins\AntRadar\AntRadar.dll
       
      Last edited: Oct 6, 2014
    5. XantX

      XantX New Member

      Joined:
      Oct 5, 2014
      Messages:
      15
      Likes Received:
      0
      Trophy Points:
      0
      Might be me screwing up when i copy pasted it into the forums. My code doesn't have 400 lines..
       
    6. galio

      galio Member

      Joined:
      Sep 27, 2014
      Messages:
      111
      Likes Received:
      1
      Trophy Points:
      18
      Ilegal farms would help A LOT
       
    7. CalifRHCP

      CalifRHCP Member

      Joined:
      Jan 15, 2010
      Messages:
      439
      Likes Received:
      3
      Trophy Points:
      18
      Can we get a check put in the code for this so it doesn't crash your game when you go to character select? I'm guessing it crashes if its running when you go to change characters because its trying to read memory and that memory vanishes. Should be able to do a simple check that turns the plugin off instead of crashes the game.

      Problem with this radar and the first radar that was released.
       
    8. goodle

      goodle New Member

      Joined:
      Apr 17, 2014
      Messages:
      146
      Likes Received:
      0
      Trophy Points:
      0
      Thanks for that!!

      * Add zoom in-out

      This is HOT!
      Illegal Trees
      Illegal Plants
      Illegal Livestock
       
      Last edited: Oct 6, 2014
    9. mMirh

      mMirh New Member

      Joined:
      Sep 13, 2014
      Messages:
      31
      Likes Received:
      0
      Trophy Points:
      0
    10. XantX

      XantX New Member

      Joined:
      Oct 5, 2014
      Messages:
      15
      Likes Received:
      0
      Trophy Points:
      0
      This is how a traditional radar would work. Due to how 2face coded his dotDrawing and how the Y axis is different between ArcheAge and C# Forms.. I don't really want to calculate the angles.

      Also, generally speaking, calling sin and cosine so many times in a loop is generally a bad programming decision.

      Working on it. Trying to figure out which is the function that gives that error. Currently getting Gods have disconnected me when i try to inject with the bot.
       
    11. Sunriz3D

      Sunriz3D New Member

      Joined:
      Dec 31, 2011
      Messages:
      34
      Likes Received:
      0
      Trophy Points:
      0
      Hey is there a way to show plants ? ( like cotton, etc) without activating "everything - debug" ?
       
    12. XantX

      XantX New Member

      Joined:
      Oct 5, 2014
      Messages:
      15
      Likes Received:
      0
      Trophy Points:
      0
      Once out updates the bot. I will test and see if it works.

      Untested work -
      Shows Plants
      Shows Schooling fish
      Shows Tradepack
      Shows Thunderstruck Trees
      Shows Animals To Be Butchered

      Untested - Uncompiled - Unknown everything - Try at your own risk

      Code here
       
    13. Sunriz3D

      Sunriz3D New Member

      Joined:
      Dec 31, 2011
      Messages:
      34
      Likes Received:
      0
      Trophy Points:
      0
      Thanks for the update, nothing is showing ( gonna wait your test :p )
       
    14. james6345

      james6345 Member

      Joined:
      Apr 24, 2014
      Messages:
      160
      Likes Received:
      0
      Trophy Points:
      16
      were do I download this from? I don't see a link
       
    15. goodle

      goodle New Member

      Joined:
      Apr 17, 2014
      Messages:
      146
      Likes Received:
      0
      Trophy Points:
      0
      1st page, you have code
       
    16. XantX

      XantX New Member

      Joined:
      Oct 5, 2014
      Messages:
      15
      Likes Received:
      0
      Trophy Points:
      0
      Updated
       
    17. CalifRHCP

      CalifRHCP Member

      Joined:
      Jan 15, 2010
      Messages:
      439
      Likes Received:
      3
      Trophy Points:
      18
      This is showing scarecrows as enemies. If theres a way to blacklist that, would be nice.
       
    18. XantX

      XantX New Member

      Joined:
      Oct 5, 2014
      Messages:
      15
      Likes Received:
      0
      Trophy Points:
      0
      I think I kinda fixed the problem. Not sure if it works, I don't want to test it because restarting my computer takes close to 10 minutes.. If you ever accidentally happen to test it, let me know if it works.
       
    19. XantX

      XantX New Member

      Joined:
      Oct 5, 2014
      Messages:
      15
      Likes Received:
      0
      Trophy Points:
      0
      It doesn't for me?
       
    20. Jamati

      Jamati New Member

      Joined:
      Oct 3, 2014
      Messages:
      5
      Likes Received:
      0
      Trophy Points:
      1
    Thread Status:
    Not open for further replies.

    Share This Page