Example #1
0
        public GameServer(string _gsIP, int _gsPort, string _lip)
        {
            IPAddress localip = IPAddress.Parse(_lip);
            // Console.WriteLine(localip.ToString());
            gsListen = new TcpListener(System.Net.IPAddress.Any, 7777);
            gsIP = _gsIP;
            gsPort = _gsPort;

            //initialize members
            clanlist = new Dictionary<uint, Clans>();
            enemyclans = new Dictionary<uint, Clans>();
            allplayerinfo = new Dictionary<uint, CharInfo>();
            playerlist = new Dictionary<uint, CharInfo>();
            attacklist = new Dictionary<uint, CharInfo>();
            enemylist = new Dictionary<uint, CharInfo>();
            deadlist = new Dictionary<uint, CharInfo>();
            deletedenemies = new List<uint>();
            enemynames = new List<string>();
            distanceupdates = true;
            targetselection = new Thread(this.selectTarget);
            target = null;

            shotlist = new List<shots>();
            {
                StreamReader sReader = new StreamReader(new FileStream("shotid.txt", FileMode.Open,
                    FileAccess.Read, FileShare.Read), Encoding.UTF8);

                while (true)
                {
                    string line = sReader.ReadLine();
                    if (line == null)
                        break;
                    char[] sep = new char[4];
                    sep[0] = '=';
                    sep[1] = '[';
                    sep[2] = ']';
                    sep[3] = '\t';
                    string[] split = line.Split(sep, StringSplitOptions.RemoveEmptyEntries);
                    //id = 2, name = 4
                    shots _s = new shots();
                    _s.id = Convert.ToUInt32(split[2]);
                    _s.name = split[4];

                    shotlist.Add(_s);
                }
            }
            robeids = new List<uint>();
            {
                StreamReader sReader = new StreamReader(new FileStream("robeid.txt", FileMode.Open,
                    FileAccess.Read, FileShare.Read), Encoding.UTF8);

                while (true)
                {
                    string line = sReader.ReadLine();
                    if (line == null)
                        break;
                    char[] sep = new char[4];
                    sep[0] = '=';
                    sep[1] = '[';
                    sep[2] = ']';
                    sep[3] = '\t';
                    string[] split = line.Split(sep, StringSplitOptions.RemoveEmptyEntries);
                    //id = 2, name = 4
                    uint id = Convert.ToUInt32(split[2]);
                    robeids.Add(id);
                }
            }

            lightarmor = new List<uint>();
            {
                StreamReader sReader = new StreamReader(new FileStream("lightamor.txt", FileMode.Open,
                    FileAccess.Read, FileShare.Read), Encoding.UTF8);

                while (true)
                {
                    string line = sReader.ReadLine();
                    if (line == null)
                        break;
                    char[] sep = new char[4];
                    sep[0] = '=';
                    sep[1] = '[';
                    sep[2] = ']';
                    sep[3] = '\t';
                    string[] split = line.Split(sep, StringSplitOptions.RemoveEmptyEntries);
                    //id = 2, name = 4
                    uint id = Convert.ToUInt32(split[2]);
                    lightarmor.Add(id);
                }
            }

            skills = new Dictionary<uint, string>();
            {
                StreamReader lReader = new StreamReader(new FileStream("uniquelist.txt", FileMode.Open,
                    FileAccess.Read, FileShare.Read), Encoding.UTF8);
                while (true)
                {
                    string line = lReader.ReadLine();
                    if (line == null)
                        break;
                    char[] sep = new char[3];
                    char[] sep1 = new char[2];
                    sep[0] = ' ';
                    sep[1] = '\t';
                    sep[2] = '=';
                    sep1[0] = '[';
                    sep1[1] = ']';

                    string[] splits = line.Split(sep, 6, StringSplitOptions.RemoveEmptyEntries);
                    string[] split2 = splits[5].Split(sep1, 3, StringSplitOptions.RemoveEmptyEntries);
                    skills.Add(Convert.ToUInt32(splits[2]), split2[1]);

                }
                System.Console.WriteLine("loaded skills");
            }

            clist = new List<Client>();
            leader = null;
            //start UI thread
            bwindow = new BotView(this);
            bwindow.Show();
        }
Example #2
0
        public GameServer(string _gsIP, int _gsPort, string _lip)
        {
            IPAddress localip = IPAddress.Parse(_lip);
            // Console.WriteLine(localip.ToString());
            gsListen = new TcpListener(System.Net.IPAddress.Any, 7777);
            gsIP = _gsIP;
            gsPort = _gsPort;

            commandlists = new List<string>(128);

            //initialize members
            clanlist = new Dictionary<uint, Clans>();
            enemyclans = new Dictionary<uint, Clans>();
            allplayerinfo = new Dictionary<uint, CharInfo>();
            playerlist = new Dictionary<uint, CharInfo>();
            attacklist = new Dictionary<uint, CharInfo>();
            enemylist = new Dictionary<uint, CharInfo>();
            deadlist = new Dictionary<uint, CharInfo>();
            wlist = new Dictionary<uint, WatchedPlayers>();
            deletedenemies = new List<uint>();
            enemynames = new List<string>();
            distanceupdates = true;
            targetselection = new Thread(this.selectTarget);
            target = null;

            npclist = new Dictionary<uint, Client.NPC>();
            moblist = new Dictionary<uint, Client.NPC>();

            shotlist = new List<shots>();
            {
                StreamReader sReader = new StreamReader(new FileStream("shotid.txt", FileMode.Open,
                    FileAccess.Read, FileShare.Read), Encoding.UTF8);

                while (true)
                {
                    string line = sReader.ReadLine();
                    if (line == null)
                        break;
                    char[] sep = new char[4];
                    sep[0] = '=';
                    sep[1] = '[';
                    sep[2] = ']';
                    sep[3] = '\t';
                    string[] split = line.Split(sep, StringSplitOptions.RemoveEmptyEntries);
                    //id = 2, name = 4
                    shots _s = new shots();
                    _s.id = Convert.ToUInt32(split[2]);
                    _s.name = split[4];

                    shotlist.Add(_s);
                }
            }
            robeids = new List<uint>();
            lightarmor = new List<uint>();
            {
                StreamReader lReader = new StreamReader(new FileStream("armor.sql", FileMode.Open,
                    FileAccess.Read, FileShare.Read), Encoding.UTF8);
                while (true)
                {
                    string line = lReader.ReadLine();
                    if (line == null)
                        break;
                    if (line.Contains("--"))
                        continue;
                    if (line.Length < 6)
                        continue;
                    char[] sep = new char[4];
                    sep[0] = '('; sep[1] = ')'; sep[2] = ','; sep[3] = ';';
                    string[] splits = line.Split(sep, 6, StringSplitOptions.RemoveEmptyEntries);
                    if (splits[4] == "\'magic\'")
                    {
                        robeids.Add(Convert.ToUInt32(splits[0]));
                    }
                    if (splits[4] == "\'light\'")
                    {
                        lightarmor.Add(Convert.ToUInt32(splits[0]));
                    }

                }
            }
            Console.WriteLine("{0} in robe and {1} in light", robeids.Count, lightarmor.Count);

            itemlist = new Dictionary<uint, Items>();
            {
                StreamReader lReader = new StreamReader(new FileStream("etcitem.sql", FileMode.Open,
                    FileAccess.Read, FileShare.Read), Encoding.UTF8);
                while (true)
                {
                    string line = lReader.ReadLine();
                    if (line == null)
                        break;
                    if (line.Contains("--"))
                        continue;
                    if (line.Length < 6)
                        continue;
                    char[] sep = new char[4];
                    sep[0] = '('; sep[1] = ')'; sep[2] = ','; sep[3] = ';';
                    string[] splits = line.Split(sep, 6, StringSplitOptions.RemoveEmptyEntries);
                    try
                    {
                        Items i = new Items();
                        i.id = Convert.ToUInt32(splits[0]);
                        i.name = splits[1];
                        itemlist.Add(i.id, i);

                    }
                    catch
                    {
                    }
                }
            }

            Console.WriteLine("Item count = {0}", itemlist.Count);

            skills = new Dictionary<uint, skillmap>();
            {
                StreamReader lReader = new StreamReader(new FileStream("skill_trees.sql", FileMode.Open,
                    FileAccess.Read, FileShare.Read), Encoding.UTF8);
                while (true)
                {
                    string line = lReader.ReadLine();
                    if (line == null)
                        break;
                    if (line.Contains("--"))
                        continue;
                    if (line.Length < 6)
                        continue;
                    char[] sep = new char[5];
                    sep[0] = '('; sep[1] = ')'; sep[2] = ','; sep[3] = '\''; sep[4] = ';';
                    string[] splits = line.Split(sep, 6, StringSplitOptions.RemoveEmptyEntries);
                    uint skillid = Convert.ToUInt32(splits[1]);
                    skillmap s = new skillmap();
                    s.id = skillid;
                    s.name = splits[3];
                    if (!skills.ContainsKey(skillid))
                        skills.Add(skillid, s);

                }
            }

            clist = new List<Client>();
            leader = null;
            //start UI thread
            bwindow = new BotView(this);
            bwindow.Show();
        }