コード例 #1
0
        public void Update()
        {
            if (_recentItemDroppper != null && _dropItemKey != null && Input.GetKeyDown(_dropItemKey.Value))
            {
                _recentItemDroppper.DropRecentItem();
            }

            if (RaincoatConfig.EnableStarterPack.Value && NetworkServer.active && _starterPackKey != null && Input.GetKeyDown(_starterPackKey.Value))
            {
                StarterPack.GrantStarterItemsToAll();
            }
        }
コード例 #2
0
        private static void EventSink_CharacterCreated(CharacterCreatedEventArgs args)
        {
            if (!VerifyProfession(args.Profession))
            {
                args.Profession = 0;
            }

            NetState state = args.State;
            Account  acct  = args.Account as Account;

            Mobile newChar = CreateMobile(acct);

            if (newChar == null)
            {
                Console.WriteLine("Login: {0}: Character creation failed, account full", args.State);
                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;
            newChar.Thirst = 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)
                {
                    young = pm.Young = true;
                }
            }

            /*NameResultMessage result =*/ 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);
            }

            BankBox bank = newChar.BankBox;

            bool needstartpack = acct != null && String.IsNullOrEmpty(acct.GetTag("startpack"));

            if (needstartpack /*|| TestCenter.Enabled*/)
            {
                Container startpack = new StarterPack();
                bank.DropItem(startpack);

/*
 *                              if ( needstartpack )
 *                              {
 *                                      Item housedeed = new SmallBrickHouseDeed();
 *                                      housedeed.Name = "a beta tester's small brick house deed";
 *                                      startpack.DropItem( housedeed );
 *                                      housedeed.X = 23;
 *                                      housedeed.Y = 53;
 *
 *                                      Item startercheck = new BankCheck( 10000 );
 *                                      startpack.DropItem( startercheck );
 *                                      startercheck.X = 52;
 *                                      startercheck.Y = 36;
 *                              }
 */
                acct.SetTag("startpack", "true");
            }

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

            CityInfo city = GetStartLocation(args, young);

            //CityInfo city = new CityInfo( "Britain", "Sweet Dreams Inn", 1496, 1628, 10, Map.Felucca );

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

            Console.WriteLine("Login: {0}: New character being created (account={1})", args.State, 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());

            new WelcomeTimer(newChar).Start();

            //if ( result != NameResultMessage.Allowed )
            //	newChar.SendGump( new NameChangeGump( newChar, result, args.Name ) );
        }