- Updated client version
- Updated NearbyPokemon proto
- Added Encounter, NicknamePokemon, UpgradePokemon, EvolvePokemon,
SetFavoritePokemon responses
This commit is contained in:
Felix 2016-08-10 21:48:41 +02:00
parent 5728d47098
commit 58fd8fb227
16 changed files with 304 additions and 118 deletions

View File

@ -4,7 +4,9 @@ package POGOProtos.Map.Pokemon;
import "POGOProtos/Enums/PokemonId.proto";
message NearbyPokemon {
.POGOProtos.Enums.PokemonId pokemon_id = 1;
float distance_in_meters = 2;
fixed64 encounter_id = 3;
}
.POGOProtos.Enums.PokemonId pokemon_id = 1;
float distance_in_meters = 2;
fixed64 encounter_id = 3;
string fort_id = 4;
string fort_image_url = 5;
}

4
cfg.js
View File

@ -2,7 +2,7 @@ export const SERVER_PORT = 3000;
export const SERVER_HOST_IP = "127.0.0.1";
export const SERVER_GAME_MODE = 0;
export const SERVER_TICK_INTERVAL = 1; // better dont change
export const SERVER_SAVE_INTERVAL = 120000; // all 120s
export const SERVER_SAVE_INTERVAL = 1e3 * 60; // 1min
export const SERVER_MAX_CONNECTIONS = 64;
export const SERVER_PLAYER_CONNECTION_TIMEOUT = 1e3 * 60 * 30; // 30min
@ -10,7 +10,7 @@ export const SERVER_DEFAULT_CONSOLE_COLOR = 32;
export const ASSET_DIGEST_PATH = "asset_digest";
export const MINIMUM_CLIENT_VERSION = "0.31.0";
export const MINIMUM_CLIENT_VERSION = "0.33.0";
export const SERVER_MONGO_PORT = 27017;
export const SERVER_MONGO_HOST_IP = "localhost";

View File

@ -16,14 +16,14 @@ export default function DownloadSettings(obj) {
interaction_range_meters: 40,
max_total_deployed_pokemon: 10,
max_player_deployed_pokemon: 1,
deploy_stamina_multiplier: 500,
deploy_stamina_multiplier: 2,
far_interaction_range_meters: 1000
}),
map_settings: new proto.Settings.MapSettings({
pokemon_visible_range: 70,
poke_nav_range_meters: 201,
poke_nav_range_meters: 751,
encounter_range_meters: 50,
get_map_objects_min_refresh_seconds: 5,
get_map_objects_min_refresh_seconds: 10,
get_map_objects_max_refresh_seconds: 30,
get_map_objects_min_distance_meters: 10,
google_maps_api_key: CFG.SERVER_GMAPS_API_KEY
@ -33,11 +33,11 @@ export default function DownloadSettings(obj) {
max_bag_items: 1000,
base_pokemon: 250,
base_bag_items: 350,
base_eggs: 1000
base_eggs: 9
}),
minimum_client_version: CFG.MINIMUM_CLIENT_VERSION
})
}).encode()
);
}
}

View File

@ -0,0 +1,57 @@
import * as CFG from "../../cfg";
import proto from "../proto";
import { decodeLong } from "../utils";
/**
* @param {Request} req
* @return {Object}
*/
export default function Encounter(req) {
let data = proto.Networking.Requests.Messages.EncounterMessage.decode(req.request_message.toBuffer());
let encounter_id = decodeLong(
data.encounter_id.high, data.encounter_id.low, data.encounter_id.unsigned
);
return (
new proto.Networking.Responses.EncounterResponse({
wild_pokemon: new proto.Map.Pokemon.WildPokemon({
encounter_id: 11810991820755313517,
last_modified_timestamp_ms: 1470787552996,
latitude: 39.19047143172622,
longitude: -96.58502161502839,
spawn_point_id: "87bdd289c69",
pokemon_data: new proto.Data.PokemonData({
pokemon_id: 19,
cp: 277,
stamina: 41,
stamina_max: 41,
move_1: 221,
move_2: 26,
height_m: 0.22802678267819977,
weight_kg: 1.3452539511871338,
individual_attack: 9,
individual_defense: 13,
individual_stamina: 14,
cp_multiplier: 0.5663545199394226
}),
time_till_hidden_ms: 730176
}),
background: proto.Networking.Responses.EncounterResponse.Background.PARK,
status: proto.Networking.Responses.EncounterResponse.Status.ENCOUNTER_SUCCESS,
capture_probability: new proto.Data.Capture.CaptureProbability({
pokeball_type: [1, 2, 3],
capture_probability: [
0.352886438369751,
0.47944003343582153,
0.5812440514564514
],
reticle_difficulty_scale: 2
})
}).encode()
);
}

View File

@ -0,0 +1,22 @@
import * as CFG from "../../cfg";
import proto from "../proto";
/**
* @param {Request} req
* @return {Object}
*/
export default function EvolvePokemon(req) {
let data = proto.Networking.Requests.Messages.EvolvePokemonMessage.decode(req.request_message.toBuffer());
return (
new proto.Networking.Responses.EvolvePokemonResponse({
result: proto.Networking.Responses.EvolvePokemonResponse.Result.FAILED_POKEMON_CANNOT_EVOLVE,
evolved_pokemon_data: null,
experience_awarded: 0,
candy_awarded: 0
}).encode()
);
}

View File

@ -3,18 +3,36 @@ import * as CFG from "../../cfg";
import proto from "../proto";
/**
* @param {Object} obj
* @param {Request} req
* @return {Object}
*/
export default function FortDetails(obj) {
export default function FortDetails(req) {
let data = proto.Networking.Requests.Messages.FortDetailsMessage.decode(req.request_message.toBuffer());
return (
new proto.Networking.Responses.FortDetailsResponse({
fort_id: "cbb56441628d4a4d88f1c00b5b545684.16",
name: "Bauer Vom Lande",
image_urls: ["http://lh3.ggpht.com/Pu8QxppOJjm3gNI8wO_--2CcyXmfeOH8CTb3DionlzCpo7stk3pjlV_c9-kMakhtFyygN62WuNJaTsIiTw334UVmHZgEXDCj"],
type: proto.Map.Fort.FortType.CHECKPOINT,
description: "meow!"
new proto.Networking.Responses.FortDetailsResponse({
"fort_id": data.fort_id,
"team_color": 0,
"pokemon_data": null,
"name": "POGOserver v0.2.0",
"description": "Weird species below",
"image_urls": [
"http://thecatapi.com/api/images/get?format=src&type=png"
],
"fp": 0,
"stamina": 0,
"max_stamina": 0,
"type": 1,
"latitude": data.latitude,
"longitude": data.longitude,
"modifiers": [
new proto.Map.Fort.FortModifier({
item_id: proto.Inventory.Item.ItemId.ITEM_TROY_DISK,
expiration_timestamp_ms: (new Date().getTime() + 1e3) * 1e3,
deployer_player_codename: "The Big Lebowski"
})
]
}).encode()
);

View File

@ -13,17 +13,17 @@ export default function FortSearch(obj) {
result: proto.Networking.Responses.FortSearchResponse.Result.SUCCESS,
items_awarded: [
new proto.Inventory.Item.ItemAward({
item_id: proto.Inventory.Item.ItemId.ITEM_ULTRA_BALL,
item_count: 1
item_id: proto.Inventory.Item.ItemId.ITEM_MASTER_BALL,
item_count: 3
}),
new proto.Inventory.Item.ItemAward({
item_id: proto.Inventory.Item.ItemId.ITEM_GREAT_BALL,
item_id: proto.Inventory.Item.ItemId.ITEM_ULTRA_BALL,
item_count: 2
})
],
gems_awarded: 0,
pokemon_data_egg: null,
experience_awarded: 100,
experience_awarded: 99999,
cooldown_complete_timestamp_ms: 1470174535972,
chain_hack_sequence_number: 0
}).encode()

View File

@ -6,6 +6,8 @@ import proto from "../proto";
*/
export default function GetInventoryData(obj) {
// TODO: Start loading pkmn party from db
return (
new proto.Networking.Responses.GetInventoryResponse({
success: true,
@ -15,7 +17,7 @@ export default function GetInventoryData(obj) {
new proto.Inventory.InventoryItem({
inventory_item_data: new proto.Inventory.InventoryItemData({
"player_stats": new proto.Data.Player.PlayerStats({
"level": 3,
"level": 98,
"experience": 2000,
"prev_level_xp": 1000,
"next_level_xp": 6000,
@ -82,35 +84,24 @@ export default function GetInventoryData(obj) {
new proto.Inventory.InventoryItem({
inventory_item_data: new proto.Inventory.InventoryItemData({
"pokemon_data": new proto.Data.PokemonData({
"id": 151,
"pokemon_id": 151,
"cp": 9454,
"stamina": 53,
"stamina_max": 53,
"move_1": 221,
"move_2": 80,
"deployed_fort_id": "",
"owner_name": "",
"is_egg": false,
"egg_km_walked_target": 0,
"egg_km_walked_start": 0,
"origin": 0,
"height_m": 0.3461824357509613,
"weight_kg": 2.0753486156463623,
"individual_attack": 2,
"individual_defense": 0,
"individual_stamina": 9,
"cp_multiplier": 0.5974000096321106,
"pokeball": 2,
"battles_attacked": 0,
"battles_defended": 0,
"egg_incubator_id": "",
"creation_time_ms": new Date().getTime() * 1000,
"num_upgrades": 0,
"additional_cp_multiplier": 0,
"favorite": 0,
"nickname": "Ad°0lf_fH$TL3R",
"from_fort": 0
pokemon_id: 19,
cp: 277,
stamina: 41,
stamina_max: 41,
move_1: 221,
move_2: 26,
height_m: 0.22802678267819977,
weight_kg: 1.3452539511871338,
individual_attack: 9,
individual_defense: 13,
individual_stamina: 14,
cp_multiplier: 0.5663545199394226,
additional_cp_multiplier: 0,
favorite: 0,
nickname: "BauerVomLande",
owner_name: "Administrator",
origin: 0,
is_egg: false
})
})
})

View File

@ -10,75 +10,82 @@ export default function GetMapObjects(request) {
var cellsRes = [];
cells.forEach((cell)=>{
cells.forEach((cell) => {
cellsRes.push(new proto.Map.MapCell({
s2_cell_id: cell,
current_timestamp_ms: new Date().getTime() * 1000,
forts: [
new proto.Map.Fort.FortData({
id: "wuff",
last_modified_timestamp_ms: new Date().getTime() * 1000,
latitude: 39.19047143172651,
longitude: -96.58502161502833,
owned_by_team: 2,
guard_pokemon_id: 150,
guard_pokemon_cp: 2000,
gym_points: 1000,
is_in_battle: false,
enabled: true,
type: proto.Map.Fort.FortType.CHECKPOINT,
sponsor: proto.Map.Fort.FortSponsor.MCDONALDS,
rendering_type: proto.Map.Fort.FortRenderingType.DEFAULT
})
],
current_timestamp_ms: new Date().getTime() * 1e3,
forts: [],
spawn_points: [],
deleted_objects: [ ],
deleted_objects: [],
is_truncated_list: false,
fort_summaries: [ ],
decimated_spawn_points: [ ],
wild_pokemons: [
new proto.Map.Pokemon.WildPokemon({
encounter_id: 6180230722423979422,
last_modified_timestamp_ms: new Date().getTime() * 1e3,
latitude: 39.19047143172621,
longitude: -96.58502161502838,
spawn_point_id: "",
pokemon_data: new proto.Data.PokemonData({
"move_1": 211,
"move_2": 45,
"pokemon_id": 21,
"height_m": 0.2640344202518463,
"stamina_max": 14,
"weight_kg": 1.2240252494812012,
"individual_defense": 8,
"stamina": 14,
"individual_stamina": 10,
"individual_attack": 12,
"cp": 27
}),
time_till_hidden_ms: 597695
})
],
catchable_pokemons: [
new proto.Map.Pokemon.MapPokemon({
spawn_point_id: "",
encounter_id: 6180230722423979422,
pokemon_id: proto.Enums.PokemonId.SPEAROW,
expiration_timestamp_ms: (new Date().getTime() + 1e6) * 1e3,
latitude: 39.19047143172621,
longitude: -96.58502161502838
})
],
nearby_pokemons: [
new proto.Map.Pokemon.NearbyPokemon({
pokemon_id: proto.Enums.PokemonId.SPEAROW,
distance_in_meters: 1.0,
encounter_id: 6180230722423979422
})
]
fort_summaries: [],
decimated_spawn_points: [],
wild_pokemons: [],
catchable_pokemons: [],
nearby_pokemons: []
}));
});
let cell = cellsRes[cellsRes.length - 1];
cellsRes[cellsRes.length - 2].forts = [
new proto.Map.Fort.FortData({
id: "roflcopter",
last_modified_timestamp_ms: 1470787552992,
//latitude: 39.1914,
//longitude: -96.5850,
latitude: 39.19047143172622,
longitude: -96.58502161502839,
enabled: true,
type: proto.Map.Fort.FortType.CHECKPOINT,
cooldown_complete_timestamp_ms: new Date().getTime(),
sponsor: proto.Map.Fort.FortSponsor.UNSET_SPONSOR
})
];
cell.wild_pokemons = [
new proto.Map.Pokemon.WildPokemon({
encounter_id: 11810991820755313517,
last_modified_timestamp_ms: 1470787552996,
latitude: 39.19047143172622,
longitude: -96.58502161502839,
spawn_point_id: "87bdd289c69",
pokemon_data: new proto.Data.PokemonData({
pokemon_id: 19,
cp: 277,
stamina: 41,
stamina_max: 41,
move_1: 221,
move_2: 26,
height_m: 0.22802678267819977,
weight_kg: 1.3452539511871338,
individual_attack: 9,
individual_defense: 13,
individual_stamina: 14,
cp_multiplier: 0.5663545199394226
}),
time_till_hidden_ms: 730176
})
];
cell.catchable_pokemons = [
new proto.Map.Pokemon.MapPokemon({
spawn_point_id: "87bdd289c69",
encounter_id: 11810991820755313517,
pokemon_id: 19,
latitude: 39.19047143172622,
longitude: -96.58502161502839,
expiration_timestamp_ms: (new Date().getTime() + 1e6) * 1e3
})
];
cell.nearby_pokemons = [
new proto.Map.Pokemon.NearbyPokemon({
distance_in_meters: 200.0,
pokemon_id: 19
})
];
return (
new proto.Networking.Responses.GetMapObjectsResponse({
status: 1,

View File

@ -0,0 +1,21 @@
import * as CFG from "../../cfg";
import proto from "../proto";
/**
* @param {Request} req
* @return {Object}
*/
export default function NicknamePokemon(req) {
let data = proto.Networking.Requests.Messages.NicknamePokemonMessage.decode(req.request_message.toBuffer());
// TODO: Save nickname into db
return (
new proto.Networking.Responses.NicknamePokemonResponse({
result: proto.Networking.Responses.NicknamePokemonResponse.Result.ERROR_INVALID_NICKNAME
}).encode()
);
}

View File

@ -0,0 +1,21 @@
import * as CFG from "../../cfg";
import proto from "../proto";
/**
* @param {Request} req
* @return {Object}
*/
export default function SetFavoritePokemon(req) {
let data = proto.Networking.Requests.Messages.SetFavoritePokemonMessage.decode(req.request_message.toBuffer());
console.log(data);
// TODO: save into db
return (
new proto.Networking.Responses.SetFavoritePokemonResponse({
result: proto.Networking.Responses.SetFavoritePokemonResponse.Result.ERROR_POKEMON_NOT_FOUND
}).encode()
);
}

View File

@ -0,0 +1,20 @@
import * as CFG from "../../cfg";
import proto from "../proto";
/**
* @param {Request} req
* @return {Object}
*/
export default function UpgradePokemon(req) {
let data = proto.Networking.Requests.Messages.UpgradePokemonMessage.decode(req.request_message.toBuffer());
return (
new proto.Networking.Responses.UpgradePokemonResponse({
result: proto.Networking.Responses.UpgradePokemonResponse.Result.ERROR_UPGRADE_NOT_AVAILABLE,
upgraded_pokemon: null
}).encode()
);
}

View File

@ -25,6 +25,12 @@ export SetAvatar from "./Responses.SetAvatar";
export SfidaActionLog from "./Responses.SfidaActionLog";
export Encounter from "./Responses.Encounter";
export NicknamePokemon from "./Responses.NicknamePokemon";
export UpgradePokemon from "./Responses.UpgradePokemon";
export EvolvePokemon from "./Responses.EvolvePokemon";
export SetFavoritePokemon from "./Responses.SetFavoritePokemon";
export AuthTicket from "./Envelopes.AuthTicket";
export ResponseEnvelope from "./Envelopes.ResponseEnvelope";
export ResponseEnvelopeAuth from "./Envelopes.ResponseEnvelope.Auth";

View File

@ -20,7 +20,7 @@ class Player {
this.uid = -1;
this.email = null;
this._username = "undefined";
this._username = "Administrator";
this.position = {
latitude: 0,

View File

@ -39,6 +39,7 @@ export function authenticatePlayer() {
this.print(`${player.email.replace("@gmail.com", "")} connected!`, 36);
}
else {
this.print("Invalid authentication token! Kicking..", 31);
this.removePlayer(player);
return void 0;
}

View File

@ -21,7 +21,12 @@ import {
SetContactSettings,
SetAvatar,
MarkTutorialComplete,
LevelUpRewards
LevelUpRewards,
Encounter,
NicknamePokemon,
UpgradePokemon,
EvolvePokemon,
SetFavoritePokemon
} from "./packets";
/**
@ -88,7 +93,7 @@ export function processResponse(request) {
buffer = LevelUpRewards();
break;
case REQUEST.FORT_DETAILS:
buffer = FortDetails();
buffer = FortDetails(request);
break;
case REQUEST.FORT_SEARCH:
buffer = FortSearch();
@ -98,6 +103,21 @@ export function processResponse(request) {
buffer = SetContactSettings(player);
this.savePlayer(player);
break;
case REQUEST.ENCOUNTER:
buffer = Encounter(request);
break;
case REQUEST.NICKNAME_POKEMON:
buffer = NicknamePokemon(request);
break;
case REQUEST.UPGRADE_POKEMON:
buffer = UpgradePokemon(request);
break;
case REQUEST.EVOLVE_POKEMON:
buffer = EvolvePokemon(request);
break;
case REQUEST.SET_FAVORITE_POKEMON:
buffer = SetFavoritePokemon(request);
break;
default:
this.print(`Unknown request: ${this.getRequestType(request)}`, 31);
break;