Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ### Eclipse Workspace Patch 1.0
- #P aCis_gameserver
- Index: java/net/sf/l2j/util/DDSConverter.java
- ===================================================================
- --- java/net/sf/l2j/util/DDSConverter.java (revision 0)
- +++ java/net/sf/l2j/util/DDSConverter.java (working copy)
- @@ -0,0 +1,348 @@
- +package net.sf.l2j.util;
- +
- +
- +import java.awt.image.BufferedImage;
- +import java.io.File;
- +import java.io.IOException;
- +import java.nio.ByteBuffer;
- +import java.nio.ByteOrder;
- +import java.util.logging.Logger;
- +
- +import javax.imageio.ImageIO;
- +
- +public class DDSConverter
- +{
- + public static final Logger _log = Logger.getLogger(DDSConverter.class.getName());
- +
- + protected static class Color
- + {
- +
- + @Override
- + public boolean equals(Object obj)
- + {
- + if (this == obj)
- + {
- + return true;
- + }
- + if ((obj == null) || (getClass() != obj.getClass()))
- + {
- + return false;
- + }
- + Color color = (Color) obj;
- + if (b != color.b)
- + {
- + return false;
- + }
- + if (g != color.g)
- + {
- + return false;
- + }
- + return r == color.r;
- + }
- +
- + @Override
- + public int hashCode()
- + {
- + int i = r;
- + i = (29 * i) + g;
- + i = (29 * i) + b;
- + return i;
- + }
- +
- + protected int r;
- + protected int g;
- + protected int b;
- +
- + public Color()
- + {
- + r = g = b = 0;
- + }
- +
- + public Color(int i, int j, int k)
- + {
- + r = i;
- + g = j;
- + b = k;
- + }
- + }
- +
- + public static ByteBuffer convertToDDS(File file) throws IOException
- + {
- + if (file == null)
- + {
- + String s = "nullValue.FileIsNull";
- + _log.severe(s);
- + throw new IllegalArgumentException(s);
- + }
- + if (!file.exists() || !file.canRead())
- + {
- + String s1 = "DDSConverter.NoFileOrNoPermission";
- + _log.severe(s1);
- + throw new IllegalArgumentException(s1);
- + }
- + BufferedImage bufferedimage = ImageIO.read(file);
- + if (bufferedimage == null)
- + {
- + return null;
- + }
- + if (bufferedimage.getColorModel().hasAlpha())
- + {
- + return convertToDxt3(bufferedimage);
- + }
- + return convertToDxt1NoTransparency(bufferedimage);
- + }
- +
- + public static ByteBuffer convertToDxt1NoTransparency(BufferedImage bufferedimage)
- + {
- + if (bufferedimage == null)
- + {
- + return null;
- + }
- + int ai[] = new int[16];
- + int i = 128 + ((bufferedimage.getWidth() * bufferedimage.getHeight()) / 2);
- + ByteBuffer bytebuffer = ByteBuffer.allocate(i);
- + bytebuffer.order(ByteOrder.LITTLE_ENDIAN);
- + buildHeaderDxt1(bytebuffer, bufferedimage.getWidth(), bufferedimage.getHeight());
- + int j = bufferedimage.getWidth() / 4;
- + int k = bufferedimage.getHeight() / 4;
- + for (int l = 0; l < k; l++)
- + {
- + for (int i1 = 0; i1 < j; i1++)
- + {
- + BufferedImage bufferedimage1 = bufferedimage.getSubimage(i1 * 4, l * 4, 4, 4);
- + bufferedimage1.getRGB(0, 0, 4, 4, ai, 0, 4);
- + Color acolor[] = getColors888(ai);
- + for (int j1 = 0; j1 < ai.length; j1++)
- + {
- + ai[j1] = getPixel565(acolor[j1]);
- + acolor[j1] = getColor565(ai[j1]);
- + }
- +
- + int ai1[] = determineExtremeColors(acolor);
- + if (ai[ai1[0]] < ai[ai1[1]])
- + {
- + int k1 = ai1[0];
- + ai1[0] = ai1[1];
- + ai1[1] = k1;
- + }
- + bytebuffer.putShort((short) ai[ai1[0]]);
- + bytebuffer.putShort((short) ai[ai1[1]]);
- + long l1 = computeBitMask(acolor, ai1);
- + bytebuffer.putInt((int) l1);
- + }
- + }
- + return bytebuffer;
- + }
- +
- + public static ByteBuffer convertToDxt3(BufferedImage bufferedimage)
- + {
- + if (bufferedimage == null)
- + {
- + return null;
- + }
- + if (!bufferedimage.getColorModel().hasAlpha())
- + {
- + return convertToDxt1NoTransparency(bufferedimage);
- + }
- + int ai[] = new int[16];
- + int i = 128 + (bufferedimage.getWidth() * bufferedimage.getHeight());
- + ByteBuffer bytebuffer = ByteBuffer.allocate(i);
- + bytebuffer.order(ByteOrder.LITTLE_ENDIAN);
- + buildHeaderDxt3(bytebuffer, bufferedimage.getWidth(), bufferedimage.getHeight());
- + int j = bufferedimage.getWidth() / 4;
- + int k = bufferedimage.getHeight() / 4;
- + for (int l = 0; l < k; l++)
- + {
- + for (int i1 = 0; i1 < j; i1++)
- + {
- + BufferedImage bufferedimage1 = bufferedimage.getSubimage(i1 * 4, l * 4, 4, 4);
- + bufferedimage1.getRGB(0, 0, 4, 4, ai, 0, 4);
- + Color acolor[] = getColors888(ai);
- + for (int j1 = 0; j1 < ai.length; j1 += 2)
- + {
- + bytebuffer.put((byte) ((ai[j1] >>> 28) | (ai[j1 + 1] >>> 24)));
- + }
- +
- + for (int k1 = 0; k1 < ai.length; k1++)
- + {
- + ai[k1] = getPixel565(acolor[k1]);
- + acolor[k1] = getColor565(ai[k1]);
- + }
- +
- + int ai1[] = determineExtremeColors(acolor);
- + if (ai[ai1[0]] < ai[ai1[1]])
- + {
- + int l1 = ai1[0];
- + ai1[0] = ai1[1];
- + ai1[1] = l1;
- + }
- + bytebuffer.putShort((short) ai[ai1[0]]);
- + bytebuffer.putShort((short) ai[ai1[1]]);
- + long l2 = computeBitMask(acolor, ai1);
- + bytebuffer.putInt((int) l2);
- + }
- + }
- + return bytebuffer;
- + }
- +
- + protected static void buildHeaderDxt1(ByteBuffer bytebuffer, int i, int j)
- + {
- + bytebuffer.rewind();
- + bytebuffer.put((byte) 68);
- + bytebuffer.put((byte) 68);
- + bytebuffer.put((byte) 83);
- + bytebuffer.put((byte) 32);
- + bytebuffer.putInt(124);
- + int k = 0xa1007;
- + bytebuffer.putInt(k);
- + bytebuffer.putInt(j);
- + bytebuffer.putInt(i);
- + bytebuffer.putInt((i * j) / 2);
- + bytebuffer.putInt(0);
- + bytebuffer.putInt(0);
- + bytebuffer.position(bytebuffer.position() + 44);
- + bytebuffer.putInt(32);
- + bytebuffer.putInt(4);
- + bytebuffer.put((byte) 68);
- + bytebuffer.put((byte) 88);
- + bytebuffer.put((byte) 84);
- + bytebuffer.put((byte) 49);
- + bytebuffer.putInt(0);
- + bytebuffer.putInt(0);
- + bytebuffer.putInt(0);
- + bytebuffer.putInt(0);
- + bytebuffer.putInt(0);
- + bytebuffer.putInt(4096);
- + bytebuffer.putInt(0);
- + bytebuffer.position(bytebuffer.position() + 12);
- + }
- +
- + protected static void buildHeaderDxt3(ByteBuffer bytebuffer, int i, int j)
- + {
- + bytebuffer.rewind();
- + bytebuffer.put((byte) 68);
- + bytebuffer.put((byte) 68);
- + bytebuffer.put((byte) 83);
- + bytebuffer.put((byte) 32);
- + bytebuffer.putInt(124);
- + int k = 0xa1007;
- + bytebuffer.putInt(k);
- + bytebuffer.putInt(j);
- + bytebuffer.putInt(i);
- + bytebuffer.putInt(i * j);
- + bytebuffer.putInt(0);
- + bytebuffer.putInt(0);
- + bytebuffer.position(bytebuffer.position() + 44);
- + bytebuffer.putInt(32);
- + bytebuffer.putInt(4);
- + bytebuffer.put((byte) 68);
- + bytebuffer.put((byte) 88);
- + bytebuffer.put((byte) 84);
- + bytebuffer.put((byte) 51);
- + bytebuffer.putInt(0);
- + bytebuffer.putInt(0);
- + bytebuffer.putInt(0);
- + bytebuffer.putInt(0);
- + bytebuffer.putInt(0);
- + bytebuffer.putInt(4096);
- + bytebuffer.putInt(0);
- + bytebuffer.position(bytebuffer.position() + 12);
- + }
- +
- + protected static int[] determineExtremeColors(Color acolor[])
- + {
- + int i = 0x80000000;
- + int ai[] = new int[2];
- + for (int j = 0; j < (acolor.length - 1); j++)
- + {
- + for (int k = j + 1; k < acolor.length; k++)
- + {
- + int l = distance(acolor[j], acolor[k]);
- + if (l > i)
- + {
- + i = l;
- + ai[0] = j;
- + ai[1] = k;
- + }
- + }
- +
- + }
- + return ai;
- + }
- +
- + protected static long computeBitMask(Color acolor[], int ai[])
- + {
- + Color acolor1[] =
- + {
- + null,
- + null,
- + new Color(),
- + new Color()
- + };
- + acolor1[0] = acolor[ai[0]];
- + acolor1[1] = acolor[ai[1]];
- + if (acolor1[0].equals(acolor1[1]))
- + {
- + return 0L;
- + }
- + acolor1[2].r = ((2 * acolor1[0].r) + acolor1[1].r + 1) / 3;
- + acolor1[2].g = ((2 * acolor1[0].g) + acolor1[1].g + 1) / 3;
- + acolor1[2].b = ((2 * acolor1[0].b) + acolor1[1].b + 1) / 3;
- + acolor1[3].r = (acolor1[0].r + (2 * acolor1[1].r) + 1) / 3;
- + acolor1[3].g = (acolor1[0].g + (2 * acolor1[1].g) + 1) / 3;
- + acolor1[3].b = (acolor1[0].b + (2 * acolor1[1].b) + 1) / 3;
- + long l = 0L;
- + for (int i = 0; i < acolor.length; i++)
- + {
- + int j = 0x7fffffff;
- + int k = 0;
- + for (int i1 = 0; i1 < acolor1.length; i1++)
- + {
- + int j1 = distance(acolor[i], acolor1[i1]);
- + if (j1 < j)
- + {
- + j = j1;
- + k = i1;
- + }
- + }
- +
- + l |= k << (i * 2);
- + }
- + return l;
- + }
- +
- + protected static int getPixel565(Color color)
- + {
- + int i = color.r >> 3;
- + int j = color.g >> 2;
- + int k = color.b >> 3;
- + return (i << 11) | (j << 5) | k;
- + }
- +
- + protected static Color getColor565(int i)
- + {
- + Color color = new Color();
- + color.r = (int) (i & 63488L) >> 11;
- + color.g = (int) (i & 2016L) >> 5;
- + color.b = (int) (i & 31L);
- + return color;
- + }
- +
- + protected static Color[] getColors888(int ai[])
- + {
- + Color acolor[] = new Color[ai.length];
- + for (int i = 0; i < ai.length; i++)
- + {
- + acolor[i] = new Color();
- + acolor[i].r = (int) (ai[i] & 0xff0000L) >> 16;
- + acolor[i].g = (int) (ai[i] & 65280L) >> 8;
- + acolor[i].b = (int) (ai[i] & 255L);
- + }
- + return acolor;
- + }
- +
- + protected static int distance(Color color, Color color1)
- + {
- + return ((color1.r - color.r) * (color1.r - color.r)) + ((color1.g - color.g) * (color1.g - color.g)) + ((color1.b - color.b) * (color1.b - color.b));
- + }
- +}
- \ No newline at end of file
- Index: java/net/sf/l2j/gameserver/model/actor/instance/L2BufferArchiveInstance.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/model/actor/instance/L2BufferArchiveInstance.java (revision 0)
- +++ java/net/sf/l2j/gameserver/model/actor/instance/L2BufferArchiveInstance.java (working copy)
- @@ -0,0 +1,339 @@
- + /*
- + * This program is free software; you can redistribute it and/or modify
- + * it under the terms of the GNU General Public License as published by
- + * the Free Software Foundation; either version 2, or (at your option)
- + * any later version.
- + *
- + * This program is distributed in the hope that it will be useful,
- + * but WITHOUT ANY WARRANTY; without even the implied warranty of
- + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- + * GNU General Public License for more details.
- + *
- + * You should have received a copy of the GNU General Public License
- + * along with this program; if not, write to the Free Software
- + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- + * 02111-1307, USA.
- + *
- + * http://www.gnu.org/copyleft/gpl.html
- + */
- +package net.sf.l2j.gameserver.model.actor.instance;
- +
- +import java.io.File;
- +import java.util.StringTokenizer;
- +
- +import net.sf.l2j.Config;
- +import net.sf.l2j.gameserver.ai.CtrlIntention;
- +import net.sf.l2j.gameserver.datatables.SkillTable;
- +import net.sf.l2j.gameserver.model.L2Effect;
- +import net.sf.l2j.gameserver.model.actor.template.NpcTemplate;
- +import net.sf.l2j.gameserver.network.serverpackets.ActionFailed;
- +import net.sf.l2j.gameserver.network.serverpackets.MyTargetSelected;
- +import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage;
- +import net.sf.l2j.gameserver.network.serverpackets.PledgeCrest;
- +import net.sf.l2j.gameserver.network.serverpackets.ValidateLocation;
- +import net.sf.l2j.gameserver.network.serverpackets.MagicSkillUse;
- +import net.sf.l2j.gameserver.templates.skills.L2SkillType;
- +import net.sf.l2j.util.DDSConverter;
- +import net.sf.l2j.util.StringUtil;
- +
- +/**
- + * @author Elfocrash
- + */
- +public final class L2BufferArchiveInstance extends L2NpcInstance
- +{
- + public L2BufferArchiveInstance(int objectId, NpcTemplate template)
- + {
- + super(objectId, template);
- + }
- +
- + int state = 0;
- + @Override
- + public void onAction(L2PcInstance client)
- + {
- + if (this != client.getTarget())
- + {
- + client.setTarget(this);
- + client.sendPacket(new MyTargetSelected(getObjectId(), 0));
- + client.sendPacket(new ValidateLocation(this));
- + }
- + else
- + {
- + client.sendPacket(new MyTargetSelected(getObjectId(), 0));
- + client.getAI().setIntention(CtrlIntention.INTERACT, this);
- +
- + if (!isInsideRadius(client, 150, false, false))
- + client.sendPacket(ActionFailed.STATIC_PACKET);
- + else
- + showMessageWindow(client);
- + }
- + }
- +
- + @Override
- + public void onBypassFeedback(L2PcInstance client, String command)
- + {
- + if (!client.isDead())
- + {
- + StringTokenizer st = new StringTokenizer(command, " ");
- + String actualCommand = st.nextToken();
- +
- + int buffid = 0;
- + int bufflevel = 1;
- + if (st.countTokens() == 2)
- + {
- + buffid = Integer.valueOf(st.nextToken());
- + bufflevel = Integer.valueOf(st.nextToken());
- + }
- + else if (st.countTokens() == 1)
- + buffid = Integer.valueOf(st.nextToken());
- +
- + if (actualCommand.equalsIgnoreCase("getbuff"))
- + {
- + if (buffid != 0)
- + {
- + MagicSkillUse mgc = new MagicSkillUse(this, client, buffid, bufflevel, 500, 0);
- + SkillTable.getInstance().getInfo(buffid, bufflevel).getEffects(this, client);
- + showMessageWindow(client);
- + client.broadcastPacket(mgc);
- + }
- + }
- + else if (actualCommand.equalsIgnoreCase("restore"))
- + {
- + MagicSkillUse mgc = new MagicSkillUse(this, client, 1258, 4, 500, 0);
- + client.setCurrentHpMp(client.getMaxHp(), client.getMaxMp());
- + client.setCurrentCp(client.getMaxCp());
- + showMessageWindow(client);
- + client.broadcastPacket(mgc);
- + }
- + else if (actualCommand.equalsIgnoreCase("cancel"))
- + {
- + MagicSkillUse mgc = new MagicSkillUse(this, client, 1056, 12, 500, 0);
- + client.stopAllEffects();
- + showMessageWindow(client);
- + client.broadcastPacket(mgc);
- + }
- + else if (actualCommand.equalsIgnoreCase("setstate0"))
- + {
- + state = 0;
- + showMessageWindow(client);
- + }
- + else if (actualCommand.equalsIgnoreCase("setstate1"))
- + {
- + state = 1;
- + showMessageWindow(client);
- + }
- + else if (actualCommand.equalsIgnoreCase("setstate2"))
- + {
- + state = 2;
- + showMessageWindow(client);
- + }
- + else if (actualCommand.equalsIgnoreCase("setstate3"))
- + {
- + state = 3;
- + showMessageWindow(client);
- + }
- + else
- + super.onBypassFeedback(client, command);
- + }
- + }
- +
- + private static int getCurrentBuffs(L2PcInstance activechar)
- + {
- + int i = 0;
- +
- + for (L2Effect e : activechar.getAllEffects())
- + {
- + if (e.getSkill().getSkillType() == L2SkillType.BUFF)
- + i++;
- + }
- +
- + return i;
- + }
- +
- + private void showMessageWindow(L2PcInstance client)
- + {
- + NpcHtmlMessage html = new NpcHtmlMessage(1);
- + final StringBuilder sb = StringUtil.startAppend(3500, "<html><body>");
- + int imgId = 0;
- +
- + switch (getCurrentBuffs(client)) {
- + case 0: imgId = 20010;
- + generateLogo(client, 20010);
- + break;
- + case 1: imgId = 20011;
- + generateLogo(client, 20011);
- + break;
- + case 2: imgId = 20012;
- + generateLogo(client, 20012);
- + break;
- + case 3: imgId = 20013;
- + generateLogo(client, 20013);
- + break;
- + case 4: imgId = 20014;
- + generateLogo(client, 20014);
- + break;
- + case 5: imgId = 20015;
- + generateLogo(client, 20015);
- + break;
- + case 6: imgId = 20016;
- + generateLogo(client, 20016);
- + break;
- + case 7: imgId = 20017;
- + generateLogo(client, 20017);
- + break;
- + case 8: imgId = 20018;
- + generateLogo(client, 20018);
- + break;
- + case 9: imgId = 20019;
- + generateLogo(client, 20019);
- + break;
- + case 10: imgId = 20020;
- + generateLogo(client, 20020);
- + break;
- + case 11: imgId = 20021;
- + generateLogo(client, 20021);
- + break;
- + case 12: imgId = 20022;
- + generateLogo(client, 20022);
- + break;
- + case 13: imgId = 20023;
- + generateLogo(client, 20023);
- + break;
- + case 14: imgId = 20024;
- + generateLogo(client, 20024);
- + break;
- + case 15: imgId = 20025;
- + generateLogo(client, 20025);
- + break;
- + case 16: imgId = 20026;
- + generateLogo(client, 20026);
- + break;
- + case 17: imgId = 20027;
- + generateLogo(client, 20027);
- + break;
- + case 18: imgId = 20028;
- + generateLogo(client, 20028);
- + break;
- + case 19: imgId = 20029;
- + generateLogo(client, 20029);
- + break;
- + case 20: imgId = 20030;
- + generateLogo(client, 20030);
- + break;
- + case 21: imgId = 20031;
- + generateLogo(client, 20031);
- + break;
- + case 22: imgId = 20032;
- + generateLogo(client, 20032);
- + break;
- + case 23: imgId = 20033;
- + generateLogo(client, 20033);
- + break;
- + case 24: imgId = 20034;
- + generateLogo(client, 20034);
- + break;
- + default: imgId = 20034;
- + generateLogo(client, 20034);
- + break;
- + }
- +
- +
- + sb.append("<center><font color=\"FF9900\">AIO Buffer Laena</font></center>");
- +
- + sb.append("<table width=\"256\" cellpadding=\"5\" bgcolor=\"000000\"><tr><td><img src=\"Crest.crest_" + Config.SERVER_ID + "_" + imgId + "\" width=256 height=16></td></tr></table>");
- +
- + if(state ==0)
- + {
- + sb.append("<br><center><font color=\"FF9900\">Buffs</font></center><table width=\"256\" cellpadding=\"5\">");
- + sb.append("<tr><td><button action=\"bypass npc_" + getObjectId() + "_getbuff 1204 130\" width=32 height=32 back=\"icon.skill1204\" fore=\"icon.skill1204\"></td>");
- + sb.append("<td><button action=\"bypass npc_" + getObjectId() + "_getbuff 1040 130\" width=32 height=32 back=\"icon.skill1040\" fore=\"icon.skill1040\"></td>");
- + sb.append("<td><button action=\"bypass npc_" + getObjectId() + "_getbuff 1068 130\" width=32 height=32 back=\"icon.skill1068\" fore=\"icon.skill1068\"></td>");
- + sb.append("<td><button action=\"bypass npc_" + getObjectId() + "_getbuff 1036 130\" width=32 height=32 back=\"icon.skill1036\" fore=\"icon.skill1036\"></td><");
- + sb.append("<td><button action=\"bypass npc_" + getObjectId() + "_getbuff 1035 130\" width=32 height=32 back=\"icon.skill1035\" fore=\"icon.skill1035\"></td></tr>");
- + sb.append("<tr><td><button action=\"bypass npc_" + getObjectId() + "_getbuff 1045 130\" width=32 height=32 back=\"icon.skill1045\" fore=\"icon.skill1045\"></td>");
- + sb.append("<td><button action=\"bypass npc_" + getObjectId() + "_getbuff 1048 130\" width=32 height=32 back=\"icon.skill1048\" fore=\"icon.skill1048\"></td>");
- + sb.append("<td><button action=\"bypass npc_" + getObjectId() + "_getbuff 1062 130\" width=32 height=32 back=\"icon.skill1062\" fore=\"icon.skill1062\"></td>");
- + sb.append("<td><button action=\"bypass npc_" + getObjectId() + "_getbuff 1086 130\" width=32 height=32 back=\"icon.skill1086\" fore=\"icon.skill1086\"></td>");
- + sb.append("<td><button action=\"bypass npc_" + getObjectId() + "_getbuff 1240 130\" width=32 height=32 back=\"icon.skill1240\" fore=\"icon.skill1240\"></td></tr>");
- + sb.append("<tr><td><button action=\"bypass npc_" + getObjectId() + "_getbuff 1242 130\" width=32 height=32 back=\"icon.skill1242\" fore=\"icon.skill1242\"></td>");
- + sb.append("<td><button action=\"bypass npc_" + getObjectId() + "_getbuff 1077 130\" width=32 height=32 back=\"icon.skill1077\" fore=\"icon.skill1077\"></td>");
- + sb.append("<td><button action=\"bypass npc_" + getObjectId() + "_getbuff 1268 130\" width=32 height=32 back=\"icon.skill1268\" fore=\"icon.skill1268\"></td>");
- + sb.append("<td><button action=\"bypass npc_" + getObjectId() + "_getbuff 1087 130\" width=32 height=32 back=\"icon.skill1087\" fore=\"icon.skill1087\"></td>");
- + sb.append("<td><button action=\"bypass npc_" + getObjectId() + "_getbuff 1085 130\" width=32 height=32 back=\"icon.skill1085\" fore=\"icon.skill1085\"></td></tr>");
- + sb.append("<tr><td><button action=\"bypass npc_" + getObjectId() + "_getbuff 1059 130\" width=32 height=32 back=\"icon.skill1059\" fore=\"icon.skill1059\"></td>");
- + sb.append("<td><button action=\"bypass npc_" + getObjectId() + "_getbuff 1303 130\" width=32 height=32 back=\"icon.skill1303\" fore=\"icon.skill1303\"></td>");
- + sb.append("<td><button action=\"bypass npc_" + getObjectId() + "_getbuff 1078 130\" width=32 height=32 back=\"icon.skill1078\" fore=\"icon.skill1078\"></td>");
- + sb.append("<td><button action=\"bypass npc_" + getObjectId() + "_getbuff 1243 130\" width=32 height=32 back=\"icon.skill1243\" fore=\"icon.skill1243\"></td>");
- + sb.append("<td><button action=\"bypass npc_" + getObjectId() + "_getbuff 1259 130\" width=32 height=32 back=\"icon.skill1259\" fore=\"icon.skill1259\"></td></tr>"
- + + "<tr><td><button action=\"bypass npc_" + getObjectId() + "_getbuff 1304 130\" width=32 height=32 back=\"icon.skill1304\" fore=\"icon.skill1304\"></td></tr></table>");
- + }
- + else
- + sb.append("<br><center><a action=\"bypass npc_%objectId%_setstate0\">Buffs [+]</a></center>");
- +
- +
- + if(state == 1)
- + {
- + sb.append("<center><font color=\"FF9900\">Dances</font></center><table width=\"200\" cellpadding=\"5\">");
- + sb.append("<tr><td><button action=\"bypass npc_" + getObjectId() + "_getbuff 271 130\" width=32 height=32 back=\"icon.skill0271\" fore=\"icon.skill0271\"></td>");
- + sb.append("<td><button action=\"bypass npc_" + getObjectId() + "_getbuff 274 130\" width=32 height=32 back=\"icon.skill0274\" fore=\"icon.skill0274\"></td>");
- + sb.append("<td><button action=\"bypass npc_" + getObjectId() + "_getbuff 275 130\" width=32 height=32 back=\"icon.skill0275\" fore=\"icon.skill0275\"></td>");
- + sb.append("<td><button action=\"bypass npc_" + getObjectId() + "_getbuff 272 130\" width=32 height=32 back=\"icon.skill0272\" fore=\"icon.skill0272\"></td></tr>");
- + sb.append("<tr><td><button action=\"bypass npc_" + getObjectId() + "_getbuff 310 130\" width=32 height=32 back=\"icon.skill0310\" fore=\"icon.skill0310\"></td>");
- + sb.append("<td><button action=\"bypass npc_" + getObjectId() + "_getbuff 273 130\" width=32 height=32 back=\"icon.skill0273\" fore=\"icon.skill0273\"></td>");
- + sb.append("<td><button action=\"bypass npc_" + getObjectId() + "_getbuff 276 130\" width=32 height=32 back=\"icon.skill0276\" fore=\"icon.skill0276\"></td>");
- + sb.append("<td><button action=\"bypass npc_" + getObjectId() + "_getbuff 277 130\" width=32 height=32 back=\"icon.skill0277\" fore=\"icon.skill0277\"></td></tr></table>");
- + }
- + else
- + sb.append("<br><center><a action=\"bypass npc_%objectId%_setstate1\">Dances [+]</a></center>");
- +
- + if(state == 2)
- + {
- + sb.append("<center><font color=\"FF9900\">Songs</font></center><table width=\"200\" cellpadding=\"5\">");
- + sb.append("<tr><td><button action=\"bypass npc_" + getObjectId() + "_getbuff 264 130\" width=32 height=32 back=\"icon.skill0264\" fore=\"icon.skill0264\"></td>");
- + sb.append("<td><button action=\"bypass npc_" + getObjectId() + "_getbuff 304 130\" width=32 height=32 back=\"icon.skill0304\" fore=\"icon.skill0304\"></td>");
- + sb.append("<td><button action=\"bypass npc_" + getObjectId() + "_getbuff 268 130\" width=32 height=32 back=\"icon.skill0268\" fore=\"icon.skill0268\"></td>");
- + sb.append("<td><button action=\"bypass npc_" + getObjectId() + "_getbuff 267 130\" width=32 height=32 back=\"icon.skill0267\" fore=\"icon.skill0267\"></td></tr>");
- + sb.append("<tr><td><button action=\"bypass npc_" + getObjectId() + "_getbuff 266 130\" width=32 height=32 back=\"icon.skill0266\" fore=\"icon.skill0266\"></td>");
- + sb.append("<td><button action=\"bypass npc_" + getObjectId() + "_getbuff 269 130\" width=32 height=32 back=\"icon.skill0269\" fore=\"icon.skill0269\"></td>");
- + sb.append("<td><button action=\"bypass npc_" + getObjectId() + "_getbuff 265 130\" width=32 height=32 back=\"icon.skill0265\" fore=\"icon.skill0265\"></td>");
- + sb.append("<td><button action=\"bypass npc_" + getObjectId() + "_getbuff 270 130\" width=32 height=32 back=\"icon.skill0270\" fore=\"icon.skill0270\"></td></tr></table>");
- + }
- + else
- + sb.append("<br><center><a action=\"bypass npc_%objectId%_setstate2\">Song [+]</a></center>");
- +
- + if(state == 3)
- + {
- + sb.append("<center><font color=\"FF9900\">Restore/Cancel</font></center><table width=\"100\" cellpadding=\"5\">");
- + sb.append("<tr><td><button action=\"bypass npc_" + getObjectId() + "_restore\" width=32 height=32 back=\"icon.skill0058\" fore=\"icon.skill0058\"></td>");
- + sb.append("<td><button action=\"bypass npc_" + getObjectId() + "_cancel\" width=32 height=32 back=\"icon.skill1056\" fore=\"icon.skill1056\"></td></tr>");
- + }
- + else
- + sb.append("<br><center><a action=\"bypass npc_%objectId%_setstate3\">Restore/Cancel [+]</a></center>");
- +
- + // sb.append("</table>");
- +
- +
- + sb.append("</body></html>");
- +
- + html.setHtml(sb.toString());
- + html.replace("%objectId%", String.valueOf(getObjectId()));
- + html.replace("%charname%", client.getName());
- + client.sendPacket(html);
- + }
- +
- + public static void generateLogo(L2PcInstance activeChar, int imgId)
- + {
- + try
- + {
- +
- + File captcha = new File("data/images/"+imgId+".png");
- + PledgeCrest packet = new PledgeCrest(imgId, DDSConverter.convertToDDS(captcha).array());
- + activeChar.sendPacket(packet);
- +
- + }
- + catch (Exception e)
- + {
- + }
- +
- + }
- +
- +}
- \ No newline at end of file
- Index: java/net/sf/l2j/gameserver/network/serverpackets/PledgeCrest.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/network/serverpackets/PledgeCrest.java (revision 65)
- +++ java/net/sf/l2j/gameserver/network/serverpackets/PledgeCrest.java (working copy)
- @@ -3,42 +3,36 @@
- * the terms of the GNU General Public License as published by the Free Software
- * Foundation, either version 3 of the License, or (at your option) any later
- * version.
- - *
- + *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- - *
- + *
- * You should have received a copy of the GNU General Public License along with
- * this program. If not, see <http://www.gnu.org/licenses/>.
- */
- package net.sf.l2j.gameserver.network.serverpackets;
- -import net.sf.l2j.gameserver.cache.CrestCache;
- -import net.sf.l2j.gameserver.cache.CrestCache.CrestType;
- -
- public class PledgeCrest extends L2GameServerPacket
- {
- - private final int _crestId;
- - private final byte[] _data;
- -
- - public PledgeCrest(int crestId)
- - {
- - _crestId = crestId;
- - _data = CrestCache.getCrest(CrestType.PLEDGE, _crestId);
- - }
- -
- - @Override
- - protected final void writeImpl()
- - {
- - writeC(0x6c);
- - writeD(_crestId);
- - if (_data != null)
- - {
- - writeD(_data.length);
- - writeB(_data);
- - }
- - else
- - writeD(0);
- - }
- + private final int _crestId;
- + private final byte[] _data;
- + private final int _crestSize;
- +
- + public PledgeCrest(int crestId, byte[] data)
- + {
- + _crestId = crestId;
- + _data = data;
- + _crestSize = _data.length;
- + }
- +
- + @Override
- + protected final void writeImpl()
- + {
- + writeC(0x6c);
- + writeD(_crestId);
- + writeD(_crestSize);
- + writeB(_data);
- + }
- }
- \ No newline at end of file
- Index: java/net/sf/l2j/gameserver/network/clientpackets/RequestPledgeCrest.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/network/clientpackets/RequestPledgeCrest.java (revision 65)
- +++ java/net/sf/l2j/gameserver/network/clientpackets/RequestPledgeCrest.java (working copy)
- @@ -3,38 +3,66 @@
- * the terms of the GNU General Public License as published by the Free Software
- * Foundation, either version 3 of the License, or (at your option) any later
- * version.
- - *
- + *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- - *
- + *
- * You should have received a copy of the GNU General Public License along with
- * this program. If not, see <http://www.gnu.org/licenses/>.
- */
- package net.sf.l2j.gameserver.network.clientpackets;
- +import java.util.logging.Logger;
- +
- +import net.sf.l2j.Config;
- +import net.sf.l2j.gameserver.cache.CrestCache;
- +import net.sf.l2j.gameserver.cache.CrestCache.CrestType;
- import net.sf.l2j.gameserver.network.serverpackets.PledgeCrest;
- public final class RequestPledgeCrest extends L2GameClientPacket
- {
- - private int _crestId;
- -
- - @Override
- - protected void readImpl()
- - {
- - _crestId = readD();
- - }
- -
- - @Override
- - protected void runImpl()
- - {
- - sendPacket(new PledgeCrest(_crestId));
- - }
- -
- - @Override
- - protected boolean triggersOnActionRequest()
- - {
- - return false;
- - }
- + private static Logger _log = Logger.getLogger(RequestPledgeCrest.class.getName());
- + private int _crestId;
- +
- + @Override
- + protected void readImpl()
- + {
- + _crestId = readD();
- + }
- +
- + @Override
- + protected void runImpl()
- + {
- + if (_crestId == 0)
- + {
- + return;
- + }
- + if (Config.DEBUG)
- + {
- + _log.fine("crestid " + _crestId + " requested");
- + }
- +
- + byte[] data = CrestCache.getCrest(CrestType.PLEDGE, _crestId);
- +
- + if (data != null)
- + {
- + PledgeCrest pc = new PledgeCrest(_crestId, data);
- + sendPacket(pc);
- + }
- + else
- + {
- + if (Config.DEBUG)
- + {
- + _log.fine("crest is missing:" + _crestId);
- + }
- + }
- + }
- +
- + @Override
- + protected boolean triggersOnActionRequest()
- + {
- + return false;
- + }
- }
- \ No newline at end of file
Add Comment
Please, Sign In to add comment