mirror of
https://github.com/maierfelix/POGOserver.git
synced 2026-07-10 14:36:41 -05:00
- Lucky Egg working now
- Forgot to include the response.js now fixed
This commit is contained in:
parent
12d3333ad7
commit
1b2ba7c6c1
|
|
@ -30,9 +30,9 @@ export default class Info {
|
|||
this.levelReward = false;
|
||||
|
||||
this.kmWalked = 0;
|
||||
this.pkmnEncountered = 1;
|
||||
this.uniquePokedexEntries = 1;
|
||||
this.pkmnCaptured = 1;
|
||||
this.pkmnEncountered = 151;
|
||||
this.uniquePokedexEntries = 100;
|
||||
this.pkmnCaptured = 101;
|
||||
this.pokeStopVisits = 2;
|
||||
this.pokeballsThrown = 3;
|
||||
this.eggsHatched = 0;
|
||||
|
|
@ -41,6 +41,8 @@ export default class Info {
|
|||
|
||||
this.maxPkmnStorage = 250;
|
||||
this.maxItemStorage = 350;
|
||||
|
||||
this.LuckyEggExp = 0;
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -48,7 +50,7 @@ export default class Info {
|
|||
return (this._exp);
|
||||
}
|
||||
set exp(value) {
|
||||
this._exp = value;
|
||||
this._exp = value;
|
||||
this.updatePrevNextExp();
|
||||
}
|
||||
|
||||
|
|
@ -58,6 +60,7 @@ export default class Info {
|
|||
set level(value) {
|
||||
this._level = value;
|
||||
this.updatePrevNextExp();
|
||||
|
||||
}
|
||||
|
||||
get team() {
|
||||
|
|
@ -108,6 +111,8 @@ export default class Info {
|
|||
* @param {Number} exp
|
||||
*/
|
||||
upgradeExp(exp) {
|
||||
if(this.LuckyEggExp !=0 && this.LuckyEggExp > new Date() ){exp = exp*2;}
|
||||
print(exp);
|
||||
if (!this.maxLevelReached()) {
|
||||
let currentLevelExp = this.getLevelExp(this.level);
|
||||
let nextLevelExp = this.getLevelExp(this.level + 1);
|
||||
|
|
|
|||
|
|
@ -145,7 +145,7 @@ export default class Player extends MapObject {
|
|||
this.isIOS = sig.device_info.device_brand === "Apple";
|
||||
this.isAndroid = !this.isIOS;
|
||||
this.platform = this.isIOS ? "ios" : "android";
|
||||
print(`${this.email} is playing with an ${this.isIOS ? "Apple" : "Android"} device!`, 36);
|
||||
print(`${this.username} is playing with an ${this.isIOS ? "Apple" : "Android"} device!`, 36);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -210,6 +210,9 @@ export default class Player extends MapObject {
|
|||
case "USE_ITEM_REVIVE":
|
||||
resolve(this.UseRevive(msg));
|
||||
break;
|
||||
case "USE_ITEM_XP_BOOST":
|
||||
resolve(this.UseXpBoost(msg));
|
||||
break;
|
||||
};
|
||||
});
|
||||
}
|
||||
|
|
@ -325,14 +328,14 @@ export default class Player extends MapObject {
|
|||
* @param {String} ball
|
||||
*/
|
||||
catchPkmn(pkmn, ball) {
|
||||
this.info.exp += 100;
|
||||
let exp=100;
|
||||
if(this.info.LuckyEggExp !=0 && this.info.LuckyEggExp > new Date() ){exp = exp*2;}
|
||||
this.info.exp += exp;
|
||||
this.info.stardust += 100;
|
||||
this.info.pkmnCaptured += 1;
|
||||
this.currentEncounter = null;
|
||||
pkmn.caughtBy(this);
|
||||
pkmn.pokeball = ball;
|
||||
try{this.pokeDex.addEntry(pkmn.dexNumber,1,1);}
|
||||
catch(e){print(e,31);}
|
||||
return new Promise((resolve) => {
|
||||
pkmn.owner = this;
|
||||
pkmn.insertIntoDatabase().then((insertId) => {
|
||||
|
|
@ -350,7 +353,7 @@ export default class Player extends MapObject {
|
|||
captured_pokemon_id: pkmn.uid,
|
||||
capture_award: {
|
||||
activity_type: ["ACTIVITY_CATCH_POKEMON"],
|
||||
xp: [100],
|
||||
xp: [exp],
|
||||
candy: [3],
|
||||
stardust: [100]
|
||||
}
|
||||
|
|
|
|||
25
src/models/Player/packets/UseXpBoost.js
Normal file
25
src/models/Player/packets/UseXpBoost.js
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
import POGOProtos from "pokemongo-protobuf";
|
||||
import print from "../../../print";
|
||||
/**
|
||||
* @param {Object} msg
|
||||
* @return {Buffer}
|
||||
*/
|
||||
export default function UseXpBoost(msg) {
|
||||
let buffer = null;
|
||||
|
||||
buffer = { result: "SUCCESS",
|
||||
applied_items:{item:[
|
||||
{
|
||||
item_id: msg.item_id,
|
||||
item_type: "ITEM_TYPE_XP_BOOST",
|
||||
expire_ms: +new Date()+20000,//1800000 ,
|
||||
applied_ms:+new Date()
|
||||
}
|
||||
]}};
|
||||
this.removeItems({"301":1});
|
||||
this.info.LuckyEggExp = +new Date()+20000;
|
||||
return (
|
||||
POGOProtos.serialize(buffer, "POGOProtos.Networking.Responses.UseItemXpBoostResponse")
|
||||
);
|
||||
|
||||
}
|
||||
|
|
@ -15,4 +15,5 @@ export RecycleInventoryItem from "./RecycleInventoryItem";
|
|||
export ClaimCodename from "./ClaimCodename";
|
||||
export EvolvePokemon from "./EvolvePokemon";
|
||||
export UsePotion from "./UsePotion";
|
||||
export UseRevive from "./UseRevive";
|
||||
export UseRevive from "./UseRevive";
|
||||
export UseXpBoost from "./UseXpBoost";
|
||||
|
|
@ -15,11 +15,13 @@ export default function FortSearch(msg) {
|
|||
this.getFortDataById(msg.fort_id).then((fort) => {
|
||||
if (!fort) return void 0;
|
||||
player.consumeFortRewards(fort);
|
||||
let exp = fort.experience;
|
||||
// TODO: disable rewarding when on cooldown
|
||||
let buffer = ({
|
||||
if(player.info.LuckyEggExp !=0 && player.info.LuckyEggExp > new Date() ){exp = exp*2;}
|
||||
let buffer = ({
|
||||
result: "SUCCESS",
|
||||
items_awarded: fort.serializeRewards(),
|
||||
experience_awarded: fort.experience,
|
||||
experience_awarded: exp,
|
||||
cooldown_complete_timestamp_ms: +new Date() + fort.cooldown,
|
||||
chain_hack_sequence_number: 2
|
||||
});
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ export function parseMessage(req, type) {
|
|||
let proto = `POGOProtos.Networking.Requests.Messages.${type}Message`;
|
||||
if (req.request_message) {
|
||||
try {
|
||||
|
||||
return (this.parseProtobuf(req.request_message, proto));
|
||||
} catch (e) {
|
||||
print(`Failed to parse ${type}: ${e}`, 31);
|
||||
|
|
@ -53,6 +54,10 @@ export function processResponse(player, req) {
|
|||
case "CHECK_AWARDED_BADGES":
|
||||
case "SET_FAVORITE_POKEMON":
|
||||
case "RECYCLE_INVENTORY_ITEM":
|
||||
case "EVOLVE_POKEMON":
|
||||
case "USE_ITEM_POTION":
|
||||
case "USE_ITEM_REVIVE":
|
||||
case "USE_ITEM_XP_BOOST":
|
||||
player.getPacket(req.request_type, msg).then((result) => {
|
||||
resolve(result);
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user