Jump to content

Recommended Posts

Posted

i made this nearly 5months ago so its pretty outdated sry for this :D

 

Index: trunk/L2Emu-Game/src/main/java/com/l2emu/gameserver/model/actor/instance/L2NpcBufferInstance.java
===================================================================
diff -u -N -r1311 -r1320
--- trunk/L2Emu-Game/src/main/java/com/l2emu/gameserver/model/actor/instance/L2NpcBufferInstance.java	(.../L2NpcBufferInstance.java)	(revision 1311)
+++ trunk/L2Emu-Game/src/main/java/com/l2emu/gameserver/model/actor/instance/L2NpcBufferInstance.java	(.../L2NpcBufferInstance.java)	(revision 1320)
@@ -22,6 +22,7 @@
import com.l2emu.gameserver.model.L2ItemInstance;
import com.l2emu.gameserver.model.L2Skill;
import com.l2emu.gameserver.model.actor.L2Npc;
+import com.l2emu.gameserver.model.actor.L2Summon;
import com.l2emu.gameserver.network.SystemMessageId;
import com.l2emu.gameserver.network.serverpackets.ActionFailed;
import com.l2emu.gameserver.network.serverpackets.NpcHtmlMessage;
@@ -122,6 +123,63 @@
			}
			showChatWindow(playerInstance, pageVal);
		}
+		else if (command.startsWith("PetBuff"))
+		{
+			L2Summon summonInstance = playerInstance.getPet();
+			
+			if (summonInstance == null)
+				return;
+			
+			String[] buffGroupArray = command.substring(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);
+				int[] npcBuffGroupInfo = NpcBufferTable.getInstance().getSkillInfo(npcId, buffGroup);
+				if (npcBuffGroupInfo == null)
+				{
+					_log.warning("NPC Buffer Warning: npcId = " + npcId + " Location: " + getX() + ", " + getY() + ", " + getZ() + " Player: " + playerInstance.getName() + " has tried to use skill group (" + buffGroup + ") not assigned to the NPC Buffer!");
+					return;
+				}
+				int skillId = npcBuffGroupInfo[0];
+				int skillLevel = npcBuffGroupInfo[1];
+				int skillFeeId = npcBuffGroupInfo[2];
+				int skillFeeAmount = npcBuffGroupInfo[3];
+				if (skillFeeId != 0)
+				{
+					L2ItemInstance itemInstance = playerInstance.getInventory().getItemByItemId(skillFeeId);
+					if (itemInstance == null || (!itemInstance.isStackable() && playerInstance.getInventory().getInventoryItemCount(skillFeeId, -1) < skillFeeAmount))
+					{
+						SystemMessage sm = new SystemMessage(SystemMessageId.THERE_ARE_NOT_ENOUGH_NECESSARY_ITEMS_TO_USE_THE_SKILL);
+						playerInstance.sendPacket(sm);
+						continue;
+					}
+					if (itemInstance.isStackable())
+					{
+						if (!playerInstance.destroyItemByItemId("Npc Buffer", skillFeeId, skillFeeAmount, playerInstance.getTarget(), true))
+						{
+							SystemMessage sm = new SystemMessage(SystemMessageId.THERE_ARE_NOT_ENOUGH_NECESSARY_ITEMS_TO_USE_THE_SKILL);
+							playerInstance.sendPacket(sm);
+							continue;
+						}
+					}
+					else
+					{
+						for (int i = 0; i < skillFeeAmount; ++i)
+							playerInstance.destroyItemByItemId("Npc Buffer", skillFeeId, 1, playerInstance.getTarget(), true);
+					}
+				}
+				L2Skill skill;
+				skill = SkillTable.getInstance().getInfo(skillId, skillLevel);
+				if (skill != null)
+					skill.getEffects(playerInstance, summonInstance);
+			}
+			showChatWindow(playerInstance, pageVal);
+		}
		else if (command.startsWith("Heal"))
		{
			if (!playerInstance.isInCombat() && !AttackStanceTaskManager.getInstance().getAttackStanceTask(playerInstance))

 

to use it use the PetBuff bypass.

 

credits to me.

Posted

Nice one, glad to see you back at sharing ^^

 

i never regret to share something i just not a sharing type and i share only few times but still i have the most own shared code so... :D

  • 2 weeks later...
  • 1 month later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock