Сообщений: 441
Тем: 15
Зарегистрирован: Oct 2012
Репутация:
3,319
Вопрос по новым абилкам эпизода: при попытке купить одно очко клиент отправляет RequestChangeAbilityPoint? Если да, то какая у него структура? В дампе ее нет
Сообщений: 466
Тем: 10
Зарегистрирован: Dec 2012
Репутация:
398
elastic Написал:Вопрос по новым абилкам эпизода: при попытке купить одно очко клиент отправляет RequestChangeAbilityPoint? Если да, то какая у него структура? В дампе ее нет
[src='c++']
int __thiscall UNetworkHandler::RequestChangeAbilityPoint(int this)
{
int result; // eax@1
int v2; // [sp+0h] [bp-2Ch]@1
int *v3; // [sp+1Ch] [bp-10h]@1
int v4; // [sp+28h] [bp-4h]@1
v3 = &v2;
v4 = 0;
(*(void (__cdecl **)(_DWORD, _DWORD, signed int, signed int))(**(_DWORD **)(this + 72) + 108))(
*(_DWORD *)(this + 72),
"ch",
208,
236);
result = *(_DWORD *)dword_205A4400;
if ( *(_DWORD *)dword_205A4400 )
result = v15051730(result, L"(Send)%s", &asc_2064D158[17]);
return result;
}
[/src]
ch - опкод. То есть у него структура "пустая", а runImpl() идет снятие SP, добавление абилити-очка и отправка ExAcquireAPSkillList.
И это, лучше всего делать реверс в C++ с помощью IDA, ибо в нем больше инфы.
Сообщений: 102
Тем: 0
Зарегистрирован: Dec 2012
Репутация:
139
09-25-2014, 01:36 PM
(Сообщение последний раз редактировалось: 09-25-2014, 02:23 PM silvermain.)
Доброго времени суток Господа
Эртейки у меня по воздуху летают=))))
кто может помочь с данной проблемой? Collision`ы выставлял различные, толку 0
+ так и не могу разобраться с брошками=((( в неё камни не влазят, словно ювелир с размером накосячил+)
Сообщений: 441
Тем: 15
Зарегистрирован: Oct 2012
Репутация:
3,319
silvermain Написал:Доброго времени суток Господа
Эртейки у меня по воздуху летают=))))
кто может помочь с данной проблемой? Collision`ы выставлял различные, толку 0
+ так и не могу разобраться с брошками=((( в неё камни не влазят, словно ювелир с размером накосячил+) Такое только с артейками или со всеми? Если со всеми, то ищите косяк в UserInfo. Если нет, то смотрите, где задаются колижены для всех остальных рас.
По второму: скорее всего со слотами накосячили.
Сообщений: 102
Тем: 0
Зарегистрирован: Dec 2012
Репутация:
139
elastic Написал:Такое только с артейками или со всеми? Если со всеми, то ищите косяк в UserInfo. Если нет, то смотрите, где задаются колижены для всех остальных рас.
По второму: скорее всего со слотами накосячили.
1-е такое только с Артейками
Заранее камнями не кидаться=)
2-е ммм, я так и не понял как правильно прописать брошки и камушки=)
10 раз перечитывал как должно получиться, и толку 0
у меня так:
L2Item
PHP код: <?php
public static final long SLOT_BROACH = 0x20000000L;
public static final long SLOT_STONE = 0x40000000L;
Inventory
PHP код: <?php
public static final int PAPERDOLL_UNDER = 0;
public static final int PAPERDOLL_HEAD = 1;
public static final int PAPERDOLL_HAIR = 2;
public static final int PAPERDOLL_HAIR2 = 3;
public static final int PAPERDOLL_NECK = 4;
public static final int PAPERDOLL_RHAND = 5;
public static final int PAPERDOLL_CHEST = 6;
public static final int PAPERDOLL_LHAND = 7;
public static final int PAPERDOLL_REAR = 8;
public static final int PAPERDOLL_LEAR = 9;
public static final int PAPERDOLL_GLOVES = 10;
public static final int PAPERDOLL_LEGS = 11;
public static final int PAPERDOLL_FEET = 12;
public static final int PAPERDOLL_RFINGER = 13;
public static final int PAPERDOLL_LFINGER = 14;
public static final int PAPERDOLL_LBRACELET = 15;
public static final int PAPERDOLL_RBRACELET = 16;
public static final int PAPERDOLL_DECO1 = 17;
public static final int PAPERDOLL_DECO2 = 18;
public static final int PAPERDOLL_DECO3 = 19;
public static final int PAPERDOLL_DECO4 = 20;
public static final int PAPERDOLL_DECO5 = 21;
public static final int PAPERDOLL_DECO6 = 22;
public static final int PAPERDOLL_CLOAK = 23;
public static final int PAPERDOLL_BELT = 24;
public static final int PAPERDOLL_BROACH = 25;
public static final int PAPERDOLL_STONE1 = 26;
public static final int PAPERDOLL_STONE2 = 27;
public static final int PAPERDOLL_STONE3 = 28;
public static final int PAPERDOLL_STONE4 = 29;
public static final int PAPERDOLL_STONE5 = 30;
public static final int PAPERDOLL_STONE6 = 31;
public static final int PAPERDOLL_TOTALSLOTS = 32;
+ ко всему, если отправляю в CharacterSelectionInfo всё сразу, то у меня начинает тупить и в лобби все серые и не активные
L2GameServerPacket
PHP код: <?php
private static final int[] PAPERDOLL_ORDER = new int[]
{
Inventory.PAPERDOLL_UNDER,
Inventory.PAPERDOLL_REAR,
Inventory.PAPERDOLL_LEAR,
Inventory.PAPERDOLL_NECK,
Inventory.PAPERDOLL_RFINGER,
Inventory.PAPERDOLL_LFINGER,
Inventory.PAPERDOLL_HEAD,
Inventory.PAPERDOLL_RHAND,
Inventory.PAPERDOLL_LHAND,
Inventory.PAPERDOLL_GLOVES,
Inventory.PAPERDOLL_CHEST,
Inventory.PAPERDOLL_LEGS,
Inventory.PAPERDOLL_FEET,
Inventory.PAPERDOLL_CLOAK,
Inventory.PAPERDOLL_RHAND,
Inventory.PAPERDOLL_HAIR,
Inventory.PAPERDOLL_HAIR2,
Inventory.PAPERDOLL_RBRACELET,
Inventory.PAPERDOLL_LBRACELET,
Inventory.PAPERDOLL_DECO1,
Inventory.PAPERDOLL_DECO2,
Inventory.PAPERDOLL_DECO3,
Inventory.PAPERDOLL_DECO4,
Inventory.PAPERDOLL_DECO5,
Inventory.PAPERDOLL_DECO6,
Inventory.PAPERDOLL_BELT
//Inventory.PAPERDOLL_BROACH,
//Inventory.PAPERDOLL_STONE1,
//Inventory.PAPERDOLL_STONE2,
//Inventory.PAPERDOLL_STONE3,
//Inventory.PAPERDOLL_STONE4,
//Inventory.PAPERDOLL_STONE5,
//Inventory.PAPERDOLL_STONE6
};
Сообщений: 441
Тем: 15
Зарегистрирован: Oct 2012
Репутация:
3,319
silvermain Написал:1-е такое только с Артейками
Заранее камнями не кидаться=)
2-е ммм, я так и не понял как правильно прописать брошки и камушки=)
10 раз перечитывал как должно получиться, и толку 0
у меня так:
L2Item
PHP код: <?php
public static final long SLOT_BROACH = 0x20000000L;
public static final long SLOT_STONE = 0x40000000L;
Inventory
PHP код: <?php
public static final int PAPERDOLL_UNDER = 0;
public static final int PAPERDOLL_HEAD = 1;
public static final int PAPERDOLL_HAIR = 2;
public static final int PAPERDOLL_HAIR2 = 3;
public static final int PAPERDOLL_NECK = 4;
public static final int PAPERDOLL_RHAND = 5;
public static final int PAPERDOLL_CHEST = 6;
public static final int PAPERDOLL_LHAND = 7;
public static final int PAPERDOLL_REAR = 8;
public static final int PAPERDOLL_LEAR = 9;
public static final int PAPERDOLL_GLOVES = 10;
public static final int PAPERDOLL_LEGS = 11;
public static final int PAPERDOLL_FEET = 12;
public static final int PAPERDOLL_RFINGER = 13;
public static final int PAPERDOLL_LFINGER = 14;
public static final int PAPERDOLL_LBRACELET = 15;
public static final int PAPERDOLL_RBRACELET = 16;
public static final int PAPERDOLL_DECO1 = 17;
public static final int PAPERDOLL_DECO2 = 18;
public static final int PAPERDOLL_DECO3 = 19;
public static final int PAPERDOLL_DECO4 = 20;
public static final int PAPERDOLL_DECO5 = 21;
public static final int PAPERDOLL_DECO6 = 22;
public static final int PAPERDOLL_CLOAK = 23;
public static final int PAPERDOLL_BELT = 24;
public static final int PAPERDOLL_BROACH = 25;
public static final int PAPERDOLL_STONE1 = 26;
public static final int PAPERDOLL_STONE2 = 27;
public static final int PAPERDOLL_STONE3 = 28;
public static final int PAPERDOLL_STONE4 = 29;
public static final int PAPERDOLL_STONE5 = 30;
public static final int PAPERDOLL_STONE6 = 31;
public static final int PAPERDOLL_TOTALSLOTS = 32;
+ ко всему, если отправляю в CharacterSelectionInfo всё сразу, то у меня начинает тупить и в лобби все серые и не активные
L2GameServerPacket
PHP код: <?php
private static final int[] PAPERDOLL_ORDER = new int[]
{
Inventory.PAPERDOLL_UNDER,
Inventory.PAPERDOLL_REAR,
Inventory.PAPERDOLL_LEAR,
Inventory.PAPERDOLL_NECK,
Inventory.PAPERDOLL_RFINGER,
Inventory.PAPERDOLL_LFINGER,
Inventory.PAPERDOLL_HEAD,
Inventory.PAPERDOLL_RHAND,
Inventory.PAPERDOLL_LHAND,
Inventory.PAPERDOLL_GLOVES,
Inventory.PAPERDOLL_CHEST,
Inventory.PAPERDOLL_LEGS,
Inventory.PAPERDOLL_FEET,
Inventory.PAPERDOLL_CLOAK,
Inventory.PAPERDOLL_RHAND,
Inventory.PAPERDOLL_HAIR,
Inventory.PAPERDOLL_HAIR2,
Inventory.PAPERDOLL_RBRACELET,
Inventory.PAPERDOLL_LBRACELET,
Inventory.PAPERDOLL_DECO1,
Inventory.PAPERDOLL_DECO2,
Inventory.PAPERDOLL_DECO3,
Inventory.PAPERDOLL_DECO4,
Inventory.PAPERDOLL_DECO5,
Inventory.PAPERDOLL_DECO6,
Inventory.PAPERDOLL_BELT
//Inventory.PAPERDOLL_BROACH,
//Inventory.PAPERDOLL_STONE1,
//Inventory.PAPERDOLL_STONE2,
//Inventory.PAPERDOLL_STONE3,
//Inventory.PAPERDOLL_STONE4,
//Inventory.PAPERDOLL_STONE5,
//Inventory.PAPERDOLL_STONE6
};
В лобби и надо отправлять все слоты. Кто-то скидывал структуру пакета CharacterSelectionInfo, там после D-шки pvp есть цикл с отправкой 14-ти D-шек.
Цитата:for (int j = 0; j < 14; j++)
{
writeD(0x00);
}
Убавьте до 7, ибо остальные 7 - и есть брошка и камушки.
Чтобы брошь и камни одевались, Вам нужно изменить те методы, где используются остальные слоты. Сделайте по примеру браслета и талисманов, все то же самое.
Сообщений: 102
Тем: 0
Зарегистрирован: Dec 2012
Репутация:
139
elastic Написал:В лобби и надо отправлять все слоты. Кто-то скидывал структуру пакета CharacterSelectionInfo, там после D-шки pvp есть цикл с отправкой 14-ти D-шек.
Убавьте до 7, ибо остальные 7 - и есть брошка и камушки.
Чтобы брошь и камни одевались, Вам нужно изменить те методы, где используются остальные слоты. Сделайте по примеру браслета и талисманов, все то же самое.
CharSelectionInfo
PHP код: <?php
/*
* Copyright (C) 2004-2014 L2J Server
*
* This file is part of L2J Server.
*
* L2J Server 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.
*
* L2J Server 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.network.serverpackets.lobby;
import com.l2jserver.Config;
import com.l2jserver.L2DatabaseFactory;
import com.l2jserver.gameserver.datatables.ClanTable;
import com.l2jserver.gameserver.datatables.ExperienceTable;
import com.l2jserver.gameserver.model.CharSelectInfoPackage;
import com.l2jserver.gameserver.model.L2Clan;
import com.l2jserver.gameserver.model.itemcontainer.Inventory;
import com.l2jserver.gameserver.network.L2GameClient;
import com.l2jserver.gameserver.network.serverpackets.L2GameServerPacket;
import javolution.util.FastList;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
public class CharSelectionInfo extends L2GameServerPacket
{
private static Logger _log = Logger.getLogger(CharSelectionInfo.class.getName());
private final String _loginName;
private final int _sessionId;
private int _activeId;
private final CharSelectInfoPackage[] _characterPackages;
/**
* Constructor for CharSelectionInfo.
* @param loginName
* @param sessionId
*/
public CharSelectionInfo(String loginName, int sessionId)
{
_sessionId = sessionId;
_loginName = loginName;
_characterPackages = loadCharacterSelectInfo(_loginName);
_activeId = -1;
}
public CharSelectionInfo(String loginName, int sessionId, int activeId)
{
_sessionId = sessionId;
_loginName = loginName;
_characterPackages = loadCharacterSelectInfo(_loginName);
_activeId = activeId;
}
public CharSelectInfoPackage[] getCharInfo()
{
return _characterPackages;
}
@Override
protected final void writeImpl()
{
writeC(0x09);
int size = (_characterPackages.length);
writeD(size);
// Can prevent players from creating new characters (if 0); (if 1, the client will ask if chars may be created (0x13) Response: (0x0D) )
writeD(Config.MAX_CHARACTERS_NUMBER_PER_ACCOUNT);
writeC(0x00);
writeC(0x01); // 603
writeD(0x02); // 603
writeC(0x00); // 603
long lastAccess = 0L;
if (_activeId == -1)
{
for (int i = 0; i < size; i++)
{
if (lastAccess < _characterPackages[i].getLastAccess())
{
lastAccess = _characterPackages[i].getLastAccess();
_activeId = i;
}
}
}
for (int i = 0; i < size; i++)
{
CharSelectInfoPackage charInfoPackage = _characterPackages[i];
writeS(charInfoPackage.getName());
writeD(charInfoPackage.getObjectId());
writeS(_loginName);
writeD(_sessionId);
writeD(charInfoPackage.getClanId());
writeD(0x00); // ??
writeD(charInfoPackage.getSex());
writeD(charInfoPackage.getRace());
if (charInfoPackage.getClassId() == charInfoPackage.getBaseClassId())
{
writeD(charInfoPackage.getClassId());
}
else
{
writeD(charInfoPackage.getBaseClassId());
}
writeD(0x01); // active ??
writeD(charInfoPackage.getX());
writeD(charInfoPackage.getY());
writeD(charInfoPackage.getZ());
writeF(charInfoPackage.getCurrentHp());
writeF(charInfoPackage.getCurrentMp());
writeQ(charInfoPackage.getSp()); // 603
writeQ(charInfoPackage.getExp());
writeF((float) (charInfoPackage.getExp() - ExperienceTable.getInstance().getExpForLevel(charInfoPackage.getLevel())) / (ExperienceTable.getInstance().getExpForLevel(charInfoPackage.getLevel() + 1) - ExperienceTable.getInstance().getExpForLevel(charInfoPackage.getLevel()))); // High Five
// exp %
writeD(charInfoPackage.getLevel());
int Karma = 0 - charInfoPackage.getKarma(); // 603-Test
writeD(Karma); // 603-Test
writeD(charInfoPackage.getPkKills());
writeD(charInfoPackage.getPvPKills());
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0); // 603
writeD(0); // 603
for (int slot : getPaperdollOrder())
{
writeD(charInfoPackage.getPaperdollItemId(slot));
}
writeD(0); // 603
writeD(0); // 603
writeD(0); // 603
writeD(0); // 603
writeD(0); // 603
writeD(0); // 603
writeD(0); // 603
writeD(0); // 603
writeD(0); // 603
writeD(0);
writeD(0);
writeD(0);
writeD(0);
writeD(0);
writeD(0);
writeD(0);
writeH(0); // 603
writeH(0); // 603
writeH(0); // 603
writeH(0); // 603
writeH(0); // 603
writeD(charInfoPackage.getHairStyle());
writeD(charInfoPackage.getHairColor());
writeD(charInfoPackage.getFace());
writeF(charInfoPackage.getMaxHp()); // hp max
writeF(charInfoPackage.getMaxMp()); // mp max
long deleteTime = charInfoPackage.getDeleteTimer();
int deletedays = 0;
if (deleteTime > 0)
{
deletedays = (int) ((deleteTime - System.currentTimeMillis()) / 1000);
}
writeD(deletedays); // days left before
// delete .. if != 0
// then char is inactive
writeD(charInfoPackage.getClassId());
writeD(i == _activeId ? 0x01 : 0x00); // c3 auto-select char
writeC(charInfoPackage.getEnchantEffect() > 127 ? 127 : charInfoPackage.getEnchantEffect());
writeD(charInfoPackage.getAugmentationId()); // 603
writeD(0x00); // Currently on retail when you are on character select you don't see your transformation.
writeD(0x00); // npdid - 16024 Tame Tiny Baby Kookaburra A9E89C
writeD(0x00); // level
writeD(0x00); // ?
writeD(0x00); // food? - 1200
writeF(0x00); // max Hp
writeF(0x00); // cur Hp
// High Five by Vistall:
writeD(charInfoPackage.getVitalityPoints()); // H5 Vitality
writeD(200); // 603
writeD(5); // 603 systemmsg-6073 $s1 vitality items can be used
writeD(charInfoPackage.getAccessLevel() > -100 ? 0x01 : 0x00); // 603 1 = active / 0 = not active
writeC(0); // 603 awake = 1???
writeC(0); // 603
writeC(1); // 603
}
}
private static CharSelectInfoPackage[] loadCharacterSelectInfo(String loginName)
{
CharSelectInfoPackage charInfopackage;
List<CharSelectInfoPackage> characterList = new FastList<>();
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
PreparedStatement statement = con.prepareStatement("SELECT * FROM characters WHERE account_name=? ORDER BY createDate"))
{
statement.setString(1, loginName);
try (ResultSet charList = statement.executeQuery())
{
while (charList.next())// fills the package
{
charInfopackage = restoreChar(charList);
if (charInfopackage != null)
{
characterList.add(charInfopackage);
}
}
}
return characterList.toArray(new CharSelectInfoPackage[characterList.size()]);
}
catch (Exception e)
{
_log.log(Level.WARNING, "Could not restore char info: " + e.getMessage(), e);
}
return new CharSelectInfoPackage[0];
}
private static void loadCharacterSubclassInfo(CharSelectInfoPackage charInfopackage, int ObjectId, int activeClassId)
{
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
PreparedStatement statement = con.prepareStatement("SELECT exp, sp, level FROM character_subclasses WHERE charId=? && class_id=? ORDER BY charId"))
{
statement.setInt(1, ObjectId);
statement.setInt(2, activeClassId);
try (ResultSet charList = statement.executeQuery())
{
if (charList.next())
{
charInfopackage.setExp(charList.getLong("exp"));
charInfopackage.setSp(charList.getInt("sp"));
charInfopackage.setLevel(charList.getInt("level"));
}
}
}
catch (Exception e)
{
_log.log(Level.WARNING, "Could not restore char subclass info: " + e.getMessage(), e);
}
}
private static CharSelectInfoPackage restoreChar(ResultSet chardata) throws Exception
{
int objectId = chardata.getInt("charId");
String name = chardata.getString("char_name");
// See if the char must be deleted
long deletetime = chardata.getLong("deletetime");
if (deletetime > 0)
{
if (System.currentTimeMillis() > deletetime)
{
L2Clan clan = ClanTable.getInstance().getClan(chardata.getInt("clanid"));
if (clan != null)
{
clan.removeClanMember(objectId, 0);
}
L2GameClient.deleteCharByObjId(objectId);
return null;
}
}
CharSelectInfoPackage charInfopackage = new CharSelectInfoPackage(objectId, name);
charInfopackage.setAccessLevel(chardata.getInt("accesslevel"));
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.setKarma(chardata.getInt("karma"));
charInfopackage.setPkKills(chardata.getInt("pkkills"));
charInfopackage.setPvPKills(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.setVitalityPoints(chardata.getInt("vitality_points"));
charInfopackage.setClanId(chardata.getInt("clanid"));
charInfopackage.setRace(chardata.getInt("race"));
final int baseClassId = chardata.getInt("base_class");
final int activeClassId = chardata.getInt("classid");
charInfopackage.setX(chardata.getInt("x"));
charInfopackage.setY(chardata.getInt("y"));
charInfopackage.setZ(chardata.getInt("z"));
if (Config.L2JMOD_MULTILANG_ENABLE)
{
String lang = chardata.getString("language");
if (!Config.L2JMOD_MULTILANG_ALLOWED.contains(lang))
{
lang = Config.L2JMOD_MULTILANG_DEFAULT;
}
charInfopackage.setHtmlPrefix("data/lang/" + lang + "/");
}
// if is in subclass, load subclass exp, sp, lvl info
if (baseClassId != activeClassId)
{
loadCharacterSubclassInfo(charInfopackage, objectId, activeClassId);
}
charInfopackage.setClassId(activeClassId);
// Get the augmentation id for equipped weapon
int weaponObjId = charInfopackage.getPaperdollObjectId(Inventory.PAPERDOLL_RHAND);
if (weaponObjId < 1)
{
weaponObjId = charInfopackage.getPaperdollObjectId(Inventory.PAPERDOLL_RHAND);
}
if (weaponObjId > 0)
{
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
PreparedStatement statement = con.prepareStatement("SELECT augAttributes FROM item_attributes WHERE itemId=?"))
{
statement.setInt(1, weaponObjId);
try (ResultSet result = statement.executeQuery())
{
if (result.next())
{
int augment = result.getInt("augAttributes");
charInfopackage.setAugmentationId(augment == -1 ? 0 : augment);
}
}
}
catch (Exception e)
{
_log.log(Level.WARNING, "Could not restore augmentation info: " + e.getMessage(), e);
}
}
// Check if the base class is set to zero and also doesn't match with the current active class, otherwise send the base class ID. This prevents chars created before base class was introduced from being displayed incorrectly.
if ((baseClassId == 0) && (activeClassId > 0))
{
charInfopackage.setBaseClassId(activeClassId);
}
else
{
charInfopackage.setBaseClassId(baseClassId);
}
charInfopackage.setDeleteTimer(deletetime);
charInfopackage.setLastAccess(chardata.getLong("lastAccess"));
return charInfopackage;
}
}
вот так у меня, и понять не могу почему=(((
Сообщений: 441
Тем: 15
Зарегистрирован: Oct 2012
Репутация:
3,319
silvermain Написал:
CharSelectionInfo
PHP код: <?php
/*
* Copyright (C) 2004-2014 L2J Server
*
* This file is part of L2J Server.
*
* L2J Server 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.
*
* L2J Server 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.network.serverpackets.lobby;
import com.l2jserver.Config;
import com.l2jserver.L2DatabaseFactory;
import com.l2jserver.gameserver.datatables.ClanTable;
import com.l2jserver.gameserver.datatables.ExperienceTable;
import com.l2jserver.gameserver.model.CharSelectInfoPackage;
import com.l2jserver.gameserver.model.L2Clan;
import com.l2jserver.gameserver.model.itemcontainer.Inventory;
import com.l2jserver.gameserver.network.L2GameClient;
import com.l2jserver.gameserver.network.serverpackets.L2GameServerPacket;
import javolution.util.FastList;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
public class CharSelectionInfo extends L2GameServerPacket
{
private static Logger _log = Logger.getLogger(CharSelectionInfo.class.getName());
private final String _loginName;
private final int _sessionId;
private int _activeId;
private final CharSelectInfoPackage[] _characterPackages;
/**
* Constructor for CharSelectionInfo.
* @param loginName
* @param sessionId
*/
public CharSelectionInfo(String loginName, int sessionId)
{
_sessionId = sessionId;
_loginName = loginName;
_characterPackages = loadCharacterSelectInfo(_loginName);
_activeId = -1;
}
public CharSelectionInfo(String loginName, int sessionId, int activeId)
{
_sessionId = sessionId;
_loginName = loginName;
_characterPackages = loadCharacterSelectInfo(_loginName);
_activeId = activeId;
}
public CharSelectInfoPackage[] getCharInfo()
{
return _characterPackages;
}
@Override
protected final void writeImpl()
{
writeC(0x09);
int size = (_characterPackages.length);
writeD(size);
// Can prevent players from creating new characters (if 0); (if 1, the client will ask if chars may be created (0x13) Response: (0x0D) )
writeD(Config.MAX_CHARACTERS_NUMBER_PER_ACCOUNT);
writeC(0x00);
writeC(0x01); // 603
writeD(0x02); // 603
writeC(0x00); // 603
long lastAccess = 0L;
if (_activeId == -1)
{
for (int i = 0; i < size; i++)
{
if (lastAccess < _characterPackages[i].getLastAccess())
{
lastAccess = _characterPackages[i].getLastAccess();
_activeId = i;
}
}
}
for (int i = 0; i < size; i++)
{
CharSelectInfoPackage charInfoPackage = _characterPackages[i];
writeS(charInfoPackage.getName());
writeD(charInfoPackage.getObjectId());
writeS(_loginName);
writeD(_sessionId);
writeD(charInfoPackage.getClanId());
writeD(0x00); // ??
writeD(charInfoPackage.getSex());
writeD(charInfoPackage.getRace());
if (charInfoPackage.getClassId() == charInfoPackage.getBaseClassId())
{
writeD(charInfoPackage.getClassId());
}
else
{
writeD(charInfoPackage.getBaseClassId());
}
writeD(0x01); // active ??
writeD(charInfoPackage.getX());
writeD(charInfoPackage.getY());
writeD(charInfoPackage.getZ());
writeF(charInfoPackage.getCurrentHp());
writeF(charInfoPackage.getCurrentMp());
writeQ(charInfoPackage.getSp()); // 603
writeQ(charInfoPackage.getExp());
writeF((float) (charInfoPackage.getExp() - ExperienceTable.getInstance().getExpForLevel(charInfoPackage.getLevel())) / (ExperienceTable.getInstance().getExpForLevel(charInfoPackage.getLevel() + 1) - ExperienceTable.getInstance().getExpForLevel(charInfoPackage.getLevel()))); // High Five
// exp %
writeD(charInfoPackage.getLevel());
int Karma = 0 - charInfoPackage.getKarma(); // 603-Test
writeD(Karma); // 603-Test
writeD(charInfoPackage.getPkKills());
writeD(charInfoPackage.getPvPKills());
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0); // 603
writeD(0); // 603
for (int slot : getPaperdollOrder())
{
writeD(charInfoPackage.getPaperdollItemId(slot));
}
writeD(0); // 603
writeD(0); // 603
writeD(0); // 603
writeD(0); // 603
writeD(0); // 603
writeD(0); // 603
writeD(0); // 603
writeD(0); // 603
writeD(0); // 603
writeD(0);
writeD(0);
writeD(0);
writeD(0);
writeD(0);
writeD(0);
writeD(0);
writeH(0); // 603
writeH(0); // 603
writeH(0); // 603
writeH(0); // 603
writeH(0); // 603
writeD(charInfoPackage.getHairStyle());
writeD(charInfoPackage.getHairColor());
writeD(charInfoPackage.getFace());
writeF(charInfoPackage.getMaxHp()); // hp max
writeF(charInfoPackage.getMaxMp()); // mp max
long deleteTime = charInfoPackage.getDeleteTimer();
int deletedays = 0;
if (deleteTime > 0)
{
deletedays = (int) ((deleteTime - System.currentTimeMillis()) / 1000);
}
writeD(deletedays); // days left before
// delete .. if != 0
// then char is inactive
writeD(charInfoPackage.getClassId());
writeD(i == _activeId ? 0x01 : 0x00); // c3 auto-select char
writeC(charInfoPackage.getEnchantEffect() > 127 ? 127 : charInfoPackage.getEnchantEffect());
writeD(charInfoPackage.getAugmentationId()); // 603
writeD(0x00); // Currently on retail when you are on character select you don't see your transformation.
writeD(0x00); // npdid - 16024 Tame Tiny Baby Kookaburra A9E89C
writeD(0x00); // level
writeD(0x00); // ?
writeD(0x00); // food? - 1200
writeF(0x00); // max Hp
writeF(0x00); // cur Hp
// High Five by Vistall:
writeD(charInfoPackage.getVitalityPoints()); // H5 Vitality
writeD(200); // 603
writeD(5); // 603 systemmsg-6073 $s1 vitality items can be used
writeD(charInfoPackage.getAccessLevel() > -100 ? 0x01 : 0x00); // 603 1 = active / 0 = not active
writeC(0); // 603 awake = 1???
writeC(0); // 603
writeC(1); // 603
}
}
private static CharSelectInfoPackage[] loadCharacterSelectInfo(String loginName)
{
CharSelectInfoPackage charInfopackage;
List<CharSelectInfoPackage> characterList = new FastList<>();
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
PreparedStatement statement = con.prepareStatement("SELECT * FROM characters WHERE account_name=? ORDER BY createDate"))
{
statement.setString(1, loginName);
try (ResultSet charList = statement.executeQuery())
{
while (charList.next())// fills the package
{
charInfopackage = restoreChar(charList);
if (charInfopackage != null)
{
characterList.add(charInfopackage);
}
}
}
return characterList.toArray(new CharSelectInfoPackage[characterList.size()]);
}
catch (Exception e)
{
_log.log(Level.WARNING, "Could not restore char info: " + e.getMessage(), e);
}
return new CharSelectInfoPackage[0];
}
private static void loadCharacterSubclassInfo(CharSelectInfoPackage charInfopackage, int ObjectId, int activeClassId)
{
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
PreparedStatement statement = con.prepareStatement("SELECT exp, sp, level FROM character_subclasses WHERE charId=? && class_id=? ORDER BY charId"))
{
statement.setInt(1, ObjectId);
statement.setInt(2, activeClassId);
try (ResultSet charList = statement.executeQuery())
{
if (charList.next())
{
charInfopackage.setExp(charList.getLong("exp"));
charInfopackage.setSp(charList.getInt("sp"));
charInfopackage.setLevel(charList.getInt("level"));
}
}
}
catch (Exception e)
{
_log.log(Level.WARNING, "Could not restore char subclass info: " + e.getMessage(), e);
}
}
private static CharSelectInfoPackage restoreChar(ResultSet chardata) throws Exception
{
int objectId = chardata.getInt("charId");
String name = chardata.getString("char_name");
// See if the char must be deleted
long deletetime = chardata.getLong("deletetime");
if (deletetime > 0)
{
if (System.currentTimeMillis() > deletetime)
{
L2Clan clan = ClanTable.getInstance().getClan(chardata.getInt("clanid"));
if (clan != null)
{
clan.removeClanMember(objectId, 0);
}
L2GameClient.deleteCharByObjId(objectId);
return null;
}
}
CharSelectInfoPackage charInfopackage = new CharSelectInfoPackage(objectId, name);
charInfopackage.setAccessLevel(chardata.getInt("accesslevel"));
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.setKarma(chardata.getInt("karma"));
charInfopackage.setPkKills(chardata.getInt("pkkills"));
charInfopackage.setPvPKills(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.setVitalityPoints(chardata.getInt("vitality_points"));
charInfopackage.setClanId(chardata.getInt("clanid"));
charInfopackage.setRace(chardata.getInt("race"));
final int baseClassId = chardata.getInt("base_class");
final int activeClassId = chardata.getInt("classid");
charInfopackage.setX(chardata.getInt("x"));
charInfopackage.setY(chardata.getInt("y"));
charInfopackage.setZ(chardata.getInt("z"));
if (Config.L2JMOD_MULTILANG_ENABLE)
{
String lang = chardata.getString("language");
if (!Config.L2JMOD_MULTILANG_ALLOWED.contains(lang))
{
lang = Config.L2JMOD_MULTILANG_DEFAULT;
}
charInfopackage.setHtmlPrefix("data/lang/" + lang + "/");
}
// if is in subclass, load subclass exp, sp, lvl info
if (baseClassId != activeClassId)
{
loadCharacterSubclassInfo(charInfopackage, objectId, activeClassId);
}
charInfopackage.setClassId(activeClassId);
// Get the augmentation id for equipped weapon
int weaponObjId = charInfopackage.getPaperdollObjectId(Inventory.PAPERDOLL_RHAND);
if (weaponObjId < 1)
{
weaponObjId = charInfopackage.getPaperdollObjectId(Inventory.PAPERDOLL_RHAND);
}
if (weaponObjId > 0)
{
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
PreparedStatement statement = con.prepareStatement("SELECT augAttributes FROM item_attributes WHERE itemId=?"))
{
statement.setInt(1, weaponObjId);
try (ResultSet result = statement.executeQuery())
{
if (result.next())
{
int augment = result.getInt("augAttributes");
charInfopackage.setAugmentationId(augment == -1 ? 0 : augment);
}
}
}
catch (Exception e)
{
_log.log(Level.WARNING, "Could not restore augmentation info: " + e.getMessage(), e);
}
}
// Check if the base class is set to zero and also doesn't match with the current active class, otherwise send the base class ID. This prevents chars created before base class was introduced from being displayed incorrectly.
if ((baseClassId == 0) && (activeClassId > 0))
{
charInfopackage.setBaseClassId(activeClassId);
}
else
{
charInfopackage.setBaseClassId(baseClassId);
}
charInfopackage.setDeleteTimer(deletetime);
charInfopackage.setLastAccess(chardata.getLong("lastAccess"));
return charInfopackage;
}
}
вот так у меня, и понять не могу почему=(((Попробуйте.
Код
Цитата:public CharSelectionInfo(String loginName, int sessionId, int activeId)
{
_sessionId = sessionId;
_loginName = loginName;
_characterPackages = loadCharacterSelectInfo(_loginName);
_activeId = activeId;
}
public CharSelectInfoPackage[] getCharInfo()
{
return _characterPackages;
}
@Override
protected final void writeImpl()
{
writeC(0x09);
int size = (_characterPackages.length);
writeD(size);
// Can prevent players from creating new characters (if 0); (if 1, the client will ask if chars may be created (0x13) Response: (0x0D) )
writeD(Config.MAX_CHARACTERS_NUMBER_PER_ACCOUNT);
writeC(0x00);
writeC(0x01); // 603
writeD(0x02); // 603
writeC(0x00); // 603
long lastAccess = 0L;
if (_activeId == -1)
{
for (int i = 0; i < size; i++)
{
if (lastAccess < _characterPackages[i].getLastAccess())
{
lastAccess = _characterPackages[i].getLastAccess();
_activeId = i;
}
}
}
for (int i = 0; i < size; i++)
{
CharSelectInfoPackage charInfoPackage = _characterPackages[i];
writeS(charInfoPackage.getName());
writeD(charInfoPackage.getObjectId());
writeS(_loginName);
writeD(_sessionId);
writeD(charInfoPackage.getClanId());
writeD(0x00); // ??
writeD(charInfoPackage.getSex());
writeD(charInfoPackage.getRace());
if (charInfoPackage.getClassId() == charInfoPackage.getBaseClassId())
{
writeD(charInfoPackage.getClassId());
}
else
{
writeD(charInfoPackage.getBaseClassId());
}
writeD(0x01); // active ??
writeD(charInfoPackage.getX());
writeD(charInfoPackage.getY());
writeD(charInfoPackage.getZ());
writeF(charInfoPackage.getCurrentHp());
writeF(charInfoPackage.getCurrentMp());
writeQ(charInfoPackage.getSp()); // 603
writeQ(charInfoPackage.getExp());
writeF((float) (charInfoPackage.getExp() - ExperienceTable.getInstance().getExpForLevel(charInfoPackage.getLevel())) / (ExperienceTable.getInstance().getExpForLevel(charInfoPackage.getLevel() + 1) - ExperienceTable.getInstance().getExpForLevel(charInfoPackage.getLevel()))); // High Five
// exp %
writeD(charInfoPackage.getLevel());
int Karma = 0 - charInfoPackage.getKarma(); // 603-Test
writeD(Karma); // 603-Test
writeD(charInfoPackage.getPkKills());
writeD(charInfoPackage.getPvPKills());
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0); // 603
writeD(0); // 603
for (int slot : getPaperdollOrder())
{
writeD(charInfoPackage.getPaperdollItemId(slot));
}
writeD(0); // 603
writeD(0); // 603
writeD(0); // 603
writeD(0); // 603
writeD(0); // 603
writeD(0); // 603
writeD(0); // 603
writeD(0); // 603
writeD(0); // 603
writeH(0); // 603
writeH(0); // 603
writeH(0); // 603
writeH(0); // 603
writeH(0); // 603
writeD(charInfoPackage.getHairStyle());
writeD(charInfoPackage.getHairColor());
writeD(charInfoPackage.getFace());
writeF(charInfoPackage.getMaxHp()); // hp max
writeF(charInfoPackage.getMaxMp()); // mp max
long deleteTime = charInfoPackage.getDeleteTimer();
int deletedays = 0;
if (deleteTime > 0)
{
deletedays = (int) ((deleteTime - System.currentTimeMillis()) / 1000);
}
writeD(deletedays); // days left before
// delete .. if != 0
// then char is inactive
writeD(charInfoPackage.getClassId());
writeD(i == _activeId ? 0x01 : 0x00); // c3 auto-select char
writeC(charInfoPackage.getEnchantEffect() > 127 ? 127 : charInfoPackage.getEnchantEffect());
writeD(charInfoPackage.getAugmentationId()); // 603
writeD(0x00); // Currently on retail when you are on character select you don't see your transformation.
writeD(0x00); // npdid - 16024 Tame Tiny Baby Kookaburra A9E89C
writeD(0x00); // level
writeD(0x00); // ?
writeD(0x00); // food? - 1200
writeF(0x00); // max Hp
writeF(0x00); // cur Hp
// High Five by Vistall:
writeD(charInfoPackage.getVitalityPoints()); // H5 Vitality
writeD(200); // 603
writeD(5); // 603 systemmsg-6073 $s1 vitality items can be used
writeD(charInfoPackage.getAccessLevel() > -100 ? 0x01 : 0x00); // 603 1 = active / 0 = not active
writeC(0); // 603 awake = 1???
writeC(0); // 603
writeC(1); // 603
}
}
Сообщений: 466
Тем: 10
Зарегистрирован: Dec 2012
Репутация:
398
09-25-2014, 08:22 PM
(Сообщение последний раз редактировалось: 09-25-2014, 08:34 PM Daan Raven.)
На счет высоты расы Артеас - нужно тестить в начальных статах (тимплейтах), height/collisionHeight или тому подобное.
На счет брошек и камней - делается по аналогии с браслетом и талисманами, только в UserInfo после инфы о доступных слотах таликов отправляется инфа о доступных слотах камней (инфа о плаще не нужна, так как теперь его можно носить без ограничений).
Добавлено через 6 минут
Моя структура (при чем полностью разжеванная с минимумом циклов):
[src='java']
@Override
protected final void writeImpl()
{
int size = charSelectionInfo.size();
writeC(0x09);
writeD(size);
writeD(0x07);
writeC(0x00);
writeC(0x01);
writeD(0x02);
writeC(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);
writeD(charInfoPackage.getX());
writeD(charInfoPackage.getY());
writeD(charInfoPackage.getZ());
writeF(charInfoPackage.getCurrentHp());
writeF(charInfoPackage.getCurrentMp());
writeQ(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());
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_UNDER));
writeD(charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_REAR));
writeD(charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_LEAR));
writeD(charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_NECK));
writeD(charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_RFINGER));
writeD(charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_LFINGER));
writeD(charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_HEAD));
writeD(charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_RHAND));
writeD(charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_LHAND));
writeD(charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_GLOVES));
writeD(charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_CHEST));
writeD(charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_LEGS));
writeD(charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_FEET));
writeD(charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_BACK));
writeD(charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_LRHAND));
writeD(charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_HAIR));
writeD(charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_DHAIR));
writeD(charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_RBRACELET));
writeD(charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_LBRACELET));
writeD(charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_DECO1));
writeD(charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_DECO2));
writeD(charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_DECO3));
writeD(charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_DECO4));
writeD(charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_DECO5));
writeD(charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_DECO6));
writeD(charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_BELT));
writeD(charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_BROACH));
writeD(charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_STONE1));
writeD(charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_STONE2));
writeD(charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_STONE3));
writeD(charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_STONE4));
writeD(charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_STONE5));
writeD(charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_STONE6));
writeD(charInfoPackage.getVisualItemId(Inventory.PAPERDOLL_RHAND));
writeD(charInfoPackage.getVisualItemId(Inventory.PAPERDOLL_LHAND));
writeD(charInfoPackage.getVisualItemId(Inventory.PAPERDOLL_GLOVES));
writeD(charInfoPackage.getVisualItemId(Inventory.PAPERDOLL_CHEST));
writeD(charInfoPackage.getVisualItemId(Inventory.PAPERDOLL_LEGS));
writeD(charInfoPackage.getVisualItemId(Inventory.PAPERDOLL_FEET));
writeD(charInfoPackage.getVisualItemId(Inventory.PAPERDOLL_LRHAND));
writeD(charInfoPackage.getVisualItemId(Inventory.PAPERDOLL_HAIR));
writeD(charInfoPackage.getVisualItemId(Inventory.PAPERDOLL_DHAIR));
writeH(0x00);
writeH(0x00);
writeH(0x00);
writeH(0x00);
writeH(0x01);
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)
{
writeD(301);
}
else if (weaponId == 8689)
{
writeD(302);
}
else
{
writeD(0x00);
}
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeF(0.0D);
writeF(0.0D);
writeD(charSelectionInfo.getVitalityPoints());
writeD(200); // Vitality percent
writeD(5); // Vitaliti items count
writeD(charInfoPackage.getAccessLevel() > -100 ? 0x01 : 0x00);
writeC(0x00);
writeC(0x00);
writeC(0x00);
i++;
}
}
[/src]
Добавлено через 7 минут
За "бегающий текст" извиняюсь, просто часть делалась в текстовике, где при Tab используется табуляция (\t), а часть в ИДЕшке, в которой табуляция заменяется 4-мя пробелами.
Добавлено через 11 минут
Кстати, кто-то сниффал на одиссее? Если можно, мне бы несколько pLog или psl файликов (пакет-логов).
Сообщений: 441
Тем: 15
Зарегистрирован: Oct 2012
Репутация:
3,319
Warencense Написал:На счет высоты расы Артеас - нужно тестить в начальных статах (тимплейтах), height/collisionHeight или тому подобное.
На счет брошек и камней - делается по аналогии с браслетом и талисманами, только в UserInfo после инфы о доступных слотах таликов отправляется инфа о доступных слотах камней (инфа о плаще не нужна, так как теперь его можно носить без ограничений).
Добавлено через 6 минут
Моя структура (при чем полностью разжеванная с минимумом циклов):
[src='java']
@Override
protected final void writeImpl()
{
int size = charSelectionInfo.size();
writeC(0x09);
writeD(size);
writeD(0x07);
writeC(0x00);
writeC(0x01);
writeD(0x02);
writeC(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);
writeD(charInfoPackage.getX());
writeD(charInfoPackage.getY());
writeD(charInfoPackage.getZ());
writeF(charInfoPackage.getCurrentHp());
writeF(charInfoPackage.getCurrentMp());
writeQ(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());
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_UNDER));
writeD(charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_REAR));
writeD(charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_LEAR));
writeD(charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_NECK));
writeD(charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_RFINGER));
writeD(charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_LFINGER));
writeD(charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_HEAD));
writeD(charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_RHAND));
writeD(charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_LHAND));
writeD(charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_GLOVES));
writeD(charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_CHEST));
writeD(charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_LEGS));
writeD(charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_FEET));
writeD(charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_BACK));
writeD(charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_LRHAND));
writeD(charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_HAIR));
writeD(charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_DHAIR));
writeD(charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_RBRACELET));
writeD(charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_LBRACELET));
writeD(charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_DECO1));
writeD(charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_DECO2));
writeD(charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_DECO3));
writeD(charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_DECO4));
writeD(charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_DECO5));
writeD(charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_DECO6));
writeD(charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_BELT));
writeD(charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_BROACH));
writeD(charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_STONE1));
writeD(charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_STONE2));
writeD(charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_STONE3));
writeD(charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_STONE4));
writeD(charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_STONE5));
writeD(charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_STONE6));
writeD(charInfoPackage.getVisualItemId(Inventory.PAPERDOLL_RHAND));
writeD(charInfoPackage.getVisualItemId(Inventory.PAPERDOLL_LHAND));
writeD(charInfoPackage.getVisualItemId(Inventory.PAPERDOLL_GLOVES));
writeD(charInfoPackage.getVisualItemId(Inventory.PAPERDOLL_CHEST));
writeD(charInfoPackage.getVisualItemId(Inventory.PAPERDOLL_LEGS));
writeD(charInfoPackage.getVisualItemId(Inventory.PAPERDOLL_FEET));
writeD(charInfoPackage.getVisualItemId(Inventory.PAPERDOLL_LRHAND));
writeD(charInfoPackage.getVisualItemId(Inventory.PAPERDOLL_HAIR));
writeD(charInfoPackage.getVisualItemId(Inventory.PAPERDOLL_DHAIR));
writeH(0x00);
writeH(0x00);
writeH(0x00);
writeH(0x00);
writeH(0x01);
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)
{
writeD(301);
}
else if (weaponId == 8689)
{
writeD(302);
}
else
{
writeD(0x00);
}
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeF(0.0D);
writeF(0.0D);
writeD(charSelectionInfo.getVitalityPoints());
writeD(200); // Vitality percent
writeD(5); // Vitaliti items count
writeD(charInfoPackage.getAccessLevel() > -100 ? 0x01 : 0x00);
writeC(0x00);
writeC(0x00);
writeC(0x00);
i++;
}
}
[/src]
Добавлено через 7 минут
За "бегающий текст" извиняюсь, просто часть делалась в текстовике, где при Tab используется табуляция (\t), а часть в ИДЕшке, в которой табуляция заменяется 4-мя пробелами.
Добавлено через 11 минут
Кстати, кто-то сниффал на одиссее? Если можно, мне бы несколько pLog или psl файликов (пакет-логов). Это конечно сильно :redlol:
Код
PHP код: <?php
writeD(charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_UNDER));
writeD(charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_REAR));
writeD(charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_LEAR));
writeD(charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_NECK));
writeD(charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_RFINGER));
writeD(charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_LFINGER));
writeD(charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_HEAD));
writeD(charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_RHAND));
writeD(charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_LHAND));
writeD(charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_GLOVES));
writeD(charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_CHEST));
writeD(charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_LEGS));
writeD(charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_FEET));
writeD(charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_BACK));
writeD(charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_LRHAND));
writeD(charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_HAIR));
writeD(charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_DHAIR));
writeD(charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_RBRACELET));
writeD(charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_LBRACELET));
writeD(charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_DECO1));
writeD(charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_DECO2));
writeD(charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_DECO3));
writeD(charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_DECO4));
writeD(charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_DECO5));
writeD(charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_DECO6));
writeD(charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_BELT));
writeD(charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_BROACH));
writeD(charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_STONE1));
writeD(charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_STONE2));
writeD(charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_STONE3));
writeD(charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_STONE4));
writeD(charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_STONE5));
writeD(charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_STONE6));
|