diff --git a/src/game/GameObject.cpp b/src/game/GameObject.cpp index e516757ad..6238c4010 100644 --- a/src/game/GameObject.cpp +++ b/src/game/GameObject.cpp @@ -1500,6 +1500,79 @@ void GameObject::Use(Unit* user) } break; } + case GAMEOBJECT_TYPE_CAPTURE_POINT: // 29 + { + // Code here is not even halfway complete, and only added for further development. + // Computer may very well blow up after stealing your bank accounts and wreck your car. + // Use() object at own risk. + + GameObjectInfo const* info = GetGOInfo(); + + if (!info) + return; + + // Can we expect that only player object are able to trigger a capture point or + // could dummy creatures be involved? + //if (user->GetTypeId() != TYPEID_PLAYER) + //return; + + //Player* player = (Player*)user; + + // ID1 vs ID2 are possibly related to team. The world states should probably + // control which event to be used. For this to work, we need a far better system for + // sWorldStateMgr (system to store and keep track of states) so that we at all times + // know the state of every part of the world. + + // Call every event, which is obviously wrong, but can help in further development. For + // the time being script side can process events and determine which one to use. It + // require of course that some object call go->Use() + if (info->capturePoint.winEventID1) + { + if (!sScriptMgr.OnProcessEvent(info->capturePoint.winEventID1, user, this, true)) + GetMap()->ScriptsStart(sEventScripts, info->capturePoint.winEventID1, user, this); + } + if (info->capturePoint.winEventID2) + { + if (!sScriptMgr.OnProcessEvent(info->capturePoint.winEventID2, user, this, true)) + GetMap()->ScriptsStart(sEventScripts, info->capturePoint.winEventID2, user, this); + } + + if (info->capturePoint.contestedEventID1) + { + if (!sScriptMgr.OnProcessEvent(info->capturePoint.contestedEventID1, user, this, true)) + GetMap()->ScriptsStart(sEventScripts, info->capturePoint.contestedEventID1, user, this); + } + if (info->capturePoint.contestedEventID2) + { + if (!sScriptMgr.OnProcessEvent(info->capturePoint.contestedEventID2, user, this, true)) + GetMap()->ScriptsStart(sEventScripts, info->capturePoint.contestedEventID2, user, this); + } + + if (info->capturePoint.progressEventID1) + { + if (!sScriptMgr.OnProcessEvent(info->capturePoint.progressEventID1, user, this, true)) + GetMap()->ScriptsStart(sEventScripts, info->capturePoint.progressEventID1, user, this); + } + if (info->capturePoint.progressEventID2) + { + if (!sScriptMgr.OnProcessEvent(info->capturePoint.progressEventID2, user, this, true)) + GetMap()->ScriptsStart(sEventScripts, info->capturePoint.progressEventID2, user, this); + } + + if (info->capturePoint.neutralEventID1) + { + if (!sScriptMgr.OnProcessEvent(info->capturePoint.neutralEventID1, user, this, true)) + GetMap()->ScriptsStart(sEventScripts, info->capturePoint.neutralEventID1, user, this); + } + if (info->capturePoint.neutralEventID2) + { + if (!sScriptMgr.OnProcessEvent(info->capturePoint.neutralEventID2, user, this, true)) + GetMap()->ScriptsStart(sEventScripts, info->capturePoint.neutralEventID2, user, this); + } + + // Some has spell, need to process those further. + return; + } case GAMEOBJECT_TYPE_BARBER_CHAIR: //32 { GameObjectInfo const* info = GetGOInfo(); diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 012461f9b..81635f239 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "11250" + #define REVISION_NR "11251" #endif // __REVISION_NR_H__