public async Task <SetFavoritePokemonResponse> SetFavoritePokemon(ulong pokemonId, bool isFavorite) { var message = new SetFavoritePokemonMessage { PokemonId = (long)pokemonId, IsFavorite = isFavorite }; return(await PostProtoPayload <Request, SetFavoritePokemonResponse>(RequestType.SetFavoritePokemon, message)); }
public SetFavoritePokemonResponse SetFavoritePokemon(long pokemonId, bool isFavorite) { var message = new SetFavoritePokemonMessage() { PokemonId = pokemonId, IsFavorite = isFavorite }; return(PostProtoPayload <Request, SetFavoritePokemonResponse>(RequestType.SetFavoritePokemon, message)); }
/// <summary> /// /// </summary> /// <param name="pokemonId"></param> /// <param name="isFavorite"></param> /// <returns></returns> public bool QueueSetFavoritePokemonRequest(long pokemonId, bool isFavorite) { var message = new SetFavoritePokemonMessage { PokemonId = pokemonId, IsFavorite = isFavorite }; return(Client.QueueRequest(RequestType.SetFavoritePokemon, message)); }
protected ByteString GetPlayerPacket(RequestType typ, object msg) { switch (typ) { case RequestType.SetFavoritePokemon: SetFavoritePokemonResponse sfp = new SetFavoritePokemonResponse(); SetFavoritePokemonMessage m = (SetFavoritePokemonMessage)msg; var owned = this.GetPokemonById((ulong)m.PokemonId); if (owned != null) { m.IsFavorite = true; owned.favorite = true; this.Database.OwnedPokemons.Update(owned); sfp.Result = SetFavoritePokemonResponse.Types.Result.Success; } else { sfp.Result = SetFavoritePokemonResponse.Types.Result.ErrorPokemonNotFound; } //this.Log.Dbg($"TypeOfResponseMessage: {nameof(SetFavoritePokemonResponse)}"); return(sfp.ToByteString()); case RequestType.LevelUpRewards: LevelUpRewardsResponse lur = new LevelUpRewardsResponse(); lur.Result = LevelUpRewardsResponse.Types.Result.Success; lur.ItemsAwarded.AddRange(new RepeatedField <ItemAward>() { new ItemAward() { ItemId = ItemId.ItemPokeBall, ItemCount = 2 }, new ItemAward() { ItemId = ItemId.ItemTroyDisk, ItemCount = 2 } }); //this.Log.Dbg($"TypeOfResponseMessage: {nameof(LevelUpRewardsResponse)}"); return(lur.ToByteString()); case RequestType.ReleasePokemon: ReleasePokemonResponse rp = this.ReleasePokemon((ReleasePokemonMessage)msg); //this.Log.Dbg($"TypeOfResponseMessage: {nameof(ReleasePokemonResponse)}"); return(rp.ToByteString()); case RequestType.UpgradePokemon: UpgradePokemonResponse up = new UpgradePokemonResponse(); //UpgradePokemonMessage upm = (UpgradePokemonMessage)msg; //var uptpkmn = brc.GetPokemonById(upm.PokemonId); //if (uptpkmn!=null) //{ //} //else //{ // up.Result = UpgradePokemonResponse.Types.Result.ErrorPokemonNotFound; //} //this.Log.Dbg($"TypeOfResponseMessage: {nameof(UpgradePokemonResponse)}"); return(up.ToByteString()); //https://github.com/msx752/PoGoEmulator/issues/24 case RequestType.GetPlayerProfile: GetPlayerProfileResponse gpp = new GetPlayerProfileResponse(); gpp.Result = GetPlayerProfileResponse.Types.Result.Success; gpp.StartTime = (long)DateTime.Now.ToUnixTime(); gpp.Badges.Add(new POGOProtos.Data.PlayerBadge() { BadgeType = BadgeType.BadgeTravelKm, EndValue = 2674, CurrentValue = 1337 }); return(gpp.ToByteString()); //case RequestType.SetAvatar: // LevelUpRewardsResponse sa = new LevelUpRewardsResponse(); // return sa.ToByteString(); case RequestType.GetPlayer: //this.Log.Dbg($"TypeOfResponseMessage: {nameof(GetPlayerResponse)}"); return(this.GetPlayer()); case RequestType.GetInventory: RepeatedField <InventoryItem> items = new RepeatedField <InventoryItem>(); //ADD ITEMSS GetInventoryResponse gi = new GetInventoryResponse(); gi.Success = true; gi.InventoryDelta = new POGOProtos.Inventory.InventoryDelta() { NewTimestampMs = (long)DateTime.Now.ToUnixTime() }; gi.InventoryDelta.InventoryItems.AddRange(items); //this.Log.Dbg($"TypeOfResponseMessage: {nameof(GetInventoryResponse)}"); return(gi.ToByteString()); case RequestType.GetAssetDigest: var gad = GlobalSettings.GameAssets[this.CurrentPlayer.Platform].Value; //this.Log.Dbg($"TypeOfResponseMessage: {nameof(GetAssetDigestResponse)}"); return(gad.ToByteString()); //case RequestType.NicknamePokemon: // LevelUpRewardsResponse np = new LevelUpRewardsResponse(); // return np.ToByteString(); case RequestType.GetHatchedEggs: GetHatchedEggsResponse ghe = new GetHatchedEggsResponse(); ghe.Success = true; //this.Log.Dbg($"TypeOfResponseMessage: {nameof(GetHatchedEggsResponse)}"); return(ghe.ToByteString()); case RequestType.CheckAwardedBadges: CheckAwardedBadgesResponse cab = new CheckAwardedBadgesResponse(); cab.Success = true; //this.Log.Dbg($"TypeOfResponseMessage: {nameof(CheckAwardedBadgesResponse)}"); return(cab.ToByteString()); //case RequestType.RecycleInventoryItem: // LevelUpRewardsResponse rii = new LevelUpRewardsResponse(); // return rii.ToByteString(); //case RequestType.ClaimCodename: // LevelUpRewardsResponse cc = new LevelUpRewardsResponse(); // return cc.ToByteString(); default: throw new Exception($"unknown (Player) Returns type: {typ}"); } }
public async Task<SetFavoritePokemonResponse> SetFavoritePokemon(ulong pokemonId, bool isFavorite) { var message = new SetFavoritePokemonMessage() { PokemonId = pokemonId, IsFavorite = isFavorite }; return await PostProtoPayload<Request, SetFavoritePokemonResponse>(RequestType.SetFavoritePokemon, message); }