Example #1
0
 public function setUp()
 {
     if (!self::$hasSetup) {
         echo 'Doing initial setup...';
         parent::setUp();
         DB::beginTransaction();
         self::$character = new Character();
         self::$character->user_id = User::first()->id;
         self::$character->name = "UNIT TEST CHARACTER";
         self::$character->save();
         self::$version = CharacterVersion::createNewVersion(self::$character);
         self::$player = new User();
         self::$storyteller = User::listStorytellers()->first();
         self::$instance = $this;
         self::$hasSetup = true;
     }
 }
 public function awardExperience(GameSession $session)
 {
     $ids = Input::get("ids");
     $costumes = Input::get("costumes");
     $nom1s = Input::get("nom1s");
     $nom2s = Input::get("nom2s");
     $overrides = Input::get("overrides");
     $save = Input::get("save");
     $missingCharacters = [];
     foreach ($ids as $index => $id) {
         $character = Character::find($id);
         if ($character) {
             $checkIn = GameSessionCheckIn::where(['session_id' => $session->id, 'character_id' => $character->id])->first();
             $checkIn->costume = $costumes[$index] == "true" ? 1 : 0;
             $checkIn->nominated = $nom1s[$index] == "true" ? 1 : 0;
             $checkIn->nominated_twice = $nom2s[$index] == "true" ? 1 : 0;
             $checkIn->bonus = $overrides[$index];
             $checkIn->total_experience = 1 + ($checkIn->costume ? 1 : 0) + ($checkIn->nominated ? 1 : 0) + ($checkIn->nominated_twice ? 1 : 0) + $checkIn->bonus;
             $checkIn->save();
             if (!isset($save)) {
                 $owner = $character->owner;
                 $owner->sendMessage(null, "Experience awarded to " . $character->name, "The Storytellers have awarded your character " . $checkIn->total_experience . " Experience. You can now use the character editor to make changes to it at" . " your leisure. Remember, changes should be submitted by 6:00pm on the Wednesday" . " before a game to ensure that they have the chance to review them.");
                 $character->awardExperience($checkIn->total_experience);
                 $character->save();
             }
         } else {
             $missingCharacters[] = $id;
         }
     }
     if (!isset($save)) {
         $session->submitted = true;
         $session->save();
         foreach (User::listStorytellers() as $st) {
             $st->sendMessage(null, "Experience successfully awarded", "The action to award experience for the session on " . $session->date . " has completed." . (sizeof($missingCharacters) > 0 ? "\n\n" . sizeof($missingCharacters) . " characters were" . " not found (" . implode(",", $missingCharacters) . ")" : ''));
         }
         return Redirect::to("/dashboard");
     } else {
         return Redirect::to("/dashboard/storyteller/session/experience/{$session->id}");
     }
 }
Example #3
0
 public function contactStorytellers()
 {
     $name = Input::get("name");
     $email = Input::get("email");
     $subject = Input::get("subject");
     $message = Input::get("message");
     $validator = Validator::make(['name' => $name, 'email' => $email, 'subject' => $subject, 'message' => $message], ['name' => 'required', 'email' => 'required|email', 'subject' => 'required', 'message' => 'required']);
     if ($validator->passes()) {
         foreach (User::listStorytellers() as $st) {
             $st->sendMessage(null, "Contact the STs Form Message", "The following message was sent via the Contact the Storytellers form.<br><br>" . "<b>Name: </b> {$name}<br><b>Email: </b><a href='mailto:{$email}'>{$email}</a><br><b>" . "Subject: </b>{$subject}<br><br>{$message}");
         }
         return View::make('/contact')->with(['response' => true]);
     } else {
         return Redirect::to('/contact')->withErrors($validator);
     }
 }
Example #4
0
 public function alertSTs()
 {
     $topic = ForumTopic::find(Input::get("topic"));
     $user = Auth::user();
     if ($user->isStoryteller()) {
         $sendTo = [];
         $message = Input::get("alert-comment");
         foreach (User::listStorytellers() as $st) {
             $response = Input::get("st-alert-" . $st->id);
             if ($response == "on") {
                 $sendTo[] = $st;
             }
         }
         foreach ($sendTo as $st) {
             $st->sendMessage(null, "Carpe Noctem Topic Alert", "Hello, {$st->username},<br><br>This message has been sent to you by {$user->username} to" . " your bring attention to the topic <a href='http://larp.illini-rp.net/forums/topic/{$topic->id}'>" . "{$topic->title}</a>." . ($message ? " {$user->username} had this to say about the topic:<br><br>" . "<blockquote>{$message}</blockquote>" : ""));
         }
         return Redirect::to('/forums/topic/' . $topic->id);
     } else {
         return Response::json(["success" => false, "message" => "Insufficient priviledges."]);
     }
 }