def process_entry(processor, txt_file, entry, index):
    spawn_records = entry[4]
    output_list = [
        "mst_%s %s %d  %d\r\n%s \r\n\r\n%d " %
        (entry[0], entry[0], entry[1], entry[2], pc.replace_spaces(
            entry[3]), po.block_len(spawn_records))
    ]
    for spawn_record in spawn_records:
        item_override_len = po.block_len(spawn_record[5])
        if item_override_len > 8:
            pc.ERROR("the maximum number of spawn item overrides is 8")
        output_list.append("%d %d %d %d %d %d  " % (spawn_record[0:5] +
                                                    (item_override_len, )))
        output_list.extend("%d " % processor.process_id(item, "itm")
                           for item in spawn_record[5])
        output_list.append("\r\n")
    output_list.append("%d\r\n" % po.block_len(entry[5]))
    txt_file.write("".join(output_list))
    for i, trigger in enumerate(entry[5]):
        txt_file.write("%f %f %f " % trigger[0:3])
        if trigger[0] < 0.0:
            name = "%s: %s" % (entry[0], get_trigger_name(trigger[0]))
        else:
            name = "%s: trigger #%d" % (entry[0], i)
        txt_file.write("".join(
            processor.process_block(trigger[3], name + " conditions")))
        txt_file.write("".join(
            processor.process_block(trigger[4], name + " consequences")))
        txt_file.write("\r\n")
    txt_file.write("\r\n\r\n")
def process_entry(processor, txt_file, item, index):
    visible_name = pc.replace_spaces(item[1])
    item_meshes = item[2]
    output_list = [
        " itm_%s %s %s %d " %
        (item[0], visible_name, visible_name, po.block_len(item_meshes))
    ]
    output_list.extend([" %s %d " % mesh_imod for mesh_imod in item_meshes])
    stats = item[6]
    output_list.append(
        " %d %d %d %d %f %d %d %d %d %d %d %d %d %d %d %d %d\r\n" %
        (item[3], item[4], item[5], item[7], get_weight(stats),
         get_abundance(stats), get_head_armor(stats), get_body_armor(stats),
         get_leg_armor(stats), get_difficulty(stats), get_hit_points(stats),
         get_speed_rating(stats), get_missile_speed(stats),
         get_weapon_length(stats), get_max_ammo(stats),
         get_thrust_damage(stats), get_swing_damage(stats)))
    item_len = len(item)
    if item_len > 9:
        output_list.append(" %d\r\n" % po.block_len(item[9]))
        output_list.extend([
            " %d" % processor.process_id(item_faction, "fac")
            for item_faction in item[9]
        ])
        output_list.append("\r\n")
    else:
        output_list.append(" 0\r\n")
    txt_file.write("".join(output_list))
    triggers = item[8] if item_len > 8 else []
    triggers = processor.process_triggers(triggers, item[0])
    triggers.append("\r\n")
    txt_file.write("".join(triggers))
def process_entry(processor, txt_file, entry, index):
    icon_flags = 0 if not entry[2] else ((entry[2][1] if po.block_len(entry[2]) > 1 else 0) | processor.process_id(entry[2][0], "icon"))
    txt_file.write("pt_%s %s %d %d %d %d " % (entry[0], pc.replace_spaces(entry[1]), icon_flags, entry[3],
        processor.process_id(entry[4], "fac"), entry[5]))
    member_count = po.block_len(entry[6])
    if member_count > 6:
      raise pc.ERROR("party templates can only have a maximum of 6 members")
    members_list = ["%d %d %d %d " % (processor.process_id(troop[0], "trp"), troop[1], troop[2], troop[3] if len(troop) > 3 else 0) for troop in entry[6]]
    members_list.extend("-1 " for i in xrange(6 - member_count))
    members_list.append("\r\n")
    txt_file.write("".join(members_list))
def process_entry(processor, txt_file, entry, index):
    passages = entry[8]
    txt_file.write("scn_%s %s %d %s %s %f %f %f %f %f %s \r\n  %d " %
                   (entry[0], pc.replace_spaces(entry[0]), entry[1], entry[2],
                    entry[3], entry[4][0], entry[4][1], entry[5][0],
                    entry[5][1], entry[6], entry[7], po.block_len(passages)))
    output_list = [
        " %d " % (100000 if p == "exit" else
                  0 if p == "" else processor.identifier_map.get_id("scn", p))
        for p in passages
    ]
    chest_troops = entry[9]
    output_list.append("\r\n  %d " % po.block_len(chest_troops))
    output_list.extend(" %d " % processor.identifier_map.get_id("trp", troop)
                       for troop in chest_troops)
    output_list.append("\r\n %s \r\n" %
                       entry[10] if len(entry) > 10 else "\r\n 0 \r\n")
    txt_file.write("".join(output_list))
Esempio n. 5
0
def process_entry(processor, txt_file, entry, index):
    face_keys = entry[6]
    output_list = [
        "%s %d\r\n %s %s %s\r\n %s %d " %
        (entry[0], entry[1], entry[2], entry[3], entry[4], entry[5],
         len(face_keys))
    ]
    output_list.extend("skinkey_%s %d %d %f %f %s " %
                       (pc.convert_to_identifier(key[4]).lower(), key[0],
                        key[1], key[2], key[3], pc.replace_spaces(key[4]))
                       for key in face_keys)
    hair_meshes = entry[7]
    output_list.append("\r\n%d\r\n" % po.block_len(hair_meshes))
    output_list.extend(" %s " % e for e in hair_meshes)
    beard_meshes = entry[8]
    output_list.append("\r\n %d\r\n" % po.block_len(beard_meshes))
    output_list.extend("  %s\r\n" % e for e in beard_meshes)
    hair_textures = entry[9]
    output_list.append("\r\n %d " % po.block_len(hair_textures))
    output_list.extend(" %s " % e for e in hair_textures)
    beard_textures = entry[10]
    output_list.append("\r\n %d " % po.block_len(beard_textures))
    output_list.extend(" %s " % e for e in beard_textures)
    face_textures = entry[11]
    output_list.append("\r\n %d " % po.block_len(face_textures))
    for face in face_textures:
        hair_textures = face[2]
        hair_colors = face[3] if len(face) > 3 else []
        output_list.append(" %s %d %d %d " %
                           (face[0], face[1], po.block_len(hair_textures),
                            po.block_len(hair_colors)))
        output_list.extend(" %s " % e for e in hair_textures)
        output_list.extend(" %d " % e for e in hair_colors)
    voices = entry[12]
    output_list.append("\r\n %d " % po.block_len(voices))
    output_list.extend(" %d %s " % e for e in voices)
    output_list.append("\r\n %s %f \r\n" % (entry[13], entry[14]))
    entry_len = len(entry)
    blood_1 = processor.process_id(entry[15], "psys") if entry_len > 15 else 0
    blood_2 = processor.process_id(entry[16], "psys") if entry_len > 16 else 0
    constraints = entry[17] if entry_len > 17 else []
    output_list.append("%d %d\r\n%d\r\n" %
                       (blood_1, blood_2, po.block_len(constraints)))
    for constraint in constraints:
        output_list.append("\r\n%f %d %d " %
                           (constraint[0], constraint[1], len(constraint) - 2))
        output_list.extend(" %f %d" % e for e in constraint[2:])
    output_list.append("\r\n")
    txt_file.write("".join(output_list))
Esempio n. 6
0
def process_entry(processor, txt_file, entry, index):
  flags = entry[1] & dword_mask
  txt_file.write("%s %d %d\r\n" % (entry[0], flags, po.block_len(entry[2])))
  for mesh in entry[2]:
    txt_file.write(" %s  %s\r\n" % (mesh[0], mesh[1] if len(mesh) > 1 else 0))
    # If this fails make sure that you have entered the alternative tree definition. Not functional in Warband.
    if flags & (fkf_tree|fkf_speedtree):
      txt_file.write(" %s %s\r\n" % (mesh[2][0], mesh[2][1]))
  if flags & fkf_has_colony_props:
    txt_file.write(" %s %s\r\n" % (entry[3], entry[4]))
Esempio n. 7
0
def process_entry(processor, txt_file, entry, index):
  flags = entry[1] & dword_mask
  txt_file.write("%s %d %d\r\n" % (entry[0], flags, po.block_len(entry[2])))
  for mesh in entry[2]:
    txt_file.write(" %s  %s\r\n" % (mesh[0], mesh[1] if len(mesh) > 1 else 0))
    # If this fails make sure that you have entered the alternative tree definition. Not functional in Warband.
    if flags & (fkf_tree|fkf_speedtree):
      txt_file.write(" %s %s\r\n" % (mesh[2][0], mesh[2][1]))
  if flags & fkf_has_colony_props:
    txt_file.write(" %s %s\r\n" % (entry[3], entry[4]))
def process_entry(processor, txt_file, entry, index):
  passages = entry[8]
  txt_file.write("scn_%s %s %d %s %s %f %f %f %f %f %s \r\n  %d " % (entry[0], pc.replace_spaces(entry[0]), entry[1],
      entry[2], entry[3], entry[4][0], entry[4][1], entry[5][0], entry[5][1], entry[6], entry[7], po.block_len(passages)))
  output_list = [" %d " % (100000 if p == "exit" else 0 if p == "" else processor.identifier_map.get_id("scn", p)) for p in passages]
  chest_troops = entry[9]
  output_list.append("\r\n  %d " % po.block_len(chest_troops))
  output_list.extend(" %d " % processor.identifier_map.get_id("trp", troop) for troop in chest_troops)
  output_list.append("\r\n %s \r\n" % entry[10] if len(entry) > 10 else "\r\n 0 \r\n")
  txt_file.write("".join(output_list))
def process_entry(processor, txt_file, entry, index):
  icon_flags = (entry[2][1] if po.block_len(entry[2]) > 1 else 0) | processor.process_id(entry[2][0], "icon") if entry[2] else 0
  menu = processor.process_id(entry[3], "mnu")
  template = processor.process_id(entry[4], "pt")
  faction = processor.process_id(entry[5], "fac")
  pos = entry[9]
  txt_file.write(" 1 %d %d p_%s %s %d %d %d %d %d %d %d %d %d %f %f %f %f %f %f 0.0 %d " % (index, index, entry[0],
      pc.replace_spaces(entry[1]), icon_flags, menu, template, faction, entry[6], entry[6], entry[7], entry[8], entry[8],
      pos[0], pos[1], pos[0], pos[1], pos[0], pos[1], len(entry[10])))
  txt_file.write("".join("%d %d 0 %d " % (processor.process_id(member[0], "trp"), member[1], member[2]) for member in entry[10]))
  txt_file.write("\r\n%f\r\n" % ((3.1415926 / 180.0) * entry[11] if len(entry) > 11 else 0.0))
def process_entry(processor, txt_file, entry, index):
  output_list = ["menu_%s %d %s %s" % (entry[0], entry[1], pc.replace_spaces(entry[2]), entry[3])]
  output_list.extend(processor.process_block(entry[4], entry[0]))
  output_list.append("%d\r\n" % po.block_len(entry[5]))
  for menu in entry[5]:
    output_list.append(" mno_%s " % menu[0])
    name = "%s: %s" % (entry[0], menu[0])
    output_list.extend(processor.process_block(menu[1], name + " conditions"))
    output_list.append(" %s " % pc.replace_spaces(menu[2]))
    output_list.extend(processor.process_block(menu[3], name + " consequences"))
    output_list.append(" %s " % pc.replace_spaces(menu[4]) if len(menu) > 4 else " . ")
  output_list.append("\r\n")
  txt_file.write("".join(output_list))
Esempio n. 11
0
def process_entry(processor, txt_file, item, index):
  visible_name = pc.replace_spaces(item[1])
  item_meshes = item[2]
  output_list = [" itm_%s %s %s %d " % (item[0], visible_name, visible_name, po.block_len(item_meshes))]
  output_list.extend([" %s %d " % mesh_imod for mesh_imod in item_meshes])
  stats = item[6]
  output_list.append(" %d %d %d %d %f %d %d %d %d %d %d %d %d %d %d %d %d\r\n" % (item[3], item[4], item[5], item[7],
      get_weight(stats), get_abundance(stats), get_head_armor(stats), get_body_armor(stats), get_leg_armor(stats),
      get_difficulty(stats), get_hit_points(stats), get_speed_rating(stats), get_missile_speed(stats),
      get_weapon_length(stats), get_max_ammo(stats), get_thrust_damage(stats), get_swing_damage(stats)))
  item_len = len(item)
  if item_len > 9:
    output_list.append(" %d\r\n" % po.block_len(item[9]))
    output_list.extend([" %d" % processor.process_id(item_faction, "fac") for item_faction in item[9]])
    output_list.append("\r\n")
  else:
    output_list.append(" 0\r\n")
  txt_file.write("".join(output_list))
  triggers = item[8] if item_len > 8 else []
  triggers = processor.process_triggers(triggers, item[0])
  triggers.append("\r\n")
  txt_file.write("".join(triggers))
def process_entry(processor, txt_file, entry, index):
  spawn_records = entry[4]
  output_list = ["mst_%s %s %d  %d\r\n%s \r\n\r\n%d " % (entry[0], entry[0], entry[1], entry[2],
      pc.replace_spaces(entry[3]), po.block_len(spawn_records))]
  for spawn_record in spawn_records:
    item_override_len = po.block_len(spawn_record[5])
    if item_override_len > 8:
      pc.ERROR("the maximum number of spawn item overrides is 8")
    output_list.append("%d %d %d %d %d %d  "% (spawn_record[0:5] + (item_override_len,)))
    output_list.extend("%d " % processor.process_id(item, "itm") for item in spawn_record[5])
    output_list.append("\r\n")
  output_list.append("%d\r\n" % po.block_len(entry[5]))
  txt_file.write("".join(output_list))
  for i, trigger in enumerate(entry[5]):
    txt_file.write("%f %f %f " % trigger[0:3])
    if trigger[0] < 0.0:
      name = "%s: %s" % (entry[0], get_trigger_name(trigger[0]))
    else:
      name = "%s: trigger #%d" % (entry[0], i)
    txt_file.write("".join(processor.process_block(trigger[3], name + " conditions")))
    txt_file.write("".join(processor.process_block(trigger[4], name + " consequences")))
    txt_file.write("\r\n")
  txt_file.write("\r\n\r\n")
Esempio n. 13
0
def process_entry(processor, txt_file, entry, index):
    face_keys = entry[6]
    output_list = [
        "%s %d\r\n %s %s %s\r\n %s %d " % (entry[0], entry[1], entry[2], entry[3], entry[4], entry[5], len(face_keys))
    ]
    output_list.extend(
        "skinkey_%s %d %d %f %f %s "
        % (pc.convert_to_identifier(key[4]).lower(), key[0], key[1], key[2], key[3], pc.replace_spaces(key[4]))
        for key in face_keys
    )
    hair_meshes = entry[7]
    output_list.append("\r\n%d\r\n" % po.block_len(hair_meshes))
    output_list.extend(" %s " % e for e in hair_meshes)
    beard_meshes = entry[8]
    output_list.append("\r\n %d\r\n" % po.block_len(beard_meshes))
    output_list.extend("  %s\r\n" % e for e in beard_meshes)
    hair_textures = entry[9]
    output_list.append("\r\n %d " % po.block_len(hair_textures))
    output_list.extend(" %s " % e for e in hair_textures)
    beard_textures = entry[10]
    output_list.append("\r\n %d " % po.block_len(beard_textures))
    output_list.extend(" %s " % e for e in beard_textures)
    face_textures = entry[11]
    output_list.append("\r\n %d " % po.block_len(face_textures))
    for face in face_textures:
        hair_textures = face[2]
        hair_colors = face[3] if len(face) > 3 else []
        output_list.append(" %s %d %d %d " % (face[0], face[1], po.block_len(hair_textures), po.block_len(hair_colors)))
        output_list.extend(" %s " % e for e in hair_textures)
        output_list.extend(" %d " % e for e in hair_colors)
    voices = entry[12]
    output_list.append("\r\n %d " % po.block_len(voices))
    output_list.extend(" %d %s " % e for e in voices)
    output_list.append("\r\n %s %f \r\n" % (entry[13], entry[14]))
    entry_len = len(entry)
    blood_1 = processor.process_id(entry[15], "psys") if entry_len > 15 else 0
    blood_2 = processor.process_id(entry[16], "psys") if entry_len > 16 else 0
    constraints = entry[17] if entry_len > 17 else []
    output_list.append("%d %d\r\n%d\r\n" % (blood_1, blood_2, po.block_len(constraints)))
    for constraint in constraints:
        output_list.append("\r\n%f %d %d " % (constraint[0], constraint[1], len(constraint) - 2))
        output_list.extend(" %f %d" % e for e in constraint[2:])
    output_list.append("\r\n")
    txt_file.write("".join(output_list))
def process_entry(processor, txt_file, entry, index):
    output_list = [
        "menu_%s %d %s %s" %
        (entry[0], entry[1], pc.replace_spaces(entry[2]), entry[3])
    ]
    output_list.extend(processor.process_block(entry[4], entry[0]))
    output_list.append("%d\r\n" % po.block_len(entry[5]))
    for menu in entry[5]:
        output_list.append(" mno_%s " % menu[0])
        name = "%s: %s" % (entry[0], menu[0])
        output_list.extend(
            processor.process_block(menu[1], name + " conditions"))
        output_list.append(" %s " % pc.replace_spaces(menu[2]))
        output_list.extend(
            processor.process_block(menu[3], name + " consequences"))
        output_list.append(
            " %s " % pc.replace_spaces(menu[4]) if len(menu) > 4 else " . ")
    output_list.append("\r\n")
    txt_file.write("".join(output_list))
Esempio n. 15
0
def process_entry(processor, txt_file, entry, index):
    icon_flags = (entry[2][1]
                  if po.block_len(entry[2]) > 1 else 0) | processor.process_id(
                      entry[2][0], "icon") if entry[2] else 0
    menu = processor.process_id(entry[3], "mnu")
    template = processor.process_id(entry[4], "pt")
    faction = processor.process_id(entry[5], "fac")
    pos = entry[9]
    txt_file.write(
        " 1 %d %d p_%s %s %d %d %d %d %d %d %d %d %d %f %f %f %f %f %f 0.0 %d "
        %
        (index, index, entry[0], pc.replace_spaces(entry[1]), icon_flags, menu,
         template, faction, entry[6], entry[6], entry[7], entry[8], entry[8],
         pos[0], pos[1], pos[0], pos[1], pos[0], pos[1], len(entry[10])))
    txt_file.write(
        "".join("%d %d 0 %d " %
                (processor.process_id(member[0], "trp"), member[1], member[2])
                for member in entry[10]))
    txt_file.write(
        "\r\n%f\r\n" %
        ((3.1415926 / 180.0) * entry[11] if len(entry) > 11 else 0.0))
def process_entry(processor, txt_file, entry, index):
  txt_file.write(" %s %d %s %f %s" % entry[0:5])
  if entry[1] & gtf_has_color and po.block_len(entry[5]) >= 3:
    txt_file.write(" %f %f %f" % entry[5])
  txt_file.write("\r\n")
Esempio n. 17
0
def process_entry(processor, txt_file, entry, index):
    txt_file.write(" %s %d %s %f %s" % entry[0:5])
    if entry[1] & gtf_has_color and po.block_len(entry[5]) >= 3:
        txt_file.write(" %f %f %f" % entry[5])
    txt_file.write("\r\n")