Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Guildhalls and guild bank. #2214

Closed
wants to merge 36 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
d76dc5a
Schema and Lua migrations for guild halls and guild bank.
Znote Mar 25, 2017
6e6ba52
Better SQL structure for the guild_transactions table.
Znote Mar 26, 2017
c681f48
Resolve conflicts
Znote Nov 3, 2019
16336b6
Merge with master and resolve conflicts
Znote Nov 3, 2019
bba6f97
Revert filename change back to 19.lua
Znote Nov 3, 2019
82a14dc
Correct merge mistakes
Znote Nov 3, 2019
5748c4f
Rename migration to 25.
Znote Nov 3, 2019
b534426
Merge remote-tracking branch 'otland/master' into 2213
Znote Jun 18, 2020
6814711
Database: Changed tinyint to enum and two column names.
Znote Jun 18, 2020
432b273
Add houses.type column after houses.id
Znote Jun 18, 2020
711321b
Marked 4 houses as guildhalls.
Znote Jun 18, 2020
b6372dd
Added house type enum and propagate house type to database
Znote Jun 18, 2020
c52c6ba
MySQL Enum value WITHDRAW instead of WITHDRAWAL
Znote Jun 18, 2020
5873ec4
House::updateDoorDescription() distinguishes houses from guildhalls.
Znote Jun 18, 2020
025048b
Store bank balance and owner guid in guild object
Znote Jun 19, 2020
c54674a
House::setOwner and House::payHouses adjusted to accomodate guildhalls
Znote Jun 19, 2020
8a31f60
Push false if house:setOwnerGuid(guid) fails to find guild_id if hous…
Znote Jun 19, 2020
f9eab57
Updating balance of a guild will also update the database
Znote Jun 19, 2020
c59f671
Guild leaders and vice-leaders now has access to walk into their guil…
Znote Jun 19, 2020
2887b0d
fix house permissions
Znote Jun 19, 2020
f1530b2
Lua functions
Znote Jun 21, 2020
8605666
feedback optimizations: (sql and source)
Znote Jun 22, 2020
33ceac0
Uppercase unsigned in sql statements
Znote Jun 22, 2020
a1f9a72
Guild Bank NPC
Znote Jun 22, 2020
bb7858a
guild_transactions, receipt support
Znote Jun 23, 2020
168a0e0
New column names, new column category, NPC allows transfers between g…
Znote Jun 29, 2020
e8905dd
Swap calc logic for paidUntil to be more human readable
Znote Jul 12, 2020
8d6fa83
Implements houseId for guilds
Znote Jul 12, 2020
3ee2f37
buyhouse.lua support guildhall purchase.
Znote Jul 12, 2020
a355019
Merge branch 'master' into 2213
Znote Jul 12, 2020
852b901
Must be guild leader to buy guildhall.
Znote Jul 12, 2020
1625491
buyhouse: review feedback, eye friendly code
Znote Jul 13, 2020
d11e44d
Sell guildhall support (untested)
Znote Jul 13, 2020
d8bf253
Revert outdated migrations
Znote Nov 15, 2020
216ff40
Merge remote-tracking branch 'otland/master' into 2213
Znote Nov 15, 2020
2dc848f
Updated migrations
Znote Nov 15, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion data/migrations/19.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
function onUpdateDatabase()
return false
print("> Updating database to version 20 (guildhalls, guild banks #2213)")
db.query("ALTER TABLE `houses` ADD `type` TINYINT(3) NOT NULL DEFAULT '0'")
db.query("ALTER TABLE `guilds` ADD `balance` bigint(20) unsigned NOT NULL DEFAULT '0'")
db.query("CREATE TABLE IF NOT EXISTS `guild_transactions` (`id` int(11) NOT NULL AUTO_INCREMENT, `guild_id` int(11) NOT NULL, `to_guild_id` int(11) DEFAULT NULL, `player_id` int(11) DEFAULT NULL, `type` TINYINT(3) NOT NULL, `balance` bigint(20) unsigned NOT NULL DEFAULT '0', `time` bigint(20) NOT NULL, PRIMARY KEY (`id`), FOREIGN KEY (`guild_id`) REFERENCES `guilds`(`id`) ON DELETE CASCADE) ENGINE=InnoDB")
return true
end
3 changes: 3 additions & 0 deletions data/migrations/20.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
function onUpdateDatabase()
return false
end
16 changes: 15 additions & 1 deletion schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,26 @@ CREATE TABLE IF NOT EXISTS `guilds` (
`name` varchar(255) NOT NULL,
`ownerid` int(11) NOT NULL,
`creationdata` int(11) NOT NULL,
`balance` bigint(20) unsigned NOT NULL DEFAULT '0',
`motd` varchar(255) NOT NULL DEFAULT '',
PRIMARY KEY (`id`),
UNIQUE KEY (`name`),
UNIQUE KEY (`ownerid`),
FOREIGN KEY (`ownerid`) REFERENCES `players`(`id`) ON DELETE CASCADE
) ENGINE=InnoDB;

CREATE TABLE IF NOT EXISTS `guild_transactions` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`guild_id` int(11) NOT NULL,
`to_guild_id` int(11) DEFAULT NULL,
`player_id` int(11) DEFAULT NULL,
Znote marked this conversation as resolved.
Show resolved Hide resolved
`type` TINYINT(3) NOT NULL,
`balance` bigint(20) unsigned NOT NULL DEFAULT '0',
Znote marked this conversation as resolved.
Show resolved Hide resolved
`time` bigint(20) NOT NULL,
PRIMARY KEY (`id`),
FOREIGN KEY (`guild_id`) REFERENCES `guilds`(`id`) ON DELETE CASCADE
) ENGINE=InnoDB;

CREATE TABLE IF NOT EXISTS `guild_invites` (
`player_id` int(11) NOT NULL DEFAULT '0',
`guild_id` int(11) NOT NULL DEFAULT '0',
Expand Down Expand Up @@ -207,6 +220,7 @@ CREATE TABLE IF NOT EXISTS `houses` (
`highest_bidder` int(11) NOT NULL DEFAULT '0',
`size` int(11) NOT NULL DEFAULT '0',
`beds` int(11) NOT NULL DEFAULT '0',
`type` TINYINT(3) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
KEY `owner` (`owner`),
KEY `town_id` (`town_id`)
Expand Down Expand Up @@ -322,7 +336,7 @@ CREATE TABLE IF NOT EXISTS `server_config` (
PRIMARY KEY `config` (`config`)
) ENGINE=InnoDB;

INSERT INTO `server_config` (`config`, `value`) VALUES ('db_version', '19'), ('motd_hash', ''), ('motd_num', '0'), ('players_record', '0');
INSERT INTO `server_config` (`config`, `value`) VALUES ('db_version', '20'), ('motd_hash', ''), ('motd_num', '0'), ('players_record', '0');

CREATE TABLE IF NOT EXISTS `tile_store` (
`house_id` int(11) NOT NULL,
Expand Down