Register for your free account! | Forgot your password?

You last visited: Today at 23:24

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[Release]Trade

Discussion on [Release]Trade within the CO2 PServer Guides & Releases forum part of the CO2 Private Server category.

Closed Thread
 
Old   #1
 
Arcо's Avatar
 
elite*gold: 0
Join Date: Oct 2009
Posts: 8,783
Received Thanks: 5,304
[Release]Trade

Okay well in the 5165 source, GM's and PM's cannot trade.
Well yeah the fix for it is small but since alot of people were asking me about it I am going to release my trading code.
Replace your entire Trade.cs with this code.
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NewestCOServer.Game;

namespace NewestCOServer.PacketHandling
{
    public class Trade
    {
        static void CancelTrade(Main.GameClient C)
        {
            if (C.MyChar.Trading)
            {
                Character Who = (Character)World.H_Chars[C.MyChar.TradingWith];
                if (Who != null)
                {
                    Who.MyClient.AddSend(Packets.TradePacket(C.MyChar.TradingWith, 5));
                    Who.Trading = false;
                    Who.TradingWith = 0;
                    Who.TradeSide.Clear();
                    Who.TradingCPs = 0;
                    Who.TradingSilvers = 0;
                    Who.ClickedOK = false;
                    Who.Silvers = Who.Silvers;//update the silvers
                    Who.CPs = Who.CPs;//update the cps
                    Who.MyClient.AddSend(Packets.ChatMessage(Who.MyClient.MessageID, "SYSTEM", Who.Name, "Trading failed!", 2005, 0));
                }
                C.AddSend(Packets.TradePacket(C.MyChar.TradingWith, 5));
                C.MyChar.Trading = false;
                C.MyChar.TradingWith = 0;
                C.MyChar.TradeSide = new System.Collections.ArrayList(20);
                C.MyChar.TradingCPs = 0;
                C.MyChar.TradingSilvers = 0;
                C.MyChar.ClickedOK = false;
                C.MyChar.CPs = C.MyChar.CPs;//update the cps
                C.MyChar.Silvers = C.MyChar.Silvers;//update the silvers
                C.AddSend(Packets.ChatMessage(C.MessageID, "SYSTEM", C.MyChar.Name, "Trading failed!", 2005, 0));
            }
        }
        public static void Handle(Main.GameClient C, byte[] Data)
        {
            uint UID = BitConverter.ToUInt32(Data, 4);
            byte Type = Data[8];

            switch (Type)
            {
                case 1:
                    {
                        Character Who = (Character)World.H_Chars[UID];
                        if (Who != null && !Who.Trading)
                        {
                            if (!C.MyChar.Trading)
                            {
                                if (Who.EntityID != C.MyChar.TradingWith)
                                {
                                    C.MyChar.TradingWith = UID;
                                    if (Who.EntityID == C.MyChar.TradingWith && Who.TradingWith == C.MyChar.EntityID)
                                    {
                                        Who.MyClient.AddSend(Packets.TradePacket(C.MyChar.EntityID, 3));
                                        C.AddSend(Packets.TradePacket(Who.EntityID, 3));
                                        C.MyChar.Trading = true;
                                        Who.Trading = true;
                                        break;
                                    }
                                    else
                                    {
                                        C.AddSend(Packets.ChatMessage(C.MessageID, "SYSTEM", C.MyChar.Name, "[Trade]Request for trading has been sent out.", 2005, 0));
                                        Who.MyClient.AddSend(Packets.TradePacket(C.MyChar.EntityID, 1));
                                    }
                                }
                                if (Who.EntityID == C.MyChar.TradingWith && Who.TradingWith == C.MyChar.EntityID)
                                {
                                    Who.MyClient.AddSend(Packets.TradePacket(C.MyChar.EntityID, 3));
                                    C.AddSend(Packets.TradePacket(Who.EntityID, 3));
                                    C.MyChar.Trading = true;
                                    Who.Trading = true;
                                }
                            }
                            else
                                C.AddSend(Packets.ChatMessage(C.MessageID, "SYSTEM", C.MyChar.Name, "[Trade]Close the current trade before you take another one.", 2005, 0));
                        }
                        else
                            C.AddSend(Packets.ChatMessage(C.MessageID, "SYSTEM", C.MyChar.Name, "[Trade]The target is trading with someone else.", 2005, 0));

                        break;
                    }
                case 2:
                    {
                        CancelTrade(C);
                        break;
                    }
                case 6:
                    {
                        Character Who = (Character)World.H_Chars[C.MyChar.TradingWith];
                        if (Who != null)
                        {
                            if (C.MyChar.TradeSide.Count < 20)
                            {
                                if (Who.Inventory.Count + C.MyChar.TradeSide.Count < 40)
                                {
                                    Game.Item I = C.MyChar.FindInvItem(UID);
                                    if (!I.FreeItem)
                                    {
                                        Who.MyClient.AddSend(Packets.TradeItem(I));
                                        C.MyChar.TradeSide.Add(I.UID);
                                    }
                                    else
                                    {
                                        C.AddSend(Packets.TradePacket(UID, 11));
                                        C.AddSend(Packets.ChatMessage(C.MessageID, "SYSTEM", C.MyChar.Name, "[Trade]Cannot trade items made with gm commands.", 2005, 0));
                                    }
                                }
                                else
                                {
                                    C.AddSend(Packets.TradePacket(UID, 11));
                                    C.AddSend(Packets.ChatMessage(C.MessageID, "SYSTEM", C.MyChar.Name, "[Trade]Your trade partner can't hold any more items.", 2005, 0));
                                    Who.MyClient.AddSend(Packets.ChatMessage(C.MessageID, "SYSTEM", C.MyChar.Name, "[Trade]The one your trading with cant add anymore items on the table because you have no room in your inventory.", 2005, 0));
                                }
                            }

                        }
                        break;
                    }
                case 7:
                    {
                        C.MyChar.TradingSilvers = UID;
                        Character Who = (Character)World.H_Chars[C.MyChar.TradingWith];
                        Who.MyClient.AddSend(Packets.TradePacket(UID, 8));

                        break;
                    }
                case 13:
                    {
                        C.MyChar.TradingCPs = UID;
                        Character Who = (Character)World.H_Chars[C.MyChar.TradingWith];
                        Who.MyClient.AddSend(Packets.TradePacket(UID, 12));

                        break;
                    }
                case 10:
                    {
                        Character Who = (Character)World.H_Chars[C.MyChar.TradingWith];

                        if (Who != null && Who.ClickedOK)
                        {
                                if (C.MyChar.Silvers >= C.MyChar.TradingSilvers && C.MyChar.CPs >= C.MyChar.TradingCPs && Who.Silvers >= Who.TradingSilvers && Who.CPs >= Who.TradingCPs)
                                {
                                    Who.MyClient.AddSend(Packets.TradePacket(C.MyChar.TradingWith, 5));
                                    C.AddSend(Packets.TradePacket(C.MyChar.EntityID, 5));

                                    Who.Silvers += C.MyChar.TradingSilvers;
                                    Who.Silvers -= Who.TradingSilvers;
                                    C.MyChar.Silvers += Who.TradingSilvers;
                                    C.MyChar.Silvers -= C.MyChar.TradingSilvers;

                                    Who.CPs += C.MyChar.TradingCPs;
                                    Who.CPs -= Who.TradingCPs;
                                    C.MyChar.CPs += Who.TradingCPs;
                                    C.MyChar.CPs -= C.MyChar.TradingCPs;


                                    foreach (uint Id in C.MyChar.TradeSide)
                                    {
                                        Game.Item I = C.MyChar.FindInvItem(Id);
                                        Who.AddItem(I);
                                        C.MyChar.RemoveItem(I);
                                    }
                                    foreach (uint Id in Who.TradeSide)
                                    {
                                        Game.Item I = Who.FindInvItem(Id);
                                        C.MyChar.AddItem(I);
                                        Who.RemoveItem(I);
                                    }

                                    Who.Trading = false;
                                    Who.TradingWith = 0;
                                    Who.TradeSide = new System.Collections.ArrayList(20);
                                    Who.TradingCPs = 0;
                                    Who.TradingSilvers = 0;
                                    Who.ClickedOK = false;
                                    Who.MyClient.AddSend(Packets.ChatMessage(Who.MyClient.MessageID, "SYSTEM", Who.Name, "Trading succeeded!", 2005, 0));
                                    C.MyChar.Trading = false;
                                    C.MyChar.TradingWith = 0;
                                    C.MyChar.TradeSide = new System.Collections.ArrayList(20);
                                    C.MyChar.TradingCPs = 0;
                                    C.MyChar.TradingSilvers = 0;
                                    C.MyChar.ClickedOK = false;
                                    C.AddSend(Packets.ChatMessage(C.MessageID, "SYSTEM", C.MyChar.Name, "Trading succeeded!", 2005, 0));
                                }
                                else
                                    CancelTrade(C);  
                            } 
                        else
                        {
                            C.MyChar.ClickedOK = true;
                            Who.MyClient.AddSend(Packets.TradePacket(0, 10));
                        }

                        break;
                    }
            }
        }
    }
}
Press thanks if it helped.
Arcо is offline  
Thanks
40 Users
Old 12/06/2009, 19:45   #2
 
elite*gold: 0
Join Date: Dec 2009
Posts: 21
Received Thanks: 8
NiCe ReLeAsE!!
.Donavon is offline  
Old 12/06/2009, 19:50   #3
 
Arcо's Avatar
 
elite*gold: 0
Join Date: Oct 2009
Posts: 8,783
Received Thanks: 5,304
Quote:
Originally Posted by .Donavon View Post
NiCe ReLeAsE!!
If you like it press thanks.
Arcо is offline  
Thanks
3 Users
Old 12/06/2009, 19:51   #4


 
Korvacs's Avatar
 
elite*gold: 20
Join Date: Mar 2006
Posts: 6,126
Received Thanks: 2,518
Quote:
Originally Posted by Tiku View Post
If you like it press thanks.
Theres atually no obligation for people to press thanks, please stop demanding it from people.
Korvacs is offline  
Old 12/06/2009, 19:53   #5
 
Arcо's Avatar
 
elite*gold: 0
Join Date: Oct 2009
Posts: 8,783
Received Thanks: 5,304
Quote:
Originally Posted by Korvacs View Post
Theres atually no obligation for people to press thanks, please stop demanding it from people.

It was more of a request than a demand.
Arcо is offline  
Thanks
3 Users
Old 12/13/2009, 09:09   #6
 
elite*gold: 0
Join Date: Jan 2008
Posts: 12
Received Thanks: 0
thanx bro
wael162 is offline  
Old 12/15/2009, 16:05   #7
 
elite*gold: 0
Join Date: Oct 2008
Posts: 29
Received Thanks: 4
thanx, i needed to handle this.
albert0 is offline  
Old 12/15/2009, 21:46   #8
 
elite*gold: 0
Join Date: Jan 2009
Posts: 1,922
Received Thanks: 491
Wait why in the world would you want your GMs to trade with players? I think the system of not allowing them to interact( giving things ) with players is awesome. ...If you wanted yourself to be able to trade, either make it with only other gms or have a command that allows you to trade... e.g #open trade
PeTe Ninja is offline  
Old 12/16/2009, 00:19   #9
 
ASSN9NE's Avatar
 
elite*gold: 0
Join Date: Oct 2006
Posts: 52
Received Thanks: 8
ok well im running the 5165 source and that still didnt let me trade to or from GM's OldCODB source rikardo updated server with 15-20 pct of the npc wont work either but thats a dif story
ASSN9NE is offline  
Old 12/16/2009, 00:30   #10
 
elite*gold: 0
Join Date: Aug 2009
Posts: 930
Received Thanks: 448
Quote:
Originally Posted by ASSN9NE View Post
ok well im running the 5156 source and that still didnt let me trade to or from GM's OldCODB source rikardo updated server with 15-20 pct of the npc wont work either but thats a dif story
you have to replace your entire trade.cs with arco's code. remember to debug from the source after making alterations, or the changes won't take effect.
.Guru is offline  
Thanks
1 User
Old 12/16/2009, 00:46   #11


 
Korvacs's Avatar
 
elite*gold: 20
Join Date: Mar 2006
Posts: 6,126
Received Thanks: 2,518
Quote:
Originally Posted by PeTe Ninja View Post
Wait why in the world would you want your GMs to trade with players? I think the system of not allowing them to interact( giving things ) with players is awesome. ...If you wanted yourself to be able to trade, either make it with only other gms or have a command that allows you to trade... e.g #open trade
I guess it comes down to oppinion, some people trust their GMs, in my private server i would have no restriction on who could trade with who. Its just anouther function that would slow down the server's packet processing, so why should you bother with it at all?

Get members of staff who can be trusted, then you dont need that check at all.
Korvacs is offline  
Old 12/16/2009, 01:31   #12
 
elite*gold: 0
Join Date: Aug 2009
Posts: 930
Received Thanks: 448
Quote:
Originally Posted by Korvacs View Post
I guess it comes down to oppinion, some people trust their GMs, in my private server i would have no restriction on who could trade with who. Its just anouther function that would slow down the server's packet processing, so why should you bother with it at all?

Get members of staff who can be trusted, then you dont need that check at all.
agreed 100%, and as he said, upon the degree of trust, allow only people you formally know, or "trust", to be staff, otherwise it'll comeback to haunt you when everyone has millions of CPs, and you either delete all accounts/characters & lose a ton of players, or change all the chars' CPs back to the original amount before the idiot altered it.
.Guru is offline  
Old 12/16/2009, 18:23   #13
 
elite*gold: 0
Join Date: Sep 2008
Posts: 1,683
Received Thanks: 506
Quote:
Originally Posted by Hepatitis C View Post

It was more of a request than a demand.
If it was a request, you should have started with, could you or something similar, it sounded as a demand to me.
Basser is offline  
Old 12/16/2009, 19:13   #14
 
onlyme64's Avatar
 
elite*gold: 0
Join Date: Mar 2008
Posts: 268
Received Thanks: 25
Quote:
Originally Posted by Smythe94 View Post
If it was a request, you should have started with, could you or something similar, it sounded as a demand to me.
****** hell smyth, he wasnt like "GIFF THANKS OR DIE".
Demand or not, does it matter? Geez.
onlyme64 is offline  
Old 12/18/2009, 23:05   #15
 
ASSN9NE's Avatar
 
elite*gold: 0
Join Date: Oct 2006
Posts: 52
Received Thanks: 8
ahha ye i just figured it out now thx 2 C# i was just copying and pasteing and replaceing but ty 4 helpin me ... and replying any ideas on the codes 2 fix the pk touney npc and the gc1-4 npcs to work for gw winners? atm im trying 2 fix the fb/ss issue
ASSN9NE is offline  
Closed Thread


Similar Threads Similar Threads
[RELEASE]Trade hack
11/16/2012 - Metin2 Hacks, Bots, Cheats, Exploits & Macros - 22 Replies
I want a trade hack pleasee:handsdown:
Release: Trade The Untrable.
02/14/2011 - Aion Hacks, Bots, Cheats & Exploits - 13 Replies
Trade the Untrable item NOTE THIS IS FOR Aion Version USA/EU .15 private server. This is a client side file modding where you can trade untrable item. in private server or any server that don't check the file at start. Im releaseing this because i quit aion no use for it no longer. But alot of people probbly already know about it. But if you don't here you go. With this items.pak patch you can trade item like anhaurt or store in warehouse selling it to npc. Even puting it in broker...
[RELEASE] Trade hack...TRADE EVEN SB ITEMS !!!
09/15/2010 - WoW PServer Exploits, Hacks & Tools - 36 Replies
so here i'm going to post my little tutorial ^^ "ingredients" : 1.WPE Pro 2.Basic knowledge of WPE 3.GOOD soulbound items (best --> something like q items because they dont have any min. level ;) 4.a low level char (the one who gets the good SB item) 5.a high level char (the one who have the good SB item)
[RELEASE] MSG_SERVER release 2.400 (TRADE and KNIGHT with 65k stars)
05/09/2010 - EO PServer Guides & Releases - 24 Replies
Alright lets say small gift from me again ;) Like I wrote long time ago - from time to time I will be releasing some useful stuff here. Since I am busy under Demons Online Reloaded (all time there is something that must be add, must be upgraded :P) here dont have much time to share :P Anyway to the subject: In attachment MSG_SERVER_ver.2.3721 C2.193 (Mannequin edition) whats new? - possibility to use TRADE for pets till 65000* - possibility to use pets under KNIGHT till 65000*
[Release]Trade...(CoEmu v2)
06/01/2009 - CO2 PServer Guides & Releases - 9 Replies
close this thread, way too many whiners.



All times are GMT +1. The time now is 23:25.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2026 elitepvpers All Rights Reserved.