MCPcopy Create free account
hub / github.com/candybox2/candybox2.github.io / selectedEqItem

Method selectedEqItem

code/main/Inventory.ts:224–250  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

222 }
223
224 private selectedEqItem(): void{
225 // Set the eqItems
226 if($("#inventoryWeaponsList").length) Saving.saveString("gameWeaponSelected", $("#inventoryWeaponsList").find(":selected").attr("id"));
227 else Saving.saveString("gameWeaponSelected", "inventorySpecialNothingWeapon");
228
229 if($("#inventoryHatsList").length) Saving.saveString("gameHatSelected", $("#inventoryHatsList").find(":selected").attr("id"));
230 else Saving.saveString("gameHatSelected", "inventorySpecialNothingHat");
231
232 if($("#inventoryBodyArmoursList").length) Saving.saveString("gameBodyArmourSelected", $("#inventoryBodyArmoursList").find(":selected").attr("id"));
233 else Saving.saveString("gameBodyArmourSelected", "inventorySpecialNothingBodyArmour");
234
235 if($("#inventoryGlovesList").length) Saving.saveString("gameGlovesSelected", $("#inventoryGlovesList").find(":selected").attr("id"));
236 else Saving.saveString("gameGlovesSelected", "inventorySpecialNothingGloves");
237
238 if($("#inventoryBootsList").length) Saving.saveString("gameBootsSelected", $("#inventoryBootsList").find(":selected").attr("id"));
239 else Saving.saveString("gameBootsSelected", "inventorySpecialNothingBoots");
240
241 // Fill the selected eqItems array
242 this.getGame().emptyAndFillSelectedEqItemsArray();
243
244 // Re calculate the player max hp, because it may have changed
245 this.getGame().getPlayer().reCalcMaxHp();
246
247 // Update inventory
248 this.update();
249 this.getGame().updatePlace();
250 }
251
252 private selectRightEqItems(): void{
253 // We select the right eqItems

Callers

nothing calls this directly

Calls 9

updateMethod · 0.95
$Function · 0.85
attrMethod · 0.80
findMethod · 0.80
reCalcMaxHpMethod · 0.80
getPlayerMethod · 0.80
updatePlaceMethod · 0.80
getGameMethod · 0.45

Tested by

no test coverage detected