本文整理汇总了C++中CreatureObject::getPlayerObject方法的典型用法代码示例。如果您正苦于以下问题:C++ CreatureObject::getPlayerObject方法的具体用法?C++ CreatureObject::getPlayerObject怎么用?C++ CreatureObject::getPlayerObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CreatureObject
的用法示例。
在下文中一共展示了CreatureObject::getPlayerObject方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: removeMember
void GroupObjectImplementation::removeMember(SceneObject* member) {
ManagedReference<SceneObject*> obj = member;
for (int i = 0; i < groupMembers.size(); i++) {
SceneObject* scno = groupMembers.get(i).get().get();
if (scno == member) {
GroupObjectDeltaMessage6* grp = new GroupObjectDeltaMessage6(_this.getReferenceUnsafeStaticCast());
grp->startUpdate(1);
groupMembers.remove(i, grp);
grp->close();
broadcastMessage(grp);
}
}
if (member->isPlayerCreature()) {
// Remove member's pets
CreatureObject* playerCreature = cast<CreatureObject*>(member);
RemovePetsFromGroupTask* task = new RemovePetsFromGroupTask(playerCreature, _this.getReferenceUnsafeStaticCast());
task->execute();
//Close any open Group SUIs.
ManagedReference<PlayerObject*> ghost = playerCreature->getPlayerObject();
if (ghost != NULL) {
ghost->closeSuiWindowType(SuiWindowType::GROUP_LOOT_RULE);
ghost->closeSuiWindowType(SuiWindowType::GROUP_LOOT_CHANGED);
ghost->closeSuiWindowType(SuiWindowType::GROUP_LOOT_PICK_LOOTER);
}
//Reset Master Looter if needed.
if (getMasterLooterID() == playerCreature->getObjectID()) {
ManagedReference<CreatureObject*> groupLeader = (getLeader()).castTo<CreatureObject*>();
GroupManager::instance()->changeMasterLooter(_this.getReferenceUnsafeStaticCast(), groupLeader, false);
}
if (hasSquadLeader()) {
removeGroupModifiers(playerCreature);
}
if (playerCreature->getPlayerObject() != NULL) {
PlayerObject* ghost = playerCreature->getPlayerObject();
ghost->removeWaypointBySpecialType(WaypointObject::SPECIALTYPE_NEARESTMISSIONFORGROUP);
}
Zone* zone = playerCreature->getZone();
if (zone != NULL) {
scheduleUpdateNearestMissionForGroup(zone->getPlanetCRC());
}
}
calcGroupLevel();
}
示例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: spawnCreature
CreatureObject* CreatureManagerImplementation::spawnCreature(uint32 templateCRC, uint32 objectCRC, float x, float z, float y, uint64 parentID, bool persistent) {
CreatureTemplate* creoTempl = creatureTemplateManager->getTemplate(templateCRC);
if (creoTempl == NULL)
return spawnCreature(objectCRC, x, z, y, parentID);
CreatureObject* creature = NULL;
String templateToSpawn;
if (objectCRC == 0) {
templateToSpawn = getTemplateToSpawn(templateCRC);
objectCRC = templateToSpawn.hashCode();
}
creature = createCreature(objectCRC, persistent, templateCRC);
if (creature != NULL && creature->isAiAgent()) {
AiAgent* npc = cast<AiAgent*>(creature);
npc->loadTemplateData(creoTempl);
} else if (creature == NULL) {
error("could not spawn template " + templateToSpawn);
}
placeCreature(creature, x, z, y, parentID);
// ensuring the combat level and max HAM is correct.
if( creature->isPlayerCreature() )
creature->getPlayerObject()->recalculateCombatLevel(creature);
return creature;
}
示例4: teleport
void PlayerZoneComponent::teleport(SceneObject* sceneObject, float newPositionX, float newPositionZ, float newPositionY, uint64 parentID) {
//sceneObject->setTeleporting(true);
CreatureObject* player = NULL;
if (sceneObject->isPlayerCreature()) {
player = cast<CreatureObject*>( sceneObject);
}
if (player != NULL && sceneObject->getParent() != NULL && parentID != 0) {
ManagedReference<SceneObject*> par = sceneObject->getParent();
if (par->isVehicleObject() || par->isMount()) {
player->executeObjectControllerAction(String("dismount").hashCode());
}
}
ZoneComponent::teleport(sceneObject, newPositionX, newPositionZ, newPositionY, parentID);
if (player != NULL) {
PlayerObject* ghost = player->getPlayerObject();
ghost->setTeleporting(true);
ghost->updateLastValidatedPosition();
player->setMovementCounter(0);
ghost->setClientLastMovementStamp(0);
}
}
示例5: awardPvpFactionPoints
void FactionManager::awardPvpFactionPoints(TangibleObject* killer, CreatureObject* destructedObject) {
if (killer->isPlayerCreature() && destructedObject->isPlayerCreature()) {
CreatureObject* killerCreature = cast<CreatureObject*>(killer);
ManagedReference<PlayerObject*> ghost = killerCreature->getPlayerObject();
ManagedReference<PlayerObject*> killedGhost = destructedObject->getPlayerObject();
if (killer->isRebel() && destructedObject->isImperial()) {
ghost->increaseFactionStanding("rebel", 75);
ghost->decreaseFactionStanding("imperial", 75);
killedGhost->decreaseFactionStanding("imperial", 75); //TODO: find formulas
} else if (killer->isImperial() && destructedObject->isRebel()) {
ghost->increaseFactionStanding("imperial", 75);
ghost->decreaseFactionStanding("rebel", 75);
killedGhost->decreaseFactionStanding("rebel", 75);
}
} else if (destructedObject->isPlayerCreature()) {
ManagedReference<PlayerObject*> ghost = destructedObject->getPlayerObject();
if (killer->getFaction() != destructedObject->getFaction()) {
if (killer->isRebel() && destructedObject->isImperial()) {
ghost->decreaseFactionStanding("imperial", 75); //TODO: find formulas
} else if (killer->isImperial() && destructedObject->isRebel()) {
ghost->decreaseFactionStanding("rebel", 75);
}
}
}
}
示例6: 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);
}
}
示例7: 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);
}
}
示例8: updateZoneWithParent
void PlayerZoneComponent::updateZoneWithParent(SceneObject* sceneObject, SceneObject* newParent, bool lightUpdate, bool sendPackets) {
ZoneComponent::updateZoneWithParent(sceneObject, newParent, lightUpdate, sendPackets);
if (sceneObject->getParent() != NULL && sceneObject->isPlayerCreature()) {
CreatureObject* player = cast<CreatureObject*>( sceneObject);
PlayerObject* ghost = player->getPlayerObject();
ghost->setSavedParentID(sceneObject->getParentID());
}
}
示例9: notifyObjectRemoved
/**
* Is called when an object was removed
* @param object object that has been inserted
*/
int PlayerContainerComponent::notifyObjectRemoved(SceneObject* sceneObject, SceneObject* object, SceneObject* destination) {
CreatureObject* creo = dynamic_cast<CreatureObject*>(sceneObject);
if (object->isArmorObject()) {
PlayerManager* playerManager = creo->getZoneServer()->getPlayerManager();
playerManager->removeEncumbrancies(creo, cast<ArmorObject*>(object));
}
if (object->isTangibleObject()) {
TangibleObject* tano = cast<TangibleObject*>(object);
tano->removeSkillModsFrom(creo);
}
if (object->isInstrument()) {
if (creo->isPlayingMusic())
creo->stopEntertaining();
}
if (creo->getPlayerObject().get() != NULL && creo->getPlayerObject()->isJedi()) {
if ((object->isRobeObject() && cast<RobeObject*>( object)->getSkillRequired() != "") || (object->isWeaponObject() && cast<WeaponObject*>(object)->isJediWeapon()))
VisibilityManager::instance()->increaseVisibility(creo);
}
//this it to update the equipment list
//we need a DeltaVector with all the slotted objects it seems
/*CreatureObjectMessage6* msg6 = new CreatureObjectMessage6(creo);
creo->broadcastMessage(msg6, true, true);*/
if (object->isTangibleObject() && object->getArrangementDescriptorSize() != 0 && object->getArrangementDescriptor(0).size() != 0) {
String arrangement = object->getArrangementDescriptor(0).get(0); //CHK
if (arrangement != "mission_bag" && arrangement != "ghost" && arrangement != "bank") {
creo->removeWearableObject(cast<TangibleObject*>(object), true);
}
}
if (creo != NULL && object->isTangibleObject()) {
ManagedReference<TangibleObject*> tano = cast<TangibleObject*>(object);
tano->removeTemplateSkillMods(creo);
}
return ContainerComponent::notifyObjectRemoved(sceneObject, object, destination);
}
示例10: notifyObjectInserted
/**
* Is called when this object has been inserted with an object
* @param object object that has been inserted
*/
int PlayerContainerComponent::notifyObjectInserted(SceneObject* sceneObject, SceneObject* object) const {
CreatureObject* creo = dynamic_cast<CreatureObject*>(sceneObject);
if (creo == NULL) {
return 0;
}
if (object->isArmorObject()) {
PlayerManager* playerManager = sceneObject->getZoneServer()->getPlayerManager();
playerManager->applyEncumbrancies(creo, cast<ArmorObject*>(object));
}
if (object->isTangibleObject()) {
TangibleObject* tano = cast<TangibleObject*>(object);
tano->applySkillModsTo(creo);
}
if (object->isInstrument() && creo->isEntertaining())
creo->stopEntertaining();
//this it to update the equipment list
//we need a DeltaVector with all the slotted objects it seems
/*CreatureObjectMessage6* msg6 = new CreatureObjectMessage6(creo);
creo->broadcastMessage(msg6, true, true);*/
if (object->isTangibleObject() && object->getArrangementDescriptorSize() != 0 && object->getArrangementDescriptor(0)->size() != 0) {
const String& arrangement = object->getArrangementDescriptor(0)->get(0);
if (arrangement != "mission_bag" && arrangement != "ghost" && arrangement != "bank") {
creo->addWearableObject(object->asTangibleObject(), true);
}
}
if (object->isTangibleObject()) {
ManagedReference<TangibleObject*> tano = object->asTangibleObject();
tano->addTemplateSkillMods(creo);
}
// Jedi stuff below.
PlayerObject* ghost = creo->getPlayerObject();
if (ghost && ghost->isJedi()) {
if (object->isRobeObject()) {
ghost->recalculateForcePower();
} else if (object->isWeaponObject()) {
WeaponObject* weaponObject = cast<WeaponObject*>(object);
if (weaponObject->isJediWeapon()) {
VisibilityManager::instance()->increaseVisibility(creo, VisibilityManager::SABERVISMOD);
}
}
}
return ContainerComponent::notifyObjectInserted(sceneObject, object);
}
示例11: notifyObjectRemoved
/**
* Is called when an object was removed
* @param object object that has been inserted
*/
int PlayerContainerComponent::notifyObjectRemoved(SceneObject* sceneObject, SceneObject* object, SceneObject* destination) const {
CreatureObject* creo = dynamic_cast<CreatureObject*>(sceneObject);
if (creo == NULL) {
return 0;
}
if (object->isArmorObject()) {
PlayerManager* playerManager = creo->getZoneServer()->getPlayerManager();
playerManager->removeEncumbrancies(creo, cast<ArmorObject*>(object));
}
if (object->isTangibleObject()) {
TangibleObject* tano = cast<TangibleObject*>(object);
tano->removeSkillModsFrom(creo);
}
if (object->isInstrument()) {
if (creo->isPlayingMusic())
creo->stopEntertaining();
}
//this it to update the equipment list
//we need a DeltaVector with all the slotted objects it seems
/*CreatureObjectMessage6* msg6 = new CreatureObjectMessage6(creo);
creo->broadcastMessage(msg6, true, true);*/
if (object->isTangibleObject() && object->getArrangementDescriptorSize() != 0 && object->getArrangementDescriptor(0)->size() != 0) {
const String& arrangement = object->getArrangementDescriptor(0)->get(0); //CHK
if (arrangement != "mission_bag" && arrangement != "ghost" && arrangement != "bank") {
creo->removeWearableObject(object->asTangibleObject(), true);
}
}
if (object->isTangibleObject()) {
ManagedReference<TangibleObject*> tano = object->asTangibleObject();
tano->removeTemplateSkillMods(creo);
}
// Jedi stuff below.
PlayerObject* ghost = creo->getPlayerObject();
if (ghost && ghost->isJedi()) {
if (object->isRobeObject()) {
ghost->recalculateForcePower();
}
}
return ContainerComponent::notifyObjectRemoved(sceneObject, object, destination);
}
示例12: 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;
}
示例13: 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);
}
}
示例14: 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);
}
}
示例15: switchZone
void PlayerZoneComponent::switchZone(SceneObject* sceneObject, const String& newTerrainName, float newPostionX, float newPositionZ, float newPositionY, uint64 parentID) {
if (sceneObject->isPlayerCreature()) {
CreatureObject* player = cast<CreatureObject*>( sceneObject);
PlayerObject* ghost = player->getPlayerObject();
ManagedReference<SceneObject*> par = sceneObject->getParent();
if (par != NULL && (par->isVehicleObject() || par->isMount())) {
player->executeObjectControllerAction(String("dismount").hashCode());
}
ghost->setSavedParentID(0);
ghost->setTeleporting(true);
ghost->updateLastValidatedPosition();
player->setMovementCounter(0);
ghost->setClientLastMovementStamp(0);
ghost->unloadSpawnedChildren();
}
ZoneComponent::switchZone(sceneObject, newTerrainName, newPostionX, newPositionZ, newPositionY, parentID);
}