public static void ReapResin(Player plr, ushort slot) { uint arborealResin = 84711; byte lvl = CraftingApoInterface.GetCraft(9, plr.ItmInterface.GetItemInSlot(slot).Info.Crafts); if (lvl > 1) { arborealResin += (uint)(lvl / 25); } plr.ItmInterface.CreateItem(arborealResin, 1, true); plr.ItmInterface.CreateItem(uint.Parse(plr.ItmInterface.GetItemInSlot(slot).Info.Craftresult.Split(';')[3]), 1, true); plr.ItmInterface.DeleteItem(slot, 1); }
public static void F_USE_ITEM(BaseClient client, PacketIn packet) { GameClient cclient = client as GameClient; if (!cclient.IsPlaying()) { return; } Player Plr = cclient.Plr; if (Plr.AbtInterface.IsOnGlobalCooldown()) { return; } ushort slot = packet.GetUint16(); Item item = Plr.ItmInterface.GetItemInSlot(slot); if (item == null || item._Count == 0) { return; } if (!item.CanBeUsedBy(Plr)) { return; } if ((Item.ItemType)item.Info.Type == Item.ItemType.Quest) { Plr.QtsInterface.HandleEvent(Objective_Type.QUEST_USE_ITEM, item.Info.Entry, 1); } if (item.Info.Entry == 86203 || item.Info.Entry == 86207 || item.Info.Entry == 86211 || item.Info.Entry == 86215 || item.Info.Entry == 86219 || item.Info.Entry == 86223) // siege oil { Keep keep = Plr.Region.Bttlfront.GetClosestKeep(Plr.WorldPosition); if (keep.Realm == Plr.Realm) { keep.SpawnOil(Plr, slot); } } if (item.ModelId == 1566 || item.ModelId == 3850) // currency conversion boxes { Plr.ItmInterface.OpenBox(slot, item); } #region Loot bags if (item.Info.Entry == 9980 || item.Info.Entry == 9940 || item.Info.Entry == 9941 || item.Info.Entry == 9942 || item.Info.Entry == 9943) // lootbags { packet.Skip(5); byte mode = packet.GetUint8(); if (mode == 0) { Plr.ItmInterface.SendMysteryBag(slot); } else { Plr.ItmInterface.GetItemfromMysterybag(slot, mode); } } #endregion // Banner hack for standards. if (item.ModelId >= 6188 && item.ModelId < 6194) { Plr.Standard(item.Info.SpellId); } if (item.Info.Crafts.Length > 0 && CraftingApoInterface.GetCraft(5, item.Info.Crafts) == 4 && (CraftingApoInterface.GetCraft(8, item.Info.Crafts) < 5 || CraftingApoInterface.GetCraft(8, item.Info.Crafts) == 18)) { CultivationInterface.ReapResin(Plr, slot); } #region Dye if (item.Info.Type == 27) { Item dye = Plr.ItmInterface.GetItemInSlot(slot); if (dye == null) { return; } byte prisek = packet.GetUint8(); packet.Skip(4); byte Slot = packet.GetUint8(); Item itemtodye = Plr.ItmInterface.GetItemInSlot(Slot); if (dye.Info.BaseColor1 == 0) { Plr.ItmInterface.RemoveDye(itemtodye, prisek == 1, prisek == 2); } else { if (prisek == 1) { Plr.ItmInterface.DyeItem(itemtodye, dye.Info.BaseColor1, 0); } else { Plr.ItmInterface.DyeItem(itemtodye, 0, dye.Info.BaseColor1); } } Plr.ItmInterface.DeleteItem(slot, 1); } #endregion if (item.Info.SpellId == 0) { return; } #region Ability Cast if (!Plr.AbtInterface.CanCastCooldown(item.Info.SpellId)) { Plr.SendLocalizeString("", ChatLogFilters.CHATLOGFILTERS_USER_ERROR, Localized_text.TEXT_ITEM_CANT_BE_USED_YET); return; } if (!Plr.AbtInterface.StartCast(Plr, item.Info.SpellId, 1, item.Info.Unk27?[19] ?? 0, item.Info.ObjectLevel)) { return; } if (item.Info.MaxStack > 1) { Plr.ItmInterface.DeleteItem(slot, 1); } WorldMgr.GeneralScripts.OnWorldPlayerEvent("USE_ITEM", Plr, item); #endregion }