Jump to content
  • 0

Core Buffer Close Html After Preset


brett16

Question

I am using this core buffer and I have it setup really nice, but there is only 1 thing bugging me with it. When you use 1 of the preset buffs it opens up a random html afterwards. Is there a line I can add some where in this code below that doesn't reopen the html for preset buffs? I don't want it to close after each single buff is picked tho if thats possible. 

public class L2NpcBufferInstance extends L2Npc
{
	private static final Logger _log = Logger.getLogger(L2NpcBufferInstance.class.getName());
	
	private static final Map<Integer, Integer> pageVal = new HashMap<>();
	
	/**
	 * Instantiates a new l2 npc buffer instance.
	 * @param objectId the object id
	 * @param template the template
	 */
	public L2NpcBufferInstance(int objectId, L2NpcTemplate template)
	{
		super(objectId, template);
		setInstanceType(InstanceType.L2NpcBufferInstance);
	}
	
	@Override
	public void showChatWindow(L2PcInstance player, int val)
	{
		if (player == null)
		{
			return;
		}
		
		String htmContent = HtmCache.getInstance().getHtm(player.getHtmlPrefix(), "data/html/mods/NpcBuffer.htm");
		if (val > 0)
		{
			htmContent = HtmCache.getInstance().getHtm(player.getHtmlPrefix(), "data/html/mods/NpcBuffer-" + val + ".htm");
		}
		
		if (htmContent != null)
		{
			final NpcHtmlMessage npcHtmlMessage = new NpcHtmlMessage(getObjectId());
			npcHtmlMessage.setHtml(htmContent);
			npcHtmlMessage.replace("%objectId%", String.valueOf(getObjectId()));
			player.sendPacket(npcHtmlMessage);
		}
		player.sendPacket(ActionFailed.STATIC_PACKET);
	}
	
	@Override
	public void onBypassFeedback(L2PcInstance player, String command)
	{
		// BypassValidation Exploit plug.
		if ((player == null) || (player.getLastFolkNPC() == null) || (player.getLastFolkNPC().getObjectId() != getObjectId()))
		{
			return;
		}
		
		L2Character target = player;
		if (command.startsWith("Pet"))
		{
			if (!player.hasSummon()) // TODO: Should be hasPet() ?
			{
				player.sendPacket(SystemMessageId.DONT_HAVE_PET);
				showChatWindow(player, 0); // 0 = main window
				return;
			}
			target = player.getSummon();
		}
		
		int npcId = getId();
		if (command.startsWith("Chat"))
		{
			int val = Integer.parseInt(command.substring(5));
			
			pageVal.put(player.getObjectId(), val);
			
			showChatWindow(player, val);
		}
		else if (command.startsWith("Buff") || command.startsWith("PetBuff"))
		{
			String[] buffGroupArray = command.substring(command.indexOf("Buff") + 5).split(" ");
			
			for (String buffGroupList : buffGroupArray)
			{
				if (buffGroupList == null)
				{
					_log.warning("NPC Buffer Warning: npcId = " + npcId + " has no buffGroup set in the bypass for the buff selected.");
					return;
				}
				
				int buffGroup = Integer.parseInt(buffGroupList);
				
				final NpcBufferData npcBuffGroupInfo = NpcBufferTable.getInstance().getSkillInfo(npcId, buffGroup);
				if (npcBuffGroupInfo == null)
				{
					_log.warning("NPC Buffer Warning: npcId = " + npcId + " Location: " + getX() + ", " + getY() + ", " + getZ() + " Player: " + player.getName() + " has tried to use skill group (" + buffGroup + ") not assigned to the NPC Buffer!");
					return;
				}
				
				if (npcBuffGroupInfo.getFee().getId() != 0)
				{
					L2ItemInstance itemInstance = player.getInventory().getItemByItemId(npcBuffGroupInfo.getFee().getId());
					if ((itemInstance == null) || (!itemInstance.isStackable() && (player.getInventory().getInventoryItemCount(npcBuffGroupInfo.getFee().getId(), -1) < npcBuffGroupInfo.getFee().getCount())))
					{
						SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.THERE_ARE_NOT_ENOUGH_NECESSARY_ITEMS_TO_USE_THE_SKILL);
						player.sendPacket(sm);
						continue;
					}
					
					if (itemInstance.isStackable())
					{
						if (!player.destroyItemByItemId("Npc Buffer", npcBuffGroupInfo.getFee().getId(), npcBuffGroupInfo.getFee().getCount(), player.getTarget(), true))
						{
							SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.THERE_ARE_NOT_ENOUGH_NECESSARY_ITEMS_TO_USE_THE_SKILL);
							player.sendPacket(sm);
							continue;
						}
					}
					else
					{
						for (int i = 0; i < npcBuffGroupInfo.getFee().getCount(); ++i)
						{
							player.destroyItemByItemId("Npc Buffer", npcBuffGroupInfo.getFee().getId(), 1, player.getTarget(), true);
						}
					}
				}
				
				final Skill skill = SkillData.getInstance().getSkill(npcBuffGroupInfo.getSkill().getSkillId(), npcBuffGroupInfo.getSkill().getSkillLvl());
				if (skill != null)
				{
					skill.applyEffects(player, target);
				}
			}
			
			showChatWindow(player, pageVal.get(player.getObjectId()));
		}
		else if (command.startsWith("Heal") || command.startsWith("PetHeal"))
		{
			if (!target.isInCombat() && !AttackStanceTaskManager.getInstance().hasAttackStanceTask(target))
			{
				String[] healArray = command.substring(command.indexOf("Heal") + 5).split(" ");
				
				for (String healType : healArray)
				{
					if (healType.equalsIgnoreCase("HP"))
					{
						target.setCurrentHp(target.getMaxHp());
					}
					else if (healType.equalsIgnoreCase("MP"))
					{
						target.setCurrentMp(target.getMaxMp());
					}
					else if (healType.equalsIgnoreCase("CP"))
					{
						target.setCurrentCp(target.getMaxCp());
					}
				}
			}
			showChatWindow(player, pageVal.get(player.getObjectId()));
		}
		else if (command.startsWith("RemoveBuffs") || command.startsWith("PetRemoveBuffs"))
		{
			target.stopAllEffectsExceptThoseThatLastThroughDeath();
			showChatWindow(player, pageVal.get(player.getObjectId()));
		}
		else
		{
			super.onBypassFeedback(player, command);
		}
	}
}
Link to comment
Share on other sites

8 answers to this question

Recommended Posts

  • 0

Do you have a main page on your buffer?

 

What I mean: 

 

Hello im buffer bla bla bla.

 

Button Buff me and taking you to buff menus where are those presets?

Because if you do it like that with the main page you will not have problem with returning back to right html window.

Link to comment
Share on other sites

  • 0

This is the new code that I think opens the main page 0 after using presets. But comes with another issue.

public class L2NpcBufferInstance extends L2Npc
{
	private static final Logger _log = Logger.getLogger(L2NpcBufferInstance.class.getName());
	
	private static final Map<Integer, Integer> pageVal = new HashMap<>();
	
	/**
	 * Instantiates a new l2 npc buffer instance.
	 * @param objectId the object id
	 * @param template the template
	 */
	public L2NpcBufferInstance(int objectId, L2NpcTemplate template)
	{
		super(objectId, template);
		setInstanceType(InstanceType.L2NpcBufferInstance);
	}
	
	@Override
	public void showChatWindow(L2PcInstance player, int val)
	{
		if (player == null)
		{
			return;
		}
		
		String htmContent = HtmCache.getInstance().getHtm(player.getHtmlPrefix(), "data/html/mods/NpcBuffer.htm");
		if (val > 0)
		{
			htmContent = HtmCache.getInstance().getHtm(player.getHtmlPrefix(), "data/html/mods/NpcBuffer-" + val + ".htm");
		}
		
		if (htmContent != null)
		{
			final NpcHtmlMessage npcHtmlMessage = new NpcHtmlMessage(getObjectId());
			npcHtmlMessage.setHtml(htmContent);
			npcHtmlMessage.replace("%objectId%", String.valueOf(getObjectId()));
			player.sendPacket(npcHtmlMessage);
		}
		player.sendPacket(ActionFailed.STATIC_PACKET);
	}
	
	@Override
	public void onBypassFeedback(L2PcInstance player, String command)
	{
		// BypassValidation Exploit plug.
		if ((player == null) || (player.getLastFolkNPC() == null) || (player.getLastFolkNPC().getObjectId() != getObjectId()))
		{
			return;
		}
		
		L2Character target = player;
		if (command.startsWith("Pet"))
		{
			if (!player.hasSummon()) // TODO: Should be hasPet() ?
			{
				player.sendPacket(SystemMessageId.DONT_HAVE_PET);
				showChatWindow(player, 0); // 0 = main window
				return;
			}
			target = player.getSummon();
		}
		
		int npcId = getId();
		if (command.startsWith("Chat"))
		{
			int val = Integer.parseInt(command.substring(5));
			
			pageVal.put(player.getObjectId(), val);
			
			showChatWindow(player, val);
		}
		else if (command.startsWith("Buff") || command.startsWith("PetBuff"))
		{
			String[] buffGroupArray = command.substring(command.indexOf("Buff") + 5).split(" ");
			
			for (String buffGroupList : buffGroupArray)
			{
				if (buffGroupList == null)
				{
					_log.warning("NPC Buffer Warning: npcId = " + npcId + " has no buffGroup set in the bypass for the buff selected.");
					return;
				}
				
				int buffGroup = Integer.parseInt(buffGroupList);
				
				final NpcBufferData npcBuffGroupInfo = NpcBufferTable.getInstance().getSkillInfo(npcId, buffGroup);
				if (npcBuffGroupInfo == null)
				{
					_log.warning("NPC Buffer Warning: npcId = " + npcId + " Location: " + getX() + ", " + getY() + ", " + getZ() + " Player: " + player.getName() + " has tried to use skill group (" + buffGroup + ") not assigned to the NPC Buffer!");
					return;
				}
				
				if (npcBuffGroupInfo.getFee().getId() != 0)
				{
					L2ItemInstance itemInstance = player.getInventory().getItemByItemId(npcBuffGroupInfo.getFee().getId());
					if ((itemInstance == null) || (!itemInstance.isStackable() && (player.getInventory().getInventoryItemCount(npcBuffGroupInfo.getFee().getId(), -1) < npcBuffGroupInfo.getFee().getCount())))
					{
						SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.THERE_ARE_NOT_ENOUGH_NECESSARY_ITEMS_TO_USE_THE_SKILL);
						player.sendPacket(sm);
						continue;
					}
					
					if (itemInstance.isStackable())
					{
						if (!player.destroyItemByItemId("Npc Buffer", npcBuffGroupInfo.getFee().getId(), npcBuffGroupInfo.getFee().getCount(), player.getTarget(), true))
						{
							SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.THERE_ARE_NOT_ENOUGH_NECESSARY_ITEMS_TO_USE_THE_SKILL);
							player.sendPacket(sm);
							continue;
						}
					}
					else
					{
						for (int i = 0; i < npcBuffGroupInfo.getFee().getCount(); ++i)
						{
							player.destroyItemByItemId("Npc Buffer", npcBuffGroupInfo.getFee().getId(), 1, player.getTarget(), true);
						}
					}
				}
				
				final Skill skill = SkillData.getInstance().getSkill(npcBuffGroupInfo.getSkill().getSkillId(), npcBuffGroupInfo.getSkill().getSkillLvl());
				if (skill != null)
				{
					skill.applyEffects(player, target);
				}
			}
			
			showChatWindow(player, pageVal.get(player.getObjectId()));
		}
		else if (command.startsWith("Heal") || command.startsWith("PetHeal"))
		{
			if (!target.isInCombat() && !AttackStanceTaskManager.getInstance().hasAttackStanceTask(target))
			{
				String[] healArray = command.substring(command.indexOf("Heal") + 5).split(" ");
				
				for (String healType : healArray)
				{
					if (healType.equalsIgnoreCase("HP"))
					{
						target.setCurrentHp(target.getMaxHp());
					}
					else if (healType.equalsIgnoreCase("MP"))
					{
						target.setCurrentMp(target.getMaxMp());
					}
					else if (healType.equalsIgnoreCase("CP"))
					{
						target.setCurrentCp(target.getMaxCp());
					}
				}
			}
			showChatWindow(player, pageVal.get(player.getObjectId()));
		}
		else if (command.startsWith("RemoveBuffs") || command.startsWith("PetRemoveBuffs"))
		{
			target.stopAllEffectsExceptThoseThatLastThroughDeath();
			showChatWindow(player, 0);
		}
		else
		{
			super.onBypassFeedback(player, command);
		}
	}
}

When I go to my buffer and select a preset fighter it buffs me, but this also pops up and sends the same message to my gameserver console. http://imgur.com/dgLhUZ1

I know how to stop to problem from happening again in game, If I select a normal buff first then use my preset it wont give me this message. But not every player will do this, they will all just use the presets. How can I fix or remove this message spam?

Edited by brett16
Link to comment
Share on other sites

  • 0

Now let me say you something the page returning function can be removed at all but this is not good because when player uses normal buffs except presets at every click the window will be closed.

 

My suggestion is to move the presets to page1. Not on page 0 because the buffer is remembering the pageVal only when the "Chat" function is used.

 

You can also try to add this code:

if (val == 0)
{
pageVal.put(player.getObjectId(), 0);
}

Bellow:

public void showChatWindow(L2PcInstance player, int val)
	{
		if (player == null)
		{
			return;
		}

I dont know if it will work that way but try.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Posts

    • bro is any chance some one share compile pack and patch system for that one? is any chance here.... and client
    • Hello members of the forum! We offer hosting services for a different range of services: - ip spoofing; - scanning; - phishing; - botnets; - proxy; - gambling; - stealers; - legal adult; Prices: - VPS starting at $24; - Dedicated servers  starting at  $110; Contctats: layer0.ltd@gmail.com Telegram: @layer0_ltd Discord: layer0.ltd#6843 site: layer0.ltd
    • OUR OFFICIAL WEBSITE / FORUM - MILLENNIUM-HOOK.NET CHEAT DESCRIPTION: Our CS2 cheat is a premium cheat which provides a ton of features for legit gamplay. The cheat was created specifically for strong leagues and anti-cheats such as Faceit, 5EWin, Gamersclub, Esportal and many others. This cheat is perfect for players who want a safe undetected and reliable multi-hack while dominating their opponents and winning the game in their own style. To ensure maximum security of our cheat, we use more than 15+ methods of protection (for example, String Encryption, PE Header Erased, Code Mutation and much more that we cannot talk about for security reasons). Settings are directly configurable via a superb looking in-game menu or over our online «Cloud Panel». Our product is constantly receiving updates in collaboration with the our coders community and suggestions by you! SUPPORTED ANTI-CHEATS: (read more on official website) - VAC (Valve Anti-Cheat) - MM (Matchmaking) - FACEIT Server-Side - FACEIT Client - CEVO / Gfinity - EAC (Easy Anti-Cheat) - ESL Wire - 5EWin / 5EPlay - Perfect World - Gamersclub - Esportal - WePlay - ESEA Our CS2 cheat has a limited number of slots to ensure greater product security! (Available slots check on official website) FEATURES: AIMBOT: - Bone Aimbot (Legit aimbot that doesn't use any angle code that other competitors use. It aims in a legitimate fashion) - Bone and Multibone (Adjust which bone to aim at or select as many Bones as you want) - Smoothaim (Adjust how smooth the aimbot is in its human-like drag) - CloseAim (Toggle distance based aiming algorithm, for increased stickyness, or whoever is closest to the crosshair) - FoV (Adjust the Field of View of the aimbot or percentage of the screen that the aimbot will target enemies from) - Aimkey (Adjust which key the aimbot will use to aim) - AimDraw (Toggle the drawing of the aimspot on enemies (Visible/Always) - VisibleCheck (Visible checking on enemies with close enemy) - NoHop (Aim at One Target per press of the AimKey (Aimbot Doesn't Hop to Other Targets even after death) - RandomSpot (Randomizes the Spot around the target bones, making your aim look more humanized and legit) - Aimtime (Amount of time that the aimbot and Aimbot-RCS is active for, after you press the aimkey) - Ammo Management (Disable aimbot and TriggerBot when the gun clip is empty) - CloseFoV (Different FoV for players with in a certain distance (CloseFOV Distance) - AimOnShoot (Aim when shooting, aim when not shooting) - RecoilAfter (Start recoil after x bullets (Good for 1-2 Taps) - Recoil (Adjust the recoil counter while using the aimbot) - RecoilKey (Adjust which key the anti-recoil is set on (For all Aimbot Keys) - RecoilType (Control if recoil control is always on or only when using the Aimbot) - RecoilFOV (Adjust how long the Recoil will stay stuck to the target, very usable for when playing at a LAN) TRIGGERBOT: - TriggerBot (Automatically shoot at an enemy in a radius (usable with or without Aimbot) - TriggerKey (Control what key activates the TriggerBot (use with any key) - TriggerFov (Control the radius around the AimSpot which activates the TriggerBot) - TriggerDraw (Draw the bone spot that the TriggerBot is aiming at) - TriggerBone (Select the bone that the TriggerBot will target) - TriggerDelay (To add to the legitimacy of the TriggerBot, delays shooting for up to 0.5 seconds) - MonsterTrigger (Extremely Fast & Accurate TriggerBot with Fullbody Options Perfect TriggerBot) - VisCheck (Make sure you're only hitting enemies that you can see, or turn it off to get some sick wallbangs) - Random Delay (A random delay for your trigger bot to look even more legitimate) - Trigger Button (Use any button you like to control the triggerbot) ESP: - Name (Name of the player) - Health (Shows the current health of a player) - Armor (Shows the current amount of armor a player has) - ArmorType (Show if a player currently has a Kevlar vest, a helmet or both equipped) - Weapon (See what weapon a player is currently holding) - Weapon Ammo (See how much ammo you have left in the current clip) - Index (The internal index of the player based on the CSGO engine) - Distance (The distance of each player from you) - Box (A box around each players model, adjusting with distance (new rectangle box type) - Sequence (What action or stance the player is in (Running, Ducking, Jumping, Scoped etc) - Box Size & Box Multi (The size of the boxes around the players, adjustable to how you like) - Team ESP (Toggle ESP on your teammates) - Clean Draw ESP (Move ESP away from box) - Pixel ESP (Single Pixel ESP for legitimate play, shows one single pixel on the screen so it's not noticeable to any casual observers) - Visible ESP (Different color ESP for visible & non-visible players) - Entity ESP (See weapons, defusers, Bomb Location, and defusing players) - Entity Distance (Adjust how far away you will see different Entities for the ultimate in Player-Location assistance) - List ESP (The Ultimate Legit ESP, Listing Players that are not on your screen, or players anywhere in case you don't want to know where they are exactly) MISC: - Bunny Hop (Jumps automatically while the chosen key is being held) - Crosshair (When enabled it will draw a cross-hair on your screen, perfect for snipers, it also features an adjustable size) - Weapon Config System (Weapon configurations for each weapon group (pistols, deagle, snipers, SMG, Knife, rifles, etc) - Flash reduction (Make sure you can see enemies while you're supposed to be flashed) - Radar In Game (A radar is displayed where you see opponents) REQUIREMENTS: - Included HWID Spoofer: Yes - Stream Bypass: Yes - Supported game modes: Windowed, Borderless - Supported CPU: Intel & AMD - Supported OS: Windows 10 (1903,1909,2004,20H2,21H1, 22H2), Windows 11 (All version). Supported OS change and are added periodically. More check on official website.   IN-GAME SCREENSHOTS:   - Check on the official website.
    • A very skilled guy, did the job and delivered super fast, you can go without fear   100% malaka boy
  • Topics

×
×
  • Create New...