Ejemplo n.º 1
0
 public function run()
 {
     $this->add_category('default', array('humanice' => true), PUBLICY);
     $this->cron = Cron::factory();
     $this->cron->attach($this);
     $this->lou = LoU::factory($this->server, $this->email, $this->password, $this->debug);
     if ($this->debug) {
         $this->log("Entered debugmode!");
     }
     $this->lou->attach($this);
     $this->lou->get_self();
     $this->forum = Forum::factory($this->lou);
     $this->igm = Igm::factory($this->lou);
     $this->load_hooks();
     $this->globalchat = defined('GLOBALCHAT') ? GLOBALCHAT : false;
     $this->lou->get_self_alliance();
     $this->lou->setAllianceAllowOnline(true);
     while ($this->lou->isConnected(true)) {
         $slepp_until = time() + POLLTRIP;
         $event = $this->cron->check();
         $chat = $this->lou->check();
         if (time() < $slepp_until) {
             time_sleep_until($slepp_until);
         }
     }
 }
Ejemplo n.º 2
0
 $cTest->drawScale($cDataSet->GetData(), $cDataSet->GetDataDescription(), SCALE_DIFF, 150, 150, 150, TRUE, 75, 0, FALSE, $skip_scale);
 $cTest->drawGrid(4, TRUE, 230, 230, 230, 40);
 // Draw the graph
 $cTest->drawFilledCubicCurve($cDataSet->GetData(), $cDataSet->GetDataDescription(), 0.1, 30);
 if ($scale_hours <= 48) {
     $cTest->drawPlotGraph($cDataSet->GetData(), $cDataSet->GetDataDescription(), 2, 1, 255, 255, 255);
 }
 // Draw labels
 if (!empty($mname)) {
     foreach ($mname as $k => $v) {
         $cTest->setLabel($cDataSet->GetData(), $cDataSet->GetDataDescription(), "points", $k, $v[1], 239, 233, 195);
     }
 }
 if (!empty($mtype)) {
     foreach ($mtype as $k => $v) {
         $cTest->setLabel($cDataSet->GetData(), $cDataSet->GetDataDescription(), "points", $k, 'Status: ' . LoU::prepare_city_type($v[0]), 221, 230, 174);
     }
 }
 if (!empty($mowner)) {
     foreach ($mowner as $k => $v) {
         $_un = $redis->HGET("user:{$v[1]}:data", 'name');
         if ($_un) {
             $cTest->setLabel($cDataSet->GetData(), $cDataSet->GetDataDescription(), "points", $k, 'Übernahme: ' . $_un, 239, 233, 195);
         }
     }
 }
 $cTest->clearShadow();
 // Finish the graph
 $cTest->drawLegend(75, 35, $cDataSet->GetDataDescription(), 236, 238, 240, 52, 58, 82);
 $cTest->setFontProperties("../charts/Fonts/tahoma.ttf", 10);
 $cTest->drawTitle(60, 22, $cities[$cid]['data']['name'] . ' - ' . $scale_hours . 'h' . ' Performance: ' . $mperformance . '%', 50, 50, 50, 585);
Ejemplo n.º 3
0
 static function stat_continents($data)
 {
     $note = array('type' => STATISTICS, 'id' => CONTINENT, 'data' => LoU::analyse_continents($data));
     return $note;
 }
Ejemplo n.º 4
0
     }
     $receivers = $redis->SDIFF("{$settler_key}:{$alliance_key}:{$continent_key}:residents", "{$settler_key}:{$alliance_key}:nomail");
     // find 'settler:continent:10:settlers:123:123' name
     $settler_pattern = "{$settler_key}:{$alliance_key}:{$continent_key}:settlers:";
     $settler_keys = $redis->clearKey($redis->Keys("{$settler_pattern}*"), "/{$settler_pattern}/");
     // clear up '123:123' name
     if (is_array($settler_keys)) {
         foreach ($settler_keys as $key) {
             if ($name = $redis->get("{$settler_pattern}{$key}")) {
                 if (!in_array($name, $receivers) && !$redis->sIsMember("{$settler_key}:{$alliance_key}:nomail", $name)) {
                     $receivers[] = $name;
                 }
             }
         }
     }
     $bot->log('IGM: send ' . count($receivers) . ' messages to ' . LoU::get_continent_abbr() . $continent);
     $bot->igm->send(implode(';', $receivers), "? {$bot->lou->get_continent_abbr()}{$continent} {$pos} {$lawless}siedeln", "{$bot->lou->get_continent_abbr()}{$continent} - {$lawless}[coords]{$pos}[/coords] - [player]{$data['user']}[/player]");
 } else {
     $settler = $redis->get("{$settler_key}:{$alliance_key}:{$continent_key}:settlers:{$pos}");
     $lawless = $redis->sIsMember("{$continent_key}:lawless", $pos) ? 'LL ' : '';
     $settletime = date('d.m.Y H:i:s', time() - (SETTLERTTL - $redis->TTL("{$settler_key}:{$alliance_key}:{$continent_key}:settlers:{$pos}")));
     if ($settler != $data['user']) {
         $message = "[player]{$settler}[/player] siedelt auf {$continent_name} {$lawless}[coords]{$pos}[/coords] seit: {$settletime}";
     } else {
         if ($data["channel"] == ALLYIN) {
             $message = "{$data['user']}, du siedelst schon auf {$continent_name} {$lawless}[coords]{$pos}[/coords] seit: {$settletime}";
         } else {
             $message = "Du siedelst schon auf {$continent_name} {$lawless}[coords]{$pos}[/coords] seit: {$settletime}";
         }
     }
 }