;_____________________________________________________________________________________________________________________________ ;__GlobalVars_________________________________________________________________________________________________________________ ;_____________________________________________________________________________________________________________________________ var Media.Success = "C:\WINDOWS\Media\tada.wav"; ;_____________________________________________________________________________________________________________________________ ;__Mining_____________________________________________________________________________________________________________________ ;_____________________________________________________________________________________________________________________________ sub Mining() ; Vzdalenost ve ktere se bude kopat kolem ; [ cislo - vzdalenost ; [ base = 2 var distance = 2; ; Pouzivat skill hiding? ; [ 0 - nepouzivat hiding ; [ cokolivJineho - pouzivat hiding ; [ base = 0 var useHiding = 1; var x = 0; var y = 0; for x = -distance to distance step 1 for y = -distance to distance step 1 if (Mining.MineSpot(x, y, useHiding) == 0) then return 0; endif next next UO.PlayWav(Media.Success); UO.Print("Mining finished!"); return 1; end sub Sub Mining.MineSpot(x, y, hidingEnabled) var toolGraphic = 0x0E85; var toolColor = 0xFFFF; var stop = 0; var timer = UO.Timer(); var oCharPosX = UO.GetX("self"); var oCharPosY = UO.GetY("self"); Mining.DropOre(); stop = 0; UO.DeleteJournal(); UO.Print("Mining on [" + Str(x) + ", " + Str(y) + "]"); while (not UO.InJournal("There is no ore here to mine") and not stop) Mining.HideMe(hidingEnabled); UO.DeleteJournal(); UO.FindType(toolGraphic, toolColor, "self"); if (UO.FindCount() <= 0) then UO.FindType(toolGraphic, toolColor, "backpack"); if (UO.FindCount() <= 0) then UO.Print("No tool found!"); return 0; endif endif UO.WaitTargetTile(1339, x, y, 0); UO.UseObject("finditem"); Journal.WaitForText(40000, "You put the|You loosen some rocks but fail to find any useable ore|There is no ore here to mine|Jeste nemuzes pouzit krumpac...|*You destroy pickaxe*") if (UO.InJournal("Jeste nemuzes pouzit krumpac...")) then Wait(2000); endif timer = UO.Timer(); Wait(500); stop = Mining.DropOre(); WaitForTimer(timer + 15); if (UO.Weight > UO.Str * 3.5) then oCharPosX = UO.GetX("self"); oCharPosY = UO.GetY("self"); UO.Print("You are overloaded!"); UO.Print("Let loose some weight and return back."); while (UO.Weight > UO.Str * 3.5) Wait(100); wend UO.Print("Great! Now return back."); UO.Track(oCharPosX, oCharPosY); while (UO.GetX("self") <> oCharPosX || UO.GetY("self") <> oCharPosY) Wait(100); wend UO.Track(0); UO.Print("Nice! Now continue mining."); endif wend WaitForTimer(timer + 35); end sub Sub Mining.HideMe(enabled) if (enabled == 0) then return UO.Hidden(); endif while (not UO.Hidden()) UO.Print("Trying to hide.."); UO.DeleteJournal(); UO.UseSkill("Hiding"); Journal.WaitForText(40000, "You have hidden|You can't seem to hide here"); Wait(500); wend return UO.Hidden(); end sub Sub Mining.DropOre() dim oreOption[18]; ; "color;drop;stop;name" oreOption[0] = "0x0000;1;1;iron"; oreOption[1] = "0x0289;1;1;copper"; oreOption[2] = "0x01BF;1;0;bronze"; oreOption[3] = "0x0482;1;1;silver"; oreOption[4] = "0x0322;1;1;shadow"; oreOption[5] = "0x0665;1;1;rose"; oreOption[6] = "0x0160;1;1;golden"; oreOption[7] = "0x01CB;0;0;verite"; oreOption[8] = "0x0253;0;0;valorite"; oreOption[9] = "0x04C2;0;0;blood rock"; oreOption[10] = "0x0455;0;0;black rock"; oreOption[11] = "0x052D;0;0;mytheril"; oreOption[12] = "0x0006;0;0;star sapphire"; oreOption[13] = "0x0041;0;0;emerald"; oreOption[14] = "0x002C;0;0;citrine"; oreOption[15] = "0x0015;0;0;amethyst"; oreOption[16] = "0x0027;0;0;ruby"; oreOption[17] = "0x03E9;0;0;diamond"; var result = 0; var bOre = 0; var gOre = 0; var oreNum; var oreColor; var oreDrop; var oreStop; var oreName; for oreNum = 0 to 17 step 1 oreColor = GetParam(1, oreOption[oreNum]); oreDrop = Val(GetParam(2, oreOption[oreNum])); oreStop = Val(GetParam(3, oreOption[oreNum])); oreName = GetParam(4, oreOption[oreNum]); if (oreDrop <> 0) then bOre = Mining.DropOre.FindOre(oreColor, "backpack"); if (bOre <> 0) then UO.Print("Dropping " + Str(UO.GetQuantity(bOre)) + " " + oreName + " ore."); gOre = Mining.DropOre.FindOre(oreColor, "ground"); if (gOre <> 0) then UO.MoveItem(bOre, -1, gOre); else UO.MoveItem(bOre, -1, "ground"); endif WaitForItemMove(40000, bOre); Wait(500); if (oreStop <> 0) then result = 1; endif endif endif next return result; end sub Sub Mining.DropOre.FindOre(color, place) var oreGraphic = 0; UO.Set("finddistance", 1); for oreGraphic = 0x19B7 to 0x19BA step 1 UO.FindType(oreGraphic, color, place); if (UO.FindCount() > 0) then return UO.GetSerial("finditem"); endif next return 0; end sub Sub GetParam(number, string) var i = 0; var temp = ""; var n = 1; for i = 0 to Len(string) - 1 step 1 temp = ""; while (string[i] <> ";" && i < Len(string)) temp = temp + string[i]; i = i + 1; wend if (n == number) then return temp; endif n = n + 1; next return "0"; end sub Sub Journal.WaitForText(timeOut, messages) if (timeOut > 0) then timeOut = timeOut / 10 + UO.Timer(); endif while (timeOut > UO.Timer() || timeOut <= 0) if (UO.InJournal(messages)) then return 1; endif Wait(100); wend return 0; end sub Sub WaitForItemMove(timeOut, serial) if (timeOut > 0) then timeOut = timeOut / 100 + UO.Timer(); endif var ox = UO.GetX(serial); var oy = UO.GetY(serial); var container = UO.ContainerOf(serial); while (timeOut > UO.Timer() || timeOut <= 0) if ((UO.GetX(serial) <> ox || UO.GetY(serial) <> oy || UO.ContainerOf(serial) <> container) && not (UO.GetX(serial) == 0 && UO.GetY(serial) == 0)) then return 1; endif Wait(100); wend return 0; end sub Sub WaitForTimer(timer) while (timer > UO.Timer()) Wait(100); wend end sub