Habitica: two-handed weapons/shields aren't easily identifiable as such

Created on 21 Jan 2017  路  11Comments  路  Source: HabitRPG/habitica

Most two-handed weapons aren't easily identified as such because they don't have anything in their text to state that they are.

We sometimes see bug reports from mobile app users when equipping a two-handed item unequips a shield. There are issues to give notifications about that when equipping them on the apps (https://github.com/HabitRPG/habitica-ios/issues/433 and https://github.com/HabitRPG/habitica-android/issues/688) but we should also include a message in each two-handed item's description on website and apps - i.e., the message should be in the data returned from the API's content route.

For consistency, the message should be automatically added to the end of the item's description when the item has a true value for the twoHanded attribute (e.g., the rancherLasso below). I.e., the PR for this change will NOT change any of the common/locales/en/ json files (with one exception listed below) but instead will modify the API's code to insert the message.

The message should be something like "Two-handed item." We won't use "Two-handed weapon" because future items might have more of a shield-like feel to them.

The PR should change weaponSpecialCandycaneNotes in common/locales/en/gear.json to remove the hard-coded two-handed description. I.e., change this:
A powerful mage's staff. Powerfully DELICIOUS, we mean! Two-handed weapon. Increases Intelligence by <%= int %> and Perception by <%= per %>. Limited Edition 2013-2014 Winter Gear.
to this:
A powerful mage's staff. Powerfully DELICIOUS, we mean! Increases Intelligence by <%= int %> and Perception by <%= per %>. Limited Edition 2013-2014 Winter Gear.

Example of a two-handed item:

  rancherLasso: {
    twoHanded: true,
    text: t('weaponArmoireRancherLassoText'),
    notes: t('weaponArmoireRancherLassoNotes', { str: 5, per: 5, int: 5 }),
    value: 100,
    str: 5,
    per: 5,
    int: 5,
    set: 'rancher',
    canOwn: ownsItem('weapon_armoire_rancherLasso'),
  },
medium Equipment status in progress medium level coding

Most helpful comment

@AndrzejDoyle The twoHanded message should be in the data returned from the API's content route because the website and mobile apps use the API to get the information about the gear (as do third-party tools). Have a look at the code in website/common/script/content/gear - that's where all the equipment is defined. The sets/wizard.js file will show you most of the twoHanded gear (for example, the code below). The text and notes fields take data from the locales files, with the t(...) function providing the translation. This would need some rework to have the new string appended to the notes, especially considering that for RTL languages (right to left), we can't put the new string at the end of the notes because then it would be read as being at the beginning.

let weapon = {

  0: {
    twoHanded: true,
    text: t('weaponWizard0Text'),
    notes: t('weaponWizard0Notes'), value: 0 },
  1: {
    twoHanded: true,
    text: t('weaponWizard1Text'),
    notes: t('weaponWizard1Notes', { int: 3, per: 1 }),
    int: 3,
    per: 1,
    value: 30,
  },

All 11 comments

It may be useful to consider this change in the context of #2028 (Split out mechanical and fluff descriptions of gear), if only to future proof the work done here so it does not have to be redone later.

I think that if we do this change using code that automatically adds the two-handed description on-the-fly, rather than hard-coding it into the locales files, then any rework later would be small. Also I suspect that #2028 will be in the on-hold / suggestion-discussion state for a while since it's not a simple change. The most promising idea there was @crookedneighbor's suggestion that the locales files would not contain the mechanical descriptions at all - they'd also be inserted automatically, and so that could easily be built around the fix for this issue.

Since there's been no complaints about my suggested approach, I've marked this as help welcome and adjusted the top post to make that approach definite rather than suggested.

Hi Alys, I'd like to take a look at this one. I think it could be quite straightforward, if we use a similar mechanism to the class-bonus suffix.

I'd like to add that I initially thought this was a website-only change, and it's taking me some time to get up to speed with the mobile apps. If anyone feels like they have a solution that would work across all three platforms, feel free to jump in and take over/team up!

@AndrzejDoyle The twoHanded message should be in the data returned from the API's content route because the website and mobile apps use the API to get the information about the gear (as do third-party tools). Have a look at the code in website/common/script/content/gear - that's where all the equipment is defined. The sets/wizard.js file will show you most of the twoHanded gear (for example, the code below). The text and notes fields take data from the locales files, with the t(...) function providing the translation. This would need some rework to have the new string appended to the notes, especially considering that for RTL languages (right to left), we can't put the new string at the end of the notes because then it would be read as being at the beginning.

let weapon = {

  0: {
    twoHanded: true,
    text: t('weaponWizard0Text'),
    notes: t('weaponWizard0Notes'), value: 0 },
  1: {
    twoHanded: true,
    text: t('weaponWizard1Text'),
    notes: t('weaponWizard1Notes', { int: 3, per: 1 }),
    int: 3,
    per: 1,
    value: 30,
  },

Ah - yes, we could it do that way (and it would certainly be easier!).

I was working on the assumption that the API should reflect the notes as they actually exist for the weapon (i.e. what we have now), and that the apps should use the twoHanded property to decide whether to append a suffix or not. I.e. the same thing that my previous commit does for the webapp.

Treating this issue as "automatically modify the weapon.notes property so that it says 'Two-handed item' without humans having to explicitly write it" makes this easier, albeit a bit less elegant.

But it means I don't have to do anything with the mobile apps' codebases, so it gets a +1 from me! :smile:

Should this be marked as in progress?

I'm putting this on hold because we're most of the way through a project to change the website's front-end code and this might no longer happen afterwards, or if it does, there'll be new code that will need to be modified to fix it.

Should this still be on hold?

I think I've seen more questions and "bug" reports about two-handed weapons with the new site than with the old, so we definitely still want this.

Labels updated.

Was this page helpful?
0 / 5 - 0 ratings