D2R-BMBot/Bots/LowerKurast.cs

238 lines
10 KiB
C#
Raw Normal View History

2023-04-27 20:42:59 -07:00
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace app
{
public class LowerKurast
{
Form1 Form1_0;
public int CurrentStep = 0;
public int WP_X = 0;
public int WP_Y = 0;
2024-03-29 00:19:36 -07:00
public List<int> IgnoredChestList = new List<int>();
2023-04-27 20:42:59 -07:00
public bool ScriptDone = false;
public void SetForm1(Form1 form1_1)
{
Form1_0 = form1_1;
}
public void ResetVars()
{
CurrentStep = 0;
WP_X = 0;
WP_Y = 0;
2024-03-29 00:19:36 -07:00
IgnoredChestList = new List<int>();
2023-04-27 20:42:59 -07:00
ScriptDone = false;
}
public void RunScript()
{
Form1_0.Town_0.ScriptTownAct = 5; //set to town act 5 when running this script
if (Form1_0.Town_0.GetInTown())
{
Form1_0.SetGameStatus("GO TO WP");
CurrentStep = 0;
2024-03-29 00:19:36 -07:00
Form1_0.Town_0.GoToWPArea(3, 4);
2023-04-27 20:42:59 -07:00
//close to store spot 5078, 5026
2024-03-29 00:19:36 -07:00
/*if (Form1_0.Town_0.IsPosCloseTo(5084, 5037, 7))
2023-04-27 20:42:59 -07:00
{
//move close to tp location
Form1_0.Mover_0.MoveToLocation(5103, 5029);
}
else
{
//move close to wp location
if (Form1_0.Mover_0.MoveToLocation(5119, 5067))
{
//use wp
//if (Form1_0.ObjectsStruc_0.GetObjects("ExpansionWaypoint", false))
//{
//Dictionary<string, int> itemScreenPos = Form1_0.GameStruc_0.World2Screen(Form1_0.PlayerScan_0.xPosFinal, Form1_0.PlayerScan_0.yPosFinal, Form1_0.ObjectsStruc_0.itemx, Form1_0.ObjectsStruc_0.itemy);
Dictionary<string, int> itemScreenPos = Form1_0.GameStruc_0.World2Screen(Form1_0.PlayerScan_0.xPosFinal, Form1_0.PlayerScan_0.yPosFinal, 5114, 5069);
Form1_0.KeyMouse_0.MouseClicc(itemScreenPos["x"], itemScreenPos["y"] - 15);
Form1_0.Mover_0.FinishMoving();
if (Form1_0.UIScan_0.WaitTilUIOpen("waypointMenu"))
{
Form1_0.KeyMouse_0.MouseClicc(415, 220); //select act3
Form1_0.WaitDelay(50);
Form1_0.KeyMouse_0.MouseClicc(400, 515); //select kurast wp
Form1_0.UIScan_0.WaitTilUIClose("waypointMenu");
Form1_0.UIScan_0.WaitTilUIClose("loading");
Form1_0.WaitDelay(350);
}
//}
}
2024-03-29 00:19:36 -07:00
}*/
2023-04-27 20:42:59 -07:00
}
else
{
if (CurrentStep == 0)
{
Form1_0.SetGameStatus("DOING KURAST");
2024-03-29 00:19:36 -07:00
Form1_0.Battle_0.CastDefense();
2023-04-27 20:42:59 -07:00
Form1_0.WaitDelay(15);
if (Form1_0.PlayerScan_0.levelNo == 79)
{
2024-03-29 00:19:36 -07:00
WP_X = Form1_0.PlayerScan_0.xPos - 3;
WP_Y = Form1_0.PlayerScan_0.yPos - 3;
2023-04-27 20:42:59 -07:00
CurrentStep++;
}
2024-03-29 00:19:36 -07:00
else
{
Form1_0.Town_0.GoToTown();
}
2023-04-27 20:42:59 -07:00
}
if (CurrentStep == 1)
{
2024-03-29 00:19:36 -07:00
TakeChest();
2023-04-27 20:42:59 -07:00
2024-03-29 00:19:36 -07:00
CurrentStep++;
2023-04-27 20:42:59 -07:00
}
if (CurrentStep == 2)
{
2024-03-29 00:19:36 -07:00
//Form1_0.ItemsStruc_0.GrabAllItemsForGold();
2023-04-27 20:42:59 -07:00
2024-03-29 00:19:36 -07:00
//Form1_0.LeaveGame(true);
if (Form1_0.Mover_0.MoveToLocation(WP_X, WP_Y))
2023-04-27 20:42:59 -07:00
{
2024-03-29 00:19:36 -07:00
//take back wp
//if (Form1_0.ObjectsStruc_0.GetObjects("Act3TownWaypoint", false))
//{
Dictionary<string, int> itemScreenPos = Form1_0.GameStruc_0.World2Screen(Form1_0.PlayerScan_0.xPosFinal, Form1_0.PlayerScan_0.yPosFinal, WP_X, WP_Y);
Form1_0.KeyMouse_0.MouseClicc(itemScreenPos["x"], itemScreenPos["y"] - 15);
//Form1_0.Mover_0.FinishMoving();
if (Form1_0.UIScan_0.WaitTilUIOpen("waypointMenu"))
2023-04-27 20:42:59 -07:00
{
2024-03-29 00:19:36 -07:00
Form1_0.Town_0.SelectTownWP();
//Form1_0.Town_0.Towning = true;
ScriptDone = true;
2023-04-27 20:42:59 -07:00
2024-03-29 00:19:36 -07:00
Form1_0.LeaveGame(true); //#####
}
//}
2023-04-27 20:42:59 -07:00
}
}
}
}
public void TakeChest()
{
2024-03-29 00:19:36 -07:00
//JungleStashObject2
//JungleStashObject3
//GoodChest
//NotSoGoodChest
//DeadVillager1
//DeadVillager2
//NotSoGoodChest
//HollowLog
//JungleMediumChestLeft ####
2024-03-30 00:16:39 -07:00
MapAreaStruc.Position ThisChestPos = Form1_0.MapAreaStruc_0.GetPositionOfObject("object", "GoodChest", (int)Enums.Area.LowerKurast, IgnoredChestList);
2023-04-27 20:42:59 -07:00
int Tryy = 0;
2024-03-29 00:19:36 -07:00
while (ThisChestPos.X != 0 && ThisChestPos.Y != 0 && Tryy < 30)
2023-04-27 20:42:59 -07:00
{
2024-03-29 00:19:36 -07:00
if (Form1_0.Mover_0.MoveToLocation(ThisChestPos.X, ThisChestPos.Y))
2023-04-27 20:42:59 -07:00
{
2024-03-29 00:19:36 -07:00
Dictionary<string, int> itemScreenPos = Form1_0.GameStruc_0.World2Screen(Form1_0.PlayerScan_0.xPosFinal, Form1_0.PlayerScan_0.yPosFinal, ThisChestPos.X, ThisChestPos.Y);
2023-04-27 20:42:59 -07:00
Form1_0.KeyMouse_0.MouseClicc(itemScreenPos["x"], itemScreenPos["y"] - 15);
Form1_0.WaitDelay(10);
Form1_0.KeyMouse_0.MouseClicc(itemScreenPos["x"], itemScreenPos["y"] - 15);
Form1_0.WaitDelay(10);
Form1_0.KeyMouse_0.MouseClicc(itemScreenPos["x"], itemScreenPos["y"] - 15);
Form1_0.WaitDelay(10);
int tryy2 = 0;
while (Form1_0.ItemsStruc_0.GetItems(true) && tryy2 < 20)
{
Form1_0.PlayerScan_0.GetPositions();
Form1_0.ItemsStruc_0.GetItems(false);
Form1_0.Potions_0.CheckIfWeUsePotion();
tryy2++;
}
2024-03-29 00:19:36 -07:00
IgnoredChestList.Add(Form1_0.MapAreaStruc_0.CurrentObjectIndex);
2023-04-27 20:42:59 -07:00
}
2024-03-29 00:19:36 -07:00
2024-03-30 00:16:39 -07:00
ThisChestPos = Form1_0.MapAreaStruc_0.GetPositionOfObject("object", "GoodChest", (int) Enums.Area.LowerKurast, IgnoredChestList);
2024-03-29 00:19:36 -07:00
Tryy++;
2023-04-27 20:42:59 -07:00
}
2024-03-29 00:19:36 -07:00
//##############
/*ThisChestPos = Form1_0.MapAreaStruc_0.GetPositionOfObject("object", "JungleStashObject2", 78, IgnoredChestList);
Tryy = 0;
while (ThisChestPos.X != 0 && ThisChestPos.Y != 0 && Tryy < 30)
{
if (Form1_0.Mover_0.MoveToLocation(ThisChestPos.X, ThisChestPos.Y))
{
Dictionary<string, int> itemScreenPos = Form1_0.GameStruc_0.World2Screen(Form1_0.PlayerScan_0.xPosFinal, Form1_0.PlayerScan_0.yPosFinal, ThisChestPos.X, ThisChestPos.Y);
Form1_0.KeyMouse_0.MouseClicc(itemScreenPos["x"], itemScreenPos["y"] - 15);
Form1_0.WaitDelay(10);
Form1_0.KeyMouse_0.MouseClicc(itemScreenPos["x"], itemScreenPos["y"] - 15);
Form1_0.WaitDelay(10);
Form1_0.KeyMouse_0.MouseClicc(itemScreenPos["x"], itemScreenPos["y"] - 15);
Form1_0.WaitDelay(10);
int tryy2 = 0;
while (Form1_0.ItemsStruc_0.GetItems(true) && tryy2 < 20)
{
Form1_0.PlayerScan_0.GetPositions();
Form1_0.ItemsStruc_0.GetItems(false);
Form1_0.Potions_0.CheckIfWeUsePotion();
tryy2++;
}
IgnoredChestList.Add(Form1_0.MapAreaStruc_0.CurrentObjectIndex);
}
ThisChestPos = Form1_0.MapAreaStruc_0.GetPositionOfObject("object", "JungleStashObject2", 78, IgnoredChestList);
Tryy++;
}
//##############
ThisChestPos = Form1_0.MapAreaStruc_0.GetPositionOfObject("object", "JungleStashObject3", 78, IgnoredChestList);
Tryy = 0;
while (ThisChestPos.X != 0 && ThisChestPos.Y != 0 && Tryy < 30)
{
if (Form1_0.Mover_0.MoveToLocation(ThisChestPos.X, ThisChestPos.Y))
{
Dictionary<string, int> itemScreenPos = Form1_0.GameStruc_0.World2Screen(Form1_0.PlayerScan_0.xPosFinal, Form1_0.PlayerScan_0.yPosFinal, ThisChestPos.X, ThisChestPos.Y);
Form1_0.KeyMouse_0.MouseClicc(itemScreenPos["x"], itemScreenPos["y"] - 15);
Form1_0.WaitDelay(10);
Form1_0.KeyMouse_0.MouseClicc(itemScreenPos["x"], itemScreenPos["y"] - 15);
Form1_0.WaitDelay(10);
Form1_0.KeyMouse_0.MouseClicc(itemScreenPos["x"], itemScreenPos["y"] - 15);
Form1_0.WaitDelay(10);
int tryy2 = 0;
while (Form1_0.ItemsStruc_0.GetItems(true) && tryy2 < 20)
{
Form1_0.PlayerScan_0.GetPositions();
Form1_0.ItemsStruc_0.GetItems(false);
Form1_0.Potions_0.CheckIfWeUsePotion();
tryy2++;
}
IgnoredChestList.Add(Form1_0.MapAreaStruc_0.CurrentObjectIndex);
}
ThisChestPos = Form1_0.MapAreaStruc_0.GetPositionOfObject("object", "JungleStashObject3", 78, IgnoredChestList);
Tryy++;
}*/
2023-04-27 20:42:59 -07:00
}
2024-03-29 00:19:36 -07:00
2023-04-27 20:42:59 -07:00
}
}