Addition of Shared Location action.

Contributed by nasseka.
This commit is contained in:
MobiusDevelopment
2022-09-23 21:50:24 +00:00
parent bb0e37a5b9
commit b5e9fc422d
81 changed files with 1341 additions and 123 deletions
@@ -677,7 +677,7 @@ ResumeAutoPlay = False
Share loction L-Coin cost. Share loction L-Coin cost.
# Default: 50 # Default: 50
ShareLocationLcoinCost = 1000 ShareLocationLcoinCost = 50
# Teleport share location L-Coin cost. # Teleport share location L-Coin cost.
# Default: 400 # Default: 400
@@ -21,6 +21,8 @@ import org.l2jmobius.gameserver.enums.ChatType;
import org.l2jmobius.gameserver.enums.PlayerCondOverride; import org.l2jmobius.gameserver.enums.PlayerCondOverride;
import org.l2jmobius.gameserver.handler.IChatHandler; import org.l2jmobius.gameserver.handler.IChatHandler;
import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.itemcontainer.Inventory;
import org.l2jmobius.gameserver.model.zone.ZoneId;
import org.l2jmobius.gameserver.network.SystemMessageId; import org.l2jmobius.gameserver.network.SystemMessageId;
import org.l2jmobius.gameserver.network.serverpackets.CreatureSay; import org.l2jmobius.gameserver.network.serverpackets.CreatureSay;
@@ -35,7 +37,7 @@ public class ChatAlliance implements IChatHandler
}; };
@Override @Override
public void handleChat(ChatType type, Player activeChar, String target, String text) public void handleChat(ChatType type, Player activeChar, String target, String text, boolean shareLocation)
{ {
if ((activeChar.getClan() == null) || ((activeChar.getClan() != null) && (activeChar.getClan().getAllyId() == 0))) if ((activeChar.getClan() == null) || ((activeChar.getClan() != null) && (activeChar.getClan().getAllyId() == 0)))
{ {
@@ -53,7 +55,25 @@ public class ChatAlliance implements IChatHandler
activeChar.sendPacket(SystemMessageId.CHATTING_IS_CURRENTLY_PROHIBITED); activeChar.sendPacket(SystemMessageId.CHATTING_IS_CURRENTLY_PROHIBITED);
return; return;
} }
activeChar.getClan().broadcastToOnlineAllyMembers(new CreatureSay(activeChar, type, activeChar.getName(), text));
if (shareLocation)
{
if (activeChar.getInventory().getInventoryItemCount(Inventory.LCOIN_ID, -1) < Config.SHARING_LOCATION_COST)
{
activeChar.sendPacket(SystemMessageId.THERE_ARE_NOT_ENOUGH_L_COINS);
return;
}
if ((activeChar.getMovieHolder() != null) || activeChar.isFishing() || activeChar.isInInstance() || activeChar.isOnEvent() || activeChar.isInOlympiadMode() || activeChar.inObserverMode() || activeChar.isInTraingCamp() || activeChar.isInTimedHuntingZone() || activeChar.isInsideZone(ZoneId.SIEGE))
{
activeChar.sendPacket(SystemMessageId.LOCATION_CANNOT_BE_SHARED_SINCE_THE_CONDITIONS_ARE_NOT_MET);
return;
}
activeChar.destroyItemByItemId("Shared Location", Inventory.LCOIN_ID, Config.SHARING_LOCATION_COST, activeChar, true);
}
activeChar.getClan().broadcastToOnlineAllyMembers(new CreatureSay(activeChar, type, activeChar.getName(), text, shareLocation));
} }
@Override @Override
@@ -21,6 +21,8 @@ import org.l2jmobius.gameserver.enums.ChatType;
import org.l2jmobius.gameserver.enums.PlayerCondOverride; import org.l2jmobius.gameserver.enums.PlayerCondOverride;
import org.l2jmobius.gameserver.handler.IChatHandler; import org.l2jmobius.gameserver.handler.IChatHandler;
import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.itemcontainer.Inventory;
import org.l2jmobius.gameserver.model.zone.ZoneId;
import org.l2jmobius.gameserver.network.SystemMessageId; import org.l2jmobius.gameserver.network.SystemMessageId;
import org.l2jmobius.gameserver.network.serverpackets.CreatureSay; import org.l2jmobius.gameserver.network.serverpackets.CreatureSay;
@@ -36,7 +38,7 @@ public class ChatClan implements IChatHandler
}; };
@Override @Override
public void handleChat(ChatType type, Player activeChar, String target, String text) public void handleChat(ChatType type, Player activeChar, String target, String text, boolean shareLocation)
{ {
if (activeChar.getClan() == null) if (activeChar.getClan() == null)
{ {
@@ -54,7 +56,25 @@ public class ChatClan implements IChatHandler
activeChar.sendPacket(SystemMessageId.CHATTING_IS_CURRENTLY_PROHIBITED); activeChar.sendPacket(SystemMessageId.CHATTING_IS_CURRENTLY_PROHIBITED);
return; return;
} }
activeChar.getClan().broadcastCSToOnlineMembers(new CreatureSay(activeChar, type, activeChar.getName(), text), activeChar);
if (shareLocation)
{
if (activeChar.getInventory().getInventoryItemCount(Inventory.LCOIN_ID, -1) < Config.SHARING_LOCATION_COST)
{
activeChar.sendPacket(SystemMessageId.THERE_ARE_NOT_ENOUGH_L_COINS);
return;
}
if ((activeChar.getMovieHolder() != null) || activeChar.isFishing() || activeChar.isInInstance() || activeChar.isOnEvent() || activeChar.isInOlympiadMode() || activeChar.inObserverMode() || activeChar.isInTraingCamp() || activeChar.isInTimedHuntingZone() || activeChar.isInsideZone(ZoneId.SIEGE))
{
activeChar.sendPacket(SystemMessageId.LOCATION_CANNOT_BE_SHARED_SINCE_THE_CONDITIONS_ARE_NOT_MET);
return;
}
activeChar.destroyItemByItemId("Shared Location", Inventory.LCOIN_ID, Config.SHARING_LOCATION_COST, activeChar, true);
}
activeChar.getClan().broadcastCSToOnlineMembers(new CreatureSay(activeChar, type, activeChar.getName(), text, shareLocation), activeChar);
} }
@Override @Override
@@ -27,6 +27,8 @@ import org.l2jmobius.gameserver.handler.VoicedCommandHandler;
import org.l2jmobius.gameserver.model.BlockList; import org.l2jmobius.gameserver.model.BlockList;
import org.l2jmobius.gameserver.model.World; import org.l2jmobius.gameserver.model.World;
import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.itemcontainer.Inventory;
import org.l2jmobius.gameserver.model.zone.ZoneId;
import org.l2jmobius.gameserver.network.SystemMessageId; import org.l2jmobius.gameserver.network.SystemMessageId;
import org.l2jmobius.gameserver.network.serverpackets.CreatureSay; import org.l2jmobius.gameserver.network.serverpackets.CreatureSay;
import org.l2jmobius.gameserver.network.serverpackets.SystemMessage; import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
@@ -43,7 +45,7 @@ public class ChatGeneral implements IChatHandler
}; };
@Override @Override
public void handleChat(ChatType type, Player activeChar, String paramsValue, String text) public void handleChat(ChatType type, Player activeChar, String paramsValue, String text, boolean shareLocation)
{ {
boolean vcdUsed = false; boolean vcdUsed = false;
if (text.startsWith(".")) if (text.startsWith("."))
@@ -87,8 +89,26 @@ public class ChatGeneral implements IChatHandler
return; return;
} }
final CreatureSay cs = new CreatureSay(activeChar, type, activeChar.getAppearance().getVisibleName(), text); if (shareLocation)
final CreatureSay csRandom = new CreatureSay(activeChar, type, activeChar.getAppearance().getVisibleName(), ChatRandomizer.randomize(text)); {
if (activeChar.getInventory().getInventoryItemCount(Inventory.LCOIN_ID, -1) < Config.SHARING_LOCATION_COST)
{
activeChar.sendPacket(SystemMessageId.THERE_ARE_NOT_ENOUGH_L_COINS);
return;
}
if ((activeChar.getMovieHolder() != null) || activeChar.isFishing() || activeChar.isInInstance() || activeChar.isOnEvent() || activeChar.isInOlympiadMode() || activeChar.inObserverMode() || activeChar.isInTraingCamp() || activeChar.isInTimedHuntingZone() || activeChar.isInsideZone(ZoneId.SIEGE))
{
activeChar.sendPacket(SystemMessageId.LOCATION_CANNOT_BE_SHARED_SINCE_THE_CONDITIONS_ARE_NOT_MET);
return;
}
activeChar.destroyItemByItemId("Shared Location", Inventory.LCOIN_ID, Config.SHARING_LOCATION_COST, activeChar, true);
}
final CreatureSay cs = new CreatureSay(activeChar, type, activeChar.getAppearance().getVisibleName(), text, shareLocation);
final CreatureSay csRandom = new CreatureSay(activeChar, type, activeChar.getAppearance().getVisibleName(), ChatRandomizer.randomize(text), shareLocation);
World.getInstance().forEachVisibleObjectInRange(activeChar, Player.class, 1250, player -> World.getInstance().forEachVisibleObjectInRange(activeChar, Player.class, 1250, player ->
{ {
if ((player != null) && !BlockList.isBlocked(player, activeChar)) if ((player != null) && !BlockList.isBlocked(player, activeChar))
@@ -38,7 +38,7 @@ public class ChatHeroVoice implements IChatHandler
}; };
@Override @Override
public void handleChat(ChatType type, Player activeChar, String target, String text) public void handleChat(ChatType type, Player activeChar, String target, String text, boolean shareLocation)
{ {
if (!activeChar.isHero() && !activeChar.canOverrideCond(PlayerCondOverride.CHAT_CONDITIONS)) if (!activeChar.isHero() && !activeChar.canOverrideCond(PlayerCondOverride.CHAT_CONDITIONS))
{ {
@@ -62,7 +62,7 @@ public class ChatHeroVoice implements IChatHandler
return; return;
} }
final CreatureSay cs = new CreatureSay(activeChar, type, activeChar.getName(), text); final CreatureSay cs = new CreatureSay(activeChar, type, activeChar.getName(), text, shareLocation);
for (Player player : World.getInstance().getPlayers()) for (Player player : World.getInstance().getPlayers())
{ {
if ((player != null) && !BlockList.isBlocked(player, activeChar)) if ((player != null) && !BlockList.isBlocked(player, activeChar))
@@ -21,6 +21,8 @@ import org.l2jmobius.gameserver.enums.ChatType;
import org.l2jmobius.gameserver.enums.PlayerCondOverride; import org.l2jmobius.gameserver.enums.PlayerCondOverride;
import org.l2jmobius.gameserver.handler.IChatHandler; import org.l2jmobius.gameserver.handler.IChatHandler;
import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.itemcontainer.Inventory;
import org.l2jmobius.gameserver.model.zone.ZoneId;
import org.l2jmobius.gameserver.network.SystemMessageId; import org.l2jmobius.gameserver.network.SystemMessageId;
import org.l2jmobius.gameserver.network.serverpackets.CreatureSay; import org.l2jmobius.gameserver.network.serverpackets.CreatureSay;
@@ -36,7 +38,7 @@ public class ChatParty implements IChatHandler
}; };
@Override @Override
public void handleChat(ChatType type, Player activeChar, String target, String text) public void handleChat(ChatType type, Player activeChar, String target, String text, boolean shareLocation)
{ {
if (!activeChar.isInParty()) if (!activeChar.isInParty())
{ {
@@ -54,7 +56,25 @@ public class ChatParty implements IChatHandler
activeChar.sendPacket(SystemMessageId.CHATTING_IS_CURRENTLY_PROHIBITED); activeChar.sendPacket(SystemMessageId.CHATTING_IS_CURRENTLY_PROHIBITED);
return; return;
} }
activeChar.getParty().broadcastCreatureSay(new CreatureSay(activeChar, type, activeChar.getName(), text), activeChar);
if (shareLocation)
{
if (activeChar.getInventory().getInventoryItemCount(Inventory.LCOIN_ID, -1) < Config.SHARING_LOCATION_COST)
{
activeChar.sendPacket(SystemMessageId.THERE_ARE_NOT_ENOUGH_L_COINS);
return;
}
if ((activeChar.getMovieHolder() != null) || activeChar.isFishing() || activeChar.isInInstance() || activeChar.isOnEvent() || activeChar.isInOlympiadMode() || activeChar.inObserverMode() || activeChar.isInTraingCamp() || activeChar.isInTimedHuntingZone() || activeChar.isInsideZone(ZoneId.SIEGE))
{
activeChar.sendPacket(SystemMessageId.LOCATION_CANNOT_BE_SHARED_SINCE_THE_CONDITIONS_ARE_NOT_MET);
return;
}
activeChar.destroyItemByItemId("Shared Location", Inventory.LCOIN_ID, Config.SHARING_LOCATION_COST, activeChar, true);
}
activeChar.getParty().broadcastCreatureSay(new CreatureSay(activeChar, type, activeChar.getName(), text, shareLocation), activeChar);
} }
@Override @Override
@@ -37,7 +37,7 @@ public class ChatPartyMatchRoom implements IChatHandler
}; };
@Override @Override
public void handleChat(ChatType type, Player activeChar, String target, String text) public void handleChat(ChatType type, Player activeChar, String target, String text, boolean shareLocation)
{ {
final MatchingRoom room = activeChar.getMatchingRoom(); final MatchingRoom room = activeChar.getMatchingRoom();
if (room != null) if (room != null)
@@ -53,7 +53,7 @@ public class ChatPartyMatchRoom implements IChatHandler
return; return;
} }
final CreatureSay cs = new CreatureSay(activeChar, type, activeChar.getName(), text); final CreatureSay cs = new CreatureSay(activeChar, type, activeChar.getName(), text, shareLocation);
for (Player _member : room.getMembers()) for (Player _member : room.getMembers())
{ {
if (Config.FACTION_SYSTEM_ENABLED) if (Config.FACTION_SYSTEM_ENABLED)
@@ -36,7 +36,7 @@ public class ChatPartyRoomAll implements IChatHandler
}; };
@Override @Override
public void handleChat(ChatType type, Player activeChar, String target, String text) public void handleChat(ChatType type, Player activeChar, String target, String text, boolean shareLocation)
{ {
if (activeChar.isInParty() && activeChar.getParty().isInCommandChannel() && activeChar.getParty().isLeader(activeChar)) if (activeChar.isInParty() && activeChar.getParty().isInCommandChannel() && activeChar.getParty().isLeader(activeChar))
{ {
@@ -50,7 +50,7 @@ public class ChatPartyRoomAll implements IChatHandler
activeChar.sendPacket(SystemMessageId.CHATTING_IS_CURRENTLY_PROHIBITED); activeChar.sendPacket(SystemMessageId.CHATTING_IS_CURRENTLY_PROHIBITED);
return; return;
} }
activeChar.getParty().getCommandChannel().broadcastCreatureSay(new CreatureSay(activeChar, type, activeChar.getName(), text), activeChar); activeChar.getParty().getCommandChannel().broadcastCreatureSay(new CreatureSay(activeChar, type, activeChar.getName(), text, shareLocation), activeChar);
} }
} }
@@ -36,7 +36,7 @@ public class ChatPartyRoomCommander implements IChatHandler
}; };
@Override @Override
public void handleChat(ChatType type, Player activeChar, String target, String text) public void handleChat(ChatType type, Player activeChar, String target, String text, boolean shareLocation)
{ {
if (activeChar.isInParty() && activeChar.getParty().isInCommandChannel() && activeChar.getParty().getCommandChannel().getLeader().equals(activeChar)) if (activeChar.isInParty() && activeChar.getParty().isInCommandChannel() && activeChar.getParty().getCommandChannel().getLeader().equals(activeChar))
{ {
@@ -50,7 +50,7 @@ public class ChatPartyRoomCommander implements IChatHandler
activeChar.sendPacket(SystemMessageId.CHATTING_IS_CURRENTLY_PROHIBITED); activeChar.sendPacket(SystemMessageId.CHATTING_IS_CURRENTLY_PROHIBITED);
return; return;
} }
activeChar.getParty().getCommandChannel().broadcastCreatureSay(new CreatureSay(activeChar, type, activeChar.getName(), text), activeChar); activeChar.getParty().getCommandChannel().broadcastCreatureSay(new CreatureSay(activeChar, type, activeChar.getName(), text, shareLocation), activeChar);
} }
} }
@@ -37,7 +37,7 @@ public class ChatPetition implements IChatHandler
}; };
@Override @Override
public void handleChat(ChatType type, Player activeChar, String target, String text) public void handleChat(ChatType type, Player activeChar, String target, String text, boolean shareLocation)
{ {
if (activeChar.isChatBanned() && Config.BAN_CHAT_CHANNELS.contains(type)) if (activeChar.isChatBanned() && Config.BAN_CHAT_CHANNELS.contains(type))
{ {
@@ -24,6 +24,8 @@ import org.l2jmobius.gameserver.instancemanager.MapRegionManager;
import org.l2jmobius.gameserver.model.BlockList; import org.l2jmobius.gameserver.model.BlockList;
import org.l2jmobius.gameserver.model.World; import org.l2jmobius.gameserver.model.World;
import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.itemcontainer.Inventory;
import org.l2jmobius.gameserver.model.zone.ZoneId;
import org.l2jmobius.gameserver.network.SystemMessageId; import org.l2jmobius.gameserver.network.SystemMessageId;
import org.l2jmobius.gameserver.network.serverpackets.CreatureSay; import org.l2jmobius.gameserver.network.serverpackets.CreatureSay;
import org.l2jmobius.gameserver.network.serverpackets.SystemMessage; import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
@@ -40,7 +42,7 @@ public class ChatShout implements IChatHandler
}; };
@Override @Override
public void handleChat(ChatType type, Player activeChar, String target, String text) public void handleChat(ChatType type, Player activeChar, String target, String text, boolean shareLocation)
{ {
if (activeChar.isChatBanned() && Config.BAN_CHAT_CHANNELS.contains(type)) if (activeChar.isChatBanned() && Config.BAN_CHAT_CHANNELS.contains(type))
{ {
@@ -58,7 +60,24 @@ public class ChatShout implements IChatHandler
return; return;
} }
final CreatureSay cs = new CreatureSay(activeChar, type, activeChar.getName(), text); if (shareLocation)
{
if (activeChar.getInventory().getInventoryItemCount(Inventory.LCOIN_ID, -1) < Config.SHARING_LOCATION_COST)
{
activeChar.sendPacket(SystemMessageId.THERE_ARE_NOT_ENOUGH_L_COINS);
return;
}
if ((activeChar.getMovieHolder() != null) || activeChar.isFishing() || activeChar.isInInstance() || activeChar.isOnEvent() || activeChar.isInOlympiadMode() || activeChar.inObserverMode() || activeChar.isInTraingCamp() || activeChar.isInTimedHuntingZone() || activeChar.isInsideZone(ZoneId.SIEGE))
{
activeChar.sendPacket(SystemMessageId.LOCATION_CANNOT_BE_SHARED_SINCE_THE_CONDITIONS_ARE_NOT_MET);
return;
}
activeChar.destroyItemByItemId("Shared Location", Inventory.LCOIN_ID, Config.SHARING_LOCATION_COST, activeChar, true);
}
final CreatureSay cs = new CreatureSay(activeChar, type, activeChar.getName(), text, shareLocation);
if (Config.DEFAULT_GLOBAL_CHAT.equalsIgnoreCase("on") || (Config.DEFAULT_GLOBAL_CHAT.equalsIgnoreCase("gm") && activeChar.canOverrideCond(PlayerCondOverride.CHAT_CONDITIONS))) if (Config.DEFAULT_GLOBAL_CHAT.equalsIgnoreCase("on") || (Config.DEFAULT_GLOBAL_CHAT.equalsIgnoreCase("gm") && activeChar.canOverrideCond(PlayerCondOverride.CHAT_CONDITIONS)))
{ {
final int region = MapRegionManager.getInstance().getMapRegionLocId(activeChar); final int region = MapRegionManager.getInstance().getMapRegionLocId(activeChar);
@@ -24,6 +24,8 @@ import org.l2jmobius.gameserver.instancemanager.MapRegionManager;
import org.l2jmobius.gameserver.model.BlockList; import org.l2jmobius.gameserver.model.BlockList;
import org.l2jmobius.gameserver.model.World; import org.l2jmobius.gameserver.model.World;
import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.itemcontainer.Inventory;
import org.l2jmobius.gameserver.model.zone.ZoneId;
import org.l2jmobius.gameserver.network.SystemMessageId; import org.l2jmobius.gameserver.network.SystemMessageId;
import org.l2jmobius.gameserver.network.serverpackets.CreatureSay; import org.l2jmobius.gameserver.network.serverpackets.CreatureSay;
import org.l2jmobius.gameserver.network.serverpackets.SystemMessage; import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
@@ -40,7 +42,7 @@ public class ChatTrade implements IChatHandler
}; };
@Override @Override
public void handleChat(ChatType type, Player activeChar, String target, String text) public void handleChat(ChatType type, Player activeChar, String target, String text, boolean shareLocation)
{ {
if (activeChar.isChatBanned() && Config.BAN_CHAT_CHANNELS.contains(type)) if (activeChar.isChatBanned() && Config.BAN_CHAT_CHANNELS.contains(type))
{ {
@@ -58,7 +60,24 @@ public class ChatTrade implements IChatHandler
return; return;
} }
final CreatureSay cs = new CreatureSay(activeChar, type, activeChar.getName(), text); if (shareLocation)
{
if (activeChar.getInventory().getInventoryItemCount(Inventory.LCOIN_ID, -1) < Config.SHARING_LOCATION_COST)
{
activeChar.sendPacket(SystemMessageId.THERE_ARE_NOT_ENOUGH_L_COINS);
return;
}
if ((activeChar.getMovieHolder() != null) || activeChar.isFishing() || activeChar.isInInstance() || activeChar.isOnEvent() || activeChar.isInOlympiadMode() || activeChar.inObserverMode() || activeChar.isInTraingCamp() || activeChar.isInTimedHuntingZone() || activeChar.isInsideZone(ZoneId.SIEGE))
{
activeChar.sendPacket(SystemMessageId.LOCATION_CANNOT_BE_SHARED_SINCE_THE_CONDITIONS_ARE_NOT_MET);
return;
}
activeChar.destroyItemByItemId("Shared Location", Inventory.LCOIN_ID, Config.SHARING_LOCATION_COST, activeChar, true);
}
final CreatureSay cs = new CreatureSay(activeChar, type, activeChar.getName(), text, shareLocation);
if (Config.DEFAULT_TRADE_CHAT.equalsIgnoreCase("on") || (Config.DEFAULT_TRADE_CHAT.equalsIgnoreCase("gm") && activeChar.canOverrideCond(PlayerCondOverride.CHAT_CONDITIONS))) if (Config.DEFAULT_TRADE_CHAT.equalsIgnoreCase("on") || (Config.DEFAULT_TRADE_CHAT.equalsIgnoreCase("gm") && activeChar.canOverrideCond(PlayerCondOverride.CHAT_CONDITIONS)))
{ {
final int region = MapRegionManager.getInstance().getMapRegionLocId(activeChar); final int region = MapRegionManager.getInstance().getMapRegionLocId(activeChar);
@@ -41,7 +41,7 @@ public class ChatWhisper implements IChatHandler
}; };
@Override @Override
public void handleChat(ChatType type, Player activeChar, String target, String text) public void handleChat(ChatType type, Player activeChar, String target, String text, boolean shareLocation)
{ {
if (activeChar.isChatBanned() && Config.BAN_CHAT_CHANNELS.contains(type)) if (activeChar.isChatBanned() && Config.BAN_CHAT_CHANNELS.contains(type))
{ {
@@ -27,6 +27,8 @@ import org.l2jmobius.gameserver.enums.PlayerCondOverride;
import org.l2jmobius.gameserver.handler.IChatHandler; import org.l2jmobius.gameserver.handler.IChatHandler;
import org.l2jmobius.gameserver.model.World; import org.l2jmobius.gameserver.model.World;
import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.itemcontainer.Inventory;
import org.l2jmobius.gameserver.model.zone.ZoneId;
import org.l2jmobius.gameserver.network.SystemMessageId; import org.l2jmobius.gameserver.network.SystemMessageId;
import org.l2jmobius.gameserver.network.serverpackets.CreatureSay; import org.l2jmobius.gameserver.network.serverpackets.CreatureSay;
import org.l2jmobius.gameserver.network.serverpackets.ExWorldChatCnt; import org.l2jmobius.gameserver.network.serverpackets.ExWorldChatCnt;
@@ -46,7 +48,7 @@ public class ChatWorld implements IChatHandler
}; };
@Override @Override
public void handleChat(ChatType type, Player activeChar, String target, String text) public void handleChat(ChatType type, Player activeChar, String target, String text, boolean shareLocation)
{ {
if (!Config.ENABLE_WORLD_CHAT) if (!Config.ENABLE_WORLD_CHAT)
{ {
@@ -77,6 +79,14 @@ public class ChatWorld implements IChatHandler
{ {
activeChar.sendPacket(SystemMessageId.YOU_HAVE_SPENT_YOUR_WORLD_CHAT_QUOTA_FOR_THE_DAY_IT_IS_RESET_DAILY_AT_7_A_M); activeChar.sendPacket(SystemMessageId.YOU_HAVE_SPENT_YOUR_WORLD_CHAT_QUOTA_FOR_THE_DAY_IT_IS_RESET_DAILY_AT_7_A_M);
} }
else if (shareLocation && (activeChar.getInventory().getInventoryItemCount(Inventory.LCOIN_ID, -1) < Config.SHARING_LOCATION_COST))
{
activeChar.sendPacket(SystemMessageId.THERE_ARE_NOT_ENOUGH_L_COINS);
}
else if (shareLocation && ((activeChar.getMovieHolder() != null) || activeChar.isFishing() || activeChar.isInInstance() || activeChar.isOnEvent() || activeChar.isInOlympiadMode() || activeChar.inObserverMode() || activeChar.isInTraingCamp() || activeChar.isInTimedHuntingZone() || activeChar.isInsideZone(ZoneId.SIEGE)))
{
activeChar.sendPacket(SystemMessageId.LOCATION_CANNOT_BE_SHARED_SINCE_THE_CONDITIONS_ARE_NOT_MET);
}
else else
{ {
// Verify if player is not spaming. // Verify if player is not spaming.
@@ -93,7 +103,12 @@ public class ChatWorld implements IChatHandler
} }
} }
final CreatureSay cs = new CreatureSay(activeChar, type, activeChar.getName(), text); if (shareLocation)
{
activeChar.destroyItemByItemId("Shared Location", Inventory.LCOIN_ID, Config.SHARING_LOCATION_COST, activeChar, true);
}
final CreatureSay cs = new CreatureSay(activeChar, type, activeChar.getName(), text, shareLocation);
if (Config.FACTION_SYSTEM_ENABLED && Config.FACTION_SPECIFIC_CHAT) if (Config.FACTION_SYSTEM_ENABLED && Config.FACTION_SPECIFIC_CHAT)
{ {
if (activeChar.isGood()) if (activeChar.isGood())
@@ -2180,8 +2180,8 @@ public class Config
ENABLE_AUTO_ITEM = generalConfig.getBoolean("EnableAutoItem", true); ENABLE_AUTO_ITEM = generalConfig.getBoolean("EnableAutoItem", true);
AUTO_PLAY_ATTACK_ACTION = generalConfig.getBoolean("AutoPlayAttackAction", true); AUTO_PLAY_ATTACK_ACTION = generalConfig.getBoolean("AutoPlayAttackAction", true);
RESUME_AUTO_PLAY = generalConfig.getBoolean("ResumeAutoPlay", false); RESUME_AUTO_PLAY = generalConfig.getBoolean("ResumeAutoPlay", false);
SHARING_LOCATION_COST = generalConfig.getInt("ShareLocationLcoinCost", 1); SHARING_LOCATION_COST = generalConfig.getInt("ShareLocationLcoinCost", 50);
TELEPORT_SHARE_LOCATION_COST = generalConfig.getInt("TeleportShareLocationLcoinCost", 1); TELEPORT_SHARE_LOCATION_COST = generalConfig.getInt("TeleportShareLocationLcoinCost", 400);
// Load FloodProtector config file // Load FloodProtector config file
final PropertiesParser floodProtectorConfig = new PropertiesParser(FLOOD_PROTECTOR_CONFIG_FILE); final PropertiesParser floodProtectorConfig = new PropertiesParser(FLOOD_PROTECTOR_CONFIG_FILE);
@@ -139,7 +139,6 @@ import org.l2jmobius.gameserver.instancemanager.InstanceManager;
import org.l2jmobius.gameserver.instancemanager.ItemAuctionManager; import org.l2jmobius.gameserver.instancemanager.ItemAuctionManager;
import org.l2jmobius.gameserver.instancemanager.ItemCommissionManager; import org.l2jmobius.gameserver.instancemanager.ItemCommissionManager;
import org.l2jmobius.gameserver.instancemanager.ItemsOnGroundManager; import org.l2jmobius.gameserver.instancemanager.ItemsOnGroundManager;
import org.l2jmobius.gameserver.instancemanager.RankingPowerManager;
import org.l2jmobius.gameserver.instancemanager.MailManager; import org.l2jmobius.gameserver.instancemanager.MailManager;
import org.l2jmobius.gameserver.instancemanager.MapRegionManager; import org.l2jmobius.gameserver.instancemanager.MapRegionManager;
import org.l2jmobius.gameserver.instancemanager.MatchingRoomManager; import org.l2jmobius.gameserver.instancemanager.MatchingRoomManager;
@@ -151,8 +150,10 @@ import org.l2jmobius.gameserver.instancemanager.PremiumManager;
import org.l2jmobius.gameserver.instancemanager.PunishmentManager; import org.l2jmobius.gameserver.instancemanager.PunishmentManager;
import org.l2jmobius.gameserver.instancemanager.QuestManager; import org.l2jmobius.gameserver.instancemanager.QuestManager;
import org.l2jmobius.gameserver.instancemanager.RankManager; import org.l2jmobius.gameserver.instancemanager.RankManager;
import org.l2jmobius.gameserver.instancemanager.RankingPowerManager;
import org.l2jmobius.gameserver.instancemanager.SellBuffsManager; import org.l2jmobius.gameserver.instancemanager.SellBuffsManager;
import org.l2jmobius.gameserver.instancemanager.ServerRestartManager; import org.l2jmobius.gameserver.instancemanager.ServerRestartManager;
import org.l2jmobius.gameserver.instancemanager.SharedTeleportManager;
import org.l2jmobius.gameserver.instancemanager.SiegeGuardManager; import org.l2jmobius.gameserver.instancemanager.SiegeGuardManager;
import org.l2jmobius.gameserver.instancemanager.SiegeManager; import org.l2jmobius.gameserver.instancemanager.SiegeManager;
import org.l2jmobius.gameserver.instancemanager.WalkingManager; import org.l2jmobius.gameserver.instancemanager.WalkingManager;
@@ -369,6 +370,7 @@ public class GameServer
HtmCache.getInstance(); HtmCache.getInstance();
CrestTable.getInstance(); CrestTable.getInstance();
TeleportListData.getInstance(); TeleportListData.getInstance();
SharedTeleportManager.getInstance();
PetTypesListData.getInstance(); PetTypesListData.getInstance();
TeleporterData.getInstance(); TeleporterData.getInstance();
TimedHuntingZoneData.getInstance(); TimedHuntingZoneData.getInstance();
@@ -31,8 +31,9 @@ public interface IChatHandler
* @param player * @param player
* @param target * @param target
* @param text * @param text
* @param shareLocation
*/ */
void handleChat(ChatType type, Player player, String target, String text); void handleChat(ChatType type, Player player, String target, String text, boolean shareLocation);
/** /**
* Returns a list of all chat types registered to this handler * Returns a list of all chat types registered to this handler
@@ -0,0 +1,69 @@
/*
* 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.instancemanager;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.logging.Logger;
import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.holders.SharedTeleportHolder;
/**
* Shared Teleport Manager
* @author NasSeKa
*/
public class SharedTeleportManager
{
protected static final Logger LOGGER = Logger.getLogger(SharedTeleportManager.class.getName());
private static final int TELEPORT_COUNT = 5;
private final Map<Integer, SharedTeleportHolder> _sharedTeleports = new ConcurrentHashMap<>();
private int _lastSharedTeleportId = 0;
protected SharedTeleportManager()
{
LOGGER.info(getClass().getSimpleName() + ": initialized.");
}
public SharedTeleportHolder getTeleport(int id)
{
return _sharedTeleports.get(id);
}
public synchronized int nextId(Creature creature)
{
final int nextId = ++_lastSharedTeleportId;
_sharedTeleports.put(nextId, new SharedTeleportHolder(nextId, creature.getName(), TELEPORT_COUNT, creature.getX(), creature.getY(), creature.getZ()));
return nextId;
}
/**
* Gets the single instance of {@code SharedTeleportManager}.
* @return single instance of {@code SharedTeleportManager}
*/
public static SharedTeleportManager getInstance()
{
return SingletonHolder.INSTANCE;
}
private static class SingletonHolder
{
protected static final SharedTeleportManager INSTANCE = new SharedTeleportManager();
}
}
@@ -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 org.l2jmobius.gameserver.model.holders;
import org.l2jmobius.gameserver.model.Location;
/**
* @author NasSeKa
*/
public class SharedTeleportHolder
{
private final int _id;
private final String _name;
private int _count;
private final Location _location;
public SharedTeleportHolder(int id, String name, int count, int x, int y, int z)
{
_id = id;
_name = name;
_count = count;
_location = new Location(x, y, z);
}
public int getId()
{
return _id;
}
public String getName()
{
return _name;
}
public int getCount()
{
return Math.max(0, _count);
}
public void decrementCount()
{
_count -= 1;
}
public Location getLocation()
{
return _location;
}
}
@@ -139,6 +139,7 @@ import org.l2jmobius.gameserver.network.clientpackets.shuttle.RequestShuttleGetO
import org.l2jmobius.gameserver.network.clientpackets.shuttle.RequestShuttleGetOn; import org.l2jmobius.gameserver.network.clientpackets.shuttle.RequestShuttleGetOn;
import org.l2jmobius.gameserver.network.clientpackets.stats.ExResetStatusBonus; import org.l2jmobius.gameserver.network.clientpackets.stats.ExResetStatusBonus;
import org.l2jmobius.gameserver.network.clientpackets.stats.ExSetStatusBonus; import org.l2jmobius.gameserver.network.clientpackets.stats.ExSetStatusBonus;
import org.l2jmobius.gameserver.network.clientpackets.teleports.ExRequestSharedLocationTeleport;
import org.l2jmobius.gameserver.network.clientpackets.teleports.ExRequestSharedLocationTeleportUi; import org.l2jmobius.gameserver.network.clientpackets.teleports.ExRequestSharedLocationTeleportUi;
import org.l2jmobius.gameserver.network.clientpackets.teleports.ExRequestSharingLocationUi; import org.l2jmobius.gameserver.network.clientpackets.teleports.ExRequestSharingLocationUi;
import org.l2jmobius.gameserver.network.clientpackets.teleports.ExRequestTeleport; import org.l2jmobius.gameserver.network.clientpackets.teleports.ExRequestTeleport;
@@ -577,7 +578,7 @@ public enum ExIncomingPackets implements IIncomingPackets<GameClient>
// 270 // 270
EX_SHARED_POSITION_SHARING_UI(0x1A1, ExRequestSharingLocationUi::new, ConnectionState.IN_GAME), EX_SHARED_POSITION_SHARING_UI(0x1A1, ExRequestSharingLocationUi::new, ConnectionState.IN_GAME),
EX_SHARED_POSITION_TELEPORT_UI(0x1A2, ExRequestSharedLocationTeleportUi::new, ConnectionState.IN_GAME), EX_SHARED_POSITION_TELEPORT_UI(0x1A2, ExRequestSharedLocationTeleportUi::new, ConnectionState.IN_GAME),
EX_SHARED_POSITION_TELEPORT(0x1A3, ExRequestSharedLocationTeleportUi::new, ConnectionState.IN_GAME), EX_SHARED_POSITION_TELEPORT(0x1A3, ExRequestSharedLocationTeleport::new, ConnectionState.IN_GAME),
EX_AUTH_RECONNECT(0x1A4, null, ConnectionState.IN_GAME), EX_AUTH_RECONNECT(0x1A4, null, ConnectionState.IN_GAME),
EX_PET_EQUIP_ITEM(0x1A5, ExPetEquipItem::new, ConnectionState.IN_GAME), EX_PET_EQUIP_ITEM(0x1A5, ExPetEquipItem::new, ConnectionState.IN_GAME),
EX_PET_UNEQUIP_ITEM(0x1A6, ExPetUnequipItem::new, ConnectionState.IN_GAME), EX_PET_UNEQUIP_ITEM(0x1A6, ExPetUnequipItem::new, ConnectionState.IN_GAME),
@@ -88,16 +88,18 @@ public class Say2 implements IClientIncomingPacket
private String _text; private String _text;
private int _type; private int _type;
private String _target; private String _target;
private boolean _shareLocation;
@Override @Override
public boolean read(GameClient client, PacketReader packet) public boolean read(GameClient client, PacketReader packet)
{ {
_text = packet.readS(); _text = packet.readS();
_type = packet.readD(); _type = packet.readD();
_shareLocation = packet.readC() == 1;
if (_type == ChatType.WHISPER.getClientId()) if (_type == ChatType.WHISPER.getClientId())
{ {
packet.readC();
_target = packet.readS(); _target = packet.readS();
_shareLocation = false;
} }
return true; return true;
} }
@@ -215,7 +217,7 @@ public class Say2 implements IClientIncomingPacket
final IChatHandler handler = ChatHandler.getInstance().getHandler(chatType); final IChatHandler handler = ChatHandler.getInstance().getHandler(chatType);
if (handler != null) if (handler != null)
{ {
handler.handleChat(chatType, player, _target, _text); handler.handleChat(chatType, player, _target, _text, _shareLocation);
} }
else else
{ {
@@ -0,0 +1,86 @@
/*
* 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.teleports;
import org.l2jmobius.Config;
import org.l2jmobius.commons.network.PacketReader;
import org.l2jmobius.gameserver.instancemanager.SharedTeleportManager;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.holders.SharedTeleportHolder;
import org.l2jmobius.gameserver.model.itemcontainer.Inventory;
import org.l2jmobius.gameserver.model.zone.ZoneId;
import org.l2jmobius.gameserver.network.GameClient;
import org.l2jmobius.gameserver.network.SystemMessageId;
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
/**
* @author NasSeKa
*/
public class ExRequestSharedLocationTeleport implements IClientIncomingPacket
{
private int _id;
@Override
public boolean read(GameClient client, PacketReader packet)
{
_id = (packet.readD() - 1) / 256;
return true;
}
@Override
public void run(GameClient client)
{
final Player player = client.getPlayer();
if (player == null)
{
return;
}
final SharedTeleportHolder teleport = SharedTeleportManager.getInstance().getTeleport(_id);
if ((teleport == null) || (teleport.getCount() == 0))
{
player.sendPacket(SystemMessageId.TELEPORTATION_LIMIT_FOR_THE_COORDINATES_RECEIVED_IS_REACHED);
return;
}
if (player.getName().equals(teleport.getName()))
{
player.sendPacket(SystemMessageId.YOU_CAN_T_TELEPORT_HERE_FROM_THIS_CLIENT);
return;
}
if (player.getInventory().getInventoryItemCount(Inventory.LCOIN_ID, -1) < Config.TELEPORT_SHARE_LOCATION_COST)
{
player.sendPacket(SystemMessageId.THERE_ARE_NOT_ENOUGH_L_COINS);
return;
}
if ((player.getMovieHolder() != null) || player.isFishing() || player.isInInstance() || player.isOnEvent() || player.isInOlympiadMode() || player.inObserverMode() || player.isInTraingCamp() || player.isInTimedHuntingZone() || player.isInsideZone(ZoneId.SIEGE))
{
player.sendPacket(SystemMessageId.YOU_CANNOT_TELEPORT_RIGHT_NOW);
return;
}
if (player.destroyItemByItemId("Shared Location", Inventory.LCOIN_ID, Config.TELEPORT_SHARE_LOCATION_COST, player, true))
{
teleport.decrementCount();
player.abortCast();
player.stopMove(null);
player.teleToLocation(teleport.getLocation());
}
}
}
@@ -17,19 +17,24 @@
package org.l2jmobius.gameserver.network.clientpackets.teleports; package org.l2jmobius.gameserver.network.clientpackets.teleports;
import org.l2jmobius.commons.network.PacketReader; import org.l2jmobius.commons.network.PacketReader;
import org.l2jmobius.gameserver.instancemanager.SharedTeleportManager;
import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.holders.SharedTeleportHolder;
import org.l2jmobius.gameserver.network.GameClient; import org.l2jmobius.gameserver.network.GameClient;
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket; import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
import org.l2jmobius.gameserver.network.serverpackets.teleports.ExShowSharedLocationTeleportUi; import org.l2jmobius.gameserver.network.serverpackets.teleports.ExShowSharedLocationTeleportUi;
/** /**
* @author GustavoFonseca * @author NasSeKa
*/ */
public class ExRequestSharedLocationTeleportUi implements IClientIncomingPacket public class ExRequestSharedLocationTeleportUi implements IClientIncomingPacket
{ {
private int _id;
@Override @Override
public boolean read(GameClient client, PacketReader packet) public boolean read(GameClient client, PacketReader packet)
{ {
_id = (packet.readD() - 1) / 256;
return true; return true;
} }
@@ -42,6 +47,12 @@ public class ExRequestSharedLocationTeleportUi implements IClientIncomingPacket
return; return;
} }
client.sendPacket(new ExShowSharedLocationTeleportUi()); final SharedTeleportHolder teleport = SharedTeleportManager.getInstance().getTeleport(_id);
if (teleport == null)
{
return;
}
player.sendPacket(new ExShowSharedLocationTeleportUi(teleport));
} }
} }
@@ -42,6 +42,6 @@ public class ExRequestSharingLocationUi implements IClientIncomingPacket
return; return;
} }
client.sendPacket(new ExShowSharingLocationUi()); player.sendPacket(new ExShowSharingLocationUi());
} }
} }
@@ -23,6 +23,7 @@ import org.l2jmobius.commons.network.PacketWriter;
import org.l2jmobius.gameserver.enums.ChatType; import org.l2jmobius.gameserver.enums.ChatType;
import org.l2jmobius.gameserver.instancemanager.MentorManager; import org.l2jmobius.gameserver.instancemanager.MentorManager;
import org.l2jmobius.gameserver.instancemanager.RankManager; import org.l2jmobius.gameserver.instancemanager.RankManager;
import org.l2jmobius.gameserver.instancemanager.SharedTeleportManager;
import org.l2jmobius.gameserver.model.actor.Creature; import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.clan.Clan; import org.l2jmobius.gameserver.model.clan.Clan;
@@ -40,6 +41,7 @@ public class CreatureSay implements IClientOutgoingPacket
private int _messageId = -1; private int _messageId = -1;
private int _mask; private int _mask;
private List<String> _parameters; private List<String> _parameters;
private boolean _shareLocation;
/** /**
* @param sender * @param sender
@@ -49,11 +51,25 @@ public class CreatureSay implements IClientOutgoingPacket
* @param text * @param text
*/ */
public CreatureSay(Player sender, Player receiver, String name, ChatType chatType, String text) public CreatureSay(Player sender, Player receiver, String name, ChatType chatType, String text)
{
this(sender, receiver, name, chatType, text, false);
}
/**
* @param sender
* @param receiver
* @param name
* @param chatType
* @param text
* @param shareLocation
*/
public CreatureSay(Player sender, Player receiver, String name, ChatType chatType, String text, boolean shareLocation)
{ {
_sender = sender; _sender = sender;
_senderName = name; _senderName = name;
_chatType = chatType; _chatType = chatType;
_text = text; _text = text;
_shareLocation = shareLocation;
if (receiver != null) if (receiver != null)
{ {
if (receiver.getFriendList().contains(sender.getObjectId())) if (receiver.getFriendList().contains(sender.getObjectId()))
@@ -81,11 +97,17 @@ public class CreatureSay implements IClientOutgoingPacket
} }
public CreatureSay(Creature sender, ChatType chatType, String senderName, String text) public CreatureSay(Creature sender, ChatType chatType, String senderName, String text)
{
this(sender, chatType, senderName, text, false);
}
public CreatureSay(Creature sender, ChatType chatType, String senderName, String text, boolean shareLocation)
{ {
_sender = sender; _sender = sender;
_chatType = chatType; _chatType = chatType;
_senderName = senderName; _senderName = senderName;
_text = text; _text = text;
_shareLocation = shareLocation;
} }
public CreatureSay(Creature sender, ChatType chatType, NpcStringId npcStringId) public CreatureSay(Creature sender, ChatType chatType, NpcStringId npcStringId)
@@ -162,6 +184,7 @@ public class CreatureSay implements IClientOutgoingPacket
{ {
packet.writeC(0); // unknown clan byte packet.writeC(0); // unknown clan byte
} }
final int rank = RankManager.getInstance().getPlayerGlobalRank(_sender.getActingPlayer()); final int rank = RankManager.getInstance().getPlayerGlobalRank(_sender.getActingPlayer());
if ((rank == 0) || (rank > 100)) if ((rank == 0) || (rank > 100))
{ {
@@ -187,6 +210,12 @@ public class CreatureSay implements IClientOutgoingPacket
{ {
packet.writeC(0); packet.writeC(0);
} }
if (_shareLocation)
{
packet.writeC(1);
packet.writeH(SharedTeleportManager.getInstance().nextId(_sender));
}
} }
else else
{ {
@@ -100,7 +100,7 @@ public class ExBasicActionList implements IClientOutgoingPacket
81, 82, 83, 84, 81, 82, 83, 84,
85, 86, 87, 88, 85, 86, 87, 88,
89, 90, 92, 93, 89, 90, 92, 93,
94, 96, 97, 94, 96, 97, 99,
1000, 1001, 1000, 1001,
1002, 1003, 1004, 1005, 1002, 1003, 1004, 1005,
1006, 1007, 1008, 1009, 1006, 1007, 1008, 1009,
@@ -17,24 +17,33 @@
package org.l2jmobius.gameserver.network.serverpackets.teleports; package org.l2jmobius.gameserver.network.serverpackets.teleports;
import org.l2jmobius.commons.network.PacketWriter; import org.l2jmobius.commons.network.PacketWriter;
import org.l2jmobius.gameserver.model.holders.SharedTeleportHolder;
import org.l2jmobius.gameserver.network.OutgoingPackets; import org.l2jmobius.gameserver.network.OutgoingPackets;
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket; import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
/** /**
* @author Gustavo Fonseca * @author NasSeKa
*/ */
public class ExShowSharedLocationTeleportUi implements IClientOutgoingPacket public class ExShowSharedLocationTeleportUi implements IClientOutgoingPacket
{ {
public static final ExShowSharedLocationTeleportUi STATIC_PACKET = new ExShowSharedLocationTeleportUi(); private final SharedTeleportHolder _teleport;
public ExShowSharedLocationTeleportUi() public ExShowSharedLocationTeleportUi(SharedTeleportHolder teleport)
{ {
_teleport = teleport;
} }
@Override @Override
public boolean write(PacketWriter packet) public boolean write(PacketWriter packet)
{ {
OutgoingPackets.EX_SHARED_POSITION_TELEPORT_UI.writeId(packet); OutgoingPackets.EX_SHARED_POSITION_TELEPORT_UI.writeId(packet);
packet.writeString(_teleport.getName());
packet.writeD(_teleport.getId());
packet.writeD(_teleport.getCount());
packet.writeH(150);
packet.writeD(_teleport.getLocation().getX());
packet.writeD(_teleport.getLocation().getY());
packet.writeD(_teleport.getLocation().getZ());
return true; return true;
} }
} }
@@ -685,7 +685,7 @@ SubjugationTopicBody = Reward for being in the top of the best players in cleari
Share loction L-Coin cost. Share loction L-Coin cost.
# Default: 50 # Default: 50
ShareLocationLcoinCost = 1000 ShareLocationLcoinCost = 50
# Teleport share location L-Coin cost. # Teleport share location L-Coin cost.
# Default: 400 # Default: 400
@@ -21,6 +21,8 @@ import org.l2jmobius.gameserver.enums.ChatType;
import org.l2jmobius.gameserver.enums.PlayerCondOverride; import org.l2jmobius.gameserver.enums.PlayerCondOverride;
import org.l2jmobius.gameserver.handler.IChatHandler; import org.l2jmobius.gameserver.handler.IChatHandler;
import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.itemcontainer.Inventory;
import org.l2jmobius.gameserver.model.zone.ZoneId;
import org.l2jmobius.gameserver.network.SystemMessageId; import org.l2jmobius.gameserver.network.SystemMessageId;
import org.l2jmobius.gameserver.network.serverpackets.CreatureSay; import org.l2jmobius.gameserver.network.serverpackets.CreatureSay;
@@ -35,7 +37,7 @@ public class ChatAlliance implements IChatHandler
}; };
@Override @Override
public void handleChat(ChatType type, Player activeChar, String target, String text) public void handleChat(ChatType type, Player activeChar, String target, String text, boolean shareLocation)
{ {
if ((activeChar.getClan() == null) || ((activeChar.getClan() != null) && (activeChar.getClan().getAllyId() == 0))) if ((activeChar.getClan() == null) || ((activeChar.getClan() != null) && (activeChar.getClan().getAllyId() == 0)))
{ {
@@ -53,7 +55,25 @@ public class ChatAlliance implements IChatHandler
activeChar.sendPacket(SystemMessageId.CHATTING_IS_CURRENTLY_PROHIBITED); activeChar.sendPacket(SystemMessageId.CHATTING_IS_CURRENTLY_PROHIBITED);
return; return;
} }
activeChar.getClan().broadcastToOnlineAllyMembers(new CreatureSay(activeChar, type, activeChar.getName(), text));
if (shareLocation)
{
if (activeChar.getInventory().getInventoryItemCount(Inventory.LCOIN_ID, -1) < Config.SHARING_LOCATION_COST)
{
activeChar.sendPacket(SystemMessageId.THERE_ARE_NOT_ENOUGH_L_COINS);
return;
}
if ((activeChar.getMovieHolder() != null) || activeChar.isFishing() || activeChar.isInInstance() || activeChar.isOnEvent() || activeChar.isInOlympiadMode() || activeChar.inObserverMode() || activeChar.isInTraingCamp() || activeChar.isInTimedHuntingZone() || activeChar.isInsideZone(ZoneId.SIEGE))
{
activeChar.sendPacket(SystemMessageId.LOCATION_CANNOT_BE_SHARED_SINCE_THE_CONDITIONS_ARE_NOT_MET);
return;
}
activeChar.destroyItemByItemId("Shared Location", Inventory.LCOIN_ID, Config.SHARING_LOCATION_COST, activeChar, true);
}
activeChar.getClan().broadcastToOnlineAllyMembers(new CreatureSay(activeChar, type, activeChar.getName(), text, shareLocation));
} }
@Override @Override
@@ -21,6 +21,8 @@ import org.l2jmobius.gameserver.enums.ChatType;
import org.l2jmobius.gameserver.enums.PlayerCondOverride; import org.l2jmobius.gameserver.enums.PlayerCondOverride;
import org.l2jmobius.gameserver.handler.IChatHandler; import org.l2jmobius.gameserver.handler.IChatHandler;
import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.itemcontainer.Inventory;
import org.l2jmobius.gameserver.model.zone.ZoneId;
import org.l2jmobius.gameserver.network.SystemMessageId; import org.l2jmobius.gameserver.network.SystemMessageId;
import org.l2jmobius.gameserver.network.serverpackets.CreatureSay; import org.l2jmobius.gameserver.network.serverpackets.CreatureSay;
@@ -36,7 +38,7 @@ public class ChatClan implements IChatHandler
}; };
@Override @Override
public void handleChat(ChatType type, Player activeChar, String target, String text) public void handleChat(ChatType type, Player activeChar, String target, String text, boolean shareLocation)
{ {
if (activeChar.getClan() == null) if (activeChar.getClan() == null)
{ {
@@ -54,7 +56,25 @@ public class ChatClan implements IChatHandler
activeChar.sendPacket(SystemMessageId.CHATTING_IS_CURRENTLY_PROHIBITED); activeChar.sendPacket(SystemMessageId.CHATTING_IS_CURRENTLY_PROHIBITED);
return; return;
} }
activeChar.getClan().broadcastCSToOnlineMembers(new CreatureSay(activeChar, type, activeChar.getName(), text), activeChar);
if (shareLocation)
{
if (activeChar.getInventory().getInventoryItemCount(Inventory.LCOIN_ID, -1) < Config.SHARING_LOCATION_COST)
{
activeChar.sendPacket(SystemMessageId.THERE_ARE_NOT_ENOUGH_L_COINS);
return;
}
if ((activeChar.getMovieHolder() != null) || activeChar.isFishing() || activeChar.isInInstance() || activeChar.isOnEvent() || activeChar.isInOlympiadMode() || activeChar.inObserverMode() || activeChar.isInTraingCamp() || activeChar.isInTimedHuntingZone() || activeChar.isInsideZone(ZoneId.SIEGE))
{
activeChar.sendPacket(SystemMessageId.LOCATION_CANNOT_BE_SHARED_SINCE_THE_CONDITIONS_ARE_NOT_MET);
return;
}
activeChar.destroyItemByItemId("Shared Location", Inventory.LCOIN_ID, Config.SHARING_LOCATION_COST, activeChar, true);
}
activeChar.getClan().broadcastCSToOnlineMembers(new CreatureSay(activeChar, type, activeChar.getName(), text, shareLocation), activeChar);
} }
@Override @Override
@@ -27,6 +27,8 @@ import org.l2jmobius.gameserver.handler.VoicedCommandHandler;
import org.l2jmobius.gameserver.model.BlockList; import org.l2jmobius.gameserver.model.BlockList;
import org.l2jmobius.gameserver.model.World; import org.l2jmobius.gameserver.model.World;
import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.itemcontainer.Inventory;
import org.l2jmobius.gameserver.model.zone.ZoneId;
import org.l2jmobius.gameserver.network.SystemMessageId; import org.l2jmobius.gameserver.network.SystemMessageId;
import org.l2jmobius.gameserver.network.serverpackets.CreatureSay; import org.l2jmobius.gameserver.network.serverpackets.CreatureSay;
import org.l2jmobius.gameserver.network.serverpackets.SystemMessage; import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
@@ -43,7 +45,7 @@ public class ChatGeneral implements IChatHandler
}; };
@Override @Override
public void handleChat(ChatType type, Player activeChar, String paramsValue, String text) public void handleChat(ChatType type, Player activeChar, String paramsValue, String text, boolean shareLocation)
{ {
boolean vcdUsed = false; boolean vcdUsed = false;
if (text.startsWith(".")) if (text.startsWith("."))
@@ -87,8 +89,26 @@ public class ChatGeneral implements IChatHandler
return; return;
} }
final CreatureSay cs = new CreatureSay(activeChar, type, activeChar.getAppearance().getVisibleName(), text); if (shareLocation)
final CreatureSay csRandom = new CreatureSay(activeChar, type, activeChar.getAppearance().getVisibleName(), ChatRandomizer.randomize(text)); {
if (activeChar.getInventory().getInventoryItemCount(Inventory.LCOIN_ID, -1) < Config.SHARING_LOCATION_COST)
{
activeChar.sendPacket(SystemMessageId.THERE_ARE_NOT_ENOUGH_L_COINS);
return;
}
if ((activeChar.getMovieHolder() != null) || activeChar.isFishing() || activeChar.isInInstance() || activeChar.isOnEvent() || activeChar.isInOlympiadMode() || activeChar.inObserverMode() || activeChar.isInTraingCamp() || activeChar.isInTimedHuntingZone() || activeChar.isInsideZone(ZoneId.SIEGE))
{
activeChar.sendPacket(SystemMessageId.LOCATION_CANNOT_BE_SHARED_SINCE_THE_CONDITIONS_ARE_NOT_MET);
return;
}
activeChar.destroyItemByItemId("Shared Location", Inventory.LCOIN_ID, Config.SHARING_LOCATION_COST, activeChar, true);
}
final CreatureSay cs = new CreatureSay(activeChar, type, activeChar.getAppearance().getVisibleName(), text, shareLocation);
final CreatureSay csRandom = new CreatureSay(activeChar, type, activeChar.getAppearance().getVisibleName(), ChatRandomizer.randomize(text), shareLocation);
World.getInstance().forEachVisibleObjectInRange(activeChar, Player.class, 1250, player -> World.getInstance().forEachVisibleObjectInRange(activeChar, Player.class, 1250, player ->
{ {
if ((player != null) && !BlockList.isBlocked(player, activeChar)) if ((player != null) && !BlockList.isBlocked(player, activeChar))
@@ -38,7 +38,7 @@ public class ChatHeroVoice implements IChatHandler
}; };
@Override @Override
public void handleChat(ChatType type, Player activeChar, String target, String text) public void handleChat(ChatType type, Player activeChar, String target, String text, boolean shareLocation)
{ {
if (!activeChar.isHero() && !activeChar.canOverrideCond(PlayerCondOverride.CHAT_CONDITIONS)) if (!activeChar.isHero() && !activeChar.canOverrideCond(PlayerCondOverride.CHAT_CONDITIONS))
{ {
@@ -62,7 +62,7 @@ public class ChatHeroVoice implements IChatHandler
return; return;
} }
final CreatureSay cs = new CreatureSay(activeChar, type, activeChar.getName(), text); final CreatureSay cs = new CreatureSay(activeChar, type, activeChar.getName(), text, shareLocation);
for (Player player : World.getInstance().getPlayers()) for (Player player : World.getInstance().getPlayers())
{ {
if ((player != null) && !BlockList.isBlocked(player, activeChar)) if ((player != null) && !BlockList.isBlocked(player, activeChar))
@@ -21,6 +21,8 @@ import org.l2jmobius.gameserver.enums.ChatType;
import org.l2jmobius.gameserver.enums.PlayerCondOverride; import org.l2jmobius.gameserver.enums.PlayerCondOverride;
import org.l2jmobius.gameserver.handler.IChatHandler; import org.l2jmobius.gameserver.handler.IChatHandler;
import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.itemcontainer.Inventory;
import org.l2jmobius.gameserver.model.zone.ZoneId;
import org.l2jmobius.gameserver.network.SystemMessageId; import org.l2jmobius.gameserver.network.SystemMessageId;
import org.l2jmobius.gameserver.network.serverpackets.CreatureSay; import org.l2jmobius.gameserver.network.serverpackets.CreatureSay;
@@ -36,7 +38,7 @@ public class ChatParty implements IChatHandler
}; };
@Override @Override
public void handleChat(ChatType type, Player activeChar, String target, String text) public void handleChat(ChatType type, Player activeChar, String target, String text, boolean shareLocation)
{ {
if (!activeChar.isInParty()) if (!activeChar.isInParty())
{ {
@@ -54,7 +56,25 @@ public class ChatParty implements IChatHandler
activeChar.sendPacket(SystemMessageId.CHATTING_IS_CURRENTLY_PROHIBITED); activeChar.sendPacket(SystemMessageId.CHATTING_IS_CURRENTLY_PROHIBITED);
return; return;
} }
activeChar.getParty().broadcastCreatureSay(new CreatureSay(activeChar, type, activeChar.getName(), text), activeChar);
if (shareLocation)
{
if (activeChar.getInventory().getInventoryItemCount(Inventory.LCOIN_ID, -1) < Config.SHARING_LOCATION_COST)
{
activeChar.sendPacket(SystemMessageId.THERE_ARE_NOT_ENOUGH_L_COINS);
return;
}
if ((activeChar.getMovieHolder() != null) || activeChar.isFishing() || activeChar.isInInstance() || activeChar.isOnEvent() || activeChar.isInOlympiadMode() || activeChar.inObserverMode() || activeChar.isInTraingCamp() || activeChar.isInTimedHuntingZone() || activeChar.isInsideZone(ZoneId.SIEGE))
{
activeChar.sendPacket(SystemMessageId.LOCATION_CANNOT_BE_SHARED_SINCE_THE_CONDITIONS_ARE_NOT_MET);
return;
}
activeChar.destroyItemByItemId("Shared Location", Inventory.LCOIN_ID, Config.SHARING_LOCATION_COST, activeChar, true);
}
activeChar.getParty().broadcastCreatureSay(new CreatureSay(activeChar, type, activeChar.getName(), text, shareLocation), activeChar);
} }
@Override @Override
@@ -37,7 +37,7 @@ public class ChatPartyMatchRoom implements IChatHandler
}; };
@Override @Override
public void handleChat(ChatType type, Player activeChar, String target, String text) public void handleChat(ChatType type, Player activeChar, String target, String text, boolean shareLocation)
{ {
final MatchingRoom room = activeChar.getMatchingRoom(); final MatchingRoom room = activeChar.getMatchingRoom();
if (room != null) if (room != null)
@@ -53,7 +53,7 @@ public class ChatPartyMatchRoom implements IChatHandler
return; return;
} }
final CreatureSay cs = new CreatureSay(activeChar, type, activeChar.getName(), text); final CreatureSay cs = new CreatureSay(activeChar, type, activeChar.getName(), text, shareLocation);
for (Player _member : room.getMembers()) for (Player _member : room.getMembers())
{ {
if (Config.FACTION_SYSTEM_ENABLED) if (Config.FACTION_SYSTEM_ENABLED)
@@ -36,7 +36,7 @@ public class ChatPartyRoomAll implements IChatHandler
}; };
@Override @Override
public void handleChat(ChatType type, Player activeChar, String target, String text) public void handleChat(ChatType type, Player activeChar, String target, String text, boolean shareLocation)
{ {
if (activeChar.isInParty() && activeChar.getParty().isInCommandChannel() && activeChar.getParty().isLeader(activeChar)) if (activeChar.isInParty() && activeChar.getParty().isInCommandChannel() && activeChar.getParty().isLeader(activeChar))
{ {
@@ -50,7 +50,7 @@ public class ChatPartyRoomAll implements IChatHandler
activeChar.sendPacket(SystemMessageId.CHATTING_IS_CURRENTLY_PROHIBITED); activeChar.sendPacket(SystemMessageId.CHATTING_IS_CURRENTLY_PROHIBITED);
return; return;
} }
activeChar.getParty().getCommandChannel().broadcastCreatureSay(new CreatureSay(activeChar, type, activeChar.getName(), text), activeChar); activeChar.getParty().getCommandChannel().broadcastCreatureSay(new CreatureSay(activeChar, type, activeChar.getName(), text, shareLocation), activeChar);
} }
} }
@@ -36,7 +36,7 @@ public class ChatPartyRoomCommander implements IChatHandler
}; };
@Override @Override
public void handleChat(ChatType type, Player activeChar, String target, String text) public void handleChat(ChatType type, Player activeChar, String target, String text, boolean shareLocation)
{ {
if (activeChar.isInParty() && activeChar.getParty().isInCommandChannel() && activeChar.getParty().getCommandChannel().getLeader().equals(activeChar)) if (activeChar.isInParty() && activeChar.getParty().isInCommandChannel() && activeChar.getParty().getCommandChannel().getLeader().equals(activeChar))
{ {
@@ -50,7 +50,7 @@ public class ChatPartyRoomCommander implements IChatHandler
activeChar.sendPacket(SystemMessageId.CHATTING_IS_CURRENTLY_PROHIBITED); activeChar.sendPacket(SystemMessageId.CHATTING_IS_CURRENTLY_PROHIBITED);
return; return;
} }
activeChar.getParty().getCommandChannel().broadcastCreatureSay(new CreatureSay(activeChar, type, activeChar.getName(), text), activeChar); activeChar.getParty().getCommandChannel().broadcastCreatureSay(new CreatureSay(activeChar, type, activeChar.getName(), text, shareLocation), activeChar);
} }
} }
@@ -37,7 +37,7 @@ public class ChatPetition implements IChatHandler
}; };
@Override @Override
public void handleChat(ChatType type, Player activeChar, String target, String text) public void handleChat(ChatType type, Player activeChar, String target, String text, boolean shareLocation)
{ {
if (activeChar.isChatBanned() && Config.BAN_CHAT_CHANNELS.contains(type)) if (activeChar.isChatBanned() && Config.BAN_CHAT_CHANNELS.contains(type))
{ {
@@ -24,6 +24,8 @@ import org.l2jmobius.gameserver.instancemanager.MapRegionManager;
import org.l2jmobius.gameserver.model.BlockList; import org.l2jmobius.gameserver.model.BlockList;
import org.l2jmobius.gameserver.model.World; import org.l2jmobius.gameserver.model.World;
import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.itemcontainer.Inventory;
import org.l2jmobius.gameserver.model.zone.ZoneId;
import org.l2jmobius.gameserver.network.SystemMessageId; import org.l2jmobius.gameserver.network.SystemMessageId;
import org.l2jmobius.gameserver.network.serverpackets.CreatureSay; import org.l2jmobius.gameserver.network.serverpackets.CreatureSay;
import org.l2jmobius.gameserver.network.serverpackets.SystemMessage; import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
@@ -40,7 +42,7 @@ public class ChatShout implements IChatHandler
}; };
@Override @Override
public void handleChat(ChatType type, Player activeChar, String target, String text) public void handleChat(ChatType type, Player activeChar, String target, String text, boolean shareLocation)
{ {
if (activeChar.isChatBanned() && Config.BAN_CHAT_CHANNELS.contains(type)) if (activeChar.isChatBanned() && Config.BAN_CHAT_CHANNELS.contains(type))
{ {
@@ -58,7 +60,24 @@ public class ChatShout implements IChatHandler
return; return;
} }
final CreatureSay cs = new CreatureSay(activeChar, type, activeChar.getName(), text); if (shareLocation)
{
if (activeChar.getInventory().getInventoryItemCount(Inventory.LCOIN_ID, -1) < Config.SHARING_LOCATION_COST)
{
activeChar.sendPacket(SystemMessageId.THERE_ARE_NOT_ENOUGH_L_COINS);
return;
}
if ((activeChar.getMovieHolder() != null) || activeChar.isFishing() || activeChar.isInInstance() || activeChar.isOnEvent() || activeChar.isInOlympiadMode() || activeChar.inObserverMode() || activeChar.isInTraingCamp() || activeChar.isInTimedHuntingZone() || activeChar.isInsideZone(ZoneId.SIEGE))
{
activeChar.sendPacket(SystemMessageId.LOCATION_CANNOT_BE_SHARED_SINCE_THE_CONDITIONS_ARE_NOT_MET);
return;
}
activeChar.destroyItemByItemId("Shared Location", Inventory.LCOIN_ID, Config.SHARING_LOCATION_COST, activeChar, true);
}
final CreatureSay cs = new CreatureSay(activeChar, type, activeChar.getName(), text, shareLocation);
if (Config.DEFAULT_GLOBAL_CHAT.equalsIgnoreCase("on") || (Config.DEFAULT_GLOBAL_CHAT.equalsIgnoreCase("gm") && activeChar.canOverrideCond(PlayerCondOverride.CHAT_CONDITIONS))) if (Config.DEFAULT_GLOBAL_CHAT.equalsIgnoreCase("on") || (Config.DEFAULT_GLOBAL_CHAT.equalsIgnoreCase("gm") && activeChar.canOverrideCond(PlayerCondOverride.CHAT_CONDITIONS)))
{ {
final int region = MapRegionManager.getInstance().getMapRegionLocId(activeChar); final int region = MapRegionManager.getInstance().getMapRegionLocId(activeChar);
@@ -24,6 +24,8 @@ import org.l2jmobius.gameserver.instancemanager.MapRegionManager;
import org.l2jmobius.gameserver.model.BlockList; import org.l2jmobius.gameserver.model.BlockList;
import org.l2jmobius.gameserver.model.World; import org.l2jmobius.gameserver.model.World;
import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.itemcontainer.Inventory;
import org.l2jmobius.gameserver.model.zone.ZoneId;
import org.l2jmobius.gameserver.network.SystemMessageId; import org.l2jmobius.gameserver.network.SystemMessageId;
import org.l2jmobius.gameserver.network.serverpackets.CreatureSay; import org.l2jmobius.gameserver.network.serverpackets.CreatureSay;
import org.l2jmobius.gameserver.network.serverpackets.SystemMessage; import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
@@ -40,7 +42,7 @@ public class ChatTrade implements IChatHandler
}; };
@Override @Override
public void handleChat(ChatType type, Player activeChar, String target, String text) public void handleChat(ChatType type, Player activeChar, String target, String text, boolean shareLocation)
{ {
if (activeChar.isChatBanned() && Config.BAN_CHAT_CHANNELS.contains(type)) if (activeChar.isChatBanned() && Config.BAN_CHAT_CHANNELS.contains(type))
{ {
@@ -58,7 +60,24 @@ public class ChatTrade implements IChatHandler
return; return;
} }
final CreatureSay cs = new CreatureSay(activeChar, type, activeChar.getName(), text); if (shareLocation)
{
if (activeChar.getInventory().getInventoryItemCount(Inventory.LCOIN_ID, -1) < Config.SHARING_LOCATION_COST)
{
activeChar.sendPacket(SystemMessageId.THERE_ARE_NOT_ENOUGH_L_COINS);
return;
}
if ((activeChar.getMovieHolder() != null) || activeChar.isFishing() || activeChar.isInInstance() || activeChar.isOnEvent() || activeChar.isInOlympiadMode() || activeChar.inObserverMode() || activeChar.isInTraingCamp() || activeChar.isInTimedHuntingZone() || activeChar.isInsideZone(ZoneId.SIEGE))
{
activeChar.sendPacket(SystemMessageId.LOCATION_CANNOT_BE_SHARED_SINCE_THE_CONDITIONS_ARE_NOT_MET);
return;
}
activeChar.destroyItemByItemId("Shared Location", Inventory.LCOIN_ID, Config.SHARING_LOCATION_COST, activeChar, true);
}
final CreatureSay cs = new CreatureSay(activeChar, type, activeChar.getName(), text, shareLocation);
if (Config.DEFAULT_TRADE_CHAT.equalsIgnoreCase("on") || (Config.DEFAULT_TRADE_CHAT.equalsIgnoreCase("gm") && activeChar.canOverrideCond(PlayerCondOverride.CHAT_CONDITIONS))) if (Config.DEFAULT_TRADE_CHAT.equalsIgnoreCase("on") || (Config.DEFAULT_TRADE_CHAT.equalsIgnoreCase("gm") && activeChar.canOverrideCond(PlayerCondOverride.CHAT_CONDITIONS)))
{ {
final int region = MapRegionManager.getInstance().getMapRegionLocId(activeChar); final int region = MapRegionManager.getInstance().getMapRegionLocId(activeChar);
@@ -41,7 +41,7 @@ public class ChatWhisper implements IChatHandler
}; };
@Override @Override
public void handleChat(ChatType type, Player activeChar, String target, String text) public void handleChat(ChatType type, Player activeChar, String target, String text, boolean shareLocation)
{ {
if (activeChar.isChatBanned() && Config.BAN_CHAT_CHANNELS.contains(type)) if (activeChar.isChatBanned() && Config.BAN_CHAT_CHANNELS.contains(type))
{ {
@@ -27,6 +27,8 @@ import org.l2jmobius.gameserver.enums.PlayerCondOverride;
import org.l2jmobius.gameserver.handler.IChatHandler; import org.l2jmobius.gameserver.handler.IChatHandler;
import org.l2jmobius.gameserver.model.World; import org.l2jmobius.gameserver.model.World;
import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.itemcontainer.Inventory;
import org.l2jmobius.gameserver.model.zone.ZoneId;
import org.l2jmobius.gameserver.network.SystemMessageId; import org.l2jmobius.gameserver.network.SystemMessageId;
import org.l2jmobius.gameserver.network.serverpackets.CreatureSay; import org.l2jmobius.gameserver.network.serverpackets.CreatureSay;
import org.l2jmobius.gameserver.network.serverpackets.ExWorldChatCnt; import org.l2jmobius.gameserver.network.serverpackets.ExWorldChatCnt;
@@ -46,7 +48,7 @@ public class ChatWorld implements IChatHandler
}; };
@Override @Override
public void handleChat(ChatType type, Player activeChar, String target, String text) public void handleChat(ChatType type, Player activeChar, String target, String text, boolean shareLocation)
{ {
if (!Config.ENABLE_WORLD_CHAT) if (!Config.ENABLE_WORLD_CHAT)
{ {
@@ -77,6 +79,14 @@ public class ChatWorld implements IChatHandler
{ {
activeChar.sendPacket(SystemMessageId.YOU_HAVE_SPENT_YOUR_WORLD_CHAT_QUOTA_FOR_THE_DAY_IT_IS_RESET_DAILY_AT_7_A_M); activeChar.sendPacket(SystemMessageId.YOU_HAVE_SPENT_YOUR_WORLD_CHAT_QUOTA_FOR_THE_DAY_IT_IS_RESET_DAILY_AT_7_A_M);
} }
else if (shareLocation && (activeChar.getInventory().getInventoryItemCount(Inventory.LCOIN_ID, -1) < Config.SHARING_LOCATION_COST))
{
activeChar.sendPacket(SystemMessageId.THERE_ARE_NOT_ENOUGH_L_COINS);
}
else if (shareLocation && ((activeChar.getMovieHolder() != null) || activeChar.isFishing() || activeChar.isInInstance() || activeChar.isOnEvent() || activeChar.isInOlympiadMode() || activeChar.inObserverMode() || activeChar.isInTraingCamp() || activeChar.isInTimedHuntingZone() || activeChar.isInsideZone(ZoneId.SIEGE)))
{
activeChar.sendPacket(SystemMessageId.LOCATION_CANNOT_BE_SHARED_SINCE_THE_CONDITIONS_ARE_NOT_MET);
}
else else
{ {
// Verify if player is not spaming. // Verify if player is not spaming.
@@ -93,7 +103,12 @@ public class ChatWorld implements IChatHandler
} }
} }
final CreatureSay cs = new CreatureSay(activeChar, type, activeChar.getName(), text); if (shareLocation)
{
activeChar.destroyItemByItemId("Shared Location", Inventory.LCOIN_ID, Config.SHARING_LOCATION_COST, activeChar, true);
}
final CreatureSay cs = new CreatureSay(activeChar, type, activeChar.getName(), text, shareLocation);
if (Config.FACTION_SYSTEM_ENABLED && Config.FACTION_SPECIFIC_CHAT) if (Config.FACTION_SYSTEM_ENABLED && Config.FACTION_SPECIFIC_CHAT)
{ {
if (activeChar.isGood()) if (activeChar.isGood())
@@ -2281,8 +2281,8 @@ public class Config
RESUME_AUTO_PLAY = generalConfig.getBoolean("ResumeAutoPlay", false); RESUME_AUTO_PLAY = generalConfig.getBoolean("ResumeAutoPlay", false);
SUBJUGATION_TOPIC_BODY = generalConfig.getString("SubjugationTopicBody", "Reward for being in the top of the best players in clearing the lands of Aden"); SUBJUGATION_TOPIC_BODY = generalConfig.getString("SubjugationTopicBody", "Reward for being in the top of the best players in clearing the lands of Aden");
SUBJUGATION_TOPIC_HEADER = generalConfig.getString("SubjugationTopicHeader", "Purge reward"); SUBJUGATION_TOPIC_HEADER = generalConfig.getString("SubjugationTopicHeader", "Purge reward");
SHARING_LOCATION_COST = generalConfig.getInt("ShareLocationLcoinCost", 1); SHARING_LOCATION_COST = generalConfig.getInt("ShareLocationLcoinCost", 50);
TELEPORT_SHARE_LOCATION_COST = generalConfig.getInt("TeleportShareLocationLcoinCost", 1); TELEPORT_SHARE_LOCATION_COST = generalConfig.getInt("TeleportShareLocationLcoinCost", 400);
// Load FloodProtector config file // Load FloodProtector config file
final PropertiesParser floodProtectorConfig = new PropertiesParser(FLOOD_PROTECTOR_CONFIG_FILE); final PropertiesParser floodProtectorConfig = new PropertiesParser(FLOOD_PROTECTOR_CONFIG_FILE);
@@ -143,7 +143,6 @@ import org.l2jmobius.gameserver.instancemanager.InstanceManager;
import org.l2jmobius.gameserver.instancemanager.ItemAuctionManager; import org.l2jmobius.gameserver.instancemanager.ItemAuctionManager;
import org.l2jmobius.gameserver.instancemanager.ItemCommissionManager; import org.l2jmobius.gameserver.instancemanager.ItemCommissionManager;
import org.l2jmobius.gameserver.instancemanager.ItemsOnGroundManager; import org.l2jmobius.gameserver.instancemanager.ItemsOnGroundManager;
import org.l2jmobius.gameserver.instancemanager.RankingPowerManager;
import org.l2jmobius.gameserver.instancemanager.MailManager; import org.l2jmobius.gameserver.instancemanager.MailManager;
import org.l2jmobius.gameserver.instancemanager.MapRegionManager; import org.l2jmobius.gameserver.instancemanager.MapRegionManager;
import org.l2jmobius.gameserver.instancemanager.MatchingRoomManager; import org.l2jmobius.gameserver.instancemanager.MatchingRoomManager;
@@ -156,8 +155,10 @@ import org.l2jmobius.gameserver.instancemanager.PunishmentManager;
import org.l2jmobius.gameserver.instancemanager.PurgeRankingManager; import org.l2jmobius.gameserver.instancemanager.PurgeRankingManager;
import org.l2jmobius.gameserver.instancemanager.QuestManager; import org.l2jmobius.gameserver.instancemanager.QuestManager;
import org.l2jmobius.gameserver.instancemanager.RankManager; import org.l2jmobius.gameserver.instancemanager.RankManager;
import org.l2jmobius.gameserver.instancemanager.RankingPowerManager;
import org.l2jmobius.gameserver.instancemanager.SellBuffsManager; import org.l2jmobius.gameserver.instancemanager.SellBuffsManager;
import org.l2jmobius.gameserver.instancemanager.ServerRestartManager; import org.l2jmobius.gameserver.instancemanager.ServerRestartManager;
import org.l2jmobius.gameserver.instancemanager.SharedTeleportManager;
import org.l2jmobius.gameserver.instancemanager.SiegeGuardManager; import org.l2jmobius.gameserver.instancemanager.SiegeGuardManager;
import org.l2jmobius.gameserver.instancemanager.SiegeManager; import org.l2jmobius.gameserver.instancemanager.SiegeManager;
import org.l2jmobius.gameserver.instancemanager.WalkingManager; import org.l2jmobius.gameserver.instancemanager.WalkingManager;
@@ -379,6 +380,7 @@ public class GameServer
HtmCache.getInstance(); HtmCache.getInstance();
CrestTable.getInstance(); CrestTable.getInstance();
TeleportListData.getInstance(); TeleportListData.getInstance();
SharedTeleportManager.getInstance();
PetTypesListData.getInstance(); PetTypesListData.getInstance();
TeleporterData.getInstance(); TeleporterData.getInstance();
TimedHuntingZoneData.getInstance(); TimedHuntingZoneData.getInstance();
@@ -31,8 +31,9 @@ public interface IChatHandler
* @param player * @param player
* @param target * @param target
* @param text * @param text
* @param shareLocation
*/ */
void handleChat(ChatType type, Player player, String target, String text); void handleChat(ChatType type, Player player, String target, String text, boolean shareLocation);
/** /**
* Returns a list of all chat types registered to this handler * Returns a list of all chat types registered to this handler
@@ -0,0 +1,69 @@
/*
* 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.instancemanager;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.logging.Logger;
import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.holders.SharedTeleportHolder;
/**
* Shared Teleport Manager
* @author NasSeKa
*/
public class SharedTeleportManager
{
protected static final Logger LOGGER = Logger.getLogger(SharedTeleportManager.class.getName());
private static final int TELEPORT_COUNT = 5;
private final Map<Integer, SharedTeleportHolder> _sharedTeleports = new ConcurrentHashMap<>();
private int _lastSharedTeleportId = 0;
protected SharedTeleportManager()
{
LOGGER.info(getClass().getSimpleName() + ": initialized.");
}
public SharedTeleportHolder getTeleport(int id)
{
return _sharedTeleports.get(id);
}
public synchronized int nextId(Creature creature)
{
final int nextId = ++_lastSharedTeleportId;
_sharedTeleports.put(nextId, new SharedTeleportHolder(nextId, creature.getName(), TELEPORT_COUNT, creature.getX(), creature.getY(), creature.getZ()));
return nextId;
}
/**
* Gets the single instance of {@code SharedTeleportManager}.
* @return single instance of {@code SharedTeleportManager}
*/
public static SharedTeleportManager getInstance()
{
return SingletonHolder.INSTANCE;
}
private static class SingletonHolder
{
protected static final SharedTeleportManager INSTANCE = new SharedTeleportManager();
}
}
@@ -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 org.l2jmobius.gameserver.model.holders;
import org.l2jmobius.gameserver.model.Location;
/**
* @author NasSeKa
*/
public class SharedTeleportHolder
{
private final int _id;
private final String _name;
private int _count;
private final Location _location;
public SharedTeleportHolder(int id, String name, int count, int x, int y, int z)
{
_id = id;
_name = name;
_count = count;
_location = new Location(x, y, z);
}
public int getId()
{
return _id;
}
public String getName()
{
return _name;
}
public int getCount()
{
return Math.max(0, _count);
}
public void decrementCount()
{
_count -= 1;
}
public Location getLocation()
{
return _location;
}
}
@@ -157,6 +157,7 @@ import org.l2jmobius.gameserver.network.clientpackets.subjugation.RequestSubjuga
import org.l2jmobius.gameserver.network.clientpackets.subjugation.RequestSubjugationGachaUI; import org.l2jmobius.gameserver.network.clientpackets.subjugation.RequestSubjugationGachaUI;
import org.l2jmobius.gameserver.network.clientpackets.subjugation.RequestSubjugationList; import org.l2jmobius.gameserver.network.clientpackets.subjugation.RequestSubjugationList;
import org.l2jmobius.gameserver.network.clientpackets.subjugation.RequestSubjugationRanking; import org.l2jmobius.gameserver.network.clientpackets.subjugation.RequestSubjugationRanking;
import org.l2jmobius.gameserver.network.clientpackets.teleports.ExRequestSharedLocationTeleport;
import org.l2jmobius.gameserver.network.clientpackets.teleports.ExRequestSharedLocationTeleportUi; import org.l2jmobius.gameserver.network.clientpackets.teleports.ExRequestSharedLocationTeleportUi;
import org.l2jmobius.gameserver.network.clientpackets.teleports.ExRequestSharingLocationUi; import org.l2jmobius.gameserver.network.clientpackets.teleports.ExRequestSharingLocationUi;
import org.l2jmobius.gameserver.network.clientpackets.teleports.ExRequestTeleport; import org.l2jmobius.gameserver.network.clientpackets.teleports.ExRequestTeleport;
@@ -595,7 +596,7 @@ public enum ExIncomingPackets implements IIncomingPackets<GameClient>
// 270 // 270
EX_SHARED_POSITION_SHARING_UI(0x1A1, ExRequestSharingLocationUi::new, ConnectionState.IN_GAME), EX_SHARED_POSITION_SHARING_UI(0x1A1, ExRequestSharingLocationUi::new, ConnectionState.IN_GAME),
EX_SHARED_POSITION_TELEPORT_UI(0x1A2, ExRequestSharedLocationTeleportUi::new, ConnectionState.IN_GAME), EX_SHARED_POSITION_TELEPORT_UI(0x1A2, ExRequestSharedLocationTeleportUi::new, ConnectionState.IN_GAME),
EX_SHARED_POSITION_TELEPORT(0x1A3, ExRequestSharedLocationTeleportUi::new, ConnectionState.IN_GAME), EX_SHARED_POSITION_TELEPORT(0x1A3, ExRequestSharedLocationTeleport::new, ConnectionState.IN_GAME),
EX_AUTH_RECONNECT(0x1A4, null, ConnectionState.IN_GAME), EX_AUTH_RECONNECT(0x1A4, null, ConnectionState.IN_GAME),
EX_PET_EQUIP_ITEM(0x1A5, ExPetEquipItem::new, ConnectionState.IN_GAME), EX_PET_EQUIP_ITEM(0x1A5, ExPetEquipItem::new, ConnectionState.IN_GAME),
EX_PET_UNEQUIP_ITEM(0x1A6, ExPetUnequipItem::new, ConnectionState.IN_GAME), EX_PET_UNEQUIP_ITEM(0x1A6, ExPetUnequipItem::new, ConnectionState.IN_GAME),
@@ -88,16 +88,18 @@ public class Say2 implements IClientIncomingPacket
private String _text; private String _text;
private int _type; private int _type;
private String _target; private String _target;
private boolean _shareLocation;
@Override @Override
public boolean read(GameClient client, PacketReader packet) public boolean read(GameClient client, PacketReader packet)
{ {
_text = packet.readS(); _text = packet.readS();
_type = packet.readD(); _type = packet.readD();
_shareLocation = packet.readC() == 1;
if (_type == ChatType.WHISPER.getClientId()) if (_type == ChatType.WHISPER.getClientId())
{ {
packet.readC();
_target = packet.readS(); _target = packet.readS();
_shareLocation = false;
} }
return true; return true;
} }
@@ -215,7 +217,7 @@ public class Say2 implements IClientIncomingPacket
final IChatHandler handler = ChatHandler.getInstance().getHandler(chatType); final IChatHandler handler = ChatHandler.getInstance().getHandler(chatType);
if (handler != null) if (handler != null)
{ {
handler.handleChat(chatType, player, _target, _text); handler.handleChat(chatType, player, _target, _text, _shareLocation);
} }
else else
{ {
@@ -0,0 +1,86 @@
/*
* 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.teleports;
import org.l2jmobius.Config;
import org.l2jmobius.commons.network.PacketReader;
import org.l2jmobius.gameserver.instancemanager.SharedTeleportManager;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.holders.SharedTeleportHolder;
import org.l2jmobius.gameserver.model.itemcontainer.Inventory;
import org.l2jmobius.gameserver.model.zone.ZoneId;
import org.l2jmobius.gameserver.network.GameClient;
import org.l2jmobius.gameserver.network.SystemMessageId;
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
/**
* @author NasSeKa
*/
public class ExRequestSharedLocationTeleport implements IClientIncomingPacket
{
private int _id;
@Override
public boolean read(GameClient client, PacketReader packet)
{
_id = (packet.readD() - 1) / 256;
return true;
}
@Override
public void run(GameClient client)
{
final Player player = client.getPlayer();
if (player == null)
{
return;
}
final SharedTeleportHolder teleport = SharedTeleportManager.getInstance().getTeleport(_id);
if ((teleport == null) || (teleport.getCount() == 0))
{
player.sendPacket(SystemMessageId.TELEPORTATION_LIMIT_FOR_THE_COORDINATES_RECEIVED_IS_REACHED);
return;
}
if (player.getName().equals(teleport.getName()))
{
player.sendPacket(SystemMessageId.YOU_CANNOT_TELEPORT_TO_YOURSELF);
return;
}
if (player.getInventory().getInventoryItemCount(Inventory.LCOIN_ID, -1) < Config.TELEPORT_SHARE_LOCATION_COST)
{
player.sendPacket(SystemMessageId.THERE_ARE_NOT_ENOUGH_L_COINS);
return;
}
if ((player.getMovieHolder() != null) || player.isFishing() || player.isInInstance() || player.isOnEvent() || player.isInOlympiadMode() || player.inObserverMode() || player.isInTraingCamp() || player.isInTimedHuntingZone() || player.isInsideZone(ZoneId.SIEGE))
{
player.sendPacket(SystemMessageId.YOU_CANNOT_TELEPORT_RIGHT_NOW);
return;
}
if (player.destroyItemByItemId("Shared Location", Inventory.LCOIN_ID, Config.TELEPORT_SHARE_LOCATION_COST, player, true))
{
teleport.decrementCount();
player.abortCast();
player.stopMove(null);
player.teleToLocation(teleport.getLocation());
}
}
}
@@ -17,19 +17,24 @@
package org.l2jmobius.gameserver.network.clientpackets.teleports; package org.l2jmobius.gameserver.network.clientpackets.teleports;
import org.l2jmobius.commons.network.PacketReader; import org.l2jmobius.commons.network.PacketReader;
import org.l2jmobius.gameserver.instancemanager.SharedTeleportManager;
import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.holders.SharedTeleportHolder;
import org.l2jmobius.gameserver.network.GameClient; import org.l2jmobius.gameserver.network.GameClient;
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket; import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
import org.l2jmobius.gameserver.network.serverpackets.teleports.ExShowSharedLocationTeleportUi; import org.l2jmobius.gameserver.network.serverpackets.teleports.ExShowSharedLocationTeleportUi;
/** /**
* @author GustavoFonseca * @author NasSeKa
*/ */
public class ExRequestSharedLocationTeleportUi implements IClientIncomingPacket public class ExRequestSharedLocationTeleportUi implements IClientIncomingPacket
{ {
private int _id;
@Override @Override
public boolean read(GameClient client, PacketReader packet) public boolean read(GameClient client, PacketReader packet)
{ {
_id = (packet.readD() - 1) / 256;
return true; return true;
} }
@@ -42,6 +47,12 @@ public class ExRequestSharedLocationTeleportUi implements IClientIncomingPacket
return; return;
} }
client.sendPacket(new ExShowSharedLocationTeleportUi()); final SharedTeleportHolder teleport = SharedTeleportManager.getInstance().getTeleport(_id);
if (teleport == null)
{
return;
}
player.sendPacket(new ExShowSharedLocationTeleportUi(teleport));
} }
} }
@@ -42,6 +42,6 @@ public class ExRequestSharingLocationUi implements IClientIncomingPacket
return; return;
} }
client.sendPacket(new ExShowSharingLocationUi()); player.sendPacket(new ExShowSharingLocationUi());
} }
} }
@@ -23,6 +23,7 @@ import org.l2jmobius.commons.network.PacketWriter;
import org.l2jmobius.gameserver.enums.ChatType; import org.l2jmobius.gameserver.enums.ChatType;
import org.l2jmobius.gameserver.instancemanager.MentorManager; import org.l2jmobius.gameserver.instancemanager.MentorManager;
import org.l2jmobius.gameserver.instancemanager.RankManager; import org.l2jmobius.gameserver.instancemanager.RankManager;
import org.l2jmobius.gameserver.instancemanager.SharedTeleportManager;
import org.l2jmobius.gameserver.model.actor.Creature; import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.clan.Clan; import org.l2jmobius.gameserver.model.clan.Clan;
@@ -40,6 +41,7 @@ public class CreatureSay implements IClientOutgoingPacket
private int _messageId = -1; private int _messageId = -1;
private int _mask; private int _mask;
private List<String> _parameters; private List<String> _parameters;
private boolean _shareLocation;
/** /**
* @param sender * @param sender
@@ -49,11 +51,25 @@ public class CreatureSay implements IClientOutgoingPacket
* @param text * @param text
*/ */
public CreatureSay(Player sender, Player receiver, String name, ChatType chatType, String text) public CreatureSay(Player sender, Player receiver, String name, ChatType chatType, String text)
{
this(sender, receiver, name, chatType, text, false);
}
/**
* @param sender
* @param receiver
* @param name
* @param chatType
* @param text
* @param shareLocation
*/
public CreatureSay(Player sender, Player receiver, String name, ChatType chatType, String text, boolean shareLocation)
{ {
_sender = sender; _sender = sender;
_senderName = name; _senderName = name;
_chatType = chatType; _chatType = chatType;
_text = text; _text = text;
_shareLocation = shareLocation;
if (receiver != null) if (receiver != null)
{ {
if (receiver.getFriendList().contains(sender.getObjectId())) if (receiver.getFriendList().contains(sender.getObjectId()))
@@ -81,11 +97,17 @@ public class CreatureSay implements IClientOutgoingPacket
} }
public CreatureSay(Creature sender, ChatType chatType, String senderName, String text) public CreatureSay(Creature sender, ChatType chatType, String senderName, String text)
{
this(sender, chatType, senderName, text, false);
}
public CreatureSay(Creature sender, ChatType chatType, String senderName, String text, boolean shareLocation)
{ {
_sender = sender; _sender = sender;
_chatType = chatType; _chatType = chatType;
_senderName = senderName; _senderName = senderName;
_text = text; _text = text;
_shareLocation = shareLocation;
} }
public CreatureSay(Creature sender, ChatType chatType, NpcStringId npcStringId) public CreatureSay(Creature sender, ChatType chatType, NpcStringId npcStringId)
@@ -162,6 +184,7 @@ public class CreatureSay implements IClientOutgoingPacket
{ {
packet.writeC(0); // unknown clan byte packet.writeC(0); // unknown clan byte
} }
final int rank = RankManager.getInstance().getPlayerGlobalRank(_sender.getActingPlayer()); final int rank = RankManager.getInstance().getPlayerGlobalRank(_sender.getActingPlayer());
if ((rank == 0) || (rank > 100)) if ((rank == 0) || (rank > 100))
{ {
@@ -187,6 +210,12 @@ public class CreatureSay implements IClientOutgoingPacket
{ {
packet.writeC(0); packet.writeC(0);
} }
if (_shareLocation)
{
packet.writeC(1);
packet.writeH(SharedTeleportManager.getInstance().nextId(_sender));
}
} }
else else
{ {
@@ -100,7 +100,7 @@ public class ExBasicActionList implements IClientOutgoingPacket
81, 82, 83, 84, 81, 82, 83, 84,
85, 86, 87, 88, 85, 86, 87, 88,
89, 90, 92, 93, 89, 90, 92, 93,
94, 96, 97, 94, 96, 97, 99,
1000, 1001, 1000, 1001,
1002, 1003, 1004, 1005, 1002, 1003, 1004, 1005,
1006, 1007, 1008, 1009, 1006, 1007, 1008, 1009,
@@ -17,24 +17,33 @@
package org.l2jmobius.gameserver.network.serverpackets.teleports; package org.l2jmobius.gameserver.network.serverpackets.teleports;
import org.l2jmobius.commons.network.PacketWriter; import org.l2jmobius.commons.network.PacketWriter;
import org.l2jmobius.gameserver.model.holders.SharedTeleportHolder;
import org.l2jmobius.gameserver.network.OutgoingPackets; import org.l2jmobius.gameserver.network.OutgoingPackets;
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket; import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
/** /**
* @author Gustavo Fonseca * @author NasSeKa
*/ */
public class ExShowSharedLocationTeleportUi implements IClientOutgoingPacket public class ExShowSharedLocationTeleportUi implements IClientOutgoingPacket
{ {
public static final ExShowSharedLocationTeleportUi STATIC_PACKET = new ExShowSharedLocationTeleportUi(); private final SharedTeleportHolder _teleport;
public ExShowSharedLocationTeleportUi() public ExShowSharedLocationTeleportUi(SharedTeleportHolder teleport)
{ {
_teleport = teleport;
} }
@Override @Override
public boolean write(PacketWriter packet) public boolean write(PacketWriter packet)
{ {
OutgoingPackets.EX_SHARED_POSITION_TELEPORT_UI.writeId(packet); OutgoingPackets.EX_SHARED_POSITION_TELEPORT_UI.writeId(packet);
packet.writeString(_teleport.getName());
packet.writeD(_teleport.getId());
packet.writeD(_teleport.getCount());
packet.writeH(150);
packet.writeD(_teleport.getLocation().getX());
packet.writeD(_teleport.getLocation().getY());
packet.writeD(_teleport.getLocation().getZ());
return true; return true;
} }
} }
@@ -685,7 +685,7 @@ SubjugationTopicBody = Reward for being in the top of the best players in cleari
Share loction L-Coin cost. Share loction L-Coin cost.
# Default: 50 # Default: 50
ShareLocationLcoinCost = 1000 ShareLocationLcoinCost = 50
# Teleport share location L-Coin cost. # Teleport share location L-Coin cost.
# Default: 400 # Default: 400
@@ -21,6 +21,8 @@ import org.l2jmobius.gameserver.enums.ChatType;
import org.l2jmobius.gameserver.enums.PlayerCondOverride; import org.l2jmobius.gameserver.enums.PlayerCondOverride;
import org.l2jmobius.gameserver.handler.IChatHandler; import org.l2jmobius.gameserver.handler.IChatHandler;
import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.itemcontainer.Inventory;
import org.l2jmobius.gameserver.model.zone.ZoneId;
import org.l2jmobius.gameserver.network.SystemMessageId; import org.l2jmobius.gameserver.network.SystemMessageId;
import org.l2jmobius.gameserver.network.serverpackets.CreatureSay; import org.l2jmobius.gameserver.network.serverpackets.CreatureSay;
@@ -35,7 +37,7 @@ public class ChatAlliance implements IChatHandler
}; };
@Override @Override
public void handleChat(ChatType type, Player activeChar, String target, String text) public void handleChat(ChatType type, Player activeChar, String target, String text, boolean shareLocation)
{ {
if ((activeChar.getClan() == null) || ((activeChar.getClan() != null) && (activeChar.getClan().getAllyId() == 0))) if ((activeChar.getClan() == null) || ((activeChar.getClan() != null) && (activeChar.getClan().getAllyId() == 0)))
{ {
@@ -53,7 +55,25 @@ public class ChatAlliance implements IChatHandler
activeChar.sendPacket(SystemMessageId.CHATTING_IS_CURRENTLY_PROHIBITED); activeChar.sendPacket(SystemMessageId.CHATTING_IS_CURRENTLY_PROHIBITED);
return; return;
} }
activeChar.getClan().broadcastToOnlineAllyMembers(new CreatureSay(activeChar, type, activeChar.getName(), text));
if (shareLocation)
{
if (activeChar.getInventory().getInventoryItemCount(Inventory.LCOIN_ID, -1) < Config.SHARING_LOCATION_COST)
{
activeChar.sendPacket(SystemMessageId.THERE_ARE_NOT_ENOUGH_L_COINS);
return;
}
if ((activeChar.getMovieHolder() != null) || activeChar.isFishing() || activeChar.isInInstance() || activeChar.isOnEvent() || activeChar.isInOlympiadMode() || activeChar.inObserverMode() || activeChar.isInTraingCamp() || activeChar.isInTimedHuntingZone() || activeChar.isInsideZone(ZoneId.SIEGE))
{
activeChar.sendPacket(SystemMessageId.LOCATION_CANNOT_BE_SHARED_SINCE_THE_CONDITIONS_ARE_NOT_MET);
return;
}
activeChar.destroyItemByItemId("Shared Location", Inventory.LCOIN_ID, Config.SHARING_LOCATION_COST, activeChar, true);
}
activeChar.getClan().broadcastToOnlineAllyMembers(new CreatureSay(activeChar, type, activeChar.getName(), text, shareLocation));
} }
@Override @Override
@@ -21,6 +21,8 @@ import org.l2jmobius.gameserver.enums.ChatType;
import org.l2jmobius.gameserver.enums.PlayerCondOverride; import org.l2jmobius.gameserver.enums.PlayerCondOverride;
import org.l2jmobius.gameserver.handler.IChatHandler; import org.l2jmobius.gameserver.handler.IChatHandler;
import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.itemcontainer.Inventory;
import org.l2jmobius.gameserver.model.zone.ZoneId;
import org.l2jmobius.gameserver.network.SystemMessageId; import org.l2jmobius.gameserver.network.SystemMessageId;
import org.l2jmobius.gameserver.network.serverpackets.CreatureSay; import org.l2jmobius.gameserver.network.serverpackets.CreatureSay;
@@ -36,7 +38,7 @@ public class ChatClan implements IChatHandler
}; };
@Override @Override
public void handleChat(ChatType type, Player activeChar, String target, String text) public void handleChat(ChatType type, Player activeChar, String target, String text, boolean shareLocation)
{ {
if (activeChar.getClan() == null) if (activeChar.getClan() == null)
{ {
@@ -54,7 +56,25 @@ public class ChatClan implements IChatHandler
activeChar.sendPacket(SystemMessageId.CHATTING_IS_CURRENTLY_PROHIBITED); activeChar.sendPacket(SystemMessageId.CHATTING_IS_CURRENTLY_PROHIBITED);
return; return;
} }
activeChar.getClan().broadcastCSToOnlineMembers(new CreatureSay(activeChar, type, activeChar.getName(), text), activeChar);
if (shareLocation)
{
if (activeChar.getInventory().getInventoryItemCount(Inventory.LCOIN_ID, -1) < Config.SHARING_LOCATION_COST)
{
activeChar.sendPacket(SystemMessageId.THERE_ARE_NOT_ENOUGH_L_COINS);
return;
}
if ((activeChar.getMovieHolder() != null) || activeChar.isFishing() || activeChar.isInInstance() || activeChar.isOnEvent() || activeChar.isInOlympiadMode() || activeChar.inObserverMode() || activeChar.isInTraingCamp() || activeChar.isInTimedHuntingZone() || activeChar.isInsideZone(ZoneId.SIEGE))
{
activeChar.sendPacket(SystemMessageId.LOCATION_CANNOT_BE_SHARED_SINCE_THE_CONDITIONS_ARE_NOT_MET);
return;
}
activeChar.destroyItemByItemId("Shared Location", Inventory.LCOIN_ID, Config.SHARING_LOCATION_COST, activeChar, true);
}
activeChar.getClan().broadcastCSToOnlineMembers(new CreatureSay(activeChar, type, activeChar.getName(), text, shareLocation), activeChar);
} }
@Override @Override
@@ -27,6 +27,8 @@ import org.l2jmobius.gameserver.handler.VoicedCommandHandler;
import org.l2jmobius.gameserver.model.BlockList; import org.l2jmobius.gameserver.model.BlockList;
import org.l2jmobius.gameserver.model.World; import org.l2jmobius.gameserver.model.World;
import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.itemcontainer.Inventory;
import org.l2jmobius.gameserver.model.zone.ZoneId;
import org.l2jmobius.gameserver.network.SystemMessageId; import org.l2jmobius.gameserver.network.SystemMessageId;
import org.l2jmobius.gameserver.network.serverpackets.CreatureSay; import org.l2jmobius.gameserver.network.serverpackets.CreatureSay;
import org.l2jmobius.gameserver.network.serverpackets.SystemMessage; import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
@@ -43,7 +45,7 @@ public class ChatGeneral implements IChatHandler
}; };
@Override @Override
public void handleChat(ChatType type, Player activeChar, String paramsValue, String text) public void handleChat(ChatType type, Player activeChar, String paramsValue, String text, boolean shareLocation)
{ {
boolean vcdUsed = false; boolean vcdUsed = false;
if (text.startsWith(".")) if (text.startsWith("."))
@@ -87,8 +89,26 @@ public class ChatGeneral implements IChatHandler
return; return;
} }
final CreatureSay cs = new CreatureSay(activeChar, type, activeChar.getAppearance().getVisibleName(), text); if (shareLocation)
final CreatureSay csRandom = new CreatureSay(activeChar, type, activeChar.getAppearance().getVisibleName(), ChatRandomizer.randomize(text)); {
if (activeChar.getInventory().getInventoryItemCount(Inventory.LCOIN_ID, -1) < Config.SHARING_LOCATION_COST)
{
activeChar.sendPacket(SystemMessageId.THERE_ARE_NOT_ENOUGH_L_COINS);
return;
}
if ((activeChar.getMovieHolder() != null) || activeChar.isFishing() || activeChar.isInInstance() || activeChar.isOnEvent() || activeChar.isInOlympiadMode() || activeChar.inObserverMode() || activeChar.isInTraingCamp() || activeChar.isInTimedHuntingZone() || activeChar.isInsideZone(ZoneId.SIEGE))
{
activeChar.sendPacket(SystemMessageId.LOCATION_CANNOT_BE_SHARED_SINCE_THE_CONDITIONS_ARE_NOT_MET);
return;
}
activeChar.destroyItemByItemId("Shared Location", Inventory.LCOIN_ID, Config.SHARING_LOCATION_COST, activeChar, true);
}
final CreatureSay cs = new CreatureSay(activeChar, type, activeChar.getAppearance().getVisibleName(), text, shareLocation);
final CreatureSay csRandom = new CreatureSay(activeChar, type, activeChar.getAppearance().getVisibleName(), ChatRandomizer.randomize(text), shareLocation);
World.getInstance().forEachVisibleObjectInRange(activeChar, Player.class, 1250, player -> World.getInstance().forEachVisibleObjectInRange(activeChar, Player.class, 1250, player ->
{ {
if ((player != null) && !BlockList.isBlocked(player, activeChar)) if ((player != null) && !BlockList.isBlocked(player, activeChar))
@@ -38,7 +38,7 @@ public class ChatHeroVoice implements IChatHandler
}; };
@Override @Override
public void handleChat(ChatType type, Player activeChar, String target, String text) public void handleChat(ChatType type, Player activeChar, String target, String text, boolean shareLocation)
{ {
if (!activeChar.isHero() && !activeChar.canOverrideCond(PlayerCondOverride.CHAT_CONDITIONS)) if (!activeChar.isHero() && !activeChar.canOverrideCond(PlayerCondOverride.CHAT_CONDITIONS))
{ {
@@ -62,7 +62,7 @@ public class ChatHeroVoice implements IChatHandler
return; return;
} }
final CreatureSay cs = new CreatureSay(activeChar, type, activeChar.getName(), text); final CreatureSay cs = new CreatureSay(activeChar, type, activeChar.getName(), text, shareLocation);
for (Player player : World.getInstance().getPlayers()) for (Player player : World.getInstance().getPlayers())
{ {
if ((player != null) && !BlockList.isBlocked(player, activeChar)) if ((player != null) && !BlockList.isBlocked(player, activeChar))
@@ -21,6 +21,8 @@ import org.l2jmobius.gameserver.enums.ChatType;
import org.l2jmobius.gameserver.enums.PlayerCondOverride; import org.l2jmobius.gameserver.enums.PlayerCondOverride;
import org.l2jmobius.gameserver.handler.IChatHandler; import org.l2jmobius.gameserver.handler.IChatHandler;
import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.itemcontainer.Inventory;
import org.l2jmobius.gameserver.model.zone.ZoneId;
import org.l2jmobius.gameserver.network.SystemMessageId; import org.l2jmobius.gameserver.network.SystemMessageId;
import org.l2jmobius.gameserver.network.serverpackets.CreatureSay; import org.l2jmobius.gameserver.network.serverpackets.CreatureSay;
@@ -36,7 +38,7 @@ public class ChatParty implements IChatHandler
}; };
@Override @Override
public void handleChat(ChatType type, Player activeChar, String target, String text) public void handleChat(ChatType type, Player activeChar, String target, String text, boolean shareLocation)
{ {
if (!activeChar.isInParty()) if (!activeChar.isInParty())
{ {
@@ -54,7 +56,25 @@ public class ChatParty implements IChatHandler
activeChar.sendPacket(SystemMessageId.CHATTING_IS_CURRENTLY_PROHIBITED); activeChar.sendPacket(SystemMessageId.CHATTING_IS_CURRENTLY_PROHIBITED);
return; return;
} }
activeChar.getParty().broadcastCreatureSay(new CreatureSay(activeChar, type, activeChar.getName(), text), activeChar);
if (shareLocation)
{
if (activeChar.getInventory().getInventoryItemCount(Inventory.LCOIN_ID, -1) < Config.SHARING_LOCATION_COST)
{
activeChar.sendPacket(SystemMessageId.THERE_ARE_NOT_ENOUGH_L_COINS);
return;
}
if ((activeChar.getMovieHolder() != null) || activeChar.isFishing() || activeChar.isInInstance() || activeChar.isOnEvent() || activeChar.isInOlympiadMode() || activeChar.inObserverMode() || activeChar.isInTraingCamp() || activeChar.isInTimedHuntingZone() || activeChar.isInsideZone(ZoneId.SIEGE))
{
activeChar.sendPacket(SystemMessageId.LOCATION_CANNOT_BE_SHARED_SINCE_THE_CONDITIONS_ARE_NOT_MET);
return;
}
activeChar.destroyItemByItemId("Shared Location", Inventory.LCOIN_ID, Config.SHARING_LOCATION_COST, activeChar, true);
}
activeChar.getParty().broadcastCreatureSay(new CreatureSay(activeChar, type, activeChar.getName(), text, shareLocation), activeChar);
} }
@Override @Override
@@ -37,7 +37,7 @@ public class ChatPartyMatchRoom implements IChatHandler
}; };
@Override @Override
public void handleChat(ChatType type, Player activeChar, String target, String text) public void handleChat(ChatType type, Player activeChar, String target, String text, boolean shareLocation)
{ {
final MatchingRoom room = activeChar.getMatchingRoom(); final MatchingRoom room = activeChar.getMatchingRoom();
if (room != null) if (room != null)
@@ -53,7 +53,7 @@ public class ChatPartyMatchRoom implements IChatHandler
return; return;
} }
final CreatureSay cs = new CreatureSay(activeChar, type, activeChar.getName(), text); final CreatureSay cs = new CreatureSay(activeChar, type, activeChar.getName(), text, shareLocation);
for (Player _member : room.getMembers()) for (Player _member : room.getMembers())
{ {
if (Config.FACTION_SYSTEM_ENABLED) if (Config.FACTION_SYSTEM_ENABLED)
@@ -36,7 +36,7 @@ public class ChatPartyRoomAll implements IChatHandler
}; };
@Override @Override
public void handleChat(ChatType type, Player activeChar, String target, String text) public void handleChat(ChatType type, Player activeChar, String target, String text, boolean shareLocation)
{ {
if (activeChar.isInParty() && activeChar.getParty().isInCommandChannel() && activeChar.getParty().isLeader(activeChar)) if (activeChar.isInParty() && activeChar.getParty().isInCommandChannel() && activeChar.getParty().isLeader(activeChar))
{ {
@@ -50,7 +50,7 @@ public class ChatPartyRoomAll implements IChatHandler
activeChar.sendPacket(SystemMessageId.CHATTING_IS_CURRENTLY_PROHIBITED); activeChar.sendPacket(SystemMessageId.CHATTING_IS_CURRENTLY_PROHIBITED);
return; return;
} }
activeChar.getParty().getCommandChannel().broadcastCreatureSay(new CreatureSay(activeChar, type, activeChar.getName(), text), activeChar); activeChar.getParty().getCommandChannel().broadcastCreatureSay(new CreatureSay(activeChar, type, activeChar.getName(), text, shareLocation), activeChar);
} }
} }
@@ -36,7 +36,7 @@ public class ChatPartyRoomCommander implements IChatHandler
}; };
@Override @Override
public void handleChat(ChatType type, Player activeChar, String target, String text) public void handleChat(ChatType type, Player activeChar, String target, String text, boolean shareLocation)
{ {
if (activeChar.isInParty() && activeChar.getParty().isInCommandChannel() && activeChar.getParty().getCommandChannel().getLeader().equals(activeChar)) if (activeChar.isInParty() && activeChar.getParty().isInCommandChannel() && activeChar.getParty().getCommandChannel().getLeader().equals(activeChar))
{ {
@@ -50,7 +50,7 @@ public class ChatPartyRoomCommander implements IChatHandler
activeChar.sendPacket(SystemMessageId.CHATTING_IS_CURRENTLY_PROHIBITED); activeChar.sendPacket(SystemMessageId.CHATTING_IS_CURRENTLY_PROHIBITED);
return; return;
} }
activeChar.getParty().getCommandChannel().broadcastCreatureSay(new CreatureSay(activeChar, type, activeChar.getName(), text), activeChar); activeChar.getParty().getCommandChannel().broadcastCreatureSay(new CreatureSay(activeChar, type, activeChar.getName(), text, shareLocation), activeChar);
} }
} }
@@ -37,7 +37,7 @@ public class ChatPetition implements IChatHandler
}; };
@Override @Override
public void handleChat(ChatType type, Player activeChar, String target, String text) public void handleChat(ChatType type, Player activeChar, String target, String text, boolean shareLocation)
{ {
if (activeChar.isChatBanned() && Config.BAN_CHAT_CHANNELS.contains(type)) if (activeChar.isChatBanned() && Config.BAN_CHAT_CHANNELS.contains(type))
{ {
@@ -24,6 +24,8 @@ import org.l2jmobius.gameserver.instancemanager.MapRegionManager;
import org.l2jmobius.gameserver.model.BlockList; import org.l2jmobius.gameserver.model.BlockList;
import org.l2jmobius.gameserver.model.World; import org.l2jmobius.gameserver.model.World;
import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.itemcontainer.Inventory;
import org.l2jmobius.gameserver.model.zone.ZoneId;
import org.l2jmobius.gameserver.network.SystemMessageId; import org.l2jmobius.gameserver.network.SystemMessageId;
import org.l2jmobius.gameserver.network.serverpackets.CreatureSay; import org.l2jmobius.gameserver.network.serverpackets.CreatureSay;
import org.l2jmobius.gameserver.network.serverpackets.SystemMessage; import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
@@ -40,7 +42,7 @@ public class ChatShout implements IChatHandler
}; };
@Override @Override
public void handleChat(ChatType type, Player activeChar, String target, String text) public void handleChat(ChatType type, Player activeChar, String target, String text, boolean shareLocation)
{ {
if (activeChar.isChatBanned() && Config.BAN_CHAT_CHANNELS.contains(type)) if (activeChar.isChatBanned() && Config.BAN_CHAT_CHANNELS.contains(type))
{ {
@@ -58,7 +60,24 @@ public class ChatShout implements IChatHandler
return; return;
} }
final CreatureSay cs = new CreatureSay(activeChar, type, activeChar.getName(), text); if (shareLocation)
{
if (activeChar.getInventory().getInventoryItemCount(Inventory.LCOIN_ID, -1) < Config.SHARING_LOCATION_COST)
{
activeChar.sendPacket(SystemMessageId.THERE_ARE_NOT_ENOUGH_L_COINS);
return;
}
if ((activeChar.getMovieHolder() != null) || activeChar.isFishing() || activeChar.isInInstance() || activeChar.isOnEvent() || activeChar.isInOlympiadMode() || activeChar.inObserverMode() || activeChar.isInTraingCamp() || activeChar.isInTimedHuntingZone() || activeChar.isInsideZone(ZoneId.SIEGE))
{
activeChar.sendPacket(SystemMessageId.LOCATION_CANNOT_BE_SHARED_SINCE_THE_CONDITIONS_ARE_NOT_MET);
return;
}
activeChar.destroyItemByItemId("Shared Location", Inventory.LCOIN_ID, Config.SHARING_LOCATION_COST, activeChar, true);
}
final CreatureSay cs = new CreatureSay(activeChar, type, activeChar.getName(), text, shareLocation);
if (Config.DEFAULT_GLOBAL_CHAT.equalsIgnoreCase("on") || (Config.DEFAULT_GLOBAL_CHAT.equalsIgnoreCase("gm") && activeChar.canOverrideCond(PlayerCondOverride.CHAT_CONDITIONS))) if (Config.DEFAULT_GLOBAL_CHAT.equalsIgnoreCase("on") || (Config.DEFAULT_GLOBAL_CHAT.equalsIgnoreCase("gm") && activeChar.canOverrideCond(PlayerCondOverride.CHAT_CONDITIONS)))
{ {
final int region = MapRegionManager.getInstance().getMapRegionLocId(activeChar); final int region = MapRegionManager.getInstance().getMapRegionLocId(activeChar);
@@ -24,6 +24,8 @@ import org.l2jmobius.gameserver.instancemanager.MapRegionManager;
import org.l2jmobius.gameserver.model.BlockList; import org.l2jmobius.gameserver.model.BlockList;
import org.l2jmobius.gameserver.model.World; import org.l2jmobius.gameserver.model.World;
import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.itemcontainer.Inventory;
import org.l2jmobius.gameserver.model.zone.ZoneId;
import org.l2jmobius.gameserver.network.SystemMessageId; import org.l2jmobius.gameserver.network.SystemMessageId;
import org.l2jmobius.gameserver.network.serverpackets.CreatureSay; import org.l2jmobius.gameserver.network.serverpackets.CreatureSay;
import org.l2jmobius.gameserver.network.serverpackets.SystemMessage; import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
@@ -40,7 +42,7 @@ public class ChatTrade implements IChatHandler
}; };
@Override @Override
public void handleChat(ChatType type, Player activeChar, String target, String text) public void handleChat(ChatType type, Player activeChar, String target, String text, boolean shareLocation)
{ {
if (activeChar.isChatBanned() && Config.BAN_CHAT_CHANNELS.contains(type)) if (activeChar.isChatBanned() && Config.BAN_CHAT_CHANNELS.contains(type))
{ {
@@ -58,7 +60,24 @@ public class ChatTrade implements IChatHandler
return; return;
} }
final CreatureSay cs = new CreatureSay(activeChar, type, activeChar.getName(), text); if (shareLocation)
{
if (activeChar.getInventory().getInventoryItemCount(Inventory.LCOIN_ID, -1) < Config.SHARING_LOCATION_COST)
{
activeChar.sendPacket(SystemMessageId.THERE_ARE_NOT_ENOUGH_L_COINS);
return;
}
if ((activeChar.getMovieHolder() != null) || activeChar.isFishing() || activeChar.isInInstance() || activeChar.isOnEvent() || activeChar.isInOlympiadMode() || activeChar.inObserverMode() || activeChar.isInTraingCamp() || activeChar.isInTimedHuntingZone() || activeChar.isInsideZone(ZoneId.SIEGE))
{
activeChar.sendPacket(SystemMessageId.LOCATION_CANNOT_BE_SHARED_SINCE_THE_CONDITIONS_ARE_NOT_MET);
return;
}
activeChar.destroyItemByItemId("Shared Location", Inventory.LCOIN_ID, Config.SHARING_LOCATION_COST, activeChar, true);
}
final CreatureSay cs = new CreatureSay(activeChar, type, activeChar.getName(), text, shareLocation);
if (Config.DEFAULT_TRADE_CHAT.equalsIgnoreCase("on") || (Config.DEFAULT_TRADE_CHAT.equalsIgnoreCase("gm") && activeChar.canOverrideCond(PlayerCondOverride.CHAT_CONDITIONS))) if (Config.DEFAULT_TRADE_CHAT.equalsIgnoreCase("on") || (Config.DEFAULT_TRADE_CHAT.equalsIgnoreCase("gm") && activeChar.canOverrideCond(PlayerCondOverride.CHAT_CONDITIONS)))
{ {
final int region = MapRegionManager.getInstance().getMapRegionLocId(activeChar); final int region = MapRegionManager.getInstance().getMapRegionLocId(activeChar);
@@ -41,7 +41,7 @@ public class ChatWhisper implements IChatHandler
}; };
@Override @Override
public void handleChat(ChatType type, Player activeChar, String target, String text) public void handleChat(ChatType type, Player activeChar, String target, String text, boolean shareLocation)
{ {
if (activeChar.isChatBanned() && Config.BAN_CHAT_CHANNELS.contains(type)) if (activeChar.isChatBanned() && Config.BAN_CHAT_CHANNELS.contains(type))
{ {
@@ -27,6 +27,8 @@ import org.l2jmobius.gameserver.enums.PlayerCondOverride;
import org.l2jmobius.gameserver.handler.IChatHandler; import org.l2jmobius.gameserver.handler.IChatHandler;
import org.l2jmobius.gameserver.model.World; import org.l2jmobius.gameserver.model.World;
import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.itemcontainer.Inventory;
import org.l2jmobius.gameserver.model.zone.ZoneId;
import org.l2jmobius.gameserver.network.SystemMessageId; import org.l2jmobius.gameserver.network.SystemMessageId;
import org.l2jmobius.gameserver.network.serverpackets.CreatureSay; import org.l2jmobius.gameserver.network.serverpackets.CreatureSay;
import org.l2jmobius.gameserver.network.serverpackets.ExWorldChatCnt; import org.l2jmobius.gameserver.network.serverpackets.ExWorldChatCnt;
@@ -46,7 +48,7 @@ public class ChatWorld implements IChatHandler
}; };
@Override @Override
public void handleChat(ChatType type, Player activeChar, String target, String text) public void handleChat(ChatType type, Player activeChar, String target, String text, boolean shareLocation)
{ {
if (!Config.ENABLE_WORLD_CHAT) if (!Config.ENABLE_WORLD_CHAT)
{ {
@@ -77,6 +79,14 @@ public class ChatWorld implements IChatHandler
{ {
activeChar.sendPacket(SystemMessageId.YOU_HAVE_SPENT_YOUR_WORLD_CHAT_QUOTA_FOR_THE_DAY_IT_IS_RESET_DAILY_AT_7_A_M); activeChar.sendPacket(SystemMessageId.YOU_HAVE_SPENT_YOUR_WORLD_CHAT_QUOTA_FOR_THE_DAY_IT_IS_RESET_DAILY_AT_7_A_M);
} }
else if (shareLocation && (activeChar.getInventory().getInventoryItemCount(Inventory.LCOIN_ID, -1) < Config.SHARING_LOCATION_COST))
{
activeChar.sendPacket(SystemMessageId.THERE_ARE_NOT_ENOUGH_L_COINS);
}
else if (shareLocation && ((activeChar.getMovieHolder() != null) || activeChar.isFishing() || activeChar.isInInstance() || activeChar.isOnEvent() || activeChar.isInOlympiadMode() || activeChar.inObserverMode() || activeChar.isInTraingCamp() || activeChar.isInTimedHuntingZone() || activeChar.isInsideZone(ZoneId.SIEGE)))
{
activeChar.sendPacket(SystemMessageId.LOCATION_CANNOT_BE_SHARED_SINCE_THE_CONDITIONS_ARE_NOT_MET);
}
else else
{ {
// Verify if player is not spaming. // Verify if player is not spaming.
@@ -93,7 +103,12 @@ public class ChatWorld implements IChatHandler
} }
} }
final CreatureSay cs = new CreatureSay(activeChar, type, activeChar.getName(), text); if (shareLocation)
{
activeChar.destroyItemByItemId("Shared Location", Inventory.LCOIN_ID, Config.SHARING_LOCATION_COST, activeChar, true);
}
final CreatureSay cs = new CreatureSay(activeChar, type, activeChar.getName(), text, shareLocation);
if (Config.FACTION_SYSTEM_ENABLED && Config.FACTION_SPECIFIC_CHAT) if (Config.FACTION_SYSTEM_ENABLED && Config.FACTION_SPECIFIC_CHAT)
{ {
if (activeChar.isGood()) if (activeChar.isGood())
@@ -2316,8 +2316,8 @@ public class Config
RESUME_AUTO_PLAY = generalConfig.getBoolean("ResumeAutoPlay", false); RESUME_AUTO_PLAY = generalConfig.getBoolean("ResumeAutoPlay", false);
SUBJUGATION_TOPIC_BODY = generalConfig.getString("SubjugationTopicBody", "Reward for being in the top of the best players in clearing the lands of Aden"); SUBJUGATION_TOPIC_BODY = generalConfig.getString("SubjugationTopicBody", "Reward for being in the top of the best players in clearing the lands of Aden");
SUBJUGATION_TOPIC_HEADER = generalConfig.getString("SubjugationTopicHeader", "Purge reward"); SUBJUGATION_TOPIC_HEADER = generalConfig.getString("SubjugationTopicHeader", "Purge reward");
SHARING_LOCATION_COST = generalConfig.getInt("ShareLocationLcoinCost", 1); SHARING_LOCATION_COST = generalConfig.getInt("ShareLocationLcoinCost", 50);
TELEPORT_SHARE_LOCATION_COST = generalConfig.getInt("TeleportShareLocationLcoinCost", 1); TELEPORT_SHARE_LOCATION_COST = generalConfig.getInt("TeleportShareLocationLcoinCost", 400);
// Load FloodProtector config file // Load FloodProtector config file
final PropertiesParser floodProtectorConfig = new PropertiesParser(FLOOD_PROTECTOR_CONFIG_FILE); final PropertiesParser floodProtectorConfig = new PropertiesParser(FLOOD_PROTECTOR_CONFIG_FILE);
@@ -146,7 +146,6 @@ import org.l2jmobius.gameserver.instancemanager.InstanceManager;
import org.l2jmobius.gameserver.instancemanager.ItemAuctionManager; import org.l2jmobius.gameserver.instancemanager.ItemAuctionManager;
import org.l2jmobius.gameserver.instancemanager.ItemCommissionManager; import org.l2jmobius.gameserver.instancemanager.ItemCommissionManager;
import org.l2jmobius.gameserver.instancemanager.ItemsOnGroundManager; import org.l2jmobius.gameserver.instancemanager.ItemsOnGroundManager;
import org.l2jmobius.gameserver.instancemanager.RankingPowerManager;
import org.l2jmobius.gameserver.instancemanager.MailManager; import org.l2jmobius.gameserver.instancemanager.MailManager;
import org.l2jmobius.gameserver.instancemanager.MapRegionManager; import org.l2jmobius.gameserver.instancemanager.MapRegionManager;
import org.l2jmobius.gameserver.instancemanager.MatchingRoomManager; import org.l2jmobius.gameserver.instancemanager.MatchingRoomManager;
@@ -159,8 +158,10 @@ import org.l2jmobius.gameserver.instancemanager.PunishmentManager;
import org.l2jmobius.gameserver.instancemanager.PurgeRankingManager; import org.l2jmobius.gameserver.instancemanager.PurgeRankingManager;
import org.l2jmobius.gameserver.instancemanager.QuestManager; import org.l2jmobius.gameserver.instancemanager.QuestManager;
import org.l2jmobius.gameserver.instancemanager.RankManager; import org.l2jmobius.gameserver.instancemanager.RankManager;
import org.l2jmobius.gameserver.instancemanager.RankingPowerManager;
import org.l2jmobius.gameserver.instancemanager.SellBuffsManager; import org.l2jmobius.gameserver.instancemanager.SellBuffsManager;
import org.l2jmobius.gameserver.instancemanager.ServerRestartManager; import org.l2jmobius.gameserver.instancemanager.ServerRestartManager;
import org.l2jmobius.gameserver.instancemanager.SharedTeleportManager;
import org.l2jmobius.gameserver.instancemanager.SiegeGuardManager; import org.l2jmobius.gameserver.instancemanager.SiegeGuardManager;
import org.l2jmobius.gameserver.instancemanager.SiegeManager; import org.l2jmobius.gameserver.instancemanager.SiegeManager;
import org.l2jmobius.gameserver.instancemanager.WalkingManager; import org.l2jmobius.gameserver.instancemanager.WalkingManager;
@@ -387,6 +388,7 @@ public class GameServer
HtmCache.getInstance(); HtmCache.getInstance();
CrestTable.getInstance(); CrestTable.getInstance();
TeleportListData.getInstance(); TeleportListData.getInstance();
SharedTeleportManager.getInstance();
PetTypesListData.getInstance(); PetTypesListData.getInstance();
TeleporterData.getInstance(); TeleporterData.getInstance();
TimedHuntingZoneData.getInstance(); TimedHuntingZoneData.getInstance();
@@ -31,8 +31,9 @@ public interface IChatHandler
* @param player * @param player
* @param target * @param target
* @param text * @param text
* @param shareLocation
*/ */
void handleChat(ChatType type, Player player, String target, String text); void handleChat(ChatType type, Player player, String target, String text, boolean shareLocation);
/** /**
* Returns a list of all chat types registered to this handler * Returns a list of all chat types registered to this handler
@@ -0,0 +1,69 @@
/*
* 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.instancemanager;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.logging.Logger;
import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.holders.SharedTeleportHolder;
/**
* Shared Teleport Manager
* @author NasSeKa
*/
public class SharedTeleportManager
{
protected static final Logger LOGGER = Logger.getLogger(SharedTeleportManager.class.getName());
private static final int TELEPORT_COUNT = 5;
private final Map<Integer, SharedTeleportHolder> _sharedTeleports = new ConcurrentHashMap<>();
private int _lastSharedTeleportId = 0;
protected SharedTeleportManager()
{
LOGGER.info(getClass().getSimpleName() + ": initialized.");
}
public SharedTeleportHolder getTeleport(int id)
{
return _sharedTeleports.get(id);
}
public synchronized int nextId(Creature creature)
{
final int nextId = ++_lastSharedTeleportId;
_sharedTeleports.put(nextId, new SharedTeleportHolder(nextId, creature.getName(), TELEPORT_COUNT, creature.getX(), creature.getY(), creature.getZ()));
return nextId;
}
/**
* Gets the single instance of {@code SharedTeleportManager}.
* @return single instance of {@code SharedTeleportManager}
*/
public static SharedTeleportManager getInstance()
{
return SingletonHolder.INSTANCE;
}
private static class SingletonHolder
{
protected static final SharedTeleportManager INSTANCE = new SharedTeleportManager();
}
}
@@ -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 org.l2jmobius.gameserver.model.holders;
import org.l2jmobius.gameserver.model.Location;
/**
* @author NasSeKa
*/
public class SharedTeleportHolder
{
private final int _id;
private final String _name;
private int _count;
private final Location _location;
public SharedTeleportHolder(int id, String name, int count, int x, int y, int z)
{
_id = id;
_name = name;
_count = count;
_location = new Location(x, y, z);
}
public int getId()
{
return _id;
}
public String getName()
{
return _name;
}
public int getCount()
{
return Math.max(0, _count);
}
public void decrementCount()
{
_count -= 1;
}
public Location getLocation()
{
return _location;
}
}
@@ -182,6 +182,7 @@ import org.l2jmobius.gameserver.network.clientpackets.subjugation.RequestSubjuga
import org.l2jmobius.gameserver.network.clientpackets.subjugation.RequestSubjugationGachaUI; import org.l2jmobius.gameserver.network.clientpackets.subjugation.RequestSubjugationGachaUI;
import org.l2jmobius.gameserver.network.clientpackets.subjugation.RequestSubjugationList; import org.l2jmobius.gameserver.network.clientpackets.subjugation.RequestSubjugationList;
import org.l2jmobius.gameserver.network.clientpackets.subjugation.RequestSubjugationRanking; import org.l2jmobius.gameserver.network.clientpackets.subjugation.RequestSubjugationRanking;
import org.l2jmobius.gameserver.network.clientpackets.teleports.ExRequestSharedLocationTeleport;
import org.l2jmobius.gameserver.network.clientpackets.teleports.ExRequestSharedLocationTeleportUi; import org.l2jmobius.gameserver.network.clientpackets.teleports.ExRequestSharedLocationTeleportUi;
import org.l2jmobius.gameserver.network.clientpackets.teleports.ExRequestSharingLocationUi; import org.l2jmobius.gameserver.network.clientpackets.teleports.ExRequestSharingLocationUi;
import org.l2jmobius.gameserver.network.clientpackets.teleports.ExRequestTeleport; import org.l2jmobius.gameserver.network.clientpackets.teleports.ExRequestTeleport;
@@ -631,7 +632,7 @@ public enum ExIncomingPackets implements IIncomingPackets<GameClient>
// 270 // 270
EX_SHARED_POSITION_SHARING_UI(0x1A1, ExRequestSharingLocationUi::new, ConnectionState.IN_GAME), EX_SHARED_POSITION_SHARING_UI(0x1A1, ExRequestSharingLocationUi::new, ConnectionState.IN_GAME),
EX_SHARED_POSITION_TELEPORT_UI(0x1A2, ExRequestSharedLocationTeleportUi::new, ConnectionState.IN_GAME), EX_SHARED_POSITION_TELEPORT_UI(0x1A2, ExRequestSharedLocationTeleportUi::new, ConnectionState.IN_GAME),
EX_SHARED_POSITION_TELEPORT(0x1A3, ExRequestSharedLocationTeleportUi::new, ConnectionState.IN_GAME), EX_SHARED_POSITION_TELEPORT(0x1A3, ExRequestSharedLocationTeleport::new, ConnectionState.IN_GAME),
EX_AUTH_RECONNECT(0x1A4, null, ConnectionState.IN_GAME), EX_AUTH_RECONNECT(0x1A4, null, ConnectionState.IN_GAME),
EX_PET_EQUIP_ITEM(0x1A5, ExPetEquipItem::new, ConnectionState.IN_GAME), EX_PET_EQUIP_ITEM(0x1A5, ExPetEquipItem::new, ConnectionState.IN_GAME),
EX_PET_UNEQUIP_ITEM(0x1A6, ExPetUnequipItem::new, ConnectionState.IN_GAME), EX_PET_UNEQUIP_ITEM(0x1A6, ExPetUnequipItem::new, ConnectionState.IN_GAME),
@@ -88,16 +88,18 @@ public class Say2 implements IClientIncomingPacket
private String _text; private String _text;
private int _type; private int _type;
private String _target; private String _target;
private boolean _shareLocation;
@Override @Override
public boolean read(GameClient client, PacketReader packet) public boolean read(GameClient client, PacketReader packet)
{ {
_text = packet.readS(); _text = packet.readS();
_type = packet.readD(); _type = packet.readD();
_shareLocation = packet.readC() == 1;
if (_type == ChatType.WHISPER.getClientId()) if (_type == ChatType.WHISPER.getClientId())
{ {
packet.readC();
_target = packet.readS(); _target = packet.readS();
_shareLocation = false;
} }
return true; return true;
} }
@@ -215,7 +217,7 @@ public class Say2 implements IClientIncomingPacket
final IChatHandler handler = ChatHandler.getInstance().getHandler(chatType); final IChatHandler handler = ChatHandler.getInstance().getHandler(chatType);
if (handler != null) if (handler != null)
{ {
handler.handleChat(chatType, player, _target, _text); handler.handleChat(chatType, player, _target, _text, _shareLocation);
} }
else else
{ {
@@ -0,0 +1,86 @@
/*
* 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.teleports;
import org.l2jmobius.Config;
import org.l2jmobius.commons.network.PacketReader;
import org.l2jmobius.gameserver.instancemanager.SharedTeleportManager;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.holders.SharedTeleportHolder;
import org.l2jmobius.gameserver.model.itemcontainer.Inventory;
import org.l2jmobius.gameserver.model.zone.ZoneId;
import org.l2jmobius.gameserver.network.GameClient;
import org.l2jmobius.gameserver.network.SystemMessageId;
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
/**
* @author NasSeKa
*/
public class ExRequestSharedLocationTeleport implements IClientIncomingPacket
{
private int _id;
@Override
public boolean read(GameClient client, PacketReader packet)
{
_id = (packet.readD() - 1) / 256;
return true;
}
@Override
public void run(GameClient client)
{
final Player player = client.getPlayer();
if (player == null)
{
return;
}
final SharedTeleportHolder teleport = SharedTeleportManager.getInstance().getTeleport(_id);
if ((teleport == null) || (teleport.getCount() == 0))
{
player.sendPacket(SystemMessageId.TELEPORTATION_LIMIT_FOR_THE_COORDINATES_RECEIVED_IS_REACHED);
return;
}
if (player.getName().equals(teleport.getName()))
{
player.sendPacket(SystemMessageId.YOU_CANNOT_TELEPORT_TO_YOURSELF);
return;
}
if (player.getInventory().getInventoryItemCount(Inventory.LCOIN_ID, -1) < Config.TELEPORT_SHARE_LOCATION_COST)
{
player.sendPacket(SystemMessageId.THERE_ARE_NOT_ENOUGH_L_COINS);
return;
}
if ((player.getMovieHolder() != null) || player.isFishing() || player.isInInstance() || player.isOnEvent() || player.isInOlympiadMode() || player.inObserverMode() || player.isInTraingCamp() || player.isInTimedHuntingZone() || player.isInsideZone(ZoneId.SIEGE))
{
player.sendPacket(SystemMessageId.YOU_CANNOT_TELEPORT_RIGHT_NOW);
return;
}
if (player.destroyItemByItemId("Shared Location", Inventory.LCOIN_ID, Config.TELEPORT_SHARE_LOCATION_COST, player, true))
{
teleport.decrementCount();
player.abortCast();
player.stopMove(null);
player.teleToLocation(teleport.getLocation());
}
}
}
@@ -17,19 +17,24 @@
package org.l2jmobius.gameserver.network.clientpackets.teleports; package org.l2jmobius.gameserver.network.clientpackets.teleports;
import org.l2jmobius.commons.network.PacketReader; import org.l2jmobius.commons.network.PacketReader;
import org.l2jmobius.gameserver.instancemanager.SharedTeleportManager;
import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.holders.SharedTeleportHolder;
import org.l2jmobius.gameserver.network.GameClient; import org.l2jmobius.gameserver.network.GameClient;
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket; import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
import org.l2jmobius.gameserver.network.serverpackets.teleports.ExShowSharedLocationTeleportUi; import org.l2jmobius.gameserver.network.serverpackets.teleports.ExShowSharedLocationTeleportUi;
/** /**
* @author GustavoFonseca * @author NasSeKa
*/ */
public class ExRequestSharedLocationTeleportUi implements IClientIncomingPacket public class ExRequestSharedLocationTeleportUi implements IClientIncomingPacket
{ {
private int _id;
@Override @Override
public boolean read(GameClient client, PacketReader packet) public boolean read(GameClient client, PacketReader packet)
{ {
_id = (packet.readD() - 1) / 256;
return true; return true;
} }
@@ -42,6 +47,12 @@ public class ExRequestSharedLocationTeleportUi implements IClientIncomingPacket
return; return;
} }
client.sendPacket(new ExShowSharedLocationTeleportUi()); final SharedTeleportHolder teleport = SharedTeleportManager.getInstance().getTeleport(_id);
if (teleport == null)
{
return;
}
player.sendPacket(new ExShowSharedLocationTeleportUi(teleport));
} }
} }
@@ -42,6 +42,6 @@ public class ExRequestSharingLocationUi implements IClientIncomingPacket
return; return;
} }
client.sendPacket(new ExShowSharingLocationUi()); player.sendPacket(new ExShowSharingLocationUi());
} }
} }
@@ -23,6 +23,7 @@ import org.l2jmobius.commons.network.PacketWriter;
import org.l2jmobius.gameserver.enums.ChatType; import org.l2jmobius.gameserver.enums.ChatType;
import org.l2jmobius.gameserver.instancemanager.MentorManager; import org.l2jmobius.gameserver.instancemanager.MentorManager;
import org.l2jmobius.gameserver.instancemanager.RankManager; import org.l2jmobius.gameserver.instancemanager.RankManager;
import org.l2jmobius.gameserver.instancemanager.SharedTeleportManager;
import org.l2jmobius.gameserver.model.actor.Creature; import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.clan.Clan; import org.l2jmobius.gameserver.model.clan.Clan;
@@ -40,6 +41,7 @@ public class CreatureSay implements IClientOutgoingPacket
private int _messageId = -1; private int _messageId = -1;
private int _mask; private int _mask;
private List<String> _parameters; private List<String> _parameters;
private boolean _shareLocation;
/** /**
* @param sender * @param sender
@@ -49,11 +51,25 @@ public class CreatureSay implements IClientOutgoingPacket
* @param text * @param text
*/ */
public CreatureSay(Player sender, Player receiver, String name, ChatType chatType, String text) public CreatureSay(Player sender, Player receiver, String name, ChatType chatType, String text)
{
this(sender, receiver, name, chatType, text, false);
}
/**
* @param sender
* @param receiver
* @param name
* @param chatType
* @param text
* @param shareLocation
*/
public CreatureSay(Player sender, Player receiver, String name, ChatType chatType, String text, boolean shareLocation)
{ {
_sender = sender; _sender = sender;
_senderName = name; _senderName = name;
_chatType = chatType; _chatType = chatType;
_text = text; _text = text;
_shareLocation = shareLocation;
if (receiver != null) if (receiver != null)
{ {
if (receiver.getFriendList().contains(sender.getObjectId())) if (receiver.getFriendList().contains(sender.getObjectId()))
@@ -81,11 +97,17 @@ public class CreatureSay implements IClientOutgoingPacket
} }
public CreatureSay(Creature sender, ChatType chatType, String senderName, String text) public CreatureSay(Creature sender, ChatType chatType, String senderName, String text)
{
this(sender, chatType, senderName, text, false);
}
public CreatureSay(Creature sender, ChatType chatType, String senderName, String text, boolean shareLocation)
{ {
_sender = sender; _sender = sender;
_chatType = chatType; _chatType = chatType;
_senderName = senderName; _senderName = senderName;
_text = text; _text = text;
_shareLocation = shareLocation;
} }
public CreatureSay(Creature sender, ChatType chatType, NpcStringId npcStringId) public CreatureSay(Creature sender, ChatType chatType, NpcStringId npcStringId)
@@ -162,6 +184,7 @@ public class CreatureSay implements IClientOutgoingPacket
{ {
packet.writeC(0); // unknown clan byte packet.writeC(0); // unknown clan byte
} }
final int rank = RankManager.getInstance().getPlayerGlobalRank(_sender.getActingPlayer()); final int rank = RankManager.getInstance().getPlayerGlobalRank(_sender.getActingPlayer());
if ((rank == 0) || (rank > 100)) if ((rank == 0) || (rank > 100))
{ {
@@ -187,6 +210,12 @@ public class CreatureSay implements IClientOutgoingPacket
{ {
packet.writeC(0); packet.writeC(0);
} }
if (_shareLocation)
{
packet.writeC(1);
packet.writeH(SharedTeleportManager.getInstance().nextId(_sender));
}
} }
else else
{ {
@@ -100,7 +100,7 @@ public class ExBasicActionList implements IClientOutgoingPacket
81, 82, 83, 84, 81, 82, 83, 84,
85, 86, 87, 88, 85, 86, 87, 88,
89, 90, 92, 93, 89, 90, 92, 93,
94, 96, 97, 94, 96, 97, 99,
1000, 1001, 1000, 1001,
1002, 1003, 1004, 1005, 1002, 1003, 1004, 1005,
1006, 1007, 1008, 1009, 1006, 1007, 1008, 1009,
@@ -17,24 +17,33 @@
package org.l2jmobius.gameserver.network.serverpackets.teleports; package org.l2jmobius.gameserver.network.serverpackets.teleports;
import org.l2jmobius.commons.network.PacketWriter; import org.l2jmobius.commons.network.PacketWriter;
import org.l2jmobius.gameserver.model.holders.SharedTeleportHolder;
import org.l2jmobius.gameserver.network.OutgoingPackets; import org.l2jmobius.gameserver.network.OutgoingPackets;
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket; import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
/** /**
* @author Gustavo Fonseca * @author NasSeKa
*/ */
public class ExShowSharedLocationTeleportUi implements IClientOutgoingPacket public class ExShowSharedLocationTeleportUi implements IClientOutgoingPacket
{ {
public static final ExShowSharedLocationTeleportUi STATIC_PACKET = new ExShowSharedLocationTeleportUi(); private final SharedTeleportHolder _teleport;
public ExShowSharedLocationTeleportUi() public ExShowSharedLocationTeleportUi(SharedTeleportHolder teleport)
{ {
_teleport = teleport;
} }
@Override @Override
public boolean write(PacketWriter packet) public boolean write(PacketWriter packet)
{ {
OutgoingPackets.EX_SHARED_POSITION_TELEPORT_UI.writeId(packet); OutgoingPackets.EX_SHARED_POSITION_TELEPORT_UI.writeId(packet);
packet.writeString(_teleport.getName());
packet.writeD(_teleport.getId());
packet.writeD(_teleport.getCount());
packet.writeH(150);
packet.writeD(_teleport.getLocation().getX());
packet.writeD(_teleport.getLocation().getY());
packet.writeD(_teleport.getLocation().getZ());
return true; return true;
} }
} }