Skip to content

Commit

Permalink
count_monsters.lua improvements.
Browse files Browse the repository at this point in the history
  • Loading branch information
elsongabriel committed Dec 19, 2023
1 parent 2f54ccf commit 0906a87
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,7 @@ client_assertions.txt
*-house.xml
*-monster.xml
*-npc.xml
monster_count.txt

# SFTP for Sublime
sftp-config.json
Expand Down
9 changes: 7 additions & 2 deletions data/scripts/talkactions/gm/count_monsters.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,19 @@ function count_monsters.onSay(player, words, param)
end
end

writing_file:write("--- Total of monsters on server ---\n")

writing_file:write("--- Monsters on Server ---\n")
local total = 0
for monster, count in pairsByKeys(monsters) do
writing_file:write(monster .. " - " .. count .. "\n")
total = total + count
end
local outputMsg = "Total of monsters on server: " .. total
writing_file:write("\n" .. outputMsg .. "\n------------------------")

writing_file:close()

logger.info(outputMsg)

return true
end

Expand Down

0 comments on commit 0906a87

Please sign in to comment.