2007 | | QueryResult *result = WorldDatabase.PQuery("SELECT entry FROM item_template WHERE itemset = %u",itemsetId); |
2008 | | |
2009 | | if(!result) |
| 2007 | bool found = false; |
| 2008 | for (uint32 id = 0; id < sItemStorage.MaxEntry; id++) |
| 2009 | { |
| 2010 | ItemPrototype const *pProto = sItemStorage.LookupEntry<ItemPrototype>(id); |
| 2011 | if (!pProto) |
| 2012 | continue; |
| 2013 | |
| 2014 | if (pProto->ItemSet == itemsetId) |
| 2015 | { |
| 2016 | found = true; |
| 2017 | ItemPosCountVec dest; |
| 2018 | uint8 msg = plTarget->CanStoreNewItem( NULL_BAG, NULL_SLOT, dest, pProto->ItemId, 1 ); |
| 2019 | if (msg == EQUIP_ERR_OK) |
| 2020 | { |
| 2021 | Item* item = plTarget->StoreNewItem( dest, pProto->ItemId, true); |
| 2022 | // remove binding (let GM give it to another player later) |
| 2023 | if (pl==plTarget) |
| 2024 | item->SetBinding( false ); |
| 2025 | |
| 2026 | pl->SendNewItem(item,1,false,true); |
| 2027 | if (pl!=plTarget) |
| 2028 | plTarget->SendNewItem(item,1,true,false); |
| 2029 | } |
| 2030 | else |
| 2031 | { |
| 2032 | pl->SendEquipError( msg, NULL, NULL ); |
| 2033 | PSendSysMessage(LANG_ITEM_CANNOT_CREATE, pProto->ItemId, 1); |
| 2034 | } |
| 2035 | } |
| 2036 | } |
| 2037 | |
| 2038 | if (!found) |
2016 | | |
2017 | | do |
2018 | | { |
2019 | | Field *fields = result->Fetch(); |
2020 | | uint32 itemId = fields[0].GetUInt32(); |
2021 | | |
2022 | | ItemPosCountVec dest; |
2023 | | uint8 msg = plTarget->CanStoreNewItem( NULL_BAG, NULL_SLOT, dest, itemId, 1 ); |
2024 | | if( msg == EQUIP_ERR_OK ) |
2025 | | { |
2026 | | Item* item = plTarget->StoreNewItem( dest, itemId, true); |
2027 | | |
2028 | | // remove binding (let GM give it to another player later) |
2029 | | if(pl==plTarget) |
2030 | | item->SetBinding( false ); |
2031 | | |
2032 | | pl->SendNewItem(item,1,false,true); |
2033 | | if(pl!=plTarget) |
2034 | | plTarget->SendNewItem(item,1,true,false); |
2035 | | } |
2036 | | else |
2037 | | { |
2038 | | pl->SendEquipError( msg, NULL, NULL ); |
2039 | | PSendSysMessage(LANG_ITEM_CANNOT_CREATE, itemId, 1); |
2040 | | } |
2041 | | |
2042 | | }while( result->NextRow() ); |
2043 | | |
2044 | | delete result; |
2045 | | |
4768 | | QueryResult *result = WorldDatabase.PQuery("SELECT entry FROM item_template WHERE startquest = '%u' LIMIT 1",entry); |
4769 | | if(result) |
4770 | | { |
4771 | | Field* fields = result->Fetch(); |
4772 | | uint32 item_id = fields[0].GetUInt32(); |
4773 | | delete result; |
4774 | | |
4775 | | PSendSysMessage(LANG_COMMAND_QUEST_STARTFROMITEM, entry,item_id); |
4776 | | SetSentErrorMessage(true); |
4777 | | return false; |
| 4767 | for (uint32 id = 0; id < sItemStorage.MaxEntry; id++) |
| 4768 | { |
| 4769 | ItemPrototype const *pProto = sItemStorage.LookupEntry<ItemPrototype>(id); |
| 4770 | if (!pProto) |
| 4771 | continue; |
| 4772 | |
| 4773 | if (pProto->StartQuest == entry) |
| 4774 | { |
| 4775 | PSendSysMessage(LANG_COMMAND_QUEST_STARTFROMITEM, entry, pProto->ItemId); |
| 4776 | SetSentErrorMessage(true); |
| 4777 | return false; |
| 4778 | } |