pitrus
New Member
- Joined
- May 17, 2015
- Messages
- 36
- Reaction score
- 0
так как нормальный радар не нашол пробую ант радар переделать но не совсем получается
помогите плиз зделать окно празрачным полнастью + чтоб скрол был( приближать обекты) и чтоб радар крутился. ну и желательно кнопки уменьшить. если кому не сложно помагите
вот скрипт
помогите плиз зделать окно празрачным полнастью + чтоб скрол был( приближать обекты) и чтоб радар крутился. ну и желательно кнопки уменьшить. если кому не сложно помагите
вот скрипт
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 = 50;
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;
double scaleMap = 1;
bool FormIsOpen = true;
// Create font and brush.
Font drawFont = new Font("Courier New Bold", 11);
SolidBrush drawBrush = new SolidBrush(Color.Black);
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();
// ToolBarButton tbb11 = new ToolBarButton();
// ToolBarButton tbb12 = new ToolBarButton();
// ToolBarButton tbb13 = new ToolBarButton();
ToolBarButton tbb14 = new ToolBarButton();
ToolBarButton tbb15 = new ToolBarButton();
ToolBarButton tbb16 = new ToolBarButton();
ToolBarButton tbb17 = new ToolBarButton();
ToolBarButton tbb18 = new ToolBarButton();
ToolBarButton tbb19 = new ToolBarButton();
ToolBarButton tbb20 = 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(91, 22);
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 + 2, HEIGHT + 2);
//background color
f.BackColor = Color.White;
//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 = "Руда";
// tbb2.Text = "Деревья";
tbb9.Text = "Монстры";
tbb4.Text = "Все Отладки";
tbb5.Text = "Вык текст";
tbb6.Text = "Вк ваше место";
tbb7.Text = "Друж расса";
tbb8.Text = "Враждеб расса";
tbb3.Text = "Нужное!!!!";
// tbb10.Text = "Паки";
// tbb11.Text = "Thunderstruck";
// tbb12.Text = "Рыбные косяки";
// tbb13.Text = "Сундуки с сокровищами";
tbb14.Text = "Живность";
tbb15.Text = "Увилечение 5x";
// tbb1.Style = ToolBarButtonStyle.ToggleButton;
// tbb2.Style = ToolBarButtonStyle.ToggleButton;
tbb9.Style = ToolBarButtonStyle.ToggleButton;
tbb4.Style = ToolBarButtonStyle.ToggleButton;
tbb5.Style = ToolBarButtonStyle.ToggleButton;
tbb6.Style = ToolBarButtonStyle.ToggleButton;
tbb7.Style = ToolBarButtonStyle.ToggleButton;
tbb8.Style = ToolBarButtonStyle.ToggleButton;
tbb3.Style = ToolBarButtonStyle.ToggleButton;
// tbb10.Style = ToolBarButtonStyle.ToggleButton;
// tbb11.Style = ToolBarButtonStyle.ToggleButton;
// tbb12.Style = ToolBarButtonStyle.ToggleButton;
// tbb13.Style = ToolBarButtonStyle.ToggleButton;
tbb14.Style = ToolBarButtonStyle.ToggleButton;
tbb15.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);
toolBar1.Buttons.Add(tbb9);
// toolBar1.Buttons.Add(tbb10);
// toolBar1.Buttons.Add(tbb11);
// toolBar1.Buttons.Add(tbb12);
// toolBar1.Buttons.Add(tbb13);
toolBar1.Buttons.Add(tbb14);
toolBar1.Buttons.Add(tbb15);
f.Controls.Add(toolBar1);
f.FormClosed += new FormClosedEventHandler(Form1_FormClosed);
}
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 drawPlants()
{
string [] drawPlants = {"Плодоносящий баобаб",
"Горный женьшень",
"Рассада женьшеня",
"Женьшень",
"Сумка путешественника",
"Затонувший корабль",
"Обугленное дерево",
"Пораженное молнией дерево",
"Стелющаяся трава",
"Заброшенный саженец",
"Раковина с черным жемчугом",
"Большая жемчужная раковина",
"Морское ушко",
"Заросли сорняка",
"Кордицепс",
"Реликвии",
"Реликвии Дельфинады",
"Груз",
"Сансам",
"сансам",
"Стебли неизвестной травы",
"Стебли неизвес",
"Мелкий кустарник",
"кустарник",
"неспелыми",};
foreach(var dood in getDoodads())
{
foreach (string s in drawPlants)
{
if (dood.name.Contains(s))
{
drawWorldDot(dood.X, dood.Y, dood.Z , dood.name + " z: " + dood.Z, Color.Blue);
}
}
}
}
public void drawAnimals()
{
foreach(var dood in getDoodads())
{
skill = getDoodadSkill(dood);
if(skill != null && (skill.name.Contains("Butcher")))
{
drawWorldDot(dood.X,dood.Y,dood.Z,dood.name,Color.Blue);
}
}
}
public void drawAllObjects()
{
foreach(var dood in getDoodads())
{
//if (dood.name.Contains("Clipper")) = harpoonclipper / cannon clipper
//if (dood.name.Contains("Seat")) = rowboat
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
if (me.factionId == 109 || me.factionId == 113) // if im east
{
if (obj.factionId == 109 || obj.factionId == 113)
drawWorldDot(obj.X,obj.Y,obj.Z,obj.name,Color.Aquamarine);
}
else if (me.factionId == 101 || me.factionId == 103) // im a west player thus draw
{
if ((obj.factionId == 101 || obj.factionId == 103))
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
if (me.factionId == 109 || me.factionId == 113) // if im east
{
if (obj.factionId == 101 || obj.factionId == 103)
drawWorldDot(obj.X,obj.Y,obj.Z,obj.name,Color.Red);
}
else if (obj.factionId == 101 || obj.factionId == 103) // im a west player thus draw
{
if (obj.factionId == 109 || obj.factionId == 113)
drawWorldDot(obj.X,obj.Y,obj.Z,obj.name,Color.Red);
}
}
}
}
public void drawSelf()
{
drawWorldDot(me.X, me.Y, me.Z, "Me", Color.Black);
// 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)
{
// check if player is in game world - not confirm that it will prevent the crash
if (me == null || me.name == "")
{
return;
}
// Log(me.factionId.ToString());
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.White);
drawNSEW();
drawSelf();
if(tbb4.Pushed)
{
drawAllObjects();
pictureBox1.Image = bmp;
g.Dispose();
return;
}
// if(tbb1.Pushed)
// {
//
// }
//
//if(tbb2.Pushed)
// {
//
// }
//
if(tbb9.Pushed)
{
drawCreatures();
}
if(tbb7.Pushed)
{
drawFriendlies();
}
if(tbb8.Pushed)
{
drawEnemies();
}
if(tbb3.Pushed)
{
drawPlants();
}
// if(tbb10.Pushed)
// {
//
// }
//
// if(tbb11.Pushed)
// {
//
// }
//
// if(tbb12.Pushed)
// {
//
// }
//
// if(tbb13.Pushed)
// {
//
// }
if(tbb14.Pushed)
{
drawAnimals();
}
if(tbb15.Pushed)
{
scaleMap = 30;
}
else
{
scaleMap = 1;
}
//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");
}
}
void Form1_FormClosed(object sender, FormClosedEventArgs e)
{
// Do something
//PluginStop();
FormIsOpen = false;
}
public void PluginRun()
{
Log("Start Of Ant Radar");
formThread = new Thread(RunForm);
formThread.SetApartmentState(ApartmentState.STA);
formThread.Start();
while (FormIsOpen)
Thread.Sleep(100);
}
}
}