Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dbcsql #442

Open
wants to merge 28 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
dd7f026
Load DBC from databases WiP
cyberium Mar 4, 2021
df604c0
"Templatize" SQLStorage class.
cyberium Mar 4, 2021
7f605f2
Reneame SQLStorage::GetRecordCount to GetNumRows
cyberium Mar 4, 2021
3388c8e
Templatize SQLHashStorage and SQLMultiStorage
cyberium Mar 4, 2021
abb5a20
Improve SqlStorageBase iterator class
cyberium Mar 5, 2021
70bb5a1
Change sCreatureStorage and sGOStorage loop format
cyberium Mar 5, 2021
b3e9bbb
Convert more SQLStorages loop
cyberium Mar 5, 2021
d80a6d6
Should fix template build
cyberium Mar 5, 2021
5c6b4fa
Fix PlayerBot build
cyberium Mar 6, 2021
90b7002
Use sDBCAreaTable store.
cyberium Mar 8, 2021
5fe6b3a
Implement sql storage n and d format
cyberium Mar 9, 2021
4fa514e
Adjust SQLStorage format and constructor
cyberium Mar 9, 2021
c0042e6
Convert some more loop of sDBCAreaTable
cyberium Mar 9, 2021
ae932f4
sDBCAreaTrigger
cyberium Mar 9, 2021
43db956
sDBCAuctionHouse
cyberium Mar 9, 2021
5899480
sDBCBankBagSlotPrices
cyberium Mar 9, 2021
92156aa
sDBCBattlemasterList
cyberium Mar 9, 2021
58f61e4
sDBCCharStartOutfit
cyberium Mar 9, 2021
7f60374
sDBCCharTitles
cyberium Mar 9, 2021
0aaaf81
sDBCChatChannels
cyberium Mar 9, 2021
685c42a
fix build
cyberium Mar 9, 2021
773afe0
sDBCChrClasses
cyberium Mar 9, 2021
f58ff97
Batch of dbc store convertion from file to db
cyberium Mar 9, 2021
84ba747
Some fixes to make it run again.
cyberium Mar 9, 2021
413b280
More loop convertion
cyberium Mar 9, 2021
0f8dc64
Moving code and removing DBCStore code
cyberium Mar 10, 2021
946a969
Just some allignements
cyberium Mar 10, 2021
cc47b14
Store renaming
cyberium Mar 10, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/game/AI/BaseAI/PetAI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ void PetAI::UpdateAI(const uint32 diff)
&& m_unit->IsWithinLOSInMap(victim, true))
{
uint32 spellId = charminfo->GetSpellOpener();
SpellEntry const* spellInfo = sSpellTemplate.LookupEntry<SpellEntry>(spellId);
SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(spellId);
Spell* spell = new Spell(m_unit, spellInfo, TRIGGERED_NONE);

// Push back stored spell
Expand All @@ -208,7 +208,7 @@ void PetAI::UpdateAI(const uint32 diff)
if (!spellId)
continue;

SpellEntry const* spellInfo = sSpellTemplate.LookupEntry<SpellEntry>(spellId);
SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(spellId);
if (!spellInfo)
continue;

Expand Down
2 changes: 1 addition & 1 deletion src/game/AI/BaseAI/TotemAI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ void TotemAI::UpdateAI(const uint32 diff)
return;

// Search spell
SpellEntry const* spellInfo = sSpellTemplate.LookupEntry<SpellEntry>(getTotem().GetSpell());
SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(getTotem().GetSpell());
if (!spellInfo)
return;

Expand Down
2 changes: 1 addition & 1 deletion src/game/AI/BaseAI/UnitAI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ CanCastResult UnitAI::DoCastSpellIfCan(Unit* target, uint32 spellId, uint32 cast
// Allowed to cast only if not casting (unless we interrupt ourself) or if spell is triggered
if (!caster->IsNonMeleeSpellCasted(false) || (castFlags & (CAST_TRIGGERED | CAST_INTERRUPT_PREVIOUS)))
{
if (const SpellEntry* spellInfo = sSpellTemplate.LookupEntry<SpellEntry>(spellId))
if (const SpellEntry* spellInfo = sSpellTemplate.LookupEntry(spellId))
{
// If cast flag CAST_AURA_NOT_PRESENT is active, check if target already has aura on them
if (castFlags & CAST_AURA_NOT_PRESENT)
Expand Down
14 changes: 7 additions & 7 deletions src/game/AI/EventAI/CreatureEventAI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ void CreatureEventAI::InitAI()
if (!m_mainSpellId)
{
m_mainSpellId = i.action[actionIdx].cast.spellId;
SpellEntry const* spellInfo = sSpellTemplate.LookupEntry<SpellEntry>(m_mainSpellId);
SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(m_mainSpellId);
m_mainSpellCost = Spell::CalculatePowerCost(spellInfo, m_creature);
m_mainSpellMinRange = GetSpellMinRange(sSpellRangeStore.LookupEntry(spellInfo->rangeIndex));
m_mainAttackMask = SpellSchoolMask(m_mainAttackMask + spellInfo->SchoolMask);
Expand Down Expand Up @@ -465,18 +465,18 @@ bool CreatureEventAI::CheckEvent(CreatureEventAIHolder& holder, Unit* actionInvo
{
if (!m_creature->IsInCombat())
return false;

DoFindFriendlyMissingBuff(pList, (float)event.friendly_buff.radius, event.friendly_buff.spellId, false);
}
else if (event.friendly_buff.inCombat == 1)
DoFindFriendlyMissingBuff(pList, (float)event.friendly_buff.radius, event.friendly_buff.spellId, true);
else if (event.friendly_buff.inCombat == 1)
DoFindFriendlyMissingBuff(pList, (float)event.friendly_buff.radius, event.friendly_buff.spellId, true);
else if (event.friendly_buff.inCombat == 2)
{
if (m_creature->IsInCombat())
return false;

DoFindFriendlyMissingBuff(pList, (float)event.friendly_buff.radius, event.friendly_buff.spellId, true);
}
}

// List is empty
if (pList.empty())
Expand Down Expand Up @@ -830,7 +830,7 @@ bool CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
if (!(action.cast.castFlags & (CAST_TRIGGERED | CAST_FORCE_CAST | CAST_FORCE_TARGET_SELF)))
{
spellId = action.cast.spellId;
SpellEntry const* spellInfo = sSpellTemplate.LookupEntry<SpellEntry>(spellId);
SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(spellId);
if (!spellInfo)
return false;
if (!IsIgnoreLosSpellCast(spellInfo))
Expand Down
67 changes: 32 additions & 35 deletions src/game/AI/EventAI/CreatureEventAIMgr.cpp

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/game/AI/ScriptDevAI/base/CombatAI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ void RangedCombatAI::AddMainSpell(uint32 spellId)
if (!m_mainSpellId) // only for first
{
m_mainSpellId = spellId;
SpellEntry const* spellInfo = sSpellTemplate.LookupEntry<SpellEntry>(m_mainSpellId);
SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(m_mainSpellId);
m_mainSpellCost = Spell::CalculatePowerCost(spellInfo, m_creature);
m_mainSpellMinRange = GetSpellMinRange(sSpellRangeStore.LookupEntry(spellInfo->rangeIndex));
m_mainAttackMask = SpellSchoolMask(m_mainAttackMask + spellInfo->SchoolMask);
Expand Down
14 changes: 7 additions & 7 deletions src/game/AI/ScriptDevAI/include/sc_creature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ void ScriptedAI::DoPlaySoundToSet(WorldObject* source, uint32 soundId)
if (!source)
return;

if (!GetSoundEntriesStore()->LookupEntry(soundId))
if (!sSoundEntriesStore.LookupEntry(soundId))
{
script_error_log("Invalid soundId %u used in DoPlaySoundToSet (Source: TypeId %u, GUID %u)", soundId, source->GetTypeId(), source->GetGUIDLow());
return;
Expand Down Expand Up @@ -130,7 +130,7 @@ SpellEntry const* ScriptedAI::SelectSpell(Unit* target, int32 school, int32 mech
// Check if each spell is viable(set it to null if not)
for (uint8 i = 0; i < 4; ++i)
{
SpellEntry const* tempSpellInfo = GetSpellStore()->LookupEntry<SpellEntry>(m_creature->m_spells[i]);
SpellEntry const* tempSpellInfo = GetSpellStore()->LookupEntry(m_creature->m_spells[i]);

// This spell doesn't exist
if (!tempSpellInfo)
Expand Down Expand Up @@ -165,7 +165,7 @@ SpellEntry const* ScriptedAI::SelectSpell(Unit* target, int32 school, int32 mech
continue;

// Get the Range
SpellRangeEntry const* tempRange = GetSpellRangeStore()->LookupEntry(tempSpellInfo->rangeIndex);
SpellRangeEntry const* tempRange = sSpellRangeStore.LookupEntry(tempSpellInfo->rangeIndex);

// Spell has invalid range store so we can't use it
if (!tempRange)
Expand Down Expand Up @@ -208,7 +208,7 @@ bool ScriptedAI::CanCast(Unit* target, SpellEntry const* spellInfo, bool trigger
if (!triggered && m_creature->GetPower((Powers)spellInfo->powerType) < spellInfo->manaCost)
return false;

SpellRangeEntry const* tempRange = GetSpellRangeStore()->LookupEntry(spellInfo->rangeIndex);
SpellRangeEntry const* tempRange = sSpellRangeStore.LookupEntry(spellInfo->rangeIndex);

// Spell has invalid range store so we can't use it
if (!tempRange)
Expand All @@ -230,7 +230,7 @@ void FillSpellSummary()
SpellSummary[i].Effects = 0;
SpellSummary[i].Targets = 0;

SpellEntry const* tempSpell = GetSpellStore()->LookupEntry<SpellEntry>(i);
SpellEntry const* tempSpell = GetSpellStore()->LookupEntry(i);
// This spell doesn't exist
if (!tempSpell)
continue;
Expand Down Expand Up @@ -333,7 +333,7 @@ CreatureList ScriptedAI::DoFindFriendlyCC(float range)
CreatureList ScriptedAI::DoFindFriendlyMissingBuff(float range, uint32 spellId, bool inCombat)
{
CreatureList creatureList;

if (inCombat == false)
{
MaNGOS::FriendlyMissingBuffInRangeInCombatCheck u_check(m_creature, range, spellId);
Expand All @@ -346,7 +346,7 @@ CreatureList ScriptedAI::DoFindFriendlyMissingBuff(float range, uint32 spellId,
MaNGOS::CreatureListSearcher<MaNGOS::FriendlyMissingBuffInRangeNotInCombatCheck> searcher(creatureList, u_check);

Cell::VisitGridObjects(m_creature, searcher, range);
}
}

return creatureList;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ struct boss_curatorAI : public CombatAI
uint32 randomSpell = astralFlareSpells[urand(0, 3)];
DoCastSpellIfCan(nullptr, randomSpell);
ResetCombatAction(action, GetSubsequentActionTimer(action));
SpellEntry const* spellInfo = sSpellTemplate.LookupEntry<SpellEntry>(randomSpell);
SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(randomSpell);
// supposed to happen right away not on next oom
if (m_creature->GetPower((Powers)spellInfo->powerType) < Spell::CalculatePowerCost(spellInfo, m_creature))
{
Expand Down
Loading