Beispiel #1
0
        private static void EventSink_CharacterCreated(CharacterCreatedEventArgs args)
        {
            if (!VerifyProfession(args.Profession))
            {
                args.Profession = 0;
            }

            NetState state = args.State;

            if (state == null)
            {
                return;
            }

            Mobile newChar = CreateMobile(args.Account as Account);

            if (newChar == null)
            {
                Utility.PushColor(ConsoleColor.Red);
                Console.WriteLine("Login: {0}: Character creation failed, account full", state);
                Utility.PopColor();
                return;
            }

            args.Mobile = newChar;
            m_Mobile    = newChar;

            newChar.Player      = true;
            newChar.AccessLevel = args.Account.AccessLevel;
            newChar.Female      = args.Female;
            //newChar.Body = newChar.Female ? 0x191 : 0x190;

            if (Core.Expansion >= args.Race.RequiredExpansion)
            {
                newChar.Race = args.Race;       //Sets body
            }
            else
            {
                newChar.Race = Race.DefaultRace;
            }

            //newChar.Hue = Utility.ClipSkinHue( args.Hue & 0x3FFF ) | 0x8000;
            newChar.Hue = newChar.Race.ClipSkinHue(args.Hue & 0x3FFF) | 0x8000;

            newChar.Hunger = 20;

            bool young = false;

            if (newChar is PlayerMobile)
            {
                PlayerMobile pm       = (PlayerMobile)newChar;
                double       skillcap = Config.Player.SkillCap / 10;
                if (skillcap != 100.0)
                {
                    for (int i = 0; i < Enum.GetNames(typeof(SkillName)).Length; ++i)
                    {
                        pm.Skills[i].Cap = skillcap;
                    }
                }
                pm.Profession = args.Profession;

                if (pm.IsPlayer() && ((Account)pm.Account).Young)
                {
                    young = pm.Young = true;
                }
            }

            SetName(newChar, args.Name);

            AddBackpack(newChar);

            SetStats(newChar, state, args.Str, args.Dex, args.Int);
            SetSkills(newChar, args.Skills, args.Profession);

            Race race = newChar.Race;

            if (race.ValidateHair(newChar, args.HairID))
            {
                newChar.HairItemID = args.HairID;
                newChar.HairHue    = race.ClipHairHue(args.HairHue & 0x3FFF);
            }

            if (race.ValidateFacialHair(newChar, args.BeardID))
            {
                newChar.FacialHairItemID = args.BeardID;
                newChar.FacialHairHue    = race.ClipHairHue(args.BeardHue & 0x3FFF);
            }

            if (args.Profession <= 3)
            {
                AddShirt(newChar, args.ShirtHue);
                AddPants(newChar, args.PantsHue);
                AddShoes(newChar);
            }

            if (TestCenter.Enabled)
            {
                TestCenter.FillBankbox(newChar);
            }

            if (young)
            {
                NewPlayerTicket ticket = new NewPlayerTicket();
                ticket.Owner = newChar;
                newChar.BankBox.DropItem(ticket);
            }

            CityInfo city = GetStartLocation(args, young);

            if (Core.bEnforceExpansionClient && Core.LBR)
            {
                if (city == null)
                {
                    city = new CityInfo("Britain", "Sweet Dreams Inn", 1496, 1628, 10, Map.Felucca);
                }
            }

            newChar.MoveToWorld(city.Location, city.Map);

            Utility.PushColor(ConsoleColor.Green);
            Console.WriteLine("Login: {0}: New character being created (account={1})", state, args.Account.Username);
            Utility.PopColor();
            Utility.PushColor(ConsoleColor.DarkGreen);
            Console.WriteLine(" - Character: {0} (serial={1})", newChar.Name, newChar.Serial);
            Console.WriteLine(" - Started: {0} {1} in {2}", city.City, city.Location, city.Map.ToString());
            Utility.PopColor();

            new WelcomeTimer(newChar).Start();
        }
Beispiel #2
0
        private static void EventSink_CharacterCreated(CharacterCreatedEventArgs args)
        {
            if (!VerifyProfession(args.Profession))
            {
                args.Profession = 0;
            }

            var state = args.State;

            if (state == null)
            {
                return;
            }

            var newChar = CreateMobile(args.Account as Account);

            if (newChar == null)
            {
                Utility.PushColor(ConsoleColor.Red);
                Console.WriteLine("Login: {0}: Character creation failed, account full", state);
                Utility.PopColor();
                return;
            }

            args.Mobile = newChar;
            m_Mobile    = newChar;

            newChar.Player      = true;
            newChar.AccessLevel = args.Account.AccessLevel;
            newChar.Female      = args.Female;
            //newChar.Body = newChar.Female ? 0x191 : 0x190;

            if (Core.Expansion >= args.Race.RequiredExpansion)
            {
                newChar.Race = args.Race; //Sets body
            }
            else
            {
                newChar.Race = Race.DefaultRace;
            }

            newChar.Hue = args.Hue | 0x8000;

            newChar.Hunger = 20;

            var young = false;

            if (newChar is PlayerMobile)
            {
                var pm = (PlayerMobile)newChar;

                pm.AutoRenewInsurance = true;

                var skillcap = Initialization.Get("PlayerCaps.SkillCap", 1000.0d) / 10;

                if (skillcap != 100.0)
                {
                    for (var i = 0; i < Enum.GetNames(typeof(SkillName)).Length; ++i)
                    {
                        pm.Skills[i].Cap = skillcap;
                    }
                }

                pm.Profession = args.Profession;

                if (pm.IsPlayer() && pm.Account.Young && !Siege.SiegeShard)
                {
                    young = pm.Young = true;
                }
            }

            SetName(newChar, args.Name);

            AddBackpack(newChar);

            SetStats(newChar, state, args.Profession, args.Str, args.Dex, args.Int);
            SetSkills(newChar, args.Skills, args.Profession);

            var race = newChar.Race;

            if (race.ValidateHair(newChar, args.HairID))
            {
                newChar.HairItemID = args.HairID;
                newChar.HairHue    = args.HairHue;
            }

            if (race.ValidateFacialHair(newChar, args.BeardID))
            {
                newChar.FacialHairItemID = args.BeardID;
                newChar.FacialHairHue    = args.BeardHue;
            }

            var faceID = args.FaceID;

            if (faceID > 0 && race.ValidateFace(newChar.Female, faceID))
            {
                newChar.FaceItemID = faceID;
                newChar.FaceHue    = args.FaceHue;
            }
            else
            {
                newChar.FaceItemID = race.RandomFace(newChar.Female);
                newChar.FaceHue    = newChar.Hue;
            }

            if (args.Profession <= 3)
            {
                AddShirt(newChar, args.ShirtHue);
                AddPants(newChar, args.PantsHue);
                AddShoes(newChar);
            }

            if (TestCenter.Enabled)
            {
                TestCenter.FillBankbox(newChar);
            }

            if (young)
            {
                var ticket = new NewPlayerTicket
                {
                    Owner = newChar
                };

                newChar.BankBox.DropItem(ticket);
            }

            var city = args.City;
            var map  = Siege.SiegeShard && city.Map == Map.Trammel ? Map.Felucca : city.Map;

            newChar.MoveToWorld(city.Location, map);

            Utility.PushColor(ConsoleColor.Green);
            Console.WriteLine("Login: {0}: New character being created (account={1})", state, args.Account.Username);
            Utility.PopColor();
            Utility.PushColor(ConsoleColor.DarkGreen);
            Console.WriteLine(" - Character: {0} (serial={1})", newChar.Name, newChar.Serial);
            Console.WriteLine(" - Started: {0} {1} in {2}", city.City, city.Location, city.Map);
            Utility.PopColor();

            new WelcomeTimer(newChar).Start();
        }
Beispiel #3
0
        private static void EventSink_CharacterCreated(CharacterCreatedEventArgs args)
        {
            if (!VerifyProfession(args.Profession))
            {
                args.Profession = 0;
            }

            var state = args.State;

            if (state == null)
            {
                return;
            }

            var newChar = CreateMobile(args.Account as Account);

            if (newChar == null)
            {
                Utility.PushColor(ConsoleColor.Red);
                Console.WriteLine("Login: {0}: Character creation failed, account full", state);
                Utility.PopColor();
                return;
            }

            args.Mobile = newChar;
            m_Mobile    = newChar;

            newChar.Player      = true;
            newChar.AccessLevel = args.Account.AccessLevel;
            newChar.Female      = args.Female;
            //newChar.Body = newChar.Female ? 0x191 : 0x190;

            //UOSI: Trying to disable races, but no matter what you pick you're getting a human
            //if (Core.Expansion >= args.Race.RequiredExpansion)
            //	newChar.Race = args.Race; //Sets body
            //else
            //	newChar.Race = Race.DefaultRace;

            newChar.Race = Race.DefaultRace; //UOSI see above

            newChar.Hue = args.Hue | 0x8000;

            newChar.Hunger = 18;
            newChar.Thirst = 18; //UOSI added for the hunger/thirst system

            var young = false;

            if (newChar is PlayerMobile)
            {
                var pm = (PlayerMobile)newChar;

                pm.AutoRenewInsurance = true;

                var skillcap = Config.Get("PlayerCaps.SkillCap", 1000.0d) / 10;

                if (skillcap != 100.0)
                {
                    for (var i = 0; i < Enum.GetNames(typeof(SkillName)).Length; ++i)
                    {
                        pm.Skills[i].Cap = skillcap;
                    }
                }

                pm.Profession = args.Profession;

                if (pm.IsPlayer() && pm.Account.Young && !Siege.SiegeShard)
                {
                    young = pm.Young = true;
                }
            }

            SetName(newChar, args.Name);

            AddBackpack(newChar);

            SetStats(newChar, state, args.Str, args.Dex, args.Int);
            SetSkills(newChar, args.Skills, args.Profession);

            var race = newChar.Race;

            if (race.ValidateHair(newChar, args.HairID))
            {
                newChar.HairItemID = args.HairID;
                newChar.HairHue    = args.HairHue;
            }

            if (race.ValidateFacialHair(newChar, args.BeardID))
            {
                newChar.FacialHairItemID = args.BeardID;
                newChar.FacialHairHue    = args.BeardHue;
            }

            var faceID = args.FaceID;

            if (faceID > 0 && race.ValidateFace(newChar.Female, faceID))
            {
                newChar.FaceItemID = faceID;
                newChar.FaceHue    = args.FaceHue;
            }
            else
            {
                newChar.FaceItemID = race.RandomFace(newChar.Female);
                newChar.FaceHue    = newChar.Hue;
            }

            if (args.Profession <= 3)
            {
                AddShirt(newChar, args.ShirtHue);
                AddPants(newChar, args.PantsHue);
                AddShoes(newChar);
            }

            if (TestCenter.Enabled)
            {
                TestCenter.FillBankbox(newChar);
            }

            //UOSI idk what this is for, so now its gone.
            //if (young)
            //{
            //	var ticket = new NewPlayerTicket
            //	{
            //		Owner = newChar
            //	};

            //	newChar.BankBox.DropItem(ticket);
            //}

            //UOSI Added starting items
            newChar.AddToBackpack(new Waterskin());
            //newChar.AddToBackpack(new PlayerGuide());

            //UOSI Override the starting city
            var tCity = new CityInfo("", "", 236, 265, 0, Map.Tokuno);

            var city = args.City;
            var map  = Siege.SiegeShard && city.Map == Map.Trammel ? Map.Felucca : city.Map;

            //UOSI Override the starting city
            //newChar.MoveToWorld(city.Location, map);
            newChar.MoveToWorld(tCity.Location, Map.Tokuno);
            newChar.Direction = Direction.South;

            Utility.PushColor(ConsoleColor.Green);
            Console.WriteLine("Login: {0}: New character being created (account={1})", state, args.Account.Username);
            Utility.PopColor();
            Utility.PushColor(ConsoleColor.DarkGreen);
            Console.WriteLine(" - Character: {0} (serial={1})", newChar.Name, newChar.Serial);
            Console.WriteLine(" - Started: {0} {1} in {2}", tCity.City, tCity.Location, tCity.Map);             //UOSI
            Utility.PopColor();

            new WelcomeTimer(newChar).Start();
        }