public static HudElem PerkHud(this Entity player, PerkCola perk, bool playsound = false) { player.Call("setblurforplayer", 6, 0.5f); int perksAmount = player.PerkColasCount() - 1; int MultiplyTimes = 28 * perksAmount; var hudtext = HudElem.NewClientHudElem(player); hudtext.AlignX = "center"; hudtext.VertAlign = "middle"; hudtext.AlignY = "middle"; hudtext.HorzAlign = "center"; hudtext.Font = "objective"; hudtext.FontScale = 1.5f; hudtext.X = 0; hudtext.Y = 0; hudtext.Foreground = true; hudtext.Color = perk.HudColor; hudtext.Alpha = 0; hudtext.SetText(perk.HudName); var hudshader = HudElem.NewClientHudElem(player); hudshader.AlignX = "center"; hudshader.VertAlign = "middle"; hudshader.AlignY = "middle"; hudshader.HorzAlign = "center"; hudshader.X = 0; hudshader.Y = 0; hudshader.Foreground = true; hudshader.SetShader(perk.Icon, 25, 25); hudshader.Alpha = 1; hudshader.SetField("perk", new Parameter(perk.Type)); player.AfterDelay(300, e => { hudshader.Call("moveovertime", 0.5f); hudshader.X = -200; }); player.AfterDelay(700, e => { player.Call("setblurforplayer", 0, 0.3f); hudtext.Alpha = 1; }); player.AfterDelay(3700, e => { hudtext.Call("fadeovertime", 0.25f); hudtext.Alpha = 0; hudshader.Call("scaleovertime", 1, 25, 25); hudshader.Call("moveovertime", 1); hudshader.X = -300 + MultiplyTimes; hudshader.Y = 180; }); player.AfterDelay(4700, e => { hudtext.Call("destroy"); }); return(hudshader); }
public static string PerkBoxHintString(PerkCola perk) { if (Function.Call <int>("getdvarint", "bonus_fire_sale") == 1) { return("Press ^3[{+activate}]^7 to buy " + perk.FullName + ". [Cost: ^2$^610^7]"); } return("Press ^3[{+activate}]^7 to buy " + perk.FullName + ". [Cost: ^2$^3" + perk.Pay + "^7]"); }
/// <summary> /// 获取玩家是否拥有指定Perk-a-Cola /// </summary> /// <param name="player">指定玩家</param> /// <param name="perk">要查询的Perk-a-Cola的对象</param> /// <returns></returns> public static bool HasPerkCola(this Entity player, PerkColaType perk) { if (player.HasField(PerkCola.QueryDvar(perk)) && player.GetField <int>(PerkCola.QueryDvar(perk)) != 0) { return(true); } return(false); }
/// <summary> /// 获取玩家是否拥有指定Perk-a-Cola /// </summary> /// <param name="player">指定玩家</param> /// <param name="perk">要查询的Perk-a-Cola的对象</param> /// <returns></returns> public static bool HasPerkCola(this Entity player, PerkCola perk) { if (player.HasField(perk.GetDvar()) && player.GetField <int>(perk.GetDvar()) != 0) { return(true); } return(false); }
private string PerkText(Entity player, PerkCola perk) { if (player.GetTeam() == "allies") { if (Call <int>("getdvarint", "scr_aiz_power") == 0 || Call <int>("getdvarint", "scr_aiz_power") == 2) { return("Requires Electricity"); } return(PerkCola.PerkBoxHintString(perk)); } return(""); }
private static void RandomPerkCola(this Entity player) { if (player.GetField <int>("aiz_perks") == 11) { return; } var perk = PerkCola.RandomPerk(); while (PerkCola.HasPerkCola(player, perk)) { perk = PerkCola.RandomPerk(); } PerkCola.GivePerkCola(player, perk); }
public void CreatePerk(Vector3 origin, Vector3 angles, PerkCola perk) { if (_perkboxs.Contains(perk.Type)) { return; } _perkboxs.Add(perk.Type); Entity ent = SpawnCrate(origin, angles); ent.SetField("perk", new Parameter(perk)); CreateObjective(ent, perk.PerkIcon, "allies"); MakeUsable(ent, "perk", 50); }
private int GetPerkPay(PerkCola perk) { if (perk.Type == QUICK_REVIVE) { return(500); } if (perk.Type == SPEED_COLA) { return(700); } if (perk.Type == JUGGERNOG) { return(1000); } if (perk.Type == STAMIN_UP) { return(800); } if (perk.Type == MULE_KICK) { return(700); } if (perk.Type == DOUBLE_TAP) { return(600); } if (perk.Type == DEAD_SHOT) { return(600); } if (perk.Type == PHD) { return(800); } if (perk.Type == ELECTRIC_CHERRY) { return(600); } if (perk.Type == WIDOW_S_WINE) { return(1000); } if (perk.Type == VULTURE_AID) { return(500); } return(0); }
private string GetPerkFullName(PerkCola perk) { if (perk.Type == QUICK_REVIVE) { return("Quick Revive"); } if (perk.Type == SPEED_COLA) { return("Speed Cola"); } if (perk.Type == JUGGERNOG) { return("Juggernog"); } if (perk.Type == STAMIN_UP) { return("Stamin-Up"); } if (perk.Type == MULE_KICK) { return("Mule Kick"); } if (perk.Type == DOUBLE_TAP) { return("Double Tap Root Beer"); } if (perk.Type == DEAD_SHOT) { return("Deadshot Daiquiri"); } if (perk.Type == PHD) { return("PhD Flopper"); } if (perk.Type == ELECTRIC_CHERRY) { return("Electric Cherry"); } if (perk.Type == WIDOW_S_WINE) { return("Widow's Wine"); } if (perk.Type == VULTURE_AID) { return("Vulture Aid Elixir"); } return(""); }
private string GetPerkIcon(PerkCola perk) { if (perk.Type == QUICK_REVIVE) { return("specialty_finalstand"); } if (perk.Type == SPEED_COLA) { return("specialty_fastreload"); } if (perk.Type == JUGGERNOG) { return("cardicon_juggernaut_1"); } if (perk.Type == STAMIN_UP) { return("specialty_longersprint"); } if (perk.Type == MULE_KICK) { return("specialty_twoprimaries"); } if (perk.Type == DOUBLE_TAP) { return("specialty_moredamage"); } if (perk.Type == DEAD_SHOT) { return("cardicon_headshot"); } if (perk.Type == PHD) { return("specialty_blastshield"); } if (perk.Type == ELECTRIC_CHERRY) { return("cardicon_cod4"); } if (perk.Type == WIDOW_S_WINE) { return("cardicon_soap_bar"); } if (perk.Type == VULTURE_AID) { return("specialty_scavenger"); } return(""); }
/// <summary> /// 给与玩家一个随机的Perk-a-Cola /// </summary> /// <param name="player">指定玩家</param> public static void GiveRandomPerkCola(this Entity player, bool effect) { if (player.PerkColasCount() == MAX_PERKCOLAS) { return; } var perk = PerkCola.GetRandomPerkCola(); if (player.HasPerkCola(perk.Type) || (perk.Type == PerkColaType.TOMBSTONE && !player.HasPerkCola(PerkColaType.QUICK_REVIVE))) { player.GiveRandomPerkCola(effect); return; } perk.GiveToPlayer(player, effect); }
public static void UsePerk(Entity player, PerkCola perk) { if (!player.IsAlive) { return; } if (player.GetTeam() == "allies") { if (Function.Call <int>("getdvarint", "bonus_fire_sale") == 1 && player.GetCash() >= 10) { if (player.GetField <int>("aiz_perks") >= 5) { player.Call("iprintln", "^1You already have 5 Perk-a-Cola."); return; } if (PerkCola.HasPerkCola(player, perk)) { player.Call("iprintln", "^1You already have " + perk.FullName + "."); return; } player.PayCash(10); PerkCola.GivePerkCola(player, perk); } else if (player.GetCash() >= perk.Pay) { if (player.GetField <int>("aiz_perks") >= 5) { player.Call("iprintln", "^1You already have 5 Perk-a-Cola."); return; } if (PerkCola.HasPerkCola(player, perk)) { player.Call("iprintln", "^1You already have " + perk.FullName + "."); return; } player.PayCash(perk.Pay); PerkCola.GivePerkCola(player, perk); } else { player.Call("iprintln", "^1Not enough cash for " + perk.FullName + ". Need ^2$^3" + perk.Pay); } } }
/// <summary> /// 删除指定玩家指定的Perk-a-Cola /// </summary> /// <param name="player">指定玩家</param> /// <param name="perk">要删除的Perk-a-Cola的对象</param> public static void RemovePerkCola(this Entity player, PerkColaType type, bool tempdisable = false) { var perk = new PerkCola(type); perk.TakePlayerPerkCola(player); if (tempdisable) { var list = player.GetPerkColaHud(); foreach (var item in list) { if (item.GetField <PerkColaType>("perk") == type) { item.Call("fadeovertime", 0.5f); item.Alpha = 0; break; } } } }
public static HudElem PerkHudNoEffect(this Entity player, PerkCola perk, bool playsound = false) { int perksAmount = player.PerkColasCount() - 1; int MultiplyTimes = 28 * perksAmount; var hudshader = HudElem.NewClientHudElem(player); hudshader.AlignX = "center"; hudshader.VertAlign = "middle"; hudshader.AlignY = "middle"; hudshader.HorzAlign = "center"; hudshader.X = -300 + MultiplyTimes; hudshader.Y = 180; hudshader.Foreground = true; hudshader.SetShader(perk.Icon, 25, 25); hudshader.Call("fadeovertime", 0.5f); hudshader.Alpha = 1; hudshader.SetField("perk", new Parameter(perk.Type)); return(hudshader); }
public void OnSpawned(Entity player) { player.Call("freezecontrols", false); player.OnInterval(100, e => { if (player.GetField <int>("aiz_cash") >= 13000) { player.SetField("aiz_cash", 13000); } if (player.GetField <int>("aiz_point") >= 200) { player.SetField("aiz_point", 200); } return(player.IsAlive); }); player.SetField("speed", 1f); player.SetField("usingtelepot", 0); player.SetField("xpUpdateTotal", 0); if (player.GetTeam() == "allies") { PerkCola.ResetPerkCola(player); player.SetField("incantation", 0); player.Call("setviewmodel", "viewmodel_base_viewhands"); player.Call("clearperks"); player.SetPerk("specialty_assists", true, false); player.SetPerk("specialty_paint", true, false); player.SetPerk("specialty_paint_pro", true, false); } else if (player.GetTeam() == "axis") { player.SetField("zombie_incantation", 0); SetZombieModel(player); player.Call("clearperks"); player.SetPerk("specialty_falldamage", true, false); player.SetPerk("specialty_lightweight", true, false); player.SetPerk("specialty_longersprint", true, false); player.SetPerk("specialty_grenadepulldeath", true, false); player.SetPerk("specialty_fastoffhand", true, false); player.SetPerk("specialty_fastreload", true, false); player.SetPerk("specialty_paint", true, false); player.SetPerk("specialty_autospot", true, false); player.SetPerk("specialty_stalker", true, false); player.SetPerk("specialty_marksman", true, false); player.SetPerk("specialty_quickswap", true, false); player.SetPerk("specialty_quickdraw", true, false); player.SetPerk("specialty_fastermelee", true, false); player.SetPerk("specialty_selectivehearing", true, false); player.SetPerk("specialty_steadyaimpro", true, false); player.SetPerk("specialty_sitrep", true, false); player.SetPerk("specialty_detectexplosive", true, false); player.SetPerk("specialty_fastsprintrecovery", true, false); player.SetPerk("specialty_fastmeleerecovery", true, false); player.SetPerk("specialty_bulletpenetration", true, false); player.SetPerk("specialty_bulletaccuracy", true, false); } }
private static void Gamble(this Entity player) { player.Call("iprintlnbold", new Parameter[] { "^210" }); player.Call("playlocalsound", new Parameter[] { "ui_mp_nukebomb_timer" }); player.AfterDelay(1000, e => player.Call("iprintlnbold", "^29")); player.AfterDelay(1000, e => player.Call("playlocalsound", "ui_mp_nukebomb_timer")); player.AfterDelay(2000, e => player.Call("iprintlnbold", "^28")); player.AfterDelay(2000, e => player.Call("playlocalsound", "ui_mp_nukebomb_timer")); player.AfterDelay(3000, e => player.Call("iprintlnbold", "^27")); player.AfterDelay(3000, e => player.Call("playlocalsound", "ui_mp_nukebomb_timer")); player.AfterDelay(4000, e => player.Call("iprintlnbold", "^26")); player.AfterDelay(4000, e => player.Call("playlocalsound", "ui_mp_nukebomb_timer")); player.AfterDelay(5000, e => player.Call("iprintlnbold", "^25")); player.AfterDelay(5000, e => player.Call("playlocalsound", "ui_mp_nukebomb_timer")); player.AfterDelay(6000, e => player.Call("iprintlnbold", "^24")); player.AfterDelay(6000, e => player.Call("playlocalsound", "ui_mp_nukebomb_timer")); player.AfterDelay(7000, e => player.Call("iprintlnbold", "^23")); player.AfterDelay(7000, e => player.Call("playlocalsound", "ui_mp_nukebomb_timer")); player.AfterDelay(8000, e => player.Call("iprintlnbold", "^22")); player.AfterDelay(8000, e => player.Call("playlocalsound", "ui_mp_nukebomb_timer")); player.AfterDelay(9000, e => player.Call("iprintlnbold", "^21")); player.AfterDelay(9000, e => player.Call("playlocalsound", "ui_mp_nukebomb_timer")); player.AfterDelay(10000, e => { switch (Utility.Rng.Next(22)) { case 0: player.PrintGambleInfo("You win nothing.", GambleType.Bad); break; case 1: player.PrintGambleInfo("You win $500.", GambleType.Good); player.WinCash(500); break; case 2: player.PrintGambleInfo("You win $1000.", GambleType.Good); player.WinCash(1000); break; case 3: player.PrintGambleInfo("You win $2000.", GambleType.Good); player.WinCash(2000); break; case 4: player.PrintGambleInfo("You lose $500.", GambleType.Bad); player.PayCash(500); break; case 5: player.PrintGambleInfo("You lose all money.", GambleType.Bad); player.SetField("aiz_cash", 0); break; case 6: player.PrintGambleInfo("You win $10000.", GambleType.Excellent); player.WinCash(10000); break; case 7: player.PrintGambleInfo("You win 10 bonus Points.", GambleType.Good); player.WinPoint(10); break; case 8: player.PrintGambleInfo("You win 50 bonus Points.", GambleType.Excellent); player.WinPoint(50); break; case 9: player.PrintGambleInfo("You lose all bonus Points.", GambleType.Bad); player.SetField("aiz_point", 0); break; case 10: player.PrintGambleInfo("You live or die after 5 second.", GambleType.Bad); player.AfterDelay(1000, ex => player.Call("iprintlnbold", "^15")); player.AfterDelay(1000, ex => player.Call("playlocalsound", "ui_mp_nukebomb_timer")); player.AfterDelay(2000, ex => player.Call("iprintlnbold", "^14")); player.AfterDelay(2000, ex => player.Call("playlocalsound", "ui_mp_nukebomb_timer")); player.AfterDelay(3000, ex => player.Call("iprintlnbold", "^13")); player.AfterDelay(3000, ex => player.Call("playlocalsound", "ui_mp_nukebomb_timer")); player.AfterDelay(4000, ex => player.Call("iprintlnbold", "^12")); player.AfterDelay(4000, ex => player.Call("playlocalsound", "ui_mp_nukebomb_timer")); player.AfterDelay(5000, ex => player.Call("iprintlnbold", "^11")); player.AfterDelay(5000, ex => player.Call("playlocalsound", "ui_mp_nukebomb_timer")); player.AfterDelay(6000, ex => { switch (Utility.Rng.Next(2)) { case 0: player.PrintGambleInfo("You live!", GambleType.Good); break; case 1: player.PrintGambleInfo("You die!", GambleType.Bad); player.SelfExploed(); break; } }); break; case 11: player.PrintGambleInfo("Gambler Restart.", GambleType.Bad); player.AfterDelay(1000, ex => player.Gamble()); return; case 12: player.PrintGambleInfo("Robbed all cash.", GambleType.Excellent); int cash = 0; foreach (var item in Utility.GetPlayers()) { if (item.GetTeam() == "allies" && item.IsAlive && item != player) { item.GamblerText("Player " + player.Name + " robbed you all cash.", new Vector3(1, 1, 1), new Vector3(1, 0, 0), 1, 0.85f); cash += item.GetCash(); item.SetField("cash", 0); } } player.WinCash(cash); break; case 13: player.PrintGambleInfo("Incantation", GambleType.Bad); player.SetField("incantation", 1); break; case 14: player.PrintGambleInfo("Give all human $500", GambleType.Excellent); player.WinCash(500); foreach (var item in Utility.GetPlayers()) { if (item.GetTeam() == "allies" && item.IsAlive && item != player) { item.WinCash(500); item.GamblerText("Player " + player.Name + " give you $500.", new Vector3(1, 1, 1), new Vector3(0, 1, 0), 1, 0.85f); } } break; case 15: player.PrintGambleInfo("You infected.", GambleType.Bad); player.SelfExploed(); break; case 16: player.PrintGambleInfo("You lose all weapon.", GambleType.Bad); player.TakeAllWeapons(); break; case 17: player.PrintGambleInfo("You win riotshield in your back.", GambleType.Good); player.Call("attachshieldmodel", "weapon_riot_shield_mp", "tag_shield_back"); break; case 18: player.PrintGambleInfo("Surprise!", GambleType.Terrible); foreach (var item in Utility.GetPlayers()) { if (item.GetTeam() == "allies" && item.IsAlive) { item.SetField("aiz_cash", 0); item.SetField("aiz_point", 0); if (player != item) { item.GamblerText("Surprise!", new Vector3(0, 0, 0), new Vector3(1, 1, 1), 1, 0); } } } break; case 19: player.PrintGambleInfo("You win a random Perk-a-Cola.", GambleType.Good); player.RandomPerkCola(); break; case 20: player.PrintGambleInfo("You lose all Perk-a-Cola.", GambleType.Terrible); PerkCola.TakeAllPerkCola(player); break; case 21: player.PrintGambleInfo("Other humans die or you die after 5 second.", GambleType.Terrible); foreach (var item in Utility.GetPlayers()) { if (item.GetTeam() == "allies" && item.IsAlive) { if (player != item) { item.GamblerText("You die or " + player.Name + " die after 5 second.", new Vector3(0, 0, 0), new Vector3(1, 1, 1), 1, 0); } item.AfterDelay(1000, ex => item.Call("iprintlnbold", "^05")); item.AfterDelay(1000, ex => item.Call("playlocalsound", "ui_mp_nukebomb_timer")); item.AfterDelay(2000, ex => item.Call("iprintlnbold", "^04")); item.AfterDelay(2000, ex => item.Call("playlocalsound", "ui_mp_nukebomb_timer")); item.AfterDelay(3000, ex => item.Call("iprintlnbold", "^03")); item.AfterDelay(3000, ex => item.Call("playlocalsound", "ui_mp_nukebomb_timer")); item.AfterDelay(4000, ex => item.Call("iprintlnbold", "^02")); item.AfterDelay(4000, ex => item.Call("playlocalsound", "ui_mp_nukebomb_timer")); item.AfterDelay(5000, ex => item.Call("iprintlnbold", "^01")); item.AfterDelay(5000, ex => item.Call("playlocalsound", "ui_mp_nukebomb_timer")); } } player.AfterDelay(6000, ex => { switch (Utility.Rng.Next(3)) { case 0: case 1: foreach (var item in Utility.GetPlayers()) { if (player != item && item.GetTeam() == "allies") { item.GamblerText(player.Name + " die. You live!", new Vector3(1, 1, 1), new Vector3(0, 1, 0), 1, 0.85f); } } player.PrintGambleInfo("You die!", GambleType.Bad); player.SelfExploed(); break; case 2: foreach (var item in Utility.GetPlayers()) { if (player != item && item.GetTeam() == "allies") { item.GamblerText("You die! And " + player.Name + " live!", new Vector3(0, 0, 0), new Vector3(1, 1, 1), 1, 0); item.SelfExploed(); } } player.PrintGambleInfo("You live! And you have all Perk-a-Cola!", GambleType.Excellent); player.WinCash(1000); while (player.GetField <int>("aiz_perks") < 11) { player.RandomPerkCola(); } break; } }); break; } player.SetField("isgambling", 0); }); }
/// <summary> /// 给与指定玩家指定的Perk-a-Cola,但是不播放给与特效 /// </summary> /// <param name="player">指定玩家</param> /// <param name="perk">要给与的Perk-a-Cola的对象</param> public static void GivePerkColaNoEffect(this Entity player, PerkColaType type) { var perk = new PerkCola(type); perk.GiveToPlayer(player, false); }
/// <summary> /// 删除指定玩家指定的Perk-a-Cola /// </summary> /// <param name="player">指定玩家</param> /// <param name="perk">要删除的Perk-a-Cola的对象</param> public static void RemovePerkCola(this Entity player, PerkCola perk) { perk.TakePerkCola(player); }
public override void OnPlayerKilled(Entity player, Entity inflictor, Entity attacker, int damage, string mod, string weapon, Vector3 dir, string hitLoc) { if (mod == "MOD_HEAD_SHOT") { player.Call("detachall"); } PerkCola.ResetPerkCola(player); if (attacker == null || !attacker.IsPlayer || attacker.GetTeam() == player.GetTeam()) { return; } if (attacker.GetTeam() == "allies") { if (player.GetField <int>("rtd_flag") == 1) { if (Call <int>("getdvarint", "bonus_double_points") == 1) { attacker.WinCash(400); } else { attacker.WinCash(200); } } else if (player.GetField <int>("rtd_king") == 1) { if (Call <int>("getdvarint", "bonus_double_points") == 1) { attacker.WinCash(1000); } else { attacker.WinCash(500); } } else { if (Call <int>("getdvarint", "bonus_double_points") == 1) { attacker.WinCash(200); } else { attacker.WinCash(100); } } attacker.WinPoint(1); if (player.GetField <int>("zombie_incantation") == 1) { attacker.Health = 1000; AfterDelay(100, () => { attacker.RadiusExploed(player.Origin); player.GamblerText("Incantation!", new Vector3(0, 0, 0), new Vector3(1, 1, 1), 1, 0); }); AfterDelay(200, () => attacker.Health = attacker.GetField <int>("maxhealth")); } } else { if (player.GetField <int>("incantation") == 1) { attacker.Health = 1000; AfterDelay(100, () => { attacker.RadiusExploed(player.Origin); player.GamblerText("Incantation!", new Vector3(0, 0, 0), new Vector3(1, 1, 1), 1, 0); }); AfterDelay(200, () => attacker.Health = attacker.GetField <int>("maxhealth")); } } }
public static void GivePerkCola(Entity player, PerkCola perk) { player.SetField("aiz_perks", player.GetField <int>("aiz_perks") + 1); player.GetField <List <HudElem> >("aiz_perkhuds").Add(ShowPerkHud(player, perk)); switch (perk.Type) { case QUICK_REVIVE: player.SetField("perk_revive", 1); break; case SPEED_COLA: player.SetField("perk_speedcola", 1); player.SetPerk("specialty_fastreload", true, false); player.SetPerk("specialty_quickswap", true, false); player.SetPerk("specialty_quickdraw", true, false); break; case JUGGERNOG: player.SetField("perk_juggernog", 1); player.SetField("oldmodel", player.GetField <string>("model")); player.Call("setmodel", "mp_fullbody_ally_juggernaut"); player.Call("setviewmodel", "viewhands_juggernaut_ally"); player.SetField("maxhealth", 300); player.Health = 300; break; case STAMIN_UP: player.SetField("perk_staminup", 1); player.SetField("speed", 1.3f); player.SetPerk("specialty_marathon", true, false); player.SetPerk("specialty_lightweight", true, false); player.SetPerk("specialty_fastsprintrecovery", true, false); break; case MULE_KICK: player.SetField("perk_mulekick", 1); player.GiveWeapon(Sharpshooter._mulekickWeapon.Code); player.Call("givemaxammo", Sharpshooter._mulekickWeapon.Code); break; case DOUBLE_TAP: player.SetField("perk_doubletap", 1); player.SetPerk("specialty_moredamage", true, false); player.SetPerk("specialty_bulletdamage", true, false); player.SetPerk("specialty_rof", true, false); break; case DEAD_SHOT: player.SetField("perk_deadshot", 1); PerkFunction.DeadShotThink(player); player.SetPerk("specialty_reducedsway", true, false); player.SetPerk("specialty_bulletaccuracy", true, false); break; case PHD: player.SetField("perk_phd", 1); player.SetPerk("_specialty_blastshield", true, false); break; case ELECTRIC_CHERRY: player.SetField("perk_cherry", 1); break; case WIDOW_S_WINE: player.SetField("perk_widow", 1); player.SetPerk("specialty_fastermelee", true, false); break; case VULTURE_AID: player.SetField("perk_vultrue", 1); player.SetPerk("specialty_scavenger", true, false); break; } }
public static bool HasPerkCola(Entity player, PerkCola perk) { switch (perk.Type) { case QUICK_REVIVE: if (player.GetField <int>("perk_revive") == 1) { return(true); } else { return(false); } case SPEED_COLA: if (player.GetField <int>("perk_speedcola") == 1) { return(true); } else { return(false); } case JUGGERNOG: if (player.GetField <int>("perk_juggernog") == 1) { return(true); } else { return(false); } case STAMIN_UP: if (player.GetField <int>("perk_staminup") == 1) { return(true); } else { return(false); } case MULE_KICK: if (player.GetField <int>("perk_mulekick") == 1) { return(true); } else { return(false); } case DOUBLE_TAP: if (player.GetField <int>("perk_doubletap") == 1) { return(true); } else { return(false); } case DEAD_SHOT: if (player.GetField <int>("perk_deadshot") == 1) { return(true); } else { return(false); } case PHD: if (player.GetField <int>("perk_phd") == 1) { return(true); } else { return(false); } case ELECTRIC_CHERRY: if (player.GetField <int>("perk_cherry") == 1) { return(true); } else { return(false); } case WIDOW_S_WINE: if (player.GetField <int>("perk_widow") == 1) { return(true); } else { return(false); } case VULTURE_AID: if (player.GetField <int>("perk_vultrue") == 1) { return(true); } else { return(false); } default: return(false); } }
/// <summary> /// 给与指定玩家指定的Perk-a-Cola /// </summary> /// <param name="player">指定玩家</param> /// <param name="perk">要给与的Perk-a-Cola的对象</param> public static void GivePerkCola(this Entity player, PerkCola perk) { perk.GiveToPlayer(player); }
private static HudElem ShowPerkHud(Entity player, PerkCola perk) { return(player.PerkHudNoEffect(perk.PerkIcon)); }
public PerkColaMachine(Vector3 origin, Vector3 angle, PerkColaType perk) : base(BoxType.PerkColaMachine, origin, angle, 50) { if (MapEdit.spawnedPerkColas.Contains(perk)) { Dispose(); return; } MapEdit.spawnedPerkColas.Add(perk); PerkCola = new PerkCola(perk); Icon = PerkCola.GetIcon(); ObjectiveId = Hud.CreateObjective(Origin, Icon); Cost = PerkCola.GetCost(); string fullname = PerkCola.GetFullName(); OnTriggerString += player => { if ((player.GetTeam() == "allies" && Utility.GetDvar <int>("allies_fire_sale") == 1) || (player.GetTeam() == "axis" && Utility.GetDvar <int>("axis_fire_sale") == 1)) { return("Press ^3[{+activate}] ^7to buy " + fullname + ". [Cost: ^2$^610^7]"); } return("Press ^3[{+activate}] ^7to buy " + fullname + ". [Cost: ^2$^3" + Cost + "^7]"); }; OnTriggerUse += player => { if (!player.IsAlive) { return; } if ((player.GetTeam() == "allies" && Utility.GetDvar <int>("allies_fire_sale") == 1) || (player.GetTeam() == "axis" && Utility.GetDvar <int>("axis_fire_sale") == 1) && player.GetCash() >= 10) { if (player.PerkColasCount() >= 4) { player.PrintlnBold("^1You already have 4 Perk-a-Cola."); return; } if (player.HasPerkCola(PerkCola)) { player.PrintlnBold("^1You already have " + fullname + "."); return; } player.PayCash(10); player.GivePerkCola(PerkCola); } else if (player.GetCash() >= Cost) { if (player.PerkColasCount() >= 4) { player.PrintlnBold("^1You already have 4 Perk-a-Cola."); return; } if (player.HasPerkCola(PerkCola)) { player.PrintlnBold("^1You already have " + fullname + "."); return; } player.PayCash(Cost); player.GivePerkCola(PerkCola); } else { player.Println("^1Not enough cash for " + fullname + ". Need ^2$^3" + Cost); } }; }