public static bool CanSpawn() { if (Main.Instance.AllItems.Where(x => x.Id == 1).ToList().Count > 0) { return(false); } if (MeetingHud.Instance) { return(false); } if (!AmongUsClient.Instance.IsGameStarted) { return(false); } if (ItemRandom.Next(0, 100000) > ItemSpawnChance) { return(false); } if (HasSpawned && Main.Instance.Config.SingleItem) { return(false); } return(true); }
static ScratchCardSystem() { ItemRandom ItemInfo; uint[] SupplyTypeID; RandomWeight = new ItemRandomClass(); try { if (File.Exists("Json/ScratchCard.json")) { SupplyTypeID = new uint[4]; foreach (var item in JsonValue.ParseFile("Json/ScratchCard.json")["ScratchCardData"].AsJsonArray) { SupplyTypeID[0] = (uint)item["SupplyTypeID"].AsInteger; SupplyTypeID[1] = (uint)item["SupplyTypeID2"].AsInteger; SupplyTypeID[2] = (uint)item["SupplyTypeID3"].AsInteger; SupplyTypeID[3] = (uint)item["SupplyTypeID4"].AsInteger; foreach (var Reward in item["Items"].AsJsonArray) { ItemInfo = new ItemRandom() { TypeId = (uint)Reward["TypeID"].AsInteger, MaxQuantity = (uint)Reward["MaxQuan"].AsInteger, RareType = (uint)Reward["TypeRare"].AsInteger, Probs = (ushort)Reward["Probability"].AsInteger, Active = Reward["Valid"].AsBoolean }; RandomWeight.AddItems(ItemInfo); } } RandomWeight.AddSupply(SupplyTypeID[0]); RandomWeight.AddSupply(SupplyTypeID[1]); RandomWeight.AddSupply(SupplyTypeID[2]); RandomWeight.AddSupply(SupplyTypeID[3]); RandomWeight.SetCanDup(false); } else { throw new Exception(" ScratchCard.json file in folder not found !"); } } catch (Exception ex) { WriteConsole.WriteLine(ex.Message, ConsoleColor.Red); Console.ReadKey(); Environment.Exit(0); } }
public override int GetHashCode() { int hash = 1; if (MissionId != 0) { hash ^= MissionId.GetHashCode(); } if (ItemRandom != 0) { hash ^= ItemRandom.GetHashCode(); } hash ^= award_.GetHashCode(); if (MissionDesc.Length != 0) { hash ^= MissionDesc.GetHashCode(); } return(hash); }