<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">#!/usr/bin/perl -w

# (c) CWZ, LLC

# End The Round

use strict;
use lib '.';
use CWZ;

# Call and run rank_update.pl script
system("/var/www/live/cwzgame/perl/rank_update.pl");

system("/var/www/live/cwzgame/perl/smash_update.pl");


# Ass Sess EOR
#qDb_do("UPDATE Account SET Sess = CONCAT(Sess, ',EOR:1')");

# Query to select the current round ID
my $roundDetails = qDb_hr("SELECT id, start_date, end_date FROM Round WHERE end_date &lt; NOW() ORDER BY id DESC LIMIT 1");

my $round_id = $roundDetails-&gt;{id};
my $start_date = $roundDetails-&gt;{start_date};
my $end_date = $roundDetails-&gt;{end_date};


# Query to insert data into the halloffame player table
qDb_do("INSERT INTO Hofplayer (round_id, start, end, pid, charnm, sid, squadnm, chartag, loc, locsnm, locnm, glob_rank, loc_rank, market, cash, sk_class, f_newb, f_hodler, f_whale, f_shill, f_youtuber, f_redditor, f_anon, f_karen, f_reporter, f_politician, it_by, a51_by, fud_by, att_won, att_lost, whales_smashed, shills_smashed, def_count, loot_stole, influencers_stole, doubters_stole)
          SELECT $round_id, '$start_date', '$end_date', p.pid, p.charnm, p.sid, s.squadnm, p.chartag, p.loc, l.shortnm, l.longnm, p.glob_rank, p.loc_rank, p.market, p.cash, p.sk_class, p.f_newb, p.f_hodler, p.f_whale, p.f_shill, p.f_youtuber, p.f_redditor, p.f_anon, p.f_karen, p.f_reporter, p.f_politician, p.it_by, p.a51_by, p.fud_by, p.att_won, p.att_lost, p.whales_smashed, p.shills_smashed, p.def_count, p.loot_stole, p.influencers_stole, p.doubters_stole
          FROM Player p LEFT JOIN Squad s ON p.sid = s.sid LEFT JOIN Location l ON p.loc = l.id");

# Query to insert data into the halloffame squad table
qDb_do("INSERT INTO Hofsquad (round_id, start, end, sid, squadnm, founder, cofounder, loc, loc_rank, value, hourly_pct, daily_pct, att_won, att_lost, whales_smashed, shills_smashed, def_count, loot_stole, influencers_stole, doubters_stole)
          SELECT $round_id, '$start_date', '$end_date', s.sid, s.squadnm, s.founder, s.cofounder, sr.loc, sr.loc_rank, sr.value, sr.hourly_pct, sr.daily_pct, s.att_won, s.att_lost, s.whales_smashed, s.shills_smashed, s.def_count, s.loot_stole, s.influencers_stole, s.doubters_stole
          FROM Squad s
          JOIN Squad_Rank sr ON s.sid = sr.sid");
</pre></body></html>