Exemplo n.º 1
0
 public FakeNameProfile()
 {
     CreateMap <FakeName, ContactModel>()
     .ForMember(d => d.Id, opt => opt.MapFrom(s => 0))
     .ForMember(d => d.Address,
                opt => opt.MapFrom(s => new Address
     {
         AddressInfo = s.Address,
         Latitude    = s.Latitude,
         Longitude   = s.Longitude
     }))
     .ForMember(d => d.Pets, opt => opt.Ignore())
     .ForMember(d => d.Pets,
                opt => opt.MapFrom(s => s.Company
                                   .Split(new[] { " ", "-" }, StringSplitOptions.RemoveEmptyEntries)
                                   .Where(name => name.Length >= 4)
                                   .Select(name => new Pet
     {
         Name = name,
         Type = PetTypes.GetRandom()
     }).ToList()))
     .ForMember(d => d.Gender, opt => opt.MapFrom(s =>
                                                  s.Pict.EndsWith("female", StringComparison.InvariantCultureIgnoreCase)
                 ? Gender.Female
                 : Gender.Male))
     .ForMember(d => d.Height, opt => opt.MapFrom(s => (int)s.Height));
 }
Exemplo n.º 2
0
        public PetTypes GetPetTypes(string petTypeName)
        {
            int    petTypeId = 0;
            string type      = string.Empty;

            switch (petTypeName)
            {
            case "Cat":
                petTypeId = 1;
                break;

            case "Dog":
                petTypeId = 2;
                break;

            case "Reptile":
                petTypeId = 3;
                break;

            default:
                break;
            }

            PetTypes petType = new PetTypes
            {
                PetTypeId = petTypeId,
                Type      = petTypeName
            };

            return(petType);
        }
Exemplo n.º 3
0
        private Pet createAPetObject()
        {
            Console.Write("Please type the pets name: ");
            string name = validateString();

            Console.Write("Please insert the pets type: ");
            PetTypes type = getPetType();

            Console.Write("Please type the pets birth date: ");
            DateTime birthDate = validateTime();

            Console.Write("Please type the pets sold date: ");
            DateTime soldDate = validateTime();

            Console.Write("Please type the pets color/colors: ");
            string color = validateString();

            Console.Write("Please insert the pets price: ");
            double price = parseThatDouble();

            Pet pet = new Pet
            {
                name      = name,
                type      = type,
                birthDate = birthDate,
                soldDate  = soldDate,
                color     = color,
                price     = price
            };

            return(pet);
        }
Exemplo n.º 4
0
 public UnitPetEntry(int snoID, PetTypes type, string internalname = "", PluginActorType actortype = PluginActorType.Monster)
     : base(snoID)
 {
     InternalName = internalname;
     _objectType  = type;
     _actorType   = actortype;
 }
Exemplo n.º 5
0
        public List <Pet> GetPetByType(PetTypes Type)
        {
            using var db = new PersonDbContext();

            List <Pet> petsByType = db.Pets.Where(type => type.PetType == Type).ToList();

            return(petsByType);
        }
Exemplo n.º 6
0
 public CacheUnitPetEntry(int snoID, PetTypes type, string internalname = "", int interactRange = -1, int collisionRadius = -1)
     : base(snoID)
 {
     InternalName    = internalname;
     _objectType     = type;
     InteractRange   = interactRange;
     CollisionRadius = collisionRadius;
 }
 public ActionResult <PetTypes> Put(int TypeId, [FromBody] PetTypes petTypes)
 {
     if (TypeId < 1 || TypeId != petTypes.TypeId)
     {
         return(StatusCode(404, "Can not find Type"));
     }
     petTypes.TypeId = TypeId;
     return(Ok(_petTypeService.UpdateType(petTypes)));
 }
Exemplo n.º 8
0
 public UnitPetEntry(int snoID, PetTypes type, string internalname = "", PluginActorType actortype = PluginActorType.Monster, int interactRange = -1, int collisionRadius = -1)
     : base(snoID)
 {
     InternalName    = internalname;
     _objectType     = type;
     _actorType      = actortype;
     InteractRange   = interactRange;
     CollisionRadius = collisionRadius;
 }
Exemplo n.º 9
0
        /// <summary>
        /// Updates a type
        /// </summary>
        /// <param name="PetTypeUpdate"></param>
        /// <returns></returns>
        public PetTypes UpdateType(PetTypes PetTypeUpdate)
        {
            var petTyper = FindTypeById(PetTypeUpdate.TypeId);

            petTyper.PetType = PetTypeUpdate.PetType;
            petTyper.Race    = PetTypeUpdate.Race;

            return(petTyper);
        }
Exemplo n.º 10
0
        public PetTypes Create(PetTypes petTypes)
        {
            {
                var petstypes = _ctx.PetTypeTable.Add(petTypes).Entity;
                _ctx.SaveChanges();

                return(petTypes);
            }
        }
Exemplo n.º 11
0
        public ActionResult <PetTypes> Post([FromBody] PetTypes petTypes)
        {
            if (string.IsNullOrEmpty(petTypes.PetType))
            {
                return(StatusCode(500, "Can not Create Type, try again"));
            }

            return(_petTypeService.CreateType(petTypes));
        }
Exemplo n.º 12
0
 public Pet(int id, string name, PetTypes type, DateTime birthdate, DateTime soldDate, string color, string previousOwner, double price)
 {
     this.Id            = id;
     this.Name          = name;
     this.Type          = type;
     this.Birthdate     = birthdate;
     this.SoldDate      = soldDate;
     this.Color         = color;
     this.PreviousOwner = previousOwner;
     this.Price         = price;
 }
Exemplo n.º 13
0
        public List <Pet> GetPetsByType(PetTypes type)
        {
            List <Pet> petsByType = new List <Pet>();
            List <Pet> pets       = _petRepo.ReadPets(null).ToList();

            foreach (Pet pet in pets)
            {
                if (type == pet.type)
                {
                    petsByType.Add(pet);
                }
            }
            return(petsByType);
        }
Exemplo n.º 14
0
        public List <Pet> GetPetsByType(PetTypes type)
        {
            List <Pet> SortByType = new List <Pet>();
            List <Pet> pets       = _PetRepository.ReadPets().ToList();

            foreach (Pet pet in pets)
            {
                if (type == pet.Type)
                {
                    SortByType.Add(pet);
                }
            }
            return(SortByType);
        }
Exemplo n.º 15
0
        /// <summary>
        /// Updates the pettypes
        /// </summary>
        /// <param name="typeUpdate"></param>
        /// <returns></returns>
        public PetTypes UpdateTypes(PetTypes typeUpdate)
        {
            PetTypes typeFromDB = ReadById(typeUpdate.TypeId);

            if (typeFromDB != null)
            {
                typeFromDB.PetType = typeUpdate.PetType;
                typeFromDB.Race    = typeUpdate.Race;


                return(typeFromDB);
            }
            return(null);
        }
Exemplo n.º 16
0
        public Pet NewPet(int id, string petName, PetTypes type, DateTime birthdate, DateTime soldDate, string color, string previousOwner, double petPrice)
        {
            var nPet = new Pet(id, petName, type, birthdate, soldDate, color, previousOwner, petPrice)
            {
                Id            = id,
                Name          = petName,
                Type          = type,
                Birthdate     = birthdate,
                SoldDate      = soldDate,
                Color         = color,
                PreviousOwner = previousOwner,
                Price         = petPrice
            };

            return(nPet);
        }
Exemplo n.º 17
0
        private void PrintPetsByType()
        {
            printAllPetTypes();
            Console.Write("Please enter the type of pets you want to be shown: ");
            PetTypes   type       = getPetType();
            List <Pet> petsByType = _petserv.GetPetsByType(type);

            if (petsByType.Count == 0)
            {
                Console.WriteLine("There are no pets by that type to be shown");
            }
            else
            {
                PrintPets(petsByType);
            }
        }
Exemplo n.º 18
0
        private void PrintPetsType()
        {
            Console.Clear();
            printAllTypes();
            Console.Write("Please enter a type: ");
            PetTypes   type       = getPetType();
            List <Pet> petsByType = _PetService.GetPetsByType(type);

            if (petsByType.Count == 0)
            {
                Console.WriteLine("No pets with that type could be found");
            }
            else
            {
                PrintPets(petsByType);
            }
        }
Exemplo n.º 19
0
        private Pet CreatePetObject()
        {
            Console.Write("Enter the pet's name: ");
            string name = Console.ReadLine();

            Console.Write("Enter the pet's type: ");
            PetTypes type = getPetType();

            Console.Write("Enter the pet's birth date: ");
            DateTime birthDate = validateTime();

            Console.Write("Enter the pet's sales date: ");
            DateTime soldDate = validateTime();

            Console.Write("Enter the pet's color/colors: ");
            string color = Console.ReadLine();

            Console.Write("Enter the pet's previous owner or \"none\": ");
            string previousOwner = Console.ReadLine();

            Console.Write("Enter the pet's price: ");
            double price = parseDouble();

            Pet pet = new Pet
            {
                Name          = name,
                Type          = type,
                Birthdate     = birthDate,
                SoldDate      = soldDate,
                Color         = color,
                PreviousOwner = previousOwner,
                Price         = price
            };

            return(pet);
        }
Exemplo n.º 20
0
        //

        ///<summary>
        ///Adds/Updates CacheObjects inside collection by Iteration of RactorList
        ///This is the method that caches all live data about an object!
        ///</summary>
        internal static bool UpdateCacheObjectCollection()
        {
            //Update Character (just incase it wasnt called before..)
            FunkyGame.Hero.Update(false, true);

            Obstacles.AttemptToClearEntries();

            HashSet <int> hashDoneThisRactor = new HashSet <int>();

            using (ZetaDia.Memory.AcquireFrame(true))
            {
                if (!ZetaDia.IsInGame || ZetaDia.IsLoadingWorld || !ZetaDia.Me.IsValid)
                {
                    return(false);
                }

                foreach (Actor thisActor in ZetaDia.Actors.RActorList)
                {
                    int       tmp_raGUID;
                    DiaObject thisObj;

                    if (!thisActor.IsValid)
                    {
                        continue;
                    }
                    //Convert to DiaObject
                    thisObj    = (DiaObject)thisActor;
                    tmp_raGUID = thisObj.RActorGuid;

                    // See if we've already checked this ractor, this loop
                    if (hashDoneThisRactor.Contains(tmp_raGUID))
                    {
                        continue;
                    }
                    hashDoneThisRactor.Add(tmp_raGUID);

                    //Update RactorGUID and check blacklisting..
                    if (BlacklistCache.IsRAGUIDBlacklisted(tmp_raGUID))
                    {
                        continue;
                    }
                    CacheObject tmp_CachedObj;

                    if (!Objects.TryGetValue(tmp_raGUID, out tmp_CachedObj))
                    {
                        ActorType Actortype;
                        Vector3   tmp_position;
                        int       tmp_acdguid;
                        int       tmp_SNOID;



                        #region SNO
                        //Lookup SNO
                        try
                        {
                            tmp_SNOID = thisObj.ActorSNO;
                        }
                        catch (Exception ex)
                        {
                            Logger.Write(LogLevel.Cache, "Safely handled getting SNO for {0}", tmp_raGUID);
                            //Logger.DBLog.InfoFormat("Failure to get SNO from object! RaGUID: {0}", tmp_raGUID);
                            continue;
                        }
                        #endregion

                        //check our SNO blacklist (exclude pets?)
                        if (BlacklistCache.IsSNOIDBlacklisted(tmp_SNOID))
                        {
                            continue;
                        }


                        #region Position
                        try
                        {
                            tmp_position = thisObj.Position;
                        }
                        catch (Exception ex)
                        {
                            Logger.Write(LogLevel.Cache, "Safely handled getting Position for {0}", tmp_SNOID);
                            continue;
                        }

                        #endregion

                        #region AcdGUID
                        try
                        {
                            tmp_acdguid = thisObj.ACDGuid;
                        }
                        catch (Exception ex)
                        {
                            Logger.Write(LogLevel.Cache, "Safely handled getting ACDGuid for {0}", tmp_SNOID);
                            continue;
                        }

                        #endregion


                        tmp_CachedObj = new CacheObject(tmp_SNOID, tmp_raGUID, tmp_acdguid, tmp_position);
                    }
                    else
                    {
                        //Reset unseen var
                        tmp_CachedObj.LoopsUnseen = 0;
                    }


                    ////Validate (ignore special object SNO Ids)
                    //if (!CacheIDLookup.hashSNOSkipCommonDataCheck.Contains(tmp_CachedObj.SNOID))
                    //{
                    //    try
                    //    {
                    //        if (thisObj.CommonData == null)
                    //        {
                    //            Logger.Write(LogLevel.Cache, "CommonData is no longer valid! {0}", tmp_CachedObj.DebugStringSimple);
                    //            //BlacklistCache.AddObjectToBlacklist(tmp_CachedObj.RAGUID, BlacklistType.Temporary);
                    //            continue;
                    //        }
                    //        if (thisObj.CommonData.ACDGuid != thisObj.ACDGuid)
                    //        {
                    //            Logger.Write(LogLevel.Cache, "ACDGuid Mismatched! {0}", tmp_CachedObj.DebugStringSimple);
                    //            //BlacklistCache.AddObjectToBlacklist(tmp_CachedObj.RAGUID, BlacklistType.Temporary);
                    //            continue;
                    //        }
                    //    }
                    //    catch (Exception ex)
                    //    {
                    //        //Logger.Write(LogLevel.Cache, "Object is no longer valid! (Exception) SNOID {0}", tmp_CachedObj.DebugStringSimple);
                    //        //BlacklistCache.AddObjectToBlacklist(tmp_CachedObj.RAGUID, BlacklistType.Temporary);
                    //        continue;
                    //    }
                    //}

                    //Update any SNO Data.
                    #region SNO_Cache_Update
                    if (tmp_CachedObj.ref_DiaObject == null || tmp_CachedObj.ContainsNullValues())
                    {
                        if (!tmp_CachedObj.UpdateData(thisObj, tmp_CachedObj.RAGUID))
                        {
                            continue;
                        }
                    }
                    else if (!tmp_CachedObj.IsFinalized)
                    {                    //Finalize this data by recreating it and updating the Sno cache with a new finalized entry, this also clears our all Sno cache dictionaries since we no longer need them!
                        cacheSnoCollection.FinalizeEntry(tmp_CachedObj.SNOID);
                    }
                    #endregion

                    //Check if this object is a summoned unit by a player...
                    #region SummonedUnits
                    if (tmp_CachedObj.IsSummonedPet && CacheIDLookup.hashSNOSkipCommonDataCheck.Contains(tmp_CachedObj.SNOID))
                    {
                        PetTypes PetType = (PetTypes)TheCache.ObjectIDCache.UnitPetEntries[tmp_CachedObj.SNOID].ObjectType;
                        if (PetType == PetTypes.WIZARD_ArcaneOrbs)
                        {
                            FunkyGame.Targeting.Cache.Environment.HeroPets.WizardArcaneOrbs++;
                            tmp_CachedObj.NeedsRemoved = true;
                            continue;
                        }
                    }
                    #endregion

                    //Special Cache for Interactable Server Objects
                    if (CheckFlag(tmp_CachedObj.targetType.Value, TargetType.ServerInteractable))
                    {
                        if (!InteractableObjectCache.ContainsKey(tmp_CachedObj.RAGUID))
                        {
                            InteractableObjectCache.Add(tmp_CachedObj.RAGUID, tmp_CachedObj);

                            //Adventure Mode -- Rifting we add Exit to LOS movement!
                            //if (FunkyGame.AdventureMode && FunkyGame.Bounty.IsInRiftWorld && FunkyBaseExtension.Settings.AdventureMode.EnableAdventuringMode)
                            //{
                            //	if (tmp_CachedObj.InternalName.Contains("Exit"))
                            //	{
                            //		int index = FunkyGame.Bounty.CurrentBountyMapMarkers.Count;
                            //		FunkyGame.Bounty.CurrentBountyMapMarkers.Add(index, new BountyCache.BountyMapMarker(tmp_CachedObj.Position, FunkyGame.Hero.CurrentWorldDynamicID, index));
                            //	}
                            //}
                        }

                        //Whymsdal Portal!
                        if (tmp_CachedObj.SNOID == 405590)
                        {
                            GoblinBehavior.Portal = tmp_CachedObj;
                        }
                        else if (tmp_CachedObj.SNOID == 393030)
                        {
                            GoblinBehavior.Portal = tmp_CachedObj;
                        }

                        //Do not add to main cache!
                        continue;
                    }

                    //Objects with static positions already cached don't need to be updated here.
                    if (!tmp_CachedObj.NeedsUpdate)
                    {
                        continue;
                    }

                    //Obstacles -- (Not an actual object we add to targeting.)
                    if (CheckFlag(tmp_CachedObj.targetType.Value, TargetType.Avoidance) || tmp_CachedObj.IsObstacle || tmp_CachedObj.HandleAsAvoidanceObject)
                    {
                        #region Obstacles

                        CacheObstacle thisObstacle;
                        //Do we have this cached?
                        if (!Obstacles.TryGetValue(tmp_CachedObj.RAGUID, out thisObstacle))
                        {
                            AvoidanceType AvoidanceType = AvoidanceType.None;
                            if (tmp_CachedObj.IsAvoidance)
                            {
                                AvoidanceType = AvoidanceCache.FindAvoidanceUsingSNOID(tmp_CachedObj.SNOID);
                                if (AvoidanceType == AvoidanceType.None)
                                {
                                    AvoidanceType = AvoidanceCache.FindAvoidanceUsingName(tmp_CachedObj.InternalName);
                                    if (AvoidanceType == AvoidanceType.None)
                                    {
                                        continue;
                                    }
                                }
                            }

                            if (tmp_CachedObj.IsAvoidance && tmp_CachedObj.IsProjectileAvoidance)
                            {                            //Ranged Projectiles require more than simple bounding points.. so we create it as avoidance zone to cache it with properties.
                                //Check for intersection..
                                try
                                {
                                    ActorMovement thisMovement = thisObj.Movement;
                                    Vector2       Direction    = thisMovement.DirectionVector;
                                    Ray           R            = new Ray(tmp_CachedObj.Position, Direction.ToVector3());
                                    double        Speed;
                                    //Lookup Cached Speed, or add new entry.
                                    if (!dictProjectileSpeed.TryGetValue(tmp_CachedObj.SNOID, out Speed))
                                    {
                                        Speed = thisMovement.DesiredSpeed;
                                        dictProjectileSpeed.Add(tmp_CachedObj.SNOID, Speed);
                                    }

                                    thisObstacle = new CacheAvoidance(tmp_CachedObj, AvoidanceType, R, Speed);
                                    Obstacles.Add(thisObstacle);
                                }
                                catch
                                {
                                    Logger.Write(LogLevel.Cache, "Failed to create projectile avoidance with rotation and speed. {0}", tmp_CachedObj.InternalName);
                                }
                            }
                            else if (tmp_CachedObj.IsAvoidance)
                            {
                                //Poison Gas Can Be Friendly...
                                if (AvoidanceType == AvoidanceType.PoisonGas)
                                {
                                    int TeamID = 0;
                                    try
                                    {
                                        TeamID = thisObj.CommonData.GetAttribute <int>(ActorAttributeType.TeamID);
                                    }
                                    catch
                                    {
                                        Logger.Write(LogLevel.Cache, "Failed to retrieve TeamID attribute for object {0}", tmp_CachedObj.InternalName);
                                    }

                                    //ID of 1 means its non-hostile! (-1?) 2??
                                    //if (TeamID==1||TeamID==-1)
                                    if (TeamID != 10)
                                    {
                                        //Logger.Write(LogLevel.None, "Ignoring Avoidance {0} due to Friendly TeamID match!", tmp_CachedObj.InternalName);
                                        BlacklistCache.AddObjectToBlacklist(tmp_CachedObj.RAGUID, BlacklistType.Permanent);
                                        continue;
                                    }
                                }


                                thisObstacle = new CacheAvoidance(tmp_CachedObj, AvoidanceType);
                                Obstacles.Add(thisObstacle);
                            }
                            else
                            {
                                //Obstacles.
                                thisObstacle = new CacheServerObject(tmp_CachedObj);
                                Obstacles.Add(thisObstacle);
                            }
                        }

                        continue;
                        #endregion
                    }

                    if (tmp_CachedObj.ObjectShouldBeRecreated)
                    {                    //This is where we create the real object after its done with SNO Update.
                        //Specific updates
                        if (tmp_CachedObj.Actortype.Value == ActorType.Item)
                        {
                            tmp_CachedObj = new CacheItem(tmp_CachedObj);
                        }
                        else if (tmp_CachedObj.Actortype.Value == ActorType.Monster)
                        {
                            if (!tmp_CachedObj.IsSummonedPet)
                            {
                                tmp_CachedObj = new CacheUnit(tmp_CachedObj);
                            }
                            else
                            {
                                PetTypes PetType = (PetTypes)TheCache.ObjectIDCache.UnitPetEntries[tmp_CachedObj.SNOID].ObjectType;

                                #region Summoner ID Check

                                // Get the summoned-by info, cached if possible
                                if (!tmp_CachedObj.SummonerID.HasValue)
                                {
                                    try
                                    {
                                        tmp_CachedObj.SummonerID = thisObj.CommonData.GetAttribute <int>(ActorAttributeType.SummonedByACDID);
                                    }
                                    catch (Exception ex)
                                    {
                                        //Logger.DBLog.InfoFormat("[Funky] Safely handled exception getting summoned-by info [" + tmp_CachedObj.SNOID.ToString(CultureInfo.InvariantCulture) + "]");
                                        //Logger.DBLog.DebugFormat(ex.ToString());
                                        continue;
                                    }
                                }

                                if (FunkyGame.Hero.iMyDynamicID != tmp_CachedObj.SummonerID.Value)
                                {
                                    BlacklistCache.IgnoreThisObject(tmp_CachedObj, false, false);
                                    tmp_CachedObj.NeedsRemoved = true;
                                    continue;
                                }

                                #endregion

                                tmp_CachedObj = new CachePet(tmp_CachedObj, PetType);
                            }
                        }
                        else if (tmp_CachedObj.Actortype.Value == ActorType.Gizmo)
                        {
                            if (CheckFlag(tmp_CachedObj.targetType.Value, TargetType.Interactables))
                            {
                                tmp_CachedObj = new CacheInteractable(tmp_CachedObj);
                            }
                            else
                            {
                                tmp_CachedObj = new CacheDestructable(tmp_CachedObj);
                            }
                        }


                        //Update Properties (currently only for units)

                        try
                        {
                            tmp_CachedObj.UpdateProperties();
                        }
                        catch
                        {
                            Logger.Write(LogLevel.Cache, "Failed to update properties for {0}", tmp_CachedObj.DebugStringSimple);
                        }
                    }

                    if (!tmp_CachedObj.UpdateData())
                    {
                        //Logger.Write(LogLevel.Cache, "Update Failed for {0}", tmp_CachedObj.DebugStringSimple);

                        if (!tmp_CachedObj.IsStillValid())
                        {
                            tmp_CachedObj.NeedsRemoved = true;
                        }

                        continue;
                    }

                    //Obstacle cache
                    if (tmp_CachedObj.Obstacletype.Value != ObstacleType.None &&
                        (CheckFlag(tmp_CachedObj.targetType.Value, TargetType.ServerObjects)))
                    {
                        CacheObstacle thisObstacleObj;

                        if (!Obstacles.TryGetValue(tmp_CachedObj.RAGUID, out thisObstacleObj))
                        {
                            CacheServerObject newobj = new CacheServerObject(tmp_CachedObj);
                            Obstacles.Add(tmp_CachedObj.RAGUID, newobj);

                            //Add nearby objects to our collection (used in navblock/obstaclecheck methods to reduce queries)
                            if (CacheIDLookup.hashSNONavigationObstacles.Contains(newobj.SNOID))
                            {
                                Navigation.Navigation.MGP.AddCellWeightingObstacle(newobj.SNOID, newobj.Radius);
                            }
                        }
                        else
                        {
                            if (thisObstacleObj.targetType.Value == TargetType.Unit)
                            {
                                //Since units position requires updating, we update using the CacheObject
                                thisObstacleObj.Position        = tmp_CachedObj.Position;
                                Obstacles[tmp_CachedObj.RAGUID] = thisObstacleObj;
                            }
                        }
                    }


                    //cache it
                    if (Objects.ContainsKey(tmp_CachedObj.RAGUID))
                    {
                        Objects[tmp_CachedObj.RAGUID] = tmp_CachedObj;
                    }
                    else
                    {
                        Objects.Add(tmp_CachedObj.RAGUID, tmp_CachedObj);
                    }
                }        //End of Loop
            }            // End of Framelock

            //Tally up unseen objects.
            var UnseenObjects = Objects.Keys.Where(O => !hashDoneThisRactor.Contains(O)).ToList();
            if (UnseenObjects.Any())
            {
                for (int i = 0; i < UnseenObjects.Count(); i++)
                {
                    Objects[UnseenObjects[i]].LoopsUnseen++;
                }
            }

            //Trim our collection every 5th refresh.
            UpdateLoopCounter++;
            if (UpdateLoopCounter > 4)
            {
                UpdateLoopCounter = 0;
                //Now flag any objects not seen for 5 loops. Gold/Globe only 1 loop.
                foreach (var item in Objects.Values.Where(CO =>
                                                          (CO.LoopsUnseen >= 5 ||                                                                                                    //5 loops max..
                                                           (CO.targetType.HasValue && (CheckFlag(CO.targetType.Value, TargetType.Gold | TargetType.Globe)) && CO.LoopsUnseen > 0)))) //gold/globe only 1 loop!
                {
                    item.NeedsRemoved = true;
                }
            }

            CheckForCacheRemoval();

            _lastUpdatedCacheCollection = DateTime.Now;
            return(true);
        }
Exemplo n.º 21
0
 /// <summary>
 /// Creates a Pettype
 /// </summary>
 /// <param name="petTypes"></param>
 /// <returns></returns>
 public PetTypes Create(PetTypes petTypes)
 {
     petTypes.TypeId = FakeDB.TypeId++;
     FakeDB.PetTyper.Add(petTypes);
     return(petTypes);
 }
Exemplo n.º 22
0
 public UnitPetEntry(int snoID, PetTypes type, string internalname = "", PluginActorType actortype = PluginActorType.Monster, int interactRange = -1, int collisionRadius = -1)
     : base(snoID)
 {
     InternalName=internalname;
     _objectType = type;
     _actorType = actortype;
     InteractRange = interactRange;
     CollisionRadius = collisionRadius;
 }
Exemplo n.º 23
0
        public List <Pet> GetPetByType(PetTypes Type)
        {
            var pets = _PetService.GetPetByType(Type).ToList();

            return(pets.ToList());;
        }
Exemplo n.º 24
0
 public PetTypes UpdateTypes(PetTypes typeUpdate)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 25
0
        /// <summary>
        /// Mock data of all entyties
        /// </summary>
        public static void InitData()
        {
            var p = new Pet()
            {
                PetId         = FakeDB.PetId++,
                PetName       = "Bob",
                PetTypers     = "Cat",
                BirthDay      = DateTime.Now.AddDays(-10),
                Color         = "Green",
                PreviousOwner = "",
                Price         = 1000,
            };
            Owner own = new Owner();
            Pet   p1  = new Pet();

            p1.PetId         = FakeDB.PetId++;
            p1.PetName       = "Dingo";
            p1.PetTypers     = "Dog";
            p1.BirthDay      = DateTime.Now.AddDays(-20);
            p1.Color         = "Brown";
            p1.PreviousOwner = "Jørgen";
            p1.Price         = 2500;
            p1.owner         = own;

            Owner own1 = new Owner();
            Pet   p2   = new Pet();

            p2.PetId         = FakeDB.PetId++;
            p2.PetName       = "Raul";
            p2.PetTypers     = "Fish";
            p2.BirthDay      = DateTime.Now.AddDays(-15);
            p2.Color         = "Dark Pink";
            p2.PreviousOwner = "Ingolf";
            p2.Price         = 6700;
            p2.owner         = own1;

            Pet p3 = new Pet();

            p3.PetId         = FakeDB.PetId++;
            p3.PetName       = "Fido";
            p3.PetTypers     = "Dog";
            p3.BirthDay      = DateTime.Now.AddDays(-20);
            p3.Color         = "Black";
            p3.PreviousOwner = "Hans";
            p3.Price         = 1200;

            Pet p4 = new Pet();

            p4.PetId         = FakeDB.PetId++;
            p4.PetName       = "Laila";
            p4.PetTypers     = "Dog";
            p4.BirthDay      = DateTime.Now.AddDays(-20);
            p4.Color         = "Blonde";
            p4.PreviousOwner = "HC";
            p4.Price         = 25000;


            FakeDB.pets.Add(p);
            FakeDB.pets.Add(p1);
            FakeDB.pets.Add(p2);
            FakeDB.pets.Add(p3);
            FakeDB.pets.Add(p4);



            own.OwnerId        = FakeDB.OwnerId++;
            own.OwnerFirstName = "Lars";
            own.OwnerLastName  = "Bilde";
            own.Address        = "Ostevej 1";
            own.PhoneNumber    = "12345678";
            own.Email          = "*****@*****.**";



            own1.OwnerId        = FakeDB.OwnerId++;
            own1.OwnerFirstName = "Larsi";
            own1.OwnerLastName  = "Bildei";
            own1.Address        = "Ostevej 12";
            own1.PhoneNumber    = "1234567810";
            own1.Email          = "*****@*****.**";


            Owner own2 = new Owner();

            own2.OwnerId        = FakeDB.OwnerId++;
            own2.OwnerFirstName = "Larso";
            own2.OwnerLastName  = "Bildeo";
            own2.Address        = "Ostevej 6";
            own2.PhoneNumber    = "12341278";
            own2.Email          = "*****@*****.**";


            FakeDB.Owners.Add(own);
            FakeDB.Owners.Add(own1);
            FakeDB.Owners.Add(own2);

            PetTypes pt = new PetTypes();

            pt.TypeId  = FakeDB.TypeId++;
            pt.PetType = "Dog";

            FakeDB.PetTyper.Add(pt);
        }
Exemplo n.º 26
0
 public CachePet(CacheObject parent, PetTypes type)
     : base(parent)
 {
     PetType = type;
 }
Exemplo n.º 27
0
 public CacheUnitPetEntry(int snoID, PetTypes type, string internalname = "", int interactRange = -1, int collisionRadius = -1)
     : base(snoID)
 {
     InternalName = internalname;
     _objectType = type;
     InteractRange = interactRange;
     CollisionRadius = collisionRadius;
 }
Exemplo n.º 28
0
 public CacheUnitPetEntry(int snoID, PetTypes type, string internalname = "")
     : base(snoID)
 {
     InternalName = internalname;
     _objectType  = type;
 }
Exemplo n.º 29
0
 /// <summary>
 /// Create a Type
 /// </summary>
 /// <param name="petType"></param>
 /// <returns></returns>
 public PetTypes CreateType(PetTypes petType)
 {
     return(_petTypeRepo.Create(petType));
 }
Exemplo n.º 30
0
 public CachePet(CacheObject parent, PetTypes type) : base(parent)
 {
     PetType = type;
 }