Data Tables


(This document is still under construction!)

In Muddery, the whole game world is built by a series of tables. When the server starts up for the first time, the server will load these data and build the world. If you have modified some tables after the server start, you, as a builder, can use @loadworld command to rebuild the world and use @reload command to refresh data.
Here are main tables and example data. They are from our game example. You can use muddery --init game_folder example to install it.

Basic Defines

These tables define a set of basic values. These values are essential to other tables, and they must match the settings in the game.

class_categories
key name desc
CATE_ROOM Room These are rooms.
These categories set object's basic types, such as rooms, exits, characters, objects, etc.
key is the category's key.
name is the category's readable name displays to game designers.
desc (optional) category's description.

typeclasses
key name path category desc
CLASS_COMMON_ROOM Common Room typeclasses.rooms.Room CATE_ROOM Common room's typeclass.
All available typeclasses are here. These typeclass's paths must match the values in codes, or the program can not create objects of these typeclasses.
key is the typeclass's key.
name is the typeclass's readable name displays to game designers.
path is the typeclass's path, it must match the values in codes.
category is the typeclass's category, set in class_categories.
desc (optional) typeclass's description.

equipment_types
Equipment Types limit character's available equipments. Characters can only put on equipments that match their careers.
key name desc
EQUIP_CLOTH Cloth Cloth

equipment_positions
Equipments only can be put on right positions, such as hands or legs.
key name desc
POSITION_HEAD Head Head

character_careers
Character's career decides their features, such as basic attribute values, basic skills, equipments etc.
key name desc
CAREER_COMMON Common Common

career_equipments
Defines certain careers can put on what kinds of equipments.
career equipment
CAREER_COMMON EQUIP_CLOTH

quest_objective_types
Quest objectives' types define objective such as arriving a room, or killing some mobs. They must match the values in utils.defines.
key type_id name desc
OBJECTIVE_TALK 1 Talk Finishes a dialogue. object field: dialogue's id.

quest_dependency_types
Quest's dependency types are the relation between quests. Some quest can be accepted only when another quest has been completed, and some can be accepted only when another has not been completed. These relations types are all in this table. They must match the values in utils.defines.
key type_id name desc
DPD_CAN_PROVIDE 1 Can Provide Can provide this quest.

event_types
The types of actions that events lead to, such as begin a combat or begin a dialogue. They must match the values in utils.defines.
key type_id name desc
EVENT_ATTACK 1 Attack Event leads to a combat.

event_trigger_types
Event trigger's types define how to trigger an event, such as walking into a room. They must match the values in utils.defines.
key type_id name desc
EVENT_TRIGGER_ARRIVE 1 Arrive Triggers when players arrive a room. trigger_obj field: room's id.

World Objects

World objects are unique in the world. We use key to identify them. If you add an object to these tables, this object will appear in the location you specified. If you remove an object from these tables, this object will be remove from the game world too.

world_rooms
key name typeclass desc position
room_house HOUSE typeclasses.rooms.Room This is a house.
room_cellar CELLAR typeclasses.rooms.Room This is a cellar.
room_street STREET typeclasses.rooms.Room This is a street.
room_dungeon DUNGEON typeclasses.rooms.Room This is a dungeon.
Rooms are basic areas in the game. They build up the whole map of the game world together.
key is the unique id of a room. This must be unique in all tables.
name is the name of the room that shows to players.
typeclass is the typeclass of the room.
desc is the appearance of the room when players look at it.

world_exits
key name typeclass desc verb location destination condition
exit_house_to_cellar CELLAR typeclasses.exits.Exit Go to the cellar. Go To room_house room_cellar
exit_cellar_to_house HOUSE typeclasses.exits.Exit Leave the cellar. Leave room_cellar room_house
exit_house_to_street STREET typeclasses.exits.Exit Go to the street. Go Out room_house room_street
exit_street_to_house HOUSE typeclasses.exits.Exit Enter the house. Enter room_street room_house
exit_street_to_dungeon DUNGEON typeclasses.exits.Exit Go to the dungeon. Go room_street room_dungeon
exit_dungeon_to_street STREET typeclasses.exits.Exit Back to the street. Back room_dungeon room_street
Characters must traverse exits to move from one room to another. Exits link rooms together. Exits are oneway, so if you want to move in and move out, you need to build two exits on each side.
key is the unique id of an exit. This must be unique in all tables.
name is the name of the exit that shows to players.
typeclass is the typeclass of the exit.
desc is the appearance of the exit when players look at it.
verb is the name of the action of traverse. This shows to players to make the action looks better. If it is empty, the system will use a default verb.
location is the room where the exit sets. The exit opens on this side. It must be a key in world_rooms.
destination is the room where the exit leads to. It must be a key of world_rooms.

exit_locks
key unlock_condition unlock_verb locked_desc auto_unlock
exit_lock have_object("obj_key") UNLOCK Use a key to unlock it. 0
It is a special kind of exits. They are locked and players need to unlock it first to traverse it. Their appearance can be different after unlocked. These are additional data of locked exits.
key is the key of an exit.
condition is the condition of unlock. Players who matches the condition can unlock the exit. The condition's syntax will be explained in another document.
verb is the name of the action of unlock. This shows to players to make the action looks better. If it is empty, the system will use a default verb.
message_lock is the appearance of the exit when it is locked.
auto_unlock If an exit is auto_unlock, players needn't do the unlock action, the exit can unlock itself automatically for players who match the condition.

world_objects
key name typeclass desc location condition
object_box BOX typeclasses.objects.Object An empty box. room_house
creator_box BOX typeclasses.object_creators.ObjectCreator A small box. room_house
creator_basket BASKET typeclasses.object_creators.ObjectCreator A basket of apples. room_house
creator_bag BAG typeclasses.object_creators.ObjectCreator A bag of potatoes. room_cellar
creator_rack RACK typeclasses.object_creators.ObjectCreator This is a rack. room_dungeon
You can add objects to rooms by adding data to this table.
key is the unique id of an object. This must be unique in all tables.
name is the name of the object that shows to players.
typeclass is the typeclass of the object.
desc is the appearance of the object when players look at it.
location is the room where the object stay.
condition Players can only see objects that match the condition. The condition's syntax will be explained in another document.

object_creators
key loot_verb loot_condition
creator_box SEARCH
creator_basket SEARCH is_quest_in_progress("quest_apple")
creator_bag SEARCH is_quest_in_progress("quest_potato")
creator_rack LOOT
These are additional data for object creators.
key is the key of an object creator.
verb describes the action of loot that shows to players.
loot_condition Players can only loot objects that match the condition. The condition's syntax will be explained in another document.

loot_list
provider object number odds quest condition
creator_basket obj_apple 1 1
creator_bag obj_potato 1 1
creator_rack equip_armor 1 1
creator_rack weapon_sword 1 1
Object creators provide objects according to this loot list.
provider is an object creator. It is a key in object_creators.
object is the key of an common object that provided by this object creator. An object creator can provide several objects.
number is the number of the objects provided.
odds is the odds of the drop. It is a float number between 0 to 1.
condition is the condition of the drop. Players can only get objects that match the condition. The condition's syntax will be explained in another document.
creator_loot_list character_loot_list quest_reward_list

world_npcs
key name typeclass desc location model level condition
npc_boy BOY typeclasses.npcs.NPC This is a boy. room_street
You can add NPCs by adding data to this table.
key is the unique id of an NPC. This must be unique in all tables.
name is the name of the NPC that shows to players.
typeclass is the typeclass of the NPC.
desc is the appearance of the NPC when players look at it.
location is the room where the NPC stay. It must be a key in world_rooms.
condition Players can only see NPCs that match the condition. The condition's syntax will be explained in another document.

Common Objects

Common objects are not unique in the game world. There can be a lot of common objects of have the same key.

common_objects
key name typeclass desc max_stack unique
obj_apple APPLE typeclasses.common_objects.CommonObject An apple. 10 0
obj_potato POTATO typeclasses.common_objects.CommonObject A potato. 10 0
Common objects are objects that players can put them into their inventories.
key is the unique id of an object. This must be unique in all tables.
name is the name of the object that shows to players.
typeclass is the typeclass of the object.
desc is the appearance of the object when players look at it.
max_stack limits the max number of objects in a pile. For example, if the max_stack of apples is 10, the max number of a pile of apples is 10. If you have 11 apples, they will be divided into 2 piles.
unique determines whether players can have more than one pile of this object. 0 means NO and 1 means YES.
effect is a float value that can provide as an argument when players use this object.
action is a short script that runs when players use this object. The action's syntax will be explained in another document.
It does not have location field because common objects can appear everywhere.

foods
key name typeclass desc max_stack unique hp mp
food_bread Bread CLASS_FOOD Eating breads can recover a little HP. 10 1 10

common_characters
key name typeclass desc model level
mob_rogue ROGUE typeclasses.monsters.Monster This is a rogue. He is dangerous.
Common characters are characters that can appear everywhere.
key is the unique id of a character. This must be unique in all tables.
name is the name of the character that shows to players.
typeclass is the typeclass of the character.
desc is the appearance of the character when players look at it.

Quests

Quests are special objects stored in characters. One quest object represents a quest. It can have several objectives. There are a series of tables work for the quest system.

quests
key name typeclass desc condition action
quest_apple APPLE typeclasses.character_quests.Quest Find an apple.
quest_potato POTATO typeclasses.character_quests.Quest Find a potato.
Quests are objects stored in characters. key is the unique id of a quest. This must be unique in all tables.
name is the name of the quest that shows to players.
typeclass is the typeclass of the quest.
desc is the appearance of the quest when players look at it.
condition Players can only accept quests that match the condition. The condition's syntax will be explained in another document.
action is a short script that runs when players finish a quest. The action's syntax will be explained in another document.

quest_objectives
quest ordinal type object number desc
quest_apple 1 3 obj_apple 1 Find an apple.
quest_potato 1 3 obj_potato 1
quest_objectives are objectives of quests. A quest can have several objectives. A quest is achieved while all its objectives are achieved.
quest is the key of the quest that have this objective.
ordinal is the ordinal number of an objective. quest and ordinal together must be unique.
type is the type of the objective, such as getting some objects, talking to somebody, or arriving some place. They are defined in units/defines.py.

quest_dependencies
quest dependency type
quest_potato quest_apple 8
This table sets the dependencies of quests. A quest is available while all its dependencies are matched.
quest is the key of a quest.
dependency is this quest's dependent quest. It is the key of another quest.
type is the dependency's type. They are defined in units/defines.py.

Dialogues

Dialogues are basic units of a talk. They can have branches, so players can choose what they want to say. Dialogues also have conditions, so an NPC can talk different things to players. A dialogue has several sentences which are indivisible. A dialogue can only start from the first sentence.

dialugues
key name condition
dlg_hello
dlg_apple
dlg_potato
dlg_event
This table has all dialogues' key and their conditions.
key is the key of the dialogues. It must be unique in this table.
condition Players can only see dialugues that match the condition. The condition's syntax will be explained in another document.

dialogue_sentences
dialogue ordinal speaker content action provide_quest complete_quest
dlg_hello 1 n Hello!
dlg_apple 1 n Can you find me an apple?
dlg_apple 2 p OK! quest_apple
dlg_potato 1 n Can you find me a potato?
dlg_potato 2 p OK! quest_potato
dlg_event 1 "voice" Welcome!
A dialogues can have several sentences, but a dialogue must begin from the first sentence. If a dialogue is interrupted, players can not continue from the middle of the dialogue. They must start from the beginning.
Sentence can provide and/or finish quests.
dialogue is the key of a dialogue.
ordinal is the ordinal of the sentence. dialogue and ordinal together must be unique.
speaker is the name of speaker that players can see. If it is p, the speaker's name will be the name of the player. If it is n, the speaker's name will be the name of the NPC. If it is a string quoted in ", the speaker's name will be the string in the quotes. Otherwise it will be empty.
content is the texts of the sentence.
action is a short script that runs when players use this sentence. The action's syntax will be explained in another document.
provide_quest is the key of a quest. When players use sentences with provide_quest, they will accept this quest if they can.
finish_quest is the key of a quest. When players use sentences with finish_quest, they will finish this quest if they can.

dialogue_relations
dialogue next
dlg_apple dlg_potato
A dialogue can leads to one or several dialogues. If there several dialogues, players can choose the one that they want say.
dialogue is the key of a dialogue.
next is another dialogue's key which this dialogue leads to.

dialogue_quest_dependencies
dialogue dependency type
dlg_apple quest_apple 1
dlg_no_apple quest_apple 7
dlg_has_apple quest_apple 6
dlg_potato quest_potato 1
dlg_potato quest_apple 8
dlg_no_potato quest_potato 7
dlg_has_potato quest_potato 6
This table sets the dependencies of quests. A dialogue is available while all its dependencies are matched.
dialogue is the key of a dialogue.
dependency is this dialogue's dependent quest. It is the key of a quest.
type is the dependency's type. They are defined in units/defines.py.

npc_dialogues
npc dialogue default
npc_boy dlg_hello 1
npc_boy dlg_apple
npc_boy dlg_potato
You can add dialogues to NPCs by adding data to this table.
npc is the key of an NPC.
dialogue is the key of a dialogue.
default is whether this dialogue is default or not. 0 means NO and 1 means YES. If an NPC can show non-default dialogues, it will not show default dialogues. Default dialogues can only be shown when other dialogues are not available.

Events

Player's actions can trigger events, such as moving into a special room or killing a special NPC. The event can lead to a dialogue or begin a fight.
Notice, superusers and players whose permissions are listed in settings.PERMISSION_BYPASS_EVENTS will not trigger events.

event_data
key type trigger_type trigger_obj condition
event_dialogue 1 room_cellar 2
event_fight 1 room_dungeon 1
All events are in this table.
key is the unique id of a event. It must be unique in this table.
trigger is how the event can be triggered. It can be arriving, killing or other types. They are defined in units/defines.py.
object is the object's key of the trigger target. For example, if the trigger is arriving a room, the object is the key of the room.
type is the type of the event. It can be a dialogue or a fight. They are defined in units/defines.py.
condition is the condition of the event. The condition's syntax will be explained in another document.

event_dialogues
key dialogue npc
event_dialogue dlg_event
These data are used to create dialogues in events.
key is the key of an event.
dialogue is the key of the dialogue that will be triggered.
npc is the key of an NPC. If it is not empty, the NPC speaker's name will be this NPC's name. If it is empty, the NPC speaker's name will be empty.

event_attacks
key mob level odds desc
event_fight mob_rogue 1 1 A rogue is attacking you!
These data are used to create fights in events.
key is the key of an event.
mob is the key of the mob that will attack players.
level is the level of the mob.
odds is the odds of the event. It is a float number between 0 to 1.
desc is the description of this fight. It will show to players.

character's data

These are character's attributes and skills.

character_models
key name level max_exp max_hp max_mp attack defence give_exp
player 1 100 100 100 10 10
player 2 120 120 100 12 12
player 3 150 150 100 15 15
npc_boy 1 1 1 1 1 1
mob_rogue 1 20 20 100 5 5
Character's attribute can increase with level up.
character is the key of the character. If it is a player, the key should be DEFAULT_PLAYER_CHARACTER_KEY in settings.py.
level is the level of a character.
max_exp, max_hp, max_mp, attack and defence are character's attributes.

skills
key name typeclass desc cd passive condition function effect
skill_hit HIT typeclasses.character_skills.Skill Hit an enemy. 1 0 skill_hit 1
Character's skills are special objects. When a player casts a skill, the skill object calls a skill function. Skill function model's position is defined by SKILL_FOLDER and SKILL_FILES in settings.py. If a skill casted successfully, the result of the skill and the CD will be sent to the client.
key is the unique id of a skill. This must be unique in all tables.
name is the name of the skill that shows to players.
typeclass is the typeclass of the skill.
desc is the description of the skill.
cd is the cool down time in seconds.
passive is whether the skill is passive or not. 0 means NO and 1 means YES. If it is a passive skill, players can not cast it manually.
condition is the condition of the skill. Players can only cast skills that match the condition. The condition's syntax will be explained in another document.
function is the name of the skill function. The function must be defined in skill models. Skill function model's position is defined by SKILL_FOLDER and SKILL_FILES in settings.py.
effect is a float value that can provide as an argument when players use this object.

default_skills
character skill
player skill_hit
mob_rogue skill_hit
Characters can have default skills. All default skills are in this table.
character is the key of a character. If it is a player, the key should be DEFAULT_PLAYER_CHARACTER_KEY in settings.py.
skill is the key of a skill.

Equipments

Player characters can wear equipments to increase their attributes. Available attributes are defined by EQUIP_EFFECTS in settings.py. Only attributes listed in EQUIP_EFFECTS can add to characters.

Every equipment has its position. Equipments can only be put on their positions. All available positions are defined by EQUIP_POSITIONS in settings.py.

Every equipment has a type too. This type relates to character's career. Equipments can only be put on characters with right career.

equipments
key name typeclass desc max_stack unique position type attack defence
equip_armor ARMOR CLASS_EQUIPMENT This is an armor. 1 1 chest plate 10
key is the unique id of an equipment. This must be unique in all tables.
name is the name of the equipment that shows to players.
typeclass is the typeclass of the equipment.
desc is the appearance of the equipment when players look at it.
max_stack limits the max number of equipments in a pile. It is the same as the max_stack in common_objects.
unique determines whether players can have more than one pile of this equipment. It is the same as the unique in common_objects.
position is the position to wear. Positions are defined by EQUIP_POSITIONS in settings.py.
type is the type of the equipment.
attack and defence are attributes add to characters.

Localization

localized_strings
Localized strings can translate original strings to local language strings.
origin local
Hello! 你好!