XF 1.5 Ad After First, Second and Last Post in Thread

Is there code already developed for showing an ad to a guest after the 1st, 2nd and last post of every page of a thread?

vBulletin in postbit_legacy I had it hacked nicely:

<if condition="$bbuserinfo[usergroupid]==1">
<if condition="$post[postcount] % $vboptions[maxposts] == 1">

<if condition="($post[postcount]-$vboptions[maxposts])>=1">
<if condition="($post[postcount] % $vboptions[maxposts] == 2) AND !$GLOBALS['vbulletin']->GPC['ajax'] AND ((($thread[replycount]+1)-(($_GET[page]-1)*$vboptions[maxposts]))>3)">

<if condition="$post[islastshown] AND !$GLOBALS['vbulletin']->GPC['ajax'] AND ((($thread[replycount]+1)-(($_GET[page]-1)*$vboptions[maxposts]))>4)">