Esempio n. 1
0
        public static void Prefix(object __instance, ref bool __state)
        {
            if (IgnoreHelper.IsIgnored())
            {
                return;
            }

            TransportTool tool    = ReflectionHelper.GetAttr <TransportTool>(__instance, "$this");
            int           counter = ReflectionHelper.GetAttr <int>(__instance, "$PC");

            int mode         = ReflectionHelper.GetAttr <int>(tool, "m_mode");
            int expectedMode = ReflectionHelper.GetEnumValue(
                typeof(TransportTool).GetNestedType("Mode", ReflectionHelper.AllAccessFlags), "MoveStops");

            if (counter != 0 || mode != expectedMode)
            {
                __state = false;
                return;
            }

            __state = true;

            ArrayHandler.StartCollecting();
            IgnoreHelper.StartIgnore("CancelMoveStop");
        }
Esempio n. 2
0
        public static void Prefix(object __instance, ref bool __state)
        {
            if (IgnoreHelper.IsIgnored())
            {
                return;
            }

            TransportTool tool    = ReflectionHelper.GetAttr <TransportTool>(__instance, "$this");
            int           counter = ReflectionHelper.GetAttr <int>(__instance, "$PC");

            int mode         = ReflectionHelper.GetAttr <int>(tool, "m_mode");
            int expectedMode = ReflectionHelper.GetEnumValue(typeof(TransportTool).GetNestedType("Mode", ReflectionHelper.AllAccessFlags), "NewLine");

            ToolBase.ToolErrors m_errors = ReflectionHelper.GetAttr <ToolBase.ToolErrors>(tool, "m_errors");
            ushort m_lastEditLine        = ReflectionHelper.GetAttr <ushort>(tool, "m_lastEditLine");
            int    m_hoverStopIndex      = ReflectionHelper.GetAttr <int>(tool, "m_hoverStopIndex");
            int    m_building            = ReflectionHelper.GetAttr <int>(tool, "m_building");

            if (counter != 0 || m_errors != ToolBase.ToolErrors.None || mode != expectedMode || m_lastEditLine == 0 || m_hoverStopIndex == -1 || (m_building != 0 && m_hoverStopIndex == 0))
            {
                __state = false;
                return;
            }
            __state = true;

            ArrayHandler.StartCollecting();
            IgnoreHelper.StartIgnore("RemoveStop");
        }
Esempio n. 3
0
        public static void Postfix(object __instance, ref bool __state)
        {
            if (IgnoreHelper.IsIgnored("NewLine"))
            {
                return;
            }

            if (!__state)
            {
                return;
            }

            IgnoreHelper.EndIgnore("NewLine");
            ArrayHandler.StopCollecting();

            TransportTool tool = ReflectionHelper.GetAttr <TransportTool>(__instance, "$this");

            ushort prefab   = (ushort)Mathf.Clamp(tool.m_prefab.m_prefabDataIndex, 0, 65535);
            int    building = tool.m_building;

            Command.SendToAll(new TransportLineCreateCommand()
            {
                Array16Ids = ArrayHandler.Collected16,
                Prefab     = prefab,
                Building   = building
            });
        }
Esempio n. 4
0
        public static void Postfix(TransportInfo ___m_prefab, Vector3 ___m_hitPosition, bool ___m_fixedPlatform, int ___m_hoverStopIndex, int ___m_hoverSegmentIndex, int ___m_mode, ToolBase.ToolErrors ___m_errors, ref DataStore __state)
        {
            if (IgnoreHelper.IsIgnored())
            {
                return;
            }

            TransportHandler.TrackSimulationStep = false;

            // Only send when values have changed
            if (TransportHandler.DidUpdatePaths ||
                __state.hitPos != ___m_hitPosition || __state.fixedP != ___m_fixedPlatform ||
                __state.hoverStop != ___m_hoverStopIndex || __state.hoverSegment != ___m_hoverSegmentIndex ||
                __state.mode != ___m_mode || __state.errors != ___m_errors)
            {
                Command.SendToAll(new TransportLineSyncCommand()
                {
                    HitPosition       = ___m_hitPosition,
                    FixedPlatform     = ___m_fixedPlatform,
                    HoverStopIndex    = ___m_hoverStopIndex,
                    HoverSegmentIndex = ___m_hoverSegmentIndex,
                    Mode        = ___m_mode,
                    Errors      = ___m_errors,
                    UpdateLines = TransportHandler.DidUpdateLinesNow,
                    UpdatePaths = TransportHandler.DidUpdatePaths
                });

                TransportHandler.DidUpdateLinesNow = false;
                TransportHandler.DidUpdatePaths    = false;
            }
        }
Esempio n. 5
0
        public static void Postfix(WeatherManager __instance, ref DataStore __state)
        {
            if (IgnoreHelper.IsIgnored() || MultiplayerManager.Instance.CurrentRole == MultiplayerRole.Client)
            {
                return;
            }

            // don't send command if target values have not been changed
            if (!__state.HasChanged(__instance))
            {
                return;
            }

            Command.SendToAll(new WeatherCommand
            {
                CurrentCloud         = __instance.m_currentCloud,
                TargetCloud          = __instance.m_targetCloud,
                CurrentFog           = __instance.m_currentFog,
                TargetFog            = __instance.m_targetFog,
                CurrentNothernLights = __instance.m_currentNorthernLights,
                TargetNothernLights  = __instance.m_targetNorthernLights,
                CurrentRain          = __instance.m_currentRain,
                TargetRain           = __instance.m_targetRain,
                CurrentRainbow       = __instance.m_currentRainbow,
                TargetRainbow        = __instance.m_targetRainbow,
                CurrentTemperature   = __instance.m_currentTemperature,
                TargetTemperature    = __instance.m_targetTemperature,
            });
        }
Esempio n. 6
0
        public static void Prefix(out CallState __state, object __instance)
        {
            __state = new CallState();

            if (IgnoreHelper.IsIgnored())
            {
                __state.run = false;
                return;
            }

            BuildingTool tool    = ReflectionHelper.GetAttr <BuildingTool>(__instance, "$this");
            int          counter = ReflectionHelper.GetAttr <int>(__instance, "$PC");

            ToolBase.ToolErrors ___m_placementErrors = ReflectionHelper.GetAttr <ToolBase.ToolErrors>(tool, "m_placementErrors");

            if (counter != 0 || ___m_placementErrors != ToolBase.ToolErrors.None)
            {
                __state.run = false;
                return;
            }

            __state.run      = true;
            __state.relocate = tool.m_relocate; // Save relocate state as it will be cleared at the end of the method

            IgnoreHelper.StartIgnore();
            ArrayHandler.StartCollecting();
        }
Esempio n. 7
0
        public static void Prefix(ushort eventID, ref EventData data, Color32 newColor, EventAI __instance)
        {
            if (IgnoreHelper.IsIgnored())
            {
                return;
            }

            Type type = __instance.GetType();

            if (type != typeof(RocketLaunchAI) && type != typeof(ConcertAI) && type != typeof(SportMatchAI))
            {
                return;
            }

            if (newColor.r == data.m_color.r && newColor.g == data.m_color.g && newColor.b == data.m_color.b)
            {
                return;
            }

            Command.SendToAll(new EventColorChangedCommand()
            {
                Event = eventID,
                Color = newColor
            });
        }
Esempio n. 8
0
        public static void Postfix()
        {
            if (IgnoreHelper.IsIgnored())
            {
                return;
            }

            Command.SendToAll(new TransportLineInitCommand());
        }
Esempio n. 9
0
        public static void Postfix()
        {
            if (IgnoreHelper.IsIgnored() || !TransportHandler.TrackSimulationStep)
            {
                return;
            }

            TransportHandler.DidUpdateLinesNow = true;
        }
Esempio n. 10
0
        public static bool CanRun(object instance, bool state)
        {
            if (IgnoreHelper.IsIgnored() || !state)
            {
                return(false);
            }

            return(ReflectionHelper.GetAttr <bool>(instance, "$current"));
        }
Esempio n. 11
0
        public static void Prefix()
        {
            if (IgnoreHelper.IsIgnored())
            {
                return;
            }

            ArrayHandler.StartCollecting();
        }
Esempio n. 12
0
        public static void Postfix(ref bool __state)
        {
            if (!__state || IgnoreHelper.IsIgnored("SetTaxRate"))
            {
                return;
            }

            IgnoreHelper.EndIgnore("SetTaxRate");
        }
Esempio n. 13
0
 public static void Postfix(DistrictPolicies.Policies policy)
 {
     if (!IgnoreHelper.IsIgnored())
     {
         Command.SendToAll(new DistrictCityPolicyCommand
         {
             Policy = policy
         });
     }
 }
Esempio n. 14
0
 public static void Postfix(byte district)
 {
     if (!IgnoreHelper.IsIgnored())
     {
         Command.SendToAll(new DistrictReleaseCommand
         {
             DistrictId = district,
         });
     }
 }
Esempio n. 15
0
 public static void Prefix(ref byte park)
 {
     if (!IgnoreHelper.IsIgnored())
     {
         Command.SendToAll(new ParkReleaseCommand
         {
             ParkId = park
         });
     }
 }
Esempio n. 16
0
        public static void Prefix()
        {
            if (IgnoreHelper.IsIgnored())
            {
                return;
            }

            ArrayHandler.StartCollecting();
            IgnoreHelper.StartIgnore("StartEditingBuildingLine");
        }
Esempio n. 17
0
 public static void Postfix(DistrictPolicies.Policies policy, byte district)
 {
     if (!IgnoreHelper.IsIgnored())
     {
         Command.SendToAll(new DistrictPolicyCommand
         {
             Policy     = policy,
             DistrictId = district
         });
     }
 }
Esempio n. 18
0
        public static void Prefix(ref NetNode data, int index, out int __state)
        {
            __state = -1;

            if (IgnoreHelper.IsIgnored())
            {
                return;
            }

            __state = GetFlags(data, index);
        }
Esempio n. 19
0
        public static void Prefix(ushort prop)
        {
            if (IgnoreHelper.IsIgnored())
            {
                return;
            }

            Command.SendToAll(new PropReleaseCommand
            {
                PropId = prop
            });
        }
Esempio n. 20
0
        public static void Postfix(ushort lineID)
        {
            if (IgnoreHelper.IsIgnored() || !TransportHandler.TrackSimulationStep)
            {
                return;
            }

            if (TransportHandler.TrackTempLine == lineID)
            {
                TransportHandler.DidUpdatePaths = true;
            }
        }
Esempio n. 21
0
        public static void Postfix(string ___name, ref bool __state)
        {
            if (IgnoreHelper.IsIgnored() || !__state)
            {
                return;
            }

            Command.SendToAll(new ChangeCityNameCommand
            {
                Name = ___name
            });
        }
Esempio n. 22
0
        public static void Prefix(uint tree)
        {
            if (IgnoreHelper.IsIgnored())
            {
                return;
            }

            Command.SendToAll(new TreeReleaseCommand
            {
                TreeId = tree
            });
        }
Esempio n. 23
0
        public static void Prefix(out bool __state)
        {
            if (IgnoreHelper.IsIgnored())
            {
                __state = false;
                return;
            }

            __state = true;
            ArrayHandler.StartCollecting();
            IgnoreHelper.StartIgnore();
        }
Esempio n. 24
0
        public static void Prefix(out bool __state)
        {
            if (IgnoreHelper.IsIgnored())
            {
                __state = false;
                return;
            }

            __state = true;

            IgnoreHelper.StartIgnore();
        }
Esempio n. 25
0
        public static void Prefix(ushort eventID)
        {
            if (IgnoreHelper.IsIgnored())
            {
                return;
            }

            Command.SendToAll(new EventActivateCommand()
            {
                Event = eventID
            });
        }
Esempio n. 26
0
        public static void Postfix(ushort building)
        {
            if (IgnoreHelper.IsIgnored())
            {
                return;
            }

            Command.SendToAll(new BuildingRemoveCommand
            {
                BuildingId = building
            });
        }
Esempio n. 27
0
        public static void Prefix()
        {
            if (IgnoreHelper.IsIgnored())
            {
                return;
            }

            Command.SendToAll(new EconomyBailoutCommand()
            {
                Accepted = false
            });
        }
Esempio n. 28
0
        public override void OnUnlockArea(int x, int z)
        {
            if (IgnoreHelper.IsIgnored())
            {
                return;
            }

            Command.SendToAll(new UnlockAreaCommand
            {
                X = x,
                Z = z
            });
        }
Esempio n. 29
0
        public static void Postfix(uint tree, Vector3 position)
        {
            if (IgnoreHelper.IsIgnored())
            {
                return;
            }

            Command.SendToAll(new TreeMoveCommand
            {
                TreeId   = tree,
                Position = position
            });
        }
Esempio n. 30
0
        public static void Prefix(ushort lineID, Color color)
        {
            if (IgnoreHelper.IsIgnored())
            {
                return;
            }

            Command.SendToAll(new TransportLineChangeColorCommand()
            {
                LineId = lineID,
                Color  = color
            });
        }