Пример #1
0
 public CreatureObject(uint pHandle, GameObjectSubType subType) : base(pHandle, GameObjectType.Creature, subType)
 {
     this.Status        = 0;
     this.FaceDirection = 0;
     this.Hp            = 100;
     this.MaxHp         = 100;
     this.Mp            = 0;
     this.MaxMp         = 0;
     this.Level         = 1;
     this.Race          = Races.None;
     this.SkinColor     = 0;
     this.Energy        = 0;
 }
Пример #2
0
        public void AddEntity(long objectId, Guid userGuid, Guid?interactGuid, string name, GameObjectType objectType, GameObjectSubType objectSubType)
        {
            PlayerGameObject gameObject;

            if (_knownEntities.TryRemove(userGuid, out var oldEntity))
            {
                gameObject = new PlayerGameObject(objectId)
                {
                    Name               = name,
                    ObjectType         = objectType,
                    UserGuid           = userGuid,
                    InteractGuid       = interactGuid,
                    ObjectSubType      = objectSubType,
                    CharacterEquipment = oldEntity.CharacterEquipment,
                    CombatStart        = oldEntity.CombatStart,
                    CombatTime         = oldEntity.CombatTime,
                    Damage             = oldEntity.Damage
                }
            }
            ;
            else
            {
                gameObject = new PlayerGameObject(objectId)
                {
                    Name          = name,
                    ObjectType    = objectType,
                    UserGuid      = userGuid,
                    ObjectSubType = objectSubType
                }
            };

            if (_tempCharacterEquipmentData.TryGetValue(objectId, out var characterEquipmentData))
            {
                ResetTempCharacterEquipment();
                gameObject.CharacterEquipment = characterEquipmentData.CharacterEquipment;
                _tempCharacterEquipmentData.TryRemove(objectId, out _);
            }

            _knownEntities.TryAdd(gameObject.UserGuid, gameObject);
            OnAddEntity?.Invoke(gameObject);
        }
Пример #3
0
 public GameObject(uint pHandle, GameObjectType pType, GameObjectSubType subType)
 {
     this.Handle  = pHandle;
     this.Type    = pType;
     this.SubType = subType;
 }