Class: Lich::Gemstone::Bounty

Inherits:
Object
  • Object
show all
Defined in:
documented/gemstone/bounty.rb,
documented/gemstone/bounty/task.rb,
documented/gemstone/bounty/parser.rb

Overview

Represents a bounty in the Lich game.

This class is responsible for parsing bounty descriptions and extracting relevant task information.

See Also:

  • Parser

Defined Under Namespace

Classes: Parser, Task

Constant Summary collapse

KNOWN_TASKS =
Parser::TASK_MATCHERS.keys

Class Method Summary collapse

Class Method Details

.currentTask

Retrieves the current bounty task.

Returns:

  • (Task)

    the current bounty task instance



17
18
19
# File 'documented/gemstone/bounty.rb', line 17

def self.current
  Task.new(Parser.parse(checkbounty))
end

.lnet(person) ⇒ Task?

Note:

Returns nil if no bounty information is available.

Retrieves bounty information for a specified person from LNet.

If the person is found, a new Task is created with the bounty data.

Parameters:

  • person (String)

    the name of the person to retrieve bounty information for

Returns:

  • (Task, nil)

    the bounty task instance if found, otherwise nil



31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'documented/gemstone/bounty.rb', line 31

def self.lnet(person)
  if (target_info = LNet.get_data(person.dup, 'bounty'))
    Task.new(Parser.parse(target_info))
  else
    if target_info == false
      text = "No one on LNet with a name like #{person}"
    else
      text = "Empty response from LNet for bounty from #{person}\n"
    end
    Lich::Messaging.msg("warn", text)
    nil
  end
end

.taskObject



21
22
23
# File 'documented/gemstone/bounty.rb', line 21

def self.task
  current
end