make online clothing localization work on all links

This commit is contained in:
Bitl 2021-11-16 05:50:04 -07:00
parent 52beaabfb9
commit fd41aa47b1
2 changed files with 26 additions and 24 deletions

View File

@ -1144,14 +1144,14 @@ public class GlobalFuncs
GlobalVars.PantsTextureID = GetItemTextureID(GlobalVars.UserCustomization.Pants, "Pants", new AssetCacheDefBasic("Pants", new string[] { "PantsTemplate" })); GlobalVars.PantsTextureID = GetItemTextureID(GlobalVars.UserCustomization.Pants, "Pants", new AssetCacheDefBasic("Pants", new string[] { "PantsTemplate" }));
GlobalVars.FaceTextureID = GetItemTextureID(GlobalVars.UserCustomization.Face, "Face", new AssetCacheDefBasic("Decal", new string[] { "Texture" })); GlobalVars.FaceTextureID = GetItemTextureID(GlobalVars.UserCustomization.Face, "Face", new AssetCacheDefBasic("Decal", new string[] { "Texture" }));
GlobalVars.TShirtTextureLocal = GetItemTextureLocalPath(GlobalVars.TShirtTextureID); GlobalVars.TShirtTextureLocal = GetItemTextureLocalPath(GlobalVars.TShirtTextureID, "TShirt");
GlobalVars.ShirtTextureLocal = GetItemTextureLocalPath(GlobalVars.ShirtTextureID); GlobalVars.ShirtTextureLocal = GetItemTextureLocalPath(GlobalVars.ShirtTextureID, "Shirt");
GlobalVars.PantsTextureLocal = GetItemTextureLocalPath(GlobalVars.PantsTextureID); GlobalVars.PantsTextureLocal = GetItemTextureLocalPath(GlobalVars.PantsTextureID, "Pants");
GlobalVars.FaceTextureLocal = GetItemTextureLocalPath(GlobalVars.FaceTextureID); GlobalVars.FaceTextureLocal = GetItemTextureLocalPath(GlobalVars.FaceTextureID, "Face");
} }
} }
public static string GetItemTextureLocalPath(string item) public static string GetItemTextureLocalPath(string item, string nameprefix)
{ {
//don't bother, we're offline. //don't bother, we're offline.
if (GlobalVars.ExternalIP.Equals("localhost")) if (GlobalVars.ExternalIP.Equals("localhost"))
@ -1160,11 +1160,18 @@ public class GlobalFuncs
if (!GlobalVars.SelectedClientInfo.CommandLineArgs.Contains("%localizeonlineclothing%")) if (!GlobalVars.SelectedClientInfo.CommandLineArgs.Contains("%localizeonlineclothing%"))
return ""; return "";
string peram = "id="; if (item.Contains("http://") || item.Contains("https://"))
string id = item.After(peram);
if (item.Contains(peram))
{ {
Downloader download = new Downloader(item, id + ".png", "", GlobalPaths.AssetCacheDirTextures); string peram = "id=";
string fullname = nameprefix + "Temp.png";
if (item.Contains(peram))
{
string id = item.After(peram);
fullname = id + ".png";
}
Downloader download = new Downloader(item, fullname, "", GlobalPaths.AssetCacheDirTextures);
try try
{ {
@ -1195,8 +1202,7 @@ public class GlobalFuncs
if (!GlobalVars.SelectedClientInfo.CommandLineArgs.Contains("%localizeonlineclothing%")) if (!GlobalVars.SelectedClientInfo.CommandLineArgs.Contains("%localizeonlineclothing%"))
return ""; return "";
string peram = "id="; if (item.Contains("http://") || item.Contains("https://"))
if (item.Contains(peram))
{ {
Downloader download = new Downloader(item, name + "Temp.rbxm", "", GlobalPaths.AssetCacheDirFonts); Downloader download = new Downloader(item, name + "Temp.rbxm", "", GlobalPaths.AssetCacheDirFonts);
@ -1215,10 +1221,7 @@ public class GlobalFuncs
doc = XDocument.Load(xmlReader); doc = XDocument.Load(xmlReader);
} }
string id = item.After(peram); return RobloxXML.GetURLInNodes(doc, assetCacheDef.Class, assetCacheDef.Id[0], item);
string baseURL = item.Before(id);
return RobloxXML.GetURLInNodes(doc, assetCacheDef.Class, assetCacheDef.Id[0], baseURL);
} }
#if URI || LAUNCHER || CMD || BASICLAUNCHER #if URI || LAUNCHER || CMD || BASICLAUNCHER
catch (Exception ex) catch (Exception ex)
@ -2010,10 +2013,9 @@ public class GlobalFuncs
if (!info.AlreadyHasSecurity) if (!info.AlreadyHasSecurity)
{ {
Match match = Regex.Match(GlobalVars.UserConfiguration.PlayerTripcode, "[^a-zA-Z0-9]"); if (Regex.Match(GlobalVars.UserConfiguration.PlayerTripcode, "[^a-zA-Z0-9]") != Match.Empty ||
if (match != Match.Empty || string.IsNullOrWhiteSpace(GlobalVars.UserConfiguration.PlayerTripcode)) string.IsNullOrWhiteSpace(GlobalVars.UserConfiguration.PlayerTripcode))
{ {
MessageBox.Show(match.Captures.Count.ToString());
#if URI #if URI
if (label != null) if (label != null)
{ {

View File

@ -4,8 +4,12 @@ New Features:
- The Asset SDK Asset Localizer is now known as the Asset Fixer! - The Asset SDK Asset Localizer is now known as the Asset Fixer!
- Added the ability to "fix" all asset URLs by changing them to a URL of your choice! - Added the ability to "fix" all asset URLs by changing them to a URL of your choice!
- Added T-Shirt support to 2007E/2007E-Shaders. - Added T-Shirt support to 2007E/2007E-Shaders.
- T-Shirts loaded with Roblox Asset URLs/Redirects are not supported due to 2 issues with 2007e: Roblox Asset URLs/Redirects do not work properly in 2007E if it's a texture and using anything to get the current texture value for a ShirtGraphic or Decal returns a "bad cast" error. - T-Shirts with Roblox Asset URLs/Redirects are not supported due to 2 issues with 2007e: Roblox Asset URLs/Redirects do not work properly in 2007E if it's a texture and using anything to get the current texture value for a ShirtGraphic or Decal returns a "bad cast" error.
- As a result, T-Shirts loaded with Roblox Asset URLs/Redirects will not load in 2007e. - As a result, T-Shirts with Roblox Asset URLs/Redirects will not load in 2007e.
- Added ClientScript Variables:
- %tshirttexid%, %shirttexid%, %pantstexid%, %facetexid% - Returns the texture URL for the respective online clothing type. Returns nothing if the URL is invalid, the item isn't using Online Clothing, or %localizeonlineclothing% is not defined in the script.
- %tshirttexidlocal%, %shirttexidlocal%, %pantstexidlocal%, %facetexlocal%" - Returns the texture rbxasset URL for the respective online clothing type. Returns nothing if the URL is invalid, the item isn't using Online Clothing, or %localizeonlineclothing% is not defined in the script. Only the client who downloads the clothing would be able to see it.
- %localizeonlineclothing% - Grabs texture IDS for the %texid% variables and localizes the texture for the %texidlocal% variables. This WILL increase load times of your client depending on how many items are being downloaded.
Enhancements: Enhancements:
- Added an additional warning about certain GUI elements being disabled in later clients when No3D is selected. - Added an additional warning about certain GUI elements being disabled in later clients when No3D is selected.
@ -14,10 +18,6 @@ Enhancements:
- The server browser no longer requires a server to be the same exact version as the current running version of Novetus. - The server browser no longer requires a server to be the same exact version as the current running version of Novetus.
- The server browser now displays versions in red if they're not the same exact version. - The server browser now displays versions in red if they're not the same exact version.
- The master server security warning will now show up once for every Novetus session. - The master server security warning will now show up once for every Novetus session.
- Added ClientScript Variables:
- %tshirttexid%, %shirttexid%, %pantstexid%, %facetexid% - Returns the texture URL for the respective online clothing type. Returns nothing if the URL is invalid, the item isn't using Online Clothing, or %localizeonlineclothing% is not defined in the script.
- %tshirttexidlocal%, %shirttexidlocal%, %pantstexidlocal%, %facetexlocal%" - Returns the texture rbxasset URL for the respective online clothing type. Returns nothing if the URL is invalid, the item isn't using Online Clothing, or %localizeonlineclothing% is not defined in the script. Only the client who downloads the clothing would be able to see it.
- %localizeonlineclothing% - Grabs texture IDS for the %texid% variables and localizes the texture for the %texidlocal% variables. This WILL increase load times of your client depending on how many items are being downloaded.
Fixes: Fixes:
- Fixed the URL Override box in the Asset SDK not being functional. - Fixed the URL Override box in the Asset SDK not being functional.