public static void onComputerKill(HQ hq, Computer killer, Player victim) { int bountyReward = victim._bounty; //Always give them some kind of reward.. if (bountyReward < Script_LaserTag.baseBountyPerKill) { bountyReward = Script_LaserTag.baseBountyPerKill / 2; } hq.bounty += bountyReward; }
public static void onPlayerKill(HQ hq, Player killer, Player victim) { int bountyReward = (killer._bounty + victim._bounty) + Script_LaserTag.baseBountyPerKill; //Always give them some kind of reward.. if (bountyReward < Script_LaserTag.baseBountyPerKill) { bountyReward = Script_LaserTag.baseBountyPerKill; } hq.bounty += bountyReward; killer.sendMessage(0, String.Format("~[HQ] - Kill! - Your HQ has been rewarded {0} bounty points for your kill", bountyReward)); }
public static void onVehicleKill(HQ hq, Player killer, Vehicle victim) { //Vehicles use max hitpoints for determining size of bounty reward.. int bountyReward = (int)(victim._type.Hitpoints * Script_LaserTag.vehicleKillMultiply); //Always give them some kind of reward.. if (bountyReward < Script_LaserTag.baseBountyPerKill) { bountyReward = Script_LaserTag.baseBountyPerKill; } hq.bounty += bountyReward; killer.sendMessage(0, String.Format("~[HQ] - Kill! - Your HQ has been rewarded {0} bounty points for your vehicle kill", bountyReward)); }
public static void periodicReward(HQ hq) { int cash = (Script_LaserTag.baseCash * hq.level); int points = (Script_LaserTag.basePoints * hq.level); int experience = (Script_LaserTag.baseExp * hq.level); hq.team.sendArenaMessage ((String.Format("~[HQ] - Reward=(Cash={0}) (Experience={1}) (Points={2})", cash, experience, points))); foreach (Player player in hq.team.ActivePlayers) { player.Cash += cash; player.Experience += experience; } }
public bool playerComputerKill(Player victim, Computer computer) { if (_hqs.Keys.Contains(computer._team)) { //Smaller range for Computers List <Vehicle> hqsInRange = _arena.getVehiclesInRange(computer._state.positionX, computer._state.positionY, 1000); //Is it in range? if (hqsInRange.Contains(_hqs[computer._team].vehicle)) { HQ headq = _hqs[computer._team]; Events.onComputerKill(headq, computer, victim); } } return(true); }
public bool playerChatCommand(Player player, Player recipient, string command, string payload) { if (command.ToLower() == "hqlist") { foreach (HQ hq in _hqs.Values) { player.sendMessage(0, String.Format("[HQ] (Team={0} Bounty={1} Location={2})", hq.team._name, hq.bounty, Helpers.posToLetterCoord(hq.vehicle._state.positionX, hq.vehicle._state.positionY))); } } else if (command.ToLower() == "hq") { if (!_hqs.Keys.Contains(player._team)) { player.sendMessage(-1, "No Headquarters"); return(false); } HQ hq = _hqs[player._team]; player.sendMessage(0, "~[HQ] - Information!"); player.sendMessage(0, String.Format("[HQ] - Level: {0}", hq.level)); player.sendMessage(0, String.Format("[HQ] - Next Level: {0}", hq.nextLvl)); player.sendMessage(0, String.Format("[HQ] - Total Bounty: {0}", hq.bounty)); player.sendMessage(0, String.Format("[HQ] - Location: {0}", Helpers.posToLetterCoord(hq.vehicle._state.positionX, hq.vehicle._state.positionY))); } else if (command.ToLower() == "bounty") { if (player.PermissionLevel > 0) { if (_hqs.ContainsKey(player._team)) { _hqs[player._team].bounty += Int32.Parse(payload); } } } return(true); }
public bool playerPlayerKill(Player victim, Player killer) { //Flag Kill double bty test... foreach (Arena.FlagState fs in _arena._flags.Values) { if (fs.carrier == killer) { //Double killer's bty killer._bounty *= 2; } } if (_hqs.Keys.Contains(killer._team)) { HQ headq = _hqs[killer._team]; List <Vehicle> inRange = _arena.getVehiclesInRange( killer._state.positionX, killer._state.positionY, killRadius); //Blasphemy! if (killer._team == victim._team) { return(false); } //Is it in range? if (inRange.Contains(headq.vehicle)) { Events.onPlayerKill(headq, killer, victim); return(true); } //Pylon? if (headq.pylon != null && inRange.Contains(headq.pylon)) { Events.onPlayerKill(headq, killer, victim); return(true); } } return(true); }
public static void onHQDeath(HQ hq, Player killer) { string format = "*[HQ] - Destroyed! - {0}'s headquarters worth {1} bounty was destroyed by {2}"; killer._arena.sendArenaMessage(String.Format(format, hq.team._name, hq.bounty, killer._team._name)); //Do we reward them with cash or bounty? if (Script_LaserTag._hqs.ContainsKey(killer._team)) { HQ headQ = Script_LaserTag._hqs[killer._team]; //Alert them killer._team.sendArenaMessage( String.Format( "[HQ] - Reward! - Your Headquarters has been awarded {0} bounty for the destruction of {1}'s Headquarters", hq.bounty, hq.team._name)); //Reward their HQ instead! headQ.bounty += hq.bounty; return; } //Calculate rewards int cashReward = (int)(hq.bounty * Script_LaserTag.cashMultiplier) * Script_LaserTag.doubleXP; int expReward = (int)(hq.bounty * Script_LaserTag.expMultipler) * Script_LaserTag.doubleXP; int pointReward = (int)(hq.bounty * Script_LaserTag.pointMultiplier) * Script_LaserTag.doubleXP; //Loop through a reward! foreach (Player player in killer._team.ActivePlayers) { string rewardFormat = "~[HQ] - Reward! - Your personal reward for the destruction of {0}'s HQ:"; player.sendMessage(0, String.Format(rewardFormat, hq.team._name)); player.sendMessage(0, String.Format("(Cash={0} Experience={1} Points={2})", cashReward, expReward, pointReward)); player.Cash += cashReward; player.Experience += expReward; } }
public bool vehicleCreation(Vehicle created, Team team, Player creator) { //If either team's headquarter is created... if ((created._type.Id == teamOne.hqVehId) || (created._type.Id == teamTwo.hqVehId)) { //Already have one? if (_hqs.Keys.Contains(team)) { //Destroy it created.destroy(false, true); return(false); } //No else { //Create it HQ newHQ = new HQ(created); _hqs.Add(team, newHQ); } } return(true); }
public static void onHQLevelUp(HQ hq) { string format = "*[HQ] - Level Up! Your Headquarters is now level {0} and is worth {1} bounty. (Next level requires {2} Bounty)"; hq.level++; //Multiples of 10? (For humps) bool isMultiple = hq.level % 10 == 0; if (isMultiple) { hq.nextLvl = (int)(hq.nextLvl + (Script_LaserTag.baseBounty * (hq.level / Script_LaserTag.baseMultiplier)) + Script_LaserTag.levelHump); } else { hq.nextLvl = (int)(hq.nextLvl + (Script_LaserTag.baseBounty * (hq.level / Script_LaserTag.baseMultiplier))); } hq.team.sendArenaMessage(String.Format(format, hq.level, hq.bounty, hq.nextLvl)); hq.maxHealth += 10; hq.vehicle._state.health = (short)hq.maxHealth; hq.vehicle.update(false); }
public bool vehicleDeath(Vehicle dead, Player killer) { //If either team's headquarter dies... if (dead._type.Id == teamOne.hqVehId || dead._type.Id == teamTwo.hqVehId) { //Which team's hq? if (_hqs.Keys.Contains(dead._team)) { HQ headQ = _hqs[dead._team]; //If the killer isn't on the same team as the destroyed HQ if (headQ.team != killer._team) { //Carry on with HQ death event Events.onHQDeath(headQ, killer); //Winner! gameVictory(killer._team); } //Otherwise it's team kill else { _arena.sendArenaMessage( String.Format("~[HQ] - Oops! - Team {0} has destroyed their own headquarters!", headQ.team._name)); //Opposite team wins! if (headQ.team == teamOne.team) { gameVictory(teamTwo.team); } else { gameVictory(teamOne.team); } } _hqs.Remove(dead._team); } } //Pylon? else if (dead._type.Id == 480) { if (_hqs.Keys.Contains(dead._team)) { HQ headQ = _hqs[dead._team]; headQ.pylon = null; } } //Car? if (dead._type.Type == VehInfo.Types.Car) { /*[3:05:51 PM]* Exception whilst polling arena Public1: * System.NullReferenceException: Object reference not set to an instance of an object. * at InfServer.Script.GameType_HQ.Script_HQ.vehicleDeath(Vehicle dead, Player killer) in c:\Infantry\Zones\Combined Arms\scripts\GameTypes\HQ\Headquarters.cs:line 518 * added if(killer != null) */ try { if (killer != null && _hqs != null) { if (_hqs.Keys.Contains(killer._team)) { HQ headq = _hqs[killer._team]; List <Vehicle> inRange = _arena.getVehiclesInRange( killer._state.positionX, killer._state.positionY, killRadius); //Blasphemy! if (killer._team == dead._team) { return(false); } //Is it in range? if (inRange.Contains(headq.vehicle)) { Events.onVehicleKill(headq, killer, dead); return(true); } //Pylon? if (headq.pylon != null && inRange.Contains(headq.pylon)) { Events.onVehicleKill(headq, killer, dead); return(true); } } } } catch (Exception e) { Log.write(TLog.Warning, "hq or killer do not exist" + e); } } return(true); }
public static void newHQ(HQ hq) { hq.team._arena.sendArenaMessage (String.Format("*[HQ] - {0} has established a headquarters in the {1} sector.", hq.team._name, Helpers.posToLetterCoord(hq.vehicle._state.positionX, hq.vehicle._state.positionY))); }