Hello There, Guest!
View New Posts   View Today's Posts
Underlight Angler

  • 0 Vote(s) - 0 Average


05-22-2017, 01:52 AM #1
Blow
Junior Member
**
Posts: 8 Threads:6 Joined: May 2017 Reputation: 1

Underlight Angler
Looting barrel of fish on proc.

I found a HB plugin for this but I'm not qualified to convert this. I'm not even sure if it can be, I have done quite a good bit of research here on the forums for a solution and seems a plugin is the easiest method.  I just dont how to write this.   I don't mind tipping or whatever it takes, I'm simply trying to make fishing profiles for the forum and I think this would be a good asset.  

Thanks

using CommonBehaviors.Actions;
using Styx;
using Styx.Common;
using Styx.CommonBot;
using Styx.CommonBot.Coroutines;
using Styx.CommonBot.POI;
using Styx.Plugins;
using Styx.TreeSharp;
using Styx.WoWInternals;
using Styx.WoWInternals.WoWObjects;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LootBarrels
{
public class Plugin : HBPlugin
{
const uint UNDERLIGHT_ANGLER = 133755;
const int MAIN_HAND = 16;
static string lastInformationMSG;
private static bool _lootingBarrel = false;
private static DateTime _barrelLootingStarted;
private static List<Barrel> _barrels = new List<Barrel>();
private static WoWObject _currentBarrel;
private Composite barrelHook;
private static LocalPlayer Me { get { return StyxWoW.Me; } }
public override string Author { get { return "SpeshulK926"; } }
public override string Name { get { return "Loot Barrels"; } }
public override Version Version { get { return new Version(1, 2); } }
public override void OnEnable()
{
base.OnEnable();
//TreeHooks.Instance.InsertHook("InGame_Check", 0, barrelHook ?? (barrelHook = new ActionRunCoroutine(ctx => LootBarrelLoop())));
_barrels.Clear();
_barrels.Add(new Barrel() { ID = 251356, Name = "Cursed Queenfish" });
_barrels.Add(new Barrel() { ID = 251387, Name = "Highmountain Salmon" });
_barrels.Add(new Barrel() { ID = 251388, Name = "Stormray" });
_barrels.Add(new Barrel() { ID = 251386, Name = "Mossgill Perch" });
_barrels.Add(new Barrel() { ID = 251389, Name = "Runescale Koi" });
_barrels.Add(new Barrel() { ID = 251390, Name = "Black Barracuda" });

infoLog("Enabled");
}

public override void OnDisable()
{
base.OnDisable();
//Styx.CommonBot.BotEvents.OnBotStopped -= BotEvents_OnBotStopped;
//TreeHooks.Instance.RemoveHook("InGame_Check", barrelHook);
infoLog("Disabled");
}
private static Stopwatch infoLogReset = new Stopwatch();
public void infoLog(string Message, params object[] args)
{
if (Message == lastInformationMSG) { return; }

Logging.Write(System.Windows.Media.Colors.LightBlue, "[LootBarrel]: {0}", Message, args);
lastInformationMSG = Message;
}
bool IsEntryABarrel(uint id)
{
foreach (var item in _barrels)
{
if (item.ID == id)
{
return true;
}

}
return false;
}

public override void Pulse()
{
if (!infoLogReset.IsRunning || (infoLogReset.IsRunning && infoLogReset.ElapsedMilliseconds > 1000)) { lastInformationMSG = ""; infoLogReset.Reset(); }
if (!Me.Combat && HasUnderlightAngler() && !HasUnderlightAnglerEquipped())
{
WoWItem angler = Me.BagItems.FirstOrDefault(item => item.ItemInfo.Id == UNDERLIGHT_ANGLER);
if (angler != null && Me.CanEquipItem(angler))
{
infoLog("Equipping: " + angler.SafeName);
Lua.DoString("PickupContainerItem({0},{1}) EquipCursorItem({2})", angler.BagIndex + 1, angler.BagSlot + 1, MAIN_HAND);
}
}
var b = ObjectManager.GetObjectsOfTypeFast<WoWObject>().FirstOrDefault(f => IsEntryABarrel(f.Entry));

//var b = ObjectManager.GetObjectsOfTypeFast<WoWObject>().FirstOrDefault(f => IsEntryABarrel(f.Entry));
if (b != null && !_lootingBarrel)
{

// we found a barrel, let's loot it.
if (b != null)
{
infoLog("Looting Barrel: " + b.GetObjectName() + " : " + b.Entry + "(" + _barrels.FirstOrDefault(bar => bar.ID == b.Entry)?.Name + ")");
BotPoi.Current = new BotPoi(b, PoiType.Harvest, NavType.Run);
}
}
}
bool HasUnderlightAngler()
{
bool inBags = Me.BagItems.Where(item => item.ItemInfo.Id == UNDERLIGHT_ANGLER).Any();
bool equipped = Me.Inventory.Equipped.MainHand.ItemInfo.Id == UNDERLIGHT_ANGLER;
if (inBags || equipped) { return true; }
return false;
}
bool HasUnderlightAnglerEquipped()
{
bool equipped = Me.Inventory.Equipped.MainHand.ItemInfo.Id == UNDERLIGHT_ANGLER;
return equipped;
}
}
public class Barrel
{
public uint ID { get; set; }
public string Name { get; set; }
}
}
This post was last modified: 05-22-2017, 01:53 AM by Blow.

05-22-2017, 03:39 PM #2
Vesper
Founder
*******
Posts: 3,607 Threads:344 Joined: Nov 2015 Reputation: 37

RE: Underlight Angler
What must be done by the player in a manual situation ?

And what is that code lol
Code:
bool IsEntryABarrel(uint id)
{
foreach (var item in _barrels)
{
if (item.ID == id)
{
return true;
}

}
return false;
}

when you can do that
Code:
_barrels.Contains(id)



TheNoobBot wont work ? Make sure to read this topic (EN) ! It resolves most of problems/crash/freezes.
TheNoobBot ne fonctionne pas ? Lisez ce sujet (FR) ! Il vous aidera à résoudre la plupart des problèmes/crash/freezes.

Join TheNoobBot's Discord server today ! World Quests OPEN project !

05-22-2017, 05:32 PM #3
Blow
Junior Member
**
Posts: 8 Threads:6 Joined: May 2017 Reputation: 1

RE: Underlight Angler
(05-22-2017, 03:39 PM)Vesper Wrote:  What must be done by the player in a manual situation ?

And  what is that code lol
Code:
bool IsEntryABarrel(uint id)
{
foreach (var item in _barrels)
{
if (item.ID == id)
{
return true;
}

}
return false;
}

when you can do that
Code:
_barrels.Contains(id)
All the player has to do is step up about three steps and click the barrel and it loots like a chest would.  The Proc rate is extremely high so basically every pool it procs, thing is when it procs the barrel appears and the pool disappears, therefore making it difficult to to get fish.  
As far as the code, I have no clue just trying to help.
If you need my account info so that you can see how it works let me know and I'll PM you the info.




Forum Jump:



Users browsing this thread: 1 Guest(s)