Advertisement
Guest User

Untitled

a guest
Apr 28th, 2015
780
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 74.17 KB | None | 0 0
  1.  src/char/char.c              |   5 +
  2.  src/char/int_guild.c         |   2 +-
  3.  src/common/mmo.h             |  16 ++--
  4.  src/config/classes/general.h |   2 +-
  5.  src/config/core.h            |   6 +-
  6.  src/config/renewal.h         |   5 +-
  7.  src/login/account.h          |   1 +
  8.  src/login/account_sql.c      |   9 +-
  9.  src/login/login.c            |  13 ++-
  10.  src/login/login.h            |   2 +
  11.  src/map/Makefile.in          |   6 +-
  12.  src/map/atcommand.c          | 216 ++++++++++++++++++++++++++++++++++++++++---
  13.  src/map/battle.c             |   8 +-
  14.  src/map/battle.h             |   2 +
  15.  src/map/buyingstore.c        |   6 ++
  16.  src/map/clif.c               | 122 +++++++++++++++++++++---
  17.  src/map/clif.h               |   2 +
  18.  src/map/mail.c               |   6 ++
  19.  src/map/map.c                |  29 ++++++
  20.  src/map/mob.c                |   4 +-
  21.  src/map/npc.c                |   9 ++
  22.  src/map/npc.h                |   2 +
  23.  src/map/packets.h            |   2 +-
  24.  src/map/party.c              |   7 +-
  25.  src/map/pc.c                 |  67 ++++++++++++--
  26.  src/map/pc.h                 |  16 ++++
  27.  src/map/script.c             | 149 ++++++++++++++++++++++++++++-
  28.  src/map/script.h             |   4 +
  29.  src/map/skill.c              | 100 ++++++++++++++++++--
  30.  src/map/status.c             |  38 ++++++--
  31.  src/map/status.h             |   8 ++
  32.  src/map/storage.c            |   6 ++
  33.  src/map/trade.c              |  10 ++
  34.  src/map/unit.c               |   8 ++
  35.  src/plugins/Makefile.in      |   2 +-
  36.  35 files changed, 808 insertions(+), 82 deletions(-)
  37.  
  38. diff --git a/src/char/char.c b/src/char/char.c
  39. index d97cd33..bf0592f 100644
  40. --- a/src/char/char.c
  41. +++ b/src/char/char.c
  42. @@ -2491,6 +2491,11 @@ int char_parse_fromlogin_changesex_reply(int fd)
  43.     }
  44.     SQL->StmtFree(stmt);
  45.  
  46. +#if PACKETVER < 20141022
  47. +   if ( SQL_ERROR == SQL->Query(inter->sql_handle, "UPDATE `%s` SET sex = 'U' WHERE account_id = %d",char_db,acc) )
  48. +       Sql_ShowDebug(inter->sql_handle);
  49. +#endif
  50. +
  51.     // disconnect player if online on char-server
  52.     chr->disconnect_player(acc);
  53.  
  54. diff --git a/src/char/int_guild.c b/src/char/int_guild.c
  55. index 3ba51e1..5e64bac 100644
  56. --- a/src/char/int_guild.c
  57. +++ b/src/char/int_guild.c
  58. @@ -837,7 +837,7 @@ int inter_guild_calcinfo(struct guild *g)
  59.     g->next_exp = nextexp;
  60.  
  61.     // Set the max number of members, Guild Extension skill - currently adds 6 to max per skill lv.
  62. -   g->max_member = 16 + inter_guild->checkskill(g, GD_EXTENSION) * 6;
  63. +   g->max_member = 16 + inter_guild->checkskill(g, GD_EXTENSION) * 2;
  64.     if(g->max_member > MAX_GUILD)
  65.     {
  66.         ShowError("Guild %d:%s has capacity for too many guild members (%d), max supported is %d\n", g->guild_id, g->name, g->max_member, MAX_GUILD);
  67. diff --git a/src/common/mmo.h b/src/common/mmo.h
  68. index 48eba00..852b505 100644
  69. --- a/src/common/mmo.h
  70. +++ b/src/common/mmo.h
  71. @@ -49,7 +49,7 @@
  72.  // 20120307 - 2012-03-07aRagexeRE+ - 0x970
  73.  
  74.  #ifndef PACKETVER
  75. -   #define PACKETVER 20141022
  76. +   #define PACKETVER 20131223
  77.  #endif // PACKETVER
  78.  
  79.  //Uncomment the following line if your client is ragexeRE instead of ragexe (required because of conflicting packets in ragexe vs ragexeRE).
  80. @@ -94,13 +94,13 @@
  81.  
  82.  #define MAX_INVENTORY 100
  83.  //Max number of characters per account. Note that changing this setting alone is not enough if the client is not hexed to support more characters as well.
  84. -#define MAX_CHARS 9
  85. +#define MAX_CHARS 15
  86.  //Number of slots carded equipment can have. Never set to less than 4 as they are also used to keep the data of forged items/equipment. [Skotlex]
  87.  //Note: The client seems unable to receive data for more than 4 slots due to all related packets having a fixed size.
  88.  #define MAX_SLOTS 4
  89.  //Max amount of a single stacked item
  90.  #define MAX_AMOUNT 30000
  91. -#define MAX_ZENY 1000000000
  92. +#define MAX_ZENY 2000000000
  93.  
  94.  //Official Limit: 2.1b ( the var that stores the money doesn't go much higher than this by default )
  95.  #define MAX_BANK_ZENY INT_MAX
  96. @@ -115,11 +115,11 @@
  97.  #define DEFAULT_WALK_SPEED 150
  98.  #define MIN_WALK_SPEED 20 /* below 20 clips animation */
  99.  #define MAX_WALK_SPEED 1000
  100. -#define MAX_STORAGE 600
  101. -#define MAX_GUILD_STORAGE 600
  102. -#define MAX_PARTY 12
  103. -#define MAX_GUILD (16+10*6)     // Increased max guild members +6 per 1 extension levels [Lupus]
  104. -#define MAX_GUILDPOSITION 20    // Increased max guild positions to accommodate for all members [Valaris] (removed) [PoW]
  105. +#define MAX_STORAGE 999
  106. +#define MAX_GUILD_STORAGE 999
  107. +#define MAX_PARTY 20
  108. +#define MAX_GUILD (16+10*2)     // Increased max guild members +6 per 1 extension levels [Lupus]
  109. +#define MAX_GUILDPOSITION 30    // Increased max guild positions to accommodate for all members [Valaris] (removed) [PoW]
  110.  #define MAX_GUILDEXPULSION 32
  111.  #define MAX_GUILDALLIANCE 16
  112.  #define MAX_GUILDSKILL 15       // Increased max guild skills because of new skills [Sara-chan]
  113. diff --git a/src/config/classes/general.h b/src/config/classes/general.h
  114. index b75c907..9027582 100644
  115. --- a/src/config/classes/general.h
  116. +++ b/src/config/classes/general.h
  117. @@ -30,7 +30,7 @@
  118.   * when enabled, reflect damage doesn't bypass devotion (and thus damage is passed to crusader)
  119.   * uncomment to enable
  120.   **/
  121. -//#define DEVOTION_REFLECT_DAMAGE
  122. +#define DEVOTION_REFLECT_DAMAGE
  123.  
  124.  /**
  125.   * No settings past this point
  126. diff --git a/src/config/core.h b/src/config/core.h
  127. index da9296b..43b4b1f 100644
  128. --- a/src/config/core.h
  129. +++ b/src/config/core.h
  130. @@ -14,7 +14,7 @@
  131.  /// The official walkpath disables users from taking non-clear walk paths,
  132.  /// e.g. if they want to get around an obstacle they have to walk around it,
  133.  /// while with OFFICIAL_WALKPATH disabled if they click to walk around a obstacle the server will do it automatically
  134. -#define OFFICIAL_WALKPATH
  135. +//#define OFFICIAL_WALKPATH
  136.  
  137.  /// leave this line uncommented to enable callfunc checks when processing scripts.
  138.  /// while allowed, the script engine will attempt to match user-defined functions
  139. @@ -45,7 +45,7 @@
  140.  /// Client-sided range checks are, however, are always circular.
  141.  /// Enabling this changes all checks to circular checks, which is more realistic,
  142.  /// - but is not the official behaviour.
  143. -//#define CIRCULAR_AREA
  144. +#define CIRCULAR_AREA
  145.  
  146.  //This is the distance at which @autoloot works,
  147.  //if the item drops farther from the player than this,
  148. @@ -66,7 +66,7 @@
  149.  
  150.  
  151.  /// Comment to disable autotrade persistency (where autotrading merchants survive server restarts)
  152. -#define AUTOTRADE_PERSISTENCY
  153. +//#define AUTOTRADE_PERSISTENCY
  154.  
  155.  /**
  156.   * No settings past this point
  157. diff --git a/src/config/renewal.h b/src/config/renewal.h
  158. index 939ad9b..49da009 100644
  159. --- a/src/config/renewal.h
  160. +++ b/src/config/renewal.h
  161. @@ -13,6 +13,9 @@
  162.   * @INFO: This file holds general-purpose renewal settings, for class-specific ones check /src/config/classes folder
  163.   **/
  164.  
  165. +/// Enable achievement system
  166. +#define ACHIEVEMENT
  167. +
  168.  /**
  169.   * Renewal full toggle switch.
  170.   *
  171. @@ -21,7 +24,7 @@
  172.   * line, by passing --disable-renewal to the configure script:
  173.   * ./configure --disable-renewal
  174.   */
  175. -//#define DISABLE_RENEWAL
  176. +#define DISABLE_RENEWAL
  177.  
  178.  
  179.  #ifndef DISABLE_RENEWAL // Do not change this line
  180. diff --git a/src/login/account.h b/src/login/account.h
  181. index 82ae28b..6a5c597 100644
  182. --- a/src/login/account.h
  183. +++ b/src/login/account.h
  184. @@ -25,6 +25,7 @@ struct mmo_account
  185.     char pass[32+1];            // 23+1 for plaintext, 32+1 for md5-ed passwords
  186.     char sex;                   // gender (M/F/S)
  187.     char email[40];             // e-mail (by default: a@a.com)
  188. +   char mac_address[20];       // Mac Check
  189.     int group_id;               // player group id
  190.     uint8 char_slots;           // this accounts maximum character slots (maximum is limited to MAX_CHARS define in char server)
  191.     unsigned int state;         // packet 0x006a value + 1 (0: complete OK)
  192. diff --git a/src/login/account_sql.c b/src/login/account_sql.c
  193. index 8975250..44b4753 100644
  194. --- a/src/login/account_sql.c
  195. +++ b/src/login/account_sql.c
  196. @@ -566,7 +566,7 @@ static bool mmo_auth_fromsql(AccountDB_SQL* db, struct mmo_account* acc, int acc
  197.     sql_handle = db->accounts;
  198.     // retrieve login entry for the specified account
  199.     if( SQL_ERROR == SQL->Query(sql_handle,
  200. -       "SELECT `account_id`,`userid`,`user_pass`,`sex`,`email`,`group_id`,`state`,`unban_time`,`expiration_time`,`logincount`,`lastlogin`,`last_ip`,`birthdate`,`character_slots`,`pincode`,`pincode_change` FROM `%s` WHERE `account_id` = %d",
  201. +       "SELECT `account_id`,`userid`,`user_pass`,`sex`,`email`,`group_id`,`state`,`unban_time`,`expiration_time`,`logincount`,`lastlogin`,`last_ip`,`birthdate`,`character_slots`,`pincode`,`pincode_change`,`last_mac` FROM `%s` WHERE `account_id` = %d",
  202.         db->account_db, account_id )
  203.     ) {
  204.         Sql_ShowDebug(sql_handle);
  205. @@ -595,6 +595,7 @@ static bool mmo_auth_fromsql(AccountDB_SQL* db, struct mmo_account* acc, int acc
  206.     SQL->GetData(sql_handle, 13, &data, NULL); acc->char_slots = (uint8)atoi(data);
  207.     SQL->GetData(sql_handle, 14, &data, NULL); safestrncpy(acc->pincode, data, sizeof(acc->pincode));
  208.     SQL->GetData(sql_handle, 15, &data, NULL); acc->pincode_change = (unsigned int)atol(data);
  209. +   SQL->GetData(sql_handle, 16, &data, NULL); safestrncpy(acc->mac_address, data, sizeof(acc->mac_address));
  210.  
  211.     SQL->FreeResult(sql_handle);
  212.  
  213. @@ -624,7 +625,7 @@ static bool mmo_auth_tosql(AccountDB_SQL* db, const struct mmo_account* acc, boo
  214.     if( is_new )
  215.     {// insert into account table
  216.         if( SQL_SUCCESS != SQL->StmtPrepare(stmt,
  217. -           "INSERT INTO `%s` (`account_id`, `userid`, `user_pass`, `sex`, `email`, `group_id`, `state`, `unban_time`, `expiration_time`, `logincount`, `lastlogin`, `last_ip`, `birthdate`, `character_slots`, `pincode`, `pincode_change`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
  218. +           "INSERT INTO `%s` (`account_id`, `userid`, `user_pass`, `sex`, `email`, `group_id`, `state`, `unban_time`, `expiration_time`, `logincount`, `lastlogin`, `last_ip`, `birthdate`, `character_slots`, `pincode`, `pincode_change`, `last_mac`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
  219.             db->account_db)
  220.         ||  SQL_SUCCESS != SQL->StmtBindParam(stmt,  0, SQLDT_INT,    (void*)&acc->account_id,      sizeof(acc->account_id))
  221.         ||  SQL_SUCCESS != SQL->StmtBindParam(stmt,  1, SQLDT_STRING, (void*)acc->userid,           strlen(acc->userid))
  222. @@ -642,13 +643,14 @@ static bool mmo_auth_tosql(AccountDB_SQL* db, const struct mmo_account* acc, boo
  223.         ||  SQL_SUCCESS != SQL->StmtBindParam(stmt, 13, SQLDT_UCHAR,  (void*)&acc->char_slots,      sizeof(acc->char_slots))
  224.         ||  SQL_SUCCESS != SQL->StmtBindParam(stmt, 14, SQLDT_STRING, (void*)&acc->pincode,         strlen(acc->pincode))
  225.         ||  SQL_SUCCESS != SQL->StmtBindParam(stmt, 15, SQLDT_LONG,   (void*)&acc->pincode_change,  sizeof(acc->pincode_change))
  226. +       ||  SQL_SUCCESS != SQL->StmtBindParam(stmt, 16, SQLDT_STRING, (void*)acc->mac_address,     strlen(acc->mac_address))
  227.         ||  SQL_SUCCESS != SQL->StmtExecute(stmt)
  228.         ) {
  229.             SqlStmt_ShowDebug(stmt);
  230.             break;
  231.         }
  232.     } else {// update account table
  233. -       if( SQL_SUCCESS != SQL->StmtPrepare(stmt, "UPDATE `%s` SET `userid`=?,`user_pass`=?,`sex`=?,`email`=?,`group_id`=?,`state`=?,`unban_time`=?,`expiration_time`=?,`logincount`=?,`lastlogin`=?,`last_ip`=?,`birthdate`=?,`character_slots`=?,`pincode`=?,`pincode_change`=? WHERE `account_id` = '%d'", db->account_db, acc->account_id)
  234. +       if( SQL_SUCCESS != SQL->StmtPrepare(stmt, "UPDATE `%s` SET `userid`=?,`user_pass`=?,`sex`=?,`email`=?,`group_id`=?,`state`=?,`unban_time`=?,`expiration_time`=?,`logincount`=?,`lastlogin`=?,`last_ip`=?,`birthdate`=?,`character_slots`=?,`pincode`=?,`pincode_change`=?, `last_mac`=? WHERE `account_id` = '%d'", db->account_db, acc->account_id)
  235.         ||  SQL_SUCCESS != SQL->StmtBindParam(stmt,  0, SQLDT_STRING, (void*)acc->userid,           strlen(acc->userid))
  236.         ||  SQL_SUCCESS != SQL->StmtBindParam(stmt,  1, SQLDT_STRING, (void*)acc->pass,             strlen(acc->pass))
  237.         ||  SQL_SUCCESS != SQL->StmtBindParam(stmt,  2, SQLDT_ENUM,   (void*)&acc->sex,             sizeof(acc->sex))
  238. @@ -664,6 +666,7 @@ static bool mmo_auth_tosql(AccountDB_SQL* db, const struct mmo_account* acc, boo
  239.         ||  SQL_SUCCESS != SQL->StmtBindParam(stmt, 12, SQLDT_UCHAR,  (void*)&acc->char_slots,      sizeof(acc->char_slots))
  240.         ||  SQL_SUCCESS != SQL->StmtBindParam(stmt, 13, SQLDT_STRING, (void*)&acc->pincode,         strlen(acc->pincode))
  241.         ||  SQL_SUCCESS != SQL->StmtBindParam(stmt, 14, SQLDT_LONG,   (void*)&acc->pincode_change,  sizeof(acc->pincode_change))
  242. +       ||  SQL_SUCCESS != SQL->StmtBindParam(stmt, 15, SQLDT_STRING, (void*)acc->mac_address,      strlen(acc->mac_address))
  243.         ||  SQL_SUCCESS != SQL->StmtExecute(stmt)
  244.         ) {
  245.             SqlStmt_ShowDebug(stmt);
  246. diff --git a/src/login/login.c b/src/login/login.c
  247. index 95cbab7..1c5097b 100644
  248. --- a/src/login/login.c
  249. +++ b/src/login/login.c
  250. @@ -1199,6 +1199,8 @@ int login_mmo_auth(struct login_session_data* sd, bool isServer) {
  251.     sd->group_id = (uint8)acc.group_id;
  252.     sd->expiration_time = acc.expiration_time;
  253.  
  254. +   memcpy(acc.mac_address, sd->mac_address, sizeof(acc.mac_address));
  255. +
  256.     // update account data
  257.     timestamp2string(acc.lastlogin, sizeof(acc.lastlogin), time(NULL), "%Y-%m-%d %H:%M:%S");
  258.     safestrncpy(acc.last_ip, ip, sizeof(acc.last_ip));
  259. @@ -1395,8 +1397,11 @@ void login_auth_failed(struct login_session_data* sd, int result)
  260.         login_log(ip, sd->userid, result, error);
  261.     }
  262.  
  263. -   if( result == 1 && login_config.dynamic_pass_failure_ban )
  264. -       ipban_log(ip); // log failed password attempt
  265. +   if( result == 1) {
  266. +   if (!login_config.dynamic_pass_failure_ban)
  267. +       return;
  268. +       ipban_log(ip);
  269. +   }
  270.  
  271.  #if PACKETVER >= 20120000 /* not sure when this started */
  272.     WFIFOHEAD(fd,26);
  273. @@ -1462,8 +1467,12 @@ bool login_parse_client_login(int fd, struct login_session_data* sd, const char
  274.     {
  275.         char *accname = (char *)RFIFOP(fd, 9);
  276.         char *token = (char *)RFIFOP(fd, 0x5C);
  277. +       char *mac = {(char *)RFIFOP(fd, 60)};
  278.         size_t uAccLen = strlen(accname);
  279. +       size_t uMac = 18;
  280.         size_t uTokenLen = RFIFOREST(fd) - 0x5C;
  281. +       safestrncpy(mac,mac, uMac);
  282. +       safestrncpy(sd->mac_address,mac, uMac);
  283.  
  284.         version = RFIFOL(fd,4);
  285.  
  286. diff --git a/src/login/login.h b/src/login/login.h
  287. index 7254b5d..e7b61fc 100644
  288. --- a/src/login/login.h
  289. +++ b/src/login/login.h
  290. @@ -34,6 +34,8 @@ struct login_session_data {
  291.     char md5key[20];
  292.     uint16 md5keylen;
  293.  
  294. +   char mac_address[20];
  295. +
  296.     char lastlogin[24];
  297.     uint8 group_id;
  298.     uint8 clienttype;
  299. diff --git a/src/map/Makefile.in b/src/map/Makefile.in
  300. index 90bb556..4bb7e2e 100644
  301. --- a/src/map/Makefile.in
  302. +++ b/src/map/Makefile.in
  303. @@ -29,7 +29,7 @@ MAP_C = atcommand.c battle.c battleground.c buyingstore.c channel.c chat.c \
  304.          pet.c quest.c script.c searchstore.c skill.c status.c storage.c \
  305.          trade.c unit.c vending.c
  306.  MAP_OBJ = $(addprefix obj_sql/, $(patsubst %c,%o,$(MAP_C)))
  307. -MAP_H = atcommand.h battle.h battleground.h buyingstore.h channel.h chat.h \
  308. +MAP_H = adelays.h atcommand.h battle.h battleground.h buyingstore.h channel.h chat.h \
  309.          chrif.h clif.h date.h duel.h elemental.h guild.h homunculus.h HPMmap.h \
  310.          instance.h intif.h irc-bot.h itemdb.h log.h mail.h map.h mapreg.h \
  311.          mercenary.h mob.h npc.h packets.h packets_struct.h party.h path.h \
  312. @@ -104,8 +104,8 @@ map-server: ../../map-server@EXEEXT@
  313.  
  314.  ../../map-server@EXEEXT@: $(MAP_SERVER_SQL_DEPENDS) Makefile
  315.     @echo " LD  $(notdir $@)"
  316. -   @$(CC) @STATIC@ @LDFLAGS@ -o ../../map-server@EXEEXT@ $(MAP_OBJ) $(COMMON_D)/obj_sql/common_sql.a \
  317. -       $(COMMON_D)/obj_all/common.a $(MT19937AR_OBJ) $(LIBCONFIG_OBJ) @LIBS@ @PCRE_LIBS@ @MYSQL_LIBS@
  318. +   @$(CC) @STATIC@ @LDFLAGS@ -o ../../map-server@EXEEXT@ $(MAP_OBJ) adelays64.a $(COMMON_D)/obj_sql/common_sql.a \
  319. +       $(COMMON_D)/obj_all/common.a $(MT19937AR_OBJ) $(LIBCONFIG_OBJ) @LIBS@ @PCRE_LIBS@ @MYSQL_LIBS@ -lcurl
  320.  
  321.  # map object files
  322.  
  323. diff --git a/src/map/atcommand.c b/src/map/atcommand.c
  324. index b9b4704..3d18c3c 100644
  325. --- a/src/map/atcommand.c
  326. +++ b/src/map/atcommand.c
  327. @@ -13,6 +13,7 @@
  328.  #include <string.h>
  329.  
  330.  #include "HPMmap.h"
  331. +#include "adelays.h"
  332.  #include "battle.h"
  333.  #include "channel.h"
  334.  #include "chat.h"
  335. @@ -1157,7 +1158,7 @@ static inline const char* atcommand_help_string(AtCommandInfo *info) {
  336.  ACMD(item)
  337.  {
  338.     char item_name[100];
  339. -   int number = 0, item_id, flag = 0, bound = 0;
  340. +   int number = 0, item_id, flag = 0, bound = 0, costume = 0;
  341.     struct item item_tmp;
  342.     struct item_data *item_data;
  343.     int get_count, i;
  344. @@ -1212,6 +1213,26 @@ static inline const char* atcommand_help_string(AtCommandInfo *info) {
  345.         }
  346.     }
  347.  
  348. +       if( !strcmpi(command+1,"costumeitem") )
  349. +   {
  350. +       if( !battle_config.reserved_costume_id )
  351. +       {
  352. +           clif->message(fd, "Costume conversion is disable. Set a value for reserved_cosutme_id on your battle.conf file.");
  353. +           return -1;
  354. +       }
  355. +       if( !(item_data->equip&EQP_HEAD_LOW) &&
  356. +           !(item_data->equip&EQP_HEAD_MID) &&
  357. +           !(item_data->equip&EQP_HEAD_TOP) &&
  358. +           !(item_data->equip&EQP_COSTUME_HEAD_LOW) &&
  359. +           !(item_data->equip&EQP_COSTUME_HEAD_MID) &&
  360. +           !(item_data->equip&EQP_COSTUME_HEAD_TOP) )
  361. +       {
  362. +           clif->message(fd, "You cannot costume this item. Costume only work for headgears.");
  363. +           return -1;
  364. +       }
  365. +       costume = 1;
  366. +   }
  367. +
  368.     item_id = item_data->nameid;
  369.     get_count = number;
  370.     //Check if it's stackable.
  371. @@ -1231,6 +1252,13 @@ static inline const char* atcommand_help_string(AtCommandInfo *info) {
  372.             item_tmp.identify = 1;
  373.             item_tmp.bound = (unsigned char)bound;
  374.  
  375. +           if( costume == 1 )
  376. +           {
  377. +               item_tmp.card[0] = CARD0_CREATE;
  378. +               item_tmp.card[2] = GetWord(battle_config.reserved_costume_id, 0);
  379. +               item_tmp.card[3] = GetWord(battle_config.reserved_costume_id, 1);
  380. +           }
  381. +          
  382.             if ((flag = pc->additem(sd, &item_tmp, get_count, LOG_TYPE_COMMAND)))
  383.                 clif->additem(sd, 0, 0, flag);
  384.         }
  385. @@ -5409,23 +5437,23 @@ void getring(struct map_session_data* sd) {
  386.   * Marry two players
  387.   *------------------------------------------*/
  388.  ACMD(marry) {
  389. -   struct map_session_data *pl_sd = NULL;
  390. -   char player_name[NAME_LENGTH] = "";
  391. +   struct map_session_data *pl_sd, *pl_sd2 = NULL;
  392. +   char player_name[NAME_LENGTH], player_name2[NAME_LENGTH] = "";
  393.  
  394. -   if (!message || !*message || sscanf(message, "%23s", player_name) != 1) {
  395. -       clif->message(fd, msg_fd(fd,1172)); // Usage: @marry <char name>
  396. +   if (!message || !*message || sscanf(message, "%23s %23s", player_name, player_name2) < 2) {
  397. +       clif->message(fd, "Usage: @marry <char name> <char name>"); // Usage: @marry <char name>
  398.         return false;
  399.     }
  400.  
  401. -   if ((pl_sd = map->nick2sd(player_name)) == NULL) {
  402. +   if (((pl_sd = map->nick2sd(player_name)) == NULL) || ((pl_sd2 = map->nick2sd(player_name2)) == NULL)) {
  403.         clif->message(fd, msg_fd(fd,3));
  404.         return false;
  405.     }
  406.  
  407. -   if (pc->marriage(sd, pl_sd) == 0) {
  408. +   if (pc->marriage(pl_sd2, pl_sd) == 0) {
  409.         clif->message(fd, msg_fd(fd,1173)); // They are married... wish them well.
  410.         clif->wedding_effect(&pl_sd->bl); //wedding effect and music [Lupus]
  411. -       getring(sd); // Auto-give named rings (Aru)
  412. +       getring(pl_sd2); // Auto-give named rings (Aru)
  413.         getring(pl_sd);
  414.         return true;
  415.     }
  416. @@ -5440,13 +5468,29 @@ void getring(struct map_session_data* sd) {
  417.   *------------------------------------------*/
  418.  ACMD(divorce)
  419.  {
  420. -   if (pc->divorce(sd) != 0) {
  421. -       sprintf(atcmd_output, msg_fd(fd,1175), sd->status.name); // '%s' is not married.
  422. +   struct map_session_data *player = NULL;
  423. +
  424. +   if (!message || !*message)
  425. +   {
  426. +       player = sd;
  427. +   }
  428. +   else
  429. +   {
  430. +       if( ( player = map->nick2sd(message) ) == NULL)
  431. +       {
  432. +           sprintf(atcmd_output,"The player %s doesn't exist or he/she offline",message);
  433. +           clif->message(fd,atcmd_output);
  434. +           return false;
  435. +       }
  436. +   }
  437. +
  438. +   if (pc->divorce(player) != 0) {
  439. +       sprintf(atcmd_output, msg_txt(1175), player->status.name); // '%s' is not married.
  440.         clif->message(fd, atcmd_output);
  441.         return false;
  442.     }
  443.  
  444. -   sprintf(atcmd_output, msg_fd(fd,1176), sd->status.name); // '%s' and his/her partner are now divorced.
  445. +   sprintf(atcmd_output, msg_txt(1176), player->status.name); // '%s' and his/her partner are now divorced.
  446.     clif->message(fd, atcmd_output);
  447.     return true;
  448.  }
  449. @@ -6479,6 +6523,8 @@ int atcommand_cleanfloor_sub(struct block_list *bl, va_list ap) {
  450.   *------------------------------------------*/
  451.  ACMD(refresh)
  452.  {
  453. +   sd->ud.canact_tick += 2000;
  454. +   sd->ud.canmove_tick += 2000;
  455.     clif->refresh(sd);
  456.     return true;
  457.  }
  458. @@ -8377,7 +8423,7 @@ void atcommand_commands_sub(struct map_session_data* sd, const int fd, AtCommand
  459.  /*==========================================
  460.   * @commands Lists available @ commands to you
  461.   *------------------------------------------*/
  462. -ACMD(commands)
  463. +ACMD(commandslist)
  464.  {
  465.     atcommand->commands_sub(sd, fd, COMMAND_ATCOMMAND);
  466.     return true;
  467. @@ -9127,8 +9173,8 @@ static inline void atcmd_channel_help(int fd, const char *command, bool can_crea
  468.         } else {
  469.             int v = atoi(sub3);
  470.             if (k == HCS_OPT_MSG_DELAY) {
  471. -               if (v < 0 || v > 10) {
  472. -                   sprintf(atcmd_output, msg_fd(fd,1451), v, opt_str[k]);// value '%d' for option '%s' is out of range (limit is 0-10)
  473. +               if ( (sd->group_id < 1) && (v < 0 || v > 60) ) {
  474. +                   sprintf(atcmd_output, msg_fd(fd,1451), v, opt_str[k]);// value '%d' for option '%s' is out of range (limit is 0-60)
  475.                     clif->message(fd, atcmd_output);
  476.                     return false;
  477.                 }
  478. @@ -9391,6 +9437,132 @@ static inline void atcmd_channel_help(int fd, const char *command, bool can_crea
  479.    
  480.     return true;
  481.  }
  482. +
  483. +/**
  484. + * [Aeva]
  485. + **/
  486. +
  487. +ACMD(arealoot) {
  488. +   if(sd->state.arealoot)
  489. +       sd->state.arealoot = false;
  490. +   else
  491. +       sd->state.arealoot = true;
  492. +
  493. +   sprintf(atcmd_output,"You have turned %s Area Loot",(sd->state.arealoot)? "ON" : "OFF");
  494. +   clif->message(fd,atcmd_output);
  495. +   return true;
  496. +}
  497. +
  498. +ACMD(noattack) {
  499. +   if(sd->state.noattack)
  500. +       sd->state.noattack = false;
  501. +   else
  502. +       sd->state.noattack = true;
  503. +
  504. +   sprintf(atcmd_output,"You have turned %s No Attack",(sd->state.noattack)? "ON" : "OFF");
  505. +   clif->message(fd,atcmd_output);
  506. +   return true;
  507. +}
  508. +
  509. +ACMD(showpartybuff)
  510. +{
  511. +   struct party_data* p = NULL;
  512. +   nullpo_retr(-1, sd);
  513. +
  514. +    if( !sd->status.party_id ) {
  515. +       clif->message(fd, "You are not in the party.");
  516. +       return false;
  517. +    }
  518. +
  519. +   p = party->search(sd->status.party_id);
  520. +
  521. +   if(sd->state.spb)
  522. +       sd->state.spb = false;
  523. +   else
  524. +       sd->state.spb = true;
  525. +
  526. +   sprintf(atcmd_output,"You have turned %s Show Party Buffs",(sd->state.spb)? "ON" : "OFF");
  527. +   clif->message(fd,atcmd_output);
  528. +
  529. +   clif->party_info(p,sd);
  530. +   return true;
  531. +}
  532. +
  533. +ACMD(listenpvp) {
  534. +   if(sd->state.pvp_listen)
  535. +       sd->state.pvp_listen = false;
  536. +   else
  537. +       sd->state.pvp_listen = true;
  538. +
  539. +   sprintf(atcmd_output,"You have turned %s PvP Announce",(sd->state.pvp_listen)? "ON" : "OFF");
  540. +   clif->message(fd,atcmd_output);
  541. +   return true;
  542. +}
  543. +
  544. +#ifdef ADELAYS
  545. +ACMD(adelays)
  546. +{
  547. +   sprintf(atcmd_output, "This server is using Adelays V%.2f. You are protected against Nodelay Users & Speedhacks.", adelays_getVersion());
  548. +   if (!adelays_is_enabled()) {
  549. +       clif->message(fd, "Adelays is not currently activated.");
  550. +   }else{
  551. +       clif->message(fd, atcmd_output);
  552. +   }
  553. +
  554. +   if (pc_get_group_level(sd) > 10){
  555. +       if (sd->adelays_state.adelays_showinfo == 1) {
  556. +           sd->adelays_state.adelays_showinfo = 0;
  557. +           clif->message(fd, "Show Adelays Logs Disabled");
  558. +       }else{
  559. +           sd->adelays_state.adelays_showinfo = 1;
  560. +           clif->message(fd, "Show Adelays Logs Enabled");
  561. +       }
  562. +   }
  563. +   return true;
  564. +}
  565. +
  566. +ACMD(adelayslog)
  567. +{
  568. +
  569. +   if (sd->adelays_state.adelays_log == 1) {
  570. +       sd->adelays_state.adelays_log = 0;
  571. +       if (pc_get_group_level(sd) > 10){
  572. +           clif->message(fd, "Adelays Logs save disabled for you");
  573. +       }
  574. +   }else{
  575. +       sd->adelays_state.adelays_log = 1;
  576. +       if (pc_get_group_level(sd) > 10){
  577. +           clif->message(fd, "Adelays Logs save enabled for you");
  578. +       }
  579. +
  580. +   }
  581. +   return true;
  582. +}
  583. +
  584. +ACMD(adelaysupgrade)
  585. +{
  586. +
  587. +   adelays_get_updates();
  588. +   clif->message(fd, "Adelays files have been upgraded. You have to recompile your server.");
  589. +
  590. +   return true;
  591. +}
  592. +
  593. +ACMD(adelaysreload)
  594. +{
  595. +   adelays_read_db();
  596. +   adelays_battle_config_read();
  597. +   clif->message(fd, "Adelays Config and Database reloaded.");
  598. +
  599. +   return true;
  600. +}
  601. +ACMD(adelaysip)
  602. +{
  603. +   adelays_check_ip(fd);
  604. +   return 0;
  605. +}
  606. +#endif
  607. +
  608.  /**
  609.   * Fills the reference of available commands in atcommand DBMap
  610.   **/
  611. @@ -9401,6 +9573,20 @@ void atcommand_basecommands(void) {
  612.      * Command reference list, place the base of your commands here
  613.      **/
  614.     AtCommandInfo atcommand_base[] = {
  615. +   /* [Aeva] */
  616. +       ACMD_DEF(arealoot),
  617. +       ACMD_DEF(noattack),
  618. +       ACMD_DEF(showpartybuff),
  619. +       ACMD_DEF2("spb", showpartybuff),
  620. +       ACMD_DEF2("costumeitem", item),
  621. +       ACMD_DEF(listenpvp),
  622. +#ifdef ADELAYS
  623. +       ACMD_DEF(adelays),
  624. +       ACMD_DEF(adelayslog),
  625. +       ACMD_DEF(adelaysreload),
  626. +       ACMD_DEF(adelaysupgrade),
  627. +       ACMD_DEF(adelaysip),
  628. +#endif
  629.         ACMD_DEF2("warp", mapmove),
  630.         ACMD_DEF(where),
  631.         ACMD_DEF(jumpto),
  632. @@ -9610,7 +9796,7 @@ void atcommand_basecommands(void) {
  633.         ACMD_DEF2("slaveclone", clone),
  634.         ACMD_DEF2("evilclone", clone),
  635.         ACMD_DEF(tonpc),
  636. -       ACMD_DEF(commands),
  637. +       ACMD_DEF(commandslist),
  638.         ACMD_DEF(noask),
  639.         ACMD_DEF(request),
  640.         ACMD_DEF(homlevel),
  641. diff --git a/src/map/battle.c b/src/map/battle.c
  642. index 31b04ad..8fef514 100644
  643. --- a/src/map/battle.c
  644. +++ b/src/map/battle.c
  645. @@ -22,6 +22,7 @@
  646.  #include "map.h"
  647.  #include "mercenary.h"
  648.  #include "mob.h"
  649. +#include "npc.h"
  650.  #include "party.h"
  651.  #include "path.h"
  652.  #include "pc.h"
  653. @@ -5526,6 +5527,7 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list
  654.         rnd()%100 < tsc->data[SC_SWORDREJECT]->val2
  655.         ) {
  656.         ATK_RATER(50);
  657. +       wd.damage = min(status_get_max_hp(target),wd.damage);
  658.         status_fix_damage(target,src,wd.damage,clif->damage(target,src,0,0,wd.damage,0,0,0));
  659.         clif->skill_nodamage(target,target,ST_REJECTSWORD,tsc->data[SC_SWORDREJECT]->val1,1);
  660.         if( --(tsc->data[SC_SWORDREJECT]->val3) <= 0 )
  661. @@ -5603,7 +5605,7 @@ void battle_reflect_damage(struct block_list *target, struct block_list *src, st
  662.     struct status_change *sc;
  663.     int64 tick = timer->gettick();
  664.     int delay = 50, rdelay = 0;
  665. -#ifdef RENEWAL
  666. +#ifndef RENEWAL
  667.     int max_reflect_damage;
  668.  
  669.     max_reflect_damage = max(status_get_max_hp(target), status_get_max_hp(target) * status->get_lv(target) / 100);
  670. @@ -5614,7 +5616,7 @@ void battle_reflect_damage(struct block_list *target, struct block_list *src, st
  671.     tsd = BL_CAST(BL_PC, target);
  672.     sc = status->get_sc(target);
  673.  
  674. -#ifdef RENEWAL
  675. +#ifndef RENEWAL
  676.  #define NORMALIZE_RDAMAGE(d) ( trdamage += rdamage = max(1, min(max_reflect_damage, (d))) )
  677.  #else
  678.  #define NORMALIZE_RDAMAGE(d) ( trdamage += rdamage = max(1, (d)) )
  679. @@ -7086,6 +7088,8 @@ bool battle_check_range(struct block_list *src, struct block_list *bl, int range
  680.     { "mob_icewall_walk_block",             &battle_config.mob_icewall_walk_block,          75,     0,      255,            },
  681.     { "boss_icewall_walk_block",            &battle_config.boss_icewall_walk_block,         0,      0,      255,            },
  682.     { "feature.roulette",                   &battle_config.feature_roulette,                1,      0,      1,              },
  683. +   { "reserved_costume_id",                &battle_config.reserved_costume_id,             999998, 0,      INT_MAX,        },
  684. +   { "teleport_on_portal",                 &battle_config.teleport_on_portal,              0,      0,      1,              },
  685.  };
  686.  #ifndef STATS_OPT_OUT
  687.  /**
  688. diff --git a/src/map/battle.h b/src/map/battle.h
  689. index b3437db..18dadc2 100644
  690. --- a/src/map/battle.h
  691. +++ b/src/map/battle.h
  692. @@ -486,6 +486,8 @@ struct Battle_Config {
  693.     int stormgust_knockback;
  694.  
  695.     int feature_roulette;
  696. +   int reserved_costume_id;
  697. +   int teleport_on_portal;
  698.  };
  699.  
  700.  #ifdef HERCULES_CORE
  701. diff --git a/src/map/buyingstore.c b/src/map/buyingstore.c
  702. index 85fef98..0645a16 100644
  703. --- a/src/map/buyingstore.c
  704. +++ b/src/map/buyingstore.c
  705. @@ -49,6 +49,12 @@ bool buyingstore_setup(struct map_session_data* sd, unsigned char slots)
  706.         return false;
  707.     }
  708.  
  709. +   if( sd->state.secure_items )
  710. +   {
  711. +       clif->message(sd->fd, "You are protected by @security, You can't do this action.");
  712. +       return false;
  713. +   }  
  714. +
  715.     if( slots > MAX_BUYINGSTORE_SLOTS )
  716.     {
  717.         ShowWarning("buyingstore_setup: Requested %d slots, but server supports only %d slots.\n", (int)slots, MAX_BUYINGSTORE_SLOTS);
  718. diff --git a/src/map/clif.c b/src/map/clif.c
  719. index d28e64c..c17818b 100644
  720. --- a/src/map/clif.c
  721. +++ b/src/map/clif.c
  722. @@ -14,6 +14,7 @@
  723.  #include <time.h>
  724.  
  725.  #include "atcommand.h"
  726. +#include "adelays.h"
  727.  #include "battle.h"
  728.  #include "battleground.h"
  729.  #include "channel.h"
  730. @@ -370,16 +371,19 @@ bool clif_send(const void* buf, int len, struct block_list* bl, enum send_target
  731.     int x0 = 0, x1 = 0, y0 = 0, y1 = 0, fd;
  732.     struct s_mapiterator* iter;
  733.  
  734. -   if( type != ALL_CLIENT )
  735. -       nullpo_ret(bl);
  736. +   /*if( type != ALL_CLIENT )
  737. +       nullpo_ret(bl);*/
  738.  
  739.     sd = BL_CAST(BL_PC, bl);
  740.  
  741.     switch(type) {
  742.  
  743.         case ALL_CLIENT: //All player clients.
  744. +       case PVP_LISTEN:
  745.             iter = mapit_getallusers();
  746.             while( (tsd = (TBL_PC*)mapit->next(iter)) != NULL ) {
  747. +               if( type == PVP_LISTEN && !(tsd->state.pvp_listen || tsd->qd) )
  748. +               continue;
  749.                 WFIFOHEAD(tsd->fd, len);
  750.                 memcpy(WFIFOP(tsd->fd,0), buf, len);
  751.                 WFIFOSET(tsd->fd,len);
  752. @@ -448,6 +452,7 @@ bool clif_send(const void* buf, int len, struct block_list* bl, enum send_target
  753.         case PARTY_WOS:
  754.         case PARTY_SAMEMAP:
  755.         case PARTY_SAMEMAP_WOS:
  756. +       case PARTY_BUFF_INFO:
  757.             if (sd && sd->status.party_id)
  758.                 p = party->search(sd->status.party_id);
  759.  
  760. @@ -462,7 +467,10 @@ bool clif_send(const void* buf, int len, struct block_list* bl, enum send_target
  761.                     if( sd->bl.id == bl->id && (type == PARTY_WOS || type == PARTY_SAMEMAP_WOS || type == PARTY_AREA_WOS) )
  762.                         continue;
  763.  
  764. -                   if( type != PARTY && type != PARTY_WOS && bl->m != sd->bl.m )
  765. +                   if( type != PARTY_BUFF_INFO && type != PARTY && type != PARTY_WOS && bl->m != sd->bl.m )
  766. +                       continue;
  767. +                      
  768. +                   if( type == PARTY_BUFF_INFO && !sd->state.spb )
  769.                         continue;
  770.  
  771.                     if( (type == PARTY_AREA || type == PARTY_AREA_WOS) && (sd->bl.x < x0 || sd->bl.y < y0 || sd->bl.x > x1 || sd->bl.y > y1) )
  772. @@ -1582,6 +1590,12 @@ void clif_walkok(struct map_session_data *sd)
  773.  {
  774.     int fd=sd->fd;
  775.  
  776. +#ifdef ADELAYS
  777. +   if(adelays_is_enabled() && sd) {
  778. +       adelays_set1HitLock(&(sd->adelays_state));
  779. +   }
  780. +#endif
  781. +
  782.     WFIFOHEAD(fd, packet_len(0x87));
  783.     WFIFOW(fd,0)=0x87;
  784.     WFIFOL(fd,2)=(unsigned int)timer->gettick();
  785. @@ -4175,6 +4189,14 @@ int clif_damage(struct block_list* src, struct block_list* dst, int sdelay, int
  786.     damage2 = (int)min(in_damage2,INT_MAX);
  787.  #endif
  788.  
  789. +#ifdef ADELAYS
  790. +if (adelays_is_enabled()){
  791. +    struct map_session_data * dsd;
  792. +    dsd = BL_CAST(BL_PC, dst);
  793. +    adelays_set_damages(NULL, dsd? &(dsd->adelays_state) : NULL, 0, adelays_gettick(), sdelay, damage, div);
  794. +}
  795. +#endif
  796. +
  797.     type = clif_calc_delay(type,div,damage+damage2,ddelay);
  798.  
  799.     p.PacketType = damageType;
  800. @@ -4811,6 +4833,10 @@ void clif_skill_fail(struct map_session_data *sd,uint16 skill_id,enum useskill_f
  801.     if(cause==USESKILL_FAIL_SKILLINTERVAL && !sd->state.showdelay)
  802.         return; //Disable delay failed messages
  803.  
  804. +#ifdef ADELAYS
  805. +   if(sd && adelays_is_enabled()) adelays_skillFailed(&(sd->adelays_state));
  806. +#endif
  807. +
  808.     if(skill_id == RG_SNATCHER && battle_config.display_skill_fail&4)
  809.         return;
  810.  
  811. @@ -4933,6 +4959,14 @@ int clif_skill_damage(struct block_list *src, struct block_list *dst, int64 tick
  812.     }
  813.  #endif
  814.  
  815. +#ifdef ADELAYS
  816. +   if (adelays_is_enabled()){
  817. +       struct map_session_data * dsd;
  818. +       dsd = BL_CAST(BL_PC, dst);
  819. +       adelays_set_damages(NULL, dsd? &(dsd->adelays_state) : NULL, 0, tick, sdelay, damage, div);
  820. +   }
  821. +#endif
  822. +
  823.     //Because the damage delay must be synced with the client, here is where the can-walk tick must be updated. [Skotlex]
  824.     return clif->calc_walkdelay(dst,ddelay,type,damage,div);
  825.  }
  826. @@ -4990,6 +5024,14 @@ int clif_skill_damage2(struct block_list *src, struct block_list *dst, int64 tic
  827.         clif->send(buf,packet_len(0x115),dst,SELF);
  828.     }
  829.  
  830. +#ifdef ADELAYS
  831. +   if (adelays_is_enabled()){
  832. +       struct map_session_data *dsd;
  833. +       dsd = BL_CAST(BL_PC, dst);
  834. +       adelays_set_damages(sd? &(sd->adelays_state) : NULL, dsd? &(dsd->adelays_state) : NULL, skill_id, tick, sdelay, damage, div);
  835. +   }
  836. +#endif
  837. +
  838.     //Because the damage delay must be synced with the client, here is where the can-walk tick must be updated. [Skotlex]
  839.     return clif->calc_walkdelay(dst,ddelay,type,damage,div);
  840.  }
  841. @@ -6284,8 +6326,9 @@ void clif_party_member_info(struct party_data *p, struct map_session_data *sd)
  842.  void clif_party_info(struct party_data* p, struct map_session_data *sd)
  843.  {
  844.     unsigned char buf[2+2+NAME_LENGTH+(4+NAME_LENGTH+MAP_NAME_LENGTH_EXT+1+1)*MAX_PARTY];
  845. -   struct map_session_data* party_sd = NULL;
  846. +   struct map_session_data* party_sd = NULL, *target = NULL;
  847.     int i, c;
  848. +   char output[NAME_LENGTH+10];
  849.  
  850.     nullpo_retv(p);
  851.  
  852. @@ -6312,6 +6355,32 @@ void clif_party_info(struct party_data* p, struct map_session_data *sd)
  853.     } else if (party_sd) { // send to whole party
  854.         clif->send(buf, WBUFW(buf,2), &party_sd->bl, PARTY);
  855.     }
  856. +   for(i = 0; i < MAX_PARTY; i++)
  857. +   {
  858. +       if( (target = p->data[i].sd) )
  859. +       {
  860. +           strcpy(output, "[");
  861. +           if( target->sc.data[SC_BLESSING] ) strcat(output,"B");
  862. +               else strcat(output,"_");
  863. +           if( target->sc.data[SC_INC_AGI] ) strcat(output,"A");
  864. +               else strcat(output,"_");
  865. +           if( target->sc.data[SC_PROTECTWEAPON] && target->sc.data[SC_PROTECTSHIELD] &&
  866. +               target->sc.data[SC_PROTECTARMOR] && target->sc.data[SC_PROTECTHELM] ) strcat(output,"F");
  867. +               else strcat(output,"_");
  868. +           if( target->sc.data[SC_SOULLINK] ) strcat(output,"S");
  869. +               else strcat(output,"_");
  870. +           if( target->sc.data[SC_DEVOTION] ) strcat(output,"+");
  871. +               else strcat(output,"_");
  872. +           strcat(output, "]");
  873. +           strncat(output, p->data[i].sd->status.name, NAME_LENGTH);
  874. +           safestrncpy((char*)WBUFP(buf,28+i*46+4), output, NAME_LENGTH);
  875. +       }
  876. +   }
  877. +
  878. +   if( sd && sd->state.spb )
  879. +       clif->send(buf, WBUFW(buf,2), &sd->bl, SELF);
  880. +   else if( party_sd )
  881. +       clif->send(buf, WBUFW(buf,2), &party_sd->bl, PARTY_BUFF_INFO);
  882.  }
  883.  
  884.  
  885. @@ -9226,10 +9295,10 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) {
  886.     }
  887.  
  888.     if( sd->state.changemap ) {// restore information that gets lost on map-change
  889. -#if PACKETVER >= 20070918
  890. +/*#if PACKETVER >= 20070918
  891.         clif->partyinvitationstate(sd);
  892.         clif->equpcheckbox(sd);
  893. -#endif
  894. +#endif*/
  895.         if( (battle_config.bg_flee_penalty != 100 || battle_config.gvg_flee_penalty != 100)
  896.          && (map_flag_gvg2(sd->state.pmap) || map_flag_gvg2(sd->bl.m)
  897.           || map->list[sd->state.pmap].flag.battleground || map->list[sd->bl.m].flag.battleground) )
  898. @@ -9287,7 +9356,11 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) {
  899.         clif->showvendingboard(&sd->bl,sd->message,0);
  900.     }
  901.  
  902. +#ifndef ACHIEVEMENT
  903.     if(map->list[sd->bl.m].flag.loadevent) // Lance
  904. +#else
  905. +   if( map->list[sd->bl.m].instance_id < 0)  // Instanced Map should not record Acv [Kichi]
  906. +#endif
  907.         npc->script_event(sd, NPCE_LOADMAP);
  908.  
  909.     if (pc->checkskill(sd, SG_DEVIL) && !pc->nextjobexp(sd)) //blindness [Komurka]
  910. @@ -9870,7 +9943,7 @@ void clif_parse_ActionRequest_sub(struct map_session_data *sd, int action_type,
  911.                 return;
  912.             }
  913.            
  914. -           if( pc_cant_act(sd) || pc_issit(sd) || sd->sc.option&OPTION_HIDE )
  915. +           if( pc_cant_act(sd) || pc_issit(sd) || sd->sc.option&OPTION_HIDE || sd->state.noattack )
  916.                 return;
  917.  
  918.             if( sd->sc.option&OPTION_COSTUME )
  919. @@ -10166,8 +10239,10 @@ void clif_parse_TakeItem(int fd, struct map_session_data *sd) {
  920.         if (pc_cant_act(sd))
  921.             break;
  922.  
  923. -       if (!pc->takeitem(sd, fitem))
  924. +       if (!sd->state.arealoot && !pc->takeitem(sd, fitem))
  925.             break;
  926. +       else
  927. +           map->foreachinrange(skill->greed, &fitem->bl, 1, BL_ITEM, &sd->bl);
  928.  
  929.         return;
  930.     } while (0);
  931. @@ -10395,6 +10470,11 @@ void clif_parse_NpcBuyListSend(int fd, struct map_session_data* sd)
  932.  
  933.     if( sd->state.trading || !sd->npc_shopid || pc_has_permission(sd,PC_PERM_DISABLE_STORE) )
  934.         result = 1;
  935. +   else if( sd->state.secure_items )
  936. +   {
  937. +       clif->message(sd->fd, "You are protected by @security, You can't do this action.");
  938. +       result = 1;
  939. +   }
  940.     else
  941.         result = npc->buylist(sd,n,item_list);
  942.  
  943. @@ -10431,6 +10511,11 @@ void clif_parse_NpcSellListSend(int fd,struct map_session_data *sd)
  944.  
  945.     if (sd->state.trading || !sd->npc_shopid)
  946.         fail = 1;
  947. +   else if( sd->state.secure_items )
  948. +   {
  949. +       clif->message(sd->fd, "You are protected by @security, You can't do this action.");
  950. +       fail = 1;
  951. +   }
  952.     else
  953.         fail = npc->selllist(sd,n,item_list);
  954.  
  955. @@ -10462,10 +10547,10 @@ void clif_parse_CreateChatRoom(int fd, struct map_session_data* sd)
  956.         return;
  957.     }
  958.     if( npc->isnear(&sd->bl) ) {
  959. -       // uncomment for more verbose message.
  960. -       //char output[150];
  961. -       //sprintf(output, msg_txt(862), battle_config.min_npc_vendchat_distance); // "You're too close to a NPC, you must be at least %d cells away from any NPC."
  962. -       //clif_displaymessage(sd->fd, output);
  963. +
  964. +       char output[150];
  965. +       sprintf(output, msg_txt(862), battle_config.min_npc_vendchat_distance); // "You're too close to a NPC, you must be at least %d cells away from any NPC."
  966. +       clif_displaymessage(sd->fd, output);
  967.         clif->skill_fail(sd,1,USESKILL_FAIL_THERE_ARE_NPC_AROUND,0);
  968.         return;
  969.     }
  970. @@ -12428,6 +12513,12 @@ void clif_parse_OpenVending(int fd, struct map_session_data* sd) {
  971.         return;
  972.     }
  973.  
  974. +   if( sd->state.secure_items )
  975. +   {
  976. +       clif->message(sd->fd, "You are protected by @security, You can't do this action.");
  977. +       return;
  978. +   }
  979. +
  980.     if( message[0] == '\0' ) // invalid input
  981.         return;
  982.  
  983. @@ -14802,6 +14893,13 @@ void clif_parse_Auction_setitem(int fd, struct map_session_data *sd)
  984.         return;
  985.     }
  986.  
  987. +   if( sd->state.secure_items )
  988. +   {
  989. +       clif_Auction_setitem(sd->fd, idx, true);
  990. +       clif->message(sd->fd, "You are protected by @security, You can't do this action.");
  991. +       return;
  992. +   }
  993. +
  994.     if( !pc_can_give_items(sd) || sd->status.inventory[idx].expire_time ||
  995.             !sd->status.inventory[idx].identify ||
  996.                 !itemdb_canauction(&sd->status.inventory[idx],pc_get_group_level(sd)) || // Quest Item or something else
  997. diff --git a/src/map/clif.h b/src/map/clif.h
  998. index 5f1a2a8..208bcaf 100644
  999. --- a/src/map/clif.h
  1000. +++ b/src/map/clif.h
  1001. @@ -76,6 +76,7 @@ typedef enum send_target {
  1002.     PARTY_SAMEMAP_WOS,
  1003.     PARTY_AREA,
  1004.     PARTY_AREA_WOS,
  1005. +   PARTY_BUFF_INFO,
  1006.     GUILD,
  1007.     GUILD_WOS,
  1008.     GUILD_SAMEMAP,
  1009. @@ -95,6 +96,7 @@ typedef enum send_target {
  1010.     BG_AREA_WOS,
  1011.  
  1012.     BG_QUEUE,
  1013. +   PVP_LISTEN,
  1014.  } send_target;
  1015.  
  1016.  typedef enum broadcast_flags {
  1017. diff --git a/src/map/mail.c b/src/map/mail.c
  1018. index 7ba7d74..b549987 100644
  1019. --- a/src/map/mail.c
  1020. +++ b/src/map/mail.c
  1021. @@ -62,6 +62,12 @@ int mail_removezeny(struct map_session_data *sd, short flag)
  1022.  
  1023.  unsigned char mail_setitem(struct map_session_data *sd, int idx, int amount) {
  1024.  
  1025. +   if( sd->state.secure_items )
  1026. +   {
  1027. +       clif->message(sd->fd, "You are protected by @security, You can't do this action.");
  1028. +       return 1;
  1029. +   }
  1030. +
  1031.     if( pc_istrading(sd) )
  1032.         return 1;
  1033.  
  1034. diff --git a/src/map/map.c b/src/map/map.c
  1035. index c79d49c..5f40ff3 100644
  1036. --- a/src/map/map.c
  1037. +++ b/src/map/map.c
  1038. @@ -14,6 +14,7 @@
  1039.  #include <string.h>
  1040.  
  1041.  #include "HPMmap.h"
  1042. +#include "adelays.h"
  1043.  #include "atcommand.h"
  1044.  #include "battle.h"
  1045.  #include "battleground.h"
  1046. @@ -1701,6 +1702,12 @@ void map_reqnickdb(struct map_session_data * sd, int charid)
  1047.  
  1048.     nullpo_retv(sd);
  1049.  
  1050. +   if( battle_config.reserved_costume_id && battle_config.reserved_costume_id == charid )
  1051. +   {
  1052. +       clif->solved_charname(sd->fd, charid, "C");
  1053. +       return;
  1054. +   }
  1055. +
  1056.     tsd = map->charid2sd(charid);
  1057.     if( tsd ) {
  1058.         clif->solved_charname(sd->fd, charid, tsd->status.name);
  1059. @@ -5281,6 +5288,21 @@ void map_add_questinfo(int m, struct questinfo *qi) {
  1060.     memcpy(&map->list[m].qi_data[i], qi, sizeof(struct questinfo));
  1061.  }
  1062.  
  1063. +void map_add_questinfo2(int m, struct questinfo *qi) {
  1064. +   unsigned short i;
  1065. +  
  1066. +   /* duplicate, override */
  1067. +   for(i = 0; i < map->list[m].qi_count; i++) {
  1068. +       if( map->list[m].qi_data[i].nd == qi->nd )
  1069. +           break;
  1070. +   }
  1071. +      
  1072. +   if( i == map->list[m].qi_count )
  1073. +       RECREATE(map->list[m].qi_data, struct questinfo, ++map->list[m].qi_count);
  1074. +  
  1075. +   memcpy(&map->list[m].qi_data[i], qi, sizeof(struct questinfo));
  1076. +}
  1077. +
  1078.  bool map_remove_questinfo(int m, struct npc_data *nd) {
  1079.     unsigned short i;
  1080.    
  1081. @@ -5919,6 +5941,10 @@ int do_init(int argc, char *argv[])
  1082.                 chrif->setip(ip_str);
  1083.         }
  1084.  
  1085. +#ifdef ADELAYS
  1086. +   adelays_battle_config_read();
  1087. +#endif
  1088. +
  1089.         battle->config_read(map->BATTLE_CONF_FILENAME);
  1090.         atcommand->msg_read(map->MSG_CONF_NAME, false);
  1091.         map->inter_config_read(map->INTER_CONF_NAME);
  1092. @@ -5989,6 +6015,9 @@ int do_init(int argc, char *argv[])
  1093.     skill->init(minimal);
  1094.     if (!minimal)
  1095.         map->read_zone_db();/* read after item and skill initialization */
  1096. +#ifdef ADELAYS
  1097. +   adelays_init();
  1098. +#endif
  1099.     mob->init(minimal);
  1100.     pc->init(minimal);
  1101.     status->init(minimal);
  1102. diff --git a/src/map/mob.c b/src/map/mob.c
  1103. index 8a8e965..5273002 100644
  1104. --- a/src/map/mob.c
  1105. +++ b/src/map/mob.c
  1106. @@ -1343,7 +1343,7 @@ int mob_randomwalk(struct mob_data *md, int64 tick) {
  1107.         x+=md->bl.x;
  1108.         y+=md->bl.y;
  1109.  
  1110. -       if(((x != md->bl.x) || (y != md->bl.y)) && map->getcell(md->bl.m,x,y,CELL_CHKPASS) && unit->walktoxy(&md->bl,x,y,8)){
  1111. +       if(((x != md->bl.x) || (y != md->bl.y)) && map->getcell(md->bl.m,x,y,CELL_CHKPASS) && unit->walktoxy(&md->bl,x,y,0)){
  1112.             break;
  1113.         }
  1114.     }
  1115. @@ -2144,6 +2144,8 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type) {
  1116.             mvp_damage = md->dmglog[i].dmg;
  1117.         }
  1118.  
  1119. +       if (tsd->aeva.expblock)
  1120. +           continue;
  1121.         tmpsd[i] = tsd; // record as valid damage-log entry
  1122.  
  1123.         switch( md->dmglog[i].flag ) {
  1124. diff --git a/src/map/npc.c b/src/map/npc.c
  1125. index 996cd4f..e7af09f 100644
  1126. --- a/src/map/npc.c
  1127. +++ b/src/map/npc.c
  1128. @@ -2135,6 +2135,13 @@ int npc_selllist(struct map_session_data* sd, int n, unsigned short* item_list)
  1129.  
  1130.     pc->getzeny(sd, (int)z, LOG_TYPE_NPC, NULL);
  1131.  
  1132. +#ifdef ACHIEVEMENT
  1133. +   if (sd){
  1134. +       sd->gotzenylog = (int)z;
  1135. +       npc->script_event(sd, NPCE_ZENYGET);
  1136. +   }
  1137. +#endif
  1138. +
  1139.     // custom merchant shop exp bonus
  1140.     if( battle_config.shop_exp > 0 && z > 0 && ( skill_t = pc->checkskill2(sd,skill_idx) ) > 0) {
  1141.         if( sd->status.skill[skill_idx].flag >= SKILL_FLAG_REPLACED_LV_0 )
  1142. @@ -4300,6 +4307,8 @@ void npc_read_event_script(void)
  1143.         {"Die Event",script->config.die_event_name},
  1144.         {"Kill PC Event",script->config.kill_pc_event_name},
  1145.         {"Kill NPC Event",script->config.kill_mob_event_name},
  1146. +       {"PC Zeny Get Event",script->config.zeny_event_name},
  1147. +       {"PC On Skill Event",script->config.skill_event_name},
  1148.     };
  1149.  
  1150.     for (i = 0; i < NPCE_MAX; i++)
  1151. diff --git a/src/map/npc.h b/src/map/npc.h
  1152. index 68d6838..0950d13 100644
  1153. --- a/src/map/npc.h
  1154. +++ b/src/map/npc.h
  1155. @@ -134,6 +134,8 @@ enum npce_event {
  1156.     NPCE_DIE,
  1157.     NPCE_KILLPC,
  1158.     NPCE_KILLNPC,
  1159. +   NPCE_ZENYGET,
  1160. +   NPCE_ONSKILL,
  1161.     NPCE_MAX
  1162.  };
  1163.  
  1164. diff --git a/src/map/packets.h b/src/map/packets.h
  1165. index ccf1c28..0b877e9 100644
  1166. --- a/src/map/packets.h
  1167. +++ b/src/map/packets.h
  1168. @@ -3051,7 +3051,7 @@ packet(0x020d,-1);
  1169.  #endif
  1170.  
  1171.  #if PACKETVER >= 20131223
  1172. -   packetKeys(0x631C511C,0x111C111C,0x111C111C);
  1173. +   packetKeys(0x611B7097,0x768A0FCB,0x768A0FCB);
  1174.  #endif
  1175.  
  1176.  #if PACKETVER >= 20131230
  1177. diff --git a/src/map/party.c b/src/map/party.c
  1178. index fb738a1..8b22550 100644
  1179. --- a/src/map/party.c
  1180. +++ b/src/map/party.c
  1181. @@ -561,6 +561,7 @@ int party_member_withdraw(int party_id, int account_id, int char_id)
  1182.             memset(&p->data[i], 0, sizeof(p->data[0]));
  1183.             p->party.count--;
  1184.             party->check_state(p);
  1185. +           clif->party_info(p, NULL);
  1186.         }
  1187.     }
  1188.  
  1189. @@ -569,6 +570,10 @@ int party_member_withdraw(int party_id, int account_id, int char_id)
  1190.         pc->bound_clear(sd,IBT_PARTY);
  1191.  #endif
  1192.         sd->status.party_id = 0;
  1193. +       if( sd->state.spb ) {
  1194. +           sd->state.spb = false;
  1195. +           clif->message(sd->fd, "Displaying party member's buffs disabled.");
  1196. +       }
  1197.         clif->charnameupdate(sd); //Update name display [Skotlex]
  1198.         //TODO: hp bars should be cleared too
  1199.         if( p && p->instances )
  1200. @@ -929,7 +934,7 @@ int party_exp_share(struct party_data* p, struct block_list* src, unsigned int b
  1201.  
  1202.     // count the number of players eligible for exp sharing
  1203.     for (i = c = 0; i < MAX_PARTY; i++) {
  1204. -       if( (sd[c] = p->data[i].sd) == NULL || sd[c]->bl.m != src->m || pc_isdead(sd[c]) || (battle_config.idle_no_share && pc_isidle(sd[c])) )
  1205. +       if( (sd[c] = p->data[i].sd) == NULL || sd[c]->bl.m != src->m || pc_isdead(sd[c]) || (battle_config.idle_no_share && pc_isidle(sd[c])) || sd[c]->aeva.expblock)
  1206.             continue;
  1207.         c++;
  1208.     }
  1209. diff --git a/src/map/pc.c b/src/map/pc.c
  1210. index 0905df6..233b81c 100644
  1211. --- a/src/map/pc.c
  1212. +++ b/src/map/pc.c
  1213. @@ -13,6 +13,7 @@
  1214.  #include <time.h>
  1215.  
  1216.  #include "atcommand.h" // get_atcommand_level()
  1217. +#include "adelays.h"
  1218.  #include "battle.h" // battle_config
  1219.  #include "battleground.h"
  1220.  #include "channel.h"
  1221. @@ -634,7 +635,7 @@ int pc_setnewpc(struct map_session_data *sd, int account_id, int char_id, int lo
  1222.  
  1223.  int pc_equippoint(struct map_session_data *sd,int n)
  1224.  {
  1225. -   int ep = 0;
  1226. +   int ep = 0, char_id = 0;
  1227.  
  1228.     nullpo_ret(sd);
  1229.  
  1230. @@ -660,6 +661,14 @@ int pc_equippoint(struct map_session_data *sd,int n)
  1231.                 return EQP_SHADOW_ARMS;
  1232.         }
  1233.     }
  1234. +   if( battle_config.reserved_costume_id &&
  1235. +       sd->status.inventory[n].card[0] == CARD0_CREATE &&
  1236. +       (char_id = MakeDWord(sd->status.inventory[n].card[2],sd->status.inventory[n].card[3])) == battle_config.reserved_costume_id )
  1237. +   {
  1238. +       if( ep&EQP_HEAD_TOP ) { ep &= ~EQP_HEAD_TOP; ep |= EQP_COSTUME_HEAD_TOP; }
  1239. +       if( ep&EQP_HEAD_LOW ) { ep &= ~EQP_HEAD_LOW; ep |= EQP_COSTUME_HEAD_LOW; }
  1240. +       if( ep&EQP_HEAD_MID ) { ep &= ~EQP_HEAD_MID; ep |= EQP_COSTUME_HEAD_MID; }
  1241. +   }
  1242.     return ep;
  1243.  }
  1244.  
  1245. @@ -892,6 +901,9 @@ int pc_isequip(struct map_session_data *sd,int n)
  1246.     if(pc_has_permission(sd, PC_PERM_USE_ALL_EQUIPMENT))
  1247.         return 1;
  1248.    
  1249. +   if(sd->status.inventory[n].card[2] == GetWord(battle_config.reserved_costume_id, 0) && sd->status.inventory[n].card[3] == GetWord(battle_config.reserved_costume_id, 1))
  1250. +       return 1;
  1251. +
  1252.     if(item->elv && sd->status.base_level < (unsigned int)item->elv){
  1253.         clif->msg(sd, 0x6ED);
  1254.         return 0;
  1255. @@ -986,6 +998,10 @@ bool pc_authok(struct map_session_data *sd, int login_id2, time_t expiration_tim
  1256.     int64 tick = timer->gettick();
  1257.     uint32 ip = session[sd->fd]->client_addr;
  1258.  
  1259. +#ifdef ADELAYS
  1260. +   adelays_dataset(&(sd->adelays_state), sd->status.name);
  1261. +#endif
  1262. +
  1263.     sd->login_id2 = login_id2;
  1264.  
  1265.     if (pc->set_group(sd, group_id) != 0) {
  1266. @@ -1335,6 +1351,14 @@ int pc_reg_received(struct map_session_data *sd)
  1267.     intif->Mail_requestinbox(sd->status.char_id, 0); // MAIL SYSTEM - Request Mail Inbox
  1268.     intif->request_questlog(sd);
  1269.  
  1270. +   if( pc_readaccountreg(sd,script->add_str("#SECURITYCODE")) > 0 )
  1271. +   {
  1272. +       clif->message(sd->fd, "Item Security System ENABLE : Use @security for more options.");
  1273. +       sd->state.secure_items = 1;
  1274. +   }
  1275. +   else
  1276. +       clif->message(sd->fd, "Item Security System DISABLE : Use @security for more options.");
  1277. +
  1278.     if (sd->state.connect_new == 0 && sd->fd) { //Character already loaded map! Gotta trigger LoadEndAck manually.
  1279.         sd->state.connect_new = 1;
  1280.         clif->pLoadEndAck(sd->fd, sd);
  1281. @@ -4169,6 +4193,12 @@ int pc_dropitem(struct map_session_data *sd,int n,int amount)
  1282.         return 0; //Can't drop items in nodrop mapflag maps.
  1283.     }
  1284.  
  1285. +   if( sd->state.secure_items )
  1286. +   {
  1287. +       clif->message(sd->fd, "You are protected by @security, You can't do this action.");
  1288. +       return 0;
  1289. +   }
  1290. +
  1291.     if( !pc->candrop(sd,&sd->status.inventory[n]) )
  1292.     {
  1293.         clif->message (sd->fd, msg_sd(sd,263));
  1294. @@ -4456,6 +4486,12 @@ int pc_useitem(struct map_session_data *sd,int n) {
  1295.         return 0;
  1296.     }
  1297.  
  1298. +#ifdef ADELAYS
  1299. +   if (!adelays_canuseitem(sd->status.inventory[n].nameid, sd->ud.canact_tick)){
  1300. +       return 0;
  1301. +   }
  1302. +#endif
  1303. +
  1304.     if( sd->status.inventory[n].nameid <= 0 || sd->status.inventory[n].amount <= 0 )
  1305.         return 0;
  1306.  
  1307. @@ -5104,10 +5140,20 @@ int pc_setpos(struct map_session_data* sd, unsigned short map_index, int x, int
  1308.     }
  1309.  
  1310.     if( x == 0 && y == 0 ) {// pick a random walkable cell
  1311. +       int c = 0;
  1312.         do {
  1313.             x=rnd()%(map->list[m].xs-2)+1;
  1314.             y=rnd()%(map->list[m].ys-2)+1;
  1315. -       } while(map->getcell(m,x,y,CELL_CHKNOPASS));
  1316. +           c++;
  1317. +
  1318. +           if(c > (map->list[m].xs * map->list[m].ys)*3)
  1319. +           {
  1320. +               ShowError("pc_setpos: couldn't found a valid coordinates for player '%s' (%d:%d) on (%s), preventing warp\n", sd->status.name, sd->status.account_id, sd->status.char_id, mapindex_id2name(map_index));
  1321. +               return 0;
  1322. +           }
  1323. +
  1324. +       } while(map->getcell(m,x,y,CELL_CHKNOPASS) || (!battle_config.teleport_on_portal && npc->check_areanpc(1,m,x,y,1)) );
  1325. +
  1326.     }
  1327.  
  1328.     if (sd->state.vending && map->getcell(m,x,y,CELL_CHKNOVENDING)) {
  1329. @@ -5182,7 +5228,7 @@ int pc_randomwarp(struct map_session_data *sd, clr_type type) {
  1330.     do {
  1331.         x=rnd()%(map->list[m].xs-2)+1;
  1332.         y=rnd()%(map->list[m].ys-2)+1;
  1333. -   } while( map->getcell(m,x,y,CELL_CHKNOPASS) && (i++) < 1000 );
  1334. +   } while( ( map->getcell(m,x,y,CELL_CHKNOPASS) || (!battle_config.teleport_on_portal && npc->check_areanpc(1,m,x,y,1)) ) && (i++) < 1000 );
  1335.  
  1336.     if (i < 1000)
  1337.         return pc->setpos(sd,map_id2index(sd->bl.m),x,y,type);
  1338. @@ -8887,6 +8933,9 @@ int pc_checkcombo(struct map_session_data *sd, struct item_data *data ) {
  1339.                 if( k == EQI_HEAD_MID &&  sd->equip_index[EQI_HEAD_LOW] == index ) continue;
  1340.                 if( k == EQI_HEAD_TOP && (sd->equip_index[EQI_HEAD_MID] == index || sd->equip_index[EQI_HEAD_LOW] == index) ) continue;
  1341.  
  1342. +               if( (int)MakeDWord(sd->status.inventory[index].card[2],sd->status.inventory[index].card[3]) == battle_config.reserved_costume_id )
  1343. +                   continue;
  1344. +
  1345.                 if(!sd->inventory_data[index])
  1346.                     continue;
  1347.                
  1348. @@ -9861,7 +9910,7 @@ int pc_daynight_timer_sub(struct map_session_data *sd,va_list ap) {
  1349.   * data: 0 = called by timer, 1 = gmcommand/script
  1350.   *------------------------------------------------*/
  1351.  int map_day_timer(int tid, int64 tick, int id, intptr_t data) {
  1352. -   char tmp_soutput[1024];
  1353. +   //char tmp_soutput[1024];
  1354.  
  1355.     if (data == 0 && battle_config.day_duration <= 0) // if we want a day
  1356.         return 0;
  1357. @@ -9871,8 +9920,8 @@ int map_day_timer(int tid, int64 tick, int id, intptr_t data) {
  1358.  
  1359.     map->night_flag = 0; // 0=day, 1=night [Yor]
  1360.     map->foreachpc(pc->daynight_timer_sub);
  1361. -   safestrncpy(tmp_soutput, (data == 0) ? msg_txt(502) : msg_txt(60), sizeof(tmp_soutput)); // The day has arrived!
  1362. -   intif->broadcast(tmp_soutput, strlen(tmp_soutput) + 1, BC_DEFAULT);
  1363. +   //safestrncpy(tmp_soutput, (data == 0) ? msg_txt(502) : msg_txt(60), sizeof(tmp_soutput)); // The day has arrived!
  1364. +   //intif->broadcast(tmp_soutput, strlen(tmp_soutput) + 1, BC_DEFAULT);
  1365.     return 0;
  1366.  }
  1367.  
  1368. @@ -9881,7 +9930,7 @@ int map_day_timer(int tid, int64 tick, int id, intptr_t data) {
  1369.   * data: 0 = called by timer, 1 = gmcommand/script
  1370.   *------------------------------------------------*/
  1371.  int map_night_timer(int tid, int64 tick, int id, intptr_t data) {
  1372. -   char tmp_soutput[1024];
  1373. +   //char tmp_soutput[1024];
  1374.  
  1375.     if (data == 0 && battle_config.night_duration <= 0) // if we want a night
  1376.         return 0;
  1377. @@ -9891,8 +9940,8 @@ int map_night_timer(int tid, int64 tick, int id, intptr_t data) {
  1378.  
  1379.     map->night_flag = 1; // 0=day, 1=night [Yor]
  1380.     map->foreachpc(pc->daynight_timer_sub);
  1381. -   safestrncpy(tmp_soutput, (data == 0) ? msg_txt(503) : msg_txt(59), sizeof(tmp_soutput)); // The night has fallen...
  1382. -   intif->broadcast(tmp_soutput, strlen(tmp_soutput) + 1, BC_DEFAULT);
  1383. +   //safestrncpy(tmp_soutput, (data == 0) ? msg_txt(503) : msg_txt(59), sizeof(tmp_soutput)); // The night has fallen...
  1384. +   //intif->broadcast(tmp_soutput, strlen(tmp_soutput) + 1, BC_DEFAULT);
  1385.     return 0;
  1386.  }
  1387.  
  1388. diff --git a/src/map/pc.h b/src/map/pc.h
  1389. index 39b705b..e2c16a4 100644
  1390. --- a/src/map/pc.h
  1391. +++ b/src/map/pc.h
  1392. @@ -7,6 +7,7 @@
  1393.  
  1394.  #include "../config/core.h" // AUTOLOOTITEM_SIZE, RENEWAL, SECURE_NPCTIMEOUT
  1395.  
  1396. +#include "adelays.h"
  1397.  #include "battle.h" // battle
  1398.  #include "battleground.h" // enum bg_queue_types
  1399.  #include "buyingstore.h"  // struct s_buyingstore
  1400. @@ -188,7 +189,15 @@ struct map_session_data {
  1401.         unsigned int itemcheck : 1;
  1402.         unsigned int standalone : 1;/* [Ind/Hercules <3] */
  1403.         unsigned int loggingout : 1;
  1404. +       unsigned int arealoot : 1;
  1405. +       unsigned int pvp_listen : 1;
  1406. +       bool noattack;
  1407. +       unsigned int spb : 1;
  1408. +       unsigned int secure_items : 1;
  1409.     } state;
  1410. +#ifdef ADELAYS
  1411. +       struct Adelays_State adelays_state;
  1412. +#endif
  1413.     struct {
  1414.         unsigned char no_weapon_damage, no_magic_damage, no_misc_damage;
  1415.         unsigned int restart_full_recover : 1;
  1416. @@ -204,6 +213,12 @@ struct map_session_data {
  1417.     int login_id1, login_id2;
  1418.     unsigned short class_; //This is the internal job ID used by the map server to simplify comparisons/queries/etc. [Skotlex]
  1419.  
  1420. +   struct {
  1421. +       unsigned short expblock: 1; //Block Exp gain from any resource (doesn't block exp getting from script)
  1422. +   }aeva;
  1423. +
  1424. +   unsigned int gotzenylog;
  1425. +   unsigned int countskilllog;
  1426.     /// Groups & permissions
  1427.     int group_id;
  1428.     GroupSettings *group;
  1429. @@ -461,6 +476,7 @@ struct map_session_data {
  1430.     const char* debug_func;
  1431.  
  1432.     unsigned int bg_id;
  1433. +   struct queue_data *qd;
  1434.  
  1435.     /**
  1436.      * For the Secure NPC Timeout option (check config/Secure.h) [RR]
  1437. diff --git a/src/map/script.c b/src/map/script.c
  1438. index 51bb344..a01016a 100644
  1439. --- a/src/map/script.c
  1440. +++ b/src/map/script.c
  1441. @@ -9618,6 +9618,7 @@ enum setmount_type {
  1442.     TBL_PC* sd;
  1443.     int base=0,job=0;
  1444.     double bonus;
  1445. +   int mul = 1;
  1446.  
  1447.     sd = script->rid2sd(st);
  1448.     if( sd == NULL )
  1449. @@ -9629,9 +9630,11 @@ enum setmount_type {
  1450.         return true;
  1451.  
  1452.     // bonus for npc-given exp
  1453. +   if (sd->status.base_level >= 90) mul = 3;
  1454. +   else if (sd->status.base_level >= 60) mul = 2;
  1455.     bonus = battle_config.quest_exp_rate / 100.;
  1456. -   base = (int) cap_value(base * bonus, 0, INT_MAX);
  1457. -   job = (int) cap_value(job * bonus, 0, INT_MAX);
  1458. +   base = (int) cap_value(base * mul * bonus, 0, INT_MAX);
  1459. +   job = (int) cap_value(job * mul * bonus, 0, INT_MAX);
  1460.  
  1461.     pc->gainexp(sd, &sd->bl, base, job, true);
  1462.  
  1463. @@ -19637,6 +19640,138 @@ void script_hqueue_clear(int idx) {
  1464.     return true;
  1465.  }
  1466.  
  1467. +/**
  1468. + * [Aeva]
  1469. + **/
  1470. +
  1471. +BUILDIN(costume)
  1472. +{
  1473. +   int i = -1, num, ep;
  1474. +   TBL_PC *sd;
  1475. +
  1476. +   num = script_getnum(st,2);
  1477. +   sd = script->rid2sd(st);
  1478. +
  1479. +   if( sd == NULL )
  1480. +       return 0;
  1481. +   if( num > 0 && num <= ARRAYLENGTH(script->equip) )
  1482. +       i = pc->checkequip(sd, script->equip[num - 1]);
  1483. +   if( i < 0 )
  1484. +       return 0;
  1485. +   ep = sd->status.inventory[i].equip;
  1486. +   if( !(ep&EQP_HEAD_LOW) && !(ep&EQP_HEAD_MID) && !(ep&EQP_HEAD_TOP) )
  1487. +       return 0;
  1488. +
  1489. +   logs->pick_pc(sd, LOG_TYPE_SCRIPT, -1, &sd->status.inventory[i],sd->inventory_data[i]);
  1490. +   pc->unequipitem(sd,i,2);
  1491. +   clif->delitem(sd,i,1,3);
  1492. +   // --------------------------------------------------------------------
  1493. +   sd->status.inventory[i].refine = 0;
  1494. +   sd->status.inventory[i].attribute = 0;
  1495. +   sd->status.inventory[i].card[0] = CARD0_CREATE;
  1496. +   sd->status.inventory[i].card[1] = 0;
  1497. +   sd->status.inventory[i].card[2] = GetWord(battle_config.reserved_costume_id, 0);
  1498. +   sd->status.inventory[i].card[3] = GetWord(battle_config.reserved_costume_id, 1);
  1499. +
  1500. +   if( ep&EQP_HEAD_TOP ) { ep &= ~EQP_HEAD_TOP; ep |= EQP_COSTUME_HEAD_TOP; }
  1501. +   if( ep&EQP_HEAD_LOW ) { ep &= ~EQP_HEAD_LOW; ep |= EQP_COSTUME_HEAD_LOW; }
  1502. +   if( ep&EQP_HEAD_MID ) { ep &= ~EQP_HEAD_MID; ep |= EQP_COSTUME_HEAD_MID; }
  1503. +   // --------------------------------------------------------------------
  1504. +   logs->pick_pc(sd, LOG_TYPE_SCRIPT, 1, &sd->status.inventory[i],sd->inventory_data[i]);
  1505. +
  1506. +   clif->additem(sd,i,1,0);
  1507. +   pc->equipitem(sd,i,ep);
  1508. +   clif->misceffect(&sd->bl,3);
  1509. +
  1510. +   return true;
  1511. +}
  1512. +
  1513. +/*==========================================
  1514. + * Item Security System
  1515. + *------------------------------------------*/
  1516. +BUILDIN(setsecurity)
  1517. +{
  1518. +   struct map_session_data *sd = script_rid2sd(st);
  1519. +   int value = script_getnum(st,2);
  1520. +   if( sd == NULL )
  1521. +       return 0;
  1522. +
  1523. +   sd->state.secure_items = (value)?1:0;
  1524. +   return 0;
  1525. +}
  1526. +
  1527. +BUILDIN(getsecurity)
  1528. +{
  1529. +   struct map_session_data *sd = script_rid2sd(st);
  1530. +   if( sd == NULL )
  1531. +       return 0;
  1532. +
  1533. +   script_pushint(st,sd->state.secure_items);
  1534. +   return 0;
  1535. +}
  1536. +
  1537. +BUILDIN(blockexp)
  1538. +{
  1539. +   int type;
  1540. +   TBL_PC *sd=script->rid2sd(st);
  1541. +  
  1542. +   if ( sd == NULL) {
  1543. +       return true;
  1544. +   }
  1545. +
  1546. +   type = script_getnum(st,2);
  1547. +  
  1548. +   switch(type){
  1549. +       case 0:
  1550. +           sd->aeva.expblock = 0;
  1551. +       break;
  1552. +       case 1:
  1553. +           sd->aeva.expblock = 1;
  1554. +       break;
  1555. +   }
  1556. +   return true;
  1557. +}
  1558. +
  1559. +BUILDIN(getcharinfo) {
  1560. +   int num;
  1561. +   TBL_PC *sd;
  1562. +
  1563. +   num = script_getnum(st,2);
  1564. +   if( script_hasdata(st,3) )
  1565. +       sd=map->nick2sd(script_getstr(st,3));
  1566. +   else
  1567. +       sd=script->rid2sd(st);
  1568. +
  1569. +   if(sd==NULL) {
  1570. +       script_pushint(st,0); //return 0, according docs
  1571. +       return true;
  1572. +   }
  1573. +
  1574. +   switch( num ) {
  1575. +       case 0: script_pushint(st,sd->gotzenylog); break;
  1576. +       case 1: script_pushint(st,sd->countskilllog); break;
  1577. +       default:
  1578. +           ShowError("buildin_getcharinfo: invalid parameter (%d).\n", num);
  1579. +           script_pushint(st,0);
  1580. +           break;
  1581. +   }
  1582. +
  1583. +   return true;
  1584. +}
  1585. +
  1586. +BUILDIN(pvpannounce)
  1587. +{
  1588. +   const char *mes       = script_getstr(st,2);
  1589. +   const char *fontColor = script_hasdata(st,4) ? script_getstr(st,4) : NULL;
  1590. +   int         fontType  = script_hasdata(st,5) ? script_getnum(st,5) : 0x190; // default fontType (FW_NORMAL)
  1591. +   int         fontSize  = script_hasdata(st,6) ? script_getnum(st,6) : 12;    // default fontSize
  1592. +   int         fontAlign = script_hasdata(st,7) ? script_getnum(st,7) : 0;     // default fontAlign
  1593. +   int         fontY     = script_hasdata(st,8) ? script_getnum(st,8) : 0;     // default fontY
  1594. +
  1595. +   clif->broadcast2(NULL, mes, (int)strlen(mes)+1, strtol(fontColor, (char **)NULL, 0), fontType, fontSize, fontAlign, fontY, PVP_LISTEN);
  1596. +   return true;
  1597. +}
  1598. +
  1599.  // declarations that were supposed to be exported from npc_chat.c
  1600.  #ifdef PCRE_SUPPORT
  1601.  BUILDIN(defpattern);
  1602. @@ -19758,6 +19893,14 @@ void script_parse_builtin(void) {
  1603.         /* Commands for internal use by the script engine */
  1604.         BUILDIN_DEF(__jump_zero,"il"),
  1605.         BUILDIN_DEF(__setr,"rv?"),
  1606. +      
  1607. +       /* [Aeva] */
  1608. +       BUILDIN_DEF(costume,"i"),
  1609. +       BUILDIN_DEF(setsecurity,"i"),
  1610. +       BUILDIN_DEF(getsecurity,""),
  1611. +       BUILDIN_DEF(blockexp,"i"),
  1612. +       BUILDIN_DEF(getcharinfo,"i?"),
  1613. +       BUILDIN_DEF(pvpannounce,"s?????"),
  1614.  
  1615.         // NPC interaction
  1616.         BUILDIN_DEF(mes,"s*"),
  1617. @@ -20600,6 +20743,8 @@ void script_defaults(void) {
  1618.     script->config.ontouch_name = "OnTouch_";  //ontouch_name (runs on first visible char to enter area, picks another char if the first char leaves)
  1619.     script->config.ontouch2_name = "OnTouch";  //ontouch2_name (run whenever a char walks into the OnTouch area)
  1620.     script->config.onuntouch_name = "OnUnTouch";  //onuntouch_name (run whenever a char walks from the OnTouch area)
  1621. +   script->config.zeny_event_name = "OnZenyGet";
  1622. +   script->config.skill_event_name = "OnSkill";
  1623.  
  1624.     // for ENABLE_CASE_CHECK
  1625.     script->calc_hash_ci = calc_hash_ci;
  1626. diff --git a/src/map/script.h b/src/map/script.h
  1627. index 25c4283..ef387eb 100644
  1628. --- a/src/map/script.h
  1629. +++ b/src/map/script.h
  1630. @@ -345,6 +345,10 @@ struct Script_Config {
  1631.     const char* ontouch_name;
  1632.     const char* ontouch2_name;
  1633.     const char* onuntouch_name;
  1634. +
  1635. +   const char *zeny_event_name;
  1636. +   const char *skill_event_name;  
  1637. +
  1638.  };
  1639.  
  1640.  /**
  1641. diff --git a/src/map/skill.c b/src/map/skill.c
  1642. index a9737f1..f1dbaa4 100644
  1643. --- a/src/map/skill.c
  1644. +++ b/src/map/skill.c
  1645. @@ -14,6 +14,7 @@
  1646.  #include <time.h>
  1647.  
  1648.  #include "battle.h"
  1649. +#include "adelays.h"
  1650.  #include "battleground.h"
  1651.  #include "chrif.h"
  1652.  #include "clif.h"
  1653. @@ -518,13 +519,19 @@ int skillnotok (uint16 skill_id, struct map_session_data *sd)
  1654.         case MC_VENDING:
  1655.         case ALL_BUYING_STORE:
  1656.             if( npc->isnear(&sd->bl) ) {
  1657. -               // uncomment for more verbose message.
  1658. -               //char output[150];
  1659. -               //sprintf(output, msg_txt(862), battle_config.min_npc_vendchat_distance); // "You're too close to a NPC, you must be at least %d cells away from any NPC."
  1660. -               //clif->message(sd->fd, output);
  1661. +
  1662. +               char output[150];
  1663. +               sprintf(output, msg_txt(862), battle_config.min_npc_vendchat_distance); // "You're too close to a NPC, you must be at least %d cells away from any NPC."
  1664. +               clif->message(sd->fd, output);
  1665.                 clif->skill_fail(sd,skill_id,USESKILL_FAIL_THERE_ARE_NPC_AROUND,0);
  1666.                 return 1;
  1667.             }
  1668. +           if( sd->state.secure_items )
  1669. +           {
  1670. +               clif->message(sd->fd, "You are protected by @security, You can't do this action.");
  1671. +               clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
  1672. +               return 1;
  1673. +           }
  1674.         case MC_IDENTIFY:
  1675.             return 0; // always allowed
  1676.         case WZ_ICEWALL:
  1677. @@ -4834,6 +4841,11 @@ int skill_castend_id(int tid, int64 tick, int id, intptr_t data) {
  1678.     struct status_change *sc = NULL;
  1679.     int inf,inf2,flag = 0;
  1680.  
  1681. +#ifdef ADELAYS
  1682. +   int action;
  1683. +   char message[256];
  1684. +#endif
  1685. +
  1686.     src = map->id2bl(id);
  1687.     if( src == NULL )
  1688.     {
  1689. @@ -5047,6 +5059,28 @@ int skill_castend_id(int tid, int64 tick, int id, intptr_t data) {
  1690.             if(cooldown)
  1691.                 skill->blockpc_start(sd, ud->skill_id, cooldown);
  1692.         }
  1693. +
  1694. +#ifdef ADELAYS
  1695. +       if (adelays_is_enabled() && sd) {
  1696. +
  1697. +           // Record the delay.
  1698. +           adelays_recordSkillDelay(ud->skill_id, skill->delay_fix(src, ud->skill_id, ud->skill_lv), skill_get_cooldown(ud->skill_id,ud->skill_lv), &(sd->adelays_state), tick, sd->battle_status.amotion, sd->status.class_, sd->status.sex, sd->sc.option&OPTION_RIDING,battle_config.min_skill_delay_limit);
  1699. +           action = adelays_process_record(tick, &(ud->canact_tick), &(sd->adelays_state), battle_config.min_skill_delay_limit);
  1700. +
  1701. +           // Show the log in game.
  1702. +           if (sd->adelays_state.adelays_showinfo == 1) {
  1703. +           adelays_get_log_message(message, &(sd->adelays_state));
  1704. +               clif->disp_overhead(&sd->bl, message);
  1705. +           }
  1706. +
  1707. +           if (action == 2)
  1708. +           {
  1709. +               // Skill was cancelled.
  1710. +               break;
  1711. +           }
  1712. +       }
  1713. +#endif
  1714. +
  1715.         if( battle_config.display_status_timers && sd )
  1716.             clif->status_change(src, SI_POSTDELAY, 1, skill->delay_fix(src, ud->skill_id, ud->skill_lv), 0, 0, 0);
  1717.         if( sd )
  1718. @@ -5118,6 +5152,10 @@ int skill_castend_id(int tid, int64 tick, int id, intptr_t data) {
  1719.         return 1;
  1720.     } while(0);
  1721.  
  1722. +#ifdef ADELAYS
  1723. +   if(sd && adelays_is_enabled()) adelays_skillFailed(&(sd->adelays_state));
  1724. +#endif
  1725. +
  1726.     //Skill failed.
  1727.     if (ud->skill_id == MO_EXTREMITYFIST && sd && !(sc && sc->data[SC_FOGWALL])) {
  1728.         //When Asura fails... (except when it fails from Fog of Wall)
  1729. @@ -5858,7 +5896,6 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin
  1730.         case NJ_NEN:
  1731.         case NPC_DEFENDER:
  1732.         case NPC_MAGICMIRROR:
  1733. -       case ST_PRESERVE:
  1734.         case NPC_INVINCIBLE:
  1735.         case NPC_INVINCIBLEOFF:
  1736.         case RK_DEATHBOUND:
  1737. @@ -6345,6 +6382,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin
  1738.         case CR_SHRINK:
  1739.         case SG_FUSION:
  1740.         case GS_GATLINGFEVER:
  1741. +       case ST_PRESERVE:
  1742.             if( tsce )
  1743.             {
  1744.                 clif->skill_nodamage(src,bl,skill_id,skill_lv,status_change_end(bl, type, INVALID_TIMER));
  1745. @@ -7014,7 +7052,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin
  1746.                     switch (i) {
  1747.                         /**
  1748.                          * bugreport:4888 these songs may only be dispelled if you're not in their song area anymore
  1749. -                        **/
  1750. +                      
  1751.                         case SC_WHISTLE:
  1752.                         case SC_ASSNCROS:
  1753.                         case SC_POEMBRAGI:
  1754. @@ -7026,6 +7064,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin
  1755.                             if( tsc->data[i]->val4 ) //val4 = out-of-song-area
  1756.                                 continue;
  1757.                             break;
  1758. +                        **/
  1759.                         case SC_ASSUMPTIO:
  1760.                             if( bl->type == BL_MOB )
  1761.                                 continue;
  1762. @@ -9859,6 +9898,11 @@ int skill_castend_pos(int tid, int64 tick, int id, intptr_t data)
  1763.     struct unit_data *ud = unit->bl2ud(src);
  1764.     struct mob_data *md;
  1765.  
  1766. +#ifdef ADELAYS
  1767. +   int action;
  1768. +   char message[256];
  1769. +#endif
  1770. +
  1771.     nullpo_ret(ud);
  1772.  
  1773.     sd = BL_CAST(BL_PC , src);
  1774. @@ -9970,6 +10014,28 @@ int skill_castend_pos(int tid, int64 tick, int id, intptr_t data)
  1775.             if(cooldown)
  1776.                 skill->blockpc_start(sd, ud->skill_id, cooldown);
  1777.         }
  1778. +
  1779. +#ifdef ADELAYS
  1780. +       if (adelays_is_enabled() && sd) {
  1781. +
  1782. +           // Record the delay.
  1783. +           adelays_recordSkillDelay(ud->skill_id, skill->delay_fix(src, ud->skill_id, ud->skill_lv), skill_get_cooldown(ud->skill_id,ud->skill_lv), &(sd->adelays_state), tick, sd->battle_status.amotion, sd->status.class_, sd->status.sex, sd->sc.option&OPTION_RIDING,battle_config.min_skill_delay_limit);
  1784. +           action = adelays_process_record(tick, &(ud->canact_tick), &(sd->adelays_state), battle_config.min_skill_delay_limit);
  1785. +
  1786. +           // Show the log in game.
  1787. +           if (sd->adelays_state.adelays_showinfo == 1) {
  1788. +               adelays_get_log_message(message, &(sd->adelays_state));
  1789. +               clif->disp_overhead(&sd->bl, message);
  1790. +           }
  1791. +
  1792. +           if (action == 2)
  1793. +           {
  1794. +               // Skill was cancelled.
  1795. +               break;
  1796. +           }
  1797. +       }
  1798. +#endif
  1799. +
  1800.         if( battle_config.display_status_timers && sd )
  1801.             clif->status_change(src, SI_POSTDELAY, 1, skill->delay_fix(src, ud->skill_id, ud->skill_lv), 0, 0, 0);
  1802.  #if 0
  1803. @@ -10001,6 +10067,10 @@ int skill_castend_pos(int tid, int64 tick, int id, intptr_t data)
  1804.         return 1;
  1805.     } while(0);
  1806.  
  1807. +#ifdef ADELAYS
  1808. +    if(adelays_is_enabled() && sd) adelays_skillFailed(&(sd->adelays_state));
  1809. +#endif
  1810. +
  1811.     if( !sd || sd->skillitem != ud->skill_id || skill->get_delay(ud->skill_id,ud->skill_lv) )
  1812.         ud->canact_tick = tick;
  1813.     ud->skill_id = ud->skill_lv = 0;
  1814. @@ -19335,3 +19405,21 @@ void skill_defaults(void) {
  1815.     skill->get_requirement_item_unknown = skill_get_requirement_item_unknown;
  1816.     skill->get_requirement_unknown = skill_get_requirement_unknown;
  1817.  }
  1818. +
  1819. +#ifdef ADELAYS
  1820. +/************************************************************************/
  1821. +/* Compatibility methods: Add at the end of skill.c                     */
  1822. +/************************************************************************/
  1823. +int64 adelays_gettick(){
  1824. +   return timer->gettick();
  1825. +}
  1826. +int adelays_skill_name2id(const char * skillName){
  1827. +   return skill->name2id(skillName);
  1828. +}
  1829. +int adelays_skill_get_index(int id){
  1830. +   return skill->get_index(id);
  1831. +}
  1832. +const char * adelays_skill_get_name(int id){
  1833. +   return skill->get_name(id);
  1834. +}
  1835. +#endif
  1836. \ No newline at end of file
  1837. diff --git a/src/map/status.c b/src/map/status.c
  1838. index 0b40685..48681fc 100644
  1839. --- a/src/map/status.c
  1840. +++ b/src/map/status.c
  1841. @@ -33,6 +33,7 @@
  1842.  #include "skill.h"
  1843.  #include "unit.h"
  1844.  #include "vending.h"
  1845. +#include "party.h"
  1846.  #include "../common/cbasetypes.h"
  1847.  #include "../common/ers.h"
  1848.  #include "../common/malloc.h"
  1849. @@ -914,6 +915,12 @@ void initChangeTables(void) {
  1850.     status->IconChangeTable[SC_SUPER_STAR] = SI_SUPER_STAR;
  1851.     status->IconChangeTable[SC_STRANGELIGHTS] = SI_STRANGELIGHTS;
  1852.     status->IconChangeTable[SC_DECORATION_OF_MUSIC] = SI_DECORATION_OF_MUSIC;
  1853. +   status->IconChangeTable[SC_MINDBREAKER] = SI_MINDBREAKER;
  1854. +   status->IconChangeTable[SC_SERVICEFORYOU] = SI_SERVICEFORYOU;
  1855. +   status->IconChangeTable[SC_DONTFORGETME] = SI_DONTFORGETME;
  1856. +   status->IconChangeTable[SC_ASSNCROS] = SI_ASSNCROS;
  1857. +   status->IconChangeTable[SC_POEMBRAGI] = SI_POEMBRAGI;
  1858. +   status->IconChangeTable[SC_APPLEIDUN] = SI_APPLEIDUN;
  1859.  
  1860.     //Other SC which are not necessarily associated to skills.
  1861.     status->ChangeFlagTable[SC_ATTHASTE_POTION1] = SCB_ASPD;
  1862. @@ -2303,6 +2310,8 @@ int status_calc_pc_(struct map_session_data* sd, enum e_status_calc_opt opt) {
  1863.             continue;
  1864.         if(i == EQI_COSTUME_TOP && (sd->equip_index[EQI_COSTUME_MID] == index || sd->equip_index[EQI_COSTUME_LOW] == index))
  1865.             continue;
  1866. +       if( (int)MakeDWord(sd->status.inventory[index].card[2],sd->status.inventory[index].card[3]) == battle_config.reserved_costume_id )
  1867. +           continue;
  1868.         if(!sd->inventory_data[index])
  1869.             continue;
  1870.  
  1871. @@ -7596,10 +7605,10 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t
  1872.                         int i;
  1873.                         for( i = 0; i < 5; i++ ) {
  1874.                             if( sd->devotion[i] && (tsd = map->id2sd(sd->devotion[i])) )
  1875. -                               status->change_start(bl, &tsd->bl, type, 10000, val1, val2, val3, val4, tick, SCFLAG_ALL);
  1876. +                               status->change_start(bl, &tsd->bl, type, 10000, val1, val2, val3, val4, tick, SCFLAG_NOAVOID);
  1877.                         }
  1878.                     } else if( bl->type == BL_MER && ((TBL_MER*)bl)->devotion_flag && (tsd = ((TBL_MER*)bl)->master) )
  1879. -                       status->change_start(bl, &tsd->bl, type, 10000, val1, val2, val3, val4, tick, SCFLAG_ALL);
  1880. +                       status->change_start(bl, &tsd->bl, type, 10000, val1, val2, val3, val4, tick, SCFLAG_NOAVOID);
  1881.                 }
  1882.                 //val4 signals infinite endure (if val4 == 2 it is infinite endure from Berserk)
  1883.                 if( val4 )
  1884. @@ -7695,10 +7704,10 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t
  1885.                         int i;
  1886.                         for( i = 0; i < 5; i++ ) {
  1887.                             if( sd->devotion[i] && (tsd = map->id2sd(sd->devotion[i])) )
  1888. -                               status->change_start(bl, &tsd->bl, type, 10000, val1, val2, 0, 0, tick, SCFLAG_ALL);
  1889. +                               status->change_start(bl, &tsd->bl, type, 10000, val1, val2, 0, 0, tick, SCFLAG_NOAVOID);
  1890.                         }
  1891.                     } else if( bl->type == BL_MER && ((TBL_MER*)bl)->devotion_flag && (tsd = ((TBL_MER*)bl)->master) )
  1892. -                       status->change_start(bl, &tsd->bl, type, 10000, val1, val2, 0, 0, tick, SCFLAG_ALL);
  1893. +                       status->change_start(bl, &tsd->bl, type, 10000, val1, val2, 0, 0, tick, SCFLAG_NOAVOID);
  1894.                 }
  1895.                 break;
  1896.             case SC_NOEQUIPWEAPON:
  1897. @@ -7920,8 +7929,8 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t
  1898.             case SC_RUWACH:
  1899.             case SC_WZ_SIGHTBLASTER:
  1900.                 val3 = skill->get_splash(val2, val1); //Val2 should bring the skill-id.
  1901. -               val2 = tick/20;
  1902. -               tick_time = 20; // [GodLesZ] tick time
  1903. +               val2 = tick/250;
  1904. +               tick_time = 10; // [GodLesZ] tick time
  1905.                 break;
  1906.  
  1907.                 //Permanent effects.
  1908. @@ -7953,11 +7962,11 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t
  1909.                         if( sd ) {
  1910.                             for( i = 0; i < 5; i++ ) {
  1911.                                 if( sd->devotion[i] && (tsd = map->id2sd(sd->devotion[i])) )
  1912. -                                   status->change_start(bl, &tsd->bl, type, 10000, val1, val2, 0, 0, tick, SCFLAG_ALL);
  1913. +                                   status->change_start(bl, &tsd->bl, type, 10000, val1, val2, 0, 0, tick, SCFLAG_NOAVOID);
  1914.                             }
  1915.                         }
  1916.                         else if( bl->type == BL_MER && ((TBL_MER*)bl)->devotion_flag && (tsd = ((TBL_MER*)bl)->master) )
  1917. -                           status->change_start(bl, &tsd->bl, type, 10000, val1, val2, 0, 0, tick, SCFLAG_ALL);
  1918. +                           status->change_start(bl, &tsd->bl, type, 10000, val1, val2, 0, 0, tick, SCFLAG_NOAVOID);
  1919.                     }
  1920.                 }
  1921.                 break;
  1922. @@ -9673,6 +9682,15 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t
  1923.     if( opt_flag&2 && sd && sd->touching_id )
  1924.         npc->touchnext_areanpc(sd,false); // run OnTouch_ on next char in range
  1925.  
  1926. +   if( sd && sd->status.party_id && (
  1927. +       type == SC_BLESSING || type == SC_INC_AGI || type == SC_PROTECTWEAPON || type == SC_PROTECTSHIELD ||
  1928. +       type == SC_PROTECTARMOR || type == SC_PROTECTHELM || type == SC_SOULLINK || type == SC_DEVOTION )
  1929. +   )
  1930. +   {
  1931. +       struct party_data *p = party->search(sd->status.party_id);
  1932. +       clif->party_info(p, NULL);
  1933. +   }
  1934. +
  1935.     return 1;
  1936.  }
  1937.  /*==========================================
  1938. @@ -10615,8 +10633,8 @@ int status_change_timer(int tid, int64 tick, int id, intptr_t data) {
  1939.                 map->foreachinrange(status->change_timer_sub, bl, sce->val3, BL_CHAR, bl, sce, type, tick);
  1940.  
  1941.             if( --(sce->val2)>0 ){
  1942. -               sce->val4 += 20; // use for Shadow Form 2 seconds checking.
  1943. -               sc_timer_next(20+tick, status->change_timer, bl->id, data);
  1944. +               sce->val4 += 250; // use for Shadow Form 2 seconds checking.
  1945. +               sc_timer_next(250+tick, status->change_timer, bl->id, data);
  1946.                 return 0;
  1947.             }
  1948.             break;
  1949. diff --git a/src/map/status.h b/src/map/status.h
  1950. index c8a7a08..959b4bc 100644
  1951. --- a/src/map/status.h
  1952. +++ b/src/map/status.h
  1953. @@ -1566,6 +1566,14 @@ enum si_type {
  1954.     //SI_MTF_RANGEATK2                         = 818,
  1955.     //SI_MTF_ASPD2                             = 819,
  1956.     //SI_MTF_MATK2                             = 820,
  1957. +  
  1958. +   // [Aeva]
  1959. +   SI_MINDBREAKER                           = 1001,
  1960. +   SI_SERVICEFORYOU                         = 1002,
  1961. +   SI_DONTFORGETME                          = 1003,
  1962. +   SI_ASSNCROS                              = 1004,
  1963. +   SI_POEMBRAGI                             = 1005,
  1964. +   SI_APPLEIDUN                             = 1006,
  1965.  
  1966.     SI_MAX,
  1967.  };
  1968. diff --git a/src/map/storage.c b/src/map/storage.c
  1969. index 79a5ad5..891188a 100644
  1970. --- a/src/map/storage.c
  1971. +++ b/src/map/storage.c
  1972. @@ -437,6 +437,12 @@ int guild_storage_additem(struct map_session_data* sd, struct guild_storage* sto
  1973.         return 1;
  1974.     }
  1975.  
  1976. +   if( sd->state.secure_items )
  1977. +   {
  1978. +       clif->message(sd->fd, "You are protected by @security, You can't do this action.");
  1979. +       return 1;
  1980. +   }
  1981. +
  1982.     if( item_data->bound && item_data->bound != IBT_GUILD && !pc_can_give_bound_items(sd) ) {
  1983.         clif->message(sd->fd, msg_sd(sd,294));
  1984.         return 1;
  1985. diff --git a/src/map/trade.c b/src/map/trade.c
  1986. index 7417f05..4ff638b 100644
  1987. --- a/src/map/trade.c
  1988. +++ b/src/map/trade.c
  1989. @@ -37,12 +37,22 @@ void trade_traderequest(struct map_session_data *sd, struct map_session_data *ta
  1990.         clif->message (sd->fd, msg_sd(sd,272));
  1991.         return; //Can't trade in notrade mapflag maps.
  1992.     }
  1993. +  
  1994. +   if( sd->state.secure_items ) {
  1995. +       clif->message(sd->fd, "You are protected by @security, You can't do this action.");
  1996. +       return;
  1997. +   }
  1998.  
  1999.     if (target_sd == NULL || sd == target_sd) {
  2000.         clif->tradestart(sd, 1); // character does not exist
  2001.         return;
  2002.     }
  2003.  
  2004. +   if( target_sd->state.secure_items ) {
  2005. +       clif->message(sd->fd, "You target protected by @security, You can't do this action.");
  2006. +       return;
  2007. +   }
  2008. +
  2009.     if (target_sd->npc_id) {
  2010.         //Trade fails if you are using an NPC.
  2011.         clif->tradestart(sd, 2);
  2012. diff --git a/src/map/unit.c b/src/map/unit.c
  2013. index 2dba10a..06b08cc 100644
  2014. --- a/src/map/unit.c
  2015. +++ b/src/map/unit.c
  2016. @@ -1608,6 +1608,13 @@ int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill_id, ui
  2017.     } else
  2018.         skill->castend_id(ud->skilltimer,tick,src->id,0);
  2019.  
  2020. +#ifdef ACHIEVEMENT
  2021. +   if( sd ){
  2022. +       sd->countskilllog ++;
  2023. +       npc->script_event(sd, NPCE_ONSKILL);
  2024. +   }
  2025. +#endif
  2026. +
  2027.     return 1;
  2028.  }
  2029.  
  2030. @@ -2505,6 +2512,7 @@ int unit_remove_map(struct block_list *bl, clr_type clrtype, const char* file, i
  2031.         }
  2032.         case BL_HOM: {
  2033.             struct homun_data *hd = (struct homun_data *)bl;
  2034. +           ud->canact_tick = ud->canmove_tick; //It appears HOM do reset the can-act tick.
  2035.             if( !hd->homunculus.intimacy && !(hd->master && !hd->master->state.active) ) {
  2036.                 //If logging out, this is deleted on unit->free
  2037.                 clif->emotion(bl, E_SOB);
  2038. diff --git a/src/plugins/Makefile.in b/src/plugins/Makefile.in
  2039. index 802d101..54d733a 100644
  2040. --- a/src/plugins/Makefile.in
  2041. +++ b/src/plugins/Makefile.in
  2042. @@ -18,7 +18,7 @@
  2043.  #                                                                    #
  2044.  # Note: DO NOT include the .c extension!!!                           #
  2045.  
  2046. -MYPLUGINS =
  2047. +MYPLUGINS = whosell
  2048.  
  2049.  #                                                                    #
  2050.  #########  DO NOT EDIT ANYTHING BELOW THIS LINE!!!  ##################
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement