Bug - Fixed Proxy records persist across logins

damion117

New member
If I cast a skill with a skill in one account, log out and log into another the timescast proxy record remains the same for both accounts.

Ran into this when a second account's breakfast script was misbehaving, as daily skills were being cast based on whether the timescast was lower than the dailylimit. As the timescast was carried over from the first account, none of the skills were cast.

This behaviour is present for me on v18.11 r19274.


Edit 2019/06/14:
Found out that the behaviour only exists for when you use the 'Logout of KoL' button and then log back in as someone else. When you 'Exit KoL mafia' and restart, it is fine.
 
Last edited:

Saklad5

Member
On a possibly related note, the number of times that you have visited a location does not persist across logins of the same account.
 

Veracity

Developer
Staff member
ProxyRecordValue:

Code:
		public int get_timescast()
		{
			return SkillDatabase.getCasts( (int) this.contentLong );
		}
(Slight termonology nit: a "proxy record" is conceptually a set of disparate named data elements - like a record - which you access from an "item", "effect", "skill", etc using the same syntax as you access the fields of a record object. Therefore, I would call "timescast" an "item proxy field" or something.)

SkillsDatabase:

Code:
	private static final Map<Integer, Integer> castsById = new HashMap<Integer, Integer>();
That map is not cleared when you log in a new character without restarting KoLmafia.

Code:
		public int get_turns_spent()
		{
			return AdventureSpentDatabase.getTurns( (KoLAdventure) this.content );
		}

AdventuresSpentDatabase:

Code:
	private static Map<String, Integer> TURNS = new TreeMap<String, Integer>();
Supposedly, that structure is serialized into "USERNAME_turns.ser" in LogoutManager and deserialized in LoginManager.

In other words, it is certainly intended to persist across logins.

Both of the reported behaviors seem like bugs, but they are actually not "related". I suggest you move the second one into its own bug report.
 

Veracity

Developer
Staff member
Revision 19902 resets SKILL.turnscast when you log in as a new user.
t also actually increments that when you cast a skill.
I don't see how the code as it existed worked.
Something must have changed.

Regarding LOCATION.turns_spent, that works just fine for me.

When I log in, it loads the serialized file.
When I visit a location, it increments the value
When I log out, it writes the serialized file.
And when I log in again, it has the last value, exactly as expected.

Perhaps you are bypassing "logout" by exiting or ^C-ing or something.
Don't do that.
 
Top