Esempio n. 1
0
        public void OnPlayerKeyInput(IPlayer player, VirtualKeyInfo[] keyEvents)
        {
            for (int i = 0; i < keyEvents.Length; i++)
            {
                // Game.WriteToConsole(string.Format("Player {0} keyevent: {1}", player.UniqueID, keyEvents[i].ToString()));

                // TP HALE to some position if HALE presses DOWN + BLOCK and cooldown is gone
                if (keyEvents[i].Event == VirtualKeyEvent.Pressed && keyEvents[i].Key == VirtualKey.BLOCK && player.KeyPressed(VirtualKey.CROUCH_ROLL_DIVE))
                {
                    if (player == HALE && (Game.TotalElapsedGameTime - lastTeleported) > tpCooldown && tpEnabled == true)
                    {
                        lastTeleported = Game.TotalElapsedGameTime;
                        if (HALENAMES[HALETYPE] == "Sin Feaster")
                        {
                            TeleportHaleToPlayers();
                            HALE.SetInputEnabled(false);
                            HaleMovementStopper.Trigger();
                        }
                        break;
                    }
                    else if (player == HALE && (Game.TotalElapsedGameTime - lastWarudod) > warudoCooldown && warudoEnabled == true)
                    {
                        lastWarudod = Game.TotalElapsedGameTime;
                        IPlayer[] players = Game.GetPlayers();
                        foreach (IPlayer plr in players)
                        {
                            if (plr != HALE)
                            {
                                plr.SetInputEnabled(false);
                                Game.PlaySound("ChurchBell1", plr.GetWorldPosition(), 1);
                            }
                        }
                        Game.RunCommand("/SLOMO " + "1");
                        PlayerMovementStopper.Trigger();
                    }
                }
            }
        }
Esempio n. 2
0
        private void SetHale()
        {
            IPlayer[] players = Game.GetPlayers();

            foreach (IPlayer plr in players)
            {
                plr.SetTeam(PlayerTeam.Team1);
                PlayerModifiers plrmodifier = plr.GetModifiers();
                plrmodifier.MaxHealth                = -2;
                plrmodifier.MaxEnergy                = -2;
                plrmodifier.CurrentHealth            = -2;
                plrmodifier.EnergyRechargeModifier   = -2;
                plrmodifier.SizeModifier             = -2;
                plrmodifier.SprintSpeedModifier      = -2;
                plrmodifier.RunSpeedModifier         = -2;
                plrmodifier.MeleeForceModifier       = -2;
                plrmodifier.MeleeDamageDealtModifier = -2;
                plrmodifier.MeleeDamageTakenModifier = -2;
                plr.SetModifiers(plrmodifier);
            }

            // Check if Local Storage contains needed items (halecandidates and last_hale)
            if (!Game.LocalStorage.ContainsKey("halecandidates"))
            {
                Game.RunCommand("/MSG " + "Local storage doesn't contain the 'halecandidates' key, so let's add it.");
                SetHaleCandidates();
            }
            if (!Game.LocalStorage.ContainsKey("last_hale"))
            {
                Game.RunCommand("/MSG " + "Local storage doesn't contain the 'last_hale' key, so let's add it");
                Game.LocalStorage.SetItem("last_hale", players[0].Name);
            }
            string[] haleCandidates = (string[])Game.LocalStorage.GetItem("halecandidates");

            // Synchronize haleCandidates queue to the players currently in server
            SynchronizeHaleCandidates(players, haleCandidates);

            string  next_hale_name = haleCandidates[(m_rnd.Next(((int)DateTime.Now.Millisecond * (int)DateTime.Now.Minute * 1000)) + (int)DateTime.Now.Millisecond) % haleCandidates.Length];
            IPlayer next_hale      = players[0];
            int     next_type      = (m_rnd.Next(0, ((int)DateTime.Now.Millisecond * (int)DateTime.Now.Minute * 1000)) + (int)DateTime.Now.Millisecond) % (HALENAMES.Length);
            int     random_index   = 0;

            if (!MODE)
            {
                // Check if storage contains last_hale. If it does make sure that same person isn't hale again.
                bool chooseAgain = false;
                do
                {
                    chooseAgain    = false;
                    next_hale_name = haleCandidates[(m_rnd.Next(((int)DateTime.Now.Millisecond * (int)DateTime.Now.Minute * 1000) + random_index) + (int)DateTime.Now.Millisecond) % haleCandidates.Length];
                    if ((string)Game.LocalStorage.GetItem("last_hale") == next_hale_name)
                    {
                        Game.RunCommand("/MSG " + "Sama hale kuin viimeksi --> vaihtoon");
                        chooseAgain = true;
                    }
                    foreach (IPlayer plr in players)
                    {
                        if (plr.Name == next_hale_name)
                        {
                            next_hale = plr;
                        }
                    }
                    random_index++;
                } while (chooseAgain & random_index < 10);

                // Delete new hale from halecandidates and update 'last_hale' in localstorage
                EraseFromHaleCandidates(next_hale_name);
            }

            HALE     = next_hale;
            HALETYPE = next_type;

            HALETYPE = 4;
            HALE.SetTeam(PlayerTeam.Team2);

            // Calculating hale HP based on playeramount and getting the modifier for HALE to apply changes

            PlayerModifiers modify = HALE.GetModifiers();
            int             haleHP;
            int             hpConstant = 150;

            if (MODE)
            {
                haleHP = 500;
            }
            else
            {
                if (players.Length <= 4)
                {
                    haleHP = (players.Length - 1) * hpConstant;
                }
                else
                {
                    haleHP = 4 * hpConstant + (players.Length - 4) * hpConstant / 2;
                }
            }

            lastHaleHp = haleHP;

            Game.RunCommand("/MSG " + " - - - Minä olen hirmuinen " + HALENAMES[HALETYPE] + " - - - ");

            // Setting HALE modifiers
            switch (HALETYPE)
            {
            // SetHaleModifiers( modify, HP, sprintSpeed, runSpeed, meleeForce, meleeDamageDealt, meleeDamageTaken )
            // Saxton Fale;
            case 0:
                SetHaleClothing(ref HALE);
                SetHaleModifiers(ref modify, haleHP, 1.5f, 1.5f, 3f, 8f, 2f);
                HALE.SetModifiers(modify);
                break;

            // Sin Feaster
            case 1:
                SetSinClothing(ref HALE);
                tpEnabled  = true;
                tpCooldown = 20000;
                SetHaleModifiers(ref modify, haleHP, 1.2f, 1.2f, 2f, 5f, 1.5f);
                HALE.SetModifiers(modify);
                break;

            // Speedy Fale
            case 2:
                SetSpeedClothing(ref HALE);
                SetHaleModifiers(ref modify, haleHP, 2f, 2f, 6f, 0.001f, 1f);
                HALE.SetModifiers(modify);
                break;

            // DIO
            case 3:
                warudoEnabled  = true;
                warudoCooldown = 10000;
                SetDIOClothing(ref HALE);
                SetHaleModifiers(ref modify, haleHP, 1.2f, 1.2f, 3f, 3f, 2f);
                HALE.SetModifiers(modify);
                break;

            // Sick F**k
            case 4:
                SetTeam(HALETYPE);
                zombifyHumansOnDeath = true;
                SetSickClothing(ref HALE);
                SetHaleModifiers(ref modify, haleHP / 2, 1.5f, 1.5f, 2f, 3f, 1.5f);
                HALE.SetModifiers(modify);
                ReanimateTrigger.Trigger();
                break;
            }

            // Activate HALE triggers
            if (MODE)
            {
                Game.RunCommand("/INFINITE_AMMO 1");
                Game.RunCommand("/GIVE 0 shuriken");
            }
            else
            {
                HALE.SetInputEnabled(false);
                HaleStartCooldown.Trigger();
                RemoveHaleItemsTimer.Trigger();
            }
            DisplayHaleStatusTimer.Trigger();
        }