heroAwayReason($session->uid); $t4AwayText = ''; if ($t4AwayReason === 'nohero') { $t4AwayText = defined('HERO_LOCKED_NOHERO') ? HERO_LOCKED_NOHERO : 'You have no hero yet. Train one in the Hero\'s Mansion before equipping items.'; } elseif ($t4AwayReason === 'adventure') { $t4AwayText = defined('HERO_LOCKED_ADVENTURE') ? HERO_LOCKED_ADVENTURE : 'Your hero is on an adventure. Equipment can only be changed while the hero is in a village.'; } elseif ($t4AwayReason === 'attack') { $t4AwayText = defined('HERO_LOCKED_ATTACK') ? HERO_LOCKED_ATTACK : 'Your hero is on the move with the army. Equipment can only be changed while the hero is in a village.'; } elseif ($t4AwayReason === 'reinforcement') { $t4AwayText = defined('HERO_LOCKED_REINFORCEMENT') ? HERO_LOCKED_REINFORCEMENT : 'Your hero is reinforcing another village. Equipment can only be changed while the hero is in a village.'; } if (isset($_POST['t4action'], $_POST['rowid'])) { $t4RowId = (int) $_POST['rowid']; switch ($_POST['t4action']) { case 'equip': $t4Msg = $t4HeroItems->equipItem($session->uid, $t4RowId) ? HERO_EQUIP_OK : HERO_EQUIP_FAIL; break; case 'unequip': $t4Msg = $t4HeroItems->unequipItem($session->uid, $t4RowId) ? HERO_UNEQUIP_OK : HERO_ITEM_USE_FAIL; break; case 'useitem': $t4Qty = max(1, (int) ($_POST['qty'] ?? 1)); $t4Result = $t4HeroItems->useItem($session->uid, $t4RowId, $t4Qty, $village->wid); if ($t4Result === HeroItems::USE_OK) { $t4Msg = HERO_ITEM_USED_OK; } elseif ($t4Result === HeroItems::USE_DEFERRED) { $t4Msg = HERO_ITEM_USE_BATTLE; } else { $t4Msg = HERO_ITEM_USE_FAIL; } break; } } $t4Inventory = $t4HeroItems->getInventory($session->uid); $t4Equipped = $t4HeroItems->getEquipped($session->uid); ?>
| — | - | |||||