本文整理汇总了C++中StringIdChatParameter::setStringId方法的典型用法代码示例。如果您正苦于以下问题:C++ StringIdChatParameter::setStringId方法的具体用法?C++ StringIdChatParameter::setStringId怎么用?C++ StringIdChatParameter::setStringId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringIdChatParameter
的用法示例。
在下文中一共展示了StringIdChatParameter::setStringId方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: killPet
void PetManagerImplementation::killPet(TangibleObject* attacker, AiAgent* pet) {
StringIdChatParameter stringId;
if (attacker->isPlayerCreature()) {
stringId.setStringId("base_player", "prose_target_dead");
stringId.setTT(pet->getObjectID());
(cast<CreatureObject*>(attacker))->sendSystemMessage(stringId);
}
pet->clearDots();
pet->setCurrentSpeed(0);
pet->clearCombatState(true);
pet->setPosture(CreaturePosture::DEAD, true);
pet->updateLocomotion();
pet->setOblivious();
pet->storeFollowObject();
pet->updateTimeOfDeath();
Reference<AiAgent*> petAgent = pet;
EXECUTE_TASK_1(petAgent, {
Locker locker(petAgent_p);
petAgent_p->clearBuffs(false);
});
示例2: killPet
void PetManagerImplementation::killPet(TangibleObject* attacker, AiAgent* pet) {
// TODO REMOVE AFTER TESTING
bool attackerIsAdmin = false;
// END REMOVE
StringIdChatParameter stringId;
if (attacker->isPlayerCreature()) {
stringId.setStringId("base_player", "prose_target_dead");
stringId.setTT(pet->getObjectID());
(cast<CreatureObject*>(attacker))->sendSystemMessage(stringId);
// TODO REMOVE AFTER TESTING
//ManagedReference<PlayerObject*> ghost = (cast<CreatureObject*>(attacker))->getPlayerObject();
//if (ghost != NULL && ghost->isPrivileged())
// attackerIsAdmin = true;
// END REMOVE
}
pet->setCurrentSpeed(0);
pet->clearCombatState(true);
pet->setPosture(CreaturePosture::DEAD, true);
pet->updateLocomotion();
pet->updateTimeOfDeath();
pet->clearBuffs(false);
ManagedReference<PetControlDevice*> petControlDevice = pet->getControlDevice().get().castTo<PetControlDevice*>();
if (petControlDevice != NULL) {
if (petControlDevice->getPetType() == FACTIONPET) {
ManagedReference<CreatureObject*> owner = zoneServer->getObject(pet->getCreatureLinkID()).castTo<CreatureObject*>();
if (owner != NULL)
petControlDevice->storeObject(owner, true);
petControlDevice->destroyObjectFromWorld(true);
petControlDevice->destroyObjectFromDatabase(true);
} else if ( (!attacker->isPlayerCreature() && !attacker->isPet()) || attackerIsAdmin) { // TODO REMOVE attackerIsAdmin AFTER TESTING
if (pet->getCooldownTimerMap() != NULL && pet->getCooldownTimerMap()->isPast("vitalityLossCooldown")) {
petControlDevice->setVitality(petControlDevice->getVitality() - 2);
pet->getCooldownTimerMap()->updateToCurrentAndAddMili("vitalityLossCooldown", 300000);
}
}
}
pet->notifyObjectKillObservers(attacker);
}
示例3: makeLeader
void GroupManager::makeLeader(GroupObject* group, CreatureObject* player, CreatureObject* newLeader) {
// Pre: player locked
// Post: player locked
player->unlock();
try {
group->wlock();
if (group->getLeader() != player) {
player->sendSystemMessage("@group:must_be_leader");
group->unlock();
player->wlock();
return;
}
if (!group->hasMember(newLeader) || !newLeader->isPlayerCreature()) {
group->unlock();
player->wlock();
return;
}
group->makeLeader(newLeader);
String firstNameLeader;
firstNameLeader = "[Offline player]";
if (newLeader->isPlayerCreature()) {
CreatureObject* playerLeader = cast<CreatureObject*>( newLeader);
if (playerLeader->isOnline())
firstNameLeader= playerLeader->getFirstName();
}
StringIdChatParameter message;
message.setStringId("group", "new_leader"); // %TU is now the group leader.
message.setTU(newLeader);
for (int i = 0; i < group->getGroupSize(); i++) {
Reference<CreatureObject*> play = ( group->getGroupMember(i)).castTo<CreatureObject*>();
if (play->isPlayerCreature())
play->sendSystemMessage(message);
}
group->unlock();
} catch (...) {
group->unlock();
player->wlock();
throw;
}
player->wlock();
}
示例4: performVendorBark
void VendorDataComponent::performVendorBark(SceneObject* target) {
if (isOnStrike()) {
return;
}
ManagedReference<CreatureObject*> vendor = cast<CreatureObject*>(parent.get().get());
if (vendor == NULL)
return;
ManagedReference<CreatureObject*> player = cast<CreatureObject*>(target);
if (player == NULL || !player->isPlayerCreature())
return;
resetLastBark();
addBarkTarget(target);
EXECUTE_TASK_2(vendor, player, {
Locker locker(vendor_p);
VendorDataComponent* data = cast<VendorDataComponent*>(vendor_p->getDataObjectComponent()->get());
if (data == NULL)
return;
vendor_p->faceObject(player_p);
vendor_p->updateDirection(Math::deg2rad(vendor_p->getDirectionAngle()));
SpatialChat* chatMessage = NULL;
String barkMessage = data->getAdPhrase();
if (barkMessage.beginsWith("@")) {
StringIdChatParameter message;
message.setStringId(barkMessage);
message.setTT(player_p->getObjectID());
chatMessage = new SpatialChat(vendor_p->getObjectID(), player_p->getObjectID(), message, player_p->getObjectID(), Races::getMoodID(data->getAdMood()), 0);
} else {
UnicodeString uniMessage(barkMessage);
chatMessage = new SpatialChat(vendor_p->getObjectID(), player_p->getObjectID(), uniMessage, player_p->getObjectID(), Races::getMoodID(data->getAdMood()), 0, 0);
}
vendor_p->broadcastMessage(chatMessage, true);
vendor_p->doAnimation(data->getAdAnimation());
Reference<VendorReturnToPositionTask*> returnTask = new VendorReturnToPositionTask(vendor_p, data->getOriginalDirection());
vendor_p->addPendingTask("vendorreturn", returnTask, 3000);
});
示例5: handleSliceEffectiveness
void SlicingSessionImplementation::handleSliceEffectiveness(uint8 percent) {
ManagedReference<CreatureObject*> player = this->player.get();
ManagedReference<TangibleObject*> tangibleObject = this->tangibleObject.get();
if (tangibleObject == NULL || player == NULL || !tangibleObject->isArmorObject())
return;
ArmorObject* armor = cast<ArmorObject*>( tangibleObject.get());
Locker locker(armor);
armor->setEffectivenessSlice(percent / 100.f);
armor->setSliced(true);
StringIdChatParameter params;
params.setDI(percent);
params.setStringId("@slicing/slicing:eff_mod");
player->sendSystemMessage(params);
}
示例6: handleSliceSpeed
void SlicingSessionImplementation::handleSliceSpeed(uint8 percent) {
ManagedReference<CreatureObject*> player = this->player.get();
ManagedReference<TangibleObject*> tangibleObject = this->tangibleObject.get();
if (tangibleObject == NULL || player == NULL || !tangibleObject->isWeaponObject())
return;
WeaponObject* weap = cast<WeaponObject*>( tangibleObject.get());
Locker locker(weap);
//TODO: Check for Weapon Powerups and Remove it before the Slice
weap->setSpeedSlice(percent / 100.f);
weap->setSliced(true);
StringIdChatParameter params;
params.setDI(percent);
params.setStringId("@slicing/slicing:spd_mod");
player->sendSystemMessage(params);
}
示例7: awardSkill
bool SkillManager::awardSkill(const String& skillName, CreatureObject* creature, bool notifyClient, bool awardRequiredSkills, bool noXpRequired) {
Skill* skill = skillMap.get(skillName.hashCode());
if (skill == NULL)
return false;
Locker locker(creature);
//Check for required skills.
Vector<String>* requiredSkills = skill->getSkillsRequired();
for (int i = 0; i < requiredSkills->size(); ++i) {
String requiredSkillName = requiredSkills->get(i);
Skill* requiredSkill = skillMap.get(requiredSkillName.hashCode());
if (requiredSkill == NULL)
continue;
if (awardRequiredSkills)
awardSkill(requiredSkillName, creature, notifyClient, awardRequiredSkills, noXpRequired);
if (!creature->hasSkill(requiredSkillName))
return false;
}
if (!canLearnSkill(skillName, creature, noXpRequired)) {
return false;
}
//If they already have the skill, then return true.
if (creature->hasSkill(skill->getSkillName()))
return true;
ManagedReference<PlayerObject*> ghost = creature->getPlayerObject();
if (ghost != NULL) {
//Withdraw skill points.
ghost->addSkillPoints(-skill->getSkillPointsRequired());
//Witdraw experience.
if (!noXpRequired) {
ghost->addExperience(skill->getXpType(), -skill->getXpCost(), true);
}
creature->addSkill(skill, notifyClient);
//Add skill modifiers
VectorMap<String, int>* skillModifiers = skill->getSkillModifiers();
for (int i = 0; i < skillModifiers->size(); ++i) {
VectorMapEntry<String, int>* entry = &skillModifiers->elementAt(i);
creature->addSkillMod(SkillModManager::SKILLBOX, entry->getKey(), entry->getValue(), notifyClient);
}
//Add abilities
Vector<String>* abilityNames = skill->getAbilities();
addAbilities(ghost, *abilityNames, notifyClient);
if (skill->isGodOnly()) {
for (int i = 0; i < abilityNames->size(); ++i) {
String ability = abilityNames->get(i);
StringIdChatParameter params;
params.setTU(ability);
params.setStringId("ui", "skill_command_acquired_prose");
creature->sendSystemMessage(params);
}
}
//Add draft schematic groups
Vector<String>* schematicsGranted = skill->getSchematicsGranted();
SchematicMap::instance()->addSchematics(ghost, *schematicsGranted, notifyClient);
//Update maximum experience.
updateXpLimits(ghost);
// Update Force Power Max.
ghost->setForcePowerMax(creature->getSkillMod("jedi_force_power_max"), true);
if (skillName.contains("master")) {
ManagedReference<PlayerManager*> playerManager = creature->getZoneServer()->getPlayerManager();
if (playerManager != NULL) {
const Badge* badge = BadgeList::instance()->get(skillName);
if (badge == NULL && skillName == "crafting_shipwright_master") {
badge = BadgeList::instance()->get("crafting_shipwright");
}
if (badge != NULL) {
playerManager->awardBadge(ghost, badge);
}
}
}
SkillList* list = creature->getSkillList();
int totalSkillPointsWasted = 250;
for (int i = 0; i < list->size(); ++i) {
Skill* skill = list->get(i);
//.........这里部分代码省略.........
示例8: handleCharacterBuilderSelectItem
//.........这里部分代码省略.........
} else if(templatePath == "crafting_apron_chef") {
modName = "(Chef)";
apron->addSkillMod(SkillModManager::WEARABLE, "food_assembly", 25);
apron->addSkillMod(SkillModManager::WEARABLE, "food_experimentation", 25);
} else if(templatePath == "crafting_apron_architect") {
modName = "(Architect)";
apron->addSkillMod(SkillModManager::WEARABLE, "structure_assembly", 25);
apron->addSkillMod(SkillModManager::WEARABLE, "structure_experimentation", 25);
apron->addSkillMod(SkillModManager::WEARABLE, "structure_complexity", 25);
} else if(templatePath == "crafting_apron_droid_engineer") {
modName = "(Droid Engineer)";
apron->addSkillMod(SkillModManager::WEARABLE, "droid_assembly", 25);
apron->addSkillMod(SkillModManager::WEARABLE, "droid_experimentation", 25);
apron->addSkillMod(SkillModManager::WEARABLE, "droid_complexity", 25);
} else if(templatePath == "crafting_apron_doctor") {
modName = "(Doctor)";
apron->addSkillMod(SkillModManager::WEARABLE, "medicine_assembly", 25);
apron->addSkillMod(SkillModManager::WEARABLE, "medicine_experimentation", 25);
} else if(templatePath == "crafting_apron_combat_medic") {
modName = "(Combat Medic)";
apron->addSkillMod(SkillModManager::WEARABLE, "combat_medicine_assembly", 25);
apron->addSkillMod(SkillModManager::WEARABLE, "combat_medicine_experimentation", 25);
}
UnicodeString apronName = "Crafting Apron " + modName;
apron->setCustomObjectName(apronName, false);
}
ManagedReference<SceneObject*> inventory = player->getSlottedObject("inventory");
apron->sendTo(player, true);
inventory->transferObject(apron, -1, true);
StringIdChatParameter stringId;
stringId.setStringId("@faction_perk:bonus_base_name"); //You received a: %TO.
stringId.setTO(apron);
player->sendSystemMessage(stringId);
} else if (templatePath == "enhance_character") {
ManagedReference<SceneObject*> scob = cbSui->getUsingObject();
if (scob != NULL) {
if (scob->getGameObjectType() == SceneObjectType::CHARACTERBUILDERTERMINAL) {
CharacterBuilderTerminal* bluefrog = cast<CharacterBuilderTerminal*>( scob.get());
bluefrog->enhanceCharacter(player);
}
}
} else if (templatePath == "credits") {
player->addCashCredits(50000, true);
player->sendSystemMessage("You have received 50.000 Credits");
} else if (templatePath == "faction_rebel") {
ghost->increaseFactionStanding("rebel", 100000);
} else if (templatePath == "faction_imperial") {
ghost->increaseFactionStanding("imperial", 100000);
} else if (templatePath == "language") {
ManagedReference<SceneObject*> scob = cbSui->getUsingObject();
if (scob != NULL) {
示例9: setTrainingCommand
void PetControlDeviceImplementation::setTrainingCommand( unsigned int commandID ){
// we set to 0 to flag completion so skip all this then.
if (commandID == 0) {
trainingCommand = 0;
return;
}
ManagedReference<TangibleObject*> controlledObject = this->controlledObject.get();
if (controlledObject == NULL || !controlledObject->isAiAgent())
return;
AiAgent* pet = cast<AiAgent*>(controlledObject.get());
if( pet == NULL )
return;
ManagedReference<CreatureObject*> owner = pet->getLinkedCreature().get();
if (owner == NULL || !owner->isPlayerCreature())
return;
if( petType == PetManager::DROIDPET) {
ManagedReference<DroidObject*> droid = this->controlledObject.get().castTo<DroidObject*>();
if (droid == NULL)
return;
// Check power on droids
if( !droid->hasPower() ){
droid->showFlyText("npc_reaction/flytext","low_power", 204, 0, 0); // "*Low Power*"
return;
}
if(((commandID == PetManager::ATTACK || commandID == PetManager::GUARD) && !droid->isCombatDroid()) ||
(commandID == PetManager::RANGED_ATTACK && (!droid->isCombatDroid() || !droid->hasRangedWeapon())) ||
(commandID == PetManager::RECHARGEOTHER && !droid->isPowerDroid()) ||
(commandID == PetManager::TRANSFER) ||
(commandID == PetManager::SPECIAL_ATTACK1) ||
(commandID == PetManager::SPECIAL_ATTACK2) ||
(commandID == PetManager::TRICK1) ||
(commandID == PetManager::TRICK2)){
return;
}
}
else if(petType == PetManager::CREATUREPET){
if(((commandID == PetManager::ATTACK || commandID == PetManager::FOLLOW || commandID == PetManager::STORE) && !owner->hasSkill("outdoors_creaturehandler_novice") ) ||
(commandID == PetManager::STAY && !owner->hasSkill("outdoors_creaturehandler_training_01")) ||
(commandID == PetManager::GUARD && !owner->hasSkill("outdoors_creaturehandler_training_02")) ||
(commandID == PetManager::FRIEND && !owner->hasSkill("outdoors_creaturehandler_support_03")) ||
((commandID == PetManager::PATROL || commandID == PetManager::GETPATROLPOINT || commandID == PetManager::CLEARPATROLPOINTS) && !owner->hasSkill("outdoors_creaturehandler_training_03")) ||
((commandID == PetManager::FORMATION1 || commandID == PetManager::FORMATION2) && !owner->hasSkill("outdoors_creaturehandler_training_04")) ||
(commandID == PetManager::TRANSFER && !owner->hasSkill("outdoors_creaturehandler_master")) ||
(commandID == PetManager::TRICK1 && !owner->hasSkill("outdoors_creaturehandler_healing_01")) ||
(commandID == PetManager::TRICK2 && !owner->hasSkill("outdoors_creaturehandler_healing_03")) ||
(commandID == PetManager::GROUP && !owner->hasSkill("outdoors_creaturehandler_support_01")) ||
(commandID == PetManager::SPECIAL_ATTACK1 && (!owner->hasSkill("outdoors_creaturehandler_taming_03") || !pet->hasSpecialAttack(1))) ||
(commandID == PetManager::SPECIAL_ATTACK2 && (!owner->hasSkill("outdoors_creaturehandler_taming_04") || !pet->hasSpecialAttack(2))) ||
(commandID == PetManager::RANGED_ATTACK && (!owner->hasSkill("outdoors_creaturehandler_master") || !pet->hasRangedWeapon())) ||
(commandID == PetManager::FOLLOWOTHER && !owner->hasSkill("outdoors_creaturehandler_support_02")) ||
(commandID == PetManager::RECHARGEOTHER))
return;
}
else if(petType == PetManager::FACTIONPET){
if(commandID == PetManager::RECHARGEOTHER ||
(commandID == PetManager::TRANSFER) ||
(commandID == PetManager::SPECIAL_ATTACK1) ||
(commandID == PetManager::SPECIAL_ATTACK2) ||
(commandID == PetManager::TRICK1) ||
(commandID == PetManager::TRICK2))
return;
}
/** Check for converse and if so, get its personalityStf**/
if (pet->getOptionsBitmask() & OptionBitmask::CONVERSE) {
String stf = pet->getPersonalityStf();
StringBuffer message;
message << stf << ":start_convo_4";
StringIdChatParameter chat;
chat.setStringId(message.toString());
pet->getZoneServer()->getChatManager()->broadcastChatMessage(pet,chat,0,0,0);
} else {
pet->showFlyText("npc_reaction/flytext","alert", 204, 0, 0); // "?"
}
trainingCommand = commandID;
}
示例10: handleCommandTraining
bool PetManagerImplementation::handleCommandTraining(CreatureObject* speaker, AiAgent* pet, const String& message){
if( speaker == NULL || pet == NULL )
return false;
if( message.isEmpty() )
return false;
ManagedWeakReference< CreatureObject*> linkedCreature = pet->getLinkedCreature();
if( linkedCreature == NULL )
return false;
// Only owner may train
if( linkedCreature != speaker)
return false;
ManagedReference<PetControlDevice*> pcd = pet->getControlDevice().get().castTo<PetControlDevice*>();
if( pcd == NULL )
return false;
if( pcd->hasTrainedCommandString(message) ){
if (pet->getOptionsBitmask() & OptionBitmask::CONVERSE) {
String stf = pet->getPersonalityStf();
StringBuffer message;
message << stf << ":confused";
StringIdChatParameter chat;
chat.setStringId(message.toString());
pet->getZoneServer()->getChatManager()->broadcastMessage(pet,chat,0,0,0);
} else {
pet->showFlyText("npc_reaction/flytext","confused", 204, 0, 0); // "?"
}
return true;
}
Locker locker(pcd);
unsigned int trainingCommand = pcd->getTrainingCommand();
int petType = pcd->getPetType();
// Train command
if (petType == CREATUREPET) {
bool alreadyTrained = pcd->hasTrainedCommand(trainingCommand);
if (!alreadyTrained) {
bool success = false;
int skill = speaker->getSkillMod("tame_level");
int roll = System::random(skill + 30);
if (skill > roll)
success = true;
if (!success) {
pet->showFlyText("npc_reaction/flytext","confused", 204, 0, 0); // "?"
speaker->sendSystemMessage("@pet/pet_menu:pet_nolearn"); // Your pet doesn't seem to understand you.
return true;
}
}
// Success
pcd->addTrainedCommand( trainingCommand, message );
pet->showFlyText("npc_reaction/flytext","threaten", 204, 0, 0); // "?"
speaker->sendSystemMessage("@pet/pet_menu:pet_learn"); // You teach your pet a new command.
if (!alreadyTrained) {
CreatureTemplate* creatureTemplate = pet->getCreatureTemplate();
if (creatureTemplate == NULL)
return true;
PlayerManager* playerManager = zoneServer->getPlayerManager();
if (pet->hasPetDeed()) {
playerManager->awardExperience(speaker, "creaturehandler", 100);
} else {
playerManager->awardExperience(speaker, "creaturehandler", 10 * creatureTemplate->getLevel());
}
}
}
else{
pcd->addTrainedCommand( trainingCommand, message );
if (pet->getOptionsBitmask() & OptionBitmask::CONVERSE) {
String stf = pet->getPersonalityStf();
StringBuffer message;
message << stf << ":end_convo";
StringIdChatParameter chat;
chat.setStringId(message.toString());
pet->getZoneServer()->getChatManager()->broadcastMessage(pet,chat,0,0,0);
} else {
pet->showFlyText("npc_reaction/flytext","threaten", 204, 0, 0); // "?"
speaker->sendSystemMessage("@pet/pet_menu:pet_learn"); // You teach your pet a new command.
}
}
// No renaming of faction pets
if (petType == FACTIONPET)
return true;
// no renaming of converse style droids with personalities installed.
if ( (pet->getOptionsBitmask() & OptionBitmask::CONVERSE) && petType == DROIDPET )
//.........这里部分代码省略.........
示例11: inviteToGroup
void GroupManager::inviteToGroup(CreatureObject* leader, CreatureObject* target) {
// Pre: leader locked
// Post: player invited to leader's group, leader locked
Locker clocker(target, leader);
if (target == leader) {
leader->sendSystemMessage("@group:invite_no_target_self");
return;
}
if (leader->isGrouped()) {
ManagedReference<GroupObject*> group = leader->getGroup();
if (playerIsInvitingOwnPet(leader, target)) {
if (!target->isInRange(leader, 120)) {
return;
}
}
else if (group->getLeader() != leader) {
leader->sendSystemMessage("@group:must_be_leader");
return;
}
// can't invite if the group is full
if (group->getGroupSize() >= 20) {
leader->sendSystemMessage("@group:full");
return;
}
}
if (target->isGrouped()) {
StringIdChatParameter stringId;
stringId.setStringId("group", "already_grouped");
stringId.setTT(target);
leader->sendSystemMessage(stringId);
//leader->sendSystemMessage("group", "already_grouped", player->getObjectID());
return;
}
if (target->getGroupInviterID() == leader->getObjectID()) {
StringIdChatParameter stringId;
stringId.setStringId("group", "considering_your_group");
stringId.setTT(target);
leader->sendSystemMessage(stringId);
//leader->sendSystemMessage("group", "considering_your_group", player->getObjectID());
return;
} else if (target->getGroupInviterID() != 0) {
StringIdChatParameter stringId;
stringId.setStringId("group", "considering_other_group"); // %TT is considering joining another group.
stringId.setTT(target);
leader->sendSystemMessage(stringId);
return;
}
target->updateGroupInviterID(leader->getObjectID());
StringIdChatParameter stringId;
stringId.setStringId("group", "invite_leader");
stringId.setTT(target->getDisplayedName());
leader->sendSystemMessage(stringId);
if (target->isPlayerCreature()) {
stringId.setStringId("group", "invite_target");
stringId.setTT(leader->getDisplayedName());
target->sendSystemMessage(stringId);
} else if (target->isPet()) {
unsigned long long ownerId = target->getCreatureLinkID();
ManagedReference<CreatureObject*> owner = target->getZoneServer()->getObject(ownerId).castTo<CreatureObject*>();
if (owner != NULL && owner != leader)
owner->sendSystemMessage("@pet/pet_menu:pet_invited"); // Your pet has been invited to join your group.
joinGroup(target);
}
}