QuestionSolvedK-Relay Problem with making a plugin cancel a trade correctly

Posts 1–3 of 3 · Page 1 of 1
K-Relay Problem with making a plugin cancel a trade correctly
So I've been playing around making plugins for k-relay, and ive come across a minor problem, when the tradee cancels the trade, while the trade does get canceled, I'm left looking at the "XXX want to trade accept/reject" menu, and when i cancel the trade myself (using the CancelTradePacket)
I'm left staring at the trade (as if nothing happened) while the tradee does infact get his trade canceled.

Code being used for accepting the trade:
Code:
TradeRequestedPacket tradeRequest = (TradeRequestedPacket)packet;


PlayerTextPacket playerText = (PlayerTextPacket)Packet.Create(PacketType.PLAYERTEXT);
playerText.Text = "/trade " + tradeRequest.Name;
client.SendToServer(playerText);
Code being used to cancel the trade:
Code:
CancelTradePacket cancelTrade = (CancelTradePacket)Packet.Create(PacketType.CANCELTRADE);
client.SendToServer(cancelTrade);
Now, the proxy does trigger OnTradeDone (proxy.HookPacket(PacketType.TRADEDONE, OnTradeDone); )
But it dosent actually cancel the trade for me, just for the person who is trading me.

I imagine both of these problem occur because im not sending anything to the client itself, but I've not clue how to begin fixing that, using client.SendToClient just crashes me each time, and the default plugins dont do anything with Trades for me to go off of.

Any ideas?

Also, if this isn't the place to ask this, please redirect me.
Quote Originally Posted by finalsin View Post
So I've been playing around making plugins for k-relay, and ive come across a minor problem, when the tradee cancels the trade, while the trade does get canceled, I'm left looking at the "XXX want to trade accept/reject" menu, and when i cancel the trade myself (using the CancelTradePacket)
I'm left staring at the trade (as if nothing happened) while the tradee does infact get his trade canceled.

Code being used for accepting the trade:
Code:
TradeRequestedPacket tradeRequest = (TradeRequestedPacket)packet;


PlayerTextPacket playerText = (PlayerTextPacket)Packet.Create(PacketType.PLAYERTEXT);
playerText.Text = "/trade " + tradeRequest.Name;
client.SendToServer(playerText);
Code being used to cancel the trade:
Code:
CancelTradePacket cancelTrade = (CancelTradePacket)Packet.Create(PacketType.CANCELTRADE);
client.SendToServer(cancelTrade);
Now, the proxy does trigger OnTradeDone (proxy.HookPacket(PacketType.TRADEDONE, OnTradeDone); )
But it dosent actually cancel the trade for me, just for the person who is trading me.

I imagine both of these problem occur because im not sending anything to the client itself, but I've not clue how to begin fixing that, using client.SendToClient just crashes me each time, and the default plugins dont do anything with Trades for me to go off of.

Any ideas?

Also, if this isn't the place to ask this, please redirect me.
There is absolutely nothing wrong with your code. The only thing is that the ROTMG client doesn't update it's UI once you cancel the trade programatically. It's just a graphical error. The trade has actually been canceled for both of you, but the trade UI still remains on your screen. Just try to ignore it
Quote Originally Posted by finalsin View Post
Also, if this isn't the place to ask this, please redirect me.
No response for over a week.

/closed, if you think there is a better solution PM me or Luis to re-open this thread.
Posts 1–3 of 3 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Need help?