Sync with L2jOrg and various adjustments.

This commit is contained in:
MobiusDevelopment
2019-10-10 09:57:48 +00:00
parent 0b9d2b8173
commit 8e6f33bc41
349 changed files with 31442 additions and 25115 deletions

View File

@@ -194,7 +194,7 @@ public class SkillTreesData implements IXmlReader
if (attr != null)
{
cId = Integer.parseInt(attr.getNodeValue());
classId = ClassId.values()[cId];
classId = ClassId.getClassId(cId);
}
else
{
@@ -219,7 +219,7 @@ public class SkillTreesData implements IXmlReader
parentClassId = Integer.parseInt(attr.getNodeValue());
if ((cId > -1) && (cId != parentClassId) && (parentClassId > -1) && !_parentClassMap.containsKey(classId))
{
_parentClassMap.put(classId, ClassId.values()[parentClassId]);
_parentClassMap.put(classId, ClassId.getClassId(parentClassId));
}
}

View File

@@ -25,5 +25,6 @@ public enum HtmlActionScope
NPC_ITEM_HTML,
NPC_QUEST_HTML,
TUTORIAL_HTML,
COMM_BOARD_HTML
COMM_BOARD_HTML,
PREMIUM_HTML
}

View File

@@ -252,6 +252,17 @@ public class WorldRegion
public void setSurroundingRegions(WorldRegion[] regions)
{
_surroundingRegions = regions;
// Make sure that this region is always the first region to improve bulk operations when this region should be updated first.
for (int i = 0; i < _surroundingRegions.length; i++)
{
if (_surroundingRegions[i] == this)
{
final WorldRegion first = _surroundingRegions[0];
_surroundingRegions[0] = this;
_surroundingRegions[i] = first;
}
}
}
public WorldRegion[] getSurroundingRegions()

View File

@@ -277,6 +277,7 @@ import org.l2jmobius.gameserver.network.serverpackets.EtcStatusUpdate;
import org.l2jmobius.gameserver.network.serverpackets.ExAbnormalStatusUpdateFromTarget;
import org.l2jmobius.gameserver.network.serverpackets.ExAdenaInvenCount;
import org.l2jmobius.gameserver.network.serverpackets.ExAlterSkillRequest;
import org.l2jmobius.gameserver.network.serverpackets.ExAutoPlayDoMacro;
import org.l2jmobius.gameserver.network.serverpackets.ExAutoSoulShot;
import org.l2jmobius.gameserver.network.serverpackets.ExBrPremiumState;
import org.l2jmobius.gameserver.network.serverpackets.ExDuelUpdateUserInfo;
@@ -857,6 +858,8 @@ public class PlayerInstance extends Playable
private final Set<Integer> _whisperers = ConcurrentHashMap.newKeySet();
private ScheduledFuture<?> _autoPlayTask = null;
// Selling buffs system
private boolean _isSellingBuffs = false;
private List<SellBuffHolder> _sellingBuffs = null;
@@ -1251,7 +1254,7 @@ public class PlayerInstance extends Playable
public void setBaseClass(ClassId classId)
{
_baseClass = classId.ordinal();
_baseClass = classId.getId();
}
public boolean isInStoreMode()
@@ -14052,4 +14055,61 @@ public class PlayerInstance extends Playable
getVariables().set(ATTENDANCE_INDEX_VAR, rewardIndex);
}
}
public void stopAutoPlayTask()
{
if ((_autoPlayTask != null) && !_autoPlayTask.isCancelled() && !_autoPlayTask.isDone())
{
_autoPlayTask.cancel(true);
}
_autoPlayTask = null;
}
public void startAutoPlayTask(boolean longRange, boolean respectfulHunting)
{
if (_autoPlayTask != null)
{
return;
}
_autoPlayTask = ThreadPool.scheduleAtFixedRate(() ->
{
if ((getTarget() != null) && getTarget().isMonster() && (((MonsterInstance) getTarget()).getTarget() == this) && !((MonsterInstance) getTarget()).isAlikeDead())
{
sendPacket(ExAutoPlayDoMacro.STATIC_PACKET);
return;
}
MonsterInstance monster = null;
double closestDistance = Double.MAX_VALUE;
for (MonsterInstance nearby : World.getInstance().getVisibleObjectsInRange(this, MonsterInstance.class, longRange ? 600 : 1400))
{
if ((nearby == null) || nearby.isAlikeDead())
{
continue;
}
if (respectfulHunting && (nearby.getTarget() != null) && (nearby.getTarget() != this))
{
continue;
}
if (nearby.isAutoAttackable(this) //
&& GeoEngine.getInstance().canSeeTarget(this, nearby)//
&& GeoEngine.getInstance().canMoveToTarget(getX(), getY(), getZ(), nearby.getX(), nearby.getY(), nearby.getZ(), getInstanceWorld()))
{
final double monsterDistance = calculateDistance2D(nearby);
if (monsterDistance < closestDistance)
{
monster = nearby;
closestDistance = monsterDistance;
}
}
}
if (monster != null)
{
setTarget(monster);
sendPacket(ExAutoPlayDoMacro.STATIC_PACKET);
}
}, 0, 2000);
}
}

View File

@@ -16,7 +16,9 @@
*/
package org.l2jmobius.gameserver.model.base;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import org.l2jmobius.gameserver.enums.Race;
@@ -103,37 +105,6 @@ public enum ClassId implements IIdentifiable
ARTISAN(56, false, Race.DWARF, DWARVEN_FIGHTER),
WARSMITH(57, false, Race.DWARF, ARTISAN),
DUMMY_ENTRY_1(58, false, null, null),
DUMMY_ENTRY_2(59, false, null, null),
DUMMY_ENTRY_3(60, false, null, null),
DUMMY_ENTRY_4(61, false, null, null),
DUMMY_ENTRY_5(62, false, null, null),
DUMMY_ENTRY_6(63, false, null, null),
DUMMY_ENTRY_7(64, false, null, null),
DUMMY_ENTRY_8(65, false, null, null),
DUMMY_ENTRY_9(66, false, null, null),
DUMMY_ENTRY_10(67, false, null, null),
DUMMY_ENTRY_11(68, false, null, null),
DUMMY_ENTRY_12(69, false, null, null),
DUMMY_ENTRY_13(70, false, null, null),
DUMMY_ENTRY_14(71, false, null, null),
DUMMY_ENTRY_15(72, false, null, null),
DUMMY_ENTRY_16(73, false, null, null),
DUMMY_ENTRY_17(74, false, null, null),
DUMMY_ENTRY_18(75, false, null, null),
DUMMY_ENTRY_19(76, false, null, null),
DUMMY_ENTRY_20(77, false, null, null),
DUMMY_ENTRY_21(78, false, null, null),
DUMMY_ENTRY_22(79, false, null, null),
DUMMY_ENTRY_23(80, false, null, null),
DUMMY_ENTRY_24(81, false, null, null),
DUMMY_ENTRY_25(82, false, null, null),
DUMMY_ENTRY_26(83, false, null, null),
DUMMY_ENTRY_27(84, false, null, null),
DUMMY_ENTRY_28(85, false, null, null),
DUMMY_ENTRY_29(86, false, null, null),
DUMMY_ENTRY_30(87, false, null, null),
DUELIST(88, false, Race.HUMAN, GLADIATOR),
DREADNOUGHT(89, false, Race.HUMAN, WARLORD),
PHOENIX_KNIGHT(90, false, Race.HUMAN, PALADIN),
@@ -169,12 +140,7 @@ public enum ClassId implements IIdentifiable
FORTUNE_SEEKER(117, false, Race.DWARF, BOUNTY_HUNTER),
MAESTRO(118, false, Race.DWARF, WARSMITH),
DUMMY_ENTRY_31(119, false, null, null),
DUMMY_ENTRY_32(120, false, null, null),
DUMMY_ENTRY_33(121, false, null, null),
DUMMY_ENTRY_34(122, false, null, null),
MALE_SOLDIER(123, false, Race.KAMAEL, null),
FEMALE_SOLDIER(124, false, Race.KAMAEL, null),
TROOPER(125, false, Race.KAMAEL, MALE_SOLDIER),
@@ -189,10 +155,7 @@ public enum ClassId implements IIdentifiable
TRICKSTER(134, false, Race.KAMAEL, ARBALESTER),
INSPECTOR(135, false, Race.KAMAEL, WARDER),
JUDICATOR(136, false, Race.KAMAEL, INSPECTOR),
DUMMY_ENTRY_35(137, false, null, null),
DUMMY_ENTRY_36(138, false, null, null),
SIGEL_KNIGHT(139, false, null, null),
TYRR_WARRIOR(140, false, null, null),
OTHELL_ROGUE(141, false, null, null),
@@ -201,9 +164,7 @@ public enum ClassId implements IIdentifiable
ISS_ENCHANTER(144, false, null, null),
WYNN_SUMMONER(145, false, null, null),
AEORE_HEALER(146, false, null, null),
DUMMY_ENTRY_37(147, false, null, null),
SIGEL_PHOENIX_KNIGHT(148, false, Race.HUMAN, PHOENIX_KNIGHT),
SIGEL_HELL_KNIGHT(149, false, Race.HUMAN, HELL_KNIGHT),
SIGEL_EVA_TEMPLAR(150, false, Race.ELF, EVA_TEMPLAR),
@@ -269,6 +230,20 @@ public enum ClassId implements IIdentifiable
/** List of available Class for next transfer **/
private final Set<ClassId> _nextClassIds = new HashSet<>(1);
private static Map<Integer, ClassId> _classIdMap = new HashMap<>(ClassId.values().length);
static
{
for (ClassId classId : ClassId.values())
{
_classIdMap.put(classId.getId(), classId);
}
}
public static ClassId getClassId(int cId)
{
return _classIdMap.get(cId);
}
/**
* Class constructor.
* @param pId the class Id.
@@ -363,7 +338,6 @@ public enum ClassId implements IIdentifiable
}
return _parent.childOf(cid);
}
/**
@@ -413,18 +387,6 @@ public enum ClassId implements IIdentifiable
return _nextClassIds;
}
public static ClassId getClassId(int cId)
{
try
{
return ClassId.values()[cId];
}
catch (Exception e)
{
return null;
}
}
private final void addNextClassId(ClassId cId)
{
_nextClassIds.add(cId);

View File

@@ -102,8 +102,11 @@ import org.l2jmobius.gameserver.network.clientpackets.primeshop.RequestBRProduct
import org.l2jmobius.gameserver.network.clientpackets.primeshop.RequestBRRecentProductList;
import org.l2jmobius.gameserver.network.clientpackets.raidbossinfo.RequestRaidBossSpawnInfo;
import org.l2jmobius.gameserver.network.clientpackets.raidbossinfo.RequestRaidServerInfo;
import org.l2jmobius.gameserver.network.clientpackets.ranking.ExRankCharInfo;
import org.l2jmobius.gameserver.network.clientpackets.ranking.ExRankingCharRankers;
import org.l2jmobius.gameserver.network.clientpackets.sayune.RequestFlyMove;
import org.l2jmobius.gameserver.network.clientpackets.sayune.RequestFlyMoveStart;
import org.l2jmobius.gameserver.network.clientpackets.sessionzones.ExTimedHuntingZoneList;
import org.l2jmobius.gameserver.network.clientpackets.shuttle.CannotMoveAnymoreInShuttle;
import org.l2jmobius.gameserver.network.clientpackets.shuttle.MoveToLocationInShuttle;
import org.l2jmobius.gameserver.network.clientpackets.shuttle.RequestShuttleGetOff;
@@ -463,19 +466,19 @@ public enum ExIncomingPackets implements IIncomingPackets<GameClient>
EX_INTERACT_MODIFY(0x15F, null, ConnectionState.IN_GAME), // 152
EX_TRY_ENCHANT_ARTIFACT(0x160, null, ConnectionState.IN_GAME), // 152
EX_XIGN_CODE(0x161, null, ConnectionState.IN_GAME), // 152
EX_OPEN_HTML(0x164, null, ConnectionState.IN_GAME), // 228
EX_OPEN_HTML(0x164, ExOpenDimensionalHtml::new, ConnectionState.IN_GAME), // 228
EX_REQUEST_CLASS_CHANGE(0x165, null, ConnectionState.IN_GAME), // 228
EX_REQUEST_CLASS_CHANGE_VERIFYING(0x166, null, ConnectionState.IN_GAME), // 228
EX_REQUEST_TELEPORT(0x167, ExRequestTeleport::new, ConnectionState.IN_GAME), // 228
EX_COSTUME_COLLECTION_SKILL_ACTIVE(0x16B, null, ConnectionState.IN_GAME), // 228
REQUEST_AUTO_USE_POTION(0x171, null, ConnectionState.IN_GAME), // 228
REQUEST_AUTO_USE(0x177, null, ConnectionState.IN_GAME), // 228
EX_TIME_RESTRICT_FIELD_LIST(0x17F, null, ConnectionState.IN_GAME), // 228
EX_AUTOPLAY_SETTING(0x177, ExAutoPlaySetting::new, ConnectionState.IN_GAME), // 228
EX_TIME_RESTRICT_FIELD_LIST(0x17F, ExTimedHuntingZoneList::new, ConnectionState.IN_GAME), // 228
EX_TIME_RESTRICT_FIELD_USER_ENTER(0x180, null, ConnectionState.IN_GAME), // 228
EX_RANKING_CHAR_INFO(0x181, null, ConnectionState.IN_GAME), // 228
EX_RANKING_CHAR_INFO(0x181, ExRankCharInfo::new, ConnectionState.IN_GAME), // 228
EX_RANKING_CHAR_HISTORY(0x182, null, ConnectionState.IN_GAME), // 228
EX_RANKING_CHAR_RANKERS(0x183, null, ConnectionState.IN_GAME), // 228
EX_RANKING_CHAR_RANKERS(0x183, ExRankingCharRankers::new, ConnectionState.IN_GAME), // 228
EX_MERCENARY_CASTLEWAR_CASTLE_SIEGE_ATTACKER_LIST(0x186, null, ConnectionState.IN_GAME), // 228
EX_PVP_BOOK_LIST(0x18B, ExPvpBookList::new, ConnectionState.IN_GAME), // 228
EX_LETTER_COLLECTOR_TAKE_REWARD(0x18D, null, ConnectionState.IN_GAME); // 228
public static final ExIncomingPackets[] PACKET_ARRAY;

View File

@@ -801,9 +801,15 @@ public enum OutgoingPackets
EX_SEND_COSTUME_LIST(0xFE, 0x20F), // 228
EX_COSTUME_SHORTCUT_LIST(0xFE, 0x215), // 228
EX_SHOW_TELEPORT_UI(0xFE, 0x219), // 228
EX_PREMIUM_MANAGER_SHOW_HTML(0xFE, 0x21B), // 228
EX_AUTOPLAY_SETTING(0xFE, 0x221), // 228
EX_AUTOPLAY_DO_MACRO(0xFE, 0x222), // 228
EX_TIME_RESTRICT_FIELD_LIST(0xFE, 0x22B), // 228
EX_UNK_225(0xFE, 0x225), // 228
EX_MERCENARY_CASTLEWAR_CASTLE_SIEGE_HUD_INFO(0xFE, 0x235); // 228
EX_RANKING_CHAR_INFO(0xFE, 0x230), // 228
EX_RANKING_CHAR_RANKERS(0xFE, 0x232), // 228
EX_MERCENARY_CASTLEWAR_CASTLE_SIEGE_HUD_INFO(0xFE, 0x235), // 228
EX_PVPBOOK_LIST(0xFE, 0x23A); // 228
private final int _id1;
private final int _id2;

View File

@@ -0,0 +1,70 @@
/*
* 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 org.l2jmobius.gameserver.network.clientpackets;
import org.l2jmobius.commons.network.PacketReader;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.network.GameClient;
import org.l2jmobius.gameserver.network.serverpackets.ExAutoPlaySettingSend;
/**
* @author Mobius
*/
public class ExAutoPlaySetting implements IClientIncomingPacket
{
private int _options;
private boolean _active;
private boolean _pickUp;
private int _nextTargetMode;
private boolean _longRange;
private int _potionPercent;
private boolean _respectfulHunting;
@Override
public boolean read(GameClient client, PacketReader packet)
{
_options = packet.readH();
_active = packet.readC() == 1;
_pickUp = packet.readC() == 1;
_nextTargetMode = packet.readH();
_longRange = packet.readC() == 0;
_potionPercent = packet.readD();
_respectfulHunting = packet.readC() == 1;
return true;
}
@Override
public void run(GameClient client)
{
final PlayerInstance player = client.getPlayer();
if (player == null)
{
return;
}
player.sendPacket(new ExAutoPlaySettingSend(_options, _active, _pickUp, _nextTargetMode, _longRange, _potionPercent, _respectfulHunting));
if (_active)
{
player.startAutoPlayTask(_longRange, _respectfulHunting);
}
else
{
player.stopAutoPlayTask();
}
}
}

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 org.l2jmobius.gameserver.network.clientpackets;
import org.l2jmobius.commons.network.PacketReader;
import org.l2jmobius.gameserver.cache.HtmCache;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.network.GameClient;
import org.l2jmobius.gameserver.network.serverpackets.NpcHtmlMessage;
/**
* @author Mobius
*/
public class ExOpenDimensionalHtml implements IClientIncomingPacket
{
@Override
public boolean read(GameClient client, PacketReader packet)
{
packet.readC(); // html scope?
return true;
}
@Override
public void run(GameClient client)
{
final PlayerInstance player = client.getPlayer();
if (player == null)
{
return;
}
// FIXME:
// client.sendPacket(new ExPremiumManagerShowHtml(HtmCache.getInstance().getHtm(player, "data/scripts/ai/others/DimensionalMerchant/32478.html")));
final NpcHtmlMessage html = new NpcHtmlMessage();
html.setHtml(HtmCache.getInstance().getHtm(player, "data/scripts/ai/others/DimensionalMerchant/32478.html"));
player.sendPacket(html);
}
}

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 org.l2jmobius.gameserver.network.clientpackets;
import org.l2jmobius.commons.network.PacketReader;
import org.l2jmobius.gameserver.network.GameClient;
import org.l2jmobius.gameserver.network.serverpackets.PvpBookList;
/**
* @author JoeAlisson
*/
public class ExPvpBookList implements IClientIncomingPacket
{
@Override
public boolean read(GameClient client, PacketReader packet)
{
return true;
}
@Override
public void run(GameClient client)
{
client.sendPacket(new PvpBookList());
}
}

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 org.l2jmobius.gameserver.network.clientpackets.ranking;
import org.l2jmobius.commons.network.PacketReader;
import org.l2jmobius.gameserver.network.GameClient;
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
import org.l2jmobius.gameserver.network.serverpackets.ranking.ExRankingCharInfo;
/**
* @author JoeAlisson
*/
public class ExRankCharInfo implements IClientIncomingPacket
{
@Override
public boolean read(GameClient client, PacketReader packet)
{
return true;
}
@Override
public void run(GameClient client)
{
client.sendPacket(new ExRankingCharInfo());
}
}

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 org.l2jmobius.gameserver.network.clientpackets.ranking;
import org.l2jmobius.commons.network.PacketReader;
import org.l2jmobius.gameserver.network.GameClient;
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
import org.l2jmobius.gameserver.network.serverpackets.ranking.ExRankList;
/**
* @author JoeAlisson
*/
public class ExRankingCharRankers implements IClientIncomingPacket
{
private int _group;
private int _scope;
private int _race;
@Override
public boolean read(GameClient client, PacketReader packet)
{
_group = packet.readC();
_scope = packet.readC();
_race = packet.readD();
return true;
}
@Override
public void run(GameClient client)
{
client.sendPacket(new ExRankList(_group, _scope, _race));
}
}

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 org.l2jmobius.gameserver.network.clientpackets.sessionzones;
import org.l2jmobius.commons.network.PacketReader;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.network.GameClient;
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
import org.l2jmobius.gameserver.network.serverpackets.timedhunting.TimedHuntingZoneList;
public class ExTimedHuntingZoneList implements IClientIncomingPacket
{
@Override
public boolean read(GameClient client, PacketReader packet)
{
return true;
}
@Override
public void run(GameClient client)
{
final PlayerInstance player = client.getPlayer();
if (player == null)
{
return;
}
client.sendPacket(new TimedHuntingZoneList());
}
}

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 org.l2jmobius.gameserver.network.serverpackets;
import org.l2jmobius.commons.network.PacketWriter;
import org.l2jmobius.gameserver.network.OutgoingPackets;
/**
* @author Mobius
*/
public class ExAutoPlayDoMacro implements IClientOutgoingPacket
{
public static final ExAutoPlayDoMacro STATIC_PACKET = new ExAutoPlayDoMacro();
public ExAutoPlayDoMacro()
{
}
@Override
public boolean write(PacketWriter packet)
{
OutgoingPackets.EX_AUTOPLAY_DO_MACRO.writeId(packet);
packet.writeD(0x114);
return true;
}
}

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 org.l2jmobius.gameserver.network.serverpackets;
import org.l2jmobius.commons.network.PacketWriter;
import org.l2jmobius.gameserver.network.OutgoingPackets;
/**
* @author JoeAlisson
*/
public class ExAutoPlaySettingSend implements IClientOutgoingPacket
{
private final int _options;
private final boolean _active;
private final boolean _pickUp;
private final int _nextTargetMode;
private final boolean _longRange;
private final int _potionPercent;
private final boolean _respectfulHunting;
public ExAutoPlaySettingSend(int options, boolean active, boolean pickUp, int nextTargetMode, boolean longRange, int potionPercent, boolean respectfulHunting)
{
_options = options;
_active = active;
_pickUp = pickUp;
_nextTargetMode = nextTargetMode;
_longRange = longRange;
_potionPercent = potionPercent;
_respectfulHunting = respectfulHunting;
}
@Override
public boolean write(PacketWriter packet)
{
OutgoingPackets.EX_AUTOPLAY_SETTING.writeId(packet);
packet.writeH(_options);
packet.writeC(_active ? 1 : 0);
packet.writeC(_pickUp ? 1 : 0);
packet.writeH(_nextTargetMode);
packet.writeC(_longRange ? 1 : 0);
packet.writeD(_potionPercent);
packet.writeC(_respectfulHunting ? 1 : 0);
return true;
}
}

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 org.l2jmobius.gameserver.network.serverpackets;
import org.l2jmobius.commons.network.PacketWriter;
import org.l2jmobius.gameserver.enums.HtmlActionScope;
import org.l2jmobius.gameserver.network.OutgoingPackets;
/**
* @author JoeAlisson
*/
public class ExPremiumManagerShowHtml extends AbstractHtmlPacket
{
public ExPremiumManagerShowHtml(String html)
{
super(html);
}
@Override
public boolean write(PacketWriter packet)
{
OutgoingPackets.EX_PREMIUM_MANAGER_SHOW_HTML.writeId(packet);
packet.writeD(getNpcObjId());
packet.writeS(getHtml());
packet.writeD(-1);
packet.writeD(0);
return true;
}
@Override
public HtmlActionScope getScope()
{
return HtmlActionScope.PREMIUM_HTML;
}
}

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 org.l2jmobius.gameserver.network.serverpackets;
import java.time.LocalDateTime;
import java.time.ZoneId;
import org.l2jmobius.commons.network.PacketWriter;
import org.l2jmobius.gameserver.network.OutgoingPackets;
public class PvpBookList implements IClientOutgoingPacket
{
public PvpBookList()
{
}
@Override
public boolean write(PacketWriter packet)
{
OutgoingPackets.EX_PVPBOOK_LIST.writeId(packet);
int size = 1;
packet.writeD(4); // show killer's location count
packet.writeD(5); // teleport count
packet.writeD(size); // killer count
for (int i = 0; i < size; i++)
{
packet.writeString("killer" + i); // killer name
packet.writeString("clanKiller" + i); // killer clan name
packet.writeD(15); // killer level
packet.writeD(2); // killer race
packet.writeD(10); // killer class
packet.writeD((int) LocalDateTime.now().atZone(ZoneId.systemDefault()).toEpochSecond()); // kill time
packet.writeC(1); // is online
}
return true;
}
}

View File

@@ -0,0 +1,99 @@
/*
* 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 org.l2jmobius.gameserver.network.serverpackets.ranking;
import java.util.ArrayList;
import java.util.List;
import org.l2jmobius.commons.network.PacketWriter;
import org.l2jmobius.gameserver.network.OutgoingPackets;
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
/**
* @author JoeAlisson
*/
public class ExRankList implements IClientOutgoingPacket
{
private final int _race;
private final int _group;
private final int _scope;
public ExRankList(int group, int scope, int race)
{
_group = group;
_scope = scope;
_race = race;
}
@Override
public boolean write(PacketWriter packet)
{
OutgoingPackets.EX_RANKING_CHAR_RANKERS.writeId(packet);
packet.writeC(_group);
packet.writeC(_scope);
packet.writeD(_race);
List<Ranker> rankers = new ArrayList<>();
for (int i = 0; i < 5; i++)
{
addRanker(rankers);
}
packet.writeD(rankers.size());
for (Ranker ranker : rankers)
{
packet.writeString(ranker.name);
packet.writeString(ranker.pledgeName);
packet.writeD(ranker.level);
packet.writeD(ranker.rClass);
packet.writeD(ranker.race);
packet.writeD(ranker.rank);
packet.writeD(ranker.serverRankSnapshot);
packet.writeD(ranker.raceRankSnapshot);
}
return true;
}
private static void addRanker(List<Ranker> rankers)
{
final Ranker ranker = new Ranker();
ranker.name = "Ranker" + rankers.size();
ranker.pledgeName = "ClanRanker" + rankers.size();
ranker.level = 80 - rankers.size();
ranker.race = rankers.size();
ranker.rClass = 20 + rankers.size();
ranker.rank = 1 + rankers.size();
ranker.serverRankSnapshot = ranker.rank + ((rankers.size() % 2) == 0 ? 2 : -1);
ranker.raceRankSnapshot = rankers.size();
rankers.add(ranker);
}
private static class Ranker
{
String name;
String pledgeName;
int level;
int rClass;
int rank;
int race;
int serverRankSnapshot;
int raceRankSnapshot;
}
}

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 org.l2jmobius.gameserver.network.serverpackets.ranking;
import org.l2jmobius.commons.network.PacketWriter;
import org.l2jmobius.gameserver.network.OutgoingPackets;
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
/**
* @author JoeAlisson
*/
public class ExRankingCharInfo implements IClientOutgoingPacket
{
public ExRankingCharInfo()
{
}
@Override
public boolean write(PacketWriter packet)
{
OutgoingPackets.EX_RANKING_CHAR_INFO.writeId(packet);
packet.writeD(1); // server rank
packet.writeD(2); // race rank
packet.writeD(2); // server rank snapshot
packet.writeD(1); // race rank snapshot
return true;
}
}

View File

@@ -0,0 +1,111 @@
/*
* 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 org.l2jmobius.gameserver.network.serverpackets.timedhunting;
import java.util.ArrayList;
import java.util.List;
import org.l2jmobius.commons.network.PacketWriter;
import org.l2jmobius.gameserver.network.OutgoingPackets;
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
public class TimedHuntingZoneList implements IClientOutgoingPacket
{
public TimedHuntingZoneList()
{
}
@Override
public boolean write(PacketWriter packet)
{
OutgoingPackets.EX_TIME_RESTRICT_FIELD_LIST.writeId(packet);
List<TimeRestrictedFieldInfo> infos = new ArrayList<>();
addField(infos);
packet.writeD(infos.size());
for (TimeRestrictedFieldInfo info : infos)
{
packet.writeD(info.requiredItems.size());
for (FieldRequiredItem item : info.requiredItems)
{
packet.writeD(item.itemId);
packet.writeQ(item.count);
}
packet.writeD(info.resetCycle);
packet.writeD(info.fieldId);
packet.writeD(info.minLevel);
packet.writeD(info.maxLevel);
packet.writeD(info.remainTimeBase);
packet.writeD(info.remainTime);
packet.writeD(info.remainTimeMax);
packet.writeD(info.remainRefillTime);
packet.writeD(info.refillTimeMax);
packet.writeC(info.fieldActivated ? 1 : 0);
}
return true;
}
private void addField(List<TimeRestrictedFieldInfo> infos)
{
final TimeRestrictedFieldInfo field = new TimeRestrictedFieldInfo();
field.resetCycle = 1;
field.fieldId = 2;
field.minLevel = 78;
field.maxLevel = 999;
field.remainTimeBase = 3600;
field.remainTime = 3600;
field.remainTimeMax = 21600;
field.remainRefillTime = 18000;
field.refillTimeMax = 18000;
field.fieldActivated = true;
final FieldRequiredItem item = new FieldRequiredItem();
item.itemId = 57;
item.count = 10000;
field.requiredItems = List.of(item);
infos.add(field);
}
static class TimeRestrictedFieldInfo
{
List<FieldRequiredItem> requiredItems;
int resetCycle;
int fieldId;
int minLevel;
int maxLevel;
int remainTimeBase;
int remainTime;
int remainTimeMax;
int remainRefillTime;
int refillTimeMax;
boolean fieldActivated;
}
static class FieldRequiredItem
{
int itemId;
long count;
}
}