» Find Revision
L2J Revision Number:
L2JDP Revision Number:
hi all i have a interlude server and i am try to make npc to pc i have this code
facepc.java:
Code: Select all
package net.sf.l2j.gameserver.model; 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 int pdHairall;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 byte enchantEffect;public int pvpFlag;public int karma;public byte fishing;public int fishingX;public int fishingY;public int fishingZ;public byte invisible;public int ClanId;public int ClanCrestId;public int AllyId;public int AllyCrestId; }
Code: Select all
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.FakePc; /** * * @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(){ 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 = rset.getInt("title_color"); fpc.name = rset.getString("name"); fpc.nameColor = rset.getInt("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.pdHairall = rset.getInt("pd_hairall"); 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.getByte("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.warning("AccessFakePcsTable: Error loading from database:" + e); } finally { try { con.close(); } catch (Exception e) { } }} 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();}}
Code: Select all
@Override protected final void writeImpl() { FakePc fpc = FakePcsTable.getInstance().getFakePc(_idTemplate); if (fpc != null) { writeC(0x03); writeD(_x); writeD(_y); writeD(_z); writeD(_heading); writeD(_activeChar.getObjectId()); writeS(fpc.name); writeD(fpc.race); writeD(fpc.sex); writeD(fpc.clazz); writeD(fpc.pdHairall); 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); // c6 new h's writeH(0x00); writeH(0x00); writeH(0x00); writeH(0x00); writeD(fpc.pdRHand); writeH(0x00); writeH(0x00); writeH(0x00); writeH(0x00); writeH(0x00); writeH(0x00); writeH(0x00); writeH(0x00); writeH(0x00); writeH(0x00); writeH(0x00); writeH(0x00); writeD(fpc.pdLHand); writeH(0x00); writeH(0x00); writeH(0x00); writeH(0x00); writeD(fpc.pvpFlag); writeD(fpc.karma); writeD(_mAtkSpd); writeD(_pAtkSpd); writeD(fpc.pvpFlag); writeD(fpc.karma); writeD(_runSpd); writeD(_walkSpd); writeD(_swimRunSpd/*0x32*/); // swimspeed writeD(_swimWalkSpd/*0x32*/); // swimspeed writeD(_flRunSpd); writeD(_flWalkSpd); writeD(_flyRunSpd); writeD(_flyWalkSpd); writeF(_activeChar.getMovementSpeedMultiplier()); // _activeChar.getProperMultiplier() writeF(_activeChar.getAttackSpeedMultiplier()); // _activeChar.getAttackSpeedMultiplier() L2PcTemplate pctmpl = CharTemplateTable.getInstance().getTemplate(fpc.clazz); writeF(pctmpl.collisionRadius); writeF(pctmpl.collisionHeight); writeD(fpc.hairStyle); writeD(fpc.hairColor); writeD(fpc.face); writeS(fpc.title); writeD(fpc.ClanId); writeD(fpc.ClanCrestId); writeD(fpc.AllyId); writeD(fpc.AllyCrestId); /* writeD(_activeChar.getClanId()); writeD(_activeChar.getClanCrestId()); PRIREIKS VELIAU writeD(_activeChar.getAllyId()); writeD(_activeChar.getAllyCrestId()); */ writeD(0x00); writeD(0x00); writeD(0x00); // In UserInfo leader rights and siege flags, but here found nothing?? // Therefore RelationChanged packet with that info is required writeD(0); writeC(0x01); // standing = 1 sitting = 0 writeC(_activeChar.isRunning() ? 1 : 0); // running = 1 walking = 0 writeC(_activeChar.isInCombat() ? 1 : 0); writeC(_activeChar.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 //writeH(_activeChar.getCubics().size()); //for(int id : _activeChar.getCubics().keySet()) // writeH(id); writeC(0x00); // find party members writeD(0x00); writeC(0x00); //Changed by Thorgrim writeH(0x00); //Blue value for name (0 = white, 255 = pure blue) writeD(fpc.clazz); writeD(0x00);//max cp writeD(0x00);//cur cp writeC(fpc.enchantEffect); writeC(fpc.team); //team circle around feet 1= Blue, 2 = red //writeD(_activeChar.getClanCrestLargeId()); //writeC(_activeChar.isNoble() ? 1 : 0); // Symbol on char menu ctrl+I //writeC((_activeChar.isHero() || (_activeChar.isGM() && Config.GM_HERO_AURA)) ? 1 : 0); // Hero Aura writeD(0x00); writeC(0x00); // Symbol on char menu ctrl+I writeC(0x00); // 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(0x00); // isRunning() as in UserInfo? writeD(0x00); writeD(0x00); // ?? writeD(fpc.titleColor); //writeD(0x00); // ?? writeD(0x00); } else {
Code: Select all
-- ---------------------------- -- Table structure for fake_pcs -- ---------------------------- DROP TABLE IF EXISTS `fake_pcs`; CREATE TABLE `fake_pcs` ( `npc_id` INT(11) NOT NULL, `race` INT(11) NOT NULL DEFAULT '0', `sex` INT(11) NOT NULL DEFAULT '0', `class` INT(11) NOT NULL DEFAULT '0', `title` VARCHAR(255) NOT NULL, `title_color` INT(11) NOT NULL DEFAULT '0', `name` VARCHAR(255) NOT NULL, `name_color` INT(11) NOT NULL DEFAULT '0', `hair_style` INT(11) NOT NULL DEFAULT '0', `hair_color` INT(11) NOT NULL DEFAULT '0', `face` INT(11) NOT NULL DEFAULT '0', `mount` TINYINT(4) NOT NULL DEFAULT '0', `team` TINYINT(4) NOT NULL DEFAULT '0', `pd_hairall` TINYINT(4) NOT NULL DEFAULT '0', `pd_under` INT(11) NOT NULL DEFAULT '0', `pd_under_aug` INT(11) NOT NULL DEFAULT '0', `pd_head` INT(11) NOT NULL DEFAULT '0', `pd_head_aug` INT(11) NOT NULL DEFAULT '0', `pd_rhand` INT(11) NOT NULL DEFAULT '0', `pd_rhand_aug` INT(11) NOT NULL DEFAULT '0', `pd_lhand` INT(11) NOT NULL DEFAULT '0', `pd_lhand_aug` INT(11) NOT NULL DEFAULT '0', `pd_gloves` INT(11) NOT NULL DEFAULT '0', `pd_gloves_aug` INT(11) NOT NULL DEFAULT '0', `pd_chest` INT(11) NOT NULL DEFAULT '0', `pd_chest_aug` INT(11) NOT NULL DEFAULT '0', `pd_legs` INT(11) NOT NULL DEFAULT '0', `pd_legs_aug` INT(11) NOT NULL DEFAULT '0', `pd_feet` INT(11) NOT NULL DEFAULT '0', `pd_feet_aug` INT(11) NOT NULL DEFAULT '0', `pd_back` INT(11) NOT NULL DEFAULT '0', `pd_back_aug` INT(11) NOT NULL DEFAULT '0', `pd_lrhand` INT(11) NOT NULL DEFAULT '0', `pd_lrhand_aug` INT(11) NOT NULL DEFAULT '0', `pd_hair` INT(11) NOT NULL DEFAULT '0', `pd_hair_aug` INT(11) NOT NULL DEFAULT '0', `pd_hair2` INT(11) NOT NULL DEFAULT '0', `pd_hair2_aug` INT(11) NOT NULL DEFAULT '0', `pd_rbracelet` INT(11) NOT NULL DEFAULT '0', `pd_rbracelet_aug` INT(11) NOT NULL DEFAULT '0', `pd_lbracelet` INT(11) NOT NULL DEFAULT '0', `pd_lbracelet_aug` INT(11) NOT NULL DEFAULT '0', `pd_deco1` INT(11) NOT NULL DEFAULT '0', `pd_deco1_aug` INT(11) NOT NULL DEFAULT '0', `pd_deco2` INT(11) NOT NULL DEFAULT '0', `pd_deco2_aug` INT(11) NOT NULL DEFAULT '0', `pd_deco3` INT(11) NOT NULL DEFAULT '0', `pd_deco3_aug` INT(11) NOT NULL DEFAULT '0', `pd_deco4` INT(11) NOT NULL DEFAULT '0', `pd_deco4_aug` INT(11) NOT NULL DEFAULT '0', `pd_deco5` INT(11) NOT NULL DEFAULT '0', `pd_deco5_aug` INT(11) NOT NULL DEFAULT '0', `pd_deco6` INT(11) NOT NULL DEFAULT '0', `pd_deco6_aug` INT(11) NOT NULL DEFAULT '0', `enchant_effect` TINYINT(4) NOT NULL DEFAULT '0', `pvp_flag` INT(11) NOT NULL DEFAULT '0', `karma` INT(11) NOT NULL DEFAULT '0', `fishing` TINYINT(4) NOT NULL DEFAULT '0', `fishing_x` INT(11) NOT NULL DEFAULT '0', `fishing_y` INT(11) NOT NULL DEFAULT '0', `fishing_z` INT(11) NOT NULL DEFAULT '0', `invisible` TINYINT(4) NOT NULL DEFAULT '1', PRIMARY KEY (`npc_id`)) ENGINE=MyISAM DEFAULT CHARSET=utf8; -- ---------------------------- -- Records -- ---------------------------- INSERT INTO `fake_pcs` VALUES ('20544', '0', '0', '0', '', '0', 'Elder Keltir', '0', '0', '0', '0', '0','0','0', '0', '0', '0', '0', '6580', '0', '0', '0', '5771', '0', '374', '0', '374', '0', '5783', '0', '0', '0', '6580', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0');
plz someone (if it is possible) can help me????
ty in advanse
sakisd