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

Method drawEquipment

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

Source from the content-addressed store, hash-verified

88 }
89
90 private drawEquipment(): void{
91 // Add backgrounds and lists
92 var arr: string[];
93 // Weapon
94 arr = this.createArrayFromEqItemsArrayForRenderAreaList(this.getGame().getWeapons(), "inventorySpecialNothingWeapon");
95 if(arr.length > 2) this.renderArea.addList(8, 38, 15, "inventoryWeaponsList", new CallbackCollection(this.selectedEqItem.bind(this)), arr);
96
97 // Hat
98 arr = this.createArrayFromEqItemsArrayForRenderAreaList(this.getGame().getHats(), "inventorySpecialNothingHat");
99 if(arr.length > 2){
100 this.renderArea.drawArray(Database.getAscii("general/inventoryHat"), 59, 12);
101 this.renderArea.addList(61, 93, 14, "inventoryHatsList", new CallbackCollection(this.selectedEqItem.bind(this)), arr);
102 }
103
104 // Body armour
105 arr = this.createArrayFromEqItemsArrayForRenderAreaList(this.getGame().getBodyArmours(), "inventorySpecialNothingBodyArmour");
106 if(arr.length > 2){
107 this.renderArea.drawArray(Database.getAscii("general/inventoryBodyArmour"), 59, 25);
108 this.renderArea.addList(61, 78, 27, "inventoryBodyArmoursList", new CallbackCollection(this.selectedEqItem.bind(this)), arr);
109 }
110
111 // Gloves
112 arr = this.createArrayFromEqItemsArrayForRenderAreaList(this.getGame().getGloves(), "inventorySpecialNothingGloves");
113 if(arr.length > 2){
114 this.renderArea.drawArray(Database.getAscii("general/inventoryGloves"), 82, 25);
115 this.renderArea.addList(84, 93, 27, "inventoryGlovesList", new CallbackCollection(this.selectedEqItem.bind(this)), arr);
116 }
117
118 // Boots
119 arr = this.createArrayFromEqItemsArrayForRenderAreaList(this.getGame().getBoots(), "inventorySpecialNothingBoots");
120 if(arr.length > 2){
121 this.renderArea.drawArray(Database.getAscii("general/inventoryBoots"), 59, 38);
122 this.renderArea.addList(61, 93, 40, "inventoryBootsList", new CallbackCollection(this.selectedEqItem.bind(this)), arr);
123 }
124
125 // Add links which will call callbacks after the html dom is created
126 this.renderArea.addLinkCallbackCollection(new CallbackCollection(this.selectRightEqItems.bind(this))); // Select the right items
127 if(this.getGame().getWeAreQuesting() == true) this.renderArea.addLinkCallbackCollection(new CallbackCollection(this.disableAllLists.bind(this))); // Disable all the lists
128
129 // Draw the eqItems
130 this.drawEqItem(this.getGame().getSelectedEqItems()["weapon"], new Pos(7, 16), new Pos(32, 33));
131 this.drawEqItem(this.getGame().getSelectedEqItems()["hat"], new Pos(60, 16), new Pos(34, 8));
132 this.drawEqItem(this.getGame().getSelectedEqItems()["bodyArmour"], new Pos(60, 28), new Pos(19, 8));
133 this.drawEqItem(this.getGame().getSelectedEqItems()["gloves"], new Pos(83, 28), new Pos(11, 8));
134 this.drawEqItem(this.getGame().getSelectedEqItems()["boots"], new Pos(60, 41), new Pos(34, 8));
135 }
136
137 private drawGridItem(gridItem: GridItem, x: number, y: number){
138 // Draw the ascii art

Callers 1

updateMethod · 0.95

Calls 15

drawEqItemMethod · 0.95
getWeaponsMethod · 0.80
addListMethod · 0.80
bindMethod · 0.80
getHatsMethod · 0.80
drawArrayMethod · 0.80
getAsciiMethod · 0.80
getBodyArmoursMethod · 0.80
getGlovesMethod · 0.80
getBootsMethod · 0.80

Tested by

no test coverage detected