Core/ObjectMgr: Refactor sItemStorage

This commit is contained in:
leak committed 2011-04-28 22:42:33 +02:00
1 parent 03365e9a57
commit a82654debd
49 files changed
+785 -639

No files matched your search

+7 -11
View File
@@ -76,18 +76,14 @@ public:
}
// check item starting quest (it can work incorrectly if added without item in inventory)
for (uint32 id = 0; id < sItemStorage.MaxEntry; id++)
{
ItemPrototype const *pProto = sItemStorage.LookupEntry<ItemPrototype>(id);
if (!pProto)
continue;
ItemTemplateContainer const* itc = sObjectMgr->GetItemTemplateStore();
ItemTemplateContainer::const_iterator result = find_if(itc->begin(), itc->end(), Finder<uint32, ItemTemplate>(entry, &ItemTemplate::StartQuest));
if (pProto->StartQuest == entry)
{
handler->PSendSysMessage(LANG_COMMAND_QUEST_STARTFROMITEM, entry, pProto->ItemId);
handler->SetSentErrorMessage(true);
return false;
}
if (result != itc->end())
{
handler->PSendSysMessage(LANG_COMMAND_QUEST_STARTFROMITEM, entry, result->second.ItemId);
handler->SetSentErrorMessage(true);
return false;
}
// ok, normal (creature/GO starting) quest