-
Notifications
You must be signed in to change notification settings - Fork 45
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
feat (core\db): Server Mail Reward System #162
Merged
seobryn
merged 1 commit into
FirelandsProject:master
from
acidmanifesto:server-mail-reward-system
Aug 30, 2023
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
data/sql/updates/pending_db_characters/rev_1693343760497114600.sql
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,23 @@ | ||
DROP TABLE IF EXISTS `mail_server_character`; | ||
CREATE TABLE IF NOT EXISTS `mail_server_character` ( | ||
`guid` INT UNSIGNED NOT NULL, | ||
`mailId` INT UNSIGNED NOT NULL, | ||
PRIMARY KEY (`guid`, `mailId`) | ||
) ENGINE=INNODB DEFAULT CHARSET=UTF8MB4; | ||
|
||
DROP TABLE IF EXISTS `mail_server_template`; | ||
CREATE TABLE IF NOT EXISTS `mail_server_template` ( | ||
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT, | ||
`reqLevel` TINYINT UNSIGNED NOT NULL DEFAULT '0', | ||
`reqPlayTime` INT UNSIGNED NOT NULL DEFAULT '0', | ||
`moneyA` INT UNSIGNED NOT NULL DEFAULT '0', | ||
`moneyH` INT UNSIGNED NOT NULL DEFAULT '0', | ||
`itemA` INT UNSIGNED NOT NULL DEFAULT '0', | ||
`itemCountA` INT UNSIGNED NOT NULL DEFAULT '0', | ||
`itemH` INT UNSIGNED NOT NULL DEFAULT '0', | ||
`itemCountH` INT UNSIGNED NOT NULL DEFAULT '0', | ||
`subject` TEXT NOT NULL, | ||
`body` TEXT NOT NULL, | ||
`active` TINYINT UNSIGNED NOT NULL DEFAULT '1', | ||
PRIMARY KEY (`id`) | ||
) ENGINE=INNODB DEFAULT CHARSET=UTF8MB4; |
3 changes: 3 additions & 0 deletions
3
data/sql/updates/pending_db_world/rev_1693344185076263500.sql
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 @@ | ||
DELETE FROM `command` WHERE `name`='reload mail_server_template'; | ||
INSERT INTO `command` (`name`, `help`) VALUES | ||
('reload mail_server_template', 'Syntax: .reload mail_server_template\nReload server_mail_template table.'); |
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
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
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
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,57 @@ | ||
/* | ||
* This file is part of the FirelandsCore Project. See AUTHORS file for Copyright information | ||
* | ||
* This program is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU Affero General Public License as published by the | ||
* Free Software Foundation; either version 2 of the License, or (at your | ||
* option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for | ||
* more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License along | ||
* with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#include "DatabaseEnv.h" | ||
#include "ObjectMgr.h" | ||
#include "Player.h" | ||
#include "QueryResult.h" | ||
#include "ScriptMgr.h" | ||
#include "WorldSession.h" | ||
|
||
class ServerMailReward : public PlayerScript | ||
{ | ||
public: | ||
ServerMailReward() : PlayerScript("ServerMailReward") {} | ||
|
||
// CHARACTER_LOGIN = 8 | ||
void OnLogin(Player* player, bool /*firstLogin*/) | ||
{ | ||
for (auto const& servMail : sObjectMgr->GetAllServerMailStore()) | ||
{ | ||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_MAIL_SERVER_CHARACTER); | ||
stmt->setUInt32(0, player->GetGUID().GetCounter()); | ||
stmt->setUInt32(1, servMail.second.id); | ||
|
||
WorldSession* mySess = player->GetSession(); | ||
mySess->GetQueryProcessor().AddCallback(CharacterDatabase.AsyncQuery(stmt).WithPreparedCallback( | ||
[mySess, servMail](PreparedQueryResult result) | ||
{ | ||
if (!result) | ||
{ | ||
sObjectMgr->SendServerMail(mySess->GetPlayer(), servMail.second.id, servMail.second.reqLevel, servMail.second.reqPlayTime, servMail.second.moneyA, servMail.second.moneyH, | ||
servMail.second.itemA, servMail.second.itemCountA, servMail.second.itemH, servMail.second.itemCountH, servMail.second.subject, servMail.second.body, | ||
servMail.second.active); | ||
} | ||
})); | ||
} | ||
} | ||
}; | ||
|
||
void AddSC_server_mail() | ||
{ | ||
new ServerMailReward(); | ||
} |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a dupe line. Its a world script not a player script on in the solution