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


C++ Datapad::addMission方法代码示例

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


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

示例1: missionRequest

/*
 * Player Accepted Mission
*/
void MissionManager::missionRequest(PlayerObject* player, uint64 mission_id)
{
	Datapad* datapad = dynamic_cast<Datapad*>(player->getEquipManager()->getEquippedObject(CreatureEquipSlot_Datapad));

	//Move the mission from the player's mission bag to his datapad.
	MissionBag* mission_bag = dynamic_cast<MissionBag*>(player->getEquipManager()->getEquippedObject(CreatureEquipSlot_MissionBag));
	MissionObject* mission =  mission_bag->getMissionById(mission_id);
	if(mission == NULL)
	{
		gLogger->logMsgF("ERROR: Failed to retrieve mission with id %"PRIu64". Unable to accept mission!", MSG_HIGH, mission_id);
		return;
	}

	//automatically checks the datapads capacity
	if(!datapad->addMission(mission))
	{
		gMessageLib->sendSystemMessage(player,L"","mission/mission_generic","too_many_missions");
		return;
	}
	mission_bag->removeMission(mission);
	gMessageLib->sendContainmentMessage(mission->getId(), datapad->getId(), 0xffffffff, player);


	//Replace it with a new mission.
	mission_bag->spawnNAdd();

	//Send MissionGenericResponse to tell the client its been accepted
	gMessageLib->sendMissionGenericResponse(mission,player);

	//Update the name and mission waypoint
	MissionObject* updater = new MissionObject();
	updater->clear();
	updater->setId(mission->getId());
	updater->setNameFile(mission->getTitleFile().getRawData());
	updater->setName(mission->getTitle().getRawData());
	if(mission->getMissionType() != survey)
	{
		updater->getWaypoint()->setId(mission->getId()+1);
		if(mission->getMissionType() == deliver || mission->getMissionType() == crafting)
		{
			updater->getWaypoint()->setCoords(mission->getStart().Coordinates);
			updater->getWaypoint()->setPlanetCRC(mission->getStart().PlanetCRC);
		}
		else
		{
			updater->getWaypoint()->setCoords(mission->getDestination().Coordinates);
			updater->getWaypoint()->setPlanetCRC(mission->getDestination().PlanetCRC);

		}
		char name[150];
		sprintf(name, "@%s:%s",mission->getTitleFile().getRawData(),mission->getTitle().getRawData());
		updater->getWaypoint()->setName(name);
		updater->getWaypoint()->setActive(true);
	}
	else
	{
		gMessageLib->sendSystemMessage(player,L"","mission/mission_generic","survey_start");
	}

	//Accept the mission let the player know
	gMessageLib->sendPlayMusicMessage(WMSound_Mission_Accepted,player); //3887, 'sound/music_mission_accepted.snd'
	gMessageLib->sendMISO_Delta(updater,player);

	mission->sendAttributes(mission->getOwner());

	delete updater;

	if(mission->getMissionType() == recon)	mission->setTaskId(gWorldManager->addMissionToProcess(mission));


	//check if we need to inform our group
	if((mission->getMissionType() == destroy)&&(player->getGroupId() != 0))
	{
		// we are in a group and just accepted a destroy mission
		// check the missions and update the nearest waypoint
		GroupObject* group = gGroupManager->getGroupObject(player->getGroupId());
		gGroupManager->sendGroupMissionUpdate(group);

	}

return;
}
开发者ID:Arnold47525,项目名称:mmoserver,代码行数:85,代码来源:MissionManager.cpp


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