private static void EventSink_CharacterCreated( CharacterCreatedEventArgs args ) { 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; } newChar.Race = Race.Human; 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.RequiredExpasnion ) 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; } SetName( newChar, args.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 ); } AddShirt( newChar, args.ShirtHue ); AddPants( newChar, args.PantsHue ); AddShoes( newChar ); if( newChar.BankBox != null ) { BankBox bankbox = newChar.FindItemOnLayer( Layer.Bank ) as BankBox; bankbox.Delete(); } PlayerBankBox pbb = new PlayerBankBox( newChar ); newChar.AddItem( pbb ); newChar.Blessed = true; CityInfo city = GetStartLocation( args, false ); //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(); }
private static void OnLogin( LoginEventArgs e ) { Mobile from = e.Mobile; Map map = from.Map; from.Map = Map.Trammel; from.Map = map; PlayerMobile m = from as PlayerMobile; m.m_LoginTime = DateTime.Now; m.Criminal = true; if( m.IsVampire && m.BPs < 1 ) m.HueMod = 0; if( !m.OldMapChar ) m.LogPetsIn(); if( m.EmptyBankBoxOn != DateTime.MinValue && DateTime.Compare(DateTime.Now, m.EmptyBankBoxOn) > 0 ) m.EmptyBankBox(); if( m.Age != 0 && m.MaxAge != 0 ) CheckBirthday( m ); if( m.Age == 0 ) m.Age = 18; if( m.Lives < 1 && !m.Alive ) { m.SendMessage( 32, "You are dead." ); m.SendMessage( 60, "Please, contact a GM if you suffered any kind of injustice in regards to your permanent death." ); } m.KnownLanguages.Common = 1500000; if( m.m_RacialResources == null ) { m.m_RacialResources = new RacialResources(); } CheckAtrophies( from ); if ( AccountHandler.LockdownLevel > AccessLevel.Player ) { string notice; Accounting.Account acct = from.Account as Accounting.Account; if ( acct == null || !acct.HasAccess( from.NetState ) ) { if ( from.AccessLevel == AccessLevel.Player ) notice = "The server is currently under lockdown. No players are allowed to log in at this time."; else notice = "The server is currently under lockdown. You do not have sufficient access level to connect."; Timer.DelayCall( TimeSpan.FromSeconds( 1.0 ), new TimerStateCallback( Disconnect ), from ); } else if ( from.AccessLevel >= AccessLevel.Administrator ) { notice = "The server is currently under lockdown. As you are an administrator, you may change this from the .Admin gump."; } else { notice = "The server is currently under lockdown. You have sufficient access level to connect."; } from.SendGump( new NoticeGump( 1060637, 30720, notice, 0xFFC000, 300, 140, null, null ) ); } if( m.BankBox != null && !( m.BankBox is PlayerBankBox ) ) { BankBox bankbox = m.FindItemOnLayer( Layer.Bank ) as BankBox; bankbox.Delete(); PlayerBankBox pbb = new PlayerBankBox( m ); m.AddItem( pbb ); } m.SendGump( new CharInfoGump( m ) ); if( !m.FixedStatPoints ) { int dexcap = 100 + ( m.GetBackgroundLevel(BackgroundList.Quick) * 5 ) - ( m.GetBackgroundLevel(BackgroundList.Clumsy) * 5 ) - m.TotalPenalty; int stamcap = 100 + ( m.GetBackgroundLevel(BackgroundList.Fit) * 5 ) - ( m.GetBackgroundLevel(BackgroundList.Unenergetic) * 5 ) - m.TotalPenalty; switch( m.Nation ) { case Nation.Alyrian: dexcap += 30; stamcap += 20; break; case Nation.Azhuran: dexcap += 50; stamcap += 10; break; case Nation.Khemetar: dexcap += 40; stamcap += 0; break; case Nation.Mhordul: dexcap += 20; stamcap += 30; break; case Nation.Tyrean: dexcap += 0; stamcap += 40; break; case Nation.Vhalurian: dexcap += 10; stamcap += 50; break; } int dexoffset = m.RawDex - dexcap; int stamoffset = m.RawStam - stamcap; if( dexoffset > 0 ) { m.RawDex -= m.RawDex - dexcap; m.StatPoints += dexoffset; } if( stamoffset > 0 ) { m.RawStam -= m.RawStam - stamcap; m.StatPoints += stamoffset; } m.FixedStatPoints = true; } if( !m.FixedRun ) { m.ArmourPieces = 0; m.LightPieces = 0; m.HeavyPieces = 0; m.MediumPieces = 0; m.LightPenalty = 0; m.MediumPenalty = 0; m.HeavyPenalty = 0; CheckPenalty( m, Layer.Arms ); CheckPenalty( m, Layer.Gloves ); CheckPenalty( m, Layer.Helm ); CheckPenalty( m, Layer.InnerLegs ); CheckPenalty( m, Layer.InnerTorso ); CheckPenalty( m, Layer.MiddleTorso ); CheckPenalty( m, Layer.Neck ); CheckPenalty( m, Layer.OuterLegs ); CheckPenalty( m, Layer.OuterTorso ); CheckPenalty( m, Layer.Pants ); CheckPenalty( m, Layer.Shirt ); CheckPenalty( m, Layer.Shoes ); CheckPenalty( m, Layer.TwoHanded ); m.FixedRun = true; } if( m.OldMapChar && !m.Reforging && !m.Forging ) m.Reforge(); else if( !m.Reforging && !m.Forging && m.AccessLevel < AccessLevel.GameMaster && m.BuggedCP ) { m.SendMessage( "The amount of CP you had spent was above your cap due to a bug that allowed it. Please reforge." ); m.Reforge(); } m.SendStatusIcons(); m.LogoutTime = DateTime.MinValue; foreach( NetState state in NetState.Instances ) { PlayerMobile staffer = state.Mobile as PlayerMobile; if( state.Mobile != null && state.Mobile is PlayerMobile && staffer.AccessLevel > AccessLevel.Player && staffer.LogMsgs ) staffer.SendMessage( m.Account.Username + " has logged in on " + m.Name + "." ); if( m.AccessLevel > AccessLevel.Player && state.Mobile is PlayerMobile && staffer.NeedsFixing ) { staffer.Map = Map.Felucca; staffer.NetState.Dispose(); } } m.FixControlSlots(); m.HandleGhoulStatOffsets(); }