本文整理汇总了C++中PlayerObject::hasGodMode方法的典型用法代码示例。如果您正苦于以下问题:C++ PlayerObject::hasGodMode方法的具体用法?C++ PlayerObject::hasGodMode怎么用?C++ PlayerObject::hasGodMode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerObject
的用法示例。
在下文中一共展示了PlayerObject::hasGodMode方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: notifyEnter
void FsVillageAreaImplementation::notifyEnter(SceneObject* player) {
ActiveAreaImplementation::notifyEnter(player);
if (!player->isPlayerCreature()) {
return;
}
float x = player->getPositionX();
float y = player->getPositionY();
float diffY = y - getPositionY();
float diffX = x - getPositionX();
float angle = atan2(diffY == 0.f ? 1 : diffY, diffX == 0.f ? 1 : diffX);
CreatureObject* playerCreature = cast<CreatureObject*>(player);
PlayerObject* ghost = playerCreature->getPlayerObject();
float rad = getRadius() * 1.05;
float newPosX = getPositionX() + (cos(angle) * rad);
float newPosY = getPositionY() + (sin(angle) * rad);
// Those who aren't a valid player, do not currently have or have had the Village elder quest cannot enter.
if (ghost != NULL) {
if (ghost->hasGodMode())
return;
if (!ghost->hasActiveQuestBitSet(PlayerQuestData::FS_VILLAGE_ELDER) && !ghost->hasCompletedQuestsBitSet(PlayerQuestData::FS_VILLAGE_ELDER)) {
playerCreature->teleport(newPosX, getZone()->getHeight(newPosX, newPosY), newPosY, 0);
playerCreature->sendSystemMessage("@base_player:fs_village_unavailable");
} else if (playerCreature->isInCombat()) {
playerCreature->teleport(newPosX, getZone()->getHeight(newPosX, newPosY), newPosY, 0);
playerCreature->sendSystemMessage("@base_player:fs_village_no_combat");
}
}
}
示例2: 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() ){
//.........这里部分代码省略.........