mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-19 13:28:25 +00:00
Work on implementing salvage
This commit is contained in:
+31
-2
@@ -1060,6 +1060,18 @@ bool Client::TradeskillExecute(DBTradeskillRecipe_Struct *spec) {
|
||||
SummonItem(itr->first, itr->second);
|
||||
itr++;
|
||||
}
|
||||
|
||||
// Rolls on each item, is possible to return everything
|
||||
int SalvageChance = aabonuses.SalvageChance + itembonuses.SalvageChance + spellbonuses.SalvageChance;
|
||||
if(SalvageChance) {
|
||||
itr = spec->onsalvage.begin();
|
||||
while(itr != spec->onsalvage.end()) {
|
||||
if(MakeRandomInt(0,99) < SalvageChance)
|
||||
SummonItem(itr->first, itr->second);
|
||||
itr++;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return(false);
|
||||
}
|
||||
@@ -1404,8 +1416,25 @@ bool ZoneDatabase::GetTradeRecipe(uint32 recipe_id, uint8 c_type, uint32 some_id
|
||||
}
|
||||
mysql_free_result(result);
|
||||
}
|
||||
safe_delete_array(query);
|
||||
|
||||
|
||||
// Pull the salvage list
|
||||
qlen = MakeAnyLenString(&query, "SELECT item_id,salvagecount FROM tradeskill_recipe_entries"
|
||||
" WHERE salvagecount>0 AND recipe_id=%u", recipe_id);
|
||||
|
||||
spec->onsalvage.clear();
|
||||
if (RunQuery(query, qlen, errbuf, &result)) {
|
||||
qcount = mysql_num_rows(result);
|
||||
uint8 r;
|
||||
for(r = 0; r < qcount; r++) {
|
||||
row = mysql_fetch_row(result);
|
||||
uint32 item = (uint32)atoi(row[0]);
|
||||
uint8 num = (uint8)atoi(row[1]);
|
||||
spec->onsalvage.push_back(pair<uint32,uint8>(item, num));
|
||||
}
|
||||
mysql_free_result(result);
|
||||
}
|
||||
safe_delete_array(query);
|
||||
|
||||
return(true);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user