浏览代码

Adds reload attendance database atcommand (#4657)

* Fixes #4656.
* Adds an atcommand option for reloading the attendance database.
* Adds missing headers for attendance database.
* Adds missing reload options in the atcommand configuration.
Thanks to @lelouch22's suggestion!
Aleos 5 年之前
父节点
当前提交
97372ff423
共有 9 个文件被更改,包括 164 次插入22 次删除
  1. 9 0
      conf/atcommands.yml
  2. 4 1
      conf/msg_conf/map_msg.conf
  3. 31 0
      db/attendance.yml
  4. 31 0
      db/import-tmpl/attendance.yml
  5. 31 0
      db/pre-re/attendance.yml
  6. 31 0
      db/re/attendance.yml
  7. 4 0
      src/map/atcommand.cpp
  8. 0 21
      src/map/pc.cpp
  9. 23 0
      src/map/pc.hpp

+ 9 - 0
conf/atcommands.yml

@@ -857,12 +857,21 @@ Body:
     Help: |
       Params: <char name>
       Blow somebody up, including those surrounding them.
+  - Command: reloadachievementdb
+    Help: |
+      Reload achievement database.
   - Command: reloadatcommand
     Help: |
       Reload atcommand settings.
+  - Command: reloadattendancedb
+    Help: |
+      Reload attendance database.
   - Command: reloadbattleconf
     Help: |
       Reload battle settings.
+  - Command: reloadinstancedb
+    Help: |
+      Reload instance database.
   - Command: reloaditemdb
     Help: |
       Reload item database.

+ 4 - 1
conf/msg_conf/map_msg.conf

@@ -864,7 +864,10 @@
 // pcblock command
 794: This action is currently blocked.
 
-//795-899 free
+// @reloadattendancedb
+795: Attendance database has been reloaded.
+
+//796-899 free
 
 //------------------------------------
 // More atcommands message

+ 31 - 0
db/attendance.yml

@@ -1,3 +1,34 @@
+# This file is a part of rAthena.
+#   Copyright(C) 2019 rAthena Development Team
+#   https://rathena.org - https://github.com/rathena
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+###########################################################################
+# Attendance Database
+###########################################################################
+#
+# Attendance Settings
+#
+###########################################################################
+# - Start                   Start date.
+#   End                     End date.
+#   Rewards:                List of rewards for each day.
+#     - Day                 Reward day.
+#       ItemId              Item ID.
+###########################################################################
+
 Header:
   Type: ATTENDANCE_DB
   Version: 1

+ 31 - 0
db/import-tmpl/attendance.yml

@@ -1,3 +1,34 @@
+# This file is a part of rAthena.
+#   Copyright(C) 2019 rAthena Development Team
+#   https://rathena.org - https://github.com/rathena
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+###########################################################################
+# Attendance Database
+###########################################################################
+#
+# Attendance Settings
+#
+###########################################################################
+# - Start                   Start date.
+#   End                     End date.
+#   Rewards:                List of rewards for each day.
+#     - Day                 Reward day.
+#       ItemId              Item ID.
+###########################################################################
+
 Header:
   Type: ATTENDANCE_DB
   Version: 1

+ 31 - 0
db/pre-re/attendance.yml

@@ -1,3 +1,34 @@
+# This file is a part of rAthena.
+#   Copyright(C) 2019 rAthena Development Team
+#   https://rathena.org - https://github.com/rathena
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+###########################################################################
+# Attendance Database
+###########################################################################
+#
+# Attendance Settings
+#
+###########################################################################
+# - Start                   Start date.
+#   End                     End date.
+#   Rewards:                List of rewards for each day.
+#     - Day                 Reward day.
+#       ItemId              Item ID.
+###########################################################################
+
 Header:
   Type: ATTENDANCE_DB
   Version: 1

+ 31 - 0
db/re/attendance.yml

@@ -1,3 +1,34 @@
+# This file is a part of rAthena.
+#   Copyright(C) 2019 rAthena Development Team
+#   https://rathena.org - https://github.com/rathena
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+###########################################################################
+# Attendance Database
+###########################################################################
+#
+# Attendance Settings
+#
+###########################################################################
+# - Start                   Start date.
+#   End                     End date.
+#   Rewards:                List of rewards for each day.
+#     - Day                 Reward day.
+#       ItemId              Item ID.
+###########################################################################
+
 Header:
   Type: ATTENDANCE_DB
   Version: 1

+ 4 - 0
src/map/atcommand.cpp

@@ -4013,6 +4013,9 @@ ACMD_FUNC(reload) {
 	} else if (strstr(command, "achievementdb") || strncmp(message, "achievementdb", 4) == 0) {
 		achievement_db_reload();
 		clif_displaymessage(fd, msg_txt(sd,771)); // Achievement database has been reloaded.
+	} else if (strstr(command, "attendancedb") || strncmp(message, "attendancedb", 4) == 0) {
+		attendance_db.reload();
+		clif_displaymessage(fd, msg_txt(sd, 795)); // Attendance database has been reloaded.
 	}
 
 	return 0;
@@ -10250,6 +10253,7 @@ void atcommand_basecommands(void) {
 		ACMD_DEF2("reloadmsgconf", reload),
 		ACMD_DEF2("reloadinstancedb", reload),
 		ACMD_DEF2("reloadachievementdb",reload),
+		ACMD_DEF2("reloadattendancedb",reload),
 		ACMD_DEF(partysharelvl),
 		ACMD_DEF(mapinfo),
 		ACMD_DEF(dye),

+ 0 - 21
src/map/pc.cpp

@@ -90,27 +90,6 @@ struct fame_list taekwon_fame_list[MAX_FAME_LIST];
 
 struct s_job_info job_info[CLASS_COUNT];
 
-struct s_attendance_reward{
-	uint16 item_id;
-	uint16 amount;
-};
-
-struct s_attendance_period{
-	uint32 start;
-	uint32 end;
-	std::map<uint32,std::shared_ptr<struct s_attendance_reward>> rewards;
-};
-
-class AttendanceDatabase : public TypesafeYamlDatabase<uint32,s_attendance_period>{
-public:
-	AttendanceDatabase() : TypesafeYamlDatabase( "ATTENDANCE_DB", 1 ){
-
-	}
-
-	const std::string getDefaultLocation();
-	uint64 parseBodyNode( const YAML::Node& node );
-};
-
 const std::string AttendanceDatabase::getDefaultLocation(){
 	return std::string(db_path) + "/attendance.yml";
 }

+ 23 - 0
src/map/pc.hpp

@@ -1011,6 +1011,29 @@ short pc_maxaspd(struct map_session_data *sd);
     )
 #endif
 
+struct s_attendance_reward {
+	uint16 item_id;
+	uint16 amount;
+};
+
+struct s_attendance_period {
+	uint32 start;
+	uint32 end;
+	std::map<uint32, std::shared_ptr<struct s_attendance_reward>> rewards;
+};
+
+class AttendanceDatabase : public TypesafeYamlDatabase<uint32, s_attendance_period> {
+public:
+	AttendanceDatabase() : TypesafeYamlDatabase("ATTENDANCE_DB", 1) {
+
+	}
+
+	const std::string getDefaultLocation();
+	uint64 parseBodyNode(const YAML::Node &node);
+};
+
+extern AttendanceDatabase attendance_db;
+
 void pc_set_reg_load(bool val);
 int pc_split_atoi(char* str, int* val, char sep, int max);
 int pc_class2idx(int class_);