Example #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Pet"/> class.
 /// </summary>
 /// <param name="petId">The pet identifier.</param>
 /// <param name="ownerId">The owner identifier.</param>
 /// <param name="roomId">The room identifier.</param>
 /// <param name="name">The name.</param>
 /// <param name="type">The type.</param>
 /// <param name="race">The race.</param>
 /// <param name="color">The color.</param>
 /// <param name="experience">The experience.</param>
 /// <param name="energy">The energy.</param>
 /// <param name="nutrition">The nutrition.</param>
 /// <param name="respect">The respect.</param>
 /// <param name="creationStamp">The creation stamp.</param>
 /// <param name="x">The x.</param>
 /// <param name="y">The y.</param>
 /// <param name="z">The z.</param>
 /// <param name="havesaddle">if set to <c>true</c> [havesaddle].</param>
 /// <param name="anyoneCanRide">The anyone can ride.</param>
 /// <param name="dye">The dye.</param>
 /// <param name="petHer">The pet her.</param>
 /// <param name="rarity">The rarity.</param>
 /// <param name="lastHealth">The last health.</param>
 /// <param name="untilGrown">The until grown.</param>
 /// <param name="moplaBreed">The mopla breed.</param>
 internal Pet(uint petId, uint ownerId, uint roomId, string name, uint type, string race, string color,
              int experience, int energy, int nutrition, int respect, double creationStamp, int x, int y, double z,
              bool havesaddle, int anyoneCanRide, int dye, int petHer, int rarity, DateTime lastHealth,
              DateTime untilGrown, MoplaBreed moplaBreed)
 {
     PetId              = petId;
     OwnerId            = ownerId;
     RoomId             = roomId;
     Name               = name;
     Type               = type;
     Race               = race;
     Color              = color;
     Experience         = experience;
     Energy             = energy;
     Nutrition          = nutrition;
     Respect            = respect;
     CreationStamp      = creationStamp;
     X                  = x;
     Y                  = y;
     Z                  = z;
     PlacedInRoom       = false;
     DbState            = DatabaseUpdateState.Updated;
     HaveSaddle         = havesaddle;
     AnyoneCanRide      = anyoneCanRide;
     PetHair            = petHer;
     HairDye            = dye;
     Rarity             = rarity;
     LastHealth         = lastHealth;
     UntilGrown         = untilGrown;
     MoplaBreed         = moplaBreed;
     PetCommands        = PetCommandHandler.GetPetCommands(this);
     WaitingForBreading = 0;
 }
Example #2
0
        /// <summary>
        /// Creates the monsterplant breed.
        /// </summary>
        /// <param name="pet">The pet.</param>
        /// <returns>MoplaBreed.</returns>
        internal static MoplaBreed CreateMonsterplantBreed(Pet pet)
        {
            if (pet.Type != 16)
            {
                return(null);
            }
            var tuple = GeneratePlantData(pet.Rarity);
            var breed = new MoplaBreed(pet, pet.PetId, pet.Rarity, tuple.Item1, tuple.Item2, 0, 1);

            using (var adapter = Plus.GetDatabaseManager().GetQueryReactor())
            {
                adapter.SetQuery(
                    "INSERT INTO pets_plants (pet_id, rarity, plant_name, plant_data) VALUES (@petid , @rarity , @plantname , @plantdata)");
                adapter.AddParameter("petid", pet.PetId);
                adapter.AddParameter("rarity", pet.Rarity);
                adapter.AddParameter("plantname", tuple.Item1);
                adapter.AddParameter("plantdata", tuple.Item2);
                adapter.RunQuery();
            }
            return(breed);
        }