public void StartUp() { // add prices to the dictionary, prices prices.Add("Dog", 120); prices.Add("Cat", 60); prices.Add("Snake", 40); prices.Add("Guinea pig", 20); prices.Add("Canary", 15); // create customers Customer c1 = new Customer(1001, "Susan", "Peterson", "Borgergade 45", "8000", "Aarhus", "*****@*****.**", "211a212121"); Customer c2 = new Customer(1002, "Brian", "Smith", "Allegade 108", "8000", "Aarhus", "*****@*****.**", "45454545"); //opret Employees Employee e1 = new Employee("Gitte", "Svendsen", "GIT", "234234234"); Employee e2 = new Employee("Mads", "Juul", "MUL", "911112112"); Pet p1 = new Pet("Dog", "Hamlet", new DateTime(2011, 9, 2), new DateTime(2011,9,20), c1, e1); Pet p2 = new Pet("Dog", "Samson", new DateTime(2011, 9, 14), new DateTime(2011, 9, 21), c1, e1); Pet p3 = new Pet("Cat", "Darla", new DateTime(2011, 9, 7), new DateTime(2011, 9, 10), c2, e2); // add Pets to list of Pet, pets pets.Add(p1); pets.Add(p2); pets.Add(p3); // add customers to list customer.Add(c1); customer.Add(c2); }
public ActionResult CreatePet([DataSourceRequest]DataSourceRequest request, IEnumerable<AdministrationPetsViewModel> models) { var result = new List<AdministrationPetsViewModel>(); if (this.ModelState.IsValid && models != null) { foreach (var model in models) { var owner = this.users.GetByUsername(model.Owner).FirstOrDefault(); var breed = this.breeds.GetById(model.BreedId).FirstOrDefault(); var location = this.locations.GetById(model.LocationId).FirstOrDefault(); var status = this.petStatuses.GetById(model.PetStatusId).FirstOrDefault(); if (owner != null && breed != null && location != null && status != null) { var newPet = new Pet { Name = model.Name, Description = model.Description, Breed = breed, Owner = owner, Location = location, PetStatus = status, ImageUrl = model.ImageUrl, PetGender = model.PetGenderType }; this.pets.Add(newPet); model.CreatedOn = newPet.CreatedOn; model.Id = newPet.Id; result.Add(model); } } return this.Json(result.ToDataSourceResult(request), JsonRequestBehavior.AllowGet); } return null; }
public MainVM() { var bobbyJoe = new Person("Bobby Joe", new[] { new Pet("Fluffy") }); var bob = new Person("Bob", new[] { bobbyJoe }); var littleJoe = new Person("Little Joe"); var joe = new Person("Joe", new[] { littleJoe }); Family = new ReactiveList<TreeItem> { bob, joe }; _addPerson = ReactiveCommand.Create(); _addPerson.Subscribe(_ => { if (SelectedItem == null) return; var p = new Person(NewName); SelectedItem.AddChild(p); p.IsSelected = true; p.ExpandPath(); }); _addPet = ReactiveCommand.Create(); _addPet.Subscribe(_ => { if (SelectedItem == null) return; var p = new Pet(PetName); SelectedItem.AddChild(p); p.IsSelected = true; p.ExpandPath(); }); _collapse = ReactiveCommand.Create(); _collapse.Subscribe(_ => { SelectedItem?.CollapsePath(); }); }
/// <summary>Add a new pet to the store</summary> /// <param name="body">Pet object that needs to be added to the store</param> /// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param> /// <exception cref="SwaggerException">A server side error occurred.</exception> public async System.Threading.Tasks.Task AddPetAsync(Pet body, System.Threading.CancellationToken cancellationToken) { var url_ = string.Format("{0}/{1}", BaseUrl, "pet"); using (var client_ = new System.Net.Http.HttpClient()) { var request_ = new System.Net.Http.HttpRequestMessage(); PrepareRequest(client_, ref url_); var content_ = new System.Net.Http.StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(body)); content_.Headers.ContentType.MediaType = "application/json"; request_.Content = content_; request_.Method = new System.Net.Http.HttpMethod("POST"); request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseContentRead, cancellationToken).ConfigureAwait(false); ProcessResponse(client_, response_); var responseData_ = await response_.Content.ReadAsByteArrayAsync().ConfigureAwait(false); var status_ = ((int)response_.StatusCode).ToString(); if (status_ == "405") { throw new SwaggerException("Invalid input", status_, responseData_, null); } else if (status_ != "200" && status_ != "204") throw new SwaggerException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", status_, responseData_, null); } }
static void Main() { Person Ivan = new Person{ Name = "Ivan Petrov" }; Person Gosho = new Person{ Name = "Gosho Georgiev" }; Person Mara = new Person{ Name = "Kaka Mara" }; Pet barley = new Pet{ Name = "Barley", Owner = Ivan }; Pet boots = new Pet{ Name = "Boots", Owner = Ivan }; Pet whiskers = new Pet{ Name = "Whiskers", Owner = Mara }; Pet daisy = new Pet{ Name = "Daisy", Owner = Gosho }; List<Person> people = new List<Person>{ Ivan, Gosho, Mara }; List<Pet> pets = new List<Pet>{ barley, boots, whiskers, daisy }; var query = //from person in people // join p in pets on person equals p.Owner // select new { OwnerName = person.Name, Pet = p.Name }; people.Join(pets, person => person, pet => pet.Owner, (person, pet) => new { OwnerName = person.Name, Pet = pet.Name }); foreach (var obj in query) { Console.WriteLine("{0} - {1}", obj.OwnerName, obj.Pet); } }
internal static void GenerateMessage(Pet pet, ServerMessage message, bool levelAfterName = false) { message.AppendInteger(pet.PetId); message.AppendString(pet.Name); if (levelAfterName) message.AppendInteger(pet.Level); message.AppendInteger(pet.RaceId); message.AppendInteger(pet.Race); message.AppendString(pet.Type == "pet_monster" ? "ffffff" : pet.Color); message.AppendInteger(pet.Type == "pet_monster" ? 0u : pet.RaceId); if (pet.Type == "pet_monster" && pet.MoplaBreed != null) { string[] array = pet.MoplaBreed.PlantData.Substring(12).Split(' '); string[] array2 = array; foreach (string s in array2) message.AppendInteger(int.Parse(s)); message.AppendInteger(pet.MoplaBreed.GrowingStatus); return; } message.AppendInteger(0); message.AppendInteger(0); }
public Pet Pet_insert() { Pet.Pet_Location_Found_ID = Convert.ToInt32(Pet_Location_Found_ID_txt.Text); Pet.Pet_Type_ID = Convert.ToInt32(Pet_Type_ID_txt.Text); Pet.Pet_Vet_ID = Pet_Vet_ID_txt.Text; Pet.Pet_License_Tag = Pet_License_Tag_txt.Text; Pet.Pet_RFID = Pet_RFID_txt.Text; Pet.Pet_Tatoo_No = Pet_Tatoo_No_txt.Text; Pet.Pet_Name = Pet_Name_txt.Text; Pet.Pet_Gender = Pet_Gender_txt.Text; Pet.Pet_Color = Pet_Color_txt.Text; Pet.Pet_Weight = Convert.ToInt32(Pet_Weight_txt.Text); Pet.Pet_Description = Pet_Description_txt.Text; Pet.Pet_Condition = Pet_Condition_txt.Text; Pet.Pet_Status = Pet_Status_txt.Text; Pet.Pet_Date_Of_Birth = Convert.ToDateTime(Pet_Date_Of_Birth_txt.Text); byte[] uploaded_picture = FileUpload1.FileBytes; Pet.Pet_Picture = uploaded_picture; Pet.Pet_Sterilized = Pet_Sterilized_txt.Text; Pet.Date_Modified = Convert.ToDateTime(Date_Modified_txt.Text); Pet.Date_Created = Convert.ToDateTime(Date_Created_txt.Text); Pet = Pet.Insert(Pet); GridView1.DataBind(); return Pet; }
public IEnumerable<Pet> Get() { List<Pet> pets = new List<Pet>(); //get pets from db using (SqlConnection connection = new SqlConnection(this.connectionString)) { string sql = @"SELECT * FROM PETS"; connection.Open(); SqlCommand cmd = new SqlCommand(sql, connection); SqlDataReader data = cmd.ExecuteReader(); if (data.HasRows) { while (data.Read()) { Pet pet = new Pet(); pet.Id = Int32.Parse(data["Id"].ToString()); pet.Name = data["Name"].ToString(); pet.Notes = data["Notes"].ToString(); pet.IsOnCare = Boolean.Parse(data["IsOnCare"].ToString()); pets.Add(pet); } } data.Dispose(); cmd.Dispose(); } return pets; }
public Pet GetPet() { Pet pet = new Pet(); pet.PetId = 1; pet.Name = "Tamo"; return pet; }
/// <summary> /// Add a new pet to the store /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='body'> /// Pet object that needs to be added to the store /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task<Pet> AddPetAsync(this ISwaggerPetstoreV2 operations, Pet body, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.AddPetWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } }
public static void JoinEx1() { Person magnus = new Person { Name = "Hedlund, Magnus" }; Person terry = new Person { Name = "Adams, Terry" }; Person charlotte = new Person { Name = "Weiss, Charlotte" }; Pet barley = new Pet { Name = "Barley", Owner = terry }; Pet boots = new Pet { Name = "Boots", Owner = terry }; Pet whiskers = new Pet { Name = "Whiskers", Owner = charlotte }; Pet daisy = new Pet { Name = "Daisy", Owner = magnus }; List<Person> people = new List<Person> { magnus, terry, charlotte }; List<Pet> pets = new List<Pet> { barley, boots, whiskers, daisy }; // Create a list of Person-Pet pairs where // each element is an anonymous type that contains a // Pet's name and the name of the Person that owns the Pet. var query = people.Join(pets, person => person, pet => pet.Owner, (person1, pet1) => new { OwnerName = person1.Name, Pet = pet1.Name }); foreach (var obj in query) { Console.WriteLine( "{0} - {1}", obj.OwnerName, obj.Pet); } }
internal static void GenerateMessage(Pet pet) { ServerMessage serverMessage = new ServerMessage(LibraryParser.OutgoingRequest("RespectPetComposer")); serverMessage.AppendInteger(pet.VirtualId); serverMessage.AppendBool(true); pet.Room.SendMessage(serverMessage); }
public void dogIndexChanged(object sender, EventArgs e) { gvCat.SelectedIndex = -1; gvBird.SelectedIndex = -1; btnPurchase.Enabled = true; petToBuy = (Pet)dogList[gvDog.SelectedIndex]; ViewState["pet"] = pet_dao.ObjectToString(petToBuy); }
internal static void GenerateMessage(Pet pet) { ServerMessage serverMessage = new ServerMessage(LibraryParser.OutgoingRequest("PetRespectNotificationMessageComposer")); serverMessage.AppendInteger(1); serverMessage.AppendInteger(pet.VirtualId); pet.SerializeInventory(serverMessage); pet.Room.SendMessage(serverMessage); }
internal static void GenerateMessage(Pet pet, uint amount) { ServerMessage serverMessage = new ServerMessage(LibraryParser.OutgoingRequest("AddPetExperienceMessageComposer")); serverMessage.AppendInteger(pet.PetId); serverMessage.AppendInteger(pet.VirtualId); serverMessage.AppendInteger(amount); pet.Room.SendMessage(serverMessage); }
internal MoplaBreed(Pet Pet, uint PetId, int Rarity, string MoplaName, string BreedData, int LiveState, int GrowingStatus) { this.Pet = Pet; this.PetId = PetId; this.Rarity = Rarity; this.MoplaName = MoplaName; this.BreedData = BreedData; this.LiveState = (MoplaState)LiveState; this.GrowingStatus = GrowingStatus; }
Regulus.Remoting.Value<Pet> IStorage.FindPet(Guid id) { var pet = new Pet() { Id = Guid.NewGuid(), Owner = id }; pet.Energy = new Energy(7); Func<bool>[] energyIncs = new Func<bool>[]{pet.Energy.IncGreen , pet.Energy.IncRed , pet.Energy.IncYellow }; /*for(int i = 0 ; i < 3 ; ++i) { energyIncs[Regulus.Utility.Random.Next(0, 3)](); }*/ pet.Name = _Count++ % 2 == 0 ? "蝙蝠" : "甲蟲"; return pet; }
Regulus.Remoting.Value<IBattlerBehavior> IBattleAdmissionTickets.Visit(Pet pet) { Regulus.Remoting.Value<IBattlerBehavior> rce = new Remoting.Value<IBattlerBehavior>(); ReadyInfomation ri = (from readyInfomation in _ReadyInfomations where readyInfomation.Battler.Id == pet.Owner && readyInfomation.Pet == null select readyInfomation).FirstOrDefault(); if (ri != null) { ri.Pet = pet; ri.BattleBehavior = rce; _Count++; } return rce; }
public static void Main() { Console.WriteLine("Pet Properties"); // Create a new Person object: Pet pet = new Pet(); // Print out the name and the age associated with the person: Console.WriteLine("Pet details - {0}", pet); pet.Name = "Doge"; pet.Age = 99; pet.Sex = "male"; pet.Type = "Shiba Inu"; Console.WriteLine("Pet details - {0}", pet); }
public override void Awake() { base.Awake(); atkAnimKeyFrame = 14; if (GotoProxy.getSceneName() != GotoProxy.SKILLTREE && GotoProxy.getSceneName() != GotoProxy.YOUR_TEAM && GotoProxy.getSceneName() != GotoProxy.COMBINED_ARMORY && GotoProxy.getSceneName() != GotoProxy.ARMORY ) { GameObject petObj = Instantiate(petPrb, gameObject.transform.position, gameObject.transform.rotation) as GameObject; pet = petObj.GetComponent<Pet>(); pet.selectMaster(this); } isTigersClaw = false; }
public HomeModule() { Get["/"] = _ => { List<Pet> allPets = Pet.GetAll(); if (allPets.Count >=0) { return View["index.cshtml",allPets]; } else { return View["index.cshtml"]; } }; Post["/"] = _ => { Pet newPet = new Pet(Request.Form["new-pet"]); List<Pet> allPets = Pet.GetAll(); return View["index.cshtml", allPets]; }; Post["/time"]= _ =>{ Pet.TimePass(); List<Pet> allPets = Pet.GetAll(); return View["index.cshtml", allPets]; }; Get["/pets/{id}"] = parameters => { Pet pet = Pet.Find(parameters.id); return View["/pet.cshtml", pet]; }; Post["/pets/{id}/food"]= parameters =>{ Pet pet = Pet.Find(parameters.id); Pet.FeedPet(pet); return View["pet.cshtml", pet]; }; Post["/pets/{id}/attention"]= parameters =>{ Pet pet = Pet.Find(parameters.id); Pet.AttentionPet(pet);//increase attention return View["pet.cshtml", pet]; }; Post["/pets/{id}/rest"]= parameters =>{ Pet pet = Pet.Find(parameters.id); Pet.RestPet(pet);//increase rest return View["pet.cshtml", pet]; }; Post["/clear"]= _ =>{ List<Pet> allPets = Pet.GetAll(); Pet.ClearAll(); return View["index.cshtml", allPets]; }; }
public HunterPet(Pet k, int str, int agi, int sta, int intel, int spi, int ap, int dmgMin, int dmgMax, double atkspeed, double dps, int sp, int ar) { //kind = k; strength = str; agility = agi; //baseStamina = sta; //baseIntelect = intel; spirit = spi; //baseAttackPower = ap; damageMin = dmgMin; damageMax = dmgMax; attackSpeed = atkspeed; dmgpersec = dps; //baseSpellPower = sp; //baseArmor = ar; }
void Start() { popupInstantiated = false; instance = this; instance.m_lastPlayTime = lastP; m_hunger = new Desire(Desire.DesireType.Hunger, 1); m_hapiness = new Desire(Desire.DesireType.Hapiness, 1); m_sleep = new Desire(Desire.DesireType.Sleep, 1); m_inventory = new List<Item>(); updateDesiresSinceLastPlayed(); m_hunger.setDemand(hungerD); m_hapiness.setDemand(happyD); m_sleep.setDemand(sleepD); StartCoroutine(desireLoop()); hungerD = 0; sleepD = 0; happyD = 0; lastP = System.DateTime.MinValue; }
internal static void GenerateMessage(Pet pet, Dictionary<uint, PetCommand> totalPetCommands, Dictionary<uint, PetCommand> petCommands, GameClient owner) { ServerMessage serverMessage = new ServerMessage(LibraryParser.OutgoingRequest("PetTrainerPanelMessageComposer")); serverMessage.AppendInteger(pet.PetId); serverMessage.AppendInteger(totalPetCommands.Count); foreach (uint sh in totalPetCommands.Keys) serverMessage.AppendInteger(sh); serverMessage.AppendInteger(petCommands.Count); foreach (uint sh in petCommands.Keys) serverMessage.AppendInteger(sh); owner.SendMessage(serverMessage); }
internal static MoplaBreed CreateMonsterplantBreed(Pet Pet) { MoplaBreed breed = null; if (Pet.Type == 16) { Tuple<string, string> tuple = GeneratePlantData(Pet.Rarity); breed = new MoplaBreed(Pet, Pet.PetId, Pet.Rarity, tuple.Item1, tuple.Item2, 0, 1); using (IQueryAdapter adapter = MercuryEnvironment.GetDatabaseManager().getQueryreactor()) { adapter.setQuery("INSERT INTO bots_monsterplants (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; }
public static void Main() { Pet fluffy = new Pet(); fluffy.Name = "Fluffy"; fluffy.Species = "Cat"; fluffy.Age = 5; Pet spot = new Pet(); spot.Name = "Spot"; spot.Species = "Dog"; spot.Age = 5; Pet ace = new Pet(); ace.Name = "Ace"; ace.Species = "Dog"; ace.Age = 8; Pet tom = new Pet(); tom.Name = "Tom"; tom.Species = "Cat"; tom.Age = 5; List<Pet> Pets = new List<Pet>() {fluffy, spot, ace, tom}; foreach(Pet animal in Pets) { Console.WriteLine(animal.Name); } Console.WriteLine("Enter the maximum age pet you are looking for."); string stringMaxAge = Console.ReadLine(); int maxAge = int.Parse(stringMaxAge); List <Pet> PetsMatchingSearch = new List<Pet>(); foreach(Pet animal in Pets) { if (animal.Age <= maxAge) { PetsMatchingSearch.Add(animal); } } foreach(Pet animal in PetsMatchingSearch) { Console.WriteLine(animal.Name); } }
public Pet Add(string name) { if (string.IsNullOrWhiteSpace(name)) { return null; } var pet = new Pet() { Name = name }; this.petsRepo.Add(pet); try { this.petsRepo.Save(); return this.petsRepo.All().Where(x => x.Name == name).FirstOrDefault(); } catch (Exception) { // log return null; } }
public string Upload(Pet pet) { var restClient = new RestClient {BaseUrl = "http://ec2-107-20-224-204.compute-1.amazonaws.com/node"}; byte[] readBuffer = new IsolatedStorageService().ReadImageFromIsolatedStorage("myWP7.dat"); IRestRequest restRequest = new RestRequest(Method.POST) .AddFile("file", readBuffer, pet.PictureUri.LocalPath) .AddParameter("breed", pet.Breed) .AddParameter("contact", pet.Contact) .AddParameter("contactMethod", pet.ContactMethod) .AddParameter("when", pet.DateWhen) .AddParameter("description", pet.Description) .AddParameter("dogOrCat", pet.DogOrCat) .AddParameter("foundAround", pet.FoundAround) .AddParameter("name", pet.Name) .AddParameter("size", pet.Size) .AddParameter("status", pet.Status); /*var callback = new Action<RestResponse>(delegate { }); restClient.ExecuteAsync(restRequest, callback);*/ return "http://www.lostpets.com"; }
public Pet Create(string name, int age, string ownerId, PetGender gender, int speciesId, string picture = null) { if (picture == string.Empty) { picture = "http://s.hswstatic.com/gif/animal-stereotype-orig.jpg"; } var pet = new Pet { Name = name, Age = age, OwnerId = ownerId, Gender = gender, SpeciesId = speciesId, Picture = picture }; this.pets.Add(pet); this.pets.Save(); return pet; }
public bool Add(Pet pet) { bool isSuccess = false; //insert on db using (SqlConnection connection = new SqlConnection(this.connectionString)) { string sql = @"INSERT INTO Pets (Name, IsOnCare) VALUES (@name,@isOnCare);"; connection.Open(); SqlCommand cmd = new SqlCommand(sql, connection); cmd.Parameters.AddWithValue("@name", pet.Name); cmd.Parameters.AddWithValue("@isOnCare", pet.IsOnCare); if (cmd.ExecuteNonQuery() > 0) { isSuccess = true; } } return isSuccess; }
/// <summary>Get parsed data about the friendship between a player and NPC.</summary> /// <param name="player">The player.</param> /// <param name="pet">The pet.</param> public FriendshipModel GetFriendshipForPet(Farmer player, Pet pet) { return(this.DataParser.GetFriendshipForPet(player, pet)); }
public Pet CreatePet(Pet pet) { return(_petRepository.CreatePet(pet)); }
public void RemovePet(Pet removePet) { MyLists.Pets.Remove(removePet); }
public void Post([FromBody] Pet pet) { _petsRepositorio.Insert(pet); }
public void CreatePet(IList <string> petArgs) { IPet newPet = new Pet(petArgs[0], int.Parse(petArgs[1]), petArgs[2]); pets.Add(newPet); }
public void RemovePet(Pet pet) { _petRepo.PetEaten(pet); }
public Pet CreatePet(Pet pet) { pet.PetId = id++; _pets.Add(pet); return(pet); }
public override int Speed(Pet pet) => pet.speed;
public Pet Create(Pet pet) { _context.Attach(pet).State = EntityState.Added; _context.SaveChanges(); return(pet); }
public bool PetInsert(Pet obj) { return(_petRepository.PetInsert(obj)); }
public bool PetUpdate(Pet obj) { return(_petRepository.PetUpdate(obj)); }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { if (!Session.GetHabbo().InRoom) { return; } if (Session == null || Session.GetHabbo() == null || Session.GetHabbo().GetInventoryComponent() == null) { return; } Room Room; if (!PlusEnvironment.GetGame().GetRoomManager().TryGetRoom(Session.GetHabbo().CurrentRoomId, out Room)) { return; } int PetId = Packet.PopInt(); RoomUser Pet = null; if (!Room.GetRoomUserManager().TryGetPet(PetId, out Pet)) { //Check kick rights, just because it seems most appropriate. if ((!Room.CheckRights(Session) && Room.WhoCanKick != 2 && Room.Group == null) || (Room.Group != null && !Room.CheckRights(Session, false, true))) { return; } //Okay so, we've established we have no pets in this room by this virtual Id, let us check out users, maybe they're creeping as a pet?! RoomUser TargetUser = Session.GetHabbo().CurrentRoom.GetRoomUserManager().GetRoomUserByHabbo(PetId); if (TargetUser == null) { return; } //Check some values first, please! if (TargetUser.GetClient() == null || TargetUser.GetClient().GetHabbo() == null) { return; } //Update the targets PetId. TargetUser.GetClient().GetHabbo().PetId = 0; //Quickly remove the old user instance. Room.SendMessage(new UserRemoveComposer(TargetUser.VirtualId)); //Add the new one, they won't even notice a thing!!11 8-) Room.SendMessage(new UsersComposer(TargetUser)); return; } if (Session.GetHabbo().Id != Pet.PetData.OwnerId && !Room.CheckRights(Session, true, false)) { Session.SendWhisper("You can only pickup your own pets, to kick a pet you must have room rights."); return; } if (Pet.RidingHorse) { RoomUser UserRiding = Room.GetRoomUserManager().GetRoomUserByVirtualId(Pet.HorseID); if (UserRiding != null) { UserRiding.RidingHorse = false; UserRiding.ApplyEffect(-1); UserRiding.MoveTo(new Point(UserRiding.X + 1, UserRiding.Y + 1)); } else { Pet.RidingHorse = false; } } Pet.PetData.RoomId = 0; Pet.PetData.PlacedInRoom = false; Pet pet = Pet.PetData; if (pet != null) { using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.RunQuery("UPDATE `bots` SET `room_id` = '0', `x` = '0', `Y` = '0', `Z` = '0' WHERE `id` = '" + pet.PetId + "' LIMIT 1"); dbClient.RunQuery("UPDATE `bots_petdata` SET `experience` = '" + pet.experience + "', `energy` = '" + pet.Energy + "', `nutrition` = '" + pet.Nutrition + "', `respect` = '" + pet.Respect + "' WHERE `id` = '" + pet.PetId + "' LIMIT 1"); } } if (pet.OwnerId != Session.GetHabbo().Id) { GameClient Target = PlusEnvironment.GetGame().GetClientManager().GetClientByUserID(pet.OwnerId); if (Target != null) { if (Target.GetHabbo().GetInventoryComponent().TryAddPet(Pet.PetData)) { Target.SendMessage(new PetInventoryComposer(Target.GetHabbo().GetInventoryComponent().GetPets())); } } Room.GetRoomUserManager().RemoveBot(Pet.VirtualId, false); return; } if (Session.GetHabbo().GetInventoryComponent().TryAddPet(Pet.PetData)) { Room.GetRoomUserManager().RemoveBot(Pet.VirtualId, false); Session.SendMessage(new PetInventoryComposer(Session.GetHabbo().GetInventoryComponent().GetPets())); } }
public Pet AddPet(Pet pet) { return(_petRepo.CreatePet(pet)); }
/// <summary> /// Update an existing pet /// </summary> /// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="body">Pet object that needs to be added to the store</param> /// <returns>ApiResponse of Object(void)</returns> public ApiResponse <Object> UpdatePetWithHttpInfo(Pet body) { // verify the required parameter 'body' is set if (body == null) { throw new ApiException(400, "Missing required parameter 'body' when calling PetApi->UpdatePet"); } var localVarPath = "/pet"; var localVarPathParams = new Dictionary <String, String>(); var localVarQueryParams = new List <KeyValuePair <String, String> >(); var localVarHeaderParams = new Dictionary <String, String>(this.Configuration.DefaultHeader); var localVarFormParams = new Dictionary <String, String>(); var localVarFileParams = new Dictionary <String, FileParameter>(); Object localVarPostBody = null; // to determine the Content-Type header String[] localVarHttpContentTypes = new String[] { "application/json", "application/xml" }; String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); // to determine the Accept header String[] localVarHttpHeaderAccepts = new String[] { "application/xml", "application/json" }; String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null) { localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); } if (body != null && body.GetType() != typeof(byte[])) { localVarPostBody = this.Configuration.ApiClient.Serialize(body); // http body (model) parameter } else { localVarPostBody = body; // byte array } // authentication (petstore_auth) required // oauth required if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) { localVarHeaderParams["Authorization"] = "Bearer " + this.Configuration.AccessToken; } // make the HTTP request IRestResponse localVarResponse = (IRestResponse)this.Configuration.ApiClient.CallApi(localVarPath, Method.PUT, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarPathParams, localVarHttpContentType); int localVarStatusCode = (int)localVarResponse.StatusCode; if (ExceptionFactory != null) { Exception exception = ExceptionFactory("UpdatePet", localVarResponse); if (exception != null) { throw exception; } } return(new ApiResponse <Object>(localVarStatusCode, localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), null)); }
public bool UpdatePet(Pet updatedPet) { return(_PetRepo.UpdatePet(updatedPet)); }
protected void Page_Load(object sender, EventArgs e) { this.healthBar = Page.FindControl("health") as HtmlGenericControl; this.happyBar = Page.FindControl("happy") as HtmlGenericControl; this.hungryBar = Page.FindControl("hungry") as HtmlGenericControl; this.Pts = Page.FindControl("pts") as HtmlGenericControl; this.db = new Conexao().GetConnection(); this.username = Session["Auth"].ToString(); this.petname = Request.QueryString["petnome"].ToString(); Session["petLogged"] = petname; pet = new Pet().getPet(db, username, petname); if (pet.Estado != "dormindo") { Debug.WriteLine("update"); updateEstado(sender, e); } labelestado.Text = pet.Estado; if (pet.Estado == "doente") { updateDoente(sender, e); } else if (pet.Estado == "faminto") { updateFaminto(sender, e); } else if (pet.Estado == "triste") { updateTriste(sender, e); } else if (pet.Estado == "morto") { pet.Fome = 0; pet.Saude = 0; pet.Felicidade = 0; } else { updateNormal(sender, e); } if (pet.Fome < 0) { pet.Fome = 0; } if (pet.Saude < 0) { pet.Saude = 0; } if (pet.Felicidade < 0) { pet.Felicidade = 0; } if (pet.Fome > 100) { pet.Fome = 100; } if (pet.Saude > 100) { pet.Saude = 100; } if (pet.Felicidade > 100) { pet.Felicidade = 100; } healthBar.Style.Add("width", pet.Saude + "%"); hungryBar.Style.Add("width", pet.Fome + "%"); happyBar.Style.Add("width", pet.Felicidade + "%"); pet.Update_Pet(pet.Fome, pet.Saude, pet.Felicidade, pet, DateTime.UtcNow, pet.Estado); }
public ActionResult DeleteConfirmed(int id) { Pet pet = _dataRepository.GetAPetByID(id); return(RedirectToAction("Index")); }
/// <summary> /// Update an existing pet /// </summary> /// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="body">Pet object that needs to be added to the store</param> /// <returns></returns> public void UpdatePet(Pet body) { UpdatePetWithHttpInfo(body); }
public void UpdatePet(Pet pet, int typeToChange, string change) { _petRepo.UpdatePetInDB(pet, typeToChange, change); }
/// <summary> /// Add a new pet to the store /// </summary> /// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="body">Pet object that needs to be added to the store</param> /// <returns></returns> public void AddPet(Pet body) { AddPetWithHttpInfo(body); }
public void Parse(GameClient session, ClientPacket packet) { if (session == null || session.GetHabbo() == null || !session.GetHabbo().InRoom) { return; } Room room = session.GetHabbo().CurrentRoom; if (room == null) { return; } int itemId = packet.PopInt(); Item item = room.GetRoomItemHandler().GetItem(itemId); if (item == null || item.Data == null || item.UserID != session.GetHabbo().Id || item.Data.InteractionType != InteractionType.GNOME_BOX) { return; } string petName = packet.PopString(); if (string.IsNullOrEmpty(petName)) { session.SendPacket(new CheckGnomeNameComposer(petName, 1)); return; } if (!PlusEnvironment.IsValidAlphaNumeric(petName)) { session.SendPacket(new CheckGnomeNameComposer(petName, 1)); return; } int x = item.GetX; int y = item.GetY; //Quickly delete it from the database. using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("DELETE FROM `items` WHERE `id` = @ItemId LIMIT 1"); dbClient.AddParameter("ItemId", item.Id); dbClient.RunQuery(); } //Remove the item. room.GetRoomItemHandler().RemoveFurniture(session, item.Id); //Apparently we need this for success. session.SendPacket(new CheckGnomeNameComposer(petName, 0)); //Create the pet here. Pet pet = PetUtility.CreatePet(session.GetHabbo().Id, petName, 26, "30", "ffffff"); if (pet == null) { session.SendNotification("Oops, an error occoured. Please report this!"); return; } List <RandomSpeech> rndSpeechList = new List <RandomSpeech>(); pet.RoomId = session.GetHabbo().CurrentRoomId; pet.GnomeClothing = RandomClothing(); //Update the pets gnome clothing. using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("UPDATE `bots_petdata` SET `gnome_clothing` = @GnomeClothing WHERE `id` = @PetId LIMIT 1"); dbClient.AddParameter("GnomeClothing", pet.GnomeClothing); dbClient.AddParameter("PetId", pet.PetId); dbClient.RunQuery(); } //Make a RoomUser of the pet. room.GetRoomUserManager().DeployBot(new RoomBot(pet.PetId, pet.RoomId, "pet", "freeroam", pet.Name, "", pet.Look, x, y, 0, 0, 0, 0, 0, 0, ref rndSpeechList, "", 0, pet.OwnerId, false, 0, false, 0), pet); //Give the food. if (PlusEnvironment.GetGame().GetItemManager().GetItem(320, out ItemData petFood)) { Item food = ItemFactory.CreateSingleItemNullable(petFood, session.GetHabbo(), "", ""); if (food != null) { session.GetHabbo().GetInventoryComponent().TryAddItem(food); session.SendPacket(new FurniListNotificationComposer(food.Id, 1)); } } }
public void UpdateZone(uint newZone, uint newArea) { if (!IsInWorld) { return; } uint oldZone = m_zoneUpdateId; m_zoneUpdateId = newZone; m_zoneUpdateTimer = 1 * Time.InMilliseconds; GetMap().UpdatePlayerZoneStats(oldZone, newZone); // call leave script hooks immedately (before updating flags) if (oldZone != newZone) { Global.OutdoorPvPMgr.HandlePlayerLeaveZone(this, oldZone); Global.BattleFieldMgr.HandlePlayerLeaveZone(this, oldZone); } // group update if (GetGroup()) { SetGroupUpdateFlag(GroupUpdateFlags.Full); Pet pet = GetPet(); if (pet) { pet.SetGroupUpdateFlag(GroupUpdatePetFlags.Full); } } // zone changed, so area changed as well, update it UpdateArea(newArea); AreaTableRecord zone = CliDB.AreaTableStorage.LookupByKey(newZone); if (zone == null) { return; } if (WorldConfig.GetBoolValue(WorldCfg.Weather)) { GetMap().GetOrGenerateZoneDefaultWeather(newZone); } GetMap().SendZoneDynamicInfo(newZone, this); UpdateWarModeAuras(); UpdateHostileAreaState(zone); if (zone.HasFlag(AreaFlags.Capital)) // Is in a capital city { if (!pvpInfo.IsInHostileArea || zone.IsSanctuary()) { _restMgr.SetRestFlag(RestFlag.City); } pvpInfo.IsInNoPvPArea = true; } else { _restMgr.RemoveRestFlag(RestFlag.City); } UpdatePvPState(); // remove items with area/map limitations (delete only for alive player to allow back in ghost mode) // if player resurrected at teleport this will be applied in resurrect code if (IsAlive()) { DestroyZoneLimitedItem(true, newZone); } // check some item equip limitations (in result lost CanTitanGrip at talent reset, for example) AutoUnequipOffhandIfNeed(); // recent client version not send leave/join channel packets for built-in local channels UpdateLocalChannels(newZone); UpdateZoneDependentAuras(newZone); // call enter script hooks after everyting else has processed Global.ScriptMgr.OnPlayerUpdateZone(this, newZone, newArea); if (oldZone != newZone) { Global.OutdoorPvPMgr.HandlePlayerEnterZone(this, newZone); Global.BattleFieldMgr.HandlePlayerEnterZone(this, newZone); SendInitWorldStates(newZone, newArea); // only if really enters to new zone, not just area change, works strange... Guild guild = GetGuild(); if (guild) { guild.UpdateMemberData(this, GuildMemberData.ZoneId, newZone); } } }
public void Put([FromBody] Pet pet) { _petsRepositorio.Update(pet); }
void Start() { inventory = Inventory.instance; pet = new Pet(); }
public async Task DeleteItemAsync(Pet pet) { await Table.DeleteAsync(pet).ConfigureAwait(false); }
static bool HandlePetCreateCommand(StringArguments args, CommandHandler handler) { Player player = handler.GetSession().GetPlayer(); Creature creatureTarget = handler.GetSelectedCreature(); if (!creatureTarget || creatureTarget.IsPet() || creatureTarget.IsTypeId(TypeId.Player)) { handler.SendSysMessage(CypherStrings.SelectCreature); return(false); } CreatureTemplate creatureTemplate = creatureTarget.GetCreatureTemplate(); // Creatures with family CreatureFamily.None crashes the server if (creatureTemplate.Family == CreatureFamily.None) { handler.SendSysMessage("This creature cannot be tamed. (Family id: 0)."); return(false); } if (!player.GetPetGUID().IsEmpty()) { handler.SendSysMessage("You already have a pet"); return(false); } // Everything looks OK, create new pet Pet pet = new Pet(player, PetType.Hunter); if (!pet.CreateBaseAtCreature(creatureTarget)) { handler.SendSysMessage("Error 1"); return(false); } creatureTarget.SetDeathState(DeathState.JustDied); creatureTarget.RemoveCorpse(); creatureTarget.SetHealth(0); // just for nice GM-mode view pet.SetCreatorGUID(player.GetGUID()); pet.SetFaction(player.GetFaction()); if (!pet.InitStatsForLevel(creatureTarget.GetLevel())) { Log.outError(LogFilter.ChatSystem, "InitStatsForLevel() in EffectTameCreature failed! Pet deleted."); handler.SendSysMessage("Error 2"); return(false); } // prepare visual effect for levelup pet.SetLevel(creatureTarget.GetLevel() - 1); pet.GetCharmInfo().SetPetNumber(Global.ObjectMgr.GeneratePetNumber(), true); // this enables pet details window (Shift+P) pet.InitPetCreateSpells(); pet.SetFullHealth(); pet.GetMap().AddToMap(pet.ToCreature()); // visual effect for levelup pet.SetLevel(creatureTarget.GetLevel()); player.SetMinion(pet, true); pet.SavePetToDB(PetSaveMode.AsCurrent); player.PetSpellInitialize(); return(true); }
public static void Main(string[] args) { string input = Console.ReadLine(); List <IIdentifiable> subjects = new List <IIdentifiable>(); List <Identity> subjectsWithId = new List <Identity>(); while (input != "End") { string[] partitions = input.Split(" ", StringSplitOptions.RemoveEmptyEntries); string type = partitions[0]; string name = partitions[1]; switch (type) { case "Citizen": int age = int.Parse(partitions[2]); string id = partitions[3]; DateTime birthDate = DateTime.ParseExact(partitions[4], "dd/MM/yyyy", null); Identity citizen = new Citizen(name, id, age, birthDate); subjectsWithId.Add(citizen); break; case "Pet": birthDate = DateTime.ParseExact(partitions[2], "dd/MM/yyyy", null); Identity pet = new Pet(name, birthDate); subjectsWithId.Add(pet); break; case "Robot": id = partitions[2]; IIdentifiable robot = new Robot(id, name); subjects.Add(robot); break; } input = Console.ReadLine(); } int year = int.Parse(Console.ReadLine()); List <DateTime> birthdates = new List <DateTime>(); foreach (var sub in subjectsWithId) { int currentYear = sub.BirthDate.Year; if (currentYear == year) { birthdates.Add(sub.BirthDate); } } foreach (var bDay in birthdates) { string date = $"{bDay.Day:d2}/{bDay.Month:d2}/{bDay.Year}"; Print(date); } }
public IList <ConsultationExam> ShowAll(Pet pet) { return(consultationExamDAL.ShowAll(pet)); }
public bool CreateNewPet(Pet newPet) { return(_PetRepo.CreateNewPet(newPet)); }
public void AddPet(Pet newPet) { MyLists.Pets.Add(newPet); }