aboutsummaryrefslogtreecommitdiff
path: root/src/server/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/scripts')
-rw-r--r--src/server/scripts/Commands/cs_debug.cpp2
-rw-r--r--src/server/scripts/Commands/cs_npc.cpp10
-rw-r--r--src/server/scripts/Commands/cs_quest.cpp18
-rw-r--r--src/server/scripts/World/item_scripts.cpp4
-rw-r--r--src/server/scripts/World/npc_professions.cpp4
5 files changed, 17 insertions, 21 deletions
diff --git a/src/server/scripts/Commands/cs_debug.cpp b/src/server/scripts/Commands/cs_debug.cpp
index c6936727885..33dad2ff918 100644
--- a/src/server/scripts/Commands/cs_debug.cpp
+++ b/src/server/scripts/Commands/cs_debug.cpp
@@ -965,7 +965,7 @@ public:
return false;
handler->GetSession()->GetPlayer()->DestroyItem(i->GetBagSlot(), i->GetSlot(), true);
- sScriptMgr->OnItemExpire(handler->GetSession()->GetPlayer(), i->GetProto());
+ sScriptMgr->OnItemExpire(handler->GetSession()->GetPlayer(), i->GetTemplate());
return true;
}
diff --git a/src/server/scripts/Commands/cs_npc.cpp b/src/server/scripts/Commands/cs_npc.cpp
index 0b1bb311f0b..a6ac7c9b597 100644
--- a/src/server/scripts/Commands/cs_npc.cpp
+++ b/src/server/scripts/Commands/cs_npc.cpp
@@ -201,9 +201,9 @@ public:
sObjectMgr->AddVendorItem(vendor_entry,itemId,maxcount,incrtime,extendedcost);
- ItemPrototype const* pProto = ObjectMgr::GetItemPrototype(itemId);
+ ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(itemId);
- handler->PSendSysMessage(LANG_ITEM_ADDED_TO_LIST,itemId,pProto->Name1,maxcount,incrtime,extendedcost);
+ handler->PSendSysMessage(LANG_ITEM_ADDED_TO_LIST,itemId,itemTemplate->Name1,maxcount,incrtime,extendedcost);
return true;
}
@@ -419,9 +419,9 @@ public:
return false;
}
- ItemPrototype const* pProto = ObjectMgr::GetItemPrototype(itemId);
+ ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(itemId);
- handler->PSendSysMessage(LANG_ITEM_DELETED_FROM_LIST,itemId,pProto->Name1);
+ handler->PSendSysMessage(LANG_ITEM_DELETED_FROM_LIST,itemId,itemTemplate->Name1);
return true;
}
@@ -1299,7 +1299,7 @@ public:
uint32 ItemID = atoi(pItemID);
uint32 SlotID = atoi(pSlotID);
- ItemPrototype* tmpItem = ObjectMgr::GetItemPrototype(ItemID);
+ ItemPrototype* tmpItem = sObjectMgr->GetItemTemplate(ItemID);
bool added = false;
if (tmpItem)
diff --git a/src/server/scripts/Commands/cs_quest.cpp b/src/server/scripts/Commands/cs_quest.cpp
index 41d45f7a033..df5f9703ab2 100644
--- a/src/server/scripts/Commands/cs_quest.cpp
+++ b/src/server/scripts/Commands/cs_quest.cpp
@@ -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
diff --git a/src/server/scripts/World/item_scripts.cpp b/src/server/scripts/World/item_scripts.cpp
index 71c3a1661ed..c248738a6d6 100644
--- a/src/server/scripts/World/item_scripts.cpp
+++ b/src/server/scripts/World/item_scripts.cpp
@@ -189,7 +189,7 @@ class item_mysterious_egg : public ItemScript
{
public:
item_mysterious_egg() : ItemScript("item_mysterious_egg") { }
- bool OnExpire(Player *pPlayer, ItemPrototype const * /*pItemProto*/)
+ bool OnExpire(Player *pPlayer, ItemTemplate const * /*pItemProto*/)
{
ItemPosCountVec dest;
uint8 msg = pPlayer->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, 39883, 1); // Cracked Egg
@@ -209,7 +209,7 @@ class item_disgusting_jar : public ItemScript
public:
item_disgusting_jar() : ItemScript("item_disgusting_jar") {}
- bool OnExpire(Player *pPlayer, ItemPrototype const * /*pItemProto*/)
+ bool OnExpire(Player *pPlayer, ItemTemplate const * /*pItemProto*/)
{
ItemPosCountVec dest;
uint8 msg = pPlayer->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, 44718, 1); // Ripe Disgusting Jar
diff --git a/src/server/scripts/World/npc_professions.cpp b/src/server/scripts/World/npc_professions.cpp
index 314b781e773..798ca9a86e4 100644
--- a/src/server/scripts/World/npc_professions.cpp
+++ b/src/server/scripts/World/npc_professions.cpp
@@ -233,10 +233,10 @@ bool EquippedOk(Player* pPlayer, uint32 spellId)
{
pItem = pPlayer->GetItemByPos(INVENTORY_SLOT_BAG_0, j);
if (pItem)
- if (pItem->GetProto()->RequiredSpell == reqSpell)
+ if (pItem->GetTemplate()->RequiredSpell == reqSpell)
{
//player has item equipped that require specialty. Not allow to unlearn, player has to unequip first
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: player attempt to unlearn spell %u, but item %u is equipped.",reqSpell,pItem->GetProto()->ItemId);
+ sLog->outDebug(LOG_FILTER_TSCR, "TSCR: player attempt to unlearn spell %u, but item %u is equipped.",reqSpell,pItem->GetTemplate()->ItemId);
return false;
}
}