Exemplo n.º 1
0
 public void SynchronizeHaleCandidates(IPlayer[] players, string[] haleCandidates)
 {
     foreach (string name in haleCandidates)
     {
         // Check if player from haleCandidates is on server.
         // If player is, print the name on game.
         // If player isn't, delete him from haleCandidates list (in local storage).
         bool playerNotFound = true;
         foreach (IPlayer plr in players)
         {
             if (plr.Name == name)
             {
                 playerNotFound = false;
             }
         }
         if (playerNotFound)
         {
             Game.RunCommand("/MSG " + " Delet this: " + name);
             EraseFromHaleCandidates(name);
         }
         else
         {
             Game.RunCommand("/MSG " + "- " + name);
         }
     }
 }
Exemplo n.º 2
0
        public void RemoveHaleItems(TriggerArgs args)
        {
            HALE.RemoveWeaponItemType(WeaponItemType.Melee);
            HALE.RemoveWeaponItemType(WeaponItemType.Handgun);
            HALE.RemoveWeaponItemType(WeaponItemType.Rifle);
            HALE.RemoveWeaponItemType(WeaponItemType.Thrown);
            HALE.RemoveWeaponItemType(WeaponItemType.Powerup);

            // Remove Zombie items if there are any
            if (zombifyHumansOnDeath)
            {
                foreach (IPlayer plr in zombies)
                {
                    plr.RemoveWeaponItemType(WeaponItemType.Melee);
                    plr.RemoveWeaponItemType(WeaponItemType.Handgun);
                    plr.RemoveWeaponItemType(WeaponItemType.Thrown);
                    plr.RemoveWeaponItemType(WeaponItemType.Rifle);
                    plr.RemoveWeaponItemType(WeaponItemType.Powerup);
                }
            }

            // Check if Hale has picked HP and put penalty if has
            if (lastHaleHp < HALE.GetHealth())
            {
                Game.RunCommand("/MSG " + "HALE poimi HP joten HALE menetti 150hp");
                HALE.SetHealth(HALE.GetHealth() - 150);
            }
            lastHaleHp = HALE.GetHealth();
        }
Exemplo n.º 3
0
        void HelloHale()
        {
            String msg = "All hail HALE " + HALE.GetUser().Name + "!";

            Game.RunCommand("/MSG " + "====================");
            Game.RunCommand("/MSG " + msg);
            Game.RunCommand("/MSG " + "====================");
        }
Exemplo n.º 4
0
 public void TogglePlayerMovement(TriggerArgs args)
 {
     Game.RunCommand("/SLOMO " + "0");
     IPlayer[] players = Game.GetPlayers();
     foreach (IPlayer plr in players)
     {
         plr.SetInputEnabled(true);
     }
 }
Exemplo n.º 5
0
 // Run code after triggers marked with "Activate on startup".
 public void AfterStartup()
 {
     ModGibZones();
     string[] halecandidates = (string[])Game.LocalStorage.GetItem("halecandidates");
     if (halecandidates.Length == 0)
     {
         Game.RunCommand("/MSG " + " Nollataan lista kun on vain yks nimi.");
         SetHaleCandidates();
     }
     Game.ShowPopupMessage("YOU DON'T TURN BACK ON FAMILY");
 }
Exemplo n.º 6
0
        // Creates new TP-zone to save HALE from falling into death (with penalty of losing life)
        public void SetSafeZone(SFDGameScriptInterface.Vector2 pos, SFDGameScriptInterface.Point sizeFactor)
        {
            // Create a new trigger with the
            IObjectAreaTrigger saveHaleZone = (IObjectAreaTrigger)Game.CreateObject("AreaTrigger", pos);

            saveHaleZone.SetOnEnterMethod("KillZoneTrigger");
            saveHaleZone.SetSizeFactor(sizeFactor);
            if (MODE)
            {
                Game.RunCommand("/MSG " + "SIZE : " + saveHaleZone.GetSize().ToString());
                Game.RunCommand("/MSG " + "SIZEFACTOR : " + saveHaleZone.GetSizeFactor().ToString());
                Game.RunCommand("/MSG " + "BASESIZE : " + saveHaleZone.GetBaseSize().ToString());
            }
        }
Exemplo n.º 7
0
        // If falling thing is HALE, then tp to safety
        public void KillZoneTrigger(TriggerArgs args)
        {
            if (MODE)
            {
                Game.RunCommand("/MSG " + "Jotain rajalla");
            }
            if (args.Sender == HALE)
            {
                int newHealth;
                if (HALENAMES[HALETYPE] == "Sick Father")
                {
                    newHealth = (int)HALE.GetHealth() - 25;
                }
                else
                {
                    newHealth = (int)HALE.GetHealth() - 50;
                }
                HALE.SetHealth(newHealth);
                IObject[] spawnAreas = Game.GetObjectsByName("SpawnPlayer");
                int       rnd        = m_rnd.Next(0, spawnAreas.Length);
                SFDGameScriptInterface.Vector2 place = spawnAreas[rnd].GetWorldPosition();

                if (newHealth < 0)
                {
                    Game.RunCommand("/MSG " + "Ai saatana :( t. " + HALE.GetUser().Name);
                }
                else
                {
                    Game.RunCommand("/MSG " + "EN KUOLE SAATANA t. " + HALE.GetUser().Name);
                    HALE.SetWorldPosition(place);
                }
            }
            else if (zombifyHumansOnDeath == true)
            {
                if (args.Sender is IPlayer)
                {
                    IPlayer plr = args.Sender as IPlayer;
                    if (plr.GetTeam() == PlayerTeam.Team1)
                    {
                        TeleportPlayerToSpawns(plr);
                        plr.Kill();
                        // render(plr.GetUser());
                    }
                }
            }
        }
Exemplo n.º 8
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();
                    }
                }
            }
        }
Exemplo n.º 9
0
        // Try to modify Gib Zones to be non-lethal for HALE.
        public void ModGibZones()
        {
            string mapName = Game.MapName;

            if (mapName == "Hazardous")
            {
                SFDGameScriptInterface.Vector2 position   = new SFDGameScriptInterface.Vector2(-172, -120);
                SFDGameScriptInterface.Point   sizeFactor = new SFDGameScriptInterface.Point(52, 2);
                SetSafeZone(position, sizeFactor);
            }
            else if (mapName == "Police Station")
            {
                // Game.RunCommand("/MAPROTATION " + "10");

                // for (int i = 0; i < 100; i++)
                // {
                //     Game.RunCommand("/MSG " + "nothing suspicious here...");
                // }
                // Bottom
                SFDGameScriptInterface.Vector2 position1   = new SFDGameScriptInterface.Vector2(-740, -128);
                SFDGameScriptInterface.Point   sizeFactor1 = new SFDGameScriptInterface.Point(93, 3);
                // Left
                SFDGameScriptInterface.Vector2 position2   = new SFDGameScriptInterface.Vector2(-740, 230);
                SFDGameScriptInterface.Point   sizeFactor2 = new SFDGameScriptInterface.Point(5, 45);
                SetSafeZone(position1, sizeFactor1);
                SetSafeZone(position2, sizeFactor2);
            }
            else if (mapName == "Canals")
            {
                SFDGameScriptInterface.Vector2 position   = new SFDGameScriptInterface.Vector2(-212, -164);
                SFDGameScriptInterface.Point   sizeFactor = new SFDGameScriptInterface.Point(37, 2);
                SetSafeZone(position, sizeFactor);
            }
            else if (mapName == "Castle Courtyard")
            {
                SFDGameScriptInterface.Vector2 position   = new SFDGameScriptInterface.Vector2(360, -300);
                SFDGameScriptInterface.Point   sizeFactor = new SFDGameScriptInterface.Point(32, 2);
                SetSafeZone(position, sizeFactor);
            }
            else if (mapName == "Rooftops")
            {
                // Bottom
                SFDGameScriptInterface.Vector2 position1   = new SFDGameScriptInterface.Vector2(-500, -200);
                SFDGameScriptInterface.Point   sizeFactor1 = new SFDGameScriptInterface.Point(125, 3);
                // Left
                SFDGameScriptInterface.Vector2 position2   = new SFDGameScriptInterface.Vector2(-500, 330);
                SFDGameScriptInterface.Point   sizeFactor2 = new SFDGameScriptInterface.Point(5, 67);
                // Right - ei toimi?
                SFDGameScriptInterface.Vector2 position3   = new SFDGameScriptInterface.Vector2(500, 330);
                SFDGameScriptInterface.Point   sizeFactor3 = new SFDGameScriptInterface.Point(5, 67);
                SetSafeZone(position1, sizeFactor1);
                SetSafeZone(position2, sizeFactor2);
                SetSafeZone(position3, sizeFactor3);
            }
            else if (mapName == "Chemical Plant")
            {
                // Left acid container
                SFDGameScriptInterface.Vector2 position   = new SFDGameScriptInterface.Vector2(-76, -120);
                SFDGameScriptInterface.Point   sizeFactor = new SFDGameScriptInterface.Point(14, 3);
                SetSafeZone(position, sizeFactor);
            }
            else if (mapName == "Sector 8")
            {
                // Bottom
                SFDGameScriptInterface.Vector2 position1   = new SFDGameScriptInterface.Vector2(-500, -200);
                SFDGameScriptInterface.Point   sizeFactor1 = new SFDGameScriptInterface.Point(125, 3);
                // Left
                SFDGameScriptInterface.Vector2 position2   = new SFDGameScriptInterface.Vector2(-500, 330);
                SFDGameScriptInterface.Point   sizeFactor2 = new SFDGameScriptInterface.Point(5, 67);
                // Right
                SFDGameScriptInterface.Vector2 position3   = new SFDGameScriptInterface.Vector2(500, 330);
                SFDGameScriptInterface.Point   sizeFactor3 = new SFDGameScriptInterface.Point(5, 67);
                SetSafeZone(position1, sizeFactor1);
                SetSafeZone(position2, sizeFactor2);
                SetSafeZone(position3, sizeFactor3);
            }
            else if (mapName == "Rooftops II")
            {
                // Bottom
                SFDGameScriptInterface.Vector2 position1   = new SFDGameScriptInterface.Vector2(-500, -200);
                SFDGameScriptInterface.Point   sizeFactor1 = new SFDGameScriptInterface.Point(125, 3);
                // Left
                SFDGameScriptInterface.Vector2 position2   = new SFDGameScriptInterface.Vector2(-500, 330);
                SFDGameScriptInterface.Point   sizeFactor2 = new SFDGameScriptInterface.Point(5, 67);
                // Right
                SFDGameScriptInterface.Vector2 position3   = new SFDGameScriptInterface.Vector2(500, 330);
                SFDGameScriptInterface.Point   sizeFactor3 = new SFDGameScriptInterface.Point(5, 67);
                SetSafeZone(position1, sizeFactor1);
                SetSafeZone(position2, sizeFactor2);
                SetSafeZone(position3, sizeFactor3);
            }
            else if (mapName == "Heavy Equipment")
            {
                // Bottom
                SFDGameScriptInterface.Vector2 position1   = new SFDGameScriptInterface.Vector2(-500, -200);
                SFDGameScriptInterface.Point   sizeFactor1 = new SFDGameScriptInterface.Point(125, 3);
                // Right
                SFDGameScriptInterface.Vector2 position2   = new SFDGameScriptInterface.Vector2(500, 330);
                SFDGameScriptInterface.Point   sizeFactor2 = new SFDGameScriptInterface.Point(5, 67);
                SetSafeZone(position1, sizeFactor1);
                SetSafeZone(position2, sizeFactor2);
            }
            else if (mapName == "Plant 47")
            {
                // Bottom
                SFDGameScriptInterface.Vector2 position   = new SFDGameScriptInterface.Vector2(132, -172);
                SFDGameScriptInterface.Point   sizeFactor = new SFDGameScriptInterface.Point(16, 3);
                SetSafeZone(position, sizeFactor);
            }
            else if (mapName == "Old Warehouse")
            {
                // Bottom
                SFDGameScriptInterface.Vector2 position   = new SFDGameScriptInterface.Vector2(-500, -200);
                SFDGameScriptInterface.Point   sizeFactor = new SFDGameScriptInterface.Point(125, 3);
                SetSafeZone(position, sizeFactor);
            }
            else if (mapName == "Tower")
            {
                // Bottom
                SFDGameScriptInterface.Vector2 position   = new SFDGameScriptInterface.Vector2(-500, -200);
                SFDGameScriptInterface.Point   sizeFactor = new SFDGameScriptInterface.Point(125, 3);
                SetSafeZone(position, sizeFactor);
            }
            else if (mapName == "Pistons")
            {
                // Bottom
                SFDGameScriptInterface.Vector2 position1   = new SFDGameScriptInterface.Vector2(-500, -200);
                SFDGameScriptInterface.Point   sizeFactor1 = new SFDGameScriptInterface.Point(125, 3);
                SetSafeZone(position1, sizeFactor1);
                // The GIB-buckets:
                SFDGameScriptInterface.Vector2 position2   = new SFDGameScriptInterface.Vector2(-216, -40);
                SFDGameScriptInterface.Point   sizeFactor2 = new SFDGameScriptInterface.Point(10, 4);
                SetSafeZone(position2, sizeFactor2);
            }
            else if (mapName == "Facility")
            {
                // Bottom
                SFDGameScriptInterface.Vector2 position   = new SFDGameScriptInterface.Vector2(-500, -200);
                SFDGameScriptInterface.Point   sizeFactor = new SFDGameScriptInterface.Point(125, 5);
                SetSafeZone(position, sizeFactor);
                // Maybe left??
            }
            else if (mapName == "Steamship")
            {
                // Bottom
                SFDGameScriptInterface.Vector2 position   = new SFDGameScriptInterface.Vector2(-500, -180);
                SFDGameScriptInterface.Point   sizeFactor = new SFDGameScriptInterface.Point(125, 5);
                SetSafeZone(position, sizeFactor);
            }
            else if (mapName == "East Warehouse")
            {
                // Bottom
                SFDGameScriptInterface.Vector2 position   = new SFDGameScriptInterface.Vector2(-500, -150);
                SFDGameScriptInterface.Point   sizeFactor = new SFDGameScriptInterface.Point(32, 5);
                SetSafeZone(position, sizeFactor);
                // Left??
            }
            else
            {
                Game.RunCommand("/MSG " + "Mapissa " + mapName + ": Halen tervapeikko is off");
            }
        }
Exemplo n.º 10
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();
        }