dota2 post-test-fixes + help page + mobile brightness enhancement port2d

1bb71e2 · gmorell · 2023-02-09 05:53

12 files +124 -14

Files changed

modified lib/lambent_ex/machine/ext/gsi.ex
+13 −13
@@ -223,19 +223,19 @@ defmodule LambentEx.Machine.Ext.GSI do
223 223 # gold
224 224 defp read(:dota_player_xpm, state), do: state[:gs] |> get_in(["player", "xpm"]) || 0
225 225 defp read(:dota_player_gpm, state), do: state[:gs] |> get_in(["player", "gpm"]) || 0
226 − defp read(:dota_player_gold, state), do: state[:gs] |> get_in(["player", "gold"]) || 0
227 − defp read(:dota_player_gold_unreliable, state), do: state[:gs] |> get_in(["player", "gold_unreliable"]) || 0
228 − defp read(:dota_player_gold_reliable, state), do: state[:gs] |> get_in(["player", "gold_reliable"]) || 0
226 + defp read(:dota_player_gold, state), do: state[:gs] |> get_in(["player", "gold"]) || 1
227 + defp read(:dota_player_gold_unreliable, state), do: state[:gs] |> get_in(["player", "gold_unreliable"]) || 1
228 + defp read(:dota_player_gold_reliable, state), do: state[:gs] |> get_in(["player", "gold_reliable"]) || 1
229 229 defp read(:dota_player_gold_from_creep_kills, state), do: state[:gs] |> get_in(["player", "gold_from_creep_kills"]) || 0
230 230 defp read(:dota_player_gold_from_hero_kills, state), do: state[:gs] |> get_in(["player", "gold_from_hero_kills"]) || 0
231 231 defp read(:dota_player_gold_from_income, state), do: state[:gs] |> get_in(["player", "gold_from_income"]) || 0
232 232 defp read(:dota_player_gold_from_shared, state), do: state[:gs] |> get_in(["player", "gold_from_shared"]) || 0
233 233 # numbers
234 234 defp read(:dota_mana, state), do: state[:gs] |> get_in(["hero", "mana"]) || 0
235 − defp read(:dota_mana_max, state), do: state[:gs] |> get_in(["hero", "max_mana"]) || 0
235 + defp read(:dota_mana_max, state), do: state[:gs] |> get_in(["hero", "max_mana"]) || 1
236 236 defp read(:dota_mana_pct, state), do: state[:gs] |> get_in(["hero", "mana_percent"]) || 0
237 237 defp read(:dota_health, state), do: state[:gs] |> get_in(["hero", "health"]) || 0
238 − defp read(:dota_health_max, state), do: state[:gs] |> get_in(["hero", "max_health"]) || 0
238 + defp read(:dota_health_max, state), do: state[:gs] |> get_in(["hero", "max_health"]) || 1
239 239 defp read(:dota_health_pct, state), do: state[:gs] |> get_in(["hero", "health_percent"]) || 0
240 240 # statuses
241 241 defp read(:dota_hero_smoked, state), do: state[:gs] |> get_in(["hero", "smoked"]) ||false
@@ -269,14 +269,14 @@ defmodule LambentEx.Machine.Ext.GSI do
269 269 defp read(:dota_hero_talent_7, state), do: state[:gs] |> get_in(["hero", "talent_7"]) || false
270 270 defp read(:dota_hero_talent_8, state), do: state[:gs] |> get_in(["hero", "talent_8"]) || false
271 271 # abilities
272 − defp read(:dota_hero_ability_1, state), do: state[:gs] |> get_in(["hero", "ability_1"]) || false
273 − defp read(:dota_hero_ability_2, state), do: state[:gs] |> get_in(["hero", "ability_2"]) || false
274 − defp read(:dota_hero_ability_3, state), do: state[:gs] |> get_in(["hero", "ability_3"]) || false
275 − defp read(:dota_hero_ability_4, state), do: state[:gs] |> get_in(["hero", "ability_4"]) || false
276 − defp read(:dota_hero_ability_5, state), do: state[:gs] |> get_in(["hero", "ability_5"]) || false
277 − defp read(:dota_hero_ability_6, state), do: state[:gs] |> get_in(["hero", "ability_6"]) || false
278 − defp read(:dota_hero_ability_7, state), do: state[:gs] |> get_in(["hero", "ability_7"]) || false
279 − defp read(:dota_hero_ability_8, state), do: state[:gs] |> get_in(["hero", "ability_8"]) || false
272 + defp read(:dota_hero_ability_1, state), do: state[:gs] |> get_in(["hero", "ability_1"]) || %{}
273 + defp read(:dota_hero_ability_2, state), do: state[:gs] |> get_in(["hero", "ability_2"]) || %{}
274 + defp read(:dota_hero_ability_3, state), do: state[:gs] |> get_in(["hero", "ability_3"]) || %{}
275 + defp read(:dota_hero_ability_4, state), do: state[:gs] |> get_in(["hero", "ability_4"]) || %{}
276 + defp read(:dota_hero_ability_5, state), do: state[:gs] |> get_in(["hero", "ability_5"]) || %{}
277 + defp read(:dota_hero_ability_6, state), do: state[:gs] |> get_in(["hero", "ability_6"]) || %{}
278 + defp read(:dota_hero_ability_7, state), do: state[:gs] |> get_in(["hero", "ability_7"]) || %{}
279 + defp read(:dota_hero_ability_8, state), do: state[:gs] |> get_in(["hero", "ability_8"]) || %{}
280 280 ## these are passed in the result of above eg; read(:dota_hero_ability_active, read(:dota_hero_ability_1, state))
281 281 defp read(:dota_hero_ability_active, state), do: state |> Map.get("ability_active") || false
282 282 defp read(:dota_hero_ability_can_cast, state), do: state |> Map.get("can_cast") || false
modified lib/lambent_ex_web/components/layouts/app.html.heex
+105 −0
@@ -39,7 +39,11 @@
39 39 <main class="px-4 py-20 sm:px-6 lg:px-8">
40 40 <div class="mx-auto max-w-7xl">
41 41 <div>
42 + <a class="float-right text-primary hover:text-accent" href="#help-modal">
43 + <i class="fa-solid fa-circle-question fa-3x"></i>
44 + </a>
42 45 <h1 class="text-5xl font-build text-center lg:text-left">LambentEx</h1>
46 +
43 47 </div>
44 48 <.flash kind={:info} title="Success!" flash={@flash} />
45 49 <.flash kind={:error} title="Error!" flash={@flash} />
@@ -119,4 +123,105 @@
119 123 </div>
120 124 </div>
121 125 </div>
126 +<div class="modal" id="help-modal">
127 + <div class="modal-box w-11/12 max-w-5xl">
128 + <h3 class="font-bold text-xl text-accent">HELP!</h3>
129 + <p class="py-4">You're new here and are probably wondering what the hell is going on. While it looks like A Lot. It isn't, and you'll be ready to play momentarily.</p>
130 + <h4 class="font-bold text-md text-accent">Devices</h4>
131 + <p class="py-4"><code>Devices</code> are lights that have been found on your local area network via one of the scanning processes, or lights that have been found on a configured external service.
132 + Devices can be assigned to a Place and given a Name via the UI for organizational purposes.
133 + <br /><br />
134 + As the service provides a wide range of support for many types of target device, it allows for resorting of output values to support pixels beyond RGB including color expansion based on the RGB values.
135 + <br /><br >
136 + <span class="font-bold">Icons</span>
137 + <div class="grid grid-cols-5">
138 + <button class="btn btn-circle btn-sm">
139 + <i class="fa-solid fa-2x fa-bolt-lightning"></i>
140 + </button>
141 + <div class="col-span-4">Locate a physical device by sending it a flashing test pattern.</div>
142 + </div>
143 + <br />
144 + </p>
145 + <h4 class="font-bold text-md text-accent">Machines</h4>
146 + <p class="py-4">
147 + <code>Machines</code> are small programs that follow specific rules every time they internally tick, which causes them to emit a stream of RGB values.
148 + <br /><br >
149 + <span class="font-bold">Icons</span>
150 + <div class="grid grid-cols-5">
151 + <i class="fa-solid fa-2x fa-plus hover:fa-spin"></i>
152 + <div class="col-span-4">Create a link attaching a single machine to a single device.</div>
153 + <i class="fa-solid fa-2x fa-bucket hover:fa-spin"></i>
154 + <div class="col-span-4">Create multiple links attaching a single machine to many devices.</div>
155 + <span class="col-span-5"><br /></span>
156 + <button class="btn btn-circle btn-sm">
157 + <i class="fa-solid fa-2x fa-forward-step"></i>
158 + </button>
159 + <div class="col-span-4">Slow down the machine's internal timer</div>
160 + <button class="btn btn-circle btn-sm">
161 + <i class="fa-solid fa-2x fa-forward-fast"></i>
162 + </button>
163 + <div class="col-span-4">Speed up the machine's internal timer</div>
164 + <button class="btn btn-circle btn-sm">
165 + <i class="fa-regular fa-2x fa-lightbulb"></i>
166 + </button>
167 + <div class="col-span-4">Set the brightness target lower</div>
168 + <button class="btn btn-circle btn-sm">
169 + <i class="fa-solid fa-2x fa-lightbulb"></i>
170 + </button>
171 + <div class="col-span-4">Set the brightness target higher</div>
172 + <button class="btn btn-circle btn-accent btn-sm btn-outline ">
173 + <i class="fa-solid fa-2x fa-thumbtack"></i>
174 + </button>
175 + <div class="col-span-4">Mark the machine for persistence in case of an update/reboot, it'll be saved</div>
176 + <button class="btn btn-circle btn-error btn-sm btn-outline">
177 + <i class="fa-solid fa-2x fa-xmark"></i>
178 + </button>
179 + <div class="col-span-4">Delete the machine.</div>
180 + </div>
181 + <br />
182 + </p>
183 + <h4 class="font-bold text-md text-accent">Links</h4>
184 + <p class="py-4">
185 + <code>Links</code> connect the output from a <code>Machine</code> to a <code>Device</code>
186 + <br /> <br />
187 + <span class="font-bold">Icons</span>
188 + <div class="grid grid-cols-5">
189 + <i class="fa-solid fa-2x fa-plus hover:fa-spin"></i>
190 + <div class="col-span-4">Create a machine from the UI, being able to adjust all parameters.</div>
191 + <i class="fa-solid fa-2x fa-book hover:fa-spin"></i>
192 + <div class="col-span-4">Open the machine library to view and instantiate example machines.</div>
193 + <span class="col-span-5"><br /></span>
194 + <button class="btn btn-circle btn-sm btn-secondary hover:btn-accent btn-outline">
195 + <i class="fa-solid fa-2x fa-cog hover:fa-spin"></i>
196 + </button>
197 + <div class="col-span-4">Enable a link. Enabling a link will disable all other links that point to this device</div>
198 + <button class="btn btn-circle btn-accent btn-sm btn-outline ">
199 + <i class="fa-solid fa-2x fa-thumbtack"></i>
200 + </button>
201 + <div class="col-span-4">Mark the link for persistence in case of an update/reboot, it'll be saved</div>
202 + <button class="btn btn-circle btn-error btn-sm btn-outline">
203 + <i class="fa-solid fa-2x fa-xmark"></i>
204 + </button>
205 + <div class="col-span-4">Delete the link.</div>
206 + </div>
207 + <br />
208 + </p>
209 + <h4 class="font-bold text-md text-accent">SVCS</h4>
210 + <p class="py-4">
211 + <code>Services</code> allow external <code>Machines</code> and <code>Devices</code> that use MQTT or HTTP. Service configurations are automatically persisted.
212 + <br /><br />
213 + <span class="font-bold">Icons</span>
214 + <div class="grid grid-cols-5">
215 + <button class="btn btn-circle btn-error btn-sm btn-outline">
216 + <i class="fa-solid fa-2x fa-xmark"></i>
217 + </button>
218 + <div class="col-span-4">Delete the service.</div>
219 + </div>
220 + <br />
221 + </p>
222 + <div class="modal-action">
223 + <a href="#" class="btn">Yay!</a>
224 + </div>
225 + </div>
226 +</div>
122 227 </main>
modified lib/lambent_ex_web/live/machines/index.html.heex
+6 −1
@@ -58,7 +58,12 @@
58 58 <td><%= v[:step] %></td>
59 59 <td><%= v[:name] %></td>
60 60 <td><%= v[:speed] |> spd %></td>
61 − <td><%= v[:bgt] |> bgt %> %</td>
61 + <td>
62 + <%= if v[:bgt] != v[:bgtt] do %>
63 + <%= v[:bgt] |> bgt %>&percnt; <i class="fa-solid fa-fw fa-caret-right"></i> <%= v[:bgtt] |> bgt %>&percnt;
64 + <% else %>
65 + <%= v[:bgt] |> bgt %>&percnt;
66 + <% end%></td>
62 67 <td>
63 68 <button class="btn btn-circle" phx-click="slower" phx-value-id={v[:name]}>
64 69 <i class="fa-solid fa-2x fa-forward-step"></i>

Parents: a93dee0