mainIine / foe-helfer-extension

FoE Helfer - Extension for chromium based browsers and Firefox ;-)
https://foe-helper.com
GNU Affero General Public License v3.0
119 stars 181 forks source link

add pvp-arena box to show different lists of the pvp-arena protocol #2719

Closed dersiedler1 closed 6 months ago

AlfonZ42 commented 6 months ago

I got the following error when opening PVP arena.

TypeError: Cannot read property 'length' of undefined
    at Object.multisort (_helper.js?v=3.4.0.0:87)
    at Object.StartPvPArena (pvparena.js?v=3.4.0.0:131)
    at pvparena.js?v=3.4.0.0:163

The response causing it is in PVPArenaService_getOverview-undefined_length.zip. Player ids and names were sanitized, so hopefully you'll be still able to reproduce it.

Beelzebob6666 commented 6 months ago

I have the same issue - probably the object is not correctly initialized

Beelzebob6666 commented 6 months ago

maybe get rid of your sorting?

the helper already has a sorting feature for tables - sorting is done in the output only: the containing the table heads needs class "sorter-header" the that you want to sort by number need class "is-number" - "is-text" should be presumed if nothing is given - you can give class "ascending/descending" if you want to set an initial sorting direction when sorting numbers, the individual need class "is-number" and data-value "data-number=[1-9]" when sorting text, the individual need "data-text=[a-z]"

you can look up the "Motivate/Polish Helper"/"Moppelassitent" table as reference

dersiedler1 commented 6 months ago

removed the helper sorting as it is done correctly with only the markers on the table.

was an old relict when i havent got the sort working with the table only.

Beelzebob6666 commented 6 months ago

Hi there - seems to essentially work now.

Two things:

AlfonZ42 commented 6 months ago

Opening the arena calls PvPArena.Show() which toggles the box. For me, toggling the box is the expected behaviour when it's used on a menu button (which also calls <module>.Show()), not when opening the arena - I would expect it to open the box (if configured so), or refresh (when already open).

The string.prototype.cleanup seems to be taken from production module (which also does that). In contrast, guildfights module uses slightly different regexp /[\W_ ]+/ (vs. /[^a-zA-Z0-9]+/) on each use and doesn't modify the string prototype. Maybe adding a new unified function to helper module and using that would be appropriate?

Select Attack tab, only attacks are shown (good). Close the box. Open arena again, so the box opens again. Now the lost Attacks tab seems to be selected with the previously shown list of attacks, not the expected lost attacks.

dersiedler1 commented 6 months ago

yes as @AlfonZ42 mentioned the String function was taken from the production.js and as the code formatter mentioned this should be outside any function i put it at the start of the file.

according to open/close box: it should open when you click on the pvp-arena tower. it should do the same as if you open the market and the market filter opens.

dersiedler1 commented 6 months ago

fixed the initial active tab which @AlfonZ42 mentioned

Beelzebob6666 commented 6 months ago

what I meant in regards to the setting - no matter what state it has, the table will be shown when opening the Arena

Beelzebob6666 commented 6 months ago

Thanks for your contribution! I hopefully was not too hard on you 😅

dersiedler1 commented 6 months ago

all good. hopefully the feature will be useful for many users