Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bool Farming::hasFarmPoints(Player * player, bool IsPriced, uint32 addpoints, uint32 points)
- {
- QueryResult result;
- result = WorldDatabase.PQuery("SELECT points FROM farmer_points WHERE guid='%u' LIMIT 1", player->GetGUID());
- if(!result)
- return false;
- uint32 currentpoints;
- if(result)
- {
- do
- {
- Field * fields = result->Fetch();
- currentpoints = fields[0].GetInt32();
- if(currentpoints > points)
- {
- if(IsPriced == true)// Here if it is true we will add the points
- WorldDatabase.PQuery("UPDATE farmer_points SET points='%u' WHERE (guid='%u') LIMIT 1", currentpoints + addpoints, player->GetGUID());
- else// Else, we will take the points
- WorldDatabase.PQuery("UPDATE farmer_points SET points='%u' WHERE (guid='%u') LIMIT 1", currentpoints - points, player->GetGUID());
- }
- else
- {
- Notice(player, "You don't have enough farm points!", MSG_COLOR_RED);
- return false;
- }
- }while(result->NextRow());
- }
- return true;
- }
Add Comment
Please, Sign In to add comment