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,85 +172,89 @@ 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 MenuVisible = True Then If TextBox.Showing = False Then
For i = 0 To Me.MenuEntries.Count - 1 If MenuVisible = True Then
If i <= Me.MenuEntries.Count - 1 Then For i = 0 To Me.MenuEntries.Count - 1
Dim m As MenuEntry = Me.MenuEntries(i) If i <= Me.MenuEntries.Count - 1 Then
Dim m As MenuEntry = Me.MenuEntries(i)
m.Update(Me) m.Update(Me)
End If
Next
If Controls.Up(True, True) = True Then
Me.MenuCursor -= 1
End If End If
Next If Controls.Down(True, True) = True Then
Me.MenuCursor += 1
If Controls.Up(True, True) = True Then
Me.MenuCursor -= 1
End If
If Controls.Down(True, True) = True Then
Me.MenuCursor += 1
End If
Dim maxIndex As Integer = 0
Dim minIndex As Integer = 100
For Each e As MenuEntry In Me.MenuEntries
If e.Index < minIndex Then
minIndex = e.Index
End If End If
If e.Index > maxIndex Then
maxIndex = e.Index
End If
Next
If Me.MenuCursor > maxIndex Then Dim maxIndex As Integer = 0
Me.MenuCursor = minIndex Dim minIndex As Integer = 100
ElseIf Me.MenuCursor < minIndex Then
Me.MenuCursor = maxIndex For Each e As MenuEntry In Me.MenuEntries
End If If e.Index < minIndex Then
Else minIndex = e.Index
TurnModel() End If
If CursorMoving = True Then If e.Index > maxIndex Then
MoveCursor() maxIndex = e.Index
End If
Next
If Me.MenuCursor > maxIndex Then
Me.MenuCursor = minIndex
ElseIf Me.MenuCursor < minIndex Then
Me.MenuCursor = maxIndex
End If
Else Else
If ControllerHandler.ButtonPressed(Buttons.RightShoulder) = True Or Controls.Right(True, False, True, False, False, False) = True Then TurnModel()
Me.CurrentBox += 1 If CursorMoving = True Then
If CurrentBox > Me.Boxes.Count - 1 Then MoveCursor()
CurrentBox = 0 Else
If ControllerHandler.ButtonPressed(Buttons.RightShoulder) = True Or Controls.Right(True, False, True, False, False, False) = True Then
Me.CurrentBox += 1
If CurrentBox > Me.Boxes.Count - 1 Then
CurrentBox = 0
End If
End If End If
End If If ControllerHandler.ButtonPressed(Buttons.LeftShoulder) = True Or Controls.Left(True, False, True, False, False, False) = True Then
If ControllerHandler.ButtonPressed(Buttons.LeftShoulder) = True Or Controls.Left(True, False, True, False, False, False) = True Then Me.CurrentBox -= 1
Me.CurrentBox -= 1 If CurrentBox < 0 Then
If CurrentBox < 0 Then CurrentBox = Me.Boxes.Count - 1
CurrentBox = Me.Boxes.Count - 1 End If
End If End If
End If
PressNumberButtons() PressNumberButtons()
If GetRelativeMousePosition() <> New Vector2(-1) AndAlso GetRelativeMousePosition() = CursorPosition AndAlso Controls.Accept(True, False, False) = True Then If GetRelativeMousePosition() <> New Vector2(-1) AndAlso GetRelativeMousePosition() = CursorPosition AndAlso Controls.Accept(True, False, False) = True Then
SoundManager.PlaySound("select") SoundManager.PlaySound("select")
ChooseObject() ChooseObject()
End If End If
ControlCursor() ControlCursor()
If Controls.Accept(False, True, True) = True Then If Controls.Accept(False, True, True) = True Then
SoundManager.PlaySound("select") SoundManager.PlaySound("select")
ChooseObject() ChooseObject()
End If End If
If Controls.Dismiss(True, True, True) = True Then If Controls.Dismiss(True, True, True) = True Then
SoundManager.PlaySound("select") SoundManager.PlaySound("select")
CloseScreen() CloseScreen()
End If
End If End If
End If End If
End If
StorageSystemScreen.TileOffset += 1 StorageSystemScreen.TileOffset += 1
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
@ -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