本文整理汇总了C++中CreatureObject::sendMessage方法的典型用法代码示例。如果您正苦于以下问题:C++ CreatureObject::sendMessage方法的具体用法?C++ CreatureObject::sendMessage怎么用?C++ CreatureObject::sendMessage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CreatureObject
的用法示例。
在下文中一共展示了CreatureObject::sendMessage方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sendInputBox
void SuiManager::sendInputBox(SceneObject* terminal, SceneObject* player, const String& play, const String& callback, const String& prompt, const String& button) {
if (terminal == NULL)
return;
if (player == NULL || !player->isCreatureObject())
return;
CreatureObject* creature = cast<CreatureObject*>(player);
PlayerObject* playerObject = creature->getPlayerObject();
if (playerObject != NULL) {
ManagedReference<SuiInputBox*> confirmSui = new SuiInputBox(creature, 0x00);
confirmSui->setCallback(new LuaSuiCallback(creature->getZoneServer(), play, callback));
confirmSui->setUsingObject(terminal);
confirmSui->setPromptText(prompt);
confirmSui->setOkButton(true, button);
confirmSui->setOtherButton(false, "");
confirmSui->setCancelButton(false, "");
confirmSui->setForceCloseDistance(32);
creature->sendMessage(confirmSui->generateMessage());
playerObject->addSuiBox(confirmSui);
}
}
示例2: sendMessageBox
void SuiManager::sendMessageBox(SceneObject* usingObject, SceneObject* player, const String& title, const String& text, const String& okButton, const String& screenplay, const String& callback) {
if (usingObject == NULL)
return;
if (player == NULL || !player->isCreatureObject())
return;
CreatureObject* creature = cast<CreatureObject*>(player);
PlayerObject* playerObject = creature->getPlayerObject();
if (playerObject != NULL) {
ManagedReference<SuiMessageBox*> messageBox = new SuiMessageBox(creature, 0x00);
messageBox->setCallback(new LuaSuiCallback(creature->getZoneServer(), screenplay, callback));
messageBox->setPromptTitle(title);
messageBox->setPromptText(text);
messageBox->setUsingObject(usingObject);
messageBox->setOkButton(true, okButton);
messageBox->setCancelButton(true, "@cancel");
messageBox->setForceCloseDistance(32.f);
creature->sendMessage(messageBox->generateMessage());
playerObject->addSuiBox(messageBox);
}
}
示例3: broadcastToOperators
void InstallationObjectImplementation::broadcastToOperators(BasePacket* packet) {
for (int i = 0; i < operatorList.size(); ++i) {
CreatureObject* player = operatorList.get(i);
player->sendMessage(packet->clone());
}
delete packet;
}
示例4: sendListBox
void SuiManager::sendListBox(SceneObject* usingObject, SceneObject* player, const String& title, const String& text, const uint8& numOfButtons, const String& cancelButton, const String& otherButton, const String& okButton, LuaObject& options, const String& screenplay, const String& callback) {
if (usingObject == NULL)
return;
if (player == NULL || !player->isCreatureObject())
return;
CreatureObject* creature = cast<CreatureObject*>(player);
PlayerObject* playerObject = creature->getPlayerObject();
if (playerObject != NULL) {
ManagedReference<SuiListBox*> box = NULL;
switch (numOfButtons) {
case 1:
box = new SuiListBox(creature, 0x00, SuiListBox::HANDLESINGLEBUTTON);
box->setCancelButton(false, "");
box->setOtherButton(false, "");
box->setOkButton(true, okButton);
break;
case 2:
box = new SuiListBox(creature, 0x00, SuiListBox::HANDLETWOBUTTON);
box->setCancelButton(true, cancelButton);
box->setOtherButton(false, "");
box->setOkButton(true, okButton);
break;
case 3:
box = new SuiListBox(creature, 0x00, SuiListBox::HANDLETHREEBUTTON);
box->setCancelButton(true, cancelButton);
box->setOtherButton(true, otherButton);
box->setOkButton(true, okButton);
break;
default:
return;
break;
}
if(options.isValidTable()){
for(int i = 1; i <= options.getTableSize(); ++i){
String optionString = options.getStringAt(i);
box->addMenuItem(optionString);
}
options.pop();
}
box->setCallback(new LuaSuiCallback(creature->getZoneServer(), screenplay, callback));
box->setPromptTitle(title);
box->setPromptText(text);
box->setUsingObject(usingObject);
box->setForceCloseDistance(32.f);
creature->sendMessage(box->generateMessage());
playerObject->addSuiBox(box);
}
}
示例5: broadcastMessage
void GroupObjectImplementation::broadcastMessage(BaseMessage* msg) {
for (int i = 0; i < groupMembers.size(); i++) {
CreatureObject* member = groupMembers.get(i).get().get();
if (member->isPlayerCreature())
member->sendMessage(msg->clone());
}
delete msg;
}
示例6: initializeSession
int DestroyStructureSessionImplementation::initializeSession() {
//TODO: Temporary until CreatureObject* dependency removed.
if (!creatureObject->isPlayerCreature())
return cancelSession();
creatureObject->addActiveSession(SessionFacadeType::DESTROYSTRUCTURE, _this.getReferenceUnsafeStaticCast());
Locker _lock(structureObject, creatureObject);
CreatureObject* player = cast<CreatureObject*>( creatureObject.get());
String no = "\\#FF6347 @player_structure:can_redeed_no_suffix \\#.";
String yes = "\\#32CD32 @player_structure:can_redeed_yes_suffix \\#.";
String redeed = (structureObject->isRedeedable()) ? yes : no;
StringBuffer maint;
maint << "@player_structure:redeed_maintenance \\#" << ((structureObject->isRedeedable()) ? "32CD32 " : "FF6347 ") << structureObject->getSurplusMaintenance() << "/" << structureObject->getRedeedCost() << "\\#.";
StringBuffer entry;
entry << "@player_structure:confirm_destruction_d1 ";
entry << "@player_structure:confirm_destruction_d2 \n\n";
entry << "@player_structure:confirm_destruction_d3a ";
entry << "\\#32CD32 @player_structure:confirm_destruction_d3b \\#. ";
entry << "@player_structure:confirm_destruction_d4 \n";
entry << "@player_structure:redeed_confirmation " << redeed;
StringBuffer cond;
cond << "@player_structure:redeed_condition \\#32CD32 " << (structureObject->getMaxCondition() - structureObject->getConditionDamage()) << "/" << structureObject->getMaxCondition() << "\\#.";
ManagedReference<SuiListBox*> sui = new SuiListBox(player);
sui->setCallback(new DestroyStructureRequestSuiCallback(creatureObject->getZoneServer()));
sui->setCancelButton(true, "@no");
sui->setOkButton(true, "@yes");
sui->setUsingObject(structureObject);
sui->setPromptTitle(structureObject->getDisplayedName());
sui->setPromptText(entry.toString());
sui->addMenuItem("@player_structure:can_redeed_alert " + redeed);
sui->addMenuItem(cond.toString());
sui->addMenuItem(maint.toString());
player->getPlayerObject()->addSuiBox(sui);
player->sendMessage(sui->generateMessage());
return 0;
}
示例7: sendTransferBox
void SuiManager::sendTransferBox(SceneObject* usingObject, SceneObject* player, const String& title, const String& text, LuaObject& optionsAddFrom, LuaObject& optionsAddTo, const String& screenplay, const String& callback) {
if (usingObject == NULL)
return;
if (player == NULL || !player->isCreatureObject())
return;
CreatureObject* creature = cast<CreatureObject*>(player);
PlayerObject* playerObject = creature->getPlayerObject();
if (playerObject != NULL) {
ManagedReference<SuiTransferBox*> box = NULL;
box = new SuiTransferBox(creature, 0x00);
if(optionsAddFrom.isValidTable()){
String optionAddFromTextString = optionsAddFrom.getStringAt(1);
String optionAddFromStartingString = optionsAddFrom.getStringAt(2);
String optionAddFromRatioString = optionsAddFrom.getStringAt(3);
box->addFrom(optionAddFromTextString,
optionAddFromStartingString,
optionAddFromStartingString, optionAddFromRatioString);
optionsAddFrom.pop();
}
if(optionsAddTo.isValidTable()){
String optionAddToTextString = optionsAddTo.getStringAt(1);
String optionAddToStartingString = optionsAddTo.getStringAt(2);
String optionAddToRatioString = optionsAddTo.getStringAt(3);
box->addTo(optionAddToTextString,
optionAddToStartingString,
optionAddToStartingString, optionAddToRatioString);
optionsAddTo.pop();
}
box->setCallback(new LuaSuiCallback(creature->getZoneServer(), screenplay, callback));
box->setPromptTitle(title);
box->setPromptText(text);
box->setUsingObject(usingObject);
box->setForceCloseDistance(32.f);
creature->sendMessage(box->generateMessage());
playerObject->addSuiBox(box);
}
}
示例8: updateMissionLocation
void MissionObjectImplementation::updateMissionLocation() {
if (getMissionObjective() == NULL || getMissionObjective()->getPlayerOwner() == NULL) {
return;
}
CreatureObject* playerCreature = getMissionObjective()->getPlayerOwner().castTo<CreatureObject*>();
ManagedReference<WaypointObject* > waypointToMission = this->waypointToMission;
if (playerCreature != NULL && waypointToMission != NULL) {
MissionObjectDeltaMessage3* dmiso3 = new MissionObjectDeltaMessage3(_this.get());
dmiso3->updateWaypoint(waypointToMission);
dmiso3->close();
playerCreature->sendMessage(dmiso3);
if (playerCreature->isGrouped() && playerCreature->getGroup() != NULL) {
GroupObject* group = playerCreature->getGroup();
group->scheduleUpdateNearestMissionForGroup(playerCreature->getPlanetCRC());
}
}
}
示例9: sendKeypadSui
void SuiManager::sendKeypadSui(SceneObject* keypad, SceneObject* creatureSceneObject, const String& play, const String& callback) {
if (keypad == NULL)
return;
if (creatureSceneObject == NULL || !creatureSceneObject->isCreatureObject())
return;
CreatureObject* creature = cast<CreatureObject*>(creatureSceneObject);
PlayerObject* playerObject = creature->getPlayerObject();
if (playerObject != NULL) {
ManagedReference<SuiKeypadBox*> keypadSui = new SuiKeypadBox(creature, 0x00);
keypadSui->setCallback(new LuaSuiCallback(creature->getZoneServer(), play, callback));
keypadSui->setUsingObject(keypad);
keypadSui->setForceCloseDisabled();
creature->sendMessage(keypadSui->generateMessage());
playerObject->addSuiBox(keypadSui);
}
}
示例10: sendDestroyCode
int DestroyStructureSessionImplementation::sendDestroyCode() {
//TODO: Temporary until CreatureObject* dependency removed.
if (!creatureObject->isPlayerCreature())
return cancelSession();
Locker structureLock(structureObject);
Locker _lock(creatureObject, structureObject);
CreatureObject* player = cast<CreatureObject*>( creatureObject.get());
destroyCode = System::random(899999) + 100000;
String no = "\\#FF6347 @player_structure:will_not_redeed_confirm \\#.";
String yes = "\\#32CD32 @player_structure:will_redeed_confirm \\#.";
String redeed = (structureObject->isRedeedable()) ? yes : no;
StringBuffer entry;
entry << "@player_structure:your_structure_prefix ";
entry << redeed << " @player_structure:will_redeed_suffix \n\n";
entry << "Code: " << destroyCode;
ManagedReference<SuiInputBox*> sui = new SuiInputBox(player);
sui->setCallback(new DestroyStructureCodeSuiCallback(player->getZoneServer()));
sui->setUsingObject(structureObject);
sui->setPromptTitle("@player_structure:confirm_destruction_t"); //Confirm Structure Deletion
sui->setPromptText(entry.toString());
sui->setCancelButton(true, "@cancel");
sui->setMaxInputSize(6);
player->getPlayerObject()->addSuiBox(sui);
player->sendMessage(sui->generateMessage());
return 0;
}
示例11: 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() ){
//.........这里部分代码省略.........
示例12: 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);
}
}
}
}
示例13: updateImageDesign
//.........这里部分代码省略.........
//System::out << h << endl;
if (commitChanges) {
//TODO: set XP Values
int xpGranted = 0; // Minimum Image Design XP granted (base amount).
//if (imageDesignData.mi)
String hairTemplate = imageDesignData.getHairTemplate();
bool statMig = imageDesignData.isStatMigrationRequested();
if (statMig && strongReferenceDesigner->getParentRecursively(SceneObjectType::SALONBUILDING).get().get()
&& strongReferenceDesigner->getParentRecursively(SceneObjectType::SALONBUILDING).get().get() && strongReferenceDesigner != strongReferenceTarget) {
ManagedReference<Facade*> facade = strongReferenceTarget->getActiveSession(SessionFacadeType::MIGRATESTATS);
ManagedReference<MigrateStatsSession*> session = dynamic_cast<MigrateStatsSession*>(facade.get());
if (session != NULL) {
session->migrateStats();
xpGranted = 2000;
}
}
VectorMap<String, float>* bodyAttributes = imageDesignData.getBodyAttributesMap();
VectorMap<String, uint32>* colorAttributes = imageDesignData.getColorAttributesMap();
ImageDesignManager* imageDesignManager = ImageDesignManager::instance();
hairObject = strongReferenceTarget->getSlottedObject("hair").castTo<TangibleObject*>();
if (type == 1) {
String oldCustomization;
if (hairObject != NULL)
hairObject->getCustomizationString(oldCustomization);
hairObject = imageDesignManager->createHairObject(strongReferenceDesigner, strongReferenceTarget, imageDesignData.getHairTemplate(), imageDesignData.getHairCustomizationString());
if (hairObject != NULL)
hairObject->setCustomizationString(oldCustomization);
if (xpGranted < 100)
xpGranted = 100;
}
if (bodyAttributes->size() > 0) {
if (xpGranted < 300)
xpGranted = 300;
for (int i = 0; i < bodyAttributes->size(); ++i) {
VectorMapEntry<String, float>* entry = &bodyAttributes->elementAt(i);
imageDesignManager->updateCustomization(strongReferenceDesigner, entry->getKey(), entry->getValue(), strongReferenceTarget);
}
}
if (colorAttributes->size() > 0) {
if(xpGranted < 100)
xpGranted = 100;
for (int i = 0; i < colorAttributes->size(); ++i) {
VectorMapEntry<String, uint32>* entry = &colorAttributes->elementAt(i);
imageDesignManager->updateColorCustomization(strongReferenceDesigner, entry->getKey(), entry->getValue(), hairObject, strongReferenceTarget);
}
}
imageDesignManager->updateHairObject(strongReferenceTarget, hairObject);
// Add holo emote
String holoemote = imageDesignData.getHoloEmote();
if( !holoemote.isEmpty() ){
PlayerObject* ghost = strongReferenceTarget->getPlayerObject();
ghost->setInstalledHoloEmote( holoemote ); // Also resets number of uses available
strongReferenceTarget->sendSystemMessage("@image_designer:new_holoemote"); //"Congratulations! You have purchased a new Holo-Emote generator. Type '/holoemote help' for instructions."
if(xpGranted < 100)
xpGranted = 100;
}
// Drop the Session for both the designer and the targetCreature;
strongReferenceDesigner->dropActiveSession(SessionFacadeType::IMAGEDESIGN);
strongReferenceTarget->dropActiveSession(SessionFacadeType::IMAGEDESIGN);
// Award XP.
PlayerManager* playerManager = strongReferenceDesigner->getZoneServer()->getPlayerManager();
if (playerManager != NULL && xpGranted > 0) {
if(strongReferenceDesigner == strongReferenceTarget)
xpGranted /= 2;
playerManager->awardExperience(strongReferenceDesigner, "imagedesigner", xpGranted, true);
}
if (idTimeoutEvent != NULL && idTimeoutEvent->isScheduled())
dequeueIdTimeoutEvent();
}
targetObject->sendMessage(message);
}