Class: Lich::Gemstone::Treasure
- Inherits:
-
Object
- Object
- Lich::Gemstone::Treasure
- Defined in:
- documented/gemstone/creature.rb
Overview
Treasure drops available on a creature template.
Tracks currency (coins/gems), loot boxes, corpse harvest items (skin), and equipment by category (magic items, armaments, transmogs).
Instance Method Summary collapse
-
#blunt_required? ⇒ Boolean
Returns whether the creature must be killed with blunt damage for item drops.
-
#has_armaments? ⇒ Boolean
Returns whether the creature carries armaments (weapons/armor).
-
#has_boxes? ⇒ Boolean
Returns whether the creature drops loot boxes.
-
#has_coins? ⇒ Boolean
Returns whether the creature drops coins.
-
#has_gems? ⇒ Boolean
Returns whether the creature drops gems.
-
#has_skin? ⇒ Boolean
Returns whether the creature's corpse yields harvestable skin.
-
#has_transmogs? ⇒ Boolean
Returns whether the creature carries transmog items.
-
#initialize(data = {}) ⇒ void
constructor
Initializes treasure configuration from a creature template data hash.
-
#to_h ⇒ Hash
Returns the treasure configuration as a hash.
Constructor Details
#initialize(data = {}) ⇒ void
Initializes treasure configuration from a creature template data hash.
Merges provided data into defaults (all false/nil), allowing partial specs.
864 865 866 867 868 869 870 871 872 873 874 875 876 |
# File 'documented/gemstone/creature.rb', line 864 def initialize(data = {}) @data = { coins: false, gems: false, boxes: false, skin: nil, magic_items: nil, other: nil, armaments: nil, transmogs: nil, blunt_required: false }.merge(data) end |
Instance Method Details
#blunt_required? ⇒ Boolean
Returns whether the creature must be killed with blunt damage for item drops.
905 |
# File 'documented/gemstone/creature.rb', line 905 def blunt_required? = !!@data[:blunt_required] |
#has_armaments? ⇒ Boolean
Returns whether the creature carries armaments (weapons/armor).
897 898 899 900 |
# File 'documented/gemstone/creature.rb', line 897 def has_armaments? = !!(@data[:armaments] && !Array(@data[:armaments]).empty?) # Returns whether the creature carries transmog items. # # @return [Boolean] |
#has_boxes? ⇒ Boolean
Returns whether the creature drops loot boxes.
889 890 891 892 |
# File 'documented/gemstone/creature.rb', line 889 def has_boxes? = !!@data[:boxes] # Returns whether the creature's corpse yields harvestable skin. # # @return [Boolean] |
#has_coins? ⇒ Boolean
Returns whether the creature drops coins.
881 882 883 884 |
# File 'documented/gemstone/creature.rb', line 881 def has_coins? = !!@data[:coins] # Returns whether the creature drops gems. # # @return [Boolean] |
#has_gems? ⇒ Boolean
Returns whether the creature drops gems.
885 886 887 888 |
# File 'documented/gemstone/creature.rb', line 885 def has_gems? = !!@data[:gems] # Returns whether the creature drops loot boxes. # # @return [Boolean] |
#has_skin? ⇒ Boolean
Returns whether the creature's corpse yields harvestable skin.
893 894 895 896 |
# File 'documented/gemstone/creature.rb', line 893 def has_skin? = !!@data[:skin] # Returns whether the creature carries armaments (weapons/armor). # # @return [Boolean] |
#has_transmogs? ⇒ Boolean
Returns whether the creature carries transmog items.
901 902 903 904 |
# File 'documented/gemstone/creature.rb', line 901 def has_transmogs? = !!(@data[:transmogs] && !Array(@data[:transmogs]).empty?) # Returns whether the creature must be killed with blunt damage for item drops. # # @return [Boolean] |
#to_h ⇒ Hash
Returns the treasure configuration as a hash.
910 |
# File 'documented/gemstone/creature.rb', line 910 def to_h = @data |