Пример #1
0
        public static void Prefix(ushort eventID, ref EventData data, int newBudget, EventAI __instance)
        {
            if (IgnoreHelper.IsIgnored())
            {
                return;
            }

            if (__instance.GetSecurityBudget(eventID, ref data) == newBudget)
            {
                return;
            }

            Command.SendToAll(new EventSetSecurityBudgetCommand()
            {
                Event  = eventID,
                Budget = newBudget
            });
        }
Пример #2
0
        public static void Prefix(ushort eventID, ref EventData data, int newPrice, EventAI __instance)
        {
            if (IgnoreHelper.IsIgnored())
            {
                return;
            }

            // Event is 0, when it is set through the FestivalPanel for a certain band
            // TODO: Sync price changes in FestivalPanel and VarsitySportsArenaPanel
            if (eventID == 0 || __instance.GetTicketPrice(eventID, ref data) == newPrice)
            {
                return;
            }

            Command.SendToAll(new EventSetTicketPriceCommand()
            {
                Event = eventID,
                Price = newPrice
            });
        }
Пример #3
0
        /// <summary>Customizes the vanilla events in the game by changing their time behavior.</summary>
        /// <returns>An instance of the <see cref="VanillaEvents"/> class that can be used for reverting the events
        /// to the original state.</returns>
        public static VanillaEvents Customize()
        {
            var result = new VanillaEvents();

            for (uint i = 0; i < PrefabCollection <EventInfo> .PrefabCount(); ++i)
            {
                EventInfo eventInfo = PrefabCollection <EventInfo> .GetPrefab(i);

                if (eventInfo?.m_eventAI?.m_info == null)
                {
                    continue;
                }

                EventAI eventAI      = eventInfo.m_eventAI;
                var     originalData = new EventAIData(eventAI.m_eventDuration, eventAI.m_prepareDuration, eventAI.m_disorganizeDuration);
                result.eventData[eventAI] = originalData;
                Customize(eventAI);
                Log.Debug(LogCategory.Events, $"Customized event {eventAI.GetType().Name}");
            }

            return(result);
        }
Пример #4
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
            });
        }