From c750e034d1e0229db66202a315ca06cc77e6c844 Mon Sep 17 00:00:00 2001 From: Luan Luciano Date: Tue, 5 Dec 2023 15:49:24 -0300 Subject: [PATCH 01/17] Update schema.sql --- schema.sql | 2 ++ 1 file changed, 2 insertions(+) diff --git a/schema.sql b/schema.sql index 3ba4e35effc..7a1bfccc9ff 100644 --- a/schema.sql +++ b/schema.sql @@ -315,6 +315,8 @@ CREATE TABLE IF NOT EXISTS `guild_wars` ( `status` tinyint(2) NOT NULL DEFAULT '0', `started` bigint(15) NOT NULL DEFAULT '0', `ended` bigint(15) NOT NULL DEFAULT '0', + `frags` tinyint(3) UNSIGNED NOT NULL DEFAULT '0', + `payment` bigint(20) UNSIGNED NOT NULL DEFAULT '0', INDEX `guild1` (`guild1`), INDEX `guild2` (`guild2`), CONSTRAINT `guild_wars_pk` PRIMARY KEY (`id`) From 427f511734f3eb394d0c11ea94f1f4b00adfa93c Mon Sep 17 00:00:00 2001 From: Luan Luciano Date: Tue, 5 Dec 2023 15:58:10 -0300 Subject: [PATCH 02/17] UPDATE --- data-otservbr-global/migrations/41.lua | 4 ++-- data-otservbr-global/migrations/42.lua | 10 +++++++++- data-otservbr-global/migrations/43.lua | 3 +++ 3 files changed, 14 insertions(+), 3 deletions(-) create mode 100644 data-otservbr-global/migrations/43.lua diff --git a/data-otservbr-global/migrations/41.lua b/data-otservbr-global/migrations/41.lua index 179ac18b574..15eb1d88e99 100644 --- a/data-otservbr-global/migrations/41.lua +++ b/data-otservbr-global/migrations/41.lua @@ -3,8 +3,8 @@ function onUpdateDatabase() db.query([[ ALTER TABLE `players` - MODIFY `xpboost_stamina` smallint(5) UNSIGNED DEFAULT NULL, - MODIFY `xpboost_value` tinyint(4) UNSIGNED DEFAULT NULL + MODIFY `xpboost_stamina` smallint(5) UNSIGNED DEFAULT NULL, + MODIFY `xpboost_value` tinyint(4) UNSIGNED DEFAULT NULL ]]) return true diff --git a/data-otservbr-global/migrations/42.lua b/data-otservbr-global/migrations/42.lua index 86a6d8ffec1..f9dcebda845 100644 --- a/data-otservbr-global/migrations/42.lua +++ b/data-otservbr-global/migrations/42.lua @@ -1,3 +1,11 @@ function onUpdateDatabase() - return false -- true = There are others migrations file | false = this is the last migration file + logger.info("Updating database to version 43 (feat frags and payment in war system)") + + db.query([[ + ALTER TABLE `guild_wars` + ADD `frags` tinyint(3) UNSIGNED NOT NULL DEFAULT '0', + ADD `payment` bigint(20) UNSIGNED NOT NULL DEFAULT '0' + ]]) + + return true end diff --git a/data-otservbr-global/migrations/43.lua b/data-otservbr-global/migrations/43.lua new file mode 100644 index 00000000000..86a6d8ffec1 --- /dev/null +++ b/data-otservbr-global/migrations/43.lua @@ -0,0 +1,3 @@ +function onUpdateDatabase() + return false -- true = There are others migrations file | false = this is the last migration file +end From d0ed7dc1dc35d462ff43ed68754db7de6c49a5b8 Mon Sep 17 00:00:00 2001 From: Luan Luciano Date: Tue, 5 Dec 2023 15:59:34 -0300 Subject: [PATCH 03/17] Update schema.sql --- schema.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/schema.sql b/schema.sql index 7a1bfccc9ff..f68c30d305b 100644 --- a/schema.sql +++ b/schema.sql @@ -7,7 +7,7 @@ CREATE TABLE IF NOT EXISTS `server_config` ( CONSTRAINT `server_config_pk` PRIMARY KEY (`config`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -INSERT INTO `server_config` (`config`, `value`) VALUES ('db_version', '41'), ('motd_hash', ''), ('motd_num', '0'), ('players_record', '0'); +INSERT INTO `server_config` (`config`, `value`) VALUES ('db_version', '43'), ('motd_hash', ''), ('motd_num', '0'), ('players_record', '0'); -- Table structure `accounts` CREATE TABLE IF NOT EXISTS `accounts` ( From 2fd0b520e15917999301e2a673a718be73be58d9 Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Wed, 13 Dec 2023 06:53:02 +0000 Subject: [PATCH 04/17] Lua code format - (Stylua) --- data-otservbr-global/migrations/43.lua | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/data-otservbr-global/migrations/43.lua b/data-otservbr-global/migrations/43.lua index 4d5589672aa..31b45997791 100644 --- a/data-otservbr-global/migrations/43.lua +++ b/data-otservbr-global/migrations/43.lua @@ -1,12 +1,11 @@ function onUpdateDatabase() - logger.info("Updating database to version 43 (feat frags and payment in war system)") - - db.query([[ + logger.info("Updating database to version 43 (feat frags and payment in war system)") + + db.query([[ ALTER TABLE `guild_wars` ADD `frags` tinyint(3) UNSIGNED NOT NULL DEFAULT '0', ADD `payment` bigint(20) UNSIGNED NOT NULL DEFAULT '0' ]]) - - return true - end - + + return true +end From 93e3e5642914f26dd29ad7dc5584b0fc981db12c Mon Sep 17 00:00:00 2001 From: Luan Luciano Date: Wed, 13 Dec 2023 03:53:42 -0300 Subject: [PATCH 05/17] Update schema.sql --- schema.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/schema.sql b/schema.sql index 89fef97f7b2..6993c414684 100644 --- a/schema.sql +++ b/schema.sql @@ -7,7 +7,7 @@ CREATE TABLE IF NOT EXISTS `server_config` ( CONSTRAINT `server_config_pk` PRIMARY KEY (`config`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -INSERT INTO `server_config` (`config`, `value`) VALUES ('db_version', '43'), ('motd_hash', ''), ('motd_num', '0'), ('players_record', '0'); +INSERT INTO `server_config` (`config`, `value`) VALUES ('db_version', '44'), ('motd_hash', ''), ('motd_num', '0'), ('players_record', '0'); -- Table structure `accounts` CREATE TABLE IF NOT EXISTS `accounts` ( From acf2d0eefcec6e7c0487c1d325ebc8dfecd8bc10 Mon Sep 17 00:00:00 2001 From: Luan Luciano Date: Fri, 19 Jan 2024 20:33:56 -0300 Subject: [PATCH 06/17] Update guild_war.lua --- .../scripts/globalevents/others/guild_war.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/data-otservbr-global/scripts/globalevents/others/guild_war.lua b/data-otservbr-global/scripts/globalevents/others/guild_war.lua index f34828b1fa7..c036b3b271a 100644 --- a/data-otservbr-global/scripts/globalevents/others/guild_war.lua +++ b/data-otservbr-global/scripts/globalevents/others/guild_war.lua @@ -1,9 +1,10 @@ local guildWar = GlobalEvent("guildwar") + function guildWar.onThink(interval) local time = os.time() - db.query("UPDATE `guild_wars` SET `status` = 4, `ended` = " .. time .. " WHERE `status` = 1 AND (`started` + 5 * 60 * 60) < " .. time) + db.query("UPDATE `guild_wars` SET `status` = 4 WHERE `status` = 1 AND `ended` < " .. time) return true end -guildWar:interval(100000) +guildWar:interval(600000) guildWar:register() From 0314647527642294d3ca86a5fc854e2077f1fec1 Mon Sep 17 00:00:00 2001 From: Luan Luciano Date: Fri, 19 Jan 2024 20:37:26 -0300 Subject: [PATCH 07/17] Update guild_war.lua --- data-otservbr-global/scripts/globalevents/others/guild_war.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data-otservbr-global/scripts/globalevents/others/guild_war.lua b/data-otservbr-global/scripts/globalevents/others/guild_war.lua index c036b3b271a..547d11e9894 100644 --- a/data-otservbr-global/scripts/globalevents/others/guild_war.lua +++ b/data-otservbr-global/scripts/globalevents/others/guild_war.lua @@ -6,5 +6,5 @@ function guildWar.onThink(interval) return true end -guildWar:interval(600000) +guildWar:interval(60000) guildWar:register() From ae8bf1d83c2d833a37b1245547e85a4f0ebc1a2c Mon Sep 17 00:00:00 2001 From: Luan Luciano Date: Fri, 19 Jan 2024 20:51:52 -0300 Subject: [PATCH 08/17] Update player_death.lua --- .../creaturescripts/others/player_death.lua | 48 +++++++++++++++---- 1 file changed, 38 insertions(+), 10 deletions(-) diff --git a/data-otservbr-global/scripts/creaturescripts/others/player_death.lua b/data-otservbr-global/scripts/creaturescripts/others/player_death.lua index 9e8bfbeca34..9c008f33a5b 100644 --- a/data-otservbr-global/scripts/creaturescripts/others/player_death.lua +++ b/data-otservbr-global/scripts/creaturescripts/others/player_death.lua @@ -84,24 +84,52 @@ function playerDeath.onDeath(player, corpse, killer, mostDamageKiller, unjustifi if byPlayer == 1 then local targetGuild = player:getGuild() - targetGuild = targetGuild and targetGuild:getId() or 0 - if targetGuild ~= 0 then + local targetGuildId = targetGuild and targetGuild:getId() or 0 + if targetGuildId ~= 0 then local killerGuild = killer:getGuild() - killerGuild = killerGuild and killerGuild:getId() or 0 - if killerGuild ~= 0 and targetGuild ~= killerGuild and isInWar(player:getId(), killer.uid) then + local killerGuildId = killerGuild and killerGuild:getId() or 0 + if killerGuildId ~= 0 and targetGuildId ~= killerGuildId and isInWar(player:getId(), killer:getId()) then local warId = false resultId = db.storeQuery("SELECT `id` FROM `guild_wars` WHERE `status` = 1 AND \z - ((`guild1` = " .. killerGuild .. " AND `guild2` = " .. targetGuild .. ") OR \z - (`guild1` = " .. targetGuild .. " AND `guild2` = " .. killerGuild .. "))") - if resultId ~= false then + ((`guild1` = " .. killerGuildId .. " AND `guild2` = " .. targetGuildId .. ") OR \z + (`guild1` = " .. targetGuildId .. " AND `guild2` = " .. killerGuildId .. "))") + if resultId then warId = Result.getNumber(resultId, "id") Result.free(resultId) end - if warId ~= false then + if warId then + local playerName = player:getName() db.asyncQuery("INSERT INTO `guildwar_kills` (`killer`, `target`, `killerguild`, `targetguild`, `time`, `warid`) \z - VALUES (" .. db.escapeString(killerName) .. ", " .. db.escapeString(player:getName()) .. ", " .. killerGuild .. ", \z - " .. targetGuild .. ", " .. os.time() .. ", " .. warId .. ")") + VALUES (" .. db.escapeString(killerName) .. ", " .. db.escapeString(playerName) .. ", " .. killerGuildId .. ", \z + " .. targetGuildId .. ", " .. os.time() .. ", " .. warId .. ")") + + resultId = db.storeQuery("SELECT `guild_wars`.`id`, `guild_wars`.`frags`, (SELECT COUNT(1) FROM `guildwar_kills` \z + WHERE `guildwar_kills`.`warid` = `guild_wars`.`id` AND `guildwar_kills`.`killerguild` = `guild_wars`.`guild1`) AS guild1_kills, \z + (SELECT COUNT(1) FROM `guildwar_kills` WHERE `guildwar_kills`.`warid` = `guild_wars`.`id` AND `guildwar_kills`.`killerguild` = `guild_wars`.`guild2`) AS guild2_kills \z + FROM `guild_wars` WHERE (`guild1` = " .. killerGuildId .. " OR `guild2` = " .. killerGuildId .. ") AND `status` = 1 AND `id` = " .. warId) + + if resultId then + local guild1_kills = Result.getNumber(resultId, "guild1_kills") + local guild2_kills = Result.getNumber(resultId, "guild2_kills") + local limit = Result.getNumber(resultId, "frags") + Result.free(resultId) + + local members = killerGuild:getMembersOnline() + for i = 1, #members do + members[i]:sendChannelMessage(members[i], string.format("%s was killed by %s. The new score is: %s %d:%d %s (frags limit: %d)", playerName, killerName, targetGuild:getName(), guild1_kills, guild2_kills, killerGuild:getName(), limit), TALKTYPE_CHANNEL_R1, CHANNEL_GUILD) + end + + local enemyMembers = targetGuild:getMembersOnline() + for i = 1, #enemyMembers do + enemyMembers[i]:sendChannelMessage(enemyMembers[i], string.format("%s was killed by %s. The new score is: %s %d:%d %s (frags limit: %d)", playerName, killerName, targetGuild:getName(), guild1_kills, guild2_kills, killerGuild:getName(), limit), TALKTYPE_CHANNEL_R1, CHANNEL_GUILD) + end + + if guild1_kills >= limit or guild2_kills >= limit then + db.query("UPDATE `guild_wars` SET `status` = 4, `ended` = " .. os.time() .. " WHERE `status` = 1 AND `id` = " .. warId) + Game.broadcastMessage(string.format("%s has just won the war against %s.", killerGuild:getName(), targetGuild:getName())) + end + end end end end From 26c2236d82a92cf044fc7b08d1cda642c6dca26b Mon Sep 17 00:00:00 2001 From: Luan Luciano Date: Sun, 21 Jan 2024 11:16:52 -0300 Subject: [PATCH 09/17] Update guild_war.lua --- data-otservbr-global/scripts/globalevents/others/guild_war.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data-otservbr-global/scripts/globalevents/others/guild_war.lua b/data-otservbr-global/scripts/globalevents/others/guild_war.lua index 547d11e9894..3552d0133ca 100644 --- a/data-otservbr-global/scripts/globalevents/others/guild_war.lua +++ b/data-otservbr-global/scripts/globalevents/others/guild_war.lua @@ -2,7 +2,7 @@ local guildWar = GlobalEvent("guildwar") function guildWar.onThink(interval) local time = os.time() - db.query("UPDATE `guild_wars` SET `status` = 4 WHERE `status` = 1 AND `ended` < " .. time) + db.query("UPDATE `guild_wars` SET `status` = 4 WHERE `status` = 1 AND `ended` != 0 AND `ended` < " .. time) return true end From c3e7a0d837558859c1057cd1f288eb306b375b01 Mon Sep 17 00:00:00 2001 From: Luan Luciano Date: Fri, 26 Jan 2024 00:27:30 -0300 Subject: [PATCH 10/17] Update ioguild.cpp --- src/io/ioguild.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/io/ioguild.cpp b/src/io/ioguild.cpp index 7555c5c0ed8..d5829cad892 100644 --- a/src/io/ioguild.cpp +++ b/src/io/ioguild.cpp @@ -60,7 +60,7 @@ uint32_t IOGuild::getGuildIdByName(const std::string &name) { void IOGuild::getWarList(uint32_t guildId, GuildWarVector &guildWarVector) { std::ostringstream query; - query << "SELECT `guild1`, `guild2` FROM `guild_wars` WHERE (`guild1` = " << guildId << " OR `guild2` = " << guildId << ") AND `ended` = 0 AND `status` = 1"; + query << "SELECT `guild1`, `guild2` FROM `guild_wars` WHERE (`guild1` = " << guildId << " OR `guild2` = " << guildId << ") AND `status` = 1"; DBResult_ptr result = Database::getInstance().storeQuery(query.str()); if (!result) { From 33cc0d3c71794ea057932dffce431034d446f364 Mon Sep 17 00:00:00 2001 From: Luan Luciano Date: Fri, 26 Jan 2024 01:21:14 -0300 Subject: [PATCH 11/17] Update schema.sql --- schema.sql | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/schema.sql b/schema.sql index 6993c414684..de521b3bd5c 100644 --- a/schema.sql +++ b/schema.sql @@ -312,11 +312,12 @@ CREATE TABLE IF NOT EXISTS `guild_wars` ( `guild2` int(11) NOT NULL DEFAULT '0', `name1` varchar(255) NOT NULL, `name2` varchar(255) NOT NULL, - `status` tinyint(2) NOT NULL DEFAULT '0', + `status` tinyint(2) UNSIGNED NOT NULL DEFAULT '0', `started` bigint(15) NOT NULL DEFAULT '0', `ended` bigint(15) NOT NULL DEFAULT '0', - `frags` tinyint(3) UNSIGNED NOT NULL DEFAULT '0', - `payment` bigint(20) UNSIGNED NOT NULL DEFAULT '0', + `frags_limit` smallint(4) UNSIGNED NOT NULL DEFAULT '0', + `payment` bigint(13) UNSIGNED NOT NULL DEFAULT '0', + `duration_days` tinyint(3) UNSIGNED NOT NULL DEFAULT '0', INDEX `guild1` (`guild1`), INDEX `guild2` (`guild2`), CONSTRAINT `guild_wars_pk` PRIMARY KEY (`id`) From 805991b6fc79eccb7501b389e99ba6294ea417a0 Mon Sep 17 00:00:00 2001 From: Luan Luciano Date: Fri, 26 Jan 2024 01:22:13 -0300 Subject: [PATCH 12/17] Update 43.lua --- data-otservbr-global/migrations/43.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/data-otservbr-global/migrations/43.lua b/data-otservbr-global/migrations/43.lua index 31b45997791..93315d2de0a 100644 --- a/data-otservbr-global/migrations/43.lua +++ b/data-otservbr-global/migrations/43.lua @@ -3,8 +3,9 @@ function onUpdateDatabase() db.query([[ ALTER TABLE `guild_wars` - ADD `frags` tinyint(3) UNSIGNED NOT NULL DEFAULT '0', - ADD `payment` bigint(20) UNSIGNED NOT NULL DEFAULT '0' + ADD `frags_limit` smallint(4) UNSIGNED NOT NULL DEFAULT '0', + ADD `payment` bigint(13) UNSIGNED NOT NULL DEFAULT '0', + ADD `duration_days` tinyint(3) UNSIGNED NOT NULL DEFAULT '0' ]]) return true From 1d73864ca1a3c3819d37b10f008ec661b6895de3 Mon Sep 17 00:00:00 2001 From: Luan Luciano Date: Fri, 26 Jan 2024 01:25:36 -0300 Subject: [PATCH 13/17] Update player_death.lua --- .../scripts/creaturescripts/others/player_death.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/data-otservbr-global/scripts/creaturescripts/others/player_death.lua b/data-otservbr-global/scripts/creaturescripts/others/player_death.lua index 9c008f33a5b..bf92727864d 100644 --- a/data-otservbr-global/scripts/creaturescripts/others/player_death.lua +++ b/data-otservbr-global/scripts/creaturescripts/others/player_death.lua @@ -104,7 +104,7 @@ function playerDeath.onDeath(player, corpse, killer, mostDamageKiller, unjustifi VALUES (" .. db.escapeString(killerName) .. ", " .. db.escapeString(playerName) .. ", " .. killerGuildId .. ", \z " .. targetGuildId .. ", " .. os.time() .. ", " .. warId .. ")") - resultId = db.storeQuery("SELECT `guild_wars`.`id`, `guild_wars`.`frags`, (SELECT COUNT(1) FROM `guildwar_kills` \z + resultId = db.storeQuery("SELECT `guild_wars`.`id`, `guild_wars`.`frags_limit`, (SELECT COUNT(1) FROM `guildwar_kills` \z WHERE `guildwar_kills`.`warid` = `guild_wars`.`id` AND `guildwar_kills`.`killerguild` = `guild_wars`.`guild1`) AS guild1_kills, \z (SELECT COUNT(1) FROM `guildwar_kills` WHERE `guildwar_kills`.`warid` = `guild_wars`.`id` AND `guildwar_kills`.`killerguild` = `guild_wars`.`guild2`) AS guild2_kills \z FROM `guild_wars` WHERE (`guild1` = " .. killerGuildId .. " OR `guild2` = " .. killerGuildId .. ") AND `status` = 1 AND `id` = " .. warId) @@ -112,17 +112,17 @@ function playerDeath.onDeath(player, corpse, killer, mostDamageKiller, unjustifi if resultId then local guild1_kills = Result.getNumber(resultId, "guild1_kills") local guild2_kills = Result.getNumber(resultId, "guild2_kills") - local limit = Result.getNumber(resultId, "frags") + local frags_limit = Result.getNumber(resultId, "frags_limit") Result.free(resultId) local members = killerGuild:getMembersOnline() for i = 1, #members do - members[i]:sendChannelMessage(members[i], string.format("%s was killed by %s. The new score is: %s %d:%d %s (frags limit: %d)", playerName, killerName, targetGuild:getName(), guild1_kills, guild2_kills, killerGuild:getName(), limit), TALKTYPE_CHANNEL_R1, CHANNEL_GUILD) + members[i]:sendChannelMessage(members[i], string.format("%s was killed by %s. The new score is: %s %d:%d %s (frags limit: %d)", playerName, killerName, targetGuild:getName(), guild1_kills, guild2_kills, killerGuild:getName(), frags_limit), TALKTYPE_CHANNEL_R1, CHANNEL_GUILD) end local enemyMembers = targetGuild:getMembersOnline() for i = 1, #enemyMembers do - enemyMembers[i]:sendChannelMessage(enemyMembers[i], string.format("%s was killed by %s. The new score is: %s %d:%d %s (frags limit: %d)", playerName, killerName, targetGuild:getName(), guild1_kills, guild2_kills, killerGuild:getName(), limit), TALKTYPE_CHANNEL_R1, CHANNEL_GUILD) + enemyMembers[i]:sendChannelMessage(enemyMembers[i], string.format("%s was killed by %s. The new score is: %s %d:%d %s (frags limit: %d)", playerName, killerName, targetGuild:getName(), guild1_kills, guild2_kills, killerGuild:getName(), frags_limit), TALKTYPE_CHANNEL_R1, CHANNEL_GUILD) end if guild1_kills >= limit or guild2_kills >= limit then From 7358c3fb1241a185f403773fb0d1f2121a06622f Mon Sep 17 00:00:00 2001 From: Luan Luciano Date: Fri, 26 Jan 2024 01:59:00 -0300 Subject: [PATCH 14/17] Update player_death.lua --- .../scripts/creaturescripts/others/player_death.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data-otservbr-global/scripts/creaturescripts/others/player_death.lua b/data-otservbr-global/scripts/creaturescripts/others/player_death.lua index bf92727864d..b848235ebae 100644 --- a/data-otservbr-global/scripts/creaturescripts/others/player_death.lua +++ b/data-otservbr-global/scripts/creaturescripts/others/player_death.lua @@ -125,7 +125,7 @@ function playerDeath.onDeath(player, corpse, killer, mostDamageKiller, unjustifi enemyMembers[i]:sendChannelMessage(enemyMembers[i], string.format("%s was killed by %s. The new score is: %s %d:%d %s (frags limit: %d)", playerName, killerName, targetGuild:getName(), guild1_kills, guild2_kills, killerGuild:getName(), frags_limit), TALKTYPE_CHANNEL_R1, CHANNEL_GUILD) end - if guild1_kills >= limit or guild2_kills >= limit then + if guild1_kills >= frags_limit or guild2_kills >= frags_limit then db.query("UPDATE `guild_wars` SET `status` = 4, `ended` = " .. os.time() .. " WHERE `status` = 1 AND `id` = " .. warId) Game.broadcastMessage(string.format("%s has just won the war against %s.", killerGuild:getName(), targetGuild:getName())) end From 2e626c6f964e230a02df123d05489c5272f98fce Mon Sep 17 00:00:00 2001 From: Luan Luciano Date: Fri, 26 Jan 2024 02:00:42 -0300 Subject: [PATCH 15/17] Update 43.lua --- data-otservbr-global/migrations/43.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data-otservbr-global/migrations/43.lua b/data-otservbr-global/migrations/43.lua index 93315d2de0a..1464703c96e 100644 --- a/data-otservbr-global/migrations/43.lua +++ b/data-otservbr-global/migrations/43.lua @@ -1,5 +1,5 @@ function onUpdateDatabase() - logger.info("Updating database to version 43 (feat frags and payment in war system)") + logger.info("Updating database to version 43 (feat frags_limit, payment and duration_days in guild wars)") db.query([[ ALTER TABLE `guild_wars` From 8811493252f944baf6d58e43b0996ca95d63fb4f Mon Sep 17 00:00:00 2001 From: Luan Luciano Date: Wed, 31 Jan 2024 23:03:51 -0300 Subject: [PATCH 16/17] Update guild_war.lua --- data-otservbr-global/scripts/globalevents/others/guild_war.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data-otservbr-global/scripts/globalevents/others/guild_war.lua b/data-otservbr-global/scripts/globalevents/others/guild_war.lua index 3552d0133ca..1fe55cacd40 100644 --- a/data-otservbr-global/scripts/globalevents/others/guild_war.lua +++ b/data-otservbr-global/scripts/globalevents/others/guild_war.lua @@ -2,7 +2,7 @@ local guildWar = GlobalEvent("guildwar") function guildWar.onThink(interval) local time = os.time() - db.query("UPDATE `guild_wars` SET `status` = 4 WHERE `status` = 1 AND `ended` != 0 AND `ended` < " .. time) + db.query("UPDATE `guild_wars` SET `status` = 4 , `ended` = " .. time .. " WHERE `status` = 1 AND `ended` != 0 AND `ended` < " .. time) return true end From 8afd019013621e1b468f78883f8c6f9b0f61776b Mon Sep 17 00:00:00 2001 From: Luan Luciano Date: Wed, 31 Jan 2024 23:30:40 -0300 Subject: [PATCH 17/17] Update guild_war.lua --- data-otservbr-global/scripts/globalevents/others/guild_war.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data-otservbr-global/scripts/globalevents/others/guild_war.lua b/data-otservbr-global/scripts/globalevents/others/guild_war.lua index 1fe55cacd40..41238755494 100644 --- a/data-otservbr-global/scripts/globalevents/others/guild_war.lua +++ b/data-otservbr-global/scripts/globalevents/others/guild_war.lua @@ -2,7 +2,7 @@ local guildWar = GlobalEvent("guildwar") function guildWar.onThink(interval) local time = os.time() - db.query("UPDATE `guild_wars` SET `status` = 4 , `ended` = " .. time .. " WHERE `status` = 1 AND `ended` != 0 AND `ended` < " .. time) + db.query("UPDATE `guild_wars` SET `status` = 4, `ended` = " .. time .. " WHERE `status` = 1 AND `ended` != 0 AND `ended` < " .. time) return true end