From 0484bdfee3ad2190734263c62f8da953a502b37f Mon Sep 17 00:00:00 2001 From: ferricles Date: Mon, 30 May 2022 23:31:37 -0700 Subject: [PATCH] Custom Item encoding section --- dev/index.html | 427 +++++++++++++++++++++++++++++++++++++---------- js/custom.js | 163 +++++++++--------- js/customizer.js | 1 + 3 files changed, 422 insertions(+), 169 deletions(-) diff --git a/dev/index.html b/dev/index.html index 7baf0c3..438a215 100644 --- a/dev/index.html +++ b/dev/index.html @@ -58,30 +58,32 @@ crafted items, and custom items).

- We use a Base 64 encode/decode system in most shareable links. It would be quite clunky to put a + We use a Base 64 (B64) encode/decode system in most shareable links. It would be quite clunky to put a bunch of numbers (the data we save and read) into one link. To save some space, we compress the - base 10 numerical alphabet into a custom base 64 alphabet. + base 10 numerical alphabet into a custom B64 alphabet.

-
+

- The Wynnbuilder Base 64 character table: + The Wynnbuilder B64 character table:

- - 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz+- - +
+0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz+-
+^    ^    ^    ^    ^    ^    ^    ^    ^    ^    ^    ^    ^   
+|    |    |    |    |    |    |    |    |    |    |    |    |   
+0    5    10   15   20   25   30   35   40   45   50   55   60  

- The Base 64 encoding of a number (in the 0 to 63 range) is equal to the character at the index + The B64 encoding of a number (in the 0 to 63 range) is equal to the character at the index within the above string.

For example, if we have a set of items with id numbers in the range [0, - 10000], we need at most 3 base 64 characters to encode any of these items - in the link! The item of id 1337 corresponds to the Base64 hash 0Kv: + 10000], we need at most 3 B64 characters to encode any of these items + in the link! The item of id 1337 corresponds to the B64 hash 0Kv: 1337 = 0 * 4096 + 20 * 64 + 57, 0 maps to 0, 20 maps to K, and 57 maps to v.

- Decoding is a little different. We can either interpret the base 64 string as a signed or unsigned number (signed: using 2s complement binary). + Decoding is a little different. We can either interpret the B64 string as a signed or unsigned number (signed: using 2s complement binary).

Things that should be interpreted as signed are: @@ -103,7 +105,7 @@

- Now that we understand the base 64 system, we can move on to the way builds, crafted items, and custom items are stored in links. + Now that we understand the B64 system, we can move on to the way builds, crafted items, and custom items are stored in links.

@@ -124,14 +126,14 @@ similar idea is used for skill points and powders. However, we know how many different skills there are already (5), so we can encode the user's assignment of skill points in 5 numbers. With powders, it's a little different. There are 31 "states" of powder: 1 for no powder and then 5 elements with 6 tiers of powder for each element. We will know how many available powder slots we have based on our - equipment. We can then put all of these numbers in a specific order (after running Base 64 encoding) to get our build link. --> + equipment. We can then put all of these numbers in a specific order (after running B64 encoding) to get our build link. -->

For items, you can download the item DB here: clean.json. Each item has an id value that can be put in a map. The NoneItem ID numbers start at 10000 in the canonical order: [helmet, chestplate, leggings, boots, ring 1, ring 2, bracelet, necklace, weapon] (No Weapon has an id of 10008).

- For tomes, you can download the tome DB here: tome_map.json. The NoneTome ID numbers start at 61 in the order [no weapon tome, no armor tome, no guild tome] so that we can store tome IDs in 1 Base 64 character. + For tomes, you can download the tome DB here: tome_map.json. The NoneTome ID numbers start at 61 in the order [no weapon tome, no armor tome, no guild tome] so that we can store tome IDs in 1 B64 character.

For powders: id numbers 1 through 30 map to Earth I, Earth II, ..., Earth VI, @@ -155,7 +157,7 @@

  • - 9 items from idMap (3 characters each): + 9 items from idMap (3 B64 characters each): 06W, 2SH, 0D4, @@ -167,7 +169,7 @@ 0Qi
  • - 5 skill point totals (2 characters each): + 5 skill point totals (2 B64 characters each): 19, 1V, -E, @@ -175,20 +177,20 @@ 2C
  • - 1 player level (2 characters): + 1 player level (2 B64 characters): 1g
  • - A variable number of powder "blocks" (5 characters which give us 6 powders per block). + A variable number of powder "blocks" (5 B64 characters which give us 6 powders per block).
    • For each of the 5 powderable equipment fields [helmet, chestplate, leggings, boots, weapon], we will have the following:
    • -
    • 1 base 64 character that says that we need n blocks for this item.
    • -
    • n blocks of 5 base 64 characters.
    • +
    • 1 B64 character that says that we need n blocks for this item.
    • +
    • n blocks of 5 B64 characters.
    • - Since there are 4 0s (Base 64 0 = 0 unsigned) in this example, we have no powders on any of the armor piece (no blocks). + Since there are 4 0s (B64 0 = 0 unsigned) in this example, we have no powders on any of the armor piece (no blocks).
    • - Then, we have 1 (Base 64 1 = 1 unsigned). There is 1 block of powders to decode for the weapon item. That is 00nZ6. + Then, we have 1 (B64 1 = 1 unsigned). There is 1 block of powders to decode for the weapon item. That is 00nZ6.
      • The unsigned equivalent of 00nZ6 in binary is 30 binary bits long (omitted). Each section of 5 bits directly corresponds to an powder ID.
      • @@ -214,16 +216,16 @@

        - http://hppeng-wynn.github.io/builder/#5_06W00mCI-10000JCustom%20Chestplate0220510G020Fe0M0201a0D40Qq2SK2SL02d0og0Qi191V-E0i2C1g0000100nZ6zz++++- + https://hppeng-wynn.github.io/builder/#5_06W00mCI-10000JCustom%20Chestplate0220510G020Fe0M0201a0D40Qq2SK2SL02d0og0Qi191V-E0i2C1g0000100nZ6zz++++-

        Build Hash format:

        • - 9 items from idMap (3 characters each): + 9 items from idMap (3 B64 characters each): 06W, - CI-10000JCustom%20Chestplate0220510G020Fe0M0201a, + 00m (with the custom item CI-10000JCustom%20Chestplate0220510G020Fe0M0201a), 0D4, 0Qq, 2SK, @@ -232,13 +234,14 @@ 0og, 0Qi
            -
          • Starting in this version, you can substitute in the full hash of a custom item ("CI-[gibberish]") for the 3-character hash of an item pool item, just like for crafted items.
          • -
          • Similar to crafted items, the way we can tell that an item is a custom item is when the 3-character hash of the 'item' is "CI-". No existing item has an item ID of "CI-" in base 64, so we can define a special case check for this "id number".
          • +
          • Starting in this version, to encode a custom item we substitute in the length of the full hash of a custom item ("CI-[gibberish]") in 3 B64 characters for the item ID, followed by the full hash.
          • +
          • When decoding build links of this version or higher, you must check whether or not the 3 characters after the current item are "CI-". If they are, the current 3 characters are the B64 representation of the unsigned length of the custom item hash (n), in characters. Then the next n characters make up the full custom item hash.
          • +
          • No existing item has an item ID of "CI-" in B64, so we can define a special case check for this "id number".
          • Further details on parsing and loading this custom item are in the Custom Item section.
        • - 5 skill point totals (2 characters each): + 5 skill point totals (2 B64 characters each): 19, 1V, -E, @@ -246,20 +249,20 @@ 2C
        • - 1 player level (2 characters): + 1 player level (2 B64 characters): 1g
        • - A variable number of powder "blocks" (5 characters which give us 6 powders per block). + A variable number of powder "blocks" (5 B64 characters which give us 6 powders per block).
          • For each of the 5 powderable equipment fields [helmet, chestplate, leggings, boots, weapon], we will have the following:
          • -
          • 1 base 64 character that says that we need n blocks for this item.
          • -
          • n blocks of 5 base 64 characters.
          • +
          • 1 B64 character that says that we need n blocks for this item.
          • +
          • n blocks of 5 B64 characters.
          • - Since there are 4 0s (Base 64 0 = 0 unsigned) in this example, we have no powders on any of the armor piece (no blocks). + Since there are 4 0s (B64 0 = 0 unsigned) in this example, we have no powders on any of the armor piece (no blocks).
          • - Then, we have 1 (Base 64 1 = 1 unsigned). There is 1 block of powders to decode for the weapon item. That is 00nZ6. + Then, we have 1 (B64 1 = 1 unsigned). There is 1 block of powders to decode for the weapon item. That is 00nZ6.
            • The unsigned equivalent of 00nZ6 in binary is 30 binary bits long (omitted). Each section of 5 bits directly corresponds to an powder ID.
            • @@ -281,14 +284,14 @@

              - http://hppeng-wynn.github.io/builder/#4_06W2SH0D40Qq2SK2SL02d0og0Qi191V-E0i2C1g0000100nZ6zz++++- + https://hppeng-wynn.github.io/builder/#4_06W2SH0D40Qq2SK2SL02d0og0Qi191V-E0i2C1g0000100nZ6zz++++-

              Build Hash format:

              • - 9 items from idMap (3 characters each): + 9 items from idMap (3 N64 characters each): 06W, 2SH, 0D4, @@ -300,7 +303,7 @@ 0Qi
              • - 5 skill point totals (2 characters each): + 5 skill point totals (2 B64 characters each): 19, 1V, -E, @@ -308,20 +311,20 @@ 2C
              • - 1 player level (2 characters): + 1 player level (2 B64 characters): 1g
              • - A variable number of powder "blocks" (5 characters which give us 6 powders per block). + A variable number of powder "blocks" (5 B64 characters which give us 6 powders per block).
                • For each of the 5 powderable equipment fields [helmet, chestplate, leggings, boots, weapon], we will have the following:
                • -
                • 1 base 64 character that says that we need n blocks for this item.
                • -
                • n blocks of 5 base 64 characters.
                • +
                • 1 B64 character that says that we need n blocks for this item.
                • +
                • n blocks of 5 B64 characters.
                • - Since there are 4 0s (Base 64 0 = 0 unsigned) in this example, we have no powders on any of the armor piece (no blocks). + Since there are 4 0s (B64 0 = 0 unsigned) in this example, we have no powders on any of the armor piece (no blocks).
                • - Then, we have 1 (Base 64 1 = 1 unsigned). There is 1 block of powders to decode for the weapon item. That is 00nZ6. + Then, we have 1 (B64 1 = 1 unsigned). There is 1 block of powders to decode for the weapon item. That is 00nZ6.
                  • The unsigned equivalent of 00nZ6 in binary is 30 binary bits long (omitted). Each section of 5 bits directly corresponds to an powder ID.
                  • @@ -339,7 +342,7 @@

                    • - 9 items from idMap (3 characters each): + 9 items from idMap (3 B64 characters each): 06W, CR-1628i8v8v94948f21, 0D4, @@ -351,12 +354,12 @@ 0Qi
                      • Starting in this version, you can substitute in the full hash of a crafted item ("CR-[gibberish]") for the 3-character hash of an item pool item.
                      • -
                      • The way we can tell that an item is a crafted item is when the 3-character hash of the 'item' is "CR-". No existing item has an item ID of "CR-" in base 64, so we can define a special case check for this "id number".
                      • +
                      • The way we can tell that an item is a crafted item is when the 3-character hash of the 'item' is "CR-". No existing item has an item ID of "CR-" in B64, so we can define a special case check for this "id number".
                      • Further details on parsing and loading this custom item are in the Crafted Item section.
                    • - 5 skill point totals (2 characters each): + 5 skill point totals (2 B64 characters each): 19, 1V, -E, @@ -364,20 +367,20 @@ 2C
                    • - 1 player level (2 characters): + 1 player level (2 B64 characters): 1g
                    • - A variable number of powder "blocks" (5 characters which give us 6 powders per block). + A variable number of powder "blocks" (5 B64 characters which give us 6 powders per block).
                      • For each of the 5 powderable equipment fields [helmet, chestplate, leggings, boots, weapon], we will have the following:
                      • -
                      • 1 base 64 character that says that we need n blocks for this item.
                      • -
                      • n blocks of 5 base 64 characters.
                      • +
                      • 1 B64 character that says that we need n blocks for this item.
                      • +
                      • n blocks of 5 B64 characters.
                      • - Since there are 4 0s (Base 64 0 = 0 unsigned) in this example, we have no powders on any of the armor piece (no blocks). + Since there are 4 0s (B64 0 = 0 unsigned) in this example, we have no powders on any of the armor piece (no blocks).
                      • - Then, we have 1 (Base 64 1 = 1 unsigned). There is 1 block of powders to decode for the weapon item. That is 00nZ6. + Then, we have 1 (B64 1 = 1 unsigned). There is 1 block of powders to decode for the weapon item. That is 00nZ6.
                        • The unsigned equivalent of 00nZ6 in binary is 30 binary bits long (omitted). Each section of 5 bits directly corresponds to an powder ID.
                        • @@ -403,7 +406,7 @@

                          • - 9 items from idMap (3 characters each): + 9 items from idMap (3 B64 characters each): 06W, 2SH, 0D4, @@ -415,7 +418,7 @@ 0Qi
                          • - 5 skill point totals (2 characters each): + 5 skill point totals (2 B64 characters each): 19, 1V, -E, @@ -423,20 +426,20 @@ 2C
                          • - 1 player level (2 characters): + 1 player level (2 B64 characters): 1g
                          • - A variable number of powder "blocks" (5 characters which give us 6 powders per block). + A variable number of powder "blocks" (5 B64 characters which give us 6 powders per block).
                            • For each of the 5 powderable equipment fields [helmet, chestplate, leggings, boots, weapon], we will have the following:
                            • -
                            • 1 base 64 character that says that we need n blocks for this item.
                            • -
                            • n blocks of 5 base 64 characters.
                            • +
                            • 1 B64 character that says that we need n blocks for this item.
                            • +
                            • n blocks of 5 B64 characters.
                            • - Since there are 4 0s (Base 64 0 = 0 unsigned) in this example, we have no powders on any of the armor piece (no blocks). + Since there are 4 0s (B64 0 = 0 unsigned) in this example, we have no powders on any of the armor piece (no blocks).
                            • - Then, we have 1 (Base 64 1 = 1 unsigned). There is 1 block of powders to decode for the weapon item. That is 00nZ6. + Then, we have 1 (B64 1 = 1 unsigned). There is 1 block of powders to decode for the weapon item. That is 00nZ6.
                              • The unsigned equivalent of 00nZ6 in binary is 30 binary bits long (omitted). Each section of 5 bits directly corresponds to an powder ID.
                              • @@ -459,7 +462,7 @@

                                • - 9 items from idMap (3 characters each): + 9 items from idMap (3 B64 characters each): 06W, 2SH, 0D4, @@ -471,7 +474,7 @@ 0Qi
                                • - 5 skill point totals (2 characters each): + 5 skill point totals (2 B64 characters each): 19, 1V, -E, @@ -479,16 +482,16 @@ 2C
                                • - A variable number of powder "blocks" (5 characters which give us 6 powders per block). + A variable number of powder "blocks" (5 B64 characters which give us 6 powders per block).
                                  • For each of the 5 powderable equipment fields [helmet, chestplate, leggings, boots, weapon], we will have the following:
                                  • -
                                  • 1 base 64 character that says that we need n blocks for this item.
                                  • -
                                  • n blocks of 5 base 64 characters.
                                  • +
                                  • 1 B64 character that says that we need n blocks for this item.
                                  • +
                                  • n blocks of 5 B64 characters.
                                  • - Since there are 4 0s (Base 64 0 = 0 unsigned) in this example, we have no powders on any of the armor piece (no blocks). + Since there are 4 0s (B64 0 = 0 unsigned) in this example, we have no powders on any of the armor piece (no blocks).
                                  • - Then, we have 1 (Base 64 1 = 1 unsigned). There is 1 block of powders to decode for the weapon item. That is 00nZ6. + Then, we have 1 (B64 1 = 1 unsigned). There is 1 block of powders to decode for the weapon item. That is 00nZ6.
                                    • The unsigned equivalent of 00nZ6 in binary is 30 binary bits long (omitted). Each section of 5 bits directly corresponds to an powder ID.
                                    • @@ -511,7 +514,7 @@

                                      • - 9 items from idMap (3 characters each): + 9 items from idMap (3 B64 characters each): 06W, 2SH, 0D4, @@ -523,16 +526,16 @@ 0Qi
                                      • - A variable number of powder "blocks" (5 characters which give us 6 powders per block). + A variable number of powder "blocks" (5 B64 characters which give us 6 powders per block).
                                        • For each of the 5 powderable equipment fields [helmet, chestplate, leggings, boots, weapon], we will have the following:
                                        • -
                                        • 1 base 64 character that says that we need n blocks for this item.
                                        • -
                                        • n blocks of 5 base 64 characters.
                                        • +
                                        • 1 B64 character that says that we need n blocks for this item.
                                        • +
                                        • n blocks of 5 B64 characters.
                                        • - Since there are 4 0s (Base 64 0 = 0 unsigned) in this example, we have no powders on any of the armor piece (no blocks). + Since there are 4 0s (B64 0 = 0 unsigned) in this example, we have no powders on any of the armor piece (no blocks).
                                        • - Then, we have 1 (Base 64 1 = 1 unsigned). There is 1 block of powders to decode for the weapon item. That is 00nZ6. + Then, we have 1 (B64 1 = 1 unsigned). There is 1 block of powders to decode for the weapon item. That is 00nZ6.
                                          • The unsigned equivalent of 00nZ6 in binary is 30 binary bits long (omitted). Each section of 5 bits directly corresponds to an powder ID.
                                          • @@ -565,16 +568,16 @@

                                            - For ingredients, you can download the ingredient DB here: ing_map.json. The ID number for No Ingredient is 4000. + For ingredients, you can download the ingredient id map here: ing_map.json. The ID number for No Ingredient is 4000.

                                            - For recipes, you can download the recipe DB here: recipe_map.json. + For recipes, you can download the recipe id map here: recipe_map.json or the recipe DB here: recipes_clean.json.

                                            - This is the first version of crafted item encoding. Crafted Items are always stored in a constant number of base 64 characters. + This is the first version of crafted item encoding. Crafted Items are always stored in a constant number of B64 characters.

                                            @@ -589,7 +592,7 @@

                                            • 3 characters to denote item type as crafted: CR- (always)
                                            • 1 character for encoding version: 1
                                            • -
                                            • 6 ingredient IDs (2 Base 64 characters each): +
                                            • 6 ingredient IDs (2 B64 characters each): 62, 8i, 8v, @@ -597,25 +600,28 @@ 94, 94
                                            • -
                                            • 2 characters for recipe ID: 8f
                                            • +
                                            • 2 B64 characters for recipe ID: 8f
                                            • 1 character to encode material tiers: 2
                                                - +
                                              • There are 2 material tiers to decode. The ordering of materials is determined by their order within the corresponding recipe object held in the db.
                                              • +
                                              • The material tier character (from here on t) is in the range [1, 9].
                                              • +
                                              • Mat 1's tier is equal to t % 3 except when this yields 0, in which case it becomes 3.
                                              • +
                                              • Mat 2's tier is equal to ceil( (t - 0.5) / 3).
                                            • 1 character to encode attack speed: 1
                                                -
                                              • The integer after doing unsigned decoding from the Base 64 character denotes the index within the following array: [SLOW, NORMAL, FAST]. Base 64 1 maps to the unsigned integer 1, meaning that the attack speed of this crafted item would be NORMAL if it were a weapon.
                                              • +
                                              • The integer after doing unsigned decoding from the B64 character denotes the index within the following array: [SLOW, NORMAL, FAST]. B64 1 maps to the unsigned integer 1, meaning that the attack speed of this crafted item would be NORMAL if it were a weapon.
                                              • Note: although only weapons will have attack speed, we decided to include the character in all crafted item hashes to keep a constant hash length.

                                            - You may need to parse a crafted item from a wynnbuilder link with a crafted item. + You may need to parse a crafted item from a wynnbuilder crafter link.

                                            - http://hppeng-wynn.github.io/crafter/#1628i8v8v94948f21 + https://hppeng-wynn.github.io/crafter/#1628i8v8v94948f21

                                            We can simply take the string after the octothorpe/hash tag (#), tack on "CR-" in front of this string, and arrive at the full hash for the crafted item in question. Decode using the same logic as the previous example. @@ -632,17 +638,262 @@

                                            Custom items always start with "CI-" so that they are, as an entire category, distinguishable from item pool items. The stats and values that make up the custom item are stored in the rest of the "hash".

                                            -

                                            - http://localhost:8000/builder/#5_06W02hCI-10000HMeta%20Chestplate010Gbest%20in%20slot0240401030510G0302SG0H020Fe0I020Fe0J020Fe0K020Fe0L020Fe0M0201Y0i0200U220z0204iKK150200U22160200U22170200U22180200U22190200U220D40Qq2SK2SL02d0og0Qi191V-E0i2C1g0000100nZ6zz++++- -

                                            +
                                            +

                                            This is the first version of custom item encoding and decoding.

                                            +

                                            You will need the full array of item identification saving order and all non-rolled identifications (ex: name). View them below.

                                            +
                                            +

                                            ID saving order: ci_save_order = ["name", "lore", "tier", "set", "slots", "type", "material", "drop", "quest", "nDam", "fDam", "wDam", "aDam", "tDam", "eDam", "atkSpd", "hp", "fDef", "wDef", "aDef", "tDef", "eDef", "lvl", "classReq", "strReq", "dexReq", "intReq", "defReq", "agiReq","str", "dex", "int", "agi", "def", "id", "skillpoints", "reqs", "nDam_", "fDam_", "wDam_", "aDam_", "tDam_", "eDam_", "majorIds", "hprPct", "mr", "sdPct", "mdPct", "ls", "ms", "xpb", "lb", "ref", "thorns", "expd", "spd", "atkTier", "poison", "hpBonus", "spRegen", "eSteal", "hprRaw", "sdRaw", "mdRaw", "fDamPct", "wDamPct", "aDamPct", "tDamPct", "eDamPct", "fDefPct", "wDefPct", "aDefPct", "tDefPct", "eDefPct", "spPct1", "spRaw1", "spPct2", "spRaw2", "spPct3", "spRaw3", "spPct4", "spRaw4", "rainbowRaw", "sprint", "sprintReg", "jh", "lq", "gXp", "gSpd","durability","duration","charges"];

                                            +

                                            Non-rolled string IDs: nonRolled_strings = ["name", "lore", "tier", "set", "type", "material", "drop", "quest", "majorIds", "classReq", "atkSpd", "displayName", "nDam", "fDam", "wDam", "aDam", "tDam", "eDam", "nDam_", "fDam_", "wDam_", "aDam_", "tDam_", "eDam_", "durability", "duration"];

                                            +

                                            Rolled IDs: rolledIDs = ["hprPct", "mr", "sdPct", "mdPct", "ls", "ms", "xpb", "lb", "ref", "thorns", "expd", "spd", "atkTier", "poison", "hpBonus", "spRegen", "eSteal", "hprRaw", "sdRaw", "mdRaw", "fDamPct", "wDamPct", "aDamPct", "tDamPct", "eDamPct", "fDefPct", "wDefPct", "aDefPct", "tDefPct", "eDefPct", "spPct1", "spRaw1", "spPct2", "spRaw2", "spPct3", "spRaw3", "spPct4", "spRaw4", "rainbowRaw", "sprint", "sprintReg", "jh", "lq", "gXp", "gSpd"];

                                            +

                                            Non-rolled IDs: nonRolledIDs = ["name", "lore", "displayName", "tier", "set", "slots", "type", "material", "drop", "quest", "restrict", "nDam", "fDam", "wDam", "aDam", "tDam", "eDam", "atkSpd", "hp", "fDef", "wDef", "aDef", "tDef", "eDef", "lvl", "classReq", "strReq", "dexReq", "intReq", "defReq", "agiReq", "str", "dex", "int", "agi", "def", "fixID", "category", "id", "skillpoints", "reqs", "nDam_", "fDam_", "wDam_", "aDam_", "tDam_", "eDam_", "majorIds"];

                                            +

                                            Tiers: tiers = ["Normal", "Unique", "Rare", "Legendary", "Fabled", "Mythic", "Set", "Crafted"]

                                            +

                                            Types: types = [ "helmet", "chestplate", "leggings", "boots", "ring", "bracelet", "necklace", "wand", "spear", "bow", "dagger", "relik", "potion", "scroll", "food"];

                                            +

                                            Attack Speeds: attackSpeeds = ["SUPER_SLOW", "VERY_SLOW", "SLOW", "NORMAL", "FAST", "VERY_FAST", "SUPER_FAST"];

                                            +

                                            Class Requirements: classes = ["Warrior", "Assassin", "Mage", "Archer", "Shaman"]

                                            +
                                            + +
                                            +

                                            + Here's an example of a custom item hash. +

                                            + + CI-10000HMeta%20Chestplate010Gbest%20in%20slot0240401030510G0302SG0H020Fe0I020Fe0J020Fe0K020Fe0L020Fe0M0201Y0i0200U220z0204iKK150200U22160200U22170200U22180200U22190200U22 + +

                                            + Given a custom item hash, we will in general continue to parse through many identifications and their values until we reach the end of the custom item hash. +

                                            +

                                            + Custom item hash format: +

                                            +
                                              +
                                            • 1 B64 character denoting encoding/decoding version number: 1
                                            • +
                                            • 1 character denoting whether or not this item has fixed IDs: 0. (0 for no fixed IDs, 1 for fixed IDs)
                                            • +
                                            • A series of encoded identifications, each taking a variable number of characters. For every ID, we have to save: +
                                                +
                                              • 2 B64 characters that represent the identification ID (its index in the CI save order array).
                                              • +
                                              • 2 B64 characters that represent the length len of the value of the identification.
                                              • +
                                              • A variable number characters to encode the value of the identification. +
                                              • For string-valued identifications (in the non-rolled strings array), we do not use any encoding for the value. The next len characters of the custom item hash is the raw value of the identification (before substituting space for "%20"). +
                                                  +
                                                • Exception: for the identifications tier, type, atkSpd, and classReq, there is no string used. They are encoded as a numerical value representing an index in a pre-defined array (check the Important Arrays section above). They also do not use the earlier-specified 2 characters to store length; instead, they each use only 1 B64 character to store their index in their corresponding arrays.
                                                • +
                                                +
                                              • +
                                              • For numerical-valued identifications, encoding depends on the fixed ID value from before. +
                                                  +
                                                • Rolled IDs (with non-fixed IDs): +
                                                    +
                                                  • 1 character to denote the sign of the min and max values: 0 for both positive, 1 for negative min and positive max, 2 for positive min and negative max, and 3 for both negative.
                                                  • +
                                                  • len B64 characters that represent the unsigned minimum value of the identification.
                                                  • +
                                                  • len B64 characters that represent the unsigned maximum value of the identification.
                                                  • +
                                                  +
                                                • +
                                                • Rolled IDs (with fixed IDs) and Non-Rolled IDs: +
                                                    +
                                                  • 1 character (binary bit) to denote the sign of the value (0 positive, 1 negative).
                                                  • +
                                                  • len B64 characters that represent the unsigned value of the identification.
                                                  • +
                                                  +
                                                • +
                                                +
                                              • + +
                                              +
                                            • +
                                            • To finish the example, we'll go through all the actual identifications of the provided custom item. +
                                                +
                                              • "CI-" constant portion
                                              • +
                                              • Encoding version number: 1
                                              • +
                                              • Fixed IDs: 0 (non-fixed IDs)
                                              • +
                                              • 000HMeta%20Chestplate +
                                                  +
                                                • ID name: 00 ("name")
                                                • +
                                                • ID value length: 0H (17)
                                                • +
                                                • ID value: Meta%20Chestplate ("Meta Chestplate")
                                                • +
                                                +
                                              • +
                                              • 010Gbest%20in%20slot +
                                                  +
                                                • ID name: 01 ("lore")
                                                • +
                                                • ID value length: 0G (16)
                                                • +
                                                • ID value: best%20in%20slot ("best in slot")
                                                • +
                                                +
                                              • +
                                              • 024 +
                                                  +
                                                • ID name: 02 ("tier")
                                                • +
                                                • ID value length: None (exception)
                                                • +
                                                • ID value: 4 (tiers[4] = "Fabled")
                                                • +
                                                +
                                              • +
                                              • 040103 +
                                                  +
                                                • ID name: 04 ("slots")
                                                • +
                                                • ID value length: 01 (1)
                                                • +
                                                • ID sign: 0 (positive)
                                                • +
                                                • ID value: 3 (3)
                                                • +
                                                +
                                              • +
                                              • 051 +
                                                  +
                                                • ID name: 05 ("type")
                                                • +
                                                • ID value length: None (exception)
                                                • +
                                                • ID value: 1 (types[1] = "chestplate")
                                                • +
                                                +
                                              • +
                                              • 0G0302SG +
                                                  +
                                                • ID name: 0G ("hp")
                                                • +
                                                • ID value length: 03 (3)
                                                • +
                                                • ID sign: 0 (positive)
                                                • +
                                                • ID value: 2SG (10000)
                                                • +
                                                +
                                              • +
                                              • 0H020Fe +
                                                  +
                                                • ID name: 0H ("fDef")
                                                • +
                                                • ID value length: 02 (2)
                                                • +
                                                • ID sign: 0 (positive)
                                                • +
                                                • ID value: Fe (1000)
                                                • +
                                                +
                                              • +
                                              • 0I020Fe +
                                                  +
                                                • ID name: 0I ("wDef")
                                                • +
                                                • ID value length: 02 (2)
                                                • +
                                                • ID sign: 0 (positive)
                                                • +
                                                • ID value: Fe (1000)
                                                • +
                                                +
                                              • +
                                              • 0J020Fe +
                                                  +
                                                • ID name: 0J ("aDef")
                                                • +
                                                • ID value length: 02 (2)
                                                • +
                                                • ID sign: 0 (positive)
                                                • +
                                                • ID value: Fe (1000)
                                                • +
                                                +
                                              • +
                                              • 0K020Fe +
                                                  +
                                                • ID name: 0K ("tDef")
                                                • +
                                                • ID value length: 02 (2)
                                                • +
                                                • ID sign: 0 (positive)
                                                • +
                                                • ID value: Fe (1000)
                                                • +
                                                +
                                              • +
                                              • 0L020Fe +
                                                  +
                                                • ID name: 0L ("eDef")
                                                • +
                                                • ID value length: 02 (2)
                                                • +
                                                • ID sign: 0 (positive)
                                                • +
                                                • ID value: Fe (1000)
                                                • +
                                                +
                                              • +
                                              • 0M0201Y +
                                                  +
                                                • ID name: 0M ("lvl")
                                                • +
                                                • ID value length: 02 (2)
                                                • +
                                                • ID sign: 0 (positive)
                                                • +
                                                • ID value: 1Y (98)
                                                • +
                                                +
                                              • +
                                              • 0i0200U22 +
                                                  +
                                                • ID name: 0i ("hprPct")
                                                • +
                                                • ID value length: 02 (2)
                                                • +
                                                • ID sign: 0 (both positive)
                                                • +
                                                • ID value minimum: 0U (30)
                                                • +
                                                • ID value maximum: 22 (130)
                                                • +
                                                +
                                              • +
                                              • 0z0204iKK +
                                                  +
                                                • ID name: 0z ("hprRaw")
                                                • +
                                                • ID value length: 02 (2)
                                                • +
                                                • ID sign: 0 (both positive)
                                                • +
                                                • ID value minimum: 4i (300)
                                                • +
                                                • ID value maximum: KK (1300)
                                                • +
                                                +
                                              • +
                                              • 0z0204iKK +
                                                  +
                                                • ID name: 0z ("hprRaw")
                                                • +
                                                • ID value length: 02 (2)
                                                • +
                                                • ID sign: 0 (both positive)
                                                • +
                                                • ID value minimum: 4i (300)
                                                • +
                                                • ID value maximum: KK (1300)
                                                • +
                                                +
                                              • +
                                              • 150200U22 +
                                                  +
                                                • ID name: 15 ("fDefPct")
                                                • +
                                                • ID value length: 02 (2)
                                                • +
                                                • ID sign: 0 (both positive)
                                                • +
                                                • ID value minimum: 0U (30)
                                                • +
                                                • ID value maximum: 22 (130)
                                                • +
                                                +
                                              • +
                                              • 160200U22 +
                                                  +
                                                • ID name: 16 ("wDefPct")
                                                • +
                                                • ID value length: 02 (2)
                                                • +
                                                • ID sign: 0 (both positive)
                                                • +
                                                • ID value minimum: 0U (30)
                                                • +
                                                • ID value maximum: 22 (130)
                                                • +
                                                +
                                              • +
                                              • 170200U22 +
                                                  +
                                                • ID name: 17 ("aDefPct")
                                                • +
                                                • ID value length: 02 (2)
                                                • +
                                                • ID sign: 0 (both positive)
                                                • +
                                                • ID value minimum: 0U (30)
                                                • +
                                                • ID value maximum: 22 (130)
                                                • +
                                                +
                                              • +
                                              • 180200U22 +
                                                  +
                                                • ID name: 18 ("tDefPct")
                                                • +
                                                • ID value length: 02 (2)
                                                • +
                                                • ID sign: 0 (both positive)
                                                • +
                                                • ID value minimum: 0U (30)
                                                • +
                                                • ID value maximum: 22 (130)
                                                • +
                                                +
                                              • +
                                              • 190200U22 +
                                                  +
                                                • ID name: 19 ("eDefPct")
                                                • +
                                                • ID value length: 02 (2)
                                                • +
                                                • ID sign: 0 (both positive)
                                                • +
                                                • ID value minimum: 0U (30)
                                                • +
                                                • ID value maximum: 22 (130)
                                                • +
                                                +
                                              • +
                                              +
                                            • +
                                            + + +

                                            + You may need to parse a custom item from a Wynnbuilder customizer link. +

                                            + + hppeng-wynn.github.io/custom/#10000HMeta%20Chestplate010Gbest%20in%20slot0240401030510G0302SG0H020Fe0I020Fe0J020Fe0K020Fe0L020Fe0M0201Y0i0200U220z0204iKK150200U22160200U22170200U22180200U22190200U22 + +

                                            + Similar to crafted items, the part of the link after the "#" is the rest of the custom item after the "CI-" constant portion. You may need to convert all "%20" to spaces manually. +

                                            +

                                            + Details on reading custom items in build links are provided in the Decoding WB links > Builds section. +

                                            +
                                            +

                                            - Last updated: 25 May 2022 + Last updated: 30 May 2022

                                            -
                                            -
                                            +
              diff --git a/js/custom.js b/js/custom.js index 0a470a4..50ead5b 100644 --- a/js/custom.js +++ b/js/custom.js @@ -1,5 +1,6 @@ -const ci_save_order = ["name", "lore", "tier", "set", "slots", "type", "material", "drop", "quest", "nDam", "fDam", "wDam", "aDam", "tDam", "eDam", "atkSpd", "hp", "fDef", "wDef", "aDef", "tDef", "eDef", "lvl", "classReq", "strReq", "dexReq", "intReq", "defReq", "agiReq","str", "dex", "int", "agi", "def", "id", "skillpoints", "reqs", "nDam_", "fDam_", "wDam_", "aDam_", "tDam_", "eDam_", "majorIds", "hprPct", "mr", "sdPct", "mdPct", "ls", "ms", "xpb", "lb", "ref", "thorns", "expd", "spd", "atkTier", "poison", "hpBonus", "spRegen", "eSteal", "hprRaw", "sdRaw", "mdRaw", "fDamPct", "wDamPct", "aDamPct", "tDamPct", "eDamPct", "fDefPct", "wDefPct", "aDefPct", "tDefPct", "eDefPct", "spPct1", "spRaw1", "spPct2", "spRaw2", "spPct3", "spRaw3", "spPct4", "spRaw4", "rainbowRaw", "sprint", "sprintReg", "jh", "lq", "gXp", "gSpd","durability","duration","charges"]; -const nonRolled_strings = ["name","lore", "tier","set","type","material","drop","quest","majorIds","classReq","atkSpd","displayName", "nDam", "fDam", "wDam", "aDam", "tDam", "eDam", "nDam_", "fDam_", "wDam_", "aDam_", "tDam_", "eDam_", "durability", "duration"]; +const ci_save_order = ["name", "lore", "tier", "set", "slots", "type", "material", "drop", "quest", "nDam", "fDam", "wDam", "aDam", "tDam", "eDam", "atkSpd", "hp", "fDef", "wDef", "aDef", "tDef", "eDef", "lvl", "classReq", "strReq", "dexReq", "intReq", "defReq", "agiReq", "str", "dex", "int", "agi", "def", "id", "skillpoints", "reqs", "nDam_", "fDam_", "wDam_", "aDam_", "tDam_", "eDam_", "majorIds", "hprPct", "mr", "sdPct", "mdPct", "ls", "ms", "xpb", "lb", "ref", "thorns", "expd", "spd", "atkTier", "poison", "hpBonus", "spRegen", "eSteal", "hprRaw", "sdRaw", "mdRaw", "fDamPct", "wDamPct", "aDamPct", "tDamPct", "eDamPct", "fDefPct", "wDefPct", "aDefPct", "tDefPct", "eDefPct", "spPct1", "spRaw1", "spPct2", "spRaw2", "spPct3", "spRaw3", "spPct4", "spRaw4", "rainbowRaw", "sprint", "sprintReg", "jh", "lq", "gXp", "gSpd", "durability", "duration", "charges"]; +const nonRolled_strings = ["name", "lore", "tier", "set", "type", "material", "drop", "quest", "majorIds", "classReq", "atkSpd", "displayName", "nDam", "fDam", "wDam", "aDam", "tDam", "eDam", "nDam_", "fDam_", "wDam_", "aDam_", "tDam_", "eDam_", "durability", "duration"]; + //omitted restrict - it's always "Custom Item" //omitted displayName - either it's the same as name (repetitive) or it's "Custom Item" //omitted category - can always get this from type @@ -16,7 +17,7 @@ const nonRolled_strings = ["name","lore", "tier","set","type","material","drop", function encodeCustom(custom, verbose) { if (custom) { if (custom.statMap) { - custom = custom.statMap; + custom = custom.statMap; } let hash = "1"; //version 1 @@ -34,19 +35,19 @@ function encodeCustom(custom, verbose) { // 1 - min neg max pos // 2 - min pos max neg (how?) // 3 - min neg max neg - let sign = (Boolean(val_min / Math.abs(val_min) < 0) | 0) + 2*(Boolean(val_max / Math.abs(val_max) < 0) | 0); + let sign = (Boolean(val_min / Math.abs(val_min) < 0) | 0) + 2 * (Boolean(val_max / Math.abs(val_max) < 0) | 0); //console.log(id + ": " + sign); - let min_len = Math.max(1,Math.ceil(log(64,Math.abs(val_min)+1))); - let max_len = Math.max(1,Math.ceil(log(64,Math.abs(val_max)+1))); - let len = Math.max(min_len,max_len); + let min_len = Math.max(1, Math.ceil(log(64, Math.abs(val_min) + 1))); + let max_len = Math.max(1, Math.ceil(log(64, Math.abs(val_max) + 1))); + let len = Math.max(min_len, max_len); val_min = Math.abs(val_min); val_max = Math.abs(val_max); - if ( val_min != 0 || val_max != 0 ) { + if (val_min != 0 || val_max != 0) { if (custom.get("fixID")) { - hash += Base64.fromIntN(i,2) + Base64.fromIntN(len,2) + sign + Base64.fromIntN(val_min, len); + hash += Base64.fromIntN(i, 2) + Base64.fromIntN(len, 2) + sign + Base64.fromIntN(val_min, len); } else { - hash += Base64.fromIntN(i,2) + Base64.fromIntN(len,2) + sign + Base64.fromIntN(val_min, len) + Base64.fromIntN(val_max,len); + hash += Base64.fromIntN(i, 2) + Base64.fromIntN(len, 2) + sign + Base64.fromIntN(val_min, len) + Base64.fromIntN(val_max, len); } } } else { @@ -61,26 +62,26 @@ function encodeCustom(custom, verbose) { } } - if (typeof(val) === "string" && val !== "") { - if ((damages.includes(id) && val === "0-0") || (!verbose && ["lore","majorIds","quest","materials","drop","set"].includes(id))) { continue; } + if (typeof (val) === "string" && val !== "") { + if ((damages.includes(id) && val === "0-0") || (!verbose && ["lore", "majorIds", "quest", "materials", "drop", "set"].includes(id))) { continue; } if (id === "type") { - hash += Base64.fromIntN(i,2) + Base64.fromIntN(types.indexOf(val.substring(0,1).toUpperCase()+val.slice(1)),1); + hash += Base64.fromIntN(i, 2) + Base64.fromIntN(types.indexOf(val.substring(0, 1).toUpperCase() + val.slice(1)), 1); } else if (id === "tier") { - hash += Base64.fromIntN(i,2) + Base64.fromIntN(tiers.indexOf(val),1); + hash += Base64.fromIntN(i, 2) + Base64.fromIntN(tiers.indexOf(val), 1); } else if (id === "atkSpd") { - hash += Base64.fromIntN(i,2) + Base64.fromIntN(attackSpeeds.indexOf(val),1); + hash += Base64.fromIntN(i, 2) + Base64.fromIntN(attackSpeeds.indexOf(val), 1); } else if (id === "classReq") { - hash += Base64.fromIntN(i,2) + Base64.fromIntN(classes.indexOf(val),1); + hash += Base64.fromIntN(i, 2) + Base64.fromIntN(classes.indexOf(val), 1); } else { - hash += Base64.fromIntN(i,2) + Base64.fromIntN(val.replaceAll(" ", "%20").length,2) + val.replaceAll(" ", "%20"); //values cannot go above 4096 chars!!!! Is this ok? + hash += Base64.fromIntN(i, 2) + Base64.fromIntN(val.replaceAll(" ", "%20").length, 2) + val.replaceAll(" ", "%20"); //values cannot go above 4096 chars!!!! Is this ok? } - } else if (typeof(val) === "number" && val != 0) { - let len = Math.max(1,Math.ceil(log(64,Math.abs(val)))); + } else if (typeof (val) === "number" && val != 0) { + let len = Math.max(1, Math.ceil(log(64, Math.abs(val)))); let sign = Boolean(val / Math.abs(val) < 0) | 0; //console.log(sign); //hash += Base64.fromIntN(i,2) + Base64.fromIntN(val,Math.max(1,Math.ceil(log(64,Math.abs(val))))) + "_"; - hash += Base64.fromIntN(i,2) + Base64.fromIntN(len,2) + sign + Base64.fromIntN(Math.abs(val),len); - } + hash += Base64.fromIntN(i, 2) + Base64.fromIntN(len, 2) + sign + Base64.fromIntN(Math.abs(val), len); + } } } @@ -93,49 +94,51 @@ function encodeCustom(custom, verbose) { function getCustomFromHash(hash) { let name = hash.slice(); let statMap; + console.log("decoding"); try { - if (name.slice(0,3) === "CI-") { + if (name.slice(0, 3) === "CI-") { name = name.substring(3); } else { throw new Error("Not a custom item!"); } - + + //probably change vers and fixID to be encoded and decoded to/from B64 in the future let version = name.charAt(0); - let fixID = Boolean(parseInt(name.charAt(1),10)); + let fixID = Boolean(parseInt(name.charAt(1), 10)); let tag = name.substring(2); statMap = new Map(); statMap.set("minRolls", new Map()); statMap.set("maxRolls", new Map()); - + if (version === "1") { //do the things if (fixID) { statMap.set("fixID", true); - } + } while (tag !== "") { - let id = ci_save_order[Base64.toInt(tag.slice(0,2))]; - let len = Base64.toInt(tag.slice(2,4)); + let id = ci_save_order[Base64.toInt(tag.slice(0, 2))]; + let len = Base64.toInt(tag.slice(2, 4)); if (rolledIDs.includes(id)) { - let sign = parseInt(tag.slice(4,5),10); - let minRoll = Base64.toInt(tag.slice(5,5+len)); + let sign = parseInt(tag.slice(4, 5), 10); + let minRoll = Base64.toInt(tag.slice(5, 5 + len)); if (!fixID) { - let maxRoll = Base64.toInt(tag.slice(5+len,5+2*len)); + let maxRoll = Base64.toInt(tag.slice(5 + len, 5 + 2 * len)); if (sign > 1) { maxRoll *= -1; } if (sign % 2 == 1) { minRoll *= -1; } - statMap.get("minRolls").set(id,minRoll); - statMap.get("maxRolls").set(id,maxRoll); - tag = tag.slice(5+2*len); + statMap.get("minRolls").set(id, minRoll); + statMap.get("maxRolls").set(id, maxRoll); + tag = tag.slice(5 + 2 * len); } else { if (sign != 0) { minRoll *= -1; } - statMap.get("minRolls").set(id,minRoll); - statMap.get("maxRolls").set(id,minRoll); - tag = tag.slice(5+len); + statMap.get("minRolls").set(id, minRoll); + statMap.get("maxRolls").set(id, minRoll); + tag = tag.slice(5 + len); } } else { let val; @@ -153,17 +156,17 @@ function getCustomFromHash(hash) { val = classes[Base64.toInt(tag.charAt(2))]; len = -1; } else { //general case - val = tag.slice(4,4+len).replaceAll("%20"," "); + val = tag.slice(4, 4 + len).replaceAll("%20", " "); } - tag = tag.slice(4+len); + tag = tag.slice(4 + len); } else { - let sign = parseInt(tag.slice(4,5),10); - val = Base64.toInt(tag.slice(5,5+len)); + let sign = parseInt(tag.slice(4, 5), 10); + val = Base64.toInt(tag.slice(5, 5 + len)); if (sign == 1) { val *= -1; } - tag = tag.slice(5+len); - } + tag = tag.slice(5 + len); + } if (id === "majorIds") { val = [val]; console.log(val); @@ -171,27 +174,27 @@ function getCustomFromHash(hash) { statMap.set(id, val); } } - statMap.set("hash","CI-"+name); + statMap.set("hash", "CI-" + name); return new Custom(statMap); } } catch (error) { //console.log(statMap); return undefined; } - + } /** An object representing a Custom Item. Mostly for vanity purposes. * @dep Requires the use of nonRolledIDs and rolledIDs from display_constants.js. * @dep Requires the use of attackSpeeds from build.js. */ -class Custom{ +class Custom { /** * @description Construct a custom item (CI) from a statMap. * @param {statMap}: A map with keys from rolledIDs or nonRolledIDs or minRolls/maxRolls and values befitting the keys. minRolls and maxRolls are their own maps and have the same keys, but with minimum and maximum values (for rolls). * */ - constructor(statMap){ + constructor(statMap) { this.statMap = statMap; // TODO patch // this.statMap.set("majorIds", [this.statMap.get("majorIds")]); @@ -200,17 +203,17 @@ class Custom{ setHash(hash) { let ihash = hash.slice(); - if (ihash.slice(0,3) !== "CI-") { + if (ihash.slice(0, 3) !== "CI-") { ihash = "CI-" + hash; } this.hash = ihash; - this.statMap.set("hash",ihash); + this.statMap.set("hash", ihash); } updateName(name) { this.name = name; - this.displayName = name; + this.displayName = name; } /* Get all stats for this CI. @@ -218,26 +221,24 @@ class Custom{ * Follows the expandedItem item structure, similar to a crafted item. * TODO: Check if this is even useful */ - initCustomStats(){ + initCustomStats() { //this.setHashVerbose(); //do NOT move sethash from here please - - this.statMap.set("custom", true); console.log(this.statMap); for (const id of ci_save_order) { if (rolledIDs.includes(id)) { if (!(this.statMap.get("minRolls").has(id) && this.statMap.get("minRolls").get(id))) { - this.statMap.get("minRolls").set(id,0); - this.statMap.get("maxRolls").set(id,0); + this.statMap.get("minRolls").set(id, 0); + this.statMap.get("maxRolls").set(id, 0); } } else { if (nonRolled_strings.includes(id)) { - if (!(this.statMap.has(id)&&this.statMap.get(id))) { - this.statMap.set(id,""); + if (!(this.statMap.has(id) && this.statMap.get(id))) { + this.statMap.set(id, ""); } } else { - if (!(this.statMap.has(id)&&this.statMap.get(id))) { - this.statMap.set(id,0); + if (!(this.statMap.has(id) && this.statMap.get(id))) { + this.statMap.set(id, 0); } } } @@ -245,30 +246,30 @@ class Custom{ let type = this.statMap.get("type").toLowerCase(); console.log(type); if (weaponTypes.includes(type)) { - for (const n of ["nDam","eDam","tDam","wDam","fDam","aDam"]) { + for (const n of ["nDam", "eDam", "tDam", "wDam", "fDam", "aDam"]) { if (!(this.statMap.has(n) && this.statMap.get(n))) { - this.statMap.set(n,"0-0"); + this.statMap.set(n, "0-0"); } } } else { - for (const n of ["nDam","eDam","tDam","wDam","fDam","aDam"]) { + for (const n of ["nDam", "eDam", "tDam", "wDam", "fDam", "aDam"]) { if (this.statMap.has(n)) { this.statMap.delete(n); } } } - + if (this.statMap.get("type")) { - this.statMap.set("type",this.statMap.get("type").toLowerCase()); + this.statMap.set("type", this.statMap.get("type").toLowerCase()); if (armorTypes.includes(this.statMap.get("type"))) { - this.statMap.set("category","armor"); + this.statMap.set("category", "armor"); } else if (accessoryTypes.includes(this.statMap.get("type"))) { - this.statMap.set("category","accessory"); + this.statMap.set("category", "accessory"); } else if (weaponTypes.includes(this.statMap.get("type"))) { - this.statMap.set("category","weapon"); + this.statMap.set("category", "weapon"); } else if (consumableTypes.includes(this.statMap.get("type"))) { - this.statMap.set("category","consumable"); + this.statMap.set("category", "consumable"); } else if (tomeTypes.includes(this.statMap.get("type"))) { this.statMap.set("category", "tome"); } @@ -278,13 +279,13 @@ class Custom{ this.statMap.set("crafted", true); for (const e of skp_elements) { - this.statMap.set(e+"DamLow", this.statMap.get(e+"Dam")); + this.statMap.set(e + "DamLow", this.statMap.get(e + "Dam")); } this.statMap.set("nDamLow", this.statMap.get("nDam")); this.statMap.set("hpLow", this.statMap.get("hp")); for (const e of skp_order) { - this.statMap.get("minRolls").set(e,this.statMap.get(e)); - this.statMap.get("maxRolls").set(e,this.statMap.get(e)); + this.statMap.get("minRolls").set(e, this.statMap.get(e)); + this.statMap.get("maxRolls").set(e, this.statMap.get(e)); } // for (const e of ["durability", "duration"]) { // if (this.statMap.get(e) === "") { @@ -294,15 +295,15 @@ class Custom{ // } // } - this.statMap.set("lvlLow",this.statMap.get("lvl")); + this.statMap.set("lvlLow", this.statMap.get("lvl")); if (this.statMap.get("category") === "weapon") { //this is for powder purposes. //users will likely not stick to the 0.9,1.1 rule because custom item. We will get around this by breaking everything and rewarding users for sticking to 0.9,1.1. - this.statMap.set("nDamBaseLow", Math.floor((parseFloat(this.statMap.get("nDamLow")) + parseFloat(this.statMap.get("nDam"))) / 2) ); - this.statMap.set("nDamBaseHigh", Math.floor((parseFloat(this.statMap.get("nDamLow")) + parseFloat(this.statMap.get("nDam"))) / 2) ); + this.statMap.set("nDamBaseLow", Math.floor((parseFloat(this.statMap.get("nDamLow")) + parseFloat(this.statMap.get("nDam"))) / 2)); + this.statMap.set("nDamBaseHigh", Math.floor((parseFloat(this.statMap.get("nDamLow")) + parseFloat(this.statMap.get("nDam"))) / 2)); for (const e in skp_elements) { - this.statMap.set(skp_elements[e]+"DamBaseLow", Math.floor((parseFloat(this.statMap.get(skp_elements[e]+"DamLow")) + parseFloat(this.statMap.get(skp_elements[e]+"Dam"))) / 2)); - this.statMap.set(skp_elements[e]+"DamBaseHigh", Math.floor((parseFloat(this.statMap.get(skp_elements[e]+"DamLow")) + parseFloat(this.statMap.get(skp_elements[e]+"Dam"))) / 2)); + this.statMap.set(skp_elements[e] + "DamBaseLow", Math.floor((parseFloat(this.statMap.get(skp_elements[e] + "DamLow")) + parseFloat(this.statMap.get(skp_elements[e] + "Dam"))) / 2)); + this.statMap.set(skp_elements[e] + "DamBaseHigh", Math.floor((parseFloat(this.statMap.get(skp_elements[e] + "DamLow")) + parseFloat(this.statMap.get(skp_elements[e] + "Dam"))) / 2)); } this.statMap.set("ingredPowders", []); } @@ -310,7 +311,7 @@ class Custom{ if (this.statMap.get("category") !== "weapon") { this.statMap.set("atkSpd", ""); - for (const n in ["nDam","eDam","tDam","wDam","fDam","aDam"]) { + for (const n in ["nDam", "eDam", "tDam", "wDam", "fDam", "aDam"]) { //this.statMap.set(n,""); } } else { @@ -323,12 +324,12 @@ class Custom{ } else { this.statMap.set("displayName", "Custom Item"); } - this.statMap.set("powders",[]); + this.statMap.set("powders", []); - this.statMap.set("reqs",[this.statMap.get("strReq"),this.statMap.get("dexReq"),this.statMap.get("intReq"),this.statMap.get("defReq"),this.statMap.get("agiReq")]); - this.statMap.set("skillpoints", [this.statMap.get("str"),this.statMap.get("dex"),this.statMap.get("int"),this.statMap.get("def"),this.statMap.get("agi")]); - + this.statMap.set("reqs", [this.statMap.get("strReq"), this.statMap.get("dexReq"), this.statMap.get("intReq"), this.statMap.get("defReq"), this.statMap.get("agiReq")]); + this.statMap.set("skillpoints", [this.statMap.get("str"), this.statMap.get("dex"), this.statMap.get("int"), this.statMap.get("def"), this.statMap.get("agi")]); + this.statMap.set("restrict", "Custom Item") } diff --git a/js/customizer.js b/js/customizer.js index 84c665e..80c6c66 100644 --- a/js/customizer.js +++ b/js/customizer.js @@ -232,6 +232,7 @@ function decodeCustom(custom_url_tag) { let id = ci_save_order[Base64.toInt(tag.slice(0,2))]; //console.log(tag.slice(0, 2) + ": " + id); let len = Base64.toInt(tag.slice(2,4)); + if (rolledIDs.includes(id)) { let sign = parseInt(tag.slice(4,5),10); let minRoll = Base64.toInt(tag.slice(5,5+len));