def updateBelt(self, event): beltParent = self.document.GetElementById("beltContainer") for child in beltParent.child_nodes: child.inner_rml = "" inventory = freeablo.updateInventory() global cursorItem global cursor cursor = inventory["cursor"]["empty"] cursorItem = inventory["cursor"] for i, item in enumerate(inventory["belt"]): parent = self.document.GetElementById("belt" + str(i)) element = self.document.CreateElement("div") element.SetAttribute("InvX", str(item["invX"])) element.SetAttribute("InvY", str(item["invY"])) element.SetAttribute("BeltX", str(i)) element.SetAttribute("empty", "false") element.SetAttribute("class", "beltItem") if item["empty"] is False: parent.style.background_color = "#A3191950" element.SetAttribute("class", "itemGraphic" + str(item["graphic"])) element.style.width = "28px" element.style.height = "28px" else: parent.style.background_color = "#00000000" element.SetAttribute("empty", "true") element.style.width = "0px" element.style.height = "0px" parent.AppendChild(element)
def updateBelt(self, event): beltParent = self.document.GetElementById("beltContainer") for child in beltParent.child_nodes: child.inner_rml="" inventory = freeablo.updateInventory() global cursorItem global cursor cursor = inventory["cursor"]["empty"] cursorItem = inventory["cursor"] for i, item in enumerate(inventory["belt"]): parent = self.document.GetElementById("belt" + str(i)) element = self.document.CreateElement("div") element.SetAttribute("InvX", str(item["invX"])) element.SetAttribute("InvY", str(item["invY"])) element.SetAttribute("BeltX", str(i)) element.SetAttribute("empty", "false") element.SetAttribute("class", "beltItem") if item["empty"] is False: parent.style.background_color="#A3191950" element.SetAttribute("class", "itemGraphic" + str(item["graphic"])); element.style.width = "28px" element.style.height = "28px" else: parent.style.background_color="#00000000" element.SetAttribute("empty", "true") element.style.width="0px" element.style.height="0px" parent.AppendChild(element)
def updateInventory(self, event): inventory_element = self.document.GetElementById("inventory") self.document.GetElementById("rightHand").inner_rml = "" self.document.GetElementById("leftHand").inner_rml = "" self.document.GetElementById("rightRing").inner_rml = "" self.document.GetElementById("leftRing").inner_rml = "" self.document.GetElementById("body").inner_rml = "" self.document.GetElementById("head").inner_rml = "" self.document.GetElementById("amulet").inner_rml = "" for child in inventory_element.child_nodes: child.inner_rml = "" child.style.background_color = "#00000000" inventory = freeablo.updateInventory() leftHandItem = inventory["leftHand"] leftHandContainer = self.document.GetElementById("leftHand") leftHand = self.document.CreateElement("div") if leftHandItem["empty"] is False: leftHandContainer.style.background_color = "#A3191950" leftHand.SetAttribute("empty", "false") leftHand.style.width = str(28 * leftHandItem["sizeX"]) + "px" leftHand.style.height = str(28 * leftHandItem["sizeY"]) + "px" if leftHandItem["sizeX"] == 1: leftHand.style.left = str(int(leftHand.style.left) + 10) + "px" if leftHandItem["sizeY"] == 2: leftHand.style.top = str(int(leftHand.style.top) + 14) + "px" leftHand.SetAttribute("class", "itemGraphic" + str(leftHandItem["graphic"])) else: leftHandContainer.style.background_color = "#00000000" leftHand.style.width = "0" leftHand.style.height = "0" leftHand.SetAttribute("empty", "true") leftHandContainer.AppendChild(leftHand) rightHandItem = inventory["rightHand"] rightHandContainer = self.document.GetElementById("rightHand") rightHand = self.document.CreateElement("div") if rightHandItem["empty"] is False: rightHandContainer.style.background_color = "#A3191950" rightHand.SetAttribute("empty", "false") rightHand.style.width = str(28 * rightHandItem["sizeX"]) + "px" rightHand.style.height = str(28 * rightHandItem["sizeY"]) + "px" if rightHandItem["sizeX"] == 1: rightHand.style.left = str(int(rightHand.style.left) + 10) + "px" if rightHandItem["sizeY"] == 2: rightHand.style.top = str(int(rightHand.style.top) + 14) + "px" rightHand.SetAttribute("class", "itemGraphic" + str(rightHandItem["graphic"])) else: rightHandContainer.style.background_color = "#00000000" rightHand.style.width = "0" rightHand.style.height = "0" rightHand.SetAttribute("empty", "true") rightHandContainer.AppendChild(rightHand) bodyItem = inventory["body"] bodyContainer = self.document.GetElementById("body") body = self.document.CreateElement("div") if bodyItem["empty"] is False: bodyContainer.style.background_color = "#A3191950" body.SetAttribute("empty", "false") body.style.width = "57px" body.style.height = "87px" body.SetAttribute("class", "itemGraphic" + str(bodyItem["graphic"])) else: bodyContainer.style.background_color = "#00000000" body.style.width = "0" body.style.height = "0" body.SetAttribute("empty", "true") bodyContainer.AppendChild(body) headItem = inventory["head"] headContainer = self.document.GetElementById("head") head = self.document.CreateElement("div") if headItem["empty"] is False: headContainer.style.background_color = "#A3191950" head.SetAttribute("empty", "false") head.style.width = "56px" head.style.height = "56px" head.SetAttribute("class", "itemGraphic" + str(headItem["graphic"])) else: headContainer.style.background_color = "#00000000" head.style.width = "0" head.style.height = "0" head.SetAttribute("empty", "true") headContainer.AppendChild(head) amuletItem = inventory["amulet"] amuletContainer = self.document.GetElementById("amulet") amulet = self.document.CreateElement("div") if amuletItem["empty"] is False: amuletContainer.style.background_color = "#A3191950" amulet.SetAttribute("empty", "false") amulet.style.width = "28px" amulet.style.height = "28px" amulet.SetAttribute("class", "itemGraphic" + str(amuletItem["graphic"])) else: amuletContainer.style.background_color = "#00000000" amulet.style.width = "0" amulet.style.height = "0" amulet.SetAttribute("empty", "true") amuletContainer.AppendChild(amulet) leftRingItem = inventory["leftRing"] leftRingContainer = self.document.GetElementById("leftRing") leftRing = self.document.CreateElement("div") if leftRingItem["empty"] is False: leftRingContainer.style.background_color = "#A3191950" leftRing.SetAttribute("empty", "false") leftRing.style.width = "28px" leftRing.style.height = "28px" leftRing.SetAttribute("class", "itemGraphic" + str(leftRingItem["graphic"])) else: leftRingContainer.style.background_color = "#00000000" leftRing.style.width = "0" leftRing.style.height = "0" leftRing.SetAttribute("empty", "true") leftRingContainer.AppendChild(leftRing) rightRingItem = inventory["rightRing"] rightRingContainer = self.document.GetElementById("rightRing") rightRing = self.document.CreateElement("div") if rightRingItem["empty"] is False: rightRingContainer.style.background_color = "#A3191950" rightRing.SetAttribute("empty", "false") rightRing.style.width = "28px" rightRing.style.height = "28px" rightRing.SetAttribute("class", "itemGraphic" + str(rightRingItem["graphic"])) else: rightRingContainer.style.background_color = "#00000000" rightRing.style.width = "0" rightRing.style.height = "0" rightRing.SetAttribute("empty", "true") rightRingContainer.AppendChild(rightRing) global cursor global cursorItem cursorItem = inventory["cursor"] cursor = cursorItem["empty"] inventoryBox = inventory["inventoryBox"] for i, item in enumerate(inventoryBox): parent = self.document.GetElementById("inv-item-socket" + str(i)) element = self.document.CreateElement("div") element.SetAttribute("InvX", str(item["invX"])) element.SetAttribute("InvY", str(item["invY"])) if item["empty"] is False: element.SetAttribute("class", "itemGraphic" + str(item["graphic"])) element.SetAttribute("SizeX", str(item["sizeX"])) element.SetAttribute("SizeY", str(item["sizeY"])) element.style.background_color = "#A3191950" element.style.width = str(28 * item["sizeX"]) element.style.height = str(28 * item["sizeY"]) element.SetAttribute("CornerX", str(item["cornerX"])) element.SetAttribute("CornerY", str(item["cornerY"])) if item["real"] is True: element.SetAttribute("real", "true") else: element.style.display = "none" element.SetAttribute("real", "false") else: element.SetAttribute("empty", "true") parent.style.background_color = "#00000000" parent.AppendChild(element)
def updateInventory(self, event): inventory_element = self.document.GetElementById("inventory") self.document.GetElementById("rightHand").inner_rml="" self.document.GetElementById("leftHand").inner_rml="" self.document.GetElementById("rightRing").inner_rml="" self.document.GetElementById("leftRing").inner_rml="" self.document.GetElementById("body").inner_rml="" self.document.GetElementById("head").inner_rml="" self.document.GetElementById("amulet").inner_rml="" for child in inventory_element.child_nodes: child.inner_rml = "" child.style.background_color="#00000000" inventory = freeablo.updateInventory() leftHandItem = inventory["leftHand"] leftHandContainer = self.document.GetElementById("leftHand") leftHand = self.document.CreateElement("div") if leftHandItem["empty"] is False: leftHandContainer.style.background_color="#A3191950" leftHand.SetAttribute("empty", "false") leftHand.style.width = str(28 * leftHandItem["sizeX"]) + "px" leftHand.style.height = str(28 * leftHandItem["sizeY"]) + "px" if leftHandItem["sizeX"] == 1: leftHand.style.left = str(int(leftHand.style.left)+10) + "px" if leftHandItem["sizeY"] == 2: leftHand.style.top = str(int(leftHand.style.top)+14) + "px" leftHand.SetAttribute("class", "itemGraphic" + str(leftHandItem["graphic"])) else: leftHandContainer.style.background_color="#00000000" leftHand.style.width = "0" leftHand.style.height = "0" leftHand.SetAttribute("empty", "true") leftHandContainer.AppendChild(leftHand) rightHandItem = inventory["rightHand"] rightHandContainer = self.document.GetElementById("rightHand") rightHand = self.document.CreateElement("div") if rightHandItem["empty"] is False: rightHandContainer.style.background_color="#A3191950" rightHand.SetAttribute("empty", "false") rightHand.style.width = str(28 * rightHandItem["sizeX"]) + "px" rightHand.style.height = str(28 * rightHandItem["sizeY"]) + "px" if rightHandItem["sizeX"] == 1: rightHand.style.left = str(int(rightHand.style.left)+10) + "px" if rightHandItem["sizeY"] == 2: rightHand.style.top = str(int(rightHand.style.top)+14) + "px" rightHand.SetAttribute("class", "itemGraphic" + str(rightHandItem["graphic"])) else: rightHandContainer.style.background_color="#00000000" rightHand.style.width = "0" rightHand.style.height = "0" rightHand.SetAttribute("empty", "true") rightHandContainer.AppendChild(rightHand) bodyItem = inventory["body"] bodyContainer = self.document.GetElementById("body") body = self.document.CreateElement("div") if bodyItem["empty"] is False: bodyContainer.style.background_color="#A3191950" body.SetAttribute("empty", "false") body.style.width = "57px" body.style.height = "87px" body.SetAttribute("class", "itemGraphic" + str(bodyItem["graphic"])) else: bodyContainer.style.background_color="#00000000" body.style.width = "0" body.style.height = "0" body.SetAttribute("empty", "true") bodyContainer.AppendChild(body) headItem = inventory["head"] headContainer = self.document.GetElementById("head") head = self.document.CreateElement("div") if headItem["empty"] is False: headContainer.style.background_color="#A3191950" head.SetAttribute("empty", "false") head.style.width = "56px" head.style.height = "56px" head.SetAttribute("class", "itemGraphic" + str(headItem["graphic"])) else: headContainer.style.background_color="#00000000" head.style.width = "0" head.style.height = "0" head.SetAttribute("empty", "true") headContainer.AppendChild(head) amuletItem = inventory["amulet"] amuletContainer = self.document.GetElementById("amulet") amulet = self.document.CreateElement("div") if amuletItem["empty"] is False: amuletContainer.style.background_color="#A3191950" amulet.SetAttribute("empty", "false") amulet.style.width = "28px" amulet.style.height = "28px" amulet.SetAttribute("class", "itemGraphic" + str(amuletItem["graphic"])) else: amuletContainer.style.background_color="#00000000" amulet.style.width = "0" amulet.style.height = "0" amulet.SetAttribute("empty", "true") amuletContainer.AppendChild(amulet) leftRingItem = inventory["leftRing"] leftRingContainer = self.document.GetElementById("leftRing") leftRing = self.document.CreateElement("div") if leftRingItem["empty"] is False: leftRingContainer.style.background_color="#A3191950" leftRing.SetAttribute("empty", "false") leftRing.style.width = "28px" leftRing.style.height = "28px" leftRing.SetAttribute("class", "itemGraphic" + str(leftRingItem["graphic"])) else: leftRingContainer.style.background_color="#00000000" leftRing.style.width = "0" leftRing.style.height = "0" leftRing.SetAttribute("empty", "true") leftRingContainer.AppendChild(leftRing) rightRingItem = inventory["rightRing"] rightRingContainer = self.document.GetElementById("rightRing") rightRing = self.document.CreateElement("div") if rightRingItem["empty"] is False: rightRingContainer.style.background_color="#A3191950" rightRing.SetAttribute("empty", "false") rightRing.style.width = "28px" rightRing.style.height = "28px" rightRing.SetAttribute("class", "itemGraphic" + str(rightRingItem["graphic"])) else: rightRingContainer.style.background_color="#00000000" rightRing.style.width = "0" rightRing.style.height = "0" rightRing.SetAttribute("empty", "true") rightRingContainer.AppendChild(rightRing) global cursor global cursorItem cursorItem = inventory["cursor"] cursor = cursorItem["empty"] inventoryBox = inventory["inventoryBox"] for i, item in enumerate(inventoryBox): parent = self.document.GetElementById("inv-item-socket" + str(i)) element = self.document.CreateElement("div") element.SetAttribute("InvX", str(item["invX"])) element.SetAttribute("InvY", str(item["invY"])) if item["empty"] is False: element.SetAttribute("class", "itemGraphic"+str(item["graphic"])) element.SetAttribute("SizeX", str(item["sizeX"])) element.SetAttribute("SizeY", str(item["sizeY"])) element.style.background_color="#A3191950" element.style.width = str(28*item["sizeX"]) element.style.height = str(28*item["sizeY"]) element.SetAttribute("CornerX", str(item["cornerX"])) element.SetAttribute("CornerY", str(item["cornerY"])) if item["real"] is True: element.SetAttribute("real", "true") else: element.style.display = "none" element.SetAttribute("real", "false") else: element.SetAttribute("empty", "true") parent.style.background_color="#00000000" parent.AppendChild(element)