コード例 #1
0
ファイル: World.cs プロジェクト: elavanis/Mud
        public IPlayerCharacter CreateCharacter(string userName, string password)
        {
            IPlayerCharacter pc = new PlayerCharacter();

            pc.Name                = userName;
            pc.Password            = password;
            pc.StrengthStat        = GlobalReference.GlobalValues.Settings.BaseStatValue;
            pc.DexterityStat       = GlobalReference.GlobalValues.Settings.BaseStatValue;
            pc.ConstitutionStat    = GlobalReference.GlobalValues.Settings.BaseStatValue;
            pc.IntelligenceStat    = GlobalReference.GlobalValues.Settings.BaseStatValue;
            pc.WisdomStat          = GlobalReference.GlobalValues.Settings.BaseStatValue;
            pc.CharismaStat        = GlobalReference.GlobalValues.Settings.BaseStatValue;
            pc.LevelPoints         = GlobalReference.GlobalValues.Settings.AssignableStatPoints;
            pc.Level               = 1;
            pc.Health              = pc.MaxHealth;
            pc.Stamina             = pc.MaxStamina;
            pc.Mana                = pc.MaxStamina;
            pc.SentenceDescription = pc.Name;
            pc.ShortDescription    = pc.Name;
            pc.LookDescription     = pc.Name;
            pc.KeyWords.Add(pc.Name);
            pc.GuildPoints = 1;

            AddPlayerQueue.Enqueue(pc);

            return(pc);
        }
コード例 #2
0
ファイル: World.cs プロジェクト: elavanis/Mud
        private void PutPlayersIntoWorld()
        {
            IPlayerCharacter pc = null;

            while (AddPlayerQueue.TryDequeue(out pc))
            {
                if (pc.Room != null)
                {
                    pc.Room.AddMobileObjectToRoom(pc);
                }
                else if (pc.RoomId != null)
                {
                    try
                    {
                        pc.Room = Zones[pc.RoomId.Zone].Rooms[pc.RoomId.Id];
                    }
                    catch
                    {
                        //for some reason the room does not exist.
                        //Put the player in the default start room;
                        pc.Room = Zones[1].Rooms[1];
                    }
                    pc.Room.AddMobileObjectToRoom(pc);
                }
                //first time loading the character
                else
                {
                    IRoom startRoom = Zones[1].Rooms[1];
                    pc.Room = startRoom;
                    startRoom.Enter(pc);
                }

                lock (CharacterLock)
                {
                    Characters.Add(pc);
                }
                pc.EnqueueCommand("Look");


                //if the player just started they should not be mounted
                Dismount(pc);
            }
        }