-
-
Notifications
You must be signed in to change notification settings - Fork 659
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: options 'frags' and 'payment' to war system (#1982)
When declaring war, the guild leader chooses their opponent and defines the conditions: duration (from 7 to 180 days), frags limit (up to 1,000), a penalty to be paid in case of loss (up to 2kkk), among others. Based on the information above, we can add the columns "frags_limit," "payment," and "duration_days" to the 'guild wars' table so that the websites can interact correctly according to the system. Resolves #2121
- Loading branch information
Luan Luciano
authored
Mar 1, 2024
1 parent
ca96af8
commit 59b7abd
Showing
7 changed files
with
62 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,12 @@ | ||
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_limit, payment and duration_days in guild wars)") | ||
|
||
db.query([[ | ||
ALTER TABLE `guild_wars` | ||
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 | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
function onUpdateDatabase() | ||
return false -- true = There are others migrations file | false = this is the last migration file | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 3 additions & 2 deletions
5
data-otservbr-global/scripts/globalevents/others/guild_war.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,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, `ended` = " .. time .. " WHERE `status` = 1 AND `ended` != 0 AND `ended` < " .. time) | ||
return true | ||
end | ||
|
||
guildWar:interval(100000) | ||
guildWar:interval(60000) | ||
guildWar:register() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters