|
GameFiles
How to create an EQdkp game file for your game.
Featured IntroductionThis wiki article will explain and demonstrate how to create your own game file for EQdkp. This article will be using the World of Warcraft (WoW) EQdkp game file to demonstrate. The File StructureThe typical file structure for a game will look something like this: <eqdkp_root>
|
|-- games
|-- wow
| |-- game_wow.php
| |-- language
| |-- english
| |-- lang_game.php
|-- ...Each game needs to have a short, unique key name to identify the game by. Start by creating a folder with this key name (for example, "wow" for World of Warcraft). Inside this folder, create a PHP file called "game" + your keyname. This is the file that will contain the information about the game required for use by EQdkp. Optionally, you can include a language file for the game. This file should be called lang_game.php, and be placed inside a folder named after the language. The Filesgame_wow.phpA full example for the file structure can be found in our repository. The game file should only be usable by the game manager class, and by EQdkp. As such, you should place the following at the start of each game file. if (!defined('EQDKP_INC') || !defined('IN_GAME_MANAGER'))
{
header('HTTP/1.0 404 Not Found');
exit;
}$game_info arrayNext up is the $game_info array. This array holds information about the game itself. $game_info = array(
'id' => 'wow',
'name' => 'World of Warcraft',
'shortname' => 'WoW',
'version' => '1.0',
'max_level' => 70,
'available' => array(
'armor_types' => true,
'classes' => true,
'class_armor' => true,
'factions' => true,
'races' => true,
'professions' => false,
'parsing' => true,
),
);Here's an explanation of each of these fields:
$game_data arrayNext up after the $game_info array is the $game_data array. This array holds the data for the game's races, classes, factions etc. The game manager only needs the $game_data array when it's attempting to install the game. When it's retrieving game information only, it will declare a variable called $get_gameinfo. As such, you should enclose the $game_data array in a conditional statement that checks for the existence of this variable: if (!isset($get_gameinfo))
{
$game_data = array();
}The game data is comprised of several sections. Each section is an array itself with a specific key name. Further, each value for these arrays is a key-value pair in which the key descries the value. The key names should only contain alphabetic characters or an underscore. This key is used for language string lookups, which will be explained further on. armor_typesDeclares the game's armor types. These armor types are used later on. Each armor type is referenced by a unique keyname (such as "cloth" or "plate"). The array holds the following information:
classesDeclares the game's classes. Each class is referenced by a unique keyname (such as "priest" or "deathknight"). The array holds the following information:
class_armorDeclares mappings between the classes and armor types in order to tell EQdkp which classes can use what armor. Each entry is an unnamed array that holds the following information:
factionsDeclares the factions in the game. Each faction is referenced by a unique keyname (such as "horde"). The array holds the following information:
racesDeclares the races that are playable in the game. Each faction is referenced by a unique keyname (such as "tauren" or "night_elf"). The array holds the following information:
parsingThis section contains expressions that will allow parsing of game logs. These expressions have a special (and hopefully understandable) syntax. Each entry is a single string value that contains a parsing string for the game. You can specify multiple parse strings, but only the first string will be used to parse the game logs (NOTE: in a future version it will be possible to select a specific parsing string) Everything in the string will be parsed letter for letter, with a few exceptions.
lang_game.phpThe language file defines strings that will be used to replace the default names for game objects. It should be accessible by EQdkp. A full example can be found in our repository. if ( !defined('EQDKP_INC') )
{
header('HTTP/1.0 404 Not Found');
exit;
}The language strings are stored in an array called $lang. This array may already exist by the time this file is called upon, so you should include the following code to ensure that the new game string entries do not override anything currently included in the $lang array: // Initialize the language array if it isn't already
if (empty($lang) || !is_array($lang))
{
$lang = array();
}
$lang = array_merge($lang, array(
<your values here>
));As you may appreciate, because each game is different in terms of the class names, races etc., a game language string has an expected format. Each language key has a PREFIX_SUFFIX format (note that they're all in uppercase). The PREFIX for a language string can be any of the following values:
The SUFFIX for a language string should correspond to one of the keynames specified in the $game_data array of the game_name.php file. Here's some examples: 'GAME_NAME' => 'World of Warcraft',
'GAME_ID' => 'WoW',
'GAME_CLASS' => 'Class',
'CLASS_DEATH_KNIGHT'=> 'Death Knight',
'CLASS_DRUID' => 'Druid',
'RACE_BLOOD_ELF' => 'Blood Elf',
'RACE_DRAENEI' => 'Draenei',
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||