Removed file items

Will be replaced with better solution later on
This commit is contained in:
nilllzz 2016-09-21 00:56:01 +02:00
parent 4ce2be7c08
commit 44d5729462
7 changed files with 0 additions and 244 deletions

View File

@ -1036,7 +1036,6 @@
<Compile Include="Pokemon\Items\Berries\WikiBerry.vb" />
<Compile Include="Pokemon\Items\Berries\YacheBerry.vb" />
<Compile Include="Pokemon\Items\Berry.vb" />
<Compile Include="Pokemon\Items\FileItem.vb" />
<Compile Include="Pokemon\Items\Item.vb" />
<Compile Include="Pokemon\Items\ItemAttribute.vb" />
<Compile Include="Pokemon\Items\ItemType.vb" />

View File

@ -1 +0,0 @@
{Id|Name|Price|ItemType|CatchMultiplier|SortValue|Description|TextureRectangle|TextureSource|ScriptBinding|CanBeUsed,CanBeTraded,CanBeHold,isBall}

View File

@ -350,7 +350,6 @@
Public LastPokemonPosition As Vector3 = New Vector3(999, 999, 999)
Public PokeFiles As New List(Of String)
Public EarnedAchievements As New List(Of String)
Public FileItems As New List(Of Items.FileItem)
Public PokegearModules As New List(Of Integer)
Public PhoneContacts As New List(Of String)
Public Mails As New List(Of Items.MailItem.MailData)
@ -510,7 +509,6 @@
GameModeManager.SetGameModePointer(GameMode)
End If
GameModeManager.LoadFileItems()
BattleSystem.GameModeAttackLoader.Load()
If IsGameJoltSave = True Then
@ -1832,7 +1830,6 @@
Badges.Clear()
PokeFiles.Clear()
EarnedAchievements.Clear()
FileItems.Clear()
PokegearModules.Clear()
PhoneContacts.Clear()
Mails.Clear()

View File

@ -1,199 +0,0 @@
Namespace Items
''' <summary>
''' This class enables content creators to create own items with own images, functions and stats.
''' </summary>
Public Class FileItem
Inherits Item
Private _isValid As Boolean = True
Private _scriptBinding As String = ""
''' <summary>
''' Returns the item of the FileItem class.
''' </summary>
Public ReadOnly Property Item() As Item
Get
Return Me
End Get
End Property
''' <summary>
''' Returns if the FileItem is generated in a valid state.
''' </summary>
Public ReadOnly Property IsValid() As Boolean
Get
Return Me._isValid
End Get
End Property
''' <summary>
''' This is the script binding that represents the script that gets executed once the item gets used.
''' </summary>
Public Property ScriptBinding() As String
Get
Return Me._scriptBinding
End Get
Set(value As String)
Me._scriptBinding = value
End Set
End Property
''' <summary>
''' Iniztializes a new FileItem class.
''' </summary>
Public Sub New(ByVal data As String)
data = data.Remove(0, 1)
data = data.Remove(data.Length - 1, 1)
Dim dataArr() As String = data.Split(CChar("|"))
Dim ID As Integer = 0
Dim Name As String = ""
Dim Price As Integer = 0
Dim ItemType As Items.ItemTypes = Game.Items.ItemTypes.Standard
Dim CatchMultiplier As Single = 0.0F
Dim SortValue As Integer = 0
Dim Description As String = ""
Dim TextureRectangle As Rectangle = Nothing
Dim TextureSource As String = ""
Dim ScriptBinding As String = ""
If dataArr.Count = 11 Then
If IsNumeric(dataArr(0)) = True Then
ID = CInt(dataArr(0))
Else
Logger.Log(Logger.LogTypes.ErrorMessage, "FileItem.vb: The field for ""ID"" did not have the correct data type (int).")
Me._isValid = False
End If
If dataArr(1) <> "" Then
Name = dataArr(1)
Else
Logger.Log(Logger.LogTypes.ErrorMessage, "FileItem.vb: The field for ""Name"" cannot be empty.")
Me._isValid = False
End If
If IsNumeric(dataArr(2)) = True Then
Price = CInt(dataArr(2))
Else
Logger.Log(Logger.LogTypes.ErrorMessage, "FileItem.vb: The field for ""Price"" did not have the correct data type (int).")
Me._isValid = False
End If
Select Case dataArr(3).ToLower()
Case "standard"
ItemType = ItemTypes.Standard
Case "medicine"
ItemType = ItemTypes.Medicine
Case "plants"
ItemType = ItemTypes.Plants
Case "pokeballs", "pokéballs"
ItemType = ItemTypes.Pokéballs
Case "machines"
ItemType = ItemTypes.Machines
Case "keyitems", "keyitem"
ItemType = ItemTypes.KeyItems
Case "mail"
ItemType = ItemTypes.Mail
Case "battleitems"
ItemType = ItemTypes.BattleItems
Case Else
Logger.Log(Logger.LogTypes.ErrorMessage, "FileItem.vb: The field for ""ItemType"" did not contain an ItemType data type.")
Me._isValid = False
End Select
If IsNumeric(dataArr(4).Replace(".", GameController.DecSeparator)) = True Then
CatchMultiplier = CSng(dataArr(4).Replace(".", GameController.DecSeparator))
Else
Logger.Log(Logger.LogTypes.ErrorMessage, "FileItem.vb: The field for ""CatchMultiplier"" did not have the correct data type (sng).")
Me._isValid = False
End If
If IsNumeric(dataArr(5)) = True Then
SortValue = CInt(dataArr(5))
Else
Logger.Log(Logger.LogTypes.ErrorMessage, "FileItem.vb: The field for ""SortValue"" did not have the correct data type (int).")
Me._isValid = False
End If
If dataArr(6) <> "" Then
Description = dataArr(6)
Else
Logger.Log(Logger.LogTypes.ErrorMessage, "FileItem.vb: The field for ""Description"" cannot be empty.")
Me._isValid = False
End If
If dataArr(7).CountSeperators(",") = 3 Then
Dim texData() As String = dataArr(7).Split(CChar(","))
If texData.ToList().IsNumericList() = True Then
TextureRectangle = New Rectangle(CInt(texData(0)), CInt(texData(1)), CInt(texData(2)), CInt(texData(3)))
Else
Logger.Log(Logger.LogTypes.ErrorMessage, "FileItem.vb: The field for ""TextureRectangle"" contains invalid data.")
Me._isValid = False
End If
Else
Logger.Log(Logger.LogTypes.ErrorMessage, "FileItem.vb: The field for ""TextureRectangle"" contains invalid data.")
Me._isValid = False
End If
TextureSource = dataArr(8)
If dataArr(9) <> "" Then
ScriptBinding = dataArr(9)
Else
Logger.Log(Logger.LogTypes.ErrorMessage, "FileItem.vb: The field for ""ScriptBinding"" cannot be empty.")
Me._isValid = False
End If
If dataArr(10).CountSeperators(",") = 3 Then
Dim attData() As String = dataArr(10).Split(CChar(","))
If attData.ToList().IsBooleanicList() = True Then
Me._canBeUsed = CBool(attData(0))
Me._canBeTraded = CBool(attData(1))
Me._canBeHold = CBool(attData(2))
Me._isBall = CBool(attData(3))
If Me._isBall = True Then
Me._canBeUsedInBattle = True
End If
Else
Logger.Log(Logger.LogTypes.ErrorMessage, "FileItem.vb: The field for ""ItemAttributes"" contains invalid data.")
Me._isValid = False
End If
Else
Logger.Log(Logger.LogTypes.ErrorMessage, "FileItem.vb: The field for ""ItemAttributes"" contains invalid data.")
Me._isValid = False
End If
Else
Logger.Log(Logger.LogTypes.ErrorMessage, "FileItem.vb: The array length (" & dataArr.Count & ") was smaller or greater than expected (11).")
Me._isValid = False
End If
If Me._isValid = True Then
Me.Initialize(Name, Price, ItemType, ID, CatchMultiplier, SortValue, TextureRectangle, Description)
Me._scriptBinding = ScriptBinding
If TextureSource.ToLower() <> "items\itemsheet" And TextureSource <> "" Then
Me._texture = TextureManager.GetTexture(TextureSource, TextureRectangle, "")
End If
End If
End Sub
Public Overrides Sub Use()
Dim s As Screen = Core.CurrentScreen
While s.Identification <> Screen.Identifications.OverworldScreen And Not s.PreScreen Is Nothing
s = s.PreScreen
End While
If s.Identification = Screen.Identifications.OverworldScreen Then
Core.SetScreen(s)
CType(s, OverworldScreen).ActionScript.StartScript(Me._scriptBinding, 0)
Else
Logger.Log(Logger.LogTypes.Warning, "FileItem.vb: The Item """ & Me.Name & """ created by the GameMode """ & GameModeManager.ActiveGameMode.Name & """ was used in a bad environment.")
End If
End Sub
End Class
End Namespace

View File

@ -247,13 +247,6 @@ Public MustInherit Class Item
''' </summary>
''' <param name="ID">The desired item's ID.</param>
Public Shared Function GetItemByID(ByVal ID As Integer) As Item
'Check if the ID is available in the FileItem list.
For Each f As FileItem In Core.Player.FileItems
If f.Item.ID = ID Then
Return f.Item
End If
Next
If _itemBuffer Is Nothing Then
LoadItemBuffer()
End If
@ -273,13 +266,6 @@ Public MustInherit Class Item
''' </summary>
''' <param name="name">The name of the item.</param>
Public Shared Function GetItemByName(ByVal name As String) As Item
'Check if the name is available in the FileItem list.
For Each FileItem As Items.FileItem In Core.Player.FileItems
If FileItem.Item.Name.ToLower() = name.ToLower() Then
Return FileItem.Item
End If
Next
Dim type = _itemBuffer.FirstOrDefault(Function(itemTypePair)
Return itemTypePair.Key.Name.ToLowerInvariant() = name.ToLowerInvariant()
End Function).Value

View File

@ -259,31 +259,6 @@ start:
Return GameController.GamePath & GameMode.DefaultContentPath & ContentFile
End Function
''' <summary>
''' Loads the FileItems for the loaded player file.
''' </summary>
Public Shared Sub LoadFileItems()
If Not Core.Player Is Nothing Then
Core.Player.FileItems.Clear()
If ActiveGameMode.IsDefaultGamemode = False Then
Dim path As String = GameController.GamePath & ActiveGameMode.ContentPath & "\Data\items.dat"
If System.IO.File.Exists(path) = True Then
Dim c() As String = System.IO.File.ReadAllLines(path)
For Each line As String In c
If line.StartsWith("{") = True And line.EndsWith("}") = True Then
Dim fileItem As New Items.FileItem(line)
If fileItem.IsValid = True Then
Core.Player.FileItems.Add(fileItem)
End If
End If
Next
End If
End If
End If
End Sub
''' <summary>
''' Checks if a map file exists either in the active GameMode or the default GameMode.
''' </summary>

View File

@ -47,7 +47,6 @@
ContentPackManager.Load(GameController.GamePath & "\ContentPacks\" & s & "\exceptions.dat")
Next
GameModeManager.LoadFileItems()
BattleSystem.GameModeAttackLoader.Load()
Localization.ReloadGameModeTokens()