345 lines
12 KiB
PHP
345 lines
12 KiB
PHP
<?php
|
|
/**
|
|
* app/plugins/dnd/forms.php
|
|
*
|
|
* This houses all of the form checking functions for this plugin.
|
|
*
|
|
* @package TTE Dungeons & Dragons
|
|
* @version 3.0
|
|
* @author Joey Kimsey <Joey@tabletopelite.com>
|
|
* @link https://TableTopElite.com
|
|
*/
|
|
namespace TheTempusProject\Plugins\Dnd;
|
|
|
|
use TheTempusProject\Bedrock\Functions\Input;
|
|
use TheTempusProject\Bedrock\Functions\Check;
|
|
use TheTempusProject\Classes\Forms;
|
|
|
|
class DnDForms extends Forms {
|
|
/**
|
|
* Adds these functions to the form list.
|
|
*/
|
|
public function __construct() {
|
|
// admin
|
|
self::addHandler( 'createTrait', __CLASS__, 'createTrait' );
|
|
self::addHandler( 'editTrait', __CLASS__, 'editTrait' );
|
|
self::addHandler( 'createSpell', __CLASS__, 'createSpell' );
|
|
self::addHandler( 'editSpell', __CLASS__, 'editSpell' );
|
|
self::addHandler( 'createSourcebook', __CLASS__, 'createSourcebook' );
|
|
self::addHandler( 'editSourcebook', __CLASS__, 'editSourcebook' );
|
|
self::addHandler( 'createSkill', __CLASS__, 'createSkill' );
|
|
self::addHandler( 'editSkill', __CLASS__, 'editSkill' );
|
|
self::addHandler( 'createRace', __CLASS__, 'createRace' );
|
|
self::addHandler( 'editRace', __CLASS__, 'editRace' );
|
|
self::addHandler( 'createMonster', __CLASS__, 'createMonster' );
|
|
self::addHandler( 'editMonster', __CLASS__, 'editMonster' );
|
|
self::addHandler( 'createLanguage', __CLASS__, 'createLanguage' );
|
|
self::addHandler( 'editLanguage', __CLASS__, 'editLanguage' );
|
|
self::addHandler( 'createItem', __CLASS__, 'createItem' );
|
|
self::addHandler( 'editItem', __CLASS__, 'editItem' );
|
|
self::addHandler( 'createGod', __CLASS__, 'createGod' );
|
|
self::addHandler( 'editGod', __CLASS__, 'editGod' );
|
|
self::addHandler( 'createClass', __CLASS__, 'createClass' );
|
|
self::addHandler( 'editClass', __CLASS__, 'editClass' );
|
|
|
|
// character creator
|
|
self::addHandler( 'createCharacterScreenOne', __CLASS__, 'createCharacterScreenOne' );
|
|
self::addHandler( 'createCharacterScreenTwo', __CLASS__, 'createCharacterScreenTwo' );
|
|
self::addHandler( 'createCharacterScreenThree', __CLASS__, 'createCharacterScreenThree' );
|
|
self::addHandler( 'createCharacterScreenFour', __CLASS__, 'createCharacterScreenFour' );
|
|
self::addHandler( 'createCharacterScreenFive', __CLASS__, 'createCharacterScreenFive' );
|
|
self::addHandler( 'createCharacterScreenSix', __CLASS__, 'createCharacterScreenSix' );
|
|
self::addHandler( 'createCharacterScreenSeven', __CLASS__, 'createCharacterScreenSeven' );
|
|
self::addHandler( 'createCharacterScreenEight', __CLASS__, 'createCharacterScreenEight' );
|
|
|
|
}
|
|
public static function createTrait() {
|
|
if ( ! Input::exists( 'name' ) ) {
|
|
Check::addUserError( 'You must provide a name.' );
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
public static function editTrait() {
|
|
if ( ! Input::exists( 'name' ) ) {
|
|
Check::addUserError( 'You must provide a name.' );
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
public static function createSpell() {
|
|
if ( ! Input::exists( 'name' ) ) {
|
|
Check::addUserError( 'You must provide a name.' );
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
public static function editSpell() {
|
|
if ( ! Input::exists( 'name' ) ) {
|
|
Check::addUserError( 'You must provide a name.' );
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
public static function createSourcebook() {
|
|
if ( ! Input::exists( 'name' ) ) {
|
|
Check::addUserError( 'You must provide a name.' );
|
|
return false;
|
|
}
|
|
// if ( ! Input::exists( 'sourceType' ) ) {
|
|
// Check::addUserError( 'You must provide a sourceType.' );
|
|
// return false;
|
|
// }
|
|
if ( ! Input::exists( 'year' ) ) {
|
|
Check::addUserError( 'You must provide a year.' );
|
|
return false;
|
|
}
|
|
// if ( ! Input::exists( 'amazonUrl' ) ) {
|
|
// Check::addUserError( 'You must provide a amazonUrl.' );
|
|
// return false;
|
|
// }
|
|
return true;
|
|
}
|
|
public static function editSourcebook() {
|
|
if ( ! Input::exists( 'name' ) ) {
|
|
Check::addUserError( 'You must provide a name.' );
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
public static function createSkill() {
|
|
if ( ! Input::exists( 'name' ) ) {
|
|
Check::addUserError( 'You must provide a name.' );
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
public static function editSkill() {
|
|
if ( ! Input::exists( 'name' ) ) {
|
|
Check::addUserError( 'You must provide a name.' );
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
public static function createRace() {
|
|
if ( ! Input::exists( 'name' ) ) {
|
|
Check::addUserError( 'You must provide a name.' );
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
public static function editRace() {
|
|
if ( ! Input::exists( 'name' ) ) {
|
|
Check::addUserError( 'You must provide a name.' );
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
public static function createMonster() {
|
|
if ( ! Input::exists( 'name' ) ) {
|
|
Check::addUserError( 'You must provide a name.' );
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
public static function editMonster() {
|
|
if ( ! Input::exists( 'name' ) ) {
|
|
Check::addUserError( 'You must provide a name.' );
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
public static function createLanguage() {
|
|
if ( ! Input::exists( 'name' ) ) {
|
|
Check::addUserError( 'You must provide a name.' );
|
|
return false;
|
|
}
|
|
if ( ! Input::exists( 'privacy' ) ) {
|
|
Check::addUserError( 'You must provide a privacy.' );
|
|
return false;
|
|
}
|
|
if ( ! Input::exists( 'version' ) ) {
|
|
Check::addUserError( 'You must provide a version.' );
|
|
return false;
|
|
}
|
|
if ( ! Input::exists( 'sourcebookID' ) ) {
|
|
Check::addUserError( 'You must provide a sourcebookID.' );
|
|
return false;
|
|
}
|
|
if ( ! Input::exists( 'type' ) ) {
|
|
Check::addUserError( 'You must provide a type.' );
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
public static function editLanguage() {
|
|
if ( ! Input::exists( 'name' ) ) {
|
|
Check::addUserError( 'You must provide a name.' );
|
|
return false;
|
|
}
|
|
if ( ! Input::exists( 'privacy' ) ) {
|
|
Check::addUserError( 'You must provide a privacy.' );
|
|
return false;
|
|
}
|
|
if ( ! Input::exists( 'version' ) ) {
|
|
Check::addUserError( 'You must provide a version.' );
|
|
return false;
|
|
}
|
|
if ( ! Input::exists( 'sourcebookID' ) ) {
|
|
Check::addUserError( 'You must provide a sourcebookID.' );
|
|
return false;
|
|
}
|
|
if ( ! Input::exists( 'type' ) ) {
|
|
Check::addUserError( 'You must provide a type.' );
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
public static function createItem() {
|
|
if ( ! Input::exists( 'name' ) ) {
|
|
Check::addUserError( 'You must provide a name.' );
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
public static function editItem() {
|
|
if ( ! Input::exists( 'name' ) ) {
|
|
Check::addUserError( 'You must provide a name.' );
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
public static function createGod() {
|
|
if ( ! Input::exists( 'name' ) ) {
|
|
Check::addUserError( 'You must provide a name.' );
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
public static function editGod() {
|
|
if ( ! Input::exists( 'name' ) ) {
|
|
Check::addUserError( 'You must provide a name.' );
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
public static function createClass() {
|
|
if ( ! Input::exists( 'name' ) ) {
|
|
Check::addUserError( 'You must provide a name.' );
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
public static function editClass() {
|
|
if ( ! Input::exists( 'name' ) ) {
|
|
Check::addUserError( 'You must provide a name.' );
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
public static function createCharacterScreenOne() {
|
|
if ( ! Input::exists( 'first_name' ) ) {
|
|
Check::addUserError( 'You must provide a first name.' );
|
|
return false;
|
|
}
|
|
if ( ! Input::exists( 'last_name' ) ) {
|
|
Check::addUserError( 'You must provide a last name.' );
|
|
return false;
|
|
}
|
|
if ( ! Input::exists( 'privacy' ) ) {
|
|
Check::addUserError( 'You must provide a privacy.' );
|
|
return false;
|
|
}
|
|
if ( ! Input::exists( 'version' ) ) {
|
|
Check::addUserError( 'You must provide a version.' );
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
public static function createCharacterScreenTwo() {
|
|
if ( ! Input::exists( 'race' ) ) {
|
|
Check::addUserError( 'You must provide a race.' );
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
public static function createCharacterScreenThree() {
|
|
if ( ! Input::exists( 'class' ) ) {
|
|
Check::addUserError( 'You must provide a class.' );
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
public static function createCharacterScreenFour() {
|
|
if ( ! Input::exists( 'name' ) ) {
|
|
Check::addUserError( 'You must provide a name.' );
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
public static function createCharacterScreenFive() {
|
|
if ( ! Input::exists( 'strength' ) ) {
|
|
Check::addUserError( 'You must provide a strength.' );
|
|
return false;
|
|
}
|
|
if ( ! Input::exists( 'dexterity' ) ) {
|
|
Check::addUserError( 'You must provide a dexterity.' );
|
|
return false;
|
|
}
|
|
if ( ! Input::exists( 'constitution' ) ) {
|
|
Check::addUserError( 'You must provide a constitution.' );
|
|
return false;
|
|
}
|
|
if ( ! Input::exists( 'charisma' ) ) {
|
|
Check::addUserError( 'You must provide a charisma.' );
|
|
return false;
|
|
}
|
|
if ( ! Input::exists( 'intelligence' ) ) {
|
|
Check::addUserError( 'You must provide a intelligence.' );
|
|
return false;
|
|
}
|
|
if ( ! Input::exists( 'wisdom' ) ) {
|
|
Check::addUserError( 'You must provide a wisdom.' );
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
public static function createCharacterScreenSix() {
|
|
if ( ! Input::exists( 'order' ) ) {
|
|
Check::addUserError( 'You must provide a order.' );
|
|
return false;
|
|
}
|
|
if ( ! Input::exists( 'morality' ) ) {
|
|
Check::addUserError( 'You must provide a morality.' );
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
public static function createCharacterScreenSeven() {
|
|
if ( ! Input::exists( 'age' ) ) {
|
|
Check::addUserError( 'You must provide an age.' );
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
public static function createCharacterScreenEight() {
|
|
if ( ! Input::exists( 'submit' ) ) {
|
|
Check::addUserError( 'You must provide a submit.' );
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
}
|
|
|
|
new DnDForms;
|