Example #1
0
            private void PopulateWeaponStats()
            {
                try {

                    Hashtable statTable = this.FetchWeaponStats();
                    if (plugin._GameVersion == GameVersion.BF3) {
                        //No need for bandwidth, all BF3 weapons are set in stone now.
                        this.Weapons = OverloadBF3Weapons();
                        if (plugin._UseHackerChecker) {
                            plugin.ConsoleWarn("Downloaded " + this.Weapons.Count + " " + plugin._GameVersion + " weapon definitions for hacker checker.");
                        }
                        return;
                    }
                    //Get Weapons
                    ArrayList statData = (ArrayList)statTable[plugin._GameVersion + ""];
                    if (statData != null && statData.Count > 0) {
                        Dictionary<String, StatLibraryWeapon> tempWeapons = new Dictionary<String, StatLibraryWeapon>();
                        foreach (Hashtable currentWeapon in statData) {
                            //Create new construct
                            StatLibraryWeapon weapon;
                            weapon = new StatLibraryWeapon {
                                                               id = (String)currentWeapon["id"],
                                                               damage_max = (Double)currentWeapon["damage_max"],
                                                               damage_min = (Double)currentWeapon["damage_min"]
                                                           };
                            tempWeapons.Add(weapon.id, weapon);
                        }
                        if (tempWeapons.Count > 0) {
                            this.Weapons = tempWeapons;
                            if (plugin._UseHackerChecker) {
                                plugin.ConsoleWarn("Downloaded " + this.Weapons.Count + " " + plugin._GameVersion + " weapon definitions for hacker checker.");
                            }
                        }
                        else {
                            this.plugin.HandleException(new AdKatsException("Valid game found, but no weapons were founds."));
                        }
                    }
                    else {
                        this.plugin.HandleException(new AdKatsException("Unable to fetch weapon stats from github. Unable to perform hacker checking."));
                    }
                }
                catch (Exception e) {
                    this.plugin.HandleException(new AdKatsException("Error while fetching weapon stats for " + plugin._GameVersion, e));
                }
            }
Example #2
0
 private Dictionary<String, StatLibraryWeapon> OverloadBF3Weapons()
 {
     //Create the game specific libraries
     Dictionary<String, StatLibraryWeapon> bf3Weapons = new Dictionary<String, StatLibraryWeapon>();
     //Add the weapons
     StatLibraryWeapon weapon;
     weapon = new StatLibraryWeapon
     {
         id = "G17C",
         damage_max = 25,
         damage_min = 13.75
     };
     bf3Weapons.Add(weapon.id, weapon);
     weapon = new StatLibraryWeapon
     {
         id = "G17C SUPP.",
         damage_max = 25,
         damage_min = 13.75
     };
     bf3Weapons.Add(weapon.id, weapon);
     weapon = new StatLibraryWeapon
     {
         id = "G17C TACT.",
         damage_max = 25,
         damage_min = 13.75
     };
     bf3Weapons.Add(weapon.id, weapon);
     weapon = new StatLibraryWeapon
     {
         id = ".44 MAGNUM",
         damage_max = 60,
         damage_min = 30
     };
     bf3Weapons.Add(weapon.id, weapon);
     weapon = new StatLibraryWeapon
     {
         id = ".44 SCOPED",
         damage_max = 60,
         damage_min = 30
     };
     bf3Weapons.Add(weapon.id, weapon);
     weapon = new StatLibraryWeapon
     {
         id = "93R",
         damage_max = 20,
         damage_min = 12.5
     };
     bf3Weapons.Add(weapon.id, weapon);
     weapon = new StatLibraryWeapon
     {
         id = "G18",
         damage_max = 20,
         damage_min = 12.5
     };
     bf3Weapons.Add(weapon.id, weapon);
     weapon = new StatLibraryWeapon
     {
         id = "G18 SUPP.",
         damage_max = 20,
         damage_min = 12.5
     };
     bf3Weapons.Add(weapon.id, weapon);
     weapon = new StatLibraryWeapon
     {
         id = "G18 TACT.",
         damage_max = 20,
         damage_min = 12.5
     };
     bf3Weapons.Add(weapon.id, weapon);
     weapon = new StatLibraryWeapon
     {
         id = "M9",
         damage_max = 25,
         damage_min = 13.75
     };
     bf3Weapons.Add(weapon.id, weapon);
     weapon = new StatLibraryWeapon
     {
         id = "M9 TACT.",
         damage_max = 25,
         damage_min = 13.75
     };
     bf3Weapons.Add(weapon.id, weapon);
     weapon = new StatLibraryWeapon
     {
         id = "M9 SUPP.",
         damage_max = 25,
         damage_min = 13.75
     };
     bf3Weapons.Add(weapon.id, weapon);
     weapon = new StatLibraryWeapon
     {
         id = "M1911",
         damage_max = 34,
         damage_min = 14.3
     };
     bf3Weapons.Add(weapon.id, weapon);
     weapon = new StatLibraryWeapon
     {
         id = "M1911 TACT.",
         damage_max = 34,
         damage_min = 14.3
     };
     bf3Weapons.Add(weapon.id, weapon);
     weapon = new StatLibraryWeapon
     {
         id = "M1911 SUPP.",
         damage_max = 34,
         damage_min = 14.3
     };
     bf3Weapons.Add(weapon.id, weapon);
     weapon = new StatLibraryWeapon
     {
         id = "M1911 S-TAC",
         damage_max = 34,
         damage_min = 14.3
     };
     bf3Weapons.Add(weapon.id, weapon);
     weapon = new StatLibraryWeapon
     {
         id = "MP412 REX",
         damage_max = 50,
         damage_min = 28
     };
     bf3Weapons.Add(weapon.id, weapon);
     weapon = new StatLibraryWeapon
     {
         id = "MP443",
         damage_max = 25,
         damage_min = 13.75
     };
     bf3Weapons.Add(weapon.id, weapon);
     weapon = new StatLibraryWeapon
     {
         id = "MP443 TACT.",
         damage_max = 25,
         damage_min = 13.75
     };
     bf3Weapons.Add(weapon.id, weapon);
     weapon = new StatLibraryWeapon
     {
         id = "MP443 SUPP.",
         damage_max = 25,
         damage_min = 13.75
     };
     bf3Weapons.Add(weapon.id, weapon);
     weapon = new StatLibraryWeapon
     {
         id = "AS VAL",
         damage_max = 20,
         damage_min = 18.4
     };
     bf3Weapons.Add(weapon.id, weapon);
     weapon = new StatLibraryWeapon
     {
         id = "M5K",
         damage_max = 25,
         damage_min = 13.75
     };
     bf3Weapons.Add(weapon.id, weapon);
     weapon = new StatLibraryWeapon
     {
         id = "MP7",
         damage_max = 20,
         damage_min = 11.2
     };
     bf3Weapons.Add(weapon.id, weapon);
     weapon = new StatLibraryWeapon
     {
         id = "P90",
         damage_max = 20,
         damage_min = 11.2
     };
     bf3Weapons.Add(weapon.id, weapon);
     weapon = new StatLibraryWeapon
     {
         id = "PDW-R",
         damage_max = 25,
         damage_min = 14.3
     };
     bf3Weapons.Add(weapon.id, weapon);
     weapon = new StatLibraryWeapon
     {
         id = "PP-19",
         damage_max = 16.7,
         damage_min = 12.5
     };
     bf3Weapons.Add(weapon.id, weapon);
     weapon = new StatLibraryWeapon
     {
         id = "PP-2000",
         damage_max = 25,
         damage_min = 13.75
     };
     bf3Weapons.Add(weapon.id, weapon);
     weapon = new StatLibraryWeapon
     {
         id = "UMP-45",
         damage_max = 34,
         damage_min = 12.5
     };
     bf3Weapons.Add(weapon.id, weapon);
     weapon = new StatLibraryWeapon
     {
         id = "JNG-90",
         damage_max = 80,
         damage_min = 59
     };
     bf3Weapons.Add(weapon.id, weapon);
     weapon = new StatLibraryWeapon
     {
         id = "L96",
         damage_max = 80,
         damage_min = 59
     };
     bf3Weapons.Add(weapon.id, weapon);
     weapon = new StatLibraryWeapon
     {
         id = "M39 EMR",
         damage_max = 50,
         damage_min = 37.5
     };
     bf3Weapons.Add(weapon.id, weapon);
     weapon = new StatLibraryWeapon
     {
         id = "M40A5",
         damage_max = 80,
         damage_min = 59
     };
     bf3Weapons.Add(weapon.id, weapon);
     weapon = new StatLibraryWeapon
     {
         id = "M98B",
         damage_max = 95,
         damage_min = 59
     };
     bf3Weapons.Add(weapon.id, weapon);
     weapon = new StatLibraryWeapon
     {
         id = "M417",
         damage_max = 50,
         damage_min = 37.5
     };
     bf3Weapons.Add(weapon.id, weapon);
     weapon = new StatLibraryWeapon
     {
         id = "MK11",
         damage_max = 50,
         damage_min = 37.5
     };
     bf3Weapons.Add(weapon.id, weapon);
     weapon = new StatLibraryWeapon
     {
         id = "QBU-88",
         damage_max = 50,
         damage_min = 37.5
     };
     bf3Weapons.Add(weapon.id, weapon);
     weapon = new StatLibraryWeapon
     {
         id = "SKS",
         damage_max = 43,
         damage_min = 27
     };
     bf3Weapons.Add(weapon.id, weapon);
     weapon = new StatLibraryWeapon
     {
         id = "SV98",
         damage_max = 80,
         damage_min = 50
     };
     bf3Weapons.Add(weapon.id, weapon);
     weapon = new StatLibraryWeapon
     {
         id = "SVD",
         damage_max = 50,
         damage_min = 37.5
     };
     bf3Weapons.Add(weapon.id, weapon);
     weapon = new StatLibraryWeapon
     {
         id = "M27 IAR",
         damage_max = 25,
         damage_min = 18.4
     };
     bf3Weapons.Add(weapon.id, weapon);
     weapon = new StatLibraryWeapon
     {
         id = "RPK-74M",
         damage_max = 25,
         damage_min = 18.4
     };
     bf3Weapons.Add(weapon.id, weapon);
     weapon = new StatLibraryWeapon
     {
         id = "L86A2",
         damage_max = 25,
         damage_min = 18.4
     };
     bf3Weapons.Add(weapon.id, weapon);
     weapon = new StatLibraryWeapon
     {
         id = "LSAT",
         damage_max = 25,
         damage_min = 18.4
     };
     bf3Weapons.Add(weapon.id, weapon);
     weapon = new StatLibraryWeapon
     {
         id = "M60E4",
         damage_max = 34,
         damage_min = 22
     };
     bf3Weapons.Add(weapon.id, weapon);
     weapon = new StatLibraryWeapon
     {
         id = "M240B",
         damage_max = 34,
         damage_min = 22
     };
     bf3Weapons.Add(weapon.id, weapon);
     weapon = new StatLibraryWeapon
     {
         id = "M249",
         damage_max = 25,
         damage_min = 18.4
     };
     bf3Weapons.Add(weapon.id, weapon);
     weapon = new StatLibraryWeapon
     {
         id = "MG36",
         damage_max = 25,
         damage_min = 18.4
     };
     bf3Weapons.Add(weapon.id, weapon);
     weapon = new StatLibraryWeapon
     {
         id = "PKP PECHENEG",
         damage_max = 34,
         damage_min = 22
     };
     bf3Weapons.Add(weapon.id, weapon);
     weapon = new StatLibraryWeapon
     {
         id = "QBB-95",
         damage_max = 25,
         damage_min = 18.4
     };
     bf3Weapons.Add(weapon.id, weapon);
     weapon = new StatLibraryWeapon
     {
         id = "TYPE 88 LMG",
         damage_max = 25,
         damage_min = 18.4
     };
     bf3Weapons.Add(weapon.id, weapon);
     weapon = new StatLibraryWeapon
     {
         id = "A-91",
         damage_max = 25,
         damage_min = 14.3
     };
     bf3Weapons.Add(weapon.id, weapon);
     weapon = new StatLibraryWeapon
     {
         id = "ACW-R",
         damage_max = 20,
         damage_min = 16.7
     };
     bf3Weapons.Add(weapon.id, weapon);
     weapon = new StatLibraryWeapon
     {
         id = "AKS-74u",
         damage_max = 25,
         damage_min = 14.3
     };
     bf3Weapons.Add(weapon.id, weapon);
     weapon = new StatLibraryWeapon
     {
         id = "G36C",
         damage_max = 25,
         damage_min = 14.3
     };
     bf3Weapons.Add(weapon.id, weapon);
     weapon = new StatLibraryWeapon
     {
         id = "G53",
         damage_max = 25,
         damage_min = 14.3
     };
     bf3Weapons.Add(weapon.id, weapon);
     weapon = new StatLibraryWeapon
     {
         id = "M4A1",
         damage_max = 25,
         damage_min = 14.3
     };
     bf3Weapons.Add(weapon.id, weapon);
     weapon = new StatLibraryWeapon
     {
         id = "MTAR-21",
         damage_max = 25,
         damage_min = 14.3
     };
     bf3Weapons.Add(weapon.id, weapon);
     weapon = new StatLibraryWeapon
     {
         id = "QBZ-95B",
         damage_max = 25,
         damage_min = 14.3
     };
     bf3Weapons.Add(weapon.id, weapon);
     weapon = new StatLibraryWeapon
     {
         id = "SCAR-H",
         damage_max = 30,
         damage_min = 20
     };
     bf3Weapons.Add(weapon.id, weapon);
     weapon = new StatLibraryWeapon
     {
         id = "SG553",
         damage_max = 25,
         damage_min = 14.3
     };
     bf3Weapons.Add(weapon.id, weapon);
     weapon = new StatLibraryWeapon
     {
         id = "M4",
         damage_max = 25,
         damage_min = 14.3
     };
     bf3Weapons.Add(weapon.id, weapon);
     weapon = new StatLibraryWeapon
     {
         id = "AEK-971",
         damage_max = 25,
         damage_min = 18.4
     };
     bf3Weapons.Add(weapon.id, weapon);
     weapon = new StatLibraryWeapon
     {
         id = "AK-74M",
         damage_max = 25,
         damage_min = 18.4
     };
     bf3Weapons.Add(weapon.id, weapon);
     weapon = new StatLibraryWeapon
     {
         id = "AN-94",
         damage_max = 25,
         damage_min = 18.4
     };
     bf3Weapons.Add(weapon.id, weapon);
     weapon = new StatLibraryWeapon
     {
         id = "AUG A3",
         damage_max = 25,
         damage_min = 18.4
     };
     bf3Weapons.Add(weapon.id, weapon);
     weapon = new StatLibraryWeapon
     {
         id = "F2000",
         damage_max = 25,
         damage_min = 18.4
     };
     bf3Weapons.Add(weapon.id, weapon);
     weapon = new StatLibraryWeapon
     {
         id = "FAMAS",
         damage_max = 25,
         damage_min = 18.4
     };
     bf3Weapons.Add(weapon.id, weapon);
     weapon = new StatLibraryWeapon
     {
         id = "G3A3",
         damage_max = 34,
         damage_min = 22
     };
     bf3Weapons.Add(weapon.id, weapon);
     weapon = new StatLibraryWeapon
     {
         id = "KH2002",
         damage_max = 25,
         damage_min = 18.4
     };
     bf3Weapons.Add(weapon.id, weapon);
     weapon = new StatLibraryWeapon
     {
         id = "L85A2",
         damage_max = 25,
         damage_min = 18.4
     };
     bf3Weapons.Add(weapon.id, weapon);
     weapon = new StatLibraryWeapon
     {
         id = "M16A3",
         damage_max = 25,
         damage_min = 18.4
     };
     bf3Weapons.Add(weapon.id, weapon);
     weapon = new StatLibraryWeapon
     {
         id = "M416",
         damage_max = 25,
         damage_min = 18.4
     };
     bf3Weapons.Add(weapon.id, weapon);
     weapon = new StatLibraryWeapon
     {
         id = "SCAR-L",
         damage_max = 25,
         damage_min = 18.4
     };
     bf3Weapons.Add(weapon.id, weapon);
     weapon = new StatLibraryWeapon
     {
         id = "M16A4",
         damage_max = 25,
         damage_min = 18.4
     };
     bf3Weapons.Add(weapon.id, weapon);
     weapon = new StatLibraryWeapon
     {
         id = "XBOW",
         damage_max = 100,
         damage_min = 10
     };
     bf3Weapons.Add(weapon.id, weapon);
     weapon = new StatLibraryWeapon
     {
         id = "XBOW SCOPED",
         damage_max = 100,
         damage_min = 10
     };
     bf3Weapons.Add(weapon.id, weapon);
     weapon = new StatLibraryWeapon
     {
         id = "M320",
         damage_max = 100,
         damage_min = 1
     };
     bf3Weapons.Add(weapon.id, weapon);
     weapon = new StatLibraryWeapon
     {
         id = "M26",
         damage_max = 100,
         damage_min = 1
     };
     bf3Weapons.Add(weapon.id, weapon);
     weapon = new StatLibraryWeapon
     {
         id = "M26 MASS",
         damage_max = 100,
         damage_min = 1
     };
     bf3Weapons.Add(weapon.id, weapon);
     weapon = new StatLibraryWeapon
     {
         id = "M26 SLUG",
         damage_max = 100,
         damage_min = 1
     };
     bf3Weapons.Add(weapon.id, weapon);
     weapon = new StatLibraryWeapon
     {
         id = "M26 FRAG",
         damage_max = 100,
         damage_min = 1
     };
     bf3Weapons.Add(weapon.id, weapon);
     return bf3Weapons;
 }