mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 04:37:00 +00:00
[10938] Some adjustments to script calls OnQuestChooseReward replaced with OnQuestRewarded. Also fix compile in VC 8.0 and VC 9.0.
This commit is contained in:
parent
14c8db9c9a
commit
0b7e78d2a7
7 changed files with 58 additions and 87 deletions
|
|
@ -13790,6 +13790,21 @@ void Player::RewardQuest(Quest const *pQuest, uint32 reward, Object* questGiver,
|
|||
if (announce)
|
||||
SendQuestReward(pQuest, XP, questGiver);
|
||||
|
||||
bool handled = false;
|
||||
|
||||
switch(questGiver->GetTypeId())
|
||||
{
|
||||
case TYPEID_UNIT:
|
||||
handled = sScriptMgr.OnQuestRewarded(this, (Creature*)questGiver, pQuest);
|
||||
break;
|
||||
case TYPEID_GAMEOBJECT:
|
||||
handled = sScriptMgr.OnQuestRewarded(this, (GameObject*)questGiver, pQuest);
|
||||
break;
|
||||
}
|
||||
|
||||
if (!handled && pQuest->GetQuestCompleteScript() != 0)
|
||||
GetMap()->ScriptsStart(sQuestEndScripts, pQuest->GetQuestCompleteScript(), questGiver, this);
|
||||
|
||||
// cast spells after mark quest complete (some spells have quest completed state reqyurements in spell_area data)
|
||||
if (pQuest->GetRewSpellCast() > 0)
|
||||
CastSpell(this, pQuest->GetRewSpellCast(), true);
|
||||
|
|
@ -14860,9 +14875,6 @@ void Player::SendQuestReward( Quest const *pQuest, uint32 XP, Object * questGive
|
|||
data << uint32(pQuest->GetBonusTalents()); // bonus talents
|
||||
data << uint32(0); // arena points
|
||||
GetSession()->SendPacket( &data );
|
||||
|
||||
if (pQuest->GetQuestCompleteScript() != 0)
|
||||
GetMap()->ScriptsStart(sQuestEndScripts, pQuest->GetQuestCompleteScript(), questGiver, this);
|
||||
}
|
||||
|
||||
void Player::SendQuestFailed( uint32 quest_id, InventoryChangeFailure reason)
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ void WorldSession::HandleQuestgiverStatusQueryOpcode( WorldPacket & recv_data )
|
|||
|
||||
if (!cr_questgiver->IsHostileTo(_player)) // not show quest status to enemies
|
||||
{
|
||||
dialogStatus = sScriptMgr.OnDialogStatus(_player, cr_questgiver);
|
||||
dialogStatus = sScriptMgr.GetDialogStatus(_player, cr_questgiver);
|
||||
|
||||
if (dialogStatus > DIALOG_STATUS_REWARD_REP)
|
||||
dialogStatus = getDialogStatus(_player, cr_questgiver, DIALOG_STATUS_NONE);
|
||||
|
|
@ -64,7 +64,7 @@ void WorldSession::HandleQuestgiverStatusQueryOpcode( WorldPacket & recv_data )
|
|||
case TYPEID_GAMEOBJECT:
|
||||
{
|
||||
GameObject* go_questgiver = (GameObject*)questgiver;
|
||||
dialogStatus = sScriptMgr.OnDialogStatus(_player, go_questgiver);
|
||||
dialogStatus = sScriptMgr.GetDialogStatus(_player, go_questgiver);
|
||||
|
||||
if (dialogStatus > DIALOG_STATUS_REWARD_REP)
|
||||
dialogStatus = getDialogStatus(_player, go_questgiver, DIALOG_STATUS_NONE);
|
||||
|
|
@ -296,25 +296,9 @@ void WorldSession::HandleQuestgiverChooseRewardOpcode( WorldPacket & recv_data )
|
|||
{
|
||||
_player->RewardQuest( pQuest, reward, pObject );
|
||||
|
||||
switch(pObject->GetTypeId())
|
||||
{
|
||||
case TYPEID_UNIT:
|
||||
if (!sScriptMgr.OnQuestChooseReward(_player, (Creature*)pObject, pQuest, reward))
|
||||
{
|
||||
// Send next quest
|
||||
if (Quest const* nextquest = _player->GetNextQuest(guid, pQuest))
|
||||
_player->PlayerTalkClass->SendQuestGiverQuestDetails(nextquest, guid, true);
|
||||
}
|
||||
break;
|
||||
case TYPEID_GAMEOBJECT:
|
||||
if (!sScriptMgr.OnQuestChooseReward(_player, (GameObject*)pObject, pQuest, reward))
|
||||
{
|
||||
// Send next quest
|
||||
if (Quest const* nextquest = _player->GetNextQuest(guid, pQuest))
|
||||
_player->PlayerTalkClass->SendQuestGiverQuestDetails(nextquest, guid, true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
// Send next quest
|
||||
if (Quest const* nextquest = _player->GetNextQuest(guid, pQuest))
|
||||
_player->PlayerTalkClass->SendQuestGiverQuestDetails(nextquest, guid, true);
|
||||
}
|
||||
else
|
||||
_player->PlayerTalkClass->SendQuestGiverOfferReward(pQuest, guid, true);
|
||||
|
|
@ -663,7 +647,7 @@ void WorldSession::HandleQuestgiverStatusMultipleQuery(WorldPacket& /*recvPacket
|
|||
if (!questgiver->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER))
|
||||
continue;
|
||||
|
||||
dialogStatus = sScriptMgr.OnDialogStatus(_player, questgiver);
|
||||
dialogStatus = sScriptMgr.GetDialogStatus(_player, questgiver);
|
||||
|
||||
if (dialogStatus > DIALOG_STATUS_REWARD_REP)
|
||||
dialogStatus = getDialogStatus(_player, questgiver, DIALOG_STATUS_NONE);
|
||||
|
|
@ -682,7 +666,7 @@ void WorldSession::HandleQuestgiverStatusMultipleQuery(WorldPacket& /*recvPacket
|
|||
if (questgiver->GetGoType() != GAMEOBJECT_TYPE_QUESTGIVER)
|
||||
continue;
|
||||
|
||||
dialogStatus = sScriptMgr.OnDialogStatus(_player, questgiver);
|
||||
dialogStatus = sScriptMgr.GetDialogStatus(_player, questgiver);
|
||||
|
||||
if (dialogStatus > DIALOG_STATUS_REWARD_REP)
|
||||
dialogStatus = getDialogStatus(_player, questgiver, DIALOG_STATUS_NONE);
|
||||
|
|
|
|||
|
|
@ -53,11 +53,10 @@ ScriptMgr::ScriptMgr() :
|
|||
m_pOnQuestAccept(NULL),
|
||||
m_pOnGOQuestAccept(NULL),
|
||||
m_pOnItemQuestAccept(NULL),
|
||||
m_pOnQuestComplete(NULL),
|
||||
m_pOnQuestChooseReward(NULL),
|
||||
m_pOnGOQuestChooseReward(NULL),
|
||||
m_pOnNPCDialogStatus(NULL),
|
||||
m_pOnGODialogStatus(NULL),
|
||||
m_pOnQuestRewarded(NULL),
|
||||
m_pOnGOQuestRewarded(NULL),
|
||||
m_pGetNPCDialogStatus(NULL),
|
||||
m_pGetGODialogStatus(NULL),
|
||||
m_pOnGOUse(NULL),
|
||||
m_pOnItemUse(NULL),
|
||||
m_pOnAreaTrigger(NULL),
|
||||
|
|
@ -967,35 +966,30 @@ bool ScriptMgr::OnQuestAccept(Player* pPlayer, Item* pItem, Quest const* pQuest)
|
|||
return m_pOnItemQuestAccept != NULL && m_pOnItemQuestAccept(pPlayer, pItem, pQuest);
|
||||
}
|
||||
|
||||
bool ScriptMgr::OnQuestComplete(Player* pPlayer, Creature* pCreature, Quest const* pQuest)
|
||||
bool ScriptMgr::OnQuestRewarded(Player* pPlayer, Creature* pCreature, Quest const* pQuest)
|
||||
{
|
||||
return m_pOnQuestComplete != NULL && m_pOnQuestComplete(pPlayer, pCreature, pQuest);
|
||||
return m_pOnQuestRewarded != NULL && m_pOnQuestRewarded(pPlayer, pCreature, pQuest);
|
||||
}
|
||||
|
||||
bool ScriptMgr::OnQuestChooseReward(Player* pPlayer, Creature* pCreature, Quest const* pQuest, uint32 opt)
|
||||
bool ScriptMgr::OnQuestRewarded(Player* pPlayer, GameObject* pGameObject, Quest const* pQuest)
|
||||
{
|
||||
return m_pOnQuestChooseReward != NULL && m_pOnQuestChooseReward(pPlayer, pCreature, pQuest, opt);
|
||||
return m_pOnGOQuestRewarded != NULL && m_pOnGOQuestRewarded(pPlayer, pGameObject, pQuest);
|
||||
}
|
||||
|
||||
bool ScriptMgr::OnQuestChooseReward(Player* pPlayer, GameObject* pGameObject, Quest const* pQuest, uint32 opt)
|
||||
uint32 ScriptMgr::GetDialogStatus(Player* pPlayer, Creature* pCreature)
|
||||
{
|
||||
return m_pOnGOQuestChooseReward != NULL && m_pOnGOQuestChooseReward(pPlayer, pGameObject, pQuest, opt);
|
||||
}
|
||||
|
||||
uint32 ScriptMgr::OnDialogStatus(Player* pPlayer, Creature* pCreature)
|
||||
{
|
||||
if (!m_pOnNPCDialogStatus)
|
||||
if (!m_pGetNPCDialogStatus)
|
||||
return 100;
|
||||
|
||||
return m_pOnNPCDialogStatus(pPlayer, pCreature);
|
||||
return m_pGetNPCDialogStatus(pPlayer, pCreature);
|
||||
}
|
||||
|
||||
uint32 ScriptMgr::OnDialogStatus(Player* pPlayer, GameObject* pGameObject)
|
||||
uint32 ScriptMgr::GetDialogStatus(Player* pPlayer, GameObject* pGameObject)
|
||||
{
|
||||
if (!m_pOnGODialogStatus)
|
||||
if (!m_pGetGODialogStatus)
|
||||
return 100;
|
||||
|
||||
return m_pOnGODialogStatus(pPlayer, pGameObject);
|
||||
return m_pGetGODialogStatus(pPlayer, pGameObject);
|
||||
}
|
||||
|
||||
bool ScriptMgr::OnGameObjectUse(Player* pPlayer, GameObject* pGameObject)
|
||||
|
|
@ -1013,7 +1007,7 @@ bool ScriptMgr::OnAreaTrigger(Player* pPlayer, AreaTriggerEntry const* atEntry)
|
|||
return m_pOnAreaTrigger != NULL && m_pOnAreaTrigger(pPlayer, atEntry);
|
||||
}
|
||||
|
||||
bool ScriptMgr::OnProcessEvent(uint32 eventId, WorldObject* pSource, WorldObject* pTarget, bool isStart)
|
||||
bool ScriptMgr::OnProcessEvent(uint32 eventId, Object* pSource, Object* pTarget, bool isStart)
|
||||
{
|
||||
return m_pOnProcessEvent != NULL && m_pOnProcessEvent(eventId, pSource, pTarget, isStart);
|
||||
}
|
||||
|
|
@ -1066,11 +1060,10 @@ bool ScriptMgr::LoadScriptLibrary(const char* libName)
|
|||
GetScriptHookPtr(m_pOnQuestAccept, "QuestAccept");
|
||||
GetScriptHookPtr(m_pOnGOQuestAccept, "GOQuestAccept");
|
||||
GetScriptHookPtr(m_pOnItemQuestAccept, "ItemQuestAccept");
|
||||
GetScriptHookPtr(m_pOnQuestComplete, "QuestComplete");
|
||||
GetScriptHookPtr(m_pOnQuestChooseReward, "QuestChooseReward");
|
||||
GetScriptHookPtr(m_pOnGOQuestChooseReward, "GOQuestChooseReward");
|
||||
GetScriptHookPtr(m_pOnNPCDialogStatus, "NPCDialogStatus");
|
||||
GetScriptHookPtr(m_pOnGODialogStatus, "GODialogStatus");
|
||||
GetScriptHookPtr(m_pOnQuestRewarded, "QuestRewarded");
|
||||
GetScriptHookPtr(m_pOnGOQuestRewarded, "GOQuestRewarded");
|
||||
GetScriptHookPtr(m_pGetNPCDialogStatus, "GetNPCDialogStatus");
|
||||
GetScriptHookPtr(m_pGetGODialogStatus, "GetGODialogStatus");
|
||||
GetScriptHookPtr(m_pOnGOUse, "GOUse");
|
||||
GetScriptHookPtr(m_pOnItemUse, "ItemUse");
|
||||
GetScriptHookPtr(m_pOnAreaTrigger, "AreaTrigger");
|
||||
|
|
@ -1116,11 +1109,10 @@ void ScriptMgr::UnloadScriptLibrary()
|
|||
m_pOnQuestAccept = NULL;
|
||||
m_pOnGOQuestAccept = NULL;
|
||||
m_pOnItemQuestAccept = NULL;
|
||||
m_pOnQuestComplete = NULL;
|
||||
m_pOnQuestChooseReward = NULL;
|
||||
m_pOnGOQuestChooseReward = NULL;
|
||||
m_pOnNPCDialogStatus = NULL;
|
||||
m_pOnGODialogStatus = NULL;
|
||||
m_pOnQuestRewarded = NULL;
|
||||
m_pOnGOQuestRewarded = NULL;
|
||||
m_pGetNPCDialogStatus = NULL;
|
||||
m_pGetGODialogStatus = NULL;
|
||||
m_pOnGOUse = NULL;
|
||||
m_pOnItemUse = NULL;
|
||||
m_pOnAreaTrigger = NULL;
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ class GameObject;
|
|||
class InstanceData;
|
||||
class Item;
|
||||
class Map;
|
||||
class Object;
|
||||
class Player;
|
||||
class Quest;
|
||||
class SpellCastTargets;
|
||||
|
|
@ -342,15 +343,14 @@ public:
|
|||
bool OnQuestAccept(Player* pPlayer, Creature* pCreature, Quest const* pQuest);
|
||||
bool OnQuestAccept(Player* pPlayer, GameObject* pGameObject, Quest const* pQuest);
|
||||
bool OnQuestAccept(Player* pPlayer, Item* pItem, Quest const* pQuest);
|
||||
bool OnQuestComplete(Player* pPlayer, Creature* pCreature, Quest const* pQuest);
|
||||
bool OnQuestChooseReward(Player* pPlayer, Creature* pCreature, Quest const* pQuest, uint32 opt);
|
||||
bool OnQuestChooseReward(Player* pPlayer, GameObject* pGameObject, Quest const* pQuest, uint32 opt);
|
||||
uint32 OnDialogStatus(Player* pPlayer, Creature* pCreature);
|
||||
uint32 OnDialogStatus(Player* pPlayer, GameObject* pGameObject);
|
||||
bool OnQuestRewarded(Player* pPlayer, Creature* pCreature, Quest const* pQuest);
|
||||
bool OnQuestRewarded(Player* pPlayer, GameObject* pGameObject, Quest const* pQuest);
|
||||
uint32 GetDialogStatus(Player* pPlayer, Creature* pCreature);
|
||||
uint32 GetDialogStatus(Player* pPlayer, GameObject* pGameObject);
|
||||
bool OnGameObjectUse(Player* pPlayer, GameObject* pGameObject);
|
||||
bool OnItemUse(Player* pPlayer, Item* pItem, SpellCastTargets const& targets);
|
||||
bool OnAreaTrigger(Player* pPlayer, AreaTriggerEntry const* atEntry);
|
||||
bool OnProcessEvent(uint32 eventId, WorldObject* pSource, WorldObject* pTarget, bool isStart);
|
||||
bool OnProcessEvent(uint32 eventId, Object* pSource, Object* pTarget, bool isStart);
|
||||
bool OnEffectDummy(Unit* pCaster, uint32 spellId, SpellEffectIndex effIndex, Creature* pTarget);
|
||||
bool OnEffectDummy(Unit* pCaster, uint32 spellId, SpellEffectIndex effIndex, GameObject* pTarget);
|
||||
bool OnEffectDummy(Unit* pCaster, uint32 spellId, SpellEffectIndex effIndex, Item* pTarget);
|
||||
|
|
@ -391,16 +391,15 @@ private:
|
|||
bool (MANGOS_IMPORT* m_pOnGOGossipSelectWithCode) (Player*, GameObject*, uint32, uint32, const char*);
|
||||
bool (MANGOS_IMPORT* m_pOnQuestAccept) (Player*, Creature*, Quest const*);
|
||||
bool (MANGOS_IMPORT* m_pOnGOQuestAccept) (Player*, GameObject*, Quest const*);
|
||||
bool (MANGOS_IMPORT* m_pOnItemQuestAccept) (Player*, Item*pItem, Quest const*);
|
||||
bool (MANGOS_IMPORT* m_pOnQuestComplete) (Player*, Creature* pCreature, Quest const*);
|
||||
bool (MANGOS_IMPORT* m_pOnQuestChooseReward) (Player*, Creature*, Quest const*, uint32);
|
||||
bool (MANGOS_IMPORT* m_pOnGOQuestChooseReward) (Player*, GameObject*, Quest const*, uint32);
|
||||
uint32 (MANGOS_IMPORT* m_pOnNPCDialogStatus) (Player*, Creature*);
|
||||
uint32 (MANGOS_IMPORT* m_pOnGODialogStatus) (Player*, GameObject*);
|
||||
bool (MANGOS_IMPORT* m_pOnItemQuestAccept) (Player*, Item*, Quest const*);
|
||||
bool (MANGOS_IMPORT* m_pOnQuestRewarded) (Player*, Creature*, Quest const*);
|
||||
bool (MANGOS_IMPORT* m_pOnGOQuestRewarded) (Player*, GameObject*, Quest const*);
|
||||
uint32 (MANGOS_IMPORT* m_pGetNPCDialogStatus) (Player*, Creature*);
|
||||
uint32 (MANGOS_IMPORT* m_pGetGODialogStatus) (Player*, GameObject*);
|
||||
bool (MANGOS_IMPORT* m_pOnGOUse) (Player*, GameObject*);
|
||||
bool (MANGOS_IMPORT* m_pOnItemUse) (Player*, Item*, SpellCastTargets const&);
|
||||
bool (MANGOS_IMPORT* m_pOnAreaTrigger) (Player*, AreaTriggerEntry const*);
|
||||
bool (MANGOS_IMPORT* m_pOnProcessEvent)(uint32, WorldObject*, WorldObject*, bool);
|
||||
bool (MANGOS_IMPORT* m_pOnProcessEvent) (uint32, Object*, Object*, bool);
|
||||
bool (MANGOS_IMPORT* m_pOnEffectDummyCreature) (Unit*, uint32, SpellEffectIndex, Creature*);
|
||||
bool (MANGOS_IMPORT* m_pOnEffectDummyGO) (Unit*, uint32, SpellEffectIndex, GameObject*);
|
||||
bool (MANGOS_IMPORT* m_pOnEffectDummyItem) (Unit*, uint32, SpellEffectIndex, Item*);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "10937"
|
||||
#define REVISION_NR "10938"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
|
|
@ -909,14 +909,6 @@
|
|||
RelativePath="..\..\src\game\QuestHandler.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\game\ScriptCalls.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\game\ScriptCalls.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\game\ScriptMgr.cpp"
|
||||
>
|
||||
|
|
|
|||
|
|
@ -902,14 +902,6 @@
|
|||
RelativePath="..\..\src\game\QuestHandler.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\game\ScriptCalls.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\game\ScriptCalls.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\game\ScriptMgr.cpp"
|
||||
>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue