SHARE
TWEET

Untitled

a guest Jul 18th, 2019 67 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import struct
  2.  
  3.  
  4. def decrypt(data):
  5.     retValue = ""
  6.     key = "!~#(&|@@"
  7.     x = 0
  8.  
  9.     for i in range(len(data)):
  10.         if x >= len(key):
  11.             xored = (ord(data[i])) ^ (ord(key[0]))
  12.         else:
  13.             xored = (ord(data[i])) ^ (ord(key[x]))
  14.         retValue += chr(xored)
  15.         x = x + 1
  16.     return retValue
  17.  
  18.  
  19. def read_string_sized(handle):
  20.     size = read_u_int_32(handle)
  21.     s = ''
  22.     for j in range(0, size):
  23.         lit = struct.unpack('c', handle.read(1))[0]
  24.         if ord(lit) != 0:
  25.             s += chr(lit[0])
  26.             if len(s) > 100:
  27.                 break
  28.     return s
  29.  
  30.  
  31. def read_u_int_32(handle):
  32.     return struct.unpack("I", handle.read(4))[0]
  33.  
  34.  
  35. def read_int_32(handle):
  36.     return struct.unpack("i", handle.read(4))[0]
  37.  
  38.  
  39. def read_float(handle):
  40.     return struct.unpack("f", handle.read(4))[0]
  41.  
  42.  
  43. def read_char(handle):
  44.     return chr(struct.unpack("c", handle.read(1))[0][0])
  45.  
  46.  
  47. def write_int32(handle, val):
  48.     handle.write(struct.pack("i", val))
  49.  
  50.  
  51. def write_length_string(handle, text):
  52.     write_int32(handle, len(text))
  53.     for i in range(len(text)):
  54.         handle.write(struct.pack("b", ord(text[i])))
  55.  
  56.  
  57. def add_entry(path, entries):
  58.     gbf_file = open(path, "rb")
  59.  
  60.     header = gbf_file.read(52)
  61.  
  62.     mesh_count = read_u_int_32(gbf_file)
  63.     meshes = []
  64.     meshes_vectors = []
  65.     for i in range(mesh_count):
  66.         meshes.append(decrypt(read_string_sized(gbf_file)))
  67.         meshes_vectors.append(gbf_file.read(24))
  68.  
  69.     materials = []
  70.     material_count = read_u_int_32(gbf_file)
  71.     for i in range(material_count):
  72.         materials.append(decrypt(read_string_sized(gbf_file)))
  73.  
  74.     rest_of_file = gbf_file.read()
  75.  
  76.     gbf_file_out = open(path, "wb")
  77.     gbf_file_out.write(header)
  78.  
  79.     for entry in entries:
  80.         if entry.startswith("material="):
  81.             material_count = material_count + 1
  82.             materials.append(entry)
  83.         else:
  84.             material_count = material_count + 1
  85.             materials.append("mesh=" + entry)
  86.  
  87.             mesh_count = mesh_count + 1
  88.             meshes.append(entry)
  89.             meshes_vectors.append(meshes_vectors[-1])
  90.  
  91.     write_int32(gbf_file_out, mesh_count)
  92.     for i in range(mesh_count):
  93.         write_length_string(gbf_file_out, decrypt(meshes[i].upper()))
  94.         gbf_file_out.write(meshes_vectors[i])
  95.  
  96.     write_int32(gbf_file_out, material_count)
  97.     for i in range(material_count):
  98.         write_length_string(gbf_file_out, decrypt(materials[i]))
  99.  
  100.     gbf_file_out.write(rest_of_file)
  101.     # animation_count = read_u_int_32(gbf_file)
  102.     # animations1 = []
  103.     # for i in range(animation_count):
  104.     #    print(decrypt(read_string_sized(gbf_file)))
  105.     #    for j in range(read_u_int_32(gbf_file)):
  106.     #        print(decrypt(read_string_sized(gbf_file)))
  107.     #        for k in range(read_u_int_32(gbf_file)):
  108.     #            print("float" + str(read_float(gbf_file)))
  109.  
  110.     # animation_count2 = read_u_int_32(gbf_file)
  111.     # for i in range(animation_count2):
  112.     #    print(decrypt(read_string_sized(gbf_file)))
  113.     #    print(read_char(gbf_file))
  114.  
  115.  
  116.  
  117. #bow
  118.  
  119. entries = ["w_bow_rgb_32_am.gmf", "material=am3067.grf", "material=amm3754.grf"]
  120. add_entry(r"F:\TrinityDev\RohanCN\model\Player\bin\am_s.gbf", entries)
  121.  
  122.  
  123. entries = ["w_bow_rgb_32_aw.gmf", "material=aw3101.grf", "material=aww3754.grf"]
  124. add_entry(r"F:\TrinityDev\RohanCN\model\Player\bin\aw_s.gbf", entries)
  125.  
  126. #staff
  127.  
  128.  
  129. entries = ["w_stf_rgb_32_wm.gmf", "material=am3061.grf", "material=amm3748.grf"]
  130. add_entry(r"F:\TrinityDev\RohanCN\model\Player\bin\wm_s.gbf", entries)
  131.  
  132.  
  133. entries = ["w_stf_rgb_32_ww.gmf", "material=aw3095.grf", "material=aww3748.grf"]
  134. add_entry(r"F:\TrinityDev\RohanCN\model\Player\bin\ww_s.gbf", entries)
  135.  
  136.  
  137.  
  138. entries = ["w_stf_rgb_32_em.gmf", "material=am3061.grf", "material=amm3748.grf"]
  139. add_entry(r"F:\TrinityDev\RohanCN\model\Player\bin\em_s.gbf", entries)
  140.  
  141.  
  142. entries = ["w_stf_rgb_32_ew.gmf", "material=aw3095.grf", "material=aww3748.grf"]
  143. add_entry(r"F:\TrinityDev\RohanCN\model\Player\bin\ew_s.gbf", entries)
  144.  
  145.  
  146. #crossbow
  147.  
  148. entries = ["w_cbw_rgb_32_am.gmf", "material=am3073.grf", "material=amm3760.grf"]
  149. add_entry(r"F:\TrinityDev\RohanCN\model\Player\bin\am_s.gbf", entries)
  150.  
  151.  
  152. entries = ["w_cbw_rgb_32_aw.gmf", "material=aw3107.grf", "material=aww3760.grf"]
  153. add_entry(r"F:\TrinityDev\RohanCN\model\Player\bin\aw_s.gbf", entries)
  154.  
  155. #mace1
  156.  
  157.  
  158. #mace2
  159.  
  160. entries = ["w_mce_rgb_32_em.gmf", "material=am3040.grf", "material=amm3727.grf"]
  161. add_entry(r"F:\TrinityDev\RohanCN\model\Player\bin\em_s.gbf", entries)
  162.  
  163.  
  164. entries = ["w_mce_rgb_32_ew.gmf", "material=aw3074.grf", "material=aww3727.grf"]
  165. add_entry(r"F:\TrinityDev\RohanCN\model\Player\bin\ew_s.gbf", entries)
  166.  
  167.  
  168. entries = ["w_mce_rgb_32_km.gmf", "material=am3040.grf", "material=amm3727.grf"]
  169. add_entry(r"F:\TrinityDev\RohanCN\model\Player\bin\km_s.gbf", entries)
  170.  
  171.  
  172. entries = ["w_mce_rgb_32_kw.gmf", "material=aw3074.grf", "material=aww3727.grf"]
  173. add_entry(r"F:\TrinityDev\RohanCN\model\Player\bin\kw_s.gbf", entries)
  174.  
  175.  
  176.  
  177. entries = ["w_mce_rgb_32_wm.gmf", "material=am3040.grf", "material=amm3727.grf"]
  178. add_entry(r"F:\TrinityDev\RohanCN\model\Player\bin\wm_s.gbf", entries)
  179.  
  180.  
  181. entries = ["w_mce_rgb_32_ww.gmf", "material=aw3074.grf", "material=aww3727.grf"]
  182. add_entry(r"F:\TrinityDev\RohanCN\model\Player\bin\ww_s.gbf", entries)
  183.  
  184.  
  185. entries = ["w_mce_rgb_32_zm.gmf", "material=am3040.grf", "material=amm3727.grf"]
  186. add_entry(r"F:\TrinityDev\RohanCN\model\Player\bin\zm_s.gbf", entries)
  187.  
  188.  
  189. entries = ["w_mce_rgb_32_zw.gmf", "material=aw3074.grf", "material=aww3727.grf"]
  190. add_entry(r"F:\TrinityDev\RohanCN\model\Player\bin\zw_s.gbf", entries)
  191.  
  192.  
  193. #dagger
  194.  
  195. entries = ["w_ddg_rgb_32_am.gmf", "material=am3029.grf", "material=amm3716.grf"]
  196. add_entry(r"F:\TrinityDev\RohanCN\model\Player\bin\am_s.gbf", entries)
  197.  
  198.  
  199. entries = ["w_ddg_rgb_32_aw.gmf", "material=aw3063.grf", "material=aww3716.grf"]
  200. add_entry(r"F:\TrinityDev\RohanCN\model\Player\bin\aw_s.gbf", entries)
  201.  
  202.  
  203. entries = ["w_ddg_rgb_32_dm.gmf", "material=am3029.grf", "material=amm3716.grf"]
  204. add_entry(r"F:\TrinityDev\RohanCN\model\Player\bin\dm_s.gbf", entries)
  205.  
  206.  
  207. entries = ["w_ddg_rgb_32_dw.gmf", "material=aw3063.grf", "material=aww3716.grf"]
  208. add_entry(r"F:\TrinityDev\RohanCN\model\Player\bin\dw_s.gbf", entries)
  209.  
  210.  
  211. entries = ["w_ddg_rgb_32_em.gmf", "material=am3029.grf", "material=amm3716.grf"]
  212. add_entry(r"F:\TrinityDev\RohanCN\model\Player\bin\em_s.gbf", entries)
  213.  
  214.  
  215. entries = ["w_ddg_rgb_32_ew.gmf", "material=aw3063.grf", "material=aww3716.grf"]
  216. add_entry(r"F:\TrinityDev\RohanCN\model\Player\bin\ew_s.gbf", entries)
  217.  
  218.  
  219.  
  220. entries = ["w_ddg_rgb_32_km.gmf", "material=am3029.grf", "material=amm3716.grf"]
  221. add_entry(r"F:\TrinityDev\RohanCN\model\Player\bin\km_s.gbf", entries)
  222.  
  223.  
  224. entries = ["w_ddg_rgb_32_kw.gmf", "material=aw3063.grf", "material=aww3716.grf"]
  225. add_entry(r"F:\TrinityDev\RohanCN\model\Player\bin\kw_s.gbf", entries)
  226.  
  227.  
  228. entries = ["w_ddg_rgb_32_km_01.gmf", "material=am3029.grf", "material=amm3716.grf"]
  229. add_entry(r"F:\TrinityDev\RohanCN\model\Player\bin\km_s.gbf", entries)
  230.  
  231.  
  232. entries = ["w_ddg_rgb_32_kw_01.gmf", "material=aw3063.grf", "material=aww3716.grf"]
  233. add_entry(r"F:\TrinityDev\RohanCN\model\Player\bin\kw_s.gbf", entries)
  234.  
  235.  
  236. entries = ["w_ddg_rgb_32_nm.gmf", "material=am3029.grf", "material=amm3716.grf"]
  237. add_entry(r"F:\TrinityDev\RohanCN\model\Player\bin\nm_s.gbf", entries)
  238.  
  239.  
  240. entries = ["w_ddg_rgb_32_nw.gmf", "material=aw3063.grf", "material=aww3716.grf"]
  241. add_entry(r"F:\TrinityDev\RohanCN\model\Player\bin\nw_s.gbf", entries)
  242.  
  243.  
  244. entries = ["w_ddg_rgb_32_wm.gmf", "material=am3029.grf", "material=amm3716.grf"]
  245. add_entry(r"F:\TrinityDev\RohanCN\model\Player\bin\wm_s.gbf", entries)
  246.  
  247.  
  248. entries = ["w_ddg_rgb_32_ww.gmf", "material=aw3063.grf", "material=aww3716.grf"]
  249. add_entry(r"F:\TrinityDev\RohanCN\model\Player\bin\ww_s.gbf", entries)
  250.  
  251.  
  252. entries = ["w_ddg_rgb_32_zm.gmf", "material=am3029.grf", "material=amm3716.grf"]
  253. add_entry(r"F:\TrinityDev\RohanCN\model\Player\bin\zm_s.gbf", entries)
  254.  
  255.  
  256. entries = ["w_ddg_rgb_32_zw.gmf", "material=aw3063.grf", "material=aww3716.grf"]
  257. add_entry(r"F:\TrinityDev\RohanCN\model\Player\bin\zw_s.gbf", entries)
  258.  
  259. #dualsword
  260.  
  261.  
  262. entries = ["w_dsw_rgb32_zm.gmf", "material=zmm1430.grf", "material=zmm1433.grf"]
  263. add_entry(r"F:\TrinityDev\RohanCN\model\Player\bin\zm_s.gbf", entries)
  264.  
  265.  
  266. entries = ["w_dsw_rgb32_zw.gmf", "material=zww1430.grf"]
  267. add_entry(r"F:\TrinityDev\RohanCN\model\Player\bin\zw_s.gbf", entries)
  268.  
  269. entries = ["w_pax_rgb32_zm.gmf", "material=zmm1427.grf", "material=zmm1443.grf"]
  270. add_entry(r"F:\TrinityDev\RohanCN\model\Player\bin\zm_s.gbf", entries)
  271.  
  272.  
  273. entries = ["w_pax_rgb32_zw.gmf", "material=zww1427.grf"]
  274. add_entry(r"F:\TrinityDev\RohanCN\model\Player\bin\zw_s.gbf", entries)
  275.  
  276. #katar
  277.  
  278. entries = ["w_ktr_rgb_32_nm.gmf", "material=nm3049.grf", "material=nmn3766.grf"]
  279. add_entry(r"F:\TrinityDev\RohanCN\model\Player\bin\nm_s.gbf", entries)
  280.  
  281. entries = ["w_ktr_rgb_32_nw.gmf", "material=nw3074.grf", "material=nww3766.grf"]
  282. add_entry(r"F:\TrinityDev\RohanCN\model\Player\bin\nw_s.gbf", entries)
  283.  
  284.  
  285.  
  286. #zhen
  287.  
  288.  
  289.  
  290. entries = ["w_dks_rgb_32_dm.gmf", "material=am3092.grf", "material=amm3779.grf"]
  291. add_entry(r"F:\TrinityDev\RohanCN\model\Player\bin\dm_s.gbf", entries)
  292.  
  293.  
  294. entries = ["w_dks_rgb_32_dw.gmf", "material=aw3126.grf", "material=aww3779.grf"]
  295. add_entry(r"F:\TrinityDev\RohanCN\model\Player\bin\dw_s.gbf", entries)
  296.  
  297.  
  298. entries = ["w_dks_rgb_32_dm01.gmf", "material=am3092.grf", "material=amm3779.grf"]
  299. add_entry(r"F:\TrinityDev\RohanCN\model\Player\bin\dm_s.gbf", entries)
  300.  
  301.  
  302. entries = ["w_dks_rgb_32_dw01.gmf", "material=aw3126.grf", "material=aww3779.grf"]
  303. add_entry(r"F:\TrinityDev\RohanCN\model\Player\bin\dw_s.gbf", entries)
  304.  
  305. #trinity
  306.  
  307.  
  308. entries = ["w_glove3400.gmf", "material=trr963.grf"]
  309. add_entry(r"F:\TrinityDev\RohanCN\model\Player\bin\tr_s.gbf", entries)
  310.  
  311.  
  312. entries = ["w_obj3400.gmf", "material=tnn951.grf"]
  313. add_entry(r"F:\TrinityDev\RohanCN\model\Player\bin\tn_s.gbf", entries)
  314.  
  315.  
  316.  
  317.  
  318. #onehandsword
  319.  
  320. entries = ["w_osw_rgb_32_am.gmf", "material=am3035.grf", "material=amm3722.grf"]
  321. add_entry(r"F:\TrinityDev\RohanCN\model\Player\bin\am_s.gbf", entries)
  322.  
  323.  
  324. entries = ["w_osw_rgb_32_aw.gmf", "material=aw3069.grf", "material=aww3722.grf"]
  325. add_entry(r"F:\TrinityDev\RohanCN\model\Player\bin\aw_s.gbf", entries)
  326.  
  327.  
  328. entries = ["w_osw_rgb_32_dm.gmf", "material=am3035.grf", "material=amm3722.grf"]
  329. add_entry(r"F:\TrinityDev\RohanCN\model\Player\bin\dm_s.gbf", entries)
  330.  
  331.  
  332. entries = ["w_osw_rgb_32_dw.gmf", "material=aw3069.grf", "material=aww3722.grf"]
  333. add_entry(r"F:\TrinityDev\RohanCN\model\Player\bin\dw_s.gbf", entries)
  334.  
  335.  
  336.  
  337. entries = ["w_osw_rgb_32_em.gmf", "material=am3035.grf", "material=amm3722.grf"]
  338. add_entry(r"F:\TrinityDev\RohanCN\model\Player\bin\em_s.gbf", entries)
  339.  
  340. entries = ["w_osw_rgb_32_ew.gmf", "material=aw3069.grf", "material=aww3722.grf"]
  341. add_entry(r"F:\TrinityDev\RohanCN\model\Player\bin\ew_s.gbf", entries)
  342.  
  343.  
  344. entries = ["w_osw_rgb_32_km.gmf", "material=am3035.grf", "material=amm3722.grf"]
  345. add_entry(r"F:\TrinityDev\RohanCN\model\Player\bin\km_s.gbf", entries)
  346.  
  347.  
  348. entries = ["w_osw_rgb_32_kw.gmf", "material=aw3069.grf", "material=aww3722.grf"]
  349. add_entry(r"F:\TrinityDev\RohanCN\model\Player\bin\kw_s.gbf", entries)
  350.  
  351.  
  352.  
  353. entries = ["w_osw_rgb_32_nm.gmf", "material=am3035.grf", "material=amm3722.grf"]
  354. add_entry(r"F:\TrinityDev\RohanCN\model\Player\bin\nm_s.gbf", entries)
  355.  
  356.  
  357. entries = ["w_osw_rgb_32_nw.gmf", "material=aw3069.grf", "material=aww3722.grf"]
  358. add_entry(r"F:\TrinityDev\RohanCN\model\Player\bin\nw_s.gbf", entries)
  359.  
  360.  
  361.  
  362. entries = ["w_osw_rgb_32_wm.gmf", "material=am3035.grf", "material=amm3722.grf"]
  363. add_entry(r"F:\TrinityDev\RohanCN\model\Player\bin\wm_s.gbf", entries)
  364.  
  365.  
  366. entries = ["w_osw_rgb_32_ww.gmf", "material=aw3069.grf", "material=aww3722.grf"]
  367. add_entry(r"F:\TrinityDev\RohanCN\model\Player\bin\ww_s.gbf", entries)
  368.  
  369.  
  370.  
  371. entries = ["w_osw_rgb_32_zm.gmf", "material=am3035.grf", "material=amm3722.grf"]
  372. add_entry(r"F:\TrinityDev\RohanCN\model\Player\bin\zm_s.gbf", entries)
  373.  
  374.  
  375. entries = ["w_osw_rgb_32_zw.gmf", "material=aw3069.grf", "material=aww3722.grf"]
  376. add_entry(r"F:\TrinityDev\RohanCN\model\Player\bin\zw_s.gbf", entries)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top