本文整理汇总了C++中PlayerObject类的典型用法代码示例。如果您正苦于以下问题:C++ PlayerObject类的具体用法?C++ PlayerObject怎么用?C++ PlayerObject使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PlayerObject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getPlayerObject
//-----------------------------------------------------------------------------
void CommunityManager::handleMessage(ChatOnGetIgnoreList const &message)
{
//DEBUG_REPORT_LOG(true, ("CommunityManager::handleMessage() - <ChatOnGetIgnoreList> networkId: %s ignore count: %d\n", message.getCharacter().getValueString().c_str(), message.getIgnoreList().size()));
PlayerObject *playerObject = getPlayerObject(message.getCharacter());
if (playerObject != NULL)
{
typedef std::vector<std::string> StringVector;
StringVector ignoreList;
ignoreList.reserve(message.getIgnoreList().size());
std::vector<ChatAvatarId>::const_iterator iterIgnoreList = message.getIgnoreList().begin();
#ifdef _DEBUG
int count = 1;
#endif // _DEBUG
std::string const & thisGameCode = Chat::getGameCode();
std::string const & thisClusterName = GameServer::getInstance().getClusterName();
for (; iterIgnoreList != message.getIgnoreList().end(); ++iterIgnoreList)
{
if (!iterIgnoreList->name.empty())
{
if (_stricmp(iterIgnoreList->gameCode.c_str(), thisGameCode.c_str()))
{
// ignore is from a different game, so store both the game and cluster name
ignoreList.push_back(iterIgnoreList->gameCode + std::string(".") + iterIgnoreList->cluster + std::string(".") + iterIgnoreList->name);
}
else if (_stricmp(iterIgnoreList->cluster.c_str(), thisClusterName.c_str()))
{
// ignore is from a different cluster, so store cluster name
ignoreList.push_back(iterIgnoreList->cluster + std::string(".") + iterIgnoreList->name);
}
else
{
// ignore is from the same cluster, so don't need to store game name
ignoreList.push_back(iterIgnoreList->name);
}
}
//DEBUG_REPORT_LOG(true, (" %2d CommunityManager::handleMessage() - <ChatOnGetIgnoreList> networkId: %s friend: %s\n", ++count, message.getCharacter().getValueString().c_str(), iterIgnoreList->getFullName().c_str()));
//playerObject->addIgnore(iterIgnoreList->name);
#ifdef _DEBUG
++count;
#endif // _DEBUG
}
playerObject->setIgnoreList(ignoreList);
}
}
示例2: destroyObjectFromDatabase
void EventPerkDeedImplementation::destroyObjectFromDatabase(bool destroyContainedObjects) {
ManagedReference<CreatureObject*> strongOwner = owner.get();
if (strongOwner != NULL) {
PlayerObject* ghost = strongOwner->getPlayerObject();
if (ghost != NULL) {
ghost->removeEventPerk(_this.get());
}
}
DeedImplementation::destroyObjectFromDatabase(destroyContainedObjects);
}
示例3: HandleCancelCraftingSession
bool CraftingManager::HandleCancelCraftingSession(Object* object,Object* target,Message* message,ObjectControllerCmdProperties* cmdProperties)
{
PlayerObject* playerObject = dynamic_cast<PlayerObject*>(object);
message->setIndex(24);
/*uint32 counter = */
message->getUint32();
gCraftingSessionFactory->destroySession(playerObject->getCraftingSession());
//client complains over crafting tool already having an item when we go out of the slot screen!!!!!
return true;
}
示例4: scriptSystemMessage
void ScriptSupport::scriptSystemMessage(uint64 playerId, uint64 targetId, std::string message)
{
PlayerObject* playerObject = dynamic_cast<PlayerObject*>(gWorldManager->getObjectById(playerId));
Object* object = gWorldManager->getObjectById(targetId);
CreatureObject* creature = dynamic_cast<CreatureObject*>(gWorldManager->getObjectById(targetId));
if (object && creature && playerObject && playerObject->isConnected())
{
std::string msg = (int8*)message.c_str();
// gMessageLib->sendPlayClientEffectLocMessage(msg, object->mPosition, playerObject);
gMessageLib->sendPlayClientEffectObjectMessage(msg,"",creature,playerObject);
// "clienteffect/combat_explosion_lair_large.cef"
}
}
示例5: 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);
}
示例6: 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) {
CreatureObject* creo = dynamic_cast<CreatureObject*>(sceneObject);
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->setForcePowerMax(creo->getSkillMod("jedi_force_power_max"));
} else if (object->isWeaponObject()) {
WeaponObject* weaponObject = cast<WeaponObject*>(object);
if (weaponObject->isJediWeapon()) {
VisibilityManager::instance()->increaseVisibility(creo, VisibilityManager::SABERVISMOD);
}
}
}
return ContainerComponent::notifyObjectInserted(sceneObject, object);
}
示例7: while
void WorldManager::createObjectForKnownPlayers(PlayerObjectSet* knownPlayers, Object* object)
{
PlayerObjectSet::iterator it = knownPlayers->begin();
while(it != knownPlayers->end())
{
PlayerObject* targetObject = (*it);
gMessageLib->sendCreateObject(object,targetObject);
targetObject->addKnownObjectSafe(object);
object->addKnownObjectSafe(targetObject);
++it;
}
}
示例8: _handleDismissGroupMember
void ObjectController::_handleDismissGroupMember(uint64 targetId,Message* message,ObjectControllerCmdProperties* cmdProperties)
{
PlayerObject* player = dynamic_cast<PlayerObject*>(mObject);
// make sure its a fully grouped player
if(player->getGroupId() == 0)
{
return;
}
// lets get the target player
message->setIndex(32);
PlayerObject* targetPlayer = dynamic_cast<PlayerObject*>(gWorldManager->getObjectById(message->getUint64()));
// if target is valid
if(targetPlayer == NULL || targetPlayer->getGroupId() != player->getGroupId())
{
gMessageLib->sendSystemMessage(player,L"Invalid Target.");
return;
}
// we advise the chat server about it
Message* newMessage;
gMessageFactory->StartMessage();
gMessageFactory->addUint32(opIsmGroupDismissGroupMember);
gMessageFactory->addUint32(targetPlayer->getAccountId());
newMessage = gMessageFactory->EndMessage();
player->getClient()->SendChannelA(newMessage,player->getAccountId(),CR_Chat,2);
}
示例9: _handleWaypoint
void ObjectController::_handleWaypoint(uint64 targetId, Message* message, ObjectControllerCmdProperties* cmdProperties)
{
PlayerObject* player = dynamic_cast<PlayerObject*>(mObject);
Datapad* datapad = player->getDataPad();
BString waypoint_data;
glm::vec3 waypoint_position;
// Before anything else verify the datapad can hold another waypoint.
if(! datapad->getCapacity()) {
gMessageLib->SendSystemMessage(::common::OutOfBand("base_player", "too_many_waypoints"), player);
return;
}
// Read in any waypoint data that may have been sent:
// [SYNTAX] /waypoint <x> <z> or /waypoint <x> <y> <z>
message->getStringUnicode16(waypoint_data);
// Check and see if any parameters were passed to the /waypoint command. For
// immediate purposes the length can be used to tell if anything or nothing was passed.
if (waypoint_data.getLength()) {
int count = swscanf(waypoint_data.getUnicode16(), L"%f %f %f", &waypoint_position.x, &waypoint_position.y, &waypoint_position.z);
// If there are an invalid number of items then disregard and notify the player of the correct
// format for the /waypoint command.
if (count < 2 || count > 3) {
gMessageLib->SendSystemMessage(L"[SYNTAX] /waypoint <x> <z> or /waypoint <x> <y> <z>", player);
return;
}
// If the item count is 2 it means no y value was set in the /waypoint command so
// update the waypoint_position data values accordingly.
if (count == 2) {
waypoint_position.z = waypoint_position.y;
waypoint_position.y = 0;
}
// Validate the position values.
if (waypoint_position.x < -8192 || waypoint_position.x > 8192 ||
waypoint_position.y < -500 || waypoint_position.y > 500 ||
waypoint_position.z < -8192 || waypoint_position.z > 8192) {
gMessageLib->SendSystemMessage( L"[SYNTAX] Invalid range for /waypoint. x = -8192/8192 y = -500/500 z = -8192/8192", player);
return;
}
} else {
// If no parameters were passed to the /waypoint command use the current world position.
waypoint_position = player->getWorldPosition();
}
datapad->requestNewWaypoint("Waypoint", waypoint_position, static_cast<uint16>(gWorldManager->getZoneId()), Waypoint_blue);
}
示例10: _findInRangeObjectsOutside
void ObjectController::_findInRangeObjectsOutside(bool updateAll)
{
PlayerObject* player = dynamic_cast<PlayerObject*>(mObject);
//scale down viewing range when busy
float viewingRange = _GetMessageHeapLoadViewingRange();
// query the rtree for non moving objects/objects in buildings
// ObjectSet inRangeObjects;
// mSI->getObjectsInRange(player,&inRangeObjects,(ObjType_Player | ObjType_Tangible | ObjType_Creature | ObjType_NPC | ObjType_Building),viewingRange);
// Using intersectsWithQuery(..)
// NOTE: THIS USEAGE OF intersectsWithQuery(..) MUST BE CHECKED, SINCE IT SEEMS THAT WE GET TO MUCH / TO MANY OBJECTS !!!
// mSI->getObjectsInRangeEx(player,&inRangeObjects,(ObjType_Player | ObjType_Tangible | ObjType_Creature | ObjType_NPC | ObjType_Building),viewingRange);
// Make Set ready,
mInRangeObjects.clear();
mObjectSetIt = mInRangeObjects.begin(); // Will point to end of Set
if(player->getSubZoneId())
{
if(QTRegion* region = gWorldManager->getQTRegion(player->getSubZoneId()))
{
Anh_Math::Rectangle qRect = Anh_Math::Rectangle(player->mPosition.x - viewingRange,player->mPosition.z - viewingRange,viewingRange * 2,viewingRange * 2);
// We need to find moving creatures also...
region->mTree->getObjectsInRange(player,&mInRangeObjects,ObjType_Player | ObjType_NPC | ObjType_Creature | ObjType_Lair , &qRect);
}
}
if (updateAll)
{
// Doing this because we need the players from inside buildings too.
mSI->getObjectsInRangeEx(player,&mInRangeObjects,(ObjType_Player | ObjType_NPC | ObjType_Creature), viewingRange);
// This may be good when we standstill.
mSI->getObjectsInRange(player,&mInRangeObjects,(ObjType_Tangible | ObjType_Building | ObjType_Lair | ObjType_Structure), viewingRange);
}
/*
{
// This may be good when we are moving around outside.
mSI->getObjectsInRange(player,&mInRangeObjects,(ObjType_Player | ObjType_NPC | ObjType_Creature | ObjType_Tangible | ObjType_Building), viewingRange);
}
*/
// Update the iterator to start of Set.
mObjectSetIt = mInRangeObjects.begin();
}
示例11: getGroupMember
void GroupObjectImplementation::disband() {
// this locked
ManagedReference<ChatRoom* > chat = chatRoom;
for (int i = 0; i < groupMembers.size(); i++) {
if (groupMembers.get(i) == NULL) {
continue;
}
Reference<CreatureObject*> groupMember = getGroupMember(i).castTo<CreatureObject*>();
try {
Locker clocker(groupMember, _this.get());
if (groupMember->isPlayerCreature()) {
if (chat != NULL) {
chat->removePlayer(groupMember, false);
chat->sendDestroyTo(groupMember);
ChatRoom* room = chat->getParent();
room->sendDestroyTo(groupMember);
}
if (groupMember->getPlayerObject() != NULL) {
PlayerObject* ghost = groupMember->getPlayerObject();
ghost->removeWaypointBySpecialType(WaypointObject::SPECIALTYPE_NEARESTMISSIONFORGROUP);
}
}
groupMember->updateGroup(NULL);
//play->updateGroupId(0);
//sendClosestWaypointDestroyTo(play);
//removeSquadLeaderBonuses(play);
} catch (Exception& e) {
System::out << "Exception in GroupObject::disband(Player* player)\n";
}
}
destroyChatRoom();
if (hasSquadLeader())
removeGroupModifiers();
groupMembers.removeAll();
//The mission waypoints should not be destroyed. They belong to the players.
//missionWaypoints.removeAll();
}
示例12:
void CampRegion::applyWoundHealing(Object* object)
{
PlayerObject* player = dynamic_cast<PlayerObject*>(object);
//Make sure it's a player.
if(player == NULL)
return;
auto ham = gWorldManager->getKernel()->GetServiceManager()->GetService<swganh::ham::HamService>("HamService");
for(uint8 i = HamBar_Health; i < HamBar_Willpower;i++) {
ham->RemoveWound(player->GetCreature(), i, 1);
}
}
示例13: while
bool WorldManager::_handleDisconnectUpdate(uint64 callTime,void* ref)
{
PlayerList::iterator it = mPlayersToRemove.begin();
while(it != mPlayersToRemove.end())
{
PlayerObject* playerObject = (*it);
// we timed out, so save + remove it
if(--*(playerObject->getDisconnectTime()) <= 0 && playerObject->isLinkDead())
{
// reset link dead state
playerObject->togglePlayerFlagOff(PlayerFlag_LinkDead);
playerObject->setConnectionState(PlayerConnState_Destroying);
//remove the player out of his group - if any
GroupObject* group = gGroupManager->getGroupObject(playerObject->getGroupId());
if(group)
{
group->removePlayer(playerObject->getId());
}
//asynch save
savePlayer(playerObject->getAccountId(),true,WMLogOut_LogOut);
it = mPlayersToRemove.erase(it);
}
else
++it;
}
return(true);
}
示例14: getObjects
//=============================================================================
bool Inventory::itemExist(uint32 familyId, uint32 typeId)
{
bool found = false;
ObjectIDList::iterator invObjectIt = getObjects()->begin();
// Items inside inventory and child objects.
while (invObjectIt != getObjects()->end())
{
Object* object = getObjectById(*invObjectIt);
Item* item = dynamic_cast<Item*>(object);
if (item)
{
if ((item->getItemFamily() == familyId) && (item->getItemType() == typeId))
{
found = true;
break;
}
}
invObjectIt++;
}
if (!found)
{
// Items equipped by the player.
PlayerObject* player = dynamic_cast<PlayerObject*>(gWorldManager->getObjectById(this->getParentId()));
if(!player)
return found;
ObjectList* objList = player->getEquipManager()->getEquippedObjects();
ObjectList::iterator equippedObjectIt = objList->begin();
while (equippedObjectIt != objList->end())
{
Object* object = (*equippedObjectIt);
Item* item = dynamic_cast<Item*>(object);
if (item)
{
if ((item->getItemFamily() == familyId) && (item->getItemType() == typeId))
{
found = true;
break;
}
}
equippedObjectIt++;
}
delete objList;
}
return found;
}
示例15: GroupObjectDeltaMessage6
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.get());
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.get());
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.get(), groupLeader, false);
}
if (hasSquadLeader()) {
removeGroupModifiers(playerCreature);
}
if (playerCreature->getPlayerObject() != NULL) {
PlayerObject* ghost = playerCreature->getPlayerObject();
ghost->removeWaypointBySpecialType(WaypointObject::SPECIALTYPE_NEARESTMISSIONFORGROUP);
}
scheduleUpdateNearestMissionForGroup(playerCreature->getPlanetCRC());
}
calcGroupLevel();
}