internal void processAccept(TSPlayer player, OfferObj obj) { //deactivate offer in db main.Database.Query("UPDATE storeoffer SET Active = @0 WHERE ID = @1", 0, obj.ID); //remove trade and create offer inplace of trade if (obj.Type != -1) { TradeObj obj2 = TradeObjByID(obj.Type); if (obj2 == null) { player.SendErrorMessage("Error: Major Database Desync has occured - Transaction ID: {0} does not exist!", obj.Type); return; } main.Database.Query("UPDATE storetrade SET TradeID = @0 WHERE ID = @1 AND Active = @2", 0, obj2.ID, 1); main.Database.Query("INSERT INTO storeoffer(ID, User, ItemID, Stack, TradeID, Active) VALUES(@0,@1,@2,@3,@4,@5)", offerID, obj.User, obj2.ItemID, obj2.Stack, -1, 1); offerObj.Add(new OfferObj(offerID, obj.User, obj2.ItemID, obj2.Stack, -1, 1)); offerID += 1; obj2.Active = 0; } obj.Active = 0; }
public void returnOffer(OfferObj obj) { main.Database.Query("UPDATE storeoffer SET TradeID = @0 WHERE ID = @1 AND Active = @2", -1, obj.ID, 1); obj.Type = -1; }
internal void processAccept(TSPlayer player, OfferObj obj) { //deactivate offer in db main.Database.Query("UPDATE storeoffer SET Active = @0 WHERE ID = @1", 0, obj.ID); //remove trade and create offer inplace of trade if (obj.Type != -1) { TradeObj obj2 = TradeObjByID(obj.Type); if (obj2 == null) { player.SendErrorMessage("Error: Major Database Desync has occured - Transaction ID: {0} does not exist!", obj.Type); return; } main.Database.Query("UPDATE storetrade SET TradeID = @0 WHERE ID = @1 AND Active = @2",0 ,obj2.ID, 1); main.Database.Query("INSERT INTO storeoffer(ID, User, ItemID, Stack, TradeID, Active) VALUES(@0,@1,@2,@3,@4,@5)", offerID, obj.User, obj2.ItemID, obj2.Stack, -1, 1); offerObj.Add(new OfferObj(offerID, obj.User, obj2.ItemID, obj2.Stack, -1, 1)); offerID += 1; obj2.Active = 0; } obj.Active = 0; }