Project update.

This commit is contained in:
MobiusDev
2015-12-31 23:53:41 +00:00
parent e0d681a17e
commit ad2bcd79be
4084 changed files with 83696 additions and 86998 deletions

View File

@ -0,0 +1,63 @@
/*
* This file is part of the L2J Mobius project.
*
* 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.l2jmobius.gameserver.network.serverpackets;
import java.util.ArrayList;
import java.util.List;
import com.l2jmobius.gameserver.datatables.SkillData;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
public class AbnormalStatusUpdate extends L2GameServerPacket
{
private final List<BuffInfo> _effects = new ArrayList<>();
public void addSkill(BuffInfo info)
{
if (!info.getSkill().isHealingPotionSkill())
{
_effects.add(info);
}
}
@Override
protected final void writeImpl()
{
writeC(0x85);
writeH(_effects.size());
for (BuffInfo info : _effects)
{
if ((info != null) && info.isInUse())
{
writeD(info.getSkill().getDisplayId());
if (info.getSkill().getDisplayLevel() < 100)
{
writeH(info.getSkill().getDisplayLevel());
writeH(0x00);
}
else
{
final int maxLevel = SkillData.getInstance().getMaxLevel(info.getSkill().getDisplayId());
writeH(maxLevel);
writeH(info.getSkill().getDisplayLevel());
}
writeD(0x00);
writeH(info.getTime());
}
}
}
}

View File

@ -0,0 +1,159 @@
/*
* This file is part of the L2J Mobius project.
*
* 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.l2jmobius.gameserver.network.serverpackets;
import java.util.logging.Level;
import com.l2jmobius.gameserver.cache.HtmCache;
import com.l2jmobius.gameserver.enums.HtmlActionScope;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.util.Util;
/**
* @author HorridoJoho
*/
public abstract class AbstractHtmlPacket extends L2GameServerPacket
{
public static final char VAR_PARAM_START_CHAR = '$';
private final int _npcObjId;
private String _html = null;
private boolean _disabledValidation = false;
protected AbstractHtmlPacket()
{
_npcObjId = 0;
}
protected AbstractHtmlPacket(int npcObjId)
{
if (npcObjId < 0)
{
throw new IllegalArgumentException();
}
_npcObjId = npcObjId;
}
protected AbstractHtmlPacket(String html)
{
_npcObjId = 0;
setHtml(html);
}
protected AbstractHtmlPacket(int npcObjId, String html)
{
if (npcObjId < 0)
{
throw new IllegalArgumentException();
}
_npcObjId = npcObjId;
setHtml(html);
}
public final void disableValidation()
{
_disabledValidation = true;
}
public final void setHtml(String html)
{
if (html.length() > 17200)
{
_log.log(Level.WARNING, "Html is too long! this will crash the client!", new Throwable());
_html = html.substring(0, 17200);
}
if (!html.contains("<html") && !html.startsWith("..\\L2"))
{
html = "<html><body>" + html + "</body></html>";
}
_html = html;
}
public final boolean setFile(String prefix, String path)
{
final String content = HtmCache.getInstance().getHtm(prefix, path);
if (content == null)
{
setHtml("<html><body>My Text is missing:<br>" + path + "</body></html>");
_log.warning("missing html page " + path);
return false;
}
setHtml(content);
return true;
}
public final void replace(String pattern, String value)
{
_html = _html.replaceAll(pattern, value.replaceAll("\\$", "\\\\\\$"));
}
public final void replace(String pattern, boolean val)
{
replace(pattern, String.valueOf(val));
}
public final void replace(String pattern, int val)
{
replace(pattern, String.valueOf(val));
}
public final void replace(String pattern, long val)
{
replace(pattern, String.valueOf(val));
}
public final void replace(String pattern, double val)
{
replace(pattern, String.valueOf(val));
}
@Override
public final void runImpl()
{
final L2PcInstance player = getClient().getActiveChar();
if (player == null)
{
return;
}
player.clearHtmlActions(getScope());
if (_disabledValidation)
{
return;
}
Util.buildHtmlActionCache(player, getScope(), _npcObjId, _html);
}
public final int getNpcObjId()
{
return _npcObjId;
}
public final String getHtml()
{
return _html;
}
public abstract HtmlActionScope getScope();
}

View File

@ -0,0 +1,93 @@
/*
* This file is part of the L2J Mobius project.
*
* 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.l2jmobius.gameserver.network.serverpackets;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentSkipListMap;
import com.l2jmobius.gameserver.model.ItemInfo;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
/**
* @author UnAfraid
*/
public abstract class AbstractInventoryUpdate extends AbstractItemPacket
{
private final Map<Integer, ItemInfo> _items = new ConcurrentSkipListMap<>();
public AbstractInventoryUpdate()
{
}
public AbstractInventoryUpdate(L2ItemInstance item)
{
addItem(item);
}
public AbstractInventoryUpdate(List<ItemInfo> items)
{
for (ItemInfo item : items)
{
_items.put(item.getObjectId(), item);
}
}
public final void addItem(L2ItemInstance item)
{
_items.put(item.getObjectId(), new ItemInfo(item));
}
public final void addNewItem(L2ItemInstance item)
{
_items.put(item.getObjectId(), new ItemInfo(item, 1));
}
public final void addModifiedItem(L2ItemInstance item)
{
_items.put(item.getObjectId(), new ItemInfo(item, 2));
}
public final void addRemovedItem(L2ItemInstance item)
{
_items.put(item.getObjectId(), new ItemInfo(item, 3));
}
public final void addItems(List<L2ItemInstance> items)
{
for (L2ItemInstance item : items)
{
_items.put(item.getObjectId(), new ItemInfo(item));
}
}
public final Collection<ItemInfo> getItems()
{
return _items.values();
}
protected final void writeItems()
{
writeH(_items.size());
for (ItemInfo item : _items.values())
{
writeH(item.getChange()); // Update type : 01-add, 02-modify, 03-remove
writeItem(item);
}
}
}

View File

@ -0,0 +1,220 @@
/*
* This file is part of the L2J Mobius project.
*
* 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.l2jmobius.gameserver.network.serverpackets;
import com.l2jmobius.gameserver.enums.ItemListType;
import com.l2jmobius.gameserver.model.ItemInfo;
import com.l2jmobius.gameserver.model.TradeItem;
import com.l2jmobius.gameserver.model.buylist.Product;
import com.l2jmobius.gameserver.model.itemcontainer.PcInventory;
import com.l2jmobius.gameserver.model.items.L2WarehouseItem;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
/**
* @author UnAfraid
*/
public abstract class AbstractItemPacket extends AbstractMaskPacket<ItemListType>
{
private static final byte[] MASKS =
{
0x00
};
@Override
protected byte[] getMasks()
{
return MASKS;
}
@Override
protected void onNewMaskAdded(ItemListType component)
{
}
protected void writeItem(TradeItem item)
{
writeItem(new ItemInfo(item));
}
protected void writeItem(L2WarehouseItem item)
{
writeItem(new ItemInfo(item));
}
protected void writeItem(L2ItemInstance item)
{
writeItem(new ItemInfo(item));
}
protected void writeItem(Product item)
{
writeItem(new ItemInfo(item));
}
protected void writeTradeItem(TradeItem item)
{
writeH(item.getItem().getType1());
writeD(item.getObjectId()); // ObjectId
writeD(item.getItem().getDisplayId()); // ItemId
writeQ(item.getCount()); // Quantity
writeC(item.getItem().getType2()); // Item Type 2 : 00-weapon, 01-shield/armor, 02-ring/earring/necklace, 03-questitem, 04-adena, 05-item
writeC(item.getCustomType1()); // Filler (always 0)
writeQ(item.getItem().getBodyPart()); // Slot : 0006-lr.ear, 0008-neck, 0030-lr.finger, 0040-head, 0100-l.hand, 0200-gloves, 0400-chest, 0800-pants, 1000-feet, 4000-r.hand, 8000-r.hand
writeC(item.getEnchant()); // Enchant level (pet level shown in control item)
writeH(0x00); // Equipped : 00-No, 01-yes
writeC(item.getCustomType2());
writeD(0);
writeItemElementalAndEnchant(new ItemInfo(item));
}
protected void writeItem(ItemInfo item)
{
final int mask = calculateMask(item);
// cddcQcchQccddc
writeC(mask);
writeD(item.getObjectId()); // ObjectId
writeD(item.getItem().getDisplayId()); // ItemId
writeC(item.getEquipped() == 0 ? item.getLocation() : 0xFF); // T1
writeQ(item.getCount()); // Quantity
writeC(item.getItem().getType2()); // Item Type 2 : 00-weapon, 01-shield/armor, 02-ring/earring/necklace, 03-questitem, 04-adena, 05-item
writeC(item.getCustomType1()); // Filler (always 0)
writeH(item.getEquipped()); // Equipped : 00-No, 01-yes
writeQ(item.getItem().getBodyPart()); // Slot : 0006-lr.ear, 0008-neck, 0030-lr.finger, 0040-head, 0100-l.hand, 0200-gloves, 0400-chest, 0800-pants, 1000-feet, 4000-r.hand, 8000-r.hand
writeC(item.getEnchant()); // Enchant level (pet level shown in control item)
writeC(0);
writeD(item.getMana());
writeD(item.getTime());
writeC(0x01); // GOD Item enabled = 1 disabled (red) = 0
if (containsMask(mask, ItemListType.AUGMENT_BONUS))
{
writeD(item.get1stAugmentationId());
writeD(item.get2ndAugmentationId());
}
if (containsMask(mask, ItemListType.ELEMENTAL_ATTRIBUTE))
{
writeItemElemental(item);
}
if (containsMask(mask, ItemListType.ENCHANT_EFFECT))
{
writeItemEnchantEffect(item);
}
if (containsMask(mask, ItemListType.VISUAL_ID))
{
writeD(item.getVisualId()); // Item remodel visual ID
}
}
protected static final int calculateMask(ItemInfo item)
{
int mask = 0;
if (item.getAugmentationBonus() > 0)
{
mask |= ItemListType.AUGMENT_BONUS.getMask();
}
if (item.getAttackElementType() >= 0)
{
mask |= ItemListType.ELEMENTAL_ATTRIBUTE.getMask();
}
else
{
for (byte i = 0; i < 6; i++)
{
if (item.getElementDefAttr(i) >= 0)
{
mask |= ItemListType.ELEMENTAL_ATTRIBUTE.getMask();
break;
}
}
}
if (item.getEnchantOptions() != null)
{
for (int id : item.getEnchantOptions())
{
if (id > 0)
{
mask |= ItemListType.ENCHANT_EFFECT.getMask();
break;
}
}
}
if (item.getVisualId() > 0)
{
mask |= ItemListType.VISUAL_ID.getMask();
}
return mask;
}
protected void writeItemElementalAndEnchant(ItemInfo item)
{
writeItemElemental(item);
writeItemEnchantEffect(item);
}
protected void writeItemElemental(ItemInfo item)
{
writeH(item.getAttackElementType());
writeH(item.getAttackElementPower());
for (byte i = 0; i < 6; i++)
{
writeH(item.getElementDefAttr(i));
}
}
protected void writeItemEnchantEffect(ItemInfo item)
{
// Enchant Effects
for (int op : item.getEnchantOptions())
{
writeD(op);
}
}
protected void writeInventoryBlock(PcInventory inventory)
{
if (inventory.hasInventoryBlock())
{
writeH(inventory.getBlockItems().length);
writeC(inventory.getBlockMode());
for (int i : inventory.getBlockItems())
{
writeD(i);
}
}
else
{
writeH(0x00);
}
}
protected void writeCommissionItem(ItemInfo item)
{
writeD(0); // Always 0
writeD(item.getItem().getId());
writeQ(item.getCount());
writeH(item.getItem().getType2());
writeQ(item.getItem().getBodyPart());
writeH(item.getEnchant());
writeH(item.getCustomType2());
writeItemElementalAndEnchant(item);
writeD(item.getVisualId());
writeC(0);
writeC(0);
}
}

View File

@ -0,0 +1,65 @@
/*
* This file is part of the L2J Mobius project.
*
* 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.l2jmobius.gameserver.network.serverpackets;
import com.l2jmobius.gameserver.model.interfaces.IUpdateTypeComponent;
/**
* @author UnAfraid
* @param <T>
*/
public abstract class AbstractMaskPacket<T extends IUpdateTypeComponent>extends L2GameServerPacket
{
protected static final byte[] DEFAULT_FLAG_ARRAY =
{
(byte) 0x80,
0x40,
0x20,
0x10,
0x08,
0x04,
0x02,
0x01
};
protected abstract byte[] getMasks();
protected abstract void onNewMaskAdded(T component);
@SuppressWarnings("unchecked")
public void addComponentType(T... updateComponents)
{
for (T component : updateComponents)
{
if (!containsMask(component))
{
getMasks()[component.getMask() >> 3] |= DEFAULT_FLAG_ARRAY[component.getMask() & 7];
onNewMaskAdded(component);
}
}
}
public boolean containsMask(T component)
{
return containsMask(component.getMask());
}
public boolean containsMask(int mask)
{
return (getMasks()[mask >> 3] & DEFAULT_FLAG_ARRAY[mask & 7]) != 0;
}
}

View File

@ -0,0 +1,644 @@
/*
* This file is part of the L2J Mobius project.
*
* 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.l2jmobius.gameserver.network.serverpackets;
import java.io.PrintStream;
import java.util.Arrays;
import java.util.logging.Level;
import com.l2jmobius.Config;
import com.l2jmobius.gameserver.data.xml.impl.DoorData;
import com.l2jmobius.gameserver.data.xml.impl.NpcData;
import com.l2jmobius.gameserver.datatables.ItemTable;
import com.l2jmobius.gameserver.datatables.SkillData;
import com.l2jmobius.gameserver.instancemanager.CastleManager;
import com.l2jmobius.gameserver.instancemanager.InstanceManager;
import com.l2jmobius.gameserver.instancemanager.ZoneManager;
import com.l2jmobius.gameserver.model.Elementals;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.L2Npc;
import com.l2jmobius.gameserver.model.actor.L2Summon;
import com.l2jmobius.gameserver.model.actor.instance.L2DoorInstance;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.actor.templates.L2NpcTemplate;
import com.l2jmobius.gameserver.model.entity.Castle;
import com.l2jmobius.gameserver.model.items.L2Item;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.model.zone.L2ZoneType;
import com.l2jmobius.gameserver.network.SystemMessageId;
import com.l2jmobius.gameserver.network.SystemMessageId.SMLocalisation;
/**
* @author UnAfraid
* @param <T>
*/
@SuppressWarnings("unchecked")
public abstract class AbstractMessagePacket<T extends AbstractMessagePacket<?>>extends L2GameServerPacket
{
private static final SMParam[] EMPTY_PARAM_ARRAY = new SMParam[0];
private static final class SMParam
{
private final byte _type;
private final Object _value;
public SMParam(final byte type, final Object value)
{
_type = type;
_value = value;
}
public final byte getType()
{
return _type;
}
public final Object getValue()
{
return _value;
}
public final String getStringValue()
{
return (String) _value;
}
public final int getIntValue()
{
return ((Integer) _value).intValue();
}
public final long getLongValue()
{
return ((Long) _value).longValue();
}
public final int[] getIntArrayValue()
{
return (int[]) _value;
}
}
private static final byte TYPE_POPUP_ID = 16;
private static final byte TYPE_CLASS_ID = 15;
// id 14 unknown
private static final byte TYPE_SYSTEM_STRING = 13;
private static final byte TYPE_PLAYER_NAME = 12;
private static final byte TYPE_DOOR_NAME = 11;
private static final byte TYPE_INSTANCE_NAME = 10;
private static final byte TYPE_ELEMENT_NAME = 9;
// id 8 - same as 3
private static final byte TYPE_ZONE_NAME = 7;
private static final byte TYPE_LONG_NUMBER = 6;
private static final byte TYPE_CASTLE_NAME = 5;
private static final byte TYPE_SKILL_NAME = 4;
private static final byte TYPE_ITEM_NAME = 3;
private static final byte TYPE_NPC_NAME = 2;
private static final byte TYPE_INT_NUMBER = 1;
private static final byte TYPE_TEXT = 0;
private SMParam[] _params;
private final SystemMessageId _smId;
private int _paramIndex;
public AbstractMessagePacket(SystemMessageId smId)
{
if (smId == null)
{
throw new NullPointerException("SystemMessageId cannot be null!");
}
_smId = smId;
_params = smId.getParamCount() > 0 ? new SMParam[smId.getParamCount()] : EMPTY_PARAM_ARRAY;
}
public final int getId()
{
return _smId.getId();
}
public final SystemMessageId getSystemMessageId()
{
return _smId;
}
private final void append(SMParam param)
{
if (_paramIndex >= _params.length)
{
_params = Arrays.copyOf(_params, _paramIndex + 1);
_smId.setParamCount(_paramIndex + 1);
_log.log(Level.INFO, "Wrong parameter count '" + (_paramIndex + 1) + "' for SystemMessageId: " + _smId);
}
_params[_paramIndex++] = param;
}
public final T addString(final String text)
{
append(new SMParam(TYPE_TEXT, text));
return (T) this;
}
/**
* Appends a Castle name parameter type, the name will be read from CastleName-e.dat.<br>
* <ul>
* <li>1-9 Castle names</li>
* <li>21 Fortress of Resistance</li>
* <li>22-33 Clan Hall names</li>
* <li>34 Devastated Castle</li>
* <li>35 Bandit Stronghold</li>
* <li>36-61 Clan Hall names</li>
* <li>62 Rainbow Springs</li>
* <li>63 Wild Beast Reserve</li>
* <li>64 Fortress of the Dead</li>
* <li>81-89 Territory names</li>
* <li>90-100 null</li>
* <li>101-121 Fortress names</li>
* </ul>
* @param number the conquerable entity
* @return the system message with the proper parameter
*/
public final T addCastleId(final int number)
{
append(new SMParam(TYPE_CASTLE_NAME, number));
return (T) this;
}
public final T addInt(final int number)
{
append(new SMParam(TYPE_INT_NUMBER, number));
return (T) this;
}
public final T addLong(final long number)
{
append(new SMParam(TYPE_LONG_NUMBER, number));
return (T) this;
}
public final T addCharName(final L2Character cha)
{
if (cha.isNpc())
{
final L2Npc npc = (L2Npc) cha;
if (npc.getTemplate().isUsingServerSideName())
{
return addString(npc.getTemplate().getName());
}
return addNpcName(npc);
}
else if (cha.isPlayer())
{
return addPcName(cha.getActingPlayer());
}
else if (cha.isSummon())
{
final L2Summon summon = (L2Summon) cha;
if (summon.getTemplate().isUsingServerSideName())
{
return addString(summon.getTemplate().getName());
}
return addNpcName(summon);
}
else if (cha.isDoor())
{
final L2DoorInstance door = (L2DoorInstance) cha;
return addDoorName(door.getId());
}
return addString(cha.getName());
}
public final T addPcName(final L2PcInstance pc)
{
append(new SMParam(TYPE_PLAYER_NAME, pc.getAppearance().getVisibleName()));
return (T) this;
}
/**
* ID from doorData.xml
* @param doorId
* @return
*/
public final T addDoorName(int doorId)
{
append(new SMParam(TYPE_DOOR_NAME, doorId));
return (T) this;
}
public final T addNpcName(L2Npc npc)
{
return addNpcName(npc.getTemplate());
}
public final T addNpcName(final L2Summon npc)
{
return addNpcName(npc.getId());
}
public final T addNpcName(final L2NpcTemplate template)
{
if (template.isUsingServerSideName())
{
return addString(template.getName());
}
return addNpcName(template.getId());
}
public final T addNpcName(final int id)
{
append(new SMParam(TYPE_NPC_NAME, 1000000 + id));
return (T) this;
}
public T addItemName(final L2ItemInstance item)
{
return addItemName(item.getId());
}
public T addItemName(final L2Item item)
{
return addItemName(item.getId());
}
public final T addItemName(final int id)
{
final L2Item item = ItemTable.getInstance().getTemplate(id);
if (item.getDisplayId() != id)
{
return addString(item.getName());
}
append(new SMParam(TYPE_ITEM_NAME, id));
return (T) this;
}
public final T addZoneName(final int x, final int y, final int z)
{
append(new SMParam(TYPE_ZONE_NAME, new int[]
{
x,
y,
z
}));
return (T) this;
}
public final T addSkillName(final Skill skill)
{
if (skill.getId() != skill.getDisplayId())
{
return addString(skill.getName());
}
return addSkillName(skill.getId(), skill.getLevel());
}
public final T addSkillName(final int id)
{
return addSkillName(id, 1);
}
public final T addSkillName(final int id, final int lvl)
{
append(new SMParam(TYPE_SKILL_NAME, new int[]
{
id,
lvl
}));
return (T) this;
}
/**
* Elemental name - 0(Fire) ...
* @param type
* @return
*/
public final T addElemental(final int type)
{
append(new SMParam(TYPE_ELEMENT_NAME, type));
return (T) this;
}
/**
* ID from sysstring-e.dat
* @param type
* @return
*/
public final T addSystemString(final int type)
{
append(new SMParam(TYPE_SYSTEM_STRING, type));
return (T) this;
}
/**
* ID from ClassInfo-e.dat
* @param type
* @return
*/
public final T addClassId(final int type)
{
append(new SMParam(TYPE_CLASS_ID, type));
return (T) this;
}
public final T addPopup(int target, int attacker, int damage)
{
append(new SMParam(TYPE_POPUP_ID, new int[]
{
target,
attacker,
damage
}));
return (T) this;
}
/**
* Instance name from instantzonedata-e.dat
* @param type id of instance
* @return
*/
public final T addInstanceName(final int type)
{
append(new SMParam(TYPE_INSTANCE_NAME, type));
return (T) this;
}
protected void writeParamsSize(int size)
{
writeC(size);
}
protected void writeParamType(int type)
{
writeC(type);
}
protected final void writeMe()
{
writeParamsSize(_params.length);
SMParam param;
for (int i = 0; i < _paramIndex; i++)
{
param = _params[i];
writeParamType(param.getType());
switch (param.getType())
{
case TYPE_TEXT:
case TYPE_PLAYER_NAME:
{
writeS(param.getStringValue());
break;
}
case TYPE_LONG_NUMBER:
{
writeQ(param.getLongValue());
break;
}
case TYPE_ITEM_NAME:
case TYPE_INT_NUMBER:
case TYPE_NPC_NAME:
case TYPE_DOOR_NAME:
{
writeD(param.getIntValue());
break;
}
case TYPE_SKILL_NAME:
{
final int[] array = param.getIntArrayValue();
final int _skillId = array[0];
final int _skillLevel = array[1];
writeD(_skillId); // SkillId
if (_skillLevel < 100)
{
writeH(_skillLevel); // SkillLevel
writeH(0);
}
else if (_skillLevel > 10000)
{
writeH((short) _skillLevel);
writeH(_skillLevel >> 16);
}
else
{
final int _maxLevel = SkillData.getInstance().getMaxLevel(_skillId);
writeH(_maxLevel);
writeH(_skillLevel);
}
break;
}
case TYPE_POPUP_ID:
case TYPE_ZONE_NAME:
{
final int[] array = param.getIntArrayValue();
writeD(array[0]); // x
writeD(array[1]); // y
writeD(array[2]); // z
break;
}
case TYPE_CLASS_ID:
case TYPE_CASTLE_NAME:
case TYPE_INSTANCE_NAME:
case TYPE_SYSTEM_STRING:
{
writeH(param.getIntValue());
break;
}
case TYPE_ELEMENT_NAME:
{
writeC(param.getIntValue());
break;
}
}
}
}
public final void printMe(PrintStream out)
{
out.println(0x62);
out.println(getId());
out.println(_params.length);
for (SMParam param : _params)
{
switch (param.getType())
{
case TYPE_TEXT:
case TYPE_PLAYER_NAME:
{
out.println(param.getStringValue());
break;
}
case TYPE_LONG_NUMBER:
{
out.println(param.getLongValue());
break;
}
case TYPE_ITEM_NAME:
case TYPE_CASTLE_NAME:
case TYPE_INT_NUMBER:
case TYPE_NPC_NAME:
case TYPE_ELEMENT_NAME:
case TYPE_SYSTEM_STRING:
case TYPE_INSTANCE_NAME:
case TYPE_DOOR_NAME:
case TYPE_CLASS_ID:
{
out.println(param.getIntValue());
break;
}
case TYPE_POPUP_ID:
{
final int[] array = param.getIntArrayValue();
out.println(array[0]); // Target
out.println(array[1]); // Attacker
out.println(array[2]); // Value
break;
}
case TYPE_SKILL_NAME:
{
final int[] array = param.getIntArrayValue();
out.println(array[0]); // SkillId
out.println(array[1]); // SkillLevel
out.println(array[2]);
break;
}
case TYPE_ZONE_NAME:
{
final int[] array = param.getIntArrayValue();
out.println(array[0]); // x
out.println(array[1]); // y
out.println(array[2]); // z
break;
}
}
}
}
public final T getLocalizedMessage(final String lang)
{
if (!Config.L2JMOD_MULTILANG_SM_ENABLE || (getSystemMessageId() == SystemMessageId.S13))
{
return (T) this;
}
final SMLocalisation sml = getSystemMessageId().getLocalisation(lang);
if (sml == null)
{
return (T) this;
}
final Object[] params = new Object[_paramIndex];
SMParam param;
for (int i = 0; i < _paramIndex; i++)
{
param = _params[i];
switch (param.getType())
{
case TYPE_TEXT:
case TYPE_PLAYER_NAME:
{
params[i] = param.getValue();
break;
}
case TYPE_LONG_NUMBER:
{
params[i] = param.getValue();
break;
}
case TYPE_ITEM_NAME:
{
final L2Item item = ItemTable.getInstance().getTemplate(param.getIntValue());
params[i] = item == null ? "Unknown" : item.getName();
break;
}
case TYPE_CASTLE_NAME:
{
final Castle castle = CastleManager.getInstance().getCastleById(param.getIntValue());
params[i] = castle == null ? "Unknown" : castle.getName();
break;
}
case TYPE_INT_NUMBER:
{
params[i] = param.getValue();
break;
}
case TYPE_NPC_NAME:
{
final L2NpcTemplate template = NpcData.getInstance().getTemplate(param.getIntValue());
params[i] = template == null ? "Unknown" : template.getName();
break;
}
case TYPE_ELEMENT_NAME:
{
params[i] = Elementals.getElementName((byte) param.getIntValue());
break;
}
case TYPE_SYSTEM_STRING:
{
params[i] = "SYS-S-" + param.getIntValue(); // writeD(param.getIntValue());
break;
}
case TYPE_CLASS_ID:
{
params[i] = "CLASS_ID-N-" + param.getIntValue(); // writeD(param.getIntValue());
break;
}
case TYPE_INSTANCE_NAME:
{
final String instanceName = InstanceManager.getInstance().getInstanceIdName(param.getIntValue());
params[i] = instanceName == null ? "Unknown" : instanceName;
break;
}
case TYPE_DOOR_NAME:
{
final L2DoorInstance door = DoorData.getInstance().getDoor(param.getIntValue());
params[i] = door == null ? "Unknown" : door.getName();
break;
}
case TYPE_SKILL_NAME:
{
final int[] array = param.getIntArrayValue();
if (array[1] < 10000)
{
final Skill skill = SkillData.getInstance().getSkill(array[0], array[1]);
params[i] = skill == null ? "Unknown" : skill.getName();
}
else
{
final Skill skill = SkillData.getInstance().getSkill(array[0], array[1] >> 16);
params[i] = skill == null ? "Unknown" : skill.getName();
}
break;
}
case TYPE_ZONE_NAME:
{
final int[] array = param.getIntArrayValue();
final L2ZoneType zone = ZoneManager.getInstance().getZone(array[0], array[1], array[2], L2ZoneType.class);
params[i] = zone == null ? "Unknown ZONE-N-" + Arrays.toString(array) : zone.getName();
break;
}
}
i++;
}
addString(sml.getLocalisation(params));
return (T) this;
}
}

View File

@ -0,0 +1,141 @@
/*
* This file is part of the L2J Mobius project.
*
* 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.l2jmobius.gameserver.network.serverpackets;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.instance.L2TrapInstance;
public abstract class AbstractNpcInfo extends L2GameServerPacket
{
protected int _x, _y, _z, _heading;
protected int _idTemplate;
protected boolean _isAttackable, _isSummoned;
protected int _mAtkSpd, _pAtkSpd;
protected final int _runSpd, _walkSpd;
protected final int _swimRunSpd, _swimWalkSpd;
protected final int _flyRunSpd, _flyWalkSpd;
protected double _moveMultiplier;
protected int _rhand, _lhand, _chest, _enchantEffect;
protected double _collisionHeight, _collisionRadius;
protected String _name = "";
protected String _title = "";
public AbstractNpcInfo(L2Character cha)
{
_isSummoned = cha.isShowSummonAnimation();
_x = cha.getX();
_y = cha.getY();
_z = cha.getZ();
_heading = cha.getHeading();
_mAtkSpd = cha.getMAtkSpd();
_pAtkSpd = (int) cha.getPAtkSpd();
_moveMultiplier = cha.getMovementSpeedMultiplier();
_runSpd = (int) Math.round(cha.getRunSpeed() / _moveMultiplier);
_walkSpd = (int) Math.round(cha.getWalkSpeed() / _moveMultiplier);
_swimRunSpd = (int) Math.round(cha.getSwimRunSpeed() / _moveMultiplier);
_swimWalkSpd = (int) Math.round(cha.getSwimWalkSpeed() / _moveMultiplier);
_flyRunSpd = cha.isFlying() ? _runSpd : 0;
_flyWalkSpd = cha.isFlying() ? _walkSpd : 0;
}
public static class TrapInfo extends AbstractNpcInfo
{
private final L2TrapInstance _trap;
public TrapInfo(L2TrapInstance cha, L2Character attacker)
{
super(cha);
_trap = cha;
_idTemplate = cha.getTemplate().getDisplayId();
_isAttackable = cha.isAutoAttackable(attacker);
_rhand = 0;
_lhand = 0;
_collisionHeight = _trap.getTemplate().getfCollisionHeight();
_collisionRadius = _trap.getTemplate().getfCollisionRadius();
if (cha.getTemplate().isUsingServerSideName())
{
_name = cha.getName();
}
_title = cha.getOwner() != null ? cha.getOwner().getName() : "";
}
@Override
protected void writeImpl()
{
writeC(0x0c);
writeD(_trap.getObjectId());
writeD(_idTemplate + 1000000); // npctype id
writeD(_isAttackable ? 1 : 0);
writeD(_x);
writeD(_y);
writeD(_z);
writeD(_heading);
writeD(0x00);
writeD(_mAtkSpd);
writeD(_pAtkSpd);
writeD(_runSpd);
writeD(_walkSpd);
writeD(_swimRunSpd);
writeD(_swimWalkSpd);
writeD(_flyRunSpd);
writeD(_flyWalkSpd);
writeD(_flyRunSpd);
writeD(_flyWalkSpd);
writeF(_moveMultiplier);
writeF(_trap.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(1);
writeC(_trap.isInCombat() ? 1 : 0);
writeC(_trap.isAlikeDead() ? 1 : 0);
writeC(_isSummoned ? 2 : 0); // invisible ?? 0=false 1=true 2=summoned (only works if model has a summon animation)
writeD(-1); // High Five NPCString ID
writeS(_name);
writeD(-1); // High Five NPCString ID
writeS(_title);
writeD(0x00); // title color 0 = client default
writeD(_trap.getPvpFlag());
writeD(_trap.getReputation());
writeD(0); // was AVE and was adding stealth
writeD(0x00); // clan id
writeD(0x00); // crest id
writeD(0000); // C2
writeD(0000); // C2
writeC(0000); // C2
writeC(_trap.getTeam().getId());
writeF(_collisionRadius);
writeF(_collisionHeight);
writeD(0x00); // C4
writeD(0x00); // C6
writeD(0x00);
writeD(0);// CT1.5 Pet form and skills
writeC(0x01);
writeC(0x01);
writeD(0x00);
}
}
}

View File

@ -0,0 +1,34 @@
/*
* This file is part of the L2J Mobius project.
*
* 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.l2jmobius.gameserver.network.serverpackets;
/**
* @author Kerberos
*/
public class AcquireSkillDone extends L2GameServerPacket
{
public AcquireSkillDone()
{
//
}
@Override
protected final void writeImpl()
{
writeC(0x94);
}
}

View File

@ -0,0 +1,128 @@
/*
* This file is part of the L2J Mobius project.
*
* 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.l2jmobius.gameserver.network.serverpackets;
import java.util.ArrayList;
import java.util.List;
import com.l2jmobius.Config;
import com.l2jmobius.gameserver.model.L2SkillLearn;
import com.l2jmobius.gameserver.model.base.AcquireSkillType;
import com.l2jmobius.gameserver.model.holders.ItemHolder;
import com.l2jmobius.gameserver.model.skills.CommonSkill;
/**
* Acquire Skill Info server packet implementation.
* @author Zoey76
*/
public class AcquireSkillInfo extends L2GameServerPacket
{
private final AcquireSkillType _type;
private final int _id;
private final int _level;
private final int _spCost;
private final List<Req> _reqs;
/**
* Private class containing learning skill requisites.
*/
private static class Req
{
public int itemId;
public long count;
public int type;
public int unk;
/**
* @param pType TODO identify.
* @param pItemId the item Id.
* @param itemCount the item count.
* @param pUnk TODO identify.
*/
public Req(int pType, int pItemId, long itemCount, int pUnk)
{
itemId = pItemId;
type = pType;
count = itemCount;
unk = pUnk;
}
}
/**
* Constructor for the acquire skill info object.
* @param skillType the skill learning type.
* @param skillLearn the skill learn.
*/
public AcquireSkillInfo(AcquireSkillType skillType, L2SkillLearn skillLearn)
{
_id = skillLearn.getSkillId();
_level = skillLearn.getSkillLevel();
_spCost = skillLearn.getLevelUpSp();
_type = skillType;
_reqs = new ArrayList<>();
if ((skillType != AcquireSkillType.PLEDGE) || Config.LIFE_CRYSTAL_NEEDED)
{
for (ItemHolder item : skillLearn.getRequiredItems())
{
if (!Config.DIVINE_SP_BOOK_NEEDED && (_id == CommonSkill.DIVINE_INSPIRATION.getId()))
{
continue;
}
_reqs.add(new Req(99, item.getId(), item.getCount(), 50));
}
}
}
/**
* Special constructor for Alternate Skill Learning system.<br>
* Sets a custom amount of SP.
* @param skillType the skill learning type.
* @param skillLearn the skill learn.
* @param sp the custom SP amount.
*/
public AcquireSkillInfo(AcquireSkillType skillType, L2SkillLearn skillLearn, int sp)
{
_id = skillLearn.getSkillId();
_level = skillLearn.getSkillLevel();
_spCost = sp;
_type = skillType;
_reqs = new ArrayList<>();
for (ItemHolder item : skillLearn.getRequiredItems())
{
_reqs.add(new Req(99, item.getId(), item.getCount(), 50));
}
}
@Override
protected final void writeImpl()
{
writeC(0x91);
writeD(_id);
writeD(_level);
writeQ(_spCost);
writeD(_type.getId());
writeD(_reqs.size());
for (Req temp : _reqs)
{
writeD(temp.type);
writeD(temp.itemId);
writeQ(temp.count);
writeD(temp.unk);
}
writeD(0);
}
}

View File

@ -0,0 +1,82 @@
/*
* This file is part of the L2J Mobius project.
*
* 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.l2jmobius.gameserver.network.serverpackets;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
import com.l2jmobius.gameserver.data.xml.impl.SkillTreesData;
import com.l2jmobius.gameserver.datatables.SkillData;
import com.l2jmobius.gameserver.model.L2SkillLearn;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.holders.ItemHolder;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* @author Sdw
*/
public class AcquireSkillList extends L2GameServerPacket
{
final L2PcInstance _activeChar;
final List<L2SkillLearn> _learnable;
public AcquireSkillList(L2PcInstance activeChar)
{
_activeChar = activeChar;
_learnable = SkillTreesData.getInstance().getAvailableSkillsList(activeChar, activeChar.getClassId(), false, false);
}
@Override
protected void writeImpl()
{
writeC(0x90);
writeH(_learnable.size());
for (L2SkillLearn skill : _learnable)
{
writeD(skill.getSkillId());
writeD(skill.getSkillLevel());
writeQ(skill.getLevelUpSp());
writeC(skill.getGetLevel());
writeC(skill.getDualClassLevel());
writeC(skill.getRequiredItems().size());
for (ItemHolder item : skill.getRequiredItems())
{
writeD(item.getId());
writeQ(item.getCount());
}
final List<Skill> skillRem = skill.getRemoveSkills().stream().map(_activeChar::getKnownSkill).filter(Objects::nonNull).collect(Collectors.toList());
writeC(skillRem.size());
for (Skill skillRemove : skillRem)
{
writeD(skillRemove.getId());
if (skillRemove.getLevel() < 100)
{
writeD(skillRemove.getLevel());
}
else
{
final int maxLevel = SkillData.getInstance().getMaxLevel(skillRemove.getId());
writeH(maxLevel);
writeH(skillRemove.getLevel());
}
}
}
}
}

View File

@ -0,0 +1,33 @@
/*
* This file is part of the L2J Mobius project.
*
* 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.l2jmobius.gameserver.network.serverpackets;
public final class ActionFailed extends L2GameServerPacket
{
public static final ActionFailed STATIC_PACKET = new ActionFailed();
private ActionFailed()
{
}
@Override
protected void writeImpl()
{
writeC(0x1F);
writeD(0x00); // TODO: Find me!
}
}

View File

@ -0,0 +1,106 @@
/*
* This file is part of the L2J Mobius project.
*
* 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.l2jmobius.gameserver.network.serverpackets;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
/**
* This class is made to create packets with any format
* @author Maktakien
*/
public class AdminForgePacket extends L2GameServerPacket
{
private final List<Part> _parts = new ArrayList<>();
private static class Part
{
public byte b;
public String str;
public Part(byte bb, String string)
{
b = bb;
str = string;
}
}
public AdminForgePacket()
{
}
@Override
protected void writeImpl()
{
for (Part p : _parts)
{
generate(p.b, p.str);
}
}
/**
* @param b
* @param string
* @return
*/
public boolean generate(byte b, String string)
{
if ((b == 'C') || (b == 'c'))
{
writeC(Integer.decode(string));
return true;
}
else if ((b == 'D') || (b == 'd'))
{
writeD(Integer.decode(string));
return true;
}
else if ((b == 'H') || (b == 'h'))
{
writeH(Integer.decode(string));
return true;
}
else if ((b == 'F') || (b == 'f'))
{
writeF(Double.parseDouble(string));
return true;
}
else if ((b == 'S') || (b == 's'))
{
writeS(string);
return true;
}
else if ((b == 'B') || (b == 'b') || (b == 'X') || (b == 'x'))
{
writeB(new BigInteger(string).toByteArray());
return true;
}
else if ((b == 'Q') || (b == 'q'))
{
writeQ(Long.decode(string));
return true;
}
return false;
}
public void addPart(byte b, String string)
{
_parts.add(new Part(b, string));
}
}

View File

@ -0,0 +1,200 @@
/*
* This file is part of the L2J Mobius project.
*
* 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.l2jmobius.gameserver.network.serverpackets;
import com.l2jmobius.gameserver.model.entity.ClanHall;
import com.l2jmobius.gameserver.model.entity.ClanHall.ClanHallFunction;
import com.l2jmobius.gameserver.model.entity.clanhall.AuctionableHall;
/**
* @author Steuf
*/
public class AgitDecoInfo extends L2GameServerPacket
{
private final AuctionableHall _clanHall;
public AgitDecoInfo(AuctionableHall ClanHall)
{
_clanHall = ClanHall;
}
//@formatter:off
/*
* Packet send, must be confirmed
writeC(0xf7);
writeD(0); // clanhall id
writeC(0); // FUNC_RESTORE_HP (Fireplace)
writeC(0); // FUNC_RESTORE_MP (Carpet)
writeC(0); // FUNC_RESTORE_MP (Statue)
writeC(0); // FUNC_RESTORE_EXP (Chandelier)
writeC(0); // FUNC_TELEPORT (Mirror)
writeC(0); // Crytal
writeC(0); // Curtain
writeC(0); // FUNC_ITEM_CREATE (Magic Curtain)
writeC(0); // FUNC_SUPPORT
writeC(0); // FUNC_SUPPORT (Flag)
writeC(0); // Front Platform
writeC(0); // FUNC_ITEM_CREATE
writeD(0);
writeD(0);
*/
//@formatter:on
@Override
protected final void writeImpl()
{
writeC(0xfd);
writeD(_clanHall.getId()); // clanhall id
// FUNC_RESTORE_HP
ClanHallFunction function = _clanHall.getFunction(ClanHall.FUNC_RESTORE_HP);
if ((function == null) || (function.getLvl() == 0))
{
writeC(0);
}
else if (((_clanHall.getGrade() == 0) && (function.getLvl() < 220)) || ((_clanHall.getGrade() == 1) && (function.getLvl() < 160)) || ((_clanHall.getGrade() == 2) && (function.getLvl() < 260)) || ((_clanHall.getGrade() == 3) && (function.getLvl() < 300)))
{
writeC(1);
}
else
{
writeC(2);
}
// FUNC_RESTORE_MP
function = _clanHall.getFunction(ClanHall.FUNC_RESTORE_MP);
if ((function == null) || (function.getLvl() == 0))
{
writeC(0);
writeC(0);
}
else if ((((_clanHall.getGrade() == 0) || (_clanHall.getGrade() == 1)) && (function.getLvl() < 25)) || ((_clanHall.getGrade() == 2) && (function.getLvl() < 30)) || ((_clanHall.getGrade() == 3) && (function.getLvl() < 40)))
{
writeC(1);
writeC(1);
}
else
{
writeC(2);
writeC(2);
}
// FUNC_RESTORE_EXP
function = _clanHall.getFunction(ClanHall.FUNC_RESTORE_EXP);
if ((function == null) || (function.getLvl() == 0))
{
writeC(0);
}
else if (((_clanHall.getGrade() == 0) && (function.getLvl() < 25)) || ((_clanHall.getGrade() == 1) && (function.getLvl() < 30)) || ((_clanHall.getGrade() == 2) && (function.getLvl() < 40)) || ((_clanHall.getGrade() == 3) && (function.getLvl() < 50)))
{
writeC(1);
}
else
{
writeC(2);
}
// FUNC_TELEPORT
function = _clanHall.getFunction(ClanHall.FUNC_TELEPORT);
if ((function == null) || (function.getLvl() == 0))
{
writeC(0);
}
else if (function.getLvl() < 2)
{
writeC(1);
}
else
{
writeC(2);
}
writeC(0);
// CURTAINS
function = _clanHall.getFunction(ClanHall.FUNC_DECO_CURTAINS);
if ((function == null) || (function.getLvl() == 0))
{
writeC(0);
}
else if (function.getLvl() <= 1)
{
writeC(1);
}
else
{
writeC(2);
}
// FUNC_ITEM_CREATE
function = _clanHall.getFunction(ClanHall.FUNC_ITEM_CREATE);
if ((function == null) || (function.getLvl() == 0))
{
writeC(0);
}
else if (((_clanHall.getGrade() == 0) && (function.getLvl() < 2)) || (function.getLvl() < 3))
{
writeC(1);
}
else
{
writeC(2);
}
// FUNC_SUPPORT
function = _clanHall.getFunction(ClanHall.FUNC_SUPPORT);
if ((function == null) || (function.getLvl() == 0))
{
writeC(0);
writeC(0);
}
else if (((_clanHall.getGrade() == 0) && (function.getLvl() < 2)) || ((_clanHall.getGrade() == 1) && (function.getLvl() < 4)) || ((_clanHall.getGrade() == 2) && (function.getLvl() < 5)) || ((_clanHall.getGrade() == 3) && (function.getLvl() < 8)))
{
writeC(1);
writeC(1);
}
else
{
writeC(2);
writeC(2);
}
// Front Plateform
function = _clanHall.getFunction(ClanHall.FUNC_DECO_FRONTPLATEFORM);
if ((function == null) || (function.getLvl() == 0))
{
writeC(0);
}
else if (function.getLvl() <= 1)
{
writeC(1);
}
else
{
writeC(2);
}
// FUNC_ITEM_CREATE
function = _clanHall.getFunction(ClanHall.FUNC_ITEM_CREATE);
if ((function == null) || (function.getLvl() == 0))
{
writeC(0);
}
else if (((_clanHall.getGrade() == 0) && (function.getLvl() < 2)) || (function.getLvl() < 3))
{
writeC(1);
}
else
{
writeC(2);
}
writeD(0); // TODO: Find me!
writeD(0); // TODO: Find me!
writeD(0); // TODO: Find me!
writeD(0); // TODO: Find me!
writeD(0); // TODO: Find me!
}
}

View File

@ -0,0 +1,113 @@
/*
* This file is part of the L2J Mobius project.
*
* 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.l2jmobius.gameserver.network.serverpackets;
import java.util.Collection;
import com.l2jmobius.gameserver.data.sql.impl.ClanTable;
import com.l2jmobius.gameserver.model.ClanInfo;
import com.l2jmobius.gameserver.model.L2Clan;
import com.l2jmobius.gameserver.network.clientpackets.RequestAllyInfo;
/**
* Sent in response to {@link RequestAllyInfo}, if applicable.<BR>
* @author afk5min
*/
public class AllianceInfo extends L2GameServerPacket
{
private final String _name;
private final int _total;
private final int _online;
private final String _leaderC;
private final String _leaderP;
private final ClanInfo[] _allies;
public AllianceInfo(int allianceId)
{
final L2Clan leader = ClanTable.getInstance().getClan(allianceId);
_name = leader.getAllyName();
_leaderC = leader.getName();
_leaderP = leader.getLeaderName();
final Collection<L2Clan> allies = ClanTable.getInstance().getClanAllies(allianceId);
_allies = new ClanInfo[allies.size()];
int idx = 0, total = 0, online = 0;
for (L2Clan clan : allies)
{
final ClanInfo ci = new ClanInfo(clan);
_allies[idx++] = ci;
total += ci.getTotal();
online += ci.getOnline();
}
_total = total;
_online = online;
}
@Override
protected void writeImpl()
{
writeC(0xB5);
writeS(_name);
writeD(_total);
writeD(_online);
writeS(_leaderC);
writeS(_leaderP);
writeD(_allies.length);
for (ClanInfo aci : _allies)
{
writeS(aci.getClan().getName());
writeD(0x00);
writeD(aci.getClan().getLevel());
writeS(aci.getClan().getLeaderName());
writeD(aci.getTotal());
writeD(aci.getOnline());
}
}
public String getName()
{
return _name;
}
public int getTotal()
{
return _total;
}
public int getOnline()
{
return _online;
}
public String getLeaderC()
{
return _leaderC;
}
public String getLeaderP()
{
return _leaderP;
}
public ClanInfo[] getAllies()
{
return _allies;
}
}

View File

@ -0,0 +1,49 @@
/*
* This file is part of the L2J Mobius project.
*
* 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.l2jmobius.gameserver.network.serverpackets;
import com.l2jmobius.Config;
import com.l2jmobius.gameserver.data.sql.impl.CrestTable;
public class AllyCrest extends L2GameServerPacket
{
private final int _crestId;
private final byte[] _data;
public AllyCrest(int crestId)
{
_crestId = crestId;
_data = CrestTable.getInstance().getCrest(crestId).getData();
}
@Override
protected final void writeImpl()
{
writeC(0xAF);
writeD(Config.SERVER_ID);
writeD(_crestId);
if (_data != null)
{
writeD(_data.length);
writeB(_data);
}
else
{
writeD(0);
}
}
}

View File

@ -0,0 +1,46 @@
/*
* This file is part of the L2J Mobius project.
*
* 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.l2jmobius.gameserver.network.serverpackets;
public class AskJoinAlly extends L2GameServerPacket
{
private final String _requestorName;
private final int _requestorObjId;
private final String _requestorAllyName;
/**
* @param requestorObjId
* @param requestorAllyName
* @param requestorName
*/
public AskJoinAlly(int requestorObjId, String requestorAllyName, String requestorName)
{
_requestorName = requestorName;
_requestorObjId = requestorObjId;
_requestorAllyName = requestorAllyName;
}
@Override
protected final void writeImpl()
{
writeC(0xbb);
writeD(_requestorObjId);
writeS(_requestorAllyName);
writeS(null); // TODO: Find me!
writeS(_requestorName);
}
}

View File

@ -0,0 +1,43 @@
/*
* This file is part of the L2J Mobius project.
*
* 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.l2jmobius.gameserver.network.serverpackets;
import com.l2jmobius.gameserver.enums.PartyDistributionType;
public class AskJoinParty extends L2GameServerPacket
{
private final String _requestorName;
private final PartyDistributionType _partyDistributionType;
/**
* @param requestorName
* @param partyDistributionType
*/
public AskJoinParty(String requestorName, PartyDistributionType partyDistributionType)
{
_requestorName = requestorName;
_partyDistributionType = partyDistributionType;
}
@Override
protected final void writeImpl()
{
writeC(0x39);
writeS(_requestorName);
writeD(_partyDistributionType.getId());
}
}

View File

@ -0,0 +1,52 @@
/*
* This file is part of the L2J Mobius project.
*
* 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.l2jmobius.gameserver.network.serverpackets;
public final class AskJoinPledge extends L2GameServerPacket
{
private final int _requestorObjId;
private final String _subPledgeName;
private final int _pledgeType;
private final String _pledgeName;
private final String _askjoinName;
public AskJoinPledge(int requestorObjId, String subPledgeName, int pledgeType, String pledgeName, String askjoinName)
{
_requestorObjId = requestorObjId;
_subPledgeName = subPledgeName;
_pledgeType = pledgeType;
_pledgeName = pledgeName;
_askjoinName = askjoinName;
}
@Override
protected final void writeImpl()
{
writeC(0x2c);
writeD(_requestorObjId);
writeS(_askjoinName);
writeS(_pledgeName);
if (_pledgeType != 0)
{
writeD(_pledgeType);
}
if (_subPledgeName != null)
{
writeS(_pledgeType > 0 ? _subPledgeName : _pledgeName);
}
}
}

View File

@ -0,0 +1,115 @@
/*
* This file is part of the L2J Mobius project.
*
* 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.l2jmobius.gameserver.network.serverpackets;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import com.l2jmobius.gameserver.model.Hit;
import com.l2jmobius.gameserver.model.Location;
import com.l2jmobius.gameserver.model.actor.L2Character;
public class Attack extends L2GameServerPacket
{
private final int _attackerObjId;
private final boolean _soulshot;
private final int _ssGrade;
private final Location _attackerLoc;
private final Location _targetLoc;
private final List<Hit> _hits = new ArrayList<>();
/**
* @param attacker
* @param target
* @param useShots
* @param ssGrade
*/
public Attack(L2Character attacker, L2Character target, boolean useShots, int ssGrade)
{
_attackerObjId = attacker.getObjectId();
_soulshot = useShots;
_ssGrade = Math.min(ssGrade, 6);
_attackerLoc = new Location(attacker);
_targetLoc = new Location(target);
}
/**
* Adds hit to the attack (Attacks such as dual dagger/sword/fist has two hits)
* @param target
* @param damage
* @param miss
* @param crit
* @param shld
*/
public void addHit(L2Character target, int damage, boolean miss, boolean crit, byte shld)
{
_hits.add(new Hit(target, damage, miss, crit, shld, _soulshot, _ssGrade));
}
/**
* @return {@code true} if current attack contains at least 1 hit.
*/
public boolean hasHits()
{
return !_hits.isEmpty();
}
/**
* @return {@code true} if attack has soul shot charged.
*/
public boolean hasSoulshot()
{
return _soulshot;
}
/**
* Writes current hit
* @param hit
*/
private void writeHit(Hit hit)
{
writeD(hit.getTargetId());
writeD(hit.getDamage());
writeD(hit.getFlags());
writeD(hit.getGrade()); // GOD
}
@Override
protected final void writeImpl()
{
final Iterator<Hit> it = _hits.iterator();
final Hit firstHit = it.next();
writeC(0x33);
writeD(_attackerObjId);
writeD(firstHit.getTargetId());
writeD(0x00); // Ertheia Unknown
writeD(firstHit.getDamage());
writeD(firstHit.getFlags());
writeD(firstHit.getGrade()); // GOD
writeLoc(_attackerLoc);
writeH(_hits.size() - 1);
while (it.hasNext())
{
writeHit(it.next());
}
writeLoc(_targetLoc);
}
}

View File

@ -0,0 +1,37 @@
/*
* This file is part of the L2J Mobius project.
*
* 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.l2jmobius.gameserver.network.serverpackets;
public final class AutoAttackStart extends L2GameServerPacket
{
private final int _targetObjId;
/**
* @param targetId
*/
public AutoAttackStart(int targetId)
{
_targetObjId = targetId;
}
@Override
protected final void writeImpl()
{
writeC(0x25);
writeD(_targetObjId);
}
}

View File

@ -0,0 +1,37 @@
/*
* This file is part of the L2J Mobius project.
*
* 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.l2jmobius.gameserver.network.serverpackets;
public class AutoAttackStop extends L2GameServerPacket
{
private final int _targetObjId;
/**
* @param targetObjId
*/
public AutoAttackStop(int targetObjId)
{
_targetObjId = targetObjId;
}
@Override
protected final void writeImpl()
{
writeC(0x26);
writeD(_targetObjId);
}
}

View File

@ -0,0 +1,68 @@
/*
* This file is part of the L2J Mobius project.
*
* 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.l2jmobius.gameserver.network.serverpackets;
import java.util.Collection;
import com.l2jmobius.Config;
import com.l2jmobius.gameserver.model.buylist.L2BuyList;
import com.l2jmobius.gameserver.model.buylist.Product;
public final class BuyList extends AbstractItemPacket
{
private final int _listId;
private final Collection<Product> _list;
private final long _money;
private double _taxRate = 0;
public BuyList(L2BuyList list, long currentMoney, double taxRate)
{
_listId = list.getListId();
_list = list.getProducts();
_money = currentMoney;
_taxRate = taxRate;
}
@Override
protected final void writeImpl()
{
writeC(0xFE);
writeH(0xB8);
writeD(0x00);
writeQ(_money); // current money
writeD(_listId);
writeD(0x00); // TODO: Find me
writeH(_list.size());
for (Product product : _list)
{
if ((product.getCount() > 0) || !product.hasLimitedStock())
{
writeItem(product);
if ((product.getItemId() >= 3960) && (product.getItemId() <= 4026))
{
writeQ((long) (product.getPrice() * Config.RATE_SIEGE_GUARDS_PRICE * (1 + _taxRate)));
}
else
{
writeQ((long) (product.getPrice() * (1 + _taxRate)));
}
}
}
}
}

View File

@ -0,0 +1,85 @@
/*
* This file is part of the L2J Mobius project.
*
* 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.l2jmobius.gameserver.network.serverpackets;
import java.util.ArrayList;
import java.util.List;
import com.l2jmobius.gameserver.instancemanager.CastleManorManager;
import com.l2jmobius.gameserver.model.SeedProduction;
/**
* @author l3x
*/
public final class BuyListSeed extends L2GameServerPacket
{
private final int _manorId;
private final long _money;
private final List<SeedProduction> _list = new ArrayList<>();
public BuyListSeed(long currentMoney, int castleId)
{
_money = currentMoney;
_manorId = castleId;
for (SeedProduction s : CastleManorManager.getInstance().getSeedProduction(castleId, false))
{
if ((s.getAmount() > 0) && (s.getPrice() > 0))
{
_list.add(s);
}
}
}
@Override
protected final void writeImpl()
{
writeC(0xe9);
writeQ(_money); // current money
writeD(0x00); // TODO: Find me!
writeD(_manorId); // manor id
if (!_list.isEmpty())
{
writeH(_list.size()); // list length
for (SeedProduction s : _list)
{
writeC(0x00); // mask item 0 to print minimal item information
writeD(s.getId()); // ObjectId
writeD(s.getId()); // ItemId
writeC(0xFF); // T1
writeQ(s.getAmount()); // Quantity
writeC(0x05); // Item Type 2 : 00-weapon, 01-shield/armor, 02-ring/earring/necklace, 03-questitem, 04-adena, 05-item
writeC(0x00); // Filler (always 0)
writeH(0x00); // Equipped : 00-No, 01-yes
writeQ(0x00); // Slot : 0006-lr.ear, 0008-neck, 0030-lr.finger, 0040-head, 0100-l.hand, 0200-gloves, 0400-chest, 0800-pants, 1000-feet, 4000-r.hand, 8000-r.hand
writeC(0x00); // Enchant level (pet level shown in control item)
writeC(0x00);
writeD(-1);
writeD(-9999);
writeC(0x01); // GOD Item enabled = 1 disabled (red) = 0
writeQ(s.getPrice()); // price
}
_list.clear();
}
else
{
writeH(0x00);
}
}
}

View File

@ -0,0 +1,35 @@
/*
* This file is part of the L2J Mobius project.
*
* 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.l2jmobius.gameserver.network.serverpackets;
public final class CSShowComBoard extends L2GameServerPacket
{
private final byte[] _html;
public CSShowComBoard(final byte[] html)
{
_html = html;
}
@Override
protected void writeImpl()
{
writeC(0x7b);
writeC(0x01); // c4 1 to show community 00 to hide
writeB(_html);
}
}

View File

@ -0,0 +1,38 @@
/*
* This file is part of the L2J Mobius project.
*
* 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.l2jmobius.gameserver.network.serverpackets;
public class CameraMode extends L2GameServerPacket
{
private final int _mode;
/**
* Forces client camera mode change
* @param mode 0 - third person cam 1 - first person cam
*/
public CameraMode(int mode)
{
_mode = mode;
}
@Override
public void writeImpl()
{
writeC(0xf7);
writeD(_mode);
}
}

View File

@ -0,0 +1,43 @@
/*
* This file is part of the L2J Mobius project.
*
* 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.l2jmobius.gameserver.network.serverpackets;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
public class ChairSit extends L2GameServerPacket
{
private final L2PcInstance _activeChar;
private final int _staticObjectId;
/**
* @param player
* @param staticObjectId
*/
public ChairSit(L2PcInstance player, int staticObjectId)
{
_activeChar = player;
_staticObjectId = staticObjectId;
}
@Override
protected final void writeImpl()
{
writeC(0xed);
writeD(_activeChar.getObjectId());
writeD(_staticObjectId);
}
}

View File

@ -0,0 +1,43 @@
/*
* This file is part of the L2J Mobius project.
*
* 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.l2jmobius.gameserver.network.serverpackets;
import com.l2jmobius.gameserver.model.actor.L2Character;
public class ChangeMoveType extends L2GameServerPacket
{
public static final int WALK = 0;
public static final int RUN = 1;
private final int _charObjId;
private final boolean _running;
public ChangeMoveType(L2Character character)
{
_charObjId = character.getObjectId();
_running = character.isRunning();
}
@Override
protected final void writeImpl()
{
writeC(0x28);
writeD(_charObjId);
writeD(_running ? RUN : WALK);
writeD(0); // c2
}
}

View File

@ -0,0 +1,52 @@
/*
* This file is part of the L2J Mobius project.
*
* 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.l2jmobius.gameserver.network.serverpackets;
import com.l2jmobius.gameserver.model.actor.L2Character;
public class ChangeWaitType extends L2GameServerPacket
{
private final int _charObjId;
private final int _moveType;
private final int _x, _y, _z;
public static final int WT_SITTING = 0;
public static final int WT_STANDING = 1;
public static final int WT_START_FAKEDEATH = 2;
public static final int WT_STOP_FAKEDEATH = 3;
public ChangeWaitType(L2Character character, int newMoveType)
{
_charObjId = character.getObjectId();
_moveType = newMoveType;
_x = character.getX();
_y = character.getY();
_z = character.getZ();
}
@Override
protected final void writeImpl()
{
writeC(0x29);
writeD(_charObjId);
writeD(_moveType);
writeD(_x);
writeD(_y);
writeD(_z);
}
}

View File

@ -0,0 +1,43 @@
/*
* This file is part of the L2J Mobius project.
*
* 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.l2jmobius.gameserver.network.serverpackets;
public class CharCreateFail extends L2GameServerPacket
{
public static final int REASON_CREATION_FAILED = 0x00; // "Your character creation has failed."
public static final int REASON_TOO_MANY_CHARACTERS = 0x01; // "You cannot create another character. Please delete the existing character and try again." Removes all settings that were selected (race, class, etc).
public static final int REASON_NAME_ALREADY_EXISTS = 0x02; // "This name already exists."
public static final int REASON_16_ENG_CHARS = 0x03; // "Your title cannot exceed 16 characters in length. Please try again."
public static final int REASON_INCORRECT_NAME = 0x04; // "Incorrect name. Please try again."
public static final int REASON_CREATE_NOT_ALLOWED = 0x05; // "Characters cannot be created from this server."
public static final int REASON_CHOOSE_ANOTHER_SVR = 0x06; // "Unable to create character. You are unable to create a new character on the selected server. A restriction is in place which restricts users from creating characters on different servers where no previous character exists. Please
// choose another server."
private final int _error;
public CharCreateFail(int errorCode)
{
_error = errorCode;
}
@Override
protected final void writeImpl()
{
writeC(0x10);
writeD(_error);
}
}

View File

@ -0,0 +1,27 @@
/*
* This file is part of the L2J Mobius project.
*
* 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.l2jmobius.gameserver.network.serverpackets;
public class CharCreateOk extends L2GameServerPacket
{
@Override
protected final void writeImpl()
{
writeC(0x0f);
writeD(0x01);
}
}

View File

@ -0,0 +1,38 @@
/*
* This file is part of the L2J Mobius project.
*
* 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.l2jmobius.gameserver.network.serverpackets;
public class CharDeleteFail extends L2GameServerPacket
{
public static final int REASON_DELETION_FAILED = 0x01;
public static final int REASON_YOU_MAY_NOT_DELETE_CLAN_MEMBER = 0x02;
public static final int REASON_CLAN_LEADERS_MAY_NOT_BE_DELETED = 0x03;
private final int _error;
public CharDeleteFail(int errorCode)
{
_error = errorCode;
}
@Override
protected final void writeImpl()
{
writeC(0x1e);
writeD(_error);
}
}

View File

@ -0,0 +1,26 @@
/*
* This file is part of the L2J Mobius project.
*
* 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.l2jmobius.gameserver.network.serverpackets;
public class CharDeleteSuccess extends L2GameServerPacket
{
@Override
protected final void writeImpl()
{
writeC(0x1d);
}
}

View File

@ -0,0 +1,246 @@
/*
* This file is part of the L2J Mobius project.
*
* 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.l2jmobius.gameserver.network.serverpackets;
import java.util.Set;
import com.l2jmobius.Config;
import com.l2jmobius.gameserver.instancemanager.CursedWeaponsManager;
import com.l2jmobius.gameserver.model.PcCondOverride;
import com.l2jmobius.gameserver.model.actor.L2Decoy;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.itemcontainer.Inventory;
import com.l2jmobius.gameserver.model.skills.AbnormalVisualEffect;
import com.l2jmobius.gameserver.model.zone.ZoneId;
public class CharInfo extends L2GameServerPacket
{
private final L2PcInstance _activeChar;
private int _objId;
private int _x, _y, _z, _heading;
private final int _mAtkSpd, _pAtkSpd;
private final int _runSpd, _walkSpd;
private final int _swimRunSpd;
private final int _swimWalkSpd;
private final int _flyRunSpd;
private final int _flyWalkSpd;
private final double _moveMultiplier;
private final float _attackSpeedMultiplier;
private int _enchantLevel = 0;
private int _armorEnchant = 0;
private int _vehicleId = 0;
public CharInfo(L2PcInstance cha)
{
_activeChar = cha;
_objId = cha.getObjectId();
if ((_activeChar.getVehicle() != null) && (_activeChar.getInVehiclePosition() != null))
{
_x = _activeChar.getInVehiclePosition().getX();
_y = _activeChar.getInVehiclePosition().getY();
_z = _activeChar.getInVehiclePosition().getZ();
_vehicleId = _activeChar.getVehicle().getObjectId();
}
else
{
_x = _activeChar.getX();
_y = _activeChar.getY();
_z = _activeChar.getZ();
}
_heading = _activeChar.getHeading();
_mAtkSpd = _activeChar.getMAtkSpd();
_pAtkSpd = (int) _activeChar.getPAtkSpd();
_attackSpeedMultiplier = _activeChar.getAttackSpeedMultiplier();
setInvisible(cha.isInvisible());
_moveMultiplier = cha.getMovementSpeedMultiplier();
_runSpd = (int) Math.round(cha.getRunSpeed() / _moveMultiplier);
_walkSpd = (int) Math.round(cha.getWalkSpeed() / _moveMultiplier);
_swimRunSpd = (int) Math.round(cha.getSwimRunSpeed() / _moveMultiplier);
_swimWalkSpd = (int) Math.round(cha.getSwimWalkSpeed() / _moveMultiplier);
_flyRunSpd = cha.isFlying() ? _runSpd : 0;
_flyWalkSpd = cha.isFlying() ? _walkSpd : 0;
_enchantLevel = cha.getInventory().getWeaponEnchant();
_armorEnchant = cha.getInventory().getArmorMinEnchant();
}
public CharInfo(L2Decoy decoy)
{
this(decoy.getActingPlayer()); // init
_objId = decoy.getObjectId();
_x = decoy.getX();
_y = decoy.getY();
_z = decoy.getZ();
_heading = decoy.getHeading();
}
@Override
protected final void writeImpl()
{
boolean gmSeeInvis = false;
if (isInvisible())
{
final L2PcInstance activeChar = getClient().getActiveChar();
if ((activeChar != null) && activeChar.canOverrideCond(PcCondOverride.SEE_ALL_PLAYERS))
{
gmSeeInvis = true;
}
}
writeC(0x31);
writeD(_x); // Confirmed
writeD(_y); // Confirmed
writeD(_z); // Confirmed
writeD(_vehicleId); // Confirmed
writeD(_objId); // Confirmed
writeS(_activeChar.getAppearance().getVisibleName()); // Confirmed
writeH(_activeChar.getRace().ordinal()); // Confirmed
writeC(_activeChar.getAppearance().getSex() ? 0x01 : 0x00); // Confirmed
writeD(_activeChar.getBaseClassId()); // Confirmed
for (int slot : Inventory.PAPERDOLL_ORDER)
{
writeD(_activeChar.getInventory().getPaperdollItemDisplayId(slot)); // Confirmed
}
for (int slot : Inventory.PAPERDOLL_ORDER_AUGMENT)
{
writeD(_activeChar.getInventory().getPaperdoll1stAugmentationId(slot));
writeD(_activeChar.getInventory().getPaperdoll2ndAugmentationId(slot));
}
writeC(_armorEnchant);
for (int slot : Inventory.PAPERDOLL_ORDER_VISUAL_ID)
{
writeD(_activeChar.getInventory().getPaperdollItemVisualId(slot));
}
writeC(_activeChar.getPvpFlag());
writeD(_activeChar.getReputation());
writeD(_mAtkSpd);
writeD(_pAtkSpd);
writeH(_runSpd);
writeH(_walkSpd);
writeH(_swimRunSpd);
writeH(_swimWalkSpd);
writeH(_flyRunSpd);
writeH(_flyWalkSpd);
writeH(_flyRunSpd);
writeH(_flyWalkSpd);
writeF(_moveMultiplier);
writeF(_attackSpeedMultiplier);
writeF(_activeChar.getCollisionRadius());
writeF(_activeChar.getCollisionHeight());
writeD(_activeChar.getVisualHair());
writeD(_activeChar.getVisualHairColor());
writeD(_activeChar.getVisualFace());
writeS(gmSeeInvis ? "[Invisible]" : _activeChar.getAppearance().getVisibleTitle());
if (!_activeChar.isCursedWeaponEquipped())
{
writeD(_activeChar.getClanId());
writeD(_activeChar.getClanCrestId());
writeD(_activeChar.getAllyId());
writeD(_activeChar.getAllyCrestId());
}
else
{
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0x00);
}
writeC(_activeChar.isSitting() ? 0x00 : 0x01); // Confirmed
writeC(_activeChar.isRunning() ? 0x01 : 0x00); // Confirmed
writeC(_activeChar.isInCombat() ? 0x01 : 0x00); // Confirmed
writeC(!_activeChar.isInOlympiadMode() && _activeChar.isAlikeDead() ? 0x01 : 0x00); // Confirmed
writeC(!gmSeeInvis && isInvisible() ? 0x01 : 0x00); // TODO: Find me!
writeC(_activeChar.getMountType().ordinal()); // 1-on Strider, 2-on Wyvern, 3-on Great Wolf, 0-no mount
writeC(_activeChar.getPrivateStoreType().getId()); // Confirmed
writeH(_activeChar.getCubics().size()); // Confirmed
_activeChar.getCubics().keySet().forEach(this::writeH);
writeC(_activeChar.isInPartyMatchRoom() ? 0x01 : 0x00); // Confirmed
writeC(_activeChar.isInsideZone(ZoneId.WATER) ? 1 : _activeChar.isFlyingMounted() ? 2 : 0);
writeH(_activeChar.getRecomHave()); // Confirmed
writeD(_activeChar.getMountNpcId() == 0 ? 0 : _activeChar.getMountNpcId() + 1000000);
writeD(_activeChar.getClassId().getId()); // Confirmed
writeD(0x00); // TODO: Find me!
writeC(_activeChar.isMounted() ? 0 : _enchantLevel); // Confirmed
writeC(_activeChar.getTeam().getId()); // Confirmed
writeD(_activeChar.getClanCrestLargeId());
writeC(_activeChar.isNoble() ? 1 : 0); // Confirmed
writeC(_activeChar.isHero() || (_activeChar.isGM() && Config.GM_HERO_AURA) ? 1 : 0); // Confirmed
writeC(_activeChar.isFishing() ? 1 : 0); // Confirmed
writeD(_activeChar.getFishx()); // Confirmed
writeD(_activeChar.getFishy()); // Confirmed
writeD(_activeChar.getFishz()); // Confirmed
writeD(_activeChar.getAppearance().getNameColor()); // Confirmed
writeD(_heading); // Confirmed
writeC(_activeChar.getPledgeClass());
writeH(_activeChar.getPledgeType());
writeD(_activeChar.getAppearance().getTitleColor()); // Confirmed
writeC(_activeChar.isCursedWeaponEquipped() ? CursedWeaponsManager.getInstance().getLevel(_activeChar.getCursedWeaponEquippedId()) : 0); // TODO: Find me!
writeD(_activeChar.getClanId() > 0 ? _activeChar.getClan().getReputationScore() : 0);
writeD(_activeChar.getTransformationDisplayId()); // Confirmed
writeD(_activeChar.getAgathionId()); // Confirmed
writeC(0x01); // TODO: Find me!
writeD((int) Math.round(_activeChar.getCurrentCp())); // Confirmed
writeD(_activeChar.getMaxHp()); // Confirmed
writeD((int) Math.round(_activeChar.getCurrentHp())); // Confirmed
writeD(_activeChar.getMaxMp()); // Confirmed
writeD((int) Math.round(_activeChar.getCurrentMp())); // Confirmed
writeC(0x00); // TODO: Find me!
final Set<AbnormalVisualEffect> abnormalVisualEffects = _activeChar.getCurrentAbnormalVisualEffects();
writeD(abnormalVisualEffects.size()); // Confirmed
for (AbnormalVisualEffect abnormalVisualEffect : abnormalVisualEffects)
{
writeH(abnormalVisualEffect.getClientId()); // Confirmed
}
writeC(0x00); // TODO: Find me!
writeC(_activeChar.isHairAccessoryEnabled() ? 0x01 : 0x00); // Hair accessory
writeC(_activeChar.getAbilityPointsUsed()); // Used Ability Points
}
}

View File

@ -0,0 +1,83 @@
/*
* This file is part of the L2J Mobius project.
*
* 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.l2jmobius.gameserver.network.serverpackets;
import com.l2jmobius.gameserver.GameTimeController;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
public class CharSelected extends L2GameServerPacket
{
private final L2PcInstance _activeChar;
private final int _sessionId;
/**
* @param cha
* @param sessionId
*/
public CharSelected(L2PcInstance cha, int sessionId)
{
_activeChar = cha;
_sessionId = sessionId;
}
@Override
protected final void writeImpl()
{
writeC(0x0B);
writeS(_activeChar.getName());
writeD(_activeChar.getObjectId());
writeS(_activeChar.getTitle());
writeD(_sessionId);
writeD(_activeChar.getClanId());
writeD(0x00); // ??
writeD(_activeChar.getAppearance().getSex() ? 1 : 0);
writeD(_activeChar.getRace().ordinal());
writeD(_activeChar.getClassId().getId());
writeD(0x01); // active ??
writeD(_activeChar.getX());
writeD(_activeChar.getY());
writeD(_activeChar.getZ());
writeF(_activeChar.getCurrentHp());
writeF(_activeChar.getCurrentMp());
writeQ(_activeChar.getSp());
writeQ(_activeChar.getExp());
writeD(_activeChar.getLevel());
writeD(_activeChar.getReputation());
writeD(_activeChar.getPkKills());
writeD(GameTimeController.getInstance().getGameTime() % (24 * 60)); // "reset" on 24th hour
writeD(0x00);
writeD(_activeChar.getClassId().getId());
writeB(new byte[16]);
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeB(new byte[28]);
writeD(0x00);
}
}

View File

@ -0,0 +1,347 @@
/*
* This file is part of the L2J Mobius project.
*
* 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.l2jmobius.gameserver.network.serverpackets;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import com.l2jmobius.Config;
import com.l2jmobius.commons.database.pool.impl.ConnectionFactory;
import com.l2jmobius.gameserver.data.sql.impl.ClanTable;
import com.l2jmobius.gameserver.data.xml.impl.ExperienceData;
import com.l2jmobius.gameserver.model.CharSelectInfoPackage;
import com.l2jmobius.gameserver.model.L2Clan;
import com.l2jmobius.gameserver.model.itemcontainer.Inventory;
import com.l2jmobius.gameserver.network.L2GameClient;
public class CharSelectionInfo extends L2GameServerPacket
{
private static Logger _log = Logger.getLogger(CharSelectionInfo.class.getName());
private final String _loginName;
private final int _sessionId;
private final List<CharSelectInfoPackage> _characterPackages;
/**
* Constructor for CharSelectionInfo.
* @param loginName
* @param sessionId
*/
public CharSelectionInfo(String loginName, int sessionId)
{
_sessionId = sessionId;
_loginName = loginName;
_characterPackages = loadCharacterSelectInfo(_loginName);
}
public List<CharSelectInfoPackage> getCharInfo()
{
return _characterPackages;
}
@Override
protected final void writeImpl()
{
writeC(0x09); // packet id
final int size = (_characterPackages.size());
writeD(size); // How many char there is on this account
// 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(size == Config.MAX_CHARACTERS_NUMBER_PER_ACCOUNT ? 0x01 : 0x00); // if 1 can't create new char
writeC(0x01); // play mode, if 1 can create only 2 char in regular lobby
writeC(0x02); // play mode, if 1 can create only 2 char in regular lobby
writeD(0x00); // if 1, korean client
int charId = 0;
if (!_characterPackages.isEmpty())
{
long lastAccess = -1L;
charId = _characterPackages.get(0).getObjectId();
for (CharSelectInfoPackage info : _characterPackages)
{
if (info.isAvailable() && (lastAccess < info.getLastAccess()))
{
lastAccess = info.getLastAccess();
charId = info.getObjectId();
}
}
}
for (CharSelectInfoPackage charInfoPackage : _characterPackages)
{
writeS(charInfoPackage.getName());
writeD(charInfoPackage.getObjectId());
writeS(_loginName);
writeD(_sessionId);
writeD(charInfoPackage.getClanId());
writeD(0x00);
writeD(charInfoPackage.getSex());
writeD(charInfoPackage.getRace());
writeD(charInfoPackage.getBaseClassId());
writeD(Config.SERVER_ID);
writeD(charInfoPackage.getX());
writeD(charInfoPackage.getY());
writeD(charInfoPackage.getZ());
writeF(charInfoPackage.getCurrentHp());
writeF(charInfoPackage.getCurrentMp());
writeQ(charInfoPackage.getSp());
writeQ(charInfoPackage.getExp());
writeF((float) (charInfoPackage.getExp() - ExperienceData.getInstance().getExpForLevel(charInfoPackage.getLevel())) / (ExperienceData.getInstance().getExpForLevel(charInfoPackage.getLevel() + 1) - ExperienceData.getInstance().getExpForLevel(charInfoPackage.getLevel()))); // High Five
writeD(charInfoPackage.getLevel());
writeD(charInfoPackage.getReputation());
writeD(charInfoPackage.getPkKills());
writeD(charInfoPackage.getPvPKills());
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0x00); // Ertheia
writeD(0x00); // Ertheia
for (int slot : Inventory.PAPERDOLL_ORDER_ALL)
{
writeD(charInfoPackage.getPaperdollItemId(slot));
}
for (int slot : Inventory.PAPERDOLL_ORDER_VISUAL_ID)
{
writeD(charInfoPackage.getPaperdollItemVisualId(slot));
}
writeH(charInfoPackage.getEnchantEffect(Inventory.PAPERDOLL_CHEST));
writeH(charInfoPackage.getEnchantEffect(Inventory.PAPERDOLL_LEGS));
writeH(charInfoPackage.getEnchantEffect(Inventory.PAPERDOLL_HEAD));
writeH(charInfoPackage.getEnchantEffect(Inventory.PAPERDOLL_GLOVES));
writeH(charInfoPackage.getEnchantEffect(Inventory.PAPERDOLL_FEET));
writeD(charInfoPackage.getHairStyle());
writeD(charInfoPackage.getHairColor());
writeD(charInfoPackage.getFace());
writeF(charInfoPackage.getMaxHp());
writeF(charInfoPackage.getMaxMp());
writeD(charInfoPackage.getDeleteTimer() > 0 ? (int) ((charInfoPackage.getDeleteTimer() - System.currentTimeMillis()) / 1000) : 0);
writeD(charInfoPackage.getClassId());
writeD(charId == charInfoPackage.getObjectId() ? 0x01 : 0x00);
writeC(charInfoPackage.getWeaponEnchantEffect());
writeD(charInfoPackage.get1stAugmentationId());
writeD(charInfoPackage.get2ndAugmentationId());
writeD(charInfoPackage.getTransformationId());
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeF(0x00);
writeF(0x00);
writeD(charInfoPackage.getVitalityPoints());
writeD(charInfoPackage.getVitalityPercent());
writeD(charInfoPackage.getVitalityItemCount());
writeD(charInfoPackage.isAvailable());
writeC(0x00);
writeC(charInfoPackage.isHero()); // hero glow
writeC(charInfoPackage.isHairAccessoryEnabled() ? 0x01 : 0x00); // show hair accessory if enabled
}
}
private static List<CharSelectInfoPackage> loadCharacterSelectInfo(String loginName)
{
final List<CharSelectInfoPackage> characterList = new ArrayList<>();
try (Connection con = ConnectionFactory.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
{
final CharSelectInfoPackage charInfopackage = restoreChar(charList);
if (charInfopackage != null)
{
characterList.add(charInfopackage);
}
}
}
}
catch (Exception e)
{
_log.log(Level.WARNING, "Could not restore char info: " + e.getMessage(), e);
}
return characterList;
}
private static void loadCharacterSubclassInfo(CharSelectInfoPackage charInfopackage, int ObjectId, int activeClassId)
{
try (Connection con = ConnectionFactory.getInstance().getConnection();
PreparedStatement statement = con.prepareStatement("SELECT exp, sp, level, vitality_points 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"));
charInfopackage.setVitalityPoints(charList.getInt("vitality_points"));
}
}
}
catch (Exception e)
{
_log.log(Level.WARNING, "Could not restore char subclass info: " + e.getMessage(), e);
}
}
private static CharSelectInfoPackage restoreChar(ResultSet chardata) throws Exception
{
final int objectId = chardata.getInt("charId");
final String name = chardata.getString("char_name");
// See if the char must be deleted
final long deletetime = chardata.getLong("deletetime");
if (deletetime > 0)
{
if (System.currentTimeMillis() > deletetime)
{
final L2Clan clan = ClanTable.getInstance().getClan(chardata.getInt("clanid"));
if (clan != null)
{
clan.removeClanMember(objectId, 0);
}
L2GameClient.deleteCharByObjId(objectId);
return null;
}
}
final 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.setReputation(chardata.getInt("reputation"));
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.getLong("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"));
final int faction = chardata.getInt("faction");
if (faction == 1)
{
charInfopackage.setGood();
}
if (faction == 2)
{
charInfopackage.setEvil();
}
if (Config.L2JMOD_MULTILANG_ENABLE)
{
String lang = chardata.getString("language");
if (!Config.L2JMOD_MULTILANG_ALLOWED.contains(lang))
{
lang = Config.L2JMOD_MULTILANG_DEFAULT;
}
charInfopackage.setHtmlPrefix("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 = ConnectionFactory.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())
{
final 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;
}
}

View File

@ -0,0 +1,34 @@
/*
* This file is part of the L2J Mobius project.
*
* 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.l2jmobius.gameserver.network.serverpackets;
public final class ChooseInventoryItem extends L2GameServerPacket
{
private final int _itemId;
public ChooseInventoryItem(int itemId)
{
_itemId = itemId;
}
@Override
protected final void writeImpl()
{
writeC(0x7c);
writeD(_itemId);
}
}

View File

@ -0,0 +1,36 @@
/*
* This file is part of the L2J Mobius project.
*
* 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.l2jmobius.gameserver.network.serverpackets;
import com.l2jmobius.gameserver.GameTimeController;
public class ClientSetTime extends L2GameServerPacket
{
public static final ClientSetTime STATIC_PACKET = new ClientSetTime();
private ClientSetTime()
{
}
@Override
protected final void writeImpl()
{
writeC(0xf2);
writeD(GameTimeController.getInstance().getGameTime()); // time in client minutes
writeD(6); // constant to match the server time( this determines the speed of the client clock)
}
}

View File

@ -0,0 +1,79 @@
/*
* This file is part of the L2J Mobius project.
*
* 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.l2jmobius.gameserver.network.serverpackets;
import com.l2jmobius.gameserver.network.SystemMessageId;
/**
* ConfirmDlg server packet implementation.
* @author kombat, UnAfraid
*/
public class ConfirmDlg extends AbstractMessagePacket<ConfirmDlg>
{
private int _time;
private int _requesterId;
public ConfirmDlg(SystemMessageId smId)
{
super(smId);
}
public ConfirmDlg(int id)
{
this(SystemMessageId.getSystemMessageId(id));
}
public ConfirmDlg(String text)
{
this(SystemMessageId.S13);
addString(text);
}
public ConfirmDlg addTime(int time)
{
_time = time;
return this;
}
public ConfirmDlg addRequesterId(int id)
{
_requesterId = id;
return this;
}
@Override
protected void writeParamsSize(int size)
{
writeD(size);
}
@Override
protected void writeParamType(int type)
{
writeD(type);
}
@Override
protected final void writeImpl()
{
writeC(0xF3);
writeD(getId());
writeMe();
writeD(_time);
writeD(_requesterId);
}
}

View File

@ -0,0 +1,182 @@
/*
* This file is part of the L2J Mobius project.
*
* 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.l2jmobius.gameserver.network.serverpackets;
import java.util.ArrayList;
import java.util.List;
import com.l2jmobius.gameserver.enums.ChatType;
import com.l2jmobius.gameserver.instancemanager.MentorManager;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.network.NpcStringId;
import com.l2jmobius.gameserver.network.SystemMessageId;
public final class CreatureSay extends L2GameServerPacket
{
private final int _objectId;
private final ChatType _textType;
private String _charName = null;
private int _charId = 0;
private String _text = null;
private int _npcString = -1;
private int _mask;
private int _charLevel = -1;
private List<String> _parameters;
/**
* @param sender
* @param receiver
* @param name
* @param messageType
* @param text
*/
public CreatureSay(L2PcInstance sender, L2PcInstance receiver, String name, ChatType messageType, String text)
{
_objectId = sender.getObjectId();
_charName = name;
_charLevel = sender.getLevel();
_textType = messageType;
_text = text;
if (receiver.getFriendList().containsKey(sender.getObjectId()))
{
_mask |= 0x01;
}
if ((receiver.getClanId() > 0) && (receiver.getClanId() == sender.getClanId()))
{
_mask |= 0x02;
}
if ((MentorManager.getInstance().getMentee(receiver.getObjectId(), sender.getObjectId()) != null) || (MentorManager.getInstance().getMentee(sender.getObjectId(), receiver.getObjectId()) != null))
{
_mask |= 0x04;
}
if ((receiver.getAllyId() > 0) && (receiver.getAllyId() == sender.getAllyId()))
{
_mask |= 0x08;
}
// Does not shows level
if (sender.isGM())
{
_mask |= 0x10;
}
}
/**
* @param objectId
* @param messageType
* @param charName
* @param text
*/
public CreatureSay(int objectId, ChatType messageType, String charName, String text)
{
_objectId = objectId;
_textType = messageType;
_charName = charName;
_text = text;
}
public CreatureSay(L2PcInstance player, ChatType messageType, String text)
{
_objectId = player.getObjectId();
_textType = messageType;
_charName = player.getAppearance().getVisibleName();
_text = text;
}
public CreatureSay(int objectId, ChatType messageType, int charId, NpcStringId npcString)
{
_objectId = objectId;
_textType = messageType;
_charId = charId;
_npcString = npcString.getId();
}
public CreatureSay(int objectId, ChatType messageType, String charName, NpcStringId npcString)
{
_objectId = objectId;
_textType = messageType;
_charName = charName;
_npcString = npcString.getId();
}
public CreatureSay(int objectId, ChatType messageType, int charId, SystemMessageId sysString)
{
_objectId = objectId;
_textType = messageType;
_charId = charId;
_npcString = sysString.getId();
}
/**
* String parameter for argument S1,S2,.. in npcstring-e.dat
* @param text
*/
public void addStringParameter(String text)
{
if (_parameters == null)
{
_parameters = new ArrayList<>();
}
_parameters.add(text);
}
@Override
protected final void writeImpl()
{
writeC(0x4A);
writeD(_objectId);
writeD(_textType.getClientId());
if (_charName != null)
{
writeS(_charName);
}
else
{
writeD(_charId);
}
writeD(_npcString); // High Five NPCString ID
if (_text != null)
{
writeS(_text);
if ((_charLevel > 0) && (_textType == ChatType.WHISPER))
{
writeC(_mask);
if ((_mask & 0x10) == 0)
{
writeC(_charLevel);
}
}
}
else if (_parameters != null)
{
for (String s : _parameters)
{
writeS(s);
}
}
}
@Override
public final void runImpl()
{
final L2PcInstance _pci = getClient().getActiveChar();
if (_pci != null)
{
_pci.broadcastSnoop(_textType, _charName, _text);
}
}
}

View File

@ -0,0 +1,42 @@
/*
* This file is part of the L2J Mobius project.
*
* 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.l2jmobius.gameserver.network.serverpackets;
import com.l2jmobius.gameserver.model.L2Object;
public final class DeleteObject extends L2GameServerPacket
{
private final int _objectId;
public DeleteObject(L2Object obj)
{
_objectId = obj.getObjectId();
}
public DeleteObject(int objectId)
{
_objectId = objectId;
}
@Override
protected final void writeImpl()
{
writeC(0x08);
writeD(_objectId);
writeC(0x00); // c2
}
}

View File

@ -0,0 +1,57 @@
/*
* This file is part of the L2J Mobius project.
*
* 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.l2jmobius.gameserver.network.serverpackets;
public class Dice extends L2GameServerPacket
{
private final int _charObjId;
private final int _itemId;
private final int _number;
private final int _x;
private final int _y;
private final int _z;
/**
* @param charObjId
* @param itemId
* @param number
* @param x
* @param y
* @param z
*/
public Dice(int charObjId, int itemId, int number, int x, int y, int z)
{
_charObjId = charObjId;
_itemId = itemId;
_number = number;
_x = x;
_y = y;
_z = z;
}
@Override
protected final void writeImpl()
{
writeC(0xda);
writeD(_charObjId); // object id of player
writeD(_itemId); // item id of dice (spade) 4625,4626,4627,4628
writeD(_number); // number rolled
writeD(_x); // x
writeD(_y); // y
writeD(_z); // z
}
}

View File

@ -0,0 +1,123 @@
/*
* This file is part of the L2J Mobius project.
*
* 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.l2jmobius.gameserver.network.serverpackets;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import com.l2jmobius.gameserver.instancemanager.CHSiegeManager;
import com.l2jmobius.gameserver.instancemanager.CastleManager;
import com.l2jmobius.gameserver.instancemanager.FortManager;
import com.l2jmobius.gameserver.model.L2Clan;
import com.l2jmobius.gameserver.model.L2SiegeClan;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.entity.Castle;
import com.l2jmobius.gameserver.model.entity.Fort;
import com.l2jmobius.gameserver.model.entity.clanhall.SiegableHall;
/**
* @author UnAfraid, Nos
*/
public class Die extends L2GameServerPacket
{
private final int _objectId;
private boolean _toVillage;
private boolean _toClanHall;
private boolean _toCastle;
private boolean _toOutpost;
private final boolean _isSweepable;
private boolean _useFeather;
private boolean _toFortress;
private List<Integer> _items = null;
public Die(L2Character activeChar)
{
_objectId = activeChar.getObjectId();
if (activeChar.isPlayer())
{
final L2Clan clan = activeChar.getActingPlayer().getClan();
boolean isInCastleDefense = false;
boolean isInFortDefense = false;
L2SiegeClan siegeClan = null;
final Castle castle = CastleManager.getInstance().getCastle(activeChar);
final Fort fort = FortManager.getInstance().getFort(activeChar);
final SiegableHall hall = CHSiegeManager.getInstance().getNearbyClanHall(activeChar);
if ((castle != null) && castle.getSiege().isInProgress())
{
siegeClan = castle.getSiege().getAttackerClan(clan);
isInCastleDefense = (siegeClan == null) && castle.getSiege().checkIsDefender(clan);
}
else if ((fort != null) && fort.getSiege().isInProgress())
{
siegeClan = fort.getSiege().getAttackerClan(clan);
isInFortDefense = (siegeClan == null) && fort.getSiege().checkIsDefender(clan);
}
_toVillage = activeChar.canRevive() && !activeChar.isPendingRevive();
_toClanHall = (clan != null) && (clan.getHideoutId() > 0);
_toCastle = ((clan != null) && (clan.getCastleId() > 0)) || isInCastleDefense;
_toOutpost = ((siegeClan != null) && !isInCastleDefense && !isInFortDefense && !siegeClan.getFlag().isEmpty()) || ((hall != null) && hall.getSiege().checkIsAttacker(clan));
_useFeather = activeChar.getAccessLevel().allowFixedRes();
_toFortress = ((clan != null) && (clan.getFortId() > 0)) || isInFortDefense;
}
_isSweepable = activeChar.isAttackable() && activeChar.isSweepActive();
}
public void addItem(int itemId)
{
if (_items == null)
{
_items = new ArrayList<>(8);
}
if (_items.size() < 8)
{
_items.add(itemId);
}
else
{
throw new IndexOutOfBoundsException("Die packet doesn't support more then 8 items!");
}
}
public List<Integer> getItems()
{
return _items != null ? _items : Collections.emptyList();
}
@Override
protected final void writeImpl()
{
writeC(0x00);
writeD(_objectId);
writeD(_toVillage ? 0x01 : 0x00);
writeD(_toClanHall ? 0x01 : 0x00);
writeD(_toCastle ? 0x01 : 0x00);
writeD(_toOutpost ? 0x01 : 0x00);
writeD(_isSweepable ? 0x01 : 0x00);
writeD(_useFeather ? 0x01 : 0x00);
writeD(_toFortress ? 0x01 : 0x00);
writeD(0x00);
writeD(0x00);
writeC(0x00);
writeD(0x00);
writeD(0x00);
}
}

View File

@ -0,0 +1,37 @@
/*
* This file is part of the L2J Mobius project.
*
* 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.l2jmobius.gameserver.network.serverpackets;
import com.l2jmobius.gameserver.model.actor.instance.L2DoorInstance;
public final class DoorInfo extends L2GameServerPacket
{
private final L2DoorInstance _door;
public DoorInfo(L2DoorInstance door)
{
_door = door;
}
@Override
protected final void writeImpl()
{
writeC(0x4c);
writeD(_door.getObjectId());
writeD(_door.getId());
}
}

View File

@ -0,0 +1,42 @@
/*
* This file is part of the L2J Mobius project.
*
* 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.l2jmobius.gameserver.network.serverpackets;
import com.l2jmobius.gameserver.model.actor.instance.L2DoorInstance;
public final class DoorStatusUpdate extends L2GameServerPacket
{
private final L2DoorInstance _door;
public DoorStatusUpdate(L2DoorInstance door)
{
_door = door;
}
@Override
protected final void writeImpl()
{
writeC(0x4d);
writeD(_door.getObjectId());
writeD(_door.getOpen() ? 0 : 1);
writeD(_door.getDamage());
writeD(_door.isEnemy() ? 1 : 0);
writeD(_door.getId());
writeD((int) _door.getCurrentHp());
writeD(_door.getMaxHp());
}
}

View File

@ -0,0 +1,55 @@
/*
* This file is part of the L2J Mobius project.
*
* 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.l2jmobius.gameserver.network.serverpackets;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
public class DropItem extends L2GameServerPacket
{
private final L2ItemInstance _item;
private final int _charObjId;
/**
* Constructor of the DropItem server packet
* @param item : L2ItemInstance designating the item
* @param playerObjId : int designating the player ID who dropped the item
*/
public DropItem(L2ItemInstance item, int playerObjId)
{
_item = item;
_charObjId = playerObjId;
}
@Override
protected final void writeImpl()
{
writeC(0x16);
writeD(_charObjId);
writeD(_item.getObjectId());
writeD(_item.getDisplayId());
writeD(_item.getX());
writeD(_item.getY());
writeD(_item.getZ());
// only show item count if it is a stackable item
writeC(_item.isStackable() ? 0x01 : 0x00);
writeQ(_item.getCount());
writeC(0x00);
// writeD(0x01); if above C == true (1) then readD()
}
}

View File

@ -0,0 +1,54 @@
/*
* This file is part of the L2J Mobius project.
*
* 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.l2jmobius.gameserver.network.serverpackets;
public class Earthquake extends L2GameServerPacket
{
private final int _x;
private final int _y;
private final int _z;
private final int _intensity;
private final int _duration;
/**
* @param x
* @param y
* @param z
* @param intensity
* @param duration
*/
public Earthquake(int x, int y, int z, int intensity, int duration)
{
_x = x;
_y = y;
_z = z;
_intensity = intensity;
_duration = duration;
}
@Override
protected final void writeImpl()
{
writeC(0xD3);
writeD(_x);
writeD(_y);
writeD(_z);
writeD(_intensity);
writeD(_duration);
writeD(0x00); // Unknown
}
}

View File

@ -0,0 +1,67 @@
/*
* This file is part of the L2J Mobius project.
*
* 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.l2jmobius.gameserver.network.serverpackets;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
public class EnchantResult extends L2GameServerPacket
{
public static int SUCCESS = 0;
public static int FAIL = 1;
public static int ERROR = 2;
public static int BLESSED_FAIL = 3;
public static int NO_CRYSTAL = 4;
public static int SAFE_FAIL = 5;
private final int _result;
private final int _crystal;
private final int _count;
private final int _enchantLevel;
private final int[] _enchantOptions;
public EnchantResult(int result, int crystal, int count, int enchantLevel, int[] options)
{
_result = result;
_crystal = crystal;
_count = count;
_enchantLevel = enchantLevel;
_enchantOptions = options;
}
public EnchantResult(int result, int crystal, int count)
{
this(result, crystal, count, 0, L2ItemInstance.DEFAULT_ENCHANT_OPTIONS);
}
public EnchantResult(int result, L2ItemInstance item)
{
this(result, 0, 0, item.getEnchantLevel(), item.getEnchantOptions());
}
@Override
protected final void writeImpl()
{
writeC(0x87);
writeD(_result);
writeD(_crystal);
writeQ(_count);
writeD(_enchantLevel);
for (int option : _enchantOptions)
{
writeD(option);
}
}
}

View File

@ -0,0 +1,50 @@
/*
* This file is part of the L2J Mobius project.
*
* 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.l2jmobius.gameserver.network.serverpackets;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.zone.ZoneId;
/**
* @author Luca Baldi
*/
public class EtcStatusUpdate extends L2GameServerPacket
{
private final L2PcInstance _activeChar;
private int _mask;
public EtcStatusUpdate(L2PcInstance activeChar)
{
_activeChar = activeChar;
_mask = _activeChar.getMessageRefusal() || _activeChar.isChatBanned() || _activeChar.isSilenceMode() ? 1 : 0;
_mask |= _activeChar.isInsideZone(ZoneId.DANGER_AREA) ? 2 : 0;
_mask |= _activeChar.hasCharmOfCourage() ? 4 : 0;
}
@Override
protected void writeImpl()
{
writeC(0xF9); // several icons to a separate line (0 = disabled)
writeC(_activeChar.getCharges()); // 1-7 increase force, lvl
writeD(_activeChar.getWeightPenalty()); // 1-4 weight penalty, lvl (1=50%, 2=66.6%, 3=80%, 4=100%)
writeC(_activeChar.getExpertiseWeaponPenalty()); // Weapon Grade Penalty [1-4]
writeC(_activeChar.getExpertiseArmorPenalty()); // Armor Grade Penalty [1-4]
writeC(0); // Death Penalty [1-15, 0 = disabled)], not used anymore in Ertheia
writeC(_activeChar.getChargedSouls());
writeC(_mask);
}
}

View File

@ -0,0 +1,45 @@
/*
* This file is part of the L2J Mobius project.
*
* 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.l2jmobius.gameserver.network.serverpackets;
/**
* @author mrTJO
*/
public class Ex2ndPasswordAck extends L2GameServerPacket
{
private final int _status;
private final int _response;
public static int SUCCESS = 0x00;
public static int WRONG_PATTERN = 0x01;
public Ex2ndPasswordAck(int status, int response)
{
_status = status;
_response = response;
}
@Override
protected void writeImpl()
{
writeC(0xFE);
writeH(0x107);
writeC(_status);
writeD(_response == WRONG_PATTERN ? 0x01 : 0x00);
writeD(0x00);
}
}

View File

@ -0,0 +1,44 @@
/*
* This file is part of the L2J Mobius project.
*
* 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.l2jmobius.gameserver.network.serverpackets;
/**
* @author mrTJO
*/
public class Ex2ndPasswordCheck extends L2GameServerPacket
{
public static final int PASSWORD_NEW = 0x00;
public static final int PASSWORD_PROMPT = 0x01;
public static final int PASSWORD_OK = 0x02;
private final int _windowType;
public Ex2ndPasswordCheck(int windowType)
{
_windowType = windowType;
}
@Override
protected void writeImpl()
{
writeC(0xFE);
writeH(0x105);
writeD(_windowType);
writeD(0x00);
}
}

View File

@ -0,0 +1,45 @@
/*
* This file is part of the L2J Mobius project.
*
* 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.l2jmobius.gameserver.network.serverpackets;
/**
* @author mrTJO
*/
public class Ex2ndPasswordVerify extends L2GameServerPacket
{
public static final int PASSWORD_OK = 0x00;
public static final int PASSWORD_WRONG = 0x01;
public static final int PASSWORD_BAN = 0x02;
private final int _wrongTentatives, _mode;
public Ex2ndPasswordVerify(int mode, int wrongTentatives)
{
_mode = mode;
_wrongTentatives = wrongTentatives;
}
@Override
protected void writeImpl()
{
writeC(0xFE);
// writeH(0x109); GOD
writeH(0x106);
writeD(_mode);
writeD(_wrongTentatives);
}
}

View File

@ -0,0 +1,105 @@
/*
* This file is part of the L2J Mobius project.
*
* 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.l2jmobius.gameserver.network.serverpackets;
import java.util.ArrayList;
import java.util.List;
import com.l2jmobius.gameserver.datatables.SkillData;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
import com.l2jmobius.gameserver.model.skills.Skill;
public class ExAbnormalStatusUpdateFromTarget extends L2GameServerPacket
{
private final L2Character _character;
private List<Effect> _effects = new ArrayList<>();
private static class Effect
{
protected int _skillId;
protected int _level;
protected int _maxlevel;
protected int _duration;
protected int _caster;
public Effect(BuffInfo info)
{
final Skill skill = info.getSkill();
final L2Character caster = info.getEffector();
int casterId = 0;
if (caster != null)
{
casterId = caster.getObjectId();
}
_skillId = skill.getDisplayId();
_level = skill.getDisplayLevel();
_maxlevel = SkillData.getInstance().getMaxLevel(_skillId);
_duration = info.getTime();
_caster = casterId;
}
}
public ExAbnormalStatusUpdateFromTarget(L2Character character)
{
_character = character;
_effects = new ArrayList<>();
for (BuffInfo info : character.getEffectList().getEffects())
{
if ((info != null) && info.isInUse())
{
final Skill skill = info.getSkill();
// TODO: Check on retail if all effects should be displayed
if (skill != null)
{
_effects.add(new Effect(info));
}
}
}
}
@Override
protected final void writeImpl()
{
writeC(0xFE);
writeH(0xE6);
writeD(_character.getObjectId());
writeH(_effects.size());
for (Effect info : _effects)
{
writeD(info._skillId);
if (info._level < 100)
{
writeH(info._level);
writeH(0x00);
}
else
{
writeH(info._maxlevel);
writeH(info._level);
}
writeH(0x00); // Combo abnormal ?
writeH(info._duration);
writeD(info._caster);
}
}
}

View File

@ -0,0 +1,59 @@
/*
* This file is part of the L2J Mobius project.
*
* 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.l2jmobius.gameserver.network.serverpackets;
import java.util.List;
import com.l2jmobius.gameserver.model.L2SkillLearn;
import com.l2jmobius.gameserver.model.base.AcquireSkillType;
/**
* @author UnAfraid
*/
public class ExAcquirableSkillListByClass extends L2GameServerPacket
{
final List<L2SkillLearn> _learnable;
final AcquireSkillType _type;
public ExAcquirableSkillListByClass(List<L2SkillLearn> learnable, AcquireSkillType type)
{
_learnable = learnable;
_type = type;
}
@Override
protected void writeImpl()
{
writeC(0xFE);
writeH(0xFA);
writeH(_type.getId());
writeH(_learnable.size());
for (L2SkillLearn skill : _learnable)
{
writeD(skill.getSkillId());
writeH(skill.getSkillLevel());
writeH(skill.getSkillLevel());
writeC(skill.getGetLevel());
writeQ(skill.getLevelUpSp());
writeC(skill.getRequiredItems().size());
if (_type == AcquireSkillType.SUBPLEDGE)
{
writeH(0x00);
}
}
}
}

View File

@ -0,0 +1,77 @@
/*
* This file is part of the L2J Mobius project.
*
* 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.l2jmobius.gameserver.network.serverpackets;
import java.util.ArrayList;
import java.util.List;
import com.l2jmobius.Config;
import com.l2jmobius.gameserver.data.xml.impl.AbilityPointsData;
import com.l2jmobius.gameserver.data.xml.impl.SkillTreesData;
import com.l2jmobius.gameserver.model.L2SkillLearn;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* @author Sdw
*/
public class ExAcquireAPSkillList extends L2GameServerPacket
{
private final int _abilityPoints, _usedAbilityPoints;
private final long _price;
private final boolean _enable;
private final List<Skill> _skills = new ArrayList<>();
public ExAcquireAPSkillList(L2PcInstance activeChar)
{
_abilityPoints = activeChar.getAbilityPoints();
_usedAbilityPoints = activeChar.getAbilityPointsUsed();
_price = AbilityPointsData.getInstance().getPrice(_abilityPoints);
for (L2SkillLearn sk : SkillTreesData.getInstance().getAbilitySkillTree().values())
{
final Skill knownSkill = activeChar.getKnownSkill(sk.getSkillId());
if (knownSkill != null)
{
if (knownSkill.getLevel() == sk.getSkillLevel())
{
_skills.add(knownSkill);
}
}
}
_enable = !activeChar.isSubClassActive() && (activeChar.getLevel() >= 99) && activeChar.isNoble();
}
@Override
protected void writeImpl()
{
writeC(0xFE);
writeH(0x15F);
writeD(_enable ? 1 : 0);
writeQ(Config.ABILITY_POINTS_RESET_ADENA);
writeQ(_price);
writeD(Config.ABILITY_MAX_POINTS);
writeD(_abilityPoints);
writeD(_usedAbilityPoints);
writeD(_skills.size());
for (Skill skill : _skills)
{
writeD(skill.getId());
writeD(skill.getLevel());
}
}
}

View File

@ -0,0 +1,82 @@
/*
* This file is part of the L2J Mobius project.
*
* 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.l2jmobius.gameserver.network.serverpackets;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
import com.l2jmobius.gameserver.model.L2SkillLearn;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.holders.ItemHolder;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* @author UnAfraid
*/
public class ExAcquireSkillInfo extends L2GameServerPacket
{
private final int _id;
private final int _level;
private final int _spCost;
private final int _minLevel;
private final List<ItemHolder> _itemReq;
private final List<Skill> _skillRem;
/**
* Special constructor for Alternate Skill Learning system.<br>
* Sets a custom amount of SP.
* @param player
* @param skillLearn the skill learn.
* @param sp the custom SP amount.
*/
public ExAcquireSkillInfo(L2PcInstance player, L2SkillLearn skillLearn, int sp)
{
_id = skillLearn.getSkillId();
_level = skillLearn.getSkillLevel();
_spCost = sp;
_minLevel = skillLearn.getGetLevel();
_itemReq = skillLearn.getRequiredItems();
_skillRem = skillLearn.getRemoveSkills().stream().map(player::getKnownSkill).filter(Objects::nonNull).collect(Collectors.toList());
}
@Override
protected final void writeImpl()
{
writeC(0xFE);
writeH(0xFC);
writeD(_id);
writeD(_level);
writeQ(_spCost);
writeH(_minLevel);
writeH(0x00); // Dual Class Level Required
writeD(_itemReq.size());
for (ItemHolder holder : _itemReq)
{
writeD(holder.getId());
writeQ(holder.getCount());
}
writeD(_skillRem.size());
for (Skill skill : _skillRem)
{
writeD(skill.getId());
writeD(skill.getLevel());
}
}
}

View File

@ -0,0 +1,42 @@
/*
* This file is part of the L2J Mobius project.
*
* 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.l2jmobius.gameserver.network.serverpackets;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
/**
* @author Sdw
*/
public class ExAdenaInvenCount extends L2GameServerPacket
{
private final L2PcInstance _activeChar;
public ExAdenaInvenCount(L2PcInstance cha)
{
_activeChar = cha;
}
@Override
protected final void writeImpl()
{
writeC(0xFE);
writeH(0x13E);
writeQ(_activeChar.getAdena());
writeH(_activeChar.getInventory().getSize());
}
}

View File

@ -0,0 +1,79 @@
/*
* This file is part of the L2J Mobius project.
*
* 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.l2jmobius.gameserver.network.serverpackets;
import com.l2jmobius.gameserver.model.actor.instance.L2AirShipInstance;
public class ExAirShipInfo extends L2GameServerPacket
{
// store some parameters, because they can be changed during broadcast
private final L2AirShipInstance _ship;
private final int _x, _y, _z, _heading, _moveSpeed, _rotationSpeed, _captain, _helm;
public ExAirShipInfo(L2AirShipInstance ship)
{
_ship = ship;
_x = ship.getX();
_y = ship.getY();
_z = ship.getZ();
_heading = ship.getHeading();
_moveSpeed = (int) ship.getStat().getMoveSpeed();
_rotationSpeed = (int) ship.getStat().getRotationSpeed();
_captain = ship.getCaptainId();
_helm = ship.getHelmObjectId();
}
@Override
protected void writeImpl()
{
writeC(0xFE);
writeH(0x61);
writeD(_ship.getObjectId());
writeD(_x);
writeD(_y);
writeD(_z);
writeD(_heading);
writeD(_captain);
writeD(_moveSpeed);
writeD(_rotationSpeed);
writeD(_helm);
if (_helm != 0)
{
// TODO: unhardcode these!
writeD(0x16e); // Controller X
writeD(0x00); // Controller Y
writeD(0x6b); // Controller Z
writeD(0x15c); // Captain X
writeD(0x00); // Captain Y
writeD(0x69); // Captain Z
}
else
{
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0x00);
}
writeD(_ship.getFuel());
writeD(_ship.getMaxFuel());
}
}

View File

@ -0,0 +1,47 @@
/*
* This file is part of the L2J Mobius project.
*
* 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.l2jmobius.gameserver.network.serverpackets;
import com.l2jmobius.gameserver.model.actor.instance.L2AirShipInstance;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
public class ExAirShipStopMove extends L2GameServerPacket
{
private final int _playerId, _airShipId, _x, _y, _z;
public ExAirShipStopMove(L2PcInstance player, L2AirShipInstance ship, int x, int y, int z)
{
_playerId = player.getObjectId();
_airShipId = ship.getObjectId();
_x = x;
_y = y;
_z = z;
}
@Override
protected void writeImpl()
{
writeC(0xfe);
writeH(0x66);
writeD(_airShipId);
writeD(_playerId);
writeD(_x);
writeD(_y);
writeD(_z);
}
}

View File

@ -0,0 +1,63 @@
/*
* This file is part of the L2J Mobius project.
*
* 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.l2jmobius.gameserver.network.serverpackets;
import com.l2jmobius.gameserver.model.VehiclePathPoint;
public class ExAirShipTeleportList extends L2GameServerPacket
{
private final int _dockId;
private final VehiclePathPoint[][] _teleports;
private final int[] _fuelConsumption;
public ExAirShipTeleportList(int dockId, VehiclePathPoint[][] teleports, int[] fuelConsumption)
{
_dockId = dockId;
_teleports = teleports;
_fuelConsumption = fuelConsumption;
}
@Override
protected void writeImpl()
{
writeC(0xFE);
writeH(0x9B);
writeD(_dockId);
if (_teleports != null)
{
writeD(_teleports.length);
VehiclePathPoint[] path;
VehiclePathPoint dst;
for (int i = 0; i < _teleports.length; i++)
{
writeD(i - 1);
writeD(_fuelConsumption[i]);
path = _teleports[i];
dst = path[path.length - 1];
writeD(dst.getX());
writeD(dst.getY());
writeD(dst.getZ());
}
}
else
{
writeD(0);
}
}
}

View File

@ -0,0 +1,41 @@
/*
* This file is part of the L2J Mobius project.
*
* 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.l2jmobius.gameserver.network.serverpackets;
/**
* @author JIV
*/
public class ExAskCoupleAction extends L2GameServerPacket
{
private final int _charObjId;
private final int _actionId;
public ExAskCoupleAction(int charObjId, int social)
{
_charObjId = charObjId;
_actionId = social;
}
@Override
protected void writeImpl()
{
writeC(0xFE);
writeH(0xBC);
writeD(_actionId);
writeD(_charObjId);
}
}

View File

@ -0,0 +1,43 @@
/*
* This file is part of the L2J Mobius project.
*
* 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.l2jmobius.gameserver.network.serverpackets;
/**
* Asks the player to join a CC
* @author chris_00
*/
public class ExAskJoinMPCC extends L2GameServerPacket
{
private final String _requestorName;
/**
* @param requestorName
*/
public ExAskJoinMPCC(String requestorName)
{
_requestorName = requestorName;
}
@Override
protected void writeImpl()
{
writeC(0xFE);
writeH(0x1a);
writeS(_requestorName); // name of CCLeader
writeD(0x00); // TODO: Find me
}
}

View File

@ -0,0 +1,44 @@
/*
* This file is part of the L2J Mobius project.
*
* 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.l2jmobius.gameserver.network.serverpackets;
import com.l2jmobius.gameserver.model.PartyMatchRoomList;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
/**
* @author KenM
*/
public class ExAskJoinPartyRoom extends L2GameServerPacket
{
private final String _charName;
private final String _roomName;
public ExAskJoinPartyRoom(L2PcInstance player)
{
_charName = player.getName();
_roomName = PartyMatchRoomList.getInstance().getPlayerRoom(player).getTitle();
}
@Override
protected void writeImpl()
{
writeC(0xFE);
writeH(0x35);
writeS(_charName);
writeS(_roomName);
}
}

View File

@ -0,0 +1,43 @@
/*
* This file is part of the L2J Mobius project.
*
* 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.l2jmobius.gameserver.network.serverpackets;
import com.l2jmobius.gameserver.enums.PartyDistributionType;
/**
* @author JIV
*/
public class ExAskModifyPartyLooting extends L2GameServerPacket
{
private final String _requestor;
private final PartyDistributionType _partyDistributionType;
public ExAskModifyPartyLooting(String name, PartyDistributionType partyDistributionType)
{
_requestor = name;
_partyDistributionType = partyDistributionType;
}
@Override
protected void writeImpl()
{
writeC(0xFE);
writeH(0xC0);
writeS(_requestor);
writeD(_partyDistributionType.getId());
}
}

View File

@ -0,0 +1,54 @@
/*
* This file is part of the L2J Mobius project.
*
* 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.l2jmobius.gameserver.network.serverpackets;
public class ExAttributeEnchantResult extends L2GameServerPacket
{
private final int _result;
private final int _isWeapon;
private final int _type;
private final int _before;
private final int _after;
private final int _successCount;
private final int _failedCount;
public ExAttributeEnchantResult(int result, boolean isWeapon, int type, int before, int after, int successCount, int failedCount)
{
_result = result;
_isWeapon = isWeapon ? 1 : 0;
_type = type;
_before = before;
_after = after;
_successCount = successCount;
_failedCount = failedCount;
}
@Override
protected final void writeImpl()
{
writeC(0xFE);
writeH(0x62);
writeD(_result);
writeC(_isWeapon);
writeH(_type);
writeH(_before);
writeH(_after);
writeH(_successCount);
writeH(_failedCount);
}
}

View File

@ -0,0 +1,40 @@
/*
* This file is part of the L2J Mobius project.
*
* 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.l2jmobius.gameserver.network.serverpackets;
import com.l2jmobius.gameserver.model.actor.L2Character;
/**
* @author Mobius
*/
public class ExAutoFishAvailable extends L2GameServerPacket
{
private final L2Character _activeChar;
public ExAutoFishAvailable(L2Character character)
{
_activeChar = character;
}
@Override
protected void writeImpl()
{
writeC(0xFE);
writeH(0x179);
writeD(_activeChar.getObjectId());
}
}

View File

@ -0,0 +1,49 @@
/*
* This file is part of the L2J Mobius project.
*
* 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.l2jmobius.gameserver.network.serverpackets;
/**
* @author Mobius
*/
public class ExAutoSoulShot extends L2GameServerPacket
{
private final int _itemId;
private final int _enabled;
private final int _type; // 0 SS, 1 SPS, 2 Beast SS, 3 Beast SPS
/**
* @param itemId
* @param enabled
* @param type
*/
public ExAutoSoulShot(int itemId, int enabled, int type)
{
_itemId = itemId;
_enabled = enabled;
_type = type;
}
@Override
protected final void writeImpl()
{
writeC(0xFE);
writeH(0x0C);
writeD(_itemId);
writeD(_enabled);
writeD(_type);
}
}

View File

@ -0,0 +1,42 @@
/*
* This file is part of the L2J Mobius project.
*
* 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.l2jmobius.gameserver.network.serverpackets;
/**
* @author JIV
*/
public class ExBaseAttributeCancelResult extends L2GameServerPacket
{
private final int _objId;
private final byte _attribute;
public ExBaseAttributeCancelResult(int objId, byte attribute)
{
_objId = objId;
_attribute = attribute;
}
@Override
protected void writeImpl()
{
writeC(0xFE);
writeH(0x76);
writeD(0x01); // result
writeD(_objId);
writeD(_attribute);
}
}

View File

@ -0,0 +1,166 @@
/*
* This file is part of the L2J Mobius project.
*
* 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.l2jmobius.gameserver.network.serverpackets;
/**
* @author KenM
*/
public final class ExBasicActionList extends L2GameServerPacket
{
//@formatter:off
public static final int[] ACTIONS_ON_TRANSFORM =
{
1, 3, 4, 5,
6, 7, 8, 9,
11, 15, 16, 17,
18, 19, 21, 22,
23, 32, 36, 39,
40, 41, 42, 43,
44, 45, 46, 47,
48, 50, 52, 53,
54, 55, 56, 57,
63, 64, 65, 70, 86,
1000, 1001, 1003, 1004,
1005, 1006, 1007, 1008,
1009, 1010, 1011, 1012,
1013, 1014, 1015, 1016,
1017, 1018, 1019, 1020,
1021, 1022, 1023, 1024,
1025, 1026, 1027, 1028,
1029, 1030, 1031, 1032,
1033, 1034, 1035, 1036,
1037, 1038, 1039, 1040,
1041, 1042, 1043, 1044,
1045, 1046, 1047, 1048,
1049, 1050, 1051, 1052,
1053, 1054, 1055, 1056,
1057, 1058, 1059, 1060,
1061, 1062, 1063, 1064,
1065, 1066, 1067, 1068,
1069, 1070, 1071, 1072,
1073, 1074, 1075, 1076,
1077, 1078, 1079, 1080,
1081, 1082, 1083, 1084,
1089, 1090, 1091, 1092,
1093, 1094, 1095, 1096,
1097, 1098, 1099, 1100,
1101, 1102, 1103, 1104,
1106, 1107, 1108, 1109,
1110, 1111, 1113, 1114,
1115, 1116, 1117, 1118,
1120, 1121, 1124, 1125,
1126, 1127, 1128, 1129,
1130, 1131, 1132, 1133,
1134, 1135, 1136, 1137,
1138, 1139, 1140, 1141,
1142, 1143, 1144, 1145,
1146, 1147, 1148, 1149,
1150, 1151, 1152, 1153,
1154, 1155
};
public static final int[] DEFAULT_ACTION_LIST =
{
0, 1, 2, 3, 4,
5, 6, 7, 8, 9,
10, 11, 12, 13,
14, 15, 16, 17,
18, 19, 20, 21,
22, 23, 24, 25,
26, 27, 28, 29,
30, 31, 32, 33,
34, 35, 36, 37,
38, 39, 40, 41,
42, 43, 44, 45,
46, 47, 48, 49,
50, 51, 52, 53,
54, 55, 56, 57,
58, 59, 60, 61,
62, 63, 64, 65,
66, 67, 68, 69,
70, 71, 72, 73,
74, 76, 77, 78,
79, 80, 81, 82,
83, 84, 85, 86,
87, 88, 89, 90,
1000, 1001, 1002, 1003,
1004, 1005, 1006, 1007,
1008, 1009, 1010, 1011,
1012, 1013, 1014, 1015,
1016, 1017, 1018, 1019,
1020, 1021, 1022, 1023,
1024, 1025, 1026, 1027,
1028, 1029, 1030, 1031,
1032, 1033, 1034, 1035,
1036, 1037, 1038, 1039,
1040, 1041, 1042, 1043,
1044, 1045, 1046, 1047,
1048, 1049, 1050, 1051,
1052, 1053, 1054, 1055,
1056, 1057, 1058, 1059,
1060, 1061, 1062, 1063,
1064, 1065, 1066, 1067,
1068, 1069, 1070, 1071,
1072, 1073, 1074, 1075,
1076, 1077, 1078, 1079,
1080, 1081, 1082, 1083,
1084, 1086, 1087, 1088,
1089, 1090, 1091, 1092,
1093, 1094, 1095, 1096,
1097, 1098, 1099, 1100,
1101, 1102, 1103, 1104,
1106, 1107, 1108, 1109,
1110, 1111, 1112, 1113,
1114, 1115, 1116, 1117,
1118, 1119, 1120, 1121,
1122, 1123, 1124, 1125,
1126, 1127, 1128, 1129,
1130, 1131, 1132, 1133,
1134, 1135, 1136, 1137,
1138, 1139, 1140, 1141,
1142, 1143, 1144, 1145,
1146, 1147, 1148, 1149,
1150, 1151, 1152, 1153,
1154, 1155, 5000, 5001,
5002, 5003, 5004, 5005,
5006, 5007, 5008, 5009,
5010, 5011, 5012, 5013,
5014, 5015
};
//@formatter:on
public static final ExBasicActionList STATIC_PACKET = new ExBasicActionList(DEFAULT_ACTION_LIST);
private final int[] _actionIds;
public ExBasicActionList(final int[] actionIds)
{
_actionIds = actionIds;
}
@Override
protected void writeImpl()
{
writeC(0xFE);
writeH(0x60);
writeD(_actionIds.length);
for (int _actionId : _actionIds)
{
writeD(_actionId);
}
}
}

View File

@ -0,0 +1,101 @@
/*
* This file is part of the L2J Mobius project.
*
* 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.l2jmobius.gameserver.network.serverpackets;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.l2jmobius.gameserver.data.xml.impl.BeautyShopData;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.beautyshop.BeautyData;
import com.l2jmobius.gameserver.model.beautyshop.BeautyItem;
/**
* @author Sdw
*/
public class ExBeautyItemList extends L2GameServerPacket
{
private int _colorCount;
private final BeautyData _beautyData;
private final Map<Integer, List<BeautyItem>> _colorData = new HashMap<>();
private static final int HAIR_TYPE = 0;
private static final int FACE_TYPE = 1;
private static final int COLOR_TYPE = 2;
public ExBeautyItemList(L2PcInstance activeChar)
{
_beautyData = BeautyShopData.getInstance().getBeautyData(activeChar.getRace(), activeChar.getAppearance().getSexType());
for (BeautyItem hair : _beautyData.getHairList().values())
{
final List<BeautyItem> colors = new ArrayList<>();
for (BeautyItem color : hair.getColors().values())
{
colors.add(color);
_colorCount++;
}
_colorData.put(hair.getId(), colors);
}
}
@Override
protected void writeImpl()
{
writeC(0xFE);
writeH(0x177);
writeD(HAIR_TYPE);
writeD(_beautyData.getHairList().size());
for (BeautyItem hair : _beautyData.getHairList().values())
{
writeD(0); // ?
writeD(hair.getId());
writeD(hair.getAdena());
writeD(hair.getResetAdena());
writeD(hair.getBeautyShopTicket());
writeD(99999999); // Limit
}
writeD(FACE_TYPE);
writeD(_beautyData.getFaceList().size());
for (BeautyItem face : _beautyData.getFaceList().values())
{
writeD(0); // ?
writeD(face.getId());
writeD(face.getAdena());
writeD(face.getResetAdena());
writeD(face.getBeautyShopTicket());
writeD(99999999); // Limit
}
writeD(COLOR_TYPE);
writeD(_colorCount);
for (int hairId : _colorData.keySet())
{
for (BeautyItem color : _colorData.get(hairId))
{
writeD(hairId);
writeD(color.getId());
writeD(color.getAdena());
writeD(color.getResetAdena());
writeD(color.getBeautyShopTicket());
writeD(99999999);
}
}
}
}

View File

@ -0,0 +1,41 @@
/*
* This file is part of the L2J Mobius project.
*
* 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.l2jmobius.gameserver.network.serverpackets;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
/**
* @author Gnat
**/
public class ExBirthdayPopup extends L2GameServerPacket
{
private final L2PcInstance _activeChar;
public ExBirthdayPopup(L2PcInstance character)
{
_activeChar = character;
}
@Override
protected void writeImpl()
{
writeC(0xFE);
writeH(0x90);
writeD(_activeChar.getObjectId());
}
}

View File

@ -0,0 +1,76 @@
/*
* This file is part of the L2J Mobius project.
*
* 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.l2jmobius.gameserver.network.serverpackets;
/**
* Special event info packet.
* @author Kerberos
* @author mrTJO
*/
public class ExBrBroadcastEventState extends L2GameServerPacket
{
private final int _eventId;
private final int _eventState;
private int _param0;
private int _param1;
private int _param2;
private int _param3;
private int _param4;
private String _param5;
private String _param6;
public static final int APRIL_FOOLS = 20090401;
public static final int EVAS_INFERNO = 20090801; // event state (0 - hide, 1 - show), day (1-14), percent (0-100)
public static final int HALLOWEEN_EVENT = 20091031; // event state (0 - hide, 1 - show)
public static final int RAISING_RUDOLPH = 20091225; // event state (0 - hide, 1 - show)
public static final int LOVERS_JUBILEE = 20100214; // event state (0 - hide, 1 - show)
public ExBrBroadcastEventState(int eventId, int eventState)
{
_eventId = eventId;
_eventState = eventState;
}
public ExBrBroadcastEventState(int eventId, int eventState, int param0, int param1, int param2, int param3, int param4, String param5, String param6)
{
_eventId = eventId;
_eventState = eventState;
_param0 = param0;
_param1 = param1;
_param2 = param2;
_param3 = param3;
_param4 = param4;
_param5 = param5;
_param6 = param6;
}
@Override
protected final void writeImpl()
{
writeC(0xFE);
writeH(0xBD);
writeD(_eventId);
writeD(_eventState);
writeD(_param0);
writeD(_param1);
writeD(_param2);
writeD(_param3);
writeD(_param4);
writeS(_param5);
writeS(_param6);
}
}

View File

@ -0,0 +1,51 @@
/*
* This file is part of the L2J Mobius project.
*
* 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.l2jmobius.gameserver.network.serverpackets;
/**
* Eva's Inferno event packet. info params: <br>
* type (1 - %, 2 - npcId), <br>
* value (depending on type: for type 1 - % value; for type 2 - 20573-20575), <br>
* state (0-1), endtime (only when type 2)
*/
public class ExBrBuffEventState extends L2GameServerPacket
{
private final int _type; // 1 - %, 2 - npcId
private final int _value; // depending on type: for type 1 - % value; for type 2 - 20573-20575
private final int _state; // 0-1
private final int _endtime; // only when type 2 as unix time in seconds from 1970
public ExBrBuffEventState(int type, int value, int state, int endtime)
{
_type = type;
_value = value;
_state = state;
_endtime = endtime;
}
@Override
protected void writeImpl()
{
writeC(0xFE);
writeH(0xDC);
writeD(_type);
writeD(_value);
writeD(_state);
writeD(_endtime);
}
}

View File

@ -0,0 +1,50 @@
/*
* This file is part of the L2J Mobius project.
*
* 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.l2jmobius.gameserver.network.serverpackets;
/**
* Halloween rank list server packet.
*/
public class ExBrLoadEventTopRankers extends L2GameServerPacket
{
private final int _eventId;
private final int _day;
private final int _count;
private final int _bestScore;
private final int _myScore;
public ExBrLoadEventTopRankers(int eventId, int day, int count, int bestScore, int myScore)
{
_eventId = eventId;
_day = day;
_count = count;
_bestScore = bestScore;
_myScore = myScore;
}
@Override
protected final void writeImpl()
{
writeC(0xFE);
writeH(0xBE);
writeD(_eventId);
writeD(_day);
writeD(_count);
writeD(_bestScore);
writeD(_myScore);
}
}

View File

@ -0,0 +1,41 @@
/*
* This file is part of the L2J Mobius project.
*
* 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.l2jmobius.gameserver.network.serverpackets;
/**
* @author GodKratos
*/
public class ExBrPremiumState extends L2GameServerPacket
{
private final int _objId;
private final int _state;
public ExBrPremiumState(int id, int state)
{
_objId = id;
_state = state;
}
@Override
protected void writeImpl()
{
writeC(0xFE);
writeH(0xDA);
writeD(_objId);
writeC(_state);
}
}

View File

@ -0,0 +1,100 @@
/*
* This file is part of the L2J Mobius project.
*
* 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.l2jmobius.gameserver.network.serverpackets;
import java.util.ArrayList;
import java.util.List;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
/**
* @author ShanSoft
*/
public class ExBuySellList extends AbstractItemPacket
{
private final List<L2ItemInstance> _items = new ArrayList<>();
private final List<L2ItemInstance> _sellList = new ArrayList<>();
private L2ItemInstance[] _refundList = null;
private final boolean _done;
public ExBuySellList(L2PcInstance player, boolean done)
{
for (L2ItemInstance item : player.getInventory().getItems())
{
if (!item.isQuestItem())
{
_items.add(item);
}
}
for (L2ItemInstance item : player.getInventory().getAvailableItems(false, false, false))
{
if (item.isSellable())
{
_sellList.add(item);
}
}
if (player.hasRefund())
{
_refundList = player.getRefund().getItems();
}
_done = done;
}
@Override
protected final void writeImpl()
{
writeC(0xFE);
writeH(0xB8);
writeD(0x01);
writeD(_items.size());
if (_sellList.size() > 0)
{
writeH(_sellList.size());
for (L2ItemInstance item : _sellList)
{
writeItem(item);
writeQ(item.getItem().getReferencePrice() / 2);
}
}
else
{
writeH(0x00);
}
if ((_refundList != null) && (_refundList.length > 0))
{
writeH(_refundList.length);
int i = 0;
for (L2ItemInstance item : _refundList)
{
writeItem(item);
writeD(i++);
writeQ((item.getItem().getReferencePrice() / 2) * item.getCount());
}
}
else
{
writeH(0x00);
}
writeC(_done ? 0x01 : 0x00);
}
}

View File

@ -0,0 +1,50 @@
/*
* This file is part of the L2J Mobius project.
*
* 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.l2jmobius.gameserver.network.serverpackets;
/**
* @author KenM
*/
public class ExCaptureOrc extends L2GameServerPacket
{
private static final byte[] _test;
static
{
// TODO: Verify the data
//@formatter:off
_test = new byte[]
{
(byte) 0xE4 ,(byte) 0xAB ,(byte) 0x8E ,(byte) 0xC5 ,(byte) 0xE9 ,(byte) 0xF9 ,(byte) 0x86 ,(byte) 0x7B,
(byte) 0x9E ,(byte) 0x5D ,(byte) 0x83 ,(byte) 0x14 ,(byte) 0x05 ,(byte) 0xD4 ,(byte) 0x48 ,(byte) 0x01,
(byte) 0xCD ,(byte) 0xA2 ,(byte) 0x8D ,(byte) 0x90 ,(byte) 0x62 ,(byte) 0x8C ,(byte) 0xDA ,(byte) 0x32,
(byte) 0x7B ,(byte) 0x1B ,(byte) 0x87 ,(byte) 0x6D ,(byte) 0x08 ,(byte) 0xC4 ,(byte) 0xE1 ,(byte) 0x56,
(byte) 0x9B ,(byte) 0x3B ,(byte) 0xC3 ,(byte) 0x40 ,(byte) 0xDF ,(byte) 0xE8 ,(byte) 0xD7 ,(byte) 0xE1,
(byte) 0x98 ,(byte) 0x38 ,(byte) 0x1C ,(byte) 0xA5 ,(byte) 0x8E ,(byte) 0x45 ,(byte) 0x3F ,(byte) 0xF2,
(byte) 0x5E ,(byte) 0x1C ,(byte) 0x59 ,(byte) 0x8E ,(byte) 0x74 ,(byte) 0x01 ,(byte) 0x9E ,(byte) 0xC2,
(byte) 0x00 ,(byte) 0x95 ,(byte) 0xB0 ,(byte) 0x1D ,(byte) 0x87 ,(byte) 0xED ,(byte) 0x9C ,(byte) 0x8A
};
//@formatter:on
}
@Override
protected void writeImpl()
{
writeC(0xFE);
writeH(0x45);
writeB(_test);
}
}

View File

@ -0,0 +1,44 @@
/*
* This file is part of the L2J Mobius project.
*
* 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.l2jmobius.gameserver.network.serverpackets;
import com.l2jmobius.gameserver.enums.CastleSide;
import com.l2jmobius.gameserver.model.entity.Castle;
/**
* @author UnAfraid
*/
public class ExCastleState extends L2GameServerPacket
{
private final int _castleId;
private final CastleSide _castleSide;
public ExCastleState(Castle castle)
{
_castleId = castle.getResidenceId();
_castleSide = castle.getSide();
}
@Override
protected void writeImpl()
{
writeC(0xFE);
writeH(0x12D);
writeD(_castleId);
writeD(_castleSide.ordinal());
}
}

View File

@ -0,0 +1,30 @@
/*
* 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.l2jmobius.gameserver.network.serverpackets;
/**
* @author Erlandys
*/
public class ExChangeAttributeFail extends L2GameServerPacket
{
public static final ExChangeAttributeFail STATIC_PACKET = new ExChangeAttributeFail();
@Override
protected void writeImpl()
{
writeC(0xFE);
writeH(0x116);
}
}

View File

@ -0,0 +1,71 @@
/*
* 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.l2jmobius.gameserver.network.serverpackets;
/**
* @author Erlandys
*/
public class ExChangeAttributeInfo extends L2GameServerPacket
{
private final int attributeOID;
private final int attributes;
public ExChangeAttributeInfo(int _attributeOID, int _attribute)
{
attributeOID = _attributeOID;
switch (_attribute)
{
case 0:
{
attributes = -2;
break;
}
case 1:
{
attributes = -3;
break;
}
case 2:
{
attributes = -5;
break;
}
case 3:
{
attributes = -9;
break;
}
case 4:
{
attributes = -17;
break;
}
default:
{
attributes = -33;
break;
}
}
}
@Override
protected void writeImpl()
{
writeC(0xFE);
writeH(0x114);
writeD(attributeOID);
writeD(attributes);
}
}

View File

@ -0,0 +1,60 @@
/*
* This file is part of the L2J Mobius project.
*
* 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.l2jmobius.gameserver.network.serverpackets;
import java.util.ArrayList;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
/**
* @author Erlandys TODO: Fix this class to Infinity Odyssey !!!
*/
public class ExChangeAttributeItemList extends AbstractItemPacket
{
private final ArrayList<L2ItemInstance> _itemsList;
private final int _itemOID;
public ExChangeAttributeItemList(L2PcInstance player, int itemOID)
{
_itemsList = new ArrayList<>();
for (L2ItemInstance item : player.getInventory().getItems())
{
if (item.isWeapon())
{
if (item.getAttackElementPower() > 0)
{
_itemsList.add(item);
}
}
}
_itemOID = itemOID;
}
@Override
protected void writeImpl()
{
writeC(0xFE);
writeH(0x113);
writeD(_itemOID);
writeD(_itemsList.size());
for (L2ItemInstance item : _itemsList)
{
writeItem(item);
}
}
}

View File

@ -0,0 +1,30 @@
/*
* 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.l2jmobius.gameserver.network.serverpackets;
/**
* @author Erlandys
*/
public class ExChangeAttributeOk extends L2GameServerPacket
{
public static final ExChangeAttributeOk STATIC_PACKET = new ExChangeAttributeOk();
@Override
protected void writeImpl()
{
writeC(0xFE);
writeH(0x115);
}
}

View File

@ -0,0 +1,55 @@
/*
* This file is part of the L2J Mobius project.
*
* 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.l2jmobius.gameserver.network.serverpackets;
/**
* @author UnAfraid
*/
public class ExChangeClientEffectInfo extends L2GameServerPacket
{
public static final ExChangeClientEffectInfo STATIC_FREYA_DEFAULT = new ExChangeClientEffectInfo(0, 0, 1);
public static final ExChangeClientEffectInfo STATIC_FREYA_DESTROYED = new ExChangeClientEffectInfo(0, 0, 2);
private final int _type, _key, _value;
/**
* @param type
* <ul>
* <li>0 - ChangeZoneState</li>
* <li>1 - SetL2Fog</li>
* <li>2 - postEffectData</li>
* </ul>
* @param key
* @param value
*/
public ExChangeClientEffectInfo(int type, int key, int value)
{
_type = type;
_key = key;
_value = value;
}
@Override
protected void writeImpl()
{
writeC(0xFE);
writeH(0xC3);
writeD(_type);
writeD(_key);
writeD(_value);
}
}

View File

@ -0,0 +1,41 @@
/*
* This file is part of the L2J Mobius project.
*
* 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.l2jmobius.gameserver.network.serverpackets;
/**
* @author JIV
*/
public class ExChangeNpcState extends L2GameServerPacket
{
private final int _objId;
private final int _state;
public ExChangeNpcState(int objId, int state)
{
_objId = objId;
_state = state;
}
@Override
protected void writeImpl()
{
writeC(0xFE);
writeH(0xBF);
writeD(_objId);
writeD(_state);
}
}

View File

@ -0,0 +1,58 @@
/*
* This file is part of the L2J Mobius project.
*
* 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.l2jmobius.gameserver.network.serverpackets;
/**
* @author Migi
*/
public class ExChangePostState extends L2GameServerPacket
{
private final boolean _receivedBoard;
private final int[] _changedMsgIds;
private final int _changeId;
public ExChangePostState(boolean receivedBoard, int[] changedMsgIds, int changeId)
{
_receivedBoard = receivedBoard;
_changedMsgIds = changedMsgIds;
_changeId = changeId;
}
public ExChangePostState(boolean receivedBoard, int changedMsgId, int changeId)
{
_receivedBoard = receivedBoard;
_changedMsgIds = new int[]
{
changedMsgId
};
_changeId = changeId;
}
@Override
protected void writeImpl()
{
writeC(0xFE);
writeH(0xB4);
writeD(_receivedBoard ? 1 : 0);
writeD(_changedMsgIds.length);
for (int postId : _changedMsgIds)
{
writeD(postId); // postId
writeD(_changeId); // state
}
}
}

View File

@ -0,0 +1,39 @@
/*
* This file is part of the L2J Mobius project.
*
* 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.l2jmobius.gameserver.network.serverpackets;
/**
* @author Sdw
*/
public class ExChangeToAwakenedClass extends L2GameServerPacket
{
private final int _classId;
public ExChangeToAwakenedClass(int classId)
{
_classId = classId;
}
@Override
protected void writeImpl()
{
writeC(0xFE);
writeH(0xFF);
writeD(_classId);
}
}

View File

@ -0,0 +1,75 @@
/*
* This file is part of the L2J Mobius project.
*
* 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.l2jmobius.gameserver.network.serverpackets;
import java.util.HashSet;
import java.util.Set;
import com.l2jmobius.gameserver.model.Elementals;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
/**
* @author Kerberos
*/
public class ExChooseInventoryAttributeItem extends L2GameServerPacket
{
private final int _itemId;
private final long _count;
private final byte _atribute;
private final int _level;
private final Set<Integer> _items = new HashSet<>();
public ExChooseInventoryAttributeItem(L2PcInstance activeChar, L2ItemInstance stone)
{
_itemId = stone.getDisplayId();
_count = stone.getCount();
_atribute = Elementals.getItemElement(_itemId);
if (_atribute == Elementals.NONE)
{
throw new IllegalArgumentException("Undefined Atribute item: " + stone);
}
_level = Elementals.getMaxElementLevel(_itemId);
// Register only items that can be put an attribute stone/crystal
for (L2ItemInstance item : activeChar.getInventory().getItems())
{
if (item.isElementable())
{
_items.add(item.getObjectId());
}
}
}
@Override
protected void writeImpl()
{
writeC(0xFE);
writeH(0x63);
writeD(_itemId);
writeQ(_count);
writeD(_atribute == Elementals.FIRE ? 1 : 0); // Fire
writeD(_atribute == Elementals.WATER ? 1 : 0); // Water
writeD(_atribute == Elementals.WIND ? 1 : 0); // Wind
writeD(_atribute == Elementals.EARTH ? 1 : 0); // Earth
writeD(_atribute == Elementals.HOLY ? 1 : 0); // Holy
writeD(_atribute == Elementals.DARK ? 1 : 0); // Unholy
writeD(_level); // Item max attribute level
writeD(_items.size());
_items.forEach(this::writeD);
}
}

View File

@ -0,0 +1,36 @@
/*
* This file is part of the L2J Mobius project.
*
* 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.l2jmobius.gameserver.network.serverpackets;
/**
* @author UnAfraid
*/
public class ExCloseAPListWnd extends L2GameServerPacket
{
public static ExCloseAPListWnd STATIC_PACKET = new ExCloseAPListWnd();
private ExCloseAPListWnd()
{
}
@Override
protected void writeImpl()
{
writeC(0xFE);
writeH(0x167);
}
}

View File

@ -0,0 +1,35 @@
/*
* This file is part of the L2J Mobius project.
*
* 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.l2jmobius.gameserver.network.serverpackets;
/**
* Close the CommandChannel Information window
* @author chris_00
*/
public class ExCloseMPCC extends L2GameServerPacket
{
public ExCloseMPCC()
{
}
@Override
protected void writeImpl()
{
writeC(0xfe);
writeH(0x13);
}
}

View File

@ -0,0 +1,34 @@
/*
* This file is part of the L2J Mobius project.
*
* 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.l2jmobius.gameserver.network.serverpackets;
/**
* @author Gnacik
*/
public class ExClosePartyRoom extends L2GameServerPacket
{
public ExClosePartyRoom()
{
}
@Override
protected void writeImpl()
{
writeC(0xfe);
writeH(0x09);
}
}

View File

@ -0,0 +1,41 @@
/*
* This file is part of the L2J Mobius project.
*
* 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.l2jmobius.gameserver.network.serverpackets;
/**
* @author mrTJO & UnAfraid
*/
public class ExConfirmAddingContact extends L2GameServerPacket
{
private final String _charName;
private final boolean _added;
public ExConfirmAddingContact(String charName, boolean added)
{
_charName = charName;
_added = added;
}
@Override
protected void writeImpl()
{
writeC(0xFE);
writeH(0xD3);
writeS(_charName);
writeD(_added ? 0x01 : 0x00);
}
}

View File

@ -0,0 +1,53 @@
/*
* This file is part of the L2J Mobius project.
*
* 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.l2jmobius.gameserver.network.serverpackets;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
/**
* @author mrTJO
*/
public class ExCubeGameAddPlayer extends L2GameServerPacket
{
L2PcInstance _player;
boolean _isRedTeam;
/**
* Add Player To Minigame Waiting List
* @param player Player Instance
* @param isRedTeam Is Player from Red Team?
*/
public ExCubeGameAddPlayer(L2PcInstance player, boolean isRedTeam)
{
_player = player;
_isRedTeam = isRedTeam;
}
@Override
protected void writeImpl()
{
writeC(0xFE);
writeH(0x98);
writeD(0x01);
writeD(0xffffffff);
writeD(_isRedTeam ? 0x01 : 0x00);
writeD(_player.getObjectId());
writeS(_player.getName());
}
}

View File

@ -0,0 +1,52 @@
/*
* This file is part of the L2J Mobius project.
*
* 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.l2jmobius.gameserver.network.serverpackets;
/**
* @author mrTJO
*/
public class ExCubeGameChangePoints extends L2GameServerPacket
{
int _timeLeft;
int _bluePoints;
int _redPoints;
/**
* Change Client Point Counter
* @param timeLeft Time Left before Minigame's End
* @param bluePoints Current Blue Team Points
* @param redPoints Current Red Team Points
*/
public ExCubeGameChangePoints(int timeLeft, int bluePoints, int redPoints)
{
_timeLeft = timeLeft;
_bluePoints = bluePoints;
_redPoints = redPoints;
}
@Override
protected void writeImpl()
{
writeC(0xFE);
writeH(0x99);
writeD(0x02);
writeD(_timeLeft);
writeD(_bluePoints);
writeD(_redPoints);
}
}

View File

@ -0,0 +1,51 @@
/*
* This file is part of the L2J Mobius project.
*
* 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.l2jmobius.gameserver.network.serverpackets;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
/**
* @author mrTJO
*/
public class ExCubeGameChangeTeam extends L2GameServerPacket
{
L2PcInstance _player;
boolean _fromRedTeam;
/**
* Move Player from Team x to Team y
* @param player Player Instance
* @param fromRedTeam Is Player from Red Team?
*/
public ExCubeGameChangeTeam(L2PcInstance player, boolean fromRedTeam)
{
_player = player;
_fromRedTeam = fromRedTeam;
}
@Override
protected void writeImpl()
{
writeC(0xFE);
writeH(0x98);
writeD(0x05);
writeD(_player.getObjectId());
writeD(_fromRedTeam ? 0x01 : 0x00);
writeD(_fromRedTeam ? 0x00 : 0x01);
}
}

View File

@ -0,0 +1,44 @@
/*
* This file is part of the L2J Mobius project.
*
* 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.l2jmobius.gameserver.network.serverpackets;
/**
* @author mrTJO
*/
public class ExCubeGameChangeTimeToStart extends L2GameServerPacket
{
int _seconds;
/**
* Update Minigame Waiting List Time to Start
* @param seconds
*/
public ExCubeGameChangeTimeToStart(int seconds)
{
_seconds = seconds;
}
@Override
protected void writeImpl()
{
writeC(0xFE);
writeH(0x98);
writeD(0x03);
writeD(_seconds);
}
}

View File

@ -0,0 +1,38 @@
/*
* This file is part of the L2J Mobius project.
*
* 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.l2jmobius.gameserver.network.serverpackets;
/**
* @author mrTJO
*/
public class ExCubeGameCloseUI extends L2GameServerPacket
{
/**
* Close Minigame Waiting List
*/
public ExCubeGameCloseUI()
{
}
@Override
protected void writeImpl()
{
writeC(0xFE);
writeH(0x98);
writeD(0xffffffff);
}
}

View File

@ -0,0 +1,46 @@
/*
* This file is part of the L2J Mobius project.
*
* 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.l2jmobius.gameserver.network.serverpackets;
/**
* *
* @author mrTJO
*/
public class ExCubeGameEnd extends L2GameServerPacket
{
boolean _isRedTeamWin;
/**
* Show Minigame Results
* @param isRedTeamWin Is Red Team Winner?
*/
public ExCubeGameEnd(boolean isRedTeamWin)
{
_isRedTeamWin = isRedTeamWin;
}
@Override
protected void writeImpl()
{
writeC(0xFE);
writeH(0x99);
writeD(0x01);
writeD(_isRedTeamWin ? 0x01 : 0x00);
writeD(0x00); // TODO: Find me!
}
}

View File

@ -0,0 +1,67 @@
/*
* This file is part of the L2J Mobius project.
*
* 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.l2jmobius.gameserver.network.serverpackets;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
/**
* @author mrTJO
*/
public class ExCubeGameExtendedChangePoints extends L2GameServerPacket
{
int _timeLeft;
int _bluePoints;
int _redPoints;
boolean _isRedTeam;
L2PcInstance _player;
int _playerPoints;
/**
* Update a Secret Point Counter (used by client when receive ExCubeGameEnd)
* @param timeLeft Time Left before Minigame's End
* @param bluePoints Current Blue Team Points
* @param redPoints Current Blue Team points
* @param isRedTeam Is Player from Red Team?
* @param player Player Instance
* @param playerPoints Current Player Points
*/
public ExCubeGameExtendedChangePoints(int timeLeft, int bluePoints, int redPoints, boolean isRedTeam, L2PcInstance player, int playerPoints)
{
_timeLeft = timeLeft;
_bluePoints = bluePoints;
_redPoints = redPoints;
_isRedTeam = isRedTeam;
_player = player;
_playerPoints = playerPoints;
}
@Override
protected void writeImpl()
{
writeC(0xFE);
writeH(0x99);
writeD(0x00);
writeD(_timeLeft);
writeD(_bluePoints);
writeD(_redPoints);
writeD(_isRedTeam ? 0x01 : 0x00);
writeD(_player.getObjectId());
writeD(_playerPoints);
}
}

View File

@ -0,0 +1,52 @@
/*
* This file is part of the L2J Mobius project.
*
* 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.l2jmobius.gameserver.network.serverpackets;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
/**
* @author mrTJO
*/
public class ExCubeGameRemovePlayer extends L2GameServerPacket
{
L2PcInstance _player;
boolean _isRedTeam;
/**
* Remove Player from Minigame Waiting List
* @param player Player to Remove
* @param isRedTeam Is Player from Red Team?
*/
public ExCubeGameRemovePlayer(L2PcInstance player, boolean isRedTeam)
{
_player = player;
_isRedTeam = isRedTeam;
}
@Override
protected void writeImpl()
{
writeC(0xFE);
writeH(0x98);
writeD(0x02);
writeD(0xffffffff);
writeD(_isRedTeam ? 0x01 : 0x00);
writeD(_player.getObjectId());
}
}

View File

@ -0,0 +1,39 @@
/*
* This file is part of the L2J Mobius project.
*
* 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.l2jmobius.gameserver.network.serverpackets;
/**
* Format: (chd)
* @author mrTJO
*/
public class ExCubeGameRequestReady extends L2GameServerPacket
{
/**
* Show Confirm Dialog for 10 seconds
*/
public ExCubeGameRequestReady()
{
}
@Override
protected void writeImpl()
{
writeC(0xFE);
writeH(0x98);
writeD(0x04);
}
}

View File

@ -0,0 +1,71 @@
/*
* This file is part of the L2J Mobius project.
*
* 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.l2jmobius.gameserver.network.serverpackets;
import java.util.List;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
/**
* @author mrTJO
*/
public class ExCubeGameTeamList extends L2GameServerPacket
{
// Players Lists
List<L2PcInstance> _bluePlayers;
List<L2PcInstance> _redPlayers;
// Common Values
int _roomNumber;
/**
* Show Minigame Waiting List to Player
* @param redPlayers Red Players List
* @param bluePlayers Blue Players List
* @param roomNumber Arena/Room ID
*/
public ExCubeGameTeamList(List<L2PcInstance> redPlayers, List<L2PcInstance> bluePlayers, int roomNumber)
{
_redPlayers = redPlayers;
_bluePlayers = bluePlayers;
_roomNumber = roomNumber - 1;
}
@Override
protected void writeImpl()
{
writeC(0xFE);
writeH(0x98);
writeD(0x00);
writeD(_roomNumber);
writeD(0xffffffff);
writeD(_bluePlayers.size());
for (L2PcInstance player : _bluePlayers)
{
writeD(player.getObjectId());
writeS(player.getName());
}
writeD(_redPlayers.size());
for (L2PcInstance player : _redPlayers)
{
writeD(player.getObjectId());
writeS(player.getName());
}
}
}

Some files were not shown because too many files have changed in this diff Show More