Ejemplo n.º 1
0
    public void ServerSendAllPPItoPlayer(uLink.NetworkPlayer player)
    {
#if !DEADZONE_CLIENT
        foreach (PlayerPersistantInfo ppi in PPIs)
        {
            NetworkView.RPC("ClientAddPPI", player, ppi);
        }
#endif
    }
Ejemplo n.º 2
0
        private void IOnPlayerInput(uLink.NetworkPlayer player, InputControls input)
        {
            PlayerSession session = Player.Find(player);

            if (session != null)
            {
                Interface.CallHook("OnPlayerInput", session, input);
            }
        }
Ejemplo n.º 3
0
    public void ServerSetState(uLink.NetworkPlayer player, PlayerPersistantInfo.E_State state, bool Synchronize)
    {
#if !DEADZONE_CLIENT
        PlayerPersistantInfo ppi = GetPPI(player);
        ppi.State = state;

        Server.Printf("PPI " + ppi.Name + " " + state);
        NetworkView.RPC("SynchronizeStatePlayer", uLink.RPCMode.Others, player, state);
#endif
    }
Ejemplo n.º 4
0
    void SynchronizeStatePlayer(uLink.NetworkPlayer player, PlayerPersistantInfo.E_State state)
    {
        PlayerPersistantInfo ppi = GetPPI(player);

        ppi.State = state;

        if (LocalPPI.Player == player)
        {
            LocalPPI.State = state;
        }
    }
Ejemplo n.º 5
0
    // we don't want to let server to fetch local ppi
    // it will be done later after round results display
    public void ClientNotifyPPIChange(uLink.NetworkPlayer player)
    {
        if (uLink.Network.isServer == false)
        {
            throw new uLink.NetworkException("PPIManager::ClientNotifyPPIChange : could be called only on server");
        }

        if (player.isConnected == true)
        {
            NetworkView.RPC("FetchPPIFromCloud", player);
        }
    }
Ejemplo n.º 6
0
    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
    }
Ejemplo n.º 7
0
    void ClientUpdateTeam(uLink.NetworkPlayer player, E_Team team)
    {
        if (uLink.Network.isClient == false)
        {
            throw new uLink.NetworkException("PPIManager::ClientUpdateTeam: could be called only on client");
        }

        int index = PPIs.FindIndex(ps => ps.Player == player);

        if (index == -1)
        {
            throw new uLink.NetworkException("PPIManager::ClientUpdateTeam ppi is NOT in the list");
        }

        PPIs[index].Team = team;

        UpdateTeamLocalPPI(PPIs[index]);
    }
Ejemplo n.º 8
0
    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
    }
Ejemplo n.º 9
0
    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
    }
Ejemplo n.º 10
0
    public void ClientRemovePPI(uLink.NetworkPlayer player)
    {
        if (uLink.Network.isClient == false)
        {
            throw new uLink.NetworkException("PPIManager::AddPPI : could be called only on server");
        }

        int index = PPIs.FindIndex(ps => ps.Player == player);

        if (index == -1)
        {
            throw new uLink.NetworkException("PPIManager::AddPPI ppi is NOT in the list");
        }

        Client.Printf("client remove ppi " + PPIs[index].Name + " " + PPIs[index].Team);

        Client.Instance.ConsoleMsg(PPIs[index].NameForGui + " " + TextDatabase.instance[0500001]);

        PPIs.RemoveAt(index);
    }
Ejemplo n.º 11
0
    public void ServerRemovePPI(uLink.NetworkPlayer player)
    {
#if !DEADZONE_CLIENT
        if (uLink.Network.isServer == false)
        {
            throw new uLink.NetworkException("PPIManager::AddPPI : could be called only on server");
        }

        int index = PPIs.FindIndex(ps => ps.Player == player);

        if (index == -1)
        {
            throw new uLink.NetworkException("PPIManager::AddPPI ppi is NOT in the list");
        }

        Server.Printf("Server remove ppi " + PPIs[index].Name + " " + PPIs[index].Team);
        PPIs.RemoveAt(index);

        NetworkView.RPC("ClientRemovePPI", uLink.RPCMode.Others, player);
#endif
    }
Ejemplo n.º 12
0
    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
    }
Ejemplo n.º 13
0
        private object ICanCraft(uLink.NetworkPlayer player, ICraftable recipe)
        {
            PlayerSession session = Player.Find(player);

            return(Interface.CallHook("CanCraft", session, recipe));
        }
Ejemplo n.º 14
0
    // 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
    }
Ejemplo n.º 15
0
 private void ICanCraftInitialize(Crafter crafter, uLink.NetworkPlayer networkPlayer)
 {
     crafter.NetworkPlayer = networkPlayer;
 }
Ejemplo n.º 16
0
        private object IOnPlayerClaimedTerritory(uLink.NetworkPlayer player, Clan clan, float territory)
        {
            PlayerSession session = Player.Find(player);

            return(Interface.CallHook("OnPlayerClaimedTerritory", session, clan, territory));
        }
Ejemplo n.º 17
0
    void SynchroScoreOnClient(uLink.NetworkPlayer player, PPIRoundScore score)
    {
        PlayerPersistantInfo p = PPIManager.Instance.GetPPI(player);

        p.Score.Update(score);
    }
Ejemplo n.º 18
0
        private object IOnPlayerVoice(uLink.NetworkPlayer player)
        {
            PlayerSession session = Player.Find(player);

            return(session != null?Interface.CallHook("OnPlayerVoice", session) : null);
        }
Ejemplo n.º 19
0
 /// <summary>
 /// Gets the player session using a uLink.NetworkPlayer
 /// </summary>
 /// <param name="player"></param>
 /// <returns></returns>
 public PlayerSession Session(uLink.NetworkPlayer player) => GameManager.GetSession(player);
Ejemplo n.º 20
0
        private void IOnExitVehicle(uLink.NetworkPlayer player, VehiclePassenger vehicle)
        {
            PlayerSession session = Player.Find(player);

            Interface.CallHook("OnExitVehicle", session, vehicle);
        }
Ejemplo n.º 21
0
    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);
        }
    }
Ejemplo n.º 22
0
 /// <summary>
 /// Gets the player session using a uLink.NetworkPlayer
 /// </summary>
 /// <param name="player"></param>
 /// <returns></returns>
 public PlayerSession FindSessionByNetPlayer(uLink.NetworkPlayer player) => GameManager.Instance.GetSession(player);
Ejemplo n.º 23
0
 public PlayerPersistantInfo GetPPI(uLink.NetworkPlayer player)
 {
     return(PPIs.Find(ps => ps.Player == player));
 }