Skip to content
This repository has been archived by the owner on Jun 18, 2023. It is now read-only.

Furtif/pogo-protos

 
 

Repository files navigation

pogo-protos Donate

Uses protobuf.js to compile the Protobuf files from POGOProtos into an easy to use Node module.

Test Build license

How to use

const POGOProtos = require('pogo-protos');

const nbPokemon = Object.keys(POGOProtos.Rpc.HoloPokemonId).length -1;
console.log(`We have ${nbPokemon} pokemons in protos.`);
const nbCostumes = Object.keys(POGOProtos.Rpc.PokemonDisplayProto.Costume).length -1;
console.log(`We have ${nbCostumes} costumes in protos.`);
const nbForms = Object.keys(POGOProtos.Rpc.PokemonDisplayProto.Form).length -1;
console.log(`We have ${nbForms} forms in protos.`);
const nbBadges = Object.keys(POGOProtos.Rpc.HoloBadgeType).length -1;
console.log(`We have ${nbBadges} badges in protos.`);
const nbMoves = Object.keys(POGOProtos.Rpc.HoloPokemonMove).length -1;
console.log(`We have ${nbMoves} moves in protos.`);
const nbItems = Object.keys(POGOProtos.Rpc.Item).length -1;
console.log(`We have ${nbItems} items in protos.`);
const nbMethodRequests = Object.keys(POGOProtos.Rpc.Method).length -1;
console.log(`We have ${nbMethodRequests} method requests in protos.`);
const nbSocialRequests = Object.keys(POGOProtos.Rpc.SocialAction).length -1;
console.log(`We have ${nbSocialRequests} social requests in protos.`);
const nbPlatformRequests = Object.keys(POGOProtos.Rpc.ClientAction).length -1;
console.log(`We have ${nbPlatformRequests} platform requests in protos.`);
const nbGameActionClientRequests = Object.keys(POGOProtos.Rpc.GameActionClient).length -1;
console.log(`We have ${nbGameActionClientRequests} game action client requests in protos.`);
const nbGameActionRequests = Object.keys(POGOProtos.Rpc.GameAction).length -1;
console.log(`We have ${nbGameActionRequests} game action requests in protos.`);
const nbGameAdventureSyncRequests = Object.keys(POGOProtos.Rpc.GameAdventureSyncAction).length -1;
console.log(`We have ${nbGameAdventureSyncRequests} game adventure sync requests in protos.`);
const nbPGameOthersRequests = Object.keys(POGOProtos.Rpc.GameOthersAction).length -1;
console.log(`We have ${nbPGameOthersRequests} game others requests in protos.`);
const nbPlayerSubmissionsRequests = Object.keys(POGOProtos.Rpc.PlayerSubmissionAction).length -1;
console.log(`We have ${nbPlayerSubmissionsRequests} Player Submissions requests in protos.`);
const nbGamefitnessRequests = Object.keys(POGOProtos.Rpc.GameFitnessAction).length -1;
console.log(`We have ${nbGamefitnessRequests} game fitness requests in protos.`);

// Count of all req's
const all_in_one = nbMethodRequests 
+ nbSocialRequests 
+ nbPlatformRequests 
+ nbGameActionClientRequests 
+ nbGameActionRequests 
+ nbGameAdventureSyncRequests 
+ nbPGameOthersRequests 
+ nbPlayerSubmissionsRequests 
+ nbGamefitnessRequests;

console.log(`We have ${all_in_one} (GLOBAL) multi method requests in protos.\n`);

var myMessage = POGOProtos.Rpc.RecycleItemProto.fromObject({
    item: POGOProtos.Rpc.Item.ITEM_POTION,
    count: 50
});
  
var encoded = POGOProtos.Rpc.RecycleItemProto.encode(myMessage).finish();
var decodedAgain = POGOProtos.Rpc.RecycleItemProto.decode(encoded);
console.log('Test encode/decode:\nItem: ' + decodedAgain.item + ' count: ' + decodedAgain.count);

// will print:
// We have x pokemons in protos.
// We have x costumes in protos.
// We have x forms in protos.
// We have x badges in protos.
// We have x moves in protos.
// We have x items in protos.
// We have x method requests in protos.
// We have x social requests in protos.
// We have x platform requests in protos.
// We have x game action client requests in protos.
// We have x game action requests in protos.
// We have x game adventure sync requests in protos.
// We have x game others requests in protos.
// We have x Player Submissions requests in protos.
// We have x game fitness requests in protos.
// We have x (GLOBAL) multi method requests in protos.

//Test encode/decode:
//Item: 101 count: 50

For more details see the protobuf.js documentation.

Usage with TypeScript

TypeScript definitions are included. Modern IDE should use them automatically.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%