Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Conquer Online 2 > CO2 Private Server
You last visited: Today at 17:36

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

Advertisement



Weird Problem in Elite Pk System

Discussion on Weird Problem in Elite Pk System within the CO2 Private Server forum part of the Conquer Online 2 category.

Reply
 
Old   #1
 
shadowman123's Avatar
 
elite*gold: 0
Join Date: Aug 2007
Posts: 1,525
Received Thanks: 230
Weird Problem in Elite Pk System

Well i Added the Elite pk system Like that
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Conquer_Online_Server.Database;

namespace Conquer_Online_Server.Game.Tournaments
{
    public enum Tournamet_Type
    {
        LeveL100,
        LeveL119,
        LeveL129,
        LeveL130
    }
    public enum top_typ
    {
        Elite_PK_Champion__Low_ = 12,
        Elite_PK_2nd_Place_Low_ = 13,
        Elite_PK_3rd_Place_Low_ = 14,
        Elite_PK_Top_8__Low_ = 15,

        Elite_PK_Champion_High_ = 16,
        Elite_PK_2nd_Place_High_ = 17,
        Elite_PK_3rd_Place__High_ = 18,
        Elite_PK_Top_8_High_ = 19
    }
    public class Elite_client
    {
        public uint Points = 0;
        public uint UID = 0;
        public ushort Avatar = 0;
        public ushort Mesh = 0;
        public string Name = "";
        public ushort Postion = 0;
        public byte MyTitle = 0;

        public Elite_client(Client.GameState client)
        {
            this.UID = client.Entity.UID;
            this.Avatar = client.Entity.Face;
            this.Mesh = client.Entity.Body;
            this.Name = client.Entity.Name;

        }
        public Elite_client(uint _uid, ushort _avatar, ushort _mesh, string _name, uint _points, ushort Position, byte Tytle)
        {
            this.MyTitle = Tytle;
            this.Postion = Position;
            this.Points = _points;
            this.UID = _uid;
            this.Avatar = _avatar;
            this.Mesh = _mesh;
            this.Name = _name;
        }
    }
    public class EliteTournament
    {

        public static Dictionary<uint, Elite_client> Elite_PK_Tournament = new Dictionary<uint, Elite_client>(500);
        public static Dictionary<uint, Elite_client> Top8 = new Dictionary<uint, Elite_client>(10);

        public void LoginClient(Client.GameState client)
        {
            if (!Start)
            {
                if (Top8.ContainsKey(client.Entity.UID))
                {
                    client.Entity.Elite = Top8[client.Entity.UID];
                    CreatePacket(client);
                }
            }
        }
        public void CreatePacket(Client.GameState client)
        {
            client.Entity.TitlePacket = new Network.GamePackets.TitlePacket(true);
            client.Entity.TitlePacket.UID = client.Entity.UID;
            client.Entity.TitlePacket.Type = 4;
            client.Entity.TitlePacket.dwParam = 1;
            client.Entity.TitlePacket.dwParam2 = Top8[client.Entity.UID].MyTitle;
        }
        public void DeleteTabelInstances()
        {
            foreach (Elite_client client in Top8.Values)
            {
                MySqlCommand cmd = new MySqlCommand(MySqlCommandType.DELETE);
                int res = cmd.Delete("elitepk", "UID", client.UID).Execute();
            }
        }
        public void LoadTop8()
        {
            MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT);
            cmd.Select("elitepk");
            MySqlReader r = new MySqlReader(cmd);
            while (r.Read())
            {
                Elite_client client = new Elite_client(
                    r.ReadUInt32("UID")
                    , r.ReadUInt16("Avatar")
                    , r.ReadUInt16("Mesh")
                    , r.ReadString("Name")
                    , r.ReadUInt32("Points")
                    , r.ReadUInt16("Postion")
                    , r.ReadByte("MyTitle")
                    );
                if (!Top8.ContainsKey(client.UID))
                    Top8.Add(client.UID, client);
            }
            r.Close();
        }
        public void SaveTop8()
        {
            foreach (Elite_client client in Top8.Values)
            {
                MySqlCommand cmd = new MySqlCommand(MySqlCommandType.INSERT);
                cmd.Insert("elitepk")
                    .Insert("UID", client.UID).Insert("Avatar", client.Avatar)
                    .Insert("Mesh", client.Mesh).Insert("Name", client.Name)
                    .Insert("Points", client.Points).Insert("Postion", client.Postion)
                    .Insert("MyTitle", client.MyTitle);
                cmd.Execute();
            }
        }
        public EliteTournament() { LoadTop8(); }
        public void Open()
        {
            if (!Start)
            {
                DeleteTabelInstances();
                Start = true;
                CalculateTime = DateTime.Now;
                StartTimer = DateTime.Now;
                SendInvitation();
                Elite_PK_Tournament.Clear();
                Top8.Clear();
            }
        }
        public void Open(int hour, int minute)
        {
            if (DateTime.Now.Minute == minute && DateTime.Now.Hour == hour)
            {
                if (!Start)
                {
                    DeleteTabelInstances();
                    Start = true;
                    CalculateTime = DateTime.Now;
                    StartTimer = DateTime.Now;
                    SendInvitation();
                    Elite_PK_Tournament.Clear();
                    Top8.Clear();
                }
            }
        }
        public void SendInvitation()
        {
            Client.GameState[] client = Conquer_Online_Server.ServerBase.Kernel.GamePool.Values.ToArray();
            foreach (Client.GameState clientss in client)
            {
                Network.GamePackets.NpcReply npc = new Network.GamePackets.NpcReply(6, "The Elite Tournament has Started! You Wana Join?");
                npc.OptionID = 249;
                clientss.Send(npc.ToArray());
            }
        }
        private DateTime CalculateTime;
        public void SendThis()
        {
            if (Start)
            {
                if (DateTime.Now > CalculateTime.AddSeconds(7))
                {
                    CalculateTime = DateTime.Now;

                    CalculateRank();

                    Client.GameState[] Clients = Conquer_Online_Server.ServerBase.Kernel.GamePool.Values.ToArray();
                    foreach (Client.GameState client in Clients)
                    {
                        if (client.Entity.MapID == Mapid)
                        {
                            SendScore(client);
                        }
                    }
                    Finish();
                }
            }
        }
        public void Finish()
        {
            if (Start)
            {
                if (DateTime.Now > StartTimer.AddMinutes(15))
                {
                    CalculateRank();
                    Client.GameState[] Clients = Conquer_Online_Server.ServerBase.Kernel.GamePool.Values.ToArray();
                    foreach (Client.GameState client in Clients)
                    {
                        if (client.Entity.MapID == Mapid)
                        {
                            this.ObtinedOutCoord(client);
                            this.ObtinedReward(client);
                        }
                    }
                    SaveTop8();
                    Start = false;
                }
            }

        }
        public void ObtinedReward(Client.GameState client)
        {
            switch (client.Entity.Elite.Postion)
            {
                case 1:
                    {
                        client.Entity.Elite.MyTitle = (byte)top_typ.Elite_PK_Champion_High_;
                        client.Entity.ConquerPoints += 100000;
                        break;
                    }
                case 2:
                    {
                        client.Entity.Elite.MyTitle = (byte)top_typ.Elite_PK_2nd_Place_High_;
                        client.Entity.ConquerPoints += 50000;
                        break;
                    }
                case 3:
                    {
                        client.Entity.Elite.MyTitle = (byte)top_typ.Elite_PK_3rd_Place__High_;
                        client.Entity.ConquerPoints += 30000;
                        break;
                    }
                default:
                    {
                        client.Entity.Elite.MyTitle = (byte)top_typ.Elite_PK_Top_8_High_;
                        client.Entity.ConquerPoints += 10000;
                        break;
                    }
            }
            CreatePacket(client);
        }
        public DateTime StartTimer;
        public bool Start = false;
        private ushort Mapid = 6002;

        public void AddMap(Client.GameState client)
        {

            if (Start)
            {


                client.Entity.Elite = new Elite_client(client);
                if (!Elite_PK_Tournament.ContainsKey(client.Entity.UID))
                    Elite_PK_Tournament.Add(client.Entity.Elite.UID, client.Entity.Elite);
                else
                {
                    Elite_PK_Tournament[client.Entity.UID].Points = 0;
                }
                ObtinedCoord(client);
            }
        }
        public void ObtinedOutCoord(Client.GameState client)
        {
            byte Rand = (byte)Conquer_Online_Server.ServerBase.Kernel.Random.Next(1, 4);
            switch (Rand)
            {
                case 1: client.Entity.Teleport(1002, 391, 371); break;
                case 2: client.Entity.Teleport(1002, 392, 323); break;
                case 3: client.Entity.Teleport(1002, 475, 373); break;
                case 4: client.Entity.Teleport(1002, 405, 246); break;
            }
        }
        public void ObtinedCoord(Client.GameState client)
        {
            byte Rand = (byte)Conquer_Online_Server.ServerBase.Kernel.Random.Next(1, 10);
            switch (Rand)
            {
                case 1: client.Entity.Teleport(Mapid, 17, 80); break;
                case 2: client.Entity.Teleport(Mapid, 47, 99); break;
                case 3: client.Entity.Teleport(Mapid, 101, 118); break;
                case 4: client.Entity.Teleport(Mapid, 141, 109); break;
                case 5: client.Entity.Teleport(Mapid, 88, 50); break;
                case 6: client.Entity.Teleport(Mapid, 78, 23); break;
                case 7: client.Entity.Teleport(Mapid, 63, 47); break;
                case 8: client.Entity.Teleport(Mapid, 72, 79); break;
                case 9: client.Entity.Teleport(Mapid, 94, 95); break;
                case 10: client.Entity.Teleport(Mapid, 121, 114); break;
            }
        }
        public void SendScore(Client.GameState client)
        {

            if (Start)
            {
                for (uint x = 1; x < 9; x++)
                {
                    string Mesage = "";
                    foreach (Elite_client clients in Top8.Values)
                    {
                        if (clients.Postion == x)
                        {
                            Mesage = "No." + x + " " + clients.Name + ": Score: " + clients.Points + "";
                        }
                    }
                    Network.GamePackets.Message msg = new Network.GamePackets.Message(Mesage, System.Drawing.Color.Red, x == 1 ? Network.GamePackets.Message.FirstRightCorner : Network.GamePackets.Message.ContinueRightCorner);
                    client.Send(msg);
                }
            }
        }
        public void CalculateRank()
        {
            if (Start)
            {
                Dictionary<uint, ulong> ToIndex = new Dictionary<uint, ulong>();
                uint CurKey = 0; int Rank = 1;
                for (short x = 0; x < Elite_PK_Tournament.Count; x++)
                {
                    if (Rank == 9)
                        break;
                    ulong Value = 0;
                    foreach (uint K in Elite_PK_Tournament.Keys)
                    {
                        if (Elite_PK_Tournament[K].Points >= Value && !ToIndex.ContainsKey(K))
                        {
                            Value = Elite_PK_Tournament[K].Points; CurKey = K;
                        }
                    }
                    if (!ToIndex.ContainsKey(CurKey))
                        ToIndex.Add(CurKey, Value);
                    if (Elite_PK_Tournament.ContainsKey(CurKey))
                    {
                        Elite_PK_Tournament[CurKey].Postion = (ushort)Rank;
                    }
                    Rank++;
                }
                lock (Top8)
                {
                    Top8.Clear();
                    for (byte x = 1; x < 10; x++)
                    {
                        foreach (Elite_client client in Elite_PK_Tournament.Values)
                        {
                            if (client.Postion == x)
                            {
                                Top8.Add(client.UID, client);
                            }
                        }
                    }
                }
            }
        }
    }
}
And i created Npc to Test Awards but when i claim it it give me Error in Gui Heres Code of Testing titles by using npc (No1 tell me that i can use Command for it i just test Npc cuz of Elite pk Awards)
btw When i Find it It Stands on Client.Entity.Elite.Title Line i dont know y although i added Elite Pk Saving , loading system in my database
Code:
client.Entity.Elite.MyTitle = (byte)top_typ.Elite_PK_Champion_High_;
                                    client.Entity.Elite.UID = client.Entity.UID;
                                    client.Inventory.Add(720717, 0, 1);
Here is the Error

Code:
System.NullReferenceException: Object reference not set to an instance of an object.
   at Conquer_Online_Server.Dialogs.GetDialog(NpcRequest npcRequest, GameState client) in B:\1.Conquer World\Conquer Making\CrazyZeroVb.V.2\NPCS.cs:line 13884
   at Conquer_Online_Server.Network.PacketHandler.HandlePacket(Byte[] packet, GameState client) in B:\1.Conquer World\Conquer Making\CrazyZeroVb.V.2\Network\PacketHandler.cs:line 1616
   at Conquer_Online_Server.Network.PacketHandler.HandleBuffer(Byte[] buffer, GameState client) in B:\1.Conquer World\Conquer Making\CrazyZeroVb.V.2\Network\PacketHandler.cs:line 52
   at Conquer_Online_Server.Program.GameServer_AnnounceReceive(Byte[] arg1, ISocketWrapper arg2) in B:\1.Conquer World\Conquer Making\CrazyZeroVb.V.2\Program.cs:line 1582
   at Conquer_Online_Server.Network.Sockets.AsyncSocket.AsyncReceive(IAsyncResult res) in B:\1.Conquer World\Conquer Making\CrazyZeroVb.V.2\Network\Sockets\AsyncSocket.cs:line 89

shadowman123 is offline  
Old 11/26/2011, 05:18   #2
 
elite*gold: 0
Join Date: Sep 2011
Posts: 40
Received Thanks: 1
hhhh
u use kimo source
there are more of bug
i think u make special PS source
dont use kimo source
this is my advice

problem in
line 13884
Ctrl+G
and write 13884
and u will see line

problem in
line 13884
Ctrl+G
and write 13884
and u will see line
mohamedmashhot is offline  
Old 11/26/2011, 05:32   #3
 
shadowman123's Avatar
 
elite*gold: 0
Join Date: Aug 2007
Posts: 1,525
Received Thanks: 230
Quote:
Originally Posted by mohamedmashhot View Post
hhhh
u use kimo source
there are more of bug
i think u make special PS source
dont use kimo source
this is my advice

problem in
line 13884
Ctrl+G
and write 13884
and u will see line

problem in
line 13884
Ctrl+G
and write 13884
and u will see line
Kimo Source only Have Refineries Work but i Fixed Every Single Bug and i Added Capture The Flag Quest but it needs Testing Anywas i already did that and When i Find it It Stands on Client.Entity.Elite.Title Line i dont know y although i added Elite Pk Saving , loading system in my database
shadowman123 is offline  
Old 11/26/2011, 06:27   #4
 
elite*gold: 0
Join Date: Sep 2011
Posts: 40
Received Thanks: 1
u cane edit
anything in database and test source after it?
edit anything in entity table and then go to kill monster and see inventory
and reply on me
what is happens
mohamedmashhot is offline  
Old 11/26/2011, 07:03   #5
 
shadowman123's Avatar
 
elite*gold: 0
Join Date: Aug 2007
Posts: 1,525
Received Thanks: 230
Dude i Exchanged the Database system With Eragon One
shadowman123 is offline  
Old 11/26/2011, 07:06   #6
 
elite*gold: 0
Join Date: Sep 2011
Posts: 40
Received Thanks: 1
you mean that you change database system?
mohamedmashhot is offline  
Old 11/26/2011, 07:39   #7
 
shadowman123's Avatar
 
elite*gold: 0
Join Date: Aug 2007
Posts: 1,525
Received Thanks: 230
Quote:
Originally Posted by mohamedmashhot View Post
you mean that you change database system?
Yup and it working Properly ..Saving and loading Well
shadowman123 is offline  
Old 11/26/2011, 08:19   #8
 
elite*gold: 0
Join Date: Sep 2011
Posts: 40
Received Thanks: 1
if you change database system normally.i think you can solve this problem without any help
and get the line that have error in npcs
and see what is wrong on it

if u change it this mean u understand files in generated folder and change them.
because they depends on subsonic system.
and when you do this.
this mean u can do refinery system in any source,because you understand system
good luck
mohamedmashhot is offline  
Old 11/26/2011, 08:46   #9
 
shadowman123's Avatar
 
elite*gold: 0
Join Date: Aug 2007
Posts: 1,525
Received Thanks: 230
Quote:
Originally Posted by mohamedmashhot View Post
if you change database system normally.i think you can solve this problem without any help
and get the line that have error in npcs
and see what is wrong on it

if u change it this mean u understand files in generated folder and change them.
because they depends on subsonic system.
and when you do this.
this mean u can do refinery system in any source,because you understand system
good luck
i tried it once but i failed Anyways i just use EntityTabel , ConqueritemTable , Spells , Skills from eragon but beside what u said Kimo source said to be Stable and have Well Socket system thats y i'd like to work with it
shadowman123 is offline  
Old 11/26/2011, 09:15   #10
 
elite*gold: 0
Join Date: Sep 2011
Posts: 40
Received Thanks: 1
yes,i know
but it have more bugs
u will see after use it
ask Kimo,and Fang said this van be reference but not good for make private server
and problem will meet you.
mohamedmashhot is offline  
Old 11/26/2011, 11:07   #11
 
shadowman123's Avatar
 
elite*gold: 0
Join Date: Aug 2007
Posts: 1,525
Received Thanks: 230
i tell you what i Fixed :-
1- revivng and dropping gears
2- Multi SKill Bosses
3- Voting System
4- AutoInvite system
5- Server msgs
6-Npcs Much more Then Source have
7- Unloading item states
8- 2nd rb quest
9- Fixed Calculations Completely
10- Critical Strike System
11- SUbclasses work 100% not just Icon
12- used better Database system
13- Monk Skills works Perfectly
14- Dis City quest
15- Riding Crop Works
16- Saving and loading gears Work
17- Packets Fixed as Classes , etc
18- Events
19- pvp points
20- Observing Gears Fixed so u dont See item locked anymore
and iam working on Capture the Flag System it needs Editing but not very much i have made a progress
After all that i guess its Good Editing
shadowman123 is offline  
Old 11/26/2011, 11:41   #12
 
elite*gold: 0
Join Date: Sep 2011
Posts: 40
Received Thanks: 1
all of this i fix it
and i remember that i response on you how to fix
7- Unloading item states
but it deleted because i use arabic to answer on you
but the problem that still in source after use it with in time
you will see problem
and all problem you fix not technical problem but this problem in send and get data just
or class dosent exist or add npcs dialog or copy and paste from other source
i have sources better than this
and i advice you to teach c# and network programing in my answer that deleted and you will know how to sniff and get packets and you will know how to follow code
if you know any programming language it will help you
good luck
^_^
mohamedmashhot is offline  
Old 11/26/2011, 11:41   #13
 
F i n c h i's Avatar
 
elite*gold: 0
Join Date: Nov 2009
Posts: 785
Received Thanks: 421
Quote:
Originally Posted by shadowman123 View Post
i tell you what i Fixed :-
6-Npcs Much more Then Source have
Which sucks.
F i n c h i is offline  
Old 11/26/2011, 11:51   #14
 
elite*gold: 0
Join Date: Sep 2011
Posts: 40
Received Thanks: 1

ypu ask for problem of unequip
and i answer but it deleted because of arabic answer ^_^
this mean u still leech.
this mean you will never have source good
and if any problem meet you after you will change source or closer PS
take my advice

all problem you ask for them i resolve them after i download source with out asking.but after using found problem after more of using
mohamedmashhot is offline  
Old 11/26/2011, 11:52   #15
 
shadowman123's Avatar
 
elite*gold: 0
Join Date: Aug 2007
Posts: 1,525
Received Thanks: 230
Quote:
Originally Posted by F i n c h i View Post
Which sucks.
But They r effective..iam not adding Npc Shops or useless ones but i added quests [Top SPouse , Weekly pk , Hourly pk , Daily pk , Monthly Pk , ELite pk , and Normal Arena , Help Desk(Maybe its useless) , And Elite Title Tester(Will be removed Later) , Horce Race Store(Must be Removed) and Still teamdeath match npc , Kill the terrorist , Class pk so almost all of them r effective]

Quote:
Originally Posted by mohamedmashhot View Post

ypu ask for problem of unequip
and i answer but it deleted because of arabic answer ^_^
this mean u still leech.
this mean you will never have source good
and if any problem meet you after you will change source or closer PS
take my advice

all problem you ask for them i resolve them after i download source with out asking.but after using found problem after more of using
like what ?...and about Taking Codes from other source is smart Thing not bad As long as i Add what i desire and those general data Thing and unloading and i didnt know till now the house 5 ID anyways i can find whats better for me and thx for advice
shadowman123 is offline  
Reply


Similar Threads Similar Threads
Weird problem
09/29/2011 - CO2 Private Server - 0 Replies
#Closed, Fixed :D.
Some weird things about new bot detection system
08/08/2011 - DarkOrbit - 14 Replies
:confused: I do not know if I am being paranoiac, but I have noticed some strange things that are happening in the space simulator. I have noticed that after some amount of picked bonus boxes in a continuous way, there is a little stop, around five or six seconds. And after that, you can pick boxes again. Maybe this is a method that points out bot users because they can avoid that little stop. I don't know if I am being paranoiac, but this thing makes me feel uncomfortable about using a...
weird problem
08/05/2011 - CO2 Private Server - 0 Replies
well it was weird that when i finished coding an npc it comes up with so weird error..the error in case after #region but when i just refer the pointer to it it says..invalid expression and for the code it says it represent 32 bit smthing ANyways heres the pic showing that http://www5.0zz0.com/2011/08/05/04/743698916.jpg
[help]weird problem
07/30/2009 - CO2 Private Server - 5 Replies
i've tryed using like 20 different register pages there all setup right says that the account has been successfully created but when i look in phpmyadmin there is no account there so its not inserting it into the db can anyone help me with this i've been at it for 3 days now. using lotf source



All times are GMT +2. The time now is 17:36.


Powered by vBulletin®
Copyright ©2000 - 2024, 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 ©2024 elitepvpers All Rights Reserved.