Skip to content

Commit

Permalink
Inestitionsanzeige hinzugefügt
Browse files Browse the repository at this point in the history
  • Loading branch information
Th3C0D3R authored and Th3C0D3R committed Jan 23, 2020
1 parent 2711444 commit 11c236e
Show file tree
Hide file tree
Showing 13 changed files with 207 additions and 0 deletions.
32 changes: 32 additions & 0 deletions css/web/style-menu.css
Original file line number Diff line number Diff line change
Expand Up @@ -631,3 +631,35 @@ p {


/*******************************************************************************/

/*******************************************************************************/
#invest-bar {
display: inline;
margin-left: 7%;
z-index: 100;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";
font-size: 0.9rem;
color: #F3D6A0;
text-shadow: 0 0 1px rgba(0,0,0, 0.8);
user-select: text;
}

#reward-bar {
display: inline;
margin-left: 10%;
z-index: 100;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";
font-size: 0.9rem;
color: #F3D6A0;
text-shadow: 0 0 1px rgba(0,0,0, 0.8);
user-select: text;
}

#invest-bar strong {
color: #FFB539;
}

#reward-bar strong {
color: #FFB539;
}
/*******************************************************************************/
1 change: 1 addition & 0 deletions js/inject.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ async function InjectCode() {
'eventquest',
'read-buildings',
'settings',
'investment',
'strategy-points',
'citymap',
'hidden-rewards'
Expand Down
6 changes: 6 additions & 0 deletions js/web/_i18n/cs.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,12 @@ let i18n = {
"BuyableFP" : "Buyable: "
},

"Investment" : {
"Title" : "Investment", //Todo: Translate
"InvestBar" : "Invested FP: ", //Todo: Translate
"CurrReward" : "Current Profit: " //Todo: Translate
},

"Productions" : {
"Title" : "Přehled produkce",
"SearchInput": "Hledat budovu...",
Expand Down
6 changes: 6 additions & 0 deletions js/web/_i18n/de.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,12 @@ let i18n = {
"BuyableFP" : "Kaufbar: "
},

"Investment" : {
"Title" : "Investitionen",
"InvestBar" : "Investierte FP: ",
"CurrReward" : "Aktueller Gewinn: "
},

"Productions" : {
"Title" : "Produktions Übersicht",
"SearchInput": "Gebäude Suche...",
Expand Down
6 changes: 6 additions & 0 deletions js/web/_i18n/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,12 @@ let i18n = {
"BuyableFP" : "Buyable: "
},

"Investment" : {
"Title" : "Investment",
"InvestBar" : "Invested FP: ",
"CurrReward" : "Current Profit: "
},

"Productions" : {
"Title" : "Production overview",
"SearchInput": "Search building...",
Expand Down
6 changes: 6 additions & 0 deletions js/web/_i18n/es.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,12 @@ let i18n = {
"BuyableFP" : "Buyable: "
},

"Investment" : {
"Title" : "Investment", //Todo: Translate
"InvestBar" : "Invested FP: ", //Todo: Translate
"CurrReward" : "Current Profit: " //Todo: Translate
},

"Productions" : {
"Title" : "Produktions Übersicht",
"SearchInput": "Edificio busqueda...",
Expand Down
6 changes: 6 additions & 0 deletions js/web/_i18n/fr.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,12 @@ let i18n = {
"BuyableFP" : "Achetable: ",
},

"Investment" : {
"Title" : "Investment", //Todo: Translate
"InvestBar" : "Invested FP: ", //Todo: Translate
"CurrReward" : "Current Profit: " //Todo: Translate
},

"Productions" : {
"Title" : "Vue d'ensemble des productions",
"SearchInput": "Chercher un bâtiment...",
Expand Down
6 changes: 6 additions & 0 deletions js/web/_i18n/ro.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,12 @@ let i18n = {
"BuyableFP" : "Buyable: "
},

"Investment" : {
"Title" : "Investment", //Todo: Translate
"InvestBar" : "Invested FP: ", //Todo: Translate
"CurrReward" : "Current Profit: " //Todo: Translate
},

"Productions" : {
"Title" : "Prezentarea generală a producției",
"SearchInput": "Caută clădirea...",
Expand Down
6 changes: 6 additions & 0 deletions js/web/_i18n/ru.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,12 @@ let i18n = {
"BuyableFP" : "Buyable: "
},

"Investment" : {
"Title" : "Investment", //Todo: Translate
"InvestBar" : "Invested FP: ", //Todo: Translate
"CurrReward" : "Current Profit: " //Todo: Translate
},

"Productions" : {
"Title" : "Обзор производства",
"SearchInput": "Найти постройку...",
Expand Down
6 changes: 6 additions & 0 deletions js/web/_i18n/sv.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,12 @@ let i18n = {
"BuyableFP" : "Buyable: " //Todo: Translate
},

"Investment" : {
"Title" : "Investment", //Todo: Translate
"InvestBar" : "Invested FP: ", //Todo: Translate
"CurrReward" : "Current Profit: " //Todo: Translate
},

"Productions" : {
"Title" : "Produktionsöversikt",
"SearchInput": "Sök byggnad...",
Expand Down
1 change: 1 addition & 0 deletions js/web/calculator/js/calculator.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ let Calculator = {
}

Calculator.ArcBonus = ArcBonus;
localStorage.setItem('ArcBonus',ArcBonus);
},


Expand Down
12 changes: 12 additions & 0 deletions js/web/investment/css/investment.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#Investment {
width: 370px !important;
height: 27px !important;
}

#Investment #InvestmentBody {
overflow: auto;
}

#Investment #InvestmentBody strong {
color: #ffb539;
}
113 changes: 113 additions & 0 deletions js/web/investment/js/investment.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
/*
* **************************************************************************************
*
* Dateiname: investment.js
* Projekt: foe-chrome
*
* erstellt von: Daniel Siekiera <[email protected]>
* erstellt am: 22.12.19, 14:31 Uhr
* zuletzt bearbeitet: 22.12.19, 14:31 Uhr
*
* Copyright © 2019
*
* **************************************************************************************
*/

FoEproxy.addHandler('GreatBuildingsService', 'getContributions', (data) => {
Investment.Box();
Investment.CalcBar(data.responseData);
});


let Investment = {
RefreshDone: false,
OldInvestmentPoints: 0,
OldRewardPoints: 0,
InvestedFP : 0,
RewardFP : 0,
BonusFP : 0,
ArcBonus: 0,

Box: () => {
if ($('#Investment').length === 0) {
HTML.Box({
'id': 'Investment',
'title': i18n['Boxes']['Investment']['Title'],
'auto_close': false,
'dragdrop': true,
'resize': false,
'minimize': false
});

// CSS in den DOM prügeln
HTML.AddCssFile('investment');
}
},

CalcBar: (data) =>{
if(!data) return;
if(data.length <= 0) return;

Investment.ArcBonus = localStorage.getItem('ArcBonus');
Investment.ArcBonus = ((parseFloat(Investment.ArcBonus) + 100) / 100)

Investment.InvestedFP = 0;
Investment.BonusFP = 0;

for (let x = 0; x < data.length; x++) {
const contribution = data[x];
Investment.InvestedFP += contribution['forge_points'];
if(undefined !== contribution['reward'])
Investment.RewardFP += (contribution['reward']['strategy_point_amount'] !== undefined ? contribution['reward']['strategy_point_amount'] : 0);
}
Investment.InvestmentBar(Investment.InvestedFP)
},

/**
* Kleine FP-Bar im Header
*
* @param NewFP Die neu zu setzenden FP
*/
InvestmentBar: (_InvestedFP) => {
if (_InvestedFP === undefined) _InvestedFP = 0;

Investment.BonusFP = Math.round(_InvestedFP * Investment.ArcBonus) - _InvestedFP;

let div = $('#InvestmentBody');

// noch nicht im DOM?
if( $('#invest-bar').length < 1 && $('#reward-bar').length < 1){
let Invest = $('<div />').attr('id', 'invest-bar').text(i18n['Boxes']['Investment']['InvestBar']).append( $('<strong>0</strong>').addClass('invest-storage') );
let Reward = $('<div />').attr('id', 'reward-bar').text(i18n['Boxes']['Investment']['CurrReward']).append( $('<strong>0</strong>').addClass('reward-storage') );

$(div).append(Invest);
$(div).append(Reward);
}

// Update mit Animation, wenn es überhaupt notwendig ist
if(Investment.BonusFP < Investment.OldRewardPoints ||
Investment.BonusFP > Investment.OldRewardPoints ||
_InvestedFP < Investment.OldInvestmentPoints ||
_InvestedFP > Investment.OldInvestmentPoints ||
!Investment.RefreshDone)
{
Investment.RefreshDone = true;

$('.invest-storage').easy_number_animate({
start_value: Investment.OldInvestmentPoints,
end_value: _InvestedFP,
duration: 750
});

$('.reward-storage').easy_number_animate({
start_value: Investment.OldRewardPoints,
end_value: Investment.BonusFP,
duration: 750
});

Investment.OldInvestmentPoints = _InvestedFP;
Investment.OldRewardPoints = Investment.BonusFP;
Investment.InvestedFP = _InvestedFP;
}
},
}

0 comments on commit 11c236e

Please sign in to comment.