Skip to content

Commit

Permalink
Core/DataStores: Updating spells dbc part 2
Browse files Browse the repository at this point in the history
  • Loading branch information
chemicstry committed Nov 10, 2014
1 parent f847f55 commit 43d5fb5
Show file tree
Hide file tree
Showing 21 changed files with 301 additions and 282 deletions.
2 changes: 1 addition & 1 deletion src/server/game/AI/CoreAI/UnitAI.cpp
Expand Up @@ -296,7 +296,7 @@ bool SpellTargetSelector::operator()(Unit const* target) const
return false;

// copypasta from Spell::CheckRange
uint32 range_type = _spellInfo->RangeEntry ? _spellInfo->RangeEntry->type : 0;
uint32 range_type = _spellInfo->RangeEntry ? _spellInfo->RangeEntry->Flags : 0;
float max_range = _caster->GetSpellMaxRangeForTarget(target, _spellInfo);
float min_range = _caster->GetSpellMinRangeForTarget(target, _spellInfo);

Expand Down
22 changes: 15 additions & 7 deletions src/server/game/DataStores/DB2Stores.cpp
Expand Up @@ -28,7 +28,11 @@ DB2Storage<ItemExtendedCostEntry> sItemExtendedCostStore(ItemExtendedCostEntryfm
DB2Storage<ItemSparseEntry> sItemSparseStore(ItemSparsefmt, &DB2Utilities::HasItemSparseEntry, &DB2Utilities::WriteItemSparseDbReply);
DB2Storage<KeyChainEntry> sKeyChainStore(KeyChainfmt);
DB2Storage<SpellAuraRestrictionsEntry> sSpellAuraRestrictionsStore(SpellAuraRestrictionsEntryfmt);
DB2Storage<SpellClassOptionsEntry> sSpellClassOptionsStore(SpellClassOptionsEntryfmt);
DB2Storage<SpellMiscEntry> sSpellMiscStore(SpellMiscEntryfmt);
DB2Storage<SpellPowerEntry> sSpellPowerStore(SpellPowerEntryfmt);
DB2Storage<SpellReagentsEntry> sSpellReagentsStore(SpellReagentsEntryfmt);
DB2Storage<SpellRuneCostEntry> sSpellRuneCostStore(SpellRuneCostEntryfmt);

typedef std::list<std::string> DB2StoreProblemList;

Expand Down Expand Up @@ -98,13 +102,17 @@ void LoadDB2Stores(std::string const& dataPath)
DB2StoreProblemList bad_db2_files;
uint32 availableDb2Locales = 0xFF;

LoadDB2(availableDb2Locales, bad_db2_files, sItemStore, db2Path, "Item.db2");
LoadDB2(availableDb2Locales, bad_db2_files, sItemCurrencyCostStore, db2Path, "ItemCurrencyCost.db2");
LoadDB2(availableDb2Locales, bad_db2_files, sItemSparseStore, db2Path, "Item-sparse.db2");
LoadDB2(availableDb2Locales, bad_db2_files, sItemExtendedCostStore, db2Path, "ItemExtendedCost.db2");
LoadDB2(availableDb2Locales, bad_db2_files, sKeyChainStore, db2Path, "KeyChain.db2");
LoadDB2(availableDb2Locales, bad_db2_files, sSpellAuraRestrictionsStore, db2Path, "SpellAuraRestrictions.db2");
LoadDB2(availableDb2Locales, bad_db2_files, sSpellMiscStore, db2Path, "SpellMisc.db2");
LoadDB2(availableDb2Locales, bad_db2_files, sItemStore, db2Path, "Item.db2");
LoadDB2(availableDb2Locales, bad_db2_files, sItemCurrencyCostStore, db2Path, "ItemCurrencyCost.db2");
LoadDB2(availableDb2Locales, bad_db2_files, sItemSparseStore, db2Path, "Item-sparse.db2");
LoadDB2(availableDb2Locales, bad_db2_files, sItemExtendedCostStore, db2Path, "ItemExtendedCost.db2");
LoadDB2(availableDb2Locales, bad_db2_files, sKeyChainStore, db2Path, "KeyChain.db2");
LoadDB2(availableDb2Locales, bad_db2_files, sSpellAuraRestrictionsStore, db2Path, "SpellAuraRestrictions.db2");
LoadDB2(availableDb2Locales, bad_db2_files, sSpellClassOptionsStore, db2Path, "SpellClassOptions.db2");
LoadDB2(availableDb2Locales, bad_db2_files, sSpellMiscStore, db2Path, "SpellMisc.db2");
LoadDB2(availableDb2Locales, bad_db2_files, sSpellPowerStore, db2Path, "SpellPower.db2");
LoadDB2(availableDb2Locales, bad_db2_files, sSpellReagentsStore, db2Path, "SpellReagents.db2");
LoadDB2(availableDb2Locales, bad_db2_files, sSpellRuneCostStore, db2Path, "SpellRuneCost.db2");

// error checks
if (bad_db2_files.size() >= DB2FilesCount)
Expand Down
4 changes: 4 additions & 0 deletions src/server/game/DataStores/DB2Stores.h
Expand Up @@ -28,7 +28,11 @@ extern DB2Storage<ItemExtendedCostEntry> sItemExtendedCostStore;
extern DB2Storage<ItemSparseEntry> sItemSparseStore;
extern DB2Storage<KeyChainEntry> sKeyChainStore;
extern DB2Storage<SpellAuraRestrictionsEntry> sSpellAuraRestrictionsStore;
extern DB2Storage<SpellClassOptionsEntry> sSpellClassOptionsStore;
extern DB2Storage<SpellMiscEntry> sSpellMiscStore;
extern DB2Storage<SpellPowerEntry> sSpellPowerStore;
extern DB2Storage<SpellReagentsEntry> sSpellReagentsStore;
extern DB2Storage<SpellRuneCostEntry> sSpellRuneCostStore;

void LoadDB2Stores(std::string const& dataPath);

Expand Down
47 changes: 47 additions & 0 deletions src/server/game/DataStores/DB2Structure.h
Expand Up @@ -163,6 +163,14 @@ struct SpellAuraRestrictionsEntry
uint32 ExcludeTargetAuraSpell; // 8
};

struct SpellClassOptionsEntry
{
uint32 ID; // 0
uint32 ModalNextSpell; // 1
flag128 SpellClassMask; // 2
uint32 SpellClassSet; // 3
};

struct SpellMiscEntry
{
uint32 ID; // 0
Expand Down Expand Up @@ -191,6 +199,45 @@ struct SpellMiscEntry
//float Unk; // 24
};

struct SpellPowerEntry
{
uint32 ID; // 0
uint32 SpellID; // 1
//uint32 Unk2; // 2
//uint32 Unk3; // 3
uint32 ManaCost; // 4
uint32 ManaCostPerLevel; // 5
uint32 ManaCostPerSecond; // 6
//uint32 Unk4; // 7 (All 0 except one spell: 22570)
//uint32 Unk5; // 8
//uint32 Unk6; // 9
float ManaCostPercentage; // 10
//float Unk7; // 11
//uint32 Unk8; // 12
};

#define MAX_SPELL_REAGENTS 8

struct SpellReagentsEntry
{
uint32 ID; // 0
int32 Reagent[MAX_SPELL_REAGENTS]; // 1-8
uint32 ReagentCount[MAX_SPELL_REAGENTS]; // 9-16
//uint32 Unk1; // 17
//uint32 Unk2; // 18
};

struct SpellRuneCostEntry
{
uint32 ID; // 0
uint32 RuneCost[3]; // 1-3 (0=blood, 1=frost, 2=unholy)
//uint32 Unk; // 4 (All 0 except for 2 ids: 2510, 2748)
uint32 RunePowerGain; // 5

bool NoRuneCost() const { return RuneCost[0] == 0 && RuneCost[1] == 0 && RuneCost[2] == 0; }
bool NoRunicPowerGain() const { return RunePowerGain == 0; }
};

// GCC has alternative #pragma pack(N) syntax and old gcc version does not support pack(push, N), also any gcc version does not support it at some platform
#if defined(__GNUC__)
#pragma pack()
Expand Down
6 changes: 5 additions & 1 deletion src/server/game/DataStores/DB2fmt.h
Expand Up @@ -24,6 +24,10 @@ char const ItemSparsefmt[]="niiiffiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
char const ItemExtendedCostEntryfmt[]="nxxiiiiiiiiiiiixiiiiiiiiiiiiiii";
char const KeyChainfmt[]="nbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb";
char const SpellAuraRestrictionsEntryfmt[] = "diiiiiiii";
char const SpellMiscEntryfmt[] = "niiiiiiiiiiiiiiiiiiiiiif";
char const SpellClassOptionsEntryfmt[] = "niiiiii";
char const SpellMiscEntryfmt[] = "niiiiiiiiiiiiiiiiiiiiiix";
char const SpellPowerEntryfmt[] = "nixxiiixxxfxx";
char const SpellReagentsEntryfmt[] = "niiiiiiiiiiiiiiiixx";
char const SpellRuneCostEntryfmt[] = "niiixi";

#endif
13 changes: 2 additions & 11 deletions src/server/game/DataStores/DBCStores.cpp
Expand Up @@ -194,28 +194,23 @@ SpellCategoryStore sSpellsByCategoryStore;
PetFamilySpellsStore sPetFamilySpellsStore;


DBCStorage <SpellReagentsEntry> sSpellReagentsStore(SpellReagentsEntryfmt);
DBCStorage <SpellScalingEntry> sSpellScalingStore(SpellScalingEntryfmt);
DBCStorage <SpellTotemsEntry> sSpellTotemsStore(SpellTotemsEntryfmt);
DBCStorage <SpellTargetRestrictionsEntry> sSpellTargetRestrictionsStore(SpellTargetRestrictionsEntryfmt);
DBCStorage <SpellPowerEntry> sSpellPowerStore(SpellPowerEntryfmt);
DBCStorage <SpellLevelsEntry> sSpellLevelsStore(SpellLevelsEntryfmt);
DBCStorage <SpellInterruptsEntry> sSpellInterruptsStore(SpellInterruptsEntryfmt);
DBCStorage <SpellEquippedItemsEntry> sSpellEquippedItemsStore(SpellEquippedItemsEntryfmt);
DBCStorage <SpellClassOptionsEntry> sSpellClassOptionsStore(SpellClassOptionsEntryfmt);
DBCStorage <SpellCooldownsEntry> sSpellCooldownsStore(SpellCooldownsEntryfmt);
DBCStorage <SpellAuraOptionsEntry> sSpellAuraOptionsStore(SpellAuraOptionsEntryfmt);
DBCStorage <SpellCastingRequirementsEntry> sSpellCastingRequirementsStore(SpellCastingRequirementsEntryfmt);
DBCStorage <SpellCastTimesEntry> sSpellCastTimesStore(SpellCastTimefmt);
DBCStorage <SpellCategoriesEntry> sSpellCategoriesStore(SpellCategoriesEntryfmt);
DBCStorage <SpellCategoryEntry> sSpellCategoryStore(SpellCategoryfmt);
DBCStorage <SpellEffectEntry> sSpellEffectStore(SpellEffectEntryfmt);
DBCStorage <SpellDifficultyEntry> sSpellDifficultyStore(SpellDifficultyfmt);
DBCStorage <SpellDurationEntry> sSpellDurationStore(SpellDurationfmt);
DBCStorage <SpellFocusObjectEntry> sSpellFocusObjectStore(SpellFocusObjectfmt);
DBCStorage <SpellRadiusEntry> sSpellRadiusStore(SpellRadiusfmt);
DBCStorage <SpellRangeEntry> sSpellRangeStore(SpellRangefmt);
DBCStorage <SpellRuneCostEntry> sSpellRuneCostStore(SpellRuneCostfmt);
DBCStorage <SpellShapeshiftEntry> sSpellShapeshiftStore(SpellShapeshiftEntryfmt);
DBCStorage <SpellShapeshiftFormEntry> sSpellShapeshiftFormStore(SpellShapeshiftFormfmt);
DBCStorage <StableSlotPricesEntry> sStableSlotPricesStore(StableSlotPricesfmt);
Expand Down Expand Up @@ -548,28 +543,23 @@ void LoadDBCStores(const std::string& dataPath)
sSpellsByCategoryStore[category->Category].insert(i);
}

LoadDBC(availableDbcLocales, bad_dbc_files, sSpellReagentsStore, dbcPath,"SpellReagents.dbc");//15595
LoadDBC(availableDbcLocales, bad_dbc_files, sSpellScalingStore, dbcPath,"SpellScaling.dbc");//15595
LoadDBC(availableDbcLocales, bad_dbc_files, sSpellTotemsStore, dbcPath,"SpellTotems.dbc");//15595
LoadDBC(availableDbcLocales, bad_dbc_files, sSpellTargetRestrictionsStore, dbcPath,"SpellTargetRestrictions.dbc");//15595
LoadDBC(availableDbcLocales, bad_dbc_files, sSpellPowerStore, dbcPath,"SpellPower.dbc");//15595
LoadDBC(availableDbcLocales, bad_dbc_files, sSpellLevelsStore, dbcPath,"SpellLevels.dbc");//15595
LoadDBC(availableDbcLocales, bad_dbc_files, sSpellInterruptsStore, dbcPath,"SpellInterrupts.dbc");//15595
LoadDBC(availableDbcLocales, bad_dbc_files, sSpellEquippedItemsStore, dbcPath,"SpellEquippedItems.dbc");//15595
LoadDBC(availableDbcLocales, bad_dbc_files, sSpellClassOptionsStore, dbcPath,"SpellClassOptions.dbc");//15595
LoadDBC(availableDbcLocales, bad_dbc_files, sSpellCooldownsStore, dbcPath,"SpellCooldowns.dbc");//15595
LoadDBC(availableDbcLocales, bad_dbc_files, sSpellAuraOptionsStore, dbcPath,"SpellAuraOptions.dbc");//15595
LoadDBC(availableDbcLocales, bad_dbc_files, sSpellCastingRequirementsStore, dbcPath,"SpellCastingRequirements.dbc");//15595
LoadDBC(availableDbcLocales, bad_dbc_files, sSpellEffectStore, dbcPath,"SpellEffect.dbc", &CustomSpellEffectEntryfmt, &CustomSpellEffectEntryIndex);//15595
LoadDBC(availableDbcLocales, bad_dbc_files, sSpellCastTimesStore, dbcPath, "SpellCastTimes.dbc");//15595
LoadDBC(availableDbcLocales, bad_dbc_files, sSpellDifficultyStore, dbcPath, "SpellDifficulty.dbc", &CustomSpellDifficultyfmt, &CustomSpellDifficultyIndex);//15595
LoadDBC(availableDbcLocales, bad_dbc_files, sSpellDurationStore, dbcPath, "SpellDuration.dbc");//15595
LoadDBC(availableDbcLocales, bad_dbc_files, sSpellFocusObjectStore, dbcPath, "SpellFocusObject.dbc");//15595
LoadDBC(availableDbcLocales, bad_dbc_files, sSpellItemEnchantmentStore, dbcPath, "SpellItemEnchantment.dbc");//15595
LoadDBC(availableDbcLocales, bad_dbc_files, sSpellItemEnchantmentConditionStore, dbcPath, "SpellItemEnchantmentCondition.dbc");//15595
LoadDBC(availableDbcLocales, bad_dbc_files, sSpellRadiusStore, dbcPath, "SpellRadius.dbc");//15595
LoadDBC(availableDbcLocales, bad_dbc_files, sSpellRangeStore, dbcPath, "SpellRange.dbc");//15595
LoadDBC(availableDbcLocales, bad_dbc_files, sSpellRuneCostStore, dbcPath, "SpellRuneCost.dbc");//15595
LoadDBC(availableDbcLocales, bad_dbc_files, sSpellShapeshiftStore, dbcPath, "SpellShapeshift.dbc");//15595
LoadDBC(availableDbcLocales, bad_dbc_files, sSpellShapeshiftFormStore, dbcPath, "SpellShapeshiftForm.dbc");//15595
//LoadDBC(availableDbcLocales, bad_dbc_files, sStableSlotPricesStore, dbcPath, "StableSlotPrices.dbc");
Expand Down Expand Up @@ -614,6 +604,7 @@ void LoadDBCStores(const std::string& dataPath)
LoadDBC(availableDbcLocales, bad_dbc_files, sTalentStore, dbcPath, "Talent.dbc");//15595

// Create Spelldifficulty searcher
/* TODO: 6.x update to new spell diffs
for (uint32 i = 0; i < sSpellDifficultyStore.GetNumRows(); ++i)
{
SpellDifficultyEntry const* spellDiff = sSpellDifficultyStore.LookupEntry(i);
Expand All @@ -640,7 +631,7 @@ void LoadDBCStores(const std::string& dataPath)
for (uint32 x = 0; x < MAX_DIFFICULTY; ++x)
if (newEntry.SpellID[x])
sSpellMgr->SetSpellDifficultyId(uint32(newEntry.SpellID[x]), spellDiff->ID);
}
}*/

// create talent spells set
for (unsigned int i = 0; i < sTalentStore.GetNumRows(); ++i)
Expand Down
5 changes: 0 additions & 5 deletions src/server/game/DataStores/DBCStores.h
Expand Up @@ -199,7 +199,6 @@ extern DBCStorage <SkillTiersEntry> sSkillTiersStore;
extern DBCStorage <SoundEntriesEntry> sSoundEntriesStore;
extern DBCStorage <SpellCastTimesEntry> sSpellCastTimesStore;
extern DBCStorage <SpellCategoryEntry> sSpellCategoryStore;
extern DBCStorage <SpellDifficultyEntry> sSpellDifficultyStore;
extern DBCStorage <SpellDurationEntry> sSpellDurationStore;
extern DBCStorage <SpellFocusObjectEntry> sSpellFocusObjectStore;
extern DBCStorage <SpellItemEnchantmentEntry> sSpellItemEnchantmentStore;
Expand All @@ -208,21 +207,17 @@ extern SpellCategoryStore sSpellsByCategoryStore;
extern PetFamilySpellsStore sPetFamilySpellsStore;
extern DBCStorage <SpellRadiusEntry> sSpellRadiusStore;
extern DBCStorage <SpellRangeEntry> sSpellRangeStore;
extern DBCStorage <SpellRuneCostEntry> sSpellRuneCostStore;
extern DBCStorage <SpellShapeshiftEntry> sSpellShapeshiftStore;
extern DBCStorage <SpellShapeshiftFormEntry> sSpellShapeshiftFormStore;
extern DBCStorage <SpellEntry> sSpellStore;
extern DBCStorage <SpellAuraOptionsEntry> sSpellAuraOptionsStore;
extern DBCStorage <SpellCastingRequirementsEntry> sSpellCastingRequirementsStore;
extern DBCStorage <SpellCategoriesEntry> sSpellCategoriesStore;
extern DBCStorage <SpellClassOptionsEntry> sSpellClassOptionsStore;
extern DBCStorage <SpellCooldownsEntry> sSpellCooldownsStore;
extern DBCStorage <SpellEffectEntry> sSpellEffectStore;
extern DBCStorage <SpellEquippedItemsEntry> sSpellEquippedItemsStore;
extern DBCStorage <SpellInterruptsEntry> sSpellInterruptsStore;
extern DBCStorage <SpellLevelsEntry> sSpellLevelsStore;
extern DBCStorage <SpellPowerEntry> sSpellPowerStore;
extern DBCStorage <SpellReagentsEntry> sSpellReagentsStore;
extern DBCStorage <SpellScalingEntry> sSpellScalingStore;
extern DBCStorage <SpellTargetRestrictionsEntry> sSpellTargetRestrictionsStore;
extern DBCStorage <SpellTotemsEntry> sSpellTotemsStore;
Expand Down

0 comments on commit 43d5fb5

Please sign in to comment.