From 5b75ce5a3fa10e4caafd87968d3a3dbda1cbb138 Mon Sep 17 00:00:00 2001 From: ole1986 Date: Mon, 11 Aug 2014 23:20:23 +0200 Subject: [PATCH] slightly changes to add products properly --- plugins/Radegast.Plugin.EVOVend/EVOvendPlugin.cs | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/plugins/Radegast.Plugin.EVOVend/EVOvendPlugin.cs b/plugins/Radegast.Plugin.EVOVend/EVOvendPlugin.cs index 4562001..ebe5e3a 100644 --- a/plugins/Radegast.Plugin.EVOVend/EVOvendPlugin.cs +++ b/plugins/Radegast.Plugin.EVOVend/EVOvendPlugin.cs @@ -80,16 +80,30 @@ namespace Radegast.Plugin.EVOVend //client.Self.ChatFromSimulator += new EventHandler(Self_ChatFromSimulator); } + void UnregisterClientEvents(GridClient client) + { + //if (client == null) return; + client.Inventory.ItemReceived -= Inventory_ItemReceived; + client.Inventory.InventoryObjectOffered -= Inventory_InventoryObjectOffered; + } + private UUID offeredObject; + private UUID offeredAgent; void Inventory_InventoryObjectOffered(object sender, InventoryObjectOfferedEventArgs e) { offeredObject = e.ObjectID; + offeredAgent = e.Offer.FromAgentID; } void Inventory_ItemReceived(object sender, ItemReceivedEventArgs e) { if (offeredObject != e.Item.UUID) return; + if (offeredAgent == UUID.Zero) + { + instance.MainForm.TabConsole.DisplayNotificationInChat(pluginName + ": Failed to insert. Agent UUID not found", ChatBufferTextStyle.Error); + return; + } Dictionary param = new Dictionary(); param.Add("invUUID", e.Item.UUID.ToString()); @@ -106,16 +120,13 @@ namespace Radegast.Plugin.EVOVend int result = Int32.Parse(str); if(result > 0) - instance.MainForm.TabConsole.DisplayNotificationInChat(pluginName + ": Product " + e.Item.Name + " accepted and successfully inserted", ChatBufferTextStyle.StatusBlue); + instance.MainForm.TabConsole.DisplayNotificationInChat(pluginName + ": Product " + e.Item.Name + " from Agent " + e.Item.LastOwnerID +" accepted and inserted", ChatBufferTextStyle.StatusBlue); else instance.MainForm.TabConsole.DisplayNotificationInChat(pluginName + ": Failed to insert " + e.Item.Name + " from Agent " + e.Item.LastOwnerID, ChatBufferTextStyle.Error); + offeredAgent = UUID.Zero; } - void UnregisterClientEvents(GridClient client) - { - //if (client == null) return; - //client.Self.ChatFromSimulator -= new EventHandler(Self_ChatFromSimulator); - } + void EVOvendTab_Disposed(object sender, EventArgs e) { -- 2.11.0