From d5176b2eec89e9942125c48cae6b77ffa8488a82 Mon Sep 17 00:00:00 2001 From: Bella Date: Thu, 12 Mar 2020 20:59:54 -0400 Subject: [PATCH] add leetspeek mode to fancychat --- .../modules/experimental/FancyChat.java | 34 ++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/src/main/java/me/zeroeightsix/kami/module/modules/experimental/FancyChat.java b/src/main/java/me/zeroeightsix/kami/module/modules/experimental/FancyChat.java index 8398b314..58bda64b 100644 --- a/src/main/java/me/zeroeightsix/kami/module/modules/experimental/FancyChat.java +++ b/src/main/java/me/zeroeightsix/kami/module/modules/experimental/FancyChat.java @@ -29,7 +29,7 @@ public class FancyChat extends Module { case UWU: return "Error: UWU mode is still experimental"; case LEET: - return "Error: LEET mode is still experimental"; + return leetConverter(s); case MOCKING: return mockingConverter(s); default: @@ -45,6 +45,17 @@ public class FancyChat extends Module { // input.replace("a", "b"); // } + private String leetConverter(String input) { + StringBuilder message = new StringBuilder(); + for (int i = 0 ; i < input.length() ; i++) { + String inputChar = input.charAt(i) + ""; + inputChar = inputChar.toLowerCase(); + inputChar = leetSwitch(inputChar); + message.append(inputChar); + } + return message.toString(); + } + private String mockingConverter(String input) { StringBuilder message = new StringBuilder(); for (int i = 0 ; i < input.length() ; i++) { @@ -79,4 +90,25 @@ public class FancyChat extends Module { } private boolean isNumberEven(int i) { return (i & 1) == 0; } + + private String leetSwitch(String i) { + switch (i) { + case "a": + return "4"; + case "e": + return "3"; + case "g": + return "6"; + case "l": + case "i": + return "1"; + case "o": + return "0"; + case "s": + return "5"; + case "t": + return "7"; + default: return i; + } + } }