I quibbled a bit with the autoloot and I said to myself that it's boring for some players to wait for a reboot to deactivate or not the autoloot. So I modified it a bit. It can definitely be improved I think. Like click on it again and it deactivates instantly but I free for those who are beginners and who don't really know how to do it.
In this case the autoloot is activated for 20 minutes and it will deactivate automatically
Code:
if (VNum == 1143) // Auto-Loot
{
if (!session.Character.StaticBonusList.Any(s => s.StaticBonusType == StaticBonusType.AutoLoot))
{
session.Character.StaticBonusList.Add(new StaticBonusDTO
{
CharacterId = session.Character.CharacterId,
DateEnd = DateTime.Now.AddMinutes(20),
StaticBonusType = StaticBonusType.AutoLoot
});
session.SendPacket(
session.Character.GenerateSay(
Language.Instance.GetMessageFromKey("AUTOLOOT_ON"), 0));
Observable.Timer(TimeSpan.FromMinutes(20)).Subscribe(observer =>
{
session.SendPacket(
session.Character.GenerateSay(
Language.Instance.GetMessageFromKey("AUTOLOOT_OFF"), 0));
});
}
else
{
session.SendPacket(UserInterfaceHelper.GenerateMsg(Language.Instance.GetMessageFromKey("ITEM_IN_USE"), 0));
}
}