Skip to content
This repository was archived by the owner on Oct 11, 2023. It is now read-only.

added character map util function for default character emojis#214

Merged
JustinPinero merged 2 commits intopre-alpha-fixes3from
default-emojis
May 4, 2021
Merged

added character map util function for default character emojis#214
JustinPinero merged 2 commits intopre-alpha-fixes3from
default-emojis

Conversation

@JustinPinero
Copy link
Copy Markdown
Contributor

@JustinPinero JustinPinero commented May 4, 2021

Added util function that assigns a default emoji based on the name of the current persona. Current map and emoji pairings are:
assassin: "dagger_knife" 🗡️
assistant_chef: "hocho" 🔪
bandit: "crossed_swords" ⚔️
battle_master: "trident" 🔱
big_sheep_like_brown_dog: "dog2" 🐕
bighorn_sheep: "ram" 🐏
butler: "bellhop_bell" 🛎️
drunk_reeling_out_of_the_saloon: "beer" 🍺
fox: "fox_face" 🦊
goblin: "smiling_imp" 😈
graveyard_keeper: "coffin" ⚰️
groundskeeper: "seedling" 🌱
half_wild_cat: "tiger" 🐯
jailer: "old_key" 🗝️
lady_of_the_house: "princess" 👸
lord: "crown" 👑
master_at_arms: "shield" 🛡️
milk_man: "glass_of_milk" 🥛
monkey_friend: "monkey" 🐒
pig: "pig" 🐷
priest: "church" ⛪
rat: "rat" 🐀
serving_boy: "boy" 👦
skeleton_assistant: "skull" 💀
small_aggressive_looking_dog: "dog" 🐶
smith: "hammer" 🔨
town_doctor: "syringe" 💉

These can be changed easily at anytime and are currently located in the DefaultEmojiMapper function in the utils file in the Light GameApp. Every persona emoji pairing has been tested in game and works properly.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label May 4, 2021
Copy link
Copy Markdown
Contributor

@JackUrb JackUrb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great choices! Just making sure we don't lose the autopicking code for future releases when we may have more characters than these.

town_doctor: "syringe",
};

return EmojiMap[characterName];
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the case where characterName is not in the map, we should default to the old autopicking code:

    const skipWords = ["a", "the", "an", "of", "with", "holding"];
    const tryPickEmojis = !persona
      ? []
      : persona.name
          .split(" ")
          .filter((token) => !!token)
          .map((token) => token.replace(/\.$/, ""))
          .filter((word) => skipWords.indexOf(word.toLowerCase()) === -1)
          .flatMap((term) =>
            emojiIndex.search(term).map((o) => {
              return o.native;
            })
          );

    const autopickedEmoji =
      tryPickEmojis.length > 0 ? tryPickEmojis[0] : defaultEmoji;
    return autopickedEmoji;

@JustinPinero JustinPinero merged commit b2d42f0 into pre-alpha-fixes3 May 4, 2021
@JackUrb JackUrb mentioned this pull request May 4, 2021
@JackUrb JackUrb deleted the default-emojis branch September 1, 2021 18:38
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants