/// <summary>Prepares the base character.</summary> /// <param name="session">The session.</param> /// <returns>Filled out base character.</returns> public static Thing PrepareBaseCharacter(Session session) { var movableBehavior = new MovableBehavior(); var livingBehavior = new LivingBehavior(); var sensesBehavior = new SensesBehavior(); // TODO: Most characters should start as just tutorialPlayer or player role, unless FirstCreatedCharacterIsAdmin // is set and there is no character in the DB yet. See: https://github.com/DavidRieman/WheelMUD/issues/39 var userControlledBehavior = new UserControlledBehavior() { Controller = session, SecurityRoles = SecurityRole.player | SecurityRole.helper | SecurityRole.minorBuilder | SecurityRole.fullBuilder | SecurityRole.minorAdmin | SecurityRole.fullAdmin }; var playerBehavior = new PlayerBehavior() { SessionId = session.ID }; var player = new Thing(livingBehavior, sensesBehavior, userControlledBehavior, playerBehavior, movableBehavior); var game = GameSystemController.Instance; // Load a fresh set of stats and attributes classes for the current gaming system. player.Attributes = game.CloneGameAttributes(); player.Stats = game.CloneGameStats(); return(player); }
/// <summary>Prepares the base character.</summary> /// <param name="session">The session.</param> /// <returns>Filled out base character.</returns> public static Thing PrepareBaseCharacter(Session session) { var movableBehavior = new MovableBehavior(); var livingBehavior = new LivingBehavior(); var sensesBehavior = new SensesBehavior(); var userControlledBehavior = new UserControlledBehavior() { Controller = session, }; var playerBehavior = new PlayerBehavior(sensesBehavior, userControlledBehavior) { SessionId = session.ID, }; var player = new Thing(livingBehavior, sensesBehavior, userControlledBehavior, playerBehavior, movableBehavior); var game = GameSystemController.Instance; // Load the default stats for the current gaming system foreach (var gameStat in game.GameStats) { var currStat = new GameStat(session, gameStat.Name, gameStat.Abbreviation, gameStat.Formula, gameStat.Value, gameStat.MinValue, gameStat.MaxValue, gameStat.Visible); player.Stats.Add(currStat.Abbreviation, currStat); } // Load the secondary stats\attributes for the current gaming system foreach (var attribute in game.GameAttributes) { var newAttribute = new GameAttribute(session, attribute.Name, attribute.Abbreviation, attribute.Formula, attribute.Value, attribute.MinValue, attribute.MaxValue, attribute.Visible); player.Attributes.Add(newAttribute.Abbreviation, newAttribute); } return(player); }
/// <summary>Prepares the base character.</summary> /// <param name="session">The session.</param> /// <returns>Filled out base character.</returns> public static Thing PrepareBaseCharacter(Session session) { var movableBehavior = new MovableBehavior(); var livingBehavior = new LivingBehavior(); var sensesBehavior = new SensesBehavior(); var userControlledBehavior = new UserControlledBehavior() { Controller = session, }; var playerBehavior = new PlayerBehavior(sensesBehavior, userControlledBehavior) { SessionId = session.ID, }; var player = new Thing(livingBehavior, sensesBehavior, userControlledBehavior, playerBehavior, movableBehavior); var game = GameSystemController.Instance; // Load the default stats for the current gaming system foreach (var gameStat in game.GameStats) { var currStat = new GameStat(session, gameStat.Name, gameStat.Abbreviation, gameStat.Formula, gameStat.Value, gameStat.MinValue, gameStat.MaxValue, gameStat.Visible); player.Stats.Add(currStat.Abbreviation, currStat); } // Load the secondary stats\attributes for the current gaming system foreach (var attribute in game.GameAttributes) { var newAttribute = new GameAttribute(session, attribute.Name, attribute.Abbreviation, attribute.Formula, attribute.Value, attribute.MinValue, attribute.MaxValue, attribute.Visible); player.Attributes.Add(newAttribute.Abbreviation, newAttribute); } return player; }