summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/char/char.c4
-rw-r--r--src/char/pincode.c283
-rw-r--r--src/char/pincode.h40
-rw-r--r--src/map/clif.c10
-rw-r--r--src/map/packets_struct.h4
-rw-r--r--src/map/status.c24
-rw-r--r--src/plugins/HPMHooking/HPMHooking.Defs.inc14
-rw-r--r--src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc28
-rw-r--r--src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc7
-rw-r--r--src/plugins/HPMHooking/HPMHooking_char.Hooks.inc151
10 files changed, 469 insertions, 96 deletions
diff --git a/src/char/char.c b/src/char/char.c
index 84cc1b688..7e5b7e0dc 100644
--- a/src/char/char.c
+++ b/src/char/char.c
@@ -5012,7 +5012,7 @@ void char_parse_char_pincode_window(int fd, struct char_session_data* sd) __attr
void char_parse_char_pincode_window(int fd, struct char_session_data* sd)
{
if (RFIFOL(fd,2) == sd->account_id)
- pincode->sendstate(fd, sd, PINCODE_NOTSET);
+ pincode->loginstate(fd, sd, PINCODE_LOGIN_NOTSET);
RFIFOSKIP(fd, 6);
}
@@ -6159,6 +6159,7 @@ int do_final(void) {
do_final_mapif();
loginif->final();
+ pincode->final();
if( SQL_ERROR == SQL->Query(inter->sql_handle, "DELETE FROM `%s`", ragsrvinfo_db) )
Sql_ShowDebug(inter->sql_handle);
@@ -6305,6 +6306,7 @@ int do_init(int argc, char **argv) {
//Read map indexes
mapindex->init();
+ pincode->init();
#ifdef RENEWAL
start_point.map = mapindex->name2id("iz_int");
diff --git a/src/char/pincode.c b/src/char/pincode.c
index bca1b4394..01c1f482c 100644
--- a/src/char/pincode.c
+++ b/src/char/pincode.c
@@ -26,6 +26,7 @@
#include "common/cbasetypes.h"
#include "common/conf.h"
#include "common/db.h"
+#include "common/memmgr.h"
#include "common/mmo.h"
#include "common/nullpo.h"
#include "common/random.h"
@@ -39,56 +40,95 @@
struct pincode_interface pincode_s;
struct pincode_interface *pincode;
-void pincode_handle (int fd, struct char_session_data* sd) {
+void pincode_handle (int fd, struct char_session_data* sd)
+{
struct online_char_data* character;
nullpo_retv(sd);
+
character = (struct online_char_data*)idb_get(chr->online_char_db, sd->account_id);
- if( character && character->pincode_enable > pincode->charselect ){
+
+ if (character && character->pincode_enable > pincode->charselect) {
character->pincode_enable = pincode->charselect * 2;
- }else{
- pincode->sendstate( fd, sd, PINCODE_OK );
+ } else {
+ pincode->loginstate(fd, sd, PINCODE_LOGIN_OK);
return;
}
- if( strlen(sd->pincode) == 4 ){
- if( pincode->changetime && time(NULL) > (sd->pincode_change+pincode->changetime) ){ // User hasn't changed his PIN code for a long time
- pincode->sendstate( fd, sd, PINCODE_EXPIRED );
+ if (strlen(sd->pincode) == 4) {
+ if (pincode->check_blacklist && pincode->isBlacklisted(sd->pincode)) {
+ // Ask player to change pincode to be able to connect
+ pincode->loginstate(fd, sd, PINCODE_LOGIN_EXPIRED);
+ } else if (pincode->changetime && time(NULL) > (sd->pincode_change + pincode->changetime)) {
+ // User hasn't changed his PIN code for a long time
+ pincode->loginstate(fd, sd, PINCODE_LOGIN_EXPIRED);
} else { // Ask user for his PIN code
- pincode->sendstate( fd, sd, PINCODE_ASK );
+ pincode->loginstate(fd, sd, PINCODE_LOGIN_ASK);
}
} else // No PIN code has been set yet
- pincode->sendstate( fd, sd, PINCODE_NOTSET );
+ pincode->loginstate(fd, sd, PINCODE_LOGIN_NOTSET);
- if( character )
+ if (character)
character->pincode_enable = -1;
}
-void pincode_check(int fd, struct char_session_data* sd) {
+void pincode_check(int fd, struct char_session_data* sd)
+{
char pin[5] = "\0\0\0\0";
nullpo_retv(sd);
+
if (strlen(sd->pincode) != 4)
return;
+
safestrncpy(pin, RFIFOP(fd, 6), sizeof(pin));
- pincode->decrypt(sd->pincode_seed, pin);
- if( pincode->compare( fd, sd, pin ) ){
+
+ if (pincode->check_blacklist && pincode->isBlacklisted(pin)) {
+ pincode->loginstate(fd, sd, PINCODE_LOGIN_RESTRICT_PW);
+ return;
+ }
+
+ if (pincode->compare(fd, sd, pin)) {
struct online_char_data* character;
- if( (character = (struct online_char_data*)idb_get(chr->online_char_db, sd->account_id)) )
+ if ((character = (struct online_char_data*)idb_get(chr->online_char_db, sd->account_id)))
character->pincode_enable = pincode->charselect * 2;
- pincode->sendstate( fd, sd, PINCODE_OK );
+ pincode->loginstate(fd, sd, PINCODE_LOGIN_OK);
+ } else {
+ pincode->loginstate(fd, sd, PINCODE_LOGIN_WRONG);
}
}
-int pincode_compare(int fd, struct char_session_data* sd, char* pin) {
+/**
+* Check if this pincode is blacklisted or not
+*
+* @param (const char *) pin The pin to be verified
+* @return bool
+*/
+bool pincode_isBlacklisted(const char *pin)
+{
+ int i;
+
+ nullpo_retr(false, pin);
+
+ ARR_FIND(0, VECTOR_LENGTH(pincode->blacklist), i, strcmp(VECTOR_INDEX(pincode->blacklist, i), pin) == 0);
+
+ if (i < VECTOR_LENGTH(pincode->blacklist)) {
+ return true;
+ }
+
+ return false;
+}
+
+int pincode_compare(int fd, struct char_session_data* sd, char* pin)
+{
nullpo_ret(sd);
nullpo_ret(pin);
- if( strcmp( sd->pincode, pin ) == 0 ){
+
+ if (strcmp(sd->pincode, pin) == 0) {
sd->pincode_try = 0;
return 1;
} else {
- pincode->sendstate( fd, sd, PINCODE_WRONG );
- if( pincode->maxtry && ++sd->pincode_try >= pincode->maxtry ){
+ if (pincode->maxtry && ++sd->pincode_try >= pincode->maxtry) {
pincode->error(sd->account_id);
chr->authfail_fd(fd, 0);
chr->disconnect_player(sd->account_id);
@@ -97,35 +137,94 @@ int pincode_compare(int fd, struct char_session_data* sd, char* pin) {
}
}
-void pincode_change(int fd, struct char_session_data* sd) {
+void pincode_change(int fd, struct char_session_data* sd)
+{
char oldpin[5] = "\0\0\0\0", newpin[5] = "\0\0\0\0";
nullpo_retv(sd);
+
if (strlen(sd->pincode) != 4)
return;
- safestrncpy(oldpin, RFIFOP(fd,6), sizeof(oldpin));
- pincode->decrypt(sd->pincode_seed,oldpin);
- if( !pincode->compare( fd, sd, oldpin ) )
+
+ safestrncpy(oldpin, RFIFOP(fd, 6), sizeof(oldpin));
+ pincode->decrypt(sd->pincode_seed, oldpin);
+
+ if (!pincode->compare(fd, sd, oldpin)) {
+ pincode->editstate(fd, sd, PINCODE_EDIT_FAILED);
+ pincode->loginstate(fd, sd, PINCODE_LOGIN_ASK);
return;
+ }
- safestrncpy(newpin, RFIFOP(fd,10), sizeof(newpin));
- pincode->decrypt(sd->pincode_seed,newpin);
- pincode->update( sd->account_id, newpin );
- safestrncpy(sd->pincode, newpin, sizeof(sd->pincode));
- pincode->sendstate( fd, sd, PINCODE_ASK );
+ safestrncpy(newpin, RFIFOP(fd, 10), sizeof(newpin));
+ pincode->decrypt(sd->pincode_seed, newpin);
+
+ if (pincode->check_blacklist && pincode->isBlacklisted(newpin)) {
+ pincode->editstate(fd, sd, PINCODE_EDIT_RESTRICT_PW);
+ } else {
+ pincode->update(sd->account_id, newpin);
+ safestrncpy(sd->pincode, newpin, sizeof(sd->pincode));
+ pincode->editstate(fd, sd, PINCODE_EDIT_SUCCESS);
+ }
+
+ pincode->loginstate(fd, sd, PINCODE_LOGIN_ASK);
}
-void pincode_setnew(int fd, struct char_session_data* sd) {
+void pincode_setnew(int fd, struct char_session_data* sd)
+{
char newpin[5] = "\0\0\0\0";
nullpo_retv(sd);
+
if (strlen(sd->pincode) == 4)
return;
- safestrncpy(newpin, RFIFOP(fd,6), sizeof(newpin));
- pincode->decrypt(sd->pincode_seed,newpin);
- pincode->update( sd->account_id, newpin );
+
+ safestrncpy(newpin, RFIFOP(fd, 6), sizeof(newpin));
+ pincode->decrypt(sd->pincode_seed, newpin);
+
+ if (pincode->check_blacklist && pincode->isBlacklisted(newpin)) {
+ pincode->makestate(fd, sd, PINCODE_MAKE_RESTRICT_PW);
+ return;
+ }
+
+ pincode->update(sd->account_id, newpin);
safestrncpy(sd->pincode, newpin, sizeof(sd->pincode));
- pincode->sendstate( fd, sd, PINCODE_ASK );
+ pincode->makestate(fd, sd, PINCODE_MAKE_SUCCESS);
+}
+
+/**
+* Send state of making new pincode
+*
+* @param[in] fd
+* @param[in, out] sd Session Data
+* @param[in] state Pincode Edit State
+*/
+void pincode_makestate(int fd, struct char_session_data *sd, enum pincode_make_response state)
+{
+ nullpo_retv(sd);
+
+ WFIFOHEAD(fd, 8);
+ WFIFOW(fd, 0) = 0x8bb;
+ WFIFOW(fd, 2) = state;
+ WFIFOW(fd, 4) = 0;
+ WFIFOSET(fd, 8);
+}
+
+/**
+* Send state of editing pincode
+*
+* @param[in] fd
+* @param[in, out] sd Session Data
+* @param[in] state Pincode Edit State
+*/
+void pincode_editstate(int fd, struct char_session_data *sd, enum pincode_edit_response state)
+{
+ nullpo_retv(sd);
+
+ WFIFOHEAD(fd, 8);
+ WFIFOW(fd, 0) = 0x8bf;
+ WFIFOW(fd, 2) = state;
+ WFIFOW(fd, 4) = sd->pincode_seed = rnd() % 0xFFFF;
+ WFIFOSET(fd, 8);
}
// 0 = pin is correct
@@ -137,50 +236,57 @@ void pincode_setnew(int fd, struct char_session_data* sd) {
// 6 = client shows msgstr(1897) Unable to use your KSSN number
// 7 = char select window shows a button - client sends 0x8c5
// 8 = pincode was incorrect
-void pincode_sendstate(int fd, struct char_session_data* sd, uint16 state) {
+void pincode_loginstate(int fd, struct char_session_data* sd, enum pincode_login_response state)
+{
nullpo_retv(sd);
+
WFIFOHEAD(fd, 12);
WFIFOW(fd, 0) = 0x8b9;
WFIFOL(fd, 2) = sd->pincode_seed = rnd() % 0xFFFF;
WFIFOL(fd, 6) = sd->account_id;
- WFIFOW(fd,10) = state;
- WFIFOSET(fd,12);
+ WFIFOW(fd, 10) = state;
+ WFIFOSET(fd, 12);
}
-void pincode_notifyLoginPinUpdate(int account_id, char* pin) {
+void pincode_notifyLoginPinUpdate(int account_id, char* pin)
+{
nullpo_retv(pin);
+
Assert_retv(chr->login_fd != -1);
- WFIFOHEAD(chr->login_fd,11);
- WFIFOW(chr->login_fd,0) = 0x2738;
- WFIFOL(chr->login_fd,2) = account_id;
- safestrncpy(WFIFOP(chr->login_fd,6), pin, 5);
- WFIFOSET(chr->login_fd,11);
+ WFIFOHEAD(chr->login_fd, 11);
+ WFIFOW(chr->login_fd, 0) = 0x2738;
+ WFIFOL(chr->login_fd, 2) = account_id;
+ safestrncpy(WFIFOP(chr->login_fd, 6), pin, 5);
+ WFIFOSET(chr->login_fd, 11);
}
-void pincode_notifyLoginPinError(int account_id) {
- WFIFOHEAD(chr->login_fd,6);
- WFIFOW(chr->login_fd,0) = 0x2739;
- WFIFOL(chr->login_fd,2) = account_id;
- WFIFOSET(chr->login_fd,6);
+void pincode_notifyLoginPinError(int account_id)
+{
+ WFIFOHEAD(chr->login_fd, 6);
+ WFIFOW(chr->login_fd, 0) = 0x2739;
+ WFIFOL(chr->login_fd, 2) = account_id;
+ WFIFOSET(chr->login_fd, 6);
}
-void pincode_decrypt(unsigned int userSeed, char* pin) {
+void pincode_decrypt(unsigned int userSeed, char* pin)
+{
int i;
- char tab[10] = {0,1,2,3,4,5,6,7,8,9};
+ char tab[10] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
nullpo_retv(pin);
+
for (i = 1; i < 10; i++) {
int pos;
userSeed = pincode->baseSeed + userSeed * pincode->multiplier;
pos = userSeed % (i + 1);
- if( i != pos ){
+ if (i != pos) {
tab[i] ^= tab[pos];
tab[pos] ^= tab[i];
tab[i] ^= tab[pos];
}
}
- for (i = 0; i < 4; i++ ) {
+ for (i = 0; i < 4; i++) {
if (pin[i] < '0' || pin[i] > '9')
pin[i] = '0';
else
@@ -202,6 +308,8 @@ void pincode_decrypt(unsigned int userSeed, char* pin) {
bool pincode_config_read(const char *filename, const struct config_t *config, bool imported)
{
const struct config_setting_t *setting = NULL;
+ const struct config_setting_t *temp = NULL;
+
nullpo_retr(false, filename);
nullpo_retr(false, config);
@@ -238,28 +346,93 @@ bool pincode_config_read(const char *filename, const struct config_t *config, bo
}
}
+ if (libconfig->setting_lookup_bool_real(setting, "check_blacklisted", &pincode->check_blacklist) == CONFIG_FALSE) {
+ if (!imported) {
+ ShowWarning("pincode 'check_blaclisted' not found, defaulting to false...\n");
+ pincode->check_blacklist = false;
+ }
+ }
+
+ if (pincode->check_blacklist) {
+ if ((temp = libconfig->setting_get_member(setting, "blacklist")) != NULL) {
+ VECTOR_DECL(char *) duplicate;
+ int i, j, size = libconfig->setting_length(temp);
+ VECTOR_INIT(duplicate);
+ VECTOR_ENSURE(duplicate, size, 1);
+ for (i = 0; i < size; i++) {
+ const char *pin = libconfig->setting_get_string_elem(temp, i);
+
+ if (pin == NULL)
+ continue;
+
+ if (strlen(pin) != 4) {
+ ShowError("Wrong size on element %d of blacklist. Desired size = 4, received = %d\n", i, (int)strlen(pin));
+ continue;
+ }
+
+ ARR_FIND(0, VECTOR_LENGTH(duplicate), j, strcmp(VECTOR_INDEX(duplicate, j), pin) == 0);
+
+ if (j < VECTOR_LENGTH(duplicate)) {
+ ShowWarning("Duplicate pin on pincode blacklist. Item #%d\n", i);
+ continue;
+ }
+
+ VECTOR_ENSURE(pincode->blacklist, 1, 1);
+ VECTOR_PUSH(pincode->blacklist, aStrdup(pin));
+ VECTOR_PUSH(duplicate, aStrdup(pin));
+ }
+ while (VECTOR_LENGTH(duplicate) > 0) {
+ aFree(VECTOR_POP(duplicate));
+ }
+ VECTOR_CLEAR(duplicate);
+ } else if (!imported) {
+ ShowError("Pincode Blacklist Check is enabled but there's no blacklist setting! Disabling check.\n");
+ pincode->check_blacklist = false;
+ }
+ }
+
return true;
}
-void pincode_defaults(void) {
+void do_pincode_init(void)
+{
+ VECTOR_INIT(pincode->blacklist);
+}
+
+void do_pincode_final(void)
+{
+ while (VECTOR_LENGTH(pincode->blacklist) > 0) {
+ aFree(VECTOR_POP(pincode->blacklist));
+ }
+ VECTOR_CLEAR(pincode->blacklist);
+}
+
+void pincode_defaults(void)
+{
pincode = &pincode_s;
- pincode->enabled = PINCODE_OK;
+ pincode->enabled = 0;
pincode->changetime = 0;
pincode->maxtry = 3;
pincode->charselect = 0;
+ pincode->check_blacklist = false;
pincode->multiplier = 0x3498;
pincode->baseSeed = 0x881234;
+ pincode->init = do_pincode_init;
+ pincode->final = do_pincode_final;
+
pincode->handle = pincode_handle;
pincode->decrypt = pincode_decrypt;
pincode->error = pincode_notifyLoginPinError;
pincode->update = pincode_notifyLoginPinUpdate;
- pincode->sendstate = pincode_sendstate;
+ pincode->makestate = pincode_makestate;
+ pincode->editstate = pincode_editstate;
+ pincode->loginstate = pincode_loginstate;
pincode->setnew = pincode_setnew;
pincode->change = pincode_change;
+ pincode->isBlacklisted = pincode_isBlacklisted;
pincode->compare = pincode_compare;
pincode->check = pincode_check;
pincode->config_read = pincode_config_read;
-
}
diff --git a/src/char/pincode.h b/src/char/pincode.h
index cffaa3054..8e4f67c2d 100644
--- a/src/char/pincode.h
+++ b/src/char/pincode.h
@@ -22,18 +22,35 @@
#define CHAR_PINCODE_H
#include "common/hercules.h"
+#include "common/db.h"
/* Forward Declarations */
struct char_session_data;
struct config_t; // common/conf.h
-enum PincodeResponseCode {
- PINCODE_OK = 0,
- PINCODE_ASK = 1,
- PINCODE_NOTSET = 2,
- PINCODE_EXPIRED = 3,
- PINCODE_UNUSED = 7,
- PINCODE_WRONG = 8,
+enum pincode_make_response {
+ PINCODE_MAKE_SUCCESS = 0,
+ PINCODE_MAKE_DUPLICATED = 1,
+ PINCODE_MAKE_RESTRICT_PW = 2,
+ PINCODE_MAKE_PERSONALNUM_PW = 3,
+ PINCODE_MAKE_FAILED = 4,
+};
+
+enum pincode_edit_response {
+ PINCODE_EDIT_SUCCESS = 0x0,
+ PINCODE_EDIT_FAILED = 0x1,
+ PINCODE_EDIT_RESTRICT_PW = 0x2,
+ PINCODE_EDIT_PERSONALNUM_PW = 0x3,
+};
+
+enum pincode_login_response {
+ PINCODE_LOGIN_OK = 0,
+ PINCODE_LOGIN_ASK = 1,
+ PINCODE_LOGIN_NOTSET = 2,
+ PINCODE_LOGIN_EXPIRED = 3,
+ PINCODE_LOGIN_RESTRICT_PW = 5,
+ PINCODE_LOGIN_UNUSED = 7,
+ PINCODE_LOGIN_WRONG = 8,
};
/**
@@ -45,6 +62,8 @@ struct pincode_interface {
int changetime;
int maxtry;
int charselect;
+ bool check_blacklist;
+ VECTOR_DECL(char *) blacklist;
unsigned int multiplier;
unsigned int baseSeed;
/* handler */
@@ -52,12 +71,17 @@ struct pincode_interface {
void (*decrypt) (unsigned int userSeed, char* pin);
void (*error) (int account_id);
void (*update) (int account_id, char* pin);
- void (*sendstate) (int fd, struct char_session_data* sd, uint16 state);
+ void (*makestate) (int fd, struct char_session_data *sd, enum pincode_make_response state);
+ void (*editstate) (int fd, struct char_session_data *sd, enum pincode_edit_response state);
+ void (*loginstate) (int fd, struct char_session_data *sd, enum pincode_login_response state);
void (*setnew) (int fd, struct char_session_data* sd);
void (*change) (int fd, struct char_session_data* sd);
+ bool (*isBlacklisted) (const char *pin);
int (*compare) (int fd, struct char_session_data* sd, char* pin);
void (*check) (int fd, struct char_session_data* sd);
bool (*config_read) (const char *filename, const struct config_t *config, bool imported);
+ void (*init) (void);
+ void (*final) (void);
};
#ifdef HERCULES_CORE
diff --git a/src/map/clif.c b/src/map/clif.c
index 60f4b18c0..47d5a1586 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -819,7 +819,7 @@ void clif_dropflooritem(struct flooritem_data* fitem) {
p.subX = fitem->subx;
p.subY = fitem->suby;
p.count = fitem->item_data.amount;
-#ifdef PACKETVER_ZERO
+#if defined(PACKETVER_ZERO) || PACKETVER >= 20180418
if (fitem->showdropeffect) {
p.showdropeffect = itemdb_showdropeffect(fitem->item_data.nameid);
p.dropeffectmode = itemdb_dropeffectmode(fitem->item_data.nameid);
@@ -20519,7 +20519,7 @@ void clif_parse_open_ui_request(int fd, struct map_session_data *sd)
void clif_open_ui(struct map_session_data *sd, int8 UIType)
{
-#if PACKETVER_RE_NUM >= 20180307 || PACKETVER_MAIN_NUM >= 20180404
+#if PACKETVER_RE_NUM >= 20180307 || PACKETVER_MAIN_NUM >= 20180404 || PACKETVER_ZERO_NUM >= 20180411
int claimed = 0;
struct PACKET_ZC_OPEN_UI p;
@@ -20542,14 +20542,14 @@ void clif_open_ui(struct map_session_data *sd, int8 UIType)
clif->send(&p, sizeof(p), &sd->bl, SELF);
#else
- ShowWarning("Attendance System available only for PACKETVER_RE_NUM >= 20180307 || PACKETVER_MAIN_NUM >= 20180404.\n");
+ ShowWarning("Attendance System available only for PACKETVER_RE_NUM >= 20180307 || PACKETVER_MAIN_NUM >= 20180404 || PACKETVER_ZERO_NUM >= 20180411.\n");
#endif
}
void clif_parse_attendance_reward_request(int fd, struct map_session_data *sd) __attribute__((nonnull(2)));
void clif_parse_attendance_reward_request(int fd, struct map_session_data *sd)
{
-#if PACKETVER_RE_NUM >= 20180307 || PACKETVER_MAIN_NUM >= 20180404
+#if PACKETVER_RE_NUM >= 20180307 || PACKETVER_MAIN_NUM >= 20180404 || PACKETVER_ZERO_NUM >= 20180411
struct rodex_message msg = { 0 };
struct attendance_entry *entry;
@@ -20593,7 +20593,7 @@ void clif_parse_attendance_reward_request(int fd, struct map_session_data *sd)
intif->rodex_sendmail(&msg);
clif->ui_action(sd, 0, sd->status.attendance_count);
#else
- ShowWarning("Attendance System available only for PACKETVER_RE_NUM >= 20180307 || PACKETVER_MAIN_NUM >= 20180404.\n");
+ ShowWarning("Attendance System available only for PACKETVER_RE_NUM >= 20180307 || PACKETVER_MAIN_NUM >= 20180404 || PACKETVER_ZERO_NUM >= 20180411.\n");
#endif
}
diff --git a/src/map/packets_struct.h b/src/map/packets_struct.h
index 438084778..5b9a4344a 100644
--- a/src/map/packets_struct.h
+++ b/src/map/packets_struct.h
@@ -191,7 +191,7 @@ enum packet_headers {
skill_entryType = 0x9ca,
#endif
graffiti_entryType = 0x1c9,
-#ifdef PACKETVER_ZERO
+#if defined(PACKETVER_ZERO) || PACKETVER >= 20180418
dropflooritemType = 0xadd,
#elif PACKETVER > 20130000 /* not sure date */
dropflooritemType = 0x84b,
@@ -530,7 +530,7 @@ struct packet_dropflooritem {
uint8 subX;
uint8 subY;
int16 count;
-#ifdef PACKETVER_ZERO
+#if defined(PACKETVER_ZERO) || PACKETVER >= 20180418
int8 showdropeffect;
int16 dropeffectmode;
#endif
diff --git a/src/map/status.c b/src/map/status.c
index b2f67735b..a39449b11 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -10189,8 +10189,8 @@ void status_change_start_stop_action(struct block_list *bl, enum sc_type type)
* @param val3 Additional value (meaning depends on type).
* @param val4 Additional value (meaning depends on type).
*
- * @retval 0 if no status change happened.
- * @retval 1 if the status change was successfully applied.
+ * @retval false if no status change happened, or the other sc can be started regardless.
+ * @retval true if the status change was successfully applied and the other sc shouldn't be started.
*/
bool status_end_sc_before_start(struct block_list *bl, struct status_data *st, struct status_change* sc, enum sc_type type, int undead_flag, int val1, int val2, int val3, int val4)
{
@@ -10200,14 +10200,22 @@ bool status_end_sc_before_start(struct block_list *bl, struct status_data *st, s
switch (type) {
case SC_BLESSING:
- //TO-DO Blessing and Agi up should do 1 damage against players on Undead Status, even on PvM
- //but cannot be plagiarized (this requires aegis investigation on packets and official behavior) [Brainstorm]
- if ((!undead_flag && st->race != RC_DEMON) || bl->type == BL_PC) {
- status_change_end(bl, SC_CURSE, INVALID_TIMER);
- if (sc->data[SC_STONE] && sc->opt1 == OPT1_STONE)
+ // TODO: Blessing and Agi up should do 1 damage against players on Undead Status, even on PvM
+ // but cannot be plagiarized (this requires aegis investigation on packets and official behavior) [Brainstorm]
+ if ((undead_flag == 0 && st->race != RC_DEMON) || bl->type == BL_PC) {
+ bool prevent_start = false;
+ if (sc->data[SC_CURSE] != NULL) {
+ prevent_start = true;
+ status_change_end(bl, SC_CURSE, INVALID_TIMER);
+ }
+ if (sc->data[SC_STONE] != NULL && sc->opt1 == OPT1_STONE) {
+ prevent_start = true;
status_change_end(bl, SC_STONE, INVALID_TIMER);
+ }
+ if (prevent_start)
+ return true;
}
- if (sc->data[SC_SOULLINK] && sc->data[SC_SOULLINK]->val2 == SL_HIGH)
+ if (sc->data[SC_SOULLINK] != NULL && sc->data[SC_SOULLINK]->val2 == SL_HIGH)
status_change_end(bl, SC_SOULLINK, INVALID_TIMER);
break;
case SC_INC_AGI:
diff --git a/src/plugins/HPMHooking/HPMHooking.Defs.inc b/src/plugins/HPMHooking/HPMHooking.Defs.inc
index c11c9c3c0..d2b03c16c 100644
--- a/src/plugins/HPMHooking/HPMHooking.Defs.inc
+++ b/src/plugins/HPMHooking/HPMHooking.Defs.inc
@@ -6068,18 +6068,28 @@ typedef void (*HPMHOOK_pre_pincode_error) (int *account_id);
typedef void (*HPMHOOK_post_pincode_error) (int account_id);
typedef void (*HPMHOOK_pre_pincode_update) (int *account_id, char **pin);
typedef void (*HPMHOOK_post_pincode_update) (int account_id, char *pin);
-typedef void (*HPMHOOK_pre_pincode_sendstate) (int *fd, struct char_session_data **sd, uint16 *state);
-typedef void (*HPMHOOK_post_pincode_sendstate) (int fd, struct char_session_data *sd, uint16 state);
+typedef void (*HPMHOOK_pre_pincode_makestate) (int *fd, struct char_session_data **sd, enum pincode_make_response *state);
+typedef void (*HPMHOOK_post_pincode_makestate) (int fd, struct char_session_data *sd, enum pincode_make_response state);
+typedef void (*HPMHOOK_pre_pincode_editstate) (int *fd, struct char_session_data **sd, enum pincode_edit_response *state);
+typedef void (*HPMHOOK_post_pincode_editstate) (int fd, struct char_session_data *sd, enum pincode_edit_response state);
+typedef void (*HPMHOOK_pre_pincode_loginstate) (int *fd, struct char_session_data **sd, enum pincode_login_response *state);
+typedef void (*HPMHOOK_post_pincode_loginstate) (int fd, struct char_session_data *sd, enum pincode_login_response state);
typedef void (*HPMHOOK_pre_pincode_setnew) (int *fd, struct char_session_data **sd);
typedef void (*HPMHOOK_post_pincode_setnew) (int fd, struct char_session_data *sd);
typedef void (*HPMHOOK_pre_pincode_change) (int *fd, struct char_session_data **sd);
typedef void (*HPMHOOK_post_pincode_change) (int fd, struct char_session_data *sd);
+typedef bool (*HPMHOOK_pre_pincode_isBlacklisted) (const char **pin);
+typedef bool (*HPMHOOK_post_pincode_isBlacklisted) (bool retVal___, const char *pin);
typedef int (*HPMHOOK_pre_pincode_compare) (int *fd, struct char_session_data **sd, char **pin);
typedef int (*HPMHOOK_post_pincode_compare) (int retVal___, int fd, struct char_session_data *sd, char *pin);
typedef void (*HPMHOOK_pre_pincode_check) (int *fd, struct char_session_data **sd);
typedef void (*HPMHOOK_post_pincode_check) (int fd, struct char_session_data *sd);
typedef bool (*HPMHOOK_pre_pincode_config_read) (const char **filename, const struct config_t **config, bool *imported);
typedef bool (*HPMHOOK_post_pincode_config_read) (bool retVal___, const char *filename, const struct config_t *config, bool imported);
+typedef void (*HPMHOOK_pre_pincode_init) (void);
+typedef void (*HPMHOOK_post_pincode_init) (void);
+typedef void (*HPMHOOK_pre_pincode_final) (void);
+typedef void (*HPMHOOK_post_pincode_final) (void);
#endif // CHAR_PINCODE_H
#ifdef MAP_QUEST_H /* quest */
typedef void (*HPMHOOK_pre_quest_init) (bool *minimal);
diff --git a/src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc
index d0b4ac5ce..d81709ff3 100644
--- a/src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc
+++ b/src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc
@@ -1248,18 +1248,28 @@ struct {
struct HPMHookPoint *HP_pincode_error_post;
struct HPMHookPoint *HP_pincode_update_pre;
struct HPMHookPoint *HP_pincode_update_post;
- struct HPMHookPoint *HP_pincode_sendstate_pre;
- struct HPMHookPoint *HP_pincode_sendstate_post;
+ struct HPMHookPoint *HP_pincode_makestate_pre;
+ struct HPMHookPoint *HP_pincode_makestate_post;
+ struct HPMHookPoint *HP_pincode_editstate_pre;
+ struct HPMHookPoint *HP_pincode_editstate_post;
+ struct HPMHookPoint *HP_pincode_loginstate_pre;
+ struct HPMHookPoint *HP_pincode_loginstate_post;
struct HPMHookPoint *HP_pincode_setnew_pre;
struct HPMHookPoint *HP_pincode_setnew_post;
struct HPMHookPoint *HP_pincode_change_pre;
struct HPMHookPoint *HP_pincode_change_post;
+ struct HPMHookPoint *HP_pincode_isBlacklisted_pre;
+ struct HPMHookPoint *HP_pincode_isBlacklisted_post;
struct HPMHookPoint *HP_pincode_compare_pre;
struct HPMHookPoint *HP_pincode_compare_post;
struct HPMHookPoint *HP_pincode_check_pre;
struct HPMHookPoint *HP_pincode_check_post;
struct HPMHookPoint *HP_pincode_config_read_pre;
struct HPMHookPoint *HP_pincode_config_read_post;
+ struct HPMHookPoint *HP_pincode_init_pre;
+ struct HPMHookPoint *HP_pincode_init_post;
+ struct HPMHookPoint *HP_pincode_final_pre;
+ struct HPMHookPoint *HP_pincode_final_post;
struct HPMHookPoint *HP_rnd_init_pre;
struct HPMHookPoint *HP_rnd_init_post;
struct HPMHookPoint *HP_rnd_final_pre;
@@ -2777,18 +2787,28 @@ struct {
int HP_pincode_error_post;
int HP_pincode_update_pre;
int HP_pincode_update_post;
- int HP_pincode_sendstate_pre;
- int HP_pincode_sendstate_post;
+ int HP_pincode_makestate_pre;
+ int HP_pincode_makestate_post;
+ int HP_pincode_editstate_pre;
+ int HP_pincode_editstate_post;
+ int HP_pincode_loginstate_pre;
+ int HP_pincode_loginstate_post;
int HP_pincode_setnew_pre;
int HP_pincode_setnew_post;
int HP_pincode_change_pre;
int HP_pincode_change_post;
+ int HP_pincode_isBlacklisted_pre;
+ int HP_pincode_isBlacklisted_post;
int HP_pincode_compare_pre;
int HP_pincode_compare_post;
int HP_pincode_check_pre;
int HP_pincode_check_post;
int HP_pincode_config_read_pre;
int HP_pincode_config_read_post;
+ int HP_pincode_init_pre;
+ int HP_pincode_init_post;
+ int HP_pincode_final_pre;
+ int HP_pincode_final_post;
int HP_rnd_init_pre;
int HP_rnd_init_post;
int HP_rnd_final_pre;
diff --git a/src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc
index 36a115e1b..26ee54453 100644
--- a/src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc
+++ b/src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc
@@ -666,12 +666,17 @@ struct HookingPointData HookingPoints[] = {
{ HP_POP(pincode->decrypt, HP_pincode_decrypt) },
{ HP_POP(pincode->error, HP_pincode_error) },
{ HP_POP(pincode->update, HP_pincode_update) },
- { HP_POP(pincode->sendstate, HP_pincode_sendstate) },
+ { HP_POP(pincode->makestate, HP_pincode_makestate) },
+ { HP_POP(pincode->editstate, HP_pincode_editstate) },
+ { HP_POP(pincode->loginstate, HP_pincode_loginstate) },
{ HP_POP(pincode->setnew, HP_pincode_setnew) },
{ HP_POP(pincode->change, HP_pincode_change) },
+ { HP_POP(pincode->isBlacklisted, HP_pincode_isBlacklisted) },
{ HP_POP(pincode->compare, HP_pincode_compare) },
{ HP_POP(pincode->check, HP_pincode_check) },
{ HP_POP(pincode->config_read, HP_pincode_config_read) },
+ { HP_POP(pincode->init, HP_pincode_init) },
+ { HP_POP(pincode->final, HP_pincode_final) },
/* rnd_interface */
{ HP_POP(rnd->init, HP_rnd_init) },
{ HP_POP(rnd->final, HP_rnd_final) },
diff --git a/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc
index 6ea10f78f..fdec7feea 100644
--- a/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc
+++ b/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc
@@ -16353,13 +16353,13 @@ void HP_pincode_update(int account_id, char *pin) {
}
return;
}
-void HP_pincode_sendstate(int fd, struct char_session_data *sd, uint16 state) {
+void HP_pincode_makestate(int fd, struct char_session_data *sd, enum pincode_make_response state) {
int hIndex = 0;
- if (HPMHooks.count.HP_pincode_sendstate_pre > 0) {
- void (*preHookFunc) (int *fd, struct char_session_data **sd, uint16 *state);
+ if (HPMHooks.count.HP_pincode_makestate_pre > 0) {
+ void (*preHookFunc) (int *fd, struct char_session_data **sd, enum pincode_make_response *state);
*HPMforce_return = false;
- for (hIndex = 0; hIndex < HPMHooks.count.HP_pincode_sendstate_pre; hIndex++) {
- preHookFunc = HPMHooks.list.HP_pincode_sendstate_pre[hIndex].func;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_pincode_makestate_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_pincode_makestate_pre[hIndex].func;
preHookFunc(&fd, &sd, &state);
}
if (*HPMforce_return) {
@@ -16368,12 +16368,64 @@ void HP_pincode_sendstate(int fd, struct char_session_data *sd, uint16 state) {
}
}
{
- HPMHooks.source.pincode.sendstate(fd, sd, state);
+ HPMHooks.source.pincode.makestate(fd, sd, state);
}
- if (HPMHooks.count.HP_pincode_sendstate_post > 0) {
- void (*postHookFunc) (int fd, struct char_session_data *sd, uint16 state);
- for (hIndex = 0; hIndex < HPMHooks.count.HP_pincode_sendstate_post; hIndex++) {
- postHookFunc = HPMHooks.list.HP_pincode_sendstate_post[hIndex].func;
+ if (HPMHooks.count.HP_pincode_makestate_post > 0) {
+ void (*postHookFunc) (int fd, struct char_session_data *sd, enum pincode_make_response state);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_pincode_makestate_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_pincode_makestate_post[hIndex].func;
+ postHookFunc(fd, sd, state);
+ }
+ }
+ return;
+}
+void HP_pincode_editstate(int fd, struct char_session_data *sd, enum pincode_edit_response state) {
+ int hIndex = 0;
+ if (HPMHooks.count.HP_pincode_editstate_pre > 0) {
+ void (*preHookFunc) (int *fd, struct char_session_data **sd, enum pincode_edit_response *state);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_pincode_editstate_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_pincode_editstate_pre[hIndex].func;
+ preHookFunc(&fd, &sd, &state);
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return;
+ }
+ }
+ {
+ HPMHooks.source.pincode.editstate(fd, sd, state);
+ }
+ if (HPMHooks.count.HP_pincode_editstate_post > 0) {
+ void (*postHookFunc) (int fd, struct char_session_data *sd, enum pincode_edit_response state);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_pincode_editstate_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_pincode_editstate_post[hIndex].func;
+ postHookFunc(fd, sd, state);
+ }
+ }
+ return;
+}
+void HP_pincode_loginstate(int fd, struct char_session_data *sd, enum pincode_login_response state) {
+ int hIndex = 0;
+ if (HPMHooks.count.HP_pincode_loginstate_pre > 0) {
+ void (*preHookFunc) (int *fd, struct char_session_data **sd, enum pincode_login_response *state);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_pincode_loginstate_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_pincode_loginstate_pre[hIndex].func;
+ preHookFunc(&fd, &sd, &state);
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return;
+ }
+ }
+ {
+ HPMHooks.source.pincode.loginstate(fd, sd, state);
+ }
+ if (HPMHooks.count.HP_pincode_loginstate_post > 0) {
+ void (*postHookFunc) (int fd, struct char_session_data *sd, enum pincode_login_response state);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_pincode_loginstate_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_pincode_loginstate_post[hIndex].func;
postHookFunc(fd, sd, state);
}
}
@@ -16431,6 +16483,33 @@ void HP_pincode_change(int fd, struct char_session_data *sd) {
}
return;
}
+bool HP_pincode_isBlacklisted(const char *pin) {
+ int hIndex = 0;
+ bool retVal___ = false;
+ if (HPMHooks.count.HP_pincode_isBlacklisted_pre > 0) {
+ bool (*preHookFunc) (const char **pin);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_pincode_isBlacklisted_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_pincode_isBlacklisted_pre[hIndex].func;
+ retVal___ = preHookFunc(&pin);
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return retVal___;
+ }
+ }
+ {
+ retVal___ = HPMHooks.source.pincode.isBlacklisted(pin);
+ }
+ if (HPMHooks.count.HP_pincode_isBlacklisted_post > 0) {
+ bool (*postHookFunc) (bool retVal___, const char *pin);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_pincode_isBlacklisted_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_pincode_isBlacklisted_post[hIndex].func;
+ retVal___ = postHookFunc(retVal___, pin);
+ }
+ }
+ return retVal___;
+}
int HP_pincode_compare(int fd, struct char_session_data *sd, char *pin) {
int hIndex = 0;
int retVal___ = 0;
@@ -16511,6 +16590,58 @@ bool HP_pincode_config_read(const char *filename, const struct config_t *config,
}
return retVal___;
}
+void HP_pincode_init(void) {
+ int hIndex = 0;
+ if (HPMHooks.count.HP_pincode_init_pre > 0) {
+ void (*preHookFunc) (void);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_pincode_init_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_pincode_init_pre[hIndex].func;
+ preHookFunc();
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return;
+ }
+ }
+ {
+ HPMHooks.source.pincode.init();
+ }
+ if (HPMHooks.count.HP_pincode_init_post > 0) {
+ void (*postHookFunc) (void);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_pincode_init_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_pincode_init_post[hIndex].func;
+ postHookFunc();
+ }
+ }
+ return;
+}
+void HP_pincode_final(void) {
+ int hIndex = 0;
+ if (HPMHooks.count.HP_pincode_final_pre > 0) {
+ void (*preHookFunc) (void);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_pincode_final_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_pincode_final_pre[hIndex].func;
+ preHookFunc();
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return;
+ }
+ }
+ {
+ HPMHooks.source.pincode.final();
+ }
+ if (HPMHooks.count.HP_pincode_final_post > 0) {
+ void (*postHookFunc) (void);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_pincode_final_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_pincode_final_post[hIndex].func;
+ postHookFunc();
+ }
+ }
+ return;
+}
/* rnd_interface */
void HP_rnd_init(void) {
int hIndex = 0;