From b3b45e3e1a4733bd0a77450db53a27816fa32cf5 Mon Sep 17 00:00:00 2001 From: Z61 Date: Thu, 7 May 2015 19:56:07 -0400 Subject: [PATCH 1/5] Fixed part of CORE-95 (ui_name_declined_fictionally_reserved). Also added fiction reserved check. Will need names added to that. --- namegen/fiction_reserved.txt | 3 +++ .../creation/ClientVerifyAndLockNameResponse.java | 3 ++- .../login/creation/CreateCharacterFailure.java | 8 +++++++- src/resources/zone/NameFilter.java | 15 +++++++++++---- src/services/player/ZoneService.java | 10 ++++++++-- 5 files changed, 31 insertions(+), 8 deletions(-) create mode 100644 namegen/fiction_reserved.txt diff --git a/namegen/fiction_reserved.txt b/namegen/fiction_reserved.txt new file mode 100644 index 000000000..243f54a9e --- /dev/null +++ b/namegen/fiction_reserved.txt @@ -0,0 +1,3 @@ +Han +Solo +Skywalker \ No newline at end of file diff --git a/src/network/packets/swg/login/creation/ClientVerifyAndLockNameResponse.java b/src/network/packets/swg/login/creation/ClientVerifyAndLockNameResponse.java index 67bc296f5..d5a0613ab 100644 --- a/src/network/packets/swg/login/creation/ClientVerifyAndLockNameResponse.java +++ b/src/network/packets/swg/login/creation/ClientVerifyAndLockNameResponse.java @@ -83,7 +83,8 @@ public class ClientVerifyAndLockNameResponse extends SWGPacket { NAME_DECLINED_INTERNAL_ERROR, NAME_DECLINED_RETRY, NAME_DECLINED_TOO_FAST, - NAME_DECLINED_NOT_AUTHORIZED_FOR_SPECIES; + NAME_DECLINED_NOT_AUTHORIZED_FOR_SPECIES, + NAME_DECLINED_FICTIONALLY_RESERVED; } } diff --git a/src/network/packets/swg/login/creation/CreateCharacterFailure.java b/src/network/packets/swg/login/creation/CreateCharacterFailure.java index fe7fc84d4..f2f6349bc 100644 --- a/src/network/packets/swg/login/creation/CreateCharacterFailure.java +++ b/src/network/packets/swg/login/creation/CreateCharacterFailure.java @@ -69,10 +69,14 @@ public class CreateCharacterFailure extends SWGPacket { return "name_declined_in_use"; case NAME_RETRY: return "name_declined_retry"; + case NAME_FICTIONALLY_INAPPRORIATE: + return "name_declined_syntax"; case NAME_SYNTAX: return "name_declined_syntax"; case NAME_TOO_FAST: return "name_declined_too_fast"; + case NAME_DEV_RESERVED: + return "name_declined_developer"; } return "name_declined_retry"; } @@ -82,6 +86,8 @@ public class CreateCharacterFailure extends SWGPacket { NAME_TOO_FAST, NAME_RETRY, NAME_SYNTAX, - NAME_IN_USE + NAME_IN_USE, + NAME_FICTIONALLY_INAPPRORIATE, + NAME_DEV_RESERVED; } } diff --git a/src/resources/zone/NameFilter.java b/src/resources/zone/NameFilter.java index 2e42b6ef9..3778dac08 100644 --- a/src/resources/zone/NameFilter.java +++ b/src/resources/zone/NameFilter.java @@ -41,24 +41,29 @@ public class NameFilter { private static final int [] MAX_ALLOWED = new int[] {1 , 1, 1}; private final List profaneWords; private final List reservedWords; + private final List fictionNames; private final File profaneFile; private final File reservedFile; + private final File fictionFile; - public NameFilter(String badWordsPath, String reservedPath) { - this(new File(badWordsPath), new File(reservedPath)); + public NameFilter(String badWordsPath, String reservedPath, String fictionPath) { + this(new File(badWordsPath), new File(reservedPath), new File(fictionPath)); } - public NameFilter(File badWordsFile, File reservedFile) { + public NameFilter(File badWordsFile, File reservedFile, File fictionFile) { this.profaneFile = badWordsFile; this.reservedFile = reservedFile; + this.fictionFile = fictionFile; this.profaneWords = new ArrayList(); this.reservedWords = new ArrayList(); + this.fictionNames = new ArrayList(); } public boolean load() { boolean success = true; success = load(profaneWords, profaneFile) && success; success = load(reservedWords, reservedFile) && success; + success = load(fictionNames, fictionFile) && success; return success; } @@ -114,7 +119,9 @@ public class NameFilter { public boolean isReserved(String name) { return contains(reservedWords, name); } - + public boolean isFictionallyReserved(String name) { + return contains(fictionNames, name); + } public boolean isFictionallyInappropriate(String name) { boolean space = true; for (int i = 0; i < name.length(); i++) { diff --git a/src/services/player/ZoneService.java b/src/services/player/ZoneService.java index ff2a4733e..d006661a1 100644 --- a/src/services/player/ZoneService.java +++ b/src/services/player/ZoneService.java @@ -97,7 +97,7 @@ public class ZoneService extends Service { public ZoneService() { clientFac = new ClientFactory(); - nameFilter = new NameFilter("namegen/bad_word_list.txt", "namegen/reserved_words.txt"); + nameFilter = new NameFilter("namegen/bad_word_list.txt", "namegen/reserved_words.txt", "namegen/fiction_reserved.txt"); nameGenerator = new SWGNameGenerator(nameFilter); } @@ -214,6 +214,10 @@ public class ZoneService extends Service { reason = NameFailureReason.NAME_IN_USE; else if (err == ErrorMessage.NAME_DECLINED_EMPTY) reason = NameFailureReason.NAME_DECLINED_EMPTY; + else if (err == ErrorMessage.NAME_DECLINED_FICTIONALLY_INAPPROPRIATE) + reason = NameFailureReason.NAME_FICTIONALLY_INAPPRORIATE; + else if (err == ErrorMessage.NAME_DECLINED_RESERVED) + reason = NameFailureReason.NAME_DEV_RESERVED; System.err.println("ZoneService: Unable to create character [Name: " + create.getName() + " User: " + player.getUsername() + "] and put into database! Reason: " + err); sendPacket(player, new CreateCharacterFailure(reason)); } @@ -246,11 +250,13 @@ public class ZoneService extends Service { if (nameFilter.isProfanity(modified)) // Contains profanity return ErrorMessage.NAME_DECLINED_PROFANE; if (nameFilter.isFictionallyInappropriate(modified)) - return ErrorMessage.NAME_DECLINED_FICTIONALLY_INAPPROPRIATE; + return ErrorMessage.NAME_DECLINED_SYNTAX; if (nameFilter.isReserved(modified) && !admin) return ErrorMessage.NAME_DECLINED_RESERVED; if (characterExistsForName(modified)) // User already exists. return ErrorMessage.NAME_DECLINED_IN_USE; + if (nameFilter.isFictionallyReserved(modified)) + return ErrorMessage.NAME_DECLINED_FICTIONALLY_RESERVED; if (!modified.equals(name)) // If we needed to remove double spaces, trim the ends, etc return ErrorMessage.NAME_APPROVED_MODIFIED; return ErrorMessage.NAME_APPROVED; From 3bd55d62bf113416343584c80e2a622d7694df01 Mon Sep 17 00:00:00 2001 From: Ziggy Date: Fri, 8 May 2015 12:16:39 +0200 Subject: [PATCH 2/5] Fixed CORE-87 'Mails become unread again after relog' --- src/services/chat/ChatService.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/services/chat/ChatService.java b/src/services/chat/ChatService.java index 63257ea37..868dd9dba 100644 --- a/src/services/chat/ChatService.java +++ b/src/services/chat/ChatService.java @@ -285,6 +285,7 @@ public class ChatService extends Service { if (mail.getReceiverId() != player.getCreatureObject().getObjectId()) return; + mail.setStatus(Mail.READ); sendPersistentMessage(player, mail, MailFlagType.FULL_MESSAGE, galaxy); } From 4ad69ccf378066f679f22359f73c35f6601b5537 Mon Sep 17 00:00:00 2001 From: Ziggy Date: Fri, 8 May 2015 13:22:13 +0200 Subject: [PATCH 3/5] Fixed an issue where boss creatures would be displayed as Elite creatures --- src/resources/objects/creature/CreatureDifficulty.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/resources/objects/creature/CreatureDifficulty.java b/src/resources/objects/creature/CreatureDifficulty.java index eed29888c..7313ada97 100644 --- a/src/resources/objects/creature/CreatureDifficulty.java +++ b/src/resources/objects/creature/CreatureDifficulty.java @@ -30,7 +30,7 @@ package resources.objects.creature; public enum CreatureDifficulty { NORMAL (0x00), ELITE (0x01), - BOSS (0x01); + BOSS (0x02); private int difficulty; From 0ae8ceba2355f98bc13084ea6799e0ee164313d3 Mon Sep 17 00:00:00 2001 From: Ziggy Date: Fri, 8 May 2015 18:45:39 +0200 Subject: [PATCH 4/5] Reverted Posture.java --- src/resources/Posture.java | 70 +++++++++++++++++++++++--------------- 1 file changed, 42 insertions(+), 28 deletions(-) diff --git a/src/resources/Posture.java b/src/resources/Posture.java index 957467235..9b8479784 100644 --- a/src/resources/Posture.java +++ b/src/resources/Posture.java @@ -27,37 +27,51 @@ ***********************************************************************************/ package resources; +import java.util.Hashtable; +import java.util.Map; + public enum Posture { - INVALID, // 0xFFFFFFFFFFFFFFFF - UPRIGHT, // 0x00 - CROUCHED, // 0x01 - PRONE, // 0x02 - SNEAKING, // 0x03 - BLOCKING, // 0x04 - CLIMBING, // 0x05 - FLYING, // 0x06 - LYING_DOWN, // 0x07 - SITTING, // 0x08 - SKILL_ANIMATING, // 0x09 - DRIVING_VEHICLE, // 0x0A - RIDING_CREATURE, // 0x0B - KNOCKED_DOWN, // 0x0C - INCAPACITATED, // 0x0D - DEAD; // 0x0E + UPRIGHT (0x00), + CROUCHED (0x01), + PRONE (0x02), + SNEAKING (0x03), + BLOCKING (0x04), + CLIMBING (0x05), + FLYING (0x06), + LYING_DOWN (0x07), + SITTING (0x08), + SKILL_ANIMATING (0x09), + DRIVING_VEHICLE (0x0A), + RIDING_CREATURE (0x0B), + KNOCKED_DOWN (0x0C), + INCAPACITATED (0x0D), + DEAD (0x0E), + INVALID (0x0E); - private static final byte OFFSET = 1; + private static final Map POSTURE_MAP = new Hashtable(15); + private byte id; - /** - * Is the exact same as calling Enum.ordinal(), subtracting 1 and casting the result to a byte. - * @return the ID for this posture - */ - public byte getId() { return (byte) (ordinal() - OFFSET); } + static { + for (Posture p : values()) { + if (p != INVALID) + POSTURE_MAP.put(p.getId(), p); + } + } - /** - * @param id for the Posture - * @return the Posture enum that has this id - * @throws ArrayIndexOutOfBoundsException if this ID doesn't point to a valid posture. - */ - public static final Posture getFromId(byte id) { return values()[id + OFFSET]; } + Posture(int id) { + this.id = (byte)id; + } + + public byte getId() { return id; } + + public static final Posture getFromId(byte id) { + Posture p = null; + synchronized (POSTURE_MAP) { + p = POSTURE_MAP.get(id); + } + if (p == null) + return INVALID; + return p; + } } From 0a741c6a9aa7f191746e458efd1089c38fad8db6 Mon Sep 17 00:00:00 2001 From: Undercova Date: Fri, 8 May 2015 19:04:15 +0000 Subject: [PATCH 5/5] changed reserved_words.txt --- namegen/reserved_words.txt | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/namegen/reserved_words.txt b/namegen/reserved_words.txt index 5c1df8d66..879462d56 100644 --- a/namegen/reserved_words.txt +++ b/namegen/reserved_words.txt @@ -2,10 +2,7 @@ undercova obique waverunner ilikenwf -nergmada skorpios telsia -tacef -pyron rydex -carnor -stryker +fusion +tosteto \ No newline at end of file