コード例 #1
0
ファイル: settlement.php プロジェクト: Cassioblu55/aesop_php
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);
        }
    }
}
コード例 #2
0
ファイル: tavern.php プロジェクト: Cassioblu55/aesop_php
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
ファイル: villain.php プロジェクト: Cassioblu55/aesop_php
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);
            }
        }
    }
}
コード例 #4
0
ファイル: create.php プロジェクト: Cassioblu55/aesop_php
<?php

include_once '../../config/config.php';
require_once $serverPath . 'utils/security/createAssestRequired.php';
include_once $serverPath . 'utils/db/db_post.php';
require_once $serverPath . 'utils/generator/settlement.php';
createSettelment();
$table = "settlement";
header("Location: " . $baseURL . "assets/settlements/show.php?id=" . insertFromPostWithIdReturn($table));
コード例 #5
0
ファイル: edit.php プロジェクト: Cassioblu55/aesop_php
<?php

include_once $serverPath . 'utils/db/db_post.php';
if (!empty($_POST)) {
    if (!empty($_GET['id'])) {
        $id = $_GET['id'];
        updateFromPost($table);
    } else {
        $id = insertFromPostWithIdReturn($table);
    }
    header("Location: show.php?id=" . $id);
    die("Redirecting to show.php");
}
include_once $serverPath . 'resources/templates/head.php';
?>

<div ng-controller="encounterEditController">
	<form
		action="edit.php<?php 
if (!empty($_GET['id'])) {
    echo "?id=" . $_GET['id'];
}
?>
"
		method="post">
		<div class="col-md-8">
			<div class="panel panel-default">
				<div class="panel-heading">
					<div class="panel-title">{{addOrEdit}} {{name}} Encounter</div>
				</div>
				<div class="panel-body">