iopietro / Travianz-Legacy

Join our Discord Server: https://discordapp.com/invite/9fbJKP9 | New repo: https://github.com/iopietro/Travianz
GNU General Public License v3.0
160 stars 94 forks source link

Tooltips for server settings #519

Open velhbxtyrj opened 6 years ago

velhbxtyrj commented 6 years ago

I offer for your consideration a few decorations for the admin panel: tooltips for server settings. Who and what thinks about it?

1 default

Some code:

<style>
    .tooltip {border-bottom: 1px dotted #000000; color: #000000; outline: none; cursor: help; text-decoration: none; position: relative;}
    .tooltip span {margin-left: -999em; position: absolute;}
    .tooltip:hover span {font-family: Calibri, Tahoma, Geneva, sans-serif; position: absolute; left: 1em; top: 2em; z-index: 99; margin-left: 0; width: 250px;}
    .classic {padding: 0.8em 1em; background: #FFFFAA; border: 1px solid #FFAD33; border-radius: 5px 5px;}
</style>

    <tr>
        <td>Server Name <em class="tooltip">?<span class="classic">Name of your game server</span></em></td>
        <td><?php echo SERVER_NAME;?></td>
    </tr>
iopietro commented 6 years ago

I like it, it's a good idea :)!

velhbxtyrj commented 6 years ago

Is the code here okay? If the code is okay then I'll do it.

iopietro commented 6 years ago

I think that you should put that code in the main .css file (it should be compact.css).

velhbxtyrj commented 6 years ago

I know that. The main thing is that the code was not bad :) I'm asking about it :)

iopietro commented 6 years ago

I know a very little of css, but it seems fine to me.

Shadowss commented 6 years ago

You can make the change.

velhbxtyrj commented 6 years ago

Please tell me what the "Evasion Speed" and "Tourn Threshold" parameters mean in the settings. And as I understand that the parameter "Natars Units Multiplier" is not implemented? Does it mean how strong will the troops of Natar be in the villages?

iopietro commented 6 years ago

Evasion speed: the time your troops spend to return home after an evasion. Tourn Threshold: the total square after the tournament square begin to work (20 squares is the default value). Natars Units Multiplier: it's used as a troops multiplier while creating Natars (through the "create_account.php" file).

velhbxtyrj commented 6 years ago

Natars Units Multiplier: it's used as a troops multiplier while creating Natars (through the "create_account.php" file).

Having looked at this file, I saw only that this parameter affects the number of sent scouts of the natars

$multiplier = NATARS_UNITS;
$sendspytroops = 1500 * $multiplier;

The number of warriors created in the villages of Natars depends on the speed of the server:

        if(SPEED > 3) {
            $speed = 5;
        } else {
            $speed = SPEED;
        }
        $q3 = "UPDATE " . TB_PREFIX . "units SET u41 = " . (64700 * $speed) . ", u42 = " . (295231 * $speed) . ", u43 = " . (180747 * $speed) . ", u44 = " . (20000 * $speed) . ", u45 = " . (364401 * $speed) . ", u46 = " . (217602 * $speed) . ", u47 = " . (2034 * $speed) . ", u48 = " . (1040 * $speed) . " , u49 = " . (1 * $speed) . ", u50 = " . (9 * $speed) . " WHERE vref = " . (int) $wid['wref'] . "";
            if(SPEED > 3) {
                $speed = 5;
            } else {
                $speed = SPEED;
            }
            if($size == 1) {
                mysqli_query($database->dblink,"UPDATE " . TB_PREFIX . "units SET u41 = " . (rand(1000, 2000) * $speed) . ", u42 = " . (rand(1500, 2000) * $speed) . ", u43 = " . (rand(2300, 2800) * $speed) . ", u44 = " . (rand(25, 75) * $speed) . ", u45 = " . (rand(1200, 1900) * $speed) . ", u46 = " . (rand(1500, 2000) * $speed) . ", u47 = " . (rand(500, 900) * $speed) . ", u48 = " . (rand(100, 300) * $speed) . " , u49 = " . (rand(1, 5) * $speed) . ", u50 = " . (rand(1, 5) * $speed) . " WHERE vref = " . (int) $wid . "");
                mysqli_query($database->dblink,"UPDATE " . TB_PREFIX . "fdata SET f22t = 27, f22 = 10, f28t = 25, f28 = 10, f19t = 23, f19 = 10, f32t = 23, f32 = 10 WHERE vref = ".(int) $wid);
            } elseif($size == 2) {
                mysqli_query($database->dblink,"UPDATE " . TB_PREFIX . "units SET u41 = " . (rand(2000, 4000) * $speed) . ", u42 = " . (rand(3000, 4000) * $speed) . ", u43 = " . (rand(4600, 5600) * $speed) . ", u44 = " . (rand(50, 150) * $speed) . ", u45 = " . (rand(2400, 3800) * $speed) . ", u46 = " . (rand(3000, 4000) * $speed) . ", u47 = " . (rand(1000, 1800) * $speed) . ", u48 = " . (rand(200, 600) * $speed) . " , u49 = " . (rand(2, 10) * $speed) . ", u50 = " . (rand(2, 10) * $speed) . " WHERE vref = " . (int) $wid . "");
                mysqli_query($database->dblink,"UPDATE " . TB_PREFIX . "fdata SET f22t = 27, f22 = 10, f28t = 25, f28 = 20, f19t = 23, f19 = 10, f32t = 23, f32 = 10 WHERE vref = ".(int) $wid);
            } elseif($size == 3) {
                mysqli_query($database->dblink,"UPDATE " . TB_PREFIX . "units SET u41 = " . (rand(4000, 8000) * $speed) . ", u42 = " . (rand(6000, 8000) * $speed) . ", u43 = " . (rand(9200, 11200) * $speed) . ", u44 = " . (rand(100, 300) * $speed) . ", u45 = " . (rand(4800, 7600) * $speed) . ", u46 = " . (rand(6000, 8000) * $speed) . ", u47 = " . (rand(2000, 3600) * $speed) . ", u48 = " . (rand(400, 1200) * $speed) . " , u49 = " . (rand(4, 20) * $speed) . ", u50 = " . (rand(4, 20) * $speed) . " WHERE vref = " . (int) $wid . "");
                mysqli_query($database->dblink,"UPDATE " . TB_PREFIX . "fdata SET f22t = 27, f22 = 10, f28t = 25, f28 = 20, f19t = 23, f19 = 10, f32t = 23, f32 = 10 WHERE vref = ".(int) $wid);
            }
        }
iopietro commented 6 years ago

It's wrong then. It's not a problem though, Natars troops spawn will be reworked soon, their spawn will be based of top 100 best mains in the server.

velhbxtyrj commented 6 years ago

So it does not make sense to write tooltips for this Natars Units Multiplier since it will be deleted?

Shadowss commented 6 years ago

For evasion ( troops running from the attack ) cam be reworked to look more "beautiful" ? eschiva

velhbxtyrj commented 6 years ago

So the question about the Evasion Speed. According to the standard, this is equal to 1. Ie if the player puts time 1 this equals one minute (in the attack the troops will be missing one minute). If we put 2 in the admin panel and the player sets 1 minute, will it be 2 minutes or 30 seconds (in the attack the troops will be missing 2 minutes or 30 seconds)?

velhbxtyrj commented 6 years ago

@phaze1G Can you take a look at the code specified in the first message?

RevertIT commented 6 years ago

I checked and it's good.

I did CSS for @Shadowss request in 2 posts above. http://jsfiddle.net/EgLKV/9539/

velhbxtyrj commented 6 years ago

I'm thinking about what could remake the CSS for something more colorful. Maybe you can suggest something for this.

And in occasion of that that has offered @Shadowss that I think that it will look absolutely on another. This was taken from T4+ and there the withdrawal of troops works only for the capital. In our code as far as I understand it works for all villages.

RevertIT commented 6 years ago

@velhbxtyrj I don't like colorful things. I'm always sticking to 1-3 colors which are just small variants of the first one. for the tooltip maybe making it transparent and smaller?

http://jsfiddle.net/EgLKV/9553/

iopietro commented 6 years ago

@velhbxtyrj, the evasion speed should be (180 seconds / server speed)

velhbxtyrj commented 6 years ago

@iopietro @Shadowss I've implemented all the tooltips in the server settings for the administrator. Now it's the same for installation. I would like to know the opinion about how it looks. Continue the same, or maybe something needs to be changed?

iopietro commented 6 years ago

They look good! Good job :)! I think that you can continue the same.

velhbxtyrj commented 6 years ago

@iopietro I ran into a little problem. I started filling the configuration file during installation and found out that it was not connected to the language package (( Could look at this. Or maybe it even makes sense to create a language pack for the installation and when loading the installer, we will have to select the language first before proceeding further?

iopietro commented 6 years ago

Mmh, I think that it would be more easy connecting the "Lang/en.php" file to the installation and in the future we could make a button for choosing the installation language.

velhbxtyrj commented 6 years ago

I tried to connect and it did not work :) Try it :)

iopietro commented 6 years ago

Ok, I'll try it.

iopietro commented 6 years ago

I tried it and it "works", but a lot of errors are displayed, so we should create a different language file for the installation, or we can just split the en.php file into specified files. For example we can create a folder for each language and put in it all languages file: GameEngine/Lang/en/building.php | GameEngine/Lang/en/installation.php etc. Let me know if you like it or not.

velhbxtyrj commented 6 years ago

I think can split the file into specified files. One for installation, one for the admin area, one for the game. Unless, of course, it does not take much time for this :)

eliopinho commented 6 years ago

I do not know much of php code, but would be simplier link whole game to en.php and all languages should be translated by these file, on the installation simply add some kind of function to rename the desired lang file to "en.php" avoiding the work to modify all game files to work properly.. But this only an idea. The experts on this matter have a final word :)

Or

Translate only the game itself, leave admin and installation in english (normally the admin have the skills to do anything in english, such has install apache php mysql etc.. all of those are english (no big deal))

iopietro commented 6 years ago

@eliopinho, Splitting en.php in more files isn't a problem nor having multiple languages files. The big "problem" is the huge amount of work needed to find every single not localized string in the game and put them in language files.

If you want, you can help us by doing so, don't worry, there's no hurry, if you'll accept you can do it without constrains or deadlines.

eliopinho commented 6 years ago

@iopietro Friend i do not know how to identify and edit those codes :(

velhbxtyrj commented 6 years ago

Well, I can do it. But this requires a lot of time and the main thing is to solve the problem with how the files for translation will be implemented. After this question is solved, I will be able to change all the files.

P.S. In general, it would be interesting to implement translation with the help of .po and .mo files because they have a more flexible translation system. But editing requires special software.

iopietro commented 6 years ago

Yeah, it requires a lot of time, for now we'll use .php files, we'll see in the future for other options.

iopietro commented 6 years ago

@eliopinho No, problem, it's ok :).

eliopinho commented 6 years ago

Also has some graphics buttons can be translated, those i can edit in various languages :)

RevertIT commented 6 years ago

Idea: Instead of using graphics buttons, we should replace everything with CSS + text. CSS3 can literally mimic graphics and page load will be faster.

velhbxtyrj commented 6 years ago

@phaze1G You will be able to do it?

RevertIT commented 6 years ago

Something like this?

https://jsfiddle.net/7jn1Labp/

eliopinho commented 6 years ago

nice!! but can you "make" like the game graphic Buttons ?

velhbxtyrj commented 6 years ago

@phaze1G It looks beautiful. But probably it's worth sticking to the style that applies to this version?

RevertIT commented 6 years ago

Sure just give me an image of current button i'll do it whiteish

velhbxtyrj commented 6 years ago

It seems this is all the buttons: https://github.com/Shadowss/TravianZ/tree/master/gpack/travian_default/lang/en/b

RevertIT commented 6 years ago

Sorry for late response been sleeping. I recreate it to be the same as on images.

https://jsfiddle.net/7jn1Labp/4/

@iopietro should replace this with all buttons 😃

Edit: Updated a bit

velhbxtyrj commented 6 years ago

It looks great!

Shadowss commented 6 years ago

Who will update the GITHUB buttons ?

RevertIT commented 6 years ago

One more idea, we should replace the most of things we can with css instead of images. Rest of the stuff should be added as sprites css image. It would increase load speed by at least 30%.

Shadowss commented 6 years ago

Can you do that ? I can give you access on the repository

iopietro commented 6 years ago

@phaze1G, They're awesome, great job :)!

Shadowss commented 6 years ago

@phaze1G : i give you an invitation for Collaborator. You can change now.

RevertIT commented 6 years ago

I don't want to mess the code, I'm kinda new to GitHub functions.

PS: Changing images to CSS for buttons require editing every .php file and including text + class.

For example:

<input value="Login" name="s1" onclick="xy();" id="btn_login" class="button1" alt="login button">

iopietro commented 6 years ago

@phaze1G, Don't worry, github uses "git", every commit can be reverted without problems, edit as much code as you want. If you're not sure, you can fork this project, edit it from your fork and then create a pull request to this project, so we can look at the changes before committing them to the master branch.

RevertIT commented 6 years ago

@iopietro Can you explain me it a bit more, I just added CSS for new buttons and it added directly to master branch.

How should I edit and make pull requests? Should I do it with the desktop client or directly go to file in browser and edit?