public void UseItem(RealmTime time, UseItemPacket pkt) { IContainer container = Owner.GetEntity(pkt.Slot.ObjectId) as IContainer; var item = container.Inventory[pkt.Slot.SlotId]; Activate(time, item, pkt.Position); if (item.Consumable) { if (item.SuccessorId != null) { if (item.SuccessorId != item.ObjectId) { container.Inventory[pkt.Slot.SlotId] = XmlDatas.ItemDescs[XmlDatas.IdToType[item.SuccessorId]]; Owner.GetEntity(pkt.Slot.ObjectId).UpdateCount++; UpdateCount++; } } else { container.Inventory[pkt.Slot.SlotId] = null; Owner.GetEntity(pkt.Slot.ObjectId).UpdateCount++; UpdateCount++; } } if (container.SlotTypes[pkt.Slot.SlotId] != -1) { fames.UseAbility(); } }
// Token: 0x0600049C RID: 1180 RVA: 0x000193D0 File Offset: 0x000175D0 private void UseAltWeapon(ItemStructure item, int time, Location position = null, byte useType = 1) { if (position == null) { position = this.client.Player.ClientPosition; } int num = (int)item._tYSs4Ly8XTHvXe9jwJ9dhQMMttd; num = ((num == 0) ? 500 : (num * 1000)); this._nextAltAttack = time + num; this._lastUseItem = time; UseItemPacket useItemPacket = (UseItemPacket)Packet.Create(PacketType.USEITEM); useItemPacket.SlotObject = new SlotObject { objectId = this.client.Player.ObjectId, SlotId = 1, ObjectType = this.client.Player.Inventory[1] }; useItemPacket.Time = time; useItemPacket.UseType = useType; useItemPacket.ItemUsePos = position; this.client.SendToServer(useItemPacket); if (Settings.Default.AutoAbilityNotifications) { this.client.SendToClient("AutoAbility activated!"); } }
public async Task Handle(WorldClient client, UseItemPacket packet) { var ok = await _invetoryManager.TryUseItem(packet.Bag, packet.Slot); if (!ok) { _packetFactory.SendCanNotUseItem(client, _gameSession.CharId); } }
// Token: 0x06000497 RID: 1175 RVA: 0x00018DDC File Offset: 0x00016FDC public void UseItem(UseItemPacket useItem) { if (useItem.SlotObject.SlotId == 1 && Settings.Default.EnableAutoAbility && useItem.Time - this._lastUseItem < 500) { useItem.Send = false; this.client.SendToClient("AutoAbility", "Ability is on cooldown!"); return; } this._lastUseItem = useItem.Time; }
/// <summary> /// u_i packet /// </summary> /// <param name="useItemPacket"></param> public void UseItem(UseItemPacket useItemPacket) { IItemInstance inv = Session.Character.Inventory.LoadBySlotAndType <IItemInstance>(useItemPacket.Slot, useItemPacket.Type); if (inv?.Requests == null) { return; } inv.Requests.OnNext(new RequestData <Tuple <IItemInstance, UseItemPacket> >(Session, new Tuple <IItemInstance, UseItemPacket>(inv, useItemPacket))); }
public static void UseAbility(this Client client, byte usetype, Location location = null) // TO TEST { if (client.PlayerData.Slot[1] != -1) { UseItemPacket upacket = Packet.Create <UseItemPacket>(PacketType.USEITEM); upacket.ItemUsePos = location == null ? client.PlayerData.Pos : location; upacket.SlotObject = client.GetSlotAt(1); upacket.Time = client.Time; upacket.UseType = usetype; client.SendToServer(upacket); } }
// Token: 0x060004C2 RID: 1218 RVA: 0x0001B668 File Offset: 0x00019868 private void _sOwc8Hz5GYPFJ7BLvgRX72MvmaK(int time, int itemType, byte slotId, Location location) { UseItemPacket lylWoxWrca2h31SiYiDb8gyQP0o = (UseItemPacket)Packet.Create(PacketType.USEITEM); lylWoxWrca2h31SiYiDb8gyQP0o.SlotObject = new SlotObject { objectId = this._W6Ov6AArxzTTDnCyBtZPqkqNaKf._7w6u8taiwfZruB2OdFEa2AmzJaA, ObjectType = itemType, SlotId = (int)slotId }; lylWoxWrca2h31SiYiDb8gyQP0o.Time = time; lylWoxWrca2h31SiYiDb8gyQP0o.ItemUsePos = location; lylWoxWrca2h31SiYiDb8gyQP0o.UseType = ((slotId >= 254) ? 0 : 1); this._W6Ov6AArxzTTDnCyBtZPqkqNaKf._7uxLEqPg6T4dttVtkm2zilX7Qji(lylWoxWrca2h31SiYiDb8gyQP0o); }
// Token: 0x0600049A RID: 1178 RVA: 0x00018F94 File Offset: 0x00017194 private void _sOwc8Hz5GYPFJ7BLvgRX72MvmaK(int time, int itemType, byte slotId, Location location) { UseItemPacket lylWoxWrca2h31SiYiDb8gyQP0o = (UseItemPacket)Packet.Create(PacketType.USEITEM); lylWoxWrca2h31SiYiDb8gyQP0o.SlotObject = new SlotObject { objectId = this.client.PlayerId, ObjectType = itemType, SlotId = (int)slotId }; lylWoxWrca2h31SiYiDb8gyQP0o.Time = time; lylWoxWrca2h31SiYiDb8gyQP0o.ItemUsePos = location; lylWoxWrca2h31SiYiDb8gyQP0o.UseType = ((slotId >= 254) ? 0 : 1); this.client.SendToServer(lylWoxWrca2h31SiYiDb8gyQP0o); }
private void SendUseItem(Client client) { _cooldown = AutoAbilityConfig.Default.RetryDelay; UseItemPacket useItem = _useItemMap[client]; useItem.Time = client.Time; useItem.ItemUsePos = client.PlayerData.Pos; client.SendToServer(useItem); if (AutoAbilityConfig.Default.ShowBuffNotifications) { client.SendToClient(PluginUtils.CreateNotification( client.ObjectId, "Auto-Buff Triggered!")); } }
protected override void OnHandle(IPacket packet, NetState netState, ServerWorldState worldState) { UseItemPacket incomingPacket = (UseItemPacket)packet; //if (incomingPacket.MobileId != netState.WorldId) //{ // netState.SendError(0, string.Format("Invalid CMD: '{0},{1},{2}'.", incomingPacket.PacketId, incomingPacket.MobileId, incomingPacket.ItemId)); // return; //} ServerCharacter serverCharacter = (ServerCharacter)worldState.GetCharacter(netState.WorldId); Item itemToUse = worldState.GetItem(incomingPacket.ItemId); if (serverCharacter != null && itemToUse != null) { if (itemToUse.IsWorldItem) { if (serverCharacter.PickupItem(itemToUse)) { worldState.SaveItemPosition(itemToUse); this.OnSuccessfulUse(serverCharacter.CurrentMapId, incomingPacket.MobileId, incomingPacket.ItemId, worldState); } } else { if (itemToUse.Category == ItemCategory.Consumable) { ConsumableItem consumable = (ConsumableItem)itemToUse; if (consumable.Use(serverCharacter, worldState)) { worldState.SaveItemUse(itemToUse); this.OnSuccessfulUse(serverCharacter.CurrentMapId, incomingPacket.MobileId, incomingPacket.ItemId, worldState); } } if (itemToUse.Category == ItemCategory.Armor || itemToUse.Category == ItemCategory.Weapon) { if (serverCharacter.Equip(itemToUse)) { worldState.SaveCharacterItems(serverCharacter); this.OnSuccessfulUse(serverCharacter.CurrentMapId, incomingPacket.MobileId, incomingPacket.ItemId, worldState); } } } } }
private void SendUseItem(Client client) { UseItemPacket useItem = (UseItemPacket)UseItemPacket.Create(PacketType.USEITEM); useItem.Time = client.Time; useItem.ItemUsePos = new Location(); useItem.ItemUsePos.X = client.PlayerData.Pos.X; useItem.ItemUsePos.Y = client.PlayerData.Pos.Y; useItem.SlotObject = new SlotObject(); useItem.SlotObject.SlotId = 1; useItem.SlotObject.ObjectType = (short)client.PlayerData.Slot[1]; useItem.SlotObject.ObjectId = client.ObjectId; useItem.UseType = 1; client.SendToServer(useItem); client.SendToClient( PluginUtils.CreateNotification(client.ObjectId, "Auto-Buff Triggered!") ); }
protected override void OnHandle(IPacket packet, ClientWorldState worldState) { UseItemPacket incomingPacket = (UseItemPacket)packet; ClientCharacter mobileToUpdate = (ClientCharacter)worldState.GetCharacter(incomingPacket.MobileId); Item itemToUse = worldState.GetItem(incomingPacket.ItemId); if (mobileToUpdate == null) { worldState.MissingCharacters.Add(incomingPacket.MobileId); } if (mobileToUpdate != null && itemToUse != null) { if (itemToUse.IsWorldItem) { if (!mobileToUpdate.PickupItem(itemToUse)) { //ToDo: Simulation missmatch, Force server Authority } } else { if (itemToUse.Category == ItemCategory.Consumable) { ConsumableItem itemToConsume = (ConsumableItem)itemToUse; if (!itemToConsume.Use(mobileToUpdate, worldState)) { //ToDo: Simulation missmatch, Force server Authority } } else if (itemToUse.Category == ItemCategory.Armor || itemToUse.Category == ItemCategory.Weapon) { if (!mobileToUpdate.Equip(itemToUse)) { //ToDo: Sim missmatch, force server Auth } } } } }
private void OnUseItem(Client client, Packet packet) { if (Editing && !_cancel) { UseItemPacket useItem = (UseItemPacket)packet; useItem.Send = false; UpdatePacket update = (UpdatePacket)Packet.Create(PacketType.UPDATE); update.Drops = new int[0]; update.NewObjs = new Entity[0]; update.Tiles = new Tile[1]; Tile paintedTile = new Tile(); paintedTile.X = (short)Math.Floor(useItem.ItemUsePos.X); paintedTile.Y = (short)Math.Floor(useItem.ItemUsePos.Y); paintedTile.Type = GameData.Tiles.ByName(SelectedTile).ID; update.Tiles[0] = paintedTile; _cancel = true; client.SendToClient(update); } }
// Token: 0x060004E5 RID: 1253 RVA: 0x0001C678 File Offset: 0x0001A878 public void UseItem(UseItemPacket useItem) { if (!Settings.Default.EnableFameTools) { return; } if (useItem.SlotObject.objectId != this.client.PlayerId) { return; } if (Settings.Default.FameBlockDrinking) { /*ItemStructure*/ ItemStructure itemStructure = GameData.Items.ByID((ushort)useItem.SlotObject.ObjectType); if (itemStructure != null) { if (itemStructure.Potion) { useItem.Send = false; } } } }
// Token: 0x06000232 RID: 562 RVA: 0x0000FDC0 File Offset: 0x0000DFC0 private void HandlePacket(Packet packet) { UpdatePacket updatePacket = packet as UpdatePacket; if (updatePacket != null) { this._objectTracker.Update(updatePacket); this.SafeWalk.Update(updatePacket); this._autoNexus.Update(updatePacket); this._fameHelper.Update(updatePacket); this._accuracyFarm.Update(updatePacket); this._antiLag.Update(updatePacket); this._autoLoot.Update(updatePacket); this._mapHack.Update(updatePacket); this._o3Helper.Update(updatePacket); this._showLHPot.Update(updatePacket); return; } NewTickPacket newTickPacket = packet as NewTickPacket; if (newTickPacket != null) { this._objectTracker.NewTick(newTickPacket); this._antiDebuffs.NewTick(newTickPacket); this._autoNexus.NewTick(newTickPacket); this._antiDdos.NewTick(); this._fameHelper.NewTick(newTickPacket); this._accuracyFarm.NewTick(newTickPacket); this._antiLag.NewTick(newTickPacket); this._o3Helper.NewTick(newTickPacket); this._autoNexus2.NewTick(newTickPacket); return; } MovePacket movePacket = packet as MovePacket; if (movePacket != null) { this.PreviousTime = movePacket._Nx46RcGIU0H1BCGWaJXjN1ieopt; this._objectTracker.move(movePacket); this._antiDebuffs.Move(movePacket); this._autoLoot.Move(movePacket); this.AntiAfk.move(movePacket); this._autoNexus.move(movePacket); this._autoNexus2.move(movePacket); return; } MapInfoPacket mapInfoPacket = packet as MapInfoPacket; if (mapInfoPacket != null) { Console.WriteLine("Client: Map is " + mapInfoPacket.Name); this._objectTracker.MapInfo(mapInfoPacket); this._autoNexus2.MapInfo(mapInfoPacket); this.SafeWalk.MapInfo(mapInfoPacket); this._autoNexus.MapInfo(mapInfoPacket); this._autoLoot.MapInfo(mapInfoPacket); this._fameHelper.MapInfo(); _accuracyFarm.MapInfo(); this._antiLag.MapInfo(mapInfoPacket); this._mapHack.MapInfo(mapInfoPacket); this._o3Helper.MapInfo(mapInfoPacket); this._showLHPot.MapInfo(mapInfoPacket); return; } PlayerTextPacket playerTextPacket = packet as PlayerTextPacket; if (playerTextPacket != null) { this._teleportTools.text(playerTextPacket); this._ipJoin.text(playerTextPacket); this._fameHelper._QrK9KtR4xguWgEYrBE9xnEwwcqd(playerTextPacket); this._antiLag.PlayerText(playerTextPacket); this._mapHack.text(playerTextPacket); this._autoNexus._QrK9KtR4xguWgEYrBE9xnEwwcqd(playerTextPacket); return; } _5Qyhf9ImNgkDzh4BmaDRKP646iH createSuccessPacket = packet as _5Qyhf9ImNgkDzh4BmaDRKP646iH; if (createSuccessPacket != null) { this.PlayerId = createSuccessPacket.ObjectId; this._objectTracker._1lYB9SyYVs1zUAIHgLGbUs7pmeb(); this._bazaarTimer.CreateSuccess(); this._autoNexus2._1lYB9SyYVs1zUAIHgLGbUs7pmeb(); return; } FailurePacket failurePacket = packet as FailurePacket; if (failurePacket != null) { Console.WriteLine(string.Format("Client: Got failure {0}, {1} ({2})", failurePacket.ErrorId, failurePacket.ErrorMessage, failurePacket.ErrorPlace)); return; } ReconnectPacket reconnectPacket = packet as ReconnectPacket; if (reconnectPacket != null) { this.Reconnect(reconnectPacket); return; } HelloPacket helloPacket = packet as HelloPacket; if (helloPacket != null) { this.Hello(helloPacket); return; } PlayerHitPacket playerHitPacket = packet as PlayerHitPacket; if (playerHitPacket != null) { this._autoNexus.PlayerHit(playerHitPacket); this._antiDebuffs.PlayerHit(playerHitPacket); return; } AoEPacket pqhqze9k9pObME2LmlIcbfEeSYS = packet as AoEPacket; if (pqhqze9k9pObME2LmlIcbfEeSYS != null) { this._autoNexus._M1PxW31jx87SGG4gvOYAwe86vjg(pqhqze9k9pObME2LmlIcbfEeSYS); this._antiDebuffs.AoE(pqhqze9k9pObME2LmlIcbfEeSYS); return; } AoEAckPacket x7UwVkbcYG7VnZWu4HCA8hCeQtS = packet as AoEAckPacket; if (x7UwVkbcYG7VnZWu4HCA8hCeQtS != null) { this._autoNexus._iKqf12lpU2ifSlxUxUegqEC5CVe(x7UwVkbcYG7VnZWu4HCA8hCeQtS); return; } GroundDamagePacket hllcDvAIxPBOvJZP4BFTFQUoryN = packet as GroundDamagePacket; if (hllcDvAIxPBOvJZP4BFTFQUoryN != null) { this._autoNexus._524YRDmz9HCOj575eu5oeD5ruJb(hllcDvAIxPBOvJZP4BFTFQUoryN); return; } _6lHFncsY9352Wg3pNnnFZ49g5xA 6lHFncsY9352Wg3pNnnFZ49g5xA = packet as QuestObjIdPacket; if (6lHFncsY9352Wg3pNnnFZ49g5xA != null) { this._teleportTools._FMTVFcTfzNRteqoB3XiUkaNps7l(6lHFncsY9352Wg3pNnnFZ49g5xA); return; } ShowEffectPacket showEffectPacket = packet as ShowEffectPacket; if (showEffectPacket != null) { this._antiLag.ShowEffect(showEffectPacket); this._autoNexus._1nwhQXngJ6rNjd7Ufx1bWeF0vhM(showEffectPacket); this._o3Helper._1nwhQXngJ6rNjd7Ufx1bWeF0vhM(showEffectPacket); return; } _4wU9AwmH67XtmNygsXuDz9DUXYm 4wU9AwmH67XtmNygsXuDz9DUXYm = packet as _4wU9AwmH67XtmNygsXuDz9DUXYm; if (4wU9AwmH67XtmNygsXuDz9DUXYm != null) { this._antiLag._Q1PiJQ99KBCJeLcZ0HOk3AUAjIP(4wU9AwmH67XtmNygsXuDz9DUXYm); return; } PlayerShootPacket fbqBESNaaIBpK5dNK9X5lWOOll = packet as PlayerShootPacket; if (fbqBESNaaIBpK5dNK9X5lWOOll != null) { this._autoNexus2.PlayerShoot(fbqBESNaaIBpK5dNK9X5lWOOll); return; } TextPacket cbwOjnzusZzuPkHfx7wuwePHqrf = packet as TextPacket; if (cbwOjnzusZzuPkHfx7wuwePHqrf != null) { this._antiSpam._IDtpCgDjmC1AQOcZCJSFNAYjlbH(cbwOjnzusZzuPkHfx7wuwePHqrf); this._antiLag.Text(cbwOjnzusZzuPkHfx7wuwePHqrf); this._o3Helper._IDtpCgDjmC1AQOcZCJSFNAYjlbH(cbwOjnzusZzuPkHfx7wuwePHqrf); return; } UseItemPacket lylWoxWrca2h31SiYiDb8gyQP0o = packet as UseItemPacket; if (lylWoxWrca2h31SiYiDb8gyQP0o != null) { this._autoNexus2.UseItem(lylWoxWrca2h31SiYiDb8gyQP0o); this._fameHelper.UseItem(lylWoxWrca2h31SiYiDb8gyQP0o); return; } EnemyShootPacket cbwrHXLbrCktla3qkqXNmNymbvH = packet as EnemyShootPacket; if (cbwrHXLbrCktla3qkqXNmNymbvH != null) { this._objectTracker._Qz49aY7UXgmnBNNMA6Q6IEQtadk(cbwrHXLbrCktla3qkqXNmNymbvH); return; } InvSwapPacket maJp2qic3r54gk5Eg1eeMowxvXh = packet as InvSwapPacket; if (maJp2qic3r54gk5Eg1eeMowxvXh != null) { this._autoLoot.InvSwap(maJp2qic3r54gk5Eg1eeMowxvXh); this._autoNexus._ZHfjECn2B9JJHnVF67eBaO57JUp(maJp2qic3r54gk5Eg1eeMowxvXh); return; } EscapePacket m74ADSrj0VfuNwRBO916gAw0Nu = packet as EscapePacket; if (m74ADSrj0VfuNwRBO916gAw0Nu != null) { this.Escape(m74ADSrj0VfuNwRBO916gAw0Nu); return; } InvitedToGuildPacket tJHGMoVf7DhHyQm8a6SCuL1cSWl = packet as InvitedToGuildPacket; if (tJHGMoVf7DhHyQm8a6SCuL1cSWl != null) { this._antiDdos.Invite(tJHGMoVf7DhHyQm8a6SCuL1cSWl); return; } TeleportPacket rvckmor8bw91EVaRfdwc25aHYbc = packet as TeleportPacket; if (rvckmor8bw91EVaRfdwc25aHYbc != null) { this._fameHelper.Teleport(rvckmor8bw91EVaRfdwc25aHYbc); this._accuracyFarm.Teleport(rvckmor8bw91EVaRfdwc25aHYbc); return; } _6UIiGxMChbVinHsvx5uqg8WrMRc 6UIiGxMChbVinHsvx5uqg8WrMRc = packet as InvResultPacket; if (6UIiGxMChbVinHsvx5uqg8WrMRc != null) { this._autoLoot._yOjSn1WKSXsXVziJpL1eH5gSoWg(6UIiGxMChbVinHsvx5uqg8WrMRc); return; } NotificationPacket zIBPB6zZVww7yGWtjJqRMmACh1q = packet as NotificationPacket; if (zIBPB6zZVww7yGWtjJqRMmACh1q != null) { this._autoNexus._4GSfC8bADOwIwOXLYze8EOUBQxJ(zIBPB6zZVww7yGWtjJqRMmACh1q); return; } AccountListPacket k4pBHmoGRyaE6dWf1FIvL0dcuzKA = packet as AccountListPacket; if (k4pBHmoGRyaE6dWf1FIvL0dcuzKA != null) { this._antiLag.AccountList(k4pBHmoGRyaE6dWf1FIvL0dcuzKA); return; } EditAccountListPacket co7ACSeK1WWaCGAPAqLaov37Wqdb = packet as EditAccountListPacket; if (co7ACSeK1WWaCGAPAqLaov37Wqdb != null) { this._antiLag.EditAccountList(co7ACSeK1WWaCGAPAqLaov37Wqdb); return; } _7k8aOfI7MhNrVnHioUXbsPAxkbm 7k8aOfI7MhNrVnHioUXbsPAxkbm = packet as EnemyHitPacket; if (7k8aOfI7MhNrVnHioUXbsPAxkbm != null) { this._o3Helper._9BgsXisaUbFFlj5HLRd76sERUUX(7k8aOfI7MhNrVnHioUXbsPAxkbm); return; } DeathPacket wOmvsGmaE1PheZ2fPjD9V16UEseb = packet as DeathPacket; if (wOmvsGmaE1PheZ2fPjD9V16UEseb != null) { this._autoNexus._qQsqaOxgCR9yg9ky7erATaKrgCC(wOmvsGmaE1PheZ2fPjD9V16UEseb); return; } }
internal void UseItem(int characterId, IItem itemToUse) { UseItemPacket useItemPacket = new UseItemPacket(itemToUse.Id, characterId); worldServerClient.Send(useItemPacket); }