예제 #1
0
 public function __construct()
 {
     $id = Locations::MakeID('Hitman_HQ');
     $location0 = Locations::Find(0);
     parent::__construct($id, new Position(1950, 170), new Position(1780, 340), 85, new Position(202.142, 1869.3627, 13.1406, 280), $location0, -1, 0, $id);
     $this->LoadObjectsFromFile('hitman_hq.txt');
     parent::AddEntrance(-1, 'main', new Position(2263.5876, -755.4053, 38.0447, 120.0885));
 }
예제 #2
0
 public function __construct()
 {
     $location0 = Locations::Find(0);
     $id = Locations::MakeID('Neultral zone');
     parent::__construct($id, new Position(1085, -1990), new Position(1130, -2005), 15, new Position(1121.2744, -2063.98, 69.0078, 90), $location0, -1, 0, 0);
     parent::AddEntrance(1272, 'main', new Position(1125.6589, -2037.153, 69.8805, 270));
     parent::LoadObjectsFromFile('neutralzone_hall.txt');
 }
예제 #3
0
 public function __construct()
 {
     LSBank::$id = Locations::MakeID('Los Santos Bank');
     $location0 = Locations::Find(0);
     parent::__construct(LSBank::$id, new Position(2300, 15), new Position(2340, -25), 40, new Position(2306.1182, -16.238, 26.7496, 281.6266), $location0, -1, 0, LSBank::$id);
     parent::AddEntrance(1274, 'main', new Position(1462.21, -1013.2396, 26.8438, 178.2465));
     /* ID=1274 Dollar icon ($) */
     parent::AddEntrance(1274, 'back', new Position(1426.8937, -966.2885, 37.4297, 349.1802), new Position(2315.2346, -1.3617, 26.7422, 180.4423));
 }
예제 #4
0
 public function __construct()
 {
     $id = Locations::MakeID('Police_Department');
     $location0 = Locations::Find(0);
     parent::__construct($id, new Position(200, 130), new Position(290, 100), 30, new Position(246.3663, 108.5394, 1003.2188, 0), $location0, -1, 10, $id);
     $this->AddEntrance(1239, 'street', new Position(1554.2861, -1675.6412, 16, 90));
     $this->AddEntrance(1239, 'parking', new Position(1568.6268, -1691.0177, 5.8906, 180), new Position(214.8052, 118.2134, 1003.2188, 90));
     $this->AddEntrance(1239, 'roof', new Position(1564.9879, -1685.7429, 28.3956, 180), new Position(237.9606, 114.7937, 1010.2188, 90));
 }
예제 #5
0
 /**
  ** Default constructor
  **
  ** Parameters:
  ** - id:             The unique ID for this house
  ** - name:           The name of this hosue
  ** - maxrooms:       Maximum number of rooms
  ** - default_price:  Default price for unowned rooms, and max price for rooms for sale
  ** - corner1:        Top-Left corner of the location
  ** - corner2:        Bottom-right corner of the location
  ** - edge:           Edge size for the area of this location
  ** - start:          Starting point (default spawn)
  ** - interior:       Interior ID for this location
  **/
 public function __construct($id, $name, $maxrooms, $default_price, Position $corner1, Position $corner2, $edge, Position $start, $interior)
 {
     $location0 = Locations::Find(0);
     $this->id = $id;
     $this->name = $name;
     $this->maxrooms = $maxrooms;
     $this->availrooms = 0;
     $this->default_price = $default_price;
     parent::__construct($id, $corner1, $corner2, $edge, $start, $location0, -1, $interior, $id);
     /* Load all rooms from database */
     $rooms = DB::GetHouseRooms($this->id);
     foreach ($rooms as $room) {
         if ($room['number'] >= $this->maxrooms) {
             continue;
         }
         $newroom = new Room($room['id'], $this, $room['number'], $room['fridge'], new Ownership($room['owner'], $room['fowner']));
         if ($room['owner'] == null && $room['fowner'] == null) {
             /* If both owner and fowner are null, this is an unsold room */
             $newroom->SetAvailable(true);
             $newroom->SetPrice($this->default_price);
             $this->availrooms++;
         } else {
             $newroom->SetPrice($room['price']);
             if ($room['price'] != -1) {
                 /* If price isnt -1, the owner put it for sale */
                 $newroom->SetAvailable(true);
                 $this->availrooms++;
             }
             if ($room['owner'] != null) {
                 $this->prooms[$room['owner']] = $newroom;
             }
             if ($room['fowner'] != null) {
                 $this->frooms[$room['fowner']] = $newroom;
             }
         }
         $this->rooms[$newroom->Number()] = $newroom;
         /* Update the cheapest room on this building */
         if ($newroom->IsAvailable() && ($this->cheapest == null || $this->cheapest->GetPrice() > $newroom->GetPrice())) {
             $this->cheapest = $newroom;
         }
         $newroom->SetChanged(false);
     }
 }
예제 #6
0
 public function __construct($id)
 {
     $this->id = $id;
     GetPlayerName($id, &$this->name);
     $this->position = new Position();
     $this->last_updated_position = new Position();
     $this->spawn_position = new Position(0, 0, 0, 0);
     $this->spawn_weapons = array();
     $this->spawn_skin = 0;
     $this->spawn_team = 0;
     $this->UpdateSpawnInfo();
     /* Initially, set the player in the location0 OOB sector */
     $this->sector = Locations::Find(0)->Locate(new Position(99999999, 99999999), 0, 0);
     $this->sector->AddPlayer($this);
     $this->PreloadAnimLibs();
     $this->SetColor(COLOR_CIVILIAN);
     /* TODO: Set alpha to 0x00 when you build a release */
     $this->SetAlpha(0xff);
     $this->Update();
     /* Hide this player nametag for all, and all nametags for him */
     $this->seeingNametags = array_fill(0, MAX_PLAYERS, false);
     foreach (Players::Get() as $p) {
         $p->CanIdentify($this, false);
         $this->CanIdentify($p, false);
     }
     GetPlayerIP($this->id, &$this->ip);
     $this->guns = array_fill(0, 13, 0);
 }
예제 #7
0
 /**
  ** AddEntrance
  ** Sets the entrance for this location to be shown in the parent location
  **
  ** Parameters:
  ** - modelid:  Entrance pickup id (won't take effect if this is not a Location0 child)
  ** - position: Entrance coordinates
  **/
 public function AddEntrance($modelid, $name, Position $position, Position $start = null)
 {
     $id = 0;
     if ($this->parent == Locations::Find(0)) {
         if ($modelid != -1) {
             $id = CreatePickup($modelid, 23, $position->x, $position->y, $position->z);
         } else {
             $id = -1;
         }
     } else {
         $id = -1;
         if ($this->parent != null) {
             $this->parent->area->AddCheckpoint($position, 1.15);
         }
     }
     if ($start == null) {
         $start = $this->start;
     }
     $entrance = new LocationEntrance($id, $name, $position, $start, $this);
     $this->entrances[] = $entrance;
     $this->area->AddCheckpoint($start, 0.7);
     return $entrance;
 }
예제 #8
0
 public function Auth()
 {
     /* Load the player stats */
     $this->stats = Accounts::GetLoadedStats($this->id);
     if ($this->stats == null) {
         $this->stats = DB::GetAccountStats($this->id);
     }
     if ($this->stats == null) {
         $this->player->Send(COLOR_RED, '* Error loading your stats, contact an administrator.');
         $this->player->Kick();
         return;
     }
     Log::Append(LOG_JOINQUIT, "[{$this->player->id}] {$this->player->name} logged in");
     /* Set the player authed and stop the limit login time */
     Accounts::EraseLoadedStats($this->id);
     $this->authed = true;
     $this->data['password'] = null;
     KillTimer($this->loginTimer);
     $this->loginTimer = null;
     $this->player->SetAdminLevel($this->data['adminlevel']);
     /* Save the player last ip */
     $data = array();
     $data['id'] = $this->id;
     $data['last_ip'] = $this->player->ip;
     DB::SaveAccount($data);
     /*
      * Set the player starting location
      */
     $location0 = Locations::Find(0);
     $location = Locations::Find($this->stats['location']);
     $vworld = $this->stats['vworld'];
     if ($location != null) {
         if ($location->StayAfterLogout() == false) {
             /* Find the location entrance to location0 */
             while ($location->GetParent() != null && $location->GetParent() != $location0) {
                 $location = $location->GetParent();
             }
             if ($location->GetParent() != null) {
                 $entrance = $location->GetEntrance();
                 $this->stats['x'] = $entrance->position->x;
                 $this->stats['y'] = $entrance->position->y;
                 $this->stats['z'] = $entrance->position->z;
                 $this->stats['angle'] = $entrance->position->angle;
             }
             $location = $location0;
             $vworld = 0;
         }
     } else {
         $location = $location0;
         $vworld = 0;
     }
     $this->player->SetLocation($location);
     $this->player->SetVirtualWorld($vworld);
     /* Set player data */
     $this->player->SetSkin($this->stats['skin']);
     $this->player->SetExperience($this->stats['experience']);
     $this->player->SetLevel($this->stats['level']);
     $this->player->SetSex($this->stats['sex']);
     $this->player->SetAge($this->stats['age']);
     $this->player->SetReports($this->stats['reports']);
     $this->player->SetBank($this->stats['bank']);
     $this->player->FreezeBank($this->stats['bankfreezed']);
     $this->player->SetStrength($this->stats['strength']);
     $this->player->SetSpeedometer($this->stats['speedo']);
     /* Marriage is a special case */
     if ($this->stats['married'] != null) {
         /* Find their marriage */
         $marrystats = DB::GetAccountStats($this->stats['married'], 'sex');
         $marryaccount = DB::GetAccount($this->stats['married'], 'id', 'name');
         $this->player->MarryTo($marryaccount['name'], $marrystats['sex']);
     }
     /* Set the player faction and rank */
     $faction_is_null = 0;
     $rank_is_null = 0;
     if ($this->stats['faction'] == null) {
         $faction_is_null = 1;
     }
     if ($this->stats['rank'] == null) {
         $rank_is_null = 1;
     }
     if ($faction_is_null ^ $rank_is_null) {
         echo "[WARNING] Player {$this->player->name} has faction but not rank, or viceversa. Setting both to null\n";
         $this->stats['faction'] = null;
         $this->stats['rank'] = null;
     }
     $this->player->SetFaction($this->stats['faction']);
     $this->player->SetRank($this->stats['rank']);
     $this->player->SetOnduty($this->stats['onduty']);
     /**
      ** Load player skills
      **/
     $this->player->SetUpgradePoints($this->stats['upgradepts']);
     foreach ($this->stats as $name => $value) {
         if (!strncmp($name, 'sk_', 3)) {
             $name = substr($name, 3);
             $this->player->SetSkill(Players::GetSkillFlag($name), $value);
         }
     }
     /**
      ** Load player properties
      **/
     /* Spawn the player and set his last position, if he had */
     $this->player->LagProtection();
     $this->player->Spawn();
     if ($this->stats['x'] != 0 || $this->stats['y'] != 0 || $this->stats['z'] != 0 || $this->stats['angle'] != 0) {
         $pos = new Position($this->stats['x'], $this->stats['y'], $this->stats['z'], $this->stats['angle']);
         $sector = $location->Locate($pos);
         $this->player->SetPosition($pos);
         $location->StreamObjects($this->player, $pos, $sector);
     }
     /* Set player data required to be set after spawn */
     $this->player->SetHunger($this->stats['hunger']);
     $this->player->SetInjures($this->stats['injures']);
     $this->player->SetMoney($this->stats['money']);
     $this->player->CheckHealth(true);
     $this->player->CheckGuns(true);
     /* Set the player guns */
     for ($i = 0; $i < 13; $i++) {
         if ($this->stats['slot_' . $i] > 0) {
         }
     }
     /* Send the join info to players who requested it */
     foreach (Players::GetJQ() as $p) {
         $p->Send(COLOR_GRAY, "[JOIN] {$this->player->name}({$this->player->id}) has logged in");
     }
     /* Set the player message receiving defaults */
     if ($this->player->togjq == true) {
         Players::AddToJQ($this->player);
     }
     if ($this->player->togooc == true) {
         Players::AddToOOC($this->player);
     }
     /* Check if the player must spawn in jail */
     if ($this->stats['jailtime'] > 0) {
         $this->player->Jail($this->stats['jailtime']);
     }
     /* Show the clock */
     TextDrawShowForPlayer($this->player->id, Core::GetClock());
     $this->player->Update();
 }
예제 #9
0
파일: HQ.php 프로젝트: ryden/ItalyMafia-3.0
 public function __construct(Faction $owner, Position $start, Position $topleft, Position $bottomright, $edge, $interior)
 {
     $location0 = Locations::Find(0);
     parent::__construct($owner->ID(), $topleft, $bottomright, $edge, $start, $location0, -1, $interior, $owner->ID());
 }