QueryResult result = CharacterDatabase.PQuery(“SELECT GUID, FakeEntry FROM custom_transmogrification WHERE Owner = %u”, playerGUID);
if (result)
{
do
{
uint32 itemGUID = (*result)[0].GetUInt32();
uint32 fakeEntry = (*result)[1].GetUInt32();
} while (result->NextRow());
}
case GOSSIP_ACTION_INFO_DEF+1:
QueryResult result = WorldDatabase.PQuery(“SELECT code FROM landro_redeem_codes WHERE code = %u AND USED = 0”, code);
if (!result)
{
//Read comment in enum
creature->AI()->Talk(SAY_WRONG);
creature->CastSpell(player, SPELL_POLYMORPH, true);
sLog->outInfo(LOG_FILTER_SERVER_LOADING, “Player entered wrong redeem code! Entered code is: %u”, code);
}
else
And also, if in game i’ll enter something like 456, console returns random value (in sLog->outInfo)
uint32 codeUINT = (uint32)atol(code);
if(!codeINT)
return; // send error about invalid value inserted
QueryResult result = WorldDatabase.PQuery(“SELECT code FROM landro_redeem_codes WHERE code = %u AND USED = 0”, codeUINT);
if (!result)
{
//Read comment in enum
creature->AI()->Talk(SAY_WRONG);
creature->CastSpell(player, SPELL_POLYMORPH, true);
sLog->outInfo(LOG_FILTER_SERVER_LOADING, “Player entered wrong redeem code! Entered code is: %u”, codeUINT);
}
Did not test. I do not know C++.
Btw, I think the logic is wrong.
You can basically insert anything to the field (34782628374842) and if it is not found from DB, you get the buff …
and since we are talking about uint32, thats a lot of keys you can use …