Caves of Qud

Caves of Qud

Show Weapon, Item Stats
38 Comments
SpaceLatency 1 Aug @ 6:23am 
could you add separate settings for with/without techscanning? it seems weird to be able to see the number of uses an item has until it runs out of energy without it but it makes sense if you do.
Zoloft Enthusiast 7 Jan @ 1:24am 
Oof sorry I missed the replies. Yeah - I'm not sure. They were dual jacked counterweighted morphogenetic rhinox horns, only the melee weapons were gone. I suppose it's more likely that I accidentally sold both than you made that wild of a typo, and no one else is reporting this bug as far as I can tell so I'm inclined to think this is a me thing, not a you thing
biocrystalluminescence  [author] 4 Jan @ 12:51pm 
Your Player.log (https://wiki.cavesofqud.com/wiki/File_locations) might also help, if you haven't restarted the game since then? Could put it in a new discussion.
biocrystalluminescence  [author] 4 Jan @ 11:58am 
Forgot to ask what the weapons were, or if you have any unusual mods.
biocrystalluminescence  [author] 4 Jan @ 11:53am 
Checked code and didn't see anything... in worst case, it should just display wrong. I don't actually know the code to remove items, so it'd have to be a really unlucky mistype, or a weird interaction with base game triggered by this mod? I'll ask on discord.
Zoloft Enthusiast 4 Jan @ 8:12am 
I think the latest update removed my melee weapons from the game. Updated the mod & they're gone now - they were there this morning & gone after the update
biocrystalluminescence  [author] 30 Dec, 2024 @ 11:51pm 
Tyrir 30 Dec, 2024 @ 11:40pm 
Not sure if this is in line with what you want to do with the mod, but it'd be handy to have some text or indicator that readable items are unread/unknown, data disks, books, etc.
biocrystalluminescence  [author] 25 Dec, 2024 @ 12:39pm 
Added __state features, so no more prefixes returning false/skipping, trailing | removed, and a few other things since.
and no problem, glad people enjoy it.
Pausbrak 22 Dec, 2024 @ 5:24pm 
Awesome, that's just what I needed! Thanks for making such a great mod!
biocrystalluminescence  [author] 21 Dec, 2024 @ 5:17pm 
Added options for item damage status, and to remove/reduce strength-scaling display.
Will look at the __state features in a bit.
Tyrir 21 Dec, 2024 @ 3:00pm 
else if (order == "Low to high")
for (int a = 0; a < num; a++)
{
esimateBuilder.Append(ave[a]);
if (where_order < 5)
{
avBuilder.Append("{{c|").Append(min + a * add).Append("}}");
}

if (ave[a] == 0) break;

if (a != num - 1) esimateBuilder.Append(daml);
if (where_order < 5)
{
if (a != num - 1) avBuilder.Append(avl);
}
}

The `break` should be in between the two so that there isn't a trailing |
Tyrir 21 Dec, 2024 @ 12:41pm 
[code]
public static bool AddMissileWeaponDamageTagPrefix(GetDisplayNameEvent __instance, out DescriptionBuilder __state)
{
char do_r = Options.GetOption("BCL_Damage_Option_What")[0];
if (do_r == 'N' || do_r == 'M')
{
__state = null;
return true;
}
__state = __instance.DB;
__instance.DB = new DescriptionBuilder();
return true;
}


[HarmonyPostfix]
[HarmonyPatch(nameof(GetDisplayNameEvent.AddMissileWeaponDamageTag))]
public static void AddMissileWeaponDamageTagPostfix(GetDisplayNameEvent __instance, GetMissileWeaponPerformanceEvent E, DescriptionBuilder __state)
{
if (__state != null)
{
__instance.DB = __state;
}
[/code]
Tyrir 21 Dec, 2024 @ 12:41pm 
> that one was necessary because it uses AddTag(string) rather than 'return string'

fyi, I used harmony's __state feature to handle your AddTag() issue. I'll post example code in next comment because of steam's character limit in comments.

https://harmony.pardeike.net/articles/patching-prefix.html#passing-state-between-prefix-and-postfix
Pausbrak 21 Dec, 2024 @ 9:05am 
Great mod! I'm enjoying it so far, but I was wondering, would it be feasible to add some kind of indicator in the name for damaged items? (health damage, not [broken]) My biggest inventory annoyance right now is accidentally taking a bath in acid or lava and then having to go through my inventory items one by one to find which ones got damaged, and having some kind of little symbol or something in the name would make it much easier.
Tyrir 21 Dec, 2024 @ 8:25am 
> Started an Artifex with 1k of DataDisks, Artifact 2's, and Artifact 3's, then another ten with 200 of each table. Takes a while in worldgen, but no crashes or log issues. Doesn't seem to be that.

Hmm.. Not sure what to tell you. I had no other mods and this mod set to defaults (or mostly defaults), and was easily able to reproduce those errors. Possible my base game option settings were to blame somehow, maybe debug options that I had enabled.
Tyrir 21 Dec, 2024 @ 8:23am 
> The default settings of this mod instead shows "Str→7 ♥4.5 ■13|5→♦0|5", which in order means:
> PV increases with 'Str' or strength, up to a cap (shown in description or with base game option 'display detailed weapon penetration' on). This option is mostly because some popular mods have weapons with PV that increase with Agility instead, but I don't think base game has any, so can be turned off if so.

Could possibly have an option that works like:
1. Do not show attribute that increases PV
2. Show attribute that increases PV
3. Show attribute that increases PV when it isn't Strength
biocrystalluminescence  [author] 20 Dec, 2024 @ 3:17pm 
Started an Artifex with 1k of DataDisks, Artifact 2's, and Artifact 3's, then another ten with 200 of each table. Takes a while in worldgen, but no crashes or log issues. Doesn't seem to be that.
Tyrir 20 Dec, 2024 @ 2:34pm 
In populationtables.xml in the caves of qud install, I set the number of artifacts to 10-11 for <population Name="StartingGear_Artifex" to more consistently repro the issue.
biocrystalluminescence  [author] 20 Dec, 2024 @ 2:22pm 
Huh, got a crash on my 3rd or 4th try (though mine didn't mention data disks or 'at [class]' or anything helpful really, so I didn't think to save it), and then nothing for like 50 more Artifexes, which is weird. Wished in 1k data disks without issue, so isn't that.
Can't reproduce, maybe missing something.
biocrystalluminescence  [author] 20 Dec, 2024 @ 1:27pm 
MissileWeapon was the first one I did, and that one was necessary because it uses AddTag(string) rather than 'return string', so there's no way to remove/alter the existing string if it runs, and I haven't found a way to remove tags; there might be a way to remove the whole line, but that'd probably cause more issues.

Some of the others probably aren't strictly necessary per se, but if I already have to use prefixes to skip, and the new code is more replacement than addition, then may as well skip the originals too if they're not being used. And since they're all the same,

Started a few Artifex, got some missile weapon disks, then crashed, although that log isn't saying anything. Will have to test more.
Tyrir 20 Dec, 2024 @ 9:12am 
I was able to fix the world generation locking issue by removing all 4 harmony prefix patches from the patch files (alternatively, make sure they return true; so that they don't prevent the originals from running), in addition to the if (actor == null) {return;} check mentioned previously.

The prefix patches don't do anything other than prevent the original function from running under certain conditions. Unless I'm missing something, the prefixes appear to be redundant because, in the postfix patches, the same check is performed a second time. I didn't look at the original function decompilation, but it must be caching/inserting something into a dictionary that results in the various errors with key lookup exceptions and null pointer exceptions.

In general, it is best practice to allow the original function to run when writing prefix patches, unless there is good reason to disallow that.
Tyrir 20 Dec, 2024 @ 6:48am 
There might be a bit more to this issue than I realized. There seems to be more issues that cause world creation to get stuck at history generation, even when the display name modification is aborted when Player is null (before the player is created during world generation).

Having data disks on the character seems to be the most reliable way to reproduce the issues, so True Kin -> Artifex has been the most reliable. I posted another error stack trace in the discussion forum for this mod.

I'm still trying to figure out what exactly is causing the issues.
Tyrir 19 Dec, 2024 @ 10:49pm 
In case you wanted to track down where/when exactly this issue occurs, I posted the full stack trace from the log into a discussion thread as it is too big to fit in these comments.


> Hm, in that case I might just throw a 'if actor == null, quit or just use original function' in there then. Shouldn't be a problem if game wasn't trying to show item names anyway?

It should be fine to just return if actor == null since these are in a harmony postfix (the original already ran and produced '__result').
biocrystalluminescence  [author] 19 Dec, 2024 @ 10:42pm 
Hm, in that case I might just throw a 'if actor == null, quit or just use original function' in there then. Shouldn't be a problem if game wasn't trying to show item names anyway?
Tyrir 19 Dec, 2024 @ 10:29pm 
> Can you recall what was happening, like were you walking into/loading a new zone, or had just come into sight of a Boulderer, or had the Boulderer already thrown a few rocks, or anything else?

It happens numerous times during world creation before taking a turn. Perhaps it is generating legendary/hero monsters and somehow the methods decorated by this mod are invoked?
Tyrir 19 Dec, 2024 @ 10:29pm 
> I'm pretty sure it shouldn't be 'actor' because those use "GameObject actor = __instance.ParentObject.Equipped ?? IComponent<GameObject>.ThePlayer;" which is code with null check from the base game.

if both __instance.ParentObject.Equipped and IComponent<GameObject>.ThePlayer are null, then `actor` will be assigned null.

I'm sure actor being assigned null is the issue here. I added the following after those 2 places in the code assign a value to actor to address the issue, and I see in the debug logs in player.log:

if (actor == null)
{
XRLCore.Log("MODWARN [Show Weapon Stats (Range; Damage vs AV)] - MeleeWeaponPostfix: actor is null");
return;
}
biocrystalluminescence  [author] 19 Dec, 2024 @ 10:16pm 
Messed around with/possessed a Boulderer for a bit, and couldn't reproduce.

I'm pretty sure it shouldn't be 'actor' because those use "GameObject actor = __instance.ParentObject.Equipped ?? IComponent<GameObject>.ThePlayer;" which is code with null check from the base game. Although not sure what else it could be either, since the only other object is "__instance.ParentObject", which is just the item.
I'll add "?? IPlayerPart.ThePlayer;" to the actor initialization, but not sure if that'll do anything.

Can you recall what was happening, like were you walking into/loading a new zone, or had just come into sight of a Boulderer, or had the Boulderer already thrown a few rocks, or anything else?
Tyrir 19 Dec, 2024 @ 6:14pm 
Same issue (no check for actor == null) is in Melee_Patch.cs too
Tyrir 19 Dec, 2024 @ 6:07pm 
MODERROR [Show Weapon Stats (Range; Damage vs AV)] - Failed creating:Glittermensch Boulderer: System.NullReferenceException: Object reference not set to an instance of an object
at XRL.World.GetThrowProfileEvent.Process (System.Int32& Range, System.Int32& Strength, System.Int32& AimVariance, System.Boolean& Telekinetic, XRL.World.GameObject Actor, XRL.World.GameObject Object, XRL.World.GameObject ApparentTarget, XRL.World.Cell TargetCell, System.Int32 Distance) [0x0013e] in <92095d38a1a94620890943b3fa8613ab>:0
at BCL.Display_Weapon_Stats_HarmonyPatch.Thrown_Patch.GetPerformanceTagPostfix (XRL.World.Parts.ThrownWeapon __instance, System.String& __result) [0x0024e] in C:\Program Files (x86)\Steam\steamapps\workshop\content\333640\3371639487\Thrown_Patch.cs:79
biocrystalluminescence  [author] 16 Dec, 2024 @ 2:39pm 
The game originally would show "→7 ♥1d8", which means 7 →PV (Penetration Value), and for each penetration, ♥damage equal to 1d8 or one 8-sided dice. On average, a hit will have more penetrations the higher it's PV is relative to the target's ♦AV (Armor Value), but 'how much more damage is that' is kind of vague even to long time players, so I made this mod.

The default settings of this mod instead shows "Str→7 ♥4.5 ■13|5→♦0|5", which in order means:
PV increases with 'Str' or strength, up to a cap (shown in description or with base game option 'display detailed weapon penetration' on). This option is mostly because some popular mods have weapons with PV that increase with Agility instead, but I don't think base game has any, so can be turned off if so.
biocrystalluminescence  [author] 16 Dec, 2024 @ 2:39pm 
♥4.5 is the average of the 1-to-8 dice roll and any +/- modifiers. Note this is damage per penetration, so doesn't count stuff like flaming or freezing weapons, because those item mods deal damage once on any hit, shown in description.
■13|5→♦0|5 means that the weapon will do 13 damage on average against a target with 0 Armor Value ('average' meaning anywhere from 0 to like 30 is possible), and 5 average damage against 5 AV, taking into account the average damage and average expected penetrations, but not critical hits. It also doesn't take into account flaming/freezing, but those are easy to add on. This value can also be used to estimate how much damage a weapon will do to you, with your AV.

The options for this mod should mostly show what they do as well, so it's recommended to check those out. Once you're familiar with Qud's stats, you can reduce those to just display the first letter (S for strength), or adjust set AV values to enemies you have trouble with, etc.
jonpfl 16 Dec, 2024 @ 4:24am 
I just subscribed to this mod but I am wondering what the numbers mean. I look at a weapon and it says the following "carbide long sword Str -> 7 <heart> 4.5 <square> 13 | 5 -> <diamond> 0 | 5"
Folkherobob 13 Dec, 2024 @ 4:45am 
Works fine in 1.0 from what I can tell
Arendeth 29 Nov, 2024 @ 1:14pm 
Thanks for updates and such currently doesn't break inventory of current character
biocrystalluminescence  [author] 28 Nov, 2024 @ 6:53pm 
Update out, and it turns out there's a wish to add every item in the game, so just tested that with default settings, and it works!
So any more of that kind of bug should be unlikely.
biocrystalluminescence  [author] 28 Nov, 2024 @ 1:54pm 
@Arendeth
Added Issues and Troubleshooting section to description.

In your case, since the Inv wasn't opening, then it was a combination of an item in there and specific options (although I didn't test every item in the game, so it could be default options).
It's probably not a mod conflict, though a mod could have an unusual item? But a new game with the same item (base or mod) would have the same problem.
See the above Issues section.

Also, will update to make mod more stable soon-ish (initializing all stringBuilders with "" instead of null, so don't fail if used while null), it may fix the issue.
Arendeth 28 Nov, 2024 @ 1:07am 
might have a conflict with one of my mods or maybe I need a new game to not break my inventory with this mod active (disabling the mod fixed the inventory of character and merchant that refused to open) this was with the beta branch