Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added QI citymap stuff #2937

Merged
merged 2 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions changelog-de.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@
- Kategorien umstrukturiert
- Fenster vergrößert und verschiebbar gemacht

- Stadtübersicht QI:
- Gebäude werden nun nach Typ kategorisiert
- Münz- Vorrats- und Quantenaktionsboosts aus der Hauptstadt werden mitberechnet - danke Juber!

**BugFix**
- Fenster:
- können nun nicht mehr verschoben werden, wenn die Maus auf einen der Buttons des Fensters zeigt
Expand Down
4 changes: 4 additions & 0 deletions changelog-en.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@
- Reorganized the menu
- Bigger and moveable window

- QI City Map:
- Buildings are now grouped by type
- Coin, supply and quantum action boosts from your main city are now included - thx Juber!

**BugFix**
- Boxes:
- can not be draged anymore when the mouse is on of the buttons of the box
Expand Down
2 changes: 1 addition & 1 deletion js/web/_i18n/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@
"Boxes.CityMap.OutpostSubmit": "Zum Stadtplaner schicken",
"Boxes.CityMap.QIActionRechargeCycle": "pro Stunde",
"Boxes.CityMap.QICycle": "alle 10 Stunden",
"Boxes.CityMap.QIHint": "Alle Werte nehmen an, dass die Gebäude fertiggestellt sind.",
"Boxes.CityMap.QIHint": "Alle Werte, außer Aktionen pro Stunde, nehmen an, dass die Gebäude fertiggestellt sind.",
"Boxes.CityMap.ShowNoStreetBuildings": "Markiere Gebäude, die keine Straße brauchen",
"Boxes.CityMap.ShowSubmitBox": "Stadtplaner",
"Boxes.CityMap.StreetsAmount": "Anzahl Straßen: ",
Expand Down
2 changes: 1 addition & 1 deletion js/web/_i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@
"Boxes.CityMap.OutpostSubmit": "Submit to City-Planner",
"Boxes.CityMap.QIActionRechargeCycle": "every hour",
"Boxes.CityMap.QICycle": "every 10 hours",
"Boxes.CityMap.QIHint": "All displayed values assume your buildings have finished construction.",
"Boxes.CityMap.QIHint": "All displayed values, except Actions per Hour, assume your buildings have finished construction.",
"Boxes.CityMap.ShowNoStreetBuildings": "Highlight buildings that do not need streets",
"Boxes.CityMap.ShowSubmitBox": "City planner",
"Boxes.CityMap.StreetsAmount": "Number of Streets: ",
Expand Down
3 changes: 3 additions & 0 deletions js/web/_main/js/_main.js
Original file line number Diff line number Diff line change
Expand Up @@ -986,6 +986,9 @@ let MainParser = {
'coin_production': 0,
'supply_production': 0,
'forge_points_production':0,
'guild_raids_coins_production': 0,
'guild_raids_supplies_production': 0,
'guild_raids_action_points_collection': 0
},


Expand Down
72 changes: 44 additions & 28 deletions js/web/citymap/js/citymap.js
Original file line number Diff line number Diff line change
Expand Up @@ -358,14 +358,38 @@ let CityMap = {

showQIStats: () => {
if (!CityMap.QIData) return
let boosts = MainParser.BoostSums
let supply_boost = boosts.guild_raids_supplies_production*0.01
let coin_boost = boosts.guild_raids_coins_production*0.01
let buildings = Object.values(CityMap.QIData)
let population = 0, totalPopulation = 0, euphoria = 0, euphoriaBoost = 0, supplies = 0, money = 0, att_def_boost_attacker = 0, att_def_boost_defender = 0, actions = 0
let population = 0, totalPopulation = 0, euphoria = 0, euphoriaBoost = 0, supplies = 0, money = 0, att_def_boost_attacker = 0, att_def_boost_defender = 0
let actions = boosts.guild_raids_action_points_collection
for (let b in buildings) {
let building = CityMap.setQIBuilding(MainParser.CityEntities[buildings[b]['cityentity_id']])
if (building.type !== "impediment" && building.type !== "street") {
population += building.population
euphoria += building.euphoria
totalPopulation += (building.population > 0 ? building.population : 0)
euphoria += building.euphoria
}
}
let euphoriaFactor = euphoria/totalPopulation
if (euphoriaFactor < 0.2)
euphoriaBoost = 0.2
else if (euphoriaFactor > 0.20 && euphoriaFactor <= 0.60)
euphoriaBoost = 0.6
else if (euphoriaFactor > 0.60 && euphoriaFactor <= 0.80)
euphoriaBoost = 0.8
else if (euphoriaFactor > 0.80 && euphoriaFactor <= 1.20)
euphoriaBoost = 1
else if (euphoriaFactor > 1.20 && euphoriaFactor <= 1.40)
euphoriaBoost = 1.1
else if (euphoriaFactor > 1.40 && euphoriaFactor < 2.0)
euphoriaBoost = 1.2
else
euphoriaBoost = 1.5
for (let b in buildings) {
let building = CityMap.setQIBuilding(MainParser.CityEntities[buildings[b]['cityentity_id']])
if (building.type !== "impediment" && building.type !== "street") {

if (building.boosts !== null) {
for (let i in building.boosts) {
Expand All @@ -374,43 +398,26 @@ let CityMap = {
att_def_boost_attacker += boost.value
if (boost.type === "att_def_boost_defender")
att_def_boost_defender += boost.value
if (boost.type === "guild_raids_action_points_collection")
actions += boost.value
}
}
if (building.production !== null) {
if (building.type !== "military" && building.type !== "goods" && building.type !== "main_building") {
if (building.production.guild_raids_supplies)
supplies += building.production.guild_raids_supplies
supplies += Math.round(building.production.guild_raids_supplies*(euphoriaBoost+supply_boost))
if (building.production.guild_raids_money)
money += building.production.guild_raids_money
money += Math.round(building.production.guild_raids_money*(euphoriaBoost+coin_boost))
}
}
}
}
let euphoriaFactor = euphoria/totalPopulation
if (euphoriaFactor < 0.2)
euphoriaBoost = 0.2
else if (euphoriaFactor > 0.20 && euphoriaFactor <= 0.60)
euphoriaBoost = 0.6
else if (euphoriaFactor > 0.60 && euphoriaFactor <= 0.80)
euphoriaBoost = 0.8
else if (euphoriaFactor > 0.80 && euphoriaFactor <= 1.20)
euphoriaBoost = 1
else if (euphoriaFactor > 1.20 && euphoriaFactor <= 1.40)
euphoriaBoost = 1.1
else if (euphoriaFactor > 1.40 && euphoriaFactor < 2.0)
euphoriaBoost = 1.2
else
euphoriaBoost = 1.5

CityMap.QIStats = {
population: population,
totalPopulation: totalPopulation,
euphoria: euphoria,
euphoriaBoost: euphoriaBoost,
money: money*euphoriaBoost,
supplies: supplies*euphoriaBoost,
money: money,
supplies: supplies,
att_def_boost_attacker: att_def_boost_attacker,
att_def_boost_defender: att_def_boost_defender,
actions: actions,
Expand All @@ -422,16 +429,20 @@ let CityMap = {
out += '<span class="prod happiness">'+CityMap.QIStats.euphoriaBoost*100+'%</span> <br>'
out += '<span class="prod guild_raids_money">'+HTML.Format(CityMap.QIStats.money)+'</span> + '
out += '<span class="prod guild_raids_supplies">'+HTML.Format(CityMap.QIStats.supplies)+'</span> '+i18n('Boxes.CityMap.QICycle')+'<br>'
out += '<span class="prod guild_raids_action_points_collection">'+'+'+CityMap.QIStats.actions+'</span> '+i18n('Boxes.CityMap.QIActionRechargeCycle')+'<br>'
out += '<span class="prod att_def_boost_attacker">'+CityMap.QIStats.att_def_boost_attacker+'</span> '
out += '<span class="prod att_def_boost_defender">'+CityMap.QIStats.att_def_boost_defender+'</span> '
out += '<span class="prod att_def_boost_defender">'+CityMap.QIStats.att_def_boost_defender+'</span> '+'<br>'
out += '<span class="prod guild_raids_action_points_collection">'+'+'+CityMap.QIStats.actions+'</span> '+i18n('Boxes.CityMap.QIActionRechargeCycle')

out += "<div>"
return out
},


showQIBuildings: () => {
let boosts = MainParser.BoostSums
let supply_boost = 0, coin_boost = 0
coin_boost = boosts.guild_raids_coins_production*0.01
supply_boost = boosts.guild_raids_supplies_production*0.01
let buildings = Object.values(CityMap.QIData)
buildings.sort((a, b) => {
if (a.cityentity_id < b.cityentity_id) return -1
Expand Down Expand Up @@ -464,9 +475,14 @@ let CityMap = {
out += (building.production.guild_raids_money ? '<span class="prod guild_raids_money">'+HTML.Format(building.production.guild_raids_money*-1.0)+'</span> ' : "")
}
else {
let eBoost = (building.type === "main_building" ? 1.0 : CityMap.QIStats.euphoriaBoost)
out += (building.production.guild_raids_supplies ? '<span class="prod guild_raids_supplies">'+HTML.Format(building.production.guild_raids_supplies*eBoost)+'</span> ' : " ")
out += (building.production.guild_raids_money ? '<span class="prod guild_raids_money">'+HTML.Format(building.production.guild_raids_money*eBoost)+'</span> ' : "")
let eBoost = CityMap.QIStats.euphoriaBoost
if (building.type === "main_building"){
out += (building.production.guild_raids_supplies ? '<span class="prod guild_raids_supplies">'+HTML.Format(Math.round(building.production.guild_raids_supplies))+'</span> ' : " ")
out += (building.production.guild_raids_money ? '<span class="prod guild_raids_money">'+HTML.Format(Math.round(building.production.guild_raids_money))+'</span> ' : "")
} else{
out += (building.production.guild_raids_supplies ? '<span class="prod guild_raids_supplies">'+HTML.Format(Math.round(building.production.guild_raids_supplies*(eBoost+supply_boost)))+'</span> ' : " ")
out += (building.production.guild_raids_money ? '<span class="prod guild_raids_money">'+HTML.Format(Math.round(building.production.guild_raids_money*(eBoost+coin_boost)))+'</span> ' : "")
}
}
}
if (building.boosts !== null) {
Expand Down