本文整理汇总了C++中ChatManager类的典型用法代码示例。如果您正苦于以下问题:C++ ChatManager类的具体用法?C++ ChatManager怎么用?C++ ChatManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ChatManager类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addWearableItem
bool CreatureManagerImplementation::addWearableItem(CreatureObject* creature, TangibleObject* clothing) {
if (!clothing->isWearableObject() && !clothing->isWeaponObject())
return false;
ChatManager* chatMan = zoneServer->getChatManager();
SharedTangibleObjectTemplate* tanoData = dynamic_cast<SharedTangibleObjectTemplate*>(clothing->getObjectTemplate());
Vector<uint32>* races = tanoData->getPlayerRaces();
String race = creature->getObjectTemplate()->getFullTemplateString();
if(clothing->isWearableObject()) {
if (!races->contains(race.hashCode())) {
UnicodeString message;
if(creature->getObjectTemplate()->getFullTemplateString().contains("ithorian"))
message = "@player_structure:wear_not_ithorian";
else
message = "@player_structure:wear_no";
chatMan->broadcastMessage(creature, message, clothing->getObjectID(), creature->getMoodID(), 0);
return false;
}
}
ManagedReference<SceneObject*> clothingParent = clothing->getParent();
if (clothingParent == NULL)
return false;
for (int i = 0; i < clothing->getArrangementDescriptorSize(); ++i) {
Vector<String> descriptors = clothing->getArrangementDescriptor(i);
for (int j = 0; j < descriptors.size(); ++j) {
ManagedReference<SceneObject*> slot = creature->getSlottedObject(descriptors.get(j));
if (slot != NULL) {
slot->destroyObjectFromWorld(true);
slot->destroyObjectFromDatabase(true);
}
}
}
creature->transferObject(clothing, 4, false);
creature->doAnimation("pose_proudly");
creature->broadcastObject(clothing, true);
UnicodeString message;
if(clothing->isWeaponObject())
message = "@player_structure:wear_yes_weapon";
else
message = "@player_structure:wear_yes";
chatMan->broadcastMessage(creature, message, clothing->getObjectID(), creature->getMoodID(), 0);
return true;
}
示例2: destroyChatRoom
void GroupObjectImplementation::destroyChatRoom() {
if (chatRoom == NULL)
return;
ManagedReference<ChatRoom*> room = chatRoom->getParent();
ManagedReference<ChatRoom*> parent = room->getParent();
ChatManager* chatManager = server->getZoneServer()->getChatManager();
chatManager->destroyRoom(chatRoom);
chatManager->destroyRoom(room);
chatRoom = NULL;
}
示例3: spatialChat
int LuaAiAgent::spatialChat(lua_State* L) {
ZoneServer* zoneServer = ServerCore::getZoneServer();
if (zoneServer == NULL)
return 0;
ChatManager* chatManager = zoneServer->getChatManager();
if (lua_islightuserdata(L, -1)) {
StringIdChatParameter* message = (StringIdChatParameter*)lua_touserdata(L, -1);
if (realObject != NULL && message != NULL) {
chatManager->broadcastMessage(realObject, *message, 0, 0, 0);
}
} else {
String message = lua_tostring(L, -1);
if (realObject != NULL) {
chatManager->broadcastMessage(realObject, message, 0, 0, 0);
}
}
return 0;
}
示例4: ErrorMessage
//.........这里部分代码省略.........
} else {
lastCreatedCharacter.put(accID, Time());
}
}
} catch (Exception& e) {
error(e.getMessage());
}
} else {
playerManager->updatePermissionLevel(playerCreature, PermissionLevelList::instance()->getLevelNumber("admin"));
}
if (doTutorial)
playerManager->createTutorialBuilding(playerCreature);
else
playerManager->createSkippedTutorialBuilding(playerCreature);
ValidatedPosition* lastValidatedPosition =
ghost->getLastValidatedPosition();
lastValidatedPosition->update(playerCreature);
ghost->setBiography(bio);
ghost->setRaceID(raceID);
ghost->setLanguageID(playerTemplate->getDefaultLanguage());
}
playerCreature->setLevel(1);
ClientCreateCharacterSuccess* msg = new ClientCreateCharacterSuccess(
playerCreature->getObjectID());
playerCreature->sendMessage(msg);
ChatManager* chatManager = zoneServer.get()->getChatManager();
chatManager->addPlayer(playerCreature);
String firstName = playerCreature->getFirstName();
String lastName = playerCreature->getLastName();
try {
StringBuffer query;
query
<< "INSERT INTO `characters_dirty` (`character_oid`, `account_id`, `galaxy_id`, `firstname`, `surname`, `race`, `gender`, `template`)"
<< " VALUES (" << playerCreature->getObjectID() << ","
<< client->getAccountID() << "," << zoneServer.get()->getGalaxyID()
<< "," << "'" << firstName.escapeString() << "','"
<< lastName.escapeString() << "'," << raceID << "," << 0 << ",'"
<< raceFile.escapeString() << "')";
ServerDatabase::instance()->executeStatement(query);
} catch (DatabaseException& e) {
error(e.getMessage());
}
playerManager->addPlayer(playerCreature);
// Copy claimed veteran rewards from player's alt character
uint32 accID = client->getAccountID();
ManagedReference<Account*> playerAccount = playerManager->getAccount(accID);
if (playerAccount != NULL && ghost != NULL) {
// Find the first alt character
ManagedReference<CreatureObject*> altPlayer = NULL;
CharacterList* characters = playerAccount->getCharacterList();
for(int i = 0; i < characters->size(); ++i) {
CharacterListEntry* entry = &characters->get(i);
示例5: tame
//.........这里部分代码省略.........
if (creatureTemplate == NULL)
return;
int templateLevel = creatureTemplate->getLevel();
int maxLevelofPets = player->getSkillMod("tame_level");
if (!player->hasSkill("outdoors_creaturehandler_novice") || (templateLevel > maxLevelofPets)) {
player->sendSystemMessage("@pet/pet_menu:sys_lack_skill"); // You lack the skill to be able to tame that creature.
return;
}
if ((creature->isVicious() && player->getSkillMod("tame_aggro") < 1) || creature->getChanceToTame(player) <= 0) {
player->sendSystemMessage("@pet/pet_menu:sys_lack_skill"); // You lack the skill to be able to tame that creature.
return;
}
ManagedReference<SceneObject*> datapad = player->getSlottedObject("datapad");
if (datapad == NULL)
return;
if (datapad->getContainerObjectsSize() >= datapad->getContainerVolumeLimit()) {
player->sendSystemMessage("@faction_recruiter:datapad_full"); // Your datapad is full. You must first free some space.
return;
}
ManagedReference<PlayerManager*> playerManager = zoneServer->getPlayerManager();
int numberStored = 0;
int maxStoredPets = playerManager->getBaseStoredCreaturePets() + player->getSkillMod("stored_pets");
for (int i = 0; i < datapad->getContainerObjectsSize(); ++i) {
ManagedReference<SceneObject*> object = datapad->getContainerObject(i);
if (object != NULL && object->isPetControlDevice()) {
PetControlDevice* device = cast<PetControlDevice*>( object.get());
if (device->getPetType() == PetManager::CREATUREPET) {
if (++numberStored >= maxStoredPets) {
player->sendSystemMessage("@pet/pet_menu:sys_too_many_stored"); // There are too many pets stored in this container. Release some of them to make room for more.
return;
}
}
}
}
ManagedReference<PlayerObject*> ghost = player->getPlayerObject();
int currentlySpawned = 0;
int spawnedLevel = 0;
int level = creature->getLevel();
int maxPets = player->getSkillMod("keep_creature");
for (int i = 0; i < ghost->getActivePetsSize(); ++i) {
ManagedReference<AiAgent*> object = ghost->getActivePet(i);
if (object != NULL) {
ManagedReference<PetControlDevice*> pcd = object->getControlDevice().get().castTo<PetControlDevice*>();
if (pcd == NULL || pcd->getPetType() != PetManager::CREATUREPET) {
continue;
}
if (++currentlySpawned >= maxPets) {
player->sendSystemMessage("@pet/pet_menu:too_many"); // You can't control any more pets. Store one first
return;
}
spawnedLevel += object->getLevel();
if ((spawnedLevel + level) >= maxLevelofPets) {
player->sendSystemMessage("Taming this pet would exceed your control level ability.");
return;
}
}
}
if (force && !ghost->isPrivileged())
force = false;
ChatManager* chatManager = player->getZoneServer()->getChatManager();
chatManager->broadcastMessage(player, "@hireling/hireling:taming_1"); // Easy.
Locker clocker(creature);
int mask = creature->getPvpStatusBitmask();
creature->setPvpStatusBitmask(0, true);
if (creature->isAiAgent()) {
AiAgent* agent = cast<AiAgent*>(creature);
agent->activateLoad("wait");
}
ManagedReference<TameCreatureTask*> task = new TameCreatureTask(creature, player, mask, force);
player->addPendingTask("tame_pet", task, 8000);
}
示例6: startChatRoom
void GroupObjectImplementation::startChatRoom() {
Reference<CreatureObject*> leader = groupMembers.get(0).get().castTo<CreatureObject*>();
ChatManager* chatManager = server->getZoneServer()->getChatManager();
chatRoom = chatManager->createGroupRoom(getObjectID(), leader);
}
示例7: if
bool FactionRecruiterContainerComponent::transferObject(SceneObject* sceneObject, SceneObject* object, int containmentType, bool notifyClient, bool allowOverflow) {
CoaMessageDataComponent* data = object->getDataObjectComponent()->castTo<CoaMessageDataComponent*>();
if (data == NULL) {
return false;
}
CreatureObject* player = object->getParentRecursively(SceneObjectType::PLAYERCREATURE).get().castTo<CreatureObject*>();
if (player == NULL) {
return false;
}
ZoneServer* zoneServer = player->getZoneServer();
PlayerObject* ghost = player->getPlayerObject();
if (zoneServer == NULL || ghost == NULL) {
return false;
}
if (!sceneObject->isAiAgent()) {
return false;
}
AiAgent* recruiter = cast<AiAgent*>(sceneObject);
String recruiterFaction = recruiter->getFactionString().toLowerCase();
bool hasBadge = ghost->hasBadge(Badge::EVENT_PROJECT_DEAD_EYE_1);
String faction = data->getFaction().toLowerCase();
StringBuffer response;
response << "@encoded_disk/message_fragment:response_event";
if (faction == "rebel") {
response << "reb1_";
} else if (faction == "imperial") {
response << "imp1_";
}
response << recruiterFaction;
ChatManager* chatManager = zoneServer->getChatManager();
if (chatManager == NULL) {
return false;
}
Locker locker(recruiter);
chatManager->broadcastMessage(recruiter,response.toString(), 0, 0, 0);
object->destroyObjectFromWorld(true);
object->destroyObjectFromDatabase();
int credits = System::random(500) + 500;
player->sendSystemMessage("You receive " + String::valueOf(credits) + " credits.");
player->addCashCredits(credits, true);
if (!hasBadge) {
ghost->awardBadge(Badge::EVENT_PROJECT_DEAD_EYE_1);
ghost->increaseFactionStanding(recruiterFaction, 500);
}
return true;
}
示例8: startChatRoom
void GroupObjectImplementation::startChatRoom(CreatureObject* leader) {
ChatManager* chatManager = server->getZoneServer()->getChatManager();
chatRoom = chatManager->createGroupRoom(getObjectID(), leader);
}