Example #1
0
    /**
     * Add javascripts, handle the removing of blueprints and show the blueprints list.
     *
     * @return void
     */
    public function process()
    {
        $this->getTemplate()->loadJs('addBlueprint');
        $this->getTemplate()->loadJs('jquery.materialSelect');
        $this->getTemplate()->loadJs('jquery.techniqueSelect');
        $this->getTemplate()->loadJs('jquery.blueprint');
        $this->getTemplate()->loadJs('showBlueprint');
        $this->getTemplate()->loadJsReadyScript('
			$(document).tooltip({
				content: function () {
					$(this).addClass("tooltip");
					return $(this).attr("title").replace(/(?:\\r\\n|\\r|\\n)/g, "<br />");
				}
			});
			$(".addTalentPoints").addTalentPoints();
		');
        $blueprintListing = \Listing\Blueprints::loadList();
        $itemListing = \Listing\Items::loadList();
        $itemTypeListing = \Listing\ItemTypes::loadList();
        $materialListing = \Listing\Materials::loadList();
        $techniqueListing = \Listing\Techniques::loadList();
        $moneyHelper = new \Helper\Money();
        if ($_GET['remove']) {
            $this->removeBlueprint($blueprintListing->getById($_GET['remove']));
        }
        $translator = \SmartWork\Translator::getInstance();
        $this->getTemplate()->assign('blueprintListing', $blueprintListing);
        $this->getTemplate()->assign('itemListing', $itemListing);
        $this->getTemplate()->assign('itemTypeListing', $itemTypeListing);
        $this->getTemplate()->assign('materialListing', $materialListing);
        $this->getTemplate()->assign('materialList', json_encode($materialListing->getAsArray()));
        $this->getTemplate()->assign('techniqueListing', $techniqueListing);
        $this->getTemplate()->assign('techniqueList', json_encode($techniqueListing->getAsArray()));
        $this->getTemplate()->assign('currencyList', $moneyHelper->getCurrencyList());
        $talentList = array('bowMaking' => $translator->gt('bowMaking'), 'precisionMechanics' => $translator->gt('precisionMechanics'), 'blacksmith' => $translator->gt('blacksmith'), 'woodworking' => $translator->gt('woodworking'), 'leatherworking' => $translator->gt('leatherworking'), 'tailoring' => $translator->gt('tailoring'));
        asort($talentList, SORT_NATURAL);
        $this->getTemplate()->assign('talentList', json_encode($talentList));
        $this->assign('columsPerItemType', array('meleeWeapon' => array('blueprint', 'item', 'itemType', 'damageType', 'materials', 'techniques', 'upgradeHitPoints', 'upgradeBreakFactor', 'upgradeInitiative', 'upgradeWeaponModificator'), 'rangedWeapon' => array('blueprint', 'item', 'itemType', 'damageType', 'materials', 'bonusRangedFightValue', 'reducePhysicalStrengthRequirement')));
    }
Example #2
0
 /**
  * Add javascripts, handle removing of items and show the item list.
  *
  * @return void
  */
 public function process()
 {
     $this->template->loadJs('item');
     $this->getTemplate()->loadJs('jquery.ajax');
     $this->getTemplate()->loadJs('removeRow');
     $this->getTemplate()->loadJs('jquery.popupEdit');
     $itemsListing = \Listing\Items::loadList();
     $moneyHelper = new \Helper\Money();
     switch ($_GET['action']) {
         case 'remove':
             $this->removeItem($itemsListing->getById($_GET['id']));
             break;
         case 'edit':
             $this->editItem($_GET['id'], $_POST['data']);
             break;
         case 'get':
             $this->getItem($itemsListing->getById($_GET['id']));
             break;
     }
     $this->assign('itemsListing', $itemsListing);
     $this->assign('currencyList', $moneyHelper->getCurrencyList());
     $this->assign('columsPerItemType', array('meleeWeapon' => array('item' => array('heading' => 'item', 'key' => 'name'), 'hitPoints' => array('heading' => 'hp', 'key' => 'hitPointsString'), 'weight' => array('heading' => 'weight', 'key' => 'weight'), 'breakFactor' => array('heading' => 'bf', 'key' => 'breakFactor'), 'initiative' => array('heading' => 'ini', 'key' => 'initiative'), 'price' => array('heading' => 'price', 'key' => 'priceFormatted'), 'weaponModificator' => array('heading' => 'wm', 'key' => 'weaponModificatorFormatted'), 'notes' => array('heading' => 'notes', 'key' => 'notes')), 'rangedWeapon' => array('item' => array('heading' => 'item', 'key' => 'name'), 'hitPoints' => array('heading' => 'hp', 'key' => 'hitPointsString'), 'weight' => array('heading' => 'weight', 'key' => 'weight'), 'physicalStrengthRequirement' => array('heading' => 'physicalStrengthRequirement', 'key' => 'physicalStrengthRequirement'), 'price' => array('heading' => 'price', 'key' => 'priceFormatted'))));
 }