Actually it IS public. xD It's just not one of my usual scripts. I released it long time ago as part of my Blizzard Script Collection v1.0. Here you go:
#==============================================================================
# Shop layout from Chaos Project (Final Demo Version) by Blizzard
# Version: 2.0
#==============================================================================
#==============================================================================
# Window_ShopBuy
#==============================================================================
class Window_ShopBuy < Window_Selectable
def initialize(shop_goods)
super(320, 80, 308, 384)
@shop_goods = shop_goods
refresh
self.index = 0
end
def item
return @data[self.index]
end
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
@shop_goods.each {|goods_item|
item = case goods_item[0]
when 0 then $data_items[goods_item[1]]
when 1 then $data_weapons[goods_item[1]]
when 2 then $data_armors[goods_item[1]]
end
@data.push(item) if item != nil}
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
if $fontface != nil
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
elsif $defaultfonttype != nil
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
end
(0...@item_max).each {|i| draw_item(i)}
end
end
def draw_item(index)
item = @data[index]
number = case item
when RPG::Item then $game_party.item_number(item.id)
when RPG::Weapon then $game_party.weapon_number(item.id)
when RPG::Armor then $game_party.armor_number(item.id)
end
x = 4
y = index * 32
if item.price <= $game_party.gold && number < 99
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
rect = Rect.new(x, y, self.width - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(item.icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
if item.price <= $game_party.gold && number < 99
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
self.contents.draw_text(x + 176, y, 88, 32, item.price.to_s, 2)
end
def update_help
@help_window.set_text(self.item == nil ? "" : self.item.description)
end
end
#==============================================================================
# Window_ShopSell
#==============================================================================
class Window_ShopSell < Window_Selectable
def initialize
super(16, 80, 608, 320)
@column_max = 2
self.z = 4000
refresh
self.index = 0
end
def item
return @data[self.index]
end
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
(1...$data_items.size).each {|i|
@data.push($data_items[i]) if $game_party.item_number(i) > 0}
(1...$data_weapons.size).each {|i|
@data.push($data_weapons[i]) if $game_party.weapon_number(i) > 0}
(1...$data_armors.size).each {|i|
@data.push($data_armors[i]) if $game_party.armor_number(i) > 0}
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
if $fontface != nil
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
elsif $defaultfonttype != nil
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
end
(0...@item_max).each {|i| draw_item(i)}
end
end
def draw_item(index)
item = @data[index]
number = case item
when RPG::Item then $game_party.item_number(item.id)
when RPG::Weapon then $game_party.weapon_number(item.id)
when RPG::Armor then $game_party.armor_number(item.id)
end
x = 4 + index % 2 * 304
y = index / 2 * 32
if item.price > 0
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(item.icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
if item.price > 0
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
self.contents.draw_text(x + 224, y, 16, 32, ":", 1)
self.contents.draw_text(x + 240, y, 24, 32, number.to_s, 2)
end
def update_help
@help_window.set_text(self.item == nil ? "" : self.item.description)
end
end
#==============================================================================
# Window_ShopNumber
#==============================================================================
class Window_ShopNumber < Window_Base
def initialize
super(320, 80, 308, 384)
self.contents = Bitmap.new(width - 32, height - 32)
if $fontface != nil
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
elsif $defaultfonttype != nil
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
end
@item = nil
@max = 1
@price = 0
@number = 1
self.z = 5000
end
def set(item, max, price)
@item = item
@max = max
@price = price
@number = 1
refresh
end
def number
return @number
end
def refresh
self.contents.clear
self.contents.font.color = system_color
self.contents.draw_text(4, 0, 276, 32, "How many?")
draw_item_name(@item, 4, 96)
self.contents.font.color = normal_color
self.contents.draw_text(208, 96, 32, 32, "×")
self.contents.draw_text(244, 96, 24, 32, @number.to_s, 2)
self.cursor_rect.set(240, 96, 32, 32)
domination = $data_system.words.gold
cx = contents.text_size(domination).width
total_price = @price * @number
self.contents.font.color = normal_color
self.contents.draw_text(4, 128, 308-cx, 32, total_price.to_s, 2)
self.contents.font.color = system_color
self.contents.draw_text(268-cx, 160, cx, 32, domination, 2)
end
def update
super
if self.active
if Input.repeat?(Input::RIGHT) && @number < @max
$game_system.se_play($data_system.cursor_se)
@number += 1
refresh
elsif Input.repeat?(Input::LEFT) && @number > 1
$game_system.se_play($data_system.cursor_se)
@number -= 1
refresh
elsif Input.repeat?(Input::UP) && @number < @max
$game_system.se_play($data_system.cursor_se)
@number = [@number + 10, @max].min
refresh
elsif Input.repeat?(Input::DOWN) && @number > 1
$game_system.se_play($data_system.cursor_se)
@number = [@number - 10, 1].max
refresh
end
end
end
end
#==============================================================================
# Window_ShopStatus
#==============================================================================
class Window_ShopStatus < Window_Base
def initialize
super(16, 80, 304, 320)
self.contents = Bitmap.new(width - 32, height - 32)
if $fontface != nil
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
elsif $defaultfonttype != nil
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
end
@item = nil
self.z = 4000
refresh
end
def refresh
self.contents.clear
return if @item == nil
number = case @item
when RPG::Item then $game_party.item_number(@item.id)
when RPG::Weapon then $game_party.weapon_number(@item.id)
when RPG::Armor then $game_party.armor_number(@item.id)
end
self.contents.font.color = system_color
self.contents.draw_text(44, 0, 200, 32, "possesed")
self.contents.font.color = normal_color
self.contents.draw_text(4, 0, 32, 32, number.to_s, 2)
return if @item.is_a?(RPG::Item)
(0...$game_party.actors.size).each {|i|
actor = $game_party.actors[i]
if actor.equippable?(@item)
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
self.contents.draw_text(4, 32 + 64 * i, 120, 32, actor.name)
if @item.is_a?(RPG::Weapon)
item1 = $data_weapons[actor.weapon_id]
elsif @item.kind == 0
item1 = $data_armors[actor.armor1_id]
elsif @item.kind == 1
item1 = $data_armors[actor.armor2_id]
elsif @item.kind == 2
item1 = $data_armors[actor.armor3_id]
else
item1 = $data_armors[actor.armor4_id]
end
if actor.equippable?(@item)
if @item.is_a?(RPG::Weapon)
atk1 = item1 != nil ? item1.atk : 0
atk2 = @item != nil ? @item.atk : 0
change1 = atk2 - atk1
end
if @item.is_a?(RPG::Armor)
pdef1 = item1 != nil ? item1.pdef : 0
mdef1 = item1 != nil ? item1.mdef : 0
pdef2 = @item != nil ? @item.pdef : 0
mdef2 = @item != nil ? @item.mdef : 0
change1 = pdef2 - pdef1
change2 = mdef2 - mdef1
end
if change2 != nil
if actor.equippable?(@item)
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
self.contents.draw_text(156, 32 + 64 * i, 56, 32,
sprintf("%+d", change1), 2)
if actor.equippable?(@item)
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
self.contents.draw_text(212, 32 + 64 * i, 56, 32,
sprintf("%+d", change2), 2)
elsif change1 != nil
if actor.equippable?(@item)
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
self.contents.draw_text(156, 32 + 64 * i, 112, 32,
sprintf("%+d", change1), 2)
end
end
if item1 != nil
x = 4
y = 64 + 64 * i
bitmap = RPG::Cache.icon(item1.icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
if actor.equippable?(@item)
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
self.contents.draw_text(x + 28, y, 212, 32, item1.name)
end
if change2 != nil
self.contents.font.color = normal_color
self.contents.draw_text(156, 0, 56, 32, "PDef", 2)
self.contents.draw_text(212, 0, 56, 32, "MDef", 2)
elsif change1 != nil
self.contents.font.color = normal_color
self.contents.draw_text(212, 0, 56, 32, "Atk", 2)
end}
end
def item=(item)
if @item != item
@item = item
refresh
end
end
end
#==============================================================================
# Scene_Shop
#==============================================================================
class Scene_Shop
def main
c = ["Buy", "Sell", "Cancel"]
@help_window = Window_Help.new
@command_window = Window_Command.new(192, c)
@command_window.x = 16
@command_window.y = 80
@gold_window = Window_Gold.new
@gold_window.x = 16
@gold_window.y = 400
@buy_window = Window_ShopBuy.new($game_temp.shop_goods)
@buy_window.help_window = @help_window
@sell_window = Window_ShopSell.new
@sell_window.help_window = @help_window
@number_window = Window_ShopNumber.new
@status_window = Window_ShopStatus.new
@buy_window.active = @buy_window.visible = @sell_window.active =
@sell_window.visible = @number_window.active = @number_window.visible =
@status_window.visible = false
Graphics.transition
loop do
Graphics.update
Input.update
update
break if $scene != self
end
Graphics.freeze
[@help_window, @command_window, @gold_window, @buy_window, @sell_window,
@number_window, @status_window].each {|win| win.dispose}
end
def update
[@help_window, @command_window, @gold_window, @buy_window, @sell_window,
@number_window, @status_window].each {|win| win.update}
if @command_window.active
update_command
elsif @buy_window.active
update_buy
elsif @sell_window.active
update_sell
elsif @number_window.active
update_number
end
end
def update_command
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Map.new
elsif Input.trigger?(Input::C)
case @command_window.index
when 0
$game_system.se_play($data_system.decision_se)
@command_window.active = false
@buy_window.refresh
@buy_window.active = @buy_window.visible = @status_window.visible = true
when 1
$game_system.se_play($data_system.decision_se)
@command_window.active = false
@sell_window.active = @sell_window.visible = true
@sell_window.refresh
when 2
$game_system.se_play($data_system.decision_se)
$scene = Scene_Map.new
end
end
end
def update_buy
@status_window.item = @buy_window.item
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@command_window.active = true
@buy_window.active = @buy_window.visible = @status_window.visible = false
@status_window.item = nil
@help_window.set_text("")
elsif Input.trigger?(Input::C)
@item = @buy_window.item
if @item == nil or @item.price > $game_party.gold
$game_system.se_play($data_system.buzzer_se)
return
end
number = case @item
when RPG::Item then $game_party.item_number(@item.id)
when RPG::Weapon then $game_party.weapon_number(@item.id)
when RPG::Armor then $game_party.armor_number(@item.id)
end
if number == 99
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
max = @item.price == 0 ? 99 : $game_party.gold / @item.price
max = [max, 99 - number].min
@buy_window.active = @buy_window.visible = false
@number_window.set(@item, max, @item.price)
@number_window.active = @number_window.visible = true
end
end
def update_sell
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@command_window.active = true
@sell_window.active = @sell_window.visible = false
@status_window.item = nil
@help_window.set_text("")
elsif Input.trigger?(Input::C)
@item = @sell_window.item
@status_window.item = @item
if @item == nil or @item.price == 0
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
number = case @item
when RPG::Item then $game_party.item_number(@item.id)
when RPG::Weapon then $game_party.weapon_number(@item.id)
when RPG::Armor then $game_party.armor_number(@item.id)
end
max = number
@sell_window.active = @sell_window.visible = false
@number_window.set(@item, max, @item.price / 2)
@number_window.active = @number_window.visible = @status_window.visible = true
end
end
def update_number
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@number_window.active = @number_window.visible = false
case @command_window.index
when 0
@buy_window.active = @buy_window.visible = true
when 1
@sell_window.active = @sell_window.visible = true
@status_window.visible = false
end
elsif Input.trigger?(Input::C)
$game_system.se_play($data_system.shop_se)
@number_window.active = @number_window.visible = false
case @command_window.index
when 0
$game_party.lose_gold(@number_window.number * @item.price)
case @item
when RPG::Item then $game_party.gain_item(@item.id, @number_window.number)
when RPG::Weapon then $game_party.gain_weapon(@item.id, @number_window.number)
when RPG::Armor then $game_party.gain_armor(@item.id, @number_window.number)
end
[@gold_window, @buy_window, @status_window].each {|win| win.refresh}
@buy_window.active = @buy_window.visible = true
when 1
$game_party.gain_gold(@number_window.number * (@item.price / 2))
case @item
when RPG::Item then $game_party.lose_item(@item.id, @number_window.number)
when RPG::Weapon then $game_party.lose_weapon(@item.id, @number_window.number)
when RPG::Armor then $game_party.lose_armor(@item.id, @number_window.number)
end
[@gold_window, @sell_window, @status_window].each {|win| win.refresh}
@sell_window.active = @sell_window.visible = true
@status_window.visible = false
end
end
end
end