Forum in READ ONLY mode! All questions and discussions on Discord official server, invite link: https://discord.gg/VxsGzJ7

Алхимия для FW (пойзоны)

Only working scripts
Post Reply
Edred
Moderator
Moderator
Posts: 559
Joined: 28.03.2006 21:29

Алхимия для FW (пойзоны)

Post by Edred »

Потребуются два ящика (сундука), один забитый пустыми мешками (на FW поушены складываются в стеки по 20 шт только). Под ноги кучу найтшейда и бутылок. В пак пестик.

Скрипт сделан через крафт хитро: первый раз крафтится через меню, последующие через команду .makelast
Если у вас на шарде такой команды нету - удалите строку:

Code: Select all

FirstTime := false;
И у вас всегда будет крафтиться через меню. 8)

Поехали.

Code: Select all

Program AlchemyUP; 
// v.1.02b (c) Edred 

{$Include 'all.inc'} 

var 
ctime : TDateTime;
LastContOpen : TDateTime;
k, s, m : integer; 
tmpser,curbag : cardinal;
FirstTime : boolean;

const 
TypBottles = $0F0E;      // Тип бутылок
//TypPotion = $0F0D;
TypPotion = $0F0A;
CountRegs = 10;
HowGetRegs = 200;
CountBottles = 5;
HowGetBottles = 100;
HowDropBottles = 20;
TrashID = $4005198D;
SundukEmptyBag = $40053D27;			// тут лежат пустые мешки
Sunduk2Craft = $40053D34;			// сюда кладем скрафченное
BagType = $0E76;

	procedure OpenContainer(f : boolean);
	// если f - true - просто открываем все нужные контейнеры, то есть:
	// SundukIngots,SundukEmptyBag,Sunduk2Craft и curbag (если он не равен 0)
	// если f - false - проверяем, был ли реконнект чара после последнего
	// открывания контейнеров, если был - переоткрываем контейнеры и записываем
	// новое значение в переменную LastContOpen, если не был - ничего не делаем
	begin
		waitconnection(3000);
		if (f = true) or (LastContOpen < ConnectedTime) then
		begin
			UseObject(SundukEmptyBag);
			wait(1000);
			checksave;
			UseObject(Sunduk2Craft);
			wait(1000);
			checksave;
			if curbag <> 0 then
			begin
				UseObject(curbag);
				wait(1000);
				checksave;
			end;
			LastContOpen := Now;
			addtosystemjournal('Контейнеры открыты в ' + DateTimeToStr(Now));
		end;
	end;

	function GetEmptyBag : cardinal;
	// берет пустой мешок из одного контейнера и помещает в другой
	// возвращает сериал пустого мешка
	var tmp1 : cardinal;
	begin
		Result := 0;
		waitconnection(3000);
		tmp1 := FindType(BagType,SundukEmptyBag);
		if tmp1 = 0 then
		begin
			Addtosystemjournal('Error: кончились мешки');
			exit;
		end;
		MoveItem(tmp1,1,Sunduk2Craft,0,0,0);
		wait(1000);
		CheckSave;
		UseObject(tmp1);
		wait(1000);
		CheckSave;
		Result := tmp1;
		Addtosystemjournal('Взял новый мешок');
	end;

	function CheckCountPotion : Boolean;
	begin
		Result := False;
		findtype(TypPotion,curbag);
		if findcount > 240 then exit;
		Result := True;
	end;

	function GetRes : boolean;
	begin
		Result := True;
		if Count(NS) < CountRegs then
		begin
			findtype(NS,ground);
			if GetQuantity(Finditem) < HowGetRegs then
			begin
				if GetQuantity(Finditem) = 0 then
				repeat
					addtosystemjournal('Warning: Мало регов на полу');
					wait(10000);
					findtype(NS,ground);
				until GetQuantity(Finditem) >= HowGetRegs;
			end;
			m := GetQuantity(finditem);
			Grab(FindItem,HowGetRegs);
			wait(1000);
			checksave;
			addtosystemjournal('Взял ' + inttostr(HowGetRegs) + ' NS из ' + inttostr(m));
		end;
		if Count(TypBottles) < CountBottles then
		begin
			findtype(TypBottles,ground);
			if GetQuantity(Finditem) < HowGetBottles then
			begin
				repeat
					addtosystemjournal('Warning: Мало бутылок на полу');
					wait(10000);
					findtype(TypBottles,ground);
				until GetQuantity(Finditem) >= HowGetBottles;
			end;
			m := GetQuantity(finditem);
			Grab(FindItem,HowGetBottles);
			wait(1000);
			checksave;
			addtosystemjournal('Взял ' + inttostr(HowGetBottles) + ' bottles из ' + inttostr(m));
		end;
	end;

	procedure DropPotions(a : integer);
	var tmp1 : cardinal;
	begin
		if Count(TypPotion) < HowDropBottles then exit;
		tmp1 := findtype(TypPotion,backpack);
		while findcount > 0 do
		begin
			OpenContainer(false);
			if not CheckCountPotion then curbag := GetEmptyBag;
			MoveItem(tmp1,GetQuantity(tmp1),curbag,0,0,0);
			wait(500);
			checksave;
			addtosystemjournal('Сбросил ' + inttostr(GetQuantity(tmp1)) + ' potions. Всего скрафчено ' + inttostr(a));
			tmp1 := findtype(TypPotion,backpack);
		end;
	end;

Begin 
	FindDistance := 2; 
	s := 0;
	CancelMenu; 
	AutoMenu('What sort of potion', '(last)'); 
	FirstTime := true;
	// Первый раз через меню
	LastContOpen := Now;
	OpenContainer(true);
	curbag := GetEmptyBag;
	repeat
		if not GetRes then exit;
		tmpser := findtype(NS, backpack);
		if FindCount = 0 then
		begin
			repeat
				wait(10000);
				tmpser := findtype(NS, backpack);
			until FindCount <> 0;
		end;
		waitconnection(3000);
		ctime := Now;
		k := 0;
		if FirstTime then
		begin
			if TargetPresent then CancelTarget;
			UseObject(tmpser);
			FirstTime := false;
		end
		else UOSay('.makelast');
		repeat 
			wait(100); 
			k := k + 1; 
			checksave; 
		until (InJournalBetweenTimes('You put|You fail|failed mixture', ctime, Now)<>-1) or (k > 200);
		if InJournalBetweenTimes('You put', ctime, Now)<>-1 then s := s + 1;
		wait(2000)
		DropPotions(s);
		if GetSkillValue('Alchemy') = 1000 then exit;
	until false;
End.
Edred
Moderator
Moderator
Posts: 559
Joined: 28.03.2006 21:29

Post by Edred »

Code: Select all

Program AlchemyUP; 
// v.1.04b (c) Edred 

{$Include 'all.inc'} 

var 
ctime : TDateTime;
LastContOpen : TDateTime;
k, s, m : integer; 
tmpser,curbag : cardinal;
FirstTime : boolean;
OldSkill : Double;

const
WhatYouDo = 'Greater Poison';		// можно написать, например: '(last)'
TypBottles = $0F0E;					// Тип бутылок
TypPotion = $0F0A;
CountRegs = 10;
HowGetRegs = 200;
CountBottles = 5;
HowGetBottles = 100;
HowDropBottles = 20;
TrashID = $4005198D;
SundukEmptyBag = $40053D27;			// тут лежат пустые мешки
Sunduk2Craft = $40053D34;			// сюда кладем скрафченное
BagType = $0E76;

	procedure OpenContainer(f : boolean);
	// если f - true - просто открываем все нужные контейнеры, то есть:
	// SundukIngots,SundukEmptyBag,Sunduk2Craft и curbag (если он не равен 0)
	// если f - false - проверяем, был ли реконнект чара после последнего
	// открывания контейнеров, если был - переоткрываем контейнеры и записываем
	// новое значение в переменную LastContOpen, если не был - ничего не делаем
	begin
		waitconnection(3000);
		if (f = true) or (LastContOpen < ConnectedTime) then
		begin
			UseObject(SundukEmptyBag);
			wait(1000);
			checksave;
			UseObject(Sunduk2Craft);
			wait(1000);
			checksave;
			if curbag <> 0 then
			begin
				UseObject(curbag);
				wait(1000);
				checksave;
			end;
			LastContOpen := Now;
			addtosystemjournal('Контейнеры открыты в ' + DateTimeToStr(Now));
		end;
	end;

	function GetEmptyBag : cardinal;
	// берет пустой мешок из одного контейнера и помещает в другой
	// возвращает сериал пустого мешка
	var tmp1 : cardinal;
	begin
		Result := 0;
		waitconnection(3000);
		tmp1 := FindType(BagType,SundukEmptyBag);
		if tmp1 = 0 then
		begin
			Addtosystemjournal('Error: кончились мешки');
			exit;
		end;
		MoveItem(tmp1,1,Sunduk2Craft,0,0,0);
		wait(1000);
		CheckSave;
		UseObject(tmp1);
		wait(1000);
		CheckSave;
		Result := tmp1;
		Addtosystemjournal('Взял новый мешок');
	end;

	function CheckCountPotion : Boolean;
	begin
		Result := False;
		findtype(TypPotion,curbag);
		if findcount > 240 then exit;
		Result := True;
	end;

	function GetRes : boolean;
	begin
		Result := True;
		if Count(NS) < CountRegs then
		begin
			waitconnection(3000);
			findtype(NS,ground);
			if GetQuantity(Finditem) < HowGetRegs then
			begin
				if GetQuantity(Finditem) = 0 then
				repeat
					addtosystemjournal('Warning: Мало регов на полу');
					wait(10000);
					findtype(NS,ground);
				until GetQuantity(Finditem) >= HowGetRegs;
			end;
			m := GetQuantity(finditem);
			Grab(FindItem,HowGetRegs);
			wait(1000);
			checksave;
			addtosystemjournal('Взял ' + inttostr(HowGetRegs) + ' NS из ' + inttostr(m));
		end;
		if Count(TypBottles) < CountBottles then
		begin
			waitconnection(3000);
			findtype(TypBottles,ground);
			if GetQuantity(Finditem) < HowGetBottles then
			begin
				repeat
					addtosystemjournal('Warning: Мало бутылок на полу');
					wait(10000);
					findtype(TypBottles,ground);
				until GetQuantity(Finditem) >= HowGetBottles;
			end;
			m := GetQuantity(finditem);
			Grab(FindItem,HowGetBottles);
			wait(1000);
			checksave;
			addtosystemjournal('Взял ' + inttostr(HowGetBottles) + ' bottles из ' + inttostr(m));
		end;
	end;

	procedure DropPotions(a : integer);
	var tmp1 : cardinal;
	begin
		waitconnection(3000);
		if Count(TypPotion) < HowDropBottles then exit;
		tmp1 := findtype(TypPotion,backpack);
		while findcount > 0 do
		begin
			OpenContainer(false);
			if not CheckCountPotion then curbag := GetEmptyBag;
			MoveItem(tmp1,GetQuantity(tmp1),curbag,0,0,0);
			wait(500);
			checksave;
			addtosystemjournal('Сбросил ' + inttostr(GetQuantity(tmp1)) + ' potions. Всего скрафчено ' + inttostr(a));
			tmp1 := findtype(TypPotion,backpack);
		end;
	end;

Begin 
	FindDistance := 2; 
	s := 0;
	CancelMenu; 
	AutoMenu('What sort of potion', WhatYouDo); 
	FirstTime := true;
	// Первый раз через меню
	LastContOpen := Now;
	OpenContainer(true);
	curbag := GetEmptyBag;
	OldSkill := GetSkillValue('Alchemy');
	repeat
		if not GetRes then exit;
		tmpser := findtype(NS, backpack);
		if FindCount = 0 then
		begin
			repeat
				wait(10000);
				tmpser := findtype(NS, backpack);
			until FindCount <> 0;
		end;
		waitconnection(3000);
		ctime := Now;
		k := 0;
		if FirstTime then
		begin
			if TargetPresent then CancelTarget;
			UseObject(tmpser);
			FirstTime := false;
		end
		else UOSay('.makelast');
		repeat 
			wait(100); 
			k := k + 1; 
			checksave; 
		until (InJournalBetweenTimes('You put|You fail|failed mixture', ctime, Now)<>-1) or (k > 200);
		if InJournalBetweenTimes('You put', ctime, Now)<>-1 then s := s + 1;
		wait(2000)
		DropPotions(s);
		if GetSkillValue('Alchemy') > OldSkill then
		begin
			AddToSystemJournal('Скилл Alchemy вырос. Теперь он равен ' + FloatToStr(GetSkillValue('Alchemy')));
			OldSkill := GetSkillValue('Alchemy');
		end;
	until GetSkillValue('Alchemy') >= 100.0;
End.
Post Reply