<commit_before>require("base.common")
require("base.time")

module("npc.base.repeatable_quests", package.seeall)

function checkIfTimesExpired(User, quest, monthToRepeat, dayToRepeat, hourToRepeat) 
	local questState, questLastChanged = User:getQuestProgress(quest);
	local month, day, hour;
	local y, mo, d, h, mi, sec = base.time.getRLDateFromUnixTimestamp(questLastChanged);
	
	debug(d.."."..mo.."."..y.." "..h..":"..mi..":"..sec);
	
	if base.time.daysPerMonth[mo] == 28 then
		month = monthToRepeat * 2419200;
	elseif base.time.daysPerMonth[mo] == 31 then
		month = monthToRepeat * 2678400;
	else 
		month = monthToRepeat * 2592000;
	end	
	
	day = dayToRepeat * 86400;
	hour = hourToRepeat * 3600;
	
	local newTimestamp = questLastChanged + month + day + hour;
	local currentTimestamp = world:getTime("unix");
	
	if newTimestamp >= currentTimestamp then
		return true; 
	else 
		return false; 
	end
end<commit_msg>debug and test<commit_after>require("base.common")
require("base.time")

module("npc.base.repeatable_quests", package.seeall)

function checkIfTimesExpired(User, quest, monthToRepeat, dayToRepeat, hourToRepeat) 
	local questState, questLastChanged = User:getQuestProgress(quest);
	local month, day, hour;
	local y, mo, d, h, mi, sec = base.time.getRLDateFromUnixTimestamp(questLastChanged);
	
	debug("LastChanged: "..questLastChanged)
	
	if base.time.daysPerMonth[mo] == 28 then
		month = monthToRepeat * 2419200;
	elseif base.time.daysPerMonth[mo] == 31 then
		month = monthToRepeat * 2678400;
	else 
		month = monthToRepeat * 2592000;
	end	
	
	day = dayToRepeat * 86400;
	hour = hourToRepeat * 3600;
	
	local newTimestamp = questLastChanged + month + day + hour;
	local currentTimestamp = world:getTime("unix");
	
	debug("Newtime: "..newTimestamp);
	debug("Current: "..currentTimestamp);
	
	if newTimestamp >= currentTimestamp then
		return true; 
	else 
		return false; 
	end
end
{'fraction_non_alphanumeric': 0.12631578947368421, 'fraction_numerical': 0.035789473684210524, 'mean_word_length': 4.743202416918429, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 5, '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': '3720597', 'n_tokens_mistral': 734, 'n_tokens_neox': 640, 'n_words': 151}