Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: net.sf.l2j;Config.java
- ===================================================================
- --- net.sf.l2j;Config.java (revision 84)
- +++ net.sf.l2j;Config.java (working copy)
- + public static final String SKILLS_SELLER = "./config/aCis/NpcSkillSeller.properties";
- + /** Seller Npc Skills */
- + public static int SELLER_SKILLS_NPCID;
- + public static int SELLER_SKILLS_ITEM;
- + public static String SELLER_SKILLS_MESSAGE_TEXT;
- + public static int SELLER_SKILLS_COUNT;
- + private static final void loadSellerSkills() {
- +
- + final ExProperties NpcSkillSeller = initProperties(Config.SKILLS_SELLER);
- +
- + SELLER_SKILLS_NPCID = Integer.parseInt(NpcSkillSeller.getProperty("SellerSkillsNpcId", "1"));
- + SELLER_SKILLS_ITEM = NpcSkillSeller.getProperty("SellerItemId", 57);
- + SELLER_SKILLS_COUNT = NpcSkillSeller.getProperty("SellerItemCount", 100);
- +
- + SELLER_SKILLS_MESSAGE_TEXT = NpcSkillSeller.getProperty("ItemName", "Adena");
- +
- +
- +
- +
- + }
- - // siege settings
- - loadSieges();
- + // siege settings
- + loadSieges();
- + loadSellerSkills();
- Index: net.sf.l2j.gameserver.model.actor.Npc.java
- ===================================================================
- --- net.sf.l2j.gameserver.model.actor.Npc.java (revision 84)
- +++ net.sf.l2j.gameserver.model.actor.Npc.java (working copy)
- @Override
- public void onAction(Player player)
- {
- + if (getNpcId() == SkillSeller.NPC_ID)
- + {
- + ItemInstance i = player.getInventory().getItemByItemId(SkillSeller.ITEM_ID);
- +
- + if (i == null || i.getCount() < SkillSeller.ITEM_COUNT)
- + {
- + player.sendMessage("You need " + SkillSeller.ITEM_COUNT + " " + Config.SELLER_SKILLS_MESSAGE_TEXT + "to use this Npc.");
- + player.sendPacket(new ActionFailed());
- + return;
- + }
- + }
- // Set the target of the player
- if (player.getTarget() != this)
- player.setTarget(this);
- else
- Index: net.sf.l2j.gameserver.network.clientpackets.RequestBypassToServer.java
- ===================================================================
- --- net.sf.l2j.gameserver.network.clientpackets.RequestBypassToServer.java (revision 84)
- +++ net.sf.l2j.gameserver.network.clientpackets.RequestBypassToServer.java (working copy)
- + // L2SkillSeller
- + if (_command.startsWith("skill"))
- + {
- + String b = _command.substring(5);
- + int id = 0;
- + try
- + {
- + id = Integer.parseInt(b);
- + }
- + catch (Exception e)
- + {
- + e.printStackTrace();
- + }
- +
- + if (id == 0)
- + return;
- +
- + L2Skill s = SkillTable.getInstance().getInfo(id, 10);
- + ItemInstance i = player.getInventory().getItemByItemId(SkillSeller.ITEM_ID);
- +
- + if (i == null || i.getCount() < SkillSeller.ITEM_COUNT)
- + {
- + player.sendMessage("You don't have enought " + Config.SELLER_SKILLS_MESSAGE_TEXT);
- + return;
- + }
- +
- + player.getInventory().destroyItemByItemId("", SkillSeller.ITEM_ID, SkillSeller.ITEM_COUNT, player, null);
- + player.sendMessage("You rewarded successfully with " + s.getName() + " Lvl:10, " + Config.SELLER_SKILLS_COUNT + " " + Config.SELLER_SKILLS_MESSAGE_TEXT + " dissapeared");
- + player.addSkill(s, false);
- + player.broadcastPacket(new SocialAction(player, 9));
- + }
- +
- + }
- Index: net.sf.l2j.gameserver.model.actor.instance.SkillSeller.java
- ===================================================================
- --- net.sf.l2j.gameserver.model.actor.instance.SkillSeller.java (no exist)
- +++ net.sf.l2j.gameserver.model.actor.instance.SkillSeller.java (no exist)
- + package net.sf.l2j.gameserver.model.actor.instance;
- +
- + import net.sf.l2j.Config;
- + import net.sf.l2j.gameserver.data.SkillTable;
- +
- + import net.sf.l2j.gameserver.model.L2Skill;
- + import net.sf.l2j.gameserver.model.actor.Npc;
- + import net.sf.l2j.gameserver.model.actor.Player;
- + import net.sf.l2j.gameserver.model.actor.template.NpcTemplate;
- + import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage;
- +
- + public class SkillSeller extends Npc
- + {
- + public final static int NPC_ID = Config.SELLER_SKILLS_NPCID;
- + public final static int ITEM_ID = Config.SELLER_SKILLS_ITEM;
- + public final static int ITEM_COUNT = Config.SELLER_SKILLS_COUNT;
- +
- + private final int[] SKILL_IDS =
- + {
- + 3134, 3132, 3124, 3125, 3133, 3135, 3136, 3137, 3138, 3139, 3140, 3141, 3134
- + };
- +
- +
- +
- + public SkillSeller(int objectId, NpcTemplate template)
- + {
- + super(objectId, template);
- + }
- +
- + @Override
- + public void showChatWindow(Player j, int val)
- + {
- + if (j == null)
- + return;
- +
- + StringBuilder t = new StringBuilder();
- + NpcHtmlMessage n = new NpcHtmlMessage(getObjectId());
- + sendHtml(t, n, j);
- +
- + }
- +
- +
- +
- + private void sendHtml(StringBuilder t, NpcHtmlMessage n, Player j)
- + {
- + t.append("<html><head><title>");
- + t.append("L2Skill Seller");
- + t.append("</title</head>");
- + t.append("<body><center>");
- + t.append("<br>Hello , do you want some special skills?");
- + t.append("<br>Choose whatever you want but don't forget");
- + t.append("<br>you need " + Config.SELLER_SKILLS_MESSAGE_TEXT + " Bars for each one");
- + for (int i : SKILL_IDS)
- + {
- + L2Skill s = SkillTable.getInstance().getInfo(i, 10);
- + String name = "";
- + if (s != null)
- + name = s.getName();
- + if (name != "")
- + t.append("<center><button value=\"" + name + " LvL:10\" action=\"bypass -h skill" + i + "\" width=204 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"><br>");
- + }
- + t.append("</center></body></html>");
- + n.setHtml(t.toString());
- + j.sendPacket(n);
- + }
- +
- +
- + }
- +
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement