Пример #1
0
        private void InitializeTest()
        {
            World world = new World();

            world.IpAddress = "127.0.0.1";
            world.IsPreview = true;
            world.Port      = 7172;
            world.Id        = 0;
            world.Name      = "Draconia";

            Character character = new Character();

            character.Id     = 1;
            character.Name   = "Chuitox";
            character.Status = SessionStatus.Online;
            character.Settings.CanBroadcast      = true;
            character.Settings.CanChangeSex      = true;
            character.Settings.CanSeeDiagnostics = true;
            character.Settings.CanSeeGhosts      = true;
            character.Settings.CanTeleport       = true;

            _characterSpawn           = new CharacterSpawn();
            _characterSpawn.AccountId = 1;
            _characterSpawn.Amulet    = null;
            _characterSpawn.AmuletId  = null;
            _characterSpawn.AxeSkill  = new Skill
            {
                Base                = 10,
                Current             = 100,
                Experience          = 1000,
                NextLevelExperience = 1100
            };
            _characterSpawn.Balance      = 1000000;
            _characterSpawn.BattleStance = BattleStance.Defense;
            _characterSpawn.Belt         = null;
            _characterSpawn.BeltId       = null;
            _characterSpawn.Blessings    = 7;
            _characterSpawn.Capacity     = 300;
            _characterSpawn.Character    = character;
            _characterSpawn.CharacterId  = 1;
            _characterSpawn.ClubSkill    = new Skill
            {
                Base                = 10,
                Current             = 100,
                Experience          = 1000,
                NextLevelExperience = 1100
            };
            _characterSpawn.Conditions    = Conditions.Bleeding | Conditions.Burning | Conditions.Cursed | Conditions.Dazzled | Conditions.Drowning | Conditions.Strengthened;
            _characterSpawn.Container     = null;
            _characterSpawn.ContainerId   = null;
            _characterSpawn.CreationTime  = DateTime.UtcNow;
            _characterSpawn.Creature      = character;
            _characterSpawn.DeletionTime  = null;
            _characterSpawn.Direction     = Direction.East;
            _characterSpawn.DistanceSkill = new Skill
            {
                Base                = 10,
                Current             = 100,
                Experience          = 1000,
                NextLevelExperience = 1100
            };
            _characterSpawn.DrunkCondition   = null;
            _characterSpawn.ExhaustCondition = null;
            _characterSpawn.Feet             = null;
            _characterSpawn.FeetId           = null;
            _characterSpawn.FishingSkill     = new Skill
            {
                Base                = 10,
                Current             = 100,
                Experience          = 1000,
                NextLevelExperience = 1100
            };
            _characterSpawn.FistSkill = new Skill
            {
                Base                = 10,
                Current             = 100,
                Experience          = 1000,
                NextLevelExperience = 1100
            };
            _characterSpawn.FollowOpponent = true;
            _characterSpawn.FreeCapacity   = 250;
            _characterSpawn.Guild          = null;
            _characterSpawn.GuildLevel     = 0;
            _characterSpawn.Head           = null;
            _characterSpawn.HeadId         = null;
            _characterSpawn.Health.Current = 100;
            _characterSpawn.Health.Maximum = 1000;
            _characterSpawn.Id             = 0;
            //characterSpawn.IsDead = false;
            //characterSpawn.IsDrunk = false;
            //characterSpawn.IsExhausted = false;
            // TODO: This must be handled differently
            _characterSpawn.IsMountToggleExhausted = false;
            //characterSpawn.IsPoisoned = false;
            _characterSpawn.LastLogin.IpAddress = "127.0.0.1";
            _characterSpawn.LastLogin.Time      = DateTime.UtcNow;
            _characterSpawn.LastLogout          = null;
            _characterSpawn.LastPing            = DateTime.MinValue;
            _characterSpawn.Legs                           = null;
            _characterSpawn.LegsId                         = null;
            _characterSpawn.Level.Current                  = 9;
            _characterSpawn.Level.Experience               = 1000;
            _characterSpawn.Level.NextLevelExperience      = 1100;
            _characterSpawn.LightInfo.Level                = LightLevel.Torch;
            _characterSpawn.LightInfo.Color                = LightColor.Default;
            _characterSpawn.MagicLevel.Base                = 100;
            _characterSpawn.MagicLevel.Bonus               = 10;
            _characterSpawn.MagicLevel.Experience          = 1000;
            _characterSpawn.MagicLevel.NextLevelExperience = 1100;
            _characterSpawn.Mana.Current                   = 100;
            _characterSpawn.Mana.Maximum                   = 1000;
            _characterSpawn.Mana.Spent                     = 100;
            _characterSpawn.Mount                          = _mountService.GetMountBySpriteId(373);

            // TODO: This should be initialized by the constructor
            _characterSpawn.IsRiding = true;
            _characterSpawn.Mounts.AddRange(_mountService.GetAll());
            _characterSpawn.OfflineTraining.Elapsed = TimeSpan.Zero;
            _characterSpawn.OfflineTraining.Skill   = new Skill
            {
                Base                = 10,
                Current             = 100,
                Experience          = 1000,
                NextLevelExperience = 1100
            };
            _characterSpawn.OnlineTime = TimeSpan.Zero;

            // TODO: Containers open
            //characterSpawn.OpenContainers = null;
            _characterSpawn.Outfit = _outfitService.GetOutfitBySpriteId(147);

            // TODO: This should be initialized by the constructor
            _characterSpawn.Outfits.AddRange(_outfitService.GetAll());
            _characterSpawn.PartyId = null;

            // TODO: This should be initialized by the constructor
            _characterSpawn.PartyInvitations = new IParty[0];
            _characterSpawn.PoisonCondition  = null;

            // TODO: This should be initialized by the constructor
            _characterSpawn.Quests = new IQuestInfo[0];

            // TODO: This should be initialized by the constructor
            _characterSpawn.RegenerationConditions = new RegenerationCondition[0];
            _characterSpawn.Ring        = null;
            _characterSpawn.RingId      = null;
            _characterSpawn.Sex         = Sex.Female;
            _characterSpawn.Shield      = null;
            _characterSpawn.ShieldId    = null;
            _characterSpawn.ShieldSkill = new Skill
            {
                Base                = 10,
                Current             = 100,
                Experience          = 1000,
                NextLevelExperience = 1100
            };
            _characterSpawn.Skull.Type       = SkullType.None;
            _characterSpawn.Skull.Time       = TimeSpan.Zero;
            _characterSpawn.Soul             = 200;
            _characterSpawn.Speed.BaseSpeed  = 100;
            _characterSpawn.Speed.BonusSpeed = 100;
            _characterSpawn.Stamina          = 400;
            _characterSpawn.SwordSkill       = new Skill
            {
                Base                = 10,
                Current             = 100,
                Experience          = 1000,
                NextLevelExperience = 1100
            };

            ITile tile = _tileService.GetTileByPosition(new Vector3(168, 493, 7));

            //Tile tile = new Tile();
            //tile.Flags = TileFlags.None;
            //tile.Position = new Vector3(168, 492, 7);
            //tile.Items.Add(new ItemSpawn
            //{
            //    Item = _itemService.GetItemById(406),
            //    ItemId = 406,
            //    LightInfo = new LightInfo
            //    {
            //        Color = LightColor.Default,
            //        Level = LightLevel.Torch
            //    },
            //    StackPosition = 0,
            //    Tile = tile
            //});

            // TODO: This has to be a valid tile of the map
            _characterSpawn.Tile          = tile;
            _characterSpawn.StackPosition = 1;
            _characterSpawn.Torso         = null;
            _characterSpawn.TorsoId       = null;
            _characterSpawn.TownId        = 1;
            _characterSpawn.Town          = _townService.GetTownById(_characterSpawn.TownId);
            _characterSpawn.UseSecureMode = true;
            _characterSpawn.VocationId    = 0;
            _characterSpawn.Vocation      = _vocationService.GetVocationById(_characterSpawn.VocationId);
            _characterSpawn.WarIcon       = WarIcon.None;
            _characterSpawn.Weapon        = null;
            _characterSpawn.WeaponId      = null;
            _characterSpawn.WorldId       = 0;

            Friend friend = new Friend();

            friend.Character     = _characterSpawn.Character;
            friend.CharacterId   = _characterSpawn.Character.Id;
            friend.Id            = 1;
            friend.Description   = "Test";
            friend.NotifyOnLogin = true;

            Account account = new Account();

            account.ClientVersion         = 100;
            account.Notification          = null;
            account.OSPlatform            = OSPlatform.Windows;
            account.Password              = "******";
            account.PremiumExpirationDate = DateTime.UtcNow.AddYears(1);
            account.UserName              = "******";

            account.Friends.Add(friend);
            friend.Account   = account;
            friend.AccountId = account.Id;

            account.CharacterSpawns.Add(_characterSpawn);
            _characterSpawn.Account = account;
        }