Noticias:

Debes de estar registrado para poder ver el contenido indicado. Registrate o Conectate

Menú Principal

Npc Poly Morph

Iniciado por Swarlog, Ago 19, 2022, 12:37 AM

Tema anterior - Siguiente tema

Swarlog

CitarCORE:

Index: D:/eclipse/workspace/L2_GameServer_It/java/net/sf/l2j/gameserver/model/L2MaxPolyModel.java
===================================================================
--- D:/eclipse/workspace/L2_GameServer_It/java/net/sf/l2j/gameserver/model/L2MaxPolyModel.java (revision 0)
+++ D:/eclipse/workspace/L2_GameServer_It/java/net/sf/l2j/gameserver/model/L2MaxPolyModel.java (revision 0)
@@ -0,0 +1,518 @@
+/* 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;
+
+import net.sf.l2j.gameserver.datatables.ArmorSetsTable;
+import net.sf.l2j.gameserver.datatables.CharTemplateTable;
+import net.sf.l2j.gameserver.datatables.ClanTable;
+import net.sf.l2j.gameserver.datatables.ArmorSetsTable.ArmorDummy;
+import net.sf.l2j.gameserver.model.base.Race;
+import net.sf.l2j.gameserver.templates.StatsSet;
+
+/**
+ *
+ * @author Velvet
+ */
+public class L2MaxPolyModel
+{
+ // Base
+ private String _name;
+ private String _title;
+ private Race _race;
+ private int _sex;
+ private int _hair;
+ private int _hairColor;
+ private int _face;
+ private int _classId;
+ private int _npcId;
+            
+ // Item related
+ private int _weaponIdRH;
+ private int _weaponIdLH;
+ private int _weaponIdEnc;
+ private int _armorId; // all others p_dolls will be set auto if the value is a valid armor set id
+ private int _head; // not seen
+ private int _hats;
+ private int _faces;
+ private int _chest;
+ private int _legs;
+ private int _gloves;
+ private int _feet;
+
+ // Misc
+ private int _abnormalEffect;
+ private int _pvpFlag;
+ private int _karma;
+ private int _recom;
+ private L2Clan _clan;
+ private int _isHero;
+ private int _pledge;
+ private int _nameColor = 0xFFFFFF;
+ private int _titleColor = 0xFFFF77;
+
+ public L2MaxPolyModel(StatsSet data)
+ {
+ _name = data.getString("name");
+ _title = data.getString("title");
+ _sex = data.getInteger("sex");
+ _hair = data.getInteger("hair");
+ _hairColor = data.getInteger("hairColor");
+ _face = data.getInteger("face");
+ _classId = data.getInteger("classId");
+ _npcId = data.getInteger("npcId");
+ _weaponIdRH = data.getInteger("weaponIdRH");
+ _weaponIdLH = data.getInteger("weaponIdLH");
+ _weaponIdEnc = data.getInteger("weaponIdEnc");
+ _armorId = data.getInteger("armorId");
+ _head = data.getInteger("head");
+ _hats = data.getInteger("hats");
+ _faces = data.getInteger("faces");
+ _chest = data.getInteger("chest");
+ _legs = data.getInteger("legs");
+ _gloves = data.getInteger("gloves");
+ _feet = data.getInteger("feet");
+ _abnormalEffect = data.getInteger("abnormalEffect");
+ _pvpFlag = data.getInteger("pvpFlag");
+ _karma = data.getInteger("karma");
+ _recom = data.getInteger("recom");
+ _clan = ClanTable.getInstance().getClan(data.getInteger("clan"));
+ _isHero = data.getInteger("isHero");
+ _pledge = data.getInteger("pledge");
+
+ if(data.getInteger("nameColor") > 0)
+ _nameColor = data.getInteger("nameColor");
+ if(data.getInteger("titleColor") > 0)
+ _titleColor = data.getInteger("titleColor");
+
+ _race = CharTemplateTable.getInstance().getTemplate(_classId).race;
+
+ ArmorDummy armor = ArmorSetsTable.getInstance().getCusArmorSets(_armorId);
+
+ if(armor != null)
+ {
+ _head = armor.getHead();
+ _chest = armor.getChest();
+ _legs = armor.getLegs();
+ _gloves = armor.getGloves();
+ _feet = armor.getFeet();
+ }
+ }
+
+ /**
+ * @return Returns the name.
+ */
+ public String getName()
+ {
+ return _name;
+ }
+ /**
+ * @param name The name to set.
+ */
+ public void setName(String name)
+ {
+ _name = name;
+ }
+ /**
+ * @return Returns the title.
+ */
+ public String getTitle()
+ {
+ return _title;
+ }
+ /**
+ * @param title The title to set.
+ */
+ public void setTitle(String title)
+ {
+ _title = title;
+ }
+ /**
+ * @return Returns the sex.
+ */
+ public int getSex()
+ {
+ return _sex;
+ }
+ /**
+ * @param sex The sex to set.
+ */
+ public void setSex(int sex)
+ {
+ _sex = sex;
+ }
+ /**
+ * @return Returns the hair.
+ */
+ public int getHair()
+ {
+ return _hair;
+ }
+ /**
+ * @param hair The hair to set.
+ */
+ public void setHair(int hair)
+ {
+ _hair = hair;
+ }
+ /**
+ * @return Returns the hairColor.
+ */
+ public int getHairColor()
+ {
+ return _hairColor;
+ }
+ /**
+ * @param hairColor The hairColor to set.
+ */
+ public void setHairColor(int hairColor)
+ {
+ _hairColor = hairColor;
+ }
+ /**
+ * @return Returns the face.
+ */
+ public int getFace()
+ {
+ return _face;
+ }
+ /**
+ * @param face The face to set.
+ */
+ public void setFace(int face)
+ {
+ _face = face;
+ }
+ /**
+ * @return Returns the classId.
+ */
+ public int getClassId()
+ {
+ return _classId;
+ }
+ /**
+ * @param classId The classId to set.
+ */
+ public void setClassId(int classId)
+ {
+ _classId = classId;
+ }
+
+ /**
+ * @return Returns the weaponIdRH.
+ */
+ public int getWeaponIdRH()
+ {
+ return _weaponIdRH;
+ }
+
+ /**
+ * @return Returns the weaponIdRH.
+ */
+ public int getWeaponIdLH()
+ {
+ return _weaponIdLH;
+ }
+
+ /**
+ * @param weaponIdRH The weaponIdRH to set.
+ */
+ public void setWeaponIdRH(int weaponIdRH)
+ {
+ _weaponIdRH = weaponIdRH;
+ }
+
+ public void setWeaponIdLH(int weaponIdLH)
+ {
+ _weaponIdLH = weaponIdLH;
+ }
+
+ /**
+ * @return Returns the weaponIdEnc.
+ */
+ public int getWeaponIdEnc()
+ {
+ return _weaponIdEnc;
+ }
+ /**
+ * @param weaponIdEnc The weaponIdEnc to set.
+ */
+ public void setWeaponIdEnc(int weaponIdEnc)
+ {
+ _weaponIdEnc = weaponIdEnc;
+ }
+ /**
+ * @return Returns the armorId.
+ */
+ public int getArmorId()
+ {
+ return _armorId;
+ }
+ /**
+ * @param armorId The armorId to set.
+ */
+ public void setArmorId(int armorId)
+ {
+ _armorId = armorId;
+ }
+ /**
+ * @return Returns the head.
+ */
+ public int getHead()
+ {
+ return _head;
+ }
+ /**
+ * @param head The head to set.
+ */
+ public void setHead(int head)
+ {
+ _head = head;
+ }
+ /**
+ * @return Returns the hats.
+ */
+ public int getHats()
+ {
+ return _hats;
+ }
+ /**
+ * @param hats The hats to set.
+ */
+ public void setHats(int hats)
+ {
+ _hats = hats;
+ }
+ /**
+ * @return Returns the faces.
+ */
+ public int getFaces()
+ {
+ return _faces;
+ }
+ /**
+ * @param faces The faces to set.
+ */
+ public void setFaces(int faces)
+ {
+ _faces = faces;
+ }
+ /**
+ * @return Returns the chest.
+ */
+ public int getChest()
+ {
+ return _chest;
+ }
+ /**
+ * @param chest The chest to set.
+ */
+ public void setChest(int chest)
+ {
+ _chest = chest;
+ }
+ /**
+ * @return Returns the legs.
+ */
+ public int getLegs()
+ {
+ return _legs;
+ }
+ /**
+ * @param legs The legs to set.
+ */
+ public void setLegs(int legs)
+ {
+ _legs = legs;
+ }
+ /**
+ * @return Returns the gloves.
+ */
+ public int getGloves()
+ {
+ return _gloves;
+ }
+ /**
+ * @param gloves The gloves to set.
+ */
+ public void setGloves(int gloves)
+ {
+ _gloves = gloves;
+ }
+ /**
+ * @return Returns the feet.
+ */
+ public int getFeet()
+ {
+ return _feet;
+ }
+ /**
+ * @param feet The feet to set.
+ */
+ public void setFeet(int feet)
+ {
+ _feet = feet;
+ }
+ /**
+ * @return Returns the abnormalEffect.
+ */
+ public int getAbnormalEffect()
+ {
+ return _abnormalEffect;
+ }
+ /**
+ * @param abnormalEffect The abnormalEffect to set.
+ */
+ public void setAbnormalEffect(int abnormalEffect)
+ {
+ _abnormalEffect = abnormalEffect;
+ }
+ /**
+ * @return Returns the pvpFlag.
+ */
+ public int getPvpFlag()
+ {
+ return _pvpFlag;
+ }
+ /**
+ * @param pvpFlag The pvpFlag to set.
+ */
+ public void setPvpFlag(int pvpFlag)
+ {
+ _pvpFlag = pvpFlag;
+ }
+ /**
+ * @return Returns the karma.
+ */
+ public int getKarma()
+ {
+ return _karma;
+ }
+ /**
+ * @param karma The karma to set.
+ */
+ public void setKarma(int karma)
+ {
+ _karma = karma;
+ }
+ /**
+ * @return Returns the recom.
+ */
+ public int getRecom()
+ {
+ return _recom;
+ }
+ /**
+ * @param recom The recom to set.
+ */
+ public void setRecom(int recom)
+ {
+ _recom = recom;
+ }
+ /**
+ * @return Returns the clan.
+ */
+ public L2Clan getClan()
+ {
+ return _clan;
+ }
+ /**
+ * @param clan The clan to set.
+ */
+ public void setClan(L2Clan clan)
+ {
+ _clan = clan;
+ }
+ /**
+ * @return Returns the isHero.
+ */
+ public int getIsHero()
+ {
+ return _isHero;
+ }
+ /**
+ * @param isHero The isHero to set.
+ */
+ public void setIsHero(int isHero)
+ {
+ _isHero = isHero;
+ }
+ /**
+ * @return Returns the pledge.
+ */
+ public int getPledge()
+ {
+ return _pledge;
+ }
+ /**
+ * @param pledge The pledge to set.
+ */
+ public void setPledge(int pledge)
+ {
+ _pledge = pledge;
+ }
+ /**
+ * @return Returns the nameColor.
+ */
+ public int getNameColor()
+ {
+ return _nameColor;
+ }
+ /**
+ * @param nameColor The nameColor to set.
+ */
+ public void setNameColor(int nameColor)
+ {
+ _nameColor = nameColor;
+ }
+ /**
+ * @return Returns the titleColor.
+ */
+ public int getTitleColor()
+ {
+ return _titleColor;
+ }
+ /**
+ * @param titleColor The titleColor to set.
+ */
+ public void setTitleColor(int titleColor)
+ {
+ _titleColor = titleColor;
+ }
+
+ /**
+ * @param npcId The npcId to set.
+ */
+ public void setNpcId(int npcId)
+ {
+ _npcId = npcId;
+ }
+
+ /**
+ * @return Returns the npcId.
+ */
+ public int getNpcId()
+ {
+ return _npcId;
+ }
+
+ public Race getRace()
+ {
+ return _race;
+ }
+
+}
Index: D:/eclipse/workspace/L2_GameServer_It/java/net/sf/l2j/gameserver/model/actor/instance/L2NpcInstance.java
===================================================================
--- D:/eclipse/workspace/L2_GameServer_It/java/net/sf/l2j/gameserver/model/actor/instance/L2NpcInstance.java (revision 4034)
+++ D:/eclipse/workspace/L2_GameServer_It/java/net/sf/l2j/gameserver/model/actor/instance/L2NpcInstance.java (working copy)
@@ -32,9 +32,11 @@
 import net.sf.l2j.gameserver.ThreadPoolManager;
 import net.sf.l2j.gameserver.ai.CtrlIntention;
 import net.sf.l2j.gameserver.cache.HtmCache;
+import net.sf.l2j.gameserver.datatables.CharTemplateTable;
 import net.sf.l2j.gameserver.datatables.ClanTable;
 import net.sf.l2j.gameserver.datatables.HelperBuffTable;
 import net.sf.l2j.gameserver.datatables.ItemTable;
+import net.sf.l2j.gameserver.datatables.MaxCheatersTable;
 import net.sf.l2j.gameserver.datatables.SkillTable;
 import net.sf.l2j.gameserver.datatables.SpawnTable;
 import net.sf.l2j.gameserver.idfactory.IdFactory;
@@ -49,6 +51,7 @@
 import net.sf.l2j.gameserver.model.L2DropCategory;
 import net.sf.l2j.gameserver.model.L2DropData;
 import net.sf.l2j.gameserver.model.L2ItemInstance;
+import net.sf.l2j.gameserver.model.L2MaxPolyModel;
 import net.sf.l2j.gameserver.model.L2Multisell;
 import net.sf.l2j.gameserver.model.L2Object;
 import net.sf.l2j.gameserver.model.L2Skill;
@@ -127,6 +130,8 @@
 
     private int _isSpoiledBy = 0;
 
+    private final L2MaxPolyModel _mxcModel;
+   
     protected RandomAnimationTask _rAniTask = null;
     private int _currentLHandId;  // normally this shouldn't change from the template, but there exist exceptions
     private int _currentRHandId;  // normally this shouldn't change from the template, but there exist exceptions
@@ -270,6 +275,21 @@
         _currentCollisionHeight = getTemplate().collisionHeight;
         _currentCollisionRadius = getTemplate().collisionRadius;
         
+        // Velvet - MxC
+        _mxcModel = MaxCheatersTable.getInstance().getModelForID(template.npcId);
+
+        if(_mxcModel != null) // Lil Config xD
+        {
+         _currentCollisionHeight = CharTemplateTable.getInstance().getTemplate(_mxcModel.getClassId()).collisionHeight;
+         _currentCollisionRadius = CharTemplateTable.getInstance().getTemplate(_mxcModel.getClassId()).collisionRadius;
+
+         if(_mxcModel.getWeaponIdRH() <= 0 && _mxcModel.getWeaponIdLH() <= 0)
+ {
+ _mxcModel.setWeaponIdRH(template.rhand);
+ _mxcModel.setWeaponIdLH(template.lhand);
+ }
+        }
+
         if (template == null)
         {
             _log.severe("No template for Npc. Please check your datapack is setup correctly.");
@@ -278,7 +298,6 @@
 
         // Set the name of the L2Character
         setName(template.name);
-
     }
 
     @Override
@@ -2283,4 +2302,9 @@
     {
      return _currentCollisionRadius;
     }
+
+    public L2MaxPolyModel getMxcPoly()
+    {
+    return _mxcModel;
+    }
 }
Index: D:/eclipse/workspace/L2_GameServer_It/java/net/sf/l2j/gameserver/GameServer.java
===================================================================
--- D:/eclipse/workspace/L2_GameServer_It/java/net/sf/l2j/gameserver/GameServer.java (revision 4034)
+++ D:/eclipse/workspace/L2_GameServer_It/java/net/sf/l2j/gameserver/GameServer.java (working copy)
@@ -48,6 +48,7 @@
 import net.sf.l2j.gameserver.datatables.ItemTable;
 import net.sf.l2j.gameserver.datatables.LevelUpData;
 import net.sf.l2j.gameserver.datatables.MapRegionTable;
+import net.sf.l2j.gameserver.datatables.MaxCheatersTable;
 import net.sf.l2j.gameserver.datatables.NobleSkillTable;
 import net.sf.l2j.gameserver.datatables.NpcTable;
 import net.sf.l2j.gameserver.datatables.NpcWalkerRoutesTable;
@@ -393,6 +394,7 @@
  TeleportLocationTable.getInstance();
  LevelUpData.getInstance();
  L2World.getInstance();
+ MaxCheatersTable.getInstance();
  ZoneData.getInstance();
         SpawnTable.getInstance();
         RaidBossSpawnManager.getInstance();
Index: D:/eclipse/workspace/L2_GameServer_It/java/net/sf/l2j/gameserver/serverpackets/MxCPolyInfo.java
===================================================================
--- D:/eclipse/workspace/L2_GameServer_It/java/net/sf/l2j/gameserver/serverpackets/MxCPolyInfo.java (revision 0)
+++ D:/eclipse/workspace/L2_GameServer_It/java/net/sf/l2j/gameserver/serverpackets/MxCPolyInfo.java (revision 0)
@@ -0,0 +1,158 @@
+/*
+ * 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.serverpackets;
+
+import net.sf.l2j.gameserver.model.actor.instance.L2NpcInstance;
+
+/**
+ *
+ * @author Velvet
+ */
+public class MxCPolyInfo extends L2GameServerPacket
+{
+ private L2NpcInstance _activeChar;
+ private int _x, _y, _z, _heading;
+ private int _runSpd, _walkSpd, _swimRunSpd, _swimWalkSpd, _flRunSpd, _flWalkSpd, _flyRunSpd, _flyWalkSpd;
+ private float _moveMultiplier;
+ private int _maxCp;
+
+ public MxCPolyInfo(L2NpcInstance cha)
+ {
+ _activeChar = cha;
+ _x = _activeChar.getX();
+ _y = _activeChar.getY();
+ _z = _activeChar.getZ();
+ _heading = _activeChar.getHeading();
+ _moveMultiplier = _activeChar.getMovementSpeedMultiplier();
+ _runSpd = (int) (_activeChar.getRunSpeed() / _moveMultiplier);
+ _walkSpd = (int) (_activeChar.getWalkSpeed() / _moveMultiplier);
+ _swimRunSpd = _flRunSpd = _flyRunSpd = _runSpd;
+ _swimWalkSpd = _flWalkSpd = _flyWalkSpd = _walkSpd;
+ _maxCp = _activeChar.getMaxCp();
+ }
+
+ @Override
+ protected final void writeImpl()
+ {
+ writeC(0x03);
+ writeD(_x);
+ writeD(_y);
+ writeD(_z);
+ writeD(_heading);
+ writeD(_activeChar.getObjectId());
+ writeS(_activeChar.getMxcPoly().getName());
+ writeD(_activeChar.getMxcPoly().getRace().ordinal());
+ writeD(_activeChar.getMxcPoly().getSex());
+ writeD(_activeChar.getMxcPoly().getClassId());
+ writeD(_activeChar.getMxcPoly().getHats());
+ writeD(_activeChar.getMxcPoly().getHead());
+ writeD(_activeChar.getMxcPoly().getWeaponIdRH());
+ writeD(_activeChar.getMxcPoly().getWeaponIdLH());
+ writeD(_activeChar.getMxcPoly().getGloves());
+ writeD(_activeChar.getMxcPoly().getChest());
+ writeD(_activeChar.getMxcPoly().getLegs());
+ writeD(_activeChar.getMxcPoly().getFeet());
+ writeD(_activeChar.getMxcPoly().getHats());
+ writeD(_activeChar.getMxcPoly().getWeaponIdRH());
+ writeD(_activeChar.getMxcPoly().getHats());
+ writeD(_activeChar.getMxcPoly().getFaces());
+ write('H', 0, 24);
+ writeD(_activeChar.getMxcPoly().getPvpFlag());
+ writeD(_activeChar.getMxcPoly().getKarma());
+ writeD(_activeChar.getMAtkSpd());
+ writeD(_activeChar.getPAtkSpd());
+ writeD(_activeChar.getMxcPoly().getPvpFlag());
+ writeD(_activeChar.getMxcPoly().getKarma());
+ writeD(_runSpd);
+ writeD(_walkSpd);
+ writeD(_swimRunSpd);
+ writeD(_swimWalkSpd);
+ writeD(_flRunSpd);
+ writeD(_flWalkSpd);
+ writeD(_flyRunSpd);
+ writeD(_flyWalkSpd);
+ writeF(_activeChar.getMovementSpeedMultiplier());
+ writeF(_activeChar.getAttackSpeedMultiplier());
+ writeF(_activeChar.getCollisionRadius());
+ writeF(_activeChar.getCollisionHeight());
+ writeD(_activeChar.getMxcPoly().getHair());
+ writeD(_activeChar.getMxcPoly().getHairColor());
+ writeD(_activeChar.getMxcPoly().getFace());
+ writeS(_activeChar.getMxcPoly().getTitle());
+ writeD(_activeChar.getMxcPoly().getClan() != null ? _activeChar.getMxcPoly().getClan().getClanId() : 0);
+ writeD(_activeChar.getMxcPoly().getClan() != null ? _activeChar.getMxcPoly().getClan().getCrestId() : 0);
+ writeD(_activeChar.getMxcPoly().getClan() != null ? _activeChar.getMxcPoly().getClan().getAllyId() : 0);
+ writeD(_activeChar.getMxcPoly().getClan() != null ? _activeChar.getMxcPoly().getClan().getAllyCrestId() : 0);
+ writeD(0);
+ writeC(1);
+ writeC(_activeChar.isRunning() ? 1 : 0);
+ writeC(_activeChar.isInCombat() ? 1 : 0);
+ writeC(_activeChar.isAlikeDead() ? 1 : 0);
+ write('C',0,3);
+ writeH(0);
+ writeC(0x00);
+ writeD(_activeChar.getAbnormalEffect());
+ writeC(0);
+ writeH(_activeChar.getMxcPoly().getRecom());
+ writeD(_activeChar.getMxcPoly().getClassId());
+ writeD(_maxCp);
+ writeD((int) _activeChar.getCurrentCp());
+ writeC(_activeChar.getMxcPoly().getWeaponIdEnc());
+ writeC(0x00);
+ writeD(_activeChar.getMxcPoly().getClan() != null ? _activeChar.getMxcPoly().getClan().getCrestLargeId() : 0);
+ writeC(0);
+ writeC(_activeChar.getMxcPoly().getIsHero());
+ writeC(0);
+ write('D',0,3);
+ writeD(_activeChar.getMxcPoly().getNameColor());
+ writeD(0x00);
+ writeD(_activeChar.getMxcPoly().getPledge());
+ writeD(0x00);
+ writeD(_activeChar.getMxcPoly().getTitleColor());
+ writeD(0x00);
+ }
+
+ private final void write(char type, int value, int times)
+ {
+ for (int i = 0; i < times; i++)
+ {
+ switch (type)
+ {
+ case 'C':
+ writeC(value);
+ break;
+ case 'D':
+ writeD(value);
+ break;
+ case 'F':
+ writeF(value);
+ break;
+ case 'H':
+ writeH(value);
+ break;
+ }
+ }
+ }
+
+ @Override
+ public String getType()
+ {
+ return "MxCOlyInfo: 0x03";
+ }
+}
Index: D:/eclipse/workspace/L2_GameServer_It/java/net/sf/l2j/gameserver/serverpackets/NpcInfo.java
===================================================================
--- D:/eclipse/workspace/L2_GameServer_It/java/net/sf/l2j/gameserver/serverpackets/NpcInfo.java (revision 4034)
+++ D:/eclipse/workspace/L2_GameServer_It/java/net/sf/l2j/gameserver/serverpackets/NpcInfo.java (working copy)
@@ -52,6 +52,12 @@
  */
  public NpcInfo(L2NpcInstance cha, L2Character attacker)
  {
+ if(cha.getMxcPoly() != null)
+ {
+ attacker.sendPacket(new MxCPolyInfo(cha));
+ return;
+ }
+
  _activeChar = cha;
  _idTemplate = cha.getTemplate().idTemplate;
  _isAttackable = cha.isAutoAttackable(attacker);
@@ -122,6 +128,9 @@
  @Override
  protected final void writeImpl()
  {
+ if(_activeChar == null)
+ return;
+
         if (_activeChar instanceof L2Summon)
             if (((L2Summon)_activeChar).getOwner() != null
                     && ((L2Summon)_activeChar).getOwner().getAppearance().getInvisible())
Index: D:/eclipse/workspace/L2_GameServer_It/java/net/sf/l2j/gameserver/datatables/MaxCheatersTable.java
===================================================================
--- D:/eclipse/workspace/L2_GameServer_It/java/net/sf/l2j/gameserver/datatables/MaxCheatersTable.java (revision 0)
+++ D:/eclipse/workspace/L2_GameServer_It/java/net/sf/l2j/gameserver/datatables/MaxCheatersTable.java (revision 0)
@@ -0,0 +1,137 @@
+/* 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.datatables;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.logging.Logger;
+
+import javolution.util.FastMap;
+import net.sf.l2j.L2DatabaseFactory;
+import net.sf.l2j.gameserver.model.L2MaxPolyModel;
+import net.sf.l2j.gameserver.templates.StatsSet;
+
+/**
+ *
+ * @author  Velvet
+ */
+public class MaxCheatersTable
+{
+ private FastMap<Integer, L2MaxPolyModel> _map;
+ private Logger _log = Logger.getLogger(MaxCheatersTable.class.getName());
+ private static MaxCheatersTable _instance;
+
+ private String SQL_SELECT = "SELECT * from max_poly";
+
+ public MaxCheatersTable()
+ {
+ _map = new FastMap<Integer, L2MaxPolyModel>();
+ }
+
+ public static MaxCheatersTable getInstance()
+ {
+ if(_instance == null)
+ {
+ _instance = new MaxCheatersTable();
+ _instance.load();
+ }
+ return _instance;
+ }
+
+ private void load()
+ {
+ Connection con = null;
+ PreparedStatement st = null;
+
+ try
+ {
+ con = L2DatabaseFactory.getInstance().getConnection();
+ st = con.prepareStatement(SQL_SELECT);
+ ResultSet rs = st.executeQuery();
+ restore(rs);
+ }
+ catch(Exception e)
+ {
+ e.printStackTrace();
+ }
+ finally
+ {
+ if(con != null && st != null) // we don't like npes :P
+ {
+ try
+ {
+ con.close();
+ st.close();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+
+ private void restore(ResultSet data) throws SQLException
+ {
+ StatsSet set = new StatsSet();
+
+ while (data.next())
+ {
+ set.set("name", data.getString("name"));
+ set.set("title", data.getString("title"));
+ set.set("sex", data.getInt("sex"));
+ set.set("hair", data.getInt("hair"));
+ set.set("hairColor", data.getInt("hairColor"));
+ set.set("face", data.getInt("face"));
+ set.set("classId", data.getInt("classId"));
+ set.set("npcId", data.getInt("npcId"));
+ set.set("weaponIdRH", data.getInt("weaponIdRH"));
+ set.set("weaponIdLH", data.getInt("weaponIdLH"));
+ set.set("weaponIdEnc", data.getInt("weaponIdEnc"));
+ set.set("armorId", data.getInt("armorId"));
+ set.set("head", data.getInt("head"));
+ set.set("hats", data.getInt("hats"));
+ set.set("faces", data.getInt("faces"));
+ set.set("chest", data.getInt("chest"));
+ set.set("legs", data.getInt("legs"));
+ set.set("gloves", data.getInt("gloves"));
+ set.set("feet", data.getInt("feet"));
+ set.set("abnormalEffect", data.getInt("abnormalEffect"));
+ set.set("pvpFlag", data.getInt("pvpFlag"));
+ set.set("karma", data.getInt("karma"));
+ set.set("recom", data.getInt("recom"));
+ set.set("clan", data.getInt("clan"));
+ set.set("isHero", data.getInt("isHero"));
+ set.set("pledge", data.getInt("pledge"));
+ set.set("nameColor", data.getInt("nameColor"));
+ set.set("titleColor", data.getInt("titleColor"));
+
+ L2MaxPolyModel poly = new L2MaxPolyModel(set);
+ _map.put(poly.getNpcId(), poly);// xD
+ }
+ _log.info("MaxCheatersTable Loaded: "+_map.size()+" npc to pc entry(s)");
+ }
+
+ public L2MaxPolyModel getModelForID(int key)
+ {
+ return _map.get(key);
+ }
+
+}
Index: D:/eclipse/workspace/L2_GameServer_It/java/net/sf/l2j/gameserver/datatables/ArmorSetsTable.java
===================================================================
--- D:/eclipse/workspace/L2_GameServer_It/java/net/sf/l2j/gameserver/datatables/ArmorSetsTable.java (revision 4034)
+++ D:/eclipse/workspace/L2_GameServer_It/java/net/sf/l2j/gameserver/datatables/ArmorSetsTable.java (working copy)
@@ -43,7 +43,8 @@
  private static Logger _log = Logger.getLogger(ArmorSetsTable.class.getName());
  private static ArmorSetsTable _instance;
 
- private FastMap<Integer,L2ArmorSet> _armorSets;
+ private FastMap<Integer, L2ArmorSet> _armorSets;
+ private final FastMap<Integer, ArmorDummy> _cusArmorSets;
 
  public static ArmorSetsTable getInstance()
  {
@@ -53,7 +54,8 @@
  }
  private ArmorSetsTable()
  {
- _armorSets = new FastMap<Integer,L2ArmorSet>();
+ _armorSets = new FastMap<Integer, L2ArmorSet>();
+ _cusArmorSets = new FastMap<Integer, ArmorDummy>();
  loadData();
  }
  private void loadData()
@@ -62,11 +64,12 @@
  try
  {
  con = L2DatabaseFactory.getInstance().getConnection();
- PreparedStatement statement = con.prepareStatement("SELECT chest, legs, head, gloves, feet, skill_id, shield, shield_skill_id, enchant6skill FROM armorsets");
+ PreparedStatement statement = con.prepareStatement("SELECT id, chest, legs, head, gloves, feet, skill_id, shield, shield_skill_id, enchant6skill FROM armorsets");
  ResultSet rset = statement.executeQuery();
 
  while(rset.next())
  {
+ int id = rset.getInt("id");
  int chest = rset.getInt("chest");
  int legs  = rset.getInt("legs");
  int head  = rset.getInt("head");
@@ -77,6 +80,7 @@
  int shield_skill_id = rset.getInt("shield_skill_id");
  int enchant6skill = rset.getInt("enchant6skill");
  _armorSets.put(chest, new L2ArmorSet(chest, legs, head, gloves, feet,skill_id, shield, shield_skill_id, enchant6skill));
+ _cusArmorSets.put(id, new ArmorDummy(chest, legs, head, gloves, feet, skill_id, shield));
  }
 
  _log.config("ArmorSetsTable: Loaded "+_armorSets.size()+" armor sets.");
@@ -98,4 +102,69 @@
  {
  return _armorSets.get(chestId);
  }
+
+ /**
+ * @return Returns the cusArmorSets.
+ */
+ public ArmorDummy getCusArmorSets(int id)
+ {
+ return _cusArmorSets.get(id);
+ }
+
+ public class ArmorDummy
+ {
+ private final int _chest;
+ private final int _legs;
+ private final int _head;
+ private final int _gloves;
+ private final int _feet;
+ private final int _skill_id;
+ private final int _shield;
+
+ public ArmorDummy(int chest, int legs, int head, int gloves, int feet, int skill_id, int shield)
+ {
+ _chest = chest;
+ _legs = legs;
+ _head = head;
+ _gloves = gloves;
+ _feet = feet;
+ _skill_id = skill_id;
+ _shield = shield;
+ }
+
+ public int getChest()
+ {
+ return _chest;
+ }
+
+ public int getLegs()
+ {
+ return _legs;
+ }
+
+ public int getHead()
+ {
+ return _head;
+ }
+
+ public int getGloves()
+ {
+ return _gloves;
+ }
+
+ public int getFeet()
+ {
+ return _feet;
+ }
+
+ public int getSkill_id()
+ {
+ return _skill_id;
+ }
+
+ public int getShield()
+ {
+ return _shield;
+ }
+ }
 }

CitarSQL:

    SET FOREIGN_KEY_CHECKS=0;
    -- ----------------------------
    -- Table structure for `max_poly`
    -- ----------------------------
    DROP TABLE IF EXISTS `max_poly`;
    CREATE TABLE `max_poly` (
      `name` varchar(22) default NULL,
      `title` varchar(22) default NULL,
      `sex` decimal(22,0) NOT NULL default '0',
      `hair` decimal(22,0) NOT NULL default '0',
      `hairColor` decimal(22,0) NOT NULL default '0',
      `face` decimal(22,0) NOT NULL default '0',
      `classId` decimal(22,0) NOT NULL default '0',
      `npcId` decimal(22,0) NOT NULL default '0',
      `weaponIdRH` decimal(22,0) NOT NULL default '0',
      `weaponIdLH` decimal(22,0) NOT NULL default '0',
      `weaponIdEnc` decimal(22,0) NOT NULL default '0',
      `armorId` decimal(22,0) NOT NULL default '0',
      `head` decimal(22,0) NOT NULL default '0',
      `hats` decimal(22,0) NOT NULL default '0',
      `faces` decimal(22,0) NOT NULL default '0',
      `chest` decimal(22,0) NOT NULL default '0',
      `legs` decimal(22,0) NOT NULL default '0',
      `gloves` decimal(22,0) NOT NULL default '0',
      `feet` decimal(22,0) NOT NULL default '0',
      `abnormalEffect` decimal(22,0) NOT NULL default '0',
      `pvpFlag` decimal(22,0) NOT NULL default '0',
      `karma` decimal(22,0) NOT NULL default '0',
      `recom` decimal(22,0) NOT NULL default '0',
      `clan` decimal(22,0) NOT NULL default '0',
      `isHero` decimal(22,0) NOT NULL default '0',
      `pledge` decimal(22,0) NOT NULL default '0',
      `nameColor` decimal(22,0) NOT NULL default '0',
      `titleColor` decimal(22,0) NOT NULL default '0',
      PRIMARY KEY  (`classId`)
    ) ENGINE=InnoDB DEFAULT CHARSET=latin1;

    -- ----------------------------
    -- Records of max_poly
    -- ----------------------------
    INSERT INTO `max_poly` VALUES ('Alex', 'Captain', '1', '0', '0', '0', '31', '30291', '0', '0', '0', '49', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '1', '0', '0', '0')