From 5d73a7cd8a723ef55dcc0e2ccd7baf131e1e039a Mon Sep 17 00:00:00 2001 From: kokekanon Date: Sun, 21 Apr 2024 22:40:46 -0400 Subject: [PATCH] update lua --- README.md | 28 +++++++- data/monster/monsters/orc.xml | 2 +- data/scripts/OTCMEHAH/Attachedeffect.lua | 92 ++++++++++++++++++++++++ 3 files changed, 120 insertions(+), 2 deletions(-) create mode 100644 data/scripts/OTCMEHAH/Attachedeffect.lua diff --git a/README.md b/README.md index 35ff9db..da6a43f 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,17 @@ If you need help, please visit the [support forum on OTLand](https://otland.net/ We use the [issue tracker on GitHub](https://github.com/otland/forgottenserver/issues). Keep in mind that everyone who is watching the repository gets notified by e-mail when there is activity, so be thoughtful and avoid writing comments that aren't meaningful for an issue (e.g. "+1"). If you'd like for an issue to be fixed faster, you should either fix it yourself and submit a pull request, or place a bounty on the issue. - +Client: +```lua +g_game.enableFeature(GameWingsAurasEffectsShader) +g_game.enableFeature(GameFormatCreatureName) +g_game.enableFeature(GameCreatureShader) +g_game.enableFeature(GameCreatureAttachedEffect) +g_game.enableFeature(GameItemShader) +g_game.enableFeature(GameItemTooltipV8); +``` +DATA BASE +```sql ALTER TABLE `players` ADD COLUMN `currentwing` smallint UNSIGNED NOT NULL DEFAULT '0', ADD COLUMN `randomizewing` tinyint NOT NULL DEFAULT '0', @@ -27,8 +37,21 @@ ADD COLUMN `currenteffect` smallint UNSIGNED NOT NULL DEFAULT '0', ADD COLUMN `randomizeeffect` tinyint NOT NULL DEFAULT '0', ADD COLUMN `currentshader` smallint UNSIGNED NOT NULL DEFAULT '0', ADD COLUMN `randomizeshader` tinyint NOT NULL DEFAULT '0'; +``` +```sql +ALTER TABLE `players` +ADD COLUMN `currentwing` smallint UNSIGNED NOT NULL DEFAULT '0', +ADD COLUMN `randomizewing` tinyint NOT NULL DEFAULT '0', +ADD COLUMN `currentaura` smallint UNSIGNED NOT NULL DEFAULT '0', +ADD COLUMN `randomizeaura` tinyint NOT NULL DEFAULT '0', +ADD COLUMN `currenteffect` smallint UNSIGNED NOT NULL DEFAULT '0', +ADD COLUMN `randomizeeffect` tinyint NOT NULL DEFAULT '0', +ADD COLUMN `currentshader` smallint UNSIGNED NOT NULL DEFAULT '0', +ADD COLUMN `randomizeshader` tinyint NOT NULL DEFAULT '0'; +``` +```sql CREATE TABLE IF NOT EXISTS `player_wings` ( `player_id` int NOT NULL DEFAULT '0', `wing_id` smallint unsigned NOT NULL DEFAULT '0', @@ -56,3 +79,6 @@ CREATE TABLE IF NOT EXISTS `player_shaders` ( PRIMARY KEY (`player_id`, `shader_id`), FOREIGN KEY (`player_id`) REFERENCES `players`(`id`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARACTER SET=utf8; +``` + +![img](https://github.com/Nottinghster/otclient/assets/114332266/782e0fcf-b1cf-451e-b102-d7e7943bd50b) \ No newline at end of file diff --git a/data/monster/monsters/orc.xml b/data/monster/monsters/orc.xml index 80fc57b..47c523e 100644 --- a/data/monster/monsters/orc.xml +++ b/data/monster/monsters/orc.xml @@ -1,5 +1,5 @@ - + diff --git a/data/scripts/OTCMEHAH/Attachedeffect.lua b/data/scripts/OTCMEHAH/Attachedeffect.lua new file mode 100644 index 0000000..e55ce3f --- /dev/null +++ b/data/scripts/OTCMEHAH/Attachedeffect.lua @@ -0,0 +1,92 @@ +local mehah = { + talkactions = { + attacheffect = "!attacheffect", + detachEffect = "!detacheffect", + playerSetShader = "!playerSetShader", + itemSetShader = "!itemSetShader", + mapShader = "!mapShader" + }, +} + +local events = {} + +local function processCommand(player, words, param, type, action) + if not player:getGroup():getAccess() or player:getAccountType() < ACCOUNT_TYPE_GOD then + player:sendCancelMessage("No tienes acceso a este comando.") + return false + end + + local params, arg + if param:find("\"") then + params = { param:match("\"(.+)\",*(.*)") } + arg = params[1] + print(params) + print(arg) + pdump(params) + else + params = param:split(", ") + arg = params[1] + print("2",params) + print("2",arg) + end + + if not arg then + player:sendCancelMessage("Parámetro inválido. Por favor proporciona un argumento válido.") + return false + end + + local creature + if params[2] and params[2] ~= "" then + creature = Player(params[2]) + if not creature then + player:sendCancelMessage("El nombre del jugador proporcionado no es válido.") + return false + end + else + creature = player + end + + action(creature, arg) + return false +end + +local attachEffect = TalkAction(mehah.talkactions.attacheffect) +function attachEffect.onSay(player, words, param, type) + return processCommand(player, words, param, type, function(creature, effect) + creature:attachEffectById(tonumber(effect), false) + end) +end +table.insert(events, attachEffect) + +local detachEffect = TalkAction(mehah.talkactions.detachEffect) +function detachEffect.onSay(player, words, param, type) + return processCommand(player, words, param, type, function(creature, effect) + creature:detachEffectById(tonumber(effect)) + end) +end +table.insert(events, detachEffect) + +local setShader = TalkAction(mehah.talkactions.playerSetShader) +function setShader.onSay(player, words, param, type) + return processCommand(player, words, param, type, function(creature, shader) + creature:setShader(shader) + end) +end +table.insert(events, setShader) + +local mapShader = TalkAction(mehah.talkactions.mapShader) +function mapShader.onSay(player, words, param, type) + return processCommand(player, words, param, type, function(creature, shader) + if creature:getMapShader() ~= shader then + creature:setMapShader(shader, true) + end + end) +end +table.insert(events, mapShader) + +for _, event in ipairs(events) do + event:accountType(ACCOUNT_TYPE_GOD) + event:access(true) + event:separator(" ") + event:register() +end