コード例 #1
0
 private static function ArgumentParser($SpellData, $Spell, $Argument, $Value, $MathEquation = false)
 {
     $Modifiers = array('+', '-', '/', '*', '%', '^');
     $Data = '';
     switch ($Argument) {
         case 's':
             if (is_numeric($Spell)) {
                 $SpellData = Spells::GetSpellByID($Spell);
             }
             if ($MathEquation == false) {
                 $BasePoints = $SpellData['effect1BasePoints'] + 1;
                 $Data = abs($BasePoints) . ($SpellData['effect1DieSides'] > 1 ? ' - ' . abs($BasePoints + $SpellData['effect1DieSides']) : '');
             } else {
                 $Equation = abs($SpellData['effect1BasePoints']) . $MathEquation;
                 eval("\$BasePoints = {$Equation};");
                 $Data = abs(floor($BasePoints)) . ($SpellData['effect1DieSides'] > 1 ? ' - ' . abs(floor($BasePoints) + $SpellData['effect1DieSides']) : '');
             }
             break;
         case 'm':
             if (is_numeric($Spell)) {
                 $SpellData = Spells::GetSpellByID($Spell);
             }
             if ($MathEquation) {
                 $Equation = abs($SpellData['effect1BasePoints']) . $MathEquation;
                 eval("\$BasePoints = {$Equation};");
                 $Data = abs($BasePoints);
             }
             break;
         case 'u':
             if (is_numeric($Spell)) {
                 $SpellData = Spells::GetSpellByID($Spell);
             }
             if (isset($SpellData['effect1Aura'])) {
                 $BasePoints = $SpellData['effect1Aura'] + 1;
             }
             $Data = abs($BasePoints);
             break;
         case 'd':
             if (is_numeric($Spell)) {
                 $SpellData = Spells::GetSpellDurationBySpellID($Spell);
                 $BasePoints = $SpellData['durationBase'] > 0 ? $SpellData['durationBase'] + 1 : 0;
             } else {
                 $BasePoints = Spells::GetSpellDurationByDurationID($SpellData['durationID']);
             }
             $Data = Spells::GetDuration($BasePoints) . ' ' . Items::$TM->GetConfigVars('Item_Spell_DS');
             break;
         case 'a':
             if (is_numeric($Spell)) {
                 $SpellData = Spells::GetSpellRadiusBySpellID($Spell);
             }
             $BasePoints = Spells::GetSpellRadiusByRadiusID($SpellData['effect' . trim($Value) . 'radius']);
             $Data = abs($BasePoints);
             break;
     }
     return $Data;
 }