feat(Core/AI): CU_SAI - Custom Target Options (#2879)

NEW:
* SMART_TARGET_PLAYER_WITH_AURA (spellid, negation?, distMax, distMin) - if target.O is set it will resize the list of targets to target.o
* SMART_TARGET_RANDOM_POINT (range, amount (for summon creature), self (creature is middle else use xyz) (ONLY USED FOR SUMMON CREATURE OR MOVE/JUMP TO POS ACTIONS FOR NOW)

MODIFIED:
* SMART_ACTION_SUMMON_CREATURE now possible to spawn multiple creatures with SMART_TARGET_RANDOM_POINT
* SMART_ACTION_MOVE_TO_POS/JUMP_TO_POS now possible to move to a random point with SMART_TARGET_RANDOM_POINT
* SMART_TARGET_PLAYER_RANGE no longer targets GMs or dead targets and when target.o is >0 it will try all possible targets in max instead of min-maxing


Co-authored-by: Francesco Borzì <borzifrancesco@gmail.com>
This commit is contained in:
P-Kito
2020-04-18 16:59:52 +02:00
committed by GitHub
parent 63c86a9a14
commit 2514f8fc9a
7 changed files with 1033 additions and 677 deletions

View File

@@ -159,6 +159,9 @@ DBCStorage <TalentEntry> sTalentStore(TalentEntryfmt);
TalentSpellPosMap sTalentSpellPosMap;
DBCStorage <TalentTabEntry> sTalentTabStore(TalentTabEntryfmt);
// store absolute bit position for first rank for talent inspect
static uint32 sTalentTabPages[MAX_CLASSES][3];
DBCStorage <TaxiNodesEntry> sTaxiNodesStore(TaxiNodesEntryfmt);
TaxiMask sTaxiNodesMask;
TaxiMask sOldContinentsNodesMask;
@@ -469,6 +472,26 @@ void LoadDBCStores(const std::string& dataPath)
LoadDBC(availableDbcLocales, bad_dbc_files, sTalentTabStore, dbcPath, "TalentTab.dbc");
// prepare fast data access to bit pos of talent ranks for use at inspecting
{
// now have all max ranks (and then bit amount used for store talent ranks in inspect)
for (uint32 talentTabId = 1; talentTabId < sTalentTabStore.GetNumRows(); ++talentTabId)
{
TalentTabEntry const* talentTabInfo = sTalentTabStore.LookupEntry(talentTabId);
if (!talentTabInfo)
continue;
// prevent memory corruption; otherwise cls will become 12 below
if ((talentTabInfo->ClassMask & CLASSMASK_ALL_PLAYABLE) == 0)
continue;
// store class talent tab pages
for (uint32 cls = 1; cls < MAX_CLASSES; ++cls)
if (talentTabInfo->ClassMask & (1 << (cls - 1)))
sTalentTabPages[cls][talentTabInfo->tabpage] = talentTabId;
}
}
LoadDBC(availableDbcLocales, bad_dbc_files, sTaxiNodesStore, dbcPath, "TaxiNodes.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sTaxiPathStore, dbcPath, "TaxiPath.dbc");
for (uint32 i = 1; i < sTaxiPathStore.GetNumRows(); ++i)
@@ -784,9 +807,14 @@ PvPDifficultyEntry const* GetBattlegroundBracketById(uint32 mapid, BattlegroundB
return NULL;
}
uint32 const* GetTalentTabPages(uint8 cls)
{
return sTalentTabPages[cls];
}
bool IsSharedDifficultyMap(uint32 mapid)
{
return sWorld->getBoolConfig(CONFIG_INSTANCE_SHARED_ID) && (mapid == 631 || mapid == 724);
{
return sWorld->getBoolConfig(CONFIG_INSTANCE_SHARED_ID) && (mapid == 631 || mapid == 724);
}
uint32 GetLiquidFlags(uint32 liquidType)

View File

@@ -41,6 +41,8 @@ MapDifficulty const* GetDownscaledMapDifficultyData(uint32 mapId, Difficulty &di
bool IsSharedDifficultyMap(uint32 mapid);
uint32 const* /*[MAX_TALENT_TABS]*/ GetTalentTabPages(uint8 cls);
uint32 GetLiquidFlags(uint32 liquidType);
PvPDifficultyEntry const* GetBattlegroundBracketByLevel(uint32 mapid, uint32 level);