• 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 ZnoteAAC show killing assists at characterprofile deathlist

ralke

(҂ ͠❛ ෴ ͡❛)ᕤ
Joined
Dec 17, 2011
Messages
1,521
Solutions
27
Reaction score
870
Location
Santiago - Chile
GitHub
ralke23
Twitch
ralke23
I use TFS 1.5 downgrades 8.6. Hi guys! Someone knows how to add death assists to znote aac characterprofile? It only shows 1 killer, no assists. I already set up the playerdeath.lua creaturescript from znote main repository (tested the revscript and the creaturescript), both works well in-game, the assists are shown. But in website, the deathlist doesn't count killing assists (if a player was killed by multiple players).

Here's my characterprofile.php (inside sub folder)
PHP:
<?php require_once 'engine/init.php';
 
if ($config['log_ip'])
{
    znote_visitor_insert_detailed_data(4);
}

if (isset($_GET['name']) === true && empty($_GET['name']) === false)
{
    $name = getValue($_GET['name']);
    $user_id = user_character_exist($name);
   
    if ($user_id !== false)
    {  
        if ($config['TFSVersion'] == 'TFS_10')
        {
            $profile_data = user_character_data($user_id, 'account_id', 'town_id', 'name', 'level', 'group_id', 'vocation', 'health', 'healthmax', 'experience', 'mana', 'manamax', 'sex', 'lastlogin', 'looktype', 'lookhead', 'lookbody', 'looklegs', 'lookfeet', 'exphist1', 'exphist2', 'exphist3', 'exphist4', 'exphist5', 'exphist6', 'exphist7');
            $profile_data['online'] = user_is_online_10($user_id);
           
            if ($config['Ach'])
            {
                $user_id = (int) $user_id;
                $achievementPoints = mysql_select_single("SELECT SUM(`value`) AS `sum` FROM `player_storage` WHERE `key` LIKE '30___' AND `player_id`=$user_id");
            }
           
        }
        else
        {
            $profile_data = user_character_data($user_id, 'name', 'account_id', 'town_id', 'level', 'group_id', 'vocation', 'health', 'healthmax', 'experience', 'mana', 'manamax', 'lastlogin', 'online', 'sex', 'looktype', 'lookhead', 'lookbody', 'looklegs', 'lookfeet', 'exphist1', 'exphist2', 'exphist3', 'exphist4', 'exphist5', 'exphist6', 'exphist7');
        }
       
        $profile_znote_data = user_znote_character_data($user_id, 'created', 'hide_char');
        $account_data = user_znote_account_data($profile_data['account_id'], 'flag');
       
        $guild_exist = false;
       
        if (get_character_guild_rank($user_id) > 0)
        {
            $guild_exist = true;
            $guild = get_player_guild_data($user_id);
            $guild_name = get_guild_name($guild['guild_id']);
        }
       
        ?>  
        <!-- PROFILE MARKUP HERE-->
        <table>
  <td class="white"><b><?php echo $config['site_title'] ?> | Búsqueda de personaje</b></td>
  </table>
        <table style='table-layout:auto' id="characterProfileTable" class="default" border="1" cellspacing="1" cellpadding="4" width="100%">
            <thead>
                <tr class="yellow">
                    <th style="width:200px">
                        <?php if ($loadOutfits): ?>
                            <div class="outfit">
                                <img src="<?php echo $config['show_outfits']['imageServer']; ?>?id=<?php echo $profile_data['looktype']; ?>&addons=<?php echo $profile_data['lookaddons']; ?>&head=<?php echo $profile_data['lookhead']; ?>&body=<?php echo $profile_data['lookbody']; ?>&legs=<?php echo $profile_data['looklegs']; ?>&feet=<?php echo $profile_data['lookfeet']; ?>" alt="img">
                            </div>
                        <?php endif;
                        $flags = $config['country_flags'];
                        if ($flags['enabled'] && $flags['characterprofile']) {
                            $account_data = user_znote_account_data($profile_data['account_id'], 'flag');
                            if (strlen($account_data['flag']) > 0):
                                ?><!-- Player country data -->
                                <div class="flag">
                                    <img src="<?php echo $flags['server'] . '/' . $account_data['flag']; ?>.png">
                                </div>
                                <?php
                            endif;
                        }
                        ?>
                        <?php
                echo '
                <div style="position:relative; left:-5px; top:-48px;">
                    <div style="background-image: url(layout/outfitter/outfit.php?id='.$profile_data['looktype'].'&head='.$profile_data['lookhead'].'&body='.$profile_data['lookbody'].'&legs='.$profile_data['looklegs'].'&feet='.$profile_data['lookfeet'].');
                        width:64px;height:64px;position:absolute;background-repeat:no-repeat;background-position:right bottom;">
                    </div>
                </td>';
                ?>
                    </th>
                    <th>
                        <h2>&emsp;<?php echo $profile_data['name']; ?></h2>

                    </th>
                </tr>
            </thead>
            <tbody>
<!-- Player Profession: -->
                <tr><td><strong>&emsp;Vocation:</strong></td><td>&emsp;<?php if ($profile_data['sex'] == 1) { echo 'He is a '; echo vocation_id_to_name($profile_data['vocation']); } else { echo 'She is a '; echo vocation_id_to_name($profile_data['vocation']); }?></td></tr>
               
                <!-- Player level -->
                <tr>
                    <td><strong>&emsp;Level:</strong></td><td colspan="2">
                        &emsp;<?php
                        echo $profile_data['level']; echo ' and has '; echo $profile_data['experience']; echo ' experience points';
                        ?>
                    </td>
                </tr>
               
                <!-- Player Position -->
                <?php if ($profile_data['group_id'] > 1) { ?>
                <tr><td><strong>&emsp;Position:</strong></td><td colspan="2">&emsp;<?php echo 'Greed\'s Staff Member ('; echo group_id_to_name($profile_data['group_id']); echo ')'; ?></td></tr>
                <?php } ?>
               
               
                <!-- Player guild -->
                <?php
                if ($guild_exist)
                {
                ?>
                <td><strong>&emsp;Guild Membership:</strong></td>
                    <td colspan="2">
                &emsp;<?php if ($profile_data['sex'] == 1) { echo 'He\'s '; echo $guild['rank_name']; ?> of <a href="guilds.php?name=<?php echo $guild_name; ?>"><?php echo $guild_name;} else {echo 'She\'s '; echo $guild['rank_name']; ?> of <a href="guilds.php?name=<?php echo $guild_name; ?>"><?php echo $guild_name;} ?></a>
                    </td>
                </td>
                <?php
                }
                ?>
                <!-- Player last login -->
                <tr>
                    <td><strong>&emsp;Last Login:</strong></td><td colspan="2">
                    &emsp;<?php
                    if ($profile_data['lastlogin'] != 0)
                    {
                        echo getClock($profile_data['lastlogin'], true, true); echo ' (UTC-4 CL)';
                    }
                    else
                    {
                        echo 'Never logged in.';
                    }
                    ?>
                    </td>
                </tr>
                <!-- Achievement start -->
                <center><?php if ($config['Ach'] && (int)$achievementPoints['sum'] > 0): ?></center>
                    <tr>
                        <td>&emsp;Achievement Points</td>
                        <td><?php echo (int)$achievementPoints['sum']; ?></td>
                    </tr>
                <?php endif; ?>
                <!-- Display house start -->
                &emsp;<?php
                if ($config['TFSVersion'] !== 'TFS_02')
                {
                    $townid = ($config['TFSVersion'] === 'TFS_03') ? 'town' : 'town_id';
                    $houses = mysql_select_multi("SELECT `id`, `owner`, `name`, `$townid` AS `town_id` FROM `houses` WHERE `owner` = $user_id;");
                   
                    if ($houses)
                    {
                        $playerlist = array();
                        foreach ($houses as $h)
                        {
                            if ($h['owner'] > 0)
                            {
                                $playerlist[] = $h['owner'];
                            }
                               
                            if ($profile_data['id'] = $h['owner'])
                            {
                            ?>
                                <tr><td><strong>&emsp;House:</strong></td><td colspan="2">&emsp;<?php echo $h['name']; ?>, <?php
                                    foreach ($config['towns'] as $key => $value)
                                    {
                                        if ($key == $h['town_id'])
                                        {
                                            echo $value;
                                        }
                                    }
                             ?>
                                </td></tr>
                            <?php
                            }
                        }
                    }
                }
                ?>
                <!-- Display house end -->
               
                <!-- Display player status -->
                <tr><td><strong>&emsp;Status:</strong></td><td colspan="2">&emsp;<?php
                if ($config['TFSVersion'] == 'TFS_10')
                {
                    if ($profile_data['online'])
                    {
                        echo 'This player is currently '; echo '<font class="profile_font" name="profile_font_online" color="green"><b>online</b></font>';
                    }
                    else
                    {
                        echo 'This player is currently '; echo '<font class="profile_font" name="profile_font_online" color="red"><b>offline</b></font>';
                    }
                }
                else
                {
                    if ($profile_data['online'])
                    {
                        echo 'This player is currently '; echo '<font class="profile_font" name="profile_font_online" color="green"><b>online</b></font>';
                    }
                    else
                    {
                        echo 'This player is currently '; echo '<font class="profile_font" name="profile_font_online" color="red"><b>offline</b></font>';
                    }
                }
                ?></td>
                </tr>
                <!-- Display player status end -->
               
                <!-- Player created -->
                <tr><td><strong>&emsp;Created:</strong></td><td colspan="2">&emsp;<?php echo getClock($profile_znote_data['created'], true); echo ' (UTC-4 CL)';?></td></tr>

        <!-- Season --->
    <!---    <table border="1" cellspacing="1" cellpadding="4" width="100%">
    <thead>
        <tr>
            <th colspan="2"><font class="profile_font"><b>Seasons ranking:</b></font></th>
        </tr>
    </thead>
    <tbody>
<!---?php
$seasons = mysql_select_multi("SELECT id, name FROM seasons ORDER BY id");

foreach($seasons as $season) {
    $seasonData = mysql_select_single("SELECT rank_level, level, experience FROM season_archive WHERE `season_id` =" . (int)$season['id'] . " AND `player_id` =" . (int)$user_id);
    echo '<tr>';
    echo '<td><b>' . $season['name'] . '</b></td>';
    if ($seasonData) {
        echo '<td>#' . $seasonData['rank_level'] . ' (level ' . $seasonData['level'] . ', exp ' . $seasonData['experience'] . ')</td>';
    } else {
        // player has no rank for season = was created after season finished
        echo '<td>Not participated in competition</td>';
    }
    echo '</tr>';
}
?>
    </tbody>
</table>-->

        <!-- Achievements start -->
        <?php if ($config['Ach']):
            $achievements = mysql_select_multi("
                SELECT `player_id`, `value`, `key`
                FROM `player_storage`
                WHERE `player_id`='$user_id'
                AND `key` LIKE '30___';
            ");
            $c_achs = $config['achievements'];
            $toggle = array(
                'show' => '<a href="#show">Show</a>',
                'hide' => '<a href="#hide">Hide</a>'
            );
            if ($achievements !== false): ?>
                <h3>Achievements: <label id="ac_label_hide" for="ac_toggle_hide"><?php echo $toggle['show']; ?></label></h3>
                <!-- <div id="accordion">
                    <h3>Show/hide player achievements</h3>
                    <div>
                    </div>
                </div><br> -->
                <input type="checkbox" id="ac_toggle_hide" name="ac_toggle_hide">
                <table class="achievements">
                    <thead>
                        <tr>
                            <th>Name</th>
                            <th>Description</th>
                            <th>Points</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php foreach($achievements as $a): ?>
                            <tr>
                                <td><?php echo $c_achs[$a['key']][0]; ?></td>
                                <td><?php echo $c_achs[$a['key']][1]; ?></td>
                                <td><?php echo $a['value']; ?></td>
                            </tr>
                        <?php endforeach; ?>
                    </tbody>
                </table>
                <style type="text/css">
                    table.achievements,
                    #ac_toggle_hide {
                        display: none;
                    }
                    #ac_toggle_hide:checked + table.achievements {
                        display: table;
                    }
                </style>
                <script type="text/javascript">
                    document.getElementById("ac_label_hide").addEventListener("click", function(event){
                        event.preventDefault();
                        if (document.getElementById("ac_label_hide").innerHTML == "<?php echo str_replace('"', '\"', $toggle['show']); ?>") {
                            document.getElementById("ac_label_hide").innerHTML = "<?php echo str_replace('"', '\"', $toggle['hide']); ?>";
                            document.getElementById("ac_toggle_hide").checked = true;
                        } else {
                            document.getElementById("ac_label_hide").innerHTML = "<?php echo str_replace('"', '\"', $toggle['show']); ?>";
                            document.getElementById("ac_toggle_hide").checked = false;
                        }
                    });
                </script>
            <?php endif; ?>
        <?php endif; ?>

        <!-- DEATH LIST -->
        <table class="default" border="1" cellspacing="0" cellpadding="4" width="100%">
            <thead>
                <tr class="yellow">
                    <th colspan="2">Death List</th>
                </tr>
            </thead>
            <tbody>
                <?php
                if ($config['ServerEngine'] == 'TFS_10') {
                    $deaths = mysql_select_multi("
                        SELECT
                            `player_id`,
                            `time`,
                            `level`,
                            `killed_by`,
                            `is_player`,
                            `mostdamage_by`,
                            `mostdamage_is_player`,
                            `unjustified`,
                            `mostdamage_unjustified`
                        FROM `player_deaths`
                        WHERE `player_id`=$user_id
                        ORDER BY `time` DESC
                        LIMIT 10;
                    ");

                    if ($deaths) {
                        foreach ($deaths as $d) {
                            $lasthit = ($d['is_player'])
                            ? "<a href='characterprofile.php?name=".$d['killed_by']."'>".$d['killed_by']."</a>"
                            : $d['killed_by'];

                            ?>
                            <tr>
                                <td><?php echo getClock($d['time'], true, true); ?></td>
                                <td>
                                    &ensp;<?php
                                    echo "Killed at level ".$d['level']." by {$lasthit}";
                                    if ($d['unjustified']) {
                                        echo " <font color='red' style='font-style: italic;'>(unjustified)</font>";
                                    }
                                    $mostdmg = ($d['mostdamage_by'] !== $d['killed_by']) ? true : false;
                                    if ($mostdmg) {
                                        $mostdmg = ($d['mostdamage_is_player'])
                                        ? "<a href='characterprofile.php?name=".$d['mostdamage_by']."'>".$d['mostdamage_by']."</a>"
                                        : $d['mostdamage_by'];

                                        echo "<br>and by $mostdmg.";

                                        if ($d['mostdamage_unjustified']) {
                                            echo " <font color='red' style='font-style: italic;'>(unjustified)</font>";
                                        }
                                    } else {
                                        echo " <b>(soloed)</b>";
                                    }
                                    ?>
                                </td>
                            </tr>
                            <?php
                        }
                    } else {
                        ?>
                        <tr>
                            <td colspan="2">This player has never died.</td>
                        </tr>
                        <?php
                    }
                } elseif ($config['ServerEngine'] == 'TFS_02') {
                    $array = user_fetch_deathlist($user_id);
                    if ($array) {
                        foreach ($array as $value):
                            if ($value['is_player'] == 1) {
                                $value['killed_by'] = 'player: <a href="characterprofile.php?name='. $value['killed_by'] .'">'. $value['killed_by'] .'</a>';
                            } else {
                                $value['killed_by'] = 'monster: '. $value['killed_by'] .'.';
                            }
                            ?>
                            <tr>
                                <td><?php echo getClock($value['time'], true, true); ?></td>
                                <td><?php echo 'Killed at level '. $value['level'] .' by '. $value['killed_by']; ?></td>
                            </tr>
                        <?php endforeach;
                    } else {
                        ?>
                        <tr>
                            <td colspan="2">This player has never died.</td>
                        </tr>
                        <?php
                    }
                } elseif (in_array($config['ServerEngine'], array('TFS_03', 'OTHIRE'))) {
                    //mysql_select_single("SELECT * FROM players WHERE name='TEST DEBUG';");
                    $array = user_fetch_deathlist03($user_id);
                    if ($array) {
                        // Design and present the list
                        foreach ($array as $value):
                            $value[3] = user_get_killer_id(user_get_kid($value['id']));
                            if ($value[3] !== false && $value[3] >= 1) {
                                $namedata = user_character_data((int)$value[3], 'name');
                                if ($namedata !== false) {
                                    $value[3] = $namedata['name'];
                                    $value[3] = 'player: <a href="characterprofile.php?name='. $value[3] .'">'. $value[3] .'</a>';
                                } else {
                                    $value[3] = 'deleted player.';
                                }
                            } else {
                                $value[3] = user_get_killer_m_name(user_get_kid($value['id']));
                                if ($value[3] === false) {
                                    $value[3] = 'deleted player.';
                                }
                            }
                            ?>
                            <tr>
                                <td><?php echo getClock($value['date'], true, true); ?></td>
                                <td><?php echo 'Killed at level '. $value['level'] .' by '. $value[3]; ?></td>
                            </tr>
                        <?php endforeach;
                    } else {
                        ?>
                        <tr>
                            <td colspan="2">This player has never died.</td>
                        </tr>
                        <?php
                    }
                }
                ?>
            </tbody>
        </table>

        <!-- CHARACTER LIST -->
        <?php
        // Backward compatibility
        $select_online = "CASE WHEN `l`.`player_id` IS NULL THEN 0 else 1 END as `online`";
        $join_online = "LEFT JOIN `players_online` as `l` ON `p`.`id` = `l`.`player_id`";
        if ($config['ServerEngine'] != 'TFS_10') {
            $select_online = "`p`.`online`";
            $join_online = "";
        }

        // Load other visible characters
        $otherChars = mysql_select_multi("
            SELECT
                `p`.`id`,
                `p`.`name`,
                `p`.`level`,
                `p`.`vocation`,
                `p`.`lastlogin`,
                {$select_online}
            FROM `players` as `o`
            JOIN `players` as `p`
                ON `o`.`account_id` = `p`.`account_id`
            LEFT JOIN `znote_players` as `z`
                ON `p`.`id` = `z`.`player_id`
            LEFT JOIN `znote_players` as `z2`
                ON `o`.`id` = `z2`.`player_id`
            {$join_online}
            WHERE `o`.`id` = {$user_id}
            AND `p`.`id` != `o`.`id`
            AND `z`.`hide_char` = 0
            AND `z2`.`hide_char` = 0
            ORDER BY `p`.`experience` DESC;
        ");

        // Render table if there are any characters to show
        if ($otherChars !== false) {
            ?>
                <table id="characterprofileTable" class="table table-striped table-hover" border="1" cellspacing="1" cellpadding="4" width="100%">
                <th colspan="5"<b>Other visible characters on this account:</b></th>

                    <tr class="yellow">
                        <th>Name:</th>
                        <th>Level:</th>
                        <th>Vocation:</th>
                        <th>Last login:</th>
                        <th>Status:</th>
                    </tr>
                    <?php
                    // Add character rows
                    foreach ($otherChars as $char):
                        ?>
                        <tr>
                            <td><a href="characterprofile.php?name=<?php echo $char['name']; ?>"><?php echo $char['name']; ?></a></td>
                            <td><?php echo (int)$char['level']; ?></td>
                            <td><?php echo vocation_id_to_name($char['vocation']); ?></td>
                            <td><?php echo ($char['lastlogin'] != 0) ? getClock($char['lastlogin'], true, true) : 'Never.'; ?></td>
                            <td><?php echo ($char['online']) ? 'online' : 'offline'; ?></td>
                        </tr>
                        <?php
                    endforeach;
                    ?>
                </table>
            <?php
        }
        ?>
        <!-- END CHARACTER LIST -->
        </table>
        <?php
    }
    else
    {
        echo htmlentities(strip_tags($name, ENT_QUOTES)) . ' does not exist.';
    }
?>
    <form type="submit" action="characterprofile.php" method="get">
   
    <table class="default" border="1" cellspacing="1" cellpadding="4" width="100%">
        <tr><th >Search Character</th></tr>
        <tr><td>
            <table style="width: auto;margin: 0;">
                <tr>
                    <td><strong>Name:</strong></td><td><input size="29" type="text" name="name" class="search"></td>
                    <td>
                    <input type="Submit" value="" class="hover" style="background: url(layout/tibia_img/sbutton_submit.gif); width:120px;height:18px;border: 0 none;" border="0"></td>
                </tr>
               

            </table>
        </td></tr>
    </table>
    </form>
<?php
}
else
{
    header('Location: index.php');
}

?>

Thanks in advance!
 
Last edited:
Back
Top