Ejemplo n.º 1
0
void MissionManager::missionFailedEntertainer(PlayerObject* player)
{
	Datapad* datapad = dynamic_cast<Datapad*>(player->getEquipManager()->getEquippedObject(CreatureEquipSlot_Datapad));

	if(datapad->hasMission()) //player has a mission
	{
		MissionList::iterator it = datapad->getMissions()->begin();
		while(it != datapad->getMissions()->end())
		{
			MissionObject* mission = dynamic_cast<MissionObject*>(*it);
			if(mission->getMissionType() == dancer || mission->getMissionType() == musician)
			{
				if(!mission->getInProgress()) { ++it; continue; }
                if(glm::distance(player->mPosition, mission->getDestination().Coordinates) < 20)
				{
						missionFailed(player,mission);
						it = datapad->removeMission(it);
						delete mission;
						return;
				}
			}
			++it;
		}
	}
}
Ejemplo n.º 2
0
bool MissionManager::checkCraftingMission(PlayerObject* player,NPCObject* npc)
{
	Datapad* datapad = dynamic_cast<Datapad*>(player->getEquipManager()->getEquippedObject(CreatureEquipSlot_Datapad));
	if(datapad->hasMission()) //player has a mission
	{
		MissionList::iterator it = datapad->getMissions()->begin();
		while(it != datapad->getMissions()->end())
		{
			MissionObject* mission = dynamic_cast<MissionObject*>(*it);
			if(mission->getMissionType() == crafting)
			{
				if(mission->getStartNPC() == npc)
				{
					//This is the start npc for the deliver mission
					char mp[10];
					sprintf(mp,"m%dp",mission->getNum());
					gMessageLib->sendSpatialChat(npc,player,L"",mission->getTitleFile(),mp);
					mission->setStartNPC(NULL);
					gMessageLib->sendSystemMessage(player,L"","mission/mission_generic","deliver_received_data");
					MissionObject* updater = new MissionObject();
					updater->clear();
					updater->setId(mission->getId());
					updater->getWaypoint()->setId(mission->getId()+1);
					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);
					gMessageLib->sendMISO_Delta(updater,player);
					delete updater;
					return true;
				}
				else if(mission->getDestinationNPC() == npc && mission->getStartNPC() == NULL)
				{
					//This is the end npc for the deliver mission.
					char mr[10];
					sprintf(mr,"m%dr",mission->getNum());
					gMessageLib->sendSpatialChat(npc,player,L"",mission->getTitleFile(),mr);
					missionComplete(player,mission);
					mission->setDestinationNPC(NULL);
					it = datapad->removeMission(it);
					delete mission;
					return true;
				}
			}

			++it;
		}
	}

return false;
}
Ejemplo n.º 3
0
bool MissionManager::checkReconMission(MissionObject* mission)
{
	if (mission->getMissionType() != recon) return false;

    if(glm::distance(mission->getOwner()->mPosition, mission->getDestination().Coordinates) < 20)
	{
		Datapad* datapad = dynamic_cast<Datapad*>(mission->getOwner()->getEquipManager()->getEquippedObject(CreatureEquipSlot_Datapad));
		missionComplete(mission->getOwner(),mission);
		gWorldManager->removeMissionFromProcess(mission->getTaskId());
		datapad->removeMission(mission);
		delete mission;
	}



return true;
}
Ejemplo n.º 4
0
void MissionManager::checkSurveyMission(PlayerObject* player,CurrentResource* resource,ResourceLocation highestDist)
{
	Datapad* datapad = dynamic_cast<Datapad*>(player->getEquipManager()->getEquippedObject(CreatureEquipSlot_Datapad));
	if(datapad->hasMission()) //player has a mission
	{
		MissionList::iterator it = datapad->getMissions()->begin();
		while(it != datapad->getMissions()->end())
		{
			MissionObject* mission = dynamic_cast<MissionObject*>(*it);
			if(mission->getMissionType() == survey)
			{
				if(mission->getTargetResource() == resource->getType())
				{
					if(mission->getDifficulty() <= (highestDist.ratio*100))
					{
                        if(glm::distance(mission->getIssuingTerminal()->mPosition, highestDist.position) > 1024)
						{
							gLogger->logMsg("PE > 500: ready to apply new BF/wound dmg");
							missionComplete(player,mission);
							it = datapad->removeMission(it);
							delete mission;
							return;
						}
						else
						{


							int8 sm[500];
							sprintf(sm,"That resource pocket is too close (%"PRIu32" meters) to the mission giver to be useful to them. Go find one at least %"PRIu32" meters away to complete your survey mission. ",
                                static_cast<uint32>(glm::distance(mission->getIssuingTerminal()->mPosition, highestDist.position)),
                                    (1024 - (int)glm::distance(mission->getIssuingTerminal()->mPosition, highestDist.position)));

							string s = BString(sm);
							s.convert(BSTRType_Unicode16);
							gMessageLib->sendSystemMessage(player,s);
						}
					}
				}
			}
			++it;
		}

	}

}
Ejemplo n.º 5
0
/*
 * Player aborted the mission
*/
void MissionManager::missionAbort(PlayerObject* player, uint64 mission_id)
{
	gLogger->logMsg("ABORT MISSION");
	Datapad* datapad = dynamic_cast<Datapad*>(player->getEquipManager()->getEquippedObject(CreatureEquipSlot_Datapad));

	MissionObject* mission = datapad->getMissionById(mission_id);
	if(mission)
	{
		datapad->removeMission(mission);
		gMessageLib->sendSystemMessage(player,L"","mission/mission_generic","incomplete");
		gMessageLib->sendSetWaypointActiveStatus(mission->getWaypoint(),false,player);
		gMessageLib->sendMissionAbort(mission,player);
		gMessageLib->sendContainmentMessage(mission->getId(), datapad->getId(), 4, player);
		gMessageLib->sendDestroyObject(mission_id,player);

		delete mission;
	}
	else
	{
		gLogger->logMsg("ERROR: Attempt to abort an invalid mission, with id %.8X, from the datapad.", static_cast<int>(mission_id));
	}

return;
}