Advertisement
Fomar0153

Fomar0153 - Albhed Translator 1.0

Feb 14th, 2012
291
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 2.24 KB | None | 0 0
  1. =begin
  2. Albhed Translator
  3. by Fomar0153
  4. Version 1.0
  5. ----------------------
  6. Notes
  7. ----------------------
  8. Adds an Albhed style language to your game.
  9. ----------------------
  10. Instructions
  11. ----------------------
  12. Follow the instructions in the Albhed module
  13. turn your chosen switch on to have people speak
  14. Albhed.
  15. ----------------------
  16. Known bugs
  17. ----------------------
  18. None
  19. =end
  20. module Albhed
  21.  
  22.   # Id of the switch to translate the text to Albhed
  23.   ALBHED_SWITCH = 5
  24.  
  25.   ALBHED_CHARS = {}
  26.   # ALBHED_CHARS['letter'] = ['replacementletter', itemid to translate]
  27.   ALBHED_CHARS['a'] = ['b', 1]
  28.   ALBHED_CHARS['b'] = ['c', 1]
  29.   ALBHED_CHARS['c'] = ['d', 1]
  30.   ALBHED_CHARS['d'] = ['e', 1]
  31.   ALBHED_CHARS['e'] = ['f', 1]
  32.   ALBHED_CHARS['f'] = ['g', 1]
  33.   ALBHED_CHARS['g'] = ['h', 1]
  34.   ALBHED_CHARS['h'] = ['i', 1]
  35.   ALBHED_CHARS['i'] = ['j', 1]
  36.   ALBHED_CHARS['j'] = ['k', 1]
  37.   ALBHED_CHARS['k'] = ['l', 1]
  38.   ALBHED_CHARS['l'] = ['m', 1]
  39.   ALBHED_CHARS['m'] = ['n', 1]
  40.   ALBHED_CHARS['n'] = ['o', 1]
  41.   ALBHED_CHARS['o'] = ['p', 1]
  42.   ALBHED_CHARS['p'] = ['q', 1]
  43.   ALBHED_CHARS['q'] = ['r', 1]
  44.   ALBHED_CHARS['r'] = ['s', 1]
  45.   ALBHED_CHARS['s'] = ['t', 1]
  46.   ALBHED_CHARS['t'] = ['u', 1]
  47.   ALBHED_CHARS['u'] = ['v', 1]
  48.   ALBHED_CHARS['v'] = ['w', 1]
  49.   ALBHED_CHARS['w'] = ['x', 1]
  50.   ALBHED_CHARS['x'] = ['y', 1]
  51.   ALBHED_CHARS['y'] = ['z', 1]
  52.   ALBHED_CHARS['z'] = ['a', 1]
  53.  
  54.   def self.translate(c)
  55.     return c if ALBHED_CHARS[c.downcase].nil?
  56.     return c if $game_party.has_item?($data_items[ALBHED_CHARS[c.downcase][1]])
  57.     return ALBHED_CHARS[c.downcase][0].downcase if c.downcase!.nil?
  58.     return ALBHED_CHARS[c.downcase][0].upcase
  59.   end
  60.  
  61. end
  62.  
  63. class Window_Base < Window
  64.   #--------------------------------------------------------------------------
  65.   # ● 通常文字の処理
  66.   #--------------------------------------------------------------------------
  67.   alias albhed_process_normal_character process_normal_character
  68.   def process_normal_character(c, pos)
  69.     return albhed_process_normal_character(c, pos) unless $game_switches[Albhed::ALBHED_SWITCH]
  70.     c = Albhed.translate(c)
  71.     text_width = text_size(c).width
  72.     draw_text(pos[:x], pos[:y], text_width * 2, pos[:height], c)
  73.     pos[:x] += text_width
  74.   end
  75. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement