package Item import NoWurst import public Vectors public function createItem(int itemId, vec2 pos) returns item return createItem(itemId, pos.toVec3()) public function createItem(int itemId, vec3 pos) returns item return CreateItem(itemId, pos.x, pos.y) public function item.remove() RemoveItem(this) public function item.getTypeId() returns int return GetItemTypeId(this) /** Returns "itemtype" of this item. Do not confuse it with itemTypeId. */ public function item.getItemtype() returns itemtype return GetItemType(this) public function item.getLevel() returns int return GetItemLevel(this) public function item.getX() returns real return GetItemX(this) public function item.getY() returns real return GetItemY(this) public function item.getPos() returns vec2 return vec2(this.getX(), this.getY()) public function item.setPos(vec2 pos) SetItemPosition(this, pos.x, pos.y) public function item.setDropOnDeath(boolean flag) SetItemDropOnDeath(this, flag) public function item.setDroppable(boolean flag) SetItemDroppable(this, flag) public function item.setPawnable(boolean flag) SetItemPawnable(this, flag) public function item.setInvulnerable(boolean flag) SetItemInvulnerable(this, flag) public function item.setVisible(boolean flag) SetItemVisible(this, flag) public function item.isInvulnerable() returns boolean return IsItemInvulnerable(this) public function item.isVisible() returns boolean return IsItemVisible(this) public function item.isOwned() returns boolean return IsItemOwned(this) public function item.isPowerup() returns boolean return IsItemPowerup(this) public function item.isSellable() returns boolean return IsItemSellable(this) public function item.isPawnable() returns boolean return IsItemPawnable(this) /** Returns true if item is not destroyed and has a valid type id. */ public function item.isAlive() returns boolean return this.getTypeId() != 0 and GetWidgetLife(this) > .405 /** Returns true if item can be picked up by a unit. */ public function item.isPickupable() returns boolean return this.isAlive() and not this.isOwned() and this.isVisible() public function item.getPlayer() returns player return GetItemPlayer(this) public function item.setPlayer(player whichPlayer, boolean changeColor) SetItemPlayer(this, whichPlayer, changeColor) public function item.getCharges() returns int return GetItemCharges(this) public function item.setCharges(int charges) SetItemCharges(this, charges) public function item.getUserData() returns int return GetItemUserData(this) public function item.setUserData(int data) SetItemUserData(this, data) public function item.getName() returns string return GetItemName(this) public function item.setName(string name) BlzSetItemName(this, name) public function item.getDescription() returns string return BlzGetItemDescription(this) public function item.setDescription(string description) BlzSetItemDescription(this, description) public function item.getTooltip() returns string return BlzGetItemTooltip(this) public function item.setTooltip(string tooltip) BlzSetItemTooltip(this, tooltip) public function item.getExtendedTooltip() returns string return BlzGetItemExtendedTooltip(this) public function item.setExtendedTooltip(string tooltip) BlzSetItemExtendedTooltip(this, tooltip) public function item.getIconPath() returns string return BlzGetItemIconPath(this) public function item.setIconPath(string path) BlzSetItemIconPath(this, path) // Item-Ability Get/Setters public function item.getAbilityByIndex(int index) returns ability return BlzGetItemAbilityByIndex(this, index) public function item.getAbility(int abiId) returns ability return BlzGetItemAbility(this, abiId) public function item.addAbility(int abiId) returns bool return BlzItemAddAbility(this, abiId) public function item.removeAbility(int abiId) returns bool return BlzItemRemoveAbility(this, abiId) // Item Field Getters public function item.getField(itembooleanfield field) returns bool return BlzGetItemBooleanField(this, field) public function item.getField(itemintegerfield field) returns int return BlzGetItemIntegerField(this, field) public function item.getField(itemrealfield field) returns real return BlzGetItemRealField(this, field) public function item.getField(itemstringfield field) returns string return BlzGetItemStringField(this, field) // Item Field Setters public function item.setField(itembooleanfield field, bool value) returns bool return BlzSetItemBooleanField(this, field, value) public function item.setField(itemintegerfield field, int value) returns bool return BlzSetItemIntegerField(this, field, value) public function item.setField(itemrealfield field, real value) returns bool return BlzSetItemRealField(this, field, value) public function item.setField(itemstringfield field, string value) returns bool return BlzSetItemStringField(this, field, value) /** Updates the item's name, tooltip, extendedtooltip, description or icon for the specific player. If p == null, the item is updated for all players */ function item.updateDetails(player p, string itemName, string itemTooltip, string itemExtendedTooltip, string itemDesc, string itemIcon) returns bool var valid = false if this != null and (itemName != "" or itemTooltip != "" or itemExtendedTooltip != "" or itemDesc != "" or itemIcon != "") valid = true if (p == null or p == GetLocalPlayer()) if itemName != "" this.setName(itemName) if itemTooltip != "" this.setTooltip(itemTooltip) if itemExtendedTooltip != "" this.setExtendedTooltip(itemExtendedTooltip) if itemDesc != "" this.setDescription(itemDesc) if itemIcon != "" this.setIconPath(itemIcon) return valid /** Updates the item's name, tooltip, extendedtooltip, description or icon for the specific player. If p == null, the item is updated for all players Returns false if no player is given. */ public function item.updateDetailsForPlayer(player p, string itemName, string itemTooltip, string itemExtendedTooltip, string itemDesc, string itemIcon) returns bool return p != null ? this.updateDetails(p, itemName, itemTooltip, itemExtendedTooltip, itemDesc, itemIcon) : false /** Updates the item's name, tooltip, extendedtooltip, description or icon for the specific player. If p == null, the item is updated for all players Returns false if no player is given. */ public function item.updateDetailsForAll(string itemName, string itemTooltip, string itemExtendedTooltip, string itemDesc, string itemIcon) returns bool return this.updateDetails(null, itemName, itemTooltip, itemExtendedTooltip, itemDesc, itemIcon)