Skip to content

Conversation

Znote
Copy link
Member

@Znote Znote commented Mar 25, 2017

WIP #2213 Click on issue link for further description.

Edit: 13. Jul 2020: Feature implementation complete!
Edit: 15. Nov 2020: Rebase with master to continue testing

Schema changes

  • houses.type to determine if it is a house or guildhall.
  • guilds.balance to determine the guild balance.
  • guild_transactions table to log transactions between guildmember and the guild, as well as between guilds.
  • Schema version update to 25 27

data folder changes

  • Lua migrations added to reflect schema changes.
  • Changed 4 houses to be flagged as guildhalls.
    image

Engine/C++/Lua changes

  • house:getType() return house type enums. 1 = HOUSE_TYPE_NORMAL, 2 = HOUSE_TYPE_GUILDHALL
  • Update database houses table with house type
  • Modify house owner to no longer be Player guid implicit, but either player.guid or guild.id depending on house type.
  • Create bank NPC to support (unrestricted) deposit to and (restricted) withdraws from guild banks. And (restricted) transfers between guilds.
  • Make bank NPC use guild_transactions and give player receipts for their deposits and withdrawals.

WIP Known issues / todo:

  • Testing rent paying. (might have broken rent/payhouses)?
  • Looking at house doors seems to have inconsistent behavior (Does not always display house data) Edit: Does not seem to be related to this PR, getting same issue with otland/master
  • Testing selling guildhalls with !sellhouse
  • Todo: Transfer funds between guilds Fixed 29.06.2020
  • Todo: guild_transaction table was a bit too ambigious, want to rename the guild columns Fixed 29.06.2020
  • Todo: !buyhouse: account for guild:getBankBalance() and only for guild leaders Fixed 12.07.2020
  • Todo: sell house account for guildhalls Fixed 13.07.2020

as of 10.7 update we have Receipts:
Receipts are pieces of paper which confirm whether or not guild-related transactions were successful, and also provide details about said transactions. There are 2 types of receipts:

Receipt (Fail) - a receipt of a failed transaction
Receipt (Success) - a receipt of a successful transaction

[source]

Postoned for later PR/skipped:

  • Guild War System talk actions #3104 Modify guild_wars to use guild_transactions and guild bank. This is skipped because currently, guild_wars does not have a monetary stake in TFS yet. I consider this a separate feature (monetary stakes for guildwar + integration with guild_transactions).
  • House auction system in Lua #3105 House auction system talkactions (dealing with ongoing bids, reserved balance during bid period, Receipt (fail/success))

@djarek djarek added the feature New feature or functionality label Mar 25, 2017
@djarek djarek added this to the 2.0 milestone Mar 25, 2017
@Znote
Copy link
Member Author

Znote commented Mar 26, 2017

@djarek I would like for this to get into the TFS 1.3 milestone if possible (If we manage to finish it up before then). I don't think the changes are so major that we need to stall it for 2.0.

@djarek
Copy link
Contributor

djarek commented Mar 26, 2017

@Znote
If it's ready before 1.3 we will merge it.

@ranisalt
Copy link
Member

1.3 still has some 2 or 3 months to maturate before release, FYI.

@DSpeichert
Copy link
Member

@Znote migration requires rename.

@ghost
Copy link

ghost commented Nov 3, 2019

as of 10.7 update we have Receipts:
Receipts are pieces of paper which confirm whether or not guild-related transactions were successful, and also provide details about said transactions. There are 2 types of receipts:

Receipt (Fail) - a receipt of a failed transaction
Receipt (Success) - a receipt of a successful transaction

[source]

@ghost ghost mentioned this pull request Apr 11, 2020
@ghost
Copy link

ghost commented May 10, 2020

piece of guild bank code from the user jlcvp from Otserver global I guess:
https://pastebin.com/cFp9GArZ very useful

Znote added a commit that referenced this pull request Jun 16, 2020
These functions were added in order for the upcoming sample `Banker` NPC #2934 and in the future for the guild balance feature #2214 

- function getPlayerDatabaseInfo(name_or_guid)
TFS 1.3 function that queries for player information from the database, returns a table of useful information if success, false if player doesn't exist.

- function isNumber(str)
used in several distros but wasn't there on compat.lua yet
- function Player.transferMoneyTo(self, target, amount)
- function Player.withdrawMoney(self, amount)
- function Player.depositMoney(self, amount)
- function isValidMoney(money)
- function getMoneyCount(string)
- function getMoneyWeight(money)

Co-authored-by: Znote <stefan_brannfjell@live.no>
Znote added 5 commits June 18, 2020 14:46
Based on feedback from ranisalt
Changed to_guild_id to to_guild as the reference guild_id is implicit.
Changed from_guild_id to from_guild as the reference guild_id is implicit.
Changed guild_transactions.type from tinyint to enum to make the meaning more implicit.
Changed houses.type from tinyint to enum to make the meaning more implicit.
Also made the migration itself more human-readable by using Lua multi-line string declaration.
@Znote
Copy link
Member Author

Znote commented Jun 18, 2020

Starting to step lightly into the source code, now the server will update the database with house type (normal house or guildhall) depending on which flags you put on houses in RME.
image

@Znote Znote marked this pull request as draft June 18, 2020 16:03
@ghost
Copy link

ghost commented Jul 12, 2020

oops, there is still the !sellhouse command missing xD

@Znote
Copy link
Member Author

Znote commented Jul 13, 2020

oops, there is still the !sellhouse command missing xD

sellhouse.lua only initiates a house trade between players, what I had to fix was house:startTrade(player, tradePartner) which unfortunately is a source function. :P (had to check house type, make sure both players are in a guild, make sure they are both guild leaders etc...)

ghost
ghost previously approved these changes Jul 13, 2020
Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we are all set to leave the draft phase, so more people can see and test this awesome PR

@Znote Znote marked this pull request as ready for review July 13, 2020 15:30
@DSpeichert DSpeichert requested a review from ranisalt August 24, 2020 02:07
@ranisalt
Copy link
Member

Please merge these database migrations into one

@Znote
Copy link
Member Author

Znote commented Nov 15, 2020

Please merge these database migrations into one

It is only one, I just git stashed and applied it between rebase to catch up to otland/master migration version. What was previously 25.lua is now 27.lua, because another merged PR snagged 25.lua
28.lua returns false in accordance to structure convention and signals the end of migrations. (Until another PR modifies it for their need).

@Znote
Copy link
Member Author

Znote commented Nov 15, 2020

WIP Known issues / todo:

  • Testing rent paying. (might have broken rent/payhouses)?
  • Looking at house doors seems to have inconsistent behavior (Does not always display house data) Edit: Does not seem to be related to this PR, getting same issue with otland/master
  • Testing selling guildhalls with !sellhouse

@Znote Znote added the needs-testing Needs testing with screenshots label Nov 15, 2020
@ranisalt
Copy link
Member

@Znote oops. github notifications pranked me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or functionality needs-testing Needs testing with screenshots
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants