示例#1
0
bool CNWNXNames::OnCreate (gline *config, const char* LogDir)
{
	char log[128];
	bool validate = true, startServer = true;

	// call the base class function
	sprintf (log, "%s/nwnx_names.txt", LogDir);
	if (!CNWNXBase::OnCreate(config,log))
		return false;

	// write copy information to the log file
	Log (0, "NWNX Names version 1.0.3 for Linux.\n");
	Log (0, "(c) 2006-2010 by virusman ([email protected])\n");

	if(nwnxConfig->exists(confKey)) {
		strncpy(eventScript, (*nwnxConfig)[confKey]["event_script"].c_str(), 16);
		eventScript[16] = 0;

		int log_dbg = atoi((*nwnxConfig)[confKey]["log_debug"].c_str());
		if (log_dbg) logDebug = log_dbg;
	}
	if(!this->Names.data)
	{
		Log(0, "Unable to construct names array\n");
		return 0;
	}
	//Names.InsertPlayer(0x7FFFFFFF, 0);
	//int nPlyID = Names.FindPlayerID(0x7FFFFFFF);
	//Log(0, "PlyID=%n", nPlyID);
	//char plog[128];
	//sprintf (plog, "%s/nwnx_names_plog.txt", LogDir);
	//PacketData = fopen(plog, "w");

	return(HookFunctions());
}
示例#2
0
void InitPlugin()
{
    logFile = fopen(logFileName, "w");
    fprintf(logFile, "NWCX Serverlist plugin 1.0.1\n");
    fprintf(logFile, "(c) 2013 by virusman & addicted2rpg\n");
    fflush(logFile);
    if(pluginLink) {
    }
    HookFunctions();
    client = new NWNMSClient(logFile, ServerListCallback);
}
示例#3
0
BOOL CNWNXResMan::OnCreate (const char* LogDir)
{
	// call the base class function
	char log[MAX_PATH];
	sprintf (log, "%s\\nwnx_resman.txt", LogDir);
	if (!CNWNXBase::OnCreate(log))
		return false;

	LoadConfiguration();
	HookFunctions();
	return true;
}
示例#4
0
文件: gui.cpp 项目: HellSinker/nwncx
void InitPlugin()
{
	//DebugBreak();
	logFile = fopen(logFileName, "w");
	fprintf(logFile, "NWN Client Extender 0.1 - GUI plugin\n");
	fprintf(logFile, "(c) 2009 by virusman\n");
	//init();
	HookFunctions();
	HookEvent("NWNX/Core/PluginsLoaded", OnPluginsLoaded);
	fflush(logFile);

}
示例#5
0
bool CNWNXServerlist::OnCreate(gline *config, const char *LogDir) {
    char log[128];

    sprintf(log, "%s/nwnx_serverlist.txt", LogDir);

    // call the base class function
    if (!CNWNXBase::OnCreate(config, log))
        return false;
	HookFunctions();

    return true;
}
示例#6
0
BOOL CNWNXAreas::OnCreate (const char* LogDir)
{
	// call the base class function
	char log[MAX_PATH];
	sprintf (log, "%s\\nwnx_areas.txt", LogDir);
	if (!CNWNXBase::OnCreate(log))
		return false;

	// write copy information to the log file
	Log (0, "NWNX Areas version 0.2.2 for Windows.\n");
	Log (0, "(c) 2006-2008 by virusman ([email protected])\n");
	
	return HookFunctions();
}
示例#7
0
文件: test.cpp 项目: HellSinker/nwncx
void InitPlugin()
{
	//DebugBreak();
	logFile = fopen(logFileName, "w");
	fprintf(logFile, "NWN Client Extender 0.1 - Test plugin\n");
	fprintf(logFile, "(c) 2010 by virusman\n");
	fflush(logFile);
	if(pluginLink){
		hAppendMsg = CreateHookableEvent("NWClient/GUI/AppendToMsgBuffer");
		hClientPostInit = CreateHookableEvent("NWClient/ExoApp/Initialized");
		CreateServiceFunction("NWClient/GUI/AppendToMsgBuffer", ShowLogMessage);
	}
	HookFunctions();

}
示例#8
0
文件: nwnxruby.cpp 项目: NWNX/nwnx4
bool Ruby::Init(TCHAR* nwnxhome)
{
	assert(GetPluginFileName());

	/* Log file */
	wxString logfile(nwnxhome); 
	logfile.append(wxT("\\"));
	logfile.append(GetPluginFileName());
	logfile.append(wxT(".txt"));
	logger = new wxLogNWNX(logfile, wxString(header.c_str()));

	ruby_init();
	ruby_script("embedded");
	ruby_init_loadpath();
	RubyInt_DefineConstants();

	//rb_eval_string("puts \"NWNX Ruby Initialized\"\n");

/*	char *preload = (char*)((*nwnxConfig)[confKey]["preload"].c_str());
	if (strlen(preload) > 0)
	{
		Log(0, "Preloading: %s\n", preload);
		rb_require(preload);
	}*/

	cNWScript = RubyInt_InitNWScript();
	rb_include_module(rb_cObject, cNWScript);

	if (HookFunctions())
	{
		//bHooked=1;
		Log(0,"* Module loaded successfully.\n");
	}

	//wxLogMessage(wxT("* Plugin initialized."));
	return true;
}
示例#9
0
文件: NWNXICE.cpp 项目: niv/nwnx-ice
bool CNWNXICE::OnCreate(gline *config, const char *LogDir)
{
	char log[128];
	struct stat statbuf;
	int i = 0;
	sprintf (log, "%s/nwnx_ice.txt", LogDir);

	// call the base class function
	if (!CNWNXBase::OnCreate(config,log))
		return false;

	Log(0,"NWNX ICE\n");

	if (HookFunctions())
	{
		bHooked=1;
		Log(0,"* Module loaded successfully.\n");
	}
	else
	{
		bHooked=0;
		Log(0,"* Module loaded successfully.\n");
		Log(0,"* Signature recognition failed. Some functions will be disabled.\n");
		return false;
	}

	Ice::PropertiesPtr props = Ice::createProperties();
	props->setProperty("Ice.ThreadPool.Client.Size", (*nwnxConfig)[confKey]["threadPoolClientSize"].c_str());
	props->setProperty("Ice.ThreadPool.Client.SizeMax", (*nwnxConfig)[confKey]["threadPoolClientSizeMax"].c_str());
	props->setProperty("Ice.ThreadPool.Server.Size", (*nwnxConfig)[confKey]["threadPoolServerSize"].c_str());
	props->setProperty("Ice.ThreadPool.Server.SizeMax", (*nwnxConfig)[confKey]["threadPoolServerSizeMax"].c_str());
	Ice::InitializationData initData;
	const char* charset = (*nwnxConfig)[confKey]["charset"].c_str();
	initData.stringConverter = new Ice::IconvStringConverter<char>(charset);
	initData.properties = props;
	ic = Ice::initialize(initData);

	while (true) {
		// Set up the client
		try {
			Ice::ObjectPrx base = ic->stringToProxy( (*nwnxConfig)[confKey]["client"].c_str() );
			if (!base)
				throw "Could not create proxy.";

			prx_client = NWN::ClientPrx::checkedCast(base);
			if (!prx_client)
				throw "Invalid proxy.";

			break;

		} catch (const Ice::ConnectFailedException &e) {
			cerr << e << endl;
			IceUtil::ThreadControl::sleep(IceUtil::Time::seconds(2));

		} catch (const Ice::Exception &ee) {
			cerr << ee << endl;
			exit(1);

		} catch (const char* msg) {
			cerr << msg << endl;
			exit(1);
		}
	}

	// Set up the server ..
	try {
		adapter =
			ic->createObjectAdapterWithEndpoints(
				"NWScriptAdapter", (*nwnxConfig)[confKey]["server"].c_str() );
		
		nwscriptI = new NWScriptI;
		Ice::ObjectPtr object = nwscriptI;

		nwscript_proxy = NWN::NWScriptPrx::checkedCast(
			adapter->add(object, ic->stringToIdentity("NWScript"))
		);
		adapter->activate();

	} catch (const Ice::Exception &e) {
		cerr << e << endl;
		throw;
	}

	nwscriptI->printEvents = atoi((*nwnxConfig)[confKey]["printEvents"].c_str()) == 1 ? true : false;

    return true;
}