miscs: engine

This commit is contained in:
Yunfan Li
2023-08-03 21:27:59 +08:00
parent 1c47108c23
commit 09566cb664
7 changed files with 62 additions and 29 deletions

View File

@@ -261,8 +261,8 @@ bool Engine::DoNextAction(Unit* unit, uint32 depth, bool minimal)
lastRelevance = 0.0f;
PushDefaultActions();
if (queue.Peek() && depth < 1 && !minimal)
return DoNextAction(unit, depth + 1, minimal);
// if (queue.Peek() && depth < 1 && !minimal)
// return DoNextAction(unit, depth + 1, minimal);
}
// MEMORY FIX TEST

View File

@@ -26,21 +26,53 @@ bool LootRollAction::Execute(Event event)
p >> rollType; //need,greed or pass on roll
RollVote vote = PASS;
if (ItemTemplate const* proto = sObjectMgr->GetItemTemplate(guid.GetEntry()))
{
switch (proto->Class)
{
case ITEM_CLASS_WEAPON:
case ITEM_CLASS_ARMOR:
if (!QueryItemUsage(proto).empty())
vote = NEED;
break;
default:
if (StoreLootAction::IsLootAllowed(guid.GetEntry(), botAI))
vote = NEED;
break;
}
}
// std::vector<Roll*> rolls = group->GetRolls();
// bot->Say("guid:" + std::to_string(guid.GetCounter()) +
// "item entry:" + std::to_string(guid.GetEntry()), LANG_UNIVERSAL);
// for (std::vector<Roll*>::iterator i = rolls.begin(); i != rolls.end(); ++i)
// {
// if ((*i)->isValid() && (*i)->itemGUID == guid && (*i)->itemSlot == slot)
// {
// uint32 itemId = (*i)->itemid;
// bot->Say("item entry2:" + std::to_string(itemId), LANG_UNIVERSAL);
// ItemTemplate const *proto = sObjectMgr->GetItemTemplate(itemId);
// if (!proto)
// continue;
// switch (proto->Class)
// {
// case ITEM_CLASS_WEAPON:
// case ITEM_CLASS_ARMOR:
// if (!QueryItemUsage(proto).empty())
// vote = NEED;
// else if (bot->HasSkill(SKILL_ENCHANTING))
// vote = DISENCHANT;
// break;
// default:
// if (StoreLootAction::IsLootAllowed(itemId, botAI))
// vote = NEED;
// break;
// }
// break;
// }
// }
// if (ItemTemplate const* proto = sObjectMgr->GetItemTemplate(guid.GetEntry()))
// {
// switch (proto->Class)
// {
// case ITEM_CLASS_WEAPON:
// case ITEM_CLASS_ARMOR:
// if (!QueryItemUsage(proto).empty())
// vote = NEED;
// break;
// default:
// if (StoreLootAction::IsLootAllowed(guid.GetEntry(), botAI))
// vote = NEED;
// break;
// }
// }
switch (group->GetLootMethod())
{

View File

@@ -135,11 +135,10 @@ bool MovementAction::MoveTo(uint32 mapId, float x, float y, float z, bool idle,
if (!IsMovingAllowed(mapId, x, y, z)) {
return false;
}
// if (bot->HasUnitMovementFlag(MOVEMENTFLAG_FALLING | MOVEMENTFLAG_FALLING_FAR)) {
// bot->Yell("I'm falling!", LANG_UNIVERSAL);
// if (bot->m_movementInfo.HasMovementFlag(MOVEMENTFLAG_FALLING | MOVEMENTFLAG_FALLING_SLOW | MOVEMENTFLAG_FALLING_FAR)) {
// bot->Say("I'm falling!, flag:" + std::to_string(bot->m_movementInfo.GetMovementFlags()), LANG_UNIVERSAL);
// return false;
// }
// bot->UpdateGroundPositionZ(x, y, z);
z += 2.0f;
bot->UpdateAllowedPositionZ(x, y, z);
// z += 0.5f;

View File

@@ -43,7 +43,7 @@ WorldLocation ArrowFormation::GetLocationInternal()
float x = master->GetPositionX() - masterUnit->GetX() + botUnit->GetX();
float y = master->GetPositionY() - masterUnit->GetY() + botUnit->GetY();
float z = master->GetPositionZ();
float z = master->GetPositionZ() + 5.0f;
float ground = master->GetMap()->GetHeight(x, y, z + 0.5f);
if (ground <= INVALID_HEIGHT)