// Fixed cloud PPI sync public void ServerAddScoreForZoneControl(ZoneControlFlag.E_ZoneControlEvent zoneEvent, uLink.NetworkPlayer player) { #if !DEADZONE_CLIENT PlayerPersistantInfo ppi = PPIManager.Instance.GetPPI(player); switch (zoneEvent) { case ZoneControlFlag.E_ZoneControlEvent.Attacked: ppi.AddScore(GameplayRewards.ZC.FlagDefend); ppi.AddExperience(GameplayRewards.ZC.FlagDefend, E_AddMoneyAction.ZoneControl); Server.Instance.ShowCombatMsgOnClient(ppi.Player, Client.E_MessageType.ZoneAttacked, GameplayRewards.ZC.FlagDefend, (short)(GameplayRewards.ZC.FlagDefend * GameplayRewards.MoneyModificator)); break; case ZoneControlFlag.E_ZoneControlEvent.Defend: ppi.AddScore(GameplayRewards.ZC.FlagDefend); ppi.AddExperience(GameplayRewards.ZC.FlagDefend, E_AddMoneyAction.ZoneControl); Server.Instance.ShowCombatMsgOnClient(ppi.Player, Client.E_MessageType.ZoneDefended, GameplayRewards.ZC.FlagDefend, (short)(GameplayRewards.ZC.FlagDefend * GameplayRewards.MoneyModificator)); break; case ZoneControlFlag.E_ZoneControlEvent.FlagNeutral: ppi.AddScore(GameplayRewards.ZC.FlagNeutral); ppi.AddExperience(GameplayRewards.ZC.FlagNeutral, E_AddMoneyAction.ZoneControl); Server.Instance.ShowCombatMsgOnClient(ppi.Player, Client.E_MessageType.ZoneNeutral, GameplayRewards.ZC.FlagNeutral, (short)(GameplayRewards.ZC.FlagNeutral * GameplayRewards.MoneyModificator)); break; case ZoneControlFlag.E_ZoneControlEvent.Owned: ppi.AddScore(GameplayRewards.ZC.FlagOwned); ppi.AddExperience(GameplayRewards.ZC.FlagOwned, E_AddMoneyAction.ZoneControl); Server.Instance.ShowCombatMsgOnClient(ppi.Player, Client.E_MessageType.ZoneControl, GameplayRewards.ZC.FlagOwned, (short)(GameplayRewards.ZC.FlagOwned * GameplayRewards.MoneyModificator)); break; } SortDescending(); SynchronizeScore(ppi); #endif }
public void ServerAddScoreForSpiderKill(uLink.NetworkPlayer player) { #if !DEADZONE_CLIENT PlayerPersistantInfo ppi = PPIManager.Instance.GetPPI(player); ppi.AddScore(GameplayRewards.SpiderKill); ppi.AddExperience(GameplayRewards.SpiderKill, E_AddMoneyAction.KillSpider); Server.Instance.ShowCombatMsgOnClient(ppi.Player, Client.E_MessageType.Spider, GameplayRewards.SpiderKill, (short)(GameplayRewards.SpiderKill * GameplayRewards.MoneyModificator)); SortDescending(); SynchronizeScore(ppi); #endif }
public void ServerAddScoreForMineKill(uLink.NetworkPlayer player) { #if !DEADZONE_CLIENT PlayerPersistantInfo ppi = PPIManager.Instance.GetPPI(player); ppi.AddScore(GameplayRewards.MineKill); //TODO I added the E_AddMoneyAction.KillMine enumerator but I'm not sure if it is supported on the Kontangent side. On the other side - //the E_AddMoneyAction do not interact with clients at all - thus such modification should be safe. ppi.AddExperience(GameplayRewards.MineKill, E_AddMoneyAction.KillMine); //FIXME The message type should be E_MessageType.Mine but there is no such message on the current clients at the moment //(and it is unclear if we are ever going to update clients) - thus we have to use what we already have supported on the client side. Server.Instance.ShowCombatMsgOnClient(ppi.Player, Client.E_MessageType.Turret, GameplayRewards.MineKill, (short)(GameplayRewards.MineKill * GameplayRewards.MoneyModificator)); SortDescending(); SynchronizeScore(ppi); #endif }
public void ServerAddScoreForTurretKill(uLink.NetworkPlayer player, int extraGold) { #if !DEADZONE_CLIENT PlayerPersistantInfo ppi = PPIManager.Instance.GetPPI(player); ppi.AddScore(GameplayRewards.TurretKill); ppi.AddExperience(GameplayRewards.TurretKill, E_AddMoneyAction.KillSentry); ppi.AddGoldFromGameplay(extraGold); Server.Instance.ShowCombatMsgOnClient(ppi.Player, Client.E_MessageType.Turret, GameplayRewards.TurretKill, (short)(GameplayRewards.TurretKill * GameplayRewards.MoneyModificator)); if (extraGold > 0) { Server.Instance.ShowGoldMsgOnClient(player, (short)extraGold); } SortDescending(); SynchronizeScore(ppi); #endif }
public void ServerAddScoreForKill(uLink.NetworkPlayer victim, uLink.NetworkPlayer killer, List <BlackBoard.DamageData> damageData, E_BodyPart bodyPart, int extraGold) { #if !DEADZONE_CLIENT PlayerPersistantInfo victimPPI = PPIManager.Instance.GetPPI(victim); PlayerPersistantInfo killerPPI = PPIManager.Instance.GetPPI(killer); if (killer != victim) { victimPPI.Score.Deaths++; // check this!!!! SynchronizeScore(victimPPI); killerPPI.Score.Kills++; // check this!!!! killerPPI.AddGoldFromGameplay(extraGold); Server.Instance.ShowMessageOnClients(killerPPI.NameForGui + " " + TextDatabase.instance[MPMessages.Kill] + " " + victimPPI.NameForGui); DistributeKills(victim, killer, bodyPart); if (extraGold > 0) { Server.Instance.ShowGoldMsgOnClient(killerPPI.Player, (short)extraGold); } } else { killerPPI.Score.Deaths++; // check this!!!! killerPPI.AddScore(GameplayRewards.Suicide); Server.Instance.ShowMessageOnClients(killerPPI.NameForGui + " " + TextDatabase.instance[MPMessages.Suicide]); SynchronizeScore(killerPPI); } ServerSetState(victim, PlayerPersistantInfo.E_State.Connected, true); SortDescending(); #endif }
void DistributeKills(uLink.NetworkPlayer victim, uLink.NetworkPlayer killer, E_BodyPart bodyPart) { ComponentPlayer p = Player.GetPlayer(victim); float left = p.Owner.BlackBoard.RealMaxHealth; Dictionary <uLink.NetworkPlayer, float> killers = new Dictionary <uLink.NetworkPlayer, float>(); foreach (BlackBoard.DamageData data in p.Owner.BlackBoard.AttackersDamageData) { float damage = Mathf.Min(left, data.Damage); if (Player.GetPlayer(data.Attacker) == null) //player is fadeout , f**k him.. or it cause crash in hud on client { continue; } if (killers.ContainsKey(data.Attacker)) { killers[data.Attacker] += damage; } else { killers.Add(data.Attacker, damage); } left -= damage; if (left <= 0) { break; } } //PlayerPersistantInfo victimPPI = PPIManager.Instance.GetPPI(victim); foreach (KeyValuePair <uLink.NetworkPlayer, float> pair in killers) { PlayerPersistantInfo killerPPI = PPIManager.Instance.GetPPI(pair.Key); if (killerPPI == null) { continue; // one of the killers could disconnect } float percent = pair.Value / p.Owner.BlackBoard.RealMaxHealth; if (pair.Key == killer) { percent = 1.0f; } else if (percent < 0.1f) { percent = 0.1f; } else if (percent > 0.6f) { percent = 0.6f; } int score = Mathf.FloorToInt(GameplayRewards.Kill * percent); if (killer == pair.Key) { Server.Instance.ShowCombatMsgOnClient(killerPPI.Player, Client.E_MessageType.Kill, (short)score, (short)(score * GameplayRewards.MoneyModificator)); if (bodyPart == E_BodyPart.Head) { Server.Instance.ShowCombatMsgOnClient(killerPPI.Player, Client.E_MessageType.HeadShot, GameplayRewards.HeadShot, (short)(GameplayRewards.HeadShot * GameplayRewards.MoneyModificator)); score += GameplayRewards.HeadShot; } } else { Server.Instance.ShowCombatMsgOnClient(killerPPI.Player, Client.E_MessageType.KillAssist, (short)score, (short)(score * GameplayRewards.MoneyModificator)); } killerPPI.AddScore(score); if (Server.Instance.GameInfo.GameType == E_MPGameType.DeathMatch) { killerPPI.AddExperience(score, E_AddMoneyAction.KillDM); } else { killerPPI.AddExperience(score, E_AddMoneyAction.KillZC); } SynchronizeScore(killerPPI); } }