Exemple #1
0
        //TODO: Simplify method body
        public override async Task RunImpl()
        {
            if (!await IsValidChar())
            {
                return;
            }

            PcTemplate template = CharTemplateTable.GetTemplate(_classId);

            L2Player player = new L2Player(template, _idFactory.NextId())
            {
                Name          = _name,
                Account       = _client.Account,
                Sex           = (Gender)_sex,
                HairStyleId   = (HairStyleId)_hairStyle,
                HairColor     = (HairColor)_hairColor,
                Face          = (Face)_face,
                CharacterSlot = _client.AccountCharacters.Count
            };

            _characterService.CreatePlayer(player);
            _client.AccountCharacters.Add(player);
            _client.SendPacketAsync(new CharCreateOk());
            _client.SendPacketAsync(new CharList(_client, _client.SessionKey.PlayOkId1));
        }
Exemple #2
0
 public L2Item(ICrudService <ItemContract> itemCrudService, IdFactory idFactory, ItemTemplate template, int objectId) : base(objectId)
 {
     _itemCrudService = itemCrudService;
     _idFactory       = idFactory;
     ObjectId         = objectId != 0 ? objectId : _idFactory.NextId();
     Template         = template;
     Count            = 1;
     Location         = ItemLocation.Void;
 }
Exemple #3
0
 public PeaceZoneBuff(IdFactory idFactory) : base(idFactory)
 {
     ZoneId  = idFactory.NextId();
     Enabled = true;
 }
Exemple #4
0
 public WaterZone(IdFactory idFactory) : base(idFactory)
 {
     ZoneId  = idFactory.NextId();
     Enabled = true;
 }
 public SwampZone(IdFactory idFactory) : base(idFactory)
 {
     ZoneId = idFactory.NextId();
 }
Exemple #6
0
 public DamageZone(IdFactory idFactory) : base(idFactory)
 {
     ZoneId = idFactory.NextId();
 }
Exemple #7
0
 public void GenId()
 {
     ObjectId = _idFactory.NextId();
 }
Exemple #8
0
 public MotherTreeZone(IdFactory idFactory) : base(idFactory)
 {
     ZoneId  = idFactory.NextId();
     Enabled = true;
 }
Exemple #9
0
 public NoRestartZone(IdFactory idFactory) : base(idFactory)
 {
     ZoneId  = idFactory.NextId();
     Enabled = true;
 }
Exemple #10
0
        //TODO: Simplify method body
        public override void RunImpl()
        {
            if (!IsValidChar())
            {
                return;
            }

            PcTemplate template = CharTemplateTable.Instance.GetTemplate(_classId);

            L2Player player = new L2Player(_playerService, _idFactory.NextId(), template);

            player.Inventory   = new PcInventory(_itemService, _idFactory, _itemTable, player);
            player.Name        = _name;
            player.AccountName = _client.AccountName;
            player.Title       = string.Empty;
            player.Sex         = (Gender)_sex;
            player.HairStyleId = (HairStyleId)_hairStyle;
            player.HairColor   = (HairColor)_hairColor;
            player.Face        = (Face)_face;
            player.Exp         = 0;
            player.Level       = 1;
            player.Gameclient  = _client;
            //player.Stats = new CharacterStat(player);
            player.ClassId              = template.ClassId;
            player.BaseClass            = template;
            player.ActiveClass          = template;
            player.CharStatus.CurrentCp = player.MaxCp;
            player.CharStatus.SetCurrentHp(player.MaxHp);
            player.CharStatus.SetCurrentHp(player.MaxMp);
            //player.MaxMp = player.Stats.MaxMp;//;(int)player.CharacterStat.GetStat(EffectType.BMaxMp);
            //player.MaxCp = player.Stats.MaxCp;
            //player.MaxHp = player.Stats.MaxHp;
            player.X        = template.SpawnX;
            player.Y        = template.SpawnY;
            player.Z        = template.SpawnZ;
            player.CharSlot = player.Gameclient.AccountChars.Count;

            if (template.Items != null)
            {
                player.Inventory = new PcInventory(_itemService, _idFactory, _itemTable, player);

                //foreach (PC_item i in template._items)
                //{
                //    if (!i.item.isStackable())
                //    {
                //        for (long s = 0; s < i.count; s++)
                //        {
                //            L2Item item = new L2Item(i.item);
                //            item.Enchant = i.enchant;
                //            if (i.lifetime != -1)
                //                item.AddLimitedHour(i.lifetime);

                //            item.Location = L2Item.L2ItemLocation.inventory;
                //            player.Inventory.addItem(item, false, false);

                //            if (i.equip)
                //            {
                //                int pdollId = player.Inventory.getPaperdollId(item.Template);
                //                player.setPaperdoll(pdollId, item, false);
                //            }
                //        }
                //    }
                //    else
                //        player.addItem(i.item.ItemID, i.count);
                //}
            }

            _playerService.CreatePlayer(player);
            //player = PlayerService.RestorePlayer(player.ObjId, _client);
            player.Gameclient.AccountChars.Add(player);
            _client.SendPacket(new CharCreateOk());
            L2World.Instance.AddPlayer(player);
            _client.SendPacket(new CharacterSelectionInfo(_client.AccountName, _client.AccountChars, _client.SessionKey.PlayOkId1)
            {
                CharId = player.ObjId
            });
        }
Exemple #11
0
 public InstantBuffZone(IdFactory idFactory) : base(idFactory)
 {
     ZoneId = idFactory.NextId();
 }
Exemple #12
0
 public MonsterRaceZone(IdFactory idFactory) : base(idFactory)
 {
     ZoneId  = idFactory.NextId();
     Enabled = true;
 }
Exemple #13
0
        private L2Item MapModelToItem(ItemContract contract)
        {
            L2Item item = new L2Item(ItemService, _idFactory, _itemTable.GetItem(contract.ItemId), _idFactory.NextId())
            {
                ObjId        = contract.ObjectId,
                Count        = contract.Count,
                CustomType1  = contract.CustomType1,
                CustomType2  = contract.CustomType2,
                Enchant      = contract.Enchant,
                SlotLocation = contract.LocationData,
                OwnerId      = contract.OwnerId,
                ExistsInDb   = contract.ExistsInDb
            };

            return(item);
        }
Exemple #14
0
 public PoisonZone(IdFactory idFactory) : base(idFactory)
 {
     ZoneId = idFactory.NextId();
 }