Skip to content

Instantly share code, notes, and snippets.

@u3games
Created June 11, 2015 15:11
Show Gist options
  • Save u3games/c206e9b7d0d2c0598b25 to your computer and use it in GitHub Desktop.
Save u3games/c206e9b7d0d2c0598b25 to your computer and use it in GitHub Desktop.
L2JServer - High Five - Fake PCs, NPCs as PCs
Index: com/l2jserver/gameserver/datatables/customs/FakePcsTable.java
===================================================================
--- com/l2jserver/gameserver/datatables/customs/FakePcsTable.java (revision 0)
+++ com/l2jserver/gameserver/datatables/customs/FakePcsTable.java (working copy)
@@ -0,0 +1,147 @@
+/*
+ * 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 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 com.l2jserver.gameserver.datatables.customs;
+
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.Statement;
+import java.util.HashMap;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import com.l2jserver.L2DatabaseFactory;
+import com.l2jserver.gameserver.model.actor.FakePc;
+
+public class FakePcsTable
+{
+ private static Logger _log = Logger.getLogger(FakePcsTable.class.getName());
+
+ private final HashMap<Integer, FakePc> _fakePcs = new HashMap<>();
+
+ private static final String SQL_LOAD_FAKE_PCS = "SELECT * FROM fake_pcs";
+
+ protected FakePcsTable()
+ {
+ loadData();
+ }
+
+ private void loadData()
+ {
+ _fakePcs.clear();
+
+ try (Connection con = L2DatabaseFactory.getInstance().getConnection();
+ Statement st = con.createStatement();
+ ResultSet rset = st.executeQuery(SQL_LOAD_FAKE_PCS))
+ {
+ FakePc fpc = null;
+
+ while (rset.next())
+ {
+ fpc = new FakePc();
+
+ int npcId = rset.getInt("npc_id");
+ fpc.race = rset.getInt("race");
+ fpc.sex = rset.getInt("sex");
+ fpc.clazz = rset.getInt("class");
+ fpc.title = rset.getString("title");
+ fpc.titleColor = Integer.decode("0x" + rset.getString("title_color"));
+ fpc.name = rset.getString("name");
+ fpc.nameColor = Integer.decode("0x" + rset.getString("name_color"));
+ fpc.hairStyle = rset.getInt("hair_style");
+ fpc.hairColor = rset.getInt("hair_color");
+ fpc.face = rset.getInt("face");
+ fpc.mount = rset.getByte("mount");
+ fpc.team = rset.getByte("team");
+ fpc.hero = rset.getByte("hero");
+ fpc.pdUnder = rset.getInt("pd_under");
+ fpc.pdUnderAug = rset.getInt("pd_under_aug");
+ fpc.pdHead = rset.getInt("pd_head");
+ fpc.pdHeadAug = rset.getInt("pd_head_aug");
+ fpc.pdRHand = rset.getInt("pd_rhand");
+ fpc.pdRHandAug = rset.getInt("pd_rhand_aug");
+ fpc.pdLHand = rset.getInt("pd_lhand");
+ fpc.pdLHandAug = rset.getInt("pd_lhand_aug");
+ fpc.pdGloves = rset.getInt("pd_gloves");
+ fpc.pdGlovesAug = rset.getInt("pd_gloves_aug");
+ fpc.pdChest = rset.getInt("pd_chest");
+ fpc.pdChestAug = rset.getInt("pd_chest_aug");
+ fpc.pdLegs = rset.getInt("pd_legs");
+ fpc.pdLegsAug = rset.getInt("pd_legs_aug");
+ fpc.pdFeet = rset.getInt("pd_feet");
+ fpc.pdFeetAug = rset.getInt("pd_feet_aug");
+ fpc.pdBack = rset.getInt("pd_back");
+ fpc.pdBackAug = rset.getInt("pd_back_aug");
+ fpc.pdLRHand = rset.getInt("pd_lrhand");
+ fpc.pdLRHandAug = rset.getInt("pd_lrhand_aug");
+ fpc.pdHair = rset.getInt("pd_hair");
+ fpc.pdHairAug = rset.getInt("pd_hair_aug");
+ fpc.pdHair2 = rset.getInt("pd_hair2");
+ fpc.pdHair2Aug = rset.getInt("pd_hair2_aug");
+ fpc.pdRBracelet = rset.getInt("pd_rbracelet");
+ fpc.pdRBraceletAug = rset.getInt("pd_rbracelet_aug");
+ fpc.pdLBracelet = rset.getInt("pd_lbracelet");
+ fpc.pdLBraceletAug = rset.getInt("pd_lbracelet_aug");
+ fpc.pdDeco1 = rset.getInt("pd_deco1");
+ fpc.pdDeco1Aug = rset.getInt("pd_deco1_aug");
+ fpc.pdDeco2 = rset.getInt("pd_deco2");
+ fpc.pdDeco2Aug = rset.getInt("pd_deco2_aug");
+ fpc.pdDeco3 = rset.getInt("pd_deco3");
+ fpc.pdDeco3Aug = rset.getInt("pd_deco3_aug");
+ fpc.pdDeco4 = rset.getInt("pd_deco4");
+ fpc.pdDeco4Aug = rset.getInt("pd_deco4_aug");
+ fpc.pdDeco5 = rset.getInt("pd_deco5");
+ fpc.pdDeco5Aug = rset.getInt("pd_deco5_aug");
+ fpc.pdDeco6 = rset.getInt("pd_deco6");
+ fpc.pdDeco6Aug = rset.getInt("pd_deco6_aug");
+ fpc.enchantEffect = rset.getInt("enchant_effect");
+ fpc.pvpFlag = rset.getInt("pvp_flag");
+ fpc.karma = rset.getInt("karma");
+ fpc.fishing = rset.getByte("fishing");
+ fpc.fishingX = rset.getInt("fishing_x");
+ fpc.fishingY = rset.getInt("fishing_y");
+ fpc.fishingZ = rset.getInt("fishing_z");
+ fpc.invisible = rset.getByte("invisible");
+ _fakePcs.put(npcId, fpc);
+ }
+
+ rset.close();
+ }
+ catch (Exception e)
+ {
+ _log.log(Level.WARNING, "FakePcsTable: Error while creating fake pc table: ", e);
+ }
+ }
+
+ public void reloadData()
+ {
+ loadData();
+ }
+
+ public FakePc getFakePc(int npcId)
+ {
+ return _fakePcs.get(npcId);
+ }
+
+ public static FakePcsTable getInstance()
+ {
+ return SingletonHolder._instance;
+ }
+
+ private static class SingletonHolder
+ {
+ protected static final FakePcsTable _instance = new FakePcsTable();
+ }
+}
Index: com/l2jserver/gameserver/GameServer.java
===================================================================
--- com/l2jserver/gameserver/GameServer.java (revision 10721)
+++ com/l2jserver/gameserver/GameServer.java (working copy)
@@ -85,6 +85,7 @@
import com.l2jserver.gameserver.datatables.MerchantPriceConfigTable;
import com.l2jserver.gameserver.datatables.SkillData;
import com.l2jserver.gameserver.datatables.SpawnTable;
+import com.l2jserver.gameserver.datatables.customs.FakePcsTable;
import com.l2jserver.gameserver.handler.EffectHandler;
import com.l2jserver.gameserver.idfactory.IdFactory;
import com.l2jserver.gameserver.instancemanager.AirShipManager;
@@ -291,6 +292,7 @@
CursedWeaponsManager.getInstance();
TransformData.getInstance();
BotReportTable.getInstance();
+ FakePcsTable.getInstance();
printSection("Scripts");
QuestManager.getInstance();
Index: com/l2jserver/gameserver/model/actor/FakePc.java
===================================================================
--- com/l2jserver/gameserver/model/actor/FakePc.java (revision 0)
+++ com/l2jserver/gameserver/model/actor/FakePc.java (working copy)
@@ -0,0 +1,81 @@
+/*
+ * 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 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 com.l2jserver.gameserver.model.actor;
+
+public class FakePc
+{
+ public int race;
+ public int sex;
+ public int clazz;
+ public String title;
+ public int titleColor;
+ public String name;
+ public int nameColor;
+ public int hairStyle;
+ public int hairColor;
+ public int face;
+ public byte mount;
+ public byte team;
+ public byte hero;
+ public int pdUnder;
+ public int pdUnderAug;
+ public int pdHead;
+ public int pdHeadAug;
+ public int pdRHand;
+ public int pdRHandAug;
+ public int pdLHand;
+ public int pdLHandAug;
+ public int pdGloves;
+ public int pdGlovesAug;
+ public int pdChest;
+ public int pdChestAug;
+ public int pdLegs;
+ public int pdLegsAug;
+ public int pdFeet;
+ public int pdFeetAug;
+ public int pdBack;
+ public int pdBackAug;
+ public int pdLRHand;
+ public int pdLRHandAug;
+ public int pdHair;
+ public int pdHairAug;
+ public int pdHair2;
+ public int pdHair2Aug;
+ public int pdRBracelet;
+ public int pdRBraceletAug;
+ public int pdLBracelet;
+ public int pdLBraceletAug;
+ public int pdDeco1;
+ public int pdDeco1Aug;
+ public int pdDeco2;
+ public int pdDeco2Aug;
+ public int pdDeco3;
+ public int pdDeco3Aug;
+ public int pdDeco4;
+ public int pdDeco4Aug;
+ public int pdDeco5;
+ public int pdDeco5Aug;
+ public int pdDeco6;
+ public int pdDeco6Aug;
+ public int enchantEffect;
+ public int pvpFlag;
+ public int karma;
+ public byte fishing;
+ public int fishingX;
+ public int fishingY;
+ public int fishingZ;
+ public byte invisible;
+}
Index: com/l2jserver/gameserver/model/actor/L2Npc.java
===================================================================
--- com/l2jserver/gameserver/model/actor/L2Npc.java (revision 10721)
+++ com/l2jserver/gameserver/model/actor/L2Npc.java (working copy)
@@ -37,6 +37,7 @@
import com.l2jserver.gameserver.data.xml.impl.NpcData;
import com.l2jserver.gameserver.datatables.ItemTable;
import com.l2jserver.gameserver.datatables.NpcPersonalAIData;
+import com.l2jserver.gameserver.datatables.customs.FakePcsTable;
import com.l2jserver.gameserver.enums.AISkillScope;
import com.l2jserver.gameserver.enums.AIType;
import com.l2jserver.gameserver.enums.InstanceType;
@@ -142,6 +143,9 @@
private double _currentCollisionHeight; // used for npc grow effect skills
private double _currentCollisionRadius; // used for npc grow effect skills
+ // Fake Npc
+ private FakePc _fakePc = null;
+
private int _soulshotamount = 0;
private int _spiritshotamount = 0;
private int _displayEffect = 0;
@@ -172,6 +176,9 @@
_currentCollisionHeight = getTemplate().getfCollisionHeight();
_currentCollisionRadius = getTemplate().getfCollisionRadius();
+ // Fake Npc
+ _fakePc = FakePcsTable.getInstance().getFakePc(getTemplate().getId());
+
setIsFlying(template.isFlying());
}
@@ -1655,6 +1662,11 @@
return _displayEffect;
}
+ public FakePc getFakePc()
+ {
+ return _fakePc;
+ }
+
public int getColorEffect()
{
return 0;
Index: com/l2jserver/gameserver/model/actor/status/AttackableStatus.java
===================================================================
--- com/l2jserver/gameserver/model/actor/status/AttackableStatus.java (revision 10721)
+++ com/l2jserver/gameserver/model/actor/status/AttackableStatus.java (working copy)
@@ -18,8 +18,12 @@
*/
package com.l2jserver.gameserver.model.actor.status;
+import java.util.Collection;
+
import com.l2jserver.gameserver.model.actor.L2Attackable;
import com.l2jserver.gameserver.model.actor.L2Character;
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jserver.gameserver.network.serverpackets.AbstractNpcInfo;
public class AttackableStatus extends NpcStatus
{
@@ -68,6 +72,26 @@
}
@Override
+ public boolean setCurrentHp(double newHp, boolean broadcastPacket)
+ {
+ super.setCurrentHp(newHp, broadcastPacket);
+
+ if (getActiveChar().getFakePc() != null)
+ {
+ Collection<L2PcInstance> plrs = getActiveChar().getKnownList().getKnownPlayers().values();
+ for (L2PcInstance player : plrs)
+ {
+ if (player != null)
+ {
+ player.sendPacket(new AbstractNpcInfo.NpcInfo(getActiveChar(), player));
+ }
+ }
+ }
+
+ return broadcastPacket;
+ }
+
+ @Override
public L2Attackable getActiveChar()
{
return (L2Attackable) super.getActiveChar();
Index: com/l2jserver/gameserver/network/serverpackets/AbstractNpcInfo.java
===================================================================
--- com/l2jserver/gameserver/network/serverpackets/AbstractNpcInfo.java (revision 10721)
+++ com/l2jserver/gameserver/network/serverpackets/AbstractNpcInfo.java (working copy)
@@ -18,11 +18,15 @@
*/
package com.l2jserver.gameserver.network.serverpackets;
+import java.text.DecimalFormat;
+
import com.l2jserver.Config;
import com.l2jserver.gameserver.data.sql.impl.ClanTable;
+import com.l2jserver.gameserver.data.xml.impl.PlayerTemplateData;
import com.l2jserver.gameserver.instancemanager.TownManager;
import com.l2jserver.gameserver.model.L2Clan;
import com.l2jserver.gameserver.model.PcCondOverride;
+import com.l2jserver.gameserver.model.actor.FakePc;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.L2Summon;
@@ -30,6 +34,7 @@
import com.l2jserver.gameserver.model.actor.instance.L2NpcInstance;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.actor.instance.L2TrapInstance;
+import com.l2jserver.gameserver.model.actor.templates.L2PcTemplate;
import com.l2jserver.gameserver.model.skills.AbnormalVisualEffect;
import com.l2jserver.gameserver.model.zone.ZoneId;
@@ -143,64 +148,216 @@
@Override
protected void writeImpl()
{
- writeC(0x0c);
- writeD(_npc.getObjectId());
- writeD(_idTemplate + 1000000); // npctype id
- writeD(_isAttackable ? 1 : 0);
- writeD(_x);
- writeD(_y);
- writeD(_z);
- writeD(_heading);
- writeD(0x00);
- writeD(_mAtkSpd);
- writeD(_pAtkSpd);
- writeD(_runSpd);
- writeD(_walkSpd);
- writeD(_swimRunSpd);
- writeD(_swimWalkSpd);
- writeD(_flyRunSpd);
- writeD(_flyWalkSpd);
- writeD(_flyRunSpd);
- writeD(_flyWalkSpd);
- writeF(_moveMultiplier);
- writeF(_npc.getAttackSpeedMultiplier());
- writeF(_collisionRadius);
- writeF(_collisionHeight);
- writeD(_rhand); // right hand weapon
- writeD(_chest);
- writeD(_lhand); // left hand weapon
- writeC(1); // name above char 1=true ... ??
- writeC(_npc.isRunning() ? 1 : 0);
- writeC(_npc.isInCombat() ? 1 : 0);
- writeC(_npc.isAlikeDead() ? 1 : 0);
- writeC(_isSummoned ? 2 : 0); // invisible ?? 0=false 1=true 2=summoned (only works if model has a summon animation)
- writeD(-1); // High Five NPCString ID
- writeS(_name);
- writeD(-1); // High Five NPCString ID
- writeS(_title);
- writeD(0x00); // Title color 0=client default
- writeD(0x00); // pvp flag
- writeD(0x00); // karma
-
- writeD(_npc.isInvisible() ? _npc.getAbnormalVisualEffects() | AbnormalVisualEffect.STEALTH.getMask() : _npc.getAbnormalVisualEffects());
- writeD(_clanId); // clan id
- writeD(_clanCrest); // crest id
- writeD(_allyId); // ally id
- writeD(_allyCrest); // all crest
-
- writeC(_npc.isInsideZone(ZoneId.WATER) ? 1 : _npc.isFlying() ? 2 : 0); // C2
- writeC(_npc.getTeam().getId());
-
- writeF(_collisionRadius);
- writeF(_collisionHeight);
- writeD(_enchantEffect); // C4
- writeD(_npc.isFlying() ? 1 : 0); // C6
- writeD(0x00);
- writeD(_npc.getColorEffect()); // CT1.5 Pet form and skills, Color effect
- writeC(_npc.isTargetable() ? 0x01 : 0x00);
- writeC(_npc.isShowName() ? 0x01 : 0x00);
- writeD(_npc.getAbnormalVisualEffectSpecial());
- writeD(_displayEffect);
+ FakePc fpc = _npc.getFakePc();
+ if (fpc != null)
+ {
+ writeC(0x31);
+ writeD(_x);
+ writeD(_y);
+ writeD(_z);
+ writeD(0x00); // vehicle id
+ writeD(_npc.getObjectId());
+ writeS(fpc.name); // visible name
+ writeD(fpc.race);
+ writeD(fpc.sex);
+ writeD(fpc.clazz);
+
+ writeD(fpc.pdUnder);
+ writeD(fpc.pdHead);
+ writeD(fpc.pdRHand);
+ writeD(fpc.pdLHand);
+ writeD(fpc.pdGloves);
+ writeD(fpc.pdChest);
+ writeD(fpc.pdLegs);
+ writeD(fpc.pdFeet);
+ writeD(fpc.pdBack);
+ writeD(fpc.pdLRHand);
+ writeD(fpc.pdHair);
+ writeD(fpc.pdHair2);
+ writeD(fpc.pdRBracelet);
+ writeD(fpc.pdLBracelet);
+ writeD(fpc.pdDeco1);
+ writeD(fpc.pdDeco2);
+ writeD(fpc.pdDeco3);
+ writeD(fpc.pdDeco4);
+ writeD(fpc.pdDeco5);
+ writeD(fpc.pdDeco6);
+ writeD(0x00); // belt
+
+ writeD(fpc.pdUnderAug);
+ writeD(fpc.pdHeadAug);
+ writeD(fpc.pdRHandAug);
+ writeD(fpc.pdLHandAug);
+ writeD(fpc.pdGlovesAug);
+ writeD(fpc.pdChestAug);
+ writeD(fpc.pdLegsAug);
+ writeD(fpc.pdFeetAug);
+ writeD(fpc.pdBackAug);
+ writeD(fpc.pdLRHandAug);
+ writeD(fpc.pdHairAug);
+ writeD(fpc.pdHair2Aug);
+ writeD(fpc.pdRBraceletAug);
+ writeD(fpc.pdLBraceletAug);
+ writeD(fpc.pdDeco1Aug);
+ writeD(fpc.pdDeco2Aug);
+ writeD(fpc.pdDeco3Aug);
+ writeD(fpc.pdDeco4Aug);
+ writeD(fpc.pdDeco5Aug);
+ writeD(fpc.pdDeco6Aug);
+ writeD(0x00); // belt aug
+ writeD(0x00);
+ writeD(0x01);
+
+ writeD(fpc.pvpFlag);
+ writeD(fpc.karma);
+
+ writeD(_mAtkSpd);
+ writeD(_pAtkSpd);
+
+ writeD(0x00);
+
+ writeD(_runSpd);
+ writeD(_walkSpd);
+ writeD(_runSpd); // swim run speed
+ writeD(_walkSpd); // swim walk speed
+ writeD(_runSpd); // fly run speed
+ writeD(_walkSpd); // fly walk speed
+ writeD(_runSpd);
+ writeD(_walkSpd);
+ writeF(_npc.getMovementSpeedMultiplier()); // _activeChar.getProperMultiplier()
+ writeF(_npc.getAttackSpeedMultiplier()); // _activeChar.getAttackSpeedMultiplier()
+
+ // TODO: add handling of mount collision
+ L2PcTemplate pctmpl = PlayerTemplateData.getInstance().getTemplate(fpc.clazz);
+ writeF(fpc.sex == 0 ? pctmpl.getCollisionRadius() : pctmpl.getCollisionRadius());
+ writeF(fpc.sex == 0 ? pctmpl.getCollisionHeight() : pctmpl.getCollisionHeight());
+
+ writeD(fpc.hairStyle);
+ writeD(fpc.hairColor);
+ writeD(fpc.face);
+
+ if (_npc instanceof L2MonsterInstance)
+ {
+ writeS(fpc.title + " - HP " + new DecimalFormat("#.##").format((100.0 * _npc.getCurrentHp()) / _npc.getMaxHp()) + "%"); // visible title
+ }
+ else
+ {
+ writeS(fpc.title);
+ }
+
+ writeD(0x00); // clan id
+ writeD(0x00); // clan crest id
+ writeD(0x00); // ally id
+ writeD(0x00); // ally crest id
+
+ writeC(0x01); // standing = 1 sitting = 0
+ writeC(_npc.isRunning() ? 1 : 0); // running = 1 walking = 0
+ writeC(_npc.isInCombat() ? 1 : 0);
+ writeC(_npc.isAlikeDead() ? 1 : 0);
+
+ writeC(fpc.invisible); // invisible = 1 visible =0
+
+ writeC(fpc.mount); // 1 on strider 2 on wyvern 3 on Great Wolf 0 no mount
+ writeC(0x00); // 1 - sellshop
+ writeH(0x00); // cubic count
+
+ // for (int id : allCubics)
+ // writeH(id);
+
+ writeC(0x00); // find party members
+ writeD(0x00); // abnormal effect
+ writeC(0x00); // isFlying() ? 2 : 0
+ writeH(0x00); // getRecomHave(): Blue value for name (0 = white, 255 = pure blue)
+ writeD(1000000); // getMountNpcId() + 1000000
+ writeD(fpc.clazz);
+ writeD(0x00); // ?
+ writeC(fpc.enchantEffect);
+ writeC(fpc.team); // team circle around feet 1= Blue, 2 = red
+ writeD(0x00); // getClanCrestLargeId()
+ writeC(0x00); // isNoble(): Symbol on char menu ctrl+I
+ writeC(fpc.hero); // Hero Aura
+ writeC(fpc.fishing); // 0x01: Fishing Mode (Cant be undone by setting back to 0)
+ writeD(fpc.fishingX);
+ writeD(fpc.fishingY);
+ writeD(fpc.fishingZ);
+
+ writeD(fpc.nameColor);
+ writeD(_heading);
+ writeD(0x00); // pledge class
+ writeD(0x00); // pledge type
+ writeD(fpc.titleColor);
+
+ writeD(0x00); // cursed weapon level
+ writeD(0x00); // reputation score
+ writeD(0x00); // transformation id
+ writeD(0x00); // agathion id
+ writeD(0x01); // T2 ?
+ writeD(0x00); // special effect
+ /*
+ * writeD(0x00); // territory Id writeD(0x00); // is Disguised writeD(0x00); // territory Id
+ */
+ }
+ else
+ {
+ writeC(0x0c);
+ writeD(_npc.getObjectId());
+ writeD(_idTemplate + 1000000); // npctype id
+ writeD(_isAttackable ? 1 : 0);
+ writeD(_x);
+ writeD(_y);
+ writeD(_z);
+ writeD(_heading);
+ writeD(0x00);
+ writeD(_mAtkSpd);
+ writeD(_pAtkSpd);
+ writeD(_runSpd);
+ writeD(_walkSpd);
+ writeD(_swimRunSpd);
+ writeD(_swimWalkSpd);
+ writeD(_flyRunSpd);
+ writeD(_flyWalkSpd);
+ writeD(_flyRunSpd);
+ writeD(_flyWalkSpd);
+ writeF(_moveMultiplier);
+ writeF(_npc.getAttackSpeedMultiplier());
+ writeF(_collisionRadius);
+ writeF(_collisionHeight);
+ writeD(_rhand); // right hand weapon
+ writeD(_chest);
+ writeD(_lhand); // left hand weapon
+ writeC(1); // name above char 1=true ... ??
+ writeC(_npc.isRunning() ? 1 : 0);
+ writeC(_npc.isInCombat() ? 1 : 0);
+ writeC(_npc.isAlikeDead() ? 1 : 0);
+ writeC(_isSummoned ? 2 : 0); // invisible ?? 0=false 1=true 2=summoned (only works if model has a summon animation)
+ writeD(-1); // High Five NPCString ID
+ writeS(_name);
+ writeD(-1); // High Five NPCString ID
+ writeS(_title);
+ writeD(0x00); // Title color 0=client default
+ writeD(0x00); // pvp flag
+ writeD(0x00); // karma
+
+ writeD(_npc.isInvisible() ? _npc.getAbnormalVisualEffects() | AbnormalVisualEffect.STEALTH.getMask() : _npc.getAbnormalVisualEffects());
+ writeD(_clanId); // clan id
+ writeD(_clanCrest); // crest id
+ writeD(_allyId); // ally id
+ writeD(_allyCrest); // all crest
+
+ writeC(_npc.isInsideZone(ZoneId.WATER) ? 1 : _npc.isFlying() ? 2 : 0); // C2
+ writeC(_npc.getTeam().getId());
+
+ writeF(_collisionRadius);
+ writeF(_collisionHeight);
+ writeD(_enchantEffect); // C4
+ writeD(_npc.isFlying() ? 1 : 0); // C6
+ writeD(0x00);
+ writeD(_npc.getColorEffect()); // CT1.5 Pet form and skills, Color effect
+ writeC(_npc.isTargetable() ? 0x01 : 0x00);
+ writeC(_npc.isShowName() ? 0x01 : 0x00);
+ writeD(_npc.getAbnormalVisualEffectSpecial());
+ writeD(_displayEffect);
+ }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment