viewing paste ra_inter_battle_conf | Diff

Posted on the
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125
Index: src/common/core.c
===================================================================
--- src/common/core.c   (revision 17291)
+++ src/common/core.c   (working copy)
@@ -5,6 +5,8 @@
 #include "showmsg.h"
 #include "malloc.h"
 #include "core.h"
+#include "conf.h"
+#include "utils.h"
 #ifndef MINICORE
 #include "db.h"
 #include "socket.h"
@@ -41,6 +43,7 @@
 char *SERVER_NAME = NULL;
 char SERVER_TYPE = ATHENA_SERVER_NONE;
 
+
 #ifndef MINICORE   // minimalist Core
 // Added by Gabuzomeu
 //
@@ -295,6 +298,7 @@
 /*======================================
  * CORE : MAINROUTINE
  *--------------------------------------*/
+void inter_conf_read(void);
 int main (int argc, char **argv)
 {
    {// initialize program arguments
@@ -355,5 +359,50 @@
 
    malloc_final();
 
+   inter_conf_read();
+
    return 0;
 }
+
+void inter_conf_read(void){
+   config_t inter_conf;
+   config_setting_t *sys = NULL;
+   const char *config_filename = "conf/inter_battle.conf";
+
+   if (conf_read_file(&inter_conf, config_filename))
+       return;
+
+   sys = config_lookup(&inter_conf, "vip_sys");
+   if (sys != NULL) { //reading vip_sys part
+       config_setting_t *settings = config_setting_get_elem(sys, 0);
+       unsigned int enable; //:1
+       unsigned int group;
+       unsigned int magic_stone; //:1
+       unsigned int storage_increase;
+       unsigned int char_increase;
+       unsigned int exp_increase;
+       unsigned int exp_penalty;
+       unsigned int bm_increase;
+       unsigned int drop_increase;
+
+       config_setting_lookup_bool(settings, "enable", &enable);
+       config_setting_lookup_int(settings, "group", &group);
+       config_setting_lookup_int(settings, "storage_increase", &storage_increase);
+       config_setting_lookup_int(settings, "char_increase", &char_increase);
+       config_setting_lookup_int(settings, "exp_increase", &exp_increase);
+       config_setting_lookup_int(settings, "exp_penalty", &exp_penalty);
+       config_setting_lookup_int(settings, "bm_increase", &bm_increase);
+       config_setting_lookup_int(settings, "drop_increase", &drop_increase);
+       config_setting_lookup_bool(settings, "magic_stone", &magic_stone);
+
+       Inter_Config.vip_sys.enable = enable;
+       Inter_Config.vip_sys.group = cap_value(storage_increase,0,99);
+       Inter_Config.vip_sys.storage_increase = cap_value(storage_increase,0,MAX_STORAGE);
+       Inter_Config.vip_sys.char_increase = cap_value(char_increase,0,MAX_CHARS);
+       Inter_Config.vip_sys.exp_increase = cap_value(exp_increase,0,INT_MAX);
+       Inter_Config.vip_sys.exp_penalty = cap_value(exp_penalty,0,INT_MAX);
+       Inter_Config.vip_sys.bm_increase = cap_value(bm_increase,0,INT_MAX);
+       Inter_Config.vip_sys.drop_increase = cap_value(drop_increase,0,INT_MAX);
+       Inter_Config.vip_sys.magic_stone = magic_stone;
+   }
+}
Index: src/common/core.h
===================================================================
--- src/common/core.h   (revision 17291)
+++ src/common/core.h   (working copy)
@@ -45,6 +45,20 @@
    CORE_ST_LAST
 };
 
+struct {
+    struct  {
+   unsigned int enable :1;
+   unsigned int group;
+   unsigned int storage_increase;
+   unsigned int char_increase;
+   unsigned int exp_increase;
+   unsigned int exp_penalty;
+   unsigned int bm_increase;
+   unsigned int drop_increase;
+   unsigned int magic_stone :1;
+    } vip_sys;
+} Inter_Config;
+
 /// Called when a terminate signal is received. (Ctrl+C pressed)
 /// If NULL, runflag is set to CORE_ST_STOP instead.
 extern void (*shutdown_callback)(void);
Index: conf/inter_battle.conf
===================================================================
--- conf/inter_battle.conf  (revision 0)
+++ conf/inter_battle.conf  (revision 0)
@@ -0,0 +1,15 @@
+/* Inter server system configuration file */
+
+vip_sys: ( /*vip system part*/
+{
+   enable: true            /*Enable/Disable the VIP system.*/
+   group :1                /*Which group (ID) will be denoted as the VIP Group?*/      
+   storage_increase: 300   /*Storage slot increase.*/
+   char_increase:6         /*Max character limit increase.*/
+   exp_increase:50         /*Base/Job EXP rate increase.*/
+   exp_penalty:200         /*Base/Job EXP rate death penalty.*/
+   bm_increase:2           /*Battle Manual EXP increase.*/
+   drop_increase:50        /*Item drop increase.*/
+   magic_stone :true       /*Can the VIP Group ignore Magic Stone requirement for skills?*/
+}
+)
Viewed 1200 times, submitted by lighta.