-
Notifications
You must be signed in to change notification settings - Fork 2
/
DefaultTemplate2.cpp
79 lines (79 loc) · 8.43 KB
/
DefaultTemplate2.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#include <wx/wx.h>
void ExportTemplateFile(wxString &directory,wxArrayString &fileLines,char *filename);
void ExportTemplateQuick(wxString &directory)
{
wxString filename;
wxArrayString fileLines;
wxString fileLine;
fileLines.Clear();
fileLine="$$roundsalreadyprocessed=ReadStatistic(\"roundsalreadyprocessed\")$$";fileLines.Add(fileLine);
fileLine="$$MinPlayersInRound=ReadConfig(\"/General/MinPlayersInRound\")$$";fileLines.Add(fileLine);
fileLine="$$MinRoundsPerPlayer=ReadConfig(\"/General/MinRoundsPerPlayer\")$$";fileLines.Add(fileLine);
fileLine="$$updatestatus(\"Main Page\")$$$$include quickmainpage.html$$";fileLines.Add(fileLine);
fileLine="$$updatestatus(\"Awards\")$$$$include quickawards.html$$";fileLines.Add(fileLine);
fileLine="$$updatestatus(\"Skill List\")$$$$messagecentrekey=\"TopSkill\"$$$$title=\"^7Skill\"$$$$sortkey=\"skill\"$$$$include quickplayerlists.html$$";fileLines.Add(fileLine);
fileLine="$$updatestatus(\"Score List\")$$$$messagecentrekey=\"TopScore\"$$$$title=\"^7Score\"$$$$sortkey=\"score\"$$$$include quickplayerlists.html$$";fileLines.Add(fileLine);
fileLine="$$updatestatus(\"Weighted Skill List\")$$$$messagecentrekey=\"TopWeightedSkill\"$$$$title=\"^7Weighted Skill\"$$$$sortkey=\"skillweighted\"$$$$include quickplayerlists.html$$";fileLines.Add(fileLine);
fileLine="$$updatestatus(\"Weighted Score List\")$$$$messagecentrekey=\"TopWeightedScore\"$$$$title=\"^7Weighted Score\"$$$$sortkey=\"scoreweighted\"$$$$include quickplayerlists.html$$";fileLines.Add(fileLine);
fileLine="$$updatestatus(\"Kill List\")$$$$messagecentrekey=\"TopKills\"$$$$title=\"^7Kills\"$$$$sortkey=\"kills\"$$$$include quickplayerlists.html$$";fileLines.Add(fileLine);
fileLine="$$updatestatus(\"Death List\")$$$$messagecentrekey=\"TopDeaths\"$$$$title=\"^7Deaths\"$$$$sortkey=\"deaths\"$$$$include quickplayerlists.html$$";fileLines.Add(fileLine);
fileLine="$$updatestatus(\"Team Kill List\")$$$$messagecentrekey=\"TopTeamKills\"$$$$title=\"^7Team Kills\"$$$$sortkey=\"teamkills\"$$$$include quickplayerlists.html$$";fileLines.Add(fileLine);
fileLine="$$updatestatus(\"Team Win List\")$$$$messagecentrekey=\"TopTeamWins\"$$$$title=\"^7Team Wins\"$$$$sortkey=\"teamwins\"$$$$include quickplayerlists.html$$";fileLines.Add(fileLine);
fileLine="$$updatestatus(\"Team Loss List\")$$$$messagecentrekey=\"TopTeamLosses\"$$$$title=\"^7Team Losses\"$$$$sortkey=\"teamlosses\"$$$$include quickplayerlists.html$$";fileLines.Add(fileLine);
fileLine="$$updatestatus(\"Kill Streak List\")$$$$messagecentrekey=\"TopKillStreak\"$$$$title=\"^7Longest Kill Streak\"$$$$sortkey=\"longestkillstreak\"$$$$include quickplayerlists.html$$";fileLines.Add(fileLine);
fileLine="$$updatestatus(\"Team Kill Streak List\")$$$$messagecentrekey=\"TopTeamKillStreak\"$$$$title=\"^7Longest Team Kill Streak\"$$$$sortkey=\"longestteamkillstreak\"$$$$include quickplayerlists.html$$";fileLines.Add(fileLine);
fileLine="$$updatestatus(\"Death Streak List\")$$$$messagecentrekey=\"TopDeathStreak\"$$$$title=\"^7Longest Death Streak\"$$$$sortkey=\"longestdeathstreak\"$$$$include quickplayerlists.html$$";fileLines.Add(fileLine);
fileLine="$$updatestatus(\"Suicide List\")$$$$messagecentrekey=\"TopSuicides\"$$$$title=\"^7Suicides\"$$$$sortkey=\"suicides\"$$$$include quickplayerlists.html$$";fileLines.Add(fileLine);
fileLine="$$updatestatus(\"Time Played List\")$$$$messagecentrekey=\"TopTimePlayed\"$$$$title=\"^7Time Played\"$$$$sortkey=\"duration\"$$$$include quickplayerlists.html$$";fileLines.Add(fileLine);
fileLine="$$updatestatus(\"Rounds Played List\")$$$$messagecentrekey=\"TopRoundsPlayed\"$$$$title=\"^7Rounds Played\"$$$$sortkey=\"rounds\"$$$$include quickplayerlists.html$$";fileLines.Add(fileLine);
fileLine="$$updatestatus(\"XP List\")$$$$include quickxplists.html$$";fileLines.Add(fileLine);
ExportTemplateFile(directory,fileLines,"quick.template");
fileLines.Clear();
fileLine="$$suffix=\"classes\"$$$$table=\"class\"$$$$title=\"Class\"$$$$include quicktotallist.html$$";fileLines.Add(fileLine);
fileLine="$$suffix=\"gametypes\"$$$$table=\"gametype\"$$$$title=\"Game Type\"$$$$include quicktotallist.html$$";fileLines.Add(fileLine);
fileLine="$$suffix=\"locations\"$$$$table=\"location\"$$$$title=\"Location\"$$$$include quicktotallist.html$$";fileLines.Add(fileLine);
fileLine="$$suffix=\"maps\"$$$$table=\"map\"$$$$title=\"Map\"$$$$include quicktotallist.html$$";fileLines.Add(fileLine);
fileLine="$$suffix=\"weapons\"$$$$table=\"weapon\"$$$$title=\"Weapon\"$$$$include quicktotallist.html$$";fileLines.Add(fileLine);
fileLine="$$suffix=\"teams\"$$$$table=\"team\"$$$$title=\"Team\"$$$$include quicktotallist.html$$";fileLines.Add(fileLine);
ExportTemplateFile(directory,fileLines,"quickmainpage.html");
fileLines.Clear();
fileLine="$$loop row as totaltype index as totaltypeindex select * from %%table%%$$";fileLines.Add(fileLine);
fileLine="$$messagecentrekey=\"Top%%table%%%%totaltype.id%%\"$$";fileLines.Add(fileLine);
fileLine="$$loop row as playertotal index as playertotalindex select * from view_killtotal%%suffix%% where itemindex='%%totaltype.idx%%' order by kills desc limit 1$$";fileLines.Add(fileLine);
fileLine="$$MessageCentre(messagecentrekey,playertotal.name,playertotal.kills)$$";fileLines.Add(fileLine);
fileLine="$$endloop playertotal$$";fileLines.Add(fileLine);
fileLine="$$endloop totaltype$$";fileLines.Add(fileLine);
ExportTemplateFile(directory,fileLines,"quicktotallist.html");
fileLines.Clear();
fileLine="$$loop row as awarddef index as awarddefindex select * from awarddefinition$$";fileLines.Add(fileLine);
fileLine=" $$pointsrecorded=\"0\"$$";fileLines.Add(fileLine);
fileLine=" $$loop row as awardpoints index as awardpointsindex select count(*) from view_awardpoints where awardindex='%%awarddef.awardindex%%'$$";fileLines.Add(fileLine);
fileLine=" $$pointsrecorded=awardpoints.0$$";fileLines.Add(fileLine);
fileLine=" $$endloop awardpoints$$";fileLines.Add(fileLine);
fileLine=" $$if (pointsrecorded !EQUALS \"0\")$$";fileLines.Add(fileLine);
fileLine=" $$if (awarddef.weighted EQUALS \"Y\")$$";fileLines.Add(fileLine);
fileLine=" $$loopcommand=\"loop row as awardpoints index as awardpointsindex select coalesce(cast(sum(score)as float)/cast(count(score)as float),'-9999999') as awardscore,playername from view_awardpoints where awardindex='%%awarddef.awardindex%%' group by playerindex order by awardscore desc limit 1\"$$";fileLines.Add(fileLine);
fileLine=" $$else$$";fileLines.Add(fileLine);
fileLine=" $$loopcommand=\"loop row as awardpoints index as awardpointsindex select sum(score) as awardscore,playername from view_awardpoints where awardindex='%%awarddef.awardindex%%' group by playerindex order by awardscore desc limit 1\"$$";fileLines.Add(fileLine);
fileLine=" $$endif$$";fileLines.Add(fileLine);
fileLine=" $$%%loopcommand%%$$";fileLines.Add(fileLine);
fileLine=" $$MessageCentre(\"AWARD%%awarddef.id%%\",awardpoints.playername,awardpoints.awardscore)$$";fileLines.Add(fileLine);
fileLine=" $$endloop awardpoints$$";fileLines.Add(fileLine);
fileLine=" $$endif$$";fileLines.Add(fileLine);
fileLine="$$endloop awarddef$$";fileLines.Add(fileLine);
ExportTemplateFile(directory,fileLines,"quickawards.html");
fileLines.Clear();
fileLine="$$loop row as player index as playerindex select * from view_player order by %%sortkey%% desc limit 1$$";fileLines.Add(fileLine);
fileLine="$$MessageCentre(messagecentrekey,player.name,player.%%sortkey%%)$$";fileLines.Add(fileLine);
fileLine="$$endloop$$";fileLines.Add(fileLine);
ExportTemplateFile(directory,fileLines,"quickplayerlists.html");
fileLines.Clear();
fileLine="$$loop row as xptype index as xptypeindex select * from xp$$";fileLines.Add(fileLine);
fileLine="$$updatestatus(\"xp %%xptype.id%%\")$$$$openfile xp_%%xptype.id%%.html$$";fileLines.Add(fileLine);
fileLine="$$messagecentrekey=\"TopXP%%xptype.id%%\"$$";fileLines.Add(fileLine);
fileLine="$$loop row as xptotal index as xptotalindex select * from view_xptotalpoints where pointsindex='%%xptype.idx%%' order by points desc limit 1$$";fileLines.Add(fileLine);
fileLine="$$MessageCentre(messagecentrekey,xptotal.playername,formatfloat(\"%.3f\",xptotal.points))$$";fileLines.Add(fileLine);
fileLine="$$endloop$$";fileLines.Add(fileLine);
fileLine="$$endloop xptype$$";fileLines.Add(fileLine);
ExportTemplateFile(directory,fileLines,"quickxplists.html");
}