mirror of
https://git.vectorsigma.ru/public/mod-playerbots.git
synced 2026-08-05 03:39:25 +00:00
Run clang-format
This commit is contained in:
@@ -1,20 +1,18 @@
|
||||
/*
|
||||
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU GPL v2 license, you may redistribute it and/or modify it under version 2 of the License, or (at your option), any later version.
|
||||
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU GPL v2 license, you may redistribute it
|
||||
* and/or modify it under version 2 of the License, or (at your option), any later version.
|
||||
*/
|
||||
|
||||
#include "SpellIdValue.h"
|
||||
|
||||
#include "ChatHelper.h"
|
||||
#include "Playerbots.h"
|
||||
#include "Vehicle.h"
|
||||
#include "World.h"
|
||||
|
||||
SpellIdValue::SpellIdValue(PlayerbotAI* botAI) : CalculatedValue<uint32>(botAI, "spell id", 20 * 1000)
|
||||
{
|
||||
}
|
||||
SpellIdValue::SpellIdValue(PlayerbotAI* botAI) : CalculatedValue<uint32>(botAI, "spell id", 20 * 1000) {}
|
||||
|
||||
VehicleSpellIdValue::VehicleSpellIdValue(PlayerbotAI* botAI) : CalculatedValue<uint32>(botAI, "vehicle spell id")
|
||||
{
|
||||
}
|
||||
VehicleSpellIdValue::VehicleSpellIdValue(PlayerbotAI* botAI) : CalculatedValue<uint32>(botAI, "vehicle spell id") {}
|
||||
|
||||
uint32 SpellIdValue::Calculate()
|
||||
{
|
||||
@@ -55,7 +53,8 @@ uint32 SpellIdValue::Calculate()
|
||||
bool useByItem = false;
|
||||
for (uint8 i = 0; i < 3; ++i)
|
||||
{
|
||||
if (spellInfo->Effects[i].Effect == SPELL_EFFECT_CREATE_ITEM && itemIds.find(spellInfo->Effects[i].ItemType) != itemIds.end())
|
||||
if (spellInfo->Effects[i].Effect == SPELL_EFFECT_CREATE_ITEM &&
|
||||
itemIds.find(spellInfo->Effects[i].ItemType) != itemIds.end())
|
||||
{
|
||||
useByItem = true;
|
||||
break;
|
||||
@@ -63,7 +62,8 @@ uint32 SpellIdValue::Calculate()
|
||||
}
|
||||
|
||||
char const* spellName = spellInfo->SpellName[loc];
|
||||
if (!useByItem && (tolower(spellName[0]) != firstSymbol || strlen(spellName) != spellLength || !Utf8FitTo(spellName, wnamepart)))
|
||||
if (!useByItem && (tolower(spellName[0]) != firstSymbol || strlen(spellName) != spellLength ||
|
||||
!Utf8FitTo(spellName, wnamepart)))
|
||||
continue;
|
||||
|
||||
spellIds.insert(spellId);
|
||||
@@ -86,14 +86,16 @@ uint32 SpellIdValue::Calculate()
|
||||
continue;
|
||||
|
||||
char const* spellName = spellInfo->SpellName[loc];
|
||||
if (tolower(spellName[0]) != firstSymbol || strlen(spellName) != spellLength || !Utf8FitTo(spellName, wnamepart))
|
||||
if (tolower(spellName[0]) != firstSymbol || strlen(spellName) != spellLength ||
|
||||
!Utf8FitTo(spellName, wnamepart))
|
||||
continue;
|
||||
|
||||
spellIds.insert(spellId);
|
||||
}
|
||||
}
|
||||
|
||||
if (spellIds.empty()) return 0;
|
||||
if (spellIds.empty())
|
||||
return 0;
|
||||
|
||||
int32 saveMana = (int32)round(AI_VALUE(double, "mana save level"));
|
||||
uint32 rank = 1;
|
||||
@@ -106,7 +108,7 @@ uint32 SpellIdValue::Calculate()
|
||||
for (auto it = spellIds.rbegin(); it != spellIds.rend(); ++it)
|
||||
{
|
||||
auto spellId = *it;
|
||||
const SpellInfo *pSpellInfo = sSpellMgr->GetSpellInfo(spellId);
|
||||
const SpellInfo* pSpellInfo = sSpellMgr->GetSpellInfo(spellId);
|
||||
if (!pSpellInfo)
|
||||
continue;
|
||||
|
||||
@@ -115,7 +117,10 @@ uint32 SpellIdValue::Calculate()
|
||||
// For atoi, the input string has to start with a digit, so lets search for the first digit
|
||||
size_t i = 0;
|
||||
for (; i < spellName.length(); i++)
|
||||
{ if (isdigit(spellName[i])) break; }
|
||||
{
|
||||
if (isdigit(spellName[i]))
|
||||
break;
|
||||
}
|
||||
|
||||
// remove the first chars, which aren't digits
|
||||
spellName = spellName.substr(i, spellName.length() - i);
|
||||
@@ -156,7 +161,7 @@ uint32 SpellIdValue::Calculate()
|
||||
}
|
||||
}
|
||||
|
||||
return saveMana > 1 ? lowestSpellId : highestSpellId;
|
||||
return saveMana > 1 ? lowestSpellId : highestSpellId;
|
||||
}
|
||||
|
||||
uint32 VehicleSpellIdValue::Calculate()
|
||||
@@ -204,7 +209,8 @@ uint32 VehicleSpellIdValue::Calculate()
|
||||
continue;
|
||||
|
||||
char const* spellName = spellInfo->SpellName[loc];
|
||||
if (tolower(spellName[0]) != firstSymbol || strlen(spellName) != spellLength || !Utf8FitTo(spellName, wnamepart))
|
||||
if (tolower(spellName[0]) != firstSymbol || strlen(spellName) != spellLength ||
|
||||
!Utf8FitTo(spellName, wnamepart))
|
||||
continue;
|
||||
|
||||
return spellId;
|
||||
|
||||
Reference in New Issue
Block a user