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...

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
Reply to this topic...

×   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.



×
×
  • Create New...