public function awardDiablerieExperience() { //This is functionally the same as the journal XP, except it grants 2 and sends a different message. $character = Character::find(Input::get('id')); if ($character) { $date = new DateTime(); $date->setTimestamp(intval(Input::get('month'))); //Check to make sure we haven't already awarded XP for this month. if (!CharacterDiablerieExperience::where('character_id', $character->id)->whereRaw('MONTH(date) = ?', [date('m', $date->getTimestamp())])->whereRaw('YEAR(date) = ?', [date('Y', $date->getTimestamp())])->exists()) { $journal = new CharacterDiablerieExperience(); $journal->character_id = $character->id; $journal->date = $date; $journal->save(); $character->awardExperience(2); $character->save(); $character->owner->sendMessage(null, "Diablerie Experience awarded for " . $date->format('F Y'), "The Storytellers have awareded your character " . $character->name . " 2 Experience for diablerizing in " . $date->format('F Y') . ".\n\n If you have any" . " questions, please post in the \"General Messages\" forum.\n\nThanks,\nThe Storytellers"); return Redirect::to("/dashboard/storyteller/experience/diablerie"); } else { return Response::json(['success' => false, 'message' => 'Experience already awarded for this month']); } } else { return Response::json(['success' => false, 'message' => 'Unable to find character.']); } }
public function hasDiablerized() { if (CharacterDiablerieExperience::where('character_id', $this->id)->exists()) { return true; } if (CharacterFlaw::where('character_id', $this->id)->whereHas('definition', function ($q) { $q->where('name', 'Prior Diablerie'); })->exists()) { return true; } return false; }