当前位置: 首页>>代码示例>>C++>>正文


C++ PlayerManager类代码示例

本文整理汇总了C++中PlayerManager的典型用法代码示例。如果您正苦于以下问题:C++ PlayerManager类的具体用法?C++ PlayerManager怎么用?C++ PlayerManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了PlayerManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: sendHome

//Sends a fleet back to it's home planet
void TaeTurn::sendHome(uint32_t fleet) {
    Game* game = Game::getGame();
    ObjectManager* obm = game->getObjectManager();
    ObjectTypeManager* obtm = game->getObjectTypeManager();
    PlayerManager* pm = game->getPlayerManager();

    IGObject* fleetobj = obm->getObject(fleet);
    //Check to make sure it is really a fleet
    if(fleetobj->getType() != obtm->getObjectTypeByName("Fleet")) {
        return;
    }
    
    //Get all the required objects
    Fleet* f = (Fleet*) fleetobj->getObjectBehaviour();
    Player* p = pm->getPlayer(f->getOwner());
    IGObject* sys = obm->getObject(fleetobj->getParent());
    StarSystem* sysData = (StarSystem*) sys->getObjectBehaviour();

    //Remove fleet from system
    sysData->setRegion(0);
    fleetobj->removeFromParent();

    //Find it's home planet
    std::set<uint32_t> objects = obm->getAllIds();
    std::set<uint32_t>::iterator itcurr;
    for(itcurr = objects.begin(); itcurr != objects.end(); ++itcurr) {
        IGObject * ob = obm->getObject(*itcurr);
        if(ob->getName().compare(string(p->getName() + "'s Home Planet")) == 0) {
            Planet* p = (Planet*) ob->getObjectBehaviour();
            f->setPosition(p->getPosition());
            fleetobj->addToParent(ob->getID());
        }
    }
}
开发者ID:AfrazHussain,项目名称:tpserver-cpp,代码行数:35,代码来源:taeturn.cpp

示例2: doMusicSelection

void JukeboxImplementation::doMusicSelection(CreatureObject* player) {
	PlayerObject* ghost = player->getPlayerObject();

	if (ghost == NULL)
		return;

	PlayerManager* playerManager = player->getZoneServer()->getPlayerManager();

	if (playerManager == NULL)
		return;

	ManagedReference<SuiListBox*> listbox = new SuiListBox(player, SuiWindowType::JUKEBOX_SELECTION);
    listbox->setCallback(new JukeboxSelectionSuiCallback(server->getZoneServer()));
	listbox->setPromptTitle("@event_perk_jukebox_songs:songs_t"); // Music Select
	listbox->setPromptText("@event_perk_jukebox_songs:songs_d"); // Select a song to play from the list below.
	listbox->setUsingObject(_this.getReferenceUnsafeStaticCast());
	listbox->setForceCloseDistance(32.f);
	listbox->setCancelButton(true, "@cancel");

	int songListSize = playerManager->getNumJukeboxSongs();
	JukeboxSong* song = NULL;

	for (int i = 0; i < songListSize; i++) {
		song = playerManager->getJukeboxSong(i);

		if (song != NULL) {
			listbox->addMenuItem(song->getStringId());
		}
	}

	ghost->addSuiBox(listbox);
	player->sendMessage(listbox->generateMessage());
}
开发者ID:JigglyPoofSWG,项目名称:BSS,代码行数:33,代码来源:JukeboxImplementation.cpp

示例3: action

//-------------------------------------------------------------------------
void CardMovePlayerToPosition::action(
        PlayerManager &i_players
        )
{
    i_players.setPosition(m_newPosition);
    std::cout<< "Move " << i_players.getName() << " to " << i_players.getPosition() << " position." << std::endl;
}
开发者ID:cblop,项目名称:monopoly,代码行数:8,代码来源:CardMovePlayerToPosition.cpp

示例4: Execute

BOOL CMDUnsilence::Execute(const std::string &verb, Player* mobile,std::vector<std::string> &args,int subcmd)
{
    World* world = World::GetPtr();
    PlayerManager* manager = world->GetPlayerManager();
    Player* targ = nullptr;

    if (!args.size())
    {
        mobile->Message(MSG_ERROR, "Syntax: unsilence <player>");
        return false;
    }

    targ = manager->FindPlayer(args[0]);
    if (!targ)
    {
        mobile->Message(MSG_ERROR, "Could not find the specified player.");
        return false;
    }
    if (!BitIsSet(targ->GetPflag(), PF_SILENCE))
    {
        mobile->Message(MSG_INFO, "That player is not silenced.");
        return false;
    }

    targ->SetPflag(BitClear(mobile->GetPflag(), PF_SILENCE));
    mobile->Message(MSG_INFO, Capitalize(targ->GetName())+" has been unsilenced.");
    world->WriteLog(Capitalize(targ->GetName())+" was unsilenced by "+Capitalize(mobile->GetName())+".");
    targ->Message(MSG_INFO, "You were unsilenced by "+Capitalize(mobile->GetName())+".");
    return true;
}
开发者ID:sorressean,项目名称:Aspen,代码行数:30,代码来源:com_wiz.cpp

示例5: if

int RingObjectMenuComponent::handleObjectMenuSelect(SceneObject* sceneObject, CreatureObject* player, byte selectedID) const {
	if (selectedID == 22) { // Propose Unity
		if (!sceneObject->isASubChildOf(player))
			return 0;

		ManagedReference<SceneObject*> target = player->getZoneServer()->getObject(player->getTargetID());

		if (target != NULL && target->isPlayerCreature()) {
			PlayerManager* playerManager = player->getZoneServer()->getPlayerManager();

			if (playerManager != NULL)
				playerManager->proposeUnity(player, cast<CreatureObject*>(target.get()), sceneObject);

			return 0;
		} else {
			player->sendSystemMessage("@unity:bad_target"); // "You must have a valid player target to Propose Unity."
			return 0;
		}

	} else if (selectedID == 234) { // Divorce
		if (!sceneObject->isASubChildOf(player))
			return 0;

		PlayerManager* playerManager = player->getZoneServer()->getPlayerManager();

		if (playerManager != NULL)
			playerManager->promptDivorce(player);

		return 0;
	}

	return TangibleObjectMenuComponent::handleObjectMenuSelect(sceneObject, player, selectedID);
}
开发者ID:ModTheGalaxy,项目名称:mtgserver,代码行数:33,代码来源:RingObjectMenuComponent.cpp

示例6: personaje_en_radio

bool Enemigo::personaje_en_radio(MapaServidor& mapa,PlayerManager& pm,TileServidor*& tilePersonaje){
	//it-> first = nick
	//it-> second = pje
	//TileServidor* tileEnemigo = mapa.getTilePorPixeles(this->getX(),this->getY());
	//int XlogicoEnemigo = tileEnemigo->getU();
	//int YlogicoEnemigo = tileEnemigo->getV();
	int XlogicoEnemigo = this->getX();
	int YlogicoEnemigo = this->getY();

	bool encontro_personaje = false;
	//posiciones fisicas
	for(auto it = pm.getPlayers().begin();it != pm.getPlayers().end(); it++) {
	
		int XLogicoPersonaje = it->second.getX();
		int YLogicoPersonaje = it->second.getY();

		if( (XLogicoPersonaje >= (XlogicoEnemigo - radioAtaque)) && (XLogicoPersonaje <= (XlogicoEnemigo + radioAtaque)) ){
			if( (YLogicoPersonaje >= (YlogicoEnemigo - radioAtaque)) && (YLogicoPersonaje <= (YlogicoEnemigo + radioAtaque)) ){
				encontro_personaje = true;
				tilePersonaje = mapa.getTile( XLogicoPersonaje,YLogicoPersonaje);
				break;
			}
		}
	}
	
	return encontro_personaje;
}
开发者ID:vnportnoy,项目名称:Taller,代码行数:27,代码来源:enemigoServer.cpp

示例7: action

//-----------------------------------------------------------------------------
void CardReceiveMoneyFromPlayers::action(
        PlayerManager &i_players
        )
{
	//Uses method in PlayerManager 
    i_players.takeBalance(i_players.getMoneyFromEachPlayer(m_balanceToAdd));
}
开发者ID:cblop,项目名称:monopoly,代码行数:8,代码来源:CardReceiveMoneyFromPlayers.cpp

示例8: Java_com_lisa_testplayer_jni_LocalPlayer_translateColor

jint Java_com_lisa_testplayer_jni_LocalPlayer_translateColor(JNIEnv *env,jobject thiz,jbyteArray out){
	PlayerManager *playerManager = PlayerManager::GetInstance();
	jbyte *Picture= env->GetByteArrayElements(out,0);
	playerManager->translate_color(Picture);
	env->ReleaseByteArrayElements(out, Picture, 0);

}
开发者ID:VinsonCai,项目名称:AnaVideo,代码行数:7,代码来源:decode.cpp

示例9: Java_com_lisa_testplayer_jni_LocalPlayer_open

jint Java_com_lisa_testplayer_jni_LocalPlayer_open(JNIEnv* env, jobject thiz, jstring pFileName) {
	FFmpegDecoder *ffmpegDecoder = FFmpegDecoder::GetInstance();
	const char *_filename = env->GetStringUTFChars(pFileName, NULL);
	ffmpegDecoder->open_video(_filename);
	PlayerManager *playerManager = PlayerManager::GetInstance();
	playerManager->init_player();
	env->ReleaseStringUTFChars(pFileName, _filename);
}
开发者ID:VinsonCai,项目名称:AnaVideo,代码行数:8,代码来源:decode.cpp

示例10: locker

bool CampSiteActiveAreaImplementation::despawnCamp() {
	Locker locker(_this.get());

	if(!abandoned && campOwner != NULL && campOwner->getZoneServer() != NULL) {
		/// Get Player Manager
		PlayerManager* playerManager = campOwner->getZoneServer()->getPlayerManager();
		if (playerManager == NULL) {
			error("playerManager is null");
			return false;
		}

		float durationUsed = ((float)(System::getTime() - timeCreated)) / (campStructureData->getDuration() / 4);
		if (durationUsed > 1)
			durationUsed = 1;

		int amount = 0;
		int campXp = campStructureData->getExperience();
		amount = (int)(campXp * durationUsed);

		amount += (int)((visitors.size() -1) * (campXp / 30) * durationUsed);
		amount += (int)(currentXp * durationUsed);

		playerManager->awardExperience(campOwner, "camp", amount, true);
	}

	Locker tlocker(&taskMutex);

	if(despawnTask != NULL ) {
		if(despawnTask->isScheduled())
			despawnTask->cancel();
		despawnTask = NULL;
	}


	if(abandonTask != NULL) {
		if(abandonTask->isScheduled())
			abandonTask->cancel();
		abandonTask = NULL;
	}

	tlocker.release();

	if(campOwner != NULL)
		campOwner->dropObserver(ObserverEventType::STARTCOMBAT, campObserver);

	if (camp != NULL) {
		if(camp->getZone() == NULL)
			return false;

		StructureManager::instance()->destroyStructure(camp);
	}

	destroyObjectFromWorld(true);
	destroyObjectFromDatabase(true);


	return true;
}
开发者ID:Chilastra-Reborn,项目名称:Core3,代码行数:58,代码来源:CampSiteActiveAreaImplementation.cpp

示例11: RunMovementThreadAPI

void * RunMovementThreadAPI(void *arg)
{
    PlayerManager::MParam * param = (PlayerManager::MParam *) arg;
    PlayerManager * mgr = param->ClassAdd;
    //PlayerManager::Player *player = param->player;
    delete param;
    mgr->RunMovementThread();
    return NULL;
}
开发者ID:RavenB,项目名称:Earth-and-Beyond-server,代码行数:9,代码来源:PlayerManager.cpp

示例12: lua_tostring

int LuaCreatureObject::awardExperience(lua_State* L) {
    String experienceType = lua_tostring(L, -2);
    int experienceAmount = lua_tointeger(L, -1);

    PlayerManager* playerManager = realObject->getZoneServer()->getPlayerManager();
    playerManager->awardExperience(realObject, experienceType, experienceAmount, false);

    return 0;
}
开发者ID:grserver,项目名称:swgemutest,代码行数:9,代码来源:LuaCreatureObject.cpp

示例13: 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);
}
开发者ID:ModTheGalaxy,项目名称:mtgserver,代码行数:59,代码来源:PlayerContainerComponent.cpp

示例14: run

void ClientCreateCharacterCallback::run() {
	client->info("ClientCreateCharacterCallback::run()");

	PlayerManager* playerManager = server->getPlayerManager();
	bool success = playerManager->createPlayer(this);

	if (success) {
		client->info("success creating char");
	} else {
		client->info("failed to create char", true);
	}
}
开发者ID:angelsounds777,项目名称:Core3-CU,代码行数:12,代码来源:ClientCreateCharacterCallback.cpp

示例15: 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);
}
开发者ID:ModTheGalaxy,项目名称:mtgserver,代码行数:55,代码来源:PlayerContainerComponent.cpp


注:本文中的PlayerManager类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。