Skip to content

Commit 80e2bc4

Browse files
committed
Moved card0 check to config & Flux lib
* Fixed rathena#190 * The card0 values are defined in config file (application.php) in `ItemSpecial`. By default, using rAthena's card0 values. * The usage will be `Flux::itemIsSpecial($item)`. Returns `true` if item's card0 is special, `false` otherwise * For control checking (ifs) for item is forged * `if ($item->card0 == $this->itemIsForged)` * `if ($item->card0 == $this->itemIsCreation)` * `if ($item->card0 == $this->itemIsPetEgg)`
1 parent cb92485 commit 80e2bc4

File tree

3 files changed

+41
-0
lines changed

3 files changed

+41
-0
lines changed

Diff for: config/application.php

+7
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,13 @@
407407
array('module' => 'guild', 'action' => 'emblem')
408408
),
409409

410+
// Card0 special flag. Older rAthena the values are 254,255,-256
411+
'ItemSpecial' => array(
412+
'forge' => 0x00FF,
413+
'create' => 0x00FE,
414+
'pet' => 0x0100,
415+
),
416+
410417
// Job classes, loaded from another file to avoid cluttering this one.
411418
// There isn't normally a need to modify this file, unless it's been
412419
// modified in an update. (In English: DON'T TOUCH THIS.)

Diff for: lib/Flux.php

+14
Original file line numberDiff line numberDiff line change
@@ -934,5 +934,19 @@ public static function monsterSizeName($size)
934934
$size = Flux::config("MonsterSizes.$size");
935935
return $size;
936936
}
937+
938+
/**
939+
* Check if item is special
940+
* @param $item Item object fetched from table
941+
* @return True if item's card0 is special, false otherwise
942+
*/
943+
public static function itemIsSpecial($item) {
944+
$special = Flux::config('ItemSpecial');
945+
if (!$special)
946+
return false;
947+
if ($item->card0 && ($item->card0 == $special->get('forge') || $item->card0 == $special->get('create') || $item->card0 == $special->get('pet')))
948+
return true;
949+
return false;
950+
}
937951
}
938952
?>

Diff for: lib/Flux/Template.php

+20
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,21 @@ class Flux_Template {
165165
protected $urlWithQs;
166166
protected $urlWithQS; // compatibility.
167167

168+
/**
169+
* CARD0_FORGE value for checking
170+
*/
171+
protected $itemIsForged;
172+
173+
/**
174+
* CARD0_CREATE value for checking
175+
*/
176+
protected $itemIsCreation;
177+
178+
/**
179+
* CARD0_PET value for checking
180+
*/
181+
protected $itemIsPetEgg;
182+
168183
/**
169184
* Module/action for missing action's event.
170185
*
@@ -228,6 +243,11 @@ public function __construct(Flux_Config $config)
228243
$this->missingViewModuleAction = $config->get('missingViewModuleAction', false);
229244
$this->referer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '';
230245

246+
$special = Flux::config('ItemSpecial');
247+
$this->itemIsForged = $special->get('forge');
248+
$this->itemIsCreation = $special->get('create');
249+
$this->itemIsPetEgg = $special->get('pet');
250+
231251
// Read manifest file if exists
232252
if (file_exists($this->themePath.'/'.$this->themeName.'/manifest.php')) {
233253
$manifest = include($this->themePath.'/'.$this->themeName.'/manifest.php');

0 commit comments

Comments
 (0)