Implement "view blacklist" packet

This commit is contained in:
P0nk
2021-09-27 22:00:42 +02:00
parent 37899c2508
commit edc457d5f5
2 changed files with 23 additions and 1 deletions

View File

@@ -44,6 +44,7 @@ import tools.PacketCreator;
import java.awt.*;
import java.sql.SQLException;
import java.util.Arrays;
import java.util.List;
/**
* @author Matze
@@ -83,7 +84,9 @@ public final class PlayerInteractionHandler extends AbstractPacketHandler {
MERCHANT_MESO(0x2B),
SOMETHING(0x2D),
VIEW_VISITORS(0x2E),
BLACKLIST(0x2F),
VIEW_BLACKLIST(0x2F),
ADD_TO_BLACKLIST(0x30),
REMOVE_FROM_BLACKLIST(0x31),
REQUEST_TIE(0x32),
ANSWER_TIE(0x33),
GIVE_UP(0x34),
@@ -681,6 +684,12 @@ public final class PlayerInteractionHandler extends AbstractPacketHandler {
}
merchant.withdrawMesos(chr);
} else if (mode == Action.VIEW_BLACKLIST.getCode()) {
List<String> blacklistedNames = List.of("Blanca", "Betsy", "Kevin", "Rosa", "Evan", "Terence",
"Cecilia", "Gayle", "Erma", "Dorothy", "Willis", "Alberta", "Marilyn", "Myron", "Sheryl",
"Marco", "Jose", "Kendra", "Laurence", "Victoria", "NonListed");
c.sendPacket(PacketCreator.viewBlacklist(blacklistedNames));
} else if (mode == Action.MERCHANT_ORGANIZE.getCode()) {
HiredMerchant merchant = chr.getHiredMerchant();
if (merchant == null || !merchant.isOwner(chr)) {

View File

@@ -5203,6 +5203,19 @@ public class PacketCreator {
return p;
}
/**
* @param chrNames Blacklisted names. The first 20 names will be displayed, anything beyond does no difference.
*/
public static Packet viewBlacklist(List<String> chrNames) {
final OutPacket p = OutPacket.create(SendOpcode.PLAYER_INTERACTION);
p.writeByte(PlayerInteractionHandler.Action.VIEW_BLACKLIST.getCode());
p.writeShort(chrNames.size());
for (String chrName : chrNames) {
p.writeString(chrName);
}
return p;
}
public static Packet hiredMerchantVisitorAdd(Character chr, int slot) {
final OutPacket p = OutPacket.create(SendOpcode.PLAYER_INTERACTION);
p.writeByte(PlayerInteractionHandler.Action.VISIT.getCode());