Added a new Client::MakeItemLink() method that uses Item_Struct instead of ItemInst. Changed the way that NPC::QueryLoot() builds its links.

This commit is contained in:
Uleat
2014-12-25 00:00:57 -05:00
parent 8522542ae2
commit 15fbb722eb
3 changed files with 68 additions and 58 deletions
+17 -25
View File
@@ -500,36 +500,28 @@ void NPC::ClearItemList() {
itemlist.clear();
}
void NPC::QueryLoot(Client* to) {
int x = 0;
void NPC::QueryLoot(Client* to)
{
to->Message(0, "Coin: %ip %ig %is %ic", platinum, gold, silver, copper);
ItemList::iterator cur,end;
cur = itemlist.begin();
end = itemlist.end();
for(; cur != end; ++cur) {
int x = 0;
for(ItemList::iterator cur = itemlist.begin(); cur != itemlist.end(); ++cur, ++x) {
const Item_Struct* item = database.GetItem((*cur)->item_id);
if (item)
if (to->GetClientVersion() >= EQClientRoF2)
{
to->Message(0, "minlvl: %i maxlvl: %i %i: %c%06X00000000000000000000000000000000000000000000000000%s%c", (*cur)->min_level, (*cur)->max_level, (int)item->ID, 0x12, item->ID, item->Name, 0x12);
}
else if (to->GetClientVersion() >= EQClientRoF)
{
to->Message(0, "minlvl: %i maxlvl: %i %i: %c%06X0000000000000000000000000000000000000000000000000%s%c",(*cur)->min_level, (*cur)->max_level, (int) item->ID,0x12, item->ID, item->Name, 0x12);
}
else if (to->GetClientVersion() >= EQClientSoF)
{
to->Message(0, "minlvl: %i maxlvl: %i %i: %c%06X00000000000000000000000000000000000000000000%s%c",(*cur)->min_level, (*cur)->max_level, (int) item->ID,0x12, item->ID, item->Name, 0x12);
}
else
{
to->Message(0, "minlvl: %i maxlvl: %i %i: %c%06X000000000000000000000000000000000000000%s%c",(*cur)->min_level, (*cur)->max_level, (int) item->ID,0x12, item->ID, item->Name, 0x12);
}
else
if (item == nullptr) {
LogFile->write(EQEMuLog::Error, "Database error, invalid item");
x++;
continue;
}
char* itemLinkCore = nullptr;
std::string itemLink;
to->MakeItemLink(itemLinkCore, item);
itemLink = (itemLinkCore ? StringFormat("%c%s%s%c", 0x12, itemLinkCore, item->Name, 0x12) : "null");
to->Message(0, "%s, ID: %u, Level: (min: , max: )", itemLink.c_str(), item->ID, (*cur)->min_level, (*cur)->max_level);
safe_delete_array(itemLinkCore);
}
to->Message(0, "%i items on %s.", x, GetName());
}