示例#1
0
 /**
  * Aktiver spilleren
  */
 public function activate()
 {
     global $_game, $__server;
     // er aktivert?
     if ($this->active) {
         return false;
     }
     $this->active = true;
     $this->data['up_access_level'] = 1;
     // aktiver spilleren og sett helse og energi til maks
     $a = \Kofradia\DB::get()->exec("UPDATE users_players SET up_access_level = 1, up_health = up_health_max, up_energy = up_energy_max WHERE up_id = {$this->id} AND up_access_level = 0");
     if ($a == 0) {
         return false;
     }
     // oppdater ranklisten
     /*\Kofradia\DB::get()->exec("
     		UPDATE users_players, (SELECT up_id ref_up_id FROM users_players WHERE up_points = {$this->data['up_points']} AND up_id != $this->id AND up_access_level < {$_game['access_noplay']} LIMIT 1) ref
     		SET up_rank_pos = up_rank_pos + 1 WHERE ref_up_id IS NULL AND up_points < {$this->data['up_points']}");*/
     \Kofradia\DB::get()->exec("UPDATE users_players_rank SET upr_up_access_level = 1 WHERE upr_up_id = {$this->id}");
     ranklist::update();
     // fjern tilknytninger til FF
     ff::set_leave($this->id);
     putlog("CREWCHAN", "%bAktivering%b: Spilleren {$this->data['up_name']} er nå aktivert igjen " . $this->generate_minside_url());
     return true;
 }
示例#2
0
 /** Aksepter invitasjon */
 public function invite_accept()
 {
     // invitert?
     if ($this->status != self::STATUS_INVITED) {
         throw new HSException("Medlemmet er ikke invitert til " . $this->ff->type['refobj'] . ".");
     }
     // oppdater brukerinfo
     $this->data['ffm_date_join'] = time();
     $this->data['ffm_status'] = 1;
     $this->data['ffm_pay_points'] = $this->data['up_points_rel'];
     \Kofradia\DB::get()->exec("UPDATE ff_members, users_players SET ffm_date_join = {$this->data['ffm_date_join']}, ffm_status = 1, ffm_pay_points = up_points_rel, ffm_log_new = 0 WHERE ffm_up_id = {$this->id} AND ffm_ff_id = {$this->ff->id} AND ffm_up_id = up_id");
     $this->reattach();
     // legg til logg
     $this->ff->add_log("member_invite_accept", $this->id);
     // legg til FF-forum
     $this->forum_link(true);
     // fjern FF tilknyttet spilleren ved helse under 40 %
     ff::set_leave($this->id);
     // trigger for spiller
     player::get($this->id)->trigger("ff_join", array("ff" => $this->ff, "member" => $this));
 }