From cef4f69d5802dc47de0c695bdfef75c0de3f1e10 Mon Sep 17 00:00:00 2001 From: IamSanjid Date: Sun, 18 Nov 2018 17:33:56 +0600 Subject: [PATCH 01/52] Fixed an issue with Map Server Connection The map server ignores those players who haven't created a carachter yet. So we cannot load the map until we create our new character. --- PROProtocol/GameClient.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/PROProtocol/GameClient.cs b/PROProtocol/GameClient.cs index 11c7a7d..92a5260 100644 --- a/PROProtocol/GameClient.cs +++ b/PROProtocol/GameClient.cs @@ -2005,6 +2005,8 @@ private void OnPCBox(string[] data) private void LoadMap(string mapName) { + if (!IsAuthenticated) + return; mapName = MapClient.RemoveExtension(mapName); _loadingTimeout.Set(Rand.Next(1500, 4000)); From bcb508d99733f0e1427aaf45c57868883665f4a3 Mon Sep 17 00:00:00 2001 From: IamSanjid Date: Mon, 26 Nov 2018 14:27:43 +0600 Subject: [PATCH 02/52] Fixed crash when opening Shop --- PROProtocol/GameClient.cs | 2 -- PROProtocol/Shop.cs | 17 +++++++++-------- PROProtocol/ShopItem.cs | 2 +- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/PROProtocol/GameClient.cs b/PROProtocol/GameClient.cs index e7e4ab7..15e8c87 100644 --- a/PROProtocol/GameClient.cs +++ b/PROProtocol/GameClient.cs @@ -1999,8 +1999,6 @@ private void OnPCBox(string[] data) private void LoadMap(string mapName) { - if (!IsAuthenticated) - return; mapName = MapClient.RemoveExtension(mapName); _loadingTimeout.Set(Rand.Next(1500, 4000)); diff --git a/PROProtocol/Shop.cs b/PROProtocol/Shop.cs index 0efc862..310077f 100644 --- a/PROProtocol/Shop.cs +++ b/PROProtocol/Shop.cs @@ -1,5 +1,7 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using System.Collections.ObjectModel; +using System.Linq; namespace PROProtocol { @@ -12,18 +14,17 @@ public class Shop public Shop(string content) { - string[] data = content.Split(','); - if (data.Length >= 31) + string[] data = content.Split(new[] { "[PD]," }, StringSplitOptions.None); + if (data.Length >= 4) { - for (int i = 0; i < 10; ++i) + for (int i = 0; i < data.Length - 1; ++i) { - ShopItem item = new ShopItem(data, i * 3); + var itemData = data[i].Split(','); + var item = new ShopItem(itemData, 0); if (item.Id > 0) - { _items.Add(item); - } } - Id = int.Parse(data[30]); + Id = int.Parse(data.LastOrDefault()); } } } diff --git a/PROProtocol/ShopItem.cs b/PROProtocol/ShopItem.cs index 329c21a..1c295d5 100644 --- a/PROProtocol/ShopItem.cs +++ b/PROProtocol/ShopItem.cs @@ -9,7 +9,7 @@ public class ShopItem public ShopItem(string[] data, int index) { Id = int.Parse(data[index]); - Name = data[index + 1]; + Name = data[index + 1].Replace("\"", ""); Price = int.Parse(data[index + 2]); } } From c03c9042b05acfcdfa9a904ec3bc475924304f1a Mon Sep 17 00:00:00 2001 From: DubsCheckum Date: Sun, 7 Apr 2019 20:55:45 +1200 Subject: [PATCH 03/52] beta3 --- PROBot/BotClient.cs | 2 +- PROProtocol/GameClient.cs | 59 ++++++++++++++++++++++++++------------- PROProtocol/GameServer.cs | 4 +-- PROShine/App.xaml.cs | 2 +- 4 files changed, 44 insertions(+), 23 deletions(-) diff --git a/PROBot/BotClient.cs b/PROBot/BotClient.cs index 193d250..b9f0458 100644 --- a/PROBot/BotClient.cs +++ b/PROBot/BotClient.cs @@ -286,7 +286,7 @@ public void LoadScript(string filename) catch (Exception ex) { Script = null; - throw ex; + throw; } } diff --git a/PROProtocol/GameClient.cs b/PROProtocol/GameClient.cs index ea57f19..1476097 100644 --- a/PROProtocol/GameClient.cs +++ b/PROProtocol/GameClient.cs @@ -104,7 +104,7 @@ public class GameClient public event Action ActivePokemonChanged; public event Action OpponentChanged; - private const string Version = "Dolphin"; + private const string Version = "Marchv4"; private GameConnection _connection; private DateTime _lastMovement; @@ -1172,9 +1172,9 @@ private void ProcessPacket(string packet) case "@": OnNpcBattlers(data); break; - case "*": - OnNpcDestroy(data); - break; + //case "*": + // OnNpcDestroy(data); + // break; case "#": OnTeamUpdate(data); break; @@ -1327,7 +1327,7 @@ private void OnPlayerSync(string[] data) PositionUpdated?.Invoke(MapName, PlayerX, playerY); } - private void OnPlayerInfos(string[] data) + private void OnPlayerInfos(string[] data) { string[] playerData = data[1].Split('|'); PlayerName = playerData[0]; @@ -1352,7 +1352,8 @@ private void OnNpcBattlers(string[] data) { if (!IsMapLoaded) return; - List defeatedBattlers = data[1].Split(new [] { "|" }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToList(); + var npcData = data[1].Split('*'); + var defeatedBattlers = npcData[0].Split(new [] { "|" }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToList(); Map.Npcs.Clear(); foreach (Npc npc in Map.OriginalNpcs) @@ -1364,23 +1365,20 @@ private void OnNpcBattlers(string[] data) } Map.Npcs.Add(clone); } - } - - private void OnNpcDestroy(string[] data) - { - if (!IsMapLoaded) return; - string[] npcData = data[1].Split('|'); - - foreach (string npcText in npcData) + if (npcData[1] != "") { - int npcId = int.Parse(npcText); - foreach (Npc npc in Map.Npcs) + var destroyedNpcs = npcData[1].Split('|'); + foreach (string npcText in destroyedNpcs) { - if (npc.Id == npcId) + int npcId = int.Parse(npcText); + foreach (Npc npc in Map.Npcs) { - Map.Npcs.Remove(npc); - break; + if (npc.Id == npcId) + { + Map.Npcs.Remove(npc); + break; + } } } } @@ -1389,6 +1387,29 @@ private void OnNpcDestroy(string[] data) NpcReceived?.Invoke(Map.Npcs); } + //private void OnNpcDestroy(string[] data) + //{ + // if (!IsMapLoaded) return; + + // string[] npcData = data[1].Split('|'); + + // foreach (string npcText in npcData) + // { + // int npcId = int.Parse(npcText); + // foreach (Npc npc in Map.Npcs) + // { + // if (npc.Id == npcId) + // { + // Map.Npcs.Remove(npc); + // break; + // } + // } + // } + + // AreNpcReceived = true; + // NpcReceived?.Invoke(Map.Npcs); + //} + private void OnTeamUpdate(string[] data) { string[] teamData = data[1].Split(new[] { "\r\n" }, StringSplitOptions.None); diff --git a/PROProtocol/GameServer.cs b/PROProtocol/GameServer.cs index 894c270..d6dadf2 100644 --- a/PROProtocol/GameServer.cs +++ b/PROProtocol/GameServer.cs @@ -16,9 +16,9 @@ public static IPEndPoint GetAddress(this GameServer server) switch (server) { case GameServer.Silver: - return new IPEndPoint(IPAddress.Parse("185.70.107.113"), 800); + return new IPEndPoint(IPAddress.Parse("185.83.214.111"), 800); case GameServer.Gold: - return new IPEndPoint(IPAddress.Parse("185.70.107.113"), 801); + return new IPEndPoint(IPAddress.Parse("185.83.214.111"), 801); } return null; } diff --git a/PROShine/App.xaml.cs b/PROShine/App.xaml.cs index 58b76a6..a496c9a 100644 --- a/PROShine/App.xaml.cs +++ b/PROShine/App.xaml.cs @@ -17,7 +17,7 @@ public static void InitializeVersion() Assembly assembly = typeof(App).Assembly; AssemblyName assemblyName = assembly.GetName(); Name = assemblyName.Name; - Version = assemblyName.Version.ToString(3) + "-beta2"; + Version = assemblyName.Version.ToString(3) + "-unofficial_beta3"; IsBeta = true; Author = ((AssemblyCompanyAttribute)Attribute.GetCustomAttribute(assembly, typeof(AssemblyCompanyAttribute), false)).Company; Description = ((AssemblyDescriptionAttribute)Attribute.GetCustomAttribute(assembly, typeof(AssemblyDescriptionAttribute), false)).Description; From d5989eb6a1d1d9ea771c521163a8afa8b3e67705 Mon Sep 17 00:00:00 2001 From: DubsCheckum Date: Wed, 10 Apr 2019 02:50:44 +1200 Subject: [PATCH 04/52] Map data and better NPC data courtesy of Zonz: getNpcData getMapLinks getMapWidth getMapHeight getCellType --- PROBot/Scripting/LuaScript.cs | 87 ++++++++++++++++++++++++++++++----- 1 file changed, 75 insertions(+), 12 deletions(-) diff --git a/PROBot/Scripting/LuaScript.cs b/PROBot/Scripting/LuaScript.cs index 7f33953..8ec6c3b 100644 --- a/PROBot/Scripting/LuaScript.cs +++ b/PROBot/Scripting/LuaScript.cs @@ -172,7 +172,11 @@ private void CreateLuaInstance() _lua.Globals["getActiveHeadbuttTrees"] = new Func>>(GetActiveHeadbuttTrees); _lua.Globals["getActiveBerryTrees"] = new Func>>(GetActiveBerryTrees); _lua.Globals["getDiscoverableItems"] = new Func>>(GetDiscoverableItems); - _lua.Globals["getNpcData"] = new Func>>(GetNpcData); + _lua.Globals["getNpcData"] = new Func>>(GetNpcData); + _lua.Globals["getMapLinks"] = new Func>>(GetMapLinks); + _lua.Globals["getMapWidth"] = new Func(GetMapWidth); + _lua.Globals["getMapHeight"] = new Func(GetMapHeight); + _lua.Globals["getCellType"] = new Func(GetCellType); _lua.Globals["hasItem"] = new Func(HasItem); _lua.Globals["getItemQuantity"] = new Func(GetItemQuantity); @@ -530,25 +534,84 @@ private List> GetDiscoverableItems() return items; } - // API return npc data on current map, format : { { "x" = x , "y" = y, "type" = type }, {...}, ... } - private List> GetNpcData() + // API: Returns npc data on current map, format : { { "x" = x , "y" = y, "type" = type }, {...}, ... } + private List> GetNpcData() { - var lNpc = new List>(); + var lNpc = new List>(); foreach (Npc npc in Bot.Game.Map.Npcs) { - var npcData = new Dictionary(); - npcData["x"] = npc.PositionX.ToString(); - npcData["y"] = npc.PositionY.ToString(); - npcData["type"] = npc.Type.ToString(); - npcData["name"] = npc.Name; - npcData["isBattler"] = npc.IsBattler.ToString(); - npcData["id"] = npc.Id.ToString(); - npcData["los"] = npc.LosLength.ToString(); + var npcData = new Dictionary + { + ["x"] = DynValue.NewNumber(npc.PositionX), + ["y"] = DynValue.NewNumber(npc.PositionY), + ["type"] = DynValue.NewNumber(npc.Type), + ["name"] = DynValue.NewString(npc.Name), + ["isBattler"] = DynValue.NewBoolean(npc.IsBattler), + ["id"] = DynValue.NewNumber(npc.Id), + ["los"] = DynValue.NewNumber(npc.LosLength) + }; lNpc.Add(npcData); } return lNpc; } + // API: Returns an array of all map links on the current map + public List> GetMapLinks() + { + var links = new List>(); + + for (int y = 0; y < Bot.Game.Map.DimensionY; y++) + { + for (int x = 0; x < Bot.Game.Map.DimensionX; x++) + { + if (Bot.Game.Map.Links[x, y]) + { + links.Add(new Dictionary + { + ["x"] = x, + ["y"] = y, + }); + } + } + } + + return links; + } + + // API: The number of cells on the current map in the x direction. + private int GetMapWidth() + { + return Bot.Game.Map.Width; + } + + // API: The number of cells on the current map in the y direction. + private int GetMapHeight() + { + return Bot.Game.Map.Height; + } + + // API: Returns the cell type of the specified cell on the current map. + private string GetCellType(int x, int y) + { + Map map = Bot.Game.Map; + + if (map.HasLink(x, y)) return "Link"; + if (map.IsGrass(x, y)) return "Grass"; + if (map.IsWater(x, y)) return "Water"; + if (map.IsNormalGround(x, y)) return "Normal Ground"; + if (map.IsIce(x, y)) return "Ice"; + if (map.IsPC(x, y)) return "PC"; + + int collider = map.GetCollider(x, y); + if (collider == 2) return "Ledge South"; + if (collider == 3) return "Ledge East"; + if (collider == 4) return "Ledge West"; + if (collider == 11) return "Tree"; + if (collider == 13) return "Rock"; + + return "Collider"; + } + // API: Returns true if the string contains the specified part, ignoring the case. private bool StringContains(string haystack, string needle) { From 46547de7854b5b07ee9d250b81f0d249fd1ebbec Mon Sep 17 00:00:00 2001 From: DubsCheckum Date: Wed, 10 Apr 2019 02:59:51 +1200 Subject: [PATCH 05/52] beta4 --- PROShine/App.xaml.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PROShine/App.xaml.cs b/PROShine/App.xaml.cs index a496c9a..631126c 100644 --- a/PROShine/App.xaml.cs +++ b/PROShine/App.xaml.cs @@ -17,7 +17,7 @@ public static void InitializeVersion() Assembly assembly = typeof(App).Assembly; AssemblyName assemblyName = assembly.GetName(); Name = assemblyName.Name; - Version = assemblyName.Version.ToString(3) + "-unofficial_beta3"; + Version = assemblyName.Version.ToString(3) + "-unofficial_beta4"; IsBeta = true; Author = ((AssemblyCompanyAttribute)Attribute.GetCustomAttribute(assembly, typeof(AssemblyCompanyAttribute), false)).Company; Description = ((AssemblyDescriptionAttribute)Attribute.GetCustomAttribute(assembly, typeof(AssemblyDescriptionAttribute), false)).Description; From 6c075eb43a62f18ff76767d51b14bf92e9dd0937 Mon Sep 17 00:00:00 2001 From: DubsCheckum Date: Wed, 10 Apr 2019 14:19:49 +1200 Subject: [PATCH 06/52] simplify this function --- PROProtocol/GameClient.cs | 54 +++++---------------------------------- 1 file changed, 7 insertions(+), 47 deletions(-) diff --git a/PROProtocol/GameClient.cs b/PROProtocol/GameClient.cs index 1476097..5f1f377 100644 --- a/PROProtocol/GameClient.cs +++ b/PROProtocol/GameClient.cs @@ -1172,9 +1172,6 @@ private void ProcessPacket(string packet) case "@": OnNpcBattlers(data); break; - //case "*": - // OnNpcDestroy(data); - // break; case "#": OnTeamUpdate(data); break; @@ -1353,33 +1350,19 @@ private void OnNpcBattlers(string[] data) if (!IsMapLoaded) return; var npcData = data[1].Split('*'); - var defeatedBattlers = npcData[0].Split(new [] { "|" }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToList(); + var defeatedNpcs = npcData[0].Split(new[] { "|" }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse); + var destroyedNpcs = npcData[1].Split(new[] { "|" }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse); Map.Npcs.Clear(); foreach (Npc npc in Map.OriginalNpcs) { - Npc clone = npc.Clone(); - if (defeatedBattlers.Contains(npc.Id)) + if (!destroyedNpcs.Contains(npc.Id)) { - clone.CanBattle = false; - } - Map.Npcs.Add(clone); - } + Npc clone = npc.Clone(); + if (defeatedNpcs.Contains(npc.Id)) + clone.CanBattle = false; - if (npcData[1] != "") - { - var destroyedNpcs = npcData[1].Split('|'); - foreach (string npcText in destroyedNpcs) - { - int npcId = int.Parse(npcText); - foreach (Npc npc in Map.Npcs) - { - if (npc.Id == npcId) - { - Map.Npcs.Remove(npc); - break; - } - } + Map.Npcs.Add(clone); } } @@ -1387,29 +1370,6 @@ private void OnNpcBattlers(string[] data) NpcReceived?.Invoke(Map.Npcs); } - //private void OnNpcDestroy(string[] data) - //{ - // if (!IsMapLoaded) return; - - // string[] npcData = data[1].Split('|'); - - // foreach (string npcText in npcData) - // { - // int npcId = int.Parse(npcText); - // foreach (Npc npc in Map.Npcs) - // { - // if (npc.Id == npcId) - // { - // Map.Npcs.Remove(npc); - // break; - // } - // } - // } - - // AreNpcReceived = true; - // NpcReceived?.Invoke(Map.Npcs); - //} - private void OnTeamUpdate(string[] data) { string[] teamData = data[1].Split(new[] { "\r\n" }, StringSplitOptions.None); From 90ab1575367c7084881a206c61e738ec5fa8ed98 Mon Sep 17 00:00:00 2001 From: DubsCheckum Date: Wed, 10 Apr 2019 23:00:31 +1200 Subject: [PATCH 07/52] shop fix --- PROProtocol/Shop.cs | 6 +++--- PROProtocol/ShopItem.cs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/PROProtocol/Shop.cs b/PROProtocol/Shop.cs index 0efc862..042703a 100644 --- a/PROProtocol/Shop.cs +++ b/PROProtocol/Shop.cs @@ -13,17 +13,17 @@ public class Shop public Shop(string content) { string[] data = content.Split(','); - if (data.Length >= 31) + if (data.Length >= 41) { for (int i = 0; i < 10; ++i) { - ShopItem item = new ShopItem(data, i * 3); + ShopItem item = new ShopItem(data, i * 4); if (item.Id > 0) { _items.Add(item); } } - Id = int.Parse(data[30]); + Id = int.Parse(data[40]); } } } diff --git a/PROProtocol/ShopItem.cs b/PROProtocol/ShopItem.cs index 329c21a..841ad3b 100644 --- a/PROProtocol/ShopItem.cs +++ b/PROProtocol/ShopItem.cs @@ -9,7 +9,7 @@ public class ShopItem public ShopItem(string[] data, int index) { Id = int.Parse(data[index]); - Name = data[index + 1]; + Name = data[index + 1].Trim('"'); Price = int.Parse(data[index + 2]); } } From 0824b4755db4acd200d0aa734b3460d515ab368e Mon Sep 17 00:00:00 2001 From: DubsCheckum Date: Sun, 19 May 2019 08:48:40 +1200 Subject: [PATCH 08/52] update version to Easter2019 --- PROProtocol/GameClient.cs | 2 +- PROShine/App.xaml.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/PROProtocol/GameClient.cs b/PROProtocol/GameClient.cs index 5f1f377..6b39514 100644 --- a/PROProtocol/GameClient.cs +++ b/PROProtocol/GameClient.cs @@ -104,7 +104,7 @@ public class GameClient public event Action ActivePokemonChanged; public event Action OpponentChanged; - private const string Version = "Marchv4"; + private const string Version = "Easter2019"; private GameConnection _connection; private DateTime _lastMovement; diff --git a/PROShine/App.xaml.cs b/PROShine/App.xaml.cs index 631126c..1ca46ac 100644 --- a/PROShine/App.xaml.cs +++ b/PROShine/App.xaml.cs @@ -17,7 +17,7 @@ public static void InitializeVersion() Assembly assembly = typeof(App).Assembly; AssemblyName assemblyName = assembly.GetName(); Name = assemblyName.Name; - Version = assemblyName.Version.ToString(3) + "-unofficial_beta4"; + Version = assemblyName.Version.ToString(3) + "-unofficial_beta5"; IsBeta = true; Author = ((AssemblyCompanyAttribute)Attribute.GetCustomAttribute(assembly, typeof(AssemblyCompanyAttribute), false)).Company; Description = ((AssemblyDescriptionAttribute)Attribute.GetCustomAttribute(assembly, typeof(AssemblyDescriptionAttribute), false)).Description; From c58012c5224efee83eafc8d6088c310e0705559b Mon Sep 17 00:00:00 2001 From: DubsCheckum Date: Sun, 19 May 2019 19:01:57 +1200 Subject: [PATCH 09/52] beta5 --- PROBot/BotClient.cs | 17 +++++++---------- PROBot/Scripting/LuaScript.cs | 6 +++--- PROProtocol/GameClient.cs | 7 ++++--- 3 files changed, 14 insertions(+), 16 deletions(-) diff --git a/PROBot/BotClient.cs b/PROBot/BotClient.cs index b9f0458..9c6fa41 100644 --- a/PROBot/BotClient.cs +++ b/PROBot/BotClient.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; using System.IO; +using System.Linq; namespace PROBot { @@ -261,17 +262,13 @@ public void LoadScript(string filename) { string input = File.ReadAllText(filename); - List libs = new List(); + var libs = new List(); 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); @@ -283,7 +280,7 @@ public void LoadScript(string filename) Script.ScriptMessage += Script_ScriptMessage; Script.Initialize(); } - catch (Exception ex) + catch (Exception) { Script = null; throw; diff --git a/PROBot/Scripting/LuaScript.cs b/PROBot/Scripting/LuaScript.cs index 8ec6c3b..55be00d 100644 --- a/PROBot/Scripting/LuaScript.cs +++ b/PROBot/Scripting/LuaScript.cs @@ -111,7 +111,7 @@ private void CreateLuaInstance() _hookedFunctions = new Dictionary>(); _lua = new Script(CoreModules.Preset_SoftSandbox | CoreModules.LoadMethods); - _lua.Options.ScriptLoader = new CustomScriptLoader(_path) { ModulePaths = new[] { "?.lua" } }; + _lua.Options.ScriptLoader = new CustomScriptLoader(_path) { ModulePaths = new[] { "?.lua", Directory.GetCurrentDirectory() + "/Libs/?.lua" } }; _lua.Options.CheckThreadAccess = false; _lua.Globals["log"] = new Action(Log); _lua.Globals["fatal"] = new Action(Fatal); @@ -2462,9 +2462,9 @@ private string[] GetPokemonTypeFromPC(int boxId, int boxPokemonId) { return null; } - + int id = Bot.Game.CurrentPCBox[boxPokemonId - 1].Id; - + if (id <= 0 || id >= TypesManager.Instance.Type1.Count()) { return new string[] { "Unknown", "Unknown" }; diff --git a/PROProtocol/GameClient.cs b/PROProtocol/GameClient.cs index 6b39514..614501b 100644 --- a/PROProtocol/GameClient.cs +++ b/PROProtocol/GameClient.cs @@ -868,7 +868,7 @@ public int GetMovePosition(int pokemonUid, string moveName) public InventoryItem GetItemFromId(int id) { - return Items.FirstOrDefault(i => i.Id == id && i.Quantity > 0); + return Items.Find(i => i.Id == id && i.Quantity > 0); } public bool HasItemId(int id) @@ -878,7 +878,8 @@ public bool HasItemId(int id) public InventoryItem GetItemFromName(string itemName) { - return Items.FirstOrDefault(i => i.Name.Equals(itemName, StringComparison.InvariantCultureIgnoreCase) && i.Quantity > 0); + return Items.Find(i => i.Name?.Equals(itemName, StringComparison.InvariantCultureIgnoreCase) == true + && i.Quantity > 0); } public bool HasItemName(string itemName) @@ -893,7 +894,7 @@ public bool HasPokemonInTeam(string pokemonName) public Pokemon FindFirstPokemonInTeam(string pokemonName) { - return Team.FirstOrDefault(p => p.Name.Equals(pokemonName, StringComparison.InvariantCultureIgnoreCase)); + return Team.Find(p => p.Name.Equals(pokemonName, StringComparison.InvariantCultureIgnoreCase)); } public void UseSurf() From a12d1fa7bfc34f25df716bb719508fd2fb195819 Mon Sep 17 00:00:00 2001 From: DubsCheckum Date: Mon, 20 May 2019 16:05:24 +1200 Subject: [PATCH 10/52] add animated battle sprites (ty zonz) --- PROShine/PROShine.csproj | 3 ++ PROShine/Views/BattleView.xaml | 5 ++-- PROShine/Views/BattleView.xaml.cs | 48 +++++++++++++++++++++++++++---- PROShine/packages.config | 1 + 4 files changed, 49 insertions(+), 8 deletions(-) diff --git a/PROShine/PROShine.csproj b/PROShine/PROShine.csproj index afcc587..36f43e0 100644 --- a/PROShine/PROShine.csproj +++ b/PROShine/PROShine.csproj @@ -53,6 +53,9 @@ + + ..\packages\XamlAnimatedGif.1.2.1\lib\net45\XamlAnimatedGif.dll + diff --git a/PROShine/Views/BattleView.xaml b/PROShine/Views/BattleView.xaml index 1028b1a..5edd0c0 100644 --- a/PROShine/Views/BattleView.xaml +++ b/PROShine/Views/BattleView.xaml @@ -6,6 +6,7 @@ xmlns:local="clr-namespace:PROShine.Views" xmlns:fa="http://schemas.fontawesome.io/icons/" xmlns:p="clr-namespace:PROShine" + xmlns:gif="https://github.com/XamlAnimatedGif/XamlAnimatedGif" mc:Ignorable="d" d:DesignHeight="350" d:DesignWidth="600"> @@ -17,8 +18,8 @@