Exemplo n.º 1
0
 internal void cancelTrade(TradeObj obj)
 {
     main.Database.Query("UPDATE storetrade SET Active = @0 WHERE ID = @1", 0, obj.ID);
     main.Database.Query("INSERT INTO storeoffer(ID, User, ItemID, Stack, TradeID, Active) VALUES(@0,@1,@2,@3,@4,@5)", offerID, obj.User, obj.ItemID, obj.Stack, -1, 1);
     offerObj.Add(new OfferObj(offerID, obj.User, obj.ItemID, obj.Stack, -1, 1));
     offerID += 1;
     foreach (OfferObj obj2 in offerObj)
     {
         if (obj2.Type == obj.ID && obj.Active == 1)
         {
             main.Database.Query("UPDATE storeoffer SET TradeID = @0 WHERE ID = @1", -1, obj.ID);
             obj2.Type = -1;
         }
     }
     obj.Active = 0;
 }
Exemplo n.º 2
0
 public void processTrade(TSPlayer player, TradeObj obj, Item item, int stack)
 {
     //make trade inactive as it has been finished -in db and in cached obj
     main.Database.Query("UPDATE storetrade SET Active = @0 WHERE ID = @1", 0, obj.ID);
     obj.Active = 0;
     //check if item being added to db/obj is actually an item
     if (item != null)
     {
         //add to db/obj as a comppleted offer, so player who added the trade is able to collect it
         main.Database.Query("INSERT INTO storeoffer(ID, User, ItemID, Stack, TradeID, Active) VALUES(@0,@1,@2,@3,@4,@5)", offerID, obj.User, item.netID, stack, -1, 1);
         offerObj.Add(new OfferObj(offerID, obj.User, item.netID, stack, -1, 1));
     }
     else
     {
         //add to db/obj as completed offer but for currency instead, so player who added the trade isable to collect it
         main.Database.Query("INSERT INTO storeoffer(ID, User, ItemID, Stack, TradeID, Active) VALUES(@0,@1,@2,@3,@4,@5)", offerID, obj.User, 0, stack, -1, 1);
         offerObj.Add(new OfferObj(offerID, obj.User, 0, stack, -1, 1));
     }
     //increase offer ID
     offerID += 1;
 }
Exemplo n.º 3
0
 public void processTrade(TSPlayer player, TradeObj obj, Item item, int stack)
 {
     //make trade inactive as it has been finished -in db and in cached obj
     main.Database.Query("UPDATE storetrade SET Active = @0 WHERE ID = @1", 0, obj.ID);
     obj.Active = 0;
     //check if item being added to db/obj is actually an item
     if (item != null)
     {
         //add to db/obj as a comppleted offer, so player who added the trade is able to collect it
         main.Database.Query("INSERT INTO storeoffer(ID, User, ItemID, Stack, TradeID, Active) VALUES(@0,@1,@2,@3,@4,@5)", offerID, obj.User, item.netID, stack, -1, 1);
         offerObj.Add(new OfferObj(offerID, obj.User, item.netID, stack, -1, 1));
     }
     else
     {
         //add to db/obj as completed offer but for currency instead, so player who added the trade isable to collect it
         main.Database.Query("INSERT INTO storeoffer(ID, User, ItemID, Stack, TradeID, Active) VALUES(@0,@1,@2,@3,@4,@5)", offerID, obj.User, 0, stack, -1, 1);
         offerObj.Add(new OfferObj(offerID, obj.User, 0, stack, -1, 1));
     }
     //increase offer ID
     offerID += 1;
 }
Exemplo n.º 4
0
 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;
 }
Exemplo n.º 5
0
 internal void cancelTrade(TradeObj obj)
 {
     main.Database.Query("UPDATE storetrade SET Active = @0 WHERE ID = @1", 0, obj.ID);
     main.Database.Query("INSERT INTO storeoffer(ID, User, ItemID, Stack, TradeID, Active) VALUES(@0,@1,@2,@3,@4,@5)", offerID, obj.User, obj.ItemID, obj.Stack, -1, 1);
     offerObj.Add(new OfferObj(offerID, obj.User, obj.ItemID, obj.Stack, -1, 1));
     offerID += 1;
     foreach (OfferObj obj2 in offerObj)
     {
         if (obj2.Type == obj.ID && obj.Active == 1)
         {
             main.Database.Query("UPDATE storeoffer SET TradeID = @0 WHERE ID = @1", -1, obj.ID);
             obj2.Type = -1;
         }
     }
     obj.Active = 0;
 }