private void OnConsequenceRunnedEvent(ConversationSentence sentence) { if (sentence.OutputToken == lord_talk_speak_diplomacy_2) { // I have no choice but to remove the dead heroes, otherwise // the game will consider them as candidates for marriage. ICollection <Hero> heroes = Hero.OneToOneConversationHero.Clan.Heroes as ICollection <Hero>; if (heroes != null) { Hero del; while ((del = heroes.FirstOrDefault(h => h.IsDead)) != null) { heroes.Remove(del); } } } if (sentence.Id == "lord_propose_marriage_conv_general_proposal_2" && sentence.InputToken == lord_propose_marriage_to_clan_leader_options && sentence.OutputToken == lord_propose_marriage_to_clan_leader_response) { CharacterObject characterObject = ConversationSentence.LastSelectedRepeatObject as CharacterObject; if (characterObject != null) { playerProposalHero = characterObject.HeroObject; } } else if (sentence.InputToken == lord_propose_marriage_to_clan_leader_response && sentence.OutputToken == lord_propose_marriage_to_clan_leader_response_self) { proposedSpouseForPlayerRelative = Hero.OneToOneConversationHero; } else if (sentence.InputToken == lord_propose_marriage_to_clan_leader_response_self && sentence.OutputToken == lord_start_courtship_response && playerProposalHero != null && proposedSpouseForPlayerRelative != null) { StartMarriageBarter(); } else if (sentence.InputToken == lord_propose_marriage_to_clan_leader_response && sentence.OutputToken == lord_propose_marriage_to_clan_leader_response_other) { Regex reHref = new Regex("<a .* href=\"event:Hero-(.*)\">"); var href = reHref.Match(sentence.Text.ToString()); if (href.Success) { string id = href.Groups[1].Captures[0].ToString(); proposedSpouseForPlayerRelative = Hero.OneToOneConversationHero.Clan.Heroes.FirstOrDefault(h => h.StringId == id); } } else if (sentence.InputToken == lord_propose_marriage_to_clan_leader_response_other && sentence.OutputToken == lord_propose_marriage_to_clan_leader_confirm && playerProposalHero != null && proposedSpouseForPlayerRelative != null) { StartMarriageBarter(); } else { proposedSpouseForPlayerRelative = null; playerProposalHero = null; } }
private void OnConsequenceRunnedEvent(ConversationSentence sentence) { if (sentence.OutputToken == lord_talk_speak_diplomacy_2) { // I have no choice but to remove the dead heroes, otherwise // the game will consider them as candidates for marriage. RemoveDeadClanMembers(Hero.OneToOneConversationHero.Clan.Lords as ICollection <Hero>); RemoveDeadClanMembers(Hero.MainHero.Clan.Lords as ICollection <Hero>); } if (sentence.Id == "lord_propose_marriage_conv_general_proposal_2" && sentence.InputToken == lord_propose_marriage_to_clan_leader_options && sentence.OutputToken == lord_propose_marriage_to_clan_leader_response) { CharacterObject characterObject = ConversationSentence.LastSelectedRepeatObject as CharacterObject; if (characterObject != null) { playerRelative = characterObject.HeroObject; // Bug in MarriageAction: // if hero in party - party will be disbanded. // Remove hero temporarily from the MainParty. if (playerRelative.PartyBelongedTo != null && playerRelative.PartyBelongedTo == MobileParty.MainParty) { MobileParty.MainParty.AddElementToMemberRoster(playerRelative.CharacterObject, -1); shouldJoinPartyAfterOffer = true; } } } else if (sentence.InputToken == lord_propose_marriage_to_clan_leader_response && sentence.OutputToken == lord_propose_marriage_to_clan_leader_response_self) { proposedSpouseForPlayerRelative = Hero.OneToOneConversationHero; } else if (sentence.InputToken == lord_propose_marriage_to_clan_leader_response_self && sentence.OutputToken == lord_start_courtship_response && playerRelative != null && proposedSpouseForPlayerRelative != null) { StartMarriageBarter(); } else if (sentence.InputToken == lord_propose_marriage_to_clan_leader_response && sentence.OutputToken == lord_propose_marriage_to_clan_leader_response_other) { Regex reHref = new Regex("<a .* href=\"event:Hero-(.*)\">"); var href = reHref.Match(sentence.Text.ToString()); if (href.Success) { string id = href.Groups[1].Captures[0].ToString(); proposedSpouseForPlayerRelative = Hero.OneToOneConversationHero.Clan.Heroes.FirstOrDefault(h => h.StringId == id); } } else if (sentence.InputToken == lord_propose_marriage_to_clan_leader_response_other && sentence.OutputToken == lord_propose_marriage_to_clan_leader_confirm && playerRelative != null && proposedSpouseForPlayerRelative != null) { StartMarriageBarter(); } else { if (shouldJoinPartyAfterOffer && playerRelative != null && playerRelative.PartyBelongedTo == null) { AddHeroToPartyAction.Apply(playerRelative, MobileParty.MainParty); shouldJoinPartyAfterOffer = false; } proposedSpouseForPlayerRelative = null; playerRelative = null; } }