Exemplo n.º 1
0
        public CombatAssistantFeatureForm(IWurmApi wurmApi, ILogger logger, FeatureSettings featureSettings,
                                          IProcessStarter processStarter)
        {
            if (wurmApi == null)
            {
                throw new ArgumentNullException(nameof(wurmApi));
            }
            if (logger == null)
            {
                throw new ArgumentNullException(nameof(logger));
            }
            if (featureSettings == null)
            {
                throw new ArgumentNullException(nameof(featureSettings));
            }
            if (processStarter == null)
            {
                throw new ArgumentNullException(nameof(processStarter));
            }
            this.wurmApi         = wurmApi;
            this.logger          = logger;
            this.featureSettings = featureSettings;
            this.processStarter  = processStarter;

            InitializeComponent();
            var characters =
                wurmApi.Characters.All.Select(character => character.Name.Capitalized).Cast <object>().ToArray();

            wurmCharacterCbox.Items.AddRange(characters);
            historicCharacterCbox.Items.AddRange(characters);
        }
Exemplo n.º 2
0
        public SkillStatsFeatureForm(SkillStatsFeature feature, IWurmApi wurmApi, ILogger logger, [NotNull] ITelemetry telemetry)
        {
            if (feature == null)
            {
                throw new ArgumentNullException("feature");
            }
            if (wurmApi == null)
            {
                throw new ArgumentNullException("wurmApi");
            }
            if (logger == null)
            {
                throw new ArgumentNullException("logger");
            }
            this.feature   = feature;
            this.wurmApi   = wurmApi;
            this.logger    = logger;
            this.telemetry = telemetry ?? throw new ArgumentNullException(nameof(telemetry));
            InitializeComponent();

            var allChars = this.wurmApi.Characters.All.Select(character => character).ToArray();

            liveMonCharacterCbox.Items.AddRange(
                allChars.Select(character => character.Name.Capitalized).Cast <object>().ToArray());
            queryGameCharsCblist.Items.AddRange(allChars.Cast <object>().ToArray());
            var serverGroups = this.wurmApi.ServerGroups.AllKnown;

            serverGroupCbox.Items.AddRange(serverGroups.Select(group => group.ServerGroupId).Cast <object>().ToArray());

            SetToday();
        }
Exemplo n.º 3
0
        public LogSearchForm([NotNull] IWurmApi wurmApi, [NotNull] ILogger logger, [NotNull] ITelemetry telemetry)
        {
            this.wurmApi   = wurmApi ?? throw new ArgumentNullException(nameof(wurmApi));
            this.logger    = logger ?? throw new ArgumentNullException(nameof(logger));
            this.telemetry = telemetry ?? throw new ArgumentNullException(nameof(telemetry));

            InitializeComponent();
            lastVisibleWindowState = this.WindowState;

            comboBoxPlayerName.Items.AddRange(
                wurmApi.Characters.All.Select(character => (object)character.Name).ToArray());
            comboBoxLogType.Items.AddRange(wurmApi.LogDefinitions.AllLogTypes.Select(type => (object)type.ToString()).ToArray());
            comboBoxSearchType.Items.AddRange(SearchTypes.Select(type => (object)type.ToString()).ToArray());

            dateTimePickerTimeFrom.Value = DateTime.Now;
            dateTimePickerTimeTo.Value   = DateTime.Now;

            comboBoxLogType.Text    = LogType.Event.ToString();
            comboBoxSearchType.Text = SearchTypeId.RegexEscapedCaseIns.ToString();

            if (comboBoxPlayerName.Items.Count > 0)
            {
                comboBoxPlayerName.Text = comboBoxPlayerName.Items[0].ToString();
            }
        }
Exemplo n.º 4
0
 public WurmTimer(
     string persistentObjectId,
     [NotNull] ITrayPopups trayPopups,
     [NotNull] ILogger logger,
     [NotNull] IWurmApi wurmApi,
     [NotNull] ISoundManager soundManager,
     [NotNull] ITelemetry telemetry) : base(persistentObjectId)
 {
     Id = Guid.Parse(persistentObjectId);
     if (trayPopups == null)
     {
         throw new ArgumentNullException("trayPopups");
     }
     if (logger == null)
     {
         throw new ArgumentNullException("logger");
     }
     if (wurmApi == null)
     {
         throw new ArgumentNullException("wurmApi");
     }
     if (soundManager == null)
     {
         throw new ArgumentNullException("soundManager");
     }
     this.TrayPopups   = trayPopups;
     this.Logger       = logger;
     this.WurmApi      = wurmApi;
     this.SoundManager = soundManager;
     this.telemetry    = telemetry ?? throw new ArgumentNullException(nameof(telemetry));
 }
Exemplo n.º 5
0
        public LiveSessionForm(string gameChar, IWurmApi wurmApi, ILogger logger)
        {
            if (gameChar == null)
            {
                throw new ArgumentNullException("gameChar");
            }
            if (wurmApi == null)
            {
                throw new ArgumentNullException("wurmApi");
            }
            if (logger == null)
            {
                throw new ArgumentNullException("logger");
            }
            this.gameChar = gameChar;
            this.wurmApi  = wurmApi;
            this.logger   = logger;
            InitializeComponent();

            Text = "Skills monitor " + gameChar;

            wurmCharacter = wurmApi.Characters.Get(gameChar);

            objectListView.SetObjects(reportItems);
            descBase = gameChar + " (since: " + DateTime.Now.ToString("g") + ")";
            stopwatch.Start();

            Collecting = true;
            timer.Start();

            wurmCharacter.Skills.SkillsChanged += SkillsOnSkillsChanged;
        }
Exemplo n.º 6
0
 public CombatAssistantFeature(IWurmApi wurmApi, ILogger logger, FeatureSettings featureSettings,
                               IProcessStarter processStarter)
 {
     if (wurmApi == null)
     {
         throw new ArgumentNullException("wurmApi");
     }
     if (logger == null)
     {
         throw new ArgumentNullException("logger");
     }
     if (featureSettings == null)
     {
         throw new ArgumentNullException("featureSettings");
     }
     if (processStarter == null)
     {
         throw new ArgumentNullException("processStarter");
     }
     this.wurmApi         = wurmApi;
     this.logger          = logger;
     this.featureSettings = featureSettings;
     this.processStarter  = processStarter;
     form = new CombatAssistantFeatureForm(wurmApi, logger, featureSettings, processStarter);
 }
Exemplo n.º 7
0
        public RevealCreaturesForm(IWurmApi wurmApi, ILogger logger)
        {
            if (wurmApi == null)
            {
                throw new ArgumentNullException("wurmApi");
            }
            if (logger == null)
            {
                throw new ArgumentNullException("logger");
            }
            this.wurmApi = wurmApi;
            this.logger  = logger;
            InitializeComponent();

            ClearOutput();

            filter = new TextMatchFilter(resultsView,
                                         "",
                                         StringComparison.InvariantCultureIgnoreCase);

            resultsView.DefaultRenderer =
                new HighlightTextRenderer(filter);

            gameChar.Items.AddRange(
                wurmApi.Characters.All.Select(character => character.Name.Capitalized).Cast <object>().ToArray());
        }
Exemplo n.º 8
0
        public Widget(string characterName, IWurmApi wurmApi, ILogger logger)
        {
            if (characterName == null)
            {
                throw new ArgumentNullException("characterName");
            }
            if (wurmApi == null)
            {
                throw new ArgumentNullException("wurmApi");
            }
            if (logger == null)
            {
                throw new ArgumentNullException("logger");
            }
            this.characterName = characterName;
            this.wurmApi       = wurmApi;
            this.logger        = logger;
            InitializeComponent();

            actionLbl.Text    = string.Empty;
            widgetModeManager = new WidgetModeManager(this);
            widgetModeManager.Set(true);
            widgetModeManager.WidgetModeChanging += (sender, args) =>
            {
                widgetHelpLbl.Visible = !args.WidgetMode;
            };
        }
Exemplo n.º 9
0
 public TimersForm([NotNull] TimersFeature timersFeature, [NotNull] ILogger logger, [NotNull] IWurmApi wurmApi,
                   [NotNull] TimerDefinitions timerDefinitions)
 {
     if (timersFeature == null)
     {
         throw new ArgumentNullException("timersFeature");
     }
     if (logger == null)
     {
         throw new ArgumentNullException("logger");
     }
     if (wurmApi == null)
     {
         throw new ArgumentNullException("wurmApi");
     }
     if (timerDefinitions == null)
     {
         throw new ArgumentNullException("timerDefinitions");
     }
     this.timersFeature    = timersFeature;
     this.logger           = logger;
     this.wurmApi          = wurmApi;
     this.timerDefinitions = timerDefinitions;
     InitializeComponent();
     widgetManager = new WidgetModeManager(this);
     widgetManager.WidgetModeChanging += (sender, args) =>
     {
         buttonAddRemoveChars.Visible
                   = buttonCustomTimers.Visible
                   = buttonOptions.Visible
                   = label1.Visible
                   = !args.WidgetMode;
     };
 }
Exemplo n.º 10
0
 public WurmUnlimitedLogsDirChecker([NotNull] IWurmApi wurmApi, [NotNull] IUserNotifier userNotifier,
                                    [NotNull] IWurmAssistantConfig wurmAssistantConfig)
 {
     this.wurmPaths           = wurmApi.Paths ?? throw new ArgumentNullException(nameof(wurmPaths));
     this.wurmCharacters      = wurmApi.Characters ?? throw new ArgumentNullException(nameof(wurmCharacters));
     this.userNotifier        = userNotifier ?? throw new ArgumentNullException(nameof(userNotifier));
     this.wurmAssistantConfig = wurmAssistantConfig ?? throw new ArgumentNullException(nameof(wurmAssistantConfig));
 }
Exemplo n.º 11
0
        public CalendarFeature(
            [NotNull] IWurmApi wurmApi,
            [NotNull] ILogger logger,
            [NotNull] ITimerFactory timerFactory,
            [NotNull] ISoundManager soundManager,
            [NotNull] ITrayPopups trayPopups,
            [NotNull] WurmSeasonsManager seasonsManager)
        {
            if (wurmApi == null)
            {
                throw new ArgumentNullException(nameof(wurmApi));
            }
            if (logger == null)
            {
                throw new ArgumentNullException(nameof(logger));
            }
            if (timerFactory == null)
            {
                throw new ArgumentNullException(nameof(timerFactory));
            }
            if (soundManager == null)
            {
                throw new ArgumentNullException(nameof(soundManager));
            }
            if (trayPopups == null)
            {
                throw new ArgumentNullException(nameof(trayPopups));
            }
            if (seasonsManager == null)
            {
                throw new ArgumentNullException(nameof(seasonsManager));
            }
            this.wurmApi        = wurmApi;
            this.logger         = logger;
            this.soundManager   = soundManager;
            this.trayPopups     = trayPopups;
            this.seasonsManager = seasonsManager;

            useWurmTimeForDisplay = false;
            soundWarning          = false;
            soundId        = Guid.Empty;
            popupWarning   = false;
            trackedSeasons = new string[0];
            serverName     = "";
            mainWindowSize = new System.Drawing.Size(487, 414);

            updateTimer          = timerFactory.CreateUiThreadTimer();
            updateTimer.Interval = TimeSpan.FromMilliseconds(500);
            updateTimer.Tick    += (sender, args) =>
            {
                ObtainWdtForCurrentServer();
                if (hasWdt)
                {
                    UpdateOutputList();
                }
            };
            seasonsManager.DataChanged += SeasonsManagerOnDataChanged;
        }
Exemplo n.º 12
0
        public ActiveTriggers(
            string characterName,
            [NotNull] ISoundManager soundManager,
            [NotNull] ITrayPopups trayPopups,
            [NotNull] IWurmApi wurmApi,
            [NotNull] ILogger logger,
            [NotNull] IActionQueueConditions actionQueueConditions,
            [NotNull] TriggersDataContext triggersDataContext,
            [NotNull] ITelemetry telemetry)
        {
            if (soundManager == null)
            {
                throw new ArgumentNullException(nameof(soundManager));
            }
            if (trayPopups == null)
            {
                throw new ArgumentNullException(nameof(trayPopups));
            }
            if (wurmApi == null)
            {
                throw new ArgumentNullException(nameof(wurmApi));
            }
            if (logger == null)
            {
                throw new ArgumentNullException(nameof(logger));
            }
            if (actionQueueConditions == null)
            {
                throw new ArgumentNullException(nameof(actionQueueConditions));
            }
            if (triggersDataContext == null)
            {
                throw new ArgumentNullException(nameof(triggersDataContext));
            }

            CharacterName = characterName;

            this.soundManager          = soundManager;
            this.trayPopups            = trayPopups;
            this.wurmApi               = wurmApi;
            this.logger                = logger;
            this.actionQueueConditions = actionQueueConditions;
            this.telemetry             = telemetry ?? throw new ArgumentNullException(nameof(telemetry));
            this.triggersConfig        = triggersDataContext.CharacterTriggersConfigs.GetOrCreate(characterName);

            foreach (var entity in triggersConfig.TriggerEntities.Values)
            {
                try
                {
                    triggers.Add(entity.TriggerId, BuildTrigger(entity));
                }
                catch (Exception exception)
                {
                    logger.Error(exception,
                                 string.Format("Error initializing trigger id {0}, name: {1}", entity.TriggerId, entity.Name));
                }
            }
        }
Exemplo n.º 13
0
 public CustomTimer(string persistentObjectId, IWurmApi wurmApi, ILogger logger, ISoundManager soundManager,
                    ITrayPopups trayPopups)
     : base(persistentObjectId, trayPopups, logger, wurmApi, soundManager)
 {
     if (logger == null)
     {
         throw new ArgumentNullException("logger");
     }
     this.logger = logger;
 }
Exemplo n.º 14
0
 public FormChoosePlayers(IReadOnlyCollection <string> currentPlayers, IWurmApi wurmApi)
 {
     InitializeComponent();
     string[] allPlayers = wurmApi.Characters.All.Select(character => character.Name.Capitalized)
                           .Union(currentPlayers).Distinct().ToArray();
     foreach (var player in allPlayers)
     {
         checkedListBoxPlayers.Items.Add(player, currentPlayers.Contains(player));
     }
     BuildResult();
 }
Exemplo n.º 15
0
 public LogsFeedManager(
     [NotNull] GrangerFeature parentModule,
     [NotNull] GrangerContext context,
     [NotNull] IWurmApi wurmApi,
     [NotNull] ILogger logger,
     [NotNull] ITrayPopups trayPopups,
     [NotNull] IWurmAssistantConfig wurmAssistantConfig,
     [NotNull] CreatureColorDefinitions creatureColorDefinitions,
     [NotNull] GrangerSettings grangerSettings,
     [NotNull] ITelemetry telemetry)
 {
     if (parentModule == null)
     {
         throw new ArgumentNullException(nameof(parentModule));
     }
     if (context == null)
     {
         throw new ArgumentNullException(nameof(context));
     }
     if (wurmApi == null)
     {
         throw new ArgumentNullException(nameof(wurmApi));
     }
     if (logger == null)
     {
         throw new ArgumentNullException(nameof(logger));
     }
     if (trayPopups == null)
     {
         throw new ArgumentNullException(nameof(trayPopups));
     }
     if (wurmAssistantConfig == null)
     {
         throw new ArgumentNullException(nameof(wurmAssistantConfig));
     }
     if (creatureColorDefinitions == null)
     {
         throw new ArgumentNullException(nameof(creatureColorDefinitions));
     }
     if (grangerSettings == null)
     {
         throw new ArgumentNullException(nameof(grangerSettings));
     }
     this.parentModule             = parentModule;
     this.context                  = context;
     this.wurmApi                  = wurmApi;
     this.logger                   = logger;
     this.trayPopups               = trayPopups;
     this.wurmAssistantConfig      = wurmAssistantConfig;
     this.creatureColorDefinitions = creatureColorDefinitions;
     this.grangerSettings          = grangerSettings;
     this.telemetry                = telemetry ?? throw new ArgumentNullException(nameof(telemetry));
 }
Exemplo n.º 16
0
 public WurmClientValidator([NotNull] IWurmApi wurmApi, [NotNull] IWurmAssistantConfig config)
 {
     if (wurmApi == null)
     {
         throw new ArgumentNullException(nameof(wurmApi));
     }
     if (config == null)
     {
         throw new ArgumentNullException(nameof(config));
     }
     this.wurmApi = wurmApi;
     this.config  = config;
 }
Exemplo n.º 17
0
 void Form1_Load(object sender, EventArgs e)
 {
     wurmApi = WurmApiFactory.Create(
         new WurmApiCreationOptions()
     {
         WurmApiLogger          = new WumrApiLogger(textBox1),
         WurmApiEventMarshaller = new Marshaller(this),
         WurmApiConfig          = new WurmApiConfig()
         {
             PersistenceMethod = WurmApiPersistenceMethod.FlatFiles
         }
     });
 }
Exemplo n.º 18
0
 public LogSearchFeature([NotNull] IWurmApi wurmApi, [NotNull] ILogger logger)
 {
     if (wurmApi == null)
     {
         throw new ArgumentNullException("wurmApi");
     }
     if (logger == null)
     {
         throw new ArgumentNullException("logger");
     }
     this.wurmApi = wurmApi;
     this.logger  = logger;
 }
Exemplo n.º 19
0
 public SkillStatsFeature(IWurmApi wurmApi, ILogger logger)
 {
     if (wurmApi == null)
     {
         throw new ArgumentNullException("wurmApi");
     }
     if (logger == null)
     {
         throw new ArgumentNullException("logger");
     }
     this.wurmApi = wurmApi;
     this.logger  = logger;
     form         = new SkillStatsFeatureForm(this, wurmApi, logger);
 }
Exemplo n.º 20
0
 public LogSearchFeature([NotNull] IWurmApi wurmApi, [NotNull] ILogger logger, [NotNull] ITelemetry telemetry)
 {
     if (wurmApi == null)
     {
         throw new ArgumentNullException("wurmApi");
     }
     if (logger == null)
     {
         throw new ArgumentNullException("logger");
     }
     this.wurmApi   = wurmApi;
     this.logger    = logger;
     this.telemetry = telemetry ?? throw new ArgumentNullException(nameof(telemetry));
 }
Exemplo n.º 21
0
        public CraftingAssistantFeature(IWurmApi wurmApi, ILogger logger)
        {
            if (wurmApi == null)
            {
                throw new ArgumentNullException("wurmApi");
            }
            if (logger == null)
            {
                throw new ArgumentNullException("logger");
            }
            this.wurmApi = wurmApi;
            this.logger  = logger;

            form = new CraftingAssistantForm(wurmApi, logger);
        }
Exemplo n.º 22
0
        public RevealCreaturesFeature(IWurmApi wurmApi, ILogger logger)
        {
            if (wurmApi == null)
            {
                throw new ArgumentNullException("wurmApi");
            }
            if (logger == null)
            {
                throw new ArgumentNullException("logger");
            }
            this.wurmApi = wurmApi;
            this.logger  = logger;

            form = new RevealCreaturesForm(wurmApi, logger);
        }
Exemplo n.º 23
0
        public ServersEditorForm([NotNull] ServerInfoManager serverInfoManager, IWurmApi wurmApi)
        {
            if (serverInfoManager == null)
            {
                throw new ArgumentNullException("serverInfoManager");
            }
            this.serverInfoManager = serverInfoManager;
            InitializeComponent();

            currentMappings         = new BindingList <WurmServerInfo>(wurmApi.ServersList.All.ToArray());
            defaultsGrid.DataSource = currentMappings;

            customMappings = new BindingList <ServerInformation>(
                serverInfoManager.GetAllMappings().ToList());
            customGrid.DataSource = customMappings;
        }
Exemplo n.º 24
0
        public LogSearchEventsParser(LogSearchParameters logSearchParameters, IWurmApi wurmApi, ILogger logger)
        {
            if (logSearchParameters == null)
            {
                throw new ArgumentNullException("logSearchParameters");
            }
            if (wurmApi == null)
            {
                throw new ArgumentNullException("wurmApi");
            }
            this.logSearchParameters = logSearchParameters;
            this.wurmApi             = wurmApi;

            CombatStatus = new CombatStatus(logSearchParameters.CharacterName);
            processor    = new CombatResultsProcessor(CombatStatus, logger, wurmApi);
        }
 public CustomTimersManagerForm([NotNull] IWurmApi wurmApi,
                                [NotNull] TimerDefinitions timerDefinitions)
 {
     if (wurmApi == null)
     {
         throw new ArgumentNullException("wurmApi");
     }
     if (timerDefinitions == null)
     {
         throw new ArgumentNullException("timerDefinitions");
     }
     this.wurmApi          = wurmApi;
     this.timerDefinitions = timerDefinitions;
     InitializeComponent();
     ReloadList();
 }
Exemplo n.º 26
0
        public CraftingAssistantForm(IWurmApi wurmApi, ILogger logger)
        {
            if (wurmApi == null)
            {
                throw new ArgumentNullException("wurmApi");
            }
            if (logger == null)
            {
                throw new ArgumentNullException("logger");
            }
            this.wurmApi = wurmApi;
            this.logger  = logger;
            InitializeComponent();

            gameCharactersCmb.Items.AddRange(
                wurmApi.Characters.All.Select(character => character.Name.Capitalized).Cast <object>().ToArray());
        }
        public CustomTimersManagerEditForm([NotNull] IWurmApi wurmApi, [NotNull] TimerDefinition definition,
                                           [NotNull] TimerDefinitions timerDefinitions)
        {
            if (wurmApi == null)
            {
                throw new ArgumentNullException("wurmApi");
            }
            if (definition == null)
            {
                throw new ArgumentNullException("definition");
            }
            if (timerDefinitions == null)
            {
                throw new ArgumentNullException("timerDefinitions");
            }
            this.wurmApi          = wurmApi;
            this.timerDefinitions = timerDefinitions;
            this.definition       = definition;

            InitializeComponent();

            foreach (var type in wurmApi.LogDefinitions.AllLogTypes)
            {
                comboBoxLogType.Items.Add(type);
            }
            comboBoxLogType.SelectedItem = LogType.Event;

            CustomTimerDefinition options = definition.CustomTimerConfig ?? new CustomTimerDefinition();

            textBoxTimerName.Text = definition.Name;
            if (options.TriggerConditions != null)
            {
                textBoxCond.Text = options.TriggerConditions[0].RegexPattern;
                if (!options.IsRegex)
                {
                    textBoxCond.Text = Regex.Unescape(textBoxCond.Text);
                }
                else
                {
                    checkBoxAsRegex.Checked = true;
                }
                comboBoxLogType.SelectedItem = options.TriggerConditions[0].LogType;
            }
            timeInputUControl2.Value    = options.Duration;
            checkBoxUptimeReset.Checked = options.ResetOnUptime;
        }
Exemplo n.º 28
0
        public TriggerBase([NotNull] TriggerEntity triggerEntity, [NotNull] ISoundManager soundManager, [NotNull] ITrayPopups trayPopups,
                           [NotNull] IWurmApi wurmApi, [NotNull] ILogger logger,
                           [NotNull] ITelemetry telemetry)
        {
            if (triggerEntity == null)
            {
                throw new ArgumentNullException("triggerEntity");
            }
            if (soundManager == null)
            {
                throw new ArgumentNullException("soundManager");
            }
            if (trayPopups == null)
            {
                throw new ArgumentNullException("trayPopups");
            }
            if (wurmApi == null)
            {
                throw new ArgumentNullException("wurmApi");
            }
            if (logger == null)
            {
                throw new ArgumentNullException("logger");
            }
            this.TriggerEntity = triggerEntity;
            this.SoundManager  = soundManager;
            this.TrayPopups    = trayPopups;
            this.WurmApi       = wurmApi;
            this.Logger        = logger;
            this.telemetry     = telemetry ?? throw new ArgumentNullException(nameof(telemetry));

            MuteChecker = () => false;
            Active      = true;

            if (triggerEntity.HasSound)
            {
                Sound = new SoundNotifier(this, soundManager);
            }
            if (triggerEntity.HasPopup)
            {
                Popup = new PopupNotifier(this, trayPopups);
            }

            telemetry.TrackEvent($"Triggers: initialized trigger {this.GetType().Name}");
        }
Exemplo n.º 29
0
        public CombatResultsProcessor(CombatStatus combatStatus, ILogger logger, IWurmApi wurmApi)
        {
            if (combatStatus == null)
            {
                throw new ArgumentNullException("combatStatus");
            }
            if (logger == null)
            {
                throw new ArgumentNullException("logger");
            }
            this.combatStatus = combatStatus;
            this.logger       = logger;

            damageEntryParser = new DamageEntryParser(logger);
            skillEntryParser  = new SkillEntryParser(wurmApi);

            SetupRules();
        }
Exemplo n.º 30
0
        public TriggerBaseConfig(TriggerBase trigger, [NotNull] IWurmApi wurmApi, [NotNull] ILogger logger)
        {
            if (wurmApi == null)
            {
                throw new ArgumentNullException("wurmApi");
            }
            if (logger == null)
            {
                throw new ArgumentNullException("logger");
            }
            this.trigger = trigger;
            this.wurmApi = wurmApi;
            this.logger  = logger;
            InitializeComponent();
            toolTip1.SetToolTip(ResetOnCndHitChkbox, "Every time condition is hit, cooldown will be set to full duration (including when trigger is already on cooldown). Useful for new chat message triggers.".WrapLines());

            TriggerNameTbox.Text             = trigger.Name;
            ApplicableLogsDisplayTxtbox.Text = trigger.LogTypesAspect;
            foreach (var logType in wurmApi.LogDefinitions.AllLogTypes)
            {
                LogTypesChklist.Items.Add(logType, trigger.CheckLogType(logType));
            }
            if (trigger.LogTypesLocked)
            {
                LogTypesChklist.Enabled = false;
            }
            CooldownEnabledChkbox.Checked
                                        = ResetOnCndHitChkbox.Enabled
                                        = CooldownInput.Enabled
                                        = trigger.CooldownEnabled;
            CooldownInput.Value         = trigger.Cooldown;
            ResetOnCndHitChkbox.Checked = this.trigger.ResetOnConditonHit;
            if (this.trigger.DefaultDelayFunctionalityDisabled)
            {
                DelayChkbox.Enabled = DelayInput.Enabled = false;
            }
            else
            {
                DelayChkbox.Checked = DelayInput.Enabled = this.trigger.DelayEnabled;
                DelayInput.Value    = this.trigger.Delay;
            }

            initComplete = true;
        }
Exemplo n.º 31
0
        void ConstructWurmApi(IWurmAssistantConfig config, LoggerFactory loggerFactory, IEventMarshaller eventMarshaller)
        {
            IWurmInstallDirectory wurmInstallDirectory = null;
            if (!string.IsNullOrWhiteSpace(config.WurmGameClientInstallDirectory))
            {
                wurmInstallDirectory = new WurmInstallDirectoryOverride()
                {
                    FullPath = config.WurmGameClientInstallDirectory
                };
            }

            WurmApiConfig wurmApiConfig = null;
            if (config.RunningPlatform != Platform.Unknown)
            {
                wurmApiConfig = new WurmApiConfig {Platform = config.RunningPlatform};
            }

            wurmApi = WurmApiFactory.Create(Path.Combine(config.DataDirectoryFullPath, "WurmApi"),
                loggerFactory.CreateWithGuiThreadMarshaller("WurmApi"),
                eventMarshaller,
                wurmInstallDirectory,
                wurmApiConfig);
            kernel.Bind<IWurmApi>().ToConstant(wurmApi);
        }
Exemplo n.º 32
0
 public LogSearcherViewModel([NotNull] IWurmApi wurmApi)
 {
     if (wurmApi == null) throw new ArgumentNullException("wurmApi");
     this.wurmApi = wurmApi;
 }