Advertisement
Guest User

Untitled

a guest
Jul 31st, 2012
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.60 KB | None | 0 0
  1. <?php
  2.  
  3.         public function ValidateFigure($gender, $figure, $vip = false, $club = false, $ignoreselectable = true)
  4.         {
  5.             $settypes = explode('.', $figure);
  6.            
  7.             foreach ($settypes as $settype)
  8.             {
  9.                 @list ($type, $id, $colorid) = explode('-', $settype);
  10.                
  11.                 if (!isset($this->sets[$type]))
  12.                 {
  13.                     return false;
  14.                 }
  15.                
  16.                 if (!isset($this->sets[$type][$id]))
  17.                 {
  18.                     return false;
  19.                 }
  20.                
  21.                 $set = $this->sets[$type][$id];
  22.                 $paletteid = $this->setscolors[$type];
  23.                
  24.                 if ($set['gender'] != $gender && $set['gender'] != 'U')
  25.                 {
  26.                     return false;
  27.                 }
  28.                
  29.                
  30.            
  31.                 if ($set['selectable'] == '0' && !$ignoreselectable)
  32.                 {
  33.                     return false;
  34.                 }
  35.                
  36.                 if ($set['colorable'] == '1' && isset($colorid))
  37.                 {
  38.                     if (!isset($this->colors[$paletteid]))
  39.                     {
  40.                         return false;
  41.                     }
  42.                
  43.                     if (!isset($this->colors[$paletteid][$colorid]))
  44.                     {
  45.                         return false;
  46.                     }
  47.                
  48.                     $color = $this->colors[$this->setscolors[$type]][$colorid];
  49.                
  50.                     if ($color['selectable'] == '0' && !$ignoreselectable)
  51.                     {
  52.                         return false;
  53.                     }
  54.                 }
  55.                
  56.                 if ($set['colorable'] == '0' && isset($colorid))
  57.                 {
  58.                     return false;
  59.                 }
  60.                
  61.                 if ($vip || $club)
  62.                 {
  63.                     $maxclub = ($vip) ? 2 : 1;
  64.                    
  65.                     if ($set['club'] > $maxclub)
  66.                     {
  67.                         return false;
  68.                     }
  69.                    
  70.                     if ($color['club'] > $maxclub && $set['colorable'] == '1' && isset($colorid))
  71.                     {
  72.                         return false;
  73.                     }
  74.                 }
  75.                 else if ($set['club'] != '0')
  76.                 {
  77.                     return false;
  78.                 }
  79.             }
  80.            
  81.             return true;
  82.         }
  83.  
  84. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement