当前位置: 首页>>代码示例>>C++>>正文


C++ PlayerManager::updatePermissionLevel方法代码示例

本文整理汇总了C++中PlayerManager::updatePermissionLevel方法的典型用法代码示例。如果您正苦于以下问题:C++ PlayerManager::updatePermissionLevel方法的具体用法?C++ PlayerManager::updatePermissionLevel怎么用?C++ PlayerManager::updatePermissionLevel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PlayerManager的用法示例。


在下文中一共展示了PlayerManager::updatePermissionLevel方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: createCharacter


//.........这里部分代码省略.........
				playerTemplate->getStartingItems(), false);
	} else {
		addProfessionStartingItems(playerCreature, profession, clientTemplate,
				true);
		addStartingItems(playerCreature, clientTemplate, true);
		addRacialMods(playerCreature, fileName,
				playerTemplate->getStartingSkills(),
				playerTemplate->getStartingItems(), true);
	}

	// Set starting cash and starting bank
	playerCreature->setCashCredits(startingCash, false);
	playerCreature->setBankCredits(startingBank, false);

	if (ghost != NULL) {

		ghost->setAccountID(client->getAccountID());

		if (!freeGodMode) {
			try {
				uint32 accID = client->getAccountID();

				ManagedReference<Account*> playerAccount = playerManager->getAccount(accID);

				if (playerAccount == NULL) {
					playerCreature->destroyPlayerCreatureFromDatabase(true);
					return false;
				}

				int accountPermissionLevel = playerAccount->getAdminLevel();
				String accountName = playerAccount->getUsername();

				if(accountPermissionLevel > 0 && (accountPermissionLevel == 9 || accountPermissionLevel == 10 || accountPermissionLevel == 12 || accountPermissionLevel == 15)) {
					playerManager->updatePermissionLevel(playerCreature, accountPermissionLevel);

					/*
					Reference<ShipControlDevice*> shipControlDevice = zoneServer->createObject(STRING_HASHCODE("object/intangible/ship/sorosuub_space_yacht_pcd.iff"), 1).castTo<ShipControlDevice*>();
					//ShipObject* ship = (ShipObject*) server->createObject(STRING_HASHCODE("object/ship/player/player_sorosuub_space_yacht.iff"), 1);
					Reference<ShipObject*> ship = zoneServer->createObject(STRING_HASHCODE("object/ship/player/player_basic_tiefighter.iff"), 1).castTo<ShipObject*>();

					shipControlDevice->setControlledObject(ship);

					if (!shipControlDevice->transferObject(ship, 4))
						info("Adding of ship to device failed");

					ManagedReference<SceneObject*> datapad = playerCreature->getSlottedObject("datapad");

					if (datapad != NULL) {
						if (!datapad->transferObject(shipControlDevice, -1)) {
							shipControlDevice->destroyObjectFromDatabase(true);
						}
					} else {
						shipControlDevice->destroyObjectFromDatabase(true);
						error("could not get datapad from player");
					}
					*/
				}

				if (accountPermissionLevel < 9) {
					try {
						StringBuffer query;
						//query << "SELECT UNIX_TIMESTAMP(creation_date) FROM characters c WHERE galaxy_id = " << zoneServer.get()->getGalaxyID() << " AND account_id = " << client->getAccountID() << " ORDER BY creation_date desc;";
						uint32 galaxyId = zoneServer.get()->getGalaxyID();
						uint32 accountId = client->getAccountID();
						query << "(SELECT UNIX_TIMESTAMP(c.creation_date) as t FROM characters as c WHERE c.account_id = " << accountId << " AND c.galaxy_id = " << galaxyId << " ORDER BY c.creation_date DESC) UNION (SELECT UNIX_TIMESTAMP(d.creation_date) FROM deleted_characters as d WHERE d.account_id = " << accountId << " AND d.galaxy_id = " << galaxyId << " ORDER BY d.creation_date DESC) ORDER BY t DESC LIMIT 1";
开发者ID:angelsounds777,项目名称:Core3-CU,代码行数:66,代码来源:PlayerCreationManager.cpp

示例2: handlePost

void PermissionsServlet::handlePost(HttpRequest* request, HttpResponse* response) {
	PlayerManager* playerManager = server->getPlayerManager();
	bool applyToAll = false;
	String accountName = request->getParameter("accountName");
	String levelName = request->getParameter("level");
	int level = PermissionLevelList::instance()->getLevelNumber(levelName);

	if(request->getParameter("applyToAll") == "true")
		applyToAll = true;

	ManagedReference<Account*> account = AccountManager::getAccount(accountName);
	if(account == NULL) {
		response->println("HTTP/1.1 200 OK\r\n");
		response->println("Content-Type: text/html\r\n\r\n");
		response->println("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN " "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">");
		response->println("<html xmlns=\"http://www.w3.org/1999/xhtml\">");
		response->println("	<head>");
		response->println("		<title>SWGEmu Web Server Login</title>");
		response->println("		<meta http-equiv=\"content-type\" content=\"text/html;charset=utf-8\" />");
		response->println("		<link rel=\"stylesheet\" type=\"text/css\" href=\"css/style.css\" />");
		response->println("	</head>");
		response->println("	<body>");
		response->println("		<div class=\"login_box\">");
		response->println("			<h1>Account doesn't exist.</h1>");
		response->println("			<a href=\"permissions\"> Click here to return </a>");
		response->println("		</div>");
		response->println("	</body>");
		response->println("</html>");
	}

	Locker locker(account);
	account->setAdminLevel(level);
	locker.release();

	if(applyToAll == true) {
		Reference<CharacterList*> characterList = account->getCharacterList();
		for(int i = 0; i < characterList->size(); ++i) {
			ManagedReference<CreatureObject* > targetCreature = NULL;
			CharacterListEntry* entry = &characterList->get(i);

			targetCreature = playerManager->getPlayer(entry->getFirstName());
			playerManager->updatePermissionLevel(targetCreature, level);
		}
	}

	response->println("HTTP/1.1 200 OK\r\n");
	response->println("Content-Type: text/html\r\n\r\n");
	response->println("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN " "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">");
	response->println("<html xmlns=\"http://www.w3.org/1999/xhtml\">");
	response->println("	<head>");
	response->println("		<title>SWGEmu Web Server Login</title>");
	response->println("		<meta http-equiv=\"content-type\" content=\"text/html;charset=utf-8\" />");
	response->println("		<link rel=\"stylesheet\" type=\"text/css\" href=\"css/style.css\" />");
	response->println("	</head>");
	response->println("	<body>");
	response->println("		<div class=\"login_box\">");
	response->println("			<h1>Account updated.</h1>");
	response->println("			<a href=\"permissions\"> Click here to return </a>");
	response->println("		</div>");
	response->println("	</body>");
	response->println("</html>");
}
开发者ID:JigglyPoofSWG,项目名称:BSS,代码行数:62,代码来源:PermissionsServlet.cpp


注:本文中的PlayerManager::updatePermissionLevel方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。