diff --git a/zone/client.h b/zone/client.h
index b9a2c6d30..5730cae86 100644
--- a/zone/client.h
+++ b/zone/client.h
@@ -815,6 +815,7 @@ public:
void SetStats(uint8 type,int16 set_val);
void IncStats(uint8 type,int16 increase_val);
void DropItem(int16 slot_id);
+ bool MakeItemLink(char* &ret_link, const Item_Struct* item, uint32 aug0=0, uint32 aug1=0, uint32 aug2=0, uint32 aug3=0, uint32 aug4=0, uint32 aug5=0);
bool MakeItemLink(char* &ret_link, const ItemInst* inst);
int GetItemLinkHash(const ItemInst* inst);
void SendItemLink(const ItemInst* inst, bool sendtoall=false);
diff --git a/zone/inventory.cpp b/zone/inventory.cpp
index e6f4b00b6..80d48309c 100644
--- a/zone/inventory.cpp
+++ b/zone/inventory.cpp
@@ -1027,23 +1027,22 @@ void Client::MoveItemCharges(ItemInst &from, int16 to_slot, uint8 type)
}
}
-bool Client::MakeItemLink(char* &ret_link, const ItemInst *inst) {
+bool Client::MakeItemLink(char* &ret_link, const Item_Struct *item, uint32 aug0, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5) {
//we're sending back the entire "link", minus the null characters & item name
//that way, we can use it for regular links & Task links
//note: initiator needs to pass us ret_link
-/*
+ /*
--- Usage ---
Chat: "%c" "%s" "%s" "%c", 0x12, ret_link, inst->GetItem()->name, 0x12
Task: "" "%s" "", ret_link, inst->GetItem()->name
- Master's Book of Wood Elven Culture
- http://eqitems.13th-floor.org/phpBB2/viewtopic.php?p=510#510
-*/
+ Master's Book of Wood Elven Culture
+ http://eqitems.13th-floor.org/phpBB2/viewtopic.php?p=510#510
+ */
- if (!inst) //have to have an item to make the link
+ if (!item) //have to have an item to make the link
return false;
- const Item_Struct* item = inst->GetItem();
//format:
//0 itemid aug1 aug2 aug3 aug4 aug5 evolving? loregroup evolved level hash
//0 00000 00000 00000 00000 00000 00000 0 0000 0 00000000
@@ -1057,16 +1056,18 @@ bool Client::MakeItemLink(char* &ret_link, const ItemInst *inst) {
//int hash = GetItemLinkHash(inst); //eventually this will work (currently crashes zone), but for now we'll skip the extra overhead
if (GetClientVersion() >= EQClientRoF2)
{
- MakeAnyLenString(&ret_link, "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%01X" "%1X" "%04X" "%1X" "%05X" "%08X",
+ MakeAnyLenString(&ret_link, "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%1X" "%04X" "%1X" "%05X" "%08X",
0,
item->ID,
- inst->GetAugmentItemID(0),
- inst->GetAugmentItemID(1),
- inst->GetAugmentItemID(2),
- inst->GetAugmentItemID(3),
- inst->GetAugmentItemID(4),
- inst->GetAugmentItemID(5),
+ aug0,
+ aug1,
+ aug2,
+ aug3,
+ aug4,
+ aug5,
+ //0, this, or below, needs to be activated..not sure which yet
evolving,
+ //0, this, or above, needs to be activated..not sure which yet
loregroup,
evolvedlevel,
0,
@@ -1078,56 +1079,72 @@ bool Client::MakeItemLink(char* &ret_link, const ItemInst *inst) {
MakeAnyLenString(&ret_link, "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%1X" "%05X" "%08X",
0,
item->ID,
- inst->GetAugmentItemID(0),
- inst->GetAugmentItemID(1),
- inst->GetAugmentItemID(2),
- inst->GetAugmentItemID(3),
- inst->GetAugmentItemID(4),
- inst->GetAugmentItemID(5),
+ aug0,
+ aug1,
+ aug2,
+ aug3,
+ aug4,
+ aug5,
evolving,
loregroup,
evolvedlevel,
0,
hash
- );
+ );
}
else if (GetClientVersion() >= EQClientSoF)
{
MakeAnyLenString(&ret_link, "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%1X" "%05X" "%08X",
0,
item->ID,
- inst->GetAugmentItemID(0),
- inst->GetAugmentItemID(1),
- inst->GetAugmentItemID(2),
- inst->GetAugmentItemID(3),
- inst->GetAugmentItemID(4),
+ aug0,
+ aug1,
+ aug2,
+ aug3,
+ aug4,
evolving,
loregroup,
evolvedlevel,
0,
hash
- );
+ );
}
else
{
MakeAnyLenString(&ret_link, "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%1X" "%08X",
0,
item->ID,
- inst->GetAugmentItemID(0),
- inst->GetAugmentItemID(1),
- inst->GetAugmentItemID(2),
- inst->GetAugmentItemID(3),
- inst->GetAugmentItemID(4),
+ aug0,
+ aug1,
+ aug2,
+ aug3,
+ aug4,
evolving,
loregroup,
evolvedlevel,
hash
- );
+ );
}
return true;
}
+bool Client::MakeItemLink(char* &ret_link, const ItemInst *inst) {
+ if (!inst)
+ return false;
+
+ return MakeItemLink(
+ ret_link,
+ inst->GetItem(),
+ inst->GetAugmentItemID(0),
+ inst->GetAugmentItemID(1),
+ inst->GetAugmentItemID(2),
+ inst->GetAugmentItemID(3),
+ inst->GetAugmentItemID(4),
+ inst->GetAugmentItemID(5)
+ );
+}
+
int Client::GetItemLinkHash(const ItemInst* inst) {
//pre-Titanium: http://eqitems.13th-floor.org/phpBB2/viewtopic.php?t=70&postdays=0&postorder=asc
//Titanium: http://eqitems.13th-floor.org/phpBB2/viewtopic.php?t=145
diff --git a/zone/npc.cpp b/zone/npc.cpp
index d52365f72..af8a013a3 100644
--- a/zone/npc.cpp
+++ b/zone/npc.cpp
@@ -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());
}