*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
+6 -6
View File
@@ -33,7 +33,7 @@
#include "SpellMgr.h"
#include "CreatureAIImpl.h"
bool CreatureEventAIHolder::UpdateRepeatTimer( Creature* creature, uint32 repeatMin, uint32 repeatMax )
bool CreatureEventAIHolder::UpdateRepeatTimer(Creature* creature, uint32 repeatMin, uint32 repeatMax)
{
if (repeatMin == repeatMax)
Time = repeatMin;
@@ -51,7 +51,7 @@ bool CreatureEventAIHolder::UpdateRepeatTimer( Creature* creature, uint32 repeat
int CreatureEventAI::Permissible(const Creature *creature)
{
if( creature->GetAIName() == "EventAI" )
if (creature->GetAIName() == "EventAI")
return PERMIT_BASE_SPECIAL;
return PERMIT_BASE_NO;
}
@@ -108,7 +108,7 @@ CreatureEventAI::CreatureEventAI(Creature *c ) : CreatureAI(c)
}
}
bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pActionInvoker)
bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pActionInvoker /*=NULL*/)
{
if (!pHolder.Enabled || pHolder.Time)
return false;
@@ -336,7 +336,7 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction
return false;
//Process actions
for (uint32 j = 0; j < MAX_ACTIONS; j++)
for (uint8 j = 0; j < MAX_ACTIONS; ++j)
ProcessAction(pHolder.Event.action[j], rnd, pHolder.Event.event_id, pActionInvoker);
return true;
@@ -1017,7 +1017,7 @@ void CreatureEventAI::UpdateAI(const uint32 diff)
if (!bEmptyList)
{
//Events are only updated once every EVENT_UPDATE_TIME ms to prevent lag with large amount of events
if (EventUpdateTime < diff)
if (EventUpdateTime <= diff)
{
EventDiff += diff;
@@ -1027,7 +1027,7 @@ void CreatureEventAI::UpdateAI(const uint32 diff)
//Decrement Timers
if ((*i).Time)
{
if ((*i).Time > EventDiff)
if (EventDiff <= (*i).Time)
{
//Do not decrement timers if event cannot trigger in this phase
if (!((*i).Event.event_inverse_phase_mask & (1 << Phase)))
+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;
+253 -247
View File
File diff suppressed because it is too large Load Diff