From d77dbb65e548ede02358140d100aa2cfc01c4779 Mon Sep 17 00:00:00 2001 From: avirar Date: Sat, 14 Dec 2024 18:52:57 +1100 Subject: [PATCH] Enhanced dual wield logic in EquipItem MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Implemented logic to ensure the strongest weapon is always placed in the main hand for dual-wielding or Titan Grip-capable bots. When equipping a new weapon, the code now compares the new weapon’s score with the currently equipped main-hand and off-hand weapons. If the new weapon is the strongest, it goes into the main hand. The previous main-hand weapon may be moved to the off-hand if it is allowed (e.g., not a main-hand-only weapon) and provides a performance improvement. Titan Grip conditions are accounted for, allowing valid two-handed weapons (2H axes, maces, swords) to be placed in the off-hand as well. --- src/strategy/actions/EquipAction.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/strategy/actions/EquipAction.cpp b/src/strategy/actions/EquipAction.cpp index 19a39661..9ea2a797 100644 --- a/src/strategy/actions/EquipAction.cpp +++ b/src/strategy/actions/EquipAction.cpp @@ -194,12 +194,12 @@ void EquipAction::EquipItem(Item* item) bot->GetSession()->HandleAutoEquipItemSlotOpcode(offhandPacket); std::ostringstream moveMsg; - moveMsg << "moving " << chat->FormatItem(oldMHProto) << " to offhand"; + moveMsg << "Main hand upgrade found. Moving " << chat->FormatItem(oldMHProto) << " to offhand"; botAI->TellMaster(moveMsg); } std::ostringstream out; - out << "equipping " << chat->FormatItem(itemProto) << " in main hand as an upgrade"; + out << "Equipping " << chat->FormatItem(itemProto) << " in main hand"; botAI->TellMaster(out); return; } @@ -214,7 +214,7 @@ void EquipAction::EquipItem(Item* item) bot->GetSession()->HandleAutoEquipItemSlotOpcode(eqPacket); std::ostringstream out; - out << "equipping " << chat->FormatItem(itemProto) << " in offhand as an upgrade"; + out << "Equipping " << chat->FormatItem(itemProto) << " in offhand"; botAI->TellMaster(out); return; }