Customizable Frontier Emblems

This commit is contained in:
JappaWakka 2023-07-28 12:35:00 +02:00
parent d5bcb336dd
commit bded481df8
8 changed files with 103 additions and 15 deletions

View File

@ -14,4 +14,10 @@
13|Storm|level=70|HM=Fly|Texture=GUI\Badges,200,50,50,50|Region=Johto
14|Mineral|Texture=GUI\Badges,250,50,50,50|Region=Johto
15|Glacier|HM=Whirlpool|Texture=GUI\Badges,300,50,50,50|Region=Johto
16|Rising|level=100|HM=Waterfall|Texture=GUI\Badges,350,50,50,50|Region=Johto
16|Rising|level=100|HM=Waterfall|Texture=GUI\Badges,350,50,50,50|Region=Johto
frontier_1_silver|name=Silver Ability|description=You defeated the Frontier Brain of~Battle Tower and showed him how~you and your Pokémon really are.|Texture=GUI\Badges,0,200,50,50
frontier_1_gold|name=Gold Ability|description=You defeated the Frontier Brain of~Battle Tower a second time and you've shown~your real strength when it comes to battles.|Texture=GUI\Badges,50,200,50,50
frontier_2_silver|name=Silver Knowledge|description=Only few trainers achieved this emblem~which shows what strength lies~inside them.|Texture=GUI\Badges,100,200,50,50
frontier_2_gold|name=Gold Knowledge|description=This Emblem displays how great you can~interact with Pokémon and how well~you can adapt your strategy to a new situation.|Texture=GUI\Badges,150,200,50,50

View File

@ -1574,20 +1574,61 @@
Me.InitializedFrontier = True
If ActionScript.IsRegistered("gold ability") = True Then
Me.FrontierList.Add(New FrontierSymbol() With {.Name = "Gold Ability", .Description = "You defeated the Frontier Brain of" & Environment.NewLine & "Battle Tower a second time and you've" & Environment.NewLine & "your real strength when it comes to battles.", .Texture = TextureManager.GetTexture("GUI\Badges", New Rectangle(50, 200, 50, 50), "")})
Else
If ActionScript.IsRegistered("silver ability") = True Then
Me.FrontierList.Add(New FrontierSymbol() With {.Name = "Silver Ability", .Description = "You defeated the Frontier Brain of" & Environment.NewLine & "Battle Tower and showed him how" & Environment.NewLine & "you and your Pokémon really are.", .Texture = TextureManager.GetTexture("GUI\Badges", New Rectangle(0, 200, 50, 50), "")})
Dim file As String = GameModeManager.GetContentFilePath("Data\badges.dat")
Security.FileValidation.CheckFileValid(file, False, "Badge.vb")
Dim data() As String = System.IO.File.ReadAllLines(file)
For Each line As String In data
If line.Contains("|") = True AndAlso StringHelper.IsNumeric(line.GetSplit(0, "|")) = False Then
Dim hasGold As Boolean = False
Dim hasSilver As Boolean = False
If line.GetSplit(0, "|").EndsWith("_gold") Then
If ActionScript.IsRegistered(line.GetSplit(0, "|")) = True Then
hasGold = True
End If
End If
If line.GetSplit(0, "|").EndsWith("_silver") Then
If ActionScript.IsRegistered(line.GetSplit(0, "|")) = True Then
If ActionScript.IsRegistered(CStr(line.GetSplit(0, "|").Remove(line.GetSplit(0, "|").Length - "_silver".Length, "_silver".Length) & "_gold")) = False Then
hasSilver = True
End If
End If
End If
If hasSilver = True OrElse hasGold = True Then
Dim emblemName As String = ""
Dim emblemDescription As String = ""
Dim emblemTexture As Texture2D = Nothing
Dim lineData As String() = line.Split("|")
For i = 1 To lineData.Count - 1
If lineData(i).ToLower.StartsWith("name=") Then
emblemName = Localization.GetString(line.GetSplit(0, "|") & "_name", lineData(i).Remove(0, "name=".Length))
End If
If lineData(i).ToLower.StartsWith("description=") Then
emblemDescription = Localization.GetString(line.GetSplit(0, "|") & "_description", lineData(i).Remove(0, "description=".Length))
End If
If lineData(i).ToLower.StartsWith("texture=") Then
Dim texturedata As String() = lineData(i).Remove(0, "texture=".Length).Split(",")
emblemTexture = TextureManager.GetTexture(texturedata(0), New Rectangle(CInt(texturedata(1)), CInt(texturedata(2)), CInt(texturedata(3)), CInt(texturedata(4))), "")
End If
Next
If emblemName = "" Then
If Localization.TokenExists(line.GetSplit(0, "|") & "_name") = True Then
emblemName = Localization.GetString(line.GetSplit(0, "|") & "_name")
End If
End If
If emblemDescription = "" Then
If Localization.TokenExists(line.GetSplit(0, "|") & "_description") = True Then
emblemDescription = Localization.GetString(line.GetSplit(0, "|") & "_description")
End If
End If
If emblemTexture IsNot Nothing Then
Me.FrontierList.Add(New FrontierSymbol() With {.Name = emblemName.Replace("~", Environment.NewLine), .Description = emblemDescription.Replace("~", Environment.NewLine), .Texture = emblemTexture})
End If
End If
End If
End If
If ActionScript.IsRegistered("gold knowledge") = True Then
Me.FrontierList.Add(New FrontierSymbol() With {.Name = "Gold Knowledge", .Description = "This Emblem displays how great you can" & Environment.NewLine & "interact with Pokémon and how well" & Environment.NewLine & "you can adapt your strategy to a new situation.", .Texture = TextureManager.GetTexture("GUI\Badges", New Rectangle(150, 200, 50, 50), "")})
Else
If ActionScript.IsRegistered("silver knowledge") = True Then
Me.FrontierList.Add(New FrontierSymbol() With {.Name = "Silver Knowledge", .Description = "Only few trainers achieved this emblem" & Environment.NewLine & "which shows what strength lies" & Environment.NewLine & "inside them.", .Texture = TextureManager.GetTexture("GUI\Badges", New Rectangle(100, 200, 50, 50), "")})
End If
End If
Next
End Sub
#End Region

View File

@ -287,6 +287,17 @@
End If
End If
IsReady = True
Case "addfrontieremblem"
If argument.Split(",").Count = 1 Then
ActionScript.RegisterID("frontier_" & argument & "_gold")
Else
If CBool(argument.GetSplit(1, ",")) = False Then
ActionScript.RegisterID("frontier_" & argument.GetSplit(0, ",") & "_silver")
Else
ActionScript.RegisterID("frontier_" & argument.GetSplit(0, ",") & "_gold")
End If
End If
IsReady = True
Case "achieveemblem"
GameJolt.Emblem.AchieveEmblem(argument)

View File

@ -44,6 +44,34 @@
Else
Return "false"
End If
Case "hasfrontieremblem"
Dim ID As String = ""
Dim CheckType As Boolean = Nothing
If argument.Split(",").Count > 0 AndAlso argument <> "" Then
If argument.Split(",").Count = 1 Then
ID = argument
Else
ID = argument.GetSplit(0, ",")
CheckType = CBool(argument.GetSplit(1, ","))
End If
End If
If CheckType <> Nothing Then
If CheckType = False Then
Return ReturnBoolean(ActionScript.IsRegistered("frontier_" & ID & "_silver"))
Else
Return ReturnBoolean(ActionScript.IsRegistered("frontier_" & ID & "_gold"))
End If
Else
If ActionScript.IsRegistered("frontier_" & ID & "_gold") = True Then
Return "true"
Else
If ActionScript.IsRegistered("frontier_" & ID & "_silver") = True Then
Return "true"
Else
Return "false"
End If
End If
End If
Case "skin"
Return Core.Player.Skin
Case "velocity"

View File

@ -504,6 +504,7 @@ Namespace ScriptVersion2
r(New ScriptCommand("player", "getbadge", {New ScriptArgument("badgeID", ScriptArgument.ArgumentTypes.Int)}.ToList(), "Adds the given Badge to the player's Badges and displays a message."))
r(New ScriptCommand("player", "removebadge", {New ScriptArgument("badgeID", ScriptArgument.ArgumentTypes.Int)}.ToList(), "Removes the given Badge from the player's Badges."))
r(New ScriptCommand("player", "addbadge", {New ScriptArgument("badgeID", ScriptArgument.ArgumentTypes.Int)}.ToList(), "Adds the given Badge from the player's Badges."))
r(New ScriptCommand("player", "addfrontieremblem", {New ScriptArgument("frontierEmblemID", ScriptArgument.ArgumentTypes.Str), New ScriptArgument("SilverOrGold", ScriptArgument.ArgumentTypes.Bool, True, "1")}.ToList(), "Adds a frontier emblem (silver or gold) to the player's emblems. 0 = silver, 1 = gold"))
r(New ScriptCommand("player", "achieveemblem", {New ScriptArgument("emblemName", ScriptArgument.ArgumentTypes.Str)}.ToList(), "Makes the player achieve an emblem (GameJolt only)."))
r(New ScriptCommand("player", "addbp", {New ScriptArgument("amount", ScriptArgument.ArgumentTypes.Int)}.ToList(), "Adds the given amount to the player's Battle Points."))
r(New ScriptCommand("player", "showrod", {New ScriptArgument("rodID", ScriptArgument.ArgumentTypes.Int, {"0-2"})}.ToList(), "Displays a Fishing Rod on the screen."))
@ -516,6 +517,7 @@ Namespace ScriptVersion2
' Constructs:
r(New ScriptCommand("player", "position", "sngarr", {New ScriptArgument("coordinate", ScriptArgument.ArgumentTypes.StrArr, {"x", "y", "z"}, True, "")}.ToList(), "Returns the position of the player. The normal coordinate combination is ""X,Y,Z"".", ",", True))
r(New ScriptCommand("player", "hasbadge", "bool", {New ScriptArgument("badgeID", ScriptArgument.ArgumentTypes.Int)}.ToList(), "Returns if the player owns a specific Badge.", ",", True))
r(New ScriptCommand("player", "hasfrontieremblem", "bool", {New ScriptArgument("frontierEmblemID", ScriptArgument.ArgumentTypes.Str), New ScriptArgument("SilverOrGold", ScriptArgument.ArgumentTypes.Bool, True, "")}.ToList(), "Returns if the player owns a specific frontier emblem. Without the second argument, returns true if the player owns either silver or gold.", ",", True))
r(New ScriptCommand("player", "skin", "str", "Returns the current skin the player wears.", ",", True))
r(New ScriptCommand("player", "velocity", "sng", "Returns the player's velocity (steps until the player movement ends).", ",", True))
r(New ScriptCommand("player", "speed", "sng", "Returns the player's movement speed (divided by 0.04F).", ",", True))

View File

@ -95,7 +95,7 @@ Public Class Badge
Security.FileValidation.CheckFileValid(file, False, "Badge.vb")
Dim data() As String = System.IO.File.ReadAllLines(file)
For Each line As String In data
If line.Contains("|") = True Then
If line.Contains("|") = True AndAlso StringHelper.IsNumeric(line.GetSplit(0, "|")) = True Then
Badges.Add(New BadgeDeclaration(line))
End If
Next