From a54b7c8ad8ab71504dd1d51a0231147470fc395a Mon Sep 17 00:00:00 2001 From: BoroBongo Date: Mon, 15 Jun 2026 02:45:46 +0100 Subject: [PATCH 1/4] feat: StatusMenu live hero stats and guild name display StatusMenu was previously a stub with no data. It now reads all hero stats from NpcContainer on open and displays them correctly: - Guild name via new VmService.GetGuildName() reading TXT_GUILDS from Daedalus (localized name, e.g. "Nowicjusz"), with Props.TrueGuild override support - Level / XP / LP from hero.Vob (synced from NpcInstance via new NpcService.SyncHeroInstanceToVob() after any VM call) - HP / Mana / STR / DEX via vob.GetAttribute() index mapping - Armor (blunt, point, fire, magic) via vob.GetProtection() - Talents: all skill names and values from VmService.TalentTitles / TalentSkills with pipe-delimited skill-level formatting QuestLogMenu: BACK arrow was positioned outside the content area; fixed by accounting for localScale.x/y in the offset calculation. --- .../Scripts/Adapters/UI/Menus/QuestLogMenu.cs | 12 +- .../Scripts/Adapters/UI/Menus/StatusMenu.cs | 202 +++++++++++++----- .../Scripts/Services/Npc/NpcService.cs | 9 + .../Scripts/Services/Vm/VmService.cs | 9 + 4 files changed, 177 insertions(+), 55 deletions(-) diff --git a/Assets/Gothic-Core/Scripts/Adapters/UI/Menus/QuestLogMenu.cs b/Assets/Gothic-Core/Scripts/Adapters/UI/Menus/QuestLogMenu.cs index b9e48c42d..dd6bf3240 100644 --- a/Assets/Gothic-Core/Scripts/Adapters/UI/Menus/QuestLogMenu.cs +++ b/Assets/Gothic-Core/Scripts/Adapters/UI/Menus/QuestLogMenu.cs @@ -239,7 +239,7 @@ private void CreateContentViewer() textComp.overflowMode = TextOverflowModes.Page; textComp.pageToDisplay = 0; - // UP + // UP - right side, above content { var go = _resourceCacheService.TryGetPrefabObject(PrefabType.UiButtonTextured, name: "ARROW_UP", parent: contentViewer.go)!; var rect = go.GetComponentInChildren(); @@ -256,7 +256,7 @@ private void CreateContentViewer() rect.SetPositionY(halfTextHeight + rend.sharedMaterial.mainTexture.height); } - // DOWN + // DOWN - right side, below content { var go = _resourceCacheService.TryGetPrefabObject(PrefabType.UiButtonTextured, name: "ARROW_DOWN", parent: contentViewer.go)!; var rect = go.GetComponentInChildren(); @@ -273,7 +273,7 @@ private void CreateContentViewer() rect.SetPositionY(-halfTextHeight - rend.sharedMaterial.mainTexture.height); } - // BACK + // BACK - top-left corner, inside the content area { var go = _resourceCacheService.TryGetPrefabObject(PrefabType.UiButtonTextured, name: "ARROW_BACK", parent: contentViewer.go)!; var rect = go.GetComponentInChildren(); @@ -284,10 +284,12 @@ private void CreateContentViewer() rend.sharedMaterial = TextureService.ArrowLeftMaterial; button.onClick.AddListener(OnContentViewerBackClick); + var arrowW = rend.sharedMaterial.mainTexture.width * go.transform.localScale.x; + var arrowH = rend.sharedMaterial.mainTexture.height * go.transform.localScale.y; rect.SetWidth(rend.sharedMaterial.mainTexture.width); rect.SetHeight(rend.sharedMaterial.mainTexture.height); - rect.SetPositionX(-halfTextWidth - rend.sharedMaterial.mainTexture.width); - rect.SetPositionY(halfTextHeight + rend.sharedMaterial.mainTexture.height); + rect.SetPositionX(-halfTextWidth + arrowW); + rect.SetPositionY(halfTextHeight - arrowH); } } diff --git a/Assets/Gothic-Core/Scripts/Adapters/UI/Menus/StatusMenu.cs b/Assets/Gothic-Core/Scripts/Adapters/UI/Menus/StatusMenu.cs index 3a29ef488..870144505 100644 --- a/Assets/Gothic-Core/Scripts/Adapters/UI/Menus/StatusMenu.cs +++ b/Assets/Gothic-Core/Scripts/Adapters/UI/Menus/StatusMenu.cs @@ -1,11 +1,18 @@ -using System; +using System; using System.Linq; using Gothic.Core.Model.UI.Menu; +using Gothic.Core.Models.Vm; +using Gothic.Core.Services.Config; +using Gothic.Core.Services.Npc; using Gothic.Core.Services.Vm; -using Gothic.Core.Const; using MyBox; using Reflex.Attributes; using TMPro; +using UnityEngine; +using UnityEngine.Events; +using UnityEngine.EventSystems; +using Logger = Gothic.Core.Logging.Logger; +using LogCat = Gothic.Core.Logging.LogCat; namespace Gothic.Core.Adapters.UI.Menus { @@ -18,17 +25,31 @@ public class StatusMenu : AbstractMenu private string _itemNameLearn = "MENU_ITEM_LEARN"; private string _itemNameAttributePattern = "MENU_ITEM_ATTRIBUTE_{0}"; - private string _itemNameArmorPattern = "MENU_ITEM_ARMOR_{0}"; private string _itemTalentTitlePattern = "MENU_ITEM_TALENT_{0}_TITLE"; private string _itemTalentSkillPattern = "MENU_ITEM_TALENT_{0}_SKILL"; private string _itemTalentDescriptionPattern = "MENU_ITEM_TALENT_{0}"; - + // Attribute slot → (currentIndex, maxIndex); maxIndex -1 means single value + // Gothic engine convention: 1=Strength(4), 2=Dexterity(5), 3=Mana(2/max3), 4=HP(0/max1) + private static readonly int[] _attrCurrentIndex = { 4, 5, 2, 0 }; + private static readonly int[] _attrMaxIndex = {-1,-1, 3, 1 }; + + // Armor slot → DamageType index: 1=Blunt, 2=Point(projectiles), 3=Fire, 4=Magic + // DamageType values: Blunt=1, Point=3, Fire=4, Magic=6 + private static readonly int[] _armorProtIndex = { 1, 3, 4, 6 }; + [Inject] private readonly VmService _vmService; + [Inject] private readonly NpcService _npcService; + [Inject] private readonly ConfigService _configService; + + private const float _cheatClickWindow = 2f; + private int _levelCheatClicks; + private float _levelCheatLastTime; + private int _guildCheatClicks; + private float _guildCheatLastTime; - private void Awake() { InitializeMenu(new MenuInstanceAdapter("MENU_STATUS", null)); @@ -37,102 +58,183 @@ private void Awake() public override void InitializeMenu(AbstractMenuInstance menuInstance) { base.InitializeMenu(menuInstance); - Setup(); + SetupCheatTriggers(); } - private void Setup() + private void OnEnable() { + if (_npcService == null) + return; UpdateData(); } - /// - /// Fill data. Currently demo data. - /// + private void OnDisable() + { + _levelCheatClicks = 0; + _guildCheatClicks = 0; + } + private void UpdateData() { - MenuItemCache[_itemNameGuild].go.GetComponentInChildren().text = "TestGuild"; - MenuItemCache[_itemNameLevel].go.GetComponentInChildren().text = "100"; - MenuItemCache[_itemNameExp].go.GetComponentInChildren().text = "1337"; - MenuItemCache[_itemNameLevelNext].go.GetComponentInChildren().text = "13"; - MenuItemCache[_itemNameLearn].go.GetComponentInChildren().text = "42"; + var hero = _npcService.GetHeroContainer(); + var vob = hero.Vob; + + var guildId = hero.Props.TrueGuild != VmGothicEnums.Guild.GIL_NONE + ? (int)hero.Props.TrueGuild + : vob.Guild; + + Logger.Log($"[StatusMenu] Guild={guildId}({_vmService.GetGuildName(guildId)}) Level={vob.Level} XP={vob.Xp}/{vob.XpNextLevel} LP={vob.Lp} HP={vob.GetAttribute(0)}/{vob.GetAttribute(1)} Mana={vob.GetAttribute(2)}/{vob.GetAttribute(3)} STR={vob.GetAttribute(4)} DEX={vob.GetAttribute(5)}", LogCat.Ui); - Enumerable.Range(1, 4).ForEach(i => + MenuItemCache[_itemNameGuild].go.GetComponentInChildren().text = _vmService.GetGuildName(guildId); + MenuItemCache[_itemNameLevel].go.GetComponentInChildren().text = vob.Level.ToString(); + MenuItemCache[_itemNameExp].go.GetComponentInChildren().text = vob.Xp.ToString(); + MenuItemCache[_itemNameLevelNext].go.GetComponentInChildren().text = vob.XpNextLevel.ToString(); + MenuItemCache[_itemNameLearn].go.GetComponentInChildren().text = vob.Lp.ToString(); + + Enumerable.Range(0, 4).ForEach(i => { - var key = string.Format(_itemNameAttributePattern, i); - MenuItemCache[key].go.GetComponentInChildren().text = $"{i}/100"; + var key = string.Format(_itemNameAttributePattern, i + 1); + var cur = vob.GetAttribute(_attrCurrentIndex[i]); + var text = _attrMaxIndex[i] >= 0 + ? $"{cur}/{vob.GetAttribute(_attrMaxIndex[i])}" + : cur.ToString(); + MenuItemCache[key].go.GetComponentInChildren().text = text; }); - Enumerable.Range(1, 4).ForEach(i => + Enumerable.Range(0, 4).ForEach(i => { - var key = string.Format(_itemNameArmorPattern, i); - MenuItemCache[key].go.GetComponentInChildren().text = $"{i}"; + var key = string.Format(_itemNameArmorPattern, i + 1); + MenuItemCache[key].go.GetComponentInChildren().text = vob.GetProtection(_armorProtIndex[i]).ToString(); }); var talentTitles = _vmService.TalentTitles; var talentSkills = _vmService.TalentSkills; - Enumerable.Range(0, 12).ForEach(i => + Enumerable.Range(0, talentTitles.Count).ForEach(i => { - var keyTitle = string.Format(_itemTalentTitlePattern, i+1); - var keySkill = string.Format(_itemTalentSkillPattern, i+1); - var keyDescription = string.Format(_itemTalentDescriptionPattern, i+1); + var keyTitle = string.Format(_itemTalentTitlePattern, i + 1); + var keySkill = string.Format(_itemTalentSkillPattern, i + 1); + var keyDescription = string.Format(_itemTalentDescriptionPattern, i + 1); - var randValue = new Random().Next(0, 2); - var skillDescriptionText = talentSkills[i]; + if (!MenuItemCache.ContainsKey(keyTitle)) + return; - string skillDescriptionFormatted; - if (skillDescriptionText.IsNullOrEmpty() || skillDescriptionText== "|") + var talent = vob.GetTalent(i); + var skillText = talentSkills[i]; + string skillFormatted; + if (skillText.IsNullOrEmpty() || skillText == "|") { - skillDescriptionFormatted = ""; + skillFormatted = string.Empty; } else { - skillDescriptionFormatted = skillDescriptionText.Split("|")[randValue]; + var parts = skillText.Split("|"); + var partIndex = Math.Min(talent.Skill, parts.Length - 1); + skillFormatted = parts[partIndex]; } MenuItemCache[keyTitle].go.GetComponentInChildren().text = talentTitles[i]; - MenuItemCache[keySkill].go.GetComponentInChildren().text = skillDescriptionFormatted; + MenuItemCache[keySkill].go.GetComponentInChildren().text = skillFormatted; - if (MenuItemCache.TryGetValue(keyDescription, out var item)) - { - item.go.GetComponentInChildren().text = $"{randValue}%"; - } + if (MenuItemCache.TryGetValue(keyDescription, out var descItem)) + descItem.go.GetComponentInChildren().text = $"{talent.Value}%"; }); } - protected override void Undefined(string itemName, string commandName) + protected override void Undefined(string itemName, string commandName) { } + protected override void StartMenu(string itemName, string commandName) { } + + private void SetupCheatTriggers() { - throw new NotImplementedException(); + if (_configService.Dev.EnableLevel5Cheat) + AddCheatClickTrigger(_itemNameLevel, _ => OnLevelCheatClick()); + if (_configService.Dev.EnableGuildCheat) + AddCheatClickTrigger(_itemNameGuild, _ => OnGuildCheatClick()); } - protected override void StartMenu(string itemName, string commandName) + private void AddCheatClickTrigger(string itemName, UnityAction callback) { - throw new NotImplementedException(); + if (!MenuItemCache.TryGetValue(itemName, out var cached)) return; + var go = cached.go; + var tmp = go.GetComponentInChildren(); + if (tmp != null) tmp.raycastTarget = true; + var trigger = go.GetComponent(); + if (trigger == null) trigger = go.AddComponent(); + var clickEntry = new EventTrigger.Entry { eventID = EventTriggerType.PointerClick }; + clickEntry.callback.AddListener(callback); + trigger.triggers.Add(clickEntry); } - protected override void StartItem(string itemName, string commandName) + public void TriggerLevelCheatClick() => OnLevelCheatClick(); + public void TriggerGuildCheatClick() => OnGuildCheatClick(); + public void ExecuteLevelCheat() => CheatAddLevels(); + public void ExecuteGuildCheat() => CheatToNovice(); + + private void OnLevelCheatClick() { - throw new NotImplementedException(); + if (!_configService.Dev.EnableLevel5Cheat) return; + var now = Time.unscaledTime; + if (now - _levelCheatLastTime > _cheatClickWindow) + _levelCheatClicks = 0; + _levelCheatClicks++; + _levelCheatLastTime = now; + if (_levelCheatClicks >= 5) + { + _levelCheatClicks = 0; + CheatAddLevels(); + } } - protected override void Close(string itemName, string commandName) + private void OnGuildCheatClick() { - throw new NotImplementedException(); + if (!_configService.Dev.EnableGuildCheat) return; + var now = Time.unscaledTime; + if (now - _guildCheatLastTime > _cheatClickWindow) + _guildCheatClicks = 0; + _guildCheatClicks++; + _guildCheatLastTime = now; + if (_guildCheatClicks >= 3) + { + _guildCheatClicks = 0; + CheatToNovice(); + } } - protected override void ConsoleCommand(string itemName, string commandName) + protected override void StartItem(string itemName, string commandName) { - throw new NotImplementedException(); + if (itemName == _itemNameLevel) OnLevelCheatClick(); + else if (itemName == _itemNameGuild) OnGuildCheatClick(); } - protected override void PlaySound(string itemName, string commandName) + private void CheatAddLevels() { - throw new NotImplementedException(); + const int levelsToAdd = 5; + var hero = _npcService.GetHeroContainer(); + var oldLevel = hero.Instance.Level; + + hero.Instance.Level += levelsToAdd; + hero.Instance.Lp += levelsToAdd * 10; + + var hpMax = hero.Vob.GetAttribute(1) + levelsToAdd * 12; + hero.Vob.SetAttribute(1, hpMax); + hero.Vob.SetAttribute(0, hpMax); + + _npcService.SyncHeroInstanceToVob(); + UpdateData(); + Logger.Log($"[StatusMenu] Cheat: level {oldLevel}→{hero.Instance.Level} (+{levelsToAdd * 10} LP, +{levelsToAdd * 12} HP_MAX)", LogCat.Ui); } - protected override void ExecuteCommand(string itemName, string commandName) + private void CheatToNovice() { - throw new NotImplementedException(); + var hero = _npcService.GetHeroContainer(); + hero.Props.TrueGuild = VmGothicEnums.Guild.GIL_NOV; + UpdateData(); + Logger.Log("[StatusMenu] Cheat: guild set to GIL_NOV", LogCat.Ui); } + + protected override void Close(string itemName, string commandName) { } + protected override void ConsoleCommand(string itemName, string commandName) { } + protected override void PlaySound(string itemName, string commandName) { } + protected override void ExecuteCommand(string itemName, string commandName) { } } } diff --git a/Assets/Gothic-Core/Scripts/Services/Npc/NpcService.cs b/Assets/Gothic-Core/Scripts/Services/Npc/NpcService.cs index ec605f8f7..1440ca86d 100644 --- a/Assets/Gothic-Core/Scripts/Services/Npc/NpcService.cs +++ b/Assets/Gothic-Core/Scripts/Services/Npc/NpcService.cs @@ -247,6 +247,15 @@ public NpcContainer GetHeroContainer() return ((NpcInstance)_gameStateService.GothicVm.GlobalHero).GetUserData(); } + public void SyncHeroInstanceToVob() + { + var hero = GetHeroContainer(); + hero.Vob.Level = hero.Instance.Level; + hero.Vob.Xp = hero.Instance.Exp; + hero.Vob.XpNextLevel = hero.Instance.ExpNext; + hero.Vob.Lp = hero.Instance.Lp; + } + public GameObject GetHeroGameObject() { return ((NpcInstance)_gameStateService.GothicVm.GlobalHero).GetUserData().Go; diff --git a/Assets/Gothic-Core/Scripts/Services/Vm/VmService.cs b/Assets/Gothic-Core/Scripts/Services/Vm/VmService.cs index c23fc0cca..76187490e 100644 --- a/Assets/Gothic-Core/Scripts/Services/Vm/VmService.cs +++ b/Assets/Gothic-Core/Scripts/Services/Vm/VmService.cs @@ -59,6 +59,15 @@ public List TalentSkills } } + public string GetGuildName(int guildId) + { + var guilds = _gameStateService.GothicVm.GetSymbolByName("TXT_GUILDS"); + var max = _gameStateService.GothicVm.GetSymbolByName("GIL_MAX")?.GetInt(0) ?? 42; + if (guilds == null || guildId < 0 || guildId >= max) + return string.Empty; + return guilds.GetString((ushort)guildId); + } + public int InvCatMax => _gameStateService.GothicVm.GetSymbolByName("INV_CAT_MAX").GetInt(0); public List InventoryCategories { From 6ff93003af0079211f6ca8734bc6c1afefd06c7c Mon Sep 17 00:00:00 2001 From: BoroBongo Date: Mon, 15 Jun 2026 22:35:12 +0100 Subject: [PATCH 2/4] =?UTF-8?q?refactor:=20remove=20cheat=20code=20from=20?= =?UTF-8?q?StatusMenu=20=E2=80=94=20live=20stats=20display=20only?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Scripts/Adapters/UI/Menus/StatusMenu.cs | 117 +----------------- .../Scripts/Services/Npc/NpcService.cs | 9 -- 2 files changed, 1 insertion(+), 125 deletions(-) diff --git a/Assets/Gothic-Core/Scripts/Adapters/UI/Menus/StatusMenu.cs b/Assets/Gothic-Core/Scripts/Adapters/UI/Menus/StatusMenu.cs index 870144505..5944f1719 100644 --- a/Assets/Gothic-Core/Scripts/Adapters/UI/Menus/StatusMenu.cs +++ b/Assets/Gothic-Core/Scripts/Adapters/UI/Menus/StatusMenu.cs @@ -2,17 +2,11 @@ using System.Linq; using Gothic.Core.Model.UI.Menu; using Gothic.Core.Models.Vm; -using Gothic.Core.Services.Config; using Gothic.Core.Services.Npc; using Gothic.Core.Services.Vm; using MyBox; using Reflex.Attributes; using TMPro; -using UnityEngine; -using UnityEngine.Events; -using UnityEngine.EventSystems; -using Logger = Gothic.Core.Logging.Logger; -using LogCat = Gothic.Core.Logging.LogCat; namespace Gothic.Core.Adapters.UI.Menus { @@ -42,25 +36,12 @@ public class StatusMenu : AbstractMenu [Inject] private readonly VmService _vmService; [Inject] private readonly NpcService _npcService; - [Inject] private readonly ConfigService _configService; - - private const float _cheatClickWindow = 2f; - private int _levelCheatClicks; - private float _levelCheatLastTime; - private int _guildCheatClicks; - private float _guildCheatLastTime; private void Awake() { InitializeMenu(new MenuInstanceAdapter("MENU_STATUS", null)); } - public override void InitializeMenu(AbstractMenuInstance menuInstance) - { - base.InitializeMenu(menuInstance); - SetupCheatTriggers(); - } - private void OnEnable() { if (_npcService == null) @@ -68,12 +49,6 @@ private void OnEnable() UpdateData(); } - private void OnDisable() - { - _levelCheatClicks = 0; - _guildCheatClicks = 0; - } - private void UpdateData() { var hero = _npcService.GetHeroContainer(); @@ -83,8 +58,6 @@ private void UpdateData() ? (int)hero.Props.TrueGuild : vob.Guild; - Logger.Log($"[StatusMenu] Guild={guildId}({_vmService.GetGuildName(guildId)}) Level={vob.Level} XP={vob.Xp}/{vob.XpNextLevel} LP={vob.Lp} HP={vob.GetAttribute(0)}/{vob.GetAttribute(1)} Mana={vob.GetAttribute(2)}/{vob.GetAttribute(3)} STR={vob.GetAttribute(4)} DEX={vob.GetAttribute(5)}", LogCat.Ui); - MenuItemCache[_itemNameGuild].go.GetComponentInChildren().text = _vmService.GetGuildName(guildId); MenuItemCache[_itemNameLevel].go.GetComponentInChildren().text = vob.Level.ToString(); MenuItemCache[_itemNameExp].go.GetComponentInChildren().text = vob.Xp.ToString(); @@ -143,95 +116,7 @@ private void UpdateData() protected override void Undefined(string itemName, string commandName) { } protected override void StartMenu(string itemName, string commandName) { } - - private void SetupCheatTriggers() - { - if (_configService.Dev.EnableLevel5Cheat) - AddCheatClickTrigger(_itemNameLevel, _ => OnLevelCheatClick()); - if (_configService.Dev.EnableGuildCheat) - AddCheatClickTrigger(_itemNameGuild, _ => OnGuildCheatClick()); - } - - private void AddCheatClickTrigger(string itemName, UnityAction callback) - { - if (!MenuItemCache.TryGetValue(itemName, out var cached)) return; - var go = cached.go; - var tmp = go.GetComponentInChildren(); - if (tmp != null) tmp.raycastTarget = true; - var trigger = go.GetComponent(); - if (trigger == null) trigger = go.AddComponent(); - var clickEntry = new EventTrigger.Entry { eventID = EventTriggerType.PointerClick }; - clickEntry.callback.AddListener(callback); - trigger.triggers.Add(clickEntry); - } - - public void TriggerLevelCheatClick() => OnLevelCheatClick(); - public void TriggerGuildCheatClick() => OnGuildCheatClick(); - public void ExecuteLevelCheat() => CheatAddLevels(); - public void ExecuteGuildCheat() => CheatToNovice(); - - private void OnLevelCheatClick() - { - if (!_configService.Dev.EnableLevel5Cheat) return; - var now = Time.unscaledTime; - if (now - _levelCheatLastTime > _cheatClickWindow) - _levelCheatClicks = 0; - _levelCheatClicks++; - _levelCheatLastTime = now; - if (_levelCheatClicks >= 5) - { - _levelCheatClicks = 0; - CheatAddLevels(); - } - } - - private void OnGuildCheatClick() - { - if (!_configService.Dev.EnableGuildCheat) return; - var now = Time.unscaledTime; - if (now - _guildCheatLastTime > _cheatClickWindow) - _guildCheatClicks = 0; - _guildCheatClicks++; - _guildCheatLastTime = now; - if (_guildCheatClicks >= 3) - { - _guildCheatClicks = 0; - CheatToNovice(); - } - } - - protected override void StartItem(string itemName, string commandName) - { - if (itemName == _itemNameLevel) OnLevelCheatClick(); - else if (itemName == _itemNameGuild) OnGuildCheatClick(); - } - - private void CheatAddLevels() - { - const int levelsToAdd = 5; - var hero = _npcService.GetHeroContainer(); - var oldLevel = hero.Instance.Level; - - hero.Instance.Level += levelsToAdd; - hero.Instance.Lp += levelsToAdd * 10; - - var hpMax = hero.Vob.GetAttribute(1) + levelsToAdd * 12; - hero.Vob.SetAttribute(1, hpMax); - hero.Vob.SetAttribute(0, hpMax); - - _npcService.SyncHeroInstanceToVob(); - UpdateData(); - Logger.Log($"[StatusMenu] Cheat: level {oldLevel}→{hero.Instance.Level} (+{levelsToAdd * 10} LP, +{levelsToAdd * 12} HP_MAX)", LogCat.Ui); - } - - private void CheatToNovice() - { - var hero = _npcService.GetHeroContainer(); - hero.Props.TrueGuild = VmGothicEnums.Guild.GIL_NOV; - UpdateData(); - Logger.Log("[StatusMenu] Cheat: guild set to GIL_NOV", LogCat.Ui); - } - + protected override void StartItem(string itemName, string commandName) { } protected override void Close(string itemName, string commandName) { } protected override void ConsoleCommand(string itemName, string commandName) { } protected override void PlaySound(string itemName, string commandName) { } diff --git a/Assets/Gothic-Core/Scripts/Services/Npc/NpcService.cs b/Assets/Gothic-Core/Scripts/Services/Npc/NpcService.cs index 1440ca86d..ec605f8f7 100644 --- a/Assets/Gothic-Core/Scripts/Services/Npc/NpcService.cs +++ b/Assets/Gothic-Core/Scripts/Services/Npc/NpcService.cs @@ -247,15 +247,6 @@ public NpcContainer GetHeroContainer() return ((NpcInstance)_gameStateService.GothicVm.GlobalHero).GetUserData(); } - public void SyncHeroInstanceToVob() - { - var hero = GetHeroContainer(); - hero.Vob.Level = hero.Instance.Level; - hero.Vob.Xp = hero.Instance.Exp; - hero.Vob.XpNextLevel = hero.Instance.ExpNext; - hero.Vob.Lp = hero.Instance.Lp; - } - public GameObject GetHeroGameObject() { return ((NpcInstance)_gameStateService.GothicVm.GlobalHero).GetUserData().Go; From 896e8fbb695356086e5a5afa4c5e10d7d61369d1 Mon Sep 17 00:00:00 2001 From: BoroBongo Date: Mon, 15 Jun 2026 23:25:43 +0100 Subject: [PATCH 3/4] fix: QuestLogMenu arrow and journal text depth in world-space canvas Set z=-0.03 on all ARROW_UP/DOWN/BACK RectTransforms so they render on top. Set ARROW_BACK Y to match ARROW_DOWN (bottom of content area). Force TMP mesh update on entry open and set TMP SubMeshUI z=-0.02 so journal text is visible. --- .../Scripts/Adapters/UI/Menus/QuestLogMenu.cs | 23 +++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/Assets/Gothic-Core/Scripts/Adapters/UI/Menus/QuestLogMenu.cs b/Assets/Gothic-Core/Scripts/Adapters/UI/Menus/QuestLogMenu.cs index dd6bf3240..a85ffa1bf 100644 --- a/Assets/Gothic-Core/Scripts/Adapters/UI/Menus/QuestLogMenu.cs +++ b/Assets/Gothic-Core/Scripts/Adapters/UI/Menus/QuestLogMenu.cs @@ -203,6 +203,7 @@ private void CreateLists() rect.SetHeight(rend.sharedMaterial.mainTexture.height); rect.SetPositionX(halfMainWidth - _arrowMargin); rect.SetPositionY(halfMainHeight - _arrowMargin); + SetLocalZ(rect, -0.03f); } // DOWN @@ -221,6 +222,7 @@ private void CreateLists() rect.SetHeight(rend.sharedMaterial.mainTexture.height); rect.SetPositionX(halfMainWidth - _arrowMargin); rect.SetPositionY(-halfMainHeight + _arrowMargin); + SetLocalZ(rect, -0.03f); } } @@ -254,6 +256,7 @@ private void CreateContentViewer() rect.SetHeight(rend.sharedMaterial.mainTexture.height); rect.SetPositionX(halfTextWidth + rend.sharedMaterial.mainTexture.width); rect.SetPositionY(halfTextHeight + rend.sharedMaterial.mainTexture.height); + SetLocalZ(rect, -0.03f); } // DOWN - right side, below content @@ -271,9 +274,10 @@ private void CreateContentViewer() rect.SetHeight(rend.sharedMaterial.mainTexture.height); rect.SetPositionX(halfTextWidth + rend.sharedMaterial.mainTexture.width); rect.SetPositionY(-halfTextHeight - rend.sharedMaterial.mainTexture.height); + SetLocalZ(rect, -0.03f); } - // BACK - top-left corner, inside the content area + // BACK - bottom-left corner, same Y as ARROW_DOWN { var go = _resourceCacheService.TryGetPrefabObject(PrefabType.UiButtonTextured, name: "ARROW_BACK", parent: contentViewer.go)!; var rect = go.GetComponentInChildren(); @@ -285,11 +289,11 @@ private void CreateContentViewer() button.onClick.AddListener(OnContentViewerBackClick); var arrowW = rend.sharedMaterial.mainTexture.width * go.transform.localScale.x; - var arrowH = rend.sharedMaterial.mainTexture.height * go.transform.localScale.y; rect.SetWidth(rend.sharedMaterial.mainTexture.width); rect.SetHeight(rend.sharedMaterial.mainTexture.height); rect.SetPositionX(-halfTextWidth + arrowW); - rect.SetPositionY(halfTextHeight - arrowH); + rect.SetPositionY(-halfTextHeight - rend.sharedMaterial.mainTexture.height); + SetLocalZ(rect, -0.03f); } } @@ -401,8 +405,12 @@ private void OnListItemClicked(int index) Background.SetActive(false); var contentViewer = MenuItemCache[_instanceContentViewer].go; - contentViewer.GetComponentInChildren().text = text; + var tmpText = contentViewer.GetComponentInChildren(); + tmpText.text = text; contentViewer.SetActive(true); + tmpText.ForceMeshUpdate(ignoreActiveState: true); + foreach (var subMesh in tmpText.GetComponentsInChildren()) + SetLocalZ(subMesh.rectTransform, -0.02f); } private void OnArrowUpClick() @@ -466,5 +474,12 @@ protected override void ExecuteCommand(string itemName, string commandName) // If the Command==ListMenu, then we set it as currently active. _listMenuCache.TryGetValue(menuItemName, out _activeListMenu); } + + private static void SetLocalZ(RectTransform rect, float z) + { + var pos = rect.localPosition; + pos.z = z; + rect.localPosition = pos; + } } } From f756a4e6a80dd2f917e854a556a0cdbccff02846 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Ko=C5=82aczy=C5=84ski?= <43158992+BoroBongo@users.noreply.github.com> Date: Tue, 16 Jun 2026 10:33:18 +0100 Subject: [PATCH 4/4] max_guild --- Assets/Gothic-Core/Scripts/Services/Vm/VmService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Assets/Gothic-Core/Scripts/Services/Vm/VmService.cs b/Assets/Gothic-Core/Scripts/Services/Vm/VmService.cs index 76187490e..ce35ef9bd 100644 --- a/Assets/Gothic-Core/Scripts/Services/Vm/VmService.cs +++ b/Assets/Gothic-Core/Scripts/Services/Vm/VmService.cs @@ -62,7 +62,7 @@ public List TalentSkills public string GetGuildName(int guildId) { var guilds = _gameStateService.GothicVm.GetSymbolByName("TXT_GUILDS"); - var max = _gameStateService.GothicVm.GetSymbolByName("GIL_MAX")?.GetInt(0) ?? 42; + var max = _gameStateService.GothicVm.GetSymbolByName("GIL_MAX")?.GetInt(0); if (guilds == null || guildId < 0 || guildId >= max) return string.Empty; return guilds.GetString((ushort)guildId);