# Kio's Reputation System v1.2 #==============================================================
class Game_System attr_accessor :fac_rep attr_accessor :fac_active alias rep_initialize initialize def initialize rep_initialize @fac_rep=[] @fac_active=[] end end
class Scene_Title alias cng command_new_game def command_new_game cng #Determine the initial settings for the faction's reputations here $game_system.fac_rep = [50, 44, 75, 24, 9, 56, 100] #Determine the inital factions you can see here. $game_system.fac_active = ["active", "active", "active", "active", "active", nil, nil] end end
class Scene_Reputation def main @status_window = Window_Reputation.new @sprite = Spriteset_Map.new Graphics.transition loop do Graphics.update Input.update update if $scene != self break end end Graphics.freeze @status_window.dispose @sprite.dispose end
def update if Input.trigger?(Input::B) $game_system.se_play($data_system.cancel_se) $scene = Scene_Map.new return end end end
class Window_Reputation < Window_Base attr_accessor :factions attr_accessor :fac_rep attr_accessor :reptypes attr_accessor :fac_active
def initialize super(0, 0, 640, 480) self.contents = Bitmap.new(width - 32, height - 32) self.contents.font.name = "Tahoma" self.contents.font.size = 22 self.contents.font.color = text_color(0) self.back_opacity = 120 @factions = ["Maitre Pokémon", "Adoré", "Naze", "Stupide", "0 BP", "Ordre Blanc", "Crestguarde"] @rep = ["Héros", "Héros", "Amical", "Débutant", "Détesté", "Intelligent", "9999 BP"] refresh end def draw_repbar(x, y, width, height, current, max) x -= 10 for i in 0..(height+2) self.contents.fill_rect(x-3+i, y - 1 + i, width+5, 1, Color.new(255, 255, 255, 255)) end for i in 0..height self.contents.fill_rect(x+i, y+i, width+1, 1, Color.new(0, 0, 0, 255)) end for i in 0..height for j in 0..current self.contents.fill_rect(x+j+i, y+i, 1, 1, Color.new(0, 0 + (1.25*j), 255 - (1.25*j), 255 - (5*i))) end end end
def refresh self.contents.clear self.contents.font.color = normal_color self.contents.font.size = 32 self.contents.draw_text(20, 40, 184, 32, "Réputation", 2) self.contents.font.size = $fontsize for i in 0... @factions.size y = 80 + (i * 70) x = -30 if i > 4 x = 280 y = 80 + ((i - 5) * 70) end if $game_system.fac_rep[i] > 100 $game_system.fac_rep[i] = 100 end if $game_system.fac_rep[i] < 0 $game_system.fac_rep[i] = 0 end if $game_system.fac_active[i] == "active" draw_fac(x, y, i) end self.contents.font.color = normal_color end end def draw_fac(x, y, i) self.contents.draw_text(x+40, y, 160, 32, @factions[i], 0) draw_repbar(x+90, y+32, 200, 14, 2 * $game_system.fac_rep[i], 100) self.contents.font.color = system_color if $game_system.fac_rep[i] >= 90 self.contents.draw_text(x+210, y, 96, 32, @rep[0], 2) elsif $game_system.fac_rep[i] >= 75 self.contents.draw_text(x+210, y, 96, 32, @rep[1], 2) elsif $game_system.fac_rep[i] >= 55 self.contents.draw_text(x+210, y, 96, 32, @rep[2], 2) elsif $game_system.fac_rep[i] >= 45 self.contents.draw_text(x+210, y, 96, 32, @rep[3], 2) elsif $game_system.fac_rep[i] >= 25 self.contents.draw_text(x+210, y, 96, 32, @rep[4], 2) elsif $game_system.fac_rep[i] >= 10 self.contents.draw_text(x+210, y, 96, 32, @rep[5], 2) else self.contents.draw_text(x+210, y, 96, 32, @rep[6], 2) end end |