Bug - Fixed Dependence day not detected on IRL date 0704

taltamir

Member
Holidays can occur either due to IRL holidays or due to kol internal calendar.
holiday() function does not detect dependence day when IRL date ends in 0704 aka 4th of july

I can try to make a script recognize it via checking the date with today_to_string().substring(4, 8) == "0704"
but even if I do it will not let me do holiday specific actions because mafia does not recognize it as today's holiday.
For example, I can't buy green rocket because it can only be bought on dependence day, and as far as mafia is concerned today is not dependence day, so trying to buy it fails
 
I've got 'usable quantity of green rocket is limited to 0 by a wizard'. The relay browser let me use one manually, though.
 

fredg1

Member
little note: the CLI command " holiday Dependence Day " didn't seem to do anything/the ash function " holiday() " was still returning an empty string. Am I understanding how this command works wrong, or what?
 

Veracity

Developer
Staff member
Clearly.

Looking at the code, it doesn't actually change an internal "holiday" object. Probably because we don't actually store such a thing anywhere; everywhere we want to know the holiday, we call HolidayDatabase.getHoliday(), which recalculates it based on KoL + Real World Dates.

Here is what the command calls:

Code:
	public static final void setHoliday( final String holiday )
	{
		KoLCharacter.isFullnessIncreased = holiday.contains( "Feast of Boris" ) || holiday.contains( "Drunksgiving" );
		KoLCharacter.holidayManaCostReduction = holiday.contains( "Festival of Jarlsberg" ) ? 3 : 0;
		KoLmafia.statDay = HolidayDatabase.currentStatDay();
	}
Which looks pretty useless, to me.

Maybe the command used to do something useful.
 

fronobulax

Developer
Staff member
https://wiki.kolmafia.us/index.php?title=Holiday and https://wiki.kolmafia.us/index.php?title=CLI_Reference

If run on July 4 I would expect it to return a non-empty string in the event that the wiki is up to date.

I did notice that RuntimeLibrary defines a holiday command which does just that. But KoLmafiCLI defines a command "holiday" which is actually SetHolidayCommand noted above. If I am following this, it means that the ash command holiday() returns a string indicating which holiday, if appropriate, but the cli command just sets some character data.

SetHolidayCommand().register( "holiday" ); traces back to hola in 2009.whereas the ash command seems o be veracity in 2015.

At the very least the wiki is wrong. I'm guessing the cli holiday is meant to take a parameter and override some character values and is intended for the case where a holiday happens but mafia's prediction was wrong.
 
Top