Exemplo n.º 1
0
<?php

include_once "bootstrap.php";
include_once "hero/weaponController.php";
include_once "hero/heroController.php";
include_once "user/user.php";
$user = new User();
$user = $user->load($currentUID);
$heroController = new heroController();
$userChaBonus = $heroController->getChaModForUser($currentUID);
$smarty->assign("userChaBonus", $userChaBonus);
//html header
$smarty->display("css/css.tpl");
$weaponController = new weaponController();
//menu
$smarty->assign("currentpage", "inventory");
$smarty->assign("help", "This page displays all the weapon you have. Weapons can be scrapped if not required, so long as they are not currently equipped.\n\t\t\t\t\t  Clicking the Weapon Name will allow you to upgrade and rename the weapon. \n\t\t\t\t\t  Clicking a heroes name will show more detailed information about that hero.");
$smarty->assign("helpTitle", "Weapons Page Help");
include_once "menu.php";
if (isset($_REQUEST['action'])) {
    if ($_REQUEST['action'] == "scrap") {
        $scrapWeapon = Weapon::loadWeapon($_REQUEST['ID']);
        if ($scrapWeapon->UserID == $currentUID) {
            if (!is_numeric($scrapWeapon->GetHeroIDFromWeapon())) {
                $user->gold += $scrapWeapon->getScrapValue($userChaBonus);
                $user->Save();
                $scrapWeapon->delete();
                $smarty->assign("message", $scrapWeapon->Name . " has been scrapped for " . $scrapWeapon->getScrapValue($userChaBonus) . "gp");
            } else {
                $smarty->assign("error", "Can not scrap equipped weapons");
            }