Пример #1
0
 private static CityInfo GetStartLocation(CreateCharRequestEventArgs args, bool isYoung)
 {
     if (args.State.Version == null || args.State.Version < ClientVersion.Client70130)
     {
         if (args.Mobile.Race == Race.Gargoyle)
         {
             return(new CityInfo("Royal City", "Royal City", 738, 3486, -19, Map.TerMur, 1150169));
         }
         else
         {
             return(new CityInfo("New Haven", "New Haven Bank", 3503, 2574, 14, Map.Trammel, 1150168));
         }
     }
     else
     {
         return(args.City);
     }
 }
Пример #2
0
        private static void EventSink_CreateCharRequest(CreateCharRequestEventArgs args)
        {
            string name = args.Name.Trim();

            if (!VerifyName(name))
            {
                Console.WriteLine("Login: {0}: Character creation failed, invalid name '{1}'", args.State, args.Name);

                args.State.BlockAllPackets = false;
                args.State.Send(new PopupMessage(PMMessage.InvalidName));
                return;
            }

            if (!VerifyProfession(args.Profession))
            {
                args.Profession = 0;
            }

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

            if (newChar == null)
            {
                Console.WriteLine("Login: {0}: Character creation failed, account full", args.State);
                return;
            }

            args.Mobile = newChar;
            m_Mobile    = newChar;

            newChar.IsPlayer    = true;
            newChar.AccessLevel = ((Account)args.Account).AccessLevel;
            newChar.Female      = args.Female;
            newChar.Race        = args.Race;
            newChar.Hue         = newChar.Race.ClipSkinHue(args.Hue & 0x3FFF) | 0x8000;
            newChar.Hunger      = 20;

            bool young = false;

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

                pm.Profession = args.Profession;

                if (pm.AccessLevel == AccessLevel.Player && ((Account)pm.Account).Young && (pm.Profession != 0) && !(pm.Profession == 6 || pm.Profession == 7))
                {
                    young = pm.Young = true;
                }

                if (pm.Race == Race.Gargoyle)
                {
                    pm.LoyaltyInfo.SetValue(Engines.Loyalty.LoyaltyGroup.GargoyleQueen, 2000);
                }
            }

            newChar.Name = name;

            AddBackpack(newChar);

            SetStats(newChar, 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);
            }

            var acct = args.Account as Account;

            if (acct.GetTag("GivenStarterKit") == null && newChar.Backpack != null)
            {
                var token = new StarterKitToken();
                token.Owner = newChar;
                newChar.Backpack.DropItem(token);

                acct.SetTag("GivenStarterKit", "true");
            }

            CityInfo city = GetStartLocation(args, young);

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

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