public static void UpdateRewardGrid(string newRewardId = null) { guiScript?.rewardGrid.Clear(); if (Plugin.Instance?.twitchRewards == null) { return; } foreach (Reward reward in Plugin.Instance.twitchRewards.Data) { try { var customReward = Plugin.Instance.twitchCustomRewards.Data.Exists(x => x.Id == reward.Id); //Log.Info($"Reward: {reward.Title} - custom: {customReward}"); var title = reward.Title; var data = RewardsConfig.Get(reward.Id); var color = Colors.FromHex(reward.BackgroundColor); var texture = TextureLoader.LoadFromURL((reward.Image ?? reward.DefaultImage).Url4x); var rewardGridItem = new RewardGridItem(reward.Id, title, color, texture, customReward, data); bool isNew = newRewardId == reward.Id; guiScript.rewardGrid.Add(rewardGridItem, isNew); } catch (Exception e) { Log.Error(e.ToString()); //Log.Warning($"Reward image unavailable: {reward.Title}"); } } }
/// <summary> /// Initializes a new instance of the <see cref="PoolConfig"/> class. /// </summary> /// <param name="config">The configuration.</param> /// <param name="coinConfig"></param> public PoolConfig(dynamic config, ICoinConfig coinConfig) { try { Enabled = config.enabled ? config.enabled : false; if (Enabled == false) // if the configuration is not enabled { return; // just skip reading rest of the parameters. } Coin = coinConfig; // assign the coin config. // load the sections. Daemon = new DaemonConfig(config.daemon); Meta = new MetaConfig(config.meta); Wallet = new WalletConfig(config.wallet); Rewards = new RewardsConfig(config.rewards); Payments = new PaymentConfig(config.payments); Miner = new MinerConfig(config.miner); Job = new JobConfig(config.job); Stratum = new StratumServerConfig(config.stratum); Banning = new BanConfig(config.banning); Storage = new RedisConfig(config.storage.redis); Vanilla = new VanillaServerConfig(config.vanilla); Valid = true; } catch (Exception e) { Valid = false; Log.Logger.ForContext <PoolConfig>().Error(e, "Error loading pool configuration"); } }
/// <summary> /// Initializes a new instance of the <see cref="PoolConfig"/> class. /// </summary> /// <param name="config">The configuration.</param> /// <param name="coinConfig"></param> public PoolConfig(dynamic config, ICoinConfig coinConfig) { try { _logger = Log.ForContext <PoolConfig>().ForContext("Component", coinConfig.Name); Enabled = config.enabled ? config.enabled : false; if (Enabled == false) // if the configuration is not enabled { return; // just skip reading rest of the parameters. } Coin = coinConfig; // assign the coin config. // load the sections. Daemon = new DaemonConfig(config.daemon); Meta = new MetaConfig(config.meta); Wallet = new WalletConfig(config.wallet); Rewards = new RewardsConfig(config.rewards); Payments = new PaymentConfig(config.payments); Miner = new MinerConfig(config.miner); Job = new JobConfig(config.job); Stratum = new StratumServerConfig(config.stratum); Banning = new BanConfig(config.banning); Storage = new StorageConfig(config.storage); Vanilla = new VanillaServerConfig(config.vanilla); // process extra checks if (Storage.Layer is MposStorageLayerConfig) { if (Payments.Enabled) { Payments.Disable(); _logger.Information("Disabled payments processor as it can not be enabled when MPOS mode is on"); } } Valid = true; } catch (Exception e) { Valid = false; _logger.Error(e, "Error loading pool configuration"); } }
private static void OnRewardSettingschanged(object sender, SettingsChangedArgs e) { var key = guiScript.rewardSettings.reward.id; if (e.Data is RavenMessageData) { RewardsConfig.Set(key, e.Data as RavenMessageData); } else if (e.Data is SpawnCreatureData) { RewardsConfig.Set(key, e.Data as SpawnCreatureData); } else if (e.Data is HUDMessageData) { RewardsConfig.Set(key, e.Data as HUDMessageData); } else { RewardsConfig.Set(key, e.Data); } UpdateRewardGrid(); }