This repository has been archived by the owner on Jul 12, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Format for wrap.lua usage.
- Loading branch information
Showing
1 changed file
with
32 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,36 @@ | ||
unit.setTimer("dmgRpt", 1) | ||
screen.activate() | ||
script = {} | ||
|
||
function update() | ||
elements = core.getElementIdList() | ||
local text = [[<html><head></head><body><table style="font-size:3em">]] | ||
text = text .. [[<tr><th>ElementId</th><th>ElementType</th><th>ElementName</th><th>Remaining Hit Points</th><tr>]] | ||
for i = 1, #elements do | ||
elementInfo = database.getElement(core, elements[i]) | ||
if elementInfo['hitPoints'] < elementInfo['maxHitPoints'] then | ||
text = text .. [[<tr>]] | ||
text = text .. [[<td>]] .. elementInfo['id'] .. [[</td>]] | ||
text = text .. [[<td>]] .. elementInfo['type'] .. [[</td>]] | ||
text = text .. [[<td>]] .. elementInfo['name'] .. [[</td>]] | ||
text = text .. [[<td align="right" style="font-family: monospace">]] .. string.format('%0.2f', elementInfo['hitPoints']/elementInfo['maxHitPoints']*100) .. [[%</td>]] | ||
text = text .. [[</tr>]] | ||
end | ||
function script.onStart() | ||
unit.setTimer("dmgRpt", 1) | ||
screen.activate() | ||
|
||
function update() | ||
elements = core.getElementIdList() | ||
local text = [[<html><head></head><body><table style="font-size:3em">]] | ||
text = text .. [[<tr><th>ElementId</th><th>ElementType</th><th>ElementName</th><th>Remaining Hit Points</th><tr>]] | ||
for i = 1, #elements do | ||
elementInfo = database.getElement(core, elements[i]) | ||
if elementInfo['hitPoints'] < elementInfo['maxHitPoints'] then | ||
text = text .. [[<tr>]] | ||
text = text .. [[<td>]] .. elementInfo['id'] .. [[</td>]] | ||
text = text .. [[<td>]] .. elementInfo['type'] .. [[</td>]] | ||
text = text .. [[<td>]] .. elementInfo['name'] .. [[</td>]] | ||
text = text .. [[<td align="right" style="font-family: monospace">]] .. string.format('%0.2f', elementInfo['hitPoints']/elementInfo['maxHitPoints']*100) .. [[%</td>]] | ||
text = text .. [[</tr>]] | ||
end | ||
end | ||
text = text .. [[</table></body></html>]] | ||
screen.setHTML(text) | ||
end | ||
text = text .. [[</table></body></html>]] | ||
screen.setHTML(text) | ||
update() | ||
end | ||
|
||
function script.onStop() | ||
screen.deactivate() | ||
end | ||
|
||
function script.onTick(dmgRpt) | ||
update() | ||
end | ||
|
||
update() | ||
script.onStart() |