[Release]CoEmuV2 EXPBall code

06/03/2009 01:02 scottdavey#16
Lots of npcs are gonna add exp, best just to create a function, stick this at the bottom of useitem.

Code:
        public static void GiveExp(int exp,  ClientSocket CSocket)
        {
            CSocket.Client.Exp += (ulong)exp;
            if (Calculation.NeededExp(CSocket.Client.Level) <= CSocket.Client.Exp)
            {
                Calculation.GiveLevel(CSocket);
            }
            else
            {
                CSocket.Send(ConquerPacket.Status(CSocket, 2, CSocket.Client.Exp, Struct.StatusTypes.Exp));
            }
        }
06/04/2009 22:28 quadruple1#17
It doesnt work for me...
Itl show the notice where it says itl level you up by this much... you click okay and nothing happens
06/04/2009 23:32 Zeroxelli#18
Guys, all your code fails. You only give ONE FRIGGIN LEVEL and the rest is just off in space. -.-

Here's an example using the Qonquer
Code:
Math.Floor(600000 * (1 + ((CSocket.Client.Level - 1) * 0.4)));
Kinshi posted

Code:
                case 723700:
                    {
                        ulong ExpToGive = (ulong)Math.Floor(600000 * (1 + ((CSocket.Client.Level - 1) * 0.4)));
                        ulong ExpNeed = Calculation.NeededExp(CSocket.Client.Level) - CSocket.Client.Exp;
                        int Safety = 0;

                        while (ExpToGive >= 0)
                        {
                            if (Safety >= 150)
                                break;
                            if (ExpToGive < ExpNeed)
                            {
                                CSocket.Client.Exp += (ulong)ExpToGive;
                                ExpToGive = 0;
                                break;
                            }
                            else
                            {
                                CSocket.Client.Exp += (ulong)ExpNeed;
                                ExpToGive -= ExpNeed;
                                if (CSocket.Client.Exp >= Calculation.NeededExp(CSocket.Client.Level))
                                {
                                    Calculation.GiveLevel(CSocket);
                                    ExpNeed = Calculation.NeededExp(CSocket.Client.Level) - CSocket.Client.Exp;
                                    CSocket.Client.Exp = 0;
                                }
                            }   ++Safety;
                        }
                        CSocket.Send(ConquerPacket.Status(CSocket, 2, CSocket.Client.Exp, Struct.StatusTypes.Exp));
                        break;
                    }
Please learn to code guys, you're making me lonely :(
06/04/2009 23:43 SuperDragonMan#19
thanks
06/05/2009 01:45 scottdavey#20
Quote:
Originally Posted by Zeroxelli View Post
Guys, all your code fails. You only give ONE FRIGGIN LEVEL and the rest is just off in space. -.-

Here's an example using the Qonquer
Code:
Math.Floor(600000 * (1 + ((CSocket.Client.Level - 1) * 0.4)));
Kinshi posted

Code:
                case 723700:
                    {
                        ulong ExpToGive = (ulong)Math.Floor(600000 * (1 + ((CSocket.Client.Level - 1) * 0.4)));
                        ulong ExpNeed = Calculation.NeededExp(CSocket.Client.Level) - CSocket.Client.Exp;
                        int Safety = 0;

                        while (ExpToGive >= 0)
                        {
                            if (Safety >= 150)
                                break;
                            if (ExpToGive < ExpNeed)
                            {
                                CSocket.Client.Exp += (ulong)ExpToGive;
                                ExpToGive = 0;
                                break;
                            }
                            else
                            {
                                CSocket.Client.Exp += (ulong)ExpNeed;
                                ExpToGive -= ExpNeed;
                                if (CSocket.Client.Exp >= Calculation.NeededExp(CSocket.Client.Level))
                                {
                                    Calculation.GiveLevel(CSocket);
                                    ExpNeed = Calculation.NeededExp(CSocket.Client.Level) - CSocket.Client.Exp;
                                    CSocket.Client.Exp = 0;
                                }
                            }   ++Safety;
                        }
                        CSocket.Send(ConquerPacket.Status(CSocket, 2, CSocket.Client.Exp, Struct.StatusTypes.Exp));
                        break;
                    }
Please learn to code guys, you're making me lonely :(
"guys"? There was one person that posted fail code, i merely posted an example.

Ignorant.
06/05/2009 02:07 Zeroxelli#21
Quote:
Originally Posted by scottdavey View Post
"guys"? There was one person that posted fail code, i merely posted an example.

Ignorant.
Uh, no. Check the thread. Also, it wasn't directed at your function. But even so with yours, since you bring it up; It's blindly adding EXP onto the current.
06/08/2009 08:43 killerbee#22
ok, all the codes ya gave was great, working like charms, but if you buy like 5 expballs from shopping mall and use them, only one will be remove from your inventory and the other 4 wont be remove and you can still get experience by clicking it. any idea why its doing that.
07/06/2009 11:09 0105653642#23
do you know how to control of it i only want players use 10 expball only
07/06/2009 15:38 Zeroxelli#24
@killerbee
Mall fix, you need it.

@0105653642
Just save/load an integer to/from the db, and increment it.
07/07/2009 14:51 0105653642#25
I want to know how to control in expballs use i want the players only use 10 expball in day any idea
07/10/2009 17:58 taylor2846#26
il give you an example def in in character.cs and put this

if (CSocket.Client.expballuse <= 10)
{
CSocket.Client.expballuse += 1;


and you may want set it to save the expballuse. if not the acc can just relog and us 10 more
07/10/2009 19:15 alexbigfoot#27
Quote:
Originally Posted by taylor2846 View Post
il give you an example def in in character.cs and put this

if (CSocket.Client.expballuse <= 10)
{
CSocket.Client.expballuse += 1;


and you may want set it to save the expballuse. if not the acc can just relog and us 10 more
wooh, and next day will u be able to use another 10? i doubt cuz you certainly dont know how to handle the "tomorrow".
07/10/2009 19:37 killerbee#28
Quote:
Zeroxelli;2508278]@killerbee
Mall fix, you need it.
I already have the mall fix, but it was my ExpBall code that was the problem, but i fix it. thanks
07/10/2009 21:44 CIRASH#29
Quote:
Originally Posted by alexbigfoot View Post
wooh, and next day will u be able to use another 10? i doubt cuz you certainly dont know how to handle the "tomorrow".
add a 24 hour timer or sumtin?
lol i barely know anything about coding