ConversationScreen* InformantMissionScreenHandler::handleScreen(CreatureObject* conversingPlayer, CreatureObject* conversingNPC, int selectedOption, ConversationScreen* conversationScreen) { //Get informant level. int informantLevel; if (conversationScreen->getOptionLink(0) == "1") { informantLevel = 1; } else if (conversationScreen->getOptionLink(0) == "2") { informantLevel = 2; } else if (conversationScreen->getOptionLink(0) == "3") { informantLevel = 3; } else { error("Informant level incorrect."); return NULL; } //Check if player is bounty hunter. if (!conversingPlayer->hasSkill("combat_bountyhunter_novice")) { conversationScreen->setDialogText(String("@mission/mission_generic:informant_not_bounty_hunter")); } else { //Get bounty mission object if it exists. MissionObject* mission = getBountyMissionObject(conversingPlayer); if (mission == NULL) { //Player has no bounty mission. conversationScreen->setDialogText(String("@mission/mission_generic:informant_no_bounty_mission")); } else { //Check mission level. if (mission->getMissionLevel() < informantLevel) { //Incorrect informant level. conversationScreen->setDialogText(String("@mission/mission_bounty_informant:informant_find_easier")); } else if (mission->getMissionLevel() > informantLevel) { //Incorrect informant level. conversationScreen->setDialogText(String("@mission/mission_bounty_informant:informant_find_harder")); } else { //Player has bounty mission. BountyMissionObjective* objective = cast<BountyMissionObjective*>(mission->getMissionObjective()); if (objective != NULL) { //Run mission logic. if (objective->getObjectiveStatus() == BountyMissionObjective::INITSTATUS) { objective->updateMissionStatus(informantLevel); if (objective->getObjectiveStatus() == BountyMissionObjective::HASBIOSIGNATURESTATUS) { //Player received info about target position. int randomStringValue = System::random(4) + 1; conversationScreen->setDialogText("@mission/mission_bounty_informant:target_easy_" + String::valueOf(randomStringValue)); } else { //Should never happen. error("Bounty mission update failed."); } } else { //Player has already got the target position. conversationScreen->setDialogText(String("@mission/mission_generic:informant_no_bounty_mission")); } } else { //Player has already got the target position. conversationScreen->setDialogText(String("@mission/mission_generic:informant_no_bounty_mission")); } } } } return conversationScreen; }
ConversationScreen* DeliverMissionScreenHandler::handleScreen(CreatureObject* conversingPlayer, CreatureObject* conversingNPC, int selectedOption, ConversationScreen* conversationScreen) { //Get relevant mission object if it exists. MissionObject* mission = getRelevantMissionObject(conversingPlayer, conversingNPC); if (mission == NULL) { //NPC is not related to any mission for this player. int randomAnswer = System::random(4); conversationScreen->setDialogText("@mission/mission_generic:deliver_incorrect_player_" + String::valueOf(randomAnswer)); } else { //NPC is related to a mission for this player. Reference<DeliverMissionObjective*> objective = cast<DeliverMissionObjective*>(mission->getMissionObjective()); if (objective != NULL) { Locker locker(objective, conversingPlayer); //Run mission logic. String text; if (isTargetNpc(objective, conversingNPC->getPosition())) { //Target NPC. if (objective->getObjectiveStatus() == DeliverMissionObjective::INITSTATUS) { //Update mission objective status. objective->updateMissionStatus(conversingPlayer); //Converse with the player. performPickupConversation(conversationScreen, mission); } else { //Target NPC already talked to. text = "@mission/mission_generic:deliver_already_picked_up"; conversationScreen->setDialogText(text); } } else { //Destination NPC. if (objective->getObjectiveStatus() == DeliverMissionObjective::PICKEDUPSTATUS) { //Update mission objective status. objective->updateMissionStatus(conversingPlayer); if (objective->getObjectiveStatus() == DeliverMissionObjective::DELIVEREDSTATUS) { //Item delivered. performDeliverConversation(conversationScreen, mission); } else { //Item not found. text = "@mission/mission_generic:give_item"; conversationScreen->setDialogText(text); } } else if (objective->getObjectiveStatus() == DeliverMissionObjective::INITSTATUS) { //Item not picked up yet. text = "@mission/mission_generic:give_item"; conversationScreen->setDialogText(text); } else { //Item already dropped off. text = "@mission/mission_generic:deliver_already_dropped_off"; conversationScreen->setDialogText(text); } } } } return conversationScreen; }