mirror of
https://github.com/P3D-Legacy/P3D-Legacy.git
synced 2025-07-28 08:14:29 +02:00
Fix crash when giving items
This commit is contained in:
parent
574a3eb8eb
commit
e03827880e
@ -117,6 +117,12 @@
|
|||||||
If result.Contains("<name>") Then
|
If result.Contains("<name>") Then
|
||||||
result = result.Replace("<name>", "//POKEMONNAME//")
|
result = result.Replace("<name>", "//POKEMONNAME//")
|
||||||
End If
|
End If
|
||||||
|
If result.Contains("<newitem>") Then
|
||||||
|
result = result.Replace("<newitem>", "//NEWITEM//")
|
||||||
|
End If
|
||||||
|
If result.Contains("<olditem>") Then
|
||||||
|
result = result.Replace("<olditem>", "//OLDITEM//")
|
||||||
|
End If
|
||||||
If result.Contains("<") Then
|
If result.Contains("<") Then
|
||||||
result = CStr(ScriptVersion2.ScriptComparer.EvaluateConstruct(result))
|
result = CStr(ScriptVersion2.ScriptComparer.EvaluateConstruct(result))
|
||||||
End If
|
End If
|
||||||
|
@ -1083,12 +1083,12 @@ Public Class NewInventoryScreen
|
|||||||
If reItem Is Nothing Then
|
If reItem Is Nothing Then
|
||||||
'JSON Stuff
|
'JSON Stuff
|
||||||
'ShowMessage(_translation.MESSAGE_GIVE_ITEM(Pokemon.GetDisplayName(), cItem.Name))
|
'ShowMessage(_translation.MESSAGE_GIVE_ITEM(Pokemon.GetDisplayName(), cItem.Name))
|
||||||
Dim giveString As String = Localization.GetString("inventory_screen_GiveItem_Give", "Gave <name> the <newitem>.").Replace("<name>", Pokemon.GetDisplayName()).Replace("<newitem>", cItem.OneLineName())
|
Dim giveString As String = Localization.GetString("inventory_screen_GiveItem_Give", "Gave <name> the <newitem>.").Replace("//POKEMONNAME//", Pokemon.GetDisplayName()).Replace("//NEWITEM//", cItem.OneLineName())
|
||||||
ShowMessage(giveString)
|
ShowMessage(giveString)
|
||||||
Else
|
Else
|
||||||
'JSON Stuff
|
'JSON Stuff
|
||||||
'ShowMessage(_translation.MESSAGE_SWITCH_ITEM(Pokemon.GetDisplayName(), reItem.Name, cItem.Name))
|
'ShowMessage(_translation.MESSAGE_SWITCH_ITEM(Pokemon.GetDisplayName(), reItem.Name, cItem.Name))
|
||||||
Dim switchString As String = Localization.GetString("inventory_screen_GiveItem_Switch", "Switched <name>'s <olditem> with the <newitem>.").Replace("<name>", Pokemon.GetDisplayName()).Replace("<olditem>", reItem.OneLineName()).Replace("<newitem>", cItem.OneLineName())
|
Dim switchString As String = Localization.GetString("inventory_screen_GiveItem_Switch", "Switched <name>'s <olditem> with the <newitem>.").Replace("//POKEMONNAME//", Pokemon.GetDisplayName()).Replace("//OLDITEM//", reItem.OneLineName()).Replace("//NEWITEM//", cItem.OneLineName())
|
||||||
ShowMessage(switchString)
|
ShowMessage(switchString)
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
@ -850,7 +850,7 @@ Public Class PartyScreen
|
|||||||
If reItem.IsMail And reItem.AdditionalData <> "" Then
|
If reItem.IsMail And reItem.AdditionalData <> "" Then
|
||||||
Core.Player.Mails.Add(Items.MailItem.GetMailDataFromString(reItem.AdditionalData))
|
Core.Player.Mails.Add(Items.MailItem.GetMailDataFromString(reItem.AdditionalData))
|
||||||
|
|
||||||
message = Localization.GetString("inventory_screen_GiveItem_TakeMail", "Gave <newitem> to <name> and took the Mail to the PC.").Replace("<newitem>", i.OneLineName()).Replace("<name>", p.GetDisplayName())
|
message = Localization.GetString("inventory_screen_GiveItem_TakeMail", "Gave <newitem> to <name> and took the Mail to the PC.").Replace("//NEWITEM//", i.OneLineName()).Replace("//POKEMONNAME//", p.GetDisplayName())
|
||||||
Else
|
Else
|
||||||
Dim ReItemID As String
|
Dim ReItemID As String
|
||||||
If reItem.IsGameModeItem Then
|
If reItem.IsGameModeItem Then
|
||||||
@ -860,17 +860,17 @@ Public Class PartyScreen
|
|||||||
End If
|
End If
|
||||||
Core.Player.Inventory.AddItem(ReItemID, 1)
|
Core.Player.Inventory.AddItem(ReItemID, 1)
|
||||||
|
|
||||||
message = Localization.GetString("inventory_screen_GiveItem_Switch", "Switched <name>'s <olditem> with the <newitem>.").Replace("<newitem>", i.OneLineName()).Replace("<olditem>", reItem.OneLineName()).Replace("<name>", p.GetDisplayName())
|
message = Localization.GetString("inventory_screen_GiveItem_Switch", "Switched <name>'s <olditem> with the <newitem>.").Replace("//NEWITEM//", i.OneLineName()).Replace("//OLDITEM//", reItem.OneLineName()).Replace("//POKEMONNAME//", p.GetDisplayName())
|
||||||
End If
|
End If
|
||||||
Else
|
Else
|
||||||
message = Localization.GetString("inventory_screen_GiveItem_Give", "Gave <name> the <newitem>.").Replace("<name>", p.GetDisplayName()).Replace("<newitem>", i.OneLineName())
|
message = Localization.GetString("inventory_screen_GiveItem_Give", "Gave <name> the <newitem>.").Replace("//POKEMONNAME//", p.GetDisplayName()).Replace("//NEWITEM//", i.OneLineName())
|
||||||
End If
|
End If
|
||||||
|
|
||||||
p.Item = i
|
p.Item = i
|
||||||
|
|
||||||
ShowMessage(message)
|
ShowMessage(message)
|
||||||
Else
|
Else
|
||||||
ShowMessage(Localization.GetString("inventory_screen_CannotGiveToPokemon", "<newitem> cannot be given to a Pokémon.").Replace("<newitem>", i.OneLineName()))
|
ShowMessage(Localization.GetString("inventory_screen_CannotGiveToPokemon", "<newitem> cannot be given to a Pokémon.").Replace("//NEWITEM//", i.OneLineName()))
|
||||||
End If
|
End If
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user