Пример #1
0
QStringList IconThemeManager::defaultThemePaths()
{
	QStringList result = getSubDirs(dataPath("kadu/themes/icons"));
	result += getSubDirs(profilePath("icons"));

	return result;
}
Пример #2
0
bool updateFile(char *pFile)
{
	char *ext = strrchr(pFile, '.');
	CString file = pFile;

	if (strcmp(ext, ".graal") == 0 || strcmp(ext, ".nw") == 0 || strcmp(ext, ".zelda") == 0)
		CLevel::updateLevel(file);
	else if (strcmp(pFile, "rchelp.txt") == 0)
		RCHelpMessage.load(pFile);
	else if (strcmp(pFile, "rcmessage.txt") == 0)
		RCMessage.load(pFile);
	else if (strcmp(pFile, "serverflags.txt") == 0)
		serverFlags.load(pFile);
	else if (strcmp(pFile, "servermessage.html") == 0)
		loadServerMessage();
	else if (strcmp(pFile, "rules.txt") == 0)
		WordFilter.load("rules.txt");
	else if ( strcmp(pFile, "foldersconfig.txt") == 0 )
	{
		folderConfig.load( "foldersconfig.txt" );

		// Don't allow .. in the folder path.
		for ( int i = 0; i < folderConfig.count(); ++i )
		{
			if ( ((CBuffer)folderConfig[i]).find( ".." ) != -1 )
			{
				folderConfig.remove(i);
				--i;
			}
		}

		getSubDirs();
	}
	else
		return false;

	return true;
}
Пример #3
0
bool loadSettings(char* pFile)
{
	CStringList settings;
	if (!settings.load(pFile))
		return false;

	for (int i = 0; i < settingList.count(); i++)
	{
		delete (SettingKey *)settingList[i];
		i--;
	}
	settingList.clear();

	for (int i = 0; i < settings.count(); i++)
	{
		if (settings[i][0] == '#' || settings[i][0] == '\'')
			continue;

		SettingKey *key = new SettingKey();
		key->name = settings[i].copy(0, settings[i].find('=')).trim();
		key->value = settings[i].copy(settings[i].find('=') + 1).trim();
	}

	/* ARRAY Server-Options */
	globalGuildList.load(findKey("allowedglobalguilds"), ",");
	cheatwindows.load(findKey("cheatwindows"), ",");
	jailLevels.load(findKey("jaillevels"), ",");
	mapNames.load(findKey("maps"), ",");
	profileList.load(findKey("profilevars", "Kills:=playerkills,Deaths:=playerdeaths,Maxpower:=playerfullhearts,Rating:=playerrating,Alignment:=playerap,Gralat:=playerrupees,Swordpower:=playerswordpower,Spin Attack:=canspin"), ",");
	staffGuilds.load(findKey("staffguilds", "Server,Manager,Owner,Admin,FAQ,LAT,NAT,GAT,GP,GP Chief,Bugs Admin,NPC Admin,Gani Team,GFX Admin,Events Team,Events Admin,Guild Admin"), ",");
	staffList.load(findKey("staff"), ",");
	statusList.load(findKey("playerlisticons", "Online,Away,DND"), ",");

	/* BOOL Server-Options */
	apSystem = CHECK_BOOL(findKey("apsystem", "true"));
	baddyDropItems = CHECK_BOOL(findKey("baddyitems", "false"));
	bushesDrop = CHECK_BOOL(findKey("bushitems", "true"));
	cheatwindowsban = CHECK_BOOL(findKey("cheatwindowsban", "false"));
	clientsidePushPull = CHECK_BOOL(findKey("clientsidepushpull", "true"));
	defaultweapons = CHECK_BOOL(findKey("defaultweapons", "true"));
	detailedconsole = CHECK_BOOL(findKey("detailedconsole", "false"));
	dontaddserverflags = CHECK_BOOL(findKey("dontaddserverflags", "false"));
	dontchangekills = CHECK_BOOL(findKey("dontchangekills", "false"));
	dropItemsDead = CHECK_BOOL(findKey("dropitemsdead", "true"));
	globalGuilds = CHECK_BOOL(findKey("globalguilds", "true"));
	healswords = CHECK_BOOL(findKey("healswords", "false"));
	idleDisconnect = CHECK_BOOL(findKey("disconnectifnotmoved", "true"));
	noExplosions = CHECK_BOOL(findKey("noexplosions", "false"));
	noFoldersConfig = CHECK_BOOL(findKey("nofoldersconfig", "false"));
	putnpcenabled = CHECK_BOOL(findKey("putnpcenabled", "true"));
	adminCanChangeGralat = CHECK_BOOL(findKey("normaladminscanchangegralats", "true"));
	setbodyallowed = CHECK_BOOL(findKey("setbodyallowed", "true"));
	setheadallowed = CHECK_BOOL(findKey("setheadallowed", "true"));
	setswordallowed = CHECK_BOOL(findKey("setswordallowed", "true"));
	setshieldallowed = CHECK_BOOL(findKey("setshieldallowed", "true"));
	showConsolePackets = CHECK_BOOL(findKey("showconsolepackets", "false"));
	staffOnly = CHECK_BOOL(findKey("onlystaff", "false"));
	underconstruction = CHECK_BOOL(findKey("underconstruction", "false"));
	vasesDrop = CHECK_BOOL(findKey("vasesdrop", "true"));
	warptoforall  = CHECK_BOOL(findKey("warptoforall", "false"));

	/* INT Server-Options */
	aptime[0] = atoi(findKey("aptime0", "30"));
	aptime[1] = atoi(findKey("aptime1", "90"));
	aptime[2] = atoi(findKey("aptime2", "300"));
	aptime[3] = atoi(findKey("aptime3", "600"));
	aptime[4] = atoi(findKey("aptime4", "1200"));
	baddyRespawn = atoi(findKey("baddyrespawntime"));
	cheatwindowstime = atoi(findKey("cheatwindowstime", "60"));
	heartLimit = atoi(findKey("heartlimit", "20"));
	horseLife = atoi(findKey("horselifetime"));
	listServerFields[3] = toString(GSERVER_BUILD);
	listServerPort = atoi(findKey("listport", "14900"));
	maxNoMovement = atoi(findKey("maxnomovement", "1200"));
	maxPlayers = atoi(findKey("maxplayers", "128"));
	mindeathgralats = atoi(findKey("mindeathgralats","1"));
	maxdeathgralats = atoi(findKey("maxdeathgralats","50"));
	shieldLimit = atoi(findKey("shieldlimit", "3"));
	swordLimit = CLIP(atoi(findKey("swordlimit", "4")), -25, 25);
	tiledroprate = CLIP(atoi(findKey("tiledroprate", "50")), 0, 100);
	tileRespawn = atoi(findKey("respawntime"));
	unstickmeX = (float)atof(findKey("unstickmex", "30"));
	unstickmeY = (float)atof(findKey("unstickmey", "30.5"));

	/* TEXT Server-Options */
	unstickmeLevel = findKey("unstickmelevel", "onlinestartlocal.nw");
	listServerIp = findKey("listip", "listserver.graal.in");
	listServerFields[0] = findKey("name", "My Server");
	listServerFields[1] = findKey("description", "My Server");
	listServerFields[2] = findKey("language", "English");
	listServerFields[4] = findKey("url", "http://www.graal.in");
	listServerFields[5] = findKey("myip", "AUTO");
	serverPort = findKey("serverport", "14802");
	shareFolder = findKey("sharefolder");
	staffHead = findKey("staffhead", "head25.png");
	worldName = findKey("worldname", "main");

	// If the server is flagged as under construction, prepend the
	// Under Construction value to the name.
	if ( underconstruction && !listServerFields[0].match( "U *" ) )
		listServerFields[0] = CBuffer() << "U " << listServerFields[0];

	/* Load Maps */
	for(int i = 0; i < CMap::mapList.count(); i++)
		delete((CMap*)CMap::mapList[i]);
	CMap::mapList.clear();
	for(int i = 0; i < mapNames.count(); i++)
		CMap::openMap(mapNames[i].trim());

	// Now fix all the levels.
	for ( int i = 0; i < levelList.count(); ++i )
	{
		CLevel* level = (CLevel*)levelList[i];

		//Find our map id
		level->map = 0;
		for ( int j = 0; j < CMap::mapList.count(); ++j )
		{
			CMap* m = (CMap*)CMap::mapList[j];
			if ( (level->levelIndex = m->getLevelpos(level->fileName)) >= 0 )
			{
				level->map = m;
				break;
			}
		}
	}

	// In case we turned off folders config, get the new sub dirs.
	getSubDirs();

	return true;
}