IceDragon200

ICY-RecruitmentSystem (Old)

Jul 19th, 2011
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 71.93 KB | None | 0 0
  1. #------------------------------------------------------------------------------#
  2. #Recruitment System V 1.2a
  3. #Created by : IceDragon
  4. #Script-Status : GO!
  5. #Date Started : 3/12/2010
  6. #Date Last Modified : 7/17/2010
  7. #Date Completed : 3/24/2010
  8. #Date Released : 3/24/2010
  9. #Difficulty : Medium
  10. #------------------------------------------------------------------------------#
  11. =begin
  12.  
  13. REALEASE LOG--------------
  14. --------
  15. 7/17/2010 = V1.2a Dumped all my Window Scripts into it
  16. 3/24/2010 = V1.0 Finished Script >_<
  17.  
  18. In order to use the script you must configure it below!
  19. To call the script
  20. USE
  21. $scene = Scene_Recruit.new
  22. =end
  23. #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
  24. #-#-#-#-#START CUSTOMIZATION#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
  25. #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
  26. #THIS IS NOT JUST SOME PLUG 'n' PLAY or COPY 'n' PASTE
  27. #Configure 'IT'
  28. module ICY
  29.   module RCS
  30.  
  31. #Character limit for naming
  32. NAME_CHAR_LIMIT = 9
  33.  
  34. #Opacity for inactive windows
  35. OPAC = 160
  36.  
  37. #Basic Recruit Cost
  38. RECCOST = 1000
  39.  
  40. #There can also be sub charges such as Type, Gender or Class Costs
  41. #Enable other costs, such as class cost
  42. EXTRACOSTS = true
  43. #Type Cost enabled
  44. T_Cost = true
  45. #Gender Cost enabled
  46. G_Cost = true
  47. #Class Cost enabled
  48. C_Cost = true
  49.  
  50. #These are the recruits. An array of actor IDS.
  51.     RECRUITS = [2, 3, 4, 5, 6, 7, 8]
  52.  
  53.    
  54. #These are sub catergories fo sorting purposes  
  55.      TYPES  = ["Human"]              
  56.     GENDERS = ["Male","Female"]
  57.    
  58. #Icons for types    
  59.     TYPESCON = {
  60.     "Human"  => 137,
  61.     }#Don't touch this
  62.    
  63. #Type Costs $
  64. #Money makes this system go round if you enable this feature
  65.     TYPESCOST = {
  66.     "Human"  => 100,
  67.     }#Don't touch this
  68.    
  69. #Icons for Genders  
  70.     GENDERSCON = {
  71.     "Male"   => 2,
  72.     "Female" => 9,
  73.     }#Don't touch this
  74.  
  75. #Icons for Genders
  76. #Money makes this system go round if you enable this feature
  77.     GENDERSCOST = {
  78.     "Male"   => 200,
  79.     "Female" => 200,
  80.     }#Don't touch this
  81.    
  82. #Recruit info follows    
  83. #Class_ID =>[type, gender]
  84. #OR
  85. #Class_ID =>[gender, type]
  86. #It doesn't really matter how you put in the array just don't have it twice!
  87.     RECRUIT_INFO = {
  88.     0 => ["Unknown","Unknown"],#NULL ACTOR
  89.     2 => ["Human","Female"],
  90.     3 => ["Human","Male"],
  91.     4 => ["Human","Female"],
  92.     5 => ["Human","Male"],
  93.     6 => ["Human","Male"],
  94.     7 => ["Human","Female"],
  95.     8 => ["Human","Male"],
  96.             }#Don't touch this
  97.                
  98. #Recruitment class type IDS
  99. #This will be used for the selectable classes
  100. #These are the classes that can be assigned to the selected recruit
  101. #Note that the Recruits will "NOT" be filtered by classes.
  102.     REC_CLASSES = [1, 2, 3, 4, 5, 6, 7, 8]
  103.    
  104. #Class icons
  105.  REC_CLASS_CONS = {
  106.    0  =>  176,  # Nil Class
  107.    1  =>  32,   # Paladin(Knight)
  108.    2  =>  6,    # Warrior
  109.    3  =>  128,  # Priest
  110.    4  =>  119,  # Magician
  111.    5  =>  3,    # Knight(Paladin)
  112.    6  =>  136,  # Dark Knight
  113.    7  =>  132,  # Grappler
  114.    8  =>  39,   # Thief
  115.     }#Don't touch this
  116.    
  117. #Class Costs $
  118. #Money makes this system go round if you enable this feature
  119.  REC_CLASS_COST = {
  120.  0  => "Free", #NO Cost#Don't touch this
  121.  1 => 300,
  122.  2 => 600,
  123.  3 => 500,
  124.  4 => 500,
  125.  5 => 600,
  126.  6 => 800,
  127.  7 => 500,
  128.  8 => 300,
  129.  
  130.  }#Don't touch this
  131.  
  132. #Menu commands icon
  133. #These are the icons used by the commands inside the recruitment window
  134. #Recruit Icon
  135. RECUCON  = 152
  136. #Setup Icon
  137. SETUPCON = 155
  138. #Leave Icon
  139. LEAVECON = 157
  140. #Tab Switch SE
  141. TABSND = "Book"
  142.  
  143. end#END RCS-DON'T TOUCH
  144.  
  145.   module RCS_HELPS#DON'T TOUCH
  146.    
  147.     #Texts used for help
  148.     #Help for types\races
  149.     RACEHELP = {
  150.     "Human" => "Simple everday human",
  151.     }#Don't touch this
  152.     #Help for Genders
  153.     GENDERHELP = {
  154.     "Male"   => "Male",
  155.     "Female" => "Female",
  156.     }#Don't touch this
  157.     #Help for Classes
  158.     CLASSHELP = {
  159.     0 => "Unknown",
  160.     1 => "Holy Knights",
  161.     2 => "High Attack Class",
  162.     3 => "Holy Healing Class",
  163.     4 => "Magic Users",
  164.     5 => "Guards of justice",
  165.     6 => "Dark users",
  166.     7 => "Masters of Barehand",
  167.     8 => "Stealth Class"
  168.     }#Don't touch this
  169.    
  170.   end#END RCS_HELPS-DON'T TOUCH
  171.  
  172.  
  173.   module RCS_Vocab#DON'T TOUCH
  174.    
  175.     #Text used for recruitment system
  176.     #Text to be used when setting up recruit
  177.     SETTEXT = "Set_Up"
  178.    
  179.     #Text to be used when recruiting
  180.     RECTEXT = "Recruit"
  181.    
  182.     #Text to be used when cancelling recruiting
  183.     CANCELTEXT = "Quit Recruiting"
  184.    
  185.     #Text to be used for the types
  186.     TYPEWIN = "Race"
  187.    
  188.     #Text to be used for genders
  189.     GENWIN = "Gender"
  190.    
  191.     #Text to be used for classes
  192.     CLSWIN = "Class"
  193.    
  194.     #Text used in confirmation window
  195.     CONFIRM = "Recruit!"
  196.    
  197.     #Icon for Confirm
  198.     CONFCON = 1468
  199.    
  200.     #Text used in confirmation window
  201.     CANCEL = "....."
  202.    
  203.     #Icon for Cancel
  204.     CANCCON = 115
  205.    
  206.     #Text used for total cost
  207.     TOTACOST = "Total Fee"
  208.    
  209.     #Text used for recruit cost
  210.     RECCOSTTEXT = "Recruit Fee"
  211.    
  212.   end#END RCS_Vocab-DON'T TOUCH
  213.  
  214.  module RCS_Fonts#DON'T TOUCH
  215.    
  216.    #Font Control
  217.    #Default Font Size
  218.    FONTSIZE = 16
  219.    
  220.    #Font used for list
  221.    DEFAULTFONT = "Agency FB"
  222.    
  223.    #List Font Size
  224.    SELFONTSIZE = 24
  225.    
  226.    #Font used for list headers
  227.    HEADERFONT = "Agency FB"
  228.    
  229.    #Header Font Size
  230.    HEADERFONTSIZE = 24
  231.    
  232.  end#END RCS_Fonts-DON'T TOUCH
  233. end#END ICY-DON'T TOUCH
  234. ################################################################################
  235. #------------------------------------------------------------------------------#
  236. #END\\\END\\\END\\\END\\\END\\\END\\\END///END///END///END///END///END///END///#
  237. #------------------------------------------------------------------------------#
  238. ################################################################################
  239. #==============================================================================
  240. # ** ICY_Windows
  241. #------------------------------------------------------------------------------
  242. #  This Script houses all my Base Window scripts
  243. #==============================================================================
  244. =begin
  245. Script 'O' Contents
  246. ICY_W1.0  ICY_Window_Base
  247. ICY_W1.1  ICY_Window_Selectable
  248. ICY_W1.2  ICY_Window_Command
  249. ICY_W1.3  ICY_Window_Help
  250. ICY_W1.4  ICY_Window_NameEdit
  251. ICY_W1.5  ICY_Window_NameInput
  252. ICY_W1.6  ICY_Window_Item
  253. ICY_W1.7  ICY_Window_Current_Items
  254. ICY_W1.8  ICY_Window_Gold
  255. ICY_W1.9  ICY_Window_ShopBuy
  256. ICY_W1.10 ICY_Window_SaveFile
  257. ICY_W1.11 ICY_Window_NameingActor
  258. =end
  259. #==============================================================================
  260. # ** ICY_Gold
  261. #------------------------------------------------------------------------------
  262. #  This is the customizi part.
  263. #==============================================================================
  264. module ICY
  265.   module ISS
  266.     #This is the Icon used in my gold window by default it is 205
  267.     Goldcon = 205
  268.   end
  269. end
  270. $imported = {} if $imported == nil
  271. $imported["ICY_Window_Systems"] = true
  272. #ICY_W1.0
  273. #==============================================================================
  274. # ** ICY_Window_Base
  275. #------------------------------------------------------------------------------
  276. #  This is a class for custom windows.
  277. #==============================================================================
  278.  
  279. class ICY_Window_Base < Window_Base
  280.   #--------------------------------------------------------------------------
  281.   # * Object Initialization
  282.   #     x      : window x-coordinate
  283.   #     y      : window y-coordinate
  284.   #     width  : window width
  285.   #     height : window height
  286.   #   windfold : use a window folder?
  287.   #   cuswin   : use a custom window?
  288.   #--------------------------------------------------------------------------
  289.   def initialize(x, y, width, height, fontsize = 21)
  290.      super(x,y, width, height)
  291.     self.z = 100
  292.     self.back_opacity = 200
  293.     self.openness = 255
  294.     @fontsize = fontsize
  295.     create_contents
  296.     @opening = false
  297.     @closing = false
  298.   end
  299.  
  300. def icy_draw_text(tx, ty, twidth, theight, string, align = 0, font = "Arial Black")
  301.   self.contents.font.name = font
  302.   self.contents.font.size = @fontsize
  303.   self.contents.draw_text(tx, ty, twidth, theight, string, align)
  304. end
  305.  
  306. end
  307. #ICY_W1.1
  308. #==============================================================================
  309. # ** ICY_Window_Selectable
  310. #------------------------------------------------------------------------------
  311. #  This window contains cursor movement and scroll functions.
  312. #==============================================================================
  313.  
  314. class ICY_Window_Selectable < Window_Selectable
  315.   #--------------------------------------------------------------------------
  316.   # * Public Instance Variables
  317.   #--------------------------------------------------------------------------
  318.   attr_reader   :item_max                 # item count
  319.   attr_reader   :column_max               # digit count
  320.   attr_reader   :index                    # cursor position
  321.   attr_reader   :help_window              # help window
  322.   #--------------------------------------------------------------------------
  323.   # * Object Initialization
  324.   #     x       : window X coordinate
  325.   #     y       : window Y coordinate
  326.   #     width   : window width
  327.   #     height  : window height
  328.   #     spacing : width of empty space when items are arranged horizontally
  329.   #--------------------------------------------------------------------------
  330.   def initialize(x, y, width, height, columns, spacing = 32)
  331.     super(x, y, width, height, spacing)
  332.     @column_max = columns
  333.   end
  334.  
  335. end
  336. #ICY_W1.2
  337. #==============================================================================
  338. # ** ICY_Window_Command
  339. #------------------------------------------------------------------------------
  340. #  This window deals with general command choices.
  341. #==============================================================================
  342.  
  343. class ICY_Window_Command < Window_Selectable
  344.   #--------------------------------------------------------------------------
  345.   # * Public Instance Variables
  346.   #--------------------------------------------------------------------------
  347.   attr_reader   :commands                 # command
  348.   #--------------------------------------------------------------------------
  349.   # * Object Initialization
  350.   #     width      : window width
  351.   #     commands   : command string array
  352.   #     commandcons: command icon array
  353.   #     column_max : digit count (if 2 or more, horizontal selection)
  354.   #     row_max    : row count (0: match command count)
  355.   #     spacing    : blank space when items are arrange horizontally
  356.   #--------------------------------------------------------------------------
  357.   def initialize(width, commands, commandcons, fontsize = 18, column_max = 1, row_max = 0, spacing = 32)
  358.     if row_max == 0
  359.       row_max = (commands.size + column_max - 1) / column_max
  360.     end
  361.     super(0, 0, width, row_max * WLH + 32, spacing)
  362.     @commands = commands
  363.     @item_max = commands.size
  364.     @column_max = column_max
  365.     @commandcons = commandcons
  366.     @fontsize = fontsize
  367.     refresh
  368.     self.index = 0
  369.   end
  370.   #--------------------------------------------------------------------------
  371.   # * Refresh
  372.   #--------------------------------------------------------------------------
  373.   def refresh
  374.    self.contents.clear
  375.     for i in 0...@item_max
  376.       command = @commands[i]
  377.       icon = @commandcons[command]        
  378.        icy_recdraw_item(i, icon)
  379.     end
  380.   end
  381.   #--------------------------------------------------------------------------
  382.   # * Draw Item
  383.   #     index   : item number
  384.   #     enabled : enabled flag. When false, draw semi-transparently.
  385.   #--------------------------------------------------------------------------
  386.   def icy_recdraw_item(index, icon_index, enabled = true)
  387.     rect = item_rect(index)
  388.     rect.x += 24
  389.     rect.width -= 8
  390.    
  391.     if @column_max == 1
  392.     draw_icon(icon_index, x, rect.y, enabled)
  393.   else
  394.     draw_icon(icon_index, (rect.x - 24), y, enabled)
  395.   end
  396.  
  397.     self.contents.clear_rect(rect)
  398.     self.contents.font.size = @fontsize
  399.     self.contents.font.color = normal_color
  400.     self.contents.font.color.alpha = enabled ? 255 : 128
  401.     self.contents.draw_text(rect, @commands[index])
  402.   end
  403. end
  404.  
  405. #ICY_W1.3
  406. #==============================================================================
  407. # ** ICY_Window_Help
  408. #------------------------------------------------------------------------------
  409. #  This window shows explanations.
  410. #==============================================================================
  411.  
  412. class ICY_Window_Help < Window_Base
  413.   #--------------------------------------------------------------------------
  414.   # * Object Initialization
  415.   #--------------------------------------------------------------------------
  416.   def initialize(x, y, width, height, fontsize = 18)
  417.     super(x, y, width, height)
  418.     @fontsize = fontsize
  419.   end
  420.   #--------------------------------------------------------------------------
  421.   # * Set Text
  422.   #  text  : character string displayed in window
  423.   #  align : alignment (0..flush left, 1..center, 2..flush right)
  424.   #--------------------------------------------------------------------------
  425.   def set_text(text, align = 0)
  426.     if text != @text or align != @align
  427.       self.contents.clear
  428.       self.contents.font.size = @fontsize
  429.       self.contents.font.color = normal_color
  430.       self.contents.draw_text(4, 0, self.width - 40, WLH, text, align)
  431.       @text = text
  432.       @align = align
  433.     end
  434.   end
  435. end
  436.  
  437. #ICY_W1.4
  438. #==============================================================================
  439. # ** ICY_Window_NameEdit
  440. #------------------------------------------------------------------------------
  441. #  This window is used to edit an actor's name on the name input screen.
  442. #==============================================================================
  443.  
  444. class ICY_Window_NameEdit < Window_Base
  445.   #--------------------------------------------------------------------------
  446.   # * Public Instance Variables
  447.   #--------------------------------------------------------------------------
  448.   attr_reader   :name                     # name
  449.   attr_reader   :index                    # cursor position
  450.   attr_reader   :max_char                 # maximum number of characters
  451.   #--------------------------------------------------------------------------
  452.   # * Object Initialization
  453.   #     actor    : actor
  454.   #     max_char : maximum number of characters
  455.   #--------------------------------------------------------------------------
  456.   def initialize(actor, max_char)
  457.     super(20, 20, 480, 128)
  458.     @actor = actor
  459.     @name = actor.name
  460.     @max_char = max_char
  461.     name_array = @name.split(//)[0...@max_char]   # Fit within max length
  462.     @name = ""
  463.     for i in 0...name_array.size
  464.       @name += name_array[i]
  465.     end
  466.     @default_name = @name
  467.     @index = name_array.size
  468.     self.active = false
  469.     refresh
  470.     update_cursor
  471.   end
  472.   #--------------------------------------------------------------------------
  473.   # * Return to Default Name
  474.   #--------------------------------------------------------------------------
  475.   def restore_default
  476.     @name = @default_name
  477.     @index = @name.split(//).size
  478.     refresh
  479.     update_cursor
  480.   end
  481.   #--------------------------------------------------------------------------
  482.   # * Add Text Character
  483.   #     character : text character to be added
  484.   #--------------------------------------------------------------------------
  485.   def add(character)
  486.     if @index < @max_char and character != ""
  487.       @name += character
  488.       @index += 1
  489.       refresh
  490.       update_cursor
  491.     end
  492.   end
  493.   #--------------------------------------------------------------------------
  494.   # * Delete Text Character
  495.   #--------------------------------------------------------------------------
  496.   def back
  497.     if @index > 0
  498.       name_array = @name.split(//)          # Delete one character
  499.       @name = ""
  500.       for i in 0...name_array.size-1
  501.         @name += name_array[i]
  502.       end
  503.       @index -= 1
  504.       refresh
  505.       update_cursor
  506.     end
  507.   end
  508.   #--------------------------------------------------------------------------
  509.   # * Get rectangle for displaying items
  510.   #     index : item number
  511.   #--------------------------------------------------------------------------
  512.   def item_rect(index)
  513.     rect = Rect.new(0, 0, 0, 0)
  514.     rect.x = 220 - (@max_char + 1) * 12 + index * 24
  515.     rect.y = 36
  516.     rect.width = 24
  517.     rect.height = WLH
  518.     return rect
  519.   end
  520.   #--------------------------------------------------------------------------
  521.   # * Refresh
  522.   #--------------------------------------------------------------------------
  523.   def refresh
  524.     self.contents.clear
  525.     draw_actor_face(@actor, 0, 0)
  526.     name_array = @name.split(//)
  527.     for i in 0...@max_char
  528.       c = name_array[i]
  529.       c = '_' if c == nil
  530.       self.contents.draw_text(item_rect(i), c, 1)
  531.     end
  532.   end
  533.   #--------------------------------------------------------------------------
  534.   # * Update cursor
  535.   #--------------------------------------------------------------------------
  536.   def update_cursor
  537.     self.cursor_rect = item_rect(@index)
  538.   end
  539.   #--------------------------------------------------------------------------
  540.   # * Frame Update
  541.   #--------------------------------------------------------------------------
  542.   def update
  543.     super
  544.     update_cursor
  545.   end
  546. end
  547.  
  548. #ICY_W1.5
  549. #==============================================================================
  550. # ** ICY_Window_NameInput
  551. #------------------------------------------------------------------------------
  552. #  This window is used to select text characters on the name input screen.
  553. #==============================================================================
  554.  
  555. class ICY_Window_NameInput < Window_Base
  556.   #--------------------------------------------------------------------------
  557.   # * Text Character Table
  558.   #--------------------------------------------------------------------------
  559.   ENGLISH = [ 'A','B','C','D','E',  'F','G','H','I','J',
  560.               'K','L','M','N','O',  'P','Q','R','S','T',
  561.               'U','V','W','X','Y',  'Z',' ',' ',' ',' ',
  562.               'a','b','c','d','e',  'f','g','h','i','j',
  563.               'k','l','m','n','o',  'p','q','r','s','t',
  564.               'u','v','w','x','y',  'z','_','-',' ',' ',
  565.               ' ',' ',' ',' ',' ',  ' ',' ',' ',' ',' ',
  566.               '1','2','3','4','5',  ' ',' ',' ',' ',' ',
  567.               '6','7','8','9','0',  ' ',' ',' ',' ','OK']
  568.   TABLE = [ENGLISH]
  569.   #--------------------------------------------------------------------------
  570.   # * Object Initialization
  571.   #     mode : Defeault input mode (always 0 in English version)
  572.   #--------------------------------------------------------------------------
  573.   def initialize(mode = 0)
  574.     super(20, 148, 386, 248)
  575.     @mode = mode
  576.     @index = 0
  577.     refresh
  578.     update_cursor
  579.   end
  580.   #--------------------------------------------------------------------------
  581.   # * Text Character Acquisition
  582.   #--------------------------------------------------------------------------
  583.   def character
  584.     if @index < 88
  585.       return TABLE[@mode][@index]
  586.     else
  587.       return ""
  588.     end
  589.   end
  590.   #--------------------------------------------------------------------------
  591.   # * Determine Cursor Position: Mode Switch
  592.   #--------------------------------------------------------------------------
  593.   def is_mode_change
  594.     return (@index == 88)
  595.   end
  596.   #--------------------------------------------------------------------------
  597.   # * Determine Cursor Location: Confirmation
  598.   #--------------------------------------------------------------------------
  599.   def is_decision
  600.     return (@index == 89)
  601.   end
  602.   #--------------------------------------------------------------------------
  603.   # * Get rectangle for displaying items
  604.   #     index : item number
  605.   #--------------------------------------------------------------------------
  606.   def item_rect(index)
  607.     rect = Rect.new(0, 0, 0, 0)
  608.     rect.x = index % 10 * 32 + index % 10 / 5 * 16
  609.     rect.y = index / 10 * WLH
  610.     rect.width = 32
  611.     rect.height = WLH
  612.     return rect
  613.   end
  614.   #--------------------------------------------------------------------------
  615.   # * Refresh
  616.   #--------------------------------------------------------------------------
  617.   def refresh
  618.     self.contents.clear
  619.     for i in 0..89
  620.       rect = item_rect(i)
  621.       rect.x += 2
  622.       rect.width -= 4
  623.       self.contents.draw_text(rect, TABLE[@mode][i], 1)
  624.     end
  625.   end
  626.   #--------------------------------------------------------------------------
  627.   # * Update cursor
  628.   #--------------------------------------------------------------------------
  629.   def update_cursor
  630.     self.cursor_rect = item_rect(@index)
  631.   end
  632.   #--------------------------------------------------------------------------
  633.   # * Move cursor down
  634.   #     wrap : Wraparound allowed
  635.   #--------------------------------------------------------------------------
  636.   def cursor_down(wrap)
  637.     if @index < 80
  638.       @index += 10
  639.     elsif wrap
  640.       @index -= 80
  641.     end
  642.   end
  643.   #--------------------------------------------------------------------------
  644.   # * Move cursor up
  645.   #     wrap : Wraparound allowed
  646.   #--------------------------------------------------------------------------
  647.   def cursor_up(wrap)
  648.     if @index >= 10
  649.       @index -= 10
  650.     elsif wrap
  651.       @index += 80
  652.     end
  653.   end
  654.   #--------------------------------------------------------------------------
  655.   # * Move cursor right
  656.   #     wrap : Wraparound allowed
  657.   #--------------------------------------------------------------------------
  658.   def cursor_right(wrap)
  659.     if @index % 10 < 9
  660.       @index += 1
  661.     elsif wrap
  662.       @index -= 9
  663.     end
  664.   end
  665.   #--------------------------------------------------------------------------
  666.   # * Move cursor left
  667.   #     wrap : Wraparound allowed
  668.   #--------------------------------------------------------------------------
  669.   def cursor_left(wrap)
  670.     if @index % 10 > 0
  671.       @index -= 1
  672.     elsif wrap
  673.       @index += 9
  674.     end
  675.   end
  676.   #--------------------------------------------------------------------------
  677.   # * Move Cursor to [OK]
  678.   #--------------------------------------------------------------------------
  679.   def cursor_to_decision
  680.     @index = 89
  681.   end
  682.   #--------------------------------------------------------------------------
  683.   # * Move to Next Page
  684.   #--------------------------------------------------------------------------
  685.   def cursor_pagedown
  686.     @mode = (@mode + 1) % TABLE.size
  687.     refresh
  688.   end
  689.   #--------------------------------------------------------------------------
  690.   # * Move to Previous Page
  691.   #--------------------------------------------------------------------------
  692.   def cursor_pageup
  693.     @mode = (@mode + TABLE.size - 1) % TABLE.size
  694.     refresh
  695.   end
  696.   #--------------------------------------------------------------------------
  697.   # * Frame Update
  698.   #--------------------------------------------------------------------------
  699.   def update
  700.     super
  701.     last_mode = @mode
  702.     last_index = @index
  703.     if Input.repeat?(Input::DOWN)
  704.       cursor_down(Input.trigger?(Input::DOWN))
  705.     end
  706.     if Input.repeat?(Input::UP)
  707.       cursor_up(Input.trigger?(Input::UP))
  708.     end
  709.     if Input.repeat?(Input::RIGHT)
  710.       cursor_right(Input.trigger?(Input::RIGHT))
  711.     end
  712.     if Input.repeat?(Input::LEFT)
  713.       cursor_left(Input.trigger?(Input::LEFT))
  714.     end
  715.     if Input.trigger?(Input::A)
  716.       cursor_to_decision
  717.     end
  718.     if Input.trigger?(Input::R)
  719.       cursor_pagedown
  720.     end
  721.     if Input.trigger?(Input::L)
  722.       cursor_pageup
  723.     end
  724.     if Input.trigger?(Input::C) and is_mode_change
  725.       cursor_pagedown
  726.     end
  727.     if @index != last_index or @mode != last_mode
  728.       Sound.play_cursor
  729.     end
  730.     update_cursor
  731.   end
  732. end
  733.  
  734. #ICY_W1.6
  735. #==============================================================================
  736. # ** ICY_Window_Item
  737. #------------------------------------------------------------------------------
  738. #  This window displays a list of inventory items for the item screen, etc.
  739. #==============================================================================
  740.  
  741. class ICY_Window_Item < Window_Selectable
  742.   #--------------------------------------------------------------------------
  743.   # * Object Initialization
  744.   #     x      : window x-coordinate
  745.   #     y      : window y-coordinate
  746.   #     width  : window width
  747.   #     height : window height
  748.   #--------------------------------------------------------------------------
  749.   def initialize(x, y, width, height)
  750.     super(x, y, width, height)
  751.     @column_max = 1
  752.     self.index = 0
  753.     refresh
  754.   end
  755.   #--------------------------------------------------------------------------
  756.   # * Get Item
  757.   #--------------------------------------------------------------------------
  758.   def item
  759.     return @data[self.index]
  760.   end
  761.   #--------------------------------------------------------------------------
  762.   # * Whether or not to include in item list
  763.   #     item : item
  764.   #--------------------------------------------------------------------------
  765.   def include?(item)
  766.     return false if item == nil
  767.     if $game_temp.in_battle
  768.       return false unless item.is_a?(RPG::Item)
  769.     end
  770.     return true
  771.   end
  772.   #--------------------------------------------------------------------------
  773.   # * Whether or not to display in enabled state
  774.   #     item : item
  775.   #--------------------------------------------------------------------------
  776.   def enable?(item)
  777.     return $game_party.item_can_use?(item)
  778.   end
  779.   #--------------------------------------------------------------------------
  780.   # * Refresh
  781.   #--------------------------------------------------------------------------
  782.   def refresh
  783.     @data = []
  784.     for item in $game_party.items
  785.       next unless include?(item)
  786.       @data.push(item)
  787.       if item.is_a?(RPG::Item) and item.id == $game_party.last_item_id
  788.         self.index = @data.size - 1
  789.       end
  790.     end
  791.     @data.push(nil) if include?(nil)
  792.     @item_max = @data.size
  793.     create_contents
  794.     for i in 0...@item_max
  795.       draw_item(i)
  796.     end
  797.   end
  798.   #--------------------------------------------------------------------------
  799.   # * Draw Item
  800.   #     index : item number
  801.   #--------------------------------------------------------------------------
  802.   def draw_item(index)
  803.     rect = item_rect(index)
  804.     self.contents.clear_rect(rect)
  805.     item = @data[index]
  806.     if item != nil
  807.       number = $game_party.item_number(item)
  808.       enabled = enable?(item)
  809.       rect.width -= 4
  810.       draw_item_name(item, rect.x, rect.y, enabled)
  811.       self.contents.draw_text(rect, sprintf(":%2d", number), 2)
  812.     end
  813.   end
  814.   #--------------------------------------------------------------------------
  815.   # * Update Help Text
  816.   #--------------------------------------------------------------------------
  817.   def update_help
  818.     @help_window.set_text(item == nil ? "" : item.description)
  819.   end
  820. end
  821.  
  822. #ICY_W1.7
  823. #==============================================================================
  824. # ** ICY_Window_Current_Items
  825. #------------------------------------------------------------------------------
  826. #  This window displays items in possession for selling on the shop screen.
  827. #==============================================================================
  828.  
  829. class ICY_Window_CurrentItems < ICY_Window_Item
  830.   #--------------------------------------------------------------------------
  831.   # * Object Initialization
  832.   #     x      : window x-coordinate
  833.   #     y      : window y-coordinate
  834.   #     width  : window width
  835.   #     height : window height
  836.   #--------------------------------------------------------------------------
  837.   def initialize(x, y, width, height)
  838.     super(x, y, width, height)
  839.   end
  840.   #--------------------------------------------------------------------------
  841.   # * Whether or not to include in item list
  842.   #     item : item
  843.   #--------------------------------------------------------------------------
  844.   def include?(item)
  845.     return item != nil
  846.   end
  847.   #--------------------------------------------------------------------------
  848.   # * Whether or not to display in enabled state
  849.   #     item : item
  850.   #--------------------------------------------------------------------------
  851.   def enable?(item)
  852.     return (item.price > 0)
  853.   end
  854. end
  855.  
  856. #ICY_W1.8
  857.  
  858. #==============================================================================
  859. # ** ICY_Window_Gold
  860. #------------------------------------------------------------------------------
  861. #  This window displays the amount of gold.
  862. #==============================================================================
  863.  
  864. class ICY_Window_Gold < Window_Base
  865.   #--------------------------------------------------------------------------
  866.   # * Object Initialization
  867.   #     x : window X coordinate
  868.   #     y : window Y coordinate
  869.   #--------------------------------------------------------------------------
  870.   def initialize(x, y)
  871.     super(x, y, 160, WLH + 32)
  872.     refresh
  873.   end
  874.   #--------------------------------------------------------------------------
  875.   # * Refresh
  876.   #--------------------------------------------------------------------------
  877.   def refresh
  878.     self.contents.clear
  879.     draw_currency_value($game_party.gold, 4, 0, 120)
  880.     draw_icon(ICY::ISS::Goldcon, 0, 0, true)
  881.   end
  882. end
  883.  
  884. #ICY_W1.9
  885. #==============================================================================
  886. # ** ICY_Window_ShopBuy
  887. #------------------------------------------------------------------------------
  888. #  This window displays buyable goods on the shop screen.
  889. #==============================================================================
  890.  
  891. class ICY_Window_ShopBuy < ICY_Window_Selectable
  892.   #--------------------------------------------------------------------------
  893.   # * Object Initialization
  894.   #     x : window X coordinate
  895.   #     y : window Y coordinate
  896.   #--------------------------------------------------------------------------
  897.   def initialize(x, y, width, height, columns = 1, spacing = 32)
  898.     super(x, y, width, height, columns)
  899.     @shop_goods = $game_temp.shop_goods
  900.     @columns = columns
  901.     refresh
  902.     self.index = 0
  903.   end
  904.   #--------------------------------------------------------------------------
  905.   # * Get Item
  906.   #--------------------------------------------------------------------------
  907.   def item
  908.     return @data[self.index]
  909.   end
  910.   #--------------------------------------------------------------------------
  911.   # * Refresh
  912.   #--------------------------------------------------------------------------
  913.   def refresh
  914.     @data = []
  915.     for goods_item in @shop_goods
  916.       case goods_item[0]
  917.       when 0
  918.         item = $data_items[goods_item[1]]
  919.       when 1
  920.         item = $data_weapons[goods_item[1]]
  921.       when 2
  922.         item = $data_armors[goods_item[1]]
  923.       end
  924.       if item != nil
  925.         @data.push(item)
  926.       end
  927.     end
  928.     @item_max = @data.size
  929.     create_contents
  930.     for i in 0...@item_max
  931.       draw_item(i)
  932.     end
  933.   end
  934.   #--------------------------------------------------------------------------
  935.   # * Draw Item
  936.   #     index : item number
  937.   #--------------------------------------------------------------------------
  938.   def draw_item(index)
  939.     item = @data[index]
  940.     number = $game_party.item_number(item)
  941.     enabled = (item.price <= $game_party.gold and number < 99)
  942.     rect = item_rect(index)
  943.     self.contents.clear_rect(rect)
  944.     draw_item_name(item, rect.x, rect.y, enabled)
  945.     rect.width -= 4
  946.     self.contents.draw_text(rect.x - 24, rect.y, rect.width, rect.height, item.price, 2)
  947.     if @columns > 1
  948.      draw_icon (ICY::ISS::Goldcon, rect.x + (rect.width - 24),rect.y, enabled)
  949.      else
  950.     self.draw_icon (ICY::ISS::Goldcon, rect.width - 24, rect.y, enabled)
  951.     end
  952.   end
  953.   #--------------------------------------------------------------------------
  954.   # * Help Text Update
  955.   #--------------------------------------------------------------------------
  956.   def update_help
  957.     @help_window.set_text(item == nil ? "" : item.description)
  958.   end
  959. end
  960.  
  961. #ICY_W1.10
  962. #==============================================================================
  963. # ** ICY_Window_SaveFile
  964. #------------------------------------------------------------------------------
  965. #  This window displays save files on the save and load screens.
  966. #==============================================================================
  967.  
  968. class ICY_Window_SaveFile < Window_Base
  969.   #--------------------------------------------------------------------------
  970.   # * Public Instance Variables
  971.   #--------------------------------------------------------------------------
  972.   attr_reader   :filename                 # filename
  973.   attr_reader   :file_exist               # file existence flag
  974.   attr_reader   :time_stamp               # timestamp
  975.   attr_reader   :selected                 # selected
  976.   #--------------------------------------------------------------------------
  977.   # * Object Initialization
  978.   #     file_index : save file index (0-3)
  979.   #     filename   : filename
  980.   #--------------------------------------------------------------------------
  981.   def initialize(file_index, filename)
  982.     super(20, 124, 504, 286)
  983.     @file_index = file_index
  984.     @filename = filename
  985.     load_gamedata
  986.     refresh
  987.     @selected = false
  988.   end
  989.   #--------------------------------------------------------------------------
  990.   # * Load Partial Game Data
  991.   #    By default, switches and variables are not used (for expansion use,
  992.   #    such as displaying place names)
  993.   #--------------------------------------------------------------------------
  994.   def load_gamedata
  995.     @time_stamp = Time.at(0)
  996.     @file_exist = FileTest.exist?(@filename)
  997.     if @file_exist
  998.       file = File.open(@filename, "r")
  999.       @time_stamp = file.mtime
  1000.       begin
  1001.         @characters     = Marshal.load(file)
  1002.         @frame_count    = Marshal.load(file)
  1003.         @last_bgm       = Marshal.load(file)
  1004.         @last_bgs       = Marshal.load(file)
  1005.         @game_system    = Marshal.load(file)
  1006.         @game_message   = Marshal.load(file)
  1007.         @game_switches  = Marshal.load(file)
  1008.         @game_variables = Marshal.load(file)
  1009.        
  1010.         @game_self_switches  = Marshal.load(file)
  1011.         @game_actors         = Marshal.load(file)
  1012.         @game_party          = Marshal.load(file)
  1013.         @game_troop          = Marshal.load(file)
  1014.         @game_map            = Marshal.load(file)
  1015.         @game_player         = Marshal.load(file)
  1016.    
  1017.         @total_sec = @frame_count / Graphics.frame_rate
  1018.        
  1019.         map_infos = load_data("Data/MapInfos.rvdata")
  1020.         mname = map_infos[@game_map.map_id].name.clone
  1021.         mname.gsub!(/\\N\[([0-9]+)\]/i) { $game_actors[$1.to_i].name }
  1022.         mname.gsub!(/\\PN\[([0-9]+)\]/i) { $game_party.members[$1.to_i].name }
  1023.         mname.gsub!(/\\V\[([0-9]+)\]/i) { $game_variables[$1.to_i] }
  1024.         @mapp_name = mname
  1025.      rescue
  1026.         @file_exist = false
  1027.       ensure
  1028.         file.close
  1029.       end
  1030.     end
  1031.   end
  1032.   #--------------------------------------------------------------------------
  1033.   # * Refresh
  1034.   #--------------------------------------------------------------------------
  1035.   def refresh
  1036.     self.contents.clear
  1037.     self.contents.font.color = normal_color
  1038.     self.contents.font.size = 18
  1039.     name = Vocab::File + " #{@file_index + 1}"
  1040.     self.contents.draw_text(28, 0, 200, WLH, name)
  1041.    
  1042.     @name_width = contents.text_size(name).width + 24
  1043.     if @file_exist
  1044.       draw_icon(100,0, 0, true)
  1045.       draw_party_characters(24, 58)
  1046.       draw_playtime(0, 34, contents.width - 4, 2)
  1047.       draw_money(32, self.height - 64)
  1048.       draw_map_name(32, self.height - 128)
  1049.    if $imported["ICY_Clan_System"] == true
  1050.       draw_party_name(246, self.height - 96)
  1051.      end
  1052.     else
  1053.       draw_icon(98,0, 0, true)
  1054.       self.contents.font.size = 64
  1055.       self.contents.draw_text((self.width / 3), (self.height / 3), 300, 64, "NO DATA", 0)
  1056.     end
  1057.   end
  1058.  
  1059.   def draw_party_name(x, y)
  1060.     if $imported["ICY_Clan_System"] == true
  1061.     icon = @game_party.get_party_icon
  1062.     icon = icon.to_i
  1063.     draw_icon(icon, x - 24, y, true)    
  1064.     self.contents.draw_text(x, y, 200, WLH, "Party Name : #{@game_party.get_party_name}")
  1065.     end
  1066.   end
  1067.  
  1068.   def draw_path_chosen(x, y)
  1069.     self.contents.font.size = 18
  1070.     self.contents.font.color = normal_color
  1071.     draw_icon(149,x - 24, y, true)
  1072.     if @game_switches[511]
  1073.      self.contents.draw_text(x, y, 200, WLH, "Story : 'Male Story'")
  1074.     elsif @game_switches[512]
  1075.       self.contents.draw_text(x, y, 200, WLH, "Story : 'Female Story'")
  1076.       else
  1077.       self.contents.draw_text(x, y, 200, WLH, "Story : 'Unknown'")
  1078.     end
  1079.     end
  1080.    
  1081.   def draw_map_name(x, y)
  1082.     draw_icon(2296, x - 24, y, true)
  1083.     self.contents.draw_text(x, y, 200, WLH, "Location : #{@mapp_name}")
  1084.   end
  1085.  
  1086.   def draw_money(x, y)
  1087.     draw_currency_value(@game_party.gold, x, y, 120)
  1088.     draw_icon(ICY::ISS::Goldcon, x - 24, y, true)
  1089.   end
  1090.   #--------------------------------------------------------------------------
  1091.   # * Draw Party Characters
  1092.   #     x : Draw spot X coordinate
  1093.   #     y : Draw spot Y coordinate
  1094.   #--------------------------------------------------------------------------
  1095.   def draw_party_characters(x, y)
  1096.     y_move = y
  1097.     chars_count = 0
  1098.     i2 = 0
  1099.     iset = 0
  1100.     for i in 0...@characters.size
  1101.       i2 = i
  1102.       i2 -= iset
  1103.       name = @characters[i][0]
  1104.       index = @characters[i][1]
  1105.       draw_character(name, index, x + i2 * 32, y_move)
  1106.       chars_count += 1
  1107.       if chars_count >= 5
  1108.       iset = i2 + 1
  1109.       y_move += 32
  1110.       end
  1111.     end
  1112.   end
  1113.   #--------------------------------------------------------------------------
  1114.   # * Draw Play Time
  1115.   #     x : Draw spot X coordinate
  1116.   #     y : Draw spot Y coordinate
  1117.   #     width : Width
  1118.   #     align : Alignment
  1119.   #--------------------------------------------------------------------------
  1120.   def draw_playtime(x, y, width, align)
  1121.     hour = @total_sec / 60 / 60
  1122.     min = @total_sec / 60 % 60
  1123.     sec = @total_sec % 60
  1124.     time_string = sprintf("%02d:%02d:%02d", hour, min, sec)
  1125.     self.contents.draw_text(x, y - 24 , width, WLH, "Play Time", 2)
  1126.     self.contents.font.color = ICY::Colors::LightGreen
  1127.     self.contents.draw_text(x, y, width, WLH, time_string, 2)
  1128.   end
  1129.   #--------------------------------------------------------------------------
  1130.   # * Set Selected
  1131.   #     selected : new selected (true = selected, false = unselected)
  1132.   #--------------------------------------------------------------------------
  1133.   def selected=(selected)
  1134.     @selected = selected
  1135.     update_cursor
  1136.   end
  1137.   #--------------------------------------------------------------------------
  1138.   # * Update cursor
  1139.   #--------------------------------------------------------------------------
  1140.   def update_cursor
  1141.     if @selected
  1142.       self.cursor_rect.set(0, 0, @name_width + 8, WLH)
  1143.     else
  1144.       self.cursor_rect.empty
  1145.     end
  1146.   end
  1147. end
  1148.  
  1149. class ICY_Window_Total_Saves < Window_Base
  1150.  
  1151.   #--------------------------------------------------------------------------
  1152.   # * Object Initialization
  1153.   #--------------------------------------------------------------------------
  1154.   def initialize(x, y, width, height, fontsize = 18)
  1155.     super(x, y, width, height)
  1156.     @fontsize = fontsize
  1157.   end
  1158.   #--------------------------------------------------------------------------
  1159.   # * Set Text
  1160.   #  text  : character string displayed in window
  1161.   #  align : alignment (0..flush left, 1..center, 2..flush right)
  1162.   #--------------------------------------------------------------------------
  1163.   def set_text(indexy, maxitw)
  1164.     if indexy != @indexy
  1165.       self.contents.clear
  1166.       self.contents.font.size = @fontsize
  1167.       self.contents.font.color = normal_color
  1168.       self.contents.draw_text(4, 0, self.width - 40, WLH, "Save #{indexy + 1} out of #{maxitw}", 1)
  1169.       @indexy = indexy
  1170.     end
  1171.   end
  1172.  
  1173. end
  1174.  
  1175. #ICY_W1.11
  1176. #==============================================================================
  1177. # ** ICY_Window_NameingActor
  1178. #------------------------------------------------------------------------------
  1179. #  This window is used to show the actor currently being named.
  1180. #==============================================================================
  1181. class ICY_Window_NM_Actor < Window_Base
  1182.  
  1183.   def initialize
  1184.     super(406, 148, 128, 248)
  1185.     @actor = $game_actors[$game_temp.name_actor_id]
  1186.     @index = 0
  1187.     refresh
  1188.   end
  1189.  
  1190.   def refresh
  1191.     self.contents.clear
  1192.     self.contents.draw_text(5, 50, 64, 32,"Class:", 0)
  1193.     self.contents.draw_text(5, 82, 96, 32,@actor.class.name, 0)
  1194.     self.draw_character(@actor.character_name, @actor.character_index, 32, 48)
  1195.   end
  1196.  
  1197. end
  1198.  
  1199. class ICY_Window_HelpEX < ICY_Window_Help
  1200.    
  1201.   def basic_setup
  1202.     set = $icy_rec["reclist"].retrieve
  1203.     @e1 = set.at(0)#Actor
  1204.     @e2 = set.at(1)#Type/Race
  1205.     @e3 = set.at(2)#Gender
  1206.     @e4 = set.at(3)#Class
  1207.     @e5 = set.at(4)#Is actor present
  1208.     @cost_calcu = 0
  1209.    
  1210.   if ICY::RCS::EXTRACOSTS
  1211.     if ICY::RCS::T_Cost == true
  1212.     type_costs  = ICY::RCS::TYPESCOST
  1213.     @type_cost  = type_costs[@e2]
  1214.     end
  1215.     if ICY::RCS::G_Cost == true
  1216.     gen_costs   = ICY::RCS::GENDERSCOST
  1217.      @gen_cost   = gen_costs[@e3]
  1218.      end
  1219.     if ICY::RCS::C_Cost == true
  1220.     class_costs = ICY::RCS::REC_CLASS_COST
  1221.     class_id    = $icy_rec["classwin"].class_grab
  1222.     @class_cost = class_costs[class_id.id]
  1223.     end    
  1224.   end
  1225. end
  1226.  
  1227.   def set_rec_text
  1228.     basic_setup
  1229.     main_y = 18
  1230.     main_x = 100
  1231.    
  1232.      self.contents.clear
  1233.      self.contents.font.size = (@fontsize + 1)
  1234.      self.contents.font.color = normal_color
  1235.   if @e5
  1236.      self.contents.draw_text(0, 4, self.width - 40, WLH, @e1.name)
  1237.      self.contents.draw_text(main_x, main_y, self.width - 40, WLH, "#{ICY::RCS_Vocab::TYPEWIN}: #{@e2}")
  1238.      self.contents.draw_text(main_x, (main_y * 2), self.width - 40, WLH, "#{ICY::RCS_Vocab::GENWIN}: #{@e3}")
  1239.      self.contents.draw_text(main_x, (main_y * 3), self.width - 40, WLH, "#{ICY::RCS_Vocab::CLSWIN}: #{@e4}")
  1240.      self.contents.draw_text(main_x, (main_y * 4), self.width - 40, WLH, ICY::RCS_Vocab::RECCOSTTEXT)
  1241.      self.contents.font.color = ICY::Colors::LightCoral
  1242.      self.contents.draw_text(main_x, (main_y * 5), self.width - 40, WLH, ICY::RCS_Vocab::TOTACOST)
  1243.      self.contents.font.color = normal_color
  1244.      
  1245.      if ICY::RCS::EXTRACOSTS
  1246.        if ICY::RCS::T_Cost
  1247.          draw_currency_value(@type_cost, main_x * 2, main_y, 120)
  1248.          @cost_calcu += @type_cost
  1249.        end
  1250.        if ICY::RCS::G_Cost
  1251.         draw_currency_value(@gen_cost, main_x * 2, (main_y * 2), 120)
  1252.         @cost_calcu += @gen_cost
  1253.        end
  1254.        if ICY::RCS::C_Cost
  1255.         draw_currency_value(@class_cost, main_x * 2, (main_y * 3), 120)
  1256.         @cost_calcu += @class_cost
  1257.        end
  1258.       end
  1259.        draw_currency_value(ICY::RCS::RECCOST, main_x * 2, (main_y * 4), 120)
  1260.        @cost_calcu += ICY::RCS::RECCOST  
  1261.        draw_currency_value(@cost_calcu, main_x * 2, (main_y * 5), 120)
  1262.        
  1263.      self.draw_character(@e1.character_name, @e1.character_index, 32, 64)
  1264.      self.draw_icon(101, 0, (main_y * 4), true)
  1265.      self.contents.font.color = ICY::Colors::LightGreen
  1266.      self.contents.draw_text(24, (main_y * 4), self.width - 40, WLH, "LV : #{@e1.level}")
  1267.    else
  1268.      self.contents.font.color = ICY::Colors::Red
  1269.     self.contents.draw_text(0, 4, self.width - 40, WLH, "No One")
  1270.   end
  1271.  end
  1272.      
  1273. end
  1274.  
  1275. #==============================================================================
  1276. # ** Scene_Recruit
  1277. #------------------------------------------------------------------------------
  1278. #  This class brings up the recruitment scene.
  1279. #==============================================================================
  1280. class Scene_Recruit < Scene_Base
  1281. #------------------------------------------------------------------------------
  1282. # ** Perform_Transition
  1283. #------------------------------------------------------------------------------  
  1284.   def perform_transition
  1285.     Graphics.transition(30)
  1286.   end
  1287. #------------------------------------------------------------------------------
  1288. # ** Start
  1289. #------------------------------------------------------------------------------
  1290.   def start
  1291.     super
  1292.     create_menu_background
  1293.     create_systemstuff
  1294.     @gold_window = ICY_Window_Gold.new(346, 6)
  1295.     @help_window = ICY_Window_Help.new(272, 266, 254, 64)
  1296.     @recruit_window = Window_Base.new(0, 0, 320, 64)
  1297.     @recruit_window.contents.draw_text(25, 0, (@recruit_window.width / 2), 32,"Recruitment!",1)
  1298.     @recruit_window.draw_icon(2, 0, 0, true)
  1299.     create_list_windows
  1300.     @icy_win["statshelp"] = ICY_Window_HelpEX.new(180, @ji_y, (@jiwidth * 2), @jiheight)
  1301.     @help_window.set_text("......")
  1302.     create_headers
  1303.     create_confirms
  1304.     create_main_commands
  1305.     create_recruiting_windows
  1306.     set_visibility
  1307.     set_active
  1308.     set_help_windows
  1309.   end
  1310.  
  1311.   def create_systemstuff
  1312.     @switchinsnd = RPG::SE.new(ICY::RCS::TABSND)
  1313.     @win_slides = false
  1314.     @icy_wins = false
  1315.     @icy_stat = false
  1316.     @icy_rec = {}
  1317.     $icy_rec = {}
  1318.     @icy_header = {}
  1319.     @icy_win = {}
  1320.     @jiwidth = 180
  1321.     @jiheight = 160
  1322.     @ji_y = 96
  1323.     @windowgrap = ""
  1324.   end
  1325.  
  1326.   def create_list_windows
  1327.     @icy_rec["racewin"] = ICY_Recruit_ListWins.new(0, @ji_y, @jiwidth, @jiheight, ICY::RCS::TYPES, ICY::RCS_HELPS::RACEHELP, ICY::RCS::TYPESCON)
  1328.     @icy_rec["genwin"]  = ICY_Recruit_ListWins.new(180, @ji_y, @jiwidth, @jiheight,ICY::RCS::GENDERS, ICY::RCS_HELPS::GENDERHELP, ICY::RCS::GENDERSCON)
  1329.     $icy_rec["classwin"]= ICY_Rec_Classwin.new(360, @ji_y, @jiwidth, @jiheight)
  1330.     $icy_rec["reclist"] = ICY_Rec_List.new(0, @ji_y, @jiwidth, @jiheight)
  1331.   end
  1332.  
  1333. #------------------------------------------------------------------------------
  1334. # ** Set_Windows
  1335. #------------------------------------------------------------------------------  
  1336.   def set_help_windows
  1337.     $icy_rec["classwin"].help_window = @help_window
  1338.     @icy_rec["genwin"].help_window = @help_window
  1339.     @icy_rec["racewin"].help_window = @help_window
  1340.     $icy_rec["reclist"].help_window = @icy_win["statshelp"]
  1341.   end
  1342. #------------------------------------------------------------------------------
  1343. # ** Set_Active_Windows
  1344. #------------------------------------------------------------------------------  
  1345.   def set_active
  1346.     #Active
  1347.     @icy_rec["racewin"].active = false
  1348.     @icy_rec["genwin"].active = false
  1349.     $icy_rec["classwin"].active = false
  1350.     $icy_rec["reclist"].active = false
  1351.   end
  1352. #------------------------------------------------------------------------------
  1353. # ** Set_Visibility
  1354. #------------------------------------------------------------------------------  
  1355.   def set_visibility
  1356.     #Visible
  1357.     @icy_rec["racewin"].visible = false
  1358.     @icy_rec["genwin"].visible = false
  1359.     $icy_rec["classwin"].visible = false
  1360.     $icy_rec["reclist"].visible = false
  1361.     @icy_header["race"].visible = false
  1362.     @icy_header["gender"].visible = false  
  1363.     @icy_header["class"].visible = false
  1364.     @icy_win["statshelp"].visible = false
  1365.   end
  1366. #------------------------------------------------------------------------------
  1367. # ** Create_Recruit Commands
  1368. #------------------------------------------------------------------------------  
  1369. def create_recruiting_windows
  1370.    y1 = ICY::RCS_Vocab::CONFCON
  1371.    y2 = ICY::RCS_Vocab::CANCCON
  1372.    z1 = ICY::RCS_Vocab::CONFIRM
  1373.    z2 = ICY::RCS_Vocab::CANCEL
  1374.    concoso = {z1 => y1, z2 => y2}
  1375.    @icy_win["crecruit"] = ICY_Window_Command.new(254 , [z1, z2], concoso, ICY::RCS_Fonts::FONTSIZE, 2)
  1376.    @icy_win["crecruit"].x = 266
  1377.    @icy_win["crecruit"].y = 352
  1378.    @icy_win["crecruit"].active = false
  1379.    @icy_win["crecruit"].visible = false  
  1380.  end
  1381.  
  1382. #------------------------------------------------------------------------------
  1383. #** Main command window
  1384. #------------------------------------------------------------------------------
  1385.  def create_main_commands
  1386.    i1 = ICY::RCS::SETUPCON
  1387.    i2 = ICY::RCS::RECUCON
  1388.    i3 = ICY::RCS::LEAVECON
  1389.    s1 = ICY::RCS_Vocab::SETTEXT
  1390.    s2 = ICY::RCS_Vocab::RECTEXT
  1391.    s3 = ICY::RCS_Vocab::CANCELTEXT
  1392.    iconso = {s1 => i1, s2 => i2, s3 => i3}
  1393.    @storage_commands = ICY_Window_Command.new(254, [s1, s2, s3], iconso, ICY::RCS_Fonts::FONTSIZE)
  1394.    @storage_commands.x = 0
  1395.    @storage_commands.y = 266
  1396.    @storage_commands.help_window = @help_window
  1397.  end
  1398. #------------------------------------------------------------------------------
  1399. # ** Create_Confirm_Window
  1400. #------------------------------------------------------------------------------
  1401.  def create_confirms
  1402.    cp1 = "Yes recruit this"
  1403.    cp2 = "No don't recruit"
  1404.    @icy_win["confirm"] = Window_Command.new(382, [cp1, cp2], 2)
  1405.    @icy_win["confirm"].x = ((544 / 2)- (@icy_win["confirm"].width / 2))
  1406.    @icy_win["confirm"].y = (416 / 2)
  1407.    @icy_win["confirm"].active = false
  1408.    @icy_win["confirm"].visible = false
  1409.  end
  1410. #------------------------------------------------------------------------------
  1411. # ** Create_Headers
  1412. #------------------------------------------------------------------------------
  1413.   def create_headers
  1414.     @icy_header["race"] = ICY_Window_Base.new(16 , (@ji_y -48) , (@jiwidth -32), 64, ICY::RCS_Fonts::HEADERFONTSIZE)
  1415.     @icy_header["gender"] = ICY_Window_Base.new(196 , (@ji_y -48) , (@jiwidth -32), 64, ICY::RCS_Fonts::HEADERFONTSIZE)
  1416.     @icy_header["class"] = ICY_Window_Base.new(376 , (@ji_y -48) , (@jiwidth -32), 64, ICY::RCS_Fonts::HEADERFONTSIZE)
  1417.     @icy_header["race"].icy_draw_text(24 , 0, @jiwidth, 24, ICY::RCS_Vocab::TYPEWIN, 0, ICY::RCS_Fonts::HEADERFONT)
  1418.     @icy_header["gender"].icy_draw_text(24 , 0, @jiwidth, 24, ICY::RCS_Vocab::GENWIN, 0, ICY::RCS_Fonts::HEADERFONT)
  1419.     @icy_header["class"].icy_draw_text(24 , 0, @jiwidth, 24, ICY::RCS_Vocab::CLSWIN, 0, ICY::RCS_Fonts::HEADERFONT)
  1420.     @icy_header["race"].opacity = 0
  1421.     @icy_header["gender"].opacity = 0
  1422.     @icy_header["class"].opacity = 0
  1423.   end
  1424. #------------------------------------------------------------------------------
  1425. #------------------------------------------------------------------------------
  1426. #------------------------------------------------------------------------------
  1427. # ** Update_Help
  1428. #------------------------------------------------------------------------------
  1429.  def update_help
  1430.    
  1431.    case @storage_commands.index
  1432.    when 0
  1433.       @help_window.set_text("Set up")
  1434.    when 1
  1435.       @help_window.set_text("Recruit")
  1436.    when 2
  1437.       @help_window.set_text(ICY::RCS_Vocab::CANCELTEXT)
  1438.       end
  1439.     end
  1440. #------------------------------------------------------------------------------
  1441. # ** Update Imagery
  1442. #------------------------------------------------------------------------------
  1443.   def update_imagery
  1444.      @icy_win["statshelp"].set_rec_text
  1445.    end
  1446.    
  1447. #------------------------------------------------------------------------------
  1448. # ** Update Help
  1449. #------------------------------------------------------------------------------  
  1450.   def update_confirmhelp
  1451.     case @icy_win["crecruit"].index
  1452.    when 0
  1453.       @help_window.set_text("Recruit this person")
  1454.    when 1
  1455.       @help_window.set_text("Quit Recruiting")
  1456.     end
  1457.   end
  1458. #------------------------------------------------------------------------------
  1459. # ** Command_Setup
  1460. #------------------------------------------------------------------------------
  1461.   def command_setup
  1462.     Sound.play_decision
  1463.     @storage_commands.opacity = ICY::RCS::OPAC
  1464.     @storage_commands.active = false
  1465.     @icy_rec["racewin"].active = true
  1466.     @icy_rec["genwin"].active = false
  1467.     $icy_rec["classwin"].active = false
  1468.     @icy_rec["racewin"].visible = true
  1469.     @icy_rec["genwin"].visible = true
  1470.     $icy_rec["classwin"].visible = true
  1471.     @icy_header["race"].visible = true
  1472.     @icy_header["gender"].visible = true  
  1473.     @icy_header["class"].visible = true
  1474.     @icy_wins = true
  1475.   end
  1476. #------------------------------------------------------------------------------
  1477. # ** Command_Recruit
  1478. #------------------------------------------------------------------------------
  1479. def command_recruit
  1480.   @icy_stat = true
  1481.   @storage_commands.opacity = ICY::RCS::OPAC
  1482.   drace = @icy_rec["racewin"].rtc
  1483.   dgen  = @icy_rec["genwin"].rtc
  1484.   dclas = $icy_rec["classwin"].rtc
  1485.   $icy_rec["reclist"].getrecs(drace, dgen, dclas)
  1486.   $icy_rec["reclist"].refresh
  1487.   @storage_commands.active = false
  1488.   $icy_rec["reclist"].index = 0
  1489.   $icy_rec["reclist"].active = true
  1490.   $icy_rec["reclist"].visible = true
  1491.   @icy_win["crecruit"].active = true
  1492.   @icy_win["crecruit"].visible = true
  1493.   @icy_win["statshelp"].contents.clear
  1494.   @icy_win["statshelp"].set_rec_text
  1495.   @icy_win["statshelp"].visible = true
  1496.   @icy_win["confirm"].active = false
  1497.   @icy_win["confirm"].visible = false
  1498. end
  1499.  
  1500. #------------------------------------------------------------------------------
  1501. # ** Cancel Recruit
  1502. #------------------------------------------------------------------------------
  1503.  def no_rec
  1504.    Sound.play_cancel
  1505.    @icy_win["confirm"].active = false
  1506.    @icy_win["confirm"].visible = false
  1507.    @icy_win["crecruit"].active = true
  1508.    @icy_win["crecruit"].opacity = 255
  1509.   end
  1510. #------------------------------------------------------------------------------
  1511. # ** Recruit Go back
  1512. #------------------------------------------------------------------------------
  1513. def rec_go_back
  1514.     Sound.play_cancel
  1515.     @storage_commands.opacity = 255
  1516.     @icy_wins = false
  1517.     @icy_rec["racewin"].active = false
  1518.     @icy_rec["genwin"].active = false
  1519.     $icy_rec["classwin"].active = false
  1520.     @icy_rec["racewin"].visible = false
  1521.     @icy_rec["genwin"].visible = false
  1522.     $icy_rec["classwin"].visible = false
  1523.     @icy_header["race"].visible = false
  1524.     @icy_header["gender"].visible = false  
  1525.     @icy_header["class"].visible = false
  1526.     @storage_commands.active = true
  1527.   end
  1528.  
  1529. #------------------------------------------------------------------------------
  1530. # ** Status Go back
  1531. #------------------------------------------------------------------------------
  1532. def stat_go_back
  1533.     Sound.play_cancel
  1534.     @storage_commands.opacity = 255
  1535.     @icy_stat = false
  1536.     $icy_rec["reclist"].active = false
  1537.     $icy_rec["reclist"].visible = false
  1538.     @icy_win["crecruit"].active = false
  1539.     @icy_win["crecruit"].visible = false
  1540.     @icy_win["statshelp"].visible = false
  1541.     @icy_win["confirm"].visible = false
  1542.     @icy_win["confirm"].active = false
  1543.     @storage_commands.active = true
  1544. end
  1545. #------------------------------------------------------------------------------
  1546. # ** Confirm Recruit
  1547. #------------------------------------------------------------------------------  
  1548. def command_takeon
  1549.    @icy_win["confirm"].active = true
  1550.    @icy_win["confirm"].visible = true
  1551.    @icy_win["crecruit"].active = false
  1552.    @icy_win["crecruit"].opacity = ICY::RCS::OPAC
  1553. end
  1554. #------------------------------------------------------------------------------
  1555. # ** Close_down
  1556. #------------------------------------------------------------------------------
  1557. def close_down
  1558.    Sound.play_cancel
  1559.    Graphics.freeze
  1560.    @gold_window.dispose
  1561.    @help_window.dispose
  1562.    @recruit_window.dispose
  1563.    @storage_commands.dispose
  1564.    $icy_rec["reclist"].dispose
  1565.    @icy_rec["racewin"].dispose
  1566.    @icy_rec["genwin"].dispose
  1567.    $icy_rec["classwin"].dispose
  1568.    @icy_header["race"].dispose
  1569.    @icy_header["gender"].dispose  
  1570.    @icy_header["class"].dispose
  1571.    @icy_win["crecruit"].dispose
  1572.    @icy_win["statshelp"].dispose
  1573.    @icy_win["confirm"].dispose
  1574.    $game_player.refresh
  1575.    $game_map.refresh
  1576.    $scene = Scene_Map.new
  1577.  end
  1578.  
  1579. #------------------------------------------------------------------------------
  1580. #------------------------------------------------------------------------------
  1581. #------------------------------------------------------------------------------
  1582. # ** Update
  1583. #------------------------------------------------------------------------------
  1584. #------------------------------------------------------------------------------
  1585. #------------------------------------------------------------------------------
  1586. def update
  1587.   super
  1588.   @icy_win["statshelp"].update
  1589.   @icy_rec["racewin"].update
  1590.   $icy_rec["classwin"].update
  1591.   @icy_rec["genwin"].update
  1592.   @storage_commands.update
  1593.   @icy_win["crecruit"].update
  1594.   @icy_win["confirm"].update
  1595.   $icy_rec["reclist"].update
  1596. #----------------------------------------------------------------------------
  1597. # ** Confirm
  1598. #----------------------------------------------------------------------------
  1599.   if @icy_win["confirm"].active and not @storage_commands.active
  1600.    update_help
  1601.     if Input.trigger?(Input::C)
  1602.       case @icy_win["confirm"].index
  1603.       when 0
  1604.         final_setup
  1605.       when 1
  1606.         no_rec
  1607.       end
  1608.     end
  1609.     end
  1610. #----------------------------------------------------------------------------
  1611. # ** Main Command Window
  1612. #----------------------------------------------------------------------------
  1613.   if @storage_commands.active and not @icy_win["confirm"].active == true or not @icy_stat == true
  1614.    update_help
  1615.     if Input.trigger?(Input::C)
  1616.       case @storage_commands.index
  1617.       when 0
  1618.         command_setup
  1619.       when 1
  1620.         command_recruit
  1621.       when 2
  1622.        close_down
  1623.       end
  1624.     end
  1625. #----------------------------------------------------------------------------
  1626. # ** Recruit Command Window
  1627. #----------------------------------------------------------------------------  
  1628. elsif @icy_win["crecruit"].active == true and not @storage_commands.active or not @icy_stat == true
  1629.    if Input.trigger?(Input::C)
  1630.     case @icy_win["crecruit"].index
  1631.       when 0
  1632.         command_takeon
  1633.       when 1
  1634.         stat_go_back
  1635.       end
  1636.     end
  1637.   end
  1638.  
  1639. #------------------------------------------------------------------------------
  1640. # ** Update Cancelling
  1641. #------------------------------------------------------------------------------
  1642.     if Input.trigger?(Input::B)
  1643.       if @icy_stat == true and not @icy_win["confirm"].active
  1644.         stat_go_back
  1645.       elsif @icy_wins == true and not @icy_win["confirm"].active
  1646.         rec_go_back
  1647.       elsif @icy_win["confirm"].active == true and not @storage_commands.active
  1648.         no_rec
  1649.       else
  1650.         close_down
  1651.      end
  1652.    end
  1653. #------------------------------------------------------------------------------
  1654. # ** Update Commands
  1655. #------------------------------------------------------------------------------
  1656.   if @icy_stat
  1657.     if Input.repeat?(Input::UP) or Input.repeat?(Input::DOWN)
  1658.     update_imagery
  1659.     end
  1660.     update_confirmhelp
  1661.   end
  1662.  
  1663.   if @icy_wins
  1664.    if Input.trigger?(Input::RIGHT)
  1665.     @switchinsnd.play
  1666.     if @icy_rec["racewin"].active
  1667.       @icy_rec["genwin"].active = true
  1668.       @icy_rec["racewin"].active = false  
  1669.    
  1670.   elsif @icy_rec["genwin"].active
  1671.      $icy_rec["classwin"].active = true
  1672.     @icy_rec["genwin"].active = false
  1673.  
  1674.   elsif $icy_rec["classwin"].active
  1675.     @icy_rec["racewin"].active = true
  1676.     $icy_rec["classwin"].active = false
  1677.     end
  1678.   end
  1679.  
  1680.   if Input.trigger?(Input::LEFT)
  1681.     @switchinsnd.play
  1682.     if @icy_rec["racewin"].active
  1683.       $icy_rec["classwin"].active = true
  1684.       @icy_rec["racewin"].active = false  
  1685.    
  1686.   elsif @icy_rec["genwin"].active
  1687.      @icy_rec["racewin"].active = true
  1688.     @icy_rec["genwin"].active = false
  1689.  
  1690.   elsif $icy_rec["classwin"].active
  1691.     @icy_rec["genwin"].active = true
  1692.     $icy_rec["classwin"].active = false
  1693.     end
  1694.   end
  1695.   @help_window.update
  1696. end
  1697.  
  1698. end
  1699.  
  1700.  
  1701. #------------------------------------------------------------------------------
  1702. # ** Command_Recruit
  1703. #------------------------------------------------------------------------------
  1704. def cost_calculate
  1705.    set = $icy_rec["reclist"].retrieve
  1706.     @e1 = set.at(0)#Actor
  1707.     @e2 = set.at(1)#Type/Race
  1708.     @e3 = set.at(2)#Gender
  1709.     @e4 = set.at(3)#Class
  1710.     @e5 = set.at(4)#Is actor present
  1711.     @cost_calcu = 0
  1712.    
  1713.    if ICY::RCS::EXTRACOSTS
  1714.     type_costs  = ICY::RCS::TYPESCOST
  1715.     gen_costs   = ICY::RCS::GENDERSCOST
  1716.     class_costs = ICY::RCS::REC_CLASS_COST
  1717.     class_id    = $icy_rec["classwin"].class_grab
  1718.     @type_cost  = type_costs[@e2]
  1719.     @gen_cost   = gen_costs[@e3]
  1720.     @class_cost = class_costs[class_id.id]
  1721.        if ICY::RCS::T_Cost
  1722.         @cost_calcu += @type_cost
  1723.        end
  1724.        if ICY::RCS::G_Cost
  1725.         @cost_calcu += @gen_cost
  1726.        end
  1727.        if ICY::RCS::C_Cost
  1728.         @cost_calcu += @class_cost
  1729.       end
  1730.      
  1731.     end
  1732.       @cost_calcu += ICY::RCS::RECCOST
  1733.       return @cost_calcu
  1734. end
  1735.  
  1736. def final_setup
  1737.   rec_cost = cost_calculate
  1738.   if rec_cost > $game_party.gold
  1739.     Sound.play_buzzer
  1740.   else
  1741.   $game_party.lose_gold(@cost_calcu)
  1742.   set = $icy_rec["reclist"].retrieve
  1743.   actor_id = set.at(0)
  1744.   actor_id = actor_id.id
  1745.   class_id = $icy_rec["classwin"].class_grab
  1746.   class_id = class_id.id
  1747.   add_actor(actor_id)
  1748.   change_class(actor_id, class_id)
  1749.   name_recruit(actor_id)
  1750.   end
  1751. end
  1752.  
  1753. def add_actor(actor_id)
  1754.     $game_party.add_actor(actor_id)  
  1755.     $game_player.refresh
  1756. end
  1757.  
  1758. def change_class(actor_id, dclass_id)
  1759.   actor = $game_actors[actor_id]
  1760.   Sound.play_equip
  1761.   actor.class_id = dclass_id
  1762. end  
  1763.  
  1764. def name_recruit(actor_id)
  1765.    $game_temp.next_scene = "name"
  1766.    $game_temp.name_actor_id = actor_id
  1767.    $game_temp.name_max_char = ICY::RCS::NAME_CHAR_LIMIT
  1768.    $game_temp.next_scene = nil
  1769.    $scene = Scene_ICY_Name.new
  1770. end
  1771.      
  1772. def icy_change_level(actor_id)
  1773.     actor = $game_actors[actor_id]
  1774.     actor.change_level(actor.level + value, false)
  1775. end
  1776.    
  1777. end#End Main Class
  1778. ################################################################################
  1779. #------------------------------------------------------------------------------
  1780. #------------------------------------------------------------------------------
  1781. #==============================================================================
  1782. # ** ICY_Recruit_ListWins
  1783. #------------------------------------------------------------------------------
  1784. #  This window displays a list items formed from an array. It has icons and help.
  1785. #==============================================================================
  1786. class ICY_Recruit_ListWins < Window_Selectable
  1787.  
  1788.  def initialize(x, y, width, height, mainarray, helparray, iconarray)
  1789.     super(x, y, width, height)
  1790.     @back = Sprite.new
  1791.     self.index = 0
  1792.     self.contents = Bitmap.new(width-32, height-32)
  1793.     @column_max = 1
  1794.     @mainarray = mainarray
  1795.     @helparray = helparray
  1796.     @iconij = iconarray
  1797.     @item_max = @mainarray.size
  1798.     refresh
  1799.   end
  1800. #------------------------------------------------------------------------------
  1801. # ** Refresh
  1802. #------------------------------------------------------------------------------  
  1803.   def refresh
  1804.     create_contents
  1805.     self.contents.clear
  1806.    
  1807.       @commands = @mainarray
  1808.      
  1809.       for i in 0...@commands.size
  1810.         command = @mainarray[i]
  1811.         @icon = @iconij[command]
  1812.         if @icon == nil
  1813.           @icon = @iconij[0]
  1814.         end
  1815.        icy_draw_item_name(i, @icon, 0)
  1816.         end
  1817.        @item_max = @commands.size
  1818.     end
  1819.    
  1820.      def icy_draw_item_name(index, icon_index, x, enabled = true)
  1821.       rect = item_rect(index)
  1822.       rect.x += 24
  1823.       rect.width -= 8
  1824.       draw_icon(icon_index, x, rect.y, enabled)
  1825.       self.contents.clear_rect(rect)
  1826.       self.contents.font.name = ICY::RCS_Fonts::DEFAULTFONT
  1827.       self.contents.font.size = ICY::RCS_Fonts::SELFONTSIZE
  1828.       self.contents.font.color = normal_color
  1829.       self.contents.font.color.alpha = enabled ? 255 : 128
  1830.       self.contents.draw_text(rect, @commands[index])
  1831.     end
  1832.    
  1833.     #Retrive current command
  1834.   def rtc
  1835.     hindex = self.index
  1836.     rtcmd = @commands[hindex]
  1837.     return rtcmd
  1838.   end
  1839.  
  1840.       def update_help
  1841.        hindex = self.index
  1842.        nume = @mainarray[hindex]
  1843.        help = @helparray[nume]
  1844.        @help_window.set_text(help)
  1845.       end
  1846. end
  1847. ################################################################################
  1848. #==============================================================================
  1849. # ** ICY_Rec_Classwin
  1850. #------------------------------------------------------------------------------
  1851. #  This window displays the classes.
  1852. #==============================================================================
  1853. class ICY_Rec_Classwin < Window_Selectable
  1854.  
  1855.  def initialize(x, y, width, height)
  1856.     super(x, y, width, height)
  1857.     @back = Sprite.new
  1858.     self.index = 0
  1859.     self.contents = Bitmap.new(width-32, height-32)
  1860.     @column_max = 1
  1861.     @classes = []
  1862.     @classnums = []
  1863.     @class = ICY::RCS::REC_CLASSES
  1864.     @classhelp = ICY::RCS_HELPS::CLASSHELP
  1865.     @item_max = @class.size
  1866.     refresh
  1867.   end  
  1868. #------------------------------------------------------------------------------
  1869. # ** Refresh
  1870. #------------------------------------------------------------------------------  
  1871.   def refresh
  1872.     create_contents
  1873.     self.contents.clear
  1874.    
  1875.     for c in 0...@class.size
  1876.       @recla = @class.at(c)
  1877.       @iclas = $data_classes[@recla]
  1878.       @classnums[c] = @iclas
  1879.       @classes[c] = @iclas.name
  1880.     end
  1881.       @commands = @classes
  1882.       self.contents.clear
  1883.       @iconij = ICY::RCS::REC_CLASS_CONS
  1884.      
  1885.     for i in 0...@commands.size
  1886.         command = @class[i]
  1887.         @icon = @iconij[command]
  1888.         if @icon == nil
  1889.           @icon = @iconij[0]
  1890.         end
  1891.        icy_draw_item_name(i, @icon, 0)
  1892.         end
  1893.        @item_max = @commands.size
  1894.     end
  1895.    
  1896.      def icy_draw_item_name(index, icon_index, x, enabled = true)
  1897.       rect = item_rect(index)
  1898.       rect.x += 24
  1899.       rect.width -= 8
  1900.       draw_icon(icon_index, x, rect.y, enabled)
  1901.       self.contents.clear_rect(rect)
  1902.       self.contents.font.name = ICY::RCS_Fonts::DEFAULTFONT
  1903.       self.contents.font.size = ICY::RCS_Fonts::SELFONTSIZE
  1904.       self.contents.font.color = normal_color
  1905.       self.contents.font.color.alpha = enabled ? 255 : 128
  1906.       self.contents.draw_text(rect, @commands[index])
  1907.     end
  1908.    
  1909.     #Retrive current command
  1910.   def rtc
  1911.     hindex = self.index
  1912.     rtcmd = @commands[hindex]
  1913.     return rtcmd
  1914.   end
  1915.  
  1916.   def class_grab
  1917.     clsgrb = @classnums[self.index]
  1918.     return clsgrb
  1919.   end
  1920.  
  1921.       def update_help
  1922.        hindex = self.index
  1923.        declass = @class[hindex]
  1924.        help = @classhelp[declass]
  1925.        @help_window.set_text(help)
  1926.       end
  1927.     end
  1928.    
  1929. #==============================================================================
  1930. # ** ICY_Recruit_List
  1931. #------------------------------------------------------------------------------
  1932. #  This window displays a list of recruits.
  1933. #==============================================================================
  1934. class ICY_Rec_List < Window_Selectable
  1935.   #--------------------------------------------------------------------------
  1936.   # * Object Initialization
  1937.   #     x      : window x-coordinate
  1938.   #     y      : window y-coordinate
  1939.   #     width  : window width
  1940.   #     height : window height
  1941.   #--------------------------------------------------------------------------
  1942.   def initialize(x, y, width, height)
  1943.     super(x, y, width, height)
  1944.     @back = Sprite.new
  1945.     self.index = 0
  1946.     self.contents = Bitmap.new(width-32, height-32)
  1947.     @column_max = 1
  1948.     @stuff = ICY::RCS::RECRUITS
  1949.     @recinfo = ICY::RCS::RECRUIT_INFO
  1950.     @item_max = @stuff.size
  1951.     @actors = $game_party.members
  1952.   end
  1953.    
  1954.   def getrecs(drace, dgender ,dclass)
  1955.     @currentrace = drace
  1956.     @currentgender = dgender
  1957.     @assignclass = dclass
  1958.   end
  1959. #------------------------------------------------------------------------------
  1960. # ** Refresh
  1961. #------------------------------------------------------------------------------  
  1962. def refresh
  1963.     create_contents
  1964.     self.contents.clear
  1965.     item = []
  1966.     @commands = []
  1967.     @names = []
  1968.     @repcru = []
  1969.     @stuff = @stuff.compact
  1970.        
  1971.     for c in 0...@stuff.size
  1972.       recru = @stuff.at(c)
  1973.       arecru = $game_actors[recru]
  1974.       if @recinfo[recru].include?(@currentrace) and @recinfo[recru].include?(@currentgender) and not @actors.include?(arecru)
  1975.       @recui = @stuff.at(c)
  1976.       @inpi = $game_actors[@recui]
  1977.       @repcru[c] = @inpi
  1978.       @names[c] = @inpi.name
  1979.      end
  1980.    end
  1981.     if @names == nil
  1982.       @names["None"]
  1983.     end
  1984.     @names = @names.compact
  1985.     @repcru = @repcru.compact
  1986.     @item_max = @names.size
  1987.     @commands = @names
  1988.     self.contents = Bitmap.new(width - 32, height - 32)
  1989.       self.contents.clear
  1990.       create_contents
  1991.      
  1992.       for i in 0...@commands.size
  1993.         command = @commands[i]
  1994.        icy_draw_item_name(i, 101, 0)
  1995.       end
  1996.       @item_max = @commands.size
  1997.     end
  1998.  
  1999.   def icy_draw_item_name(index, icon_index, x, enabled = true)
  2000.       rect = item_rect(index)
  2001.       rect.x += 24
  2002.       rect.width -= 8
  2003.       draw_icon(icon_index, x, rect.y, enabled)
  2004.       self.contents.clear_rect(rect)
  2005.       self.contents.font.name = ICY::RCS_Fonts::DEFAULTFONT
  2006.       self.contents.font.size = ICY::RCS_Fonts::SELFONTSIZE
  2007.       self.contents.font.color = normal_color
  2008.       self.contents.font.color.alpha = enabled ? 255 : 128
  2009.       self.contents.draw_text(rect, @commands[index])
  2010.     end
  2011.  
  2012.     def retrieve
  2013.      nui = @repcru.at(self.index)
  2014.     if nui != nil
  2015.       goed = true
  2016.     else
  2017.       goed = false
  2018.     end
  2019.      set = [nui, @currentrace, @currentgender, @assignclass, goed]
  2020.      set = set.compact
  2021.      return set
  2022.    end
  2023.    
  2024. end
  2025. ################################################################################
  2026. #==============================================================================
  2027. # ** Scene_Name
  2028. #------------------------------------------------------------------------------
  2029. #  This class performs name input screen processing.
  2030. #==============================================================================
  2031.  
  2032. class Scene_ICY_Name < Scene_Base
  2033.   #--------------------------------------------------------------------------
  2034.   # * Start processing
  2035.   #--------------------------------------------------------------------------
  2036.   def start
  2037.     super
  2038.     @actor = $game_actors[$game_temp.name_actor_id]
  2039.     @edit_window = ICY_Window_NameEdit.new(@actor, $game_temp.name_max_char)
  2040.     @input_window = ICY_Window_NameInput.new
  2041.     @actor_window = ICY_Window_NM_Actor.new
  2042.   end
  2043.   #--------------------------------------------------------------------------
  2044.   # * Termination Processing
  2045.   #--------------------------------------------------------------------------
  2046.   def terminate
  2047.     super
  2048.     @edit_window.dispose
  2049.     @input_window.dispose
  2050.     @actor_window.dispose
  2051.   end
  2052.  
  2053.   #--------------------------------------------------------------------------
  2054.   # * Return to Original Screen
  2055.   #--------------------------------------------------------------------------
  2056.   def return_scene
  2057.    $scene = Scene_Recruit.new
  2058.   end
  2059.   #--------------------------------------------------------------------------
  2060.   # * Frame Update
  2061.   #--------------------------------------------------------------------------
  2062.   def update
  2063.     super
  2064.     update_menu_background
  2065.     @edit_window.update
  2066.     @input_window.update
  2067.     if Input.repeat?(Input::B)
  2068.       if @edit_window.index > 0             # Not at the left edge
  2069.         Sound.play_cancel
  2070.         @edit_window.back
  2071.       end
  2072.     elsif Input.trigger?(Input::C)
  2073.       if @input_window.is_decision          # If cursor is positioned on [OK]
  2074.         if @edit_window.name == ""          # If name is empty
  2075.           @edit_window.restore_default      # Return to default name
  2076.           if @edit_window.name == ""
  2077.             Sound.play_buzzer
  2078.           else
  2079.             Sound.play_decision
  2080.           end
  2081.         else
  2082.           Sound.play_decision
  2083.           @actor.name = @edit_window.name   # Change actor name
  2084.           return_scene
  2085.         end
  2086.       elsif @input_window.character != ""   # If text characters are not empty
  2087.         if @edit_window.index == @edit_window.max_char    # at the right edge
  2088.           Sound.play_buzzer
  2089.         else
  2090.           Sound.play_decision
  2091.           @edit_window.add(@input_window.character)       # Add text character
  2092.         end
  2093.       end
  2094.     end
  2095.   end
  2096. end  
  2097. ################################################################################
  2098. #------------------------------------------------------------------------------#
  2099. #END\\\END\\\END\\\END\\\END\\\END\\\END///END///END///END///END///END///END///#
  2100. #------------------------------------------------------------------------------#
  2101. ################################################################################
Advertisement
Add Comment
Please, Sign In to add comment