# Shard: Imperial Shard
# Macro: Mineração em Minoc, minera, funde e guarda os minérios no banco.
#### ## ## ##### ###### ##### #### ## ##
## ### ### ## ## ## ## ## ## #### ##
## ####### ## ## ## ## ## ## ## ## ##
## ## # ## ##### #### ##### ## ###### ##
## ## ## ## ## #### ## ## ## ##
## ## ## ## ## ## ## ## ## ## ##
#### ## ## ## ###### ## ## #### ## ## ######
## #### ######
#### ## ## ##
## ## ## ##
###### ## ### ####
## ## ## ## ##
## ## ## ## ##
## ## #### ######
#### ## ## ## ##### ####
## ## ## ## #### ## ## ## ##
## ## ## ## ## ## ## ## ##
#### ###### ###### ##### ## ##
## ## ## ## ## #### ## ##
## ## ## ## ## ## ## ## ## ##
#### ## ## ## ## ## ## ####
# Instruções para uso do macro de mineração:
# 1. Coloque um baú ou mochila no banco e anote o ID dele usando o Classic Assist.
# -> Clique em Object Inspector, selecione a mochila ou bau, anote o seu serial e substitua o código na linha 'storeIngots'.
# -> Coloque 0 se não quiser ir ao banco.
#
# 2. Na primeira execução, escolha a forja quando solicitado.
#
# 3. Deixe a picareta na mochila do personagem. O macro pegará a picareta automaticamente quando necessário.
#
# 4. O macro minerará priorizando os minérios coloridos e levará ao banco de acordo com a configuração.
#
# 5. Altere "maxWeightBeforeSmelt" para definir o peso máximo antes de fundir os minérios.
#
# 6. Altere a linha "if Weight() > (maxWeightBeforeSmelt * 0.8)" para ajustar o percentual de peso que deseja levar ao banco.
import clr
import System
clr.AddReference('System.Core')
clr.ImportExtensions(System.Linq)
from Assistant import Engine
from System import Random
# Configurações para mineração no Imperial Shard
miningToolName = "Picareta"
maxWeightBeforeSmelt = 300 # Peso máximo antes de fundir o minério -> Aqui você coloca o peso máximo do seu personagem para o momento de fundir.
forgeDistance = 2 # Distância máxima para acessar a forja
storeIngots = 0x4003133a # ID do baú de lingotes - > Aqui você altera para a id da bag dentro do seu banco! (coloque 0 se não quiser ir ao banco)
miningTool = 0
def GetSelfItems(filter=None):
if Engine.Player == None:
return []
if Engine.Player.Backpack.Container == None:
UseObject('backpack')
WaitForContents('backpack', 5000)
items = Engine.Player.Backpack.Container.SelectEntities(lambda i: filter == None or i.Name.Contains(filter))
if items == None:
return []
return items.Select(lambda i: i.Serial)
def GetFirst(l):
for item in l:
return item
return 0
def GetPickaxe():
if FindLayer("OneHanded"):
if miningToolName in Name(GetAlias('found')):
return
ClearHands()
Pause(1500)
miningToolList = GetSelfItems(miningToolName)
if miningToolList == []:
SysMessage("SEM PICARETA", 39)
else:
miningTool = GetFirst(miningToolList)
SysMessage("PICARETA: " + hex(miningTool), 64)
EquipItem(miningTool, "OneHanded")
Pause(2000)
def Mine():
ClearJournal()
while Weight() < maxWeightBeforeSmelt:
for ore in [0x9caa, 0x9cab, 0x9cac]:
if FindType(ore, 20):
if Z('found') != Z() or X('found') < 2555 or X('found') > 2581 or Y('found') > 495 or Y('found') < 474:
IgnoreObject('found')
else:
WalkTo('found', 1)
while Weight() < maxWeightBeforeSmelt and FindObject('found', 2) and not InJournal("Voce precisaria de ", 'system'):
if not UseLayer("OneHanded"):
break
WaitForTarget(5000)
Target('found')
if WaitForJournal("Voce precisaria de ", 5000, 'system'):
IgnoreObject('found')
ClearJournal()
if not UseLayer("OneHanded"):
break
WaitForTarget(5000)
Target('self')
if WaitForJournal("nao tem minerio aqui", 1500, 'system') or WaitForJournal("Você não pode minerar isto.", 2000, 'system'):
WalkRandom()
ClearJournal()
def WalkRandom():
rand = ['East', 'West', 'North', 'South', 'Northeast', 'Southeast', 'Southwest', 'Northwest']
rando = Random()
Run(rand[rando.Next(8)])
Pause(500)
Run(Direction('self'))
Run(Direction('self'))
Run(Direction('self'))
while Y() > 495:
Pause(100)
Run('North')
def WalkTo(alias, distance):
walkfail = 0
while Distance(alias) > distance:
x = X()
y = Y()
if walkfail < 3:
Run(DirectionTo(alias))
else:
WalkRandom()
Pause(100)
if x == X() and y == Y():
walkfail += 1
else:
walkfail = 0
def Smelt():
oreTypes = [0x19b7, 0x19b8, 0x19b9, 0x19ba]
WalkTo('forge', forgeDistance)
ClearIgnoreList()
for ore in oreTypes:
while FindType(ore, -1, 'backpack'):
if Graphic('found') == 0x19b7:
item = Engine.Items.GetItem(GetAlias('found'))
if item.Count <= 1:
IgnoreObject('found')
continue
UseObject('found')
WaitForTarget(5000)
Target('forge')
Pause(1000)
IgnoreObject('found')
def StoreInBank():
if storeIngots <= 0:
return
gobank = [(2564, 487), (2559, 497), (2559, 502), (2548, 501), (2527, 501), (2527, 516), (2509, 516), (2509, 541)]
for (x, y) in gobank:
Pathfind(x, y, Z())
while Pathfinding():
Pause(3000)
if X() == gobank[-1][0] and Y() == gobank[-1][1]:
Msg("banco")
Pause(1000)
else:
return
ClearIgnoreList()
FindObject(storeIngots, -1, 'self')
SetAlias('ore chest', 'found')
while FindType(0x1bf2, -1, 'backpack'):
MoveItem('found', 'ore chest')
Pause(1500)
IgnoreObject('found')
gobank.reverse()
for (x, y) in gobank:
Pathfind(x, y, Z())
while Pathfinding():
Pause(100)
if not FindObject('forge'):
PromptAlias('forge') # Solicita ao usuário que defina a forja se ainda não estiver definida
ClearIgnoreList()
GetPickaxe()
while FindLayer("OneHanded"):
WalkRandom()
Mine()
Smelt()
if Weight() > (maxWeightBeforeSmelt * 0.8):
StoreInBank()
GetPickaxe()
Smelt()
if FindType(0x1bf2, -1, 'backpack'): # Armazena os lingotes restantes, se houver
StoreInBank()