Thread Tools Display Modes
11-21-18, 09:10 PM   #1
outer1990
A Defias Bandit
Join Date: Nov 2018
Posts: 3
LF Gold trade announcer

Looking for a addon that announces how much gold i receive / lose to a certain person.

So it will pop up in /say chat

/say Trade with X(Character's name) was completed. Received X (Amount of gold)

/say Trade with X(Character's name) was completed. Lost X (Amount of gold)


I do not know if a addon exist or if it would be easy to make. Let me know. Thank you anyways
  Reply With Quote
11-22-18, 08:42 AM   #2
myrroddin
A Pyroguard Emberseer
 
myrroddin's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 1,240
I don't know of such an AddOn, but I can *ahem* say that printing the message to /say or any other channel will get annoying very quickly for everybody around you. It would be much better as a message to yourself.

Tradeskillmaster is extreme overkill for only this feature, but it does track gold trades in its Ledger tab, along with sales and auctions. TSM does a whole host of other things, but if you only want that one thing, maybe some other commenters can think of a specialized AddOn.
  Reply With Quote
11-22-18, 12:06 PM   #3
JDoubleU00
A Firelord
 
JDoubleU00's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 463
I would agree with myrroddin that it would get annoying quickly. This does not announce to a channel, but does track your money.

https://wowinterface.com/downloads/i...ntClassic.html

There are others similar to this, but this was the first one that came to mind.
__________________
Author of JWExpBar and JWRepBar.
  Reply With Quote
11-22-18, 03:23 PM   #4
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,892
If none of the suggested addons suit you and you can't find any others then maybe you can use this project as your first leap into addon writing.

A code example similar to what you are asking is at https://wow.gamepedia.com/User:Egingell/PLAYER_MONEY which could be a good help to your first project.
__________________
  Reply With Quote
11-22-18, 10:27 PM   #5
outer1990
A Defias Bandit
Join Date: Nov 2018
Posts: 3
Originally Posted by Xrystal View Post
If none of the suggested addons suit you and you can't find any others then maybe you can use this project as your first leap into addon writing.

A code example similar to what you are asking is at https://wow.gamepedia.com/User:Egingell/PLAYER_MONEY which could be a good help to your first project.
thanks this works! only problem is that i have add %t to say current targets name. Would rather have it automatically name the person in the trade but i do not think its possible . thank you!
  Reply With Quote
11-22-18, 11:00 PM   #6
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,892
You could look into the following to incoporate that feature

https://wow.gamepedia.com/TRADE_ACCEPT_UPDATE

https://wow.gamepedia.com/TRADE_SHOW

https://wow.gamepedia.com/API_GetUnitName


Of course if the other trade person targetted you first then it may not return a true value unless you make a point of targetting them yourself before completing the trade.


However, this event may help you identify when someone has requested trade with you with arg1 being the result of the string format ERR_TRADE_REQUEST_S where the first word is the other player's name.

The same event with arg1 being the result of the string format ERR_INITIATE_TRADE_S with the last value the players name will handle you trading with them.

https://wow.gamepedia.com/CHAT_MSG_SYSTEM
https://www.townlong-yak.com/framexm...balStrings.lua


It all depends on what is the important element to the functionality. And may take a little play about with those functions to find the best combination of code to make it work.
__________________
  Reply With Quote
11-22-18, 11:38 PM   #7
Kanegasi
A Molten Giant
 
Kanegasi's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2007
Posts: 666
I use UnitName("npc") to get the name of the trading target for my addon.

Lua Code:
  1. local f = CreateFrame("frame")
  2. function f.TRADE_SHOW()
  3.     local name, realm = UnitName("npc")
  4.     print(name..(realm and "-"..realm or "").." has opened a trade with me.")
  5. end
  6. f:RegisterEvent("TRADE_SHOW")
  7. f:SetScript("OnEvent", function(self, event, ...) self[event](...) end)

I got this from http://wowprogramming.com/docs/api_types#unitID before it was deleted.

Edit: It's been quite a while since I found/used that, so I had a look in Blizzard's TradeFrame.lua, they use it to set the other player's name in the window:

Lua Code:
  1. function TradeFrame_Update()
  2.     SetPortraitTexture(TradeFramePlayerPortrait, "player");
  3.     SetPortraitTexture(TradeFrameRecipientPortrait, "NPC");
  4.     TradeFramePlayerNameText:SetText(GetUnitName("player"));
  5.     TradeFrameRecipientNameText:SetText(GetUnitName("NPC"));
  6.     for i=1, MAX_TRADE_ITEMS, 1 do
  7.         TradeFrame_UpdateTargetItem(i);
  8.         TradeFrame_UpdatePlayerItem(i);
  9.     end
  10.     TradeHighlightRecipient:Hide();
  11.     TradeHighlightPlayer:Hide();
  12.     TradeHighlightPlayerEnchant:Hide();
  13.     TradeHighlightRecipientEnchant:Hide();
  14. end

UnitName is defined in the C portion of WoW's code, but GetUnitName is in UnitFrame.lua:

Lua Code:
  1. function GetUnitName(unit, showServerName)
  2.     local name, server = UnitName(unit);
  3.     local relationship = UnitRealmRelationship(unit);
  4.     if ( server and server ~= "" ) then
  5.         if ( showServerName ) then
  6.             return name.."-"..server;
  7.         else
  8.             if (relationship == LE_REALM_RELATION_VIRTUAL) then
  9.                 return name;
  10.             else
  11.                 return name..FOREIGN_SERVER_LABEL;
  12.             end
  13.         end
  14.     else
  15.         return name;
  16.     end
  17. end

Last edited by Kanegasi : 11-22-18 at 11:47 PM. Reason: Blizzard code
  Reply With Quote
11-23-18, 01:25 AM   #8
outer1990
A Defias Bandit
Join Date: Nov 2018
Posts: 3
Originally Posted by Kanegasi View Post
I use UnitName("npc") to get the name of the trading target for my addon.

Lua Code:
  1. local f = CreateFrame("frame")
  2. function f.TRADE_SHOW()
  3.     local name, realm = UnitName("npc")
  4.     print(name..(realm and "-"..realm or "").." has opened a trade with me.")
  5. end
  6. f:RegisterEvent("TRADE_SHOW")
  7. f:SetScript("OnEvent", function(self, event, ...) self[event](...) end)

I got this from http://wowprogramming.com/docs/api_types#unitID before it was deleted.

Edit: It's been quite a while since I found/used that, so I had a look in Blizzard's TradeFrame.lua, they use it to set the other player's name in the window:

Lua Code:
  1. function TradeFrame_Update()
  2.     SetPortraitTexture(TradeFramePlayerPortrait, "player");
  3.     SetPortraitTexture(TradeFrameRecipientPortrait, "NPC");
  4.     TradeFramePlayerNameText:SetText(GetUnitName("player"));
  5.     TradeFrameRecipientNameText:SetText(GetUnitName("NPC"));
  6.     for i=1, MAX_TRADE_ITEMS, 1 do
  7.         TradeFrame_UpdateTargetItem(i);
  8.         TradeFrame_UpdatePlayerItem(i);
  9.     end
  10.     TradeHighlightRecipient:Hide();
  11.     TradeHighlightPlayer:Hide();
  12.     TradeHighlightPlayerEnchant:Hide();
  13.     TradeHighlightRecipientEnchant:Hide();
  14. end

UnitName is defined in the C portion of WoW's code, but GetUnitName is in UnitFrame.lua:

Lua Code:
  1. function GetUnitName(unit, showServerName)
  2.     local name, server = UnitName(unit);
  3.     local relationship = UnitRealmRelationship(unit);
  4.     if ( server and server ~= "" ) then
  5.         if ( showServerName ) then
  6.             return name.."-"..server;
  7.         else
  8.             if (relationship == LE_REALM_RELATION_VIRTUAL) then
  9.                 return name;
  10.             else
  11.                 return name..FOREIGN_SERVER_LABEL;
  12.             end
  13.         end
  14.     else
  15.         return name;
  16.     end
  17. end
thank you, it does let me know who opens trade with me which is useful to know when trading with 10+ people at once. thank you for this script... it has been added on. Still must target the person when accepting a trade to get there name in "Xname has traded you 2000g confirmed" Dont think it is possible.. but still a useful script! <3
  Reply With Quote
11-23-18, 04:53 AM   #9
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,892
Oh, that is handy to know as I would have thought that a player trade would require "target" rather than "npc" as a player would not be an npc. But I suppose Blizzard just made the code work functionally the same regardless of where the trader is an npc or player.
__________________
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Search/Requests » LF Gold trade announcer

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off