[Release] Points ( Custom idea )

11/01/2008 01:29 _Emme_#1
Hey guys. Litteraly bored,so I decided to code like points,this is how it work:

What point does:
You can trade them for items,such as:
DB
Met
Experience
VPS
Blessing
some more...


You can also sell them to an NPC.


How to get them:
PKing others
Be in the winning guild of GW
Participing in Lottery


How to loose:
Getting PKed by another player.


Lets start!


Search for :
public void SaveHB()
Above it ,add:

Code:
public void SavePoints()
        {
            LastSave = DateTime.Now;
            if (MyClient.There)
                if (MyClient.Online)
                {
                    DataBase.SaveChar(this);
                    DataBase.SavePoints(this);
                }
        }
Search for:
public static void Ban
above it , add:

Code:
public static void SavePoints(Character Charr)
        {
            MySqlCommand Command = null;
            Command = new MySqlCommand("UPDATE `Characters` SET `Points` = '" + Charr.Points + "' WHERE `Account` = '" + Charr.MyClient.Account + "'", Connection);
            Command.ExecuteNonQuery();
        }

Search for
if (CurrentNPC == 9812)
Until you get to the CODE for it,above it add:

Code:
if (CurrentNPC == 3900)
                            {
                                if (Control == 1)
                                {
                                    SendPacket(General.MyPackets.NPCSay("Which to buy points? This is what I give for your items."));
                                    SendPacket(General.MyPackets.NPCLink("50 points for one million silvers.", 3));
                                    SendPacket(General.MyPackets.NPCLink("50 points for 140 CPs.", 4));
                                    SendPacket(General.MyPackets.NPCLink("10 points for 5000 VPs", 5));
                                    SendPacket(General.MyPackets.NPCLink("15 points for an Meteor", 6));
                                    SendPacket(General.MyPackets.NPCLink("35 points for an DragonBall", 7));
                                    SendPacket(General.MyPackets.NPCLink("Nothing,thanks.", 255));
                                    SendPacket(General.MyPackets.NPCSetFace(30));
                                    SendPacket(General.MyPackets.NPCFinish());
                                }
                                if (Control == 2)
                                {
                                    SendPacket(General.MyPackets.NPCSay("Which to sell points? This is what I give for your points."));
                                    SendPacket(General.MyPackets.NPCLink("10000 VPs for 100 points", 8));
                                    SendPacket(General.MyPackets.NPCLink("EXP. worth of 10 ExpBalls for 300 points.", 9));
                                    SendPacket(General.MyPackets.NPCLink("DragonBall for 75 points", 10));
                                    SendPacket(General.MyPackets.NPCLink("3-days-blessing for 750 points", 11));
                                    SendPacket(General.MyPackets.NPCLink("Random amout of silvers for 500 points", 12));
                                    SendPacket(General.MyPackets.NPCLink("Nothing,thanks.", 255));
                                    SendPacket(General.MyPackets.NPCSetFace(30));
                                    SendPacket(General.MyPackets.NPCFinish());
                                    
                                    }
                                if (Control == 3)
                                {
                                    if (MyChar.Silvers >= 1000000)
                                    {
                                        MyChar.Points += 50;
                                        MyChar.Silvers -= 1000000;
                             SendPacket(General.MyPackets.Vital(MyChar.UID, 4, MyChar.Silvers));
                             SendPacket(General.MyPackets.SendMsg(MessageId, "SYSTEM", MyChar.Name, "You now have " + MyChar.Points + " Points left.", 2005));
                                       
                                        
                                    }

                                }
                                if (Control == 4)
                                {
                                    if (MyChar.CPs >= 140)
                                    {
                                        MyChar.Points += 50;
                                        MyChar.CPs -= 140;
                                      SendPacket(General.MyPackets.Vital(MyChar.UID, 30, MyChar.CPs));
                                      SendPacket(General.MyPackets.SendMsg(MessageId, "SYSTEM", MyChar.Name, "You now have " + MyChar.Points + " Points left.", 2005));

                                    }
                                }
                                if (Control == 5)
                                {
                                    if (MyChar.VP >= 5000)
                                    {
                                        MyChar.Points += 10;
                                        MyChar.VP -= 5000;
                                        MyChar.MyClient.SendPacket(General.MyPackets.Vital(MyChar.UID, 26, MyChar.GetStat()));
                                        SendPacket(General.MyPackets.SendMsg(MessageId, "SYSTEM", MyChar.Name, "You now have " + MyChar.Points + " Points left.", 2005));

                                    }
                                }
                                if (Control == 6)
                                {
                                    if (MyChar.InventoryContains(1088001, 1))
                                    {
                                        MyChar.Points += 15;
                                        MyChar.RemoveItem(1088001);

                                    }
                                }
                                if (Control == 7)
                                {
                                    if (MyChar.InventoryContains(1088000, 1))
                                    {
                                        MyChar.Points += 35;
                                        MyChar.RemoveItem(1088000);

                                    }
                                }
                                if (Control == 8)
                                    {
                                        if (MyChar.Points >= 100)
                                        {
                                            MyChar.VP += 10000 ;
                                            MyChar.Points -= 100;
                                            MyChar.MyClient.SendPacket(General.MyPackets.Vital(MyChar.UID, 26, MyChar.GetStat()));
                                            SendPacket(General.MyPackets.SendMsg(MessageId, "SYSTEM", MyChar.Name, "You now have " + MyChar.Points + " Points left.", 2005));
                                            

                                        }
                                    }
                                if (Control == 9)
                                {
                                    if (MyChar.Points >= 900)
                                    {
                                    if (MyChar.Level < 100)
                                            MyChar.AddExp((ulong)(12950000 + MyChar.Level * 400000), false);
                                        else if (MyChar.Level < 110)
                                            MyChar.AddExp((ulong)(13950000 + MyChar.Level * 700000), false);
                                        else if (MyChar.Level < 115)
                                            MyChar.AddExp((ulong)(15950000 + MyChar.Level * 900000), false);
                                        else if (MyChar.Level < 120)
                                            MyChar.AddExp((ulong)(18950000 + MyChar.Level * 1100000), false);
                                        else if (MyChar.Level < 125)
                                            MyChar.AddExp((ulong)(20950000 + MyChar.Level * 1400000), false);
                                        else if (MyChar.Level < 130)
                                            MyChar.AddExp((ulong)(23950000 + MyChar.Level * 1700000), false);
                                        else if (MyChar.Level < 135)
                                            MyChar.AddExp((ulong)(28950000 + MyChar.Level * 1900000), false);
                                        MyChar.Points -= 900;
                                        SendPacket(General.MyPackets.Vital((long)MyChar.UID, 5, MyChar.Exp));
                                        SendPacket(General.MyPackets.SendMsg(MessageId, "SYSTEM", MyChar.Name, "You now have " + MyChar.Points + " Points left.", 2005));

                                    }
                                }
                                if (Control == 10)
                                {
                                    if (MyChar.Points >= 75)
                                    {
                                        MyChar.AddItem("1088000-0-0-0-0-0", 0, (uint)General.Rand.Next(36457836));
                                        MyChar.Points -= 75;
                                        SendPacket(General.MyPackets.SendMsg(MessageId, "SYSTEM", MyChar.Name, "You now have " + MyChar.Points + " Points left.", 2005));

                                    }
                                }
                                if (Control == 11)
                                {
                                    if (MyChar.Points >= 750)
                                    {
                                        if (!MyChar.Blessed)
                                        {
                                            MyChar.HBStart = DateTime.Now;
                                           MyChar.HBEnd = DateTime.Now.AddDays(3);
                                            MyChar.WhichBless = 1;
                                            MyChar.Blessed = true;
                                            MyChar.MyClient.SendPacket(General.MyPackets.Vital(MyChar.UID, 18, (3 * 24 * 60 * 60)));
                                            MyChar.MyClient.SendPacket(General.MyPackets.Vital(MyChar.UID, 26, MyChar.GetStat()));
                                           
                                            World.UpdateSpawn(MyChar);
                                            MyChar.SaveHB();
                                            MyChar.MyClient.SendPacket(General.MyPackets.String(MyChar.UID, 10, "zf2-e128"));
                                            MyChar.Points -= 750;
                                            SendPacket(General.MyPackets.SendMsg(MessageId, "SYSTEM", MyChar.Name, "You now have " + MyChar.Points + " Points left.", 2005));
                                        }
                                        else
                                        {
                                            MyChar.MyClient.SendPacket(General.MyPackets.SendMsg(MyChar.MyClient.MessageId, "SYSTEM", MyChar.Name, "You already have Heavens Blessing!", 2005));
                                        }
                                        

                                    }
                                }
                                if (Control == 12)
                                {
                                    if (MyChar.Points >= 500)
                                    {
                                        int AddSilv = General.Rand.Next(10000000, 20000000);
                                        MyChar.Silvers += (uint)AddSilv;
                                        MyChar.Points -= 500;
                                        SendPacket(General.MyPackets.Vital(MyChar.UID, 4, MyChar.Silvers));
                                        SendPacket(General.MyPackets.SendMsg(MessageId, "SYSTEM", MyChar.Name, "You now have " + MyChar.Points + " Points left.", 2005));
                                       

                                    }
                                }
                                MyChar.SavePoints();
                          }

Search for : if (CurrentNPC == 390)
Above it ,add:

Code:
if (CurrentNPC == 3900)//PointNPC1
                            {
                                SendPacket(General.MyPackets.NPCSay("Hello,I am the points NPC. I can give you points for your items, or vice versa"));
                                SendPacket(General.MyPackets.NPCSay("Your current points is : " + MyChar.Points));
                                SendPacket(General.MyPackets.NPCSay("Look at my options,intresed in any?"));
                                SendPacket(General.MyPackets.NPCLink("I'd like to buy points", 1));
                                SendPacket(General.MyPackets.NPCLink("I'd like to sell points", 2));
                                SendPacket(General.MyPackets.NPCLink("Nevermind", 255));
                                SendPacket(General.MyPackets.NPCSetFace(30));
                                SendPacket(General.MyPackets.NPCFinish());
                            }

Search for :
User.BlueName = true;

you will find two, under both,add this:

Code:
User.Points += 25;
                                    Player.Points -= 25;
                                    User.MyClient.SendPacket(General.MyPackets.SendMsg(User.MyClient.MessageId, "SYSTEM", User.Name, "You took 25 points from your target!", 2005));
                                    User.MyClient.SendPacket(General.MyPackets.SendMsg(Player.MyClient.MessageId, "SYSTEM", Player.Name, "You lost 25 points by dying!", 2005));
Search for : else if (ItemParts[0] == "723700"
Under it , add:

Code:
 else if (ItemParts[0] == "780001")//PointCardS
            {
                Points += 40;
                MyClient.SendPacket(General.MyPackets.SendMsg(MyClient.MessageId, "SYSTEM", Name, "You gained 40 Points! You now have " + Points + " Points.", 2005));
           RemoveItem(ItemUID);
            }
            else if (ItemParts[0] == "780000")//PointCard
            {
                Points += 120;
                MyClient.SendPacket(General.MyPackets.SendMsg(MyClient.MessageId, "SYSTEM", Name, "You gained 120 Points! You now have " + Points + " Points.", 2005));
                RemoveItem(ItemUID);
            }
In Character.cs , add:

Code:
public uint Points = 0;


OH MY GOD,GOTTA SLEEP,IM DYING. Now add an npc with id 3900 somewhere and add a new Points for it in character table in database.



Never tested the code,ever never,so you test it.. GOODNIGHT!!


Emme
11/01/2008 01:31 © Haydz#2
So, Just like CPs?. lol
11/01/2008 02:12 demonscim#3
:p.. you can't lose cps by getting pked, or from lotto :o.. but i guess you could say that :p
11/01/2008 09:32 ~jochemke~#4
well can be funny if it works
gonna try as soon as i can
11/01/2008 09:40 MeGaMaX#5
Yoooo Thanks Emme
11/01/2008 09:45 _Emme_#6
Press thanks if you're happy with it.I did not try it one single time,so report any bugs.

Thanks
11/01/2008 09:46 leavemealone#7
Rather useless, but in this sorta theory should create an Honor System
11/01/2008 10:43 randomnoob#8
you forgot something, it doesnt save your way i think.

just keep searching for vp and add copie it and change vp to points.
11/01/2008 11:40 _Emme_#9
It does save, look at the top two codes.
11/01/2008 13:38 Exia13#10
Another great release :D
11/01/2008 13:50 IAmHawtness#11
I fooled around with a private server some time ago, and made a similar system, although you didn't get "Points" for PKing, you gained CPs. Monsters didn't drop Meteors and DragonBalls, and they didn't give XP, they only dropped items.

You could make a very cool PvP based server with similar systems.
Nice thinking, Emme.
11/01/2008 15:42 adz06676#12
this is pretty much pointless whats wrong with using cps?
11/02/2008 22:31 DungMaster#13
Emme you make a good work , but your points don't save.. :(
11/03/2008 00:31 Tw3ak#14
Quote:
Originally Posted by DungMaster View Post
Emme you make a good work , but your points don't save.. :(
You have to add points to your database class where it reads char info when char is loading.

It should save the info fine if ya added it right but there is no code to retrieve it when each character logs in you need to go to your database class
and find where it loads all character info and add points to it then it will load them everytime.

This also needs to be done with emme's heavensblessing to work right otherwise it will save the info but not load what was saved when u log off and back on.

Or better yet better way is to have server read ALL your char info when logging in with simpler variables then standard lotf has but i won't go into that now.
11/03/2008 17:29 _Emme_#15
Search for:

Quote:
Charr.VP = (uint)DR["VP"];
Above it , add:

Quote:
Charr.Points = (uint)DR["Points"];