mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 10:37:02 +00:00
[9572] Add script calls for GameObject GossipHello and GossipSelect
Signed-off-by: NoFantasy <nofantasy@nf.no>
This commit is contained in:
parent
c4f3578226
commit
dbe089b66d
7 changed files with 76 additions and 9 deletions
|
|
@ -79,6 +79,18 @@ bool GossipHello ( Player * player, Creature *_Creature )
|
|||
return tmpscript->pGossipHello(player,_Creature);
|
||||
}
|
||||
|
||||
MANGOS_DLL_EXPORT
|
||||
bool GOGossipHello(Player *pPlayer, GameObject *pGo)
|
||||
{
|
||||
Script *tmpscript = m_scripts[pGo->GetGOInfo()->ScriptId];
|
||||
if (!tmpscript || !tmpscript->pGOGossipHello)
|
||||
return false;
|
||||
|
||||
pPlayer->PlayerTalkClass->ClearMenus();
|
||||
|
||||
return tmpscript->pGOGossipHello(pPlayer, pGo);
|
||||
}
|
||||
|
||||
MANGOS_DLL_EXPORT
|
||||
bool GossipSelect( Player *player, Creature *_Creature,uint32 sender, uint32 action )
|
||||
{
|
||||
|
|
@ -93,6 +105,20 @@ bool GossipSelect( Player *player, Creature *_Creature,uint32 sender, uint32 act
|
|||
return tmpscript->pGossipSelect(player,_Creature,sender,action);
|
||||
}
|
||||
|
||||
MANGOS_DLL_EXPORT
|
||||
bool GOGossipSelect(Player *pPlayer, GameObject *pGo, uint32 sender, uint32 action)
|
||||
{
|
||||
debug_log("DEBUG: GO Gossip selection, sender: %u, action: %u", sender, action);
|
||||
|
||||
Script *tmpscript = m_scripts[pGo->GetGOInfo()->ScriptId];
|
||||
if (!tmpscript || !tmpscript->pGOGossipSelect)
|
||||
return false;
|
||||
|
||||
pPlayer->PlayerTalkClass->ClearMenus();
|
||||
|
||||
return tmpscript->pGOGossipSelect(pPlayer, pGo, sender, action);
|
||||
}
|
||||
|
||||
MANGOS_DLL_EXPORT
|
||||
bool GossipSelectWithCode( Player *player, Creature *_Creature, uint32 sender, uint32 action, const char* sCode )
|
||||
{
|
||||
|
|
@ -107,6 +133,20 @@ bool GossipSelectWithCode( Player *player, Creature *_Creature, uint32 sender, u
|
|||
return tmpscript->pGossipSelectWithCode(player,_Creature,sender,action,sCode);
|
||||
}
|
||||
|
||||
MANGOS_DLL_EXPORT
|
||||
bool GOGossipSelectWithCode(Player *pPlayer, GameObject *pGo, uint32 sender, uint32 action, const char* sCode)
|
||||
{
|
||||
debug_log("DEBUG: GO Gossip selection, sender: %u, action: %u", sender, action);
|
||||
|
||||
Script *tmpscript = m_scripts[pGo->GetGOInfo()->ScriptId];
|
||||
if (!tmpscript || !tmpscript->pGOGossipSelectWithCode)
|
||||
return false;
|
||||
|
||||
pPlayer->PlayerTalkClass->ClearMenus();
|
||||
|
||||
return tmpscript->pGOGossipSelectWithCode(pPlayer, pGo, sender, action, sCode);
|
||||
}
|
||||
|
||||
MANGOS_DLL_EXPORT
|
||||
bool QuestAccept( Player *player, Creature *_Creature, Quest *_Quest )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -39,7 +39,8 @@ class Aura;
|
|||
struct Script
|
||||
{
|
||||
Script() :
|
||||
pGossipHello(NULL), pQuestAccept(NULL), pGossipSelect(NULL), pGossipSelectWithCode(NULL),
|
||||
pGossipHello(NULL), pGOGossipHello(NULL), pQuestAccept(NULL), pGossipSelect(NULL), pGOGossipSelect(NULL),
|
||||
pGossipSelectWithCode(NULL), pGOGossipSelectWithCode(NULL),
|
||||
pQuestSelect(NULL), pQuestComplete(NULL), pNPCDialogStatus(NULL), pGODialogStatus(NULL), pChooseReward(NULL),
|
||||
pItemHello(NULL), pGOHello(NULL), pAreaTrigger(NULL), pItemQuestAccept(NULL), pGOQuestAccept(NULL),
|
||||
pGOChooseReward(NULL), pItemUse(NULL), pEffectDummyGameObj(NULL), pEffectDummyCreature(NULL),
|
||||
|
|
@ -50,9 +51,12 @@ struct Script
|
|||
|
||||
// -- Quest/gossip Methods to be scripted --
|
||||
bool (*pGossipHello )(Player *player, Creature *_Creature);
|
||||
bool (*pGOGossipHello )(Player *player, GameObject *_GO);
|
||||
bool (*pQuestAccept )(Player *player, Creature *_Creature, Quest const*_Quest );
|
||||
bool (*pGossipSelect )(Player *player, Creature *_Creature, uint32 sender, uint32 action );
|
||||
bool (*pGOGossipSelect )(Player *player, GameObject *_GO, uint32 sender, uint32 action );
|
||||
bool (*pGossipSelectWithCode)(Player *player, Creature *_Creature, uint32 sender, uint32 action, const char* sCode );
|
||||
bool (*pGOGossipSelectWithCode)(Player *player, GameObject *_GO, uint32 sender, uint32 action, const char* sCode );
|
||||
bool (*pQuestSelect )(Player *player, Creature *_Creature, Quest const*_Quest );
|
||||
bool (*pQuestComplete )(Player *player, Creature *_Creature, Quest const*_Quest );
|
||||
uint32 (*pNPCDialogStatus )(Player *player, Creature *_Creature );
|
||||
|
|
|
|||
|
|
@ -930,8 +930,12 @@ void GameObject::Use(Unit* user)
|
|||
|
||||
Player* player = (Player*)user;
|
||||
|
||||
player->PrepareGossipMenu(this, GetGOInfo()->questgiver.gossipID);
|
||||
player->SendPreparedGossip(this);
|
||||
if (!Script->GOGossipHello(player, this))
|
||||
{
|
||||
player->PrepareGossipMenu(this, GetGOInfo()->questgiver.gossipID);
|
||||
player->SendPreparedGossip(this);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
case GAMEOBJECT_TYPE_CHEST:
|
||||
|
|
@ -1037,8 +1041,11 @@ void GameObject::Use(Unit* user)
|
|||
}
|
||||
else if (info->goober.gossipID) // ...or gossip, if page does not exist
|
||||
{
|
||||
player->PrepareGossipMenu(this, info->goober.gossipID);
|
||||
player->SendPreparedGossip(this);
|
||||
if (!Script->GOGossipHello(player, this))
|
||||
{
|
||||
player->PrepareGossipMenu(this, info->goober.gossipID);
|
||||
player->SendPreparedGossip(this);
|
||||
}
|
||||
}
|
||||
|
||||
if (info->goober.eventId)
|
||||
|
|
|
|||
|
|
@ -304,8 +304,6 @@ void WorldSession::HandleGossipSelectOptionOpcode( WorldPacket & recv_data )
|
|||
if (GetPlayer()->hasUnitState(UNIT_STAT_DIED))
|
||||
GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH);
|
||||
|
||||
// TODO: determine if scriptCall is needed for GO and also if scriptCall can be same as current, with modified argument WorldObject*
|
||||
|
||||
// can vehicle have gossip? If so, need check for this also.
|
||||
if (IS_CREATURE_OR_PET_GUID(guid))
|
||||
{
|
||||
|
|
@ -338,7 +336,16 @@ void WorldSession::HandleGossipSelectOptionOpcode( WorldPacket & recv_data )
|
|||
return;
|
||||
}
|
||||
|
||||
_player->OnGossipSelect(pGo, gossipListId, menuId);
|
||||
if (!code.empty())
|
||||
{
|
||||
if (!Script->GOGossipSelectWithCode(_player, pGo, _player->PlayerTalkClass->GossipOptionSender(gossipListId), _player->PlayerTalkClass->GossipOptionAction(gossipListId), code.c_str()))
|
||||
_player->OnGossipSelect(pGo, gossipListId, menuId);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!Script->GOGossipSelect(_player, pGo, _player->PlayerTalkClass->GossipOptionSender(gossipListId), _player->PlayerTalkClass->GossipOptionAction(gossipListId)))
|
||||
_player->OnGossipSelect(pGo, gossipListId, menuId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -58,10 +58,13 @@ bool LoadScriptingModule(char const* libName)
|
|||
||!(testScript->ScriptsFree =(scriptCallScriptsFree )MANGOS_GET_PROC_ADDR(testScript->hScriptsLib,"ScriptsFree" ))
|
||||
||!(testScript->ScriptsVersion =(scriptCallScriptsVersion )MANGOS_GET_PROC_ADDR(testScript->hScriptsLib,"ScriptsVersion" ))
|
||||
||!(testScript->GossipHello =(scriptCallGossipHello )MANGOS_GET_PROC_ADDR(testScript->hScriptsLib,"GossipHello" ))
|
||||
||!(testScript->GOGossipHello =(scriptCallGOGossipHello )MANGOS_GET_PROC_ADDR(testScript->hScriptsLib,"GOGossipHello" ))
|
||||
||!(testScript->GOChooseReward =(scriptCallGOChooseReward )MANGOS_GET_PROC_ADDR(testScript->hScriptsLib,"GOChooseReward" ))
|
||||
||!(testScript->QuestAccept =(scriptCallQuestAccept )MANGOS_GET_PROC_ADDR(testScript->hScriptsLib,"QuestAccept" ))
|
||||
||!(testScript->GossipSelect =(scriptCallGossipSelect )MANGOS_GET_PROC_ADDR(testScript->hScriptsLib,"GossipSelect" ))
|
||||
||!(testScript->GOGossipSelect =(scriptCallGOGossipSelect )MANGOS_GET_PROC_ADDR(testScript->hScriptsLib,"GOGossipSelect" ))
|
||||
||!(testScript->GossipSelectWithCode=(scriptCallGossipSelectWithCode)MANGOS_GET_PROC_ADDR(testScript->hScriptsLib,"GossipSelectWithCode"))
|
||||
||!(testScript->GOGossipSelectWithCode=(scriptCallGOGossipSelectWithCode)MANGOS_GET_PROC_ADDR(testScript->hScriptsLib,"GOGossipSelectWithCode"))
|
||||
||!(testScript->QuestSelect =(scriptCallQuestSelect )MANGOS_GET_PROC_ADDR(testScript->hScriptsLib,"QuestSelect" ))
|
||||
||!(testScript->QuestComplete =(scriptCallQuestComplete )MANGOS_GET_PROC_ADDR(testScript->hScriptsLib,"QuestComplete" ))
|
||||
||!(testScript->NPCDialogStatus =(scriptCallNPCDialogStatus )MANGOS_GET_PROC_ADDR(testScript->hScriptsLib,"NPCDialogStatus" ))
|
||||
|
|
|
|||
|
|
@ -41,9 +41,12 @@ typedef void(MANGOS_IMPORT * scriptCallScriptsFree) ();
|
|||
typedef char const* (MANGOS_IMPORT * scriptCallScriptsVersion) ();
|
||||
|
||||
typedef bool(MANGOS_IMPORT * scriptCallGossipHello) (Player *player, Creature *_Creature );
|
||||
typedef bool(MANGOS_IMPORT * scriptCallGOGossipHello) (Player *player, GameObject *_GO);
|
||||
typedef bool(MANGOS_IMPORT * scriptCallQuestAccept) (Player *player, Creature *_Creature, Quest const *);
|
||||
typedef bool(MANGOS_IMPORT * scriptCallGossipSelect)(Player *player, Creature *_Creature, uint32 sender, uint32 action);
|
||||
typedef bool(MANGOS_IMPORT * scriptCallGOGossipSelect)(Player *player, GameObject *_GO, uint32 sender, uint32 action);
|
||||
typedef bool(MANGOS_IMPORT * scriptCallGossipSelectWithCode)( Player *player, Creature *_Creature, uint32 sender, uint32 action, const char* sCode );
|
||||
typedef bool(MANGOS_IMPORT * scriptCallGOGossipSelectWithCode)( Player *player, GameObject *_GO, uint32 sender, uint32 action, const char* sCode );
|
||||
typedef bool(MANGOS_IMPORT * scriptCallQuestSelect)( Player *player, Creature *_Creature, Quest const* );
|
||||
typedef bool(MANGOS_IMPORT * scriptCallQuestComplete)(Player *player, Creature *_Creature, Quest const*);
|
||||
typedef uint32(MANGOS_IMPORT * scriptCallNPCDialogStatus)( Player *player, Creature *_Creature);
|
||||
|
|
@ -70,10 +73,13 @@ typedef struct
|
|||
scriptCallScriptsVersion ScriptsVersion;
|
||||
|
||||
scriptCallGossipHello GossipHello;
|
||||
scriptCallGOGossipHello GOGossipHello;
|
||||
scriptCallGOChooseReward GOChooseReward;
|
||||
scriptCallQuestAccept QuestAccept;
|
||||
scriptCallGossipSelect GossipSelect;
|
||||
scriptCallGOGossipSelect GOGossipSelect;
|
||||
scriptCallGossipSelectWithCode GossipSelectWithCode;
|
||||
scriptCallGOGossipSelectWithCode GOGossipSelectWithCode;
|
||||
scriptCallQuestSelect QuestSelect;
|
||||
scriptCallQuestComplete QuestComplete;
|
||||
scriptCallNPCDialogStatus NPCDialogStatus;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "9571"
|
||||
#define REVISION_NR "9572"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue