|----------------------------------------------------------------------------
| Name: HyperFish.Mac
|Developer: Fibby
| Date: 11/27/2004
|----------------------------------------------------------------------------
|Purpose: HyperFish is designed to be the next generation "smart" fishing
| automation macro. It will auto replace any broken poles that
| may have met their demise at your hands either by searching your
| inventory for one or summoning one from a fishermans companion
|
| This Macro is INI driven for it's "loot" tables on a per zone
| basis. However, if there's not a section for the zone you want
| to fish in the INI file, then it will create a new section for
| your benifit.
|
| If there are no loot items defined in the zone section of the
| ini file, then the macro will assume that you want to "keep"
| all things that are edible and drop all "non food" items. If
| in happens to fish a no-drop non food item, and that item is
| not declared in your loot tables, then it will attempt to
| destroy that item by default. You can of course change that
| flag if you wish.
|
| Depends: HyperLoot.ini - Same directory as this macro
|----------------------------------------------------------------------------
|Credits: This script was inspired by panther and his adv_fish macro
| while it is an outstanding macro.. I wanted something more...
|----------------------------------------------------------------------------
|Revisions:
| v1.1 fby Bug Fixes pointed out by Budman
| v1.0 fby Created the initial file offering
|----------------------------------------------------------------------------
#turbo 10
|----------------------------------------------------------------------------
| Event Declarations
|----------------------------------------------------------------------------
#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."
|----------------------------------------------------------------------------
| Main Macro Code
|----------------------------------------------------------------------------
Sub Main
|------------------------------------------------------------------------
|User Settings = Set these please (1 for yes, 0 for no)
|------------------------------------------------------------------------
/declare UserVar_DisplayStats int outer 1
/declare UserVar_CampOutFinish int outer 1
/declare UserVar_DestroyNoDrop int outer 1
|------------------------------------------------------------------------
| Counter data holders here
|------------------------------------------------------------------------
/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
|------------------------------------------------------------------------
| Operational Variables for this macro
|------------------------------------------------------------------------
/declare op_int_GotLootArray int outer 0
/declare op_int_GotFishComp int outer 0
/declare op_int_FishByLoot int outer 0
/declare op_int_LoopCounter int outer 0
/declare op_int_ExitMacro int outer 0
/echo Starting up ${Macro}
| Check our inventory for Fish Comp.
/for op_int_LoopCounter 1 to 8
/if (${InvSlot[pack${op_int_LoopCounter}].Item.Name.Equal["Fisherman's Companion"]}) {
/echo Whoopie!! Found our Fisherman's Companion!
/varset op_int_GotFishComp 1
/goto :BreakForFindFishComp
}
/next op_int_LoopCounter
:BreakForFindFishComp
/varset op_int_LoopCounter 0
|------------------------------------------------------------------------
| Load in Loot Table.
|------------------------------------------------------------------------
/call ReadINI HyperFish.ini "${Zone.Name}" Loot
/varset op_int_GotLootArray ${Macro.Return}
|------------------------------------------------------------------------
| Inventory anything we may have on our cursor before starting
|------------------------------------------------------------------------
/autoinventory
|------------------------------------------------------------------------
| Heart of the whole fishing routine..
|------------------------------------------------------------------------
:Fish
/if (${op_int_ExitMacro}==1) /goto :ExitMacro
/call GMCheck
/delay 2s
/if (${Cursor.ID}) /call Looting
/if (${Me.AbilityReady[Fishing]}) {
/delay 1s
/varcalc int_TotalCasts ${int_TotalCasts}+1
/doability Fishing
}
/doevents
/goto :Fish
|----------------------------------------------------------------------------
| End our Macro
|----------------------------------------------------------------------------
:ExitMacro
/echo -= Total Stats for this Fishing Trip =-
/call DisplayStats
/if (${UserVar_CampOutFinish}=1) {
/sit off
/sit on
/camp
}
/return
|----------------------------------------------------------------------------
| Begin Support sub routines
|----------------------------------------------------------------------------
| ReadINI: Stolen from adv_fish code, modified to return 1 if
| loot table built or 0 of loot table not built.
|----------------------------------------------------------------------------
Sub ReadINI(FileName, ZoneName, KeyRoot)
/declare loc_int_returnValue int local 0
/echo Attempting to Read "${ZoneName}" Section from ${FileName}
/delay 1s
/if (${Ini[${FileName}, ${ZoneName}, -1, NO].Equal[NO]}) {
/echo Zone "${ZoneName}" Not found, Creating it now...
/Ini ${FileName}, ${ZoneName}, -1, -1
/delay 1s
| Obviously, since we didn't have a section, we're not going to
| have a loot section.. so we can end now
/return loc_int_returnValue
}
/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}) {
| We didn't find any values in our loot tables.. so we'll just exit now
/return loc_int_returnValue
} else {
| Must have found some values.. set our return variable now
/varset loc_int_returnValue 1
}
/if (${FileName.Equal["HyperFish.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["HyperFish.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 loc_int_returnValue
|----------------------------------------------------------------------------
|SUB: Display fishing stats.
|----------------------------------------------------------------------------
Sub DisplayStats
/declare nArray int local
/echo Total number of casts = ${int_TotalCasts}
/echo Items fished so far:
/if (${Defined[RV_LootArray]}) {
/for nArray 1 to ${RV_LootArray.Size}
/echo ${RV_LootArray[${nArray}]} - ${Int[${RV_LootStats[${nArray}]}]}
/next nArray
}
/echo
/echo Bad fishing so far:
/echo Broken Poles - ${int_BrokenPole}
/echo Items Dropped - ${int_ItemsDropped}
/echo Lost Bait - ${int_LostBait}
/echo Nothing Caught - ${int_NothingCaught}
/echo Spilled Beer - ${int_SpillBeer}
/return
|----------------------------------------------------------------------------
|SUB: Main Looting routine.. based on adv_fish, heavily modified.
|----------------------------------------------------------------------------
Sub Looting
/declare LootCheck int inner 0
/if (${op_int_GotLootArray}==0) {
/if (${Cursor.Type.Equal["Food"]}) {
/autoinventory
}
} else {
/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}) {
/if (${Cursor.NoDrop}) {
/if (${UserVar_DestroyNoDrop}==1) {
/destroy
} else {
/autoinventory
}
} else {
/echo Dropping a ${Cursor.Name}...
/drop
/varcalc int_ItemsDropped ${int_ItemsDropped}+1
}
}
/if (${UserVar_DisplayStats}==1) /call DisplayStats
/return
|----------------------------------------------------------------------------
|SUB: Pole replacement logic
|----------------------------------------------------------------------------
Sub FindPole
/declare lv_int_Return int local 0
/declare lv_int_LoopCounter int local 0
/if (${op_int_GotFishComp}==1) {
| We have our companion.. summon our pole
/cast item "Fisherman's Companion"
/delay 11s
/autoinventory
/varset lv_int_Return 1
} else {
| We don't have a companion, find a fishing pole in inventory
/for op_int_LoopCounter 1 to 8
/if (${InvSlot[pack${op_int_LoopCounter}].Item.Container}) {
/for lv_int_LoopCounter 1 to ${InvSlot[pack${op_int_LoopCounter].Container}
/echo ${InvSlot[pack${op_int_LoopCounter}].Item.Name} - ${InvSlot[pack${op_int_LoopCounter}].Item.Item[${lv_int_LoopCounter}].Name}
/if (${InvSlot[pack${op_int_LoopCounter}].Item.Item[${lv_int_LoopCounter}].Type.Equal["Fishing Pole"]}) {
/ItemNotifiy pack${op_int_LoopCounter} rightmouseup
/ItemNotify ${InvSlot[pack${op_int_LoopCounter}]} ${lv_int_LoopCounter} leftmouseup
/autoinventory
/varset lv_int_Return 1
/goto :BreakoutLoop
}
/next lv_int_LoopCounter
} else {
/if (${InvSlot[pack${op_int_LoopCounter}].Item.Type.Equal["Fishing Pole"]}) {
/itemnotify pack${op_int_LoopCounter} leftmouseup
/autoinventory
/varset lv_int_Return 1
/goto :BreakoutLoop
}
}
/next op_int_LoopCounter
}
:BreakoutLoop
/if (${lv_int_Return}==0) {
/echo Bummer.. We're out of Fishing Poles
/varset op_int_ExitMacro 1
}
/return lv_int_Return
|----------------------------------------------------------------------------
|SUB: Check for GM's in zone.
|----------------------------------------------------------------------------
Sub GMCheck
/if (${Spawn[gm].ID}) {
/beep
/beep
/beep
/echo GM entered the zone!
/echo For safty reasons ending the macro...
/endmacro
}
/return
|----------------------------------------------------------------------------
| End Support sub routines
|----------------------------------------------------------------------------
|----------------------------------------------------------------------------
| Begin Event Sub Routines
|----------------------------------------------------------------------------
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
/call FindPole
/return
Sub Event_NothingCaught
/varcalc int_NothingCaught ${int_NothingCaught}+1
/return
Sub Event_OutOfBait
/echo Bummer.. we're out of bait
/varset op_int_ExitMacro 1
/return
Sub Event_PrimaryHand
/call FindPole
/return
Sub Event_SkillUp(SkillUpText,Skill,int Amount)
/popup Fishing increased to - ${Amount}
/echo Fishing increased to - ${Amount}
/return
Sub Event_SpillBeer
/varcalc int_SpillBeer ${int_SpillBeer}+1
/varcalc int_NothingCaught ${int_NothingCaught}-1
/return
|----------------------------------------------------------------------------
| End Event Sub Routines
|----------------------------------------------------------------------------