SKS Änderungen

master
Seph 2024-05-02 21:29:31 +02:00
parent 7f98344e3d
commit 7e556ff7a5
7 changed files with 91 additions and 26 deletions

View File

@ -4,7 +4,7 @@ Theme URI: https://nebelkrieger.de
Author: Yorndar
Author URI: https://nebelkrieger.de
Description: The next gen NK-Theme
Version: 0.1.1
Version: 0.2.1
Tested up to: 6.2
Requires PHP: 8.0
License: GNU General Public License v2 or later

View File

@ -1,6 +1,7 @@
<?php
use WoWPress\Models\Raid;
use WoWPress\Models\SKS;
use WoWPress\Models\User;
add_filter('generate_rewrite_rules', function ($wp_rewrite) {
@ -11,7 +12,7 @@ add_filter('generate_rewrite_rules', function ($wp_rewrite) {
['raid/(\d+)/?$' => 'index.php?wowpress_page=raid&raid_id=$matches[1]'],
['request/?$' => 'index.php?wowpress_page=form_request'],
['sks/?$' => 'index.php?wowpress_page=sks'],
['sks/([A-Za-z-]+)?$' => 'index.php?wowpress_page=sks&list_name=$matches[1]'],
['sks/([A-Za-z-0-9 ]+)?$' => 'index.php?wowpress_page=sks&list_name=$matches[1]'],
$wp_rewrite->rules
);
});

View File

@ -1,9 +1,47 @@
{
"Warlock" : "Hexenmeister",
"Destruction": "Zerstörung",
"Demonology": "Dämonologie",
"Affliction": "Gebrechen",
"Evoker" : "Rufer",
"Augmentation": "Verstärkung",
"Devastation" : "Verheerung",
"Preservation": "Bewahrung",
"Paladin": "Paladin",
"Retribution": "Vergeltung",
"Holy": "Heilig",
"Protection": "Schutz",
"Monk" : "Mönch",
"Windwalker" : "Windläufer"
"Windwalker" : "Windläufer",
"Brewmaster": "Braumeister",
"Mistweaver": "Nebelwirker",
"Warrior": "Krieger",
"Arms": "Waffen",
"Fury": "Furor",
"_Protection" : "Schutz",
"Hunter": "Jäger",
"Beast Mastery": "Tierherrschaft",
"Marksmanship": "Treffsicherheit",
"Survival": "Überleben",
"Rogue": "Schurke",
"Assassination": "Meucheln",
"Outlaw": "Gesetzlosigkeit",
"Subtlety": "Täuschung",
"Priest": "Priester",
"Discipline": "Disziplin",
"_Holy": "Heilig",
"Shadow": "Schatten",
"Shaman": "Schamane",
"Elemental": "Elementar",
"Enhancement": "Verstärkung",
"Restoration": "Wiederherstellung"
}

View File

@ -138,7 +138,7 @@ if (empty($liste->list_name)) {
<?php
}
if (current_user_can('wowpress_edit_characters')) : ?>
if (current_user_can('wowpress_edit_raids')) : ?>
<div x-data>
<template x-teleport="#sidebar_right">
<div class="bg-glass shadow p-auto order-1">
@ -156,6 +156,22 @@ if (current_user_can('wowpress_edit_characters')) : ?>
</form>
</div>
</template>
<?php if (!empty($liste->list_name)) : ?>
<template x-teleport="#sidebar_right">
<div class="bg-glass shadow p-auto order-1">
<h4 class="text-xl font-bold text-center mb-2">Liste neu Würfeln</h4>
<form action="/request" method="POST">
<div class="flex flex-col gap-2">
<?php wp_nonce_field('rollSKS', 'rollSKS_nonce'); ?>
<input type="hidden" name="action" value="rollSKS">
<input type="hidden" name="list_name" value="<?= $liste->list_name ?>">
<button type="submit" class="btn btn-outline btn-orange"><?= Icon::get('o-arrow-path') ?> Würfeln</a>
</div>
</form>
</div>
</template>
<?php endif; ?>
</div>
<?php

View File

@ -204,12 +204,22 @@ switch ($_POST['action']) {
if (isset($_POST['sks_id'])) {
$sks = SKS::find($_POST['sks_id']);
if ($sks->ID) {
$sks->loot();
}
}
}
break;
case 'rollSKS':
isAllowed('wowpress_edit_raids');
if (isset($_POST['rollSKS_nonce']) && wp_verify_nonce($_POST['rollSKS_nonce'], 'rollSKS')) {
if (isset($_POST['list_name'])) {
$sks = SKS::where('list_name', $_POST['list_name'])->first();
if (!empty($sks->ID)) {
$sks->roll();
}
}
}
break;
case 'fixSKS':
isAllowed('wowpress_edit_raids');
if (isset($_POST['fixSKS_nonce']) && wp_verify_nonce($_POST['fixSKS_nonce'], 'fixSKS')) {

View File

@ -25,20 +25,20 @@ function hasSearch($specs)
<?php endif; ?>
<?php foreach ($instance['classes'] as $class => $specs) : ?>
<?php if($this->hasSpec($specs)): ?>
<div class="col-span-1"><img src="<?=Character::classIconLink($class)?>" alt="" class="h-8"></div>
<div class="col-span-1"><img src="<?=Character::classIconLink($class)?>" title="<?=translate_string($class)?>" alt="" class="h-8"></div>
<div class="col-span-4 grid grid-cols-subgrid">
<?php foreach ($specs as $spec => $search) : ?>
<div><img src="<?=Character::specIconLink($class,$spec)?>" alt=""
<?php
switch($search){
case 3: ?>class="h-8 border border-red-500" title="Hoch"<?php
case 3: ?>class="h-8 border border-red-500" title="<?=translate_string($spec)?>: Hoch"<?php
break;
case 2: ?>class="h-8 opacity-70 border border-yellow-500" title="Mittel"<?php
case 2: ?>class="h-8 opacity-70 border border-yellow-500" title="<?=translate_string($spec)?>: Mittel"<?php
break;
case 1: ?>class="h-8 opacity-50 border border-green-500" title="Niedrig"<?php
case 1: ?>class="h-8 opacity-50 border border-green-500" title="<?=translate_string($spec)?>: Niedrig"<?php
break;
case 0:
default: ?>class="h-8 opacity-10" title="Suche geschlossen"<?php
default: ?>class="h-8 opacity-10" title="<?=translate_string($spec)?>: Suche geschlossen"<?php
break;
}
?>

View File

@ -33,7 +33,7 @@ class BossKills extends Widget
}
return (($done/100)*count($bosses))*1000;
return ($done/count($bosses))*100;
}
public function form($instance)