Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bool Client::TradeskillLoreCheck(DBTradeskillRecipe_Struct *spec) {
- uint8 conflicts = 0;
- uint8 resolved = 0;
- //pull the list of components
- std::string query = StringFormat("SELECT tre.item_id "
- "FROM tradeskill_recipe_entries AS tre "
- "WHERE tre.componentcount > 0 AND tre.recipe_id = %u",
- spec->recipe_id);
- auto results = database.QueryDatabase(query);
- if (!results.Success()) {
- return false; //Error in query
- }
- if (!results.RowCount()) {
- return false; //no components..
- }
- std::vector< std::pair<uint32, uint8> >::iterator itr;
- const Item_Struct* item = nullptr;
- const Item_Struct* item_comp = nullptr;
- itr = spec->onsuccess.begin();
- while (itr != spec->onsuccess.end() && !spec->quest) {
- item = database.GetItem(itr->first);
- if (item && CheckLoreConflict(item)) { //This item is lore!
- conflicts++;
- for (auto row = results.begin(); row != results.end(); ++row) {
- //todo.. fix this shit..
- item_comp = database.GetItem(atoi(row[0]));
- if(atoi(row[0]) == item->ID) {
- resolved++; //Item crafted is lore but returned...
- break;
- }
- else if (item_comp && item_comp->LoreGroup > 0 && item_comp->LoreGroup == item->LoreGroup) {
- resolved++; //Item crafted is in a Loregroup but we are using that Loregroupitem to craft this shit
- break;
- }
- }
- }
- ++itr;
- }
- if (conflicts > resolved) {
- Message_StringID(MT_Emote, TRADESKILL_LORE, item->Name);
- return true;
- }
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement