예제 #1
0
void MissionManager::checkDancerMission(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)
			{
				if(mission->getInProgress()) { ++it; continue; }
                if(glm::distance(player->mPosition, mission->getDestination().Coordinates) < 20)
				{
					BuffAttribute* performance_timer = new BuffAttribute(Mission_Timer, 0,0,0);
					Buff* timer = Buff::SimpleBuff(player, player, 600000, 0, gWorldManager->GetCurrentGlobalTick());
					timer->AddAttribute(performance_timer);
					player->AddBuff(timer);
					mission->setInProgress(true);
				}
			}
			++it;
		}
	}

return;
}
예제 #2
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;
		}
	}
}
예제 #3
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;
}
예제 #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;
		}

	}

}