diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/char/char.c | 21 | ||||
-rw-r--r-- | src/char/int_storage.c | 6 | ||||
-rw-r--r-- | src/login/lclif.c | 4 | ||||
-rw-r--r-- | src/login/lclif.p.h | 8 | ||||
-rw-r--r-- | src/map/atcommand.c | 39 | ||||
-rw-r--r-- | src/map/atcommand.h | 6 | ||||
-rw-r--r-- | src/map/packets.h | 356 | ||||
-rw-r--r-- | src/map/script.c | 48 | ||||
-rw-r--r-- | src/map/script.h | 1 |
9 files changed, 460 insertions, 29 deletions
diff --git a/src/char/char.c b/src/char/char.c index f6556073e..069ccc481 100644 --- a/src/char/char.c +++ b/src/char/char.c @@ -4432,14 +4432,21 @@ void char_parse_char_connect(int fd, struct char_session_data* sd, uint32 ipl) void char_send_map_info(int fd, int i, uint32 subnet_map_ip, struct mmo_charstatus *cd) { +#if PACKETVER < 20170329 + const int cmd = 0x71; + const int len = 28; +#else + const int cmd = 0xac5; + const int len = 156; +#endif nullpo_retv(cd); - WFIFOHEAD(fd,28); - WFIFOW(fd,0) = 0x71; - WFIFOL(fd,2) = cd->char_id; - mapindex->getmapname_ext(mapindex_id2name(cd->last_point.map), WFIFOP(fd,6)); - WFIFOL(fd,22) = htonl((subnet_map_ip) ? subnet_map_ip : chr->server[i].ip); - WFIFOW(fd,26) = sockt->ntows(htons(chr->server[i].port)); // [!] LE byte order here [!] - WFIFOSET(fd,28); + WFIFOHEAD(fd, len); + WFIFOW(fd, 0) = cmd; + WFIFOL(fd, 2) = cd->char_id; + mapindex->getmapname_ext(mapindex_id2name(cd->last_point.map), WFIFOP(fd, 6)); + WFIFOL(fd, 22) = htonl((subnet_map_ip) ? subnet_map_ip : chr->server[i].ip); + WFIFOW(fd, 26) = sockt->ntows(htons(chr->server[i].port)); // [!] LE byte order here [!] + WFIFOSET(fd, len); } void char_send_wait_char_server(int fd) diff --git a/src/char/int_storage.c b/src/char/int_storage.c index 20e852c66..65301127f 100644 --- a/src/char/int_storage.c +++ b/src/char/int_storage.c @@ -86,13 +86,13 @@ int inter_storage_tosql(int account_id, const struct storage_data *p) StrBuf->AppendStr(&buf, ", `expire_time`, `bound`, `unique_id`) VALUES"); } - StrBuf->Printf(&buf, "('%d', '%d', '%d', '%d', '%u', '%d', '%d', '%d'", - cp_it->id, account_id, p_it->nameid, p_it->amount, p_it->equip, p_it->identify, p_it->refine, p_it->attribute); + StrBuf->Printf(&buf, "%s('%d', '%d', '%d', '%d', '%u', '%d', '%d', '%d'", + total_updates > 0 ? ", " : "", cp_it->id, account_id, p_it->nameid, p_it->amount, p_it->equip, p_it->identify, p_it->refine, p_it->attribute); for (k = 0; k < MAX_SLOTS; k++) StrBuf->Printf(&buf, ", '%d'", p_it->card[k]); for (k = 0; k < MAX_ITEM_OPTIONS; ++k) StrBuf->Printf(&buf, ", '%d', '%d'", p_it->option[k].index, p_it->option[k].value); - StrBuf->Printf(&buf, ", '%u', '%d', '%"PRIu64"')%s", p_it->expire_time, p_it->bound, p_it->unique_id, total_updates > 0 ? ", " : ""); + StrBuf->Printf(&buf, ", '%u', '%d', '%"PRIu64"')", p_it->expire_time, p_it->bound, p_it->unique_id); total_updates++; } diff --git a/src/login/lclif.c b/src/login/lclif.c index 3ed257e85..f32538610 100644 --- a/src/login/lclif.c +++ b/src/login/lclif.c @@ -262,7 +262,11 @@ bool lclif_send_server_list(struct login_session_data *sd) WFIFOHEAD(sd->fd, length); packet = WP2PTR(sd->fd); +#if PACKETVER < 20170315 packet->packet_id = PACKET_ID_AC_ACCEPT_LOGIN; +#else + packet->packet_id = PACKET_ID_AC_ACCEPT_LOGIN2; +#endif packet->packet_len = length; packet->auth_code = sd->login_id1; packet->aid = sd->account_id; diff --git a/src/login/lclif.p.h b/src/login/lclif.p.h index ae9d1bc14..d28f1c587 100644 --- a/src/login/lclif.p.h +++ b/src/login/lclif.p.h @@ -56,7 +56,9 @@ enum login_packet_id { //PACKET_ID_CA_SSO_LOGIN_REQa = 0x825a, /* unused */ // AC (Login to Client) + PACKET_ID_AC_ACCEPT_LOGIN = 0x0069, + PACKET_ID_AC_ACCEPT_LOGIN2 = 0x0ac4, PACKET_ID_AC_REFUSE_LOGIN = 0x006a, PACKET_ID_SC_NOTIFY_BAN = 0x0081, PACKET_ID_AC_ACK_HASH = 0x01dc, @@ -256,6 +258,9 @@ struct packet_AC_ACCEPT_LOGIN { uint32 last_login_ip; ///< Last login IP char last_login_time[26]; ///< Last login timestamp uint8 sex; ///< Account sex +#if PACKETVER >= 20170315 + char unknown1[17]; +#endif struct { uint32 ip; ///< Server IP address int16 port; ///< Server port @@ -263,6 +268,9 @@ struct packet_AC_ACCEPT_LOGIN { uint16 usercount; ///< Online users uint16 state; ///< Server state uint16 property; ///< Server property +#if PACKETVER >= 20170315 + char unknown2[128]; +#endif } server_list[]; ///< List of charservers } __attribute__((packed)); diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 4d3a82ee2..19a7e360b 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -1408,7 +1408,7 @@ ACMD(baselevelup) pc->baselevelchanged(sd); if(sd->status.party_id) party->send_levelup(sd); - + if (level > 0 && battle_config.atcommand_levelup_events) npc->script_event(sd, NPCE_BASELVUP); // Trigger OnPCBaseLvUpEvent @@ -8398,7 +8398,9 @@ void atcommand_commands_sub(struct map_session_data* sd, const int fd, AtCommand int gm_lvl = pc_get_group_level(sd); for (i = 0; i < atcommand->binding_count; i++) { - if (gm_lvl >= ((type == COMMAND_ATCOMMAND) ? atcommand->binding[i]->group_lv : atcommand->binding[i]->group_lv_char)) { + if (gm_lvl >= ((type == COMMAND_ATCOMMAND) ? atcommand->binding[i]->group_lv : atcommand->binding[i]->group_lv_char) + || (type == COMMAND_ATCOMMAND && atcommand->binding[i]->at_groups[pcg->get_idx(sd->group)] > 0) + || (type == COMMAND_CHARCOMMAND && atcommand->binding[i]->char_groups[pcg->get_idx(sd->group)] > 0)) { size_t slen = strlen(atcommand->binding[i]->command); if (count_bind == 0) { cur = line_buff; @@ -9961,6 +9963,8 @@ bool atcommand_exec(const int fd, struct map_session_data *sd, const char *messa && ( (is_atcommand && pc_get_group_level(sd) >= binding->group_lv) || (!is_atcommand && pc_get_group_level(sd) >= binding->group_lv_char) + || (is_atcommand && binding->at_groups[pcg->get_idx(sd->group)] > 0) + || (!is_atcommand && binding->char_groups[pcg->get_idx(sd->group)] > 0) ) ) { if (binding->log) /* log only if this command should be logged [Ind/Hercules] */ @@ -10224,31 +10228,34 @@ void atcommand_db_load_groups(GroupSettings **groups, struct config_setting_t ** } bool atcommand_can_use(struct map_session_data *sd, const char *command) { - AtCommandInfo *info = atcommand->get_info_byname(atcommand->check_alias(command + 1)); + AtCommandInfo *acmd_d; + struct atcmd_binding_data *bcmd_d; nullpo_retr(false, sd); - nullpo_retr(false, command); - if (info == NULL) - return false; - if ((*command == atcommand->at_symbol && info->at_groups[pcg->get_idx(sd->group)] != 0) || - (*command == atcommand->char_symbol && info->char_groups[pcg->get_idx(sd->group)] != 0) ) { - return true; + if ((acmd_d = atcommand->get_info_byname(atcommand->check_alias(command + 1))) != NULL) { + return ((*command == atcommand->at_symbol && acmd_d->at_groups[pcg->get_idx(sd->group)] > 0) || + (*command == atcommand->char_symbol && acmd_d->char_groups[pcg->get_idx(sd->group)] > 0)); + } else if ((bcmd_d = atcommand->get_bind_byname(atcommand->check_alias(command + 1))) != NULL) { + return ((*command == atcommand->at_symbol && bcmd_d->at_groups[pcg->get_idx(sd->group)] > 0) || + (*command == atcommand->char_symbol && bcmd_d->char_groups[pcg->get_idx(sd->group)] > 0)); } return false; } + bool atcommand_can_use2(struct map_session_data *sd, const char *command, AtCommandType type) { - AtCommandInfo *info = atcommand->get_info_byname(atcommand->check_alias(command)); + AtCommandInfo *acmd_d; + struct atcmd_binding_data *bcmd_d; nullpo_retr(false, sd); - nullpo_retr(false, command); - if (info == NULL) - return false; - if ((type == COMMAND_ATCOMMAND && info->at_groups[pcg->get_idx(sd->group)] != 0) || - (type == COMMAND_CHARCOMMAND && info->char_groups[pcg->get_idx(sd->group)] != 0) ) { - return true; + if ((acmd_d = atcommand->get_info_byname(atcommand->check_alias(command))) != NULL) { + return ((type == COMMAND_ATCOMMAND && acmd_d->at_groups[pcg->get_idx(sd->group)] > 0) || + (type == COMMAND_CHARCOMMAND && acmd_d->char_groups[pcg->get_idx(sd->group)] > 0)); + } else if ((bcmd_d = atcommand->get_bind_byname(atcommand->check_alias(command))) != NULL) { + return ((type == COMMAND_ATCOMMAND && bcmd_d->at_groups[pcg->get_idx(sd->group)] > 0) || + (type == COMMAND_CHARCOMMAND && bcmd_d->char_groups[pcg->get_idx(sd->group)] > 0)); } return false; diff --git a/src/map/atcommand.h b/src/map/atcommand.h index 35b3c382e..efcf6dd31 100644 --- a/src/map/atcommand.h +++ b/src/map/atcommand.h @@ -79,8 +79,10 @@ struct AtCommandInfo { struct atcmd_binding_data { char command[ATCOMMAND_LENGTH]; char npc_event[ATCOMMAND_LENGTH]; - int group_lv; - int group_lv_char; + int group_lv; // DEPRECATED + int group_lv_char; // DEPRECATED + char *at_groups; // quick @commands "can-use" lookup + char *char_groups; // quick @charcommands "can-use" lookup bool log; }; diff --git a/src/map/packets.h b/src/map/packets.h index d1875f2f0..0a774561d 100644 --- a/src/map/packets.h +++ b/src/map/packets.h @@ -5711,6 +5711,40 @@ packet(0x96e,-1,clif->ackmergeitems); packet(0x0ab3,19); #endif +// 2017-01-25aRagexeRE +#if PACKETVER == 20170125 +// shuffle packets + packet(0x0438,7,clif->pActionRequest,2,6); // CZ_REQUEST_ACT + packet(0x0811,19,clif->pWantToConnection,2,6,10,14,18); // CZ_ENTER + packet(0x086e,26,clif->pPartyInvite2,2); // CZ_PARTY_JOIN_REQ + packet(0x0876,5,clif->pHomMenu,2,4); // CZ_COMMAND_MER + packet(0x0877,6,clif->pDropItem,2,4); // CZ_ITEM_THROW + packet(0x0879,10,clif->pUseSkillToId,2,4,6); // CZ_USE_SKILL + packet(0x087b,6,clif->pTakeItem,2); // CZ_ITEM_PICKUP + packet(0x087d,-1,clif->pReqTradeBuyingStore,2,4,8,12); // CZ_REQ_TRADE_BUYING_STORE + packet(0x0881,5,clif->pChangeDir,2,4); // CZ_CHANGE_DIRECTION + packet(0x0884,8,clif->pDull/*,XXX*/); // CZ_JOIN_BATTLE_FIELD + packet(0x0893,36,clif->pStoragePassword,0); // CZ_ACK_STORE_PASSWORD + packet(0x0894,4,clif->pDull/*,XXX*/); // CZ_GANGSI_RANK + packet(0x0895,-1,clif->pItemListWindowSelected,2,4,8); // CZ_ITEMLISTWIN_RES + packet(0x0898,6,clif->pSolveCharName,2); // CZ_REQNAME_BYGID + packet(0x089b,90,clif->pUseSkillToPosMoreInfo,2,4,6,8,10); // CZ_USE_SKILL_TOGROUND_WITHTALKBOX + packet(0x08a5,-1,clif->pReqOpenBuyingStore,2,4,8,9,89); // CZ_REQ_OPEN_BUYING_STORE + packet(0x091b,6,clif->pReqClickBuyingStore,2); // CZ_REQ_CLICK_TO_BUYING_STORE + packet(0x091c,8,clif->pMoveToKafra,2,4); // CZ_MOVE_ITEM_FROM_BODY_TO_STORE + packet(0x091d,2,clif->pReqCloseBuyingStore,0); // CZ_REQ_CLOSE_BUYING_STORE + packet(0x0920,26,clif->pFriendsListAdd,2); // CZ_ADD_FRIENDS + packet(0x0929,12,clif->pSearchStoreInfoListItemClick,2,6,10); // CZ_SSILIST_ITEM_CLICK + packet(0x092b,10,clif->pUseSkillToPos,2,4,6,8); // CZ_USE_SKILL_TOGROUND + packet(0x0930,5,clif->pWalkToXY,2); // CZ_REQUEST_MOVE + packet(0x093c,-1,clif->pSearchStoreInfo,2,4,5,9,13,14,15); // CZ_SEARCH_STORE_INFO + packet(0x0943,6,clif->pTickSend,2); // CZ_REQUEST_TIME + packet(0x0944,18,clif->pPartyBookingRegisterReq,2,4); // CZ_PARTY_BOOKING_REQ_REGISTER + packet(0x095c,8,clif->pMoveFromKafra,2,4); // CZ_MOVE_ITEM_FROM_STORE_TO_BODY + packet(0x0965,6,clif->pGetCharNameRequest,2); // CZ_REQNAME + packet(0x0968,2,clif->pSearchStoreInfoNextPage,0); // CZ_SEARCH_STORE_INFO_NEXT_PAGE +#endif + // 2017-02-01aRagexeRE #if PACKETVER >= 20170201 // new packets @@ -5718,6 +5752,40 @@ packet(0x96e,-1,clif->ackmergeitems); // changed packet sizes #endif +// 2017-02-08aRagexeRE +#if PACKETVER == 20170208 +// shuffle packets + packet(0x02c4,4,clif->pDull/*,XXX*/); // CZ_GANGSI_RANK + packet(0x035f,6,clif->pTickSend,2); // CZ_REQUEST_TIME + packet(0x0360,6,clif->pReqClickBuyingStore,2); // CZ_REQ_CLICK_TO_BUYING_STORE + packet(0x0366,90,clif->pUseSkillToPosMoreInfo,2,4,6,8,10); // CZ_USE_SKILL_TOGROUND_WITHTALKBOX + packet(0x0367,-1,clif->pItemListWindowSelected,2,4,8); // CZ_ITEMLISTWIN_RES + packet(0x0368,6,clif->pSolveCharName,2); // CZ_REQNAME_BYGID + packet(0x0369,7,clif->pActionRequest,2,6); // CZ_REQUEST_ACT + packet(0x0437,5,clif->pWalkToXY,2); // CZ_REQUEST_MOVE + packet(0x0438,10,clif->pUseSkillToPos,2,4,6,8); // CZ_USE_SKILL_TOGROUND + packet(0x0811,-1,clif->pReqTradeBuyingStore,2,4,8,12); // CZ_REQ_TRADE_BUYING_STORE + packet(0x0815,-1,clif->pReqOpenBuyingStore,2,4,8,9,89); // CZ_REQ_OPEN_BUYING_STORE + packet(0x0817,2,clif->pReqCloseBuyingStore,0); // CZ_REQ_CLOSE_BUYING_STORE + packet(0x0819,-1,clif->pSearchStoreInfo,2,4,5,9,13,14,15); // CZ_SEARCH_STORE_INFO + packet(0x0835,2,clif->pSearchStoreInfoNextPage,0); // CZ_SEARCH_STORE_INFO_NEXT_PAGE + packet(0x0838,12,clif->pSearchStoreInfoListItemClick,2,6,10); // CZ_SSILIST_ITEM_CLICK + packet(0x083c,10,clif->pUseSkillToId,2,4,6); // CZ_USE_SKILL + packet(0x085c,26,clif->pPartyInvite2,2); // CZ_PARTY_JOIN_REQ + packet(0x0860,5,clif->pChangeDir,2,4); // CZ_CHANGE_DIRECTION + packet(0x087a,8,clif->pDull/*,XXX*/); // CZ_JOIN_BATTLE_FIELD + packet(0x088c,19,clif->pWantToConnection,2,6,10,14,18); // CZ_ENTER + packet(0x0892,26,clif->pFriendsListAdd,2); // CZ_ADD_FRIENDS + packet(0x08a1,18,clif->pPartyBookingRegisterReq,2,4); // CZ_PARTY_BOOKING_REQ_REGISTER + packet(0x08ac,8,clif->pMoveToKafra,2,4); // CZ_MOVE_ITEM_FROM_BODY_TO_STORE + packet(0x0921,6,clif->pDropItem,2,4); // CZ_ITEM_THROW + packet(0x0923,6,clif->pTakeItem,2); // CZ_ITEM_PICKUP + packet(0x092d,5,clif->pHomMenu,2,4); // CZ_COMMAND_MER + packet(0x0932,8,clif->pMoveFromKafra,2,4); // CZ_MOVE_ITEM_FROM_STORE_TO_BODY + packet(0x0937,36,clif->pStoragePassword,0); // CZ_ACK_STORE_PASSWORD + packet(0x096a,6,clif->pGetCharNameRequest,2); // CZ_REQNAME +#endif + // 2017-02-15aRagexeRE #if PACKETVER >= 20170215 // new packets @@ -5734,6 +5802,40 @@ packet(0x96e,-1,clif->ackmergeitems); #endif // 2017-02-28aRagexeRE +#if PACKETVER == 20170228 +// shuffle packets + packet(0x022d,6,clif->pDropItem,2,4); // CZ_ITEM_THROW + packet(0x0360,7,clif->pActionRequest,2,6); // CZ_REQUEST_ACT + packet(0x0362,5,clif->pHomMenu,2,4); // CZ_COMMAND_MER + packet(0x0819,12,clif->pSearchStoreInfoListItemClick,2,6,10); // CZ_SSILIST_ITEM_CLICK + packet(0x085e,90,clif->pUseSkillToPosMoreInfo,2,4,6,8,10); // CZ_USE_SKILL_TOGROUND_WITHTALKBOX + packet(0x0863,-1,clif->pSearchStoreInfo,2,4,5,9,13,14,15); // CZ_SEARCH_STORE_INFO + packet(0x086b,19,clif->pWantToConnection,2,6,10,14,18); // CZ_ENTER + packet(0x0873,-1,clif->pItemListWindowSelected,2,4,8); // CZ_ITEMLISTWIN_RES + packet(0x0874,-1,clif->pReqOpenBuyingStore,2,4,8,9,89); // CZ_REQ_OPEN_BUYING_STORE + packet(0x0876,2,clif->pReqCloseBuyingStore,0); // CZ_REQ_CLOSE_BUYING_STORE + packet(0x0883,2,clif->pSearchStoreInfoNextPage,0); // CZ_SEARCH_STORE_INFO_NEXT_PAGE + packet(0x0884,5,clif->pWalkToXY,2); // CZ_REQUEST_MOVE + packet(0x0889,5,clif->pChangeDir,2,4); // CZ_CHANGE_DIRECTION + packet(0x0893,6,clif->pGetCharNameRequest,2); // CZ_REQNAME + packet(0x089e,8,clif->pMoveToKafra,2,4); // CZ_MOVE_ITEM_FROM_BODY_TO_STORE + packet(0x08a0,26,clif->pFriendsListAdd,2); // CZ_ADD_FRIENDS + packet(0x08a2,36,clif->pStoragePassword,0); // CZ_ACK_STORE_PASSWORD + packet(0x08a6,8,clif->pDull/*,XXX*/); // CZ_JOIN_BATTLE_FIELD + packet(0x08a7,6,clif->pReqClickBuyingStore,2); // CZ_REQ_CLICK_TO_BUYING_STORE + packet(0x091f,10,clif->pUseSkillToId,2,4,6); // CZ_USE_SKILL + packet(0x092a,6,clif->pTakeItem,2); // CZ_ITEM_PICKUP + packet(0x092e,-1,clif->pReqTradeBuyingStore,2,4,8,12); // CZ_REQ_TRADE_BUYING_STORE + packet(0x0937,6,clif->pTickSend,2); // CZ_REQUEST_TIME + packet(0x093e,4,clif->pDull/*,XXX*/); // CZ_GANGSI_RANK + packet(0x0944,8,clif->pMoveFromKafra,2,4); // CZ_MOVE_ITEM_FROM_STORE_TO_BODY + packet(0x0947,6,clif->pSolveCharName,2); // CZ_REQNAME_BYGID + packet(0x0948,26,clif->pPartyInvite2,2); // CZ_PARTY_JOIN_REQ + packet(0x0952,10,clif->pUseSkillToPos,2,4,6,8); // CZ_USE_SKILL_TOGROUND + packet(0x0955,18,clif->pPartyBookingRegisterReq,2,4); // CZ_PARTY_BOOKING_REQ_REGISTER +#endif + +// 2017-02-28aRagexeRE #if PACKETVER >= 20170228 // new packets packet(0x0ac0,26); @@ -5750,6 +5852,40 @@ packet(0x96e,-1,clif->ackmergeitems); #endif // 2017-03-08bRagexeRE +#if PACKETVER == 20170308 +// shuffle packets + packet(0x0202,5,clif->pChangeDir,2,4); // CZ_CHANGE_DIRECTION + packet(0x022d,19,clif->pWantToConnection,2,6,10,14,18); // CZ_ENTER + packet(0x023b,26,clif->pFriendsListAdd,2); // CZ_ADD_FRIENDS + packet(0x0281,-1,clif->pItemListWindowSelected,2,4,8); // CZ_ITEMLISTWIN_RES + packet(0x035f,6,clif->pTickSend,2); // CZ_REQUEST_TIME + packet(0x0360,6,clif->pReqClickBuyingStore,2); // CZ_REQ_CLICK_TO_BUYING_STORE + packet(0x0361,5,clif->pHomMenu,2,4); // CZ_COMMAND_MER + packet(0x0362,6,clif->pDropItem,2,4); // CZ_ITEM_THROW + packet(0x0363,8,clif->pDull/*,XXX*/); // CZ_JOIN_BATTLE_FIELD + packet(0x0364,8,clif->pMoveFromKafra,2,4); // CZ_MOVE_ITEM_FROM_STORE_TO_BODY + packet(0x0365,18,clif->pPartyBookingRegisterReq,2,4); // CZ_PARTY_BOOKING_REQ_REGISTER + packet(0x0366,90,clif->pUseSkillToPosMoreInfo,2,4,6,8,10); // CZ_USE_SKILL_TOGROUND_WITHTALKBOX + packet(0x0368,6,clif->pSolveCharName,2); // CZ_REQNAME_BYGID + packet(0x0369,7,clif->pActionRequest,2,6); // CZ_REQUEST_ACT + packet(0x0436,4,clif->pDull/*,XXX*/); // CZ_GANGSI_RANK + packet(0x0437,5,clif->pWalkToXY,2); // CZ_REQUEST_MOVE + packet(0x0438,10,clif->pUseSkillToPos,2,4,6,8); // CZ_USE_SKILL_TOGROUND + packet(0x07e4,6,clif->pTakeItem,2); // CZ_ITEM_PICKUP + packet(0x07ec,8,clif->pMoveToKafra,2,4); // CZ_MOVE_ITEM_FROM_BODY_TO_STORE + packet(0x0802,26,clif->pPartyInvite2,2); // CZ_PARTY_JOIN_REQ + packet(0x0811,-1,clif->pReqTradeBuyingStore,2,4,8,12); // CZ_REQ_TRADE_BUYING_STORE + packet(0x0815,-1,clif->pReqOpenBuyingStore,2,4,8,9,89); // CZ_REQ_OPEN_BUYING_STORE + packet(0x0817,2,clif->pReqCloseBuyingStore,0); // CZ_REQ_CLOSE_BUYING_STORE + packet(0x0819,-1,clif->pSearchStoreInfo,2,4,5,9,13,14,15); // CZ_SEARCH_STORE_INFO + packet(0x0835,2,clif->pSearchStoreInfoNextPage,0); // CZ_SEARCH_STORE_INFO_NEXT_PAGE + packet(0x0838,12,clif->pSearchStoreInfoListItemClick,2,6,10); // CZ_SSILIST_ITEM_CLICK + packet(0x083c,10,clif->pUseSkillToId,2,4,6); // CZ_USE_SKILL + packet(0x087d,36,clif->pStoragePassword,0); // CZ_ACK_STORE_PASSWORD + packet(0x096a,6,clif->pGetCharNameRequest,2); // CZ_REQNAME +#endif + +// 2017-03-08bRagexeRE #if PACKETVER >= 20170308 // new packets packet(0x0ac8,2); @@ -5757,6 +5893,74 @@ packet(0x96e,-1,clif->ackmergeitems); // changed packet sizes #endif +// 2017-03-15cRagexeRE +#if PACKETVER == 20170315 +// shuffle packets + packet(0x02c4,10,clif->pUseSkillToPos,2,4,6,8); // CZ_USE_SKILL_TOGROUND + packet(0x035f,-1,clif->pSearchStoreInfo,2,4,5,9,13,14,15); // CZ_SEARCH_STORE_INFO + packet(0x0360,5,clif->pChangeDir,2,4); // CZ_CHANGE_DIRECTION + packet(0x0366,6,clif->pTakeItem,2); // CZ_ITEM_PICKUP + packet(0x0367,90,clif->pUseSkillToPosMoreInfo,2,4,6,8,10); // CZ_USE_SKILL_TOGROUND_WITHTALKBOX + packet(0x0436,-1,clif->pReqTradeBuyingStore,2,4,8,12); // CZ_REQ_TRADE_BUYING_STORE + packet(0x07ec,6,clif->pTickSend,2); // CZ_REQUEST_TIME + packet(0x085c,4,clif->pDull/*,XXX*/); // CZ_GANGSI_RANK + packet(0x0863,5,clif->pHomMenu,2,4); // CZ_COMMAND_MER + packet(0x086a,8,clif->pMoveFromKafra,2,4); // CZ_MOVE_ITEM_FROM_STORE_TO_BODY + packet(0x0872,26,clif->pFriendsListAdd,2); // CZ_ADD_FRIENDS + packet(0x087b,26,clif->pPartyInvite2,2); // CZ_PARTY_JOIN_REQ + packet(0x0884,7,clif->pActionRequest,2,6); // CZ_REQUEST_ACT + packet(0x088b,18,clif->pPartyBookingRegisterReq,2,4); // CZ_PARTY_BOOKING_REQ_REGISTER + packet(0x088d,8,clif->pDull/*,XXX*/); // CZ_JOIN_BATTLE_FIELD + packet(0x088f,5,clif->pWalkToXY,2); // CZ_REQUEST_MOVE + packet(0x0892,10,clif->pUseSkillToId,2,4,6); // CZ_USE_SKILL + packet(0x089c,2,clif->pReqCloseBuyingStore,0); // CZ_REQ_CLOSE_BUYING_STORE + packet(0x08aa,8,clif->pMoveToKafra,2,4); // CZ_MOVE_ITEM_FROM_BODY_TO_STORE + packet(0x091a,6,clif->pDropItem,2,4); // CZ_ITEM_THROW + packet(0x091b,-1,clif->pReqOpenBuyingStore,2,4,8,9,89); // CZ_REQ_OPEN_BUYING_STORE + packet(0x091d,12,clif->pSearchStoreInfoListItemClick,2,6,10); // CZ_SSILIST_ITEM_CLICK + packet(0x0920,6,clif->pSolveCharName,2); // CZ_REQNAME_BYGID + packet(0x0922,-1,clif->pItemListWindowSelected,2,4,8); // CZ_ITEMLISTWIN_RES + packet(0x0944,6,clif->pGetCharNameRequest,2); // CZ_REQNAME + packet(0x094a,6,clif->pReqClickBuyingStore,2); // CZ_REQ_CLICK_TO_BUYING_STORE + packet(0x094e,19,clif->pWantToConnection,2,6,10,14,18); // CZ_ENTER + packet(0x0950,2,clif->pSearchStoreInfoNextPage,0); // CZ_SEARCH_STORE_INFO_NEXT_PAGE + packet(0x0952,36,clif->pStoragePassword,0); // CZ_ACK_STORE_PASSWORD +#endif + +// 2017-03-22aRagexeRE +#if PACKETVER == 20170322 +// shuffle packets + packet(0x0202,5,clif->pChangeDir,2,4); // CZ_CHANGE_DIRECTION + packet(0x022d,19,clif->pWantToConnection,2,6,10,14,18); // CZ_ENTER + packet(0x023b,26,clif->pFriendsListAdd,2); // CZ_ADD_FRIENDS + packet(0x0281,-1,clif->pItemListWindowSelected,2,4,8); // CZ_ITEMLISTWIN_RES + packet(0x035f,6,clif->pTickSend,2); // CZ_REQUEST_TIME + packet(0x0360,6,clif->pReqClickBuyingStore,2); // CZ_REQ_CLICK_TO_BUYING_STORE + packet(0x0361,5,clif->pHomMenu,2,4); // CZ_COMMAND_MER + packet(0x0362,6,clif->pDropItem,2,4); // CZ_ITEM_THROW + packet(0x0363,8,clif->pDull/*,XXX*/); // CZ_JOIN_BATTLE_FIELD + packet(0x0364,8,clif->pMoveFromKafra,2,4); // CZ_MOVE_ITEM_FROM_STORE_TO_BODY + packet(0x0365,18,clif->pPartyBookingRegisterReq,2,4); // CZ_PARTY_BOOKING_REQ_REGISTER + packet(0x0366,90,clif->pUseSkillToPosMoreInfo,2,4,6,8,10); // CZ_USE_SKILL_TOGROUND_WITHTALKBOX + packet(0x0368,6,clif->pSolveCharName,2); // CZ_REQNAME_BYGID + packet(0x0369,7,clif->pActionRequest,2,6); // CZ_REQUEST_ACT + packet(0x0436,4,clif->pDull/*,XXX*/); // CZ_GANGSI_RANK + packet(0x0437,5,clif->pWalkToXY,2); // CZ_REQUEST_MOVE + packet(0x0438,10,clif->pUseSkillToPos,2,4,6,8); // CZ_USE_SKILL_TOGROUND + packet(0x07e4,6,clif->pTakeItem,2); // CZ_ITEM_PICKUP + packet(0x07ec,8,clif->pMoveToKafra,2,4); // CZ_MOVE_ITEM_FROM_BODY_TO_STORE + packet(0x0802,26,clif->pPartyInvite2,2); // CZ_PARTY_JOIN_REQ + packet(0x0811,-1,clif->pReqTradeBuyingStore,2,4,8,12); // CZ_REQ_TRADE_BUYING_STORE + packet(0x0815,-1,clif->pReqOpenBuyingStore,2,4,8,9,89); // CZ_REQ_OPEN_BUYING_STORE + packet(0x0817,2,clif->pReqCloseBuyingStore,0); // CZ_REQ_CLOSE_BUYING_STORE + packet(0x0819,-1,clif->pSearchStoreInfo,2,4,5,9,13,14,15); // CZ_SEARCH_STORE_INFO + packet(0x0835,2,clif->pSearchStoreInfoNextPage,0); // CZ_SEARCH_STORE_INFO_NEXT_PAGE + packet(0x0838,12,clif->pSearchStoreInfoListItemClick,2,6,10); // CZ_SSILIST_ITEM_CLICK + packet(0x083c,10,clif->pUseSkillToId,2,4,6); // CZ_USE_SKILL + packet(0x091a,36,clif->pStoragePassword,0); // CZ_ACK_STORE_PASSWORD + packet(0x096a,6,clif->pGetCharNameRequest,2); // CZ_REQNAME +#endif + // 2017-03-22aRagexeRE #if PACKETVER >= 20170322 // new packets @@ -5764,6 +5968,40 @@ packet(0x96e,-1,clif->ackmergeitems); // changed packet sizes #endif +// 2017-03-29dRagexeRE +#if PACKETVER == 20170329 +// shuffle packets + packet(0x0281,26,clif->pPartyInvite2,2); // CZ_PARTY_JOIN_REQ + packet(0x035f,6,clif->pTickSend,2); // CZ_REQUEST_TIME + packet(0x0360,6,clif->pReqClickBuyingStore,2); // CZ_REQ_CLICK_TO_BUYING_STORE + packet(0x0362,5,clif->pHomMenu,2,4); // CZ_COMMAND_MER + packet(0x0363,8,clif->pMoveToKafra,2,4); // CZ_MOVE_ITEM_FROM_BODY_TO_STORE + packet(0x0366,90,clif->pUseSkillToPosMoreInfo,2,4,6,8,10); // CZ_USE_SKILL_TOGROUND_WITHTALKBOX + packet(0x0368,6,clif->pSolveCharName,2); // CZ_REQNAME_BYGID + packet(0x0369,7,clif->pActionRequest,2,6); // CZ_REQUEST_ACT + packet(0x0437,5,clif->pWalkToXY,2); // CZ_REQUEST_MOVE + packet(0x0438,10,clif->pUseSkillToPos,2,4,6,8); // CZ_USE_SKILL_TOGROUND + packet(0x0811,-1,clif->pReqTradeBuyingStore,2,4,8,12); // CZ_REQ_TRADE_BUYING_STORE + packet(0x0815,-1,clif->pReqOpenBuyingStore,2,4,8,9,89); // CZ_REQ_OPEN_BUYING_STORE + packet(0x0817,2,clif->pReqCloseBuyingStore,0); // CZ_REQ_CLOSE_BUYING_STORE + packet(0x0835,2,clif->pSearchStoreInfoNextPage,0); // CZ_SEARCH_STORE_INFO_NEXT_PAGE + packet(0x0838,12,clif->pSearchStoreInfoListItemClick,2,6,10); // CZ_SSILIST_ITEM_CLICK + packet(0x083c,10,clif->pUseSkillToId,2,4,6); // CZ_USE_SKILL + packet(0x085d,36,clif->pStoragePassword,0); // CZ_ACK_STORE_PASSWORD + packet(0x087a,18,clif->pPartyBookingRegisterReq,2,4); // CZ_PARTY_BOOKING_REQ_REGISTER + packet(0x0888,-1,clif->pSearchStoreInfo,2,4,5,9,13,14,15); // CZ_SEARCH_STORE_INFO + packet(0x08a8,6,clif->pDropItem,2,4); // CZ_ITEM_THROW + packet(0x0917,8,clif->pDull/*,XXX*/); // CZ_JOIN_BATTLE_FIELD + packet(0x0926,5,clif->pChangeDir,2,4); // CZ_CHANGE_DIRECTION + packet(0x0929,6,clif->pTakeItem,2); // CZ_ITEM_PICKUP + packet(0x092e,19,clif->pWantToConnection,2,6,10,14,18); // CZ_ENTER + packet(0x0937,-1,clif->pItemListWindowSelected,2,4,8); // CZ_ITEMLISTWIN_RES + packet(0x0939,26,clif->pFriendsListAdd,2); // CZ_ADD_FRIENDS + packet(0x0949,8,clif->pMoveFromKafra,2,4); // CZ_MOVE_ITEM_FROM_STORE_TO_BODY + packet(0x095f,4,clif->pDull/*,XXX*/); // CZ_GANGSI_RANK + packet(0x096a,6,clif->pGetCharNameRequest,2); // CZ_REQNAME +#endif + // 2017-03-29cRagexeRE #if PACKETVER >= 20170329 // new packets @@ -5772,6 +6010,40 @@ packet(0x96e,-1,clif->ackmergeitems); #endif // 2017-04-05bRagexeRE +#if PACKETVER == 20170405 +// shuffle packets + packet(0x022d,2,clif->pSearchStoreInfoNextPage,0); // CZ_SEARCH_STORE_INFO_NEXT_PAGE + packet(0x0281,18,clif->pPartyBookingRegisterReq,2,4); // CZ_PARTY_BOOKING_REQ_REGISTER + packet(0x035f,6,clif->pTickSend,2); // CZ_REQUEST_TIME + packet(0x0360,6,clif->pReqClickBuyingStore,2); // CZ_REQ_CLICK_TO_BUYING_STORE + packet(0x0362,7,clif->pActionRequest,2,6); // CZ_REQUEST_ACT + packet(0x0363,4,clif->pDull/*,XXX*/); // CZ_GANGSI_RANK + packet(0x0366,90,clif->pUseSkillToPosMoreInfo,2,4,6,8,10); // CZ_USE_SKILL_TOGROUND_WITHTALKBOX + packet(0x0368,6,clif->pSolveCharName,2); // CZ_REQNAME_BYGID + packet(0x0369,6,clif->pTakeItem,2); // CZ_ITEM_PICKUP + packet(0x0437,5,clif->pWalkToXY,2); // CZ_REQUEST_MOVE + packet(0x0438,10,clif->pUseSkillToPos,2,4,6,8); // CZ_USE_SKILL_TOGROUND + packet(0x0811,-1,clif->pReqTradeBuyingStore,2,4,8,12); // CZ_REQ_TRADE_BUYING_STORE + packet(0x0815,-1,clif->pReqOpenBuyingStore,2,4,8,9,89); // CZ_REQ_OPEN_BUYING_STORE + packet(0x0817,2,clif->pReqCloseBuyingStore,0); // CZ_REQ_CLOSE_BUYING_STORE + packet(0x0819,-1,clif->pSearchStoreInfo,2,4,5,9,13,14,15); // CZ_SEARCH_STORE_INFO + packet(0x0835,5,clif->pHomMenu,2,4); // CZ_COMMAND_MER + packet(0x0838,12,clif->pSearchStoreInfoListItemClick,2,6,10); // CZ_SSILIST_ITEM_CLICK + packet(0x083c,10,clif->pUseSkillToId,2,4,6); // CZ_USE_SKILL + packet(0x085f,8,clif->pMoveToKafra,2,4); // CZ_MOVE_ITEM_FROM_BODY_TO_STORE + packet(0x0860,-1,clif->pItemListWindowSelected,2,4,8); // CZ_ITEMLISTWIN_RES + packet(0x0864,26,clif->pPartyInvite2,2); // CZ_PARTY_JOIN_REQ + packet(0x0865,5,clif->pChangeDir,2,4); // CZ_CHANGE_DIRECTION + packet(0x086f,26,clif->pFriendsListAdd,2); // CZ_ADD_FRIENDS + packet(0x0893,8,clif->pMoveFromKafra,2,4); // CZ_MOVE_ITEM_FROM_STORE_TO_BODY + packet(0x08a5,19,clif->pWantToConnection,2,6,10,14,18); // CZ_ENTER + packet(0x094c,36,clif->pStoragePassword,0); // CZ_ACK_STORE_PASSWORD + packet(0x094f,8,clif->pDull/*,XXX*/); // CZ_JOIN_BATTLE_FIELD + packet(0x0964,6,clif->pDropItem,2,4); // CZ_ITEM_THROW + packet(0x096a,6,clif->pGetCharNameRequest,2); // CZ_REQNAME +#endif + +// 2017-04-05bRagexeRE #if PACKETVER >= 20170405 // new packets packet(0x0acb,12); @@ -5787,6 +6059,55 @@ packet(0x96e,-1,clif->ackmergeitems); packet(0x0a99,4); #endif +// 2017-04-26dRagexeRE +#if PACKETVER >= 20170426 +// new packets +// changed packet sizes + packet(0x0a98,10); +#endif + +// 2017-05-02dRagexeRE +#if PACKETVER >= 20170502 +// new packets + packet(0x0ace,4); +// changed packet sizes +#endif + +// 2017-05-17aRagexeRE +#if PACKETVER == 20170517 +// shuffle packets + packet(0x0364,8,clif->pDull/*,XXX*/); // CZ_JOIN_BATTLE_FIELD + packet(0x0367,-1,clif->pReqOpenBuyingStore,2,4,8,9,89); // CZ_REQ_OPEN_BUYING_STORE + packet(0x0437,7,clif->pActionRequest,2,6); // CZ_REQUEST_ACT + packet(0x0802,18,clif->pPartyBookingRegisterReq,2,4); // CZ_PARTY_BOOKING_REQ_REGISTER + packet(0x0815,10,clif->pUseSkillToId,2,4,6); // CZ_USE_SKILL + packet(0x0817,10,clif->pUseSkillToPos,2,4,6,8); // CZ_USE_SKILL_TOGROUND + packet(0x0868,90,clif->pUseSkillToPosMoreInfo,2,4,6,8,10); // CZ_USE_SKILL_TOGROUND_WITHTALKBOX + packet(0x0875,2,clif->pSearchStoreInfoNextPage,0); // CZ_SEARCH_STORE_INFO_NEXT_PAGE + packet(0x087b,6,clif->pSolveCharName,2); // CZ_REQNAME_BYGID + packet(0x087d,-1,clif->pSearchStoreInfo,2,4,5,9,13,14,15); // CZ_SEARCH_STORE_INFO + packet(0x088c,8,clif->pMoveFromKafra,2,4); // CZ_MOVE_ITEM_FROM_STORE_TO_BODY + packet(0x088d,5,clif->pChangeDir,2,4); // CZ_CHANGE_DIRECTION + packet(0x0894,6,clif->pGetCharNameRequest,2); // CZ_REQNAME + packet(0x0896,12,clif->pSearchStoreInfoListItemClick,2,6,10); // CZ_SSILIST_ITEM_CLICK + packet(0x0899,26,clif->pPartyInvite2,2); // CZ_PARTY_JOIN_REQ + packet(0x089e,4,clif->pDull/*,XXX*/); // CZ_GANGSI_RANK + packet(0x089f,2,clif->pReqCloseBuyingStore,0); // CZ_REQ_CLOSE_BUYING_STORE + packet(0x08a2,6,clif->pTickSend,2); // CZ_REQUEST_TIME + packet(0x08a8,5,clif->pWalkToXY,2); // CZ_REQUEST_MOVE + packet(0x08aa,8,clif->pMoveToKafra,2,4); // CZ_MOVE_ITEM_FROM_BODY_TO_STORE + packet(0x091b,-1,clif->pReqTradeBuyingStore,2,4,8,12); // CZ_REQ_TRADE_BUYING_STORE + packet(0x0923,19,clif->pWantToConnection,2,6,10,14,18); // CZ_ENTER + packet(0x093b,6,clif->pDropItem,2,4); // CZ_ITEM_THROW + packet(0x0945,-1,clif->pItemListWindowSelected,2,4,8); // CZ_ITEMLISTWIN_RES + packet(0x0946,6,clif->pReqClickBuyingStore,2); // CZ_REQ_CLICK_TO_BUYING_STORE + packet(0x0947,36,clif->pStoragePassword,0); // CZ_ACK_STORE_PASSWORD + packet(0x0958,5,clif->pHomMenu,2,4); // CZ_COMMAND_MER + packet(0x0960,26,clif->pFriendsListAdd,2); // CZ_ADD_FRIENDS + packet(0x0964,6,clif->pTakeItem,2); // CZ_ITEM_PICKUP +#endif + + /* PacketKeys: http://herc.ws/board/topic/1105-hercules-wpe-free-june-14th-patch/ */ #if PACKETVER >= 20110817 packetKeys(0x053D5CED,0x3DED6DED,0x6DED6DED); /* Thanks to Shakto */ @@ -6240,6 +6561,41 @@ packet(0x96e,-1,clif->ackmergeitems); packetKeys(0x69CB4F56,0x793C165E,0x673A2354); /* 4144 */ #endif +#if PACKETVER == 20170125 + packetKeys(0x066E04FE,0x3004224A,0x04FF0458); /* 4144 */ +#endif + +#if PACKETVER == 20170208 + packetKeys(0x6A764E5F,0x0609570D,0x28AE07FA); /* 4144 */ +#endif + +#if PACKETVER == 20170228 + packetKeys(0x771D4F2B,0x20EF1F4C,0x0D5135C8); /* 4144 */ +#endif + +#if PACKETVER == 20170308 + packetKeys(0x653470A9,0x6B316A71,0x5C712C71); /* 4144 */ +#endif + +#if PACKETVER == 20170315 + packetKeys(0x399A0856,0x56642A94,0x7F77157D); /* 4144 */ +#endif + +#if PACKETVER == 20170322 + packetKeys(0x2050167B,0x01731233,0x40337033); /* 4144 */ +#endif + +#if PACKETVER == 20170329 + packetKeys(0x18B31A80,0x1B0B1D56,0x16857D6A); /* 4144 */ +#endif + +#if PACKETVER == 20170405 + packetKeys(0x1FDE7DAC,0x2F9F5B63,0x3F2062AF); /* 4144 */ +#endif + +#if PACKETVER == 20170517 + packetKeys(0x2CC4749A,0x1FA954DC,0x72276857); /* 4144 */ +#endif #if defined(OBFUSCATIONKEY1) && defined(OBFUSCATIONKEY2) && defined(OBFUSCATIONKEY3) packetKeys(OBFUSCATIONKEY1,OBFUSCATIONKEY2,OBFUSCATIONKEY3); diff --git a/src/map/script.c b/src/map/script.c index 075b980ca..5ef54ed2e 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -136,6 +136,7 @@ const char* script_op2name(int op) { RETURN_OP_NAME(C_ADD); RETURN_OP_NAME(C_SUB); RETURN_OP_NAME(C_MUL); + RETURN_OP_NAME(C_POW); RETURN_OP_NAME(C_DIV); RETURN_OP_NAME(C_MOD); RETURN_OP_NAME(C_NEG); @@ -1035,6 +1036,7 @@ const char* parse_variable(const char* p) || ( p[0] == '|' && p[1] == '=' && (type = C_OR, true) ) // |= || ( p[0] == '&' && p[1] == '=' && (type = C_AND, true) ) // &= || ( p[0] == '*' && p[1] == '=' && (type = C_MUL, true) ) // *= + || ( p[0] == '*' && p[1] == '*' && p[2] == '=' && (type = C_POW, true) ) // **= || ( p[0] == '/' && p[1] == '=' && (type = C_DIV, true) ) // /= || ( p[0] == '%' && p[1] == '=' && (type = C_MOD, true) ) // %= || ( p[0] == '+' && p[1] == '+' && (type = C_ADD_POST, true) ) // post ++ @@ -1058,6 +1060,7 @@ const char* parse_variable(const char* p) case C_L_SHIFT: // <<= case C_R_SHIFT: // >>= + case C_POW: // **= p = script->skip_space( &p[3] ); break; @@ -1424,6 +1427,7 @@ const char* script_parse_subexpr(const char* p,int limit) (op=C_OP3, opl=0, len=1,*p=='?') // ?: || (op=C_ADD, opl=9, len=1,*p=='+') // + || (op=C_SUB, opl=9, len=1,*p=='-') // - + || (op=C_POW, opl=11,len=2,*p=='*' && p[1]=='*') // ** || (op=C_MUL, opl=10,len=1,*p=='*') // * || (op=C_DIV, opl=10,len=1,*p=='/') // / || (op=C_MOD, opl=10,len=1,*p=='%') // % @@ -4146,6 +4150,7 @@ void op_2num(struct script_state* st, int op, int i1, int i2) case C_ADD: ret = i1 + i2; ret64 = (int64)i1 + i2; break; case C_SUB: ret = i1 - i2; ret64 = (int64)i1 - i2; break; case C_MUL: ret = i1 * i2; ret64 = (int64)i1 * i2; break; + case C_POW: ret = (int)pow((double)i1, (double)i2); ret64 = (int64)pow((double)i1, (double)i2); break; default: ShowError("script:op_2num: unexpected number operator %s i1=%d i2=%d\n", script->op2name(op), i1, i2); script->reportsrc(st); @@ -4683,6 +4688,7 @@ void run_script_main(struct script_state *st) { case C_ADD: case C_SUB: case C_MUL: + case C_POW: case C_DIV: case C_MOD: case C_EQ: @@ -21535,6 +21541,43 @@ BUILDIN(issit) return true; } +BUILDIN(add_group_command) +{ + AtCommandInfo *acmd_d; + struct atcmd_binding_data *bcmd_d; + GroupSettings *group; + int group_index; + const char *atcmd = script_getstr(st, 2); + int group_id = script_getnum(st, 3); + bool self_perm = (script_getnum(st, 4) == 1); + bool char_perm = (script_getnum(st, 5) == 1); + + if (!pcg->exists(group_id)) { + ShowWarning("script:add_group_command: group does not exist: %i\n", group_id); + script_pushint(st, 0); + return false; + } + + group = pcg->id2group(group_id); + group_index = pcg->get_idx(group); + + if ((bcmd_d = atcommand->get_bind_byname(atcmd)) != NULL) { + bcmd_d->at_groups[group_index] = self_perm; + bcmd_d->char_groups[group_index] = char_perm; + script_pushint(st, 1); + return true; + } else if ((acmd_d = atcommand->get_info_byname(atcmd)) != NULL) { + acmd_d->at_groups[group_index] = self_perm; + acmd_d->char_groups[group_index] = char_perm; + script_pushint(st, 1); + return true; + } + + ShowWarning("script:add_group_command: command does not exist: %s\n", atcmd); + script_pushint(st, 0); + return false; +} + /** * @commands (script based) **/ @@ -21584,6 +21627,8 @@ BUILDIN(bindatcmd) atcommand->binding[i]->group_lv = group_lv; atcommand->binding[i]->group_lv_char = group_lv_char; atcommand->binding[i]->log = log; + CREATE(atcommand->binding[i]->at_groups, char, db_size(pcg->db)); + CREATE(atcommand->binding[i]->char_groups, char, db_size(pcg->db)); } return true; @@ -23597,7 +23642,7 @@ void script_parse_builtin(void) { // List of mathematics commands ---> BUILDIN_DEF(log10,"i"), BUILDIN_DEF(sqrt,"i"), //[zBuffer] - BUILDIN_DEF(pow,"ii"), //[zBuffer] + BUILDIN_DEF_DEPRECATED(pow,"ii"), //[zBuffer] BUILDIN_DEF(distance,"iiii"), //[zBuffer] // <--- List of mathematics commands BUILDIN_DEF(min, "i*"), @@ -23757,6 +23802,7 @@ void script_parse_builtin(void) { BUILDIN_DEF(useatcmd, "s"), BUILDIN_DEF(has_permission, "v?"), BUILDIN_DEF(can_use_command, "s?"), + BUILDIN_DEF(add_group_command, "siii"), /** * Item bound [Xantara] [Akinari] [Mhalicot/Hercules] diff --git a/src/map/script.h b/src/map/script.h index 8caec961a..fddcf4908 100644 --- a/src/map/script.h +++ b/src/map/script.h @@ -235,6 +235,7 @@ typedef enum c_op { C_SUB_PRE, // --a C_RE_EQ, // ~= C_RE_NE, // ~! + C_POW, // ** } c_op; /// Script queue options |