Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moved card0 check to config & Flux lib #194

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions config/application.php
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,13 @@
array('module' => 'guild', 'action' => 'emblem')
),

// Card0 special flag. Older rAthena the values are 254,255,-256
'ItemSpecial' => array(
'forge' => 0x00FF,
'create' => 0x00FE,
'pet' => 0x0100,
),

// Job classes, loaded from another file to avoid cluttering this one.
// There isn't normally a need to modify this file, unless it's been
// modified in an update. (In English: DON'T TOUCH THIS.)
Expand Down
14 changes: 14 additions & 0 deletions lib/Flux.php
Original file line number Diff line number Diff line change
Expand Up @@ -934,5 +934,19 @@ public static function monsterSizeName($size)
$size = Flux::config("MonsterSizes.$size");
return $size;
}

/**
* Check if item is special
* @param $item Item object fetched from table
* @return True if item's card0 is special, false otherwise
*/
public static function itemIsSpecial($item) {
$special = Flux::config('ItemSpecial');
if (!$special)
return false;
if ($item->card0 && ($item->card0 == $special->get('forge') || $item->card0 == $special->get('create') || $item->card0 == $special->get('pet')))
return true;
return false;
}
}
?>
20 changes: 20 additions & 0 deletions lib/Flux/Template.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,21 @@ class Flux_Template {
protected $urlWithQs;
protected $urlWithQS; // compatibility.

/**
* CARD0_FORGE value for checking
*/
protected $itemIsForged;

/**
* CARD0_CREATE value for checking
*/
protected $itemIsCreation;

/**
* CARD0_PET value for checking
*/
protected $itemIsPetEgg;

/**
* Module/action for missing action's event.
*
Expand Down Expand Up @@ -228,6 +243,11 @@ public function __construct(Flux_Config $config)
$this->missingViewModuleAction = $config->get('missingViewModuleAction', false);
$this->referer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '';

$special = Flux::config('ItemSpecial');
$this->itemIsForged = $special->get('forge');
$this->itemIsCreation = $special->get('create');
$this->itemIsPetEgg = $special->get('pet');

// Read manifest file if exists
if (file_exists($this->themePath.'/'.$this->themeName.'/manifest.php')) {
$manifest = include($this->themePath.'/'.$this->themeName.'/manifest.php');
Expand Down