Kompatybilność "plecakowych" skryptów
Aktualny czas: 28-04-26, 23:08 Witaj! Przejdź do zakładki Logowanie lub Rejestracja


Wątek zamknięty 
[XP] Kompatybilność "plecakowych" skryptów
Zvarr Offline
*


Liczba postów: 118
Dołączył: 22-10-13

Pomógł: 2



Post: #1
wykrzyknik Kompatybilność "plecakowych" skryptów

Witam! Otóż przejdę do sedna sprawy. Używam świetnego skryptu Ayene
#==============================================================================
# Kategoryzacja przedmiotów [XP] + Info Przedmiotów
# by Ayene
# 19.08.2012 ver 2.0
# www.ultimateam.pl
#==============================================================================
# Opis:
# Skrypt umożliwia grupowanie przedmiotów w Plecaku w dowolne kategorie, np.
# bronie, mapy, przedmioty leczące, klucze itd. W tym celu wystarczy
# odpowiednio skonfigurować linijki poniżej (sekcja Konfiguracja).
#==============================================================================
# Konfiguracja:
#==============================================================================
module AYE
  module ITEM_CAT
  
  # Poszczególne kategorie przedmiotów wymienione po przecinku.
  # Muszą być zadeklarowane w CATEGORY_NAME i CATEGORY_ITEMS
  
  ITEM_CATEGORIES = [:item, :battle, :weapon, :armor,
                     :acc, :quest, :notes, :maps, :keys, :all]
  
  # Nazwy ketegorii                    
  CATEGORY_NAME = { # <- nie usuwać
  
  # :symbol => ["Komenda", "Opis", "Ikona"],
  
:item   => ["Prowiant", "Napoje i pokarmy", "Food"],
  :battle => ["Oręż", "Broń biała, łuki i tarcze", "Weapons"],
  :weapon => ["Pancerze", "Zbroje i ubrania", "Armors"],
  :armor  => ["Talizmany", "Naszyjniki i amulety", "Talismans"],
  :acc    => ["Artefakty", "Magiczne obiekty", "Artifacts"],
  :quest  => ["Pisma", "Notatki i księgi", "Books"],    
  :notes  => ["Klucze", "Klucze i wtrychy", "Keys"],
  :maps   => ["Osiągnięcia", "Twoje osiągnięcia", "Awards"],
  :keys   => ["Różne", "Inne niezwiązane", "Items"],
  :all    => ["Wszystkie przedmioty", "Wszystkie przedmioty", "All"],
  
  } # <- nie usuwać
  
  # Przedmioty przypisane do kategorii
  
  CATEGORY_ITEMS = { # <- nie usuwać
  
  # :symbol =>   ["Typ" ,   [ID, ID, ID, ...],
  # gdzie: Typ w bazie danych - Item (przedmiot), Weapon (broń), Armor (pancerz),
  #        :all - wszystkie kategorie
    
    :item   =>   ["Item",   [ 1, 36, 37, 38, 39, 40, 41, 42, 43]],
    :battle =>   ["Item",   [ 7]],
    :weapon =>   ["Weapon", :all],
    :armor =>    ["Armor",  [1, 2, 3]],
    :acc   =>    ["Item",  [5]],
    :quest =>    ["Item",   [21, 22]],
    :notes =>    ["Item",   [8, 9, 10]],
    :maps =>     ["Item",   [2, 3, 4, 6]],
    :keys =>     ["Item",   [23, 24, 25]],
    :all   =>    [:all,     :all]
  
    } # <- nie usuwać
  
    USE_INFO_TEXT = "Enter: Użycie /  Shift: Info"
    
    
   # Opis przedmiotu (zakładka Items w Bazie danych)  
   ITEM_INFO = {  # ID => "Opis przedmiotu",
     0 => "???",   # tekst, dla reszty niezadeklarowanych przedmiotów
     1 => "Przyprawa - dar od morza.\|Składnik wielu potraw.",
     2 => "Zwykła kość jakiegoś ssaka.\|Prawidziwy rarytas dla psa.",  
     3 => "Magiczna kość nieumarłego.\|Mimo, że czar, który\| zbudził szkielet dawno\| przestał działać, to ta kość\| zachowała część magicznej mocy.\| Składnik alchemiczny ",
     4 => "Niewielki kamyk, idealny\|jako pocisk do procy",  
     5 => "W tej kamiennej tabliczce\|w jakiś sposób wyryto\|wzór spirali. Alchemik szukał jej\|dobre kilka lat.\|",    
     6 => "Żądło wydobyte jak trofeum\|z latającego insekta.\|Ponoć niektórzy potrafią\|wydobyć z niego substancje\|lecznicze.",  
     7 => " ",
     36 =>"Ughh ... Niezwykle silne!\| Lepiej nie wiedzieć/| z czego to jest...",    
     37 => " "# <- bez przecinka
     } # <-- Nie usuwać

  # Opis broni (zakładka Weapons w Bazie danych)
  WEAPON_INFO = { # ID => "Opis broni",
     0 => "???",  # tekst, dla reszty niezadeklarowanych broni
     6 => " ",
     12 => " ",
     15 => " ",
     17 => " ",
     22 => "Według legendy należał\|do szlachetnej rasy Elfów.\|Szkoda że tylko one mogą\|z tego korzystać.",
     23 => " "# <- bez przecinka
    } # <-- Nie usuwać
  
  # Opis pancerza (zakładka Armors w Bazie danych)      
  ARMOR_INFO = { # ID => "Opis pancerza",  
     0 => "???", # tekst, dla reszty niezadeklarowanych pancerzy
     5 => "",
     10 => "",
     13 => "Nie wygląda schludnie.\|Jest trochę poniszczona.",
     17 => "Zbroja została zrobiona\|z najwyższej klasy stopu.",    
     18 => " " # <- bez przecinka
    } # <-- Nie usuwać
    
  end
end

class Game_Temp
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :item_menu                
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  alias aye_itemcat_gmtemp_ini initialize
  def initialize
    aye_itemcat_gmtemp_ini
    @item_menu = false
  end
end

#==============================================================================
# ** Game_Party
#==============================================================================
class Game_Party
  def all_item_number(item)
    case item
    when RPG::Weapon
      return @weapons.include?(item.id) ? @weapons[item.id] : 0    
    when RPG::Armor
      return @armors.include?(item.id) ? @armors[item.id] : 0    
    else
      return @items.include?(item.id) ? @items[item.id] : 0    
    end
  end
end

class Window_Help < Window_Base
  include AYE::ITEM_CAT
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0, 640, 64)    
    self.contents = Bitmap.new(width - 32, height - 32)    
    self.y = 480 - height if $game_temp.item_menu
  end
end

#==============================================================================
# ** Window_ItemHelp
#==============================================================================
class Window_ItemHelp < Window_Base
  include AYE::ITEM_CAT
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    cw = 32 + ITEM_CATEGORIES.size * 32
    super(cw, 0, 640-cw, 64)    
    self.contents = Bitmap.new(width - 32, height - 32)
  end
  #--------------------------------------------------------------------------
  # * Set Text
  #--------------------------------------------------------------------------
  def set_text(index)
    self.contents.clear
    self.contents.font.color = normal_color
    text = index.is_a?(String) ? index : CATEGORY_NAME[ITEM_CATEGORIES[index]][0]
    self.contents.draw_text(4, 0, self.width - 40, 32, text, 1)
  end
end

#==============================================================================
# ** Window_ItemCategory
#==============================================================================
class Window_ItemCategory < Window_Selectable
  include AYE::ITEM_CAT
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize    
    cw = 32 + ITEM_CATEGORIES.size * 32    
    super(0, 0, cw, 64)
    @commands = ITEM_CATEGORIES
    @item_max = @commands.size
    @column_max = @item_max
    self.contents = Bitmap.new(cw - 32, height - 32)
    refresh
    self.index = 0
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    @commands.each_with_index {|com, i|draw_item(com, i)}    
  end
  #--------------------------------------------------------------------------
  # * Draw Item
  #     index : item number
  #     color : text character color
  #--------------------------------------------------------------------------
  def draw_item(command, index)
    rect = Rect.new(0, 0, 24, 24)
    bitmap = RPG::Cache.icon(CATEGORY_NAME[command][2])
    self.contents.blt(4 + 32 * index, 4, bitmap, rect)    
  end
  #--------------------------------------------------------------------------
  # * Cursor Rectangle Update
  #--------------------------------------------------------------------------
  def update_cursor_rect
    self.cursor_rect.set(@index * 32, 0, 32, 32)
  end
end

#==============================================================================
# ** Window_Item_info
#==============================================================================
class Window_Item_info < Window_Base
  include AYE::ITEM_CAT
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize(item)
    super(0, 64, 336, 352)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.z += 10
    @item = item
    refresh
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear    
    self.contents.font.color = system_color
    self.contents.draw_text(4, 0, 64, 32, "Typ:")    
    self.contents.draw_text(184, 0, 64, 32, "Cena:")
    case @item
    when RPG::Weapon
      type = "Broń"
      info = WEAPON_INFO[@item.id].nil? ? WEAPON_INFO[0] : WEAPON_INFO[@item.id]
    when RPG::Armor
      type = "Pancerz"
      info = ARMOR_INFO[@item.id].nil? ? ARMOR_INFO[0] : ARMOR_INFO[@item.id]
    else
      type = "Przedmiot"
      info = ITEM_INFO[@item.id].nil? ? ITEM_INFO[0] : ITEM_INFO[@item.id]
    end  
    self.contents.font.color = normal_color
    self.contents.draw_text(50, 0, 100, 32, type)
    self.contents.draw_text(184, 0, 100, 32, @item.price.to_s, 2)
    draw_info_text(4, 42, self.width - 40, 32, info)
  end  
  #--------------------------------------------------------------------------
  # * Draw Info Text
  #--------------------------------------------------------------------------
  def draw_info_text(x, y, width, height, text)
    text_info = text.split(/\|/)
    for i in 0...text_info.size
      self.contents.draw_text(x, y + i * 32, width, 32, text_info[i])
      break if (y + i * 32) > (self.height - 32)
    end
  end
end

#==============================================================================
# ** Window_Item
#==============================================================================
class Window_Item < Window_Selectable
  include AYE::ITEM_CAT
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(0, 64, 640, 352)
    @column_max = 2
    unless $game_temp.in_battle
      category(0)
      self.active = false
    end
    refresh
    self.index = 0    
    if $game_temp.in_battle
      self.y = 64
      self.height = 256
      self.back_opacity = 160
    end
  end
  #--------------------------------------------------------------------------
  # * Category
  #--------------------------------------------------------------------------
  def category(index)
    self.index = 0
    @items = []
    @category = ITEM_CATEGORIES[index]
    @itemtype = CATEGORY_ITEMS[@category][0]
    if @category != :all
      @items = CATEGORY_ITEMS[@category][1]
    end
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    if self.contents != nil
      self.contents.dispose
      self.contents = nil
    end
    @data = []
    if $game_temp.in_battle
      for i in 1...$data_items.size
        if $game_party.item_number(i) > 0
          @data.push($data_items[i])
        end
      end
    else
      @all_item = []    
      case @itemtype
      when "Item"
        @all_item = $data_items
      when "Weapon"
        @all_item = $data_weapons
      when "Armor"
        @all_item = $data_armors
      else
        @all_item = $data_items + $data_weapons + $data_armors
      end
      @all_item.each{|item|
        unless item == nil
          if $game_party.all_item_number(item) > 0
            if @category != :all and @items != :all
              if @items.include?(item.id)
                @data.push(item)
              end
            else
              @data.push(item)
            end
          end
        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
end

#==============================================================================
# ** Scene_Item
#==============================================================================
class Scene_Item
  include AYE::ITEM_CAT
  #--------------------------------------------------------------------------
  # * Main Processing
  #--------------------------------------------------------------------------
  alias aye_itemcat_scitem_main main
  def main
    $game_temp.item_menu = true
    @category_window = Window_ItemCategory.new
    @catname_window = Window_ItemHelp.new
    @catname_window.set_text(@category_window.index)    
    aye_itemcat_scitem_main    
    $game_temp.item_menu = false
    @category_window.dispose
    @catname_window.dispose
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  alias aye_itemcat_scitem_update update
  def update
    @category_window.update
    @catname_window.update
    if @category_window.active
      update_category
      return
    end
    if @item_info_window != nil
      update_item_info
      return
    end    
    aye_itemcat_scitem_update
  end
  #--------------------------------------------------------------------------
  # * Frame Update (when category window is active)
  #--------------------------------------------------------------------------
  def update_category
    @help_window.set_text(CATEGORY_NAME[ITEM_CATEGORIES[@category_window.index]][1])
    @item_window.category(@category_window.index)
    if Input.repeat?(Input::RIGHT) || Input.repeat?(Input::LEFT)
      @item_window.refresh
      @catname_window.set_text(@category_window.index)
    end
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      $scene = Scene_Menu.new(0)
      return
    end
    if Input.trigger?(Input::C)
      $game_system.se_play($data_system.decision_se)
      @catname_window.set_text(USE_INFO_TEXT)
      @item_window.active = true
      @category_window.active = false
      return
    end    
  end
  #--------------------------------------------------------------------------
  # * Frame Update (when item window is active)
  #--------------------------------------------------------------------------
  alias aye_itemcat_scitem_update_item update_item
  def update_item
    if Input.trigger?(Input::A)
      $game_system.se_play($data_system.decision_se)
      @item_window.active = false
      @item_info_window = Window_Item_info.new(@item_window.item)
      @item_info_window.x = (@item_window.index + 1) % 2 * 304
      return
    end    
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      @catname_window.set_text(@category_window.index)
      @item_window.active = false
      @category_window.active = true      
      return
    else        
      aye_itemcat_scitem_update_item
      return
    end    
  end
  #--------------------------------------------------------------------------
  # * Frame Update (when item info window is visible)
  #--------------------------------------------------------------------------
  def update_item_info
    if Input.trigger?(Input::B) or Input.trigger?(Input::A)
      $game_system.se_play($data_system.cancel_se)      
      @item_info_window.dispose
      @item_info_window = nil
      @item_window.active = true
      return
    end    
  end  
end
oraz wygooglowanego
#==============================================================================#​
# ICON ITEMS                                                                   #
# Version: 1.0                                                                 #
# By: Polraudio                                                                #
# Exclusive to RMU or GDU                                                      #
#==============================================================================#​

class Window_Item < Window_Selectable
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(0, 64, 640, 416)
    @column_max = 9
    refresh
    self.index = 0
    # If in battle, move window to center of screen
    # and make it semi-transparent
    if $game_temp.in_battle
      self.y = 64
      self.height = 256
      self.back_opacity = 160
    end
  end
  #--------------------------------------------------------------------------
  # * Get Item
  #--------------------------------------------------------------------------
  def item
    return @data[self.index]
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    if self.contents != nil
      self.contents.dispose
      self.contents = nil
    end
    @data = []
    # Add item
    for i in 1...$data_items.size
      if $game_party.item_number(i) > 0
        @data.push($data_items[i])
      end
    end
    # Also add weapons and items if outside of battle
    unless $game_temp.in_battle
      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, make a bit map and draw all items
    @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
  #--------------------------------------------------------------------------
  # * Draw Item
  #     index : item number
  #--------------------------------------------------------------------------
  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.is_a?(RPG::Item) and
       $game_party.item_can_use?(item.id)
      self.contents.font.color = normal_color
    else
      self.contents.font.color = disabled_color
    end
    x = 2 / 12 + index % 9 * (12 + 59)
    y = 2 / 12 + index / 9 * 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 : 255
    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.font.size = 12
    self.contents.font.color = Color.new(0, 0, 0, 255)
    self.contents.draw_text(x + 15, y+2, 24, 32, "x" + number.to_s, 2)
    #self.contents.font.color = normal_color
    self.contents.font.color = Color.new(255, 255, 255, 255)
    self.contents.draw_text(x + 13, y, 24, 32, "x" + number.to_s, 2)
  end
  #--------------------------------------------------------------------------
  # * Help Text Update
  #--------------------------------------------------------------------------
  def update_help
    @help_window.set_text(self.item == nil ? "" : self.item.name+": "+self.item.description)
  end
end

Wszystko ładnie wygląda, ale mam jedno zastrzeżenie. Mimo, że w dziale konfiguracji skryptu Ayene wszystko dobrze ustawiłem, to itemki się nie kategoryzują! Gdy mam różniste rzeczy w plecaku da się je zobaczyć w każdej zakładce - kategorii. Pomożcie!
(Ten post był ostatnio modyfikowany: 16-03-14 11:56 przez Zvarr.)
16-03-14 11:55
Znajdź wszystkie posty użytkownika
"Pomógł" przyznał(a):
Wątek zamknięty 


Wiadomości w tym wątku
Kompatybilność "plecakowych" skryptów - Zvarr - 16-03-14 11:55

Skocz do:


Użytkownicy przeglądający ten wątek: 1 gości

Kontakt | Ultima Forum | Wróć do góry | Wróć do forów | Wersja bez grafiki | RSS
Powered By MyBB. © 2013 MyBB Group. All Rights Reserved.
Skórka by Ayene.