Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void stash_info(buffer ClanLog) {
- string the_date; string the_time; string player_name; string player_id; string action; string amount; string item_handled;
- int start_of_stash_activity = index_of(ClanLog, "Stash Activity") + 55;
- int end_of_stash_activity = index_of(ClanLog, "Miscellaneous:", start_of_stash_activity);
- string stash_activity = substring(ClanLog, start_of_stash_activity, end_of_stash_activity);
- string pattern = ">(\\d{2}/\\d{2}/\\d{2}), (\\d{2}:\\d{2}[AaPp][Mm]): <a class=nounder href='showplayer\\.php\\?who=[\\d]+'>([a-zA-Z0-9\\-\\_\\ ]+) \\(#(\\d+)\\)<\\/a> (added|took|contributed) (\\d+) (.+?)\\.<br";
- matcher m_stash_put = create_matcher(pattern, stash_activity);
- print_html("<font color=0000FF>Build matcher</font>");
- int i = 0;
- while(i < 5)//test only 5 iterations
- {
- print_html("<font color=0000FF>Find</font>");
- if (m_stash_put.find()) {
- i=i+1;
- the_date = m_stash_put.group(1);
- the_time = m_stash_put.group(2);
- player_name = m_stash_put.group(3);
- player_id = m_stash_put.group(4);
- action = m_stash_put.group(5);
- amount = m_stash_put.group(6);
- item_handled = m_stash_put.group(7);
- print_html("<font color=008000>" + player_name + " (#" + player_id + ") " + action + " " + amount + " " + item_handled + " on " + the_date + " at " + the_time + ".</font>");
- print_html("<font color=008000>" + m_stash_put.group(0) + "</font>");
- }
- }
- }
- void whitelist_info(buffer ClanLog) {
- string the_date; string the_time; string player_name; string player_id; string action;
- int start_of_comings_and_goings = index_of(ClanLog, "Comings and Goings") + 60;
- int end_of_comings_and_goings = index_of(ClanLog, "Stash Activity", start_of_comings_and_goings);
- string comings_and_goings = substring(ClanLog, start_of_comings_and_goings, end_of_comings_and_goings);
- string pattern = ">(\\d{2}/\\d{2}/\\d{2}), (\\d{2}:\\d{2}[AaPp][Mm]): ([a-zA-Z0-9\\-\\_\\ ]+) \\(#(\\d+)\\) (joined another clan|was accepted into the clan)";
- matcher m_stash_put = create_matcher(pattern, comings_and_goings);
- print_html("<font color=0000FF>Build matcher</font>");
- int i = 0;
- while(i < 5)//test only 5 iterations
- {
- print_html("<font color=0000FF>Find</font>");
- if (m_stash_put.find()) {
- player_name = m_stash_put.group(3);
- if (player_name != "Easyfax" && player_name != "CheeseFax") {
- i=i+1;
- the_date = m_stash_put.group(1);
- the_time = m_stash_put.group(2);
- player_id = m_stash_put.group(4);
- action = m_stash_put.group(5);
- if (action.contains_text("accepted")) {
- print_html("<font color=008000>" + player_name + " (#" + player_id + ") joined the clan.</font>");
- } else if (action.contains_text("joined")) {
- print_html("<font color=008000>" + player_name + " (#" + player_id + ") left the clan.</font>");
- } else {
- print_html("<font color=FF0000>" + action + "</font>");
- }
- print_html("<font color=008000>" + m_stash_put.group(0) + "</font>");
- }
- }
- }
- }
- void main() {
- buffer ClanLog = visit_url("clan_log.php");
- whitelist_info(ClanLog);
- #stash_info(ClanLog);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement