internal Item AddGoldItem(Item collectedItem) { if (_inventoryGold == null) { _inventoryGold = ItemGenerator.CreateGold(_owner, collectedItem.Attributes[GameAttribute.Gold]); _inventoryGold.Attributes[GameAttribute.ItemStackQuantityLo] = collectedItem.Attributes[GameAttribute.Gold]; _inventoryGold.Owner = _owner; _inventoryGold.SetInventoryLocation(18, 0, 0); // Equipment slot 18 ==> Gold _inventoryGold.Reveal(_owner); } else { _inventoryGold.Attributes[GameAttribute.ItemStackQuantityLo] += collectedItem.Attributes[GameAttribute.Gold]; } return _inventoryGold; }
public void DropItem(Hero hero, Item item, Vector3D postition) { Random random = new Random(); Actor itemActor = new Actor() { GBHandle = new GBHandle() { Field0 = 2, Field1 = item.Gbid, }, InventoryLocationData = null, Scale = 1.35f, Position = postition, WorldId = hero.WorldId, RotationAmount = 0.768145f, RotationAxis = new Vector3D() { X = 0f, Y = 0f, Z = (float)random.NextDouble(), }, SnoId = item.SNOId, DynamicId = item.ItemId, }; GetWorld(hero.WorldId).AddActor(itemActor); itemActor.Reveal(hero); item.Reveal(hero); hero.InGameClient.PacketId += 10 * 2; hero.InGameClient.SendMessage(new DWordDataMessage() { Id = 0x89, Field0 = hero.InGameClient.PacketId, }); hero.InGameClient.FlushOutgoingBuffer(); }
public Item AddGoldItem(Item collectedItem) { // the logic is flawed, we shouldn't be creating new gold when it's collected! /raist. if (_inventoryGold == null) { _inventoryGold = ItemGenerator.CreateGold(_owner, collectedItem.Attributes[GameAttribute.Gold]); _inventoryGold.Attributes[GameAttribute.ItemStackQuantityLo] = collectedItem.Attributes[GameAttribute.Gold]; _inventoryGold.Owner = _owner; _inventoryGold.SetInventoryLocation(18, 0, 0); // Equipment slot 18 ==> Gold _inventoryGold.Reveal(_owner); } else { _inventoryGold.Attributes[GameAttribute.ItemStackQuantityLo] += collectedItem.Attributes[GameAttribute.Gold]; //_inventoryGold.Attributes.SendChangedMessage(_owner.InGameClient, _inventoryGold.DynamicID); // causes: !!!ERROR!!! Setting attribute for unknown ACD [ANN:1253] [Attribute:ItemStackQuantityLo-1048575: 8669] and client crash /raist. } return _inventoryGold; }
// TODO: The inventory's gold item should not be created here. /komiga public void PickUpGold(uint itemID) { Item collectedItem = _owner.GroundItems[itemID]; if (_goldItem == null) { ItemTypeGenerator itemGenerator = new ItemTypeGenerator(_owner.InGameClient); _goldItem = itemGenerator.CreateItem("Gold1", 0x00000178, ItemType.Gold); _goldItem.Count = collectedItem.Count; _goldItem.Owner = _owner; _goldItem.SetInventoryLocation(18, 0, 0); // Equipment slot 18 ==> Gold _goldItem.Reveal(_owner); } else { _goldItem.Count += collectedItem.Count; } GameAttributeMap attributes = new GameAttributeMap(); attributes[GameAttribute.ItemStackQuantityLo] = _goldItem.Count; attributes.SendMessage(_owner.InGameClient, _goldItem.DynamicID); }