Core/DataStores: Changed index on CharStartOutfit.dbc to allow lookups directly using race/class/gender combo instead having to iterate entire store to find the proper entry
This commit is contained in:
1 parent
cf5058c4e3
commit
84553f168c
3 files changed
+13
-35
No files matched your search
@@ -31,7 +31,7 @@ char const AuctionHouseEntryfmt[]="niiixxxxxxxxxxxxxxxxx";
|
||||
char const BankBagSlotPricesEntryfmt[]="ni";
|
||||
char const BarberShopStyleEntryfmt[]="nixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxiii";
|
||||
char const BattlemasterListEntryfmt[]="niiiiiiiiixssssssssssssssssxiixx";
|
||||
char const CharStartOutfitEntryfmt[]="diiiiiiiiiiiiiiiiiiiiiiiiixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
|
||||
char const CharStartOutfitEntryfmt[]="xniiiiiiiiiiiiiiiiiiiiiiiixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
|
||||
char const CharTitlesEntryfmt[]="nxssssssssssssssssxxxxxxxxxxxxxxxxxxi";
|
||||
char const ChatChannelsEntryfmt[]="nixssssssssssssssssxxxxxxxxxxxxxxxxxx";
|
||||
// ChatChannelsEntryfmt, index not used (more compact store)
|
||||
|
||||
@@ -1120,20 +1120,7 @@ bool Player::Create(uint32 guidlow, CharacterCreateInfo* createInfo)
|
||||
addActionButton(action_itr->button, action_itr->action, action_itr->type);
|
||||
|
||||
// original items
|
||||
CharStartOutfitEntry const* oEntry = NULL;
|
||||
for (uint32 i = 1; i < sCharStartOutfitStore.GetNumRows(); ++i)
|
||||
{
|
||||
if (CharStartOutfitEntry const* entry = sCharStartOutfitStore.LookupEntry(i))
|
||||
{
|
||||
if (entry->RaceClassGender == RaceClassGender)
|
||||
{
|
||||
oEntry = entry;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (oEntry)
|
||||
if (CharStartOutfitEntry const* oEntry = sCharStartOutfitStore.LookupEntry(RaceClassGender))
|
||||
{
|
||||
for (int j = 0; j < MAX_OUTFIT_ITEMS; ++j)
|
||||
{
|
||||
|
||||
@@ -2957,32 +2957,23 @@ void ObjectMgr::PlayerCreateInfoAddItemHelper(uint32 race_, uint32 class_, uint3
|
||||
sLog->outError(LOG_FILTER_SQL, "Invalid count %i specified on item %u be removed from original player create info (use -1)!", count, itemId);
|
||||
|
||||
uint32 RaceClass = (race_) | (class_ << 8);
|
||||
bool doneOne = false;
|
||||
for (uint32 i = 1; i < sCharStartOutfitStore.GetNumRows(); ++i)
|
||||
for (uint32 gender = 0; gender < GENDER_NONE; ++gender)
|
||||
{
|
||||
if (CharStartOutfitEntry const* entry = sCharStartOutfitStore.LookupEntry(i))
|
||||
if (CharStartOutfitEntry const* entry = sCharStartOutfitStore.LookupEntry(RaceClass | (gender << 16)))
|
||||
{
|
||||
if (entry->RaceClassGender == RaceClass || entry->RaceClassGender == (RaceClass | (1 << 16)))
|
||||
bool found = false;
|
||||
for (uint8 x = 0; x < MAX_OUTFIT_ITEMS; ++x)
|
||||
{
|
||||
bool found = false;
|
||||
for (uint8 x = 0; x < MAX_OUTFIT_ITEMS; ++x)
|
||||
if (entry->ItemId[x] > 0 && uint32(entry->ItemId[x]) == itemId)
|
||||
{
|
||||
if (entry->ItemId[x] > 0 && uint32(entry->ItemId[x]) == itemId)
|
||||
{
|
||||
found = true;
|
||||
const_cast<CharStartOutfitEntry*>(entry)->ItemId[x] = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found)
|
||||
sLog->outError(LOG_FILTER_SQL, "Item %u specified to be removed from original create info not found in dbc!", itemId);
|
||||
|
||||
if (!doneOne)
|
||||
doneOne = true;
|
||||
else
|
||||
found = true;
|
||||
const_cast<CharStartOutfitEntry*>(entry)->ItemId[x] = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found)
|
||||
sLog->outError(LOG_FILTER_SQL, "Item %u specified to be removed from original create info not found in dbc!", itemId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user