[11251] Add some base code for GAMEOBJECT_TYPE_CAPTURE_POINT

Note that code is only a tiny start to implement these gameobjects, and are most likely wrong in itself as conditions for calling events does not exist yet.
To be used in further development.

Signed-off-by: NoFantasy <nofantasy@nf.no>
This commit is contained in:
NoFantasy 2011-03-15 11:13:33 +01:00
parent 167ec0df42
commit 7b070a93aa
2 changed files with 74 additions and 1 deletions

View file

@ -1500,6 +1500,79 @@ void GameObject::Use(Unit* user)
} }
break; 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 case GAMEOBJECT_TYPE_BARBER_CHAIR: //32
{ {
GameObjectInfo const* info = GetGOInfo(); GameObjectInfo const* info = GetGOInfo();

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "11250" #define REVISION_NR "11251"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__