public void OnZoneTrespass(CPlayerInfo cpiSoldier, ZoneAction action, MapZone sender, Point3D pntTresspassLocation, float flTresspassPercentage) {

        }
Exemple #2
0
        public override void OnPlayerLeft(CPlayerInfo cpiPlayer)
        {
            // EVENT EXCEPTION BLOCK:
            try
            {
            WriteDebugInfo("ProconRulz: ********************OnPlayerLeft******************************" +
                cpiPlayer.SoldierName);

            scan_rules(TriggerEnum.Leave, cpiPlayer.SoldierName,
                new Dictionary<SubstEnum, string>(), null, null, null);
            if (trace_rules == enumBoolYesNo.Yes) prdebug("counts");

            //Removes left player from all lists
            players.remove(cpiPlayer.SoldierName);

            spawn_counts.zero_player(cpiPlayer.SoldierName);
            admins_remove(cpiPlayer.SoldierName);
            }
            catch (Exception ex)
            {
                WriteConsole("ProconRulz: recoverable exception in OnPlayerLeft");
                PrintException(ex);
            }
        }
Exemple #3
0
 private void queuePlayerForForceMove(CPlayerInfo player)
 {
     if (this.isEnabled)
     {
         this.DebugWrite("Preparing to queue player for teamswap", 6);
         lock (teamswapMutex)
         {
             this.teamswapForceMoveQueue.Enqueue(player);
             this.teamswapHandle.Set();
             this.DebugWrite("Player queued for teamswap", 6);
         }
     }
 }
Exemple #4
0
            public void updateInfo(CPlayerInfo inf) {
                /* don't update the information while round is begining */
                if (plugin.round_balancer)
                    return;

                if (plugin.live_balancer)
                    return;


                if (info.Score != inf.Score)
                    updateLastScore();

                info = inf;

                round_stats.kills = info.Kills;
                round_stats.deaths = info.Deaths;
                round_stats.score = info.Score;
            }
Exemple #5
0
 private void MapGeometry_MapZoneTrespassed(CPlayerInfo cpiSoldier, ZoneAction action, MapZone sender, Point3D pntTresspassLocation, float flTresspassPercentage, object trespassState) {
     InvokeOnAllEnabled("OnZoneTrespass", new[] {cpiSoldier, action, sender, pntTresspassLocation, flTresspassPercentage, trespassState});
 }
        //public override void OnPlayerJoin(String soldierName) { }
        public override void OnPlayerLeft(CPlayerInfo playerInfo)
        {
            if (!fIsEnabled) return;

            DebugWrite("^9^bGot OnPlayerLeft:^n " + playerInfo.SoldierName, 8);

            try {
            if (IsKnownPlayer(playerInfo.SoldierName)) {
            CheckRageQuit(playerInfo.SoldierName);
            ValidateMove(playerInfo.SoldierName);
            RemovePlayer(playerInfo.SoldierName);
            }

            DebugWrite("Player left: ^b" + playerInfo.SoldierName, 4);
            } catch (Exception e) {
            ConsoleException(e);
            }
        }
Exemple #7
0
 private PlayerProfile getPlayerProfile(CPlayerInfo info) {
     return getPlayerProfile(info.SoldierName);
 }
Exemple #8
0
 private void m_prcClient_PlayerLeft(FrostbiteClient sender, string playerName, CPlayerInfo cpiPlayer) {
     if (LogJoinLeaving == true) {
         if (cpiPlayer != null) {
             Write(DateTime.UtcNow.ToUniversalTime().AddHours(Client.Game.UtcOffset).ToLocalTime(), String.Format("^1{0}", Client.Language.GetLocalized("uscChatPanel.chkDisplayOnJoinLeaveEvents.Left", string.Format("{0} {1}", cpiPlayer.ClanTag, cpiPlayer.SoldierName))));
         }
         else {
             Write(DateTime.UtcNow.ToUniversalTime().AddHours(Client.Game.UtcOffset).ToLocalTime(), String.Format("^1{0}", Client.Language.GetLocalized("uscChatPanel.chkDisplayOnJoinLeaveEvents.Left", playerName)));
         }
     }
 }
        public override void OnPlayerLeft(CPlayerInfo cpiPlayer) {
        
            this.boolplayerleft = true;
            // int WaitforLevel = 0;

            
            // WaitforLevel = this.TSLevelStartWait.Hours * 3600 + this.TSLevelStartWait.Minutes * 60 + this.TSLevelStartWait.Seconds;
            
            this.DebugInfo("player left: ^0^b" + cpiPlayer.SoldierName + "^n^0 " + this.boolLevelStart.ToString());

            // if (this.boolLevelStart == true)
            // {        
                // this.ExecuteCommand("procon.protected.send", "admin.listPlayers", "all");
            // } 
            
        string printSoldier = "";
        printSoldier = cpiPlayer.SoldierName.Replace("{", "(");
        printSoldier = printSoldier.Replace("}", ")");
        
        if (this.dicPlayerCache.ContainsKey(cpiPlayer.SoldierName))
            {
                this.DebugInfo("In PlayerDic. Player Deleted.");
                this.dicPlayerCache.Remove(cpiPlayer.SoldierName);
            }  
        
        int toberomved = -1;
        foreach (KeyValuePair<int, CPlayerScoreInf> kvp in this.dicPlayerScore){
            if (this.dicPlayerScore[kvp.Key].playerName== cpiPlayer.SoldierName){
                toberomved = kvp.Key;
                break;
            }
        }
        if (toberomved > -1){
            this.dicPlayerScore.Remove(toberomved);
        }
        
        this.TSLevelStartWait = DateTime.Now - this.DTLevelStart;
        if (this.boolFirstOP && this.boolLevelStart)
            {
                if (strcurrentGametype != "squaddeathmatch0")
                    {
                        // if ( this.intScoreTeamA > this.intminScore && this.intScoreTeamB > this.intminScore){
                            CompareTeams();
                        // } else {
                            // this.DebugInfo("Not comparing teams. Tickets till Endround: TeamA: " + this.intScoreTeamA + ", TeamB: " + this.intScoreTeamB);
                        // }
                    }
                    else if (strcurrentGametype != "")
                    {
                        if (this.boolgametype == false)
                        {
                            this.boolgametype = true;
                            this.ExecuteCommand("procon.protected.pluginconsole.write", "TrueBalancer:  Still no data or GameMode not supported: " + "I" + strcurrentGametype + "I" );  
                        }
                    }
            }
            else
            {
                this.DebugInfo("Waiting for FirstOP (plyrLeft)");
            } 
        }
 public override void OnPlayerLeft(CPlayerInfo playerInfo)
 {
 }
Exemple #11
0
        private bool HandleResponsePacket(Packet cpBeforePacketDispatch, bool blCancelUpdateEvent, bool blCancelPacket, Packet request = null) {
            if (Game != null) {
                Packet cpRequestPacket = request ?? Game.Connection.GetRequestPacket(cpBeforePacketDispatch);

                if (cpRequestPacket != null) {
                    if (cpBeforePacketDispatch.Words.Count >= 1 && String.Compare(cpBeforePacketDispatch.Words[0], "InvalidUsername", true) == 0) {
                        if (LoginFailure != null) {
                            this.LoginFailure(this, cpBeforePacketDispatch.Words[0]);
                        }

                        Shutdown();
                        State = ConnectionState.Error;

                        blCancelPacket = true;
                    }
                    else if (cpRequestPacket.Words.Count >= 1 && String.Compare(cpRequestPacket.Words[0], "procon.version", true) == 0 && cpBeforePacketDispatch.Words.Count >= 2) {
                        try {
                            ConnectedLayerVersion = new Version(cpBeforePacketDispatch.Words[1]);

                            if (ProconVersion != null) {
                                this.ProconVersion(this, ConnectedLayerVersion);
                            }
                        }
                        catch (Exception) {
                        }

                        blCancelPacket = true;
                    }
                    else if (cpRequestPacket.Words.Count >= 1 && String.Compare(cpRequestPacket.Words[0], "procon.privileges", true) == 0 && cpBeforePacketDispatch.Words.Count >= 2) {
                        UInt32 ui32Privileges = 0;
                        if (UInt32.TryParse(cpBeforePacketDispatch.Words[1], out ui32Privileges) == true) {
                            var spPrivs = new CPrivileges();
                            spPrivs.PrivilegesFlags = ui32Privileges;

                            Privileges = spPrivs;

                            if (ProconPrivileges != null) {
                                this.ProconPrivileges(this, spPrivs);
                            }
                        }

                        blCancelPacket = true;
                    }
                    else if (cpRequestPacket.Words.Count >= 2 && String.Compare(cpRequestPacket.Words[0], "procon.registerUid", true) == 0 && cpBeforePacketDispatch.Words.Count >= 1) {
                        if (String.Compare(cpBeforePacketDispatch.Words[0], "OK", true) == 0 && cpRequestPacket.Words.Count >= 3) {
                            ProconEventsUid = cpRequestPacket.Words[2];
                        }
                        else if (String.Compare(cpBeforePacketDispatch.Words[0], "ProconUidConflict", true) == 0) {
                            // Conflict in our UID, just hash and send another one.
                            // Then go to vegas.
                            SendRequest(new List<string>() {
                                "procon.registerUid",
                                "true",
                                FrostbiteClient.GeneratePasswordHash(Encoding.ASCII.GetBytes(DateTime.Now.ToString("HH:mm:ss ff")), _username)
                            });
                        }

                        blCancelPacket = true;
                    }
                    else if (cpRequestPacket.Words.Count >= 1 && String.Compare(cpRequestPacket.Words[0], "procon.account.listAccounts", true) == 0) {
                        UInt32 ui32Privileges = 0;

                        for (int i = 1; i < cpBeforePacketDispatch.Words.Count; i += 2) {
                            if (UInt32.TryParse(cpBeforePacketDispatch.Words[i + 1], out ui32Privileges) == true) {
                                var spPrivs = new CPrivileges();
                                spPrivs.PrivilegesFlags = ui32Privileges;

                                if (RemoteAccountCreated != null && RemoteAccountAltered != null) {
                                    this.RemoteAccountCreated(this, cpBeforePacketDispatch.Words[i]);
                                    this.RemoteAccountAltered(this, cpBeforePacketDispatch.Words[i], spPrivs);
                                }
                            }
                        }

                        blCancelPacket = true;
                    }

                        // syncPlayTimes coming in
                    else if (cpBeforePacketDispatch.Words.Count >= 3 && String.Compare(cpRequestPacket.Words[0], "procon.player.syncPlayTimes", true) == 0) {
                        int iJoinTime = 0;
                        var vSoldier = new CPlayerInfo();
                        var oPlayer = new CPlayerInfo();

                        for (int i = 1; i < cpBeforePacketDispatch.Words.Count; i += 2) {
                            vSoldier.SoldierName = cpBeforePacketDispatch.Words[i];
                            if (int.TryParse(cpBeforePacketDispatch.Words[i + 1], out iJoinTime) == true) {
                                vSoldier.JoinTime = iJoinTime;
                            }
                            if (PlayerList.Contains(vSoldier.SoldierName) == true) {
                                oPlayer = PlayerList[vSoldier.SoldierName];
                                oPlayer.JoinTime = iJoinTime;

                                PlayerList[PlayerList.IndexOf(PlayerList[vSoldier.SoldierName])] = oPlayer;
                            }
                        } 
                        blCancelPacket = false;
                    }

                    else if (cpRequestPacket.Words.Count >= 1 && String.Compare(cpRequestPacket.Words[0], "procon.battlemap.listZones", true) == 0 && cpBeforePacketDispatch.Words.Count >= 2 && String.Compare(cpBeforePacketDispatch.Words[0], "OK", true) == 0) {
                        var zones = new List<MapZoneDrawing>();

                        int iZones = 0;
                        int iOffset = 1;

                        if (int.TryParse(cpBeforePacketDispatch.Words[iOffset++], out iZones) == true) {
                            for (int iZoneCount = 0; iZoneCount < iZones; iZoneCount++) {
                                string uid = String.Empty;
                                string level = String.Empty;
                                string tags = String.Empty;
                                var points = new List<Point3D>();

                                if (iOffset + 4 < cpBeforePacketDispatch.Words.Count) {
                                    uid = cpBeforePacketDispatch.Words[iOffset++];
                                    level = cpBeforePacketDispatch.Words[iOffset++];
                                    tags = cpBeforePacketDispatch.Words[iOffset++];

                                    int iZonePoints = 0;
                                    if (int.TryParse(cpBeforePacketDispatch.Words[iOffset++], out iZonePoints) == true && iOffset + iZonePoints * 3 <= cpBeforePacketDispatch.Words.Count) {
                                        for (int iZonePointCount = 0; iZonePointCount < iZonePoints && iOffset + 3 <= cpBeforePacketDispatch.Words.Count; iZonePointCount++) {
                                            points.Add(new Point3D(cpBeforePacketDispatch.Words[iOffset++], cpBeforePacketDispatch.Words[iOffset++], cpBeforePacketDispatch.Words[iOffset++]));
                                        }
                                    }
                                }

                                zones.Add(new MapZoneDrawing(uid, level, tags, points.ToArray(), true));
                            }
                        }

                        if (ListMapZones != null) {
                            this.ListMapZones(this, zones);
                        }

                        blCancelPacket = true;
                    }


                    else if (cpRequestPacket.Words.Count >= 1 && String.Compare(cpRequestPacket.Words[0], "procon.account.setPassword", true) == 0 && cpBeforePacketDispatch.Words.Count >= 1 && String.Compare(cpBeforePacketDispatch.Words[0], "OK", true) == 0) {
                        if (RemoteAccountChangePassword != null) {
                            this.RemoteAccountChangePassword(this);
                        }

                        blCancelPacket = true;
                    }
                    else if (cpRequestPacket.Words.Count >= 1 && String.Compare(cpRequestPacket.Words[0], "procon.account.listLoggedIn", true) == 0) {
                        bool containsUids = (cpRequestPacket.Words.Count >= 2 && String.Compare(cpRequestPacket.Words[1], "uids") == 0);

                        if (RemoteAccountLoggedIn != null) {
                            for (int i = 1; i < cpBeforePacketDispatch.Words.Count; i++) {
                                this.RemoteAccountLoggedIn(this, cpBeforePacketDispatch.Words[i], true);

                                if (containsUids == true && i + 1 < cpBeforePacketDispatch.Words.Count) {
                                    if (m_dicUsernamesToUids.ContainsKey(cpBeforePacketDispatch.Words[i]) == true) {
                                        m_dicUsernamesToUids[cpBeforePacketDispatch.Words[i]] = cpBeforePacketDispatch.Words[i + 1];
                                    }
                                    else {
                                        m_dicUsernamesToUids.Add(cpBeforePacketDispatch.Words[i], cpBeforePacketDispatch.Words[i + 1]);
                                    }

                                    i++;
                                }
                            }
                        }

                        blCancelPacket = true;
                    }

                    else if (cpRequestPacket.Words.Count >= 1 && String.Compare(cpRequestPacket.Words[0], "procon.plugin.listEnabled", true) == 0) {
                        if (RemoteEnabledPlugins != null) {
                            var lstEnabledPlugins = new List<string>(cpBeforePacketDispatch.Words);
                            lstEnabledPlugins.RemoveAt(0);

                            this.RemoteEnabledPlugins(this, lstEnabledPlugins);
                        }

                        blCancelPacket = true;
                    }
                    else if (cpRequestPacket.Words.Count >= 1 && String.Compare(cpRequestPacket.Words[0], "procon.vars", true) == 0 && cpBeforePacketDispatch.Words.Count >= 3) {
                        SV_Variables.SetVariable(cpBeforePacketDispatch.Words[1], cpBeforePacketDispatch.Words[2]);

                        if (ReceiveProconVariable != null) {
                            this.ReceiveProconVariable(this, cpBeforePacketDispatch.Words[1], cpBeforePacketDispatch.Words[2]);
                        }
                        // Dispatch to plugins.
                    }
                    else if (cpRequestPacket.Words.Count >= 1 && String.Compare(cpRequestPacket.Words[0], "procon.plugin.listLoaded", true) == 0) {
                        if (RemoteLoadedPlugins != null) {
                            int i = 0;
                            if (cpBeforePacketDispatch.Words.Count >= 1 && String.Compare(cpBeforePacketDispatch.Words[i++], "OK", true) == 0) {
                                var dicLoadedPlugins = new Dictionary<string, PluginDetails>();

                                while (i + 6 <= cpBeforePacketDispatch.Words.Count) {
                                    var spdLoaded = new PluginDetails();

                                    spdLoaded.ClassName = cpBeforePacketDispatch.Words[i++];
                                    spdLoaded.Name = cpBeforePacketDispatch.Words[i++];
                                    spdLoaded.Author = cpBeforePacketDispatch.Words[i++];
                                    spdLoaded.Website = cpBeforePacketDispatch.Words[i++];
                                    spdLoaded.Version = cpBeforePacketDispatch.Words[i++];
                                    spdLoaded.Description = cpBeforePacketDispatch.Words[i++];

                                    spdLoaded.DisplayPluginVariables = new List<CPluginVariable>();
                                    spdLoaded.PluginVariables = new List<CPluginVariable>(); // Not used here.
                                    int iTotalVariables = 0;
                                    if (int.TryParse(cpBeforePacketDispatch.Words[i++], out iTotalVariables) == true && i + (iTotalVariables * 3) <= cpBeforePacketDispatch.Words.Count) {
                                        for (int x = 0; x < (iTotalVariables * 3); x += 3) {
                                            spdLoaded.DisplayPluginVariables.Add(new CPluginVariable(cpBeforePacketDispatch.Words[i++], cpBeforePacketDispatch.Words[i++], cpBeforePacketDispatch.Words[i++]));
                                        }
                                    }

                                    if (dicLoadedPlugins.ContainsKey(spdLoaded.ClassName) == false) {
                                        dicLoadedPlugins.Add(spdLoaded.ClassName, spdLoaded);
                                    }
                                }

                                this.RemoteLoadedPlugins(this, dicLoadedPlugins);
                            }
                        }

                        blCancelPacket = true;
                    }
                    else if (cpRequestPacket.Words.Count >= 2 && String.Compare(cpRequestPacket.Words[0], "login.hashed", true) == 0 && cpBeforePacketDispatch.Words.Count >= 1 && String.Compare(cpBeforePacketDispatch.Words[0], "InsufficientPrivileges", true) == 0) {
                        if (LoginFailure != null) {
                            this.LoginFailure(this, cpBeforePacketDispatch.Words[0]);
                        }

                        Shutdown();
                        State = ConnectionState.Error;

                        blCancelPacket = true;
                    }
                    else if (cpRequestPacket.Words.Count >= 2 && String.Compare(cpRequestPacket.Words[0], "procon.login.username", true) == 0 && cpBeforePacketDispatch.Words.Count >= 1 && (String.Compare(cpBeforePacketDispatch.Words[0], "OK", true) == 0 || String.Compare(cpBeforePacketDispatch.Words[0], "UnknownCommand", true) == 0)) {
                        //this.send(new Packet(true, true, cpBeforePacketDispatch.SequenceNumber, new List<string>() { "procon.login.requestUsername", this.m_strUsername }));

                        // This is the first command we would recieve so now we know we're connected through a PRoCon layer.
                        if (LoginAttempt != null) {
                            this.LoginAttempt(this);
                        }

                        Game.SendLoginHashedPacket(Password);

                        if (String.Compare(cpBeforePacketDispatch.Words[0], "OK", true) == 0) {
                            IsPRoConConnection = true;
                            Game.IsLayered = true;
                        }
                        else {
                            IsPRoConConnection = false;
                            Username = "";
                        }

                        blCancelPacket = true;
                    }
                    else if (cpRequestPacket.Words.Count >= 2 && String.Compare(cpRequestPacket.Words[0], "procon.login.username", true) == 0 && cpBeforePacketDispatch.Words.Count >= 1 && String.Compare(cpBeforePacketDispatch.Words[0], "InsufficientPrivileges", true) == 0) {
                        // The servers just told us off, try and login normally.
                        if (LoginFailure != null) {
                            this.LoginFailure(this, cpBeforePacketDispatch.Words[0]);
                        }

                        Shutdown();
                        State = ConnectionState.Error;

                        blCancelPacket = true;
                    }
                    else if (cpRequestPacket.Words.Count >= 3 && String.Compare(cpRequestPacket.Words[0], "admin.say", true) == 0 && m_dicForwardedPackets.ContainsKey(cpBeforePacketDispatch.SequenceNumber) == true) {
                        if (m_dicForwardedPackets[cpBeforePacketDispatch.SequenceNumber].m_lstWords.Count >= 4 && String.Compare(m_dicForwardedPackets[cpBeforePacketDispatch.SequenceNumber].m_lstWords[0], "procon.admin.say", true) == 0) {
                            m_dicForwardedPackets[cpBeforePacketDispatch.SequenceNumber].m_lstWords[0] = "procon.admin.onSay";

                            if (IsPRoConConnection == false) {
                                List<string> lstWords = m_dicForwardedPackets[cpBeforePacketDispatch.SequenceNumber].m_lstWords;

                                if (ProconAdminSaying != null) {
                                    this.ProconAdminSaying(this, lstWords[1], lstWords[2], new CPlayerSubset(lstWords.GetRange(3, lstWords.Count - 3)));
                                }
                            }

                            if (PassLayerEvent != null) {
                                this.PassLayerEvent(this, new Packet(true, false, cpRequestPacket.SequenceNumber, m_dicForwardedPackets[cpBeforePacketDispatch.SequenceNumber].m_lstWords));
                            }

                            // Send to all logged in layer clients
                            m_dicForwardedPackets.Remove(cpBeforePacketDispatch.SequenceNumber);
                            blCancelPacket = true;
                            blCancelUpdateEvent = true;
                        }
                    }
                    else if (cpRequestPacket.Words.Count >= 4 && String.Compare(cpRequestPacket.Words[0], "admin.yell", true) == 0 && m_dicForwardedPackets.ContainsKey(cpBeforePacketDispatch.SequenceNumber) == true) {
                        if (m_dicForwardedPackets[cpBeforePacketDispatch.SequenceNumber].m_lstWords.Count >= 5 && String.Compare(m_dicForwardedPackets[cpBeforePacketDispatch.SequenceNumber].m_lstWords[0], "procon.admin.yell", true) == 0) {
                            m_dicForwardedPackets[cpBeforePacketDispatch.SequenceNumber].m_lstWords[0] = "procon.admin.onYell";

                            // If we're at the top of the tree, simulate the event coming from a layer above.
                            if (IsPRoConConnection == false) {
                                List<string> lstWords = m_dicForwardedPackets[cpBeforePacketDispatch.SequenceNumber].m_lstWords;

                                int iDisplayDuration = 0;

                                if (int.TryParse(lstWords[3], out iDisplayDuration) == true) {
                                    if (ProconAdminYelling != null) {
                                        this.ProconAdminYelling(this, lstWords[1], lstWords[2], iDisplayDuration, new CPlayerSubset(lstWords.GetRange(4, lstWords.Count - 4)));
                                    }
                                }
                            }

                            // Send to all logged in layer clients
                            if (PassLayerEvent != null) {
                                this.PassLayerEvent(this, new Packet(true, false, cpRequestPacket.SequenceNumber, m_dicForwardedPackets[cpBeforePacketDispatch.SequenceNumber].m_lstWords));
                            }

                            m_dicForwardedPackets.Remove(cpBeforePacketDispatch.SequenceNumber);
                            blCancelPacket = true;
                            blCancelUpdateEvent = true;
                        }
                    }
                        // MoHW R-6 hack
                    else if (cpRequestPacket.Words.Count >= 3 && Game.GameType == "MOHW" && String.Compare(cpRequestPacket.Words[0], "admin.yell", true) == 0 && m_dicForwardedPackets.ContainsKey(cpBeforePacketDispatch.SequenceNumber) == true) {
                        if (m_dicForwardedPackets[cpBeforePacketDispatch.SequenceNumber].m_lstWords.Count >= 4 && String.Compare(m_dicForwardedPackets[cpBeforePacketDispatch.SequenceNumber].m_lstWords[0], "procon.admin.yell", true) == 0) {
                            m_dicForwardedPackets[cpBeforePacketDispatch.SequenceNumber].m_lstWords[0] = "procon.admin.onYell";

                            // If we're at the top of the tree, simulate the event coming from a layer above.
                            if (IsPRoConConnection == false) {
                                List<string> lstWords = m_dicForwardedPackets[cpBeforePacketDispatch.SequenceNumber].m_lstWords;

                                int iDisplayDuration = 0;
                                if (int.TryParse(lstWords[3], out iDisplayDuration) == true) {
                                    iDisplayDuration = 0;
                                    if (ProconAdminYelling != null) {
                                        this.ProconAdminYelling(this, lstWords[1], lstWords[2], iDisplayDuration, new CPlayerSubset(lstWords.GetRange(4, lstWords.Count - 4)));
                                    }
                                }
                            }

                            // Send to all logged in layer clients
                            if (PassLayerEvent != null) {
                                this.PassLayerEvent(this, new Packet(true, false, cpRequestPacket.SequenceNumber, m_dicForwardedPackets[cpBeforePacketDispatch.SequenceNumber].m_lstWords));
                            }

                            m_dicForwardedPackets.Remove(cpBeforePacketDispatch.SequenceNumber);
                            blCancelPacket = true;
                            blCancelUpdateEvent = true;
                        }
                    }
                        // end hack
                        // BF3 player.ping
                    else if (cpRequestPacket.Words.Count >= 2 && Game.GameType == "BF3" && String.Compare(cpRequestPacket.Words[0], "player.ping", true) == 0 && String.Compare(cpBeforePacketDispatch.Words[0], "OK", true) == 0) {
                        string strProconEventsUid = String.Empty;

                        var lstProconUpdatedWords = new List<string>(cpRequestPacket.Words);
                        lstProconUpdatedWords.Insert(0, "procon.admin.onPlayerPinged");
                        lstProconUpdatedWords.RemoveAt(1);
                        lstProconUpdatedWords.Add(cpBeforePacketDispatch.Words[1]);
                        // Now we pass on the packet to all the clients as an event so they can remain in sync.

                        // Don't pass on anything regarding login
                        if ((lstProconUpdatedWords.Count >= 4 && (String.Compare(lstProconUpdatedWords[2], "login.plainText", true) == 0 || String.Compare(lstProconUpdatedWords[2], "login.hashed", true) == 0)) == false) {
                            if (PassLayerEvent != null) {
                                this.PassLayerEvent(this, new Packet(true, false, cpRequestPacket.SequenceNumber, lstProconUpdatedWords));
                            }
                        }
                    }
                    if (blCancelUpdateEvent == false) {
                        string strProconEventsUid = String.Empty;

                        // If a layer client sent this packet..
                        if (m_dicForwardedPackets.ContainsKey(cpBeforePacketDispatch.SequenceNumber) == true) {
                            if (m_dicForwardedPackets[cpBeforePacketDispatch.SequenceNumber].m_sender != null) {
                                (m_dicForwardedPackets[cpBeforePacketDispatch.SequenceNumber].m_sender).Forward(new Packet(false, true, m_dicForwardedPackets[cpBeforePacketDispatch.SequenceNumber].m_ui32OriginalSequence, new List<string>(cpBeforePacketDispatch.Words)));

                                strProconEventsUid = (m_dicForwardedPackets[cpBeforePacketDispatch.SequenceNumber].m_sender).ProconEventsUid;

                                InstigatingAccountName = m_dicForwardedPackets[cpBeforePacketDispatch.SequenceNumber].m_sender.Username;
                            }

                            // Unregister the sequence and packet.
                            m_dicForwardedPackets.Remove(cpBeforePacketDispatch.SequenceNumber);
                        }

                        // IF the command was not a request for a list (it's a GET operation only,
                        // as in it only lists or retrieves information and will never be set.)

                        if (Game != null && Game.GetPacketsPattern.IsMatch(cpRequestPacket.ToString()) == false) {
                            // && cpBeforePacketDispatch.Words.Count >= 1 && String.Compare(cpBeforePacketDispatch.Words[0], "OK") == 0) {
                            var lstProconUpdatedWords = new List<string>(cpRequestPacket.Words);
                            lstProconUpdatedWords.Insert(0, "procon.updated");
                            lstProconUpdatedWords.Insert(1, strProconEventsUid);
                            // Now we pass on the packet to all the clients as an event so they can remain in sync.

                            // Don't pass on anything regarding login
                            if ((lstProconUpdatedWords.Count >= 4 && (String.Compare(lstProconUpdatedWords[2], "login.plainText", true) == 0 || String.Compare(lstProconUpdatedWords[2], "login.hashed", true) == 0)) == false) {
                                if (PassLayerEvent != null) {
                                    this.PassLayerEvent(this, new Packet(true, false, cpRequestPacket.SequenceNumber, lstProconUpdatedWords));
                                }
                            }
                        }
                    }
                }
            }

            return blCancelPacket;
        }
        public override void OnPlayerLeft(CPlayerInfo playerInfo)
        {
            if (ZombieModeEnabled == false)
            {
                SetState(GState.Idle);
                return;
            }

            DebugWrite("OnPlayerLeft: " + playerInfo.SoldierName, 3);

            lock (TeamHuman)
            {
                if (TeamHuman.Contains(playerInfo.SoldierName)) TeamHuman.Remove(playerInfo.SoldierName);
                if (TeamZombie.Contains(playerInfo.SoldierName)) TeamZombie.Remove(playerInfo.SoldierName);
            }

            KillTracker.RemovePlayer(playerInfo.SoldierName);

            RemoveJoinQueue(playerInfo.SoldierName);

            lock (PlayerKickQueue)
            {
                if (PlayerKickQueue.Contains(playerInfo.SoldierName))
                {
                    PlayerKickQueue.Remove(playerInfo.SoldierName);
                }
            }

            if (GetState() == GState.Playing)
            {
                AdaptDamage();

                CheckVictoryConditions(false);
            }
        }
        public override void OnPlayerLeft(CPlayerInfo playerInfo) {
			base.OnPlayerLeft(playerInfo);
			
            this.RegisterAllCommands();
        }
        public void OnZoneTrespass(CPlayerInfo cpiSoldier, ZoneAction action, MapZone sender, Point3D pntTresspassLocation, float flTresspassPercentage, object trespassState) {

            if (flTresspassPercentage >= this.m_flMinimumTrespassError) {

                if (trespassState is Kill) {

                    Kill trespassKill = (Kill)trespassState;

                    // If the trespasser died within the zone (the killer does not need to be inside the zone)
                    if (action == ZoneAction.Death) {

                        if (trespassKill.IsSuicide == false) {

                            // If the player was within the limit for base camping.
                            // AND the player is not on the same team.
                            if (trespassKill.Distance <= this.m_iMaximumDistanceForBaseCamping && trespassKill.Killer.TeamID != trespassKill.Victim.TeamID) {

                                if (sender.Tags.Contains("EFAE_PROTECT_U.SARMY") == true) {

                                    // If the player was on U.S side
                                    // References: PRoCon.Core.CMap, PRoCon.Core.CTeamName
                                    if (String.Compare(this.GetTeamLocalizationKeyByTeamId(cpiSoldier.TeamID), "global.conquest.us", true) == 0) {
                                        this.KillPlayerWithMessage(trespassKill.Killer.SoldierName, this.m_strEfaeProtectUsArmyKillMessage.Replace("%kn%", trespassKill.Killer.SoldierName).Replace("%vn%", trespassKill.Victim.SoldierName));
                                    }
                                }

                                if (sender.Tags.Contains("EFAE_PROTECT_RUSSIANARMY") == true) {
                                    if (String.Compare(this.GetTeamLocalizationKeyByTeamId(cpiSoldier.TeamID), "global.conquest.ru", true) == 0) {
                                        this.KillPlayerWithMessage(trespassKill.Killer.SoldierName, this.m_strEfaeProtectRussianArmyKillMessage.Replace("%kn%", trespassKill.Killer.SoldierName).Replace("%vn%", trespassKill.Victim.SoldierName));
                                    }
                                }

                                if (sender.Tags.Contains("EFAE_PROTECT_NVA") == true) {
                                    if (String.Compare(this.GetTeamLocalizationKeyByTeamId(cpiSoldier.TeamID), "global.conquest.nva", true) == 0) {
                                        this.KillPlayerWithMessage(trespassKill.Killer.SoldierName, this.m_strEfaeProtectNVArmyKillMessage.Replace("%kn%", trespassKill.Killer.SoldierName).Replace("%vn%", trespassKill.Victim.SoldierName));
                                    }
                                }

                                if (sender.Tags.Contains("EFAE_PROTECT_ATTACKERS") == true) {
                                    if (String.Compare(this.GetTeamLocalizationKeyByTeamId(cpiSoldier.TeamID), "global.rush.attackers", true) == 0) {
                                        this.KillPlayerWithMessage(trespassKill.Killer.SoldierName, this.m_strEfaeProtectAttackersKillMessage.Replace("%kn%", trespassKill.Killer.SoldierName).Replace("%vn%", trespassKill.Victim.SoldierName));
                                    }
                                }
                            }
                        }
                    }
                    // If the trespasser killed another player while inside the zone (the victim does not need to be inside the zone)
                    else if (action == ZoneAction.Kill) {

                        if (sender.Tags.Contains("EFAE_ANTICAMPER_SNIPER") == true) {

                            // If they used a sniper rifle to kill.
                            // References: PRoCon.Core.Players.Items.Weapon, PRoCon.Core.Players.Items.DamageTypes, PRoCon.Core.Players.Items.WeaponDictionary
                            if (this.GetWeaponDamageType(trespassKill.DamageType) == DamageTypes.SniperRifle) {
                                this.KillPlayerWithMessage(trespassKill.Killer.SoldierName, this.m_strEfaeAntiCamperSniperKillMessage.Replace("%kn%", trespassKill.Killer.SoldierName).Replace("%vn%", trespassKill.Victim.SoldierName));
                            }
                        }
                    }
                }
            }
        }
Exemple #15
0
        private void PRoConClient_PlayerKilled(FrostbiteClient sender, string strKiller, string strVictim, string strDamageType, bool blHeadshot, Point3D pntKiller, Point3D pntVictim) {
            if (PlayerKilled != null) {
                CPlayerInfo cpKiller = null, cpVictim = null;

                if (PlayerList.Contains(strKiller) == true) {
                    cpKiller = PlayerList[strKiller];
                }
                else {
                    cpKiller = new CPlayerInfo(strKiller, String.Empty, 0, 0);
                }

                if (PlayerList.Contains(strVictim) == true) {
                    cpVictim = PlayerList[strVictim];
                }
                else {
                    cpVictim = new CPlayerInfo(strVictim, String.Empty, 0, 0);
                }

                FrostbiteConnection.RaiseEvent(PlayerKilled.GetInvocationList(), this, new Kill(cpKiller, cpVictim, strDamageType, blHeadshot, pntKiller, pntVictim));
            }
        }
Exemple #16
0
 private void QueuePlayerForForceMove(CPlayerInfo player)
 {
     this.DebugWrite("Entering queuePlayerForForceMove", 7);
     try {
         if (this._IsEnabled) {
             this.DebugWrite("Preparing to queue player for TeamSwap ", 6);
             lock (_TeamswapMutex) {
                 this._TeamswapForceMoveQueue.Enqueue(player);
                 this._TeamswapWaitHandle.Set();
                 this.DebugWrite("Player queued for TeamSwap", 6);
             }
         }
     }
     catch (Exception e) {
         this.HandleException(new AdKatsException("Error while queueing player for force-move.", e));
     }
     this.DebugWrite("Exiting queuePlayerForForceMove", 7);
 }
Exemple #17
0
 protected void OnPlayerLeft(FrostbiteClient sender, string strSoldierName, CPlayerInfo cpiPlayer) {
     if (PlayerList.Contains(strSoldierName) == true) {
         PlayerList.Remove(strSoldierName);
     }
 }
Exemple #18
0
 private void QueuePlayerForMove(CPlayerInfo player)
 {
     this.DebugWrite("Entering queuePlayerForMove", 7);
     try {
         if (this._IsEnabled) {
             this.DebugWrite("Preparing to add player to 'on-death' move dictionary.", 6);
             lock (_TeamswapMutex) {
                 if (!this._TeamswapOnDeathMoveDic.ContainsKey(player.SoldierName)) {
                     this._TeamswapOnDeathMoveDic.Add(player.SoldierName, player);
                     this._TeamswapWaitHandle.Set();
                     this.DebugWrite("Player added to 'on-death' move dictionary.", 6);
                 }
                 else {
                     this.DebugWrite("Player already in 'on-death' move dictionary.", 6);
                 }
             }
         }
     }
     catch (Exception e) {
         this.HandleException(new AdKatsException("Error while queueing player for move.", e));
     }
     this.DebugWrite("Exiting queuePlayerForMove", 7);
 }
Exemple #19
0
        public override void OnPlayerLeft(CPlayerInfo playerInfo)
        {
            base.OnPlayerLeft(playerInfo);

            foreach (Message m in messages.FindAll((m) => m.enabled))
                try
                {
                    m.OnPlayerLeft(playerInfo.SoldierName);
                }
                catch (Exception exc)
                {
                    ConsoleError("Exception with OnPlayerLeft of '" + m.name + "': " + exc.Message + " " + exc.StackTrace);
                }
        }
Exemple #20
0
 //DONE
 public override void OnPlayerLeft(CPlayerInfo playerInfo)
 {
     this.DebugWrite("Entering OnPlayerLeft", 7);
     try {
         this.RemovePlayerFromDictionary(playerInfo.SoldierName);
         this._TeamswapWaitHandle.Set();
     }
     catch (Exception e) {
         this.HandleException(new AdKatsException("Error while handling player exit.", e));
     }
     this.DebugWrite("Exiting OnPlayerLeft", 7);
 }
Exemple #21
0
            public PlayerProfile(InsaneBalancer plg, CPunkbusterInfo inf) {

                try {
                    plugin = plg;
                    info = new CPlayerInfo();
                    pbinfo = inf;
                    name = pbinfo.SoldierName;

                    time = DateTime.Now;
                    round_stats = new PlayerStats();
                    stats = new PlayerStats();
                    resetStats();

                    fetchStats();
                } catch (Exception e) {
                    plugin.dump_exception(e);
                }
            }
Exemple #22
0
 public CPlayerInfo BuildCPlayerInfo(String playerName, String playerGUID)
 {
     this.DebugWrite("Entering ", 7);
     CPlayerInfo playerInfo = null;
     try {
         IList<String> lstParameters = new List<String>();
         IList<String> lstVariables = new List<String>();
         lstParameters.Add("id");
         lstVariables.Add(playerName);
         lstParameters.Add("guid");
         lstVariables.Add(playerGUID);
         playerInfo = new CPlayerInfo(lstParameters, lstVariables);
     }
     catch (Exception e) {
         this.HandleException(new AdKatsException("Error while creating CPlayerInfo object.", e));
     }
     this.DebugWrite("Exiting ", 7);
     return playerInfo;
 }
Exemple #23
0
        private void m_prcClient_PlayerLeft(FrostbiteClient sender, string playerName, CPlayerInfo cpiPlayer) {
            if (cpiPlayer != null) {
                InvokeOnAllEnabled("OnPlayerLeft", cpiPlayer);
            }

            // OBSOLETE
            //this.InvokeOnAllEnabled("OnPlayerLeft", playerName);
        }
        private ListViewItem CreateTotalsPlayer(CPlayerInfo cpiDummyPlayer, int iTeamID) {
            ListViewItem lviReturn = this.CreatePlayer(new CPlayerInfo(cpiDummyPlayer.SoldierName, String.Empty, iTeamID, 0));
            lviReturn.Name = cpiDummyPlayer.ClanTag;
            lviReturn.Font = new Font(this.Font, FontStyle.Bold);

            return lviReturn;
        }
Exemple #25
0
            // here's where we add a player to the main list
            // and remove them from the new player cache if necessary
            public void update(CPlayerInfo inf)
            {
                string player_name = inf.SoldierName;
                // remove from new player cache
                new_player_teams.Remove(player_name);
                // add to main player list (update existing entry if necessary)

                if (!info.ContainsKey(player_name) || info[player_name] == null)
                    info[player_name] = new PlayerData();
                info[player_name].name = player_name;
                info[player_name].squad = inf.SquadID.ToString();
                info[player_name].team = inf.TeamID.ToString();
                info[player_name].ea_guid = inf.GUID;
                info[player_name].clan = inf.ClanTag;
                info[player_name].score = inf.Score;
                info[player_name].updated = true;
            }
        private ListViewItem CreatePlayer(CPlayerInfo player) {
            ListViewItem newListPlayer = new ListViewItem("") {
                Name = player.SoldierName,
                Tag = null,
                UseItemStyleForSubItems = true
            };

            AdditionalPlayerInfo additional = new AdditionalPlayerInfo {
                Player = player,
                ResolvedHostName = String.Empty
            };
            newListPlayer.Tag = additional;

            ListViewItem.ListViewSubItem tags = new ListViewItem.ListViewSubItem {
                Name = @"tags",
                Text = player.ClanTag
            };
            newListPlayer.SubItems.Add(tags);

            ListViewItem.ListViewSubItem tagsName = new ListViewItem.ListViewSubItem {
                Name = @"soldiername",
                Text = player.SoldierName
            };
            newListPlayer.SubItems.Add(tagsName);

            if (this.Client != null && this.Client.Game != null && this.Client.Game.HasSquads == true) {
                ListViewItem.ListViewSubItem squad = new ListViewItem.ListViewSubItem {
                    Name = @"squad"
                };

                if (player.SquadID != uscPlayerListPanel.NeutralSquad) {
                    squad.Text = this.Language.GetLocalized("global.Squad" + player.SquadID.ToString(CultureInfo.InvariantCulture), null);
                }
                newListPlayer.SubItems.Add(squad);
            }

            ListViewItem.ListViewSubItem kit = new ListViewItem.ListViewSubItem {
                Name = @"kit",
                Text = String.Empty
            };
            newListPlayer.SubItems.Add(kit);

            ListViewItem.ListViewSubItem score = new ListViewItem.ListViewSubItem {
                Name = @"score",
                Text = player.Score.ToString(CultureInfo.InvariantCulture)
            };
            newListPlayer.SubItems.Add(score);

            ListViewItem.ListViewSubItem kills = new ListViewItem.ListViewSubItem {
                Name = @"kills",
                Tag = (Double)player.Kills,
                Text = player.Kills.ToString(CultureInfo.InvariantCulture)
            };
            newListPlayer.SubItems.Add(kills);

            ListViewItem.ListViewSubItem deaths = new ListViewItem.ListViewSubItem {
                Name = @"deaths",
                Tag = (Double)player.Deaths,
                Text = player.Deaths.ToString(CultureInfo.InvariantCulture)
            };
            newListPlayer.SubItems.Add(deaths);

            ListViewItem.ListViewSubItem kdr = new ListViewItem.ListViewSubItem {
                Name = @"kdr",
                Text = player.Deaths > 0 ? String.Format("{0:0.00}", (Double)player.Kills / player.Deaths) : String.Format("{0:0.00}", (Double)player.Kills)
            };
            newListPlayer.SubItems.Add(kdr);

            ListViewItem.ListViewSubItem ping = new ListViewItem.ListViewSubItem {
                Name = @"ping",
                Text = player.Ping.ToString(CultureInfo.InvariantCulture)
            };
            newListPlayer.SubItems.Add(ping);

            ListViewItem.ListViewSubItem rank = new ListViewItem.ListViewSubItem {
                Name = @"rank",
                Text = player.Rank.ToString(CultureInfo.InvariantCulture)
            };
            newListPlayer.SubItems.Add(rank);

            ListViewItem.ListViewSubItem time = new ListViewItem.ListViewSubItem {
                Name = @"time",
                Text = player.SessionTime > 60 ? String.Format("{0:0}", player.SessionTime / 60) : "0"
            };
            newListPlayer.SubItems.Add(time);

            ListViewItem.ListViewSubItem type = new ListViewItem.ListViewSubItem {
                Name = @"type"
            };

            if (player.Type == 0) {
                type.Text = String.Empty;
            }
            else if (player.Type == 1) {
                type.Text = this.Language.GetDefaultLocalized("Spectator", "uscPlayerListPanel.lsvPlayers.Type.Spectator", null);
            }
            else if (player.Type == 2) {
                type.Text = this.Language.GetDefaultLocalized("Commander (PC)", "uscPlayerListPanel.lsvPlayers.Type.CommanderPC", null);
            }
            else if (player.Type == 3) {
                type.Text = this.Language.GetDefaultLocalized("Commander (Tablet)", "uscPlayerListPanel.lsvPlayers.Type.CommanderTablet", null);
            }

            newListPlayer.SubItems.Add(type);

            return newListPlayer;
        }
Exemple #27
0
        //DONE
        public override void OnPlayerLeft(CPlayerInfo playerInfo)
        {
            this.removePlayerFromDictionary(playerInfo.SoldierName);

            if (playerInfo.TeamID == USTeamID)
            {
                this.USPlayerCount--;
            }
            else
            {
                this.RUPlayerCount--;
            }

            this.teamswapHandle.Set();
        }
        private void m_prcClient_PlayerLeft(FrostbiteClient sender, string playerName, CPlayerInfo cpiPlayer) {
            this.InvokeIfRequired(() => {
                if (this.Players.ContainsKey(playerName) == true) {
                    this.Players[playerName].Remove();
                    this.Players.Remove(playerName);
                }
                if (this.Pings.ContainsKey(playerName) == true) {
                    this.Pings.Remove(playerName);
                }
                this.UpdateTeamNames();

                this.RefreshSelectedPlayer();
            });
        }
Exemple #29
0
 private void queuePlayerForMove(CPlayerInfo player)
 {
     if (this.isEnabled)
     {
         this.DebugWrite("Preparing to add player to 'on-death' move dictionary.", 6);
         lock (teamswapMutex)
         {
             if (!this.teamswapOnDeathMoveDic.ContainsKey(player.SoldierName))
             {
                 this.teamswapOnDeathMoveDic.Add(player.SoldierName, player);
                 this.teamswapHandle.Set();
                 this.DebugWrite("Player added to 'on-death' move dictionary.", 6);
             }
             else
             {
                 this.DebugWrite("Player already in 'on-death' move dictionary.", 6);
             }
         }
     }
 }
        public void OnPlayerLeft(CPlayerInfo cpiPlayer) {

        }