Push the new mutant code, now with a whole lot more diversity~

This commit is contained in:
ave 2019-01-22 23:49:28 +03:00
parent 1e33f68eb4
commit ccd84dde66
No known key found for this signature in database
GPG key ID: 09356ABAA42C842B
7 changed files with 1444 additions and 188 deletions

View file

@ -27,7 +27,7 @@ If you ever want to move back to official Discord builds or want to move to your
- Get apktool - Get apktool
- Get a keystore, see [here](https://stackoverflow.com/a/14994354/3286892), step 1. - Get a keystore, see [here](https://stackoverflow.com/a/14994354/3286892), step 1.
- Get 72x72 copies of latest version of mutant standard emojis with codepoints. I have a zip [here](https://mutant.lavatech.top/72x72.zip). - If you want Mutant Standard emoji patches, get 72x72 copies of latest version of mutant standard emojis with codepoints. I have a zip [here](https://mutant.lavatech.top/72x72.zip).
- Extract the emojis you got somewhere. - Extract the emojis you got somewhere.
- Clone this repo somewhere, edit `emojireplace.py` and set the `extracted_mutstd_path` folder to the folder you just extracted emojis to. - Clone this repo somewhere, edit `emojireplace.py` and set the `extracted_mutstd_path` folder to the folder you just extracted emojis to.
@ -38,8 +38,8 @@ If you ever want to move back to official Discord builds or want to move to your
- Get all the necessary patches for that version. Necessary patches are not available for all versions and are only required to get some versions to pack together correctly. - Get all the necessary patches for that version. Necessary patches are not available for all versions and are only required to get some versions to pack together correctly.
- Get optional patches you want for your version. If the patch you want isn't available for your version, you'll have to port them yourself. - Get optional patches you want for your version. If the patch you want isn't available for your version, you'll have to port them yourself.
- Apply the patches (`patch -p1 < <patch name>`). - Apply the patches (`patch -p1 < <patch name>`).
- Edit `emojireplace.py` to point to extracted discord folder (`extracted_discord_path`), and apply emoji patches (`python3 emojireplace.py`) - If you want mutant (or other emoji patches), edit `patches/mutant/emojireplace.py` to point to extracted discord folder (`extracted_discord_path`), and apply emoji patches (`python3 emojireplace.py`)
- Build the new APK (`apktool b com.discord-831`) - Build the new APK (`apktool b com.discord-832`)
- Sign the new APK (`jarsigner -keystore <keystore path> <foldername>/dist/<foldername>.apk <alias>`) - Sign the new APK (`jarsigner -keystore <keystore path> <foldername>/dist/<foldername>.apk <alias>`)
- Get your new APK from `<foldername>/dist/<foldername>.apk`, install and enjoy! - Get your new APK from `<foldername>/dist/<foldername>.apk`, install and enjoy!

File diff suppressed because it is too large Load diff

View file

@ -2,11 +2,13 @@
This patch replaces internal emoji list with the custom emojis of mutant standard. This patch replaces internal emoji list with the custom emojis of mutant standard.
Custom color modifiers and are added too.
You'll need to pack in the right images to the apk. See README.md at the root of the repo for more information. You'll need to pack in the right images to the apk. See README.md at the root of the repo for more information.
#### Bugs / Side effects #### Bugs / Side effects
- Not all emojis are replaced - Not all emojis are replaced
- Not all custom mutstd emojis are added - Fitzpatrick values are not provided for non-human variants of mutated emojis
- Custom mutstd emojis won't be visible for users who aren't using a patch like this. - Custom mutstd emojis won't be visible for users who aren't using a patch like this.
#### Available and tested on: #### Available and tested on:

View file

@ -0,0 +1,162 @@
import copy
import json
# Unicode hexes that will have Mutant Modifier (mm) applied to
mm_emojis = [0x1f446, 0x1f447, 0x1f448, 0x1f449, 0x1f44a, 0x1f44b, 0x1f44c,
0x1f44d, 0x1f44e, 0x1f44f, 0x1f450, 0x1f485, 0x1f4aa, 0x1f590,
0x1f595, 0x1f596, 0x1f64c, 0x1f64f, 0x1f918, 0x1f919, 0x1f91a,
0x1f91b, 0x1f91c, 0x1f91d, 0x1f91e, 0x1f933, 0x261d, 0x270a,
0x270b, 0x270c, 0x270d]
# Mutant Modifier names and their modifiers
mm_types = {"paw": "􁙐",
"claw": "􁙑"}
# Custom emojis that will be inserted to the end of an emoji category
custom_emojis = {"symbols": {"💯🌈": ["queer_100"],
"􁚚": ["dont_at", "no_at",
"no_mention", "dont_mention"],
"": ["neuter_symbol"],
"": ["androgyne_symbol"],
"": ["transgender_symbol"],
"": ["male_female_symbol"],
"": ["male_and_female_symbol"],
"": ["two_male_symbols"],
"": ["two_female_symbols"],
"": ["red_heart"],
"": ["male_symbol"],
"": ["female_symbol"],
"🧡": ["orange_heart"],
"􁚅": ["labrys_symbol"],
"􁚄": ["bisexual_triangles"],
"􁚃": ["black_triangle"],
"􁚂": ["pink_triangle"]},
"objects": {"🧻": ["toilet_paper"],
"🧱": ["brick"],
"🧨": ["firecracker"],
"🦴": ["bone"],
"􁚖": ["d20"],
"􁚕": ["d12"],
"􁚔": ["d10"],
"􁚓": ["d8"],
"􁚒": ["d4"]},
"nature": {"􁚛🌈": ["furry_pride", "rainbow_paw"],
"􁚛": ["paw"],
"􁚘": ["awoo"],
"􁚙": ["dont_awoo", "no_awoo"],
"🧝": ["elf"],
"🦝": ["raccoon"],
"🦜": ["parrot"],
"🦚": ["peacock"],
"􁙦": ["demon"]},
"people": {"🧑✈": ["pilot"],
"🧑⚕": ["health_worker"],
"🧑🥢": ["firefighter"],
"🧑🚀": ["astronaut"],
"🧑🔬": ["scientist"],
"🧑🔧": ["mechanic"],
"🧑💻": ["technologist"],
"🧑🍳": ["chef"],
"🧐": ["monocle"],
"🥺": ["pleading"],
"🥶": ["cold"],
"🥵": ["hot"],
"🥴": ["woozy"],
"🥳": ["party_face"],
"🥰": ["smile_hearts"],
"🤯": ["mind_blown"],
"🤮": ["vomiting"],
"🤭": ["hand_over_mouth"],
"🤬": ["swearing"],
"🤫": ["shush"],
"🤪": ["crazy"],
"🤩": ["starry_eyes"],
"🤨": ["raised_eyebrow"],
"🕵􁘫": ["detective"],
"💆􁘫": ["massage"],
"💁􁘫": ["tipping_hand"],
"􁚐": ["hot_shit"],
"􁚗": ["headpats"],
"🧜": ["merperson"]},
"flags": {"🏴️": ["pirate_flag"],
"􁚁": ["transgender_flag"],
"􁚀": ["polysexual_flag"],
"􁙿": ["polyamory_flag"],
"􁙾": ["pansexual_flag"],
"􁙽": ["nonbinary_flag"],
"􁙼": ["neutrois_flag"],
"􁙻": ["intersex_flag"],
"􁙺": ["genderqueer_flag"],
"􁙹": ["genderfluid_flag"],
"􁙸": ["deminonbinary_flag"],
"􁙷": ["demigirl_flag"],
"􁙶": ["demiguy_flag"],
"􁙵": ["bisexual_flag"],
"􁙴": ["bigender_flag"],
"􁙳": ["bear_flag"],
"􁙲": ["asexual_flag"],
"􁙱": ["aromantic_flag"],
"􁙰": ["agender_flag"],
"􁚆": ["lesbian_flag"],
"􁙐": ["paw-modifier"],
"􁙑": ["claw-modifier"]},
"food": {"􁚑": ["cannabis_leaf"]}
}
emoji_post = {}
# Convert aforementioned unicode addresses to actual emojis
mm_emojis = [chr(mm_emoji) for mm_emoji in mm_emojis]
# Load a file called "emojis.json" from same directory.
# On discord android, this file is on "/assets/data/emojis.json"
with open('emojis.json', 'r') as f:
emoji_j_pre = json.load(f)
# Add skin tone modifiers as emojis
# so that mobile clients can send emojis with diversity
unicodecolorbase = 0x1f3fb
mutantcolorbase = 0x101600
for st_count in range(1, 6):
character = chr(unicodecolorbase)
custom_emojis["flags"][character] = [f"skin-tone-{st_count}"]
unicodecolorbase += 1
for st_count in range(6, 51):
character = chr(mutantcolorbase)
custom_emojis["flags"][character] = [f"skin-tone-{st_count}"]
mutantcolorbase += 1
# Iterate through every emoji in emojis.json
for category in emoji_j_pre:
emoji_post[category] = []
for emoji in emoji_j_pre[category]:
emoji_post[category].append(emoji)
# If this is MM emoji, create variants
if emoji["surrogates"] in mm_emojis:
names = emoji["names"]
# Add a variant for each MM type
for mm_type in mm_types:
# Ignore paw version of hand_splayed, because it's missing
if mm_type == "paw" and emoji["surrogates"] == chr(0x1f590):
continue
# Copy the variant's entry bc of pointers
variant = copy.deepcopy(emoji)
# Append variant info to the emoji entry
variant["names"] = [f"{name}_{mm_type}" for name in names]
variant["surrogates"] += mm_types[mm_type]
# and add it to the result file
emoji_post[category].append(variant)
# Add custom emojis
if category in custom_emojis:
for custom_emoji in custom_emojis[category]:
entry = {"names": custom_emojis[category][custom_emoji],
"surrogates": custom_emoji}
emoji_post[category].append(entry)
# When finally done, dump the result as "emojispost.json"
with open('emojispost.json', 'w') as f:
json.dump(emoji_post, f)

View file

@ -1,10 +1,11 @@
#!/bin/env python3 #!/bin/env python3
import os import os
import re
import shutil import shutil
# REPLACE THESE LINES # REPLACE THESE LINES
extracted_discord_path = "/tmp/cutthecord/discord" extracted_discord_path = "/home/ave/Downloads/dic/com.discord-832"
extracted_mutstd_path = "/var/www/mutant/72x72" extracted_mutstd_path = "/home/ave/Downloads/dic/72x72"
# Add your custom emojis here # Add your custom emojis here
# with "mutstd filename": "discord filename". # with "mutstd filename": "discord filename".
@ -19,6 +20,58 @@ custom_emojis = {"1f4af-200d-1f308.png": "emoji_1f4af_1f308.png",
"1f9d1-200d-1f527.png": "emoji_1f9d1_1f527.png", "1f9d1-200d-1f527.png": "emoji_1f9d1_1f527.png",
"1f9d1-200d-1f4bb.png": "emoji_1f9d1_1f4bb.png", "1f9d1-200d-1f4bb.png": "emoji_1f9d1_1f4bb.png",
"1f9d1-200d-1f373.png": "emoji_1f9d1_1f373.png", "1f9d1-200d-1f373.png": "emoji_1f9d1_1f373.png",
"1f3fb.png": "emoji_1f3fb.png",
"1f3fc.png": "emoji_1f3fc.png",
"1f3fd.png": "emoji_1f3fd.png",
"1f3fe.png": "emoji_1f3fe.png",
"1f3ff.png": "emoji_1f3ff.png",
"101600.png": "emoji_101600.png",
"101601.png": "emoji_101601.png",
"101602.png": "emoji_101602.png",
"101603.png": "emoji_101603.png",
"101604.png": "emoji_101604.png",
"101605.png": "emoji_101605.png",
"101606.png": "emoji_101606.png",
"101607.png": "emoji_101607.png",
"101608.png": "emoji_101608.png",
"101609.png": "emoji_101609.png",
"10160a.png": "emoji_10160a.png",
"10160b.png": "emoji_10160b.png",
"10160c.png": "emoji_10160c.png",
"10160d.png": "emoji_10160d.png",
"10160e.png": "emoji_10160e.png",
"10160f.png": "emoji_10160f.png",
"101610.png": "emoji_101610.png",
"101611.png": "emoji_101611.png",
"101612.png": "emoji_101612.png",
"101613.png": "emoji_101613.png",
"101614.png": "emoji_101614.png",
"101615.png": "emoji_101615.png",
"101616.png": "emoji_101616.png",
"101617.png": "emoji_101617.png",
"101618.png": "emoji_101618.png",
"101619.png": "emoji_101619.png",
"10161a.png": "emoji_10161a.png",
"10161b.png": "emoji_10161b.png",
"10161c.png": "emoji_10161c.png",
"10161d.png": "emoji_10161d.png",
"10161e.png": "emoji_10161e.png",
"10161f.png": "emoji_10161f.png",
"101620.png": "emoji_101620.png",
"101621.png": "emoji_101621.png",
"101622.png": "emoji_101622.png",
"101623.png": "emoji_101623.png",
"101624.png": "emoji_101624.png",
"101625.png": "emoji_101625.png",
"101626.png": "emoji_101626.png",
"101627.png": "emoji_101627.png",
"101628.png": "emoji_101628.png",
"101629.png": "emoji_101629.png",
"10162a.png": "emoji_10162a.png",
"10162b.png": "emoji_10162b.png",
"10162c.png": "emoji_10162c.png",
"101650.png": "emoji_101650.png",
"101651.png": "emoji_101651.png",
"10169a.png": "emoji_10169a.png", "10169a.png": "emoji_10169a.png",
"26b2-fe0f.png": "emoji_26b2.png", "26b2-fe0f.png": "emoji_26b2.png",
"26a8-fe0f.png": "emoji_26a8.png", "26a8-fe0f.png": "emoji_26a8.png",
@ -96,17 +149,45 @@ custom_emojis = {"1f4af-200d-1f308.png": "emoji_1f4af_1f308.png",
"101691.png": "emoji_101691.png"} "101691.png": "emoji_101691.png"}
# self note to get MM emojos:
# ls 72x72 | grep "101650-" | cut -f 1 -d '-' | sort | uniq
# ls 72x72 | grep "101651-" | cut -f 1 -d '-' | sort | uniq
# echo -e "\U1f44c"
# paw: 􁙐
# claw: 􁙑
def add_diverse_emojos():
# Hackiest regex ever
div_regex = r'(|.*/)([a-f0-9]+(|-fe0f)-(|101650|101651|101650-|101651-)'\
r'(|1016[0-2][a-f0-9]|1f3f[b-f])\.png)'
div_regex = re.compile(div_regex)
for file in mutstd_emojis:
re_result = div_regex.fullmatch(file)
if re_result:
mutant = re_result.group(2)
discord = discordify_emoji_name(mutant)
custom_emojis[mutant] = discord
def clean_emoji_name(name): def clean_emoji_name(name):
name = name.lower().replace("_", "-")\ name = name.lower().replace("_", "-")\
.replace("emoji-", "").replace("-fe0f", "") .replace("emoji-", "").replace("-fe0f", "")
return name return name
def discordify_emoji_name(name):
name = "emoji_" + name.lower().replace("-", "_").replace("fe0f_", "")\
.replace("200d_", "")
return name
discord_emoji_path = os.path.join(extracted_discord_path, "res", "raw") discord_emoji_path = os.path.join(extracted_discord_path, "res", "raw")
# Get file listings in relevant folders # Get file listings in relevant folders
discord_emojis = os.listdir(discord_emoji_path) discord_emojis = os.listdir(discord_emoji_path)
mutstd_emojis = os.listdir(extracted_mutstd_path) mutstd_emojis = os.listdir(extracted_mutstd_path)
add_diverse_emojos()
# Clean names of mutantstd emojis so thar we can compare them # Clean names of mutantstd emojis so thar we can compare them
# to clean discord emojis later # to clean discord emojis later
clean_mutstd_emojis = {clean_emoji_name(emoji): emoji for clean_mutstd_emojis = {clean_emoji_name(emoji): emoji for
@ -132,6 +213,8 @@ for emoji in discord_emojis:
replace_counter += 1 replace_counter += 1
for custom_emoji in custom_emojis: for custom_emoji in custom_emojis:
# One day I'd like to do discordify_emoji_name(custom_emoji)
# But discord has too many exceptions for that~
discord_emoji_name = custom_emojis[custom_emoji] discord_emoji_name = custom_emojis[custom_emoji]
full_mutstd_path = os.path.join(extracted_mutstd_path, custom_emoji) full_mutstd_path = os.path.join(extracted_mutstd_path, custom_emoji)
full_discord_path = os.path.join(discord_emoji_path, discord_emoji_name) full_discord_path = os.path.join(discord_emoji_path, discord_emoji_name)

View file

@ -0,0 +1,8 @@
mutantcolorbase = 0x101600
for oof in range(5, 50):
character = chr(mutantcolorbase)
print(f'const-string v1, "{character}"', end="\n\n")
print(f'const/16 v2, {hex(oof)}', end="\n\n")
print(f'aput-object v1, v0, v2', end="\n\n")
mutantcolorbase += 1

View file

@ -0,0 +1,27 @@
def genemojo(emojo, fitzpatrick=True, mutant=True):
if fitzpatrick:
unicodecolorbase = 0x1f3fb
for oof in range(1, 6):
character = chr(unicodecolorbase)
print(f'{emojo}{character}', end='')
unicodecolorbase += 1
if mutant:
mutantcolorbase = 0x101600
for oof in range(6, 51):
character = chr(mutantcolorbase)
print(f'{emojo}{character}', end='')
mutantcolorbase += 1
print()
emojis = ["👆", "👇", "👈", "👉", "👊", "👋", "👌", "👍", "👎", "👏", "👐", "💅", "💪",
"🖕", "🖖", "🙌", "🙏", "🤘", "🤙", "🤚", "🤛", "🤜", "🤝", "🤞", "🤳",
"", "", "", "", ""]
mm_types = {"􁙐", "􁙑"}
for emoji in emojis:
genemojo(emoji)
for mm_type in mm_types:
genemojo(emoji + mm_type, fitzpatrick=False)