mirror of
https://github.com/mod-playerbots/mod-playerbots.git
synced 2026-01-13 09:07:19 +00:00
Item spell coverage calculation
This commit is contained in:
@@ -4,10 +4,16 @@
|
||||
*/
|
||||
|
||||
#include "TellLosAction.h"
|
||||
#include <istream>
|
||||
#include <sstream>
|
||||
|
||||
#include "ChatHelper.h"
|
||||
#include "DBCStores.h"
|
||||
#include "Event.h"
|
||||
#include "ItemTemplate.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "Playerbots.h"
|
||||
#include "StatsWeightCalculator.h"
|
||||
#include "World.h"
|
||||
|
||||
bool TellLosAction::Execute(Event event)
|
||||
@@ -130,3 +136,21 @@ bool TellExpectedDpsAction::Execute(Event event)
|
||||
botAI->TellMaster("Expected Group DPS: " + std::to_string(dps));
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TellCalculateItemAction::Execute(Event event)
|
||||
{
|
||||
std::string const text = event.getParam();
|
||||
ItemIds ids = chat->parseItems(text);
|
||||
StatsWeightCalculator calculator(bot);
|
||||
for (const uint32 &id : ids)
|
||||
{
|
||||
const ItemTemplate* proto = sObjectMgr->GetItemTemplate(id);
|
||||
if (!proto)
|
||||
continue;
|
||||
float score = calculator.CalculateItem(id);
|
||||
std::ostringstream out;
|
||||
out << "Calculated score of " << chat->FormatItem(proto) << " : " << score;
|
||||
botAI->TellMasterNoFacing(out.str());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
Reference in New Issue
Block a user