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


C++ UnicodeString::toString方法代码示例

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


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

示例1: validateName

int NameManager::validateName(CreatureObject* obj) {
	StringId* objectName = obj->getObjectName();
	UnicodeString name = obj->getCustomObjectName();
	int species = obj->getSpecies();

	return validateName(name.toString(), species);
}
开发者ID:Mesagoppinmypants,项目名称:mtgserver,代码行数:7,代码来源:NameManager.cpp

示例2: handleSpatialChat

void ObjectController::handleSpatialChat(SceneObject* object, Message* pack) {
	uint64 sender = pack->parseLong();
	uint64 target = pack->parseLong();

	UnicodeString message;
	pack->parseUnicode(message);

	SceneObject* senderObject = zone->getObject(sender);

	if (senderObject != NULL)
		senderObject->info("says " + message.toString(), true);
}
开发者ID:Chilastra-Reborn,项目名称:Chilastra-source-code,代码行数:12,代码来源:ObjectController.cpp

示例3: handleEnumerateCharacterId

void LoginPacketHandler::handleEnumerateCharacterId(Message* pack) {
	BaseClient* client = (BaseClient*) pack->getClient();
	client->info("received EnumerateCharacterId");

	uint32 characters = pack->parseInt();

	if (loginSession == NULL)
		return;

	if (characters == 0) {
		client->info("no characters found");

		loginSession->setSelectedCharacter(-1);
		return;
	}

	for (int i = 0; i < characters; ++i) {
		UnicodeString name;
		pack->parseUnicode(name);

		uint32 crc = pack->parseInt();
		uint64 oid = pack->parseLong();
		uint32 galaxy = pack->parseInt();
		uint32 serverStatus = pack->parseInt();

		StringBuffer player;
		player << "Character [" << i << "]: [" << name.toString() << "]";

		client->info(player.toString());
		loginSession->addCharacter(oid);
	}

	client->info("please enter character to login... -1 to create a new one", true);

	char characterID[32];
	auto res = fgets(characterID, sizeof(characterID), stdin);

	if (!res)
		return;

	String selected = characterID;
	selected = selected.replaceFirst("\n", "");

	int selectedInt = Integer::valueOf(selected);

	client->info("selected character " + String::valueOf(selectedInt));

	loginSession->setSelectedCharacter(selectedInt);
}
开发者ID:ModTheGalaxy,项目名称:mtgserver,代码行数:49,代码来源:LoginPacketHandler.cpp

示例4: handleChatInstantMessageToClient

void ZonePacketHandler::handleChatInstantMessageToClient(Message* pack) {
	BaseClient* client = (BaseClient*) pack->getClient();

	String game, galaxy, name;
	UnicodeString message;

	pack->parseAscii(game);
	pack->parseAscii(galaxy);
	pack->parseAscii(name);
	pack->parseUnicode(message);

	StringBuffer infoMsg;
	infoMsg << "instant message from [" << name << "] : " << message.toString();
	client->info(infoMsg.toString());
}
开发者ID:ModTheGalaxy,项目名称:mtgserver,代码行数:15,代码来源:ZonePacketHandler.cpp

示例5: handleChatSystemMessage

void ZonePacketHandler::handleChatSystemMessage(Message* pack) {
	BaseClient* client = (BaseClient*) pack->getClient();

	uint8 type = pack->parseByte();

	if (type == 1) {
		UnicodeString message;
		pack->parseUnicode(message);

		StringBuffer systemMessage;
		systemMessage << "SystemMessage:[" << message.toString() << "]";

		client->info(systemMessage.toString());
	}

}
开发者ID:ModTheGalaxy,项目名称:mtgserver,代码行数:16,代码来源:ZonePacketHandler.cpp

示例6: getObject

SceneObject* ObjectManager::getObject(const UnicodeString& customName) {
	Locker _locker(this);

	HashTableIterator<uint64, Reference<SceneObject*> > iterator(objectMap);

	while (iterator.hasNext()) {
		SceneObject* object = iterator.next();

		StringId name = object->getObjectName();
		UnicodeString cust = name.getCustomString();

		if (cust.toString() == customName.toString())
			return object;
	}

	return NULL;
}
开发者ID:Chilastra-Reborn,项目名称:Chilastra-source-code,代码行数:17,代码来源:ObjectManager.cpp

示例7: doSayCommand

void ObjectController::doSayCommand(const UnicodeString& msg) {
	PlayerCreature* object = zone->getSelfPlayer();

	Locker _locker(object);

	StringBuffer full;
	full << "0 " << "0 " << "0 " << "0 " << "0 " << msg.toString();

	BaseMessage* message = new ObjectControllerMessage(object->getObjectID(), 0x23, 0x116);

	message->insertInt(object->getNewActionCount());
	message->insertInt(String("spatialchatinternal").hashCode());
	message->insertLong(0);
	message->insertUnicode(full.toString());

	object->getClient()->sendMessage(message);
}
开发者ID:Chilastra-Reborn,项目名称:Chilastra-source-code,代码行数:17,代码来源:ObjectController.cpp

示例8: logAdminCommand

void ObjectControllerImplementation::logAdminCommand(SceneObject* object, const QueueCommand* queueCommand, uint64 targetID, const UnicodeString& arguments) {
	String name = "unknown";

	Reference<SceneObject*> targetObject = Core::getObjectBroker()->lookUp(targetID).castTo<SceneObject*>();

	if(targetObject != NULL) {
		name = targetObject->getDisplayedName();

		if(targetObject->isPlayerCreature())
			name += "(Player)";
		else
			name += "(NPC)";
	} else {
		name = "(null)";
	}

	StringBuffer logEntry;
	logEntry << object->getDisplayedName() << " used '/" << queueCommand->getQueueCommandName()
								<< "' on " << name << " with params '" << arguments.toString() << "'";
	adminLog.info(logEntry.toString());
}
开发者ID:JigglyPoofSWG,项目名称:BSS,代码行数:21,代码来源:ObjectControllerImplementation.cpp

示例9: data

CreatureAttackData::CreatureAttackData(const UnicodeString& dataString, CombatQueueCommand* base) {
	baseCommand = base;
	fillFromBase();

	StringTokenizer data(dataString.toString());
	data.setDelimeter(";");

	while (data.hasMoreTokens()) {
		String varString;
		data.getStringToken(varString);

		int pos = varString.indexOf("=");

		if (pos == -1)
			continue;

		String key = varString.subString(0,pos);
		String value = varString.subString(pos + 1, varString.length());

		setVariable(key, value);
	}
}
开发者ID:Chilastra-Reborn,项目名称:Core3,代码行数:22,代码来源:CreatureAttackData.cpp

示例10: broadcastMessage

void ChatManagerImplementation::broadcastMessage(CreatureObject* player, const UnicodeString& message,  uint64 target, uint32 moodid, uint32 mood2) {
	Zone* zone = player->getZone();
	PlayerObject* myGhost = NULL;
	bool godMode = false;

	if (zone == NULL)
		return;

	int language = 0;
	String firstName;

	if (player->isPlayerCreature() /*|| !((Player *)player)->isChatMuted() */) {
		CreatureObject* playerCreature = cast<CreatureObject*>(player);
		if (playerCreature)
		{
			firstName = playerCreature->getFirstName().toLowerCase();
			myGhost = playerCreature->getPlayerObject();
		}

		if (myGhost)
			language = myGhost->getLanguageID();
	}

	if (myGhost)
	{
		if (myGhost->hasGodMode())
			godMode = true;
	}

	StringIdChatParameter* param = NULL;

	if (message[0] == '@' && message.indexOf(":") != -1) {
		param = new StringIdChatParameter(message.toString());
	}

	CloseObjectsVector* closeObjects = (CloseObjectsVector*) player->getCloseObjects();

	SortedVector<QuadTreeEntry*> closeEntryObjects(200, 50);

	if (closeObjects != NULL) {
		closeObjects->safeCopyTo(closeEntryObjects);
	} else {
		player->info("Null closeobjects vector in ChatManager::broadcastMessage", true);
		zone->getInRangeObjects(player->getWorldPositionX(), player->getWorldPositionY(), 128, &closeEntryObjects, true);
	}

	float range = defaultSpatialChatDistance;

	float specialRange = spatialChatDistances.get(mood2);
	if (specialRange != -1) {
		range = specialRange;
	}

	try {
		for (int i = 0; i < closeEntryObjects.size(); ++i) {
			SceneObject* object = cast<SceneObject*>(closeEntryObjects.get(i));

			if (player->isInRange(object, range)) {

				//Notify observers that are expecting spatial chat.
				if (object->getObserverCount(ObserverEventType::SPATIALCHATRECEIVED)) {
					ManagedReference<ChatMessage*> chatMessage = new ChatMessage();
					chatMessage->setString(message.toString());

					EXECUTE_TASK_3(object, chatMessage, player, {
						if (player_p == NULL || object_p == NULL)
							return;

						Locker locker(object_p);

						SortedVector<ManagedReference<Observer*> > observers = object_p->getObservers(ObserverEventType::SPATIALCHATRECEIVED);
						for (int oc = 0; oc < observers.size(); oc++) {
							Observer* observer = observers.get(oc);
							Locker clocker(observer, object_p);
							if (observer->notifyObserverEvent(ObserverEventType::SPATIALCHATRECEIVED, object_p, chatMessage_p, player_p->getObjectID()) == 1)
								object_p->dropObserver(ObserverEventType::SPATIALCHATRECEIVED, observer);
						}
					});
				}

				if (object->isPlayerCreature()) {
					CreatureObject* creature = cast<CreatureObject*>(object);
					PlayerObject* ghost = creature->getPlayerObject();

					if (ghost == NULL)
						continue;

					if (!ghost->isIgnoring(firstName) || godMode) {
						SpatialChat* cmsg = NULL;

						if (param == NULL) {
							cmsg = new SpatialChat(player->getObjectID(), creature->getObjectID(), message, target, moodid, mood2, language);
						} else {
							cmsg = new SpatialChat(player->getObjectID(), creature->getObjectID(), *param, target, moodid, mood2);
						}

						creature->sendMessage(cmsg);
					}
				}
				else if( object->isPet() ){
//.........这里部分代码省略.........
开发者ID:Mesagoppinmypants,项目名称:mtgserver,代码行数:101,代码来源:ChatManagerImplementation.cpp

示例11: handleSocialInternalMessage

void ChatManagerImplementation::handleSocialInternalMessage(CreatureObject* sender, const UnicodeString& arguments) {
	if (sender->isPlayerCreature()) {
		ManagedReference<PlayerObject*> senderGhost = sender->getPlayerObject();

		if (senderGhost == NULL)
			return;

		if (senderGhost->isMuted()) {
			String reason = senderGhost->getMutedReason();

			if (reason != "")
				sender->sendSystemMessage("Your chat abilities are currently disabled by Customer Support for '" + reason + "'.");
			else
				sender->sendSystemMessage("Your chat abilities are currently disabled by Customer Support.");

			return;
		}
	}

	Zone* zone = sender->getZone();

	if (zone == NULL)
		return;

	StringTokenizer tokenizer(arguments.toString());
	uint64 targetid;
	uint32 emoteid, unkint, unkint2;

	try {
		targetid = tokenizer.getLongToken();
		emoteid = tokenizer.getIntToken();
		unkint = tokenizer.getIntToken();
		unkint2 = tokenizer.getIntToken();
	} catch (const Exception& e) {
		return;
	}

	//bool readlock = !zone->isLockedByCurrentThread();

	bool showtext = true;

	if (unkint2 == 0)
		showtext = false;

	String firstName;

	if (sender->isPlayerCreature())
		firstName = (cast<CreatureObject*>(sender))->getFirstName().toLowerCase();

	CloseObjectsVector* vec = (CloseObjectsVector*) sender->getCloseObjects();

	SortedVector<QuadTreeEntry* > closeEntryObjects(200, 50);

	if (vec != NULL) {
		vec->safeCopyTo(closeEntryObjects);
	} else {
		sender->info("Null closeobjects vector in ChatManager::handleSocialInternalMessage", true);
		zone->getInRangeObjects(sender->getWorldPositionX(), sender->getWorldPositionX(), 128, &closeEntryObjects, true);
	}

	float range = defaultSpatialChatDistance;

	for (int i = 0; i < closeEntryObjects.size(); ++i) {
		SceneObject* object = cast<SceneObject*>(closeEntryObjects.get(i));

		if (object->isPlayerCreature()) {
			CreatureObject* creature = cast<CreatureObject*>(object);

			Reference<PlayerObject*> ghost = creature->getSlottedObject("ghost").castTo<PlayerObject*>();

			if (ghost == NULL)
				continue;

			if (!ghost->isIgnoring(firstName) && creature->isInRange(sender, range)) {
				Emote* emsg = new Emote(creature, sender, targetid, emoteid, showtext);
				creature->sendMessage(emsg);

			}
		}
	}

}
开发者ID:Mesagoppinmypants,项目名称:mtgserver,代码行数:82,代码来源:ChatManagerImplementation.cpp

示例12: activateCommand

float ObjectControllerImplementation::activateCommand(CreatureObject* object, unsigned int actionCRC, unsigned int actionCount, uint64 targetID, const UnicodeString& arguments) {
	// Pre: object is wlocked
	// Post: object is wlocked

	QueueCommand* queueCommand = getQueueCommand(actionCRC);

	float durationTime = 0.f;

	if (queueCommand == NULL) {
		StringBuffer msg;
		msg << "unregistered queue command 0x" << hex << actionCRC << " arguments: " << arguments.toString();
		object->error(msg.toString());

		return 0.f;
	}

	/*StringBuffer infoMsg;
	infoMsg << "activating queue command 0x" << hex << actionCRC << " " << queueCommand->getQueueCommandName() << " arguments='" << arguments.toString() << "'";
	object->info(infoMsg.toString(), true);*/

	String characterAbility = queueCommand->getCharacterAbility();

	if (characterAbility.length() > 1) {
		object->info("activating characterAbility " + characterAbility);

		if (object->isPlayerCreature()) {
			Reference<PlayerObject*> playerObject =  object->getSlottedObject("ghost").castTo<PlayerObject*>();

			if (!playerObject->hasAbility(characterAbility)) {
				object->clearQueueAction(actionCount, 0, 2);

				return 0.f;
			}
		}
	}

	uint32 commandGroup = queueCommand->getCommandGroup();

	if (commandGroup != 0) {
		if (commandGroup == 0xe1c9a54a && queueCommand->getQueueCommandName() != "attack") {
			if (!object->isAiAgent()) {
				object->clearQueueAction(actionCount, 0, 2);

				return 0.f;
			}
		}
	}


	if(queueCommand->requiresAdmin()) {

		try {

			if(object->isPlayerCreature()) {
				Reference<PlayerObject*> ghost =  object->getSlottedObject("ghost").castTo<PlayerObject*>();
				if (ghost == NULL || !ghost->isPrivileged() || !ghost->hasAbility(queueCommand->getQueueCommandName())) {

					StringBuffer logEntry;
					logEntry << object->getDisplayedName() << " attempted to use the '/" << queueCommand->getQueueCommandName()
							<< "' command without permissions";
					adminLog.warning(logEntry.toString());
					object->sendSystemMessage("@error_message:insufficient_permissions");
					object->clearQueueAction(actionCount, 0, 2);
					return 0.f;
				}
			} else {
				return 0.f;
			}


			String name = "unknown";

			Reference<SceneObject*> targetObject = Core::getObjectBroker()->lookUp(targetID).castTo<SceneObject*>();
			if(targetObject != NULL) {
				name = targetObject->getDisplayedName();
				if(targetObject->isPlayerCreature())
					name += "(Player)";
				else
					name += "(NPC)";
			} else {
				name = "(null)";
			}

			StringBuffer logEntry;
			logEntry << object->getDisplayedName() << " used '/" << queueCommand->getQueueCommandName()
					<< "' on " << name << " with params '" << arguments.toString() << "'";
			adminLog.info(logEntry.toString());
		} catch (Exception& e) {
			Logger::error("Unhandled Exception logging admin commands" + e.getMessage());
		}
	}

	/// Add Skillmods if any
	for(int i = 0; i < queueCommand->getSkillModSize(); ++i) {
		String skillMod;
		int value = queueCommand->getSkillMod(i, skillMod);
		object->addSkillMod(SkillModManager::ABILITYBONUS, skillMod, value, false);
	}


//.........这里部分代码省略.........
开发者ID:Chilastra-Reborn,项目名称:Chilastra-source-code,代码行数:101,代码来源:ObjectControllerImplementation.cpp

示例13: activateCommand

float ObjectControllerImplementation::activateCommand(CreatureObject* object, unsigned int actionCRC, unsigned int actionCount, uint64 targetID, const UnicodeString& arguments) {
	// Pre: object is wlocked
	// Post: object is wlocked

	QueueCommand* queueCommand = getQueueCommand(actionCRC);

	float durationTime = 0.f;

	if (queueCommand == NULL) {
		StringBuffer msg;
		msg << "unregistered queue command 0x" << hex << actionCRC << " arguments: " << arguments.toString();
		object->error(msg.toString());

		return 0.f;
	}

	/*StringBuffer infoMsg;
	infoMsg << "activating queue command 0x" << hex << actionCRC << " " << queueCommand->getQueueCommandName() << " arguments='" << arguments.toString() << "'";
	object->info(infoMsg.toString(), true);*/

	const String& characterAbility = queueCommand->getCharacterAbility();

	if (characterAbility.length() > 1) {
		object->info("activating characterAbility " + characterAbility);

		if (object->isPlayerCreature()) {
			Reference<PlayerObject*> playerObject =  object->getSlottedObject("ghost").castTo<PlayerObject*>();

			if (!playerObject->hasAbility(characterAbility)) {
				object->clearQueueAction(actionCount, 0, 2);

				return 0.f;
			}
		}
	}

	uint32 commandGroup = queueCommand->getCommandGroup();

	if (commandGroup != 0) {
		if (commandGroup == 0xe1c9a54a && queueCommand->getQueueCommandName() != "attack") {
			if (!object->isAiAgent()) {
				object->clearQueueAction(actionCount, 0, 2);

				return 0.f;
			}
		}
	}

	if (queueCommand->requiresAdmin()) {
		try {
			if(object->isPlayerCreature()) {
				Reference<PlayerObject*> ghost =  object->getSlottedObject("ghost").castTo<PlayerObject*>();

				if (ghost == NULL || !ghost->hasGodMode() || !ghost->hasAbility(queueCommand->getQueueCommandName())) {
					StringBuffer logEntry;
					logEntry << object->getDisplayedName() << " attempted to use the '/" << queueCommand->getQueueCommandName()
							<< "' command without permissions";
					adminLog.warning(logEntry.toString());
					object->sendSystemMessage("@error_message:insufficient_permissions");
					object->clearQueueAction(actionCount, 0, 2);
					return 0.f;
				}
			} else {
				return 0.f;
			}

			logAdminCommand(object, queueCommand, targetID, arguments);
		} catch (Exception& e) {
			Logger::error("Unhandled Exception logging admin commands" + e.getMessage());
		}
	}

	/// Add Skillmods if any
	for(int i = 0; i < queueCommand->getSkillModSize(); ++i) {
		String skillMod;
		int value = queueCommand->getSkillMod(i, skillMod);
		object->addSkillMod(SkillModManager::ABILITYBONUS, skillMod, value, false);
	}

	int errorNumber = queueCommand->doQueueCommand(object, targetID, arguments);

	/// Remove Skillmods if any
	for(int i = 0; i < queueCommand->getSkillModSize(); ++i) {
		String skillMod;
		int value = queueCommand->getSkillMod(i, skillMod);
		object->addSkillMod(SkillModManager::ABILITYBONUS, skillMod, -value, false);
	}

	//onFail onComplete must clear the action from client queue
	if (errorNumber != QueueCommand::SUCCESS)
		queueCommand->onFail(actionCount, object, errorNumber);
	else {
		if (queueCommand->getDefaultPriority() != QueueCommand::IMMEDIATE)
			durationTime = queueCommand->getCommandDuration(object, arguments);

		queueCommand->onComplete(actionCount, object, durationTime);
	}

	return durationTime;
}
开发者ID:JigglyPoofSWG,项目名称:BSS,代码行数:100,代码来源:ObjectControllerImplementation.cpp


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