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

View File

@@ -21,6 +21,8 @@ import org.l2jmobius.gameserver.enums.ChatType;
import org.l2jmobius.gameserver.enums.PlayerCondOverride;
import org.l2jmobius.gameserver.handler.IChatHandler;
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.serverpackets.CreatureSay;
@@ -35,7 +37,7 @@ public class ChatAlliance implements IChatHandler
};
@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)))
{
@@ -53,7 +55,25 @@ public class ChatAlliance implements IChatHandler
activeChar.sendPacket(SystemMessageId.CHATTING_IS_CURRENTLY_PROHIBITED);
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

View File

@@ -21,6 +21,8 @@ import org.l2jmobius.gameserver.enums.ChatType;
import org.l2jmobius.gameserver.enums.PlayerCondOverride;
import org.l2jmobius.gameserver.handler.IChatHandler;
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.serverpackets.CreatureSay;
@@ -36,7 +38,7 @@ public class ChatClan implements IChatHandler
};
@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)
{
@@ -54,7 +56,25 @@ public class ChatClan implements IChatHandler
activeChar.sendPacket(SystemMessageId.CHATTING_IS_CURRENTLY_PROHIBITED);
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

View File

@@ -27,6 +27,8 @@ import org.l2jmobius.gameserver.handler.VoicedCommandHandler;
import org.l2jmobius.gameserver.model.BlockList;
import org.l2jmobius.gameserver.model.World;
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.serverpackets.CreatureSay;
import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
@@ -43,7 +45,7 @@ public class ChatGeneral implements IChatHandler
};
@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;
if (text.startsWith("."))
@@ -87,8 +89,26 @@ public class ChatGeneral implements IChatHandler
return;
}
final CreatureSay cs = new CreatureSay(activeChar, type, activeChar.getAppearance().getVisibleName(), text);
final CreatureSay csRandom = new CreatureSay(activeChar, type, activeChar.getAppearance().getVisibleName(), ChatRandomizer.randomize(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.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 ->
{
if ((player != null) && !BlockList.isBlocked(player, activeChar))

View File

@@ -38,7 +38,7 @@ public class ChatHeroVoice implements IChatHandler
};
@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))
{
@@ -62,7 +62,7 @@ public class ChatHeroVoice implements IChatHandler
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())
{
if ((player != null) && !BlockList.isBlocked(player, activeChar))

View File

@@ -21,6 +21,8 @@ import org.l2jmobius.gameserver.enums.ChatType;
import org.l2jmobius.gameserver.enums.PlayerCondOverride;
import org.l2jmobius.gameserver.handler.IChatHandler;
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.serverpackets.CreatureSay;
@@ -36,7 +38,7 @@ public class ChatParty implements IChatHandler
};
@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())
{
@@ -54,7 +56,25 @@ public class ChatParty implements IChatHandler
activeChar.sendPacket(SystemMessageId.CHATTING_IS_CURRENTLY_PROHIBITED);
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

View File

@@ -37,7 +37,7 @@ public class ChatPartyMatchRoom implements IChatHandler
};
@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();
if (room != null)
@@ -53,7 +53,7 @@ public class ChatPartyMatchRoom implements IChatHandler
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())
{
if (Config.FACTION_SYSTEM_ENABLED)

View File

@@ -36,7 +36,7 @@ public class ChatPartyRoomAll implements IChatHandler
};
@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))
{
@@ -50,7 +50,7 @@ public class ChatPartyRoomAll implements IChatHandler
activeChar.sendPacket(SystemMessageId.CHATTING_IS_CURRENTLY_PROHIBITED);
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);
}
}

View File

@@ -36,7 +36,7 @@ public class ChatPartyRoomCommander implements IChatHandler
};
@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))
{
@@ -50,7 +50,7 @@ public class ChatPartyRoomCommander implements IChatHandler
activeChar.sendPacket(SystemMessageId.CHATTING_IS_CURRENTLY_PROHIBITED);
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);
}
}

View File

@@ -37,7 +37,7 @@ public class ChatPetition implements IChatHandler
};
@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))
{

View File

@@ -24,6 +24,8 @@ import org.l2jmobius.gameserver.instancemanager.MapRegionManager;
import org.l2jmobius.gameserver.model.BlockList;
import org.l2jmobius.gameserver.model.World;
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.serverpackets.CreatureSay;
import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
@@ -40,7 +42,7 @@ public class ChatShout implements IChatHandler
};
@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))
{
@@ -58,7 +60,24 @@ public class ChatShout implements IChatHandler
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)))
{
final int region = MapRegionManager.getInstance().getMapRegionLocId(activeChar);

View File

@@ -24,6 +24,8 @@ import org.l2jmobius.gameserver.instancemanager.MapRegionManager;
import org.l2jmobius.gameserver.model.BlockList;
import org.l2jmobius.gameserver.model.World;
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.serverpackets.CreatureSay;
import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
@@ -40,7 +42,7 @@ public class ChatTrade implements IChatHandler
};
@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))
{
@@ -58,7 +60,24 @@ public class ChatTrade implements IChatHandler
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)))
{
final int region = MapRegionManager.getInstance().getMapRegionLocId(activeChar);

View File

@@ -41,7 +41,7 @@ public class ChatWhisper implements IChatHandler
};
@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))
{

View File

@@ -27,6 +27,8 @@ import org.l2jmobius.gameserver.enums.PlayerCondOverride;
import org.l2jmobius.gameserver.handler.IChatHandler;
import org.l2jmobius.gameserver.model.World;
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.serverpackets.CreatureSay;
import org.l2jmobius.gameserver.network.serverpackets.ExWorldChatCnt;
@@ -46,7 +48,7 @@ public class ChatWorld implements IChatHandler
};
@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)
{
@@ -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);
}
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
{
// 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 (activeChar.isGood())