Einloggen »
Neuer Benutzer?
Jetzt anmelden!
Wilkommen bei Projekt-Of-VX
Forum Übersicht
Login
Registrieren
Forums-Blog
Bildergalerie
Kalender
Projekt-OF-VX
»
»
Skripte (Fertig)
»
matrix inventar
Themen-Einstellungen
Thema drucken
Bereich wechseln
Unser Projekt
Neuigkeiten
Umfragen
Kritik & Lob
Bug´s und Fehler
Eure Meinug!
#1
|
matrix inventar
18.05.2011 18:30
Rackos
Informationen anzeigen
Beiträge:
11
Registriert seit:
18.05.2011
Wohnort:
Duisburg
#==============================================================================
# MelekTaus' MatrixInventory
# Version: 1.15b
#------------------------------------------------------------------------------
# Tipp: Verwende "|" für eine neue Zeile in der Item-Beschreibung
#==============================================================================
class Window_Item < Window_Selectable
#--------------------------------------------------------------------------
TOOLTIP = {}
#--------------------------------------------------------------------------
# Font.default_name = ["Calibri", "Comic Sans MS", "Arial"]
# Font.default_size = 20
#--------------------------------------------------------------------------
TOOLTIP_BASE_WIDTH = 160
TOOLTIP_BASE_BACKGROUND_COLOR = Color.new(0, 0, 0, 155)
#--------------------------------------------------------------------------
TOOLTIP_ITEM_NAME_FONT = Font.new(["Calibri", "Comic Sans MS"], 20)
TOOLTIP_ITEM_NAME_BOLD = true
TOOLTIP_ITEM_NAME_COLOR = Color.new(255, 255, 255)
#--------------------------------------------------------------------------
TOOLTIP_ITEM_TYPE_FONT = Font.new(["Calibri", "Comic Sans MS"], 16)
TOOLTIP_ITEM_TYPE_BOLD = false
TOOLTIP_ITEM_TYPE_COLOR = Color.new(255, 255, 255, 155)
#--------------------------------------------------------------------------
TOOLTIP_ITEM_PRICE_FONT = Font.new(["Calibri", "Comic Sans MS"], 14)
TOOLTIP_ITEM_PRICE_BOLD = false
TOOLTIP_ITEM_PRICE_COLOR = Color.new(255, 255, 0)
#--------------------------------------------------------------------------
TOOLTIP_ITEM_DESCRIPTION_FONT = Font.new(["Calibri", "Comic Sans MS"], 16)
TOOLTIP_ITEM_DESCRIPTION_BOLD = false
TOOLTIP_ITEM_DESCRIPTION_COLOR = Color.new(255, 255, 255)
#--------------------------------------------------------------------------
TOOLTIP_ITEM_ATTRIBUTE_FONT = Font.new(["Calibri", "Comic Sans MS"], 16)
TOOLTIP_ITEM_ATTRIBUTE_BOLD = false
TOOLTIP_HP_COLOR = Color.new(255, 155, 155)
TOOLTIP_MP_COLOR = Color.new(155, 155, 255)
TOOLTIP_ATK_COLOR = Color.new(255, 255, 255)
TOOLTIP_DEF_COLOR = Color.new(255, 255, 255)
TOOLTIP_SPI_COLOR = Color.new(255, 255, 255)
TOOLTIP_AGI_COLOR = Color.new(255, 255, 255)
#--------------------------------------------------------------------------
ITEM_NUMBER_FONT = Font.new(["Calibri", "Comic Sans MS"], 12)
ITEM_NUMBER_BOLD = false
ITEM_NUMBER_COLOR = Color.new(255, 255, 255)
#--------------------------------------------------------------------------
VOCAB_TYPE_ITEM = "Item"
VOCAB_PRICE = "Price"
VOCAB_SHOP = "Shop"
SHOW_SELLING_PRICE_IN_INVENTORY = true
# true: Verkaufspreis im Inventar anzeigen.
# false: Einkaufspreis im Inventar anzeigen.
USE_QUICK_SHOP = false
# true: Es wird nicht gefragt, wieviel man ein - bzw. verkaufen will,
# sondern es wird pro Tastendruck ein Stück eingekauft bzw.
# verkauft.
# false: Standard-Shop
TEXT_FOR_NULL_PRICE = ""
# Text der beim Preis angezeigt wird, wenn der Gegenstand 0 wert ist.
#--------------------------------------------------------------------------
def initialize(x, y, width, height)
super(x, y, width, height)
@use_new_wlh = true
@column_max = 10
@spacing = 10
@tooltip_right_space = 0
@tooltip_bottom_space = 0
self.index = 0
create_tooltip
refresh
end
#--------------------------------------------------------------------------
def new_wlh
return @use_new_wlh ? 50 : WLH
end
#--------------------------------------------------------------------------
def create_tooltip
@tooltip = Sprite.new
@tooltip.z = 1000
@tooltip.opacity = 0
@tooltip_switch = false
end
#--------------------------------------------------------------------------
def create_contents
self.contents.dispose
self.contents = Bitmap.new(width - 32, [height - 32, row_max * new_wlh].max)
end
#--------------------------------------------------------------------------
def top_row
return self.oy / new_wlh
end
#--------------------------------------------------------------------------
def top_row=(row)
row = 0 if row < 0
row = row_max - 1 if row > row_max - 1
self.oy = row * new_wlh
end
#--------------------------------------------------------------------------
def page_row_max
return (self.height - 32) / new_wlh
end
#--------------------------------------------------------------------------
def cursor_down(wrap = false)
if (@index < @item_max - @column_max) or (wrap and @column_max == 1)
@index = (@index + @column_max) % @item_max
@tooltip_switch = true
end
end
#--------------------------------------------------------------------------
def cursor_up(wrap = false)
if (@index >= @column_max) or (wrap and @column_max == 1)
@index = (@index - @column_max + @item_max) % @item_max
@tooltip_switch = true
end
end
#--------------------------------------------------------------------------
def cursor_right(wrap = false)
if (@column_max >= 2) and
(@index < @item_max - 1 or (wrap and page_row_max == 1))
@index = (@index + 1) % @item_max
@tooltip_switch = true
end
end
#--------------------------------------------------------------------------
def cursor_left(wrap = false)
if (@column_max >= 2) and
(@index > 0 or (wrap and page_row_max == 1))
@index = (@index - 1 + @item_max) % @item_max
@tooltip_switch = true
end
end
#--------------------------------------------------------------------------
def cursor_pagedown
if top_row + page_row_max < row_max
@index = [@index + page_item_max, @item_max - 1].min
self.top_row += page_row_max
@tooltip_switch = true
end
end
#--------------------------------------------------------------------------
def cursor_pageup
if top_row > 0
@index = [@index - page_item_max, 0].max
self.top_row -= page_row_max
@tooltip_switch = true
end
end
#--------------------------------------------------------------------------
def update_cursor
if @index < 0
self.cursor_rect.empty
else
row = @index / @column_max
if row < top_row
self.top_row = row
end
if row > bottom_row
self.bottom_row = row
end
rect = item_rect(@index)
rect.y /= WLH
rect.y *= new_wlh
rect.y -= self.oy
rect.height = 40
self.cursor_rect = rect
end
draw_item_tooltip if @use_new_wlh
end
#--------------------------------------------------------------------------
def draw_item(index, show_number = true)
rect = item_rect(index)
rect.y /= WLH
rect.y *= new_wlh
rect.y += 8
rect.width -= 4
rect.height = 40
self.contents.clear_rect(rect)
item = @data[index]
if item != nil
number = 0
number = $game_party.item_number(item) if show_number
enabled = enable?(item)
enabled = true if @shop != nil
draw_icon(item.icon_index, rect.x + 7, rect.y, enabled)
self.contents.font = ITEM_NUMBER_FONT
self.contents.font.bold = ITEM_NUMBER_BOLD
self.contents.font.color = ITEM_NUMBER_COLOR
self.contents.font.color.alpha = enabled ? 255 : 128 if @shop == nil
self.contents.draw_text(rect, sprintf("%2d ", number), 2) if number > 1
end
end
#--------------------------------------------------------------------------
def draw_item_tooltip
if not self.active or @tooltip_switch
@tooltip.opacity -= 15 if @tooltip.opacity > 0
@tooltip.opacity = 0 if @tooltip.opacity < 0
@tooltip_switch = false if @tooltip.opacity == 0
elsif @data != nil and item != nil
info = item.description
@tooltip.opacity += 15 if @tooltip.opacity < 255
@tooltip.opacity = 255 if @tooltip.opacity > 255
x = 6
width = TOOLTIP_BASE_WIDTH
text = []
text.push([2, [item.name, TOOLTIP_ITEM_NAME_FONT.size, 0], [item_type, TOOLTIP_ITEM_TYPE_FONT.size, 0], 4])
text.push([4, [item.description, TOOLTIP_ITEM_DESCRIPTION_FONT.size, 0], 4])
if item_type == VOCAB_TYPE_ITEM
t = [item.hp_recovery_rate, item.hp_recovery, item.mp_recovery_rate]
t.push(item.mp_recovery)
else
t = [item.atk, item.def, item.spi, item.agi]
end
text.push([4, t, 4])
height = 0
if text[0][1][0] != "" or text[0][2][0] != ""
height += text[0][0]
if text[0][1][0] != ""
height += text[0][1][1]
height += text[0][1][2]
end
if text[0][2][0] != ""
height += text[0][2][1]
height += text[0][2][2]
end
height += text[0][3]
end
if text[1][1][0] != ""
height += text[1][0]
if text[1][1][0] != ""
for i in 0...text[1][1][0].split("|").size
height += text[1][1][1]
end
height += text[1][1][2]
end
height += text[1][2]
end
if text[2][1][0] != 0 or text[2][1][1] != 0 or text[2][1][2] != 0 or text[2][1][3] != 0
height += text[2][0]
height += TOOLTIP_ITEM_ATTRIBUTE_FONT.size if text[2][1][0] != 0
height += TOOLTIP_ITEM_ATTRIBUTE_FONT.size if text[2][1][1] != 0
height += TOOLTIP_ITEM_ATTRIBUTE_FONT.size if text[2][1][2] != 0
height += TOOLTIP_ITEM_ATTRIBUTE_FONT.size if text[2][1][3] != 0
height += text[2][2]
end
@tooltip.bitmap = Bitmap.new(width + 2 * x, height)
@tooltip.bitmap.font = TOOLTIP_ITEM_NAME_FONT
@tooltip.bitmap.fill_rect(@tooltip.bitmap.rect, TOOLTIP_BASE_BACKGROUND_COLOR)
new_x = cursor_rect.x + 24
if new_x > 520 - @tooltip.bitmap.width - @tooltip_right_space
new_x = cursor_rect.x + new_wlh - @tooltip.bitmap.width
end
@tooltip.x = new_x
new_y = cursor_rect.y + self.y + new_wlh
if new_y > 366 - @tooltip.bitmap.height - @tooltip_bottom_space
new_y = cursor_rect.y + self.y - @tooltip.bitmap.height + 22
end
@tooltip.y = new_y
height = 0
if text[0][1][0] != "" or text[0][2][0] != ""
height += text[0][0]
if text[0][1][0] != ""
@tooltip.bitmap.font.name = TOOLTIP_ITEM_NAME_FONT.name
@tooltip.bitmap.font.size = text[0][1][1]
@tooltip.bitmap.font.bold = TOOLTIP_ITEM_NAME_BOLD
@tooltip.bitmap.font.color = TOOLTIP_ITEM_NAME_COLOR
@tooltip.bitmap.draw_text(x, height, width, text[0][1][1], text[0][1][0])
height += text[0][1][1]
height += text[0][1][2]
end
if text[0][2][0] != ""
@tooltip.bitmap.font.name = TOOLTIP_ITEM_TYPE_FONT.name
@tooltip.bitmap.font.size = text[0][2][1]
@tooltip.bitmap.font.bold = TOOLTIP_ITEM_TYPE_BOLD
@tooltip.bitmap.font.color = TOOLTIP_ITEM_TYPE_COLOR
@tooltip.bitmap.draw_text(x, height, width, text[0][2][1], text[0][2][0])
w = item.price
w /= 2 if SHOW_SELLING_PRICE_IN_INVENTORY and @shop == nil
@tooltip.bitmap.font.name = TOOLTIP_ITEM_PRICE_FONT.name
@tooltip.bitmap.font.size = TOOLTIP_ITEM_PRICE_FONT.size
@tooltip.bitmap.font.bold = TOOLTIP_ITEM_PRICE_BOLD
@tooltip.bitmap.font.color = TOOLTIP_ITEM_PRICE_COLOR
if w == 0
@tooltip.bitmap.draw_text(x, height, width, TOOLTIP_ITEM_TYPE_FONT.size, "#{TEXT_FOR_NULL_PRICE}", 2)
else
@tooltip.bitmap.draw_text(x, height, width, TOOLTIP_ITEM_TYPE_FONT.size, "#{VOCAB_PRICE}: #{w}", 2)
end
height += text[0][2][1]
height += text[0][2][2]
end
height += text[0][3]
end
if text[1][1][0] != ""
height += text[1][0]
if text[1][1][0] != ""
for i in 0...text[1][1][0].split("|").size
@tooltip.bitmap.font.name = TOOLTIP_ITEM_DESCRIPTION_FONT.name
@tooltip.bitmap.font.size = text[1][1][1]
@tooltip.bitmap.font.bold = TOOLTIP_ITEM_DESCRIPTION_BOLD
@tooltip.bitmap.font.color = TOOLTIP_ITEM_DESCRIPTION_COLOR
@tooltip.bitmap.draw_text(x, height, width, text[1][1][1], text[1][1][0].split("|")[i])
height += text[1][1][1]
end
height += text[1][1][2]
end
height += text[1][2]
end
if text[2][1][0] != 0 or text[2][1][1] != 0 or text[2][1][2] != 0 or text[2][1][3] != 0
height += text[2][0]
if text[2][1][0] != 0
@tooltip.bitmap.font.name = TOOLTIP_ITEM_ATTRIBUTE_FONT.name
@tooltip.bitmap.font.size = TOOLTIP_ITEM_ATTRIBUTE_FONT.size
@tooltip.bitmap.font.bold = TOOLTIP_ITEM_ATTRIBUTE_BOLD
if item_type == VOCAB_TYPE_ITEM
@tooltip.bitmap.font.color = TOOLTIP_HP_COLOR
if text[2][1][0] > 0
new_text = "+ #{text[2][1][0]}% #{Vocab::hp}"
else
new_text = "- #{text[2][1][0]}% #{Vocab::hp}"
end
else
@tooltip.bitmap.font.color = TOOLTIP_ATK_COLOR
if text[2][1][0] > 0
new_text = "+ #{text[2][1][0]} #{Vocab::atk}"
else
new_text = "- #{text[2][1][0]} #{Vocab::atk}"
end
end
@tooltip.bitmap.draw_text(x, height, width, 16, new_text)
height += 16
end
if text[2][1][1] != 0
@tooltip.bitmap.font.name = TOOLTIP_ITEM_ATTRIBUTE_FONT.name
@tooltip.bitmap.font.size = TOOLTIP_ITEM_ATTRIBUTE_FONT.size
@tooltip.bitmap.font.bold = TOOLTIP_ITEM_ATTRIBUTE_BOLD
if item_type == VOCAB_TYPE_ITEM
@tooltip.bitmap.font.color = TOOLTIP_HP_COLOR
if text[2][1][1] > 0
new_text = "+ #{text[2][1][1]} #{Vocab::hp}"
else
new_text = "- #{text[2][1][1]} #{Vocab::hp}"
end
else
@tooltip.bitmap.font.color = TOOLTIP_DEF_COLOR
if text[2][1][1] > 0
new_text = "+ #{text[2][1][1]} #{Vocab::def}"
else
new_text = "- #{text[2][1][1]} #{Vocab::def}"
end
end
@tooltip.bitmap.draw_text(x, height, width, 16, new_text)
height += 16
end
if text[2][1][2] != 0
@tooltip.bitmap.font.name = TOOLTIP_ITEM_ATTRIBUTE_FONT.name
@tooltip.bitmap.font.size = TOOLTIP_ITEM_ATTRIBUTE_FONT.size
@tooltip.bitmap.font.bold = TOOLTIP_ITEM_ATTRIBUTE_BOLD
if item_type == VOCAB_TYPE_ITEM
@tooltip.bitmap.font.color = TOOLTIP_MP_COLOR
if text[2][1][2] > 0
new_text = "+ #{text[2][1][2]}% #{Vocab::mp}"
else
new_text = "- #{text[2][1][2]}% #{Vocab::mp}"
end
else
@tooltip.bitmap.font.color = TOOLTIP_SPI_COLOR
if text[2][1][2] > 0
new_text = "+ #{text[2][1][2]} #{Vocab::spi}"
else
new_text = "- #{text[2][1][2]} #{Vocab::spi}"
end
end
@tooltip.bitmap.draw_text(x, height, width, 16, new_text)
height += 16
end
if text[2][1][3] != 0
@tooltip.bitmap.font.name = TOOLTIP_ITEM_ATTRIBUTE_FONT.name
@tooltip.bitmap.font.size = TOOLTIP_ITEM_ATTRIBUTE_FONT.size
@tooltip.bitmap.font.bold = TOOLTIP_ITEM_ATTRIBUTE_BOLD
if item_type == VOCAB_TYPE_ITEM
@tooltip.bitmap.font.color = TOOLTIP_MP_COLOR
if text[2][1][3] > 0
new_text = "+ #{text[2][1][3]} #{Vocab::mp}"
else
new_text = "- #{text[2][1][3]} #{Vocab::mp}"
end
else
@tooltip.bitmap.font.color = TOOLTIP_AGI_COLOR
if text[2][1][3] > 0
new_text = "+ #{text[2][1][3]} #{Vocab::agi}"
else
new_text = "- #{text[2][1][3]} #{Vocab::agi}"
end
end
@tooltip.bitmap.draw_text(x, height, width, 16, new_text)
height += 16
end
height += text[2][2]
end
end
end
#--------------------------------------------------------------------------
def item_type
case true
when item.to_s.include?("Item"); return VOCAB_TYPE_ITEM
when item.to_s.include?("Weapon"); return Vocab::weapon
when item.to_s.include?("Armor")
return Vocab::armor1 if item.kind == 0
return Vocab::armor2 if item.kind == 1
return Vocab::armor3 if item.kind == 2
return Vocab::armor4 if item.kind == 3
else; return "???"
end
end
#--------------------------------------------------------------------------
def dispose
super
@tooltip.dispose
end
#--------------------------------------------------------------------------
end
#==============================================================================
class Window_Help < Window_Base
#--------------------------------------------------------------------------
alias melektaus_matrix_inventory_window_help_set_text set_text
def set_text(text = "", align = 0)
self.contents.font.bold = true
s = $scene.to_s
case true
when s.include?("Scene_Item")
text = Vocab::item
align = 1
when s.include?("Scene_Equip")
text = Vocab::equip
align = 1
when s.include?("Scene_Shop")
text = Window_Item::VOCAB_SHOP
align = 1
end
melektaus_matrix_inventory_window_help_set_text(text, align) if text != ""
end
#--------------------------------------------------------------------------
end
#==============================================================================
class Scene_Shop < Scene_Base
#--------------------------------------------------------------------------
alias melektaus_matrix_inventory_scene_shop_start start
def start
melektaus_matrix_inventory_scene_shop_start
@help_window.set_text
end
#--------------------------------------------------------------------------
alias melektaus_matrix_inventory_scene_shop_update update
def update
melektaus_matrix_inventory_scene_shop_update
@help_window.set_text
end
#--------------------------------------------------------------------------
end
#==============================================================================
class Window_ShopBuy < Window_Item
#--------------------------------------------------------------------------
def initialize(x, y)
@shop_goods = $game_temp.shop_goods
super(x, y, 304, 304)
@use_new_wlh = true
@column_max = 6
@spacing = 4
@tooltip_right_space = 208
@tooltip_bottom_space = WLH
@shop = true
self.index = 0
create_tooltip
refresh
end
#--------------------------------------------------------------------------
def refresh
@data = []
for goods_item in @shop_goods
case goods_item[0]
when 0
item = $data_items[goods_item[1]]
when 1
item = $data_weapons[goods_item[1]]
when 2
item = $data_armors[goods_item[1]]
end
if item != nil
@data.push(item)
end
end
@item_max = @data.size
create_contents
for i in 0...@item_max
draw_item(i, false)
end
end
#--------------------------------------------------------------------------
end
#==============================================================================
class Scene_Shop < Scene_Base
#--------------------------------------------------------------------------
def update_buy_selection
@status_window.item = @buy_window.item
if Input.trigger?(Input::B)
Sound.play_cancel
@command_window.active = true
@dummy_window.visible = true
@buy_window.active = false
@buy_window.visible = false
@status_window.visible = false
@status_window.item = nil
@help_window.set_text("")
return
end
if Input.repeat?(Input::C)
@item = @buy_window.item
number = $game_party.item_number(@item)
if @item == nil or @item.price > $game_party.gold or number == 99
Sound.play_buzzer
else
if Window_Item::USE_QUICK_SHOP
Sound.play_shop
$game_party.lose_gold(@item.price)
$game_party.gain_item(@item, 1)
@gold_window.refresh
@buy_window.refresh
@status_window.refresh
else
Sound.play_decision
max = @item.price == 0 ? 99 : $game_party.gold / @item.price
max = [max, 99 - number].min
@buy_window.active = false
@buy_window.visible = false
@number_window.set(@item, max, @item.price)
@number_window.active = true
@number_window.visible = true
end
end
end
end
#--------------------------------------------------------------------------
def update_sell_selection
if Input.trigger?(Input::B)
Sound.play_cancel
@command_window.active = true
@dummy_window.visible = true
@sell_window.active = false
@sell_window.visible = false
@status_window.item = nil
@help_window.set_text("")
elsif Input.repeat?(Input::C)
@item = @sell_window.item
@status_window.item = @item
if @item == nil or @item.price == 0
Sound.play_buzzer
else
if Window_Item::USE_QUICK_SHOP
Sound.play_shop
$game_party.gain_gold(@item.price / 2)
$game_party.lose_item(@item, 1)
@gold_window.refresh
@sell_window.refresh
@status_window.refresh
else
Sound.play_decision
max = $game_party.item_number(@item)
@sell_window.active = false
@sell_window.visible = false
@number_window.set(@item, max, @item.price / 2)
@number_window.active = true
@number_window.visible = true
@status_window.visible = true
end
end
end
end
#--------------------------------------------------------------------------
end
#==============================================================================
constantine
Antworten
nach oben springen
«
**
Einfach ein eigenes
Xobor Forum
erstellen
Datenschutz