Рейтинг темы:
  • 2 Голос(ов) - 5 в среднем
  • 1
  • 2
  • 3
  • 4
  • 5
Работа над Goddess of Destruction (part 6)
silvermain Написал:Amaranthe,

вот пакет отвечающий за отображение персонажей в Лобби!
(копия для l2jserver)

CharacterSelectionInfo
Не помогло Оо
Amaranthe,
скрины покажи что у тебя да и как
silvermain Написал:Amaranthe,
скрины покажи что у тебя да и как
в скайп заявку кинул

Добавлено через 6 минут
PHP код:
<?php 
public class CharacterSelectionInfo extends L2GameServerPacket {
// dc cd SdSddddddddddffdQfddddddddddddddddddddddddddddddddddddddddffdddchhdddddffdd
private static final Logger _log = LoggerFactory.getLogger(CharacterSelectionInfo.class);

private
String _loginName;

private
int _sessionId;

private
CharSelectionInfo charSelectionInfo;

public
CharacterSelectionInfo(String loginName, int sessionId) {
_sessionId = sessionId;
_loginName = loginName;
charSelectionInfo = loadCharacterSelectInfo(loginName);
}

public
CharSelectionInfo getCharInfo() {
return
charSelectionInfo;
}

@
Override
protected final void writeImpl() {
int size = charSelectionInfo.size();

writeC(0x09);
writeD(size);
writeD(0x07);
writeC(0x00);
writeC(0x01);
writeC(0x02);// хз у гв всегда 2 поступало
writeD(0x00);

long lastAccess = -1L;
int lastUsed = -1;
for (
CharSelectInfoPackage info : charSelectionInfo) {
if (
lastAccess < info.getLastAccess()) {
lastAccess = info.getLastAccess();
lastUsed++;
}
}
int i = 0;
for (
CharSelectInfoPackage charInfoPackage : charSelectionInfo) {

writeS(charInfoPackage.getName());
writeD(charInfoPackage.getCharId()); // ?
writeS(_loginName);
writeD(_sessionId);
writeD(charInfoPackage.getClanId());
writeD(0x00); // ??

writeD(charInfoPackage.getSex());
writeD(charInfoPackage.getRace());
writeD(charInfoPackage.getBaseClassId());

writeD(0x01); // active ??

writeD(charInfoPackage.getX());
writeD(charInfoPackage.getY());
writeD(charInfoPackage.getZ());

writeF(charInfoPackage.getCurrentHp());
writeF(charInfoPackage.getCurrentMp());

writeD(charInfoPackage.getSp());
writeQ(charInfoPackage.getExp());
int lvl = charInfoPackage.getLevel();
writeF(Experience.getExpPercent(lvl, charInfoPackage.getExp()));
writeD(lvl);

writeD(charInfoPackage.getKarma());
writeD(charInfoPackage.getPk());
writeD(charInfoPackage.getPvP());

// 468 - ? (7)
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0x00);

for (
int PAPERDOLL_ID : Inventory.PAPERDOLL_ORDER)
writeD(charInfoPackage.getPaperdollItemId(PAPERDOLL_ID));


// New Protocol 411
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0x00);
// End Protocol 411

writeD(charInfoPackage.getHairStyle());
writeD(charInfoPackage.getHairColor());
writeD(charInfoPackage.getFace());

writeF(charInfoPackage.getMaxHp()); // hp max
writeF(charInfoPackage.getMaxMp()); // mp max

writeD(charInfoPackage.getAccessLevel() > -100 ? charInfoPackage.getDeleteTimer() : -1);
writeD(charInfoPackage.getClassId());
writeD(i == lastUsed ? 1 : 0);

writeC(Math.min(charInfoPackage.getPaperdollEnchantEffect(Inventory.PAPERDOLL_RHAND), 127));
writeD(charInfoPackage.getPaperdollAugmentationId(Inventory.PAPERDOLL_RHAND));
int weaponId = charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_RHAND);
if (
weaponId == 8190) // Transform id
writeD(301);
else if (
weaponId == 8689)
writeD(302);
else
writeD(0x00);

//TODO: Pet info?
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeF(0x00);
writeF(0x00);

writeD(charSelectionInfo.getVitalityPoints());
writeD(charSelectionInfo.getPremiumAccess() > 0 ? 300 : 200); // Vitality percent
writeD(5); //Vitaliti items count
writeD(charInfoPackage.getAccessLevel() > -100 ? 0x01 : 0x00);

writeC(0x00);
writeC(0x00);
}
}

public static
CharSelectionInfo loadCharacterSelectInfo(String loginName) {
CharSelectionInfo charSelectionInfo = new CharSelectionInfo();

Connection con = null;
PreparedStatement statement = null;
ResultSet rset = null;
try {
con = DatabaseFactory.getInstance().getConnection();
statement = con.prepareStatement("SELECT * FROM characters AS c LEFT JOIN character_subclasses AS cs ON (c.obj_Id=cs.char_obj_id AND cs.active=1) WHERE account_name=? LIMIT 7");
statement.setString(1, loginName);
rset = statement.executeQuery();
while (
rset.next()) { // fills the package
charSelectionInfo.addSelectionInfo(restoreChar(rset));
}
DbUtils.closeQuietly(statement, rset);
statement = con.prepareStatement("SELECT `points` FROM `vitality_points` WHERE `account_name`=?");
statement.setString(1, loginName);
rset = statement.executeQuery();
if (
rset.next()) {
int points = rset.getInt(1);
charSelectionInfo.setVitalityPoints(points);
}
} catch (
Exception e) {
_log.error("could not restore charinfo:", e);
} finally {
DbUtils.closeQuietly(con, statement, rset);
}

return
charSelectionInfo;
}

private static
int[] restoreBaseClassId(int objId) {
int[] classId = new int[2];

Connection con = null;
PreparedStatement statement = null;
ResultSet rset = null;
try {
con = DatabaseFactory.getInstance().getConnection();
statement = con.prepareStatement("SELECT class_id, default_class_id FROM character_subclasses WHERE char_obj_id=? AND type=" + SubClassType.BASE_CLASS.ordinal());
statement.setInt(1, objId);
rset = statement.executeQuery();
while (
rset.next()) {
classId[0] = rset.getInt("class_id");
classId[1] = rset.getInt("default_class_id");
}
} catch (
Exception e) {
_log.error("could not restore base class id:", e);
} finally {
DbUtils.closeQuietly(con, statement, rset);
}

return
classId;
}

private static
CharSelectInfoPackage restoreChar(ResultSet chardata) {
CharSelectInfoPackage charInfopackage = null;
try {
int objectId = chardata.getInt("obj_Id");
int classid = chardata.getInt("class_id");
int[] baseClassId = new int[]{classid, chardata.getInt("default_class_id")};
boolean useBaseClass = chardata.getInt("type") == SubClassType.BASE_CLASS.ordinal();
if (!
useBaseClass)
baseClassId = restoreBaseClassId(objectId);
Race race = ClassId.VALUES[baseClassId[1]].getRace();
String name = chardata.getString("char_name");
charInfopackage = new CharSelectInfoPackage(objectId, name);
charInfopackage.setLevel(chardata.getInt("level"));
charInfopackage.setMaxHp(chardata.getInt("maxHp"));
charInfopackage.setCurrentHp(chardata.getDouble("curHp"));
charInfopackage.setMaxMp(chardata.getInt("maxMp"));
charInfopackage.setCurrentMp(chardata.getDouble("curMp"));

charInfopackage.setX(chardata.getInt("x"));
charInfopackage.setY(chardata.getInt("y"));
charInfopackage.setZ(chardata.getInt("z"));
charInfopackage.setPk(chardata.getInt("pkkills"));
charInfopackage.setPvP(chardata.getInt("pvpkills"));

charInfopackage.setFace(chardata.getInt("face"));
charInfopackage.setHairStyle(chardata.getInt("hairstyle"));
charInfopackage.setHairColor(chardata.getInt("haircolor"));
charInfopackage.setSex(chardata.getInt("sex"));

charInfopackage.setExp(chardata.getLong("exp"));
charInfopackage.setSp(chardata.getInt("sp"));
charInfopackage.setClanId(chardata.getInt("clanid"));

charInfopackage.setKarma(chardata.getInt("karma"));
charInfopackage.setRace(race.ordinal());
charInfopackage.setClassId(classid);
charInfopackage.setBaseClassId(baseClassId[0]);
long deletetime = chardata.getLong("deletetime");
int deletedays = 0;
if (
Config.DELETE_DAYS > 0)
if (
deletetime > 0) {
deletetime = (int) (System.currentTimeMillis() / 1000 - deletetime);
deletedays = (int) (deletetime / 3600 / 24);
if (
deletedays >= Config.DELETE_DAYS) {
CharacterDAO.getInstance().deleteCharByObjId(objectId);
return
null;
}
deletetime = Config.DELETE_DAYS * 3600 * 24 - deletetime;
} else
deletetime = 0;
charInfopackage.setDeleteTimer((int) deletetime);
charInfopackage.setLastAccess(chardata.getLong("lastAccess") * 1000L);
charInfopackage.setAccessLevel(chardata.getInt("accesslevel"));

if (
charInfopackage.getAccessLevel() < 0 && !AutoBan.isBanned(objectId))
charInfopackage.setAccessLevel(0);
} catch (
Exception e) {
_log.error("", e);
}

return
charInfopackage;
}
}

Этот тоже не помог P.S. защиту вырезал в протокол версии , enterworld, gameclient

Добавлено через 1 час 36 минут
L2GameServerPacket возможно?
Amaranthe Написал:в скайп заявку кинул

Добавлено через 6 минут
PHP код:
<?php 
public class CharacterSelectionInfo extends L2GameServerPacket {
// dc cd SdSddddddddddffdQfddddddddddddddddddddddddddddddddddddddddffdddchhdddddffdd
private static final Logger _log = LoggerFactory.getLogger(CharacterSelectionInfo.class);

private
String _loginName;

private
int _sessionId;

private
CharSelectionInfo charSelectionInfo;

public
CharacterSelectionInfo(String loginName, int sessionId) {
_sessionId = sessionId;
_loginName = loginName;
charSelectionInfo = loadCharacterSelectInfo(loginName);
}

public
CharSelectionInfo getCharInfo() {
return
charSelectionInfo;
}

@
Override
protected final void writeImpl() {
int size = charSelectionInfo.size();

writeC(0x09);
writeD(size);
writeD(0x07);
writeC(0x00);
writeC(0x01);
writeC(0x02);// хз у гв всегда 2 поступало
writeD(0x00);

long lastAccess = -1L;
int lastUsed = -1;
for (
CharSelectInfoPackage info : charSelectionInfo) {
if (
lastAccess < info.getLastAccess()) {
lastAccess = info.getLastAccess();
lastUsed++;
}
}
int i = 0;
for (
CharSelectInfoPackage charInfoPackage : charSelectionInfo) {

writeS(charInfoPackage.getName());
writeD(charInfoPackage.getCharId()); // ?
writeS(_loginName);
writeD(_sessionId);
writeD(charInfoPackage.getClanId());
writeD(0x00); // ??

writeD(charInfoPackage.getSex());
writeD(charInfoPackage.getRace());
writeD(charInfoPackage.getBaseClassId());

writeD(0x01); // active ??

writeD(charInfoPackage.getX());
writeD(charInfoPackage.getY());
writeD(charInfoPackage.getZ());

writeF(charInfoPackage.getCurrentHp());
writeF(charInfoPackage.getCurrentMp());

writeD(charInfoPackage.getSp());
writeQ(charInfoPackage.getExp());
int lvl = charInfoPackage.getLevel();
writeF(Experience.getExpPercent(lvl, charInfoPackage.getExp()));
writeD(lvl);

writeD(charInfoPackage.getKarma());
writeD(charInfoPackage.getPk());
writeD(charInfoPackage.getPvP());

// 468 - ? (7)
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0x00);

for (
int PAPERDOLL_ID : Inventory.PAPERDOLL_ORDER)
writeD(charInfoPackage.getPaperdollItemId(PAPERDOLL_ID));


// New Protocol 411
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0x00);
// End Protocol 411

writeD(charInfoPackage.getHairStyle());
writeD(charInfoPackage.getHairColor());
writeD(charInfoPackage.getFace());

writeF(charInfoPackage.getMaxHp()); // hp max
writeF(charInfoPackage.getMaxMp()); // mp max

writeD(charInfoPackage.getAccessLevel() > -100 ? charInfoPackage.getDeleteTimer() : -1);
writeD(charInfoPackage.getClassId());
writeD(i == lastUsed ? 1 : 0);

writeC(Math.min(charInfoPackage.getPaperdollEnchantEffect(Inventory.PAPERDOLL_RHAND), 127));
writeD(charInfoPackage.getPaperdollAugmentationId(Inventory.PAPERDOLL_RHAND));
int weaponId = charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_RHAND);
if (
weaponId == 8190) // Transform id
writeD(301);
else if (
weaponId == 8689)
writeD(302);
else
writeD(0x00);

//TODO: Pet info?
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeF(0x00);
writeF(0x00);

writeD(charSelectionInfo.getVitalityPoints());
writeD(charSelectionInfo.getPremiumAccess() > 0 ? 300 : 200); // Vitality percent
writeD(5); //Vitaliti items count
writeD(charInfoPackage.getAccessLevel() > -100 ? 0x01 : 0x00);

writeC(0x00);
writeC(0x00);
}
}

public static
CharSelectionInfo loadCharacterSelectInfo(String loginName) {
CharSelectionInfo charSelectionInfo = new CharSelectionInfo();

Connection con = null;
PreparedStatement statement = null;
ResultSet rset = null;
try {
con = DatabaseFactory.getInstance().getConnection();
statement = con.prepareStatement("SELECT * FROM characters AS c LEFT JOIN character_subclasses AS cs ON (c.obj_Id=cs.char_obj_id AND cs.active=1) WHERE account_name=? LIMIT 7");
statement.setString(1, loginName);
rset = statement.executeQuery();
while (
rset.next()) { // fills the package
charSelectionInfo.addSelectionInfo(restoreChar(rset));
}
DbUtils.closeQuietly(statement, rset);
statement = con.prepareStatement("SELECT `points` FROM `vitality_points` WHERE `account_name`=?");
statement.setString(1, loginName);
rset = statement.executeQuery();
if (
rset.next()) {
int points = rset.getInt(1);
charSelectionInfo.setVitalityPoints(points);
}
} catch (
Exception e) {
_log.error("could not restore charinfo:", e);
} finally {
DbUtils.closeQuietly(con, statement, rset);
}

return
charSelectionInfo;
}

private static
int[] restoreBaseClassId(int objId) {
int[] classId = new int[2];

Connection con = null;
PreparedStatement statement = null;
ResultSet rset = null;
try {
con = DatabaseFactory.getInstance().getConnection();
statement = con.prepareStatement("SELECT class_id, default_class_id FROM character_subclasses WHERE char_obj_id=? AND type=" + SubClassType.BASE_CLASS.ordinal());
statement.setInt(1, objId);
rset = statement.executeQuery();
while (
rset.next()) {
classId[0] = rset.getInt("class_id");
classId[1] = rset.getInt("default_class_id");
}
} catch (
Exception e) {
_log.error("could not restore base class id:", e);
} finally {
DbUtils.closeQuietly(con, statement, rset);
}

return
classId;
}

private static
CharSelectInfoPackage restoreChar(ResultSet chardata) {
CharSelectInfoPackage charInfopackage = null;
try {
int objectId = chardata.getInt("obj_Id");
int classid = chardata.getInt("class_id");
int[] baseClassId = new int[]{classid, chardata.getInt("default_class_id")};
boolean useBaseClass = chardata.getInt("type") == SubClassType.BASE_CLASS.ordinal();
if (!
useBaseClass)
baseClassId = restoreBaseClassId(objectId);
Race race = ClassId.VALUES[baseClassId[1]].getRace();
String name = chardata.getString("char_name");
charInfopackage = new CharSelectInfoPackage(objectId, name);
charInfopackage.setLevel(chardata.getInt("level"));
charInfopackage.setMaxHp(chardata.getInt("maxHp"));
charInfopackage.setCurrentHp(chardata.getDouble("curHp"));
charInfopackage.setMaxMp(chardata.getInt("maxMp"));
charInfopackage.setCurrentMp(chardata.getDouble("curMp"));

charInfopackage.setX(chardata.getInt("x"));
charInfopackage.setY(chardata.getInt("y"));
charInfopackage.setZ(chardata.getInt("z"));
charInfopackage.setPk(chardata.getInt("pkkills"));
charInfopackage.setPvP(chardata.getInt("pvpkills"));

charInfopackage.setFace(chardata.getInt("face"));
charInfopackage.setHairStyle(chardata.getInt("hairstyle"));
charInfopackage.setHairColor(chardata.getInt("haircolor"));
charInfopackage.setSex(chardata.getInt("sex"));

charInfopackage.setExp(chardata.getLong("exp"));
charInfopackage.setSp(chardata.getInt("sp"));
charInfopackage.setClanId(chardata.getInt("clanid"));

charInfopackage.setKarma(chardata.getInt("karma"));
charInfopackage.setRace(race.ordinal());
charInfopackage.setClassId(classid);
charInfopackage.setBaseClassId(baseClassId[0]);
long deletetime = chardata.getLong("deletetime");
int deletedays = 0;
if (
Config.DELETE_DAYS > 0)
if (
deletetime > 0) {
deletetime = (int) (System.currentTimeMillis() / 1000 - deletetime);
deletedays = (int) (deletetime / 3600 / 24);
if (
deletedays >= Config.DELETE_DAYS) {
CharacterDAO.getInstance().deleteCharByObjId(objectId);
return
null;
}
deletetime = Config.DELETE_DAYS * 3600 * 24 - deletetime;
} else
deletetime = 0;
charInfopackage.setDeleteTimer((int) deletetime);
charInfopackage.setLastAccess(chardata.getLong("lastAccess") * 1000L);
charInfopackage.setAccessLevel(chardata.getInt("accesslevel"));

if (
charInfopackage.getAccessLevel() < 0 && !AutoBan.isBanned(objectId))
charInfopackage.setAccessLevel(0);
} catch (
Exception e) {
_log.error("", e);
}

return
charInfopackage;
}
}

Этот тоже не помог P.S. защиту вырезал в протокол версии , enterworld, gameclient

Добавлено через 1 час 36 минут
L2GameServerPacket возможно?
прости, занят был, какая защита? + что ты вырезал в протокол версии + в Enterworld ? + у меня в l2j без созданного персонажа на High Five нормально заходило в лобби, без изменений пакетов!!!
Mifesto Написал:может кто сталкивался с такой же проблемой, хочу посадить перса на Личную мастерскую, в пакете RequestRecipeShopListSet после всех проверок вызываю
Код:
if(!createList.isEmpty())
        {
            manufacturer.setCreateList(createList);
            manufacturer.saveTradeList();
            manufacturer.setPrivateStoreType(Player.STORE_PRIVATE_MANUFACTURE);
            manufacturer.broadcastPacket(new RecipeShopMsgPacket(manufacturer));
            manufacturer.sitDown(null);
            manufacturer.broadcastCharInfo();
        }


при этом персонаж просто садится, но после этого мне присылается пакет RequestRecipeShopManageQuit и отменяет лавку, может кто знает из-за чего может клиент присылать RequestRecipeShopManageQuit? одно из условий это нажатие клавиши отмены, а еще каике есть?
Код:
                        case 0xbc:
                            //msg = new RequestRecipeShopManageQuit();
                            break;
Big Grin
ура и я наконец то это сделал, спасибо большое за помощь Bonux.
Скрин
iquelite Написал:
Код:
                        case 0xbc:
                            //msg = new RequestRecipeShopManageQuit();
                            break;
Big Grin

не вариант, думаю что будут свои проблемы.
Код:
manufacturer.sitDown(null);

Персонаж торгует стоя? Или это новый метод сажать чара? :eek:
Donatte Написал:
Код:
manufacturer.sitDown(null);

Персонаж торгует стоя? Или это новый метод сажать чара? :eek:

на самом деле старый,

-
Mifesto Написал:на самом деле старый,

-

Странный код. В лыжах не используется статический объект.


Возможно похожие темы ...
Тема Автор Ответы Просмотры Последний пост
  Работа над Goddess of Destruction (part 7) n3k0nation 459 174,303 03-21-2022, 04:21 PM
Последний пост: TieLay
  Помогите с Сервером L2Dream версии 439 для Lineage 2 Gracia Part 2 CAHTEX 4 3,380 10-01-2021, 02:40 PM
Последний пост: tenor
  Работа с камерой и Энтер чат FriendlyGhost 0 1,302 04-29-2018, 06:07 AM
Последний пост: FriendlyGhost
  Goddess of Destruction ( новая ветка от NcSoft ) Bacek 180 59,013 08-22-2017, 12:32 PM
Последний пост: BadStealth
  EmuRT Gracia part 2 ? knaif 3 1,622 02-08-2016, 01:19 PM
Последний пост: knaif
  Gracia Part 1 от l2emu исходы TFH 6 1,965 10-05-2015, 07:53 PM
Последний пост: G1ta0
  Ищу исходы L2-Dream gracia part 2 knaif 1 1,386 10-05-2015, 07:51 PM
Последний пост: G1ta0
  Оплачиваемая работа Grek1993 1 1,349 08-01-2015, 11:29 AM
Последний пост: ztaecz
  Работа с мультиселлом Evencelance 11 2,446 09-19-2014, 12:43 PM
Последний пост: Evencelance
  Работа над Goddess of Destruction (part 5) Ozzy 980 339,195 10-09-2013, 09:13 AM
Последний пост: Ashe

Перейти к форуму:


Пользователи, просматривающие эту тему: 12 Гость(ей)