public static void findLoc(int x, int y) { var dic = Traverse.Create(ZoneSystem.instance).Field <Dictionary <Vector2i, ZoneSystem.LocationInstance> >("m_locationInstances").Value; Vector2i val = new Vector2i(x, y); dbginsa = dic[val]; }
static void Prefix(ZoneSystem __instance, Dictionary <Vector2i, ZoneSystem.LocationInstance> ___m_locationInstances) { if (!modEnabled.Value) { return; } Dbgl($"Starting ZoneSystem, relocating merchant"); for (int i = 0; i < ___m_locationInstances.Count; i++) { Vector2i v = ___m_locationInstances.Keys.ToArray()[i]; ZoneSystem.LocationInstance loc = ___m_locationInstances[v]; if (loc.m_location.m_prefabName == "Vendor_BlackForest") { if (merchantPosition.Value != Vector3.zero) { ___m_locationInstances.Remove(v); loc.m_position = merchantPosition.Value; Vector2i zone = __instance.GetZone(merchantPosition.Value); } break; } } }
public static bool GetLocationInstance(string id, out ZoneSystem.LocationInstance li) { var a = Traverse.Create(ZoneSystem.instance).Field <Dictionary <Vector2i, ZoneSystem.LocationInstance> >("m_locationInstances").Value; var key = Tweakers.Pak(id); if (a.ContainsKey(key)) { li = a[key]; return(true); } li = default(ZoneSystem.LocationInstance); return(false); }