diff --git a/Albion/Merlin/Console.cs b/Albion/Merlin/Console.cs index cdbdf7b..6cef0cd 100644 --- a/Albion/Merlin/Console.cs +++ b/Albion/Merlin/Console.cs @@ -21,7 +21,7 @@ private struct Log private List logs = new List(); private Vector2 scrollPosition; private bool show; - private bool collapse; + private bool collapse = true; private bool scroll = true; private bool limit = true; diff --git a/Albion/Merlin/Core.cs b/Albion/Merlin/Core.cs index f916e40..2739de4 100644 --- a/Albion/Merlin/Core.cs +++ b/Albion/Merlin/Core.cs @@ -51,9 +51,12 @@ public static void Unload() _coreObject = null; } + public static string lastLog; public static void Log(string message) { - Debug.Log($"[{DateTime.Now}] {message}"); + if (message != lastLog) + Debug.Log($"[{DateTime.Now}] {message}"); + lastLog = message; } public static void Log(Exception e) diff --git a/Albion/Merlin/Profiles/Gatherer/Gatherer.Banking.cs b/Albion/Merlin/Profiles/Gatherer/Gatherer.Banking.cs index bf52ef1..9301611 100644 --- a/Albion/Merlin/Profiles/Gatherer/Gatherer.Banking.cs +++ b/Albion/Merlin/Profiles/Gatherer/Gatherer.Banking.cs @@ -11,10 +11,10 @@ namespace Merlin.Profiles.Gatherer { public sealed partial class Gatherer { - private WorldPathingRequest _worldPathingRequest; - private PositionPathingRequest _bankPathingRequest; + private WorldPathingRequest _worldPathingRequest; + private PositionPathingRequest _bankPathingRequest; private PositionPathingRequest _bankFindPathingRequest; - private bool _isDepositing; + private bool _isDepositing; private bool _movingToBank = false; private static DateTime _nextBankAction; @@ -46,10 +46,10 @@ public void Bank() if (HandlePathing(ref _worldPathingRequest)) return; - if (HandlePathing(ref _bankFindPathingRequest, () => _client.GetEntities((x) => { return true; }).Count > 0)) + if (HandlePathing(ref _bankFindPathingRequest, () => _client.GetEntities((x) => { return true; }).Count > 0)) return; - if (HandlePathing(ref _bankPathingRequest, null)) + if (HandlePathing(ref _bankPathingRequest, null)) return; Worldmap worldmapInstance = GameGui.Instance.WorldMap; @@ -130,8 +130,7 @@ private bool moveObjectsToBank() { //Get inventory var playerStorage = GameGui.Instance.CharacterInfoGui.InventoryItemStorage; - var vaultStorage = GameGui.Instance.MultiVaultGui.AdditionalViewVault.InventoryStorage; - + var vaultStorage = GameGui.Instance.MultiVaultGui.MainViewVault.InventoryStorage; var ToDeposit = new List(); //Get all items we need that are visible. Need to find a way to get all items in player inventory. @@ -150,6 +149,7 @@ private bool moveObjectsToBank() } _isDepositing = ToDeposit != null && ToDeposit.Count > 0; + foreach (var item in ToDeposit) { GameGui.Instance.MoveItemToItemContainer(item, vaultStorage.ItemContainerProxy); diff --git a/Albion/Merlin/Profiles/Gatherer/Gatherer.Combat.cs b/Albion/Merlin/Profiles/Gatherer/Gatherer.Combat.cs index e33fe7b..8e9f3ad 100644 --- a/Albion/Merlin/Profiles/Gatherer/Gatherer.Combat.cs +++ b/Albion/Merlin/Profiles/Gatherer/Gatherer.Combat.cs @@ -44,6 +44,12 @@ public void Fight() _combatTarget = _localPlayerCharacterView.GetAttackTarget(); _combatSpells = _combatPlayer.GetSpellSlotsIndexed().Ready(_localPlayerCharacterView).Ignore("ESCAPE_DUNGEON").Ignore("PLAYER_COUPDEGRACE").Ignore("AMBUSH"); + if (_combatPlayer.GetIsChanneling()) + { + Core.Log("You are channeling a spell. Wait for Channeling to finish!"); + return; + } + if (_localPlayerCharacterView.IsCasting() || _combatPlayer.GetIsCasting()) { Core.Log("You are casting. Wait for casting to finish"); diff --git a/Albion/Merlin/Profiles/Gatherer/Gatherer.Harvest.cs b/Albion/Merlin/Profiles/Gatherer/Gatherer.Harvest.cs index 0505c5b..acf9379 100644 --- a/Albion/Merlin/Profiles/Gatherer/Gatherer.Harvest.cs +++ b/Albion/Merlin/Profiles/Gatherer/Gatherer.Harvest.cs @@ -181,19 +181,19 @@ public void Harvest() #endregion [dTormentedSoul Area] if (!ValidateTarget(_currentTarget)) - { + { Core.Log("Resource DepletedSearch for new one."); _state.Fire(Trigger.DepletedResource); return; } if (_currentTarget is HarvestableObjectView harvestableObject) - { + { //Core.Log("Begin Harvest of Resource"); HarvestHarvestableObjec(harvestableObject); } else if (_currentTarget is MobView mob) - { + { //Core.Log("Begin Harvest of Mob"); HarvestMob(mob); } @@ -291,12 +291,12 @@ public void HarvestMob(MobView mob) //var attackRange = _localPlayerCharacterView.LocalPlayerCharacter.t2() + mob.Mob.x1().f9(); var minimumAttackRange = isMeleeWeapon ? MELEE_ATTACK_RANGE : RANGED_ATTACK_RANGE; - var isInLoS = _localPlayerCharacterView.IsInLineOfSight(mob); + //var isInLoS = _localPlayerCharacterView.IsInLineOfSight(mob); - if (HandlePathing(ref _harvestPathingRequest, () => centerDistance <= minimumAttackRange && isInLoS)) + if (HandlePathing(ref _harvestPathingRequest, () => centerDistance <= minimumAttackRange)) return; - if (centerDistance >= minimumAttackRange || !isInLoS) + if (centerDistance >= minimumAttackRange) { if (_localPlayerCharacterView.TryFindPath(new ClusterPathfinder(), targetCenter, IsBlockedGathering, out List pathing)) { diff --git a/Albion/Merlin/Profiles/Gatherer/Gatherer.Search.cs b/Albion/Merlin/Profiles/Gatherer/Gatherer.Search.cs index 2f12f5d..8e2c608 100644 --- a/Albion/Merlin/Profiles/Gatherer/Gatherer.Search.cs +++ b/Albion/Merlin/Profiles/Gatherer/Gatherer.Search.cs @@ -40,7 +40,7 @@ private void Search() if (_localPlayerCharacterView.GetLocalPlayerCharacter().HasAnyBrokenItem()) { - Core.Log("Damaged - Items fell below 10% durability. Head to Repair in home town"); + Core.Log("Damaged - Items fell below 60% durability. Head to Repair in home town"); _state.Fire(Trigger.Damaged); return; } @@ -144,15 +144,18 @@ private void Search() public bool Loot() { - //var silver = _client.GetEntities(s => !s.IsLootProtected()).FirstOrDefault(); - //if (silver != null) - //{ - // Core.Log($"[Silver {silver.name}]"); - // _localPlayerCharacterView.Interact(silver); - // return true; - //} - - var loot = _client.GetEntities(l => l.CanLoot()).FirstOrDefault(); + var silver = _client.GetEntities(x => Vector3.Distance(_localPlayerCharacterView.transform.position, x.transform.position) < 8).FirstOrDefault(); + if (silver != null) + { + + Core.Log($"[Silver {silver.name}]"); + _localPlayerCharacterView.Interact(silver); + return true; + + } + + var loot = _client.GetEntities(x => x.CanLoot() && Vector3.Distance(_localPlayerCharacterView.transform.position, x.transform.position) < 8).FirstOrDefault(); + if (loot != null) { if (ContainKeepers(loot.transform.position)) diff --git a/README.md b/README.md index 6e1f416..d0ee290 100644 --- a/README.md +++ b/README.md @@ -29,10 +29,10 @@ We have a [Trello board](https://trello.com/b/eGLVeGbL/merlin) where you can see Join us! :+1: ```javascript -https://discord.gg/Z4Qtjty +https://discord.gg/aPfbDgK ``` -We have a [Discord Channel](https://discord.gg/Z4Qtjty) community to code tools for Albion Online. +We have a [Discord Channel](https://discord.gg/aPfbDgK) community to code tools for Albion Online. diff --git a/albion-load.bat b/albion-load.bat index 272cab9..f8f2376 100644 --- a/albion-load.bat +++ b/albion-load.bat @@ -7,5 +7,13 @@ SET Target=Albion-Online.exe SET LoadingAssembly=%AssemblyPath%\%AssemblyName%.dll +echo Unloading +if exist %UnloadAssembly% injector -dll %UnloadAssembly% -target %Target% -namespace %AssemblyName% -class Core -method Unload + +echo Loading +if exist %UnloadAssembly% del %UnloadAssembly% + +copy /y %LoadingAssembly% %UnloadAssembly% + injector -dll %LoadingAssembly% -target %Target% -namespace %AssemblyName% -class Core -method Load diff --git a/albion-unload.bat b/albion-unload.bat index fe2db5c..da07a7d 100644 --- a/albion-unload.bat +++ b/albion-unload.bat @@ -1,5 +1,12 @@ @echo off -echo Unoading -injector -dll Albion\Release\Merlin-unload.dll -target Albion-Online.exe -namespace Merlin -class Core -method Unload -del Albion\Release\Merlin-unload.dll \ No newline at end of file +SET AssemblyPath=Albion\Release +SET AssemblyName=Merlin + +SET Target=Albion-Online.exe + +SET UnloadAssembly=%AssemblyPath%\%AssemblyName%-unload.dll + +echo Unloading +if exist %UnloadAssembly% injector -dll %UnloadAssembly% -target %Target% -namespace %AssemblyName% -class Core -method Unload +if exist %UnloadAssembly% del %UnloadAssembly%