Skip to content

Commit

Permalink
Lua code format - (Stylua)
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Nov 13, 2024
1 parent 810e5aa commit e81db78
Showing 1 changed file with 22 additions and 7 deletions.
29 changes: 22 additions & 7 deletions data/scripts/creaturescripts/player/death.lua
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,18 @@ local function getMostDamageInfo(mostDamageKiller)
end

local function saveDeathRecord(playerGuid, player, killerName, byPlayer, mostDamageName, byPlayerMostDamage, unjustified, mostDamageUnjustified)
local query = string.format("INSERT INTO `player_deaths` (`player_id`, `time`, `level`, `killed_by`, `is_player`, `mostdamage_by`, `mostdamage_is_player`, `unjustified`, `mostdamage_unjustified`) VALUES (%d, %d, %d, '%s', %d, '%s', %d, %d, %d)", playerGuid, os.time(), player:getLevel(), db.escapeString(killerName), byPlayer, db.escapeString(mostDamageName), byPlayerMostDamage, unjustified and 1 or 0, mostDamageUnjustified and 1 or 0)
local query = string.format(
"INSERT INTO `player_deaths` (`player_id`, `time`, `level`, `killed_by`, `is_player`, `mostdamage_by`, `mostdamage_is_player`, `unjustified`, `mostdamage_unjustified`) VALUES (%d, %d, %d, '%s', %d, '%s', %d, %d, %d)",
playerGuid,
os.time(),
player:getLevel(),
db.escapeString(killerName),
byPlayer,
db.escapeString(mostDamageName),
byPlayerMostDamage,
unjustified and 1 or 0,
mostDamageUnjustified and 1 or 0
)
db.query(query)
end

Expand Down Expand Up @@ -97,12 +108,16 @@ local function recordGuildWarKill(killer, player, killerGuildId, targetGuildId,
end

local function checkAndUpdateGuildWarScore(warId, targetGuildId, killerGuildId, playerName, killerName, mostDamageName)

Check warning on line 110 in data/scripts/creaturescripts/player/death.lua

View workflow job for this annotation

GitHub Actions / luacheck

[luacheck] reported by reviewdog 🐶 unused function 'checkAndUpdateGuildWarScore' Raw Output: data/scripts/creaturescripts/player/death.lua:110:16: unused function 'checkAndUpdateGuildWarScore'
local resultId = db.storeQuery(string.format(
"SELECT `guild_wars`.`id`, `guild_wars`.`frags_limit`, " ..
"(SELECT COUNT(1) FROM `guildwar_kills` WHERE `guildwar_kills`.`warid` = `guild_wars`.`id` AND `guildwar_kills`.`killerguild` = `guild_wars`.`guild1`) AS guild1_kills, " ..
"(SELECT COUNT(1) FROM `guildwar_kills` WHERE `guildwar_kills`.`warid` = `guild_wars`.`id` AND `guildwar_kills`.`killerguild` = `guild_wars`.`guild2`) AS guild2_kills " ..
"FROM `guild_wars` WHERE (`guild1` = %d OR `guild2` = %d) AND `status` = 1 AND `id` = %d",
killerGuildId, targetGuildId, warId)
local resultId = db.storeQuery(
string.format(
"SELECT `guild_wars`.`id`, `guild_wars`.`frags_limit`, "
.. "(SELECT COUNT(1) FROM `guildwar_kills` WHERE `guildwar_kills`.`warid` = `guild_wars`.`id` AND `guildwar_kills`.`killerguild` = `guild_wars`.`guild1`) AS guild1_kills, "
.. "(SELECT COUNT(1) FROM `guildwar_kills` WHERE `guildwar_kills`.`warid` = `guild_wars`.`id` AND `guildwar_kills`.`killerguild` = `guild_wars`.`guild2`) AS guild2_kills "
.. "FROM `guild_wars` WHERE (`guild1` = %d OR `guild2` = %d) AND `status` = 1 AND `id` = %d",
killerGuildId,
targetGuildId,
warId
)
)

if resultId then
Expand Down

0 comments on commit e81db78

Please sign in to comment.