Пример #1
0
 public function spawnAllNpcs()
 {
     $npcconflist = $this->config->get("npcs");
     if (!is_array($npcconflist)) {
         $this->config->set("npcs", array());
         return;
     }
     foreach (array_keys($npcconflist) as $pname) {
         $p = $npcconflist[$pname];
         $pos = new Position($p["Pos"][0], $p["Pos"][1], $p["Pos"][2], $this->api->level->getDefault());
         createNpc($pname, $pos);
     }
 }
Пример #2
0
function createTavern()
{
    $table = "tavern";
    $trait_table = "tavern_traits";
    if (empty($_POST['name'])) {
        $first = getTrait($trait_table, "first_name");
        $last = getTrait($trait_table, "last_name");
        $_POST['name'] = $first . " " . $last;
    }
    if (empty($_POST['type'])) {
        $_POST['type'] = getTrait($trait_table, "type");
    }
    // create owner
    if (empty($_POST['tavern_owner_id'])) {
        createNpc();
        $table = "npc";
        $_POST['tavern_owner_id'] = insertFromPostWithIdReturn($table);
    }
}
Пример #3
0
function createSettelment()
{
    $trait_table = "settlement_traits";
    $table = "settlement";
    $columns = getColumnNames($table);
    if (empty($_POST['size'])) {
        $i = rand(0, 2);
        if ($i == 0) {
            $size = "S";
        } else {
            if ($i == 1) {
                $size = "M";
            } else {
                $s = "L";
            }
        }
        $_POST['size'] = $size;
    }
    if (empty($_POST['population'])) {
        $size = $_POST['size'];
        if ($size == "S") {
            $pop = purebell(20, 75, 5);
        } else {
            if ($size == "M") {
                $pop = purebell(76, 300, 10);
            } else {
                $pop = purebell(300, 1500, 100);
            }
        }
        $_POST['population'] = $pop;
    }
    // Pick a mayor
    if (empty($_POST['ruler_id'])) {
        createNpc();
        $table = "npc";
        $_POST['ruler_id'] = insertFromPostWithIdReturn($table);
    }
    foreach ($columns as $column) {
        if (empty($_POST[$column])) {
            $_POST[$column] = getTrait($trait_table, $column);
        }
    }
}
Пример #4
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);
            }
        }
    }
}
Пример #5
0
<?php

include_once '../../config/config.php';
include_once $serverPath . 'utils/db/db_post.php';
require_once $serverPath . 'utils/generator/npc.php';
require_once $serverPath . 'utils/security/createAssestRequired.php';
createNpc();
$table = "npc";
header("Location: " . $baseURL . "assets/npcs/show.php?id=" . insertFromPostWithIdReturn($table));