def get_instances(self, list_name, instance_class): result = [] i = 0 for p in self.git[list_name]: gff_inst = GffInstance(self.git, list_name, i) st_inst = instance_class(gff_inst, self) result.append(st_inst) i += 1 return result
def getBagItems(item): result = [] i = 0 for p in item.gff['ItemList']: gff_inst = GffInstance(item.gff, 'ItemList', i) st_inst = ItemInstance(gff_inst, item) equip_slot = p['_STRUCT_TYPE_'] result.append((equip_slot, st_inst)) i += 1 return result
def tiles(self): """Tiles :returns: List of :class:`pynwn.TileInstance` objects. """ result = [] i = 0 for p in self.are['Tile_List']: gff_inst = GffInstance(self.are, 'Tile_List', i) st_inst = TileInstance(gff_inst, self) result.append(st_inst) i += 1 return result
def creatures(self): """Creatures in the encounter. :returns: List of :class:`EncounterCreature` objects. """ result = [] i = 0 for p in self.gff['CreatureList']: gff_inst = GffInstance(self.gff, 'CreatureList', i) st_inst = EncounterCreature(gff_inst, self) result.append(st_inst) i += 1 return result
def properties(self): """Item properties :returns: List of :class:`ItemProperty` objects. """ result = [] i = 0 for p in self.gff['PropertiesList']: gff_inst = GffInstance(self.gff, 'PropertiesList', i) st_inst = ItemProperty(gff_inst, self) result.append(st_inst) i += 1 return result
def pointers(self): """Dialog pointers :returns: List of DialogPointers """ result = [] i = 0 for p in self.gff[self.pointer]: gff_inst = GffInstance(self.gff, self.pointer, i) st_inst = DialogPointer(gff_inst, self.pointer, self.parent) result.append(st_inst) i += 1 return result
def entries(self): """Entries :returns: List of DialogNodes """ if self.entry_cache is None: result = [] i = 0 for p in self.gff['EntryList']: gff_inst = GffInstance(self.gff, 'EntryList', i) st_inst = DialogNode(gff_inst, 'RepliesList', self) result.append(st_inst) i += 1 self.entry_cache = result return self.entry_cache
def equips(self): """ Creature's equipment list. :returns: List of tuples containing equipment ID and :class:`pynwn.ItemInstance`. """ result = [] i = 0 for p in self.gff['Equip_ItemList']: gff_inst = GffInstance(self.gff, 'Equip_ItemList', i) st_inst = ItemInstance(gff_inst, self.parent_obj) equip_slot = p['_STRUCT_TYPE_'] result.append((equip_slot, st_inst)) i += 1 return result
def items(self): """ Creature's equipment list. :returns: List of tuples containing equipment ID and ItemInstance. """ result = [] i = 0 for p in self.gff['ItemList']: gff_inst = GffInstance(self.gff, 'ItemList', i) st_inst = ItemInstance(gff_inst, self) equip_slot = p['_STRUCT_TYPE_'] result.append((equip_slot, st_inst)) i += 1 return result
def starts(self): """Starts These are limited pointers in the entry list to the topmost level of dialog in a concersation. :returns: List of DialogPointers """ result = [] i = 0 for p in self.gff['StartingList']: gff_inst = GffInstance(self.gff, 'StartingList', i) st_inst = DialogPointer(gff_inst, 'EntriesList', self, True) result.append(st_inst) i += 1 return result
def items(self): """Creature's inventory items. :returns: List of RepositoryItems. """ result = [] i = 0 try: for p in self.gff['ItemList']: gff_inst = GffInstance(self.gff, 'ItemList', i) st_inst = RepositoryItem(gff_inst, self) result.append(st_inst) i += 1 except KeyError: pass return result
def items(self): """Invenory items. :returns: List of RepositoryItem objects or [] if the object does not have an inventory. """ if self.has_inventory and self.gff.has_field('ItemList'): result = [] i = 0 for p in self.gff['ItemList']: gff_inst = GffInstance(self.gff, 'ItemList', i) st_inst = RepositoryItem(gff_inst, self) result.append(st_inst) i += 1 return result else: return []
def items(self): """Inventory items. :returns: List of Tupels contiain repository position and the ItemInstance. """ result = [] i = 0 # If the creature doesn't have inventory items they won't # have an 'ItemList' field in their gff structure. try: for p in self.gff['ItemList']: gff_inst = GffInstance(self.gff, 'ItemList', i) st_inst = ItemInstance(gff_inst, self) repo_pos = (p['Repos_PosX'], p['Repos_Posy']) result.append((repo_pos, st_inst)) i += 1 except KeyError: pass return result
def items(self): """Items in inventory. :returns: a two dimensional array with the format: [<store page>][<RepositoryItem objects>] """ res = [] for page in self['StoreList']: items = [] try: for p in self.gff['ItemList']: gff_inst = GffInstance(self, self.gff, 'ItemList', i) st_inst = RepositoryItem(gff_inst) items.append(st_inst) i += 1 except Exception as e: print(e) pass res.append(items) return res