diff --git a/CHANGELOG b/CHANGELOG index 7a75c56e3..8220bab41 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -6,7 +6,7 @@ The Forgotten Server Version: 1.2 Codenamed - BOOM + PHANTOM Forum and website http://www.blacktibia.org/f19-otx-server-3 @@ -59,7 +59,7 @@ - Look Display ] -[ OTX Server 3.2 Version - " " +[ OTX Server 3.2 Version - "PHANTOM" - Added Monster Spawn event - Added DDoS protection (no complete) - Added Advance Save diff --git a/path_10_9/data/logs/DarkKonia commands.log b/path_10_9/data/logs/DarkKonia commands.log deleted file mode 100644 index d710052b4..000000000 --- a/path_10_9/data/logs/DarkKonia commands.log +++ /dev/null @@ -1,4 +0,0 @@ -[18/01/2016 13:23] /reload npc -[18/01/2016 13:23] /reload movements -[18/01/2016 13:24] /reload npc -[18/01/2016 13:25] /reload movements diff --git a/path_10_9/data/npc/Nimral.xml b/path_10_9/data/npc/Nimral.xml deleted file mode 100644 index 9eb14da8c..000000000 --- a/path_10_9/data/npc/Nimral.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/path_10_9/data/npc/Timral.xml b/path_10_9/data/npc/Timral.xml deleted file mode 100644 index 6186e61c0..000000000 --- a/path_10_9/data/npc/Timral.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/path_10_9/data/talkactions/talkactions.xml b/path_10_9/data/talkactions/talkactions.xml index 05f0f35d7..ae85082af 100644 --- a/path_10_9/data/talkactions/talkactions.xml +++ b/path_10_9/data/talkactions/talkactions.xml @@ -40,8 +40,10 @@ + + @@ -49,8 +51,6 @@ diff --git a/path_8_6/data/actions/scripts/other/doors.lua b/path_8_6/data/actions/scripts/other/doors.lua index d1fdbe1d6..0374d46a9 100644 --- a/path_8_6/data/actions/scripts/other/doors.lua +++ b/path_8_6/data/actions/scripts/other/doors.lua @@ -16,6 +16,9 @@ function onUse(player, item, fromPosition, target, toPosition, isHotkey) player:sendTextMessage(MESSAGE_INFO_DESCR, "Only the worthy may pass.") end return true + elseif isInArray(blockDoors, itemId) then + player:sendTextMessage(MESSAGE_STATUS_SMALL, "It is locked.") + return true elseif isInArray(keys, itemId) then if target.actionid > 0 then if item.actionid == target.actionid and doors[target.itemid] then diff --git a/path_8_6/data/actions/scripts/quests/system.lua b/path_8_6/data/actions/scripts/quests/system.lua new file mode 100644 index 000000000..9f37e462e --- /dev/null +++ b/path_8_6/data/actions/scripts/quests/system.lua @@ -0,0 +1,87 @@ +local specialQuests = {} +local questsExperience = {} +local questLog = {} + +function onUse(player, item, fromPosition, target, toPosition, isHotkey) + local storage = specialQuests[item.actionid] + if not storage then + storage = item.uid + if storage > 65535 then + return false + end + end + + if player:getStorageValue(storage) > 0 then + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'The ' .. ItemType(item.itemid):getName() .. ' is empty.') + return true + end + + local items, reward = {} + local size = item:isContainer() and item:getSize() or 0 + if size == 0 then + reward = item:clone() + else + local container = Container(item.uid) + for i = 0, container:getSize() - 1 do + items[#items + 1] = container:getItem(i):clone() + end + end + + size = #items + if size == 1 then + reward = items[1]:clone() + end + + local result = '' + if reward then + local ret = ItemType(reward.itemid) + if ret:isRune() then + result = ret:getArticle() .. ' ' .. ret:getName() .. ' (' .. reward.type .. ' charges)' + elseif ret:isStackable() and reward:getCount() > 1 then + result = reward:getCount() .. ' ' .. ret:getPluralName() + elseif ret:getArticle() ~= '' then + result = ret:getArticle() .. ' ' .. ret:getName() + else + result = ret:getName() + end + else + if size > 20 then + reward = Game.createItem(item.itemid, 1) + elseif size > 8 then + reward = Game.createItem(1988, 1) + else + reward = Game.createItem(1987, 1) + end + + for i = 1, size do + local tmp = items[i] + if reward:addItemEx(tmp) ~= RETURNVALUE_NOERROR then + print('[Warning] QuestSystem:', 'Could not add quest reward to container') + end + end + local ret = ItemType(reward.itemid) + result = ret:getArticle() .. ' ' .. ret:getName() + end + + if player:addItemEx(reward) ~= RETURNVALUE_NOERROR then + local weight = reward:getWeight() + if player:getFreeCapacity() < weight then + player:sendCancelMessage(string.format('You have found %s weighing %.2f oz. You have no capacity.', result, (weight / 100))) + else + player:sendCancelMessage('You have found ' .. result .. ', but you have no room to take it.') + end + return true + end + + if questsExperience[storage] then + player:addExperience(questsExperience[storage], true) + end + + if questLog[storage] then + player:setStorageValue(questLog[storage], 1) + end + + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You have found ' .. result .. '.') + player:setStorageValue(storage, 1) + return true +end diff --git a/path_8_6/data/actions/scripts/tools/shovel.lua b/path_8_6/data/actions/scripts/tools/shovel.lua index 3bacc66d8..d5fcd9b4e 100644 --- a/path_8_6/data/actions/scripts/tools/shovel.lua +++ b/path_8_6/data/actions/scripts/tools/shovel.lua @@ -1,5 +1,14 @@ local holes = {468, 481, 483} +local others = {7932} function onUse(player, item, fromPosition, target, toPosition, isHotkey) + local targetId = target.itemid, target.actionid + if isInArray(others, targetId) then + target:transform(targetId + 1) + target:decay() + + return true + end + if toPosition.x == CONTAINER_POSITION then return false end diff --git a/path_8_6/data/creaturescripts/creaturescripts.xml b/path_8_6/data/creaturescripts/creaturescripts.xml index 86e2c8c3a..18f666513 100644 --- a/path_8_6/data/creaturescripts/creaturescripts.xml +++ b/path_8_6/data/creaturescripts/creaturescripts.xml @@ -2,10 +2,13 @@ - + + + + diff --git a/path_8_6/data/creaturescripts/scripts/advance_save.lua b/path_8_6/data/creaturescripts/scripts/advance_save.lua new file mode 100644 index 000000000..b4095a9d0 --- /dev/null +++ b/path_8_6/data/creaturescripts/scripts/advance_save.lua @@ -0,0 +1,25 @@ +local config = { + heal = true, + save = true, + effect = false +} + +function onAdvance(player, skill, oldLevel, newLevel) + if skill ~= SKILL_LEVEL or newLevel <= oldLevel then + return true + end + + if config.effect then + player:getPosition():sendMagicEffect(math.random(CONST_ME_FIREWORK_YELLOW, CONST_ME_FIREWORK_BLUE)) + player:say('LEVEL UP!', TALKTYPE_MONSTER_SAY) + end + + if config.heal then + player:addHealth(player:getMaxHealth()) + end + + if config.save then + player:save() + end + return true +end diff --git a/path_8_6/data/creaturescripts/scripts/firstitems.lua b/path_8_6/data/creaturescripts/scripts/firstitems.lua index 9530f4657..38a9ec889 100644 --- a/path_8_6/data/creaturescripts/scripts/firstitems.lua +++ b/path_8_6/data/creaturescripts/scripts/firstitems.lua @@ -1,12 +1,52 @@ -local firstItems = {2050, 2382} +-- Without Rookgaard +local config = { + [1] = { + --equipment spellbook, wand of vortex, magician's robe, mage hat, studded legs, leather boots, scarf + items = {{2175, 1}, {2190, 1}, {8819, 1}, {8820, 1}, {2468, 1}, {2643, 1}, {2661, 1}}, + --container rope, shovel, mana potion + container = {{2120, 1}, {2554, 1}, {7620, 1}} + }, + [2] = { + --equipment spellbook, snakebite rod, magician's robe, mage hat, studded legs, leather boots scarf + items = {{2175, 1}, {2182, 1}, {8819, 1}, {8820, 1}, {2468, 1}, {2643, 1}, {2661, 1}}, + --container rope, shovel, mana potion + container = {{2120, 1}, {2554, 1}, {7620, 1}} + }, + [3] = { + --equipment dwrven shield, 5 spear, ranger's cloak, ranger legs scarf, legion helmet + items = {{2525, 1}, {2389, 5}, {2660, 1}, {8923, 1}, {2643, 1}, {2661, 1}, {2480, 1}}, + --container rope, shovel, health potion, bow, 50 arrow + container = {{2120, 1}, {2554, 1}, {7618, 1}, {2456, 1}, {2544, 50}} + }, + [4] = { + --equipment dwarven shield, steel axe, brass armor, brass helmet, brass legs scarf + items = {{2525, 1}, {8601, 1}, {2465, 1}, {2460, 1}, {2478, 1}, {2643, 1}, {2661, 1}}, + --container jagged sword, daramian mace, rope, shovel, health potion + container = {{8602, 1}, {2439, 1}, {2120, 1}, {2554, 1}, {7618, 1}} + } +} function onLogin(player) - if player:getLastLoginSaved() == 0 then - for i = 1, #firstItems do - player:addItem(firstItems[i], 1) - end - player:addItem(player:getSex() == 0 and 2651 or 2650, 1) - player:addItem(1987, 1):addItem(2674, 1) + local targetVocation = config[player:getVocation():getId()] + if not targetVocation then + return true + end + + if player:getLastLoginSaved() ~= 0 then + return true + end + + for i = 1, #targetVocation.items do + player:addItem(targetVocation.items[i][1], targetVocation.items[i][2]) + end + + local backpack = player:addItem(1988) + if not backpack then + return true + end + + for i = 1, #targetVocation.container do + backpack:addItem(targetVocation.container[i][1], targetVocation.container[i][2]) end return true end diff --git a/path_8_6/data/events/events.xml b/path_8_6/data/events/events.xml index 6c4848013..391d63bc5 100644 --- a/path_8_6/data/events/events.xml +++ b/path_8_6/data/events/events.xml @@ -15,10 +15,10 @@ - + - + diff --git a/path_8_6/data/events/scripts/player.lua b/path_8_6/data/events/scripts/player.lua index 85342847f..099884842 100644 --- a/path_8_6/data/events/scripts/player.lua +++ b/path_8_6/data/events/scripts/player.lua @@ -82,6 +82,32 @@ function Player:onLookInShop(itemType, count) end function Player:onMoveItem(item, count, fromPosition, toPosition) + if toPosition.x ~= CONTAINER_POSITION then + return true + end + + if item:getTopParent() == self and bit.band(toPosition.y, 0x40) == 0 then + local itemType, moveItem = ItemType(item:getId()) + if bit.band(itemType:getSlotPosition(), SLOTP_TWO_HAND) ~= 0 and toPosition.y == CONST_SLOT_LEFT then + moveItem = self:getSlotItem(CONST_SLOT_RIGHT) + elseif itemType:getWeaponType() == WEAPON_SHIELD and toPosition.y == CONST_SLOT_RIGHT then + moveItem = self:getSlotItem(CONST_SLOT_LEFT) + if moveItem and bit.band(ItemType(moveItem:getId()):getSlotPosition(), SLOTP_TWO_HAND) == 0 then + return true + end + end + + if moveItem then + local parent = item:getParent() + if parent:getSize() == parent:getCapacity() then + self:sendTextMessage(MESSAGE_STATUS_SMALL, Game.getReturnMessage(RETURNVALUE_CONTAINERNOTENOUGHROOM)) + return false + else + return moveItem:moveTo(parent) + end + end + end + return true end diff --git a/path_8_6/data/globalevents/globalevents.xml b/path_8_6/data/globalevents/globalevents.xml index e136115ce..8012f11aa 100644 --- a/path_8_6/data/globalevents/globalevents.xml +++ b/path_8_6/data/globalevents/globalevents.xml @@ -2,9 +2,8 @@ - - + + + + diff --git a/path_8_6/data/globalevents/scripts/cleanmap.lua b/path_8_6/data/globalevents/scripts/cleanmap.lua new file mode 100644 index 000000000..bc69435f4 --- /dev/null +++ b/path_8_6/data/globalevents/scripts/cleanmap.lua @@ -0,0 +1,10 @@ +local function saveServer() + cleanMap() + broadcastMessage("Clean map completed and the next clean at on 2 hours.", MESSAGE_STATUS_CONSOLE_RED) +end + +function onThink(interval) + broadcastMessage("Cleaning map in 5 minutes.", MESSAGE_STATUS_WARNING) + addEvent(saveServer, 5 * 60 * 1000) + return true +end diff --git a/path_8_6/data/globalevents/scripts/serversave.lua b/path_8_6/data/globalevents/scripts/serversave.lua index 3a6c2f59e..e943e74d5 100644 --- a/path_8_6/data/globalevents/scripts/serversave.lua +++ b/path_8_6/data/globalevents/scripts/serversave.lua @@ -1,33 +1,4 @@ -local shutdownAtServerSave = false -local cleanMapAtServerSave = false - -local function serverSave() - if shutdownAtServerSave then - Game.setGameState(GAME_STATE_SHUTDOWN) - else - Game.setGameState(GAME_STATE_CLOSED) - - if cleanMapAtServerSave then - cleanMap() - end - - Game.setGameState(GAME_STATE_NORMAL) - end -end - -local function secondServerSaveWarning() - broadcastMessage("Server is saving game in one minute. Please logout.", MESSAGE_STATUS_WARNING) - addEvent(serverSave, 60000) -end - -local function firstServerSaveWarning() - broadcastMessage("Server is saving game in 3 minutes. Please logout.", MESSAGE_STATUS_WARNING) - addEvent(secondServerSaveWarning, 120000) -end - -function onTime(interval) - broadcastMessage("Server is saving game in 5 minutes. Please logout.", MESSAGE_STATUS_WARNING) - Game.setGameState(GAME_STATE_STARTUP) - addEvent(firstServerSaveWarning, 120000) - return not shutdownAtServerSave +function onThink(interval) + saveServer() + return true end diff --git a/path_8_6/data/items/items.xml b/path_8_6/data/items/items.xml index c15fd825e..aab43bb9e 100644 --- a/path_8_6/data/items/items.xml +++ b/path_8_6/data/items/items.xml @@ -220,15 +220,19 @@ - + + + + + - + @@ -285,7 +289,7 @@ - + @@ -297,7 +301,7 @@ - + @@ -353,7 +357,7 @@ - + @@ -365,7 +369,7 @@ - + @@ -6788,7 +6792,7 @@ - + @@ -6822,7 +6826,7 @@ - + @@ -7950,7 +7954,7 @@ - + @@ -7958,7 +7962,7 @@ - + @@ -7966,7 +7970,7 @@ - + @@ -7974,13 +7978,13 @@ - + - + @@ -7993,7 +7997,7 @@ - + @@ -8014,14 +8018,15 @@ - + + - + @@ -8038,9 +8043,6 @@ - - - @@ -8170,7 +8172,7 @@ - + @@ -8182,7 +8184,7 @@ - + @@ -8328,7 +8330,7 @@ - + @@ -8362,7 +8364,7 @@ - + @@ -8396,7 +8398,7 @@ - + @@ -8430,7 +8432,7 @@ - + @@ -8464,7 +8466,7 @@ - + @@ -8476,7 +8478,7 @@ - + @@ -8488,7 +8490,7 @@ - + @@ -8500,7 +8502,7 @@ - + @@ -8529,7 +8531,7 @@ - + @@ -8541,7 +8543,7 @@ - + @@ -8649,7 +8651,6 @@ - @@ -9077,11 +9078,9 @@ - - - + @@ -9092,7 +9091,7 @@ - + @@ -10592,7 +10591,7 @@ - + @@ -10604,7 +10603,7 @@ - + @@ -10667,7 +10666,7 @@ - + @@ -10679,7 +10678,7 @@ - + @@ -11710,7 +11709,7 @@ - + @@ -11744,7 +11743,7 @@ - + @@ -11834,7 +11833,7 @@ - + @@ -11868,7 +11867,7 @@ - + @@ -12006,15 +12005,11 @@ - - - - - + @@ -13222,10 +13217,7 @@ - - - - + @@ -14912,7 +14904,7 @@ - + @@ -15237,7 +15229,10 @@ - + + + + @@ -15368,8 +15363,6 @@ - - @@ -15441,10 +15434,7 @@ - - - - + @@ -16463,9 +16453,7 @@ - - - + @@ -16670,7 +16658,7 @@ - + @@ -16678,7 +16666,7 @@ - + @@ -16747,7 +16735,7 @@ - + @@ -16755,7 +16743,7 @@ - + @@ -17719,7 +17707,7 @@ - + @@ -17800,7 +17788,6 @@ - @@ -17902,7 +17889,6 @@ - @@ -17961,7 +17947,7 @@ - + @@ -18263,7 +18249,7 @@ - + @@ -18275,7 +18261,7 @@ - + @@ -18614,7 +18600,7 @@ - + @@ -18648,7 +18634,7 @@ - + @@ -19008,11 +18994,6 @@ - - - - - @@ -19063,7 +19044,7 @@ - + @@ -19091,7 +19072,7 @@ - + @@ -19150,7 +19131,7 @@ - + @@ -20189,8 +20170,8 @@ - - + + @@ -20412,7 +20393,7 @@ - + @@ -20439,7 +20420,7 @@ - + @@ -20481,7 +20462,7 @@ - + @@ -20509,7 +20490,7 @@ - + @@ -20610,7 +20591,7 @@ - + diff --git a/path_8_6/data/lib/core/player.lua b/path_8_6/data/lib/core/player.lua index db09d6816..7f5aae17e 100644 --- a/path_8_6/data/lib/core/player.lua +++ b/path_8_6/data/lib/core/player.lua @@ -32,17 +32,17 @@ function Player.getDepotItems(self, depotId) return self:getDepotChest(depotId, true):getItemHoldingCount() end -local lossPercent = { - [0] = 100, - [1] = 70, - [2] = 45, - [3] = 25, - [4] = 10, - [5] = 0 -} - function Player.getLossPercent(self) local blessings = 0 + local lossPercent = { + [0] = 100, + [1] = 70, + [2] = 45, + [3] = 25, + [4] = 10, + [5] = 0 + } + for i = 1, 5 do if self:hasBlessing(i) then blessings = blessings + 1 diff --git a/path_8_6/data/lib/custom/custom.lua b/path_8_6/data/lib/custom/custom.lua new file mode 100644 index 000000000..3a1167657 --- /dev/null +++ b/path_8_6/data/lib/custom/custom.lua @@ -0,0 +1,85 @@ +function isNumber(str) + return tonumber(str) ~= nil +end + +function getAccountNumberByPlayerName(name) + local player = Player(name) + if player ~= nil then + return player:getAccountId() + end + + local resultId = db.storeQuery("SELECT `account_id` FROM `players` WHERE `name` = " .. db.escapeString(name)) + if resultId ~= false then + local accountId = result.getNumber(resultId, "account_id") + result.free(resultId) + return accountId + end + return 0 +end + +function getMoneyCount(string) + local b, e = string:find("%d+") + local money = b and e and tonumber(string:sub(b, e)) or -1 + if isValidMoney(money) then + return money + end + return -1 +end + +function getMoneyWeight(money) + local gold = money + local crystal = math.floor(gold / 10000) + gold = gold - crystal * 10000 + local platinum = math.floor(gold / 100) + gold = gold - platinum * 100 + return (ItemType(2160):getWeight() * crystal) + (ItemType(2152):getWeight() * platinum) + (ItemType(2148):getWeight() * gold) +end + +function getRealDate() + local month = tonumber(os.date("%m", os.time())) + local day = tonumber(os.date("%d", os.time())) + + if month < 10 then + month = '0' .. month + end + if day < 10 then + day = '0' .. day + end + return day .. '/' .. month +end + +function getRealTime() + local hours = tonumber(os.date("%H", os.time())) + local minutes = tonumber(os.date("%M", os.time())) + + if hours < 10 then + hours = '0' .. hours + end + if minutes < 10 then + minutes = '0' .. minutes + end + return hours .. ':' .. minutes +end + +function isValidMoney(money) + return isNumber(money) and money > 0 and money < 4294967296 +end + +function iterateArea(func, from, to) + for z = from.z, to.z do + for y = from.y, to.y do + for x = from.x, to.x do + func(Position(x, y, z)) + end + end + end +end + +function playerExists(name) + local resultId = db.storeQuery('SELECT `name` FROM `players` WHERE `name` = ' .. db.escapeString(name)) + if resultId then + result.free(resultId) + return true + end + return false +end diff --git a/path_8_6/data/lib/custom/storages.lua b/path_8_6/data/lib/custom/storages.lua new file mode 100644 index 000000000..0cbf79c31 --- /dev/null +++ b/path_8_6/data/lib/custom/storages.lua @@ -0,0 +1,5 @@ +-- STORAGES -- +-- (HIGHLY RECOMMENDED -> ONE mission per STORAGE) -- +-- Sort it in Values - + +Storage = {} diff --git a/path_8_6/data/lib/lib.lua b/path_8_6/data/lib/lib.lua index 5a0e2b553..2ffc31da5 100644 --- a/path_8_6/data/lib/lib.lua +++ b/path_8_6/data/lib/lib.lua @@ -3,3 +3,7 @@ dofile('data/lib/core/core.lua') -- Compatibility library for our old Lua API dofile('data/lib/compat/compat.lua') + +-- Custom +dofile('data/lib/custom/custom.lua') +dofile('data/lib/custom/storages.lua') diff --git a/path_8_6/data/movements/movements.xml b/path_8_6/data/movements/movements.xml index 45ffc338f..7cc1de679 100644 --- a/path_8_6/data/movements/movements.xml +++ b/path_8_6/data/movements/movements.xml @@ -27,6 +27,7 @@ + @@ -177,6 +178,8 @@ + + diff --git a/path_8_6/data/movements/scripts/citizen.lua b/path_8_6/data/movements/scripts/citizen.lua index 94e882d5e..541cfa3a6 100644 --- a/path_8_6/data/movements/scripts/citizen.lua +++ b/path_8_6/data/movements/scripts/citizen.lua @@ -7,6 +7,7 @@ function onStepIn(creature, item, position, fromPosition) local town = Town(item.actionid - 30020) player:setTown(town) + player:sendTextMessage(MESSAGE_INFO_DESCR, "You are the newest resident of " .. town:getName(town) .. ".") end return true end diff --git a/path_8_6/data/npc/Alice.xml b/path_8_6/data/npc/Alice.xml index 755d769ea..5f02ca5ea 100644 --- a/path_8_6/data/npc/Alice.xml +++ b/path_8_6/data/npc/Alice.xml @@ -1,9 +1,5 @@ - - - - - - - - - \ No newline at end of file + + + + + diff --git a/path_8_6/data/npc/Deruno.xml b/path_8_6/data/npc/Deruno.xml index 9e56d893c..3015d5fff 100644 --- a/path_8_6/data/npc/Deruno.xml +++ b/path_8_6/data/npc/Deruno.xml @@ -4,8 +4,6 @@ - - - \ No newline at end of file + diff --git a/path_8_6/data/npc/Eryn.xml b/path_8_6/data/npc/Eryn.xml index 93622cdbf..3ee6f7476 100644 --- a/path_8_6/data/npc/Eryn.xml +++ b/path_8_6/data/npc/Eryn.xml @@ -3,7 +3,7 @@ - + diff --git a/path_8_6/data/npc/Naji.xml b/path_8_6/data/npc/Naji.xml new file mode 100644 index 000000000..7aa02a4f0 --- /dev/null +++ b/path_8_6/data/npc/Naji.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/path_8_6/data/npc/Nimral.xml b/path_8_6/data/npc/Nimral.xml deleted file mode 100644 index 9eb14da8c..000000000 --- a/path_8_6/data/npc/Nimral.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/path_8_6/data/npc/Riona.xml b/path_8_6/data/npc/Riona.xml index ed6df9a6f..13a1df43f 100644 --- a/path_8_6/data/npc/Riona.xml +++ b/path_8_6/data/npc/Riona.xml @@ -1,9 +1,9 @@ - - + + - - + + diff --git a/path_8_6/data/npc/Timral.xml b/path_8_6/data/npc/Timral.xml deleted file mode 100644 index 6186e61c0..000000000 --- a/path_8_6/data/npc/Timral.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/path_8_6/data/npc/lib/npc.lua b/path_8_6/data/npc/lib/npc.lua index 8161efeab..c6d3e2cf6 100644 --- a/path_8_6/data/npc/lib/npc.lua +++ b/path_8_6/data/npc/lib/npc.lua @@ -1,5 +1,6 @@ -- Including the Advanced NPC System dofile('data/npc/lib/npcsystem/npcsystem.lua') +dofile('data/npc/lib/npcsystem/customModules.lua') function msgcontains(message, keyword) local message, keyword = message:lower(), keyword:lower() diff --git a/path_8_6/data/npc/lib/npcsystem/customModules.lua b/path_8_6/data/npc/lib/npcsystem/customModules.lua new file mode 100644 index 000000000..f44c8a8b0 --- /dev/null +++ b/path_8_6/data/npc/lib/npcsystem/customModules.lua @@ -0,0 +1,192 @@ +-- Custom Modules, created to help us in this datapack +local travelDiscounts = { + ['postman'] = {price = 10, storage = 12460, value = 3}, + ['new frontier'] = {price = 50, storage = 12133, value = 1} +} + +function StdModule.travelDiscount(player, discounts) + local discountPrice, discount = 0 + if type(discounts) == 'string' then + discount = travelDiscounts[discounts] + if discount and player:getStorageValue(discount.storage) >= discount.value then + return discount.price + end + else + for i = 1, #discounts do + discount = travelDiscounts[discounts[i]] + if discount and player:getStorageValue(discount.storage) >= discount.value then + discountPrice = discountPrice + discount.price + end + end + end + + return discountPrice +end + +function StdModule.kick(cid, message, keywords, parameters, node) + local npcHandler = parameters.npcHandler + if npcHandler == nil then + error("StdModule.travel called without any npcHandler instance.") + end + + if not npcHandler:isFocused(cid) then + return false + end + + npcHandler:releaseFocus(cid) + npcHandler:say(parameters.text or "Off with you!", cid) + + local destination = parameters.destination + if type(destination) == 'table' then + destination = destination[math.random(#destination)] + end + + Player(cid):teleportTo(destination, true) + + npcHandler:resetNpc(cid) + return true +end + +local GreetModule = {} +function GreetModule.greet(cid, message, keywords, parameters) + if not parameters.npcHandler:isInRange(cid) then + return true + end + + if parameters.npcHandler:isFocused(cid) then + return true + end + + local parseInfo = { [TAG_PLAYERNAME] = Player(cid):getName() } + parameters.npcHandler:say(parameters.npcHandler:parseMessage(parameters.text, parseInfo), cid, true) + parameters.npcHandler:addFocus(cid) + return true +end + +function GreetModule.farewell(cid, message, keywords, parameters) + if not parameters.npcHandler:isFocused(cid) then + return false + end + + local parseInfo = { [TAG_PLAYERNAME] = Player(cid):getName() } + parameters.npcHandler:say(parameters.npcHandler:parseMessage(parameters.text, parseInfo), cid, true) + parameters.npcHandler:resetNpc(cid) + parameters.npcHandler:releaseFocus(cid) + return true +end + +-- Adds a keyword which acts as a greeting word +function KeywordHandler:addGreetKeyword(keys, parameters, condition, action) + local keys = keys + keys.callback = FocusModule.messageMatcherDefault + return self:addKeyword(keys, GreetModule.greet, parameters, condition, action) +end + +-- Adds a keyword which acts as a farewell word +function KeywordHandler:addFarewellKeyword(keys, parameters, condition, action) + local keys = keys + keys.callback = FocusModule.messageMatcherDefault + return self:addKeyword(keys, GreetModule.farewell, parameters, condition, action) +end + +-- Adds a keyword which acts as a spell word +function KeywordHandler:addSpellKeyword(keys, parameters) + local keys = keys + keys.callback = FocusModule.messageMatcherDefault + + local npcHandler, spellName, price, vocationId = parameters.npcHandler, parameters.spellName, parameters.price, parameters.vocation + local spellKeyword = self:addKeyword(keys, StdModule.say, {npcHandler = npcHandler, text = string.format("Do you want to learn the spell '%s' for %s?", spellName, price > 0 and price .. ' gold' or 'free')}, + function(player) + local baseVocationId = player:getVocation():getBase():getId() + if type(vocationId) == 'table' then + return isInArray(vocationId, baseVocationId) + else + return vocationId == baseVocationId + end + end + ) + + spellKeyword:addChildKeyword({'yes'}, StdModule.learnSpell, {npcHandler = npcHandler, spellName = spellName, level = parameters.level, price = price}) + spellKeyword:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, text = 'Maybe next time.', reset = true}) +end + +local hints = { + [-1] = 'If you don\'t know the meaning of an icon on the right side, move the mouse cursor on it and wait a moment.', + [0] = 'Send private messages to other players by right-clicking on the player or the player\'s name and select \'Message to ....\'. You can also open a \'private message channel\' and type in the name of the player.', + [1] = 'Use the shortcuts \'SHIFT\' to look, \'CTRL\' for use and \'ALT\' for attack when clicking on an object or player.', + [2] = 'If you already know where you want to go, click on the automap and your character will walk there automatically if the location is reachable and not too far away.', + [3] = 'To open or close skills, battle or VIP list, click on the corresponding button to the right.', + [4] = '\'Capacity\' restricts the amount of things you can carry with you. It raises with each level.', + [5] = 'Always have a look on your health bar. If you see that you do not regenerate health points anymore, eat something.', + [6] = 'Always eat as much food as possible. This way, you\'ll regenerate health points for a longer period of time.', + [7] = 'After you have killed a monster, you have 10 seconds in which the corpse is not moveable and no one else but you can loot it.', + [8] = 'Be careful when you approach three or more monsters because you only can block the attacks of two. In such a situation even a few rats can do severe damage or even kill you.', + [9] = 'There are many ways to gather food. Many creatures drop food but you can also pick blueberries or bake your own bread. If you have a fishing rod and worms in your inventory, you can also try to catch a fish.', + [10] = {'Baking bread is rather complex. First of all you need a scythe to harvest wheat. Then you use the wheat with a millstone to get flour. ...', 'This can be be used on water to get dough, which can be used on an oven to bake bread. Use milk instead of water to get cake dough.'}, + [11] = 'Dying hurts! Better run away than risk your life. You are going to lose experience and skill points when you die.', + [12] = 'When you switch to \'Offensive Fighting\', you deal out more damage but you also get hurt more easily.', + [13] = 'When you are on low health and need to run away from a monster, switch to \'Defensive Fighting\' and the monster will hit you less severely.', + [14] = 'Many creatures try to run away from you. Select \'Chase Opponent\' to follow them.', + [15] = 'The deeper you enter a dungeon, the more dangerous it will be. Approach every dungeon with utmost care or an unexpected creature might kill you. This will result in losing experience and skill points.', + [16] = 'Due to the perspective, some objects in Tibia are not located at the spot they seem to appear (ladders, windows, lamps). Try clicking on the floor tile the object would lie on.', + [17] = 'If you want to trade an item with another player, right-click on the item and select \'Trade with ...\', then click on the player with whom you want to trade.', + [18] = 'Stairs, ladders and dungeon entrances are marked as yellow dots on the automap.', + [19] = 'You can get food by killing animals or monsters. You can also pick blueberries or bake your own bread. If you are too lazy or own too much money, you can also buy food.', + [20] = 'Quest containers can be recognised easily. They don\'t open up regularly but display a message \'You have found ....\'. They can only be opened once.', + [21] = 'Better run away than risk to die. You\'ll lose experience and skill points each time you die.', + [22] = 'You can form a party by right-clicking on a player and selecting \'Invite to Party\'. The party leader can also enable \'Shared Experience\' by right-clicking on him- or herself.', + [23] = 'You can assign spells, the use of items, or random text to \'hotkeys\'. You find them under \'Options\'.', + [24] = 'You can also follow other players. Just right-click on the player and select \'Follow\'.', + [25] = 'You can found a party with your friends by right-clicking on a player and selecting \'Invite to Party\'. If you are invited to a party, right-click on yourself and select \'Join Party\'.', + [26] = 'Only found parties with people you trust. You can attack people in your party without getting a skull. This is helpful for training your skills, but can be abused to kill people without having to fear negative consequences.', + [27] = 'The leader of a party has the option to distribute gathered experience among all players in the party. If you are the leader, right-click on yourself and select \'Enable Shared Experience\'.', + [28] = 'There is nothing more I can tell you. If you are still in need of some {hints}, I can repeat them for you.' +} + +-- VoiceModule +VoiceModule = { + voices = nil, + voiceCount = 0, + lastVoice = 0, + timeout = nil, + chance = nil, + npcHandler = nil +} + +-- Creates a new instance of VoiceModule +function VoiceModule:new(voices, timeout, chance) + local obj = {} + setmetatable(obj, self) + self.__index = self + + obj.voices = voices + for i = 1, #obj.voices do + local voice = obj.voices[i] + if voice.yell then + voice.yell = nil + voice.talktype = TALKTYPE_YELL + else + voice.talktype = TALKTYPE_SAY + end + end + + obj.voiceCount = #voices + obj.timeout = timeout or 10 + obj.chance = chance or 25 + return obj +end + +function VoiceModule:init(handler) + return true +end + +function VoiceModule:callbackOnThink() + if self.lastVoice < os.time() then + self.lastVoice = os.time() + self.timeout + if math.random(100) < self.chance then + local voice = self.voices[math.random(self.voiceCount)] + Npc():say(voice.text, voice.talktype) + end + end + return true +end diff --git a/path_8_6/data/npc/lib/npcsystem/npchandler.lua b/path_8_6/data/npc/lib/npcsystem/npchandler.lua index fb7985fc9..dd82d4f34 100644 --- a/path_8_6/data/npc/lib/npcsystem/npchandler.lua +++ b/path_8_6/data/npc/lib/npcsystem/npchandler.lua @@ -358,6 +358,16 @@ if NpcHandler == nil then -- Handles onCreatureAppear events. If you with to handle this yourself, please use the CALLBACK_CREATURE_APPEAR callback. function NpcHandler:onCreatureAppear(creature) local cid = creature:getId() + if cid == getNpcCid() and next(self.shopItems) ~= nil then + local npc = Npc() + local speechBubble = npc:getSpeechBubble() + if speechBubble == 3 then + npc:setSpeechBubble(4) + else + npc:setSpeechBubble(2) + end + end + local callback = self:getCallback(CALLBACK_CREATURE_APPEAR) if callback == nil or callback(cid) then if self:processModuleCallback(CALLBACK_CREATURE_APPEAR, cid) then diff --git a/path_8_6/data/npc/scripts/bank.lua b/path_8_6/data/npc/scripts/bank.lua new file mode 100644 index 000000000..e20f20a92 --- /dev/null +++ b/path_8_6/data/npc/scripts/bank.lua @@ -0,0 +1,323 @@ +local keywordHandler = KeywordHandler:new() +local npcHandler = NpcHandler:new(keywordHandler) +NpcSystem.parseParameters(npcHandler) + +local count = {} +local transfer = {} + +function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end +function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end +function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end +function onThink() npcHandler:onThink() end + +local voices = { {text = 'It\'s a wise idea to store your money in your bank account.'} } +npcHandler:addModule(VoiceModule:new(voices)) + +local function greetCallback(cid) + count[cid], transfer[cid] = nil, nil + return true +end + +local function creatureSayCallback(cid, type, msg) + if not npcHandler:isFocused(cid) then + return false + end + local player = Player(cid) +---------------------------- help ------------------------ + if msgcontains(msg, 'bank account') then + npcHandler:say({ + 'Every Tibian has one. The big advantage is that you can access your money in every branch of the Tibian Bank! ...', + 'Would you like to know more about the {basic} functions of your bank account, the {advanced} functions, or are you already bored, perhaps?' + }, cid) + npcHandler.topic[cid] = 0 + return true +---------------------------- balance --------------------- + elseif msgcontains(msg, 'balance') then + npcHandler.topic[cid] = 0 + if player:getBankBalance() >= 100000000 then + npcHandler:say('I think you must be one of the richest inhabitants in the world! Your account balance is ' .. player:getBankBalance() .. ' gold.', cid) + return true + elseif player:getBankBalance() >= 10000000 then + npcHandler:say('You have made ten millions and it still grows! Your account balance is ' .. player:getBankBalance() .. ' gold.', cid) + return true + elseif player:getBankBalance() >= 1000000 then + npcHandler:say('Wow, you have reached the magic number of a million gp!!! Your account balance is ' .. player:getBankBalance() .. ' gold!', cid) + return true + elseif player:getBankBalance() >= 100000 then + npcHandler:say('You certainly have made a pretty penny. Your account balance is ' .. player:getBankBalance() .. ' gold.', cid) + return true + else + npcHandler:say('Your account balance is ' .. player:getBankBalance() .. ' gold.', cid) + return true + end +---------------------------- deposit --------------------- + elseif msgcontains(msg, 'deposit') then + count[cid] = player:getMoney() + if count[cid] < 1 then + npcHandler:say('You do not have enough gold.', cid) + npcHandler.topic[cid] = 0 + return false + end + if msgcontains(msg, 'all') then + count[cid] = player:getMoney() + npcHandler:say('Would you really like to deposit ' .. count[cid] .. ' gold?', cid) + npcHandler.topic[cid] = 2 + return true + else + if string.match(msg,'%d+') then + count[cid] = getMoneyCount(msg) + if count[cid] < 1 then + npcHandler:say('You do not have enough gold.', cid) + npcHandler.topic[cid] = 0 + return false + end + npcHandler:say('Would you really like to deposit ' .. count[cid] .. ' gold?', cid) + npcHandler.topic[cid] = 2 + return true + else + npcHandler:say('Please tell me how much gold it is you would like to deposit.', cid) + npcHandler.topic[cid] = 1 + return true + end + end + if not isValidMoney(count[cid]) then + npcHandler:say('Sorry, but you can\'t deposit that much.', cid) + npcHandler.topic[cid] = 0 + return false + end + elseif npcHandler.topic[cid] == 1 then + count[cid] = getMoneyCount(msg) + if isValidMoney(count[cid]) then + npcHandler:say('Would you really like to deposit ' .. count[cid] .. ' gold?', cid) + npcHandler.topic[cid] = 2 + return true + else + npcHandler:say('You do not have enough gold.', cid) + npcHandler.topic[cid] = 0 + return true + end + elseif npcHandler.topic[cid] == 2 then + if msgcontains(msg, 'yes') then + if player:getMoney() >= tonumber(count[cid]) then + player:depositMoney(count[cid]) + npcHandler:say('Alright, we have added the amount of ' .. count[cid] .. ' gold to your {balance}. You can {withdraw} your money anytime you want to.', cid) + else + npcHandler:say('You do not have enough gold.', cid) + end + elseif msgcontains(msg, 'no') then + npcHandler:say('As you wish. Is there something else I can do for you?', cid) + end + npcHandler.topic[cid] = 0 + return true +---------------------------- withdraw -------------------- + elseif msgcontains(msg, 'withdraw') then + if string.match(msg,'%d+') then + count[cid] = getMoneyCount(msg) + if isValidMoney(count[cid]) then + npcHandler:say('Are you sure you wish to withdraw ' .. count[cid] .. ' gold from your bank account?', cid) + npcHandler.topic[cid] = 7 + else + npcHandler:say('There is not enough gold on your account.', cid) + npcHandler.topic[cid] = 0 + end + return true + else + npcHandler:say('Please tell me how much gold you would like to withdraw.', cid) + npcHandler.topic[cid] = 6 + return true + end + elseif npcHandler.topic[cid] == 6 then + count[cid] = getMoneyCount(msg) + if isValidMoney(count[cid]) then + npcHandler:say('Are you sure you wish to withdraw ' .. count[cid] .. ' gold from your bank account?', cid) + npcHandler.topic[cid] = 7 + else + npcHandler:say('There is not enough gold on your account.', cid) + npcHandler.topic[cid] = 0 + end + return true + elseif npcHandler.topic[cid] == 7 then + if msgcontains(msg, 'yes') then + if player:getFreeCapacity() >= getMoneyWeight(count[cid]) then + if not player:withdrawMoney(count[cid]) then + npcHandler:say('There is not enough gold on your account.', cid) + else + npcHandler:say('Here you are, ' .. count[cid] .. ' gold. Please let me know if there is something else I can do for you.', cid) + end + else + npcHandler:say('Whoah, hold on, you have no room in your inventory to carry all those coins. I don\'t want you to drop it on the floor, maybe come back with a cart!', cid) + end + npcHandler.topic[cid] = 0 + elseif msgcontains(msg, 'no') then + npcHandler:say('The customer is king! Come back anytime you want to if you wish to {withdraw} your money.', cid) + npcHandler.topic[cid] = 0 + end + return true +---------------------------- transfer -------------------- + elseif msgcontains(msg, 'transfer') then + npcHandler:say('Please tell me the amount of gold you would like to transfer.', cid) + npcHandler.topic[cid] = 11 + elseif npcHandler.topic[cid] == 11 then + count[cid] = getMoneyCount(msg) + if player:getBankBalance() < count[cid] then + npcHandler:say('There is not enough gold on your account.', cid) + npcHandler.topic[cid] = 0 + return true + end + if isValidMoney(count[cid]) then + npcHandler:say('Who would you like transfer ' .. count[cid] .. ' gold to?', cid) + npcHandler.topic[cid] = 12 + else + npcHandler:say('There is not enough gold on your account.', cid) + npcHandler.topic[cid] = 0 + end + elseif npcHandler.topic[cid] == 12 then + transfer[cid] = msg + if player:getName() == transfer[cid] then + npcHandler:say('Fill in this field with person who receives your gold!', cid) + npcHandler.topic[cid] = 0 + return true + end + if playerExists(transfer[cid]) then + npcHandler:say('So you would like to transfer ' .. count[cid] .. ' gold to ' .. transfer[cid] .. '?', cid) + npcHandler.topic[cid] = 13 + else + npcHandler:say('This player does not exist.', cid) + npcHandler.topic[cid] = 0 + end + elseif npcHandler.topic[cid] == 13 then + if msgcontains(msg, 'yes') then + if not player:transferMoneyTo(transfer[cid], count[cid]) then + npcHandler:say('You cannot transfer money to this account.', cid) + else + npcHandler:say('Very well. You have transferred ' .. count[cid] .. ' gold to ' .. transfer[cid] ..'.', cid) + transfer[cid] = nil + end + elseif msgcontains(msg, 'no') then + npcHandler:say('Alright, is there something else I can do for you?', cid) + end + npcHandler.topic[cid] = 0 +---------------------------- money exchange -------------- + elseif msgcontains(msg, 'change gold') then + npcHandler:say('How many platinum coins would you like to get?', cid) + npcHandler.topic[cid] = 14 + elseif npcHandler.topic[cid] == 14 then + if getMoneyCount(msg) < 1 then + npcHandler:say('Sorry, you do not have enough gold coins.', cid) + npcHandler.topic[cid] = 0 + else + count[cid] = getMoneyCount(msg) + npcHandler:say('So you would like me to change ' .. count[cid] * 100 .. ' of your gold coins into ' .. count[cid] .. ' platinum coins?', cid) + npcHandler.topic[cid] = 15 + end + elseif npcHandler.topic[cid] == 15 then + if msgcontains(msg, 'yes') then + if player:removeItem(2148, count[cid] * 100) then + player:addItem(2152, count[cid]) + npcHandler:say('Here you are.', cid) + else + npcHandler:say('Sorry, you do not have enough gold coins.', cid) + end + else + npcHandler:say('Well, can I help you with something else?', cid) + end + npcHandler.topic[cid] = 0 + elseif msgcontains(msg, 'change platinum') then + npcHandler:say('Would you like to change your platinum coins into gold or crystal?', cid) + npcHandler.topic[cid] = 16 + elseif npcHandler.topic[cid] == 16 then + if msgcontains(msg, 'gold') then + npcHandler:say('How many platinum coins would you like to change into gold?', cid) + npcHandler.topic[cid] = 17 + elseif msgcontains(msg, 'crystal') then + npcHandler:say('How many crystal coins would you like to get?', cid) + npcHandler.topic[cid] = 19 + else + npcHandler:say('Well, can I help you with something else?', cid) + npcHandler.topic[cid] = 0 + end + elseif npcHandler.topic[cid] == 17 then + if getMoneyCount(msg) < 1 then + npcHandler:say('Sorry, you do not have enough platinum coins.', cid) + npcHandler.topic[cid] = 0 + else + count[cid] = getMoneyCount(msg) + npcHandler:say('So you would like me to change ' .. count[cid] .. ' of your platinum coins into ' .. count[cid] * 100 .. ' gold coins for you?', cid) + npcHandler.topic[cid] = 18 + end + elseif npcHandler.topic[cid] == 18 then + if msgcontains(msg, 'yes') then + if player:removeItem(2152, count[cid]) then + player:addItem(2148, count[cid] * 100) + npcHandler:say('Here you are.', cid) + else + npcHandler:say('Sorry, you do not have enough platinum coins.', cid) + end + else + npcHandler:say('Well, can I help you with something else?', cid) + end + npcHandler.topic[cid] = 0 + elseif npcHandler.topic[cid] == 19 then + if getMoneyCount(msg) < 1 then + npcHandler:say('Sorry, you do not have enough platinum coins.', cid) + npcHandler.topic[cid] = 0 + else + count[cid] = getMoneyCount(msg) + npcHandler:say('So you would like me to change ' .. count[cid] * 100 .. ' of your platinum coins into ' .. count[cid] .. ' crystal coins for you?', cid) + npcHandler.topic[cid] = 20 + end + elseif npcHandler.topic[cid] == 20 then + if msgcontains(msg, 'yes') then + if player:removeItem(2152, count[cid] * 100) then + player:addItem(2160, count[cid]) + npcHandler:say('Here you are.', cid) + else + npcHandler:say('Sorry, you do not have enough platinum coins.', cid) + end + else + npcHandler:say('Well, can I help you with something else?', cid) + end + npcHandler.topic[cid] = 0 + elseif msgcontains(msg, 'change crystal') then + npcHandler:say('How many crystal coins would you like to change into platinum?', cid) + npcHandler.topic[cid] = 21 + elseif npcHandler.topic[cid] == 21 then + if getMoneyCount(msg) < 1 then + npcHandler:say('Sorry, you do not have enough crystal coins.', cid) + npcHandler.topic[cid] = 0 + else + count[cid] = getMoneyCount(msg) + npcHandler:say('So you would like me to change ' .. count[cid] .. ' of your crystal coins into ' .. count[cid] * 100 .. ' platinum coins for you?', cid) + npcHandler.topic[cid] = 22 + end + elseif npcHandler.topic[cid] == 22 then + if msgcontains(msg, 'yes') then + if player:removeItem(2160, count[cid]) then + player:addItem(2152, count[cid] * 100) + npcHandler:say('Here you are.', cid) + else + npcHandler:say('Sorry, you do not have enough crystal coins.', cid) + end + else + npcHandler:say('Well, can I help you with something else?', cid) + end + npcHandler.topic[cid] = 0 + end + return true +end + +keywordHandler:addKeyword({'money'}, StdModule.say, {npcHandler = npcHandler, text = 'We can {change} money for you. You can also access your {bank account}.'}) +keywordHandler:addKeyword({'change'}, StdModule.say, {npcHandler = npcHandler, text = 'There are three different coin types in Tibia: 100 gold coins equal 1 platinum coin, 100 platinum coins equal 1 crystal coin. So if you\'d like to change 100 gold into 1 platinum, simply say \'{change gold}\' and then \'1 platinum\'.'}) +keywordHandler:addKeyword({'bank'}, StdModule.say, {npcHandler = npcHandler, text = 'We can {change} money for you. You can also access your {bank account}.'}) +keywordHandler:addKeyword({'advanced'}, StdModule.say, {npcHandler = npcHandler, text = 'Your bank account will be used automatically when you want to {rent} a house or place an offer on an item on the {market}. Let me know if you want to know about how either one works.'}) +keywordHandler:addKeyword({'help'}, StdModule.say, {npcHandler = npcHandler, text = 'You can check the {balance} of your bank account, {deposit} money or {withdraw} it. You can also {transfer} money to other characters, provided that they have a vocation.'}) +keywordHandler:addKeyword({'functions'}, StdModule.say, {npcHandler = npcHandler, text = 'You can check the {balance} of your bank account, {deposit} money or {withdraw} it. You can also {transfer} money to other characters, provided that they have a vocation.'}) +keywordHandler:addKeyword({'basic'}, StdModule.say, {npcHandler = npcHandler, text = 'You can check the {balance} of your bank account, {deposit} money or {withdraw} it. You can also {transfer} money to other characters, provided that they have a vocation.'}) +keywordHandler:addKeyword({'job'}, StdModule.say, {npcHandler = npcHandler, text = 'I work in this bank. I can change money for you and help you with your bank account.'}) +keywordHandler:addKeyword({'name'}, StdModule.say, {npcHandler = npcHandler, text = "My name is Naji. My mother gave me that name because she knew a Paladin with that name. I'm a spare timer hunter by myself, you know! I want to join the {Paw and Fur - hunting elite}!"}) +keywordHandler:addKeyword({'paw and fur'}, StdModule.say, {npcHandler = npcHandler, text = "The Paw and Fur - Hunting Elite is a newly founded hunting society in Port Hope. It is said that they send you on hunting mission. Sounds great if you ask me."}) + +npcHandler:setMessage(MESSAGE_GREET, 'Welcome to the Tibian {bank}, |PLAYERNAME|! What can I do for you?') +npcHandler:setCallback(CALLBACK_GREET, greetCallback) +npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) +npcHandler:addModule(FocusModule:new()) diff --git a/path_8_6/data/npc/scripts/runes.lua b/path_8_6/data/npc/scripts/runes.lua index d111ae736..1ff39598c 100644 --- a/path_8_6/data/npc/scripts/runes.lua +++ b/path_8_6/data/npc/scripts/runes.lua @@ -73,23 +73,23 @@ shopModule:addBuyableItem({'hailstorm rod', 'hailstorm'}, 2183, 15000, 'hailstor shopModule:addBuyableItem({'springsprout rod', 'springsprout'}, 8912, 18000, 'springsprout rod') shopModule:addBuyableItem({'underworld rod', 'underworld'}, 8910, 22000, 'underworld rod') -shopModule:addSellableItem({'wand of vortex', 'vortex'}, 2190, 100, 'wand of vortex') -shopModule:addSellableItem({'wand of dragonbreath', 'dragonbreath'}, 2191, 200, 'wand of dragonbreath') -shopModule:addSellableItem({'wand of decay', 'decay'}, 2188, 1000, 'wand of decay') -shopModule:addSellableItem({'wand of draconia', 'draconia'}, 8921, 1500, 'wand of draconia') -shopModule:addSellableItem({'wand of cosmic energy', 'cosmic energy'}, 2189, 2000, 'wand of cosmic energy') -shopModule:addSellableItem({'wand of inferno', 'inferno'}, 2187, 3000, 'wand of inferno') -shopModule:addSellableItem({'wand of starstorm', 'starstorm'}, 8920, 3600, 'wand of starstorm') -shopModule:addSellableItem({'wand of voodoo', 'voodoo'}, 8922, 4400, 'wand of voodoo') - -shopModule:addSellableItem({'snakebite rod', 'snakebite'}, 2182, 100, 'snakebite rod') -shopModule:addSellableItem({'moonlight rod', 'moonlight'}, 2186, 200, 'moonlight rod') -shopModule:addSellableItem({'necrotic rod', 'necrotic'}, 2185, 1000, 'necrotic rod') -shopModule:addSellableItem({'northwind rod', 'northwind'}, 8911, 1500, 'northwind rod') -shopModule:addSellableItem({'terra rod', 'terra'}, 2181, 2000, 'terra rod') -shopModule:addSellableItem({'hailstorm rod', 'hailstorm'}, 2183, 3000, 'hailstorm rod') -shopModule:addSellableItem({'springsprout rod', 'springsprout'}, 8912, 3600, 'springsprout rod') -shopModule:addSellableItem({'underworld rod', 'underworld'}, 8910, 4400, 'underworld rod') +shopModule:addSellableItem({'wand of vortex', 'vortex'}, 2190, 250, 'wand of vortex') +shopModule:addSellableItem({'wand of dragonbreath', 'dragonbreath'}, 2191, 500, 'wand of dragonbreath') +shopModule:addSellableItem({'wand of decay', 'decay'}, 2188, 2500, 'wand of decay') +shopModule:addSellableItem({'wand of draconia', 'draconia'}, 8921, 3750, 'wand of draconia') +shopModule:addSellableItem({'wand of cosmic energy', 'cosmic energy'}, 2189, 5000, 'wand of cosmic energy') +shopModule:addSellableItem({'wand of inferno', 'inferno'},2187, 7500, 'wand of inferno') +shopModule:addSellableItem({'wand of starstorm', 'starstorm'}, 8920, 9000, 'wand of starstorm') +shopModule:addSellableItem({'wand of voodoo', 'voodoo'}, 8922, 11000, 'wand of voodoo') + +shopModule:addSellableItem({'snakebite rod', 'snakebite'}, 2182, 250,'snakebite rod') +shopModule:addSellableItem({'moonlight rod', 'moonlight'}, 2186, 500, 'moonlight rod') +shopModule:addSellableItem({'necrotic rod', 'necrotic'}, 2185, 2500, 'necrotic rod') +shopModule:addSellableItem({'northwind rod', 'northwind'}, 8911, 3750, 'northwind rod') +shopModule:addSellableItem({'terra rod', 'terra'}, 2181, 5000, 'terra rod') +shopModule:addSellableItem({'hailstorm rod', 'hailstorm'}, 2183, 7500, 'hailstorm rod') +shopModule:addSellableItem({'springsprout rod', 'springsprout'}, 8912, 9000, 'springsprout rod') +shopModule:addSellableItem({'underworld rod', 'underworld'}, 8910, 11000, 'underworld rod') function creatureSayCallback(cid, type, msg) diff --git a/path_8_6/data/spells/lib/spells.lua b/path_8_6/data/spells/lib/spells.lua index 2bf763d8b..bf1c9e98d 100644 --- a/path_8_6/data/spells/lib/spells.lua +++ b/path_8_6/data/spells/lib/spells.lua @@ -1,7 +1,7 @@ --Pre-made areas --Waves -AREA_SHORTWAVE3 = { +AREA_WAVE3 = { {1, 1, 1}, {1, 1, 1}, {0, 3, 0} diff --git a/path_8_6/data/spells/scripts/attack/annihilation.lua b/path_8_6/data/spells/scripts/attack/annihilation.lua new file mode 100644 index 000000000..bcdf5bf56 --- /dev/null +++ b/path_8_6/data/spells/scripts/attack/annihilation.lua @@ -0,0 +1,18 @@ +local combat = Combat() +combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE) +combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_HITAREA) +combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_WEAPONTYPE) +combat:setParameter(COMBAT_PARAM_BLOCKARMOR, true) +combat:setParameter(COMBAT_PARAM_USECHARGES, true) + +function onGetFormulaValues(player, skill, attack, factor) + local min = (player:getLevel() / 5) + (skill * attack * 0.06) + 13 + local max = (player:getLevel() / 5) + (skill * attack * 0.14) + 34 + return -min, -max +end + +combat:setCallback(CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues") + +function onCastSpell(creature, variant) + return combat:execute(creature, variant) +end diff --git a/path_8_6/data/spells/scripts/attack/apprentices strike.lua b/path_8_6/data/spells/scripts/attack/apprentices strike.lua new file mode 100644 index 000000000..dc094fb17 --- /dev/null +++ b/path_8_6/data/spells/scripts/attack/apprentices strike.lua @@ -0,0 +1,14 @@ +local combat = Combat() +combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE) +combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_FIREATTACK) +combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_FIRE) + +function onGetFormulaValues(player, level, maglevel) + return -10, -20 +end + +combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") + +function onCastSpell(creature, variant) + return combat:execute(creature, variant) +end diff --git a/path_8_6/data/spells/scripts/attack/avalanche.lua b/path_8_6/data/spells/scripts/attack/avalanche.lua index bebcb8070..60dbf78a8 100644 --- a/path_8_6/data/spells/scripts/attack/avalanche.lua +++ b/path_8_6/data/spells/scripts/attack/avalanche.lua @@ -12,6 +12,6 @@ end combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") -function onCastSpell(creature, var, isHotkey) - return combat:execute(creature, var) +function onCastSpell(creature, variant, isHotkey) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/attack/berserk.lua b/path_8_6/data/spells/scripts/attack/berserk.lua index c3e4f45ea..9afe6025f 100644 --- a/path_8_6/data/spells/scripts/attack/berserk.lua +++ b/path_8_6/data/spells/scripts/attack/berserk.lua @@ -1,18 +1,18 @@ local combat = Combat() combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE) combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_HITAREA) -combat:setParameter(COMBAT_PARAM_BLOCKARMOR, 1) -combat:setParameter(COMBAT_PARAM_USECHARGES, 1) +combat:setParameter(COMBAT_PARAM_BLOCKARMOR, true) +combat:setParameter(COMBAT_PARAM_USECHARGES, true) combat:setArea(createCombatArea(AREA_SQUARE1X1)) function onGetFormulaValues(player, skill, attack, factor) - local skillTotal = skill * attack - local levelTotal = player:getLevel() / 5 - return -(((skillTotal * 0.03) + 7) + (levelTotal)), -(((skillTotal * 0.05) + 11) + (levelTotal)) + local min = (player:getLevel() / 5) + (skill * attack * 0.03) + 7 + local max = (player:getLevel() / 5) + (skill * attack * 0.05) + 11 + return -min, -max end combat:setCallback(CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues") -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/attack/brutal strike.lua b/path_8_6/data/spells/scripts/attack/brutal strike.lua new file mode 100644 index 000000000..e7bf8be50 --- /dev/null +++ b/path_8_6/data/spells/scripts/attack/brutal strike.lua @@ -0,0 +1,18 @@ +local combat = Combat() +combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE) +combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_HITAREA) +combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_WEAPONTYPE) +combat:setParameter(COMBAT_PARAM_BLOCKARMOR, true) +combat:setParameter(COMBAT_PARAM_USECHARGES, true) + +function onGetFormulaValues(player, skill, attack, factor) + local min = (player:getLevel() / 5) + (skill * attack * 0.02) + 4 + local max = (player:getLevel() / 5) + (skill * attack * 0.04) + 9 + return -min, -max +end + +combat:setCallback(CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues") + +function onCastSpell(creature, variant) + return combat:execute(creature, variant) +end diff --git a/path_8_6/data/spells/scripts/attack/buzz.lua b/path_8_6/data/spells/scripts/attack/buzz.lua new file mode 100644 index 000000000..767c6a301 --- /dev/null +++ b/path_8_6/data/spells/scripts/attack/buzz.lua @@ -0,0 +1,18 @@ +local combat = Combat() +combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_ENERGYDAMAGE) +combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_ENERGYAREA) +combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGY) + +function onGetFormulaValues(player, level, maglevel) + level = math.min(level, 20) + maglevel = math.min(maglevel, 20) + local min = (level / 5) + (maglevel * 0.4) + 2 + local max = (level / 5) + (maglevel * 0.8) + 5 + return -min, -max +end + +combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") + +function onCastSpell(creature, variant) + return combat:execute(creature, variant) +end diff --git a/path_8_6/data/spells/scripts/attack/chill out.lua b/path_8_6/data/spells/scripts/attack/chill out.lua new file mode 100644 index 000000000..1e682567a --- /dev/null +++ b/path_8_6/data/spells/scripts/attack/chill out.lua @@ -0,0 +1,18 @@ +local combat = Combat() +combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_ICEDAMAGE) +combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_ICEAREA) +combat:setArea(createCombatArea(AREA_WAVE4)) + +function onGetFormulaValues(player, level, maglevel) + level = math.min(level, 20) + maglevel = math.min(maglevel, 20) + local min = (level / 5) + (maglevel * 0.3) + 2 + local max = (level / 5) + (maglevel * 0.45) + 3 + return -min, -max +end + +combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") + +function onCastSpell(creature, variant) + return combat:execute(creature, variant) +end diff --git a/path_8_6/data/spells/scripts/attack/cure bleeding.lua b/path_8_6/data/spells/scripts/attack/cure bleeding.lua new file mode 100644 index 000000000..ef1e52de7 --- /dev/null +++ b/path_8_6/data/spells/scripts/attack/cure bleeding.lua @@ -0,0 +1,8 @@ +local combat = createCombatObject() +setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE) +setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, 0) +setCombatParam(combat, COMBAT_PARAM_DISPEL, CONDITION_PHYSICAL) + +function onCastSpell(cid, var) + return doCombat(cid, combat, var) +end diff --git a/path_8_6/data/spells/scripts/attack/curse.lua b/path_8_6/data/spells/scripts/attack/curse.lua new file mode 100644 index 000000000..abd967267 --- /dev/null +++ b/path_8_6/data/spells/scripts/attack/curse.lua @@ -0,0 +1,30 @@ +local combat = Combat() +combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_DEATHDAMAGE) +combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MORTAREA) +combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_DEATH) + +local condition = Condition(CONDITION_CURSED) +condition:setParameter(CONDITION_PARAM_DELAYED, true) + +condition:addDamage(1, 4000, -45) +condition:addDamage(1, 4000, -40) +condition:addDamage(1, 4000, -35) +condition:addDamage(1, 4000, -34) +condition:addDamage(2, 4000, -33) +condition:addDamage(2, 4000, -32) +condition:addDamage(2, 4000, -31) +condition:addDamage(2, 4000, -30) +condition:addDamage(3, 4000, -29) +condition:addDamage(3, 4000, -25) +condition:addDamage(3, 4000, -24) +condition:addDamage(4, 4000, -23) +condition:addDamage(4, 4000, -20) +condition:addDamage(5, 4000, -19) +condition:addDamage(5, 4000, -15) +condition:addDamage(6, 4000, -10) +condition:addDamage(10, 4000, -5) +combat:setCondition(condition) + +function onCastSpell(creature, variant) + return combat:execute(creature, variant) +end diff --git a/path_8_6/data/spells/scripts/attack/death strike.lua b/path_8_6/data/spells/scripts/attack/death strike.lua index 980026561..53d2f1873 100644 --- a/path_8_6/data/spells/scripts/attack/death strike.lua +++ b/path_8_6/data/spells/scripts/attack/death strike.lua @@ -11,6 +11,6 @@ end combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/attack/divine caldera.lua b/path_8_6/data/spells/scripts/attack/divine caldera.lua index 3734137c7..ce15a854c 100644 --- a/path_8_6/data/spells/scripts/attack/divine caldera.lua +++ b/path_8_6/data/spells/scripts/attack/divine caldera.lua @@ -11,6 +11,6 @@ end combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/attack/divine missile.lua b/path_8_6/data/spells/scripts/attack/divine missile.lua index 7248d10d0..aad549df2 100644 --- a/path_8_6/data/spells/scripts/attack/divine missile.lua +++ b/path_8_6/data/spells/scripts/attack/divine missile.lua @@ -11,6 +11,6 @@ end combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/attack/electrify.lua b/path_8_6/data/spells/scripts/attack/electrify.lua new file mode 100644 index 000000000..23eb60195 --- /dev/null +++ b/path_8_6/data/spells/scripts/attack/electrify.lua @@ -0,0 +1,13 @@ +local combat = Combat() +combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_ENERGYDAMAGE) +combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_ENERGYHIT) +combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGY) + +local condition = Condition(CONDITION_ENERGY) +condition:setParameter(CONDITION_PARAM_DELAYED, true) +condition:addDamage(10, 10000, -25) +combat:setCondition(condition) + +function onCastSpell(creature, variant) + return combat:execute(creature, variant) +end diff --git a/path_8_6/data/spells/scripts/attack/energy beam.lua b/path_8_6/data/spells/scripts/attack/energy beam.lua index ed1938a4d..47b8c177d 100644 --- a/path_8_6/data/spells/scripts/attack/energy beam.lua +++ b/path_8_6/data/spells/scripts/attack/energy beam.lua @@ -11,6 +11,6 @@ end combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/attack/energy bomb.lua b/path_8_6/data/spells/scripts/attack/energy bomb.lua index 60a275c7b..78726107d 100644 --- a/path_8_6/data/spells/scripts/attack/energy bomb.lua +++ b/path_8_6/data/spells/scripts/attack/energy bomb.lua @@ -5,6 +5,6 @@ combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGYBALL) combat:setParameter(COMBAT_PARAM_CREATEITEM, ITEM_ENERGYFIELD_PVP) combat:setArea(createCombatArea(AREA_SQUARE1X1)) -function onCastSpell(creature, var, isHotkey) - return combat:execute(creature, var) +function onCastSpell(creature, variant, isHotkey) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/attack/energy field.lua b/path_8_6/data/spells/scripts/attack/energy field.lua index 55fb4e68c..f026a05ed 100644 --- a/path_8_6/data/spells/scripts/attack/energy field.lua +++ b/path_8_6/data/spells/scripts/attack/energy field.lua @@ -4,6 +4,6 @@ combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_ENERGYHIT) combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGYBALL) combat:setParameter(COMBAT_PARAM_CREATEITEM, ITEM_ENERGYFIELD_PVP) -function onCastSpell(creature, var, isHotkey) - return combat:execute(creature, var) +function onCastSpell(creature, variant, isHotkey) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/attack/energy strike.lua b/path_8_6/data/spells/scripts/attack/energy strike.lua index a5b5a3bdb..4c6ee5234 100644 --- a/path_8_6/data/spells/scripts/attack/energy strike.lua +++ b/path_8_6/data/spells/scripts/attack/energy strike.lua @@ -11,6 +11,6 @@ end combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/attack/energy wall.lua b/path_8_6/data/spells/scripts/attack/energy wall.lua index 9b023e9df..9888b87d8 100644 --- a/path_8_6/data/spells/scripts/attack/energy wall.lua +++ b/path_8_6/data/spells/scripts/attack/energy wall.lua @@ -5,6 +5,6 @@ combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGYBALL) combat:setParameter(COMBAT_PARAM_CREATEITEM, ITEM_ENERGYFIELD_PVP) combat:setArea(createCombatArea(AREA_WALLFIELD, AREADIAGONAL_WALLFIELD)) -function onCastSpell(creature, var, isHotkey) - return combat:execute(creature, var) +function onCastSpell(creature, variant, isHotkey) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/attack/energy wave.lua b/path_8_6/data/spells/scripts/attack/energy wave.lua index e9206fcc9..a888eca0e 100644 --- a/path_8_6/data/spells/scripts/attack/energy wave.lua +++ b/path_8_6/data/spells/scripts/attack/energy wave.lua @@ -12,6 +12,6 @@ end combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/attack/envenom.lua b/path_8_6/data/spells/scripts/attack/envenom.lua new file mode 100644 index 000000000..f5efd08ff --- /dev/null +++ b/path_8_6/data/spells/scripts/attack/envenom.lua @@ -0,0 +1,13 @@ +local combat = Combat() +combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_EARTHDAMAGE) +combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_CARNIPHILA) +combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_EARTH) + +local condition = Condition(CONDITION_POISON) +condition:setParameter(CONDITION_PARAM_DELAYED, true) +condition:addDamage(25, 4000, -45) +combat:setCondition(condition) + +function onCastSpell(creature, variant) + return combat:execute(creature, variant) +end diff --git a/path_8_6/data/spells/scripts/attack/eternal winter.lua b/path_8_6/data/spells/scripts/attack/eternal winter.lua index 1b2f2d6bc..29639e8cf 100644 --- a/path_8_6/data/spells/scripts/attack/eternal winter.lua +++ b/path_8_6/data/spells/scripts/attack/eternal winter.lua @@ -11,6 +11,6 @@ end combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/attack/ethereal spear.lua b/path_8_6/data/spells/scripts/attack/ethereal spear.lua index aae01c875..d97832f5a 100644 --- a/path_8_6/data/spells/scripts/attack/ethereal spear.lua +++ b/path_8_6/data/spells/scripts/attack/ethereal spear.lua @@ -2,16 +2,17 @@ local combat = Combat() combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE) combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_HITAREA) combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ETHEREALSPEAR) -combat:setParameter(COMBAT_PARAM_BLOCKSHIELD, 1) +combat:setParameter(COMBAT_PARAM_BLOCKARMOR, true) -function onGetFormulaValues(player, attack, factor) - local skillTotal = 2 * player:getEffectiveSkillLevel(SKILL_DISTANCE) - local levelTotal = player:getLevel() / 5 - return -(((skillTotal + attack / 3500) * 0.35) + (levelTotal) + 0), -(((skillTotal + attack / 3125) * 0.5) + (levelTotal) + 5) +function onGetFormulaValues(player, skill, attack, factor) + local distSkill = player:getEffectiveSkillLevel(SKILL_DISTANCE) + local min = (player:getLevel() / 5) + distSkill * 0.7 + local max = (player:getLevel() / 5) + distSkill + 5 + return -min, -max end combat:setCallback(CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues") -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/attack/explosion.lua b/path_8_6/data/spells/scripts/attack/explosion.lua index 0ce525865..ddb1dc5a3 100644 --- a/path_8_6/data/spells/scripts/attack/explosion.lua +++ b/path_8_6/data/spells/scripts/attack/explosion.lua @@ -2,7 +2,7 @@ local combat = Combat() combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE) combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_EXPLOSIONAREA) combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_EXPLOSION) -combat:setParameter(COMBAT_PARAM_BLOCKARMOR, 1) +combat:setParameter(COMBAT_PARAM_BLOCKARMOR, true) combat:setArea(createCombatArea(AREA_CROSS1X1)) function onGetFormulaValues(player, level, maglevel) @@ -13,6 +13,6 @@ end combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") -function onCastSpell(creature, var, isHotkey) - return combat:execute(creature, var) +function onCastSpell(creature, variant, isHotkey) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/attack/fierce berserk.lua b/path_8_6/data/spells/scripts/attack/fierce berserk.lua index 7d989971e..1f051ba06 100644 --- a/path_8_6/data/spells/scripts/attack/fierce berserk.lua +++ b/path_8_6/data/spells/scripts/attack/fierce berserk.lua @@ -1,18 +1,18 @@ local combat = Combat() combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE) combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_HITAREA) -combat:setParameter(COMBAT_PARAM_BLOCKARMOR, 1) -combat:setParameter(COMBAT_PARAM_USECHARGES, 1) +combat:setParameter(COMBAT_PARAM_BLOCKARMOR, true) +combat:setParameter(COMBAT_PARAM_USECHARGES, true) combat:setArea(createCombatArea(AREA_SQUARE1X1)) function onGetFormulaValues(player, skill, attack, factor) - local skillTotal = skill * attack - local levelTotal = player:getLevel() / 5 - return -(((skillTotal * 0.06) + 13) + (levelTotal)), -(((skillTotal * 0.11) + 27) + (levelTotal)) + local min = (player:getLevel() / 5) + (skill * attack * 0.06) + 13 + local max = (player:getLevel() / 5) + (skill * attack * 0.11) + 27 + return -min, -max end combat:setCallback(CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues") -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/attack/fire bomb.lua b/path_8_6/data/spells/scripts/attack/fire bomb.lua index 9e982efaa..eba9401f8 100644 --- a/path_8_6/data/spells/scripts/attack/fire bomb.lua +++ b/path_8_6/data/spells/scripts/attack/fire bomb.lua @@ -5,6 +5,6 @@ combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_FIRE) combat:setParameter(COMBAT_PARAM_CREATEITEM, ITEM_FIREFIELD_PVP_FULL) combat:setArea(createCombatArea(AREA_SQUARE1X1)) -function onCastSpell(creature, var, isHotkey) - return combat:execute(creature, var) +function onCastSpell(creature, variant, isHotkey) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/attack/fire field.lua b/path_8_6/data/spells/scripts/attack/fire field.lua index e214679eb..59b2aa7e4 100644 --- a/path_8_6/data/spells/scripts/attack/fire field.lua +++ b/path_8_6/data/spells/scripts/attack/fire field.lua @@ -4,6 +4,6 @@ combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_HITBYFIRE) combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_FIRE) combat:setParameter(COMBAT_PARAM_CREATEITEM, ITEM_FIREFIELD_PVP_FULL) -function onCastSpell(creature, var, isHotkey) - return combat:execute(creature, var) +function onCastSpell(creature, variant, isHotkey) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/attack/fire wall.lua b/path_8_6/data/spells/scripts/attack/fire wall.lua index 203444ef6..8935419a6 100644 --- a/path_8_6/data/spells/scripts/attack/fire wall.lua +++ b/path_8_6/data/spells/scripts/attack/fire wall.lua @@ -5,6 +5,6 @@ combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_FIRE) combat:setParameter(COMBAT_PARAM_CREATEITEM, ITEM_FIREFIELD_PVP_FULL) combat:setArea(createCombatArea(AREA_WALLFIELD, AREADIAGONAL_WALLFIELD)) -function onCastSpell(creature, var, isHotkey) - return combat:execute(creature, var) +function onCastSpell(creature, variant, isHotkey) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/attack/fire wave.lua b/path_8_6/data/spells/scripts/attack/fire wave.lua index 0a674a4ef..98b7f4bc0 100644 --- a/path_8_6/data/spells/scripts/attack/fire wave.lua +++ b/path_8_6/data/spells/scripts/attack/fire wave.lua @@ -11,6 +11,6 @@ end combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/attack/fireball.lua b/path_8_6/data/spells/scripts/attack/fireball.lua index 5615cca3b..1a29dd5c5 100644 --- a/path_8_6/data/spells/scripts/attack/fireball.lua +++ b/path_8_6/data/spells/scripts/attack/fireball.lua @@ -11,6 +11,6 @@ end combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") -function onCastSpell(creature, var, isHotkey) - return combat:execute(creature, var) +function onCastSpell(creature, variant, isHotkey) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/attack/flame strike.lua b/path_8_6/data/spells/scripts/attack/flame strike.lua index 2d737fea7..e8c5130e2 100644 --- a/path_8_6/data/spells/scripts/attack/flame strike.lua +++ b/path_8_6/data/spells/scripts/attack/flame strike.lua @@ -11,6 +11,6 @@ end combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/attack/front sweep.lua b/path_8_6/data/spells/scripts/attack/front sweep.lua new file mode 100644 index 000000000..a57b9db02 --- /dev/null +++ b/path_8_6/data/spells/scripts/attack/front sweep.lua @@ -0,0 +1,18 @@ +local combat = Combat() +combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE) +combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_HITAREA) +combat:setParameter(COMBAT_PARAM_BLOCKARMOR, true) +combat:setParameter(COMBAT_PARAM_USECHARGES, true) +combat:setArea(createCombatArea(AREA_WAVE6, AREADIAGONAL_WAVE6)) + +function onGetFormulaValues(player, skill, attack, factor) + local min = (player:getLevel() / 5) + (skill * attack * 0.04) + 31 + local max = (player:getLevel() / 5) + (skill * attack * 0.08) + 45 + return -min, -max +end + +combat:setCallback(CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues") + +function onCastSpell(creature, variant) + return combat:execute(creature, variant) +end diff --git a/path_8_6/data/spells/scripts/attack/great energy beam.lua b/path_8_6/data/spells/scripts/attack/great energy beam.lua index f565ca541..33d4fd6ad 100644 --- a/path_8_6/data/spells/scripts/attack/great energy beam.lua +++ b/path_8_6/data/spells/scripts/attack/great energy beam.lua @@ -11,6 +11,6 @@ end combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/attack/great fireball.lua b/path_8_6/data/spells/scripts/attack/great fireball.lua index 986b0e704..2c9291ae3 100644 --- a/path_8_6/data/spells/scripts/attack/great fireball.lua +++ b/path_8_6/data/spells/scripts/attack/great fireball.lua @@ -12,6 +12,6 @@ end combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") -function onCastSpell(creature, var, isHotkey) - return combat:execute(creature, var) +function onCastSpell(creature, variant, isHotkey) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/attack/groundshaker.lua b/path_8_6/data/spells/scripts/attack/groundshaker.lua index 444d56ad1..bb9995407 100644 --- a/path_8_6/data/spells/scripts/attack/groundshaker.lua +++ b/path_8_6/data/spells/scripts/attack/groundshaker.lua @@ -1,18 +1,18 @@ local combat = Combat() combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE) combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_GROUNDSHAKER) -combat:setParameter(COMBAT_PARAM_BLOCKARMOR, 1) -combat:setParameter(COMBAT_PARAM_USECHARGES, 1) +combat:setParameter(COMBAT_PARAM_BLOCKARMOR, true) +combat:setParameter(COMBAT_PARAM_USECHARGES, true) combat:setArea(createCombatArea(AREA_CIRCLE3X3)) function onGetFormulaValues(player, skill, attack, factor) - local skillTotal = skill * attack - local levelTotal = player:getLevel() / 5 - return -(((skillTotal * 0.02) + 4) + (levelTotal)), -(((skillTotal * 0.03) + 6) + (levelTotal)) + local min = (player:getLevel() / 5) + (skill * attack * 0.02) + 4 + local max = (player:getLevel() / 5) + (skill * attack * 0.03) + 6 + return -min, -max end combat:setCallback(CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues") -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/attack/heavy magic missile.lua b/path_8_6/data/spells/scripts/attack/heavy magic missile.lua index 091e06213..6e6f6dea9 100644 --- a/path_8_6/data/spells/scripts/attack/heavy magic missile.lua +++ b/path_8_6/data/spells/scripts/attack/heavy magic missile.lua @@ -11,6 +11,6 @@ end combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") -function onCastSpell(creature, var, isHotkey) - return combat:execute(creature, var) +function onCastSpell(creature, variant, isHotkey) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/attack/hells core.lua b/path_8_6/data/spells/scripts/attack/hells core.lua index eaa20ad2e..9b93527eb 100644 --- a/path_8_6/data/spells/scripts/attack/hells core.lua +++ b/path_8_6/data/spells/scripts/attack/hells core.lua @@ -11,6 +11,6 @@ end combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/attack/holy flash.lua b/path_8_6/data/spells/scripts/attack/holy flash.lua new file mode 100644 index 000000000..b1bff57d1 --- /dev/null +++ b/path_8_6/data/spells/scripts/attack/holy flash.lua @@ -0,0 +1,13 @@ +local combat = Combat() +combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_HOLYDAMAGE) +combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_HOLYDAMAGE) +combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SMALLHOLY) + +local condition = Condition(CONDITION_DAZZLED) +condition:setParameter(CONDITION_PARAM_DELAYED, true) +condition:addDamage(50, 10000, -10) +combat:setCondition(condition) + +function onCastSpell(creature, variant) + return combat:execute(creature, variant) +end diff --git a/path_8_6/data/spells/scripts/attack/holy missile.lua b/path_8_6/data/spells/scripts/attack/holy missile.lua index dd22c5115..b8c25ecef 100644 --- a/path_8_6/data/spells/scripts/attack/holy missile.lua +++ b/path_8_6/data/spells/scripts/attack/holy missile.lua @@ -12,6 +12,6 @@ end combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") -function onCastSpell(creature, var, isHotkey) - return combat:execute(creature, var) +function onCastSpell(creature, variant, isHotkey) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/attack/ice strike.lua b/path_8_6/data/spells/scripts/attack/ice strike.lua index d0bc84b37..5441a316e 100644 --- a/path_8_6/data/spells/scripts/attack/ice strike.lua +++ b/path_8_6/data/spells/scripts/attack/ice strike.lua @@ -11,6 +11,6 @@ end combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/attack/ice wave.lua b/path_8_6/data/spells/scripts/attack/ice wave.lua index 0c58ca67b..3233c29a6 100644 --- a/path_8_6/data/spells/scripts/attack/ice wave.lua +++ b/path_8_6/data/spells/scripts/attack/ice wave.lua @@ -11,6 +11,6 @@ end combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/attack/icicle.lua b/path_8_6/data/spells/scripts/attack/icicle.lua index 9ac266fc1..1ec5c16b7 100644 --- a/path_8_6/data/spells/scripts/attack/icicle.lua +++ b/path_8_6/data/spells/scripts/attack/icicle.lua @@ -1,7 +1,7 @@ local combat = Combat() combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_ICEDAMAGE) -combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_ICEAREA) -combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ICE) +combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_ICEATTACK) +combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SMALLICE) function onGetFormulaValues(player, level, maglevel) local min = (level / 5) + (maglevel * 1.8) + 12 @@ -11,6 +11,6 @@ end combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") -function onCastSpell(creature, var, isHotkey) - return combat:execute(creature, var) +function onCastSpell(creature, variant, isHotkey) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/attack/ignite.lua b/path_8_6/data/spells/scripts/attack/ignite.lua new file mode 100644 index 000000000..9d69b8f69 --- /dev/null +++ b/path_8_6/data/spells/scripts/attack/ignite.lua @@ -0,0 +1,13 @@ +local combat = Combat() +combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE) +combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_HITBYFIRE) +combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_FIRE) + +local condition = Condition(CONDITION_FIRE) +condition:setParameter(CONDITION_PARAM_DELAYED, true) +condition:addDamage(23, 10000, -10) +combat:setCondition(condition) + +function onCastSpell(creature, variant) + return combat:execute(creature, variant) +end diff --git a/path_8_6/data/spells/scripts/attack/inflict wound.lua b/path_8_6/data/spells/scripts/attack/inflict wound.lua new file mode 100644 index 000000000..319cefc39 --- /dev/null +++ b/path_8_6/data/spells/scripts/attack/inflict wound.lua @@ -0,0 +1,13 @@ +local combat = Combat() +combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE) +combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_DRAWBLOOD) +combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_WEAPONTYPE) + +local condition = Condition(CONDITION_BLEEDING) +condition:setParameter(CONDITION_PARAM_DELAYED, true) +condition:addDamage(25, 4000, -45) +combat:setCondition(condition) + +function onCastSpell(creature, variant) + return combat:execute(creature, variant) +end diff --git a/path_8_6/data/spells/scripts/attack/light magic missile.lua b/path_8_6/data/spells/scripts/attack/light magic missile.lua index 7b23ba65e..977d302cd 100644 --- a/path_8_6/data/spells/scripts/attack/light magic missile.lua +++ b/path_8_6/data/spells/scripts/attack/light magic missile.lua @@ -11,6 +11,6 @@ end combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") -function onCastSpell(creature, var, isHotkey) - return combat:execute(creature, var) +function onCastSpell(creature, variant, isHotkey) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/attack/light stone shower.lua b/path_8_6/data/spells/scripts/attack/light stone shower.lua new file mode 100644 index 000000000..54f6379f8 --- /dev/null +++ b/path_8_6/data/spells/scripts/attack/light stone shower.lua @@ -0,0 +1,19 @@ +local combat = Combat() +combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_EARTHDAMAGE) +combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_STONES) +combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_EARTH) +combat:setArea(createCombatArea(AREA_CROSS1X1)) + +function onGetFormulaValues(player, level, maglevel) + level = math.min(level, 20) + maglevel = math.min(maglevel, 20) + local min = (level / 5) + (maglevel * 0.3) + 2 + local max = (level / 5) + (maglevel * 0.45) + 3 + return -min, -max +end + +combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") + +function onCastSpell(creature, variant, isHotkey) + return combat:execute(creature, variant) +end diff --git a/path_8_6/data/spells/scripts/attack/lightest magic missile.lua b/path_8_6/data/spells/scripts/attack/lightest magic missile.lua new file mode 100644 index 000000000..04ed8b505 --- /dev/null +++ b/path_8_6/data/spells/scripts/attack/lightest magic missile.lua @@ -0,0 +1,14 @@ +local combat = Combat() +combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_ENERGYDAMAGE) +combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_ENERGYAREA) +combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGY) + +function onGetFormulaValues(player, level, maglevel) + return -3, -5 +end + +combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") + +function onCastSpell(creature, variant, isHotkey) + return combat:execute(creature, variant) +end diff --git a/path_8_6/data/spells/scripts/attack/lightest missile.lua b/path_8_6/data/spells/scripts/attack/lightest missile.lua new file mode 100644 index 000000000..e9168459a --- /dev/null +++ b/path_8_6/data/spells/scripts/attack/lightest missile.lua @@ -0,0 +1,18 @@ +local combat = Combat() +combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_ENERGYDAMAGE) +combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_ENERGYHIT) +combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGY) + +function onGetFormulaValues(player, level, maglevel) + level = math.min(level, 20) + maglevel = math.min(maglevel, 20) + local min = (level / 5) + (maglevel * 0.45) + 3 + local max = (level / 5) + (maglevel * 0.7) + 4 + return -min, -max +end + +combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") + +function onCastSpell(creature, variant, isHotkey) + return combat:execute(creature, variant) +end diff --git a/path_8_6/data/spells/scripts/attack/lightning.lua b/path_8_6/data/spells/scripts/attack/lightning.lua new file mode 100644 index 000000000..fbfa8f44c --- /dev/null +++ b/path_8_6/data/spells/scripts/attack/lightning.lua @@ -0,0 +1,16 @@ +local combat = Combat() +combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_ENERGYDAMAGE) +combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_ENERGYAREA) +combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGY) + +function onGetFormulaValues(player, level, maglevel) + local min = (level / 5) + (maglevel * 2.2) + 12 + local max = (level / 5) + (maglevel * 3.4) + 21 + return -min, -max +end + +combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") + +function onCastSpell(creature, variant) + return combat:execute(creature, variant) +end diff --git a/path_8_6/data/spells/scripts/attack/mud attack.lua b/path_8_6/data/spells/scripts/attack/mud attack.lua new file mode 100644 index 000000000..450eb0a3b --- /dev/null +++ b/path_8_6/data/spells/scripts/attack/mud attack.lua @@ -0,0 +1,18 @@ +local combat = Combat() +combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_EARTHDAMAGE) +combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_CARNIPHILA) +combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SMALLEARTH) + +function onGetFormulaValues(player, level, maglevel) + level = math.min(level, 20) + maglevel = math.min(maglevel, 20) + local min = (level / 5) + (maglevel * 0.4) + 2 + local max = (level / 5) + (maglevel * 0.8) + 5 + return -min, -max +end + +combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") + +function onCastSpell(creature, variant) + return combat:execute(creature, variant) +end diff --git a/path_8_6/data/spells/scripts/attack/physical strike.lua b/path_8_6/data/spells/scripts/attack/physical strike.lua new file mode 100644 index 000000000..1d0caac18 --- /dev/null +++ b/path_8_6/data/spells/scripts/attack/physical strike.lua @@ -0,0 +1,17 @@ +local combat = Combat() +combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE) +combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_EXPLOSIONAREA) +combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_EXPLOSION) +combat:setParameter(COMBAT_PARAM_BLOCKARMOR, true) + +function onGetFormulaValues(player, level, maglevel) + local min = (level / 5) + (maglevel * 1.6) + 9 + local max = (level / 5) + (maglevel * 2.4) + 14 + return -min, -max +end + +combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") + +function onCastSpell(creature, variant) + return combat:execute(creature, variant) +end diff --git a/path_8_6/data/spells/scripts/attack/poison bomb.lua b/path_8_6/data/spells/scripts/attack/poison bomb.lua index daebbaa9c..ec5522574 100644 --- a/path_8_6/data/spells/scripts/attack/poison bomb.lua +++ b/path_8_6/data/spells/scripts/attack/poison bomb.lua @@ -5,6 +5,6 @@ combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_POISON) combat:setParameter(COMBAT_PARAM_CREATEITEM, ITEM_POISONFIELD_PVP) combat:setArea(createCombatArea(AREA_SQUARE1X1)) -function onCastSpell(creature, var, isHotkey) - return combat:execute(creature, var) +function onCastSpell(creature, variant, isHotkey) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/attack/poison field.lua b/path_8_6/data/spells/scripts/attack/poison field.lua index 30c235c91..f4e9e6224 100644 --- a/path_8_6/data/spells/scripts/attack/poison field.lua +++ b/path_8_6/data/spells/scripts/attack/poison field.lua @@ -4,6 +4,6 @@ combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_GREEN_RINGS) combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_POISON) combat:setParameter(COMBAT_PARAM_CREATEITEM, ITEM_POISONFIELD_PVP) -function onCastSpell(creature, var, isHotkey) - return combat:execute(creature, var) +function onCastSpell(creature, variant, isHotkey) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/attack/poison wall.lua b/path_8_6/data/spells/scripts/attack/poison wall.lua index be2fece91..a9b8460ae 100644 --- a/path_8_6/data/spells/scripts/attack/poison wall.lua +++ b/path_8_6/data/spells/scripts/attack/poison wall.lua @@ -5,6 +5,6 @@ combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_POISON) combat:setParameter(COMBAT_PARAM_CREATEITEM, ITEM_POISONFIELD_PVP) combat:setArea(createCombatArea(AREA_WALLFIELD, AREADIAGONAL_WALLFIELD)) -function onCastSpell(creature, var, isHotkey) - return combat:execute(creature, var) +function onCastSpell(creature, variant, isHotkey) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/attack/practise fire wave.lua b/path_8_6/data/spells/scripts/attack/practise fire wave.lua new file mode 100644 index 000000000..7a468fffc --- /dev/null +++ b/path_8_6/data/spells/scripts/attack/practise fire wave.lua @@ -0,0 +1,14 @@ +local combat = Combat() +combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE) +combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_HITBYFIRE) +combat:setArea(createCombatArea(AREA_WAVE4, AREADIAGONAL_WAVE4)) + +function onGetFormulaValues(player, level, maglevel) + return -8, -11 +end + +combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") + +function onCastSpell(creature, variant) + return combat:execute(creature, variant) +end diff --git a/path_8_6/data/spells/scripts/attack/rage of the skies.lua b/path_8_6/data/spells/scripts/attack/rage of the skies.lua index 17683e133..20aa89cd0 100644 --- a/path_8_6/data/spells/scripts/attack/rage of the skies.lua +++ b/path_8_6/data/spells/scripts/attack/rage of the skies.lua @@ -11,6 +11,6 @@ end combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/attack/scorch.lua b/path_8_6/data/spells/scripts/attack/scorch.lua new file mode 100644 index 000000000..0dfbc5cf6 --- /dev/null +++ b/path_8_6/data/spells/scripts/attack/scorch.lua @@ -0,0 +1,18 @@ +local combat = Combat() +combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE) +combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_HITBYFIRE) +combat:setArea(createCombatArea(AREA_WAVE4)) + +function onGetFormulaValues(player, level, maglevel) + level = math.min(level, 20) + maglevel = math.min(maglevel, 20) + local min = (level / 5) + (maglevel * 0.3) + 2 + local max = (level / 5) + (maglevel * 0.45) + 3 + return -min, -max +end + +combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") + +function onCastSpell(creature, variant) + return combat:execute(creature, variant) +end diff --git a/path_8_6/data/spells/scripts/attack/soul fire.lua b/path_8_6/data/spells/scripts/attack/soul fire.lua index e606baf7d..74ee7015c 100644 --- a/path_8_6/data/spells/scripts/attack/soul fire.lua +++ b/path_8_6/data/spells/scripts/attack/soul fire.lua @@ -4,10 +4,10 @@ combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_HITBYFIRE) combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_FIRE) local condition = Condition(CONDITION_FIRE) -condition:setParameter(CONDITION_PARAM_DELAYED, 1) -condition:addDamage(10, 2000, -10) +condition:setParameter(CONDITION_PARAM_DELAYED, true) +condition:addDamage(13, 10000, -10) combat:setCondition(condition) -function onCastSpell(creature, var, isHotkey) - return combat:execute(creature, var) +function onCastSpell(creature, variant, isHotkey) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/attack/stalagmite.lua b/path_8_6/data/spells/scripts/attack/stalagmite.lua index d23af2231..e2901383f 100644 --- a/path_8_6/data/spells/scripts/attack/stalagmite.lua +++ b/path_8_6/data/spells/scripts/attack/stalagmite.lua @@ -11,6 +11,6 @@ end combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") -function onCastSpell(creature, var, isHotkey) - return combat:execute(creature, var) +function onCastSpell(creature, variant, isHotkey) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/attack/stone shower.lua b/path_8_6/data/spells/scripts/attack/stone shower.lua index 3b1960c36..c53db830a 100644 --- a/path_8_6/data/spells/scripts/attack/stone shower.lua +++ b/path_8_6/data/spells/scripts/attack/stone shower.lua @@ -5,13 +5,13 @@ combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_EARTH) combat:setArea(createCombatArea(AREA_CIRCLE3X3)) function onGetFormulaValues(player, level, maglevel) - local min = (level / 5) + (maglevel * 1) + 6 + local min = (level / 5) + maglevel + 6 local max = (level / 5) + (maglevel * 2.6) + 16 return -min, -max end combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") -function onCastSpell(creature, var, isHotkey) - return combat:execute(creature, var) +function onCastSpell(creature, variant, isHotkey) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/attack/strong energy strike.lua b/path_8_6/data/spells/scripts/attack/strong energy strike.lua new file mode 100644 index 000000000..ec7ea6ba5 --- /dev/null +++ b/path_8_6/data/spells/scripts/attack/strong energy strike.lua @@ -0,0 +1,16 @@ +local combat = Combat() +combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_ENERGYDAMAGE) +combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_ENERGYAREA) +combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGY) + +function onGetFormulaValues(player, level, maglevel) + local min = (level / 5) + (maglevel * 2.8) + 16 + local max = (level / 5) + (maglevel * 4.4) + 28 + return -min, -max +end + +combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") + +function onCastSpell(creature, variant) + return combat:execute(creature, variant) +end diff --git a/path_8_6/data/spells/scripts/attack/strong ethereal spear.lua b/path_8_6/data/spells/scripts/attack/strong ethereal spear.lua new file mode 100644 index 000000000..f0d3dd627 --- /dev/null +++ b/path_8_6/data/spells/scripts/attack/strong ethereal spear.lua @@ -0,0 +1,18 @@ +local combat = Combat() +combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE) +combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_HITAREA) +combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ETHEREALSPEAR) +combat:setParameter(COMBAT_PARAM_BLOCKARMOR, true) + +function onGetFormulaValues(player, skill, attack, factor) + local distSkill = player:getEffectiveSkillLevel(SKILL_DISTANCE) + local min = (player:getLevel() / 5) + distSkill + 7 + local max = (player:getLevel() / 5) + (distSkill * 1.5) + 13 + return -min, -max +end + +combat:setCallback(CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues") + +function onCastSpell(creature, variant) + return combat:execute(creature, variant) +end diff --git a/path_8_6/data/spells/scripts/attack/strong flame strike.lua b/path_8_6/data/spells/scripts/attack/strong flame strike.lua new file mode 100644 index 000000000..93571f092 --- /dev/null +++ b/path_8_6/data/spells/scripts/attack/strong flame strike.lua @@ -0,0 +1,16 @@ +local combat = Combat() +combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE) +combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_FIREATTACK) +combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_FIRE) + +function onGetFormulaValues(player, level, maglevel) + local min = (level / 5) + (maglevel * 2.8) + 16 + local max = (level / 5) + (maglevel * 4.4) + 28 + return -min, -max +end + +combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") + +function onCastSpell(creature, variant) + return combat:execute(creature, variant) +end diff --git a/path_8_6/data/spells/scripts/attack/strong ice strike.lua b/path_8_6/data/spells/scripts/attack/strong ice strike.lua new file mode 100644 index 000000000..2a52569ca --- /dev/null +++ b/path_8_6/data/spells/scripts/attack/strong ice strike.lua @@ -0,0 +1,16 @@ +local combat = Combat() +combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_ICEDAMAGE) +combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_ICEATTACK) +combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SMALLICE) + +function onGetFormulaValues(player, level, maglevel) + local min = (level / 5) + (maglevel * 2.8) + 16 + local max = (level / 5) + (maglevel * 4.4) + 28 + return -min, -max +end + +combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") + +function onCastSpell(creature, variant) + return combat:execute(creature, variant) +end diff --git a/path_8_6/data/spells/scripts/attack/strong ice wave.lua b/path_8_6/data/spells/scripts/attack/strong ice wave.lua new file mode 100644 index 000000000..5beee5409 --- /dev/null +++ b/path_8_6/data/spells/scripts/attack/strong ice wave.lua @@ -0,0 +1,16 @@ +local combat = Combat() +combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_ICEDAMAGE) +combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_ICEAREA) +combat:setArea(createCombatArea(AREA_WAVE3)) + +function onGetFormulaValues(player, level, maglevel) + local min = (level / 5) + (maglevel * 4.5) + 20 + local max = (level / 5) + (maglevel * 7.6) + 48 + return -min, -max +end + +combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") + +function onCastSpell(creature, variant) + return combat:execute(creature, variant) +end diff --git a/path_8_6/data/spells/scripts/attack/strong terra strike.lua b/path_8_6/data/spells/scripts/attack/strong terra strike.lua new file mode 100644 index 000000000..e6f609af2 --- /dev/null +++ b/path_8_6/data/spells/scripts/attack/strong terra strike.lua @@ -0,0 +1,16 @@ +local combat = Combat() +combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_EARTHDAMAGE) +combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_CARNIPHILA) +combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SMALLEARTH) + +function onGetFormulaValues(player, level, maglevel) + local min = (level / 5) + (maglevel * 2.8) + 16 + local max = (level / 5) + (maglevel * 4.4) + 28 + return -min, -max +end + +combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") + +function onCastSpell(creature, variant) + return combat:execute(creature, variant) +end diff --git a/path_8_6/data/spells/scripts/attack/sudden death.lua b/path_8_6/data/spells/scripts/attack/sudden death.lua index f93c58253..4c68f3224 100644 --- a/path_8_6/data/spells/scripts/attack/sudden death.lua +++ b/path_8_6/data/spells/scripts/attack/sudden death.lua @@ -11,6 +11,6 @@ end combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") -function onCastSpell(creature, var, isHotkey) - return combat:execute(creature, var) +function onCastSpell(creature, variant, isHotkey) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/attack/terra strike.lua b/path_8_6/data/spells/scripts/attack/terra strike.lua index de481aa98..b6ea30bc7 100644 --- a/path_8_6/data/spells/scripts/attack/terra strike.lua +++ b/path_8_6/data/spells/scripts/attack/terra strike.lua @@ -11,6 +11,6 @@ end combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/attack/terra wave.lua b/path_8_6/data/spells/scripts/attack/terra wave.lua index ba176f08d..20131c908 100644 --- a/path_8_6/data/spells/scripts/attack/terra wave.lua +++ b/path_8_6/data/spells/scripts/attack/terra wave.lua @@ -11,6 +11,6 @@ end combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/attack/thunderstorm.lua b/path_8_6/data/spells/scripts/attack/thunderstorm.lua index d03c33fb1..b7150e42d 100644 --- a/path_8_6/data/spells/scripts/attack/thunderstorm.lua +++ b/path_8_6/data/spells/scripts/attack/thunderstorm.lua @@ -5,13 +5,13 @@ combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGYBALL) combat:setArea(createCombatArea(AREA_CIRCLE3X3)) function onGetFormulaValues(player, level, maglevel) - local min = (level / 5) + (maglevel * 1) + 6 + local min = (level / 5) + maglevel + 6 local max = (level / 5) + (maglevel * 2.6) + 16 return -min, -max end combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") -function onCastSpell(creature, var, isHotkey) - return combat:execute(creature, var) +function onCastSpell(creature, variant, isHotkey) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/attack/ultimate energy strike.lua b/path_8_6/data/spells/scripts/attack/ultimate energy strike.lua new file mode 100644 index 000000000..c81651e1b --- /dev/null +++ b/path_8_6/data/spells/scripts/attack/ultimate energy strike.lua @@ -0,0 +1,16 @@ +local combat = Combat() +combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_ENERGYDAMAGE) +combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_ENERGYAREA) +combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGY) + +function onGetFormulaValues(player, level, maglevel) + local min = (level / 5) + (maglevel * 4.5) + 35 + local max = (level / 5) + (maglevel * 7.3) + 55 + return -min, -max +end + +combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") + +function onCastSpell(creature, variant) + return combat:execute(creature, variant) +end diff --git a/path_8_6/data/spells/scripts/attack/ultimate flame strike.lua b/path_8_6/data/spells/scripts/attack/ultimate flame strike.lua new file mode 100644 index 000000000..7216145e5 --- /dev/null +++ b/path_8_6/data/spells/scripts/attack/ultimate flame strike.lua @@ -0,0 +1,16 @@ +local combat = Combat() +combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE) +combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_FIREATTACK) +combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_FIRE) + +function onGetFormulaValues(player, level, maglevel) + local min = (level / 5) + (maglevel * 4.5) + 35 + local max = (level / 5) + (maglevel * 7.3) + 55 + return -min, -max +end + +combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") + +function onCastSpell(creature, variant) + return combat:execute(creature, variant) +end diff --git a/path_8_6/data/spells/scripts/attack/ultimate ice strike.lua b/path_8_6/data/spells/scripts/attack/ultimate ice strike.lua new file mode 100644 index 000000000..d76f5125a --- /dev/null +++ b/path_8_6/data/spells/scripts/attack/ultimate ice strike.lua @@ -0,0 +1,16 @@ +local combat = Combat() +combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_ICEDAMAGE) +combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_ICEATTACK) +combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SMALLICE) + +function onGetFormulaValues(player, level, maglevel) + local min = (level / 5) + (maglevel * 4.5) + 35 + local max = (level / 5) + (maglevel * 7.3) + 55 + return -min, -max +end + +combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") + +function onCastSpell(creature, variant) + return combat:execute(creature, variant) +end diff --git a/path_8_6/data/spells/scripts/attack/ultimate terra strike.lua b/path_8_6/data/spells/scripts/attack/ultimate terra strike.lua new file mode 100644 index 000000000..736707195 --- /dev/null +++ b/path_8_6/data/spells/scripts/attack/ultimate terra strike.lua @@ -0,0 +1,16 @@ +local combat = Combat() +combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_EARTHDAMAGE) +combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_CARNIPHILA) +combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SMALLEARTH) + +function onGetFormulaValues(player, level, maglevel) + local min = (level / 5) + (maglevel * 4.5) + 35 + local max = (level / 5) + (maglevel * 7.3) + 55 + return -min, -max +end + +combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") + +function onCastSpell(creature, variant) + return combat:execute(creature, variant) +end diff --git a/path_8_6/data/spells/scripts/attack/whirlwind throw.lua b/path_8_6/data/spells/scripts/attack/whirlwind throw.lua index 2a0e87255..508062132 100644 --- a/path_8_6/data/spells/scripts/attack/whirlwind throw.lua +++ b/path_8_6/data/spells/scripts/attack/whirlwind throw.lua @@ -2,17 +2,17 @@ local combat = Combat() combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE) combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_HITAREA) combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_WEAPONTYPE) -combat:setParameter(COMBAT_PARAM_BLOCKARMOR, 1) -combat:setParameter(COMBAT_PARAM_USECHARGES, 1) +combat:setParameter(COMBAT_PARAM_BLOCKARMOR, true) +combat:setParameter(COMBAT_PARAM_USECHARGES, true) function onGetFormulaValues(player, skill, attack, factor) - local skillTotal = skill * attack - local levelTotal = player:getLevel() / 5 - return -(((skillTotal * 0.01) + 1) + (levelTotal)), -(((skillTotal * 0.03) + 6) + (levelTotal)) + local min = (player:getLevel() / 5) + (skill * attack * 0.01) + 1 + local max = (player:getLevel() / 5) + (skill * attack * 0.03) + 6 + return -min, -max end combat:setCallback(CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues") -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/attack/wrath of nature.lua b/path_8_6/data/spells/scripts/attack/wrath of nature.lua index 6392eac78..4f058ec5e 100644 --- a/path_8_6/data/spells/scripts/attack/wrath of nature.lua +++ b/path_8_6/data/spells/scripts/attack/wrath of nature.lua @@ -11,6 +11,6 @@ end combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/custom/apocalypse.lua b/path_8_6/data/spells/scripts/custom/apocalypse.lua index 8699558f0..70dead24b 100644 --- a/path_8_6/data/spells/scripts/custom/apocalypse.lua +++ b/path_8_6/data/spells/scripts/custom/apocalypse.lua @@ -20,6 +20,6 @@ local combat = Combat() combat:setArea(createCombatArea(AREA_CROSS5X5)) combat:setCallback(CALLBACK_PARAM_TARGETTILE, "onTargetTile") -function onCastSpell(creature, var, isHotkey) - return combat:execute(creature, var) +function onCastSpell(creature, variant, isHotkey) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/custom/combustion.lua b/path_8_6/data/spells/scripts/custom/combustion.lua index cba3efaac..ca9cb5aa7 100644 --- a/path_8_6/data/spells/scripts/custom/combustion.lua +++ b/path_8_6/data/spells/scripts/custom/combustion.lua @@ -10,6 +10,6 @@ combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_FIRE) combat:setFormula(COMBAT_FORMULA_LEVELMAGIC, -1.3, -30, -1.7, 0) combat:setCondition(condition) -function onCastSpell(creature, var, isHotkey) - return combat:execute(creature, var) +function onCastSpell(creature, variant, isHotkey) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/custom/drunk.lua b/path_8_6/data/spells/scripts/custom/drunk.lua index a15293b14..3c19aea0c 100644 --- a/path_8_6/data/spells/scripts/custom/drunk.lua +++ b/path_8_6/data/spells/scripts/custom/drunk.lua @@ -6,6 +6,6 @@ combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_RED) combat:setCondition(condition) combat:setArea(createCombatArea(AREA_SQUARE1X1)) -function onCastSpell(creature, var, isHotkey) - return combat:execute(creature, var) +function onCastSpell(creature, variant, isHotkey) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/custom/magic prison.lua b/path_8_6/data/spells/scripts/custom/magic prison.lua index 28fa8a68e..ee5bfba68 100644 --- a/path_8_6/data/spells/scripts/custom/magic prison.lua +++ b/path_8_6/data/spells/scripts/custom/magic prison.lua @@ -3,6 +3,6 @@ combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGY) combat:setParameter(COMBAT_PARAM_CREATEITEM, ITEM_MAGICWALL) combat:setArea(createCombatArea(AREA_CROSS1X1)) -function onCastSpell(creature, var, isHotkey) - return combat:execute(creature, var) +function onCastSpell(creature, variant, isHotkey) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/custom/polymorph.lua b/path_8_6/data/spells/scripts/custom/polymorph.lua index 8b0d98edc..27efef382 100644 --- a/path_8_6/data/spells/scripts/custom/polymorph.lua +++ b/path_8_6/data/spells/scripts/custom/polymorph.lua @@ -24,6 +24,6 @@ combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN) combat:setArea(createCombatArea(AREA_SQUARE1X1)) combat:setCondition(condition) -function onCastSpell(creature, var, isHotkey) - return combat:execute(creature, var) +function onCastSpell(creature, variant, isHotkey) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/healing/antidote.lua b/path_8_6/data/spells/scripts/healing/antidote.lua deleted file mode 100644 index d7fa024c2..000000000 --- a/path_8_6/data/spells/scripts/healing/antidote.lua +++ /dev/null @@ -1,8 +0,0 @@ -local combat = Combat() -combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE) -combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0) -combat:setParameter(COMBAT_PARAM_DISPEL, CONDITION_POISON) - -function onCastSpell(creature, var) - return combat:execute(creature, var) -end diff --git a/path_8_6/data/spells/scripts/healing/bruise bane.lua b/path_8_6/data/spells/scripts/healing/bruise bane.lua new file mode 100644 index 000000000..7b0c94e30 --- /dev/null +++ b/path_8_6/data/spells/scripts/healing/bruise bane.lua @@ -0,0 +1,19 @@ +local combat = Combat() +combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_HEALING) +combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE) +combat:setParameter(COMBAT_PARAM_DISPEL, CONDITION_PARALYZE) +combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false) + +function onGetFormulaValues(player, level, maglevel) + level = math.min(level, 20) + maglevel = math.min(maglevel, 20) + local min = (level / 5) + (maglevel * 1.4) + 8 + local max = (level / 5) + (maglevel * 1.8) + 11 + return min, max +end + +combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") + +function onCastSpell(creature, variant) + return combat:execute(creature, variant) +end diff --git a/path_8_6/data/spells/scripts/healing/cure bleeding.lua b/path_8_6/data/spells/scripts/healing/cure bleeding.lua new file mode 100644 index 000000000..b41638597 --- /dev/null +++ b/path_8_6/data/spells/scripts/healing/cure bleeding.lua @@ -0,0 +1,8 @@ +local combat = Combat() +combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE) +combat:setParameter(COMBAT_PARAM_DISPEL, CONDITION_BLEEDING) +combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false) + +function onCastSpell(creature, variant) + return combat:execute(creature, variant) +end diff --git a/path_8_6/data/spells/scripts/healing/cure burning.lua b/path_8_6/data/spells/scripts/healing/cure burning.lua new file mode 100644 index 000000000..7813858fa --- /dev/null +++ b/path_8_6/data/spells/scripts/healing/cure burning.lua @@ -0,0 +1,8 @@ +local combat = Combat() +combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE) +combat:setParameter(COMBAT_PARAM_DISPEL, CONDITION_FIRE) +combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false) + +function onCastSpell(creature, variant) + return combat:execute(creature, variant) +end diff --git a/path_8_6/data/spells/scripts/healing/cure curse.lua b/path_8_6/data/spells/scripts/healing/cure curse.lua new file mode 100644 index 000000000..1d74c77f1 --- /dev/null +++ b/path_8_6/data/spells/scripts/healing/cure curse.lua @@ -0,0 +1,8 @@ +local combat = Combat() +combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE) +combat:setParameter(COMBAT_PARAM_DISPEL, CONDITION_CURSED) +combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false) + +function onCastSpell(creature, variant) + return combat:execute(creature, variant) +end diff --git a/path_8_6/data/spells/scripts/healing/cure electrification.lua b/path_8_6/data/spells/scripts/healing/cure electrification.lua new file mode 100644 index 000000000..14f88626e --- /dev/null +++ b/path_8_6/data/spells/scripts/healing/cure electrification.lua @@ -0,0 +1,8 @@ +local combat = Combat() +combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE) +combat:setParameter(COMBAT_PARAM_DISPEL, CONDITION_ENERGY) +combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false) + +function onCastSpell(creature, variant) + return combat:execute(creature, variant) +end diff --git a/path_8_6/data/spells/scripts/healing/cure poison rune.lua b/path_8_6/data/spells/scripts/healing/cure poison rune.lua new file mode 100644 index 000000000..f272fb983 --- /dev/null +++ b/path_8_6/data/spells/scripts/healing/cure poison rune.lua @@ -0,0 +1,9 @@ +local combat = Combat() +combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE) +combat:setParameter(COMBAT_PARAM_DISPEL, CONDITION_POISON) +combat:setParameter(COMBAT_PARAM_TARGETCASTERORTOPMOST, true) +combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false) + +function onCastSpell(creature, variant, isHotkey) + return combat:execute(creature, variant) +end diff --git a/path_8_6/data/spells/scripts/healing/antidote rune.lua b/path_8_6/data/spells/scripts/healing/cure poison.lua similarity index 52% rename from path_8_6/data/spells/scripts/healing/antidote rune.lua rename to path_8_6/data/spells/scripts/healing/cure poison.lua index 157ba14c6..b50548e72 100644 --- a/path_8_6/data/spells/scripts/healing/antidote rune.lua +++ b/path_8_6/data/spells/scripts/healing/cure poison.lua @@ -1,8 +1,8 @@ local combat = Combat() combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE) -combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0) combat:setParameter(COMBAT_PARAM_DISPEL, CONDITION_POISON) +combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false) -function onCastSpell(creature, var, isHotkey) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/healing/divine healing.lua b/path_8_6/data/spells/scripts/healing/divine healing.lua index caa852a18..237e7a434 100644 --- a/path_8_6/data/spells/scripts/healing/divine healing.lua +++ b/path_8_6/data/spells/scripts/healing/divine healing.lua @@ -1,8 +1,8 @@ local combat = Combat() combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_HEALING) combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE) -combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0) combat:setParameter(COMBAT_PARAM_DISPEL, CONDITION_PARALYZE) +combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false) function onGetFormulaValues(player, level, maglevel) local min = (level / 5) + (maglevel * 6.9) + 40 @@ -12,6 +12,6 @@ end combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/healing/heal friend.lua b/path_8_6/data/spells/scripts/healing/heal friend.lua index 23eeeab87..621628afc 100644 --- a/path_8_6/data/spells/scripts/healing/heal friend.lua +++ b/path_8_6/data/spells/scripts/healing/heal friend.lua @@ -1,8 +1,8 @@ local combat = Combat() combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_HEALING) -combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE) -combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0) +combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN) combat:setParameter(COMBAT_PARAM_DISPEL, CONDITION_PARALYZE) +combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false) function onGetFormulaValues(player, level, maglevel) local min = (level / 5) + (maglevel * 6.3) + 45 @@ -12,6 +12,7 @@ end combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + creature:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/healing/intense healing rune.lua b/path_8_6/data/spells/scripts/healing/intense healing rune.lua index 08cb9087e..53fa135aa 100644 --- a/path_8_6/data/spells/scripts/healing/intense healing rune.lua +++ b/path_8_6/data/spells/scripts/healing/intense healing rune.lua @@ -1,9 +1,9 @@ local combat = Combat() combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_HEALING) combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE) -combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0) -combat:setParameter(COMBAT_PARAM_TARGETCASTERORTOPMOST, 1) combat:setParameter(COMBAT_PARAM_DISPEL, CONDITION_PARALYZE) +combat:setParameter(COMBAT_PARAM_TARGETCASTERORTOPMOST, true) +combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false) function onGetFormulaValues(player, level, maglevel) local min = (level / 5) + (maglevel * 3.2) + 20 @@ -13,6 +13,6 @@ end combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") -function onCastSpell(creature, var, isHotkey) - return combat:execute(creature, var) +function onCastSpell(creature, variant, isHotkey) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/healing/intense healing.lua b/path_8_6/data/spells/scripts/healing/intense healing.lua index 6f0c22c73..2a61b871c 100644 --- a/path_8_6/data/spells/scripts/healing/intense healing.lua +++ b/path_8_6/data/spells/scripts/healing/intense healing.lua @@ -1,8 +1,8 @@ local combat = Combat() combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_HEALING) combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE) -combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0) combat:setParameter(COMBAT_PARAM_DISPEL, CONDITION_PARALYZE) +combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false) function onGetFormulaValues(player, level, maglevel) local min = (level / 5) + (maglevel * 3.2) + 20 @@ -12,6 +12,6 @@ end combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/healing/intense recovery.lua b/path_8_6/data/spells/scripts/healing/intense recovery.lua new file mode 100644 index 000000000..bb13cce46 --- /dev/null +++ b/path_8_6/data/spells/scripts/healing/intense recovery.lua @@ -0,0 +1,15 @@ +local combat = Combat() +combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN) +combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false) + +local condition = Condition(CONDITION_REGENERATION) +condition:setParameter(CONDITION_PARAM_SUBID, 1) +condition:setParameter(CONDITION_PARAM_TICKS, 1 * 60 * 1000) +condition:setParameter(CONDITION_PARAM_HEALTHGAIN, 40) +condition:setParameter(CONDITION_PARAM_HEALTHTICKS, 3000) +condition:setParameter(CONDITION_PARAM_BUFF_SPELL, true) +combat:setCondition(condition) + +function onCastSpell(creature, variant) + return combat:execute(creature, variant) +end diff --git a/path_8_6/data/spells/scripts/healing/intense wound cleansing.lua b/path_8_6/data/spells/scripts/healing/intense wound cleansing.lua new file mode 100644 index 000000000..e64028348 --- /dev/null +++ b/path_8_6/data/spells/scripts/healing/intense wound cleansing.lua @@ -0,0 +1,17 @@ +local combat = Combat() +combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_HEALING) +combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE) +combat:setParameter(COMBAT_PARAM_DISPEL, CONDITION_PARALYZE) +combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false) + +function onGetFormulaValues(player, level, maglevel) + local min = (level / 5) + (maglevel * 70) + 438 + local max = (level / 5) + (maglevel * 92) + 544 + return min, max +end + +combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") + +function onCastSpell(creature, variant) + return combat:execute(creature, variant) +end diff --git a/path_8_6/data/spells/scripts/healing/light healing.lua b/path_8_6/data/spells/scripts/healing/light healing.lua index 2e562a03b..bd3a0908d 100644 --- a/path_8_6/data/spells/scripts/healing/light healing.lua +++ b/path_8_6/data/spells/scripts/healing/light healing.lua @@ -1,8 +1,8 @@ local combat = Combat() combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_HEALING) combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE) -combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0) combat:setParameter(COMBAT_PARAM_DISPEL, CONDITION_PARALYZE) +combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false) function onGetFormulaValues(player, level, maglevel) local min = (level / 5) + (maglevel * 1.4) + 8 @@ -12,6 +12,6 @@ end combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/healing/magic patch.lua b/path_8_6/data/spells/scripts/healing/magic patch.lua new file mode 100644 index 000000000..36347b377 --- /dev/null +++ b/path_8_6/data/spells/scripts/healing/magic patch.lua @@ -0,0 +1,19 @@ +local combat = Combat() +combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_HEALING) +combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE) +combat:setParameter(COMBAT_PARAM_DISPEL, CONDITION_PARALYZE) +combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false) + +function onGetFormulaValues(player, level, maglevel) + level = math.min(level, 20) + maglevel = math.min(maglevel, 20) + local min = (level / 5) + (maglevel * 0.6) + 3 + local max = (level / 5) + maglevel + 6 + return min, max +end + +combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") + +function onCastSpell(creature, variant) + return combat:execute(creature, variant) +end diff --git a/path_8_6/data/spells/scripts/healing/mass healing.lua b/path_8_6/data/spells/scripts/healing/mass healing.lua index 9817c144e..0b984503e 100644 --- a/path_8_6/data/spells/scripts/healing/mass healing.lua +++ b/path_8_6/data/spells/scripts/healing/mass healing.lua @@ -1,24 +1,29 @@ +local combat = Combat() +combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE) +combat:setParameter(COMBAT_PARAM_DISPEL, CONDITION_PARALYZE) +combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false) +combat:setArea(createCombatArea(AREA_CIRCLE3X3)) + +local healMonsters = false + function onTargetCreature(creature, target) local player = creature:getPlayer() - local min = ((player:getLevel() / 5) + (player:getMagicLevel() * 4.6) + 100) - local max = ((player:getLevel() / 5) + (player:getMagicLevel() * 9.6) + 125) + local min = (player:getLevel() / 5) + (player:getMagicLevel() * 4.6) + 100 + local max = (player:getLevel() / 5) + (player:getMagicLevel() * 9.6) + 125 - local master = target:getMaster() - if target:isMonster() and not master or master and master:isMonster() then - return true + if not healMonsters then + local master = target:getMaster() + if target:isMonster() and not master or master and master:isMonster() then + return true + end end doTargetCombatHealth(0, target, COMBAT_HEALING, min, max, CONST_ME_NONE) return true end -local combat = Combat() -combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE) -combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0) -combat:setParameter(COMBAT_PARAM_DISPEL, CONDITION_PARALYZE) -combat:setArea(createCombatArea(AREA_CIRCLE3X3)) combat:setCallback(CALLBACK_PARAM_TARGETCREATURE, "onTargetCreature") -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/healing/practise healing.lua b/path_8_6/data/spells/scripts/healing/practise healing.lua new file mode 100644 index 000000000..c336213b2 --- /dev/null +++ b/path_8_6/data/spells/scripts/healing/practise healing.lua @@ -0,0 +1,15 @@ +local combat = Combat() +combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_HEALING) +combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE) +combat:setParameter(COMBAT_PARAM_DISPEL, CONDITION_PARALYZE) +combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false) + +function onGetFormulaValues(player, level, maglevel) + return 4, 7 +end + +combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") + +function onCastSpell(creature, variant) + return combat:execute(creature, variant) +end diff --git a/path_8_6/data/spells/scripts/healing/recovery.lua b/path_8_6/data/spells/scripts/healing/recovery.lua new file mode 100644 index 000000000..de878399a --- /dev/null +++ b/path_8_6/data/spells/scripts/healing/recovery.lua @@ -0,0 +1,15 @@ +local combat = Combat() +combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN) +combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false) + +local condition = Condition(CONDITION_REGENERATION) +condition:setParameter(CONDITION_PARAM_SUBID, 1) +condition:setParameter(CONDITION_PARAM_TICKS, 1 * 60 * 1000) +condition:setParameter(CONDITION_PARAM_HEALTHGAIN, 20) +condition:setParameter(CONDITION_PARAM_HEALTHTICKS, 3000) +condition:setParameter(CONDITION_PARAM_BUFF_SPELL, true) +combat:setCondition(condition) + +function onCastSpell(creature, variant) + return combat:execute(creature, variant) +end diff --git a/path_8_6/data/spells/scripts/healing/salvation.lua b/path_8_6/data/spells/scripts/healing/salvation.lua new file mode 100644 index 000000000..fe047c8e5 --- /dev/null +++ b/path_8_6/data/spells/scripts/healing/salvation.lua @@ -0,0 +1,17 @@ +local combat = Combat() +combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_HEALING) +combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE) +combat:setParameter(COMBAT_PARAM_DISPEL, CONDITION_PARALYZE) +combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false) + +function onGetFormulaValues(player, level, maglevel) + local min = (level / 5) + (maglevel * 12) + 75 + local max = (level / 5) + (maglevel * 20) + 125 + return min, max +end + +combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") + +function onCastSpell(creature, variant) + return combat:execute(creature, variant) +end diff --git a/path_8_6/data/spells/scripts/healing/ultimate healing rune.lua b/path_8_6/data/spells/scripts/healing/ultimate healing rune.lua index 82c4d115b..5aac4c00f 100644 --- a/path_8_6/data/spells/scripts/healing/ultimate healing rune.lua +++ b/path_8_6/data/spells/scripts/healing/ultimate healing rune.lua @@ -1,9 +1,9 @@ local combat = Combat() combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_HEALING) combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE) -combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0) -combat:setParameter(COMBAT_PARAM_TARGETCASTERORTOPMOST, 1) combat:setParameter(COMBAT_PARAM_DISPEL, CONDITION_PARALYZE) +combat:setParameter(COMBAT_PARAM_TARGETCASTERORTOPMOST, true) +combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false) function onGetFormulaValues(player, level, maglevel) local min = (level / 5) + (maglevel * 7.3) + 42 @@ -13,6 +13,6 @@ end combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") -function onCastSpell(creature, var, isHotkey) - return combat:execute(creature, var) +function onCastSpell(creature, variant, isHotkey) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/healing/ultimate healing.lua b/path_8_6/data/spells/scripts/healing/ultimate healing.lua index 1a317a25d..ec18d9ed9 100644 --- a/path_8_6/data/spells/scripts/healing/ultimate healing.lua +++ b/path_8_6/data/spells/scripts/healing/ultimate healing.lua @@ -1,8 +1,8 @@ local combat = Combat() combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_HEALING) combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE) -combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0) combat:setParameter(COMBAT_PARAM_DISPEL, CONDITION_PARALYZE) +combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false) function onGetFormulaValues(player, level, maglevel) local min = (level / 5) + (maglevel * 6.8) + 42 @@ -12,6 +12,6 @@ end combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/healing/wound cleansing.lua b/path_8_6/data/spells/scripts/healing/wound cleansing.lua index 51a451310..61c050d01 100644 --- a/path_8_6/data/spells/scripts/healing/wound cleansing.lua +++ b/path_8_6/data/spells/scripts/healing/wound cleansing.lua @@ -1,8 +1,8 @@ local combat = Combat() combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_HEALING) combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE) -combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0) combat:setParameter(COMBAT_PARAM_DISPEL, CONDITION_PARALYZE) +combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false) function onGetFormulaValues(player, level, maglevel) local min = (level / 5) + (maglevel * 4) + 25 @@ -12,6 +12,6 @@ end combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/monster/barbarian brutetamer skill reducer.lua b/path_8_6/data/spells/scripts/monster/barbarian brutetamer skill reducer.lua index 90e587fe1..8d7ff3758 100644 --- a/path_8_6/data/spells/scripts/monster/barbarian brutetamer skill reducer.lua +++ b/path_8_6/data/spells/scripts/monster/barbarian brutetamer skill reducer.lua @@ -14,6 +14,6 @@ for i = CONDITION_PARAM_SKILL_FIST, CONDITION_PARAM_SKILL_SHIELD do end end -function onCastSpell(creature, var) - return combat[math.random(#combat)]:execute(creature, var) +function onCastSpell(creature, variant) + return combat[math.random(#combat)]:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/monster/betrayed wraith skill reducer.lua b/path_8_6/data/spells/scripts/monster/betrayed wraith skill reducer.lua index b03197937..a6d972a52 100644 --- a/path_8_6/data/spells/scripts/monster/betrayed wraith skill reducer.lua +++ b/path_8_6/data/spells/scripts/monster/betrayed wraith skill reducer.lua @@ -7,6 +7,6 @@ combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_YELLOW_RINGS) combat:setArea(createCombatArea(AREA_SQUAREWAVE5)) combat:setCondition(condition) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/monster/blightwalker curse.lua b/path_8_6/data/spells/scripts/monster/blightwalker curse.lua index fe4a33748..d025f07c7 100644 --- a/path_8_6/data/spells/scripts/monster/blightwalker curse.lua +++ b/path_8_6/data/spells/scripts/monster/blightwalker curse.lua @@ -6,7 +6,7 @@ for i = 10, 30 do combat[i]:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_SMALLCLOUDS) local condition = Condition(CONDITION_CURSED) - condition:setParameter(CONDITION_PARAM_DELAYED, 1) + condition:setParameter(CONDITION_PARAM_DELAYED, true) local damage = i condition:addDamage(1, 4000, -damage) @@ -19,6 +19,6 @@ for i = 10, 30 do combat[i]:setCondition(condition) end -function onCastSpell(creature, var) - return combat[math.random(10, 30)]:execute(creature, var) +function onCastSpell(creature, variant) + return combat[math.random(10, 30)]:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/monster/choking fear drown.lua b/path_8_6/data/spells/scripts/monster/choking fear drown.lua index 746b685a0..42b7ad8eb 100644 --- a/path_8_6/data/spells/scripts/monster/choking fear drown.lua +++ b/path_8_6/data/spells/scripts/monster/choking fear drown.lua @@ -1,5 +1,5 @@ local condition = Condition(CONDITION_DROWN) -condition:setParameter(CONDITION_PARAM_DELAYED, 1) +condition:setParameter(CONDITION_PARAM_DELAYED, true) condition:addDamage(50, 5000, -20) local combat = Combat() @@ -8,6 +8,6 @@ combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_BUBBLES) combat:setArea(createCombatArea(AREA_CROSS6X6)) combat:setCondition(condition) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/monster/cliff strider electrify.lua b/path_8_6/data/spells/scripts/monster/cliff strider electrify.lua index 0653cb2ce..7231acef3 100644 --- a/path_8_6/data/spells/scripts/monster/cliff strider electrify.lua +++ b/path_8_6/data/spells/scripts/monster/cliff strider electrify.lua @@ -3,10 +3,10 @@ combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_ENERGYDAMAGE) combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_ENERGYHIT) local condition = Condition(CONDITION_ENERGY) -condition:setParameter(CONDITION_PARAM_DELAYED, 1) +condition:setParameter(CONDITION_PARAM_DELAYED, true) condition:addDamage(20, 10000, -25) combat:setCondition(condition) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/monster/cliff strider skill reducer.lua b/path_8_6/data/spells/scripts/monster/cliff strider skill reducer.lua index 188f6bf20..e60f3b996 100644 --- a/path_8_6/data/spells/scripts/monster/cliff strider skill reducer.lua +++ b/path_8_6/data/spells/scripts/monster/cliff strider skill reducer.lua @@ -7,6 +7,6 @@ combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_RED) combat:setArea(createCombatArea(AREA_CIRCLE2X2)) combat:setCondition(condition) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/monster/dark torturer skill reducer.lua b/path_8_6/data/spells/scripts/monster/dark torturer skill reducer.lua index f93306915..559cec088 100644 --- a/path_8_6/data/spells/scripts/monster/dark torturer skill reducer.lua +++ b/path_8_6/data/spells/scripts/monster/dark torturer skill reducer.lua @@ -7,6 +7,6 @@ combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_SOUND_PURPLE) combat:setArea(createCombatArea(AREA_SQUAREWAVE6)) combat:setCondition(condition) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/monster/death blob curse.lua b/path_8_6/data/spells/scripts/monster/death blob curse.lua index 4a8304657..915f9adb1 100644 --- a/path_8_6/data/spells/scripts/monster/death blob curse.lua +++ b/path_8_6/data/spells/scripts/monster/death blob curse.lua @@ -7,7 +7,7 @@ for i = 5, 10 do combat[i]:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_DEATH) local condition = Condition(CONDITION_CURSED) - condition:setParameter(CONDITION_PARAM_DELAYED, 1) + condition:setParameter(CONDITION_PARAM_DELAYED, true) local damage = i condition:addDamage(1, 4000, -damage) @@ -19,6 +19,6 @@ for i = 5, 10 do combat[i]:setCondition(condition) end -function onCastSpell(creature, var) - return combat[math.random(5, 10)]:execute(creature, var) +function onCastSpell(creature, variant) + return combat[math.random(5, 10)]:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/monster/deepling spellsinger skill reducer.lua b/path_8_6/data/spells/scripts/monster/deepling spellsinger skill reducer.lua index 05cb2761c..cb0d443d2 100644 --- a/path_8_6/data/spells/scripts/monster/deepling spellsinger skill reducer.lua +++ b/path_8_6/data/spells/scripts/monster/deepling spellsinger skill reducer.lua @@ -13,6 +13,6 @@ for i = 45, 65 do combat[i]:setCondition(condition) end -function onCastSpell(creature, var) - return combat[math.random(45, 65)]:execute(creature, var) +function onCastSpell(creature, variant) + return combat[math.random(45, 65)]:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/monster/demon outcast skill reducer.lua b/path_8_6/data/spells/scripts/monster/demon outcast skill reducer.lua index 29988a59b..e36bbc78a 100644 --- a/path_8_6/data/spells/scripts/monster/demon outcast skill reducer.lua +++ b/path_8_6/data/spells/scripts/monster/demon outcast skill reducer.lua @@ -7,6 +7,6 @@ combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_FLASHARROW) combat:setArea(createCombatArea(AREA_BEAM1)) combat:setCondition(condition) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/monster/devourer paralyze.lua b/path_8_6/data/spells/scripts/monster/devourer paralyze.lua new file mode 100644 index 000000000..4af621800 --- /dev/null +++ b/path_8_6/data/spells/scripts/monster/devourer paralyze.lua @@ -0,0 +1,17 @@ +local combat = Combat() +combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_POISONAREA) + +local condition = Condition(CONDITION_PARALYZE) +condition:setParameter(CONDITION_PARAM_TICKS, 20000) +condition:setFormula(-0.55, 0, -0.75, 0) +combat:setCondition(condition) + + +local area = createCombatArea(AREA_SQUARE1X1) + combat:setArea(area) + combat:setCondition(condition) + + +function onCastSpell(creature, variant) + return combat:execute(creature, variant) +end diff --git a/path_8_6/data/spells/scripts/monster/devourer wave.lua b/path_8_6/data/spells/scripts/monster/devourer wave.lua new file mode 100644 index 000000000..54f6809e9 --- /dev/null +++ b/path_8_6/data/spells/scripts/monster/devourer wave.lua @@ -0,0 +1,19 @@ +local combat = Combat() +combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_POISONDAMAGE) +combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_SMALLPLANTS) + + arr = { + {0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0}, + {0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0}, + {0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0}, + {0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0} + } + +local area = createCombatArea(arr) +combat:setArea(area) + +function onCastSpell(creature, variant) + return combat:execute(creature, variant) +end diff --git a/path_8_6/data/spells/scripts/monster/diabolic imp skill reducer.lua b/path_8_6/data/spells/scripts/monster/diabolic imp skill reducer.lua index a4522153a..00b3193c4 100644 --- a/path_8_6/data/spells/scripts/monster/diabolic imp skill reducer.lua +++ b/path_8_6/data/spells/scripts/monster/diabolic imp skill reducer.lua @@ -11,6 +11,6 @@ for i = 70, 80 do combat[i]:setCondition(condition) end -function onCastSpell(creature, var) - return combat[math.random(70, 80)]:execute(creature, var) +function onCastSpell(creature, variant) + return combat[math.random(70, 80)]:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/monster/dipthrah skill reducer.lua b/path_8_6/data/spells/scripts/monster/dipthrah skill reducer.lua new file mode 100644 index 000000000..558a02843 --- /dev/null +++ b/path_8_6/data/spells/scripts/monster/dipthrah skill reducer.lua @@ -0,0 +1,16 @@ +local combat = Combat() +combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_HOLYAREA) + +local area = createCombatArea(AREA_CIRCLE3X3) +combat:setArea(area) + +local condition = Condition(CONDITION_ATTRIBUTES) +condition:setParameter(CONDITION_PARAM_TICKS, 6000) +condition:setParameter(CONDITION_PARAM_SKILL_MELEEPERCENT, 50) +condition:setParameter(CONDITION_PARAM_SKILL_DISTANCEPERCENT, 50) +condition:setParameter(CONDITION_PARAM_SKILL_SHIELDPERCENT, 50) +combat:setCondition(condition) + +function onCastSpell(creature, variant) + return combat:execute(creature, variant) +end diff --git a/path_8_6/data/spells/scripts/monster/djinn cancel invisibility.lua b/path_8_6/data/spells/scripts/monster/djinn cancel invisibility.lua index c72a83acd..61128bc97 100644 --- a/path_8_6/data/spells/scripts/monster/djinn cancel invisibility.lua +++ b/path_8_6/data/spells/scripts/monster/djinn cancel invisibility.lua @@ -2,6 +2,6 @@ local combat = Combat() combat:setParameter(COMBAT_PARAM_DISPEL, CONDITION_INVISIBLE) combat:setArea(createCombatArea(AREA_CIRCLE3X3)) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/monster/djinn electrify.lua b/path_8_6/data/spells/scripts/monster/djinn electrify.lua index 65e7cd7f5..83eb0c4eb 100644 --- a/path_8_6/data/spells/scripts/monster/djinn electrify.lua +++ b/path_8_6/data/spells/scripts/monster/djinn electrify.lua @@ -4,10 +4,10 @@ combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_ENERGYHIT) combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGY) local condition = Condition(CONDITION_ENERGY) -condition:setParameter(CONDITION_PARAM_DELAYED, 1) +condition:setParameter(CONDITION_PARAM_DELAYED, true) condition:addDamage(3, 10000, -25) combat:setCondition(condition) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/monster/draken abomination curse.lua b/path_8_6/data/spells/scripts/monster/draken abomination curse.lua index 39e544053..9304f0412 100644 --- a/path_8_6/data/spells/scripts/monster/draken abomination curse.lua +++ b/path_8_6/data/spells/scripts/monster/draken abomination curse.lua @@ -7,7 +7,7 @@ for i = 15, 30 do combat[i]:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_DEATH) local condition = Condition(CONDITION_CURSED) - condition:setParameter(CONDITION_PARAM_DELAYED, 1) + condition:setParameter(CONDITION_PARAM_DELAYED, true) local damage = i condition:addDamage(1, 4000, -damage) @@ -19,6 +19,6 @@ for i = 15, 30 do combat[i]:setCondition(condition) end -function onCastSpell(creature, var) - return combat[math.random(15, 30)]:execute(creature, var) +function onCastSpell(creature, variant) + return combat[math.random(15, 30)]:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/monster/dreadbeast skill increaser.lua b/path_8_6/data/spells/scripts/monster/dreadbeast skill increaser.lua new file mode 100644 index 000000000..e526e53e0 --- /dev/null +++ b/path_8_6/data/spells/scripts/monster/dreadbeast skill increaser.lua @@ -0,0 +1,11 @@ +local combat = Combat() +combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_YELLOWENERGY) + +local condition = Condition(CONDITION_ATTRIBUTES) +condition:setParameter(CONDITION_PARAM_TICKS, 6000) +condition:setParameter(CONDITION_PARAM_SKILL_MELEEPERCENT, 130) +combat:setCondition(condition) + +function onCastSpell(creature, variant) + return combat:execute(creature, variant) +end diff --git a/path_8_6/data/spells/scripts/monster/dreadbeast skill reducer.lua b/path_8_6/data/spells/scripts/monster/dreadbeast skill reducer.lua new file mode 100644 index 000000000..02a67c438 --- /dev/null +++ b/path_8_6/data/spells/scripts/monster/dreadbeast skill reducer.lua @@ -0,0 +1,17 @@ +local combat = {} + +for i = 70, 80 do + combat[i] = Combat() + combat[i]:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_YELLOWENERGY) + combat[i]:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGY) + + local condition = Condition(CONDITION_ATTRIBUTES) + condition:setParameter(CONDITION_PARAM_TICKS, 20000) + condition:setParameter(CONDITION_PARAM_SKILL_MELEEPERCENT, i) + condition:setParameter(CONDITION_PARAM_SKILL_FISTPERCENT, i) + combat[i]:setCondition(condition) +end + +function onCastSpell(creature, variant) + return combat[math.random(70, 80)]:execute(creature, variant) +end diff --git a/path_8_6/data/spells/scripts/monster/energized raging mage skill reducer.lua b/path_8_6/data/spells/scripts/monster/energized raging mage skill reducer.lua new file mode 100644 index 000000000..6c4ff36ea --- /dev/null +++ b/path_8_6/data/spells/scripts/monster/energized raging mage skill reducer.lua @@ -0,0 +1,14 @@ +local combat = Combat() +combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_ENERGYHIT) + +local area = createCombatArea(AREA_CROSS6X6) +combat:setArea(area) + +local condition = Condition(CONDITION_ATTRIBUTES) +condition:setParameter(CONDITION_PARAM_TICKS, 6000) +condition:setParameter(CONDITION_PARAM_SKILL_DISTANCEPERCENT, 50) +combat:setCondition(condition) + +function onCastSpell(creature, variant) + return combat:execute(creature, variant) +end diff --git a/path_8_6/data/spells/scripts/monster/energy elemental electrify.lua b/path_8_6/data/spells/scripts/monster/energy elemental electrify.lua index 7787a9ad0..0d479c47a 100644 --- a/path_8_6/data/spells/scripts/monster/energy elemental electrify.lua +++ b/path_8_6/data/spells/scripts/monster/energy elemental electrify.lua @@ -1,5 +1,5 @@ local condition = Condition(CONDITION_ENERGY) -condition:setParameter(CONDITION_PARAM_DELAYED, 1) +condition:setParameter(CONDITION_PARAM_DELAYED, true) condition:addDamage(7, 10000, -25) local combat = Combat() @@ -8,6 +8,6 @@ combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_BLOCKHIT) combat:setArea(createCombatArea(AREA_CIRCLE3X3)) combat:setCondition(condition) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/monster/enslaved dwarf skill reducer 1.lua b/path_8_6/data/spells/scripts/monster/enslaved dwarf skill reducer 1.lua index b7a6d4ea4..3790028db 100644 --- a/path_8_6/data/spells/scripts/monster/enslaved dwarf skill reducer 1.lua +++ b/path_8_6/data/spells/scripts/monster/enslaved dwarf skill reducer 1.lua @@ -11,6 +11,6 @@ for i = 13, 50 do combat[i]:setCondition(condition) end -function onCastSpell(creature, var) - return combat[math.random(13, 50)]:execute(creature, var) +function onCastSpell(creature, variant) + return combat[math.random(13, 50)]:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/monster/enslaved dwarf skill reducer 2.lua b/path_8_6/data/spells/scripts/monster/enslaved dwarf skill reducer 2.lua index 4db95ae36..e8e2b0be8 100644 --- a/path_8_6/data/spells/scripts/monster/enslaved dwarf skill reducer 2.lua +++ b/path_8_6/data/spells/scripts/monster/enslaved dwarf skill reducer 2.lua @@ -7,6 +7,6 @@ combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_HITAREA) combat:setArea(createCombatArea(AREA_CROSS1X1)) combat:setCondition(condition) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/monster/feversleep skill reducer.lua b/path_8_6/data/spells/scripts/monster/feversleep skill reducer.lua index 3e004dca9..f4b62f910 100644 --- a/path_8_6/data/spells/scripts/monster/feversleep skill reducer.lua +++ b/path_8_6/data/spells/scripts/monster/feversleep skill reducer.lua @@ -7,6 +7,6 @@ combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_STUN) combat:setArea(createCombatArea(AREA_CROSS6X6)) combat:setCondition(condition) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/monster/forest fury skill reducer.lua b/path_8_6/data/spells/scripts/monster/forest fury skill reducer.lua index c8e2154af..422fde6a9 100644 --- a/path_8_6/data/spells/scripts/monster/forest fury skill reducer.lua +++ b/path_8_6/data/spells/scripts/monster/forest fury skill reducer.lua @@ -9,6 +9,6 @@ combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_LARGEROCK) combat:setArea(createCombatArea(AREA_CIRCLE2X2)) combat:setCondition(condition) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/monster/frazzlemaw paralyze.lua b/path_8_6/data/spells/scripts/monster/frazzlemaw paralyze.lua new file mode 100644 index 000000000..3106180e7 --- /dev/null +++ b/path_8_6/data/spells/scripts/monster/frazzlemaw paralyze.lua @@ -0,0 +1,30 @@ + local combat = Combat() + combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_RED) + + local condition = Condition(CONDITION_PARALYZE) + condition:setParameter(CONDITION_PARAM_TICKS, 20000) + condition:setFormula(-0.6, 0, -0.8, 0) + combat:setCondition(condition) + + arr = { + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0}, + {0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0}, + {0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0}, + {0, 0, 1, 1, 1, 1, 3, 1, 1, 1, 1, 0, 0}, + {0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0}, + {0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0}, + {0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} + } + + local area = createCombatArea(arr) + combat:setArea(area) + +function onCastSpell(creature, variant) + return combat:execute(creature, variant) +end diff --git a/path_8_6/data/spells/scripts/monster/fury skill reducer.lua b/path_8_6/data/spells/scripts/monster/fury skill reducer.lua index d4501e822..2f0534660 100644 --- a/path_8_6/data/spells/scripts/monster/fury skill reducer.lua +++ b/path_8_6/data/spells/scripts/monster/fury skill reducer.lua @@ -8,6 +8,6 @@ combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_SOUND_YELLOW) combat:setArea(createCombatArea(AREA_CIRCLE3X3)) combat:setCondition(condition) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/monster/ghastly dragon curse.lua b/path_8_6/data/spells/scripts/monster/ghastly dragon curse.lua index ec926cd82..c12c9fcdc 100644 --- a/path_8_6/data/spells/scripts/monster/ghastly dragon curse.lua +++ b/path_8_6/data/spells/scripts/monster/ghastly dragon curse.lua @@ -9,7 +9,7 @@ for i = 40, 170 do combat[index]:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_DEATH) local condition = Condition(CONDITION_CURSED) - condition:setParameter(CONDITION_PARAM_DELAYED, 1) + condition:setParameter(CONDITION_PARAM_DELAYED, true) local damage = i condition:addDamage(1, 4000, -damage) @@ -28,6 +28,6 @@ for i = 40, 170 do end end -function onCastSpell(creature, var) - return combat[math.random(#combat)]:execute(creature, var) +function onCastSpell(creature, variant) + return combat[math.random(#combat)]:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/monster/glooth anemone summon.lua b/path_8_6/data/spells/scripts/monster/glooth anemone summon.lua new file mode 100644 index 000000000..43e8d773b --- /dev/null +++ b/path_8_6/data/spells/scripts/monster/glooth anemone summon.lua @@ -0,0 +1,22 @@ +local combat = Combat() +combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_NONE) +combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN) + +local area = createCombatArea(AREA_SQUARE1X1) +combat:setArea(area) + +local maxsummons = 1 + +function onCastSpell(creature, variant) + local summoncount = creature:getSummons() + if #summoncount < 1 then + for i = 1, maxsummons - #summoncount do + local mid = Game.createMonster("Glooth Blob", creature:getPosition()) + if not mid then + return + end + mid:setMaster(creature) + end + end + return combat:execute(creature, variant) +end diff --git a/path_8_6/data/spells/scripts/monster/hellfire fighter soulfire.lua b/path_8_6/data/spells/scripts/monster/hellfire fighter soulfire.lua index 27e97561c..8ae590fdd 100644 --- a/path_8_6/data/spells/scripts/monster/hellfire fighter soulfire.lua +++ b/path_8_6/data/spells/scripts/monster/hellfire fighter soulfire.lua @@ -1,5 +1,5 @@ local condition = Condition(CONDITION_FIRE) -condition:setParameter(CONDITION_PARAM_DELAYED, 1) +condition:setParameter(CONDITION_PARAM_DELAYED, true) condition:addDamage(20, 9000, -10) local combat = Combat() @@ -8,6 +8,6 @@ combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_FIREATTACK) combat:setArea(createCombatArea(AREA_CROSS6X6)) combat:setCondition(condition) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/monster/hellgorak skill reducer.lua b/path_8_6/data/spells/scripts/monster/hellgorak skill reducer.lua new file mode 100644 index 000000000..0c4238394 --- /dev/null +++ b/path_8_6/data/spells/scripts/monster/hellgorak skill reducer.lua @@ -0,0 +1,34 @@ +local combat = {} + +for i = 20, 40 do + combat[i] = Combat() + combat[i]:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_POFF) + + local condition = Condition(CONDITION_ATTRIBUTES) + condition:setParameter(CONDITION_PARAM_TICKS, 20000) + condition:setParameter(CONDITION_PARAM_SKILL_DISTANCEPERCENT, i) + + arr = { + {0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0}, + {0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0}, + {0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0}, + {0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0}, + {0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0}, + {1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1}, + {0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0}, + {0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0}, + {0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0}, + {0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0}, + {0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0} + } + + local area = createCombatArea(arr) + combat[i]:setArea(area) + combat[i]:setCondition(condition) +end + +function onCastSpell(creature, variant) + return combat[math.random(20, 40)]:execute(creature, variant) +end diff --git a/path_8_6/data/spells/scripts/monster/hellspawn soulfire.lua b/path_8_6/data/spells/scripts/monster/hellspawn soulfire.lua index 91af85644..1c7f144e2 100644 --- a/path_8_6/data/spells/scripts/monster/hellspawn soulfire.lua +++ b/path_8_6/data/spells/scripts/monster/hellspawn soulfire.lua @@ -4,10 +4,10 @@ combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_HITBYFIRE) combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_FIRE) local condition = Condition(CONDITION_FIRE) -condition:setParameter(CONDITION_PARAM_DELAYED, 1) +condition:setParameter(CONDITION_PARAM_DELAYED, true) condition:addDamage(26, 9000, -10) combat:setCondition(condition) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/monster/ice golem skill reducer.lua b/path_8_6/data/spells/scripts/monster/ice golem skill reducer.lua index ca7c631f8..d7bc670f0 100644 --- a/path_8_6/data/spells/scripts/monster/ice golem skill reducer.lua +++ b/path_8_6/data/spells/scripts/monster/ice golem skill reducer.lua @@ -8,6 +8,6 @@ combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_HITAREA) combat:setArea(createCombatArea(AREA_SQUARE1X1)) combat:setCondition(condition) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/monster/infernalist skill reducer.lua b/path_8_6/data/spells/scripts/monster/infernalist skill reducer.lua new file mode 100644 index 000000000..27208c4c9 --- /dev/null +++ b/path_8_6/data/spells/scripts/monster/infernalist skill reducer.lua @@ -0,0 +1,13 @@ +local combat = Combat() +combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MORTAREA) +combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SUDDENDEATH) + +local condition = Condition(CONDITION_ATTRIBUTES) +condition:setParameter(CONDITION_PARAM_TICKS, 6000) +condition:setParameter(CONDITION_PARAM_SKILL_MELEEPERCENT, 50) +condition:setParameter(CONDITION_PARAM_SKILL_SHIELDPERCENT, 50) +combat:setCondition(condition) + +function onCastSpell(creature, variant) + return combat:execute(creature, variant) +end diff --git a/path_8_6/data/spells/scripts/monster/lancer beetle curse.lua b/path_8_6/data/spells/scripts/monster/lancer beetle curse.lua index acfc56cf2..abffaacaa 100644 --- a/path_8_6/data/spells/scripts/monster/lancer beetle curse.lua +++ b/path_8_6/data/spells/scripts/monster/lancer beetle curse.lua @@ -7,7 +7,7 @@ for i = 5, 11 do combat[i]:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_DEATH) local condition = Condition(CONDITION_CURSED) - condition:setParameter(CONDITION_PARAM_DELAYED, 1) + condition:setParameter(CONDITION_PARAM_DELAYED, true) local damage = i condition:addDamage(1, 4000, -damage) @@ -19,6 +19,6 @@ for i = 5, 11 do combat[i]:setCondition(condition) end -function onCastSpell(creature, var) - return combat[math.random(5, 11)]:execute(creature, var) +function onCastSpell(creature, variant) + return combat[math.random(5, 11)]:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/monster/lava golem soulfire.lua b/path_8_6/data/spells/scripts/monster/lava golem soulfire.lua index 720e19e33..69aacb1e3 100644 --- a/path_8_6/data/spells/scripts/monster/lava golem soulfire.lua +++ b/path_8_6/data/spells/scripts/monster/lava golem soulfire.lua @@ -1,5 +1,5 @@ local condition = Condition(CONDITION_FIRE) -condition:setParameter(CONDITION_PARAM_DELAYED, 1) +condition:setParameter(CONDITION_PARAM_DELAYED, true) condition:addDamage(40, 9000, -10) local combat = Combat() @@ -8,6 +8,6 @@ combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_EXPLOSIONHIT) combat:setArea(createCombatArea(AREA_CIRCLE2X2)) combat:setCondition(condition) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/monster/lizard magistratus curse.lua b/path_8_6/data/spells/scripts/monster/lizard magistratus curse.lua index af0782168..b5b3276b5 100644 --- a/path_8_6/data/spells/scripts/monster/lizard magistratus curse.lua +++ b/path_8_6/data/spells/scripts/monster/lizard magistratus curse.lua @@ -7,7 +7,7 @@ for i = 2, 3 do combat[i]:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_DEATH) local condition = Condition(CONDITION_CURSED) - condition:setParameter(CONDITION_PARAM_DELAYED, 1) + condition:setParameter(CONDITION_PARAM_DELAYED, true) local damage = i condition:addDamage(1, 4000, -damage) @@ -19,6 +19,6 @@ for i = 2, 3 do combat[i]:setCondition(condition) end -function onCastSpell(creature, var) - return combat[math.random(2, 3)]:execute(creature, var) +function onCastSpell(creature, variant) + return combat[math.random(2, 3)]:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/monster/magma crawler soulfire.lua b/path_8_6/data/spells/scripts/monster/magma crawler soulfire.lua index 8da432be9..68135f908 100644 --- a/path_8_6/data/spells/scripts/monster/magma crawler soulfire.lua +++ b/path_8_6/data/spells/scripts/monster/magma crawler soulfire.lua @@ -1,5 +1,5 @@ local condition = Condition(CONDITION_FIRE) -condition:setParameter(CONDITION_PARAM_DELAYED, 1) +condition:setParameter(CONDITION_PARAM_DELAYED, true) condition:addDamage(20, 9000, -10) local combat = Combat() @@ -8,6 +8,6 @@ combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_EXPLOSIONHIT) combat:setArea(createCombatArea(AREA_CIRCLE2X2)) combat:setCondition(condition) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/monster/massive energy elemental electrify.lua b/path_8_6/data/spells/scripts/monster/massive energy elemental electrify.lua index 0228d6c60..1bbd62614 100644 --- a/path_8_6/data/spells/scripts/monster/massive energy elemental electrify.lua +++ b/path_8_6/data/spells/scripts/monster/massive energy elemental electrify.lua @@ -1,5 +1,5 @@ local condition = Condition(CONDITION_ENERGY) -condition:setParameter(CONDITION_PARAM_DELAYED, 1) +condition:setParameter(CONDITION_PARAM_DELAYED, true) condition:addDamage(10, 10000, -25) local combat = Combat() @@ -8,6 +8,6 @@ combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_BLOCKHIT) combat:setArea(createCombatArea(AREA_CIRCLE3X3)) combat:setCondition(condition) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/monster/massive fire elemental soulfire.lua b/path_8_6/data/spells/scripts/monster/massive fire elemental soulfire.lua index 165d1328d..1c759518a 100644 --- a/path_8_6/data/spells/scripts/monster/massive fire elemental soulfire.lua +++ b/path_8_6/data/spells/scripts/monster/massive fire elemental soulfire.lua @@ -1,5 +1,5 @@ local condition = Condition(CONDITION_FIRE) -condition:setParameter(CONDITION_PARAM_DELAYED, 1) +condition:setParameter(CONDITION_PARAM_DELAYED, true) condition:addDamage(20, 9000, -10) local combat = Combat() @@ -8,6 +8,6 @@ combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_RED) combat:setArea(createCombatArea(AREA_CROSS6X6)) combat:setCondition(condition) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/monster/medusa paralyze.lua b/path_8_6/data/spells/scripts/monster/medusa paralyze.lua new file mode 100644 index 000000000..5a08677ca --- /dev/null +++ b/path_8_6/data/spells/scripts/monster/medusa paralyze.lua @@ -0,0 +1,32 @@ +local combat = Combat() +combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_POFF) +combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_EARTH) + +local condition = Condition(CONDITION_PARALYZE) +condition:setParameter(CONDITION_PARAM_TICKS, 20000) +condition:setFormula(-0.45, 0, -0.5, 0) +combat:setCondition(condition) + +arr = { + {0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0}, + {0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0}, + {0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0}, + {0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0}, + {0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0}, + {1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1}, + {0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0}, + {0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0}, + {0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0}, + {0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0}, + {0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0} +} + +local area = createCombatArea(arr) +combat:setArea(area) +combat:setCondition(condition) + +function onCastSpell(creature, variant) + return combat:execute(creature, variant) +end diff --git a/path_8_6/data/spells/scripts/monster/metal gargoyle curse.lua b/path_8_6/data/spells/scripts/monster/metal gargoyle curse.lua new file mode 100644 index 000000000..eebd81402 --- /dev/null +++ b/path_8_6/data/spells/scripts/monster/metal gargoyle curse.lua @@ -0,0 +1,23 @@ +local combat = {} + +for i = 2, 2 do + combat[i] = Combat() + combat[i]:setParameter(COMBAT_PARAM_TYPE, COMBAT_DEATHDAMAGE) + combat[i]:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SUDDENDEATH) + + local condition = Condition(CONDITION_CURSED) + condition:setParameter(CONDITION_PARAM_DELAYED, true) + + local damage = i + condition:addDamage(1, 4000, -damage) + for j = 1, 20 do + damage = damage * 1.2 + condition:addDamage(1, 4000, -damage) + end + + combat[i]:setCondition(condition) +end + +function onCastSpell(creature, variant) + return combat[math.random(2, 2)]:execute(creature, variant) +end diff --git a/path_8_6/data/spells/scripts/monster/minotaur amazon paralyze.lua b/path_8_6/data/spells/scripts/monster/minotaur amazon paralyze.lua new file mode 100644 index 000000000..130fd1811 --- /dev/null +++ b/path_8_6/data/spells/scripts/monster/minotaur amazon paralyze.lua @@ -0,0 +1,23 @@ +local combat = Combat() +combat:setParameter(COMBAT_PARAM_EFFECT, 3) + +local condition = Condition(CONDITION_PARALYZE) +condition:setParameter(CONDITION_PARAM_TICKS, 10000) +condition:setFormula(-0.4, 0, -0.7, 0) +combat:setCondition(condition) + + arr = { + {0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0}, + {0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0}, + {0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0} + } + +local area = createCombatArea(arr) + combat:setArea(area) + combat:setCondition(condition) + + +function onCastSpell(creature, variant) + return combat:execute(creature, variant) +end diff --git a/path_8_6/data/spells/scripts/monster/mooh'tah master skill reducer.lua b/path_8_6/data/spells/scripts/monster/mooh'tah master skill reducer.lua new file mode 100644 index 000000000..049fe8599 --- /dev/null +++ b/path_8_6/data/spells/scripts/monster/mooh'tah master skill reducer.lua @@ -0,0 +1,12 @@ + local combat = Combat() + combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_STUN) + combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SUDDENDEATH) + + local condition = Condition(CONDITION_ATTRIBUTES) + condition:setParameter(CONDITION_PARAM_TICKS, 3000) + condition:setParameter(CONDITION_PARAM_SKILL_SHIELDPERCENT, -100) + combat:setCondition(condition) + +function onCastSpell(creature, variant) + return combat:execute(creature, variant) +end diff --git a/path_8_6/data/spells/scripts/monster/mutated bat curse.lua b/path_8_6/data/spells/scripts/monster/mutated bat curse.lua index c51839fd2..a724e6cfc 100644 --- a/path_8_6/data/spells/scripts/monster/mutated bat curse.lua +++ b/path_8_6/data/spells/scripts/monster/mutated bat curse.lua @@ -2,7 +2,7 @@ local combat = {} for i = 2, 4 do local condition = Condition(CONDITION_CURSED) - condition:setParameter(CONDITION_PARAM_DELAYED, 1) + condition:setParameter(CONDITION_PARAM_DELAYED, true) local damage = i condition:addDamage(1, 4000, -damage) @@ -19,6 +19,6 @@ for i = 2, 4 do combat[i]:setCondition(condition) end -function onCastSpell(creature, var) - return combat[math.random(2, 4)]:execute(creature, var) +function onCastSpell(creature, variant) + return combat[math.random(2, 4)]:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/monster/phantasm drown.lua b/path_8_6/data/spells/scripts/monster/phantasm drown.lua index 5136a8ac6..bc13da129 100644 --- a/path_8_6/data/spells/scripts/monster/phantasm drown.lua +++ b/path_8_6/data/spells/scripts/monster/phantasm drown.lua @@ -1,5 +1,5 @@ local condition = Condition(CONDITION_DROWN) -condition:setParameter(CONDITION_PARAM_DELAYED, 1) +condition:setParameter(CONDITION_PARAM_DELAYED, true) condition:addDamage(20, 5000, -20) local combat = Combat() @@ -8,6 +8,6 @@ combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE) combat:setArea(createCombatArea(AREA_SQUAREWAVE7)) combat:setCondition(condition) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/monster/pirate corsair skill reducer.lua b/path_8_6/data/spells/scripts/monster/pirate corsair skill reducer.lua index a53d18263..7435ff606 100644 --- a/path_8_6/data/spells/scripts/monster/pirate corsair skill reducer.lua +++ b/path_8_6/data/spells/scripts/monster/pirate corsair skill reducer.lua @@ -7,6 +7,6 @@ combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_SOUND_PURPLE) combat:setArea(createCombatArea(AREA_BEAM1)) combat:setCondition(condition) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/monster/quara constrictor electrify.lua b/path_8_6/data/spells/scripts/monster/quara constrictor electrify.lua index 65e7cd7f5..83eb0c4eb 100644 --- a/path_8_6/data/spells/scripts/monster/quara constrictor electrify.lua +++ b/path_8_6/data/spells/scripts/monster/quara constrictor electrify.lua @@ -4,10 +4,10 @@ combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_ENERGYHIT) combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGY) local condition = Condition(CONDITION_ENERGY) -condition:setParameter(CONDITION_PARAM_DELAYED, 1) +condition:setParameter(CONDITION_PARAM_DELAYED, true) condition:addDamage(3, 10000, -25) combat:setCondition(condition) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/monster/quara constrictor freeze.lua b/path_8_6/data/spells/scripts/monster/quara constrictor freeze.lua index 5e4af842f..96e483d7c 100644 --- a/path_8_6/data/spells/scripts/monster/quara constrictor freeze.lua +++ b/path_8_6/data/spells/scripts/monster/quara constrictor freeze.lua @@ -1,5 +1,5 @@ local condition = Condition(CONDITION_FREEZING) -condition:setParameter(CONDITION_PARAM_DELAYED, 1) +condition:setParameter(CONDITION_PARAM_DELAYED, true) condition:addDamage(10, 8000, -8) local combat = Combat() @@ -8,6 +8,6 @@ combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_GREEN_RINGS) combat:setArea(createCombatArea(AREA_SQUARE1X1)) combat:setCondition(condition) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/monster/rot elemental paralyze.lua b/path_8_6/data/spells/scripts/monster/rot elemental paralyze.lua new file mode 100644 index 000000000..2450159e4 --- /dev/null +++ b/path_8_6/data/spells/scripts/monster/rot elemental paralyze.lua @@ -0,0 +1,17 @@ +local combat = Combat() +combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_SOUND_GREEN) + +local condition = Condition(CONDITION_PARALYZE) +condition:setParameter(CONDITION_PARAM_TICKS, 20000) +condition:setFormula(-0.45, 0, -0.65, 0) +combat:setCondition(condition) + + +local area = createCombatArea(AREA_CIRCLE2X2) + combat:setArea(area) + combat:setCondition(condition) + + +function onCastSpell(creature, variant) + return combat:execute(creature, variant) +end diff --git a/path_8_6/data/spells/scripts/monster/rustheap golem electrify.lua b/path_8_6/data/spells/scripts/monster/rustheap golem electrify.lua new file mode 100644 index 000000000..1cedb5de8 --- /dev/null +++ b/path_8_6/data/spells/scripts/monster/rustheap golem electrify.lua @@ -0,0 +1,16 @@ +local combat = Combat() +combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_ENERGYDAMAGE) +combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_HITAREA) +combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGY) + +local condition = Condition(CONDITION_ENERGY) +condition:setParameter(CONDITION_PARAM_DELAYED, true) +condition:addDamage(17, 10000, -25) +combat:setCondition(condition) + +local area = createCombatArea(AREA_SQUARE1X1) +combat:setArea(area) + +function onCastSpell(creature, variant) + return combat:execute(creature, variant) +end diff --git a/path_8_6/data/spells/scripts/monster/rustheap golem wave.lua b/path_8_6/data/spells/scripts/monster/rustheap golem wave.lua new file mode 100644 index 000000000..12c0b1ebc --- /dev/null +++ b/path_8_6/data/spells/scripts/monster/rustheap golem wave.lua @@ -0,0 +1,18 @@ +local combat = Combat() +combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_LIFEDRAIN) +combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_BLACKSMOKE) + + arr = { + {0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0}, + {0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0}, + {0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0} + } + +local area = createCombatArea(arr) + combat:setArea(area) + + +function onCastSpell(creature, variant) + return combat:execute(creature, variant) +end diff --git a/path_8_6/data/spells/scripts/monster/sea serpent drown.lua b/path_8_6/data/spells/scripts/monster/sea serpent drown.lua index e5bcc6c32..c0af07d2a 100644 --- a/path_8_6/data/spells/scripts/monster/sea serpent drown.lua +++ b/path_8_6/data/spells/scripts/monster/sea serpent drown.lua @@ -1,5 +1,5 @@ local condition = Condition(CONDITION_DROWN) -condition:setParameter(CONDITION_PARAM_DELAYED, 1) +condition:setParameter(CONDITION_PARAM_DELAYED, true) condition:addDamage(12, 5000, -20) local combat = Combat() @@ -8,6 +8,6 @@ combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_WATERSPLASH) combat:setArea(createCombatArea(AREA_SQUARE1X1)) combat:setCondition(condition) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/monster/seacrest serpent wave.lua b/path_8_6/data/spells/scripts/monster/seacrest serpent wave.lua new file mode 100644 index 000000000..3c21e65b8 --- /dev/null +++ b/path_8_6/data/spells/scripts/monster/seacrest serpent wave.lua @@ -0,0 +1,19 @@ +local combat = Combat() +combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_DEATHDAMAGE) +combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_WATERSPLASH) + + arr = { + {0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0}, + {0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0}, + {0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0}, + {0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0} + } + +local area = createCombatArea(arr) +combat:setArea(area) + +function onCastSpell(creature, variant) + return combat:execute(creature, variant) +end diff --git a/path_8_6/data/spells/scripts/monster/shock head skill reducer 1.lua b/path_8_6/data/spells/scripts/monster/shock head skill reducer 1.lua index e820b56e3..a7733c502 100644 --- a/path_8_6/data/spells/scripts/monster/shock head skill reducer 1.lua +++ b/path_8_6/data/spells/scripts/monster/shock head skill reducer 1.lua @@ -8,6 +8,6 @@ combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_EXPLOSION) combat:setArea(createCombatArea(AREA_CIRCLE2X2)) combat:setCondition(condition) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/monster/shock head skill reducer 2.lua b/path_8_6/data/spells/scripts/monster/shock head skill reducer 2.lua index 6632e662c..f70279d7f 100644 --- a/path_8_6/data/spells/scripts/monster/shock head skill reducer 2.lua +++ b/path_8_6/data/spells/scripts/monster/shock head skill reducer 2.lua @@ -7,6 +7,6 @@ combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_STUN) combat:setArea(createCombatArea(AREA_CROSS6X6)) combat:setCondition(condition) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/monster/silencer skill reducer.lua b/path_8_6/data/spells/scripts/monster/silencer skill reducer.lua index 9a4aa106d..5e2cc3d9d 100644 --- a/path_8_6/data/spells/scripts/monster/silencer skill reducer.lua +++ b/path_8_6/data/spells/scripts/monster/silencer skill reducer.lua @@ -12,6 +12,6 @@ for i = 20, 70 do combat[i]:setCondition(condition) end -function onCastSpell(creature, var) - return combat[math.random(20, 70)]:execute(creature, var) +function onCastSpell(creature, variant) + return combat[math.random(20, 70)]:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/monster/smokeue.lua b/path_8_6/data/spells/scripts/monster/smokeue.lua new file mode 100644 index 000000000..7128d6a20 --- /dev/null +++ b/path_8_6/data/spells/scripts/monster/smokeue.lua @@ -0,0 +1,15 @@ +local combat = Combat() +combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_GROUNDSHAKER) + +local area = createCombatArea(AREA_CROSS5X5) +combat:setArea(area) + +local condition = Condition(CONDITION_ATTRIBUTES) +condition:setParameter(CONDITION_PARAM_BUFF_SPELL, true) +condition:setParameter(CONDITION_PARAM_TICKS, 10000) +condition:setParameter(CONDITION_PARAM_SKILL_DISTANCEPERCENT, 40) +combat:setCondition(condition) + +function onCastSpell(creature, variant) + return combat:execute(creature, variant) +end diff --git a/path_8_6/data/spells/scripts/monster/souleater drown.lua b/path_8_6/data/spells/scripts/monster/souleater drown.lua index 86e518da8..aa1c8c820 100644 --- a/path_8_6/data/spells/scripts/monster/souleater drown.lua +++ b/path_8_6/data/spells/scripts/monster/souleater drown.lua @@ -1,5 +1,5 @@ local condition = Condition(CONDITION_DROWN) -condition:setParameter(CONDITION_PARAM_DELAYED, 1) +condition:setParameter(CONDITION_PARAM_DELAYED, true) condition:addDamage(10, 5000, -20) local combat = Combat() @@ -8,6 +8,6 @@ combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MORTAREA) combat:setArea(createCombatArea(AREA_CIRCLE2X2)) combat:setCondition(condition) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/monster/spectre drown.lua b/path_8_6/data/spells/scripts/monster/spectre drown.lua index ddbe0a817..d1eda5fa3 100644 --- a/path_8_6/data/spells/scripts/monster/spectre drown.lua +++ b/path_8_6/data/spells/scripts/monster/spectre drown.lua @@ -1,5 +1,5 @@ local condition = Condition(CONDITION_DROWN) -condition:setParameter(CONDITION_PARAM_DELAYED, 1) +condition:setParameter(CONDITION_PARAM_DELAYED, true) condition:addDamage(20, 5000, -20) local combat = Combat() @@ -8,6 +8,6 @@ combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN) combat:setArea(createCombatArea(AREA_CIRCLE3X3)) combat:setCondition(condition) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/monster/stampor skill reducer.lua b/path_8_6/data/spells/scripts/monster/stampor skill reducer.lua index 74710222c..5e2594633 100644 --- a/path_8_6/data/spells/scripts/monster/stampor skill reducer.lua +++ b/path_8_6/data/spells/scripts/monster/stampor skill reducer.lua @@ -13,6 +13,6 @@ for i = 60, 85 do combat[i]:setCondition(condition) end -function onCastSpell(creature, var) - return combat[math.random(60,85)]:execute(creature, var) +function onCastSpell(creature, variant) + return combat[math.random(60, 85)]:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/monster/undead dragon curse.lua b/path_8_6/data/spells/scripts/monster/undead dragon curse.lua index 6f10e9f22..20e848a5d 100644 --- a/path_8_6/data/spells/scripts/monster/undead dragon curse.lua +++ b/path_8_6/data/spells/scripts/monster/undead dragon curse.lua @@ -2,7 +2,7 @@ local combat = {} for i = 30, 50 do local condition = Condition(CONDITION_CURSED) - condition:setParameter(CONDITION_PARAM_DELAYED, 1) + condition:setParameter(CONDITION_PARAM_DELAYED, true) local damage = i condition:addDamage(1, 4000, -damage) @@ -19,6 +19,6 @@ for i = 30, 50 do combat[i]:setCondition(condition) end -function onCastSpell(creature, var) - return combat[math.random(30, 50)]:execute(creature, var) +function onCastSpell(creature, variant) + return combat[math.random(30, 50)]:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/monster/vulcongra soulfire.lua b/path_8_6/data/spells/scripts/monster/vulcongra soulfire.lua index 21a59ee7e..d56c65ec5 100644 --- a/path_8_6/data/spells/scripts/monster/vulcongra soulfire.lua +++ b/path_8_6/data/spells/scripts/monster/vulcongra soulfire.lua @@ -1,5 +1,5 @@ local condition = Condition(CONDITION_FIRE) -condition:setParameter(CONDITION_PARAM_DELAYED, 1) +condition:setParameter(CONDITION_PARAM_DELAYED, true) condition:addDamage(20, 9000, -10) local combat = Combat() @@ -8,6 +8,6 @@ combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_HITBYFIRE) combat:setArea(createCombatArea(AREA_SQUARE1X1)) combat:setCondition(condition) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/monster/walker skill reducer.lua b/path_8_6/data/spells/scripts/monster/walker skill reducer.lua new file mode 100644 index 000000000..73553dde4 --- /dev/null +++ b/path_8_6/data/spells/scripts/monster/walker skill reducer.lua @@ -0,0 +1,71 @@ +local mage = {1, 2, 5, 6} +local paladin = {3, 7} +local knight = {4, 8} + +local combat = {} + +for i = 45, 60 do + combat[i] = Combat() + + local condition1 = Condition(CONDITION_ATTRIBUTES) + condition1:setParameter(CONDITION_PARAM_TICKS, 7000) + condition1:setParameter(CONDITION_PARAM_SKILL_MELEEPERCENT, i) + condition1:setParameter(CONDITION_PARAM_SKILL_FISTPERCENT, i) + condition1:setParameter(CONDITION_PARAM_SKILL_SHIELDPERCENT, i) + + local condition2 = Condition(CONDITION_ATTRIBUTES) + condition2:setParameter(CONDITION_PARAM_TICKS, 7000) + condition2:setParameter(CONDITION_PARAM_STAT_MAGICPOINTSPERCENT, i) + + local condition3 = Condition(CONDITION_ATTRIBUTES) + condition3:setParameter(CONDITION_PARAM_TICKS, 7000) + condition3:setParameter(CONDITION_PARAM_SKILL_DISTANCEPERCENT, i) + condition3:setParameter(CONDITION_PARAM_SKILL_SHIELDPERCENT, i) + + local area = createCombatArea(AREA_CIRCLE3X3) + combat[i]:setArea(area) + + +function onTargetTile(creature, pos) + local creatureTable = {} + local n, i = Tile({x=pos.x, y=pos.y, z=pos.z}).creatures, 1 + if n ~= 0 then + local v = getThingfromPos({x=pos.x, y=pos.y, z=pos.z, stackpos=i}).uid + while v ~= 0 do + if isCreature(v) == true then + table.insert(creatureTable, v) + if n == #creatureTable then + break + end + end + i = i + 1 + v = getThingfromPos({x=pos.x, y=pos.y, z=pos.z, stackpos=i}).uid + end + end + if #creatureTable ~= nil and #creatureTable > 0 then + for r = 1, #creatureTable do + if creatureTable[r] ~= creature then + local player = Player(creatureTable[r]) + + if isPlayer(creatureTable[r]) == true and isInArray(mage, player:getVocation():getId()) then + player:addCondition(condition2) + elseif isPlayer(creatureTable[r]) == true and isInArray(paladin, player:getVocation():getId()) then + player:addCondition(condition3) + elseif isPlayer(creatureTable[r]) == true and isInArray(knight, player:getVocation():getId()) then + player:addCondition(condition1) + elseif isMonster(creatureTable[r]) == true then + end + end + end + end + pos:sendMagicEffect(CONST_ME_MAGIC_RED) + return true +end + +combat[i]:setCallback(CALLBACK_PARAM_TARGETTILE, "onTargetTile") + +end + +function onCastSpell(creature, variant) + return combat[math.random(45, 60)]:execute(creature, variant) +end diff --git a/path_8_6/data/spells/scripts/monster/war golem electrify.lua b/path_8_6/data/spells/scripts/monster/war golem electrify.lua index efb7eb0df..630922952 100644 --- a/path_8_6/data/spells/scripts/monster/war golem electrify.lua +++ b/path_8_6/data/spells/scripts/monster/war golem electrify.lua @@ -3,10 +3,10 @@ combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_ENERGYDAMAGE) combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_ENERGYHIT) local condition = Condition(CONDITION_ENERGY) -condition:setParameter(CONDITION_PARAM_DELAYED, 1) +condition:setParameter(CONDITION_PARAM_DELAYED, true) condition:addDamage(8, 10000, -25) combat:setCondition(condition) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/monster/war golem skill reducer.lua b/path_8_6/data/spells/scripts/monster/war golem skill reducer.lua index 38aa4985a..af28828b6 100644 --- a/path_8_6/data/spells/scripts/monster/war golem skill reducer.lua +++ b/path_8_6/data/spells/scripts/monster/war golem skill reducer.lua @@ -7,6 +7,6 @@ combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_STUN) combat:setArea(createCombatArea(AREA_BEAM8)) combat:setCondition(condition) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/monster/warlock skill reducer.lua b/path_8_6/data/spells/scripts/monster/warlock skill reducer.lua index 7170a0c29..49dbbad2c 100644 --- a/path_8_6/data/spells/scripts/monster/warlock skill reducer.lua +++ b/path_8_6/data/spells/scripts/monster/warlock skill reducer.lua @@ -9,6 +9,6 @@ combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ICE) combat:setArea(createCombatArea(AREA_BEAM1)) combat:setCondition(condition) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/monster/werewolf skill reducer.lua b/path_8_6/data/spells/scripts/monster/werewolf skill reducer.lua index 15ff967c4..ceaa58e67 100644 --- a/path_8_6/data/spells/scripts/monster/werewolf skill reducer.lua +++ b/path_8_6/data/spells/scripts/monster/werewolf skill reducer.lua @@ -8,6 +8,6 @@ combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_DRAWBLOOD) combat:setArea(createCombatArea(AREA_BEAM1)) combat:setCondition(condition) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/monster/worm priestess paralyze.lua b/path_8_6/data/spells/scripts/monster/worm priestess paralyze.lua new file mode 100644 index 000000000..d7efefcc3 --- /dev/null +++ b/path_8_6/data/spells/scripts/monster/worm priestess paralyze.lua @@ -0,0 +1,22 @@ +local combat = Combat() +combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_HITAREA) + +local condition = Condition(CONDITION_PARALYZE) +condition:setParameter(CONDITION_PARAM_TICKS, 10000) +condition:setFormula(-0.4, 0, -0.7, 0) +combat:setCondition(condition) + + arr = { + {0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0}, + {0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0} + } + +local area = createCombatArea(arr) + combat:setArea(area) + combat:setCondition(condition) + + +function onCastSpell(creature, variant) + return combat:execute(creature, variant) +end diff --git a/path_8_6/data/spells/scripts/monster/young sea serpent drown.lua b/path_8_6/data/spells/scripts/monster/young sea serpent drown.lua index 9d45cd91e..93d9fb5b5 100644 --- a/path_8_6/data/spells/scripts/monster/young sea serpent drown.lua +++ b/path_8_6/data/spells/scripts/monster/young sea serpent drown.lua @@ -1,5 +1,5 @@ local condition = Condition(CONDITION_DROWN) -condition:setParameter(CONDITION_PARAM_DELAYED, 1) +condition:setParameter(CONDITION_PARAM_DELAYED, true) condition:addDamage(6, 5000, -20) local combat = Combat() @@ -8,6 +8,6 @@ combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_WATERSPLASH) combat:setArea(createCombatArea(AREA_SQUARE1X1)) combat:setCondition(condition) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/party/enchant.lua b/path_8_6/data/spells/scripts/party/enchant.lua index 1b2104dbf..b58e636cf 100644 --- a/path_8_6/data/spells/scripts/party/enchant.lua +++ b/path_8_6/data/spells/scripts/party/enchant.lua @@ -1,16 +1,16 @@ local combat = Combat() -combat:setArea(createCombatArea(AREA_CROSS5X5)) combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE) -combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0) +combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false) +combat:setArea(createCombatArea(AREA_CROSS5X5)) local condition = Condition(CONDITION_ATTRIBUTES) condition:setParameter(CONDITION_PARAM_SUBID, 3) -condition:setParameter(CONDITION_PARAM_BUFF_SPELL, 1) condition:setParameter(CONDITION_PARAM_TICKS, 2 * 60 * 1000) condition:setParameter(CONDITION_PARAM_STAT_MAGICPOINTS, 1) +condition:setParameter(CONDITION_PARAM_BUFF_SPELL, true) local baseMana = 120 -function onCastSpell(creature, var, isHotkey) +function onCastSpell(creature, variant, isHotkey) local position = creature:getPosition() local party = creature:getParty() @@ -49,7 +49,7 @@ function onCastSpell(creature, var, isHotkey) return false end - if not combat:execute(creature, var) then + if not combat:execute(creature, variant) then creature:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE) position:sendMagicEffect(CONST_ME_POFF) return false diff --git a/path_8_6/data/spells/scripts/party/heal.lua b/path_8_6/data/spells/scripts/party/heal.lua index 2efc87cdd..16a7d97b2 100644 --- a/path_8_6/data/spells/scripts/party/heal.lua +++ b/path_8_6/data/spells/scripts/party/heal.lua @@ -1,17 +1,17 @@ local combat = Combat() -combat:setParameter(createCombatArea(AREA_CROSS5X5)) combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE) -combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0) +combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false) +combat:setArea(createCombatArea(AREA_CROSS5X5)) local condition = Condition(CONDITION_REGENERATION) condition:setParameter(CONDITION_PARAM_SUBID, 1) -condition:setParameter(CONDITION_PARAM_BUFF_SPELL, 1) condition:setParameter(CONDITION_PARAM_TICKS, 2 * 60 * 1000) condition:setParameter(CONDITION_PARAM_HEALTHGAIN, 20) condition:setParameter(CONDITION_PARAM_HEALTHTICKS, 2000) +condition:setParameter(CONDITION_PARAM_BUFF_SPELL, true) local baseMana = 120 -function onCastSpell(creature, var, isHotkey) +function onCastSpell(creature, variant, isHotkey) local position = creature:getPosition() local party = creature:getParty() @@ -50,7 +50,7 @@ function onCastSpell(creature, var, isHotkey) return false end - if not combat:execute(creature, var) then + if not combat:execute(creature, variant) then creature:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE) position:sendMagicEffect(CONST_ME_POFF) return false diff --git a/path_8_6/data/spells/scripts/party/protect.lua b/path_8_6/data/spells/scripts/party/protect.lua index c6569903d..5943fe0af 100644 --- a/path_8_6/data/spells/scripts/party/protect.lua +++ b/path_8_6/data/spells/scripts/party/protect.lua @@ -1,16 +1,16 @@ local combat = Combat() -combat:setArea(createCombatArea(AREA_CROSS5X5)) combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE) -combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0) +combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false) +combat:setArea(createCombatArea(AREA_CROSS5X5)) local condition = Condition(CONDITION_ATTRIBUTES) condition:setParameter(CONDITION_PARAM_SUBID, 2) -condition:setParameter(CONDITION_PARAM_BUFF_SPELL, 1) condition:setParameter(CONDITION_PARAM_TICKS, 2 * 60 * 1000) condition:setParameter(CONDITION_PARAM_SKILL_SHIELD, 2) +condition:setParameter(CONDITION_PARAM_BUFF_SPELL, true) local baseMana = 90 -function onCastSpell(creature, var, isHotkey) +function onCastSpell(creature, variant, isHotkey) local position = creature:getPosition() local party = creature:getParty() @@ -49,7 +49,7 @@ function onCastSpell(creature, var, isHotkey) return false end - if not combat:execute(creature, var) then + if not combat:execute(creature, variant) then creature:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE) position:sendMagicEffect(CONST_ME_POFF) return false diff --git a/path_8_6/data/spells/scripts/party/train.lua b/path_8_6/data/spells/scripts/party/train.lua index 7f24424db..836ca2449 100644 --- a/path_8_6/data/spells/scripts/party/train.lua +++ b/path_8_6/data/spells/scripts/party/train.lua @@ -1,17 +1,17 @@ local combat = Combat() -combat:setArea(createCombatArea(AREA_CROSS5X5)) combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE) -combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0) +combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false) +combat:setArea(createCombatArea(AREA_CROSS5X5)) local condition = Condition(CONDITION_ATTRIBUTES) condition:setParameter(CONDITION_PARAM_SUBID, 1) -condition:setParameter(CONDITION_PARAM_BUFF_SPELL, 1) condition:setParameter(CONDITION_PARAM_TICKS, 2 * 60 * 1000) condition:setParameter(CONDITION_PARAM_SKILL_MELEE, 3) condition:setParameter(CONDITION_PARAM_SKILL_DISTANCE, 3) +condition:setParameter(CONDITION_PARAM_BUFF_SPELL, true) local baseMana = 60 -function onCastSpell(creature, var, isHotkey) +function onCastSpell(creature, variant, isHotkey) local position = creature:getPosition() local party = creature:getParty() @@ -50,7 +50,7 @@ function onCastSpell(creature, var, isHotkey) return false end - if not combat:execute(creature, var) then + if not combat:execute(creature, variant) then creature:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE) position:sendMagicEffect(CONST_ME_POFF) return false diff --git a/path_8_6/data/spells/scripts/support/animate dead rune.lua b/path_8_6/data/spells/scripts/support/animate dead rune.lua index 792897ea8..daa1dca62 100644 --- a/path_8_6/data/spells/scripts/support/animate dead rune.lua +++ b/path_8_6/data/spells/scripts/support/animate dead rune.lua @@ -1,8 +1,4 @@ function onCastSpell(creature, variant, isHotkey) - if not creature:isPlayer() then - return false - end - local position = Variant.getPosition(variant) local tile = Tile(position) if tile and creature:getSkull() ~= SKULL_BLACK then diff --git a/path_8_6/data/spells/scripts/support/blood rage.lua b/path_8_6/data/spells/scripts/support/blood rage.lua index c51444c30..3daa31f24 100644 --- a/path_8_6/data/spells/scripts/support/blood rage.lua +++ b/path_8_6/data/spells/scripts/support/blood rage.lua @@ -1,14 +1,14 @@ +local combat = Combat() +combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN) +combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false) + local condition = Condition(CONDITION_ATTRIBUTES) condition:setParameter(CONDITION_PARAM_TICKS, 10000) condition:setParameter(CONDITION_PARAM_SKILL_MELEEPERCENT, 135) -condition:setParameter(CONDITION_PARAM_SKILL_SHIELDPERCENT, 0) +condition:setParameter(CONDITION_PARAM_SKILL_SHIELDPERCENT, -100) condition:setParameter(CONDITION_PARAM_BUFF_SPELL, true) - -local combat = Combat() -combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN) -combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0) combat:setCondition(condition) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/support/cancel invisibility.lua b/path_8_6/data/spells/scripts/support/cancel invisibility.lua index c99719465..1137dce45 100644 --- a/path_8_6/data/spells/scripts/support/cancel invisibility.lua +++ b/path_8_6/data/spells/scripts/support/cancel invisibility.lua @@ -3,6 +3,6 @@ combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE) combat:setParameter(COMBAT_PARAM_DISPEL, CONDITION_INVISIBLE) combat:setArea(createCombatArea(AREA_CIRCLE3X3)) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/support/challenge.lua b/path_8_6/data/spells/scripts/support/challenge.lua index 6e87f0989..348a3a7ad 100644 --- a/path_8_6/data/spells/scripts/support/challenge.lua +++ b/path_8_6/data/spells/scripts/support/challenge.lua @@ -1,12 +1,13 @@ +local combat = Combat() +combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE) +combat:setArea(createCombatArea(AREA_SQUARE1X1)) + function onTargetCreature(creature, target) return doChallengeCreature(creature, target) end -local combat = Combat() -combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE) -combat:setArea(createCombatArea(AREA_SQUARE1X1)) combat:setCallback(CALLBACK_PARAM_TARGETCREATURE, "onTargetCreature") -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/support/charge.lua b/path_8_6/data/spells/scripts/support/charge.lua index b73e9f9a2..63a183ee5 100644 --- a/path_8_6/data/spells/scripts/support/charge.lua +++ b/path_8_6/data/spells/scripts/support/charge.lua @@ -1,12 +1,12 @@ local combat = Combat() combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN) -combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0) +combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false) local condition = Condition(CONDITION_HASTE) condition:setParameter(CONDITION_PARAM_TICKS, 5000) -condition:setFormula(0.9, 0, 0.9, 0) +condition:setFormula(0.9, -72, 0.9, -72) combat:setCondition(condition) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/support/desintegrate rune.lua b/path_8_6/data/spells/scripts/support/desintegrate rune.lua index 0be9e2de2..21d538b25 100644 --- a/path_8_6/data/spells/scripts/support/desintegrate rune.lua +++ b/path_8_6/data/spells/scripts/support/desintegrate rune.lua @@ -1,6 +1,4 @@ -local dead_human = { - 3058, 3059, 3060, 3061, 3064, 3065, 3066 -} +local dead_human = {3058, 3059, 3060, 3061, 3064, 3065, 3066} function onCastSpell(creature, variant, isHotkey) local position = Variant.getPosition(variant) diff --git a/path_8_6/data/spells/scripts/support/destroy field rune.lua b/path_8_6/data/spells/scripts/support/destroy field rune.lua index c251ca919..d6ccc1162 100644 --- a/path_8_6/data/spells/scripts/support/destroy field rune.lua +++ b/path_8_6/data/spells/scripts/support/destroy field rune.lua @@ -2,6 +2,7 @@ function onCastSpell(creature, variant, isHotkey) local position = Variant.getPosition(variant) local tile = Tile(position) local field = tile and tile:getItemByType(ITEM_TYPE_MAGICFIELD) + if field and isInArray(FIELDS, field:getId()) then field:remove() position:sendMagicEffect(CONST_ME_POFF) diff --git a/path_8_6/data/spells/scripts/support/food.lua b/path_8_6/data/spells/scripts/support/food.lua index e2cfb9ad5..4b7a37081 100644 --- a/path_8_6/data/spells/scripts/support/food.lua +++ b/path_8_6/data/spells/scripts/support/food.lua @@ -8,12 +8,12 @@ local food = { 2696 -- cheese } -function onCastSpell(creature, var) - if not creature:isPlayer() then - return false +function onCastSpell(creature, variant) + creature:addItem(food[math.random(#food)]) + if math.random(1, 100) > 50 then + creature:addItem(food[math.random(#food)]) end - creature:addItem(food[math.random(#food)]) creature:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN) return true end diff --git a/path_8_6/data/spells/scripts/support/great light.lua b/path_8_6/data/spells/scripts/support/great light.lua index f056a76dc..8eea28af1 100644 --- a/path_8_6/data/spells/scripts/support/great light.lua +++ b/path_8_6/data/spells/scripts/support/great light.lua @@ -1,6 +1,6 @@ local combat = Combat() combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE) -combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0) +combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false) local condition = Condition(CONDITION_LIGHT) condition:setParameter(CONDITION_PARAM_LIGHT_LEVEL, 8) @@ -8,6 +8,6 @@ condition:setParameter(CONDITION_PARAM_LIGHT_COLOR, 215) condition:setParameter(CONDITION_PARAM_TICKS, (11 * 60 + 35) * 1000) combat:setCondition(condition) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/support/haste.lua b/path_8_6/data/spells/scripts/support/haste.lua index 3b97e03ff..51aca5baa 100644 --- a/path_8_6/data/spells/scripts/support/haste.lua +++ b/path_8_6/data/spells/scripts/support/haste.lua @@ -1,12 +1,12 @@ local combat = Combat() combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN) -combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0) +combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false) local condition = Condition(CONDITION_HASTE) condition:setParameter(CONDITION_PARAM_TICKS, 33000) condition:setFormula(0.3, -24, 0.3, -24) combat:setCondition(condition) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/support/invisible.lua b/path_8_6/data/spells/scripts/support/invisible.lua index 0f9d92031..c5d1eec86 100644 --- a/path_8_6/data/spells/scripts/support/invisible.lua +++ b/path_8_6/data/spells/scripts/support/invisible.lua @@ -1,11 +1,11 @@ local combat = Combat() combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE) -combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0) +combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false) local condition = Condition(CONDITION_INVISIBLE) condition:setParameter(CONDITION_PARAM_TICKS, 200000) combat:setCondition(condition) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/support/light.lua b/path_8_6/data/spells/scripts/support/light.lua index fd37b6799..591bf912b 100644 --- a/path_8_6/data/spells/scripts/support/light.lua +++ b/path_8_6/data/spells/scripts/support/light.lua @@ -1,6 +1,6 @@ local combat = Combat() combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE) -combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0) +combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false) local condition = Condition(CONDITION_LIGHT) condition:setParameter(CONDITION_PARAM_LIGHT_LEVEL, 6) @@ -8,6 +8,6 @@ condition:setParameter(CONDITION_PARAM_LIGHT_COLOR, 215) condition:setParameter(CONDITION_PARAM_TICKS, (6 * 60 + 10) * 1000) combat:setCondition(condition) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/support/magic rope.lua b/path_8_6/data/spells/scripts/support/magic rope.lua index 57e967fb0..012311df6 100644 --- a/path_8_6/data/spells/scripts/support/magic rope.lua +++ b/path_8_6/data/spells/scripts/support/magic rope.lua @@ -1,4 +1,4 @@ -function onCastSpell(creature, var) +function onCastSpell(creature, variant) local position = creature:getPosition() position:sendMagicEffect(CONST_ME_POFF) diff --git a/path_8_6/data/spells/scripts/support/magic shield.lua b/path_8_6/data/spells/scripts/support/magic shield.lua index dd6ef6979..adf714704 100644 --- a/path_8_6/data/spells/scripts/support/magic shield.lua +++ b/path_8_6/data/spells/scripts/support/magic shield.lua @@ -1,11 +1,11 @@ local combat = Combat() combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE) -combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0) +combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false) local condition = Condition(CONDITION_MANASHIELD) condition:setParameter(CONDITION_PARAM_TICKS, 200000) combat:setCondition(condition) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/support/magic wall rune.lua b/path_8_6/data/spells/scripts/support/magic wall rune.lua index 7c5c556cc..79c26ee0c 100644 --- a/path_8_6/data/spells/scripts/support/magic wall rune.lua +++ b/path_8_6/data/spells/scripts/support/magic wall rune.lua @@ -2,6 +2,6 @@ local combat = Combat() combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGY) combat:setParameter(COMBAT_PARAM_CREATEITEM, ITEM_MAGICWALL) -function onCastSpell(creature, var, isHotkey) - return combat:execute(creature, var) +function onCastSpell(creature, variant, isHotkey) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/support/paralyze rune.lua b/path_8_6/data/spells/scripts/support/paralyze rune.lua index 24ccc240e..4e76c6b35 100644 --- a/path_8_6/data/spells/scripts/support/paralyze rune.lua +++ b/path_8_6/data/spells/scripts/support/paralyze rune.lua @@ -6,8 +6,8 @@ condition:setParameter(CONDITION_PARAM_TICKS, 20000) condition:setFormula(-0.9, 0, -0.9, 0) combat:setCondition(condition) -function onCastSpell(creature, var) - if not combat:execute(creature, var) then +function onCastSpell(creature, variant, isHotkey) + if not combat:execute(creature, variant) then return false end diff --git a/path_8_6/data/spells/scripts/support/protector.lua b/path_8_6/data/spells/scripts/support/protector.lua index f85abcfa4..3d9ddc91f 100644 --- a/path_8_6/data/spells/scripts/support/protector.lua +++ b/path_8_6/data/spells/scripts/support/protector.lua @@ -1,25 +1,22 @@ local combat = Combat() combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN) -combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0) +combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false) -local condition = Condition(CONDITION_ATTRIBUTES) -condition:setParameter(CONDITION_PARAM_BUFF_SPELL, 1) -condition:setParameter(CONDITION_PARAM_TICKS, 13000) -condition:setParameter(CONDITION_PARAM_SKILL_SHIELDPERCENT, 220) -combat:setCondition(condition) +local skill = Condition(CONDITION_ATTRIBUTES) +skill:setParameter(CONDITION_PARAM_TICKS, 13000) +skill:setParameter(CONDITION_PARAM_SKILL_SHIELDPERCENT, 220) +skill:setParameter(CONDITION_PARAM_BUFF_SPELL, true) +combat:setCondition(skill) -local conditionExhaustCombat = Condition(CONDITION_EXHAUST_COMBAT) -conditionExhaustCombat:setParameter(CONDITION_PARAM_TICKS, 10000) -combat:setCondition(conditionExhaustCombat) +local cooldownAttackGroup = Condition(CONDITION_SPELLGROUPCOOLDOWN) +cooldownAttackGroup:setParameter(CONDITION_PARAM_SUBID, 1) +cooldownAttackGroup:setParameter(CONDITION_PARAM_TICKS, 10000) +combat:setCondition(cooldownAttackGroup) -local conditionExhaustHeal = Condition(CONDITION_EXHAUST_HEAL) -conditionExhaustHeal:setParameter(CONDITION_PARAM_TICKS, 10000) -combat:setCondition(conditionExhaustHeal) +local pacified = Condition(CONDITION_PACIFIED) +pacified:setParameter(CONDITION_PARAM_TICKS, 10000) +combat:setCondition(pacified) -local conditionPacified = Condition(CONDITION_PACIFIED) -conditionPacified:setParameter(CONDITION_PARAM_TICKS, 10000) -combat:setCondition(conditionPacified) - -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/support/sharpshooter.lua b/path_8_6/data/spells/scripts/support/sharpshooter.lua index cf5be22fd..52fe14626 100644 --- a/path_8_6/data/spells/scripts/support/sharpshooter.lua +++ b/path_8_6/data/spells/scripts/support/sharpshooter.lua @@ -1,24 +1,29 @@ local combat = Combat() combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN) -combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0) +combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false) -local condition = Condition(CONDITION_ATTRIBUTES) -condition:setParameter(CONDITION_PARAM_TICKS, 10000) -condition:setParameter(CONDITION_PARAM_SKILL_DISTANCEPERCENT, 150) -condition:setParameter(CONDITION_PARAM_SKILL_SHIELDPERCENT, -100) -condition:setParameter(CONDITION_PARAM_BUFF_SPELL, 1) -combat:setCondition(condition) +local skill = Condition(CONDITION_ATTRIBUTES) +skill:setParameter(CONDITION_PARAM_TICKS, 10000) +skill:setParameter(CONDITION_PARAM_SKILL_DISTANCEPERCENT, 150) +skill:setParameter(CONDITION_PARAM_SKILL_SHIELDPERCENT, -100) +skill:setParameter(CONDITION_PARAM_BUFF_SPELL, true) +combat:setCondition(skill) -local speed = Condition(CONDITION_HASTE) +local speed = Condition(CONDITION_PARALYZE) speed:setParameter(CONDITION_PARAM_TICKS, 10000) speed:setFormula(-0.7, 56, -0.7, 56) combat:setCondition(speed) -local exhaust = Condition(CONDITION_EXHAUST) -exhaust:setParameter(CONDITION_PARAM_SUBID, 2) -exhaust:setParameter(CONDITION_PARAM_TICKS, 10000) -combat:setCondition(exhaust) +local cooldownHealingGroup = Condition(CONDITION_SPELLGROUPCOOLDOWN) +cooldownHealingGroup:setParameter(CONDITION_PARAM_TICKS, 10000) +cooldownHealingGroup:setParameter(CONDITION_PARAM_SUBID, 2) +combat:setCondition(cooldownHealingGroup) -function onCastSpell(creature, var) - return combat:execute(creature, var) +local cooldownSupportGroup = Condition(CONDITION_SPELLGROUPCOOLDOWN) +cooldownSupportGroup:setParameter(CONDITION_PARAM_TICKS, 10000) +cooldownSupportGroup:setParameter(CONDITION_PARAM_SUBID, 3) +combat:setCondition(cooldownSupportGroup) + +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/support/strong haste.lua b/path_8_6/data/spells/scripts/support/strong haste.lua index ffdeb8776..3a02eadc6 100644 --- a/path_8_6/data/spells/scripts/support/strong haste.lua +++ b/path_8_6/data/spells/scripts/support/strong haste.lua @@ -1,12 +1,12 @@ local combat = Combat() combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN) -combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0) +combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false) local condition = Condition(CONDITION_HASTE) condition:setParameter(CONDITION_PARAM_TICKS, 22000) condition:setFormula(0.7, -56, 0.7, -56) combat:setCondition(condition) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/support/swift foot.lua b/path_8_6/data/spells/scripts/support/swift foot.lua index 4b3cbae40..d710bc7d4 100644 --- a/path_8_6/data/spells/scripts/support/swift foot.lua +++ b/path_8_6/data/spells/scripts/support/swift foot.lua @@ -1,21 +1,21 @@ local combat = Combat() combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN) -combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0) +combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false) -local condition = Condition(CONDITION_HASTE) -condition:setParameter(CONDITION_PARAM_TICKS, 10000) -condition:setFormula(0.8, -72, 0.8, -72) -combat:setCondition(condition) +local speed = Condition(CONDITION_HASTE) +speed:setParameter(CONDITION_PARAM_TICKS, 10000) +speed:setFormula(0.8, -72, 0.8, -72) +combat:setCondition(speed) -local exhaust = Condition(CONDITION_EXHAUST) -exhaust:setParameter(CONDITION_PARAM_SUBID, 1) -exhaust:setParameter(CONDITION_PARAM_TICKS, 10000) -combat:setCondition(exhaust) +local cooldownAttackGroup = Condition(CONDITION_SPELLGROUPCOOLDOWN) +cooldownAttackGroup:setParameter(CONDITION_PARAM_SUBID, 1) +cooldownAttackGroup:setParameter(CONDITION_PARAM_TICKS, 10000) +combat:setCondition(cooldownAttackGroup) -local disable = Condition(CONDITION_PACIFIED) -disable:setParameter(CONDITION_PARAM_TICKS, 10000) -combat:setCondition(disable) +local pacified = Condition(CONDITION_PACIFIED) +pacified:setParameter(CONDITION_PARAM_TICKS, 10000) +combat:setCondition(pacified) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/support/ultimate light.lua b/path_8_6/data/spells/scripts/support/ultimate light.lua index a9e92868a..cea27680f 100644 --- a/path_8_6/data/spells/scripts/support/ultimate light.lua +++ b/path_8_6/data/spells/scripts/support/ultimate light.lua @@ -1,6 +1,6 @@ local combat = Combat() combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE) -combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0) +combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false) local condition = Condition(CONDITION_LIGHT) condition:setParameter(CONDITION_PARAM_LIGHT_LEVEL, 8) @@ -8,6 +8,6 @@ condition:setParameter(CONDITION_PARAM_LIGHT_COLOR, 215) condition:setParameter(CONDITION_PARAM_TICKS, (60 * 33 + 10) * 1000) combat:setCondition(condition) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/scripts/support/wild growth rune.lua b/path_8_6/data/spells/scripts/support/wild growth rune.lua index a15e27c7e..c22683de1 100644 --- a/path_8_6/data/spells/scripts/support/wild growth rune.lua +++ b/path_8_6/data/spells/scripts/support/wild growth rune.lua @@ -2,6 +2,6 @@ local combat = Combat() combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_EARTH) combat:setParameter(COMBAT_PARAM_CREATEITEM, ITEM_WILDGROWTH) -function onCastSpell(creature, var, isHotkey) - return combat:execute(creature, var) +function onCastSpell(creature, variant, isHotkey) + return combat:execute(creature, variant) end diff --git a/path_8_6/data/spells/spells.xml b/path_8_6/data/spells/spells.xml index 1a0e9f7c8..b2501475f 100644 --- a/path_8_6/data/spells/spells.xml +++ b/path_8_6/data/spells/spells.xml @@ -1,31 +1,75 @@ - + - + + + + + + + + + + + + + + + + + + + - + + + + + - + - + - + + + + + - + + + + + + + + + + + + + + + + + + + @@ -35,55 +79,65 @@ - + - - - + + + + + - + - + - + - + - + + + + + - + - + + + + + - + - + - + @@ -93,25 +147,29 @@ - + - + - + - + + + + + - + @@ -121,11 +179,11 @@ - + - + @@ -135,29 +193,41 @@ - + - + - + - + + + + + - + - + + + + + + + + + @@ -165,13 +235,23 @@ - + + + + + + + + + + + - + @@ -181,7 +261,7 @@ - + @@ -191,7 +271,7 @@ - + @@ -199,7 +279,19 @@ - + + + + + + + + + + + + + @@ -209,140 +301,210 @@ - + - + + + + + + + + + - + + + + + + + - + - + - + + + - + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + - + - + - + - + - + + + + + + + + + - + + + + + - + + + + + - + - + - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - + + + - - + + - - - - + + + + - + - + @@ -350,159 +512,174 @@ - + - + - + - + - + - + - + + + + + - + - + - + - + - + + + + - + + + - + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -510,7 +687,7 @@ - + @@ -518,44 +695,52 @@ - + - + + + + + - + - + - + - + + + + + - + - + - - - - + + + + diff --git a/path_8_6/data/talkactions/scripts/addon.lua b/path_8_6/data/talkactions/scripts/addon.lua new file mode 100644 index 000000000..50681a10a --- /dev/null +++ b/path_8_6/data/talkactions/scripts/addon.lua @@ -0,0 +1,181 @@ +local config = { + ["citizen"] = { + male = 128, + female = 136, + addon = 3, + items = { + {5878,100} + } + }, + ["hunter"] = { + male = 129, + female = 137, + addon = 3, + items = { + {5876, 100}, {5948, 100} + } + }, + ["mage"] = { + male = 130, + female = 138, + addon = 3, + items = { + {2160, 1000} + } + }, + ["knight"] = { + male = 131, + female = 139, + addon = 3, + items = { + {5880, 100}, {5893, 100} + } + }, + ["summoner"] = { + male = 133, + female = 141, + addon = 3, + items = { + {2160,1000} + } + }, + ["warrior"] = { + male = 134, + female = 142, + addon = 3, + items = { + {5925, 100}, {5899, 100}, {5919, 1}, {5880, 100} + } + }, + ["barbarian"] = { + male = 147, + female = 143, + addon = 3, + items = { + {5911, 50}, {5910, 50}, {5879, 100} + } + }, + ["druid"] = { + male = 148, + female = 144, + addon = 3, + items = { + {5896, 50}, {5897, 50} + } + }, + ["wizard"] = { + male = 149, + female = 145, + addon = 3, + items = { + {2536, 1}, {2492, 1}, {2488, 1}, {2123, 1}, {5922, 50} + } + }, + ["oriental"] = { + male = 150, + female = 146, + addon = 3, + items = { + {5883, 100}, {5895, 100}, {5912, 100} + } + }, + ["pirate"] = { + male = 151, + female = 155, + addon = 3, + items = { + {6098, 100}, {6126, 100}, {6097, 100} + } + }, + ["assassin"] = { + male = 152, + female = 156, + addon = 3, + items = { + {5898, 30}, {5882, 10}, {5881, 30}, {5895, 20}, {5905, 10} + } + }, + ["beggar"] = { + male = 153, + female = 157, + addon = 3, + items = { + {5878, 50}, {2743, 30}, {5913, 20}, {5894, 10} + } + }, + ["shaman"] = { + male = 154, + female = 158, + addon = 3, + items = { + {3955, 5}, {5810, 5}, {3966, 5}, {3967, 5} + } + }, + ["norseman"] = { + male = 251, + female = 252, + addon = 3, + items = { + {7290, 15} + } + }, + ["nightmare"] = { + male = 268, + female = 269, + addon = 3, + items = { + {6500, 200} + } + }, + ["jester"] = { + male = 273, + female = 270, + addon = 3, + items = { + {2160, 25} + } + }, + ["brotherhood"] = { + male = 278, + female = 279, + addon = 3, + items = { + {6500, 200} + } + } +} + +function onSay(player, words, param) + local v = config[param:lower()] + if not v then + return false + end + + local outfit = player:getSex() == PLAYERSEX_FEMALE and v["female"] or v["male"] + if player:hasOutfit(outfit, 3) then + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have already obtained the " .. param .. " addons.") + return false + end + + local text = "" + for i = 1, #v["items"] do + local itemType = ItemType(v["items"][i][1]) + text = text .. (i ~= 1 and (i == #v["items"] and " and " or ", ") or "") .. (v["items"][i][2] > 1 and v["items"][i][2] or itemType:getArticle()) .. " " .. (v["items"][i][2] > 1 and itemType:getPluralName() or itemType:getName()) + end + + for i = 1, #v["items"] do + if player:getItemCount(v["items"][i][1]) < v["items"][i][2] then + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You need " .. text .. " for the whole " .. param .. " outfit.") + return false + end + end + + for i = 1, #v["items"] do + player:removeItem(unpack(v["items"][i])) + end + player:addOutfitAddon(v["female"], 3) + player:addOutfitAddon(v["male"], 3) + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Enjoy your new addons to your " .. param .. " outfit!") + player:getPosition():sendMagicEffect(CONST_ME_FIREWORK_YELLOW) + return false +end diff --git a/path_8_6/data/talkactions/scripts/alladdons.lua b/path_8_6/data/talkactions/scripts/alladdons.lua new file mode 100644 index 000000000..255da61da --- /dev/null +++ b/path_8_6/data/talkactions/scripts/alladdons.lua @@ -0,0 +1,41 @@ +local looktypes = { + 128, 136, 129, 137, 130, 138, 131, 139, 132, 140, 133, 141, 134, 142, + 143, 147, 144, 148, 145, 149, 146, 150, 151, 155, 152, 156, 153, 157, + 154, 158, 251, 252, 268, 269, 273, 270, 278, 279, 289, 288, 325, 324, + 335, 336, 366, 367, 328, 329 +} + +function onSay(player, words, param) + if not player:getGroup():getAccess() then + return true + end + + local target + if param == '' then + target = player:getTarget() + if not target then + player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, 'Gives players the ability to wear all addons. Usage: /addons ') + return false + end + else + target = Player(param) + end + + if not target then + player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, 'Player ' .. param .. ' is currently not online.') + return false + end + + if player:getAccountType() < ACCOUNT_TYPE_GOD then + player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, 'Cannot perform action.') + return false + end + + for i = 1, #looktypes do + target:addOutfitAddon(looktypes[i], 3) + end + + player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, 'All addons unlocked for ' .. target:getName() .. '.') + target:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, '[Server] All addons unlocked.') + return false +end diff --git a/path_8_6/data/talkactions/scripts/allmounts.lua b/path_8_6/data/talkactions/scripts/allmounts.lua new file mode 100644 index 000000000..5e27a9dce --- /dev/null +++ b/path_8_6/data/talkactions/scripts/allmounts.lua @@ -0,0 +1,34 @@ +function onSay(player, words, param) + if not player:getGroup():getAccess() then + return true + end + + local target + if param == '' then + target = player:getTarget() + if not target then + player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, 'Unlocks all mounts for certain player. Usage: /mounts ') + return false + end + else + target = Player(param) + end + + if not target then + player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, 'Player ' .. param .. ' is not currently online.') + return false + end + + if player:getAccountType() < ACCOUNT_TYPE_GOD then + player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, 'Cannot perform action.') + return false + end + + for i = 1, 12 do + target:addMount(i) + end + + player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, 'All mounts unlocked for: ' .. target:getName()) + target:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, '[Server] All mounts unlocked.') + return false +end diff --git a/path_8_6/data/talkactions/scripts/animationeffect.lua b/path_8_6/data/talkactions/scripts/animationeffect.lua index 0ad31d0c1..ba55558ce 100644 --- a/path_8_6/data/talkactions/scripts/animationeffect.lua +++ b/path_8_6/data/talkactions/scripts/animationeffect.lua @@ -4,11 +4,6 @@ function onSay(player, words, param) end local effect = tonumber(param) - if not Game.hasDistanceEffect(effect) then - player:sendCancelMessage("Invalid effect id.") - return false - end - local position = player:getPosition() local toPositionLow = {z = position.z} local toPositionHigh = {z = position.z} diff --git a/path_8_6/data/talkactions/scripts/magiceffect.lua b/path_8_6/data/talkactions/scripts/magiceffect.lua index 8bc3024ec..ebc26b3ec 100644 --- a/path_8_6/data/talkactions/scripts/magiceffect.lua +++ b/path_8_6/data/talkactions/scripts/magiceffect.lua @@ -3,12 +3,6 @@ function onSay(player, words, param) return true end - local effect = tonumber(param) - if not Game.hasEffect(effect) then - player:sendCancelMessage("Invalid effect id.") - return false - end - player:getPosition():sendMagicEffect(tonumber(param)) return false end diff --git a/path_8_6/data/talkactions/scripts/save.lua b/path_8_6/data/talkactions/scripts/save.lua new file mode 100644 index 000000000..f1949517a --- /dev/null +++ b/path_8_6/data/talkactions/scripts/save.lua @@ -0,0 +1,19 @@ +local savingEvent = 0 + +function onSay(player, words, param) + if player:getGroup():getAccess() then + if isNumber(param) then + stopEvent(savingEvent) + save(tonumber(param) * 60 * 1000) + else + saveServer() + end + end +end + +function save(delay) + saveServer() + if delay > 0 then + savingEvent = addEvent(save, delay, delay) + end +end diff --git a/path_8_6/data/talkactions/scripts/teleport_to_pos.lua b/path_8_6/data/talkactions/scripts/teleport_to_pos.lua new file mode 100644 index 000000000..2b0f31a20 --- /dev/null +++ b/path_8_6/data/talkactions/scripts/teleport_to_pos.lua @@ -0,0 +1,27 @@ +function onSay(player, words, param) + if not player:getGroup():getAccess() then + return true + end + + if param == '' then + player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.") + return false + end + + local tile = param:split(",") + local pos + if tile[2] and tile[3] then + pos = Position(tile[1], tile[2], tile[3]) + else + player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Invalid param specified.") + return false + end + + local tmp = player:getPosition() + if player:teleportTo(pos) and not player:isInGhostMode() then + tmp:sendMagicEffect(CONST_ME_POFF) + pos:sendMagicEffect(CONST_ME_TELEPORT) + end + + return false +end diff --git a/path_8_6/data/talkactions/talkactions.xml b/path_8_6/data/talkactions/talkactions.xml index 486868cc9..ae85082af 100644 --- a/path_8_6/data/talkactions/talkactions.xml +++ b/path_8_6/data/talkactions/talkactions.xml @@ -33,6 +33,12 @@ + + + + + + @@ -44,7 +50,10 @@ - - - + diff --git a/path_8_6/data/weapons/scripts/burst_arrow.lua b/path_8_6/data/weapons/scripts/burst_arrow.lua new file mode 100644 index 000000000..eb8290173 --- /dev/null +++ b/path_8_6/data/weapons/scripts/burst_arrow.lua @@ -0,0 +1,17 @@ +local area = createCombatArea({ + {1, 1, 1}, + {1, 3, 1}, + {1, 1, 1} +}) + +local combat = Combat() +combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE) +combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_EXPLOSIONAREA) +combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_BURSTARROW) +combat:setParameter(COMBAT_PARAM_BLOCKARMOR, true) +combat:setFormula(COMBAT_FORMULA_SKILL, 0, 0, 1, 0) +combat:setArea(area) + +function onUseWeapon(player, variant) + return combat:execute(player, variant) +end diff --git a/path_8_6/data/weapons/scripts/explosive_arrow.lua b/path_8_6/data/weapons/scripts/explosive_arrow.lua deleted file mode 100644 index adc16b6f7..000000000 --- a/path_8_6/data/weapons/scripts/explosive_arrow.lua +++ /dev/null @@ -1,18 +0,0 @@ -local area = createCombatArea({ - {1, 1, 1}, - {1, 3, 1}, - {1, 1, 1} -}) - -local combat = Combat() -combat:setParameter(COMBAT_PARAM_BLOCKARMOR, 1) -combat:setParameter(COMBAT_PARAM_BLOCKSHIELD, 1) -combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE) -combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_FIREAREA) -combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_BURSTARROW) -combat:setFormula(COMBAT_FORMULA_SKILL, 1, 0, 1, 0) -combat:setArea(area) - -function onUseWeapon(player, var) - return combat:execute(player, var) -end diff --git a/path_8_6/data/weapons/scripts/poison_arrow.lua b/path_8_6/data/weapons/scripts/poison_arrow.lua index 6bdfd6b42..2e0f64a62 100644 --- a/path_8_6/data/weapons/scripts/poison_arrow.lua +++ b/path_8_6/data/weapons/scripts/poison_arrow.lua @@ -1,14 +1,16 @@ local combat = Combat() -combat:setParameter(COMBAT_PARAM_BLOCKARMOR, 1) -combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_POISONDAMAGE) +combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE) combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_POISONARROW) -combat:setFormula(COMBAT_FORMULA_SKILL, 1, 0, 1, 0) +combat:setParameter(COMBAT_PARAM_BLOCKARMOR, true) +combat:setFormula(COMBAT_FORMULA_SKILL, 0, 0, 1, 0) local condition = Condition(CONDITION_POISON) -condition:setParameter(CONDITION_PARAM_DELAYED, 1) -condition:addDamage(10, 2000, -1) +condition:setParameter(CONDITION_PARAM_DELAYED, true) +condition:addDamage(4, 4000, -3) +condition:addDamage(9, 4000, -2) +condition:addDamage(20, 4000, -1) combat:setCondition(condition) -function onUseWeapon(player, var) - return combat:execute(player, var) +function onUseWeapon(player, variant) + return combat:execute(player, variant) end diff --git a/path_8_6/data/weapons/scripts/viper_star.lua b/path_8_6/data/weapons/scripts/viper_star.lua index 78cea9dc1..023325818 100644 --- a/path_8_6/data/weapons/scripts/viper_star.lua +++ b/path_8_6/data/weapons/scripts/viper_star.lua @@ -1,28 +1,28 @@ local combat = Combat() -combat:setParameter(COMBAT_PARAM_BLOCKARMOR, 1) combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE) combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_GREENSTAR) -combat:setFormula(COMBAT_FORMULA_SKILL, 0, 0, 1.0, 0) +combat:setParameter(COMBAT_PARAM_BLOCKARMOR, true) +combat:setFormula(COMBAT_FORMULA_SKILL, 0, 0, 1, 0) local condition = Condition(CONDITION_POISON) -condition:setParameter(CONDITION_PARAM_DELAYED, 1) -condition:addDamage(4, 2000, -2) -condition:addDamage(6, 2000, -1) +condition:setParameter(CONDITION_PARAM_DELAYED, true) +condition:addDamage(10, 4000, -2) +condition:addDamage(20, 4000, -1) local secondCombat = Combat() secondCombat:setParameter(COMBAT_PARAM_TYPE, COMBAT_EARTHDAMAGE) secondCombat:setCondition(condition) -function onUseWeapon(player, var) - local boolean = combat:execute(player, var) +function onUseWeapon(player, variant) + local boolean = combat:execute(player, variant) if not boolean then return false end - local target = var:getNumber() + local target = variant:getNumber() if target ~= 0 then - if math.random(0, 100) > 90 then - boolean = secondCombat:execute(player, var) + if math.random(1, 100) > 90 then + boolean = secondCombat:execute(player, variant) end end return boolean diff --git a/path_8_6/data/weapons/weapons.xml b/path_8_6/data/weapons/weapons.xml index 63c882729..29b70851d 100644 --- a/path_8_6/data/weapons/weapons.xml +++ b/path_8_6/data/weapons/weapons.xml @@ -25,6 +25,15 @@ + + + + + + + + + @@ -51,6 +60,18 @@ + + + + + + + + + + + + @@ -146,6 +167,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -285,6 +336,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -409,6 +489,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -495,6 +608,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -504,20 +670,20 @@ - - - - - - - - + + + + + + + + - - - - - - - + + + + + + + diff --git a/path_8_6/src/actions.cpp b/path_8_6/src/actions.cpp index ffa1b232d..3be8d05e7 100644 --- a/path_8_6/src/actions.cpp +++ b/path_8_6/src/actions.cpp @@ -263,11 +263,7 @@ Action* Actions::getAction(const Item* item) } //rune items - Action* runeSpell = g_spells->getRuneSpell(item->getID()); - if (runeSpell) { - return runeSpell; - } - return nullptr; + return g_spells->getRuneSpell(item->getID()); } ReturnValue Actions::internalUseItem(Player* player, const Position& pos, uint8_t index, Item* item, bool isHotkey) diff --git a/path_8_6/src/chat.cpp b/path_8_6/src/chat.cpp index 12582dd83..1a4c03109 100644 --- a/path_8_6/src/chat.cpp +++ b/path_8_6/src/chat.cpp @@ -22,7 +22,6 @@ #include "chat.h" #include "game.h" #include "pugicast.h" -#include "player.h" #include "scheduler.h" extern Chat* g_chat; diff --git a/path_8_6/src/definitions.h b/path_8_6/src/definitions.h index 3f666626e..4f4326ad5 100644 --- a/path_8_6/src/definitions.h +++ b/path_8_6/src/definitions.h @@ -23,8 +23,8 @@ #define STATUS_SERVER_NAME "OTX Server" #define STATUS_SERVER_VERSION "3" #define MINOR_VERSION "2" -#define REVISION_VERSION "-" -#define SOFTWARE_CODENAME "The Second" +#define REVISION_VERSION "408" +#define SOFTWARE_CODENAME "PHANTOM" #define STATUS_SERVER_DEVELOPERS "Mattyx14 and TFS Developers" #define GIT_REPO "https://github.com/mattyx14/otxserver/" diff --git a/path_8_6/src/game.cpp b/path_8_6/src/game.cpp index 2575b066b..71f014f81 100644 --- a/path_8_6/src/game.cpp +++ b/path_8_6/src/game.cpp @@ -26,27 +26,15 @@ #include "creature.h" #include "monster.h" #include "game.h" -#include "tile.h" -#include "house.h" #include "actions.h" -#include "combat.h" #include "iologindata.h" -#include "chat.h" #include "talkaction.h" #include "spells.h" #include "configmanager.h" -#include "ban.h" -#include "raids.h" -#include "database.h" #include "server.h" -#include "ioguild.h" -#include "quests.h" #include "globalevent.h" #include "bed.h" #include "scheduler.h" -#include "monster.h" -#include "spawn.h" -#include "connection.h" #include "events.h" #include "databasetasks.h" @@ -1376,9 +1364,9 @@ Item* Game::findItemOfType(Cylinder* cylinder, uint16_t itemId, return item; } - Container* tmpContainer = item->getContainer(); - if (tmpContainer) { - containers.push_back(tmpContainer); + Container* subContainer = item->getContainer(); + if (subContainer) { + containers.push_back(subContainer); } } } @@ -1391,7 +1379,7 @@ bool Game::removeMoney(Cylinder* cylinder, uint32_t money, uint32_t flags /*= 0* return false; } - if (money <= 0) { + if (money == 0) { return true; } @@ -1446,50 +1434,52 @@ bool Game::removeMoney(Cylinder* cylinder, uint32_t money, uint32_t flags /*= 0* for (const auto& moneyEntry : moneyMap) { Item* item = moneyEntry.second; - if (moneyEntry.first > money) { + if (moneyEntry.first >= money) { uint32_t worth = moneyEntry.first / item->getItemCount(); uint32_t removeCount = (money / worth) + 1; addMoney(cylinder, (worth * removeCount) - money, flags); internalRemoveItem(item, removeCount); - money = 0; - } else { - internalRemoveItem(item); - money -= moneyEntry.first; - } - - if (money == 0) { return true; } + + internalRemoveItem(item); + money -= moneyEntry.first; } return false; } void Game::addMoney(Cylinder* cylinder, uint32_t money, uint32_t flags /*= 0*/) { - uint32_t crys = money / 10000; - money -= crys * 10000; - while (crys > 0) { - Item* remaindItem = Item::CreateItem(ITEM_CRYSTAL_COIN, std::min(100, crys)); + if (money == 0) { + return; + } + + uint32_t crystalCoins = money / 10000; + money -= crystalCoins * 10000; + while (crystalCoins > 0) { + const uint16_t count = std::min(100, crystalCoins); + + Item* remaindItem = Item::CreateItem(ITEM_CRYSTAL_COIN, count); ReturnValue ret = internalAddItem(cylinder, remaindItem, INDEX_WHEREEVER, flags); if (ret != RETURNVALUE_NOERROR) { internalAddItem(cylinder->getTile(), remaindItem, INDEX_WHEREEVER, FLAG_NOLIMIT); } - crys -= std::min(100, crys); + crystalCoins -= count; } - uint16_t plat = money / 100; - if (plat != 0) { - Item* remaindItem = Item::CreateItem(ITEM_PLATINUM_COIN, plat); + uint16_t platinumCoins = money / 100; + if (platinumCoins != 0) { + Item* remaindItem = Item::CreateItem(ITEM_PLATINUM_COIN, platinumCoins); ReturnValue ret = internalAddItem(cylinder, remaindItem, INDEX_WHEREEVER, flags); if (ret != RETURNVALUE_NOERROR) { internalAddItem(cylinder->getTile(), remaindItem, INDEX_WHEREEVER, FLAG_NOLIMIT); } - money -= plat * 100; + money -= platinumCoins * 100; } if (money != 0) { diff --git a/path_8_6/src/iomapserialize.cpp b/path_8_6/src/iomapserialize.cpp index d4390b0dd..dddd4d696 100644 --- a/path_8_6/src/iomapserialize.cpp +++ b/path_8_6/src/iomapserialize.cpp @@ -20,7 +20,6 @@ #include "otpch.h" #include "iomapserialize.h" -#include "house.h" #include "game.h" #include "bed.h" diff --git a/path_8_6/src/item.cpp b/path_8_6/src/item.cpp index f28c5c6d2..3b0eae63b 100644 --- a/path_8_6/src/item.cpp +++ b/path_8_6/src/item.cpp @@ -26,13 +26,14 @@ #include "mailbox.h" #include "house.h" #include "game.h" -#include "luascript.h" #include "bed.h" #include "actions.h" -#include "combat.h" +#include "spells.h" extern Game g_game; +extern Spells* g_spells; +extern Vocations g_vocations; Items Item::items; @@ -814,32 +815,57 @@ std::string Item::getDescription(const ItemType& it, int32_t lookDistance, } if (it.isRune()) { - if (!it.runeSpellName.empty()) { - s << " (\"" << it.runeSpellName << "\")"; - } - if (it.runeLevel > 0 || it.runeMagLevel > 0) { - int32_t tmpSubType = subType; + if (RuneSpell* rune = g_spells->getRuneSpell(it.id)) { + int32_t tmpSubType = subType; + if (item) { + tmpSubType = item->getSubType(); + } + s << ". " << (it.stackable && tmpSubType > 1 ? "They" : "It") << " can only be used by "; - if (item) { - tmpSubType = item->getSubType(); - } + const VocSpellMap& vocMap = rune->getVocMap(); + std::vector showVocMap; - s << ". " << (it.stackable && tmpSubType > 1 ? "They" : "It") << " can only be used with"; + // vocations are usually listed with the unpromoted and promoted version, the latter being + // hidden from description, so `total / 2` is most likely the amount of vocations to be shown. + showVocMap.reserve(vocMap.size() / 2); + for (const auto& voc : vocMap) { + if (voc.second) { + showVocMap.push_back(g_vocations.getVocation(voc.first)); + } + } - if (it.runeLevel > 0) { - s << " level " << it.runeLevel; - } + if (!showVocMap.empty()) { + auto vocIt = showVocMap.begin(), vocLast = (showVocMap.end() - 1); + while (vocIt != vocLast) { + s << asLowerCaseString((*vocIt)->getVocName()) << "s"; + if (++vocIt == vocLast) { + s << " and "; + } else { + s << ", "; + } + } + s << asLowerCaseString((*vocLast)->getVocName()) << "s"; + } else { + s << "players"; + } + + s << " with"; - if (it.runeMagLevel > 0) { if (it.runeLevel > 0) { - s << " and"; + s << " level " << it.runeLevel; } - s << " magic level " << it.runeMagLevel; - } + if (it.runeMagLevel > 0) { + if (it.runeLevel > 0) { + s << " and"; + } - s << " or higher"; + s << " magic level " << it.runeMagLevel; + } + + s << " or higher"; + } } } else if (it.weaponType != WEAPON_NONE) { if (it.weaponType == WEAPON_DISTANCE && it.ammoType != AMMO_NONE) { @@ -1327,7 +1353,7 @@ std::string Item::getDescription(const ItemType& it, int32_t lookDistance, s << "premium "; } - if (it.wieldInfo & WIELDINFO_VOCREQ) { + if (!it.vocationString.empty()) { s << it.vocationString; } else { s << "players"; diff --git a/path_8_6/src/items.cpp b/path_8_6/src/items.cpp index afe94c7bf..6f5cf76a3 100644 --- a/path_8_6/src/items.cpp +++ b/path_8_6/src/items.cpp @@ -948,6 +948,14 @@ void Items::parseItemNode(const pugi::xml_node& itemNode, uint16_t id) Abilities& abilities = it.getAbilities(); abilities.elementDamage = pugi::cast(valueAttribute.value()); abilities.elementType = COMBAT_ENERGYDAMAGE; + } else if (tmpStrValue == "elementdeath") { + Abilities& abilities = it.getAbilities(); + abilities.elementDamage = pugi::cast(valueAttribute.value()); + abilities.elementType = COMBAT_DEATHDAMAGE; + } else if (tmpStrValue == "elementholy") { + Abilities& abilities = it.getAbilities(); + abilities.elementDamage = pugi::cast(valueAttribute.value()); + abilities.elementType = COMBAT_HOLYDAMAGE; } else if (tmpStrValue == "walkstack") { it.walkStack = valueAttribute.as_bool(); } else if (tmpStrValue == "blocking") { diff --git a/path_8_6/src/luascript.cpp b/path_8_6/src/luascript.cpp index f9a9aee06..1157cbf5a 100644 --- a/path_8_6/src/luascript.cpp +++ b/path_8_6/src/luascript.cpp @@ -1905,6 +1905,7 @@ void LuaScriptInterface::registerFunctions() registerMethod("Item", "getAttribute", LuaScriptInterface::luaItemGetAttribute); registerMethod("Item", "setAttribute", LuaScriptInterface::luaItemSetAttribute); registerMethod("Item", "removeAttribute", LuaScriptInterface::luaItemRemoveAttribute); + registerMethod("Item", "serializeAttributes", LuaScriptInterface::luaItemSerializeAttributes); registerMethod("Item", "moveTo", LuaScriptInterface::luaItemMoveTo); registerMethod("Item", "transform", LuaScriptInterface::luaItemTransform); @@ -5918,6 +5919,24 @@ int LuaScriptInterface::luaItemRemoveAttribute(lua_State* L) return 1; } +int LuaScriptInterface::luaItemSerializeAttributes(lua_State* L) +{ + // item:serializeAttributes() + Item* item = getUserdata(L, 1); + if (!item) { + lua_pushnil(L); + return 1; + } + + PropWriteStream propWriteStream; + item->serializeAttr(propWriteStream); + + size_t attributesSize; + const char* attributes = propWriteStream.getStream(attributesSize); + lua_pushlstring(L, attributes, attributesSize); + return 1; +} + int LuaScriptInterface::luaItemMoveTo(lua_State* L) { // item:moveTo(position or cylinder) @@ -10535,14 +10554,21 @@ int LuaScriptInterface::luaCombatCreate(lua_State* L) int LuaScriptInterface::luaCombatSetParameter(lua_State* L) { // combat:setParameter(key, value) - uint32_t value = getNumber(L, 3); - CombatParam_t key = getNumber(L, 2); Combat* combat = getUserdata(L, 1); - if (combat) { - pushBoolean(L, combat->setParam(key, value)); - } else { + if (!combat) { lua_pushnil(L); + return 1; } + + CombatParam_t key = getNumber(L, 2); + uint32_t value; + if (isBoolean(L, 3)) { + value = getBoolean(L, 3) ? 1 : 0; + } else { + value = getNumber(L, 3); + } + combat->setParam(key, value); + pushBoolean(L, true); return 1; } diff --git a/path_8_6/src/luascript.h b/path_8_6/src/luascript.h index d770957a9..44e62b0a5 100644 --- a/path_8_6/src/luascript.h +++ b/path_8_6/src/luascript.h @@ -358,7 +358,7 @@ class LuaScriptInterface // Is inline static bool isNumber(lua_State* L, int32_t arg) { - return lua_isnumber(L, arg) != 0; + return lua_type(L, arg) == LUA_TNUMBER; } inline static bool isString(lua_State* L, int32_t arg) { @@ -693,6 +693,7 @@ class LuaScriptInterface static int luaItemGetAttribute(lua_State* L); static int luaItemSetAttribute(lua_State* L); static int luaItemRemoveAttribute(lua_State* L); + static int luaItemSerializeAttributes(lua_State* L); static int luaItemMoveTo(lua_State* L); static int luaItemTransform(lua_State* L); diff --git a/path_8_6/src/monster.cpp b/path_8_6/src/monster.cpp index e9368f84c..ae603cb34 100644 --- a/path_8_6/src/monster.cpp +++ b/path_8_6/src/monster.cpp @@ -608,7 +608,7 @@ BlockType_t Monster::blockHit(Creature* attacker, CombatType_t combatType, int32 damage = static_cast(std::ceil(damage * ((100 - elementMod) / 100.))); if (damage <= 0) { damage = 0; - blockType = BLOCK_DEFENSE; + blockType = BLOCK_ARMOR; } } } diff --git a/path_8_6/src/networkmessage.cpp b/path_8_6/src/networkmessage.cpp index bfb812f70..531ed872b 100644 --- a/path_8_6/src/networkmessage.cpp +++ b/path_8_6/src/networkmessage.cpp @@ -23,10 +23,6 @@ #include "container.h" #include "creature.h" -#include "player.h" - -#include "position.h" -#include "rsa.h" int32_t NetworkMessage::decodeHeader() { diff --git a/path_8_6/src/npc.cpp b/path_8_6/src/npc.cpp index 6e60e0e34..24980ccf4 100644 --- a/path_8_6/src/npc.cpp +++ b/path_8_6/src/npc.cpp @@ -21,12 +21,7 @@ #include "npc.h" #include "game.h" -#include "tools.h" -#include "position.h" -#include "player.h" -#include "spawn.h" #include "pugicast.h" -#include "luascript.h" extern Game g_game; extern LuaEnvironment g_luaEnvironment; diff --git a/path_8_6/src/player.cpp b/path_8_6/src/player.cpp index a820d84bc..77376539a 100644 --- a/path_8_6/src/player.cpp +++ b/path_8_6/src/player.cpp @@ -31,7 +31,6 @@ #include "iologindata.h" #include "monster.h" #include "movement.h" -#include "outputmessage.h" #include "scheduler.h" #include "weapons.h" @@ -1910,7 +1909,7 @@ BlockType_t Player::blockHit(Creature* attacker, CombatType_t combatType, int32_ if (damage <= 0) { damage = 0; - blockType = BLOCK_DEFENSE; + blockType = BLOCK_ARMOR; } } return blockType; diff --git a/path_8_6/src/protocolold.cpp b/path_8_6/src/protocolold.cpp index a68e857b2..319f40247 100644 --- a/path_8_6/src/protocolold.cpp +++ b/path_8_6/src/protocolold.cpp @@ -21,7 +21,6 @@ #include "protocolold.h" #include "outputmessage.h" -#include "tasks.h" #include "game.h" diff --git a/path_8_6/src/protocolstatus.cpp b/path_8_6/src/protocolstatus.cpp index 18e517acf..afb1a722b 100644 --- a/path_8_6/src/protocolstatus.cpp +++ b/path_8_6/src/protocolstatus.cpp @@ -22,11 +22,7 @@ #include "protocolstatus.h" #include "configmanager.h" #include "game.h" -#include "connection.h" -#include "networkmessage.h" #include "outputmessage.h" -#include "tools.h" -#include "tasks.h" extern ConfigManager g_config; extern Game g_game; diff --git a/path_8_6/src/rsa.cpp b/path_8_6/src/rsa.cpp index dadb42d88..32d77e690 100644 --- a/path_8_6/src/rsa.cpp +++ b/path_8_6/src/rsa.cpp @@ -72,7 +72,7 @@ void RSA::setKey(const char* pString, const char* qString) mpz_clear(e); } -void RSA::decrypt(char* msg) const +void RSA::decrypt(char* msg) const { mpz_t c, m; mpz_init2(c, 1024); diff --git a/path_8_6/src/server.cpp b/path_8_6/src/server.cpp index 4140e6515..3fb3f6126 100644 --- a/path_8_6/src/server.cpp +++ b/path_8_6/src/server.cpp @@ -28,7 +28,7 @@ extern ConfigManager g_config; Ban g_bans; -ServiceManager::ServiceManager(): +ServiceManager::ServiceManager(): death_timer(io_service), running(false) { diff --git a/path_8_6/src/spells.cpp b/path_8_6/src/spells.cpp index 0e81aee18..4378d53e5 100644 --- a/path_8_6/src/spells.cpp +++ b/path_8_6/src/spells.cpp @@ -557,11 +557,8 @@ bool Spell::configureSpell(const pugi::xml_node& node) int32_t vocationId = g_vocations.getVocationId(attr.as_string()); if (vocationId != -1) { - vocSpellMap[vocationId] = true; - int32_t promotedVocation = g_vocations.getPromotedVocation(vocationId); - if (promotedVocation != VOCATION_NONE) { - vocSpellMap[promotedVocation] = true; - } + attr = vocationNode.attribute("showInDescription"); + vocSpellMap[vocationId] = !attr || attr.as_bool(); } else { std::cout << "[Warning - Spell::configureSpell] Wrong vocation name: " << attr.as_string() << std::endl; } @@ -1985,4 +1982,4 @@ bool RuneSpell::executeCastSpell(Creature* creature, const LuaVariant& var, bool LuaScriptInterface::pushBoolean(L, isHotkey); return m_scriptInterface->callFunction(3); -} \ No newline at end of file +} diff --git a/path_8_6/src/tile.cpp b/path_8_6/src/tile.cpp index f05240d16..57e518ffa 100644 --- a/path_8_6/src/tile.cpp +++ b/path_8_6/src/tile.cpp @@ -29,7 +29,6 @@ #include "mailbox.h" #include "monster.h" #include "movement.h" -#include "player.h" #include "teleport.h" #include "trashholder.h" diff --git a/path_8_6/vc14/theforgottenserver.sln b/path_8_6/vc14/theforgottenserver.sln index 4de22538c..4c37956c6 100644 --- a/path_8_6/vc14/theforgottenserver.sln +++ b/path_8_6/vc14/theforgottenserver.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2013 -VisualStudioVersion = 12.0.21005.1 +# Visual Studio 14 +VisualStudioVersion = 14.0.23107.0 MinimumVisualStudioVersion = 10.0.40219.1 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "theforgottenserver", "theforgottenserver.vcxproj", "{A10F9657-129F-0FEF-14CB-CEE0B0E5AA3E}" EndProject diff --git a/path_8_7/.gitignore b/path_8_7/.gitignore index bf2b4e1e8..5400463dd 100644 --- a/path_8_7/.gitignore +++ b/path_8_7/.gitignore @@ -52,6 +52,7 @@ ipch/ *.aps *.ncb *.opensdf +*.opendb *.sdf *.cachefile diff --git a/path_8_7/.travis.yml b/path_8_7/.travis.yml index b8b231469..571f37424 100644 --- a/path_8_7/.travis.yml +++ b/path_8_7/.travis.yml @@ -1,12 +1,22 @@ +sudo: required +dist: trusty language: cpp -compiler: gcc +compiler: + - clang + - gcc +env: + - LUAJIT=OFF + - LUAJIT=ON cache: apt -before_install: - - sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y - - sudo add-apt-repository ppa:apokluda/boost1.53 -y - - sudo apt-get update -qq - - if [ "$CXX" = "g++" ]; then sudo apt-get install -qq g++-4.8; fi - - if [ "$CXX" = "g++" ]; then export CXX="g++-4.8" CC="gcc-4.8"; fi -install: sudo apt-get install libboost1.53-dev libboost-system1.53-dev liblua5.2-dev libgmp3-dev libmysqlclient-dev -before_script: mkdir build && cd build && cmake -DCMAKE_BUILD_TYPE=Release .. -script: make +addons: + apt: + packages: + - libboost-dev + - libboost-system-dev + - liblua5.2-dev + - libluajit-5.1-dev + - libmysqlclient-dev +before_script: + - mkdir build && cd build + - cmake -DCMAKE_BUILD_TYPE=Release -DUSE_LUAJIT=${LUAJIT} .. +script: make -j2 diff --git a/path_8_7/CMakeLists.txt b/path_8_7/CMakeLists.txt index a70e66b46..0044b0cde 100644 --- a/path_8_7/CMakeLists.txt +++ b/path_8_7/CMakeLists.txt @@ -24,12 +24,14 @@ include(FindCXX11) # Find packages. find_package(GMP REQUIRED) -find_package(MySQL) find_package(LuaJIT) +find_package(MySQL) find_package(Threads) -if (LUAJIT_FOUND) - add_definitions(-D__LUAJIT__) +option(USE_LUAJIT "Use LuaJIT" ${LUAJIT_FOUND}) + +if(USE_LUAJIT) + find_package(LuaJIT REQUIRED) if(APPLE) set(CMAKE_EXE_LINKER_FLAGS "-pagezero_size 10000 -image_base 100000000") endif() diff --git a/path_8_7/cmake/cotire.cmake b/path_8_7/cmake/cotire.cmake index 33703a559..a4fb533c6 100644 --- a/path_8_7/cmake/cotire.cmake +++ b/path_8_7/cmake/cotire.cmake @@ -3,7 +3,7 @@ # See the cotire manual for usage hints. # #============================================================================= -# Copyright 2012-2014 Sascha Kratky +# Copyright 2012-2015 Sascha Kratky # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation @@ -37,61 +37,78 @@ set(__COTIRE_INCLUDED TRUE) if (NOT CMAKE_SCRIPT_MODE_FILE) cmake_policy(PUSH) endif() -# we need the CMake variables CMAKE_SCRIPT_MODE_FILE and CMAKE_ARGV available since 2.8.5 -# we need APPEND_STRING option for set_property available since 2.8.6 -cmake_minimum_required(VERSION 2.8.6) +cmake_minimum_required(VERSION 2.8.12) if (NOT CMAKE_SCRIPT_MODE_FILE) cmake_policy(POP) endif() -if (NOT CMAKE_VERSION VERSION_LESS "3.1.0") +set (COTIRE_CMAKE_MODULE_FILE "${CMAKE_CURRENT_LIST_FILE}") +set (COTIRE_CMAKE_MODULE_VERSION "1.7.6") + +# activate select policies +if (POLICY CMP0025) + # Compiler id for Apple Clang is now AppleClang + cmake_policy(SET CMP0025 NEW) +endif() + +if (POLICY CMP0026) + # disallow use of the LOCATION target property + cmake_policy(SET CMP0026 NEW) +endif() + +if (POLICY CMP0038) + # targets may not link directly to themselves + cmake_policy(SET CMP0038 NEW) +endif() + +if (POLICY CMP0039) + # utility targets may not have link dependencies + cmake_policy(SET CMP0039 NEW) +endif() + +if (POLICY CMP0040) + # target in the TARGET signature of add_custom_command() must exist + cmake_policy(SET CMP0040 NEW) +endif() + +if (POLICY CMP0045) + # error on non-existent target in get_target_property + cmake_policy(SET CMP0045 NEW) +endif() + +if (POLICY CMP0046) + # error on non-existent dependency in add_dependencies + cmake_policy(SET CMP0046 NEW) +endif() + +if (POLICY CMP0049) + # do not expand variables in target source entries + cmake_policy(SET CMP0049 NEW) +endif() + +if (POLICY CMP0050) + # disallow add_custom_command SOURCE signatures + cmake_policy(SET CMP0050 NEW) +endif() + +if (POLICY CMP0051) # include TARGET_OBJECTS expressions in a target's SOURCES property cmake_policy(SET CMP0051 NEW) +endif() + +if (POLICY CMP0053) + # simplify variable reference and escape sequence evaluation + cmake_policy(SET CMP0053 NEW) +endif() + +if (POLICY CMP0054) # only interpret if() arguments as variables or keywords when unquoted cmake_policy(SET CMP0054 NEW) endif() -set (COTIRE_CMAKE_MODULE_FILE "${CMAKE_CURRENT_LIST_FILE}") -set (COTIRE_CMAKE_MODULE_VERSION "1.6.9") - include(CMakeParseArguments) include(ProcessorCount) -function (cotire_determine_compiler_version _language _versionPrefix) - if (NOT ${_versionPrefix}_VERSION) - # use CMake's predefined compiler version variable (available since CMake 2.8.8) - if (DEFINED CMAKE_${_language}_COMPILER_VERSION) - set (${_versionPrefix}_VERSION "${CMAKE_${_language}_COMPILER_VERSION}") - elseif (WIN32) - # cl.exe messes with the output streams unless the environment variable VS_UNICODE_OUTPUT is cleared - unset (ENV{VS_UNICODE_OUTPUT}) - string (STRIP "${CMAKE_${_language}_COMPILER_ARG1}" _compilerArg1) - execute_process ( - COMMAND ${CMAKE_${_language}_COMPILER} ${_compilerArg1} - ERROR_VARIABLE _versionLine OUTPUT_QUIET TIMEOUT 10) - string (REGEX REPLACE ".*Version *([0-9]+(\\.[0-9]+)*).*" "\\1" ${_versionPrefix}_VERSION "${_versionLine}") - else() - # assume GCC like command line interface - string (STRIP "${CMAKE_${_language}_COMPILER_ARG1}" _compilerArg1) - execute_process ( - COMMAND ${CMAKE_${_language}_COMPILER} ${_compilerArg1} "-dumpversion" - OUTPUT_VARIABLE ${_versionPrefix}_VERSION - RESULT_VARIABLE _result - OUTPUT_STRIP_TRAILING_WHITESPACE TIMEOUT 10) - if (_result) - set (${_versionPrefix}_VERSION "") - endif() - endif() - if (${_versionPrefix}_VERSION) - set (${_versionPrefix}_VERSION "${${_versionPrefix}_VERSION}" CACHE INTERNAL "${_language} compiler version") - endif() - set (${_versionPrefix}_VERSION "${${_versionPrefix}_VERSION}" PARENT_SCOPE) - if (COTIRE_DEBUG) - message (STATUS "${CMAKE_${_language}_COMPILER} version ${${_versionPrefix}_VERSION}") - endif() - endif() -endfunction() - function (cotire_get_configuration_types _configsVar) set (_configs "") if (CMAKE_CONFIGURATION_TYPES) @@ -134,10 +151,7 @@ macro (cotire_check_is_path_relative_to _path _isRelativeVar) endif() endmacro() -function (cotire_filter_language_source_files _language _sourceFilesVar _excludedSourceFilesVar _cotiredSourceFilesVar) - set (_sourceFiles "") - set (_excludedSourceFiles "") - set (_cotiredSourceFiles "") +function (cotire_filter_language_source_files _language _target _sourceFilesVar _excludedSourceFilesVar _cotiredSourceFilesVar) if (CMAKE_${_language}_SOURCE_FILE_EXTENSIONS) set (_languageExtensions "${CMAKE_${_language}_SOURCE_FILE_EXTENSIONS}") else() @@ -153,9 +167,13 @@ function (cotire_filter_language_source_files _language _sourceFilesVar _exclude else() set (_excludeExtensions "") endif() - if (COTIRE_DEBUG) + if (COTIRE_DEBUG AND _languageExtensions) message (STATUS "${_language} source file extensions: ${_languageExtensions}") + endif() + if (COTIRE_DEBUG AND _ignoreExtensions) message (STATUS "${_language} ignore extensions: ${_ignoreExtensions}") + endif() + if (COTIRE_DEBUG AND _excludeExtensions) message (STATUS "${_language} exclude extensions: ${_excludeExtensions}") endif() if (CMAKE_VERSION VERSION_LESS "3.1.0") @@ -166,12 +184,12 @@ function (cotire_filter_language_source_files _language _sourceFilesVar _exclude # through generator expressions at configure time, we filter them out string (GENEX_STRIP "${ARGN}" _allSourceFiles) endif() + set (_filteredSourceFiles "") + set (_excludedSourceFiles "") foreach (_sourceFile ${_allSourceFiles}) get_source_file_property(_sourceIsHeaderOnly "${_sourceFile}" HEADER_FILE_ONLY) get_source_file_property(_sourceIsExternal "${_sourceFile}" EXTERNAL_OBJECT) get_source_file_property(_sourceIsSymbolic "${_sourceFile}" SYMBOLIC) - get_source_file_property(_sourceLanguage "${_sourceFile}" LANGUAGE) - set (_sourceIsFiltered FALSE) if (NOT _sourceIsHeaderOnly AND NOT _sourceIsExternal AND NOT _sourceIsSymbolic) cotire_get_source_file_extension("${_sourceFile}" _sourceExt) if (_sourceExt) @@ -183,28 +201,37 @@ function (cotire_filter_language_source_files _language _sourceFilesVar _exclude else() list (FIND _languageExtensions "${_sourceExt}" _sourceIndex) if (_sourceIndex GREATER -1) - set (_sourceIsFiltered TRUE) - elseif ("${_sourceLanguage}" STREQUAL "${_language}") - # add to excluded sources, if file is not ignored and has correct language without having the correct extension - list (APPEND _excludedSourceFiles "${_sourceFile}") + # consider source file unless it is excluded explicitly + get_source_file_property(_sourceIsExcluded "${_sourceFile}" COTIRE_EXCLUDED) + if (_sourceIsExcluded) + list (APPEND _excludedSourceFiles "${_sourceFile}") + else() + list (APPEND _filteredSourceFiles "${_sourceFile}") + endif() + else() + get_source_file_property(_sourceLanguage "${_sourceFile}" LANGUAGE) + if ("${_sourceLanguage}" STREQUAL "${_language}") + # add to excluded sources, if file is not ignored and has correct language without having the correct extension + list (APPEND _excludedSourceFiles "${_sourceFile}") + endif() endif() endif() endif() endif() endif() - if (COTIRE_DEBUG) - message (STATUS "${_sourceFile} filtered=${_sourceIsFiltered} language=${_sourceLanguage} header=${_sourceIsHeaderOnly}") - endif() - if (_sourceIsFiltered) - get_source_file_property(_sourceIsExcluded "${_sourceFile}" COTIRE_EXCLUDED) - get_source_file_property(_sourceIsCotired "${_sourceFile}" COTIRE_TARGET) + endforeach() + # separate filtered source files from already cotired ones + # the COTIRE_TARGET property of a source file may be set while a target is being processed by cotire + set (_sourceFiles "") + set (_cotiredSourceFiles "") + foreach (_sourceFile ${_filteredSourceFiles}) + get_source_file_property(_sourceIsCotired "${_sourceFile}" COTIRE_TARGET) + if (_sourceIsCotired) + list (APPEND _cotiredSourceFiles "${_sourceFile}") + else() get_source_file_property(_sourceCompileFlags "${_sourceFile}" COMPILE_FLAGS) - if (COTIRE_DEBUG) - message (STATUS "${_sourceFile} excluded=${_sourceIsExcluded} cotired=${_sourceIsCotired} compileFlags=${_sourceCompileFlags}") - endif() - if (_sourceIsCotired) - list (APPEND _cotiredSourceFiles "${_sourceFile}") - elseif (_sourceIsExcluded OR _sourceCompileFlags) + if (_sourceCompileFlags) + # add to excluded sources, if file has custom compile flags list (APPEND _excludedSourceFiles "${_sourceFile}") else() list (APPEND _sourceFiles "${_sourceFile}") @@ -212,10 +239,15 @@ function (cotire_filter_language_source_files _language _sourceFilesVar _exclude endif() endforeach() if (COTIRE_DEBUG) - message (STATUS "All: ${ARGN}") - message (STATUS "${_language}: ${_sourceFiles}") - message (STATUS "Excluded: ${_excludedSourceFiles}") - message (STATUS "Cotired: ${_cotiredSourceFiles}") + if (_sourceFiles) + message (STATUS "Filtered ${_target} ${_language} sources: ${_sourceFiles}") + endif() + if (_excludedSourceFiles) + message (STATUS "Excluded ${_target} ${_language} sources: ${_excludedSourceFiles}") + endif() + if (_cotiredSourceFiles) + message (STATUS "Cotired ${_target} ${_language} sources: ${_cotiredSourceFiles}") + endif() endif() set (${_sourceFilesVar} ${_sourceFiles} PARENT_SCOPE) set (${_excludedSourceFilesVar} ${_excludedSourceFiles} PARENT_SCOPE) @@ -288,26 +320,27 @@ function (cotire_copy_set_properites _configurations _type _source _target) endforeach() endfunction() -function (cotire_get_target_link_libraries_for_usage_requirements _target _targetLinkLibrariesVar) - set (_targetLinkLibraries "") +function (cotire_get_target_usage_requirements _target _targetRequirementsVar) + set (_targetRequirements "") get_target_property(_librariesToProcess ${_target} LINK_LIBRARIES) while (_librariesToProcess) # remove from head list (GET _librariesToProcess 0 _library) list (REMOVE_AT _librariesToProcess 0) - list (FIND _targetLinkLibraries ${_library} _index) - if (_index LESS 0) - list (APPEND _targetLinkLibraries ${_library}) - # process transitive libraries - if (TARGET ${_library}) + if (TARGET ${_library}) + list (FIND _targetRequirements ${_library} _index) + if (_index LESS 0) + list (APPEND _targetRequirements ${_library}) + # process transitive libraries get_target_property(_libraries ${_library} INTERFACE_LINK_LIBRARIES) if (_libraries) list (APPEND _librariesToProcess ${_libraries}) + list (REMOVE_DUPLICATES _librariesToProcess) endif() endif() endif() endwhile() - set (${_targetLinkLibrariesVar} ${_targetLinkLibraries} PARENT_SCOPE) + set (${_targetRequirementsVar} ${_targetRequirements} PARENT_SCOPE) endfunction() function (cotire_filter_compile_flags _language _flagFilter _matchedOptionsVar _unmatchedOptionsVar) @@ -346,20 +379,17 @@ function (cotire_filter_compile_flags _language _flagFilter _matchedOptionsVar _ if (_optionFlag) list (APPEND _matchedOptions "${_optionFlag}") endif() - if (COTIRE_DEBUG) - message (STATUS "Filter ${_flagFilter}") - if (_matchedOptions) - message (STATUS "Matched ${_matchedOptions}") - endif() - if (_unmatchedOptions) - message (STATUS "Unmatched ${_unmatchedOptions}") - endif() + if (COTIRE_DEBUG AND _matchedOptions) + message (STATUS "Filter ${_flagFilter} matched: ${_matchedOptions}") + endif() + if (COTIRE_DEBUG AND _unmatchedOptions) + message (STATUS "Filter ${_flagFilter} unmatched: ${_unmatchedOptions}") endif() set (${_matchedOptionsVar} ${_matchedOptions} PARENT_SCOPE) set (${_unmatchedOptionsVar} ${_unmatchedOptions} PARENT_SCOPE) endfunction() -function (cotire_get_target_compile_flags _config _language _directory _target _flagsVar) +function (cotire_get_target_compile_flags _config _language _target _flagsVar) string (TOUPPER "${_config}" _upperConfig) # collect options from CMake language variables set (_compileFlags "") @@ -370,67 +400,11 @@ function (cotire_get_target_compile_flags _config _language _directory _target _ set (_compileFlags "${_compileFlags} ${CMAKE_${_language}_FLAGS_${_upperConfig}}") endif() if (_target) - # add option from CMake target type variable - get_target_property(_targetType ${_target} TYPE) - if (POLICY CMP0018) - # handle POSITION_INDEPENDENT_CODE property introduced with CMake 2.8.9 if policy CMP0018 is turned on - cmake_policy(GET CMP0018 _PIC_Policy) - else() - # default to old behavior - set (_PIC_Policy "OLD") - endif() - if (COTIRE_DEBUG) - message(STATUS "CMP0018=${_PIC_Policy}") - endif() - if (_PIC_Policy STREQUAL "NEW") - # NEW behavior: honor the POSITION_INDEPENDENT_CODE target property - get_target_property(_targetPIC ${_target} POSITION_INDEPENDENT_CODE) - if (_targetPIC) - if (_targetType STREQUAL "EXECUTABLE" AND CMAKE_${_language}_COMPILE_OPTIONS_PIE) - set (_compileFlags "${_compileFlags} ${CMAKE_${_language}_COMPILE_OPTIONS_PIE}") - elseif (CMAKE_${_language}_COMPILE_OPTIONS_PIC) - set (_compileFlags "${_compileFlags} ${CMAKE_${_language}_COMPILE_OPTIONS_PIC}") - endif() - endif() - else() - # OLD behavior or policy not set: use the value of CMAKE_SHARED_LIBRARY__FLAGS - if (_targetType STREQUAL "MODULE_LIBRARY") - # flags variable for module library uses different name SHARED_MODULE - # (e.g., CMAKE_SHARED_MODULE_C_FLAGS) - set (_targetType SHARED_MODULE) - endif() - if (CMAKE_${_targetType}_${_language}_FLAGS) - set (_compileFlags "${_compileFlags} ${CMAKE_${_targetType}_${_language}_FLAGS}") - endif() - endif() - endif() - if (_directory) - # add_definitions may have been used to add flags to the compiler command - get_directory_property(_dirDefinitions DIRECTORY "${_directory}" DEFINITIONS) - if (_dirDefinitions) - set (_compileFlags "${_compileFlags} ${_dirDefinitions}") - endif() - endif() - if (_target) - # add target compile options + # add target compile flags get_target_property(_targetflags ${_target} COMPILE_FLAGS) if (_targetflags) set (_compileFlags "${_compileFlags} ${_targetflags}") endif() - get_target_property(_targetOptions ${_target} COMPILE_OPTIONS) - if (_targetOptions) - set (_compileFlags "${_compileFlags} ${_targetOptions}") - endif() - # interface compile options from linked library targets - cotire_get_target_link_libraries_for_usage_requirements(${_target} _linkLibraries) - foreach (_library ${_linkLibraries}) - if (TARGET ${_library}) - get_target_property(_targetOptions ${_library} INTERFACE_COMPILE_OPTIONS) - if (_targetOptions) - set (_compileFlags "${_compileFlags} ${_targetOptions}") - endif() - endif() - endforeach() endif() if (UNIX) separate_arguments(_compileFlags UNIX_COMMAND "${_compileFlags}") @@ -439,6 +413,68 @@ function (cotire_get_target_compile_flags _config _language _directory _target _ else() separate_arguments(_compileFlags) endif() + # target compile options + if (_target) + get_target_property(_targetOptions ${_target} COMPILE_OPTIONS) + if (_targetOptions) + list (APPEND _compileFlags ${_targetOptions}) + endif() + endif() + # interface compile options from linked library targets + if (_target) + set (_linkedTargets "") + cotire_get_target_usage_requirements(${_target} _linkedTargets) + foreach (_linkedTarget ${_linkedTargets}) + get_target_property(_targetOptions ${_linkedTarget} INTERFACE_COMPILE_OPTIONS) + if (_targetOptions) + list (APPEND _compileFlags ${_targetOptions}) + endif() + endforeach() + endif() + # handle language standard properties + if (_target) + get_target_property(_targetLanguageStandard ${_target} ${_language}_STANDARD) + get_target_property(_targetLanguageExtensions ${_target} ${_language}_EXTENSIONS) + get_target_property(_targetLanguageStandardRequired ${_target} ${_language}_STANDARD_REQUIRED) + if (_targetLanguageExtensions) + if (CMAKE_${_language}${_targetLanguageExtensions}_EXTENSION_COMPILE_OPTION) + list (APPEND _compileFlags "${CMAKE_${_language}${_targetLanguageExtensions}_EXTENSION_COMPILE_OPTION}") + endif() + elseif (_targetLanguageStandard) + if (_targetLanguageStandardRequired) + if (CMAKE_${_language}${_targetLanguageStandard}_STANDARD_COMPILE_OPTION) + list (APPEND _compileFlags "${CMAKE_${_language}${_targetLanguageStandard}_STANDARD_COMPILE_OPTION}") + endif() + else() + if (CMAKE_${_language}${_targetLanguageStandard}_EXTENSION_COMPILE_OPTION) + list (APPEND _compileFlags "${CMAKE_${_language}${_targetLanguageStandard}_EXTENSION_COMPILE_OPTION}") + endif() + endif() + endif() + endif() + # handle the POSITION_INDEPENDENT_CODE target property + if (_target) + get_target_property(_targetPIC ${_target} POSITION_INDEPENDENT_CODE) + if (_targetPIC) + get_target_property(_targetType ${_target} TYPE) + if (_targetType STREQUAL "EXECUTABLE" AND CMAKE_${_language}_COMPILE_OPTIONS_PIE) + list (APPEND _compileFlags "${CMAKE_${_language}_COMPILE_OPTIONS_PIE}") + elseif (CMAKE_${_language}_COMPILE_OPTIONS_PIC) + list (APPEND _compileFlags "${CMAKE_${_language}_COMPILE_OPTIONS_PIC}") + endif() + endif() + endif() + # handle visibility target properties + if (_target) + get_target_property(_targetVisibility ${_target} ${_language}_VISIBILITY_PRESET) + if (_targetVisibility AND CMAKE_${_language}_COMPILE_OPTIONS_VISIBILITY) + list (APPEND _compileFlags "${CMAKE_${_language}_COMPILE_OPTIONS_VISIBILITY}${_targetVisibility}") + endif() + get_target_property(_targetVisibilityInlines ${_target} VISIBILITY_INLINES_HIDDEN) + if (_targetVisibilityInlines AND CMAKE_${_language}_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN) + list (APPEND _compileFlags "${CMAKE_${_language}_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN}") + endif() + endif() # platform specific flags if (APPLE) get_target_property(_architectures ${_target} OSX_ARCHITECTURES_${_upperConfig}) @@ -466,28 +502,47 @@ function (cotire_get_target_compile_flags _config _language _directory _target _ endif() endif() if (COTIRE_DEBUG AND _compileFlags) - message (STATUS "Target ${_target} compile flags ${_compileFlags}") + message (STATUS "Target ${_target} compile flags: ${_compileFlags}") endif() set (${_flagsVar} ${_compileFlags} PARENT_SCOPE) endfunction() -function (cotire_get_target_include_directories _config _language _targetSourceDir _targetBinaryDir _target _includeDirsVar _systemIncludeDirsVar) +function (cotire_get_target_include_directories _config _language _target _includeDirsVar _systemIncludeDirsVar) set (_includeDirs "") set (_systemIncludeDirs "") # default include dirs if (CMAKE_INCLUDE_CURRENT_DIR) - list (APPEND _includeDirs "${_targetBinaryDir}") - list (APPEND _includeDirs "${_targetSourceDir}") + list (APPEND _includeDirs "${CMAKE_CURRENT_BINARY_DIR}") + list (APPEND _includeDirs "${CMAKE_CURRENT_SOURCE_DIR}") endif() - # parse additional include directories from target compile flags set (_targetFlags "") - cotire_get_target_compile_flags("${_config}" "${_language}" "${_targetSourceDir}" "${_target}" _targetFlags) - cotire_filter_compile_flags("${_language}" "I" _dirs _ignore ${_targetFlags}) - if (_dirs) - list (APPEND _includeDirs ${_dirs}) + cotire_get_target_compile_flags("${_config}" "${_language}" "${_target}" _targetFlags) + # parse additional include directories from target compile flags + if (CMAKE_INCLUDE_FLAG_${_language}) + string (STRIP "${CMAKE_INCLUDE_FLAG_${_language}}" _includeFlag) + string (REGEX REPLACE "^[-/]+" "" _includeFlag "${_includeFlag}") + if (_includeFlag) + set (_dirs "") + cotire_filter_compile_flags("${_language}" "${_includeFlag}" _dirs _ignore ${_targetFlags}) + if (_dirs) + list (APPEND _includeDirs ${_dirs}) + endif() + endif() + endif() + # parse additional system include directories from target compile flags + if (CMAKE_INCLUDE_SYSTEM_FLAG_${_language}) + string (STRIP "${CMAKE_INCLUDE_SYSTEM_FLAG_${_language}}" _includeFlag) + string (REGEX REPLACE "^[-/]+" "" _includeFlag "${_includeFlag}") + if (_includeFlag) + set (_dirs "") + cotire_filter_compile_flags("${_language}" "${_includeFlag}" _dirs _ignore ${_targetFlags}) + if (_dirs) + list (APPEND _systemIncludeDirs ${_dirs}) + endif() + endif() endif() # target include directories - get_directory_property(_dirs DIRECTORY "${_targetSourceDir}" INCLUDE_DIRECTORIES) + get_directory_property(_dirs DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" INCLUDE_DIRECTORIES) if (_target) get_target_property(_targetDirs ${_target} INCLUDE_DIRECTORIES) if (_targetDirs) @@ -497,18 +552,19 @@ function (cotire_get_target_include_directories _config _language _targetSourceD if (_targetDirs) list (APPEND _systemIncludeDirs ${_targetDirs}) endif() - # interface include directories from linked library targets - cotire_get_target_link_libraries_for_usage_requirements(${_target} _linkLibraries) - foreach (_library ${_linkLibraries}) - if (TARGET ${_library}) - get_target_property(_targetDirs ${_library} INTERFACE_INCLUDE_DIRECTORIES) - if (_targetDirs) - list (APPEND _dirs ${_targetDirs}) - endif() - get_target_property(_targetDirs ${_library} INTERFACE_SYSTEM_INCLUDE_DIRECTORIES) - if (_targetDirs) - list (APPEND _systemIncludeDirs ${_targetDirs}) - endif() + endif() + # interface include directories from linked library targets + if (_target) + set (_linkedTargets "") + cotire_get_target_usage_requirements(${_target} _linkedTargets) + foreach (_linkedTarget ${_linkedTargets}) + get_target_property(_targetDirs ${_linkedTarget} INTERFACE_INCLUDE_DIRECTORIES) + if (_targetDirs) + list (APPEND _dirs ${_targetDirs}) + endif() + get_target_property(_targetDirs ${_linkedTarget} INTERFACE_SYSTEM_INCLUDE_DIRECTORIES) + if (_targetDirs) + list (APPEND _systemIncludeDirs ${_targetDirs}) endif() endforeach() endif() @@ -540,27 +596,15 @@ function (cotire_get_target_include_directories _config _language _targetSourceD list (REMOVE_ITEM _includeDirs ${CMAKE_${_language}_IMPLICIT_INCLUDE_DIRECTORIES}) endif() if (COTIRE_DEBUG AND _includeDirs) - message (STATUS "Target ${_target} include dirs ${_includeDirs}") + message (STATUS "Target ${_target} include dirs: ${_includeDirs}") endif() set (${_includeDirsVar} ${_includeDirs} PARENT_SCOPE) if (COTIRE_DEBUG AND _systemIncludeDirs) - message (STATUS "Target ${_target} system include dirs ${_systemIncludeDirs}") + message (STATUS "Target ${_target} system include dirs: ${_systemIncludeDirs}") endif() set (${_systemIncludeDirsVar} ${_systemIncludeDirs} PARENT_SCOPE) endfunction() -macro (cotire_make_C_identifier _identifierVar _str) - if (CMAKE_VERSION VERSION_LESS "2.8.12") - # mimic CMake SystemTools::MakeCindentifier behavior - if ("${_str}" MATCHES "^[0-9].+$") - set (_str "_${str}") - endif() - string (REGEX REPLACE "[^a-zA-Z0-9]" "_" ${_identifierVar} "${_str}") - else() - string (MAKE_C_IDENTIFIER "${_str}" "${_identifierVar}") - endif() -endmacro() - function (cotire_get_target_export_symbol _target _exportSymbolVar) set (_exportSymbol "") get_target_property(_targetType ${_target} TYPE) @@ -571,12 +615,12 @@ function (cotire_get_target_export_symbol _target _exportSymbolVar) if (NOT _exportSymbol) set (_exportSymbol "${_target}_EXPORTS") endif() - cotire_make_C_identifier(_exportSymbol "${_exportSymbol}") + string (MAKE_C_IDENTIFIER "${_exportSymbol}" _exportSymbol) endif() set (${_exportSymbolVar} ${_exportSymbol} PARENT_SCOPE) endfunction() -function (cotire_get_target_compile_definitions _config _language _directory _target _definitionsVar) +function (cotire_get_target_compile_definitions _config _language _target _definitionsVar) string (TOUPPER "${_config}" _upperConfig) set (_configDefinitions "") # CMAKE_INTDIR for multi-configuration build systems @@ -589,11 +633,11 @@ function (cotire_get_target_compile_definitions _config _language _directory _ta list (APPEND _configDefinitions "${_defineSymbol}") endif() # directory compile definitions - get_directory_property(_definitions DIRECTORY "${_directory}" COMPILE_DEFINITIONS) + get_directory_property(_definitions DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" COMPILE_DEFINITIONS) if (_definitions) list (APPEND _configDefinitions ${_definitions}) endif() - get_directory_property(_definitions DIRECTORY "${_directory}" COMPILE_DEFINITIONS_${_upperConfig}) + get_directory_property(_definitions DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" COMPILE_DEFINITIONS_${_upperConfig}) if (_definitions) list (APPEND _configDefinitions ${_definitions}) endif() @@ -607,38 +651,52 @@ function (cotire_get_target_compile_definitions _config _language _directory _ta list (APPEND _configDefinitions ${_definitions}) endif() # interface compile definitions from linked library targets - cotire_get_target_link_libraries_for_usage_requirements(${_target} _linkLibraries) - foreach (_library ${_linkLibraries}) - if (TARGET ${_library}) - get_target_property(_definitions ${_library} INTERFACE_COMPILE_DEFINITIONS) - if (_definitions) - list (APPEND _configDefinitions ${_definitions}) - endif() + set (_linkedTargets "") + cotire_get_target_usage_requirements(${_target} _linkedTargets) + foreach (_linkedTarget ${_linkedTargets}) + get_target_property(_definitions ${_linkedTarget} INTERFACE_COMPILE_DEFINITIONS) + if (_definitions) + list (APPEND _configDefinitions ${_definitions}) endif() endforeach() # parse additional compile definitions from target compile flags # and don't look at directory compile definitions, which we already handled set (_targetFlags "") - cotire_get_target_compile_flags("${_config}" "${_language}" "" "${_target}" _targetFlags) + cotire_get_target_compile_flags("${_config}" "${_language}" "${_target}" _targetFlags) cotire_filter_compile_flags("${_language}" "D" _definitions _ignore ${_targetFlags}) if (_definitions) list (APPEND _configDefinitions ${_definitions}) endif() list (REMOVE_DUPLICATES _configDefinitions) if (COTIRE_DEBUG AND _configDefinitions) - message (STATUS "Target ${_target} compile definitions ${_configDefinitions}") + message (STATUS "Target ${_target} compile definitions: ${_configDefinitions}") endif() set (${_definitionsVar} ${_configDefinitions} PARENT_SCOPE) endfunction() -function (cotire_get_target_compiler_flags _config _language _directory _target _compilerFlagsVar) +function (cotire_get_target_compiler_flags _config _language _target _compilerFlagsVar) # parse target compile flags omitting compile definitions and include directives set (_targetFlags "") - cotire_get_target_compile_flags("${_config}" "${_language}" "${_directory}" "${_target}" _targetFlags) + cotire_get_target_compile_flags("${_config}" "${_language}" "${_target}" _targetFlags) + set (_flagFilter "D") + if (CMAKE_INCLUDE_FLAG_${_language}) + string (STRIP "${CMAKE_INCLUDE_FLAG_${_language}}" _includeFlag) + string (REGEX REPLACE "^[-/]+" "" _includeFlag "${_includeFlag}") + if (_includeFlag) + set (_flagFilter "${_flagFilter}|${_includeFlag}") + endif() + endif() + if (CMAKE_INCLUDE_SYSTEM_FLAG_${_language}) + string (STRIP "${CMAKE_INCLUDE_SYSTEM_FLAG_${_language}}" _includeFlag) + string (REGEX REPLACE "^[-/]+" "" _includeFlag "${_includeFlag}") + if (_includeFlag) + set (_flagFilter "${_flagFilter}|${_includeFlag}") + endif() + endif() set (_compilerFlags "") - cotire_filter_compile_flags("${_language}" "[ID]" _ignore _compilerFlags ${_targetFlags}) + cotire_filter_compile_flags("${_language}" "${_flagFilter}" _ignore _compilerFlags ${_targetFlags}) if (COTIRE_DEBUG AND _compilerFlags) - message (STATUS "Target ${_target} compiler flags ${_compilerFlags}") + message (STATUS "Target ${_target} compiler flags: ${_compilerFlags}") endif() set (${_compilerFlagsVar} ${_compilerFlags} PARENT_SCOPE) endfunction() @@ -657,9 +715,6 @@ function (cotire_add_sys_root_paths _pathsVar) endif() endif() set (${_pathsVar} ${${_pathsVar}} PARENT_SCOPE) - if (COTIRE_DEBUG) - message (STATUS "${_pathsVar}=${${_pathsVar}}") - endif() endfunction() function (cotire_get_source_extra_properties _sourceFile _pattern _resultVar) @@ -702,7 +757,7 @@ function (cotire_get_source_compile_definitions _config _language _sourceFile _d list (APPEND _compileDefinitions ${_definitions}) endif() if (COTIRE_DEBUG AND _compileDefinitions) - message (STATUS "Source ${_sourceFile} compile definitions ${_compileDefinitions}") + message (STATUS "Source ${_sourceFile} compile definitions: ${_compileDefinitions}") endif() set (${_definitionsVar} ${_compileDefinitions} PARENT_SCOPE) endfunction() @@ -731,7 +786,7 @@ function (cotire_get_source_undefs _sourceFile _property _sourceUndefsVar) list (APPEND _sourceUndefs ${_undefs}) endif() if (COTIRE_DEBUG AND _sourceUndefs) - message (STATUS "Source ${_sourceFile} ${_property} undefs ${_sourceUndefs}") + message (STATUS "Source ${_sourceFile} ${_property} undefs: ${_sourceUndefs}") endif() set (${_sourceUndefsVar} ${_sourceUndefs} PARENT_SCOPE) endfunction() @@ -781,39 +836,66 @@ macro (cotire_add_definitions_to_cmd _cmdVar _language) endforeach() endmacro() -macro (cotire_add_includes_to_cmd _cmdVar _language _includeSystemFlag _includesVar _systemIncludesVar) - foreach (_include ${${_includesVar}}) - if (WIN32 AND CMAKE_${_language}_COMPILER_ID MATCHES "MSVC|Intel") - file (TO_NATIVE_PATH "${_include}" _include) - list (APPEND ${_cmdVar} "/I${_include}") - else() - list (FIND ${_systemIncludesVar} ${_include} _index) - if(_index GREATER -1 AND NOT "${_includeSystemFlag}" STREQUAL "") - list (APPEND ${_cmdVar} "${_includeSystemFlag}${_include}") +function (cotire_add_includes_to_cmd _cmdVar _language _includesVar _systemIncludesVar) + set (_includeDirs ${${_includesVar}} ${${_systemIncludesVar}}) + if (_includeDirs) + list (REMOVE_DUPLICATES _includeDirs) + foreach (_include ${_includeDirs}) + if (WIN32 AND CMAKE_${_language}_COMPILER_ID MATCHES "MSVC|Intel") + file (TO_NATIVE_PATH "${_include}" _include) + list (APPEND ${_cmdVar} "${CMAKE_INCLUDE_FLAG_${_language}}${CMAKE_INCLUDE_FLAG_${_language}_SEP}${_include}") else() - list (APPEND ${_cmdVar} "-I${_include}") + set (_index -1) + if ("${CMAKE_INCLUDE_SYSTEM_FLAG_${_language}}" MATCHES ".+") + list (FIND ${_systemIncludesVar} "${_include}" _index) + endif() + if (_index GREATER -1) + list (APPEND ${_cmdVar} "${CMAKE_INCLUDE_SYSTEM_FLAG_${_language}}${_include}") + else() + list (APPEND ${_cmdVar} "${CMAKE_INCLUDE_FLAG_${_language}}${CMAKE_INCLUDE_FLAG_${_language}_SEP}${_include}") + endif() endif() - endif() - endforeach() -endmacro() + endforeach() + endif() + set (${_cmdVar} ${${_cmdVar}} PARENT_SCOPE) +endfunction() -macro (cotire_add_frameworks_to_cmd _cmdVar _language) +function (cotire_add_frameworks_to_cmd _cmdVar _language _includesVar _systemIncludesVar) if (APPLE) - set (_frameWorkDirs "") - foreach (_include ${ARGN}) + set (_frameworkDirs "") + foreach (_include ${${_includesVar}}) + if (IS_ABSOLUTE "${_include}" AND _include MATCHES "\\.framework$") + get_filename_component(_frameworkDir "${_include}" DIRECTORY) + list (APPEND _frameworkDirs "${_frameworkDir}") + endif() + endforeach() + set (_systemFrameworkDirs "") + foreach (_include ${${_systemIncludesVar}}) if (IS_ABSOLUTE "${_include}" AND _include MATCHES "\\.framework$") - get_filename_component(_frameWorkDir "${_include}" PATH) - list (APPEND _frameWorkDirs "${_frameWorkDir}") + get_filename_component(_frameworkDir "${_include}" DIRECTORY) + list (APPEND _systemFrameworkDirs "${_frameworkDir}") endif() endforeach() - if (_frameWorkDirs) - list (REMOVE_DUPLICATES _frameWorkDirs) - foreach (_frameWorkDir ${_frameWorkDirs}) - list (APPEND ${_cmdVar} "-F${_frameWorkDir}") + if (_systemFrameworkDirs) + list (APPEND _frameworkDirs ${_systemFrameworkDirs}) + endif() + if (_frameworkDirs) + list (REMOVE_DUPLICATES _frameworkDirs) + foreach (_frameworkDir ${_frameworkDirs}) + set (_index -1) + if ("${CMAKE_${_language}_SYSTEM_FRAMEWORK_SEARCH_FLAG}" MATCHES ".+") + list (FIND _systemFrameworkDirs "${_frameworkDir}" _index) + endif() + if (_index GREATER -1) + list (APPEND ${_cmdVar} "${CMAKE_${_language}_SYSTEM_FRAMEWORK_SEARCH_FLAG}${_frameworkDir}") + else() + list (APPEND ${_cmdVar} "${CMAKE_${_language}_FRAMEWORK_SEARCH_FLAG}${_frameworkDir}") + endif() endforeach() endif() endif() -endmacro() + set (${_cmdVar} ${${_cmdVar}} PARENT_SCOPE) +endfunction() macro (cotire_add_compile_flags_to_cmd _cmdVar) foreach (_flag ${ARGN}) @@ -822,30 +904,38 @@ macro (cotire_add_compile_flags_to_cmd _cmdVar) endmacro() function (cotire_check_file_up_to_date _fileIsUpToDateVar _file) - set (${_fileIsUpToDateVar} FALSE PARENT_SCOPE) - set (_triggerFile "") - foreach (_dependencyFile ${ARGN}) - if (EXISTS "${_dependencyFile}" AND "${_dependencyFile}" IS_NEWER_THAN "${_file}") - set (_triggerFile "${_dependencyFile}") - break() - endif() - endforeach() - get_filename_component(_fileName "${_file}" NAME) if (EXISTS "${_file}") + set (_triggerFile "") + foreach (_dependencyFile ${ARGN}) + if (EXISTS "${_dependencyFile}") + # IS_NEWER_THAN returns TRUE if both files have the same timestamp + # thus we do the comparison in both directions to exclude ties + if ("${_dependencyFile}" IS_NEWER_THAN "${_file}" AND + NOT "${_file}" IS_NEWER_THAN "${_dependencyFile}") + set (_triggerFile "${_dependencyFile}") + break() + endif() + endif() + endforeach() if (_triggerFile) if (COTIRE_VERBOSE) + get_filename_component(_fileName "${_file}" NAME) message (STATUS "${_fileName} update triggered by ${_triggerFile} change.") endif() + set (${_fileIsUpToDateVar} FALSE PARENT_SCOPE) else() if (COTIRE_VERBOSE) + get_filename_component(_fileName "${_file}" NAME) message (STATUS "${_fileName} is up-to-date.") endif() set (${_fileIsUpToDateVar} TRUE PARENT_SCOPE) endif() else() if (COTIRE_VERBOSE) + get_filename_component(_fileName "${_file}" NAME) message (STATUS "${_fileName} does not exist yet.") endif() + set (${_fileIsUpToDateVar} FALSE PARENT_SCOPE) endif() endfunction() @@ -869,12 +959,12 @@ macro (cotire_find_closest_relative_path _headerFile _includeDirs _relPathVar) endforeach() endmacro() -macro (cotire_check_header_file_location _headerFile _insideIncudeDirs _outsideIncudeDirs _headerIsInside) +macro (cotire_check_header_file_location _headerFile _insideIncludeDirs _outsideIncludeDirs _headerIsInside) # check header path against ignored and honored include directories - cotire_find_closest_relative_path("${_headerFile}" "${_insideIncudeDirs}" _insideRelPath) + cotire_find_closest_relative_path("${_headerFile}" "${_insideIncludeDirs}" _insideRelPath) if (_insideRelPath) # header is inside, but could be become outside if there is a shorter outside match - cotire_find_closest_relative_path("${_headerFile}" "${_outsideIncudeDirs}" _outsideRelPath) + cotire_find_closest_relative_path("${_headerFile}" "${_outsideIncludeDirs}" _outsideRelPath) if (_outsideRelPath) string (LENGTH "${_insideRelPath}" _insideRelPathLen) string (LENGTH "${_outsideRelPath}" _outsideRelPathLen) @@ -949,7 +1039,7 @@ macro (cotire_parse_line _line _headerFileVar _headerDepthVar) endif() endmacro() -function (cotire_parse_includes _language _scanOutput _ignoredIncudeDirs _honoredIncudeDirs _ignoredExtensions _selectedIncludesVar _unparsedLinesVar) +function (cotire_parse_includes _language _scanOutput _ignoredIncludeDirs _honoredIncludeDirs _ignoredExtensions _selectedIncludesVar _unparsedLinesVar) if (WIN32) # prevent CMake macro invocation errors due to backslash characters in Windows paths string (REPLACE "\\" "/" _scanOutput "${_scanOutput}") @@ -969,11 +1059,11 @@ function (cotire_parse_includes _language _scanOutput _ignoredIncudeDirs _honore if (_ignoredExtensions) message (STATUS "Ignored extensions: ${_ignoredExtensions}") endif() - if (_ignoredIncudeDirs) - message (STATUS "Ignored paths: ${_ignoredIncudeDirs}") + if (_ignoredIncludeDirs) + message (STATUS "Ignored paths: ${_ignoredIncludeDirs}") endif() - if (_honoredIncudeDirs) - message (STATUS "Included paths: ${_honoredIncudeDirs}") + if (_honoredIncludeDirs) + message (STATUS "Included paths: ${_honoredIncludeDirs}") endif() endif() set (_sourceFiles ${ARGN}) @@ -985,7 +1075,7 @@ function (cotire_parse_includes _language _scanOutput _ignoredIncudeDirs _honore if (_line) cotire_parse_line("${_line}" _headerFile _headerDepth) if (_headerFile) - cotire_check_header_file_location("${_headerFile}" "${_ignoredIncudeDirs}" "${_honoredIncudeDirs}" _headerIsInside) + cotire_check_header_file_location("${_headerFile}" "${_ignoredIncludeDirs}" "${_honoredIncludeDirs}" _headerIsInside) if (COTIRE_DEBUG) message (STATUS "${_headerDepth}: ${_headerFile} ${_headerIsInside}") endif() @@ -1053,8 +1143,9 @@ endfunction() function (cotire_scan_includes _includesVar) set(_options "") - set(_oneValueArgs COMPILER_ID COMPILER_EXECUTABLE COMPILER_VERSION INCLUDE_SYSTEM_FLAG LANGUAGE UNPARSED_LINES) - set(_multiValueArgs COMPILE_DEFINITIONS COMPILE_FLAGS INCLUDE_DIRECTORIES SYSTEM_INCLUDE_DIRECTORIES IGNORE_PATH INCLUDE_PATH IGNORE_EXTENSIONS) + set(_oneValueArgs COMPILER_ID COMPILER_EXECUTABLE COMPILER_VERSION LANGUAGE UNPARSED_LINES) + set(_multiValueArgs COMPILE_DEFINITIONS COMPILE_FLAGS INCLUDE_DIRECTORIES SYSTEM_INCLUDE_DIRECTORIES + IGNORE_PATH INCLUDE_PATH IGNORE_EXTENSIONS INCLUDE_PRIORITY_PATH) cmake_parse_arguments(_option "${_options}" "${_oneValueArgs}" "${_multiValueArgs}" ${ARGN}) set (_sourceFiles ${_option_UNPARSED_ARGUMENTS}) if (NOT _option_LANGUAGE) @@ -1063,12 +1154,14 @@ function (cotire_scan_includes _includesVar) if (NOT _option_COMPILER_ID) set (_option_COMPILER_ID "${CMAKE_${_option_LANGUAGE}_ID}") endif() - set (_cmd "${_option_COMPILER_EXECUTABLE}" ${_option_COMPILER_ARG1}) + if (NOT _option_COMPILER_VERSION) + set (_option_COMPILER_VERSION "${CMAKE_${_option_LANGUAGE}_COMPILER_VERSION}") + endif() cotire_init_compile_cmd(_cmd "${_option_LANGUAGE}" "${_option_COMPILER_EXECUTABLE}" "${_option_COMPILER_ARG1}") cotire_add_definitions_to_cmd(_cmd "${_option_LANGUAGE}" ${_option_COMPILE_DEFINITIONS}) cotire_add_compile_flags_to_cmd(_cmd ${_option_COMPILE_FLAGS}) - cotire_add_includes_to_cmd(_cmd "${_option_LANGUAGE}" "${_option_INCLUDE_SYSTEM_FLAG}" _option_INCLUDE_DIRECTORIES _option_SYSTEM_INCLUDE_DIRECTORIES) - cotire_add_frameworks_to_cmd(_cmd "${_option_LANGUAGE}" ${_option_INCLUDE_DIRECTORIES}) + cotire_add_includes_to_cmd(_cmd "${_option_LANGUAGE}" _option_INCLUDE_DIRECTORIES _option_SYSTEM_INCLUDE_DIRECTORIES) + cotire_add_frameworks_to_cmd(_cmd "${_option_LANGUAGE}" _option_INCLUDE_DIRECTORIES _option_SYSTEM_INCLUDE_DIRECTORIES) cotire_add_makedep_flags("${_option_LANGUAGE}" "${_option_COMPILER_ID}" "${_option_COMPILER_VERSION}" _cmd) # only consider existing source files for scanning set (_existingSourceFiles "") @@ -1086,15 +1179,15 @@ function (cotire_scan_includes _includesVar) message (STATUS "execute_process: ${_cmd}") endif() if (_option_COMPILER_ID MATCHES "MSVC") - if (COTIRE_DEBUG) - message (STATUS "clearing VS_UNICODE_OUTPUT") - endif() # cl.exe messes with the output streams unless the environment variable VS_UNICODE_OUTPUT is cleared unset (ENV{VS_UNICODE_OUTPUT}) endif() execute_process( - COMMAND ${_cmd} WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" - RESULT_VARIABLE _result OUTPUT_QUIET ERROR_VARIABLE _output) + COMMAND ${_cmd} + WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" + RESULT_VARIABLE _result + OUTPUT_QUIET + ERROR_VARIABLE _output) if (_result) message (STATUS "Result ${_result} scanning includes of ${_existingSourceFiles}.") endif() @@ -1104,6 +1197,21 @@ function (cotire_scan_includes _includesVar) "${_option_IGNORE_EXTENSIONS}" _includes _unparsedLines ${_sourceFiles}) + if (_option_INCLUDE_PRIORITY_PATH) + set (_sortedIncludes "") + foreach (_priorityPath ${_option_INCLUDE_PRIORITY_PATH}) + foreach (_include ${_includes}) + string (FIND ${_include} ${_priorityPath} _position) + if (_position GREATER -1) + list (APPEND _sortedIncludes ${_include}) + endif() + endforeach() + endforeach() + if (_sortedIncludes) + list (INSERT _includes 0 ${_sortedIncludes}) + list (REMOVE_DUPLICATES _includes) + endif() + endif() set (${_includesVar} ${_includes} PARENT_SCOPE) if (_option_UNPARSED_LINES) set (${_option_UNPARSED_LINES} ${_unparsedLines} PARENT_SCOPE) @@ -1154,7 +1262,7 @@ function (cotire_generate_unity_source _unityFile) set(_options "") set(_oneValueArgs LANGUAGE) set(_multiValueArgs - DEPENDS SOURCE_LOCATIONS SOURCES_COMPILE_DEFINITIONS + DEPENDS SOURCES_COMPILE_DEFINITIONS PRE_UNDEFS SOURCES_PRE_UNDEFS POST_UNDEFS SOURCES_POST_UNDEFS PROLOGUE EPILOGUE) cmake_parse_arguments(_option "${_options}" "${_oneValueArgs}" "${_multiValueArgs}" ${ARGN}) if (_option_DEPENDS) @@ -1188,7 +1296,6 @@ function (cotire_generate_unity_source _unityFile) endif() endif() set (_compileUndefinitions "") - set (_index 0) foreach (_sourceFile ${_sourceFiles}) cotire_get_source_compile_definitions( "${_option_CONFIGURATION}" "${_option_LANGUAGE}" "${_sourceFile}" _compileDefinitions @@ -1220,18 +1327,12 @@ function (cotire_generate_unity_source _unityFile) list (INSERT _compileUndefinitions 0 "${_definition}") endif() endforeach() - if (_option_SOURCE_LOCATIONS) - # use explicitly provided source file location - list (GET _option_SOURCE_LOCATIONS ${_index} _sourceFileLocation) - else() - # use absolute path as source file location - get_filename_component(_sourceFileLocation "${_sourceFile}" ABSOLUTE) - endif() + # use absolute path as source file location + get_filename_component(_sourceFileLocation "${_sourceFile}" ABSOLUTE) if (WIN32) file (TO_NATIVE_PATH "${_sourceFileLocation}" _sourceFileLocation) endif() list (APPEND _contents "#include \"${_sourceFileLocation}\"") - math (EXPR _index "${_index} + 1") endforeach() if (_compileUndefinitions) cotire_append_undefs(_contents ${_compileUndefinitions}) @@ -1253,13 +1354,21 @@ endfunction() function (cotire_generate_prefix_header _prefixFile) set(_options "") - set(_oneValueArgs LANGUAGE COMPILER_EXECUTABLE COMPILER_ID COMPILER_VERSION INCLUDE_SYSTEM_FLAG) + set(_oneValueArgs LANGUAGE COMPILER_EXECUTABLE COMPILER_ID COMPILER_VERSION) set(_multiValueArgs DEPENDS COMPILE_DEFINITIONS COMPILE_FLAGS - INCLUDE_DIRECTORIES SYSTEM_INCLUDE_DIRECTORIES IGNORE_PATH INCLUDE_PATH IGNORE_EXTENSIONS) + INCLUDE_DIRECTORIES SYSTEM_INCLUDE_DIRECTORIES IGNORE_PATH INCLUDE_PATH + IGNORE_EXTENSIONS INCLUDE_PRIORITY_PATH) cmake_parse_arguments(_option "${_options}" "${_oneValueArgs}" "${_multiValueArgs}" ${ARGN}) + if (NOT _option_COMPILER_ID) + set (_option_COMPILER_ID "${CMAKE_${_option_LANGUAGE}_ID}") + endif() + if (NOT _option_COMPILER_VERSION) + set (_option_COMPILER_VERSION "${CMAKE_${_option_LANGUAGE}_COMPILER_VERSION}") + endif() if (_option_DEPENDS) cotire_check_file_up_to_date(_prefixFileIsUpToDate "${_prefixFile}" ${_option_DEPENDS}) if (_prefixFileIsUpToDate) + # create empty log file set (_unparsedLinesFile "${_prefixFile}.log") file (WRITE "${_unparsedLinesFile}" "") return() @@ -1287,11 +1396,11 @@ function (cotire_generate_prefix_header _prefixFile) COMPILE_DEFINITIONS ${_option_COMPILE_DEFINITIONS} COMPILE_FLAGS ${_option_COMPILE_FLAGS} INCLUDE_DIRECTORIES ${_option_INCLUDE_DIRECTORIES} - INCLUDE_SYSTEM_FLAG ${_option_INCLUDE_SYSTEM_FLAG} SYSTEM_INCLUDE_DIRECTORIES ${_option_SYSTEM_INCLUDE_DIRECTORIES} IGNORE_PATH ${_option_IGNORE_PATH} INCLUDE_PATH ${_option_INCLUDE_PATH} IGNORE_EXTENSIONS ${_option_IGNORE_EXTENSIONS} + INCLUDE_PRIORITY_PATH ${_option_INCLUDE_PRIORITY_PATH} UNPARSED_LINES _unparsedLines) cotire_generate_unity_source("${_prefixFile}" PROLOGUE ${_prologue} EPILOGUE ${_epilogue} LANGUAGE "${_option_LANGUAGE}" ${_selectedHeaders}) @@ -1299,8 +1408,7 @@ function (cotire_generate_prefix_header _prefixFile) if (_unparsedLines) if (COTIRE_VERBOSE OR NOT _selectedHeaders) list (LENGTH _unparsedLines _skippedLineCount) - file (RELATIVE_PATH _unparsedLinesFileRelPath "${CMAKE_BINARY_DIR}" "${_unparsedLinesFile}") - message (STATUS "${_skippedLineCount} line(s) skipped, see ${_unparsedLinesFileRelPath}") + message (STATUS "${_skippedLineCount} line(s) skipped, see ${_unparsedLinesFile}") endif() string (REPLACE ";" "\n" _unparsedLines "${_unparsedLines}") endif() @@ -1347,12 +1455,13 @@ function (cotire_add_makedep_flags _language _compilerID _compilerVersion _flags # Clang options used # -H print the name of each header file used # -E invoke preprocessor + # -fno-color-diagnostics don't prints diagnostics in color if (_flags) # append to list - list (APPEND _flags -H -E) + list (APPEND _flags -H -E -fno-color-diagnostics) else() # return as a flag string - set (_flags "-H -E") + set (_flags "-H -E -fno-color-diagnostics") endif() elseif (_compilerID MATCHES "Intel") if (WIN32) @@ -1409,15 +1518,22 @@ function (cotire_add_pch_compilation_flags _language _compilerID _compilerVersio # /TC treat all files named on the command line as C source files # /TP treat all files named on the command line as C++ source files # /Zs syntax check only + # /Zm precompiled header memory allocation scaling factor set (_sourceFileTypeC "/TC") set (_sourceFileTypeCXX "/TP") if (_flags) # append to list list (APPEND _flags /nologo "${_sourceFileType${_language}}" "/Yc${_prefixFileNative}" "/Fp${_pchFileNative}" "/FI${_prefixFileNative}" /Zs "${_hostFileNative}") + if (COTIRE_PCH_MEMORY_SCALING_FACTOR) + list (APPEND _flags "/Zm${COTIRE_PCH_MEMORY_SCALING_FACTOR}") + endif() else() # return as a flag string set (_flags "/Yc\"${_prefixFileNative}\" /Fp\"${_pchFileNative}\" /FI\"${_prefixFileNative}\"") + if (COTIRE_PCH_MEMORY_SCALING_FACTOR) + set (_flags "${_flags} /Zm${COTIRE_PCH_MEMORY_SCALING_FACTOR}") + endif() endif() elseif (_compilerID MATCHES "GNU|Clang") # GCC / Clang options used @@ -1472,7 +1588,7 @@ function (cotire_add_pch_compilation_flags _language _compilerID _compilerVersio # -Kc++ process all source or unrecognized file types as C++ source files # -fsyntax-only check only for correct syntax # -Wpch-messages enable diagnostics related to pre-compiled headers (requires Intel XE 2013 Update 2) - get_filename_component(_pchDir "${_pchFile}" PATH) + get_filename_component(_pchDir "${_pchFile}" DIRECTORY) get_filename_component(_pchName "${_pchFile}" NAME) set (_xLanguage_C "c-header") set (_xLanguage_CXX "c++-header") @@ -1507,14 +1623,21 @@ function (cotire_add_prefix_pch_inclusion_flags _language _compilerID _compilerV # /Yu uses a precompiled header file during build # /Fp specifies precompiled header binary file name # /FI forces inclusion of file + # /Zm precompiled header memory allocation scaling factor if (_pchFile) file (TO_NATIVE_PATH "${_pchFile}" _pchFileNative) if (_flags) # append to list list (APPEND _flags "/Yu${_prefixFileNative}" "/Fp${_pchFileNative}" "/FI${_prefixFileNative}") + if (COTIRE_PCH_MEMORY_SCALING_FACTOR) + list (APPEND _flags "/Zm${COTIRE_PCH_MEMORY_SCALING_FACTOR}") + endif() else() # return as a flag string set (_flags "/Yu\"${_prefixFileNative}\" /Fp\"${_pchFileNative}\" /FI\"${_prefixFileNative}\"") + if (COTIRE_PCH_MEMORY_SCALING_FACTOR) + set (_flags "${_flags} /Zm${COTIRE_PCH_MEMORY_SCALING_FACTOR}") + endif() endif() else() # no precompiled header, force inclusion of prefix header @@ -1591,7 +1714,7 @@ function (cotire_add_prefix_pch_inclusion_flags _language _compilerID _compilerV # -include process include file as the first line of the primary source file # -Wpch-messages enable diagnostics related to pre-compiled headers (requires Intel XE 2013 Update 2) if (_pchFile) - get_filename_component(_pchDir "${_pchFile}" PATH) + get_filename_component(_pchDir "${_pchFile}" DIRECTORY) get_filename_component(_pchName "${_pchFile}" NAME) if (_flags) # append to list @@ -1625,7 +1748,7 @@ endfunction() function (cotire_precompile_prefix_header _prefixFile _pchFile _hostFile) set(_options "") - set(_oneValueArgs COMPILER_EXECUTABLE COMPILER_ID COMPILER_VERSION INCLUDE_SYSTEM_FLAG LANGUAGE) + set(_oneValueArgs COMPILER_EXECUTABLE COMPILER_ID COMPILER_VERSION LANGUAGE) set(_multiValueArgs COMPILE_DEFINITIONS COMPILE_FLAGS INCLUDE_DIRECTORIES SYSTEM_INCLUDE_DIRECTORIES SYS) cmake_parse_arguments(_option "${_options}" "${_oneValueArgs}" "${_multiValueArgs}" ${ARGN}) if (NOT _option_LANGUAGE) @@ -1634,11 +1757,14 @@ function (cotire_precompile_prefix_header _prefixFile _pchFile _hostFile) if (NOT _option_COMPILER_ID) set (_option_COMPILER_ID "${CMAKE_${_option_LANGUAGE}_ID}") endif() + if (NOT _option_COMPILER_VERSION) + set (_option_COMPILER_VERSION "${CMAKE_${_option_LANGUAGE}_COMPILER_VERSION}") + endif() cotire_init_compile_cmd(_cmd "${_option_LANGUAGE}" "${_option_COMPILER_EXECUTABLE}" "${_option_COMPILER_ARG1}") cotire_add_definitions_to_cmd(_cmd "${_option_LANGUAGE}" ${_option_COMPILE_DEFINITIONS}) cotire_add_compile_flags_to_cmd(_cmd ${_option_COMPILE_FLAGS}) - cotire_add_includes_to_cmd(_cmd "${_option_LANGUAGE}" "${_option_INCLUDE_SYSTEM_FLAG}" _option_INCLUDE_DIRECTORIES _option_SYSTEM_INCLUDE_DIRECTORIES) - cotire_add_frameworks_to_cmd(_cmd "${_option_LANGUAGE}" ${_option_INCLUDE_DIRECTORIES}) + cotire_add_includes_to_cmd(_cmd "${_option_LANGUAGE}" _option_INCLUDE_DIRECTORIES _option_SYSTEM_INCLUDE_DIRECTORIES) + cotire_add_frameworks_to_cmd(_cmd "${_option_LANGUAGE}" _option_INCLUDE_DIRECTORIES _option_SYSTEM_INCLUDE_DIRECTORIES) cotire_add_pch_compilation_flags( "${_option_LANGUAGE}" "${_option_COMPILER_ID}" "${_option_COMPILER_VERSION}" "${_prefixFile}" "${_pchFile}" "${_hostFile}" _cmd) @@ -1646,9 +1772,6 @@ function (cotire_precompile_prefix_header _prefixFile _pchFile _hostFile) message (STATUS "execute_process: ${_cmd}") endif() if (_option_COMPILER_ID MATCHES "MSVC") - if (COTIRE_DEBUG) - message (STATUS "clearing VS_UNICODE_OUTPUT") - endif() # cl.exe messes with the output streams unless the environment variable VS_UNICODE_OUTPUT is cleared unset (ENV{VS_UNICODE_OUTPUT}) endif() @@ -1661,7 +1784,7 @@ function (cotire_precompile_prefix_header _prefixFile _pchFile _hostFile) endif() endfunction() -function (cotire_check_precompiled_header_support _language _targetSourceDir _target _msgVar) +function (cotire_check_precompiled_header_support _language _target _msgVar) set (_unsupportedCompiler "Precompiled headers not supported for ${_language} compiler ${CMAKE_${_language}_COMPILER_ID}") if (CMAKE_${_language}_COMPILER_ID MATCHES "MSVC") @@ -1670,10 +1793,8 @@ function (cotire_check_precompiled_header_support _language _targetSourceDir _ta set (${_msgVar} "" PARENT_SCOPE) elseif (CMAKE_${_language}_COMPILER_ID MATCHES "GNU") # GCC PCH support requires version >= 3.4 - cotire_determine_compiler_version("${_language}" COTIRE_${_language}_COMPILER) - if ("${COTIRE_${_language}_COMPILER_VERSION}" MATCHES ".+" AND - "${COTIRE_${_language}_COMPILER_VERSION}" VERSION_LESS "3.4.0") - set (${_msgVar} "${_unsupportedCompiler} version ${COTIRE_${_language}_COMPILER_VERSION}." PARENT_SCOPE) + if ("${CMAKE_${_language}_COMPILER_VERSION}" VERSION_LESS "3.4.0") + set (${_msgVar} "${_unsupportedCompiler} version ${CMAKE_${_language}_COMPILER_VERSION}." PARENT_SCOPE) else() set (${_msgVar} "" PARENT_SCOPE) endif() @@ -1682,10 +1803,8 @@ function (cotire_check_precompiled_header_support _language _targetSourceDir _ta set (${_msgVar} "" PARENT_SCOPE) elseif (CMAKE_${_language}_COMPILER_ID MATCHES "Intel") # Intel PCH support requires version >= 8.0.0 - cotire_determine_compiler_version("${_language}" COTIRE_${_language}_COMPILER) - if ("${COTIRE_${_language}_COMPILER_VERSION}" MATCHES ".+" AND - "${COTIRE_${_language}_COMPILER_VERSION}" VERSION_LESS "8.0.0") - set (${_msgVar} "${_unsupportedCompiler} version ${COTIRE_${_language}_COMPILER_VERSION}." PARENT_SCOPE) + if ("${CMAKE_${_language}_COMPILER_VERSION}" VERSION_LESS "8.0.0") + set (${_msgVar} "${_unsupportedCompiler} version ${CMAKE_${_language}_COMPILER_VERSION}." PARENT_SCOPE) else() set (${_msgVar} "" PARENT_SCOPE) endif() @@ -1704,7 +1823,7 @@ function (cotire_check_precompiled_header_support _language _targetSourceDir _ta cotire_get_configuration_types(_configs) foreach (_config ${_configs}) set (_targetFlags "") - cotire_get_target_compile_flags("${_config}" "${_language}" "${_targetSourceDir}" "${_target}" _targetFlags) + cotire_get_target_compile_flags("${_config}" "${_language}" "${_target}" _targetFlags) cotire_filter_compile_flags("${_language}" "arch" _architectures _ignore ${_targetFlags}) list (LENGTH _architectures _numberOfArchitectures) if (_numberOfArchitectures GREATER 1) @@ -1719,6 +1838,7 @@ function (cotire_check_precompiled_header_support _language _targetSourceDir _ta endfunction() macro (cotire_get_intermediate_dir _cotireDir) + # ${CMAKE_CFG_INTDIR} may reference a build-time variable when using a generator which supports configuration types get_filename_component(${_cotireDir} "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${COTIRE_INTDIR}" ABSOLUTE) endmacro() @@ -1742,9 +1862,6 @@ function (cotire_make_single_unity_source_file_path _language _target _unityFile cotire_get_intermediate_dir(_baseDir) set (_unityFile "${_baseDir}/${_unityFileName}") set (${_unityFileVar} "${_unityFile}" PARENT_SCOPE) - if (COTIRE_DEBUG) - message(STATUS "${_unityFile}") - endif() endfunction() function (cotire_make_unity_source_file_paths _language _target _maxIncludes _unityFilesVar) @@ -1784,8 +1901,8 @@ function (cotire_make_unity_source_file_paths _language _target _maxIncludes _un list (APPEND _unityFiles "${_baseDir}/${_unityFileName}") endif() set (${_unityFilesVar} ${_unityFiles} PARENT_SCOPE) - if (COTIRE_DEBUG) - message(STATUS "${_unityFiles}") + if (COTIRE_DEBUG AND _unityFiles) + message (STATUS "unity files: ${_unityFiles}") endif() endfunction() @@ -1835,18 +1952,18 @@ function (cotire_make_prefix_file_path _language _target _prefixFileVar) if (NOT _language) set (_language "C") endif() - if (MSVC OR CMAKE_${_language}_COMPILER_ID MATCHES "GNU|Clang|Intel") + if (CMAKE_${_language}_COMPILER_ID MATCHES "GNU|Clang|Intel|MSVC") cotire_get_intermediate_dir(_baseDir) set (${_prefixFileVar} "${_baseDir}/${_prefixFileName}" PARENT_SCOPE) endif() endif() endfunction() -function (cotire_make_pch_file_path _language _targetSourceDir _target _pchFileVar) +function (cotire_make_pch_file_path _language _target _pchFileVar) cotire_make_prefix_file_name("${_language}" "${_target}" _prefixFileBaseName _prefixFileName) set (${_pchFileVar} "" PARENT_SCOPE) if (_prefixFileBaseName AND _prefixFileName) - cotire_check_precompiled_header_support("${_language}" "${_targetSourceDir}" "${_target}" _msg) + cotire_check_precompiled_header_support("${_language}" "${_target}" _msg) if (NOT _msg) if (XCODE) # For Xcode, we completely hand off the compilation of the prefix header to the IDE @@ -1896,7 +2013,8 @@ endfunction() function (cotire_get_unity_source_dependencies _language _target _dependencySourcesVar) set (_dependencySources "") # depend on target's generated source files - cotire_get_objects_with_property_on(_generatedSources GENERATED SOURCE ${ARGN}) + get_target_property(_targetSourceFiles ${_target} SOURCES) + cotire_get_objects_with_property_on(_generatedSources GENERATED SOURCE ${_targetSourceFiles}) if (_generatedSources) # but omit all generated source files that have the COTIRE_EXCLUDED property set to true cotire_get_objects_with_property_on(_excludedGeneratedSources COTIRE_EXCLUDED SOURCE ${_generatedSources}) @@ -1913,37 +2031,28 @@ function (cotire_get_unity_source_dependencies _language _target _dependencySour endif() endif() if (COTIRE_DEBUG AND _dependencySources) - message (STATUS "${_language} ${_target} unity source depends on ${_dependencySources}") + message (STATUS "${_language} ${_target} unity source dependencies: ${_dependencySources}") endif() set (${_dependencySourcesVar} ${_dependencySources} PARENT_SCOPE) endfunction() function (cotire_get_prefix_header_dependencies _language _target _dependencySourcesVar) - # depend on target source files marked with custom COTIRE_DEPENDENCY property set (_dependencySources "") - cotire_get_objects_with_property_on(_dependencySources COTIRE_DEPENDENCY SOURCE ${ARGN}) - if (CMAKE_${_language}_COMPILER_ID MATCHES "GNU|Clang") - # GCC and clang raise a fatal error if a file is not found during preprocessing - # thus we depend on target's generated source files for prefix header generation - cotire_get_objects_with_property_on(_generatedSources GENERATED SOURCE ${ARGN}) - if (_generatedSources) - list (APPEND _dependencySources ${_generatedSources}) - endif() - endif() + # depend on target source files marked with custom COTIRE_DEPENDENCY property + get_target_property(_targetSourceFiles ${_target} SOURCES) + cotire_get_objects_with_property_on(_dependencySources COTIRE_DEPENDENCY SOURCE ${_targetSourceFiles}) if (COTIRE_DEBUG AND _dependencySources) - message (STATUS "${_language} ${_target} prefix header DEPENDS ${_dependencySources}") + message (STATUS "${_language} ${_target} prefix header dependencies: ${_dependencySources}") endif() set (${_dependencySourcesVar} ${_dependencySources} PARENT_SCOPE) endfunction() -function (cotire_generate_target_script _language _configurations _targetSourceDir _targetBinaryDir _target _targetScriptVar _targetConfigScriptVar) - set (COTIRE_TARGET_SOURCES ${ARGN}) - cotire_get_source_file_property_values(COTIRE_TARGET_SOURCE_LOCATIONS LOCATION ${COTIRE_TARGET_SOURCES}) - cotire_get_prefix_header_dependencies(${_language} ${_target} COTIRE_TARGET_PREFIX_DEPENDS ${COTIRE_TARGET_SOURCES}) - cotire_get_unity_source_dependencies(${_language} ${_target} COTIRE_TARGET_UNITY_DEPENDS ${COTIRE_TARGET_SOURCES}) +function (cotire_generate_target_script _language _configurations _target _targetScriptVar _targetConfigScriptVar) + set (_targetSources ${ARGN}) + cotire_get_prefix_header_dependencies(${_language} ${_target} COTIRE_TARGET_PREFIX_DEPENDS ${_targetSources}) + cotire_get_unity_source_dependencies(${_language} ${_target} COTIRE_TARGET_UNITY_DEPENDS ${_targetSources}) # set up variables to be configured set (COTIRE_TARGET_LANGUAGE "${_language}") - cotire_determine_compiler_version("${COTIRE_TARGET_LANGUAGE}" COTIRE_${_language}_COMPILER) get_target_property(COTIRE_TARGET_IGNORE_PATH ${_target} COTIRE_PREFIX_HEADER_IGNORE_PATH) cotire_add_sys_root_paths(COTIRE_TARGET_IGNORE_PATH) get_target_property(COTIRE_TARGET_INCLUDE_PATH ${_target} COTIRE_PREFIX_HEADER_INCLUDE_PATH) @@ -1951,30 +2060,53 @@ function (cotire_generate_target_script _language _configurations _targetSourceD get_target_property(COTIRE_TARGET_PRE_UNDEFS ${_target} COTIRE_UNITY_SOURCE_PRE_UNDEFS) get_target_property(COTIRE_TARGET_POST_UNDEFS ${_target} COTIRE_UNITY_SOURCE_POST_UNDEFS) get_target_property(COTIRE_TARGET_MAXIMUM_NUMBER_OF_INCLUDES ${_target} COTIRE_UNITY_SOURCE_MAXIMUM_NUMBER_OF_INCLUDES) - cotire_get_source_files_undefs(COTIRE_UNITY_SOURCE_PRE_UNDEFS COTIRE_TARGET_SOURCES_PRE_UNDEFS ${COTIRE_TARGET_SOURCES}) - cotire_get_source_files_undefs(COTIRE_UNITY_SOURCE_POST_UNDEFS COTIRE_TARGET_SOURCES_POST_UNDEFS ${COTIRE_TARGET_SOURCES}) - string (STRIP "${CMAKE_INCLUDE_SYSTEM_FLAG_${_language}}" COTIRE_INCLUDE_SYSTEM_FLAG) + get_target_property(COTIRE_TARGET_INCLUDE_PRIORITY_PATH ${_target} COTIRE_PREFIX_HEADER_INCLUDE_PRIORITY_PATH) + cotire_get_source_files_undefs(COTIRE_UNITY_SOURCE_PRE_UNDEFS COTIRE_TARGET_SOURCES_PRE_UNDEFS ${_targetSources}) + cotire_get_source_files_undefs(COTIRE_UNITY_SOURCE_POST_UNDEFS COTIRE_TARGET_SOURCES_POST_UNDEFS ${_targetSources}) set (COTIRE_TARGET_CONFIGURATION_TYPES "${_configurations}") foreach (_config ${_configurations}) string (TOUPPER "${_config}" _upperConfig) cotire_get_target_include_directories( - "${_config}" "${_language}" "${_targetSourceDir}" "${_targetBinaryDir}" "${_target}" COTIRE_TARGET_INCLUDE_DIRECTORIES_${_upperConfig} COTIRE_TARGET_SYSTEM_INCLUDE_DIRECTORIES_${_upperConfig}) + "${_config}" "${_language}" "${_target}" COTIRE_TARGET_INCLUDE_DIRECTORIES_${_upperConfig} COTIRE_TARGET_SYSTEM_INCLUDE_DIRECTORIES_${_upperConfig}) cotire_get_target_compile_definitions( - "${_config}" "${_language}" "${_targetSourceDir}" "${_target}" COTIRE_TARGET_COMPILE_DEFINITIONS_${_upperConfig}) + "${_config}" "${_language}" "${_target}" COTIRE_TARGET_COMPILE_DEFINITIONS_${_upperConfig}) cotire_get_target_compiler_flags( - "${_config}" "${_language}" "${_targetSourceDir}" "${_target}" COTIRE_TARGET_COMPILE_FLAGS_${_upperConfig}) + "${_config}" "${_language}" "${_target}" COTIRE_TARGET_COMPILE_FLAGS_${_upperConfig}) cotire_get_source_files_compile_definitions( - "${_config}" "${_language}" COTIRE_TARGET_SOURCES_COMPILE_DEFINITIONS_${_upperConfig} ${COTIRE_TARGET_SOURCES}) + "${_config}" "${_language}" COTIRE_TARGET_SOURCES_COMPILE_DEFINITIONS_${_upperConfig} ${_targetSources}) endforeach() + # set up COTIRE_TARGET_SOURCES + set (COTIRE_TARGET_SOURCES "") + foreach (_sourceFile ${_targetSources}) + get_source_file_property(_generated "${_sourceFile}" GENERATED) + if (_generated) + # use absolute paths for generated files only, retrieving the LOCATION property is an expensive operation + get_source_file_property(_sourceLocation "${_sourceFile}" LOCATION) + list (APPEND COTIRE_TARGET_SOURCES "${_sourceLocation}") + else() + list (APPEND COTIRE_TARGET_SOURCES "${_sourceFile}") + endif() + endforeach() + # copy variable definitions to cotire target script get_cmake_property(_vars VARIABLES) string (REGEX MATCHALL "COTIRE_[A-Za-z0-9_]+" _matchVars "${_vars}") - # remove COTIRE_VERBOSE which is passed as a CMake define on command line + # omit COTIRE_*_INIT variables + string (REGEX MATCHALL "COTIRE_[A-Za-z0-9_]+_INIT" _initVars "${_matchVars}") + if (_initVars) + list (REMOVE_ITEM _matchVars ${_initVars}) + endif() + # omit COTIRE_VERBOSE which is passed as a CMake define on command line list (REMOVE_ITEM _matchVars COTIRE_VERBOSE) set (_contents "") set (_contentsHasGeneratorExpressions FALSE) foreach (_var IN LISTS _matchVars ITEMS XCODE MSVC CMAKE_GENERATOR CMAKE_BUILD_TYPE CMAKE_CONFIGURATION_TYPES - CMAKE_${_language}_COMPILER_ID CMAKE_${_language}_COMPILER CMAKE_${_language}_COMPILER_ARG1 + CMAKE_${_language}_COMPILER_ID CMAKE_${_language}_COMPILER_VERSION + CMAKE_${_language}_COMPILER CMAKE_${_language}_COMPILER_ARG1 + CMAKE_INCLUDE_FLAG_${_language} CMAKE_INCLUDE_FLAG_${_language}_SEP + CMAKE_INCLUDE_SYSTEM_FLAG_${_language} + CMAKE_${_language}_FRAMEWORK_SEARCH_FLAG + CMAKE_${_language}_SYSTEM_FRAMEWORK_SEARCH_FLAG CMAKE_${_language}_SOURCE_FILE_EXTENSIONS) if (DEFINED ${_var}) string (REPLACE "\"" "\\\"" _value "${${_var}}") @@ -1986,20 +2118,15 @@ function (cotire_generate_target_script _language _configurations _targetSourceD endif() endif() endforeach() + # generate target script file get_filename_component(_moduleName "${COTIRE_CMAKE_MODULE_FILE}" NAME) set (_targetCotireScript "${CMAKE_CURRENT_BINARY_DIR}/${_target}_${_language}_${_moduleName}") cotire_write_file("CMAKE" "${_targetCotireScript}" "${_contents}" FALSE) if (_contentsHasGeneratorExpressions) # use file(GENERATE ...) to expand generator expressions in the target script at CMake generate-time - if (NOT CMAKE_VERSION VERSION_LESS "2.8.12") - # the file(GENERATE ...) command requires cmake 2.8.12 or later - set (_configNameOrNoneGeneratorExpression "$<$:None>$<$>:$>") - set (_targetCotireConfigScript "${CMAKE_CURRENT_BINARY_DIR}/${_target}_${_language}_${_configNameOrNoneGeneratorExpression}_${_moduleName}") - file (GENERATE OUTPUT "${_targetCotireConfigScript}" INPUT "${_targetCotireScript}") - else() - message (WARNING "cotire: generator expression used in target ${_target}. This requires CMake 2.8.12 or later.") - set (_targetCotireConfigScript "${_targetCotireScript}") - endif() + set (_configNameOrNoneGeneratorExpression "$<$:None>$<$>:$>") + set (_targetCotireConfigScript "${CMAKE_CURRENT_BINARY_DIR}/${_target}_${_language}_${_configNameOrNoneGeneratorExpression}_${_moduleName}") + file (GENERATE OUTPUT "${_targetCotireConfigScript}" INPUT "${_targetCotireScript}") else() set (_targetCotireConfigScript "${_targetCotireScript}") endif() @@ -2007,32 +2134,27 @@ function (cotire_generate_target_script _language _configurations _targetSourceD set (${_targetConfigScriptVar} "${_targetCotireConfigScript}" PARENT_SCOPE) endfunction() -function (cotire_setup_pch_file_compilation _language _target _targetSourceDir _targetScript _prefixFile _pchFile) +function (cotire_setup_pch_file_compilation _language _target _targetScript _prefixFile _pchFile _hostFile) set (_sourceFiles ${ARGN}) if (CMAKE_${_language}_COMPILER_ID MATCHES "MSVC|Intel") - # for Visual Studio and Intel, we attach the precompiled header compilation to the first source file + # for Visual Studio and Intel, we attach the precompiled header compilation to the host file # the remaining files include the precompiled header, see cotire_setup_pch_file_inclusion if (_sourceFiles) - file (TO_NATIVE_PATH "${_prefixFile}" _prefixFileNative) - file (TO_NATIVE_PATH "${_pchFile}" _pchFileNative) - list (GET _sourceFiles 0 _hostFile) set (_flags "") - cotire_determine_compiler_version("${_language}" COTIRE_${_language}_COMPILER) cotire_add_pch_compilation_flags( - "${_language}" "${CMAKE_${_language}_COMPILER_ID}" "${COTIRE_${_language}_COMPILER_VERSION}" + "${_language}" "${CMAKE_${_language}_COMPILER_ID}" "${CMAKE_${_language}_COMPILER_VERSION}" "${_prefixFile}" "${_pchFile}" "${_hostFile}" _flags) set_property (SOURCE ${_hostFile} APPEND_STRING PROPERTY COMPILE_FLAGS " ${_flags} ") set_property (SOURCE ${_hostFile} APPEND PROPERTY OBJECT_OUTPUTS "${_pchFile}") - # make first source file depend on prefix header + # make object file generated from host file depend on prefix header set_property (SOURCE ${_hostFile} APPEND PROPERTY OBJECT_DEPENDS "${_prefixFile}") - # mark first source file as cotired to prevent it from being used in another cotired target + # mark host file as cotired to prevent it from being used in another cotired target set_property (SOURCE ${_hostFile} PROPERTY COTIRE_TARGET "${_target}") endif() - elseif ("${CMAKE_GENERATOR}" MATCHES "Makefiles|Ninja") + elseif ("${CMAKE_GENERATOR}" MATCHES "Make|Ninja") # for makefile based generator, we add a custom command to precompile the prefix header if (_targetScript) cotire_set_cmd_to_prologue(_cmds) - list (GET _sourceFiles 0 _hostFile) list (APPEND _cmds -P "${COTIRE_CMAKE_MODULE_FILE}" "precompile" "${_targetScript}" "${_prefixFile}" "${_pchFile}" "${_hostFile}") file (RELATIVE_PATH _pchFileRelPath "${CMAKE_BINARY_DIR}" "${_pchFile}") if (COTIRE_DEBUG) @@ -2044,45 +2166,44 @@ function (cotire_setup_pch_file_compilation _language _target _targetSourceDir _ COMMAND ${_cmds} DEPENDS "${_prefixFile}" IMPLICIT_DEPENDS ${_language} "${_prefixFile}" - WORKING_DIRECTORY "${_targetSourceDir}" - COMMENT "Building ${_language} precompiled header ${_pchFileRelPath}" VERBATIM) + WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" + COMMENT "Building ${_language} precompiled header ${_pchFileRelPath}" + VERBATIM) endif() endif() endfunction() -function (cotire_setup_pch_file_inclusion _language _target _wholeTarget _prefixFile _pchFile) - set (_sourceFiles ${ARGN}) +function (cotire_setup_pch_file_inclusion _language _target _wholeTarget _prefixFile _pchFile _hostFile) if (CMAKE_${_language}_COMPILER_ID MATCHES "MSVC|Intel") - # for Visual Studio and Intel, we include the precompiled header in all but the first source file - # the first source file does the precompiled header compilation, see cotire_setup_pch_file_compilation + # for Visual Studio and Intel, we include the precompiled header in all but the host file + # the host file does the precompiled header compilation, see cotire_setup_pch_file_compilation + set (_sourceFiles ${ARGN}) list (LENGTH _sourceFiles _numberOfSourceFiles) - if (_numberOfSourceFiles GREATER 1) + if (_numberOfSourceFiles GREATER 0) # mark sources as cotired to prevent them from being used in another cotired target set_source_files_properties(${_sourceFiles} PROPERTIES COTIRE_TARGET "${_target}") - list (REMOVE_AT _sourceFiles 0) set (_flags "") - cotire_determine_compiler_version("${_language}" COTIRE_${_language}_COMPILER) cotire_add_prefix_pch_inclusion_flags( - "${_language}" "${CMAKE_${_language}_COMPILER_ID}" "${COTIRE_${_language}_COMPILER_VERSION}" + "${_language}" "${CMAKE_${_language}_COMPILER_ID}" "${CMAKE_${_language}_COMPILER_VERSION}" "${_prefixFile}" "${_pchFile}" _flags) set_property (SOURCE ${_sourceFiles} APPEND_STRING PROPERTY COMPILE_FLAGS " ${_flags} ") - # make source files depend on precompiled header + # make object files generated from source files depend on precompiled header set_property (SOURCE ${_sourceFiles} APPEND PROPERTY OBJECT_DEPENDS "${_pchFile}") endif() - elseif ("${CMAKE_GENERATOR}" MATCHES "Makefiles|Ninja") + elseif ("${CMAKE_GENERATOR}" MATCHES "Make|Ninja") + set (_sourceFiles ${_hostFile} ${ARGN}) if (NOT _wholeTarget) # for makefile based generator, we force the inclusion of the prefix header for a subset # of the source files, if this is a multi-language target or has excluded files set (_flags "") - cotire_determine_compiler_version("${_language}" COTIRE_${_language}_COMPILER) cotire_add_prefix_pch_inclusion_flags( - "${_language}" "${CMAKE_${_language}_COMPILER_ID}" "${COTIRE_${_language}_COMPILER_VERSION}" + "${_language}" "${CMAKE_${_language}_COMPILER_ID}" "${CMAKE_${_language}_COMPILER_VERSION}" "${_prefixFile}" "${_pchFile}" _flags) set_property (SOURCE ${_sourceFiles} APPEND_STRING PROPERTY COMPILE_FLAGS " ${_flags} ") # mark sources as cotired to prevent them from being used in another cotired target set_source_files_properties(${_sourceFiles} PROPERTIES COTIRE_TARGET "${_target}") endif() - # make source files depend on precompiled header + # make object files generated from source files depend on precompiled header set_property (SOURCE ${_sourceFiles} APPEND PROPERTY OBJECT_DEPENDS "${_pchFile}") endif() endfunction() @@ -2091,14 +2212,14 @@ function (cotire_setup_prefix_file_inclusion _language _target _prefixFile) set (_sourceFiles ${ARGN}) # force the inclusion of the prefix header for the given source files set (_flags "") - cotire_determine_compiler_version("${_language}" COTIRE_${_language}_COMPILER) + set (_pchFile "") cotire_add_prefix_pch_inclusion_flags( - "${_language}" "${CMAKE_${_language}_COMPILER_ID}" "${COTIRE_${_language}_COMPILER_VERSION}" - "${_prefixFile}" "" _flags) + "${_language}" "${CMAKE_${_language}_COMPILER_ID}" "${CMAKE_${_language}_COMPILER_VERSION}" + "${_prefixFile}" "${_pchFile}" _flags) set_property (SOURCE ${_sourceFiles} APPEND_STRING PROPERTY COMPILE_FLAGS " ${_flags} ") # mark sources as cotired to prevent them from being used in another cotired target set_source_files_properties(${_sourceFiles} PROPERTIES COTIRE_TARGET "${_target}") - # make source files depend on prefix header + # make object files generated from source files depend on prefix header set_property (SOURCE ${_sourceFiles} APPEND PROPERTY OBJECT_DEPENDS "${_prefixFile}") endfunction() @@ -2114,21 +2235,12 @@ function (cotire_get_first_set_property_value _propertyValueVar _type _object) set (${_propertyValueVar} "" PARENT_SCOPE) endfunction() -function (cotire_setup_combine_command _language _sourceDir _targetScript _joinedFile _cmdsVar) +function (cotire_setup_combine_command _language _targetScript _joinedFile _cmdsVar) set (_files ${ARGN}) set (_filesPaths "") foreach (_file ${_files}) - if (IS_ABSOLUTE "${_file}") - set (_filePath "${_file}") - else() - get_filename_component(_filePath "${_sourceDir}/${_file}" ABSOLUTE) - endif() - file (RELATIVE_PATH _fileRelPath "${_sourceDir}" "${_filePath}") - if (NOT IS_ABSOLUTE "${_fileRelPath}" AND NOT "${_fileRelPath}" MATCHES "^\\.\\.") - list (APPEND _filesPaths "${_fileRelPath}") - else() - list (APPEND _filesPaths "${_filePath}") - endif() + get_filename_component(_filePath "${_file}" ABSOLUTE) + list (APPEND _filesPaths "${_filePath}") endforeach() cotire_set_cmd_to_prologue(_prefixCmd) list (APPEND _prefixCmd -P "${COTIRE_CMAKE_MODULE_FILE}" "combine") @@ -2159,15 +2271,15 @@ function (cotire_setup_combine_command _language _sourceDir _targetScript _joine COMMAND ${_prefixCmd} DEPENDS ${_files} COMMENT "${_comment}" - WORKING_DIRECTORY "${_sourceDir}" VERBATIM) + WORKING_DIRECTORY "${CMAKE_BINARY_DIR}" + VERBATIM) list (APPEND ${_cmdsVar} COMMAND ${_prefixCmd}) set (${_cmdsVar} ${${_cmdsVar}} PARENT_SCOPE) endfunction() -function (cotire_setup_target_pch_usage _languages _targetSourceDir _target _wholeTarget) +function (cotire_setup_target_pch_usage _languages _target _wholeTarget) if (XCODE) # for Xcode, we attach a pre-build action to generate the unity sources and prefix headers - # if necessary, we also generate a single prefix header which includes all language specific prefix headers set (_prefixFiles "") foreach (_language ${_languages}) get_property(_prefixFile TARGET ${_target} PROPERTY COTIRE_${_language}_PREFIX_HEADER) @@ -2178,22 +2290,29 @@ function (cotire_setup_target_pch_usage _languages _targetSourceDir _target _who set (_cmds ${ARGN}) list (LENGTH _prefixFiles _numberOfPrefixFiles) if (_numberOfPrefixFiles GREATER 1) - cotire_make_prefix_file_path("" ${_target} _prefixHeader) - cotire_setup_combine_command("" "${_targetSourceDir}" "" "${_prefixHeader}" _cmds ${_prefixFiles}) + # we also generate a generic, single prefix header which includes all language specific prefix headers + set (_language "") + set (_targetScript "") + cotire_make_prefix_file_path("${_language}" ${_target} _prefixHeader) + cotire_setup_combine_command("${_language}" "${_targetScript}" "${_prefixHeader}" _cmds ${_prefixFiles}) else() set (_prefixHeader "${_prefixFiles}") endif() if (COTIRE_DEBUG) message (STATUS "add_custom_command: TARGET ${_target} PRE_BUILD ${_cmds}") endif() - add_custom_command(TARGET "${_target}" + # because CMake PRE_BUILD command does not support dependencies, + # we check dependencies explicity in cotire script mode when the pre-build action is run + add_custom_command( + TARGET "${_target}" PRE_BUILD ${_cmds} - WORKING_DIRECTORY "${_targetSourceDir}" - COMMENT "Updating target ${_target} prefix headers" VERBATIM) + WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" + COMMENT "Updating target ${_target} prefix headers" + VERBATIM) # make Xcode precompile the generated prefix header with ProcessPCH and ProcessPCH++ set_target_properties(${_target} PROPERTIES XCODE_ATTRIBUTE_GCC_PRECOMPILE_PREFIX_HEADER "YES") set_target_properties(${_target} PROPERTIES XCODE_ATTRIBUTE_GCC_PREFIX_HEADER "${_prefixHeader}") - elseif ("${CMAKE_GENERATOR}" MATCHES "Makefiles|Ninja") + elseif ("${CMAKE_GENERATOR}" MATCHES "Make|Ninja") # for makefile based generator, we force inclusion of the prefix header for all target source files # if this is a single-language target without any excluded files if (_wholeTarget) @@ -2203,24 +2322,22 @@ function (cotire_setup_target_pch_usage _languages _targetSourceDir _target _who if (NOT CMAKE_${_language}_COMPILER_ID MATCHES "MSVC|Intel") get_property(_prefixFile TARGET ${_target} PROPERTY COTIRE_${_language}_PREFIX_HEADER) if (_prefixFile) - set (_flags "") - cotire_determine_compiler_version("${_language}" COTIRE_${_language}_COMPILER) get_property(_pchFile TARGET ${_target} PROPERTY COTIRE_${_language}_PRECOMPILED_HEADER) + set (_options COMPILE_OPTIONS) cotire_add_prefix_pch_inclusion_flags( - "${_language}" "${CMAKE_${_language}_COMPILER_ID}" "${COTIRE_${_language}_COMPILER_VERSION}" - "${_prefixFile}" "${_pchFile}" _flags) - set_property(TARGET ${_target} APPEND_STRING PROPERTY COMPILE_FLAGS " ${_flags} ") + "${_language}" "${CMAKE_${_language}_COMPILER_ID}" "${CMAKE_${_language}_COMPILER_VERSION}" + "${_prefixFile}" "${_pchFile}" _options) + set_property(TARGET ${_target} APPEND PROPERTY ${_options}) endif() endif() endif() endif() endfunction() -function (cotire_setup_unity_generation_commands _language _targetSourceDir _target _targetScript _targetConfigScript _unityFiles _cmdsVar) +function (cotire_setup_unity_generation_commands _language _target _targetScript _targetConfigScript _unityFiles _cmdsVar) set (_dependencySources "") cotire_get_unity_source_dependencies(${_language} ${_target} _dependencySources ${ARGN}) foreach (_unityFile ${_unityFiles}) - file (RELATIVE_PATH _unityFileRelPath "${CMAKE_BINARY_DIR}" "${_unityFile}") set_property (SOURCE "${_unityFile}" PROPERTY GENERATED TRUE) # set up compiled unity source dependencies via OBJECT_DEPENDS # this ensures that missing source files are generated before the unity file is compiled @@ -2248,6 +2365,7 @@ function (cotire_setup_unity_generation_commands _language _targetSourceDir _tar # CMake 3.1.0 supports generator expressions in arguments to DEPENDS set (_unityCmdDepends "${_targetConfigScript}") endif() + file (RELATIVE_PATH _unityFileRelPath "${CMAKE_BINARY_DIR}" "${_unityFile}") if (COTIRE_DEBUG) message (STATUS "add_custom_command: OUTPUT ${_unityFile} COMMAND ${_unityCmd} DEPENDS ${_unityCmdDepends}") endif() @@ -2256,24 +2374,19 @@ function (cotire_setup_unity_generation_commands _language _targetSourceDir _tar COMMAND ${_unityCmd} DEPENDS ${_unityCmdDepends} COMMENT "Generating ${_language} unity source ${_unityFileRelPath}" - WORKING_DIRECTORY "${_targetSourceDir}" VERBATIM) + WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" + VERBATIM) list (APPEND ${_cmdsVar} COMMAND ${_unityCmd}) endforeach() - list (LENGTH _unityFiles _numberOfUnityFiles) - if (_numberOfUnityFiles GREATER 1) - # create a joint unity file from all unity file segments - cotire_make_single_unity_source_file_path(${_language} ${_target} _unityFile) - cotire_setup_combine_command(${_language} "${_targetSourceDir}" "${_targetConfigScript}" "${_unityFile}" ${_cmdsVar} ${_unityFiles}) - endif() set (${_cmdsVar} ${${_cmdsVar}} PARENT_SCOPE) endfunction() -function (cotire_setup_prefix_generation_command _language _target _targetSourceDir _targetScript _prefixFile _unityFile _cmdsVar) +function (cotire_setup_prefix_generation_command _language _target _targetScript _prefixFile _unityFiles _cmdsVar) set (_sourceFiles ${ARGN}) set (_dependencySources "") cotire_get_prefix_header_dependencies(${_language} ${_target} _dependencySources ${_sourceFiles}) cotire_set_cmd_to_prologue(_prefixCmd) - list (APPEND _prefixCmd -P "${COTIRE_CMAKE_MODULE_FILE}" "prefix" "${_targetScript}" "${_prefixFile}" "${_unityFile}") + list (APPEND _prefixCmd -P "${COTIRE_CMAKE_MODULE_FILE}" "prefix" "${_targetScript}" "${_prefixFile}" ${_unityFiles}) set_property (SOURCE "${_prefixFile}" PROPERTY GENERATED TRUE) if (COTIRE_DEBUG) message (STATUS "add_custom_command: OUTPUT ${_prefixFile} COMMAND ${_prefixCmd} DEPENDS ${_unityFile} ${_dependencySources}") @@ -2285,17 +2398,34 @@ function (cotire_setup_prefix_generation_command _language _target _targetSource else() set (_comment "Generating ${_language} prefix header ${_prefixFileRelPath}") endif() + # prevent pre-processing errors upon generating the prefix header when a target's generated include file does not yet exist + # we do not add a file-level dependency for the target's generated files though, because we only want to depend on their existence + # thus we make the prefix header generation depend on a custom helper target which triggers the generation of the files + set (_preTargetName "${_target}${COTIRE_PCH_TARGET_SUFFIX}_pre") + if (TARGET ${_preTargetName}) + # custom helper target has already been generated while processing a different language + list (APPEND _dependencySources ${_preTargetName}) + else() + get_target_property(_targetSourceFiles ${_target} SOURCES) + cotire_get_objects_with_property_on(_generatedSources GENERATED SOURCE ${_targetSourceFiles}) + if (_generatedSources) + add_custom_target("${_preTargetName}" DEPENDS ${_generatedSources}) + cotire_init_target("${_preTargetName}") + list (APPEND _dependencySources ${_preTargetName}) + endif() + endif() add_custom_command( OUTPUT "${_prefixFile}" "${_prefixFile}.log" COMMAND ${_prefixCmd} - DEPENDS "${_unityFile}" ${_dependencySources} + DEPENDS ${_unityFiles} ${_dependencySources} COMMENT "${_comment}" - WORKING_DIRECTORY "${CMAKE_BINARY_DIR}" VERBATIM) + WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" + VERBATIM) list (APPEND ${_cmdsVar} COMMAND ${_prefixCmd}) set (${_cmdsVar} ${${_cmdsVar}} PARENT_SCOPE) endfunction() -function (cotire_setup_prefix_generation_from_unity_command _language _target _targetSourceDir _targetScript _prefixFile _unityFiles _cmdsVar) +function (cotire_setup_prefix_generation_from_unity_command _language _target _targetScript _prefixFile _unityFiles _cmdsVar) set (_sourceFiles ${ARGN}) if (CMAKE_${_language}_COMPILER_ID MATCHES "GNU|Clang") # GNU and Clang require indirect compilation of the prefix header to make them honor the system_header pragma @@ -2303,24 +2433,17 @@ function (cotire_setup_prefix_generation_from_unity_command _language _target _t else() set (_prefixSourceFile "${_prefixFile}") endif() - list (LENGTH _unityFiles _numberOfUnityFiles) - if (_numberOfUnityFiles GREATER 1) - cotire_make_single_unity_source_file_path(${_language} ${_target} _unityFile) - cotire_setup_prefix_generation_command( - ${_language} ${_target} "${_targetSourceDir}" "${_targetScript}" - "${_prefixSourceFile}" "${_unityFile}" ${_cmdsVar} ${_sourceFiles}) - else() - cotire_setup_prefix_generation_command( - ${_language} ${_target} "${_targetSourceDir}" "${_targetScript}" - "${_prefixSourceFile}" "${_unityFiles}" ${_cmdsVar} ${_sourceFiles}) - endif() + cotire_setup_prefix_generation_command( + ${_language} ${_target} "${_targetScript}" + "${_prefixSourceFile}" "${_unityFiles}" ${_cmdsVar} ${_sourceFiles}) if (CMAKE_${_language}_COMPILER_ID MATCHES "GNU|Clang") - cotire_setup_combine_command(${_language} "${_targetSourceDir}" "${_targetScript}" "${_prefixFile}" ${_cmdsVar} ${_prefixSourceFile}) + # set up generation of a prefix source file which includes the prefix header + cotire_setup_combine_command(${_language} "${_targetScript}" "${_prefixFile}" _cmds ${_prefixSourceFile}) endif() set (${_cmdsVar} ${${_cmdsVar}} PARENT_SCOPE) endfunction() -function (cotire_setup_prefix_generation_from_provided_command _language _target _targetSourceDir _targetScript _prefixFile _cmdsVar) +function (cotire_setup_prefix_generation_from_provided_command _language _target _targetScript _prefixFile _cmdsVar) set (_prefixHeaderFiles ${ARGN}) if (CMAKE_${_language}_COMPILER_ID MATCHES "GNU|Clang") # GNU and Clang require indirect compilation of the prefix header to make them honor the system_header pragma @@ -2328,9 +2451,10 @@ function (cotire_setup_prefix_generation_from_provided_command _language _target else() set (_prefixSourceFile "${_prefixFile}") endif() - cotire_setup_combine_command(${_language} "${_targetSourceDir}" "${_targetScript}" "${_prefixSourceFile}" _cmds ${_prefixHeaderFiles}) + cotire_setup_combine_command(${_language} "${_targetScript}" "${_prefixSourceFile}" _cmds ${_prefixHeaderFiles}) if (CMAKE_${_language}_COMPILER_ID MATCHES "GNU|Clang") - cotire_setup_combine_command(${_language} "${_targetSourceDir}" "${_targetScript}" "${_prefixFile}" _cmds ${_prefixSourceFile}) + # set up generation of a prefix source file which includes the prefix header + cotire_setup_combine_command(${_language} "${_targetScript}" "${_prefixFile}" _cmds ${_prefixSourceFile}) endif() set (${_cmdsVar} ${${_cmdsVar}} PARENT_SCOPE) endfunction() @@ -2360,6 +2484,10 @@ function (cotire_init_cotire_target_properties _target) if (NOT _isSet) set_property(TARGET ${_target} PROPERTY COTIRE_PREFIX_HEADER_INCLUDE_PATH "") endif() + get_property(_isSet TARGET ${_target} PROPERTY COTIRE_PREFIX_HEADER_INCLUDE_PRIORITY_PATH SET) + if (NOT _isSet) + set_property(TARGET ${_target} PROPERTY COTIRE_PREFIX_HEADER_INCLUDE_PRIORITY_PATH "") + endif() get_property(_isSet TARGET ${_target} PROPERTY COTIRE_UNITY_SOURCE_PRE_UNDEFS SET) if (NOT _isSet) set_property(TARGET ${_target} PROPERTY COTIRE_UNITY_SOURCE_PRE_UNDEFS "") @@ -2370,7 +2498,7 @@ function (cotire_init_cotire_target_properties _target) endif() get_property(_isSet TARGET ${_target} PROPERTY COTIRE_UNITY_LINK_LIBRARIES_INIT SET) if (NOT _isSet) - set_property(TARGET ${_target} PROPERTY COTIRE_UNITY_LINK_LIBRARIES_INIT "") + set_property(TARGET ${_target} PROPERTY COTIRE_UNITY_LINK_LIBRARIES_INIT "COPY_UNITY") endif() get_property(_isSet TARGET ${_target} PROPERTY COTIRE_UNITY_SOURCE_MAXIMUM_NUMBER_OF_INCLUDES SET) if (NOT _isSet) @@ -2430,7 +2558,7 @@ function (cotire_make_target_message _target _languages _disableMsg _targetMsgVa set (${_targetMsgVar} "${_targetMsg}" PARENT_SCOPE) endfunction() -function (cotire_choose_target_languages _targetSourceDir _target _targetLanguagesVar _wholeTargetVar) +function (cotire_choose_target_languages _target _targetLanguagesVar _wholeTargetVar) set (_languages ${ARGN}) set (_allSourceFiles "") set (_allExcludedSourceFiles "") @@ -2451,7 +2579,7 @@ function (cotire_choose_target_languages _targetSourceDir _target _targetLanguag return() endif() if (_targetUsePCH AND "${_language}" MATCHES "^C|CXX$") - cotire_check_precompiled_header_support("${_language}" "${_targetSourceDir}" "${_target}" _disableMsg) + cotire_check_precompiled_header_support("${_language}" "${_target}" _disableMsg) if (_disableMsg) set (_targetUsePCH FALSE) endif() @@ -2459,7 +2587,7 @@ function (cotire_choose_target_languages _targetSourceDir _target _targetLanguag set (_sourceFiles "") set (_excludedSources "") set (_cotiredSources "") - cotire_filter_language_source_files(${_language} _sourceFiles _excludedSources _cotiredSources ${_targetSourceFiles}) + cotire_filter_language_source_files(${_language} ${_target} _sourceFiles _excludedSources _cotiredSources ${_targetSourceFiles}) if (_sourceFiles OR _excludedSources OR _cotiredSources) list (APPEND _targetLanguages ${_language}) endif() @@ -2541,26 +2669,22 @@ function (cotire_compute_unity_max_number_of_includes _target _maxIncludesVar) endif() list (LENGTH _sourceFiles _numberOfSources) math (EXPR _maxIncludes "(${_numberOfSources} + ${_numberOfThreads} - 1) / ${_numberOfThreads}") - # a unity source segment must not contain less than COTIRE_MINIMUM_NUMBER_OF_TARGET_SOURCES files - if (_maxIncludes LESS ${COTIRE_MINIMUM_NUMBER_OF_TARGET_SOURCES}) - set (_maxIncludes ${COTIRE_MINIMUM_NUMBER_OF_TARGET_SOURCES}) - endif() elseif (NOT _maxIncludes MATCHES "[0-9]+") set (_maxIncludes 0) endif() if (COTIRE_DEBUG) - message (STATUS "${_target} unity source max includes = ${_maxIncludes}") + message (STATUS "${_target} unity source max includes: ${_maxIncludes}") endif() set (${_maxIncludesVar} ${_maxIncludes} PARENT_SCOPE) endfunction() -function (cotire_process_target_language _language _configurations _targetSourceDir _targetBinaryDir _target _wholeTarget _cmdsVar) +function (cotire_process_target_language _language _configurations _target _wholeTarget _cmdsVar) set (${_cmdsVar} "" PARENT_SCOPE) get_target_property(_targetSourceFiles ${_target} SOURCES) set (_sourceFiles "") set (_excludedSources "") set (_cotiredSources "") - cotire_filter_language_source_files(${_language} _sourceFiles _excludedSources _cotiredSources ${_targetSourceFiles}) + cotire_filter_language_source_files(${_language} ${_target} _sourceFiles _excludedSources _cotiredSources ${_targetSourceFiles}) if (NOT _sourceFiles AND NOT _cotiredSources) return() endif() @@ -2571,24 +2695,32 @@ function (cotire_process_target_language _language _configurations _targetSource set (_unitySourceFiles ${_sourceFiles} ${_cotiredSources}) endif() cotire_generate_target_script( - ${_language} "${_configurations}" "${_targetSourceDir}" "${_targetBinaryDir}" ${_target} _targetScript _targetConfigScript ${_unitySourceFiles}) + ${_language} "${_configurations}" ${_target} _targetScript _targetConfigScript ${_unitySourceFiles}) + # set up unity files for parallel compilation cotire_compute_unity_max_number_of_includes(${_target} _maxIncludes ${_unitySourceFiles}) cotire_make_unity_source_file_paths(${_language} ${_target} ${_maxIncludes} _unityFiles ${_unitySourceFiles}) - if (NOT _unityFiles) + list (LENGTH _unityFiles _numberOfUnityFiles) + if (_numberOfUnityFiles EQUAL 0) return() + elseif (_numberOfUnityFiles GREATER 1) + cotire_setup_unity_generation_commands( + ${_language} ${_target} "${_targetScript}" "${_targetConfigScript}" "${_unityFiles}" _cmds ${_unitySourceFiles}) endif() + # set up single unity file for prefix header generation + cotire_make_single_unity_source_file_path(${_language} ${_target} _unityFile) cotire_setup_unity_generation_commands( - ${_language} "${_targetSourceDir}" ${_target} "${_targetScript}" "${_targetConfigScript}" "${_unityFiles}" _cmds ${_unitySourceFiles}) + ${_language} ${_target} "${_targetScript}" "${_targetConfigScript}" "${_unityFile}" _cmds ${_unitySourceFiles}) cotire_make_prefix_file_path(${_language} ${_target} _prefixFile) + # set up prefix header if (_prefixFile) # check for user provided prefix header files get_property(_prefixHeaderFiles TARGET ${_target} PROPERTY COTIRE_${_language}_PREFIX_HEADER_INIT) if (_prefixHeaderFiles) cotire_setup_prefix_generation_from_provided_command( - ${_language} ${_target} "${_targetSourceDir}" "${_targetConfigScript}" "${_prefixFile}" _cmds ${_prefixHeaderFiles}) + ${_language} ${_target} "${_targetConfigScript}" "${_prefixFile}" _cmds ${_prefixHeaderFiles}) else() cotire_setup_prefix_generation_from_unity_command( - ${_language} ${_target} "${_targetSourceDir}" "${_targetConfigScript}" "${_prefixFile}" "${_unityFiles}" _cmds ${_unitySourceFiles}) + ${_language} ${_target} "${_targetConfigScript}" "${_prefixFile}" "${_unityFile}" _cmds ${_unitySourceFiles}) endif() # check if selected language has enough sources at all list (LENGTH _sourceFiles _numberOfSources) @@ -2598,10 +2730,11 @@ function (cotire_process_target_language _language _configurations _targetSource get_target_property(_targetUsePCH ${_target} COTIRE_ENABLE_PRECOMPILED_HEADER) endif() if (_targetUsePCH) - cotire_make_pch_file_path(${_language} "${_targetSourceDir}" ${_target} _pchFile) + cotire_make_pch_file_path(${_language} ${_target} _pchFile) if (_pchFile) + # first file in _sourceFiles is passed as the host file cotire_setup_pch_file_compilation( - ${_language} ${_target} "${_targetSourceDir}" "${_targetConfigScript}" "${_prefixFile}" "${_pchFile}" ${_sourceFiles}) + ${_language} ${_target} "${_targetConfigScript}" "${_prefixFile}" "${_pchFile}" ${_sourceFiles}) cotire_setup_pch_file_inclusion( ${_language} ${_target} ${_wholeTarget} "${_prefixFile}" "${_pchFile}" ${_sourceFiles}) endif() @@ -2627,14 +2760,17 @@ function (cotire_setup_clean_target _target) cotire_set_cmd_to_prologue(_cmds) get_filename_component(_outputDir "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}" ABSOLUTE) list (APPEND _cmds -P "${COTIRE_CMAKE_MODULE_FILE}" "cleanup" "${_outputDir}" "${COTIRE_INTDIR}" "${_target}") - add_custom_target(${_cleanTargetName} COMMAND ${_cmds} WORKING_DIRECTORY "${CMAKE_BINARY_DIR}" - COMMENT "Cleaning up target ${_target} cotire generated files" VERBATIM) + add_custom_target(${_cleanTargetName} + COMMAND ${_cmds} + WORKING_DIRECTORY "${CMAKE_BINARY_DIR}" + COMMENT "Cleaning up target ${_target} cotire generated files" + VERBATIM) cotire_init_target("${_cleanTargetName}") endif() endfunction() function (cotire_setup_pch_target _languages _configurations _target) - if ("${CMAKE_GENERATOR}" MATCHES "Makefiles|Ninja") + if ("${CMAKE_GENERATOR}" MATCHES "Make|Ninja") # for makefile based generators, we add a custom target to trigger the generation of the cotire related files set (_dependsFiles "") foreach (_language ${_languages}) @@ -2660,22 +2796,7 @@ function (cotire_setup_pch_target _languages _configurations _target) endif() endfunction() -function (cotire_setup_unity_build_target _languages _configurations _targetSourceDir _target) - get_target_property(_unityTargetName ${_target} COTIRE_UNITY_TARGET_NAME) - if (NOT _unityTargetName) - set (_unityTargetName "${_target}${COTIRE_UNITY_BUILD_TARGET_SUFFIX}") - endif() - # determine unity target sub type - get_target_property(_targetType ${_target} TYPE) - if ("${_targetType}" STREQUAL "EXECUTABLE") - set (_unityTargetSubType "") - elseif (_targetType MATCHES "(STATIC|SHARED|MODULE|OBJECT)_LIBRARY") - set (_unityTargetSubType "${CMAKE_MATCH_1}") - else() - message (WARNING "cotire: target ${_target} has unknown target type ${_targetType}.") - return() - endif() - # determine unity target sources +function (cotire_collect_unity_target_sources _target _languages _unityTargetSourcesVar) get_target_property(_targetSourceFiles ${_target} SOURCES) set (_unityTargetSources ${_targetSourceFiles}) foreach (_language ${_languages}) @@ -2685,32 +2806,65 @@ function (cotire_setup_unity_build_target _languages _configurations _targetSour set (_sourceFiles "") set (_excludedSources "") set (_cotiredSources "") - cotire_filter_language_source_files(${_language} _sourceFiles _excludedSources _cotiredSources ${_targetSourceFiles}) + cotire_filter_language_source_files(${_language} ${_target} _sourceFiles _excludedSources _cotiredSources ${_targetSourceFiles}) if (_sourceFiles OR _cotiredSources) list (REMOVE_ITEM _unityTargetSources ${_sourceFiles} ${_cotiredSources}) endif() - # if cotire is applied to a target which has not been added in the current source dir, - # non-existing files cannot be referenced from the unity build target (this is a CMake restriction) - if (NOT "${_targetSourceDir}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}") - set (_nonExistingFiles "") - foreach (_file ${_unityTargetSources}) - if (NOT EXISTS "${_file}") - list (APPEND _nonExistingFiles "${_file}") - endif() - endforeach() - if (_nonExistingFiles) - if (COTIRE_VERBOSE) - message (STATUS "removing non-existing ${_nonExistingFiles} from ${_unityTargetName}") - endif() - list (REMOVE_ITEM _unityTargetSources ${_nonExistingFiles}) - endif() - endif() # add unity source files instead list (APPEND _unityTargetSources ${_unityFiles}) endif() endforeach() + set (${_unityTargetSourcesVar} ${_unityTargetSources} PARENT_SCOPE) +endfunction() + +function (cotire_setup_unity_target_pch_usage _languages _target) + foreach (_language ${_languages}) + get_property(_unityFiles TARGET ${_target} PROPERTY COTIRE_${_language}_UNITY_SOURCE) + if (_unityFiles) + get_property(_userPrefixFile TARGET ${_target} PROPERTY COTIRE_${_language}_PREFIX_HEADER_INIT) + get_property(_prefixFile TARGET ${_target} PROPERTY COTIRE_${_language}_PREFIX_HEADER) + if (_userPrefixFile AND _prefixFile) + # user provided prefix header must be included unconditionally by unity sources + cotire_setup_prefix_file_inclusion(${_language} ${_target} "${_prefixFile}" ${_unityFiles}) + endif() + endif() + endforeach() +endfunction() + +function (cotire_setup_unity_build_target _languages _configurations _target) + get_target_property(_unityTargetName ${_target} COTIRE_UNITY_TARGET_NAME) + if (NOT _unityTargetName) + set (_unityTargetName "${_target}${COTIRE_UNITY_BUILD_TARGET_SUFFIX}") + endif() + # determine unity target sub type + get_target_property(_targetType ${_target} TYPE) + if ("${_targetType}" STREQUAL "EXECUTABLE") + set (_unityTargetSubType "") + elseif (_targetType MATCHES "(STATIC|SHARED|MODULE|OBJECT)_LIBRARY") + set (_unityTargetSubType "${CMAKE_MATCH_1}") + else() + message (WARNING "cotire: target ${_target} has unknown target type ${_targetType}.") + return() + endif() + # determine unity target sources + set (_unityTargetSources "") + cotire_collect_unity_target_sources(${_target} "${_languages}" _unityTargetSources) + # handle automatic Qt processing + get_target_property(_targetAutoMoc ${_target} AUTOMOC) + get_target_property(_targetAutoUic ${_target} AUTOUIC) + get_target_property(_targetAutoRcc ${_target} AUTORCC) + if (_targetAutoMoc OR _targetAutoUic OR _targetAutoRcc) + # if the original target sources are subject to CMake's automatic Qt processing, + # also include implicitly generated _automoc.cpp file + list (APPEND _unityTargetSources "${_target}_automoc.cpp") + set_property (SOURCE "${_target}_automoc.cpp" PROPERTY GENERATED TRUE) + endif() + # prevent AUTOMOC, AUTOUIC and AUTORCC properties from being set when the unity target is created + set (CMAKE_AUTOMOC OFF) + set (CMAKE_AUTOUIC OFF) + set (CMAKE_AUTORCC OFF) if (COTIRE_DEBUG) - message (STATUS "add ${_targetType} ${_unityTargetName} ${_unityTargetSubType} EXCLUDE_FROM_ALL ${_unityTargetSources}") + message (STATUS "add target ${_targetType} ${_unityTargetName} ${_unityTargetSubType} EXCLUDE_FROM_ALL ${_unityTargetSources}") endif() # generate unity target if ("${_targetType}" STREQUAL "EXECUTABLE") @@ -2718,16 +2872,21 @@ function (cotire_setup_unity_build_target _languages _configurations _targetSour else() add_library(${_unityTargetName} ${_unityTargetSubType} EXCLUDE_FROM_ALL ${_unityTargetSources}) endif() + if (_targetAutoMoc OR _targetAutoUic OR _targetAutoRcc) + # depend on the original target's implicity generated _automoc target + add_dependencies(${_unityTargetName} ${_target}_automoc) + endif() + # copy output location properties set (_outputDirProperties ARCHIVE_OUTPUT_DIRECTORY ARCHIVE_OUTPUT_DIRECTORY_ LIBRARY_OUTPUT_DIRECTORY LIBRARY_OUTPUT_DIRECTORY_ RUNTIME_OUTPUT_DIRECTORY RUNTIME_OUTPUT_DIRECTORY_) - # copy output location properties if (COTIRE_UNITY_OUTPUT_DIRECTORY) set (_setDefaultOutputDir TRUE) if (IS_ABSOLUTE "${COTIRE_UNITY_OUTPUT_DIRECTORY}") set (_outputDir "${COTIRE_UNITY_OUTPUT_DIRECTORY}") else() + # append relative COTIRE_UNITY_OUTPUT_DIRECTORY to target's actual output directory cotire_copy_set_properites("${_configurations}" TARGET ${_target} ${_unityTargetName} ${_outputDirProperties}) cotire_resolve_config_properites("${_configurations}" _properties ${_outputDirProperties}) foreach (_property ${_properties}) @@ -2749,7 +2908,8 @@ function (cotire_setup_unity_build_target _languages _configurations _targetSour RUNTIME_OUTPUT_DIRECTORY "${_outputDir}") endif() else() - cotire_copy_set_properites("${_configurations}" TARGET ${_target} ${_unityTargetName} ${_outputDirProperties}) + cotire_copy_set_properites("${_configurations}" TARGET ${_target} ${_unityTargetName} + ${_outputDirProperties}) endif() # copy output name cotire_copy_set_properites("${_configurations}" TARGET ${_target} ${_unityTargetName} @@ -2767,13 +2927,22 @@ function (cotire_setup_unity_build_target _languages _configurations _targetSour INCLUDE_DIRECTORIES INTERPROCEDURAL_OPTIMIZATION INTERPROCEDURAL_OPTIMIZATION_ POSITION_INDEPENDENT_CODE + C_COMPILER_LAUNCHER CXX_COMPILER_LAUNCHER + C_INCLUDE_WHAT_YOU_USE CXX_INCLUDE_WHAT_YOU_USE C_VISIBILITY_PRESET CXX_VISIBILITY_PRESET VISIBILITY_INLINES_HIDDEN) + # copy compile features + cotire_copy_set_properites("${_configurations}" TARGET ${_target} ${_unityTargetName} + C_EXTENSIONS C_STANDARD C_STANDARD_REQUIRED + CXX_EXTENSIONS CXX_STANDARD CXX_STANDARD_REQUIRED + COMPILE_FEATURES) # copy interface stuff cotire_copy_set_properites("${_configurations}" TARGET ${_target} ${_unityTargetName} - COMPATIBLE_INTERFACE_BOOL COMPATIBLE_INTERFACE_NUMBER_MAX COMPATIBLE_INTERFACE_NUMBER_MIN COMPATIBLE_INTERFACE_STRING - INTERFACE_COMPILE_DEFINITIONS INTERFACE_COMPILE_OPTIONS INTERFACE_INCLUDE_DIRECTORIES + COMPATIBLE_INTERFACE_BOOL COMPATIBLE_INTERFACE_NUMBER_MAX COMPATIBLE_INTERFACE_NUMBER_MIN + COMPATIBLE_INTERFACE_STRING + INTERFACE_COMPILE_DEFINITIONS INTERFACE_COMPILE_FEATURES INTERFACE_COMPILE_OPTIONS + INTERFACE_INCLUDE_DIRECTORIES INTERFACE_SOURCES INTERFACE_POSITION_INDEPENDENT_CODE INTERFACE_SYSTEM_INCLUDE_DIRECTORIES - INTERFACE_AUTOUIC_OPTIONS) + INTERFACE_AUTOUIC_OPTIONS NO_SYSTEM_FROM_IMPORTED) # copy link stuff cotire_copy_set_properites("${_configurations}" TARGET ${_target} ${_unityTargetName} BUILD_WITH_INSTALL_RPATH INSTALL_RPATH INSTALL_RPATH_USE_LINK_PATH SKIP_BUILD_RPATH @@ -2784,24 +2953,36 @@ function (cotire_setup_unity_build_target _languages _configurations _targetSour LINK_SEARCH_START_STATIC LINK_SEARCH_END_STATIC STATIC_LIBRARY_FLAGS STATIC_LIBRARY_FLAGS_ NO_SONAME SOVERSION VERSION) - # copy Qt stuff - cotire_copy_set_properites("${_configurations}" TARGET ${_target} ${_unityTargetName} - AUTOMOC AUTOMOC_MOC_OPTIONS AUTOUIC AUTOUIC_OPTIONS AUTORCC AUTORCC_OPTIONS - AUTOGEN_TARGET_DEPENDS) # copy cmake stuff cotire_copy_set_properites("${_configurations}" TARGET ${_target} ${_unityTargetName} IMPLICIT_DEPENDS_INCLUDE_TRANSFORM RULE_LAUNCH_COMPILE RULE_LAUNCH_CUSTOM RULE_LAUNCH_LINK) # copy Apple platform specific stuff cotire_copy_set_properites("${_configurations}" TARGET ${_target} ${_unityTargetName} - BUNDLE BUNDLE_EXTENSION FRAMEWORK INSTALL_NAME_DIR MACOSX_BUNDLE MACOSX_BUNDLE_INFO_PLIST MACOSX_FRAMEWORK_INFO_PLIST - MACOSX_RPATH OSX_ARCHITECTURES OSX_ARCHITECTURES_ PRIVATE_HEADER PUBLIC_HEADER RESOURCE) + BUNDLE BUNDLE_EXTENSION FRAMEWORK FRAMEWORK_VERSION INSTALL_NAME_DIR + MACOSX_BUNDLE MACOSX_BUNDLE_INFO_PLIST MACOSX_FRAMEWORK_INFO_PLIST MACOSX_RPATH + OSX_ARCHITECTURES OSX_ARCHITECTURES_ PRIVATE_HEADER PUBLIC_HEADER RESOURCE XCTEST) # copy Windows platform specific stuff cotire_copy_set_properites("${_configurations}" TARGET ${_target} ${_unityTargetName} GNUtoMS + COMPILE_PDB_NAME COMPILE_PDB_NAME_ + COMPILE_PDB_OUTPUT_DIRECTORY COMPILE_PDB_OUTPUT_DIRECTORY_ PDB_NAME PDB_NAME_ PDB_OUTPUT_DIRECTORY PDB_OUTPUT_DIRECTORY_ - VS_DOTNET_REFERENCES VS_GLOBAL_KEYWORD VS_GLOBAL_PROJECT_TYPES VS_GLOBAL_ROOTNAMESPACE VS_KEYWORD + VS_DESKTOP_EXTENSIONS_VERSION VS_DOTNET_REFERENCES VS_DOTNET_TARGET_FRAMEWORK_VERSION + VS_GLOBAL_KEYWORD VS_GLOBAL_PROJECT_TYPES VS_GLOBAL_ROOTNAMESPACE + VS_IOT_EXTENSIONS_VERSION VS_IOT_STARTUP_TASK + VS_KEYWORD VS_MOBILE_EXTENSIONS_VERSION VS_SCC_AUXPATH VS_SCC_LOCALPATH VS_SCC_PROJECTNAME VS_SCC_PROVIDER - VS_WINRT_EXTENSIONS VS_WINRT_REFERENCES WIN32_EXECUTABLE) + VS_WINDOWS_TARGET_PLATFORM_MIN_VERSION + VS_WINRT_COMPONENT VS_WINRT_EXTENSIONS VS_WINRT_REFERENCES + WIN32_EXECUTABLE WINDOWS_EXPORT_ALL_SYMBOLS) + # copy Android platform specific stuff + cotire_copy_set_properites("${_configurations}" TARGET ${_target} ${_unityTargetName} + ANDROID_API ANDROID_API_MIN ANDROID_GUI + ANDROID_ANT_ADDITIONAL_OPTIONS ANDROID_ARCH ANDROID_ASSETS_DIRECTORIES + ANDROID_JAR_DEPENDENCIES ANDROID_JAR_DIRECTORIES ANDROID_JAVA_SOURCE_DIR + ANDROID_NATIVE_LIB_DEPENDENCIES ANDROID_NATIVE_LIB_DIRECTORIES + ANDROID_PROCESS_MAX ANDROID_PROGUARD ANDROID_PROGUARD_CONFIG_PATH + ANDROID_SECURE_PROPS_PATH ANDROID_SKIP_ANT_STEP ANDROID_STL_TYPE) # use output name from original target get_target_property(_targetOutputName ${_unityTargetName} OUTPUT_NAME) if (NOT _targetOutputName) @@ -2822,15 +3003,9 @@ endfunction(cotire_setup_unity_build_target) function (cotire_target _target) set(_options "") - set(_oneValueArgs SOURCE_DIR BINARY_DIR) + set(_oneValueArgs "") set(_multiValueArgs LANGUAGES CONFIGURATIONS) cmake_parse_arguments(_option "${_options}" "${_oneValueArgs}" "${_multiValueArgs}" ${ARGN}) - if (NOT _option_SOURCE_DIR) - set (_option_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}") - endif() - if (NOT _option_BINARY_DIR) - set (_option_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}") - endif() if (NOT _option_LANGUAGES) get_property (_option_LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES) endif() @@ -2867,27 +3042,34 @@ function (cotire_target _target) return() endif() endif() + # when not using configuration types, immediately create cotire intermediate dir + if (NOT CMAKE_CONFIGURATION_TYPES) + cotire_get_intermediate_dir(_baseDir) + file (MAKE_DIRECTORY "${_baseDir}") + endif() # choose languages that apply to the target - cotire_choose_target_languages("${_option_SOURCE_DIR}" "${_target}" _targetLanguages _wholeTarget ${_option_LANGUAGES}) + cotire_choose_target_languages("${_target}" _targetLanguages _wholeTarget ${_option_LANGUAGES}) if (NOT _targetLanguages) return() endif() set (_cmds "") foreach (_language ${_targetLanguages}) - cotire_process_target_language("${_language}" "${_option_CONFIGURATIONS}" - "${_option_SOURCE_DIR}" "${_option_BINARY_DIR}" ${_target} ${_wholeTarget} _cmd) + cotire_process_target_language("${_language}" "${_option_CONFIGURATIONS}" ${_target} ${_wholeTarget} _cmd) if (_cmd) list (APPEND _cmds ${_cmd}) endif() endforeach() get_target_property(_targetAddSCU ${_target} COTIRE_ADD_UNITY_BUILD) if (_targetAddSCU) - cotire_setup_unity_build_target("${_targetLanguages}" "${_option_CONFIGURATIONS}" "${_option_SOURCE_DIR}" ${_target}) + cotire_setup_unity_build_target("${_targetLanguages}" "${_option_CONFIGURATIONS}" ${_target}) endif() get_target_property(_targetUsePCH ${_target} COTIRE_ENABLE_PRECOMPILED_HEADER) if (_targetUsePCH) - cotire_setup_target_pch_usage("${_targetLanguages}" "${_option_SOURCE_DIR}" ${_target} ${_wholeTarget} ${_cmds}) + cotire_setup_target_pch_usage("${_targetLanguages}" ${_target} ${_wholeTarget} ${_cmds}) cotire_setup_pch_target("${_targetLanguages}" "${_option_CONFIGURATIONS}" ${_target}) + if (_targetAddSCU) + cotire_setup_unity_target_pch_usage("${_targetLanguages}" ${_target}) + endif() endif() get_target_property(_targetAddCleanTarget ${_target} COTIRE_ADD_CLEAN) if (_targetAddCleanTarget) @@ -2922,25 +3104,21 @@ function (cotire_target_link_libraries _target) message (STATUS "unity target ${_unityTargetName} link strategy: ${_linkLibrariesStrategy}") endif() if ("${_linkLibrariesStrategy}" MATCHES "^(COPY|COPY_UNITY)$") - if (CMAKE_VERSION VERSION_LESS "2.8.11") - message (WARNING "cotire: unity target link strategy ${_linkLibrariesStrategy} requires CMake 2.8.11 or later. Defaulting to NONE for ${_target}.") - else() - set (_unityLinkLibraries "") - get_target_property(_linkLibraries ${_target} LINK_LIBRARIES) - if (_linkLibraries) - list (APPEND _unityLinkLibraries ${_linkLibraries}) - endif() - get_target_property(_interfaceLinkLibraries ${_target} INTERFACE_LINK_LIBRARIES) - if (_interfaceLinkLibraries) - list (APPEND _unityLinkLibraries ${_interfaceLinkLibraries}) - endif() - cotire_map_libraries("${_linkLibrariesStrategy}" _unityLinkLibraries ${_unityLinkLibraries}) - if (COTIRE_DEBUG) - message (STATUS "unity target ${_unityTargetName} libraries: ${_unityLinkLibraries}") - endif() - if (_unityLinkLibraries) - target_link_libraries(${_unityTargetName} ${_unityLinkLibraries}) - endif() + set (_unityLinkLibraries "") + get_target_property(_linkLibraries ${_target} LINK_LIBRARIES) + if (_linkLibraries) + list (APPEND _unityLinkLibraries ${_linkLibraries}) + endif() + get_target_property(_interfaceLinkLibraries ${_target} INTERFACE_LINK_LIBRARIES) + if (_interfaceLinkLibraries) + list (APPEND _unityLinkLibraries ${_interfaceLinkLibraries}) + endif() + cotire_map_libraries("${_linkLibrariesStrategy}" _unityLinkLibraries ${_unityLinkLibraries}) + if (COTIRE_DEBUG) + message (STATUS "unity target ${_unityTargetName} libraries: ${_unityLinkLibraries}") + endif() + if (_unityLinkLibraries) + target_link_libraries(${_unityTargetName} ${_unityLinkLibraries}) endif() endif() endif() @@ -2955,7 +3133,7 @@ function (cotire_cleanup _binaryDir _cotireIntermediateDirName _targetName) # filter files in intermediate directory set (_filesToRemove "") foreach (_file ${_cotireFiles}) - get_filename_component(_dir "${_file}" PATH) + get_filename_component(_dir "${_file}" DIRECTORY) get_filename_component(_dirName "${_dir}" NAME) if ("${_dirName}" STREQUAL "${_cotireIntermediateDirName}") list (APPEND _filesToRemove "${_file}") @@ -2963,7 +3141,7 @@ function (cotire_cleanup _binaryDir _cotireIntermediateDirName _targetName) endforeach() if (_filesToRemove) if (COTIRE_VERBOSE) - message (STATUS "removing ${_filesToRemove}") + message (STATUS "cleaning up ${_filesToRemove}") endif() file (REMOVE ${_filesToRemove}) endif() @@ -2973,6 +3151,7 @@ function (cotire_init_target _targetName) if (COTIRE_TARGETS_FOLDER) set_target_properties(${_targetName} PROPERTIES FOLDER "${COTIRE_TARGETS_FOLDER}") endif() + set_target_properties(${_targetName} PROPERTIES EXCLUDE_FROM_ALL TRUE) if (MSVC_IDE) set_target_properties(${_targetName} PROPERTIES EXCLUDE_FROM_DEFAULT_BUILD TRUE) endif() @@ -2981,7 +3160,9 @@ endfunction() function (cotire_add_to_pch_all_target _pchTargetName) set (_targetName "${COTIRE_PCH_ALL_TARGET_NAME}") if (NOT TARGET "${_targetName}") - add_custom_target("${_targetName}" WORKING_DIRECTORY "${CMAKE_BINARY_DIR}" VERBATIM) + add_custom_target("${_targetName}" + WORKING_DIRECTORY "${CMAKE_BINARY_DIR}" + VERBATIM) cotire_init_target("${_targetName}") endif() cotire_setup_clean_all_target() @@ -2991,7 +3172,9 @@ endfunction() function (cotire_add_to_unity_all_target _unityTargetName) set (_targetName "${COTIRE_UNITY_BUILD_ALL_TARGET_NAME}") if (NOT TARGET "${_targetName}") - add_custom_target("${_targetName}" WORKING_DIRECTORY "${CMAKE_BINARY_DIR}" VERBATIM) + add_custom_target("${_targetName}" + WORKING_DIRECTORY "${CMAKE_BINARY_DIR}" + VERBATIM) cotire_init_target("${_targetName}") endif() cotire_setup_clean_all_target() @@ -3003,28 +3186,24 @@ function (cotire_setup_clean_all_target) if (NOT TARGET "${_targetName}") cotire_set_cmd_to_prologue(_cmds) list (APPEND _cmds -P "${COTIRE_CMAKE_MODULE_FILE}" "cleanup" "${CMAKE_BINARY_DIR}" "${COTIRE_INTDIR}") - add_custom_target(${_targetName} COMMAND ${_cmds} - WORKING_DIRECTORY "${CMAKE_BINARY_DIR}" COMMENT "Cleaning up all cotire generated files" VERBATIM) + add_custom_target(${_targetName} + COMMAND ${_cmds} + WORKING_DIRECTORY "${CMAKE_BINARY_DIR}" + COMMENT "Cleaning up all cotire generated files" + VERBATIM) cotire_init_target("${_targetName}") endif() endfunction() function (cotire) set(_options "") - set(_oneValueArgs SOURCE_DIR BINARY_DIR) + set(_oneValueArgs "") set(_multiValueArgs LANGUAGES CONFIGURATIONS) cmake_parse_arguments(_option "${_options}" "${_oneValueArgs}" "${_multiValueArgs}" ${ARGN}) set (_targets ${_option_UNPARSED_ARGUMENTS}) - if (NOT _option_SOURCE_DIR) - set (_option_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}") - endif() - if (NOT _option_BINARY_DIR) - set (_option_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}") - endif() foreach (_target ${_targets}) if (TARGET ${_target}) - cotire_target(${_target} LANGUAGES ${_option_LANGUAGES} CONFIGURATIONS ${_option_CONFIGURATIONS} - SOURCE_DIR "${_option_SOURCE_DIR}" BINARY_DIR "${_option_BINARY_DIR}") + cotire_target(${_target} LANGUAGES ${_option_LANGUAGES} CONFIGURATIONS ${_option_CONFIGURATIONS}) else() message (WARNING "cotire: ${_target} is not a target.") endif() @@ -3060,14 +3239,6 @@ if (CMAKE_SCRIPT_MODE_FILE) message (STATUS "${COTIRE_ARGV0} ${COTIRE_ARGV1} ${COTIRE_ARGV2} ${COTIRE_ARGV3} ${COTIRE_ARGV4} ${COTIRE_ARGV5}") endif() - if (WIN32) - # for MSVC, compiler IDs may not always be set correctly - if (MSVC) - set (CMAKE_C_COMPILER_ID "MSVC") - set (CMAKE_CXX_COMPILER_ID "MSVC") - endif() - endif() - if (NOT COTIRE_BUILD_TYPE) set (COTIRE_BUILD_TYPE "None") endif() @@ -3080,14 +3251,12 @@ if (CMAKE_SCRIPT_MODE_FILE) list (FIND COTIRE_TARGET_CONFIGURATION_TYPES "${COTIRE_BUILD_TYPE}" _index) if (_index GREATER -1) set (_sources ${COTIRE_TARGET_SOURCES}) - set (_sourceLocations ${COTIRE_TARGET_SOURCE_LOCATIONS}) set (_sourcesDefinitions ${COTIRE_TARGET_SOURCES_COMPILE_DEFINITIONS_${_upperConfig}}) else() if (COTIRE_DEBUG) message (STATUS "COTIRE_BUILD_TYPE=${COTIRE_BUILD_TYPE} not cotired (${COTIRE_TARGET_CONFIGURATION_TYPES})") endif() set (_sources "") - set (_sourceLocations "") set (_sourcesDefinitions "") endif() set (_targetPreUndefs ${COTIRE_TARGET_PRE_UNDEFS}) @@ -3106,12 +3275,10 @@ if (CMAKE_SCRIPT_MODE_FILE) endif() cotire_select_unity_source_files("${COTIRE_ARGV3}" _sources ${_sources}) - cotire_select_unity_source_files("${COTIRE_ARGV3}" _sourceLocations ${_sourceLocations}) cotire_generate_unity_source( "${COTIRE_ARGV3}" ${_sources} LANGUAGE "${COTIRE_TARGET_LANGUAGE}" - SOURCE_LOCATIONS ${_sourceLocations} SOURCES_COMPILE_DEFINITIONS ${_sourcesDefinitions} PRE_UNDEFS ${_targetPreUndefs} POST_UNDEFS ${_targetPostUndefs} @@ -3141,12 +3308,12 @@ if (CMAKE_SCRIPT_MODE_FILE) COMPILER_EXECUTABLE "${CMAKE_${COTIRE_TARGET_LANGUAGE}_COMPILER}" COMPILER_ARG1 ${CMAKE_${COTIRE_TARGET_LANGUAGE}_COMPILER_ARG1} COMPILER_ID "${CMAKE_${COTIRE_TARGET_LANGUAGE}_COMPILER_ID}" - COMPILER_VERSION "${COTIRE_${COTIRE_TARGET_LANGUAGE}_COMPILER_VERSION}" + COMPILER_VERSION "${CMAKE_${COTIRE_TARGET_LANGUAGE}_COMPILER_VERSION}" LANGUAGE "${COTIRE_TARGET_LANGUAGE}" IGNORE_PATH "${COTIRE_TARGET_IGNORE_PATH};${COTIRE_ADDITIONAL_PREFIX_HEADER_IGNORE_PATH}" INCLUDE_PATH ${COTIRE_TARGET_INCLUDE_PATH} IGNORE_EXTENSIONS "${CMAKE_${COTIRE_TARGET_LANGUAGE}_SOURCE_FILE_EXTENSIONS};${COTIRE_ADDITIONAL_PREFIX_HEADER_IGNORE_EXTENSIONS}" - INCLUDE_SYSTEM_FLAG "${COTIRE_INCLUDE_SYSTEM_FLAG}" + INCLUDE_PRIORITY_PATH ${COTIRE_TARGET_INCLUDE_PRIORITY_PATH} INCLUDE_DIRECTORIES ${_includeDirs} SYSTEM_INCLUDE_DIRECTORIES ${_systemIncludeDirs} COMPILE_DEFINITIONS ${_compileDefinitions} @@ -3167,9 +3334,8 @@ if (CMAKE_SCRIPT_MODE_FILE) COMPILER_EXECUTABLE "${CMAKE_${COTIRE_TARGET_LANGUAGE}_COMPILER}" COMPILER_ARG1 ${CMAKE_${COTIRE_TARGET_LANGUAGE}_COMPILER_ARG1} COMPILER_ID "${CMAKE_${COTIRE_TARGET_LANGUAGE}_COMPILER_ID}" - COMPILER_VERSION "${COTIRE_${COTIRE_TARGET_LANGUAGE}_COMPILER_VERSION}" + COMPILER_VERSION "${CMAKE_${COTIRE_TARGET_LANGUAGE}_COMPILER_VERSION}" LANGUAGE "${COTIRE_TARGET_LANGUAGE}" - INCLUDE_SYSTEM_FLAG "${COTIRE_INCLUDE_SYSTEM_FLAG}" INCLUDE_DIRECTORIES ${_includeDirs} SYSTEM_INCLUDE_DIRECTORIES ${_systemIncludeDirs} COMPILE_DEFINITIONS ${_compileDefinitions} @@ -3178,9 +3344,11 @@ if (CMAKE_SCRIPT_MODE_FILE) elseif ("${COTIRE_ARGV1}" STREQUAL "combine") if (COTIRE_TARGET_LANGUAGE) - set (_startIndex 3) + set (_combinedFile "${COTIRE_ARGV3}") + set (_startIndex 4) else() - set (_startIndex 2) + set (_combinedFile "${COTIRE_ARGV2}") + set (_startIndex 3) endif() set (_files "") foreach (_index RANGE ${_startIndex} ${COTIRE_ARGC}) @@ -3189,10 +3357,21 @@ if (CMAKE_SCRIPT_MODE_FILE) endif() endforeach() + if (XCODE) + # executing pre-build action under Xcode, check dependency on files to be combined + set (_dependsOption DEPENDS ${_files}) + else() + # executing custom command, no need to re-check for dependencies + set (_dependsOption "") + endif() + if (COTIRE_TARGET_LANGUAGE) - cotire_generate_unity_source(${_files} LANGUAGE "${COTIRE_TARGET_LANGUAGE}") + cotire_generate_unity_source( + "${_combinedFile}" ${_files} + LANGUAGE "${COTIRE_TARGET_LANGUAGE}" + ${_dependsOption}) else() - cotire_generate_unity_source(${_files}) + cotire_generate_unity_source("${_combinedFile}" ${_files} ${_dependsOption}) endif() elseif ("${COTIRE_ARGV1}" STREQUAL "cleanup") @@ -3208,9 +3387,6 @@ else() # cotire is being run in include mode # set up all variable and property definitions - unset (COTIRE_C_COMPILER_VERSION CACHE) - unset (COTIRE_CXX_COMPILER_VERSION CACHE) - if (NOT DEFINED COTIRE_DEBUG_INIT) if (DEFINED COTIRE_DEBUG) set (COTIRE_DEBUG_INIT ${COTIRE_DEBUG}) @@ -3278,6 +3454,13 @@ else() if (NOT COTIRE_PCH_TARGET_SUFFIX) set (COTIRE_PCH_TARGET_SUFFIX "_pch") endif() + if (MSVC) + # MSVC default PCH memory scaling factor of 100 percent (75 MB) is too small for template heavy C++ code + # use a bigger default factor of 170 percent (128 MB) + if (NOT DEFINED COTIRE_PCH_MEMORY_SCALING_FACTOR) + set (COTIRE_PCH_MEMORY_SCALING_FACTOR "170") + endif() + endif() if (NOT COTIRE_UNITY_BUILD_TARGET_SUFFIX) set (COTIRE_UNITY_BUILD_TARGET_SUFFIX "_unity") endif() @@ -3383,6 +3566,13 @@ else() "See target property COTIRE_PREFIX_HEADER_INCLUDE_PATH." ) + define_property( + DIRECTORY PROPERTY "COTIRE_PREFIX_HEADER_INCLUDE_PRIORITY_PATH" + BRIEF_DOCS "Header paths matching one of these directories are put at the top of the prefix header." + FULL_DOCS + "See target property COTIRE_PREFIX_HEADER_INCLUDE_PRIORITY_PATH." + ) + define_property( DIRECTORY PROPERTY "COTIRE_UNITY_SOURCE_PRE_UNDEFS" BRIEF_DOCS "Preprocessor undefs to place in the generated unity source file before the inclusion of each source file." @@ -3469,6 +3659,16 @@ else() "If not set, this property is initialized to the empty list." ) + define_property( + TARGET PROPERTY "COTIRE_PREFIX_HEADER_INCLUDE_PRIORITY_PATH" INHERITED + BRIEF_DOCS "Header paths matching one of these directories are put at the top of prefix header." + FULL_DOCS + "The property can be set to a list of directories." + "Header file paths matching one of these directories will be inserted at the beginning of the generated prefix header." + "Header files are sorted according to the order of the directories in the property." + "If not set, this property is initialized to the empty list." + ) + define_property( TARGET PROPERTY "COTIRE_UNITY_SOURCE_PRE_UNDEFS" INHERITED BRIEF_DOCS "Preprocessor undefs to place in the generated unity source file before the inclusion of each target source file." @@ -3524,7 +3724,7 @@ else() TARGET PROPERTY "COTIRE_UNITY_LINK_LIBRARIES_INIT" INHERITED BRIEF_DOCS "Define strategy for setting up unity target's link libraries." FULL_DOCS - "If this property is empty, the generated unity target's link libraries have to be set up manually." + "If this property is empty or set to NONE, the generated unity target's link libraries have to be set up manually." "If this property is set to COPY, the unity target's link libraries will be copied from this target." "If this property is set to COPY_UNITY, the unity target's link libraries will be copied from this target with considering existing unity targets." "Inherited from directory." diff --git a/path_8_7/config.lua b/path_8_7/config.lua index 91f2c31a9..6d4a5c0c9 100644 --- a/path_8_7/config.lua +++ b/path_8_7/config.lua @@ -1,106 +1,103 @@ --- The OTX Server Config +-- Combat settings +-- NOTE: valid values for worldType are: "pvp", "no-pvp" and "pvp-enforced" +worldType = "pvp" +hotkeyAimbotEnabled = true +protectionLevel = 1 +killsToRedSkull = 3 +killsToBlackSkull = 6 +pzLocked = 60 * 1000 +removeChargesFromRunes = true +timeToDecreaseFrags = 24 * 60 * 60 * 1000 +whiteSkullTime = 15 * 60 * 1000 +stairJumpExhaustion = 2 * 1000 +experienceByKillingPlayers = false +expFromPlayersLevelRange = 75 - -- Combat settings - -- NOTE: valid values for worldType are: "pvp", "no-pvp" and "pvp-enforced" - worldType = "pvp" - hotkeyAimbotEnabled = true - protectionLevel = 1 - killsToRedSkull = 3 - killsToBlackSkull = 6 - pzLocked = 1 * 60 * 1000 - removeChargesFromRunes = true - timeToDecreaseFrags = 24 * 60 * 60 * 1000 - whiteSkullTime = 15 * 60 * 1000 - stairJumpExhaustion = 2 * 1000 - experienceByKillingPlayers = false - expFromPlayersLevelRange = 75 +-- Connection Config +-- NOTE: maxPlayers set to 0 means no limit +ip = "127.0.0.1" +bindOnlyGlobalAddress = false +loginProtocolPort = 7171 +gameProtocolPort = 7172 +statusProtocolPort = 7171 +maxPlayers = 0 +motd = "Welcome to The Forgotten Server!" +onePlayerOnlinePerAccount = true +allowClones = false +serverName = "Forgotten" +statusTimeout = 5 * 1000 +replaceKickOnLogin = true +maxPacketsPerSecond = 25 - -- Connection Config - -- NOTE: maxPlayers set to 0 means no limit - ip = "127.0.0.1" - bindOnlyGlobalAddress = false - loginProtocolPort = 7171 - gameProtocolPort = 7172 - statusProtocolPort = 7171 - maxPlayers = 0 - motd = "Welcome to The OTX Server!" - onePlayerOnlinePerAccount = true - allowClones = false - allowWalkthrough = true - serverName = "OTXSERVER" - statusTimeout = 1 * 1000 - replaceKickOnLogin = true - maxPacketsPerSecond = 25 +-- Deaths +-- NOTE: Leave deathLosePercent as -1 if you want to use the default +-- death penalty formula. For the old formula, set it to 10. For +-- no skill/experience loss, set it to 0. +deathLosePercent = -1 - -- Deaths - -- NOTE: Leave deathLosePercent as -1 if you want to use the default - -- death penalty formula. For the old formula, set it to 10. For - -- no skill/experience loss, set it to 0. - deathLosePercent = -1 +-- Houses +-- NOTE: set housePriceEachSQM to -1 to disable the ingame buy house functionality +housePriceEachSQM = 1000 +houseRentPeriod = "weekly" - -- Houses - -- NOTE: set housePriceEachSQM to -1 to disable the ingame buy house functionality - housePriceEachSQM = 1000 - houseRentPeriod = "never" +-- Item Usage +timeBetweenActions = 200 +timeBetweenExActions = 1000 - -- Item Usage - timeBetweenActions = 200 - timeBetweenExActions = 1000 +-- Map +-- NOTE: set mapName WITHOUT .otbm at the end +mapName = "forgotten" +mapAuthor = "Komic" - -- Map - -- NOTE: set mapName WITHOUT .otbm at the end - mapName = "forgotten" - mapAuthor = "Komic" +-- Market +marketOfferDuration = 30 * 24 * 60 * 60 +premiumToCreateMarketOffer = true +checkExpiredMarketOffersEachMinutes = 60 +maxMarketOffersAtATimePerPlayer = 100 - -- MySQL - mysqlHost = "127.0.0.1" - mysqlUser = "root" - mysqlPass = "master" - mysqlDatabase = "darkkonia" - mysqlPort = 3306 - mysqlSock = "" +-- MySQL +mysqlHost = "127.0.0.1" +mysqlUser = "forgottenserver" +mysqlPass = "" +mysqlDatabase = "forgottenserver" +mysqlPort = 3306 +mysqlSock = "" - -- Misc. - allowChangeOutfit = true - freePremium = false - kickIdlePlayerAfterMinutes = 15 - maxMessageBuffer = 4 - emoteSpells = true - classicEquipmentSlots = false +-- Misc. +allowChangeOutfit = true +freePremium = false +kickIdlePlayerAfterMinutes = 15 +maxMessageBuffer = 4 +emoteSpells = true +classicEquipmentSlots = false - -- Rates - -- NOTE: rateExp is not used if you have enabled stages in data/XML/stages.xml - rateExp = 1 - rateSkill = 3 - rateLoot = 2 - rateMagic = 3 - rateSpawn = 1 +-- Rates +-- NOTE: rateExp is not used if you have enabled stages in data/XML/stages.xml +rateExp = 5 +rateSkill = 3 +rateLoot = 2 +rateMagic = 3 +rateSpawn = 1 - -- Critical hits - -- NOTE: criticalChance and extraPercent are percentages, not absolute values. - -- extraPercent is the extra percentage of the damage to be added. - criticalChance = 1 - criticalExtra = 100 +-- Monsters +deSpawnRange = 2 +deSpawnRadius = 50 - -- Monsters - deSpawnRange = 2 - deSpawnRadius = 50 +-- Stamina +staminaSystem = true - -- Stamina - staminaSystem = true +-- Scripts +warnUnsafeScripts = true +convertUnsafeScripts = true - -- Scripts - warnUnsafeScripts = true - convertUnsafeScripts = true +-- Startup +-- NOTE: defaultPriority only works on Windows and sets process +-- priority, valid values are: "normal", "above-normal", "high" +defaultPriority = "high" +startupDatabaseOptimization = true - -- Startup - -- NOTE: defaultPriority only works on Windows and sets process - -- priority, valid values are: "normal", "above-normal", "high" - defaultPriority = "high" - startupDatabaseOptimization = true - - -- Status server information - ownerName = "Mattyx14" - ownerEmail = "darkylive@live.com.mx" - url = "https://github.com/mattyx14/" - location = "Mexico" +-- Status server information +ownerName = "Mattyx14" +ownerEmail = "darkylive@live.com.mx" +url = "http://darkkonia.sytes.net/" +location = "Mexico" diff --git a/path_8_7/data/XML/mounts.xml b/path_8_7/data/XML/mounts.xml index 9beb55e38..079569066 100644 --- a/path_8_7/data/XML/mounts.xml +++ b/path_8_7/data/XML/mounts.xml @@ -1,15 +1,15 @@ - - - - - - - - - - - - + + + + + + + + + + + + diff --git a/path_8_7/data/actions/actions.xml b/path_8_7/data/actions/actions.xml index 2545e9d86..e1901d0a9 100644 --- a/path_8_7/data/actions/actions.xml +++ b/path_8_7/data/actions/actions.xml @@ -4,6 +4,7 @@ + diff --git a/path_8_7/data/actions/scripts/other/doors.lua b/path_8_7/data/actions/scripts/other/doors.lua index d1fdbe1d6..0374d46a9 100644 --- a/path_8_7/data/actions/scripts/other/doors.lua +++ b/path_8_7/data/actions/scripts/other/doors.lua @@ -16,6 +16,9 @@ function onUse(player, item, fromPosition, target, toPosition, isHotkey) player:sendTextMessage(MESSAGE_INFO_DESCR, "Only the worthy may pass.") end return true + elseif isInArray(blockDoors, itemId) then + player:sendTextMessage(MESSAGE_STATUS_SMALL, "It is locked.") + return true elseif isInArray(keys, itemId) then if target.actionid > 0 then if item.actionid == target.actionid and doors[target.itemid] then diff --git a/path_8_7/data/actions/scripts/quests/system.lua b/path_8_7/data/actions/scripts/quests/system.lua new file mode 100644 index 000000000..9f37e462e --- /dev/null +++ b/path_8_7/data/actions/scripts/quests/system.lua @@ -0,0 +1,87 @@ +local specialQuests = {} +local questsExperience = {} +local questLog = {} + +function onUse(player, item, fromPosition, target, toPosition, isHotkey) + local storage = specialQuests[item.actionid] + if not storage then + storage = item.uid + if storage > 65535 then + return false + end + end + + if player:getStorageValue(storage) > 0 then + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'The ' .. ItemType(item.itemid):getName() .. ' is empty.') + return true + end + + local items, reward = {} + local size = item:isContainer() and item:getSize() or 0 + if size == 0 then + reward = item:clone() + else + local container = Container(item.uid) + for i = 0, container:getSize() - 1 do + items[#items + 1] = container:getItem(i):clone() + end + end + + size = #items + if size == 1 then + reward = items[1]:clone() + end + + local result = '' + if reward then + local ret = ItemType(reward.itemid) + if ret:isRune() then + result = ret:getArticle() .. ' ' .. ret:getName() .. ' (' .. reward.type .. ' charges)' + elseif ret:isStackable() and reward:getCount() > 1 then + result = reward:getCount() .. ' ' .. ret:getPluralName() + elseif ret:getArticle() ~= '' then + result = ret:getArticle() .. ' ' .. ret:getName() + else + result = ret:getName() + end + else + if size > 20 then + reward = Game.createItem(item.itemid, 1) + elseif size > 8 then + reward = Game.createItem(1988, 1) + else + reward = Game.createItem(1987, 1) + end + + for i = 1, size do + local tmp = items[i] + if reward:addItemEx(tmp) ~= RETURNVALUE_NOERROR then + print('[Warning] QuestSystem:', 'Could not add quest reward to container') + end + end + local ret = ItemType(reward.itemid) + result = ret:getArticle() .. ' ' .. ret:getName() + end + + if player:addItemEx(reward) ~= RETURNVALUE_NOERROR then + local weight = reward:getWeight() + if player:getFreeCapacity() < weight then + player:sendCancelMessage(string.format('You have found %s weighing %.2f oz. You have no capacity.', result, (weight / 100))) + else + player:sendCancelMessage('You have found ' .. result .. ', but you have no room to take it.') + end + return true + end + + if questsExperience[storage] then + player:addExperience(questsExperience[storage], true) + end + + if questLog[storage] then + player:setStorageValue(questLog[storage], 1) + end + + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You have found ' .. result .. '.') + player:setStorageValue(storage, 1) + return true +end diff --git a/path_8_7/data/actions/scripts/tools/shovel.lua b/path_8_7/data/actions/scripts/tools/shovel.lua index 3bacc66d8..d5fcd9b4e 100644 --- a/path_8_7/data/actions/scripts/tools/shovel.lua +++ b/path_8_7/data/actions/scripts/tools/shovel.lua @@ -1,5 +1,14 @@ local holes = {468, 481, 483} +local others = {7932} function onUse(player, item, fromPosition, target, toPosition, isHotkey) + local targetId = target.itemid, target.actionid + if isInArray(others, targetId) then + target:transform(targetId + 1) + target:decay() + + return true + end + if toPosition.x == CONTAINER_POSITION then return false end diff --git a/path_8_7/data/creaturescripts/creaturescripts.xml b/path_8_7/data/creaturescripts/creaturescripts.xml index 86e2c8c3a..18f666513 100644 --- a/path_8_7/data/creaturescripts/creaturescripts.xml +++ b/path_8_7/data/creaturescripts/creaturescripts.xml @@ -2,10 +2,13 @@ - + + + + diff --git a/path_8_7/data/creaturescripts/scripts/advance_save.lua b/path_8_7/data/creaturescripts/scripts/advance_save.lua new file mode 100644 index 000000000..b4095a9d0 --- /dev/null +++ b/path_8_7/data/creaturescripts/scripts/advance_save.lua @@ -0,0 +1,25 @@ +local config = { + heal = true, + save = true, + effect = false +} + +function onAdvance(player, skill, oldLevel, newLevel) + if skill ~= SKILL_LEVEL or newLevel <= oldLevel then + return true + end + + if config.effect then + player:getPosition():sendMagicEffect(math.random(CONST_ME_FIREWORK_YELLOW, CONST_ME_FIREWORK_BLUE)) + player:say('LEVEL UP!', TALKTYPE_MONSTER_SAY) + end + + if config.heal then + player:addHealth(player:getMaxHealth()) + end + + if config.save then + player:save() + end + return true +end diff --git a/path_8_7/data/creaturescripts/scripts/droploot.lua b/path_8_7/data/creaturescripts/scripts/droploot.lua index 371c48a59..0ed33e259 100644 --- a/path_8_7/data/creaturescripts/scripts/droploot.lua +++ b/path_8_7/data/creaturescripts/scripts/droploot.lua @@ -4,8 +4,7 @@ function onDeath(player, corpse, killer, mostDamage, unjustified, mostDamage_unj end local amulet = player:getSlotItem(CONST_SLOT_NECKLACE) - local hasSkull = isInArray({SKULL_RED, SKULL_BLACK}, player:getSkull()) - if amulet and amulet.itemid == ITEM_AMULETOFLOSS and not hasSkull then + if amulet and amulet.itemid == ITEM_AMULETOFLOSS and not isInArray({SKULL_RED, SKULL_BLACK}, player:getSkull()) then local isPlayer = false if killer then if killer:isPlayer() then @@ -22,11 +21,10 @@ function onDeath(player, corpse, killer, mostDamage, unjustified, mostDamage_unj player:removeItem(ITEM_AMULETOFLOSS, 1, -1, false) end else - local lossPercent = player:getLossPercent() for i = CONST_SLOT_HEAD, CONST_SLOT_AMMO do local item = player:getSlotItem(i) if item then - if hasSkull or math.random(item:isContainer() and 100 or 1000) <= lossPercent then + if isInArray({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 @@ -38,6 +36,5 @@ function onDeath(player, corpse, killer, mostDamage, unjustified, mostDamage_unj if not player:getSlotItem(CONST_SLOT_BACKPACK) then player:addItem(ITEM_BAG, 1, false, CONST_SLOT_BACKPACK) end - return true end diff --git a/path_8_7/data/creaturescripts/scripts/firstitems.lua b/path_8_7/data/creaturescripts/scripts/firstitems.lua index 9530f4657..38a9ec889 100644 --- a/path_8_7/data/creaturescripts/scripts/firstitems.lua +++ b/path_8_7/data/creaturescripts/scripts/firstitems.lua @@ -1,12 +1,52 @@ -local firstItems = {2050, 2382} +-- Without Rookgaard +local config = { + [1] = { + --equipment spellbook, wand of vortex, magician's robe, mage hat, studded legs, leather boots, scarf + items = {{2175, 1}, {2190, 1}, {8819, 1}, {8820, 1}, {2468, 1}, {2643, 1}, {2661, 1}}, + --container rope, shovel, mana potion + container = {{2120, 1}, {2554, 1}, {7620, 1}} + }, + [2] = { + --equipment spellbook, snakebite rod, magician's robe, mage hat, studded legs, leather boots scarf + items = {{2175, 1}, {2182, 1}, {8819, 1}, {8820, 1}, {2468, 1}, {2643, 1}, {2661, 1}}, + --container rope, shovel, mana potion + container = {{2120, 1}, {2554, 1}, {7620, 1}} + }, + [3] = { + --equipment dwrven shield, 5 spear, ranger's cloak, ranger legs scarf, legion helmet + items = {{2525, 1}, {2389, 5}, {2660, 1}, {8923, 1}, {2643, 1}, {2661, 1}, {2480, 1}}, + --container rope, shovel, health potion, bow, 50 arrow + container = {{2120, 1}, {2554, 1}, {7618, 1}, {2456, 1}, {2544, 50}} + }, + [4] = { + --equipment dwarven shield, steel axe, brass armor, brass helmet, brass legs scarf + items = {{2525, 1}, {8601, 1}, {2465, 1}, {2460, 1}, {2478, 1}, {2643, 1}, {2661, 1}}, + --container jagged sword, daramian mace, rope, shovel, health potion + container = {{8602, 1}, {2439, 1}, {2120, 1}, {2554, 1}, {7618, 1}} + } +} function onLogin(player) - if player:getLastLoginSaved() == 0 then - for i = 1, #firstItems do - player:addItem(firstItems[i], 1) - end - player:addItem(player:getSex() == 0 and 2651 or 2650, 1) - player:addItem(1987, 1):addItem(2674, 1) + local targetVocation = config[player:getVocation():getId()] + if not targetVocation then + return true + end + + if player:getLastLoginSaved() ~= 0 then + return true + end + + for i = 1, #targetVocation.items do + player:addItem(targetVocation.items[i][1], targetVocation.items[i][2]) + end + + local backpack = player:addItem(1988) + if not backpack then + return true + end + + for i = 1, #targetVocation.container do + backpack:addItem(targetVocation.container[i][1], targetVocation.container[i][2]) end return true end diff --git a/path_8_7/data/events/events.xml b/path_8_7/data/events/events.xml index 6c4848013..391d63bc5 100644 --- a/path_8_7/data/events/events.xml +++ b/path_8_7/data/events/events.xml @@ -15,10 +15,10 @@ - + - + diff --git a/path_8_7/data/events/scripts/player.lua b/path_8_7/data/events/scripts/player.lua index 85342847f..099884842 100644 --- a/path_8_7/data/events/scripts/player.lua +++ b/path_8_7/data/events/scripts/player.lua @@ -82,6 +82,32 @@ function Player:onLookInShop(itemType, count) end function Player:onMoveItem(item, count, fromPosition, toPosition) + if toPosition.x ~= CONTAINER_POSITION then + return true + end + + if item:getTopParent() == self and bit.band(toPosition.y, 0x40) == 0 then + local itemType, moveItem = ItemType(item:getId()) + if bit.band(itemType:getSlotPosition(), SLOTP_TWO_HAND) ~= 0 and toPosition.y == CONST_SLOT_LEFT then + moveItem = self:getSlotItem(CONST_SLOT_RIGHT) + elseif itemType:getWeaponType() == WEAPON_SHIELD and toPosition.y == CONST_SLOT_RIGHT then + moveItem = self:getSlotItem(CONST_SLOT_LEFT) + if moveItem and bit.band(ItemType(moveItem:getId()):getSlotPosition(), SLOTP_TWO_HAND) == 0 then + return true + end + end + + if moveItem then + local parent = item:getParent() + if parent:getSize() == parent:getCapacity() then + self:sendTextMessage(MESSAGE_STATUS_SMALL, Game.getReturnMessage(RETURNVALUE_CONTAINERNOTENOUGHROOM)) + return false + else + return moveItem:moveTo(parent) + end + end + end + return true end diff --git a/path_8_7/data/globalevents/globalevents.xml b/path_8_7/data/globalevents/globalevents.xml index e136115ce..8012f11aa 100644 --- a/path_8_7/data/globalevents/globalevents.xml +++ b/path_8_7/data/globalevents/globalevents.xml @@ -2,9 +2,8 @@ - - + + + + diff --git a/path_8_7/data/globalevents/scripts/cleanmap.lua b/path_8_7/data/globalevents/scripts/cleanmap.lua new file mode 100644 index 000000000..bc69435f4 --- /dev/null +++ b/path_8_7/data/globalevents/scripts/cleanmap.lua @@ -0,0 +1,10 @@ +local function saveServer() + cleanMap() + broadcastMessage("Clean map completed and the next clean at on 2 hours.", MESSAGE_STATUS_CONSOLE_RED) +end + +function onThink(interval) + broadcastMessage("Cleaning map in 5 minutes.", MESSAGE_STATUS_WARNING) + addEvent(saveServer, 5 * 60 * 1000) + return true +end diff --git a/path_8_7/data/globalevents/scripts/serversave.lua b/path_8_7/data/globalevents/scripts/serversave.lua index 3a6c2f59e..e943e74d5 100644 --- a/path_8_7/data/globalevents/scripts/serversave.lua +++ b/path_8_7/data/globalevents/scripts/serversave.lua @@ -1,33 +1,4 @@ -local shutdownAtServerSave = false -local cleanMapAtServerSave = false - -local function serverSave() - if shutdownAtServerSave then - Game.setGameState(GAME_STATE_SHUTDOWN) - else - Game.setGameState(GAME_STATE_CLOSED) - - if cleanMapAtServerSave then - cleanMap() - end - - Game.setGameState(GAME_STATE_NORMAL) - end -end - -local function secondServerSaveWarning() - broadcastMessage("Server is saving game in one minute. Please logout.", MESSAGE_STATUS_WARNING) - addEvent(serverSave, 60000) -end - -local function firstServerSaveWarning() - broadcastMessage("Server is saving game in 3 minutes. Please logout.", MESSAGE_STATUS_WARNING) - addEvent(secondServerSaveWarning, 120000) -end - -function onTime(interval) - broadcastMessage("Server is saving game in 5 minutes. Please logout.", MESSAGE_STATUS_WARNING) - Game.setGameState(GAME_STATE_STARTUP) - addEvent(firstServerSaveWarning, 120000) - return not shutdownAtServerSave +function onThink(interval) + saveServer() + return true end diff --git a/path_8_7/data/items/items.xml b/path_8_7/data/items/items.xml index f1bd52c0b..61708e302 100644 --- a/path_8_7/data/items/items.xml +++ b/path_8_7/data/items/items.xml @@ -220,15 +220,19 @@ - + + + + + - + @@ -285,7 +289,7 @@ - + @@ -297,7 +301,7 @@ - + @@ -353,7 +357,7 @@ - + @@ -365,7 +369,7 @@ - + @@ -6788,7 +6792,7 @@ - + @@ -6822,7 +6826,7 @@ - + @@ -7950,7 +7954,7 @@ - + @@ -7958,7 +7962,7 @@ - + @@ -7966,7 +7970,7 @@ - + @@ -7974,13 +7978,13 @@ - + - + @@ -7993,7 +7997,7 @@ - + @@ -8014,14 +8018,15 @@ - + + - + @@ -8038,9 +8043,6 @@ - - - @@ -8170,7 +8172,7 @@ - + @@ -8182,7 +8184,7 @@ - + @@ -8328,7 +8330,7 @@ - + @@ -8362,7 +8364,7 @@ - + @@ -8396,7 +8398,7 @@ - + @@ -8430,7 +8432,7 @@ - + @@ -8464,7 +8466,7 @@ - + @@ -8476,7 +8478,7 @@ - + @@ -8488,7 +8490,7 @@ - + @@ -8500,7 +8502,7 @@ - + @@ -8529,7 +8531,7 @@ - + @@ -8541,7 +8543,7 @@ - + @@ -8649,7 +8651,6 @@ - @@ -9077,11 +9078,9 @@ - - - + @@ -9092,7 +9091,7 @@ - + @@ -10592,7 +10591,7 @@ - + @@ -10604,7 +10603,7 @@ - + @@ -10667,7 +10666,7 @@ - + @@ -10679,7 +10678,7 @@ - + @@ -11710,7 +11709,7 @@ - + @@ -11744,7 +11743,7 @@ - + @@ -11834,7 +11833,7 @@ - + @@ -11868,7 +11867,7 @@ - + @@ -12006,15 +12005,11 @@ - - - - - + @@ -13222,10 +13217,7 @@ - - - - + @@ -14912,7 +14904,7 @@ - + @@ -15237,7 +15229,10 @@ - + + + + @@ -15368,8 +15363,6 @@ - - @@ -15441,10 +15434,7 @@ - - - - + @@ -16463,9 +16453,7 @@ - - - + @@ -16670,7 +16658,7 @@ - + @@ -16678,7 +16666,7 @@ - + @@ -16747,7 +16735,7 @@ - + @@ -16755,7 +16743,7 @@ - + @@ -17719,7 +17707,7 @@ - + @@ -17800,7 +17788,6 @@ - @@ -17902,7 +17889,6 @@ - @@ -17961,7 +17947,7 @@ - + @@ -18263,7 +18249,7 @@ - + @@ -18275,7 +18261,7 @@ - + @@ -18614,7 +18600,7 @@ - + @@ -18648,7 +18634,7 @@ - + @@ -19008,11 +18994,6 @@ - - - - - @@ -19063,7 +19044,7 @@ - + @@ -19091,7 +19072,7 @@ - + @@ -19150,7 +19131,7 @@ - + @@ -20189,8 +20170,8 @@ - - + + @@ -20412,7 +20393,7 @@ - + @@ -20439,7 +20420,7 @@ - + @@ -20481,7 +20462,7 @@ - + @@ -20509,7 +20490,7 @@ - + @@ -20610,7 +20591,7 @@ - + diff --git a/path_8_7/data/lib/core/player.lua b/path_8_7/data/lib/core/player.lua index db09d6816..7f5aae17e 100644 --- a/path_8_7/data/lib/core/player.lua +++ b/path_8_7/data/lib/core/player.lua @@ -32,17 +32,17 @@ function Player.getDepotItems(self, depotId) return self:getDepotChest(depotId, true):getItemHoldingCount() end -local lossPercent = { - [0] = 100, - [1] = 70, - [2] = 45, - [3] = 25, - [4] = 10, - [5] = 0 -} - function Player.getLossPercent(self) local blessings = 0 + local lossPercent = { + [0] = 100, + [1] = 70, + [2] = 45, + [3] = 25, + [4] = 10, + [5] = 0 + } + for i = 1, 5 do if self:hasBlessing(i) then blessings = blessings + 1 diff --git a/path_8_7/data/lib/custom/custom.lua b/path_8_7/data/lib/custom/custom.lua new file mode 100644 index 000000000..3a1167657 --- /dev/null +++ b/path_8_7/data/lib/custom/custom.lua @@ -0,0 +1,85 @@ +function isNumber(str) + return tonumber(str) ~= nil +end + +function getAccountNumberByPlayerName(name) + local player = Player(name) + if player ~= nil then + return player:getAccountId() + end + + local resultId = db.storeQuery("SELECT `account_id` FROM `players` WHERE `name` = " .. db.escapeString(name)) + if resultId ~= false then + local accountId = result.getNumber(resultId, "account_id") + result.free(resultId) + return accountId + end + return 0 +end + +function getMoneyCount(string) + local b, e = string:find("%d+") + local money = b and e and tonumber(string:sub(b, e)) or -1 + if isValidMoney(money) then + return money + end + return -1 +end + +function getMoneyWeight(money) + local gold = money + local crystal = math.floor(gold / 10000) + gold = gold - crystal * 10000 + local platinum = math.floor(gold / 100) + gold = gold - platinum * 100 + return (ItemType(2160):getWeight() * crystal) + (ItemType(2152):getWeight() * platinum) + (ItemType(2148):getWeight() * gold) +end + +function getRealDate() + local month = tonumber(os.date("%m", os.time())) + local day = tonumber(os.date("%d", os.time())) + + if month < 10 then + month = '0' .. month + end + if day < 10 then + day = '0' .. day + end + return day .. '/' .. month +end + +function getRealTime() + local hours = tonumber(os.date("%H", os.time())) + local minutes = tonumber(os.date("%M", os.time())) + + if hours < 10 then + hours = '0' .. hours + end + if minutes < 10 then + minutes = '0' .. minutes + end + return hours .. ':' .. minutes +end + +function isValidMoney(money) + return isNumber(money) and money > 0 and money < 4294967296 +end + +function iterateArea(func, from, to) + for z = from.z, to.z do + for y = from.y, to.y do + for x = from.x, to.x do + func(Position(x, y, z)) + end + end + end +end + +function playerExists(name) + local resultId = db.storeQuery('SELECT `name` FROM `players` WHERE `name` = ' .. db.escapeString(name)) + if resultId then + result.free(resultId) + return true + end + return false +end diff --git a/path_8_7/data/lib/custom/storages.lua b/path_8_7/data/lib/custom/storages.lua new file mode 100644 index 000000000..0cbf79c31 --- /dev/null +++ b/path_8_7/data/lib/custom/storages.lua @@ -0,0 +1,5 @@ +-- STORAGES -- +-- (HIGHLY RECOMMENDED -> ONE mission per STORAGE) -- +-- Sort it in Values - + +Storage = {} diff --git a/path_8_7/data/lib/lib.lua b/path_8_7/data/lib/lib.lua index 5a0e2b553..2ffc31da5 100644 --- a/path_8_7/data/lib/lib.lua +++ b/path_8_7/data/lib/lib.lua @@ -3,3 +3,7 @@ dofile('data/lib/core/core.lua') -- Compatibility library for our old Lua API dofile('data/lib/compat/compat.lua') + +-- Custom +dofile('data/lib/custom/custom.lua') +dofile('data/lib/custom/storages.lua') diff --git a/path_8_7/data/movements/movements.xml b/path_8_7/data/movements/movements.xml index 45ffc338f..7cc1de679 100644 --- a/path_8_7/data/movements/movements.xml +++ b/path_8_7/data/movements/movements.xml @@ -27,6 +27,7 @@ + @@ -177,6 +178,8 @@ + + diff --git a/path_8_7/data/movements/scripts/citizen.lua b/path_8_7/data/movements/scripts/citizen.lua index 94e882d5e..541cfa3a6 100644 --- a/path_8_7/data/movements/scripts/citizen.lua +++ b/path_8_7/data/movements/scripts/citizen.lua @@ -7,6 +7,7 @@ function onStepIn(creature, item, position, fromPosition) local town = Town(item.actionid - 30020) player:setTown(town) + player:sendTextMessage(MESSAGE_INFO_DESCR, "You are the newest resident of " .. town:getName(town) .. ".") end return true end diff --git a/path_8_7/data/npc/Alice.xml b/path_8_7/data/npc/Alice.xml index 755d769ea..5f02ca5ea 100644 --- a/path_8_7/data/npc/Alice.xml +++ b/path_8_7/data/npc/Alice.xml @@ -1,9 +1,5 @@ - - - - - - - - - \ No newline at end of file + + + + + diff --git a/path_8_7/data/npc/Deruno.xml b/path_8_7/data/npc/Deruno.xml index 9e56d893c..3015d5fff 100644 --- a/path_8_7/data/npc/Deruno.xml +++ b/path_8_7/data/npc/Deruno.xml @@ -4,8 +4,6 @@ - - - \ No newline at end of file + diff --git a/path_8_7/data/npc/Eryn.xml b/path_8_7/data/npc/Eryn.xml index 93622cdbf..3ee6f7476 100644 --- a/path_8_7/data/npc/Eryn.xml +++ b/path_8_7/data/npc/Eryn.xml @@ -3,7 +3,7 @@ - + diff --git a/path_8_7/data/npc/Naji.xml b/path_8_7/data/npc/Naji.xml new file mode 100644 index 000000000..7aa02a4f0 --- /dev/null +++ b/path_8_7/data/npc/Naji.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/path_8_7/data/npc/Nimral.xml b/path_8_7/data/npc/Nimral.xml deleted file mode 100644 index 9eb14da8c..000000000 --- a/path_8_7/data/npc/Nimral.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/path_8_7/data/npc/Riona.xml b/path_8_7/data/npc/Riona.xml index ed6df9a6f..13a1df43f 100644 --- a/path_8_7/data/npc/Riona.xml +++ b/path_8_7/data/npc/Riona.xml @@ -1,9 +1,9 @@ - - + + - - + + diff --git a/path_8_7/data/npc/Timral.xml b/path_8_7/data/npc/Timral.xml deleted file mode 100644 index 6186e61c0..000000000 --- a/path_8_7/data/npc/Timral.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/path_8_7/data/npc/lib/npc.lua b/path_8_7/data/npc/lib/npc.lua index 8161efeab..c6d3e2cf6 100644 --- a/path_8_7/data/npc/lib/npc.lua +++ b/path_8_7/data/npc/lib/npc.lua @@ -1,5 +1,6 @@ -- Including the Advanced NPC System dofile('data/npc/lib/npcsystem/npcsystem.lua') +dofile('data/npc/lib/npcsystem/customModules.lua') function msgcontains(message, keyword) local message, keyword = message:lower(), keyword:lower() diff --git a/path_8_7/data/npc/lib/npcsystem/customModules.lua b/path_8_7/data/npc/lib/npcsystem/customModules.lua new file mode 100644 index 000000000..f44c8a8b0 --- /dev/null +++ b/path_8_7/data/npc/lib/npcsystem/customModules.lua @@ -0,0 +1,192 @@ +-- Custom Modules, created to help us in this datapack +local travelDiscounts = { + ['postman'] = {price = 10, storage = 12460, value = 3}, + ['new frontier'] = {price = 50, storage = 12133, value = 1} +} + +function StdModule.travelDiscount(player, discounts) + local discountPrice, discount = 0 + if type(discounts) == 'string' then + discount = travelDiscounts[discounts] + if discount and player:getStorageValue(discount.storage) >= discount.value then + return discount.price + end + else + for i = 1, #discounts do + discount = travelDiscounts[discounts[i]] + if discount and player:getStorageValue(discount.storage) >= discount.value then + discountPrice = discountPrice + discount.price + end + end + end + + return discountPrice +end + +function StdModule.kick(cid, message, keywords, parameters, node) + local npcHandler = parameters.npcHandler + if npcHandler == nil then + error("StdModule.travel called without any npcHandler instance.") + end + + if not npcHandler:isFocused(cid) then + return false + end + + npcHandler:releaseFocus(cid) + npcHandler:say(parameters.text or "Off with you!", cid) + + local destination = parameters.destination + if type(destination) == 'table' then + destination = destination[math.random(#destination)] + end + + Player(cid):teleportTo(destination, true) + + npcHandler:resetNpc(cid) + return true +end + +local GreetModule = {} +function GreetModule.greet(cid, message, keywords, parameters) + if not parameters.npcHandler:isInRange(cid) then + return true + end + + if parameters.npcHandler:isFocused(cid) then + return true + end + + local parseInfo = { [TAG_PLAYERNAME] = Player(cid):getName() } + parameters.npcHandler:say(parameters.npcHandler:parseMessage(parameters.text, parseInfo), cid, true) + parameters.npcHandler:addFocus(cid) + return true +end + +function GreetModule.farewell(cid, message, keywords, parameters) + if not parameters.npcHandler:isFocused(cid) then + return false + end + + local parseInfo = { [TAG_PLAYERNAME] = Player(cid):getName() } + parameters.npcHandler:say(parameters.npcHandler:parseMessage(parameters.text, parseInfo), cid, true) + parameters.npcHandler:resetNpc(cid) + parameters.npcHandler:releaseFocus(cid) + return true +end + +-- Adds a keyword which acts as a greeting word +function KeywordHandler:addGreetKeyword(keys, parameters, condition, action) + local keys = keys + keys.callback = FocusModule.messageMatcherDefault + return self:addKeyword(keys, GreetModule.greet, parameters, condition, action) +end + +-- Adds a keyword which acts as a farewell word +function KeywordHandler:addFarewellKeyword(keys, parameters, condition, action) + local keys = keys + keys.callback = FocusModule.messageMatcherDefault + return self:addKeyword(keys, GreetModule.farewell, parameters, condition, action) +end + +-- Adds a keyword which acts as a spell word +function KeywordHandler:addSpellKeyword(keys, parameters) + local keys = keys + keys.callback = FocusModule.messageMatcherDefault + + local npcHandler, spellName, price, vocationId = parameters.npcHandler, parameters.spellName, parameters.price, parameters.vocation + local spellKeyword = self:addKeyword(keys, StdModule.say, {npcHandler = npcHandler, text = string.format("Do you want to learn the spell '%s' for %s?", spellName, price > 0 and price .. ' gold' or 'free')}, + function(player) + local baseVocationId = player:getVocation():getBase():getId() + if type(vocationId) == 'table' then + return isInArray(vocationId, baseVocationId) + else + return vocationId == baseVocationId + end + end + ) + + spellKeyword:addChildKeyword({'yes'}, StdModule.learnSpell, {npcHandler = npcHandler, spellName = spellName, level = parameters.level, price = price}) + spellKeyword:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, text = 'Maybe next time.', reset = true}) +end + +local hints = { + [-1] = 'If you don\'t know the meaning of an icon on the right side, move the mouse cursor on it and wait a moment.', + [0] = 'Send private messages to other players by right-clicking on the player or the player\'s name and select \'Message to ....\'. You can also open a \'private message channel\' and type in the name of the player.', + [1] = 'Use the shortcuts \'SHIFT\' to look, \'CTRL\' for use and \'ALT\' for attack when clicking on an object or player.', + [2] = 'If you already know where you want to go, click on the automap and your character will walk there automatically if the location is reachable and not too far away.', + [3] = 'To open or close skills, battle or VIP list, click on the corresponding button to the right.', + [4] = '\'Capacity\' restricts the amount of things you can carry with you. It raises with each level.', + [5] = 'Always have a look on your health bar. If you see that you do not regenerate health points anymore, eat something.', + [6] = 'Always eat as much food as possible. This way, you\'ll regenerate health points for a longer period of time.', + [7] = 'After you have killed a monster, you have 10 seconds in which the corpse is not moveable and no one else but you can loot it.', + [8] = 'Be careful when you approach three or more monsters because you only can block the attacks of two. In such a situation even a few rats can do severe damage or even kill you.', + [9] = 'There are many ways to gather food. Many creatures drop food but you can also pick blueberries or bake your own bread. If you have a fishing rod and worms in your inventory, you can also try to catch a fish.', + [10] = {'Baking bread is rather complex. First of all you need a scythe to harvest wheat. Then you use the wheat with a millstone to get flour. ...', 'This can be be used on water to get dough, which can be used on an oven to bake bread. Use milk instead of water to get cake dough.'}, + [11] = 'Dying hurts! Better run away than risk your life. You are going to lose experience and skill points when you die.', + [12] = 'When you switch to \'Offensive Fighting\', you deal out more damage but you also get hurt more easily.', + [13] = 'When you are on low health and need to run away from a monster, switch to \'Defensive Fighting\' and the monster will hit you less severely.', + [14] = 'Many creatures try to run away from you. Select \'Chase Opponent\' to follow them.', + [15] = 'The deeper you enter a dungeon, the more dangerous it will be. Approach every dungeon with utmost care or an unexpected creature might kill you. This will result in losing experience and skill points.', + [16] = 'Due to the perspective, some objects in Tibia are not located at the spot they seem to appear (ladders, windows, lamps). Try clicking on the floor tile the object would lie on.', + [17] = 'If you want to trade an item with another player, right-click on the item and select \'Trade with ...\', then click on the player with whom you want to trade.', + [18] = 'Stairs, ladders and dungeon entrances are marked as yellow dots on the automap.', + [19] = 'You can get food by killing animals or monsters. You can also pick blueberries or bake your own bread. If you are too lazy or own too much money, you can also buy food.', + [20] = 'Quest containers can be recognised easily. They don\'t open up regularly but display a message \'You have found ....\'. They can only be opened once.', + [21] = 'Better run away than risk to die. You\'ll lose experience and skill points each time you die.', + [22] = 'You can form a party by right-clicking on a player and selecting \'Invite to Party\'. The party leader can also enable \'Shared Experience\' by right-clicking on him- or herself.', + [23] = 'You can assign spells, the use of items, or random text to \'hotkeys\'. You find them under \'Options\'.', + [24] = 'You can also follow other players. Just right-click on the player and select \'Follow\'.', + [25] = 'You can found a party with your friends by right-clicking on a player and selecting \'Invite to Party\'. If you are invited to a party, right-click on yourself and select \'Join Party\'.', + [26] = 'Only found parties with people you trust. You can attack people in your party without getting a skull. This is helpful for training your skills, but can be abused to kill people without having to fear negative consequences.', + [27] = 'The leader of a party has the option to distribute gathered experience among all players in the party. If you are the leader, right-click on yourself and select \'Enable Shared Experience\'.', + [28] = 'There is nothing more I can tell you. If you are still in need of some {hints}, I can repeat them for you.' +} + +-- VoiceModule +VoiceModule = { + voices = nil, + voiceCount = 0, + lastVoice = 0, + timeout = nil, + chance = nil, + npcHandler = nil +} + +-- Creates a new instance of VoiceModule +function VoiceModule:new(voices, timeout, chance) + local obj = {} + setmetatable(obj, self) + self.__index = self + + obj.voices = voices + for i = 1, #obj.voices do + local voice = obj.voices[i] + if voice.yell then + voice.yell = nil + voice.talktype = TALKTYPE_YELL + else + voice.talktype = TALKTYPE_SAY + end + end + + obj.voiceCount = #voices + obj.timeout = timeout or 10 + obj.chance = chance or 25 + return obj +end + +function VoiceModule:init(handler) + return true +end + +function VoiceModule:callbackOnThink() + if self.lastVoice < os.time() then + self.lastVoice = os.time() + self.timeout + if math.random(100) < self.chance then + local voice = self.voices[math.random(self.voiceCount)] + Npc():say(voice.text, voice.talktype) + end + end + return true +end diff --git a/path_8_7/data/npc/lib/npcsystem/npchandler.lua b/path_8_7/data/npc/lib/npcsystem/npchandler.lua index fb7985fc9..dd82d4f34 100644 --- a/path_8_7/data/npc/lib/npcsystem/npchandler.lua +++ b/path_8_7/data/npc/lib/npcsystem/npchandler.lua @@ -358,6 +358,16 @@ if NpcHandler == nil then -- Handles onCreatureAppear events. If you with to handle this yourself, please use the CALLBACK_CREATURE_APPEAR callback. function NpcHandler:onCreatureAppear(creature) local cid = creature:getId() + if cid == getNpcCid() and next(self.shopItems) ~= nil then + local npc = Npc() + local speechBubble = npc:getSpeechBubble() + if speechBubble == 3 then + npc:setSpeechBubble(4) + else + npc:setSpeechBubble(2) + end + end + local callback = self:getCallback(CALLBACK_CREATURE_APPEAR) if callback == nil or callback(cid) then if self:processModuleCallback(CALLBACK_CREATURE_APPEAR, cid) then diff --git a/path_8_7/data/npc/scripts/bank.lua b/path_8_7/data/npc/scripts/bank.lua new file mode 100644 index 000000000..e20f20a92 --- /dev/null +++ b/path_8_7/data/npc/scripts/bank.lua @@ -0,0 +1,323 @@ +local keywordHandler = KeywordHandler:new() +local npcHandler = NpcHandler:new(keywordHandler) +NpcSystem.parseParameters(npcHandler) + +local count = {} +local transfer = {} + +function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end +function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end +function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end +function onThink() npcHandler:onThink() end + +local voices = { {text = 'It\'s a wise idea to store your money in your bank account.'} } +npcHandler:addModule(VoiceModule:new(voices)) + +local function greetCallback(cid) + count[cid], transfer[cid] = nil, nil + return true +end + +local function creatureSayCallback(cid, type, msg) + if not npcHandler:isFocused(cid) then + return false + end + local player = Player(cid) +---------------------------- help ------------------------ + if msgcontains(msg, 'bank account') then + npcHandler:say({ + 'Every Tibian has one. The big advantage is that you can access your money in every branch of the Tibian Bank! ...', + 'Would you like to know more about the {basic} functions of your bank account, the {advanced} functions, or are you already bored, perhaps?' + }, cid) + npcHandler.topic[cid] = 0 + return true +---------------------------- balance --------------------- + elseif msgcontains(msg, 'balance') then + npcHandler.topic[cid] = 0 + if player:getBankBalance() >= 100000000 then + npcHandler:say('I think you must be one of the richest inhabitants in the world! Your account balance is ' .. player:getBankBalance() .. ' gold.', cid) + return true + elseif player:getBankBalance() >= 10000000 then + npcHandler:say('You have made ten millions and it still grows! Your account balance is ' .. player:getBankBalance() .. ' gold.', cid) + return true + elseif player:getBankBalance() >= 1000000 then + npcHandler:say('Wow, you have reached the magic number of a million gp!!! Your account balance is ' .. player:getBankBalance() .. ' gold!', cid) + return true + elseif player:getBankBalance() >= 100000 then + npcHandler:say('You certainly have made a pretty penny. Your account balance is ' .. player:getBankBalance() .. ' gold.', cid) + return true + else + npcHandler:say('Your account balance is ' .. player:getBankBalance() .. ' gold.', cid) + return true + end +---------------------------- deposit --------------------- + elseif msgcontains(msg, 'deposit') then + count[cid] = player:getMoney() + if count[cid] < 1 then + npcHandler:say('You do not have enough gold.', cid) + npcHandler.topic[cid] = 0 + return false + end + if msgcontains(msg, 'all') then + count[cid] = player:getMoney() + npcHandler:say('Would you really like to deposit ' .. count[cid] .. ' gold?', cid) + npcHandler.topic[cid] = 2 + return true + else + if string.match(msg,'%d+') then + count[cid] = getMoneyCount(msg) + if count[cid] < 1 then + npcHandler:say('You do not have enough gold.', cid) + npcHandler.topic[cid] = 0 + return false + end + npcHandler:say('Would you really like to deposit ' .. count[cid] .. ' gold?', cid) + npcHandler.topic[cid] = 2 + return true + else + npcHandler:say('Please tell me how much gold it is you would like to deposit.', cid) + npcHandler.topic[cid] = 1 + return true + end + end + if not isValidMoney(count[cid]) then + npcHandler:say('Sorry, but you can\'t deposit that much.', cid) + npcHandler.topic[cid] = 0 + return false + end + elseif npcHandler.topic[cid] == 1 then + count[cid] = getMoneyCount(msg) + if isValidMoney(count[cid]) then + npcHandler:say('Would you really like to deposit ' .. count[cid] .. ' gold?', cid) + npcHandler.topic[cid] = 2 + return true + else + npcHandler:say('You do not have enough gold.', cid) + npcHandler.topic[cid] = 0 + return true + end + elseif npcHandler.topic[cid] == 2 then + if msgcontains(msg, 'yes') then + if player:getMoney() >= tonumber(count[cid]) then + player:depositMoney(count[cid]) + npcHandler:say('Alright, we have added the amount of ' .. count[cid] .. ' gold to your {balance}. You can {withdraw} your money anytime you want to.', cid) + else + npcHandler:say('You do not have enough gold.', cid) + end + elseif msgcontains(msg, 'no') then + npcHandler:say('As you wish. Is there something else I can do for you?', cid) + end + npcHandler.topic[cid] = 0 + return true +---------------------------- withdraw -------------------- + elseif msgcontains(msg, 'withdraw') then + if string.match(msg,'%d+') then + count[cid] = getMoneyCount(msg) + if isValidMoney(count[cid]) then + npcHandler:say('Are you sure you wish to withdraw ' .. count[cid] .. ' gold from your bank account?', cid) + npcHandler.topic[cid] = 7 + else + npcHandler:say('There is not enough gold on your account.', cid) + npcHandler.topic[cid] = 0 + end + return true + else + npcHandler:say('Please tell me how much gold you would like to withdraw.', cid) + npcHandler.topic[cid] = 6 + return true + end + elseif npcHandler.topic[cid] == 6 then + count[cid] = getMoneyCount(msg) + if isValidMoney(count[cid]) then + npcHandler:say('Are you sure you wish to withdraw ' .. count[cid] .. ' gold from your bank account?', cid) + npcHandler.topic[cid] = 7 + else + npcHandler:say('There is not enough gold on your account.', cid) + npcHandler.topic[cid] = 0 + end + return true + elseif npcHandler.topic[cid] == 7 then + if msgcontains(msg, 'yes') then + if player:getFreeCapacity() >= getMoneyWeight(count[cid]) then + if not player:withdrawMoney(count[cid]) then + npcHandler:say('There is not enough gold on your account.', cid) + else + npcHandler:say('Here you are, ' .. count[cid] .. ' gold. Please let me know if there is something else I can do for you.', cid) + end + else + npcHandler:say('Whoah, hold on, you have no room in your inventory to carry all those coins. I don\'t want you to drop it on the floor, maybe come back with a cart!', cid) + end + npcHandler.topic[cid] = 0 + elseif msgcontains(msg, 'no') then + npcHandler:say('The customer is king! Come back anytime you want to if you wish to {withdraw} your money.', cid) + npcHandler.topic[cid] = 0 + end + return true +---------------------------- transfer -------------------- + elseif msgcontains(msg, 'transfer') then + npcHandler:say('Please tell me the amount of gold you would like to transfer.', cid) + npcHandler.topic[cid] = 11 + elseif npcHandler.topic[cid] == 11 then + count[cid] = getMoneyCount(msg) + if player:getBankBalance() < count[cid] then + npcHandler:say('There is not enough gold on your account.', cid) + npcHandler.topic[cid] = 0 + return true + end + if isValidMoney(count[cid]) then + npcHandler:say('Who would you like transfer ' .. count[cid] .. ' gold to?', cid) + npcHandler.topic[cid] = 12 + else + npcHandler:say('There is not enough gold on your account.', cid) + npcHandler.topic[cid] = 0 + end + elseif npcHandler.topic[cid] == 12 then + transfer[cid] = msg + if player:getName() == transfer[cid] then + npcHandler:say('Fill in this field with person who receives your gold!', cid) + npcHandler.topic[cid] = 0 + return true + end + if playerExists(transfer[cid]) then + npcHandler:say('So you would like to transfer ' .. count[cid] .. ' gold to ' .. transfer[cid] .. '?', cid) + npcHandler.topic[cid] = 13 + else + npcHandler:say('This player does not exist.', cid) + npcHandler.topic[cid] = 0 + end + elseif npcHandler.topic[cid] == 13 then + if msgcontains(msg, 'yes') then + if not player:transferMoneyTo(transfer[cid], count[cid]) then + npcHandler:say('You cannot transfer money to this account.', cid) + else + npcHandler:say('Very well. You have transferred ' .. count[cid] .. ' gold to ' .. transfer[cid] ..'.', cid) + transfer[cid] = nil + end + elseif msgcontains(msg, 'no') then + npcHandler:say('Alright, is there something else I can do for you?', cid) + end + npcHandler.topic[cid] = 0 +---------------------------- money exchange -------------- + elseif msgcontains(msg, 'change gold') then + npcHandler:say('How many platinum coins would you like to get?', cid) + npcHandler.topic[cid] = 14 + elseif npcHandler.topic[cid] == 14 then + if getMoneyCount(msg) < 1 then + npcHandler:say('Sorry, you do not have enough gold coins.', cid) + npcHandler.topic[cid] = 0 + else + count[cid] = getMoneyCount(msg) + npcHandler:say('So you would like me to change ' .. count[cid] * 100 .. ' of your gold coins into ' .. count[cid] .. ' platinum coins?', cid) + npcHandler.topic[cid] = 15 + end + elseif npcHandler.topic[cid] == 15 then + if msgcontains(msg, 'yes') then + if player:removeItem(2148, count[cid] * 100) then + player:addItem(2152, count[cid]) + npcHandler:say('Here you are.', cid) + else + npcHandler:say('Sorry, you do not have enough gold coins.', cid) + end + else + npcHandler:say('Well, can I help you with something else?', cid) + end + npcHandler.topic[cid] = 0 + elseif msgcontains(msg, 'change platinum') then + npcHandler:say('Would you like to change your platinum coins into gold or crystal?', cid) + npcHandler.topic[cid] = 16 + elseif npcHandler.topic[cid] == 16 then + if msgcontains(msg, 'gold') then + npcHandler:say('How many platinum coins would you like to change into gold?', cid) + npcHandler.topic[cid] = 17 + elseif msgcontains(msg, 'crystal') then + npcHandler:say('How many crystal coins would you like to get?', cid) + npcHandler.topic[cid] = 19 + else + npcHandler:say('Well, can I help you with something else?', cid) + npcHandler.topic[cid] = 0 + end + elseif npcHandler.topic[cid] == 17 then + if getMoneyCount(msg) < 1 then + npcHandler:say('Sorry, you do not have enough platinum coins.', cid) + npcHandler.topic[cid] = 0 + else + count[cid] = getMoneyCount(msg) + npcHandler:say('So you would like me to change ' .. count[cid] .. ' of your platinum coins into ' .. count[cid] * 100 .. ' gold coins for you?', cid) + npcHandler.topic[cid] = 18 + end + elseif npcHandler.topic[cid] == 18 then + if msgcontains(msg, 'yes') then + if player:removeItem(2152, count[cid]) then + player:addItem(2148, count[cid] * 100) + npcHandler:say('Here you are.', cid) + else + npcHandler:say('Sorry, you do not have enough platinum coins.', cid) + end + else + npcHandler:say('Well, can I help you with something else?', cid) + end + npcHandler.topic[cid] = 0 + elseif npcHandler.topic[cid] == 19 then + if getMoneyCount(msg) < 1 then + npcHandler:say('Sorry, you do not have enough platinum coins.', cid) + npcHandler.topic[cid] = 0 + else + count[cid] = getMoneyCount(msg) + npcHandler:say('So you would like me to change ' .. count[cid] * 100 .. ' of your platinum coins into ' .. count[cid] .. ' crystal coins for you?', cid) + npcHandler.topic[cid] = 20 + end + elseif npcHandler.topic[cid] == 20 then + if msgcontains(msg, 'yes') then + if player:removeItem(2152, count[cid] * 100) then + player:addItem(2160, count[cid]) + npcHandler:say('Here you are.', cid) + else + npcHandler:say('Sorry, you do not have enough platinum coins.', cid) + end + else + npcHandler:say('Well, can I help you with something else?', cid) + end + npcHandler.topic[cid] = 0 + elseif msgcontains(msg, 'change crystal') then + npcHandler:say('How many crystal coins would you like to change into platinum?', cid) + npcHandler.topic[cid] = 21 + elseif npcHandler.topic[cid] == 21 then + if getMoneyCount(msg) < 1 then + npcHandler:say('Sorry, you do not have enough crystal coins.', cid) + npcHandler.topic[cid] = 0 + else + count[cid] = getMoneyCount(msg) + npcHandler:say('So you would like me to change ' .. count[cid] .. ' of your crystal coins into ' .. count[cid] * 100 .. ' platinum coins for you?', cid) + npcHandler.topic[cid] = 22 + end + elseif npcHandler.topic[cid] == 22 then + if msgcontains(msg, 'yes') then + if player:removeItem(2160, count[cid]) then + player:addItem(2152, count[cid] * 100) + npcHandler:say('Here you are.', cid) + else + npcHandler:say('Sorry, you do not have enough crystal coins.', cid) + end + else + npcHandler:say('Well, can I help you with something else?', cid) + end + npcHandler.topic[cid] = 0 + end + return true +end + +keywordHandler:addKeyword({'money'}, StdModule.say, {npcHandler = npcHandler, text = 'We can {change} money for you. You can also access your {bank account}.'}) +keywordHandler:addKeyword({'change'}, StdModule.say, {npcHandler = npcHandler, text = 'There are three different coin types in Tibia: 100 gold coins equal 1 platinum coin, 100 platinum coins equal 1 crystal coin. So if you\'d like to change 100 gold into 1 platinum, simply say \'{change gold}\' and then \'1 platinum\'.'}) +keywordHandler:addKeyword({'bank'}, StdModule.say, {npcHandler = npcHandler, text = 'We can {change} money for you. You can also access your {bank account}.'}) +keywordHandler:addKeyword({'advanced'}, StdModule.say, {npcHandler = npcHandler, text = 'Your bank account will be used automatically when you want to {rent} a house or place an offer on an item on the {market}. Let me know if you want to know about how either one works.'}) +keywordHandler:addKeyword({'help'}, StdModule.say, {npcHandler = npcHandler, text = 'You can check the {balance} of your bank account, {deposit} money or {withdraw} it. You can also {transfer} money to other characters, provided that they have a vocation.'}) +keywordHandler:addKeyword({'functions'}, StdModule.say, {npcHandler = npcHandler, text = 'You can check the {balance} of your bank account, {deposit} money or {withdraw} it. You can also {transfer} money to other characters, provided that they have a vocation.'}) +keywordHandler:addKeyword({'basic'}, StdModule.say, {npcHandler = npcHandler, text = 'You can check the {balance} of your bank account, {deposit} money or {withdraw} it. You can also {transfer} money to other characters, provided that they have a vocation.'}) +keywordHandler:addKeyword({'job'}, StdModule.say, {npcHandler = npcHandler, text = 'I work in this bank. I can change money for you and help you with your bank account.'}) +keywordHandler:addKeyword({'name'}, StdModule.say, {npcHandler = npcHandler, text = "My name is Naji. My mother gave me that name because she knew a Paladin with that name. I'm a spare timer hunter by myself, you know! I want to join the {Paw and Fur - hunting elite}!"}) +keywordHandler:addKeyword({'paw and fur'}, StdModule.say, {npcHandler = npcHandler, text = "The Paw and Fur - Hunting Elite is a newly founded hunting society in Port Hope. It is said that they send you on hunting mission. Sounds great if you ask me."}) + +npcHandler:setMessage(MESSAGE_GREET, 'Welcome to the Tibian {bank}, |PLAYERNAME|! What can I do for you?') +npcHandler:setCallback(CALLBACK_GREET, greetCallback) +npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) +npcHandler:addModule(FocusModule:new()) diff --git a/path_8_7/data/npc/scripts/runes.lua b/path_8_7/data/npc/scripts/runes.lua index d111ae736..1ff39598c 100644 --- a/path_8_7/data/npc/scripts/runes.lua +++ b/path_8_7/data/npc/scripts/runes.lua @@ -73,23 +73,23 @@ shopModule:addBuyableItem({'hailstorm rod', 'hailstorm'}, 2183, 15000, 'hailstor shopModule:addBuyableItem({'springsprout rod', 'springsprout'}, 8912, 18000, 'springsprout rod') shopModule:addBuyableItem({'underworld rod', 'underworld'}, 8910, 22000, 'underworld rod') -shopModule:addSellableItem({'wand of vortex', 'vortex'}, 2190, 100, 'wand of vortex') -shopModule:addSellableItem({'wand of dragonbreath', 'dragonbreath'}, 2191, 200, 'wand of dragonbreath') -shopModule:addSellableItem({'wand of decay', 'decay'}, 2188, 1000, 'wand of decay') -shopModule:addSellableItem({'wand of draconia', 'draconia'}, 8921, 1500, 'wand of draconia') -shopModule:addSellableItem({'wand of cosmic energy', 'cosmic energy'}, 2189, 2000, 'wand of cosmic energy') -shopModule:addSellableItem({'wand of inferno', 'inferno'}, 2187, 3000, 'wand of inferno') -shopModule:addSellableItem({'wand of starstorm', 'starstorm'}, 8920, 3600, 'wand of starstorm') -shopModule:addSellableItem({'wand of voodoo', 'voodoo'}, 8922, 4400, 'wand of voodoo') - -shopModule:addSellableItem({'snakebite rod', 'snakebite'}, 2182, 100, 'snakebite rod') -shopModule:addSellableItem({'moonlight rod', 'moonlight'}, 2186, 200, 'moonlight rod') -shopModule:addSellableItem({'necrotic rod', 'necrotic'}, 2185, 1000, 'necrotic rod') -shopModule:addSellableItem({'northwind rod', 'northwind'}, 8911, 1500, 'northwind rod') -shopModule:addSellableItem({'terra rod', 'terra'}, 2181, 2000, 'terra rod') -shopModule:addSellableItem({'hailstorm rod', 'hailstorm'}, 2183, 3000, 'hailstorm rod') -shopModule:addSellableItem({'springsprout rod', 'springsprout'}, 8912, 3600, 'springsprout rod') -shopModule:addSellableItem({'underworld rod', 'underworld'}, 8910, 4400, 'underworld rod') +shopModule:addSellableItem({'wand of vortex', 'vortex'}, 2190, 250, 'wand of vortex') +shopModule:addSellableItem({'wand of dragonbreath', 'dragonbreath'}, 2191, 500, 'wand of dragonbreath') +shopModule:addSellableItem({'wand of decay', 'decay'}, 2188, 2500, 'wand of decay') +shopModule:addSellableItem({'wand of draconia', 'draconia'}, 8921, 3750, 'wand of draconia') +shopModule:addSellableItem({'wand of cosmic energy', 'cosmic energy'}, 2189, 5000, 'wand of cosmic energy') +shopModule:addSellableItem({'wand of inferno', 'inferno'},2187, 7500, 'wand of inferno') +shopModule:addSellableItem({'wand of starstorm', 'starstorm'}, 8920, 9000, 'wand of starstorm') +shopModule:addSellableItem({'wand of voodoo', 'voodoo'}, 8922, 11000, 'wand of voodoo') + +shopModule:addSellableItem({'snakebite rod', 'snakebite'}, 2182, 250,'snakebite rod') +shopModule:addSellableItem({'moonlight rod', 'moonlight'}, 2186, 500, 'moonlight rod') +shopModule:addSellableItem({'necrotic rod', 'necrotic'}, 2185, 2500, 'necrotic rod') +shopModule:addSellableItem({'northwind rod', 'northwind'}, 8911, 3750, 'northwind rod') +shopModule:addSellableItem({'terra rod', 'terra'}, 2181, 5000, 'terra rod') +shopModule:addSellableItem({'hailstorm rod', 'hailstorm'}, 2183, 7500, 'hailstorm rod') +shopModule:addSellableItem({'springsprout rod', 'springsprout'}, 8912, 9000, 'springsprout rod') +shopModule:addSellableItem({'underworld rod', 'underworld'}, 8910, 11000, 'underworld rod') function creatureSayCallback(cid, type, msg) diff --git a/path_8_7/data/spells/lib/spells.lua b/path_8_7/data/spells/lib/spells.lua index 2bf763d8b..bf1c9e98d 100644 --- a/path_8_7/data/spells/lib/spells.lua +++ b/path_8_7/data/spells/lib/spells.lua @@ -1,7 +1,7 @@ --Pre-made areas --Waves -AREA_SHORTWAVE3 = { +AREA_WAVE3 = { {1, 1, 1}, {1, 1, 1}, {0, 3, 0} diff --git a/path_8_7/data/spells/scripts/attack/annihilation.lua b/path_8_7/data/spells/scripts/attack/annihilation.lua index ebb0e50a8..bcdf5bf56 100644 --- a/path_8_7/data/spells/scripts/attack/annihilation.lua +++ b/path_8_7/data/spells/scripts/attack/annihilation.lua @@ -2,17 +2,17 @@ local combat = Combat() combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE) combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_HITAREA) combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_WEAPONTYPE) -combat:setParameter(COMBAT_PARAM_BLOCKARMOR, 1) -combat:setParameter(COMBAT_PARAM_USECHARGES, 1) +combat:setParameter(COMBAT_PARAM_BLOCKARMOR, true) +combat:setParameter(COMBAT_PARAM_USECHARGES, true) function onGetFormulaValues(player, skill, attack, factor) - local skillTotal = skill * attack - local levelTotal = player:getLevel() / 5 - return -(((skillTotal * 0.06) + 13) + (levelTotal)), -(((skillTotal * 0.14) + 34) + (levelTotal)) + local min = (player:getLevel() / 5) + (skill * attack * 0.06) + 13 + local max = (player:getLevel() / 5) + (skill * attack * 0.14) + 34 + return -min, -max end combat:setCallback(CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues") -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/attack/apprentices strike.lua b/path_8_7/data/spells/scripts/attack/apprentices strike.lua index fd9a9afb2..dc094fb17 100644 --- a/path_8_7/data/spells/scripts/attack/apprentices strike.lua +++ b/path_8_7/data/spells/scripts/attack/apprentices strike.lua @@ -9,6 +9,6 @@ end combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/attack/avalanche.lua b/path_8_7/data/spells/scripts/attack/avalanche.lua index bebcb8070..60dbf78a8 100644 --- a/path_8_7/data/spells/scripts/attack/avalanche.lua +++ b/path_8_7/data/spells/scripts/attack/avalanche.lua @@ -12,6 +12,6 @@ end combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") -function onCastSpell(creature, var, isHotkey) - return combat:execute(creature, var) +function onCastSpell(creature, variant, isHotkey) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/attack/berserk.lua b/path_8_7/data/spells/scripts/attack/berserk.lua index c3e4f45ea..9afe6025f 100644 --- a/path_8_7/data/spells/scripts/attack/berserk.lua +++ b/path_8_7/data/spells/scripts/attack/berserk.lua @@ -1,18 +1,18 @@ local combat = Combat() combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE) combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_HITAREA) -combat:setParameter(COMBAT_PARAM_BLOCKARMOR, 1) -combat:setParameter(COMBAT_PARAM_USECHARGES, 1) +combat:setParameter(COMBAT_PARAM_BLOCKARMOR, true) +combat:setParameter(COMBAT_PARAM_USECHARGES, true) combat:setArea(createCombatArea(AREA_SQUARE1X1)) function onGetFormulaValues(player, skill, attack, factor) - local skillTotal = skill * attack - local levelTotal = player:getLevel() / 5 - return -(((skillTotal * 0.03) + 7) + (levelTotal)), -(((skillTotal * 0.05) + 11) + (levelTotal)) + local min = (player:getLevel() / 5) + (skill * attack * 0.03) + 7 + local max = (player:getLevel() / 5) + (skill * attack * 0.05) + 11 + return -min, -max end combat:setCallback(CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues") -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/attack/brutal strike.lua b/path_8_7/data/spells/scripts/attack/brutal strike.lua index e1393c786..e7bf8be50 100644 --- a/path_8_7/data/spells/scripts/attack/brutal strike.lua +++ b/path_8_7/data/spells/scripts/attack/brutal strike.lua @@ -2,17 +2,17 @@ local combat = Combat() combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE) combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_HITAREA) combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_WEAPONTYPE) -combat:setParameter(COMBAT_PARAM_BLOCKARMOR, 1) -combat:setParameter(COMBAT_PARAM_USECHARGES, 1) +combat:setParameter(COMBAT_PARAM_BLOCKARMOR, true) +combat:setParameter(COMBAT_PARAM_USECHARGES, true) function onGetFormulaValues(player, skill, attack, factor) - local skillTotal = skill * attack - local levelTotal = player:getLevel() / 5 - return -(((skillTotal * 0.02) + 4) + (levelTotal)), -(((skillTotal * 0.04) + 9) + (levelTotal)) + local min = (player:getLevel() / 5) + (skill * attack * 0.02) + 4 + local max = (player:getLevel() / 5) + (skill * attack * 0.04) + 9 + return -min, -max end combat:setCallback(CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues") -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/attack/buzz.lua b/path_8_7/data/spells/scripts/attack/buzz.lua new file mode 100644 index 000000000..767c6a301 --- /dev/null +++ b/path_8_7/data/spells/scripts/attack/buzz.lua @@ -0,0 +1,18 @@ +local combat = Combat() +combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_ENERGYDAMAGE) +combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_ENERGYAREA) +combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGY) + +function onGetFormulaValues(player, level, maglevel) + level = math.min(level, 20) + maglevel = math.min(maglevel, 20) + local min = (level / 5) + (maglevel * 0.4) + 2 + local max = (level / 5) + (maglevel * 0.8) + 5 + return -min, -max +end + +combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") + +function onCastSpell(creature, variant) + return combat:execute(creature, variant) +end diff --git a/path_8_7/data/spells/scripts/attack/chill out.lua b/path_8_7/data/spells/scripts/attack/chill out.lua new file mode 100644 index 000000000..1e682567a --- /dev/null +++ b/path_8_7/data/spells/scripts/attack/chill out.lua @@ -0,0 +1,18 @@ +local combat = Combat() +combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_ICEDAMAGE) +combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_ICEAREA) +combat:setArea(createCombatArea(AREA_WAVE4)) + +function onGetFormulaValues(player, level, maglevel) + level = math.min(level, 20) + maglevel = math.min(maglevel, 20) + local min = (level / 5) + (maglevel * 0.3) + 2 + local max = (level / 5) + (maglevel * 0.45) + 3 + return -min, -max +end + +combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") + +function onCastSpell(creature, variant) + return combat:execute(creature, variant) +end diff --git a/path_8_7/data/spells/scripts/attack/curse.lua b/path_8_7/data/spells/scripts/attack/curse.lua index 5d63f50ed..abd967267 100644 --- a/path_8_7/data/spells/scripts/attack/curse.lua +++ b/path_8_7/data/spells/scripts/attack/curse.lua @@ -1,30 +1,30 @@ local combat = Combat() combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_DEATHDAMAGE) -combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_SMALLCLOUDS) +combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MORTAREA) combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_DEATH) local condition = Condition(CONDITION_CURSED) -condition:setParameter(CONDITION_PARAM_DELAYED, 1) +condition:setParameter(CONDITION_PARAM_DELAYED, true) -condition:addDamage(1, 3000, -45) -condition:addDamage(1, 3000, -40) -condition:addDamage(1, 3000, -35) -condition:addDamage(1, 3000, -34) -condition:addDamage(2, 3000, -33) -condition:addDamage(2, 3000, -32) -condition:addDamage(2, 3000, -31) -condition:addDamage(2, 3000, -30) -condition:addDamage(3, 3000, -29) -condition:addDamage(3, 3000, -25) -condition:addDamage(3, 3000, -24) -condition:addDamage(4, 3000, -23) -condition:addDamage(4, 3000, -20) -condition:addDamage(5, 3000, -19) -condition:addDamage(5, 3000, -15) -condition:addDamage(6, 3000, -10) -condition:addDamage(10, 3000, -5) +condition:addDamage(1, 4000, -45) +condition:addDamage(1, 4000, -40) +condition:addDamage(1, 4000, -35) +condition:addDamage(1, 4000, -34) +condition:addDamage(2, 4000, -33) +condition:addDamage(2, 4000, -32) +condition:addDamage(2, 4000, -31) +condition:addDamage(2, 4000, -30) +condition:addDamage(3, 4000, -29) +condition:addDamage(3, 4000, -25) +condition:addDamage(3, 4000, -24) +condition:addDamage(4, 4000, -23) +condition:addDamage(4, 4000, -20) +condition:addDamage(5, 4000, -19) +condition:addDamage(5, 4000, -15) +condition:addDamage(6, 4000, -10) +condition:addDamage(10, 4000, -5) combat:setCondition(condition) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/attack/death strike.lua b/path_8_7/data/spells/scripts/attack/death strike.lua index 980026561..53d2f1873 100644 --- a/path_8_7/data/spells/scripts/attack/death strike.lua +++ b/path_8_7/data/spells/scripts/attack/death strike.lua @@ -11,6 +11,6 @@ end combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/attack/divine caldera.lua b/path_8_7/data/spells/scripts/attack/divine caldera.lua index 3734137c7..ce15a854c 100644 --- a/path_8_7/data/spells/scripts/attack/divine caldera.lua +++ b/path_8_7/data/spells/scripts/attack/divine caldera.lua @@ -11,6 +11,6 @@ end combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/attack/divine missile.lua b/path_8_7/data/spells/scripts/attack/divine missile.lua index 7248d10d0..aad549df2 100644 --- a/path_8_7/data/spells/scripts/attack/divine missile.lua +++ b/path_8_7/data/spells/scripts/attack/divine missile.lua @@ -11,6 +11,6 @@ end combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/attack/electrify.lua b/path_8_7/data/spells/scripts/attack/electrify.lua index d45922490..23eb60195 100644 --- a/path_8_7/data/spells/scripts/attack/electrify.lua +++ b/path_8_7/data/spells/scripts/attack/electrify.lua @@ -4,10 +4,10 @@ combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_ENERGYHIT) combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGY) local condition = Condition(CONDITION_ENERGY) -condition:setParameter(CONDITION_PARAM_DELAYED, 1) -condition:addDamage(25, 3000, -45) +condition:setParameter(CONDITION_PARAM_DELAYED, true) +condition:addDamage(10, 10000, -25) combat:setCondition(condition) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/attack/energy beam.lua b/path_8_7/data/spells/scripts/attack/energy beam.lua index ed1938a4d..47b8c177d 100644 --- a/path_8_7/data/spells/scripts/attack/energy beam.lua +++ b/path_8_7/data/spells/scripts/attack/energy beam.lua @@ -11,6 +11,6 @@ end combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/attack/energy bomb.lua b/path_8_7/data/spells/scripts/attack/energy bomb.lua index 60a275c7b..78726107d 100644 --- a/path_8_7/data/spells/scripts/attack/energy bomb.lua +++ b/path_8_7/data/spells/scripts/attack/energy bomb.lua @@ -5,6 +5,6 @@ combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGYBALL) combat:setParameter(COMBAT_PARAM_CREATEITEM, ITEM_ENERGYFIELD_PVP) combat:setArea(createCombatArea(AREA_SQUARE1X1)) -function onCastSpell(creature, var, isHotkey) - return combat:execute(creature, var) +function onCastSpell(creature, variant, isHotkey) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/attack/energy field.lua b/path_8_7/data/spells/scripts/attack/energy field.lua index 55fb4e68c..f026a05ed 100644 --- a/path_8_7/data/spells/scripts/attack/energy field.lua +++ b/path_8_7/data/spells/scripts/attack/energy field.lua @@ -4,6 +4,6 @@ combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_ENERGYHIT) combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGYBALL) combat:setParameter(COMBAT_PARAM_CREATEITEM, ITEM_ENERGYFIELD_PVP) -function onCastSpell(creature, var, isHotkey) - return combat:execute(creature, var) +function onCastSpell(creature, variant, isHotkey) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/attack/energy strike.lua b/path_8_7/data/spells/scripts/attack/energy strike.lua index a5b5a3bdb..4c6ee5234 100644 --- a/path_8_7/data/spells/scripts/attack/energy strike.lua +++ b/path_8_7/data/spells/scripts/attack/energy strike.lua @@ -11,6 +11,6 @@ end combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/attack/energy wall.lua b/path_8_7/data/spells/scripts/attack/energy wall.lua index 9b023e9df..9888b87d8 100644 --- a/path_8_7/data/spells/scripts/attack/energy wall.lua +++ b/path_8_7/data/spells/scripts/attack/energy wall.lua @@ -5,6 +5,6 @@ combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGYBALL) combat:setParameter(COMBAT_PARAM_CREATEITEM, ITEM_ENERGYFIELD_PVP) combat:setArea(createCombatArea(AREA_WALLFIELD, AREADIAGONAL_WALLFIELD)) -function onCastSpell(creature, var, isHotkey) - return combat:execute(creature, var) +function onCastSpell(creature, variant, isHotkey) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/attack/energy wave.lua b/path_8_7/data/spells/scripts/attack/energy wave.lua index e9206fcc9..a888eca0e 100644 --- a/path_8_7/data/spells/scripts/attack/energy wave.lua +++ b/path_8_7/data/spells/scripts/attack/energy wave.lua @@ -12,6 +12,6 @@ end combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/attack/envenom.lua b/path_8_7/data/spells/scripts/attack/envenom.lua index 1d3942d6f..f5efd08ff 100644 --- a/path_8_7/data/spells/scripts/attack/envenom.lua +++ b/path_8_7/data/spells/scripts/attack/envenom.lua @@ -1,13 +1,13 @@ local combat = Combat() combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_EARTHDAMAGE) -combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_SMALLPLANTS) +combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_CARNIPHILA) combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_EARTH) local condition = Condition(CONDITION_POISON) -condition:setParameter(CONDITION_PARAM_DELAYED, 1) -condition:addDamage(25, 3000, -45) +condition:setParameter(CONDITION_PARAM_DELAYED, true) +condition:addDamage(25, 4000, -45) combat:setCondition(condition) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/attack/eternal winter.lua b/path_8_7/data/spells/scripts/attack/eternal winter.lua index 1b2f2d6bc..29639e8cf 100644 --- a/path_8_7/data/spells/scripts/attack/eternal winter.lua +++ b/path_8_7/data/spells/scripts/attack/eternal winter.lua @@ -11,6 +11,6 @@ end combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/attack/ethereal spear.lua b/path_8_7/data/spells/scripts/attack/ethereal spear.lua index aae01c875..d97832f5a 100644 --- a/path_8_7/data/spells/scripts/attack/ethereal spear.lua +++ b/path_8_7/data/spells/scripts/attack/ethereal spear.lua @@ -2,16 +2,17 @@ local combat = Combat() combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE) combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_HITAREA) combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ETHEREALSPEAR) -combat:setParameter(COMBAT_PARAM_BLOCKSHIELD, 1) +combat:setParameter(COMBAT_PARAM_BLOCKARMOR, true) -function onGetFormulaValues(player, attack, factor) - local skillTotal = 2 * player:getEffectiveSkillLevel(SKILL_DISTANCE) - local levelTotal = player:getLevel() / 5 - return -(((skillTotal + attack / 3500) * 0.35) + (levelTotal) + 0), -(((skillTotal + attack / 3125) * 0.5) + (levelTotal) + 5) +function onGetFormulaValues(player, skill, attack, factor) + local distSkill = player:getEffectiveSkillLevel(SKILL_DISTANCE) + local min = (player:getLevel() / 5) + distSkill * 0.7 + local max = (player:getLevel() / 5) + distSkill + 5 + return -min, -max end combat:setCallback(CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues") -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/attack/explosion.lua b/path_8_7/data/spells/scripts/attack/explosion.lua index 0ce525865..ddb1dc5a3 100644 --- a/path_8_7/data/spells/scripts/attack/explosion.lua +++ b/path_8_7/data/spells/scripts/attack/explosion.lua @@ -2,7 +2,7 @@ local combat = Combat() combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE) combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_EXPLOSIONAREA) combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_EXPLOSION) -combat:setParameter(COMBAT_PARAM_BLOCKARMOR, 1) +combat:setParameter(COMBAT_PARAM_BLOCKARMOR, true) combat:setArea(createCombatArea(AREA_CROSS1X1)) function onGetFormulaValues(player, level, maglevel) @@ -13,6 +13,6 @@ end combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") -function onCastSpell(creature, var, isHotkey) - return combat:execute(creature, var) +function onCastSpell(creature, variant, isHotkey) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/attack/fierce berserk.lua b/path_8_7/data/spells/scripts/attack/fierce berserk.lua index 7d989971e..1f051ba06 100644 --- a/path_8_7/data/spells/scripts/attack/fierce berserk.lua +++ b/path_8_7/data/spells/scripts/attack/fierce berserk.lua @@ -1,18 +1,18 @@ local combat = Combat() combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE) combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_HITAREA) -combat:setParameter(COMBAT_PARAM_BLOCKARMOR, 1) -combat:setParameter(COMBAT_PARAM_USECHARGES, 1) +combat:setParameter(COMBAT_PARAM_BLOCKARMOR, true) +combat:setParameter(COMBAT_PARAM_USECHARGES, true) combat:setArea(createCombatArea(AREA_SQUARE1X1)) function onGetFormulaValues(player, skill, attack, factor) - local skillTotal = skill * attack - local levelTotal = player:getLevel() / 5 - return -(((skillTotal * 0.06) + 13) + (levelTotal)), -(((skillTotal * 0.11) + 27) + (levelTotal)) + local min = (player:getLevel() / 5) + (skill * attack * 0.06) + 13 + local max = (player:getLevel() / 5) + (skill * attack * 0.11) + 27 + return -min, -max end combat:setCallback(CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues") -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/attack/fire bomb.lua b/path_8_7/data/spells/scripts/attack/fire bomb.lua index 9e982efaa..eba9401f8 100644 --- a/path_8_7/data/spells/scripts/attack/fire bomb.lua +++ b/path_8_7/data/spells/scripts/attack/fire bomb.lua @@ -5,6 +5,6 @@ combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_FIRE) combat:setParameter(COMBAT_PARAM_CREATEITEM, ITEM_FIREFIELD_PVP_FULL) combat:setArea(createCombatArea(AREA_SQUARE1X1)) -function onCastSpell(creature, var, isHotkey) - return combat:execute(creature, var) +function onCastSpell(creature, variant, isHotkey) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/attack/fire field.lua b/path_8_7/data/spells/scripts/attack/fire field.lua index e214679eb..59b2aa7e4 100644 --- a/path_8_7/data/spells/scripts/attack/fire field.lua +++ b/path_8_7/data/spells/scripts/attack/fire field.lua @@ -4,6 +4,6 @@ combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_HITBYFIRE) combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_FIRE) combat:setParameter(COMBAT_PARAM_CREATEITEM, ITEM_FIREFIELD_PVP_FULL) -function onCastSpell(creature, var, isHotkey) - return combat:execute(creature, var) +function onCastSpell(creature, variant, isHotkey) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/attack/fire wall.lua b/path_8_7/data/spells/scripts/attack/fire wall.lua index 203444ef6..8935419a6 100644 --- a/path_8_7/data/spells/scripts/attack/fire wall.lua +++ b/path_8_7/data/spells/scripts/attack/fire wall.lua @@ -5,6 +5,6 @@ combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_FIRE) combat:setParameter(COMBAT_PARAM_CREATEITEM, ITEM_FIREFIELD_PVP_FULL) combat:setArea(createCombatArea(AREA_WALLFIELD, AREADIAGONAL_WALLFIELD)) -function onCastSpell(creature, var, isHotkey) - return combat:execute(creature, var) +function onCastSpell(creature, variant, isHotkey) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/attack/fire wave.lua b/path_8_7/data/spells/scripts/attack/fire wave.lua index 0a674a4ef..98b7f4bc0 100644 --- a/path_8_7/data/spells/scripts/attack/fire wave.lua +++ b/path_8_7/data/spells/scripts/attack/fire wave.lua @@ -11,6 +11,6 @@ end combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/attack/fireball.lua b/path_8_7/data/spells/scripts/attack/fireball.lua index 5615cca3b..1a29dd5c5 100644 --- a/path_8_7/data/spells/scripts/attack/fireball.lua +++ b/path_8_7/data/spells/scripts/attack/fireball.lua @@ -11,6 +11,6 @@ end combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") -function onCastSpell(creature, var, isHotkey) - return combat:execute(creature, var) +function onCastSpell(creature, variant, isHotkey) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/attack/flame strike.lua b/path_8_7/data/spells/scripts/attack/flame strike.lua index 2d737fea7..e8c5130e2 100644 --- a/path_8_7/data/spells/scripts/attack/flame strike.lua +++ b/path_8_7/data/spells/scripts/attack/flame strike.lua @@ -11,6 +11,6 @@ end combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/attack/front sweep.lua b/path_8_7/data/spells/scripts/attack/front sweep.lua index d0ca83bfb..a57b9db02 100644 --- a/path_8_7/data/spells/scripts/attack/front sweep.lua +++ b/path_8_7/data/spells/scripts/attack/front sweep.lua @@ -1,18 +1,18 @@ local combat = Combat() combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE) combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_HITAREA) -combat:setParameter(COMBAT_PARAM_BLOCKARMOR, 1) -combat:setParameter(COMBAT_PARAM_USECHARGES, 1) +combat:setParameter(COMBAT_PARAM_BLOCKARMOR, true) +combat:setParameter(COMBAT_PARAM_USECHARGES, true) combat:setArea(createCombatArea(AREA_WAVE6, AREADIAGONAL_WAVE6)) function onGetFormulaValues(player, skill, attack, factor) - local skillTotal = skill * attack - local levelTotal = player:getLevel() / 5 - return -(((skillTotal * 0.04) + 31) + (levelTotal)), -(((skillTotal * 0.08) + 45) + (levelTotal)) + local min = (player:getLevel() / 5) + (skill * attack * 0.04) + 31 + local max = (player:getLevel() / 5) + (skill * attack * 0.08) + 45 + return -min, -max end combat:setCallback(CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues") -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/attack/great energy beam.lua b/path_8_7/data/spells/scripts/attack/great energy beam.lua index f565ca541..33d4fd6ad 100644 --- a/path_8_7/data/spells/scripts/attack/great energy beam.lua +++ b/path_8_7/data/spells/scripts/attack/great energy beam.lua @@ -11,6 +11,6 @@ end combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/attack/great fireball.lua b/path_8_7/data/spells/scripts/attack/great fireball.lua index 986b0e704..2c9291ae3 100644 --- a/path_8_7/data/spells/scripts/attack/great fireball.lua +++ b/path_8_7/data/spells/scripts/attack/great fireball.lua @@ -12,6 +12,6 @@ end combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") -function onCastSpell(creature, var, isHotkey) - return combat:execute(creature, var) +function onCastSpell(creature, variant, isHotkey) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/attack/groundshaker.lua b/path_8_7/data/spells/scripts/attack/groundshaker.lua index 444d56ad1..bb9995407 100644 --- a/path_8_7/data/spells/scripts/attack/groundshaker.lua +++ b/path_8_7/data/spells/scripts/attack/groundshaker.lua @@ -1,18 +1,18 @@ local combat = Combat() combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE) combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_GROUNDSHAKER) -combat:setParameter(COMBAT_PARAM_BLOCKARMOR, 1) -combat:setParameter(COMBAT_PARAM_USECHARGES, 1) +combat:setParameter(COMBAT_PARAM_BLOCKARMOR, true) +combat:setParameter(COMBAT_PARAM_USECHARGES, true) combat:setArea(createCombatArea(AREA_CIRCLE3X3)) function onGetFormulaValues(player, skill, attack, factor) - local skillTotal = skill * attack - local levelTotal = player:getLevel() / 5 - return -(((skillTotal * 0.02) + 4) + (levelTotal)), -(((skillTotal * 0.03) + 6) + (levelTotal)) + local min = (player:getLevel() / 5) + (skill * attack * 0.02) + 4 + local max = (player:getLevel() / 5) + (skill * attack * 0.03) + 6 + return -min, -max end combat:setCallback(CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues") -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/attack/heavy magic missile.lua b/path_8_7/data/spells/scripts/attack/heavy magic missile.lua index 091e06213..6e6f6dea9 100644 --- a/path_8_7/data/spells/scripts/attack/heavy magic missile.lua +++ b/path_8_7/data/spells/scripts/attack/heavy magic missile.lua @@ -11,6 +11,6 @@ end combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") -function onCastSpell(creature, var, isHotkey) - return combat:execute(creature, var) +function onCastSpell(creature, variant, isHotkey) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/attack/hells core.lua b/path_8_7/data/spells/scripts/attack/hells core.lua index eaa20ad2e..9b93527eb 100644 --- a/path_8_7/data/spells/scripts/attack/hells core.lua +++ b/path_8_7/data/spells/scripts/attack/hells core.lua @@ -11,6 +11,6 @@ end combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/attack/holy flash.lua b/path_8_7/data/spells/scripts/attack/holy flash.lua index bc08b4e8e..b1bff57d1 100644 --- a/path_8_7/data/spells/scripts/attack/holy flash.lua +++ b/path_8_7/data/spells/scripts/attack/holy flash.lua @@ -1,12 +1,13 @@ local combat = Combat() combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_HOLYDAMAGE) +combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_HOLYDAMAGE) combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SMALLHOLY) local condition = Condition(CONDITION_DAZZLED) -condition:setParameter(CONDITION_PARAM_DELAYED, 1) -condition:addDamage(math.random(7,11), 3000, -20) +condition:setParameter(CONDITION_PARAM_DELAYED, true) +condition:addDamage(50, 10000, -10) combat:setCondition(condition) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/attack/holy missile.lua b/path_8_7/data/spells/scripts/attack/holy missile.lua index dd22c5115..b8c25ecef 100644 --- a/path_8_7/data/spells/scripts/attack/holy missile.lua +++ b/path_8_7/data/spells/scripts/attack/holy missile.lua @@ -12,6 +12,6 @@ end combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") -function onCastSpell(creature, var, isHotkey) - return combat:execute(creature, var) +function onCastSpell(creature, variant, isHotkey) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/attack/ice strike.lua b/path_8_7/data/spells/scripts/attack/ice strike.lua index d0bc84b37..5441a316e 100644 --- a/path_8_7/data/spells/scripts/attack/ice strike.lua +++ b/path_8_7/data/spells/scripts/attack/ice strike.lua @@ -11,6 +11,6 @@ end combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/attack/ice wave.lua b/path_8_7/data/spells/scripts/attack/ice wave.lua index 0c58ca67b..3233c29a6 100644 --- a/path_8_7/data/spells/scripts/attack/ice wave.lua +++ b/path_8_7/data/spells/scripts/attack/ice wave.lua @@ -11,6 +11,6 @@ end combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/attack/icicle.lua b/path_8_7/data/spells/scripts/attack/icicle.lua index 9ac266fc1..1ec5c16b7 100644 --- a/path_8_7/data/spells/scripts/attack/icicle.lua +++ b/path_8_7/data/spells/scripts/attack/icicle.lua @@ -1,7 +1,7 @@ local combat = Combat() combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_ICEDAMAGE) -combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_ICEAREA) -combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ICE) +combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_ICEATTACK) +combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SMALLICE) function onGetFormulaValues(player, level, maglevel) local min = (level / 5) + (maglevel * 1.8) + 12 @@ -11,6 +11,6 @@ end combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") -function onCastSpell(creature, var, isHotkey) - return combat:execute(creature, var) +function onCastSpell(creature, variant, isHotkey) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/attack/ignite.lua b/path_8_7/data/spells/scripts/attack/ignite.lua index c8ad83a12..9d69b8f69 100644 --- a/path_8_7/data/spells/scripts/attack/ignite.lua +++ b/path_8_7/data/spells/scripts/attack/ignite.lua @@ -1,12 +1,13 @@ local combat = Combat() combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE) +combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_HITBYFIRE) combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_FIRE) local condition = Condition(CONDITION_FIRE) -condition:setParameter(CONDITION_PARAM_DELAYED, 1) -condition:addDamage(25, 3000, -45) +condition:setParameter(CONDITION_PARAM_DELAYED, true) +condition:addDamage(23, 10000, -10) combat:setCondition(condition) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/attack/inflict wound.lua b/path_8_7/data/spells/scripts/attack/inflict wound.lua index 0558c5f3f..319cefc39 100644 --- a/path_8_7/data/spells/scripts/attack/inflict wound.lua +++ b/path_8_7/data/spells/scripts/attack/inflict wound.lua @@ -1,15 +1,13 @@ local combat = Combat() combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE) -combat:setParameter(COMBAT_PARAM_TARGETCASTERORTOPMOST, 1) combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_DRAWBLOOD) combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_WEAPONTYPE) -combat:setParameter(COMBATPARAM_USECHARGES, 1) local condition = Condition(CONDITION_BLEEDING) -condition:setParameter(CONDITION_PARAM_DELAYED, 10) -condition:addDamage(15, 2000, -50) +condition:setParameter(CONDITION_PARAM_DELAYED, true) +condition:addDamage(25, 4000, -45) combat:setCondition(condition) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/attack/light magic missile.lua b/path_8_7/data/spells/scripts/attack/light magic missile.lua index 7b23ba65e..977d302cd 100644 --- a/path_8_7/data/spells/scripts/attack/light magic missile.lua +++ b/path_8_7/data/spells/scripts/attack/light magic missile.lua @@ -11,6 +11,6 @@ end combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") -function onCastSpell(creature, var, isHotkey) - return combat:execute(creature, var) +function onCastSpell(creature, variant, isHotkey) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/attack/light stone shower.lua b/path_8_7/data/spells/scripts/attack/light stone shower.lua new file mode 100644 index 000000000..54f6379f8 --- /dev/null +++ b/path_8_7/data/spells/scripts/attack/light stone shower.lua @@ -0,0 +1,19 @@ +local combat = Combat() +combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_EARTHDAMAGE) +combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_STONES) +combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_EARTH) +combat:setArea(createCombatArea(AREA_CROSS1X1)) + +function onGetFormulaValues(player, level, maglevel) + level = math.min(level, 20) + maglevel = math.min(maglevel, 20) + local min = (level / 5) + (maglevel * 0.3) + 2 + local max = (level / 5) + (maglevel * 0.45) + 3 + return -min, -max +end + +combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") + +function onCastSpell(creature, variant, isHotkey) + return combat:execute(creature, variant) +end diff --git a/path_8_7/data/spells/scripts/attack/lightest magic missile.lua b/path_8_7/data/spells/scripts/attack/lightest magic missile.lua index 1794ea5e7..04ed8b505 100644 --- a/path_8_7/data/spells/scripts/attack/lightest magic missile.lua +++ b/path_8_7/data/spells/scripts/attack/lightest magic missile.lua @@ -9,6 +9,6 @@ end combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") -function onCastSpell(creature, var, isHotkey) - return combat:execute(creature, var) +function onCastSpell(creature, variant, isHotkey) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/attack/lightest missile.lua b/path_8_7/data/spells/scripts/attack/lightest missile.lua new file mode 100644 index 000000000..e9168459a --- /dev/null +++ b/path_8_7/data/spells/scripts/attack/lightest missile.lua @@ -0,0 +1,18 @@ +local combat = Combat() +combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_ENERGYDAMAGE) +combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_ENERGYHIT) +combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGY) + +function onGetFormulaValues(player, level, maglevel) + level = math.min(level, 20) + maglevel = math.min(maglevel, 20) + local min = (level / 5) + (maglevel * 0.45) + 3 + local max = (level / 5) + (maglevel * 0.7) + 4 + return -min, -max +end + +combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") + +function onCastSpell(creature, variant, isHotkey) + return combat:execute(creature, variant) +end diff --git a/path_8_7/data/spells/scripts/attack/lightning.lua b/path_8_7/data/spells/scripts/attack/lightning.lua index 9126bdc7d..fbfa8f44c 100644 --- a/path_8_7/data/spells/scripts/attack/lightning.lua +++ b/path_8_7/data/spells/scripts/attack/lightning.lua @@ -11,6 +11,6 @@ end combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/attack/mud attack.lua b/path_8_7/data/spells/scripts/attack/mud attack.lua new file mode 100644 index 000000000..450eb0a3b --- /dev/null +++ b/path_8_7/data/spells/scripts/attack/mud attack.lua @@ -0,0 +1,18 @@ +local combat = Combat() +combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_EARTHDAMAGE) +combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_CARNIPHILA) +combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SMALLEARTH) + +function onGetFormulaValues(player, level, maglevel) + level = math.min(level, 20) + maglevel = math.min(maglevel, 20) + local min = (level / 5) + (maglevel * 0.4) + 2 + local max = (level / 5) + (maglevel * 0.8) + 5 + return -min, -max +end + +combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") + +function onCastSpell(creature, variant) + return combat:execute(creature, variant) +end diff --git a/path_8_7/data/spells/scripts/attack/physical strike.lua b/path_8_7/data/spells/scripts/attack/physical strike.lua index 3e09a552c..1d0caac18 100644 --- a/path_8_7/data/spells/scripts/attack/physical strike.lua +++ b/path_8_7/data/spells/scripts/attack/physical strike.lua @@ -2,7 +2,7 @@ local combat = Combat() combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE) combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_EXPLOSIONAREA) combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_EXPLOSION) -combat:setParameter(COMBAT_PARAM_BLOCKARMOR, 1) +combat:setParameter(COMBAT_PARAM_BLOCKARMOR, true) function onGetFormulaValues(player, level, maglevel) local min = (level / 5) + (maglevel * 1.6) + 9 @@ -12,6 +12,6 @@ end combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/attack/poison bomb.lua b/path_8_7/data/spells/scripts/attack/poison bomb.lua index daebbaa9c..ec5522574 100644 --- a/path_8_7/data/spells/scripts/attack/poison bomb.lua +++ b/path_8_7/data/spells/scripts/attack/poison bomb.lua @@ -5,6 +5,6 @@ combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_POISON) combat:setParameter(COMBAT_PARAM_CREATEITEM, ITEM_POISONFIELD_PVP) combat:setArea(createCombatArea(AREA_SQUARE1X1)) -function onCastSpell(creature, var, isHotkey) - return combat:execute(creature, var) +function onCastSpell(creature, variant, isHotkey) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/attack/poison field.lua b/path_8_7/data/spells/scripts/attack/poison field.lua index 30c235c91..f4e9e6224 100644 --- a/path_8_7/data/spells/scripts/attack/poison field.lua +++ b/path_8_7/data/spells/scripts/attack/poison field.lua @@ -4,6 +4,6 @@ combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_GREEN_RINGS) combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_POISON) combat:setParameter(COMBAT_PARAM_CREATEITEM, ITEM_POISONFIELD_PVP) -function onCastSpell(creature, var, isHotkey) - return combat:execute(creature, var) +function onCastSpell(creature, variant, isHotkey) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/attack/poison wall.lua b/path_8_7/data/spells/scripts/attack/poison wall.lua index be2fece91..a9b8460ae 100644 --- a/path_8_7/data/spells/scripts/attack/poison wall.lua +++ b/path_8_7/data/spells/scripts/attack/poison wall.lua @@ -5,6 +5,6 @@ combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_POISON) combat:setParameter(COMBAT_PARAM_CREATEITEM, ITEM_POISONFIELD_PVP) combat:setArea(createCombatArea(AREA_WALLFIELD, AREADIAGONAL_WALLFIELD)) -function onCastSpell(creature, var, isHotkey) - return combat:execute(creature, var) +function onCastSpell(creature, variant, isHotkey) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/attack/practise fire wave.lua b/path_8_7/data/spells/scripts/attack/practise fire wave.lua index 2beca088d..7a468fffc 100644 --- a/path_8_7/data/spells/scripts/attack/practise fire wave.lua +++ b/path_8_7/data/spells/scripts/attack/practise fire wave.lua @@ -9,6 +9,6 @@ end combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/attack/rage of the skies.lua b/path_8_7/data/spells/scripts/attack/rage of the skies.lua index 17683e133..20aa89cd0 100644 --- a/path_8_7/data/spells/scripts/attack/rage of the skies.lua +++ b/path_8_7/data/spells/scripts/attack/rage of the skies.lua @@ -11,6 +11,6 @@ end combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/attack/scorch.lua b/path_8_7/data/spells/scripts/attack/scorch.lua new file mode 100644 index 000000000..0dfbc5cf6 --- /dev/null +++ b/path_8_7/data/spells/scripts/attack/scorch.lua @@ -0,0 +1,18 @@ +local combat = Combat() +combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE) +combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_HITBYFIRE) +combat:setArea(createCombatArea(AREA_WAVE4)) + +function onGetFormulaValues(player, level, maglevel) + level = math.min(level, 20) + maglevel = math.min(maglevel, 20) + local min = (level / 5) + (maglevel * 0.3) + 2 + local max = (level / 5) + (maglevel * 0.45) + 3 + return -min, -max +end + +combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") + +function onCastSpell(creature, variant) + return combat:execute(creature, variant) +end diff --git a/path_8_7/data/spells/scripts/attack/soul fire.lua b/path_8_7/data/spells/scripts/attack/soul fire.lua index e606baf7d..74ee7015c 100644 --- a/path_8_7/data/spells/scripts/attack/soul fire.lua +++ b/path_8_7/data/spells/scripts/attack/soul fire.lua @@ -4,10 +4,10 @@ combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_HITBYFIRE) combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_FIRE) local condition = Condition(CONDITION_FIRE) -condition:setParameter(CONDITION_PARAM_DELAYED, 1) -condition:addDamage(10, 2000, -10) +condition:setParameter(CONDITION_PARAM_DELAYED, true) +condition:addDamage(13, 10000, -10) combat:setCondition(condition) -function onCastSpell(creature, var, isHotkey) - return combat:execute(creature, var) +function onCastSpell(creature, variant, isHotkey) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/attack/stalagmite.lua b/path_8_7/data/spells/scripts/attack/stalagmite.lua index d23af2231..e2901383f 100644 --- a/path_8_7/data/spells/scripts/attack/stalagmite.lua +++ b/path_8_7/data/spells/scripts/attack/stalagmite.lua @@ -11,6 +11,6 @@ end combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") -function onCastSpell(creature, var, isHotkey) - return combat:execute(creature, var) +function onCastSpell(creature, variant, isHotkey) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/attack/stone shower.lua b/path_8_7/data/spells/scripts/attack/stone shower.lua index 3b1960c36..c53db830a 100644 --- a/path_8_7/data/spells/scripts/attack/stone shower.lua +++ b/path_8_7/data/spells/scripts/attack/stone shower.lua @@ -5,13 +5,13 @@ combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_EARTH) combat:setArea(createCombatArea(AREA_CIRCLE3X3)) function onGetFormulaValues(player, level, maglevel) - local min = (level / 5) + (maglevel * 1) + 6 + local min = (level / 5) + maglevel + 6 local max = (level / 5) + (maglevel * 2.6) + 16 return -min, -max end combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") -function onCastSpell(creature, var, isHotkey) - return combat:execute(creature, var) +function onCastSpell(creature, variant, isHotkey) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/attack/strong energy strike.lua b/path_8_7/data/spells/scripts/attack/strong energy strike.lua index b99005306..ec7ea6ba5 100644 --- a/path_8_7/data/spells/scripts/attack/strong energy strike.lua +++ b/path_8_7/data/spells/scripts/attack/strong energy strike.lua @@ -11,6 +11,6 @@ end combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/attack/strong ethereal spear.lua b/path_8_7/data/spells/scripts/attack/strong ethereal spear.lua index f759627e0..f0d3dd627 100644 --- a/path_8_7/data/spells/scripts/attack/strong ethereal spear.lua +++ b/path_8_7/data/spells/scripts/attack/strong ethereal spear.lua @@ -2,16 +2,17 @@ local combat = Combat() combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE) combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_HITAREA) combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ETHEREALSPEAR) -combat:setParameter(COMBAT_PARAM_BLOCKSHIELD, 1) +combat:setParameter(COMBAT_PARAM_BLOCKARMOR, true) -function onGetFormulaValues(player, attack, factor) - local skillTotal = 2 * player:getEffectiveSkillLevel(SKILL_DISTANCE) - local levelTotal = player:getLevel() / 5 - return -(((skillTotal + attack / 2500) * 0.5) + (levelTotal) + 7), -(((skillTotal + attack / 1875) * 0.75) + (levelTotal) + 13) +function onGetFormulaValues(player, skill, attack, factor) + local distSkill = player:getEffectiveSkillLevel(SKILL_DISTANCE) + local min = (player:getLevel() / 5) + distSkill + 7 + local max = (player:getLevel() / 5) + (distSkill * 1.5) + 13 + return -min, -max end combat:setCallback(CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues") -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/attack/strong flame strike.lua b/path_8_7/data/spells/scripts/attack/strong flame strike.lua index ecf29f39f..93571f092 100644 --- a/path_8_7/data/spells/scripts/attack/strong flame strike.lua +++ b/path_8_7/data/spells/scripts/attack/strong flame strike.lua @@ -11,6 +11,6 @@ end combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/attack/strong ice strike.lua b/path_8_7/data/spells/scripts/attack/strong ice strike.lua index 5ab6cca75..2a52569ca 100644 --- a/path_8_7/data/spells/scripts/attack/strong ice strike.lua +++ b/path_8_7/data/spells/scripts/attack/strong ice strike.lua @@ -11,6 +11,6 @@ end combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/attack/strong ice wave.lua b/path_8_7/data/spells/scripts/attack/strong ice wave.lua index 16f42158a..5beee5409 100644 --- a/path_8_7/data/spells/scripts/attack/strong ice wave.lua +++ b/path_8_7/data/spells/scripts/attack/strong ice wave.lua @@ -1,7 +1,7 @@ local combat = Combat() combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_ICEDAMAGE) combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_ICEAREA) -combat:setArea(createCombatArea(AREA_SHORTWAVE3)) +combat:setArea(createCombatArea(AREA_WAVE3)) function onGetFormulaValues(player, level, maglevel) local min = (level / 5) + (maglevel * 4.5) + 20 @@ -11,6 +11,6 @@ end combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/attack/strong terra strike.lua b/path_8_7/data/spells/scripts/attack/strong terra strike.lua index 3019d64bd..e6f609af2 100644 --- a/path_8_7/data/spells/scripts/attack/strong terra strike.lua +++ b/path_8_7/data/spells/scripts/attack/strong terra strike.lua @@ -11,6 +11,6 @@ end combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/attack/sudden death.lua b/path_8_7/data/spells/scripts/attack/sudden death.lua index f93c58253..4c68f3224 100644 --- a/path_8_7/data/spells/scripts/attack/sudden death.lua +++ b/path_8_7/data/spells/scripts/attack/sudden death.lua @@ -11,6 +11,6 @@ end combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") -function onCastSpell(creature, var, isHotkey) - return combat:execute(creature, var) +function onCastSpell(creature, variant, isHotkey) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/attack/terra strike.lua b/path_8_7/data/spells/scripts/attack/terra strike.lua index de481aa98..b6ea30bc7 100644 --- a/path_8_7/data/spells/scripts/attack/terra strike.lua +++ b/path_8_7/data/spells/scripts/attack/terra strike.lua @@ -11,6 +11,6 @@ end combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/attack/terra wave.lua b/path_8_7/data/spells/scripts/attack/terra wave.lua index ba176f08d..20131c908 100644 --- a/path_8_7/data/spells/scripts/attack/terra wave.lua +++ b/path_8_7/data/spells/scripts/attack/terra wave.lua @@ -11,6 +11,6 @@ end combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/attack/thunderstorm.lua b/path_8_7/data/spells/scripts/attack/thunderstorm.lua index d03c33fb1..b7150e42d 100644 --- a/path_8_7/data/spells/scripts/attack/thunderstorm.lua +++ b/path_8_7/data/spells/scripts/attack/thunderstorm.lua @@ -5,13 +5,13 @@ combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGYBALL) combat:setArea(createCombatArea(AREA_CIRCLE3X3)) function onGetFormulaValues(player, level, maglevel) - local min = (level / 5) + (maglevel * 1) + 6 + local min = (level / 5) + maglevel + 6 local max = (level / 5) + (maglevel * 2.6) + 16 return -min, -max end combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") -function onCastSpell(creature, var, isHotkey) - return combat:execute(creature, var) +function onCastSpell(creature, variant, isHotkey) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/attack/ultimate energy strike.lua b/path_8_7/data/spells/scripts/attack/ultimate energy strike.lua index ba58f08ad..c81651e1b 100644 --- a/path_8_7/data/spells/scripts/attack/ultimate energy strike.lua +++ b/path_8_7/data/spells/scripts/attack/ultimate energy strike.lua @@ -11,6 +11,6 @@ end combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/attack/ultimate flame strike.lua b/path_8_7/data/spells/scripts/attack/ultimate flame strike.lua index ce62c517f..7216145e5 100644 --- a/path_8_7/data/spells/scripts/attack/ultimate flame strike.lua +++ b/path_8_7/data/spells/scripts/attack/ultimate flame strike.lua @@ -11,6 +11,6 @@ end combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/attack/ultimate ice strike.lua b/path_8_7/data/spells/scripts/attack/ultimate ice strike.lua index 30b69596f..d76f5125a 100644 --- a/path_8_7/data/spells/scripts/attack/ultimate ice strike.lua +++ b/path_8_7/data/spells/scripts/attack/ultimate ice strike.lua @@ -11,6 +11,6 @@ end combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/attack/ultimate terra strike.lua b/path_8_7/data/spells/scripts/attack/ultimate terra strike.lua index b1aad4dda..736707195 100644 --- a/path_8_7/data/spells/scripts/attack/ultimate terra strike.lua +++ b/path_8_7/data/spells/scripts/attack/ultimate terra strike.lua @@ -11,6 +11,6 @@ end combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/attack/whirlwind throw.lua b/path_8_7/data/spells/scripts/attack/whirlwind throw.lua index 2a0e87255..508062132 100644 --- a/path_8_7/data/spells/scripts/attack/whirlwind throw.lua +++ b/path_8_7/data/spells/scripts/attack/whirlwind throw.lua @@ -2,17 +2,17 @@ local combat = Combat() combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE) combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_HITAREA) combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_WEAPONTYPE) -combat:setParameter(COMBAT_PARAM_BLOCKARMOR, 1) -combat:setParameter(COMBAT_PARAM_USECHARGES, 1) +combat:setParameter(COMBAT_PARAM_BLOCKARMOR, true) +combat:setParameter(COMBAT_PARAM_USECHARGES, true) function onGetFormulaValues(player, skill, attack, factor) - local skillTotal = skill * attack - local levelTotal = player:getLevel() / 5 - return -(((skillTotal * 0.01) + 1) + (levelTotal)), -(((skillTotal * 0.03) + 6) + (levelTotal)) + local min = (player:getLevel() / 5) + (skill * attack * 0.01) + 1 + local max = (player:getLevel() / 5) + (skill * attack * 0.03) + 6 + return -min, -max end combat:setCallback(CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues") -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/attack/wrath of nature.lua b/path_8_7/data/spells/scripts/attack/wrath of nature.lua index 6392eac78..4f058ec5e 100644 --- a/path_8_7/data/spells/scripts/attack/wrath of nature.lua +++ b/path_8_7/data/spells/scripts/attack/wrath of nature.lua @@ -11,6 +11,6 @@ end combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/custom/apocalypse.lua b/path_8_7/data/spells/scripts/custom/apocalypse.lua index 8699558f0..70dead24b 100644 --- a/path_8_7/data/spells/scripts/custom/apocalypse.lua +++ b/path_8_7/data/spells/scripts/custom/apocalypse.lua @@ -20,6 +20,6 @@ local combat = Combat() combat:setArea(createCombatArea(AREA_CROSS5X5)) combat:setCallback(CALLBACK_PARAM_TARGETTILE, "onTargetTile") -function onCastSpell(creature, var, isHotkey) - return combat:execute(creature, var) +function onCastSpell(creature, variant, isHotkey) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/custom/combustion.lua b/path_8_7/data/spells/scripts/custom/combustion.lua index cba3efaac..ca9cb5aa7 100644 --- a/path_8_7/data/spells/scripts/custom/combustion.lua +++ b/path_8_7/data/spells/scripts/custom/combustion.lua @@ -10,6 +10,6 @@ combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_FIRE) combat:setFormula(COMBAT_FORMULA_LEVELMAGIC, -1.3, -30, -1.7, 0) combat:setCondition(condition) -function onCastSpell(creature, var, isHotkey) - return combat:execute(creature, var) +function onCastSpell(creature, variant, isHotkey) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/custom/drunk.lua b/path_8_7/data/spells/scripts/custom/drunk.lua index a15293b14..3c19aea0c 100644 --- a/path_8_7/data/spells/scripts/custom/drunk.lua +++ b/path_8_7/data/spells/scripts/custom/drunk.lua @@ -6,6 +6,6 @@ combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_RED) combat:setCondition(condition) combat:setArea(createCombatArea(AREA_SQUARE1X1)) -function onCastSpell(creature, var, isHotkey) - return combat:execute(creature, var) +function onCastSpell(creature, variant, isHotkey) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/custom/magic prison.lua b/path_8_7/data/spells/scripts/custom/magic prison.lua index 28fa8a68e..ee5bfba68 100644 --- a/path_8_7/data/spells/scripts/custom/magic prison.lua +++ b/path_8_7/data/spells/scripts/custom/magic prison.lua @@ -3,6 +3,6 @@ combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGY) combat:setParameter(COMBAT_PARAM_CREATEITEM, ITEM_MAGICWALL) combat:setArea(createCombatArea(AREA_CROSS1X1)) -function onCastSpell(creature, var, isHotkey) - return combat:execute(creature, var) +function onCastSpell(creature, variant, isHotkey) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/custom/polymorph.lua b/path_8_7/data/spells/scripts/custom/polymorph.lua index 8b0d98edc..27efef382 100644 --- a/path_8_7/data/spells/scripts/custom/polymorph.lua +++ b/path_8_7/data/spells/scripts/custom/polymorph.lua @@ -24,6 +24,6 @@ combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN) combat:setArea(createCombatArea(AREA_SQUARE1X1)) combat:setCondition(condition) -function onCastSpell(creature, var, isHotkey) - return combat:execute(creature, var) +function onCastSpell(creature, variant, isHotkey) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/healing/antidote rune.lua b/path_8_7/data/spells/scripts/healing/antidote rune.lua deleted file mode 100644 index 157ba14c6..000000000 --- a/path_8_7/data/spells/scripts/healing/antidote rune.lua +++ /dev/null @@ -1,8 +0,0 @@ -local combat = Combat() -combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE) -combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0) -combat:setParameter(COMBAT_PARAM_DISPEL, CONDITION_POISON) - -function onCastSpell(creature, var, isHotkey) - return combat:execute(creature, var) -end diff --git a/path_8_7/data/spells/scripts/healing/antidote.lua b/path_8_7/data/spells/scripts/healing/antidote.lua deleted file mode 100644 index d7fa024c2..000000000 --- a/path_8_7/data/spells/scripts/healing/antidote.lua +++ /dev/null @@ -1,8 +0,0 @@ -local combat = Combat() -combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE) -combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0) -combat:setParameter(COMBAT_PARAM_DISPEL, CONDITION_POISON) - -function onCastSpell(creature, var) - return combat:execute(creature, var) -end diff --git a/path_8_7/data/spells/scripts/healing/bruise bane.lua b/path_8_7/data/spells/scripts/healing/bruise bane.lua new file mode 100644 index 000000000..7b0c94e30 --- /dev/null +++ b/path_8_7/data/spells/scripts/healing/bruise bane.lua @@ -0,0 +1,19 @@ +local combat = Combat() +combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_HEALING) +combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE) +combat:setParameter(COMBAT_PARAM_DISPEL, CONDITION_PARALYZE) +combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false) + +function onGetFormulaValues(player, level, maglevel) + level = math.min(level, 20) + maglevel = math.min(maglevel, 20) + local min = (level / 5) + (maglevel * 1.4) + 8 + local max = (level / 5) + (maglevel * 1.8) + 11 + return min, max +end + +combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") + +function onCastSpell(creature, variant) + return combat:execute(creature, variant) +end diff --git a/path_8_7/data/spells/scripts/healing/cure bleeding.lua b/path_8_7/data/spells/scripts/healing/cure bleeding.lua index 51425c239..b41638597 100644 --- a/path_8_7/data/spells/scripts/healing/cure bleeding.lua +++ b/path_8_7/data/spells/scripts/healing/cure bleeding.lua @@ -1,8 +1,8 @@ local combat = Combat() combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE) -combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0) combat:setParameter(COMBAT_PARAM_DISPEL, CONDITION_BLEEDING) +combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/healing/cure burning.lua b/path_8_7/data/spells/scripts/healing/cure burning.lua index cef48b89e..7813858fa 100644 --- a/path_8_7/data/spells/scripts/healing/cure burning.lua +++ b/path_8_7/data/spells/scripts/healing/cure burning.lua @@ -1,8 +1,8 @@ local combat = Combat() combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE) -combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0) combat:setParameter(COMBAT_PARAM_DISPEL, CONDITION_FIRE) +combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/healing/cure curse.lua b/path_8_7/data/spells/scripts/healing/cure curse.lua index 53e69c377..1d74c77f1 100644 --- a/path_8_7/data/spells/scripts/healing/cure curse.lua +++ b/path_8_7/data/spells/scripts/healing/cure curse.lua @@ -1,8 +1,8 @@ local combat = Combat() combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE) -combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0) combat:setParameter(COMBAT_PARAM_DISPEL, CONDITION_CURSED) +combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/healing/cure electrification.lua b/path_8_7/data/spells/scripts/healing/cure electrification.lua index 431bc948f..14f88626e 100644 --- a/path_8_7/data/spells/scripts/healing/cure electrification.lua +++ b/path_8_7/data/spells/scripts/healing/cure electrification.lua @@ -1,8 +1,8 @@ local combat = Combat() combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE) -combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0) combat:setParameter(COMBAT_PARAM_DISPEL, CONDITION_ENERGY) +combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/healing/cure poison rune.lua b/path_8_7/data/spells/scripts/healing/cure poison rune.lua index 157ba14c6..f272fb983 100644 --- a/path_8_7/data/spells/scripts/healing/cure poison rune.lua +++ b/path_8_7/data/spells/scripts/healing/cure poison rune.lua @@ -1,8 +1,9 @@ local combat = Combat() combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE) -combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0) combat:setParameter(COMBAT_PARAM_DISPEL, CONDITION_POISON) +combat:setParameter(COMBAT_PARAM_TARGETCASTERORTOPMOST, true) +combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false) -function onCastSpell(creature, var, isHotkey) - return combat:execute(creature, var) +function onCastSpell(creature, variant, isHotkey) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/healing/cure poison.lua b/path_8_7/data/spells/scripts/healing/cure poison.lua index d7fa024c2..b50548e72 100644 --- a/path_8_7/data/spells/scripts/healing/cure poison.lua +++ b/path_8_7/data/spells/scripts/healing/cure poison.lua @@ -1,8 +1,8 @@ local combat = Combat() combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE) -combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0) combat:setParameter(COMBAT_PARAM_DISPEL, CONDITION_POISON) +combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/healing/divine healing.lua b/path_8_7/data/spells/scripts/healing/divine healing.lua index caa852a18..237e7a434 100644 --- a/path_8_7/data/spells/scripts/healing/divine healing.lua +++ b/path_8_7/data/spells/scripts/healing/divine healing.lua @@ -1,8 +1,8 @@ local combat = Combat() combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_HEALING) combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE) -combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0) combat:setParameter(COMBAT_PARAM_DISPEL, CONDITION_PARALYZE) +combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false) function onGetFormulaValues(player, level, maglevel) local min = (level / 5) + (maglevel * 6.9) + 40 @@ -12,6 +12,6 @@ end combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/healing/heal friend.lua b/path_8_7/data/spells/scripts/healing/heal friend.lua index 23eeeab87..621628afc 100644 --- a/path_8_7/data/spells/scripts/healing/heal friend.lua +++ b/path_8_7/data/spells/scripts/healing/heal friend.lua @@ -1,8 +1,8 @@ local combat = Combat() combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_HEALING) -combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE) -combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0) +combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN) combat:setParameter(COMBAT_PARAM_DISPEL, CONDITION_PARALYZE) +combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false) function onGetFormulaValues(player, level, maglevel) local min = (level / 5) + (maglevel * 6.3) + 45 @@ -12,6 +12,7 @@ end combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + creature:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/healing/intense healing rune.lua b/path_8_7/data/spells/scripts/healing/intense healing rune.lua index 08cb9087e..53fa135aa 100644 --- a/path_8_7/data/spells/scripts/healing/intense healing rune.lua +++ b/path_8_7/data/spells/scripts/healing/intense healing rune.lua @@ -1,9 +1,9 @@ local combat = Combat() combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_HEALING) combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE) -combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0) -combat:setParameter(COMBAT_PARAM_TARGETCASTERORTOPMOST, 1) combat:setParameter(COMBAT_PARAM_DISPEL, CONDITION_PARALYZE) +combat:setParameter(COMBAT_PARAM_TARGETCASTERORTOPMOST, true) +combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false) function onGetFormulaValues(player, level, maglevel) local min = (level / 5) + (maglevel * 3.2) + 20 @@ -13,6 +13,6 @@ end combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") -function onCastSpell(creature, var, isHotkey) - return combat:execute(creature, var) +function onCastSpell(creature, variant, isHotkey) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/healing/intense healing.lua b/path_8_7/data/spells/scripts/healing/intense healing.lua index 6f0c22c73..2a61b871c 100644 --- a/path_8_7/data/spells/scripts/healing/intense healing.lua +++ b/path_8_7/data/spells/scripts/healing/intense healing.lua @@ -1,8 +1,8 @@ local combat = Combat() combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_HEALING) combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE) -combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0) combat:setParameter(COMBAT_PARAM_DISPEL, CONDITION_PARALYZE) +combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false) function onGetFormulaValues(player, level, maglevel) local min = (level / 5) + (maglevel * 3.2) + 20 @@ -12,6 +12,6 @@ end combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/healing/intense recovery.lua b/path_8_7/data/spells/scripts/healing/intense recovery.lua index c67592ece..bb13cce46 100644 --- a/path_8_7/data/spells/scripts/healing/intense recovery.lua +++ b/path_8_7/data/spells/scripts/healing/intense recovery.lua @@ -1,15 +1,15 @@ local combat = Combat() combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN) -combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0) +combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false) local condition = Condition(CONDITION_REGENERATION) condition:setParameter(CONDITION_PARAM_SUBID, 1) -condition:setParameter(CONDITION_PARAM_BUFF_SPELL, 1) condition:setParameter(CONDITION_PARAM_TICKS, 1 * 60 * 1000) condition:setParameter(CONDITION_PARAM_HEALTHGAIN, 40) condition:setParameter(CONDITION_PARAM_HEALTHTICKS, 3000) +condition:setParameter(CONDITION_PARAM_BUFF_SPELL, true) combat:setCondition(condition) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/healing/intense wound cleansing.lua b/path_8_7/data/spells/scripts/healing/intense wound cleansing.lua index 392740be4..e64028348 100644 --- a/path_8_7/data/spells/scripts/healing/intense wound cleansing.lua +++ b/path_8_7/data/spells/scripts/healing/intense wound cleansing.lua @@ -1,8 +1,8 @@ local combat = Combat() combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_HEALING) combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE) -combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0) combat:setParameter(COMBAT_PARAM_DISPEL, CONDITION_PARALYZE) +combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false) function onGetFormulaValues(player, level, maglevel) local min = (level / 5) + (maglevel * 70) + 438 @@ -12,6 +12,6 @@ end combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/healing/light healing.lua b/path_8_7/data/spells/scripts/healing/light healing.lua index 2e562a03b..bd3a0908d 100644 --- a/path_8_7/data/spells/scripts/healing/light healing.lua +++ b/path_8_7/data/spells/scripts/healing/light healing.lua @@ -1,8 +1,8 @@ local combat = Combat() combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_HEALING) combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE) -combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0) combat:setParameter(COMBAT_PARAM_DISPEL, CONDITION_PARALYZE) +combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false) function onGetFormulaValues(player, level, maglevel) local min = (level / 5) + (maglevel * 1.4) + 8 @@ -12,6 +12,6 @@ end combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/healing/magic patch.lua b/path_8_7/data/spells/scripts/healing/magic patch.lua new file mode 100644 index 000000000..36347b377 --- /dev/null +++ b/path_8_7/data/spells/scripts/healing/magic patch.lua @@ -0,0 +1,19 @@ +local combat = Combat() +combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_HEALING) +combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE) +combat:setParameter(COMBAT_PARAM_DISPEL, CONDITION_PARALYZE) +combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false) + +function onGetFormulaValues(player, level, maglevel) + level = math.min(level, 20) + maglevel = math.min(maglevel, 20) + local min = (level / 5) + (maglevel * 0.6) + 3 + local max = (level / 5) + maglevel + 6 + return min, max +end + +combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") + +function onCastSpell(creature, variant) + return combat:execute(creature, variant) +end diff --git a/path_8_7/data/spells/scripts/healing/mass healing.lua b/path_8_7/data/spells/scripts/healing/mass healing.lua index 9817c144e..0b984503e 100644 --- a/path_8_7/data/spells/scripts/healing/mass healing.lua +++ b/path_8_7/data/spells/scripts/healing/mass healing.lua @@ -1,24 +1,29 @@ +local combat = Combat() +combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE) +combat:setParameter(COMBAT_PARAM_DISPEL, CONDITION_PARALYZE) +combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false) +combat:setArea(createCombatArea(AREA_CIRCLE3X3)) + +local healMonsters = false + function onTargetCreature(creature, target) local player = creature:getPlayer() - local min = ((player:getLevel() / 5) + (player:getMagicLevel() * 4.6) + 100) - local max = ((player:getLevel() / 5) + (player:getMagicLevel() * 9.6) + 125) + local min = (player:getLevel() / 5) + (player:getMagicLevel() * 4.6) + 100 + local max = (player:getLevel() / 5) + (player:getMagicLevel() * 9.6) + 125 - local master = target:getMaster() - if target:isMonster() and not master or master and master:isMonster() then - return true + if not healMonsters then + local master = target:getMaster() + if target:isMonster() and not master or master and master:isMonster() then + return true + end end doTargetCombatHealth(0, target, COMBAT_HEALING, min, max, CONST_ME_NONE) return true end -local combat = Combat() -combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE) -combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0) -combat:setParameter(COMBAT_PARAM_DISPEL, CONDITION_PARALYZE) -combat:setArea(createCombatArea(AREA_CIRCLE3X3)) combat:setCallback(CALLBACK_PARAM_TARGETCREATURE, "onTargetCreature") -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/healing/practise healing.lua b/path_8_7/data/spells/scripts/healing/practise healing.lua index f5f99ae1a..c336213b2 100644 --- a/path_8_7/data/spells/scripts/healing/practise healing.lua +++ b/path_8_7/data/spells/scripts/healing/practise healing.lua @@ -1,8 +1,8 @@ local combat = Combat() combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_HEALING) combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE) -combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0) combat:setParameter(COMBAT_PARAM_DISPEL, CONDITION_PARALYZE) +combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false) function onGetFormulaValues(player, level, maglevel) return 4, 7 @@ -10,6 +10,6 @@ end combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/healing/recovery.lua b/path_8_7/data/spells/scripts/healing/recovery.lua index c046cee0e..de878399a 100644 --- a/path_8_7/data/spells/scripts/healing/recovery.lua +++ b/path_8_7/data/spells/scripts/healing/recovery.lua @@ -1,15 +1,15 @@ local combat = Combat() combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN) -combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0) +combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false) local condition = Condition(CONDITION_REGENERATION) condition:setParameter(CONDITION_PARAM_SUBID, 1) -condition:setParameter(CONDITION_PARAM_BUFF_SPELL, 1) condition:setParameter(CONDITION_PARAM_TICKS, 1 * 60 * 1000) condition:setParameter(CONDITION_PARAM_HEALTHGAIN, 20) condition:setParameter(CONDITION_PARAM_HEALTHTICKS, 3000) +condition:setParameter(CONDITION_PARAM_BUFF_SPELL, true) combat:setCondition(condition) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/healing/salvation.lua b/path_8_7/data/spells/scripts/healing/salvation.lua index 6bbd53545..fe047c8e5 100644 --- a/path_8_7/data/spells/scripts/healing/salvation.lua +++ b/path_8_7/data/spells/scripts/healing/salvation.lua @@ -1,8 +1,8 @@ local combat = Combat() combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_HEALING) combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE) -combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0) combat:setParameter(COMBAT_PARAM_DISPEL, CONDITION_PARALYZE) +combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false) function onGetFormulaValues(player, level, maglevel) local min = (level / 5) + (maglevel * 12) + 75 @@ -12,6 +12,6 @@ end combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/healing/ultimate healing rune.lua b/path_8_7/data/spells/scripts/healing/ultimate healing rune.lua index 82c4d115b..5aac4c00f 100644 --- a/path_8_7/data/spells/scripts/healing/ultimate healing rune.lua +++ b/path_8_7/data/spells/scripts/healing/ultimate healing rune.lua @@ -1,9 +1,9 @@ local combat = Combat() combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_HEALING) combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE) -combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0) -combat:setParameter(COMBAT_PARAM_TARGETCASTERORTOPMOST, 1) combat:setParameter(COMBAT_PARAM_DISPEL, CONDITION_PARALYZE) +combat:setParameter(COMBAT_PARAM_TARGETCASTERORTOPMOST, true) +combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false) function onGetFormulaValues(player, level, maglevel) local min = (level / 5) + (maglevel * 7.3) + 42 @@ -13,6 +13,6 @@ end combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") -function onCastSpell(creature, var, isHotkey) - return combat:execute(creature, var) +function onCastSpell(creature, variant, isHotkey) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/healing/ultimate healing.lua b/path_8_7/data/spells/scripts/healing/ultimate healing.lua index 1a317a25d..ec18d9ed9 100644 --- a/path_8_7/data/spells/scripts/healing/ultimate healing.lua +++ b/path_8_7/data/spells/scripts/healing/ultimate healing.lua @@ -1,8 +1,8 @@ local combat = Combat() combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_HEALING) combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE) -combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0) combat:setParameter(COMBAT_PARAM_DISPEL, CONDITION_PARALYZE) +combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false) function onGetFormulaValues(player, level, maglevel) local min = (level / 5) + (maglevel * 6.8) + 42 @@ -12,6 +12,6 @@ end combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/healing/wound cleansing.lua b/path_8_7/data/spells/scripts/healing/wound cleansing.lua index 51a451310..61c050d01 100644 --- a/path_8_7/data/spells/scripts/healing/wound cleansing.lua +++ b/path_8_7/data/spells/scripts/healing/wound cleansing.lua @@ -1,8 +1,8 @@ local combat = Combat() combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_HEALING) combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE) -combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0) combat:setParameter(COMBAT_PARAM_DISPEL, CONDITION_PARALYZE) +combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false) function onGetFormulaValues(player, level, maglevel) local min = (level / 5) + (maglevel * 4) + 25 @@ -12,6 +12,6 @@ end combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/monster/barbarian brutetamer skill reducer.lua b/path_8_7/data/spells/scripts/monster/barbarian brutetamer skill reducer.lua index 90e587fe1..8d7ff3758 100644 --- a/path_8_7/data/spells/scripts/monster/barbarian brutetamer skill reducer.lua +++ b/path_8_7/data/spells/scripts/monster/barbarian brutetamer skill reducer.lua @@ -14,6 +14,6 @@ for i = CONDITION_PARAM_SKILL_FIST, CONDITION_PARAM_SKILL_SHIELD do end end -function onCastSpell(creature, var) - return combat[math.random(#combat)]:execute(creature, var) +function onCastSpell(creature, variant) + return combat[math.random(#combat)]:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/monster/betrayed wraith skill reducer.lua b/path_8_7/data/spells/scripts/monster/betrayed wraith skill reducer.lua index b03197937..a6d972a52 100644 --- a/path_8_7/data/spells/scripts/monster/betrayed wraith skill reducer.lua +++ b/path_8_7/data/spells/scripts/monster/betrayed wraith skill reducer.lua @@ -7,6 +7,6 @@ combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_YELLOW_RINGS) combat:setArea(createCombatArea(AREA_SQUAREWAVE5)) combat:setCondition(condition) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/monster/blightwalker curse.lua b/path_8_7/data/spells/scripts/monster/blightwalker curse.lua index fe4a33748..d025f07c7 100644 --- a/path_8_7/data/spells/scripts/monster/blightwalker curse.lua +++ b/path_8_7/data/spells/scripts/monster/blightwalker curse.lua @@ -6,7 +6,7 @@ for i = 10, 30 do combat[i]:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_SMALLCLOUDS) local condition = Condition(CONDITION_CURSED) - condition:setParameter(CONDITION_PARAM_DELAYED, 1) + condition:setParameter(CONDITION_PARAM_DELAYED, true) local damage = i condition:addDamage(1, 4000, -damage) @@ -19,6 +19,6 @@ for i = 10, 30 do combat[i]:setCondition(condition) end -function onCastSpell(creature, var) - return combat[math.random(10, 30)]:execute(creature, var) +function onCastSpell(creature, variant) + return combat[math.random(10, 30)]:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/monster/choking fear drown.lua b/path_8_7/data/spells/scripts/monster/choking fear drown.lua index 746b685a0..42b7ad8eb 100644 --- a/path_8_7/data/spells/scripts/monster/choking fear drown.lua +++ b/path_8_7/data/spells/scripts/monster/choking fear drown.lua @@ -1,5 +1,5 @@ local condition = Condition(CONDITION_DROWN) -condition:setParameter(CONDITION_PARAM_DELAYED, 1) +condition:setParameter(CONDITION_PARAM_DELAYED, true) condition:addDamage(50, 5000, -20) local combat = Combat() @@ -8,6 +8,6 @@ combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_BUBBLES) combat:setArea(createCombatArea(AREA_CROSS6X6)) combat:setCondition(condition) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/monster/cliff strider electrify.lua b/path_8_7/data/spells/scripts/monster/cliff strider electrify.lua index 0653cb2ce..7231acef3 100644 --- a/path_8_7/data/spells/scripts/monster/cliff strider electrify.lua +++ b/path_8_7/data/spells/scripts/monster/cliff strider electrify.lua @@ -3,10 +3,10 @@ combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_ENERGYDAMAGE) combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_ENERGYHIT) local condition = Condition(CONDITION_ENERGY) -condition:setParameter(CONDITION_PARAM_DELAYED, 1) +condition:setParameter(CONDITION_PARAM_DELAYED, true) condition:addDamage(20, 10000, -25) combat:setCondition(condition) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/monster/cliff strider skill reducer.lua b/path_8_7/data/spells/scripts/monster/cliff strider skill reducer.lua index 188f6bf20..e60f3b996 100644 --- a/path_8_7/data/spells/scripts/monster/cliff strider skill reducer.lua +++ b/path_8_7/data/spells/scripts/monster/cliff strider skill reducer.lua @@ -7,6 +7,6 @@ combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_RED) combat:setArea(createCombatArea(AREA_CIRCLE2X2)) combat:setCondition(condition) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/monster/dark torturer skill reducer.lua b/path_8_7/data/spells/scripts/monster/dark torturer skill reducer.lua index f93306915..559cec088 100644 --- a/path_8_7/data/spells/scripts/monster/dark torturer skill reducer.lua +++ b/path_8_7/data/spells/scripts/monster/dark torturer skill reducer.lua @@ -7,6 +7,6 @@ combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_SOUND_PURPLE) combat:setArea(createCombatArea(AREA_SQUAREWAVE6)) combat:setCondition(condition) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/monster/death blob curse.lua b/path_8_7/data/spells/scripts/monster/death blob curse.lua index 4a8304657..915f9adb1 100644 --- a/path_8_7/data/spells/scripts/monster/death blob curse.lua +++ b/path_8_7/data/spells/scripts/monster/death blob curse.lua @@ -7,7 +7,7 @@ for i = 5, 10 do combat[i]:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_DEATH) local condition = Condition(CONDITION_CURSED) - condition:setParameter(CONDITION_PARAM_DELAYED, 1) + condition:setParameter(CONDITION_PARAM_DELAYED, true) local damage = i condition:addDamage(1, 4000, -damage) @@ -19,6 +19,6 @@ for i = 5, 10 do combat[i]:setCondition(condition) end -function onCastSpell(creature, var) - return combat[math.random(5, 10)]:execute(creature, var) +function onCastSpell(creature, variant) + return combat[math.random(5, 10)]:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/monster/deepling spellsinger skill reducer.lua b/path_8_7/data/spells/scripts/monster/deepling spellsinger skill reducer.lua index 05cb2761c..cb0d443d2 100644 --- a/path_8_7/data/spells/scripts/monster/deepling spellsinger skill reducer.lua +++ b/path_8_7/data/spells/scripts/monster/deepling spellsinger skill reducer.lua @@ -13,6 +13,6 @@ for i = 45, 65 do combat[i]:setCondition(condition) end -function onCastSpell(creature, var) - return combat[math.random(45, 65)]:execute(creature, var) +function onCastSpell(creature, variant) + return combat[math.random(45, 65)]:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/monster/demon outcast skill reducer.lua b/path_8_7/data/spells/scripts/monster/demon outcast skill reducer.lua index 29988a59b..e36bbc78a 100644 --- a/path_8_7/data/spells/scripts/monster/demon outcast skill reducer.lua +++ b/path_8_7/data/spells/scripts/monster/demon outcast skill reducer.lua @@ -7,6 +7,6 @@ combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_FLASHARROW) combat:setArea(createCombatArea(AREA_BEAM1)) combat:setCondition(condition) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/monster/devourer paralyze.lua b/path_8_7/data/spells/scripts/monster/devourer paralyze.lua new file mode 100644 index 000000000..4af621800 --- /dev/null +++ b/path_8_7/data/spells/scripts/monster/devourer paralyze.lua @@ -0,0 +1,17 @@ +local combat = Combat() +combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_POISONAREA) + +local condition = Condition(CONDITION_PARALYZE) +condition:setParameter(CONDITION_PARAM_TICKS, 20000) +condition:setFormula(-0.55, 0, -0.75, 0) +combat:setCondition(condition) + + +local area = createCombatArea(AREA_SQUARE1X1) + combat:setArea(area) + combat:setCondition(condition) + + +function onCastSpell(creature, variant) + return combat:execute(creature, variant) +end diff --git a/path_8_7/data/spells/scripts/monster/devourer wave.lua b/path_8_7/data/spells/scripts/monster/devourer wave.lua new file mode 100644 index 000000000..54f6809e9 --- /dev/null +++ b/path_8_7/data/spells/scripts/monster/devourer wave.lua @@ -0,0 +1,19 @@ +local combat = Combat() +combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_POISONDAMAGE) +combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_SMALLPLANTS) + + arr = { + {0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0}, + {0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0}, + {0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0}, + {0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0} + } + +local area = createCombatArea(arr) +combat:setArea(area) + +function onCastSpell(creature, variant) + return combat:execute(creature, variant) +end diff --git a/path_8_7/data/spells/scripts/monster/diabolic imp skill reducer.lua b/path_8_7/data/spells/scripts/monster/diabolic imp skill reducer.lua index a4522153a..00b3193c4 100644 --- a/path_8_7/data/spells/scripts/monster/diabolic imp skill reducer.lua +++ b/path_8_7/data/spells/scripts/monster/diabolic imp skill reducer.lua @@ -11,6 +11,6 @@ for i = 70, 80 do combat[i]:setCondition(condition) end -function onCastSpell(creature, var) - return combat[math.random(70, 80)]:execute(creature, var) +function onCastSpell(creature, variant) + return combat[math.random(70, 80)]:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/monster/dipthrah skill reducer.lua b/path_8_7/data/spells/scripts/monster/dipthrah skill reducer.lua new file mode 100644 index 000000000..558a02843 --- /dev/null +++ b/path_8_7/data/spells/scripts/monster/dipthrah skill reducer.lua @@ -0,0 +1,16 @@ +local combat = Combat() +combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_HOLYAREA) + +local area = createCombatArea(AREA_CIRCLE3X3) +combat:setArea(area) + +local condition = Condition(CONDITION_ATTRIBUTES) +condition:setParameter(CONDITION_PARAM_TICKS, 6000) +condition:setParameter(CONDITION_PARAM_SKILL_MELEEPERCENT, 50) +condition:setParameter(CONDITION_PARAM_SKILL_DISTANCEPERCENT, 50) +condition:setParameter(CONDITION_PARAM_SKILL_SHIELDPERCENT, 50) +combat:setCondition(condition) + +function onCastSpell(creature, variant) + return combat:execute(creature, variant) +end diff --git a/path_8_7/data/spells/scripts/monster/djinn cancel invisibility.lua b/path_8_7/data/spells/scripts/monster/djinn cancel invisibility.lua index c72a83acd..61128bc97 100644 --- a/path_8_7/data/spells/scripts/monster/djinn cancel invisibility.lua +++ b/path_8_7/data/spells/scripts/monster/djinn cancel invisibility.lua @@ -2,6 +2,6 @@ local combat = Combat() combat:setParameter(COMBAT_PARAM_DISPEL, CONDITION_INVISIBLE) combat:setArea(createCombatArea(AREA_CIRCLE3X3)) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/monster/djinn electrify.lua b/path_8_7/data/spells/scripts/monster/djinn electrify.lua index 65e7cd7f5..83eb0c4eb 100644 --- a/path_8_7/data/spells/scripts/monster/djinn electrify.lua +++ b/path_8_7/data/spells/scripts/monster/djinn electrify.lua @@ -4,10 +4,10 @@ combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_ENERGYHIT) combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGY) local condition = Condition(CONDITION_ENERGY) -condition:setParameter(CONDITION_PARAM_DELAYED, 1) +condition:setParameter(CONDITION_PARAM_DELAYED, true) condition:addDamage(3, 10000, -25) combat:setCondition(condition) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/monster/draken abomination curse.lua b/path_8_7/data/spells/scripts/monster/draken abomination curse.lua index 39e544053..9304f0412 100644 --- a/path_8_7/data/spells/scripts/monster/draken abomination curse.lua +++ b/path_8_7/data/spells/scripts/monster/draken abomination curse.lua @@ -7,7 +7,7 @@ for i = 15, 30 do combat[i]:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_DEATH) local condition = Condition(CONDITION_CURSED) - condition:setParameter(CONDITION_PARAM_DELAYED, 1) + condition:setParameter(CONDITION_PARAM_DELAYED, true) local damage = i condition:addDamage(1, 4000, -damage) @@ -19,6 +19,6 @@ for i = 15, 30 do combat[i]:setCondition(condition) end -function onCastSpell(creature, var) - return combat[math.random(15, 30)]:execute(creature, var) +function onCastSpell(creature, variant) + return combat[math.random(15, 30)]:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/monster/dreadbeast skill increaser.lua b/path_8_7/data/spells/scripts/monster/dreadbeast skill increaser.lua new file mode 100644 index 000000000..e526e53e0 --- /dev/null +++ b/path_8_7/data/spells/scripts/monster/dreadbeast skill increaser.lua @@ -0,0 +1,11 @@ +local combat = Combat() +combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_YELLOWENERGY) + +local condition = Condition(CONDITION_ATTRIBUTES) +condition:setParameter(CONDITION_PARAM_TICKS, 6000) +condition:setParameter(CONDITION_PARAM_SKILL_MELEEPERCENT, 130) +combat:setCondition(condition) + +function onCastSpell(creature, variant) + return combat:execute(creature, variant) +end diff --git a/path_8_7/data/spells/scripts/monster/dreadbeast skill reducer.lua b/path_8_7/data/spells/scripts/monster/dreadbeast skill reducer.lua new file mode 100644 index 000000000..02a67c438 --- /dev/null +++ b/path_8_7/data/spells/scripts/monster/dreadbeast skill reducer.lua @@ -0,0 +1,17 @@ +local combat = {} + +for i = 70, 80 do + combat[i] = Combat() + combat[i]:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_YELLOWENERGY) + combat[i]:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGY) + + local condition = Condition(CONDITION_ATTRIBUTES) + condition:setParameter(CONDITION_PARAM_TICKS, 20000) + condition:setParameter(CONDITION_PARAM_SKILL_MELEEPERCENT, i) + condition:setParameter(CONDITION_PARAM_SKILL_FISTPERCENT, i) + combat[i]:setCondition(condition) +end + +function onCastSpell(creature, variant) + return combat[math.random(70, 80)]:execute(creature, variant) +end diff --git a/path_8_7/data/spells/scripts/monster/energized raging mage skill reducer.lua b/path_8_7/data/spells/scripts/monster/energized raging mage skill reducer.lua new file mode 100644 index 000000000..6c4ff36ea --- /dev/null +++ b/path_8_7/data/spells/scripts/monster/energized raging mage skill reducer.lua @@ -0,0 +1,14 @@ +local combat = Combat() +combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_ENERGYHIT) + +local area = createCombatArea(AREA_CROSS6X6) +combat:setArea(area) + +local condition = Condition(CONDITION_ATTRIBUTES) +condition:setParameter(CONDITION_PARAM_TICKS, 6000) +condition:setParameter(CONDITION_PARAM_SKILL_DISTANCEPERCENT, 50) +combat:setCondition(condition) + +function onCastSpell(creature, variant) + return combat:execute(creature, variant) +end diff --git a/path_8_7/data/spells/scripts/monster/energy elemental electrify.lua b/path_8_7/data/spells/scripts/monster/energy elemental electrify.lua index 7787a9ad0..0d479c47a 100644 --- a/path_8_7/data/spells/scripts/monster/energy elemental electrify.lua +++ b/path_8_7/data/spells/scripts/monster/energy elemental electrify.lua @@ -1,5 +1,5 @@ local condition = Condition(CONDITION_ENERGY) -condition:setParameter(CONDITION_PARAM_DELAYED, 1) +condition:setParameter(CONDITION_PARAM_DELAYED, true) condition:addDamage(7, 10000, -25) local combat = Combat() @@ -8,6 +8,6 @@ combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_BLOCKHIT) combat:setArea(createCombatArea(AREA_CIRCLE3X3)) combat:setCondition(condition) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/monster/enslaved dwarf skill reducer 1.lua b/path_8_7/data/spells/scripts/monster/enslaved dwarf skill reducer 1.lua index b7a6d4ea4..3790028db 100644 --- a/path_8_7/data/spells/scripts/monster/enslaved dwarf skill reducer 1.lua +++ b/path_8_7/data/spells/scripts/monster/enslaved dwarf skill reducer 1.lua @@ -11,6 +11,6 @@ for i = 13, 50 do combat[i]:setCondition(condition) end -function onCastSpell(creature, var) - return combat[math.random(13, 50)]:execute(creature, var) +function onCastSpell(creature, variant) + return combat[math.random(13, 50)]:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/monster/enslaved dwarf skill reducer 2.lua b/path_8_7/data/spells/scripts/monster/enslaved dwarf skill reducer 2.lua index 4db95ae36..e8e2b0be8 100644 --- a/path_8_7/data/spells/scripts/monster/enslaved dwarf skill reducer 2.lua +++ b/path_8_7/data/spells/scripts/monster/enslaved dwarf skill reducer 2.lua @@ -7,6 +7,6 @@ combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_HITAREA) combat:setArea(createCombatArea(AREA_CROSS1X1)) combat:setCondition(condition) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/monster/feversleep skill reducer.lua b/path_8_7/data/spells/scripts/monster/feversleep skill reducer.lua index 3e004dca9..f4b62f910 100644 --- a/path_8_7/data/spells/scripts/monster/feversleep skill reducer.lua +++ b/path_8_7/data/spells/scripts/monster/feversleep skill reducer.lua @@ -7,6 +7,6 @@ combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_STUN) combat:setArea(createCombatArea(AREA_CROSS6X6)) combat:setCondition(condition) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/monster/forest fury skill reducer.lua b/path_8_7/data/spells/scripts/monster/forest fury skill reducer.lua index c8e2154af..422fde6a9 100644 --- a/path_8_7/data/spells/scripts/monster/forest fury skill reducer.lua +++ b/path_8_7/data/spells/scripts/monster/forest fury skill reducer.lua @@ -9,6 +9,6 @@ combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_LARGEROCK) combat:setArea(createCombatArea(AREA_CIRCLE2X2)) combat:setCondition(condition) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/monster/frazzlemaw paralyze.lua b/path_8_7/data/spells/scripts/monster/frazzlemaw paralyze.lua new file mode 100644 index 000000000..3106180e7 --- /dev/null +++ b/path_8_7/data/spells/scripts/monster/frazzlemaw paralyze.lua @@ -0,0 +1,30 @@ + local combat = Combat() + combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_RED) + + local condition = Condition(CONDITION_PARALYZE) + condition:setParameter(CONDITION_PARAM_TICKS, 20000) + condition:setFormula(-0.6, 0, -0.8, 0) + combat:setCondition(condition) + + arr = { + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0}, + {0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0}, + {0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0}, + {0, 0, 1, 1, 1, 1, 3, 1, 1, 1, 1, 0, 0}, + {0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0}, + {0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0}, + {0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} + } + + local area = createCombatArea(arr) + combat:setArea(area) + +function onCastSpell(creature, variant) + return combat:execute(creature, variant) +end diff --git a/path_8_7/data/spells/scripts/monster/fury skill reducer.lua b/path_8_7/data/spells/scripts/monster/fury skill reducer.lua index d4501e822..2f0534660 100644 --- a/path_8_7/data/spells/scripts/monster/fury skill reducer.lua +++ b/path_8_7/data/spells/scripts/monster/fury skill reducer.lua @@ -8,6 +8,6 @@ combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_SOUND_YELLOW) combat:setArea(createCombatArea(AREA_CIRCLE3X3)) combat:setCondition(condition) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/monster/ghastly dragon curse.lua b/path_8_7/data/spells/scripts/monster/ghastly dragon curse.lua index ec926cd82..c12c9fcdc 100644 --- a/path_8_7/data/spells/scripts/monster/ghastly dragon curse.lua +++ b/path_8_7/data/spells/scripts/monster/ghastly dragon curse.lua @@ -9,7 +9,7 @@ for i = 40, 170 do combat[index]:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_DEATH) local condition = Condition(CONDITION_CURSED) - condition:setParameter(CONDITION_PARAM_DELAYED, 1) + condition:setParameter(CONDITION_PARAM_DELAYED, true) local damage = i condition:addDamage(1, 4000, -damage) @@ -28,6 +28,6 @@ for i = 40, 170 do end end -function onCastSpell(creature, var) - return combat[math.random(#combat)]:execute(creature, var) +function onCastSpell(creature, variant) + return combat[math.random(#combat)]:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/monster/glooth anemone summon.lua b/path_8_7/data/spells/scripts/monster/glooth anemone summon.lua new file mode 100644 index 000000000..43e8d773b --- /dev/null +++ b/path_8_7/data/spells/scripts/monster/glooth anemone summon.lua @@ -0,0 +1,22 @@ +local combat = Combat() +combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_NONE) +combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN) + +local area = createCombatArea(AREA_SQUARE1X1) +combat:setArea(area) + +local maxsummons = 1 + +function onCastSpell(creature, variant) + local summoncount = creature:getSummons() + if #summoncount < 1 then + for i = 1, maxsummons - #summoncount do + local mid = Game.createMonster("Glooth Blob", creature:getPosition()) + if not mid then + return + end + mid:setMaster(creature) + end + end + return combat:execute(creature, variant) +end diff --git a/path_8_7/data/spells/scripts/monster/hellfire fighter soulfire.lua b/path_8_7/data/spells/scripts/monster/hellfire fighter soulfire.lua index 27e97561c..8ae590fdd 100644 --- a/path_8_7/data/spells/scripts/monster/hellfire fighter soulfire.lua +++ b/path_8_7/data/spells/scripts/monster/hellfire fighter soulfire.lua @@ -1,5 +1,5 @@ local condition = Condition(CONDITION_FIRE) -condition:setParameter(CONDITION_PARAM_DELAYED, 1) +condition:setParameter(CONDITION_PARAM_DELAYED, true) condition:addDamage(20, 9000, -10) local combat = Combat() @@ -8,6 +8,6 @@ combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_FIREATTACK) combat:setArea(createCombatArea(AREA_CROSS6X6)) combat:setCondition(condition) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/monster/hellgorak skill reducer.lua b/path_8_7/data/spells/scripts/monster/hellgorak skill reducer.lua new file mode 100644 index 000000000..0c4238394 --- /dev/null +++ b/path_8_7/data/spells/scripts/monster/hellgorak skill reducer.lua @@ -0,0 +1,34 @@ +local combat = {} + +for i = 20, 40 do + combat[i] = Combat() + combat[i]:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_POFF) + + local condition = Condition(CONDITION_ATTRIBUTES) + condition:setParameter(CONDITION_PARAM_TICKS, 20000) + condition:setParameter(CONDITION_PARAM_SKILL_DISTANCEPERCENT, i) + + arr = { + {0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0}, + {0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0}, + {0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0}, + {0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0}, + {0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0}, + {1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1}, + {0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0}, + {0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0}, + {0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0}, + {0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0}, + {0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0} + } + + local area = createCombatArea(arr) + combat[i]:setArea(area) + combat[i]:setCondition(condition) +end + +function onCastSpell(creature, variant) + return combat[math.random(20, 40)]:execute(creature, variant) +end diff --git a/path_8_7/data/spells/scripts/monster/hellspawn soulfire.lua b/path_8_7/data/spells/scripts/monster/hellspawn soulfire.lua index 91af85644..1c7f144e2 100644 --- a/path_8_7/data/spells/scripts/monster/hellspawn soulfire.lua +++ b/path_8_7/data/spells/scripts/monster/hellspawn soulfire.lua @@ -4,10 +4,10 @@ combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_HITBYFIRE) combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_FIRE) local condition = Condition(CONDITION_FIRE) -condition:setParameter(CONDITION_PARAM_DELAYED, 1) +condition:setParameter(CONDITION_PARAM_DELAYED, true) condition:addDamage(26, 9000, -10) combat:setCondition(condition) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/monster/ice golem skill reducer.lua b/path_8_7/data/spells/scripts/monster/ice golem skill reducer.lua index ca7c631f8..d7bc670f0 100644 --- a/path_8_7/data/spells/scripts/monster/ice golem skill reducer.lua +++ b/path_8_7/data/spells/scripts/monster/ice golem skill reducer.lua @@ -8,6 +8,6 @@ combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_HITAREA) combat:setArea(createCombatArea(AREA_SQUARE1X1)) combat:setCondition(condition) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/monster/infernalist skill reducer.lua b/path_8_7/data/spells/scripts/monster/infernalist skill reducer.lua new file mode 100644 index 000000000..27208c4c9 --- /dev/null +++ b/path_8_7/data/spells/scripts/monster/infernalist skill reducer.lua @@ -0,0 +1,13 @@ +local combat = Combat() +combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MORTAREA) +combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SUDDENDEATH) + +local condition = Condition(CONDITION_ATTRIBUTES) +condition:setParameter(CONDITION_PARAM_TICKS, 6000) +condition:setParameter(CONDITION_PARAM_SKILL_MELEEPERCENT, 50) +condition:setParameter(CONDITION_PARAM_SKILL_SHIELDPERCENT, 50) +combat:setCondition(condition) + +function onCastSpell(creature, variant) + return combat:execute(creature, variant) +end diff --git a/path_8_7/data/spells/scripts/monster/lancer beetle curse.lua b/path_8_7/data/spells/scripts/monster/lancer beetle curse.lua index acfc56cf2..abffaacaa 100644 --- a/path_8_7/data/spells/scripts/monster/lancer beetle curse.lua +++ b/path_8_7/data/spells/scripts/monster/lancer beetle curse.lua @@ -7,7 +7,7 @@ for i = 5, 11 do combat[i]:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_DEATH) local condition = Condition(CONDITION_CURSED) - condition:setParameter(CONDITION_PARAM_DELAYED, 1) + condition:setParameter(CONDITION_PARAM_DELAYED, true) local damage = i condition:addDamage(1, 4000, -damage) @@ -19,6 +19,6 @@ for i = 5, 11 do combat[i]:setCondition(condition) end -function onCastSpell(creature, var) - return combat[math.random(5, 11)]:execute(creature, var) +function onCastSpell(creature, variant) + return combat[math.random(5, 11)]:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/monster/lava golem soulfire.lua b/path_8_7/data/spells/scripts/monster/lava golem soulfire.lua index 720e19e33..69aacb1e3 100644 --- a/path_8_7/data/spells/scripts/monster/lava golem soulfire.lua +++ b/path_8_7/data/spells/scripts/monster/lava golem soulfire.lua @@ -1,5 +1,5 @@ local condition = Condition(CONDITION_FIRE) -condition:setParameter(CONDITION_PARAM_DELAYED, 1) +condition:setParameter(CONDITION_PARAM_DELAYED, true) condition:addDamage(40, 9000, -10) local combat = Combat() @@ -8,6 +8,6 @@ combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_EXPLOSIONHIT) combat:setArea(createCombatArea(AREA_CIRCLE2X2)) combat:setCondition(condition) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/monster/lizard magistratus curse.lua b/path_8_7/data/spells/scripts/monster/lizard magistratus curse.lua index af0782168..b5b3276b5 100644 --- a/path_8_7/data/spells/scripts/monster/lizard magistratus curse.lua +++ b/path_8_7/data/spells/scripts/monster/lizard magistratus curse.lua @@ -7,7 +7,7 @@ for i = 2, 3 do combat[i]:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_DEATH) local condition = Condition(CONDITION_CURSED) - condition:setParameter(CONDITION_PARAM_DELAYED, 1) + condition:setParameter(CONDITION_PARAM_DELAYED, true) local damage = i condition:addDamage(1, 4000, -damage) @@ -19,6 +19,6 @@ for i = 2, 3 do combat[i]:setCondition(condition) end -function onCastSpell(creature, var) - return combat[math.random(2, 3)]:execute(creature, var) +function onCastSpell(creature, variant) + return combat[math.random(2, 3)]:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/monster/magma crawler soulfire.lua b/path_8_7/data/spells/scripts/monster/magma crawler soulfire.lua index 8da432be9..68135f908 100644 --- a/path_8_7/data/spells/scripts/monster/magma crawler soulfire.lua +++ b/path_8_7/data/spells/scripts/monster/magma crawler soulfire.lua @@ -1,5 +1,5 @@ local condition = Condition(CONDITION_FIRE) -condition:setParameter(CONDITION_PARAM_DELAYED, 1) +condition:setParameter(CONDITION_PARAM_DELAYED, true) condition:addDamage(20, 9000, -10) local combat = Combat() @@ -8,6 +8,6 @@ combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_EXPLOSIONHIT) combat:setArea(createCombatArea(AREA_CIRCLE2X2)) combat:setCondition(condition) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/monster/massive energy elemental electrify.lua b/path_8_7/data/spells/scripts/monster/massive energy elemental electrify.lua index 0228d6c60..1bbd62614 100644 --- a/path_8_7/data/spells/scripts/monster/massive energy elemental electrify.lua +++ b/path_8_7/data/spells/scripts/monster/massive energy elemental electrify.lua @@ -1,5 +1,5 @@ local condition = Condition(CONDITION_ENERGY) -condition:setParameter(CONDITION_PARAM_DELAYED, 1) +condition:setParameter(CONDITION_PARAM_DELAYED, true) condition:addDamage(10, 10000, -25) local combat = Combat() @@ -8,6 +8,6 @@ combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_BLOCKHIT) combat:setArea(createCombatArea(AREA_CIRCLE3X3)) combat:setCondition(condition) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/monster/massive fire elemental soulfire.lua b/path_8_7/data/spells/scripts/monster/massive fire elemental soulfire.lua index 165d1328d..1c759518a 100644 --- a/path_8_7/data/spells/scripts/monster/massive fire elemental soulfire.lua +++ b/path_8_7/data/spells/scripts/monster/massive fire elemental soulfire.lua @@ -1,5 +1,5 @@ local condition = Condition(CONDITION_FIRE) -condition:setParameter(CONDITION_PARAM_DELAYED, 1) +condition:setParameter(CONDITION_PARAM_DELAYED, true) condition:addDamage(20, 9000, -10) local combat = Combat() @@ -8,6 +8,6 @@ combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_RED) combat:setArea(createCombatArea(AREA_CROSS6X6)) combat:setCondition(condition) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/monster/medusa paralyze.lua b/path_8_7/data/spells/scripts/monster/medusa paralyze.lua new file mode 100644 index 000000000..5a08677ca --- /dev/null +++ b/path_8_7/data/spells/scripts/monster/medusa paralyze.lua @@ -0,0 +1,32 @@ +local combat = Combat() +combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_POFF) +combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_EARTH) + +local condition = Condition(CONDITION_PARALYZE) +condition:setParameter(CONDITION_PARAM_TICKS, 20000) +condition:setFormula(-0.45, 0, -0.5, 0) +combat:setCondition(condition) + +arr = { + {0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0}, + {0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0}, + {0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0}, + {0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0}, + {0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0}, + {1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1}, + {0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0}, + {0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0}, + {0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0}, + {0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0}, + {0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0} +} + +local area = createCombatArea(arr) +combat:setArea(area) +combat:setCondition(condition) + +function onCastSpell(creature, variant) + return combat:execute(creature, variant) +end diff --git a/path_8_7/data/spells/scripts/monster/metal gargoyle curse.lua b/path_8_7/data/spells/scripts/monster/metal gargoyle curse.lua new file mode 100644 index 000000000..eebd81402 --- /dev/null +++ b/path_8_7/data/spells/scripts/monster/metal gargoyle curse.lua @@ -0,0 +1,23 @@ +local combat = {} + +for i = 2, 2 do + combat[i] = Combat() + combat[i]:setParameter(COMBAT_PARAM_TYPE, COMBAT_DEATHDAMAGE) + combat[i]:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SUDDENDEATH) + + local condition = Condition(CONDITION_CURSED) + condition:setParameter(CONDITION_PARAM_DELAYED, true) + + local damage = i + condition:addDamage(1, 4000, -damage) + for j = 1, 20 do + damage = damage * 1.2 + condition:addDamage(1, 4000, -damage) + end + + combat[i]:setCondition(condition) +end + +function onCastSpell(creature, variant) + return combat[math.random(2, 2)]:execute(creature, variant) +end diff --git a/path_8_7/data/spells/scripts/monster/minotaur amazon paralyze.lua b/path_8_7/data/spells/scripts/monster/minotaur amazon paralyze.lua new file mode 100644 index 000000000..130fd1811 --- /dev/null +++ b/path_8_7/data/spells/scripts/monster/minotaur amazon paralyze.lua @@ -0,0 +1,23 @@ +local combat = Combat() +combat:setParameter(COMBAT_PARAM_EFFECT, 3) + +local condition = Condition(CONDITION_PARALYZE) +condition:setParameter(CONDITION_PARAM_TICKS, 10000) +condition:setFormula(-0.4, 0, -0.7, 0) +combat:setCondition(condition) + + arr = { + {0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0}, + {0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0}, + {0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0} + } + +local area = createCombatArea(arr) + combat:setArea(area) + combat:setCondition(condition) + + +function onCastSpell(creature, variant) + return combat:execute(creature, variant) +end diff --git a/path_8_7/data/spells/scripts/monster/mooh'tah master skill reducer.lua b/path_8_7/data/spells/scripts/monster/mooh'tah master skill reducer.lua new file mode 100644 index 000000000..049fe8599 --- /dev/null +++ b/path_8_7/data/spells/scripts/monster/mooh'tah master skill reducer.lua @@ -0,0 +1,12 @@ + local combat = Combat() + combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_STUN) + combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SUDDENDEATH) + + local condition = Condition(CONDITION_ATTRIBUTES) + condition:setParameter(CONDITION_PARAM_TICKS, 3000) + condition:setParameter(CONDITION_PARAM_SKILL_SHIELDPERCENT, -100) + combat:setCondition(condition) + +function onCastSpell(creature, variant) + return combat:execute(creature, variant) +end diff --git a/path_8_7/data/spells/scripts/monster/mutated bat curse.lua b/path_8_7/data/spells/scripts/monster/mutated bat curse.lua index c51839fd2..a724e6cfc 100644 --- a/path_8_7/data/spells/scripts/monster/mutated bat curse.lua +++ b/path_8_7/data/spells/scripts/monster/mutated bat curse.lua @@ -2,7 +2,7 @@ local combat = {} for i = 2, 4 do local condition = Condition(CONDITION_CURSED) - condition:setParameter(CONDITION_PARAM_DELAYED, 1) + condition:setParameter(CONDITION_PARAM_DELAYED, true) local damage = i condition:addDamage(1, 4000, -damage) @@ -19,6 +19,6 @@ for i = 2, 4 do combat[i]:setCondition(condition) end -function onCastSpell(creature, var) - return combat[math.random(2, 4)]:execute(creature, var) +function onCastSpell(creature, variant) + return combat[math.random(2, 4)]:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/monster/phantasm drown.lua b/path_8_7/data/spells/scripts/monster/phantasm drown.lua index 5136a8ac6..bc13da129 100644 --- a/path_8_7/data/spells/scripts/monster/phantasm drown.lua +++ b/path_8_7/data/spells/scripts/monster/phantasm drown.lua @@ -1,5 +1,5 @@ local condition = Condition(CONDITION_DROWN) -condition:setParameter(CONDITION_PARAM_DELAYED, 1) +condition:setParameter(CONDITION_PARAM_DELAYED, true) condition:addDamage(20, 5000, -20) local combat = Combat() @@ -8,6 +8,6 @@ combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE) combat:setArea(createCombatArea(AREA_SQUAREWAVE7)) combat:setCondition(condition) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/monster/pirate corsair skill reducer.lua b/path_8_7/data/spells/scripts/monster/pirate corsair skill reducer.lua index a53d18263..7435ff606 100644 --- a/path_8_7/data/spells/scripts/monster/pirate corsair skill reducer.lua +++ b/path_8_7/data/spells/scripts/monster/pirate corsair skill reducer.lua @@ -7,6 +7,6 @@ combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_SOUND_PURPLE) combat:setArea(createCombatArea(AREA_BEAM1)) combat:setCondition(condition) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/monster/quara constrictor electrify.lua b/path_8_7/data/spells/scripts/monster/quara constrictor electrify.lua index 65e7cd7f5..83eb0c4eb 100644 --- a/path_8_7/data/spells/scripts/monster/quara constrictor electrify.lua +++ b/path_8_7/data/spells/scripts/monster/quara constrictor electrify.lua @@ -4,10 +4,10 @@ combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_ENERGYHIT) combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGY) local condition = Condition(CONDITION_ENERGY) -condition:setParameter(CONDITION_PARAM_DELAYED, 1) +condition:setParameter(CONDITION_PARAM_DELAYED, true) condition:addDamage(3, 10000, -25) combat:setCondition(condition) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/monster/quara constrictor freeze.lua b/path_8_7/data/spells/scripts/monster/quara constrictor freeze.lua index 5e4af842f..96e483d7c 100644 --- a/path_8_7/data/spells/scripts/monster/quara constrictor freeze.lua +++ b/path_8_7/data/spells/scripts/monster/quara constrictor freeze.lua @@ -1,5 +1,5 @@ local condition = Condition(CONDITION_FREEZING) -condition:setParameter(CONDITION_PARAM_DELAYED, 1) +condition:setParameter(CONDITION_PARAM_DELAYED, true) condition:addDamage(10, 8000, -8) local combat = Combat() @@ -8,6 +8,6 @@ combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_GREEN_RINGS) combat:setArea(createCombatArea(AREA_SQUARE1X1)) combat:setCondition(condition) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/monster/rot elemental paralyze.lua b/path_8_7/data/spells/scripts/monster/rot elemental paralyze.lua new file mode 100644 index 000000000..2450159e4 --- /dev/null +++ b/path_8_7/data/spells/scripts/monster/rot elemental paralyze.lua @@ -0,0 +1,17 @@ +local combat = Combat() +combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_SOUND_GREEN) + +local condition = Condition(CONDITION_PARALYZE) +condition:setParameter(CONDITION_PARAM_TICKS, 20000) +condition:setFormula(-0.45, 0, -0.65, 0) +combat:setCondition(condition) + + +local area = createCombatArea(AREA_CIRCLE2X2) + combat:setArea(area) + combat:setCondition(condition) + + +function onCastSpell(creature, variant) + return combat:execute(creature, variant) +end diff --git a/path_8_7/data/spells/scripts/monster/rustheap golem electrify.lua b/path_8_7/data/spells/scripts/monster/rustheap golem electrify.lua new file mode 100644 index 000000000..1cedb5de8 --- /dev/null +++ b/path_8_7/data/spells/scripts/monster/rustheap golem electrify.lua @@ -0,0 +1,16 @@ +local combat = Combat() +combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_ENERGYDAMAGE) +combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_HITAREA) +combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGY) + +local condition = Condition(CONDITION_ENERGY) +condition:setParameter(CONDITION_PARAM_DELAYED, true) +condition:addDamage(17, 10000, -25) +combat:setCondition(condition) + +local area = createCombatArea(AREA_SQUARE1X1) +combat:setArea(area) + +function onCastSpell(creature, variant) + return combat:execute(creature, variant) +end diff --git a/path_8_7/data/spells/scripts/monster/rustheap golem wave.lua b/path_8_7/data/spells/scripts/monster/rustheap golem wave.lua new file mode 100644 index 000000000..12c0b1ebc --- /dev/null +++ b/path_8_7/data/spells/scripts/monster/rustheap golem wave.lua @@ -0,0 +1,18 @@ +local combat = Combat() +combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_LIFEDRAIN) +combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_BLACKSMOKE) + + arr = { + {0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0}, + {0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0}, + {0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0} + } + +local area = createCombatArea(arr) + combat:setArea(area) + + +function onCastSpell(creature, variant) + return combat:execute(creature, variant) +end diff --git a/path_8_7/data/spells/scripts/monster/sea serpent drown.lua b/path_8_7/data/spells/scripts/monster/sea serpent drown.lua index e5bcc6c32..c0af07d2a 100644 --- a/path_8_7/data/spells/scripts/monster/sea serpent drown.lua +++ b/path_8_7/data/spells/scripts/monster/sea serpent drown.lua @@ -1,5 +1,5 @@ local condition = Condition(CONDITION_DROWN) -condition:setParameter(CONDITION_PARAM_DELAYED, 1) +condition:setParameter(CONDITION_PARAM_DELAYED, true) condition:addDamage(12, 5000, -20) local combat = Combat() @@ -8,6 +8,6 @@ combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_WATERSPLASH) combat:setArea(createCombatArea(AREA_SQUARE1X1)) combat:setCondition(condition) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/monster/seacrest serpent wave.lua b/path_8_7/data/spells/scripts/monster/seacrest serpent wave.lua new file mode 100644 index 000000000..3c21e65b8 --- /dev/null +++ b/path_8_7/data/spells/scripts/monster/seacrest serpent wave.lua @@ -0,0 +1,19 @@ +local combat = Combat() +combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_DEATHDAMAGE) +combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_WATERSPLASH) + + arr = { + {0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0}, + {0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0}, + {0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0}, + {0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0} + } + +local area = createCombatArea(arr) +combat:setArea(area) + +function onCastSpell(creature, variant) + return combat:execute(creature, variant) +end diff --git a/path_8_7/data/spells/scripts/monster/shock head skill reducer 1.lua b/path_8_7/data/spells/scripts/monster/shock head skill reducer 1.lua index e820b56e3..a7733c502 100644 --- a/path_8_7/data/spells/scripts/monster/shock head skill reducer 1.lua +++ b/path_8_7/data/spells/scripts/monster/shock head skill reducer 1.lua @@ -8,6 +8,6 @@ combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_EXPLOSION) combat:setArea(createCombatArea(AREA_CIRCLE2X2)) combat:setCondition(condition) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/monster/shock head skill reducer 2.lua b/path_8_7/data/spells/scripts/monster/shock head skill reducer 2.lua index 6632e662c..f70279d7f 100644 --- a/path_8_7/data/spells/scripts/monster/shock head skill reducer 2.lua +++ b/path_8_7/data/spells/scripts/monster/shock head skill reducer 2.lua @@ -7,6 +7,6 @@ combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_STUN) combat:setArea(createCombatArea(AREA_CROSS6X6)) combat:setCondition(condition) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/monster/silencer skill reducer.lua b/path_8_7/data/spells/scripts/monster/silencer skill reducer.lua index 9a4aa106d..5e2cc3d9d 100644 --- a/path_8_7/data/spells/scripts/monster/silencer skill reducer.lua +++ b/path_8_7/data/spells/scripts/monster/silencer skill reducer.lua @@ -12,6 +12,6 @@ for i = 20, 70 do combat[i]:setCondition(condition) end -function onCastSpell(creature, var) - return combat[math.random(20, 70)]:execute(creature, var) +function onCastSpell(creature, variant) + return combat[math.random(20, 70)]:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/monster/smokeue.lua b/path_8_7/data/spells/scripts/monster/smokeue.lua new file mode 100644 index 000000000..7128d6a20 --- /dev/null +++ b/path_8_7/data/spells/scripts/monster/smokeue.lua @@ -0,0 +1,15 @@ +local combat = Combat() +combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_GROUNDSHAKER) + +local area = createCombatArea(AREA_CROSS5X5) +combat:setArea(area) + +local condition = Condition(CONDITION_ATTRIBUTES) +condition:setParameter(CONDITION_PARAM_BUFF_SPELL, true) +condition:setParameter(CONDITION_PARAM_TICKS, 10000) +condition:setParameter(CONDITION_PARAM_SKILL_DISTANCEPERCENT, 40) +combat:setCondition(condition) + +function onCastSpell(creature, variant) + return combat:execute(creature, variant) +end diff --git a/path_8_7/data/spells/scripts/monster/souleater drown.lua b/path_8_7/data/spells/scripts/monster/souleater drown.lua index 86e518da8..aa1c8c820 100644 --- a/path_8_7/data/spells/scripts/monster/souleater drown.lua +++ b/path_8_7/data/spells/scripts/monster/souleater drown.lua @@ -1,5 +1,5 @@ local condition = Condition(CONDITION_DROWN) -condition:setParameter(CONDITION_PARAM_DELAYED, 1) +condition:setParameter(CONDITION_PARAM_DELAYED, true) condition:addDamage(10, 5000, -20) local combat = Combat() @@ -8,6 +8,6 @@ combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MORTAREA) combat:setArea(createCombatArea(AREA_CIRCLE2X2)) combat:setCondition(condition) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/monster/spectre drown.lua b/path_8_7/data/spells/scripts/monster/spectre drown.lua index ddbe0a817..d1eda5fa3 100644 --- a/path_8_7/data/spells/scripts/monster/spectre drown.lua +++ b/path_8_7/data/spells/scripts/monster/spectre drown.lua @@ -1,5 +1,5 @@ local condition = Condition(CONDITION_DROWN) -condition:setParameter(CONDITION_PARAM_DELAYED, 1) +condition:setParameter(CONDITION_PARAM_DELAYED, true) condition:addDamage(20, 5000, -20) local combat = Combat() @@ -8,6 +8,6 @@ combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN) combat:setArea(createCombatArea(AREA_CIRCLE3X3)) combat:setCondition(condition) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/monster/stampor skill reducer.lua b/path_8_7/data/spells/scripts/monster/stampor skill reducer.lua index 74710222c..5e2594633 100644 --- a/path_8_7/data/spells/scripts/monster/stampor skill reducer.lua +++ b/path_8_7/data/spells/scripts/monster/stampor skill reducer.lua @@ -13,6 +13,6 @@ for i = 60, 85 do combat[i]:setCondition(condition) end -function onCastSpell(creature, var) - return combat[math.random(60,85)]:execute(creature, var) +function onCastSpell(creature, variant) + return combat[math.random(60, 85)]:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/monster/undead dragon curse.lua b/path_8_7/data/spells/scripts/monster/undead dragon curse.lua index 6f10e9f22..20e848a5d 100644 --- a/path_8_7/data/spells/scripts/monster/undead dragon curse.lua +++ b/path_8_7/data/spells/scripts/monster/undead dragon curse.lua @@ -2,7 +2,7 @@ local combat = {} for i = 30, 50 do local condition = Condition(CONDITION_CURSED) - condition:setParameter(CONDITION_PARAM_DELAYED, 1) + condition:setParameter(CONDITION_PARAM_DELAYED, true) local damage = i condition:addDamage(1, 4000, -damage) @@ -19,6 +19,6 @@ for i = 30, 50 do combat[i]:setCondition(condition) end -function onCastSpell(creature, var) - return combat[math.random(30, 50)]:execute(creature, var) +function onCastSpell(creature, variant) + return combat[math.random(30, 50)]:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/monster/vulcongra soulfire.lua b/path_8_7/data/spells/scripts/monster/vulcongra soulfire.lua index 21a59ee7e..d56c65ec5 100644 --- a/path_8_7/data/spells/scripts/monster/vulcongra soulfire.lua +++ b/path_8_7/data/spells/scripts/monster/vulcongra soulfire.lua @@ -1,5 +1,5 @@ local condition = Condition(CONDITION_FIRE) -condition:setParameter(CONDITION_PARAM_DELAYED, 1) +condition:setParameter(CONDITION_PARAM_DELAYED, true) condition:addDamage(20, 9000, -10) local combat = Combat() @@ -8,6 +8,6 @@ combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_HITBYFIRE) combat:setArea(createCombatArea(AREA_SQUARE1X1)) combat:setCondition(condition) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/monster/walker skill reducer.lua b/path_8_7/data/spells/scripts/monster/walker skill reducer.lua new file mode 100644 index 000000000..73553dde4 --- /dev/null +++ b/path_8_7/data/spells/scripts/monster/walker skill reducer.lua @@ -0,0 +1,71 @@ +local mage = {1, 2, 5, 6} +local paladin = {3, 7} +local knight = {4, 8} + +local combat = {} + +for i = 45, 60 do + combat[i] = Combat() + + local condition1 = Condition(CONDITION_ATTRIBUTES) + condition1:setParameter(CONDITION_PARAM_TICKS, 7000) + condition1:setParameter(CONDITION_PARAM_SKILL_MELEEPERCENT, i) + condition1:setParameter(CONDITION_PARAM_SKILL_FISTPERCENT, i) + condition1:setParameter(CONDITION_PARAM_SKILL_SHIELDPERCENT, i) + + local condition2 = Condition(CONDITION_ATTRIBUTES) + condition2:setParameter(CONDITION_PARAM_TICKS, 7000) + condition2:setParameter(CONDITION_PARAM_STAT_MAGICPOINTSPERCENT, i) + + local condition3 = Condition(CONDITION_ATTRIBUTES) + condition3:setParameter(CONDITION_PARAM_TICKS, 7000) + condition3:setParameter(CONDITION_PARAM_SKILL_DISTANCEPERCENT, i) + condition3:setParameter(CONDITION_PARAM_SKILL_SHIELDPERCENT, i) + + local area = createCombatArea(AREA_CIRCLE3X3) + combat[i]:setArea(area) + + +function onTargetTile(creature, pos) + local creatureTable = {} + local n, i = Tile({x=pos.x, y=pos.y, z=pos.z}).creatures, 1 + if n ~= 0 then + local v = getThingfromPos({x=pos.x, y=pos.y, z=pos.z, stackpos=i}).uid + while v ~= 0 do + if isCreature(v) == true then + table.insert(creatureTable, v) + if n == #creatureTable then + break + end + end + i = i + 1 + v = getThingfromPos({x=pos.x, y=pos.y, z=pos.z, stackpos=i}).uid + end + end + if #creatureTable ~= nil and #creatureTable > 0 then + for r = 1, #creatureTable do + if creatureTable[r] ~= creature then + local player = Player(creatureTable[r]) + + if isPlayer(creatureTable[r]) == true and isInArray(mage, player:getVocation():getId()) then + player:addCondition(condition2) + elseif isPlayer(creatureTable[r]) == true and isInArray(paladin, player:getVocation():getId()) then + player:addCondition(condition3) + elseif isPlayer(creatureTable[r]) == true and isInArray(knight, player:getVocation():getId()) then + player:addCondition(condition1) + elseif isMonster(creatureTable[r]) == true then + end + end + end + end + pos:sendMagicEffect(CONST_ME_MAGIC_RED) + return true +end + +combat[i]:setCallback(CALLBACK_PARAM_TARGETTILE, "onTargetTile") + +end + +function onCastSpell(creature, variant) + return combat[math.random(45, 60)]:execute(creature, variant) +end diff --git a/path_8_7/data/spells/scripts/monster/war golem electrify.lua b/path_8_7/data/spells/scripts/monster/war golem electrify.lua index efb7eb0df..630922952 100644 --- a/path_8_7/data/spells/scripts/monster/war golem electrify.lua +++ b/path_8_7/data/spells/scripts/monster/war golem electrify.lua @@ -3,10 +3,10 @@ combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_ENERGYDAMAGE) combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_ENERGYHIT) local condition = Condition(CONDITION_ENERGY) -condition:setParameter(CONDITION_PARAM_DELAYED, 1) +condition:setParameter(CONDITION_PARAM_DELAYED, true) condition:addDamage(8, 10000, -25) combat:setCondition(condition) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/monster/war golem skill reducer.lua b/path_8_7/data/spells/scripts/monster/war golem skill reducer.lua index 38aa4985a..af28828b6 100644 --- a/path_8_7/data/spells/scripts/monster/war golem skill reducer.lua +++ b/path_8_7/data/spells/scripts/monster/war golem skill reducer.lua @@ -7,6 +7,6 @@ combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_STUN) combat:setArea(createCombatArea(AREA_BEAM8)) combat:setCondition(condition) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/monster/warlock skill reducer.lua b/path_8_7/data/spells/scripts/monster/warlock skill reducer.lua index 7170a0c29..49dbbad2c 100644 --- a/path_8_7/data/spells/scripts/monster/warlock skill reducer.lua +++ b/path_8_7/data/spells/scripts/monster/warlock skill reducer.lua @@ -9,6 +9,6 @@ combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ICE) combat:setArea(createCombatArea(AREA_BEAM1)) combat:setCondition(condition) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/monster/werewolf skill reducer.lua b/path_8_7/data/spells/scripts/monster/werewolf skill reducer.lua index 15ff967c4..ceaa58e67 100644 --- a/path_8_7/data/spells/scripts/monster/werewolf skill reducer.lua +++ b/path_8_7/data/spells/scripts/monster/werewolf skill reducer.lua @@ -8,6 +8,6 @@ combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_DRAWBLOOD) combat:setArea(createCombatArea(AREA_BEAM1)) combat:setCondition(condition) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/monster/worm priestess paralyze.lua b/path_8_7/data/spells/scripts/monster/worm priestess paralyze.lua new file mode 100644 index 000000000..d7efefcc3 --- /dev/null +++ b/path_8_7/data/spells/scripts/monster/worm priestess paralyze.lua @@ -0,0 +1,22 @@ +local combat = Combat() +combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_HITAREA) + +local condition = Condition(CONDITION_PARALYZE) +condition:setParameter(CONDITION_PARAM_TICKS, 10000) +condition:setFormula(-0.4, 0, -0.7, 0) +combat:setCondition(condition) + + arr = { + {0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0}, + {0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0} + } + +local area = createCombatArea(arr) + combat:setArea(area) + combat:setCondition(condition) + + +function onCastSpell(creature, variant) + return combat:execute(creature, variant) +end diff --git a/path_8_7/data/spells/scripts/monster/young sea serpent drown.lua b/path_8_7/data/spells/scripts/monster/young sea serpent drown.lua index 9d45cd91e..93d9fb5b5 100644 --- a/path_8_7/data/spells/scripts/monster/young sea serpent drown.lua +++ b/path_8_7/data/spells/scripts/monster/young sea serpent drown.lua @@ -1,5 +1,5 @@ local condition = Condition(CONDITION_DROWN) -condition:setParameter(CONDITION_PARAM_DELAYED, 1) +condition:setParameter(CONDITION_PARAM_DELAYED, true) condition:addDamage(6, 5000, -20) local combat = Combat() @@ -8,6 +8,6 @@ combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_WATERSPLASH) combat:setArea(createCombatArea(AREA_SQUARE1X1)) combat:setCondition(condition) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/party/enchant.lua b/path_8_7/data/spells/scripts/party/enchant.lua index 1b2104dbf..b58e636cf 100644 --- a/path_8_7/data/spells/scripts/party/enchant.lua +++ b/path_8_7/data/spells/scripts/party/enchant.lua @@ -1,16 +1,16 @@ local combat = Combat() -combat:setArea(createCombatArea(AREA_CROSS5X5)) combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE) -combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0) +combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false) +combat:setArea(createCombatArea(AREA_CROSS5X5)) local condition = Condition(CONDITION_ATTRIBUTES) condition:setParameter(CONDITION_PARAM_SUBID, 3) -condition:setParameter(CONDITION_PARAM_BUFF_SPELL, 1) condition:setParameter(CONDITION_PARAM_TICKS, 2 * 60 * 1000) condition:setParameter(CONDITION_PARAM_STAT_MAGICPOINTS, 1) +condition:setParameter(CONDITION_PARAM_BUFF_SPELL, true) local baseMana = 120 -function onCastSpell(creature, var, isHotkey) +function onCastSpell(creature, variant, isHotkey) local position = creature:getPosition() local party = creature:getParty() @@ -49,7 +49,7 @@ function onCastSpell(creature, var, isHotkey) return false end - if not combat:execute(creature, var) then + if not combat:execute(creature, variant) then creature:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE) position:sendMagicEffect(CONST_ME_POFF) return false diff --git a/path_8_7/data/spells/scripts/party/heal.lua b/path_8_7/data/spells/scripts/party/heal.lua index 2efc87cdd..16a7d97b2 100644 --- a/path_8_7/data/spells/scripts/party/heal.lua +++ b/path_8_7/data/spells/scripts/party/heal.lua @@ -1,17 +1,17 @@ local combat = Combat() -combat:setParameter(createCombatArea(AREA_CROSS5X5)) combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE) -combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0) +combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false) +combat:setArea(createCombatArea(AREA_CROSS5X5)) local condition = Condition(CONDITION_REGENERATION) condition:setParameter(CONDITION_PARAM_SUBID, 1) -condition:setParameter(CONDITION_PARAM_BUFF_SPELL, 1) condition:setParameter(CONDITION_PARAM_TICKS, 2 * 60 * 1000) condition:setParameter(CONDITION_PARAM_HEALTHGAIN, 20) condition:setParameter(CONDITION_PARAM_HEALTHTICKS, 2000) +condition:setParameter(CONDITION_PARAM_BUFF_SPELL, true) local baseMana = 120 -function onCastSpell(creature, var, isHotkey) +function onCastSpell(creature, variant, isHotkey) local position = creature:getPosition() local party = creature:getParty() @@ -50,7 +50,7 @@ function onCastSpell(creature, var, isHotkey) return false end - if not combat:execute(creature, var) then + if not combat:execute(creature, variant) then creature:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE) position:sendMagicEffect(CONST_ME_POFF) return false diff --git a/path_8_7/data/spells/scripts/party/protect.lua b/path_8_7/data/spells/scripts/party/protect.lua index c6569903d..5943fe0af 100644 --- a/path_8_7/data/spells/scripts/party/protect.lua +++ b/path_8_7/data/spells/scripts/party/protect.lua @@ -1,16 +1,16 @@ local combat = Combat() -combat:setArea(createCombatArea(AREA_CROSS5X5)) combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE) -combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0) +combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false) +combat:setArea(createCombatArea(AREA_CROSS5X5)) local condition = Condition(CONDITION_ATTRIBUTES) condition:setParameter(CONDITION_PARAM_SUBID, 2) -condition:setParameter(CONDITION_PARAM_BUFF_SPELL, 1) condition:setParameter(CONDITION_PARAM_TICKS, 2 * 60 * 1000) condition:setParameter(CONDITION_PARAM_SKILL_SHIELD, 2) +condition:setParameter(CONDITION_PARAM_BUFF_SPELL, true) local baseMana = 90 -function onCastSpell(creature, var, isHotkey) +function onCastSpell(creature, variant, isHotkey) local position = creature:getPosition() local party = creature:getParty() @@ -49,7 +49,7 @@ function onCastSpell(creature, var, isHotkey) return false end - if not combat:execute(creature, var) then + if not combat:execute(creature, variant) then creature:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE) position:sendMagicEffect(CONST_ME_POFF) return false diff --git a/path_8_7/data/spells/scripts/party/train.lua b/path_8_7/data/spells/scripts/party/train.lua index 7f24424db..836ca2449 100644 --- a/path_8_7/data/spells/scripts/party/train.lua +++ b/path_8_7/data/spells/scripts/party/train.lua @@ -1,17 +1,17 @@ local combat = Combat() -combat:setArea(createCombatArea(AREA_CROSS5X5)) combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE) -combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0) +combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false) +combat:setArea(createCombatArea(AREA_CROSS5X5)) local condition = Condition(CONDITION_ATTRIBUTES) condition:setParameter(CONDITION_PARAM_SUBID, 1) -condition:setParameter(CONDITION_PARAM_BUFF_SPELL, 1) condition:setParameter(CONDITION_PARAM_TICKS, 2 * 60 * 1000) condition:setParameter(CONDITION_PARAM_SKILL_MELEE, 3) condition:setParameter(CONDITION_PARAM_SKILL_DISTANCE, 3) +condition:setParameter(CONDITION_PARAM_BUFF_SPELL, true) local baseMana = 60 -function onCastSpell(creature, var, isHotkey) +function onCastSpell(creature, variant, isHotkey) local position = creature:getPosition() local party = creature:getParty() @@ -50,7 +50,7 @@ function onCastSpell(creature, var, isHotkey) return false end - if not combat:execute(creature, var) then + if not combat:execute(creature, variant) then creature:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE) position:sendMagicEffect(CONST_ME_POFF) return false diff --git a/path_8_7/data/spells/scripts/support/animate dead rune.lua b/path_8_7/data/spells/scripts/support/animate dead rune.lua index 792897ea8..daa1dca62 100644 --- a/path_8_7/data/spells/scripts/support/animate dead rune.lua +++ b/path_8_7/data/spells/scripts/support/animate dead rune.lua @@ -1,8 +1,4 @@ function onCastSpell(creature, variant, isHotkey) - if not creature:isPlayer() then - return false - end - local position = Variant.getPosition(variant) local tile = Tile(position) if tile and creature:getSkull() ~= SKULL_BLACK then diff --git a/path_8_7/data/spells/scripts/support/blood rage.lua b/path_8_7/data/spells/scripts/support/blood rage.lua index c51444c30..3daa31f24 100644 --- a/path_8_7/data/spells/scripts/support/blood rage.lua +++ b/path_8_7/data/spells/scripts/support/blood rage.lua @@ -1,14 +1,14 @@ +local combat = Combat() +combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN) +combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false) + local condition = Condition(CONDITION_ATTRIBUTES) condition:setParameter(CONDITION_PARAM_TICKS, 10000) condition:setParameter(CONDITION_PARAM_SKILL_MELEEPERCENT, 135) -condition:setParameter(CONDITION_PARAM_SKILL_SHIELDPERCENT, 0) +condition:setParameter(CONDITION_PARAM_SKILL_SHIELDPERCENT, -100) condition:setParameter(CONDITION_PARAM_BUFF_SPELL, true) - -local combat = Combat() -combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN) -combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0) combat:setCondition(condition) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/support/cancel invisibility.lua b/path_8_7/data/spells/scripts/support/cancel invisibility.lua index c99719465..1137dce45 100644 --- a/path_8_7/data/spells/scripts/support/cancel invisibility.lua +++ b/path_8_7/data/spells/scripts/support/cancel invisibility.lua @@ -3,6 +3,6 @@ combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE) combat:setParameter(COMBAT_PARAM_DISPEL, CONDITION_INVISIBLE) combat:setArea(createCombatArea(AREA_CIRCLE3X3)) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/support/challenge.lua b/path_8_7/data/spells/scripts/support/challenge.lua index 6e87f0989..348a3a7ad 100644 --- a/path_8_7/data/spells/scripts/support/challenge.lua +++ b/path_8_7/data/spells/scripts/support/challenge.lua @@ -1,12 +1,13 @@ +local combat = Combat() +combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE) +combat:setArea(createCombatArea(AREA_SQUARE1X1)) + function onTargetCreature(creature, target) return doChallengeCreature(creature, target) end -local combat = Combat() -combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE) -combat:setArea(createCombatArea(AREA_SQUARE1X1)) combat:setCallback(CALLBACK_PARAM_TARGETCREATURE, "onTargetCreature") -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/support/charge.lua b/path_8_7/data/spells/scripts/support/charge.lua index b73e9f9a2..63a183ee5 100644 --- a/path_8_7/data/spells/scripts/support/charge.lua +++ b/path_8_7/data/spells/scripts/support/charge.lua @@ -1,12 +1,12 @@ local combat = Combat() combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN) -combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0) +combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false) local condition = Condition(CONDITION_HASTE) condition:setParameter(CONDITION_PARAM_TICKS, 5000) -condition:setFormula(0.9, 0, 0.9, 0) +condition:setFormula(0.9, -72, 0.9, -72) combat:setCondition(condition) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/support/desintegrate rune.lua b/path_8_7/data/spells/scripts/support/desintegrate rune.lua index 0be9e2de2..21d538b25 100644 --- a/path_8_7/data/spells/scripts/support/desintegrate rune.lua +++ b/path_8_7/data/spells/scripts/support/desintegrate rune.lua @@ -1,6 +1,4 @@ -local dead_human = { - 3058, 3059, 3060, 3061, 3064, 3065, 3066 -} +local dead_human = {3058, 3059, 3060, 3061, 3064, 3065, 3066} function onCastSpell(creature, variant, isHotkey) local position = Variant.getPosition(variant) diff --git a/path_8_7/data/spells/scripts/support/destroy field rune.lua b/path_8_7/data/spells/scripts/support/destroy field rune.lua index c251ca919..d6ccc1162 100644 --- a/path_8_7/data/spells/scripts/support/destroy field rune.lua +++ b/path_8_7/data/spells/scripts/support/destroy field rune.lua @@ -2,6 +2,7 @@ function onCastSpell(creature, variant, isHotkey) local position = Variant.getPosition(variant) local tile = Tile(position) local field = tile and tile:getItemByType(ITEM_TYPE_MAGICFIELD) + if field and isInArray(FIELDS, field:getId()) then field:remove() position:sendMagicEffect(CONST_ME_POFF) diff --git a/path_8_7/data/spells/scripts/support/food.lua b/path_8_7/data/spells/scripts/support/food.lua index e2cfb9ad5..4b7a37081 100644 --- a/path_8_7/data/spells/scripts/support/food.lua +++ b/path_8_7/data/spells/scripts/support/food.lua @@ -8,12 +8,12 @@ local food = { 2696 -- cheese } -function onCastSpell(creature, var) - if not creature:isPlayer() then - return false +function onCastSpell(creature, variant) + creature:addItem(food[math.random(#food)]) + if math.random(1, 100) > 50 then + creature:addItem(food[math.random(#food)]) end - creature:addItem(food[math.random(#food)]) creature:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN) return true end diff --git a/path_8_7/data/spells/scripts/support/great light.lua b/path_8_7/data/spells/scripts/support/great light.lua index f056a76dc..8eea28af1 100644 --- a/path_8_7/data/spells/scripts/support/great light.lua +++ b/path_8_7/data/spells/scripts/support/great light.lua @@ -1,6 +1,6 @@ local combat = Combat() combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE) -combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0) +combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false) local condition = Condition(CONDITION_LIGHT) condition:setParameter(CONDITION_PARAM_LIGHT_LEVEL, 8) @@ -8,6 +8,6 @@ condition:setParameter(CONDITION_PARAM_LIGHT_COLOR, 215) condition:setParameter(CONDITION_PARAM_TICKS, (11 * 60 + 35) * 1000) combat:setCondition(condition) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/support/haste.lua b/path_8_7/data/spells/scripts/support/haste.lua index 3b97e03ff..51aca5baa 100644 --- a/path_8_7/data/spells/scripts/support/haste.lua +++ b/path_8_7/data/spells/scripts/support/haste.lua @@ -1,12 +1,12 @@ local combat = Combat() combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN) -combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0) +combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false) local condition = Condition(CONDITION_HASTE) condition:setParameter(CONDITION_PARAM_TICKS, 33000) condition:setFormula(0.3, -24, 0.3, -24) combat:setCondition(condition) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/support/invisible.lua b/path_8_7/data/spells/scripts/support/invisible.lua index 0f9d92031..c5d1eec86 100644 --- a/path_8_7/data/spells/scripts/support/invisible.lua +++ b/path_8_7/data/spells/scripts/support/invisible.lua @@ -1,11 +1,11 @@ local combat = Combat() combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE) -combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0) +combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false) local condition = Condition(CONDITION_INVISIBLE) condition:setParameter(CONDITION_PARAM_TICKS, 200000) combat:setCondition(condition) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/support/light.lua b/path_8_7/data/spells/scripts/support/light.lua index fd37b6799..591bf912b 100644 --- a/path_8_7/data/spells/scripts/support/light.lua +++ b/path_8_7/data/spells/scripts/support/light.lua @@ -1,6 +1,6 @@ local combat = Combat() combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE) -combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0) +combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false) local condition = Condition(CONDITION_LIGHT) condition:setParameter(CONDITION_PARAM_LIGHT_LEVEL, 6) @@ -8,6 +8,6 @@ condition:setParameter(CONDITION_PARAM_LIGHT_COLOR, 215) condition:setParameter(CONDITION_PARAM_TICKS, (6 * 60 + 10) * 1000) combat:setCondition(condition) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/support/magic rope.lua b/path_8_7/data/spells/scripts/support/magic rope.lua index 57e967fb0..012311df6 100644 --- a/path_8_7/data/spells/scripts/support/magic rope.lua +++ b/path_8_7/data/spells/scripts/support/magic rope.lua @@ -1,4 +1,4 @@ -function onCastSpell(creature, var) +function onCastSpell(creature, variant) local position = creature:getPosition() position:sendMagicEffect(CONST_ME_POFF) diff --git a/path_8_7/data/spells/scripts/support/magic shield.lua b/path_8_7/data/spells/scripts/support/magic shield.lua index dd6ef6979..adf714704 100644 --- a/path_8_7/data/spells/scripts/support/magic shield.lua +++ b/path_8_7/data/spells/scripts/support/magic shield.lua @@ -1,11 +1,11 @@ local combat = Combat() combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE) -combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0) +combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false) local condition = Condition(CONDITION_MANASHIELD) condition:setParameter(CONDITION_PARAM_TICKS, 200000) combat:setCondition(condition) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/support/magic wall rune.lua b/path_8_7/data/spells/scripts/support/magic wall rune.lua index 7c5c556cc..79c26ee0c 100644 --- a/path_8_7/data/spells/scripts/support/magic wall rune.lua +++ b/path_8_7/data/spells/scripts/support/magic wall rune.lua @@ -2,6 +2,6 @@ local combat = Combat() combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGY) combat:setParameter(COMBAT_PARAM_CREATEITEM, ITEM_MAGICWALL) -function onCastSpell(creature, var, isHotkey) - return combat:execute(creature, var) +function onCastSpell(creature, variant, isHotkey) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/support/paralyze rune.lua b/path_8_7/data/spells/scripts/support/paralyze rune.lua index 24ccc240e..4e76c6b35 100644 --- a/path_8_7/data/spells/scripts/support/paralyze rune.lua +++ b/path_8_7/data/spells/scripts/support/paralyze rune.lua @@ -6,8 +6,8 @@ condition:setParameter(CONDITION_PARAM_TICKS, 20000) condition:setFormula(-0.9, 0, -0.9, 0) combat:setCondition(condition) -function onCastSpell(creature, var) - if not combat:execute(creature, var) then +function onCastSpell(creature, variant, isHotkey) + if not combat:execute(creature, variant) then return false end diff --git a/path_8_7/data/spells/scripts/support/protector.lua b/path_8_7/data/spells/scripts/support/protector.lua index f85abcfa4..3d9ddc91f 100644 --- a/path_8_7/data/spells/scripts/support/protector.lua +++ b/path_8_7/data/spells/scripts/support/protector.lua @@ -1,25 +1,22 @@ local combat = Combat() combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN) -combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0) +combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false) -local condition = Condition(CONDITION_ATTRIBUTES) -condition:setParameter(CONDITION_PARAM_BUFF_SPELL, 1) -condition:setParameter(CONDITION_PARAM_TICKS, 13000) -condition:setParameter(CONDITION_PARAM_SKILL_SHIELDPERCENT, 220) -combat:setCondition(condition) +local skill = Condition(CONDITION_ATTRIBUTES) +skill:setParameter(CONDITION_PARAM_TICKS, 13000) +skill:setParameter(CONDITION_PARAM_SKILL_SHIELDPERCENT, 220) +skill:setParameter(CONDITION_PARAM_BUFF_SPELL, true) +combat:setCondition(skill) -local conditionExhaustCombat = Condition(CONDITION_EXHAUST_COMBAT) -conditionExhaustCombat:setParameter(CONDITION_PARAM_TICKS, 10000) -combat:setCondition(conditionExhaustCombat) +local cooldownAttackGroup = Condition(CONDITION_SPELLGROUPCOOLDOWN) +cooldownAttackGroup:setParameter(CONDITION_PARAM_SUBID, 1) +cooldownAttackGroup:setParameter(CONDITION_PARAM_TICKS, 10000) +combat:setCondition(cooldownAttackGroup) -local conditionExhaustHeal = Condition(CONDITION_EXHAUST_HEAL) -conditionExhaustHeal:setParameter(CONDITION_PARAM_TICKS, 10000) -combat:setCondition(conditionExhaustHeal) +local pacified = Condition(CONDITION_PACIFIED) +pacified:setParameter(CONDITION_PARAM_TICKS, 10000) +combat:setCondition(pacified) -local conditionPacified = Condition(CONDITION_PACIFIED) -conditionPacified:setParameter(CONDITION_PARAM_TICKS, 10000) -combat:setCondition(conditionPacified) - -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/support/sharpshooter.lua b/path_8_7/data/spells/scripts/support/sharpshooter.lua index cf5be22fd..52fe14626 100644 --- a/path_8_7/data/spells/scripts/support/sharpshooter.lua +++ b/path_8_7/data/spells/scripts/support/sharpshooter.lua @@ -1,24 +1,29 @@ local combat = Combat() combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN) -combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0) +combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false) -local condition = Condition(CONDITION_ATTRIBUTES) -condition:setParameter(CONDITION_PARAM_TICKS, 10000) -condition:setParameter(CONDITION_PARAM_SKILL_DISTANCEPERCENT, 150) -condition:setParameter(CONDITION_PARAM_SKILL_SHIELDPERCENT, -100) -condition:setParameter(CONDITION_PARAM_BUFF_SPELL, 1) -combat:setCondition(condition) +local skill = Condition(CONDITION_ATTRIBUTES) +skill:setParameter(CONDITION_PARAM_TICKS, 10000) +skill:setParameter(CONDITION_PARAM_SKILL_DISTANCEPERCENT, 150) +skill:setParameter(CONDITION_PARAM_SKILL_SHIELDPERCENT, -100) +skill:setParameter(CONDITION_PARAM_BUFF_SPELL, true) +combat:setCondition(skill) -local speed = Condition(CONDITION_HASTE) +local speed = Condition(CONDITION_PARALYZE) speed:setParameter(CONDITION_PARAM_TICKS, 10000) speed:setFormula(-0.7, 56, -0.7, 56) combat:setCondition(speed) -local exhaust = Condition(CONDITION_EXHAUST) -exhaust:setParameter(CONDITION_PARAM_SUBID, 2) -exhaust:setParameter(CONDITION_PARAM_TICKS, 10000) -combat:setCondition(exhaust) +local cooldownHealingGroup = Condition(CONDITION_SPELLGROUPCOOLDOWN) +cooldownHealingGroup:setParameter(CONDITION_PARAM_TICKS, 10000) +cooldownHealingGroup:setParameter(CONDITION_PARAM_SUBID, 2) +combat:setCondition(cooldownHealingGroup) -function onCastSpell(creature, var) - return combat:execute(creature, var) +local cooldownSupportGroup = Condition(CONDITION_SPELLGROUPCOOLDOWN) +cooldownSupportGroup:setParameter(CONDITION_PARAM_TICKS, 10000) +cooldownSupportGroup:setParameter(CONDITION_PARAM_SUBID, 3) +combat:setCondition(cooldownSupportGroup) + +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/support/strong haste.lua b/path_8_7/data/spells/scripts/support/strong haste.lua index ffdeb8776..3a02eadc6 100644 --- a/path_8_7/data/spells/scripts/support/strong haste.lua +++ b/path_8_7/data/spells/scripts/support/strong haste.lua @@ -1,12 +1,12 @@ local combat = Combat() combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN) -combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0) +combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false) local condition = Condition(CONDITION_HASTE) condition:setParameter(CONDITION_PARAM_TICKS, 22000) condition:setFormula(0.7, -56, 0.7, -56) combat:setCondition(condition) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/support/swift foot.lua b/path_8_7/data/spells/scripts/support/swift foot.lua index 4b3cbae40..d710bc7d4 100644 --- a/path_8_7/data/spells/scripts/support/swift foot.lua +++ b/path_8_7/data/spells/scripts/support/swift foot.lua @@ -1,21 +1,21 @@ local combat = Combat() combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN) -combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0) +combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false) -local condition = Condition(CONDITION_HASTE) -condition:setParameter(CONDITION_PARAM_TICKS, 10000) -condition:setFormula(0.8, -72, 0.8, -72) -combat:setCondition(condition) +local speed = Condition(CONDITION_HASTE) +speed:setParameter(CONDITION_PARAM_TICKS, 10000) +speed:setFormula(0.8, -72, 0.8, -72) +combat:setCondition(speed) -local exhaust = Condition(CONDITION_EXHAUST) -exhaust:setParameter(CONDITION_PARAM_SUBID, 1) -exhaust:setParameter(CONDITION_PARAM_TICKS, 10000) -combat:setCondition(exhaust) +local cooldownAttackGroup = Condition(CONDITION_SPELLGROUPCOOLDOWN) +cooldownAttackGroup:setParameter(CONDITION_PARAM_SUBID, 1) +cooldownAttackGroup:setParameter(CONDITION_PARAM_TICKS, 10000) +combat:setCondition(cooldownAttackGroup) -local disable = Condition(CONDITION_PACIFIED) -disable:setParameter(CONDITION_PARAM_TICKS, 10000) -combat:setCondition(disable) +local pacified = Condition(CONDITION_PACIFIED) +pacified:setParameter(CONDITION_PARAM_TICKS, 10000) +combat:setCondition(pacified) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/support/ultimate light.lua b/path_8_7/data/spells/scripts/support/ultimate light.lua index a9e92868a..cea27680f 100644 --- a/path_8_7/data/spells/scripts/support/ultimate light.lua +++ b/path_8_7/data/spells/scripts/support/ultimate light.lua @@ -1,6 +1,6 @@ local combat = Combat() combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE) -combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0) +combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false) local condition = Condition(CONDITION_LIGHT) condition:setParameter(CONDITION_PARAM_LIGHT_LEVEL, 8) @@ -8,6 +8,6 @@ condition:setParameter(CONDITION_PARAM_LIGHT_COLOR, 215) condition:setParameter(CONDITION_PARAM_TICKS, (60 * 33 + 10) * 1000) combat:setCondition(condition) -function onCastSpell(creature, var) - return combat:execute(creature, var) +function onCastSpell(creature, variant) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/spells/scripts/support/wild growth rune.lua b/path_8_7/data/spells/scripts/support/wild growth rune.lua index a15e27c7e..c22683de1 100644 --- a/path_8_7/data/spells/scripts/support/wild growth rune.lua +++ b/path_8_7/data/spells/scripts/support/wild growth rune.lua @@ -2,6 +2,6 @@ local combat = Combat() combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_EARTH) combat:setParameter(COMBAT_PARAM_CREATEITEM, ITEM_WILDGROWTH) -function onCastSpell(creature, var, isHotkey) - return combat:execute(creature, var) +function onCastSpell(creature, variant, isHotkey) + return combat:execute(creature, variant) end diff --git a/path_8_7/data/talkactions/scripts/addon.lua b/path_8_7/data/talkactions/scripts/addon.lua new file mode 100644 index 000000000..50681a10a --- /dev/null +++ b/path_8_7/data/talkactions/scripts/addon.lua @@ -0,0 +1,181 @@ +local config = { + ["citizen"] = { + male = 128, + female = 136, + addon = 3, + items = { + {5878,100} + } + }, + ["hunter"] = { + male = 129, + female = 137, + addon = 3, + items = { + {5876, 100}, {5948, 100} + } + }, + ["mage"] = { + male = 130, + female = 138, + addon = 3, + items = { + {2160, 1000} + } + }, + ["knight"] = { + male = 131, + female = 139, + addon = 3, + items = { + {5880, 100}, {5893, 100} + } + }, + ["summoner"] = { + male = 133, + female = 141, + addon = 3, + items = { + {2160,1000} + } + }, + ["warrior"] = { + male = 134, + female = 142, + addon = 3, + items = { + {5925, 100}, {5899, 100}, {5919, 1}, {5880, 100} + } + }, + ["barbarian"] = { + male = 147, + female = 143, + addon = 3, + items = { + {5911, 50}, {5910, 50}, {5879, 100} + } + }, + ["druid"] = { + male = 148, + female = 144, + addon = 3, + items = { + {5896, 50}, {5897, 50} + } + }, + ["wizard"] = { + male = 149, + female = 145, + addon = 3, + items = { + {2536, 1}, {2492, 1}, {2488, 1}, {2123, 1}, {5922, 50} + } + }, + ["oriental"] = { + male = 150, + female = 146, + addon = 3, + items = { + {5883, 100}, {5895, 100}, {5912, 100} + } + }, + ["pirate"] = { + male = 151, + female = 155, + addon = 3, + items = { + {6098, 100}, {6126, 100}, {6097, 100} + } + }, + ["assassin"] = { + male = 152, + female = 156, + addon = 3, + items = { + {5898, 30}, {5882, 10}, {5881, 30}, {5895, 20}, {5905, 10} + } + }, + ["beggar"] = { + male = 153, + female = 157, + addon = 3, + items = { + {5878, 50}, {2743, 30}, {5913, 20}, {5894, 10} + } + }, + ["shaman"] = { + male = 154, + female = 158, + addon = 3, + items = { + {3955, 5}, {5810, 5}, {3966, 5}, {3967, 5} + } + }, + ["norseman"] = { + male = 251, + female = 252, + addon = 3, + items = { + {7290, 15} + } + }, + ["nightmare"] = { + male = 268, + female = 269, + addon = 3, + items = { + {6500, 200} + } + }, + ["jester"] = { + male = 273, + female = 270, + addon = 3, + items = { + {2160, 25} + } + }, + ["brotherhood"] = { + male = 278, + female = 279, + addon = 3, + items = { + {6500, 200} + } + } +} + +function onSay(player, words, param) + local v = config[param:lower()] + if not v then + return false + end + + local outfit = player:getSex() == PLAYERSEX_FEMALE and v["female"] or v["male"] + if player:hasOutfit(outfit, 3) then + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have already obtained the " .. param .. " addons.") + return false + end + + local text = "" + for i = 1, #v["items"] do + local itemType = ItemType(v["items"][i][1]) + text = text .. (i ~= 1 and (i == #v["items"] and " and " or ", ") or "") .. (v["items"][i][2] > 1 and v["items"][i][2] or itemType:getArticle()) .. " " .. (v["items"][i][2] > 1 and itemType:getPluralName() or itemType:getName()) + end + + for i = 1, #v["items"] do + if player:getItemCount(v["items"][i][1]) < v["items"][i][2] then + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You need " .. text .. " for the whole " .. param .. " outfit.") + return false + end + end + + for i = 1, #v["items"] do + player:removeItem(unpack(v["items"][i])) + end + player:addOutfitAddon(v["female"], 3) + player:addOutfitAddon(v["male"], 3) + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Enjoy your new addons to your " .. param .. " outfit!") + player:getPosition():sendMagicEffect(CONST_ME_FIREWORK_YELLOW) + return false +end diff --git a/path_8_7/data/talkactions/scripts/alladdons.lua b/path_8_7/data/talkactions/scripts/alladdons.lua new file mode 100644 index 000000000..255da61da --- /dev/null +++ b/path_8_7/data/talkactions/scripts/alladdons.lua @@ -0,0 +1,41 @@ +local looktypes = { + 128, 136, 129, 137, 130, 138, 131, 139, 132, 140, 133, 141, 134, 142, + 143, 147, 144, 148, 145, 149, 146, 150, 151, 155, 152, 156, 153, 157, + 154, 158, 251, 252, 268, 269, 273, 270, 278, 279, 289, 288, 325, 324, + 335, 336, 366, 367, 328, 329 +} + +function onSay(player, words, param) + if not player:getGroup():getAccess() then + return true + end + + local target + if param == '' then + target = player:getTarget() + if not target then + player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, 'Gives players the ability to wear all addons. Usage: /addons ') + return false + end + else + target = Player(param) + end + + if not target then + player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, 'Player ' .. param .. ' is currently not online.') + return false + end + + if player:getAccountType() < ACCOUNT_TYPE_GOD then + player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, 'Cannot perform action.') + return false + end + + for i = 1, #looktypes do + target:addOutfitAddon(looktypes[i], 3) + end + + player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, 'All addons unlocked for ' .. target:getName() .. '.') + target:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, '[Server] All addons unlocked.') + return false +end diff --git a/path_8_7/data/talkactions/scripts/allmounts.lua b/path_8_7/data/talkactions/scripts/allmounts.lua new file mode 100644 index 000000000..5e27a9dce --- /dev/null +++ b/path_8_7/data/talkactions/scripts/allmounts.lua @@ -0,0 +1,34 @@ +function onSay(player, words, param) + if not player:getGroup():getAccess() then + return true + end + + local target + if param == '' then + target = player:getTarget() + if not target then + player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, 'Unlocks all mounts for certain player. Usage: /mounts ') + return false + end + else + target = Player(param) + end + + if not target then + player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, 'Player ' .. param .. ' is not currently online.') + return false + end + + if player:getAccountType() < ACCOUNT_TYPE_GOD then + player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, 'Cannot perform action.') + return false + end + + for i = 1, 12 do + target:addMount(i) + end + + player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, 'All mounts unlocked for: ' .. target:getName()) + target:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, '[Server] All mounts unlocked.') + return false +end diff --git a/path_8_7/data/talkactions/scripts/animationeffect.lua b/path_8_7/data/talkactions/scripts/animationeffect.lua index 0ad31d0c1..ba55558ce 100644 --- a/path_8_7/data/talkactions/scripts/animationeffect.lua +++ b/path_8_7/data/talkactions/scripts/animationeffect.lua @@ -4,11 +4,6 @@ function onSay(player, words, param) end local effect = tonumber(param) - if not Game.hasDistanceEffect(effect) then - player:sendCancelMessage("Invalid effect id.") - return false - end - local position = player:getPosition() local toPositionLow = {z = position.z} local toPositionHigh = {z = position.z} diff --git a/path_8_7/data/talkactions/scripts/magiceffect.lua b/path_8_7/data/talkactions/scripts/magiceffect.lua index 8bc3024ec..ebc26b3ec 100644 --- a/path_8_7/data/talkactions/scripts/magiceffect.lua +++ b/path_8_7/data/talkactions/scripts/magiceffect.lua @@ -3,12 +3,6 @@ function onSay(player, words, param) return true end - local effect = tonumber(param) - if not Game.hasEffect(effect) then - player:sendCancelMessage("Invalid effect id.") - return false - end - player:getPosition():sendMagicEffect(tonumber(param)) return false end diff --git a/path_8_7/data/talkactions/scripts/save.lua b/path_8_7/data/talkactions/scripts/save.lua new file mode 100644 index 000000000..f1949517a --- /dev/null +++ b/path_8_7/data/talkactions/scripts/save.lua @@ -0,0 +1,19 @@ +local savingEvent = 0 + +function onSay(player, words, param) + if player:getGroup():getAccess() then + if isNumber(param) then + stopEvent(savingEvent) + save(tonumber(param) * 60 * 1000) + else + saveServer() + end + end +end + +function save(delay) + saveServer() + if delay > 0 then + savingEvent = addEvent(save, delay, delay) + end +end diff --git a/path_8_7/data/talkactions/scripts/teleport_to_pos.lua b/path_8_7/data/talkactions/scripts/teleport_to_pos.lua new file mode 100644 index 000000000..2b0f31a20 --- /dev/null +++ b/path_8_7/data/talkactions/scripts/teleport_to_pos.lua @@ -0,0 +1,27 @@ +function onSay(player, words, param) + if not player:getGroup():getAccess() then + return true + end + + if param == '' then + player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.") + return false + end + + local tile = param:split(",") + local pos + if tile[2] and tile[3] then + pos = Position(tile[1], tile[2], tile[3]) + else + player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Invalid param specified.") + return false + end + + local tmp = player:getPosition() + if player:teleportTo(pos) and not player:isInGhostMode() then + tmp:sendMagicEffect(CONST_ME_POFF) + pos:sendMagicEffect(CONST_ME_TELEPORT) + end + + return false +end diff --git a/path_8_7/data/talkactions/talkactions.xml b/path_8_7/data/talkactions/talkactions.xml index 486868cc9..ae85082af 100644 --- a/path_8_7/data/talkactions/talkactions.xml +++ b/path_8_7/data/talkactions/talkactions.xml @@ -33,6 +33,12 @@ + + + + + + @@ -44,7 +50,10 @@ - - - + diff --git a/path_8_7/data/weapons/scripts/burst_arrow.lua b/path_8_7/data/weapons/scripts/burst_arrow.lua new file mode 100644 index 000000000..eb8290173 --- /dev/null +++ b/path_8_7/data/weapons/scripts/burst_arrow.lua @@ -0,0 +1,17 @@ +local area = createCombatArea({ + {1, 1, 1}, + {1, 3, 1}, + {1, 1, 1} +}) + +local combat = Combat() +combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE) +combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_EXPLOSIONAREA) +combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_BURSTARROW) +combat:setParameter(COMBAT_PARAM_BLOCKARMOR, true) +combat:setFormula(COMBAT_FORMULA_SKILL, 0, 0, 1, 0) +combat:setArea(area) + +function onUseWeapon(player, variant) + return combat:execute(player, variant) +end diff --git a/path_8_7/data/weapons/scripts/explosive_arrow.lua b/path_8_7/data/weapons/scripts/explosive_arrow.lua deleted file mode 100644 index adc16b6f7..000000000 --- a/path_8_7/data/weapons/scripts/explosive_arrow.lua +++ /dev/null @@ -1,18 +0,0 @@ -local area = createCombatArea({ - {1, 1, 1}, - {1, 3, 1}, - {1, 1, 1} -}) - -local combat = Combat() -combat:setParameter(COMBAT_PARAM_BLOCKARMOR, 1) -combat:setParameter(COMBAT_PARAM_BLOCKSHIELD, 1) -combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE) -combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_FIREAREA) -combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_BURSTARROW) -combat:setFormula(COMBAT_FORMULA_SKILL, 1, 0, 1, 0) -combat:setArea(area) - -function onUseWeapon(player, var) - return combat:execute(player, var) -end diff --git a/path_8_7/data/weapons/scripts/poison_arrow.lua b/path_8_7/data/weapons/scripts/poison_arrow.lua index 6bdfd6b42..2e0f64a62 100644 --- a/path_8_7/data/weapons/scripts/poison_arrow.lua +++ b/path_8_7/data/weapons/scripts/poison_arrow.lua @@ -1,14 +1,16 @@ local combat = Combat() -combat:setParameter(COMBAT_PARAM_BLOCKARMOR, 1) -combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_POISONDAMAGE) +combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE) combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_POISONARROW) -combat:setFormula(COMBAT_FORMULA_SKILL, 1, 0, 1, 0) +combat:setParameter(COMBAT_PARAM_BLOCKARMOR, true) +combat:setFormula(COMBAT_FORMULA_SKILL, 0, 0, 1, 0) local condition = Condition(CONDITION_POISON) -condition:setParameter(CONDITION_PARAM_DELAYED, 1) -condition:addDamage(10, 2000, -1) +condition:setParameter(CONDITION_PARAM_DELAYED, true) +condition:addDamage(4, 4000, -3) +condition:addDamage(9, 4000, -2) +condition:addDamage(20, 4000, -1) combat:setCondition(condition) -function onUseWeapon(player, var) - return combat:execute(player, var) +function onUseWeapon(player, variant) + return combat:execute(player, variant) end diff --git a/path_8_7/data/weapons/scripts/viper_star.lua b/path_8_7/data/weapons/scripts/viper_star.lua index 78cea9dc1..023325818 100644 --- a/path_8_7/data/weapons/scripts/viper_star.lua +++ b/path_8_7/data/weapons/scripts/viper_star.lua @@ -1,28 +1,28 @@ local combat = Combat() -combat:setParameter(COMBAT_PARAM_BLOCKARMOR, 1) combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE) combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_GREENSTAR) -combat:setFormula(COMBAT_FORMULA_SKILL, 0, 0, 1.0, 0) +combat:setParameter(COMBAT_PARAM_BLOCKARMOR, true) +combat:setFormula(COMBAT_FORMULA_SKILL, 0, 0, 1, 0) local condition = Condition(CONDITION_POISON) -condition:setParameter(CONDITION_PARAM_DELAYED, 1) -condition:addDamage(4, 2000, -2) -condition:addDamage(6, 2000, -1) +condition:setParameter(CONDITION_PARAM_DELAYED, true) +condition:addDamage(10, 4000, -2) +condition:addDamage(20, 4000, -1) local secondCombat = Combat() secondCombat:setParameter(COMBAT_PARAM_TYPE, COMBAT_EARTHDAMAGE) secondCombat:setCondition(condition) -function onUseWeapon(player, var) - local boolean = combat:execute(player, var) +function onUseWeapon(player, variant) + local boolean = combat:execute(player, variant) if not boolean then return false end - local target = var:getNumber() + local target = variant:getNumber() if target ~= 0 then - if math.random(0, 100) > 90 then - boolean = secondCombat:execute(player, var) + if math.random(1, 100) > 90 then + boolean = secondCombat:execute(player, variant) end end return boolean diff --git a/path_8_7/data/weapons/weapons.xml b/path_8_7/data/weapons/weapons.xml index 63c882729..29b70851d 100644 --- a/path_8_7/data/weapons/weapons.xml +++ b/path_8_7/data/weapons/weapons.xml @@ -25,6 +25,15 @@ + + + + + + + + + @@ -51,6 +60,18 @@ + + + + + + + + + + + + @@ -146,6 +167,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -285,6 +336,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -409,6 +489,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -495,6 +608,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -504,20 +670,20 @@ - - - - - - - - + + + + + + + + - - - - - - - + + + + + + + diff --git a/path_8_7/src/actions.cpp b/path_8_7/src/actions.cpp index ffa1b232d..3be8d05e7 100644 --- a/path_8_7/src/actions.cpp +++ b/path_8_7/src/actions.cpp @@ -263,11 +263,7 @@ Action* Actions::getAction(const Item* item) } //rune items - Action* runeSpell = g_spells->getRuneSpell(item->getID()); - if (runeSpell) { - return runeSpell; - } - return nullptr; + return g_spells->getRuneSpell(item->getID()); } ReturnValue Actions::internalUseItem(Player* player, const Position& pos, uint8_t index, Item* item, bool isHotkey) diff --git a/path_8_7/src/chat.cpp b/path_8_7/src/chat.cpp index 12582dd83..1a4c03109 100644 --- a/path_8_7/src/chat.cpp +++ b/path_8_7/src/chat.cpp @@ -22,7 +22,6 @@ #include "chat.h" #include "game.h" #include "pugicast.h" -#include "player.h" #include "scheduler.h" extern Chat* g_chat; diff --git a/path_8_7/src/definitions.h b/path_8_7/src/definitions.h index c69f8e8f5..bcd4370f1 100644 --- a/path_8_7/src/definitions.h +++ b/path_8_7/src/definitions.h @@ -23,8 +23,8 @@ #define STATUS_SERVER_NAME "OTX Server" #define STATUS_SERVER_VERSION "3" #define MINOR_VERSION "2" -#define REVISION_VERSION "-" -#define SOFTWARE_CODENAME "The Second" +#define REVISION_VERSION "408" +#define SOFTWARE_CODENAME "PHANTOM" #define STATUS_SERVER_DEVELOPERS "Mattyx14 and TFS Developers" #define GIT_REPO "https://github.com/mattyx14/otxserver/" diff --git a/path_8_7/src/game.cpp b/path_8_7/src/game.cpp index 3d630e96d..795e3efc9 100644 --- a/path_8_7/src/game.cpp +++ b/path_8_7/src/game.cpp @@ -26,28 +26,15 @@ #include "creature.h" #include "monster.h" #include "game.h" -#include "tile.h" -#include "house.h" #include "actions.h" -#include "combat.h" #include "iologindata.h" -#include "chat.h" #include "talkaction.h" #include "spells.h" #include "configmanager.h" -#include "ban.h" -#include "raids.h" -#include "database.h" #include "server.h" -#include "ioguild.h" -#include "quests.h" #include "globalevent.h" -#include "mounts.h" #include "bed.h" #include "scheduler.h" -#include "monster.h" -#include "spawn.h" -#include "connection.h" #include "events.h" #include "databasetasks.h" @@ -1378,9 +1365,9 @@ Item* Game::findItemOfType(Cylinder* cylinder, uint16_t itemId, return item; } - Container* tmpContainer = item->getContainer(); - if (tmpContainer) { - containers.push_back(tmpContainer); + Container* subContainer = item->getContainer(); + if (subContainer) { + containers.push_back(subContainer); } } } @@ -1393,7 +1380,7 @@ bool Game::removeMoney(Cylinder* cylinder, uint32_t money, uint32_t flags /*= 0* return false; } - if (money <= 0) { + if (money == 0) { return true; } @@ -1448,50 +1435,52 @@ bool Game::removeMoney(Cylinder* cylinder, uint32_t money, uint32_t flags /*= 0* for (const auto& moneyEntry : moneyMap) { Item* item = moneyEntry.second; - if (moneyEntry.first > money) { + if (moneyEntry.first >= money) { uint32_t worth = moneyEntry.first / item->getItemCount(); uint32_t removeCount = (money / worth) + 1; addMoney(cylinder, (worth * removeCount) - money, flags); internalRemoveItem(item, removeCount); - money = 0; - } else { - internalRemoveItem(item); - money -= moneyEntry.first; - } - - if (money == 0) { return true; } + + internalRemoveItem(item); + money -= moneyEntry.first; } return false; } void Game::addMoney(Cylinder* cylinder, uint32_t money, uint32_t flags /*= 0*/) { - uint32_t crys = money / 10000; - money -= crys * 10000; - while (crys > 0) { - Item* remaindItem = Item::CreateItem(ITEM_CRYSTAL_COIN, std::min(100, crys)); + if (money == 0) { + return; + } + + uint32_t crystalCoins = money / 10000; + money -= crystalCoins * 10000; + while (crystalCoins > 0) { + const uint16_t count = std::min(100, crystalCoins); + + Item* remaindItem = Item::CreateItem(ITEM_CRYSTAL_COIN, count); ReturnValue ret = internalAddItem(cylinder, remaindItem, INDEX_WHEREEVER, flags); if (ret != RETURNVALUE_NOERROR) { internalAddItem(cylinder->getTile(), remaindItem, INDEX_WHEREEVER, FLAG_NOLIMIT); } - crys -= std::min(100, crys); + crystalCoins -= count; } - uint16_t plat = money / 100; - if (plat != 0) { - Item* remaindItem = Item::CreateItem(ITEM_PLATINUM_COIN, plat); + uint16_t platinumCoins = money / 100; + if (platinumCoins != 0) { + Item* remaindItem = Item::CreateItem(ITEM_PLATINUM_COIN, platinumCoins); ReturnValue ret = internalAddItem(cylinder, remaindItem, INDEX_WHEREEVER, flags); if (ret != RETURNVALUE_NOERROR) { internalAddItem(cylinder->getTile(), remaindItem, INDEX_WHEREEVER, FLAG_NOLIMIT); } - money -= plat * 100; + money -= platinumCoins * 100; } if (money != 0) { diff --git a/path_8_7/src/iomapserialize.cpp b/path_8_7/src/iomapserialize.cpp index d4390b0dd..dddd4d696 100644 --- a/path_8_7/src/iomapserialize.cpp +++ b/path_8_7/src/iomapserialize.cpp @@ -20,7 +20,6 @@ #include "otpch.h" #include "iomapserialize.h" -#include "house.h" #include "game.h" #include "bed.h" diff --git a/path_8_7/src/item.cpp b/path_8_7/src/item.cpp index f28c5c6d2..3b0eae63b 100644 --- a/path_8_7/src/item.cpp +++ b/path_8_7/src/item.cpp @@ -26,13 +26,14 @@ #include "mailbox.h" #include "house.h" #include "game.h" -#include "luascript.h" #include "bed.h" #include "actions.h" -#include "combat.h" +#include "spells.h" extern Game g_game; +extern Spells* g_spells; +extern Vocations g_vocations; Items Item::items; @@ -814,32 +815,57 @@ std::string Item::getDescription(const ItemType& it, int32_t lookDistance, } if (it.isRune()) { - if (!it.runeSpellName.empty()) { - s << " (\"" << it.runeSpellName << "\")"; - } - if (it.runeLevel > 0 || it.runeMagLevel > 0) { - int32_t tmpSubType = subType; + if (RuneSpell* rune = g_spells->getRuneSpell(it.id)) { + int32_t tmpSubType = subType; + if (item) { + tmpSubType = item->getSubType(); + } + s << ". " << (it.stackable && tmpSubType > 1 ? "They" : "It") << " can only be used by "; - if (item) { - tmpSubType = item->getSubType(); - } + const VocSpellMap& vocMap = rune->getVocMap(); + std::vector showVocMap; - s << ". " << (it.stackable && tmpSubType > 1 ? "They" : "It") << " can only be used with"; + // vocations are usually listed with the unpromoted and promoted version, the latter being + // hidden from description, so `total / 2` is most likely the amount of vocations to be shown. + showVocMap.reserve(vocMap.size() / 2); + for (const auto& voc : vocMap) { + if (voc.second) { + showVocMap.push_back(g_vocations.getVocation(voc.first)); + } + } - if (it.runeLevel > 0) { - s << " level " << it.runeLevel; - } + if (!showVocMap.empty()) { + auto vocIt = showVocMap.begin(), vocLast = (showVocMap.end() - 1); + while (vocIt != vocLast) { + s << asLowerCaseString((*vocIt)->getVocName()) << "s"; + if (++vocIt == vocLast) { + s << " and "; + } else { + s << ", "; + } + } + s << asLowerCaseString((*vocLast)->getVocName()) << "s"; + } else { + s << "players"; + } + + s << " with"; - if (it.runeMagLevel > 0) { if (it.runeLevel > 0) { - s << " and"; + s << " level " << it.runeLevel; } - s << " magic level " << it.runeMagLevel; - } + if (it.runeMagLevel > 0) { + if (it.runeLevel > 0) { + s << " and"; + } - s << " or higher"; + s << " magic level " << it.runeMagLevel; + } + + s << " or higher"; + } } } else if (it.weaponType != WEAPON_NONE) { if (it.weaponType == WEAPON_DISTANCE && it.ammoType != AMMO_NONE) { @@ -1327,7 +1353,7 @@ std::string Item::getDescription(const ItemType& it, int32_t lookDistance, s << "premium "; } - if (it.wieldInfo & WIELDINFO_VOCREQ) { + if (!it.vocationString.empty()) { s << it.vocationString; } else { s << "players"; diff --git a/path_8_7/src/items.cpp b/path_8_7/src/items.cpp index c419b3ce4..4096dd779 100644 --- a/path_8_7/src/items.cpp +++ b/path_8_7/src/items.cpp @@ -948,6 +948,14 @@ void Items::parseItemNode(const pugi::xml_node& itemNode, uint16_t id) Abilities& abilities = it.getAbilities(); abilities.elementDamage = pugi::cast(valueAttribute.value()); abilities.elementType = COMBAT_ENERGYDAMAGE; + } else if (tmpStrValue == "elementdeath") { + Abilities& abilities = it.getAbilities(); + abilities.elementDamage = pugi::cast(valueAttribute.value()); + abilities.elementType = COMBAT_DEATHDAMAGE; + } else if (tmpStrValue == "elementholy") { + Abilities& abilities = it.getAbilities(); + abilities.elementDamage = pugi::cast(valueAttribute.value()); + abilities.elementType = COMBAT_HOLYDAMAGE; } else if (tmpStrValue == "walkstack") { it.walkStack = valueAttribute.as_bool(); } else if (tmpStrValue == "blocking") { diff --git a/path_8_7/src/luascript.cpp b/path_8_7/src/luascript.cpp index 0c7b62c85..a7859e7a8 100644 --- a/path_8_7/src/luascript.cpp +++ b/path_8_7/src/luascript.cpp @@ -1784,6 +1784,8 @@ void LuaScriptInterface::registerFunctions() registerMethod("Game", "hasDistanceEffect", LuaScriptInterface::luaGameHasDistanceEffect); registerMethod("Game", "hasEffect", LuaScriptInterface::luaGameHasEffect); + registerMethod("Game", "sendAnimatedText", LuaScriptInterface::luaGameSendAnimatedText); + // Variant registerClass("Variant", "", LuaScriptInterface::luaVariantCreate); @@ -1871,36 +1873,6 @@ void LuaScriptInterface::registerFunctions() registerMethod("NetworkMessage", "skipBytes", LuaScriptInterface::luaNetworkMessageSkipBytes); registerMethod("NetworkMessage", "sendToPlayer", LuaScriptInterface::luaNetworkMessageSendToPlayer); - // ModalWindow - registerClass("ModalWindow", "", LuaScriptInterface::luaModalWindowCreate); - registerMetaMethod("ModalWindow", "__eq", LuaScriptInterface::luaUserdataCompare); - registerMetaMethod("ModalWindow", "__gc", LuaScriptInterface::luaModalWindowDelete); - registerMethod("ModalWindow", "delete", LuaScriptInterface::luaModalWindowDelete); - - registerMethod("ModalWindow", "getId", LuaScriptInterface::luaModalWindowGetId); - registerMethod("ModalWindow", "getTitle", LuaScriptInterface::luaModalWindowGetTitle); - registerMethod("ModalWindow", "getMessage", LuaScriptInterface::luaModalWindowGetMessage); - - registerMethod("ModalWindow", "setTitle", LuaScriptInterface::luaModalWindowSetTitle); - registerMethod("ModalWindow", "setMessage", LuaScriptInterface::luaModalWindowSetMessage); - - registerMethod("ModalWindow", "getButtonCount", LuaScriptInterface::luaModalWindowGetButtonCount); - registerMethod("ModalWindow", "getChoiceCount", LuaScriptInterface::luaModalWindowGetChoiceCount); - - registerMethod("ModalWindow", "addButton", LuaScriptInterface::luaModalWindowAddButton); - registerMethod("ModalWindow", "addChoice", LuaScriptInterface::luaModalWindowAddChoice); - - registerMethod("ModalWindow", "getDefaultEnterButton", LuaScriptInterface::luaModalWindowGetDefaultEnterButton); - registerMethod("ModalWindow", "setDefaultEnterButton", LuaScriptInterface::luaModalWindowSetDefaultEnterButton); - - registerMethod("ModalWindow", "getDefaultEscapeButton", LuaScriptInterface::luaModalWindowGetDefaultEscapeButton); - registerMethod("ModalWindow", "setDefaultEscapeButton", LuaScriptInterface::luaModalWindowSetDefaultEscapeButton); - - registerMethod("ModalWindow", "hasPriority", LuaScriptInterface::luaModalWindowHasPriority); - registerMethod("ModalWindow", "setPriority", LuaScriptInterface::luaModalWindowSetPriority); - - registerMethod("ModalWindow", "sendToPlayer", LuaScriptInterface::luaModalWindowSendToPlayer); - // Item registerClass("Item", "", LuaScriptInterface::luaItemCreate); registerMetaMethod("Item", "__eq", LuaScriptInterface::luaUserdataCompare); @@ -2066,12 +2038,7 @@ void LuaScriptInterface::registerFunctions() registerMethod("Player", "getFreeCapacity", LuaScriptInterface::luaPlayerGetFreeCapacity); - registerMethod("Player", "getReward", LuaScriptInterface::luaPlayerGetReward); - registerMethod("Player", "removeReward", LuaScriptInterface::luaPlayerRemoveReward); - registerMethod("Player", "getRewardList", LuaScriptInterface::luaPlayerGetRewardList); - registerMethod("Player", "getDepotChest", LuaScriptInterface::luaPlayerGetDepotChest); - registerMethod("Player", "getInbox", LuaScriptInterface::luaPlayerGetInbox); registerMethod("Player", "getSkullTime", LuaScriptInterface::luaPlayerGetSkullTime); registerMethod("Player", "setSkullTime", LuaScriptInterface::luaPlayerSetSkullTime); @@ -2240,9 +2207,6 @@ void LuaScriptInterface::registerFunctions() registerMethod("Npc", "setMasterPos", LuaScriptInterface::luaNpcSetMasterPos); - registerMethod("Npc", "getSpeechBubble", LuaScriptInterface::luaNpcGetSpeechBubble); - registerMethod("Npc", "setSpeechBubble", LuaScriptInterface::luaNpcSetSpeechBubble); - // Guild registerClass("Guild", "", LuaScriptInterface::luaGuildCreate); registerMetaMethod("Guild", "__eq", LuaScriptInterface::luaUserdataCompare); @@ -2430,7 +2394,6 @@ void LuaScriptInterface::registerFunctions() registerMethod("MonsterType", "isPassive", LuaScriptInterface::luaMonsterTypeIsHostile); registerMethod("MonsterType", "isPushable", LuaScriptInterface::luaMonsterTypeIsPushable); registerMethod("MonsterType", "isHealthShown", LuaScriptInterface::luaMonsterTypeIsHealthShown); - registerMethod("MonsterType", "isRewardBoss", LuaScriptInterface::luaMonsterTypeIsRewardBoss); registerMethod("MonsterType", "canPushItems", LuaScriptInterface::luaMonsterTypeCanPushItems); registerMethod("MonsterType", "canPushCreatures", LuaScriptInterface::luaMonsterTypeCanPushCreatures); @@ -4377,6 +4340,29 @@ int LuaScriptInterface::luaGameStartRaid(lua_State* L) return 1; } +int LuaScriptInterface::luaGameSendAnimatedText(lua_State* L) +{ + // Game.sendAnimatedText(message, position, color) + int parameters = lua_gettop(L); + if (parameters < 3) { + pushBoolean(L, false); + return 1; + } + + TextColor_t color = getNumber(L, 3); + const Position& position = getPosition(L, 2); + const std::string& message = getString(L, 1); + + if (!position.x || !position.y) { + pushBoolean(L, false); + return 1; + } + + g_game.addAnimatedText(message, position, color); + pushBoolean(L, true); + return 1; +} + int LuaScriptInterface::luaGameHasEffect(lua_State* L) { // Game.hasEffect(effectId) @@ -5478,243 +5464,6 @@ int LuaScriptInterface::luaNetworkMessageSendToPlayer(lua_State* L) return 1; } -// ModalWindow -int LuaScriptInterface::luaModalWindowCreate(lua_State* L) -{ - // ModalWindow(id, title, message) - const std::string& message = getString(L, 4); - const std::string& title = getString(L, 3); - uint32_t id = getNumber(L, 2); - - pushUserdata(L, new ModalWindow(id, title, message)); - setMetatable(L, -1, "ModalWindow"); - return 1; -} - -int LuaScriptInterface::luaModalWindowDelete(lua_State* L) -{ - ModalWindow** windowPtr = getRawUserdata(L, 1); - if (windowPtr && *windowPtr) { - delete *windowPtr; - *windowPtr = nullptr; - } - return 0; -} - -int LuaScriptInterface::luaModalWindowGetId(lua_State* L) -{ - // modalWindow:getId() - ModalWindow* window = getUserdata(L, 1); - if (window) { - lua_pushnumber(L, window->id); - } else { - lua_pushnil(L); - } - return 1; -} - -int LuaScriptInterface::luaModalWindowGetTitle(lua_State* L) -{ - // modalWindow:getTitle() - ModalWindow* window = getUserdata(L, 1); - if (window) { - pushString(L, window->title); - } else { - lua_pushnil(L); - } - return 1; -} - -int LuaScriptInterface::luaModalWindowGetMessage(lua_State* L) -{ - // modalWindow:getMessage() - ModalWindow* window = getUserdata(L, 1); - if (window) { - pushString(L, window->message); - } else { - lua_pushnil(L); - } - return 1; -} - -int LuaScriptInterface::luaModalWindowSetTitle(lua_State* L) -{ - // modalWindow:setTitle(text) - const std::string& text = getString(L, 2); - ModalWindow* window = getUserdata(L, 1); - if (window) { - window->title = text; - pushBoolean(L, true); - } else { - lua_pushnil(L); - } - return 1; -} - -int LuaScriptInterface::luaModalWindowSetMessage(lua_State* L) -{ - // modalWindow:setMessage(text) - const std::string& text = getString(L, 2); - ModalWindow* window = getUserdata(L, 1); - if (window) { - window->message = text; - pushBoolean(L, true); - } else { - lua_pushnil(L); - } - return 1; -} - -int LuaScriptInterface::luaModalWindowGetButtonCount(lua_State* L) -{ - // modalWindow:getButtonCount() - ModalWindow* window = getUserdata(L, 1); - if (window) { - lua_pushnumber(L, window->buttons.size()); - } else { - lua_pushnil(L); - } - return 1; -} - -int LuaScriptInterface::luaModalWindowGetChoiceCount(lua_State* L) -{ - // modalWindow:getChoiceCount() - ModalWindow* window = getUserdata(L, 1); - if (window) { - lua_pushnumber(L, window->choices.size()); - } else { - lua_pushnil(L); - } - return 1; -} - -int LuaScriptInterface::luaModalWindowAddButton(lua_State* L) -{ - // modalWindow:addButton(id, text) - const std::string& text = getString(L, 3); - uint8_t id = getNumber(L, 2); - ModalWindow* window = getUserdata(L, 1); - if (window) { - window->buttons.emplace_back(text, id); - pushBoolean(L, true); - } else { - lua_pushnil(L); - } - return 1; -} - -int LuaScriptInterface::luaModalWindowAddChoice(lua_State* L) -{ - // modalWindow:addChoice(id, text) - const std::string& text = getString(L, 3); - uint8_t id = getNumber(L, 2); - ModalWindow* window = getUserdata(L, 1); - if (window) { - window->choices.emplace_back(text, id); - pushBoolean(L, true); - } else { - lua_pushnil(L); - } - return 1; -} - -int LuaScriptInterface::luaModalWindowGetDefaultEnterButton(lua_State* L) -{ - // modalWindow:getDefaultEnterButton() - ModalWindow* window = getUserdata(L, 1); - if (window) { - lua_pushnumber(L, window->defaultEnterButton); - } else { - lua_pushnil(L); - } - return 1; -} - -int LuaScriptInterface::luaModalWindowSetDefaultEnterButton(lua_State* L) -{ - // modalWindow:setDefaultEnterButton(buttonId) - ModalWindow* window = getUserdata(L, 1); - if (window) { - window->defaultEnterButton = getNumber(L, 2); - pushBoolean(L, true); - } else { - lua_pushnil(L); - } - return 1; -} - -int LuaScriptInterface::luaModalWindowGetDefaultEscapeButton(lua_State* L) -{ - // modalWindow:getDefaultEscapeButton() - ModalWindow* window = getUserdata(L, 1); - if (window) { - lua_pushnumber(L, window->defaultEscapeButton); - } else { - lua_pushnil(L); - } - return 1; -} - -int LuaScriptInterface::luaModalWindowSetDefaultEscapeButton(lua_State* L) -{ - // modalWindow:setDefaultEscapeButton(buttonId) - ModalWindow* window = getUserdata(L, 1); - if (window) { - window->defaultEscapeButton = getNumber(L, 2); - pushBoolean(L, true); - } else { - lua_pushnil(L); - } - return 1; -} - -int LuaScriptInterface::luaModalWindowHasPriority(lua_State* L) -{ - // modalWindow:hasPriority() - ModalWindow* window = getUserdata(L, 1); - if (window) { - pushBoolean(L, window->priority); - } else { - lua_pushnil(L); - } - return 1; -} - -int LuaScriptInterface::luaModalWindowSetPriority(lua_State* L) -{ - // modalWindow:setPriority(priority) - ModalWindow* window = getUserdata(L, 1); - if (window) { - window->priority = getBoolean(L, 2); - pushBoolean(L, true); - } else { - lua_pushnil(L); - } - return 1; -} - -int LuaScriptInterface::luaModalWindowSendToPlayer(lua_State* L) -{ - // modalWindow:sendToPlayer(player) - Player* player = getPlayer(L, 2); - if (!player) { - lua_pushnil(L); - return 1; - } - - ModalWindow* window = getUserdata(L, 1); - if (window) { - if (!player->hasModalWindowOpen(window->id)) { - player->sendModalWindow(*window); - } - pushBoolean(L, true); - } else { - lua_pushnil(L); - } - return 1; -} - // Item int LuaScriptInterface::luaItemCreate(lua_State* L) { @@ -6878,7 +6627,6 @@ int LuaScriptInterface::luaCreatureSetMaster(lua_State* L) } pushBoolean(L, true); } - g_game.updateCreatureType(creature); return 1; } @@ -7612,62 +7360,6 @@ int LuaScriptInterface::luaPlayerGetFreeCapacity(lua_State* L) return 1; } -int LuaScriptInterface::luaPlayerGetReward(lua_State* L) -{ - // player:getReward(rewardId[, autoCreate = false]) - Player* player = getUserdata(L, 1); - if (!player) { - lua_pushnil(L); - return 1; - } - - uint32_t rewardId = getNumber(L, 2); - bool autoCreate = getBoolean(L, 3, false); - if (Reward* reward = player->getReward(rewardId, autoCreate)) { - pushUserdata(L, reward); - setItemMetatable(L, -1, reward); - } - else { - pushBoolean(L, false); - } - return 1; -} - -int LuaScriptInterface::luaPlayerRemoveReward(lua_State* L) -{ - // player:removeReward(rewardId) - Player* player = getUserdata(L, 1); - if (!player) { - lua_pushnil(L); - return 1; - } - - uint32_t rewardId = getNumber(L, 2); - player->removeReward(rewardId); - pushBoolean(L, true); - return 1; -} - -int LuaScriptInterface::luaPlayerGetRewardList(lua_State* L) -{ - // player:getRewardList(rewardId) - Player* player = getUserdata(L, 1); - if (!player) { - lua_pushnil(L); - return 1; - } - - auto rewardVec = player->getRewardList(); - lua_createtable(L, rewardVec.size(), 0); - - int index = 0; - for (const auto& rewardId : rewardVec) { - lua_pushnumber(L, rewardId); - lua_rawseti(L, -2, ++index); - } - return 1; -} - int LuaScriptInterface::luaPlayerGetDepotChest(lua_State* L) { // player:getDepotChest(depotId[, autoCreate = false]) @@ -7689,25 +7381,6 @@ int LuaScriptInterface::luaPlayerGetDepotChest(lua_State* L) return 1; } -int LuaScriptInterface::luaPlayerGetInbox(lua_State* L) -{ - // player:getInbox() - Player* player = getUserdata(L, 1); - if (!player) { - lua_pushnil(L); - return 1; - } - - Inbox* inbox = player->getInbox(); - if (inbox) { - pushUserdata(L, inbox); - setItemMetatable(L, -1, inbox); - } else { - pushBoolean(L, false); - } - return 1; -} - int LuaScriptInterface::luaPlayerGetSkullTime(lua_State* L) { // player:getSkullTime() @@ -8667,21 +8340,8 @@ int LuaScriptInterface::luaPlayerShowTextDialog(lua_State* L) int LuaScriptInterface::luaPlayerSendTextMessage(lua_State* L) { - // player:sendTextMessage(type, text[, position, primaryValue = 0, primaryColor = TEXTCOLOR_NONE[, secondaryValue = 0, secondaryColor = TEXTCOLOR_NONE]]) - int parameters = lua_gettop(L); - + // player:sendTextMessage(type, text) TextMessage message(getNumber(L, 2), getString(L, 3)); - if (parameters >= 6) { - message.position = getPosition(L, 4); - message.primary.value = getNumber(L, 5); - message.primary.color = getNumber(L, 6); - } - - if (parameters >= 8) { - message.secondary.value = getNumber(L, 7); - message.secondary.color = getNumber(L, 8); - } - Player* player = getUserdata(L, 1); if (player) { player->sendTextMessage(message); @@ -8720,7 +8380,7 @@ int LuaScriptInterface::luaPlayerSendPrivateMessage(lua_State* L) const Player* speaker = getUserdata(L, 2); const std::string& text = getString(L, 3); - SpeakClasses type = getNumber(L, 4, TALKTYPE_PRIVATE_FROM); + SpeakClasses type = getNumber(L, 4, TALKTYPE_PRIVATE); player->sendPrivateMessage(speaker, type, text); pushBoolean(L, true); return 1; @@ -9253,14 +8913,14 @@ int LuaScriptInterface::luaPlayerSetGhostMode(lua_State* L) if (player->isInGhostMode()) { for (const auto& it : g_game.getPlayers()) { if (!it.second->isAccessPlayer()) { - it.second->notifyStatusChange(player, VIPSTATUS_OFFLINE); + it.second->notifyStatusChange(player, false); } } IOLoginData::updateOnlineStatus(player->getGUID(), false); } else { for (const auto& it : g_game.getPlayers()) { if (!it.second->isAccessPlayer()) { - it.second->notifyStatusChange(player, VIPSTATUS_ONLINE); + it.second->notifyStatusChange(player, true); } } IOLoginData::updateOnlineStatus(player->getGUID(), true); @@ -9658,28 +9318,6 @@ int LuaScriptInterface::luaNpcSetMasterPos(lua_State* L) return 1; } -int LuaScriptInterface::luaNpcGetSpeechBubble(lua_State* L) -{ - // npc:getSpeechBubble() - Npc* npc = getUserdata(L, 1); - if (npc) { - lua_pushnumber(L, npc->getSpeechBubble()); - } else { - lua_pushnil(L); - } - return 1; -} - -int LuaScriptInterface::luaNpcSetSpeechBubble(lua_State* L) -{ - // npc:setSpeechBubble(speechBubble) - Npc* npc = getUserdata(L, 1); - if (npc) { - npc->setSpeechBubble(getNumber(L, 2)); - } - return 0; -} - // Guild int LuaScriptInterface::luaGuildCreate(lua_State* L) { @@ -10970,14 +10608,21 @@ int LuaScriptInterface::luaCombatCreate(lua_State* L) int LuaScriptInterface::luaCombatSetParameter(lua_State* L) { // combat:setParameter(key, value) - uint32_t value = getNumber(L, 3); - CombatParam_t key = getNumber(L, 2); Combat* combat = getUserdata(L, 1); - if (combat) { - pushBoolean(L, combat->setParam(key, value)); - } else { + if (!combat) { lua_pushnil(L); + return 1; } + + CombatParam_t key = getNumber(L, 2); + uint32_t value; + if (isBoolean(L, 3)) { + value = getBoolean(L, 3) ? 1 : 0; + } else { + value = getNumber(L, 3); + } + combat->setParam(key, value); + pushBoolean(L, true); return 1; } @@ -11466,19 +11111,6 @@ int LuaScriptInterface::luaMonsterTypeIsHealthShown(lua_State* L) return 1; } -int LuaScriptInterface::luaMonsterTypeIsRewardBoss(lua_State* L) -{ - // monsterType:isRewardBoss() - MonsterType* monsterType = getUserdata(L, 1); - if (monsterType) { - pushBoolean(L, monsterType->isRewardBoss); - } - else { - lua_pushnil(L); - } - return 1; -} - int LuaScriptInterface::luaMonsterTypeCanPushItems(lua_State* L) { // monsterType:canPushItems() @@ -11711,7 +11343,7 @@ int LuaScriptInterface::luaMonsterTypeGetLoot(lua_State* L) int index = 0; for (const auto& lootBlock : lootList) { - lua_createtable(L, 0, 8); + lua_createtable(L, 0, 7); setField(L, "itemId", lootBlock.id); setField(L, "chance", lootBlock.chance); @@ -11719,8 +11351,6 @@ int LuaScriptInterface::luaMonsterTypeGetLoot(lua_State* L) setField(L, "maxCount", lootBlock.countmax); setField(L, "actionId", lootBlock.actionId); setField(L, "text", lootBlock.text); - pushBoolean(L, lootBlock.unique); - lua_setfield(L, -2, "unique"); parseLoot(lootBlock.childLoot); lua_setfield(L, -2, "childLoot"); diff --git a/path_8_7/src/luascript.h b/path_8_7/src/luascript.h index 59eec5f0e..221339fcd 100644 --- a/path_8_7/src/luascript.h +++ b/path_8_7/src/luascript.h @@ -358,7 +358,7 @@ class LuaScriptInterface // Is inline static bool isNumber(lua_State* L, int32_t arg) { - return lua_isnumber(L, arg) != 0; + return lua_type(L, arg) == LUA_TNUMBER; } inline static bool isString(lua_State* L, int32_t arg) { @@ -693,6 +693,7 @@ class LuaScriptInterface static int luaItemGetAttribute(lua_State* L); static int luaItemSetAttribute(lua_State* L); static int luaItemRemoveAttribute(lua_State* L); + static int luaItemSerializeAttributes(lua_State* L); static int luaItemMoveTo(lua_State* L); static int luaItemTransform(lua_State* L); diff --git a/path_8_7/src/monster.cpp b/path_8_7/src/monster.cpp index e9368f84c..ae603cb34 100644 --- a/path_8_7/src/monster.cpp +++ b/path_8_7/src/monster.cpp @@ -608,7 +608,7 @@ BlockType_t Monster::blockHit(Creature* attacker, CombatType_t combatType, int32 damage = static_cast(std::ceil(damage * ((100 - elementMod) / 100.))); if (damage <= 0) { damage = 0; - blockType = BLOCK_DEFENSE; + blockType = BLOCK_ARMOR; } } } diff --git a/path_8_7/src/networkmessage.cpp b/path_8_7/src/networkmessage.cpp index bfb812f70..531ed872b 100644 --- a/path_8_7/src/networkmessage.cpp +++ b/path_8_7/src/networkmessage.cpp @@ -23,10 +23,6 @@ #include "container.h" #include "creature.h" -#include "player.h" - -#include "position.h" -#include "rsa.h" int32_t NetworkMessage::decodeHeader() { diff --git a/path_8_7/src/npc.cpp b/path_8_7/src/npc.cpp index 5790aa8a5..25728632c 100644 --- a/path_8_7/src/npc.cpp +++ b/path_8_7/src/npc.cpp @@ -21,12 +21,7 @@ #include "npc.h" #include "game.h" -#include "tools.h" -#include "position.h" -#include "player.h" -#include "spawn.h" #include "pugicast.h" -#include "luascript.h" extern Game g_game; extern LuaEnvironment g_luaEnvironment; diff --git a/path_8_7/src/player.cpp b/path_8_7/src/player.cpp index ab23cb598..2577c1be7 100644 --- a/path_8_7/src/player.cpp +++ b/path_8_7/src/player.cpp @@ -31,7 +31,6 @@ #include "iologindata.h" #include "monster.h" #include "movement.h" -#include "outputmessage.h" #include "scheduler.h" #include "weapons.h" @@ -1926,7 +1925,7 @@ BlockType_t Player::blockHit(Creature* attacker, CombatType_t combatType, int32_ if (damage <= 0) { damage = 0; - blockType = BLOCK_DEFENSE; + blockType = BLOCK_ARMOR; } } return blockType; diff --git a/path_8_7/src/protocolold.cpp b/path_8_7/src/protocolold.cpp index a68e857b2..319f40247 100644 --- a/path_8_7/src/protocolold.cpp +++ b/path_8_7/src/protocolold.cpp @@ -21,7 +21,6 @@ #include "protocolold.h" #include "outputmessage.h" -#include "tasks.h" #include "game.h" diff --git a/path_8_7/src/protocolstatus.cpp b/path_8_7/src/protocolstatus.cpp index 18e517acf..afb1a722b 100644 --- a/path_8_7/src/protocolstatus.cpp +++ b/path_8_7/src/protocolstatus.cpp @@ -22,11 +22,7 @@ #include "protocolstatus.h" #include "configmanager.h" #include "game.h" -#include "connection.h" -#include "networkmessage.h" #include "outputmessage.h" -#include "tools.h" -#include "tasks.h" extern ConfigManager g_config; extern Game g_game; diff --git a/path_8_7/src/rsa.cpp b/path_8_7/src/rsa.cpp index dadb42d88..32d77e690 100644 --- a/path_8_7/src/rsa.cpp +++ b/path_8_7/src/rsa.cpp @@ -72,7 +72,7 @@ void RSA::setKey(const char* pString, const char* qString) mpz_clear(e); } -void RSA::decrypt(char* msg) const +void RSA::decrypt(char* msg) const { mpz_t c, m; mpz_init2(c, 1024); diff --git a/path_8_7/src/server.cpp b/path_8_7/src/server.cpp index 4140e6515..3fb3f6126 100644 --- a/path_8_7/src/server.cpp +++ b/path_8_7/src/server.cpp @@ -28,7 +28,7 @@ extern ConfigManager g_config; Ban g_bans; -ServiceManager::ServiceManager(): +ServiceManager::ServiceManager(): death_timer(io_service), running(false) { diff --git a/path_8_7/src/spells.cpp b/path_8_7/src/spells.cpp index 3cd792a99..7cee57192 100644 --- a/path_8_7/src/spells.cpp +++ b/path_8_7/src/spells.cpp @@ -607,11 +607,8 @@ bool Spell::configureSpell(const pugi::xml_node& node) int32_t vocationId = g_vocations.getVocationId(attr.as_string()); if (vocationId != -1) { - vocSpellMap[vocationId] = true; - int32_t promotedVocation = g_vocations.getPromotedVocation(vocationId); - if (promotedVocation != VOCATION_NONE) { - vocSpellMap[promotedVocation] = true; - } + attr = vocationNode.attribute("showInDescription"); + vocSpellMap[vocationId] = !attr || attr.as_bool(); } else { std::cout << "[Warning - Spell::configureSpell] Wrong vocation name: " << attr.as_string() << std::endl; } @@ -2041,4 +2038,4 @@ bool RuneSpell::executeCastSpell(Creature* creature, const LuaVariant& var, bool LuaScriptInterface::pushBoolean(L, isHotkey); return m_scriptInterface->callFunction(3); -} \ No newline at end of file +} diff --git a/path_8_7/src/tile.cpp b/path_8_7/src/tile.cpp index f05240d16..57e518ffa 100644 --- a/path_8_7/src/tile.cpp +++ b/path_8_7/src/tile.cpp @@ -29,7 +29,6 @@ #include "mailbox.h" #include "monster.h" #include "movement.h" -#include "player.h" #include "teleport.h" #include "trashholder.h" diff --git a/path_8_7/vc14/theforgottenserver.sln b/path_8_7/vc14/theforgottenserver.sln index 4de22538c..4c37956c6 100644 --- a/path_8_7/vc14/theforgottenserver.sln +++ b/path_8_7/vc14/theforgottenserver.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2013 -VisualStudioVersion = 12.0.21005.1 +# Visual Studio 14 +VisualStudioVersion = 14.0.23107.0 MinimumVisualStudioVersion = 10.0.40219.1 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "theforgottenserver", "theforgottenserver.vcxproj", "{A10F9657-129F-0FEF-14CB-CEE0B0E5AA3E}" EndProject