Exemplo n.º 1
0
        public static void updateWeaponLevel(Entity player, string weapon, bool updateLevelNumber = false)
        {
            string  baseWeapon         = getBaseWeaponName(weapon);
            HudElem weaponLevelBar     = player.GetField <HudElem>("hud_weaponLevelBar");
            HudElem weaponLevelCounter = player.GetField <HudElem>("hud_weaponIcon").Children[0];

            if (!horde.weaponNames.ContainsKey(baseWeapon))
            {
                weaponLevelBar.ScaleOverTime(.3f, 0, 18);
                weaponLevelCounter.SetValue(0);
                return;
            }

            int   weaponLevelValue = horde.weaponLevelValues[player.EntRef][baseWeapon];
            float percent          = weaponLevelValue / (float)horde.maxWeaponLevelValue;

            if (percent < .05f)
            {
                percent = .05f;
            }
            weaponLevelBar.ScaleOverTime(.3f, (int)(percent * (int)weaponLevelBar.GetField("maxWidth")), 18);
            if (updateLevelNumber)
            {
                int weaponLevel = horde.weaponLevels[player.EntRef][baseWeapon];
                weaponLevelCounter.SetValue(weaponLevel);
            }
        }
Exemplo n.º 2
0
    public void startHUD()
    {
        HudElem primed = HudElem.CreateServerFontString(HudElem.Fonts.HudBig, 1);

        primed.SetPoint("TOP RIGHT", "TOPRIGHT", -45, 5);
        primed.HideWhenInMenu = true;
        primed.SetText("Primed Players:");
        primed.GlowAlpha = 0.10f;
        primed.GlowColor = new Vector3(0, 0, 0.7f);

        HudElem number = HudElem.CreateServerFontString(HudElem.Fonts.HudBig, 1);

        number.SetPoint("TOP RIGHT", "TOPRIGHT", -5, 5);
        number.HideWhenInMenu = true;
        OnInterval(100, () =>
        {
            number.SetValue(Primers.Count);
            if (Primers.Count == 0)
            {
                return(false);
            }
            return(true);
        });
        number.GlowAlpha = 0.10f;
        number.GlowColor = new Vector3(0, 0, 0.7f);
    }
Exemplo n.º 3
0
        private void Monitor(Entity player, ref Vector3 saved, ref HudElem velocity)
        {
            int v = Convert.ToInt32((Math.Truncate(Math.Sqrt((Math.Pow(player.GetVelocity().X, 2)) + (Math.Pow(player.GetVelocity().Y, 2))))));

            velocity.SetValue(v);
            if (player.IsPlayer && player.IsAlive)
            {
                if (player.MeleeButtonPressed())
                {
                    saved = player.GetOrigin();
                    player.IPrintLnBold("Saved Location");
                }
                if (player.UseButtonPressed())
                {
                    player.SetOrigin(saved);
                    player.IPrintLnBold("Teleported");
                }
            }
        }
Exemplo n.º 4
0
        private static void createHUD(Entity player)
        {
            if (player.HasField("hud_created"))
            {
                return;
            }

            HudElem divider = HudElem.CreateIcon(player, "hud_iw5_divider", 200, 24);

            divider.SetPoint("BOTTOMRIGHT", "BOTTOMRIGHT", -67, -20);
            divider.HideWhenInMenu = true;
            divider.Alpha          = 1;
            divider.Archived       = true;
            player.SetField("hud_divider", divider);
            divider.Sort = 1;

            // ammo stuff
            HudElem ammoSlash = HudElem.CreateFontString(player, HudElem.Fonts.HudSmall, 1f);

            ammoSlash.SetPoint("bottom right", "bottom right", -150, -28);
            ammoSlash.HideWhenInMenu   = true;
            ammoSlash.Archived         = true;
            ammoSlash.LowResBackground = true;
            ammoSlash.AlignX           = HudElem.XAlignments.Left;
            ammoSlash.Alpha            = 1;
            ammoSlash.SetText("");
            ammoSlash.Sort = 0;

            HudElem ammoStock = HudElem.CreateFontString(player, HudElem.Fonts.HudSmall, 1f);

            ammoStock.Parent = ammoSlash;
            ammoStock.SetPoint("bottom left", "bottom left", 8, 0);
            ammoStock.HideWhenInMenu = true;
            ammoStock.Archived       = true;
            ammoStock.SetValue(0);
            ammoStock.Sort = 0;

            HudElem ammoClip = HudElem.CreateFontString(player, HudElem.Fonts.HudBig, 1f);

            ammoClip.Parent = ammoSlash;
            ammoClip.SetPoint("right", "right", -5, -4);
            ammoClip.HideWhenInMenu = true;
            ammoClip.Archived       = true;
            ammoClip.SetValue(0);
            ammoClip.Sort = 0;

            HudElem weaponName = HudElem.CreateFontString(player, HudElem.Fonts.HudSmall, 1f);

            weaponName.SetPoint("bottom right", "bottom right", -140, -8);
            weaponName.HideWhenInMenu = true;
            weaponName.Archived       = true;
            weaponName.Alpha          = 1;
            weaponName.SetText("Test");
            weaponName.Sort = 0;

            HudElem scoreArrow = HudElem.CreateIcon(player, "ui_arrow_right", 12, 12);

            scoreArrow.SetPoint("BOTTOMLEFT", "BOTTOMLEFT", 82, -38);//-24
            scoreArrow.HideWhenInMenu = true;
            scoreArrow.Alpha          = 0;
            scoreArrow.Archived       = true;
            scoreArrow.Color          = new Vector3(.3f, 1, .3f);
            scoreArrow.Sort           = 1;
            HudElem scoreArrowShadow = HudElem.CreateIcon(player, "ui_arrow_right", 16, 16);

            scoreArrowShadow.SetPoint("CENTER", "CENTER", -6, 0);
            scoreArrowShadow.HideWhenInMenu = true;
            scoreArrowShadow.Alpha          = 0;
            scoreArrowShadow.Archived       = true;
            scoreArrowShadow.Color          = new Vector3(0, 0, 0);
            scoreArrowShadow.Sort           = 0;
            scoreArrowShadow.Parent         = scoreArrow;
            player.SetField("scoreArrow", scoreArrow);

            updateHUDAmmo(player);

            player.SetField("hud_weaponName", new Parameter(weaponName));
            player.SetField("hud_ammoClip", new Parameter(ammoClip));
            player.SetField("hud_ammoStock", new Parameter(ammoStock));
            player.SetField("hud_ammoSlash", new Parameter(ammoSlash));

            player.SetField("hud_created", true);
        }
Exemplo n.º 5
0
        public static void activateBonusDrop(Entity player, Entity bonus)
        {
            switch (bonus.GetField <string>("type"))
            {
            case "instaKill":
                botUtil.instaKillTime += 30;
                botUtil.startInstakill();
                bonus.PlaySound("mp_level_up");
                break;

            case "doublePoints":
                botUtil.doublePointsTime += 30;
                botUtil.startDoublePoints();
                bonus.PlaySound("mp_level_up");
                break;

            case "ammo":
                foreach (Entity players in Players)
                {
                    if (players.IsAlive)
                    {
                        AIZ.giveMaxAmmo(players);
                    }
                }
                break;

            case "nuke":
                StartAsync(doNuke(bonus));
                break;

            case "cash":
                bonus.PlaySound("mp_level_up");
                foreach (Entity players in Players)
                {
                    if (players.IsAlive && players.HasField("aizHud_created"))
                    {
                        players.SetField("cash", players.GetField <int>("cash") + 1000);
                        hud.scorePopup(players, 1000);
                        hud.scoreMessage(players, AIZ.gameStrings[97]);
                    }
                }
                break;

            case "points":
                bonus.PlaySound("mp_level_up");
                foreach (Entity players in Players)
                {
                    if (players.IsAlive && players.HasField("aizHud_created"))
                    {
                        int points = players.GetField <int>("points");
                        points += 10;
                        players.SetField("points", points);
                        //e_hud.scorePopup(players, 10);
                        hud.scoreMessage(players, AIZ.gameStrings[98]);
                        HudElem pointNumber = players.GetField <HudElem>("hud_pointNumber");
                        pointNumber.SetValue(points);
                    }
                }
                break;

            case "freeze":
                StartAsync(doFreezer(bonus));
                break;

            case "sale":
                mapEdit.startSale();
                mapEdit.sale = true;
                AfterDelay(30000, () => mapEdit.sale = false);
                break;

            case "perk":
                giveRandomPerkToAll();
                break;

            case "gun":
                player.PlayLocalSound("mp_level_up");
                StartAsync(giveDeathMachine(player));
                break;

            default:
                break;
            }
            hud.showPowerUpHud(bonus.GetField <string>("type"), player);
        }
Exemplo n.º 6
0
        public static void onBotDamage(Entity hitbox, Parameter damage, Parameter attacker, Parameter direction_vec, Parameter point, Parameter meansOfDeath, Parameter modelName, Parameter partName, Parameter tagName, Parameter iDFlags, Parameter weapon, bool isCrawler, bool isBoss)
        {
            if ((string)weapon == "iw5_usp45_mp_akimbo_silencer02" || AIZ.isRayGun((string)weapon))
            {
                return;
            }

            Entity currentBot = hitbox.GetField <Entity>("parent");

            if (!botsInPlay.Contains(currentBot))
            {
                return;
            }
            Entity player = (Entity)attacker;

            if ((string)weapon == "remote_uav_weapon_mp" && attacker.As <Entity>().HasField("owner"))//UAV tweaks
            {
                player       = attacker.As <Entity>().GetField <Entity>("owner");
                meansOfDeath = "MOD_PASSTHRU";
                damage       = 50;
            }
            else if ((string)weapon == "sentry_minigun_mp")//Sentry tweaks
            {
                player       = attacker.As <Entity>().GetField <Entity>("owner");
                meansOfDeath = "MOD_PASSTHRU";
                damage       = 10;
            }
            else if ((string)weapon == "manned_gl_turret_mp")//Sentry tweaks
            {
                player       = attacker.As <Entity>().GetField <Entity>("owner");
                meansOfDeath = "MOD_PASSTHRU";
                damage       = 300;
            }
            else if ((string)weapon == "remote_tank_projectile_mp" || (string)weapon == "uav_strike_projectile_mp")
            {
                player       = attacker.As <Entity>().GetField <Entity>("owner");
                meansOfDeath = "MOD_PASSTHRU";
            }
            else if ((string)weapon == "ac130_25mm_mp")//A10 tweaks
            {
                //player = attacker.As<Entity>().GetField<Entity>("owner");
                meansOfDeath = "MOD_PASSTHRU";
            }

            //Utilities.PrintToConsole((string)meansOfDeath);

            if ((string)meansOfDeath == "MOD_BLEEDOUT")
            {
                Vector3 org = currentBot.GetTagOrigin("j_head");
                PlayFX(AIZ.fx_headshotBlood, org);
                doBotDamage((int)damage, player, (string)weapon, hitbox, (string)meansOfDeath, point.As <Vector3>(), true);
            }
            else
            {
                if ((string)weapon != "sentry_minigun_mp" && (string)weapon != "manned_gl_turret_mp" && (string)weapon != "remote_uav_weapon_mp" && (string)meansOfDeath != "MOD_EXPLOSIVE_BULLET")
                {
                    PlayFX(AIZ.fx_blood, point.As <Vector3>());                                                                                                                                                                               //Only play FX if the weapon isn't a script weapon
                }
                doBotDamage((int)damage, player, (string)weapon, hitbox, (string)meansOfDeath, point.As <Vector3>());
            }
            string botState = currentBot.GetField <string>("state");

            if (botState != "hurt" && botState != "attacking" && (string)meansOfDeath != "MOD_BLEEDOUT")
            {
                if (!isCrawler && !isBoss)
                {
                    playAnimOnBot(currentBot, getHurtAnim(hitbox));
                }
                else if (isBoss)
                {
                    playAnimOnBot(currentBot, anim_runHurt);
                }
                currentBot.SetField("state", "hurt");
                AfterDelay(500, () =>
                           currentBot.SetField("state", "post_hurt"));
            }

            updateBotLastActiveTime(currentBot);

            if (hitbox.GetField <int>("damageTaken") >= hitbox.GetField <int>("currentHealth"))
            {
                currentBot.SetField("isAlive", false);
                if (currentBot.HasField("isOnCompass") && currentBot.GetField <bool>("isOnCompass"))
                {
                    /*
                     * Objective_Delete(currentBot.GetField<int>("compassID"));
                     * h_mapEdit._objIDList[currentBot.GetField<int>("compassID")] = false;
                     * h_mapEdit._objIDs.Remove(currentBot);
                     * currentBot.ClearField("compassID");
                     */
                    mapEdit.removeObjID(currentBot);
                    currentBot.SetField("isOnCompass", false);
                }
                hitbox.SetCanDamage(false);
                hitbox.SetCanRadiusDamage(false);
                hitbox.SetModel("tag_origin");//Change model to avoid the dead bot's hitbox blocking shots
                //if (isBoss) hitbox.Delete();
                if (AIZ.isPlayer(player))
                {
                    if (currentBot.HasField("primedForNuke") && !currentBot.GetField <bool>("primedForNuke"))
                    {
                        int pointGain = 50;
                        if ((string)meansOfDeath == "MOD_HEADSHOT")
                        {
                            pointGain = 100;
                        }
                        if ((string)meansOfDeath == "MOD_MELEE")
                        {
                            pointGain = 130;
                        }

                        if (doublePointsTime > 0)
                        {
                            pointGain *= 2;
                        }

                        if ((string)meansOfDeath != "MOD_PASSTHRU")
                        {
                            player.SetField("cash", player.GetField <int>("cash") + pointGain);
                            hud.scorePopup(player, pointGain);
                        }
                        AIZ.addRank(player, pointGain);
                    }
                    player.Kills++;
                    if (player.HasField("aizHud_created"))
                    {
                        player.SetField("points", player.GetField <int>("points") + 1);
                        HudElem pointNumber = player.GetField <HudElem>("hud_pointNumber");
                        pointNumber.SetValue(player.GetField <int>("points"));
                    }
                    killstreaks.checkKillstreak(player);
                }
                currentBot.MoveTo(currentBot.Origin, 0.05f);

                if (isCrawler || currentBot.HasField("hasBeenCrippled"))
                {
                    playAnimOnBot(currentBot, crawlerAnim_death);
                }
                else
                {
                    //Log.Write(LogLevel.All, (string)meansOfDeath);

                    /*
                     * if ((string)meansOfDeath == "MOD_EXPLOSIVE" || (string)meansOfDeath == "MOD_GRENADE_SPLASH")
                     * {
                     *  currentBot.Angles = VectorToAngles(point.As<Vector3>() - currentBot.Origin);
                     *  int randomAnim = g_AIZ.rng.Next(anim_death_explode.Length);
                     *  currentplayAnimOnBot(bot, anim_death_explode[randomAnim]);
                     * }
                     * else
                     */
                    //{
                    int randomAnim = AIZ.rng.Next(anim_deaths.Length);
                    playAnimOnBot(currentBot, anim_deaths[randomAnim]);
                    //}
                }

                if (currentBot.HasField("hasBeenCrippled"))
                {
                    currentBot.ClearField("hasBeenCrippled");
                }

                if (isCrawler)
                {
                    AfterDelay(500, () => currentBot.MoveTo(currentBot.Origin + new Vector3(0, 0, 2500), 5));
                }

                AfterDelay(5000, () => despawnBot(currentBot, isCrawler, isBoss));
                botsInPlay.Remove(currentBot);
                onBotUpdate();
                roundSystem.checkForEndRound();
                if (isCrawler && roundSystem.isCrawlerWave && (botsInPlay.Count == 0 && botsForWave == spawnedBots) && perkDropsEnabled && AIZ.isHellMap)
                {
                    bonusDrops.spawnBonusDrop(bonusDrops.dropTypes.perk, currentBot.Origin); return;
                }
                if (!isBoss)
                {
                    bonusDrops.dropTypes bonusType = bonusDrops.checkForBonusDrop();
                    if (bonusType != bonusDrops.dropTypes.none)
                    {
                        bonusDrops.spawnBonusDrop(bonusType, currentBot.Origin);
                    }
                }
            }
        }
Exemplo n.º 7
0
    private static void updateHUDAmmo(Entity player)
    {
        if (!player.HasField("cod4hud_created"))
        {
            return;
        }

        if (!player.IsAlive)
        {
            return;
        }

        HudElem ammoStock      = player.GetField <HudElem>("hud_ammoStock");
        HudElem ammoClip       = player.GetField <HudElem>("hud_ammoClip");
        HudElem ammoSlash      = player.GetField <HudElem>("hud_slash");
        HudElem flash          = player.GetField <HudElem>("hud_flash");
        HudElem grenade        = player.GetField <HudElem>("hud_grenade");
        HudElem weaponName     = player.GetField <HudElem>("hud_weaponName");
        HudElem equipAmmo      = player.GetField <HudElem>("hud_equipAmmo");
        string  currentWeapon  = player.CurrentWeapon;
        int     flashAmmo      = 0;
        int     equipAmmoCount = 0;

        if (currentWeapon == "c4_mp" || currentWeapon == "claymore_mp")
        {
            ammoStock.Alpha = 0;
            ammoClip.Alpha  = 0;;
            ammoSlash.SetText("");
        }
        else
        {
            ammoStock.Alpha = 1;
            ammoClip.Alpha  = 1;
            ammoStock.SetValue(player.GetWeaponAmmoStock(currentWeapon));
            ammoClip.SetValue(player.GetWeaponAmmoClip(currentWeapon));
            ammoSlash.SetText("/");
        }
        if (player.HasWeapon("concussion_grenade_mp"))
        {
            flashAmmo = player.GetAmmoCount("concussion_grenade_mp");
        }
        else if (player.HasWeapon("smoke_grenade_mp"))
        {
            flashAmmo = player.GetAmmoCount("smoke_grenade_mp");
        }
        else
        {
            flashAmmo = player.GetAmmoCount("flash_grenade_mp");
        }

        if (flashAmmo == 0)
        {
            flash.SetValue(flashAmmo);
            flash.Color = new Vector3(1, 0, 0);
        }
        else
        {
            flash.SetValue(flashAmmo);
            flash.Color = new Vector3(1, 1, 1);
        }

        int fragAmmo = player.GetAmmoCount("frag_grenade_mp");

        grenade.SetValue(fragAmmo);
        if (fragAmmo == 0)
        {
            grenade.Color = new Vector3(1, 0, 0);
        }
        else
        {
            grenade.Color = new Vector3(1, 1, 1);
        }

        if (player.HasWeapon("c4_mp"))
        {
            equipAmmoCount = player.GetAmmoCount("c4_mp");
        }
        else if (player.HasWeapon("claymore_mp"))
        {
            equipAmmoCount = player.GetAmmoCount("claymore_mp");
        }
        else if (player.HasWeapon("rpg_mp"))
        {
            equipAmmoCount = player.GetAmmoCount("rpg_mp");
        }

        equipAmmo.SetValue(equipAmmoCount);
        if (equipAmmoCount == 0)
        {
            equipAmmo.Color = new Vector3(1, 0, 0);
        }
        else
        {
            equipAmmo.Color = new Vector3(1, 1, 1);
        }

        var weapon = player.CurrentWeapon;

        if (weapon.Contains("iw5_usp45_"))
        {
            weaponName.SetText("USP.45");
        }
        else if (weapon.Contains("iw5_deserteagle_"))
        {
            weaponName.SetText("Desert Eagle");
        }
        else if (weapon.Contains("iw5_m4_"))
        {
            weaponName.SetText("M4 Carbine");
        }
        else if (weapon.Contains("iw5_ak47_"))
        {
            weaponName.SetText("AK-47");
        }
        else if (weapon.Contains("iw5_g36c_"))
        {
            weaponName.SetText("G36C");
        }
        else if (weapon.Contains("iw5_m16_"))
        {
            weaponName.SetText("M16A4");
        }
        else if (weapon.Contains("iw5_mk14_"))
        {
            weaponName.SetText("M14");
        }
        else if (weapon.Contains("iw5_mp5_"))
        {
            weaponName.SetText("MP5");
        }
        else if (weapon.Contains("iw5_m9_"))
        {
            weaponName.SetText("Mini-Uzi");
        }
        else if (weapon.Contains("iw5_p90_"))
        {
            weaponName.SetText("P90");
        }
        else if (weapon.Contains("iw5_skorpion_"))
        {
            weaponName.SetText("Skorpion");
        }
        else if (weapon.Contains("iw5_usas12_"))
        {
            weaponName.SetText("M1014");
        }
        else if (weapon.Contains("iw5_ksg_"))
        {
            weaponName.SetText("W1200");
        }
        else if (weapon.Contains("iw5_m60_"))
        {
            weaponName.SetText("M60E4");
        }
        else if (weapon.Contains("iw5_barrett_"))
        {
            weaponName.SetText("Barrett 50.cal");
        }
        else if (weapon == "rpg_mp")
        {
            weaponName.SetText("RPG-7");
        }
        else if (weapon.Contains("iw5_msr_"))
        {
            weaponName.SetText("M40A3");
        }
        else if (weapon.Contains("iw5_dragunov_"))
        {
            weaponName.SetText("Dragunov");
        }
        else if (weapon.Contains("iw5_mk46_"))
        {
            weaponName.SetText("M249 SAW");
        }
        else if (weapon.Contains("c4_mp"))
        {
            weaponName.SetText("C4 Detonator");
        }
        else if (weapon.Contains("claymore_mp"))
        {
            weaponName.SetText("Claymore");
        }
        else
        {
            weaponName.SetText("");
        }
    }
Exemplo n.º 8
0
        public static void updateAmmoHud(Entity player, bool updateName, string newWeapon = "")
        {
            if (!player.HasField("hud_created") || (player.HasField("hud_created") && !player.GetField <bool>("hud_created")))
            {
                return;
            }

            HudElem ammoStock = player.GetField <HudElem>("hud_ammoStock");
            HudElem ammoClip  = player.GetField <HudElem>("hud_ammoClip");
            HudElem equipment = player.GetField <HudElem>("hud_equipment");
            HudElem ammoBar   = player.GetField <HudElem>("hud_weaponBar");
            string  weapon    = player.CurrentWeapon;

            if (newWeapon != "")
            {
                weapon = newWeapon;
            }

            //build grenades hud
            int    lethalAmmoCount = 0;
            string grenade         = "  ";

            if (player.HasWeapon("c4_mp"))
            {
                lethalAmmoCount = player.GetAmmoCount("c4_mp");
                string extraLethal = lethalAmmoCount > 1 ? createHudShaderString("hud_icon_c4", false, 48, 48) : "";
                grenade = lethalAmmoCount > 0 ? createHudShaderString("hud_icon_c4", false, 48, 48) + extraLethal + "" : "";
            }
            else if (player.HasWeapon("throwingknife_mp"))
            {
                lethalAmmoCount = player.GetAmmoCount("throwingknife_mp");
                grenade         = lethalAmmoCount > 0 ? createHudShaderString("killiconimpale", false, 48, 48) + "" : "";
            }

            int    tacticalAmmoCount = player.GetAmmoCount("flash_grenade_mp");
            string special           = "";
            string extraTactical     = tacticalAmmoCount > 1 ? createHudShaderString("hud_us_flashgrenade", false, 48, 48) : "   ";

            special = (player.HasWeapon("flash_grenade_mp") && tacticalAmmoCount > 0) ? createHudShaderString("hud_us_flashgrenade", false, 48, 48) + extraTactical + "    " : "         ";

            int ammoClipValue  = player.GetWeaponAmmoClip(weapon);
            int ammoStockValue = player.GetWeaponAmmoStock(weapon);

            ammoStock.SetValue(ammoStockValue);
            ammoClip.SetValue(ammoClipValue);
            ammoStock.Alpha = 1;
            ammoClip.Alpha  = 1;
            equipment.SetText(special + grenade);

            float ammoPercent = ammoClipValue / (float)WeaponClipSize(weapon);

            if (ammoPercent < .02f)
            {
                ammoPercent = .02f;
            }
            int maxWidth = (int)ammoBar.GetField("maxWidth");

            ammoBar.SetShader("clanlvl_box", (int)(ammoPercent * maxWidth), 24);

            if (updateName)
            {
                StartAsync(updateWeaponName(player, weapon));
                updateWeaponImage(player, weapon);
                updateWeaponLevel(player, weapon, true);
            }
        }