| Revision of the SummonSnacks Macro - will summon food/drink for each group member,
| and hand out that food and drink to the group.
| Requirements: A character that can summon food, mq2cast
| With suggestions from CWTN, Sic, MaxD, wired420, exspes, and the RG Discord.
| Set spells used depending on level:
| Summon Food
| Summon Drink
| Set HowMany to give to each character
|To Do:
| Remove Bool and Ifs from delay conditions -- !${TLO.Here} will work
| Make sure toons are in the zone: /if (!${Spawn[id ${Group.Member[${i}].ID}]}) /continue
| Make sure folks aren't dead:
| Doesn't handle fizzles
| Doesn't handle out of mana
| Changelog:
| 05/26/2020
| * Code changed to allow for low level spells which need to be repeated, does bread first then water
| * New int variable HowMany sets number of each food and drink to give to each group member
| * New string variable GemSlot for slot to mem spell in
| 12/15/2019:
| * Added unloading of mq2cast and mq2yes if it was loaded
| * Added mq2yes functionality to make sure group member takes the stinking food -- works with dannet or eqbc
| * Added preliminary fizzle checking
Sub Main
/declare FoodSpell string outer Summon Food
/declare DrinkSpell string outer Summon Drink
/declare HowMany int outer 3
/declare GemSlot string outer gem8
/declare LoadedMQ2Cast bool local FALSE
/declare LoadedMQ2Yes bool local FALSE
/declare TellCMD string local
| Load mq2cast if it's not loaded
/if (!${Bool[${Plugin[mq2cast]}]}) {
/echo "Loading MQ2Cast"
/plugin mq2cast noauto
/varset LoadedMQ2Cast TRUE
}
| Load mq2yes if it's not loaded
| /if (!${Bool[${Plugin[mq2yes]}]}) {
| /echo "Loading MQYes"
| /plugin mq2yes noauto
| /varset LoadedMQYes TRUE
| }
/echo \atStarting Summoning
/echo \atSaving Current Spells
/sss summonsnacks_backup
| Get Size of Group as we'll need to summon food and drink for each
| ${Group.Member[0]} will always be you
|DO BREAD FIRST
/declare i int local 1
/for i 1 to ${Group.Members}
/target id ${Group.Member[${i}].ID}
/if (${Bool[${DanNet.Name}]}) {
/varset TellCMD /noparse /dt ${Group.Member[${i}].Name} /nomodkey /notify Tradewnd TRDW_Trade_Button leftmouseup
| /echo Set TellCMD to ${TellCMD}
} else {
/varset TellCMD /noparse /bct ${Group.Member[${i}].Name} /nomodkey /notify Tradewnd TRDW_Trade_Button leftmouseup
| /echo Set TellCMD to ${TellCMD}
}
/delay 1s ${Cast.Ready}
/echo Summoning Food for ${Group.Member[${i}]}
/call CastAndDelay 1
| 2 seconds is a magic additional delay for this to work
/delay 2s
/call AutoInvAndDelay
| Navigate to my group member and delay further action until the Navigation stops
/echo Too far away from ${Target.Name}, moving closer
/nav id ${Group.Member[${i}].ID} |log=off dist=5
/delay 10s ${Navigation.Active}
/delay 1s ${Cast.Ready}
| Pickup the bread, wait until the bread is picked up, click on the target to trade, wait until the bread is dropped in the trade window,
| and finally click yes on the trade. Do the same for the water
/echo Handing ${Target.Name} food
/while (!${Cursor.ID}) {
/itemnotify "Summoned: Black Bread" leftmouseup
/delay 10
}
/click left target
/delay 5s !${Cursor.ID}
/notify GiveWnd GVW_Give_Button leftmouseup
|Delay until trade says yes
/docommand ${TellCMD}
/delay 5s !${Window[TradeWnd]}
/delay 1s ${Cast.Ready}
/next i
|END for
|DO DRINK NOW
/for i 1 to ${Group.Members}
/target id ${Group.Member[${i}].ID}
/if (${Bool[${DanNet.Name}]}) {
/varset TellCMD /noparse /dt ${Group.Member[${i}].Name} /nomodkey /notify Tradewnd TRDW_Trade_Button leftmouseup
| /echo Set TellCMD to ${TellCMD}
} else {
/varset TellCMD /noparse /bct ${Group.Member[${i}].Name} /nomodkey /notify Tradewnd TRDW_Trade_Button leftmouseup
| /echo Set TellCMD to ${TellCMD}
}
/delay 1s ${Cast.Ready}
/echo Summoning Drink for ${Group.Member[${i}]}
/call CastAndDelay 2
| 2 seconds is a magic additional delay for this to work
/delay 2s
/call AutoInvAndDelay
| Navigate to my group member and delay further action until the Navigation stops
/echo Too far away from ${Target.Name}, moving closer
/nav id ${Group.Member[${i}].ID} |log=off dist=5
/delay 10s ${Navigation.Active}
/delay 1s ${Cast.Ready}
/echo Handing ${Target.Name} water
/while (!${Cursor.ID}) {
/itemnotify "Summoned: Globe of Water" leftmouseup
/delay 10
}
/click left target
/delay 5s !${Cursor.ID}
/notify GiveWnd GVW_Give_Button leftmouseup
|Delay until trade says yes
/docommand ${TellCMD}
/delay 5s !${Window[TradeWnd].Open}
/delay 1s ${Cast.Ready}
/next i
|END for
/delay 3s
| Now summon for yourself
/echo Summoning myself food.
/call CastAndDelay 1
| 2 seconds is a magic additional delay for this to work
/delay 2s
/call AutoInvAndDelay
/echo Summoning myself water.
/call CastAndDelay 2
| 2 seconds is a magic additional delay for this to work
/delay 2s
/call AutoInvAndDelay
| Start doing cleanup for the macro to include reloading original spells and unloading loaded plugins
/echo \atLoading Old Spells and deleting backup list
/ssm summonsnacks_backup
/ssd summonsnacks_backup
/if (${LoadedMQ2Cast}) /plugin mq2cast unload noauto
| /if (${LoadedMQ2YEs}) /plugin mq2yes unload noauto
/return
Sub CastAndDelay(summonwhat)
/echo castanddelay sub called
/declare MyCastCounter int local 0
/declare MyManaRequired int local 0
:dowhile
/if (${Cast.Result.Equal[CAST_FIZZLE]}) {
/echo caught a fizzle
}
/call AutoInvAndDelay
/delay 5s ${Cast.Ready}
|SUMMON FOOD
/if (${summonwhat} == 1 && ${Cast.Status.Equal[I]}) {
/echo summon ${summonwhat} and ${Cast.Status}
/varset MyCastCounter 0
/echo casting spell with ${HowMany} recasts
/casting "${FoodSpell}"|${GemSlot} -recast|${HowMany}
/echo delaying 1s ${Cast.Result}
/delay 1s
/echo continuing...
|count the successes
/if (${Cast.Result.Equal[CAST_SUCCESS]}) {
/echo idle - spell succeeded to start casting, incrementing counter from ${MyCastCounter}
/varcalc MyCastCounter ${MyCastCounter}+1
}
| If OutofMana - calculate how much mana needed, and med till you have it
/if (${Cast.Result.Equal[CAST_OUTOFMANA]}) {
/echo idle - out of mana
|how much mana do I need - spell mana times how many casts I need to made
/varcalc MyManaRequired ${Spell[${FoodSpell}].Mana}*(${HowMany}-${MyCastCounter})
/echo need ${MyManaRequired} mana - medding - have ${Me.CurrentMana} now
/ECHO delaying 2s
/delay 2s
/echo sitting now to med
/if (!${Me.Sitting}) /sit
:keepmedding
/if (${Me.CurrentMana} < ${MyManaRequired}) /goto :keepmedding
/echo mana reached required level - casting spell with (${HowMany}-${MyCastCounter}) recasts
/casting "${FoodSpell}"|${GemSlot} -recast|(${HowMany}-${MyCastCounter})
| /varset Cast.Result 0
}
/echo setting summonwhat to 0
/varset summonwhat 0
}
|SUMMON DRINK
/if (${summonwhat} == 2 && ${Cast.Status.Equal[I]}) {
/echo summon ${summonwhat} and ${Cast.Status}
/varset MyCastCounter 0
/echo casting spell with ${HowMany} recasts
/casting "${DrinkSpell}"|${GemSlot} -recast|${HowMany}
/echo delaying 1s ${Cast.Result}
/delay 1s
/echo continuing...
|count the successes
/if (${Cast.Result.Equal[CAST_SUCCESS]}) {
/echo idle - spell succeeded to start casting, incrementing counter from ${MyCastCounter}
/varcalc MyCastCounter ${MyCastCounter}+1
}
| If OutofMana - calculate how much mana needed, and med till you have it
/if (${Cast.Result.Equal[CAST_OUTOFMANA]}) {
/echo idle - out of mana
|how much mana do I need - spell mana times how many casts I need to made
/varcalc MyManaRequired ${Spell[${DrinkSpell}].Mana}*(${HowMany}-${MyCastCounter})
/echo need ${MyManaRequired} mana - medding - have ${Me.CurrentMana} now
/ECHO delaying 2s
/delay 2s
/echo sitting now to med
/if (!${Me.Sitting}) /sit
:keepmedding
/if (${Me.CurrentMana} < ${MyManaRequired}) /goto :keepmedding
/echo mana reached required level - casting spell with (${HowMany}-${MyCastCounter}) recasts
/casting "${DrinkSpell}"|${GemSlot} -recast|(${HowMany}-${MyCastCounter})
| /varset Cast.Result 0
}
/echo setting summonwhat to 0
/varset summonwhat 0
}
|count the successes
/if (${Cast.Result.Equal[CAST_SUCCESS]} && !${Cast.Status.Equal[C]} && !${Cast.Status.Equal[M]}) {
/echo not idle - spell succeeded to start casting and is now not in progress or memming, incrementing counter from ${MyCastCounter}
/varcalc MyCastCounter ${MyCastCounter}+1
}
}
|/echo delaying 2s and checking cast status, if casting or memorizing or not ready to cast - keep looping
|/delay 2s
/if (${Cast.Status.Equal[C]} || ${Cast.Status.Equal[M]} || !${Cast.Ready}) /goto :dowhile
/autoinv
/return
Sub AutoInvAndDelay()
/while (${Cursor.ID} && ${Me.FreeInventory}) {
/autoinv
}
/return