Пример #1
0
        public void Parse(string inp)
        {
            int pipe = 0, oldpipe = 0;

            //ID
            pipe    = inp.IndexOf('|', oldpipe);
            ID      = Util.GetUInt32(inp.Substring(oldpipe, pipe - oldpipe));
            oldpipe = pipe + 1;
            //Name
            pipe    = inp.IndexOf('|', oldpipe);
            Name    = inp.Substring(oldpipe, pipe - oldpipe);
            oldpipe = pipe + 1;
            //Add_Name
            pipe     = inp.IndexOf('|', oldpipe);
            Add_Name = inp.Substring(oldpipe, pipe - oldpipe);
            oldpipe  = pipe + 1;
            //Description
            pipe        = inp.IndexOf('|', oldpipe);
            Description = inp.Substring(oldpipe, pipe - oldpipe);
            oldpipe     = pipe + 1;
            //Special_Enchant_Amount
            pipe = inp.IndexOf('|', oldpipe);
            if (pipe == -1)
            {
                Special_Enchant_Amount = Util.GetInt32(inp.Substring(oldpipe, inp.Length - oldpipe));
                return;
            }
            Special_Enchant_Amount = Util.GetInt32(inp.Substring(oldpipe, pipe - oldpipe));
            oldpipe = pipe + 1;
            //Special_Enchant_Desc
            Special_Enchant_Desc = inp.Substring(oldpipe, inp.Length - oldpipe);
        }
Пример #2
0
        private void button_gg_connect_Click(object sender, EventArgs e)
        {
            Globals.GG_Clientmode = true;
            try
            {
                m_clientSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);

                Globals.gamedata.GG_IP   = textBox_gg_srv_ip.Text;
                Globals.gamedata.GG_Port = Util.GetInt32(textBox_gg_srv_port.Text);

                // Set the remote IP address
                IPAddress ip      = IPAddress.Parse(Globals.gamedata.GG_IP);
                int       iPortNo = Globals.gamedata.GG_Port;
                // Create the end point
                IPEndPoint ipEnd = new IPEndPoint(ip, iPortNo);
                // Connect to the remote host
                m_clientSocket.Connect(ipEnd);
                if (m_clientSocket.Connected)
                {
                    Globals.l2net_home.Add_Text(String.Format("Connected to: {0}:{1}", textBox_gg_srv_ip.Text, textBox_gg_srv_port.Text), Globals.Yellow, TextType.BOT);
                    button_gg_connect.Enabled = false;
                    //Wait for data asynchronously
                    WaitForData();
                    this.Close();
                }
            }
            catch (SocketException se)
            {
                Globals.l2net_home.Add_Text("Connection failed, is the server running? Exception: " + se.Message, Globals.Red, TextType.BOT);
            }
        }
Пример #3
0
        private void button_gg_listen_Click(object sender, EventArgs e)
        {
            Globals.gamedata.GG_IP   = textBox_gg_local_ip.Text;
            Globals.gamedata.GG_Port = Util.GetInt32(textBox_gg_local_port.Text);
            System.Net.IPAddress ipAd = System.Net.IPAddress.Parse(Globals.gamedata.GG_IP);

            Globals.GG_Servermode = true;
            try
            {
                // Create the listening socket...
                m_mainSocket = new Socket(AddressFamily.InterNetwork,
                                          SocketType.Stream,
                                          ProtocolType.Tcp);
                IPEndPoint ipLocal = new IPEndPoint(ipAd, Globals.gamedata.GG_Port);
                // Bind to local IP Address...
                m_mainSocket.Bind(ipLocal);
                // Start listening...
                m_mainSocket.Listen(4);
                // Create the call back for any client connections...
                m_mainSocket.BeginAccept(new AsyncCallback(OnClientConnect), null);
            }
            catch (SocketException se)
            {
                MessageBox.Show(se.Message);
            }

            button_gg_listen.Enabled = false;
            Globals.l2net_home.Add_Text(String.Format("Gameguard server started on: {0}:{1}", Globals.gamedata.GG_IP, Globals.gamedata.GG_Port), Globals.Yellow, TextType.BOT);
            this.Close();
        }
Пример #4
0
        private static void LoadSkills()
        {
            try
            {
                string loaded;

                byte[]       dec;
                StreamReader temp_stream;
                MemoryStream mem_stream;

                dec = GetData(data_skillname, "br2qeSw65ephepH8");

                mem_stream  = new MemoryStream(dec);
                temp_stream = new StreamReader(mem_stream);

                int version = Util.GetInt32(temp_stream.ReadLine());

                if (version < Globals.MinDataPack)
                {
                    System.Windows.Forms.MessageBox.Show("skillname.txt is too old for this version of L2.Net!");
                    System.Windows.Forms.Application.Exit();
                }

                Globals.skilllist          = new SortedList();
                Globals.skilllist.Capacity = Globals.COUNT_SKILLS;

                while ((loaded = temp_stream.ReadLine()) != null)
                {
                    SkillInfo sk_inf = new SkillInfo();

                    sk_inf.Parse(loaded);

                    if (Globals.skilllist.IndexOfKey(sk_inf.ID) == -1)
                    {
                        //the key wasnt found
                        SkillList skill = new SkillList();

                        Globals.skilllist.Add(sk_inf.ID, skill);
                    }

                    ((SkillList)Globals.skilllist[sk_inf.ID]).Add_Level(sk_inf);
                }

                mem_stream.Close();
                temp_stream.Close();

                //Add_Text("loaded skills", Globals.Red);

                dec = null;
            }
            catch (Exception e)
            {
                throw new Exception("Error during LoadSkill: " + e.Message);
            }
        }
Пример #5
0
        private void Script_SEND_EMAIL(string line)
        {
            string _from   = Get_String(ref line);
            string _to     = Get_String(ref line);
            string _sub    = Get_String(ref line);
            string _body   = Get_String(ref line);
            string _server = Get_String(ref line);
            int    _port   = Util.GetInt32(Get_String(ref line));

            Util.Send_Email(_from, _to, _sub, _body, _server, _port);
        }
Пример #6
0
        private static void LoadXP()
        {
            string loaded;

            byte[] dec;
            System.IO.StreamReader temp_stream;
            System.IO.MemoryStream mem_stream;

#if !DEBUG
            try
            {
#endif
            dec = GetData(data_lvlexp, "<M4H90ag7{_j6~3[");

            mem_stream  = new System.IO.MemoryStream(dec);
            temp_stream = new System.IO.StreamReader((System.IO.Stream)mem_stream);

            int version = Util.GetInt32(temp_stream.ReadLine());
            if (version < Globals.MinDataPack)
            {
                System.Windows.Forms.MessageBox.Show("lvlexp.txt is too old for this version of L2.Net!");
                System.Windows.Forms.Application.Exit();
            }

            Globals.levelexp = new SortedList();

            while ((loaded = temp_stream.ReadLine()) != null)
            {
                int pipe;
                //lvl
                pipe = loaded.IndexOf('|');
                uint lvl = Util.GetUInt32(loaded.Substring(0, pipe));
                //xp
                ulong xp = Util.GetUInt64(loaded.Substring(pipe + 1, loaded.Length - pipe - 1));

                Globals.levelexp.Add(lvl, xp);
            }

            mem_stream.Close();
            temp_stream.Close();

            //Add_Text("loaded lvlexp", Globals.Red);
#if !DEBUG
        }

        catch
        {
            Globals.l2net_home.Add_PopUpError("failed to load data\\lvlexp.txt");
        }
#endif

            dec = null;
        }
Пример #7
0
        public void Parse(string inp)
        {
            int pipe = 0, oldpipe = 0;

            //ID
            pipe    = inp.IndexOf('|', oldpipe);
            ID      = Util.GetUInt32(inp.Substring(oldpipe, pipe - oldpipe));
            oldpipe = pipe + 1;
            //Type
            pipe    = inp.IndexOf('|', oldpipe);
            Type    = Util.GetInt32(inp.Substring(oldpipe, pipe - oldpipe));
            oldpipe = pipe + 1;
            //Category
            pipe     = inp.IndexOf('|', oldpipe);
            Category = Util.GetInt32(inp.Substring(oldpipe, pipe - oldpipe));
            oldpipe  = pipe + 1;
            //cat2_cnt
            pipe     = inp.IndexOf('|', oldpipe);
            cat2_cnt = Util.GetInt32(inp.Substring(oldpipe, pipe - oldpipe));
            oldpipe  = pipe + 1;
            //Name
            pipe    = inp.IndexOf('|', oldpipe);
            Name    = inp.Substring(oldpipe, pipe - oldpipe);
            oldpipe = pipe + 1;
            //Icon
            pipe    = inp.IndexOf('|', oldpipe);
            Icon    = inp.Substring(oldpipe, pipe - oldpipe);
            oldpipe = pipe + 1;
            //Desc
            pipe = inp.IndexOf('|', oldpipe);
            if (pipe == -1)
            {
                Desc = inp.Substring(oldpipe, inp.Length - oldpipe);
                return;
            }
            else
            {
                Desc    = inp.Substring(oldpipe, pipe - oldpipe);
                oldpipe = pipe + 1;
            }
            //Cmd
            pipe = inp.IndexOf('|', oldpipe);
            if (pipe == -1)
            {
                Cmd = inp.Substring(oldpipe, inp.Length - oldpipe);
                return;
            }
            else
            {
                Cmd     = inp.Substring(oldpipe, pipe - oldpipe);
                oldpipe = pipe + 1;
            }
        }
Пример #8
0
        private static void LoadNPCName()
        {
            string loaded;

            byte[] dec;
            System.IO.StreamReader temp_stream;
            System.IO.MemoryStream mem_stream;

            try
            {
                dec = GetData(data_npcname, "c8c2xagUga5enE7A");

                mem_stream  = new System.IO.MemoryStream(dec);
                temp_stream = new System.IO.StreamReader((System.IO.Stream)mem_stream);

                int version = Util.GetInt32(temp_stream.ReadLine());
                if (version < Globals.MinDataPack)
                {
                    System.Windows.Forms.MessageBox.Show("npcname.txt is too old for this version of L2.Net!");
                    System.Windows.Forms.Application.Exit();
                }

                Globals.npcname          = new SortedList();
                Globals.npcname.Capacity = Globals.COUNT_NPCNAME;

                while ((loaded = temp_stream.ReadLine()) != null)
                {
                    NPCName npcnm = new NPCName();

                    npcnm.Parse(loaded);

                    Globals.npcname.Add(npcnm.ID, npcnm);
                }

                mem_stream.Close();
                temp_stream.Close();

                NPCName null_npc = new NPCName();
                null_npc.ID   = 0;
                null_npc.Name = "null npc";
                Globals.npcname.Add((uint)0, null_npc);

                //Add_Text("loaded npcname", Globals.Red);
            }
            catch
            {
                Globals.l2net_home.Add_PopUpError("failed to load data\\npcname.txt");
            }

            dec = null;
        }
Пример #9
0
        private static void LoadHennaGrp()
        {
            string loaded;

            byte[] dec;
            System.IO.StreamReader temp_stream;
            System.IO.MemoryStream mem_stream;

            try
            {
                dec = GetData(data_hennagrp, "8Er5FREjaCen7Thu");

                mem_stream  = new System.IO.MemoryStream(dec);
                temp_stream = new System.IO.StreamReader((System.IO.Stream)mem_stream);

                int version = Util.GetInt32(temp_stream.ReadLine());
                if (version < Globals.MinDataPack)
                {
                    System.Windows.Forms.MessageBox.Show("hennagrp.txt is too old for this version of L2.Net!");
                    System.Windows.Forms.Application.Exit();
                }

                Globals.hennagrp          = new SortedList();
                Globals.hennagrp.Capacity = Globals.COUNT_HENNAGROUP;

                while ((loaded = temp_stream.ReadLine()) != null)
                {
                    HennaGroup hengrp = new HennaGroup();

                    hengrp.Parse(loaded);

                    Globals.hennagrp.Add(hengrp.ID, hengrp);
                }

                mem_stream.Close();
                temp_stream.Close();

                HennaGroup null_dye = new HennaGroup();
                null_dye.ID   = 0;
                null_dye.Name = "no dye";
                Globals.hennagrp.Add((uint)0, null_dye);

                //Add_Text("loaded hennagrp", Globals.Red);
            }
            catch
            {
                Globals.l2net_home.Add_PopUpError("failed to load data\\hennagrp.txt");
            }

            dec = null;
        }
Пример #10
0
        private static void LoadNPCString()
        {
            string loaded;

            byte[] dec;
            System.IO.StreamReader temp_stream;
            System.IO.MemoryStream mem_stream;

            try
            {
                ///#)"(#&JH(S&ZKS=
                //dec = GetData(Globals.PATH + "\\data\\npcstring.txt");
                dec = GetData(data_npcstring, ")#&!%J)(/S)J/&%¤");

                mem_stream  = new System.IO.MemoryStream(dec);
                temp_stream = new System.IO.StreamReader((System.IO.Stream)mem_stream);

                int version = Util.GetInt32(temp_stream.ReadLine());
                if (version < Globals.MinDataPack)
                {
                    System.Windows.Forms.MessageBox.Show("npcstring.txt is too old for this version of L2.Net!");
                    System.Windows.Forms.Application.Exit();
                }

                Globals.npcstring          = new SortedList();
                Globals.npcstring.Capacity = Globals.COUNT_NPCSTRING;

                while ((loaded = temp_stream.ReadLine()) != null)
                {
                    NPCString npcstr = new NPCString();

                    npcstr.Parse(loaded);

                    Globals.npcstring.Add(npcstr.ID, npcstr);
                }

                mem_stream.Close();
                temp_stream.Close();

                //Globals.l2net_home.Add_Text("loaded npcstring", Globals.Red);
            }
            catch
            {
                Globals.l2net_home.Add_PopUpError("failed to load data\\npcstring.txt");
            }

            dec = null;
        }
Пример #11
0
        public void Parse(string inp)
        {
            int pipe;

            //FileName
            pipe     = inp.IndexOf('|');
            FileName = inp.Substring(0, pipe);
            inp      = inp.Remove(0, pipe + 1);
            //X
            pipe = inp.IndexOf('|');
            X    = Util.GetInt32(inp.Substring(0, pipe));
            inp  = inp.Remove(0, pipe + 1);
            //Y
            pipe = inp.IndexOf('|');
            Y    = Util.GetInt32(inp.Substring(0, pipe));
            inp  = inp.Remove(0, pipe + 1);
            //Z_Min
            pipe  = inp.IndexOf('|');
            Z_Min = Util.GetInt32(inp.Substring(0, pipe));
            inp   = inp.Remove(0, pipe + 1);

            pipe = inp.IndexOf('|');
            if (pipe == -1)
            {
                //Z_Max
                Z_Max = Util.GetInt32(inp);
                //Encrypted
                Encrypted = false;
            }
            else
            {
                //Z_Max
                Z_Max = Util.GetInt32(inp.Substring(0, pipe));
                inp   = inp.Remove(0, pipe + 1);
                //Encrypted
                if (Util.GetInt32(inp) == 0)
                {
                    Encrypted = false;
                }
                else
                {
                    Encrypted = true;
                }
            }

            Setup();
        }
Пример #12
0
        private static void LoadZones()
        {
            string loaded;

            byte[] dec;
            System.IO.StreamReader temp_stream;
            System.IO.MemoryStream mem_stream;

            try
            {
                dec = GetData(data_zonename, "pUB6epUC7uwraxaw");

                mem_stream  = new System.IO.MemoryStream(dec);
                temp_stream = new System.IO.StreamReader((System.IO.Stream)mem_stream);

                int version = Util.GetInt32(temp_stream.ReadLine());
                if (version < Globals.MinDataPack)
                {
                    System.Windows.Forms.MessageBox.Show("zonename.txt is too old for this version of L2.Net!");
                    System.Windows.Forms.Application.Exit();
                }

                Globals.zonelist          = new SortedList();
                Globals.zonelist.Capacity = Globals.COUNT_ZONES;

                while ((loaded = temp_stream.ReadLine()) != null)
                {
                    ZoneName zn_inf = new ZoneName();

                    zn_inf.Parse(loaded);

                    Globals.zonelist.Add(zn_inf.ID, zn_inf);
                }

                mem_stream.Close();
                temp_stream.Close();

                //Add_Text("loaded zones", Globals.Red);
            }
            catch
            {
                Globals.l2net_home.Add_PopUpError("failed to load data\\zonename.txt");
            }

            dec = null;
        }
Пример #13
0
        private static void LoadActions()
        {
            string loaded;

            byte[] dec;
            System.IO.StreamReader temp_stream;
            System.IO.MemoryStream mem_stream;

            try
            {
                dec = GetData(data_actionname, "bruyurEja6rUwaph");

                mem_stream  = new System.IO.MemoryStream(dec);
                temp_stream = new System.IO.StreamReader((System.IO.Stream)mem_stream);

                int version = Util.GetInt32(temp_stream.ReadLine());
                if (version < Globals.MinDataPack)
                {
                    System.Windows.Forms.MessageBox.Show("actionname.txt is too old for this version of L2.Net!");
                    System.Windows.Forms.Application.Exit();
                }

                Globals.actionlist          = new SortedList();
                Globals.actionlist.Capacity = Globals.COUNT_ACTIONS;

                while ((loaded = temp_stream.ReadLine()) != null)
                {
                    Actions act_inf = new Actions();

                    act_inf.Parse(loaded);

                    Globals.actionlist.Add(act_inf.ID, act_inf);
                }

                mem_stream.Close();
                temp_stream.Close();

                //Add_Text("loaded actions", Globals.Red);
            }
            catch
            {
                Globals.l2net_home.Add_PopUpError("failed to load data\\actionname.txt");
            }

            dec = null;
        }
Пример #14
0
        private static void LoadQuests()
        {
            string loaded;

            byte[] dec;
            System.IO.StreamReader temp_stream;
            System.IO.MemoryStream mem_stream;

            try
            {
                dec = GetData(data_questname, "D_d/-pmzRPnC|!mS");

                mem_stream  = new System.IO.MemoryStream(dec);
                temp_stream = new System.IO.StreamReader((System.IO.Stream)mem_stream);

                int version = Util.GetInt32(temp_stream.ReadLine());
                if (version < Globals.MinDataPack)
                {
                    System.Windows.Forms.MessageBox.Show("questname.txt is too old for this version of L2.Net!");
                    System.Windows.Forms.Application.Exit();
                }

                Globals.questlist          = new SortedList();
                Globals.questlist.Capacity = Globals.COUNT_QUESTS;

                while ((loaded = temp_stream.ReadLine()) != null)
                {
                    QuestName qst_inf = new QuestName();

                    qst_inf.Parse(loaded);

                    Globals.questlist.Add(qst_inf.ID * Globals.ID_OFFSET + qst_inf.quest_prog, qst_inf);
                }

                mem_stream.Close();
                temp_stream.Close();

                //Add_Text("loaded quests", Globals.Red);
            }
            catch
            {
                Globals.l2net_home.Add_PopUpError("failed to load data\\questname.txt");
            }

            dec = null;
        }
Пример #15
0
        private static void LoadClasses()
        {
            string loaded;

            byte[] dec;
            System.IO.StreamReader temp_stream;
            System.IO.MemoryStream mem_stream;

            try
            {
                dec = GetData(data_classes, "-^P_6.97R)YEFW4y");

                mem_stream  = new System.IO.MemoryStream(dec);
                temp_stream = new System.IO.StreamReader((System.IO.Stream)mem_stream);

                int version = Util.GetInt32(temp_stream.ReadLine());
                if (version < Globals.MinDataPack)
                {
                    System.Windows.Forms.MessageBox.Show("classes.txt is too old for this version of L2.Net!");
                    System.Windows.Forms.Application.Exit();
                }

                Globals.classes          = new SortedList();
                Globals.classes.Capacity = Globals.COUNT_CLASSES;

                while ((loaded = temp_stream.ReadLine()) != null)
                {
                    Classes classs = new Classes();

                    classs.Parse(loaded);

                    Globals.classes.Add(classs.ID, classs);
                }

                mem_stream.Close();
                temp_stream.Close();

                //Add_Text("loaded classes", Globals.Red);
            }
            catch
            {
                Globals.l2net_home.Add_PopUpError("failed to load data\\classes.txt");
            }

            dec = null;
        }
Пример #16
0
        private static void LoadRaces()
        {
            string loaded;

            byte[] dec;
            System.IO.StreamReader temp_stream;
            System.IO.MemoryStream mem_stream;

            try
            {
                dec = GetData(data_races, "3L=GSb_H4j-&S£m1");

                mem_stream  = new System.IO.MemoryStream(dec);
                temp_stream = new System.IO.StreamReader((System.IO.Stream)mem_stream);

                int version = Util.GetInt32(temp_stream.ReadLine());
                if (version < Globals.MinDataPack)
                {
                    System.Windows.Forms.MessageBox.Show("races.txt is too old for this version of L2.Net!");
                    System.Windows.Forms.Application.Exit();
                }

                Globals.races          = new SortedList();
                Globals.races.Capacity = Globals.COUNT_RACES;

                while ((loaded = temp_stream.ReadLine()) != null)
                {
                    Races race = new Races();

                    race.Parse(loaded);

                    Globals.races.Add(race.ID, race);
                }

                mem_stream.Close();
                temp_stream.Close();

                //Add_Text("loaded races", Globals.Red);
            }
            catch
            {
                Globals.l2net_home.Add_PopUpError("failed to load data\\races.txt");
            }

            dec = null;
        }
Пример #17
0
        private static void LoadSystemMsg()
        {
            string loaded;

            byte[] dec;
            System.IO.StreamReader temp_stream;
            System.IO.MemoryStream mem_stream;

            try
            {
                dec = GetData(data_systemmsg, "gA7ru8akusakenaf");

                mem_stream  = new System.IO.MemoryStream(dec);
                temp_stream = new System.IO.StreamReader((System.IO.Stream)mem_stream);

                int version = Util.GetInt32(temp_stream.ReadLine());
                if (version < Globals.MinDataPack)
                {
                    System.Windows.Forms.MessageBox.Show("systemmsg.txt is too old for this version of L2.Net!");
                    System.Windows.Forms.Application.Exit();
                }

                Globals.systemmsg          = new SortedList();
                Globals.systemmsg.Capacity = Globals.COUNT_SYSTEMMSG;

                while ((loaded = temp_stream.ReadLine()) != null)
                {
                    SystemMsg sysmsg = new SystemMsg();

                    sysmsg.Parse(loaded);

                    Globals.systemmsg.Add(sysmsg.ID, sysmsg);
                }

                mem_stream.Close();
                temp_stream.Close();

                //Add_Text("loaded systemmsgs", Globals.Red);
            }
            catch
            {
                Globals.l2net_home.Add_PopUpError("failed to load data\\systemmsg.txt");
            }

            dec = null;
        }
Пример #18
0
        private static void LoadServerName()
        {
            string loaded;

            byte[] dec;
            System.IO.StreamReader temp_stream;
            System.IO.MemoryStream mem_stream;

            try
            {
                dec = GetData(data_servername, "-8:2eF_08$6-o)IJ");

                mem_stream  = new System.IO.MemoryStream(dec);
                temp_stream = new System.IO.StreamReader((System.IO.Stream)mem_stream);

                int version = Util.GetInt32(temp_stream.ReadLine());
                if (version < Globals.MinDataPack)
                {
                    System.Windows.Forms.MessageBox.Show("servername.txt is too old for this version of L2.Net!");
                    System.Windows.Forms.Application.Exit();
                }

                Globals.servername          = new SortedList();
                Globals.servername.Capacity = Globals.COUNT_SERVERNAME;

                while ((loaded = temp_stream.ReadLine()) != null)
                {
                    ServerName sername = new ServerName();

                    sername.Parse(loaded);

                    Globals.servername.Add(sername.ID, sername);
                }

                mem_stream.Close();
                temp_stream.Close();

                //Add_Text("loaded servername", Globals.Red);
            }
            catch
            {
                Globals.l2net_home.Add_PopUpError("failed to load data\\servername.txt");
            }

            dec = null;
        }
Пример #19
0
        public void Parse(string inp)
        {
            int pipe = 0, oldpipe = 0;

            //ID
            pipe    = inp.IndexOf('|', oldpipe);
            ID      = Util.GetUInt32(inp.Substring(oldpipe, pipe - oldpipe));
            oldpipe = pipe + 1;
            //quest_prog
            pipe       = inp.IndexOf('|', oldpipe);
            quest_prog = Util.GetUInt32(inp.Substring(oldpipe, pipe - oldpipe));
            oldpipe    = pipe + 1;
            //main_name
            pipe      = inp.IndexOf('|', oldpipe);
            main_name = inp.Substring(oldpipe, pipe - oldpipe);
            oldpipe   = pipe + 1;
            //prog_name
            pipe      = inp.IndexOf('|', oldpipe);
            prog_name = inp.Substring(oldpipe, pipe - oldpipe);
            oldpipe   = pipe + 1;
            //description
            pipe        = inp.IndexOf('|', oldpipe);
            description = inp.Substring(oldpipe, pipe - oldpipe);
            oldpipe     = pipe + 1;
            //quest_x
            pipe    = inp.IndexOf('|', oldpipe);
            quest_x = Util.GetInt32(inp.Substring(oldpipe, pipe - oldpipe));
            oldpipe = pipe + 1;
            //quest_y
            pipe    = inp.IndexOf('|', oldpipe);
            quest_y = Util.GetInt32(inp.Substring(oldpipe, pipe - oldpipe));
            oldpipe = pipe + 1;
            //quest_z
            pipe    = inp.IndexOf('|', oldpipe);
            quest_z = Util.GetInt32(inp.Substring(oldpipe, pipe - oldpipe));
            oldpipe = pipe + 1;
            //lvl_min
            pipe    = inp.IndexOf('|', oldpipe);
            lvl_min = Util.GetUInt32(inp.Substring(oldpipe, pipe - oldpipe));
            oldpipe = pipe + 1;
            //lvl_max
            pipe    = inp.IndexOf('|', oldpipe);
            lvl_max = Util.GetUInt32(inp.Substring(oldpipe, pipe - oldpipe));
            oldpipe = pipe + 1;
            //quest_type
            pipe       = inp.IndexOf('|', oldpipe);
            quest_type = Util.GetUInt32(inp.Substring(oldpipe, pipe - oldpipe));
            oldpipe    = pipe + 1;
            //entity_name
            pipe        = inp.IndexOf('|', oldpipe);
            entity_name = inp.Substring(oldpipe, pipe - oldpipe);
            oldpipe     = pipe + 1;
            //contact_npc_id
            pipe           = inp.IndexOf('|', oldpipe);
            contact_npc_id = Util.GetUInt32(inp.Substring(oldpipe, pipe - oldpipe));
            oldpipe        = pipe + 1;
            //contact_npc_x
            pipe          = inp.IndexOf('|', oldpipe);
            contact_npc_x = Util.GetInt32(inp.Substring(oldpipe, pipe - oldpipe));
            oldpipe       = pipe + 1;
            //contact_npc_y
            pipe          = inp.IndexOf('|', oldpipe);
            contact_npc_y = Util.GetInt32(inp.Substring(oldpipe, pipe - oldpipe));
            oldpipe       = pipe + 1;
            //contact_npc_z
            pipe          = inp.IndexOf('|', oldpipe);
            contact_npc_z = Util.GetInt32(inp.Substring(oldpipe, pipe - oldpipe));
            oldpipe       = pipe + 1;
            //restricions
            pipe        = inp.IndexOf('|', oldpipe);
            restricions = inp.Substring(oldpipe, pipe - oldpipe);
            oldpipe     = pipe + 1;
            //short_description
            pipe = inp.IndexOf('|', oldpipe);
            short_description = inp.Substring(oldpipe, pipe - oldpipe);
            oldpipe           = pipe + 1;
            //clan_pet_quest
            pipe           = inp.IndexOf('|', oldpipe);
            clan_pet_quest = Util.GetUInt32(inp.Substring(oldpipe, pipe - oldpipe));
            oldpipe        = pipe + 1;
            //req_quest_complete
            pipe = inp.IndexOf('|', oldpipe);
            req_quest_complete = Util.GetUInt32(inp.Substring(oldpipe, pipe - oldpipe));
            oldpipe            = pipe + 1;
            //area_id
            area_id = Util.GetUInt32(inp.Substring(oldpipe, inp.Length - oldpipe));
        }
Пример #20
0
        public void ParseWeapon(string inp)
        {
            int pipe = 0, oldpipe = 0;

            //ID
            pipe    = inp.IndexOf('|', oldpipe);
            ID      = Util.GetUInt32(inp.Substring(oldpipe, pipe - oldpipe));
            oldpipe = pipe + 1;
            //Drop Mesh 1
            pipe = inp.IndexOf('|', oldpipe);
            string mesh = inp.Substring(oldpipe, pipe - oldpipe);

            oldpipe = pipe + 1;
            if (mesh.Length > 0)
            {
                Has_Mesh = true;
            }
            else
            {
                Has_Mesh = false;
            }
            //Icon 0
            pipe    = inp.IndexOf('|', oldpipe);
            Icon    = inp.Substring(oldpipe, pipe - oldpipe);
            oldpipe = pipe + 1;
            //Durability
            pipe       = inp.IndexOf('|', oldpipe);
            Durability = Util.GetInt64(inp.Substring(oldpipe, pipe - oldpipe));
            oldpipe    = pipe + 1;
            //Weight
            pipe    = inp.IndexOf('|', oldpipe);
            Weight  = Util.GetUInt32(inp.Substring(oldpipe, pipe - oldpipe));
            oldpipe = pipe + 1;
            //Material
            pipe     = inp.IndexOf('|', oldpipe);
            Material = Util.GetUInt32(inp.Substring(oldpipe, pipe - oldpipe));
            oldpipe  = pipe + 1;
            //Crystallizable
            pipe           = inp.IndexOf('|', oldpipe);
            Crystallizable = Util.GetUInt32(inp.Substring(oldpipe, pipe - oldpipe));
            oldpipe        = pipe + 1;
            //Body_Part
            pipe      = inp.IndexOf('|', oldpipe);
            Body_Part = Util.GetUInt32(inp.Substring(oldpipe, pipe - oldpipe));
            oldpipe   = pipe + 1;
            //Hardness
            pipe     = inp.IndexOf('|', oldpipe);
            Hardness = Util.GetUInt32(inp.Substring(oldpipe, pipe - oldpipe));
            oldpipe  = pipe + 1;
            //Random_Damage
            pipe          = inp.IndexOf('|', oldpipe);
            Random_Damage = Util.GetUInt32(inp.Substring(oldpipe, pipe - oldpipe));
            oldpipe       = pipe + 1;
            //PAtt

            /*
             * pipe = inp.IndexOf('|', oldpipe);
             * PAtt = Util.GetUInt32(inp.Substring(oldpipe, pipe - oldpipe));
             * oldpipe = pipe + 1;
             * //MAtt
             * pipe = inp.IndexOf('|', oldpipe);
             * MAtt = Util.GetUInt32(inp.Substring(oldpipe, pipe - oldpipe));
             * oldpipe = pipe + 1;
             */
            //Weapon_Type
            pipe        = inp.IndexOf('|', oldpipe);
            Weapon_Type = Util.GetUInt32(inp.Substring(oldpipe, pipe - oldpipe));
            oldpipe     = pipe + 1;
            //Crystal_Type
            pipe         = inp.IndexOf('|', oldpipe);
            Crystal_Type = Util.GetUInt32(inp.Substring(oldpipe, pipe - oldpipe));
            oldpipe      = pipe + 1;

            /*
             * //Critical
             * pipe = inp.IndexOf('|', oldpipe);
             * Critical = Util.GetUInt32(inp.Substring(oldpipe, pipe - oldpipe));
             * oldpipe = pipe + 1;
             * //Hit_Mod
             * pipe = inp.IndexOf('|', oldpipe);
             * Hit_Mod = Util.GetInt32(inp.Substring(oldpipe, pipe - oldpipe));
             * oldpipe = pipe + 1;
             * //Avoid_Mod
             * pipe = inp.IndexOf('|', oldpipe);
             * Avoid_Mod = Util.GetInt32(inp.Substring(oldpipe, pipe - oldpipe));
             * oldpipe = pipe + 1;
             * //Shield_Pdef
             * pipe = inp.IndexOf('|', oldpipe);
             * Shield_Pdef = Util.GetUInt32(inp.Substring(oldpipe, pipe - oldpipe));
             * oldpipe = pipe + 1;
             * //Shield_Rate
             * pipe = inp.IndexOf('|', oldpipe);
             * Shield_Rate = Util.GetUInt32(inp.Substring(oldpipe, pipe - oldpipe));
             * oldpipe = pipe + 1;
             * //Speed
             * pipe = inp.IndexOf('|', oldpipe);
             * Speed = Util.GetUInt32(inp.Substring(oldpipe, pipe - oldpipe));
             * oldpipe = pipe + 1;
             */
            //MP_Consume
            pipe       = inp.IndexOf('|', oldpipe);
            MP_Consume = Util.GetUInt32(inp.Substring(oldpipe, pipe - oldpipe));
            oldpipe    = pipe + 1;
            //SS
            pipe    = inp.IndexOf('|', oldpipe);
            SS      = Util.GetUInt32(inp.Substring(oldpipe, pipe - oldpipe));
            oldpipe = pipe + 1;
            //SPS
            pipe    = inp.IndexOf('|', oldpipe);
            SPS     = Util.GetUInt32(inp.Substring(oldpipe, pipe - oldpipe));
            oldpipe = pipe + 1;
            //Curvature
            pipe      = inp.IndexOf('|', oldpipe);
            Curvature = Util.GetUInt32(inp.Substring(oldpipe, pipe - oldpipe));
            oldpipe   = pipe + 1;
            //isHero
            isHero = Util.GetInt32(inp.Substring(oldpipe, inp.Length - oldpipe));
        }
Пример #21
0
        private static void LoadItemName()
        {
            string loaded;

            byte[] dec;
            System.IO.StreamReader temp_stream;
            System.IO.MemoryStream mem_stream;

            try
            {
                dec = GetData(data_itemname, "speves4azu52JutH");

                mem_stream  = new System.IO.MemoryStream(dec);
                temp_stream = new System.IO.StreamReader((System.IO.Stream)mem_stream);

                int version = Util.GetInt32(temp_stream.ReadLine());
                if (version < Globals.MinDataPack)
                {
                    System.Windows.Forms.MessageBox.Show("itemname.txt is too old for this version of L2.Net!");
                    System.Windows.Forms.Application.Exit();
                }

                Globals.itemname          = new SortedList();
                Globals.itemname.Capacity = Globals.COUNT_ITEMNAME;

                while ((loaded = temp_stream.ReadLine()) != null)
                {
                    ItemName itemnm = new ItemName();

                    itemnm.Parse(loaded);

                    Globals.itemname.Add(itemnm.ID, itemnm);
                }

                mem_stream.Close();
                temp_stream.Close();

                ItemName null_itm = new ItemName();
                null_itm.ID   = 0;
                null_itm.Name = "no item";
                Globals.itemname.Add((uint)0, null_itm);

                //Add_Text("loaded itemname", Globals.Red);
            }
            catch (Exception e)
            {
                Globals.l2net_home.Add_PopUpError("failed to load data\\itemname.txt" + e.Message);
            }
            //////////////////
            try
            {
                dec = GetData(data_etcitemgrp, "5rePruchetupHuth");

                mem_stream  = new System.IO.MemoryStream(dec);
                temp_stream = new System.IO.StreamReader((System.IO.Stream)mem_stream);

                int version2 = Util.GetInt32(temp_stream.ReadLine());
                if (version2 < Globals.MinDataPack)
                {
                    System.Windows.Forms.MessageBox.Show("etcitemgrp.txt is too old for this version of L2.Net!");
                    System.Windows.Forms.Application.Exit();
                }

                while ((loaded = temp_stream.ReadLine()) != null)
                {
                    ItemName itemnm = new ItemName();

                    itemnm.ParseETC(loaded);

                    ((ItemName)Globals.itemname[itemnm.ID]).ParseETC(itemnm);
                }

                mem_stream.Close();
                temp_stream.Close();

                //Add_Text("loaded etcitemgrp", Globals.Red);
            }
            catch
            {
                Globals.l2net_home.Add_PopUpError("failed to load data\\etcitemgrp.txt");
            }
            //////////////
            try
            {
                dec = GetData(data_weapongrp, "defru6e4ezuyuSWE");

                mem_stream  = new System.IO.MemoryStream(dec);
                temp_stream = new System.IO.StreamReader((System.IO.Stream)mem_stream);

                int version232 = Util.GetInt32(temp_stream.ReadLine());
                if (version232 < Globals.MinDataPack)
                {
                    System.Windows.Forms.MessageBox.Show("weapongrp.txt is too old for this version of L2.Net!");
                    System.Windows.Forms.Application.Exit();
                }

                while ((loaded = temp_stream.ReadLine()) != null)
                {
                    ItemName itemnm = new ItemName();

                    itemnm.ParseWeapon(loaded);

                    if (Globals.itemname.ContainsKey(itemnm.ID))
                    {
                        ((ItemName)Globals.itemname[itemnm.ID]).ParseWeapon(itemnm);
                    }
                }

                mem_stream.Close();
                temp_stream.Close();

                //Add_Text("loaded weapongrp", Globals.Red);
            }
            catch (Exception e)
            {
                Globals.l2net_home.Add_PopUpError("failed to load data\\weapongrp.txt " + e.Message);
            }
            //////////////
            try
            {
                dec = GetData(data_armorgrp, "8uf53XU3ravudepe");

                mem_stream  = new System.IO.MemoryStream(dec);
                temp_stream = new System.IO.StreamReader((System.IO.Stream)mem_stream);

                int version = Util.GetInt32(temp_stream.ReadLine());
                if (version < Globals.MinDataPack)
                {
                    System.Windows.Forms.MessageBox.Show("armorgrp.txt is too old for this version of L2.Net!");
                    System.Windows.Forms.Application.Exit();
                }

                while ((loaded = temp_stream.ReadLine()) != null)
                {
                    ItemName itemnm = new ItemName();

                    itemnm.ParseArmor(loaded);

                    ((ItemName)Globals.itemname[itemnm.ID]).ParseArmor(itemnm);
                }

                mem_stream.Close();
                temp_stream.Close();

                //Add_Text("loaded armorgrp", Globals.Red);
            }
            catch
            {
                Globals.l2net_home.Add_PopUpError("failed to load data\\armorgrp.txt");
            }

            dec = null;
        }
Пример #22
0
        public void ParseArmor(string inp)
        {
            int pipe = 0, oldpipe = 0;

            //ID
            pipe    = inp.IndexOf('|');
            ID      = Util.GetUInt32(inp.Substring(0, pipe));
            oldpipe = pipe + 1;
            //Drop Mesh 1
            pipe = inp.IndexOf('|', oldpipe);
            string mesh = inp.Substring(oldpipe, pipe - oldpipe);

            oldpipe = pipe + 1;
            if (mesh.Length > 0)
            {
                Has_Mesh = true;
            }
            else
            {
                Has_Mesh = false;
            }
            //Icon 0
            pipe    = inp.IndexOf('|', oldpipe);
            Icon    = inp.Substring(oldpipe, pipe - oldpipe);
            oldpipe = pipe + 1;
            //Durability
            pipe       = inp.IndexOf('|', oldpipe);
            Durability = Util.GetInt64(inp.Substring(oldpipe, pipe - oldpipe));
            oldpipe    = pipe + 1;
            //Weight
            pipe    = inp.IndexOf('|', oldpipe);
            Weight  = Util.GetUInt32(inp.Substring(oldpipe, pipe - oldpipe));
            oldpipe = pipe + 1;
            //Material
            pipe     = inp.IndexOf('|', oldpipe);
            Material = Util.GetUInt32(inp.Substring(oldpipe, pipe - oldpipe));
            oldpipe  = pipe + 1;
            //Crystallizable
            pipe           = inp.IndexOf('|', oldpipe);
            Crystallizable = Util.GetUInt32(inp.Substring(oldpipe, pipe - oldpipe));
            oldpipe        = pipe + 1;
            //Body_Part
            pipe      = inp.IndexOf('|', oldpipe);
            Body_Part = Util.GetUInt32(inp.Substring(oldpipe, pipe - oldpipe));
            oldpipe   = pipe + 1;
            //Armor_Type
            pipe       = inp.IndexOf('|', oldpipe);
            Armor_Type = Util.GetUInt32(inp.Substring(oldpipe, pipe - oldpipe));
            oldpipe    = pipe + 1;
            //Crystal_Type
            pipe         = inp.IndexOf('|', oldpipe);
            Crystal_Type = Util.GetUInt32(inp.Substring(oldpipe, pipe - oldpipe));
            oldpipe      = pipe + 1;
            //Avoid_Mod
            pipe      = inp.IndexOf('|', oldpipe);
            Avoid_Mod = Util.GetInt32(inp.Substring(oldpipe, inp.Length - oldpipe));

            /*
             * oldpipe = pipe + 1;
             * //Pdef
             * pipe = inp.IndexOf('|', oldpipe);
             * Pdef = Util.GetUInt32(inp.Substring(oldpipe, pipe - oldpipe));
             * oldpipe = pipe + 1;
             * //Mdef
             * pipe = inp.IndexOf('|', oldpipe);
             * Mdef = Util.GetUInt32(inp.Substring(oldpipe, pipe - oldpipe));
             * oldpipe = pipe + 1;
             * //MPbonus
             * MPbonus = Util.GetUInt32(inp.Substring(oldpipe, inp.Length - oldpipe));*/
        }
Пример #23
0
        public static void Init(string[] args)
        {
            Globals.PATH = Environment.CurrentDirectory;

            try
            {
                if (Globals.LogWriting)
                {
                    Globals.text_out = new StreamWriter(Globals.PATH + "\\logs\\" + DateTime.Now.Year.ToString() + "-" + DateTime.Now.Month.ToString() + "-" + DateTime.Now.Day.ToString() + ".txt");
                }
                else
                {
                    Globals.text_out = null;
                }
            }
            catch
            {
                Globals.text_out = null;
                Globals.l2net_home.Add_PopUpError("failed to create text output log file... do you have the datapack?" + Environment.NewLine + "L2.net needs write/create access to the \\logs\\ folder to log chat.");
            }

#if DEBUG
            try
            {
                Globals.gamedataout   = new StreamWriter(Globals.PATH + "\\logs\\from_gamelog.txt");
                Globals.gamedatato    = new StreamWriter(Globals.PATH + "\\logs\\to_gamelog.txt");
                Globals.clientdataout = new StreamWriter(Globals.PATH + "\\logs\\from_clientlog.txt");
                Globals.clientdatato  = new StreamWriter(Globals.PATH + "\\logs\\to_clientlog.txt");

                Globals.gamedataout.AutoFlush   = true;
                Globals.gamedatato.AutoFlush    = true;
                Globals.clientdataout.AutoFlush = true;
                Globals.clientdatato.AutoFlush  = true;
            }
            catch
            {
            }
#endif

            //set up all the arraylists for data
            Globals.gamedata.my_char = new Player_Info();
            Globals.gamedata.my_pet  = new Pet_Info();
            Globals.gamedata.my_pet1 = new Pet_Info();
            Globals.gamedata.my_pet2 = new Pet_Info();
            Globals.gamedata.my_pet3 = new Pet_Info();

            //flush and clear all the shortcuts
            for (int i = 0; i < Globals.Skills_Pages * Globals.Skills_PerPage; i++)
            {
                Globals.gamedata.ShortCuts.Add(new ShortCut());
            }

            Globals.gamedata.botoptions   = new BotOptions();
            Globals.gamedata.alertoptions = new AlertOptions();

            LoadData.LoadDataFiles();


            AddInfo.Set_PartyVisible();
            AddInfo.Set_PartyInfo();

            try
            {
                Globals.Keyboard = new DX_Keyboard();
            }
            catch (Exception e)
            {
                Globals.l2net_home.Add_Error("crash: failed to create SlimDX Keyboard : " + e.Message);
            }

            Globals.broadcastthread = new BroadcastThread();

            Util.Setup_Threads();

            //process command line crap


            foreach (string s in args)
            {
                // char type = s[1];
                string command;
                string data;
                int    indexOfColon = s.IndexOf(':');
                if (indexOfColon == -1)
                {
                    command = s;
                    data    = "";
                }
                else
                {
                    command = s.Substring(0, indexOfColon);
                    data    = s.Substring(indexOfColon + 1, s.Length - (indexOfColon + 1));
                }

                command = command.ToLower();

                switch (command)
                {
                case "-a":
                case "-accept":
                    Globals.pre_agree = true;
                    break;

                case "-b":
                case "-blowfish":
                    Globals.pre_blowfish = data;
                    break;

                case "-c":
                case "-protocol":
                    Globals.pre_chron_cmd = true;
                    Globals.pre_protocol  = data;
                    break;

                case "-d":
                case "-loginport":
                    Globals.pre_login_port = data;
                    break;

                case "-i":
                case "-loginip":
                    Globals.pre_login_ip = data;
                    break;

                case "-p":
                case "-password":
                    Globals.pre_password = data;
                    break;

                case "-u":
                case "-username":
                    Globals.pre_username = data;
                    break;

                case "-o":
                case "-options":
                    Globals.BotOptionsFile = data;
                    break;

                case "-s":
                case "-script":
                    Globals.Script_MainFile = data;
                    break;

                case "-x":
                case "-iglistenport":
                    Globals.pre_IG_listen_port = data;
                    break;

                case "-y":
                case "-iglistenip":
                    Globals.pre_IG_listen_ip = data;
                    break;

                case "-z":
                case "-chronicle":
                    Globals.pre_chron = Util.GetInt32(data);
                    break;

                case "-overidegameserver":
                    Globals.pre_useGameServerOveride  = true;
                    Globals.pre_checkAdvancedSettings = true;
                    break;

                case "-upl":
                case "-useproxylogin":
                    Globals.pre_useProxyServerForLogin = true;
                    Globals.pre_checkAdvancedSettings  = true;
                    break;

                case "-upg":
                case "-useproxygame":
                    Globals.pre_useProxyServerForGameserver = true;
                    Globals.pre_checkAdvancedSettings       = true;
                    break;

                case "-gameserverip":
                    Globals.pre_gameserver_override_ip = data;
                    break;

                case "-gameserverport":
                    Globals.pre_gameserver_override_port = data;
                    break;

                case "-s5ip":
                case "-socks5ip":
                    Globals.pre_socks5_ip = data;
                    break;

                case "-s5po":
                case "-socks5port":
                    Globals.pre_socks5_port = data;
                    break;

                case "-s5us":
                case "-socks5username":
                    Globals.pre_socks5_username = data;
                    break;

                case "-s5pa":
                case "-socks5password":
                    Globals.pre_socks5_password = data;
                    break;

                case "-ew":
                case "-enterworld":
                    Globals.pre_EnterWorldCheckbox = true;
                    break;

                case "-ig":
                    Globals.pre_IG = true;
                    break;

                case "-oog":
                    Globals.pre_OOG = true;
                    break;

                case "-ewip":
                    Globals.pre_enterworld_ip = true;
                    break;

                case "-ip01":
                    Globals.pre_enterworld_ip_tab[0] = data;
                    break;

                case "-ip02":
                    Globals.pre_enterworld_ip_tab[1] = data;
                    break;

                case "-ip03":
                    Globals.pre_enterworld_ip_tab[2] = data;
                    break;

                case "-ip04":
                    Globals.pre_enterworld_ip_tab[3] = data;
                    break;

                case "-ip11":
                    Globals.pre_enterworld_ip_tab[4] = data;
                    break;

                case "-ip12":
                    Globals.pre_enterworld_ip_tab[5] = data;
                    break;

                case "-ip13":
                    Globals.pre_enterworld_ip_tab[6] = data;
                    break;

                case "-ip14":
                    Globals.pre_enterworld_ip_tab[7] = data;
                    break;

                case "-ip21":
                    Globals.pre_enterworld_ip_tab[8] = data;
                    break;

                case "-ip22":
                    Globals.pre_enterworld_ip_tab[9] = data;
                    break;

                case "-ip23":
                    Globals.pre_enterworld_ip_tab[10] = data;
                    break;

                case "-ip24":
                    Globals.pre_enterworld_ip_tab[11] = data;
                    break;

                case "-ip31":
                    Globals.pre_enterworld_ip_tab[12] = data;
                    break;

                case "-ip32":
                    Globals.pre_enterworld_ip_tab[13] = data;
                    break;

                case "-ip33":
                    Globals.pre_enterworld_ip_tab[14] = data;
                    break;

                case "-ip34":
                    Globals.pre_enterworld_ip_tab[15] = data;
                    break;

                case "-ip41":
                    Globals.pre_enterworld_ip_tab[16] = data;
                    break;

                case "-ip42":
                    Globals.pre_enterworld_ip_tab[17] = data;
                    break;

                case "-ip43":
                    Globals.pre_enterworld_ip_tab[18] = data;
                    break;

                case "-ip44":
                    Globals.pre_enterworld_ip_tab[19] = data;
                    break;

                case "-ubs":
                    Globals.pre_unknow_blowfish = true;
                    break;

                case "-wasp":
                    Globals.pre_proxy_serv = true;
                    break;

                case "-gslp":
                    Globals.pre_game_srv_listen_prt = data;
                    break;

                case "-ggip":
                    Globals.gamedata.GG_IP = data;
                    break;

                case "-ggport":
                    Globals.gamedata.GG_Port = Util.GetInt32(data);
                    break;

                case "-ggsrv":
                    Globals.pre_GGSrv = true;
                    break;

                case "-ggcl":
                    Globals.pre_GGClient = true;
                    break;

                case "-secpin":
                    Globals.SecurityPin = data;
                    break;

                case "-oldclient":
                    Globals.gamedata.SecurityPinOldClient = true;
                    break;

                case "-al":
                case "-auto-login":
                case "-auto_login":
                case "-autologin":
                    Globals.auto_login = true;
                    break;
                }
            }
        }
Пример #24
0
        public void ReadScript(System.IO.StreamReader filein)
        {
            _ScriptLines.Clear();

            string line;

            while ((line = filein.ReadLine()) != null)
            {
                line = line.Trim();

                ScriptLine sl = new ScriptLine();
                sl.FullLine = line;

                string cmd = ScriptEngine.Get_String(ref line, false).ToUpperInvariant();

                sl.Command = ScriptEngine.GetCommandType(cmd);

                switch (sl.Command)
                {
                case ScriptCommands.ENCRYPTED:
                    //need to scrap everything that has been loaded so far...
                    _ScriptLines.Clear();
                    int key = Util.GetInt32(line);

                    string encoded_script = filein.ReadLine();

                    filein = Script_Crypt.Decrypt(encoded_script, key);
                    break;

                case ScriptCommands.IF:
                case ScriptCommands.WHILE:
                case ScriptCommands.LOOP:
                case ScriptCommands.UNKNOWN:
                    if (Globals.ScriptCompatibilityv386)
                    {
                        sl.UnParsedParams = line.Replace("(", " ( ").Replace(")", " ) ");
                    }
                    else
                    {
                        sl.UnParsedParams = line;
                    }

                    _ScriptLines.Add(sl);
                    break;

                default:
                    sl.UnParsedParams = line;

                    _ScriptLines.Add(sl);
                    break;
                }
            }

            //need to parse out comments in the file here...
            bool comment_block = false;

            for (int i = 0; i < _ScriptLines.Count; i++)
            {
                string cmd = ((ScriptLine)_ScriptLines[i]).FullLine.ToUpperInvariant();

                //start a comment block
                if (cmd.StartsWith("/*"))
                {
                    comment_block = true;
                }

                if (comment_block)
                {
                    ((ScriptLine)_ScriptLines[i]).Command  = ScriptCommands.NULL;
                    ((ScriptLine)_ScriptLines[i]).FullLine = "";
                }

                //end of comment block
                //  we end after we clear because we want to clear this line still (inclusive)
                if (cmd.EndsWith("*/"))
                {
                    comment_block = false;
                }

                //normal line comment
                if (cmd.StartsWith("//"))
                {
                    ((ScriptLine)_ScriptLines[i]).Command  = ScriptCommands.NULL;
                    ((ScriptLine)_ScriptLines[i]).FullLine = "";
                }
            }
        }
Пример #25
0
        private void Load_Interface()
        {
            StreamReader interin;

            try
            {
                interin = new StreamReader("config\\interface.txt");
            }
            catch (FileNotFoundException e)
            {
                throw new Exception(message: e.Message);
                // Ideally, if the file did not exist then we would have kept going with default values and then create it.
                // FIXME
            }
            try
            {
                Globals.LanguageSet = Util.GetInt32(interin.ReadLine());

                switch (Globals.LanguageSet)
                {
                case 0:
                    Globals.m_ResourceManager = new System.Resources.ResourceManager("L2_login.Languages.English", System.Reflection.Assembly.GetExecutingAssembly());
                    break;

                case 1:
                    Globals.m_ResourceManager = new System.Resources.ResourceManager("L2_login.Languages.PortugueseBR", System.Reflection.Assembly.GetExecutingAssembly());
                    break;

                case 2:
                    Globals.m_ResourceManager = new System.Resources.ResourceManager("L2_login.Languages.French", System.Reflection.Assembly.GetExecutingAssembly());
                    break;

                case 3:
                    Globals.m_ResourceManager = new System.Resources.ResourceManager("L2_login.Languages.Spanish", System.Reflection.Assembly.GetExecutingAssembly());
                    break;

                case 4:
                    Globals.m_ResourceManager = new System.Resources.ResourceManager("L2_login.Languages.German", System.Reflection.Assembly.GetExecutingAssembly());
                    break;

                case 5:
                    Globals.m_ResourceManager = new System.Resources.ResourceManager("L2_login.Languages.Polish", System.Reflection.Assembly.GetExecutingAssembly());
                    break;

                case 6:
                    Globals.m_ResourceManager = new System.Resources.ResourceManager("L2_login.Languages.Russian", System.Reflection.Assembly.GetExecutingAssembly());
                    break;

                case 7:
                    Globals.m_ResourceManager = new System.Resources.ResourceManager("L2_login.Languages.Japanese", System.Reflection.Assembly.GetExecutingAssembly());
                    break;

                case 8:
                    Globals.m_ResourceManager = new System.Resources.ResourceManager("L2_login.Languages.Chinese", System.Reflection.Assembly.GetExecutingAssembly());
                    break;

                case 9:
                    Globals.m_ResourceManager = new System.Resources.ResourceManager("L2_login.Languages.Greek", System.Reflection.Assembly.GetExecutingAssembly());
                    break;

                case 10:
                    Globals.m_ResourceManager = new System.Resources.ResourceManager("L2_login.Languages.Korean", System.Reflection.Assembly.GetExecutingAssembly());
                    break;

                case 11:
                    Globals.m_ResourceManager = new System.Resources.ResourceManager("L2_login.Languages.Italian", System.Reflection.Assembly.GetExecutingAssembly());
                    break;

                case 12:
                    Globals.m_ResourceManager = new System.Resources.ResourceManager("L2_login.Languages.Lithuanian", System.Reflection.Assembly.GetExecutingAssembly());
                    break;

                case 13:
                    Globals.m_ResourceManager = new System.Resources.ResourceManager("L2_login.Languages.Dutch", System.Reflection.Assembly.GetExecutingAssembly());
                    break;

                case 14:
                    Globals.m_ResourceManager = new System.Resources.ResourceManager("L2_login.Languages.Romanian", System.Reflection.Assembly.GetExecutingAssembly());
                    break;

                case 15:
                    Globals.m_ResourceManager = new System.Resources.ResourceManager("L2_login.Languages.Leet", System.Reflection.Assembly.GetExecutingAssembly());
                    break;

                case 16:
                    Globals.m_ResourceManager = new System.Resources.ResourceManager("L2_login.Languages.Hungarian", System.Reflection.Assembly.GetExecutingAssembly());
                    break;

                case 17:
                    Globals.m_ResourceManager = new System.Resources.ResourceManager("L2_login.Languages.Marklar", System.Reflection.Assembly.GetExecutingAssembly());
                    break;

                case 18:
                    Globals.m_ResourceManager = new System.Resources.ResourceManager("L2_login.Languages.Norwegian", System.Reflection.Assembly.GetExecutingAssembly());
                    break;

                case 19:
                    Globals.m_ResourceManager = new System.Resources.ResourceManager("L2_login.Languages.Czech", System.Reflection.Assembly.GetExecutingAssembly());
                    break;

                case 20:
                    Globals.m_ResourceManager = new System.Resources.ResourceManager("L2_login.Languages.Slovenian", System.Reflection.Assembly.GetExecutingAssembly());
                    break;

                case 21:
                    Globals.m_ResourceManager = new System.Resources.ResourceManager("L2_login.Languages.Swedish", System.Reflection.Assembly.GetExecutingAssembly());
                    break;

                case 22:
                    Globals.m_ResourceManager = new System.Resources.ResourceManager("L2_login.Languages.Danish", System.Reflection.Assembly.GetExecutingAssembly());
                    break;

                case 23:
                    Globals.m_ResourceManager = new System.Resources.ResourceManager("L2_login.Languages.PortuguesePT", System.Reflection.Assembly.GetExecutingAssembly());
                    break;

                case 24:
                    Globals.m_ResourceManager = new System.Resources.ResourceManager("L2_login.Languages.Finnish", System.Reflection.Assembly.GetExecutingAssembly());
                    break;

                case 25:
                    Globals.m_ResourceManager = new System.Resources.ResourceManager("L2_login.Languages.Vietnamese", System.Reflection.Assembly.GetExecutingAssembly());
                    break;

                case 26:
                    Globals.m_ResourceManager = new System.Resources.ResourceManager("L2_login.Languages.Thai", System.Reflection.Assembly.GetExecutingAssembly());
                    break;
                }

                //listView_char_data - report
                foreach (System.Windows.Forms.ColumnHeader clm in listView_char_data.Columns)
                {
                    clm.Width = Util.GetInt32(interin.ReadLine());
                }

                //listView_players_data - report
                foreach (System.Windows.Forms.ColumnHeader clm in listView_players_data.Columns)
                {
                    clm.Width = Util.GetInt32(interin.ReadLine());
                }

                //listView_items_data - report
                foreach (System.Windows.Forms.ColumnHeader clm in listView_items_data.Columns)
                {
                    clm.Width = Util.GetInt32(interin.ReadLine());
                }

                //listView_npc_data - report
                foreach (System.Windows.Forms.ColumnHeader clm in listView_npc_data.Columns)
                {
                    clm.Width = Util.GetInt32(interin.ReadLine());
                }

                //listView_inventory - report
                foreach (System.Windows.Forms.ColumnHeader clm in listView_inventory.Columns)
                {
                    clm.Width = Util.GetInt32(interin.ReadLine());
                }

                //listView_skills - report
                foreach (System.Windows.Forms.ColumnHeader clm in listView_skills.Columns)
                {
                    clm.Width = Util.GetInt32(interin.ReadLine());
                }

                //listView_char_clan - report
                foreach (System.Windows.Forms.ColumnHeader clm in listView_char_clan.Columns)
                {
                    clm.Width = Util.GetInt32(interin.ReadLine());
                }

                //listView_mybuffs_data - report
                foreach (System.Windows.Forms.ColumnHeader clm in listView_mybuffs_data.Columns)
                {
                    clm.Width = Util.GetInt32(interin.ReadLine());
                }

                Globals.Voice = Util.GetInt32(interin.ReadLine());
                if (Util.GetInt32(interin.ReadLine()) == 1)
                {
                    Globals.MinimizeToTray = true;
                }
                else
                {
                    Globals.MinimizeToTray = false;
                }

                this.Height = Util.GetInt32(interin.ReadLine());
                this.Width  = Util.GetInt32(interin.ReadLine());

                if (Util.GetInt32(interin.ReadLine()) == 1)
                {
                    checkBox_minimap.Checked = true;
                }
                else
                {
                    checkBox_minimap.Checked = false;
                }

                if (Util.GetInt32(interin.ReadLine()) == 1)
                {
                    Globals.ShowNamesNpcs = true;
                }
                else
                {
                    Globals.ShowNamesNpcs = false;
                }

                if (Util.GetInt32(interin.ReadLine()) == 1)
                {
                    Globals.DownloadNewCrests = true;
                }
                else
                {
                    Globals.DownloadNewCrests = false;
                }

                if (Util.GetInt32(interin.ReadLine()) == 1)
                {
                    Globals.SocialSelf = true;
                }
                else
                {
                    Globals.SocialSelf = false;
                }

                if (Util.GetInt32(interin.ReadLine()) == 1)
                {
                    Globals.SocialPcs = true;
                }
                else
                {
                    Globals.SocialPcs = false;
                }

                if (Util.GetInt32(interin.ReadLine()) == 1)
                {
                    Globals.SocialNpcs = true;
                }
                else
                {
                    Globals.SocialNpcs = false;
                }

                Globals.ProductKey = interin.ReadLine();
                Globals.L2Path     = interin.ReadLine();
                if (Util.GetInt32(interin.ReadLine()) == 1)
                {
                    Globals.AllowFiles = true;
                }
                else
                {
                    Globals.AllowFiles = false;
                }

                Globals.DirectInputKey  = interin.ReadLine();
                Globals.DirectInputKey2 = interin.ReadLine(); //Oddi, Force quit key

                if (Util.GetInt32(interin.ReadLine()) == 1)
                {
                    Globals.Use_Direct_Sound = true;
                }
                else
                {
                    Globals.Use_Direct_Sound = false;
                }

                Globals.Texture_Mode = Util.GetInt32(interin.ReadLine());
                if (Util.GetInt32(interin.ReadLine()) == 1)
                {
                    Globals.ShowNamesPcs = true;
                }
                else
                {
                    Globals.ShowNamesPcs = false;
                }

                if (Util.GetInt32(interin.ReadLine()) == 1)
                {
                    Globals.ShowNamesItems = true;
                }
                else
                {
                    Globals.ShowNamesItems = false;
                }

                if (Util.GetInt32(interin.ReadLine()) == 1) // Change by Oddi, Ignore Exit Confirmation
                {
                    Globals.IgnoreExitConf = true;
                }
                else
                {
                    Globals.IgnoreExitConf = false;
                }

                if (Util.GetInt32(interin.ReadLine()) == 1)
                {
                    Globals.White_Names = true;
                }
                else
                {
                    Globals.White_Names = false;
                }

                if (Util.GetInt32(interin.ReadLine()) == 1)
                {
                    Globals.Suppress_Quakes = true;
                }
                else
                {
                    Globals.Suppress_Quakes = false;
                }

                try
                {
                    if (Util.GetInt32(interin.ReadLine()) == 1)
                    {
                        Globals.Send_Blank_GG = true;
                    }
                    else
                    {
                        Globals.Send_Blank_GG = false;
                    }

                    if (Util.GetInt32(interin.ReadLine()) == 1)
                    {
                        Globals.Hide_Message_Boxes = true;
                    }
                    else
                    {
                        Globals.Hide_Message_Boxes = false;
                    }
                }
                catch
                {
                    //old ini file
                    Globals.Send_Blank_GG      = false;
                    Globals.Hide_Message_Boxes = false;
                }
                try
                {
                    Globals.ViewRange = Util.GetInt32(interin.ReadLine());
                }
                catch
                {
                }

                try
                {
                    textBox_zrange_map.Text = interin.ReadLine();                //Map ZRange
                    trackBar_map_zoom.Value = Util.GetInt32(interin.ReadLine()); //Map Zoom Value
                }
                catch
                {
                    //Default settings
                    textBox_zrange_map.Text = "500";
                    trackBar_map_zoom.Value = 2;
                }

                //v387
                try
                {
                    if (Util.GetInt32(interin.ReadLine()) == 1)
                    {
                        Globals.ScriptCompatibilityv386 = true;
                    }
                    else
                    {
                        Globals.ScriptCompatibilityv386 = false;
                    }
                }
                catch
                {
                }

                //v388
                try
                {
                    if (Util.GetInt32(interin.ReadLine()) == 1)
                    {
                        Globals.Use_Hardware_Acceleration = true;
                    }
                    else
                    {
                        Globals.Use_Hardware_Acceleration = false;
                    }
                }
                catch
                {
                }

                //v389
                try
                {
                    if (Util.GetInt32(interin.ReadLine()) == 1)
                    {
                        Globals.dc_on_ig_close = true;
                    }
                    else
                    {
                        Globals.dc_on_ig_close = false;
                    }
                }
                catch
                {
                }

                try
                {
                    if (Util.GetInt32(interin.ReadLine()) == 1)
                    {
                        Globals.dump_pbuff_on_ig_close = true;
                    }
                    else
                    {
                        Globals.dump_pbuff_on_ig_close = false;
                    }
                }
                catch
                {
                }

                try
                {
                    if (Util.GetInt32(interin.ReadLine()) == 1)
                    {
                        Globals.ToggleBottingifGMAction = true;
                    }
                    else
                    {
                        Globals.ToggleBottingifGMAction = false;
                    }
                }
                catch
                {
                }

                try
                {
                    if (Util.GetInt32(interin.ReadLine()) == 1)
                    {
                        Globals.ToggleBottingifTeleported = true;
                    }
                    else
                    {
                        Globals.ToggleBottingifTeleported = false;
                    }
                }
                catch
                {
                }

                //v391
                try
                {
                    if (Util.GetInt32(interin.ReadLine()) == 1)
                    {
                        Globals.Popup_Captcha = true;
                    }
                    else
                    {
                        Globals.Popup_Captcha = false;
                    }

                    Globals.Captcha_HTML1 = interin.ReadLine().ToString();
                    Globals.Captcha_HTML2 = interin.ReadLine().ToString();
                }
                catch
                {
                }

                //v396
                try
                {
                    if (Util.GetInt32(interin.ReadLine()) == 1)
                    {
                        Globals.AutolearnSkills = true;
                    }
                    else
                    {
                        Globals.AutolearnSkills = false;
                    }
                }
                catch
                {
                }
                try
                {
                    if (Util.GetInt32(interin.ReadLine()) == 1)
                    {
                        Globals.LogWriting = true;
                    }
                    else
                    {
                        Globals.LogWriting = false;
                    }

                    if (Util.GetInt32(interin.ReadLine()) == 1)
                    {
                        Globals.NpcSay = true;
                    }
                    else
                    {
                        Globals.NpcSay = false;
                    }
                }
                catch
                {
                }


                interin.Close();

                this.UpdateUI();
                if (Globals.login_window != null)
                {
                    Globals.login_window.UpdateUI();
                }

                if (Globals.botoptionsscreen != null)
                {
                    Globals.botoptionsscreen.UpdateUI();
                }

                if (Globals.setupwindow != null)
                {
                    Globals.setupwindow.UpdateUI();
                }

                if (Globals.scriptdebugwindow != null)
                {
                    Globals.scriptdebugwindow.UpdateUI();
                }

                Globals.LoadedInterface = true;

                //Add_Text("loaded interface", Globals.Red, TextType.BOT);
            }
            catch
            {
                Add_PopUpError("failed to load interface file, continuing with default parameters for unloaded values");
            }
        }