Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: java/com/l2jserver/gameserver/datatables/FakePcsTable.java
- ===================================================================
- --- java/com/l2jserver/gameserver/datatables/FakePcsTable.java (revision 0)
- +++ java/com/l2jserver/gameserver/datatables/FakePcsTable.java (revision 0)
- @@ -0,0 +1,164 @@
- +/*
- + * 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;
- +
- +import java.sql.Connection;
- +import java.sql.PreparedStatement;
- +import java.sql.ResultSet;
- +import java.sql.SQLException;
- +import java.util.logging.Level;
- +import java.util.logging.Logger;
- +
- +import javolution.util.FastMap;
- +
- +import com.l2jserver.L2DatabaseFactory;
- +import com.l2jserver.gameserver.model.actor.FakePc;
- +
- +/**
- + * Fake pc data table.
- + *
- + * @author BiTi
- + */
- +public class FakePcsTable
- +{
- + /** The logger<br> */
- + private static Logger _log = Logger.getLogger(FakePcsTable.class.getName());
- +
- + private FastMap<Integer, FakePc> _fakePcs = new FastMap<Integer, FakePc>();
- +
- + private FakePcsTable()
- + {
- + loadData();
- + }
- +
- + private void loadData()
- + {
- + _fakePcs.clear();
- +
- + Connection con = null;
- +
- + try
- + {
- + con = L2DatabaseFactory.getInstance().getConnection();
- +
- + PreparedStatement stmt = con.prepareStatement("SELECT * FROM `fake_pcs`");
- + ResultSet rset = stmt.executeQuery();
- +
- + 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();
- + stmt.close();
- + }
- + catch (SQLException e)
- + {
- + _log.log(Level.SEVERE, "Error while creating fake pc table: " + e.getMessage(), e);
- + }
- + finally
- + {
- + L2DatabaseFactory.close(con);
- + }
- + }
- +
- + public void reloadData()
- + {
- + loadData();
- + }
- +
- + public FakePc getFakePc(int npcId)
- + {
- + return _fakePcs.get(npcId);
- + }
- +
- + public static FakePcsTable getInstance()
- + {
- + return SingletonHolder._instance;
- + }
- +
- + @SuppressWarnings("synthetic-access")
- + private static class SingletonHolder
- + {
- + protected static final FakePcsTable _instance = new FakePcsTable();
- + }
- +}
- \ No newline at end of file
- Index: java/com/l2jserver/gameserver/model/actor/FakePc.java
- ===================================================================
- --- java/com/l2jserver/gameserver/model/actor/FakePc.java (revision 0)
- +++ java/com/l2jserver/gameserver/model/actor/FakePc.java (revision 0)
- @@ -0,0 +1,86 @@
- +/*
- + * 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;
- +
- +/**
- + * Fake pc data model.
- + *
- + * @author BiTi
- + */
- +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;
- +}
- \ No newline at end of file
- Index: java/com/l2jserver/gameserver/network/serverpackets/AbstractNpcInfo.java
- ===================================================================
- --- java/com/l2jserver/gameserver/network/serverpackets/AbstractNpcInfo.java (revision 4422)
- +++ java/com/l2jserver/gameserver/network/serverpackets/AbstractNpcInfo.java (working copy)
- @@ -15,9 +15,12 @@
- package com.l2jserver.gameserver.network.serverpackets;
- import com.l2jserver.Config;
- +import com.l2jserver.gameserver.datatables.CharTemplateTable;
- import com.l2jserver.gameserver.datatables.ClanTable;
- +import com.l2jserver.gameserver.datatables.FakePcsTable;
- import com.l2jserver.gameserver.instancemanager.TownManager;
- import com.l2jserver.gameserver.model.L2Clan;
- +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;
- @@ -26,6 +29,7 @@
- import com.l2jserver.gameserver.model.actor.instance.L2NpcInstance;
- import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
- import com.l2jserver.gameserver.skills.AbnormalEffect;
- +import com.l2jserver.gameserver.templates.chars.L2PcTemplate;
- /**
- * This class ...
- @@ -105,14 +109,14 @@
- _isAttackable = cha.isAutoAttackable(attacker);
- if (cha.getTemplate().serverSideName)
- _name = cha.getName();// On every subclass
- -
- +
- if (Config.L2JMOD_CHAMPION_ENABLE && cha.isChampion())
- _title = (Config.L2JMOD_CHAMP_TITLE); // On every subclass
- else if (cha.getTemplate().serverSideTitle)
- _title = cha.getTemplate().title; // On every subclass
- else
- _title = cha.getTitle(); // On every subclass
- -
- +
- if (Config.SHOW_NPC_LVL && _npc instanceof L2MonsterInstance)
- {
- String t = "Lv " + cha.getLevel() + (cha.getAggroRange() > 0 ? "*" : "");
- @@ -142,61 +146,204 @@
- @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(_runSpd); // swim run speed
- - writeD(_walkSpd); // swim walk speed
- - writeD(_runSpd); // swim run speed
- - writeD(_walkSpd); // swim walk speed
- - writeD(_runSpd); // fly run speed
- - writeD(_walkSpd); // fly run speed
- - writeF(_npc.getMovementSpeedMultiplier());
- - 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); // 0=teleported 1=default 2=summoned
- - writeS(_name);
- - writeS(_title);
- - writeD(0x00); // Title color 0=client default
- - writeD(0x00); //pvp flag
- - writeD(0x00); // karma
- -
- - writeD(_npc.getAbnormalEffect()); // C2
- - writeD(_clanId); //clan id
- - writeD(_clanCrest); //crest id
- - writeD(_allyId); // ally id
- - writeD(_allyCrest); // all crest
- - writeC(_npc.isFlying() ? 2 : 0); // C2
- - writeC(0x00); // title color 0=client
- -
- - writeF(_collisionRadius);
- - writeF(_collisionHeight);
- - writeD(_enchantEffect); // C4
- - writeD(_npc.isFlying() ? 1 : 0); // C6
- - writeD(0x00);
- - writeD(0x00);// CT1.5 Pet form and skills
- - writeC(_npc.isHideName() ? 0x00 : 0x01);
- - writeC(_npc.isHideName() ? 0x00 : 0x01);
- - writeD(_npc.getSpecialEffect());
- - writeD(_displayEffect);
- + FakePc fpc = FakePcsTable.getInstance().getFakePc(_npc.getNpcId());
- + 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 = CharTemplateTable.getInstance().getTemplate(fpc.clazz);
- + writeF(fpc.sex == 0 ? pctmpl.fCollisionRadius : pctmpl.fCollisionRadius_female);
- + writeF(fpc.sex == 0 ? pctmpl.fCollisionHeight : pctmpl.fCollisionHeight_female);
- +
- + writeD(fpc.hairStyle);
- + writeD(fpc.hairColor);
- + writeD(fpc.face);
- +
- + writeS(fpc.title); // visible 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(_runSpd); // swim run speed
- + writeD(_walkSpd); // swim walk speed
- + writeD(_runSpd); // swim run speed
- + writeD(_walkSpd); // swim walk speed
- + writeD(_runSpd); // fly run speed
- + writeD(_walkSpd); // fly run speed
- + writeF(_npc.getMovementSpeedMultiplier());
- + 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); // 0=teleported 1=default 2=summoned
- + writeS(_name);
- + writeS(_title);
- + writeD(0x00); // Title color 0=client default
- + writeD(0x00); //pvp flag
- + writeD(0x00); // karma
- +
- + writeD(_npc.getAbnormalEffect()); // C2
- + writeD(_clanId); //clan id
- + writeD(_clanCrest); //crest id
- + writeD(_allyId); // ally id
- + writeD(_allyCrest); // all crest
- + writeC(_npc.isFlying() ? 2 : 0); // C2
- + writeC(0x00); // title color 0=client
- +
- + writeF(_collisionRadius);
- + writeF(_collisionHeight);
- + writeD(_enchantEffect); // C4
- + writeD(_npc.isFlying() ? 1 : 0); // C6
- + writeD(0x00);
- + writeD(0x00);// CT1.5 Pet form and skills
- + writeC(_npc.isHideName() ? 0x00 : 0x01);
- + writeC(_npc.isHideName() ? 0x00 : 0x01);
- + writeD(_npc.getSpecialEffect());
- + writeD(_displayEffect);
- + }
- }
- }
- @@ -300,7 +447,7 @@
- _val = val;
- if (_summon.isShowSummonAnimation())
- _val = 2; //override for spawn
- -
- +
- int npcId = cha.getTemplate().npcId;
- if (npcId == 16041 || npcId == 16042)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement