From 0b8e6ee15a1137d25aaa3071dc5a1410e49faec4 Mon Sep 17 00:00:00 2001 From: Anubisss Date: Sat, 23 May 2009 20:48:32 +0200 Subject: *Some changes in bindings/interface. *Fix the bug that You build it without Trinity Script the emu try to load the libtrinityscript lib instead of libtrinityinterface. --HG-- branch : trunk --- src/bindings/interface/ScriptMgr.cpp | 109 +++++++++++++++-------------------- 1 file changed, 48 insertions(+), 61 deletions(-) (limited to 'src/bindings/interface/ScriptMgr.cpp') diff --git a/src/bindings/interface/ScriptMgr.cpp b/src/bindings/interface/ScriptMgr.cpp index 57e6ea7c224..5b38352769c 100644 --- a/src/bindings/interface/ScriptMgr.cpp +++ b/src/bindings/interface/ScriptMgr.cpp @@ -26,11 +26,8 @@ #include "Map.h" #include "ObjectMgr.h" -//uint8 loglevel = 0; -int nrscripts; +int num_sc_scripts; Script *m_scripts[MAX_SCRIPTS]; -InstanceDataScript* m_instance_scripts[MAX_INSTANCE_SCRIPTS]; -int num_inst_scripts; // -- Scripts to be added -- extern void AddSC_default(); @@ -39,26 +36,18 @@ extern void AddSC_default(); TRINITY_DLL_EXPORT void ScriptsFree() { // Free resources before library unload - for(int i=0;ipGossipSelectWithCode(player,_Creature,sender,action,sCode); } +TRINITY_DLL_EXPORT +bool GOSelect( Player *player, GameObject *_GO, uint32 sender, uint32 action ) +{ + if(!_GO) + return false; + debug_log("TSCR: Gossip selection, sender: %d, action: %d",sender, action); + + Script *tmpscript = m_scripts[_GO->GetGOInfo()->ScriptId]; + if(!tmpscript || !tmpscript->pGOSelect) return false; + + player->PlayerTalkClass->ClearMenus(); + return tmpscript->pGOSelect(player,_GO,sender,action); +} + +TRINITY_DLL_EXPORT +bool GOSelectWithCode( Player *player, GameObject *_GO, uint32 sender, uint32 action, const char* sCode ) +{ + if(!_GO) + return false; + debug_log("TSCR: Gossip selection, sender: %d, action: %d",sender, action); + + Script *tmpscript = m_scripts[_GO->GetGOInfo()->ScriptId]; + if(!tmpscript || !tmpscript->pGOSelectWithCode) return false; + + player->PlayerTalkClass->ClearMenus(); + return tmpscript->pGOSelectWithCode(player,_GO,sender,action,sCode); +} + TRINITY_DLL_EXPORT bool QuestAccept( Player *player, Creature *_Creature, Quest const *_Quest ) { @@ -266,7 +297,7 @@ bool ReceiveEmote( Player *player, Creature *_Creature, uint32 emote ) return tmpscript->pReceiveEmote(player, _Creature, emote); } -/*TRINITY_DLL_EXPORT +TRINITY_DLL_EXPORT InstanceData* CreateInstanceData(Map *map) { if (!map->IsDungeon()) return NULL; @@ -277,47 +308,3 @@ InstanceData* CreateInstanceData(Map *map) return tmpscript->GetInstanceData(map); } -void ScriptedAI::UpdateAI(const uint32) -{ - //Check if we have a current target - if( m_creature->isAlive() && m_creature->SelectHostilTarget() && m_creature->getVictim()) - { - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - if( m_creature->isAttackReady() ) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } - } -} - -void ScriptedAI::EnterEvadeMode() -{ - if( m_creature->isAlive() ) - DoGoHome(); -} - -void ScriptedAI::DoStartAttack(Unit* victim) -{ - if( m_creature->Attack(victim, true) ) - m_creature->GetMotionMaster()->MoveChase(victim); -} - -void ScriptedAI::DoStopAttack() -{ - if( m_creature->getVictim() != NULL ) - { - m_creature->AttackStop(); - } -} - -void ScriptedAI::DoGoHome() -{ - if( !m_creature->getVictim() && m_creature->isAlive() ) - m_creature->GetMotionMaster()->MoveTargetedHome(); -} -*/ - -- cgit v1.2.3