Recent Posts
C++ | 10 sec ago
None | 12 sec ago
CSS | 13 sec ago
Java 5 | 21 sec ago
None | 30 sec ago
Delphi | 36 sec ago
None | 40 sec ago
Lua | 57 sec ago
None | 1 min ago
C++ | 1 min ago
Free Subdomains
Want a pastebin.com sub-domain for your community?
learn more...
What is pastebin?
Pastebin is a website that hosts all your text & code on dedicated servers for easy sharing.
learn more...
By Anonymous on the 9th of Feb 2010 08:31:51 PM
Download |
Raw |
Embed |
Report
bool ChatHandler::HandleGoldCostCommand(const char* args, WorldSession *m_session)
{
char Query[512];
char entry[512];
uint32 ItemPrice;
uint32 gold, silver, copper;
if( sscanf(args, "%u %u", &entry, &gold))
{
ItemPrice = (gold * 10000);
}
if( sscanf(args, "%u %u %u", &entry, &gold, &silver) == 3)
{
ItemPrice = (gold * 10000) + (silver * 1000);
}
if( sscanf(args, "%u %u %u %u", &entry, &gold, &silver, &copper) == 4)
{
ItemPrice = (gold * 10000) + (silver * 1000) + copper;
}
string x = string(entry);
ASCENT_TOLOWER(x);
StorageContainerIterator<ItemPrototype> * itr = ItemPrototypeStorage.MakeIterator();
BlueSystemMessage(m_session, "Starting search of item `%s`...", x.c_str());
ItemPrototype * it;
while(!itr->AtEnd())
{
it = itr->Get();
if(FindXinYString(x, it->lowercase_name))
{
snprintf(Query, 512, "UPDATE items set goldcost %s where entry = %s", ItemPrice ,it->ItemId);
WorldDatabase.Execute(Query);
BlueSystemMessage(m_session, "Done!");
}
if(!itr->Inc())
break;
}
itr->Destruct();
return true;
}
Submit a correction or amendment below.
Make A New Post