/// <summary> /// Calculates and rewards a players for a bot kill /// </summary> static public void calculateBotKillRewards(Bots.Bot victim, Player killer) { CfgInfo cfg = killer._server._zoneConfig; int killerCash = 0; int killerExp = 0; int killerPoints = 0; int killerBounty = 0; killerCash = (int)cfg.bot.cashKillReward; killerExp = (int)cfg.bot.expKillReward; killerPoints = (int)cfg.bot.pointsKillReward; killerBounty = (int)cfg.bot.fixedBountyToKiller; //Update his stats killer.Cash += killerCash; killer.Experience += killerExp; killer.KillPoints += killerPoints; killer.Bounty += killerBounty; //Inform the killer.. killer.triggerMessage(1, 500, String.Format("{0} killed by {1} (Cash={2} Exp={3} Points={4})", victim._type.Name, killer._alias, killerCash, killerExp, killerPoints)); //Sync his state killer.syncState(); //Check for players in the share radius List <Player> sharedRewards = victim._arena.getPlayersInRange(victim._state.positionX, victim._state.positionY, cfg.bot.shareRadius); Dictionary <int, int> cashRewards = new Dictionary <int, int>(); Dictionary <int, int> expRewards = new Dictionary <int, int>(); Dictionary <int, int> pointRewards = new Dictionary <int, int>(); foreach (Player p in sharedRewards) { if (p == killer || p._team != killer._team) { continue; } cashRewards[p._id] = (int)((((float)killerCash) / 1000) * cfg.bot.sharePercent); expRewards[p._id] = (int)((((float)killerExp) / 1000) * cfg.bot.sharePercent); pointRewards[p._id] = (int)((((float)killerPoints) / 1000) * cfg.bot.sharePercent); } //Send reward notices to our lucky witnesses List <int> sentTo = new List <int>(); foreach (Player p in sharedRewards) { if (p == killer || p._team != killer._team) { continue; } //Let em know p.triggerMessage(5, 500, String.Format("{0} killed by {1} (Cash={2} Exp={3} Points={4})", victim._type.Name, killer._alias, cashRewards[p._id], expRewards[p._id], pointRewards[p._id])); p.Cash += cashRewards[p._id]; p.Experience += expRewards[p._id]; p.AssistPoints += pointRewards[p._id]; //Sync their state p.syncState(); sentTo.Add(p._id); } //Route the kill to the rest of the arena foreach (Player p in victim._arena.Players) { //As long as we haven't already declared it, send if (p == null) { continue; } if (p == killer) { continue; } if (sentTo.Contains(p._id)) { continue; } //Let them know p.triggerMessage(1, 500, String.Format("{0} killed by {1} (Cash={2} Exp={3} Points={4})", victim._type.Name, killer._alias, killerCash, killerExp, killerPoints)); } }
/// <summary> /// Calculates and rewards a players for a bot kill /// </summary> static public void calculateBotKillRewards(Bots.Bot victim, Player killer, Settings.GameTypes gameType) { CfgInfo cfg = killer._server._zoneConfig; int killerCash = 0; int killerExp = 0; int killerPoints = 0; int killerBounty = 0; int victimBounty = 0; int killerBountyIncrease = 0; BotSettings settings = victim.Settings(); if (settings != null) { /* * killerCash = settings.Cash; * killerBounty = settings.Bounty; * killerExp = settings.Experience; * killerPoints = settings.Points; */ killerBounty = Convert.ToInt32(((double)killer.Bounty / 100) * Settings.c_percentOfOwn); //We are now using base reward of 25 + 3% of current bounty killerPoints = Convert.ToInt32((settings.Points) + (killerBounty * Settings.c_pointMultiplier)); killerCash = Convert.ToInt32((settings.Cash) + (killerBounty * Settings.c_cashMultiplier)); killerExp = Convert.ToInt32((settings.Experience) + (killerBounty * Settings.c_expMultiplier)); victimBounty = settings.Bounty; killerBountyIncrease = 0; } else { /* Old fixed Bot Rewards from CFG * killerCash = (int)cfg.bot.cashKillReward; * killerExp = (int)cfg.bot.expKillReward; * killerPoints = (int)cfg.bot.pointsKillReward; * killerBounty = (int)cfg.bot.fixedBountyToKiller; */ killerBounty = Convert.ToInt32(((double)killer.Bounty / 100) * Settings.c_percentOfOwn); //We are now using base reward of 25 + 3% of current bounty killerPoints = Convert.ToInt32(((int)cfg.bot.pointsKillReward) + (killerBounty * Settings.c_pointMultiplier)); killerCash = Convert.ToInt32(((int)cfg.bot.cashKillReward) + (killerBounty * Settings.c_cashMultiplier)); killerExp = Convert.ToInt32(((int)cfg.bot.expKillReward) + (killerBounty * Settings.c_expMultiplier)); victimBounty = (int)cfg.bot.fixedBountyToKiller; killerBountyIncrease = 0; } //Update his stats killerCash = addCash(killer, killerCash, gameType); killer.Experience += killerExp; killer.KillPoints += killerPoints; //killer.Bounty += killerBounty; killer.Bounty += (killerBountyIncrease + victimBounty); //Inform the killer.. killer.triggerMessage(1, 500, String.Format("{0} killed by {1} (Cash={2} Exp={3} Points={4})", victim._type.Name, killer._alias, killerCash, killerExp, killerPoints)); //Sync his state killer.syncState(); //Check for players in the share radius List <Player> sharedRewards = victim._arena.getPlayersInRange(killer._state.positionX, killer._state.positionY, cfg.bot.shareRadius); Dictionary <Player, int> cashRewards = new Dictionary <Player, int>(); Dictionary <Player, int> expRewards = new Dictionary <Player, int>(); Dictionary <Player, int> pointRewards = new Dictionary <Player, int>(); double sharePercent = (double)(cfg.bot.sharePercent / 100); foreach (Player p in sharedRewards) { if (p == killer || p._team != killer._team) { continue; } cashRewards[p] = Convert.ToInt32(((double)killerCash / 100) * 33); expRewards[p] = Convert.ToInt32(((double)killerCash / 100) * 33); pointRewards[p] = Convert.ToInt32(((double)killerCash / 100) * 33); } //Send reward notices to our lucky witnesses List <int> sentTo = new List <int>(); foreach (Player p in sharedRewards) { if (p == killer || p._team != killer._team) { continue; } cashRewards[p] = addCash(p, cashRewards[p], gameType); p.Experience += expRewards[p]; p.AssistPoints += pointRewards[p]; //Let em know p.triggerMessage(4, 500, String.Format("{0} killed by {1} (Cash={2} Exp={3} Points={4})", victim._type.Name, killer._alias, cashRewards[p], expRewards[p], pointRewards[p])); //Sync their state p.syncState(); sentTo.Add(p._id); } //Route the kill to the rest of the arena foreach (Player p in victim._arena.Players) { //As long as we haven't already declared it, send if (p == null) { continue; } if (p == killer) { continue; } if (sentTo.Contains(p._id)) { continue; } //Adjust our color accordingly.. byte color = 0; if (victim._team == p._team) { color = 4; } //Let them know p.triggerMessage(color, 500, String.Format("{0} killed by {1}", victim._type.Name, killer._alias)); } }