Notice: ob_clean() [ref.outcontrol]: failed to delete buffer. No buffer to delete. in /var/www/vhosts/rpg-studio.de/httpdocs/scriptdb/1/dl.php on line 23
#============================================================================== # ** Advanced Shop System V1 # AdvancedShopSystem.rb von Alexis Hiemis (07.09.2009) #------------------------------------------------------------------------------ # http://www.rpg-studio.de/scriptdb/node/339 # http://www.rpg-studio.de/forum/index.php?page=Thread&threadID=14729 #============================================================================== #----------------------------------------------------------------------------- # Alexis Hiemis Advanced Shop System #----------------------------------------------------------------------------- # Hinweis: Der Wert 1 bedeutet, dass die Funktion aktiv ist, der Wert 0, # dass sie inaktiv ist. Kurze Erläuterungen, was die Funktion bewirkt, findet # ihr gleich daneben. # Anzeigeoptionen - Shopowner/ Handelsgeschickanzeige $shop_geschick_aktiv = 1 # Sollen die Preise anhand des Handelsgeschicks berechnet werden? $handelsgeschick_variable = 1 # hier einfach die Nummer der Varibale angeben, #auf der ihr das Handelsgeschick der Party legt $shop_owner_icons = 1 #für Geschick und Gold werden Icons angezeigt # Anzeigeoptionen - Itemeigenschaften $shop_itemtyp_anzeigen = 1 # Itemtypen mit Itemnamen anzeigen # die folgenden Optionen können separat an/abgeschaltet werden, werden aber # ignoriert, wenn itemtyp_anzeigen auf 0 gesetzt wurde $shop_ruestung_anzeigen = 1 #Rüstungen als Itemtyp anzeigen $shop_waffe_anzeigen = 1 #Waffen als Itemtyp anzeigen $shop_item_anzeigen = 1 #Item als Itemtyp anzeigen $shop_verwendbarkeit_anzeigen = 1 # Welche Charaktere können das Item verwenden $shop_verwendbarkeit_anzeigen_item = 1 # zeigt speziell für Items (Tränke usw.) an, # auf wen sie angewendet werden können $shop_elemente_anzeigen = 1 #Elemente werden angezeigt (gillt für ALLE Items) $shop_elemente_anzeigen_item = 1 #Elemente werden bei Items angezeigt $shop_elemente_anzeigen_waffe = 1 #Elemente werden bei Waffen angezeigt $shop_elemente_anzeigen_armor = 1 #Elemente werden bei Rüstungen angezeigt $shop_status_anzeigen = 1 #Elemente werden angezeigt (gillt für ALLE Items) $shop_status_anzeigen_item = 1 #Statusänderung wird bei Items angezeigt $shop_status_anzeigen_waffe = 1 #Statusänderung wird bei Waffen angezeigt $shop_status_anzeigen_armor = 1 #Statusresistenz bei Rüstungen angezeigt # Darstellungsoptionen - Icons $shop_owner_icons_gold = "032-Item01.png" # Icon für Goldanzeige $shop_owner_icons_geschick = "050-Skill07.png" # Icon für Handelsgeschickanzeige $shop_eig_icon_hp_ändern = "022-Potion02.png" # Icon für HP-Änderung $shop_eig_icon_sp_ändern = "021-Potion01.png" $shop_eig_icon_angriffskraft = "001-Weapon01.png" $shop_eig_icon_physische_verteidigung = "009-Shield01.png" $shop_eig_icon_magische_verteidigung = "050-Skill07.png" $shop_eig_icon_magische_attribute = "048-Skill05.png" $shop_eig_icon_elemente = "045-Skill02.png" $shop_eig_icon_ziel = "049-Skill06.png" $shop_eig_icon_hpschaden = "044-Skill01.png" $shop_eig_icon_spschaden = "047-Skill04.png" # Darstellungsoptionen - Schriftgröße # 22 = Standartgröße # 24 = größer als Standartgröße # 20 = kleiner als Standartgröße # 18 = viel kleiner als Standartgröße $shop_schrift_itemname = 22 $shop_schrift_hauptattribute = 22 $shop_schrift_magieattribute = 18 $shop_schrift_elemente = 18 $shop_schrift_menge_in_besitz = 18 # Darstellungsoptionen - Texte # Wichtig: alle nicht in der Database ändern!! $shop_word_menge_in_besitz = "In Besitz" $shop_word_resistenz = "Resistenz gegen" $shop_word_element = "Elementattacke" $shop_word_ein_feind = "Ein Feind" $shop_word_gruppe_feinde = "Alle Feinde" $shop_word_ein_freund = "Ein Verbündeter" $shop_word_alle_freunde = "Alle Verbündeten" $shop_word_toter_Freund = "Bewusstloser Verbündeter" $shop_word_tote_Freunde = "Alle bewusstlosen Verbündeten" $shop_word_selbst = "Selbst" $shop_word_maximal = "Max." $shop_word_kannnichtbezahlen = " kann nicht so viel bezahlen!" $shop_word_erhalten = "Bei Verkauf erhältst du nur " $shop_word_geschick = "Geschick " $shop_word_buy = "Kaufen" $shop_word_sell = "Verkaufen" $shop_word_leave = "Verlassen" # Ende der Optionen ! --------------------------------------------------------- #============================================================================== # ** Window_ShopBuy #------------------------------------------------------------------------------ # This window displays buyable goods on the shop screen. #============================================================================== class Window_ShopBuy < Window_Selectable #-------------------------------------------------------------------------- # * Draw Item # index : item number #-------------------------------------------------------------------------- def draw_item(index) item = @data[index] # Get items in possession case item when RPG::Item number = $game_party.item_number(item.id) when RPG::Weapon number = $game_party.weapon_number(item.id) when RPG::Armor number = $game_party.armor_number(item.id) end # If price is less than money in possession, and amount in possession is # not 99, then set to normal text color. Otherwise set to disabled color if $shop_geschick_aktiv == 1 z = $handelsgeschick_variable @new_itemprice = (item.price*$owners_mood/$game_variables[z]).abs else @new_itemprice = item.price end if @new_itemprice <= $game_party.gold and number < 99 self.contents.font.color = normal_color else self.contents.font.color = disabled_color end x = 4 y = index * 32 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) self.contents.draw_text(x + 28, y, 212, 32, item.name, 0) self.contents.draw_text(x + 240, y, 88, 32, @new_itemprice.to_s, 2) end end #------------------------------------------------------------------------------ # Window_ShopNumber # This window is for inputting quantity of items to buy or sell on the # shop screen. #------------------------------------------------------------------------------ class Window_ShopNumber < Window_Base #-------------------------------------------------------------------------- # * Set Items, Max Quantity, and Price #-------------------------------------------------------------------------- def set(item, max, price, action) @item = item @max = max @price = price @action = action @number = 1 refresh end #-------------------------------------------------------------------------- # * Refresh #-------------------------------------------------------------------------- def refresh self.contents.clear draw_item_name(@item, 4, 96) self.contents.font.color = normal_color self.contents.draw_text(272, 96, 32, 32, "×") self.contents.draw_text(308, 96, 24, 32, @number.to_s, 2) self.cursor_rect.set(304, 96, 32, 32) # Draw total price and currency units domination = $data_system.words.gold cx = contents.text_size(domination).width total_price = @price * @number if @action == 1 self.contents.font.color = normal_color self.contents.draw_text(4, 160, 328-cx-2, 32, total_price.to_s, 2) self.contents.font.color = system_color self.contents.draw_text(332-cx, 160, cx, 32, domination, 2) else if $owners_money < total_price self.contents.font.color = disabled_color self.contents.draw_text(4, 160, 328-cx-2, 32, total_price.to_s, 2) self.contents.draw_text(332-cx, 160, cx, 32, domination, 2) self.contents.font.color = normal_color self.contents.draw_text(4, 192, 500, 32, $owners_name.to_s + $shop_word_kannnichtbezahlen, 0) self.contents.draw_text(4, 224, 500, 32, $shop_word_erhalten + $owners_money.to_s + " "+ domination + "!", 0) else self.contents.font.color = normal_color self.contents.draw_text(4, 160, 328-cx-2, 32, total_price.to_s, 2) self.contents.font.color = system_color self.contents.draw_text(332-cx, 160, cx, 32, domination, 2) end end end end #============================================================================== # ** Window_ShopOwner #------------------------------------------------------------------------------ # Dieses Fenster zeigt sowohl die Eigenschaften des Shopbesitzers als auch # der Party an. #============================================================================== class Window_ShopOwner < Window_Base #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize super(-10, -10, 640, 80) self.contents = Bitmap.new(width - 32, height - 32) refresh end #-------------------------------------------------------------------------- # * Refresh #-------------------------------------------------------------------------- def refresh self.contents.clear bitmap = RPG::Cache.character($owners_pic, 0) self.opacity = 0 self.z = 9999 cw = bitmap.width / 4 ch = bitmap.height / 4 src_rect = Rect.new(0, 0, cw, ch) self.contents.blt(0, 0, bitmap, src_rect) if $shop_geschick_aktiv == 1 if $shop_owner_icons == 1 self.contents.blt(160, 0, RPG::Cache.icon($shop_owner_icons_geschick), Rect.new(0, 0, 32, 32)) self.contents.draw_text(62, -4, 180, 32, $owners_name) self.contents.draw_text(162, -4, 60, 32, $owners_mood.to_s, 2) else self.contents.draw_text(62, -4, 180, 32, $owners_name + " (" + $owners_mood.to_s + ")") end else self.contents.draw_text(62, -4, 180, 32, $owners_name) end if $shop_owner_icons == 1 self.contents.blt(72, 23, RPG::Cache.icon($shop_owner_icons_gold), Rect.new(0, 0, 32, 32)) self.contents.draw_text(102, 20, 180, 32, $owners_money.to_s + " "+ $data_system.words.gold) else self.contents.draw_text(72, 20, 180, 32, $owners_money.to_s + " "+ $data_system.words.gold) end for i in 0...$game_party.actors.size draw_actor_graphic($game_party.actors[i], 300+i*40, 48) end self.contents.font.color = normal_color if $shop_owner_icons == 1 self.contents.blt(470, 1, RPG::Cache.icon($shop_owner_icons_gold), Rect.new(0, 0, 32, 32)) end self.contents.draw_text(380, -4, 170, 32, $game_party.gold.to_s, 2) self.contents.font.color = system_color self.contents.draw_text(560, -4, 170, 32, $data_system.words.gold, 0) if $shop_geschick_aktiv == 1 self.contents.font.color = normal_color if $shop_owner_icons == 1 self.contents.blt(520, 23, RPG::Cache.icon($shop_owner_icons_geschick), Rect.new(0, 0, 32, 32)) self.contents.draw_text(500, 20, 270, 32, " " + $game_variables[$handelsgeschick_variable].to_s, 0) else self.contents.draw_text(490, 20, 270, 32, $shop_word_geschick + $game_variables[$handelsgeschick_variable].to_s, 0) end end end end #============================================================================== # ** Window_ShopStatus #------------------------------------------------------------------------------ # Dieses Fenster zeigt an, wie viele Items eines Typs in Besitz sind und was # sie bewirken. #============================================================================== class Window_ShopStatus < Window_Base #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize super(368, 128, 272, 352) self.contents = Bitmap.new(width - 32, height - 32) refresh end #-------------------------------------------------------------------------- # * Refresh #-------------------------------------------------------------------------- def refresh self.contents.clear atk = 0 pdef1 = 0 mdef1 = 0 change = 0 @str = 0 @agi = 0 @dex = 0 @int = 0 @typ = "" @y_1 = 0 @y_2 = 0 @y_3 = 0 @y_4 = 0 @follow_hp = 0 @follow_sp = 0 @follow_def = 0 if @item == nil self.contents.draw_text(4, 0, 150, 32, "Keine Itemdaten (@item=nil)!") return end if @item == 0 self.contents.draw_text(4, 0, 150, 32, "Keine Itemdaten (@item=0)!") return end if @item.is_a?(RPG::Item) number = $game_party.item_number(@item.id) if $shop_item_anzeigen == 0 @typ = "0" else @typ = $data_system.words.item end end if @item.is_a?(RPG::Weapon) number = $game_party.weapon_number(@item.id) if $shop_waffe_anzeigen == 0 @typ = "0" else @typ = $data_system.words.weapon end end if @item.is_a?(RPG::Armor) number = $game_party.armor_number(@item.id) if $shop_ruestung_anzeigen == 0 @typ = "0" else @typ = $data_armors[@item.id].kind case @typ when 0 @typ = $data_system.words.armor1 when 1 @typ = $data_system.words.armor2 when 2 @typ = $data_system.words.armor3 when 3 @typ = $data_system.words.armor4 end end end if $shop_item_anzeigen == 0 @typ = "0" end @z_i = 0 berechne_y(0) self.contents.font.color = system_color self.contents.font.size = $shop_schrift_itemname self.contents.blt(0,@y_1+3, RPG::Cache.icon(@item.icon_name), Rect.new(0, 0, 24, 24), opacity) self.contents.draw_text(28, @y_1, 212, 32, @item.name) @z_i += 1 berechne_y(0) self.contents.font.size = $shop_schrift_menge_in_besitz self.contents.draw_text(4, 290, 200, 32, $shop_word_menge_in_besitz) self.contents.font.color = normal_color self.contents.draw_text(204, 290, 32, 32, number.to_s, 2) self.contents.font.size = $shop_schrift_hauptattribute @z_i = 0 berechne_y(1) #----------------------------------------------------------------------------- # Fall 1 - Gegenstand ist eine Waffe - Angriffskraft und andere Fähigkeiten # werden geprüft und aufgelistet #----------------------------------------------------------------------------- if @item.is_a?(RPG::Weapon) if $shop_verwendbarkeit_anzeigen == 1 charakter_kann_ausruesten(@y_2) @z_i += 1 berechne_y(1) end atk = @item != nil ? @item.atk : 0 pdef1 = @item != nil ? @item.pdef : 0 mdef1 = @item != nil ? @item.mdef : 0 change = pdef1 + mdef1 # ATK wird geprüft und geschrieben if atk != 0 self.contents.blt(8, @y_2+3, RPG::Cache.icon($shop_eig_icon_angriffskraft), Rect.new(0, 0, 32, 32)) self.contents.draw_text(40, @y_2, 100, 32, atk.to_s, 0) end # Magische und normale Verteidigung wird geprüft und geschrieben if change != 0 self.contents.blt(104, @y_2+3, RPG::Cache.icon($shop_eig_icon_physische_verteidigung), Rect.new(0, 0, 32, 32)) self.contents.draw_text(136, @y_2, 100, 32, change.to_s, 0) end # Attributveränderungen werden geprüft und geschrieben berechne_y(1) @z_i = 0 berechne_y(2) self.contents.font.size = $shop_schrift_magieattribute berechne_y(2) @z_i = 0 berechne_y(3) self.contents.font.size = $shop_schrift_magieattribute attribute_schreiben berechne_y(2) @z_i = 0 berechne_y(3) if $shop_elemente_anzeigen == 1 if $shop_elemente_anzeigen_waffe = 1 self.contents.font.size = $shop_schrift_elemente liste_elemente end end if $shop_status_anzeigen = 1 if $shop_status_anzeigen_waffe = 1 liste_status end end end #----------------------------------------------------------------------------- # Fall 2 - Gegenstand ist eine Rüstung - Magische und normale Verteidigung # werden geprüft und aufgelistet #----------------------------------------------------------------------------- if @item.is_a?(RPG::Armor) if $shop_verwendbarkeit_anzeigen == 1 charakter_kann_ausruesten(@y_2) @z_i += 1 berechne_y(1) end pdef2 = @item != nil ? @item.pdef : 0 mdef2 = @item != nil ? @item.mdef : 0 if pdef2 != 0 self.contents.blt(8, @y_2+3, RPG::Cache.icon($shop_eig_icon_physische_verteidigung), Rect.new(0, 0, 32, 32)) self.contents.draw_text(40, @y_2, 100, 32, pdef2.to_s, 0) end if mdef2 != 0 self.contents.blt(104, @y_2+3, RPG::Cache.icon($shop_eig_icon_magische_verteidigung), Rect.new(0, 0, 32, 32)) self.contents.draw_text(136, @y_2, 100, 32, mdef2.to_s, 0) end berechne_y(1) @z_i = 0 berechne_y(2) self.contents.font.size = $shop_schrift_magieattribute attribute_schreiben berechne_y(2) @z_i = 0 berechne_y(3) if $shop_elemente_anzeigen == 1 if $shop_elemente_anzeigen_armor = 1 self.contents.font.size = $shop_schrift_elemente liste_elemente end end if $shop_status_anzeigen = 1 if $shop_status_anzeigen_armor = 1 liste_status end end end #----------------------------------------------------------------------------- # Fall 3 - Gegenstand ist ein Item - es wird überprüft, ob das Item HP oder # SP heilen kann #----------------------------------------------------------------------------- if @item.is_a?(RPG::Item) if @item.recover_hp != 0 @follow_hp += 1 end if @item.recover_hp_rate != 0 @follow_hp += 2 end if @item.recover_sp != 0 @follow_sp += 1 end if @item.recover_sp_rate != 0 @follow_sp += 2 end if @item.pdef_f != 0 @follow_def += 1 end if @item.mdef_f != 0 @follow_def += 2 end # recover hp if @item.recover_hp != 0 # Anzeige wird nach Vorzeichen optimiert if @item.recover_hp > 0 self.contents.draw_text(32, @y_2, 100, 32, $data_system.words.hp + " + "+@item.recover_hp.to_s, 0) self.contents.blt(8, @y_2+3, RPG::Cache.icon($shop_eig_icon_hp_ändern), Rect.new(0, 0, 32, 32)) else self.contents.blt(8, @y_2+3, RPG::Cache.icon($shop_eig_icon_hpschaden), Rect.new(0, 0, 32, 32)) self.contents.draw_text(32, @y_2, 150, 32, $data_system.words.hp + " "+@item.recover_hp.to_s, 0) end # Zeilensprung wird geprüft if @follow_hp == 1 if @follow_sp > 0 @z_i += 1 berechne_y(1) else if @follow_def > 0 @z_i += 1 berechne_y(1) end end end #--------------------------- end # recover hp rate if @item.recover_hp_rate != 0 # Anzeige wird nach Vorzeichen optimiert if @item.recover_hp_rate > 0 # Anzeige wird nach Anzahl von Informationen optimiert if @follow_hp != 3 self.contents.blt(8, @y_2+3, RPG::Cache.icon($shop_eig_icon_hp_ändern), Rect.new(0, 0, 32, 32)) self.contents.draw_text(32, @y_2, 100, 32, $data_system.words.hp + " + " + @item.recover_hp_rate.to_s + "%", 0) else self.contents.draw_text(120, @y_2, 150, 32, "/ + " + @item.recover_hp_rate.to_s + "%", 0) end #----------------------------- else # Anzeige wird nach Anzahl von Informationen optimiert if @follow_hp != 3 self.contents.blt(8, @y_2+3, RPG::Cache.icon($shop_eig_icon_hpschaden), Rect.new(0, 0, 32, 32)) self.contents.draw_text(32, @y_2, 100, 32, $data_system.words.hp + " " + @item.recover_hp_rate.to_s + "%", 0) else self.contents.draw_text(120, @y_2, 150, 32, "/ " + @item.recover_hp_rate.to_s + "%", 0) end #----------------------------------------------- end # Zeilensprung wird geprüft if @follow_hp > 1 if @follow_sp > 0 @z_i += 1 berechne_y(1) else if @follow_def > 0 @z_i += 1 berechne_y(1) end end end #--------------------- end # recover sp if @item.recover_sp != 0 # Anzeige wird nach Vorzeichen optimiert if @item.recover_sp > 0 self.contents.blt(8, @y_2+3, RPG::Cache.icon($shop_eig_icon_sp_ändern), Rect.new(0, 0, 32, 32)) self.contents.draw_text(32, @y_2, 100, 32, $data_system.words.sp + " + "+@item.recover_sp.to_s, 0) else self.contents.blt(8, @y_2+3, RPG::Cache.icon($shop_eig_icon_spschaden), Rect.new(0, 0, 32, 32)) self.contents.draw_text(32, @y_2, 150, 32, $data_system.words.sp + " "+@item.recover_sp.to_s, 0) end # Zeilensprung wird geprüft if @follow_sp == 1 if @follow_def > 0 @z_i += 1 berechne_y(1) end end #------------------- end # recover sp rate if @item.recover_sp_rate != 0 # Anzeige wird nach Vorzeichen optimiert if @item.recover_sp_rate > 0 # Anzeige wird nach Anzahl von Informationen optimiert if @follow_sp != 3 self.contents.blt(8, @y_2+3, RPG::Cache.icon($shop_eig_icon_sp_ändern), Rect.new(0, 0, 32, 32)) self.contents.draw_text(32, @y_2, 150, 32, $data_system.words.sp + " + " + @item.recover_sp_rate.to_s + "%", 0) else self.contents.draw_text(120, @y_2, 150, 32, "/ + " + @item.recover_sp_rate.to_s + "%", 0) end #------ else # Anzeige wird nach Anzahl von Informationen optimiert if @follow_sp != 3 self.contents.blt(8, @y_2+3, RPG::Cache.icon($shop_eig_icon_spschaden), Rect.new(0, 0, 32, 32)) self.contents.draw_text(32, @y_2, 150, 32, $data_system.words.sp + " " + @item.recover_sp_rate.to_s + "%", 0) else self.contents.draw_text(120, @y_2, 150, 32, "/ " +@item.recover_sp_rate.to_s + "%", 0) end #--------- end # Zeilensprung wird geprüft if @follow_sp > 1 if @follow_def > 0 @z_i += 1 berechne_y(1) end end #----------- end # physical defense if @item.pdef_f != 0 self.contents.blt(8, @y_2+3, RPG::Cache.icon($shop_eig_icon_physische_verteidigung), Rect.new(0, 0, 32, 32)) self.contents.draw_text(40, @y_2, 32, 32, @item.pdef_f.to_s, 0) # Zeilensprung wird geprüft if @follow_def == 1 if @item.parameter_type > 0 @z_i += 1 berechne_y(1) end end #------------ end # magic defense if @item.mdef_f != 0 self.contents.blt(104, @y_2+3, RPG::Cache.icon($shop_eig_icon_magische_verteidigung), Rect.new(0, 0, 32, 32)) self.contents.draw_text(136, @y_2, 32, 32, @item.mdef_f.to_s, 0) # Zeilensprung wird geprüft if @follow_def > 1 if @item.parameter_type > 0 @z_i += 1 berechne_y(1) end end #------------ end if @item.parameter_type == 0 @z_i = 0 berechne_y(2) end #Attributänderung durch Item wird geprüft if @item.parameter_type != 0 case @item.parameter_type when 1 @para_word = $shop_word_maximal + $data_system.words.hp when 2 @para_word = $shop_word_maximal + $data_system.words.sp when 3 @para_word = $data_system.words.str when 4 @para_word = $data_system.words.dex when 5 @para_word = $data_system.words.agi when 6 @para_word = $data_system.words.int end if @item.parameter_points > 0 self.contents.draw_text(32, @y_2, 100, 32, @para_word + " + " + @item.parameter_points.to_s, 0) else self.contents.draw_text(32, @y_2, 100, 32, @para_word + " " + @item.parameter_points.to_s, 0) end self.contents.blt(8, @y_2+3, RPG::Cache.icon($shop_eig_icon_magische_attribute), Rect.new(0, 0, 32, 32)) @z_i = 0 berechne_y(2) end if $shop_verwendbarkeit_anzeigen_item == 1 #Anwendungsziele des Items werden geprüft if @item.scope != 0 self.contents.blt(8, @y_3+3, RPG::Cache.icon($shop_eig_icon_ziel), Rect.new(0, 0, 32, 32)) case @item.scope when 1 @nutzer = $shop_word_ein_feind when 2 @nutzer = $shop_word_gruppe_feinde when 3 @nutzer = $shop_word_ein_freund when 4 @nutzer = $shop_word_alle_freunde when 5 @nutzer = $shop_word_toter_Freund when 6 @nutzer = $shop_word_tote_Freunde when 7 @nutzer = $shop_word_selbst end self.contents.draw_text(40, @y_3, 220, 32, @nutzer, 0) if $shop_elemente_anzeigen == 1 if $shop_elemente_anzeigen_item = 1 if @item.element_set.size != 0 @z_i += 1 berechne_y(2) end end end end end @z_i = 0 berechne_y(3) #Elementattribute des Items werden geprüft if $shop_elemente_anzeigen == 1 if $shop_elemente_anzeigen_item = 1 self.contents.font.size = $shop_schrift_elemente liste_elemente end end if $shop_status_anzeigen = 1 if $shop_status_anzeigen_item = 1 liste_status end end end end #------------------------------------------------------------------------ # Elemente auflisten #------------------------------------------------------------------------ def liste_elemente if @item.is_a?(RPG::Armor) @item_size = @item.guard_element_set.size @el_wort = $shop_word_resistenz else @item_size = @item.element_set.size @el_wort = $shop_word_element end if @item_size != 0 self.contents.blt(8, @y_4+7, RPG::Cache.icon($shop_eig_icon_elemente), Rect.new(0, 0, 32, 32)) self.contents.draw_text(40, @y_4, 150, 32, @el_wort, 0) @z_i += 1 berechne_y(3) end @elemente_liste = "" @elemente_liste2 = "" @elemente_liste3 = "" a = 0 if @item.is_a?(RPG::Armor) # Fall 1 - Item ist eine Rüstung for e in 0...@item_size if @item.guard_element_set[e] != nil if @item.guard_element_set[e] != 0 if e <= 3 if a != 0 @elemente_liste += "/" end a += 1 @elemente_liste += $data_system.elements[@item.guard_element_set[e]].to_s else if e <= 7 if a != 4 @elemente_liste2 += "/" end a += 1 @elemente_liste2 += $data_system.elements[@item.guard_element_set[e]].to_s else if a != 8 @elemente_liste3 += "/" end a += 1 @elemente_liste3 += $data_system.elements[@item.guard_element_set[e]].to_s end end end end end # Fall 2 - Item ist keine Rüstung else for e in 0...@item.element_set.size if @item.element_set[e] != nil if @item.element_set[e] != 0 if e <= 3 if a != 0 @elemente_liste += "/" end a += 1 @elemente_liste += $data_system.elements[@item.element_set[e]].to_s else if e <= 7 if a != 4 @elemente_liste2 += "/" end a += 1 @elemente_liste2 += $data_system.elements[@item.element_set[e]].to_s else if a != 8 @elemente_liste3 += "/" end a += 1 @elemente_liste3 += $data_system.elements[@item.element_set[e]].to_s end end end end end end self.contents.draw_text(40, @y_4, 200, 32, @elemente_liste, 0) @z_i += 1 berechne_y(3) self.contents.draw_text(40, @y_4, 200, 32, @elemente_liste2, 0) if @elemente_liste3 != "" @z_i += 1 berechne_y(3) end if @elemente_liste3 != "" self.contents.draw_text(40, @y_4, 200, 32, @elemente_liste3, 0) @z_i += 1 berechne_y(3) end end #------------------------------------------------------------------------ # Status auflisten #------------------------------------------------------------------------ def liste_status if @item.is_a?(RPG::Armor) @item_size_s = @item.guard_state_set @el_wort_s = "Status Verteidigung" else @item_size_s = @item.minus_state_set @item_size_s2 = @item.plus_state_set @el_wort_s = "Heilt Status" @el_wort_s2 = "Erzeugt Status" end @status_liste = "" @status_liste2 = "" @status_liste3 = "" @status_liste4 = "" @status_liste5 = "" @status_liste6 = "" a = 0 if @item.is_a?(RPG::Armor) # Fall 1 - Item ist eine Rüstung for e in @item_size_s if @item.guard_state_set[e] != nil if @item.guard_state_set[e] != 0 if e <= 3 # Prüft, ob ein Zeilenanfang besteht => ansonsten Slash setzen if a != 0 @status_liste += "/" end a += 1 # Statusnamen hinzufügen @status_liste += $data_states[e].name else if e <= 7 if a != 5 @status_liste2 += "/" end a += 1 # Statusnamen hinzufügen @status_liste2 += $data_states[e].name else if a != 8 @elemente_liste3 += "/" end a += 1 # Statusnamen hinzufügen @status_liste3 += $data_states[e].name end end end end end # Fall 2 - Item ist keine Rüstung else #Statusheilungen for e in @item_size_s if a <= 3 if a != 0 @status_liste += "/" end a += 1 # Statusnamen hinzufügen @status_liste += $data_states[e].name else if a <= 7 if a != 4 @status_liste2 += "/" end a += 1 # Statusnamen hinzufügen @status_liste2 += $data_states[e].name else if a != 8 @elemente_liste3 += "/" end a += 1 # Statusnamen hinzufügen @status_liste3 += $data_states[e].name end end end a = 0 # Erzeugt Status for e in @item_size_s2 if a <= 3 if a != 0 @status_liste3 += "/" end a += 1 @status_liste3 += $data_states[e].name else if a <= 7 if a != 4 @status_liste4 += "/" end a += 1 @status_liste4 += $data_states[e].name else if a != 8 @elemente_liste5 += "/" end a += 1 @status_liste5 += $data_states[e].name end end end end # Rüstung ----------------------------------------------- if @item.is_a?(RPG::Armor) if @status_liste != "" self.contents.blt(8, @y_4+7, RPG::Cache.icon($shop_eig_icon_elemente), Rect.new(0, 0, 32, 32)) self.contents.draw_text(40, @y_4, 150, 32, @el_wort_s, 0) @z_i += 1 berechne_y(3) self.contents.draw_text(40, @y_4, 200, 32, @status_liste, 0) @z_i += 1 berechne_y(3) if @status_liste2 != "" self.contents.draw_text(40, @y_4, 200, 32, @status_liste2, 0) @z_i += 1 berechne_y(3) end if @status_liste3 != "" self.contents.draw_text(40, @y_4, 200, 32, @status_liste3, 0) end end # --------------------------------------------------------- else if @status_liste != "" self.contents.blt(8, @y_4+7, RPG::Cache.icon($shop_eig_icon_elemente), Rect.new(0, 0, 32, 32)) self.contents.draw_text(40, @y_4, 150, 32, @el_wort_s, 0) @z_i += 1 berechne_y(3) self.contents.draw_text(40, @y_4, 200, 32, @status_liste, 0) @z_i += 1 berechne_y(3) if @status_liste2 != "" self.contents.draw_text(40, @y_4, 200, 32, @status_liste2, 0) @z_i += 1 berechne_y(3) end if @status_liste3 != "" self.contents.draw_text(40, @y_4, 200, 32, @status_liste3, 0) @z_i += 1 berechne_y(3) end end if @status_liste3 != "" self.contents.blt(8, @y_4+7, RPG::Cache.icon($shop_eig_icon_elemente), Rect.new(0, 0, 32, 32)) self.contents.draw_text(40, @y_4, 150, 32, @el_wort_s2, 0) @z_i += 1 berechne_y(3) self.contents.draw_text(40, @y_4, 200, 32, @status_liste3, 0) @z_i += 1 berechne_y(3) if @status_liste4 != "" self.contents.draw_text(40, @y_4, 200, 32, @status_liste4, 0) @z_i += 1 berechne_y(3) end if @status_liste5 != "" self.contents.draw_text(40, @y_4, 200, 32, @status_liste5, 0) end end end end #-------------------------------------------------------------------------- # * Set Items #-------------------------------------------------------------------------- def set(item) @item = item refresh end #------------------------------------------------------------------------- # y-Werte neu berechnen #------------------------------------------------------------------------- def berechne_y(wert) case wert when 0 @y_1 = @z_i*($shop_schrift_itemname+10) when 1 @y_2 = @y_1 + @z_i*($shop_schrift_hauptattribute+10) when 2 @y_3 = @y_1 + @y_2 + @z_i*($shop_schrift_magieattribute+6) when 3 @y_4 = @y_3 + @z_i*($shop_schrift_elemente+5) end end #------------------------------------ # Wer kann welche Rüstung/Waffe tragen? #------------------------------------------ def charakter_kann_ausruesten(y) @ausruesten_charaktere = "" a = 0 for i in 0...$game_party.actors.size @actor = $game_party.actors[i] if @actor.equippable?(@item) if a != 0 @ausruesten_charaktere += "/" end a += 1 @ausruesten_charaktere += @actor.name end end if @ausruesten_charaktere == "" if @typ != "0" @ausruesten_charaktere += @typ end else if @typ != "0" @ausruesten_charaktere += " - " + @typ end end if @ausruesten_charaktere != nil if @ausruesten_charaktere != "" self.contents.blt(8, y+3, RPG::Cache.icon($shop_eig_icon_ziel), Rect.new(0, 0, 32, 32)) self.contents.draw_text(40, y, 200, 32, @ausruesten_charaktere) end end end #------------------------------------ #Attributänderungen schreiben #------------------------------------ def attribute_schreiben @str += @item != nil ? @item.str_plus : 0 @agi += @item != nil ? @item.agi_plus : 0 @dex += @item != nil ? @item.dex_plus : 0 @int += @item != nil ? @item.int_plus : 0 # Stärke if @str != 0 self.contents.blt(8, @y_3+3, RPG::Cache.icon($shop_eig_icon_magische_attribute), Rect.new(0, 0, 32, 32)) if @str < 0 self.contents.draw_text(40, @y_3, 200, 32, $data_system.words.str + " " + v.to_s) else self.contents.draw_text(40, @y_3, 200, 32, $data_system.words.str + " + " + @str.to_s) end @z_i += 1 berechne_y(2) end # Geschick if @agi != 0 if @z_i == 0 self.contents.blt(8, @y_3+3, RPG::Cache.icon($shop_eig_icon_magische_attribute), Rect.new(0, 0, 32, 32)) end if @agi < 0 self.contents.draw_text(40, @y_3, 200, 32, $data_system.words.agi + " " + @agi.to_s) else self.contents.draw_text(40, @y_3, 200, 32, $data_system.words.agi + " + " + @agi.to_s) end @z_i += 1 berechne_y(2) end # Verteidigung if @dex != 0 if @z_i == 0 self.contents.blt(8, @y_3+3, RPG::Cache.icon($shop_eig_icon_magische_attribute), Rect.new(0, 0, 32, 32)) end if @dex < 0 self.contents.draw_text(40, @y_3, 200, 32, $data_system.words.dex + " " + @dex.to_s) else self.contents.draw_text(40, @y_3, 200, 32,$data_system.words.dex + " + " + @dex.to_s) end @z_i += 1 berechne_y(2) end # Intelligenz if @int != 0 if @z_i == 0 self.contents.blt(8, @y_3+3, RPG::Cache.icon($shop_eig_icon_magische_attribute), Rect.new(0, 0, 32, 32)) end if @int < 0 self.contents.draw_text(40, @y_3, 200, 32, $data_system.words.int + " " + @int.to_s) else self.contents.draw_text(40, @y_3, 200, 32, $data_system.words.int + " + " + @int.to_s) end @z_i += 1 berechne_y(2) end end end #============================================================================== # ** Scene_Shop #------------------------------------------------------------------------------ # This class performs shop screen processing. #============================================================================== class Scene_Shop #-------------------------------------------------------------------------- # * Main Processing #-------------------------------------------------------------------------- def main # Make help window $shop_wertverfall = 2 @help_window = Window_ShopHelp.new @help_window.visible = false @help_window.z = 90000 # Make command window @command_window = Window_ShopCommand.new # Make owner window @owner_window = Window_ShopOwner.new @owner_window.visible = true @owner_window.active = true # Make dummy windows @dummy_window = Window_Base.new(0, 128, 640, 352) @dummy_window2 = Window_Base.new(0, 0, 250, 64) @dummy_window3 = Window_Base.new(250, 0, 390, 64) # Make buy window @buy_window = Window_ShopBuy.new($game_temp.shop_goods) @buy_window.active = false @buy_window.visible = false @buy_window.help_window = @help_window # Make sell window @sell_window = Window_ShopSell.new @sell_window.active = false @sell_window.visible = false @sell_window.help_window = @help_window # Make quantity input window @number_window = Window_ShopNumber.new @number_window.active = false @number_window.visible = false # Make status window @status_window = Window_ShopStatus.new @status_window.visible = false # Execute transition Graphics.transition # Main loop loop do # Update game screen Graphics.update # Update input information Input.update # Frame update update # Abort loop if screen is changed if $scene != self break end end # Prepare for transition Graphics.freeze # Dispose of windows @help_window.dispose @owner_window.dispose @command_window.dispose @dummy_window.dispose @dummy_window2.dispose @dummy_window3.dispose @buy_window.dispose @sell_window.dispose @number_window.dispose @status_window.dispose end #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update # Update windows @help_window.update @command_window.update @dummy_window.update @dummy_window2.update @dummy_window3.update @buy_window.update @sell_window.update @number_window.update @status_window.update # If command window is active: call update_command if @command_window.active update_command return end # If buy window is active: call update_buy if @buy_window.active update_buy return end # If sell window is active: call update_sell if @sell_window.active update_sell return end # If quantity input window is active: call update_number if @number_window.active update_number return end end #-------------------------------------------------------------------------- # * Frame Update (when command window is active) #-------------------------------------------------------------------------- def update_command @help_window.visible = false # If B button was pressed if Input.trigger?(Input::B) # Play cancel SE $game_system.se_play($data_system.cancel_se) # Switch to map screen $scene = Scene_Map.new return end # If C button was pressed if Input.trigger?(Input::C) # Branch by command window cursor position case @command_window.index when 0 # buy # Play decision SE $game_system.se_play($data_system.decision_se) # Change windows to buy mode @command_window.active = false @help_window.visible = true @dummy_window.visible = false @buy_window.active = true @buy_window.visible = true @buy_window.refresh @owner_window.refresh @status_window.visible = true when 1 # sell # Play decision SE $game_system.se_play($data_system.decision_se) # Change windows to sell mode @command_window.active = false @help_window.visible = true @dummy_window.visible = false @sell_window.active = true @sell_window.visible = true @sell_window.refresh when 2 # quit # Play decision SE $game_system.se_play($data_system.decision_se) # Switch to map screen $scene = Scene_Map.new end return end end #-------------------------------------------------------------------------- # * Frame Update (when buy window is active) #-------------------------------------------------------------------------- def update_buy # Set status window item @status_window.set(@buy_window.item) # If B button was pressed if Input.trigger?(Input::B) # Play cancel SE $game_system.se_play($data_system.cancel_se) # Change windows to initial mode @command_window.active = true @help_window.visible = false @help_window.update @dummy_window.visible = true @buy_window.active = false @buy_window.visible = false @status_window.visible = false @owner_window.refresh @status_window.item = nil # Erase help text @help_window.set_text("") return end # If C button was pressed if Input.trigger?(Input::C) # Get item @item = @buy_window.item if $shop_geschick_aktiv == 1 z = $handelsgeschick_variable @new_itemprice = (@item.price*$owners_mood/$game_variables[z]).abs else @new_itemprice = @item.price end # If item is invalid, or price is higher than money possessed if @item == nil or @new_itemprice > $game_party.gold # Play buzzer SE $game_system.se_play($data_system.buzzer_se) return end # Get items in possession count case @item when RPG::Item number = $game_party.item_number(@item.id) when RPG::Weapon number = $game_party.weapon_number(@item.id) when RPG::Armor number = $game_party.armor_number(@item.id) end # If 99 items are already in possession if number == 99 # Play buzzer SE $game_system.se_play($data_system.buzzer_se) return end # Play decision SE $game_system.se_play($data_system.decision_se) # Calculate maximum amount possible to buy max = @new_itemprice == 0 ? 99 : $game_party.gold / @new_itemprice max = [max, 99 - number].min # Change windows to quantity input mode @buy_window.active = false @buy_window.visible = false @number_window.set(@item, max, @new_itemprice, 1) @number_window.active = true @number_window.visible = true end end #-------------------------------------------------------------------------- # * Frame Update (when sell window is active) #-------------------------------------------------------------------------- def update_sell # If B button was pressed if Input.trigger?(Input::B) # Play cancel SE $game_system.se_play($data_system.cancel_se) # Change windows to initial mode @command_window.active = true @dummy_window.visible = true @sell_window.active = false @sell_window.visible = false @help_window.visible = false @status_window.item = nil # Erase help text @help_window.set_text("") return end # If C button was pressed if Input.trigger?(Input::C) # Get item @item = @sell_window.item # Set status window item @status_window.item = @item @status_window.set(@item) # If item is invalid, or item price is 0 (unable to sell) if @item == nil or @item.price == 0 # Play buzzer SE $game_system.se_play($data_system.buzzer_se) return end # Play decision SE $game_system.se_play($data_system.decision_se) # Get items in possession count case @item when RPG::Item number = $game_party.item_number(@item.id) when RPG::Weapon number = $game_party.weapon_number(@item.id) when RPG::Armor number = $game_party.armor_number(@item.id) end # Maximum quanitity to sell = number of items in possession max = number # Change windows to quantity input mode @sell_window.active = false @sell_window.visible = false if $shop_geschick_aktiv == 1 z = $handelsgeschick_variable @new_itemprice = (@item.price/$owners_mood*$game_variables[z]).abs @new_itemprice /= $shop_wertverfall else @new_itemprice = @item.price/$shop_wertverfall end @number_window.set(@item, max, @new_itemprice, 2) @number_window.active = true @number_window.visible = true @status_window.visible = true end end #-------------------------------------------------------------------------- # * Frame Update (when quantity input window is active) #-------------------------------------------------------------------------- def update_number # If B button was pressed if Input.trigger?(Input::B) # Play cancel SE $game_system.se_play($data_system.cancel_se) # Set quantity input window to inactive / invisible @number_window.active = false @number_window.visible = false # Branch by command window cursor position case @command_window.index when 0 # buy # Change windows to buy mode @buy_window.active = true @buy_window.visible = true when 1 # sell # Change windows to sell mode @sell_window.active = true @sell_window.visible = true @status_window.visible = false end return end # If C button was pressed if Input.trigger?(Input::C) # Play shop SE $game_system.se_play($data_system.shop_se) # Set quantity input window to inactive / invisible @number_window.active = false @number_window.visible = false # Branch by command window cursor position case @command_window.index when 0 # buy # Buy process if $shop_geschick_aktiv == 1 z = $handelsgeschick_variable @new_itemprice = (@item.price*$owners_mood/$game_variables[z]).abs @new_itemprice *= @number_window.number else @new_itemprice = @number_window.number*@item.price end $game_party.lose_gold(@new_itemprice) case @item when RPG::Item $game_party.gain_item(@item.id, @number_window.number) when RPG::Weapon $game_party.gain_weapon(@item.id, @number_window.number) when RPG::Armor $game_party.gain_armor(@item.id, @number_window.number) end # Refresh each window @buy_window.refresh @status_window.refresh @owner_window.refresh # Change windows to buy mode @buy_window.active = true @buy_window.visible = true when 1 # sell # Sell process if $shop_geschick_aktiv == 1 z = $handelsgeschick_variable @new_itemprice = (@item.price/$owners_mood*$game_variables[z]/$shop_wertverfall).abs @new_itemprice *= @number_window.number else @new_itemprice = @number_window.number*@item.price end if $owners_money >= @new_itemprice $game_party.gain_gold(@new_itemprice) else $game_party.gain_gold($owners_money) end case @item when RPG::Item $game_party.lose_item(@item.id, @number_window.number) when RPG::Weapon $game_party.lose_weapon(@item.id, @number_window.number) when RPG::Armor $game_party.lose_armor(@item.id, @number_window.number) end # Refresh each window @sell_window.refresh @status_window.refresh @owner_window.refresh # Change windows to sell mode @sell_window.active = true @sell_window.visible = true @status_window.visible = false end return end end end #============================================================================== # ** Window_ShopHelp #------------------------------------------------------------------------------ # This window shows skill and item explanations along with actor status. #============================================================================== class Window_ShopHelp < Window_Base #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize super(0, 64, 640, 64) self.contents = Bitmap.new(width - 32, height - 32) end #-------------------------------------------------------------------------- # * Set Text # text : text string displayed in window # align : alignment (0..flush left, 1..center, 2..flush right) #-------------------------------------------------------------------------- def set_text(text, align = 0) # If at least one part of text and alignment differ from last time if text != @text or align != @align # Redraw text self.contents.clear self.contents.font.color = normal_color self.contents.draw_text(4, 0, self.width - 40, 32, text, align) @text = text @align = align @actor = nil end self.visible = true end end #============================================================================== # ** Window_ShopCommand #------------------------------------------------------------------------------ # This window is used to choose your business on the shop screen. #============================================================================== class Window_ShopCommand < Window_Selectable #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize super(0, 64, 640, 64) self.contents = Bitmap.new(width - 32, height - 32) @item_max = 3 @column_max = 4 @commands = [$shop_word_buy, $shop_word_sell, $shop_word_leave] refresh self.index = 0 end end #============================================================================== # ** Window_ShopSell #------------------------------------------------------------------------------ # This window displays items in possession for selling on the shop screen. #============================================================================== class Window_ShopSell < Window_Selectable #-------------------------------------------------------------------------- # * Refresh #-------------------------------------------------------------------------- def refresh if self.contents != nil self.contents.dispose self.contents = nil end @data = [] case $owners_sortiment when 1 for i in 1...$data_items.size if $game_party.item_number(i) > 0 @data.push($data_items[i]) end end when 2 for i in 1...$data_weapons.size if $game_party.weapon_number(i) > 0 @data.push($data_weapons[i]) end end when 3 for i in 1...$data_armors.size if $game_party.armor_number(i) > 0 @data.push($data_armors[i]) end end when 12 for i in 1...$data_items.size if $game_party.item_number(i) > 0 @data.push($data_items[i]) end end for i in 1...$data_weapons.size if $game_party.weapon_number(i) > 0 @data.push($data_weapons[i]) end end when 13 for i in 1...$data_items.size if $game_party.item_number(i) > 0 @data.push($data_items[i]) end end for i in 1...$data_armors.size if $game_party.armor_number(i) > 0 @data.push($data_armors[i]) end end when 23 for i in 1...$data_weapons.size if $game_party.weapon_number(i) > 0 @data.push($data_weapons[i]) end end for i in 1...$data_armors.size if $game_party.armor_number(i) > 0 @data.push($data_armors[i]) end end when 123 for i in 1...$data_items.size if $game_party.item_number(i) > 0 @data.push($data_items[i]) end end for i in 1...$data_weapons.size if $game_party.weapon_number(i) > 0 @data.push($data_weapons[i]) end end for i in 1...$data_armors.size if $game_party.armor_number(i) > 0 @data.push($data_armors[i]) end end end # If item count is not 0, m