Nostradamus
Member
- Joined
- Jun 2, 2007
- Messages
- 219
- Reaction score
- 6
Activity Stream
What the hell is that?
This system tracks server activity and shows in the website the most relevant events that players are doing at the moment you are in the page.
Currently, you can track:
Of course if you are not a retard, you can make more events, i'm just lazy to do people's homework.
TRIGGERS
To not spam the database, i've added some conditions:
THE PAGE ITSELF
You will need to change $items array to edit rare items names.
INSTALLING
I know you are pretty lazy and you'll not read all that thing and will ask dumb questions, so just download the .7ZIP file and follow the instructions in the HOW TO INSTALL.txt file
BE CREATIVE!
Now show that you aren't a completly useless guy and make a character_view injection using this, i know you can do it
What the hell is that?
This system tracks server activity and shows in the website the most relevant events that players are doing at the moment you are in the page.
Currently, you can track:
- Level/Magic Level advances
- Skill advances
- Item drops
- Guild creation
Of course if you are not a retard, you can make more events, i'm just lazy to do people's homework.
TRIGGERS
PHP:
CREATE TABLE IF NOT EXISTS `player_log` (
`id` int(10) NOT NULL,
`old_value` int(10) NOT NULL,
`new_value` int(10) NOT NULL,
`special` varchar(50) NOT NULL,
`event` varchar(50) NOT NULL,
`date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB;
DROP TRIGGER IF EXISTS `oncreate_guilds`;
DELIMITER //
CREATE TRIGGER oncreate_guilds AFTER INSERT ON guilds
FOR EACH ROW BEGIN
INSERT INTO `player_log` (id, old_value, new_value, special, event, date) VALUES (NEW.`ownerid`, NEW.`id`, '', NEW.`name`, 'guild', CURRENT_TIMESTAMP);
INSERT INTO `guild_ranks` (`name`, `level`, `guild_id`) VALUES ('Leader', 3, NEW.`id`);
INSERT INTO `guild_ranks` (`name`, `level`, `guild_id`) VALUES ('Vice-Leader', 2, NEW.`id`);
INSERT INTO `guild_ranks` (`name`, `level`, `guild_id`) VALUES ('Member', 1, NEW.`id`);
END;
//
DELIMITER ;
DROP TRIGGER IF EXISTS `playerLog`;
DELIMITER //
CREATE TRIGGER playerLog AFTER UPDATE ON players
FOR EACH ROW BEGIN
IF NEW.level != OLD.level AND NEW.level > OLD.level THEN
IF NEW.level > 100 THEN
INSERT INTO player_log (id, old_value, new_value, special, event, date) VALUES (OLD.id, OLD.level, NEW.level, '', 'level', CURRENT_TIMESTAMP);
END IF;
END IF;
IF NEW.maglevel != OLD.maglevel AND NEW.maglevel > OLD.maglevel THEN
IF OLD.vocation IN (1,2) AND NEW.maglevel > 80 OR OLD.vocation = 3 AND NEW.maglevel > 15 OR OLD.vocation = 4 AND NEW.maglevel > 6 THEN
INSERT INTO player_log (id, old_value, new_value, special, event, date) VALUES (OLD.id, OLD.level, NEW.level, '', 'magic', CURRENT_TIMESTAMP);
END IF;
END IF;
IF NEW.vocation != OLD.vocation THEN
INSERT INTO player_log (id, old_value, new_value, special, event, date) VALUES (OLD.id, OLD.vocation, NEW.vocation, '', 'vocation', CURRENT_TIMESTAMP);
END IF;
END;
//
DELIMITER ;
DROP TRIGGER IF EXISTS `skillLog`;
DELIMITER //
CREATE TRIGGER skillLog AFTER UPDATE ON player_skills
FOR EACH ROW BEGIN
IF NEW.value != OLD.value AND NEW.value > OLD.value THEN
IF OLD.skillid IN (0,6) AND NEW.value > 50 OR OLD.skillid IN (1,2,3) AND NEW.value > 70 OR OLD.skillid = 4 AND NEW.value > 80 THEN
INSERT INTO player_log (id, old_value, new_value, special, event, date) VALUES (OLD.player_id, OLD.value, NEW.value, '', OLD.skillid, CURRENT_TIMESTAMP);
END IF;
END IF;
END;
//
DELIMITER ;
DROP TRIGGER IF EXISTS `itemLog`;
DELIMITER //
CREATE TRIGGER itemLog AFTER INSERT ON player_items
FOR EACH ROW BEGIN
IF NEW.itemtype IN (2390, 2391, 2392) THEN
INSERT INTO player_log (id, old_value, new_value, special, event, date) VALUES (NEW.player_id, NEW.itemtype, NEW.count, '', 'item', CURRENT_TIMESTAMP);
END IF;
END;
//
DELIMITER ;
To not spam the database, i've added some conditions:
- Only level 100+ advances are shown
- If character is a mage, only magic level above 80 are shown, paladin, 15 and knight at 6
- Fist and Fishing are show above 50 while Melee Skills appears in 70, to Distance Fighting we have the value 80 set
- The IDS of items that we will save in player log will be 2390, 2391, 2392, change it to your rare/custom items
THE PAGE ITSELF
PHP:
<style>
.activity p{line-height:16px;}
.activity ul li{padding:14px 0; border-bottom:1px dotted #b39d6b; list-style: none;}
.activity h4{font-size:12px;color:#000000;padding:0 0 5px; font-family:Georgia; font-weight:normal;}
.activity img{padding-right: 10px;}
.activity small{float: right; font-size: 10px;}
</style>
<?php
$items = array(
9969 => 'a fire sword', // just an example
);
// Constants
$skills = array(
'level' => 'Level',
'magic' => 'Magic',
0 => 'Fist Fighting',
1 => 'Club Fighting',
2 => 'Sword Fighting',
3 => 'Axe Fighting',
4 => 'Distance Fighting',
5 => 'Shielding',
6 => 'Fishing'
);
require("config.php");
echo '<div class="activity">';
$ots = POT::getInstance();
$ots->connect(POT::DB_MYSQL, connection());
$SQL = $ots->getDBHandle();
echo "<div style=\"text-align: center; font-weight: bold;\">Server Activity</div>";
echo "<p><em>Showing 100 most recent activities</em></p>";
foreach($SQL->query('
SELECT
player.name as name, old_value, new_value, special, event, date
FROM
player_log AS log
INNER JOIN
players AS player
WHERE
player.id = log.id
ORDER BY
date DESC;
LIMIT 100
') as $player)
{
if (isSet($skills[$player['event']])) {
$eventTitle = $skills[$player['event']];
if ($player['new_value'] - $player['old_value'] == 1)
$msg = 'advanced in '.$eventTitle. ' ('.$player['new_value'].')';
else
$msg = 'advanced in '.$eventTitle. ' from '.$player['old_value']. ' to '.$player['new_value'];
}
else if ($player['event'] == 'item') {
$eventTitle = 'Rare Item';
if (isSet($items[$player['old_value']])) {
$count = ($player['new_value'] > 1) ? ' ('. $player['new_value'] .'x)' : '';
$msg = 'earned '.$items[$player['old_value']].''.$count;
}
}
else if ($player['event'] == 'guild') {
$eventTitle = 'Guild';
$msg = 'created '.$player['special'].' guild';
}
$eventImage = ($player['event'] == 'item') ? '/images/items/'.$player['old_value'].'.jpg' : '/events/'.$player['event'].'.png';
echo '
<ul>
<li>
<img title="'.$eventTitle.'" src="'.WEBSITE.'/public'.$eventImage.'" align="absmiddle">
<strong>'.$player['name'].'</strong> '.$msg.'
<small>at '.$player['date'].' </small></li></ul>';
}
echo '</div>';
?>
You will need to change $items array to edit rare items names.
INSTALLING
I know you are pretty lazy and you'll not read all that thing and will ask dumb questions, so just download the .7ZIP file and follow the instructions in the HOW TO INSTALL.txt file
>DOWNLOAD<
Max Size for download link since most users are blind or tries to behave like one.
Max Size for download link since most users are blind or tries to behave like one.
BE CREATIVE!
Now show that you aren't a completly useless guy and make a character_view injection using this, i know you can do it