C#:
//Autoloot
public void GenerateKillBonus(MapMonster monsterToAttack)
{
void _handleGoldDrop(DropDTO drop, long maxGold, long? dropOwner, short posX, short posY)
{
Observable.Timer(TimeSpan.FromMilliseconds(500)).Subscribe(o =>
{
if (Session.HasCurrentMapInstance)
{
if (CharacterId == dropOwner && StaticBonusList.Any(s => s.StaticBonusType == StaticBonusType.AutoLoot))
{
double multiplier = 1 + (Session.Character.GetBuff(CardType.Item, (byte)AdditionalTypes.Item.IncreaseEarnedGold)[0] / 100D);
multiplier += (Session.Character.ShellEffectMain.FirstOrDefault(s => s.Effect == (byte)ShellWeaponEffectType.GainMoreGold)?.Value ?? 0) / 100D;
Gold += (int)(drop.Amount * multiplier);
if (Gold > maxGold)
{
Gold = maxGold;
Session.SendPacket(UserInterfaceHelper.GenerateMsg(Language.Instance.GetMessageFromKey("MAX_GOLD"), 0));
}
Session.SendPacket(GenerateSay($"{Language.Instance.GetMessageFromKey("ITEM_ACQUIRED")}: {ServerManager.GetItem(drop.ItemVNum).Name} x {drop.Amount}{(multiplier > 1 ? $" + {(int)(drop.Amount * multiplier) - drop.Amount}" : string.Empty)}", 12));
Session.SendPacket(GenerateGold());
}
else
{
double multiplier = 1 + (Session.Character.GetBuff(CardType.Item, (byte)AdditionalTypes.Item.IncreaseEarnedGold)[0] / 100D);
multiplier += (Session.Character.ShellEffectMain.FirstOrDefault(s => s.Effect == (byte)ShellWeaponEffectType.GainMoreGold)?.Value ?? 0) / 100D;
Gold += (int)(drop.Amount * multiplier);
if (Gold > maxGold)
{
Gold = maxGold;
Session.SendPacket(UserInterfaceHelper.GenerateMsg(Language.Instance.GetMessageFromKey("MAX_GOLD"), 0));
}
Session.SendPacket(GenerateSay($"{Language.Instance.GetMessageFromKey("ITEM_ACQUIRED")}: {ServerManager.GetItem(drop.ItemVNum).Name} x {drop.Amount}{(multiplier > 1 ? $" + {(int)(drop.Amount * multiplier) - drop.Amount}" : string.Empty)}", 12));
Session.SendPacket(GenerateGold());
//Session.CurrentMapInstance.DropItemByMonster(dropOwner, drop, monsterToAttack.MapX, monsterToAttack.MapY);
}
}
});
}
void _handleItemDrop(DropDTO drop, long? owner, short posX, short posY)
{
Observable.Timer(TimeSpan.FromMilliseconds(500)).Subscribe(o =>
{
if (Session.HasCurrentMapInstance)
{
if (CharacterId == owner && StaticBonusList.Any(s => s.StaticBonusType == StaticBonusType.AutoLoot))
{
GiftAdd(drop.ItemVNum, (byte)drop.Amount);
}
else
{
//Activate Drops
GiftAdd(drop.ItemVNum, (byte)drop.Amount);
/*Not necessary - Session.CurrentMapInstance.DropItemByMonster(owner, drop, posX, posY);*/
}
}
});
}