From dfbd2c36d96eec4058f159952fe28cade2774261 Mon Sep 17 00:00:00 2001 From: Bitl Date: Thu, 5 Aug 2021 18:11:33 -0700 Subject: [PATCH] https:// support for customization, add proper online clothing support. Add https imgur setting. --- ContentProviders.xml | 7 +- .../CharacterCustomizationShared.cs | 8 +- .../CharCustom/CustomizationFuncs.cs | 2 +- scripts/2007E-Shaders/CSMPFunctions.lua | 18 --- scripts/2007E/CSMPFunctions.lua | 19 +--- scripts/2007M-Shaders/CSMPFunctions.lua | 25 ++++- scripts/2007M/CSMPFunctions.lua | 25 ++++- scripts/2008M/CSMPFunctions.lua | 75 +++++++++++-- scripts/2009E-HD/CSMPFunctions.lua | 106 +++++++++++++++--- scripts/2009E/CSMPFunctions.lua | 106 +++++++++++++++--- scripts/2010L/CSMPFunctions.lua | 106 +++++++++++++++--- scripts/2011E/CSMPFunctions.lua | 106 +++++++++++++++--- scripts/2011M/CSMPFunctions.lua | 106 +++++++++++++++--- scripts/3DView/CSView.lua | 106 +++++++++++++++--- 14 files changed, 674 insertions(+), 141 deletions(-) diff --git a/ContentProviders.xml b/ContentProviders.xml index aa9ead1..e3b8a1e 100644 --- a/ContentProviders.xml +++ b/ContentProviders.xml @@ -13,9 +13,14 @@ roblox.png - Imgur + Imgur (HTTP) http://i.imgur.com/ imgur.png + + Imgur (HTTPS) + https://i.imgur.com/ + imgur.png + \ No newline at end of file diff --git a/Novetus/NovetusCore/CharCustom/CharacterCustomizationShared.cs b/Novetus/NovetusCore/CharCustom/CharacterCustomizationShared.cs index ed8fc8e..95b2c6f 100644 --- a/Novetus/NovetusCore/CharCustom/CharacterCustomizationShared.cs +++ b/Novetus/NovetusCore/CharCustom/CharacterCustomizationShared.cs @@ -134,7 +134,7 @@ class CharacterCustomizationShared } //face - if (GlobalVars.UserCustomization.Face.Contains("http://")) + if (GlobalVars.UserCustomization.Face.Contains("http://") || GlobalVars.UserCustomization.Face.Contains("https://")) { Provider faceProvider = OnlineClothing.FindContentProviderByURL(contentProviders, GlobalVars.UserCustomization.Face); FaceIDBox.Text = GlobalVars.UserCustomization.Face.Replace(faceProvider.URL, ""); @@ -142,21 +142,21 @@ class CharacterCustomizationShared } //clothing - if (GlobalVars.UserCustomization.TShirt.Contains("http://")) + if (GlobalVars.UserCustomization.TShirt.Contains("http://") || GlobalVars.UserCustomization.TShirt.Contains("https://")) { Provider tShirtProvider = OnlineClothing.FindContentProviderByURL(contentProviders, GlobalVars.UserCustomization.TShirt); TShirtsIDBox.Text = GlobalVars.UserCustomization.TShirt.Replace(tShirtProvider.URL, ""); TShirtsTypeBox.SelectedItem = tShirtProvider.Name; } - if (GlobalVars.UserCustomization.Shirt.Contains("http://")) + if (GlobalVars.UserCustomization.Shirt.Contains("http://") || GlobalVars.UserCustomization.Shirt.Contains("https://")) { Provider shirtProvider = OnlineClothing.FindContentProviderByURL(contentProviders, GlobalVars.UserCustomization.Shirt); ShirtsIDBox.Text = GlobalVars.UserCustomization.Shirt.Replace(shirtProvider.URL, ""); ShirtsTypeBox.SelectedItem = shirtProvider.Name; } - if (GlobalVars.UserCustomization.Pants.Contains("http://")) + if (GlobalVars.UserCustomization.Pants.Contains("http://") || GlobalVars.UserCustomization.Pants.Contains("https://")) { Provider pantsProvider = OnlineClothing.FindContentProviderByURL(contentProviders, GlobalVars.UserCustomization.Pants); PantsIDBox.Text = GlobalVars.UserCustomization.Pants.Replace(pantsProvider.URL, ""); diff --git a/Novetus/NovetusCore/CharCustom/CustomizationFuncs.cs b/Novetus/NovetusCore/CharCustom/CustomizationFuncs.cs index e609d76..c2866e0 100644 --- a/Novetus/NovetusCore/CharCustom/CustomizationFuncs.cs +++ b/Novetus/NovetusCore/CharCustom/CustomizationFuncs.cs @@ -79,7 +79,7 @@ using System.Windows.Forms; public static bool IsItemURL(string item) { - if (item.Contains("http://")) + if (item.Contains("http://") || item.Contains("https://")) return true; return false; diff --git a/scripts/2007E-Shaders/CSMPFunctions.lua b/scripts/2007E-Shaders/CSMPFunctions.lua index eb2219f..fc0e4de 100644 --- a/scripts/2007E-Shaders/CSMPFunctions.lua +++ b/scripts/2007E-Shaders/CSMPFunctions.lua @@ -74,24 +74,6 @@ function LoadCharacterNew(playerApp,newChar) pcall(function() charparts[newVal.ColorIndex.Value].BrickColor = newVal.Value end) - elseif (newVal.Name == "T-Shirt") then - pcall(function() - local newTShirt = ""; - if (string.match(newVal.Value, "http") == "http") then - newTShirt = Instance.new("ShirtGraphic") - newTShirt.Graphic = newVal.Value - newTShirt.Parent = newChar - else - newTShirt = game.Workspace:insertContent(path.."tshirts/"..newVal.Value) - if newTShirt[1] then - if newTShirt[1].className == "ShirtGraphic" then - newTShirt[1].Parent = newChar - else - newTShirt[1]:remove() - end - end - end - end) elseif (newVal.Name == "Extra") then pcall(function() local newItem = game.Workspace:insertContent(path.."custom/"..newVal.Value) diff --git a/scripts/2007E/CSMPFunctions.lua b/scripts/2007E/CSMPFunctions.lua index eb2219f..8d0349e 100644 --- a/scripts/2007E/CSMPFunctions.lua +++ b/scripts/2007E/CSMPFunctions.lua @@ -74,24 +74,7 @@ function LoadCharacterNew(playerApp,newChar) pcall(function() charparts[newVal.ColorIndex.Value].BrickColor = newVal.Value end) - elseif (newVal.Name == "T-Shirt") then - pcall(function() - local newTShirt = ""; - if (string.match(newVal.Value, "http") == "http") then - newTShirt = Instance.new("ShirtGraphic") - newTShirt.Graphic = newVal.Value - newTShirt.Parent = newChar - else - newTShirt = game.Workspace:insertContent(path.."tshirts/"..newVal.Value) - if newTShirt[1] then - if newTShirt[1].className == "ShirtGraphic" then - newTShirt[1].Parent = newChar - else - newTShirt[1]:remove() - end - end - end - end) + elseif (newVal.Name == "Extra") then pcall(function() local newItem = game.Workspace:insertContent(path.."custom/"..newVal.Value) diff --git a/scripts/2007M-Shaders/CSMPFunctions.lua b/scripts/2007M-Shaders/CSMPFunctions.lua index e7abf99..2b3dd18 100644 --- a/scripts/2007M-Shaders/CSMPFunctions.lua +++ b/scripts/2007M-Shaders/CSMPFunctions.lua @@ -89,9 +89,28 @@ function LoadCharacterNew(playerApp,newChar) pcall(function() local newTShirt = ""; if (string.match(newVal.Value, "http") == "http") then - newTShirt = Instance.new("ShirtGraphic") - newTShirt.Graphic = newVal.Value - newTShirt.Parent = newChar + if (pcall(function() + newTShirt = game.Workspace:InsertContent(newVal.Value) + if newTShirt[1] then + if newTShirt[1].className == "ShirtGraphic" then + newTShirt[1].Parent = newChar + local oldTexture = newTShirt[1].Graphic; + OldURL,OldID = oldTexture:match("(.+)=(.+)") + NewURL,NewID = newVal.Value:match("(.+)=(.+)") + newTShirt[1].Graphic = NewURL .. '=' .. OldID + else + newTShirt[1]:remove() + end + end + end)) then + --nothing + print("success"); + else + print("fail"); + newTShirt = Instance.new("ShirtGraphic") + newTShirt.Graphic = newVal.Value + newTShirt.Parent = newChar + end else newTShirt = game.Workspace:InsertContent(path.."tshirts/"..newVal.Value) if newTShirt[1] then diff --git a/scripts/2007M/CSMPFunctions.lua b/scripts/2007M/CSMPFunctions.lua index ddb12fb..345af76 100644 --- a/scripts/2007M/CSMPFunctions.lua +++ b/scripts/2007M/CSMPFunctions.lua @@ -89,9 +89,28 @@ function LoadCharacterNew(playerApp,newChar) pcall(function() local newTShirt = ""; if (string.match(newVal.Value, "http") == "http") then - newTShirt = Instance.new("ShirtGraphic") - newTShirt.Graphic = newVal.Value - newTShirt.Parent = newChar + if (pcall(function() + newTShirt = game.Workspace:InsertContent(newVal.Value) + if newTShirt[1] then + if newTShirt[1].className == "ShirtGraphic" then + newTShirt[1].Parent = newChar + local oldTexture = newTShirt[1].Graphic; + OldURL,OldID = oldTexture:match("(.+)=(.+)") + NewURL,NewID = newVal.Value:match("(.+)=(.+)") + newTShirt[1].Graphic = NewURL .. '=' .. OldID + else + newTShirt[1]:remove() + end + end + end)) then + --nothing + print("success"); + else + print("fail"); + newTShirt = Instance.new("ShirtGraphic") + newTShirt.Graphic = newVal.Value + newTShirt.Parent = newChar + end else newTShirt = game.Workspace:InsertContent(path.."tshirts/"..newVal.Value) if newTShirt[1] then diff --git a/scripts/2008M/CSMPFunctions.lua b/scripts/2008M/CSMPFunctions.lua index 339eea8..973ae2a 100644 --- a/scripts/2008M/CSMPFunctions.lua +++ b/scripts/2008M/CSMPFunctions.lua @@ -90,9 +90,28 @@ function LoadCharacterNew(playerApp,newChar) pcall(function() local newTShirt = ""; if (string.match(newVal.Value, "http") == "http") then - newTShirt = Instance.new("ShirtGraphic") - newTShirt.Graphic = newVal.Value - newTShirt.Parent = newChar + if (pcall(function() + newTShirt = game.Workspace:InsertContent(newVal.Value) + if newTShirt[1] then + if newTShirt[1].className == "ShirtGraphic" then + newTShirt[1].Parent = newChar + local oldTexture = newTShirt[1].Graphic; + OldURL,OldID = oldTexture:match("(.+)=(.+)") + NewURL,NewID = newVal.Value:match("(.+)=(.+)") + newTShirt[1].Graphic = NewURL .. '=' .. OldID + else + newTShirt[1]:remove() + end + end + end)) then + --nothing + print("success"); + else + print("fail"); + newTShirt = Instance.new("ShirtGraphic") + newTShirt.Graphic = newVal.Value + newTShirt.Parent = newChar + end else newTShirt = game.Workspace:InsertContent(path.."tshirts/"..newVal.Value) if newTShirt[1] then @@ -108,9 +127,28 @@ function LoadCharacterNew(playerApp,newChar) pcall(function() local newShirt = ""; if (string.match(newVal.Value, "http") == "http") then - newShirt = Instance.new("Shirt") - newShirt.ShirtTemplate = newVal.Value - newShirt.Parent = newChar + if (pcall(function() + newShirt = game.Workspace:InsertContent(newVal.Value) + if newShirt[1] then + if newShirt[1].className == "Shirt" then + newShirt[1].Parent = newChar + local oldTexture = newShirt[1].ShirtTemplate; + OldURL,OldID = oldTexture:match("(.+)=(.+)") + NewURL,NewID = newVal.Value:match("(.+)=(.+)") + newShirt[1].ShirtTemplate = NewURL .. '=' .. OldID + else + newShirt[1]:remove() + end + end + end)) then + --nothing + print("success"); + else + print("fail"); + newShirt = Instance.new("Shirt") + newShirt.ShirtTemplate = newVal.Value + newShirt.Parent = newChar + end else newShirt = game.Workspace:InsertContent(path.."shirts/"..newVal.Value) if newShirt[1] then @@ -126,9 +164,28 @@ function LoadCharacterNew(playerApp,newChar) pcall(function() local newPants = ""; if (string.match(newVal.Value, "http") == "http") then - newPants = Instance.new("Pants") - newPants.PantsTemplate = newVal.Value - newPants.Parent = newChar + if (pcall(function() + newPants = game.Workspace:InsertContent(newVal.Value) + if newPants[1] then + if newPants[1].className == "Pants" then + newPants[1].Parent = newChar + local oldTexture = newPants[1].PantsTemplate; + OldURL,OldID = oldTexture:match("(.+)=(.+)") + NewURL,NewID = newVal.Value:match("(.+)=(.+)") + newPants[1].PantsTemplate = NewURL .. '=' .. OldID + else + newPants[1]:remove() + end + end + end)) then + --nothing + print("success"); + else + print("fail"); + newPants = Instance.new("Pants") + newPants.PantsTemplate = newVal.Value + newPants.Parent = newChar + end else newPants = game.Workspace:InsertContent(path.."pants/"..newVal.Value) if newPants[1] then diff --git a/scripts/2009E-HD/CSMPFunctions.lua b/scripts/2009E-HD/CSMPFunctions.lua index 0e49ad2..566305f 100644 --- a/scripts/2009E-HD/CSMPFunctions.lua +++ b/scripts/2009E-HD/CSMPFunctions.lua @@ -90,9 +90,28 @@ function LoadCharacterNew(playerApp,newChar) pcall(function() local newTShirt = ""; if (string.match(newVal.Value, "http") == "http") then - newTShirt = Instance.new("ShirtGraphic") - newTShirt.Graphic = newVal.Value - newTShirt.Parent = newChar + if (pcall(function() + newTShirt = game.Workspace:InsertContent(newVal.Value) + if newTShirt[1] then + if newTShirt[1].className == "ShirtGraphic" then + newTShirt[1].Parent = newChar + local oldTexture = newTShirt[1].Graphic; + OldURL,OldID = oldTexture:match("(.+)=(.+)") + NewURL,NewID = newVal.Value:match("(.+)=(.+)") + newTShirt[1].Graphic = NewURL .. '=' .. OldID + else + newTShirt[1]:remove() + end + end + end)) then + --nothing + print("success"); + else + print("fail"); + newTShirt = Instance.new("ShirtGraphic") + newTShirt.Graphic = newVal.Value + newTShirt.Parent = newChar + end else newTShirt = game.Workspace:InsertContent(path.."tshirts/"..newVal.Value) if newTShirt[1] then @@ -108,9 +127,28 @@ function LoadCharacterNew(playerApp,newChar) pcall(function() local newShirt = ""; if (string.match(newVal.Value, "http") == "http") then - newShirt = Instance.new("Shirt") - newShirt.ShirtTemplate = newVal.Value - newShirt.Parent = newChar + if (pcall(function() + newShirt = game.Workspace:InsertContent(newVal.Value) + if newShirt[1] then + if newShirt[1].className == "Shirt" then + newShirt[1].Parent = newChar + local oldTexture = newShirt[1].ShirtTemplate; + OldURL,OldID = oldTexture:match("(.+)=(.+)") + NewURL,NewID = newVal.Value:match("(.+)=(.+)") + newShirt[1].ShirtTemplate = NewURL .. '=' .. OldID + else + newShirt[1]:remove() + end + end + end)) then + --nothing + print("success"); + else + print("fail"); + newShirt = Instance.new("Shirt") + newShirt.ShirtTemplate = newVal.Value + newShirt.Parent = newChar + end else newShirt = game.Workspace:InsertContent(path.."shirts/"..newVal.Value) if newShirt[1] then @@ -126,9 +164,28 @@ function LoadCharacterNew(playerApp,newChar) pcall(function() local newPants = ""; if (string.match(newVal.Value, "http") == "http") then - newPants = Instance.new("Pants") - newPants.PantsTemplate = newVal.Value - newPants.Parent = newChar + if (pcall(function() + newPants = game.Workspace:InsertContent(newVal.Value) + if newPants[1] then + if newPants[1].className == "Pants" then + newPants[1].Parent = newChar + local oldTexture = newPants[1].PantsTemplate; + OldURL,OldID = oldTexture:match("(.+)=(.+)") + NewURL,NewID = newVal.Value:match("(.+)=(.+)") + newPants[1].PantsTemplate = NewURL .. '=' .. OldID + else + newPants[1]:remove() + end + end + end)) then + --nothing + print("success"); + else + print("fail"); + newPants = Instance.new("Pants") + newPants.PantsTemplate = newVal.Value + newPants.Parent = newChar + end else newPants = game.Workspace:InsertContent(path.."pants/"..newVal.Value) if newPants[1] then @@ -144,11 +201,32 @@ function LoadCharacterNew(playerApp,newChar) pcall(function() local newFace = ""; if (string.match(newVal.Value, "http") == "http") then - newWaitForChild(charparts[1],"face"):remove() - newFace = Instance.new("Decal") - newFace.Texture = newVal.Value - newFace.Face = "Front" - newFace.Parent = charparts[1] + if (pcall(function() + newFace = game.Workspace:InsertContent(newVal.Value) + if newFace[1] then + if newFace[1].className == "Decal" then + newWaitForChild(charparts[1],"face"):remove() + newFace[1].Parent = charparts[1] + newFace[1].Face = "Front" + local oldTexture = newFace[1].Texture; + OldURL,OldID = oldTexture:match("(.+)=(.+)") + NewURL,NewID = newVal.Value:match("(.+)=(.+)") + newFace[1].Texture = NewURL .. '=' .. OldID + else + newFace[1]:remove() + end + end + end)) then + --nothing + print("success"); + else + print("fail"); + newWaitForChild(charparts[1],"face"):remove() + newFace = Instance.new("Decal") + newFace.Texture = newVal.Value + newFace.Face = "Front" + newFace.Parent = charparts[1] + end else newFace = game.Workspace:InsertContent(path.."faces/"..newVal.Value) if newFace[1] then diff --git a/scripts/2009E/CSMPFunctions.lua b/scripts/2009E/CSMPFunctions.lua index 0e49ad2..566305f 100644 --- a/scripts/2009E/CSMPFunctions.lua +++ b/scripts/2009E/CSMPFunctions.lua @@ -90,9 +90,28 @@ function LoadCharacterNew(playerApp,newChar) pcall(function() local newTShirt = ""; if (string.match(newVal.Value, "http") == "http") then - newTShirt = Instance.new("ShirtGraphic") - newTShirt.Graphic = newVal.Value - newTShirt.Parent = newChar + if (pcall(function() + newTShirt = game.Workspace:InsertContent(newVal.Value) + if newTShirt[1] then + if newTShirt[1].className == "ShirtGraphic" then + newTShirt[1].Parent = newChar + local oldTexture = newTShirt[1].Graphic; + OldURL,OldID = oldTexture:match("(.+)=(.+)") + NewURL,NewID = newVal.Value:match("(.+)=(.+)") + newTShirt[1].Graphic = NewURL .. '=' .. OldID + else + newTShirt[1]:remove() + end + end + end)) then + --nothing + print("success"); + else + print("fail"); + newTShirt = Instance.new("ShirtGraphic") + newTShirt.Graphic = newVal.Value + newTShirt.Parent = newChar + end else newTShirt = game.Workspace:InsertContent(path.."tshirts/"..newVal.Value) if newTShirt[1] then @@ -108,9 +127,28 @@ function LoadCharacterNew(playerApp,newChar) pcall(function() local newShirt = ""; if (string.match(newVal.Value, "http") == "http") then - newShirt = Instance.new("Shirt") - newShirt.ShirtTemplate = newVal.Value - newShirt.Parent = newChar + if (pcall(function() + newShirt = game.Workspace:InsertContent(newVal.Value) + if newShirt[1] then + if newShirt[1].className == "Shirt" then + newShirt[1].Parent = newChar + local oldTexture = newShirt[1].ShirtTemplate; + OldURL,OldID = oldTexture:match("(.+)=(.+)") + NewURL,NewID = newVal.Value:match("(.+)=(.+)") + newShirt[1].ShirtTemplate = NewURL .. '=' .. OldID + else + newShirt[1]:remove() + end + end + end)) then + --nothing + print("success"); + else + print("fail"); + newShirt = Instance.new("Shirt") + newShirt.ShirtTemplate = newVal.Value + newShirt.Parent = newChar + end else newShirt = game.Workspace:InsertContent(path.."shirts/"..newVal.Value) if newShirt[1] then @@ -126,9 +164,28 @@ function LoadCharacterNew(playerApp,newChar) pcall(function() local newPants = ""; if (string.match(newVal.Value, "http") == "http") then - newPants = Instance.new("Pants") - newPants.PantsTemplate = newVal.Value - newPants.Parent = newChar + if (pcall(function() + newPants = game.Workspace:InsertContent(newVal.Value) + if newPants[1] then + if newPants[1].className == "Pants" then + newPants[1].Parent = newChar + local oldTexture = newPants[1].PantsTemplate; + OldURL,OldID = oldTexture:match("(.+)=(.+)") + NewURL,NewID = newVal.Value:match("(.+)=(.+)") + newPants[1].PantsTemplate = NewURL .. '=' .. OldID + else + newPants[1]:remove() + end + end + end)) then + --nothing + print("success"); + else + print("fail"); + newPants = Instance.new("Pants") + newPants.PantsTemplate = newVal.Value + newPants.Parent = newChar + end else newPants = game.Workspace:InsertContent(path.."pants/"..newVal.Value) if newPants[1] then @@ -144,11 +201,32 @@ function LoadCharacterNew(playerApp,newChar) pcall(function() local newFace = ""; if (string.match(newVal.Value, "http") == "http") then - newWaitForChild(charparts[1],"face"):remove() - newFace = Instance.new("Decal") - newFace.Texture = newVal.Value - newFace.Face = "Front" - newFace.Parent = charparts[1] + if (pcall(function() + newFace = game.Workspace:InsertContent(newVal.Value) + if newFace[1] then + if newFace[1].className == "Decal" then + newWaitForChild(charparts[1],"face"):remove() + newFace[1].Parent = charparts[1] + newFace[1].Face = "Front" + local oldTexture = newFace[1].Texture; + OldURL,OldID = oldTexture:match("(.+)=(.+)") + NewURL,NewID = newVal.Value:match("(.+)=(.+)") + newFace[1].Texture = NewURL .. '=' .. OldID + else + newFace[1]:remove() + end + end + end)) then + --nothing + print("success"); + else + print("fail"); + newWaitForChild(charparts[1],"face"):remove() + newFace = Instance.new("Decal") + newFace.Texture = newVal.Value + newFace.Face = "Front" + newFace.Parent = charparts[1] + end else newFace = game.Workspace:InsertContent(path.."faces/"..newVal.Value) if newFace[1] then diff --git a/scripts/2010L/CSMPFunctions.lua b/scripts/2010L/CSMPFunctions.lua index 86f922e..18e4a3b 100644 --- a/scripts/2010L/CSMPFunctions.lua +++ b/scripts/2010L/CSMPFunctions.lua @@ -93,9 +93,28 @@ function LoadCharacterNew(playerApp,newChar) pcall(function() local newTShirt = ""; if (string.match(newVal.Value, "http") == "http") then - newTShirt = Instance.new("ShirtGraphic") - newTShirt.Graphic = newVal.Value - newTShirt.Parent = newChar + if (pcall(function() + newTShirt = game.Workspace:InsertContent(newVal.Value) + if newTShirt[1] then + if newTShirt[1].className == "ShirtGraphic" then + newTShirt[1].Parent = newChar + local oldTexture = newTShirt[1].Graphic; + OldURL,OldID = oldTexture:match("(.+)=(.+)") + NewURL,NewID = newVal.Value:match("(.+)=(.+)") + newTShirt[1].Graphic = NewURL .. '=' .. OldID + else + newTShirt[1]:remove() + end + end + end)) then + --nothing + print("success"); + else + print("fail"); + newTShirt = Instance.new("ShirtGraphic") + newTShirt.Graphic = newVal.Value + newTShirt.Parent = newChar + end else newTShirt = game.Workspace:InsertContent(path.."tshirts/"..newVal.Value) if newTShirt[1] then @@ -111,9 +130,28 @@ function LoadCharacterNew(playerApp,newChar) pcall(function() local newShirt = ""; if (string.match(newVal.Value, "http") == "http") then - newShirt = Instance.new("Shirt") - newShirt.ShirtTemplate = newVal.Value - newShirt.Parent = newChar + if (pcall(function() + newShirt = game.Workspace:InsertContent(newVal.Value) + if newShirt[1] then + if newShirt[1].className == "Shirt" then + newShirt[1].Parent = newChar + local oldTexture = newShirt[1].ShirtTemplate; + OldURL,OldID = oldTexture:match("(.+)=(.+)") + NewURL,NewID = newVal.Value:match("(.+)=(.+)") + newShirt[1].ShirtTemplate = NewURL .. '=' .. OldID + else + newShirt[1]:remove() + end + end + end)) then + --nothing + print("success"); + else + print("fail"); + newShirt = Instance.new("Shirt") + newShirt.ShirtTemplate = newVal.Value + newShirt.Parent = newChar + end else newShirt = game.Workspace:InsertContent(path.."shirts/"..newVal.Value) if newShirt[1] then @@ -129,9 +167,28 @@ function LoadCharacterNew(playerApp,newChar) pcall(function() local newPants = ""; if (string.match(newVal.Value, "http") == "http") then - newPants = Instance.new("Pants") - newPants.PantsTemplate = newVal.Value - newPants.Parent = newChar + if (pcall(function() + newPants = game.Workspace:InsertContent(newVal.Value) + if newPants[1] then + if newPants[1].className == "Pants" then + newPants[1].Parent = newChar + local oldTexture = newPants[1].PantsTemplate; + OldURL,OldID = oldTexture:match("(.+)=(.+)") + NewURL,NewID = newVal.Value:match("(.+)=(.+)") + newPants[1].PantsTemplate = NewURL .. '=' .. OldID + else + newPants[1]:remove() + end + end + end)) then + --nothing + print("success"); + else + print("fail"); + newPants = Instance.new("Pants") + newPants.PantsTemplate = newVal.Value + newPants.Parent = newChar + end else newPants = game.Workspace:InsertContent(path.."pants/"..newVal.Value) if newPants[1] then @@ -147,11 +204,32 @@ function LoadCharacterNew(playerApp,newChar) pcall(function() local newFace = ""; if (string.match(newVal.Value, "http") == "http") then - newWaitForChild(charparts[1],"face"):remove() - newFace = Instance.new("Decal") - newFace.Texture = newVal.Value - newFace.Face = "Front" - newFace.Parent = charparts[1] + if (pcall(function() + newFace = game.Workspace:InsertContent(newVal.Value) + if newFace[1] then + if newFace[1].className == "Decal" then + newWaitForChild(charparts[1],"face"):remove() + newFace[1].Parent = charparts[1] + newFace[1].Face = "Front" + local oldTexture = newFace[1].Texture; + OldURL,OldID = oldTexture:match("(.+)=(.+)") + NewURL,NewID = newVal.Value:match("(.+)=(.+)") + newFace[1].Texture = NewURL .. '=' .. OldID + else + newFace[1]:remove() + end + end + end)) then + --nothing + print("success"); + else + print("fail"); + newWaitForChild(charparts[1],"face"):remove() + newFace = Instance.new("Decal") + newFace.Texture = newVal.Value + newFace.Face = "Front" + newFace.Parent = charparts[1] + end else newFace = game.Workspace:InsertContent(path.."faces/"..newVal.Value) if newFace[1] then diff --git a/scripts/2011E/CSMPFunctions.lua b/scripts/2011E/CSMPFunctions.lua index 15da639..de5688c 100644 --- a/scripts/2011E/CSMPFunctions.lua +++ b/scripts/2011E/CSMPFunctions.lua @@ -111,9 +111,28 @@ function LoadCharacterNew(playerApp,newChar) pcall(function() local newTShirt = ""; if (string.match(newVal.Value, "http") == "http") then - newTShirt = Instance.new("ShirtGraphic") - newTShirt.Graphic = newVal.Value - newTShirt.Parent = newChar + if (pcall(function() + newTShirt = game.Workspace:InsertContent(newVal.Value) + if newTShirt[1] then + if newTShirt[1].className == "ShirtGraphic" then + newTShirt[1].Parent = newChar + local oldTexture = newTShirt[1].Graphic; + OldURL,OldID = oldTexture:match("(.+)=(.+)") + NewURL,NewID = newVal.Value:match("(.+)=(.+)") + newTShirt[1].Graphic = NewURL .. '=' .. OldID + else + newTShirt[1]:remove() + end + end + end)) then + --nothing + print("success"); + else + print("fail"); + newTShirt = Instance.new("ShirtGraphic") + newTShirt.Graphic = newVal.Value + newTShirt.Parent = newChar + end else newTShirt = game.Workspace:InsertContent(path.."tshirts/"..newVal.Value) if newTShirt[1] then @@ -129,9 +148,28 @@ function LoadCharacterNew(playerApp,newChar) pcall(function() local newShirt = ""; if (string.match(newVal.Value, "http") == "http") then - newShirt = Instance.new("Shirt") - newShirt.ShirtTemplate = newVal.Value - newShirt.Parent = newChar + if (pcall(function() + newShirt = game.Workspace:InsertContent(newVal.Value) + if newShirt[1] then + if newShirt[1].className == "Shirt" then + newShirt[1].Parent = newChar + local oldTexture = newShirt[1].ShirtTemplate; + OldURL,OldID = oldTexture:match("(.+)=(.+)") + NewURL,NewID = newVal.Value:match("(.+)=(.+)") + newShirt[1].ShirtTemplate = NewURL .. '=' .. OldID + else + newShirt[1]:remove() + end + end + end)) then + --nothing + print("success"); + else + print("fail"); + newShirt = Instance.new("Shirt") + newShirt.ShirtTemplate = newVal.Value + newShirt.Parent = newChar + end else newShirt = game.Workspace:InsertContent(path.."shirts/"..newVal.Value) if newShirt[1] then @@ -147,9 +185,28 @@ function LoadCharacterNew(playerApp,newChar) pcall(function() local newPants = ""; if (string.match(newVal.Value, "http") == "http") then - newPants = Instance.new("Pants") - newPants.PantsTemplate = newVal.Value - newPants.Parent = newChar + if (pcall(function() + newPants = game.Workspace:InsertContent(newVal.Value) + if newPants[1] then + if newPants[1].className == "Pants" then + newPants[1].Parent = newChar + local oldTexture = newPants[1].PantsTemplate; + OldURL,OldID = oldTexture:match("(.+)=(.+)") + NewURL,NewID = newVal.Value:match("(.+)=(.+)") + newPants[1].PantsTemplate = NewURL .. '=' .. OldID + else + newPants[1]:remove() + end + end + end)) then + --nothing + print("success"); + else + print("fail"); + newPants = Instance.new("Pants") + newPants.PantsTemplate = newVal.Value + newPants.Parent = newChar + end else newPants = game.Workspace:InsertContent(path.."pants/"..newVal.Value) if newPants[1] then @@ -165,11 +222,32 @@ function LoadCharacterNew(playerApp,newChar) pcall(function() local newFace = ""; if (string.match(newVal.Value, "http") == "http") then - newWaitForChild(charparts[1],"face"):remove() - newFace = Instance.new("Decal") - newFace.Texture = newVal.Value - newFace.Face = "Front" - newFace.Parent = charparts[1] + if (pcall(function() + newFace = game.Workspace:InsertContent(newVal.Value) + if newFace[1] then + if newFace[1].className == "Decal" then + newWaitForChild(charparts[1],"face"):remove() + newFace[1].Parent = charparts[1] + newFace[1].Face = "Front" + local oldTexture = newFace[1].Texture; + OldURL,OldID = oldTexture:match("(.+)=(.+)") + NewURL,NewID = newVal.Value:match("(.+)=(.+)") + newFace[1].Texture = NewURL .. '=' .. OldID + else + newFace[1]:remove() + end + end + end)) then + --nothing + print("success"); + else + print("fail"); + newWaitForChild(charparts[1],"face"):remove() + newFace = Instance.new("Decal") + newFace.Texture = newVal.Value + newFace.Face = "Front" + newFace.Parent = charparts[1] + end else newFace = game.Workspace:InsertContent(path.."faces/"..newVal.Value) if newFace[1] then diff --git a/scripts/2011M/CSMPFunctions.lua b/scripts/2011M/CSMPFunctions.lua index a05847f..4b61da5 100644 --- a/scripts/2011M/CSMPFunctions.lua +++ b/scripts/2011M/CSMPFunctions.lua @@ -102,9 +102,28 @@ function LoadCharacterNew(playerApp,newChar) pcall(function() local newTShirt = ""; if (string.match(newVal.Value, "http") == "http") then - newTShirt = Instance.new("ShirtGraphic") - newTShirt.Graphic = newVal.Value - newTShirt.Parent = newChar + if (pcall(function() + newTShirt = game.Workspace:InsertContent(newVal.Value) + if newTShirt[1] then + if newTShirt[1].className == "ShirtGraphic" then + newTShirt[1].Parent = newChar + local oldTexture = newTShirt[1].Graphic; + OldURL,OldID = oldTexture:match("(.+)=(.+)") + NewURL,NewID = newVal.Value:match("(.+)=(.+)") + newTShirt[1].Graphic = NewURL .. '=' .. OldID + else + newTShirt[1]:remove() + end + end + end)) then + --nothing + print("success"); + else + print("fail"); + newTShirt = Instance.new("ShirtGraphic") + newTShirt.Graphic = newVal.Value + newTShirt.Parent = newChar + end else newTShirt = game.Workspace:InsertContent(path.."tshirts/"..newVal.Value) if newTShirt[1] then @@ -120,9 +139,28 @@ function LoadCharacterNew(playerApp,newChar) pcall(function() local newShirt = ""; if (string.match(newVal.Value, "http") == "http") then - newShirt = Instance.new("Shirt") - newShirt.ShirtTemplate = newVal.Value - newShirt.Parent = newChar + if (pcall(function() + newShirt = game.Workspace:InsertContent(newVal.Value) + if newShirt[1] then + if newShirt[1].className == "Shirt" then + newShirt[1].Parent = newChar + local oldTexture = newShirt[1].ShirtTemplate; + OldURL,OldID = oldTexture:match("(.+)=(.+)") + NewURL,NewID = newVal.Value:match("(.+)=(.+)") + newShirt[1].ShirtTemplate = NewURL .. '=' .. OldID + else + newShirt[1]:remove() + end + end + end)) then + --nothing + print("success"); + else + print("fail"); + newShirt = Instance.new("Shirt") + newShirt.ShirtTemplate = newVal.Value + newShirt.Parent = newChar + end else newShirt = game.Workspace:InsertContent(path.."shirts/"..newVal.Value) if newShirt[1] then @@ -138,9 +176,28 @@ function LoadCharacterNew(playerApp,newChar) pcall(function() local newPants = ""; if (string.match(newVal.Value, "http") == "http") then - newPants = Instance.new("Pants") - newPants.PantsTemplate = newVal.Value - newPants.Parent = newChar + if (pcall(function() + newPants = game.Workspace:InsertContent(newVal.Value) + if newPants[1] then + if newPants[1].className == "Pants" then + newPants[1].Parent = newChar + local oldTexture = newPants[1].PantsTemplate; + OldURL,OldID = oldTexture:match("(.+)=(.+)") + NewURL,NewID = newVal.Value:match("(.+)=(.+)") + newPants[1].PantsTemplate = NewURL .. '=' .. OldID + else + newPants[1]:remove() + end + end + end)) then + --nothing + print("success"); + else + print("fail"); + newPants = Instance.new("Pants") + newPants.PantsTemplate = newVal.Value + newPants.Parent = newChar + end else newPants = game.Workspace:InsertContent(path.."pants/"..newVal.Value) if newPants[1] then @@ -156,11 +213,32 @@ function LoadCharacterNew(playerApp,newChar) pcall(function() local newFace = ""; if (string.match(newVal.Value, "http") == "http") then - newWaitForChild(charparts[1],"face"):remove() - newFace = Instance.new("Decal") - newFace.Texture = newVal.Value - newFace.Face = "Front" - newFace.Parent = charparts[1] + if (pcall(function() + newFace = game.Workspace:InsertContent(newVal.Value) + if newFace[1] then + if newFace[1].className == "Decal" then + newWaitForChild(charparts[1],"face"):remove() + newFace[1].Parent = charparts[1] + newFace[1].Face = "Front" + local oldTexture = newFace[1].Texture; + OldURL,OldID = oldTexture:match("(.+)=(.+)") + NewURL,NewID = newVal.Value:match("(.+)=(.+)") + newFace[1].Texture = NewURL .. '=' .. OldID + else + newFace[1]:remove() + end + end + end)) then + --nothing + print("success"); + else + print("fail"); + newWaitForChild(charparts[1],"face"):remove() + newFace = Instance.new("Decal") + newFace.Texture = newVal.Value + newFace.Face = "Front" + newFace.Parent = charparts[1] + end else newFace = game.Workspace:InsertContent(path.."faces/"..newVal.Value) if newFace[1] then diff --git a/scripts/3DView/CSView.lua b/scripts/3DView/CSView.lua index 4b1f562..b809179 100644 --- a/scripts/3DView/CSView.lua +++ b/scripts/3DView/CSView.lua @@ -39,9 +39,28 @@ function LoadCharacterNew(playerApp,newChar) pcall(function() local newTShirt = ""; if (string.match(newVal.Value, "http") == "http") then - newTShirt = Instance.new("ShirtGraphic") - newTShirt.Graphic = newVal.Value - newTShirt.Parent = newChar + if (pcall(function() + newTShirt = game.Workspace:InsertContent(newVal.Value) + if newTShirt[1] then + if newTShirt[1].className == "ShirtGraphic" then + newTShirt[1].Parent = newChar + local oldTexture = newTShirt[1].Graphic; + OldURL,OldID = oldTexture:match("(.+)=(.+)") + NewURL,NewID = newVal.Value:match("(.+)=(.+)") + newTShirt[1].Graphic = NewURL .. '=' .. OldID + else + newTShirt[1]:remove() + end + end + end)) then + --nothing + print("success"); + else + print("fail"); + newTShirt = Instance.new("ShirtGraphic") + newTShirt.Graphic = newVal.Value + newTShirt.Parent = newChar + end else newTShirt = game.Workspace:InsertContent(path.."tshirts/"..newVal.Value) if newTShirt[1] then @@ -57,9 +76,28 @@ function LoadCharacterNew(playerApp,newChar) pcall(function() local newShirt = ""; if (string.match(newVal.Value, "http") == "http") then - newShirt = Instance.new("Shirt") - newShirt.ShirtTemplate = newVal.Value - newShirt.Parent = newChar + if (pcall(function() + newShirt = game.Workspace:InsertContent(newVal.Value) + if newShirt[1] then + if newShirt[1].className == "Shirt" then + newShirt[1].Parent = newChar + local oldTexture = newShirt[1].ShirtTemplate; + OldURL,OldID = oldTexture:match("(.+)=(.+)") + NewURL,NewID = newVal.Value:match("(.+)=(.+)") + newShirt[1].ShirtTemplate = NewURL .. '=' .. OldID + else + newShirt[1]:remove() + end + end + end)) then + --nothing + print("success"); + else + print("fail"); + newShirt = Instance.new("Shirt") + newShirt.ShirtTemplate = newVal.Value + newShirt.Parent = newChar + end else newShirt = game.Workspace:InsertContent(path.."shirts/"..newVal.Value) if newShirt[1] then @@ -75,9 +113,28 @@ function LoadCharacterNew(playerApp,newChar) pcall(function() local newPants = ""; if (string.match(newVal.Value, "http") == "http") then - newPants = Instance.new("Pants") - newPants.PantsTemplate = newVal.Value - newPants.Parent = newChar + if (pcall(function() + newPants = game.Workspace:InsertContent(newVal.Value) + if newPants[1] then + if newPants[1].className == "Pants" then + newPants[1].Parent = newChar + local oldTexture = newPants[1].PantsTemplate; + OldURL,OldID = oldTexture:match("(.+)=(.+)") + NewURL,NewID = newVal.Value:match("(.+)=(.+)") + newPants[1].PantsTemplate = NewURL .. '=' .. OldID + else + newPants[1]:remove() + end + end + end)) then + --nothing + print("success"); + else + print("fail"); + newPants = Instance.new("Pants") + newPants.PantsTemplate = newVal.Value + newPants.Parent = newChar + end else newPants = game.Workspace:InsertContent(path.."pants/"..newVal.Value) if newPants[1] then @@ -93,11 +150,32 @@ function LoadCharacterNew(playerApp,newChar) pcall(function() local newFace = ""; if (string.match(newVal.Value, "http") == "http") then - newWaitForChild(charparts[1],"face"):remove() - newFace = Instance.new("Decal") - newFace.Texture = newVal.Value - newFace.Face = "Front" - newFace.Parent = charparts[1] + if (pcall(function() + newFace = game.Workspace:InsertContent(newVal.Value) + if newFace[1] then + if newFace[1].className == "Decal" then + newWaitForChild(charparts[1],"face"):remove() + newFace[1].Parent = charparts[1] + newFace[1].Face = "Front" + local oldTexture = newFace[1].Texture; + OldURL,OldID = oldTexture:match("(.+)=(.+)") + NewURL,NewID = newVal.Value:match("(.+)=(.+)") + newFace[1].Texture = NewURL .. '=' .. OldID + else + newFace[1]:remove() + end + end + end)) then + --nothing + print("success"); + else + print("fail"); + newWaitForChild(charparts[1],"face"):remove() + newFace = Instance.new("Decal") + newFace.Texture = newVal.Value + newFace.Face = "Front" + newFace.Parent = charparts[1] + end else newFace = game.Workspace:InsertContent(path.."faces/"..newVal.Value) if newFace[1] then