Beispiel #1
0
Eluna::Eluna():
L(luaL_newstate()),

m_EventMgr(new EventMgr(*this)),

ServerEventBindings(new EventBind<HookMgr::ServerEvents>("ServerEvents", *this)),
PlayerEventBindings(new EventBind<HookMgr::PlayerEvents>("PlayerEvents", *this)),
GuildEventBindings(new EventBind<HookMgr::GuildEvents>("GuildEvents", *this)),
GroupEventBindings(new EventBind<HookMgr::GroupEvents>("GroupEvents", *this)),
VehicleEventBindings(new EventBind<HookMgr::VehicleEvents>("VehicleEvents", *this)),

PacketEventBindings(new EntryBind<HookMgr::PacketEvents>("PacketEvents", *this)),
CreatureEventBindings(new EntryBind<HookMgr::CreatureEvents>("CreatureEvents", *this)),
CreatureGossipBindings(new EntryBind<HookMgr::GossipEvents>("GossipEvents (creature)", *this)),
GameObjectEventBindings(new EntryBind<HookMgr::GameObjectEvents>("GameObjectEvents", *this)),
GameObjectGossipBindings(new EntryBind<HookMgr::GossipEvents>("GossipEvents (gameobject)", *this)),
ItemEventBindings(new EntryBind<HookMgr::ItemEvents>("ItemEvents", *this)),
ItemGossipBindings(new EntryBind<HookMgr::GossipEvents>("GossipEvents (item)", *this)),
playerGossipBindings(new EntryBind<HookMgr::GossipEvents>("GossipEvents (player)", *this))
{
    // open base lua
    luaL_openlibs(L);
    RegisterFunctions(L);

    // Create hidden table with weak values
    lua_newtable(L);
    lua_newtable(L);
    lua_pushstring(L, "v");
    lua_setfield(L, -2, "__mode");
    lua_setmetatable(L, -2);
    userdata_table = luaL_ref(L, LUA_REGISTRYINDEX);

    // Replace this with map insert if making multithread version
    ASSERT(!Eluna::GEluna);
    Eluna::GEluna = this;

    // run scripts
    RunScripts();
}
Beispiel #2
0
void Game::tick(void)
{
	debug_clear();
	
	if (game.paused)
	{
		tickfunctions[game.paused].OnTick();
	}
	else
	{
		// record/playback replays
		Replay::run();
		
		// run scripts
		RunScripts();
		
		// call the tick function for the current game mode
		tickfunctions[game.mode].OnTick();
	}
	
	DrawDebug();
	console.Draw();
}
Beispiel #3
0
BOOL CInstallPage::StartInstallation(CString strLogFile)
{
    m_InstallationText.SetWindowText(CRString(IDS_LABEL_BEGIN_INSTALL));

    CWizardToolz toolz;

    // If the log file cannot be created, do not expect
    // that the installation can go on. So give a message and exit
    if (!toolz.InternalCreateFile(strLogFile))
    {
        m_InstallationText.SetWindowText(CRString(IDS_FAIL_INSTALL));
        AfxMessageBox(CRString(IDS_LABEL_NORIGHTS));
        return FALSE;
    }

    CStringArray arrLog;

    // The copy proccess
    arrLog.Add(CRString(IDS_START_COPY));
    if (!CopyNecessaryFiles(arrLog))
    {   // In case of an error, write to log and return
        arrLog.Add(CRString(IDS_FAIL_COPY));
        toolz.InternalWriteToFile(strLogFile, arrLog);
        return FALSE;
    }
    else
    {
        arrLog.Add(CRString(IDS_END_COPY));
        toolz.InternalWriteToFile(strLogFile, arrLog);
    }

    // The configuration of ini files process
    arrLog.RemoveAll();
    arrLog.Add(CRString(IDS_START_CONFIGURE));
    if (!ModifyConfigurationFiles(arrLog))
    {   // In case of an error, write to log and return
        arrLog.Add(CRString(IDS_FAIL_CONFIGURE));
        toolz.InternalWriteToFile(strLogFile, arrLog);
        return FALSE;
    }
    else
    {
        arrLog.Add(CRString(IDS_END_CONFIGURE));
        toolz.InternalWriteToFile(strLogFile, arrLog);
    }

    // Run some scripts to set stuff
    arrLog.RemoveAll();
    arrLog.Add(CRString(IDS_START_RUNSCRIPTS));
    if (!RunScripts(arrLog))
    {   // In case of an error, write to log and return
        arrLog.Add(CRString(IDS_FAIL_RUNSCRIPTS));
        toolz.InternalWriteToFile(strLogFile, arrLog);
        return FALSE;
    }
    else
    {
        arrLog.Add(CRString(IDS_END_RUNSCRIPTS));
        toolz.InternalWriteToFile(strLogFile, arrLog);
    }

    // Clean up process
    arrLog.RemoveAll();
    arrLog.Add(CRString(IDS_START_CLEANUP));
    if (!CleanUp(arrLog))
    {   // In case of an error, write to log and return
        arrLog.Add(CRString(IDS_FAIL_CLEANUP));
        toolz.InternalWriteToFile(strLogFile, arrLog);
        return FALSE;
    }
    else
    {
        arrLog.Add(CRString(IDS_END_CLEANUP));
        toolz.InternalWriteToFile(strLogFile, arrLog);
    }

    // create shortcuts
    CreateShortcuts(arrLog);

    // create registry entry
    arrLog.RemoveAll();
    arrLog.Add(CRString(IDS_START_UPDATEREGISTRY));
    UpdateRegistryEnvironment(arrLog);
    arrLog.Add(CRString(IDS_END_UPDATEREGISTRY));
    toolz.InternalWriteToFile(strLogFile, arrLog);

    return TRUE;
}
void CScriptedShapeTranslator::UpdateMotion(AtNode *atNode, unsigned int step)
{
   RunScripts(atNode, step, true);
}
void CScriptedShapeTranslator::Update(AtNode *atNode)
{
   RunScripts(atNode, 0, true);
}
void CScriptedShapeTranslator::ExportMotion(AtNode *atNode, unsigned int step)
{
   RunScripts(atNode, step);
}
void CScriptedShapeTranslator::Export(AtNode *atNode)
{
   RunScripts(atNode, 0);
}