*Destroy quest items on quest failure, and some cleanup.

--HG--
branch : trunk
This commit is contained in:
maximius
2009-11-11 15:11:51 -08:00
parent 2874864bc0
commit 389a377dd3
3 changed files with 270 additions and 264 deletions
+11 -11
View File
@@ -339,21 +339,21 @@ LootItem::LootItem(LootStoreItem const& li)
bool LootItem::AllowedForPlayer(Player const * player) const
{
// DB conditions check
if ( !objmgr.IsPlayerMeetToCondition(player,conditionId) )
if (!objmgr.IsPlayerMeetToCondition(player,conditionId))
return false;
if ( needs_quest )
if (needs_quest)
{
// Checking quests for quest-only drop (check only quests requirements in this case)
if( !player->HasQuestForItem(itemid) )
if (!player->HasQuestForItem(itemid))
return false;
}
else
{
// Not quest only drop (check quest starting items for already accepted non-repeatable quests)
ItemPrototype const *pProto = objmgr.GetItemPrototype(itemid);
if (pProto && pProto->StartQuest && player->GetQuestStatus(pProto->StartQuest) != QUEST_STATUS_NONE && !player->HasQuestForItem(itemid))
return false;
if (ItemPrototype const *pProto = objmgr.GetItemPrototype(itemid))
if (pProto->StartQuest && player->GetQuestStatus(pProto->StartQuest) != QUEST_STATUS_NONE && !player->HasQuestForItem(itemid))
return false;
}
return true;
@@ -378,7 +378,7 @@ void Loot::AddItem(LootStoreItem const & item)
// non-conditional one-player only items are counted here,
// free for all items are counted in FillFFALoot(),
// non-ffa conditionals are counted in FillNonQuestNonFFAConditionalLoot()
if( !item.conditionId )
if (!item.conditionId)
{
ItemPrototype const* proto = objmgr.GetItemPrototype(item.itemid);
if (!proto || (proto->Flags & ITEM_FLAGS_PARTY_LOOT) == 0)
@@ -848,10 +848,10 @@ bool LootTemplate::LootGroup::HasQuestDrop() const
// True if group includes at least 1 quest drop entry for active quests of the player
bool LootTemplate::LootGroup::HasQuestDropForPlayer(Player const * player) const
{
for (LootStoreItemList::const_iterator i=ExplicitlyChanced.begin(); i != ExplicitlyChanced.end(); ++i)
for (LootStoreItemList::const_iterator i = ExplicitlyChanced.begin(); i != ExplicitlyChanced.end(); ++i)
if (player->HasQuestForItem(i->itemid))
return true;
for (LootStoreItemList::const_iterator i=EqualChanced.begin(); i != EqualChanced.end(); ++i)
for (LootStoreItemList::const_iterator i = EqualChanced.begin(); i != EqualChanced.end(); ++i)
if (player->HasQuestForItem(i->itemid))
return true;
return false;
@@ -1072,12 +1072,12 @@ bool LootTemplate::HasQuestDropForPlayer(LootTemplateMap const& store, Player co
if (Referenced->second->HasQuestDropForPlayer(store, player, i->group) )
return true;
}
else if ( player->HasQuestForItem(i->itemid) )
else if (player->HasQuestForItem(i->itemid))
return true; // active quest drop found
}
// Now checking groups
for (LootGroups::const_iterator i = Groups.begin(); i != Groups.end(); ++i )
for (LootGroups::const_iterator i = Groups.begin(); i != Groups.end(); ++i)
if (i->HasQuestDropForPlayer(player))
return true;