slice off backpack items if char has no backpack#139
slice off backpack items if char has no backpack#139tischepe wants to merge 1 commit intoatomizer:masterfrom
Conversation
|
What's the story about there being 19 slots of equipment? Why are 12 of 19 valid? (equips make 4, inventory is 8, backpack is 8 more, unless I'm missing something) Just trying to figure out where all these numbers are coming from. P.S. It might help to define magic numbers like these as constants. I know that's not done too well across the code as-is, but it would help for future maintenance. |
|
Everything between <Char id="***"> and </Char> is generated by realmofthemadgodhrd.appspot.com/char/list so where those 7 extra -1 items come from, you would need to ask Deca games. |
|
No, I mean I'd like to define the |
|
Yes 12 is (equip + inventory) Or you could also just define: |
|
I wouldn't overthink it. That said, I'm still a little worried about why 19 is the number we come up with for number of total inventory slots. Is that result different if you check a character which does have a backpack enabled? |
|
Just to be clear, the 19 in "19 as backpack_End" comes from the fact that javascript start array indexes at 0. |
I've noticed that the backpack empty space count is not always correct,
The rotmg server returns this:
<Char id="***">
<ObjectType>782</ObjectType>
<Level>20</Level>
<Exp>154063</Exp>
<CurrentFame>261</CurrentFame>
<Equipment>2719,2774,2656,2755,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1</Equipment>
... snip ...
<HasBackpack>0</HasBackpack>
</Char>
The character has no backpack, yet equipment contains 19 items, these 7 nonexistent empty spaces get counted in totals.
So I slice the array if the char has no backpack before pushing it into items.