diff --git a/MxValheim/KillFeed/Patch.cs b/MxValheim/KillFeed/Patch.cs index c3131d6..c60b45e 100644 --- a/MxValheim/KillFeed/Patch.cs +++ b/MxValheim/KillFeed/Patch.cs @@ -53,12 +53,14 @@ namespace MxValheim.KillFeed string victimFormat = ""; string distanceFormat = ""; string starFormat = ""; + string crossFormat = ""; // Format Message in Divided Section starFormat = "★"; + crossFormat = "✝"; attackerFormat = $"{attacker.ToUpper()}"; if(type == 1) { - victimFormat = $"{victim.ToUpper()}"; + victimFormat = $"{crossFormat} {victim.ToUpper()}"; } else if(type == 2) { switch (level) @@ -75,18 +77,17 @@ namespace MxValheim.KillFeed case 4: victimFormat = $"{starFormat}{starFormat}{starFormat} {victim.ToUpper()}"; break; + case 5: + victimFormat = $"{starFormat}{starFormat}{starFormat}{starFormat} {victim.ToUpper()}"; + break; } } distanceFormat = $" à {distance:F1}m de distance."; finalMsg = - (type == 1) ? $"{victimFormat}{type1Separator}{attackerFormat}{distanceFormat}": - (type == 2) ? $"{attackerFormat}{type2Separator}{victimFormat}{distanceFormat}" : - $"{attackerFormat}{type2Separator}{victimFormat}{distanceFormat}"; - - /*string finalMsg = (type == 1) ? $"{victim.ToUpper()} a été tué par {attacker.ToUpper()} à {distance:F1}m de distance." : - (type == 2) ? $"{attacker.ToUpper()} a tué {victim.ToUpper()} à {distance:F1}m de distance." : - $"{attacker.ToUpper()} a tué {victim.ToUpper()} à {distance:F1}m de distance.";*/ + (type == 1) ? $"{victimFormat}{type1Separator}{attackerFormat}{distanceFormat}": // Player Death + (type == 2) ? $"{attackerFormat}{type2Separator}{victimFormat}{distanceFormat}": // Player Killed Something + $"{attackerFormat}{type2Separator}{victimFormat}{distanceFormat}"; // Failsafe Sprite weaponIcon = null; @@ -417,72 +418,5 @@ namespace MxValheim.KillFeed _hudRoot.SetActive(false); } - - /* - public void CreateCustomHud() - { - _hudRoot = new GameObject("MxKillFeed_Root"); - UnityEngine.Object.DontDestroyOnLoad(_hudRoot); - - Canvas c = _hudRoot.AddComponent(); - c.renderMode = RenderMode.ScreenSpaceOverlay; - c.sortingOrder = 10000; - - // Add a Scaler to ensure it looks right on all resolutions - CanvasScaler scaler = _hudRoot.AddComponent(); - scaler.uiScaleMode = CanvasScaler.ScaleMode.ScaleWithScreenSize; - scaler.referenceResolution = new Vector2(1920, 1080); - - _canvasGroup = _hudRoot.AddComponent(); - - GameObject panel = new GameObject("Background", typeof(RectTransform), typeof(Image)); - panel.transform.SetParent(_hudRoot.transform, false); - _panelImage = panel.GetComponent(); - - // Fallback: Set a solid color first in case the sprite search fails - _panelImage.color = new Color(0, 0, 0, 0.8f); - - foreach (Sprite s in Resources.FindObjectsOfTypeAll()) - { - if (s.name == "shout_field") - { - _panelImage.sprite = s; - _panelImage.type = Image.Type.Sliced; - break; - } - } - - RectTransform pRect = panel.GetComponent(); - pRect.anchorMin = pRect.anchorMax = pRect.pivot = new Vector2(0.5f, 0.95f); - pRect.anchoredPosition = Vector2.zero; // Center top - pRect.sizeDelta = new Vector2(550, 40); - pRect.localScale = Vector3.one; // FORCE SCALE TO 1 - - // Icon - GameObject iconObj = new GameObject("Icon", typeof(RectTransform), typeof(Image)); - iconObj.transform.SetParent(panel.transform, false); - _weaponIconSlot = iconObj.GetComponent(); - _weaponIconSlot.preserveAspect = true; - RectTransform iRect = iconObj.GetComponent(); - iRect.anchorMin = iRect.anchorMax = iRect.pivot = new Vector2(0, 0.5f); - iRect.anchoredPosition = new Vector2(10, 0); - iRect.sizeDelta = new Vector2(30, 30); - - // Text - GameObject textObj = new GameObject("Text", typeof(RectTransform), typeof(Text)); - textObj.transform.SetParent(panel.transform, false); - _killText = textObj.GetComponent(); - _killText.font = Resources.GetBuiltinResource("Arial.ttf"); - _killText.fontSize = 18; - _killText.alignment = TextAnchor.MiddleLeft; - _killText.supportRichText = true; - textObj.AddComponent().effectColor = Color.black; - - RectTransform tRect = textObj.GetComponent(); - tRect.anchorMin = Vector2.zero; tRect.anchorMax = Vector2.one; - tRect.offsetMin = new Vector2(50, 0); tRect.offsetMax = new Vector2(-10, 0); - - _hudRoot.SetActive(false); - }*/ } } \ No newline at end of file diff --git a/MxValheim/Localization/KillFeed.cs b/MxValheim/Localization/KillFeed.cs new file mode 100644 index 0000000..1db88cb --- /dev/null +++ b/MxValheim/Localization/KillFeed.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MxValheim.Localization +{ + internal class KillFeed + { + Dictionary killfeedLocales = new Dictionary + { + { " has been killed by ", " a été tué par " }, + { " killed ", " a tué " } + }; + } +} diff --git a/MxValheim/MxValheim.cs b/MxValheim/MxValheim.cs index 54847e1..033d2dc 100644 --- a/MxValheim/MxValheim.cs +++ b/MxValheim/MxValheim.cs @@ -21,7 +21,7 @@ public class MxValheimMod : BaseUnityPlugin private const string ModGUID = "ovh.mxdev.mxvalheim"; private const string ModName = "MxValheim"; - private const string ModVersion = "1.5.3"; + private const string ModVersion = "1.5.4"; public static ConfigEntry Config_Locked; public static ConfigEntry Config_OreMultiplier;