Esempio n. 1
0
function createVillain()
{
    $trait_table = "villain_trait";
    $table = "villain";
    $columns = getColumnNames($table);
    if (empty($_POST['npc_id'])) {
        createNpc();
        $c_table = "npc";
        $_POST['npc_id'] = insertFromPostWithIdReturn($c_table);
    }
    foreach ($columns as $column) {
        if (empty($_POST[$column])) {
            $c = split("_", $column);
            if (count($c) == 2) {
                $type = $c[0];
                $trait = getFullTrait($trait_table, $type);
                $_POST[$type . "_type"] = $trait['kind'];
                $_POST[$type . "_description"] = $trait['description'];
            } else {
                $_POST[$column] = getTrait($trait_table, $column);
            }
        }
    }
}
Esempio n. 2
0
function getTrait($table, $type)
{
    return getFullTrait($table, $type)['trait'];
}