Implement "view visitor" packet
This commit is contained in:
@@ -685,11 +685,15 @@ public final class PlayerInteractionHandler extends AbstractPacketHandler {
|
||||
|
||||
merchant.withdrawMesos(chr);
|
||||
|
||||
} else if (mode == Action.VIEW_VISITORS.getCode()) {
|
||||
List<String> visitorNames = List.of("Dwayne", "Ruben", "Ada", "Clifton", "Beatrice", "Kent", "Max",
|
||||
"Cecelia", "Edward", "Cory");
|
||||
c.sendPacket(PacketCreator.viewMerchantVisitors(visitorNames));
|
||||
} 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));
|
||||
c.sendPacket(PacketCreator.viewMerchantBlacklist(blacklistedNames));
|
||||
} else if (mode == Action.MERCHANT_ORGANIZE.getCode()) {
|
||||
HiredMerchant merchant = chr.getHiredMerchant();
|
||||
if (merchant == null || !merchant.isOwner(chr)) {
|
||||
|
||||
@@ -76,6 +76,7 @@ import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -5203,10 +5204,25 @@ public class PacketCreator {
|
||||
return p;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param chrNames Merchant visitors. The first 10 names will be shown,
|
||||
* everything beyond will layered over each other at the top of the window.
|
||||
*/
|
||||
public static Packet viewMerchantVisitors(List<String> chrNames) {
|
||||
final OutPacket p = OutPacket.create(SendOpcode.PLAYER_INTERACTION);
|
||||
p.writeByte(PlayerInteractionHandler.Action.VIEW_VISITORS.getCode());
|
||||
p.writeShort(chrNames.size());
|
||||
for (String chrName : chrNames) {
|
||||
p.writeString(chrName);
|
||||
p.writeInt((int) (TimeUnit.HOURS.toMillis(1) + TimeUnit.MINUTES.toMillis(23))); // milliseconds, displayed as hours+minutes
|
||||
}
|
||||
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) {
|
||||
public static Packet viewMerchantBlacklist(List<String> chrNames) {
|
||||
final OutPacket p = OutPacket.create(SendOpcode.PLAYER_INTERACTION);
|
||||
p.writeByte(PlayerInteractionHandler.Action.VIEW_BLACKLIST.getCode());
|
||||
p.writeShort(chrNames.size());
|
||||
|
||||
Reference in New Issue
Block a user