summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--db/const.txt3
-rw-r--r--sql-files/main.sql4
-rw-r--r--sql-files/upgrades/2013-10-30--19-53.sql5
-rw-r--r--sql-files/upgrades/index.txt1
-rw-r--r--src/char/char.c20
-rw-r--r--src/common/mmo.h3
-rw-r--r--src/map/clif.c15
-rw-r--r--src/map/clif.h2
-rw-r--r--src/map/map.h3
-rw-r--r--src/map/mob.c6
-rw-r--r--src/map/pc.c53
11 files changed, 95 insertions, 20 deletions
diff --git a/db/const.txt b/db/const.txt
index ddc4a188a..a90b87356 100644
--- a/db/const.txt
+++ b/db/const.txt
@@ -418,6 +418,9 @@ killerrid 121 1
killedrid 122 1
SlotChange 123 1
CharRename 124 1
+ModExp 125 1
+ModDrop 126 1
+ModDeath 127 1
bMaxHP 6
bMaxSP 8
diff --git a/sql-files/main.sql b/sql-files/main.sql
index 2c91d58b1..f8a225ee9 100644
--- a/sql-files/main.sql
+++ b/sql-files/main.sql
@@ -661,6 +661,7 @@ INSERT INTO `sql_updates` (`timestamp`) VALUES (1366078541);
INSERT INTO `sql_updates` (`timestamp`) VALUES (1381354728);
INSERT INTO `sql_updates` (`timestamp`) VALUES (1381423003);
INSERT INTO `sql_updates` (`timestamp`) VALUES (1382892428);
+INSERT INTO `sql_updates` (`timestamp`) VALUES (1383162785);
INSERT INTO `sql_updates` (`timestamp`) VALUES (1383167577);
--
@@ -715,6 +716,9 @@ INSERT INTO `interreg` (`varname`, `value`) VALUES
CREATE TABLE IF NOT EXISTS `account_data` (
`account_id` int(11) unsigned NOT NULL default '0',
`bank_vault` int(11) unsigned NOT NULL default '0',
+ `base_exp` TINYINT( 4 ) UNSIGNED NOT NULL default '0',
+ `base_drop` TINYINT( 4 ) UNSIGNED NOT NULL default '0',
+ `base_death` TINYINT( 4 ) UNSIGNED NOT NULL default '0',
PRIMARY KEY (`account_id`)
) ENGINE=MyISAM;
diff --git a/sql-files/upgrades/2013-10-30--19-53.sql b/sql-files/upgrades/2013-10-30--19-53.sql
new file mode 100644
index 000000000..05481cff4
--- /dev/null
+++ b/sql-files/upgrades/2013-10-30--19-53.sql
@@ -0,0 +1,5 @@
+#1383162785
+ALTER TABLE `account_data` ADD `base_exp` TINYINT( 4 ) UNSIGNED NOT NULL default '0';
+ALTER TABLE `account_data` ADD `base_drop` TINYINT( 4 ) UNSIGNED NOT NULL default '0';
+ALTER TABLE `account_data` ADD `base_death` TINYINT( 4 ) UNSIGNED NOT NULL default '0';
+INSERT INTO `sql_updates` (`timestamp`) VALUES (1383162785); \ No newline at end of file
diff --git a/sql-files/upgrades/index.txt b/sql-files/upgrades/index.txt
index ca06e9c31..1fc0ebd77 100644
--- a/sql-files/upgrades/index.txt
+++ b/sql-files/upgrades/index.txt
@@ -7,4 +7,5 @@
2013-10-09--21-38.sql
2013-10-10--16-36.sql
2013-10-27--16-47.sql
+2013-10-30--19-53.sql
2013-10-30--21-12.sql \ No newline at end of file
diff --git a/src/char/char.c b/src/char/char.c
index 4a04c521d..3cc1547ac 100644
--- a/src/char/char.c
+++ b/src/char/char.c
@@ -499,12 +499,12 @@ int mmo_char_tosql(int char_id, struct mmo_charstatus* p)
strcat(save_status, " status");
}
- if( p->bank_vault != cp->bank_vault ) {
- if( SQL_ERROR == SQL->Query(sql_handle, "REPLACE INTO `%s` (`account_id`,`bank_vault`) VALUES ('%d','%d')",account_data_db,p->account_id,p->bank_vault) ) {
+ if( p->bank_vault != cp->bank_vault || p->mod_exp != cp->mod_exp || p->mod_drop != cp->mod_drop || p->mod_death != p->mod_death ) {
+ if( SQL_ERROR == SQL->Query(sql_handle, "REPLACE INTO `%s` (`account_id`,`bank_vault`,`base_exp`,`base_drop`,`base_death`) VALUES ('%d','%d','%d','%d','%d')",account_data_db,p->account_id,p->bank_vault,p->mod_exp,p->mod_drop,p->mod_death) ) {
Sql_ShowDebug(sql_handle);
errors++;
} else
- strcat(save_status, " bank");
+ strcat(save_status, " accdata");
}
//Values that will seldom change (to speed up saving)
@@ -1353,15 +1353,21 @@ int mmo_char_fromsql(int char_id, struct mmo_charstatus* p, bool load_everything
mercenary_owner_fromsql(char_id, p);
strcat(t_msg, " mercenary");
- //`account_data` (`account_id`,`bank_vault`)
- if( SQL_ERROR == SQL->StmtPrepare(stmt, "SELECT `bank_vault` FROM `%s` WHERE `account_id`=? LIMIT 1", account_data_db)
+ /* default */
+ p->mod_exp = p->mod_drop = p->mod_death = 100;
+
+ //`account_data` (`account_id`,`bank_vault`,`base_exp`,`base_drop`,`base_death`)
+ if( SQL_ERROR == SQL->StmtPrepare(stmt, "SELECT `bank_vault`,`base_exp`,`base_drop`,`base_death` FROM `%s` WHERE `account_id`=? LIMIT 1", account_data_db)
|| SQL_ERROR == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &account_id, 0)
|| SQL_ERROR == SQL->StmtExecute(stmt)
- || SQL_ERROR == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &p->bank_vault, 0, NULL, NULL) )
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &p->bank_vault, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 1, SQLDT_USHORT, &p->mod_exp, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 2, SQLDT_USHORT, &p->mod_drop, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 3, SQLDT_USHORT, &p->mod_death, 0, NULL, NULL) )
SqlStmt_ShowDebug(stmt);
if( SQL_SUCCESS == SQL->StmtNextRow(stmt) )
- strcat(t_msg, " bank");
+ strcat(t_msg, " accdata");
if (save_log) ShowInfo("Loaded char (%d - %s): %s\n", char_id, p->name, t_msg); //ok. all data load successfuly!
SQL->StmtFree(stmt);
diff --git a/src/common/mmo.h b/src/common/mmo.h
index 5f4da6eb0..b1a1caf24 100644
--- a/src/common/mmo.h
+++ b/src/common/mmo.h
@@ -415,6 +415,9 @@ struct mmo_charstatus {
time_t delete_date;
+ /* `account_data` modifiers */
+ unsigned short mod_exp,mod_drop,mod_death;
+
unsigned char font;
};
diff --git a/src/map/clif.c b/src/map/clif.c
index 6efc73880..c099d5a1b 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -17798,6 +17798,19 @@ void clif_bank_withdraw(struct map_session_data *sd,enum e_BANKING_WITHDRAW_ACK
clif->send(&p,sizeof(p), &sd->bl, SELF);
}
+/* TODO: official response packet (tried 0x8cb/0x97b but the display was quite screwed up.) */
+/* currently mimicing */
+void clif_show_modifiers (struct map_session_data *sd) {
+
+ if( sd->status.mod_exp != 100 || sd->status.mod_drop != 100 || sd->status.mod_death != 100 ) {
+ char output[128];
+
+ snprintf(output,128,"Base EXP : %d%% | Base Drop: %d%% | Base Death Penalty: %d%%",
+ sd->status.mod_exp,sd->status.mod_drop,sd->status.mod_death);
+ clif->broadcast2(&sd->bl,output, strlen(output) + 1, 0xffbc90, 0x190, 12, 0, 0, SELF);
+ }
+
+}
/* */
unsigned short clif_decrypt_cmd( int cmd, struct map_session_data *sd ) {
@@ -18600,6 +18613,8 @@ void clif_defaults(void) {
/* Bank System [Yommy/Hercules] */
clif->bank_deposit = clif_bank_deposit;
clif->bank_withdraw = clif_bank_withdraw;
+ /* */
+ clif->show_modifiers = clif_show_modifiers;
/*------------------------
*- Parse Incoming Packet
*------------------------*/
diff --git a/src/map/clif.h b/src/map/clif.h
index 1710cfc88..710cb6590 100644
--- a/src/map/clif.h
+++ b/src/map/clif.h
@@ -1006,6 +1006,8 @@ struct clif_interface {
/* Bank System [Yommy/Hercules] */
void (*bank_deposit) (struct map_session_data *sd, enum e_BANKING_DEPOSIT_ACK reason);
void (*bank_withdraw) (struct map_session_data *sd,enum e_BANKING_WITHDRAW_ACK reason);
+ /* */
+ void (*show_modifiers) (struct map_session_data *sd);
/*------------------------
*- Parse Incoming Packet
*------------------------*/
diff --git a/src/map/map.h b/src/map/map.h
index 31ee0ef60..20e328c88 100644
--- a/src/map/map.h
+++ b/src/map/map.h
@@ -360,6 +360,9 @@ enum _sp {
SP_KILLEDRID=122,
SP_SLOTCHANGE=123,
SP_CHARRENAME=124,
+ SP_MOD_EXP=125,
+ SP_MOD_DROP=126,
+ SP_MOD_DEATH=127,
// Mercenaries
SP_MERCFLEE=165, SP_MERCKILLS=189, SP_MERCFAITH=190,
diff --git a/src/map/mob.c b/src/map/mob.c
index e3e079131..b8a8ed6c5 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -2332,6 +2332,12 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type) {
drop_rate = 1;
}
#endif
+ if( sd && sd->status.mod_drop != 100 ) {
+ drop_rate = drop_rate * sd->status.mod_drop / 100;
+ if( drop_rate < 1 )
+ drop_rate = 1;
+ }
+
// attempt to drop the item
if (rnd() % 10000 >= drop_rate)
continue;
diff --git a/src/map/pc.c b/src/map/pc.c
index 4747cf498..fcd96a85c 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -5889,6 +5889,12 @@ void pc_calcexp(struct map_session_data *sd, unsigned int *base_exp, unsigned in
*job_exp = (unsigned int) cap_value(*job_exp + (double)*job_exp * bonus/100., 1, UINT_MAX);
+ if( sd->status.mod_exp != 100 ) {
+ *base_exp = (unsigned int) cap_value((double)*base_exp * sd->status.mod_exp/100., 1, UINT_MAX);
+ *job_exp = (unsigned int) cap_value((double)*job_exp * sd->status.mod_exp/100., 1, UINT_MAX);
+
+ }
+
return;
}
/*==========================================
@@ -6911,47 +6917,55 @@ int pc_dead(struct map_session_data *sd,struct block_list *src) {
// changed penalty options, added death by player if pk_mode [Valaris]
if( battle_config.death_penalty_type
- && (sd->class_&MAPID_UPPERMASK) != MAPID_NOVICE // only novices will receive no penalty
- && !map->list[sd->bl.m].flag.noexppenalty && !map_flag_gvg2(sd->bl.m)
- && !sd->sc.data[SC_BABY] && !sd->sc.data[SC_CASH_DEATHPENALTY]
- ) {
- unsigned int base_penalty =0;
+ && (sd->class_&MAPID_UPPERMASK) != MAPID_NOVICE // only novices will receive no penalty
+ && !map->list[sd->bl.m].flag.noexppenalty && !map_flag_gvg2(sd->bl.m)
+ && !sd->sc.data[SC_BABY] && !sd->sc.data[SC_CASH_DEATHPENALTY]
+ ) {
+ unsigned int base_penalty = 0;
if (battle_config.death_penalty_base > 0) {
+
switch (battle_config.death_penalty_type) {
case 1:
base_penalty = (unsigned int) ((double)pc->nextbaseexp(sd) * (double)battle_config.death_penalty_base/10000);
- break;
+ break;
case 2:
base_penalty = (unsigned int) ((double)sd->status.base_exp * (double)battle_config.death_penalty_base/10000);
- break;
+ break;
}
+
if(base_penalty) {
if (battle_config.pk_mode && src && src->type==BL_PC)
base_penalty*=2;
+ if( sd->status.mod_death != 100 )
+ base_penalty = base_penalty * sd->status.mod_death / 100;
sd->status.base_exp -= min(sd->status.base_exp, base_penalty);
clif->updatestatus(sd,SP_BASEEXP);
}
}
- if(battle_config.death_penalty_job > 0)
- {
+
+ if(battle_config.death_penalty_job > 0) {
base_penalty = 0;
+
switch (battle_config.death_penalty_type) {
case 1:
base_penalty = (unsigned int) ((double)pc->nextjobexp(sd) * (double)battle_config.death_penalty_job/10000);
- break;
+ break;
case 2:
base_penalty = (unsigned int) ((double)sd->status.job_exp * (double)battle_config.death_penalty_job/10000);
- break;
+ break;
}
+
if(base_penalty) {
if (battle_config.pk_mode && src && src->type==BL_PC)
base_penalty*=2;
+ if( sd->status.mod_death != 100 )
+ base_penalty = base_penalty * sd->status.mod_death / 100;
sd->status.job_exp -= min(sd->status.job_exp, base_penalty);
clif->updatestatus(sd,SP_JOBEXP);
}
}
- if(battle_config.zeny_penalty > 0 && !map->list[sd->bl.m].flag.nozenypenalty)
- {
+
+ if(battle_config.zeny_penalty > 0 && !map->list[sd->bl.m].flag.nozenypenalty) {
base_penalty = (unsigned int)((double)sd->status.zeny * (double)battle_config.zeny_penalty / 10000.);
if(base_penalty)
pc->payzeny(sd, base_penalty, LOG_TYPE_PICKDROP_PLAYER, NULL);
@@ -7103,6 +7117,9 @@ int pc_readparam(struct map_session_data* sd,int type)
case SP_KILLEDRID: val = sd->killedrid; break;
case SP_SLOTCHANGE: val = sd->status.slotchange; break;
case SP_CHARRENAME: val = sd->status.rename; break;
+ case SP_MOD_EXP: val = sd->status.mod_exp; break;
+ case SP_MOD_DROP: val = sd->status.mod_drop; break;
+ case SP_MOD_DEATH: val = sd->status.mod_death; break;
case SP_CRITICAL: val = sd->battle_status.cri/10; break;
case SP_ASPD: val = (2000-sd->battle_status.amotion)/10; break;
case SP_BASE_ATK: val = sd->battle_status.batk; break;
@@ -7350,6 +7367,15 @@ int pc_setparam(struct map_session_data *sd,int type,int val)
case SP_CHARRENAME:
sd->status.rename = val;
return 1;
+ case SP_MOD_EXP:
+ sd->status.mod_exp = val;
+ return 1;
+ case SP_MOD_DROP:
+ sd->status.mod_drop = val;
+ return 1;
+ case SP_MOD_DEATH:
+ sd->status.mod_death = val;
+ return 1;
default:
ShowError("pc_setparam: Attempted to set unknown parameter '%d'.\n", type);
return 0;
@@ -10200,6 +10226,7 @@ void pc_bank_withdraw(struct map_session_data *sd, int money) {
/* status change data arrived from char-server */
void pc_scdata_received(struct map_session_data *sd) {
pc->inventory_rentals(sd);
+ clif->show_modifiers(sd);
}
/*==========================================