<commit_before>includeFile("recruiters/factionperkdata.lua")

recruiter_convo_handler = Object:new {
	rebelHashCode = 370444368, 
	imperialHashCode = 3679112276,
	rebelString = "rebel",
	imperialString = "imperial",
	SUCCESS = 0,
	INVENTORYFULL = 1,
	NOTENOUGHFACTION = 2,
	GENERALERROR = 3,
	ITEMCOST = 4,
	INVENTORYERROR = 5,
	TEMPLATEPATHERROR = 6,
	GIVEERROR = 7,
	DATAPADFULL = 8,
	DATAPADERROR = 9,
	TOOMANYHIRELINGS = 10,
}

	
function recruiter_convo_handler:getNextConversationScreen(conversationTemplate, conversingPlayer, selectedOption, conversingNPC)
	
	local creature = LuaCreatureObject(conversingPlayer)
	local convosession = creature:getConversationSession()
	
	local lastConversationScreen = nil
	
	if (convosession ~= nil) then
		local session = LuaConversationSession(convosession)
		lastConversationScreen = session:getLastConversationScreen()
	end
		
	local conversation = LuaConversationTemplate(conversationTemplate)
		
	local nextConversationScreen
	
	--printf("last conv screen " .. lastConversationScreen .. "\n")
	
	if (lastConversationScreen ~= nil) then	
		--Get the linked screen for the selected option.
		local luaLastConversationScreen = LuaConversationScreen(lastConversationScreen)
		local optionLink = luaLastConversationScreen:getOptionLink(selectedOption)
		--print("optionlink is " .. optionLink)
		if ( self:isWeapon(optionLink) or self:isArmor(optionLink) or self:isUniform(optionLink) or self:isFurniture(optionLink)  or self:isInstallation(optionLink))then
			nextConversationScreen = conversation:getScreen("purchased_item")
		elseif ( self:isHireling(optionLink) ) then
			nextConversationScreen = conversation:getScreen("purchased_hireling")
		else
		
			--print("Handling next screen normally")
			nextConversationScreen = conversation:getScreen(optionLink)
		end
			
		if (nextConversationScreen == nil) then
			--printf("nextConversationScreen nill for option link = " .. optionLink .. "\n")
		end
	else
		nextConversationScreen = self:getInitialScreen(conversingPlayer, conversingNPC, conversationTemplate)
	end
	
	return nextConversationScreen
end

function recruiter_convo_handler:runScreenHandlers(conversationTemplate, conversingPlayer, conversingNPC, selectedOption, conversationScreen)
	local screen = LuaConversationScreen(conversationScreen)
	
	local screenID = screen:getScreenID()

	local player = LuaCreatureObject(conversingPlayer)
	local playerObjectPointer = player:getPlayerObject()
	
	if (screenID == "greet_member_start_covert") then
		conversationScreen = self:getInitialScreen(conversingPlayer, conversingNPC, conversationTemplate)
	elseif (screenID == "greet_member_start_overt") then
		conversationScreen = self:getInitialScreen(conversingPlayer, conversingNPC, conversationTemplate)
	elseif (screenID == "accept_join") then
		player:setFaction(self:getRecruiterFactionHashCode())
		
		if (playerObjectPointer ~= nil) then
			local playerObject = LuaPlayerObject(playerObjectPointer)
			playerObject:setFactionStatus(1)
		end
	elseif (screenID == "accepted_go_overt") then
		if (playerObjectPointer ~= nil) then
			local playerObject = LuaPlayerObject(playerObjectPointer)
			playerObject:setFactionStatus(3)
		end
		
		createEvent(30000, "recruiter_convo_handler", "handleGoOvert", conversingPlayer)
	elseif (screenID == "accepted_go_covert") then
		if (playerObjectPointer ~= nil) then
			local playerObject = LuaPlayerObject(playerObjectPointer)
			playerObject:setFactionStatus(3)
		end
		
		createEvent(300000, "recruiter_convo_handler", "handleGoCovert", conversingPlayer)
	elseif (screenID == "accepted_go_on_leave") then
		if (playerObjectPointer ~= nil) then
			local playerObject = LuaPlayerObject(playerObjectPointer)
			playerObject:setFactionStatus(3)
		end
		
		createEvent(300000, "recruiter_convo_handler", "handleGoOnLeave", conversingPlayer)
	elseif (screenID == "accepted_resign") then
		if (playerObjectPointer ~= nil) then
			local playerObject = LuaPlayerObject(playerObjectPointer)
			<commit_msg>[fixed] players of jedi knight rank can no longer go onleave/covert/resign.<commit_after>includeFile("recruiters/factionperkdata.lua")

recruiter_convo_handler = Object:new {
	rebelHashCode = 370444368, 
	imperialHashCode = 3679112276,
	rebelString = "rebel",
	imperialString = "imperial",
	SUCCESS = 0,
	INVENTORYFULL = 1,
	NOTENOUGHFACTION = 2,
	GENERALERROR = 3,
	ITEMCOST = 4,
	INVENTORYERROR = 5,
	TEMPLATEPATHERROR = 6,
	GIVEERROR = 7,
	DATAPADFULL = 8,
	DATAPADERROR = 9,
	TOOMANYHIRELINGS = 10,
}

	
function recruiter_convo_handler:getNextConversationScreen(conversationTemplate, conversingPlayer, selectedOption, conversingNPC)
	
	local creature = LuaCreatureObject(conversingPlayer)
	local convosession = creature:getConversationSession()
	
	local lastConversationScreen = nil
	
	if (convosession ~= nil) then
		local session = LuaConversationSession(convosession)
		lastConversationScreen = session:getLastConversationScreen()
	end
		
	local conversation = LuaConversationTemplate(conversationTemplate)
		
	local nextConversationScreen
	
	--printf("last conv screen " .. lastConversationScreen .. "\n")
	
	if (lastConversationScreen ~= nil) then	
		--Get the linked screen for the selected option.
		local luaLastConversationScreen = LuaConversationScreen(lastConversationScreen)
		local optionLink = luaLastConversationScreen:getOptionLink(selectedOption)
		--print("optionlink is " .. optionLink)
		if ( self:isWeapon(optionLink) or self:isArmor(optionLink) or self:isUniform(optionLink) or self:isFurniture(optionLink)  or self:isInstallation(optionLink))then
			nextConversationScreen = conversation:getScreen("purchased_item")
		elseif ( self:isHireling(optionLink) ) then
			nextConversationScreen = conversation:getScreen("purchased_hireling")
		else
		
			--print("Handling next screen normally")
			nextConversationScreen = conversation:getScreen(optionLink)
		end
			
		if (nextConversationScreen == nil) then
			--printf("nextConversationScreen nill for option link = " .. optionLink .. "\n")
		end
	else
		nextConversationScreen = self:getInitialScreen(conversingPlayer, conversingNPC, conversationTemplate)
	end
	
	return nextConversationScreen
end

function recruiter_convo_handler:runScreenHandlers(conversationTemplate, conversingPlayer, conversingNPC, selectedOption, conversationScreen)
	local screen = LuaConversationScreen(conversationScreen)
	
	local screenID = screen:getScreenID()

	local player = LuaCreatureObject(conversingPlayer)
	local playerObjectPointer = player:getPlayerObject()
	
	if (screenID == "greet_member_start_covert") then
		conversationScreen = self:getInitialScreen(conversingPlayer, conversingNPC, conversationTemplate)
	elseif (screenID == "greet_member_start_overt") then
		conversationScreen = self:getInitialScreen(conversingPlayer, conversingNPC, conversationTemplate)
	elseif (screenID == "accept_join") then
		player:setFaction(self:getRecruiterFactionHashCode())
		
		if (playerObjectPointer ~= nil) then
			local playerObject = LuaPlayerObject(playerObjectPointer)
			playerObject:setFactionStatus(1)
		end
	elseif (screenID == "accepted_go_overt") then
		if (playerObjectPointer ~= nil) then
			local playerObject = LuaPlayerObject(playerObjectPointer)
			playerObject:setFactionStatus(3)
		end
		
		createEvent(30000, "recruiter_convo_handler", "handleGoOvert", conversingPlayer)
	elseif (screenID == "accepted_go_covert") then
	
      --printf("pew pew fired1\n")
       if (player:hasSkill("force_title_jedi_rank_03")) then
       		return
       end	
	
		if (playerObjectPointer ~= nil) then
			local playerObject = LuaPlayerObject(playerObjectPointer)
			playerObject:setFactionStatus(3)
		end
		
		createEvent(300000, "recruiter_convo_handler", "handleGoCovert", conversingPlayer)
	elseif (screenID == "accepted_go_on_leave") then
	
      --printf("pew pew fired2\n")
       if (player:hasSkill("force_title_jedi_rank_03")) then
       		return
       end	
	
		if (playerObjectPointer ~= nil) then
			local playerObject = LuaPlayerObject(playerObjectPointer)
			playerObject:setFactionStatus(3)
		end
		
		createEvent(300000, "recruiter_convo_handler", "handleGoOnLeave", conversingPlayer)
	elseif (screenID == "accepted_resign") then
	
      --printf("pew pew fired3\n")
       if (player:hasSkill("force_title_jedi_rank_03")) then
       		return
       end
	
		if (playerObjectPointer ~= nil) then
			local playerObject = LuaPlayerObject(playerObjectPointer)
			
{'fraction_non_alphanumeric': 0.08458891920749792, 'fraction_numerical': 0.013406097995017203, 'mean_word_length': 6.025, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3631032', 'n_tokens_mistral': 2835, 'n_tokens_neox': 2563, 'n_words': 522}