Example #1
0
 public static function AllowFaction(Player $player, Faction $faction)
 {
     if ($faction->BankFreezed()) {
         $player->Send(COLOR_BANK_FREEZED, '[ERROR] Your faction bank account has been freezed, operation not completed');
         return false;
     }
     return true;
 }
Example #2
0
 public static function getAll($includePermanent = true)
 {
     $factions = array();
     if (!self::checkMStore(true)) {
         return $factions;
     }
     foreach (scandir(self::$mstore . DIRECTORY_SEPARATOR . "factions_faction") as $key => $factionRaw) {
         if (!in_array($factionRaw, array(".", ".."))) {
             $path = self::$mstore . DIRECTORY_SEPARATOR . "factions_faction" . DIRECTORY_SEPARATOR . $factionRaw;
             if (is_file($path)) {
                 $factionId = basename($factionRaw, ".json");
                 $faction = new Faction($factionId);
                 if (!$includePermanent && $faction->isPermanent()) {
                     continue;
                 }
                 $factions[$factionId] = $faction;
             }
         }
     }
     return $factions;
 }
Example #3
0
 public function __construct($name, $color, $bank, $maxvehicles, $maxmembers, $membercount)
 {
     /* Create the faction */
     parent::__construct($name, $color, $bank, $maxvehicles, $maxmembers, $membercount);
     /* Create the ranks */
     parent::RegisterRank(0, 'Godfather', MEMBER_ALLOWALL, 120, 216);
     parent::RegisterRank(1, 'Right Hand', MEMBER_ALLOWALL, 240, 216);
     parent::RegisterRank(2, 'Consigliere', 0, 165, 169);
     parent::RegisterRank(3, 'Capo', 0);
     parent::RegisterRank(4, 'Soldier', 0);
     parent::RegisterRank(5, 'Scagnozzo', 0);
     parent::RegisterRank(6, 'Picciotto', 0);
 }
Example #4
0
 public static function CheckPayBank(Player $player, Faction $faction, $amount, Faction $target = null)
 {
     if ($amount < 1) {
         $player->Send(COLOR_INVALID_AMOUNT, '[ERROR] Invalid amount');
     } else {
         if ($faction->BankFreezed()) {
             $player->Send(COLOR_BANK_FREEZED, '[ERROR] Your faction bank account has been freezed, operation not completed');
         } else {
             if ($amount > $faction->GetBank()) {
                 $player->Send(COLOR_NOTENOUGH_MONEYBANK, '[ERROR] Your faction bank account doesn\'t have this amount of money');
             } else {
                 if ($target && $target->BankFreezed()) {
                     $player->Send(COLOR_BANK_FREEZED, '[ERROR] Given faction bank account has been freezed, operation cancelled');
                 } else {
                     return true;
                 }
             }
         }
     }
     return false;
 }
Example #5
0
 public function GetPlayerColor(Player $player)
 {
     return parent::GetColor();
 }
Example #6
0
 public function __construct($name, $color, $bank, $maxvehicles, $maxmembers, $membercount)
 {
     parent::__construct($name, $color, $bank, $maxvehicles, $maxmembers, $membercount);
     parent::RegisterRank(0, 'Capo dei capi', MEMBER_ALLOWALL, 186);
 }
Example #7
0
 private function factions()
 {
     $class = get_class(new Faction());
     $this->log($this->verb . ' Factions');
     $url = $this->baseUrl . "faction?c:limit=100";
     $data = $this->getCensusData($url);
     if (!$data) {
         return false;
     }
     // Collection of Eloquent objects from API
     $apiCollection = new Collection();
     foreach ($data->faction_list as $faction) {
         $values = [];
         $values['id'] = isset($faction->faction_id) ? $faction->faction_id : null;
         $values['name'] = isset($faction->name->en) ? $faction->name->en : null;
         $values['slug'] = isset($faction->name->en) ? Str::camel($faction->name->en) : null;
         $apiCollection->add(new Faction($values));
     }
     // Local factions
     $factions = Faction::all();
     $this->addModels($class, $factions, $apiCollection);
     $this->deleteModels($class, $factions, $apiCollection);
     $this->updateModels($class, Faction::all(), $apiCollection, ['name', 'slug']);
 }
 public function removeFactionData(Faction $faction)
 {
     $this->getResource()->set($faction->getName(), []);
 }
Example #9
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());
 }