public function __construct($conditions = [], $miscData = null) { parent::__construct($conditions, $miscData); foreach ($this->iterate() as &$_curTpl) { // item is scaling; overwrite other values if ($_curTpl['scalingStatDistribution'] > 0 && $_curTpl['scalingStatValue'] > 0) { $this->initScalingStats(); } $this->initJsonStats(); // readdress itemset .. is wrong for virtual sets if ($miscData && isset($miscData['pcsToSet']) && isset($miscData['pcsToSet'][$this->id])) { $this->json[$this->id]['itemset'] = $miscData['pcsToSet'][$this->id]; } // unify those pesky masks $_ =& $_curTpl['requiredClass']; if ($_ < 0 || ($_ & CLASS_MASK_ALL) == CLASS_MASK_ALL) { $_ = 0; } $_ =& $_curTpl['requiredRace']; if ($_ < 0 || ($_ & RACE_MASK_ALL) == RACE_MASK_ALL) { $_ = 0; } // sources if ($_curTpl['moreType'] && $_curTpl['moreTypeId']) { $this->sourceMore[$_curTpl['moreType']][] = $_curTpl['moreTypeId']; } for ($i = 1; $i < 25; $i++) { if ($_ = $_curTpl['src' . $i]) { $this->sources[$this->id][$i][] = $_; } unset($_curTpl['src' . $i]); } } }
public function __construct($conditions = []) { parent::__construct($conditions); // post processing foreach ($this->iterate() as $id => &$_curTpl) { // preparse sources - notice: under this system titles can't have more than one source (or two for achivements), which is enough for standard TC cases but may break custom cases if ($_curTpl['moreType'] == TYPE_ACHIEVEMENT) { $this->sources[$this->id][12][] = $_curTpl['moreTypeId']; } else { if ($_curTpl['moreType'] == TYPE_QUEST) { $this->sources[$this->id][4][] = $_curTpl['moreTypeId']; } else { if ($_curTpl['src13']) { $this->sources[$this->id][13][] = $_curTpl['src13']; } } } // titles display up to two achievements at once if ($_curTpl['src12Ext']) { $this->sources[$this->id][12][] = $_curTpl['src12Ext']; } unset($_curTpl['src12Ext']); unset($_curTpl['moreType']); unset($_curTpl['moreTypeId']); unset($_curTpl['src3']); // shorthand for more generic access foreach (Util::$localeStrings as $i => $str) { if ($str) { $_curTpl['name_loc' . $i] = trim(str_replace('%s', '', $_curTpl['male_loc' . $i])); } } } }
public function __construct($conditions = []) { parent::__construct($conditions); foreach ($this->iterate() as $k => &$_curTpl) { $_curTpl['skills'] = explode(' ', $_curTpl['skills']); } }
public function __construct($conditions = [], $miscData = null) { parent::__construct($conditions, $miscData); if ($this->error) { return; } // post processing foreach ($this->iterate() as $_id => &$curTpl) { // unpack miscInfo $curTpl['lootStack'] = []; $curTpl['spells'] = []; if (in_array($curTpl['type'], [OBJECT_GOOBER, OBJECT_RITUAL, OBJECT_SPELLCASTER, OBJECT_FLAGSTAND, OBJECT_FLAGDROP, OBJECT_AURA_GENERATOR, OBJECT_TRAP])) { $curTpl['spells'] = array_combine(['onUse', 'onSuccess', 'aura', 'triggered'], [$curTpl['onUseSpell'], $curTpl['onSuccessSpell'], $curTpl['auraSpell'], $curTpl['triggeredSpell']]); } if (!$curTpl['miscInfo']) { continue; } switch ($curTpl['type']) { case OBJECT_CHEST: case OBJECT_FISHINGHOLE: $curTpl['lootStack'] = explode(' ', $curTpl['miscInfo']); break; case OBJECT_CAPTURE_POINT: $curTpl['capture'] = explode(' ', $curTpl['miscInfo']); break; case OBJECT_MEETINGSTONE: $curTpl['mStone'] = explode(' ', $curTpl['miscInfo']); break; } } }
public function __construct($conditions = [], $miscData = null) { parent::__construct($conditions, $miscData); foreach ($this->iterate() as &$_curTpl) { // unpack attunements $_curTpl['attunes'] = []; if ($_curTpl['attunementsN']) { foreach (explode(' ', $_curTpl['attunementsN']) as $req) { $req = explode(':', $req); if (!isset($_curTpl['attunes'][$req[0]])) { $_curTpl['attunes'][$req[0]] = [$req[1]]; } else { $_curTpl['attunes'][$req[0]][] = $req[1]; } } } if ($_curTpl['attunementsH']) { foreach (explode(' ', $_curTpl['attunementsH']) as $req) { $req = explode(':', $req); if (!isset($_curTpl['attunes'][$req[0]])) { $_curTpl['attunes'][$req[0]] = [-$req[1]]; } else { $_curTpl['attunes'][$req[0]][] = -$req[1]; } } } unset($_curTpl['attunementsN']); unset($_curTpl['attunementsH']); } }
/** * {@inheritdoc} */ public function __construct($object) { parent::__construct($object); if ($this->celery) { $this->celery = Celery($this->celery); } }
public function __construct($class, $config = array()) { if (!class_exists($class)) { throw new \FelixOnline\Exceptions\InternalException('Class ' . $class . ' not found'); } $this->class = $class; parent::__construct($config); }
public function __construct($val) { $val = trim($val); if (preg_match("/^1\\d{10}\$/", $val)) { parent::__construct($val); } else { throw new Exception("this value is not Mobile"); } }
public function __construct($conditions = []) { parent::__construct($conditions); // post processing foreach ($this->iterate() as &$curTpl) { // remap for generic access $curTpl['name'] = $curTpl['cmd']; } }
public function __construct($conditions = []) { parent::__construct($conditions); if ($this->error) { return; } // post processing foreach ($this->iterate() as &$_curTpl) { // prepare factionTemplates $_curTpl['templateIds'] = $_curTpl['templateIds'] ? explode(' ', $_curTpl['templateIds']) : []; // prepare quartermaster $_curTpl['qmNpcIds'] = $_curTpl['qmNpcIds'] ? explode(' ', $_curTpl['qmNpcIds']) : []; } }
public function __construct($conditions = []) { parent::__construct($conditions); // unseting elements while we iterate over the array will cause the pointer to reset $replace = []; // post processing foreach ($this->iterate() as $__) { // emulate category $sT = $this->curTpl['scheduleType']; if (!$this->curTpl['holidayId']) { $this->curTpl['category'] = 0; } else { if ($sT == 2) { $this->curTpl['category'] = 3; } else { if (in_array($sT, [0, 1])) { $this->curTpl['category'] = 2; } else { if ($sT == -1) { $this->curTpl['category'] = 1; } } } } // preparse requisites if ($this->curTpl['requires']) { $this->curTpl['requires'] = explode(' ', $this->curTpl['requires']); } $this->curTpl['eventBak'] = -$this->curTpl['id']; // change Ids if holiday is set if ($this->curTpl['holidayId'] > 0) { $this->curTpl['id'] = $this->curTpl['holidayId']; $this->curTpl['name'] = $this->getField('name', true); $replace[$this->id] = $this->curTpl; unset($this->curTpl['description']); } else { // template $this->curTpl['name_loc0'] = $this->curTpl['description']; $this->curTpl['iconString'] = 'trade_engineering'; $this->curTpl['name'] = '(SERVERSIDE) ' . $this->getField('description', true); $replace[$this->id] = $this->curTpl; } } foreach ($replace as $old => $data) { unset($this->templates[$old]); $this->templates[$data['id']] = $data; } }
public function __construct($conditions = [], $miscData = null) { parent::__construct($conditions, $miscData); if ($this->error) { return; } // post processing $rewards = DB::World()->select(' SELECT ar.entry AS ARRAY_KEY, ar.*, lar.* FROM achievement_reward ar LEFT JOIN locales_achievement_reward lar ON lar.entry = ar.entry WHERE ar.entry IN (?a)', $this->getFoundIDs()); foreach ($this->iterate() as $_id => &$_curTpl) { $_curTpl['rewards'] = []; if (!empty($rewards[$_id])) { $_curTpl = array_merge($rewards[$_id], $_curTpl); if ($rewards[$_id]['mailTemplate']) { // using class Loot creates an inifinite loop cirling between Loot, ItemList and SpellList or something // $mailSrc = new Loot(); // $mailSrc->getByContainer(LOOT_MAIL, $rewards[$_id]['mailTemplate']); // foreach ($mailSrc->iterate() as $loot) // $_curTpl['rewards'][] = [TYPE_ITEM, $loot['id']]; // lets just assume for now, that mailRewards for achievements do not contain references $mailRew = DB::World()->selectCol('SELECT Item FROM mail_loot_template WHERE Reference <= 0 AND entry = ?d', $rewards[$_id]['mailTemplate']); foreach ($mailRew as $mr) { $_curTpl['rewards'][] = [TYPE_ITEM, $mr]; } } } //"rewards":[[11,137],[3,138]] [type, typeId] if (!empty($_curTpl['item'])) { $_curTpl['rewards'][] = [TYPE_ITEM, $_curTpl['item']]; } if (!empty($_curTpl['itemExtra'])) { $_curTpl['rewards'][] = [TYPE_ITEM, $_curTpl['itemExtra']]; } if (!empty($_curTpl['title_A'])) { $_curTpl['rewards'][] = [TYPE_TITLE, $_curTpl['title_A']]; } if (!empty($_curTpl['title_H'])) { if (empty($_curTpl['title_A']) || $_curTpl['title_A'] != $_curTpl['title_H']) { $_curTpl['rewards'][] = [TYPE_TITLE, $_curTpl['title_H']]; } } // icon $_curTpl['iconString'] = $_curTpl['iconString'] ?: 'trade_engineering'; } }
public function __construct($conditions = []) { parent::__construct($conditions); // post processing foreach ($this->iterate() as &$curTpl) { $curTpl['spells'] = []; // [spellId, triggerType, charges, chanceOrPpm] for ($i = 1; $i <= 3; $i++) { if ($curTpl['object' . $i] <= 0) { continue; } switch ($curTpl['type' . $i]) { case 1: $proc = -$this->getField('ppmRate') ?: ($this->getField('procChance') ?: $this->getField('amount' . $i)); $curTpl['spells'][$i] = [$curTpl['object' . $i], 2, $curTpl['charges'], $proc]; $this->relSpells[] = $curTpl['object' . $i]; break; case 3: $curTpl['spells'][$i] = [$curTpl['object' . $i], 1, $curTpl['charges'], 0]; $this->relSpells[] = $curTpl['object' . $i]; break; case 7: $curTpl['spells'][$i] = [$curTpl['object' . $i], 0, $curTpl['charges'], 0]; $this->relSpells[] = $curTpl['object' . $i]; break; } } // floats are fetched as string from db :< $curTpl['dmg'] = floatVal($curTpl['dmg']); $curTpl['dps'] = floatVal($curTpl['dps']); // remove zero-stats foreach (Util::$itemMods as $str) { if ($curTpl[$str] == 0) { // empty(0.0f) => true .. yeah, sure unset($curTpl[$str]); } } if ($curTpl['dps'] == 0) { unset($curTpl['dps']); } } if ($this->relSpells) { $this->relSpells = new SpellList(array(['id', $this->relSpells])); } }
public function __construct($conditions = [], $miscData = null) { parent::__construct($conditions, $miscData); if ($this->error) { return; } // post processing foreach ($this->iterate() as $_id => &$curTpl) { // check for attackspeeds if (!$curTpl['atkSpeed']) { $curTpl['atkSpeed'] = 2.0; } else { $curTpl['atkSpeed'] /= 1000; } if (!$curTpl['rngAtkSpeed']) { $curTpl['rngAtkSpeed'] = 2.0; } else { $curTpl['rngAtkSpeed'] /= 1000; } } }
public function __construct($conditions = []) { parent::__construct($conditions); // post processing foreach ($this->iterate() as &$_curTpl) { $_curTpl['classes'] = []; $_curTpl['pieces'] = []; for ($i = 1; $i < 12; $i++) { if ($_curTpl['classMask'] & 1 << $i - 1) { $this->classes[] = $i; $_curTpl['classes'][] = $i; } } for ($i = 1; $i < 10; $i++) { if ($piece = $_curTpl['item' . $i]) { $_curTpl['pieces'][] = $piece; $this->pieceToSet[$piece] = $this->id; } } } $this->classes = array_unique($this->classes); }
function __construct($array = null) { parent::__construct($array); }
public function __construct($conditions = []) { parent::__construct($conditions); if ($this->error) { return; } // post processing $foo = DB::World()->selectCol('SELECT perfectItemType FROM skill_perfect_item_template WHERE spellId IN (?a)', $this->getFoundIDs()); foreach ($this->iterate() as &$_curTpl) { // required for globals if ($idx = $this->canCreateItem()) { foreach ($idx as $i) { $foo[] = (int) $_curTpl['effect' . $i . 'CreateItemId']; } } for ($i = 1; $i <= 8; $i++) { if ($_curTpl['reagent' . $i] > 0) { $foo[] = (int) $_curTpl['reagent' . $i]; } } for ($i = 1; $i <= 2; $i++) { if ($_curTpl['tool' . $i] > 0) { $foo[] = (int) $_curTpl['tool' . $i]; } } // ranks $this->ranks[$this->id] = $this->getField('rank', true); // sources for ($i = 1; $i < 25; $i++) { if ($_ = $_curTpl['src' . $i]) { $this->sources[$this->id][$i][] = $_; } unset($_curTpl['src' . $i]); } // set full masks to 0 $_curTpl['reqClassMask'] &= CLASS_MASK_ALL; if ($_curTpl['reqClassMask'] == CLASS_MASK_ALL) { $_curTpl['reqClassMask'] = 0; } $_curTpl['reqRaceMask'] &= RACE_MASK_ALL; if ($_curTpl['reqRaceMask'] == RACE_MASK_ALL) { $_curTpl['reqRaceMask'] = 0; } // unpack skillLines $_curTpl['skillLines'] = []; if ($_curTpl['skillLine1'] < 0) { foreach (Util::$skillLineMask[$_curTpl['skillLine1']] as $idx => $pair) { if ($_curTpl['skillLine2OrMask'] & 1 << $idx) { $_curTpl['skillLines'][] = $pair[1]; } } } else { if ($sec = $_curTpl['skillLine2OrMask']) { if ($this->id == 818) { // and another hack .. basic Campfire (818) has deprecated skill Survival (142) as first skillLine $_curTpl['skillLines'] = [$sec, $_curTpl['skillLine1']]; } else { $_curTpl['skillLines'] = [$_curTpl['skillLine1'], $sec]; } } else { if ($prim = $_curTpl['skillLine1']) { $_curTpl['skillLines'] = [$prim]; } } } unset($_curTpl['skillLine1']); unset($_curTpl['skillLine2OrMask']); } if ($foo) { $this->relItems = new ItemList(array(['i.id', array_unique($foo)], CFG_SQL_LIMIT_NONE)); } }
public function __construct($conditions = [], $miscData = null) { parent::__construct($conditions, $miscData); // i don't like this very much $currencies = DB::Aowow()->selectCol('SELECT id AS ARRAY_KEY, itemId FROM ?_currencies'); // post processing foreach ($this->iterate() as $id => &$_curTpl) { $_curTpl['cat1'] = $_curTpl['zoneOrSort']; // should probably be in a method... $_curTpl['cat2'] = 0; foreach (Util::$questClasses as $k => $arr) { if (in_array($_curTpl['cat1'], $arr)) { $_curTpl['cat2'] = $k; break; } } // store requirements $requires = []; for ($i = 1; $i < 7; $i++) { if ($_ = $_curTpl['reqItemId' . $i]) { $requires[TYPE_ITEM][] = $_; } if ($i > 4) { continue; } if ($_curTpl['reqNpcOrGo' . $i] > 0) { $requires[TYPE_NPC][] = $_curTpl['reqNpcOrGo' . $i]; } else { if ($_curTpl['reqNpcOrGo' . $i] < 0) { $requires[TYPE_OBJECT][] = -$_curTpl['reqNpcOrGo' . $i]; } } if ($_ = $_curTpl['reqSourceItemId' . $i]) { $requires[TYPE_ITEM][] = $_; } } if ($requires) { $this->requires[$id] = $requires; } // store rewards $rewards = []; $choices = []; if ($_ = $_curTpl['rewardTitleId']) { $rewards[TYPE_TITLE][] = $_; } if ($_ = $_curTpl['rewardHonorPoints']) { $rewards[TYPE_CURRENCY][104] = $_; } if ($_ = $_curTpl['rewardArenaPoints']) { $rewards[TYPE_CURRENCY][103] = $_; } for ($i = 1; $i < 7; $i++) { if ($_ = $_curTpl['rewardChoiceItemId' . $i]) { $choices[TYPE_ITEM][$_] = $_curTpl['rewardChoiceItemCount' . $i]; } if ($i > 5) { continue; } if ($_ = $_curTpl['rewardFactionId' . $i]) { $rewards[TYPE_FACTION][$_] = $_curTpl['rewardFactionValue' . $i]; } if ($i > 4) { continue; } if ($_ = $_curTpl['rewardItemId' . $i]) { $qty = $_curTpl['rewardItemCount' . $i]; if (in_array($_, $currencies)) { $rewards[TYPE_CURRENCY][array_search($_, $currencies)] = $qty; } else { $rewards[TYPE_ITEM][$_] = $qty; } } } if ($rewards) { $this->rewards[$id] = $rewards; } if ($choices) { $this->choices[$id] = $choices; } } }
/** * Constructor */ public function __construct($length, $options = null) { parent::__construct($options); $this->_length = intval($length); }
/** * Constructor */ public function __construct($set = array(), $options = null) { parent::__construct($options); $this->_set = $set; }