[6840] Fixed displaying escaped GM ticket ingame

This commit is contained in:
arrai 2008-11-19 10:08:10 +01:00
parent 1e9464ea73
commit 59a5964b12
4 changed files with 12 additions and 9 deletions

View file

@ -27,7 +27,7 @@ namespace MaNGOS
{
inline uint32 hk_honor_at_level(uint32 level, uint32 count=1)
{
return ceil(count*(-0.53177f + 0.59357f * exp((level +23.54042f) / 26.07859f )));
return (uint32)ceil(count*(-0.53177f + 0.59357f * exp((level +23.54042f) / 26.07859f )));
}
}
namespace XP

View file

@ -64,8 +64,6 @@ void WorldSession::HandleGMTicketUpdateTextOpcode( WorldPacket & recv_data )
std::string ticketText;
recv_data >> ticketText;
CharacterDatabase.escape_string(ticketText);
if(GMTicket* ticket = ticketmgr.GetGMTicket(GetPlayer()->GetGUIDLow()))
ticket->SetText(ticketText.c_str());
else
@ -103,8 +101,6 @@ void WorldSession::HandleGMTicketCreateOpcode( WorldPacket & recv_data )
sLog.outDebug("TicketCreate: map %u, x %f, y %f, z %f, text %s, unk1 %u, unk2 %u", map, x, y, z, ticketText.c_str(), unk1, unk2);
CharacterDatabase.escape_string(ticketText);
if(ticketmgr.GetGMTicket(GetPlayer()->GetGUIDLow()))
{
WorldPacket data( SMSG_GMTICKET_CREATE, 4 );

View file

@ -50,7 +50,10 @@ class GMTicket
{
m_text = text ? text : "";
m_lastUpdate = time(NULL);
CharacterDatabase.PExecute("UPDATE character_ticket SET ticket_text = '%s' WHERE guid = '%u'", m_text.c_str(), m_guid);
std::string escapedString = m_text;
CharacterDatabase.escape_string(escapedString);
CharacterDatabase.PExecute("UPDATE character_ticket SET ticket_text = '%s' WHERE guid = '%u'", escapedString.c_str(), m_guid);
}
void DeleteFromDB() const
@ -62,7 +65,11 @@ class GMTicket
{
CharacterDatabase.BeginTransaction();
DeleteFromDB();
CharacterDatabase.PExecute("INSERT INTO character_ticket (guid, ticket_text) VALUES ('%u', '%s')", m_guid, GetText());
std::string escapedString = m_text;
CharacterDatabase.escape_string(escapedString);
CharacterDatabase.PExecute("INSERT INTO character_ticket (guid, ticket_text) VALUES ('%u', '%s')", m_guid, escapedString.c_str());
CharacterDatabase.CommitTransaction();
}
private:
@ -115,4 +122,4 @@ class GMTicketMgr
};
#define ticketmgr MaNGOS::Singleton<GMTicketMgr>::Instance()
#endif
#endif

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "6839"
#define REVISION_NR "6840"
#endif // __REVISION_NR_H__