Class: Lich::Gemstone::Bounty

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

Overview

The Bounty module provides functionality for handling bounties in the game.

Defined Under Namespace

Classes: Parser, Task

Constant Summary collapse

KNOWN_TASKS =

A list of known task matchers.

Parser::TASK_MATCHERS.keys

Class Method Summary collapse

Class Method Details

.currentTask

Retrieves the current bounty task.

Examples:

current_task = Lich::Gemstone::Bounty.current

Returns:

  • (Task)

    the current bounty task instance.



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

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

.lnet(person) ⇒ Task?

Retrieves bounty information for a specified person from LNet.

Examples:

bounty_task = Lich::Gemstone::Bounty.lnet("John Doe")

Parameters:

  • person (String)

    the name of the person to retrieve bounty information for.

Returns:

  • (Task, nil)

    a Task instance with the bounty information or nil if not found.

Raises:

  • (StandardError)

    if there is an issue with the LNet data retrieval.



40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/gemstone/bounty.rb', line 40

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

.taskTask

Retrieves the current bounty task.

Examples:

task = Lich::Gemstone::Bounty.task

Returns:

  • (Task)

    the current bounty task instance.



27
28
29
# File 'lib/gemstone/bounty.rb', line 27

def self.task
  current
end