public NukitoFactCommand( IMethodInfo method, ConstructorInfo constructor, IRequestProvider requestProvider, IResolver resolver, IReflectionHelper reflectionHelper, IMockRepository mockRepository, MockSettings settings, MockSettings constructorSettings) : base(method) { _constructor = constructor; _requestProvider = requestProvider; _resolver = resolver; _reflectionHelper = reflectionHelper; _mockRepository = mockRepository; _settings = settings; _constructorSettings = constructorSettings; }
/********* ** Public methods *********/ /// <summary>Construct an instance.</summary> /// <param name="config">The attachment settings.</param> /// <param name="reflection">Simplifies access to private code.</param> public FertilizerAttachment(GenericAttachmentConfig config, IReflectionHelper reflection) : base(reflection) { this.Config = config; }
/********* ** Public methods *********/ /// <summary>Construct an instance.</summary> /// <param name="obj">The underlying in-game object.</param> /// <param name="tilePosition">The object's tile position in the current location (if applicable).</param> /// <param name="reflection">Simplifies access to private game code.</param> public ObjectTarget(Object obj, Vector2?tilePosition, IReflectionHelper reflection) : base(TargetType.Object, obj, tilePosition) { this.Reflection = reflection; }
/********* ** Public methods *********/ /// <summary>Construct an instance.</summary> /// <param name="codex">Provides subject entries for target values.</param> /// <param name="gameHelper">Provides utility methods for interacting with the game code.</param> /// <param name="npc">The lookup target.</param> /// <param name="type">The NPC type.</param> /// <param name="metadata">Provides metadata that's not available from the game data directly.</param> /// <param name="translations">Provides translations stored in the mod folder.</param> /// <param name="reflectionHelper">Simplifies access to private game code.</param> /// <param name="progressionMode">Whether to only show content once the player discovers it.</param> /// <param name="highlightUnrevealedGiftTastes">Whether to highlight item gift tastes which haven't been revealed in the NPC profile.</param> /// <remarks>Reverse engineered from <see cref="NPC"/>.</remarks> public CharacterSubject(SubjectFactory codex, GameHelper gameHelper, NPC npc, SubjectType type, Metadata metadata, ITranslationHelper translations, IReflectionHelper reflectionHelper, bool progressionMode, bool highlightUnrevealedGiftTastes) : base(codex, gameHelper, translations) { this.Reflection = reflectionHelper; this.ProgressionMode = progressionMode; this.HighlightUnrevealedGiftTastes = highlightUnrevealedGiftTastes; // initialize this.Target = npc; this.TargetType = type; CharacterData overrides = metadata.GetCharacter(npc, type); this.Initialize( name: npc.getName(), description: overrides?.DescriptionKey != null ? translations.Get(overrides.DescriptionKey) : null, type: CharacterSubject.GetTypeName(npc, type) ); this.IsHauntedSkull = npc is Bat && this.Reflection.GetField <NetBool>(npc, "hauntedSkull").GetValue().Value; }
/********* ** Public methods *********/ /// <summary>Construct an instance.</summary> /// <param name="farm">The farm whose shipping bin to manage.</param> /// <param name="reflection">Simplifies access to private game data.</param> public ShippingBinContainer(Farm farm, IReflectionHelper reflection) { this.Farm = farm; this.Reflection = reflection; this.FakeChest = new Chest(0, farm.shippingBin, Vector2.Zero); }
public static List <IClickableMenu> GetTabs(this GameMenu m, IReflectionHelper h) => h.GetField <List <IClickableMenu> >(m, "pages").GetValue();
/********* ** Public methods *********/ /// <summary>Construct an instance.</summary> /// <param name="reflection">Simplifies access to protected code.</param> public WorldItemScanner(IReflectionHelper reflection) { this.Reflection = reflection; }
/********* ** Public methods *********/ /// <summary>Construct an instance.</summary> /// <param name="config">The attachment settings.</param> /// <param name="reflection">Simplifies access to private code.</param> public MilkPailAttachment(GenericAttachmentConfig config, IReflectionHelper reflection) : base(reflection) { this.Config = config; }
/********* ** Public methods *********/ /// <summary>Construct an instance.</summary> /// <param name="gameHelper">Provides utility methods for interacting with the game code.</param> /// <param name="value">The underlying in-game entity.</param> /// <param name="tilePosition">The object's tile position in the current location (if applicable).</param> /// <param name="reflectionHelper">Simplifies access to private game code.</param> public TreeTarget(GameHelper gameHelper, Tree value, Vector2?tilePosition, IReflectionHelper reflectionHelper) : base(gameHelper, TargetType.WildTree, value, tilePosition) { this.Reflection = reflectionHelper; }
public UrlValidator(IReflectionHelper reflectionHelper, IBaseUrlProvider baseUrlProvider) { _reflectionHelper = reflectionHelper; _baseUrlProvider = baseUrlProvider; _propertyModelList = new Dictionary<Type, UrlPropertyModel>(); }
public MoqMockRepository(IReflectionHelper reflectionHelper) { _reflectionHelper = reflectionHelper; }
protected override void FinalizeSetUp() { _baseUrl = "http://example.org"; _reflectionHelper = new FakeReflectionHelper(); _baseUrlProvider = MockFor<IBaseUrlProvider>(); _urlValidator = new UrlValidator(_reflectionHelper, _baseUrlProvider.Object); }
public Resolver(IMockRepository mockRepository, IConstructorChooser constructorChooser, IReflectionHelper reflectionHelper) { _constructorChooser = constructorChooser; _reflectionHelper = reflectionHelper; _mockRepository = mockRepository; }
protected override void FinalizeSetUp() { _reflectionHelper = new ReflectionHelper(); }
//Call Method from Entry Class public static void Initialize(IMonitor monitor, Type machine, IReflectionHelper reflection) { Monitor = monitor; MachineType = machine; Reflection = reflection; }
/********* ** Public methods *********/ /// <summary>Construct an instance.</summary> /// <param name="config">The attachment settings.</param> /// <param name="modRegistry">Fetches metadata about loaded mods.</param> /// <param name="reflection">Simplifies access to private code.</param> public SeedBagAttachment(GenericAttachmentConfig config, IModRegistry modRegistry, IReflectionHelper reflection) : base(modRegistry, reflection) { this.Config = config; }
/// <summary>Get machines with connections in a location.</summary> /// <param name="location">The location to search.</param> /// <param name="reflection">Simplifies access to private game code.</param> public IEnumerable <MachineGroup> GetActiveMachinesGroups(GameLocation location, IReflectionHelper reflection) { return(this .GetMachineGroups(location, reflection) .Where(group => group.HasInternalAutomation)); }
/********* ** Public methods *********/ /// <summary>Construct an instance.</summary> /// <param name="connectors">The objects through which machines can connect, but which have no other automation properties.</param> /// <param name="automateShippingBin">Whether to treat the shipping bin as a machine that can be automated.</param> /// <param name="monitor">Encapsulates monitoring and logging.</param> /// <param name="reflection">Simplifies access to private game code.</param> /// <param name="data">The internal Automate data that can't be derived automatically.</param> /// <param name="betterJunimosCompat">Whether to enable compatibility with the Better Junimos mod.</param> /// <param name="autoGrabberModCompat">Whether to enable compatibility with Auto-Grabber Mod.</param> /// <param name="pullGemstonesFromJunimoHuts">Whether to pull gemstones out of Junimo huts.</param> public AutomationFactory(string[] connectors, bool automateShippingBin, IMonitor monitor, IReflectionHelper reflection, DataModel data, bool betterJunimosCompat, bool autoGrabberModCompat, bool pullGemstonesFromJunimoHuts) { this.Connectors = new HashSet <string>(connectors, StringComparer.InvariantCultureIgnoreCase); this.AutomateShippingBin = automateShippingBin; this.Monitor = monitor; this.Reflection = reflection; this.Data = data; this.BetterJunimosCompat = betterJunimosCompat; this.AutoGrabberModCompat = autoGrabberModCompat; this.PullGemstonesFromJunimoHuts = pullGemstonesFromJunimoHuts; }
public UrlValidator(IReflectionHelper reflectionHelper) { this.reflectionHelper = reflectionHelper; propertyModelList = new Dictionary<Type, UrlPropertyModel>(); }
public static InternalDrawPatch CreatePatch(IReflectionHelper reflection) { Reflection = reflection; return(Instance); }
/// <summary>Constructs an instance.</summary> /// <param name="reflection">Reflection helper.</param> /// <param name="monitor">Monitor for logging.</param> /// <param name="menu">The native shop menu.</param> /// <param name="item">The item to buy.</param> public SellAction(IReflectionHelper reflection, IMonitor monitor, ShopMenu menu, Item item) : base(reflection, monitor, menu, item) { // Default amount this.Amount = (int)Math.Ceiling(this.ClickedItem.Stack / 2.0); }
public CustomizableCartAPI(IReflectionHelper Ref) { this.Reflector = Ref; }
/********* ** Public methods *********/ /// <summary>Construct an instance.</summary> /// <param name="reflection">Simplifies access to private code.</param> /// <param name="multiplier">The animation speed multiplier to apply.</param> /// <param name="disableConfirmation">Whether to disable the confirmation dialogue before eating or drinking.</param> public EatingHandler(IReflectionHelper reflection, int multiplier, bool disableConfirmation) : base(multiplier) { this.Reflection = reflection; this.DisableConfirmation = disableConfirmation; }
internal SkipLogicFactory(IReflectionHelper typeCreator) { this.typeCreator = typeCreator; }
/********* ** Public methods *********/ /// <summary>Construct an instance.</summary> /// <param name="machine">The underlying machine.</param> /// <param name="location">The location containing the machine.</param> /// <param name="reflection">Simplifies access to private game code.</param> /// <param name="monitor">Encapsulates monitoring and logging.</param> /// <param name="tile">The tile covered by the machine.</param> public CrabPotMachine(CrabPot machine, GameLocation location, Vector2 tile, IMonitor monitor, IReflectionHelper reflection) : base(machine, location, tile) { this.Monitor = monitor; this.Reflection = reflection; }
/********* ** Public methods *********/ /// <summary>Construct an instance.</summary> /// <param name="machine">The underlying machine.</param> /// <param name="reflection">Simplifies access to private game code.</param> public CrystalariumMachine(SObject machine, IReflectionHelper reflection) : base(machine) { this.Reflection = reflection; }
/********* ** Public methods *********/ /// <summary>Construct an instance.</summary> /// <param name="type">The target type.</param> /// <param name="obj">The underlying in-game object.</param> /// <param name="tilePosition">The object's tile position in the current location (if applicable).</param> /// <param name="reflectionHelper">Simplifies access to private game code.</param> public CharacterTarget(TargetType type, NPC obj, Vector2?tilePosition, IReflectionHelper reflectionHelper) : base(type, obj, tilePosition) { this.Reflection = reflectionHelper; }
/********* ** Public methods *********/ public void Init(SDVSocialPage nativePage, IReflectionHelper reflection) { this.Reflection = reflection; this.OnResize(nativePage); }
/********* ** Public methods *********/ /// <summary>Construct an instance.</summary> /// <param name="codex">Provides subject entries for target values.</param> /// <param name="gameHelper">Provides utility methods for interacting with the game code.</param> /// <param name="bush">The lookup target.</param> /// <param name="translations">Provides translations stored in the mod folder.</param> /// <param name="reflection">Simplifies access to private game code.</param> public BushSubject(SubjectFactory codex, GameHelper gameHelper, Bush bush, ITranslationHelper translations, IReflectionHelper reflection) : base(codex, gameHelper, translations) { this.Target = bush; this.Reflection = reflection; if (this.IsBerryBush(bush)) { this.Initialize(L10n.Bush.BerryName(), L10n.Bush.BerryDescription(), L10n.Types.Bush()); } else if (this.IsTeaBush(bush)) { this.Initialize(L10n.Bush.TeaName(), L10n.Bush.TeaDescription(), L10n.Types.Bush()); } else { this.Initialize(L10n.Bush.PlainName(), L10n.Bush.PlainDescription(), L10n.Types.Bush()); } }
public OrderManager(IDbHelper db, IReflectionHelper reflectionHelper) { _db = db; _reflectionHelper = reflectionHelper; }
public DoEmotePatch(IReflectionHelper reflection) { Reflection = reflection; }
/********* ** Protected methods *********/ /// <summary>Construct an instance.</summary> /// <param name="reflection">Simplifies access to private code.</param> /// <param name="rateLimit">The minimum number of ticks between each update.</param> protected BaseAttachment(IReflectionHelper reflection, int rateLimit = 0) { this.Reflection = reflection; this.RateLimit = rateLimit; }
/********* ** Public methods *********/ /// <summary>Construct an instance.</summary> /// <param name="autoGrabber">The underlying auto-grabber.</param> /// <param name="chest">The underlying auto-grabber chest.</param> /// <param name="context">The <see cref="ItemGrabMenu.context"/> value which indicates what opened the menu.</param> /// <param name="reflection">Simplifies access to private code.</param> public AutoGrabberContainer(SObject autoGrabber, Chest chest, object context, IReflectionHelper reflection) : base(chest, context, showColorPicker: false, reflection) { this.AutoGrabber = autoGrabber; }
/********* ** Public methods *********/ /// <summary>Construct an instance.</summary> /// <param name="gameHelper">Provides utility methods for interacting with the game code.</param> /// <param name="value">The underlying in-game entity.</param> /// <param name="tilePosition">The object's tile position in the current location (if applicable).</param> /// <param name="reflectionHelper">Simplifies access to private game code.</param> /// <param name="jsonAssets">The Json Assets API.</param> public CropTarget(GameHelper gameHelper, HoeDirt value, Vector2?tilePosition, IReflectionHelper reflectionHelper, JsonAssetsIntegration jsonAssets) : base(gameHelper, SubjectType.Crop, value, tilePosition) { this.Reflection = reflectionHelper; this.GetSpriteSheet(value.crop, jsonAssets, out this.Texture, out this.SourceRect); }
/********* ** Private methods *********/ /// <summary>Extend the given machine group to include all machines and containers connected to the given tile, if any.</summary> /// <param name="group">The machine group to extend.</param> /// <param name="location">The location to search.</param> /// <param name="origin">The first tile to check.</param> /// <param name="visited">A lookup of visited tiles.</param> /// <param name="reflection">Simplifies access to private game code.</param> private void FloodFillGroup(MachineGroupBuilder group, GameLocation location, Vector2 origin, ISet <Vector2> visited, IReflectionHelper reflection) { // skip if already visited if (visited.Contains(origin)) { return; } // flood-fill connected machines & containers Queue <Vector2> queue = new Queue <Vector2>(); queue.Enqueue(origin); while (queue.Any()) { // get tile Vector2 tile = queue.Dequeue(); if (!visited.Add(tile)) { continue; } // get machine or container on tile Vector2 foundSize; if (this.TryGetMachine(location, tile, reflection, out IMachine machine, out Vector2 size)) { group.Add(machine); foundSize = size; }
/********* ** Public methods *********/ /// <summary>Try to create a convention wrapper for a given token instance.</summary> /// <param name="instance">The token instance.</param> /// <param name="reflection">Simplifies access to private code.</param> /// <param name="wrapper">The wrapper, if created successfully.</param> /// <param name="error">The error indicating why creating the wrapper failed, if applicable.</param> public static bool TryCreate(object instance, IReflectionHelper reflection, out ConventionWrapper wrapper, out string error) { error = null; var result = new ConventionWrapper(); // Map a delegate type to a token method and wrapper field by convention. // This assumes the delegate type name matches the method name, and the wrapper has a // field of the delegate type in the form {name}Impl. bool TryMap <TDelegate>(out string mapError) where TDelegate : Delegate { string methodName = typeof(TDelegate).Name; string fieldName = $"{methodName}Impl"; if (ConventionWrapper.TryWrapMethod(instance, methodName, out TDelegate mapped, out mapError)) { reflection.GetField <TDelegate>(result, fieldName).SetValue(mapped); } return(mapError == null); } // detect unknown methods bool succeeded = true; { string[] unknownMethods = ( from MethodInfo method in instance.GetType().GetMethods() where typeof(ConventionWrapper).GetMethod(method.Name) == null select method.Name ) .ToArray(); if (unknownMethods.Any()) { succeeded = false; error = unknownMethods.Length == 1 ? $"found unsupported '{unknownMethods[0]}' method" : $"found unsupported methods: {string.Join(", ", unknownMethods)}"; } } // map implemented fields if (succeeded) { succeeded = // metadata TryMap <ConventionDelegates.IsMutable>(out error) && TryMap <ConventionDelegates.AllowsInput>(out error) && TryMap <ConventionDelegates.RequiresInput>(out error) && TryMap <ConventionDelegates.CanHaveMultipleValues>(out error) && TryMap <ConventionDelegates.GetValidInputs>(out error) && TryMap <ConventionDelegates.HasBoundedValues>(out error) && TryMap <ConventionDelegates.HasBoundedRangeValues>(out error) && TryMap <ConventionDelegates.TryValidateInput>(out error) && TryMap <ConventionDelegates.TryValidateValues>(out error) && TryMap <ConventionDelegates.NormalizeValue>(out error) // state && TryMap <ConventionDelegates.IsReady>(out error) && TryMap <ConventionDelegates.GetValues>(out error) && TryMap <ConventionDelegates.UpdateContext>(out error); } wrapper = succeeded ? result : null; return(succeeded); }
/********* ** Public methods *********/ /// <summary>Construct an instance.</summary> /// <param name="reflection">Simplifies access to private game code.</param> /// <param name="gameHelper">Provides utility methods for interacting with the game code.</param> /// <param name="config">The mod configuration.</param> /// <param name="jsonAssets">The Json Assets API.</param> public ItemLookupProvider(IReflectionHelper reflection, GameHelper gameHelper, ModConfig config, JsonAssetsIntegration jsonAssets) : base(reflection, gameHelper) { this.Config = config; this.JsonAssets = jsonAssets; }
public ReflectionHelperTests() { reflectionHelper = new ReflectionHelper(); }