コード例 #1
0
def get_dialog_name(start_state, end_state, text):
  global dialog_names
  name = "dlga_%s:%s" % (pc.convert_to_identifier(start_state), pc.convert_to_identifier(end_state))
  text_list = dialog_names.setdefault(name, [])
  for i, existing_text in enumerate(text_list):
    if text == existing_text:
      name = "%s.%d" % (name, i + 1)
      break
  else:
    text_list.append(text)
  return name
コード例 #2
0
def get_dialog_name(start_state, end_state, text):
  global dialog_names
  name = "dlga_%s:%s" % (pc.convert_to_identifier(start_state), pc.convert_to_identifier(end_state))
  text_list = dialog_names.setdefault(name, [])
  for i, existing_text in enumerate(text_list):
    if text == existing_text:
      name = "%s.%d" % (name, i + 1)
      break
  else:
    text_list.append(text)
  return name
コード例 #3
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))
コード例 #4
0
def set_item_heraldic():
  item_heraldic = []
  for i_item in xrange(len(items)):
    type = items[i_item][3] & 0x000000ff
    if (type==itp_type_shield)|(type==itp_type_body_armor)|(type==itp_type_horse):
      if (len(items[i_item]))>8:
        if (len(items[i_item][8]))>0:
          item_heraldic.append((item_set_slot, i_item, slot_item_heraldic, 1))               
    if items[i_item][0].startswith("wse_"):
      native_id = items[i_item][0].replace("wse_","",1)
      j_item = find_object(items,convert_to_identifier(native_id))
      if (j_item > -1):
        item_heraldic.append((item_set_slot, i_item, slot_item_native_version,  j_item))        
        item_heraldic.append((item_set_slot, j_item, slot_item_wse_version, i_item))        
  return item_heraldic[:]
コード例 #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))
コード例 #6
0
ファイル: process_operations.py プロジェクト: hakjimmy/cngame
 def add_str(self, sentence):
   full_id = pc.convert_to_identifier(sentence)
   sentence = pc.replace_spaces(sentence)
   id_len = min(len(full_id), 20)
   id_str = full_id[:id_len]
   duplicate_number = 1
   result = None
   while result is None:
     num_str = self.quick_strings.setdefault(id_str, [self.number, sentence])
     if num_str[0] == self.number:
       result = self.number
       self.number += 1
     elif num_str[1] == sentence:
       result = num_str[0]
     elif id_len < len(full_id):
       id_len += 1
       id_str = full_id[:id_len]
     else:
       id_str = "%s%d" % (full_id, duplicate_number)
       duplicate_number += 1
   return opmask_quick_string|result
コード例 #7
0
 def add_str(self, sentence):
     full_id = pc.convert_to_identifier(sentence)
     sentence = pc.replace_spaces(sentence)
     id_len = min(len(full_id), 20)
     id_str = full_id[:id_len]
     duplicate_number = 1
     result = None
     while result is None:
         num_str = self.quick_strings.setdefault(id_str,
                                                 [self.number, sentence])
         if num_str[0] == self.number:
             result = self.number
             self.number += 1
         elif num_str[1] == sentence:
             result = num_str[0]
         elif id_len < len(full_id):
             id_len += 1
             id_str = full_id[:id_len]
         else:
             id_str = "%s%d" % (full_id, duplicate_number)
             duplicate_number += 1
     return opmask_quick_string | result