Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void Creature::onGainExperience(uint64_t gainExp, Creature* target)
- {
- TextMessage message(MESSAGE_EXPERIENCE_OTHERS, ucfirst(getNameDescription()) + " gained " + std::to_string(gainExp) + (gainExp != 1 ? " experience points." : " experience point."));
- static constexpr std::array<TextColor_t, 12> colors = {
- TEXTCOLOR_BLUE,
- TEXTCOLOR_LIGHTGREEN,
- TEXTCOLOR_LIGHTBLUE,
- TEXTCOLOR_MAYABLUE,
- TEXTCOLOR_DARKRED,
- TEXTCOLOR_LIGHTGREY,
- TEXTCOLOR_SKYBLUE,
- TEXTCOLOR_PURPLE,
- TEXTCOLOR_RED,
- TEXTCOLOR_ORANGE,
- TEXTCOLOR_YELLOW,
- TEXTCOLOR_WHITE_EXP,
- };
- message.position = position;
- message.primary.color = colors[uniform_random(0, colors.size() - 1)];
- message.primary.value = gainExp;
- }
- {
- if (gainExp == 0 || !master) {
- return;
- }
- gainExp /= 2;
- master->onGainExperience(gainExp, target);
- std::ostringstream strExp;
- strExp << gainExp;
- g_game.addAnimatedText(strExp.str(), _position, TEXTCOLOR_WHITE_EXP);
- }
Advertisement
Add Comment
Please, Sign In to add comment