static public DialogueMissionObjective ParseObjectiveAtom(this HtmlAgilityPack.HtmlNode htmlNode) { if (null == htmlNode) { return(null); } try { var ListTableCell = htmlNode?.SelectNodes(".//td"); var CompletionCell = ListTableCell?.FirstOrDefault(); bool?CompleteSelf = null; if (CompletionCell?.InnerHtml?.RegexMatchSuccessIgnoreCase(Regex.Escape("38_193")) ?? false) { CompleteSelf = true; } if (CompletionCell?.InnerHtml?.RegexMatchSuccessIgnoreCase(Regex.Escape("38_195")) ?? false) { CompleteSelf = false; } var TypeCell = ListTableCell?.ElementAtOrDefault(2); var LastCell = ListTableCell?.LastOrDefault(); var TypeEnum = TypeCell?.InnerText?.Trim()?.ObjectiveAtomTypeEnumFromTableDialogueText(); DialogueMissionLocation Location = null; DialogueMissionObjectiveItem Item = null; if (new[] { DialogueMissionObjectiveAtomTypeEnum.Location, DialogueMissionObjectiveAtomTypeEnum.LocationPickUp, DialogueMissionObjectiveAtomTypeEnum.LocationDropOff }.CastToNullable() .Contains(TypeEnum)) { Location = MissionLocationFromDialogue(LastCell); } if (new[] { DialogueMissionObjectiveAtomTypeEnum.Item, DialogueMissionObjectiveAtomTypeEnum.Cargo }.CastToNullable() .Contains(TypeEnum)) { Item = ObjectiveItemFromDialogueText(LastCell?.InnerText); } return(new DialogueMissionObjective() { Html = htmlNode?.OuterHtml, TypeEnum = TypeEnum, Location = Location, Item = Item, CompleteSelf = CompleteSelf, }); } catch { return(null); } }
static public bool ItemEquals(this DialogueMissionObjectiveItem o0, DialogueMissionObjectiveItem o1) { if (ReferenceEquals(o0, o1)) { return(true); } if (null == o0 || null == o1) { return(false); } return (o0.Name == o1.Name && o0.VolumeMilli == o1.VolumeMilli && o0.Quantity == o1.Quantity); }
static public bool ItemEquals(this DialogueMissionObjectiveItem O0, DialogueMissionObjectiveItem O1) { if (ReferenceEquals(O0, O1)) { return(true); } if (null == O0 || null == O1) { return(true); } return (O0.Name == O1.Name && O0.VolumeMilli == O1.VolumeMilli && O0.Quantity == O1.Quantity); }