This repository has been archived by the owner on May 20, 2023. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Full review of the bless system (#965)
* Shows better informations in the bless dialog * Improved bless status tooltip in the bless dialog button * Improve blessings handling Reworked whole blessings functions server wide, added support for both twist of fate and regular bless when losing items, fixed couple of minor bugs all though the server... Modified !bless command to reflect ToF changes and prices according to level. TODO is in blessings.lua, but should be this: "Insert & Select query in blessings_history", "Add unfair fight reduction", "Gamestore buy blessing", "Test ank print text", "Test all functions", "Test henricus prices/blessings", "Add data \\movements\\scripts\\quests\\cults of tibia\\icedeath.lua blessing information", "WotE data\\movements\\scripts\\quests\\wrath of the emperor\\realmTeleport.lua has line checking if player has bless 1", "add blessings module support npc\\lib\\npcsystem\\modules.lua", "Fix store buying bless", "Check if store is inside lua or source...", "Find better way to sendBlessStatus"
- Loading branch information
1 parent
37f01d9
commit 82ae88f
Showing
19 changed files
with
480 additions
and
279 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,27 +1,4 @@ | ||
local config = { | ||
[11260] = {blessId = 5, text = 'The Spiritual Shielding'}, | ||
[11259] = {blessId = 6, text = 'The Embrace of Tibia'}, | ||
[11261] = {blessId = 4, text = 'The Fire of the Suns'}, | ||
[11258] = {blessId = 3, text = 'The Spark of the Phoenix'}, | ||
[11262] = {blessId = 2, text = 'The Wisdom of Solitude'}, | ||
[28036] = {blessId = 7, text = 'Heart of the Mountain'}, | ||
[28037] = {blessId = 8, text = 'Blood of the Mountain'} | ||
} | ||
|
||
dofile('data/modules/scripts/blessings/blessings.lua') | ||
function onUse(player, item, fromPosition, target, toPosition, isHotkey) | ||
local useItem = config[item.itemid] | ||
if not useItem then | ||
return true | ||
end | ||
|
||
if player:hasBlessing(useItem.blessId) then | ||
player:say('You already possess this blessing.', TALKTYPE_MONSTER_SAY) | ||
return true | ||
end | ||
|
||
player:addBlessing(useItem.blessId,1) | ||
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, useItem.text .. ' protects you.') | ||
player:getPosition():sendMagicEffect(CONST_ME_LOSEENERGY) | ||
item:remove(1) | ||
return true | ||
return Blessings.useCharm(player, item) | ||
end |
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,21 +1,5 @@ | ||
local blessings = { | ||
{id = 1, name = 'Twist of Fate'}, | ||
{id = 5, name = 'The Spiritual Shielding'}, | ||
{id = 6, name = 'The Embrace of Tibia'}, | ||
{id = 4, name = 'The Fire of the Suns'}, | ||
{id = 3, name = 'The Spark of the Phoenix'}, | ||
{id = 2, name = 'The Wisdom of Solitude'}, | ||
{id = 7, name = 'Blood of the Mountain'}, | ||
{id = 8, name = 'Heart of the Mountain'} | ||
} | ||
dofile('data/modules/scripts/blessings/blessings.lua') | ||
|
||
function onUse(player, item, fromPosition, target, toPosition, isHotkey) | ||
|
||
local result, bless = 'Received blessings:' | ||
for i = 1, #blessings do | ||
bless = blessings[i] | ||
result = player:hasBlessing(bless.id) and result .. '\n' .. bless.name or result | ||
end | ||
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 20 > result:len() and 'No blessings received.' or result) | ||
return true | ||
return Blessings.checkBless(player) | ||
end |
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,15 +1,6 @@ | ||
local freeBlessMaxLevel = 20 | ||
dofile('data/modules/scripts/blessings/blessings.lua') | ||
|
||
function onLogin(player) | ||
if player:getLevel() <= freeBlessMaxLevel then | ||
for i = 1, 8 do | ||
if not player:hasBlessing(i) then | ||
player:addBlessing(i, 1) | ||
end | ||
end | ||
|
||
player:sendTextMessage(MESSAGE_EVENT_ADVANCE,'You received adventurers blessings for you to be level less than ' .. freeBlessMaxLevel .. '!') | ||
player:getPosition():sendMagicEffect(CONST_ME_HOLYDAMAGE) | ||
end | ||
return true | ||
function onLogin(cid) | ||
local player = Player(cid) | ||
return Blessings.doAdventurerBlessing(player) | ||
end |
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,40 +1,8 @@ | ||
dofile('data/modules/scripts/blessings/blessings.lua') | ||
function onDeath(player, corpse, killer, mostDamage, unjustified, mostDamage_unjustified) | ||
if player:hasFlag(PlayerFlag_NotGenerateLoot) then | ||
return true | ||
end | ||
|
||
local amulet = player:getSlotItem(CONST_SLOT_NECKLACE) | ||
if amulet and amulet.itemid == ITEM_AMULETOFLOSS and not table.contains({SKULL_RED, SKULL_BLACK}, player:getSkull()) then | ||
local isPlayer = false | ||
if killer then | ||
if killer:isPlayer() then | ||
isPlayer = true | ||
else | ||
local master = killer:getMaster() | ||
if master and master:isPlayer() then | ||
isPlayer = true | ||
end | ||
end | ||
end | ||
|
||
if not isPlayer or not player:hasBlessing(5) then | ||
player:removeItem(ITEM_AMULETOFLOSS, 1, -1, false) | ||
end | ||
else | ||
for i = CONST_SLOT_HEAD, CONST_SLOT_AMMO do | ||
local item = player:getSlotItem(i) | ||
if item then | ||
if table.contains({SKULL_RED, SKULL_BLACK}, player:getSkull()) or math.random(item:isContainer() and 100 or 1000) <= player:getLossPercent() then | ||
if not item:moveTo(corpse) then | ||
item:remove() | ||
end | ||
end | ||
end | ||
end | ||
end | ||
|
||
if not player:getSlotItem(CONST_SLOT_BACKPACK) then | ||
player:addItem(ITEM_BAG, 1, false, CONST_SLOT_BACKPACK) | ||
end | ||
return true | ||
Blessings.DebugPrint("onDeath DROPLOOT EVENT DropLoot") | ||
return Blessings.PlayerDeath(player, corpse, killer) | ||
end |
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
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
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
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 |
---|---|---|
@@ -0,0 +1,49 @@ | ||
Blessings.Types = { | ||
REGULAR = 1, | ||
ENHANCED = 2, | ||
PvP = 3 | ||
} | ||
|
||
Blessings.All = { | ||
[1] = {id = 1, name = "Twist of Fate", type = Blessings.Types.PvP}, | ||
[2] = {id = 2, name = "The Wisdom of Solitude", charm = 11262, type = Blessings.Types.REGULAR, losscount = true, inquisition = true}, | ||
[3] = {id = 3, name = "The Spark of the Phoenix", charm = 11258, type = Blessings.Types.REGULAR, losscount = true, inquisition = true}, | ||
[4] = {id = 4, name = "The Fire of the Suns", charm = 11261, type = Blessings.Types.REGULAR, losscount = true, inquisition = true}, | ||
[5] = {id = 5, name = "The Spiritual Shielding", charm = 11260, type = Blessings.Types.REGULAR, losscount = true, inquisition = true}, | ||
[6] = {id = 6, name = "The Embrace of Tibia", charm = 11259, type = Blessings.Types.REGULAR, losscount = true, inquisition = true}, | ||
[7] = {id = 7, name = "Blood of the Mountain", charm = 28036, type = Blessings.Types.ENHANCED, losscount = true, inquisition = false}, | ||
[8] = {id = 8, name = "Heart of the Mountain", charm = 28037, type = Blessings.Types.ENHANCED, losscount = true, inquisition = false} | ||
} | ||
|
||
|
||
Blessings.LossPercent = { | ||
[0] = {item = 100, skill = 0}, | ||
[1] = {item = 70, skill = 8}, | ||
[2] = {item = 45, skill = 16}, | ||
[3] = {item = 25, skill = 24}, | ||
[4] = {item = 10, skill = 32}, | ||
[5] = {item = 0, skill = 40}, | ||
[6] = {item = 0, skill = 48}, | ||
[7] = {item = 0, skill = 56}, | ||
[8] = {item = 0, skill = 56} | ||
} | ||
|
||
|
||
Blessings.BitWiseTable = { | ||
[0] = 1, | ||
[1] = 2, | ||
[2] = 4, | ||
[3] = 8, | ||
[4] = 16, | ||
[5] = 32, | ||
[6] = 64, | ||
[7] = 128, | ||
[8] = 256, | ||
[9] = 512, | ||
[10] = 1024, | ||
[11] = 2048, | ||
[12] = 4096, | ||
[13] = 8192, | ||
[14] = 16384, | ||
[15] = 32768 | ||
} |
Oops, something went wrong.