Loot for DRW Shard
Posted: 2005-06-07 08:39:43
Скрипт на лут под шард ДРВ. Спасибо Beyonder за его скрипт .Я его немного дописал и подправил под свои нужды
##################################
### AutoLoot v 3.2 by Beyonder , Edit Dominator #
##################################
#
### Запускать auto_loot()
### Run the function auto_loot()
#
### Нужна любая функция CheckLag()
### Any CheckLag() function is needed for script
#
## Время достаточное для открытия контейнера
## Time enough for container to open
var OpenContWait=400
## Время между лутом вещей с трупов
## Delay after looting each item from corpses
var LootItemWait=400
## Время между лутом вещей с земли
## Delay after looting each item from ground
var LootGroundWait=400
## Нужно ли брать вещи без разбору?
## Taking items without specification
var LootAllItems=1 # 1=true 0=false
## Сначала резать трупы?
## Carve corpses first
var CutCorpse=true
## Тип вещи которой будем резать
## Type of the item we want to carve the corpses
var CutItemType='0x0F52'
## Как далеко лежащие трупы можно лутить
## Distance to the corpse we can loot
var maxlen=3
## ID мешка куда будем складывать вещи
## ID of the bag we want to put the items to
var BagID='0x40032183'
## Забирать вещи с земли?
## Do you want loot from the ground too?
var LootGround=true
## Время достаточное на разрезание трупа
## Time enough for carving the corpse
var CutTime=300
## Отключить вывод системных сообщений в клиенте
## Disable verbosing in client
var NoVerbose=true
### Основная функция лута # ContainerID - ID контейнера # BagID - ID мешка куда складывать вещи
### Main looting function # Container ID - ID of the container to loot # BagID - bag where to put
sub loot_container(ContainerID,BagID)
var ContCnt=3 #Количество указанных контейнеров # Container count
var NeedCnt=21 #Количество указанных вещей для лута # Loot items count
dim ContFr[4] #Массив контейнеров. Число в скобках должно быть больше ContCnt # Container array, value must be set >ContCnt
dim ContTo[40] #То-же условие что и выше # Same as for ContFr
dim NeedFr[40] #Массив вещей. Число в скобках должно быть больше NeedCnt # Item array # Value must be set > NeedCnt
dim NeedTo[40] #То-же условие что и для NeedFr # Same as for NeedFr
dim NeedTypes[40] #То-же условие что и для NeedFr # Same as for NeedFr
var ItemGr
var ItemID
var FCnt
var iItem
var waittime
if ContainerID==UO.GetSerial('ground') then
waittime=LootGroundWait
else
waittime=LootItemWait
end if
##### Настройка вещей
##### Item config
#### Контейнеры
#### Containers
ContFr[0]='0x0E70'
ContTo[0]='0x0E80'
#
ContFr[1]='0x09B0'
ContTo[1]='0x09B0'
#### Вещи
#### Items
#### Gold
NeedFr[2]='0x0EED'
NeedTo[2]='0x0EED'
#### Dead Woods
NeedFr[3]='0x0F90'
NeedTo[3]='0x0F90'
#### Skeleton Bones
NeedFr[4]='0x0F7E'
NeedTo[5]='0x0F7E'
#### Eyes of newt
NeedFr[5]='0x0F87'
NeedTo[5]='0x0F87'
#### Wyrm"s Hearts
NeedFr[6]='0x0F91'
NeedTo[6]='0x0F91'
#### Mana (Total mana)
NeedFr[7]='0x09DF'
NeedTo[7]='0x09DF'
#### GH
NeedFr[8]='0x09BB'
NeedTo[8]='0x09BB'
#### FS
NeedFr[9]='0x1F5F'
NeedTo[9]='0x1F5F'
#### Full_Platemail
NeedFr[10]='0x1410'
NeedTo[10]='0x1415'
#### Heater
NeedFr[11]='0x1B76'
NeedTo[11]='0x1B76'
#### VikingSword
NeedFr[12]='0x13B9'
NeedTo[12]='0x13B9'
#### Halberd
NeedFr[13]='0x143e'
NeedTo[13]='0x143e'
#### Bow
NeedFr[14]='0x13b1'
NeedTo[14]='0x13b1'
#### GA ; GI ; MR
NeedFr[15]='0x0F84'
NeedTo[15]='0x0F86'
#### BP
NeedFr[16]='0x0F7A'
NeedTo[16]='0x0F7A'
#### NS
NeedFr[17]='0x0F88'
NeedTo[17]='0x0F88'
#### SA
NeedFr[18]='0x0F8C'
NeedTo[18]='0x0F8C'
#### SS
NeedFr[19]='0x0F8D'
NeedTo[19]='0x0F8D'
#### Batwing
NeedFr[20]='0x0F78'
NeedTo[20]='0x0F78'
#### Blank Scroll
NeedFr[21]='0x0E34'
NeedTo[21]='0x0E34'
#### Какие из перечисленных типов нам нужны
#### Which of the types we need
NeedTypes[0]=1
NeedTypes[1]=1
NeedTypes[2]=1
NeedTypes[3]=1
NeedTypes[4]=1
NeedTypes[5]=1
NeedTypes[6]=1
NeedTypes[7]=1
NeedTypes[8]=1
NeedTypes[9]=1
NeedTypes[10]=1
NeedTypes[11]=1
NeedTypes[12]=1
NeedTypes[13]=1
NeedTypes[14]=1
NeedTypes[15]=1
NeedTypes[16]=1
NeedTypes[17]=1
NeedTypes[18]=1
NeedTypes[19]=1
NeedTypes[20]=1
NeedTypes[21]=1
#### Getting items up
repeat
UO.FindType(-1,-1,ContainerID)
FCnt=UO.FindCount()
if UO.FindCount()>0 then
ItemGr=UO.GetGraphic('finditem')
ItemID=UO.GetSerial('finditem')
if LootAllItems==0 then
## Scanning for bags
iItem=0
while iItem<ContCnt
if IsDip(ItemGr,ContFr[iItem],ContTo[iItem]) then
UO.UseObject(ItemID) ## Opening container
wait(OpenContWait)
loot_container(ItemID,BagID)
UO.Hide(ItemID) ## Closing opened container
iItem=ContCnt
end if
iItem=iItem+1
wend
## Scanning for items
iItem=0
while iItem<NeedCnt
if NeedTypes[iItem] AND IsDip(ItemGr,NeedFr[iItem],NeedTo[iItem]) then
UO.MoveItem(ItemID,0,BagID)
wait(waittime)
iItem=NeedCnt
end if
iItem=iItem+1
wend
else
UO.MoveItem(ItemID,0,BagID)
wait(waittime)
end if
UO.Ignore(ItemID)
end if
until FCnt==0
end sub
## Функция режет выбранный труп
## Function cuts selected corpse
Sub CutCorpseID(CorpseID)
var CutID
var Dressed=true
if UO.GetGraphic(UO.ObjAtLayer('Rhand'))==CutItemType then
CutID=UO.GetSerial(UO.ObjAtLayer('Rhand'))
else
if UO.GetGraphic(UO.ObjAtLayer('Lhand'))==CutItemType then
CutID=UO.GetSerial(UO.ObjAtLayer('Lhand'))
else
UO.FindType(CutItemType,-1,'my')
CutID=UO.GetSerial('finditem')
Dressed=false
end if
end if
if not Dressed then
UO.SetArm('cutting_start_arm')
end if
UO.WaitTargetObject(CorpseID)
UO.UseObject(CutID)
wait(CutTime)
return Dressed
end sub
### Функция возвращает следующий труп
### Function returns next corpse
sub next_corpse()
var CorpseID
repeat
UO.FindType('0x2006',-1,'ground') ### Finding corpse
CorpseID=UO.GetSerial('finditem')
if UO.FindCount()==0 then
CorpseID=0 ## No more corpses
else
UO.Ignore(CorpseID)
return CorpseID
end if
until CorpseID==0
return CorpseID
end sub
### Проверка на принадлежность значения диапазону
### Check for a value being between bounds
sub IsDip(x,f,t)
var i_x=UO.Hex2Int(x)
var i_f=UO.Hex2Int(f)
var i_t=UO.Hex2Int(t)
if (i_x>=i_f AND i_x<=i_t) OR (i_x<=i_f AND i_x>=i_t) then
return true
else
return false
end if
end sub
Sub CollectCorpses(Arr)
var CorpseID=1
var CorpseCnt=0
UO.IgnoreReset()
while CorpseID<>0
CorpseID=next_corpse()
if CorpseID<>0 then
Arr[CorpseCnt]=CorpseID
UO.Ignore(CorpseID)
CorpseCnt=CorpseCnt+1
end if
wend
return CorpseCnt
end sub
### Функция лутящая все трупы вокруг
### All corpse looting function
sub auto_loot()
dim Corpses[50]
var CorpseCnt=0
var CorpseNum
var Dressed=true
uo.set('quiet',NoVerbose)
uo.set('finddistance',maxlen)
## Searching Corpses
CorpseCnt=CollectCorpses(Corpses)
## Looting corpses
if (CorpseCnt>0) then
if CutCorpse then
for CorpseNum=0 to CorpseCnt-1
UO.Print('Cutting')
Dressed=Dressed*CutCorpseID(Corpses[CorpseNum])
next
CorpseCnt=CollectCorpses(Corpses)
end if
end if
if CorpseCnt>0 then
if not Dressed then
UO.Arm('cutting_start_arm')
end if
for CorpseNum=0 to CorpseCnt-1
UO.DeleteJournal()
UO.UseObject(Corpses[CorpseNum])
wait(OpenContWait)
loot_container(Corpses[CorpseNum],BagID)
next
end if
if LootGround then
loot_container('ground',BagID) #
end if
UO.IgnoreReset()
uo.set('quiet',0)
end sub
##################################
### AutoLoot v 3.2 by Beyonder , Edit Dominator #
##################################
#
### Запускать auto_loot()
### Run the function auto_loot()
#
### Нужна любая функция CheckLag()
### Any CheckLag() function is needed for script
#
## Время достаточное для открытия контейнера
## Time enough for container to open
var OpenContWait=400
## Время между лутом вещей с трупов
## Delay after looting each item from corpses
var LootItemWait=400
## Время между лутом вещей с земли
## Delay after looting each item from ground
var LootGroundWait=400
## Нужно ли брать вещи без разбору?
## Taking items without specification
var LootAllItems=1 # 1=true 0=false
## Сначала резать трупы?
## Carve corpses first
var CutCorpse=true
## Тип вещи которой будем резать
## Type of the item we want to carve the corpses
var CutItemType='0x0F52'
## Как далеко лежащие трупы можно лутить
## Distance to the corpse we can loot
var maxlen=3
## ID мешка куда будем складывать вещи
## ID of the bag we want to put the items to
var BagID='0x40032183'
## Забирать вещи с земли?
## Do you want loot from the ground too?
var LootGround=true
## Время достаточное на разрезание трупа
## Time enough for carving the corpse
var CutTime=300
## Отключить вывод системных сообщений в клиенте
## Disable verbosing in client
var NoVerbose=true
### Основная функция лута # ContainerID - ID контейнера # BagID - ID мешка куда складывать вещи
### Main looting function # Container ID - ID of the container to loot # BagID - bag where to put
sub loot_container(ContainerID,BagID)
var ContCnt=3 #Количество указанных контейнеров # Container count
var NeedCnt=21 #Количество указанных вещей для лута # Loot items count
dim ContFr[4] #Массив контейнеров. Число в скобках должно быть больше ContCnt # Container array, value must be set >ContCnt
dim ContTo[40] #То-же условие что и выше # Same as for ContFr
dim NeedFr[40] #Массив вещей. Число в скобках должно быть больше NeedCnt # Item array # Value must be set > NeedCnt
dim NeedTo[40] #То-же условие что и для NeedFr # Same as for NeedFr
dim NeedTypes[40] #То-же условие что и для NeedFr # Same as for NeedFr
var ItemGr
var ItemID
var FCnt
var iItem
var waittime
if ContainerID==UO.GetSerial('ground') then
waittime=LootGroundWait
else
waittime=LootItemWait
end if
##### Настройка вещей
##### Item config
#### Контейнеры
#### Containers
ContFr[0]='0x0E70'
ContTo[0]='0x0E80'
#
ContFr[1]='0x09B0'
ContTo[1]='0x09B0'
#### Вещи
#### Items
#### Gold
NeedFr[2]='0x0EED'
NeedTo[2]='0x0EED'
#### Dead Woods
NeedFr[3]='0x0F90'
NeedTo[3]='0x0F90'
#### Skeleton Bones
NeedFr[4]='0x0F7E'
NeedTo[5]='0x0F7E'
#### Eyes of newt
NeedFr[5]='0x0F87'
NeedTo[5]='0x0F87'
#### Wyrm"s Hearts
NeedFr[6]='0x0F91'
NeedTo[6]='0x0F91'
#### Mana (Total mana)
NeedFr[7]='0x09DF'
NeedTo[7]='0x09DF'
#### GH
NeedFr[8]='0x09BB'
NeedTo[8]='0x09BB'
#### FS
NeedFr[9]='0x1F5F'
NeedTo[9]='0x1F5F'
#### Full_Platemail
NeedFr[10]='0x1410'
NeedTo[10]='0x1415'
#### Heater
NeedFr[11]='0x1B76'
NeedTo[11]='0x1B76'
#### VikingSword
NeedFr[12]='0x13B9'
NeedTo[12]='0x13B9'
#### Halberd
NeedFr[13]='0x143e'
NeedTo[13]='0x143e'
#### Bow
NeedFr[14]='0x13b1'
NeedTo[14]='0x13b1'
#### GA ; GI ; MR
NeedFr[15]='0x0F84'
NeedTo[15]='0x0F86'
#### BP
NeedFr[16]='0x0F7A'
NeedTo[16]='0x0F7A'
#### NS
NeedFr[17]='0x0F88'
NeedTo[17]='0x0F88'
#### SA
NeedFr[18]='0x0F8C'
NeedTo[18]='0x0F8C'
#### SS
NeedFr[19]='0x0F8D'
NeedTo[19]='0x0F8D'
#### Batwing
NeedFr[20]='0x0F78'
NeedTo[20]='0x0F78'
#### Blank Scroll
NeedFr[21]='0x0E34'
NeedTo[21]='0x0E34'
#### Какие из перечисленных типов нам нужны
#### Which of the types we need
NeedTypes[0]=1
NeedTypes[1]=1
NeedTypes[2]=1
NeedTypes[3]=1
NeedTypes[4]=1
NeedTypes[5]=1
NeedTypes[6]=1
NeedTypes[7]=1
NeedTypes[8]=1
NeedTypes[9]=1
NeedTypes[10]=1
NeedTypes[11]=1
NeedTypes[12]=1
NeedTypes[13]=1
NeedTypes[14]=1
NeedTypes[15]=1
NeedTypes[16]=1
NeedTypes[17]=1
NeedTypes[18]=1
NeedTypes[19]=1
NeedTypes[20]=1
NeedTypes[21]=1
#### Getting items up
repeat
UO.FindType(-1,-1,ContainerID)
FCnt=UO.FindCount()
if UO.FindCount()>0 then
ItemGr=UO.GetGraphic('finditem')
ItemID=UO.GetSerial('finditem')
if LootAllItems==0 then
## Scanning for bags
iItem=0
while iItem<ContCnt
if IsDip(ItemGr,ContFr[iItem],ContTo[iItem]) then
UO.UseObject(ItemID) ## Opening container
wait(OpenContWait)
loot_container(ItemID,BagID)
UO.Hide(ItemID) ## Closing opened container
iItem=ContCnt
end if
iItem=iItem+1
wend
## Scanning for items
iItem=0
while iItem<NeedCnt
if NeedTypes[iItem] AND IsDip(ItemGr,NeedFr[iItem],NeedTo[iItem]) then
UO.MoveItem(ItemID,0,BagID)
wait(waittime)
iItem=NeedCnt
end if
iItem=iItem+1
wend
else
UO.MoveItem(ItemID,0,BagID)
wait(waittime)
end if
UO.Ignore(ItemID)
end if
until FCnt==0
end sub
## Функция режет выбранный труп
## Function cuts selected corpse
Sub CutCorpseID(CorpseID)
var CutID
var Dressed=true
if UO.GetGraphic(UO.ObjAtLayer('Rhand'))==CutItemType then
CutID=UO.GetSerial(UO.ObjAtLayer('Rhand'))
else
if UO.GetGraphic(UO.ObjAtLayer('Lhand'))==CutItemType then
CutID=UO.GetSerial(UO.ObjAtLayer('Lhand'))
else
UO.FindType(CutItemType,-1,'my')
CutID=UO.GetSerial('finditem')
Dressed=false
end if
end if
if not Dressed then
UO.SetArm('cutting_start_arm')
end if
UO.WaitTargetObject(CorpseID)
UO.UseObject(CutID)
wait(CutTime)
return Dressed
end sub
### Функция возвращает следующий труп
### Function returns next corpse
sub next_corpse()
var CorpseID
repeat
UO.FindType('0x2006',-1,'ground') ### Finding corpse
CorpseID=UO.GetSerial('finditem')
if UO.FindCount()==0 then
CorpseID=0 ## No more corpses
else
UO.Ignore(CorpseID)
return CorpseID
end if
until CorpseID==0
return CorpseID
end sub
### Проверка на принадлежность значения диапазону
### Check for a value being between bounds
sub IsDip(x,f,t)
var i_x=UO.Hex2Int(x)
var i_f=UO.Hex2Int(f)
var i_t=UO.Hex2Int(t)
if (i_x>=i_f AND i_x<=i_t) OR (i_x<=i_f AND i_x>=i_t) then
return true
else
return false
end if
end sub
Sub CollectCorpses(Arr)
var CorpseID=1
var CorpseCnt=0
UO.IgnoreReset()
while CorpseID<>0
CorpseID=next_corpse()
if CorpseID<>0 then
Arr[CorpseCnt]=CorpseID
UO.Ignore(CorpseID)
CorpseCnt=CorpseCnt+1
end if
wend
return CorpseCnt
end sub
### Функция лутящая все трупы вокруг
### All corpse looting function
sub auto_loot()
dim Corpses[50]
var CorpseCnt=0
var CorpseNum
var Dressed=true
uo.set('quiet',NoVerbose)
uo.set('finddistance',maxlen)
## Searching Corpses
CorpseCnt=CollectCorpses(Corpses)
## Looting corpses
if (CorpseCnt>0) then
if CutCorpse then
for CorpseNum=0 to CorpseCnt-1
UO.Print('Cutting')
Dressed=Dressed*CutCorpseID(Corpses[CorpseNum])
next
CorpseCnt=CollectCorpses(Corpses)
end if
end if
if CorpseCnt>0 then
if not Dressed then
UO.Arm('cutting_start_arm')
end if
for CorpseNum=0 to CorpseCnt-1
UO.DeleteJournal()
UO.UseObject(Corpses[CorpseNum])
wait(OpenContWait)
loot_container(Corpses[CorpseNum],BagID)
next
end if
if LootGround then
loot_container('ground',BagID) #
end if
UO.IgnoreReset()
uo.set('quiet',0)
end sub