• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

AAC Time to respawn Boss

ZiumZium

Member
Joined
Sep 27, 2024
Messages
106
Solutions
1
Reaction score
11
TFS 1.4.2 MyAcc

Hi. I would like to make a script on the page check if a given boss is alive, and if not, how much time is left until the next boss respawns.

For example, Orshabaal is on the server, it shows him on the "Alive" page, if he is dead - it shows the time until the next boss respawns, e.g.
Ferumbras
Time to respawn: 17:24:41.

I received information that I need to create a table with bosses, save and update it. I have no idea how to do it

I was thinking of trying to make it auto respawn at a specific time on a specific day with this script (dont need checker, only auto respawn):




PHP:
if (!function_exists('checkMonsterOnline')) {
    function checkMonsterOnline($monsterName) {
        global $db;
        
        if (!$db->hasTable('boss_status')) {
            return false;
        }

        try {
            $query = $db->query("SELECT alive FROM boss_status WHERE name = " . $db->quote($monsterName));
            if ($query->rowCount() > 0) {
                $result = $query->fetch();
                return (bool)$result['alive'];
            }
            return false;
        }
        catch (PDOException $e) {
            error_log("Błąd sprawdzania statusu bossa: " . $e->getMessage());
            return false;
        }
    }
}


PHP:
<div class="right_box">
            <div class="corner_lt"></div><div class="corner_rt"></div>
            <div class="corner_lb"></div><div class="corner_rb"></div>
            <div class="title">
                <span class="title-like-menu">Bossy</span>
            </div>
            <div class="content">
                <div class="rise-up-content" style="text-align: center;">
                    <div style="color: #00ff00; font-weight: bold; margin-bottom: 5px;">
                        Orshabaal
                    </div>

                    <img src="<?= $template_path; ?>/images/Orshabaal.gif" alt="Orshabaal">
                    <div style="margin-top: 5px;">
                        <?php
                        $monsterAlive = checkMonsterOnline("Orshabaal");
                        if($monsterAlive){
                            echo '<span style="color: #00ff00; font-weight: bold;">Alive</span>';
                        } else {
                            echo '<span style="color: #ff0000; font-weight: bold;">Death</span>';
                        }
                        ?>
                    </div>
                </div>
            </div>
            <div class="border_bottom"></div>
        </div>
 

Similar threads

Back
Top