Steemnova - Correct language for fleet activities

in #utopian-io7 years ago (edited)

Bug Fix

What was the issue?

The messages that are generated by fleet activities were always in the language of the attacking player, even if the receiver is using another language.
Also see my bugreport

Example:

Should be in german instead:

What was the solution?

Even though the code change was very small, it was a very hard to spot issue.

First I thought that the language for the user was never read and that the variable from the attacker was just reused, so I looked into "MissionCaseAttack.class.php" where the report is generated:

image.png
Click to go directly to github

But as you can see a method called "getLanguage" is used, with the correct userId...
After looking through the code some more and finding nothing wrong with it, I looked into the "getLanguage" method:
image.png

Click to go directly to github

Well the code doesn't look too bad, it get the language or the userId. If the language is null and a userId is provided it would then select the language for a user...
It then builds a language object and returns that.

But after looking through the method in detail I realized that "userId" was not used in the select! Instead the userid of the owner of the fleet (the attacker) was used to select the language. After realizing this it was very easy to fix.
image.png

Click to go directly to github

This didn't only fix the issues with player attacking others, but also a few more, like pointed out by @mys.

This also fixes foreign messages about incoming transport deliveries, ACS invitations and others

Relevant Links



Posted on Utopian.io - Rewarding Open Source Contributors

Sort:  

Thank you for the contribution. It has been approved.

You can contact us on Discord.
[utopian-moderator]

Thank you! :)

Really informative 👍

Thank you for your upvote.

But what exactly did you find informative?
Are you playing steemnova?
If yes what is your account name there?

Resteemed your article. This article was resteemed because you are part of the New Steemians project. You can learn more about it here: https://steemit.com/introduceyourself/@gaman/new-steemians-project-launch . If your post has more upvotes, your post will appear in the trending page. To get more upvotes, you can bid for @steembidbot vote. please check it out here: https://steembottracker.com/

Hey @mwfiae I am @utopian-io. I have just upvoted you!

Achievements

  • WOW WOW WOW People loved what you did here. GREAT JOB!
  • You have less than 500 followers. Just gave you a gift to help you succeed!
  • Seems like you contribute quite often. AMAZING!

Community-Driven Witness!

I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!

mooncryption-utopian-witness-gif

Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x

Coin Marketplace

STEEM 0.21
TRX 0.20
JST 0.035
BTC 91288.71
ETH 3149.19
USDT 1.00
SBD 3.08