summaryrefslogtreecommitdiff
path: root/src/char/char.c
diff options
context:
space:
mode:
authorshennetsind <ind@henn.et>2013-10-30 18:42:58 -0200
committershennetsind <ind@henn.et>2013-10-30 18:42:58 -0200
commitc159a3c4ffd414d7423b3504a282cce1111b7874 (patch)
tree0d7051a90bcd0b9ba229ff16d52a9dea0bbee743 /src/char/char.c
parent7fefefdde386f13f8fefa8db3ffe9ed140c8aa10 (diff)
downloadhercules-c159a3c4ffd414d7423b3504a282cce1111b7874.tar.gz
hercules-c159a3c4ffd414d7423b3504a282cce1111b7874.tar.bz2
hercules-c159a3c4ffd414d7423b3504a282cce1111b7874.tar.xz
hercules-c159a3c4ffd414d7423b3504a282cce1111b7874.zip
Account-wide Exp/Drop/Death Modifiers
Attempting to mimic the official as suggested in http://hercules.ws/board/topic/250-official-vip-system/ The variables can be read and modified thru scripting as well as sql, the patch introduces 3 new pc-arams 'ModExp','ModDrop' and 'ModDeath' for that purpose. The OnLogin modifier display is not the real deal though -- wasn't able to get it to output properly (though that might have been my client files failt) Up for review. Signed-off-by: shennetsind <ind@henn.et>
Diffstat (limited to 'src/char/char.c')
-rw-r--r--src/char/char.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/char/char.c b/src/char/char.c
index 310163e3a..240acab53 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)
@@ -1352,15 +1352,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);