Add item links and small refinements

- compose and send a gray item link when selling
- use DestroyItem on a targeted bag slot rather than DestroyItemCount that searches player inventory/bank/etc
- refine wording slightly
This commit is contained in:
KJack
2023-05-18 02:25:56 -04:00
parent ce01d81a0c
commit 8a0bd29b75

View File

@@ -13,7 +13,7 @@ public:
{ {
SendTransactionInformation(player, item, count); SendTransactionInformation(player, item, count);
player->ModifyMoney(item->GetTemplate()->SellPrice * count); player->ModifyMoney(item->GetTemplate()->SellPrice * count);
player->DestroyItemCount(item, count, true); player->DestroyItem(item->GetBagSlot(), item->GetSlot(), true);
} }
} }
@@ -23,7 +23,7 @@ private:
std::string name; std::string name;
if (count > 1) if (count > 1)
{ {
name = Acore::StringFormat("[%s] x %i", item->GetTemplate()->Name1, count); name = Acore::StringFormat("[%s]x%i", item->GetTemplate()->Name1, count);
} }
else else
{ {
@@ -35,39 +35,41 @@ private:
uint32 silver = (money % GOLD) / SILVER; uint32 silver = (money % GOLD) / SILVER;
uint32 copper = (money % GOLD) % SILVER; uint32 copper = (money % GOLD) % SILVER;
std::string itemLink = Acore::StringFormat("|cff9d9d9d|Hitem:%i::::::::80:::::|h%s|h|r", item->GetTemplate()->ItemId, name);
std::string info; std::string info;
if (money < SILVER) if (money < SILVER)
{ {
info = Acore::StringFormat("%s was sold for %i copper.", name, copper); info = Acore::StringFormat("%s sold for %i copper.", itemLink, copper);
} }
else if (money < GOLD) else if (money < GOLD)
{ {
if (copper > 0) if (copper > 0)
{ {
info = Acore::StringFormat("%s was sold for %i silver and %i copper.", name, silver, copper); info = Acore::StringFormat("%s sold for %i silver and %i copper.", itemLink, silver, copper);
} }
else else
{ {
info = Acore::StringFormat("%s was sold for %i silver.", name, silver); info = Acore::StringFormat("%s sold for %i silver.", itemLink, silver);
} }
} }
else else
{ {
if (copper > 0 && silver > 0) if (copper > 0 && silver > 0)
{ {
info = Acore::StringFormat("%s was sold for %i gold, %i silver and %i copper.", name, gold, silver, copper); info = Acore::StringFormat("%s sold for %i gold, %i silver and %i copper.", itemLink, gold, silver, copper);
} }
else if (copper > 0) else if (copper > 0)
{ {
info = Acore::StringFormat("%s was sold for %i gold and %i copper.", name, gold, copper); info = Acore::StringFormat("%s sold for %i gold and %i copper.", itemLink, gold, copper);
} }
else if (silver > 0) else if (silver > 0)
{ {
info = Acore::StringFormat("%s was sold for %i gold and %i silver.", name, gold, silver); info = Acore::StringFormat("%s sold for %i gold and %i silver.", itemLink, gold, silver);
} }
else else
{ {
info = Acore::StringFormat("%s was sold for %i gold.", name, gold); info = Acore::StringFormat("%s sold for %i gold.", itemLink, gold);
} }
} }