Module: Lich::Gemstone::Creature

Defined in:
documented/gemstone/creature.rb

Overview

Provides methods for managing creature instances. This module serves as a facade for interacting with creature instances.

Class Method Summary collapse

Class Method Details

.[](id) ⇒ CreatureInstance?

Retrieves a creature instance by ID.

Parameters:

  • id (Integer)

    The ID of the creature instance to retrieve.

Returns:



591
592
593
# File 'documented/gemstone/creature.rb', line 591

def self.[](id)
  CreatureInstance[id]
end

.allObject



643
644
645
# File 'documented/gemstone/creature.rb', line 643

def self.all
  CreatureInstance.all
end

.cleanup_old(**options) ⇒ void

This method returns an undefined value.

Cleans up old creature instances based on specified options.

Parameters:

  • options (Hash)

    Options for cleanup criteria.



631
632
633
# File 'documented/gemstone/creature.rb', line 631

def self.cleanup_old(**options)
  CreatureInstance.cleanup_old(**options)
end

.clearvoid

This method returns an undefined value.

Clears all registered creature instances.



624
625
626
# File 'documented/gemstone/creature.rb', line 624

def self.clear
  CreatureInstance.clear
end

.configure(**options) ⇒ void

This method returns an undefined value.

Configures the creature instance settings.

Parameters:

  • options (Hash)

    Configuration options for the creature instances.



607
608
609
# File 'documented/gemstone/creature.rb', line 607

def self.configure(**options)
  CreatureInstance.configure(**options)
end

.damage_report(**options) ⇒ Object



635
636
637
# File 'documented/gemstone/creature.rb', line 635

def self.damage_report(**options)
  CreatureInstance.damage_report(**options)
end


639
640
641
# File 'documented/gemstone/creature.rb', line 639

def self.print_damage_report(**options)
  CreatureInstance.print_damage_report(**options)
end

.register(name, id, noun = nil) ⇒ CreatureInstance?

Registers a new creature instance with the specified name and ID.

Parameters:

  • name (String)

    The name of the creature.

  • id (Integer)

    The unique identifier for the creature instance.

  • noun (String, nil) (defaults to: nil)

    The noun used to refer to the creature, defaults to nil.

Returns:

  • (CreatureInstance, nil)

    The registered creature instance, or nil if registration failed.



600
601
602
# File 'documented/gemstone/creature.rb', line 600

def self.register(name, id, noun = nil)
  CreatureInstance.register(name, id, noun)
end

.statsHash

Retrieves statistics about the current state of creature instances.

Returns:

  • (Hash)

    A hash containing instance and template statistics.



613
614
615
616
617
618
619
620
# File 'documented/gemstone/creature.rb', line 613

def self.stats
  {
    instances: CreatureInstance.size,
    templates: CreatureTemplate.all.size,
    max_size: CreatureInstance.class_variable_get(:@@max_size),
    auto_register: CreatureInstance.auto_register?
  }
end