Beispiel #1
0
 /**
  * Process the search criteria for the spells page.
  *
  * @param  \Apolune\Library\Http\Requests\Spells\FormRequest  $request
  * @return \Illuminate\Http\Response
  */
 public function form(FormRequest $request)
 {
     if ($request->has('spell')) {
         return redirect(url('/library/spells', $request->get('spell')))->withInput();
     }
     extract($this->getCriteria($request));
     $spells = spells();
     // Filter by vocation
     if (strtolower($vocation) !== 'all') {
         $spells = $spells->filter(function ($spell) use($vocation) {
             $vocations = vocations(true)->filter(function ($vocation) use($spell) {
                 return in_array($vocation->name(), $spell->vocations());
             })->map(function (&$item) {
                 $item = $item->id();
             })->keys();
             return in_array((int) $vocation, $vocations->toArray());
         });
     }
     // Filter by group
     if (strtolower($group) !== 'all') {
         $spells = $spells->filter(function ($spell) use($group) {
             return strtolower($spell->group()) === strtolower($group);
         });
     }
     // Filter by type
     if (strtolower($type) !== 'all') {
         $spells = $spells->filter(function ($spell) use($type) {
             return strtolower($spell->type()) === strtolower($type);
         });
     }
     // Filter by premium status
     if (strtolower($premium) !== 'all') {
         $spells = $spells->filter(function ($spell) use($premium) {
             return $spell->premium() === (strtolower($premium) === 'yes');
         });
     }
     $sorted = $spells->sort(function ($a, $b) use($sort) {
         return $a->{$sort}() > $b->{$sort}();
     });
     return redirect('/library/spells')->with('spells', $sorted)->withInput();
 }
Beispiel #2
0
    } elseif ($do[0] == "editdrop") {
        editdrop($do[1]);
    } elseif ($do[0] == "towns") {
        towns();
    } elseif ($do[0] == "edittown") {
        edittown($do[1]);
    } elseif ($do[0] == "monsters") {
        monsters();
    } elseif ($do[0] == "editmonster") {
        editmonster($do[1]);
    } elseif ($do[0] == "levels") {
        levels();
    } elseif ($do[0] == "editlevel") {
        editlevel();
    } elseif ($do[0] == "spells") {
        spells();
    } elseif ($do[0] == "editspell") {
        editspell($do[1]);
    } elseif ($do[0] == "users") {
        users();
    } elseif ($do[0] == "edituser") {
        edituser($do[1]);
    } elseif ($do[0] == "news") {
        addnews();
    }
} else {
    donothing();
}
function donothing()
{
    $page = "Welcome to the Dragon Knight Administration section. Use the links on the left bar to control and edit various elements of the game.<br /><br />Please note that the control panel has been created mostly as a shortcut for certain individual settings. It is meant for use primarily with editing one thing at a time. If you need to completely replace an entire table (say, to replace all stock monsters with your own new ones), it is suggested that you use a more in-depth database tool such as <a href=\"http://www.phpmyadmin.net\" target=\"_new\">phpMyAdmin</a>. Also, you may want to have a copy of the Dragon Knight development kit, available from the <a href=\"http://dragon.se7enet.com/dev.php\">Dragon Knight homepage</a>.<br /><br />Also, you should be aware that certain portions of the DK code are dependent on the formatting of certain database results (for example, the special attributes on item drops). While I have attempted to point these out throughout the admin script, you should definitely pay attention and be careful when editing some fields, because mistakes in the database content may result in script errors or your game breaking completely.";
Beispiel #3
0
 /**
  * Get a specific spell by its slug.
  *
  * @param  string  $slug
  * @return \Apolune\Contracts\Server\Spell
  */
 function spell_by_slug($slug)
 {
     $spells = spells();
     return head(array_where($spells, function ($key, $spell) use($slug) {
         return strtolower($spell->slug()) === strtolower($slug);
     }));
 }