Dark_htf membre très actif
Nombre de messages : 205 Date d'inscription : 23/06/2007
| Sujet: Des super beaux scripts Sam 23 Juin - 17:53 | |
| Ici je vais mettre des script d'un certain MOGHUNTER qui sont super beaux. Pour commencer le script d'un magasin, placer le au-dessu de main, appelez le MOG Scene Shop.Puis supprimez le script de base Window_ShopStatus - Code:
-
#_______________________________________________________________________________ # MOG Scene Shop V1.0 #_______________________________________________________________________________ # By Moghunter #_______________________________________________________________________________ if true module MOG #Temps de transition. MNSHPT= 30 #Type de transition MNSHPTT= "006-Stripe02" end $mogscript = {} if $mogscript == nil $mogscript["menu_"] = true ############### # Window_Base # ############### class Window_Base < Window def draw_item_name_ex(item, x, y) if item == nil return end bitmap = RPG::Cache.icon(item.icon_name) self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24)) self.contents.font.color = normal_color self.contents.draw_text(x + 28, y, 150, 32, item.name) end def nada face = RPG::Cache.picture("") end def drw_face(actor,x,y) face = RPG::Cache.picture(actor.name + "_fc") rescue nada cw = face.width ch = face.height src_rect = Rect.new(0, 0, cw, ch) self.contents.blt(x , y - ch, face, src_rect) end end ################ # Win_Shop_Sel # ################ class Win_Shop_Sel < Window_Base attr_reader :index def initialize(x, y, width, height) super(x, y, width, height) @item_max = 1 @column_max = 1 @index = -1 end def index=(index) @index = index update_cursor_rect end def row_max return (@item_max + @column_max - 1) / @column_max end def top_row return self.oy / 32 end def top_row=(row) if row < 0 row = 0 end if row > row_max - 1 row = row_max - 1 end self.oy = row * 32 end def page_row_max return (self.height - 32) / 32 end def page_item_max return page_row_max * @column_max end def update_cursor_rect if @index < 0 self.cursor_rect.empty return end row = @index / @column_max if row < self.top_row self.top_row = row end if row > self.top_row + (self.page_row_max - 1) self.top_row = row - (self.page_row_max - 1) end cursor_width = self.width / @column_max - 32 x = @index % @column_max * 80 y = @index / @column_max * 32 - self.oy self.cursor_rect.set(x, y, 32, 32) end def update super if self.active and @item_max > 0 and @index >= 0 if Input.repeat?(Input::RIGHT) if @column_max >= 2 and @index < @item_max - 1 $game_system.se_play($data_system.cursor_se) @index += 1 end end if Input.repeat?(Input::LEFT) if @column_max >= 2 and @index > 0 $game_system.se_play($data_system.cursor_se) @index -= 1 end end end update_cursor_rect end end ###################### # Window_ShopCommand # ###################### class Window_ShopCommand < Win_Shop_Sel def initialize super(58, 68, 230, 64) self.contents = Bitmap.new(width - 32, height - 32) @item_max = 3 @column_max = 3 @commands = ["", "", ""] self.index = 0 end end ################## # Window_ShopBuy # ################## class Window_ShopBuy < Window_Selectable def initialize(shop_goods) super(-10, 180, 310, 225) @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 = [] 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 if @item_max > 0 self.contents = Bitmap.new(width - 32, row_max * 32) for i in 0...@item_max draw_item(i) end end end def draw_item(index) self.contents.font.name = "Georgia" self.contents.font.bold = false item = @data[index] 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 x = 4 y = index * 32 if item.price <= $game_party.gold and 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) self.contents.draw_text(x + 28, y, 150, 32, item.name, 0) self.contents.font.color = Color.new(50,250,150,255) self.contents.draw_text(x + 150, y, 88, 32, "G", 1) if item.price <= $game_party.gold if number < 99 self.contents.font.color = Color.new(200,200,50,255) else self.contents.font.color = disabled_color end else self.contents.font.color = Color.new(250,100,50,255) end self.contents.draw_text(x + 180, 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(-10, 180, 305, 225) @column_max = 1 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 = [] 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 @item_max = @data.size if @item_max > 0 self.contents = Bitmap.new(width - 32, row_max * 32) for i in 0...@item_max draw_item(i) end end end def draw_item(index) item = @data[index] 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 item.price > 0 self.contents.font.color = normal_color else self.contents.font.color = disabled_color end self.contents.font.name = "Georgia" x = 4 + index % 1 * (288 + 32) y = index / 1 * 32 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) self.contents.draw_text(x + 28, y, 150, 32, item.name, 0) self.contents.draw_text(x + 230, 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(-10, 180, 310, 225) self.contents = Bitmap.new(width - 32, height - 32) @item = nil @max = 1 @price = 0 @number = 1 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.name = "Georgia" self.contents.font.bold = true draw_item_name_ex(@item, 4, 66) self.contents.font.color = Color.new(50,150,250,255) self.contents.draw_text(185, 66, 32, 32, "x") self.contents.font.color = normal_color self.contents.draw_text(208, 66, 24, 32, @number.to_s, 2) self.cursor_rect.set(304, 66, 32, 32) total_price = @price * @number cx = contents.text_size("G").width self.contents.font.color = Color.new(200,200,50,255) self.contents.draw_text(4, 160, 228-2, 32, total_price.to_s, 2) self.contents.font.color = Color.new(50,250,150,255) self.contents.draw_text(90, 160, 88, 32, "G", 1) end def update super if self.active if Input.repeat?(Input::RIGHT) and @number < @max $game_system.se_play($data_system.cursor_se) @number += 1 refresh end if Input.repeat?(Input::LEFT) and @number > 1 $game_system.se_play($data_system.cursor_se) @number -= 1 refresh end if Input.repeat?(Input::UP) and @number < @max $game_system.se_play($data_system.cursor_se) @number = [@number + 10, @max].min refresh end if Input.repeat?(Input::DOWN) and @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(300, 128, 350, 300) self.contents = Bitmap.new(width - 32, height - 32) @item = nil refresh end def refresh self.contents.clear self.contents.font.name = "Georgia" if @item == nil return end 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 self.contents.font.color = system_color self.contents.draw_text(210, 0, 200, 32, "Stock") self.contents.font.color = normal_color self.contents.draw_text(245, 0, 32, 32, number.to_s, 2) if @item.is_a?(RPG::Item) return end for i in 0...$game_party.actors.size 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(65, 0, 100, 32, "Equipped", 2) drw_face(actor,0 ,80 + 64 * i) 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 pdef1 = item1 != nil ? item1.pdef : 0 mdef1 = item1 != nil ? item1.mdef : 0 pdef2 = @item != nil ? @item.pdef : 0 mdef2 = @item != nil ? @item.mdef : 0 self.contents.draw_text(-20, 50 + 64 * i, 112, 32,"Atk", 2) self.contents.draw_text(70, 50 + 64 * i, 112, 32,"Pdef", 2) self.contents.draw_text(160, 50 + 64 * i, 112, 32,"Mdef", 2) change = atk2 - atk1 change2 = pdef2 - pdef1 change3 = mdef2 - mdef1 if atk2 > atk1 self.contents.font.color = Color.new(50,250,150,255) elsif atk2 == atk1 self.contents.font.color = disabled_color else self.contents.font.color = Color.new(250,100,50,255) end self.contents.draw_text(20, 50 + 64 * i, 112, 32,sprintf("%d", change), 2) if pdef2 > pdef1 self.contents.font.color = Color.new(50,250,150,255) elsif pdef2 == pdef1 self.contents.font.color = disabled_color else self.contents.font.color = Color.new(250,100,50,255) end self.contents.draw_text(110, 50 + 64 * i, 112, 32,sprintf("%d", change2), 2) if mdef2 > mdef1 self.contents.font.color = Color.new(50,250,150,255) elsif mdef2 == mdef1 self.contents.font.color = disabled_color else self.contents.font.color = Color.new(250,100,50,255) end self.contents.draw_text(200, 50 + 64 * i, 112, 32,sprintf("%d", change3), 2) end if @item.is_a?(RPG::Armor) pdef1 = item1 != nil ? item1.pdef : 0 mdef1 = item1 != nil ? item1.mdef : 0 eva1 = item1 != nil ? item1.eva : 0 pdef2 = @item != nil ? @item.pdef : 0 mdef2 = @item != nil ? @item.mdef : 0 eva2 = @item != nil ? @item.eva : 0 change = pdef2 - pdef1 change2 = mdef2 - mdef1 change3 = eva2 - eva1 self.contents.draw_text(-20, 50 + 64 * i, 112, 32,"Pdef", 2) self.contents.draw_text(70, 50 + 64 * i, 112, 32,"Mdef", 2) self.contents.draw_text(160, 50 + 64 * i, 112, 32,"Eva", 2) if pdef2 > pdef1 self.contents.font.color = Color.new(50,250,150,255) elsif pdef2 == pdef1 self.contents.font.color = disabled_color else self.contents.font.color = Color.new(250,100,50,255) end self.contents.draw_text(20, 50 + 64 * i, 112, 32,sprintf("%d", change), 2) if mdef2 > mdef1 self.contents.font.color = Color.new(50,250,150,255) elsif mdef2 == mdef1 self.contents.font.color = disabled_color else self.contents.font.color = Color.new(250,100,50,255) end self.contents.draw_text(110, 50 + 64 * i, 112, 32,sprintf("%d", change2), 2) if eva2 > eva1 self.contents.font.color = Color.new(50,250,150,255) elsif eva2 == eva1 self.contents.font.color = disabled_color else self.contents.font.color = Color.new(250,100,50,255) end self.contents.draw_text(200, 50 + 64 * i, 112, 32,sprintf("%d", change3), 2) end end if item1 != nil if actor.equippable?(@item) self.contents.font.color = normal_color else self.contents.font.color = disabled_color end 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 + 50, y - 35, bitmap, Rect.new(0, 0, 24, 24), opacity) self.contents.draw_text(x + 75, y - 40, 212, 32, item1.name) end end end def item=(item) if @item != item @item = item refresh end end end
Dernière édition par le Sam 23 Juin - 17:56, édité 1 fois | |
|