Beispiel #1
0
        public override void HandlePacket(BinaryReader reader, int whoAmI)
        {
            StandMessageType msgType = (StandMessageType)reader.ReadByte();

            /// debug

            /*if (Main.netMode == NetmodeID.Server) // Server
             * {
             *  NetMessage.BroadcastChatMessage(NetworkText.FromKey("Server get packet"), Color.Green);
             * }
             * if (Main.netMode == NetmodeID.MultiplayerClient) // Client
             * {
             *  Main.NewText("Client get packet", Color.Red);
             * }*/

            switch (msgType)
            {
            case StandMessageType.SyncNPCFromStatue:
                if (Main.netMode == NetmodeID.MultiplayerClient)
                {
                    int n = reader.ReadInt32();

                    if (n != 0)
                    {
                        int[] NetId = new int[n];

                        for (int i = 0; i < n; i++)
                        {
                            NetId[i] = reader.ReadInt32();
                        }

                        for (int i = 0; i < n; i++)
                        {
                            Main.npc[NetId[i]].SpawnedFromStatue = true;
                        }
                    }
                }
                break;

            case StandMessageType.TimeStopActivate:
                int fromWho = reader.ReadInt32();

                if (Main.netMode == NetmodeID.Server)
                {
                    ModPacket packet = mod.GetPacket();

                    packet.Write((byte)StandMessageType.TimeStopActivate);
                    packet.Write(fromWho);

                    packet.Send(-1, fromWho);
                }

                SpecialAbilityManager.Abilities["ZaWardo"].GetAbilty <ZaWardo>().Init(fromWho);
                SpecialAbilityManager.Activate("ZaWardo");
                break;
            }
        }
Beispiel #2
0
        /* Mod unloading function */
        public override void Unload()
        {
            if (!Main.dedServ)
            {
                StandInterface = null;
                StandoUI       = null;

                //BonusManager.UnLoad();
                CutSceneManager.UnLoad();
            }

            mod                  = null;
            StandSummonHT        = null;
            SpecialAbilityHT     = null;
            StandClientConfig    = null;
            SwitchStandControlHT = null;

            SpecialAbilityManager.UnLoad();
        }
Beispiel #3
0
        /* Mod loading */
        public override void Load()
        {
            mod = this; // mod

            mod.Logger.Info("Starting loading...");

            /* Try to get steam info */
            try
            {
                usingSteam = Steamworks.SteamAPI.IsSteamRunning();

                if (usingSteam)
                {
                    SteamId = Steamworks.SteamUser.GetSteamID().m_SteamID; // klass
                    mod.Logger.Info("Steam login = true");
                }
                else
                {
                    mod.Logger.Warn("Steam login = false");
                }
            }
            catch (Exception e)
            {
                usingSteam = false;
                SteamId    = 0;
                mod.Logger.Warn("Steam login = false");
                mod.Logger.Error(e.Message);
            }

            /* Register hotkeys */
            StandSummonHT        = RegisterHotKey("Summon Stand", "Insert");
            SpecialAbilityHT     = RegisterHotKey("Special ability", "P");
            SwitchStandControlHT = RegisterHotKey("Switch stand control mode", "Home");

            /* Loading special abilities */
            SpecialAbilityManager.Load();
            SpecialAbilityManager.AddAbility("ZaWardo", new ZaWardo());
            SpecialAbilityManager.AddAbility("SCA", new SilverChariotAbility());

            /* Client only loading */
            if (!Main.dedServ)
            {
                /* Interface loading */
                StandInterface = new UserInterface();
                StandoUI       = new StandUI();

                StandoUI.Activate();

                StandInterface.SetState(StandoUI);

                /* Cut scene */
                CutSceneManager.Load();
                CutSceneManager.AddScene("Test", new CutScenes.TestCSc());

                /* Red dolphin shader */
                GameShaders.Misc["RedDolphin"] = new MiscShaderData(new Ref <Effect>(GetEffect("Effects/RedDolphin")), "RedDolphine");

                /* Bonus manager (not needed) */

                /*try
                 * {
                 *  BonusManager.Init();
                 *
                 *  if (BonusManager.UpdateBonuses())
                 *      Logger.Info("Bonuses loaded");
                 *
                 *  BonusManager.UnLoad();
                 * }
                 * catch (Exception e)
                 * {
                 *  mod.Logger.Warn("DB error: " + e.Message);
                 * }*/
            }

            mod.Logger.Info("Load successful");
        }