aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Globals/ObjectMgr.cpp
diff options
context:
space:
mode:
authorsilinoron <none@none>2010-08-29 20:28:14 -0700
committersilinoron <none@none>2010-08-29 20:28:14 -0700
commit08205afcc94045c8d74ee4283821db68c5333b1d (patch)
tree2d3eff04fe18a1985d08708ed1d79d0a119c4cc6 /src/server/game/Globals/ObjectMgr.cpp
parent1f9936399c6fbd2fe723f1d2e9ceacf463a24f52 (diff)
Rewrite much of the GM ticket system
* Extract storage and manipulation of tickets to TicketMgr (from ObjectMgr) * Extract ticket commands to TicketCommands.cpp * Adds support for sending GM responses and GM surveys. * Fix structure of several ticket-related packets. * Add support for understanding lag reports. * Thanks Zor for some of the packet structures, and Cyrax for some sniffs * Please report any issues encountered via the tracker. --HG-- branch : trunk
Diffstat (limited to 'src/server/game/Globals/ObjectMgr.cpp')
-rw-r--r--src/server/game/Globals/ObjectMgr.cpp123
1 files changed, 0 insertions, 123 deletions
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp
index aecf48a4f1a..e9fec505d22 100644
--- a/src/server/game/Globals/ObjectMgr.cpp
+++ b/src/server/game/Globals/ObjectMgr.cpp
@@ -8816,129 +8816,6 @@ Quest const* GetQuestTemplateStore(uint32 entry)
return sObjectMgr.GetQuestTemplate(entry);
}
-uint64 ObjectMgr::GenerateGMTicketId()
-{
- return ++m_GMticketid;
-}
-
-void ObjectMgr::LoadGMTickets()
-{
- if (!m_GMTicketList.empty())
- {
- for (GmTicketList::const_iterator itr = m_GMTicketList.begin(); itr != m_GMTicketList.end(); ++itr)
- delete *itr;
- }
- m_GMTicketList.clear();
- m_GMticketid = 0;
-
- QueryResult_AutoPtr result = CharacterDatabase.Query("SELECT guid, playerGuid, name, message, createtime, map, posX, posY, posZ, timestamp, closed, assignedto, comment FROM gm_tickets");
-
- if (!result)
- {
- barGoLink bar(1);
- bar.step();
- sLog.outString();
- sLog.outString(">> GM Tickets table is empty, no tickets were loaded.");
- return;
- }
-
- uint16 count = 0;
- barGoLink bar ((*result).GetRowCount());
- GM_Ticket *ticket;
- do
- {
- Field *fields = result->Fetch();
- ticket = new GM_Ticket;
- ticket->guid = fields[0].GetUInt64();
- ticket->playerGuid = fields[1].GetUInt64();
- ticket->name = fields[2].GetCppString();
- ticket->message = fields[3].GetCppString();
- ticket->createtime = fields[4].GetUInt64();
- ticket->map = fields[5].GetUInt32();
- ticket->pos_x = fields[6].GetFloat();
- ticket->pos_y = fields[7].GetFloat();
- ticket->pos_z = fields[8].GetFloat();
- ticket->timestamp = fields[9].GetUInt64();
- ticket->closed = fields[10].GetUInt64();
- ticket->assignedToGM = fields[11].GetUInt64();
- ticket->comment = fields[12].GetCppString();
- ++count;
- bar.step();
-
- m_GMTicketList.push_back(ticket);
-
- } while (result->NextRow());
-
- result = CharacterDatabase.Query("SELECT MAX(guid) from gm_tickets");
-
- if (result)
- {
- Field *fields = result->Fetch();
- m_GMticketid = fields[0].GetUInt64();
- }
-
- sLog.outString(">> Loaded %u GM Tickets from the database.", count);
-}
-
-void ObjectMgr::AddOrUpdateGMTicket(GM_Ticket &ticket, bool create)
-{
- if (create)
- m_GMTicketList.push_back(&ticket);
-
- _AddOrUpdateGMTicket(ticket);
-}
-
-void ObjectMgr::_AddOrUpdateGMTicket(GM_Ticket &ticket)
-{
- std::string msg(ticket.message), name(ticket.name), comment(ticket.comment);
- CharacterDatabase.escape_string(msg);
- CharacterDatabase.escape_string(name);
- CharacterDatabase.escape_string(comment);
- std::ostringstream ss;
- ss << "REPLACE INTO gm_tickets (guid, playerGuid, name, message, createtime, map, posX, posY, posZ, timestamp, closed, assignedto, comment) VALUES('";
- ss << ticket.guid << "', '";
- ss << ticket.playerGuid << "', '";
- ss << name << "', '";
- ss << msg << "', '" ;
- ss << ticket.createtime << "', '";
- ss << ticket.map << "', '";
- ss << ticket.pos_x << "', '";
- ss << ticket.pos_y << "', '";
- ss << ticket.pos_z << "', '";
- ss << ticket.timestamp << "', '";
- ss << ticket.closed << "', '";
- ss << ticket.assignedToGM << "', '";
- ss << comment << "');";
-
- SQLTransaction trans = CharacterDatabase.BeginTransaction();
- trans->Append(ss.str().c_str());
- CharacterDatabase.CommitTransaction(trans);
-}
-
-void ObjectMgr::RemoveGMTicket(GM_Ticket *ticket, int64 source, bool permanently)
-{
- for (GmTicketList::iterator i = m_GMTicketList.begin(); i != m_GMTicketList.end(); ++i)
- if ((*i)->guid == ticket->guid)
- {
- if (permanently)
- {
- CharacterDatabase.PExecute("DELETE FROM gm_tickets WHERE guid = '%u'", ticket->guid);
- i = m_GMTicketList.erase(i);
- ticket = NULL;
- return;
- }
- (*i)->closed = source;
- _AddOrUpdateGMTicket(*(*i));
- }
-}
-
-void ObjectMgr::RemoveGMTicket(uint64 ticketGuid, int64 source, bool permanently)
-{
- GM_Ticket *ticket = GetGMTicket(ticketGuid);
- ASSERT(ticket);
- RemoveGMTicket(ticket, source, permanently);
-}
-
CreatureBaseStats const* ObjectMgr::GetCreatureBaseStats(uint8 level, uint8 unitClass)
{
CreatureBaseStatsMap::const_iterator it = m_creatureBaseStatsMap.find(MAKE_PAIR16(level,unitClass));