diff --git a/P3D/Battle/BattleSystemV2/Battle.vb b/P3D/Battle/BattleSystemV2/Battle.vb
index 1c0a4fb96..9ea4f423e 100644
--- a/P3D/Battle/BattleSystemV2/Battle.vb
+++ b/P3D/Battle/BattleSystemV2/Battle.vb
@@ -496,10 +496,20 @@
End Select
Next
Dim p As Pokemon = BattleScreen.OppPokemon
- If p.Item IsNot Nothing AndAlso p.Item.IsMegaStone = True Then
- Dim megaStone = CType(p.Item, Items.MegaStone)
- If p.Number = megaStone.MegaPokemonNumber Then
- BattleScreen.IsMegaEvolvingOpp = True
+ If p.Item IsNot Nothing Then
+ If p.Item.IsGameModeItem = True Then
+ If p.Item.gmIsMegaStone = True Then
+ If p.Number = CType(p.Item, GameModeItem).gmMegaPokemonNumber Then
+ BattleScreen.IsMegaEvolvingOpp = True
+ End If
+ End If
+ Else
+ If p.Item.IsMegaStone = True Then
+ Dim megaStone = CType(p.Item, Items.MegaStone)
+ If p.Number = megaStone.MegaPokemonNumber Then
+ BattleScreen.IsMegaEvolvingOpp = True
+ End If
+ End If
End If
End If
End Sub
@@ -2474,9 +2484,11 @@
canSteal = False
End If
If canSteal Then
- Dim ItemID As Integer = p.Item.ID
-
- p.OriginalItem = Item.GetItemByID(p.Item.ID)
+ Dim ItemID As String = p.Item.ID.ToString
+ If p.Item.IsGameModeItem = True Then
+ ItemID = p.Item.gmID
+ End If
+ p.OriginalItem = Item.GetItemByID(ItemID)
p.OriginalItem.AdditionalData = p.Item.AdditionalData
If BattleScreen.Battle.RemoveHeldItem(own, Not own, BattleScreen, op.GetDisplayName() & " stole an item from " & p.GetDisplayName() & " due to " & op.Ability.Name & "!", op.Ability.Name.ToLower()) Then
@@ -2520,9 +2532,14 @@
canSteal = False
End If
If canSteal Then
- Dim ItemID As Integer = op.Item.ID
+ Dim ItemID As String
+ If op.Item.IsGameModeItem = True Then
+ ItemID = op.Item.gmID
+ Else
+ ItemID = op.Item.ID.ToString
+ End If
- op.OriginalItem = Item.GetItemByID(op.Item.ID)
+ op.OriginalItem = Item.GetItemByID(ItemID)
op.OriginalItem.AdditionalData = op.Item.AdditionalData
If BattleScreen.Battle.RemoveHeldItem(Not own, own, BattleScreen, p.GetDisplayName() & " stole an item from " & op.GetDisplayName() & " due to " & p.Ability.Name & "!", p.Ability.Name.ToLower()) Then
@@ -2651,7 +2668,7 @@
If Core.Random.Next(0, 2) = 0 AndAlso moveUsed.MakesContact = True AndAlso op.Item Is Nothing AndAlso op.HP > 0 Then
ChangeCameraAngle(2, own, BattleScreen)
BattleScreen.BattleQuery.Add(New TextQueryObject(p.GetDisplayName() & "'s Sticky Barb was passed over to " & op.GetDisplayName() & "."))
- op.Item = Item.GetItemByID(p.Item.ID)
+ op.Item = Item.GetItemByID(p.Item.ID.ToString)
p.Item = Nothing
End If 'CODELINE OF EVIL
End If
@@ -4485,7 +4502,7 @@
If Not p.Item Is Nothing Then
If p.Item.OriginalName.ToLower() = "enigma" And BattleScreen.FieldEffects.CanUseItem(own) = True And BattleScreen.FieldEffects.CanUseOwnItem(own, BattleScreen) = True Then
If RemoveHeldItem(own, own, BattleScreen, "", "berry:enigma") = True Then
- UseBerry(own, from, Item.GetItemByID(ItemID), BattleScreen, message, cause)
+ UseBerry(own, from, Item.GetItemByID(ItemID.ToString), BattleScreen, message, cause)
End If
End If
End If
@@ -4496,7 +4513,7 @@
If Not p.Item Is Nothing Then
If p.Item.OriginalName.ToLower() = "oran" And BattleScreen.FieldEffects.CanUseItem(own) = True And BattleScreen.FieldEffects.CanUseOwnItem(own, BattleScreen) = True Then
If RemoveHeldItem(own, own, BattleScreen, "", "berry:oran") = True Then
- UseBerry(own, from, Item.GetItemByID(ItemID), BattleScreen, message, cause)
+ UseBerry(own, from, Item.GetItemByID(ItemID.ToString), BattleScreen, message, cause)
End If
End If
End If
@@ -4507,7 +4524,7 @@
Select Case p.Item.OriginalName.ToLower()
Case "sitrus"
If RemoveHeldItem(own, own, BattleScreen, "", "berry:sitrus") = True Then
- UseBerry(own, from, Item.GetItemByID(ItemID), BattleScreen, message, cause)
+ UseBerry(own, from, Item.GetItemByID(ItemID.ToString), BattleScreen, message, cause)
End If
End Select
End If
@@ -4519,59 +4536,59 @@
Select Case p.Item.OriginalName.ToLower()
Case "figy"
If RemoveHeldItem(own, own, BattleScreen, "", "berry:figy") = True Then
- UseBerry(own, from, Item.GetItemByID(ItemID), BattleScreen, message, cause)
+ UseBerry(own, from, Item.GetItemByID(ItemID.ToString), BattleScreen, message, cause)
End If
Case "wiki"
If RemoveHeldItem(own, own, BattleScreen, "", "berry:wiki") = True Then
- UseBerry(own, from, Item.GetItemByID(ItemID), BattleScreen, message, cause)
+ UseBerry(own, from, Item.GetItemByID(ItemID.ToString), BattleScreen, message, cause)
End If
Case "mago"
If RemoveHeldItem(own, own, BattleScreen, "", "berry:mago") = True Then
- UseBerry(own, from, Item.GetItemByID(ItemID), BattleScreen, message, cause)
+ UseBerry(own, from, Item.GetItemByID(ItemID.ToString), BattleScreen, message, cause)
End If
Case "aguav"
If RemoveHeldItem(own, own, BattleScreen, "", "berry:aguav") = True Then
- UseBerry(own, from, Item.GetItemByID(ItemID), BattleScreen, message, cause)
+ UseBerry(own, from, Item.GetItemByID(ItemID.ToString), BattleScreen, message, cause)
End If
Case "iapapa"
If RemoveHeldItem(own, own, BattleScreen, "", "berry:iapapa") = True Then
- UseBerry(own, from, Item.GetItemByID(ItemID), BattleScreen, message, cause)
+ UseBerry(own, from, Item.GetItemByID(ItemID.ToString), BattleScreen, message, cause)
End If
Case "liechi"
If RemoveHeldItem(own, own, BattleScreen, "", "berry:liechi") = True Then
- UseBerry(own, from, Item.GetItemByID(ItemID), BattleScreen, message, cause)
+ UseBerry(own, from, Item.GetItemByID(ItemID.ToString), BattleScreen, message, cause)
End If
Case "ganlon"
If RemoveHeldItem(own, own, BattleScreen, "", "berry:ganlon") = True Then
- UseBerry(own, from, Item.GetItemByID(ItemID), BattleScreen, message, cause)
+ UseBerry(own, from, Item.GetItemByID(ItemID.ToString), BattleScreen, message, cause)
End If
Case "salac"
If RemoveHeldItem(own, own, BattleScreen, "", "berry:salac") = True Then
- UseBerry(own, from, Item.GetItemByID(ItemID), BattleScreen, message, cause)
+ UseBerry(own, from, Item.GetItemByID(ItemID.ToString), BattleScreen, message, cause)
End If
Case "petaya"
If RemoveHeldItem(own, own, BattleScreen, "", "berry:petaya") = True Then
- UseBerry(own, from, Item.GetItemByID(ItemID), BattleScreen, message, cause)
+ UseBerry(own, from, Item.GetItemByID(ItemID.ToString), BattleScreen, message, cause)
End If
Case "apicot"
If RemoveHeldItem(own, own, BattleScreen, "", "berry:apicot") = True Then
- UseBerry(own, from, Item.GetItemByID(ItemID), BattleScreen, message, cause)
+ UseBerry(own, from, Item.GetItemByID(ItemID.ToString), BattleScreen, message, cause)
End If
Case "lansat"
If RemoveHeldItem(own, own, BattleScreen, "", "berry:lansat") = True Then
- UseBerry(own, from, Item.GetItemByID(ItemID), BattleScreen, message, cause)
+ UseBerry(own, from, Item.GetItemByID(ItemID.ToString), BattleScreen, message, cause)
End If
Case "starf"
If RemoveHeldItem(own, own, BattleScreen, "", "berry:starf") = True Then
- UseBerry(own, from, Item.GetItemByID(ItemID), BattleScreen, message, cause)
+ UseBerry(own, from, Item.GetItemByID(ItemID.ToString), BattleScreen, message, cause)
End If
Case "micle"
If RemoveHeldItem(own, own, BattleScreen, "", "berry:micle") = True Then
- UseBerry(own, from, Item.GetItemByID(ItemID), BattleScreen, message, cause)
+ UseBerry(own, from, Item.GetItemByID(ItemID.ToString), BattleScreen, message, cause)
End If
Case "custap"
If RemoveHeldItem(own, own, BattleScreen, "", "berry:custap") = True Then
- UseBerry(own, from, Item.GetItemByID(ItemID), BattleScreen, message, cause)
+ UseBerry(own, from, Item.GetItemByID(ItemID.ToString), BattleScreen, message, cause)
End If
End Select
End If
@@ -4710,7 +4727,7 @@
If TestFor = False Then
Dim ItemID As Integer = p.Item.ID
- Dim lostItem As Item = Item.GetItemByID(ItemID)
+ Dim lostItem As Item = Item.GetItemByID(ItemID.ToString)
If from = own Then
If own = True Then
diff --git a/P3D/Battle/BattleSystemV2/BattleMenu.vb b/P3D/Battle/BattleSystemV2/BattleMenu.vb
index 7fe88f745..eab390740 100644
--- a/P3D/Battle/BattleSystemV2/BattleMenu.vb
+++ b/P3D/Battle/BattleSystemV2/BattleMenu.vb
@@ -631,7 +631,7 @@
TempBattleScreen = BattleScreen
Player.Temp.PokemonScreenIndex = BattleScreen.OwnPokemonIndex
- Dim selScreen = New PartyScreen(Core.CurrentScreen, Item.GetItemByID(5), AddressOf ShowPokemonMenu, "Choose Pokémon", False) With {.Mode = Screens.UI.ISelectionScreen.ScreenMode.Selection, .CanExit = False}
+ Dim selScreen = New PartyScreen(Core.CurrentScreen, Item.GetItemByID(5.ToString), AddressOf ShowPokemonMenu, "Choose Pokémon", False) With {.Mode = Screens.UI.ISelectionScreen.ScreenMode.Selection, .CanExit = False}
AddHandler selScreen.SelectedObject, AddressOf ShowPokemonMenuHandler
Core.SetScreen(selScreen)
@@ -651,8 +651,8 @@
_mainMenuItemList.Clear()
Select Case BattleScreen.BattleMode
Case BattleSystem.BattleScreen.BattleModes.Safari
- Dim safariBallText As String = "Safari Ball x" & Core.Player.Inventory.GetItemAmount(181).ToString()
- If Core.Player.Inventory.GetItemAmount(181) = 0 Then
+ Dim safariBallText As String = "Safari Ball x" & Core.Player.Inventory.GetItemAmount(181.ToString).ToString()
+ If Core.Player.Inventory.GetItemAmount(181.ToString) = 0 Then
safariBallText = "No Safari Balls."
End If
_mainMenuItemList.Add(New MainMenuItem(4, safariBallText, 0, AddressOf MainMenuUseSafariBall))
@@ -664,8 +664,8 @@
Case BattleSystem.BattleScreen.BattleModes.BugContest
_mainMenuItemList.Add(New MainMenuItem(0, "Battle", 0, AddressOf MainMenuOpenBattleMenu))
- Dim sportBallText As String = "Sport Ball x" & Core.Player.Inventory.GetItemAmount(177).ToString()
- If Core.Player.Inventory.GetItemAmount(177) = 0 Then
+ Dim sportBallText As String = "Sport Ball x" & Core.Player.Inventory.GetItemAmount(177.ToString).ToString()
+ If Core.Player.Inventory.GetItemAmount(177.ToString) = 0 Then
sportBallText = "No Sport Balls."
End If
_mainMenuItemList.Add(New MainMenuItem(4, sportBallText, 1, AddressOf MainMenuUseSportBall))
@@ -715,7 +715,7 @@
Private Sub MainMenuAddMegaEvolution(ByVal BattleScreen As BattleScreen, ByVal Index As Integer)
'Checks if the player has the Mega Bracelet.
- If Not (Core.Player.Inventory.GetItemAmount(576) > 0) Then
+ If Not (Core.Player.Inventory.GetItemAmount(576.ToString) > 0) Then
Exit Sub
End If
@@ -738,12 +738,19 @@
'Next
Dim PokeIndex As Integer = BattleScreen.OwnPokemonIndex
If BattleScreen.FieldEffects.OwnMegaEvolved = False Then
- If Not Core.Player.Pokemons(PokeIndex).Item Is Nothing Then
- If Core.Player.Pokemons(PokeIndex).Item.IsMegaStone = True Then
- Dim megaStone = CType(Core.Player.Pokemons(PokeIndex).Item, Items.MegaStone)
-
- If megaStone.MegaPokemonNumber = Core.Player.Pokemons(PokeIndex).Number Then
- _mainMenuItemList.Add(New MainMenuItem(5, "Mega Evolve!", Index, AddressOf MainMenuMegaEvolve))
+ If Core.Player.Pokemons(PokeIndex).Item IsNot Nothing Then
+ If Core.Player.Pokemons(PokeIndex).Item.IsGameModeItem = True Then
+ If Core.Player.Pokemons(PokeIndex).Item.gmIsMegaStone = True Then
+ If Core.Player.Pokemons(PokeIndex).Number = CType(Core.Player.Pokemons(PokeIndex).Item, GameModeItem).gmMegaPokemonNumber Then
+ _mainMenuItemList.Add(New MainMenuItem(5, "Mega Evolve!", Index, AddressOf MainMenuMegaEvolve))
+ End If
+ End If
+ Else
+ If Core.Player.Pokemons(PokeIndex).Item.IsMegaStone = True Then
+ Dim megaStone = CType(Core.Player.Pokemons(PokeIndex).Item, Items.MegaStone)
+ If megaStone.MegaPokemonNumber = Core.Player.Pokemons(PokeIndex).Number Then
+ _mainMenuItemList.Add(New MainMenuItem(5, "Mega Evolve!", Index, AddressOf MainMenuMegaEvolve))
+ End If
End If
End If
End If
@@ -767,7 +774,7 @@
TempBattleScreen = BattleScreen
Player.Temp.PokemonScreenIndex = BattleScreen.OwnPokemonIndex
- Dim selScreen = New PartyScreen(Core.CurrentScreen, Item.GetItemByID(5), AddressOf ShowPokemonMenu, "Choose Pokémon", True) With {.Mode = Screens.UI.ISelectionScreen.ScreenMode.Selection, .CanExit = True}
+ Dim selScreen = New PartyScreen(Core.CurrentScreen, Item.GetItemByID(5.ToString), AddressOf ShowPokemonMenu, "Choose Pokémon", True) With {.Mode = Screens.UI.ISelectionScreen.ScreenMode.Selection, .CanExit = True}
AddHandler selScreen.SelectedObject, AddressOf ShowPokemonMenuHandler
Core.SetScreen(selScreen)
@@ -805,15 +812,15 @@
End Sub
Private Sub MainMenuUseSafariBall(ByVal BattleScreen As BattleScreen)
- If Core.Player.Inventory.GetItemAmount(181) > 0 Then
- Core.Player.Inventory.RemoveItem(181, 1)
+ If Core.Player.Inventory.GetItemAmount(181.ToString) > 0 Then
+ Core.Player.Inventory.RemoveItem(181.ToString, 1)
BattleScreen.BattleQuery.Clear()
BattleScreen.BattleQuery.Add(BattleScreen.FocusBattle())
BattleScreen.BattleQuery.Insert(0, New ToggleMenuQueryObject(True))
- Core.SetScreen(New BattleCatchScreen(BattleScreen, Item.GetItemByID(181)))
+ Core.SetScreen(New BattleCatchScreen(BattleScreen, Item.GetItemByID(181.ToString)))
- Dim safariBallText As String = "Safari Ball x" & Core.Player.Inventory.GetItemAmount(181).ToString()
- If Core.Player.Inventory.GetItemAmount(181) = 0 Then
+ Dim safariBallText As String = "Safari Ball x" & Core.Player.Inventory.GetItemAmount(181.ToString).ToString()
+ If Core.Player.Inventory.GetItemAmount(181.ToString) = 0 Then
safariBallText = "No Safari Balls."
End If
_mainMenuItemList(0).Text = safariBallText
@@ -821,15 +828,15 @@
End Sub
Private Sub MainMenuUseSportBall(ByVal BattleScreen As BattleScreen)
- If Core.Player.Inventory.GetItemAmount(177) > 0 Then
- Core.Player.Inventory.RemoveItem(177, 1)
+ If Core.Player.Inventory.GetItemAmount(177.ToString) > 0 Then
+ Core.Player.Inventory.RemoveItem(177.ToString, 1)
BattleScreen.BattleQuery.Clear()
BattleScreen.BattleQuery.Add(BattleScreen.FocusBattle())
BattleScreen.BattleQuery.Insert(0, New ToggleMenuQueryObject(True))
- Core.SetScreen(New BattleCatchScreen(BattleScreen, Item.GetItemByID(177)))
+ Core.SetScreen(New BattleCatchScreen(BattleScreen, Item.GetItemByID(177.ToString)))
- Dim sportBallText As String = "Sport Ball x" & Core.Player.Inventory.GetItemAmount(177).ToString()
- If Core.Player.Inventory.GetItemAmount(177) = 0 Then
+ Dim sportBallText As String = "Sport Ball x" & Core.Player.Inventory.GetItemAmount(177.ToString).ToString()
+ If Core.Player.Inventory.GetItemAmount(177.ToString) = 0 Then
sportBallText = "No Sport Balls."
End If
_mainMenuItemList(0).Text = sportBallText
@@ -1056,17 +1063,17 @@
End Sub
Private Shared Sub SelectedItem(ByVal itemID As Integer)
- Dim Item As Item = Item.GetItemByID(itemID)
+ Dim Item As Item = Item.GetItemByID(itemID.ToString)
If Item.CanBeUsedInBattle = True Then
If Item.IsBall = True Then
- Core.Player.Inventory.RemoveItem(itemID, 1)
+ Core.Player.Inventory.RemoveItem(itemID.ToString, 1)
If TempBattleScreen.IsTrainerBattle = False Then
If BattleScreen.CanCatch = True Or CBool(GameModeManager.GetGameRuleValue("OnlyCaptureFirst", "0")) = True And Core.Player.PokeFiles.Contains(BattleScreen.TempPokeFile) = True Then
TempBattleScreen.BattleQuery.Clear()
TempBattleScreen.BattleQuery.Add(TempBattleScreen.FocusBattle())
TempBattleScreen.BattleQuery.Insert(0, New ToggleMenuQueryObject(True))
- Core.SetScreen(New BattleCatchScreen(TempBattleScreen, Item.GetItemByID(itemID)))
+ Core.SetScreen(New BattleCatchScreen(TempBattleScreen, Item.GetItemByID(itemID.ToString)))
PlayerStatistics.Track("[4]Poké Balls used", 1)
Else
TempBattleScreen.BattleQuery.Clear()
@@ -1105,7 +1112,7 @@
Private Shared Sub UseItem(ByVal PokeIndex As Integer)
Dim Pokemon As Pokemon = Core.Player.Pokemons(PokeIndex)
- Dim Item As Item = Item.GetItemByID(TempItemID)
+ Dim Item As Item = Item.GetItemByID(TempItemID.ToString)
If Item.UseOnPokemon(PokeIndex) = True Then
TempBattleScreen.BattleQuery.Clear()
diff --git a/P3D/Battle/BattleSystemV2/BattleScreen.vb b/P3D/Battle/BattleSystemV2/BattleScreen.vb
index 163e4617c..280c711e7 100644
--- a/P3D/Battle/BattleSystemV2/BattleScreen.vb
+++ b/P3D/Battle/BattleSystemV2/BattleScreen.vb
@@ -1250,7 +1250,7 @@ nextIndex:
End If
If IsRemoteBattle = True Then
If p.OriginalItem IsNot Nothing Then
- p.Item = P3D.Item.GetItemByID(p.OriginalItem.ID)
+ p.Item = P3D.Item.GetItemByID(p.OriginalItem.ID.ToString)
p.Item.AdditionalData = p.OriginalItem.AdditionalData
Screen.TextBox.Show(Core.Player.Name & " received~" & p.OriginalItem.Name & "and gave it back to~" & p.GetDisplayName)
p.OriginalItem = Nothing
@@ -1258,12 +1258,12 @@ nextIndex:
Else
If Not p.OriginalItem Is Nothing Then
If p.Item Is Nothing Then
- p.Item = P3D.Item.GetItemByID(p.OriginalItem.ID)
+ p.Item = P3D.Item.GetItemByID(p.OriginalItem.ID.ToString)
p.Item.AdditionalData = p.OriginalItem.AdditionalData
Screen.TextBox.Show(Core.Player.Name & " found~" & p.OriginalItem.Name & "*and gave it back to~" & p.GetDisplayName)
p.OriginalItem = Nothing
Else
- Core.Player.Inventory.AddItem(p.OriginalItem.ID, 1)
+ Core.Player.Inventory.AddItem(p.OriginalItem.ID.ToString, 1)
SoundManager.PlaySound("item_found", True)
Screen.TextBox.Show(Core.Player.Name & " found~" & p.OriginalItem.Name & "!*" & Core.Player.Inventory.GetMessageReceive(p.OriginalItem, 1))
p.OriginalItem = Nothing
@@ -1303,7 +1303,7 @@ nextIndex:
If Not p.Item Is Nothing Then
If p.Item.IsBerry = True Then
If Core.Random.Next(0, 3) = 0 Then
- p.Item = Item.GetItemByID(139)
+ p.Item = Item.GetItemByID(139.ToString)
End If
End If
End If
@@ -1313,19 +1313,19 @@ nextIndex:
For Each p As Pokemon In Core.Player.Pokemons
If IsRemoteBattle = True Then
If p.OriginalItem IsNot Nothing Then
- p.Item = P3D.Item.GetItemByID(p.OriginalItem.ID)
+ p.Item = P3D.Item.GetItemByID(p.OriginalItem.ID.ToString)
p.Item.AdditionalData = p.OriginalItem.AdditionalData
Screen.TextBox.Show(Core.Player.Name & " received~" & p.OriginalItem.Name & "and gave it back to~" & p.GetDisplayName)
End If
Else
If Not p.OriginalItem Is Nothing Then
If p.Item IsNot Nothing Then
- Core.Player.Inventory.AddItem(p.OriginalItem.ID, 1)
+ Core.Player.Inventory.AddItem(p.OriginalItem.ID.ToString, 1)
SoundManager.PlaySound("item_found", True)
Screen.TextBox.Show(Core.Player.Name & " found~" & p.OriginalItem.Name & "!*" & Core.Player.Inventory.GetMessageReceive(p.OriginalItem, 1))
p.OriginalItem = Nothing
Else
- p.Item = P3D.Item.GetItemByID(p.OriginalItem.ID)
+ p.Item = P3D.Item.GetItemByID(p.OriginalItem.ID.ToString)
p.Item.AdditionalData = p.OriginalItem.AdditionalData
Screen.TextBox.Show(Core.Player.Name & " found~" & p.OriginalItem.Name & "*and gave it back to~" & p.GetDisplayName)
p.OriginalItem = Nothing
diff --git a/P3D/Battle/BattleSystemV2/FieldEffects.vb b/P3D/Battle/BattleSystemV2/FieldEffects.vb
index 5934e20d4..16b4d386f 100644
--- a/P3D/Battle/BattleSystemV2/FieldEffects.vb
+++ b/P3D/Battle/BattleSystemV2/FieldEffects.vb
@@ -281,7 +281,7 @@
'Special stuff
Public RunTries As Integer = 0
Public UsedPokemon As New List(Of Integer)
- Public StolenItemIDs As New List(Of Integer)
+ Public StolenItemIDs As New List(Of String)
Public DefeatedTrainerPokemon As Boolean = False
Public RoamingFled As Boolean = False
diff --git a/P3D/Battle/BattleSystemV2/QueryObjects/SwitchPokemonQueryObject.vb b/P3D/Battle/BattleSystemV2/QueryObjects/SwitchPokemonQueryObject.vb
index 449c1dca3..5cf15a1fd 100644
--- a/P3D/Battle/BattleSystemV2/QueryObjects/SwitchPokemonQueryObject.vb
+++ b/P3D/Battle/BattleSystemV2/QueryObjects/SwitchPokemonQueryObject.vb
@@ -89,7 +89,7 @@
If rec.Contains(MouseHandler.MousePosition) = False Then
If Controls.Accept(True, True, True) = True Then
If _chooseIndex = 0 Then
- Dim selScreen = New PartyScreen(Core.CurrentScreen, Item.GetItemByID(5), AddressOf ChoosePokemon, Localization.GetString("battle_main_choose_pokemon"), False) With {.Mode = Screens.UI.ISelectionScreen.ScreenMode.Selection, .CanExit = True}
+ Dim selScreen = New PartyScreen(Core.CurrentScreen, Item.GetItemByID(5.ToString), AddressOf ChoosePokemon, Localization.GetString("battle_main_choose_pokemon"), False) With {.Mode = Screens.UI.ISelectionScreen.ScreenMode.Selection, .CanExit = True}
AddHandler selScreen.SelectedObject, AddressOf ChoosePokemonHandler
SoundManager.PlaySound("select")
Core.SetScreen(selScreen)
@@ -109,7 +109,7 @@
Else
If Controls.Accept(False, True, True) = True Then
If _chooseIndex = 0 Then
- Dim selScreen = New PartyScreen(Core.CurrentScreen, Item.GetItemByID(5), AddressOf ChoosePokemon, Localization.GetString("battle_main_choose_pokemon"), False) With {.Mode = Screens.UI.ISelectionScreen.ScreenMode.Selection, .CanExit = True}
+ Dim selScreen = New PartyScreen(Core.CurrentScreen, Item.GetItemByID(5.ToString), AddressOf ChoosePokemon, Localization.GetString("battle_main_choose_pokemon"), False) With {.Mode = Screens.UI.ISelectionScreen.ScreenMode.Selection, .CanExit = True}
AddHandler selScreen.SelectedObject, AddressOf ChoosePokemonHandler
SoundManager.PlaySound("select")
Core.SetScreen(selScreen)
@@ -129,7 +129,7 @@
If Controls.Accept(True, False, False) Then
If New Rectangle(Core.windowSize.Width - 213, Core.windowSize.Height - 438, 80, 50).Contains(MouseHandler.MousePosition) Then
_chooseIndex = 0
- Dim selScreen = New PartyScreen(Core.CurrentScreen, Item.GetItemByID(5), AddressOf ChoosePokemon, Localization.GetString("battle_main_choose_pokemon"), False) With {.Mode = Screens.UI.ISelectionScreen.ScreenMode.Selection, .CanExit = True}
+ Dim selScreen = New PartyScreen(Core.CurrentScreen, Item.GetItemByID(5.ToString), AddressOf ChoosePokemon, Localization.GetString("battle_main_choose_pokemon"), False) With {.Mode = Screens.UI.ISelectionScreen.ScreenMode.Selection, .CanExit = True}
AddHandler selScreen.SelectedObject, AddressOf ChoosePokemonHandler
SoundManager.PlaySound("select")
Core.SetScreen(selScreen)
diff --git a/P3D/Battle/Trainer.vb b/P3D/Battle/Trainer.vb
index c6eeec33c..2cf02921a 100644
--- a/P3D/Battle/Trainer.vb
+++ b/P3D/Battle/Trainer.vb
@@ -179,7 +179,7 @@ Public Class Trainer
If value <> "" Then
Dim itemData() As String = ScriptCommander.Parse(value).ToString().Split(CChar(","))
For Each ItemID As String In itemData
- Items.Add(Item.GetItemByID(CInt(ItemID)))
+ Items.Add(Item.GetItemByID(CInt(ItemID).ToString))
Next
End If
Case "gender"
diff --git a/P3D/Entites/Enviroment/ApricornPlant.vb b/P3D/Entites/Enviroment/ApricornPlant.vb
index 01e4f9828..31c33855b 100644
--- a/P3D/Entites/Enviroment/ApricornPlant.vb
+++ b/P3D/Entites/Enviroment/ApricornPlant.vb
@@ -145,8 +145,13 @@
Public Overrides Sub ResultFunction(Result As Integer)
If Result = 0 Then
Dim Item As Item = GetItem()
-
- Core.Player.Inventory.AddItem(Item.ID, 1)
+ Dim ItemID As String
+ If Item.IsGameModeItem Then
+ ItemID = Item.gmID
+ Else
+ ItemID = Item.ID.ToString
+ End If
+ Core.Player.Inventory.AddItem(ItemID, 1)
PlayerStatistics.Track("[85]Apricorns picked", 1)
SoundManager.PlaySound("Receive_Item", True)
Screen.TextBox.TextColor = TextBox.PlayerColor
@@ -193,7 +198,7 @@
ItemID = 101
End Select
- Return Item.GetItemByID(ItemID)
+ Return Item.GetItemByID(ItemID.ToString)
End Function
End Class
\ No newline at end of file
diff --git a/P3D/Entites/Enviroment/BerryPlant.vb b/P3D/Entites/Enviroment/BerryPlant.vb
index 2556723f5..c68a3b90b 100644
--- a/P3D/Entites/Enviroment/BerryPlant.vb
+++ b/P3D/Entites/Enviroment/BerryPlant.vb
@@ -16,7 +16,7 @@
Dim LastUpdateDate As Date
Public Overloads Sub Initialize(ByVal BerryIndex As Integer, ByVal BerriesYield As Integer, ByVal Watered As String, ByVal Time As String, ByVal FullGrown As Boolean)
- Me.Berry = CType(Item.GetItemByID(BerryIndex + 2000), Items.Berry)
+ Me.Berry = CType(Item.GetItemByID(CStr(BerryIndex + 2000)), Items.Berry)
Me.Berries = BerriesYield
Me.PlantDate = Time
Me.BerryIndex = BerryIndex
@@ -130,7 +130,7 @@
Dim text As String = ""
Dim hasBottle As Boolean = False
- If Core.Player.Inventory.GetItemAmount(175) > 0 Then
+ If Core.Player.Inventory.GetItemAmount(175.ToString) > 0 Then
hasBottle = True
End If
@@ -180,7 +180,7 @@
If Result = 0 Then
Select Case Me.ResultIndex
Case 0
- Core.Player.Inventory.AddItem(Me.Berry.ID, Me.Berries)
+ Core.Player.Inventory.AddItem(Me.Berry.ID.ToString, Me.Berries)
Dim Text As String = ""
If Me.Berries = 1 Then
Text = Core.Player.Name & " picked the~" & Berry.Name & " Berry.*" & Core.Player.Inventory.GetMessageReceive(Berry, Me.Berries)
@@ -235,7 +235,7 @@
Dim cD As Date = Date.Now
Dim DateData As String = cD.Year & "," & cD.Month & "," & cD.Day & "," & cD.TimeOfDay.Hours & "," & cD.TimeOfDay.Minutes & "," & cD.TimeOfDay.Seconds
- Dim Berry As Items.Berry = CType(Item.GetItemByID(BerryIndex + 2000), Items.Berry)
+ Dim Berry As Items.Berry = CType(Item.GetItemByID(CStr(BerryIndex + 2000)), Items.Berry)
Dim BerryAmount As Integer = GetBerryAmount(Berry, 0)
@@ -257,7 +257,7 @@
CType(newEnt, BerryPlant).Initialize(BerryIndex, 0, "", DateData, False)
Screen.Level.Entities.Add(newEnt)
- Core.Player.Inventory.RemoveItem(BerryIndex + 2000, 1)
+ Core.Player.Inventory.RemoveItem(CStr(BerryIndex + 2000), 1)
End Sub
Private Shared Function GetBerryAmount(ByVal Berry As Items.Berry, ByVal Watered As Integer) As Integer
@@ -312,7 +312,7 @@
Dim DateData As String = PlantDate
- Dim Berry As Items.Berry = CType(Item.GetItemByID(BerryIndex + 2000), Items.Berry)
+ Dim Berry As Items.Berry = CType(Item.GetItemByID(CStr(BerryIndex + 2000)), Items.Berry)
Dim WateredData As String = ""
Dim wateredCount As Integer = 0
diff --git a/P3D/Entites/Enviroment/ItemObject.vb b/P3D/Entites/Enviroment/ItemObject.vb
index c7c81161d..1ce2d55e6 100644
--- a/P3D/Entites/Enviroment/ItemObject.vb
+++ b/P3D/Entites/Enviroment/ItemObject.vb
@@ -17,7 +17,7 @@
Public Overloads Sub Initialize(Optional ByVal AnimationData As List(Of List(Of Integer)) = Nothing)
MyBase.Initialize()
- Me.Item = Item.GetItemByID(CInt(Me.AdditionalValue.GetSplit(1)))
+ Me.Item = Item.GetItemByID(Me.AdditionalValue.GetSplit(1))
Me.ItemID = CInt(Me.AdditionalValue.GetSplit(0))
Me.Textures(0) = Me.Item.Texture
@@ -147,7 +147,13 @@
End If
Screen.TextBox.TextColor = TextBox.PlayerColor
Screen.TextBox.Show(Core.Player.Name & " found~" & Me.Item.Name & "!*" & Core.Player.Inventory.GetMessageReceive(Item, 1), {Me})
- Core.Player.Inventory.AddItem(Me.Item.ID, 1)
+ Dim ItemID As String
+ If Me.Item.IsGameModeItem Then
+ ItemID = Me.Item.gmID
+ Else
+ ItemID = Me.Item.ID.ToString
+ End If
+ Core.Player.Inventory.AddItem(ItemID, 1)
PlayerStatistics.Track("Items found", 1)
Core.Player.AddPoints(1, "Found an item.")
diff --git a/P3D/Entites/Enviroment/LoamySoil.vb b/P3D/Entites/Enviroment/LoamySoil.vb
index f455725e8..9cd89baa8 100644
--- a/P3D/Entites/Enviroment/LoamySoil.vb
+++ b/P3D/Entites/Enviroment/LoamySoil.vb
@@ -42,9 +42,9 @@
End Sub
Public Sub PlantBerry(ByVal ChosenBerry As Integer)
- Dim testItem As Item = Item.GetItemByID(ChosenBerry)
+ Dim testItem As Item = Item.GetItemByID(ChosenBerry.ToString)
If testItem.isBerry = True Then
- Dim Berry As Items.Berry = CType(Item.GetItemByID(ChosenBerry), Items.Berry)
+ Dim Berry As Items.Berry = CType(Item.GetItemByID(ChosenBerry.ToString), Items.Berry)
BerryPlant.AddBerryPlant(Screen.Level.LevelFile, Me.Position, Berry.BerryIndex)
Screen.TextBox.reDelay = 0.0F
diff --git a/P3D/Network/GameJolt/GTS/GTSSetupScreen.vb b/P3D/Network/GameJolt/GTS/GTSSetupScreen.vb
index 723d2fec8..c571616f0 100644
--- a/P3D/Network/GameJolt/GTS/GTSSetupScreen.vb
+++ b/P3D/Network/GameJolt/GTS/GTSSetupScreen.vb
@@ -722,7 +722,7 @@
Core.SetScreen(New SelectFriendScreen(Me))
End If
If New Rectangle(100, 300, 32 * 5 + 64, 32).Contains(MouseHandler.MousePosition) = True Then
- Dim selScreen = New PartyScreen(Me, Item.GetItemByID(5), AddressOf ChosenPokemon, "Choose Pokémon for Trade", True, True, False) With {.Mode = Screens.UI.ISelectionScreen.ScreenMode.Selection, .CanExit = True}
+ Dim selScreen = New PartyScreen(Me, Item.GetItemByID(5.ToString), AddressOf ChosenPokemon, "Choose Pokémon for Trade", True, True, False) With {.Mode = Screens.UI.ISelectionScreen.ScreenMode.Selection, .CanExit = True}
AddHandler selScreen.SelectedObject, AddressOf ChosenPokemonHandler
Core.SetScreen(selScreen)
diff --git a/P3D/Network/GameJolt/GTS/GTSTradeScreen.vb b/P3D/Network/GameJolt/GTS/GTSTradeScreen.vb
index 7b8525c53..4c70be957 100644
--- a/P3D/Network/GameJolt/GTS/GTSTradeScreen.vb
+++ b/P3D/Network/GameJolt/GTS/GTSTradeScreen.vb
@@ -45,7 +45,7 @@
If Controls.Accept(True, False) = True Then
If New Rectangle(180, 560, 32 * 5 + 64, 32).Contains(MouseHandler.MousePosition) = True Then
- Dim selScreen = New PartyScreen(Me, Item.GetItemByID(5), AddressOf ChosePokemon, "Choose Pokémon to trade", True) With {.Mode = Screens.UI.ISelectionScreen.ScreenMode.Selection, .CanExit = True}
+ Dim selScreen = New PartyScreen(Me, Item.GetItemByID(5.ToString), AddressOf ChosePokemon, "Choose Pokémon to trade", True) With {.Mode = Screens.UI.ISelectionScreen.ScreenMode.Selection, .CanExit = True}
AddHandler selScreen.SelectedObject, AddressOf ChosePokemonHandler
SoundManager.PlaySound("select")
Core.SetScreen(selScreen)
diff --git a/P3D/Network/GameJolt/GTS/WonderTradeScreen.vb b/P3D/Network/GameJolt/GTS/WonderTradeScreen.vb
index 682f39a5b..b3aebb997 100644
--- a/P3D/Network/GameJolt/GTS/WonderTradeScreen.vb
+++ b/P3D/Network/GameJolt/GTS/WonderTradeScreen.vb
@@ -204,7 +204,7 @@
If Me.OpenedSelect = True Then
Me.CloseScreen()
Else
- Dim selScreen = New PartyScreen(Core.CurrentScreen, Item.GetItemByID(5), AddressOf SelectPokemonForTrade, "Choose Pokémon for Trade", True, False, False) With {.Mode = Screens.UI.ISelectionScreen.ScreenMode.Selection, .CanExit = True}
+ Dim selScreen = New PartyScreen(Core.CurrentScreen, Item.GetItemByID(5.ToString), AddressOf SelectPokemonForTrade, "Choose Pokémon for Trade", True, False, False) With {.Mode = Screens.UI.ISelectionScreen.ScreenMode.Selection, .CanExit = True}
AddHandler selScreen.SelectedObject, AddressOf SelectPokemonForTradeHandler
Core.SetScreen(selScreen)
diff --git a/P3D/Network/Servers/DirectTradeScreen.vb b/P3D/Network/Servers/DirectTradeScreen.vb
index 9c42df54b..8576b5bc2 100644
--- a/P3D/Network/Servers/DirectTradeScreen.vb
+++ b/P3D/Network/Servers/DirectTradeScreen.vb
@@ -314,7 +314,7 @@
Case 0
Me.StartTrade()
Case 1
- Dim selScreen = New PartyScreen(Core.CurrentScreen, Item.GetItemByID(5), AddressOf SelectPokemonForTrade, "Choose Pokémon for Trade", True, False, False) With {.Mode = Screens.UI.ISelectionScreen.ScreenMode.Selection, .CanExit = True}
+ Dim selScreen = New PartyScreen(Core.CurrentScreen, Item.GetItemByID(5.ToString), AddressOf SelectPokemonForTrade, "Choose Pokémon for Trade", True, False, False) With {.Mode = Screens.UI.ISelectionScreen.ScreenMode.Selection, .CanExit = True}
AddHandler selScreen.SelectedObject, AddressOf SelectPokemonForTradeHandler
Core.SetScreen(selScreen)
diff --git a/P3D/Network/Servers/PVPLobbyScreen.vb b/P3D/Network/Servers/PVPLobbyScreen.vb
index 9c800cb07..f15976444 100644
--- a/P3D/Network/Servers/PVPLobbyScreen.vb
+++ b/P3D/Network/Servers/PVPLobbyScreen.vb
@@ -329,7 +329,7 @@
Private Sub StartBattle()
If Not Me.OwnTeam Is Nothing And Not OppTeam Is Nothing Then
- Dim selScreen = New PartyScreen(Core.CurrentScreen, Item.GetItemByID(5), AddressOf LeadPickedStart, "Choose your Lead", True, True, False, _pokemonList:=OwnTeam) With {.Mode = Screens.UI.ISelectionScreen.ScreenMode.Selection, .CanExit = True}
+ Dim selScreen = New PartyScreen(Core.CurrentScreen, Item.GetItemByID(5.ToString), AddressOf LeadPickedStart, "Choose your Lead", True, True, False, _pokemonList:=OwnTeam) With {.Mode = Screens.UI.ISelectionScreen.ScreenMode.Selection, .CanExit = True}
AddHandler selScreen.SelectedObject, AddressOf LeadPickedStartHandler
Core.SetScreen(selScreen)
diff --git a/P3D/P3D.vbproj b/P3D/P3D.vbproj
index 30a4ec7ef..e212a367b 100644
--- a/P3D/P3D.vbproj
+++ b/P3D/P3D.vbproj
@@ -18036,7 +18036,7 @@
PreserveNewest
- PreserveNewest
+ PreserveNewest
PreserveNewest
@@ -28460,6 +28460,7 @@
+
@@ -28478,6 +28479,7 @@
+
diff --git a/P3D/Player/Player.vb b/P3D/Player/Player.vb
index d0e2493fc..0ad0cacd2 100644
--- a/P3D/Player/Player.vb
+++ b/P3D/Player/Player.vb
@@ -534,6 +534,7 @@
GameModeManager.SetGameModePointer(GameMode)
BattleSystem.GameModeAttackLoader.Load()
+ GameModeItemLoader.Load()
If IsGameJoltSave = True Then
SandBoxMode = False
@@ -592,9 +593,9 @@
''' 2. Shiny Candy [ID: 501]
If Not ActionScript.IsRegistered("PokemonIndev054Update") Then
' Check Inventory.
- Inventory.RemoveItem(501)
+ Inventory.RemoveItem(501.ToString)
For i As Integer = 507 To 553 Step +1
- Inventory.RemoveItem(i)
+ Inventory.RemoveItem(i.ToString)
Next
' Check Party Pokemon.
@@ -958,7 +959,7 @@
Dim amount As Integer = CInt(ItemID.Remove(0, ItemID.IndexOf("|") + 1))
ItemID = ItemID.Remove(ItemID.IndexOf("|"))
- Inventory.AddItem(CInt(ItemID), amount)
+ Inventory.AddItem(ItemID, amount)
Else
If ItemDat <> "" And ItemDat.StartsWith("Mail|") = True Then
Dim mailData As String = ItemDat.Remove(0, 5)
@@ -1498,7 +1499,7 @@
End Sub
Private Sub SaveItems()
- Inventory.RemoveItem(177) 'Removing Sport Balls if player has those.
+ Inventory.RemoveItem(177.ToString) 'Removing Sport Balls if player has those.
Dim Data As String = GetItemsData()
@@ -1840,7 +1841,7 @@
":end"
If Temp.LastUsedRepel > -1 Then
- Dim haveItemLeft As Boolean = Inventory.GetItemAmount(Temp.LastUsedRepel) > 0
+ Dim haveItemLeft As Boolean = Inventory.GetItemAmount(Temp.LastUsedRepel.ToString) > 0
If haveItemLeft = True Then
s = "version=2" & Environment.NewLine &
diff --git a/P3D/Player/PlayerInventory.vb b/P3D/Player/PlayerInventory.vb
index b24ae1876..baf9ede5c 100644
--- a/P3D/Player/PlayerInventory.vb
+++ b/P3D/Player/PlayerInventory.vb
@@ -10,14 +10,14 @@ Public Class PlayerInventory
'''
Class ItemContainer
- Private _itemID As Integer
+ Private _itemID As String
Private _amount As Integer
- Public Property ItemID() As Integer
+ Public Property ItemID() As String
Get
Return Me._itemID
End Get
- Set(value As Integer)
+ Set(value As String)
Me._itemID = value
End Set
End Property
@@ -31,7 +31,7 @@ Public Class PlayerInventory
End Set
End Property
- Public Sub New(ByVal ItemID As Integer, ByVal Amount As Integer)
+ Public Sub New(ByVal ItemID As String, ByVal Amount As Integer)
Me.ItemID = ItemID
Me.Amount = Amount
End Sub
@@ -69,9 +69,7 @@ Public Class PlayerInventory
'''
''' The ID of the item.
''' Amount of items to add.
- Public Sub AddItem(ByVal ID As Integer, ByVal Amount As Integer)
- Dim newItem As Item = P3D.Item.GetItemByID(ID)
-
+ Public Sub AddItem(ByVal ID As String, ByVal Amount As Integer)
For Each c As ItemContainer In Me
If c.ItemID = ID Then
c.Amount += Amount
@@ -87,7 +85,7 @@ Public Class PlayerInventory
'''
''' The ID of the item to remove.
''' The amount of items to remove.
- Public Sub RemoveItem(ByVal ID As Integer, ByVal Amount As Integer)
+ Public Sub RemoveItem(ByVal ID As String, ByVal Amount As Integer)
If Amount > 0 Then
For Each c As ItemContainer In Me
If c.ItemID = ID Then
@@ -113,7 +111,7 @@ Public Class PlayerInventory
''' Removes all items of an ID from the inventory.
'''
''' The ID of the item.
- Public Sub RemoveItem(ByVal ID As Integer)
+ Public Sub RemoveItem(ByVal ID As String)
Dim Amount As Integer = Me.GetItemAmount(ID)
If Amount > 0 Then
Me.RemoveItem(ID, Amount)
@@ -124,7 +122,7 @@ Public Class PlayerInventory
''' Returns the count of the item in the inventory.
'''
''' The ID of the item to be counted.
- Public Function GetItemAmount(ByVal ID As Integer) As Integer
+ Public Function GetItemAmount(ByVal ID As String) As Integer
For Each c As ItemContainer In Me
If c.ItemID = ID Then
Return c.Amount
@@ -142,7 +140,7 @@ Public Class PlayerInventory
If Core.Player.SandBoxMode = True Or GameController.IS_DEBUG_ACTIVE = True Then
Return True
Else
- If Me.GetItemAmount(78) > 0 Then
+ If Me.GetItemAmount(78.ToString) > 0 Then
Return True
End If
End If
@@ -156,7 +154,7 @@ Public Class PlayerInventory
'''
Public ReadOnly Property HasMegaBracelet() As Boolean
Get
- If Me.GetItemAmount(576) > 0 Then
+ If Me.GetItemAmount(576.ToString) > 0 Then
Return True
End If
@@ -170,7 +168,7 @@ Public Class PlayerInventory
''' The Item to store in the inventory.
''' The amount.
Public Function GetMessageReceive(ByVal Item As Item, ByVal Amount As Integer) As String
- Dim Message As String = ""
+ Dim Message As String
If Amount = 1 Then
Message = Core.Player.Name & " stored it in the~" & Core.Player.Inventory.GetItemPocketChar(Item) & Item.ItemType.ToString() & " pocket."
Else
diff --git a/P3D/Pokemon/Abilities/Compoundeyes.vb b/P3D/Pokemon/Abilities/Compoundeyes.vb
index 26b90ecaf..15d315064 100644
--- a/P3D/Pokemon/Abilities/Compoundeyes.vb
+++ b/P3D/Pokemon/Abilities/Compoundeyes.vb
@@ -8,12 +8,12 @@ Namespace Abilities
MyBase.New(14, "Compoundeyes", "The Pokémon's accuracy is boosted.")
End Sub
- Public Shared Function ConvertItemChances(ByVal WildItems As Dictionary(Of Integer, Integer)) As Dictionary(Of Integer, Integer)
- Dim d As New Dictionary(Of Integer, Integer)
+ Public Shared Function ConvertItemChances(ByVal WildItems As Dictionary(Of Integer, String)) As Dictionary(Of Integer, String)
+ Dim d As New Dictionary(Of Integer, String)
For i = 0 To WildItems.Count - 1
Dim chance As Integer = WildItems.Keys(i)
- Dim itemID As Integer = WildItems.Values(i)
+ Dim itemID As String = WildItems.Values(CInt(i))
Select Case chance
Case 50
diff --git a/P3D/Pokemon/Abilities/HoneyGather.vb b/P3D/Pokemon/Abilities/HoneyGather.vb
index 74619063a..03a1fe65f 100644
--- a/P3D/Pokemon/Abilities/HoneyGather.vb
+++ b/P3D/Pokemon/Abilities/HoneyGather.vb
@@ -14,7 +14,7 @@ Namespace Abilities
If p.Item Is Nothing Then
Dim chance As Integer = CInt(Math.Ceiling(p.Level / 10) * 5)
If Core.Random.Next(0, 100) < chance Then
- p.Item = Item.GetItemByID(253)
+ p.Item = Item.GetItemByID(253.ToString)
End If
End If
End If
diff --git a/P3D/Pokemon/Abilities/Pickup.vb b/P3D/Pokemon/Abilities/Pickup.vb
index 719711812..3ddb6a211 100644
--- a/P3D/Pokemon/Abilities/Pickup.vb
+++ b/P3D/Pokemon/Abilities/Pickup.vb
@@ -24,7 +24,7 @@ Namespace Abilities
itemList = Get1(p)
End If
If itemList.Count > 0 Then
- p.Item = Item.GetItemByID(itemList(Core.Random.Next(0, itemList.Count)))
+ p.Item = Item.GetItemByID(itemList(Core.Random.Next(0, itemList.Count)).ToString)
End If
End If
End If
diff --git a/P3D/Pokemon/Attacks/Bug/BugBite.vb b/P3D/Pokemon/Attacks/Bug/BugBite.vb
index 4b4bce449..ed1a00a80 100644
--- a/P3D/Pokemon/Attacks/Bug/BugBite.vb
+++ b/P3D/Pokemon/Attacks/Bug/BugBite.vb
@@ -65,7 +65,7 @@
Dim ItemID As Integer = op.Item.ID
BattleScreen.Battle.RemoveHeldItem(Not own, own, BattleScreen, p.GetDisplayName() & " ate the " & op.Item.Name & " berry!", "move:bugbite")
- BattleScreen.Battle.UseBerry(own, own, Item.GetItemByID(ItemID), BattleScreen, "", "move:bugbite")
+ BattleScreen.Battle.UseBerry(own, own, Item.GetItemByID(ItemID.ToString), BattleScreen, "", "move:bugbite")
End If
End If
End Sub
diff --git a/P3D/Pokemon/Attacks/Dark/Fling.vb b/P3D/Pokemon/Attacks/Dark/Fling.vb
index 5c9e2f0e8..1e33f825f 100644
--- a/P3D/Pokemon/Attacks/Dark/Fling.vb
+++ b/P3D/Pokemon/Attacks/Dark/Fling.vb
@@ -141,7 +141,11 @@
End If
End Select
- p.OriginalItem = Item.GetItemByID(p.Item.ID)
+ Dim ItemID As String = p.Item.ID.ToString
+ If p.Item.IsGameModeItem = True Then
+ ItemID = p.Item.gmID
+ End If
+ p.OriginalItem = Item.GetItemByID(ItemID)
p.Item = Nothing
End If
End Sub
diff --git a/P3D/Pokemon/Attacks/Dark/KnockOff.vb b/P3D/Pokemon/Attacks/Dark/KnockOff.vb
index eccada254..a8d2434d6 100644
--- a/P3D/Pokemon/Attacks/Dark/KnockOff.vb
+++ b/P3D/Pokemon/Attacks/Dark/KnockOff.vb
@@ -117,7 +117,11 @@
Exit Sub
End If
- op.OriginalItem = Item.GetItemByID(op.Item.ID)
+ Dim ItemID As String = op.Item.ID.ToString
+ If op.Item.IsGameModeItem = True Then
+ ItemID = op.Item.gmID
+ End If
+ op.OriginalItem = Item.GetItemByID(ItemID)
op.OriginalItem.AdditionalData = op.Item.AdditionalData
BattleScreen.Battle.RemoveHeldItem(Not own, own, BattleScreen, p.GetDisplayName() & " knocked off the " & op.GetDisplayName() & "'s " & op.OriginalItem.Name & "!", "move:knockoff")
diff --git a/P3D/Pokemon/Attacks/Dark/Thief.vb b/P3D/Pokemon/Attacks/Dark/Thief.vb
index 9e349367b..d2ee2ccc3 100644
--- a/P3D/Pokemon/Attacks/Dark/Thief.vb
+++ b/P3D/Pokemon/Attacks/Dark/Thief.vb
@@ -84,9 +84,12 @@
End If
If p.Item Is Nothing Then
- Dim ItemID As Integer = op.Item.ID
+ Dim ItemID As String = op.Item.ID.ToString
+ If op.Item.IsGameModeItem = True Then
+ ItemID = op.Item.gmID
+ End If
- op.OriginalItem = Item.GetItemByID(op.Item.ID)
+ op.OriginalItem = Item.GetItemByID(ItemID)
op.OriginalItem.AdditionalData = op.Item.AdditionalData
If BattleScreen.Battle.RemoveHeldItem(Not own, own, BattleScreen, "Thief stole the item " & op.Item.Name & " from " & op.GetDisplayName() & "!", "move:thief") Then
diff --git a/P3D/Pokemon/Attacks/Flying/Pluck.vb b/P3D/Pokemon/Attacks/Flying/Pluck.vb
index bdd211b5e..0a9d16d9a 100644
--- a/P3D/Pokemon/Attacks/Flying/Pluck.vb
+++ b/P3D/Pokemon/Attacks/Flying/Pluck.vb
@@ -64,8 +64,15 @@ Namespace BattleSystem.Moves.Flying
End If
If Not op.Item Is Nothing Then
- If op.Item.isBerry = True Then
- BattleScreen.Battle.UseBerry(own, own, Item.GetItemByID(op.Item.ID), BattleScreen, "", "move:pluck")
+ If op.Item.IsBerry = True Then
+ Dim ItemID As String
+ If op.Item.IsGameModeItem Then
+ ItemID = op.Item.gmID
+ Else
+ ItemID = op.Item.ID.ToString
+ End If
+
+ BattleScreen.Battle.UseBerry(own, own, Item.GetItemByID(ItemID), BattleScreen, "", "move:pluck")
End If
End If
End Sub
diff --git a/P3D/Pokemon/Attacks/Normal/Bestow.vb b/P3D/Pokemon/Attacks/Normal/Bestow.vb
index eab339bf1..8c3349e3e 100644
--- a/P3D/Pokemon/Attacks/Normal/Bestow.vb
+++ b/P3D/Pokemon/Attacks/Normal/Bestow.vb
@@ -95,9 +95,12 @@
End If
If op.Item Is Nothing And a = True And b = False Then
- Dim ItemID As Integer = p.Item.ID
+ Dim ItemID As String = p.Item.ID.ToString
+ If p.Item.IsGameModeItem = True Then
+ ItemID = p.Item.gmID
+ End If
- p.OriginalItem = Item.GetItemByID(p.Item.ID)
+ p.OriginalItem = Item.GetItemByID(ItemID)
p.OriginalItem.AdditionalData = p.Item.AdditionalData
If BattleScreen.Battle.RemoveHeldItem(own, own, BattleScreen, op.GetDisplayName() & " received the item " & p.Item.Name & " from " & p.GetDisplayName() & "!", "move:bestow") Then
diff --git a/P3D/Pokemon/Attacks/Normal/Covet.vb b/P3D/Pokemon/Attacks/Normal/Covet.vb
index 83ddc199e..f7a93f8a0 100644
--- a/P3D/Pokemon/Attacks/Normal/Covet.vb
+++ b/P3D/Pokemon/Attacks/Normal/Covet.vb
@@ -87,9 +87,12 @@ Namespace BattleSystem.Moves.Normal
End If
If p.Item Is Nothing Then
- Dim ItemID As Integer = op.Item.ID
+ Dim ItemID As String = op.Item.ID.ToString
+ If op.Item.IsGameModeItem = True Then
+ ItemID = op.Item.gmID
+ End If
- op.OriginalItem = Item.GetItemByID(op.Item.ID)
+ op.OriginalItem = Item.GetItemByID(ItemID)
op.OriginalItem.AdditionalData = op.Item.AdditionalData
If BattleScreen.Battle.RemoveHeldItem(Not own, own, BattleScreen, "Covet stole the item " & op.Item.Name & " from " & op.GetDisplayName() & "!", "move:covet") Then
diff --git a/P3D/Pokemon/Attacks/Psychic/Trick.vb b/P3D/Pokemon/Attacks/Psychic/Trick.vb
index ca5bab148..a3750c1dd 100644
--- a/P3D/Pokemon/Attacks/Psychic/Trick.vb
+++ b/P3D/Pokemon/Attacks/Psychic/Trick.vb
@@ -125,11 +125,29 @@ Namespace BattleSystem.Moves.Psychic
op.Item = i1
If p.Item IsNot Nothing AndAlso p.OriginalItem IsNot Nothing Then
- If p.Item.ID = p.OriginalItem.ID AndAlso p.Item.AdditionalData = p.OriginalItem.AdditionalData Then
+ Dim pItemID As String = p.Item.ID.ToString
+ Dim pOriginalItemID As String = p.OriginalItem.ID.ToString
+ If p.Item.IsGameModeItem = True Then
+ pItemID = p.Item.gmID
+ End If
+ If p.OriginalItem.IsGameModeItem = True Then
+ pOriginalItemID = p.Item.gmID
+ End If
+
+ If pItemID = pOriginalItemID AndAlso p.Item.AdditionalData = p.OriginalItem.AdditionalData Then
p.OriginalItem = Nothing
End If
End If
If op.Item IsNot Nothing AndAlso op.OriginalItem IsNot Nothing Then
+ Dim opItemID As String = op.Item.ID.ToString
+ Dim opOriginalItemID As String = op.OriginalItem.ID.ToString
+ If op.Item.IsGameModeItem = True Then
+ opItemID = op.Item.gmID
+ End If
+ If op.OriginalItem.IsGameModeItem = True Then
+ opOriginalItemID = op.Item.gmID
+ End If
+
If op.Item.ID = op.OriginalItem.ID AndAlso op.Item.AdditionalData = op.OriginalItem.AdditionalData Then
p.OriginalItem = Nothing
End If
diff --git a/P3D/Pokemon/Items/Balls/SafariBall.vb b/P3D/Pokemon/Items/Balls/SafariBall.vb
index 4aec7f3cb..863f2d61a 100644
--- a/P3D/Pokemon/Items/Balls/SafariBall.vb
+++ b/P3D/Pokemon/Items/Balls/SafariBall.vb
@@ -5,7 +5,7 @@ Namespace Items.Balls
Inherits BallItem
- Public Overrides ReadOnly Property CanBeHold As Boolean = False
+ Public Overrides ReadOnly Property CanBeHeld As Boolean = False
Public Overrides ReadOnly Property Description As String = "A special Pokéball that is used only in the Great Marsh and the Safari Zone. It is decorated in a camouflage pattern."
Public Overrides ReadOnly Property PokeDollarPrice As Integer = 200
Public Overrides ReadOnly Property CatchMultiplier As Single = 1.5F
diff --git a/P3D/Pokemon/Items/Balls/SportBall.vb b/P3D/Pokemon/Items/Balls/SportBall.vb
index 983f74e3e..5077c5f7b 100644
--- a/P3D/Pokemon/Items/Balls/SportBall.vb
+++ b/P3D/Pokemon/Items/Balls/SportBall.vb
@@ -5,7 +5,7 @@ Namespace Items.Balls
Inherits BallItem
- Public Overrides ReadOnly Property CanBeHold As Boolean = False
+ Public Overrides ReadOnly Property CanBeHeld As Boolean = False
Public Overrides ReadOnly Property Description As String = "A special Pokéball for the Bug-Catching Contest."
Public Overrides ReadOnly Property PokeDollarPrice As Integer = 200
Public Overrides ReadOnly Property CatchMultiplier As Single = 1.5F
diff --git a/P3D/Pokemon/Items/GameModeItem.vb b/P3D/Pokemon/Items/GameModeItem.vb
new file mode 100644
index 000000000..133ab79e5
--- /dev/null
+++ b/P3D/Pokemon/Items/GameModeItem.vb
@@ -0,0 +1,149 @@
+Imports P3D.Items
+
+'''
+''' An item the player stores in their inventory.
+'''
+Public Class GameModeItem
+
+ Inherits Item
+
+ Public gmTextureSource As String = "Items\GameModeItems"
+ Public gmPluralName As String = gmName
+ Public gmPrice As Integer = 0
+ Public gmBattlePointsPrice As Integer = 1
+ Public gmItemType As ItemTypes = ItemTypes.Standard
+
+ Public gmCatchMultiplier As Single = 1.0F
+ Public gmMaxStack As Integer = 999
+ Public gmFlingDamage As Integer = 30
+ Public gmCanBeTraded As Boolean = True
+ Public gmCanBeHeld As Boolean = True
+ Public gmCanBeUsed As Boolean = True
+ Public gmCanBeUsedInBattle As Boolean = True
+ Public gmCanBeTossed As Boolean = True
+ Public gmBattleSelectPokemon As Boolean = True
+ 'Medicine Item
+ Public gmIsHealingItem As Boolean = False
+ Public gmHealHPAmount As Integer = 0
+ Public gmCureStatusEffects As List(Of Pokemon.StatusProblems)
+ 'Evolution Item
+ Public gmIsEvolutionItem As Boolean = False
+ Public gmEvolutionPokemon As List(Of Integer)
+
+ 'Mega Stone Item
+ Public gmMegaPokemonNumber As Integer
+
+ Public Sub New()
+ IsGameModeItem = True
+ End Sub
+
+ '''
+ ''' The plural name of the item.
+ '''
+ Public Overrides ReadOnly Property PluralName As String
+ Get
+ Return gmPluralName
+ End Get
+ End Property
+
+ '''
+ ''' The price of this item if the player purchases it in exchange for PokéDollars. This halves when selling an item to the store.
+ '''
+ Public Overrides ReadOnly Property PokeDollarPrice As Integer = gmPrice
+
+ '''
+ ''' The price of this item if the player purchases it exchange for BattlePoints.
+ '''
+ Public Overrides ReadOnly Property BattlePointsPrice As Integer = gmBattlePointsPrice
+
+ '''
+ ''' The type of this item. This also controls in which bag this item gets sorted.
+ '''
+ Public Overrides ReadOnly Property ItemType As ItemTypes = gmItemType
+
+ '''
+ ''' The default catch multiplier if the item gets used as a Pokéball.
+ '''
+ Public Overrides ReadOnly Property CatchMultiplier As Single = gmCatchMultiplier
+
+ '''
+ ''' The maximum amount of this item type (per ID) that can be stored in the bag.
+ '''
+ Public Overrides ReadOnly Property MaxStack As Integer = gmMaxStack
+
+ '''
+ ''' A value that can be used to sort items in the bag after. Lower values make items appear closer to the top.
+ '''
+ Public Overrides ReadOnly Property SortValue As Integer = 0
+
+
+ '''
+ ''' The bag description of this item.
+ '''
+ Public Overrides ReadOnly Property Description As String = gmDescription
+
+
+ '''
+ ''' The damage the Fling move does when this item is attached to a Pokémon.
+ '''
+ Public Overrides ReadOnly Property FlingDamage As Integer = gmFlingDamage
+
+ '''
+ ''' If this item can be traded in for money.
+ '''
+ Public Overrides ReadOnly Property CanBeTraded As Boolean = gmCanBeTraded
+
+ '''
+ ''' If this item can be given to a Pokémon.
+ '''
+ Public Overrides ReadOnly Property CanBeHeld As Boolean = gmCanBeHeld
+
+ '''
+ ''' If this item can be used from the bag.
+ '''
+ Public Overrides ReadOnly Property CanBeUsed As Boolean = gmCanBeUsed
+
+ '''
+ ''' If this item can be used in battle.
+ '''
+ Public Overrides ReadOnly Property CanBeUsedInBattle As Boolean = gmCanBeUsedInBattle
+
+ '''
+ ''' If this item can be tossed in the bag.
+ '''
+ Public Overrides ReadOnly Property CanBeTossed As Boolean = gmCanBeTossed
+
+ '''
+ ''' If this item requires the player to select a Pokémon to use the item on in battle.
+ '''
+ Public Overrides ReadOnly Property BattleSelectPokemon As Boolean = gmBattleSelectPokemon
+
+ '''
+ ''' If this item is a Healing item.
+ '''
+ Public Overrides ReadOnly Property IsHealingItem As Boolean = gmIsHealingItem
+
+
+ '''
+ ''' The item gets used from the bag.
+ '''
+ Public Overrides Sub Use()
+ Logger.Debug("PLACEHOLDER FOR GAMEMODE ITEM USE")
+ End Sub
+
+
+ '''
+ ''' A method that gets used when the item is applied to a Pokémon. Returns True if the action was successful.
+ '''
+ ''' The Index of the Pokémon in party.
+ Public Overrides Function UseOnPokemon(ByVal PokeIndex As Integer) As Boolean
+ If PokeIndex < 0 Or PokeIndex > 5 Then
+ Throw New ArgumentOutOfRangeException("PokeIndex", PokeIndex, "The index for a Pokémon in a player's party can only be between 0 and 5.")
+ End If
+
+ Logger.Debug("PLACEHOLDER FOR GAMEMODE ITEM USE ON POKEMON")
+ Return False
+ End Function
+
+
+End Class
diff --git a/P3D/Pokemon/Items/GameModeItemLoader.vb b/P3D/Pokemon/Items/GameModeItemLoader.vb
new file mode 100644
index 000000000..884fcf51b
--- /dev/null
+++ b/P3D/Pokemon/Items/GameModeItemLoader.vb
@@ -0,0 +1,207 @@
+Imports P3D.Items
+
+'''
+''' Provides an interface to load additional GameMode items.
+'''
+Public Class GameModeItemLoader
+
+ 'The default relative path to load items from (Content folder).
+ Const PATH As String = "Data\Items\"
+
+ 'List of loaded items.
+ Shared LoadedItems As New List(Of GameModeItem)
+
+ '''
+ ''' Load the attack list for the loaded GameMode.
+ '''
+ ''' The game won't try to load the list if the default GameMode is selected.
+ Public Shared Sub Load()
+ LoadedItems.Clear()
+
+ If GameModeManager.ActiveGameMode.IsDefaultGamemode = False Then
+ If System.IO.Directory.Exists(GameController.GamePath & "\" & GameModeManager.ActiveGameMode.ContentPath & "\" & PATH) = True Then
+ For Each file As String In System.IO.Directory.GetFiles(GameController.GamePath & "\" & GameModeManager.ActiveGameMode.ContentPath & PATH, "*.dat")
+ LoadItem(file)
+ Next
+ End If
+ End If
+
+ If LoadedItems.Count > 0 Then
+ Logger.Debug("Loaded " & LoadedItems.Count.ToString() & " GameMode item(s).")
+ End If
+ End Sub
+
+ '''
+ ''' Loads a item from a file.
+ '''
+ ''' The file to load the item from.
+ Private Shared Sub LoadItem(ByVal file As String)
+ Dim item As New GameModeItem
+
+ Dim content() As String = System.IO.File.ReadAllLines(file)
+
+ Dim key As String = ""
+ Dim value As String = ""
+
+ Dim setID As Boolean = False 'Controls if the item sets its ID.
+ Dim setName As Boolean = False 'Controls if the item sets its ID.
+
+ Try
+ 'Go through lines of the file and set the properties depending on the content.
+ 'Lines starting with # are comments.
+ For Each l As String In content
+ If l.Contains("|") = True And l.StartsWith("#") = False Then
+ key = l.Remove(l.IndexOf("|"))
+ value = l.Remove(0, l.IndexOf("|") + 1)
+
+ Select Case key.ToLower()
+ Case "id"
+ item.gmID = "gm" & CInt(value).ToString
+ Dim itemX As Integer = CInt(value)
+ Dim itemY As Integer = 0
+ Dim sheetWidth As Integer = CInt(TextureManager.GetTexture(item.gmTextureSource).Width / 24)
+ While itemX > sheetWidth - 1
+ itemX -= sheetWidth
+ itemY += 1
+ End While
+ item.gmTextureRectangle = New Rectangle(CInt(itemX * 24), CInt(itemY * 24), 24, 24)
+ setID = True
+ Case "name"
+ item.gmName = value
+ setName = True
+ Case "pluralname"
+ item.gmPluralName = value
+ Case "description"
+ item.gmDescription = value
+ Case "type"
+ Select Case value
+ Case "standard", "0"
+ item.gmItemType = ItemTypes.Standard
+ Case "medicine", "1"
+ item.gmItemType = ItemTypes.Medicine
+ Case "plants", "2"
+ item.gmItemType = ItemTypes.Plants
+ Case "balls", "pokeballs", "pokéballs", "3"
+ item.gmItemType = ItemTypes.Pokéballs
+ Case "machines", "4"
+ item.gmItemType = ItemTypes.Machines
+ Case "keyitems", "5"
+ item.gmItemType = ItemTypes.KeyItems
+ Case "mail", "6"
+ item.gmItemType = ItemTypes.Mail
+ Case "battleitems", "7"
+ item.gmItemType = ItemTypes.BattleItems
+ End Select
+ Case "canbeused"
+ item.gmCanBeUsed = CBool(value)
+ Case "canbeusedinbattle"
+ item.gmCanBeUsedInBattle = CBool(value)
+ Case "useonpokemoninbattle"
+ item.gmBattleSelectPokemon = CBool(value)
+ Case "canbetossed"
+ item.gmCanBeTossed = CBool(value)
+ Case "canbeheld"
+ item.gmCanBeHeld = CBool(value)
+ Case "canbetraded"
+ item.gmCanBeTraded = CBool(value)
+ Case "price"
+ item.gmPrice = CInt(value)
+ Case "battlepointsprice"
+ item.gmBattlePointsPrice = CInt(value)
+ Case "catchmultiplier"
+ item.gmCatchMultiplier = CSng(value)
+ Case "maxstack"
+ item.gmMaxStack = CInt(value)
+ Case "flingdamage"
+ item.gmFlingDamage = CInt(value)
+ Case "ishealingitem"
+ item.gmIsHealingItem = CBool(value)
+ Case "healhpamount"
+ item.gmHealHPAmount = CInt(value)
+ Case "curestatuseffects"
+ Dim StatusEffectList As New List(Of Pokemon.StatusProblems)
+ Dim valueSplit As String() = value.Split(",")
+ For i = 0 To valueSplit.Count - 1
+ Select Case valueSplit(i).ToLower
+ Case "brn"
+ StatusEffectList.Add(Pokemon.StatusProblems.Burn)
+ Case "frz"
+ StatusEffectList.Add(Pokemon.StatusProblems.Freeze)
+ Case "prz"
+ StatusEffectList.Add(Pokemon.StatusProblems.Paralyzed)
+ Case "psn"
+ StatusEffectList.Add(Pokemon.StatusProblems.Poison)
+ Case "bpsn"
+ StatusEffectList.Add(Pokemon.StatusProblems.BadPoison)
+ Case "slp"
+ StatusEffectList.Add(Pokemon.StatusProblems.Sleep)
+ Case "fnt"
+ StatusEffectList.Add(Pokemon.StatusProblems.Fainted)
+ End Select
+ Next
+ If item.gmCureStatusEffects Is Nothing Then
+ item.gmCureStatusEffects = StatusEffectList
+ Else
+ item.gmCureStatusEffects.AddRange(StatusEffectList)
+ End If
+ Case "isevolutionitem"
+ item.gmIsEvolutionItem = CBool(value)
+ Case "evolutionpokemon"
+ Dim PokemonList As New List(Of Integer)
+ Dim valueSplit As String() = value.Split(",")
+ For i = 0 To valueSplit.Count - 1
+ If Pokemon.PokemonDataExists(CInt(valueSplit(i))) Then
+ PokemonList.Add(CInt(valueSplit(i)))
+ End If
+ Next
+ If item.gmEvolutionPokemon Is Nothing Then
+ item.gmEvolutionPokemon = PokemonList
+ Else
+ item.gmEvolutionPokemon.AddRange(PokemonList)
+ End If
+ End Select
+ End If
+ Next
+ Catch ex As Exception
+ 'If an error occurs loading a item, log the error.
+ Logger.Log(Logger.LogTypes.ErrorMessage, "GameModeItemLoader.vb: Error loading GameMode Item from file """ & file & """: " & ex.Message & "; Last Key/Value pair successfully loaded: " & key & "|" & value)
+ End Try
+
+ If setID = True AndAlso setName = True Then
+ If item.gmIsMegaStone = True AndAlso item.gmMegaPokemonNumber <> Nothing AndAlso item.gmDescription = "" Then
+ Dim MegaPokemonName As String = Pokemon.GetPokemonByID(item.gmMegaPokemonNumber, item.AdditionalData).GetName
+ item.gmDescription = "One variety of the mysterious Mega Stones. Have " & MegaPokemonName & " hold it, and this stone will enable it to Mega Evolve during battle."
+ item.gmCanBeTossed = False
+ item.gmCanBeTraded = False
+ item.gmCanBeUsed = False
+ item.gmCanBeUsedInBattle = False
+ End If
+ LoadedItems.Add(item) 'Add the item.
+ Else
+ Logger.Log(Logger.LogTypes.ErrorMessage, "GameModeItemLoader.vb: User defined Items must set their ID through the ""ID"" property and their Name through the ""Name"" property, however the item loaded from """ & file & """ has no ID or Name set so it will be ignored.")
+ End If
+ End Sub
+
+ '''
+ ''' Returns a custom item based on its ID.
+ '''
+ ''' The ID of the custom item.
+ ''' Returns a item or nothing.
+ Public Shared Function GetItemByID(ByVal ID As String) As GameModeItem
+ For Each i As GameModeItem In LoadedItems
+ If i.gmID = ID Then
+ Return i
+ End If
+ Next
+ Return Nothing
+ End Function
+ Public Shared Function GetItemByName(ByVal Name As String) As GameModeItem
+ For Each i As GameModeItem In LoadedItems
+ If i.gmName.ToLowerInvariant() = Name.ToLowerInvariant() Then
+ Return i
+ End If
+ Next
+ Return Nothing
+ End Function
+
+End Class
diff --git a/P3D/Pokemon/Items/Item.vb b/P3D/Pokemon/Items/Item.vb
index 7ab1a89cf..044295040 100644
--- a/P3D/Pokemon/Items/Item.vb
+++ b/P3D/Pokemon/Items/Item.vb
@@ -9,6 +9,18 @@ Public MustInherit Class Item
Protected _textureRectangle As Rectangle
Private _texture As Texture2D
+ 'GameMode Items
+ Public gmID As String = ""
+ Public gmName As String = ""
+ Public gmDescription As String = ""
+ Public gmTextureRectangle As Rectangle
+ Public gmIsBerry As Boolean = False
+ Public gmIsMail As Boolean = False
+ Public gmIsMegaStone As Boolean = False
+ Public gmIsPlate As Boolean = False
+
+ Public Property IsGameModeItem As Boolean = False
+
Public ReadOnly Property TextureSource As String
Get
Return _textureSource & "," & _textureRectangle.X & "," & _textureRectangle.Y & "," & _textureRectangle.Width & "," & _textureRectangle.Height
@@ -16,10 +28,18 @@ Public MustInherit Class Item
End Property
Public Function GetDescription() As String
- If Localization.TokenExists("item_desc_" & GetAttribute().Id) = True Then
- Return Localization.GetString("item_desc_" & GetAttribute().Id)
+ If IsGameModeItem = True Then
+ If Localization.TokenExists("item_desc_" & gmID) = True Then
+ Return Localization.GetString("item_desc_" & gmID)
+ Else
+ Return Me.gmDescription
+ End If
Else
- Return Me.Description
+ If Localization.TokenExists("item_desc_" & GetAttribute().Id) = True Then
+ Return Localization.GetString("item_desc_" & GetAttribute().Id)
+ Else
+ Return Me.Description
+ End If
End If
End Function
@@ -34,7 +54,11 @@ Public MustInherit Class Item
End Function
Public Function OriginalName() As String
- Return GetAttribute().Name
+ If IsGameModeItem = True Then
+ Return gmName
+ Else
+ Return GetAttribute().Name
+ End If
End Function
'''
@@ -42,10 +66,18 @@ Public MustInherit Class Item
'''
Public Overridable ReadOnly Property Name As String
Get
- If Localization.TokenExists("item_name_" & GetAttribute().Id) = True Then
- Return Localization.GetString("item_name_" & GetAttribute().Id)
+ If IsGameModeItem = True Then
+ If Localization.TokenExists("item_name_" & gmID) = True Then
+ Return Localization.GetString("item_name_" & gmID)
+ Else
+ Return gmName
+ End If
Else
- Return GetAttribute().Name
+ If Localization.TokenExists("item_name_" & GetAttribute().Id) = True Then
+ Return Localization.GetString("item_name_" & GetAttribute().Id)
+ Else
+ Return GetAttribute().Name
+ End If
End If
End Get
End Property
@@ -103,8 +135,14 @@ Public MustInherit Class Item
'''
Public ReadOnly Property Texture As Texture2D
Get
- If _texture Is Nothing Then
- _texture = TextureManager.GetTexture(_textureSource, _textureRectangle, "")
+ If IsGameModeItem = True Then
+ If _texture Is Nothing Then
+ _texture = TextureManager.GetTexture(_textureSource, gmTextureRectangle, "")
+ End If
+ Else
+ If _texture Is Nothing Then
+ _texture = TextureManager.GetTexture(_textureSource, _textureRectangle, "")
+ End If
End If
Return _texture
@@ -120,6 +158,7 @@ Public MustInherit Class Item
''' The additional data that is stored with this item.
'''
Public Property AdditionalData As String = ""
+
'''
''' The damage the Fling move does when this item is attached to a Pokémon.
@@ -134,7 +173,7 @@ Public MustInherit Class Item
'''
''' If this item can be given to a Pokémon.
'''
- Public Overridable ReadOnly Property CanBeHold As Boolean = True
+ Public Overridable ReadOnly Property CanBeHeld As Boolean = True
'''
''' If this item can be used from the bag.
@@ -166,7 +205,11 @@ Public MustInherit Class Item
'''
Public Overridable ReadOnly Property IsBall As Boolean
Get
- Return [GetType]().IsSubclassOf(GetType(Items.Balls.BallItem))
+ If IsGameModeItem = True Then
+ Return Me.ItemType = ItemTypes.Pokéballs
+ Else
+ Return [GetType]().IsSubclassOf(GetType(Items.Balls.BallItem))
+ End If
End Get
End Property
@@ -175,7 +218,11 @@ Public MustInherit Class Item
'''
Public ReadOnly Property IsBerry As Boolean
Get
- Return [GetType]().IsSubclassOf(GetType(Berry))
+ If IsGameModeItem = True Then
+ Return gmIsBerry
+ Else
+ Return [GetType]().IsSubclassOf(GetType(Berry))
+ End If
End Get
End Property
@@ -184,7 +231,11 @@ Public MustInherit Class Item
'''
Public ReadOnly Property IsMail As Boolean
Get
- Return [GetType]().IsSubclassOf(GetType(MailItem))
+ If IsGameModeItem = True Then
+ Return gmIsMail
+ Else
+ Return [GetType]().IsSubclassOf(GetType(MailItem))
+ End If
End Get
End Property
@@ -193,7 +244,11 @@ Public MustInherit Class Item
'''
Public ReadOnly Property IsMegaStone As Boolean
Get
- Return [GetType]().IsSubclassOf(GetType(MegaStone))
+ If IsGameModeItem = True Then
+ Return gmIsMegaStone
+ Else
+ Return [GetType]().IsSubclassOf(GetType(MegaStone))
+ End If
End Get
End Property
@@ -202,7 +257,11 @@ Public MustInherit Class Item
'''
Public ReadOnly Property IsPlate As Boolean
Get
- Return [GetType]().IsSubclassOf(GetType(PlateItem))
+ If IsGameModeItem = True Then
+ Return gmIsPlate
+ Else
+ Return [GetType]().IsSubclassOf(GetType(PlateItem))
+ End If
End Get
End Property
@@ -252,7 +311,13 @@ Public MustInherit Class Item
''' Tries to remove a single item of this item type from the player's bag and returns a message which changes depending on if the item that got removed was the last one of its kind.
'''
Public Function RemoveItem() As String
- Core.Player.Inventory.RemoveItem(Me.ID, 1)
+ Dim ItemID As String
+ If IsGameModeItem = True Then
+ ItemID = Me.gmID
+ Else
+ ItemID = Me.ID.ToString
+ End If
+ Core.Player.Inventory.RemoveItem(ItemID, 1)
Dim s As Screen = Core.CurrentScreen
While Not s.PreScreen Is Nothing And s.Identification <> Screen.Identifications.InventoryScreen
s = s.PreScreen
@@ -261,9 +326,11 @@ Public MustInherit Class Item
If s.Identification = Screen.Identifications.InventoryScreen Then
CType(s, NewInventoryScreen).LoadItems()
End If
- If Core.Player.Inventory.GetItemAmount(Me.ID) <= 0 Then
+
+ If Core.Player.Inventory.GetItemAmount(ItemID) <= 0 Then
Return "*There are no~" & Me.PluralName & " left."
End If
+
Return ""
End Function
@@ -289,18 +356,25 @@ Public MustInherit Class Item
''' Returns an item instance based on the passed in ID.
'''
''' The desired item's ID.
- Public Shared Function GetItemByID(ByVal ID As Integer) As Item
- If _itemBuffer Is Nothing Then
- LoadItemBuffer()
- End If
+ Public Shared Function GetItemByID(ByVal ID As String) As Item
+ If ID.Contains("gm") Then
+ Dim gmItem As GameModeItem = GameModeItemLoader.GetItemByID(ID)
+ If gmItem IsNot Nothing Then
+ Return gmItem
+ End If
+ Else
+ If _itemBuffer Is Nothing Then
+ LoadItemBuffer()
+ End If
- Dim type = _itemBuffer.FirstOrDefault(Function(itemTypePair)
- Return itemTypePair.Key.Id = ID
- End Function).Value
- If type IsNot Nothing Then
- Return CType(Activator.CreateInstance(type), Item)
- End If
+ Dim type = _itemBuffer.FirstOrDefault(Function(itemTypePair)
+ Return itemTypePair.Key.Id = CInt(ID)
+ End Function).Value
+ If type IsNot Nothing Then
+ Return CType(Activator.CreateInstance(type), Item)
+ End If
+ End If
Return Nothing
End Function
diff --git a/P3D/Pokemon/Items/KeyItems/KeyItem.vb b/P3D/Pokemon/Items/KeyItems/KeyItem.vb
index e0c6854a6..c860dc80c 100644
--- a/P3D/Pokemon/Items/KeyItems/KeyItem.vb
+++ b/P3D/Pokemon/Items/KeyItems/KeyItem.vb
@@ -9,7 +9,7 @@
Public Overrides ReadOnly Property CanBeUsedInBattle As Boolean = False
Public Overrides ReadOnly Property CanBeTraded As Boolean = False
Public Overrides ReadOnly Property CanBeTossed As Boolean = False
- Public Overrides ReadOnly Property CanBeHold As Boolean = False
+ Public Overrides ReadOnly Property CanBeHeld As Boolean = False
Public Overrides ReadOnly Property PokeDollarPrice As Integer = 9800
End Class
diff --git a/P3D/Pokemon/Items/Mail/KolbenMail.vb b/P3D/Pokemon/Items/Mail/KolbenMail.vb
index d89d08c3a..13fa42835 100644
--- a/P3D/Pokemon/Items/Mail/KolbenMail.vb
+++ b/P3D/Pokemon/Items/Mail/KolbenMail.vb
@@ -9,7 +9,7 @@ Namespace Items.Mail
Public Overrides ReadOnly Property CanBeUsed As Boolean = False
Public Overrides ReadOnly Property CanBeUsedInBattle As Boolean = False
Public Overrides ReadOnly Property CanBeTraded As Boolean = False
- Public Overrides ReadOnly Property CanBeHold As Boolean = False
+ Public Overrides ReadOnly Property CanBeHeld As Boolean = False
Public Overrides ReadOnly Property CanBeTossed As Boolean = False
Public Sub New()
diff --git a/P3D/Pokemon/Items/Medicine/HealPowder.vb b/P3D/Pokemon/Items/Medicine/HealPowder.vb
index b37db1931..2e407b0fb 100644
--- a/P3D/Pokemon/Items/Medicine/HealPowder.vb
+++ b/P3D/Pokemon/Items/Medicine/HealPowder.vb
@@ -32,7 +32,7 @@ Namespace Items.Medicine
Pokemon.Status = P3D.Pokemon.StatusProblems.None
Pokemon.ChangeFriendShip(Pokemon.FriendShipCauses.HealPowder)
- Core.Player.Inventory.RemoveItem(Me.ID, 1)
+ Core.Player.Inventory.RemoveItem(Me.ID.ToString, 1)
Screen.TextBox.reDelay = 0.0F
diff --git a/P3D/Pokemon/Items/Medicine/LavaCookie.vb b/P3D/Pokemon/Items/Medicine/LavaCookie.vb
index 6249bf10e..ea8a0ba54 100644
--- a/P3D/Pokemon/Items/Medicine/LavaCookie.vb
+++ b/P3D/Pokemon/Items/Medicine/LavaCookie.vb
@@ -35,7 +35,7 @@ Namespace Items.Medicine
Pokemon.RemoveVolatileStatus(Pokemon.VolatileStatus.Confusion)
End If
- Core.Player.Inventory.RemoveItem(Me.ID, 1)
+ Core.Player.Inventory.RemoveItem(Me.ID.ToString, 1)
Screen.TextBox.reDelay = 0.0F
diff --git a/P3D/Pokemon/Items/Medicine/ShinyCandy.vb b/P3D/Pokemon/Items/Medicine/ShinyCandy.vb
index ac48b895d..5de8e6f15 100644
--- a/P3D/Pokemon/Items/Medicine/ShinyCandy.vb
+++ b/P3D/Pokemon/Items/Medicine/ShinyCandy.vb
@@ -8,7 +8,7 @@ Namespace Items.Medicine
Public Overrides ReadOnly Property Description As String = "This mysterious candy sparkles when unwrapped. It attracts all sorts of Pokémon."
Public Overrides ReadOnly Property PokeDollarPrice As Integer = 4800
Public Overrides ReadOnly Property MaxStack As Integer = 1
- Public Overrides ReadOnly Property CanBeHold As Boolean = False
+ Public Overrides ReadOnly Property CanBeHeld As Boolean = False
Public Overrides ReadOnly Property PluralName As String = "Shiny Candies"
Public Sub New()
diff --git a/P3D/Pokemon/Items/MedicineItem.vb b/P3D/Pokemon/Items/MedicineItem.vb
index ea755badc..c37d15991 100644
--- a/P3D/Pokemon/Items/MedicineItem.vb
+++ b/P3D/Pokemon/Items/MedicineItem.vb
@@ -186,7 +186,7 @@ Namespace Items
ElseIf Pokemon.Status = P3D.Pokemon.StatusProblems.Freeze Then
Pokemon.Status = P3D.Pokemon.StatusProblems.None
- Core.Player.Inventory.RemoveItem(Me.ID, 1)
+ Core.Player.Inventory.RemoveItem(Me.ID.ToString, 1)
Screen.TextBox.reDelay = 0.0F
@@ -225,7 +225,7 @@ Namespace Items
ElseIf Pokemon.Status = P3D.Pokemon.StatusProblems.Paralyzed Then
Pokemon.Status = P3D.Pokemon.StatusProblems.None
- Core.Player.Inventory.RemoveItem(Me.ID, 1)
+ Core.Player.Inventory.RemoveItem(Me.ID.ToString, 1)
Screen.TextBox.reDelay = 0.0F
diff --git a/P3D/Pokemon/Items/TechMachine.vb b/P3D/Pokemon/Items/TechMachine.vb
index c2d249069..bbbc7001c 100644
--- a/P3D/Pokemon/Items/TechMachine.vb
+++ b/P3D/Pokemon/Items/TechMachine.vb
@@ -15,7 +15,7 @@
Public CanTeachWhenGender As Boolean = False
Public Overrides ReadOnly Property CanBeUsedInBattle As Boolean = False
- Public Overrides ReadOnly Property CanBeHold As Boolean = False
+ Public Overrides ReadOnly Property CanBeHeld As Boolean = False
Public Overrides ReadOnly Property CanBeTraded As Boolean = True
Public Overrides ReadOnly Property CanBeTossed As Boolean = True
Public Overrides ReadOnly Property SortValue As Integer
@@ -106,12 +106,12 @@
If t = "" Then
If p.Attacks.Count = 4 Then
- SetScreen(New LearnAttackScreen(CurrentScreen, p, a, ID))
+ SetScreen(New LearnAttackScreen(CurrentScreen, p, a, ID.ToString))
Return True
Else
If IsTM = True AndAlso CBool(GameModeManager.GetGameRuleValue("SingleUseTM", "0")) = True Then
- Core.Player.Inventory.RemoveItem(ID, 1)
+ Core.Player.Inventory.RemoveItem(ID.ToString, 1)
End If
p.Attacks.Add(BattleSystem.Attack.GetAttackByID(a.ID))
diff --git a/P3D/Pokemon/Monster/Pokemon.vb b/P3D/Pokemon/Monster/Pokemon.vb
index 4e7b1bea7..4c186adfe 100644
--- a/P3D/Pokemon/Monster/Pokemon.vb
+++ b/P3D/Pokemon/Monster/Pokemon.vb
@@ -20,7 +20,7 @@ Public Class Pokemon
Next
'ShinyCharm
- If Core.Player.Inventory.GetItemAmount(242) > 0 Then
+ If Core.Player.Inventory.GetItemAmount(242.ToString) > 0 Then
shinyRate = CInt(shinyRate * 0.25F)
End If
End If
@@ -568,7 +568,7 @@ Public Class Pokemon
Public Machines As New List(Of Integer)
Public PokedexEntry As PokedexEntry
Public Cry As SoundEffect
- Public WildItems As New Dictionary(Of Integer, Integer)
+ Public WildItems As New Dictionary(Of Integer, String)
Public RegionalForms As String = ""
Private _name As String
@@ -896,7 +896,7 @@ Public Class Pokemon
Public Attacks As New List(Of BattleSystem.Attack)
Public Ability As Ability
- Public CatchBall As Item = Item.GetItemByID(5)
+ Public CatchBall As Item = Item.GetItemByID(5.ToString)
Private _experience As Integer
Private _gender As Genders
@@ -1504,7 +1504,7 @@ Public Class Pokemon
End If
Case "item"
Dim chance As Integer = CInt(Value.GetSplit(0))
- Dim itemID As Integer = CInt(Value.GetSplit(1))
+ Dim itemID As String = Value.GetSplit(1)
If Not WildItems.ContainsKey(chance) Then
WildItems.Add(chance, itemID)
@@ -1585,7 +1585,7 @@ Public Class Pokemon
Me.CatchTrainerName = Core.Player.Name
Me.OT = Core.Player.OT
- Me.CatchBall = Item.GetItemByID(5)
+ Me.CatchBall = Item.GetItemByID(5.ToString)
For i = 0 To Tags.Count - 1
Dim tagName As String = Tags.Keys(i)
@@ -1611,7 +1611,7 @@ Public Class Pokemon
Me.EggSteps = CInt(tagValue)
Case "item"
If StringHelper.IsNumeric(tagValue) Then
- Me.Item = Item.GetItemByID(CInt(tagValue))
+ Me.Item = Item.GetItemByID(tagValue)
End If
Case "itemdata"
If Not Me.Item Is Nothing Then
@@ -1656,7 +1656,7 @@ Public Class Pokemon
Case "catchtrainer"
Me.CatchTrainerName = tagValue
Case "catchball"
- Me.CatchBall = Item.GetItemByID(CInt(tagValue))
+ Me.CatchBall = Item.GetItemByID(tagValue)
Case "catchmethod"
Me.CatchMethod = tagValue
Case "friendship"
@@ -1998,18 +1998,18 @@ Public Class Pokemon
If WildItems.Count > 0 Then
Dim has100 As Boolean = False
- Dim ChosenItemID As Integer = 0
+ Dim ChosenItemID As String = 0.ToString
For i = 0 To WildItems.Count - 1
If WildItems.Keys(i) = 100 Then
has100 = True
- ChosenItemID = WildItems.Values(i)
+ ChosenItemID = WildItems.Values(cint(i))
Exit For
End If
Next
If has100 = True Then
Me.Item = Item.GetItemByID(ChosenItemID)
Else
- Dim usedWildItems As Dictionary(Of Integer, Integer) = Me.WildItems
+ Dim usedWildItems As Dictionary(Of Integer, String) = Me.WildItems
'Compound eyes ability:
If Core.Player.Pokemons.Count > 0 Then
diff --git a/P3D/Pokemon/Monster/PokemonInteractions.vb b/P3D/Pokemon/Monster/PokemonInteractions.vb
index 8867078c7..08a9883d0 100644
--- a/P3D/Pokemon/Monster/PokemonInteractions.vb
+++ b/P3D/Pokemon/Monster/PokemonInteractions.vb
@@ -23,11 +23,11 @@
End Enum
Public Shared Function GetScriptString(ByVal p As Pokemon, ByVal cPosition As Vector3, ByVal facing As Integer) As String
- If PickupItemID > -1 Then
+ If PickupItemID > CInt(-1).ToString Then
If PickupIndividualValue = p.IndividualValue Then
Return GenerateItemReaction(p, cPosition, facing)
Else
- PickupItemID = -1
+ PickupItemID = CInt(-1).ToString
PickupIndividualValue = ""
End If
End If
@@ -139,7 +139,7 @@
End If
s &= ":end"
- PickupItemID = -1
+ PickupItemID = CInt(-1).ToString
PickupIndividualValue = ""
Return s
@@ -873,7 +873,7 @@
End Class
Shared PickupIndividualValue As String = "" 'This value holds the individual value of the Pokémon that picked up the item.
- Shared PickupItemID As Integer = -1 'This is the Item ID of the item that the Pokémon picked up. -1 means no item got picked up.
+ Shared PickupItemID As String = CInt(-1).ToString 'This is the Item ID of the item that the Pokémon picked up. -1 means no item got picked up.
Public Shared Sub CheckForRandomPickup()
'Checks if the first Pokémon in the party is following the player:
@@ -883,7 +883,7 @@
If Core.Player.GetWalkPokemon().Status = Pokemon.StatusProblems.None Then
'If the player switched the Pokémon, reset the item ID.
If PickupIndividualValue <> Core.Player.GetWalkPokemon().IndividualValue Then
- PickupItemID = -1
+ PickupItemID = CInt(-1).ToString
End If
'Check if an item should be generated:
@@ -1044,8 +1044,8 @@
'If an item got generated, assign it to the global value to store it until the player interacts with the Pokémon. Also store the individual value.
If newItemID > -1 Then
- Logger.Debug("Pokémon picks up item (" & Item.GetItemByID(newItemID).Name & ")")
- PickupItemID = newItemID
+ Logger.Debug("Pokémon picks up item (" & Item.GetItemByID(newItemID.ToString).Name & ")")
+ PickupItemID = newItemID.ToString
PickupIndividualValue = Core.Player.GetWalkPokemon().IndividualValue
SoundManager.PlaySound("pickup")
End If
@@ -1053,7 +1053,7 @@
End If
Else
'Reset the system if no Pokémon:
- PickupItemID = -1
+ PickupItemID = CInt(-1).ToString
PickupIndividualValue = ""
End If
End If
diff --git a/P3D/Pokemon/Monster/Shedinja.vb b/P3D/Pokemon/Monster/Shedinja.vb
index 8eba690cd..8e1bf1c4e 100644
--- a/P3D/Pokemon/Monster/Shedinja.vb
+++ b/P3D/Pokemon/Monster/Shedinja.vb
@@ -45,7 +45,7 @@ Public Class Shedinja
Public Shared Function CanEvolveInto(ByVal EvolvedPokemon As Pokemon, ByVal Trigger As EvolutionCondition.EvolutionTrigger) As Boolean
If EvolvedPokemon.Number = 291 And Trigger = EvolutionCondition.EvolutionTrigger.LevelUp Then
If Core.Player.Pokemons.Count < 6 Then
- If Core.Player.Inventory.GetItemAmount(5) > 0 Then
+ If Core.Player.Inventory.GetItemAmount(5.ToString) > 0 Then
Return True
End If
End If
diff --git a/P3D/Pokemon/Wild/FrontierSpawner.vb b/P3D/Pokemon/Wild/FrontierSpawner.vb
index b1a545726..2e7c85174 100644
--- a/P3D/Pokemon/Wild/FrontierSpawner.vb
+++ b/P3D/Pokemon/Wild/FrontierSpawner.vb
@@ -53,12 +53,12 @@
SetStats(p, Stats(0), Stats(1), pokemon_class)
If ItemID <> "" Then
- p.Item = Item.GetItemByID(CInt(ItemID))
+ p.Item = Item.GetItemByID(ItemID)
End If
If p.Item Is Nothing Then
Dim items() As Integer = {146, 2009, 119, 140, 73, 74}
- p.Item = Item.GetItemByID(items(Core.Random.Next(0, items.Length)))
+ p.Item = Item.GetItemByID(items(Core.Random.Next(0, items.Length)).ToString)
End If
p.FullRestore()
@@ -74,7 +74,7 @@
If Not p.Item Is Nothing Then
Dim items() As Integer = {146, 2009, 119, 140, 73, 74}
- p.Item = Item.GetItemByID(items(Core.Random.Next(0, items.Length)))
+ p.Item = Item.GetItemByID(items(Core.Random.Next(0, items.Length)).ToString)
End If
End If
End Sub
diff --git a/P3D/Screens/Battle/BlackOutScreen.vb b/P3D/Screens/Battle/BlackOutScreen.vb
index 1e2981d19..487d05c8a 100644
--- a/P3D/Screens/Battle/BlackOutScreen.vb
+++ b/P3D/Screens/Battle/BlackOutScreen.vb
@@ -151,7 +151,7 @@
Public Overrides Sub ChangeTo()
MusicManager.PlayNoMusic()
- Core.Player.Inventory.RemoveItem(177) ' Remove all Park Balls (happens regardless of whether or not the player was currently in the Bug-Catching Contest).
+ Core.Player.Inventory.RemoveItem(177.ToString) ' Remove all Park Balls (happens regardless of whether or not the player was currently in the Bug-Catching Contest).
PlayerStatistics.Track("Blackouts", 1)
End Sub
diff --git a/P3D/Screens/Inventory/ApricornScreen.vb b/P3D/Screens/Inventory/ApricornScreen.vb
index 100d9809b..4a5405c0f 100644
--- a/P3D/Screens/Inventory/ApricornScreen.vb
+++ b/P3D/Screens/Inventory/ApricornScreen.vb
@@ -62,13 +62,13 @@
Dim T As Texture2D = TextureManager.GetTexture("Items\ItemSheet")
Me.Labels.Add(New Label(Localization.GetString("apricorn_screen_choose_apricorns"), New Vector2(100, 200), FontManager.MainFont))
- Dim RedApricorn As ButtonIcon = New ButtonIcon(AddressOf Me.GiveApricorn, "0 / " & Core.Player.Inventory.GetItemAmount(85), FontManager.MainFont, T, New Rectangle(240, 72, 24, 24), New Vector2(98, 240), New Size(48, 48), "85")
- Dim BlueApricorn As ButtonIcon = New ButtonIcon(AddressOf Me.GiveApricorn, "0 / " & Core.Player.Inventory.GetItemAmount(89), FontManager.MainFont, T, New Rectangle(336, 72, 24, 24), New Vector2(98, 304), New Size(48, 48), "89")
- Dim YellowApricorn As ButtonIcon = New ButtonIcon(AddressOf Me.GiveApricorn, "0 / " & Core.Player.Inventory.GetItemAmount(92), FontManager.MainFont, T, New Rectangle(384, 72, 24, 24), New Vector2(98, 368), New Size(48, 48), "92")
- Dim GreenApricorn As ButtonIcon = New ButtonIcon(AddressOf Me.GiveApricorn, "0 / " & Core.Player.Inventory.GetItemAmount(93), FontManager.MainFont, T, New Rectangle(408, 72, 24, 24), New Vector2(98, 432), New Size(48, 48), "93")
- Dim WhiteApricorn As ButtonIcon = New ButtonIcon(AddressOf Me.GiveApricorn, "0 / " & Core.Player.Inventory.GetItemAmount(97), FontManager.MainFont, T, New Rectangle(0, 96, 24, 24), New Vector2(98, 496), New Size(48, 48), "97")
- Dim BlackApricorn As ButtonIcon = New ButtonIcon(AddressOf Me.GiveApricorn, "0 / " & Core.Player.Inventory.GetItemAmount(99), FontManager.MainFont, T, New Rectangle(48, 96, 24, 24), New Vector2(162, 240), New Size(48, 48), "99")
- Dim PinkApricorn As ButtonIcon = New ButtonIcon(AddressOf Me.GiveApricorn, "0 / " & Core.Player.Inventory.GetItemAmount(101), FontManager.MainFont, T, New Rectangle(72, 96, 24, 24), New Vector2(162, 304), New Size(48, 48), "101")
+ Dim RedApricorn As ButtonIcon = New ButtonIcon(AddressOf Me.GiveApricorn, "0 / " & Core.Player.Inventory.GetItemAmount(85.ToString), FontManager.MainFont, T, New Rectangle(240, 72, 24, 24), New Vector2(98, 240), New Size(48, 48), "85")
+ Dim BlueApricorn As ButtonIcon = New ButtonIcon(AddressOf Me.GiveApricorn, "0 / " & Core.Player.Inventory.GetItemAmount(89.ToString), FontManager.MainFont, T, New Rectangle(336, 72, 24, 24), New Vector2(98, 304), New Size(48, 48), "89")
+ Dim YellowApricorn As ButtonIcon = New ButtonIcon(AddressOf Me.GiveApricorn, "0 / " & Core.Player.Inventory.GetItemAmount(92.ToString), FontManager.MainFont, T, New Rectangle(384, 72, 24, 24), New Vector2(98, 368), New Size(48, 48), "92")
+ Dim GreenApricorn As ButtonIcon = New ButtonIcon(AddressOf Me.GiveApricorn, "0 / " & Core.Player.Inventory.GetItemAmount(93.ToString), FontManager.MainFont, T, New Rectangle(408, 72, 24, 24), New Vector2(98, 432), New Size(48, 48), "93")
+ Dim WhiteApricorn As ButtonIcon = New ButtonIcon(AddressOf Me.GiveApricorn, "0 / " & Core.Player.Inventory.GetItemAmount(97.ToString), FontManager.MainFont, T, New Rectangle(0, 96, 24, 24), New Vector2(98, 496), New Size(48, 48), "97")
+ Dim BlackApricorn As ButtonIcon = New ButtonIcon(AddressOf Me.GiveApricorn, "0 / " & Core.Player.Inventory.GetItemAmount(99.ToString), FontManager.MainFont, T, New Rectangle(48, 96, 24, 24), New Vector2(162, 240), New Size(48, 48), "99")
+ Dim PinkApricorn As ButtonIcon = New ButtonIcon(AddressOf Me.GiveApricorn, "0 / " & Core.Player.Inventory.GetItemAmount(101.ToString), FontManager.MainFont, T, New Rectangle(72, 96, 24, 24), New Vector2(162, 304), New Size(48, 48), "101")
Dim GiveButton As ButtonIcon = New ButtonIcon(AddressOf Me.Give, Localization.GetString("apricorn_screen_ok"), FontManager.MainFont, mainTexture, New Rectangle(48, 128, 16, 16), New Vector2(162, 496), New Size(48, 48), "OK")
GiveButton.Enabled = False
@@ -206,7 +206,7 @@
ItemID = 166
End Select
- Dim Item As Item = Item.GetItemByID(ItemID)
+ Dim Item As Item = Item.GetItemByID(ItemID.ToString)
Core.SpriteBatch.Draw(Item.Texture, New Rectangle(100 + x * 64, 260 + y * 96, 48, 48), Color.White)
Core.SpriteBatch.DrawString(FontManager.MainFont, "x" & Apricorns(i), New Vector2(110 + x * 64, 300 + y * 96), Color.Black)
Next
@@ -236,7 +236,7 @@
apricornID = 6
End Select
- If Core.Player.Inventory.GetItemAmount(CInt(b.AdditionalValue)) > CInt(Me.Apricorns(apricornID)) Then
+ If Core.Player.Inventory.GetItemAmount(b.AdditionalValue) > CInt(Me.Apricorns(apricornID)) Then
Me.Apricorns(apricornID) = CStr(CInt(Me.Apricorns(apricornID)) + 1)
If HasApricorns() = True Then
@@ -273,7 +273,7 @@
apricornID = 6
End Select
- b.Text = Me.Apricorns(apricornID) & " / " & Core.Player.Inventory.GetItemAmount(CInt(b.AdditionalValue))
+ b.Text = Me.Apricorns(apricornID) & " / " & Core.Player.Inventory.GetItemAmount(b.AdditionalValue)
End If
Next
End Sub
@@ -287,13 +287,13 @@
Private Sub Give()
Me.State = States.Wait
- Core.Player.Inventory.RemoveItem(85, CInt(Me.Apricorns(0)))
- Core.Player.Inventory.RemoveItem(89, CInt(Me.Apricorns(1)))
- Core.Player.Inventory.RemoveItem(92, CInt(Me.Apricorns(2)))
- Core.Player.Inventory.RemoveItem(93, CInt(Me.Apricorns(3)))
- Core.Player.Inventory.RemoveItem(97, CInt(Me.Apricorns(4)))
- Core.Player.Inventory.RemoveItem(99, CInt(Me.Apricorns(5)))
- Core.Player.Inventory.RemoveItem(101, CInt(Me.Apricorns(6)))
+ Core.Player.Inventory.RemoveItem(85.ToString, CInt(Me.Apricorns(0)))
+ Core.Player.Inventory.RemoveItem(89.ToString, CInt(Me.Apricorns(1)))
+ Core.Player.Inventory.RemoveItem(92.ToString, CInt(Me.Apricorns(2)))
+ Core.Player.Inventory.RemoveItem(93.ToString, CInt(Me.Apricorns(3)))
+ Core.Player.Inventory.RemoveItem(97.ToString, CInt(Me.Apricorns(4)))
+ Core.Player.Inventory.RemoveItem(99.ToString, CInt(Me.Apricorns(5)))
+ Core.Player.Inventory.RemoveItem(101.ToString, CInt(Me.Apricorns(6)))
Dim d As Date = Date.Now
@@ -320,32 +320,32 @@
Dim text As String = Core.Player.Name & Localization.GetString("apricorn_screen_obtain")
If CInt(Apricorns(0)) > 0 Then
- Core.Player.Inventory.AddItem(159, CInt(Apricorns(0)))
- text &= "~" & Apricorns(0) & " " & Item.GetItemByID(159).Name
+ Core.Player.Inventory.AddItem(159.ToString, CInt(Apricorns(0)))
+ text &= "~" & Apricorns(0) & " " & Item.GetItemByID(159.ToString).Name
End If
If CInt(Apricorns(1)) > 0 Then
- Core.Player.Inventory.AddItem(160, CInt(Apricorns(1)))
- text &= ",~" & Apricorns(1) & " " & Item.GetItemByID(160).Name
+ Core.Player.Inventory.AddItem(160.ToString, CInt(Apricorns(1)))
+ text &= ",~" & Apricorns(1) & " " & Item.GetItemByID(160.ToString).Name
End If
If CInt(Apricorns(2)) > 0 Then
- Core.Player.Inventory.AddItem(165, CInt(Apricorns(2)))
- text &= ",~" & Apricorns(2) & " " & Item.GetItemByID(165).Name
+ Core.Player.Inventory.AddItem(165.ToString, CInt(Apricorns(2)))
+ text &= ",~" & Apricorns(2) & " " & Item.GetItemByID(165.ToString).Name
End If
If CInt(Apricorns(3)) > 0 Then
- Core.Player.Inventory.AddItem(164, CInt(Apricorns(3)))
- text &= ",~" & Apricorns(3) & " " & Item.GetItemByID(164).Name
+ Core.Player.Inventory.AddItem(164.ToString, CInt(Apricorns(3)))
+ text &= ",~" & Apricorns(3) & " " & Item.GetItemByID(164.ToString).Name
End If
If CInt(Apricorns(4)) > 0 Then
- Core.Player.Inventory.AddItem(161, CInt(Apricorns(4)))
- text &= ",~" & Apricorns(4) & " " & Item.GetItemByID(161).Name
+ Core.Player.Inventory.AddItem(161.ToString, CInt(Apricorns(4)))
+ text &= ",~" & Apricorns(4) & " " & Item.GetItemByID(161.ToString).Name
End If
If CInt(Apricorns(5)) > 0 Then
- Core.Player.Inventory.AddItem(157, CInt(Apricorns(5)))
- text &= ",~" & Apricorns(5) & " " & Item.GetItemByID(157).Name
+ Core.Player.Inventory.AddItem(157.ToString, CInt(Apricorns(5)))
+ text &= ",~" & Apricorns(5) & " " & Item.GetItemByID(157.ToString).Name
End If
If CInt(Apricorns(6)) > 0 Then
- Core.Player.Inventory.AddItem(166, CInt(Apricorns(6)))
- text &= ",~" & Apricorns(6) & " " & Item.GetItemByID(166).Name
+ Core.Player.Inventory.AddItem(166.ToString, CInt(Apricorns(6)))
+ text &= ",~" & Apricorns(6) & " " & Item.GetItemByID(166.ToString).Name
End If
text &= "."
diff --git a/P3D/Screens/Inventory/NewInventoryScreen.vb b/P3D/Screens/Inventory/NewInventoryScreen.vb
index 1bce6a987..81a9790bf 100644
--- a/P3D/Screens/Inventory/NewInventoryScreen.vb
+++ b/P3D/Screens/Inventory/NewInventoryScreen.vb
@@ -536,7 +536,13 @@ Public Class NewInventoryScreen
Dim CanvasTexture As Texture2D
CanvasTexture = TextureManager.GetTexture(TextureManager.GetTexture("GUI\Menus\Menu"), New Rectangle(0, 0, 48, 48))
- Dim trashText As String = _tossValue & "/" & Core.Player.Inventory.GetItemAmount(cItem.ID)
+ Dim ItemID As String
+ If cItem.IsGameModeItem = True Then
+ ItemID = cItem.gmID
+ Else
+ ItemID = cItem.ID.ToString
+ End If
+ Dim trashText As String = _tossValue & "/" & Core.Player.Inventory.GetItemAmount(ItemID)
Dim offsetX As Integer = 100
Dim offsetY As Integer = Core.windowSize.Height - 390
@@ -694,12 +700,18 @@ Public Class NewInventoryScreen
_tossValue -= 1
End If
- _tossValue = CInt(MathHelper.Clamp(_tossValue, 1, Core.Player.Inventory.GetItemAmount(cItem.ID)))
+ Dim ItemID As String
+ If cItem.IsGameModeItem = True Then
+ ItemID = cItem.gmID
+ Else
+ ItemID = cItem.ID.ToString
+ End If
+ _tossValue = CInt(MathHelper.Clamp(_tossValue, 1, Core.Player.Inventory.GetItemAmount(ItemID)))
If Not TextBox.Showing Then
If Controls.Accept Then
SoundManager.PlaySound("select")
- Core.Player.Inventory.RemoveItem(cItem.ID, _tossValue)
+ Core.Player.Inventory.RemoveItem(ItemID, _tossValue)
LoadItems()
_tossingItems = False
ElseIf Controls.Dismiss Then
@@ -949,15 +961,28 @@ Public Class NewInventoryScreen
Dim Pokemon As Pokemon = Core.Player.Pokemons(PokeIndex)
If Pokemon.IsEgg() = False Then
- Core.Player.Inventory.RemoveItem(cItem.ID, 1)
+ Dim ItemID As String
+ If cItem.IsGameModeItem = True Then
+ ItemID = cItem.gmID
+ Else
+ ItemID = cItem.ID.ToString
+ End If
+
+ Core.Player.Inventory.RemoveItem(ItemID, 1)
Dim reItem As Item = Nothing
If Not Pokemon.Item Is Nothing Then
+ Dim ReItemID As String
+ If cItem.IsGameModeItem = True Then
+ ReItemID = cItem.gmID
+ Else
+ ReItemID = cItem.ID.ToString
+ End If
reItem = Pokemon.Item
- Core.Player.Inventory.AddItem(reItem.ID, 1)
+ Core.Player.Inventory.AddItem(ReItemID, 1)
End If
- Pokemon.Item = Item.GetItemByID(cItem.ID)
+ Pokemon.Item = Item.GetItemByID(ItemID)
If reItem Is Nothing Then
'JSON Stuff
@@ -1101,7 +1126,7 @@ Public Class NewInventoryScreen
_infoItemOptions.Add("Use")
_infoItemOptionsNormal.Add(INFO_ITEM_OPTION_USE)
End If
- If cItem.CanBeHold Then
+ If cItem.CanBeHeld Then
'JSON Stuff
' _infoItemOptions.Add(_translation.INFO_ITEM_OPTION_GIVE)
_infoItemOptions.Add("Give")
diff --git a/P3D/Screens/MainMenu/NewNewGameScreen.vb b/P3D/Screens/MainMenu/NewNewGameScreen.vb
index 68293e473..03d7ee8f5 100644
--- a/P3D/Screens/MainMenu/NewNewGameScreen.vb
+++ b/P3D/Screens/MainMenu/NewNewGameScreen.vb
@@ -22,6 +22,7 @@
Next
BattleSystem.GameModeAttackLoader.Load()
+ GameModeItemLoader.Load()
SmashRock.Load()
Badge.Load()
diff --git a/P3D/Screens/NewMenuScreen.vb b/P3D/Screens/NewMenuScreen.vb
index 0d45ff0bd..78cb0c861 100644
--- a/P3D/Screens/NewMenuScreen.vb
+++ b/P3D/Screens/NewMenuScreen.vb
@@ -49,7 +49,7 @@
End If
If Screen.Level.IsBugCatchingContest = True Then
- _menuOptions.AddRange({Screen.Level.BugCatchingContestData.GetSplit(2) & " x" & Core.Player.Inventory.GetItemAmount(177),
+ _menuOptions.AddRange({Screen.Level.BugCatchingContestData.GetSplit(2) & " x" & Core.Player.Inventory.GetItemAmount(177.ToString),
"Bag",
"|||" & Core.Player.Name, 'Trainer card
"End Contest"})
@@ -307,7 +307,7 @@
Core.SetScreen(New NewOptionScreen(Me))
Case "Exit"
Core.SetScreen(PreScreen)
- Case Screen.Level.BugCatchingContestData.GetSplit(2) & " x" & Core.Player.Inventory.GetItemAmount(177)
+ Case Screen.Level.BugCatchingContestData.GetSplit(2) & " x" & Core.Player.Inventory.GetItemAmount(177.ToString)
Me.ShowBalls()
Case "End Contest"
Me.EndContest()
diff --git a/P3D/Screens/PC/MailSystemScreen.vb b/P3D/Screens/PC/MailSystemScreen.vb
index 0f2f0badd..921798134 100644
--- a/P3D/Screens/PC/MailSystemScreen.vb
+++ b/P3D/Screens/PC/MailSystemScreen.vb
@@ -66,7 +66,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.DrawString(FontManager.MiniFont, "Write new mail.", New Vector2(CInt(P.X) + 13, CInt(P.Y) + 14), Color.Black)
Else
- Dim item As Item = Item.GetItemByID(mail.MailID)
+ Dim item As Item = Item.GetItemByID(mail.MailID.ToString)
Dim x As Integer = 0
Dim y As Integer = 0
@@ -101,7 +101,7 @@
Private Sub DrawCurrentMail()
If index = 0 Then
Dim mail As Items.MailItem.MailData = TempNewMail
- Dim item As Item = Item.GetItemByID(mail.MailID)
+ Dim item As Item = Item.GetItemByID(mail.MailID.ToString)
Core.SpriteBatch.Draw(item.Texture, New Rectangle(420, 84, 48, 48), Color.White)
@@ -154,7 +154,7 @@
Core.SpriteBatch.DrawString(FontManager.MiniFont, "Cancel", New Vector2(696, yPlus + 334), Color.Black)
Else
Dim mail As Items.MailItem.MailData = Core.Player.Mails(index - 1)
- Dim item As Item = Item.GetItemByID(mail.MailID)
+ Dim item As Item = Item.GetItemByID(mail.MailID.ToString)
Core.SpriteBatch.Draw(item.Texture, New Rectangle(420, 84, 48, 48), Color.White)
@@ -281,7 +281,7 @@
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), AddressOf Me.ChosenPokemon, "Give mail to:", True) With {.Mode = Screens.UI.ISelectionScreen.ScreenMode.Selection, .CanExit = True}
+ 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)
@@ -322,13 +322,18 @@
Private Sub ChosenPokemon(ByVal PokeIndex As Integer)
If Not Core.Player.Pokemons(PokeIndex).Item Is Nothing Then
- Core.Player.Inventory.AddItem(Core.Player.Pokemons(PokeIndex).Item.ID, 1)
+ 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
+
End If
- Core.Player.Pokemons(PokeIndex).Item = Item.GetItemByID(TempNewMail.MailID)
+ 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, 1)
+ Core.Player.Inventory.RemoveItem(TempNewMail.MailID.ToString, 1)
Me.index = -1
Me.message = "Attached the Mail to " & Core.Player.Pokemons(PokeIndex).GetDisplayName() & "."
diff --git a/P3D/Screens/Pokemon/Daycare.vb b/P3D/Screens/Pokemon/Daycare.vb
index 19b0c1f37..099ab568a 100644
--- a/P3D/Screens/Pokemon/Daycare.vb
+++ b/P3D/Screens/Pokemon/Daycare.vb
@@ -74,7 +74,7 @@
p.Generate(1, True, OptionalAdditionalData)
p.EggSteps = 1
- p.SetCatchInfos(Item.GetItemByID(5), "obtained at")
+ p.SetCatchInfos(Item.GetItemByID(5.ToString), "obtained at")
p.CatchBall = Item.GetItemByID(GetEggPokeballID({parent1, parent2}.ToList()))
p.ReloadDefinitions()
@@ -473,7 +473,7 @@
End If
If chance > 0 And multiplier = True Then
- If Core.Player.Inventory.GetItemAmount(241) > 0 Then
+ If Core.Player.Inventory.GetItemAmount(241.ToString) > 0 Then
chance = CInt(chance * 1.3F)
End If
End If
@@ -526,42 +526,56 @@
Return 0
End Function
- Private Shared Function GetEggPokeballID(ByVal Pokemon As List(Of Pokemon)) As Integer
- Dim ballID As Integer = 5
+ Private Shared Function GetEggPokeballID(ByVal Pokemon As List(Of Pokemon)) As String
+ Dim ballID As String = 5.ToString
If Pokemon.Count = 2 Then
+
Dim p1 As Pokemon = Pokemon(0)
Dim p2 As Pokemon = Pokemon(1)
+ Dim CatchBallID1 As String
+ Dim CatchBallID2 As String
+ If p1.CatchBall.IsGameModeItem Then
+ CatchBallID1 = p1.CatchBall.gmID
+ Else
+ CatchBallID1 = p1.CatchBall.ID.ToString
+ End If
+ If p2.CatchBall.IsGameModeItem Then
+ CatchBallID2 = p2.CatchBall.gmID
+ Else
+ CatchBallID2 = p2.CatchBall.ID.ToString
+ End If
+
' First Pokémon is Ditto:
If p1.EggGroup1 = P3D.Pokemon.EggGroups.Ditto Or p1.EggGroup2 = P3D.Pokemon.EggGroups.Ditto Then
' If the first Pokémon is Ditto, then the other Pokémon must be female to inherit the Poké Ball.
If p2.Gender = P3D.Pokemon.Genders.Female Then
- ballID = p2.CatchBall.ID
+ ballID = CatchBallID2
End If
End If
'Second Pokémon is Ditto.
If p2.EggGroup1 = P3D.Pokemon.EggGroups.Ditto Or p2.EggGroup2 = P3D.Pokemon.EggGroups.Ditto Then
'If the second Pokémon is Ditto, then the other Pokémon must be female to inherit the Poké Ball.
If p1.Gender = P3D.Pokemon.Genders.Female Then
- ballID = p1.CatchBall.ID
+ ballID = CatchBallID1
End If
End If
' No Pokémon is Ditto:
If p1.EggGroup1 <> P3D.Pokemon.EggGroups.Ditto And p1.EggGroup2 <> P3D.Pokemon.EggGroups.Ditto And p2.EggGroup1 <> P3D.Pokemon.EggGroups.Ditto And p2.EggGroup2 <> P3D.Pokemon.EggGroups.Ditto Then
' First Pokémon is female:
If p1.Gender = P3D.Pokemon.Genders.Female Then
- ballID = p1.CatchBall.ID
+ ballID = CatchBallID1
End If
' Second Pokémon is female:
If p2.Gender = P3D.Pokemon.Genders.Female Then
- ballID = p2.CatchBall.ID
+ ballID = CatchBallID2
End If
End If
' Check for: Master Ball, Cherish Ball: Set to Poké Ball
- If ballID = 1 Or ballID = 45 Then
- ballID = 5
+ If ballID = 1.ToString Or ballID = 45.ToString Then
+ ballID = 5.ToString
End If
End If
diff --git a/P3D/Screens/Pokemon/EvolutionScreen.vb b/P3D/Screens/Pokemon/EvolutionScreen.vb
index a6ecaf63e..f38a80b2a 100644
--- a/P3D/Screens/Pokemon/EvolutionScreen.vb
+++ b/P3D/Screens/Pokemon/EvolutionScreen.vb
@@ -304,7 +304,7 @@
' Nincada's evolution to Shedinja if a Poké Ball is in the player's Bag and free space is available in the player's party:
If Shedinja.CanEvolveInto(Me.evolvedPokemon, Me.EvolutionTrigger) = True Then
Core.Player.Pokemons.Add(Shedinja.GenerateNew(evolvedPokemon))
- Core.Player.Inventory.RemoveItem(5, 1)
+ Core.Player.Inventory.RemoveItem(5.ToString, 1)
End If
Core.Player.Pokemons(PokeList(0)) = evolvedPokemon
diff --git a/P3D/Screens/Pokemon/LearnAttackScreen.vb b/P3D/Screens/Pokemon/LearnAttackScreen.vb
index 3ab661fae..0cbb0a65a 100644
--- a/P3D/Screens/Pokemon/LearnAttackScreen.vb
+++ b/P3D/Screens/Pokemon/LearnAttackScreen.vb
@@ -13,15 +13,15 @@
Dim AttackPos As Single = 320.0F
Dim canForget As Boolean = True
- Dim MachineItemID As Integer = -1
+ Dim MachineItemID As String = CInt(-1).ToString
Dim currentCharIndex As Integer = 0
Public Sub New(ByVal currentScreen As Screen, ByVal Pokemon As Pokemon, ByVal newAttack As BattleSystem.Attack)
- Me.New(currentScreen, Pokemon, newAttack, -1)
+ Me.New(currentScreen, Pokemon, newAttack, CInt(-1).ToString)
End Sub
- Public Sub New(ByVal currentScreen As Screen, ByVal Pokemon As Pokemon, ByVal newAttack As BattleSystem.Attack, ByVal MachineItemID As Integer)
+ Public Sub New(ByVal currentScreen As Screen, ByVal Pokemon As Pokemon, ByVal newAttack As BattleSystem.Attack, ByVal MachineItemID As String)
Me.Identification = Identifications.LearnAttackScreen
Me.PreScreen = currentScreen
@@ -261,7 +261,7 @@
Pokemon.Attacks.RemoveAt(AttackIndex)
Pokemon.Attacks.Insert(AttackIndex, newAttack)
- If Me.MachineItemID > -1 Then
+ If Me.MachineItemID <> CInt(-1).ToString Then
PlayerStatistics.Track("TMs/HMs used", 1)
If CBool(GameModeManager.GetGameRuleValue("SingleUseTM", "0")) = True Then
Dim TechMachine As Item = Item.GetItemByID(Me.MachineItemID)
diff --git a/P3D/Screens/Pokemon/PartyScreen.vb b/P3D/Screens/Pokemon/PartyScreen.vb
index adea62442..a01fc8908 100644
--- a/P3D/Screens/Pokemon/PartyScreen.vb
+++ b/P3D/Screens/Pokemon/PartyScreen.vb
@@ -763,9 +763,14 @@ Public Class PartyScreen
p.Item = Nothing
Else
- ShowMessage("Taken " & p.Item.Name & " from " & p.GetDisplayName() & ".")
-
- Core.Player.Inventory.AddItem(p.Item.ID, 1)
+ ShowMessage("Taken " & p.Item.Name & " from " & p.GetDisplayName() & ".")
+ Dim ItemID As String
+ If p.Item.IsGameModeItem Then
+ ItemID = p.Item.gmID
+ Else
+ ItemID = p.Item.ID.ToString
+ End If
+ Core.Player.Inventory.AddItem(ItemID, 1)
p.Item = Nothing
End If
Case "Back"
@@ -777,13 +782,13 @@ Public Class PartyScreen
''' A handler method to convert the incoming object array.
'''
Private Sub GiveItemHandler(ByVal params As Object())
- GiveItem(CInt(params(0)))
+ GiveItem(params(0).ToString)
End Sub
- Private Sub GiveItem(ByVal itemID As Integer)
+ Private Sub GiveItem(ByVal itemID As String)
Dim i As Item = Item.GetItemByID(itemID)
- If i.CanBeHold Then
+ If i.CanBeHeld Then
Dim p As Pokemon = PokemonList(_index)
Core.Player.Inventory.RemoveItem(itemID, 1)
@@ -797,7 +802,13 @@ Public Class PartyScreen
message = "Gave " & i.Name & " to " & p.GetDisplayName() & " and took the Mail to the PC."
Else
- Core.Player.Inventory.AddItem(reItem.ID, 1)
+ Dim ReItemID As String
+ If reItem.IsGameModeItem Then
+ ReItemID = reItem.gmID
+ Else
+ ReItemID = reItem.ID.ToString
+ End If
+ Core.Player.Inventory.AddItem(ReItemID, 1)
message = "Switched " & p.GetDisplayName() & "'s " & i.Name & " with a " & reItem.Name & "."
End If
diff --git a/P3D/Screens/StatisticsScreen.vb b/P3D/Screens/StatisticsScreen.vb
index 521e3900d..696fdb883 100644
--- a/P3D/Screens/StatisticsScreen.vb
+++ b/P3D/Screens/StatisticsScreen.vb
@@ -70,7 +70,7 @@
Dim value As Integer = Me.Statistics.Values(i)
If ItemID <> "" Then
- Dim Item As Item = Item.GetItemByID(CInt(ItemID))
+ Dim Item As Item = Item.GetItemByID(ItemID)
Core.SpriteBatch.Draw(Item.Texture, New Rectangle(CInt(140), CInt(152 + i * 50 + Scroll), 48, 48), Color.White)
End If
diff --git a/P3D/Screens/TradeScreen.vb b/P3D/Screens/TradeScreen.vb
index 40a5016a4..99b3fad8d 100644
--- a/P3D/Screens/TradeScreen.vb
+++ b/P3D/Screens/TradeScreen.vb
@@ -88,7 +88,7 @@ Public Class TradeScreen
''' The ID of the Item.
''' The Price of the Item. Leave -1 for automatic Price.
''' The Amount of the Item available in the store. Leave -1 for infinite.
- Public Sub New(ByVal ItemID As Integer, ByVal Amount As Integer, ByVal Price As Integer, ByVal Currency As Currencies)
+ Public Sub New(ByVal ItemID As String, ByVal Amount As Integer, ByVal Price As Integer, ByVal Currency As Currencies)
Me.ItemID = ItemID
Me.Amount = Amount
@@ -105,7 +105,7 @@ Public Class TradeScreen
End If
End Sub
- Public ItemID As Integer
+ Public ItemID As String
Public Price As Integer
Public Amount As Integer
@@ -148,7 +148,7 @@ Public Class TradeScreen
Dim itemData = lItem.Split(CChar("|"))
- Me.TradeItems.Add(New TradeItem(ScriptConversion.ToInteger(itemData(0)), ScriptConversion.ToInteger(itemData(1)), ScriptConversion.ToInteger(itemData(2)), Me.Currency))
+ Me.TradeItems.Add(New TradeItem(itemData(0), ScriptConversion.ToInteger(itemData(1)), ScriptConversion.ToInteger(itemData(2)), Me.Currency))
Next
Me.texture = TextureManager.GetTexture("GUI\Menus\General")
@@ -637,8 +637,8 @@ Public Class TradeScreen
Core.Player.Inventory.AddItem(tradeItem.ItemID, Me.BuyItemsAmount)
' Add a Premier Ball (ID=3) if the player bought 10 or more Poké Balls (ID=5):
- If tradeItem.ItemID = 5 And Me.BuyItemsAmount >= 10 Then
- Core.Player.Inventory.AddItem(3, 1)
+ If tradeItem.ItemID = 5.ToString And Me.BuyItemsAmount >= 10 Then
+ Core.Player.Inventory.AddItem(3.ToString, 1)
End If
' Remove trade item from seller's side if the rest amount is smaller than 0:
@@ -671,7 +671,13 @@ Public Class TradeScreen
Private Function GetMaxBuyItemAmount(ByVal tradeItem As TradeItem) As Integer
Dim item As Item = tradeItem.GetItem()
- Dim maxAmount As Integer = item.MaxStack - Core.Player.Inventory.GetItemAmount(item.ID)
+ Dim ItemID As String
+ If item.IsGameModeItem Then
+ ItemID = item.gmID
+ Else
+ ItemID = item.ID.ToString
+ End If
+ Dim maxAmount As Integer = item.MaxStack - Core.Player.Inventory.GetItemAmount(ItemID)
If maxAmount > tradeItem.Amount And tradeItem.Amount > -1 Then
maxAmount = tradeItem.Amount
@@ -886,9 +892,15 @@ Public Class TradeScreen
Me.SellItemsList.Clear()
For Each c In Core.Player.Inventory
Dim i = Item.GetItemByID(c.ItemID)
+ Dim ItemID As String
+ If i.IsGameModeItem Then
+ ItemID = i.gmID
+ Else
+ ItemID = i.ID.ToString
+ End If
If i.CanBeTraded = True Then
If i.ItemType = Me.CurrentCategory Then
- SellItemsList.Add(New TradeItem(i.ID, c.Amount, -1, Me.Currency))
+ SellItemsList.Add(New TradeItem(ItemID, c.Amount, -1, Me.Currency))
End If
End If
Next
diff --git a/P3D/World/ActionScript/Script.vb b/P3D/World/ActionScript/Script.vb
index 4a2d6cf78..b98860812 100644
--- a/P3D/World/ActionScript/Script.vb
+++ b/P3D/World/ActionScript/Script.vb
@@ -266,11 +266,11 @@
oppPokemon.OT = Script.SaveNPCTrade(6)
oppPokemon.CatchTrainerName = Script.SaveNPCTrade(7)
- oppPokemon.CatchBall = Item.GetItemByID(ScriptConversion.ToInteger(Script.SaveNPCTrade(8)))
+ oppPokemon.CatchBall = Item.GetItemByID(Script.SaveNPCTrade(8))
Dim itemID As String = Script.SaveNPCTrade(9)
If StringHelper.IsNumeric(itemID) Then
- oppPokemon.Item = Item.GetItemByID(ScriptConversion.ToInteger(itemID))
+ oppPokemon.Item = Item.GetItemByID(itemID)
End If
oppPokemon.CatchLocation = Script.SaveNPCTrade(10)
diff --git a/P3D/World/ActionScript/V1/ScriptV1.vb b/P3D/World/ActionScript/V1/ScriptV1.vb
index 3e3f16dce..a971b23a3 100644
--- a/P3D/World/ActionScript/V1/ScriptV1.vb
+++ b/P3D/World/ActionScript/V1/ScriptV1.vb
@@ -569,7 +569,7 @@
T = False
End If
Case "hasitem"
- If Core.Player.Inventory.GetItemAmount(CInt(condition)) > 0 Then
+ If Core.Player.Inventory.GetItemAmount(condition) > 0 Then
T = True
Else
T = False
@@ -644,9 +644,9 @@
catchMethod = Me.Value.GetSplit(2)
End If
- Dim catchBall As Item = Item.GetItemByID(1)
+ Dim catchBall As Item = Item.GetItemByID(1.ToString)
If commas > 2 Then
- catchBall = Item.GetItemByID(CInt(Me.Value.GetSplit(3)))
+ catchBall = Item.GetItemByID(Me.Value.GetSplit(3))
End If
Dim catchLocation As String = Screen.Level.MapName
@@ -676,7 +676,7 @@
If isEgg = True Then
Pokemon.EggSteps = 1
- Pokemon.SetCatchInfos(Item.GetItemByID(5), "obtained at")
+ Pokemon.SetCatchInfos(Item.GetItemByID(5.ToString), "obtained at")
Else
Pokemon.EggSteps = 0
End If
@@ -1083,9 +1083,9 @@
catchMethod = argument.GetSplit(2)
End If
- Dim catchBall As Item = Item.GetItemByID(1)
+ Dim catchBall As Item = Item.GetItemByID(1.ToString)
If commas > 2 Then
- catchBall = Item.GetItemByID(CInt(argument.GetSplit(3)))
+ catchBall = Item.GetItemByID(argument.GetSplit(3))
End If
Dim catchLocation As String = Screen.Level.MapName
@@ -1115,7 +1115,7 @@
If isEgg = True Then
Pokemon.EggSteps = 1
- Pokemon.SetCatchInfos(Item.GetItemByID(5), "obtained at")
+ Pokemon.SetCatchInfos(Item.GetItemByID(5.ToString), "obtained at")
Else
Pokemon.EggSteps = 0
End If
@@ -1241,7 +1241,7 @@
Dim splits() As String = argument.Split(CChar("|"))
Script.SaveNPCTrade = splits
- Core.SetScreen(New PartyScreen(Core.CurrentScreen, Item.GetItemByID(5), AddressOf Script.DoNPCTrade, "Choose trade Pokémon", True))
+ Core.SetScreen(New PartyScreen(Core.CurrentScreen, Item.GetItemByID(5.ToString), AddressOf Script.DoNPCTrade, "Choose trade Pokémon", True))
CType(Core.CurrentScreen, PartyScreen).ExitedSub = AddressOf Script.ExitedNPCTrade
Case "hide"
Screen.Level.OverworldPokemon.Visible = False
@@ -1649,7 +1649,7 @@
End Sub
Private Sub GiveItem()
- Dim ItemID As Integer = CInt(Me.Value.GetSplit(0))
+ Dim ItemID As String = Me.Value.GetSplit(0)
Dim Item As Item = Item.GetItemByID(ItemID)
Dim Amount As Integer = CInt(Me.Value.GetSplit(1))
@@ -1671,7 +1671,7 @@
End Sub
Private Sub RemoveItem()
- Dim ItemID As Integer = CInt(Me.Value.GetSplit(0))
+ Dim ItemID As String = Me.Value.GetSplit(0)
Dim Item As Item = Item.GetItemByID(ItemID)
Dim Amount As Integer = CInt(Me.Value.GetSplit(1))
diff --git a/P3D/World/ActionScript/V2/ScriptCommands/DoItem.vb b/P3D/World/ActionScript/V2/ScriptCommands/DoItem.vb
index 2bed85791..2d476280e 100644
--- a/P3D/World/ActionScript/V2/ScriptCommands/DoItem.vb
+++ b/P3D/World/ActionScript/V2/ScriptCommands/DoItem.vb
@@ -20,17 +20,22 @@
ItemID = argument.GetSplit(0)
End If
- If ScriptConversion.IsArithmeticExpression(ItemID) = False Then
+ If ScriptConversion.IsArithmeticExpression(ItemID) = False AndAlso ItemID.StartsWith("gm") = False Then
item = Item.GetItemByName(ItemID)
-
Else
- item = Item.GetItemByID(int(ItemID))
+ item = Item.GetItemByID(ItemID)
End If
If Not item Is Nothing Then
- If item.MaxStack < Core.Player.Inventory.GetItemAmount(item.ID) + amount Then
- amount = int(item.MaxStack - Core.Player.Inventory.GetItemAmount(item.ID)).Clamp(0, 999)
+ Dim _itemID As String
+ If item.IsGameModeItem Then
+ _itemID = item.gmID
+ Else
+ _itemID = item.ID.ToString
End If
- Core.Player.Inventory.AddItem(item.ID, amount)
+ If item.MaxStack < Core.Player.Inventory.GetItemAmount(_itemID) + amount Then
+ amount = int(item.MaxStack - Core.Player.Inventory.GetItemAmount(_itemID)).Clamp(0, 999)
+ End If
+ Core.Player.Inventory.AddItem(_itemID, amount)
End If
Case "remove"
Dim amount As Integer = 1
@@ -45,9 +50,16 @@
End If
End If
- Dim Item As Item = Item.GetItemByID(int(ItemID))
+ Dim Item As Item = Item.GetItemByID(ItemID)
- Core.Player.Inventory.RemoveItem(Item.ID, amount)
+ Dim _itemID As String
+ If Item.IsGameModeItem Then
+ _itemID = Item.gmID
+ Else
+ _itemID = Item.ID.ToString
+ End If
+
+ Core.Player.Inventory.RemoveItem(_itemID, amount)
If showMessage = True Then
Dim Message As String = ""
@@ -65,7 +77,7 @@
End If
Case "clearitem"
If argument <> "" Then
- Dim ItemID As Integer = int(argument)
+ Dim ItemID As String = argument
Dim amount As Integer = Core.Player.Inventory.GetItemAmount(ItemID)
If amount > 0 Then
@@ -77,10 +89,10 @@
Case "messagegive"
Dim ItemID As String = argument.GetSplit(0)
Dim item As Item
- If ScriptConversion.IsArithmeticExpression(ItemID) = False Then
+ If ScriptConversion.IsArithmeticExpression(ItemID) = False AndAlso ItemID.StartsWith("gm") = False Then
item = Item.GetItemByName(ItemID)
Else
- item = Item.GetItemByID(int(ItemID))
+ item = Item.GetItemByID(ItemID)
End If
Dim Amount As Integer = int(argument.GetSplit(1))
diff --git a/P3D/World/ActionScript/V2/ScriptCommands/DoPokemon.vb b/P3D/World/ActionScript/V2/ScriptCommands/DoPokemon.vb
index cdb789257..62ed62427 100644
--- a/P3D/World/ActionScript/V2/ScriptCommands/DoPokemon.vb
+++ b/P3D/World/ActionScript/V2/ScriptCommands/DoPokemon.vb
@@ -61,9 +61,9 @@
catchMethod = argument.GetSplit(2)
End If
- Dim catchBall As Item = Item.GetItemByID(1)
+ Dim catchBall As Item = Item.GetItemByID(1.ToString)
If commas > 2 Then
- catchBall = Item.GetItemByID(int(argument.GetSplit(3)))
+ catchBall = Item.GetItemByID(argument.GetSplit(3))
End If
Dim catchLocation As String = Screen.Level.MapName
@@ -81,9 +81,9 @@
catchTrainer = argument.GetSplit(6)
End If
- Dim heldItem As Integer = 0
+ Dim heldItem As String = 0.ToString
If commas > 6 Then
- heldItem = CInt(argument.GetSplit(7))
+ heldItem = argument.GetSplit(7)
End If
Dim isShiny As Boolean = False
@@ -106,12 +106,12 @@
If isEgg = True Then
Pokemon.EggSteps = 1
- Pokemon.SetCatchInfos(Item.GetItemByID(5), "obtained at")
+ Pokemon.SetCatchInfos(Item.GetItemByID(5.ToString), "obtained at")
Else
Pokemon.EggSteps = 0
End If
- If heldItem <> 0 Then
+ If heldItem <> 0.ToString Then
Pokemon.Item = Item.GetItemByID(heldItem)
End If
@@ -249,7 +249,7 @@
Dim splits() As String = argument.Split(CChar("|"))
Script.SaveNPCTrade = splits
- Dim selScreen = New PartyScreen(Core.CurrentScreen, Item.GetItemByID(5), AddressOf Script.DoNPCTrade, "Choose Pokémon for trade", True) With {.Mode = Screens.UI.ISelectionScreen.ScreenMode.Selection, .CanExit = True}
+ Dim selScreen = New PartyScreen(Core.CurrentScreen, Item.GetItemByID(5.ToString), AddressOf Script.DoNPCTrade, "Choose Pokémon for trade", True) With {.Mode = Screens.UI.ISelectionScreen.ScreenMode.Selection, .CanExit = True}
AddHandler selScreen.SelectedObject, AddressOf Script.DoNPCTradeHandler
Core.SetScreen(selScreen)
@@ -372,7 +372,7 @@
End If
End If
- Dim selScreen = New PartyScreen(Core.CurrentScreen, Item.GetItemByID(5), Nothing, "Choose Pokémon", canExit, canChooseFainted, canChooseEgg) With {.Mode = Screens.UI.ISelectionScreen.ScreenMode.Selection, .CanExit = canExit}
+ Dim selScreen = New PartyScreen(Core.CurrentScreen, Item.GetItemByID(5.ToString), Nothing, "Choose Pokémon", canExit, canChooseFainted, canChooseEgg) With {.Mode = Screens.UI.ISelectionScreen.ScreenMode.Selection, .CanExit = canExit}
AddHandler selScreen.SelectedObject, Nothing
Core.SetScreen(selScreen)
@@ -550,7 +550,7 @@
End If
Case "setitem"
Dim Index As Integer = int(argument.GetSplit(0, ","))
- Dim newItem As Item = Item.GetItemByID(int(argument.GetSplit(1, ",")))
+ Dim newItem As Item = Item.GetItemByID(argument.GetSplit(1, ","))
If Core.Player.Pokemons.Count - 1 >= Index Then
Core.Player.Pokemons(Index).Item = newItem
@@ -577,7 +577,7 @@
End If
Case "setcatchball"
Dim Index As Integer = int(argument.GetSplit(0, ","))
- Dim catchBall As Integer = int(argument.GetSplit(1, ","))
+ Dim catchBall As String = argument.GetSplit(1, ",")
If Core.Player.Pokemons.Count - 1 >= Index Then
Core.Player.Pokemons(Index).CatchBall = Item.GetItemByID(catchBall)
@@ -764,9 +764,9 @@
catchMethod = argument.GetSplit(2)
End If
- Dim catchBall As Item = Item.GetItemByID(1)
+ Dim catchBall As Item = Item.GetItemByID(1.ToString)
If commas > 2 Then
- catchBall = Item.GetItemByID(int(argument.GetSplit(3)))
+ catchBall = Item.GetItemByID(argument.GetSplit(3))
End If
Dim catchLocation As String = Screen.Level.MapName
@@ -784,9 +784,9 @@
catchTrainer = argument.GetSplit(6)
End If
- Dim heldItem As Integer = 0
+ Dim heldItem As String = 0.ToString
If commas > 6 Then
- heldItem = CInt(argument.GetSplit(7))
+ heldItem = argument.GetSplit(7)
End If
Dim isShiny As Boolean = False
@@ -809,12 +809,12 @@
If isEgg = True Then
Pokemon.EggSteps = 1
- Pokemon.SetCatchInfos(Item.GetItemByID(5), "obtained at")
+ Pokemon.SetCatchInfos(Item.GetItemByID(5.ToString), "obtained at")
Else
Pokemon.EggSteps = 0
End If
- If heldItem <> 0 Then
+ If heldItem <> 0.ToString Then
Pokemon.Item = Item.GetItemByID(heldItem)
End If
diff --git a/P3D/World/ActionScript/V2/ScriptCommands/DoScreen.vb b/P3D/World/ActionScript/V2/ScriptCommands/DoScreen.vb
index 72472b68d..506280efe 100644
--- a/P3D/World/ActionScript/V2/ScriptCommands/DoScreen.vb
+++ b/P3D/World/ActionScript/V2/ScriptCommands/DoScreen.vb
@@ -277,7 +277,7 @@
CanContinue = False
Case "voltorbflip"
- If Core.Player.Inventory.GetItemAmount(54) > 0 Then
+ If Core.Player.Inventory.GetItemAmount(54.ToString) > 0 Then
If Core.Player.Coins < 50000 Then
If VoltorbFlip.VoltorbFlipScreen.TotalCoins = -1 Then
Core.SetScreen(New VoltorbFlip.VoltorbFlipScreen(CurrentScreen))
diff --git a/P3D/World/ActionScript/V2/ScriptConstructs/DoInventory.vb b/P3D/World/ActionScript/V2/ScriptConstructs/DoInventory.vb
index 5a92ebf6e..cb5c9d857 100644
--- a/P3D/World/ActionScript/V2/ScriptConstructs/DoInventory.vb
+++ b/P3D/World/ActionScript/V2/ScriptConstructs/DoInventory.vb
@@ -12,7 +12,7 @@
Select Case command.ToLower()
Case "countitem"
- Dim ItemID As Integer = int(argument.GetSplit(0))
+ Dim ItemID As String = argument.GetSplit(0)
Return Core.Player.Inventory.GetItemAmount(ItemID)
Case "countitems"
@@ -27,13 +27,13 @@
If argument.Contains(",") Then
Select Case argument.GetSplit(1).ToLower()
Case "p", "plural"
- Return Item.GetItemByID(int(ItemID)).PluralName
+ Return Item.GetItemByID(ItemID).PluralName
Case "s", "singular"
- Return Item.GetItemByID(int(ItemID)).Name
+ Return Item.GetItemByID(ItemID).Name
End Select
End If
- Return Item.GetItemByID(int(ItemID)).Name
+ Return Item.GetItemByID(ItemID).Name
Case "id"
Dim item As Item = Item.GetItemByName(argument)
If Not item Is Nothing Then