From 3e7f2f1cd3735c35db42ff7a798b840c2ec37f62 Mon Sep 17 00:00:00 2001 From: JappaWakka Date: Fri, 9 Feb 2024 17:07:15 +0100 Subject: [PATCH 1/3] =?UTF-8?q?Fix=20Pok=C3=A9mon=20level=20not=20being=20?= =?UTF-8?q?parsed=20crash?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- P3D/Pokemon/Monster/Pokemon.vb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/P3D/Pokemon/Monster/Pokemon.vb b/P3D/Pokemon/Monster/Pokemon.vb index eeedd064f..3b845ee32 100644 --- a/P3D/Pokemon/Monster/Pokemon.vb +++ b/P3D/Pokemon/Monster/Pokemon.vb @@ -1372,7 +1372,7 @@ Public Class Pokemon Dim Level As Integer = 5 If Tags.ContainsKey("Level") = True Then - Level = CInt(Tags("Level")) + Level = CInt(ScriptConversion.ToInteger(ScriptVersion2.ScriptCommander.Parse(Tags("Level")))) End If Dim p As Pokemon = GetPokemonByID(PokemonID, NewAdditionalData) @@ -1714,7 +1714,7 @@ Public Class Pokemon Case "nickname" Me.NickName = tagValue Case "level" - Me.Level = CInt(tagValue).Clamp(1, CInt(GameModeManager.GetGameRuleValue("MaxLevel", "100"))) + Me.Level = ScriptConversion.ToInteger(ScriptVersion2.ScriptCommander.Parse(tagValue)).Clamp(1, CInt(GameModeManager.GetGameRuleValue("MaxLevel", "100"))) Case "ot" Me.OT = tagValue Case "ability" From 1fbe0a14ad7851f006070789d4c9cf44b5a0a930 Mon Sep 17 00:00:00 2001 From: JappaWakka Date: Fri, 9 Feb 2024 17:51:09 +0100 Subject: [PATCH 2/3] Move MailMan check to Player.Inventory.AddItem --- P3D/Player/PlayerInventory.vb | 14 ++++++++++++++ P3D/World/ActionScript/V2/ScriptCommands/DoItem.vb | 12 ------------ 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/P3D/Player/PlayerInventory.vb b/P3D/Player/PlayerInventory.vb index ca22175a6..fc7465348 100644 --- a/P3D/Player/PlayerInventory.vb +++ b/P3D/Player/PlayerInventory.vb @@ -78,6 +78,20 @@ Public Class PlayerInventory Next Me.Add(New ItemContainer(ID, Amount)) + + Dim item As Item = Item.GetItemByID(ID) + If item.IsMail = True AndAlso item.IsGameModeItem = False Then + Dim hasAllMail = True + For m = 300 To 323 + If Core.Player.Inventory.GetItemAmount(m.ToString) = 0 Then + hasAllMail = False + Exit For + End If + Next + If hasAllMail = True Then + GameJolt.Emblem.AchieveEmblem("mailman") + End If + End If End Sub ''' diff --git a/P3D/World/ActionScript/V2/ScriptCommands/DoItem.vb b/P3D/World/ActionScript/V2/ScriptCommands/DoItem.vb index 068974bb1..5ae74190f 100644 --- a/P3D/World/ActionScript/V2/ScriptCommands/DoItem.vb +++ b/P3D/World/ActionScript/V2/ScriptCommands/DoItem.vb @@ -36,18 +36,6 @@ amount = int(item.MaxStack - Core.Player.Inventory.GetItemAmount(_itemID)).Clamp(0, 999) End If Core.Player.Inventory.AddItem(_itemID, amount) - If item.IsMail = True AndAlso item.IsGameModeItem = False Then - Dim hasAllMail = True - For m = 300 To 323 - If Core.Player.Inventory.GetItemAmount(m.ToString) = 0 Then - hasAllMail = False - Exit For - End If - Next - If hasAllMail = True Then - GameJolt.Emblem.AchieveEmblem("mailman") - End If - End If End If Case "remove" Dim amount As Integer = 1 From 4d629139aaf535a02d9bf09066358f5f184cee9c Mon Sep 17 00:00:00 2001 From: JappaWakka Date: Fri, 9 Feb 2024 18:40:01 +0100 Subject: [PATCH 3/3] Refresh inventory after attaching mail --- P3D/Screens/PC/MailSystemScreen.vb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/P3D/Screens/PC/MailSystemScreen.vb b/P3D/Screens/PC/MailSystemScreen.vb index 47fcbfe6a..eda680da4 100644 --- a/P3D/Screens/PC/MailSystemScreen.vb +++ b/P3D/Screens/PC/MailSystemScreen.vb @@ -814,6 +814,15 @@ End If End If + Dim s As Screen = Core.CurrentScreen + While Not s.PreScreen Is Nothing And s.Identification <> Screen.Identifications.InventoryScreen + s = s.PreScreen + End While + + If s.Identification = Screen.Identifications.InventoryScreen Then + CType(s, NewInventoryScreen).LoadItems() + End If + Me.message = text End Sub