Наследование: Profile
Пример #1
0
        /////////////////////////////////////////////////////////////////////////////////
        // Load weather
        /////////////////////////////////////////////////////////////////////////////////
        #region Weather
        void LoadWeather()
        {
            //Wrap our function inside a catcher
            try
            {
                //NOTE: Must be defined per zone and random information

                //Load info from ini for now
                Ini ini = new Ini();
                ini = new Framework.Ini(Environment.CurrentDirectory + @"\Settings\Settings.ini");
                string Enabled = ini.GetValue("Custom", "WeatherEnabled", "true").ToString();
                string Type    = ini.GetValue("Custom", "WeatherType", "1").ToString();
                string Info    = ini.GetValue("Custom", "WeatherInfo", "10").ToString();

                //If the user has defined to enable custom weather type
                if (Enabled == "1")
                {
                    //We send the information they chosen
                    client.Send(Packet.Weather(Convert.ToByte(Type), Convert.ToInt32(Info)));
                }
                //If disabled
                else
                {
                    //Send static weather
                    client.Send(Packet.Weather(0, 1));
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Load weather error {0}", ex);
                Systems.Debugger.Write(ex);
            }
        }
Пример #2
0
 /////////////////////////////////////////////////////////////////////////////////
 // Load our starting message
 /////////////////////////////////////////////////////////////////////////////////
 #region Welcome message
 void LoadMessage()
 {
     //Wrap function inside our catcher
     try
     {
         //If the character logs in for first time (bool is false).
         if (!Character.Information.WelcomeMessage)
         {
             //Load new ini
             Framework.Ini ini;
             ini = new Framework.Ini(Environment.CurrentDirectory + @"\Settings\Settings.ini");
             //Get servername from the ini file
             string servername = ini.GetValue("Custom", "Welcome", "Srx Revo").ToString();
             //Set welcome information
             string welcome = "Welcome to " + servername + " Programmed by: http://www.xfsgames.com.ar";
             //Send notice packet
             client.Send(sendnoticecon(7, 0, welcome, ""));
             //Set bool to true so when teleporting user wont receive the message
             Character.Information.WelcomeMessage = true;
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine("Welcome message error {0}", ex);
         Systems.Debugger.Write(ex);
     }
 }
Пример #3
0
 void LoadMessage()
 {
     //Wrap function inside our catcher
     try
     {
         //If the character logs in for first time (bool is false).
         if (!Character.Information.WelcomeMessage)
         {
             //Load new ini
             Framework.Ini ini;
             ini = new Framework.Ini(Environment.CurrentDirectory + @"\Settings\Settings.ini");
             //Get servername from the ini file
             string servername = ini.GetValue("Custom", "Welcome", "Srx Revo").ToString();
             //Set welcome information
             string welcome = "Welcome to " + servername + " Programmed by: http://www.xfsgames.com.ar";
             //Send notice packet
             client.Send(sendnoticecon(7, 0, welcome, ""));
             //Set bool to true so when teleporting user wont receive the message
             Character.Information.WelcomeMessage = true;
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine("Welcome message error {0}", ex);
         Systems.Debugger.Write(ex);
     }
 }
Пример #4
0
        static void Main(string[] args)
        {
            System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo(System.Globalization.CultureInfo.GetCultureInfo(TxtFile.GetSystemDefaultLangID()).ToString());

            Framework.Ini ini;

            DarkEmu_GameServer.Systemcore.Definitions.Bootlogo._Load();

            Program pro = new Program();

            // Begin connection to our database.
            Systems.MsSQL.OnDatabaseError += new Systems.MsSQL.dError(db_OnDatabaseError);
            // Read our database settings from our ini file.
            Systems.MsSQL.OnConnectedToDatabase += new Systems.MsSQL.dConnected(db_OnConnectedToDatabase);
            // Check if our ini file excists.
            string sqlConnect  = @"Data Source=(local)\SQLEXPRESS;Initial Catalog=silkroad;Integrated Security=True;MultipleActiveResultSets=True;";
            string sIpIPC      = "127.0.0.1";
            string sIpServer   = "127.0.0.1";
            UInt16 iPortIPC    = 15791;
            UInt16 iPortServer = 15780;
            UInt16 iPortCmd    = 10101;

            if (File.Exists("./Settings/Settings.ini"))
            {
                //Load our ini file
                ini = new Framework.Ini(Environment.CurrentDirectory + @"\Settings\Settings.ini");
                //Read line below given value.
                sqlConnect = ini.GetValue("Database", "connectionstring", @"Data Source=(local)\SQLEXPRESS;Initial Catalog=silkroad;Integrated Security=True;MultipleActiveResultSets=True;").ToString();
                //Load our rates.
                Systems.Rate.Gold     = Convert.ToByte(ini.GetValue("Rates", "Goldrate", 1));
                Systems.Rate.Item     = Convert.ToByte(ini.GetValue("Rates", "Droprate", 1));
                Systems.Rate.Xp       = Convert.ToByte(ini.GetValue("Rates", "XPrate", 1));
                Systems.Rate.Sp       = Convert.ToByte(ini.GetValue("Rates", "SPrate", 1));
                Systems.Rate.Sox      = Convert.ToByte(ini.GetValue("Rates", "Sealrate", 1));
                Systems.Rate.Elixir   = Convert.ToByte(ini.GetValue("Rates", "Elixirsrate", 1));
                Systems.Rate.Alchemyd = Convert.ToByte(ini.GetValue("Rates", "Alchemyrate", 1));
                Systems.Rate.ETCd     = Convert.ToByte(ini.GetValue("Rates", "ETCrate", 1));
                Systems.Rate.Spawns   = Convert.ToByte(ini.GetValue("Rates", "Spawnrate", 1));
                iPortIPC    = Convert.ToUInt16(ini.GetValue("IPC", "port", 15791));
                sIpIPC      = ini.GetValue("IPC", "ip", "127.0.0.1");
                iPortServer = Convert.ToUInt16(ini.GetValue("Server", "port", 15780));
                sIpServer   = ini.GetValue("Server", "ip", "127.0.0.1");
                iPortCmd    = Convert.ToUInt16(ini.GetValue("CMD", "port", 10101));
                DarkEmu_GameServer.Systems.maxSlots = Convert.ToInt32(ini.GetValue("Server", "MaxSlots", 100));
            }
            else
            {
                Systems.Rate.Gold     = 1;
                Systems.Rate.Item     = 1;
                Systems.Rate.Xp       = 1;
                Systems.Rate.Sp       = 1;
                Systems.Rate.Sox      = 1;
                Systems.Rate.Elixir   = 1;
                Systems.Rate.Alchemyd = 1;
                Systems.Rate.ETCd     = 1;
                Systems.Rate.Spawns   = 1;
                Systems.maxSlots      = 100;
            }
            Systems.MsSQL.Connection(sqlConnect);
            //Boot_Logo._Rates();
            // create servers
            try
            {
                net = new Systems.Server();

                net.OnConnect += new Systems.Server.dConnect(pro._OnClientConnect);
                net.OnError   += new Systems.Server.dError(pro._ServerError);

                Systems.ServerStartedTime = DateTime.Now;

                Systems.Client.OnReceiveData += new Systems.Client.dReceive(pro._OnReceiveData);
                Systems.Client.OnDisconnect  += new Systems.Client.dDisconnect(pro._OnClientDisconnect);

                #region CommandServer StartUp
                cmd = new Systems.CommandServer();
                cmd.OnCommandReceived += new Systems.CommandServer.dCommandReceived(pro._command);
                #endregion
                #region IPC Server StartUp
                Systems.IPC            = new Servers.IPCServer();
                Systems.IPC.OnReceive += new Servers.IPCServer.dOnReceive(pro._OnIPC);
                Systems.LoadServers("LoginServers.ini", 15790);
                #endregion
            }
            catch (Exception err)
            {
                Console.WriteLine(err);
            }

            DarkEmu_GameServer.Systems.CheckDirectories();

            DarkEmu_GameServer.File.FileLoad.Load();
            //Update serverlist info
            DarkEmu_GameServer.Systems.clients.update += new EventHandler(Users.updateServerList);
            //Load random unique monsters.
            /*Random rand = new Random();*/

            /*
             * DarkEmu_GameServer.GlobalUnique.StartTGUnique(rand.Next(10, 20) * 60000, 600);   //Random spawn tiger girl
             * DarkEmu_GameServer.GlobalUnique.StartUriUnique(rand.Next(10, 20) * 60000, 600);   //Random spawn urichi
             * DarkEmu_GameServer.GlobalUnique.StartIsyUnique(rand.Next(10, 20) * 60000, 600);   //Random spawn isy
             * DarkEmu_GameServer.GlobalUnique.StartLordUnique(rand.Next(10, 20) * 60000, 600);   //Random spawn lord yarkan
             * DarkEmu_GameServer.GlobalUnique.StartDemonUnique(rand.Next(10, 20) * 60000, 600);   //Random spawn demon shaitan
             * DarkEmu_GameServer.GlobalUnique.StartCerbUnique(rand.Next(10, 20) * 60000, 600);   //Random spawn cerberus
             * DarkEmu_GameServer.GlobalUnique.StartMedusa(rand.Next(10, 20) * 90000, 600);   //Random spawn medusa
             * DarkEmu_GameServer.GlobalUnique.StartNeith(rand.Next(10, 20) * 90000, 600);   //Random spawn neith
             * //Game.GlobalUnique.StartSphinx       (rand.Next(10, 20) * 90000, 600);   //Random spawn medusa
             * DarkEmu_GameServer.GlobalUnique.StartIsis(rand.Next(10, 20) * 90000, 600);   //Random spawn isis
             * //Game.GlobalUnique.StartRoc          (rand.Next(10, 20) * 90000, 600);   //Random spawn roc
             * DarkEmu_GameServer.GlobalUnique.StartIvyUnique(rand.Next(10, 20) * 60000, 600);   //Random spawn captain ivy
             */

            // start listening servers
            cmd.Start("127.0.0.1", iPortCmd);
            Systems.IPC.Start(sIpIPC, iPortIPC);
            net.Start(sIpServer, iPortServer);
            Systems.UpdateServerInfo();

            //Run for commands in console.
            Program launch = new Program();
            Thread  run    = new Thread(new ThreadStart(launch.run));
            run.Start();

            // main loop
            lastPromote = DateTime.Now;
            while (run.IsAlive)
            {
                Thread.Sleep(10);
                if (lastPromote.AddSeconds(60) < DateTime.Now)
                {
                    lastPromote = DateTime.Now;
                    Systems.UpdateServerInfo();
                }
            }
            Systems.UpdateServerInfo(0);
            net.ServerCheck(false);
        }
Пример #5
0
        public void Manager_Work()
        {
            Framework.Ini ini;
            // Begin connection to our database.
            Systems.MsSQL.OnDatabaseError += new Systems.MsSQL.dError(db_OnDatabaseError);
            // Read our database settings from our ini file.
            Systems.MsSQL.OnConnectedToDatabase += new Systems.MsSQL.dConnected(db_OnConnectedToDatabase);
            // Check if our ini file excists.
            string sqlConnect  = @"Data Source=(local)\SQLEXPRESS;Initial Catalog=silk;Integrated Security=True;MultipleActiveResultSets=True;";
            string sIpIPC      = "";
            string sIpServer   = "";
            UInt16 iPortIPC    = 15780;
            UInt16 iPortServer = 15780;
            UInt16 iPortCmd    = 10101;

            if (System.IO.File.Exists("./Settings/Settings.ini"))
            {
                //Load our ini file
                ini = new Framework.Ini(Environment.CurrentDirectory + @"\Settings\Settings.ini");
                //Read line below given value.
                sqlConnect = ini.GetValue("Database", "connectionstring", @"Data Source=(local)\SQLEXPRESS;Initial Catalog=silk;Integrated Security=True;MultipleActiveResultSets=True;").ToString();
                //Load our rates.
                Game.Rate.Gold        = Convert.ToByte(ini.GetValue("Rates", "Goldrate", 1));
                Game.Rate.Item        = Convert.ToByte(ini.GetValue("Rates", "Droprate", 1));
                Game.Rate.Xp          = Convert.ToByte(ini.GetValue("Rates", "XPrate", 1));
                Game.Rate.Sp          = Convert.ToByte(ini.GetValue("Rates", "SPrate", 1));
                Game.Rate.Sox         = Convert.ToByte(ini.GetValue("Rates", "Sealrate", 1));
                Game.Rate.Elixir      = Convert.ToByte(ini.GetValue("Rates", "Elixirsrate", 1));
                Game.Rate.Alchemyd    = Convert.ToByte(ini.GetValue("Rates", "Alchemyrate", 1));
                Game.Rate.ETCd        = Convert.ToByte(ini.GetValue("Rates", "ETCrate", 1));
                Game.Rate.Spawns      = Convert.ToByte(ini.GetValue("Rates", "Spawnrate", 1));
                iPortIPC              = Convert.ToUInt16(ini.GetValue("IPC", "port", 15780));
                sIpIPC                = ini.GetValue("IPC", "ip", "");
                iPortServer           = Convert.ToUInt16(ini.GetValue("Server", "port", 15780));
                sIpServer             = ini.GetValue("Server", "ip", "");
                iPortCmd              = Convert.ToUInt16(ini.GetValue("CMD", "port", 10101));
                Game.Systems.maxSlots = Convert.ToInt32(ini.GetValue("Server", "MaxSlots", 100));
            }
            else
            {
                Game.Rate.Gold        = 1;
                Game.Rate.Item        = 1;
                Game.Rate.Xp          = 1;
                Game.Rate.Sp          = 1;
                Game.Rate.Sox         = 1;
                Game.Rate.Elixir      = 1;
                Game.Rate.Alchemyd    = 1;
                Game.Rate.ETCd        = 1;
                Game.Rate.Spawns      = 1;
                Game.Systems.maxSlots = 100;
            }
            Systems.MsSQL.Connection(sqlConnect);
            // create servers
            try
            {
                net = new Systems.Server();

                net.OnConnect += new Systems.Server.dConnect(_OnClientConnect);
                net.OnError   += new Systems.Server.dError(_ServerError);

                Systems.ServerStartedTime = DateTime.Now;

                Systems.Client.OnReceiveData += new Systems.Client.dReceive(_OnReceiveData);
                Systems.Client.OnDisconnect  += new Systems.Client.dDisconnect(_OnClientDisconnect);

                #region CommandServer StartUp
                cmd = new Systems.CommandServer();
                cmd.OnCommandReceived += new Systems.CommandServer.dCommandReceived(_command);
                #endregion
                #region IPC Server StartUp
                Systems.IPC            = new Servers.IPCServer();
                Systems.IPC.OnReceive += new Servers.IPCServer.dOnReceive(_OnIPC);
                Systems.LoadServers("LoginServers.ini", 15779);
                #endregion
            }
            catch (Exception)
            {
                //Activity(err);
            }

            Game.Systems.CheckDirectories();

            Game.File.FileLoad.Load(this);
            //Update serverlist info
            Game.Systems.clients.update += new EventHandler(Users.updateServerList);
            //Load random unique monsters.
            Random rand = new Random();

            Game.GlobalUnique.StartTGUnique(rand.Next(10, 20) * 60000, 600);    //Random spawn tiger girl
            Game.GlobalUnique.StartUriUnique(rand.Next(10, 20) * 60000, 600);   //Random spawn urichi
            Game.GlobalUnique.StartIsyUnique(rand.Next(10, 20) * 60000, 600);   //Random spawn isy
            Game.GlobalUnique.StartLordUnique(rand.Next(10, 20) * 60000, 600);  //Random spawn lord yarkan
            Game.GlobalUnique.StartDemonUnique(rand.Next(10, 20) * 60000, 600); //Random spawn demon shaitan
            Game.GlobalUnique.StartCerbUnique(rand.Next(10, 20) * 60000, 600);  //Random spawn cerberus
            Game.GlobalUnique.StartMedusa(rand.Next(10, 20) * 90000, 600);      //Random spawn medusa
            Game.GlobalUnique.StartNeith(rand.Next(10, 20) * 90000, 600);       //Random spawn neith
            //Game.GlobalUnique.StartSphinx       (rand.Next(10, 20) * 90000, 600);   //Random spawn medusa
            Game.GlobalUnique.StartIsis(rand.Next(10, 20) * 90000, 600);        //Random spawn isis
            //Game.GlobalUnique.StartRoc          (rand.Next(10, 20) * 90000, 600);   //Random spawn roc
            Game.GlobalUnique.StartIvyUnique(rand.Next(10, 20) * 60000, 600);   //Random spawn captain ivy

            // start listening servers
            cmd.Start("127.0.0.1", iPortCmd);
            Systems.IPC.Start(sIpIPC, iPortIPC);
            net.Start(sIpServer, iPortServer);
            Systems.UpdateServerInfo();
            // main loop
            lastPromote = DateTime.Now;
            Thread check = new Thread(run);
            check.Start();
            while (check.IsAlive)
            {
                Thread.Sleep(10);
                if (lastPromote.AddSeconds(60) < DateTime.Now)
                {
                    lastPromote = DateTime.Now;
                    Systems.UpdateServerInfo();
                }
            }
            Systems.UpdateServerInfo(0);
            net.ServerCheck(false);
        }
Пример #6
0
        //Void creation for characters
        void CharacterCreate()
        {
            //Start wrapper for catching errors
            try
            {
                //Check the amount of characters created (If 4 then we return).
                if (MsSQL.GetRowsCount("SELECT * FROM character WHERE account='" + Player.AccountName + "'") == 4)
                {
                    return;
                }
                //Open our packet reader
                PacketReader Reader = new PacketReader(PacketInformation.buffer);
                //Need to be checked
                byte tocheck = Reader.Byte();
                //String character name
                string NewCharacterName = Reader.Text();
                //Integer for character model
                int NewCharacterModel = Reader.Int32();
                //Byte for character volume
                byte NewCharacterVolume = Reader.Byte();
                //Set new integer for item creation [4] total
                int[] Item = new int[4];
                //Item id one integer
                Item[0] = Reader.Int32();
                //Item id two integer
                Item[1] = Reader.Int32();
                //Item id three integer
                Item[2] = Reader.Int32();
                //Item id four integer
                Item[3] = Reader.Int32();
                //Close packet reader
                Reader.Close();
                //Set default character stats
                double MagicalDefense        = 3;
                double PhysicalDefense       = 6;
                double ParryRatio            = 11;
                double HitRatio              = 11;
                double MinimalPhysicalAttack = 6;
                double MaxPhysicalAttack     = 9;
                double MinimalMagicalAttack  = 6;
                double MaxMagicalAttack      = 10;
                //Set mag defense
                MagicalDefense += Data.ItemBase[Item[0]].Defans.MinMagDef;
                MagicalDefense += Data.ItemBase[Item[1]].Defans.MinMagDef;
                MagicalDefense += Data.ItemBase[Item[2]].Defans.MinMagDef;
                //Set phy defence
                PhysicalDefense += Data.ItemBase[Item[0]].Defans.MinPhyDef;
                PhysicalDefense += Data.ItemBase[Item[1]].Defans.MinPhyDef;
                PhysicalDefense += Data.ItemBase[Item[2]].Defans.MinPhyDef;
                //Set parry information
                ParryRatio += Data.ItemBase[Item[0]].Defans.Parry;
                ParryRatio += Data.ItemBase[Item[1]].Defans.Parry;
                ParryRatio += Data.ItemBase[Item[2]].Defans.Parry;
                //Set hit ratio
                HitRatio += Data.ItemBase[Item[3]].Attack.MinAttackRating;
                //Set phy attack
                MinimalPhysicalAttack += Data.ItemBase[Item[3]].Attack.Min_LPhyAttack;
                MaxPhysicalAttack     += Data.ItemBase[Item[3]].Attack.Min_HPhyAttack;
                //Set mag attack
                MinimalMagicalAttack += Data.ItemBase[Item[3]].Attack.Min_LMagAttack;
                MaxMagicalAttack     += Data.ItemBase[Item[3]].Attack.Min_HMagAttack;
                //Set bool for european or chinese characters
                if (NewCharacterModel >= 14715 && NewCharacterModel <= 14745)
                {
                    European = true;
                }
                //Replace any bad character from the name like [ , ] etc.
                NewCharacterName = Removebadchars(NewCharacterName);
                //Check the character name before creation
                if (CharacterCheck(NewCharacterName))
                {
                    //If bad send informational packet
                    client.Send(Packet.CharacterName(4));
                    //Finally return.
                    return;
                }
                //Random x y z output
                int random = rnd.Next(1, 3);
                //If player is creating a european character
                if (European)
                {
                    //Set random start location for european
                    if (random == 1)
                    {
                        randomx = 1030; randomz = 80; randomy = 512;
                    }
                    if (random == 2)
                    {
                        randomx = 889; randomz = 83; randomy = 1104;
                    }
                    if (random == 3)
                    {
                        randomx = 453; randomz = 80; randomy = 1249;
                    }
                    //Insert the basic information into the database
                    MsSQL.InsertData("INSERT INTO character (account, name, chartype, volume, xsect, ysect, xpos, zpos, ypos, GuideData) VALUES ('" + Player.AccountName + "','" + NewCharacterName + "', '" + NewCharacterModel + "', '" + NewCharacterVolume + "','79','105','" + randomx + "','" + randomz + "','" + randomy + "','0000000000000000')");
                    //Insert reverse scroll data into the database
                    MsSQL.InsertData("INSERT INTO character_rev (charname, revxsec, revysec, revx, revy, revz) VALUES ('" + NewCharacterName + "','79','105','" + randomx + "','" + randomy + "','" + randomz + "')");
                    //Set definition for the character id information
                    Player.CreatingCharID = MsSQL.GetDataInt("Select * from character Where name='" + NewCharacterName + "'", "id");
                    //If the 3rd item is a sword or a dark staff
                    if (Item[3] == 10730 || Item[3] == 10734)
                    {
                        //Add the mag def information
                        MagicalDefense += Data.ItemBase[251].Defans.MinMagDef;
                        //Add the phy def information
                        PhysicalDefense += Data.ItemBase[251].Defans.MinPhyDef;
                        //Add parry ration
                        ParryRatio += Data.ItemBase[251].Defans.Parry;
                        //Add shield item
                        AddItem(10738, 0, 7, Player.CreatingCharID, 0);
                    }
                    //If the 3rd item is a crossbow
                    if (Item[3] == 10733)
                    {
                        //We add our base bolts 250
                        AddItem(10376, 250, 7, Player.CreatingCharID, 0);
                    }

                    //Add base mastery's for europe characters
                    AddMastery(513, Player.CreatingCharID); //Warrior
                    AddMastery(515, Player.CreatingCharID); //Rogue
                    AddMastery(514, Player.CreatingCharID); //Wizard
                    AddMastery(516, Player.CreatingCharID); //Warlock
                    AddMastery(517, Player.CreatingCharID); //Bard
                    AddMastery(518, Player.CreatingCharID); //Cleric
                }
                //If the character model is an chinese character
                else
                {
                    //Set random start location for chinese
                    if (random == 1)
                    {
                        randomx = 1030; randomz = 80; randomy = 512; randomysec = 97;
                    }
                    if (random == 2)
                    {
                        randomx = 959; randomz = 20; randomy = 421; randomysec = 98;
                    }
                    if (random == 3)
                    {
                        randomx = 964; randomz = 0; randomy = 235; randomysec = 97;
                    }
                    //Add character default information into the database
                    MsSQL.InsertData("INSERT INTO character (account, name, chartype, volume, xsect, ysect, xpos, zpos, ypos, GuideData) VALUES ('" + Player.AccountName + "','" + NewCharacterName + "', '" + NewCharacterModel + "', '" + NewCharacterVolume + "','168','" + randomysec + "','" + randomx + "','" + randomz + "','" + randomy + "','0000000000000000')");
                    //Add character reverse scroll information into the database
                    MsSQL.InsertData("INSERT INTO character_rev (charname, revxsec, revysec, revx, revy, revz) VALUES ('" + NewCharacterName + "','168','" + randomysec + "','" + randomx + "','" + randomy + "','" + randomz + "')");
                    //Get new character id
                    Player.CreatingCharID = MsSQL.GetDataInt("Select * from character Where name='" + NewCharacterName + "'", "id");
                    //If the item chosen is a blade or sword
                    if (Item[3] == 3632 || Item[3] == 3633)
                    {
                        //Set magical defense for shield
                        MagicalDefense += Data.ItemBase[251].Defans.MinMagDef;
                        //Set physical defense for shield
                        PhysicalDefense += Data.ItemBase[251].Defans.MinPhyDef;
                        //Set parry ratio for shield
                        ParryRatio += Data.ItemBase[251].Defans.Parry;
                        //Add the shield to the character
                        AddItem(251, 0, 7, Player.CreatingCharID, 0);
                    }
                    //If the item is a bow
                    if (Item[3] == 3636)
                    {
                        //Add 250 arrows to the new character
                        AddItem(62, 250, 7, Player.CreatingCharID, 0);
                    }
                    AddMastery(257, Player.CreatingCharID); //blade
                    AddMastery(258, Player.CreatingCharID); //heuksal
                    AddMastery(259, Player.CreatingCharID); //bow
                    AddMastery(273, Player.CreatingCharID); //cold
                    AddMastery(274, Player.CreatingCharID); //light
                    AddMastery(275, Player.CreatingCharID); //fire
                    AddMastery(276, Player.CreatingCharID); //force
                }
                //Add job mastery same for both races
                AddMastery(1000, Player.CreatingCharID);
                //Add the base items
                AddItem(Item[0], 0, 1, Player.CreatingCharID, 0);
                AddItem(Item[1], 0, 4, Player.CreatingCharID, 0);
                AddItem(Item[2], 0, 5, Player.CreatingCharID, 0);
                AddItem(Item[3], 0, 6, Player.CreatingCharID, 0);
                //Open settings information for start items
                ini = new Framework.Ini(Environment.CurrentDirectory + @"\Settings\Settings.ini");
                try
                {
                    //European start items custom
                    string Item1 = ini.GetValue("European.Start", "Item1", "").ToString();
                    string Item2 = ini.GetValue("European.Start", "Item2", "").ToString();
                    string Item3 = ini.GetValue("European.Start", "Item3", "").ToString();
                    string Item4 = ini.GetValue("European.Start", "Item4", "").ToString();
                    string Item5 = ini.GetValue("European.Start", "Item5", "").ToString();
                    //Chinese start items cusom
                    string Item6  = ini.GetValue("Chinese.Start", "Item1", "").ToString();
                    string Item7  = ini.GetValue("Chinese.Start", "Item2", "").ToString();
                    string Item8  = ini.GetValue("Chinese.Start", "Item3", "").ToString();
                    string Item9  = ini.GetValue("Chinese.Start", "Item4", "").ToString();
                    string Item10 = ini.GetValue("Chinese.Start", "Item5", "").ToString();
                    //The amount related information for european items custom
                    string Amount1 = ini.GetValue("European.Start", "Amount1", "").ToString();
                    string Amount2 = ini.GetValue("European.Start", "Amount2", "").ToString();
                    string Amount3 = ini.GetValue("European.Start", "Amount3", "").ToString();
                    string Amount4 = ini.GetValue("European.Start", "Amount4", "").ToString();
                    string Amount5 = ini.GetValue("European.Start", "Amount5", "").ToString();
                    //The amount related information for chinese items custom
                    string Amount6  = ini.GetValue("Chinese.Start", "Amount1", "").ToString();
                    string Amount7  = ini.GetValue("Chinese.Start", "Amount2", "").ToString();
                    string Amount8  = ini.GetValue("Chinese.Start", "Amount3", "").ToString();
                    string Amount9  = ini.GetValue("Chinese.Start", "Amount4", "").ToString();
                    string Amount10 = ini.GetValue("Chinese.Start", "Amount5", "").ToString();
                    //Add the custom items (European)
                    AddItem(Convert.ToInt32(Item1), Convert.ToByte(Amount1), 13, Player.CreatingCharID, 0);
                    AddItem(Convert.ToInt32(Item2), Convert.ToByte(Amount2), 14, Player.CreatingCharID, 0);
                    AddItem(Convert.ToInt32(Item3), Convert.ToByte(Amount3), 15, Player.CreatingCharID, 0);
                    AddItem(Convert.ToInt32(Item4), Convert.ToByte(Amount4), 16, Player.CreatingCharID, 0);
                    AddItem(Convert.ToInt32(Item5), Convert.ToByte(Amount5), 17, Player.CreatingCharID, 0);
                    //Add the custom items (Chinese)
                    AddItem(Convert.ToInt32(Item6), Convert.ToByte(Amount1), 13, Player.CreatingCharID, 0);
                    AddItem(Convert.ToInt32(Item7), Convert.ToByte(Amount2), 14, Player.CreatingCharID, 0);
                    AddItem(Convert.ToInt32(Item8), Convert.ToByte(Amount3), 15, Player.CreatingCharID, 0);
                    AddItem(Convert.ToInt32(Item9), Convert.ToByte(Amount4), 16, Player.CreatingCharID, 0);
                    AddItem(Convert.ToInt32(Item10), Convert.ToByte(Amount5), 17, Player.CreatingCharID, 0);
                }
                catch (Exception) { }

                //Update database information for stats
                MsSQL.UpdateData("update character set min_phyatk='" + (int)Math.Round(MinimalPhysicalAttack) +
                                 "', max_phyatk='" + Math.Round(MaxPhysicalAttack) +
                                 "', min_magatk='" + Math.Round(MinimalMagicalAttack) +
                                 "', max_magatk='" + Math.Round(MaxMagicalAttack) +
                                 "', phydef='" + Math.Round(PhysicalDefense) +
                                 "', magdef='" + Math.Round(PhysicalDefense) +
                                 "', parry='" + Math.Round(ParryRatio) +
                                 "', hit='" + Math.Round(HitRatio) +
                                 "' where name='" + NewCharacterName + "'");
                //Send information to the console
                Console.WriteLine("Character: " + NewCharacterName + " has been created");
                //Send packet success to the client
                client.Send(Packet.ScreenSuccess(1));
            }
            //If a error happens just catch it.
            catch (Exception ex) { Console.WriteLine(ex); }
        }
Пример #7
0
        static void Main(string[] args)
        {
            System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo(System.Globalization.CultureInfo.GetCultureInfo(TxtFile.GetSystemDefaultLangID()).ToString());

            Framework.Ini ini;

            DarkEmu_GameServer.Systemcore.Definitions.Bootlogo._Load();

            Program pro = new Program();

            // Begin connection to our database.
            Systems.MsSQL.OnDatabaseError += new Systems.MsSQL.dError(db_OnDatabaseError);
            // Read our database settings from our ini file.
            Systems.MsSQL.OnConnectedToDatabase += new Systems.MsSQL.dConnected(db_OnConnectedToDatabase);
            // Check if our ini file excists.
            string sqlConnect = @"Data Source=(local)\SQLEXPRESS;Initial Catalog=silkroad;Integrated Security=True;MultipleActiveResultSets=True;";
            string sIpIPC = "127.0.0.1";
            string sIpServer = "127.0.0.1";
            UInt16 iPortIPC = 15791;
            UInt16 iPortServer = 15780;
            UInt16 iPortCmd = 10101;
            if (File.Exists("./Settings/Settings.ini"))
            {
                //Load our ini file
                ini = new Framework.Ini(Environment.CurrentDirectory + @"\Settings\Settings.ini");
                //Read line below given value.
                sqlConnect = ini.GetValue("Database", "connectionstring", @"Data Source=(local)\SQLEXPRESS;Initial Catalog=silkroad;Integrated Security=True;MultipleActiveResultSets=True;").ToString();
                //Load our rates.
                Systems.Rate.Gold = Convert.ToByte(ini.GetValue("Rates", "Goldrate", 1));
                Systems.Rate.Item = Convert.ToByte(ini.GetValue("Rates", "Droprate", 1));
                Systems.Rate.Xp = Convert.ToByte(ini.GetValue("Rates", "XPrate", 1));
                Systems.Rate.Sp = Convert.ToByte(ini.GetValue("Rates", "SPrate", 1));
                Systems.Rate.Sox = Convert.ToByte(ini.GetValue("Rates", "Sealrate", 1));
                Systems.Rate.Elixir = Convert.ToByte(ini.GetValue("Rates", "Elixirsrate", 1));
                Systems.Rate.Alchemyd = Convert.ToByte(ini.GetValue("Rates", "Alchemyrate", 1));
                Systems.Rate.ETCd = Convert.ToByte(ini.GetValue("Rates", "ETCrate", 1));
                Systems.Rate.Spawns = Convert.ToByte(ini.GetValue("Rates", "Spawnrate", 1));
                iPortIPC = Convert.ToUInt16(ini.GetValue("IPC", "port", 15791));
                sIpIPC = ini.GetValue("IPC", "ip", "127.0.0.1");
                iPortServer = Convert.ToUInt16(ini.GetValue("Server", "port", 15780));
                sIpServer = ini.GetValue("Server", "ip", "127.0.0.1");
                iPortCmd = Convert.ToUInt16(ini.GetValue("CMD", "port", 10101));
                DarkEmu_GameServer.Systems.maxSlots = Convert.ToInt32(ini.GetValue("Server", "MaxSlots", 100));
            }
            else
            {
                Systems.Rate.Gold = 1;
                Systems.Rate.Item = 1;
                Systems.Rate.Xp = 1;
                Systems.Rate.Sp = 1;
                Systems.Rate.Sox = 1;
                Systems.Rate.Elixir = 1;
                Systems.Rate.Alchemyd = 1;
                Systems.Rate.ETCd = 1;
                Systems.Rate.Spawns = 1;
                Systems.maxSlots = 100;

            }
            Systems.MsSQL.Connection(sqlConnect);
            //Boot_Logo._Rates();
            // create servers
            try
            {
                net = new Systems.Server();

                net.OnConnect += new Systems.Server.dConnect(pro._OnClientConnect);
                net.OnError += new Systems.Server.dError(pro._ServerError);

                Systems.ServerStartedTime = DateTime.Now;

                Systems.Client.OnReceiveData += new Systems.Client.dReceive(pro._OnReceiveData);
                Systems.Client.OnDisconnect += new Systems.Client.dDisconnect(pro._OnClientDisconnect);

                #region CommandServer StartUp
                cmd = new Systems.CommandServer();
                cmd.OnCommandReceived += new Systems.CommandServer.dCommandReceived(pro._command);
                #endregion
                #region IPC Server StartUp
                Systems.IPC = new Servers.IPCServer();
                Systems.IPC.OnReceive += new Servers.IPCServer.dOnReceive(pro._OnIPC);
                Systems.LoadServers("LoginServers.ini", 15790);
                #endregion

            }
            catch (Exception err)
            {
                Console.WriteLine(err);
            }

            DarkEmu_GameServer.Systems.CheckDirectories();

            DarkEmu_GameServer.File.FileLoad.Load();
            //Update serverlist info
            DarkEmu_GameServer.Systems.clients.update += new EventHandler(Users.updateServerList);
            //Load random unique monsters.
            /*Random rand = new Random();*/

            /*
            DarkEmu_GameServer.GlobalUnique.StartTGUnique(rand.Next(10, 20) * 60000, 600);   //Random spawn tiger girl
            DarkEmu_GameServer.GlobalUnique.StartUriUnique(rand.Next(10, 20) * 60000, 600);   //Random spawn urichi
            DarkEmu_GameServer.GlobalUnique.StartIsyUnique(rand.Next(10, 20) * 60000, 600);   //Random spawn isy
            DarkEmu_GameServer.GlobalUnique.StartLordUnique(rand.Next(10, 20) * 60000, 600);   //Random spawn lord yarkan
            DarkEmu_GameServer.GlobalUnique.StartDemonUnique(rand.Next(10, 20) * 60000, 600);   //Random spawn demon shaitan
            DarkEmu_GameServer.GlobalUnique.StartCerbUnique(rand.Next(10, 20) * 60000, 600);   //Random spawn cerberus
            DarkEmu_GameServer.GlobalUnique.StartMedusa(rand.Next(10, 20) * 90000, 600);   //Random spawn medusa
            DarkEmu_GameServer.GlobalUnique.StartNeith(rand.Next(10, 20) * 90000, 600);   //Random spawn neith
            //Game.GlobalUnique.StartSphinx       (rand.Next(10, 20) * 90000, 600);   //Random spawn medusa
            DarkEmu_GameServer.GlobalUnique.StartIsis(rand.Next(10, 20) * 90000, 600);   //Random spawn isis
            //Game.GlobalUnique.StartRoc          (rand.Next(10, 20) * 90000, 600);   //Random spawn roc
            DarkEmu_GameServer.GlobalUnique.StartIvyUnique(rand.Next(10, 20) * 60000, 600);   //Random spawn captain ivy
            */

            // start listening servers
            cmd.Start("127.0.0.1", iPortCmd);
            Systems.IPC.Start(sIpIPC, iPortIPC);
            net.Start(sIpServer, iPortServer);
            Systems.UpdateServerInfo();

            //Run for commands in console.
            Program launch = new Program();
            Thread run = new Thread(new ThreadStart(launch.run));
            run.Start();

            // main loop
            lastPromote = DateTime.Now;
            while (run.IsAlive)
            {
                Thread.Sleep(10);
                if (lastPromote.AddSeconds(60) < DateTime.Now)
                {
                    lastPromote = DateTime.Now;
                    Systems.UpdateServerInfo();
                }
            }
            Systems.UpdateServerInfo(0);
            net.ServerCheck(false);
        }
Пример #8
0
        public void Manager_Work()
        {
            Framework.Ini ini;
            // Begin connection to our database.
            Systems.MsSQL.OnDatabaseError += new Systems.MsSQL.dError(db_OnDatabaseError);
            // Read our database settings from our ini file.
            Systems.MsSQL.OnConnectedToDatabase += new Systems.MsSQL.dConnected(db_OnConnectedToDatabase);
            // Check if our ini file excists.
            string sqlConnect = @"Data Source=(local)\SQLEXPRESS;Initial Catalog=silk;Integrated Security=True;MultipleActiveResultSets=True;";
            string sIpIPC = "";
            string sIpServer = "";
            UInt16 iPortIPC = 15780;
            UInt16 iPortServer = 15780;
            UInt16 iPortCmd = 10101;
            if (System.IO.File.Exists("./Settings/Settings.ini"))
            {
                //Load our ini file
                ini = new Framework.Ini(Environment.CurrentDirectory + @"\Settings\Settings.ini");
                //Read line below given value.
                sqlConnect = ini.GetValue("Database", "connectionstring", @"Data Source=(local)\SQLEXPRESS;Initial Catalog=silk;Integrated Security=True;MultipleActiveResultSets=True;").ToString();
                //Load our rates.
                Game.Rate.Gold = Convert.ToByte(ini.GetValue("Rates", "Goldrate", 1));
                Game.Rate.Item = Convert.ToByte(ini.GetValue("Rates", "Droprate", 1));
                Game.Rate.Xp = Convert.ToByte(ini.GetValue("Rates", "XPrate", 1));
                Game.Rate.Sp = Convert.ToByte(ini.GetValue("Rates", "SPrate", 1));
                Game.Rate.Sox = Convert.ToByte(ini.GetValue("Rates", "Sealrate", 1));
                Game.Rate.Elixir = Convert.ToByte(ini.GetValue("Rates", "Elixirsrate", 1));
                Game.Rate.Alchemyd = Convert.ToByte(ini.GetValue("Rates", "Alchemyrate", 1));
                Game.Rate.ETCd = Convert.ToByte(ini.GetValue("Rates", "ETCrate", 1));
                Game.Rate.Spawns = Convert.ToByte(ini.GetValue("Rates", "Spawnrate", 1));
                iPortIPC = Convert.ToUInt16(ini.GetValue("IPC", "port", 15780));
                sIpIPC = ini.GetValue("IPC", "ip", "");
                iPortServer = Convert.ToUInt16(ini.GetValue("Server", "port", 15780));
                sIpServer = ini.GetValue("Server", "ip", "");
                iPortCmd = Convert.ToUInt16(ini.GetValue("CMD", "port", 10101));
                Game.Systems.maxSlots = Convert.ToInt32(ini.GetValue("Server", "MaxSlots", 100));
            }
            else
            {
                Game.Rate.Gold = 1;
                Game.Rate.Item = 1;
                Game.Rate.Xp = 1;
                Game.Rate.Sp = 1;
                Game.Rate.Sox = 1;
                Game.Rate.Elixir = 1;
                Game.Rate.Alchemyd = 1;
                Game.Rate.ETCd = 1;
                Game.Rate.Spawns = 1;
                Game.Systems.maxSlots = 100;

            }
            Systems.MsSQL.Connection(sqlConnect);
            // create servers
            try
            {
                net = new Systems.Server();

                net.OnConnect += new Systems.Server.dConnect(_OnClientConnect);
                net.OnError += new Systems.Server.dError(_ServerError);

                Systems.ServerStartedTime = DateTime.Now;

                Systems.Client.OnReceiveData += new Systems.Client.dReceive(_OnReceiveData);
                Systems.Client.OnDisconnect += new Systems.Client.dDisconnect(_OnClientDisconnect);

                #region CommandServer StartUp
                cmd = new Systems.CommandServer();
                cmd.OnCommandReceived += new Systems.CommandServer.dCommandReceived(_command);
                #endregion
                #region IPC Server StartUp
                Systems.IPC = new Servers.IPCServer();
                Systems.IPC.OnReceive += new Servers.IPCServer.dOnReceive(_OnIPC);
                Systems.LoadServers("LoginServers.ini", 15779);
                #endregion

            }
            catch (Exception)
            {
                //Activity(err);
            }

            Game.Systems.CheckDirectories();

            Game.File.FileLoad.Load(this);
            //Update serverlist info
            Game.Systems.clients.update += new EventHandler(Users.updateServerList);
            //Load random unique monsters.
            Random rand = new Random();

            Game.GlobalUnique.StartTGUnique(rand.Next(10, 20) * 60000, 600);   //Random spawn tiger girl
            Game.GlobalUnique.StartUriUnique(rand.Next(10, 20) * 60000, 600);   //Random spawn urichi
            Game.GlobalUnique.StartIsyUnique(rand.Next(10, 20) * 60000, 600);   //Random spawn isy
            Game.GlobalUnique.StartLordUnique(rand.Next(10, 20) * 60000, 600);   //Random spawn lord yarkan
            Game.GlobalUnique.StartDemonUnique(rand.Next(10, 20) * 60000, 600);   //Random spawn demon shaitan
            Game.GlobalUnique.StartCerbUnique(rand.Next(10, 20) * 60000, 600);   //Random spawn cerberus
            Game.GlobalUnique.StartMedusa(rand.Next(10, 20) * 90000, 600);   //Random spawn medusa
            Game.GlobalUnique.StartNeith(rand.Next(10, 20) * 90000, 600);   //Random spawn neith
            //Game.GlobalUnique.StartSphinx       (rand.Next(10, 20) * 90000, 600);   //Random spawn medusa
            Game.GlobalUnique.StartIsis(rand.Next(10, 20) * 90000, 600);   //Random spawn isis
            //Game.GlobalUnique.StartRoc          (rand.Next(10, 20) * 90000, 600);   //Random spawn roc
            Game.GlobalUnique.StartIvyUnique(rand.Next(10, 20) * 60000, 600);   //Random spawn captain ivy

            // start listening servers
            cmd.Start("127.0.0.1", iPortCmd);
            Systems.IPC.Start(sIpIPC, iPortIPC);
            net.Start(sIpServer, iPortServer);
            Systems.UpdateServerInfo();
            // main loop
            lastPromote = DateTime.Now;
            Thread check = new Thread(run);
            check.Start();
            while (check.IsAlive)
            {
                Thread.Sleep(10);
                if (lastPromote.AddSeconds(60) < DateTime.Now)
                {
                    lastPromote = DateTime.Now;
                    Systems.UpdateServerInfo();
                }
            }
            Systems.UpdateServerInfo(0);
            net.ServerCheck(false);
        }
Пример #9
0
        ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        // Spawn Monsters
        ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        void GM_LOADMONSTER(int model, byte type, byte type2)
        {
            try
            {
                Framework.Ini ini;
                ini = new Framework.Ini(Environment.CurrentDirectory + @"\Settings\Settings.ini");
                string count = ini.GetValue("Custom", "GMSpawnCount", "1").ToString();
                int total = Convert.ToInt16(count);

                for (int i = 1; i <= total; i++)
                {

                    obj o = new obj();

                    o.ID = model;
                    o.Type = type;
                    o.Ids = new Global.ID(Global.ID.IDS.Object);
                    o.UniqueID = o.Ids.GetUniqueID;
                    o.x = Character.Position.x;
                    o.z = Character.Position.z;
                    o.y = Character.Position.y;
                    o.oX = o.x;
                    o.oY = o.y;
                    o.xSec = Character.Position.xSec;
                    o.ySec = Character.Position.ySec;
                    o.AutoMovement = true;
                    o.HP = Data.ObjectBase[model].HP;
                    o.Agresif = Data.ObjectBase[model].Agresif;
                    if (Data.ObjectBase[model].Type == 4) o.LocalType = 4;
                    else if (Data.ObjectBase[model].Type == 1) o.LocalType = 1;
                    else if (Data.ObjectBase[model].Type == 2) o.LocalType = 2;
                    o.AutoSpawn = false;
                    o.Kat = 1;
                    o.SpeedWalk = Data.ObjectBase[o.ID].SpeedWalk;
                    o.SpeedRun = Data.ObjectBase[o.ID].SpeedRun;
                    o.SpeedZerk = Data.ObjectBase[o.ID].SpeedZerk;
                    Systems.aRound(ref o.oX, ref o.oY, 5);
                    Systems.Objects.Add(o);
                    o.SpawnMe();
                    if (o.ID == 1954 || o.ID == 1982 || o.ID == 2002 || o.ID == 3810 || o.ID == 3875 || o.ID == 5871 || o.ID == 14538 || o.ID == 14839 || o.ID == 3877)
                        Systems.SendAll(Packet.Unique_Data(5, (int)o.ID, null));

                        Framework.Ini ini2;
                        ini2 = new Framework.Ini(Environment.CurrentDirectory + @"\Settings\Settings.ini");
                        string spawnmessage = ini.GetValue("Custom", "EnableUniqueMessage", "0").ToString();
                        if (spawnmessage == "1")
                             Systems.SendAll(Packet.Unique_Data(5, (int)o.ID, null));
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }
        }
Пример #10
0
        void CharacterCreate()
        {
            try
            {
                //Define amount of characters allowed!
                if (MsSQL.GetRowsCount("SELECT * FROM character WHERE account='" + Player.AccountName + "'") == 4)
                    return;

                PacketReader Reader = new PacketReader(PacketInformation.buffer);
                Reader.Byte();
                string name = Reader.Text();
                int model = Reader.Int32();
                byte volume = Reader.Byte();
                int[] Item = new int[4];
                Item[0] = Reader.Int32();
                Item[1] = Reader.Int32();
                Item[2] = Reader.Int32();
                Item[3] = Reader.Int32();
                Reader.Close();

                #region Check Name
                if (CharacterCheck(name))
                {
                    client.Send(Packet.CharacterName(4));
                    return;
                }
                if (name.Contains("[")) return;
                if (name.Contains("GM")) return;
                if (name.Contains("]")) return;
                if (name.Contains("_")) return;
                if (name.Contains("-")) return;
                #endregion
                //#################################################################### European models begin

                if (model >= 14715 && model <= 14745)
                {
                    MsSQL.InsertData("INSERT INTO character (account, name, chartype, volume, xsect, ysect, xpos, zpos, ypos, savearea,GuideData) VALUES ('" + Player.AccountName + "','" + name + "', '" + model + "', '" + volume + "','79','105','1000','1000','83','20','0000000000000000')");
                    MsSQL.InsertData("INSERT INTO character_rev (charname, revxsec, revysec, revx, revy, revz) VALUES ('" + name + "','79','105','1000','22','83')");
                    Player.CreatingCharID = MsSQL.GetDataInt("Select * from character Where name='" + name + "'", "id");

                    double MagDef = 3;
                    double PhyDef = 6;
                    double Parry = 11;
                    double Hit = 11;
                    double MinPhyA = 6;
                    double MaxPhyA = 9;
                    double MinMagA = 6;
                    double MaxMagA = 10;

                    Framework.Ini ini;
                    ini = new Framework.Ini(Environment.CurrentDirectory + @"\Settings\Settings_Custom.ini");
                    string Item1 = ini.GetValue("START ITEMS EUROPE", "Item001").ToString();
                    string Item2 = ini.GetValue("START ITEMS EUROPE", "Item002").ToString();
                    string Item3 = ini.GetValue("START ITEMS EUROPE", "Item003").ToString();
                    string Item4 = ini.GetValue("START ITEMS EUROPE", "Item004").ToString();
                    string Item5 = ini.GetValue("START ITEMS EUROPE", "Item005").ToString();

                    string Amount1 = ini.GetValue("START ITEMS EUROPE", "Amount001").ToString();
                    string Amount2 = ini.GetValue("START ITEMS EUROPE", "Amount002").ToString();
                    string Amount3 = ini.GetValue("START ITEMS EUROPE", "Amount003").ToString();
                    string Amount4 = ini.GetValue("START ITEMS EUROPE", "Amount004").ToString();
                    string Amount5 = ini.GetValue("START ITEMS EUROPE", "Amount005").ToString();
                    try
                    {
                    AddItem(Convert.ToInt32(Item1), Convert.ToByte(Amount1), 13, 1, Player.CreatingCharID, 0);
                    AddItem(Convert.ToInt32(Item2), Convert.ToByte(Amount2), 14, 1, Player.CreatingCharID, 0);
                    AddItem(Convert.ToInt32(Item3), Convert.ToByte(Amount3), 15, 1, Player.CreatingCharID, 0);
                    AddItem(Convert.ToInt32(Item4), Convert.ToByte(Amount4), 16, 1, Player.CreatingCharID, 0);
                    AddItem(Convert.ToInt32(Item5), Convert.ToByte(Amount5), 17, 1, Player.CreatingCharID, 0);
                    }
                    catch (Exception)
                    {

                    }

                    AddItem(Item[0], 0, 1, 0, Player.CreatingCharID, 0);
                    AddItem(Item[1], 0, 4, 0, Player.CreatingCharID, 0);
                    AddItem(Item[2], 0, 5, 0, Player.CreatingCharID, 0);
                    AddItem(Item[3], 0, 6, 0, Player.CreatingCharID, 0);

                    MagDef += Data.ItemBase[Item[0]].Defans.MinMagDef;
                    MagDef += Data.ItemBase[Item[1]].Defans.MinMagDef;
                    MagDef += Data.ItemBase[Item[2]].Defans.MinMagDef;
                    PhyDef += Data.ItemBase[Item[0]].Defans.MinPhyDef;
                    PhyDef += Data.ItemBase[Item[1]].Defans.MinPhyDef;
                    PhyDef += Data.ItemBase[Item[2]].Defans.MinPhyDef;
                    Parry += Data.ItemBase[Item[0]].Defans.Parry;
                    Parry += Data.ItemBase[Item[1]].Defans.Parry;
                    Parry += Data.ItemBase[Item[2]].Defans.Parry;
                    Hit += Data.ItemBase[Item[3]].Attack.MinAttackRating;
                    MinPhyA += Data.ItemBase[Item[3]].Attack.Min_LPhyAttack;
                    MaxPhyA += Data.ItemBase[Item[3]].Attack.Min_HPhyAttack;
                    MinMagA += Data.ItemBase[Item[3]].Attack.Min_LMagAttack;
                    MaxMagA += Data.ItemBase[Item[3]].Attack.Min_HMagAttack;

                    if (Item[3] == 10730 || Item[3] == 10734)
                    {
                        MagDef += Data.ItemBase[251].Defans.MinMagDef;
                        PhyDef += Data.ItemBase[251].Defans.MinPhyDef;
                        Parry += Data.ItemBase[251].Defans.Parry;
                        AddItem(10738, 0, 7, 0, Player.CreatingCharID, 0);
                    }
                    if (Item[3] == 10733)
                    {
                        AddItem(10376, 250, 7, 1, Player.CreatingCharID, 0);
                    }
                    MsSQL.UpdateData("update character set min_phyatk='" + (int)Math.Round(MinPhyA) +
                            "', max_phyatk='" + Math.Round(MaxPhyA) +
                            "', min_magatk='" + Math.Round(MinMagA) +
                            "', max_magatk='" + Math.Round(MaxMagA) +
                            "', phydef='" + Math.Round(PhyDef) +
                            "', magdef='" + Math.Round(PhyDef) +
                            "', parry='" + Math.Round(Parry) +
                            "', hit='" + Math.Round(Hit) +
                            "' where name='" + name + "'");

                    AddMastery(513, Player.CreatingCharID); //Warrior
                    AddMastery(515, Player.CreatingCharID); //Rogue
                    AddMastery(514, Player.CreatingCharID); //Wizard
                    AddMastery(516, Player.CreatingCharID); //Warlock
                    AddMastery(517, Player.CreatingCharID); //Bard
                    AddMastery(518, Player.CreatingCharID); //Cleric
                    Console.WriteLine("@Gameserver:             Character: " + name + " Has been created");
                    client.Send(Packet.ScreenSuccess(1));
                }
                else
                {

                    #region Check Name
                    if (CharacterCheck(name))
                    {
                        client.Send(Packet.CharacterName(4));
                        return;
                    }
                    #endregion
                    //#################################################################### Chinese models begin
                    MsSQL.InsertData("INSERT INTO character (account, name, chartype, volume,GuideData) VALUES ('" + Player.AccountName + "','" + name + "', '" + model + "', '" + volume + "','0000000000000000')");
                    MsSQL.InsertData("INSERT INTO character_rev (charname, revxsec, revysec, revx, revy, revz) VALUES ('" + name + "','168','79','911','1083','-32')");
                    Player.CreatingCharID = MsSQL.GetDataInt("Select * from character Where name='" + name + "'", "id");

                    #region Item
                    double MagDef   = 3;
                    double PhyDef   = 6;
                    double Parry    = 11;
                    double Hit      = 11;
                    double MinPhyA  = 6;
                    double MaxPhyA  = 9;
                    double MinMagA  = 6;
                    double MaxMagA  = 10;

                    Framework.Ini ini;
                    ini = new Framework.Ini(Environment.CurrentDirectory + @"\Settings\Settings_Custom.ini");

                    string Item1 = ini.GetValue("START ITEMS CHINESE", "Item001").ToString();
                    string Item2 = ini.GetValue("START ITEMS CHINESE", "Item002").ToString();
                    string Item3 = ini.GetValue("START ITEMS CHINESE", "Item003").ToString();
                    string Item4 = ini.GetValue("START ITEMS CHINESE", "Item004").ToString();
                    string Item5 = ini.GetValue("START ITEMS CHINESE", "Item005").ToString();

                    string Amount1 = ini.GetValue("START ITEMS CHINESE", "Amount001").ToString();
                    string Amount2 = ini.GetValue("START ITEMS CHINESE", "Amount002").ToString();
                    string Amount3 = ini.GetValue("START ITEMS CHINESE", "Amount003").ToString();
                    string Amount4 = ini.GetValue("START ITEMS CHINESE", "Amount004").ToString();
                    string Amount5 = ini.GetValue("START ITEMS CHINESE", "Amount005").ToString();

                    try
                    {
                        AddItem(Convert.ToInt32(Item1), Convert.ToByte(Amount1), 13, 1, Player.CreatingCharID, 0);
                        AddItem(Convert.ToInt32(Item2), Convert.ToByte(Amount2), 14, 1, Player.CreatingCharID, 0);
                        AddItem(Convert.ToInt32(Item3), Convert.ToByte(Amount3), 15, 1, Player.CreatingCharID, 0);
                        AddItem(Convert.ToInt32(Item4), Convert.ToByte(Amount4), 16, 1, Player.CreatingCharID, 0);
                        AddItem(Convert.ToInt32(Item5), Convert.ToByte(Amount5), 17, 1, Player.CreatingCharID, 0);
                    }
                    catch (Exception)
                    {

                    }

                    AddItem(Item[0], 0, 1, 0, Player.CreatingCharID, 0);
                    AddItem(Item[1], 0, 4, 0, Player.CreatingCharID, 0);
                    AddItem(Item[2], 0, 5, 0, Player.CreatingCharID, 0);
                    AddItem(Item[3], 0, 6, 0, Player.CreatingCharID, 0);

                    MagDef +=   Data.ItemBase[Item[0]].Defans.MinMagDef;
                    MagDef +=   Data.ItemBase[Item[1]].Defans.MinMagDef;
                    MagDef +=   Data.ItemBase[Item[2]].Defans.MinMagDef;
                    PhyDef +=   Data.ItemBase[Item[0]].Defans.MinPhyDef;
                    PhyDef +=   Data.ItemBase[Item[1]].Defans.MinPhyDef;
                    PhyDef +=   Data.ItemBase[Item[2]].Defans.MinPhyDef;
                    Parry +=    Data.ItemBase[Item[0]].Defans.Parry;
                    Parry +=    Data.ItemBase[Item[1]].Defans.Parry;
                    Parry +=    Data.ItemBase[Item[2]].Defans.Parry;
                    Hit +=      Data.ItemBase[Item[3]].Attack.MinAttackRating;
                    MinPhyA +=  Data.ItemBase[Item[3]].Attack.Min_LPhyAttack;
                    MaxPhyA +=  Data.ItemBase[Item[3]].Attack.Min_HPhyAttack;
                    MinMagA +=  Data.ItemBase[Item[3]].Attack.Min_LMagAttack;
                    MaxMagA +=  Data.ItemBase[Item[3]].Attack.Min_HMagAttack;

                    if (Item[3] == 3632 || Item[3] == 3633)
                    {
                        MagDef +=   Data.ItemBase[251].Defans.MinMagDef;
                        PhyDef +=   Data.ItemBase[251].Defans.MinPhyDef;
                        Parry +=    Data.ItemBase[251].Defans.Parry;
                        AddItem(251, 0, 7, 0, Player.CreatingCharID, 0);
                    }
                    if (Item[3] == 3636)
                    {
                        AddItem(62, 250, 7, 1, Player.CreatingCharID, 0);
                    }
                    #endregion

                    MsSQL.UpdateData("update character set min_phyatk='" + (int)Math.Round(MinPhyA) +
                            "', max_phyatk='"   + Math.Round(MaxPhyA) +
                            "', min_magatk='"   + Math.Round(MinMagA) +
                            "', max_magatk='"   + Math.Round(MaxMagA) +
                            "', phydef='"       + Math.Round(PhyDef) +
                            "', magdef='"       + Math.Round(PhyDef) +
                            "', parry='"        + Math.Round(Parry) +
                            "', hit='"          + Math.Round(Hit) +
                            "' where name='"    + name + "'");

                    AddMastery(257, Player.CreatingCharID); //blade
                    AddMastery(258, Player.CreatingCharID); //heuksal
                    AddMastery(259, Player.CreatingCharID); //bow
                    AddMastery(273, Player.CreatingCharID); //cold
                    AddMastery(274, Player.CreatingCharID); //light
                    AddMastery(275, Player.CreatingCharID); //fire
                    AddMastery(276, Player.CreatingCharID); //force
                    Console.WriteLine("@Gameserver:             Character: " + name + " Has been created");
                    client.Send(Packet.ScreenSuccess(1));

                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("CharacterCreate()");
                deBug.Write(ex);
                Console.WriteLine(ex);
            }
        }
Пример #11
0
 /////////////////////////////////////////////////////////////////////////////////
 // Load weather
 /////////////////////////////////////////////////////////////////////////////////
 void LoadWeather()
 {
     #region Weather
     //Weather should be defined per zone
     Ini ini = new Ini();
     ini = new Framework.Ini(Environment.CurrentDirectory + @"\Settings\Settings_Custom.ini");
     string Enabled = ini.GetValue("WEATHER_ENABLED", "Enabled").ToString();
     string Type = ini.GetValue("WEATHER_TYPE", "Type").ToString();
     string Info = ini.GetValue("WEATHER_INTENSITY", "Info").ToString();
     if (Enabled == "1")
     {
         client.Send(Packet.Weather(Convert.ToByte(Type), Convert.ToInt32(Info)));
     }
     else
     {
         client.Send(Packet.Weather(0, 1));
     }
     //client.Send(Packet.SnowFlakeEvent());
     #endregion
 }
Пример #12
0
        /////////////////////////////////////////////////////////////////////////////////
        // Load our starting message
        /////////////////////////////////////////////////////////////////////////////////
        void LoadMessage()
        {
            #region Welcome message
            if (!Character.Information.WelcomeMessage)
            {
                Framework.Ini ini;
                ini = new Framework.Ini(Environment.CurrentDirectory + @"\Settings\Settings_Custom.ini");
                string servername = ini.GetValue("SERVER_MESSAGE", "Message").ToString();

                int wait = 3000;
                string welcome = "Welcome to " + servername + "";
                client.Send(sendnoticecon(7, 0, welcome, ""));
                for (int i = 1; i < wait + 1; i += 1)
                {
                    if (i == wait)
                    {
                        welcome = "Programmed by: http://xcoding.net";
                        client.Send(sendnoticecon(7, 0, welcome, ""));
                    }
                }
                Character.Information.WelcomeMessage = true;
            }
            #endregion
        }
Пример #13
0
        ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        // Create Items
        ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        void GM_MAKEITEM(int itemID, int itemPlus)
        {
            try
            {
                //Get monster mask id from config
                Framework.Ini ini;
                ini = new Framework.Ini(Environment.CurrentDirectory + @"\Settings\Settings.ini");
                string monstermaskid = ini.GetValue("Custom", "Monstermaskid","2002").ToString();
                int maskid = Convert.ToInt32(monstermaskid);

                //Get freeslots
                byte slot = GetFreeSlot();
                //No slots return
                if (slot == 0) return;

                AddItem(itemID, (short)itemPlus, slot, Character.Information.CharacterID, 0);
                client.Send(Packet.GM_MAKEITEM(0, slot, itemID, (short)itemPlus, (int)Data.ItemBase[itemID].Defans.Durability, Data.ItemBase[itemID].ID, Convert.ToInt32(monstermaskid)));

                Print.Format("[Gameserver:              " + Character.Information.Name + " Has created:  {0}", Data.ItemBase[itemID].Name);
            }
            catch (Exception ex)
            {
                Console.WriteLine("GM_MakeItem: {0}", ex);
            }
        }
Пример #14
0
        void LoadWeather()
        {
            //Wrap our function inside a catcher
            try
            {
                //NOTE: Must be defined per zone and random information

                //Load info from ini for now
                Ini ini = new Ini();
                ini = new Framework.Ini(Environment.CurrentDirectory + @"\Settings\Settings.ini");
                string Enabled = ini.GetValue("Custom", "WeatherEnabled", "true").ToString();
                string Type = ini.GetValue("Custom", "WeatherType", "1").ToString();
                string Info = ini.GetValue("Custom", "WeatherInfo", "10").ToString();

                //If the user has defined to enable custom weather type
                if (Enabled == "1")
                {
                    //We send the information they chosen
                    client.Send(Packet.Weather(Convert.ToByte(Type), Convert.ToInt32(Info)));
                }
                //If disabled
                else
                {
                    //Send static weather
                    client.Send(Packet.Weather(0, 1));
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Load weather error {0}", ex);
                Systems.Debugger.Write(ex);
            }
        }
Пример #15
0
        //Void creation for characters
        void CharacterCreate()
        {
            //Start wrapper for catching errors
            try
            {
                //Check the amount of characters created (If 4 then we return).
                if (MsSQL.GetRowsCount("SELECT * FROM character WHERE account='" + Player.AccountName + "'") == 4)
                    return;
                //Open our packet reader
                PacketReader Reader = new PacketReader(PacketInformation.buffer);
                //Need to be checked
                byte tocheck = Reader.Byte();
                //String character name
                string NewCharacterName = Reader.Text();
                //Integer for character model
                int NewCharacterModel = Reader.Int32();
                //Byte for character volume
                byte NewCharacterVolume = Reader.Byte();
                //Set new integer for item creation [4] total
                int[] Item = new int[4];
                //Item id one integer
                Item[0] = Reader.Int32();
                //Item id two integer
                Item[1] = Reader.Int32();
                //Item id three integer
                Item[2] = Reader.Int32();
                //Item id four integer
                Item[3] = Reader.Int32();
                //Close packet reader
                Reader.Close();
                //Set default character stats
                double MagicalDefense = 3;
                double PhysicalDefense = 6;
                double ParryRatio = 11;
                double HitRatio = 11;
                double MinimalPhysicalAttack = 6;
                double MaxPhysicalAttack = 9;
                double MinimalMagicalAttack = 6;
                double MaxMagicalAttack = 10;
                //Set mag defense
                MagicalDefense += Data.ItemBase[Item[0]].Defans.MinMagDef;
                MagicalDefense += Data.ItemBase[Item[1]].Defans.MinMagDef;
                MagicalDefense += Data.ItemBase[Item[2]].Defans.MinMagDef;
                //Set phy defence
                PhysicalDefense += Data.ItemBase[Item[0]].Defans.MinPhyDef;
                PhysicalDefense += Data.ItemBase[Item[1]].Defans.MinPhyDef;
                PhysicalDefense += Data.ItemBase[Item[2]].Defans.MinPhyDef;
                //Set parry information
                ParryRatio += Data.ItemBase[Item[0]].Defans.Parry;
                ParryRatio += Data.ItemBase[Item[1]].Defans.Parry;
                ParryRatio += Data.ItemBase[Item[2]].Defans.Parry;
                //Set hit ratio
                HitRatio += Data.ItemBase[Item[3]].Attack.MinAttackRating;
                //Set phy attack
                MinimalPhysicalAttack += Data.ItemBase[Item[3]].Attack.Min_LPhyAttack;
                MaxPhysicalAttack += Data.ItemBase[Item[3]].Attack.Min_HPhyAttack;
                //Set mag attack
                MinimalMagicalAttack += Data.ItemBase[Item[3]].Attack.Min_LMagAttack;
                MaxMagicalAttack += Data.ItemBase[Item[3]].Attack.Min_HMagAttack;
                //Set bool for european or chinese characters
                if (NewCharacterModel >= 14715 && NewCharacterModel <= 14745)
                    European = true;
                //Replace any bad character from the name like [ , ] etc.
                NewCharacterName = Removebadchars(NewCharacterName);
                //Check the character name before creation
                if (CharacterCheck(NewCharacterName))
                {
                    //If bad send informational packet
                    client.Send(Packet.CharacterName(4));
                    //Finally return.
                    return;
                }
                //Random x y z output
                int random = rnd.Next(1, 3);
                //If player is creating a european character
                if (European)
                {
                    //Set random start location for european
                    if (random == 1)
                    { randomx = 1030; randomz = 80; randomy = 512; }
                    if (random == 2)
                    { randomx = 889; randomz = 83; randomy = 1104; }
                    if (random == 3)
                    { randomx = 453; randomz = 80; randomy = 1249; }
                    //Insert the basic information into the database
                    MsSQL.InsertData("INSERT INTO character (account, name, chartype, volume, xsect, ysect, xpos, zpos, ypos, GuideData) VALUES ('" + Player.AccountName + "','" + NewCharacterName + "', '" + NewCharacterModel + "', '" + NewCharacterVolume + "','79','105','" + randomx + "','" + randomz + "','" + randomy + "','0000000000000000')");
                    //Insert reverse scroll data into the database
                    MsSQL.InsertData("INSERT INTO character_rev (charname, revxsec, revysec, revx, revy, revz) VALUES ('" + NewCharacterName + "','79','105','"+randomx+"','"+randomy+"','"+randomz+"')");
                    //Set definition for the character id information
                    Player.CreatingCharID = MsSQL.GetDataInt("Select * from character Where name='" + NewCharacterName + "'", "id");
                    //If the 3rd item is a sword or a dark staff
                    if (Item[3] == 10730 || Item[3] == 10734)
                    {
                        //Add the mag def information
                        MagicalDefense += Data.ItemBase[251].Defans.MinMagDef;
                        //Add the phy def information
                        PhysicalDefense += Data.ItemBase[251].Defans.MinPhyDef;
                        //Add parry ration
                        ParryRatio += Data.ItemBase[251].Defans.Parry;
                        //Add shield item
                        AddItem(10738, 0, 7, Player.CreatingCharID, 0);
                    }
                    //If the 3rd item is a crossbow
                    if (Item[3] == 10733)
                    {
                        //We add our base bolts 250
                        AddItem(10376, 250, 7, Player.CreatingCharID, 0);
                    }

                    //Add base mastery's for europe characters
                    AddMastery(513, Player.CreatingCharID); //Warrior
                    AddMastery(515, Player.CreatingCharID); //Rogue
                    AddMastery(514, Player.CreatingCharID); //Wizard
                    AddMastery(516, Player.CreatingCharID); //Warlock
                    AddMastery(517, Player.CreatingCharID); //Bard
                    AddMastery(518, Player.CreatingCharID); //Cleric
                }
                //If the character model is an chinese character
                else
                {
                    //Set random start location for chinese
                    if (random == 1)
                    { randomx = 1030; randomz = 80; randomy = 512; randomysec = 97; }
                    if (random == 2)
                    { randomx = 959; randomz = 20; randomy = 421; randomysec = 98; }
                    if (random == 3)
                    { randomx = 964; randomz = 0; randomy = 235; randomysec = 97; }
                    //Add character default information into the database
                    MsSQL.InsertData("INSERT INTO character (account, name, chartype, volume, xsect, ysect, xpos, zpos, ypos, GuideData) VALUES ('" + Player.AccountName + "','" + NewCharacterName + "', '" + NewCharacterModel + "', '" + NewCharacterVolume + "','168','" + randomysec + "','"+ randomx +"','"+ randomz +"','"+ randomy +"','0000000000000000')");
                    //Add character reverse scroll information into the database
                    MsSQL.InsertData("INSERT INTO character_rev (charname, revxsec, revysec, revx, revy, revz) VALUES ('" + NewCharacterName + "','168','"+randomysec+"','"+randomx+"','"+randomy+"','"+randomz+"')");
                    //Get new character id
                    Player.CreatingCharID = MsSQL.GetDataInt("Select * from character Where name='" + NewCharacterName + "'", "id");
                    //If the item chosen is a blade or sword
                    if (Item[3] == 3632 || Item[3] == 3633)
                    {
                        //Set magical defense for shield
                        MagicalDefense += Data.ItemBase[251].Defans.MinMagDef;
                        //Set physical defense for shield
                        PhysicalDefense += Data.ItemBase[251].Defans.MinPhyDef;
                        //Set parry ratio for shield
                        ParryRatio += Data.ItemBase[251].Defans.Parry;
                        //Add the shield to the character
                        AddItem(251, 0, 7, Player.CreatingCharID, 0);
                    }
                    //If the item is a bow
                    if (Item[3] == 3636)
                    {
                        //Add 250 arrows to the new character
                        AddItem(62, 250, 7, Player.CreatingCharID, 0);
                    }
                    AddMastery(257, Player.CreatingCharID); //blade
                    AddMastery(258, Player.CreatingCharID); //heuksal
                    AddMastery(259, Player.CreatingCharID); //bow
                    AddMastery(273, Player.CreatingCharID); //cold
                    AddMastery(274, Player.CreatingCharID); //light
                    AddMastery(275, Player.CreatingCharID); //fire
                    AddMastery(276, Player.CreatingCharID); //force
                }
                //Add job mastery same for both races
                AddMastery(1000, Player.CreatingCharID);
                //Add the base items
                AddItem(Item[0], 0, 1, Player.CreatingCharID, 0);
                AddItem(Item[1], 0, 4, Player.CreatingCharID, 0);
                AddItem(Item[2], 0, 5, Player.CreatingCharID, 0);
                AddItem(Item[3], 0, 6, Player.CreatingCharID, 0);
                //Open settings information for start items
                ini = new Framework.Ini(Environment.CurrentDirectory + @"\Settings\Settings.ini");
                try
                {
                    //European start items custom
                    string Item1 = ini.GetValue("European.Start", "Item1", "").ToString();
                    string Item2 = ini.GetValue("European.Start", "Item2", "").ToString();
                    string Item3 = ini.GetValue("European.Start", "Item3", "").ToString();
                    string Item4 = ini.GetValue("European.Start", "Item4", "").ToString();
                    string Item5 = ini.GetValue("European.Start", "Item5", "").ToString();
                    //Chinese start items cusom
                    string Item6 = ini.GetValue("Chinese.Start", "Item1", "").ToString();
                    string Item7 = ini.GetValue("Chinese.Start", "Item2", "").ToString();
                    string Item8 = ini.GetValue("Chinese.Start", "Item3", "").ToString();
                    string Item9 = ini.GetValue("Chinese.Start", "Item4", "").ToString();
                    string Item10 = ini.GetValue("Chinese.Start", "Item5", "").ToString();
                    //The amount related information for european items custom
                    string Amount1 = ini.GetValue("European.Start", "Amount1", "").ToString();
                    string Amount2 = ini.GetValue("European.Start", "Amount2", "").ToString();
                    string Amount3 = ini.GetValue("European.Start", "Amount3", "").ToString();
                    string Amount4 = ini.GetValue("European.Start", "Amount4", "").ToString();
                    string Amount5 = ini.GetValue("European.Start", "Amount5", "").ToString();
                    //The amount related information for chinese items custom
                    string Amount6 = ini.GetValue("Chinese.Start", "Amount1", "").ToString();
                    string Amount7 = ini.GetValue("Chinese.Start", "Amount2", "").ToString();
                    string Amount8 = ini.GetValue("Chinese.Start", "Amount3", "").ToString();
                    string Amount9 = ini.GetValue("Chinese.Start", "Amount4", "").ToString();
                    string Amount10 = ini.GetValue("Chinese.Start", "Amount5", "").ToString();
                    //Add the custom items (European)
                    AddItem(Convert.ToInt32(Item1), Convert.ToByte(Amount1), 13, Player.CreatingCharID, 0);
                    AddItem(Convert.ToInt32(Item2), Convert.ToByte(Amount2), 14, Player.CreatingCharID, 0);
                    AddItem(Convert.ToInt32(Item3), Convert.ToByte(Amount3), 15, Player.CreatingCharID, 0);
                    AddItem(Convert.ToInt32(Item4), Convert.ToByte(Amount4), 16, Player.CreatingCharID, 0);
                    AddItem(Convert.ToInt32(Item5), Convert.ToByte(Amount5), 17, Player.CreatingCharID, 0);
                    //Add the custom items (Chinese)
                    AddItem(Convert.ToInt32(Item6), Convert.ToByte(Amount1), 13, Player.CreatingCharID, 0);
                    AddItem(Convert.ToInt32(Item7), Convert.ToByte(Amount2), 14, Player.CreatingCharID, 0);
                    AddItem(Convert.ToInt32(Item8), Convert.ToByte(Amount3), 15, Player.CreatingCharID, 0);
                    AddItem(Convert.ToInt32(Item9), Convert.ToByte(Amount4), 16, Player.CreatingCharID, 0);
                    AddItem(Convert.ToInt32(Item10), Convert.ToByte(Amount5), 17, Player.CreatingCharID, 0);
                }
                catch (Exception) { }

                //Update database information for stats
                MsSQL.UpdateData("update character set min_phyatk='" + (int)Math.Round(MinimalPhysicalAttack) +
                        "', max_phyatk='" + Math.Round(MaxPhysicalAttack) +
                        "', min_magatk='" + Math.Round(MinimalMagicalAttack) +
                        "', max_magatk='" + Math.Round(MaxMagicalAttack) +
                        "', phydef='" + Math.Round(PhysicalDefense) +
                        "', magdef='" + Math.Round(PhysicalDefense) +
                        "', parry='" + Math.Round(ParryRatio) +
                        "', hit='" + Math.Round(HitRatio) +
                        "' where name='" + NewCharacterName + "'");
                //Send information to the console
                Console.WriteLine("Character: " + NewCharacterName + " has been created");
                //Send packet success to the client
                client.Send(Packet.ScreenSuccess(1));
            }
            //If a error happens just catch it.
            catch (Exception ex) { Console.WriteLine(ex); }
        }
Пример #16
0
 public Ini(Ini ini)
     : base(ini)
 {
 }
Пример #17
0
        ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        // Clear Inventory
        ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        void GM_CLEARINVEN()
        {
            //Options 0 or 1 , in Settings_Custom.ini
            Framework.Ini ini;
            ini = new Framework.Ini(Environment.CurrentDirectory + @"\Settings\Settings.ini");
            string Drop = ini.GetValue("Custom", "GMDrop","0").ToString();

            if (Drop.Equals("1"))
            {
                try
                {
                    //TODO: Add drop all items
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex);
                    return;
                }
            }
            else
            {
                if (Drop.Equals("0"))
                    MsSQL.UpdateData("delete from char_items where owner='" + Character.Information.CharacterID + "'");
                Character.InGame = false;

                BuffAllClose();

                DeSpawnMe();
                //ObjectDeSpawn();
                ObjectDeSpawnCheck();
                client.Send(Packet.TeleportOtherStart());

                Teleport_UpdateXYZ(Character.Information.Place);
                client.Send(Packet.TeleportImage(Data.PointBase[Character.Information.Place].xSec, Data.PointBase[Character.Information.Place].ySec));
                Character.Teleport = true;
                Timer.Scroll.Dispose();
                Timer.Scroll = null;
                Character.Information.Scroll = false;
            }
        }