Bug - Fixed Mafia acts weirdly at very high levels

So, there are three issues that I've noticed regarding mafia and high level accounts in the past day-ish:

1. Mafia displays level improperly. Despite displaying correct stat info at login, equipping anything new or doing anything in the relay browser at all causes mafia to claim I'm level 216 with ~45000 in all of my stats.

2. Gaining too many substats from one combat can cause mafia to lock up. I don't know why. This happens inconsistently when gaining more than ~100M substats at once.

3. Mafia apparently uses a signed int32 to track daily substat gain. This means that if you gain more than ~2 billion substats in a day, mafia will say you have lost billions of substats, which is confusing.

Problems two and three are probably not a big deal, but the incorrect level display is actually pretty annoying. Anyone know what might be causing that and/or how to fix it?
 

Darzil

Developer
3 is probably needing AdventureResult and AdventureMultiResult to use longs rather than ints for count, SESSION_SUBSTATS, and any calculations involving either.

Unless I'm missing something, we don't appear to update stats based on api, just character pane, so I guess if there are calculations working it out they could get out of sync if using automated adventuring or carrying out actions in mafia not using relay browser and if they calculations use ints rather than longs.
 

lostcalpolydude

Developer
Staff member
Last time this issue was reported (this thread could be merged, if someone finds the previous report) I believe it was decided that it wasn't worth switching away from ints. I think that was before I was added on to the project.

Except I see now that totalSubpoints is a long[], so I don't know.
 

Darzil

Developer
Except I see now that totalSubpoints is a long[], so I don't know.
Yeah, there is some movement in that direction. Stats are ints, shouldn't hit an issue, Substats are longs, shouldn't hit an issue, substats to next level are ints, shouldn't hit an issue. However, the session tracking stuff is relates to the general AdventureResult stuff that is everywhere and handles many types of entry. It'd be a pain to handle, probably. If I had a character that was running into these issues I'd probably investigate and fix, but without that it'd be flying rather blind. I wouldn't be too surprised if we're hitting things like mistaken implicit conversions which are not fun to find without being able to test.
 

fronobulax

Developer
Staff member
If I had a character that was running into these issues I'd probably investigate and fix

If someone wants to tell me how to generate ~100M substats at once on a never ascended character (~level 133) with limited meat and very few IOTM toys, I'll be glad to test.

;-)
 
More details: Mafia, specifically, thinks I have 2,147,483,647 substats in each stat. This suggests it's an int32 cast problem.
EAiI6T3.png


Given substats are currently being treated as though they're maxint, seems likely enough. Can't be sure though, and I can totally be wrong.
 
Last edited:

Darzil

Developer
Yeah, we'd have to find where they are maxint, because in KoLCharacter they are longs. The AdventureResult stuff is the main place I've seen it.
 

Darzil

Developer
Try r14827. Still won't handle gaining 2,147,483,647 substats in a session, but might have a fighting chance of working otherwise.
 
Top