conf\battle\player.conf
@@ -164,6 +164,12 @@ character_size: 0
// items from Autoloot (0: disabled).
idle_no_autoloot: 0
+// Extra Bonuses [Lilith]
+// Enable [1-2] or disable[0] player's Extra Bonuses?
+// 1 = enable for all players any bonuses from db/extra_bonuses.txt
+// 2 = enable only for players which have a specific variable "EXTRA_BONUS"
+enable_extra_bonus: 2
+
// Minimum distance a vending/chat room must be from a NPC in order to be placed.
// Default: 3 (0: disabled).
min_npc_vendchat_distance: 3
db\extra_bonuses.txt
@@ -0,0 +1,12 @@
+// Extra Bonuses [Lilith]
+// Skorm addition 2 to the power of the bonus should be the extra bonus variable.
+// EX: 2^2 = 4 so 4 is the variable of the second bonus this way multiple bonus can be added to one player.
+// If enable_extra_bonus is 1 this and below Extra bonuses will be received by all players
+// If enable_extra_bonus is 2 this Extra bonus will be received by players which have variable EXTRA_BONUS = 1
+{ bonus bStr,15; bonus bSpeedAddRate,50;} //1
+// If enable_extra_bonus is 2 this Extra bonus will be received by players which have variable EXTRA_BONUS = 2
+{ bonus bAgi,10; bonus bMdef,30;} //2
+// More bonuses...
+{ bonus bAgi,100;} //4
+{}
+{}
\ No newline at end of file
src\map\battle.c
@@ -8384,6 +8384,10 @@ static const struct _battle_data {
{ "tarotcard_equal_chance", &battle_config.tarotcard_equal_chance, 0, 0, 1, },
{ "change_party_leader_samemap", &battle_config.change_party_leader_samemap, 1, 0, 1, },
{ "dispel_song", &battle_config.dispel_song, 0, 0, 1, },
+ /**
+ * Extra Bonuses [Lilith]
+ **/
+ { "enable_extra_bonus", &battle_config.enable_extra_bonus, 1, 0, 2, },
#include "../custom/battle_config_init.inc"
};
src\map\battle.h
@@ -616,6 +616,11 @@ extern struct Battle_Config
int change_party_leader_samemap;
int dispel_song; //Can songs be dispelled?
+ /**
+ * Extra Bonuses [Lilith]
+ **/
+ int enable_extra_bonus;
+
#include "../custom/battle_config_struct.inc"
} battle_config;
src\map\itemdb.c
@@ -570,6 +570,59 @@ static bool itemdb_read_itemavail(char* str[], int columns, int current) {
return true;
}
+/**
+* Extra Bonuses [Lilith]
+**/
+static int itemdb_readbonus(void)
+{
+ char* filename = "extra_bonuses.txt";
+ uint32 lines = 0, count = 1;
+ char line[1024], path[256];
+ FILE* fp;
+
+ sprintf(path, "%s/%s", db_path, filename);
+ fp = fopen(path, "r");
+ if (fp == NULL)
+ {
+ ShowWarning("itemdb_readbonus: File not found \"%s\", skipping.\n", path);
+ return 0;
+ }
+
+ while (fgets(line, sizeof(line), fp))
+ {
+ char *str, *p;
+ lines++;
+ if (line[0] == '/' && line[1] == '/')
+ continue;
+ str = 0;
+ p = line;
+ while (ISSPACE(*p))
+ ++p;
+ if (*p == '\0')
+ continue;
+ if (*p != '{')
+ {
+ ShowError("itemdb_readbonus: Invalid format in line %d of \"%s\", skipping.\n", lines, path);
+ continue;
+ }
+ str = p;
+ p = strstr(p + 1, "}");
+ if (strchr(p, ',') != NULL)
+ {
+ ShowError("itemdb_readbonus: Extra columns in line %d of \"%s\", skipping.\n", lines, path);
+ continue;
+ }
+ extra_bonus[count].script = parse_script(str, path, lines, 0);
+ count++;
+ }
+
+ fclose(fp);
+
+ ShowStatus("Done reading '"CL_WHITE"%lu"CL_RESET"' entries in '"CL_WHITE"%s"CL_RESET"'.\n", count - 1, filename);
+
+ return 0;
+}
+
static int itemdb_group_free(DBKey key, DBData *data, va_list ap);
static bool itemdb_read_group(char* str[], int columns, int current) {
@@ -1684,6 +1737,8 @@ static void itemdb_read(void) {
itemdb_read_sqldb();
else
itemdb_readdb();
+
+ itemdb_readbonus(); //Extra Bonuses [Lilith]
for(i=0; i<ARRAYLENGTH(dbsubpath); i++){
uint8 n1 = (uint8)(strlen(db_path)+strlen(dbsubpath[i])+1);
src\map\itemdb.h
@@ -12,6 +12,19 @@
#define MAX_ITEMID USHRT_MAX
///Use apple for unknown items.
#define UNKNOWN_ITEM_ID 512
+
+/**
+ * Extra Bonuses [Lilith]
+ **/
+
+//#define MAX_ITEMDB 500
+
+ struct s_bonus_data {
+ struct script_code *script;
+
+};
+struct s_bonus_data extra_bonus[MAX_ITEMID];
+
/// The maximum number of item delays
#define MAX_ITEMDELAYS 10
///Designed for search functions, species max number of matches to display.
src\map\status.c
@@ -3389,6 +3389,33 @@ int status_calc_pc_(struct map_session_data* sd, enum e_status_calc_opt opt)
pc_delautobonus(sd,sd->autobonus2,ARRAYLENGTH(sd->autobonus2),true);
pc_delautobonus(sd,sd->autobonus3,ARRAYLENGTH(sd->autobonus3),true);
+ /**
+ * Extra Bonuses [Lilith]
+ **/
+ if (battle_config.enable_extra_bonus) {
+ if (battle_config.enable_extra_bonus == 2) {
+ for (i = 1; i<ARRAYLENGTH(extra_bonus); i++) {
+ if (!extra_bonus[i].script)
+ break;
+ if ( pc_readglobalreg(sd, add_str("EXTRA_BONUS")) & (int)pow(2,i-1) )
+ run_script(extra_bonus[i].script, 0, sd->bl.id, 0);
+ if (!calculating)
+ return 1;
+ }
+ }
+ else {
+ for (i = 1; i<ARRAYLENGTH(extra_bonus); i++) {
+ if (!extra_bonus[i].script)
+ break;
+ run_script(extra_bonus[i].script, 0, sd->bl.id, 0);
+ if (!calculating)
+ return 1;
+ }
+ }
+ }
+
+
pc_itemgrouphealrate_clear(sd);
running_npc_stat_calc_event = true;