echo "Stat added ! <br>"; } if (!$persistManager->deleteStat($todelstat->name)) { echo $persistManager->getLastError(); echo "<br>"; } else { echo "Stat Deleted ! <br>"; } } else { echo "Stat To Deleted not created ! <br>"; } //Trait echo "<br><br>TRAIT DELETION------------------------------------------ <br><br>"; $todelbm = new EPBonusMalus("TODELETE1", EPBonusMalus::$ON_APTITUDE, 5); $todeltrait = new EPTrait("TRAIT_TODELETE", "", EPTrait::$POSITIVE_TRAIT, EPTrait::$MORPH_TRAIT, 10, array($todelbm)); if (!$persistManager->persistTrait($todeltrait)) { echo $persistManager->getLastError(); echo "<br>"; } else { echo "Trait added ! <br>"; } if (!$persistManager->deleteTrait($todeltrait->name)) { echo $persistManager->getLastError(); echo "<br>"; } else { echo "Trait Deleted ! <br>"; } //Ai echo "<br><br>AI DELETION------------------------------------------ <br><br>"; $delaptAiList = array(new EPAptitude("TODELETE1", "")); $delstatAiList = array(new EPStat("TODELETE2", "", ""));
require_once '../php/EPBonusMalus.php'; require_once '../php/EPTrait.php'; $epListP = new EPListProvider('../php/config.ini'); $persistManager = new EPPersistentDataManager('../php/config.ini'); $_SESSION['traitList'] = $epListP->getListTraits(); $_SESSION['bmList'] = $epListP->getListBonusMalus(); if (isset($_POST['addTrait'])) { $bmlistInject = array(); if (isset($_POST['selectedBM'])) { foreach ($_POST['selectedBM'] as $bm) { $bmObj = $epListP->getBonusMalusByName($bm); array_push($bmlistInject, $bmObj); } } $newTrait = new EPTrait($_POST['name'], $_POST['desc'], $_POST['side'], $_POST['applyTo'], $_POST['cost'], $bmlistInject, $_POST['level'], $_POST['isFor']); if (!$persistManager->persistTrait($newTrait)) { echo $persistManager->getLastError(); echo "<br><br>"; } else { $_SESSION['traitList'] = $epListP->getListTraits(); echo "<b> Trait Added ! </b><br><br>"; } } else { if (isset($_POST['deleteTrait'])) { if (!$persistManager->deleteTrait($_POST['deleteTrait'])) { echo $persistManager->getLastError(); echo "<br><br>"; } else { $_SESSION['traitList'] = $epListP->getListTraits(); echo "<b> Trait Deleted ! </b><br><br>"; }