Advertisement
Protocol_

OCPGame

Apr 12th, 2012
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.82 KB | None | 0 0
  1. <?php
  2. class ocpGame {
  3.       public $type;
  4.       public $roomID;
  5.       public $server;
  6.       public function __construct($type, $roomID){
  7.           $this->type = $type;
  8.           $this->roomID = $roomID;
  9.       }
  10.       public function handlePacket($packet, &$user){
  11.           $raw = explode("%", $packet);
  12.           $cmd = $raw[3];
  13.           if($cmd == "zo")
  14.               $coins = round((int) $raw[5] / 10, 0); // 1.96
  15.               $user->setCoins((int)$user->getCoins() + $coins);
  16.           if((int)$this->type == 1){
  17.               //Single User
  18.               if($cmd == "zo")
  19.                   $user->setCoins((int)$user->getCoins() + ((int) $raw[5] / 10));
  20.           } else if((int)$this->type == 2){
  21.               if($cmd == ""){    }
  22.           } else {
  23.             //Something's gone horribly wrong
  24.               echo "Somethings gone horribly wrong. Game type: " . $this->type . ", room ID: " . $this->roomID . "\n";
  25.           }
  26.       }
  27.   }
  28. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement