@blasdoo:
There is a ton of mess in that xml.
To build a good XML, you have to learn how to group things in a logical manner. For smn, you have a few basic global issues to take care of:
1) Sets for precast. This covers Fast Cast and misc JAs.
2) Sets for standard spellcasting. Cure, enfeebling, whatever. Almost always midcast.
3) Sets for idle/aftercast. Smn has multiple idle sets due to the avatars, so you need to break this down:
3a) Idle if no avatar is out. Default.
3b) Idle with avatar. This is sub-composed of: which staff to use; which avatar-specific gear to use; refresh gear; -perp gear; weather-dependant -perp gear; day-dependant -perp gear. This needs to be determined if: you're taking an action with an avatar out; or if you're summoning an avatar. It needs to revert to the default idle set if you're releasing the avatar.
Section 3 needs to be evaluated for pretty much any action you take, so it's easiest to handle it first. This is aided by proper scoping. EG:
Code:
<if PetIsValid="TRUE" NotSpell="Release">
<!-- Have an avatar out already. Define sets based on which avatar it is.
This also means that if we accidentally hit a macro to summon an avatar
while we already have one out, it won't override the proper values. -->
</if>
<elseif type="SummonerPact">
<!-- Summoning an avatar. Define sets based on which avatar it is. -->
</elseif>
<else>
<!-- Either no avatar, or releasing the avatar we have. Drop back to default idle. -->
</else>
By setting it up that way, you can simply set some variables up that construct which sets you plan to use. The variables get set within the above If/Else blocks, and then used after those blocks, since everything is on a common footing at that point.
To illustrate how that would work, consider this expanded version (taken from my own smn xml):
Code:
<if PetIsValid="TRUE" NotSpell="Release">
<!-- Pet is out, so the staff we used is based on the pet's element. -->
<var cmd="set PrimaryWeapon $EleStaff-%PetElement" />
<var cmd="set PrimarySub Verse Strap +1" />
<var cmd="set PetSet %PetName" />
<var cmd="set PerpSet Perpetuation" />
<if DayElement="%PetElement">
<var cmd="set PerpSet $PerpSet|PerpDay" />
</if>
<if mode="OR" WeatherElement="%PetElement" BuffActive="$Storm-%PetElement">
<var cmd="set PerpSet $PerpSet|PerpWeather" />
</if>
</if>
<elseif type="SummonerPact">
<!-- Pet is being summoned, so the staff we use is based on the spell's element. -->
<var cmd="set PrimaryWeapon $EleStaff-%SpellElement" />
<var cmd="set PrimarySub Verse Strap +1" />
<var cmd="set PetSet %Spell" />
<var cmd="set PerpSet Perpetuation" />
<if DayElement="%SpellElement">
<var cmd="set PerpSet $PerpSet|PerpDay" />
</if>
<if mode="OR" WeatherElement="%SpellElement" BuffActive="$Storm-%SpellElement">
<var cmd="set PerpSet $PerpSet|PerpWeather" />
</if>
<equip when="precast" set="FastCast" />
<equip when="midcast" set="HasteCast|ConserveMP" />
</elseif>
<else>
<var cmd="set PrimaryWeapon $IdleWeapon" />
<var cmd="set PrimarySub $IdleSub" />
<var cmd="set PetSet None" />
<var cmd="set PerpSet None" />
</else>
....
<!-- Extremely simple set definition: -->
<equip when="aftercast|idle" set="Idle|$PerpSet|$PetSet" />
The above sets your idle/aftercast sets, so you don't have to touch them at all anymore. Checks for individual pets are never needed (certainly don't need to check if you have a valid pet inside your rules for casting Cure, for example); anything specific to the pet is handled by the set with the pet's name (eg: <set name="Carbuncle"><hands>Carbuncle Mitts</hands></set>).
After that you can set up your basic JA/Spell blocks for precast/midcast stuff and keep everything nicely isolated.