Advertisement
dsiver144

DSI Patch System

Jun 2nd, 2017
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1.  
  2. module DSIVER144
  3.  
  4. module PATCH_SYSTEM
  5.  
  6. PATCH_DIR = "Patches"
  7.  
  8. def self.dump_patch_test
  9. array = ["A","B","C"]
  10. header = {}
  11. header[:data] = array
  12. File.open("Test.patch", "wb") do |file|
  13. Marshal.dump(header, file)
  14. end
  15. end
  16.  
  17. def self.get_patch_file
  18. files = Dir["*.txt"]
  19. end
  20.  
  21. def self.get_data(type)
  22. case type
  23. when :item
  24. return $data_items
  25. when :weapon
  26. return $data_weapons
  27. when :armor
  28. return $data_armors
  29. end
  30. end
  31.  
  32. def self.create_patch(type,*args)
  33. @patch = []
  34. @data_array = get_data(type)
  35. args.each do |i|
  36. @patch << @data_array[i]
  37. end
  38. p @patch
  39. end
  40.  
  41. end
  42.  
  43. end
  44.  
  45.  
  46. #DSIVER144::PATCH_SYSTEM.dump_patch_test
  47. #a = load_data("Test.patch")
  48.  
  49. module DataManager
  50. class << self
  51. alias_method(:dsi_load_database_patch_system, :load_database)
  52. end
  53. #--------------------------------------------------------------------------
  54. # * Load Database
  55. #--------------------------------------------------------------------------
  56. def self.load_database
  57. dsi_load_database_patch_system
  58. DSIVER144::PATCH_SYSTEM.create_patch(:item,1,2,3)
  59. end
  60. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement