public void OnPlayerJoining(int playerIndex)
 {
     foreach (KeyValuePair <string, int> item in _killCountsByNpcId)
     {
         int npcNetId = ContentSamples.NpcNetIdsByPersistentIds[item.Key];
         NetManager.Instance.SendToClient(NetBestiaryModule.SerializeKillCount(npcNetId, item.Value), playerIndex);
     }
 }
        public void RegisterKill(NPC npc)
        {
            string bestiaryCreditId = npc.GetBestiaryCreditId();

            _killCountsByNpcId.TryGetValue(bestiaryCreditId, out var value);
            value++;
            _killCountsByNpcId[bestiaryCreditId] = Utils.Clamp(value, 0, 9999);
            if (Main.netMode == 2)
            {
                NetManager.Instance.Broadcast(NetBestiaryModule.SerializeKillCount(npc.netID, value));
            }
        }
Esempio n. 3
0
        public void RegisterKill(NPC npc)
        {
            string bestiaryCreditId = npc.GetBestiaryCreditId();
            int    num;

            this._killCountsByNpcId.TryGetValue(bestiaryCreditId, out num);
            int killcount = num + 1;

            this._killCountsByNpcId[bestiaryCreditId] = Utils.Clamp <int>(killcount, 0, 9999);
            if (Main.netMode != 2)
            {
                return;
            }
            NetManager.Instance.Broadcast(NetBestiaryModule.SerializeKillCount(npc.netID, killcount), -1);
        }