def load_rooms(area, pArea): area, w = game_utils.read_word(area, False) w = w[1:] # strip the pound while w != '0': room = handler_room.Room() room.vnum = int(w) if room.vnum in instance.room_templates: logger.critical('Dupicate room Vnum: %d', room.vnum) sys.exit(1) instance.room_templates[room.vnum] = room room.area = pArea area, room.name = game_utils.read_string(area) area, room.description = game_utils.read_string(area) area, number = game_utils.read_int(area) # area number area, room.room_flags = game_utils.read_flags(area) area, room.sector_type = game_utils.read_int(area) while True: area, letter = game_utils.read_letter(area) if letter == 'S': break elif letter == 'H': # Healing Room area, room.heal_rate = game_utils.read_int(area) elif letter == 'M': # Mana Room area, room.mana_rate = game_utils.read_int(area) elif letter == 'C': # Clan area, room.clan = game_utils.read_string(area) elif letter == 'D': # exit nexit = world_classes.Exit() area, door = game_utils.read_int(area) area, nexit.description = game_utils.read_string(area) area, nexit.keyword = game_utils.read_string(area) area, locks = game_utils.read_int(area) area, nexit.key = game_utils.read_int(area) area, nexit.to_room = game_utils.read_int(area) room.exit[door] = nexit elif letter == 'E': ed = world_classes.ExtraDescrData() area, ed.keyword = game_utils.read_string(area) area, ed.description = game_utils.read_string(area) room.extra_descr.append(ed) elif letter == 'O': area, room.owner = game_utils.read_string(area) else: logger.critical("RoomIndexData(%d) has flag other than SHMCDEO: %s", (room.vnum, letter)) sys.exit(1) area, w = game_utils.read_word(area, False) w = w[1:] # strip the pound pArea.room_dict[room.vnum] = room return area
def read_bits(self, area, default=0): area, bits = game_utils.read_flags(area) self.set_bit(bits) self.set_bit(default) return area
def load_rooms(area, pArea): area, w = game_utils.read_word(area, False) w = w[1:] # strip the pound while w != '0': room = handler_room.Room(None) room.vnum = int(w) if room.vnum in instance.room_templates: logger.critical('Dupicate room Vnum: %d', room.vnum) sys.exit(1) instance.room_templates[room.vnum] = room room.area = pArea.name area, room.name = game_utils.read_string(area) area, room.description = game_utils.read_string(area) room.description = miniboa.terminal.escape(room.description, 'pyom') area, number = game_utils.read_int(area) # area number area, room.room_flags = game_utils.read_flags(area) area, room.sector_type = game_utils.read_int(area) while True: area, letter = game_utils.read_letter(area) if letter == 'S': break elif letter == 'H': # Healing Room area, room.heal_rate = game_utils.read_int(area) elif letter == 'M': # Mana Room area, room.mana_rate = game_utils.read_int(area) elif letter == 'C': # Clan area, room.clan = game_utils.read_string(area) elif letter == 'D': # exit nexit = world_classes.Exit(None) area, door = game_utils.read_int(area) area, nexit.description = game_utils.read_string(area) area, nexit.keyword = game_utils.read_string(area) #Replaced Locks code area = nexit.exit_info.read_bits(area) area, nexit.key = game_utils.read_int(area) area, nexit.to_room_vnum = game_utils.read_int(area) nexit.name = "Exit %s %d to %d" % \ (nexit.keyword, room.vnum, nexit.to_room_vnum) room.exit[door] = nexit elif letter == 'E': ed = world_classes.ExtraDescrData() area, ed.keyword = game_utils.read_string(area) area, ed.description = game_utils.read_string(area) room.extra_descr.append(ed) elif letter == 'O': area, room.owner = game_utils.read_string(area) else: logger.critical( "RoomIndexData(%d) has flag other than SHMCDEO: %s", (room.vnum, letter)) sys.exit(1) area, w = game_utils.read_word(area, False) w = w[1:] # strip the pound # Create our instances room_instance = object_creator.create_room(room) room_instance.environment = pArea.instance_id return area
def load_objects(area, pArea): area, w = game_utils.read_word(area, False) w = w[1:] # strip the pound while w != '0': flag_data = collections.namedtuple( 'item_flags', ('slots', 'restrictions', 'attributes', 'weapon')) flag_data.slots = set({}) flag_data.restrictions = set({}) flag_data.weapon = set({}) flag_data.attributes = set({}) item = handler_item.Items(None) item.vnum = int(w) instance.item_templates[item.vnum] = item item.area = pArea.name area, item.name = game_utils.read_string(area) area, item.short_descr = game_utils.read_string(area) area, item.description = game_utils.read_string(area) item.description = miniboa.terminal.escape(item.description, 'pyom') area, item.material = game_utils.read_string(area) area, item.item_type = game_utils.read_word(area, False) area, extra_bits = game_utils.read_flags(area) game_utils.item_flags_from_bits(extra_bits, flag_data, 'extra flags') area, wear_bits = game_utils.read_flags(area) game_utils.item_flags_from_bits(wear_bits, flag_data, 'wear flags') if merc.ITEM_LIGHT == item.item_type: flag_data.slots.update({'light'}) item.equips_to = flag_data.slots item.item_restrictions = flag_data.restrictions item.item_attributes = flag_data.attributes if item.item_type == merc.ITEM_WEAPON: area, item.value[0] = game_utils.read_word(area, False) area, item.value[1] = game_utils.read_int(area) area, item.value[2] = game_utils.read_int(area) area, item.value[3] = game_utils.read_word(area, False) item.value[3] = state_checks.name_lookup(const.attack_table, item.value[3]) area, item.value[4] = game_utils.read_flags(area) game_utils.item_flags_from_bits(item.value[4], flag_data, 'weapon flags') item.weapon_attributes = flag_data.weapon elif item.item_type == merc.ITEM_CONTAINER: area, item.value[0] = game_utils.read_int(area) area, item.value[1] = game_utils.read_flags(area) area, item.value[2] = game_utils.read_int(area) area, item.value[3] = game_utils.read_int(area) area, item.value[4] = game_utils.read_int(area) elif item.item_type == merc.ITEM_DRINK_CON or item.item_type == merc.ITEM_FOUNTAIN: area, item.value[0] = game_utils.read_int(area) area, item.value[1] = game_utils.read_int(area) area, item.value[2] = game_utils.read_word(area, False) area, item.value[3] = game_utils.read_int(area) area, item.value[4] = game_utils.read_int(area) elif item.item_type == merc.ITEM_WAND or item.item_type == merc.ITEM_STAFF: area, item.value[0] = game_utils.read_int(area) area, item.value[1] = game_utils.read_int(area) area, item.value[2] = game_utils.read_int(area) area, item.value[3] = game_utils.read_word(area, False) area, item.value[4] = game_utils.read_int(area) elif item.item_type == merc.ITEM_POTION or item.item_type == merc.ITEM_SCROLL \ or item.item_type == merc.ITEM_PILL: area, item.value[0] = game_utils.read_int(area) area, item.value[1] = game_utils.read_word(area, False) area, item.value[2] = game_utils.read_word(area, False) area, item.value[3] = game_utils.read_word(area, False) area, item.value[4] = game_utils.read_word(area, False) else: area, item.value[0] = game_utils.read_flags(area) area, item.value[1] = game_utils.read_flags(area) area, item.value[2] = game_utils.read_flags(area) area, item.value[3] = game_utils.read_flags(area) area, item.value[4] = game_utils.read_flags(area) area, item.level = game_utils.read_int(area) area, item.weight = game_utils.read_int(area) area, item.cost = game_utils.read_int(area) area, item.condition = game_utils.read_word(area, False) if item.condition == 'P': item.condition = 100 elif item.condition == 'G': item.condition = 90 elif item.condition == 'A': item.condition = 75 elif item.condition == 'W': item.condition = 50 elif item.condition == 'D': item.condition = 25 elif item.condition == 'B': item.condition = 10 elif item.condition == 'R': item.condition = 0 else: item.condition = 100 area, w = game_utils.read_word(area, False) while w == 'F' or w == 'A' or w == 'E': if w == 'F': area, word = game_utils.read_word(area, False) area, number = game_utils.read_int(area) area, number = game_utils.read_int(area) area, flags = game_utils.read_flags(area) elif w == 'A': paf = handler_game.AFFECT_DATA() paf.where = merc.TO_OBJECT paf.type = -1 paf.level = 20 paf.duration = -1 area, paf.location = game_utils.read_int(area) area, paf.modifier = game_utils.read_int(area) paf.bitvector = 0 item.affected += [paf] elif w == 'E': ed = world_classes.ExtraDescrData() area, ed.keyword = game_utils.read_string(area) area, ed.description = game_utils.read_string(area) item.extra_descr.append(ed) area, w = game_utils.read_word(area, False) w = w[1:] # strip the pound return area
def load_npcs(area, pArea): area, w = game_utils.read_word(area, False) w = w[1:] # strip the pound while w != '0': npc = handler_npc.Npc() npc.vnum = int(w) instance.npc_templates[npc.vnum] = npc npc.area = pArea.name area, npc.name = game_utils.read_string(area) npc.name = npc.name.lower() area, npc.short_descr = game_utils.read_string(area) area, npc.long_descr = game_utils.read_string(area) npc.long_descr = miniboa.terminal.escape(npc.long_descr, 'pyom') area, npc.description = game_utils.read_string(area) npc.description = miniboa.terminal.escape(npc.description, 'pyom') area, npc.race = game_utils.read_string(area) area = npc.act.read_bits(area, default=merc.ACT_IS_NPC | npc.race.act) area = npc.affected_by.read_bits(area, default=npc.race.aff) area, npc.alignment = game_utils.read_int(area) area, npc.group = game_utils.read_int(area) area, npc.level = game_utils.read_int(area) area, npc.hitroll = game_utils.read_int(area) area, npc.hit_dice[0] = game_utils.read_int(area) area = game_utils.read_forward(area) area, npc.hit_dice[1] = game_utils.read_int(area) area = game_utils.read_forward(area) area, npc.hit_dice[2] = game_utils.read_int(area) area, npc.mana_dice[0] = game_utils.read_int(area) area = game_utils.read_forward(area) area, npc.mana_dice[1] = game_utils.read_int(area) area = game_utils.read_forward(area) area, npc.mana_dice[2] = game_utils.read_int(area) area, npc.dam_dice[0] = game_utils.read_int(area) area = game_utils.read_forward(area) area, npc.dam_dice[1] = game_utils.read_int(area) area = game_utils.read_forward(area) area, npc.dam_dice[2] = game_utils.read_int(area) area, npc.dam_type = game_utils.read_word(area, False) npc.dam_type = state_checks.name_lookup(const.attack_table, npc.dam_type) area, npc.armor[0] = game_utils.read_int(area) area, npc.armor[1] = game_utils.read_int(area) area, npc.armor[2] = game_utils.read_int(area) area, npc.armor[3] = game_utils.read_int(area) area = npc.off_flags.read_bits(area, default=npc.race.off) area = npc.imm_flags.read_bits(area, default=npc.race.imm) area = npc.res_flags.read_bits(area, default=npc.race.res) area = npc.vuln_flags.read_bits(area, default=npc.race.vuln) area, npc.start_pos = game_utils.read_word(area, False) area, npc.default_pos = game_utils.read_word(area, False) npc.start_pos = state_checks.name_lookup(tables.position_table, npc.start_pos, 'short_name') npc.default_pos = state_checks.name_lookup(tables.position_table, npc.default_pos, 'short_name') area, sex = game_utils.read_word(area, False) npc.sex = state_checks.value_lookup(tables.sex_table, sex) area, npc.wealth = game_utils.read_int(area) area = npc.form.read_bits(area, default=npc.race.form) area = npc.parts.read_bits(area, default=npc.race.parts) area, npc.size = game_utils.read_word(area, False) area, npc.material = game_utils.read_word(area, False) area, w = game_utils.read_word(area, False) npc.size = tables.size_table.index(npc.size) while w == 'F': area, word = game_utils.read_word(area, False) area, vector = game_utils.read_flags(area) area, w = game_utils.read_word(area, False) w = w[1:] # strip the pound return area
def load_mobiles(area, pArea): area, w = game_utils.read_word(area, False) w = w[1:] # strip the pound while w != '0': mob = handler_ch.Mobile() mob.vnum = int(w) instance.npc_templates[mob.vnum] = mob area, mob.name = game_utils.read_string(area) area, mob.short_descr = game_utils.read_string(area) area, mob.long_descr = game_utils.read_string(area) area, mob.description = game_utils.read_string(area) area, mob.race = game_utils.read_string(area) mob.race = const.race_table[mob.race] area, mob.act = game_utils.read_flags(area) mob.act = mob.act | merc.ACT_IS_NPC | mob.race.act area, mob.affected_by = game_utils.read_flags(area) mob.affected_by = mob.affected_by | mob.race.aff area, mob.alignment = game_utils.read_int(area) area, mob.group = game_utils.read_int(area) area, mob.level = game_utils.read_int(area) area, mob.hitroll = game_utils.read_int(area) area, mob.hit_dice[0] = game_utils.read_int(area) area = game_utils.read_forward(area) area, mob.hit_dice[1] = game_utils.read_int(area) area = game_utils.read_forward(area) area, mob.hit_dice[2] = game_utils.read_int(area) area, mob.mana_dice[0] = game_utils.read_int(area) area = game_utils.read_forward(area) area, mob.mana_dice[1] = game_utils.read_int(area) area = game_utils.read_forward(area) area, mob.mana_dice[2] = game_utils.read_int(area) area, mob.dam_dice[0] = game_utils.read_int(area) area = game_utils.read_forward(area) area, mob.dam_dice[1] = game_utils.read_int(area) area = game_utils.read_forward(area) area, mob.dam_dice[2] = game_utils.read_int(area) area, mob.dam_type = game_utils.read_word(area, False) mob.dam_type = state_checks.name_lookup(const.attack_table, mob.dam_type) area, mob.ac[0] = game_utils.read_int(area) area, mob.ac[1] = game_utils.read_int(area) area, mob.ac[2] = game_utils.read_int(area) area, mob.ac[3] = game_utils.read_int(area) area, mob.off_flags = game_utils.read_flags(area) mob.off_flags = mob.off_flags | mob.race.off area, mob.imm_flags = game_utils.read_flags(area) mob.imm_flags = mob.imm_flags | mob.race.imm area, mob.res_flags = game_utils.read_flags(area) mob.res_flags = mob.res_flags | mob.race.res area, mob.vuln_flags = game_utils.read_flags(area) mob.vuln_flags = mob.vuln_flags | mob.race.vuln area, mob.start_pos = game_utils.read_word(area, False) area, mob.default_pos = game_utils.read_word(area, False) mob.start_pos = state_checks.name_lookup(tables.position_table, mob.start_pos, 'short_name') mob.default_pos = state_checks.name_lookup(tables.position_table, mob.default_pos, 'short_name') area, sex = game_utils.read_word(area, False) mob.sex = state_checks.value_lookup(tables.sex_table, sex) area, mob.wealth = game_utils.read_int(area) area, mob.form = game_utils.read_flags(area) mob.form = mob.form | mob.race.form area, mob.parts = game_utils.read_flags(area) mob.parts = mob.parts | mob.race.parts area, mob.size = game_utils.read_word(area, False) area, mob.material = game_utils.read_word(area, False) area, w = game_utils.read_word(area, False) mob.size = tables.size_table.index(mob.size) while w == 'F': area, word = game_utils.read_word(area, False) area, vector = game_utils.read_flags(area) area, w = game_utils.read_word(area, False) pArea.mobile_dict[mob.vnum] = mob w = w[1:] # strip the pound return area
def load_objects(area, pArea): area, w = game_utils.read_word(area, False) w = w[1:] # strip the pound while w != '0': obj = handler_item.Items() obj.vnum = int(w) instance.item_templates[obj.vnum] = obj area, obj.name = game_utils.read_string(area) area, obj.short_descr = game_utils.read_string(area) area, obj.description = game_utils.read_string(area) area, obj.material = game_utils.read_string(area) area, item_type = game_utils.read_word(area, False) area, obj.extra_flags = game_utils.read_flags(area) area, obj.wear_flags = game_utils.read_flags(area) obj.item_type = item_type if obj.item_type == merc.ITEM_WEAPON: area, obj.value[0] = game_utils.read_word(area, False) area, obj.value[1] = game_utils.read_int(area) area, obj.value[2] = game_utils.read_int(area) area, obj.value[3] = game_utils.read_word(area, False) obj.value[3] = state_checks.name_lookup(const.attack_table, obj.value[3]) area, obj.value[4] = game_utils.read_flags(area) elif obj.item_type == merc.ITEM_CONTAINER: area, obj.value[0] = game_utils.read_int(area) area, obj.value[1] = game_utils.read_flags(area) area, obj.value[2] = game_utils.read_int(area) area, obj.value[3] = game_utils.read_int(area) area, obj.value[4] = game_utils.read_int(area) elif obj.item_type == merc.ITEM_DRINK_CON or obj.item_type == merc.ITEM_FOUNTAIN: area, obj.value[0] = game_utils.read_int(area) area, obj.value[1] = game_utils.read_int(area) area, obj.value[2] = game_utils.read_word(area, False) area, obj.value[3] = game_utils.read_int(area) area, obj.value[4] = game_utils.read_int(area) elif obj.item_type == merc.ITEM_WAND or obj.item_type == merc.ITEM_STAFF: area, obj.value[0] = game_utils.read_int(area) area, obj.value[1] = game_utils.read_int(area) area, obj.value[2] = game_utils.read_int(area) area, obj.value[3] = game_utils.read_word(area, False) area, obj.value[4] = game_utils.read_int(area) elif obj.item_type == merc.ITEM_POTION or obj.item_type == merc.ITEM_SCROLL or obj.item_type == merc.ITEM_PILL: area, obj.value[0] = game_utils.read_int(area) area, obj.value[1] = game_utils.read_word(area, False) area, obj.value[2] = game_utils.read_word(area, False) area, obj.value[3] = game_utils.read_word(area, False) area, obj.value[4] = game_utils.read_word(area, False) else: area, obj.value[0] = game_utils.read_flags(area) area, obj.value[1] = game_utils.read_flags(area) area, obj.value[2] = game_utils.read_flags(area) area, obj.value[3] = game_utils.read_flags(area) area, obj.value[4] = game_utils.read_flags(area) area, obj.level = game_utils.read_int(area) area, obj.weight = game_utils.read_int(area) area, obj.cost = game_utils.read_int(area) area, obj.condition = game_utils.read_word(area, False) if obj.condition == 'P': obj.condition = 100 elif obj.condition == 'G': obj.condition = 90 elif obj.condition == 'A': obj.condition = 75 elif obj.condition == 'W': obj.condition = 50 elif obj.condition == 'D': obj.condition = 25 elif obj.condition == 'B': obj.condition = 10 elif obj.condition == 'R': obj.condition = 0 else: obj.condition = 100 area, w = game_utils.read_word(area, False) while w == 'F' or w == 'A' or w == 'E': if w == 'F': area, word = game_utils.read_word(area, False) area, number = game_utils.read_int(area) area, number = game_utils.read_int(area) area, flags = game_utils.read_flags(area) elif w == 'A': area, number = game_utils.read_int(area) area, number = game_utils.read_int(area) elif w == 'E': ed = world_classes.ExtraDescrData() area, ed.keyword = game_utils.read_string(area) area, ed.description = game_utils.read_string(area) obj.extra_descr.append(ed) area, w = game_utils.read_word(area, False) pArea.object_dict[obj.vnum] = obj w = w[1:] # strip the pound return area
def load_objects(area, parea): area, w = game_utils.read_word(area, False) w = w[1:] # strip the pound while w != "0": vnum = int(w) if vnum in instance.item_templates: comm.notify("load_objects: vnum {} duplicated.".format(vnum), merc.CONSOLE_CRITICAL) sys.exit(1) flag_data = collections.namedtuple( "item_flags", ("slots", "restrictions", "attributes", "weapon")) flag_data.slots = set({}) flag_data.restrictions = set({}) flag_data.weapon = set({}) flag_data.attributes = set({}) item = handler_item.Items(None) item.vnum = vnum instance.item_templates[item.vnum] = item item.area = parea.name area, item.name = game_utils.read_string(area) area, item.short_descr = game_utils.read_string(area) item.short_descr = miniboa.terminal.escape(item.short_descr, "ANSI") area, item.description = game_utils.read_string(area) item.description = miniboa.terminal.escape(item.description, "ANSI") area, dummy = game_utils.read_string(area) area, item_type = game_utils.read_int(area) item_list = [(1, merc.ITEM_LIGHT), (2, merc.ITEM_SCROLL), (3, merc.ITEM_WAND), (4, merc.ITEM_STAFF), (5, merc.ITEM_WEAPON), (8, merc.ITEM_TREASURE), (9, merc.ITEM_ARMOR), (10, merc.ITEM_POTION), (12, merc.ITEM_FURNITURE), (15, merc.ITEM_CONTAINER), (17, merc.ITEM_DRINK_CON), (18, merc.ITEM_KEY), (19, merc.ITEM_FOOD), (20, merc.ITEM_MONEY), (22, merc.ITEM_BOAT), (23, merc.ITEM_CORPSE_NPC), (24, merc.ITEM_CORPSE_PC), (25, merc.ITEM_FOUNTAIN), (26, merc.ITEM_PILL), (27, merc.ITEM_PORTAL), (28, merc.ITEM_EGG), (29, merc.ITEM_VOODOO), (30, merc.ITEM_STAKE), (31, merc.ITEM_MISSILE), (32, merc.ITEM_AMMO), (33, merc.ITEM_QUEST), (34, merc.ITEM_QUESTCARD), (35, merc.ITEM_QUESTMACHINE), (36, merc.ITEM_SYMBOL), (37, merc.ITEM_BOOK), (38, merc.ITEM_PAGE), (39, merc.ITEM_TOOL)] for (aa, bb) in item_list: if item_type == aa: item.item_type = bb break else: item.item_type = merc.ITEM_TRASH area, extra_bits = game_utils.read_int(area) game_utils.item_flags_from_bits(extra_bits, flag_data, "extra flags") area, wear_bits = game_utils.read_int(area) game_utils.item_flags_from_bits(wear_bits, flag_data, "wear flags") if item.item_type == merc.ITEM_LIGHT: flag_data.slots.update({"right_hand", "left_hand"}) item.equips_to = flag_data.slots item.item_restrictions = flag_data.restrictions item.item_attributes = flag_data.attributes area, item.value[0] = game_utils.read_flags(area) area, item.value[1] = game_utils.read_flags(area) area, item.value[2] = game_utils.read_flags(area) area, item.value[3] = game_utils.read_flags(area) area, item.weight = game_utils.read_int(area) area, item.cost = game_utils.read_int(area) area, dummy = game_utils.read_int(area) area, w = game_utils.read_word(area, False) while w in ["A", "E", "Q"]: if w == "A": paf = handler_game.AffectData() paf.type = -1 paf.duration = -1 area, paf.location = game_utils.read_int(area) area, paf.modifier = game_utils.read_int(area) item.affected.append(paf) elif w == "E": edd = world_classes.ExtraDescrData() area, edd.keyword = game_utils.read_string(area) area, edd.description = game_utils.read_string(area) item.extra_descr.append(edd) elif w == "Q": area, item.chpoweron = game_utils.read_string(area) area, item.chpoweroff = game_utils.read_string(area) area, item.chpoweruse = game_utils.read_string(area) area, item.victpoweron = game_utils.read_string(area) area, item.victpoweroff = game_utils.read_string(area) area, item.victpoweruse = game_utils.read_string(area) area, sitem_bits = game_utils.read_flags(area) game_utils.item_flags_from_bits(sitem_bits, flag_data, "sitem flags") area, item.specpower = game_utils.read_int(area) area, w = game_utils.read_word(area, False) w = w[1:] # strip the pound return area
def load_rooms(area, pArea): area, w = game_utils.read_word(area, False) w = w[1:] # strip the pound while w != '0': room = handler_room.Room(None) room.vnum = int(w) if room.vnum in instance.room_templates: logger.critical('Dupicate room Vnum: %d', room.vnum) sys.exit(1) instance.room_templates[room.vnum] = room room.area = pArea.name area, room.name = game_utils.read_string(area) area, room.description = game_utils.read_string(area) room.description = miniboa.terminal.escape(room.description, 'pyom') area, number = game_utils.read_int(area) # area number area, room.room_flags = game_utils.read_flags(area) area, room.sector_type = game_utils.read_int(area) while True: area, letter = game_utils.read_letter(area) if letter == 'S': break elif letter == 'H': # Healing Room area, room.heal_rate = game_utils.read_int(area) elif letter == 'M': # Mana Room area, room.mana_rate = game_utils.read_int(area) elif letter == 'C': # Clan area, room.clan = game_utils.read_string(area) elif letter == 'D': # exit nexit = world_classes.Exit(None) area, door = game_utils.read_int(area) area, nexit.description = game_utils.read_string(area) area, nexit.keyword = game_utils.read_string(area) #Replaced Locks code area = nexit.exit_info.read_bits(area) area, nexit.key = game_utils.read_int(area) area, nexit.to_room_vnum = game_utils.read_int(area) nexit.name = "Exit %s %d to %d" % \ (nexit.keyword, room.vnum, nexit.to_room_vnum) room.exit[door] = nexit elif letter == 'E': ed = world_classes.ExtraDescrData() area, ed.keyword = game_utils.read_string(area) area, ed.description = game_utils.read_string(area) room.extra_descr.append(ed) elif letter == 'O': area, room.owner = game_utils.read_string(area) else: logger.critical("RoomIndexData(%d) has flag other than SHMCDEO: %s", (room.vnum, letter)) sys.exit(1) area, w = game_utils.read_word(area, False) w = w[1:] # strip the pound # Create our instances room_instance = object_creator.create_room(room) room_instance.environment = pArea.instance_id return area
def load_objects(area, pArea): area, w = game_utils.read_word(area, False) w = w[1:] # strip the pound while w != '0': flag_data = collections.namedtuple('item_flags', ('slots', 'restrictions', 'attributes', 'weapon')) flag_data.slots = set({}) flag_data.restrictions = set({}) flag_data.weapon = set({}) flag_data.attributes = set({}) item = handler_item.Items(None) item.vnum = int(w) instance.item_templates[item.vnum] = item item.area = pArea.name area, item.name = game_utils.read_string(area) area, item.short_descr = game_utils.read_string(area) area, item.description = game_utils.read_string(area) item.description = miniboa.terminal.escape(item.description, 'pyom') area, item.material = game_utils.read_string(area) area, item.item_type = game_utils.read_word(area, False) area, extra_bits = game_utils.read_flags(area) game_utils.item_flags_from_bits(extra_bits, flag_data, 'extra flags') area, wear_bits = game_utils.read_flags(area) game_utils.item_flags_from_bits(wear_bits, flag_data, 'wear flags') if merc.ITEM_LIGHT == item.item_type: flag_data.slots.update({'light'}) item.equips_to = flag_data.slots item.item_restrictions = flag_data.restrictions item.item_attributes = flag_data.attributes if item.item_type == merc.ITEM_WEAPON: area, item.value[0] = game_utils.read_word(area, False) area, item.value[1] = game_utils.read_int(area) area, item.value[2] = game_utils.read_int(area) area, item.value[3] = game_utils.read_word(area, False) item.value[3] = state_checks.name_lookup(const.attack_table, item.value[3]) area, item.value[4] = game_utils.read_flags(area) game_utils.item_flags_from_bits(item.value[4], flag_data, 'weapon flags') item.weapon_attributes = flag_data.weapon elif item.item_type == merc.ITEM_CONTAINER: area, item.value[0] = game_utils.read_int(area) area, item.value[1] = game_utils.read_flags(area) area, item.value[2] = game_utils.read_int(area) area, item.value[3] = game_utils.read_int(area) area, item.value[4] = game_utils.read_int(area) elif item.item_type == merc.ITEM_DRINK_CON or item.item_type == merc.ITEM_FOUNTAIN: area, item.value[0] = game_utils.read_int(area) area, item.value[1] = game_utils.read_int(area) area, item.value[2] = game_utils.read_word(area, False) area, item.value[3] = game_utils.read_int(area) area, item.value[4] = game_utils.read_int(area) elif item.item_type == merc.ITEM_WAND or item.item_type == merc.ITEM_STAFF: area, item.value[0] = game_utils.read_int(area) area, item.value[1] = game_utils.read_int(area) area, item.value[2] = game_utils.read_int(area) area, item.value[3] = game_utils.read_word(area, False) area, item.value[4] = game_utils.read_int(area) elif item.item_type == merc.ITEM_POTION or item.item_type == merc.ITEM_SCROLL \ or item.item_type == merc.ITEM_PILL: area, item.value[0] = game_utils.read_int(area) area, item.value[1] = game_utils.read_word(area, False) area, item.value[2] = game_utils.read_word(area, False) area, item.value[3] = game_utils.read_word(area, False) area, item.value[4] = game_utils.read_word(area, False) else: area, item.value[0] = game_utils.read_flags(area) area, item.value[1] = game_utils.read_flags(area) area, item.value[2] = game_utils.read_flags(area) area, item.value[3] = game_utils.read_flags(area) area, item.value[4] = game_utils.read_flags(area) area, item.level = game_utils.read_int(area) area, item.weight = game_utils.read_int(area) area, item.cost = game_utils.read_int(area) area, item.condition = game_utils.read_word(area, False) if item.condition == 'P': item.condition = 100 elif item.condition == 'G': item.condition = 90 elif item.condition == 'A': item.condition = 75 elif item.condition == 'W': item.condition = 50 elif item.condition == 'D': item.condition = 25 elif item.condition == 'B': item.condition = 10 elif item.condition == 'R': item.condition = 0 else: item.condition = 100 area, w = game_utils.read_word(area, False) while w == 'F' or w == 'A' or w == 'E': if w == 'F': area, word = game_utils.read_word(area, False) area, number = game_utils.read_int(area) area, number = game_utils.read_int(area) area, flags = game_utils.read_flags(area) elif w == 'A': paf = handler_game.AFFECT_DATA() paf.where = merc.TO_OBJECT paf.type = -1 paf.level = 20 paf.duration = -1 area, paf.location = game_utils.read_int(area) area, paf.modifier = game_utils.read_int(area) paf.bitvector = 0 item.affected += [paf] elif w == 'E': ed = world_classes.ExtraDescrData() area, ed.keyword = game_utils.read_string(area) area, ed.description = game_utils.read_string(area) item.extra_descr.append(ed) area, w = game_utils.read_word(area, False) w = w[1:] # strip the pound return area