@extends('template.layout')
@section('title', ucwords(urldecode($name)) . ' Wiki')
@section('submenuItem', 'spells')
@section('content')
@php
include "./spells.php";
include "./npcs.php";
function findSpellByName($spells, $name, $runas) {
$cleanName = trim(urldecode($name));
foreach ($spells as $spell) {
if (strcasecmp(strtolower($spell['name']), strtolower($cleanName)) === 0) {
return $spell;
}
}
foreach ($spells as $spell) {
if (strcasecmp($spell['words'], $cleanName) === 0) {
return $spell;
}
}
return null;
}
//$name = str_ireplace('rune', '', $name);
$spellFound = findSpellByName($spells, urldecode($name), $runas);
$jsonData = json_decode(file_get_contents('runes_data.json'), true);
if ($spellFound && isset($spellFound['category'])) {
if ($spellFound['category'] == 'rune') {
if (isset($runas[$spellFound['words']][0])) {
$spellName = trim($runas[$spellFound['words']][0]);
$name_search = trim(str_replace("Rune", "", $spellName)) . " Rune";
} else {
$name_search = 'Unknown Rune';
}
} else {
$name_search = trim($spellFound["name"]);
}
} else {
$name_search = 'Spell not found';
}
$spellData = collect($jsonData)->firstWhere('name', $spellFound["name"]);
$npcs_buying = [];
$npcs_selling = [];
$name_search = trim(str_ireplace('rune', '', $name_search));
foreach ($npcs as $npc) {
foreach ($npc['buy'] as $buy_item) {
if ($buy_item['name'] == $spellFound["name"]) {
$npcs_buying[] = [
'name' => $npc['name'],
'price' => $buy_item['price'],
'location' => $npc['location'],
'position' => $npc['position']
];
break;
}
}
}
@endphp
@if($spellFound && isset($spellFound['category']) && $spellFound['category'] == 'rune')
@else
@endif
|
@if($spellFound && isset($spellFound['category']) && $spellFound['category'] == 'rune')
{{ $spellFound["name"] }}
@if(!str_contains(strtolower($spellFound["name"]), 'rune'))
Rune
@endif
@else
@if($spellFound)
{{ $spellFound["name"] }}
@endif
@endif
|
@if($spellFound && isset($spellFound['category']) && $spellFound['category'] == 'rune')
@else
@endif
|
@php
$description = $spellData['description'] ?? 'Descrição não disponível.';
$spellName = $spellFound['name'] ?? '';
if (strpos($description, $spellName) === 0) {
$description = substr($description, strlen($spellName));
}
@endphp
{!! ucfirst($description ?? 'Descrição não disponível.') !!}
| Name: |
@if($spellFound['category'] == 'rune')
{{ $spellFound['name'] }}
@if($spellFound["category"] == 'rune' && !str_contains(strtolower($spellFound['name']), 'rune'))
Rune
@endif
@else
{{ $spellFound["name"] }}
@endif
|
| Formula: |
{{ $spellFound["words"] }} |
| Vocation: |
@foreach ($spellFound["vocation"] as $vocation)
{{ $vocation }}@if (!$loop->last), @endif
@endforeach
|
| Group: |
{{ isset($runas[$spellFound["words"]][1]) ? $runas[$spellFound["words"]][1] : 'Not found.' }}
|
| Type: |
{{ ucwords($spellFound["category"]) }} |
@if(isset($spellFound["conjureAmount"]))
| Amount Receive: |
{{ $spellFound["conjureAmount"] }} |
@endif
| Mana: |
@if(isset($spellFound["mana"]))
{{ ucwords($spellFound["mana"]) }}
@else
{{ ucwords($spellFound["manaPercent"]) }}
@endif
|
| Mag Lvl: |
{{ $spellFound["magicLevel"] }} |
@if(isset($spellFound["charges"]))
| Charges: |
{{ $spellFound["charges"] }} |
| Price: |
{{ isset($npcs_buying[0]['price']) ? $npcs_buying[0]['price'] : 0 }} |
| Premium: |
@if(isset($spellFound["isPremium"]))
@else
@endif
|
@else
| Premium: |
@if(isset($spellFound["isPremium"]))
@else
@endif
|
@endif
|
|
@if($spellFound["category"] == "rune")
@endif
Spell Offers
| NPC |
Location |
Price |
| No offers available |
@endsection