Item spell coverage calculation

This commit is contained in:
Yunfan Li
2024-08-11 02:10:50 +08:00
parent 7db30c96b8
commit 52b9dec2cd
8 changed files with 147 additions and 125 deletions

View File

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