P3D-Legacy/P3D/Pokemon/Items/MailItem.vb

61 lines
1.9 KiB
VB.net
Raw Normal View History

2016-09-19 03:26:44 +02:00
Namespace Items
2016-09-07 18:50:38 +02:00
''' <summary>
''' The basic item that represents a Mail Item.
''' </summary>
Public MustInherit Class MailItem
2016-09-07 18:50:38 +02:00
Inherits Item
Public Structure MailData
Dim MailID As Integer
Dim MailHeader As String
Dim MailText As String
Dim MailSender As String
Dim MailAttachment As Integer
Dim MailSignature As String
Dim MailOriginalTrainerOT As String
Dim MailRead As Boolean
End Structure
2016-09-20 02:18:12 +02:00
Public Overrides ReadOnly Property CanBeUsedInBattle As Boolean = False
Public Overrides ReadOnly Property ItemType As ItemTypes = ItemTypes.Mail
2016-09-20 06:18:09 +02:00
Public Overrides ReadOnly Property PokeDollarPrice As Integer = 50
2016-09-07 18:50:38 +02:00
Public Shared Function GetMailDataFromString(ByVal s As String) As MailData
If s.Contains("|") = True Then
s = s.Replace("|", "\,")
End If
Dim data() As String = s.Split("\,")
Dim mail As New MailData
mail.MailID = CInt(data(0))
mail.MailSender = data(1)
mail.MailHeader = data(2)
mail.MailText = data(3)
mail.MailSignature = data(4)
mail.MailAttachment = CInt(data(5))
mail.MailOriginalTrainerOT = data(6)
mail.MailRead = CBool(data(7))
Return mail
End Function
Public Shared Function GetStringFromMail(ByVal mail As MailData) As String
Dim s As String = mail.MailID.ToString() & "\," &
mail.MailSender & "\," &
mail.MailHeader & "\," &
mail.MailText & "\," &
mail.MailSignature & "\," &
mail.MailAttachment.ToString() & "\," &
mail.MailOriginalTrainerOT & "\," &
mail.MailRead.ToNumberString()
Return s
End Function
End Class
2016-09-19 03:26:44 +02:00
End Namespace