コード例 #1
0
ファイル: data_loader.py プロジェクト: totalgit/PyRom
def load_resets(area, pArea):
    count = 0
    while True:
        count += 1
        area, letter = game_utils.read_letter(area)
        if letter == 'S':
            break

        if letter == '*':
            area, t = game_utils.read_to_eol(area)
            continue

        reset = world_classes.Reset(None)
        reset.command = letter
        reset.area = pArea.name
        reset.name = pArea.name + " Reset " + str(count)
        area, number = game_utils.read_int(area)  # if_flag
        area, reset.arg1 = game_utils.read_int(area)
        area, reset.arg2 = game_utils.read_int(area)
        area, reset.arg3 = (
            area,
            0) if letter == 'G' or letter == 'R' else game_utils.read_int(area)
        area, reset.arg4 = game_utils.read_int(
            area) if letter == 'P' or letter == 'M' else (area, 0)
        area, t = game_utils.read_to_eol(area)
        pArea.reset_list.append(reset)
    return area
コード例 #2
0
def load_npcs(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.npc_templates:
            comm.notify("load_npcs: vnum {} duplicated.".format(vnum),
                        merc.CONSOLE_CRITICAL)
            sys.exit(1)

        npc = handler_npc.Npc()
        npc.vnum = vnum
        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, "ANSI")
        area, npc.description = game_utils.read_string(area)
        npc.description = miniboa.terminal.escape(npc.description, "ANSI")

        area, act = game_utils.read_int(area)
        npc.act.bits = act | merc.ACT_IS_NPC
        area, affected_by = game_utils.read_int(area)
        npc.affected_by.bits = affected_by
        area, npc.alignment = game_utils.read_int(area)

        area, letter = game_utils.read_letter(area)
        area, level = game_utils.read_int(area)
        npc.level = game_utils.number_fuzzy(level)
        area, npc.hitroll = game_utils.read_int(area)
        area, npc.armor = game_utils.read_word(area)
        area, dummy = game_utils.read_int(area)
        area = game_utils.read_forward(area)
        area, dummy = game_utils.read_int(area)
        area = game_utils.read_forward(area)
        area, dummy = game_utils.read_int(area)
        area, dummy = game_utils.read_int(area)
        area = game_utils.read_forward(area)
        area, dummy = game_utils.read_int(area)
        area = game_utils.read_forward(area)
        area, dummy = game_utils.read_int(area)
        area, npc.gold = game_utils.read_int(area)
        area, dummy = game_utils.read_int(area)
        area, dummy = game_utils.read_int(area)
        area, dummy = game_utils.read_int(area)
        area, npc.sex = game_utils.read_int(area)

        area, w = game_utils.read_word(area, False)
        w = w[1:]  # strip the pound
    return area
コード例 #3
0
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
コード例 #4
0
def load_specials(area):
    while True:
        area, letter = game_utils.read_letter(area)

        if letter == '*':
            area, t = game_utils.read_to_eol(area)
            continue
        elif letter == 'S':
            return area
        elif letter == 'M':
            area, vnum = game_utils.read_int(area)
            area, instance.npc_templates[vnum].spec_fun = game_utils.read_word(area, False)
        else:
            logger.error("Load_specials: letter noth *SM: %s", letter)

    return area
コード例 #5
0
ファイル: data_loader.py プロジェクト: carriercomm/PyRom
def load_specials(area):
    while True:
        area, letter = game_utils.read_letter(area)

        if letter == '*':
            area, t = game_utils.read_to_eol(area)
            continue
        elif letter == 'S':
            return area
        elif letter == 'M':
            area, vnum = game_utils.read_int(area)
            area, instance.npc_templates[vnum].spec_fun = game_utils.read_word(area, False)
        else:
            logger.error("Load_specials: letter noth *SM: %s", letter)

    return area
コード例 #6
0
def load_specials(area):
    while True:
        area, letter = game_utils.read_letter(area)
        if letter == "*":
            area, t = game_utils.read_to_eol(area)
            continue
        elif letter == "S":
            return area
        elif letter == "M":
            area, vnum = game_utils.read_int(area)
            area, instance.npc_templates[vnum].spec_fun = game_utils.read_word(
                area, False)
        else:
            comm.notify("load_specials: letter not *MS ({})".format(letter),
                        merc.CONSOLE_CRITICAL)
            sys.exit(1)
    return area
コード例 #7
0
def load_resets(area, pArea):
    while True:
        area, letter = game_utils.read_letter(area)
        if letter == 'S':
            break

        if letter == '*':
            area, t = game_utils.read_to_eol(area)
            continue

        reset = world_classes.Reset()
        reset.command = letter
        area, number = game_utils.read_int(area)  # if_flag
        area, reset.arg1 = game_utils.read_int(area)
        area, reset.arg2 = game_utils.read_int(area)
        area, reset.arg3 = (area, 0) if letter == 'G' or letter == 'R' else game_utils.read_int(area)
        area, reset.arg4 = game_utils.read_int(area) if letter == 'P' or letter == 'M' else (area, 0)
        area, t = game_utils.read_to_eol(area)
        pArea.reset_list.append(reset)
        merc.reset_list.append(reset)
        pArea.reset_dict[reset] = reset
    return area
コード例 #8
0
def load_resets(area, parea):
    count = 0
    while True:
        count += 1
        area, letter = game_utils.read_letter(area)
        if letter == "S":
            break

        if letter == "*":
            area, t = game_utils.read_to_eol(area)
            continue

        reset = world_classes.Reset(None)
        reset.command = letter
        reset.area = parea.name
        area, number = game_utils.read_int(area)  # if_flag
        area, reset.arg1 = game_utils.read_int(area)
        area, reset.arg2 = game_utils.read_int(area)
        area, reset.arg3 = (area,
                            0) if letter in ["G", "R"
                                             ] else game_utils.read_int(area)
        area, t = game_utils.read_to_eol(area)
        parea.reset_list.append(reset)
    return area
コード例 #9
0
ファイル: data_loader.py プロジェクト: carriercomm/PyRom
def load_resets(area, pArea):
    count = 0
    while True:
        count += 1
        area, letter = game_utils.read_letter(area)
        if letter == 'S':
            break

        if letter == '*':
            area, t = game_utils.read_to_eol(area)
            continue

        reset = world_classes.Reset(None)
        reset.command = letter
        reset.area = pArea.name
        reset.name = pArea.name + " Reset " + str(count)
        area, number = game_utils.read_int(area)  # if_flag
        area, reset.arg1 = game_utils.read_int(area)
        area, reset.arg2 = game_utils.read_int(area)
        area, reset.arg3 = (area, 0) if letter == 'G' or letter == 'R' else game_utils.read_int(area)
        area, reset.arg4 = game_utils.read_int(area) if letter == 'P' or letter == 'M' else (area, 0)
        area, t = game_utils.read_to_eol(area)
        pArea.reset_list.append(reset)
    return area
コード例 #10
0
ファイル: data_loader.py プロジェクト: totalgit/PyRom
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
コード例 #11
0
ファイル: data_loader.py プロジェクト: carriercomm/PyRom
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