Skip to content

Commit

Permalink
add: missing screenshots triggers (#4574)
Browse files Browse the repository at this point in the history
  • Loading branch information
omarcopires authored Dec 14, 2023
1 parent e441ce9 commit b8e69c2
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 15 deletions.
17 changes: 14 additions & 3 deletions data/creaturescripts/scripts/player_death.lua
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,24 @@ function onDeath(player, corpse, killer, mostDamageKiller, lastHitUnjustified, m
end

player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You are dead.")
if not deathListEnabled then
return
end

local byPlayer, killerName = getKiller(killer)
local byPlayerMostDamage, killerNameMostDamage = getKiller(mostDamageKiller)

player:takeScreenshot(byPlayer and SCREENSHOT_TYPE_DEATHPVP or SCREENSHOT_TYPE_DEATHPVE)

if byPlayer then
killer:takeScreenshot(SCREENSHOT_TYPE_PLAYERKILL)
end

if mostDamageKiller and mostDamageKiller:isPlayer() then
mostDamageKiller:takeScreenshot(SCREENSHOT_TYPE_PLAYERKILL)
end

if not deathListEnabled then
return
end

local playerGuid = player:getGuid()
db.query("INSERT INTO `player_deaths` (`player_id`, `time`, `level`, `killed_by`, `is_player`, `mostdamage_by`, `mostdamage_is_player`, `unjustified`, `mostdamage_unjustified`) VALUES (" .. playerGuid .. ", " .. os.time() .. ", " .. player:getLevel() .. ", " .. db.escapeString(killerName) .. ", " .. (byPlayer and 1 or 0) .. ", " .. db.escapeString(killerNameMostDamage) .. ", " .. (byPlayerMostDamage and 1 or 0) .. ", " .. (lastHitUnjustified and 1 or 0) .. ", " .. (mostDamageUnjustified and 1 or 0) .. ")")
local resultId = db.storeQuery("SELECT `player_id` FROM `player_deaths` WHERE `player_id` = " .. playerGuid)
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
local updateClientOnAdvanceLevel = CreatureEvent("Update Client On Advance Level")

function updateClientOnAdvanceLevel.onAdvance(player, skill, oldLevel, newLevel)
if skill ~= SKILL_LEVEL then
return true
end

player:updateClientExpDisplay()
player:takeScreenshot(SCREENSHOT_TYPE_LEVELUP)
return true
end

updateClientOnAdvanceLevel:register()
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
local updateClientOnAdvanceSkill = CreatureEvent("Update Client On Advance Skill")

function updateClientOnAdvanceSkill.onAdvance(player, skill, oldLevel, newLevel)
if skill == SKILL_LEVEL then
return true
end

player:takeScreenshot(SCREENSHOT_TYPE_SKILLUP)
return true
end

updateClientOnAdvanceSkill:register()

0 comments on commit b8e69c2

Please sign in to comment.