private void generateObject(string owner, int replacement, int stackAmount, string requirements) { if (owner == "???") { Monitor.Log("Attempt to add a object to a shop owned by `???`, this cant be done because `???` means the owner is unknown!", LogLevel.Error); return; } StardewValley.Object stack = new StardewValley.Object(replacement, stackAmount); if (stack.salePrice() == 0) { Monitor.Log("Unable to add item to shop, it has no value: " + replacement, LogLevel.Error); return; } SObject obj = new SObject(stack, stackAmount); obj.targetedShop = owner; if (!affectedShops.Contains(owner)) { affectedShops.Add(owner); } obj.requirements = requirements; Monitor.Log($"RegisterObject({obj.Name}:{replacement}@{owner},{obj.stackAmount}*{obj.maximumStackSize()},'{requirements}')", LogLevel.Trace); if (AddedObjects.ContainsKey(obj.Name)) { return; } AddedObjects.Add(obj.Name, obj); ReplacementStacks.Add(obj.Name, stack); }
private void ResolveAddedObjects() { AddedObjects.Clear(); foreach (var addedMember in NewValue.Where(pm => !OldValue.Contains(pm))) { AddedObjects.Add(addedMember); } }
void ComputeMerge_Added(Commit branchTip, PatchEntryChanges change, Patch headChanges) { var parentDataPath = change.Path.GetDataParentDataPath(); if (headChanges.Any(c => c.Path.Equals(parentDataPath, StringComparison.OrdinalIgnoreCase) && c.Status == ChangeKind.Deleted)) { throw new NotImplementedException("Node addition while parent has been deleted in head is not supported."); } var branchObject = GetContent(branchTip, change.Path, "branch tip"); AddedObjects.Add(new MetadataTreeMergeObjectAdd(change.Path, branchObject)); }
private void ComputeMerge_Added(Commit branchTip, PatchEntryChanges change, Patch headChanges) { // Only data file changes have to be taken into account // Changes made to the blobs will product a 'modified' change as well if (Path.GetFileName(change.Path) != FileSystemStorage.DataFile) { return; } var parentDataPath = change.Path.GetDataParentDataPath(); if (headChanges.Any(c => c.Path.Equals(parentDataPath, StringComparison.OrdinalIgnoreCase) && c.Status == ChangeKind.Deleted)) { throw new NotImplementedException("Node addition while parent has been deleted in head is not supported."); } var branchObject = GetContent(branchTip, change.Path, "branch tip"); var parentId = change.Path.GetDataParentId(Repository); AddedObjects.Add(new ObjectRepositoryAdd(change.Path, branchObject, parentId)); }