*Destroy quest items on quest failure, and some cleanup.
--HG-- branch : trunk
This commit is contained in:
@@ -33,7 +33,7 @@
|
|||||||
#include "SpellMgr.h"
|
#include "SpellMgr.h"
|
||||||
#include "CreatureAIImpl.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)
|
if (repeatMin == repeatMax)
|
||||||
Time = repeatMin;
|
Time = repeatMin;
|
||||||
@@ -51,7 +51,7 @@ bool CreatureEventAIHolder::UpdateRepeatTimer( Creature* creature, uint32 repeat
|
|||||||
|
|
||||||
int CreatureEventAI::Permissible(const Creature *creature)
|
int CreatureEventAI::Permissible(const Creature *creature)
|
||||||
{
|
{
|
||||||
if( creature->GetAIName() == "EventAI" )
|
if (creature->GetAIName() == "EventAI")
|
||||||
return PERMIT_BASE_SPECIAL;
|
return PERMIT_BASE_SPECIAL;
|
||||||
return PERMIT_BASE_NO;
|
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)
|
if (!pHolder.Enabled || pHolder.Time)
|
||||||
return false;
|
return false;
|
||||||
@@ -336,7 +336,7 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
//Process actions
|
//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);
|
ProcessAction(pHolder.Event.action[j], rnd, pHolder.Event.event_id, pActionInvoker);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -1017,7 +1017,7 @@ void CreatureEventAI::UpdateAI(const uint32 diff)
|
|||||||
if (!bEmptyList)
|
if (!bEmptyList)
|
||||||
{
|
{
|
||||||
//Events are only updated once every EVENT_UPDATE_TIME ms to prevent lag with large amount of events
|
//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;
|
EventDiff += diff;
|
||||||
|
|
||||||
@@ -1027,7 +1027,7 @@ void CreatureEventAI::UpdateAI(const uint32 diff)
|
|||||||
//Decrement Timers
|
//Decrement Timers
|
||||||
if ((*i).Time)
|
if ((*i).Time)
|
||||||
{
|
{
|
||||||
if ((*i).Time > EventDiff)
|
if (EventDiff <= (*i).Time)
|
||||||
{
|
{
|
||||||
//Do not decrement timers if event cannot trigger in this phase
|
//Do not decrement timers if event cannot trigger in this phase
|
||||||
if (!((*i).Event.event_inverse_phase_mask & (1 << Phase)))
|
if (!((*i).Event.event_inverse_phase_mask & (1 << Phase)))
|
||||||
|
|||||||
+11
-11
@@ -339,21 +339,21 @@ LootItem::LootItem(LootStoreItem const& li)
|
|||||||
bool LootItem::AllowedForPlayer(Player const * player) const
|
bool LootItem::AllowedForPlayer(Player const * player) const
|
||||||
{
|
{
|
||||||
// DB conditions check
|
// DB conditions check
|
||||||
if ( !objmgr.IsPlayerMeetToCondition(player,conditionId) )
|
if (!objmgr.IsPlayerMeetToCondition(player,conditionId))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if ( needs_quest )
|
if (needs_quest)
|
||||||
{
|
{
|
||||||
// Checking quests for quest-only drop (check only quests requirements in this case)
|
// Checking quests for quest-only drop (check only quests requirements in this case)
|
||||||
if( !player->HasQuestForItem(itemid) )
|
if (!player->HasQuestForItem(itemid))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Not quest only drop (check quest starting items for already accepted non-repeatable quests)
|
// Not quest only drop (check quest starting items for already accepted non-repeatable quests)
|
||||||
ItemPrototype const *pProto = objmgr.GetItemPrototype(itemid);
|
if (ItemPrototype const *pProto = objmgr.GetItemPrototype(itemid))
|
||||||
if (pProto && pProto->StartQuest && player->GetQuestStatus(pProto->StartQuest) != QUEST_STATUS_NONE && !player->HasQuestForItem(itemid))
|
if (pProto->StartQuest && player->GetQuestStatus(pProto->StartQuest) != QUEST_STATUS_NONE && !player->HasQuestForItem(itemid))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -378,7 +378,7 @@ void Loot::AddItem(LootStoreItem const & item)
|
|||||||
// non-conditional one-player only items are counted here,
|
// non-conditional one-player only items are counted here,
|
||||||
// free for all items are counted in FillFFALoot(),
|
// free for all items are counted in FillFFALoot(),
|
||||||
// non-ffa conditionals are counted in FillNonQuestNonFFAConditionalLoot()
|
// non-ffa conditionals are counted in FillNonQuestNonFFAConditionalLoot()
|
||||||
if( !item.conditionId )
|
if (!item.conditionId)
|
||||||
{
|
{
|
||||||
ItemPrototype const* proto = objmgr.GetItemPrototype(item.itemid);
|
ItemPrototype const* proto = objmgr.GetItemPrototype(item.itemid);
|
||||||
if (!proto || (proto->Flags & ITEM_FLAGS_PARTY_LOOT) == 0)
|
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
|
// True if group includes at least 1 quest drop entry for active quests of the player
|
||||||
bool LootTemplate::LootGroup::HasQuestDropForPlayer(Player const * player) const
|
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))
|
if (player->HasQuestForItem(i->itemid))
|
||||||
return true;
|
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))
|
if (player->HasQuestForItem(i->itemid))
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
@@ -1072,12 +1072,12 @@ bool LootTemplate::HasQuestDropForPlayer(LootTemplateMap const& store, Player co
|
|||||||
if (Referenced->second->HasQuestDropForPlayer(store, player, i->group) )
|
if (Referenced->second->HasQuestDropForPlayer(store, player, i->group) )
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if ( player->HasQuestForItem(i->itemid) )
|
else if (player->HasQuestForItem(i->itemid))
|
||||||
return true; // active quest drop found
|
return true; // active quest drop found
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now checking groups
|
// 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))
|
if (i->HasQuestDropForPlayer(player))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
|||||||
+253
-247
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user