trashmonks / hagadias Goto Github PK
View Code? Open in Web Editor NEWPython package to extract game data from the Caves of Qud roguelike.
License: GNU Affero General Public License v3.0
Python package to extract game data from the Caves of Qud roguelike.
License: GNU Affero General Public License v3.0
While tile generation works great on Windows using the tile modding toolkit, on Linux certain tiles won't generate because of case differences in the directory structure.
Example:
Couldn't render tile for Great Magma Crab: creatures/sw_magmacrab.png not found
The creatures
directory is actually Creatures
, so this won't work on Linux.
This affects Cryptogull and should affect QBE users on Linux and potentially Mac OS.
hagadias/hagadias/tilestyle.py
Lines 348 to 366 in b4da83f
StyleExaminerUnknown
will need to be updated to account for the change, since it now involves a color element, not only a filepath element. A good example is Mechanical Wings, which use w
and W
as the tile colors, but when unidentified use C
.
Would be cool to load the various sultan mural images for use on the wiki. I assume those are hard-coded into some class somewhere.
We currently return None
for MA for anything with a mental shield:
hagadias/hagadias/qudobject_props.py
Lines 1620 to 1639 in 09900e7
However, things with mental shields are still subject to some effects that use MA in their calculation, such as Rebuke Robot.
We should calculate MA for these creatures so it can surfaced on the wiki.
currently, we check if something is an ACTIVE_CHAR if it inherits from certain objects, which is not ideal, because how the game determines something to be similar to it more granular. This is an open issue since I myself am not sure what specifically constitutes an active char, and want to get my thoughts organized. although here are my ideas:
ORIGINAL:
ACTIVE_CHARS = ['Creature', 'ActivePlant']
INACTIVE_CHARS = ['BaseFungus', 'Baetyl', 'Wall', 'Furniture']
which a method checks if the objects inherits from either of these. idk performance checks but this sounds slow
PROPOSED:
ALL_CHARS
ACTIVE_CHARS
INACTIVE_CHARS
These will no longer be a list of things that inherit, but rather a method that determines it on method call.
It was a lil container i made up that hagadias checks against so we don't get pronouns/combat stats for inanimate objects.
the current definition in comments:
ACTIVE: What is typically considered a Character, with an inventory* and combat capabilities.
INACTIVE: What would still be helpful to have combat related stats, but have things that make them different from active characters. Usually immobile and have no attributes.
*note that inactive chars like tables can still have inventories, so it really is just combat capabilities
attribute_helper
and attribute_boost_factor
which gives attributes to everything (combat check?)dv
, where inactive = -10, but active chars has a check for part_brain_mobile anywayma
, which all inactive have 0, and active default to 4marange
, which returns none for inactive and active has 4 and calculates range from willdemeanor
, which can easily be a brain check insteadgender
also, usages of ALL_CHARS:
I think the issue is lines 953-955 of hagadias/qudobject_props.py:
hagadias/hagadias/qudobject_props.py
Line 953 in c18b14e
'Brain': {'Factions': 'Beasts-100', 'Hostile': 'false', 'Wanders': 'true'}
(accurate to what happens in-game), but the template says faction = {{creature faction|{{FactionID to name|Cherubim}}|100}}
(no longer correct).As I was working on ?wikipage
embeds for cryptogull, I ended up having to make an extra API call to the expandtemplates API to remotely call Template:Grammar in order to parse look descriptions correctly to be displayed on Discord.
It would be nice if we can parse those descriptions in hagadias before uploading to the wiki instead. This would improve performance of the ?wikipage
embed by removing the need for the extra API call.
If we do address this issue at some point, we should completely remove the _parse_grammar
method from cryptogull's wiki_page.py
module, and we can also remove the single call to that method (self._look_description = await self._parse_grammar(self._look_description, wiki_text)
)
For example, Textures/Items/sw_Jam.bmp
which prevents tiles for "Starapple Preserves" and "Spine Fruit Jam" for loading.
Apparantly we don't load or show stats on the wiki for creatures without a combat part. Said stats are relevant for some of these creatures though, like 0lam, whose mental mutations are boosted by their Ego.
https://discord.com/channels/214532333900922882/482714670860468234/967968939114123264
The ceremonial vibrokhopesh is rendering with a purple handle, but the inherited detail colour is 'w'.
Currently items do not return what mod types can be applied to them (located in the tag.Mods_Value)
When DV is specified, it is a sum to the already base 6 DV in addition to agility + spry/tumble. If self.stat_DV_Value is a pointless check because all creatures inherit a base bonus +0 DV. however, in this conditional branch it only returns that bonus without calculating the rest of the agility. (see: cave spider with an DV of 2 in code, but in game has 9 because 6+ 2(bonus) + 1 (agi modifier) )
hagadias commit 70aa463 references a TTF file that was included in a matching commit to a different repository, TrashMonks/qud-wiki@876d41c. As a result, using hagadias standalone can yield
Show rules text (qudobject_props.desc
) and add the ego
field for things like Fist of the Ape God
E.g. this stuff: https://wiki.cavesofqud.com/index.php?title=Fist_of_the_Ape_God&type=revision&diff=9970&oldid=9969
egocarib reports
FileNotFoundError: [WinError 2] The system cannot find the file specified: 'Textures\\Items\\sw_mechanical_wings.bmp'
https://discord.com/channels/214532333900922882/482714670860468234/829323919810363412
<tag Name="RandomGender" Value="elverson" />
inherited from BaseMopango is not read and every mopango is defaulting to nonspecific genders.
regex only works by splitting by -, but if it's not valid it ignores the input. This causes some inputs to be parsed even if they should not:
input: ----
output: 0 (nothing is read, but no error because string is not blank and contains legal characters)
input: 7--2
output: 5 (expected: 9 but hagadias reads it as (7)(- or just 0)(-2) = 5)
This type of arithmetic is likely never going to be used normally, so just throwing an error here instead of properly negating the -2 would be fine.
A good example is Aloe Volta, which looks like this in game (1 of 4 similar-looking variations):
But is rendered like this on the wiki (using it's inherited Render tile, which isn't ever shown in game):
EaterStatue
is one of the objects with the most random tiles.
Even if we're not able to import all the variations, we should at least choose the tile from the first tile in the list of RandomTile part, to avoid having a completely incorrect tile, like in the case of the Aloe Volta.
33 str should be 39 because of the bilge spinchter's +6
the average of a dice roll needs to be able to be a fractional number in order to allow two dice distributions to be accurately compared. the int
call needs to be removed (and it needs to be tested working correctly with cryptogull)
This is desired for several reasons:
There may be a Python package capable of reading this data:
https://github.com/HearthSim/UnityPack
Some artificing shows up on mobile Discord when viewing the tiles generated by Cryptogull using hagadias on Linux. Check to see if it is Discord introducing these using a dirty resize method when it shows the tile larger on mobile.
Clockwork beetle now gets a lot of its properties from the Roboticized part, but those aren't currently loaded onto the wiki. For example, it becomes a robot and gains certain elemental resistances from the Roboticized part.
We may need to add some custom logic for the clockwork beetle to account for this.
We don't currently handle the RandomColors part. Would be nice to take that into consideration eventually.
Right now, the Hand-e-nuke is listed as a tier 1 object due to inheriting the 1 tier from the base grenade object. However, because its rarest bit is 8, it is actually tier 8. Hagadias needs to derive tier from most significant bit if the object can be disassembled AND does not have any tier other than those inherited. (HE Missile has bits BC1 but is specified to be tier 4, and cannot be disassembled)
There are currently 5 blueprints that have *XPValue
in them instead of XPValue
. I don't know if *XPValue
does anything or if it's just a placeholder, but it doesn't appear to directly determine the actual XP value like XPValue
does.
example: ickslug
contains <property Name="*XPValue" Value="0" />
, but actual XP earned on kill in game is 210.
I think this might be related to variable names being dynamically generated and stripping out the asterisk? I dunno.
Stuff like Casinlard and Polluxus currently adds mods names like electrified to the title parameter. While more accurate, it makes it harder to favilink (the name to search is electrified Polluxus
, for example. just Polluxus
will not work) unless I add a specific alternate display name. Mods already have all of their display names stored inside cargo, so moving it over to the wiki is not too difficult. This way, the plain title can be stored for favilinking, and the mod display names can be added afterwards.
This is just a suggestion so I'm open to debate about this.
Added test_MentalShield
in qudobject_props_test.py
:
def test_mentalshield(qindex):
assert qindex['Sawhander'].ma == None
assert qindex['Lurking Beth'].ma == None
Sawhanders's MA : 10 (should be None)
Lurking Beths's MA: -4 (should be None)
Both base objects Plant and Robot have MentalShield and should be inherited.
For the purposes of defoliant, checking whether it is a mutated plant or not is no longer sufficient; I have made a new extra info titled hurtbydefoliant
that checks the tag LivePlant
(which defoliant targets). it will do significant damage if it does not have a combat part OR has the tag GasDamageAsIfInanimate
Eventually i'll be looking to see what queries currently use MutatedPlant, and replace it with the new info. once that's done i'll delete MutatedPlant
We previously made an attempt to resolve inheritance order issues in 1f205b6
However, inheritance remains sensitive to order of appearance in ObjectBlueprints, and that needs to be fixed. For example, right now Vase
does not properly inherit stat_AV
from PhysicalObject
.
More info in this discord conversation:
One possible solution might be to set a flag after an object has its inheritance resolved, and then check that flag on the parent before attempting to inherit from it. But we might want to take another look at how the game handles this first.
From what I can tell, only these two objects are currently affected by inheriting a parent that comes after them:
Note:
The following stop-gap should be reverted after we fix this issue: 412f14a
We've been incorrectly factoring in the Boost
attribute of the stat
tag.
Currently, hagadias just adds the Boost
to the calculated sValue for the stat.
boost = getattr(self, f'stat_{attr}_Boost')
if boost:
val += f'+{boost}'
However, the game instead scales this boost based on the stat value itself, often resulting in a higher increase than the Boost value alone. The game does essentially StatValue * 0.25 * Boost
, rounded up
if (statistic.Boost > 0)
{
statistic.BaseValue += (int)Math.Ceiling((double)((float)num2 * 0.25f * (float)statistic.Boost));
}
else
{
statistic.BaseValue += (int)Math.Ceiling((double)((float)num2 * 0.2f * (float)statistic.Boost));
}
As a result, any creature with a Boost
has lower-than-expected stats on the wiki. Some discussion on the discord here.
Wreckstation and Jak both report:
FileNotFoundError: [WinError 2] The system cannot find the file specified: 'Textures\\Items\\sw_grave_moss_crushed.bmp'
https://discord.com/channels/214532333900922882/482714670860468234/829399273929310218
Certain objects can be opened or deactivated by either security cards or Psychometry. This is always defined by the SecurityClearance attribute on the following parts: Door
, PowerSwitch
, and ForceProjector
. The modes of access that correspond with the SecurityClearance attribute value are defined in XRL.World.Capabilities.SecurityClearance
.
It would be nice to load this info in hagadias (and then downstream on the wiki)
Liquid colors aren't currently properly supported for tile rendering (since the colors are hard coded in the game). We should define those colors as constants and properly support the colors for the purposes of tile rendering. (Liquids now use RandomTile for single-tile puddles, with 8 variations, which could be shown off on the wiki instead of the outdated puddle tile we use now).
It might be interesting to animate tiles by generating a secondary gif
animation when relevant. For example, all of the Ereshkigal mainframe tiles could be animated to look like they do in game.
This seems to be supported with the Pillow Image library we already use in a somewhat straightforward manner (brief example tutorial). Here are the official docs: https://pillow.readthedocs.io/en/stable/handbook/image-file-formats.html#saving
If we would go forward with this enhancement, we would want to do something on the wiki side to prevent the gifs from playing on every page. Probably it would be best to generate them as a secondary image referenced in the template, and then use some CSS magic or javascript to hide them on first page load. When someone clicks the "play animation" button, they can see the tile animated. On the discord side, it would probably be fine to show the gif
images unfiltered.
This project would involve a bit of complexity because many of the animated tiles in the game don't use a single unified framework to control their animations, so it would require simulating a few different code paths in the base game.
ontoclasm reports:
ERROR:pip.subprocessor:Command errored out with exit status 1:
command: 'C:\Users\user\.virtualenvs\qud-wiki-FCW-qFpB\Scripts\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\user\\.virtualenvs\\qud-wiki-FCW-qFpB\\src\\hagadias\\setup.py'"'"'; __file__='"'"'C:\\Users\\user\\.virtualenvs\\qud-wiki-FCW-qFpB\\src\\hagadias\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info
cwd: C:\Users\user\.virtualenvs\qud-wiki-FCW-qFpB\src\hagadias\
Complete output (33 lines):
[...]
FileNotFoundError: [WinError 3] The system cannot find the path specified: '/c/Users/user/.virtualenvs/qud-wiki-FCW-qFpB/src/hagadias'
This path was confirmed to exist in the msys2 environment.
The code currently uses ctypes.windll
to extract the DLL version field from Assembly-CSharp.dll
. This is apparently only available on Windows (see https://docs.python.org/3/library/ctypes.html#loading-dynamic-link-libraries). We need a cross-platform version of loading this information.
See: Alternate approaches at https://stackoverflow.com/questions/580924/python-windows-file-version-attribute
Items such as the Hologram Bracelet and Powered exoskeleton do not currently make any indication on the wiki that they require an energy cell to function.
QBE shows the "program" chargeuse cost to set Programmable or Reprogrammable recoiler to a new target location, instead of the chargeuse cost to use the recoiler to recoil to the location. The teleport chargeuse should still be 2500.
We should probably just note the higher "programming" charge use cost on the wiki page itself and update QBE to not import that value.
It is now becoming common practice for the game to use population tables for creature inventories - this is how pretty much all the new creatures for Palladium Reef patch are done (and there are others from Tomb patch that did this too).
As a result, the wiki is missing a lot of info about character inventories.
We should figure out a good way to load inventory objects from PopulationTables.xml
A few options to consider:
PopulationTables.xml
in hagadias directly, and use it for this (and potentially other things)PopulationTables.xml
in qud-wiki and add an override to def inventory
in qudobject_wiki.py
that resolves the population (would require hagadias to return the pop table from object blueprints first)The first option would probably be nicest since there are already a lot of other things we could be using this for (like the BUTCHERABLE_POPTABLES
dictionary in hagadias' constants.py
). The second option is more along the lines of what we do with cryptogull today.
A few recent template edits that should be reviewed and potentially accounted for in QBE logic:
Plus some similar discord-reported issues:
Because of how all of the skillsoft names are derived in cs code, we need manual renames of the displayname and with TreeSkillsoft, a page move to its proper name.
SingleSkillsoft1 -> Skillsoft [low SP]
SingleSkillsoft2 -> Skillsoft [medium SP]
SingleSkillsoft3 -> Skillsoft [high SP]
TreeSkillsoft -> Skillsoft Plus [tree]
Alternative: Move all skillsofts into one page like all the cybernetics wedges.
Armithaig has written a mod to dump attributes directly from in game. The best way to use these is probably to load them as attributes on a QudObjectProps, overriding calculated ones if necessary. This could be implemented as an optional loader method on a GameRoot.
https://discordapp.com/channels/214532333900922882/482714670860468234/744684741776900247
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.