Spell Training + Fishing

Post your completed (working) macros here. Only for macros using MQ2Data syntax!

Moderator: MacroQuest Developers

User avatar
Fibby
a lesser mummy
a lesser mummy
Posts: 58
Joined: Mon Nov 15, 2004 2:18 am

Spell Training + Fishing

Post by Fibby » Mon Nov 15, 2004 2:23 am

This macro is a merged macro of panther's advanced fishing and lorad's YAST spell trainer. The idea behind this spell is to make sure your doing at at least something.. so while your meding or healing from your spell training sessions, you will start fishing.

Credits of course go to panther and lorad....


adv_fish_spelltrain.mac

Code: Select all

|---------------------------------------------------------------------------------
|
| Advanced Fishing + SpellTraining Macro
| adv_fish_spelltrain.mac
| Author      : Fibby
| Version     : v1.1 2004-11-25
| Usage       : /macro adv_fish_spelltrain
| Depends     : fishingloot.ini
|             : SpellCast.inc
|
| Description : This macro is a merged macro of panther's advanced fishing and 
|               lorad's YAST spell trainer.  The idea behind this spell is to
|               make sure your doing at at least something.. so while your 
|               meding or healing from your spell training sessions, you will
|               start fishing.
|
| Improvements: To Spell Trainer - Added a life check routine.  This will check 
|               your life before each cast to make sure you're not blowing 
|               yourself to pieces when you are practicing evocation.  Works 
|               on the same principle as mana check, but watches the red bar.
|               It will now target yourself before every cast.  Just incase you
|               Loose target on yourself from a "sense" line of spells
|
|               To Fishing - Macro will learn what direction you're faceing, 
|               and turn you to face that direction before it casts it's line.  
|               This is to "fix" you if you got turned around during a 
|               divination spell training (ie, true north, sense "something", etc)
|
| Notes       : When you have trained all of your spell types up, the macro will
|               camp you out.. even if your fishing is not up to skill.  If you 
|               would like to get your fishing up to skill, then utilize panther's
|               MORE than capable script.
|
|               Since the fishing portion is pretty much a direct rip of panther's
|               You still need a fisherman's companion in an inventory slot to get
|               the auto-replace of the broken pole to work properly.
|
| Known Bugs  : For some reason, the SkillUP Event isn't capturing the proper 
|               Skill.  If anyone can figure out why, please let me know :)
|
|---------------------------------------------------------------------------------

#turbo 10

#event BrokenPole "Your fishing pole broke!"
#event LostBait "You lost your bait!"
#event NeedPole "You can't fish without a fishing pole, go buy one."
#event NothingCaught "You didn't catch anything."
#event OutOfBait "You can't fish without fishing bait, go buy some."
#event PrimaryHand "You need to put your fishing pole in your primary hand."
#event SkillUp "You have become better at #1#! (#2#)"
#event SpillBeer "You spill your beer while bringing in your line."

#define MaxArcaneSkill 235 
#chat tell 
#event lang "tells you" 

#include SpellCast.inc 


Sub Main 

    |------------------------------------------------------------
    |Should I display fishing stats? (1 for yes, 0 for no)
    |------------------------------------------------------------
    /declare RV_DisplayStats     int outer  1


    /echo Starting up ${Macro}
    /declare int_BrokenPole     int outer  0
    /declare int_ItemsDropped     int outer  0
    /declare int_LostBait     int outer  0
    /declare int_NothingCaught     int outer  0
    /declare int_SpillBeer     int outer  0
    /declare int_TotalCasts     int outer  0

    /declare currentSpell 
    /declare maxSkill 
    /declare skillName 
    /declare spellName 

    /declare MyDirection string outer 
    
    /varset currentSpell 1 
    /varset maxSkill ${Math.Calc[${Me.Level}*5+5]} 
    /echo maxSkill=${maxSkill} 
    /if ( ${maxSkill} > 235 ) /varset maxSkill 235 

    /target myself 
    

   |--------------------------------------------------------------------
   |Get our current direction so that we can face the water if one 
   |of our spells moved us around (ie, true north, sense something, etc
   |--------------------------------------------------------------------
   /varset MyDirection ${Math.Calc[360-${Me.Heading.Degrees}]}
   /echo Current Direction = ${MyDirection} (${Heading[MyDirection].Name})


   |------------------------------------------------------------
   |Load in Loot Table.
   |------------------------------------------------------------
   /call ReadINI FishingLoot.ini "${Zone.Name}" Loot
   /if (!${Defined[RV_LootArray]}) {
      /echo No Loot Table Created... Please create one.
      /endmacro
   }

    :nextSpell 
        /echo currentspell=${currentSpell} 
        /echo casting=${Me.Gem[${currentSpell}]} 
        
        /if ( ${Bool[${Me.Gem[${currentSpell}]}]} ) { 
            /varset skillName ${Me.Gem[${currentSpell}].Skill} 
            :castSpell 
                /doevents 
                /if ( ${Me.PctMana}<20) { 
                    /sit on 
                    /call MedBreak 
                } 
		/if ( ${Me.PctHPs}<20) {
		    /sit on
                    /call LifeBreak
                }
                /echo ${skillName}=${Me.Skill[${skillName}]} 
                /if ( ${Me.Skill[${skillName}]} >= ${maxSkill} ) { 
                    /varset currentSpell ${Math.Calc[${currentSpell}+1]} 
                    /goto :nextSpell 
                } 
                /call CheckGM 
                /target myself
                /call cast "${Me.Gem[${currentSpell}]}" 
                
                :checkCursor 
                /if (${Cursor.ID}) { 
                    /autoinv 
                    /goto :checkCursor 
                } 
            /goto :castSpell 
        } 
    
    /sit 
    /call MedBreak 
    /camp 
/return 

Sub MedBreak 
    /stand 
    /sit 
    :MedMore 
	/call Fish
        /if (${Me.CurrentMana}<${Me.MaxMana}) /goto :MedMore 
/return 

Sub LifeBreak
    /stand
    /sit
    :HealMore
	/call Fish
        /if (${Me.CurrentHPs}<${Me.MaxHPs}) /goto :HealMore
/return


Sub Fish


   /autoinventory

   |--------------------------------------------
   |Make sure we are facing the right direction
   |--------------------------------------------
   /face nolook heading ${MyDirection}

   :Start
      /call CheckGM
      /delay 2s
      /if (${Cursor.ID}) /call Looting
      /if (${Me.AbilityReady[Fishing]}) {
         /delay 1s
         /varcalc int_TotalCasts ${int_TotalCasts}+1
         /doability Fishing
      }
      /doevents
/return


|--------------------------------------------------------------------------------
|SUB: Display fishing stats.
|--------------------------------------------------------------------------------
Sub DisplayStats

   /declare nArray  int local
   /echo Total number of casts = ${int_TotalCasts}
   /echo Items fished so far
   /echo -------------------
   /if (${Defined[RV_LootArray]}) {
      /for nArray 1 to ${RV_LootArray.Size}
         /echo ${Int[${RV_LootStats[${nArray}]}]} - ${RV_LootArray[${nArray}]}'s
      /next nArray
   }
   /echo
   /echo Bad fishing so far
   /echo ------------------
   /echo ${int_BrokenPole} - Broken poles
   /echo ${int_ItemsDropped} - Items dropped
   /echo ${int_LostBait} - Lost bait
   /echo ${int_NothingCaught} - Nothing caught
   /echo ${int_SpillBeer} - Spilt your beer
/return

|--------------------------------------------------------------------------------
|SUB: Check for GM's in zone.
|--------------------------------------------------------------------------------
Sub CheckGM 
    :GMCheck 
    /if (${Bool[${Spawn[gm].ID}]}) { 
       /echo A GM or Guide has been detected in the zone,  the macro will resume  when the zone is clear of GM/Guides 
       /delay 600s 
       /goto :GMCheck 
    } 
/return 

|--------------------------------------------------------------------------------
|SUB: Looting based on FishingLoot.ini.
|--------------------------------------------------------------------------------
Sub Looting

   /declare LootCheck   int inner  0

   /for LootCheck 1 to ${RV_LootArray.Size}
      /if (${Cursor.Name.Find[${RV_LootArray[${LootCheck}]}]}) {
         /echo Keeping a ${Cursor.Name}... WOOT!
         /varcalc RV_LootStats[${LootCheck}] ${RV_LootStats[${LootCheck}]}+1
         /autoinventory
      }
   /next LootCheck

   /if (${Cursor.ID}) {
      /echo Dropping a ${Cursor.Name}...
      /drop
      /varcalc int_ItemsDropped ${int_ItemsDropped}+1
   }

   /if (${RV_DisplayStats}) /call DisplayStats
/return

|--------------------------------------------------------------------------------
|SUB: Read loot table from the INI file.
|--------------------------------------------------------------------------------
Sub ReadINI(FileName,SectionName,ArrayType)

   /echo Attempting to Read Section "${SectionName}" Zone Information from ${FileName}...
   /delay 1s

   /if (${Ini[${FileName},${SectionName},-1,NO].Equal[NO]}) {
      /echo "${SectionName}" is not a Valid Section for FILE:${FileName}, ending macro...
      /delay 1s
      /return
   }
   /declare nValues     int local  1
   /declare nArray      int local  0
   /declare KeySet      string local  ${Ini[${FileName},${SectionName}]}

   :CounterLoop
   /if (${String[${Ini[${FileName},${SectionName},${ArrayType}${nValues}]}].Equal[null]}) {
      /varcalc nValues ${nValues}-1
      /goto :MakeArray
   }
   /varcalc nValues ${nValues}+1
   /goto :CounterLoop

   :MakeArray
   /if (!${nValues}) /return
   /if (${FileName.Equal["FishingLoot.ini"]}&&${nValues}>0) {
      /echo Declaring Loot Array...
      /declare RV_LootArray[${nValues}]  string outer
      /declare RV_LootStats[${nValues}]  string outer
   }

   /for nArray 1 to ${nValues}
      /if (${FileName.Equal["FishingLoot.ini"]}) {
         /varset RV_LootArray[${nArray}] ${Ini[${FileName},${SectionName},${ArrayType}${nArray}]}
         /varset RV_LootStats[${nArray}] 0
      }
   /next nArray

   /echo "${SectionName}" Zone Information Read Successfully from ${FileName}...
   /delay 1s

/return


|--------------------------------------------------------------------------------
|SUB: Event subroutines.
|--------------------------------------------------------------------------------
Sub Event_BrokenPole
   /varcalc int_BrokenPole ${int_BrokenPole}+1
   /varcalc int_NothingCaught ${int_NothingCaught}-1
/return

Sub Event_LostBait
   /varcalc int_LostBait ${int_LostBait}+1
   /varcalc int_NothingCaught ${int_NothingCaught}-1
/return

Sub Event_NeedPole
   /cast item "Fisherman's Companion"
   /delay 11s
   /autoinventory
/return

Sub Event_NothingCaught
   /varcalc int_NothingCaught ${int_NothingCaught}+1
/return

Sub Event_OutOfBait
   /Echo Ran out of Bait.
   /sit off
   /sit on
   /camp
   /endmacro
/return

Sub Event_PrimaryHand
   /cast item "Fisherman's Companion"
   /delay 11s
   /autoinventory
/return

Sub Event_SkillUp(SkillUpText,Skill,int Amount)
   /popup ${Skill} increased to - ${Amount}
   /echo ${Skill} increased to - ${Amount}
/return

Sub Event_SpillBeer
   /varcalc int_SpillBeer ${int_SpillBeer}+1
   /varcalc int_NothingCaught ${int_NothingCaught}-1
/return

Sub Event_Chat 
  /echo Got a tell, pausing for 10 minutes 
  /delay 600s 
/return 

Sub Event_Lang 
  /echo Got a tell, pausing for 10 minutes 
  /delay 600s 
/return 
|--------------------------------------------------------------------------------
fishingloot.ini

Code: Select all

[Neriak - Commons]
Loot1=Fresh Fish
Loot2=Fish Scales

[The Plane of Nightmares]
Loot1=Fresh Fish
Loot2=Fish Scales
Loot3=Crawdad
Loot4=Waterleaf Scale
Loot5=Nightmare Cichlid

[The Plane of Valor]
Loot1=Fresh Fish
Loot2=Fish Scales
Loot3=Crawdad
Loot4=Vallorian Discus

[North Qeynos]
Loot1=Fresh Fish
Loot2=Fish Scales

[The Surefall Glade]
Loot1=Fresh Fish
Loot2=Fish Scales
Loot3=Pine Cichlid
True genius is not knowing all the answers
It's knowing where to find them.