Take item from released Pokémon in PC if any

This commit is contained in:
JappaWakka 2023-07-22 10:17:07 +02:00
parent 0e9623c557
commit ea558ae187
1 changed files with 105 additions and 60 deletions

View File

@ -172,10 +172,13 @@ Public Class StorageSystemScreen
#Region "Update" #Region "Update"
Public Overrides Sub Update() Public Overrides Sub Update()
TextBox.Update()
If ControllerHandler.ButtonPressed(Buttons.Y) = True Or KeyBoardHandler.KeyPressed(KeyBindings.SpecialKey) = True Then If ControllerHandler.ButtonPressed(Buttons.Y) = True Or KeyBoardHandler.KeyPressed(KeyBindings.SpecialKey) = True Then
Core.SetScreen(New StorageSystemFilterScreen(Me)) Core.SetScreen(New StorageSystemFilterScreen(Me))
End If End If
If TextBox.Showing = False Then
If MenuVisible = True Then If MenuVisible = True Then
For i = 0 To Me.MenuEntries.Count - 1 For i = 0 To Me.MenuEntries.Count - 1
If i <= Me.MenuEntries.Count - 1 Then If i <= Me.MenuEntries.Count - 1 Then
@ -252,6 +255,7 @@ Public Class StorageSystemScreen
If StorageSystemScreen.TileOffset >= 64 Then If StorageSystemScreen.TileOffset >= 64 Then
StorageSystemScreen.TileOffset = 0 StorageSystemScreen.TileOffset = 0
End If End If
End If
End Sub End Sub
Private Sub TurnModel() Private Sub TurnModel()
@ -1068,8 +1072,42 @@ Public Class StorageSystemScreen
Private Sub ConfirmRelease() Private Sub ConfirmRelease()
Dim id As Integer = CInt(CursorPosition.X) + CInt((CursorPosition.Y - 1) * 6) Dim id As Integer = CInt(CursorPosition.X) + CInt((CursorPosition.Y - 1) * 6)
If CursorPosition.X = 6 Then If CursorPosition.X = 6 Then
If Core.Player.Pokemons(CInt(CursorPosition.Y)).Item.IsMail And Core.Player.Pokemons(CInt(CursorPosition.Y)).Item.AdditionalData <> "" Then
Screen.TextBox.Show("The Mail was taken to your~inbox on your PC.")
Core.Player.Mails.Add(Items.MailItem.GetMailDataFromString(Core.Player.Pokemons(CInt(CursorPosition.Y)).Item.AdditionalData))
Core.Player.Pokemons(CInt(CursorPosition.Y)).Item = Nothing
Else
Screen.TextBox.Show("Taken " & Core.Player.Pokemons(CInt(CursorPosition.Y)).Item.Name & "~from " & Core.Player.Pokemons(CInt(CursorPosition.Y)).GetDisplayName() & ".")
Dim ItemID As String
If Core.Player.Pokemons(CInt(CursorPosition.Y)).Item.IsGameModeItem Then
ItemID = Core.Player.Pokemons(CInt(CursorPosition.Y)).Item.gmID
Else
ItemID = Core.Player.Pokemons(CInt(CursorPosition.Y)).Item.ID.ToString
End If
Core.Player.Inventory.AddItem(ItemID, 1)
Core.Player.Pokemons(CInt(CursorPosition.Y)).Item = Nothing
End If
Core.Player.Pokemons.RemoveAt(CInt(CursorPosition.Y)) Core.Player.Pokemons.RemoveAt(CInt(CursorPosition.Y))
Else Else
If GetBox(CurrentBox).Pokemon(id).GetPokemon.Item.IsMail And GetBox(CurrentBox).Pokemon(id).GetPokemon.Item.AdditionalData <> "" Then
Screen.TextBox.Show("The Mail was taken to your~inbox on your PC.")
Core.Player.Mails.Add(Items.MailItem.GetMailDataFromString(GetBox(CurrentBox).Pokemon(id).GetPokemon.Item.AdditionalData))
GetBox(CurrentBox).Pokemon(id).GetPokemon.Item = Nothing
Else
Screen.TextBox.Show("Taken " & GetBox(CurrentBox).Pokemon(id).GetPokemon.Item.Name & "~from " & GetBox(CurrentBox).Pokemon(id).GetPokemon.GetDisplayName() & ".")
Dim ItemID As String
If GetBox(CurrentBox).Pokemon(id).GetPokemon.Item.IsGameModeItem Then
ItemID = GetBox(CurrentBox).Pokemon(id).GetPokemon.Item.gmID
Else
ItemID = GetBox(CurrentBox).Pokemon(id).GetPokemon.Item.ID.ToString
End If
Core.Player.Inventory.AddItem(ItemID, 1)
GetBox(CurrentBox).Pokemon(id).GetPokemon.Item = Nothing
End If
GetBox(CurrentBox).Pokemon.Remove(id) GetBox(CurrentBox).Pokemon.Remove(id)
End If End If
End Sub End Sub
@ -1102,6 +1140,7 @@ Public Class StorageSystemScreen
Else Else
DrawMenuEntries() DrawMenuEntries()
End If End If
TextBox.Draw()
End Sub End Sub
@ -1191,6 +1230,9 @@ Public Class StorageSystemScreen
Dim pokeTexture = box.Pokemon(id).GetPokemon().GetMenuTexture() Dim pokeTexture = box.Pokemon(id).GetPokemon().GetMenuTexture()
Dim pokeTextureScale As Vector2 = New Vector2(CSng(32 / pokeTexture.Width) * 2, CSng(32 / pokeTexture.Height) * 2) Dim pokeTextureScale As Vector2 = New Vector2(CSng(32 / pokeTexture.Width) * 2, CSng(32 / pokeTexture.Height) * 2)
Core.SpriteBatch.Draw(pokeTexture, New Rectangle(50 + x * 100, 200 + y * 84, CInt(pokeTexture.Width * pokeTextureScale.X), CInt(pokeTexture.Height * pokeTextureScale.Y)), c) Core.SpriteBatch.Draw(pokeTexture, New Rectangle(50 + x * 100, 200 + y * 84, CInt(pokeTexture.Width * pokeTextureScale.X), CInt(pokeTexture.Height * pokeTextureScale.Y)), c)
If Not box.Pokemon(id).GetPokemon().Item Is Nothing And box.Pokemon(id).GetPokemon().IsEgg() = False Then
Core.SpriteBatch.Draw(box.Pokemon(id).GetPokemon().Item.Texture, New Rectangle(CInt(50 + x * 100 + 32), CInt(200 + y * 84 + 32), 24, 24), Color.White)
End If
End If End If
Next Next
Else Else
@ -1225,6 +1267,9 @@ Public Class StorageSystemScreen
Dim pokeTexture = box.Pokemon(id).GetPokemon().GetMenuTexture() Dim pokeTexture = box.Pokemon(id).GetPokemon().GetMenuTexture()
Dim pokeTextureScale As Vector2 = New Vector2(CSng(32 / pokeTexture.Width) * 2, CSng(32 / pokeTexture.Height) * 2) Dim pokeTextureScale As Vector2 = New Vector2(CSng(32 / pokeTexture.Width) * 2, CSng(32 / pokeTexture.Height) * 2)
Core.SpriteBatch.Draw(pokeTexture, New Rectangle(50 + x * 100, 200 + y * 84, CInt(pokeTexture.Width * pokeTextureScale.X), CInt(pokeTexture.Height * pokeTextureScale.Y)), c) Core.SpriteBatch.Draw(pokeTexture, New Rectangle(50 + x * 100, 200 + y * 84, CInt(pokeTexture.Width * pokeTextureScale.X), CInt(pokeTexture.Height * pokeTextureScale.Y)), c)
If Not box.Pokemon(id).GetPokemon().Item Is Nothing And box.Pokemon(id).GetPokemon().IsEgg() = False Then
Core.SpriteBatch.Draw(box.Pokemon(id).GetPokemon().Item.Texture, New Rectangle(CInt(50 + x * 100 + 32), CInt(200 + y * 84 + 32), 24, 24), Color.White)
End If
End If End If
Next Next
Next Next