Template talk:Infobox weapon poe2

Incorrect weapon_bonuses usage
The usage of both weapon_bonuses and curr_enchantments has been giving me a real headache recently. I was working on the template Template:Cargo enchantment item poe2 today, so that we can finally get the "Items with enchantment" table going in poe2 enchantment pages, and I noticed that most weapons in poe2 are using the weapon_bonuses field to store enchantments (with very few using curr_enchantments). Previously, I assumed that this was the correct usage - but I had a look at some examples of how it was done for poe1 weapons (in Special:CargoTables/Weapon_poe1), and it seems that this is not case. We've been doing it all wrong!

To me, and probably to most, the distinction between these fields is vague, since what would be considered weapon bonuses and weapon enchantments are both listed under the same heading in-game. As I understand it, enchantments are complex effects come into play as a result of using the weapon - with curr_enchantments being enchantments that a weapons starts with (as listed in leftmost column of the enchanting panel). Weapon bonuses are effects that are always present on the weapon, and cannot be removed or upgraded (therefore excluding quality modifiers), for example Veil Piercing, Increased Reach, Accurate.

If this is the agreed definition, which it seems to be with poe1 weapons, an admin is going to have to work some magic to fix it (CompleCCity,Tagaziel). This would involve moving the data from the weapon_bonuses field to the curr_enchantments field in all poe2 weapons pages. It looks like this wiki has Replace Text installed, so here's what I suggest:

Search expression \|\s*\bweapon_bonuses\b\s*=\s*(\w+.*)\n\|\s*\bcurr_enchantments\b\s*=\s*\w*\n Replacement string If the replacement string allows control characters, it might also work with Limit to the category Category:Pillars of Eternity II: Deadfire weapons (might have to repeat for Category:Seeker, Slayer, Survivor weapons and Category:Beast of Winter weapons)
 * weapon_bonuses   =
 * curr_enchantments = $1
 * weapon_bonuses   = \n| curr_enchantments = $1\n

That expression matches the weapon_bonuses and curr_enchantments lines, capturing the value of weapon_bonuses. Excluding cases where there isn't a value for weapon_bonuses. This assumes that these two lines are next to each other, and in that order - which seems to be the case for all the pages I checked. I'm not super familiar with regex, but in testing this should work, assuming Replace Text uses php-flavoured regex.

A simpler alternative of course would be to point the template at the weapon_bonuses field instead. However, I feel that we should aim to be consistent with what conventions already exist, and fix issues rather than mask them, so although this is more involved - I think it's the right decision.

This all assumes that I'm correct with what these fields are meant for :p

Macklin (talk) 12:33, 16 November 2018 (UTC)


 * And you say, you're not "super familiar with regex" – personally, I can't get any sense out of that code. ;) (I simply don't understand regex, but perhaps haven't found the best learning material about it, yet.)


 * You're, however, right with your interpretation of which field has what purpose.


 * I could offer my bot. Running AWB. But I'm not sure, I get the "Find and replace" thing right with it. The Replace text feature doesn't offer a "search expression" as you mention it. I can enable regex, but the input field still wants the "original text". (I've tried you're expression, but nothing was found.) Here's what's explained about regex there: "(Example: values of "a(.*)c" for "Original text:" and "ac$1" for "Replacement text:" would replace "abc" with "acb".)"


 * Cool – admin, bot owner … and no idea about anything. *sigh* -- UserCCCSig.png  -- You talkin' to me? -- cCContributions -- 13:09, 16 November 2018 (UTC)


 * Hmm, I thought it might not work first time. The Replace Text site says that it uses a "small subset of the PHP and MySQL/PostgreSQL regular-expression set." I don't think I'm using any exotic expressions, so my guess is the syntax is slightly different.


 * I've always thought regex looks like someone just mashed the num row for a bit. Seeing some regex that someone else came up with always makes no sense. I bet if I looked at this tomorrow I would feel the same way. To be honest I don't even bother with properly learning, I just experiment using a site like regex101 until whatever I'm working on seems to do what I want it to. Have a look here to see how the expression functions in this instance. https://regex101.com/r/Le7na4/1


 * And yep, the "Search expression" above should be for the "Original text" field in Replace Text.


 * I had a quick look over it, seems like "\R" doesn't mean carriage return + line feed in all variants of regex. I updated the expression above, could you see if it finds anything with that? If that still doesn't find anything, try putting a "\r" before both instances of "\n".


 * AWB, doesn't that still need admin perms? I see it's a standalone program - does that mean I'm able to test stuff with an example set? If so I could see how to achieve the same thing there, and pass you the details. Macklin (talk) 15:39, 16 November 2018 (UTC)


 * I make another attempt later.
 * Take a look here for how AWB works on Gamepedia wikis, and specifically the "follow the steps here."-link. For null edits, this is okay. Or testing purposes. And your "bot" can only have the same rights as your own account. But if you plan on doing indeed bot-work, then you would need an additional bot account – otherwise you would raise your edit count excessively. -- UserCCCSig.png  -- You talkin' to me? -- cCContributions -- 16:51, 16 November 2018 (UTC)


 * Downloaded AWB, seems like a pretty neat program. My regex seems to work well, but I'm super hesitant to actually save the edits. I don't really plan on doing any "automated" work here, just mass edits like what I've described - and probably only on the rare occasion where necessary. Given this, would using a bot password, instead of a dedicated bot account be okay? If I use a bot password, will these changes be attributed to my account? Is there any way to omit these changes from the changes log, or is it okay if I spam it with hundreds of edits? There's about 260 pages that need updating, which isn't really a whole lot relatively speaking - but I'd rather be safe than sorry. Macklin (talk) 18:00, 17 November 2018 (UTC)


 * You wouldn't be the first using a bot tool with their regular account.
 * I'd say, if this is the only mass edit you're going to do, it's okay. If the next step would be to add new infobox parameters to or remove categories from all these pages, then make a bot.
 * As far as I know, there's no way to not flood the RC - "hide bots" checks the account, not a tool. Don't activate Autosave, or keep the 10 seconds break between them.
 * -- UserCCCSig.png  -- You talkin' to me? -- cCContributions -- 09:06, 18 November 2018 (UTC)
 * Alright, I'll keep that in mind. Many thanks for the assistance. I think I might as well make a bot, even if I don't end up using it. I don't know what kind of stuff I'm going to need to do later on, and I'd rather it not be an eyesore in the recent changes. I assume I just make another Twitch/Gamepedia account and let you know?
 * Just for reference - and semi unrelated to this talk page, here's the plan to add "Items with x enchantment" to poe2 items:
 * Fix/finish the queries in Template:Cargo enchantment item poe2.
 * Add auto category to Template:Infobox enchantment to add Category:Pillars of Eternity II: Deadfire enchantments (might as well)
 * Mass edit on all poe2 weapons, swapping weapon_bonuses to curr_enchantments
 * Mass edit on all poe2 enchantments, replacing Template:Cargo enchantment item with Template:Cargo enchantment item poe2.
 * Now that I think of it, I could make my life easier by using a switch in Template:Cargo enchantment item instead of using a whole new template, doing the poe2 queries if the enchantment in question is added in poe2, otherwise doing poe1 queries, etc. That would save having to replace the templates, but would add another query to fetch the added_in field from the enchantments_poe1 table. Speaking of, do you think there's any worth in splitting the poe2 enchantments off into their own table? I feel like it would be a lot of effort for no reason, but some part of me wants the "enchantments_poe1" table to actually live up to its name. Macklin (talk) 15:14, 19 November 2018 (UTC)


 * "Mass edit on all poe2 enchantments, replacing Template:Cargo enchantment item with Template:Cargo enchantment item poe2" is absolutely bot work and already the – at least – second item on your list, so, yes, bot! You've got my support, but I can't make you one. So,
 * think up a second username which should identify it as a bot (CompleCCyber didn't really find positive feedback but was accepted then (I've a "CompleCCyborg" elsewhere, which is better); usually "bot" is part of the name and it's linked to your real username – Macklinbot would be a good (bud plain boring) example; perhaps MackBot or something …
 * create this second account on Twitch – using your original eMail-address is working and okay – and log in with it here; to avoid confusion, consider using different browsers for Macklin and the bot login
 * link that bot account to your user account and perhaps – as I did for User talk:CompleCCyber – redirect the talk to your own
 * place a note on your own profile that mentions that bot
 * contact Tagaziel who has the right to set the bot flag (or at least knows somebody who can)
 * and then you're fine to go from the point of time on when the account is marked as a bot (and then you also can reduce the time between autosaves to 1 second – never tried 0 myself, however)


 * I'll take a look into the other things, you mentioned, tomorrow. And, of course, you're welcome with all this – why should I not give you my assistance? ;) -- UserCCCSig.png  -- You talkin' to me? -- cCContributions -- 19:56, 19 November 2018 (UTC)


 * I have finalized the queries in Template:Cargo enchantment item poe2. It performs queries for all fields that enchantments are present in (across all items, shields, armor and weapons in poe2). All that needs to be done is the substitution of Template:Cargo enchantment item poe2 on all poe2 items.
 * Before this happens, I'd like some input on the discussion of a universal field for enchantments. Since this doesn't only apply to weapons, I've added a new section to the talk page, here: Pillars of Eternity Wiki talk:Community portal Macklin (talk) 13:50, 27 November 2018 (UTC)