public void TookLootDropItem(Character character, List <Item> lootDropItems, Item lootDropItem, int count) { var objId = (uint)(lootDropItem.Id >> 32); if (lootDropItem.TemplateId == 500) { character.Money += lootDropItem.Count; character.SendPacket(new SCItemTaskSuccessPacket(ItemTaskType.SkillEffectGainItem, new List <ItemTask> { new MoneyChange(lootDropItem.Count) }, new List <ulong>())); } else { var item = ItemManager.Instance.Create(lootDropItem.TemplateId, count > lootDropItem.Count ? lootDropItem.Count : count, lootDropItem.Grade); InventoryHelper.AddItemAndUpdateClient(character, item); } lootDropItems.Remove(lootDropItem); if (lootDropItems.Count <= 0) { RemoveLootDropItems(objId); character.BroadcastPacket(new SCLootableStatePacket(objId, false), true); } character.SendPacket(new SCLootItemTookPacket(500, lootDropItem.Id, lootDropItem.Count)); }
public override void Read(PacketStream stream) { var cashShopItems = CashShopManager.Instance.GetCashShopItems(); var numBuys = stream.ReadByte(); for (var i = 0; i < numBuys; i++) { var cashShopId = stream.ReadUInt32(); var mainTab = stream.ReadByte(); var subTab = stream.ReadByte(); var detailIndex = stream.ReadByte(); var cashItem = cashShopItems.Find(a => a.CashShopId == cashShopId); if (cashItem != null) { var item = ItemManager.Instance.Create(cashItem.ItemTemplateId, 1, 0); InventoryHelper.AddItemAndUpdateClient(Connection.ActiveChar, item); } } var receiverName = stream.ReadString(); //_log.Warn("ICSBuyGood"); Connection.ActiveChar.SendPacket(new SCICSBuyResultPacket(true, 1, "Test", 5555)); }
private void AddItem(Unit caster, uint itemId, byte gradeId, int minAmount, int maxAmount) { var character = (Character)caster; if (character == null) { return; } var amount = Rand.Next(minAmount, maxAmount); var item = ItemManager.Instance.Create(itemId, amount, gradeId); InventoryHelper.AddItemAndUpdateClient(character, item); }
public override void Use(Unit caster, Doodad owner, uint skillId) { Character character = (Character)caster; if (character == null) { return; } int chance = Rand.Next(0, 10000); if (chance > Percent) { return; } int count = Rand.Next(CountMin, CountMax); Item item = ItemManager.Instance.Create(ItemId, count, 0); InventoryHelper.AddItemAndUpdateClient(character, item); _log.Debug("DoodadFuncLootItem"); }