RimWorld

RimWorld

Xml Patch Helper
81 kommentarer
Leutian Kane 12. aug. kl. 18:51 
a walkthru on how this works would be nice, as the profiler for the Xpaths keeps erroring out
Nepenthe 4. aug. kl. 21:30 
Just want to say thanks for this mod - I've been using it for years and makes XML patching a lot easier.
Sisyphus 21. juli kl. 14:53 
your the man Phil!
Proxyer 19. juni kl. 3:35 
YES! YES! Ty update!! Making patches just got easier!
Aria Victoria 18. juni kl. 23:18 
TY <3
Aria Victoria 18. juni kl. 19:39 
Oh, I guess the github link is old? Last update on the repo is showing as last year.
Smash Phil  [ophavsmand] 18. juni kl. 19:33 
Oh yea sorry, this is already updated to 1.6 I just haven't pushed it to steam.
Aria Victoria 18. juni kl. 19:15 
No rush (As I know you're already super busy as it is), but, is there any chance of a 1.6 version? I've only been without it for a few days and am already looking at the mod page longingly.
cyanobot 21. feb. kl. 9:04 
Thank you for many diagnosed typos, invaluable tool.
Smash Phil  [ophavsmand] 28. sep. 2024 kl. 17:38 
This isn't really set up to test those, but the concept would be the same as just trying to add that single <li/> node. The point is being able to quickly validate that your xpath is correct and that you're inserting the value exactly where you want it. Nested nodes or not, it would be the same.
123nick 28. sep. 2024 kl. 6:40 
How do you test a patch that adds multiple layers of nodes to a node?

For example, when theres a weapon that has a "costList" field, and each node below it is <ResourceName>x</ResourceName>, where X is the count of resources, then its easy to just add one using the node and value fields this mod has

But if im trying to add an ingredient to a recipedef, to the <ingredient> node, each ingredient is layed out as such:
<li>
___<filter>
________<thingDefs>
__________________<li>ComponentSpacer</li>
________</thingDefs>
___</filter>
___<count>6</count>
</li>

How do i test a patch that adds the li node AND its child nodes to the ingredients node?
aikixd 10. sep. 2024 kl. 22:31 
Here's a larger samples with coloration removed:
<li></color>
<def></color>Spine</color><<i></i>/def></color>
<coverage></color>0.05</color><<i></i>/coverage></color>
<depth></color>Inside</color><<i></i>/depth></color>
<<i></i>/li></color>
aikixd 10. sep. 2024 kl. 22:30 
Yeah, it's a malformed tag. I'm no modder, but a sw dev. If you can point me, I can try to find the source. It seems that `<i></i>` it pushed after the tag opener on an ending tag. If you remove that, then the ending tag becomes correct: `</def>`. When I find-replace `<i></i>` -> ``, the document becomes well formed.
Smash Phil  [ophavsmand] 10. sep. 2024 kl. 12:06 
As an FYI you have
<li>
< (this is the invalid character)
</li>
in your results. Which is no good
Smash Phil  [ophavsmand] 10. sep. 2024 kl. 12:05 
That’s usually when the result has some symbol I didn’t account for. The coloration of the text is just rich text, so if some symbol closes the rich text brackets prematurely then you’ll see those brackets instead of their color effect.

In this case, < is one such symbol. Not sure what def has that as input, it’s already a reserved character in xml.
aikixd 10. sep. 2024 kl. 11:26 
Yeah, there's something weird going on here: `<color=#3CBEF0FF><<i></i>/def></color>`
aikixd 10. sep. 2024 kl. 11:14 
Same issue as @Jesse - color tags are shown as literals. Path: `Defs/BodyDef[defName="Bird"]`
Smash Phil  [ophavsmand] 12. aug. 2024 kl. 1:32 
doesn't matter
Carxofing 11. aug. 2024 kl. 17:45 
What is the best position of Xml Patch Helper in the mod list? At the beginning or at the end?
Mana 19. juli 2024 kl. 12:43 
I'm late to the modding game and want to thank you PROFUSELY for sharing this. Lifesaver.
Carxofing 30. maj 2024 kl. 3:10 
@smash Phil Thanks:steamthumbsup::steamdance:
Smash Phil  [ophavsmand] 19. maj 2024 kl. 6:49 
You don’t have to compile anything. Harmony is a dependency, so you’ll need to download that mod on the workshop which will come with a pre compiled dll.
Carxofing 19. maj 2024 kl. 6:46 
@Smash Phil I downloaded the mod from github and now I was reading the readme file. I just can't figure out how to compile the Harmony file or what program to do it with. I would appreciate it if you could tell me how to do it.
The Dutchman 4. maj 2024 kl. 13:03 
@Rokuni Try paying attention to the pictures....
Rokuni 30. apr. 2024 kl. 16:03 
is there a guide or something? once i click on it there's no xml whatsoever
Jesse 21. apr. 2024 kl. 0:35 
I was looking at the BodyDef for snakes.
Smash Phil  [ophavsmand] 20. apr. 2024 kl. 0:55 
I'll look into it. Which body def?
Jesse 20. apr. 2024 kl. 0:02 
There seems to be some kind of glitch when looking at BodyDefs with the patch helper in 1.4. Everything inside the codeblock turns grey with the color tags showing.
Smash Phil  [ophavsmand] 11. apr. 2024 kl. 18:31 
Updated to 1.5
The Blind One 10. mar. 2024 kl. 19:28 
Roger that, thanks for the clarification.
Smash Phil  [ophavsmand] 10. mar. 2024 kl. 17:53 
That’s intentional, since it would be arbitrary which patches do or don’t apply to the xml shown in the window. It would end up being confusing without additional UI
The Blind One 10. mar. 2024 kl. 0:37 
So I was using this tool but it doesn't seem to recognize when a patch has patched another mod.

For example;

I have a mod that adds a building to the game
I then have a mod that patches that building's defs to some degree.

Now if I use this tool to check the def of that building, it shows the original def values of the building but not the actual in-game defs as when the patch is applied.

It's a minor thing but it got me confused for well over two hours thinking my patch didn't apply :lunar2019crylaughingpig:
Monkey Magic 9. mar. 2024 kl. 18:46 
Is there a video on this? Would be nice to see this running as an example
Ixcatl 4. mar. 2024 kl. 12:46 
really helpful little piece of kit to remind me how to work with this shit. thank you!
CTH2004 19. nov. 2023 kl. 11:56 
Just to double check, this is soeley for debuging, so it won't be necessary as a requirment if used to assist in creation?

I'm pretty sure that's accurate, just double checking! Thanks!
Smash Phil  [ophavsmand] 26. sep. 2023 kl. 14:03 
well it wouldn't be a one liner fix, but knowing that it's just not picking up the type certainly helps. The xpath field would need to be fetched via reflection. The mod is open source btw, github link is in the description if you'd like to submit a PR, but it might be a good idea to chat with me on discord before you do that so you don't take an approach that wouldn't be acceptable.

Just ping me if you decide to work on it yourself, I'm open to PRs on all my mods as long as the code is solid and there aren't any potentially performance ruining changes.
Malnormalulo 26. sep. 2023 kl. 13:46 
I totally understand. I took a quick look, and it seems the problem is that you're retrieving subclasses of PatchOperationPathed, while XML Extensions directly extends PatchOperation to add some extended functionality. Its pathed operations still have a String field named xpath, though, and it looks like that's all you're really relying on, so this might be a one-line fix (or nearly – might need to handle operations without an xpath field differently).

Hopefully that bit of digging helps. If implementing it and testing it is still a ways off with that figured out, I could try to submit a PR. Probably about time I get around to setting up an environment for C# development anyway.
Smash Phil  [ophavsmand] 26. sep. 2023 kl. 12:41 
I can look into it when I have time, but it likely won't be any time soon. I'm incredibly busy. If their patches aren't working by default, then they might require some special handling.
Malnormalulo 26. sep. 2023 kl. 10:15 
The dropdown of different patch operations includes various ones added by other mods, but the patches added by XML Extensions aren't listed. Any chance of enabling support for these? I'm currently debugging an issue using one of those operations where this tool would be super helpful.
Auld 10. sep. 2023 kl. 10:05 
Extremely helpful mod, thanks!
Smash Phil  [ophavsmand] 8. aug. 2023 kl. 19:05 
You're gonna have to elaborate, I'm not sure what you mean
Codingale 8. aug. 2023 kl. 18:38 
Hey is it possible to have it cache the playmode fetch? Or would that result in a large amount of memory used in the runtime? Thanks for this mod, so much easier now
Marcy 21. maj 2023 kl. 15:29 
this finally helped me actually figure out how xpaths worked and saved me hours of frustration, i owe this mod my life
Expectation... 4. apr. 2023 kl. 1:51 
What a useful mod for creating patches!
sel 29. jan. 2023 kl. 15:03 
thank you for this mod! this helped immensely in understanding how to make patches.
klvlt 12. jan. 2023 kl. 4:45 
This mod has been (and still is) immensely helpful to me while learning the mysteries of the xpath. Thank you so much for creating and sharing it!
Smash Phil  [ophavsmand] 8. jan. 2023 kl. 12:09 
@Kaedys Yea, this is intentional otherwise I would have to determine the execution order of the mod list's patches based on where Xml Patch Helper is in the list. In the future I may add some menu to toggle which mods to execute their patches but this is a bigger task than you think and I'm very pressed on personal time already.

So to answer your question, no. This is strictly the combined xml doc before inheritance and before any xml patches. Maybe in the future when I have more time
Kaedys 8. jan. 2023 kl. 11:39 
Seems like the XML is sees is *before* patches are applies. For example, I have a patch that modifies the leatherdef of a bunch of animals (my own local frankenstein of the various Optimized Leather mods), including one that patches out every usage of, say, Leather_Rhinoceros. I know this is working, because the game does not complain about a missing def for a Race wanter, and the animals in question drop the altered leather def. Yet when I search for "Defs/ThingDef[race/leatherDef="Leather_Rhinoceros"]", it shows me all of the original defs that had it. Is there a way for the mod to show me the XML as it exists *after* all of the existing patches are applied?

It makes it annoyingly difficult to use the mod to test a new patch, since I cannot build off of any existing patches. With Unified XML Export defunct, this appears to be the best window into the XML available, but if it only shows me the XML before patches are applied, that usefulness is rather more limited than I'd like.
The Blind One 29. nov. 2022 kl. 11:45 
Ayo thanks for this mod, figured out how to do a few xpath patches thanks to the tool saving me a lot of time and work <3
Smash Phil  [ophavsmand] 13. nov. 2022 kl. 15:34 
Ask in the RW discord server, not here.