1
0

Assure the db entry of the byproduct is valid to use

This commit is contained in:
Emagi 2025-03-13 06:48:12 -04:00
parent 2c49d9c76e
commit c4c96904d1

View File

@ -490,12 +490,15 @@ void TradeskillMgr::StopCrafting(Client* client, bool lock) {
item->creator = std::string(client->GetPlayer()->GetName());
client->AddItem(item);
if(byproduct_itemid) {
Item* byproductItem = new Item(master_item_list.GetItem(byproduct_itemid));
byproductItem->creator = std::string(client->GetPlayer()->GetName());
byproductItem->details.count = byproduct_qty;
client->Message(CHANNEL_COLOR_CHAT_RELATIONSHIP, "You received %s as a byproduct.", byproductItem->CreateItemLink(client->GetVersion()).c_str());
client->AddItem(byproductItem);
client->GetPlayer()->CheckQuestsCraftUpdate(byproductItem, byproduct_qty);
Item* byproduct = master_item_list.GetItem(byproduct_itemid);
if(byproduct) {
Item* byproductItem = new Item(byproduct);
byproductItem->creator = std::string(client->GetPlayer()->GetName());
byproductItem->details.count = byproduct_qty;
client->Message(CHANNEL_COLOR_CHAT_RELATIONSHIP, "You received %s as a byproduct.", byproductItem->CreateItemLink(client->GetVersion()).c_str());
client->AddItem(byproductItem);
client->GetPlayer()->CheckQuestsCraftUpdate(byproductItem, byproduct_qty);
}
}
//Check for crafting quest updates
int8 update_amt = 0;