summaryrefslogtreecommitdiff
path: root/utils/tfstats/weaponawards.cpp
diff options
context:
space:
mode:
authorFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
committerFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
commit3bf9df6b2785fa6d951086978a3e66f49427166a (patch)
tree2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /utils/tfstats/weaponawards.cpp
downloadarchived-source-engine-2018-hl2-src-master.tar.xz
archived-source-engine-2018-hl2-src-master.zip
Diffstat (limited to 'utils/tfstats/weaponawards.cpp')
-rw-r--r--utils/tfstats/weaponawards.cpp231
1 files changed, 231 insertions, 0 deletions
diff --git a/utils/tfstats/weaponawards.cpp b/utils/tfstats/weaponawards.cpp
new file mode 100644
index 0000000..4467945
--- /dev/null
+++ b/utils/tfstats/weaponawards.cpp
@@ -0,0 +1,231 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose: Implementation of the Weapon Awards
+//
+// $Workfile: $
+// $Date: $
+//
+//------------------------------------------------------------------------------------------------------
+// $Log: $
+//
+// $NoKeywords: $
+//=============================================================================//
+#include "WeaponAwards.h"
+
+//------------------------------------------------------------------------------------------------------
+// Function: CWeaponAward::getWinner
+// Purpose: all weapon awards use this to generate their winners
+//------------------------------------------------------------------------------------------------------
+void CWeaponAward::getWinner()
+{
+ CEventListIterator it;
+
+ for (it=g_pMatchInfo->eventList()->begin(); it != g_pMatchInfo->eventList()->end(); ++it)
+ {
+ if ((*it)->getType()==CLogEvent::FRAG)
+ {
+ if (strcmp((*it)->getArgument(2)->getStringValue(),killtype)==0)
+ {
+ PID pid=(*it)->getArgument(0)->asPlayerGetPID();
+ accum[pid]++;
+ winnerID=pid;
+ fNoWinner=false;
+ }
+ }
+ }
+
+ map<PID,int>::iterator acc_it;
+
+ for (acc_it=accum.begin();acc_it!=accum.end();++acc_it)
+ {
+ int currID=(*acc_it).first;
+ if (accum[currID]>accum[winnerID])
+ winnerID=currID;
+ }
+}
+
+
+//------------------------------------------------------------------------------------------------------
+// Function: CAssaultCannonAward::noWinner
+// Purpose: writes out html indicating that no one won this award
+// Input: html - the html file to output to
+//------------------------------------------------------------------------------------------------------
+void CAssaultCannonAward::noWinner(CHTMLFile& html)
+{
+ html.write("No one was killed with the Assault Cannon during this match.");
+}
+
+//------------------------------------------------------------------------------------------------------
+// Function: CAssaultCannonAward::extendedinfo
+// Purpose: writes out html displaying extra information about the winning of this award
+// Input: html - the html file to output to
+//------------------------------------------------------------------------------------------------------
+void CAssaultCannonAward::extendedinfo(CHTMLFile& html)
+{
+ if (accum[winnerID]==1)
+ html.write("%s got 1 kill with the Assault Cannon!",winnerName.c_str());
+ else
+ html.write("%s got %li kills with the Assault Cannon!",winnerName.c_str(),accum[winnerID]);
+}
+
+//------------------------------------------------------------------------------------------------------
+// Function: CFlamethrowerAward::noWinner
+// Purpose: writes out html indicating that no one won this award
+// Input: html - the html file to output to
+//------------------------------------------------------------------------------------------------------
+void CFlamethrowerAward::noWinner(CHTMLFile& html)
+{
+ html.write("No one got torched during this match.");
+}
+
+//------------------------------------------------------------------------------------------------------
+// Function: CFlamethrowerAward::extendedinfo
+// Purpose: writes out html displaying extra information about the winning of this award
+// Input: html - the html file to output to
+//------------------------------------------------------------------------------------------------------
+void CFlamethrowerAward::extendedinfo(CHTMLFile& html)
+{
+ if (accum[winnerID]==1)
+ html.write("%s torched 1 person!",winnerName.c_str());
+ else
+ html.write("%s torched %li people!",winnerName.c_str(),accum[winnerID]);
+}
+
+//------------------------------------------------------------------------------------------------------
+// Function: CKnifeAward::noWinner
+// Purpose: writes out html indicating that no one won this award
+// Input: html - the html file to output to
+//------------------------------------------------------------------------------------------------------
+void CKnifeAward::noWinner(CHTMLFile& html)
+{
+ html.write("No one got knifed during this match.");
+}
+
+//------------------------------------------------------------------------------------------------------
+// Function: CKnifeAward::extendedinfo
+// Purpose: writes out html displaying extra information about the winning of this award
+// Input: html - the html file to output to
+//------------------------------------------------------------------------------------------------------
+void CKnifeAward::extendedinfo(CHTMLFile& html)
+{
+ if (accum[winnerID]==1)
+ html.write("%s backstabbed 1 person!",winnerName.c_str());
+ else
+ html.write("%s backstabbed %li people!",winnerName.c_str(),accum[winnerID]);
+}
+
+//------------------------------------------------------------------------------------------------------
+// Function: CRocketryAward::noWinner
+// Purpose: writes out html indicating that no one won this award
+// Input: html - the html file to output to
+//------------------------------------------------------------------------------------------------------
+void CRocketryAward::noWinner(CHTMLFile& html)
+{
+ html.write("No one was killed by a rocket during this match.");
+}
+
+//------------------------------------------------------------------------------------------------------
+// Function: CRocketryAward::extendedinfo
+// Purpose:
+// Input: html - the html file to output to
+//------------------------------------------------------------------------------------------------------
+void CRocketryAward::extendedinfo(CHTMLFile& html)
+{
+ if (accum[winnerID]==1)
+ html.write("%s rocketed 1 person to oblivion!",winnerName.c_str());
+ else
+ html.write("%s rocketed %li people to oblivion!",winnerName.c_str(),accum[winnerID]);
+}
+
+//------------------------------------------------------------------------------------------------------
+// Function: CGrenadierAward::noWinner
+// Purpose: writes out html indicating that no one won this award
+// Input: html - the html file to output to
+//------------------------------------------------------------------------------------------------------
+void CGrenadierAward::noWinner(CHTMLFile& html)
+{
+ html.write("No one was killed by a grenade during this match.");
+}
+
+//------------------------------------------------------------------------------------------------------
+// Function: CGrenadierAward::extendedinfo
+// Purpose: writes out html displaying extra information about the winning of this award
+// Input: html - the html file to output to
+//------------------------------------------------------------------------------------------------------
+void CGrenadierAward::extendedinfo(CHTMLFile& html)
+{
+ if (accum[winnerID]==1)
+ html.write("%s killed 1 person with a grenade!",winnerName.c_str());
+ else
+ html.write("%s got %li people with grenades!",winnerName.c_str(),accum[winnerID]);
+}
+
+//------------------------------------------------------------------------------------------------------
+// Function: CDemolitionsAward::noWinner
+// Purpose: writes out html indicating that no one won this award
+// Input: html - the html file to output to
+//------------------------------------------------------------------------------------------------------
+void CDemolitionsAward::noWinner(CHTMLFile& html)
+{
+ html.write("No one fell victim to a Detpack this match.");
+}
+
+//------------------------------------------------------------------------------------------------------
+// Function: CDemolitionsAward::extendedinfo
+// Purpose: writes out html displaying extra information about the winning of this award
+// Input: html - the html file to output to
+//------------------------------------------------------------------------------------------------------
+void CDemolitionsAward::extendedinfo(CHTMLFile& html)
+{
+ if (accum[winnerID]==1)
+ html.write("%s smeared 1 person with a detpack!",winnerName.c_str());
+ else
+ html.write("%s smeared %li people with detpacks!",winnerName.c_str(),accum[winnerID]);
+}
+
+//------------------------------------------------------------------------------------------------------
+// Function: CBiologicalWarfareAward::noWinner
+// Purpose: writes out html indicating that no one won this award
+// Input: html - the html file to output to
+//------------------------------------------------------------------------------------------------------
+void CBiologicalWarfareAward::noWinner(CHTMLFile& html)
+{
+ html.write("No one died of infection this match.");
+}
+
+//------------------------------------------------------------------------------------------------------
+// Function: CBiologicalWarfareAward::extendedinfo
+// Purpose: writes out html displaying extra information about the winning of this award
+// Input: html - the html file to output to
+//------------------------------------------------------------------------------------------------------
+void CBiologicalWarfareAward::extendedinfo(CHTMLFile& html)
+{
+ if (accum[winnerID]==1)
+ html.write("%s infected 1 person.",winnerName.c_str());
+ else
+ html.write("%li people succumbed to %s's disease.",accum[winnerID],winnerName.c_str());
+}
+
+//------------------------------------------------------------------------------------------------------
+// Function: CBestSentryAward::noWinner
+// Purpose: writes out html indicating that no one won this award
+// Input: html - the html file to output to
+//------------------------------------------------------------------------------------------------------
+void CBestSentryAward::noWinner(CHTMLFile& html)
+{
+ html.write("No sentries killed anyone this match.");
+}
+
+//------------------------------------------------------------------------------------------------------
+// Function: CBestSentryAward::extendedinfo
+// Purpose: writes out html displaying extra information about the winning of this award
+// Input: html - the html file to output to
+//------------------------------------------------------------------------------------------------------
+void CBestSentryAward::extendedinfo(CHTMLFile& html)
+{
+ if (accum[winnerID]==1)
+ html.write("%s got 1 person with a sentry gun!",winnerName.c_str());
+ else
+ html.write("%li people were killed by %s's well placed sentries.",accum[winnerID],winnerName.c_str());
+}
+