Enhanced dual wield logic in EquipItem

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.
This commit is contained in:
avirar
2024-12-14 18:52:57 +11:00
committed by GitHub
parent 0c16f308db
commit d77dbb65e5

View File

@@ -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;
}