Class: Lich::Gemstone::Treasure

Inherits:
Object
  • Object
show all
Defined in:
documented/gemstone/creature.rb

Overview

Treasure drop configuration for a creature template.

Wraps creature-specific drop data: coin/gem drops, container boxes, harvestable skin, magic item drops, and weapon/armor transmog availability. Exposes boolean queries for script convenience.

Instance Method Summary collapse

Constructor Details

#initialize(data = {}) ⇒ void

Initializes Treasure with drop configuration.

Stores merged data with defaults: false for coins/gems/boxes/blunt_required, nil for harvestable and magic attributes, empty for transmogs/armaments.

Parameters:

  • data (Hash) (defaults to: {}) —

    creature treasure data (optional)



816
817
818
819
820
821
822
823
824
825
826
827
828
# File 'documented/gemstone/creature.rb', line 816

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 requires blunt damage to harvest.

Returns:

  • (Boolean)


857
# File 'documented/gemstone/creature.rb', line 857

def blunt_required? = !!@data[:blunt_required]

#has_armaments? ⇒ Boolean

Returns whether the creature can drop weapons or armor.

Returns:

  • (Boolean)


849
850
851
852
# File 'documented/gemstone/creature.rb', line 849

def has_armaments? = !!(@data[:armaments] && !Array(@data[:armaments]).empty?)
# Returns whether the creature has weapon/armor transmog drops.
#
# @return [Boolean]

#has_boxes? ⇒ Boolean

Returns whether the creature can drop containers.

Returns:

  • (Boolean)


841
842
843
844
# File 'documented/gemstone/creature.rb', line 841

def has_boxes? = !!@data[:boxes]
# Returns whether the creature has harvestable skin.
#
# @return [Boolean]

#has_coins? ⇒ Boolean

Returns whether the creature can drop coins.

Returns:

  • (Boolean)


833
834
835
836
# File 'documented/gemstone/creature.rb', line 833

def has_coins? = !!@data[:coins]
# Returns whether the creature can drop gems.
#
# @return [Boolean]

#has_gems? ⇒ Boolean

Returns whether the creature can drop gems.

Returns:

  • (Boolean)


837
838
839
840
# File 'documented/gemstone/creature.rb', line 837

def has_gems? = !!@data[:gems]
# Returns whether the creature can drop containers.
#
# @return [Boolean]

#has_skin? ⇒ Boolean

Returns whether the creature has harvestable skin.

Returns:

  • (Boolean)


845
846
847
848
# File 'documented/gemstone/creature.rb', line 845

def has_skin? = !!@data[:skin]
# Returns whether the creature can drop weapons or armor.
#
# @return [Boolean]

#has_transmogs? ⇒ Boolean

Returns whether the creature has weapon/armor transmog drops.

Returns:

  • (Boolean)


853
854
855
856
# File 'documented/gemstone/creature.rb', line 853

def has_transmogs? = !!(@data[:transmogs] && !Array(@data[:transmogs]).empty?)
# Returns whether the creature requires blunt damage to harvest.
#
# @return [Boolean]

#to_h ⇒ Hash

Returns the underlying treasure data hash.

Returns:



862
# File 'documented/gemstone/creature.rb', line 862

def to_h = @data