[FIX]CoMy CPTrader (TaoistMoon)

07/24/2009 19:40 DePredaTe#1
Alright, this guide is to show you how to fix the CPTrader, not the CPAdmin, the CPTrader!
The CPTrader is the one that trades CPs for your money. This is my first guide, so please don't flame. I know it's easy, but maybe some people don't know how to do it!
You see, before you do this guide, when you try to trade him money for CPs, it acts like it does nothing, but actually it does. He does make the trade successfully, but you must log out and back in before it would show up. Now with this, it updates without you having to log out and log in. You're welcome. :}

First open up CoServerProject.sln in the CPServerProject folder.
Now when that opens, double click client.cs and hold ctrl+f and then search for
Code:
                         if (CurrentNPC == 104813)
                        {
                            if (Control == 1)
                            {
                                if (MyChar.Silvers >= 200000)
                                {
                                    MyChar.Silvers -= 200000;
                                    MyChar.CPs += 20;
                                }
                            }
                        }
right below this:

Code:
MyChar.CPs += 20;
add this:

Code:
                                    SendPacket(General.MyPackets.Vital(MyChar.UID, 4, MyChar.Silvers));
                                    SendPacket(General.MyPackets.Vital(MyChar.UID, 30, MyChar.CPs));
That's it, you're done. :}

So at the end, it should look like this:
Code:
                        if (CurrentNPC == 104813)
                        {
                            if (Control == 1)
                            {
                                if (MyChar.Silvers >= 200000)
                                {
                                    MyChar.Silvers -= 200000;
                                    MyChar.CPs += 20;
                                    SendPacket(General.MyPackets.Vital(MyChar.UID, 4, MyChar.Silvers));
                                    SendPacket(General.MyPackets.Vital(MyChar.UID, 30, MyChar.CPs));
                                }
                            }
                        }
07/24/2009 19:48 Arcotemple:)#2
lol all people need to do is save by sending packets
good jb though might help the newbies
07/24/2009 19:53 DePredaTe#3
Well, I decided since i've been working on other people's stuff, I should release fixes for their sources.
It's not much, but. I'm still learning, i'm not as good as alot of people here. XD
But, at least i'm doing something.
07/24/2009 19:55 Arcotemple:)#4
yeah its better than being like other people here that just leach and dont contribute
07/24/2009 19:59 DePredaTe#5
at least i'm a step up from them. haha.
thanks.
07/24/2009 19:59 Skuade#6
nice i like it, =P congrats
07/24/2009 20:11 DePredaTe#7
you're welcome. :}
did it work right?
07/24/2009 20:12 Arcotemple:)#8
wait this is for lotf right?
thats what it looks lke
07/24/2009 20:14 DePredaTe#9
Yeah, CoMy. But, CoMy is loft. So, yeah.
07/24/2009 20:15 Arcotemple:)#10
lol yeah lotf base
07/25/2009 01:01 tanelipe#11
May I suggest creating some sort of enum for those UpdateIDs? I mean alot people might get confused what those '4' and '30' are on those send packets. For example something like this?


PHP Code:
public enum UpdateIDs uint
{
    
Money 4,
    
ConquerPoints 30

Ofcourse you'd have to modify the source a little bit but after all the code would be more self explaining when you'd could just send packets like:
PHP Code:
SendPacket(General.MyPackets.Vital(MyChar.UIDUpdateIDs.MoneyMyChar.Silvers)); 
It would be pretty self explaining, yes?
07/25/2009 01:15 DePredaTe#12
Yeah, but like you said. You would have to modify the source.
When the code I added, you just add it and go.
Most people who already knew what I put on this thread, probably know your way too. If they knew your way, then they would most likely know my way.

This tutorial is my first, sorry. but, I thought for people that doesn't know ANYTHING about C# would like this.
I'm still on 'learning mode' of C#. So, if I know this, than the people that know more than me should know both ways.
07/25/2009 02:11 Yooha#13
lol it is any powersource
07/25/2009 02:31 Arcotemple:)#14
its made for lotf
07/25/2009 03:47 DePredaTe#15
Yooha, was that a question?
or statement?
If it was a question: It's CoMy, which is based off the source of LOTF.
If it was a statement: what are you talking about?