* Follow up 0f7ecd0, 308ee6c, 1f29f50
* Little source documentation updated on script.c

Signed-off-by: Cydh Ramdh <house.bad@gmail.com>
This commit is contained in:
Cydh Ramdh 2014-01-11 16:10:22 +07:00
parent 24f7ccc9fa
commit f46a7920e2
5 changed files with 112 additions and 105 deletions

View File

@ -4766,7 +4766,7 @@ int parse_char(int fd)
if( RFIFOREST(fd) < 6 ) if( RFIFOREST(fd) < 6 )
return 0; return 0;
if( pincode_enabled && RFIFOL(fd,2) == sd->account_id ){ if( pincode_enabled && RFIFOL(fd,2) == sd->account_id ){
if( strlen( sd->pincode ) <= 0 ){ if( sd->pincode[0] == '\0' ){
pincode_sendstate( fd, sd, PINCODE_NEW ); pincode_sendstate( fd, sd, PINCODE_NEW );
}else{ }else{
pincode_sendstate( fd, sd, PINCODE_ASK ); pincode_sendstate( fd, sd, PINCODE_ASK );

View File

@ -3378,7 +3378,7 @@ static int battle_calc_attack_skill_ratio(struct Damage wd, struct block_list *s
case LG_SHIELDSPELL:// [(Casters Base Level x 4) + (Shield DEF x 10) + (Casters VIT x 2)] % case LG_SHIELDSPELL:// [(Casters Base Level x 4) + (Shield DEF x 10) + (Casters VIT x 2)] %
if( sd ) { if( sd ) {
int index = sd->equip_index[EQI_HAND_L]; int index = sd->equip_index[EQI_HAND_L];
struct item_data *shield_data; struct item_data *shield_data = NULL;
if( index >= 0 && sd->inventory_data[index] && sd->inventory_data[index]->type == IT_ARMOR ) if( index >= 0 && sd->inventory_data[index] && sd->inventory_data[index]->type == IT_ARMOR )
shield_data = sd->inventory_data[index]; shield_data = sd->inventory_data[index];
skillratio = status_get_lv(src) * 4 + status_get_vit(src) * 2; skillratio = status_get_lv(src) * 4 + status_get_vit(src) * 2;

View File

@ -8534,7 +8534,8 @@ static int pc_checkcombo(struct map_session_data *sd, struct item_data *data) {
} }
CREATE(combo_idx,int16,data->combos[i]->count); CREATE(combo_idx,int16,data->combos[i]->count);
memset(combo_idx,-1,sizeof(combo_idx)); memset(combo_idx,-1,data->combos[i]->count * sizeof(int16));
for( j = 0; j < data->combos[i]->count; j++ ) { for( j = 0; j < data->combos[i]->count; j++ ) {
uint16 id = data->combos[i]->nameid[j], k; uint16 id = data->combos[i]->nameid[j], k;
bool found = false; bool found = false;
@ -10136,7 +10137,7 @@ static int pc_read_statsdb(const char *basedir, int last_s, bool silent){
fclose(fp); fclose(fp);
ShowStatus("Done reading '"CL_WHITE"%d"CL_RESET"' entries in '"CL_WHITE"%s/%s"CL_RESET"'.\n", entries, basedir,"statpoint.txt"); ShowStatus("Done reading '"CL_WHITE"%d"CL_RESET"' entries in '"CL_WHITE"%s/%s"CL_RESET"'.\n", entries, basedir,"statpoint.txt");
} }
return (i>1)?i:last_s; //If i == 1 means the file is empty. return max(last_s,i);
} }
/*========================================== /*==========================================

View File

@ -9230,7 +9230,10 @@ BUILDIN_FUNC(addtimer)
if( sd == NULL ) if( sd == NULL )
return 0; return 0;
pc_addeventtimer(sd,tick,event); if (!pc_addeventtimer(sd,tick,event)) {
ShowWarning("buildin_addtimer: Event timer is full, can't add new event timer. (cid:%d timer:%s)\n",sd->status.char_id,event);
return SCRIPT_CMD_FAILURE;
}
return SCRIPT_CMD_SUCCESS; return SCRIPT_CMD_SUCCESS;
} }
@ -17679,7 +17682,9 @@ BUILDIN_FUNC(npcskill)
/* Consumes an item. /* Consumes an item.
* consumeitem <item id>; * consumeitem <item id>;
* consumeitem "<item name>"; */ * consumeitem "<item name>";
* @param item: Item ID or name
*/
BUILDIN_FUNC(consumeitem) BUILDIN_FUNC(consumeitem)
{ {
TBL_NPC *nd; TBL_NPC *nd;
@ -17698,30 +17703,30 @@ BUILDIN_FUNC(consumeitem)
if( ( item_data = itemdb_searchname( name ) ) == NULL ){ if( ( item_data = itemdb_searchname( name ) ) == NULL ){
ShowError( "buildin_consumeitem: Nonexistant item %s requested.\n", name ); ShowError( "buildin_consumeitem: Nonexistant item %s requested.\n", name );
return 1; return SCRIPT_CMD_FAILURE;
} }
}else if( data_isint( data ) ){ }else if( data_isint( data ) ){
int nameid = conv_num( st, data ); int nameid = conv_num( st, data );
if( ( item_data = itemdb_exists( nameid ) ) == NULL ){ if( ( item_data = itemdb_exists( nameid ) ) == NULL ){
ShowError("buildin_consumeitem: Nonexistant item %d requested.\n", nameid ); ShowError("buildin_consumeitem: Nonexistant item %d requested.\n", nameid );
return 1; return SCRIPT_CMD_FAILURE;
} }
}else{ }else{
ShowError("buildin_consumeitem: invalid data type for argument #1 (%d).", data->type ); ShowError("buildin_consumeitem: invalid data type for argument #1 (%d).", data->type );
return 1; return SCRIPT_CMD_FAILURE;
} }
run_script( item_data->script, 0, sd->bl.id, nd->bl.id ); run_script( item_data->script, 0, sd->bl.id, nd->bl.id );
return SCRIPT_CMD_SUCCESS; return SCRIPT_CMD_SUCCESS;
} }
/*======================================================= /** Makes a player sit/stand.
* Make a player sit/stand.
* sit {"<character name>"}; * sit {"<character name>"};
* stand {"<character name>"}; * stand {"<character name>"};
* Note: Use readparam(Sitting) which returns 1 or 0 (sitting or standing). * Note: Use readparam(Sitting) which returns 1 or 0 (sitting or standing).
*-------------------------------------------------------*/ * @param name: Player name that will be invoked
*/
BUILDIN_FUNC(sit) BUILDIN_FUNC(sit)
{ {
TBL_PC *sd; TBL_PC *sd;
@ -17732,7 +17737,7 @@ BUILDIN_FUNC(sit)
sd = script_rid2sd(st); sd = script_rid2sd(st);
if( sd == NULL) if( sd == NULL)
return 0; return SCRIPT_CMD_FAILURE;
if( !pc_issit(sd) ) { if( !pc_issit(sd) ) {
unit_stop_walking(&sd->bl, 1|4); unit_stop_walking(&sd->bl, 1|4);
@ -17743,6 +17748,9 @@ BUILDIN_FUNC(sit)
return SCRIPT_CMD_SUCCESS; return SCRIPT_CMD_SUCCESS;
} }
/** Makes player to stand
* @param name: Player name that will be set
*/
BUILDIN_FUNC(stand) BUILDIN_FUNC(stand)
{ {
TBL_PC *sd; TBL_PC *sd;
@ -17753,7 +17761,7 @@ BUILDIN_FUNC(stand)
sd = script_rid2sd(st); sd = script_rid2sd(st);
if( sd == NULL) if( sd == NULL)
return 0; return SCRIPT_CMD_FAILURE;
if( pc_issit(sd) ) { if( pc_issit(sd) ) {
pc_setstand(sd); pc_setstand(sd);
@ -17764,22 +17772,18 @@ BUILDIN_FUNC(stand)
return SCRIPT_CMD_SUCCESS; return SCRIPT_CMD_SUCCESS;
} }
/*========================================== /** Creates an array of bounded item IDs
* countbound {<type>}; * countbound {<type>};
* Creates an array of bounded item IDs * @param type: 1 - Account Bound; 2 - Guild Bound; 3 - Party Bound
* Returns amount of items found * @return amt: Amount of items found
* Type: */
* 1 - Account Bound
* 2 - Guild Bound
* 3 - Party Bound
*------------------------------------------*/
BUILDIN_FUNC(countbound) BUILDIN_FUNC(countbound)
{ {
int i, type, j=0, k=0; int i, type, j=0, k=0;
TBL_PC *sd; TBL_PC *sd;
if( (sd = script_rid2sd(st)) == NULL ) if( (sd = script_rid2sd(st)) == NULL )
return 0; return SCRIPT_CMD_FAILURE;
type = script_hasdata(st,2)?script_getnum(st,2):0; type = script_hasdata(st,2)?script_getnum(st,2):0;
@ -17798,17 +17802,19 @@ BUILDIN_FUNC(countbound)
return SCRIPT_CMD_SUCCESS; return SCRIPT_CMD_SUCCESS;
} }
/*========================================== /** Creates new party
* party_create "<party name>"{,<char id>{,<item share>{,<item share type>}}}; * party_create "<party name>"{,<char id>{,<item share>{,<item share type>}}};
* <item share>: 0-Each Take. 1-Party Share * @param party_name: String of party name that will be created
* <item share type>: 0-Each Take. 1-Even Share * @param char_id: Chara that will be leader of this new party. If no char_id specified, the invoker will be party leader
* Return values: * @param item_share: 0-Each Take. 1-Party Share
* @param item_share_type: 0-Each Take. 1-Even Share
* @return val: Result value
* -3 - party name is exist * -3 - party name is exist
* -2 - player is in party already * -2 - player is in party already
* -1 - player is not found * -1 - player is not found
* 0 - unknown error * 0 - unknown error
* 1 - success, will return party id $@party_create_id * 1 - success, will return party id $@party_create_id
*------------------------------------------*/ */
BUILDIN_FUNC(party_create) BUILDIN_FUNC(party_create)
{ {
char party_name[NAME_LENGTH]; char party_name[NAME_LENGTH];
@ -17817,19 +17823,19 @@ BUILDIN_FUNC(party_create)
if( (!script_hasdata(st,3) && !(sd = script_rid2sd(st))) || (script_hasdata(st,3) && !(sd = map_charid2sd(script_getnum(st,3)))) ) { if( (!script_hasdata(st,3) && !(sd = script_rid2sd(st))) || (script_hasdata(st,3) && !(sd = map_charid2sd(script_getnum(st,3)))) ) {
script_pushint(st,-1); script_pushint(st,-1);
return 0; return SCRIPT_CMD_FAILURE;
} }
if( sd->status.party_id ) { if( sd->status.party_id ) {
script_pushint(st,-2); script_pushint(st,-2);
return 0; return SCRIPT_CMD_FAILURE;
} }
safestrncpy(party_name,script_getstr(st,2),NAME_LENGTH); safestrncpy(party_name,script_getstr(st,2),NAME_LENGTH);
trim(party_name); trim(party_name);
if( party_searchname(party_name) ) { if( party_searchname(party_name) ) {
script_pushint(st,-3); script_pushint(st,-3);
return 0; return SCRIPT_CMD_FAILURE;
} }
if( script_getnum(st,4) ) if( script_getnum(st,4) )
item1 = 1; item1 = 1;
@ -17841,17 +17847,18 @@ BUILDIN_FUNC(party_create)
return SCRIPT_CMD_SUCCESS; return SCRIPT_CMD_SUCCESS;
} }
/*========================================== /** Adds player to specified party
* party_addmember <party id>,<char id>; * party_addmember <party id>,<char id>;
* Adds player to specified party * @param party_id: The party that will be entered by player
* Return values: * @param char_id: Char id of player that will be joined to the party
* @return val: Result value
* -4 - party is full * -4 - party is full
* -3 - party is not found * -3 - party is not found
* -2 - player is in party already * -2 - player is in party already
* -1 - player is not found * -1 - player is not found
* 0 - unknown error * 0 - unknown error
* 1 - success * 1 - success
*------------------------------------------*/ */
BUILDIN_FUNC(party_addmember) BUILDIN_FUNC(party_addmember)
{ {
int party_id = script_getnum(st,2); int party_id = script_getnum(st,2);
@ -17860,46 +17867,46 @@ BUILDIN_FUNC(party_addmember)
if( !(sd = map_charid2sd(script_getnum(st,3))) ) { if( !(sd = map_charid2sd(script_getnum(st,3))) ) {
script_pushint(st,-1); script_pushint(st,-1);
return 0; return SCRIPT_CMD_FAILURE;
} }
if( sd->status.party_id ) { if( sd->status.party_id ) {
script_pushint(st,-2); script_pushint(st,-2);
return 0; return SCRIPT_CMD_FAILURE;
} }
if( !(party = party_search(party_id)) ) { if( !(party = party_search(party_id)) ) {
script_pushint(st,-3); script_pushint(st,-3);
return 0; return SCRIPT_CMD_FAILURE;
} }
if( party->party.count >= MAX_PARTY ) { if( party->party.count >= MAX_PARTY ) {
script_pushint(st,-4); script_pushint(st,-4);
return 0; return SCRIPT_CMD_FAILURE;
} }
sd->party_invite = party_id; sd->party_invite = party_id;
script_pushint(st,party_add_member(party_id,sd)); script_pushint(st,party_add_member(party_id,sd));
return SCRIPT_CMD_SUCCESS; return SCRIPT_CMD_SUCCESS;
} }
/*========================================== /** Removes player from his/her party. If party_id and char_id is empty remove the invoker from his/her party
* party_delmember {<char id>,<party_id>}; * party_delmember {<char id>,<party_id>};
* Removes player from his/her party. If party_id and char_id is empty * @param: char_id
* remove the invoker from his/her party * @param: party_id
* Return values: * @return val: Result value
* -3 - player is not in party * -3 - player is not in party
* -2 - party is not found * -2 - party is not found
* -1 - player is not found * -1 - player is not found
* 0 - unknown error * 0 - unknown error
* 1 - success * 1 - success
*------------------------------------------*/ */
BUILDIN_FUNC(party_delmember) BUILDIN_FUNC(party_delmember)
{ {
TBL_PC *sd = NULL; TBL_PC *sd = NULL;
if( !script_hasdata(st,2) && !script_hasdata(st,3) && !(sd = script_rid2sd(st)) ) { if( !script_hasdata(st,2) && !script_hasdata(st,3) && !(sd = script_rid2sd(st)) ) {
script_pushint(st,-1); script_pushint(st,-1);
return 0; return SCRIPT_CMD_FAILURE;
} }
if( sd || (script_getnum(st,2) && (sd = map_charid2sd(script_getnum(st,2)))) ) if( sd || (script_getnum(st,2) && (sd = map_charid2sd(script_getnum(st,2)))) )
script_pushint(st,party_removemember2(sd,0,0)); script_pushint(st,party_removemember2(sd,0,0));
@ -17908,17 +17915,17 @@ BUILDIN_FUNC(party_delmember)
return SCRIPT_CMD_SUCCESS; return SCRIPT_CMD_SUCCESS;
} }
/*========================================== /** Changes party leader of specified party (even the leader is offline)
* party_changeleader <party id>,<char id>; * party_changeleader <party id>,<char id>;
* Can change party leader even the leader is not online * @param party_id: ID of party
* Return values: * @param char_id: Char ID of new leader
* @return val: Result value
* -4 - player is party leader already * -4 - player is party leader already
* -3 - player is not in this party * -3 - player is not in this party
* -2 - player is not found * -2 - player is not found
* -1 - party is not found * -1 - party is not found
* 0 - unknown error * 0 - unknown error
* 1 - success * 1 - success */
*------------------------------------------*/
BUILDIN_FUNC(party_changeleader) BUILDIN_FUNC(party_changeleader)
{ {
int i, party_id = script_getnum(st,2); int i, party_id = script_getnum(st,2);
@ -17928,59 +17935,55 @@ BUILDIN_FUNC(party_changeleader)
if( !(party = party_search(party_id)) ) { if( !(party = party_search(party_id)) ) {
script_pushint(st,-1); script_pushint(st,-1);
return 0; return SCRIPT_CMD_FAILURE;
} }
if( !(tsd = map_charid2sd(script_getnum(st,3))) ) { if( !(tsd = map_charid2sd(script_getnum(st,3))) ) {
script_pushint(st,-2); script_pushint(st,-2);
return 0; return SCRIPT_CMD_FAILURE;
} }
if( tsd->status.party_id != party_id ) { if( tsd->status.party_id != party_id ) {
script_pushint(st,-3); script_pushint(st,-3);
return 0; return SCRIPT_CMD_FAILURE;
} }
ARR_FIND(0,MAX_PARTY,i,party->party.member[i].leader); ARR_FIND(0,MAX_PARTY,i,party->party.member[i].leader);
if( i >= MAX_PARTY ) { //this is should impossible! if( i >= MAX_PARTY ) { //this is should impossible!
script_pushint(st,0); script_pushint(st,0);
return 0; return SCRIPT_CMD_FAILURE;
} }
if( party->data[i].sd == tsd ) { if( party->data[i].sd == tsd ) {
script_pushint(st,-4); script_pushint(st,-4);
return 0; return SCRIPT_CMD_FAILURE;
} }
script_pushint(st,party_changeleader(sd,tsd,party)); script_pushint(st,party_changeleader(sd,tsd,party));
return SCRIPT_CMD_SUCCESS; return SCRIPT_CMD_SUCCESS;
} }
/*========================================== /** Changes party option
* party_changeoption <party id>,<option>,<flag>; * party_changeoption <party id>,<option>,<flag>;
* Return values: * @param party_id: ID of party that will be changed
* -1 - party is not found * @param option: Type of option
* 0 - invalid option * @return val: -1 - party is not found, 0 - invalid option, 1 - success
* 1 - success */
*------------------------------------------*/
BUILDIN_FUNC(party_changeoption) BUILDIN_FUNC(party_changeoption)
{ {
struct party_data *party; struct party_data *party;
if( !(party = party_search(script_getnum(st,2))) ) { if( !(party = party_search(script_getnum(st,2))) ) {
script_pushint(st,-1); script_pushint(st,-1);
return 0; return SCRIPT_CMD_FAILURE;
} }
script_pushint(st,party_setoption(party,script_getnum(st,3),script_getnum(st,4))); script_pushint(st,party_setoption(party,script_getnum(st,3),script_getnum(st,4)));
return SCRIPT_CMD_SUCCESS; return SCRIPT_CMD_SUCCESS;
} }
/*========================================== /** Destroys party with party id.
* party_destroy <party id>; * party_destroy <party id>;
* Destroys party with party id. * @param party_id: ID of party that will be destroyed
* Return values: */
* 0 - failed
* 1 - success
*------------------------------------------*/
BUILDIN_FUNC(party_destroy) BUILDIN_FUNC(party_destroy)
{ {
int i; int i;
@ -17988,7 +17991,7 @@ BUILDIN_FUNC(party_destroy)
if( !(party = party_search(script_getnum(st,2))) ) { if( !(party = party_search(script_getnum(st,2))) ) {
script_pushint(st,0); script_pushint(st,0);
return 0; return SCRIPT_CMD_FAILURE;
} }
ARR_FIND(0,MAX_PARTY,i,party->party.member[i].leader); ARR_FIND(0,MAX_PARTY,i,party->party.member[i].leader);
@ -18009,13 +18012,10 @@ BUILDIN_FUNC(party_destroy)
return SCRIPT_CMD_SUCCESS; return SCRIPT_CMD_SUCCESS;
} }
/*========================================== /** Checks if a player's client version meets a required version or date.
* Checks if a player's client version meets a required version or date. * @param type: 0 - check by version number; 1 - check by date
* @type : * @param data: Input
* 0 - check by version number */
* 1 - check by date
* @return true/false
*------------------------------------------*/
BUILDIN_FUNC(is_clientver) { BUILDIN_FUNC(is_clientver) {
TBL_PC *sd = NULL; TBL_PC *sd = NULL;
int type = script_getnum(st,2); int type = script_getnum(st,2);
@ -18028,7 +18028,7 @@ BUILDIN_FUNC(is_clientver) {
sd = script_rid2sd(st); sd = script_rid2sd(st);
if (sd == NULL) { if (sd == NULL) {
script_pushint(st,0); script_pushint(st,0);
return 0; return SCRIPT_CMD_FAILURE;
} }
switch(type){ switch(type){
@ -18043,10 +18043,9 @@ BUILDIN_FUNC(is_clientver) {
return SCRIPT_CMD_SUCCESS; return SCRIPT_CMD_SUCCESS;
} }
/*========================================== /** Retrieves server definitions
* Retrieves server definitions. * @param type: See in const.txt
* (see @type in const.txt) */
*------------------------------------------*/
BUILDIN_FUNC(getserverdef) { BUILDIN_FUNC(getserverdef) {
int type = script_getnum(st,2); int type = script_getnum(st,2);
switch(type){ switch(type){
@ -18070,9 +18069,10 @@ BUILDIN_FUNC(getserverdef) {
return SCRIPT_CMD_SUCCESS; return SCRIPT_CMD_SUCCESS;
} }
/* Returns various information about a player's VIP status. /** Returns various information about a player's VIP status. Need to enable VIP system
* vip_status <type>,{"<character name>"}; * vip_status <type>,{"<character name>"};
* Note: VIP System needs to be enabled. * @param type: Info type, 1: VIP status, 2: Expired date, 3: Remaining time
* @param name: Character name (Optional)
*/ */
BUILDIN_FUNC(vip_status) { BUILDIN_FUNC(vip_status) {
#ifdef VIP_ENABLE #ifdef VIP_ENABLE
@ -18087,7 +18087,7 @@ BUILDIN_FUNC(vip_status) {
sd = script_rid2sd(st); sd = script_rid2sd(st);
if (sd == NULL) if (sd == NULL)
return 0; return SCRIPT_CMD_FAILURE;
switch(type) { switch(type) {
case 1: // Get VIP status. case 1: // Get VIP status.
@ -18120,10 +18120,10 @@ BUILDIN_FUNC(vip_status) {
} }
/* Adds or removes VIP time in minutes. /** Adds or removes VIP time in minutes. Need to enable VIP system
* vip_time <time in mn>,{"<character name>"}; * vip_time <time in mn>,{"<character name>"};
* If time < 0 remove time, else add time. * @param time: VIP duration in minutes. If time < 0 remove time, else add time.
* Note: VIP System needs to be enabled. * @param name: Character name (optional)
*/ */
BUILDIN_FUNC(vip_time) { BUILDIN_FUNC(vip_time) {
#ifdef VIP_ENABLE //would be a pain for scripting npc otherwise #ifdef VIP_ENABLE //would be a pain for scripting npc otherwise
@ -18136,7 +18136,7 @@ BUILDIN_FUNC(vip_time) {
sd = script_rid2sd(st); sd = script_rid2sd(st);
if (sd == NULL) if (sd == NULL)
return 0; return SCRIPT_CMD_FAILURE;
chrif_req_login_operation(sd->status.account_id, sd->status.name, 6, viptime, 7, 0); chrif_req_login_operation(sd->status.account_id, sd->status.name, 6, viptime, 7, 0);
#endif #endif
@ -18144,10 +18144,16 @@ BUILDIN_FUNC(vip_time) {
} }
/*========================================== /** Turns a player into a monster and grants SC attribute effect. [malufett/Hercules]
* Turns a player into a monster and grants SC attribute effect. [malufett/Hercules]
* montransform <monster name/ID>, <duration>, <sc type>, <val1>, <val2>, <val3>, <val4>; * montransform <monster name/ID>, <duration>, <sc type>, <val1>, <val2>, <val3>, <val4>;
*------------------------------------------*/ * @param monster: Monster ID or name
* @param duration: Transform duration in millisecond (ms)
* @param sc_type: Type of SC that will be affected during the transformation
* @param val1: Value for SC
* @param val2: Value for SC
* @param val3: Value for SC
* @param val4: Value for SC
*/
BUILDIN_FUNC(montransform) { BUILDIN_FUNC(montransform) {
TBL_PC *sd; TBL_PC *sd;
@ -18175,17 +18181,17 @@ BUILDIN_FUNC(montransform) {
ShowWarning("buildin_montransform: Attempted to use non-existing monster '%s'.\n", script_getstr(st, 2)); ShowWarning("buildin_montransform: Attempted to use non-existing monster '%s'.\n", script_getstr(st, 2));
else else
ShowWarning("buildin_montransform: Attempted to use non-existing monster of ID '%d'.\n", script_getnum(st, 2)); ShowWarning("buildin_montransform: Attempted to use non-existing monster of ID '%d'.\n", script_getnum(st, 2));
return 0; return SCRIPT_CMD_FAILURE;
} }
if (mob_id == MOBID_EMPERIUM) { if (mob_id == MOBID_EMPERIUM) {
ShowWarning("buildin_montransform: Monster 'Emperium' cannot be used.\n"); ShowWarning("buildin_montransform: Monster 'Emperium' cannot be used.\n");
return 0; return SCRIPT_CMD_FAILURE;
} }
if (!(type > SC_NONE && type < SC_MAX)) { if (!(type > SC_NONE && type < SC_MAX)) {
ShowWarning("buildin_montransform: Unsupported status change id %d\n", type); ShowWarning("buildin_montransform: Unsupported status change id %d\n", type);
return 0; return SCRIPT_CMD_FAILURE;
} }
if (script_hasdata(st, 5)) if (script_hasdata(st, 5))
@ -18205,12 +18211,12 @@ BUILDIN_FUNC(montransform) {
if (battle_config.mon_trans_disable_in_gvg && map_flag_gvg2(sd->bl.m)) { if (battle_config.mon_trans_disable_in_gvg && map_flag_gvg2(sd->bl.m)) {
clif_displaymessage(sd->fd, msg_txt(sd,1500)); // Transforming into monster is not allowed in Guild Wars. clif_displaymessage(sd->fd, msg_txt(sd,1500)); // Transforming into monster is not allowed in Guild Wars.
return 0; return SCRIPT_CMD_FAILURE;
} }
if (sd->disguise){ if (sd->disguise){
clif_displaymessage(sd->fd, msg_txt(sd,1498)); // Cannot transform into monster while in disguise. clif_displaymessage(sd->fd, msg_txt(sd,1498)); // Cannot transform into monster while in disguise.
return 0; return SCRIPT_CMD_FAILURE;
} }
sprintf(msg, msg_txt(sd,1497), monster->name); // Traaaansformation-!! %s form!! sprintf(msg, msg_txt(sd,1497), monster->name); // Traaaansformation-!! %s form!!
@ -18246,7 +18252,7 @@ BUILDIN_FUNC(bonus_script) {
sd = script_rid2sd(st); sd = script_rid2sd(st);
if (sd == NULL) if (sd == NULL)
return 0; return SCRIPT_CMD_FAILURE;
script_str = script_getstr(st,2); script_str = script_getstr(st,2);
dur = 1000 * abs(script_getnum(st,3)); dur = 1000 * abs(script_getnum(st,3));
@ -18255,27 +18261,27 @@ BUILDIN_FUNC(bonus_script) {
FETCH(6,icon); FETCH(6,icon);
if (script_str[0] == '\0' || !dur) { if (script_str[0] == '\0' || !dur) {
//ShowWarning("buildin_bonus_script: Invalid value(s). Skipping...\n"); //ShowWarning("buildin_bonus_script: Invalid script. Skipping...\n");
return 0; return SCRIPT_CMD_FAILURE;
} }
//Skip duplicate entry //Skip duplicate entry
ARR_FIND(0,MAX_PC_BONUS_SCRIPT,i,&sd->bonus_script[i] && sd->bonus_script[i].script_str && strcmp(sd->bonus_script[i].script_str,script_str) == 0); ARR_FIND(0,MAX_PC_BONUS_SCRIPT,i,&sd->bonus_script[i] && sd->bonus_script[i].script_str && strcmp(sd->bonus_script[i].script_str,script_str) == 0);
if (i < MAX_PC_BONUS_SCRIPT) { if (i < MAX_PC_BONUS_SCRIPT) {
//ShowWarning("buildin_bonus_script: Duplicate entry with bonus '%d'. Skipping...\n",i); //ShowWarning("buildin_bonus_script: Duplicate entry with bonus '%d'. Skipping...\n",i);
return 0; return SCRIPT_CMD_SUCCESS;
} }
if (!(script = parse_script(script_str,"bonus_script",0,1))) { if (!(script = parse_script(script_str,"bonus_script",0,1))) {
//ShowWarning("buildin_bonus_script: Failed to parse script '%s'. Skipping...\n",script_str); ShowWarning("buildin_bonus_script: Failed to parse script '%s' (cid:%d). Skipping...\n",script_str,sd->status.char_id);
return 0; return SCRIPT_CMD_FAILURE;
} }
//Find the empty slot //Find the empty slot
ARR_FIND(0,MAX_PC_BONUS_SCRIPT,i,!sd->bonus_script[i].script); ARR_FIND(0,MAX_PC_BONUS_SCRIPT,i,!sd->bonus_script[i].script);
if (i >= MAX_PC_BONUS_SCRIPT) { if (i >= MAX_PC_BONUS_SCRIPT) {
ShowWarning("buildin_itemscript: Maximum script_bonus is reached (max: %d). Skipping...\n",MAX_PC_BONUS_SCRIPT); ShowWarning("buildin_itemscript: Maximum script_bonus is reached (cid:%d max: %d). Skipping...\n",sd->status.char_id,MAX_PC_BONUS_SCRIPT);
return 0; return SCRIPT_CMD_SUCCESS;
} }
//Add the script data //Add the script data

View File

@ -8914,7 +8914,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
int opt = rnd()%3 + 1; int opt = rnd()%3 + 1;
int val = 0, splash = 0; int val = 0, splash = 0;
int index = sd->equip_index[EQI_HAND_L]; int index = sd->equip_index[EQI_HAND_L];
struct item_data *shield_data; struct item_data *shield_data = NULL;
if( index >= 0 && sd->inventory_data[index] && sd->inventory_data[index]->type == IT_ARMOR ) if( index >= 0 && sd->inventory_data[index] && sd->inventory_data[index]->type == IT_ARMOR )
shield_data = sd->inventory_data[index]; shield_data = sd->inventory_data[index];
if( !shield_data || shield_data->type != IT_ARMOR ) { // No shield? if( !shield_data || shield_data->type != IT_ARMOR ) { // No shield?