Data namespaces: i18n, quest, mob
The wiki loads generated game data and registers it in every template context next to the fun and bonus namespaces. Facts are generated offline by the Wiki Manager; item and world namespaces have their own pages.
interfacemodule Namespace
The interfacemodule object provides access to all interfaceModule functions, this object is ment for advanced internal use and needs knoewldge over the Python code handling the game interface.
i18n Namespace
i18n.t
Name: t
Parameters:
key: The key to translate.
Return:
- The text for
key. The key is looked up as a map index inMAP_INFO, then inQUEST_NAMES,DUNGEON_NAMESandRAID_NAMES(see configuration), and the resulting locale key is translated throughlocale.json. A key with no entry is looked up inlocale.jsondirectly and returned unchanged when missing.
Call Example:
{{ i18n.t(map_index) }}
quest Namespace
Quest data comes from quests.json, generated by the Wiki Manager. Every method takes the quest identifier as quest_id and returns a neutral value (None, [], 0, "quest") when the quest is unknown.
| Method | Returns |
|---|---|
quest.get_quest(quest_id) | The whole record, or None. |
quest.get_quest_name(quest_id) | The localized name from QUEST_NAMES, or the identifier. |
quest.get_quest_type(quest_id) | The quest type, "quest" by default. |
quest.get_min_level(quest_id) | The minimum level, 0 by default. |
quest.get_maps(quest_id) | The map indexes the quest involves. |
quest.get_map_index(quest_id) | The first map index, 0 when none. |
quest.get_map_indexes(quest_id) | The same list as get_maps. |
quest.get_previous_quest(quest_id) | The quest that must come first, or None. |
quest.get_unlocks_quests(quest_id) | The quests that start after this one. |
quest.get_rewards(quest_id) | The rewards. |
quest.get_reward_choices(quest_id) | The rewards the player chooses between. |
quest.get_mob_involved(quest_id) | The mobs the quest involves. |
quest.get_item_involved(quest_id) | The items the quest involves. |
quest.get_primary_npc(quest_id) | The primary NPC. |
quest.get_questline(quest_id) | The questline the quest belongs to, or None. |
Call Example:
{% set rewards = quest.get_rewards(quest_id) %}
mob Namespace
These methods belong to the mob object. They manage data for non-player characters identified by a vnum.
Constants
| Constant | Description |
|---|---|
mob.MOB_TYPE_NPC | Identifies an NPC mob |
mob.MOB_TYPE_MONSTER | Identifies a monster mob |
mob.MOB_TYPE_STONE | Identifies a stone or ore |
mob.MOB_TYPE_METEOR | Identifies a meteor object |
mob.MOB_TYPE_BOSS | Identifies a boss mob |
mob.get_drops
Name: mob.get_drops
Parameters:
vnum(int)
Return:
- A list of dictionaries representing drop data. Return Dictionary Schema (each element of the list):
{
"vnum": 72701,
"vnums": [72701, 72702], // optional
"count": 1,
"rarity": 10,
"type": "drop|limit|quest|stone|kill|common|belt|thiefgloves|dungeon",
"requirements": {
"level_limit_min": 1,
"level_limit_max": 120,
"days": [],
"time_from": 0,
"time_to": 0,
"max_drop": 0,
"during_event": "",
"during_quest": ""
}
}
Call Example:
{% set drop_list = mob.get_drops(101) %}
mob.appears_in_quests
Name: mob.appears_in_quests
Parameters:
vnum(int)
Return:
- A list of strings indicating the quests where the mob appears.
Call Example:
{% set quest_ids = mob.appears_in_quests(101) %}
mob.appears_in_dungeons
Name: mob.appears_in_dungeons
Parameters:
vnum(int)
Return:
- A list of dungeon identifiers (strings).
Call Example:
{% set dungeon_list = mob.appears_in_dungeons(101) %}
mob.appears_in_raids
Name: mob.appears_in_raids
Parameters:
vnum(int)
Return:
- A list of strings, each representing a raid zone.
Call Example:
{% set raid_ids = mob.appears_in_raids(101) %}
mob.appears_in_maps
Name: mob.appears_in_maps
Parameters:
vnum(int)
Return:
- A list of map indexes (integers).
Call Example:
{% set maps = mob.appears_in_maps(101) %}
mob.sells
Name: mob.sells
Parameters:
vnum(int)
Return:
- A list of dictionaries describing items sold by the mob.
Return Dictionary Schema (each element of the list):
{
"item_vnum": 30100,
"count": 1
}
Call Example:
{% set vendor_items = mob.sells(9003) %}
mob.crafts
Name: mob.crafts
Parameters:
vnum(int)
Return:
- A list of cube crafts ids (integers).
Call Example:
{% set craft_list = mob.crafts(9003) %}
mob.spawn_data
Name: mob.spawn_data
Parameters:
vnum(int)
Return:
- A dictionary containing spawn details or None if no data is available.
Return Dictionary Schema:
{
"map_index": {
"random": false|false,
"points": [
{
"x": xcoord,
"y": ycoord,
"time": seconds_to_respawn
},
]
}
}
Call Example:
{% set spawn_info = mob.spawn_data(101) %}
mob.get_mob_origin
Name: mob.get_mob_origin
Parameters:
vnum(int)
Return:
- A localized string describing the mob’s origin, or None if none is defined.
Call Example:
{% set origin = mob.get_mob_origin(101) %}
mob.is_any_of_type
Name: mob.is_any_of_type
Parameters:
vnum(int)*args: any combination of mob-type constants (e.g.mob.MOB_TYPE_BOSS,mob.MOB_TYPE_NPC)
Return:
- A boolean indicating if the mob matches any of the provided types.
Call Example:
{% if mob.is_any_of_type(101, mob.MOB_TYPE_NPC, mob.MOB_TYPE_MONSTER) %}
<!-- do something -->
{% endif %}
mob.mob_name
Name: mob.mob_name
Parameters:
vnum(int)
Return:
- A UTF-8 decoded string with the mob’s localized name.
Call Example:
{% set name = mob.mob_name(101) %}