def load_inventory(self): rows = self.world.db.select('* FROM game_item WHERE owner=?', [self.dbid]) if rows: for row in rows: item = GameItem(row) item.owner = self if item.has_type('equippable'): equip_type = item.item_types['equippable'] if equip_type.is_equipped: self.equipped[equip_type.equip_slot] = item self.isequipped.append(item) equip_type.on_equip() if item.has_type('container'): item.item_types['container'].load_inventory() self.inventory.append(item)
def load_inventory(self): # Only game items should load inventory items - if this is not connected # to a game item, just return without doing anything if not self.game_item: return from shinymud.models.item import GameItem rows = self.world.db.select('* from game_item where container=?', [self.game_item.dbid]) for row in rows: new_item = GameItem(row) self.inventory.append(new_item) if new_item.has_type('container'): new_item.item_types['container'].load_inventory()