2021-11-14 11:02:22 +01:00
|
|
|
<?php if (! defined('BASEPATH')) {
|
|
|
|
exit('No direct script access allowed');
|
|
|
|
}
|
2021-10-30 19:02:07 +02:00
|
|
|
|
|
|
|
//means set_selected
|
2021-11-14 11:02:22 +01:00
|
|
|
if (!function_exists('ss')) {
|
|
|
|
function ss($d1, $d2, $o1, $o2)
|
2021-10-30 19:02:07 +02:00
|
|
|
{
|
2021-11-14 11:02:22 +01:00
|
|
|
if ($o1 == $d1 && $o2 == $d2) {
|
|
|
|
if ($d1 == 'eq') {
|
|
|
|
return 'equipment_entry_selected';
|
|
|
|
} else {
|
|
|
|
return 'inventory_entry_selected';
|
|
|
|
}
|
|
|
|
}
|
2021-10-30 19:02:07 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//quality_(in)inventory
|
2021-11-14 11:02:22 +01:00
|
|
|
if (!function_exists('qi')) {
|
|
|
|
function qi($row)
|
2021-10-30 19:02:07 +02:00
|
|
|
{
|
2021-11-14 11:02:22 +01:00
|
|
|
if ($row) {
|
|
|
|
switch ($row['quality']) {
|
2021-10-30 19:02:07 +02:00
|
|
|
case (0):
|
|
|
|
return 'iv_quality_really_poor';
|
|
|
|
case (1):
|
|
|
|
return 'iv_quality_poor';
|
|
|
|
case (2):
|
|
|
|
return 'iv_quality_good';
|
|
|
|
case (3):
|
|
|
|
return 'iv_quality_great';
|
|
|
|
case (4):
|
|
|
|
return 'iv_quality_epic';
|
|
|
|
case (5):
|
|
|
|
return 'iv_quality_legendary';
|
|
|
|
case (6):
|
|
|
|
return 'iv_quality_omg';
|
|
|
|
}
|
2021-11-14 11:02:22 +01:00
|
|
|
}
|
2021-10-30 19:02:07 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//quality_(in)character('s view)
|
2021-11-14 11:02:22 +01:00
|
|
|
if (!function_exists('qc')) {
|
|
|
|
function qc($equipment, $id)
|
2021-10-30 19:02:07 +02:00
|
|
|
{
|
2021-11-14 11:02:22 +01:00
|
|
|
if ($equipment[$id]) {
|
|
|
|
switch ($equipment[$id]['quality']) {
|
2021-10-30 19:02:07 +02:00
|
|
|
case (0):
|
|
|
|
return 'eq_quality_really_poor';
|
|
|
|
case (1):
|
|
|
|
return 'eq_quality_poor';
|
|
|
|
case (2):
|
|
|
|
return 'eq_quality_good';
|
|
|
|
case (3):
|
|
|
|
return 'eq_quality_great';
|
|
|
|
case (4):
|
|
|
|
return 'eq_quality_epic';
|
|
|
|
case (5):
|
|
|
|
return 'eq_quality_legendary';
|
|
|
|
case (6):
|
|
|
|
return 'eq_quality_omg';
|
|
|
|
}
|
2021-11-14 11:02:22 +01:00
|
|
|
}
|
2021-10-30 19:02:07 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-11-14 11:02:22 +01:00
|
|
|
if (!function_exists('can_be_equipped')) {
|
|
|
|
function can_be_equipped($item, $hero)
|
|
|
|
{
|
|
|
|
if (!$item) {
|
|
|
|
return false;
|
|
|
|
}
|
2021-10-30 19:02:07 +02:00
|
|
|
|
2021-11-14 11:02:22 +01:00
|
|
|
$data['can'] = false;
|
|
|
|
$data['message'] = '';
|
|
|
|
$data['allowed_slot1'] = false;
|
|
|
|
$data['allowed_slot2'] = false;
|
|
|
|
$data['two_handed'] = false;
|
2021-10-30 19:02:07 +02:00
|
|
|
|
2021-11-14 11:02:22 +01:00
|
|
|
if ($item['type'] != 1) {
|
|
|
|
$data['message'] = 'That item cannot be equipped.';
|
|
|
|
return $data;
|
|
|
|
}
|
2021-10-30 19:02:07 +02:00
|
|
|
|
2021-11-14 11:02:22 +01:00
|
|
|
if ($item['req_class'] != 0 && $item['req_class'] != $hero['class']) {
|
|
|
|
$data['message'] = 'You can never use that item.';
|
|
|
|
return $data;
|
|
|
|
}
|
2021-10-30 19:02:07 +02:00
|
|
|
|
2021-11-14 11:02:22 +01:00
|
|
|
if ($item['req_level'] > $hero['level']) {
|
|
|
|
$data['message'] = 'Your level is too low to use that item.';
|
|
|
|
return $data;
|
|
|
|
}
|
2021-10-30 19:02:07 +02:00
|
|
|
|
2021-11-14 11:02:22 +01:00
|
|
|
if ($item['subtype'] == 6) {
|
|
|
|
$data['can'] = true;
|
|
|
|
$data['allowed_slot1'] = 6;
|
|
|
|
return $data;
|
|
|
|
} elseif ($item['subtype'] == 12) {
|
|
|
|
$data['can'] = true;
|
|
|
|
$data['allowed_slot1'] = 12;
|
|
|
|
$data['allowed_slot2'] = 13;
|
|
|
|
return $data;
|
|
|
|
} elseif ($item['subtype'] == 14) {
|
|
|
|
$data['can'] = true;
|
|
|
|
$data['allowed_slot1'] = 14;
|
|
|
|
$data['allowed_slot2'] = 15;
|
|
|
|
return $data;
|
|
|
|
} elseif ($item['subtype'] == 19) {
|
|
|
|
if ($hero['class'] == 2) {
|
|
|
|
$data['can'] = true;
|
|
|
|
$data['allowed_slot1'] = 19;
|
|
|
|
return $data;
|
|
|
|
}
|
|
|
|
}
|
2021-10-30 19:02:07 +02:00
|
|
|
|
2021-11-14 11:02:22 +01:00
|
|
|
$datatype = array(
|
2021-10-30 19:02:07 +02:00
|
|
|
//warrior
|
|
|
|
'1' => array(0, 1, 2, 3, 4),
|
|
|
|
//rogue
|
2021-11-14 11:02:22 +01:00
|
|
|
'2' => array(0, 1, 2, false, false),
|
2021-10-30 19:02:07 +02:00
|
|
|
//archer
|
2021-11-14 11:02:22 +01:00
|
|
|
'3' => array(0, 1, 2, 3, false));
|
2021-10-30 19:02:07 +02:00
|
|
|
|
2021-11-14 11:02:22 +01:00
|
|
|
$dataeqslots = array(
|
2021-10-30 19:02:07 +02:00
|
|
|
//head
|
2021-11-14 11:02:22 +01:00
|
|
|
'0' => array(0, false),
|
2021-10-30 19:02:07 +02:00
|
|
|
//neck
|
2021-11-14 11:02:22 +01:00
|
|
|
'1' => array(1, false),
|
2021-10-30 19:02:07 +02:00
|
|
|
//shoulder
|
2021-11-14 11:02:22 +01:00
|
|
|
'2' => array(2, false),
|
2021-10-30 19:02:07 +02:00
|
|
|
//back
|
2021-11-14 11:02:22 +01:00
|
|
|
'3' => array(3, false),
|
2021-10-30 19:02:07 +02:00
|
|
|
//chest
|
2021-11-14 11:02:22 +01:00
|
|
|
'4' => array(4, false),
|
2021-10-30 19:02:07 +02:00
|
|
|
//shirt
|
2021-11-14 11:02:22 +01:00
|
|
|
'5' => array(5, false),
|
2021-10-30 19:02:07 +02:00
|
|
|
//bracer
|
2021-11-14 11:02:22 +01:00
|
|
|
'7' => array(7, false),
|
2021-10-30 19:02:07 +02:00
|
|
|
//gloves
|
2021-11-14 11:02:22 +01:00
|
|
|
'8' => array(8, false),
|
2021-10-30 19:02:07 +02:00
|
|
|
//belt
|
2021-11-14 11:02:22 +01:00
|
|
|
'9' => array(9, false),
|
2021-10-30 19:02:07 +02:00
|
|
|
//legs
|
2021-11-14 11:02:22 +01:00
|
|
|
'10' => array(10, false),
|
2021-10-30 19:02:07 +02:00
|
|
|
//foots
|
2021-11-14 11:02:22 +01:00
|
|
|
'11' => array(11, false),
|
2021-10-30 19:02:07 +02:00
|
|
|
);
|
|
|
|
|
2021-11-14 11:02:22 +01:00
|
|
|
//this means every item, whose subsubtype means the type (like cloth)
|
|
|
|
if ($item['subtype'] >= 0 && $item['subtype'] < 6 || $item['subtype'] > 6 && $item['subtype'] < 12) {
|
|
|
|
if ($datatype[$hero['class']][$item['subsubtype']] !== false) {
|
|
|
|
$data['can'] = true;
|
|
|
|
$data['allowed_slot1'] = $dataeqslots[$item['subtype']][0];
|
|
|
|
$data['allowed_slot2'] = $dataeqslots[$item['subtype']][1];
|
|
|
|
return $data;
|
|
|
|
} else {
|
|
|
|
$data['can'] = false;
|
|
|
|
$data['message'] = "You don't have the required proficiency to use that item.";
|
|
|
|
return $data;
|
|
|
|
}
|
|
|
|
}
|
2021-10-30 19:02:07 +02:00
|
|
|
|
2021-11-14 11:02:22 +01:00
|
|
|
$dataclasswep = array(
|
2021-10-30 19:02:07 +02:00
|
|
|
//warrior
|
2021-11-14 11:02:22 +01:00
|
|
|
'1' => array(false, false, false, false, 5, 6, 7, 8, 9, 10,
|
|
|
|
11, 12, 13, 14, 15, 16, false, false, false, 20, false),
|
2021-10-30 19:02:07 +02:00
|
|
|
//rogue
|
2021-11-14 11:02:22 +01:00
|
|
|
'2' => array(false, 2, 3, 4, 5, 6, 7, false, 9, 10,
|
|
|
|
11, false, 13, 14, 15, false, false, false, false, false, 21),
|
2021-10-30 19:02:07 +02:00
|
|
|
//archer
|
2021-11-14 11:02:22 +01:00
|
|
|
'3' => array(false, 2, 3, 4, false, false, false, false, false, false,
|
|
|
|
false, false, 13, 14, 15, 16, 17, 18, 19, false, false)
|
2021-10-30 19:02:07 +02:00
|
|
|
);
|
|
|
|
|
2021-11-14 11:02:22 +01:00
|
|
|
//array(first slot, second slot, two Handed)
|
|
|
|
$datawep = array(
|
2021-10-30 19:02:07 +02:00
|
|
|
//staff
|
2021-11-14 11:02:22 +01:00
|
|
|
'1' => array(16, false, true),
|
2021-10-30 19:02:07 +02:00
|
|
|
//dagger one, main, off
|
2021-11-14 11:02:22 +01:00
|
|
|
'2' => array(16, 17, false),
|
|
|
|
'3' => array(16, false, false),
|
|
|
|
'4' => array(17, false, false),
|
2021-10-30 19:02:07 +02:00
|
|
|
//mace one main, off, 2h
|
2021-11-14 11:02:22 +01:00
|
|
|
'5' => array(16, 17, false),
|
|
|
|
'6' => array(16, false, false),
|
|
|
|
'7' => array(17, false, false),
|
|
|
|
'8' => array(16, false, true),
|
2021-10-30 19:02:07 +02:00
|
|
|
//axe one, main, off, 2h
|
2021-11-14 11:02:22 +01:00
|
|
|
'9' => array(16, 17, false),
|
|
|
|
'10' => array(16, false, false),
|
|
|
|
'11' => array(17, false, false),
|
|
|
|
'12' => array(16, false, true),
|
2021-10-30 19:02:07 +02:00
|
|
|
//sword one, main, off, 2h
|
2021-11-14 11:02:22 +01:00
|
|
|
'13' => array(16, 17, false),
|
|
|
|
'14' => array(16, false, false),
|
|
|
|
'15' => array(17, false, false),
|
|
|
|
'16' => array(16, false, true),
|
2021-10-30 19:02:07 +02:00
|
|
|
//bow, crossbow, gun
|
2021-11-14 11:02:22 +01:00
|
|
|
'17' => array(18, 17, false),
|
|
|
|
'18' => array(18, false, false),
|
|
|
|
'19' => array(18, false, false),
|
2021-10-30 19:02:07 +02:00
|
|
|
//?? warri, rogue ranged
|
2021-11-14 11:02:22 +01:00
|
|
|
'20' => array(18, false, false),
|
|
|
|
'21' => array(18, false, false)
|
2021-10-30 19:02:07 +02:00
|
|
|
);
|
|
|
|
|
2021-11-14 11:02:22 +01:00
|
|
|
if ($item['subtype'] == 16) {
|
|
|
|
if ($dataclasswep[$hero['class']][$item['subsubtype']] !== false) {
|
|
|
|
$data['can'] = true;
|
|
|
|
$data['allowed_slot1'] = $datawep[$item['subsubtype']][0];
|
|
|
|
$data['allowed_slot2'] = $datawep[$item['subsubtype']][1];
|
|
|
|
$data['two_handed'] = $datawep[$item['subsubtype']][2];
|
|
|
|
return $data;
|
|
|
|
}
|
|
|
|
}
|
2021-10-30 19:02:07 +02:00
|
|
|
|
2021-11-14 11:02:22 +01:00
|
|
|
$data['can'] = false;
|
|
|
|
$data['message'] = 'You cannot use that item.';
|
|
|
|
return $data;
|
|
|
|
}
|
|
|
|
}
|