mirror of
https://github.com/P3D-Legacy/P3D-Legacy.git
synced 2025-07-27 07:44:31 +02:00
Mail system progress
Made it possible to attach already written mail to a pokémon Added a taken item message if the pokémon that the mail gets attached to already has an item Replaced the MiniFont and InGameFont on the mail screen with MainFont Working on mouse support
This commit is contained in:
parent
a1b1df55c6
commit
5ed44da99b
@ -7,10 +7,10 @@ version=2
|
||||
|
||||
:if:<register.registered(pokemongot)>=true
|
||||
@storage.set(int,canind,2)
|
||||
@storage.set(str,computer_options,<storage.get(str,billspcname)>,Inbox)
|
||||
@storage.set(str,computer_options,<storage.get(str,billspcname)>,Mailbox)
|
||||
:else
|
||||
@storage.set(int,canind,1)
|
||||
@storage.set(str,computer_options,Inbox)
|
||||
@storage.set(str,computer_options,Mailbox)
|
||||
:endif
|
||||
|
||||
:if:<player.haspokedex>=true
|
||||
@ -43,7 +43,7 @@ version=2
|
||||
@sound.play(PC\LogOn)
|
||||
@screen.mysteryevent
|
||||
@script.start(computer_choose)
|
||||
:when:Inbox
|
||||
:when:Mailbox
|
||||
@sound.play(PC\LogOn)
|
||||
@screen.mailsystem
|
||||
@script.start(computer_choose)
|
||||
|
@ -79,7 +79,7 @@
|
||||
If op.Item.OriginalName.ToLower().EndsWith(" drive") = True AndAlso op.Number = 649 Then
|
||||
Return Power
|
||||
End If
|
||||
If op.Item.OriginalName.ToLower().EndsWith(" mail") = True Then
|
||||
If op.Item.IsMail = True Then
|
||||
Return Power
|
||||
End If
|
||||
|
||||
@ -113,7 +113,7 @@
|
||||
If op.Item.OriginalName.ToLower().EndsWith(" drive") = True AndAlso p.Number = 649 Then
|
||||
Exit Sub
|
||||
End If
|
||||
If op.Item.OriginalName.ToLower().EndsWith(" mail") = True Then
|
||||
If op.Item.IsMail = True Then
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
|
@ -93,10 +93,10 @@ Namespace BattleSystem.Moves.Dark
|
||||
If Not op.Item Is Nothing AndAlso op.Item.OriginalName.ToLower().EndsWith(" memory") = True AndAlso op.Number = 773 Then
|
||||
CanSwitchItems = False
|
||||
End If
|
||||
If Not p.Item Is Nothing AndAlso p.Item.OriginalName.ToLower().EndsWith(" mail") = True Then
|
||||
If Not p.Item Is Nothing AndAlso p.Item.IsMail = True Then
|
||||
CanSwitchItems = False
|
||||
End If
|
||||
If Not op.Item Is Nothing AndAlso op.Item.OriginalName.ToLower().EndsWith(" mail") = True Then
|
||||
If Not op.Item Is Nothing AndAlso op.Item.IsMail = True Then
|
||||
CanSwitchItems = False
|
||||
End If
|
||||
If (p.Item IsNot Nothing AndAlso p.Item.IsMegaStone) OrElse (op.Item IsNot Nothing AndAlso op.Item.IsMegaStone) Then
|
||||
|
@ -79,7 +79,7 @@
|
||||
If op.Item.OriginalName.ToLower().EndsWith(" drive") = True AndAlso op.Number = 649 Then
|
||||
Exit Sub
|
||||
End If
|
||||
If op.Item.OriginalName.ToLower().EndsWith(" mail") = True Then
|
||||
If op.Item.IsMail = True Then
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
|
@ -86,7 +86,7 @@
|
||||
If p.Item.OriginalName.ToLower().EndsWith(" drive") = True AndAlso p.Number = 649 Then
|
||||
b = True
|
||||
End If
|
||||
If p.Item.OriginalName.ToLower().EndsWith(" mail") = True Then
|
||||
If p.Item.IsMail = True Then
|
||||
b = True
|
||||
End If
|
||||
Else
|
||||
|
@ -82,7 +82,7 @@ Namespace BattleSystem.Moves.Normal
|
||||
If op.Item.OriginalName.ToLower().EndsWith(" drive") = True AndAlso op.Number = 649 Then
|
||||
Exit Sub
|
||||
End If
|
||||
If op.Item.OriginalName.ToLower().EndsWith(" mail") = True Then
|
||||
If op.Item.IsMail = True Then
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
|
@ -93,10 +93,10 @@ Namespace BattleSystem.Moves.Psychic
|
||||
If Not op.Item Is Nothing AndAlso op.Item.OriginalName.ToLower().EndsWith(" memory") = True AndAlso op.Number = 773 Then
|
||||
CanSwitchItems = False
|
||||
End If
|
||||
If Not p.Item Is Nothing AndAlso p.Item.OriginalName.ToLower().EndsWith(" mail") = True Then
|
||||
If Not p.Item Is Nothing AndAlso p.Item.IsMail = True Then
|
||||
CanSwitchItems = False
|
||||
End If
|
||||
If Not op.Item Is Nothing AndAlso op.Item.OriginalName.ToLower().EndsWith(" mail") = True Then
|
||||
If Not op.Item Is Nothing AndAlso op.Item.IsMail = True Then
|
||||
CanSwitchItems = False
|
||||
End If
|
||||
If (p.Item IsNot Nothing AndAlso p.Item.IsMegaStone) OrElse (op.Item IsNot Nothing AndAlso op.Item.IsMegaStone) Then
|
||||
|
@ -12,7 +12,7 @@
|
||||
Me.PreScreen = currentScreen
|
||||
Me.Identification = Identifications.MailSystemScreen
|
||||
|
||||
Me.MouseVisible = False
|
||||
Me.MouseVisible = True
|
||||
Me.CanBePaused = True
|
||||
Me.CanMuteAudio = False
|
||||
Me.CanChat = False
|
||||
@ -21,7 +21,7 @@
|
||||
Public Overrides Sub Draw()
|
||||
Canvas.DrawRectangle(Core.windowSize, Color.White)
|
||||
|
||||
Core.SpriteBatch.DrawString(FontManager.InGameFont, "Inbox", New Vector2(42, 28), Color.Black)
|
||||
Core.SpriteBatch.DrawString(FontManager.MainFont, "Mailbox", New Vector2(42, 28), Color.Black)
|
||||
Canvas.DrawImageBorder(TextureManager.GetTexture("GUI\Menus\Menu", New Rectangle(0, 0, 48, 48), ""), 2, New Rectangle(32, 64, 320, 576))
|
||||
|
||||
Canvas.DrawImageBorder(TextureManager.GetTexture("GUI\Menus\Menu", New Rectangle(0, 0, 48, 48), ""), 2, New Rectangle(400, 64, 672, 576))
|
||||
@ -44,9 +44,9 @@
|
||||
|
||||
If message <> "" Then
|
||||
Canvas.DrawRectangle(Core.windowSize, New Color(0, 0, 0, 150))
|
||||
Dim t As String = message.CropStringToWidth(FontManager.InGameFont, 800)
|
||||
Dim t As String = message.CropStringToWidth(FontManager.MainFont, 800)
|
||||
|
||||
Core.SpriteBatch.DrawString(FontManager.InGameFont, t, New Vector2(CSng(Core.windowSize.Width / 2 - FontManager.InGameFont.MeasureString(t).X / 2), 340), Color.White)
|
||||
Core.SpriteBatch.DrawString(FontManager.MainFont, t, New Vector2(CSng(Core.windowSize.Width / 2 - FontManager.MainFont.MeasureString(t).X / 2), 340), Color.White)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
@ -64,7 +64,7 @@
|
||||
End If
|
||||
|
||||
Canvas.DrawImageBorder(TextureManager.GetTexture("GUI\Menus\Menu", New Rectangle(x, y, 48, 48), ""), 1, New Rectangle(CInt(P.X), CInt(P.Y), 288, 32))
|
||||
Core.SpriteBatch.DrawString(FontManager.MiniFont, "Write new mail.", New Vector2(CInt(P.X) + 13, CInt(P.Y) + 14), Color.Black)
|
||||
Core.SpriteBatch.DrawString(FontManager.MainFont, "Write new mail.", New Vector2(CInt(P.X) + 13, CInt(P.Y) + 14), Color.Black)
|
||||
Else
|
||||
Dim item As Item = Item.GetItemByID(mail.MailID.ToString)
|
||||
|
||||
@ -82,7 +82,7 @@
|
||||
Canvas.DrawImageBorder(TextureManager.GetTexture("GUI\Menus\Menu", New Rectangle(x, y, 48, 48), ""), 1, New Rectangle(CInt(P.X), CInt(P.Y), 288, 32))
|
||||
Core.SpriteBatch.Draw(item.Texture, New Rectangle(CInt(P.X), CInt(P.Y), 48, 48), Color.White)
|
||||
|
||||
Core.SpriteBatch.DrawString(FontManager.MiniFont, mail.MailHeader, New Vector2(CInt(P.X) + 52, CInt(P.Y) + 14), Color.Black)
|
||||
Core.SpriteBatch.DrawString(FontManager.MainFont, mail.MailHeader, New Vector2(CInt(P.X) + 52, CInt(P.Y) + 14), Color.Black)
|
||||
|
||||
If mail.MailAttachment > -1 Then
|
||||
Dim t As TrophyInformation = GetTrophyInformation(mail.MailAttachment)
|
||||
@ -113,74 +113,88 @@
|
||||
c = Color.Gray
|
||||
End If
|
||||
|
||||
Core.SpriteBatch.DrawString(FontManager.InGameFont, "Header: " & mail.MailHeader, New Vector2(480, 92), c)
|
||||
Core.SpriteBatch.DrawString(FontManager.MainFont, "Header: " & mail.MailHeader, New Vector2(480, 92), c)
|
||||
|
||||
Canvas.DrawRectangle(New Rectangle(420, 140, 660, 2), Color.DarkGray)
|
||||
|
||||
Dim text As String = ("Text: (" & mail.MailText.Length & "/" & 200 & ")" & Environment.NewLine & Environment.NewLine & mail.MailText.Replace("<br>", Environment.NewLine)).CropStringToWidth(FontManager.MiniFont, 600)
|
||||
Dim text As String = ("Text: (" & mail.MailText.Length & "/" & 200 & ")" & Environment.NewLine & Environment.NewLine & mail.MailText.Replace("<br>", Environment.NewLine)).CropStringToWidth(FontManager.MainFont, 600)
|
||||
If EditMailIndex = 1 Then
|
||||
c = Color.Blue
|
||||
text &= "_"
|
||||
Else
|
||||
c = Color.Gray
|
||||
End If
|
||||
Core.SpriteBatch.DrawString(FontManager.MiniFont, text, New Vector2(430, 160), c)
|
||||
Core.SpriteBatch.DrawString(FontManager.MainFont, text, New Vector2(430, 160), c)
|
||||
|
||||
Dim yPlus As Integer = CInt(FontManager.MiniFont.MeasureString(text).Y)
|
||||
Dim yPlus As Integer = CInt(FontManager.MainFont.MeasureString(text).Y)
|
||||
|
||||
If EditMailIndex = 2 Then
|
||||
c = Color.Blue
|
||||
Else
|
||||
c = Color.Gray
|
||||
End If
|
||||
Core.SpriteBatch.DrawString(FontManager.MiniFont, "Signature: " & mail.MailSignature, New Vector2(430, yPlus + 200), c)
|
||||
Core.SpriteBatch.DrawString(FontManager.MainFont, "Signature: " & mail.MailSignature, New Vector2(430, yPlus + 200), c)
|
||||
|
||||
Canvas.DrawRectangle(New Rectangle(420, yPlus + 240, 660, 2), Color.DarkGray)
|
||||
|
||||
Core.SpriteBatch.DrawString(FontManager.MiniFont, "Mail OT: " & mail.MailSender & " (" & mail.MailOriginalTrainerOT & ")", New Vector2(430, yPlus + 260), Color.Black)
|
||||
Core.SpriteBatch.DrawString(FontManager.MainFont, "Mail OT: " & mail.MailSender & " (" & mail.MailOriginalTrainerOT & ")", New Vector2(430, yPlus + 260), Color.Black)
|
||||
|
||||
If EditMailIndex = 3 Then
|
||||
Canvas.DrawImageBorder(TextureManager.GetTexture("GUI\Menus\Menu", New Rectangle(0, 48, 48, 48), ""), 1, New Rectangle(440, yPlus + 320, 160, 32))
|
||||
Else
|
||||
Canvas.DrawImageBorder(TextureManager.GetTexture("GUI\Menus\Menu", New Rectangle(0, 0, 48, 48), ""), 1, New Rectangle(440, yPlus + 320, 160, 32))
|
||||
End If
|
||||
Core.SpriteBatch.DrawString(FontManager.MiniFont, "Attach", New Vector2(496, yPlus + 334), Color.Black)
|
||||
Core.SpriteBatch.DrawString(FontManager.MainFont, "Attach", New Vector2(CInt(524 - FontManager.MainFont.MeasureString("Attach").X / 2), yPlus + CInt(344 - FontManager.MainFont.MeasureString("Attach").Y / 2)), Color.Black)
|
||||
|
||||
If EditMailIndex = 4 Then
|
||||
Canvas.DrawImageBorder(TextureManager.GetTexture("GUI\Menus\Menu", New Rectangle(0, 48, 48, 48), ""), 1, New Rectangle(640, yPlus + 320, 160, 32))
|
||||
Else
|
||||
Canvas.DrawImageBorder(TextureManager.GetTexture("GUI\Menus\Menu", New Rectangle(0, 0, 48, 48), ""), 1, New Rectangle(640, yPlus + 320, 160, 32))
|
||||
End If
|
||||
Core.SpriteBatch.DrawString(FontManager.MiniFont, "Cancel", New Vector2(696, yPlus + 334), Color.Black)
|
||||
Core.SpriteBatch.DrawString(FontManager.MainFont, "Cancel", New Vector2(CInt(724 - FontManager.MainFont.MeasureString("Cancel").X / 2), yPlus + CInt(344 - FontManager.MainFont.MeasureString("Cancel").Y / 2)), Color.Black)
|
||||
Else
|
||||
Dim mail As Items.MailItem.MailData = Core.Player.Mails(index - 1)
|
||||
Dim item As Item = Item.GetItemByID(mail.MailID.ToString)
|
||||
|
||||
Core.SpriteBatch.Draw(item.Texture, New Rectangle(420, 84, 48, 48), Color.White)
|
||||
|
||||
Core.SpriteBatch.DrawString(FontManager.InGameFont, mail.MailHeader, New Vector2(480, 92), Color.Black)
|
||||
Core.SpriteBatch.DrawString(FontManager.MainFont, mail.MailHeader, New Vector2(480, 92), Color.Black)
|
||||
|
||||
Canvas.DrawRectangle(New Rectangle(420, 140, 660, 2), Color.DarkGray)
|
||||
|
||||
Dim text As String = ("Text: " & Environment.NewLine & Environment.NewLine & mail.MailText).CropStringToWidth(FontManager.MiniFont, 600)
|
||||
Core.SpriteBatch.DrawString(FontManager.MiniFont, text, New Vector2(430, 160), Color.Black)
|
||||
Dim text As String = ("Text: " & Environment.NewLine & Environment.NewLine & mail.MailText).CropStringToWidth(FontManager.MainFont, 600)
|
||||
Core.SpriteBatch.DrawString(FontManager.MainFont, text, New Vector2(430, 160), Color.Black)
|
||||
|
||||
Dim yPlus As Integer = CInt(FontManager.MiniFont.MeasureString(text).Y)
|
||||
Dim yPlus As Integer = CInt(FontManager.MainFont.MeasureString(text).Y)
|
||||
|
||||
Core.SpriteBatch.DrawString(FontManager.MiniFont, mail.MailSignature, New Vector2(430, yPlus + 200), Color.Black)
|
||||
Core.SpriteBatch.DrawString(FontManager.MainFont, mail.MailSignature, New Vector2(430, yPlus + 200), Color.Black)
|
||||
|
||||
Canvas.DrawRectangle(New Rectangle(420, yPlus + 240, 660, 2), Color.DarkGray)
|
||||
|
||||
Core.SpriteBatch.DrawString(FontManager.MiniFont, "Mail OT: " & mail.MailSender & " (" & mail.MailOriginalTrainerOT & ")", New Vector2(430, yPlus + 260), Color.Black)
|
||||
Core.SpriteBatch.DrawString(FontManager.MainFont, "Mail OT: " & mail.MailSender & " (" & mail.MailOriginalTrainerOT & ")", New Vector2(430, yPlus + 260), Color.Black)
|
||||
|
||||
If mail.MailAttachment > -1 Then
|
||||
Canvas.DrawRectangle(New Rectangle(420, yPlus + 300, 660, 2), Color.DarkGray)
|
||||
|
||||
Dim t As TrophyInformation = GetTrophyInformation(mail.MailAttachment)
|
||||
Core.SpriteBatch.DrawString(FontManager.MiniFont, "Trophy:", New Vector2(430, yPlus + 320), Color.Black)
|
||||
Core.SpriteBatch.DrawString(FontManager.MainFont, "Trophy:", New Vector2(430, yPlus + 320), Color.Black)
|
||||
Core.SpriteBatch.Draw(t.Texture, New Rectangle(430, yPlus + 340, 64, 64), Color.White)
|
||||
Core.SpriteBatch.DrawString(FontManager.MiniFont, (t.Name & Environment.NewLine & Environment.NewLine & t.Description).CropStringToWidth(FontManager.MiniFont, 500), New Vector2(510, yPlus + 340), Color.Black)
|
||||
Core.SpriteBatch.DrawString(FontManager.MainFont, (t.Name & Environment.NewLine & Environment.NewLine & t.Description).CropStringToWidth(FontManager.MainFont, 500), New Vector2(510, yPlus + 340), Color.Black)
|
||||
End If
|
||||
|
||||
If EditMailIndex = 0 Then
|
||||
Canvas.DrawImageBorder(TextureManager.GetTexture("GUI\Menus\Menu", New Rectangle(0, 48, 48, 48), ""), 1, New Rectangle(440, yPlus + 320, 160, 32))
|
||||
Else
|
||||
Canvas.DrawImageBorder(TextureManager.GetTexture("GUI\Menus\Menu", New Rectangle(0, 0, 48, 48), ""), 1, New Rectangle(440, yPlus + 320, 160, 32))
|
||||
End If
|
||||
Core.SpriteBatch.DrawString(FontManager.MainFont, "Attach", New Vector2(CInt(524 - FontManager.MainFont.MeasureString("Attach").X / 2), yPlus + CInt(344 - FontManager.MainFont.MeasureString("Attach").Y / 2)), Color.Black)
|
||||
|
||||
If EditMailIndex = 1 Then
|
||||
Canvas.DrawImageBorder(TextureManager.GetTexture("GUI\Menus\Menu", New Rectangle(0, 48, 48, 48), ""), 1, New Rectangle(640, yPlus + 320, 160, 32))
|
||||
Else
|
||||
Canvas.DrawImageBorder(TextureManager.GetTexture("GUI\Menus\Menu", New Rectangle(0, 0, 48, 48), ""), 1, New Rectangle(640, yPlus + 320, 160, 32))
|
||||
End If
|
||||
Core.SpriteBatch.DrawString(FontManager.MainFont, "Cancel", New Vector2(CInt(724 - FontManager.MainFont.MeasureString("Cancel").X / 2), yPlus + CInt(344 - FontManager.MainFont.MeasureString("Cancel").Y / 2)), Color.Black)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
@ -194,54 +208,123 @@
|
||||
End If
|
||||
|
||||
If index <> 0 Then
|
||||
If Controls.Down(True, True, True, True, True) = True Then
|
||||
Me.selectIndex += 1
|
||||
If Me.selectIndex = Me.index And Me.selectIndex < Core.Player.Mails.Count Then
|
||||
Me.selectIndex += 1
|
||||
If index > -1 Then
|
||||
|
||||
Dim pressedSystemKey As Boolean = False
|
||||
If Controls.Down(True, True, True, False, True) = True Or KeyBoardHandler.KeyPressed(Keys.Tab) = True And Controls.ShiftDown() = False Then
|
||||
EditMailIndex += 1
|
||||
End If
|
||||
End If
|
||||
If Controls.Up(True, True, True, True, True) = True Then
|
||||
Me.selectIndex -= 1
|
||||
If Me.selectIndex = Me.index And Me.selectIndex > 0 Then
|
||||
Me.selectIndex -= 1
|
||||
If Controls.Up(True, True, True, False, True) = True Or KeyBoardHandler.KeyPressed(Keys.Tab) = True And Controls.ShiftDown() = True Then
|
||||
EditMailIndex -= 1
|
||||
End If
|
||||
End If
|
||||
|
||||
selectIndex = selectIndex.Clamp(0, Core.Player.Mails.Count)
|
||||
|
||||
While selectIndex - scrollIndex > 8
|
||||
scrollIndex += 1
|
||||
End While
|
||||
|
||||
While selectIndex - scrollIndex < 0
|
||||
scrollIndex -= 1
|
||||
End While
|
||||
|
||||
If Controls.Accept(True, True, True) = True Then
|
||||
If Me.selectIndex = 0 Then
|
||||
Dim selScreen As New NewInventoryScreen(Core.CurrentScreen, {5}, 5, Nothing)
|
||||
selScreen.Mode = Screens.UI.ISelectionScreen.ScreenMode.Selection
|
||||
selScreen.CanExit = True
|
||||
|
||||
AddHandler selScreen.SelectedObject, AddressOf ChosenMailHandler
|
||||
Core.SetScreen(selScreen)
|
||||
Else
|
||||
If Me.index = Me.selectIndex Then
|
||||
Me.index = -1
|
||||
Else
|
||||
Me.index = Me.selectIndex
|
||||
|
||||
Dim m As Items.MailItem.MailData = Core.Player.Mails(Me.index - 1)
|
||||
Core.Player.Mails(Me.index - 1) = New Items.MailItem.MailData With {.MailHeader = m.MailHeader, .MailID = m.MailID, .MailOriginalTrainerOT = m.MailOriginalTrainerOT, .MailAttachment = m.MailAttachment, .MailRead = True, .MailSender = m.MailSender, .MailSignature = m.MailSignature, .MailText = m.MailText}
|
||||
If Controls.Left(True, True, False, False, False) = True Then
|
||||
If EditMailIndex = 1 Then
|
||||
EditMailIndex -= 1
|
||||
End If
|
||||
End If
|
||||
If Controls.Right(True, True, False, False, False) = True Then
|
||||
If EditMailIndex = 0 Then
|
||||
EditMailIndex += 1
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
If Controls.Dismiss(True, True, True) = True Then
|
||||
SoundManager.PlaySound("select")
|
||||
If Me.index <> -1 Then
|
||||
EditMailIndex = EditMailIndex.Clamp(0, 1)
|
||||
|
||||
If Controls.Accept(False, True, True) = True Then
|
||||
|
||||
If EditMailIndex = 0 Then
|
||||
Me.TempNewMail = Core.Player.Mails(Me.index - 1)
|
||||
SoundManager.PlaySound("select")
|
||||
Dim selScreen = New PartyScreen(Me, Item.GetItemByID(TempNewMail.MailID.ToString), AddressOf Me.ChosenPokemon, "Give mail to:", True) With {.Mode = Screens.UI.ISelectionScreen.ScreenMode.Selection, .CanExit = True}
|
||||
AddHandler selScreen.SelectedObject, AddressOf ChosenPokemonHandler
|
||||
|
||||
Core.SetScreen(selScreen)
|
||||
Else
|
||||
Me.index = -1
|
||||
EditMailIndex = 0
|
||||
|
||||
End If
|
||||
End If
|
||||
|
||||
Dim text As String = ("Text: (" & Core.Player.Mails(Me.index - 1).MailText.Length & "/" & 200 & ")" & Environment.NewLine & Environment.NewLine & Core.Player.Mails(Me.index - 1).MailText.Replace("<br>", Environment.NewLine)).CropStringToWidth(FontManager.MainFont, 600)
|
||||
Dim yPlus As Integer = CInt(FontManager.MainFont.MeasureString(text).Y)
|
||||
|
||||
If Controls.Accept(True, False, False) = True Then
|
||||
If New Rectangle(440, yPlus + 320, 160, 32).Contains(MouseHandler.MousePosition) Then
|
||||
EditMailIndex = 0
|
||||
End If
|
||||
If New Rectangle(640, yPlus + 320, 160, 32).Contains(MouseHandler.MousePosition) Then
|
||||
EditMailIndex = 1
|
||||
End If
|
||||
|
||||
If EditMailIndex = 0 Then
|
||||
Me.TempNewMail = Core.Player.Mails(Me.index - 1)
|
||||
SoundManager.PlaySound("select")
|
||||
Dim selScreen = New PartyScreen(Me, Item.GetItemByID(TempNewMail.MailID.ToString), AddressOf Me.ChosenPokemon, "Give mail to:", True) With {.Mode = Screens.UI.ISelectionScreen.ScreenMode.Selection, .CanExit = True}
|
||||
AddHandler selScreen.SelectedObject, AddressOf ChosenPokemonHandler
|
||||
|
||||
Core.SetScreen(selScreen)
|
||||
Else
|
||||
Me.index = -1
|
||||
EditMailIndex = 0
|
||||
|
||||
End If
|
||||
End If
|
||||
|
||||
If Controls.Dismiss(True, True, True) = True Then
|
||||
SoundManager.PlaySound("select")
|
||||
Me.index = -1
|
||||
Else
|
||||
|
||||
End If
|
||||
Else
|
||||
|
||||
If Controls.Down(True, True, True, True, True) = True Then
|
||||
Me.selectIndex += 1
|
||||
If Me.selectIndex = Me.index And Me.selectIndex < Core.Player.Mails.Count Then
|
||||
Me.selectIndex += 1
|
||||
End If
|
||||
End If
|
||||
If Controls.Up(True, True, True, True, True) = True Then
|
||||
Me.selectIndex -= 1
|
||||
If Me.selectIndex = Me.index And Me.selectIndex > 0 Then
|
||||
Me.selectIndex -= 1
|
||||
End If
|
||||
End If
|
||||
|
||||
selectIndex = selectIndex.Clamp(0, Core.Player.Mails.Count)
|
||||
|
||||
While selectIndex - scrollIndex > 8
|
||||
scrollIndex += 1
|
||||
End While
|
||||
|
||||
While selectIndex - scrollIndex < 0
|
||||
scrollIndex -= 1
|
||||
End While
|
||||
|
||||
If Controls.Accept(True, True, True) = True Then
|
||||
If Me.selectIndex = 0 Then
|
||||
SoundManager.PlaySound("select")
|
||||
Dim selScreen As New NewInventoryScreen(Core.CurrentScreen, {5}, 5, Nothing)
|
||||
selScreen.Mode = Screens.UI.ISelectionScreen.ScreenMode.Selection
|
||||
selScreen.CanExit = True
|
||||
|
||||
AddHandler selScreen.SelectedObject, AddressOf ChosenMailHandler
|
||||
Core.SetScreen(selScreen)
|
||||
Else
|
||||
SoundManager.PlaySound("select")
|
||||
If Me.index = Me.selectIndex Then
|
||||
Me.index = -1
|
||||
Else
|
||||
Me.index = Me.selectIndex
|
||||
|
||||
Dim m As Items.MailItem.MailData = Core.Player.Mails(Me.index - 1)
|
||||
Core.Player.Mails(Me.index - 1) = New Items.MailItem.MailData With {.MailHeader = m.MailHeader, .MailID = m.MailID, .MailOriginalTrainerOT = m.MailOriginalTrainerOT, .MailAttachment = m.MailAttachment, .MailRead = True, .MailSender = m.MailSender, .MailSignature = m.MailSignature, .MailText = m.MailText}
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
If Controls.Dismiss(True, True, True) = True Then
|
||||
SoundManager.PlaySound("select")
|
||||
Core.SetScreen(New TransitionScreen(Me, Me.PreScreen, Color.White, False))
|
||||
End If
|
||||
End If
|
||||
@ -255,8 +338,27 @@
|
||||
EditMailIndex -= 1
|
||||
pressedSystemKey = True
|
||||
End If
|
||||
If Controls.Left(True, True, False, False, False) = True Or Controls.Right(True, True, False, False, False) = True Then
|
||||
If Controls.Left(True, True, False, False, False) = True Then
|
||||
pressedSystemKey = True
|
||||
If EditMailIndex = 4 Then
|
||||
EditMailIndex -= 1
|
||||
End If
|
||||
End If
|
||||
If Controls.Right(True, True, False, False, False) = True Then
|
||||
pressedSystemKey = True
|
||||
If EditMailIndex = 3 Then
|
||||
EditMailIndex += 1
|
||||
End If
|
||||
End If
|
||||
If Controls.Left(False, False, True, True, True) = True Then
|
||||
If EditMailIndex = 1 Then
|
||||
EditMailIndex -= 1
|
||||
End If
|
||||
End If
|
||||
If Controls.Right(False, False, True, True, True) = True Then
|
||||
If EditMailIndex = 0 Then
|
||||
EditMailIndex += 1
|
||||
End If
|
||||
End If
|
||||
|
||||
EditMailIndex = EditMailIndex.Clamp(0, 4)
|
||||
@ -275,9 +377,10 @@
|
||||
End Select
|
||||
End If
|
||||
|
||||
If Controls.Accept(True, True, True) = True Then
|
||||
If Controls.Accept(False, True, True) = True Then
|
||||
Select Case EditMailIndex
|
||||
Case 3
|
||||
SoundManager.PlaySound("select")
|
||||
If TempNewMail.MailHeader = "" Or TempNewMail.MailText = "" Or TempNewMail.MailSignature = "" Then
|
||||
message = "Please fill in the Header, the Message and the Signature."
|
||||
Else
|
||||
@ -287,7 +390,48 @@
|
||||
Core.SetScreen(selScreen)
|
||||
End If
|
||||
Case 4
|
||||
SoundManager.PlaySound("select")
|
||||
Me.index = -1
|
||||
EditMailIndex = 0
|
||||
End Select
|
||||
End If
|
||||
|
||||
Dim rect As Rectangle = New Rectangle(400, 64, 672, 576)
|
||||
Dim text As String = ("Text: (" & TempNewMail.MailText.Length & "/" & 200 & ")" & Environment.NewLine & Environment.NewLine & TempNewMail.MailText.Replace("<br>", Environment.NewLine)).CropStringToWidth(FontManager.MainFont, 600)
|
||||
Dim yPlus As Integer = CInt(FontManager.MainFont.MeasureString(text).Y)
|
||||
|
||||
If Controls.Accept(True, False, False) = True Then
|
||||
If New Rectangle(420, 92, 660, 40).Contains(MouseHandler.MousePosition) Then
|
||||
EditMailIndex = 0
|
||||
End If
|
||||
If New Rectangle(420, 140, 660, yPlus + 20).Contains(MouseHandler.MousePosition) Then
|
||||
EditMailIndex = 1
|
||||
End If
|
||||
If New Rectangle(420, yPlus + 200, 660, 40).Contains(MouseHandler.MousePosition) Then
|
||||
EditMailIndex = 2
|
||||
End If
|
||||
If New Rectangle(440, yPlus + 320, 160, 32).Contains(MouseHandler.MousePosition) Then
|
||||
EditMailIndex = 3
|
||||
End If
|
||||
If New Rectangle(640, yPlus + 320, 160, 32).Contains(MouseHandler.MousePosition) Then
|
||||
EditMailIndex = 4
|
||||
End If
|
||||
|
||||
Select Case EditMailIndex
|
||||
Case 3
|
||||
SoundManager.PlaySound("select")
|
||||
If TempNewMail.MailHeader = "" Or TempNewMail.MailText = "" Or TempNewMail.MailSignature = "" Then
|
||||
message = "Please fill in the Header, the Message and the Signature."
|
||||
Else
|
||||
Dim selScreen = New PartyScreen(Me, Item.GetItemByID(TempNewMail.MailID.ToString), AddressOf Me.ChosenPokemon, "Give mail to:", True) With {.Mode = Screens.UI.ISelectionScreen.ScreenMode.Selection, .CanExit = True}
|
||||
AddHandler selScreen.SelectedObject, AddressOf ChosenPokemonHandler
|
||||
|
||||
Core.SetScreen(selScreen)
|
||||
End If
|
||||
Case 4
|
||||
SoundManager.PlaySound("select")
|
||||
Me.index = -1
|
||||
EditMailIndex = 0
|
||||
End Select
|
||||
End If
|
||||
|
||||
@ -321,22 +465,29 @@
|
||||
End Sub
|
||||
|
||||
Private Sub ChosenPokemon(ByVal PokeIndex As Integer)
|
||||
Dim text As String = "Attached the Mail to " & Core.Player.Pokemons(PokeIndex).GetDisplayName() & "."
|
||||
If Not Core.Player.Pokemons(PokeIndex).Item Is Nothing Then
|
||||
If Core.Player.Pokemons(PokeIndex).Item.IsGameModeItem Then
|
||||
Core.Player.Inventory.AddItem(Core.Player.Pokemons(PokeIndex).Item.gmID, 1)
|
||||
Else
|
||||
Core.Player.Inventory.AddItem(Core.Player.Pokemons(PokeIndex).Item.ID.ToString, 1)
|
||||
End If
|
||||
|
||||
text = "Taken " & Core.Player.Pokemons(PokeIndex).Item.Name & " from " & Core.Player.Pokemons(PokeIndex).GetDisplayName() & ", and attached the Mail to " & Core.Player.Pokemons(PokeIndex).GetDisplayName() & "."
|
||||
End If
|
||||
|
||||
Core.Player.Pokemons(PokeIndex).Item = Item.GetItemByID(TempNewMail.MailID.ToString)
|
||||
Core.Player.Pokemons(PokeIndex).Item.AdditionalData = Items.MailItem.GetStringFromMail(TempNewMail)
|
||||
|
||||
Core.Player.Inventory.RemoveItem(TempNewMail.MailID.ToString, 1)
|
||||
If index = 0 Then
|
||||
Core.Player.Inventory.RemoveItem(TempNewMail.MailID.ToString, 1)
|
||||
Else
|
||||
Core.Player.Mails.RemoveAt(Me.index - 1)
|
||||
selectIndex -= 1
|
||||
selectIndex = selectIndex.Clamp(0, Core.Player.Mails.Count)
|
||||
End If
|
||||
Me.index = -1
|
||||
|
||||
Me.message = "Attached the Mail to " & Core.Player.Pokemons(PokeIndex).GetDisplayName() & "."
|
||||
Me.message = text
|
||||
End Sub
|
||||
|
||||
#Region "Trophies"
|
||||
|
Loading…
x
Reference in New Issue
Block a user