diff --git a/src/db/Db2DbiXX.cpp b/src/db/Db2DbiXX.cpp
index 237708e..258eceb 100644
--- a/src/db/Db2DbiXX.cpp
+++ b/src/db/Db2DbiXX.cpp
@@ -283,6 +283,14 @@ void Db2DbiXX::addHarvester(int second, const std::string &player1, const std::s
DebugMessage("addHarvester");
}
+void Db2DbiXX::addGenericTeamEvent(int second, int team, int amount, const std::string &gametype, const std::string &player1, const std::string &player2, int event, int generic1) {
+ if(!isok)
+ return;
+ *sql << "INSERT INTO oastat_team_events(gamenumber,second,team,player,player2,eventtype,amount,generic1,gametype) VALUES (?,?,?,?,?,?,?,?,?)",
+ gamenumber,second,team,getPlayerId(player1),getPlayerId(player2),event,amount,generic1, gametype,exec();
+ DebugMessage("addGenericTeamEvent");
+}
+
void Db2DbiXX::addChallenge(int second, const std::string &player, int challenge, int amount)
{
if(!isok)
diff --git a/src/db/Db2DbiXX.hpp b/src/db/Db2DbiXX.hpp
index 0bb5f4a..cf30acf 100644
--- a/src/db/Db2DbiXX.hpp
+++ b/src/db/Db2DbiXX.hpp
@@ -58,6 +58,7 @@ public:
void addHarvester(int second, const std::string &player1, const std::string &player2, int team, int event, int score);
void addChallenge(int second, const std::string &player, int challenge, int amount);
void addAccuracy(int second, const std::string &player, int type, int shotsFired, int shotsHit);
+ void addGenericTeamEvent(int second, int team, int amount, const std::string &gametype, const std::string &player1, const std::string &player2, int event, int generic1);
void doNotCommit();
private:
session *sql;
diff --git a/src/db/Db2Xml.cpp b/src/db/Db2Xml.cpp
index 2d0fd48..4043c77 100644
--- a/src/db/Db2Xml.cpp
+++ b/src/db/Db2Xml.cpp
@@ -230,6 +230,22 @@ void Db2Xml::addHarvester(int second, const std::string &player1, const std::str
p_xmlcontent += (boost::format(" %1%\n") % score).str();
p_xmlcontent += " \n";
}
+
+void Db2Xml::addGenericTeamEvent(int second, int team, int amount, const std::string &gametype, const std::string &player1, const std::string &player2, int event, int generic1) {
+ if(!isOk)
+ return;
+ p_xmlcontent += " \n";
+ p_xmlcontent += (boost::format(" %1%\n") % second).str();
+ p_xmlcontent += (boost::format(" %1%\n") % team).str();
+ p_xmlcontent += (boost::format(" %1%\n") % amount).str();
+ p_xmlcontent += (boost::format(" %1%\n") % gametype).str();
+ p_xmlcontent += (boost::format(" %1%\n") % player1).str();
+ p_xmlcontent += (boost::format(" %1%\n") % player2).str();
+ p_xmlcontent += (boost::format(" %1%\n") % event).str();
+ p_xmlcontent += (boost::format(" %1%\n") % generic1).str();
+ p_xmlcontent += " \n";
+}
+
void Db2Xml::addChallenge(int second, const std::string &player, int challenge, int amount)
{
if(!isOk)
diff --git a/src/db/Db2Xml.hpp b/src/db/Db2Xml.hpp
index 2fbb1db..40fc19d 100644
--- a/src/db/Db2Xml.hpp
+++ b/src/db/Db2Xml.hpp
@@ -61,6 +61,7 @@ public:
void addHarvester(int second, const std::string &player1, const std::string &player2, int team, int event, int score);
void addChallenge(int second, const std::string &player, int challenge, int amount);
void addAccuracy(int second, const std::string &player, int type, int shotsFired, int shotsHit);
+ void addGenericTeamEvent(int second, int team, int amount, const std::string &gametype, const std::string &player1, const std::string &player2, int event, int generic1);
void doNotCommit();
private:
string p_output_dir;
diff --git a/src/db/database.hpp b/src/db/database.hpp
index 9390823..8419478 100644
--- a/src/db/database.hpp
+++ b/src/db/database.hpp
@@ -213,6 +213,19 @@ public:
* @param shotsHit Number of hits
*/
virtual void addAccuracy(int second, const std::string &player, int type, int shotsFired, int shotsHit) = 0;
+
+ /**
+ * adds a generic team event. Can be used then extending for mods.
+ * @param second Time the information was given. Usually not logged as the information is for the whole match
+ * @param team the team from the logging event
+ * @param amount Event dependent
+ * @param gametype Name of the gametype that this log message is for
+ * @param player1 Player guid of the first player in the event. Blank string if none
+ * @param player2 Player guid of the second player in the event. Blank if none
+ * @param event The event type. Should be unique for each gametype.
+ * @param generic1 A generic value. Can be used for different values needed for some events.
+ */
+ virtual void addGenericTeamEvent(int second, int team, int amount, const std::string &gametype, const std::string &player1, const std::string &player2, int event, int generic1) = 0;
};
#endif //_DATABASE_H
diff --git a/src/oastat.cpp b/src/oastat.cpp
index fefd80a..a384ca0 100644
--- a/src/oastat.cpp
+++ b/src/oastat.cpp
@@ -209,6 +209,7 @@ int main (int argc, const char* argv[])
string filename = "";
string backend = "Xml";
bool useTail = false;
+ bool doIntegrationTest = false;
vector > commands;
/////////////
//dbargs = "mysql dbname oastat";
@@ -219,25 +220,29 @@ int main (int argc, const char* argv[])
for(int i=1; istartGame(1,"oasago2","baseoa-mod","testserver",oss_test);
+ db->addGenericTeamEvent(5,2,0,"sometype","","",3,4);
+ cerr << "Test called" << endl;
+ return 1;
+ }
+
if(filename.length()>0)
{
if(useTail)