to take advantage of ~
This pattern expresses taking advantage of a situation or condition to do something, often with a negative connotation.
をいいことに means "taking advantage of ~" and is used when someone exploits a certain state or event for their own benefit, often in a way that is selfish or inconsiderate. The pattern highlights that the person is using the situation as an excuse or opportunity. It is frequently used in negative contexts, like 'being away from home, he takes advantage of it to skip chores.'
Grammatically, the preceding part is a noun or a clause nominalized with の. The verb that follows typically describes the action taken advantage of the situation. The pattern is somewhat formal and more common in writing or formal speech, though it can be used in spoken Japanese for emphasis.
A nuance to note: the action taken is often something the person would not normally do if the situation were different, and it often implies a judgment on the speaker's part.