void HatChange(Profile pro, Tex2D customHat = null) { Tex2D hat = customHat ?? pro?.team?.hat?.texture; resetReskin(pro); if (pro?.duck == null || hat == null || hat.height <= ReskinFile.HatHeight || hat.width != 64) { return; } ReskinFile file = Reskin.tryLoadReskin(hat, false); if (file == null) { DevConsole.Log("Error loading reskin", Color.Red); return; } string md5 = (file.getChunk("MD5") as TextChunk)?.Text; string dir; if (Network.isActive && md5 != null && !pro.localPlayer) { if (Reskin.Exists(md5)) { dir = reskinMod.ReskinPath + md5; } else { requestReskin(pro, md5); return; } } else { dir = Reskin.CreateReskinFiles(file); } Reskin r = Reskin.GetReskin(dir); if (!Reskin.IsValid(r)) { DevConsole.Log("something is wrong with that reskin!", Color.Red); return; } DevConsole.Log("skin appied to " + pro.name, Color.Green); ActiveReskins.Add(pro, r); r.Apply(pro.duck); }
public override void Activate() { Profile pro = DuckNetwork.profiles[profile]; if (!Reskin.Exists(md5)) { DevConsole.Log("recieved request for non existing md5", Color.Red); return; } DataTransferManager.SendLotsOfData(Reskin.hatData[md5], "reskin", connection); }