Page 1 of 4
Pet Core NPC Buffer?
Posted: Wed Jan 20, 2010 10:59 am
by momo61
Hi guys,
I've been thinking of implementing a Pet buffing option on my core NPC buffer. Is that possible without modifying anything in the core ? Can I just change the HTML coding a bit ? Anyone here could tell me how to do that ?
thanks a lot,
momo61
Re: Pet Core NPC Buffer?
Posted: Wed Jan 20, 2010 1:50 pm
by momo61
anybody

? please
Re: Pet Core NPC Buffer?
Posted: Wed Jan 20, 2010 2:42 pm
by Charus
Core
Code: Select all
### Eclipse Workspace Patch 1.0#P L2jServerIndex: java/com/l2jserver/gameserver/model/actor/instance/L2NpcBufferInstance.java===================================================================--- java/com/l2jserver/gameserver/model/actor/instance/L2NpcBufferInstance.java (revision 3836)+++ java/com/l2jserver/gameserver/model/actor/instance/L2NpcBufferInstance.java (working copy)@@ -23,7 +23,9 @@ import com.l2jserver.gameserver.datatables.SkillTable; import com.l2jserver.gameserver.model.L2ItemInstance; import com.l2jserver.gameserver.model.L2Skill;+import com.l2jserver.gameserver.model.actor.L2Character; import com.l2jserver.gameserver.model.actor.L2Npc;+import com.l2jserver.gameserver.model.actor.L2Summon; import com.l2jserver.gameserver.network.SystemMessageId; import com.l2jserver.gameserver.network.serverpackets.ActionFailed; import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;@@ -35,25 +37,27 @@ public class L2NpcBufferInstance extends L2Npc { static final Logger _log = Logger.getLogger(L2NpcBufferInstance.class.getName());- + private static TIntIntHashMap pageVal = new TIntIntHashMap();- ++ L2Character _target = null;+ public L2NpcBufferInstance(int objectId, L2NpcTemplate template) { super(objectId, template); }- + @Override public void showChatWindow(L2PcInstance playerInstance, int val) { if (playerInstance == null) return;- + String htmContent = HtmCache.getInstance().getHtm("data/html/mods/NpcBuffer.htm");- + if (val > 0) htmContent = HtmCache.getInstance().getHtm("data/html/mods/NpcBuffer-" + val + ".htm");- + if (htmContent != null) { NpcHtmlMessage npcHtmlMessage = new NpcHtmlMessage(getObjectId());@@ -62,31 +66,46 @@ npcHtmlMessage.replace("%objectId%", String.valueOf(getObjectId())); playerInstance.sendPacket(npcHtmlMessage); }- + playerInstance.sendPacket(ActionFailed.STATIC_PACKET); }- + @Override public void onBypassFeedback(L2PcInstance player, String command) { // BypassValidation Exploit plug.- if (player == null || player.getLastFolkNPC() == null || player.getLastFolkNPC().getObjectId() != this.getObjectId())+ if (player == null || player.getLastFolkNPC() == null || player.getLastFolkNPC().getObjectId() != getObjectId()) return;- + int npcId = getNpcId();- + if (command.startsWith("Chat")) { int val = Integer.parseInt(command.substring(5));- + pageVal.put(player.getObjectId(), val);- + showChatWindow(player, val); }+ else if (command.startsWith("Target"))+ {+ String target = command.substring(7).trim();+ if (target.equalsIgnoreCase("Player"))+ _target = player;+ else if (target.equalsIgnoreCase("Pet"))+ {+ L2Summon pet = player.getPet();+ if (pet == null)+ player.sendPacket(new SystemMessage(SystemMessageId.PETS_ARE_NOT_AVAILABLE_AT_THIS_TIME));+ else+ _target = player.getPet();+ }+ showChatWindow(player, 0);+ } else if (command.startsWith("Buff")) { String[] buffGroupArray = command.substring(5).split(" ");- + for (String buffGroupList : buffGroupArray) { if (buffGroupList == null)@@ -94,56 +113,54 @@ _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: " + player.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 = player.getInventory().getItemByItemId(skillFeeId);- if (itemInstance == null || (!itemInstance.isStackable() && player.getInventory().getInventoryItemCount(skillFeeId, -1) < skillFeeAmount)) {- SystemMessage sm = new SystemMessage(SystemMessageId.THERE_ARE_NOT_ENOUGH_NECESSARY_ITEMS_TO_USE_THE_SKILL);- player.sendPacket(sm);+ player.sendPacket(new SystemMessage(SystemMessageId.THERE_ARE_NOT_ENOUGH_NECESSARY_ITEMS_TO_USE_THE_SKILL)); continue; }- + if (itemInstance.isStackable()) { if (!player.destroyItemByItemId("Npc Buffer", skillFeeId, skillFeeAmount, player.getTarget(), true)) {- SystemMessage sm = new SystemMessage(SystemMessageId.THERE_ARE_NOT_ENOUGH_NECESSARY_ITEMS_TO_USE_THE_SKILL);- player.sendPacket(sm);+ player.sendPacket(new SystemMessage(SystemMessageId.THERE_ARE_NOT_ENOUGH_NECESSARY_ITEMS_TO_USE_THE_SKILL)); continue; } } else { for (int i = 0; i < skillFeeAmount; ++i)- { player.destroyItemByItemId("Npc Buffer", skillFeeId, 1, player.getTarget(), true);- } } }- - L2Skill skill;- skill = SkillTable.getInstance().getInfo(skillId, skillLevel);- ++ L2Skill skill = SkillTable.getInstance().getInfo(skillId, skillLevel); if (skill != null)- skill.getEffects(player, player);+ {+ if (_target != null)+ skill.getEffects(player, _target);+ else+ player.sendPacket(new SystemMessage(SystemMessageId.INCORRECT_TARGET));+ } } showChatWindow(player, pageVal.get(player.getObjectId()));@@ -157,19 +174,14 @@ for (String healType : healArray) { if (healType.equalsIgnoreCase("HP"))- { player.setCurrentHp(player.getMaxHp());- } else if (healType.equalsIgnoreCase("MP"))- { player.setCurrentMp(player.getMaxMp());- } else if (healType.equalsIgnoreCase("CP"))- { player.setCurrentCp(player.getMaxCp());- } } }+ showChatWindow(player, 0); // 0 = main window } else if (command.startsWith("RemoveBuffs"))@@ -178,8 +190,6 @@ showChatWindow(player, 0); // 0 = main window } else- { super.onBypassFeedback(player, command);- } } }\ No newline at end of file
DP
Code: Select all
### Eclipse Workspace Patch 1.0#P L2jDataIndex: data/html/mods/NpcBuffer.htm===================================================================--- data/html/mods/NpcBuffer.htm (revision 6906)+++ data/html/mods/NpcBuffer.htm (working copy)@@ -15,7 +15,9 @@ <button action="bypass -h npc_%objectId%_Chat 1" value="Dance" width=200 height=21 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df"><br> <button action="bypass -h npc_%objectId%_Chat 2" value="Prophet" width=200 height=21 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df"><br> <button action="bypass -h npc_%objectId%_Chat 3" value="Song" width=200 height=21 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df"><br>-<button action="bypass -h npc_%objectId%_Chat 4" value="Preset" width=200 height=21 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df"><br>+<button action="bypass -h npc_%objectId%_Chat 4" value="Preset" width=200 height=21 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df"><br><br>+<button action="bypass -h npc_%objectId%_Target Player" value="Player" width=200 height=21 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df"><br>+<button action="bypass -h npc_%objectId%_Target Pet" value="Pet" width=200 height=21 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df"><br> <img src="L2UI_CH3.herotower_deco" width=256 height=32><br> </center> </body>
It isnt tested. Test it and give results.
Re: Pet Core NPC Buffer?
Posted: Wed Jan 20, 2010 2:44 pm
by momo61
I will test it tonight when I come home. I'd be glad if someone tested it with me. I'll give results as soon as i can.
Re: Pet Core NPC Buffer?
Posted: Wed Jan 20, 2010 6:29 pm
by momo61
charus ? this isnt compilable at all...
Re: Pet Core NPC Buffer?
Posted: Wed Jan 20, 2010 7:11 pm
by Charus
Try patch again. At least i dont see errors on code. Not sure if its working, but no errors at eclipse.
Re: Pet Core NPC Buffer?
Posted: Wed Jan 20, 2010 11:50 pm
by Probe
worksforme, thanks charus
Re: Pet Core NPC Buffer?
Posted: Thu Jan 21, 2010 9:33 am
by momo61
Re: Pet Core NPC Buffer?
Posted: Thu Jan 21, 2010 9:38 am
by qwerty13
try apply patch manually?
Re: Pet Core NPC Buffer?
Posted: Thu Jan 21, 2010 9:54 am
by janiii
delete the first 2 lines from the patch, same for dp patch:
Code: Select all
### Eclipse Workspace Patch 1.0#P L2jServer
Re: Pet Core NPC Buffer?
Posted: Thu Jan 21, 2010 10:22 am
by momo61
that worked. report soon.
Re: Pet Core NPC Buffer?
Posted: Thu Jan 21, 2010 10:53 am
by momo61
Okay here are my results:
If you press on the NPC Buffer and then choose buffs, the NPC buffer wont buff the player or the pet by default. It simply won't buff you until you pick: Player OR Pet.
my opinion: That's okay, but I personally think it should buff the player by default. Because, most players wont play summoner classes, and they will get annoyed to have to click on the Player button before they buff.
Also, there might be problems for people buffing in the olympiad. They might not recieve buffs if the NPC Buffer there doesnt have the "Player" option.
If you buff your pet with the NPC buffer, then you close the HTML window and you click again to get buffs for yourself, you must first choose "Player" to be able to buff, or else it will just buff your pet again. This is alright I guess
what do you guys think about this ? Could this get committed ?
Re: Pet Core NPC Buffer?
Posted: Thu Jan 21, 2010 1:34 pm
by ADONES
I think it would be great if u setup two buffers, one with pet target and one with the player target... so the player dont got to switch the targets himself..
btw... does this also work for nightly pack?
yours
ADONES
Re: Pet Core NPC Buffer?
Posted: Thu Jan 21, 2010 4:11 pm
by Charus
Code: Select all
Index: java/com/l2jserver/gameserver/model/actor/instance/L2NpcBufferInstance.java===================================================================--- java/com/l2jserver/gameserver/model/actor/instance/L2NpcBufferInstance.java (revision 3839)+++ java/com/l2jserver/gameserver/model/actor/instance/L2NpcBufferInstance.java (working copy)@@ -23,7 +23,9 @@ import com.l2jserver.gameserver.datatables.SkillTable; import com.l2jserver.gameserver.model.L2ItemInstance; import com.l2jserver.gameserver.model.L2Skill;+import com.l2jserver.gameserver.model.actor.L2Character; import com.l2jserver.gameserver.model.actor.L2Npc;+import com.l2jserver.gameserver.model.actor.L2Summon; import com.l2jserver.gameserver.network.SystemMessageId; import com.l2jserver.gameserver.network.serverpackets.ActionFailed; import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;@@ -35,25 +37,27 @@ public class L2NpcBufferInstance extends L2Npc { static final Logger _log = Logger.getLogger(L2NpcBufferInstance.class.getName());- + private static TIntIntHashMap pageVal = new TIntIntHashMap();- ++ L2Character _target = null;+ public L2NpcBufferInstance(int objectId, L2NpcTemplate template) { super(objectId, template); }- + @Override public void showChatWindow(L2PcInstance playerInstance, int val) { if (playerInstance == null) return;- + String htmContent = HtmCache.getInstance().getHtm("data/html/mods/NpcBuffer.htm");- + if (val > 0) htmContent = HtmCache.getInstance().getHtm("data/html/mods/NpcBuffer-" + val + ".htm");- + if (htmContent != null) { NpcHtmlMessage npcHtmlMessage = new NpcHtmlMessage(getObjectId());@@ -62,31 +66,46 @@ npcHtmlMessage.replace("%objectId%", String.valueOf(getObjectId())); playerInstance.sendPacket(npcHtmlMessage); }- + playerInstance.sendPacket(ActionFailed.STATIC_PACKET); }- + @Override public void onBypassFeedback(L2PcInstance player, String command) { // BypassValidation Exploit plug.- if (player == null || player.getLastFolkNPC() == null || player.getLastFolkNPC().getObjectId() != this.getObjectId())+ if (player == null || player.getLastFolkNPC() == null || player.getLastFolkNPC().getObjectId() != getObjectId()) return;- + int npcId = getNpcId();- + if (command.startsWith("Chat")) { int val = Integer.parseInt(command.substring(5));- + pageVal.put(player.getObjectId(), val);- + showChatWindow(player, val); }+ else if (command.startsWith("Target"))+ {+ String target = command.substring(7).trim();+ if (target.equalsIgnoreCase("Player"))+ _target = player;+ else if (target.equalsIgnoreCase("Pet"))+ {+ L2Summon pet = player.getPet();+ if (pet == null)+ player.sendPacket(new SystemMessage(SystemMessageId.PETS_ARE_NOT_AVAILABLE_AT_THIS_TIME));+ else+ _target = player.getPet();+ }+ showChatWindow(player, 0);+ } else if (command.startsWith("Buff")) { String[] buffGroupArray = command.substring(5).split(" ");- + for (String buffGroupList : buffGroupArray) { if (buffGroupList == null)@@ -94,56 +113,49 @@ _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: " + player.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 = player.getInventory().getItemByItemId(skillFeeId);- if (itemInstance == null || (!itemInstance.isStackable() && player.getInventory().getInventoryItemCount(skillFeeId, -1) < skillFeeAmount)) {- SystemMessage sm = new SystemMessage(SystemMessageId.THERE_ARE_NOT_ENOUGH_NECESSARY_ITEMS_TO_USE_THE_SKILL);- player.sendPacket(sm);+ player.sendPacket(new SystemMessage(SystemMessageId.THERE_ARE_NOT_ENOUGH_NECESSARY_ITEMS_TO_USE_THE_SKILL)); continue; }- + if (itemInstance.isStackable()) { if (!player.destroyItemByItemId("Npc Buffer", skillFeeId, skillFeeAmount, player.getTarget(), true)) {- SystemMessage sm = new SystemMessage(SystemMessageId.THERE_ARE_NOT_ENOUGH_NECESSARY_ITEMS_TO_USE_THE_SKILL);- player.sendPacket(sm);+ player.sendPacket(new SystemMessage(SystemMessageId.THERE_ARE_NOT_ENOUGH_NECESSARY_ITEMS_TO_USE_THE_SKILL)); continue; } } else { for (int i = 0; i < skillFeeAmount; ++i)- { player.destroyItemByItemId("Npc Buffer", skillFeeId, 1, player.getTarget(), true);- } } }- - L2Skill skill;- skill = SkillTable.getInstance().getInfo(skillId, skillLevel);- ++ L2Skill skill = SkillTable.getInstance().getInfo(skillId, skillLevel); if (skill != null)- skill.getEffects(player, player);+ skill.getEffects(player, _target == null ? player : _target); } showChatWindow(player, pageVal.get(player.getObjectId()));@@ -157,19 +169,14 @@ for (String healType : healArray) { if (healType.equalsIgnoreCase("HP"))- { player.setCurrentHp(player.getMaxHp());- } else if (healType.equalsIgnoreCase("MP"))- { player.setCurrentMp(player.getMaxMp());- } else if (healType.equalsIgnoreCase("CP"))- { player.setCurrentCp(player.getMaxCp());- } } }+ showChatWindow(player, 0); // 0 = main window } else if (command.startsWith("RemoveBuffs"))@@ -178,8 +185,6 @@ showChatWindow(player, 0); // 0 = main window } else- { super.onBypassFeedback(player, command);- } } }\ No newline at end of file
Default target is player now.
Re: Pet Core NPC Buffer?
Posted: Thu Jan 21, 2010 6:34 pm
by momo61
will test.