Difference between revisions of "User:Jareel_Skaj/DPSGraph"

From War Thunder Wiki
Jump to: navigation, search
(Created template for visualizing damage output)
 
(Reduced the number of loops, added defaultMin and defaultMax to allow for further optimizations)
 
(5 intermediate revisions by the same user not shown)
Line 1: Line 1:
<includeonly>{{#vardefine:i|1}}{{#vardefine:maxHeight|200}}{{#vardefine:itemWidth|1.5em}}{{#vardefine:itemSpacing|0.2em}}{{#vardefine:min|9999}}{{#vardefine:max|0}}{{#while:
+
<includeonly>{{#vardefine:i|1}}{{#vardefine:maxHeight|200}}{{#vardefine:itemWidth|1.5em}}{{#vardefine:itemSpacing|0.2em}}{{#vardefine:min|{{{defaultMin|9999}}}}}{{#vardefine:max|{{{defaultMax|0}}}}}{{#ifexpr:{{#var:min}}=9999|{{#while:
  | {{{tnt{{#var:i}} |}}}
+
  | {{{tnt{{#var:i}}|}}}
  |  
+
  | {{#ifexpr:{{#var:min}}>{{User:U12017485/DPS|{{{code{{#var:i}}}}}|{{{tnt{{#var:i}}}}}|{{{broadsideGuns{{#var:i}}|}}}}}|{{#vardefine:min|{{User:U12017485/DPS|{{{code{{#var:i}}}}}|{{{tnt{{#var:i}}}}}|{{{broadsideGuns{{#var:i}}|}}}}} }}|}}
  {{#ifexpr:{{#var:min}}>{{User:U12017485/DPS|{{{code{{#var:i}}}}}|{{{tnt{{#var:i}}}}}}}|{{#vardefine:min| {{User:U12017485/DPS|{{{code{{#var:i}}}}}|{{{tnt{{#var:i}}}}}}} }}|}}
+
   {{#ifexpr:{{#var:max}}<{{User:U12017485/DPS|{{{code{{#var:i}}}}}|{{{tnt{{#var:i}}}}}|{{{broadsideGuns{{#var:i}}|}}}}}|{{#vardefine:max| {{User:U12017485/DPS|{{{code{{#var:i}}}}}|{{{tnt{{#var:i}}}}}|{{{broadsideGuns{{#var:i}}|}}}}} }}|}}
   {{#ifexpr:{{#var:max}}<{{User:U12017485/DPS|{{{code{{#var:i}}}}}|{{{tnt{{#var:i}}}}}}}|{{#vardefine:max| {{User:U12017485/DPS|{{{code{{#var:i}}}}}|{{{tnt{{#var:i}}}}}}} }}|}}
 
 
{{#vardefine:i|{{#expr:{{#var:i}}+1}}}}
 
{{#vardefine:i|{{#expr:{{#var:i}}+1}}}}
}}{{#vardefine:baseline|{{#expr: floor(0.9*{{#var:min}}) }}}}{{#while:
+
}}}}{{#vardefine:baseline|{{#expr: floor(0.9*{{#var:min}}) }}}}{{#vardefine:i|1}}<div style="display: inline-block; position: relative; width: auto;">
| {{{tnt{{#var:i}} |}}}
 
| <nowiki />
 
* {{{tnt{{#var:i}}}}}
 
{{#vardefine: i
 
  | {{#expr: {{#var: i }} + 1 }}
 
}}
 
}}<div style="display: inline-block; position: relative; width: auto;">
 
 
<div style="border:0 solid black; border-left-width: 1px; border-bottom-width: 1px; display: flex; align-items: flex-end; position: relative; width: auto;">
 
<div style="border:0 solid black; border-left-width: 1px; border-bottom-width: 1px; display: flex; align-items: flex-end; position: relative; width: auto;">
 
{{#vardefine:i| 1 }}
 
{{#vardefine:i| 1 }}
Line 18: Line 10:
 
  | {{{tnt{{#var:i}} |}}}
 
  | {{{tnt{{#var:i}} |}}}
 
  | <nowiki />
 
  | <nowiki />
<div style="background-color: #94a4b0; width: {{#var:itemWidth}}; margin-right: {{#var:itemSpacing}}; height: {{#expr:
+
<div style="background-color: {{{color{{#var:i}}|{{{colorDefault|#94a4b0}}}}}}; width: {{#var:itemWidth}}; margin-right: {{#var:itemSpacing}}; height: {{#expr:
({{User:U12017485/DPS|{{{code{{#var:i}}}}}|{{{tnt{{#var:i}}}}}}} / {{#var:max}}) * {{#var:maxHeight}} round 0
+
({{User:U12017485/DPS|{{{code{{#var:i}}}}}|{{{tnt{{#var:i}}}}}|{{{broadsideGuns{{#var:i}}|}}}}} / {{#var:max}}) * {{#var:maxHeight}} round 0
}}px; display: flex; " title="{{User:U12017485/DPS|{{{code{{#var:i}}}}}|{{{tnt{{#var:i}}}}}}} kg/min with {{#unit:{{{code{{#var:i}}}}}|weapon|main|1|name}}"></div>
+
|{{{broadsideGuns{{#var:i}}|}}}}}px; display: flex; align-items: flex-end; justify-content: center;" title="
 +
{{User:U12017485/DPS|{{{code{{#var:i}}}}}|{{{tnt{{#var:i}}}}}|{{{broadsideGuns{{#var:i}}|}}}}} kg/min with {{{broadsideGuns{{#var:i}}|{{#expr: {{#unit:{{{code{{#var:i}}}}}|weapon|{{{group|main}}}|{{{slot|1}}}|amount}} * {{#unit:{{{code{{#var:i}}}}}|weapon|{{{group|main}}}|{{{slot|1}}}|guns}} }}}}} x {{#unit:{{{code{{#var:i}}}}}|weapon|main|1|name}}">{{#ifexpr:{{{pen{{#var:i}}|0}}} and {{{penMax|0}}}|<div title="Penetration: {{{pen{{#var:i}}|0}}} mm @ {{{penDegrees|0}}}° @ {{{penRange|1000}}} m" style="background-color: #b0bec5; width: 0.3em; height: {{#expr:({{{pen{{#var:i}}|0}}}/{{{penMax|0}}}) * {{#var:maxHeight}} round 0}}px;"></div>|}}</div>
 
{{#vardefine: i
 
{{#vardefine: i
 
   | {{#expr: {{#var: i }} + 1 }}
 
   | {{#expr: {{#var: i }} + 1 }}
Line 34: Line 27:
 
  | {{{tnt{{#var:i}} |}}}
 
  | {{{tnt{{#var:i}} |}}}
 
  | <nowiki />
 
  | <nowiki />
<div style=""><div style="writing-mode: vertical-rl; width: {{#var:itemWidth}}; margin-right: {{#var:itemSpacing}}; text-align: left;">{{#unit:{{{code{{#var:i}}}}}|pseudonym}}</div></div>
+
<div style=""><div style="writing-mode: vertical-rl; width: {{#var:itemWidth}}; margin-right: {{#var:itemSpacing}}; text-align: left;">{{{name{{#var:i}}|{{#unit:{{{code{{#var:i}}}}}|pseudonym}}}}}</div></div>
 
{{#vardefine: i
 
{{#vardefine: i
 
   | {{#expr: {{#var: i }} + 1 }}
 
   | {{#expr: {{#var: i }} + 1 }}
Line 40: Line 33:
 
}}
 
}}
 
</div>
 
</div>
</div></includeonly><noinclude>Sample:
+
</div>
{{{{PAGENAME}}
+
</includeonly><noinclude>Sample:
 +
{{User:U12017485/DPSGraph
 +
|colorDefault=#355166
 +
|penMax=50
 +
|penDegrees=30
 +
|penRange=500
 
  |code1=jp_destroyer_yugumo
 
  |code1=jp_destroyer_yugumo
 
  |tnt1=2.31
 
  |tnt1=2.31
 +
|pen1=28
 
  |code2=us_destroyer_fletcher
 
  |code2=us_destroyer_fletcher
 
  |tnt2=3.22
 
  |tnt2=3.22
Line 52: Line 51:
 
  |code5=uk_destroyer_tribal
 
  |code5=uk_destroyer_tribal
 
  |tnt5=3
 
  |tnt5=3
}}</noinclude>
+
|color5=#AFB082
 +
|code6=uk_destroyer_tribal
 +
|tnt6=3
 +
|broadsideGuns6 = 1
 +
|color6=#B08382
 +
|name6=Eskimo Test
 +
}}
 +
</noinclude>

Latest revision as of 12:05, 20 November 2024

Sample:

354.2 kg/min
39 kg/min
0

IJN Yugumo
USS Fletcher
Z12 Erich Giese
Moskva
HMS Eskimo
Eskimo Test