C#:
using System;
using System.Linq;
using System.Collections.Generic;
using NewWidget.Core;
using NewWidget.Core.Native;
using NewWidget.Core.Scripting;
class Potion {
public int ItemId;
public int BuffId;
public Potion(int item, int buff) {
ItemId = item;
BuffId = buff;
}
}
public class Script : ScriptBase {
// количество бафов, если меньше - будет использовать поушены
int BuffsCount = 23;
// массив используемых поушенов
// у большинства поушенов разные id предмета и баффа !
Potion[] Pots = new Potion[] {
new Potion(8786, 2305), // primeval potion
new Potion(8193, 2274), // fisherman green
new Potion(9997, 2335), // fire potion
new Potion(1375, 2035), // atk speed
new Potion(6036, 2169), // cast speed
new Potion(1374, 2034), // walk speed
new Potion(5234, 2103), // mystery potion
new Potion(4679, 2076) // bless of eva
};
public override void OnStart() {
base.OnStart();
CreateTimer(200, PotionsUseable, UsePotions);
Enabled = true;
}
void UsePotions() {
var pot = Pots.FirstOrDefault(p => Me.CommonInventory.Any(i => i.Id == p.ItemId) && Me.BuffEndtime(p.BuffId) == 0);
if (pot != null) {
Client.UseItem(pot.ItemId);
Wait(500);
}
}
bool PotionsUseable() {
return !Me.IsDisabled && Me.Buffs.Count(IsBuff) < BuffsCount;
}
bool IsBuff(L2Effect e) {
return
e.Data == null
? true
: e.Data.IsMagic != 3/*sd*/ && e.Data.IsMagic != 4/*trigger*/ && !e.Data.IsDebuff && e.Data.OperationType != OperationTypes.Toggle;
}
}