Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
6807a49
Merge pull request #1 from Silv3rPRO/master
IamSanjid Apr 22, 2018
4b7a4df
Merge pull request #2 from Silv3rPRO/master
IamSanjid Apr 24, 2018
b5d9af2
Merge pull request #3 from Silv3rPRO/master
IamSanjid Nov 18, 2018
cef4f69
Fixed an issue with Map Server Connection
IamSanjid Nov 18, 2018
095a4b0
Merge pull request #4 from Silv3rPRO/master
IamSanjid Nov 26, 2018
bcb508d
Fixed crash when opening Shop
IamSanjid Nov 26, 2018
c03c904
beta3
DubsCheckum Apr 7, 2019
d5989eb
Map data and better NPC data
DubsCheckum Apr 9, 2019
46547de
beta4
DubsCheckum Apr 9, 2019
6c075eb
simplify this function
DubsCheckum Apr 10, 2019
90ab157
shop fix
DubsCheckum Apr 10, 2019
0824b47
update version to Easter2019
DubsCheckum May 18, 2019
c58012c
beta5
DubsCheckum May 19, 2019
a12d1fa
add animated battle sprites (ty zonz)
DubsCheckum May 20, 2019
d200305
Fix outdated pokemon data
DubsCheckum May 28, 2019
2836405
Log dialog options
DubsCheckum May 28, 2019
9be0340
Add Explore Script button
DubsCheckum May 29, 2019
71d77e5
Bump to DubsCheckum beta5
IamSanjid Dec 10, 2019
ce9032e
New Beta6 and Xmas19 Update
IamSanjid Dec 10, 2019
2850bb0
Merge branch 'master' into master
IamSanjid Dec 10, 2019
99b5b26
Merge pull request #2 from IamSanjid/master
DubsCheckum Dec 10, 2019
5504642
Fixing NPC ID
IamSanjid Dec 11, 2019
3abba92
Handles automatically movement data
IamSanjid Dec 11, 2019
b3a43c7
Merge pull request #4 from IamSanjid/master
DubsCheckum Dec 11, 2019
2d1117e
Shop issue fixed
IamSanjid Dec 12, 2019
f492be8
Merge pull request #5 from IamSanjid/master
DubsCheckum Dec 12, 2019
846c66d
beta6- some more updates(Evolving, Relog, SetMount)
IamSanjid Dec 12, 2019
0b7dec8
Making relog start delay more cleaner
IamSanjid Dec 12, 2019
f2781ad
Merge pull request #6 from IamSanjid/master
DubsCheckum Dec 12, 2019
ebfc6ba
Fixed a mistake of setting mounts
IamSanjid Dec 12, 2019
2badb1a
Fixed another mistake
IamSanjid Dec 12, 2019
ffdd533
Update GameClient.cs
IamSanjid Dec 12, 2019
72315d6
Merge pull request #7 from IamSanjid/patch-1
DubsCheckum Dec 12, 2019
6ef8830
Merge pull request #5 from IamSanjid/patch-1
IamSanjid Dec 12, 2019
4dd9d1b
stuff
fourst4r Dec 12, 2019
8801fe4
Merge pull request #6 from DubsCheckum/master
IamSanjid Dec 12, 2019
1e9b9b8
beta6 - fixe move learning stuff
IamSanjid Dec 13, 2019
50274a7
Merge pull request #8 from IamSanjid/master
DubsCheckum Dec 13, 2019
9ae1078
Fixed relog issue
IamSanjid Dec 13, 2019
5ab141a
beta6 - map server issue fixed
IamSanjid Dec 13, 2019
aa15e0d
Merge pull request #10 from IamSanjid/master
DubsCheckum Dec 13, 2019
34f2135
fix typo
DubsCheckum Dec 14, 2019
0f14aee
beta6 - some more packet updates
IamSanjid Dec 14, 2019
ceac1cd
Merge pull request #11 from IamSanjid/master
DubsCheckum Dec 14, 2019
0ebdf4c
beta6 - Updated more stuff (Evolving stuff, Guild data request)
IamSanjid Dec 19, 2019
f74ec9a
Merge pull request #12 from IamSanjid/master
DubsCheckum Dec 19, 2019
54b3a62
Merge branch 'master' of https://github.com/DubsCheckum/proshine
DubsCheckum Dec 19, 2019
5c3662a
load abilities and moves from file
DubsCheckum Dec 21, 2019
6e37943
Merge pull request #7 from DubsCheckum/master
IamSanjid Dec 21, 2019
35f3cf6
load pokedex info from file
DubsCheckum Dec 21, 2019
d0b4a05
Merge pull request #8 from DubsCheckum/master
IamSanjid Dec 21, 2019
6bdb6af
Add resource files...
IamSanjid Dec 21, 2019
592cf18
Update Items.json
IamSanjid Dec 21, 2019
7511743
Merge pull request #14 from IamSanjid/master
DubsCheckum Dec 22, 2019
222aa25
bump version
DubsCheckum Dec 22, 2019
7f5de64
whoops inverted move status
DubsCheckum Dec 22, 2019
ed52fb3
Merge pull request #9 from DubsCheckum/master
IamSanjid Dec 26, 2019
e7992fe
Update Npc.cs
IamSanjid Jan 4, 2020
ef98443
Update GameClient.cs
IamSanjid Jan 4, 2020
99aa0c5
Merge pull request #15 from IamSanjid/master
DubsCheckum Jan 4, 2020
3e505bf
Update XorEncryption.cs
IamSanjid Jan 4, 2020
859388a
Clearing Code
IamSanjid Jan 4, 2020
ad2f9ab
Code Cleanup
IamSanjid Jan 4, 2020
673d120
Create Pro-Shine_Documentation_by_George_Malachias.doc
gmalachias Jan 19, 2020
71e1fba
Create Pro-Shine_Documentation_by_George_Malachias.md
gmalachias Jan 19, 2020
b3950bb
Merge pull request #16 from gmalachias/master
DubsCheckum Jan 19, 2020
dd3c276
Updated for PRO Version Spring20
IamSanjid May 12, 2020
fe4a19e
Few simple changes
IamSanjid May 13, 2020
f396bd6
Merge pull request #17 from IamSanjid/master
DubsCheckum May 13, 2020
db58790
Important Fix
IamSanjid May 13, 2020
b613b7b
added ability to enable or disable npc interaction
IamSanjid May 16, 2020
f1842d4
Merge pull request #18 from IamSanjid/master
IamSanjid May 17, 2020
6dac45a
Some old updates
IamSanjid Sep 4, 2021
af9a508
Tried to follow the clients method to send heart beats
IamSanjid Sep 5, 2021
3ee9bac
works for version Christmas_21
IamSanjid Dec 5, 2021
ed45d21
fixed an issue with the items which effects moves(restores PP)
IamSanjid Dec 15, 2021
a52a0a5
changed encoding and few other changes
IamSanjid Dec 22, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions PROBot/BattleAI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public int UsablePokemonsCount
return usablePokemons;
}
}

public bool UseMandatoryAction()
{
return RepeatAttack();
Expand Down Expand Up @@ -152,10 +153,10 @@ public bool UseMove(string moveName)
return false;
}

public bool UseItem(int itemId, int pokemonUid = 0)
public bool UseItem(int itemId, int pokemonUid = 0, int moveIndex = 0)
{
if (ActivePokemon.CurrentHealth == 0) return false;
_client.UseItem(itemId, pokemonUid);
_client.UseItem(itemId, pokemonUid, moveIndex);
return true;
}

Expand Down Expand Up @@ -237,6 +238,12 @@ private bool UseAttack(bool useBestAttack)
}
}

if (move.Id == DragonRage)
{
if (opponentType1 == PokemonType.Fairy || opponentType2 == PokemonType.Fairy)
power = 0;
}

if (power < 0.01) continue;

if (bestMove == null || power > bestPower)
Expand Down
41 changes: 27 additions & 14 deletions PROBot/BotClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace PROBot
{
Expand Down Expand Up @@ -46,6 +47,7 @@ public enum State
public Dictionary<int, TextOption> TextOptions { get; set; }

private bool _loginRequested;
private bool _authenticationRequired;

private Timeout _actionTimeout = new Timeout();

Expand Down Expand Up @@ -161,6 +163,8 @@ private void LoginUpdate()
{
client = new GameClient(new GameConnection(server), new MapConnection());
}

Encryption.Reset();
SetClient(client);
client.Open();
}
Expand All @@ -176,6 +180,19 @@ public void Logout(bool allowAutoReconnect)

public void Update()
{
if (_authenticationRequired)
{
if (Encryption.StateReady)
{
// TODO: Add an option to select the OS we want, it could be useful.
Game.SendAuthentication(Account.Name,
Account.Password,
Account.DeviceId ?? Hardware.GenerateRandomHash(),
Hardware.GenerateRandomOsInfo());
_authenticationRequired = false;
}
return;
}
AutoReconnector.Update();

if (_loginRequested)
Expand All @@ -198,7 +215,7 @@ public void Update()
if (Game.IsCreatingNewCharacter)
{
LogMessage("Creating a new character with a random skin...");
Game.CreateCharacter(Rand.Next(14), Rand.Next(28), Rand.Next(8), Rand.Next(6), Rand.Next(5));
Game.CreateCharacter(Rand.Next(14), Rand.Next(28), Rand.Next(4), 695 + Rand.Next(6), Rand.Next(5));
return;
}

Expand Down Expand Up @@ -261,17 +278,13 @@ public void LoadScript(string filename)
{
string input = File.ReadAllText(filename);

List<string> libs = new List<string>();
var libs = new List<string>();
if (Directory.Exists("Libs"))
{
string[] files = Directory.GetFiles("Libs");
foreach (string file in files)
{
if (file.ToUpperInvariant().EndsWith(".LUA"))
{
libs.Add(File.ReadAllText(file));
}
}
libs = Directory.GetFiles("Libs")
.Where(f => f.EndsWith(".lua", StringComparison.InvariantCultureIgnoreCase))
.Select(File.ReadAllText)
.ToList();
}

BaseScript script = new LuaScript(this, Path.GetFullPath(filename), input, libs);
Expand All @@ -283,10 +296,10 @@ public void LoadScript(string filename)
Script.ScriptMessage += Script_ScriptMessage;
Script.Initialize();
}
catch (Exception ex)
catch (Exception)
{
Script = null;
throw ex;
throw;
}
}

Expand Down Expand Up @@ -402,7 +415,7 @@ private void ExecuteNextAction()
private void Client_ConnectionOpened()
{
ConnectionOpened?.Invoke();
Game.SendAuthentication(Account.Name, Account.Password, Account.DeviceId ?? HardwareHash.GenerateRandom());
_authenticationRequired = true;
}

private void Client_ConnectionClosed(Exception ex)
Expand Down Expand Up @@ -441,7 +454,7 @@ private void Client_ConnectionFailed(Exception ex)
SetClient(null);
}

private void Client_DialogOpened(string message)
private void Client_DialogOpened(string message, string[] options)
{
if (Running == State.Started)
{
Expand Down
17 changes: 13 additions & 4 deletions PROBot/Modules/AutoReconnector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public bool IsEnabled
private bool _relogging;
private double _reloggingDelay;
private DateTime _autoReconnectTimeout;
private DateTime _botScriptDelay = DateTime.MaxValue;

public AutoReconnector(BotClient bot)
{
Expand Down Expand Up @@ -58,6 +59,12 @@ public void Update()
_autoReconnectTimeout = DateTime.UtcNow.AddSeconds(_bot.Rand.Next(MinDelay, MaxDelay + 1));
}
}

if (_botScriptDelay < DateTime.UtcNow)
{
_bot.Start();
_botScriptDelay = DateTime.MaxValue;
}
}

public void Relog(double delay)
Expand All @@ -84,16 +91,18 @@ private void Client_LoggedIn()
{
_reconnecting = false;
_relogging = false;
_bot.Start();
_botScriptDelay = DateTime.UtcNow.AddSeconds(10);
}
}

private void Client_AuthenticationFailed(AuthenticationResult result)
private void Client_AuthenticationFailed(string message)
{
_relogging = false;
if (result == AuthenticationResult.InvalidUser || result == AuthenticationResult.InvalidPassword
message = message.ToLowerInvariant();
if (/*result == AuthenticationResult.InvalidUser || result == AuthenticationResult.InvalidPassword
|| result == AuthenticationResult.InvalidVersion || result == AuthenticationResult.Banned
|| result == AuthenticationResult.EmailNotActivated)
|| result == AuthenticationResult.EmailNotActivated*/
message.Contains("invalid") || message.Contains("ban") || message.Contains("email"))
{
IsEnabled = false;
_reconnecting = false;
Expand Down
11 changes: 5 additions & 6 deletions PROBot/Modules/MoveTeacher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace PROBot.Modules
public class MoveTeacher
{
public bool IsLearning { get; private set; }
public int PokemonUid { get; private set; }
public int PokemonDBid { get; private set; }
public int MoveToForget { get; set; }

private readonly BotClient _bot;
Expand All @@ -23,7 +23,7 @@ public bool Update()
if (_learningTimeout.IsActive && !_learningTimeout.Update())
{
IsLearning = false;
_bot.Game.LearnMove(PokemonUid, MoveToForget);
_bot.Game.LearnMove(PokemonDBid, MoveToForget);
return true;
}
return _learningTimeout.IsActive;
Expand All @@ -37,16 +37,15 @@ private void Bot_ClientChanged()
}
}

private void Game_LearningMove(int moveId, string moveName, int pokemonUid)
private void Game_LearningMove(int moveId, string moveName, int pokemonDBid)
{
if (_bot.Game == null || _bot.Script == null) return;

IsLearning = true;
PokemonUid = pokemonUid;
PokemonDBid = pokemonDBid;
MoveToForget = 0;
_learningTimeout.Set(_bot.Rand.Next(1000, 3000));

_bot.Script.OnLearningMove(moveName, pokemonUid);
_bot.Script.OnLearningMove(moveName, _bot.Game.GetPokemonFromDBId(pokemonDBid).Uid);
}
}
}
2 changes: 1 addition & 1 deletion PROBot/Modules/MovementResynchronizer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ private void Game_BattleEnded()
Reset();
}

private void Game_DialogOpened(string message)
private void Game_DialogOpened(string message, string[] options)
{
Reset();
}
Expand Down
10 changes: 5 additions & 5 deletions PROBot/Modules/PokemonEvolver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public bool IsEnabled
private readonly BotClient _bot;

private Timeout _evolutionTimeout = new Timeout();
public int _evolvingPokemonUid;
public int _evolvingPokemonDBid;
public int _evolvingItem;

public PokemonEvolver(BotClient bot)
Expand All @@ -39,11 +39,11 @@ public bool Update()
{
if (IsEnabled)
{
_bot.Game.SendAcceptEvolution(_evolvingPokemonUid, _evolvingItem);
_bot.Game.SendAcceptEvolution(_evolvingPokemonDBid);
}
else
{
_bot.Game.SendCancelEvolution(_evolvingPokemonUid, _evolvingItem);
_bot.Game.SendCancelEvolution(_evolvingPokemonDBid);
}
return true;
}
Expand All @@ -58,9 +58,9 @@ private void Bot_ClientChanged()
}
}

private void Game_Evolving(int evolvingPokemonUid, int evolvingItem)
private void Game_Evolving(int evolvingPokemonDBid, int evolvingItem)
{
_evolvingPokemonUid = evolvingPokemonUid;
_evolvingPokemonDBid = evolvingPokemonDBid;
_evolvingItem = evolvingItem;
_evolutionTimeout.Set(_bot.Rand.Next(2000, 3000));
}
Expand Down
4 changes: 2 additions & 2 deletions PROBot/PROBot.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
<HintPath>..\packages\MoonSharp.2.0.0.0\lib\net40-client\MoonSharp.Interpreter.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Newtonsoft.Json, Version=11.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.11.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
Expand Down
Loading