Module core.libraries.meska.achievements.server

Metrics-Skill-Achievement Framework (MESKA) The achievements-system core functions.

Module Overview

Functions

meska.achievements.tpl(config) The template for achievements
meska.achievements.load([cb]) Loads all achievements from DB.
meska.achievements.loadFor(Player[, cb]) Loads the achievements of a player.
meska.achievements.get(alias) Either gets all or filtered achievements.
meska.achievements.getBy(key, value) Get achievements by key and value.
meska.achievements.add(config, tmp[, cb]) Adds an achievement to the storage.
meska.achievements.producer(achievements, curIdx) A generator that creates the achievements while respecting the underlaying asynchronous DB code-flow.
meska.achievements.iterator(achievements) An interator that returns the results of its producer back to the consumer.
meska.achievements.meetsRequirements(Player, achievement) Calls the requirements hook.
meska.achievements.giveRewards(Player, achievement) Calls the rewards hook.
meska.achievements.award(Player) Awards a player with achievements.
meska.achievements.runAnnounceQueue(Player) Display delayed announcements.
pMeta:Achievement(alias) Checks whether player has an achievement.

Functions

meska.achievements.tpl(config)
The template for achievements

Parameters:

  • config Achievement configuration.

Returns:

    table The template.
meska.achievements.load([cb])
Loads all achievements from DB.

Parameters:

  • cb func Callback Function. (optional)
meska.achievements.loadFor(Player[, cb])
Loads the achievements of a player.

Parameters:

  • Player Player entity.
  • cb func Callback Function. (optional)
meska.achievements.get(alias)
Either gets all or filtered achievements.

Parameters:

  • alias Achievement alias.

Returns:

    table The achievements.
meska.achievements.getBy(key, value)
Get achievements by key and value.

Parameters:

  • key The key.
  • value The value.

Returns:

    table The achievements.
meska.achievements.add(config, tmp[, cb])
Adds an achievement to the storage.

Parameters:

  • config Achievement configuration.
  • tmp If false, store in db. Default: false.
  • cb func Callback Function with id as return value. (optional)
meska.achievements.producer(achievements, curIdx)
A generator that creates the achievements while respecting the underlaying asynchronous DB code-flow. It returns back to the consumer once all given achievements were created in the database. This prevents against race-conditions.

Deprecated:

    This function is deprecated and may be removed in a future version.
    Co-Routines no longer needed.

Parameters:

  • achievements Achievements table.
  • curIdx The current table index.

Returns:

    table The achievements.
meska.achievements.iterator(achievements)
An interator that returns the results of its producer back to the consumer.

Deprecated:

    This function is deprecated and may be removed in a future version.
    Co-Routines no longer needed.

Parameters:

  • achievements Initial achievements table.

Returns:

    iterator The iterator containing the results of the producter.
meska.achievements.meetsRequirements(Player, achievement)
Calls the requirements hook.

Parameters:

  • Player Player entity.
  • achievement Achievement.
meska.achievements.giveRewards(Player, achievement)
Calls the rewards hook.

Parameters:

  • Player Player entity.
  • achievement Achievement.
meska.achievements.award(Player)
Awards a player with achievements.

Parameters:

meska.achievements.runAnnounceQueue(Player)
Display delayed announcements.

Parameters:

pMeta:Achievement(alias)
Checks whether player has an achievement.

Parameters:

  • alias Achievement alias.

Returns:

    bool If player has the achievement.