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_Menu.new(0)
return
end
end
end
class Window_Reputation < Window_Base
attr_accessor :factions
attr_accessor :fac_rep
attr_accessor :reptypes
def initialize
super(0, 0, 640, 480)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
self.back_opacity = 120
@factions = ["Test1", "Test2", "Test3", "Test4", "Test5", "Test6"]
@rep = ["Heroic", "Respected", "Friendly", "Neutral", "Unfriendly", "Hated", "Hunted"]
refresh
end
def draw_repbar(x, y, width, height, current, max)
self.contents.fill_rect(x-1, y - 1, width+3, height + 3, Color.new(255, 255, 255, 255))
self.contents.fill_rect(x, y, width+1, height + 1, Color.new(0, 0, 0, 255))
for i in 0..height
for j in 0..current
self.contents.fill_rect(x+j, y+i, 1, 1, Color.new(255 - (1.25*j), 0, 0 + (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, "Reputation", 2)
self.contents.font.size = $fontsize
for i in 0...@factions.size
y = 80 + (i * 70)
x = -30
if i > 2
x = 280
y = 80 + ((i - 3) * 70)
end
if $fac_rep[i] > 100
$fac_rep[i] = 100
end
self.contents.draw_text(x+40, y, 160, 32, @factions[i], 0)
draw_repbar(x+90, y+32, 200, 14, 2 * $fac_rep[i], 100)
self.contents.font.color = system_color
if $fac_rep[i] >= 90
self.contents.draw_text(x+210, y, 96, 32, @rep[0], 2)
elsif $fac_rep[i] >= 75
self.contents.draw_text(x+210, y, 96, 32, @rep[1], 2)
elsif $fac_rep[i] >= 55
self.contents.draw_text(x+210, y, 96, 32, @rep[2], 2)
elsif $fac_rep[i] >= 45
self.contents.draw_text(x+210, y, 96, 32, @rep[3], 2)
elsif $fac_rep[i] >= 25
self.contents.draw_text(x+210, y, 96, 32, @rep[4], 2)
elsif $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
self.contents.font.color = normal_color
end
end
end
#---------------------------------------------------
#To increase or decrease reputation, use: $fac_rep[i] +=1 or -=1
#or however much you want it to change. just remember "i" is the id of the faction,
#for instance your first faction has an id of 0,
#the second faction has an id of 1, etc.
#So, for instance, if i used the default programmed factions,
#to increase the mage faction's reputation by 8, i'd input $fac_rep[1] +=8
#----------------------------------------------------