Introduction

The main object that handles setting zone & adding entities to game.

Methods


game:add

game:add(object)

  • Adds an {@link marauroa.common.game.RPObject} instance to the current zone.
  • Parameters:
    • object: Object to add.

game:add(npc)

  • Adds an {@link games.stendhal.server.entity.npc.NPC} instance to the current zone.
  • Parameters:
    • npc: NPC to add.

game:add(creature, x, y)

  • Adds a {@link games.stendhal.server.entity.creature.Creature} instance to the current zone.
  • Parameters:
    • creature: Creature to add.
    • x: Horizontal position of where to add creature.
    • y: Vertical position of where to add creature.

game:remove

game:remove(object)

  • Parameters:
    • object:

game:remove(npc)

  • Parameters:
    • npc:

game:addGameEvent

game:addGameEvent(source, event, params)

  • Adds a new {@link games.stendhal.server.core.engine.GameEvent}.
  • Parameters:
    • source:
    • event:
    • params:

game:setZone

game:setZone(name)

  • Sets the current zone.
  • Parameters:
    • name: String identifier for zone to be set as current zone.
  • Returns: true if zone was successfully set.

game:setZone(zone)

  • Sets the current zone.
  • Parameters:
    • zone: {@link games.stendhal.server.core.engine.StendhalRPZone} instance to set as current zone.
  • Returns: true if zone was successfully set.

game:getZone

game:getZone(object)

  • Retrieves the zone where object is located.
  • Parameters:
    • object: The {@link marauroa.common.game.RPObject} from which the zone should be retrieved.
  • Returns: {@link games.stendhal.server.core.engine.StendhalRPZone} or null if it doesn't exists

game:getZone(name)

  • Retrieves a zone by string ID.
    • zoneName: Name of zone to retrieve.
  • Returns: {@link games.stendhal.server.core.engine.StendhalRPZone} or null if it doesn't exist.

game:setMusic

game:setMusic(filename, args)

  • Sets the music for the currently selected zone.
  • Parameters:
    • filename: File basename excluding .ogg extension.
    • args: Lua table of key=value integer values.
      • Valid keys:
        • volume: Volume level (default: 100).
        • x: The X coordinate of the sound source (default: 1).
        • y: The Y coordinate of the sound source (default: 1).
        • radius: The radius from which the music can be heard (default: 10000).

game:playerIsInZone

game:playerIsInZone(player, zoneName)

  • Parameters:
    • player:
    • zoneName:
  • Returns: boolean

game:getCreatures

game:getCreatures()

  • Returns: An array of all available creatures.

game:getCreature

game:getCreature(clazz)

  • Retrieves a {@link games.stendhal.server.entity.creature.Creature} instance.
    • clazz: String name of the creature.
  • Returns: Creature or null if doesn't exist.

game:getItems

game:getItems()

  • Returns: Array list of available items.

game:getItem

game:getItem(name)

  • Parameters:
    • name:
  • Returns: Item instance or null if doesn't exist.

game:modify

game:modify(entity)

  • Parameters:
    • entity:

game:privateText

game:privateText(player, text)

  • Sends a private text to a player.
  • Parameters:
    • player: Player to receive the message.
    • text: Message text to send to player.

game:getMessage

game:getMessage()

  • Returns: String