So here is what I've got now:
Fishing.scar:
{==============================================================================\
| MSI Group Scripting Include |
| Fishing.scar |
|==============================================================================|
| For all fishing routines. |
| |
| * procedure MSI_FishingTools(); * by 3Garrett3 |
| |
| |
\ _____________________________________________________________________________}
{******************************************************************************}
{ Function MSI_FishingTools : TIntegerArray }
{ By: 3Garrett3 }
{ Date: 25 July 2010 }
{ Description: Figures out which tool the script needs to use }
{******************************************************************************}
Function MSI_FishingTools : TIntegerArray;
var
script: TScript;
begin
script := MSI_Scripts[MSI_Players[CurrentPlayer].Scripts[CurrentScript]];
case (script.ObjectConstants) of
FISHSPOT_NET:
Result := [FISH_SMALLNET];
FISHSPOT_BAIT:
Result := [FISH_ROD, FISH_BAIT];
FISHSPOT_LURE:
Result := [FISH_FLY, FISH_FEATHER];
FISHSPOT_CAGE:
Result := [FISH_CAGE];
FISHSPOT_HARPOON:
Result := [FISH_HARPOON];
else
MSI_Debug('MSI_FishingTools', 'Invalid Fishing Spot', DEBUG_FUNCTIONS);
end;
end;
Here is the new globals:
const
TOOL_HATCHET = 0;
TOOL_PICKAXE = 1;
TOOL_FISH = 2;
//Fishing
REQ_NET = 1;
REQ_POT = 1;
REQ_BAIT = 5;
REQ_LURE = 20;
REQ_HARPOON = 35;
REQ_CAGE = 40;
const
ITEM_COUNT = 41;
PICKAXE_BRONZE = 0;
PICKAXE_IRON = 1;
PICKAXE_STEEL = 2;
PICKAXE_MITHRIL = 3;
PICKAXE_ADAMANT = 4;
PICKAXE_RUNE = 5;
HATCHET_BRONZE = 6;
HATCHET_IRON = 7;
HATCHET_STEEL = 8;
HATCHET_MITHRIL = 9;
HATCHET_ADAMANT = 10;
HATCHET_RUNE = 11;
LOGS_NORMAL = 12;
LOGS_OAK = 13;
LOGS_WILLOW = 14;
LOGS_MAPLE = 15;
LOGS_YEW = 16;
LOGS_MAGIC = 17;
ORE_COPPER = 18;
ORE_TIN = 19;
ORE_IRON = 20;
FISH_SHRIMP = 21;
FISH_CRAYFISH = 22;
FISH_SARDINE = 23;
FISH_HERRING = 24;
FISH_ANCHOVIE = 25;
FISH_TROUT = 26;
FISH_PIKE = 27;
FISH_SALMON = 28;
FISH_TUNA = 29;
FISH_LOBSTER = 30;
FISH_SWORDFISH = 31;
FISH_SMALLNET = 32;
FISH_CRAYPOT = 33;
FISH_ROD = 34;
FISH_BAIT = 35;
FISH_FLY = 36;
FISH_FEATHER = 37;
FISH_HARPOON = 38;
FISH_CAGE = 39;
ITEM_BIRD_NEST = 40;
const
OBJ_COUNT = 20;
TREE_NORMAL = 0;
TREE_OAK = 1;
TREE_WILLOW = 2;
TREE_MAPLE = 3;
TREE_YEW = 4;
TREE_MAGIC = 5;
ROCK_TIN = 6;
ROCK_COPPER = 7;
ROCK_IRON = 8;
MSI_BANK_VE = 9; // Includes the 'MSI_' because there are bank constants in SRL's Bank.scar
MSI_BANK_DB = 10;
MSI_BANK_GE = 11;
MSI_BANK_FE = 12;
DBOX_PS = 13;
FISHSPOT_NET = 14;
FISHSPOT_BAIT = 15;
FISHSPOT_LURE = 16;
FISHSPOT_CAGE = 17;
FISHSPOT_HARPOON = 18;
OBJ_BIRD_NEST = 19;
BIRD_NEST_CBMESSAGE = 'nest falls out of';
Here is the ItemInfo:
FISH_SHRIMP, FISH_ANCHOVIE:
Result := [ Point(462, 70), Point(461, 77), Point(456, 81),
Point(464, 64), Point(477, 65) ];
FISH_CRAYFISH:
Result := [ Point(910, 538), Point(907, 545), Point(914, 516),
Point(928, 526), Point(914, 528) ];
FISH_SARDINE:
Result := [ Point(48, 134), Point(50, 127), Point(58, 131),
Point(45, 140), Point(40, 140) ];
FISH_HERRING:
Result := [ Point(98, 138), Point(87, 143), Point(108, 124),
Point(113, 134), Point(89, 134) ];
FISH_TROUT, FISH_PIKE, FISH_SALMON:
Result := [ Point(194, 141), Point(214, 122), Point(218, 129),
Point(203, 126), Point(191, 146) ];
FISH_TUNA:
Result := [ Point(357, 136), Point(359, 124), Point(372, 136),
Point(347, 146), Point(344, 127) ];
FISH_LOBSTER:
Result := [ Point(414, 133), Point(424, 144), Point(463, 121),
Point(478, 134), Point(472, 140) ];
FISH_SWORDFISH:
Result := [ Point(357, 136), Point(359, 124), Point(372, 136),
Point(347, 146), Point(344, 127) ];
FISH_SMALLNET:
Result := [ Point(621, 229), Point(617, 217), Point(607, 230),
Point(634, 224), Point(630, 240) ];
FISH_CRAYPOT:
Result := [ Point(704, 340), Point(700, 326), Point(706, 347),
Point(715, 331), Point(694, 344) ];
FISH_ROD:
Result := [ Point(567, 341), Point(576, 350), Point(577, 329),
Point(573, 343), Point(590, 323) ];
FISH_BAIT:
Result := [ Point(665, 376), Point(649, 372), Point(667, 370),
Point(675, 373), Point(652, 381) ];
FISH_FLY:
Result := [ Point(615, 373), Point(632, 357), Point(617, 385),
Point(608, 381), Point(619, 365) ];
FISH_FEATHER:
Result := [ Point(580, 370), Point(564, 388), Point(594, 359),
Point(576, 365), Point(586, 374) ];
FISH_HARPOON:
Result := [ Point(629, 321), Point(612, 351), Point(622, 323),
Point(633, 324), Point(618, 335) ];
FISH_CAGE:
Result := [ Point(665, 343), Point(676, 328), Point(649, 345),
Point(666, 350), Point(658, 324) ];
FISH_SHRIMP : Result := 1712955;
FISH_CRAYFISH : Result := 1914462;
FISH_ANCHOVIE : Result := 7696496;
FISH_SARDINE : Result := 6466656;
FISH_HERRING : Result := 11053232;
FISH_TROUT : Result := 11843005;
FISH_PIKE : Result := 10269852;
FISH_SALMON : Result := 9606569;
FISH_TUNA : Result := 9408662;
FISH_LOBSTER : Result := 2046823;
FISH_SWORDFISH : Result := 9264774;
FISH_SMALLNET : Result := 2569539;
FISH_CRAYPOT : Result := 5461079;
FISH_ROD : Result := 5197651;
FISH_BAIT : Result := 1605551;
FISH_FLY : Result := 3355445;
FISH_FEATHER : Result := 530952;
FISH_HARPOON : Result := 6052960;
FISH_CAGE : Result := 6184546;
{ FISH ======================================== ]
[============================================== }
FISH_SHRIMP :
with MSI_Items[whichItem] do
begin
Name := 'Shrimp';
UpText := ['aw shrimps'];
ItemP := Point(0, 0);
Colors := [1712955];
Tol := 5;
Stackable := False;
DTM := MSI_LoadDTM(whichItem);
end;
FISH_CRAYFISH :
with MSI_Items[whichItem] do
begin
Name := 'Crayfish';
UpText := ['aw crayfish'];
ItemP := Point(0, 0);
Colors := [1914462];
Tol := 5;
Stackable := False;
DTM := MSI_LoadDTM(whichItem);
end;
FISH_ANCHOVIE :
with MSI_Items[whichItem] do
begin
Name := 'Anchovies';
UpText := ['aw anchovies'];
ItemP := Point(0, 0);
Colors := [7696496];
Tol := 5;
Stackable := False;
DTM := MSI_LoadDTM(whichItem);
end;
FISH_SARDINE :
with MSI_Items[whichItem] do
begin
Name := 'Sardines';
UpText := ['aw sardine'];
ItemP := Point(0, 0);
Colors := [6466656];
Tol := 5;
Stackable := False;
DTM := MSI_LoadDTM(whichItem);
end;
FISH_HERRING :
with MSI_Items[whichItem] do
begin
Name := 'Herring';
UpText := ['aw herring'];
ItemP := Point(0, 0);
Colors := [11053232];
Tol := 5;
Stackable := False;
DTM := MSI_LoadDTM(whichItem);
end;
FISH_TROUT :
with MSI_Items[whichItem] do
begin
Name := 'Trout';
UpText := ['aw trout'];
ItemP := Point(0, 0);
Colors := [11843005];
Tol := 5;
Stackable := False;
DTM := MSI_LoadDTM(whichItem);
end;
FISH_PIKE :
with MSI_Items[whichItem] do
begin
Name := 'Pike';
UpText := ['aw pike'];
ItemP := Point(0, 0);
Colors := [10269852];
Tol := 5;
Stackable := False;
DTM := MSI_LoadDTM(whichItem);
end;
FISH_SALMON :
with MSI_Items[whichItem] do
begin
Name := 'Salmon';
UpText := ['aw salmon'];
ItemP := Point(0, 0);
Colors := [9606569];
Tol := 5;
Stackable := False;
DTM := MSI_LoadDTM(whichItem);
end;
FISH_TUNA :
with MSI_Items[whichItem] do
begin
Name := 'Tuna';
UpText := ['aw tuna'];
ItemP := Point(0, 0);
Colors := [9408662];
Tol := 5;
Stackable := False;
DTM := MSI_LoadDTM(whichItem);
end;
FISH_LOBSTER :
with MSI_Items[whichItem] do
begin
Name := 'Lobster';
UpText := ['aw lobster'];
ItemP := Point(0, 0);
Colors := [2046823];
Tol := 5;
Stackable := False;
DTM := MSI_LoadDTM(whichItem);
end;
FISH_SWORDFISH :
with MSI_Items[whichItem] do
begin
Name := 'Swordfish';
UpText := ['aw swordfish'];
ItemP := Point(0, 0);
Colors := [9264774];
Tol := 5;
Stackable := False;
DTM := MSI_LoadDTM(whichItem);
end;
{ FISH TOOLS ================================= ]
[============================================= }
FISH_SMALLNET:
with MSI_Items[whichItem] do
begin
Name := 'Small Fishing Net';
UpText := ['ishing net'];
ItemP := Point(0, 0);
Colors := [2569539];
Tol := 5;
Stackable := False;
DTM := MSI_LoadDTM(whichItem);
end;
FISH_CRAYPOT:
with MSI_Items[whichItem] do
begin
Name := 'Crayfish Cage';
UpText := ['rayfish cage'];
ItemP := Point(0, 0);
Colors := [5461079];
Tol := 5;
Stackable := False;
DTM := MSI_LoadDTM(whichItem);
end;
FISH_ROD:
with MSI_Items[whichItem] do
begin
Name := 'Fishing Rod';
UpText := ['ishing rod'];
ItemP := Point(0, 0);
Colors := [5197651];
Tol := 5;
Stackable := False;
DTM := MSI_LoadDTM(whichItem);
end;
FISH_BAIT:
with MSI_Items[whichItem] do
begin
Name := 'Fishing Bait';
UpText := ['ishing bait'];
ItemP := Point(0, 0);
Colors := [1605551];
Tol := 5;
Stackable := True;
DTM := MSI_LoadDTM(whichItem);
end;
FISH_FLY:
with MSI_Items[whichItem] do
begin
Name := 'Fly Fishing Rod';
UpText := ['ly fishing'];
ItemP := Point(0, 0);
Colors := [3355445];
Tol := 5;
Stackable := False;
DTM := MSI_LoadDTM(whichItem);
end;
FISH_FEATHER:
with MSI_Items[whichItem] do
begin
Name := 'Feather';
UpText := ['eather'];
ItemP := Point(0, 0);
Colors := [530952];
Tol := 5;
Stackable := False;
DTM := MSI_LoadDTM(whichItem);
end;
FISH_HARPOON:
with MSI_Items[whichItem] do
begin
Name := 'Harpoon';
UpText := ['arpoon'];
ItemP := Point(0, 0);
Colors := [6052960];
Tol := 5;
Stackable := False;
DTM := MSI_LoadDTM(whichItem);
end;
FISH_CAGE:
with MSI_Items[whichItem] do
begin
Name := 'Lobster Pot';
UpText := ['obster pot'];
ItemP := Point(0, 0);
Colors := [6184546];
Tol := 5;
Stackable := False;
DTM := MSI_LoadDTM(whichItem);
end;
SKILL_FISHING:
case Items[i] of
FISH_SHRIMP : e := 10.0;
FISH_CRAYFISH : e := 10.0;
FISH_SARDINE : e := 20.0;
FISH_HERRING : e := 30.0;
FISH_ANCHOVIE : e := 40.0;
FISH_TROUT : e := 50.0;
FISH_PIKE : e := 60.0;
FISH_SALMON : e := 70.0;
FISH_TUNA : e := 80.0;
FISH_LOBSTER : e := 90.0;
FISH_SWORDFISH : e := 100.0;
TOOL_FISH:
for j := FISH_SMALLNET to FISH_CAGE do
Result := CombineIntArray(Result, MSI_FindItemSlots(j));
And this goes in mainloop.scar (SetupPlayer)
I need feedback on this function:
TOOL_FISH:
begin
gameTabs := [TAB_EQUIP, TAB_INV];
FishingTool := MSI_FishingTools;
if (Length(FishingTool) <= 0) then Exit;
for j := 0 to High(gameTabs) do
begin
Result := MSI_FindTool(FishingTool[0], gameTabs[j], x, y);
if (Length(FishingTool) > 1) then
Result := MSI_FindTool(FishingTool[1], gameTabs[j], x, y); // There are only ever two tools.
end;
//if tool isn't found, will attempt to withdraw from bank
if (not Result) then
begin
if (script.BankType = NoBank) then
begin
MSI_Debug('MSI_SetupPlayer', 'Failed to find required tool', DEBUG_FUNCTIONS);
Exit;
end;
case (MSI_Players[CurrentPlayer].Location) of
LOC_VE_BANK:
bankCheck := MSI_OpenBank(MSI_BANK_VE, MSI_Players[CurrentPlayer].Pin);
LOC_DB_BANK:
bankCheck := MSI_OpenBank(MSI_BANK_DB, MSI_Players[CurrentPlayer].Pin);
LOC_FE_BANK:
bankCheck := MSI_OpenBank(MSI_BANK_FE, MSI_Players[CurrentPlayer].Pin);
LOC_GE_BANK:
bankCheck := MSI_OpenBank(MSI_BANK_GE, MSI_Players[CurrentPlayer].Pin);
LOC_PS_DBOX:
bankCheck := MSI_OpenBank(DBOX_PS, MSI_Players[CurrentPlayer].Pin);
else
MSI_Debug('MSI_SetupPlayer', 'Invalid PlayerLocation', DEBUG_FUNCTIONS);
end;
if bankCheck then
if MSI_Withdraw([FishingTool], [1]) then
begin
Result := True;
Break;
end else begin
CloseBank;
MSI_Debug('MSI_PlayerSetup', 'Couldn''t Withdraw Tool', DEBUG_FUNCTIONS);
end
else
MSI_Debug('MSI_SetupPlayer', 'Unable to Open Bank', DEBUG_FUNCTIONS);
end;
end;
Some of these things have already been put in this thread, but this is a complete list (I think) of what I have added so far.
Still todo:
Fishspot finding
Waiting while fishing
Fish full inventory
Will all go in Fishing.scar
Other than that, I don't know if anything else is needed. If someone would like to help me with waiting for the fishing, I would really appreciate it, but other than that, I should have everything ready for beta powerfishing testing pretty soon.