diff options
Diffstat (limited to 'src/map')
52 files changed, 3728 insertions, 3608 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c index dac51d153..254da5c5b 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -162,15 +162,15 @@ ACMD(send) { int len=0,off,end,type; long num; - + // read message type as hex number (without the 0x) if(!message || !*message || !((sscanf(message, "len %x", &type)==1 && (len=1)) || sscanf(message, "%x", &type)==1) ) { clif->message(fd, msg_txt(900)); // Usage: - clif->message(fd, msg_txt(901)); // @send len <packet hex number> - clif->message(fd, msg_txt(902)); // @send <packet hex number> {<value>}* - clif->message(fd, msg_txt(903)); // Value: <type=B(default),W,L><number> or S<length>"<string>" + clif->message(fd, msg_txt(901)); // @send len <packet hex number> + clif->message(fd, msg_txt(902)); // @send <packet hex number> {<value>}* + clif->message(fd, msg_txt(903)); // Value: <type=B(default),W,L><number> or S<length>"<string>" return false; } @@ -200,14 +200,13 @@ ACMD(send) } while(0) //define GET_VALUE if (type > 0 && type < MAX_PACKET_DB) { - if(len) {// show packet length sprintf(atcmd_output, msg_txt(904), type, packet_db[type].len); // Packet 0x%x length: %d clif->message(fd, atcmd_output); return true; } - + len=packet_db[type].len; off=2; if(len == 0) @@ -222,7 +221,7 @@ ACMD(send) } WFIFOHEAD(sd->fd, len); WFIFOW(sd->fd,0)=TOW(type); - + // parse packet contents SKIP_VALUE(message); while(*message != 0 && off < len){ @@ -266,7 +265,7 @@ ACMD(send) ++message; } } - + // parse string ++message; CHECK_EOS(message); @@ -344,7 +343,7 @@ ACMD(send) ++message; CHECK_EOS(message); } - + // terminate the string if(off < end) {// fill the rest with 0's @@ -358,7 +357,7 @@ ACMD(send) } SKIP_VALUE(message); } - + if(packet_db[type].len == -1) {// send dynamic packet WFIFOW(sd->fd,2)=TOW(off); WFIFOSET(sd->fd,off); @@ -388,21 +387,20 @@ ACMD(mapmove) { unsigned short map_index; short x = 0, y = 0; int16 m = -1; - + memset(map_name, '\0', sizeof(map_name)); - + if (!message || !*message || (sscanf(message, "%15s %hd %hd", map_name, &x, &y) < 3 && sscanf(message, "%15[^,],%hd,%hd", map_name, &x, &y) < 1)) { - clif->message(fd, msg_txt(909)); // Please enter a map (usage: @warp/@rura/@mapmove <mapname> <x> <y>). return false; } - + map_index = mapindex->name2id(map_name); if (map_index) m = map->mapindex2mapid(map_index); - + if (!map_index || m < 0) { // m < 0 means on different server or that map is disabled! [Kevin] clif->message(fd, msg_txt(1)); // Map not found. return false; @@ -412,7 +410,7 @@ ACMD(mapmove) { clif->message(fd, msg_txt(253)); // You already are at your destination! return false; } - + if ((x || y) && map->getcell(m, x, y, CELL_CHKNOPASS) && pc_get_group_level(sd) < battle_config.gm_ignore_warpable_area) { //This is to prevent the pc->setpos call from printing an error. clif->message(fd, msg_txt(2)); @@ -431,7 +429,7 @@ ACMD(mapmove) { clif->message(fd, msg_txt(1)); // Map not found. return false; } - + clif->message(fd, msg_txt(0)); // Warped. return true; } @@ -441,14 +439,14 @@ ACMD(mapmove) { *------------------------------------------*/ ACMD(where) { struct map_session_data* pl_sd; - + memset(atcmd_player_name, '\0', sizeof atcmd_player_name); - + if (!message || !*message || sscanf(message, "%23[^\n]", atcmd_player_name) < 1) { clif->message(fd, msg_txt(910)); // Please enter a player name (usage: @where <char name>). return false; } - + pl_sd = map->nick2sd(atcmd_player_name); if (pl_sd == NULL || strncmp(pl_sd->status.name, atcmd_player_name, NAME_LENGTH) != 0 || @@ -457,10 +455,10 @@ ACMD(where) { clif->message(fd, msg_txt(3)); // Character not found. return false; } - + snprintf(atcmd_output, sizeof atcmd_output, "%s %s %d %d", pl_sd->status.name, mapindex_id2name(pl_sd->mapindex), pl_sd->bl.x, pl_sd->bl.y); clif->message(fd, atcmd_output); - + return true; } @@ -489,7 +487,7 @@ ACMD(jumpto) { clif->message(fd, msg_txt(3)); // Character not found. return false; } - + if (pl_sd->bl.m >= 0 && map->list[pl_sd->bl.m].flag.nowarpto && !pc_has_permission(sd, PC_PERM_WARP_ANYWHERE)) { clif->message(fd, msg_txt(247)); // You are not authorized to warp to this map. return false; @@ -513,21 +511,21 @@ ACMD(jumpto) { ACMD(jump) { short x = 0, y = 0; - + memset(atcmd_output, '\0', sizeof(atcmd_output)); - + sscanf(message, "%hd %hd", &x, &y); - + if (map->list[sd->bl.m].flag.noteleport && !pc_has_permission(sd, PC_PERM_WARP_ANYWHERE)) { clif->message(fd, msg_txt(248)); // You are not authorized to warp from your current map. return false; } - + if( pc_isdead(sd) ) { clif->message(fd, msg_txt(864)); // "You cannot use this command when dead." return false; } - + if ((x || y) && map->getcell(sd->bl.m, x, y, CELL_CHKNOPASS)) { //This is to prevent the pc->setpos call from printing an error. clif->message(fd, msg_txt(2)); @@ -539,7 +537,7 @@ ACMD(jump) clif->message(fd, msg_txt(253)); // You already are at your destination! return false; } - + pc->setpos(sd, sd->mapindex, x, y, CLR_TELEPORT); sprintf(atcmd_output, msg_txt(5), sd->bl.x, sd->bl.y); // Jumped to %d %d clif->message(fd, atcmd_output); @@ -565,24 +563,24 @@ ACMD(who) { */ int display_type = 1; int map_id = -1; - + if (stristr(info->command, "map") != NULL) { if (sscanf(message, "%15s %23s", map_name, player_name) < 1 || (map_id = map->mapname2mapid(map_name)) < 0) map_id = sd->bl.m; } else { sscanf(message, "%23s", player_name); } - + if (stristr(info->command, "2") != NULL) display_type = 2; else if (stristr(info->command, "3") != NULL) display_type = 3; - + level = pc_get_group_level(sd); StrBuf->Init(&buf); - + iter = mapit_getallusers(); - for (pl_sd = (TBL_PC*)mapit->first(iter); mapit->exists(iter); pl_sd = (TBL_PC*)mapit->next(iter)) { + for (pl_sd = (TBL_PC*)mapit->first(iter); mapit->exists(iter); pl_sd = (TBL_PC*)mapit->next(iter)) { if (!((pc_has_permission(pl_sd, PC_PERM_HIDE_SESSION) || pc_isinvisible(pl_sd)) && pc_get_group_level(pl_sd) > level)) { // you can look only lower or same level if (stristr(pl_sd->status.name, player_name) == NULL // search with no case sensitive || (map_id >= 0 && pl_sd->bl.m != map_id)) @@ -598,7 +596,7 @@ ACMD(who) { } case 3: { if (pc_has_permission(sd, PC_PERM_WHO_DISPLAY_AID)) - StrBuf->Printf(&buf, msg_txt(912), pl_sd->status.char_id, pl_sd->status.account_id); // "(CID:%d/AID:%d) " + StrBuf->Printf(&buf, msg_txt(912), pl_sd->status.char_id, pl_sd->status.account_id); // "(CID:%d/AID:%d) " StrBuf->Printf(&buf, msg_txt(343), pl_sd->status.name); // "Name: %s " if (pc_get_group_id(pl_sd) > 0) // Player title, if exists StrBuf->Printf(&buf, msg_txt(344), pcg->get_name(pl_sd->group)); // "(%s) " @@ -608,7 +606,7 @@ ACMD(who) { default: { struct party_data *p = party->search(pl_sd->status.party_id); struct guild *g = pl_sd->guild; - + StrBuf->Printf(&buf, msg_txt(343), pl_sd->status.name); // "Name: %s " if (pc_get_group_id(pl_sd) > 0) // Player title, if exists StrBuf->Printf(&buf, msg_txt(344), pcg->get_name(pl_sd->group)); // "(%s) " @@ -625,7 +623,7 @@ ACMD(who) { } } mapit->free(iter); - + if (map_id < 0) { if (count == 0) StrBuf->Printf(&buf, msg_txt(28)); // No player found. @@ -659,32 +657,32 @@ ACMD(whogm) char player_name[NAME_LENGTH]; struct guild *g; struct party_data *p; - + memset(atcmd_output, '\0', sizeof(atcmd_output)); memset(match_text, '\0', sizeof(match_text)); memset(player_name, '\0', sizeof(player_name)); - + if (sscanf(message, "%199[^\n]", match_text) < 1) strcpy(match_text, ""); for (j = 0; match_text[j]; j++) match_text[j] = TOLOWER(match_text[j]); - + count = 0; level = pc_get_group_level(sd); - + iter = mapit_getallusers(); for( pl_sd = (TBL_PC*)mapit->first(iter); mapit->exists(iter); pl_sd = (TBL_PC*)mapit->next(iter) ) { pl_level = pc_get_group_level(pl_sd); if (!pl_level) continue; - + if (match_text[0]) { memcpy(player_name, pl_sd->status.name, NAME_LENGTH); for (j = 0; player_name[j]; j++) player_name[j] = TOLOWER(player_name[j]); - // search with no case sensitive + // search with no case sensitive if (strstr(player_name, match_text) == NULL) continue; } @@ -696,28 +694,28 @@ ACMD(whogm) count++; continue; } - + sprintf(atcmd_output, msg_txt(914), // Name: %s (GM:%d) | Location: %s %d %d pl_sd->status.name, pl_level, mapindex_id2name(pl_sd->mapindex), pl_sd->bl.x, pl_sd->bl.y); clif->message(fd, atcmd_output); - + sprintf(atcmd_output, msg_txt(915), // BLvl: %d | Job: %s (Lvl: %d) pl_sd->status.base_level, pc->job_name(pl_sd->status.class_), pl_sd->status.job_level); clif->message(fd, atcmd_output); - + p = party->search(pl_sd->status.party_id); g = pl_sd->guild; - - sprintf(atcmd_output,msg_txt(916), // Party: '%s' | Guild: '%s' - p?p->party.name:msg_txt(917), g?g->name:msg_txt(917)); // None. - + + sprintf(atcmd_output,msg_txt(916), // Party: '%s' | Guild: '%s' + p?p->party.name:msg_txt(917), g?g->name:msg_txt(917)); // None. + clif->message(fd, atcmd_output); count++; } mapit->free(iter); - + if (count == 0) clif->message(fd, msg_txt(150)); // No GM found. else if (count == 1) @@ -726,23 +724,23 @@ ACMD(whogm) sprintf(atcmd_output, msg_txt(152), count); // %d GMs found. clif->message(fd, atcmd_output); } - + return true; } /*========================================== * *------------------------------------------*/ -ACMD(save) { - +ACMD(save) +{ pc->setsavepoint(sd, sd->mapindex, sd->bl.x, sd->bl.y); if (sd->status.pet_id > 0 && sd->pd) intif->save_petdata(sd->status.account_id, &sd->pd->pet); - + chrif->save(sd,0); - + clif->message(fd, msg_txt(6)); // Your save point has been changed. - + return true; } @@ -751,7 +749,7 @@ ACMD(save) { *------------------------------------------*/ ACMD(load) { int16 m; - + m = map->mapindex2mapid(sd->status.save_point.map); if (m >= 0 && map->list[m].flag.nowarpto && !pc_has_permission(sd, PC_PERM_WARP_ANYWHERE)) { clif->message(fd, msg_txt(249)); // You are not authorized to warp to your save map. @@ -761,10 +759,10 @@ ACMD(load) { clif->message(fd, msg_txt(248)); // You are not authorized to warp from your current map. return false; } - + pc->setpos(sd, sd->status.save_point.map, sd->status.save_point.x, sd->status.save_point.y, CLR_OUTSIGHT); clif->message(fd, msg_txt(7)); // Warping to save point.. - + return true; } @@ -774,30 +772,30 @@ ACMD(load) { ACMD(speed) { int speed; - + memset(atcmd_output, '\0', sizeof(atcmd_output)); - + if (!message || !*message || sscanf(message, "%d", &speed) < 1) { sprintf(atcmd_output, msg_txt(918), MIN_WALK_SPEED, MAX_WALK_SPEED); // Please enter a speed value (usage: @speed <%d-%d>). clif->message(fd, atcmd_output); return false; } - + sd->state.permanent_speed = 0; - + if (speed < 0) sd->base_status.speed = DEFAULT_WALK_SPEED; else sd->base_status.speed = cap_value(speed, MIN_WALK_SPEED, MAX_WALK_SPEED); - + if( sd->base_status.speed != DEFAULT_WALK_SPEED ) { sd->state.permanent_speed = 1; // Set lock when set to non-default speed. clif->message(fd, msg_txt(8)); // Speed changed. } else clif->message(fd, msg_txt(172)); //Speed returned to normal. - + status_calc_bl(&sd->bl, SCB_SPEED); - + return true; } @@ -808,14 +806,14 @@ ACMD(storage) { if (sd->npc_id || sd->state.vending || sd->state.buyingstore || sd->state.trading || sd->state.storage_flag) return false; - + if (storage->open(sd) == 1) { //Already open. clif->message(fd, msg_txt(250)); return false; } - + clif->message(fd, msg_txt(919)); // Storage opened. - + return true; } @@ -829,20 +827,20 @@ ACMD(guildstorage) clif->message(fd, msg_txt(252)); return false; } - + if (sd->npc_id || sd->state.vending || sd->state.buyingstore || sd->state.trading) return false; - + if (sd->state.storage_flag == 1) { clif->message(fd, msg_txt(250)); return false; } - + if (sd->state.storage_flag == 2) { clif->message(fd, msg_txt(251)); return false; } - + if( gstorage->open(sd) ) { clif->message(fd, msg_txt(1201)); // Your guild's storage has already been opened by another member, try again later. return false; @@ -858,30 +856,30 @@ ACMD(guildstorage) ACMD(option) { int param1 = 0, param2 = 0, param3 = 0; - + if (!message || !*message || sscanf(message, "%d %d %d", ¶m1, ¶m2, ¶m3) < 1 || param1 < 0 || param2 < 0 || param3 < 0) {// failed to match the parameters so inform the user of the options const char* text; - + // attempt to find the setting information for this command text = atcommand_help_string( info ); - + // notify the user of the requirement to enter an option clif->message(fd, msg_txt(921)); // Please enter at least one option. - + if( text ) {// send the help text associated with this command clif->messageln( fd, text ); } - + return false; } - + sd->sc.opt1 = param1; sd->sc.opt2 = param2; pc->setoption(sd, param3); - + clif->message(fd, msg_txt(9)); // Options changed. - + return true; } @@ -896,10 +894,10 @@ ACMD(hide) { else status->set_viewdata(&sd->bl, sd->status.class_); clif->message(fd, msg_txt(10)); // Invisible: Off - + // increment the number of pvp players on the map map->list[sd->bl.m].users_pvp++; - + if( map->list[sd->bl.m].flag.pvp && !map->list[sd->bl.m].flag.pvp_nocalcrank ) { // register the player for ranking calculations sd->pvp_timer = timer->add( timer->gettick() + 200, pc->calc_pvprank_timer, sd->bl.id, 0 ); @@ -910,10 +908,10 @@ ACMD(hide) { sd->sc.option |= OPTION_INVISIBLE; sd->vd.class_ = INVISIBLE_CLASS; clif->message(fd, msg_txt(11)); // Invisible: On - + // decrement the number of pvp players on the map map->list[sd->bl.m].users_pvp--; - + if( map->list[sd->bl.m].flag.pvp && !map->list[sd->bl.m].flag.pvp_nocalcrank && sd->pvp_timer != INVALID_TIMER ) { // unregister the player for ranking timer->delete( sd->pvp_timer, pc->calc_pvprank_timer ); @@ -921,7 +919,7 @@ ACMD(hide) { } } clif->changeoption(&sd->bl); - + return true; } @@ -931,11 +929,11 @@ ACMD(hide) { ACMD(jobchange) { int job = 0, upper = 0; const char* text; - + if (!message || !*message || sscanf(message, "%d %d", &job, &upper) < 1) { upper = 0; - - if( message ) { + + if( message ) { int i; bool found = false; @@ -946,7 +944,7 @@ ACMD(jobchange) { found = true; } } - + // High Jobs, Babies and Third for( i = JOB_NOVICE_HIGH; i < JOB_MAX && !found; i++ ){ if (strncmpi(message, pc->job_name(i), 16) == 0) { @@ -954,7 +952,7 @@ ACMD(jobchange) { found = true; } } - + if (!found) { text = atcommand_help_string(info); if (text) @@ -965,14 +963,14 @@ ACMD(jobchange) { } /* WHY DO WE LIST THEM THEN? */ // Deny direct transformation into dummy jobs - if (job == JOB_KNIGHT2 || job == JOB_CRUSADER2 || job == JOB_WEDDING || job == JOB_XMAS || job == JOB_SUMMER - || job == JOB_LORD_KNIGHT2 || job == JOB_PALADIN2 || job == JOB_BABY_KNIGHT2 || job == JOB_BABY_CRUSADER2 || job == JOB_STAR_GLADIATOR2 - || (job >= JOB_RUNE_KNIGHT2 && job <= JOB_MECHANIC_T2) || (job >= JOB_BABY_RUNE2 && job <= JOB_BABY_MECHANIC2) - ) { + if (job == JOB_KNIGHT2 || job == JOB_CRUSADER2 || job == JOB_WEDDING || job == JOB_XMAS || job == JOB_SUMMER + || job == JOB_LORD_KNIGHT2 || job == JOB_PALADIN2 || job == JOB_BABY_KNIGHT2 || job == JOB_BABY_CRUSADER2 || job == JOB_STAR_GLADIATOR2 + || (job >= JOB_RUNE_KNIGHT2 && job <= JOB_MECHANIC_T2) || (job >= JOB_BABY_RUNE2 && job <= JOB_BABY_MECHANIC2) + ) { clif->message(fd, msg_txt(923)); //"You can not change to this job by command." return true; } - + if (pcdb_checkid(job)) { if (pc->jobchange(sd, job, upper) == 0) clif->message(fd, msg_txt(12)); // Your job has been changed. @@ -982,11 +980,11 @@ ACMD(jobchange) { } } else { text = atcommand_help_string(info); - if (text) - clif->messageln(fd, text); + if (text) + clif->messageln(fd, text); return false; } - + return true; } @@ -1022,15 +1020,15 @@ ACMD(alive) ACMD(kami) { unsigned int color=0; - + memset(atcmd_output, '\0', sizeof(atcmd_output)); - + if(*(info->command + 4) != 'c' && *(info->command + 4) != 'C') { if (!message || !*message) { clif->message(fd, msg_txt(980)); // Please enter a message (usage: @kami <message>). return false; } - + sscanf(message, "%199[^\n]", atcmd_output); if (stristr(info->command, "l") != NULL) clif->broadcast(&sd->bl, atcmd_output, strlen(atcmd_output) + 1, BC_DEFAULT, ALL_SAMEMAP); @@ -1041,7 +1039,7 @@ ACMD(kami) clif->message(fd, msg_txt(981)); // Please enter color and message (usage: @kamic <color> <message>). return false; } - + if(color > 0xFFFFFF) { clif->message(fd, msg_txt(982)); // Invalid color. return false; @@ -1057,13 +1055,13 @@ ACMD(kami) ACMD(heal) { int hp = 0, sp = 0; // [Valaris] thanks to fov - + sscanf(message, "%d %d", &hp, &sp); - + // some overflow checks if( hp == INT_MIN ) hp++; if( sp == INT_MIN ) sp++; - + if ( hp == 0 && sp == 0 ) { if (!status_percent_heal(&sd->bl, 100, 100)) clif->message(fd, msg_txt(157)); // HP and SP have already been recovered. @@ -1071,7 +1069,7 @@ ACMD(heal) clif->message(fd, msg_txt(17)); // HP, SP recovered. return true; } - + if ( hp > 0 && sp >= 0 ) { if(!status->heal(&sd->bl, hp, sp, 0)) clif->message(fd, msg_txt(157)); // HP and SP are already with the good value. @@ -1079,14 +1077,14 @@ ACMD(heal) clif->message(fd, msg_txt(17)); // HP, SP recovered. return true; } - + if ( hp < 0 && sp <= 0 ) { status->damage(NULL, &sd->bl, -hp, -sp, 0, 0); clif->damage(&sd->bl,&sd->bl, 0, 0, -hp, 0, 4, 0); clif->message(fd, msg_txt(156)); // HP or/and SP modified. return true; } - + //Opposing signs. if ( hp ) { if (hp > 0) @@ -1096,14 +1094,14 @@ ACMD(heal) clif->damage(&sd->bl,&sd->bl, 0, 0, -hp, 0, 4, 0); } } - + if ( sp ) { if (sp > 0) status->heal(&sd->bl, 0, sp, 0); else status->damage(NULL, &sd->bl, 0, -sp, 0, 0); } - + clif->message(fd, msg_txt(156)); // HP or/and SP modified. return true; } @@ -1119,7 +1117,7 @@ ACMD(item) struct item item_tmp; struct item_data *item_data; int get_count, i; - + memset(item_name, '\0', sizeof(item_name)); if (!strcmpi(info->command,"itembound") && (!message || !*message || ( @@ -1128,24 +1126,24 @@ ACMD(item) ))) { clif->message(fd, msg_txt(295)); // Please enter an item name or ID (usage: @itembound <item name/ID> <quantity> <bound_type>). return false; - } else if (!message || !*message || ( - sscanf(message, "\"%99[^\"]\" %d", item_name, &number) < 1 && - sscanf(message, "%99s %d", item_name, &number) < 1 )) - { - clif->message(fd, msg_txt(983)); // Please enter an item name or ID (usage: @item <item name/ID> <quantity>). + } else if (!message || !*message + || ( sscanf(message, "\"%99[^\"]\" %d", item_name, &number) < 1 + && sscanf(message, "%99s %d", item_name, &number) < 1 + )) { + clif->message(fd, msg_txt(983)); // Please enter an item name or ID (usage: @item <item name/ID> <quantity>). return false; } - + if (number <= 0) number = 1; - + if ((item_data = itemdb->search_name(item_name)) == NULL && (item_data = itemdb->exists(atoi(item_name))) == NULL) { clif->message(fd, msg_txt(19)); // Invalid item ID or name. return false; } - + if(!strcmpi(info->command,"itembound") ) { if( !(bound >= IBT_MIN && bound <= IBT_MAX) ) { clif->message(fd, msg_txt(298)); // Invalid bound type @@ -1178,9 +1176,9 @@ ACMD(item) clif->message(fd, msg_txt(498)); // Cannot create bounded pet eggs or pet armors. return false; } - get_count = 1; + get_count = 1; } - + for (i = 0; i < number; i += get_count) { // if not pet egg if (!pet->create_egg(sd, item_id)) { @@ -1188,12 +1186,12 @@ ACMD(item) item_tmp.nameid = item_id; item_tmp.identify = 1; item_tmp.bound = (unsigned char)bound; - + if ((flag = pc->additem(sd, &item_tmp, get_count, LOG_TYPE_COMMAND))) clif->additem(sd, 0, 0, flag); } } - + if (flag == 0) clif->message(fd, msg_txt(18)); // Item created. return true; @@ -1210,24 +1208,24 @@ ACMD(item2) int item_id, number = 0, bound = 0; int identify = 0, refine = 0, attr = 0; int c1 = 0, c2 = 0, c3 = 0, c4 = 0; - + memset(item_name, '\0', sizeof(item_name)); - + if (!strcmpi(info->command,"itembound2") && (!message || !*message || ( sscanf(message, "\"%99[^\"]\" %d %d %d %d %d %d %d %d %d", item_name, &number, &identify, &refine, &attr, &c1, &c2, &c3, &c4, &bound) < 10 && sscanf(message, "%99s %d %d %d %d %d %d %d %d %d", item_name, &number, &identify, &refine, &attr, &c1, &c2, &c3, &c4, &bound) < 10 ))) { clif->message(fd, msg_txt(296)); // Please enter all parameters (usage: @itembound2 <item name/ID> <quantity> clif->message(fd, msg_txt(297)); // <identify_flag> <refine> <attribute> <card1> <card2> <card3> <card4> <bound_type>). return false; - } else if ( !message || !*message || ( - sscanf(message, "\"%99[^\"]\" %d %d %d %d %d %d %d %d", item_name, &number, &identify, &refine, &attr, &c1, &c2, &c3, &c4) < 9 && - sscanf(message, "%99s %d %d %d %d %d %d %d %d", item_name, &number, &identify, &refine, &attr, &c1, &c2, &c3, &c4) < 9 - )) { + } else if ( !message || !*message + || ( sscanf(message, "\"%99[^\"]\" %d %d %d %d %d %d %d %d", item_name, &number, &identify, &refine, &attr, &c1, &c2, &c3, &c4) < 9 + && sscanf(message, "%99s %d %d %d %d %d %d %d %d", item_name, &number, &identify, &refine, &attr, &c1, &c2, &c3, &c4) < 9 + )) { clif->message(fd, msg_txt(984)); // Please enter all parameters (usage: @item2 <item name/ID> <quantity> clif->message(fd, msg_txt(985)); // <identify_flag> <refine> <attribute> <card1> <card2> <card3> <card4>). return false; } - + if (number <= 0) number = 1; @@ -1240,7 +1238,7 @@ ACMD(item2) if ((item_data = itemdb->search_name(item_name)) != NULL || (item_data = itemdb->exists(atoi(item_name))) != NULL) item_id = item_data->nameid; - + if (item_id > 500) { int flag = 0; int loop, get_count, i; @@ -1253,7 +1251,7 @@ ACMD(item2) clif->message(fd, msg_txt(498)); // Cannot create bounded pet eggs or pet armors. return false; } - loop = number; + loop = number; get_count = 1; if (item_data->type == IT_PETEGG) { identify = 1; @@ -1278,18 +1276,18 @@ ACMD(item2) item_tmp.card[1] = c2; item_tmp.card[2] = c3; item_tmp.card[3] = c4; - + if ((flag = pc->additem(sd, &item_tmp, get_count, LOG_TYPE_COMMAND))) clif->additem(sd, 0, 0, flag); } - + if (flag == 0) clif->message(fd, msg_txt(18)); // Item created. } else { clif->message(fd, msg_txt(19)); // Invalid item ID or name. return false; } - + return true; } @@ -1299,14 +1297,14 @@ ACMD(item2) ACMD(itemreset) { int i; - + for (i = 0; i < MAX_INVENTORY; i++) { if (sd->status.inventory[i].amount && sd->status.inventory[i].equip == 0) { pc->delitem(sd, i, sd->status.inventory[i].amount, 0, 0, LOG_TYPE_COMMAND); } } clif->message(fd, msg_txt(20)); // All of your items have been removed. - + return true; } @@ -1318,12 +1316,12 @@ ACMD(baselevelup) int level=0, i=0, status_point=0; level = atoi(message); - + if (!message || !*message || !level) { clif->message(fd, msg_txt(986)); // Please enter a level adjustment (usage: @lvup/@blevel/@baselvlup <number of levels>). return false; } - + if (level > 0) { if (sd->status.base_level >= pc->maxbaselv(sd)) { // check for max level by Valaris clif->message(fd, msg_txt(47)); // Base level can't go any higher. @@ -1333,7 +1331,7 @@ ACMD(baselevelup) level = pc->maxbaselv(sd) - sd->status.base_level; for (i = 0; i < level; i++) status_point += pc->gets_status_point(sd->status.base_level + i); - + sd->status.status_point += status_point; sd->status.base_level += (unsigned int)level; status_calc_pc(sd, SCO_FORCE); @@ -1377,9 +1375,9 @@ ACMD(baselevelup) ACMD(joblevelup) { int level=0; - + level = atoi(message); - + if (!message || !*message || !level) { clif->message(fd, msg_txt(987)); // Please enter a level adjustment (usage: @joblvup/@jlevel/@joblvlup <number of levels>). return false; @@ -1405,7 +1403,7 @@ ACMD(joblevelup) level = sd->status.job_level-1; sd->status.job_level -= (unsigned int)level; if (sd->status.skill_point < level) - pc->resetskill(sd,0); //Reset skills since we need to subtract more points. + pc->resetskill(sd,0); //Reset skills since we need to subtract more points. if (sd->status.skill_point < level) sd->status.skill_point = 0; else @@ -1418,7 +1416,7 @@ ACMD(joblevelup) clif->updatestatus(sd, SP_NEXTJOBEXP); clif->updatestatus(sd, SP_SKILLPOINT); status_calc_pc(sd, SCO_FORCE); - + return true; } @@ -1429,7 +1427,7 @@ ACMD(help) { const char *command_name = NULL; char *default_command = "help"; AtCommandInfo *tinfo = NULL; - + if (!message || !*message) { command_name = default_command; // If no command_name specified, display help for @help. } else { @@ -1437,33 +1435,33 @@ ACMD(help) { ++message; command_name = atcommand->check_alias(message); } - + if (!atcommand->can_use2(sd, command_name, COMMAND_ATCOMMAND)) { sprintf(atcmd_output, msg_txt(153), message); // "%s is Unknown Command" clif->message(fd, atcmd_output); atcommand->get_suggestions(sd, command_name, true); return false; } - + tinfo = atcommand->get_info_byname(atcommand->check_alias(command_name)); - + if ( !tinfo || tinfo->help == NULL ) { sprintf(atcmd_output, msg_txt(988), atcommand->at_symbol, command_name); // There is no help for %c%s. clif->message(fd, atcmd_output); atcommand->get_suggestions(sd, command_name, true); return false; } - + sprintf(atcmd_output, msg_txt(989), atcommand->at_symbol, command_name); // Help for command %c%s: clif->message(fd, atcmd_output); - + { // Display aliases DBIterator* iter; AtCommandInfo *command_info; AliasInfo *alias_info = NULL; StringBuf buf; bool has_aliases = false; - + StrBuf->Init(&buf); StrBuf->AppendStr(&buf, msg_txt(990)); // Available aliases: command_info = atcommand->get_info_byname(command_name); @@ -1479,7 +1477,7 @@ ACMD(help) { clif->message(fd, StrBuf->Value(&buf)); StrBuf->Destroy(&buf); } - + // Display help contents clif->message(fd, tinfo->help); return true; @@ -1512,16 +1510,16 @@ int atcommand_pvpoff_sub(struct block_list *bl,va_list ap) return 0; } -ACMD(pvpoff) { - +ACMD(pvpoff) +{ if (!map->list[sd->bl.m].flag.pvp) { clif->message(fd, msg_txt(160)); // PvP is already Off. return false; } - + map->zone_change2(sd->bl.m,map->list[sd->bl.m].prev_zone); map->list[sd->bl.m].flag.pvp = 0; - + if (!battle_config.pk_mode) { clif->map_property_mapall(sd->bl.m, MAPPROPERTY_NOTHING); clif->maptypeproperty2(&sd->bl,ALL_SAMEMAP); @@ -1549,24 +1547,24 @@ int atcommand_pvpon_sub(struct block_list *bl,va_list ap) return 0; } -ACMD(pvpon) { - +ACMD(pvpon) +{ if (map->list[sd->bl.m].flag.pvp) { clif->message(fd, msg_txt(161)); // PvP is already On. return false; } - + map->zone_change2(sd->bl.m,strdb_get(map->zone_db, MAP_ZONE_PVP_NAME)); map->list[sd->bl.m].flag.pvp = 1; - + if (!battle_config.pk_mode) {// display pvp circle and rank clif->map_property_mapall(sd->bl.m, MAPPROPERTY_FREEPVPZONE); clif->maptypeproperty2(&sd->bl,ALL_SAMEMAP); map->foreachinmap(atcommand->pvpon_sub,sd->bl.m, BL_PC); } - + clif->message(fd, msg_txt(32)); // PvP: On. - + return true; } @@ -1574,38 +1572,38 @@ ACMD(pvpon) { * *------------------------------------------*/ ACMD(gvgoff) { - + if (!map->list[sd->bl.m].flag.gvg) { clif->message(fd, msg_txt(162)); // GvG is already Off. return false; } - + map->zone_change2(sd->bl.m,map->list[sd->bl.m].prev_zone); map->list[sd->bl.m].flag.gvg = 0; clif->map_property_mapall(sd->bl.m, MAPPROPERTY_NOTHING); clif->maptypeproperty2(&sd->bl,ALL_SAMEMAP); map->foreachinmap(atcommand->stopattack,sd->bl.m, BL_CHAR, 0); clif->message(fd, msg_txt(33)); // GvG: Off. - + return true; } /*========================================== * *------------------------------------------*/ -ACMD(gvgon) { - +ACMD(gvgon) +{ if (map->list[sd->bl.m].flag.gvg) { clif->message(fd, msg_txt(163)); // GvG is already On. return false; } - + map->zone_change2(sd->bl.m,strdb_get(map->zone_db, MAP_ZONE_GVG_NAME)); map->list[sd->bl.m].flag.gvg = 1; clif->map_property_mapall(sd->bl.m, MAPPROPERTY_AGITZONE); clif->maptypeproperty2(&sd->bl,ALL_SAMEMAP); clif->message(fd, msg_txt(34)); // GvG: On. - + return true; } @@ -1615,16 +1613,16 @@ ACMD(gvgon) { ACMD(model) { int hair_style = 0, hair_color = 0, cloth_color = 0; - + memset(atcmd_output, '\0', sizeof(atcmd_output)); - + if (!message || !*message || sscanf(message, "%d %d %d", &hair_style, &hair_color, &cloth_color) < 1) { sprintf(atcmd_output, msg_txt(991), // Please enter at least one value (usage: @model <hair ID: %d-%d> <hair color: %d-%d> <clothes color: %d-%d>). MIN_HAIR_STYLE, MAX_HAIR_STYLE, MIN_HAIR_COLOR, MAX_HAIR_COLOR, MIN_CLOTH_COLOR, MAX_CLOTH_COLOR); clif->message(fd, atcmd_output); return false; } - + if (hair_style >= MIN_HAIR_STYLE && hair_style <= MAX_HAIR_STYLE && hair_color >= MIN_HAIR_COLOR && hair_color <= MAX_HAIR_COLOR && cloth_color >= MIN_CLOTH_COLOR && cloth_color <= MAX_CLOTH_COLOR) { @@ -1636,7 +1634,7 @@ ACMD(model) clif->message(fd, msg_txt(37)); // An invalid number was specified. return false; } - + return true; } @@ -1646,15 +1644,15 @@ ACMD(model) ACMD(dye) { int cloth_color = 0; - + memset(atcmd_output, '\0', sizeof(atcmd_output)); - + if (!message || !*message || sscanf(message, "%d", &cloth_color) < 1) { sprintf(atcmd_output, msg_txt(992), MIN_CLOTH_COLOR, MAX_CLOTH_COLOR); // Please enter a clothes color (usage: @dye/@ccolor <clothes color: %d-%d>). clif->message(fd, atcmd_output); return false; } - + if (cloth_color >= MIN_CLOTH_COLOR && cloth_color <= MAX_CLOTH_COLOR) { pc->changelook(sd, LOOK_CLOTHES_COLOR, cloth_color); clif->message(fd, msg_txt(36)); // Appearance changed. @@ -1662,7 +1660,7 @@ ACMD(dye) clif->message(fd, msg_txt(37)); // An invalid number was specified. return false; } - + return true; } @@ -1672,15 +1670,15 @@ ACMD(dye) ACMD(hair_style) { int hair_style = 0; - + memset(atcmd_output, '\0', sizeof(atcmd_output)); - + if (!message || !*message || sscanf(message, "%d", &hair_style) < 1) { sprintf(atcmd_output, msg_txt(993), MIN_HAIR_STYLE, MAX_HAIR_STYLE); // Please enter a hair style (usage: @hairstyle/@hstyle <hair ID: %d-%d>). clif->message(fd, atcmd_output); return false; } - + if (hair_style >= MIN_HAIR_STYLE && hair_style <= MAX_HAIR_STYLE) { pc->changelook(sd, LOOK_HAIR, hair_style); clif->message(fd, msg_txt(36)); // Appearance changed. @@ -1688,7 +1686,7 @@ ACMD(hair_style) clif->message(fd, msg_txt(37)); // An invalid number was specified. return false; } - + return true; } @@ -1698,15 +1696,15 @@ ACMD(hair_style) ACMD(hair_color) { int hair_color = 0; - + memset(atcmd_output, '\0', sizeof(atcmd_output)); - + if (!message || !*message || sscanf(message, "%d", &hair_color) < 1) { sprintf(atcmd_output, msg_txt(994), MIN_HAIR_COLOR, MAX_HAIR_COLOR); // Please enter a hair color (usage: @haircolor/@hcolor <hair color: %d-%d>). clif->message(fd, atcmd_output); return false; } - + if (hair_color >= MIN_HAIR_COLOR && hair_color <= MAX_HAIR_COLOR) { pc->changelook(sd, LOOK_HAIR_COLOR, hair_color); clif->message(fd, msg_txt(36)); // Appearance changed. @@ -1714,7 +1712,7 @@ ACMD(hair_color) clif->message(fd, msg_txt(37)); // An invalid number was specified. return false; } - + return true; } @@ -1725,7 +1723,7 @@ ACMD(go) { int i; int town = INT_MAX; // Initialized to INT_MAX instead of -1 to avoid conflicts with those who map [-3:-1] to @memo locations. char map_name[MAP_NAME_LENGTH]; - + const struct { char map[MAP_NAME_LENGTH]; int x, y; @@ -1772,23 +1770,23 @@ ACMD(go) { { MAP_MALAYA, 242, 211, 5 }, // 34 = Malaya Port { MAP_ECLAGE, 110, 39, 3 }, // 35 = Eclage }; - + memset(map_name, '\0', sizeof(map_name)); memset(atcmd_output, '\0', sizeof(atcmd_output)); - + if (!message || !*message || sscanf(message, "%11s", map_name) < 1) { // no value matched so send the list of locations const char* text; - + // attempt to find the text help string text = atcommand_help_string( info ); - + clif->message(fd, msg_txt(38)); // Invalid location number, or name. - + if( text ) {// send the text to the client clif->messageln( fd, text ); } - + return false; } @@ -1852,7 +1850,7 @@ ACMD(go) { clif->message(fd, msg_txt(38)); // Invalid location number or name. return false; } - + return true; } @@ -1870,11 +1868,11 @@ ACMD(monster) int i, k, range; short mx, my; unsigned int size; - + memset(name, '\0', sizeof(name)); memset(monster, '\0', sizeof(monster)); memset(atcmd_output, '\0', sizeof(atcmd_output)); - + if (!message || !*message) { clif->message(fd, msg_txt(80)); // Please specify a display name or monster name/id. return false; @@ -1895,35 +1893,35 @@ ACMD(monster) clif->message(fd, msg_txt(80)); // Give a display name and monster name/id please. return false; } - + if ((mob_id = mob->db_searchname(monster)) == 0) // check name first (to avoid possible name beginning by a number) mob_id = mob->db_checkid(atoi(monster)); - + if (mob_id == 0) { clif->message(fd, msg_txt(40)); // Invalid monster ID or name. return false; } - + if (number <= 0) number = 1; - + if( !name[0] ) strcpy(name, "--ja--"); - + // If value of atcommand_spawn_quantity_limit directive is greater than or equal to 1 and quantity of monsters is greater than value of the directive if (battle_config.atc_spawn_quantity_limit && number > battle_config.atc_spawn_quantity_limit) number = battle_config.atc_spawn_quantity_limit; - + if (strcmpi(info->command, "monstersmall") == 0) size = SZ_MEDIUM; else if (strcmpi(info->command, "monsterbig") == 0) size = SZ_BIG; else size = SZ_SMALL; - + if (battle_config.etc_log) ShowInfo("%s monster='%s' name='%s' id=%d count=%d (%d,%d)\n", command, monster, name, mob_id, number, sd->bl.x, sd->bl.y); - + count = 0; range = (int)sqrt((float)number) +2; // calculation of an odd number (+ 4 area around) for (i = 0; i < number; i++) { @@ -1931,7 +1929,7 @@ ACMD(monster) k = mob->once_spawn(sd, sd->bl.m, mx, my, name, mob_id, 1, eventname, size, AI_NONE|(mob_id == MOBID_EMPERIUM?0x200:0x0)); count += (k != 0) ? 1 : 0; } - + if (count != 0) if (number == count) clif->message(fd, msg_txt(39)); // All monster summoned! @@ -1943,7 +1941,7 @@ ACMD(monster) clif->message(fd, msg_txt(40)); // Invalid monster ID or name. return false; } - + return true; } @@ -1954,13 +1952,13 @@ int atkillmonster_sub(struct block_list *bl, va_list ap) { struct mob_data *md; int flag; - + nullpo_ret(md=(struct mob_data *)bl); flag = va_arg(ap, int); - + if (md->guardian_data) return 0; //Do not touch WoE mobs! - + if (flag) status_zap(bl,md->status.hp, 0); else @@ -1971,22 +1969,22 @@ int atkillmonster_sub(struct block_list *bl, va_list ap) ACMD(killmonster) { int map_id, drop_flag; char map_name[MAP_NAME_LENGTH_EXT]; - + memset(map_name, '\0', sizeof(map_name)); - + if (!message || !*message || sscanf(message, "%15s", map_name) < 1) map_id = sd->bl.m; else { if ((map_id = map->mapname2mapid(map_name)) < 0) map_id = sd->bl.m; } - + drop_flag = strcmpi(info->command, "killmonster2"); - + map->foreachinmap(atcommand->atkillmonster_sub, map_id, BL_MOB, -drop_flag); - + clif->message(fd, msg_txt(165)); // All monsters killed! - + return true; } @@ -1997,9 +1995,9 @@ ACMD(refine) { int i,j, position = 0, refine = 0, current_position, final_refine; int count; - + memset(atcmd_output, '\0', sizeof(atcmd_output)); - + if (!message || !*message || sscanf(message, "%d %d", &position, &refine) < 2) { clif->message(fd, msg_txt(996)); // Please enter a position and an amount (usage: @refine <equip position> <+/- amount>). sprintf(atcmd_output, msg_txt(997), EQP_HEAD_LOW); // %d: Lower Headgear @@ -2024,9 +2022,9 @@ ACMD(refine) clif->message(fd, atcmd_output); return false; } - + refine = cap_value(refine, -MAX_REFINE, MAX_REFINE); - + count = 0; for (j = 0; j < EQI_MAX; j++) { if ((i = sd->equip_index[j]) < 0) @@ -2038,10 +2036,10 @@ ACMD(refine) continue; if(j == EQI_HEAD_TOP && (sd->equip_index[EQI_HEAD_MID] == i || sd->equip_index[EQI_HEAD_LOW] == i)) continue; - + if(position && !(sd->status.inventory[i].equip & position)) continue; - + final_refine = cap_value(sd->status.inventory[i].refine + refine, 0, MAX_REFINE); if (sd->status.inventory[i].refine != final_refine) { sd->status.inventory[i].refine = final_refine; @@ -2055,7 +2053,7 @@ ACMD(refine) count++; } } - + if (count == 0) clif->message(fd, msg_txt(166)); // No item has been refined. else if (count == 1) @@ -2064,7 +2062,7 @@ ACMD(refine) sprintf(atcmd_output, msg_txt(168), count); // %d items have been refined. clif->message(fd, atcmd_output); } - + return true; } @@ -2077,10 +2075,10 @@ ACMD(produce) int item_id, attribute = 0, star = 0; struct item_data *item_data; struct item tmp_item; - + memset(atcmd_output, '\0', sizeof(atcmd_output)); memset(item_name, '\0', sizeof(item_name)); - + if (!message || !*message || ( sscanf(message, "\"%99[^\"]\" %d %d", item_name, &attribute, &star) < 1 && sscanf(message, "%99s %d %d", item_name, &attribute, &star) < 1 @@ -2088,15 +2086,15 @@ ACMD(produce) clif->message(fd, msg_txt(1007)); // Please enter at least one item name/ID (usage: @produce <equip name/ID> <element> <# of very's>). return false; } - + if ( (item_data = itemdb->search_name(item_name)) == NULL && (item_data = itemdb->exists(atoi(item_name))) == NULL ) { clif->message(fd, msg_txt(170)); //This item is not an equipment. return false; } - + item_id = item_data->nameid; - + if (itemdb->isequip2(item_data)) { int flag = 0; if (attribute < MIN_ATTRIBUTE || attribute > MAX_ATTRIBUTE) @@ -2114,7 +2112,7 @@ ACMD(produce) tmp_item.card[3] = GetWord(sd->status.char_id, 1); clif->produce_effect(sd, 0, item_id); clif->misceffect(&sd->bl, 3); - + if ((flag = pc->additem(sd, &tmp_item, 1, LOG_TYPE_COMMAND))) clif->additem(sd, 0, 0, flag); } else { @@ -2122,7 +2120,7 @@ ACMD(produce) clif->message(fd, atcmd_output); return false; } - + return true; } @@ -2132,9 +2130,9 @@ ACMD(produce) ACMD(memo) { int position = 0; - + memset(atcmd_output, '\0', sizeof(atcmd_output)); - + if( !message || !*message || sscanf(message, "%d", &position) < 1 ) { int i; @@ -2146,17 +2144,17 @@ ACMD(memo) else sprintf(atcmd_output, msg_txt(171), i); // %d - void clif->message(sd->fd, atcmd_output); - } + } return true; - } - + } + if( position < 0 || position >= MAX_MEMOPOINTS ) { sprintf(atcmd_output, msg_txt(1008), 0, MAX_MEMOPOINTS-1); // Please enter a valid position (usage: @memo <memo_position:%d-%d>). clif->message(fd, atcmd_output); return false; } - + pc->memo(sd, position); return true; } @@ -2166,9 +2164,9 @@ ACMD(memo) *------------------------------------------*/ ACMD(gat) { int y; - + memset(atcmd_output, '\0', sizeof(atcmd_output)); - + for (y = 2; y >= -2; y--) { sprintf(atcmd_output, "%s (x= %d, y= %d) %02X %02X %02X %02X %02X", map->list[sd->bl.m].name, sd->bl.x - 2, sd->bl.y + y, @@ -2177,10 +2175,10 @@ ACMD(gat) { map->getcell(sd->bl.m, sd->bl.x, sd->bl.y + y, CELL_GETTYPE), map->getcell(sd->bl.m, sd->bl.x + 1, sd->bl.y + y, CELL_GETTYPE), map->getcell(sd->bl.m, sd->bl.x + 2, sd->bl.y + y, CELL_GETTYPE)); - + clif->message(fd, atcmd_output); } - + return true; } @@ -2190,19 +2188,19 @@ ACMD(gat) { ACMD(displaystatus) { int i, type, flag, tick, val1 = 0, val2 = 0, val3 = 0; - + if (!message || !*message || (i = sscanf(message, "%d %d %d %d %d %d", &type, &flag, &tick, &val1, &val2, &val3)) < 1) { clif->message(fd, msg_txt(1009)); // Please enter a status type/flag (usage: @displaystatus <status type> <flag> <tick> {<val1> {<val2> {<val3>}}}). return false; } if (i < 2) flag = 1; if (i < 3) tick = 0; - + if( flag == 0 ) clif->sc_end(&sd->bl,sd->bl.id,AREA,type); else clif->status_change(&sd->bl, type, flag, tick, val1, val2, val3); - + return true; } @@ -2213,12 +2211,12 @@ ACMD(statuspoint) { int point; unsigned int new_status_point; - + if (!message || !*message || (point = atoi(message)) == 0) { clif->message(fd, msg_txt(1010)); // Please enter a number (usage: @stpoint <number of points>). return false; } - + if(point < 0) { if(sd->status.status_point < (unsigned int)(-point)) @@ -2238,7 +2236,7 @@ ACMD(statuspoint) { new_status_point = sd->status.status_point + point; } - + if (new_status_point != sd->status.status_point) { sd->status.status_point = new_status_point; clif->updatestatus(sd, SP_STATUSPOINT); @@ -2250,7 +2248,7 @@ ACMD(statuspoint) clif->message(fd, msg_txt(149)); // Unable to increase the number/value. return false; } - + return true; } @@ -2261,12 +2259,12 @@ ACMD(skillpoint) { int point; unsigned int new_skill_point; - + if (!message || !*message || (point = atoi(message)) == 0) { clif->message(fd, msg_txt(1011)); // Please enter a number (usage: @skpoint <number of points>). return false; } - + if(point < 0) { if(sd->status.skill_point < (unsigned int)(-point)) @@ -2286,7 +2284,7 @@ ACMD(skillpoint) { new_skill_point = sd->status.skill_point + point; } - + if (new_skill_point != sd->status.skill_point) { sd->status.skill_point = new_skill_point; clif->updatestatus(sd, SP_SKILLPOINT); @@ -2298,7 +2296,7 @@ ACMD(skillpoint) clif->message(fd, msg_txt(149)); // Unable to increase the number/value. return false; } - + return true; } @@ -2308,12 +2306,12 @@ ACMD(skillpoint) ACMD(zeny) { int zeny=0, ret=-1; - + if (!message || !*message || (zeny = atoi(message)) == 0) { clif->message(fd, msg_txt(1012)); // Please enter an amount (usage: @zeny <amount>). return false; } - + if(zeny > 0){ if((ret=pc->getzeny(sd,zeny,LOG_TYPE_COMMAND,NULL)) == 1) clif->message(fd, msg_txt(149)); // Unable to increase the number/value. @@ -2338,34 +2336,34 @@ ACMD(param) { int i, value = 0, new_value, max; const char* param[] = { "str", "agi", "vit", "int", "dex", "luk" }; short* stats[6]; - //we don't use direct initialization because it isn't part of the c standard. - + //we don't use direct initialization because it isn't part of the c standard. + memset(atcmd_output, '\0', sizeof(atcmd_output)); - + if (!message || !*message || sscanf(message, "%d", &value) < 1 || value == 0) { clif->message(fd, msg_txt(1013)); // Please enter a valid value (usage: @str/@agi/@vit/@int/@dex/@luk <+/-adjustment>). return false; } - + ARR_FIND( 0, ARRAYLENGTH(param), i, strcmpi(info->command, param[i]) == 0 ); - + if( i == ARRAYLENGTH(param) || i > MAX_STATUS_TYPE) { // normally impossible... clif->message(fd, msg_txt(1013)); // Please enter a valid value (usage: @str/@agi/@vit/@int/@dex/@luk <+/-adjustment>). return false; } - + stats[0] = &sd->status.str; stats[1] = &sd->status.agi; stats[2] = &sd->status.vit; stats[3] = &sd->status.int_; stats[4] = &sd->status.dex; stats[5] = &sd->status.luk; - + if( battle_config.atcommand_max_stat_bypass ) max = SHRT_MAX; else max = pc_maxparameter(sd); - + if(value < 0 && *stats[i] <= -value) { new_value = 1; } else if(max - *stats[i] < value) { @@ -2373,7 +2371,7 @@ ACMD(param) { } else { new_value = *stats[i] + value; } - + if (new_value != *stats[i]) { *stats[i] = new_value; clif->updatestatus(sd, SP_STR + i); @@ -2387,7 +2385,7 @@ ACMD(param) { clif->message(fd, msg_txt(149)); // Unable to increase the number/value. return false; } - + return true; } @@ -2397,15 +2395,15 @@ ACMD(param) { ACMD(stat_all) { int index, count, value, max, new_value; short* stats[6]; - //we don't use direct initialization because it isn't part of the c standard. - + //we don't use direct initialization because it isn't part of the c standard. + stats[0] = &sd->status.str; stats[1] = &sd->status.agi; stats[2] = &sd->status.vit; stats[3] = &sd->status.int_; stats[4] = &sd->status.dex; stats[5] = &sd->status.luk; - + if (!message || !*message || sscanf(message, "%d", &value) < 1 || value == 0) { value = pc_maxparameter(sd); max = pc_maxparameter(sd); @@ -2415,17 +2413,16 @@ ACMD(stat_all) { else max = pc_maxparameter(sd); } - + count = 0; for (index = 0; index < ARRAYLENGTH(stats); index++) { - if (value > 0 && *stats[index] > max - value) new_value = max; else if (value < 0 && *stats[index] <= -value) new_value = 1; else new_value = *stats[index] +value; - + if (new_value != (int)*stats[index]) { *stats[index] = new_value; clif->updatestatus(sd, SP_STR + index); @@ -2433,7 +2430,7 @@ ACMD(stat_all) { count++; } } - + if (count > 0) { // if at least 1 stat modified status_calc_pc(sd, SCO_FORCE); clif->message(fd, msg_txt(84)); // All stats changed! @@ -2444,7 +2441,7 @@ ACMD(stat_all) { clif->message(fd, msg_txt(178)); // You cannot increase that stat anymore. return false; } - + return true; } @@ -2455,12 +2452,12 @@ ACMD(guildlevelup) { int level = 0; int16 added_level; struct guild *guild_info; - + if (!message || !*message || sscanf(message, "%d", &level) < 1 || level == 0) { clif->message(fd, msg_txt(1014)); // Please enter a valid level (usage: @guildlvup/@guildlvlup <# of levels>). return false; } - + if (sd->status.guild_id <= 0 || (guild_info = sd->guild) == NULL) { clif->message(fd, msg_txt(43)); // You're not in a guild. return false; @@ -2471,13 +2468,13 @@ ACMD(guildlevelup) { return false; } #endif // 0 - + if (level > INT16_MAX || (level > 0 && level > MAX_GUILDLEVEL - guild_info->guild_lv)) // fix positive overflow level = MAX_GUILDLEVEL - guild_info->guild_lv; else if (level < INT16_MIN || (level < 0 && level < 1 - guild_info->guild_lv)) // fix negative overflow level = 1 - guild_info->guild_lv; added_level = (int16)level; - + if (added_level != 0) { intif->guild_change_basicinfo(guild_info->guild_id, GBI_GUILDLV, &added_level, sizeof(added_level)); clif->message(fd, msg_txt(179)); // Guild level changed. @@ -2485,7 +2482,7 @@ ACMD(guildlevelup) { clif->message(fd, msg_txt(45)); // Guild level change failed. return false; } - + return true; } @@ -2496,12 +2493,12 @@ ACMD(makeegg) { struct item_data *item_data; int id, pet_id; - + if (!message || !*message) { clif->message(fd, msg_txt(1015)); // Please enter a monster/egg name/ID (usage: @makeegg <pet>). return false; } - + if ((item_data = itemdb->search_name(message)) != NULL) // for egg name id = item_data->nameid; else @@ -2509,7 +2506,7 @@ ACMD(makeegg) ; else id = atoi(message); - + pet_id = pet->search_petDB_index(id, PET_CLASS); if (pet_id < 0) pet_id = pet->search_petDB_index(id, PET_EGG); @@ -2524,7 +2521,7 @@ ACMD(makeegg) clif->message(fd, msg_txt(180)); // The monster/egg name/id doesn't exist. return false; } - + return true; } @@ -2539,7 +2536,7 @@ ACMD(hatch) clif->message(fd, msg_txt(181)); // You already have a pet. return false; } - + return true; } @@ -2550,29 +2547,29 @@ ACMD(petfriendly) { int friendly; struct pet_data *pd; - + if (!message || !*message || (friendly = atoi(message)) < 0) { clif->message(fd, msg_txt(1016)); // Please enter a valid value (usage: @petfriendly <0-1000>). return false; } - + pd = sd->pd; if (!pd) { clif->message(fd, msg_txt(184)); // Sorry, but you have no pet. return false; } - + if (friendly < 0 || friendly > 1000) { clif->message(fd, msg_txt(37)); // An invalid number was specified. return false; } - + if (friendly == pd->pet.intimate) { clif->message(fd, msg_txt(183)); // Pet intimacy is already at maximum. return false; } - + pet->set_intimate(pd, friendly); clif->send_petstatus(sd); clif->message(fd, msg_txt(182)); // Pet intimacy changed. @@ -2586,12 +2583,12 @@ ACMD(pethungry) { int hungry; struct pet_data *pd; - + if (!message || !*message || (hungry = atoi(message)) < 0) { clif->message(fd, msg_txt(1017)); // Please enter a valid number (usage: @pethungry <0-100>). return false; } - + pd = sd->pd; if (!sd->status.pet_id || !pd) { clif->message(fd, msg_txt(184)); // Sorry, but you have no pet. @@ -2605,11 +2602,11 @@ ACMD(pethungry) clif->message(fd, msg_txt(186)); // Pet hunger is already at maximum. return false; } - + pd->pet.hungry = hungry; clif->send_petstatus(sd); clif->message(fd, msg_txt(185)); // Pet hunger changed. - + return true; } @@ -2628,12 +2625,12 @@ ACMD(petrename) clif->message(fd, msg_txt(188)); // You can already rename your pet. return false; } - + pd->pet.rename_flag = 0; intif->save_petdata(sd->status.account_id, &pd->pet); clif->send_petstatus(sd); clif->message(fd, msg_txt(187)); // You can now rename your pet. - + return true; } @@ -2642,24 +2639,23 @@ ACMD(petrename) *------------------------------------------*/ ACMD(recall) { struct map_session_data *pl_sd = NULL; - - + if (!message || !*message) { clif->message(fd, msg_txt(1018)); // Please enter a player name (usage: @recall <char name/ID>). return false; } - + if((pl_sd=map->nick2sd((char *)message)) == NULL && (pl_sd=map->charid2sd(atoi(message))) == NULL) { clif->message(fd, msg_txt(3)); // Character not found. return false; } - + if ( pc_get_group_level(sd) < pc_get_group_level(pl_sd) ) { clif->message(fd, msg_txt(81)); // Your GM level doesn't authorize you to preform this action on the specified player. return false; } - + if (sd->bl.m >= 0 && map->list[sd->bl.m].flag.nowarpto && !pc_has_permission(sd, PC_PERM_WARP_ANYWHERE)) { clif->message(fd, msg_txt(1019)); // You are not authorized to warp someone to this map. return false; @@ -2674,7 +2670,7 @@ ACMD(recall) { pc->setpos(pl_sd, sd->mapindex, sd->bl.x, sd->bl.y, CLR_RESPAWN); sprintf(atcmd_output, msg_txt(46), pl_sd->status.name); // %s recalled! clif->message(fd, atcmd_output); - + return true; } @@ -2684,17 +2680,17 @@ ACMD(recall) { *------------------------------------------*/ ACMD(char_block) { - + memset(atcmd_player_name, '\0', sizeof(atcmd_player_name)); - + if (!message || !*message || sscanf(message, "%23[^\n]", atcmd_player_name) < 1) { clif->message(fd, msg_txt(1021)); // Please enter a player name (usage: @block <char name>). return false; } - + chrif->char_ask_name(sd->status.account_id, atcmd_player_name, 1, 0, 0, 0, 0, 0, 0); // type: 1 - block clif->message(fd, msg_txt(88)); // Character name sent to char-server to ask it. - + return true; } @@ -2719,17 +2715,17 @@ ACMD(char_ban) int year, month, day, hour, minute, second, value; time_t timestamp; struct tm *tmtime; - + memset(atcmd_output, '\0', sizeof(atcmd_output)); memset(atcmd_player_name, '\0', sizeof(atcmd_player_name)); - + if (!message || !*message || sscanf(message, "%255s %23[^\n]", atcmd_output, atcmd_player_name) < 2) { clif->message(fd, msg_txt(1022)); // Please enter ban time and a player name (usage: @ban <time> <char name>). return false; } - + atcmd_output[sizeof(atcmd_output)-1] = '\0'; - + modif_p = atcmd_output; year = month = day = hour = minute = second = 0; while (modif_p[0] != '\0') { @@ -2787,10 +2783,10 @@ ACMD(char_ban) clif->message(fd,msg_txt(1023)); // You are not allowed to reduce the length of a ban. return false; } - + chrif->char_ask_name(sd->status.account_id, atcmd_player_name, !strcmpi(info->command,"charban") ? 6 : 2, year, month, day, hour, minute, second); // type: 2 - ban; 6 - charban clif->message(fd, msg_txt(88)); // Character name sent to char-server to ask it. - + return true; } @@ -2799,18 +2795,17 @@ ACMD(char_ban) *------------------------------------------*/ ACMD(char_unblock) { - memset(atcmd_player_name, '\0', sizeof(atcmd_player_name)); - + if (!message || !*message || sscanf(message, "%23[^\n]", atcmd_player_name) < 1) { clif->message(fd, msg_txt(1024)); // Please enter a player name (usage: @unblock <char name>). return false; } - + // send answer to login server via char-server chrif->char_ask_name(sd->status.account_id, atcmd_player_name, 3, 0, 0, 0, 0, 0, 0); // type: 3 - unblock clif->message(fd, msg_txt(88)); // Character name sent to char-server to ask it. - + return true; } @@ -2819,48 +2814,47 @@ ACMD(char_unblock) *------------------------------------------*/ ACMD(char_unban) { - memset(atcmd_player_name, '\0', sizeof(atcmd_player_name)); - + if (!message || !*message || sscanf(message, "%23[^\n]", atcmd_player_name) < 1) { clif->message(fd, msg_txt(1025)); // Please enter a player name (usage: @unban <char name>). return false; } - + // send answer to login server via char-server chrif->char_ask_name(sd->status.account_id, atcmd_player_name, !strcmpi(info->command,"charunban") ? 7 : 4, 0, 0, 0, 0, 0, 0); // type: 4 - unban account; type 7 - unban character clif->message(fd, msg_txt(88)); // Character name sent to char-server to ask it. - + return true; } /*========================================== * *------------------------------------------*/ -ACMD(night) { - +ACMD(night) +{ if (map->night_flag != 1) { pc->map_night_timer(pc->night_timer_tid, 0, 0, 1); } else { clif->message(fd, msg_txt(89)); // Night mode is already enabled. return false; } - + return true; } /*========================================== * *------------------------------------------*/ -ACMD(day) { - +ACMD(day) +{ if (map->night_flag != 0) { pc->map_day_timer(pc->day_timer_tid, 0, 0, 1); } else { clif->message(fd, msg_txt(90)); // Day mode is already enabled. return false; } - + return true; } @@ -2871,7 +2865,7 @@ ACMD(doom) { struct map_session_data* pl_sd; struct s_mapiterator* iter; - + iter = mapit_getallusers(); for( pl_sd = (TBL_PC*)mapit->first(iter); mapit->exists(iter); pl_sd = (TBL_PC*)mapit->next(iter) ) { @@ -2883,9 +2877,9 @@ ACMD(doom) } } mapit->free(iter); - + clif->message(fd, msg_txt(62)); // Judgment was made. - + return true; } @@ -2896,7 +2890,7 @@ ACMD(doommap) { struct map_session_data* pl_sd; struct s_mapiterator* iter; - + iter = mapit_getallusers(); for( pl_sd = (TBL_PC*)mapit->first(iter); mapit->exists(iter); pl_sd = (TBL_PC*)mapit->next(iter) ) { @@ -2908,19 +2902,19 @@ ACMD(doommap) } } mapit->free(iter); - + clif->message(fd, msg_txt(62)); // Judgment was made. - + return true; } /*========================================== * *------------------------------------------*/ -void atcommand_raise_sub(struct map_session_data* sd) { - +void atcommand_raise_sub(struct map_session_data* sd) +{ status->revive(&sd->bl, 100, 100); - + clif->skill_nodamage(&sd->bl,&sd->bl,ALL_RESURRECTION,4,1); clif->message(sd->fd, msg_txt(63)); // Mercy has been shown. } @@ -2932,15 +2926,15 @@ ACMD(raise) { struct map_session_data* pl_sd; struct s_mapiterator* iter; - + iter = mapit_getallusers(); for( pl_sd = (TBL_PC*)mapit->first(iter); mapit->exists(iter); pl_sd = (TBL_PC*)mapit->next(iter) ) if( pc_isdead(pl_sd) ) atcommand->raise_sub(pl_sd); mapit->free(iter); - + clif->message(fd, msg_txt(64)); // Mercy has been granted. - + return true; } @@ -2951,15 +2945,15 @@ ACMD(raisemap) { struct map_session_data* pl_sd; struct s_mapiterator* iter; - + iter = mapit_getallusers(); for( pl_sd = (TBL_PC*)mapit->first(iter); mapit->exists(iter); pl_sd = (TBL_PC*)mapit->next(iter) ) if (sd->bl.m == pl_sd->bl.m && pc_isdead(pl_sd) ) atcommand->raise_sub(pl_sd); mapit->free(iter); - + clif->message(fd, msg_txt(64)); // Mercy has been granted. - + return true; } @@ -2969,27 +2963,27 @@ ACMD(raisemap) ACMD(kick) { struct map_session_data *pl_sd; - + memset(atcmd_player_name, '\0', sizeof(atcmd_player_name)); - + if (!message || !*message) { clif->message(fd, msg_txt(1026)); // Please enter a player name (usage: @kick <char name/ID>). return false; } - + if((pl_sd=map->nick2sd((char *)message)) == NULL && (pl_sd=map->charid2sd(atoi(message))) == NULL) { clif->message(fd, msg_txt(3)); // Character not found. return false; } - + if ( pc_get_group_level(sd) < pc_get_group_level(pl_sd) ) { clif->message(fd, msg_txt(81)); // Your GM level don't authorize you to do this action on this player. return false; } - + clif->GM_kick(sd, pl_sd); - + return true; } @@ -3000,7 +2994,7 @@ ACMD(kickall) { struct map_session_data* pl_sd; struct s_mapiterator* iter; - + iter = mapit_getallusers(); for( pl_sd = (TBL_PC*)mapit->first(iter); mapit->exists(iter); pl_sd = (TBL_PC*)mapit->next(iter) ) { @@ -3010,9 +3004,9 @@ ACMD(kickall) } } mapit->free(iter); - + clif->message(fd, msg_txt(195)); // All players have been kicked! - + return true; } @@ -3025,7 +3019,7 @@ ACMD(allskill) sd->status.skill_point = 0; // 0 skill points clif->updatestatus(sd, SP_SKILLPOINT); // update clif->message(fd, msg_txt(76)); // All skills have been added to your skill tree. - + return true; } @@ -3035,21 +3029,21 @@ ACMD(allskill) ACMD(questskill) { uint16 skill_id, index; - + if (!message || !*message || (skill_id = atoi(message)) <= 0) {// also send a list of skills applicable to this command const char* text; - + // attempt to find the text corresponding to this command text = atcommand_help_string( info ); - + // send the error message as always clif->message(fd, msg_txt(1027)); // Please enter a quest skill number. - + if( text ) {// send the skill ID list associated with this command clif->messageln( fd, text ); } - + return false; } if( !(index = skill->get_index(skill_id)) ) { @@ -3064,10 +3058,10 @@ ACMD(questskill) clif->message(fd, msg_txt(196)); // You already have this quest skill. return false; } - + pc->skill(sd, skill_id, 1, 0); clif->message(fd, msg_txt(70)); // You have learned the skill. - + return true; } @@ -3077,21 +3071,21 @@ ACMD(questskill) ACMD(lostskill) { uint16 skill_id, index; - + if (!message || !*message || (skill_id = atoi(message)) <= 0) {// also send a list of skills applicable to this command const char* text; - + // attempt to find the text corresponding to this command text = atcommand_help_string( info ); - + // send the error message as always clif->message(fd, msg_txt(1027)); // Please enter a quest skill number. - + if( text ) {// send the skill ID list associated with this command clif->messageln( fd, text ); } - + return false; } if ( !( index = skill->get_index(skill_id) ) ) { @@ -3106,12 +3100,12 @@ ACMD(lostskill) clif->message(fd, msg_txt(201)); // You don't have this quest skill. return false; } - + sd->status.skill[index].lv = 0; sd->status.skill[index].flag = 0; clif->deleteskill(sd,skill_id); clif->message(fd, msg_txt(71)); // You have forgotten the skill. - + return true; } @@ -3122,9 +3116,9 @@ ACMD(spiritball) { int max_spiritballs; int number; - + max_spiritballs = min(ARRAYLENGTH(sd->spirit_timer), 0x7FFF); - + if( !message || !*message || (number = atoi(message)) < 0 || number > max_spiritballs ) { char msg[CHAT_SIZE_MAX]; @@ -3132,13 +3126,13 @@ ACMD(spiritball) clif->message(fd, msg); return false; } - + if( sd->spiritball > 0 ) pc->delspiritball(sd, sd->spiritball, 1); sd->spiritball = number; clif->spiritball(&sd->bl); // no message, player can look the difference - + return true; } @@ -3148,16 +3142,16 @@ ACMD(spiritball) ACMD(party) { char party_name[NAME_LENGTH]; - + memset(party_name, '\0', sizeof(party_name)); - + if (!message || !*message || sscanf(message, "%23[^\n]", party_name) < 1) { clif->message(fd, msg_txt(1029)); // Please enter a party name (usage: @party <party_name>). return false; } - + party->create(sd, party_name, 0, 0); - + return true; } @@ -3168,25 +3162,24 @@ ACMD(guild) { char guild_name[NAME_LENGTH]; int prev; - + memset(guild_name, '\0', sizeof(guild_name)); - + if (!message || !*message || sscanf(message, "%23[^\n]", guild_name) < 1) { clif->message(fd, msg_txt(1030)); // Please enter a guild name (usage: @guild <guild_name>). return false; } - + prev = battle_config.guild_emperium_check; battle_config.guild_emperium_check = 0; guild->create(sd, guild_name); battle_config.guild_emperium_check = prev; - + return true; } ACMD(breakguild) { - if (sd->status.guild_id) { // Check if the player has a guild struct guild *g; g = sd->guild; // Search the guild @@ -3222,11 +3215,11 @@ ACMD(agitstart) { clif->message(fd, msg_txt(73)); // War of Emperium is currently in progress. return false; } - + map->agit_flag = 1; guild->agit_start(); clif->message(fd, msg_txt(72)); // War of Emperium has been initiated. - + return true; } @@ -3238,11 +3231,11 @@ ACMD(agitstart2) { clif->message(fd, msg_txt(404)); // "War of Emperium SE is currently in progress." return false; } - + map->agit2_flag = 1; guild->agit2_start(); clif->message(fd, msg_txt(403)); // "War of Emperium SE has been initiated." - + return true; } @@ -3254,11 +3247,11 @@ ACMD(agitend) { clif->message(fd, msg_txt(75)); // War of Emperium is currently not in progress. return false; } - + map->agit_flag = 0; guild->agit_end(); clif->message(fd, msg_txt(74)); // War of Emperium has been ended. - + return true; } @@ -3270,11 +3263,11 @@ ACMD(agitend2) { clif->message(fd, msg_txt(406)); // "War of Emperium SE is currently not in progress." return false; } - + map->agit2_flag = 0; guild->agit2_end(); clif->message(fd, msg_txt(405)); // "War of Emperium SE has been ended." - + return true; } @@ -3294,15 +3287,15 @@ ACMD(idsearch) char item_name[100]; unsigned int i, match; struct item_data *item_array[MAX_SEARCH]; - + memset(item_name, '\0', sizeof(item_name)); memset(atcmd_output, '\0', sizeof(atcmd_output)); - + if (!message || !*message || sscanf(message, "%99s", item_name) < 0) { clif->message(fd, msg_txt(1031)); // Please enter part of an item name (usage: @idsearch <part_of_item_name>). return false; } - + sprintf(atcmd_output, msg_txt(77), item_name); // Search results for '%s' (name: id): clif->message(fd, atcmd_output); match = itemdb->search_name_array(item_array, MAX_SEARCH, item_name, 0); @@ -3317,7 +3310,7 @@ ACMD(idsearch) } sprintf(atcmd_output, msg_txt(79), match); // %d results found. clif->message(fd, atcmd_output); - + return true; } @@ -3329,14 +3322,14 @@ ACMD(recallall) struct map_session_data* pl_sd; struct s_mapiterator* iter; int count; - + memset(atcmd_output, '\0', sizeof(atcmd_output)); - + if (sd->bl.m >= 0 && map->list[sd->bl.m].flag.nowarpto && !pc_has_permission(sd, PC_PERM_WARP_ANYWHERE)) { clif->message(fd, msg_txt(1032)); // You are not authorized to warp someone to your current map. return false; } - + count = 0; iter = mapit_getallusers(); for( pl_sd = (TBL_PC*)mapit->first(iter); mapit->exists(iter); pl_sd = (TBL_PC*)mapit->next(iter) ) { @@ -3355,13 +3348,13 @@ ACMD(recallall) } } mapit->free(iter); - + clif->message(fd, msg_txt(92)); // All characters recalled! if (count) { sprintf(atcmd_output, msg_txt(1033), count); // Because you are not authorized to warp from some maps, %d player(s) have not been recalled. clif->message(fd, atcmd_output); } - + return true; } @@ -3375,29 +3368,29 @@ ACMD(guildrecall) int count; char guild_name[NAME_LENGTH]; struct guild *g; - + memset(guild_name, '\0', sizeof(guild_name)); memset(atcmd_output, '\0', sizeof(atcmd_output)); - + if (!message || !*message || sscanf(message, "%23[^\n]", guild_name) < 1) { clif->message(fd, msg_txt(1034)); // Please enter a guild name/ID (usage: @guildrecall <guild_name/ID>). return false; } - + if (sd->bl.m >= 0 && map->list[sd->bl.m].flag.nowarpto && !pc_has_permission(sd, PC_PERM_WARP_ANYWHERE)) { clif->message(fd, msg_txt(1032)); // You are not authorized to warp someone to your current map. return false; } - + if ((g = guild->searchname(guild_name)) == NULL && // name first to avoid error when name begin with a number (g = guild->search(atoi(message))) == NULL) { clif->message(fd, msg_txt(94)); // Incorrect name/ID, or no one from the guild is online. return false; } - + count = 0; - + iter = mapit_getallusers(); for( pl_sd = (TBL_PC*)mapit->first(iter); mapit->exists(iter); pl_sd = (TBL_PC*)mapit->next(iter) ) { @@ -3411,14 +3404,14 @@ ACMD(guildrecall) } } mapit->free(iter); - + sprintf(atcmd_output, msg_txt(93), g->name); // All online characters of the %s guild have been recalled to your position. clif->message(fd, atcmd_output); if (count) { sprintf(atcmd_output, msg_txt(1033), count); // Because you are not authorized to warp from some maps, %d player(s) have not been recalled. clif->message(fd, atcmd_output); } - + return true; } @@ -3432,29 +3425,29 @@ ACMD(partyrecall) char party_name[NAME_LENGTH]; struct party_data *p; int count; - + memset(party_name, '\0', sizeof(party_name)); memset(atcmd_output, '\0', sizeof(atcmd_output)); - + if (!message || !*message || sscanf(message, "%23[^\n]", party_name) < 1) { clif->message(fd, msg_txt(1035)); // Please enter a party name/ID (usage: @partyrecall <party_name/ID>). return false; } - + if (sd->bl.m >= 0 && map->list[sd->bl.m].flag.nowarpto && !pc_has_permission(sd, PC_PERM_WARP_ANYWHERE)) { clif->message(fd, msg_txt(1032)); // You are not authorized to warp someone to your current map. return false; } - + if ((p = party->searchname(party_name)) == NULL && // name first to avoid error when name begin with a number (p = party->search(atoi(message))) == NULL) { clif->message(fd, msg_txt(96)); // Incorrect name or ID, or no one from the party is online. return false; } - + count = 0; - + iter = mapit_getallusers(); for( pl_sd = (TBL_PC*)mapit->first(iter); mapit->exists(iter); pl_sd = (TBL_PC*)mapit->next(iter) ) { if (sd->status.account_id != pl_sd->status.account_id && pl_sd->status.party_id == p->party.party_id) { @@ -3467,14 +3460,14 @@ ACMD(partyrecall) } } mapit->free(iter); - + sprintf(atcmd_output, msg_txt(95), p->party.name); // All online characters of the %s party have been recalled to your position. clif->message(fd, atcmd_output); if (count) { sprintf(atcmd_output, msg_txt(1033), count); // Because you are not authorized to warp from some maps, %d player(s) have not been recalled. clif->message(fd, atcmd_output); } - + return true; } @@ -3485,7 +3478,7 @@ ACMD(reloaditemdb) { itemdb->reload(); clif->message(fd, msg_txt(97)); // Item database has been reloaded. - + return true; } @@ -3500,7 +3493,7 @@ ACMD(reloadmobdb) { mercenary->read_skilldb(); elemental->reload_db(); clif->message(fd, msg_txt(98)); // Monster database has been reloaded. - + return true; } @@ -3514,7 +3507,7 @@ ACMD(reloadskilldb) elemental->reload_skilldb(); mercenary->read_skilldb(); clif->message(fd, msg_txt(99)); // Skill database has been reloaded. - + return true; } @@ -3523,21 +3516,21 @@ ACMD(reloadskilldb) *------------------------------------------*/ ACMD(reloadatcommand) { config_t run_test; - + if (libconfig->read_file(&run_test, "conf/groups.conf")) { clif->message(fd, msg_txt(1036)); // Error reading groups.conf, reload failed. return false; } - + libconfig->destroy(&run_test); - + if (libconfig->read_file(&run_test, map->ATCOMMAND_CONF_FILENAME)) { clif->message(fd, msg_txt(1037)); // Error reading atcommand.conf, reload failed. return false; } - + libconfig->destroy(&run_test); - + atcommand->doload(); pcg->reload(); clif->message(fd, msg_txt(254)); @@ -3550,9 +3543,9 @@ ACMD(reloadbattleconf) { struct Battle_Config prev_config; memcpy(&prev_config, &battle_config, sizeof(prev_config)); - + battle->config_read(map->BATTLE_CONF_FILENAME); - + if( prev_config.item_rate_mvp != battle_config.item_rate_mvp || prev_config.item_rate_common != battle_config.item_rate_common || prev_config.item_rate_common_boss != battle_config.item_rate_common_boss @@ -3583,8 +3576,7 @@ ACMD(reloadbattleconf) || prev_config.item_drop_treasure_max != battle_config.item_drop_treasure_max || prev_config.base_exp_rate != battle_config.base_exp_rate || prev_config.job_exp_rate != battle_config.job_exp_rate - ) - { // Exp or Drop rates changed. + ) { // Exp or Drop rates changed. mob->reload(); //Needed as well so rate changes take effect. chrif->ragsrvinfo(battle_config.base_exp_rate, battle_config.job_exp_rate, battle_config.item_rate_common); } @@ -3618,7 +3610,7 @@ ACMD(reloadscript) { //atcommand_broadcast( fd, sd, "@broadcast", "Server is reloading scripts..." ); //atcommand_broadcast( fd, sd, "@broadcast", "You will feel a bit of lag at this point !" ); - + iter = mapit_getallusers(); for( pl_sd = (TBL_PC*)mapit->first(iter); mapit->exists(iter); pl_sd = (TBL_PC*)mapit->next(iter) ) { if (pl_sd->npc_id || pl_sd->npc_shopid) { @@ -3638,14 +3630,14 @@ ACMD(reloadscript) { } } mapit->free(iter); - + flush_fifos(); map->reloadnpc(true, NULL, 0); // reload config files seeking for npcs script->reload(); npc->reload(); - + clif->message(fd, msg_txt(100)); // Scripts have been reloaded. - + return true; } @@ -3667,33 +3659,33 @@ ACMD(mapinfo) { int i, m_id, chat_num = 0, list = 0, vend_num = 0; unsigned short m_index; char mapname[24]; - + memset(atcmd_output, '\0', sizeof(atcmd_output)); memset(mapname, '\0', sizeof(mapname)); memset(direction, '\0', sizeof(direction)); - + sscanf(message, "%d %23[^\n]", &list, mapname); - + if (list < 0 || list > 3) { clif->message(fd, msg_txt(1038)); // Please enter at least one valid list number (usage: @mapinfo <0-3> <map>). return false; } - + if (mapname[0] == '\0') { safestrncpy(mapname, mapindex_id2name(sd->mapindex), MAP_NAME_LENGTH); m_id = map->mapindex2mapid(sd->mapindex); } else { m_id = map->mapname2mapid(mapname); } - + if (m_id < 0) { clif->message(fd, msg_txt(1)); // Map not found. return false; } m_index = mapindex->name2id(mapname); //This one shouldn't fail since the previous seek did not. - + clif->message(fd, msg_txt(1039)); // ------ Map Info ------ - + // count chats (for initial message) chat_num = 0; iter = mapit_getallusers(); @@ -3706,21 +3698,21 @@ ACMD(mapinfo) { } } mapit->free(iter); - + sprintf(atcmd_output, msg_txt(1040), mapname, map->list[m_id].zone->name, map->list[m_id].users, map->list[m_id].npc_num, chat_num, vend_num); // Map: %s (Zone:%s) | Players: %d | NPCs: %d | Chats: %d | Vendings: %d clif->message(fd, atcmd_output); clif->message(fd, msg_txt(1041)); // ------ Map Flags ------ if (map->list[m_id].flag.town) clif->message(fd, msg_txt(1042)); // Town Map - + if (battle_config.autotrade_mapflag == map->list[m_id].flag.autotrade) clif->message(fd, msg_txt(1043)); // Autotrade Enabled else clif->message(fd, msg_txt(1044)); // Autotrade Disabled - + if (map->list[m_id].flag.battleground) clif->message(fd, msg_txt(1045)); // Battlegrounds ON - + strcpy(atcmd_output,msg_txt(1046)); // PvP Flags: if (map->list[m_id].flag.pvp) strcat(atcmd_output, msg_txt(1047)); // Pvp ON | @@ -3733,7 +3725,7 @@ ACMD(mapinfo) { if (map->list[m_id].flag.pvp_nocalcrank) strcat(atcmd_output, msg_txt(1051)); // NoCalcRank | clif->message(fd, atcmd_output); - + strcpy(atcmd_output,msg_txt(1052)); // GvG Flags: if (map->list[m_id].flag.gvg) strcat(atcmd_output, msg_txt(1053)); // GvG ON | @@ -3744,7 +3736,7 @@ ACMD(mapinfo) { if (map->list[m_id].flag.gvg_noparty) strcat(atcmd_output, msg_txt(1056)); // NoParty | clif->message(fd, atcmd_output); - + strcpy(atcmd_output,msg_txt(1057)); // Teleport Flags: if (map->list[m_id].flag.noteleport) strcat(atcmd_output, msg_txt(1058)); // NoTeleport | @@ -3759,12 +3751,12 @@ ACMD(mapinfo) { if (map->list[m_id].flag.nomemo) strcat(atcmd_output, msg_txt(1064)); // NoMemo | clif->message(fd, atcmd_output); - + sprintf(atcmd_output, msg_txt(1065), // No Exp Penalty: %s | No Zeny Penalty: %s (map->list[m_id].flag.noexppenalty) ? msg_txt(1066) : msg_txt(1067), (map->list[m_id].flag.nozenypenalty) ? msg_txt(1066) : msg_txt(1067)); // On / Off clif->message(fd, atcmd_output); - + if (map->list[m_id].flag.nosave) { if (!map->list[m_id].save.map) clif->message(fd, msg_txt(1068)); // No Save (Return to last Save Point) @@ -3777,7 +3769,7 @@ ACMD(mapinfo) { clif->message(fd, atcmd_output); } } - + strcpy(atcmd_output,msg_txt(1071)); // Weather Flags: if (map->list[m_id].flag.snow) strcat(atcmd_output, msg_txt(1072)); // Snow | @@ -3796,7 +3788,7 @@ ACMD(mapinfo) { if (map->list[m_id].flag.nightenabled) strcat(atcmd_output, msg_txt(1080)); // Displays Night | clif->message(fd, atcmd_output); - + strcpy(atcmd_output,msg_txt(1081)); // Other Flags: if (map->list[m_id].flag.nobranch) strcat(atcmd_output, msg_txt(1082)); // NoBranch | @@ -3815,7 +3807,7 @@ ACMD(mapinfo) { if (map->list[m_id].flag.reset) strcat(atcmd_output, msg_txt(1089)); // Reset | clif->message(fd, atcmd_output); - + strcpy(atcmd_output,msg_txt(1090)); // Other Flags: if (map->list[m_id].nocommand) strcat(atcmd_output, msg_txt(1091)); // NoCommand | @@ -3832,7 +3824,7 @@ ACMD(mapinfo) { if (map->list[m_id].flag.guildlock) strcat(atcmd_output, msg_txt(1097)); // GuildLock | clif->message(fd, atcmd_output); - + switch (list) { case 0: // Do nothing. It's list 0, no additional display. @@ -3881,8 +3873,8 @@ ACMD(mapinfo) { for( pl_sd = (TBL_PC*)mapit->first(iter); mapit->exists(iter); pl_sd = (TBL_PC*)mapit->next(iter) ) { if ((cd = (struct chat_data*)map->id2bl(pl_sd->chatID)) != NULL && - pl_sd->mapindex == m_index && - cd->usersd[0] == pl_sd) + pl_sd->mapindex == m_index && + cd->usersd[0] == pl_sd) { sprintf(atcmd_output, msg_txt(1114), // Chat: %s | Player: %s | Location: %d %d cd->title, pl_sd->status.name, cd->bl.x, cd->bl.y); @@ -3898,7 +3890,7 @@ ACMD(mapinfo) { clif->message(fd, msg_txt(1118)); // Please enter at least one valid list number (usage: @mapinfo <0-3> <map>). return false; } - + return true; } @@ -3911,12 +3903,12 @@ ACMD(mount_peco) clif->message(fd, msg_txt(212)); // Cannot mount while in disguise. return false; } - + if( sd->sc.data[SC_ALL_RIDING] ) { clif->message(fd, msg_txt(1476)); // You are already mounting something else return false; } - + if( (sd->class_&MAPID_THIRDMASK) == MAPID_RUNE_KNIGHT ) { if( !pc->checkskill(sd,RK_DRAGONTRAINING) ) { sprintf(atcmd_output, msg_txt(213), skill->get_desc(RK_DRAGONTRAINING)); // You need %s to mount! @@ -3982,10 +3974,10 @@ ACMD(mount_peco) ACMD(guildspy) { char guild_name[NAME_LENGTH]; struct guild *g; - + memset(guild_name, '\0', sizeof(guild_name)); memset(atcmd_output, '\0', sizeof(atcmd_output)); - + if (!map->enable_spy) { clif->message(fd, msg_txt(1125)); // The mapserver has spy command support disabled. @@ -3995,7 +3987,7 @@ ACMD(guildspy) { clif->message(fd, msg_txt(1126)); // Please enter a guild name/ID (usage: @guildspy <guild_name/ID>). return false; } - + if ((g = guild->searchname(guild_name)) != NULL || // name first to avoid error when name begin with a number (g = guild->search(atoi(message))) != NULL) { if (sd->guildspy == g->guild_id) { @@ -4011,7 +4003,7 @@ ACMD(guildspy) { clif->message(fd, msg_txt(94)); // Incorrect name/ID, or no one from the specified guild is online. return false; } - + return true; } @@ -4021,21 +4013,21 @@ ACMD(guildspy) { ACMD(partyspy) { char party_name[NAME_LENGTH]; struct party_data *p; - + memset(party_name, '\0', sizeof(party_name)); memset(atcmd_output, '\0', sizeof(atcmd_output)); - + if (!map->enable_spy) { clif->message(fd, msg_txt(1125)); // The mapserver has spy command support disabled. return false; } - + if (!message || !*message || sscanf(message, "%23[^\n]", party_name) < 1) { clif->message(fd, msg_txt(1127)); // Please enter a party name/ID (usage: @partyspy <party_name/ID>). return false; } - + if ((p = party->searchname(party_name)) != NULL || // name first to avoid error when name begin with a number (p = party->search(atoi(message))) != NULL) { if (sd->partyspy == p->party.party_id) { @@ -4051,7 +4043,7 @@ ACMD(partyspy) { clif->message(fd, msg_txt(96)); // Incorrect name/ID, or no one from the specified party is online. return false; } - + return true; } @@ -4061,7 +4053,7 @@ ACMD(partyspy) { ACMD(repairall) { int count, i; - + count = 0; for (i = 0; i < MAX_INVENTORY; i++) { if (sd->status.inventory[i].nameid && sd->status.inventory[i].attribute == 1) { @@ -4070,7 +4062,7 @@ ACMD(repairall) count++; } } - + if (count > 0) { clif->misceffect(&sd->bl, 3); clif->equiplist(sd); @@ -4079,7 +4071,7 @@ ACMD(repairall) clif->message(fd, msg_txt(108)); // No item need to be repaired. return false; } - + return true; } @@ -4088,14 +4080,14 @@ ACMD(repairall) *------------------------------------------*/ ACMD(nuke) { struct map_session_data *pl_sd; - + memset(atcmd_player_name, '\0', sizeof(atcmd_player_name)); - + if (!message || !*message || sscanf(message, "%23[^\n]", atcmd_player_name) < 1) { clif->message(fd, msg_txt(1128)); // Please enter a player name (usage: @nuke <char name>). return false; } - + if ((pl_sd = map->nick2sd(atcmd_player_name)) != NULL) { if (pc_get_group_level(sd) >= pc_get_group_level(pl_sd)) { // you can kill only lower or same GM level skill->castend_nodamage_id(&pl_sd->bl, &pl_sd->bl, NPC_SELFDESTRUCTION, 99, timer->gettick(), 0); @@ -4108,7 +4100,7 @@ ACMD(nuke) { clif->message(fd, msg_txt(3)); // Character not found. return false; } - + return true; } @@ -4118,14 +4110,14 @@ ACMD(nuke) { ACMD(tonpc) { char npcname[NAME_LENGTH+1]; struct npc_data *nd; - + memset(npcname, 0, sizeof(npcname)); - + if (!message || !*message || sscanf(message, "%23[^\n]", npcname) < 1) { clif->message(fd, msg_txt(1129)); // Please enter a NPC name (usage: @tonpc <NPC_name>). return false; } - + if ((nd = npc->name2id(npcname)) != NULL) { if (nd->bl.m != -1 && pc->setpos(sd, map_id2index(nd->bl.m), nd->bl.x, nd->bl.y, CLR_TELEPORT) == 0) clif->message(fd, msg_txt(0)); // Warped. @@ -4135,7 +4127,7 @@ ACMD(tonpc) { clif->message(fd, msg_txt(111)); // This NPC doesn't exist. return false; } - + return true; } @@ -4145,14 +4137,14 @@ ACMD(tonpc) { ACMD(shownpc) { char NPCname[NAME_LENGTH+1]; - + memset(NPCname, '\0', sizeof(NPCname)); - + if (!message || !*message || sscanf(message, "%23[^\n]", NPCname) < 1) { clif->message(fd, msg_txt(1130)); // Please enter a NPC name (usage: @enablenpc <NPC_name>). return false; } - + if (npc->name2id(NPCname) != NULL) { npc->enable(NPCname, 1); clif->message(fd, msg_txt(110)); // Npc Enabled. @@ -4160,7 +4152,7 @@ ACMD(shownpc) clif->message(fd, msg_txt(111)); // This NPC doesn't exist. return false; } - + return true; } @@ -4170,19 +4162,19 @@ ACMD(shownpc) ACMD(hidenpc) { char NPCname[NAME_LENGTH+1]; - + memset(NPCname, '\0', sizeof(NPCname)); - + if (!message || !*message || sscanf(message, "%23[^\n]", NPCname) < 1) { clif->message(fd, msg_txt(1131)); // Please enter a NPC name (usage: @hidenpc <NPC_name>). return false; } - + if (npc->name2id(NPCname) == NULL) { clif->message(fd, msg_txt(111)); // This NPC doesn't exist. return false; } - + npc->enable(NPCname, 0); clif->message(fd, msg_txt(112)); // Npc Disabled. return true; @@ -4191,26 +4183,26 @@ ACMD(hidenpc) ACMD(loadnpc) { FILE *fp; - + if (!message || !*message) { clif->message(fd, msg_txt(1132)); // Please enter a script file name (usage: @loadnpc <file name>). return false; } - + // check if script file exists if ((fp = fopen(message, "r")) == NULL) { clif->message(fd, msg_txt(261)); return false; } fclose(fp); - + // add to list of script sources and run it npc->addsrcfile(message); npc->parsesrcfile(message,true); npc->read_event_script(); - + clif->message(fd, msg_txt(262)); - + return true; } @@ -4218,19 +4210,19 @@ ACMD(unloadnpc) { struct npc_data *nd; char NPCname[NAME_LENGTH+1]; - + memset(NPCname, '\0', sizeof(NPCname)); - + if (!message || !*message || sscanf(message, "%24[^\n]", NPCname) < 1) { clif->message(fd, msg_txt(1133)); // Please enter a NPC name (usage: @npcoff <NPC_name>). return false; } - + if ((nd = npc->name2id(NPCname)) == NULL) { clif->message(fd, msg_txt(111)); // This NPC doesn't exist. return false; } - + npc->unload_duplicates(nd); npc->unload(nd,true); npc->read_event_script(); @@ -4246,16 +4238,16 @@ char* txt_time(unsigned int duration) int days, hours, minutes, seconds; static char temp1[CHAT_SIZE_MAX]; int tlen = 0; - + memset(temp1, '\0', sizeof(temp1)); - + days = duration / (60 * 60 * 24); duration = duration - (60 * 60 * 24 * days); hours = duration / (60 * 60); duration = duration - (60 * 60 * hours); minutes = duration / 60; seconds = duration - (60 * minutes); - + if (days == 1) tlen += sprintf(tlen + temp1, msg_txt(219), days); // %d day else if (days > 1) @@ -4272,7 +4264,7 @@ char* txt_time(unsigned int duration) sprintf(tlen + temp1, msg_txt(225), seconds); // and %d second else if (seconds > 1) sprintf(tlen + temp1, msg_txt(226), seconds); // and %d seconds - + return temp1; } @@ -4284,19 +4276,19 @@ ACMD(servertime) { time_t time_server; // variable for number of seconds (used with time() function) struct tm *datetime; // variable for time in structure ->tm_mday, ->tm_sec, ... char temp[CHAT_SIZE_MAX]; - + memset(temp, '\0', sizeof(temp)); - + time(&time_server); // get time in seconds since 1/1/1970 datetime = localtime(&time_server); // convert seconds in structure // like sprintf, but only for date/time (Sunday, November 02 2003 15:12:52) strftime(temp, sizeof(temp)-1, msg_txt(230), datetime); // Server time (normal time): %A, %B %d %Y %X. clif->message(fd, temp); - + if (pc->day_timer_tid != INVALID_TIMER && pc->night_timer_tid != INVALID_TIMER) { const struct TimerData * timer_data = timer->get(pc->night_timer_tid); const struct TimerData * timer_data2 = timer->get(pc->day_timer_tid); - + if (map->night_flag == 0) { sprintf(temp, msg_txt(235), // Game time: The game is actually in daylight for %s. txt_time((unsigned int)(DIFF_TICK(timer_data->tick,timer->gettick())/1000))); @@ -4328,7 +4320,7 @@ ACMD(servertime) { else clif->message(fd, msg_txt(232)); // Game time: The game is in permanent night. } - + return true; } @@ -4341,7 +4333,7 @@ void get_jail_time(int jailtime, int* year, int* month, int* day, int* hour, int const int factor_month = 43200; //30*24*60 = 43200 const int factor_day = 1440; //24*60 = 1440 const int factor_hour = 60; - + *year = jailtime/factor_year; jailtime -= *year*factor_year; *month = jailtime/factor_month; @@ -4351,7 +4343,7 @@ void get_jail_time(int jailtime, int* year, int* month, int* day, int* hour, int *hour = jailtime/factor_hour; jailtime -= *hour*factor_hour; *minute = jailtime; - + *year = *year > 0? *year : 0; *month = *month > 0? *month : 0; *day = *day > 0? *day : 0; @@ -4368,31 +4360,31 @@ ACMD(jail) { struct map_session_data *pl_sd; int x, y; unsigned short m_index; - + memset(atcmd_player_name, '\0', sizeof(atcmd_player_name)); - + if (!message || !*message || sscanf(message, "%23[^\n]", atcmd_player_name) < 1) { clif->message(fd, msg_txt(1134)); // Please enter a player name (usage: @jail <char_name>). return false; } - + if ((pl_sd = map->nick2sd(atcmd_player_name)) == NULL) { clif->message(fd, msg_txt(3)); // Character not found. return false; } - - if (pc_get_group_level(sd) < pc_get_group_level(pl_sd)) - { // you can jail only lower or same GM + + if (pc_get_group_level(sd) < pc_get_group_level(pl_sd)) { + // you can jail only lower or same GM clif->message(fd, msg_txt(81)); // Your GM level don't authorize you to do this action on this player. return false; } - + if (pl_sd->sc.data[SC_JAILED]) { clif->message(fd, msg_txt(118)); // Player warped in jails. return false; } - + switch(rnd() % 2) { //Jail Locations case 0: m_index = mapindex->name2id(MAP_JAIL); @@ -4405,7 +4397,7 @@ ACMD(jail) { y = 75; break; } - + //Duration of INT_MAX to specify infinity. sc_start4(NULL,&pl_sd->bl,SC_JAILED,100,INT_MAX,m_index,x,y,1000); clif->message(pl_sd->fd, msg_txt(117)); // You have been jailed by a GM. @@ -4419,31 +4411,31 @@ ACMD(jail) { *------------------------------------------*/ ACMD(unjail) { struct map_session_data *pl_sd; - + memset(atcmd_player_name, '\0', sizeof(atcmd_player_name)); - + if (!message || !*message || sscanf(message, "%23[^\n]", atcmd_player_name) < 1) { clif->message(fd, msg_txt(1135)); // Please enter a player name (usage: @unjail/@discharge <char_name>). return false; } - + if ((pl_sd = map->nick2sd(atcmd_player_name)) == NULL) { clif->message(fd, msg_txt(3)); // Character not found. return false; } - + if (pc_get_group_level(sd) < pc_get_group_level(pl_sd)) { // you can jail only lower or same GM - + clif->message(fd, msg_txt(81)); // Your GM level don't authorize you to do this action on this player. return false; } - + if (!pl_sd->sc.data[SC_JAILED]) { clif->message(fd, msg_txt(119)); // This player is not in jails. return false; } - + //Reset jail time to 1 sec. sc_start(NULL,&pl_sd->bl,SC_JAILED,100,1,1000); clif->message(pl_sd->fd, msg_txt(120)); // A GM has discharged you from jail. @@ -4457,14 +4449,14 @@ ACMD(jailfor) { char * modif_p; int jailtime = 0,x,y; short m_index = 0; - + if (!message || !*message || sscanf(message, "%255s %23[^\n]",atcmd_output,atcmd_player_name) < 2) { - clif->message(fd, msg_txt(400)); //Usage: @jailfor <time> <character name> + clif->message(fd, msg_txt(400)); //Usage: @jailfor <time> <character name> return false; } - + atcmd_output[sizeof(atcmd_output)-1] = '\0'; - + modif_p = atcmd_output; year = month = day = hour = minute = 0; while (modif_p[0] != '\0') { @@ -4499,33 +4491,32 @@ ACMD(jailfor) { } } } - + if (year == 0 && month == 0 && day == 0 && hour == 0 && minute == 0) { clif->message(fd, msg_txt(1136)); // Invalid time for jail command. return false; } - + if ((pl_sd = map->nick2sd(atcmd_player_name)) == NULL) { clif->message(fd, msg_txt(3)); // Character not found. return false; } - + if (pc_get_group_level(pl_sd) > pc_get_group_level(sd)) { clif->message(fd, msg_txt(81)); // Your GM level don't authorize you to do this action on this player. return false; } - - jailtime = year*12*30*24*60 + month*30*24*60 + day*24*60 + hour*60 + minute; //In minutes - + + jailtime = year*12*30*24*60 + month*30*24*60 + day*24*60 + hour*60 + minute; //In minutes + if(jailtime==0) { clif->message(fd, msg_txt(1136)); // Invalid time for jail command. return false; } - + //Added by Coltaro - if(pl_sd->sc.data[SC_JAILED] && - pl_sd->sc.data[SC_JAILED]->val1 != INT_MAX) - { //Update the player's jail time + if (pl_sd->sc.data[SC_JAILED] && pl_sd->sc.data[SC_JAILED]->val1 != INT_MAX) { + //Update the player's jail time jailtime += pl_sd->sc.data[SC_JAILED]->val1; if (jailtime <= 0) { jailtime = 0; @@ -4534,15 +4525,15 @@ ACMD(jailfor) { } else { atcommand->get_jail_time(jailtime,&year,&month,&day,&hour,&minute); sprintf(atcmd_output,msg_txt(402),msg_txt(1137),year,month,day,hour,minute); //%s in jail for %d years, %d months, %d days, %d hours and %d minutes - clif->message(pl_sd->fd, atcmd_output); + clif->message(pl_sd->fd, atcmd_output); sprintf(atcmd_output,msg_txt(402),msg_txt(1138),year,month,day,hour,minute); //This player is now in jail for %d years, %d months, %d days, %d hours and %d minutes - clif->message(fd, atcmd_output); + clif->message(fd, atcmd_output); } } else if (jailtime < 0) { clif->message(fd, msg_txt(1136)); return false; } - + //Jail locations, add more as you wish. switch(rnd()%2) { @@ -4555,7 +4546,7 @@ ACMD(jailfor) { x = 24; y = 75; break; } - + sc_start4(NULL,&pl_sd->bl,SC_JAILED,100,jailtime,m_index,x,y,jailtime?60000:1000); //jailtime = 0: Time was reset to 0. Wait 1 second to warp player out (since it's done in status->change_timer). return true; } @@ -4565,28 +4556,28 @@ ACMD(jailfor) { ACMD(jailtime) { int year, month, day, hour, minute; - + if (!sd->sc.data[SC_JAILED]) { clif->message(fd, msg_txt(1139)); // You are not in jail. return false; } - + if (sd->sc.data[SC_JAILED]->val1 == INT_MAX) { clif->message(fd, msg_txt(1140)); // You have been jailed indefinitely. return true; } - + if (sd->sc.data[SC_JAILED]->val1 <= 0) { // Was not jailed with @jailfor (maybe @jail? or warped there? or got recalled?) clif->message(fd, msg_txt(1141)); // You have been jailed for an unknown amount of time. return false; } - + //Get remaining jail time atcommand->get_jail_time(sd->sc.data[SC_JAILED]->val1,&year,&month,&day,&hour,&minute); sprintf(atcmd_output,msg_txt(402),msg_txt(1142),year,month,day,hour,minute); // You will remain in jail for %d years, %d months, %d days, %d hours and %d minutes - + clif->message(fd, atcmd_output); - + return true; } @@ -4596,17 +4587,18 @@ ACMD(jailtime) ACMD(disguise) { int id = 0; - + if (!message || !*message) { clif->message(fd, msg_txt(1143)); // Please enter a Monster/NPC name/ID (usage: @disguise <name/ID>). return false; } - - if ((id = atoi(message)) > 0) - { //Acquired an ID + + if ((id = atoi(message)) > 0) { + //Acquired an ID if (!mob->db_checkid(id) && !npcdb_checkid(id)) id = 0; //Invalid id for either mobs or npcs. - } else { //Acquired a Name + } else { + //Acquired a Name if ((id = mob->db_searchname(message)) == 0) { struct npc_data* nd = npc->name2id(message); @@ -4614,18 +4606,18 @@ ACMD(disguise) id = nd->class_; } } - + if (id == 0) { - clif->message(fd, msg_txt(123)); // Invalid Monster/NPC name/ID specified. + clif->message(fd, msg_txt(123)); // Invalid Monster/NPC name/ID specified. return false; } - + if (pc_hasmount(sd)) { clif->message(fd, msg_txt(1144)); // Character cannot be disguised while mounted. return false; } - + if(sd->sc.data[SC_MONSTER_TRANSFORM]) { clif->message(fd, msg_txt(1487)); // Character cannot be disguised while in monster form. @@ -4634,7 +4626,7 @@ ACMD(disguise) pc->disguise(sd, id); clif->message(fd, msg_txt(122)); // Disguise applied. - + return true; } @@ -4646,25 +4638,25 @@ ACMD(disguiseall) int mob_id=0; struct map_session_data *pl_sd; struct s_mapiterator* iter; - + if (!message || !*message) { clif->message(fd, msg_txt(1145)); // Please enter a Monster/NPC name/ID (usage: @disguiseall <name/ID>). return false; } - + if ((mob_id = mob->db_searchname(message)) == 0) // check name first (to avoid possible name begining by a number) mob_id = atoi(message); - + if (!mob->db_checkid(mob_id) && !npcdb_checkid(mob_id)) { //if mob or npc... clif->message(fd, msg_txt(123)); // Monster/NPC name/id not found. return false; } - + iter = mapit_getallusers(); for( pl_sd = (TBL_PC*)mapit->first(iter); mapit->exists(iter); pl_sd = (TBL_PC*)mapit->next(iter) ) pc->disguise(pl_sd, mob_id); mapit->free(iter); - + clif->message(fd, msg_txt(122)); // Disguise applied. return true; } @@ -4678,15 +4670,15 @@ ACMD(disguiseguild) char monster[NAME_LENGTH], guild_name[NAME_LENGTH]; struct map_session_data *pl_sd; struct guild *g; - + memset(monster, '\0', sizeof(monster)); memset(guild_name, '\0', sizeof(guild_name)); - + if( !message || !*message || sscanf(message, "%23[^,], %23[^\r\n]", monster, guild_name) < 2 ) { clif->message(fd, msg_txt(1146)); // Please enter a mob name/ID and guild name/ID (usage: @disguiseguild <mob name/ID>, <guild name/ID>). return false; } - + if( (id = atoi(monster)) > 0 ) { if( !mob->db_checkid(id) && !npcdb_checkid(id) ) id = 0; @@ -4697,21 +4689,21 @@ ACMD(disguiseguild) id = nd->class_; } } - + if( id == 0 ) { - clif->message(fd, msg_txt(123)); // Monster/NPC name/id hasn't been found. + clif->message(fd, msg_txt(123)); // Monster/NPC name/id hasn't been found. return false; } - + if( (g = guild->searchname(guild_name)) == NULL && (g = guild->search(atoi(guild_name))) == NULL ) { clif->message(fd, msg_txt(94)); // Incorrect name/ID, or no one from the guild is online. return false; } - + for (i = 0; i < g->max_member; i++) if ((pl_sd = g->member[i].sd) && !pc_hasmount(pl_sd)) pc->disguise(pl_sd, id); - + clif->message(fd, msg_txt(122)); // Disguise applied. return true; } @@ -4729,7 +4721,7 @@ ACMD(undisguise) clif->message(fd, msg_txt(125)); // You're not disguised. return false; } - + return true; } @@ -4739,15 +4731,15 @@ ACMD(undisguise) ACMD(undisguiseall) { struct map_session_data *pl_sd; struct s_mapiterator* iter; - + iter = mapit_getallusers(); for( pl_sd = (TBL_PC*)mapit->first(iter); mapit->exists(iter); pl_sd = (TBL_PC*)mapit->next(iter) ) if( pl_sd->disguise != -1 ) pc->disguise(pl_sd, -1); mapit->free(iter); - + clif->message(fd, msg_txt(124)); // Disguise removed. - + return true; } @@ -4760,25 +4752,25 @@ ACMD(undisguiseguild) struct map_session_data *pl_sd; struct guild *g; int i; - + memset(guild_name, '\0', sizeof(guild_name)); - + if(!message || !*message || sscanf(message, "%23[^\n]", guild_name) < 1) { clif->message(fd, msg_txt(1147)); // Please enter guild name/ID (usage: @undisguiseguild <guild name/ID>). return false; } - + if( (g = guild->searchname(guild_name)) == NULL && (g = guild->search(atoi(message))) == NULL ) { clif->message(fd, msg_txt(94)); // Incorrect name/ID, or no one from the guild is online. return false; } - + for(i = 0; i < g->max_member; i++) if( (pl_sd = g->member[i].sd) && pl_sd->disguise != -1 ) pc->disguise(pl_sd, -1); - + clif->message(fd, msg_txt(124)); // Disguise removed. - + return true; } @@ -4791,15 +4783,15 @@ ACMD(exp) double nextb, nextj; memset(output, '\0', sizeof(output)); - + nextb = pc->nextbaseexp(sd); if (nextb) nextb = sd->status.base_exp*100.0/nextb; - + nextj = pc->nextjobexp(sd); if (nextj) nextj = sd->status.job_exp*100.0/nextj; - + sprintf(output, msg_txt(1148), sd->status.base_level, nextb, sd->status.job_level, nextj); // Base Level: %d (%.3f%%) | Job Level: %d (%.3f%%) clif->message(fd, output); return true; @@ -4811,17 +4803,16 @@ ACMD(exp) *------------------------------------------*/ ACMD(broadcast) { - memset(atcmd_output, '\0', sizeof(atcmd_output)); - + if (!message || !*message) { clif->message(fd, msg_txt(1149)); // Please enter a message (usage: @broadcast <message>). return false; } - + sprintf(atcmd_output, "%s: %s", sd->status.name, message); intif->broadcast(atcmd_output, strlen(atcmd_output) + 1, BC_DEFAULT); - + return true; } @@ -4831,16 +4822,16 @@ ACMD(broadcast) ACMD(localbroadcast) { memset(atcmd_output, '\0', sizeof(atcmd_output)); - + if (!message || !*message) { clif->message(fd, msg_txt(1150)); // Please enter a message (usage: @localbroadcast <message>). return false; } - + sprintf(atcmd_output, "%s: %s", sd->status.name, message); - + clif->broadcast(&sd->bl, atcmd_output, strlen(atcmd_output) + 1, BC_DEFAULT, ALL_SAMEMAP); - + return true; } @@ -4851,15 +4842,15 @@ ACMD(email) { char actual_email[100]; char new_email[100]; - + memset(actual_email, '\0', sizeof(actual_email)); memset(new_email, '\0', sizeof(new_email)); - + if (!message || !*message || sscanf(message, "%99s %99s", actual_email, new_email) < 2) { clif->message(fd, msg_txt(1151)); // Please enter two e-mail addresses (usage: @email <current@email> <new@email>). return false; } - + if (e_mail_check(actual_email) == 0) { clif->message(fd, msg_txt(144)); // Invalid e-mail. If your email hasn't been set, use a@a.com. return false; @@ -4873,7 +4864,7 @@ ACMD(email) clif->message(fd, msg_txt(147)); // New e-mail must be different from the current e-mail address. return false; } - + chrif->changeemail(sd->status.account_id, actual_email, new_email); clif->message(fd, msg_txt(148)); // Information sended to login-server via char-server. return true; @@ -4885,12 +4876,12 @@ ACMD(email) ACMD(effect) { int type = 0, flag = 0; - + if (!message || !*message || sscanf(message, "%d", &type) < 1) { clif->message(fd, msg_txt(1152)); // Please enter an effect number (usage: @effect <effect number>). return false; } - + clif->specialeffect(&sd->bl, type, (send_target)flag); clif->message(fd, msg_txt(229)); // Your effect has changed. return true; @@ -4903,7 +4894,7 @@ ACMD(effect) ACMD(killer) { sd->state.killer = !sd->state.killer; - + if(sd->state.killer) clif->message(fd, msg_txt(241)); else { @@ -4919,7 +4910,7 @@ ACMD(killer) *------------------------------------------*/ ACMD(killable) { sd->state.killable = !sd->state.killable; - + if(sd->state.killable) clif->message(fd, msg_txt(242)); else { @@ -4958,29 +4949,29 @@ ACMD(npcmove) { struct npc_data *nd = 0; memset(atcmd_player_name, '\0', sizeof atcmd_player_name); - + if (!message || !*message || sscanf(message, "%d %d %23[^\n]", &x, &y, atcmd_player_name) < 3) { clif->message(fd, msg_txt(1153)); // Usage: @npcmove <X> <Y> <npc_name> return false; } - + if ((nd = npc->name2id(atcmd_player_name)) == NULL) { clif->message(fd, msg_txt(111)); // This NPC doesn't exist. return false; } - + if ((m=nd->bl.m) < 0 || nd->bl.prev == NULL) { clif->message(fd, msg_txt(1154)); // NPC is not in this map. - return false; //Not on a map. + return false; //Not on a map. } - + x = cap_value(x, 0, map->list[m].xs-1); y = cap_value(y, 0, map->list[m].ys-1); map->foreachinrange(clif->outsight, &nd->bl, AREA_SIZE, BL_PC, &nd->bl); map->moveblock(&nd->bl, x, y, timer->gettick()); map->foreachinrange(clif->insight, &nd->bl, AREA_SIZE, BL_PC, &nd->bl); clif->message(fd, msg_txt(1155)); // NPC moved. - + return true; } @@ -4994,14 +4985,14 @@ ACMD(addwarp) int x,y; unsigned short m; struct npc_data* nd; - + memset(warpname, '\0', sizeof(warpname)); - + if (!message || !*message || sscanf(message, "%31s %d %d %23[^\n]", mapname, &x, &y, warpname) < 4) { clif->message(fd, msg_txt(1156)); // Usage: @addwarp <mapname> <X> <Y> <npc name> return false; } - + m = mapindex->name2id(mapname); if( m == 0 ) { @@ -5009,11 +5000,11 @@ ACMD(addwarp) clif->message(fd, atcmd_output); return false; } - + nd = npc->add_warp(warpname, sd->bl.m, sd->bl.x, sd->bl.y, 2, 2, m, x, y); if( nd == NULL ) return false; - + sprintf(atcmd_output, msg_txt(1158), nd->exname); // New warp NPC '%s' created. clif->message(fd, atcmd_output); return true; @@ -5025,22 +5016,21 @@ ACMD(addwarp) *------------------------------------------*/ ACMD(follow) { struct map_session_data *pl_sd = NULL; - + if (!message || !*message) { if (sd->followtarget == -1) return false; - pc->stop_following (sd); clif->message(fd, msg_txt(1159)); // Follow mode OFF. return true; } - + if ( (pl_sd = map->nick2sd((char *)message)) == NULL ) { clif->message(fd, msg_txt(3)); // Character not found. return false; } - + if (sd->followtarget == pl_sd->bl.id) { pc->stop_following (sd); clif->message(fd, msg_txt(1159)); // Follow mode OFF. @@ -5048,7 +5038,7 @@ ACMD(follow) { pc->follow(sd, pl_sd->bl.id); clif->message(fd, msg_txt(1160)); // Follow mode ON. } - + return true; } @@ -5078,15 +5068,15 @@ ACMD(dropall) ACMD(storeall) { int i; - - if (sd->state.storage_flag != 1) - { //Open storage. + + if (sd->state.storage_flag != 1) { + //Open storage. if( storage->open(sd) == 1 ) { clif->message(fd, msg_txt(1161)); // You currently cannot open your storage. return false; } } - + for (i = 0; i < MAX_INVENTORY; i++) { if (sd->status.inventory[i].amount) { if(sd->status.inventory[i].equip != 0) @@ -5095,7 +5085,7 @@ ACMD(storeall) } } storage->close(sd); - + clif->message(fd, msg_txt(1162)); // All items stored. return true; } @@ -5103,18 +5093,18 @@ ACMD(storeall) ACMD(clearstorage) { int i, j; - + if (sd->state.storage_flag == 1) { clif->message(fd, msg_txt(250)); return false; } - + j = sd->status.storage.storage_amount; for (i = 0; i < j; ++i) { storage->delitem(sd, i, sd->status.storage.items[i].amount); } storage->close(sd); - + clif->message(fd, msg_txt(1394)); // Your storage was cleaned. return true; } @@ -5124,29 +5114,29 @@ ACMD(cleargstorage) int i, j; struct guild *g; struct guild_storage *guild_storage; - + g = sd->guild; - + if (g == NULL) { clif->message(fd, msg_txt(43)); return false; } - + if (sd->state.storage_flag == 1) { clif->message(fd, msg_txt(250)); return false; } - + if (sd->state.storage_flag == 2) { clif->message(fd, msg_txt(251)); return false; } - + guild_storage = idb_get(gstorage->db,sd->status.guild_id); if (guild_storage == NULL) {// Doesn't have opened @gstorage yet, so we skip the deletion since *shouldn't* have any item there. return false; } - + j = guild_storage->storage_amount; guild_storage->lock = 1; // Lock @gstorage: do not allow any item to be retrieved or stored from any guild member for (i = 0; i < j; ++i) { @@ -5154,7 +5144,7 @@ ACMD(cleargstorage) } gstorage->close(sd); guild_storage->lock = 0; // Cleaning done, release lock - + clif->message(fd, msg_txt(1395)); // Your guild storage was cleaned. return true; } @@ -5162,24 +5152,24 @@ ACMD(cleargstorage) ACMD(clearcart) { int i; - + if (pc_iscarton(sd) == 0) { clif->message(fd, msg_txt(1396)); // You do not have a cart to be cleaned. return false; } - + if( sd->state.vending == 1 ) { clif->message(fd, msg_txt(548)); // You can't clean a cart while vending! - return false; - } - + return false; + } + for( i = 0; i < MAX_CART; i++ ) if(sd->status.cart[i].nameid > 0) pc->cart_delitem(sd, i, sd->status.cart[i].amount, 1, LOG_TYPE_OTHER); - + clif->clearcart(fd); clif->updatestatus(sd,SP_CARTINFO); - + clif->message(fd, msg_txt(1397)); // Your cart was cleaned. return true; } @@ -5197,16 +5187,16 @@ ACMD(skillid) { DBKey key; DBData *data; char partials[MAX_SKILLID_PARTIAL_RESULTS][MAX_SKILLID_PARTIAL_RESULTS_LEN]; - + if (!message || !*message) { clif->message(fd, msg_txt(1163)); // Please enter a skill name to look up (usage: @skillid <skill name>). return false; } - + skillen = strlen(message); - + iter = db_iterator(skill->name2id_db); - + for( data = iter->first(iter,&key); iter->exists(iter); data = iter->next(iter,&key) ) { idx = skill->get_index(DB->data2i(data)); if (strnicmp(key.str, message, skillen) == 0 || strnicmp(skill->db[idx].desc, message, skillen) == 0) { @@ -5216,18 +5206,18 @@ ACMD(skillid) { snprintf(partials[found++], MAX_SKILLID_PARTIAL_RESULTS_LEN, msg_txt(1164), DB->data2i(data), skill->db[idx].desc, key.str); } } - + dbi_destroy(iter); - + if( found ) { sprintf(atcmd_output, msg_txt(1398), found); // -- Displaying first %d partial matches clif->message(fd, atcmd_output); } - + for(i = 0; i < found; i++) { /* partials */ clif->message(fd, partials[i]); } - + return true; } @@ -5241,38 +5231,38 @@ ACMD(useskill) { uint16 skill_id; uint16 skill_lv; char target[100]; - + if(!message || !*message || sscanf(message, "%hu %hu %23[^\n]", &skill_id, &skill_lv, target) != 3) { clif->message(fd, msg_txt(1165)); // Usage: @useskill <skill ID> <skill level> <target> return false; } - + if(!strcmp(target,"self")) pl_sd = sd; //quick keyword else if ( (pl_sd = map->nick2sd(target)) == NULL ) { clif->message(fd, msg_txt(3)); // Character not found. return false; } - + if ( pc_get_group_level(sd) < pc_get_group_level(pl_sd) ) { clif->message(fd, msg_txt(81)); // Your GM level don't authorized you to do this action on this player. return false; } - + if (skill_id >= HM_SKILLBASE && skill_id < HM_SKILLBASE+MAX_HOMUNSKILL && sd->hd && homun_alive(sd->hd)) // (If used with @useskill, put the homunc as dest) bl = &sd->hd->bl; else bl = &sd->bl; - + pc->delinvincibletimer(sd); - + if (skill->get_inf(skill_id)&INF_GROUND_SKILL) unit->skilluse_pos(bl, pl_sd->bl.x, pl_sd->bl.y, skill_id, skill_lv); else unit->skilluse_id(bl, pl_sd->bl.id, skill_id, skill_lv); - + return true; } @@ -5286,7 +5276,7 @@ ACMD(displayskill) { int64 tick; uint16 skill_id; uint16 skill_lv = 1; - + if (!message || !*message || sscanf(message, "%hu %hu", &skill_id, &skill_lv) < 1) { clif->message(fd, msg_txt(1166)); // Usage: @displayskill <skill ID> {<skill level>} return false; @@ -5309,32 +5299,32 @@ ACMD(skilltree) { int meets, j, c=0; char target[NAME_LENGTH]; struct skill_tree_entry *ent; - + if(!message || !*message || sscanf(message, "%hu %23[^\r\n]", &skill_id, target) != 2) { clif->message(fd, msg_txt(1167)); // Usage: @skilltree <skill ID> <target> return false; } - + if ( (pl_sd = map->nick2sd(target)) == NULL ) { clif->message(fd, msg_txt(3)); // Character not found. return false; } - + c = pc->calc_skilltree_normalize_job(pl_sd); c = pc->mapid2jobid(c, pl_sd->status.sex); - + sprintf(atcmd_output, msg_txt(1168), pc->job_name(c), pc->checkskill(pl_sd, NV_BASIC)); // Player is using %s skill tree (%d basic points). clif->message(fd, atcmd_output); - + ARR_FIND( 0, MAX_SKILL_TREE, j, pc->skill_tree[c][j].id == 0 || pc->skill_tree[c][j].id == skill_id ); if( j == MAX_SKILL_TREE || pc->skill_tree[c][j].id == 0 ) { clif->message(fd, msg_txt(1169)); // The player cannot use that skill. return false; } - + ent = &pc->skill_tree[c][j]; - + meets = 1; for(j=0;j<MAX_PC_SKILL_REQUIRE;j++) { @@ -5348,7 +5338,7 @@ ACMD(skilltree) { if (meets == 1) { clif->message(fd, msg_txt(1171)); // The player meets all the requirements for that skill. } - + return true; } @@ -5357,14 +5347,14 @@ void getring(struct map_session_data* sd) { int flag, item_id; struct item item_tmp; item_id = (sd->status.sex) ? WEDDING_RING_M : WEDDING_RING_F; - + memset(&item_tmp, 0, sizeof(item_tmp)); item_tmp.nameid = item_id; item_tmp.identify = 1; item_tmp.card[0] = 255; item_tmp.card[2] = sd->status.partner_id; item_tmp.card[3] = sd->status.partner_id >> 16; - + if((flag = pc->additem(sd,&item_tmp,1,LOG_TYPE_COMMAND))) { clif->additem(sd,0,0,flag); map->addflooritem(&item_tmp,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0); @@ -5378,17 +5368,17 @@ void getring(struct map_session_data* sd) { ACMD(marry) { struct map_session_data *pl_sd = NULL; char player_name[NAME_LENGTH] = ""; - + if (!message || !*message || sscanf(message, "%23s", player_name) != 1) { clif->message(fd, msg_txt(1172)); // Usage: @marry <char name> return false; } - + if ((pl_sd = map->nick2sd(player_name)) == NULL) { clif->message(fd, msg_txt(3)); return false; } - + if (pc->marriage(sd, pl_sd) == 0) { clif->message(fd, msg_txt(1173)); // They are married... wish them well. clif->wedding_effect(&pl_sd->bl); //wedding effect and music [Lupus] @@ -5396,7 +5386,7 @@ ACMD(marry) { getring(pl_sd); return true; } - + clif->message(fd, msg_txt(1174)); // The two cannot wed because one is either a baby or already married. return false; } @@ -5412,7 +5402,7 @@ ACMD(divorce) clif->message(fd, atcmd_output); return false; } - + sprintf(atcmd_output, msg_txt(1176), sd->status.name); // '%s' and his/her partner are now divorced. clif->message(fd, atcmd_output); return true; @@ -5425,7 +5415,7 @@ ACMD(changelook) { int i, j = 0, k = 0; int pos[7] = { LOOK_HEAD_TOP,LOOK_HEAD_MID,LOOK_HEAD_BOTTOM,LOOK_WEAPON,LOOK_SHIELD,LOOK_SHOES,LOOK_ROBE }; - + if((i = sscanf(message, "%d %d", &j, &k)) < 1) { clif->message(fd, msg_txt(1177)); // Usage: @changelook {<position>} <view id> clif->message(fd, msg_txt(1178)); // Position: 1-Top 2-Middle 3-Bottom 4-Weapon 5-Shield 6-Shoes 7-Robe @@ -5434,13 +5424,13 @@ ACMD(changelook) if (j < 1 || j > 7) j = 1; j = pos[j - 1]; - } else if( i == 1 ) { // position not defined, use HEAD_TOP as default - k = j; // swap + } else if( i == 1 ) { // position not defined, use HEAD_TOP as default + k = j; // swap j = LOOK_HEAD_TOP; } - + clif->changelook(&sd->bl,j,k); - + return true; } @@ -5448,23 +5438,23 @@ ACMD(changelook) * @autotrade by durf [Lupus] [Paradox924X] * Turns on/off Autotrade for a specific player *------------------------------------------*/ -ACMD(autotrade) { - +ACMD(autotrade) +{ if( map->list[sd->bl.m].flag.autotrade != battle_config.autotrade_mapflag ) { clif->message(fd, msg_txt(1179)); // Autotrade is not allowed in this map. return false; } - + if( pc_isdead(sd) ) { clif->message(fd, msg_txt(1180)); // You cannot autotrade when dead. return false; } - + if( !sd->state.vending && !sd->state.buyingstore ) { //check if player is vending or buying clif->message(fd, msg_txt(549)); // "You should have a shop open in order to use @autotrade." return false; } - + sd->state.autotrade = 1; if( battle_config.at_timeout ) { int timeout = atoi(message); @@ -5473,17 +5463,17 @@ ACMD(autotrade) { } clif->chsys_quit(sd); - + clif->authfail_fd(sd->fd, 15); /* currently standalone is not supporting buyingstores, so we rely on the previous method */ if( sd->state.buyingstore ) return true; - + #ifdef AUTOTRADE_PERSISTENCY sd->state.autotrade = 2;/** state will enter pre-save, we use it to rule out some criterias **/ pc->autotrade_prepare(sd); - + return false;/* we fail to not cause it to proceed on is_atcommand */ #else return true; @@ -5497,27 +5487,27 @@ ACMD(autotrade) { ACMD(changegm) { struct guild *g; struct map_session_data *pl_sd; - + if (sd->status.guild_id == 0 || (g = sd->guild) == NULL || strcmp(g->master,sd->status.name)) { clif->message(fd, msg_txt(1181)); // You need to be a Guild Master to use this command. return false; } - + if( map->list[sd->bl.m].flag.guildlock || map->list[sd->bl.m].flag.gvg_castle ) { clif->message(fd, msg_txt(1182)); // You cannot change guild leaders in this map. return false; } - + if( !message[0] ) { clif->message(fd, msg_txt(1183)); // Usage: @changegm <guild_member_name> return false; } - + if((pl_sd=map->nick2sd((char *) message)) == NULL || pl_sd->status.guild_id != sd->status.guild_id) { clif->message(fd, msg_txt(1184)); // Target character must be online and be a guild member. return false; } - + guild->gm_change(sd->status.guild_id, pl_sd); return true; } @@ -5527,12 +5517,12 @@ ACMD(changegm) { * Changes the leader of a party. *------------------------------------------*/ ACMD(changeleader) { - + if( !message[0] ) { clif->message(fd, msg_txt(1185)); // Usage: @changeleader <party_member_name> return false; } - + if (party->changeleader(sd, map->nick2sd((char *) message))) return true; return false; @@ -5547,37 +5537,37 @@ ACMD(partyoption) struct party_data *p; int mi, option; char w1[16], w2[16]; - + if (sd->status.party_id == 0 || (p = party->search(sd->status.party_id)) == NULL) { clif->message(fd, msg_txt(282)); return false; } - + ARR_FIND( 0, MAX_PARTY, mi, p->data[mi].sd == sd ); if (mi == MAX_PARTY) return false; //Shouldn't happen - + if (!p->party.member[mi].leader) { clif->message(fd, msg_txt(282)); return false; } - + if(!message || !*message || sscanf(message, "%15s %15s", w1, w2) < 2) { clif->message(fd, msg_txt(1186)); // Usage: @partyoption <pickup share: yes/no> <item distribution: yes/no> return false; } - + option = (config_switch(w1)?1:0)|(config_switch(w2)?2:0); - + //Change item share type. if (option != p->party.item) party->changeoption(sd, p->party.exp, option); else clif->message(fd, msg_txt(286)); - + return true; } @@ -5603,14 +5593,14 @@ ACMD(autoloot) } if (rate < 0) rate = 0; if (rate > 10000) rate = 10000; - + sd->state.autoloot = rate; if (sd->state.autoloot) { snprintf(atcmd_output, sizeof atcmd_output, msg_txt(1187),((double)sd->state.autoloot)/100.); // Autolooting items with drop rates of %0.02f%% and below. clif->message(fd, atcmd_output); }else clif->message(fd, msg_txt(1188)); // Autoloot is now off. - + return true; } @@ -5622,7 +5612,7 @@ ACMD(autolootitem) struct item_data *item_data = NULL; int i; int action = 3; // 1=add, 2=remove, 3=help+list (default), 4=reset - + if (message && *message) { if (message[0] == '+') { message++; @@ -5646,7 +5636,7 @@ ACMD(autolootitem) } } } - + switch(action) { case 1: ARR_FIND(0, AUTOLOOTITEM_SIZE, i, sd->state.autolootid[i] == item_data->nameid); @@ -5810,8 +5800,8 @@ ACMD(autoloottype) { /*========================================== * It is made to snow. *------------------------------------------*/ -ACMD(snow) { - +ACMD(snow) +{ if (map->list[sd->bl.m].flag.snow) { map->list[sd->bl.m].flag.snow=0; clif->weather(sd->bl.m); @@ -5821,7 +5811,7 @@ ACMD(snow) { clif->weather(sd->bl.m); clif->message(fd, msg_txt(1204)); // It has started to snow. } - + return true; } @@ -5856,7 +5846,7 @@ ACMD(clouds) { clif->weather(sd->bl.m); clif->message(fd, msg_txt(1208)); // Clouds appear. } - + return true; } @@ -5874,7 +5864,7 @@ ACMD(clouds2) { clif->weather(sd->bl.m); clif->message(fd, msg_txt(1210)); // Alternative clouds appear. } - + return true; } @@ -5909,7 +5899,7 @@ ACMD(leaves) { clif->weather(sd->bl.m); clif->message(fd, msg_txt(1214)); // Fallen leaves fall. } - + return true; } @@ -5927,15 +5917,15 @@ ACMD(fireworks) { clif->weather(sd->bl.m); clif->message(fd, msg_txt(1216)); // Fireworks have launched. } - + return true; } /*========================================== * Clearing Weather Effects by Dexity *------------------------------------------*/ -ACMD(clearweather) { - +ACMD(clearweather) +{ map->list[sd->bl.m].flag.snow=0; map->list[sd->bl.m].flag.sakura=0; map->list[sd->bl.m].flag.clouds=0; @@ -5945,7 +5935,7 @@ ACMD(clearweather) { map->list[sd->bl.m].flag.leaves=0; clif->weather(sd->bl.m); clif->message(fd, msg_txt(291)); // "Weather effects will disappear after teleporting or refreshing." - + return true; } @@ -5955,24 +5945,24 @@ ACMD(clearweather) { ACMD(sound) { char sound_file[100]; - + memset(sound_file, '\0', sizeof(sound_file)); - + if(!message || !*message || sscanf(message, "%99[^\n]", sound_file) < 1) { clif->message(fd, msg_txt(1217)); // Please enter a sound filename (usage: @sound <filename>). return false; } - + if(strstr(sound_file, ".wav") == NULL) strcat(sound_file, ".wav"); - + clif->soundeffectall(&sd->bl, sound_file, 0, AREA); - + return true; } /*========================================== - * MOB Search + * MOB Search *------------------------------------------*/ ACMD(mobsearch) { @@ -5980,12 +5970,12 @@ ACMD(mobsearch) int mob_id; int number = 0; struct s_mapiterator* it; - + if (!message || !*message || sscanf(message, "%99[^\n]", mob_name) < 1) { clif->message(fd, msg_txt(1218)); // Please enter a monster name (usage: @mobsearch <monster name>). return false; } - + if ((mob_id = atoi(mob_name)) == 0) mob_id = mob->db_searchname(mob_name); if(mob_id > 0 && mob->db_checkid(mob_id) == 0){ @@ -5994,24 +5984,24 @@ ACMD(mobsearch) return false; } if(mob_id == atoi(mob_name) && mob->db(mob_id)->jname) - strcpy(mob_name,mob->db(mob_id)->jname); // --ja-- - // strcpy(mob_name,mob_db(mob_id)->name); // --en-- - + strcpy(mob_name,mob->db(mob_id)->jname); // --ja-- + //strcpy(mob_name,mob_db(mob_id)->name); // --en-- + snprintf(atcmd_output, sizeof atcmd_output, msg_txt(1220), mob_name, mapindex_id2name(sd->mapindex)); // Mob Search... %s %s clif->message(fd, atcmd_output); - + it = mapit_geteachmob(); for(;;) { TBL_MOB* md = (TBL_MOB*)mapit->next(it); if( md == NULL ) break;// no more mobs - + if( md->bl.m != sd->bl.m ) continue; if( mob_id != -1 && md->class_ != mob_id ) continue; - + ++number; if( md->spawn_timer == INVALID_TIMER ) snprintf(atcmd_output, sizeof(atcmd_output), "%2d[%3d:%3d] %s", number, md->bl.x, md->bl.y, md->name); @@ -6020,7 +6010,7 @@ ACMD(mobsearch) clif->message(fd, atcmd_output); } mapit->free(it); - + return true; } @@ -6031,7 +6021,7 @@ ACMD(mobsearch) int atcommand_cleanfloor_sub(struct block_list *bl, va_list ap) { nullpo_ret(bl); map->clearflooritem(bl); - + return 0; } @@ -6043,7 +6033,7 @@ ACMD(cleanmap) { ACMD(cleanarea) { int x0 = 0, y0 = 0, x1 = 0, y1 = 0; - + if (!message || !*message || sscanf(message, "%d %d %d %d", &x0, &y0, &x1, &y1) < 1) { map->foreachinrange(atcommand->cleanfloor_sub, &sd->bl, AREA_SIZE * 2, BL_ITEM); } else if (sscanf(message, "%d %d %d %d", &x0, &y0, &x1, &y1) == 1) { @@ -6051,7 +6041,7 @@ ACMD(cleanarea) { } else if (sscanf(message, "%d %d %d %d", &x0, &y0, &x1, &y1) == 4) { map->foreachinarea(atcommand->cleanfloor_sub, sd->bl.m, x0, y0, x1, y1, BL_ITEM); } - + clif->message(fd, msg_txt(1221)); // All dropped items have been cleaned up. return true; } @@ -6066,12 +6056,12 @@ ACMD(npctalk) struct npc_data *nd; bool ifcolor=(*(info->command + 7) != 'c' && *(info->command + 7) != 'C')?0:1; unsigned int color = 0; - + if (sd->sc.count && //no "chatting" while muted. (sd->sc.data[SC_BERSERK] || (sd->sc.data[SC_DEEP_SLEEP] && sd->sc.data[SC_DEEP_SLEEP]->val2) || (sd->sc.data[SC_NOCHAT] && sd->sc.data[SC_NOCHAT]->val1&MANNER_NOCHAT))) return false; - + if(!ifcolor) { if (!message || !*message || sscanf(message, "%23[^,], %99[^\n]", name, mes) < 2) { clif->message(fd, msg_txt(1222)); // Please enter the correct parameters (usage: @npctalk <npc name>, <message>). @@ -6084,18 +6074,18 @@ ACMD(npctalk) return false; } } - + if (!(nd = npc->name2id(name))) { clif->message(fd, msg_txt(111)); // This NPC doesn't exist return false; } - + strtok(name, "#"); // discard extra name identifier if present snprintf(temp, sizeof(temp), "%s : %s", name, mes); - + if(ifcolor) clif->messagecolor(&nd->bl,color,temp); else clif->disp_overhead(&nd->bl, temp); - + return true; } @@ -6103,29 +6093,29 @@ ACMD(pettalk) { char mes[100],temp[100]; struct pet_data *pd; - + if ( battle_config.min_chat_delay ) { if( DIFF_TICK(sd->cantalk_tick, timer->gettick()) > 0 ) return true; sd->cantalk_tick = timer->gettick() + battle_config.min_chat_delay; } - + if(!sd->status.pet_id || !(pd=sd->pd)) { clif->message(fd, msg_txt(184)); return false; } - + if (sd->sc.count && //no "chatting" while muted. (sd->sc.data[SC_BERSERK] || (sd->sc.data[SC_DEEP_SLEEP] && sd->sc.data[SC_DEEP_SLEEP]->val2) || (sd->sc.data[SC_NOCHAT] && sd->sc.data[SC_NOCHAT]->val1&MANNER_NOCHAT))) return false; - + if (!message || !*message || sscanf(message, "%99[^\n]", mes) < 1) { clif->message(fd, msg_txt(1224)); // Please enter a message (usage: @pettalk <message>). return false; } - + if (message[0] == '/') {// pet emotion processing const char* emo[] = { @@ -6149,15 +6139,15 @@ ACMD(pettalk) return true; } sd->emotionlasttime = time(NULL); - + clif->emotion(&pd->bl, i); return true; } } - + snprintf(temp, sizeof temp ,"%s : %s", pd->pet.name, mes); clif->disp_overhead(&pd->bl, temp); - + return true; } @@ -6170,10 +6160,10 @@ ACMD(users) int users[MAX_MAPINDEX]; int users_all; struct s_mapiterator* iter; - + memset(users, 0, sizeof(users)); users_all = 0; - + // count users on each map iter = mapit_getallusers(); for(;;) @@ -6181,29 +6171,29 @@ ACMD(users) struct map_session_data* sd2 = (struct map_session_data*)mapit->next(iter); if( sd2 == NULL ) break;// no more users - + if( sd2->mapindex >= MAX_MAPINDEX ) continue;// invalid mapindex - + if( users[sd2->mapindex] < INT_MAX ) ++users[sd2->mapindex]; if( users_all < INT_MAX ) ++users_all; } mapit->free(iter); - + // display results for each map for( i = 0; i < MAX_MAPINDEX; ++i ) { if( users[i] == 0 ) continue;// empty - + safesnprintf(buf, sizeof(buf), "%s: %d (%.2f%%)", mapindex_id2name(i), users[i], (float)(100.0f*users[i]/users_all)); clif->message(sd->fd, buf); } - + // display overall count safesnprintf(buf, sizeof(buf), "all: %d", users_all); clif->message(sd->fd, buf); - + return true; } @@ -6229,31 +6219,31 @@ ACMD(summon) int duration = 0; struct mob_data *md; int64 tick=timer->gettick(); - + if (!message || !*message || sscanf(message, "%23s %d", name, &duration) < 1) { clif->message(fd, msg_txt(1225)); // Please enter a monster name (usage: @summon <monster name> {duration}). return false; } - + if (duration < 1) duration =1; else if (duration > 60) duration =60; - + if ((mob_id = atoi(name)) == 0) mob_id = mob->db_searchname(name); if(mob_id == 0 || mob->db_checkid(mob_id) == 0) { - clif->message(fd, msg_txt(40)); // Invalid monster ID or name. + clif->message(fd, msg_txt(40)); // Invalid monster ID or name. return false; } - + md = mob->once_spawn_sub(&sd->bl, sd->bl.m, -1, -1, "--ja--", mob_id, "", SZ_SMALL, AI_NONE); - + if(!md) return false; - + md->master_id=sd->bl.id; md->special_state.ai=1; md->deletetimer=timer->add(tick+(duration*60000),mob->timer_delete,md->bl.id,0); @@ -6261,8 +6251,8 @@ ACMD(summon) mob->spawn(md); sc_start4(NULL,&md->bl, SC_MODECHANGE, 100, 1, 0, MD_AGGRESSIVE, 0, 60000); clif->skill_poseffect(&sd->bl,AM_CALLHOMUN,1,md->bl.x,md->bl.y,tick); - clif->message(fd, msg_txt(39)); // All monster summoned! - + clif->message(fd, msg_txt(39)); // All monster summoned! + return true; } @@ -6274,12 +6264,12 @@ ACMD(summon) ACMD(adjgroup) { int new_group = 0; - + if (!message || !*message || sscanf(message, "%d", &new_group) != 1) { clif->message(fd, msg_txt(1226)); // Usage: @adjgroup <group_id> return false; } - + if (pc->set_group(sd, new_group) != 0) { clif->message(fd, msg_txt(1227)); // Specified group does not exist. return false; @@ -6295,18 +6285,18 @@ ACMD(adjgroup) * Open a trade window with a remote player *------------------------------------------*/ ACMD(trade) { - struct map_session_data *pl_sd = NULL; - + struct map_session_data *pl_sd = NULL; + if (!message || !*message) { clif->message(fd, msg_txt(1230)); // Please enter a player name (usage: @trade <char name>). return false; } - + if ( (pl_sd = map->nick2sd((char *)message)) == NULL ) { clif->message(fd, msg_txt(3)); // Character not found. return false; } - + trade->request(sd, pl_sd); return true; } @@ -6318,19 +6308,19 @@ ACMD(trade) { ACMD(setbattleflag) { char flag[128], value[128]; - + if (!message || !*message || sscanf(message, "%127s %127s", flag, value) != 2) { clif->message(fd, msg_txt(1231)); // Usage: @setbattleflag <flag> <value> return false; } - + if (battle->config_set_value(flag, value) == 0) { clif->message(fd, msg_txt(1232)); // Unknown battle_config flag. return false; } - + clif->message(fd, msg_txt(1233)); // Set battle_config as requested. - + return true; } @@ -6339,27 +6329,27 @@ ACMD(setbattleflag) *------------------------------------------*/ ACMD(unmute) { struct map_session_data *pl_sd = NULL; - + if (!message || !*message) { clif->message(fd, msg_txt(1234)); // Please enter a player name (usage: @unmute <char name>). return false; } - + if ( (pl_sd = map->nick2sd((char *)message)) == NULL ) { clif->message(fd, msg_txt(3)); // Character not found. return false; } - + if(!pl_sd->sc.data[SC_NOCHAT]) { clif->message(sd->fd,msg_txt(1235)); // Player is not muted. return false; } - + pl_sd->status.manner = 0; status_change_end(&pl_sd->bl, SC_NOCHAT, INVALID_TIMER); clif->message(sd->fd,msg_txt(1236)); // Player unmuted. - + return true; } @@ -6370,7 +6360,7 @@ ACMD(uptime) { unsigned long seconds = 0, day = 24*60*60, hour = 60*60, minute = 60, days = 0, hours = 0, minutes = 0; - + seconds = timer->get_uptime(); days = seconds/day; seconds -= (seconds/day>0)?(seconds/day)*day:0; @@ -6378,10 +6368,10 @@ ACMD(uptime) seconds -= (seconds/hour>0)?(seconds/hour)*hour:0; minutes = seconds/minute; seconds -= (seconds/minute>0)?(seconds/minute)*minute:0; - + snprintf(atcmd_output, sizeof(atcmd_output), msg_txt(245), days, hours, minutes, seconds); clif->message(fd, atcmd_output); - + return true; } @@ -6407,26 +6397,26 @@ ACMD(changesex) ACMD(mute) { struct map_session_data *pl_sd = NULL; int manner; - + if (!message || !*message || sscanf(message, "%d %23[^\n]", &manner, atcmd_player_name) < 1) { clif->message(fd, msg_txt(1237)); // Usage: @mute <time> <char name> return false; } - + if ( (pl_sd = map->nick2sd(atcmd_player_name)) == NULL ) { clif->message(fd, msg_txt(3)); // Character not found. return false; } - + if ( pc_get_group_level(sd) < pc_get_group_level(pl_sd) ) { clif->message(fd, msg_txt(81)); // Your GM level don't authorize you to do this action on this player. return false; } - + clif->manner_message(sd, 0); clif->manner_message(pl_sd, 5); - + if( pl_sd->status.manner < manner ) { pl_sd->status.manner -= manner; sc_start(NULL,&pl_sd->bl,SC_NOCHAT,100,0,0); @@ -6434,9 +6424,9 @@ ACMD(mute) { pl_sd->status.manner = 0; status_change_end(&pl_sd->bl, SC_NOCHAT, INVALID_TIMER); } - + clif->GM_silence(sd, pl_sd, (manner > 0 ? 1 : 0)); - + return true; } @@ -6453,7 +6443,7 @@ ACMD(refreshall) { struct map_session_data* iter_sd; struct s_mapiterator* iter; - + iter = mapit_getallusers(); for (iter_sd = (TBL_PC*)mapit->first(iter); mapit->exists(iter); iter_sd = (TBL_PC*)mapit->next(iter)) clif->refresh(iter_sd); @@ -6468,7 +6458,7 @@ ACMD(refreshall) ACMD(identify) { int i,num; - + for(i=num=0;i<MAX_INVENTORY;i++){ if(sd->status.inventory[i].nameid > 0 && sd->status.inventory[i].identify!=1){ num++; @@ -6490,7 +6480,7 @@ ACMD(misceffect) { if (sscanf(message, "%d", &effect) < 1) return false; clif->misceffect(&sd->bl,effect); - + return true; } @@ -6517,103 +6507,103 @@ ACMD(mobinfo) struct mob_db *monster, *mob_array[MAX_SEARCH]; int count; int i, j, k; - + memset(atcmd_output, '\0', sizeof(atcmd_output)); memset(atcmd_output2, '\0', sizeof(atcmd_output2)); - + if (!message || !*message) { clif->message(fd, msg_txt(1239)); // Please enter a monster name/ID (usage: @mobinfo <monster_name_or_monster_ID>). return false; } - + // If monster identifier/name argument is a name if ((i = mob->db_checkid(atoi(message)))) { mob_array[0] = mob->db(i); count = 1; } else count = mob->db_searchname_array(mob_array, MAX_SEARCH, message, 0); - + if (!count) { clif->message(fd, msg_txt(40)); // Invalid monster ID or name. return false; } - + if (count > MAX_SEARCH) { sprintf(atcmd_output, msg_txt(269), MAX_SEARCH, count); clif->message(fd, atcmd_output); count = MAX_SEARCH; } - + for (k = 0; k < count; k++) { unsigned int job_exp, base_exp; - + monster = mob_array[k]; - + job_exp = monster->job_exp; base_exp = monster->base_exp; - + #ifdef RENEWAL_EXP if( battle_config.atcommand_mobinfo_type ) { base_exp = base_exp * pc->level_penalty_mod(monster->lv - sd->status.base_level, monster->status.race, monster->status.mode, 1) / 100; job_exp = job_exp * pc->level_penalty_mod(monster->lv - sd->status.base_level, monster->status.race, monster->status.mode, 1) / 100; } #endif - + // stats if (monster->mexp) sprintf(atcmd_output, msg_txt(1240), monster->name, monster->jname, monster->sprite, monster->vd.class_); // MVP Monster: '%s'/'%s'/'%s' (%d) else sprintf(atcmd_output, msg_txt(1241), monster->name, monster->jname, monster->sprite, monster->vd.class_); // Monster: '%s'/'%s'/'%s' (%d) clif->message(fd, atcmd_output); - + sprintf(atcmd_output, msg_txt(1242), monster->lv, monster->status.max_hp, base_exp, job_exp, MOB_HIT(monster), MOB_FLEE(monster)); // Lv:%d HP:%d Base EXP:%u Job EXP:%u HIT:%d FLEE:%d clif->message(fd, atcmd_output); - + sprintf(atcmd_output, msg_txt(1243), // DEF:%d MDEF:%d STR:%d AGI:%d VIT:%d INT:%d DEX:%d LUK:%d monster->status.def, monster->status.mdef, monster->status.str, monster->status.agi, monster->status.vit, monster->status.int_, monster->status.dex, monster->status.luk); clif->message(fd, atcmd_output); - + sprintf(atcmd_output, msg_txt(1244), // ATK:%d~%d Range:%d~%d~%d Size:%s Race: %s Element: %s (Lv:%d) monster->status.rhw.atk, monster->status.rhw.atk2, monster->status.rhw.range, monster->range2 , monster->range3, msize[monster->status.size], mrace[monster->status.race], melement[monster->status.def_ele], monster->status.ele_lv); clif->message(fd, atcmd_output); - + // drops clif->message(fd, msg_txt(1245)); // Drops: strcpy(atcmd_output, " "); j = 0; for (i = 0; i < MAX_MOB_DROP; i++) { int droprate; - + if (monster->dropitem[i].nameid <= 0 || monster->dropitem[i].p < 1 || (item_data = itemdb->exists(monster->dropitem[i].nameid)) == NULL) continue; - + droprate = monster->dropitem[i].p; #ifdef RENEWAL_DROP if( battle_config.atcommand_mobinfo_type ) { droprate = droprate * pc->level_penalty_mod(monster->lv - sd->status.base_level, monster->status.race, monster->status.mode, 2) / 100; - + if (droprate <= 0 && !battle_config.drop_rate0item) droprate = 1; } #endif - + if (item_data->slot) sprintf(atcmd_output2, " - %s[%d] %02.02f%%", item_data->jname, item_data->slot, (float)droprate / 100); else sprintf(atcmd_output2, " - %s %02.02f%%", item_data->jname, (float)droprate / 100); - + strcat(atcmd_output, atcmd_output2); - + if (++j % 3 == 0) { clif->message(fd, atcmd_output); strcpy(atcmd_output, " "); } } - + if (j == 0) clif->message(fd, msg_txt(1246)); // This monster has no drops. else if (j % 3 != 0) @@ -6622,7 +6612,7 @@ ACMD(mobinfo) if (monster->mexp) { sprintf(atcmd_output, msg_txt(1247), monster->mexp); // MVP Bonus EXP:%u clif->message(fd, atcmd_output); - + strcpy(atcmd_output, msg_txt(1248)); // MVP Items: j = 0; for (i = 0; i < MAX_MVP_DROP; i++) { @@ -6656,7 +6646,7 @@ ACMD(showmobs) int mob_id; int number = 0; struct s_mapiterator* it; - + if( sscanf(message, "%99[^\n]", mob_name) < 0 ) { clif->message(fd, msg_txt(546)); // Please enter a mob name/id (usage: @showmobs <mob name/id>) return false; @@ -6676,27 +6666,28 @@ ACMD(showmobs) clif->message(fd, atcmd_output); return false; } - - if(mob->db(mob_id)->status.mode&MD_BOSS && !pc_has_permission(sd, PC_PERM_SHOW_BOSS)){ // If player group does not have access to boss mobs. + + if (mob->db(mob_id)->status.mode&MD_BOSS && !pc_has_permission(sd, PC_PERM_SHOW_BOSS)) { + // If player group does not have access to boss mobs. clif->message(fd, msg_txt(1251)); // Can't show boss mobs! return false; } - + if(mob_id == atoi(mob_name) && mob->db(mob_id)->jname) strcpy(mob_name,mob->db(mob_id)->jname); // --ja-- //strcpy(mob_name,mob_db(mob_id)->name); // --en-- - + snprintf(atcmd_output, sizeof atcmd_output, msg_txt(1252), // Mob Search... %s %s mob_name, mapindex_id2name(sd->mapindex)); clif->message(fd, atcmd_output); - + it = mapit_geteachmob(); for(;;) { TBL_MOB* md = (TBL_MOB*)mapit->next(it); if( md == NULL ) break;// no more mobs - + if( md->bl.m != sd->bl.m ) continue; if( mob_id != -1 && md->class_ != mob_id ) @@ -6705,12 +6696,12 @@ ACMD(showmobs) continue; // hide slaves and player summoned mobs if( md->spawn_timer != INVALID_TIMER ) continue; // hide mobs waiting for respawn - + ++number; clif->viewpoint(sd, 1, 0, md->bl.x, md->bl.y, number, 0xFFFFFF); } mapit->free(it); - + return true; } @@ -6721,19 +6712,19 @@ ACMD(homlevel) { TBL_HOM * hd; int level = 0; enum homun_type htype; - + if( !message || !*message || ( level = atoi(message) ) < 1 ) { clif->message(fd, msg_txt(1253)); // Please enter a level adjustment (usage: @homlevel <number of levels>). return false; } - + if( !homun_alive(sd->hd) ) { clif->message(fd, msg_txt(1254)); // You do not have a homunculus. return false; } - + hd = sd->hd; - + if( (htype = homun->class2type(hd->homunculus.class_)) == HT_INVALID ) { ShowError("atcommand_homlevel: invalid homun class %d (player %s)\n", hd->homunculus.class_,sd->status.name); return false; @@ -6759,12 +6750,11 @@ ACMD(homlevel) { ShowError("atcommand_homlevel: unknown htype '%d'\n",htype); return false; } - - + do { hd->homunculus.exp += hd->exp_next; } while( hd->homunculus.level < level && homun->levelup(hd) ); - + status_calc_homunculus(hd,SCO_NONE); status_percent_heal(&hd->bl, 100, 100); clif->specialeffect(&hd->bl,568,AREA); @@ -6780,7 +6770,7 @@ ACMD(homevolution) clif->message(fd, msg_txt(1254)); // You do not have a homunculus. return false; } - + if ( !homun->evolve(sd->hd) ) { clif->message(fd, msg_txt(1255)); // Your homunculus doesn't evolve. return false; @@ -6792,21 +6782,21 @@ ACMD(homevolution) ACMD(hommutate) { int homun_id; enum homun_type m_class, m_id; - + if( !homun_alive(sd->hd) ) { clif->message(fd, msg_txt(1254)); // You do not have a homunculus. return false; } - + if( !message || !*message ) { homun_id = 6048 + (rnd() % 4); } else { homun_id = atoi(message); } - + m_class = homun->class2type(sd->hd->homunculus.class_); - m_id = homun->class2type(homun_id); - + m_id = homun->class2type(homun_id); + if( m_class != HT_INVALID && m_id != HT_INVALID && m_class == HT_EVO && m_id == HT_S && sd->hd->homunculus.level >= 99 ) { homun->mutate(sd->hd, homun_id); } else { @@ -6820,14 +6810,14 @@ ACMD(hommutate) { *------------------------------------------*/ ACMD(makehomun) { int homunid; - + if (!message || !*message) { clif->message(fd, msg_txt(1256)); // Please enter a homunculus ID (usage: @makehomun <homunculus id>). return false; } - + homunid = atoi(message); - + if( homunid == -1 && sd->status.hom_id && !(sd->hd && homun_alive(sd->hd)) ) { if( !sd->hd ) homun->call(sd); @@ -6837,18 +6827,18 @@ ACMD(makehomun) { homun->call(sd); return true; } - + if ( sd->status.hom_id ) { clif->message(fd, msg_txt(450)); return false; } - + if( homunid < HM_CLASS_BASE || homunid > HM_CLASS_BASE + MAX_HOMUNCULUS_CLASS - 1 ) { clif->message(fd, msg_txt(1257)); // Invalid Homunculus ID. return false; } - + homun->creation_request(sd,homunid); return true; } @@ -6859,20 +6849,20 @@ ACMD(makehomun) { ACMD(homfriendly) { int friendly = 0; - + if ( !homun_alive(sd->hd) ) { clif->message(fd, msg_txt(1254)); // You do not have a homunculus. return false; } - + if (!message || !*message) { clif->message(fd, msg_txt(1258)); // Please enter a friendly value (usage: @homfriendly <friendly value [0-1000]>). return false; } - + friendly = atoi(message); friendly = cap_value(friendly, 0, 1000); - + sd->hd->homunculus.intimacy = friendly * 100 ; clif->send_homdata(sd,SP_INTIMATE,friendly); return true; @@ -6884,20 +6874,20 @@ ACMD(homfriendly) ACMD(homhungry) { int hungry = 0; - + if ( !homun_alive(sd->hd) ) { clif->message(fd, msg_txt(1254)); // You do not have a homunculus. return false; } - + if (!message || !*message) { clif->message(fd, msg_txt(1259)); // Please enter a hunger value (usage: @homhungry <hunger value [0-100]>). return false; } - + hungry = atoi(message); hungry = cap_value(hungry, 0, 100); - + sd->hd->homunculus.hunger = hungry; clif->send_homdata(sd,SP_HUNGRY,hungry); return true; @@ -6909,31 +6899,31 @@ ACMD(homhungry) ACMD(homtalk) { char mes[100],temp[100]; - + if ( battle_config.min_chat_delay ) { if( DIFF_TICK(sd->cantalk_tick, timer->gettick()) > 0 ) return true; sd->cantalk_tick = timer->gettick() + battle_config.min_chat_delay; } - + if (sd->sc.count && //no "chatting" while muted. (sd->sc.data[SC_BERSERK] || (sd->sc.data[SC_DEEP_SLEEP] && sd->sc.data[SC_DEEP_SLEEP]->val2) || (sd->sc.data[SC_NOCHAT] && sd->sc.data[SC_NOCHAT]->val1&MANNER_NOCHAT))) return false; - + if ( !homun_alive(sd->hd) ) { clif->message(fd, msg_txt(1254)); // You do not have a homunculus. return false; } - + if (!message || !*message || sscanf(message, "%99[^\n]", mes) < 1) { clif->message(fd, msg_txt(1260)); // Please enter a message (usage: @homtalk <message>). return false; } - + snprintf(temp, sizeof temp ,"%s : %s", sd->hd->homunculus.name, mes); clif->disp_overhead(&sd->hd->bl, temp); - + return true; } @@ -6943,34 +6933,34 @@ ACMD(homtalk) ACMD(hominfo) { struct homun_data *hd; struct status_data *st; - + if ( !homun_alive(sd->hd) ) { clif->message(fd, msg_txt(1254)); // You do not have a homunculus. return false; } - + hd = sd->hd; st = status->get_status_data(&hd->bl); clif->message(fd, msg_txt(1261)); // Homunculus stats: - + snprintf(atcmd_output, sizeof(atcmd_output) ,msg_txt(1262), // HP: %d/%d - SP: %d/%d st->hp, st->max_hp, st->sp, st->max_sp); clif->message(fd, atcmd_output); - + snprintf(atcmd_output, sizeof(atcmd_output) ,msg_txt(1263), // ATK: %d - MATK: %d~%d st->rhw.atk2 +st->batk, st->matk_min, st->matk_max); clif->message(fd, atcmd_output); - + snprintf(atcmd_output, sizeof(atcmd_output) ,msg_txt(1264), // Hungry: %d - Intimacy: %u hd->homunculus.hunger, hd->homunculus.intimacy/100); clif->message(fd, atcmd_output); - + snprintf(atcmd_output, sizeof(atcmd_output) , msg_txt(1265), // Stats: Str %d / Agi %d / Vit %d / Int %d / Dex %d / Luk %d st->str, st->agi, st->vit, st->int_, st->dex, st->luk); clif->message(fd, atcmd_output); - + return true; } @@ -6980,75 +6970,75 @@ ACMD(homstats) struct s_homunculus_db *db; struct s_homunculus *hom; int lv, min, max, evo; - + if ( !homun_alive(sd->hd) ) { clif->message(fd, msg_txt(1254)); // You do not have a homunculus. return false; } - + hd = sd->hd; - + hom = &hd->homunculus; db = hd->homunculusDB; lv = hom->level; - + snprintf(atcmd_output, sizeof(atcmd_output) , msg_txt(1266), lv, db->name); // Homunculus growth stats (Lv %d %s): clif->message(fd, atcmd_output); lv--; //Since the first increase is at level 2. - + evo = (hom->class_ == db->evo_class); min = db->base.HP +lv*db->gmin.HP +(evo?db->emin.HP:0); max = db->base.HP +lv*db->gmax.HP +(evo?db->emax.HP:0);; snprintf(atcmd_output, sizeof(atcmd_output) ,msg_txt(1267), hom->max_hp, min, max); // Max HP: %d (%d~%d) clif->message(fd, atcmd_output); - + min = db->base.SP +lv*db->gmin.SP +(evo?db->emin.SP:0); max = db->base.SP +lv*db->gmax.SP +(evo?db->emax.SP:0);; snprintf(atcmd_output, sizeof(atcmd_output) ,msg_txt(1268), hom->max_sp, min, max); // Max SP: %d (%d~%d) clif->message(fd, atcmd_output); - + min = db->base.str +lv*(db->gmin.str/10) +(evo?db->emin.str:0); max = db->base.str +lv*(db->gmax.str/10) +(evo?db->emax.str:0);; snprintf(atcmd_output, sizeof(atcmd_output) ,msg_txt(1269), hom->str/10, min, max); // Str: %d (%d~%d) clif->message(fd, atcmd_output); - + min = db->base.agi +lv*(db->gmin.agi/10) +(evo?db->emin.agi:0); max = db->base.agi +lv*(db->gmax.agi/10) +(evo?db->emax.agi:0);; snprintf(atcmd_output, sizeof(atcmd_output) ,msg_txt(1270), hom->agi/10, min, max); // Agi: %d (%d~%d) clif->message(fd, atcmd_output); - + min = db->base.vit +lv*(db->gmin.vit/10) +(evo?db->emin.vit:0); max = db->base.vit +lv*(db->gmax.vit/10) +(evo?db->emax.vit:0);; snprintf(atcmd_output, sizeof(atcmd_output) ,msg_txt(1271), hom->vit/10, min, max); // Vit: %d (%d~%d) clif->message(fd, atcmd_output); - + min = db->base.int_ +lv*(db->gmin.int_/10) +(evo?db->emin.int_:0); max = db->base.int_ +lv*(db->gmax.int_/10) +(evo?db->emax.int_:0);; snprintf(atcmd_output, sizeof(atcmd_output) ,msg_txt(1272), hom->int_/10, min, max); // Int: %d (%d~%d) clif->message(fd, atcmd_output); - + min = db->base.dex +lv*(db->gmin.dex/10) +(evo?db->emin.dex:0); max = db->base.dex +lv*(db->gmax.dex/10) +(evo?db->emax.dex:0);; snprintf(atcmd_output, sizeof(atcmd_output) ,msg_txt(1273), hom->dex/10, min, max); // Dex: %d (%d~%d) clif->message(fd, atcmd_output); - + min = db->base.luk +lv*(db->gmin.luk/10) +(evo?db->emin.luk:0); max = db->base.luk +lv*(db->gmax.luk/10) +(evo?db->emax.luk:0);; snprintf(atcmd_output, sizeof(atcmd_output) ,msg_txt(1274), hom->luk/10, min, max); // Luk: %d (%d~%d) clif->message(fd, atcmd_output); - + return true; } -ACMD(homshuffle) { - +ACMD(homshuffle) +{ if(!sd->hd) return false; // nothing to do - + if(!homun->shuffle(sd->hd)) return false; - + clif->message(sd->fd, msg_txt(1275)); // Homunculus stats altered. atcommand_homstats(fd, sd, command, message, info); //Print out the new stats return true; @@ -7062,19 +7052,19 @@ ACMD(iteminfo) { struct item_data *item_data, *item_array[MAX_SEARCH]; int i, count = 1; - + if (!message || !*message) { clif->message(fd, msg_txt(1276)); // Please enter an item name/ID (usage: @ii/@iteminfo <item name/ID>). return false; } if ((item_array[0] = itemdb->exists(atoi(message))) == NULL) count = itemdb->search_name_array(item_array, MAX_SEARCH, message, 0); - + if (!count) { - clif->message(fd, msg_txt(19)); // Invalid item ID or name. + clif->message(fd, msg_txt(19)); // Invalid item ID or name. return false; } - + if (count > MAX_SEARCH) { sprintf(atcmd_output, msg_txt(269), MAX_SEARCH, count); // Displaying first %d out of %d matches clif->message(fd, atcmd_output); @@ -7088,10 +7078,10 @@ ACMD(iteminfo) (item_data->script==NULL)? msg_txt(1278) : msg_txt(1279) // None / With script ); clif->message(fd, atcmd_output); - + sprintf(atcmd_output, msg_txt(1280), item_data->value_buy, item_data->value_sell, item_data->weight/10. ); // NPC Buy:%dz, Sell:%dz | Weight: %.1f clif->message(fd, atcmd_output); - + if (item_data->maxchance == -1) strcpy(atcmd_output, msg_txt(1281)); // - Available in the shops only. else if ( !battle_config.atcommand_mobinfo_type ) { @@ -7101,7 +7091,7 @@ ACMD(iteminfo) strcpy(atcmd_output, msg_txt(1283)); // - Monsters don't drop this item. } clif->message(fd, atcmd_output); - + } return true; } @@ -7113,19 +7103,19 @@ ACMD(whodrops) { struct item_data *item_data, *item_array[MAX_SEARCH]; int i,j, count = 1; - + if (!message || !*message) { clif->message(fd, msg_txt(1284)); // Please enter item name/ID (usage: @whodrops <item name/ID>). return false; } if ((item_array[0] = itemdb->exists(atoi(message))) == NULL) count = itemdb->search_name_array(item_array, MAX_SEARCH, message, 0); - + if (!count) { - clif->message(fd, msg_txt(19)); // Invalid item ID or name. + clif->message(fd, msg_txt(19)); // Invalid item ID or name. return false; } - + if (count > MAX_SEARCH) { sprintf(atcmd_output, msg_txt(269), MAX_SEARCH, count); // Displaying first %d out of %d matches clif->message(fd, atcmd_output); @@ -7135,14 +7125,14 @@ ACMD(whodrops) item_data = item_array[i]; sprintf(atcmd_output, msg_txt(1285), item_data->jname,item_data->slot); // Item: '%s'[%d] clif->message(fd, atcmd_output); - + if (item_data->mob[0].chance == 0) { strcpy(atcmd_output, msg_txt(1286)); // - Item is not dropped by mobs. clif->message(fd, atcmd_output); } else { sprintf(atcmd_output, msg_txt(1287), MAX_SEARCH); // - Common mobs with highest drop chance (only max %d are listed): clif->message(fd, atcmd_output); - + for (j=0; j < MAX_SEARCH && item_data->mob[j].chance > 0; j++) { sprintf(atcmd_output, "- %s (%02.02f%%)", mob->db(item_data->mob[j].id)->jname, item_data->mob[j].chance/100.); @@ -7158,12 +7148,12 @@ ACMD(whereis) struct mob_db *monster, *mob_array[MAX_SEARCH]; int count; int i, j, k; - + if (!message || !*message) { clif->message(fd, msg_txt(1288)); // Please enter a monster name/ID (usage: @whereis <monster_name_or_monster_ID>). return false; } - + // If monster identifier/name argument is a name if ((i = mob->db_checkid(atoi(message)))) { @@ -7171,12 +7161,12 @@ ACMD(whereis) count = 1; } else count = mob->db_searchname_array(mob_array, MAX_SEARCH, message, 0); - + if (!count) { clif->message(fd, msg_txt(40)); // Invalid monster ID or name. return false; } - + if (count > MAX_SEARCH) { sprintf(atcmd_output, msg_txt(269), MAX_SEARCH, count); clif->message(fd, atcmd_output); @@ -7186,7 +7176,7 @@ ACMD(whereis) monster = mob_array[k]; snprintf(atcmd_output, sizeof atcmd_output, msg_txt(1289), monster->jname); // %s spawns in: clif->message(fd, atcmd_output); - + for (i = 0; i < ARRAYLENGTH(monster->spawn) && monster->spawn[i].qty; i++) { j = map->mapindex2mapid(monster->spawn[i].mapindex); if (j < 0) continue; @@ -7196,7 +7186,7 @@ ACMD(whereis) if (i == 0) clif->message(fd, msg_txt(1290)); // This monster does not spawn normally. } - + return true; } @@ -7214,15 +7204,15 @@ ACMD(version) { *------------------------------------------*/ int atcommand_mutearea_sub(struct block_list *bl,va_list ap) { // As it is being used [ACMD(mutearea)] there's no need to be a bool, but if there's need to reuse it, it's better to be this way - + int time, id; struct map_session_data *pl_sd = (struct map_session_data *)bl; if (pl_sd == NULL) return 0; - + id = va_arg(ap, int); time = va_arg(ap, int); - + if (id != bl->id && !pc_get_group_level(pl_sd)) { pl_sd->status.manner -= time; if (pl_sd->status.manner < 0) @@ -7235,18 +7225,18 @@ int atcommand_mutearea_sub(struct block_list *bl,va_list ap) ACMD(mutearea) { int time; - + if (!message || !*message) { clif->message(fd, msg_txt(1297)); // Please enter a time in minutes (usage: @mutearea/@stfu <time in minutes>). return false; } - + time = atoi(message); - + map->foreachinarea(atcommand->mutearea_sub,sd->bl.m, sd->bl.x-AREA_SIZE, sd->bl.y-AREA_SIZE, sd->bl.x+AREA_SIZE, sd->bl.y+AREA_SIZE, BL_PC, sd->bl.id, time); - + return true; } @@ -7254,9 +7244,9 @@ ACMD(mutearea) { ACMD(rates) { char buf[CHAT_SIZE_MAX]; - + memset(buf, '\0', sizeof(buf)); - + snprintf(buf, CHAT_SIZE_MAX, msg_txt(1298), // Experience rates: Base %.2fx / Job %.2fx battle_config.base_exp_rate/100., battle_config.job_exp_rate/100.); clif->message(fd, buf); @@ -7269,7 +7259,7 @@ ACMD(rates) snprintf(buf, CHAT_SIZE_MAX, msg_txt(1301), // Other Drop Rates: MvP %.2fx / Card-Based %.2fx / Treasure %.2fx battle_config.item_rate_mvp/100., battle_config.item_rate_adddrop/100., battle_config.item_rate_treasure/100.); clif->message(fd, buf); - + return true; } @@ -7280,25 +7270,24 @@ ACMD(rates) ACMD(me) { char tempmes[CHAT_SIZE_MAX]; - + memset(tempmes, '\0', sizeof(tempmes)); memset(atcmd_output, '\0', sizeof(atcmd_output)); - + if (sd->sc.count && //no "chatting" while muted. (sd->sc.data[SC_BERSERK] || (sd->sc.data[SC_DEEP_SLEEP] && sd->sc.data[SC_DEEP_SLEEP]->val2) || (sd->sc.data[SC_NOCHAT] && sd->sc.data[SC_NOCHAT]->val1&MANNER_NOCHAT))) return false; - + if (!message || !*message || sscanf(message, "%199[^\n]", tempmes) < 0) { clif->message(fd, msg_txt(1302)); // Please enter a message (usage: @me <message>). return false; } - - sprintf(atcmd_output, msg_txt(270), sd->status.name, tempmes); // *%s %s* + + sprintf(atcmd_output, msg_txt(270), sd->status.name, tempmes); // *%s %s* clif->disp_overhead(&sd->bl, atcmd_output); - + return true; - } /*========================================== @@ -7308,20 +7297,20 @@ ACMD(me) ACMD(size) { int size = 0; - + size = cap_value(atoi(message),SZ_SMALL,SZ_BIG); - + if(sd->state.size) { sd->state.size = SZ_SMALL; pc->setpos(sd, sd->mapindex, sd->bl.x, sd->bl.y, CLR_TELEPORT); } - + sd->state.size = size; if( size == SZ_MEDIUM ) clif->specialeffect(&sd->bl,420,AREA); else if( size == SZ_BIG ) clif->specialeffect(&sd->bl,422,AREA); - + clif->message(fd, msg_txt(1303)); // Size change applied. return true; } @@ -7331,10 +7320,10 @@ ACMD(sizeall) int size; struct map_session_data *pl_sd; struct s_mapiterator* iter; - + size = atoi(message); size = cap_value(size,0,2); - + iter = mapit_getallusers(); for( pl_sd = (TBL_PC*)mapit->first(iter); mapit->exists(iter); pl_sd = (TBL_PC*)mapit->next(iter) ) { if( pl_sd->state.size != size ) { @@ -7342,7 +7331,7 @@ ACMD(sizeall) pl_sd->state.size = SZ_SMALL; pc->setpos(pl_sd, pl_sd->mapindex, pl_sd->bl.x, pl_sd->bl.y, CLR_TELEPORT); } - + pl_sd->state.size = size; if( size == SZ_MEDIUM ) clif->specialeffect(&pl_sd->bl,420,AREA); @@ -7351,7 +7340,7 @@ ACMD(sizeall) } } mapit->free(iter); - + clif->message(fd, msg_txt(1303)); // Size change applied. return true; } @@ -7362,28 +7351,28 @@ ACMD(sizeguild) char guild_name[NAME_LENGTH]; struct map_session_data *pl_sd; struct guild *g; - + memset(guild_name, '\0', sizeof(guild_name)); - + if( !message || !*message || sscanf(message, "%d %23[^\n]", &size, guild_name) < 2 ) { clif->message(fd, msg_txt(1304)); // Please enter guild name/ID (usage: @sizeguild <size> <guild name/ID>). return false; } - + if( (g = guild->searchname(guild_name)) == NULL && (g = guild->search(atoi(guild_name))) == NULL ) { clif->message(fd, msg_txt(94)); // Incorrect name/ID, or no one from the guild is online. return false; } - + size = cap_value(size,SZ_SMALL,SZ_BIG); - + for( i = 0; i < g->max_member; i++ ) { if( (pl_sd = g->member[i].sd) && pl_sd->state.size != size ) { if( pl_sd->state.size ) { pl_sd->state.size = SZ_SMALL; pc->setpos(pl_sd, pl_sd->mapindex, pl_sd->bl.x, pl_sd->bl.y, CLR_TELEPORT); } - + pl_sd->state.size = size; if( size == SZ_MEDIUM ) clif->specialeffect(&pl_sd->bl,420,AREA); @@ -7391,7 +7380,7 @@ ACMD(sizeguild) clif->specialeffect(&pl_sd->bl,422,AREA); } } - + clif->message(fd, msg_txt(1303)); // Size change applied. return true; } @@ -7400,8 +7389,8 @@ ACMD(sizeguild) * @monsterignore * => Makes monsters ignore you. [Valaris] *------------------------------------------*/ -ACMD(monsterignore) { - +ACMD(monsterignore) +{ if (!sd->state.monster_ignore) { sd->state.monster_ignore = 1; clif->message(sd->fd, msg_txt(1305)); // You are now immune to attacks. @@ -7409,15 +7398,15 @@ ACMD(monsterignore) { sd->state.monster_ignore = 0; clif->message(sd->fd, msg_txt(1306)); // Returned to normal state. } - + return true; } /*========================================== * @fakename * => Gives your character a fake name. [Valaris] *------------------------------------------*/ -ACMD(fakename){ - +ACMD(fakename) +{ if( !message || !*message ) { if( sd->fakename[0] ) @@ -7429,23 +7418,23 @@ ACMD(fakename){ clif->message(sd->fd, msg_txt(1307)); // Returned to real name. return true; } - + clif->message(sd->fd, msg_txt(1308)); // You must enter a name. return false; } - + if( strlen(message) < 2 ) { clif->message(sd->fd, msg_txt(1309)); // Fake name must be at least two characters. return false; } - + safestrncpy(sd->fakename, message, sizeof(sd->fakename)); clif->charnameack(0, &sd->bl); if( sd->disguise ) // Another packet should be sent so the client updates the name for sd clif->charnameack(sd->fd, &sd->bl); clif->message(sd->fd, msg_txt(1310)); // Fake name enabled. - + return true; } @@ -7467,7 +7456,7 @@ ACMD(mapflag) { short flag=0,i; memset(flag_name, '\0', sizeof(flag_name)); - + if (!message || !*message || (sscanf(message, "%99s %hd", flag_name, &flag) < 1)) { clif->message(sd->fd,msg_txt(1311)); // Enabled Mapflags in this map: clif->message(sd->fd,"----------------------------------"); @@ -7490,7 +7479,7 @@ ACMD(mapflag) { return true; } for (i = 0; flag_name[i]; i++) flag_name[i] = TOLOWER(flag_name[i]); //lowercase - + if ( strcmp( flag_name , "gvg" ) == 0 ) { if( flag && !map->list[sd->bl.m].flag.gvg ) map->zone_change2(sd->bl.m,strdb_get(map->zone_db, MAP_ZONE_GVG_NAME)); @@ -7507,7 +7496,7 @@ ACMD(mapflag) { else if ( !flag && map->list[sd->bl.m].flag.battleground ) map->zone_change2(sd->bl.m,map->list[sd->bl.m].prev_zone); } - + SETFLAG(autotrade); SETFLAG(allowks); SETFLAG(nomemo); SETFLAG(noteleport); SETFLAG(noreturn); SETFLAG(monster_noteleport); SETFLAG(nosave); SETFLAG(nobranch); SETFLAG(noexppenalty); SETFLAG(pvp); SETFLAG(pvp_noparty); SETFLAG(pvp_noguild); @@ -7521,7 +7510,7 @@ ACMD(mapflag) { SETFLAG(nodrop); SETFLAG(novending); SETFLAG(loadevent); SETFLAG(nochat); SETFLAG(partylock); SETFLAG(guildlock); SETFLAG(src4instance); SETFLAG(notomb); SETFLAG(nocashshop); - + clif->message(sd->fd,msg_txt(1314)); // Invalid flag name or flag. clif->message(sd->fd,msg_txt(1312)); // Usage: "@mapflag monster_noteleport 1" (0=Off | 1=On) clif->message(sd->fd,msg_txt(1315)); // Available Flags: @@ -7533,10 +7522,9 @@ ACMD(mapflag) { clif->message(sd->fd,"fog, fireworks, sakura, leaves, nobaseexp, nojobexp, nomobloot,"); clif->message(sd->fd,"nomvploot, nightenabled, nodrop, novending, loadevent, nochat, partylock,"); clif->message(sd->fd,"guildlock, src4instance, notomb, nocashshop"); - #undef CHECKFLAG #undef SETFLAG - + return true; } @@ -7550,7 +7538,7 @@ ACMD(showexp) clif->message(fd, msg_txt(1316)); // Gained exp will not be shown. return true; } - + sd->state.showexp = 1; clif->message(fd, msg_txt(1317)); // Gained exp is now shown. return true; @@ -7563,7 +7551,7 @@ ACMD(showzeny) clif->message(fd, msg_txt(1318)); // Gained zeny will not be shown. return true; } - + sd->state.showzeny = 1; clif->message(fd, msg_txt(1319)); // Gained zeny is now shown. return true; @@ -7576,7 +7564,7 @@ ACMD(showdelay) clif->message(fd, msg_txt(1320)); // Skill delay failures will not be shown. return true; } - + sd->state.showdelay = 1; clif->message(fd, msg_txt(1321)); // Skill delay failures are now shown. return true; @@ -7594,34 +7582,33 @@ ACMD(showdelay) ACMD(invite) { unsigned int did = sd->duel_group; struct map_session_data *target_sd = map->nick2sd((char *)message); - + if(did == 0) { // "Duel: @invite without @duel." clif->message(fd, msg_txt(350)); return false; } - + if(duel->list[did].max_players_limit > 0 && duel->list[did].members_count >= duel->list[did].max_players_limit) { - // "Duel: Limit of players is reached." clif->message(fd, msg_txt(351)); return false; } - + if(target_sd == NULL) { // "Duel: Player not found." clif->message(fd, msg_txt(352)); return false; } - + if(target_sd->duel_group > 0 || target_sd->duel_invite > 0) { // "Duel: Player already in duel." clif->message(fd, msg_txt(353)); return false; } - + if(battle_config.duel_only_on_same_map && target_sd->bl.m != sd->bl.m) { // "Duel: You can't invite %s because he/she isn't in the same map." @@ -7629,7 +7616,7 @@ ACMD(invite) { clif->message(fd, atcmd_output); return false; } - + duel->invite(did, sd, target_sd); // "Duel: Invitation has been sent." clif->message(fd, msg_txt(354)); @@ -7638,18 +7625,18 @@ ACMD(invite) { ACMD(duel) { unsigned int maxpl = 0; - + if(sd->duel_group > 0) { duel->showinfo(sd->duel_group, sd); return true; } - + if(sd->duel_invite > 0) { // "Duel: @duel without @reject." clif->message(fd, msg_txt(355)); return false; } - + if(!duel->checktime(sd)) { char output[CHAT_SIZE_MAX]; // "Duel: You can take part in duel only one time per %d minutes." @@ -7657,7 +7644,7 @@ ACMD(duel) { clif->message(fd, output); return false; } - + if( message[0] ) { if(sscanf(message, "%d", &maxpl) >= 1) { if(maxpl < 2 || maxpl > 65535) { @@ -7671,7 +7658,7 @@ ACMD(duel) { if(target_sd != NULL) { unsigned int newduel; if((newduel = duel->create(sd, 2)) != -1) { - if(target_sd->duel_group > 0 || target_sd->duel_invite > 0) { + if(target_sd->duel_group > 0 || target_sd->duel_invite > 0) { clif->message(fd, msg_txt(353)); // "Duel: Player already in duel." return false; } @@ -7686,7 +7673,7 @@ ACMD(duel) { } } else duel->create(sd, 0); - + return true; } @@ -7697,7 +7684,6 @@ ACMD(leave) { clif->message(fd, msg_txt(358)); return false; } - duel->leave(sd->duel_group, sd); clif->message(fd, msg_txt(359)); // "Duel: You left the duel." return true; @@ -7711,20 +7697,20 @@ ACMD(accept) { clif->message(fd, output); return false; } - + if(sd->duel_invite <= 0) { // "Duel: @accept without invitation." clif->message(fd, msg_txt(360)); return false; } - + if( duel->list[sd->duel_invite].max_players_limit > 0 && duel->list[sd->duel_invite].members_count >= duel->list[sd->duel_invite].max_players_limit ) { // "Duel: Limit of players is reached." clif->message(fd, msg_txt(351)); return false; } - + duel->accept(sd->duel_invite, sd); // "Duel: Invitation has been accepted." clif->message(fd, msg_txt(361)); @@ -7737,7 +7723,7 @@ ACMD(reject) { clif->message(fd, msg_txt(362)); return false; } - + duel->reject(sd->duel_invite, sd); // "Duel: Invitation has been rejected." clif->message(fd, msg_txt(363)); @@ -7752,12 +7738,12 @@ ACMD(cash) char output[128]; int value; int ret=0; - + if( !message || !*message || (value = atoi(message)) == 0 ) { clif->message(fd, msg_txt(1322)); // Please enter an amount. return false; } - + if( !strcmpi(info->command,"cash") ) { if( value > 0 ) { if( (ret=pc->getcash(sd, value, 0)) >= 0){ @@ -7793,7 +7779,7 @@ ACMD(cash) clif->message(fd, msg_txt(41)); // Unable to decrease the number/value. } } - + return true; } @@ -7801,22 +7787,22 @@ ACMD(cash) ACMD(clone) { int x=0,y=0,flag=0,master=0,i=0; struct map_session_data *pl_sd=NULL; - + if (!message || !*message) { clif->message(sd->fd,msg_txt(1323)); // You must enter a player name or ID. return false; } - + if((pl_sd=map->nick2sd((char *)message)) == NULL && (pl_sd=map->charid2sd(atoi(message))) == NULL) { - clif->message(fd, msg_txt(3)); // Character not found. + clif->message(fd, msg_txt(3)); // Character not found. return false; } - + if(pc_get_group_level(pl_sd) > pc_get_group_level(sd)) { - clif->message(fd, msg_txt(126)); // Cannot clone a player of higher GM level than yourself. + clif->message(fd, msg_txt(126)); // Cannot clone a player of higher GM level than yourself. return false; } - + if (strcmpi(info->command, "clone") == 0) flag = 1; else if (strcmpi(info->command, "slaveclone") == 0) { @@ -7829,26 +7815,26 @@ ACMD(clone) { master = sd->bl.id; if (battle_config.atc_slave_clone_limit && mob->countslave(&sd->bl) >= battle_config.atc_slave_clone_limit) { - clif->message(fd, msg_txt(127)); // You've reached your slave clones limit. + clif->message(fd, msg_txt(127)); // You've reached your slave clones limit. return false; } } - + do { x = sd->bl.x + (rnd() % 10 - 5); y = sd->bl.y + (rnd() % 10 - 5); } while (map->getcell(sd->bl.m,x,y,CELL_CHKNOPASS) && i++ < 10); - + if (i >= 10) { x = sd->bl.x; y = sd->bl.y; } - + if((x = mob->clone_spawn(pl_sd, sd->bl.m, x, y, "", master, 0, flag?1:0, 0)) > 0) { - clif->message(fd, msg_txt(128+flag*2)); // Evil Clone spawned. Clone spawned. Slave clone spawned. + clif->message(fd, msg_txt(128+flag*2)); // Evil Clone spawned. Clone spawned. Slave clone spawned. return true; } - clif->message(fd, msg_txt(129+flag*2)); // Unable to spawn evil clone. Unable to spawn clone. Unable to spawn slave clone. + clif->message(fd, msg_txt(129+flag*2)); // Unable to spawn evil clone. Unable to spawn clone. Unable to spawn slave clone. return false; } @@ -7865,7 +7851,7 @@ ACMD(noask) clif->message(fd, msg_txt(390)); // Autorejecting is activated. sd->state.noask = 1; } - + return true; } @@ -7876,14 +7862,14 @@ ACMD(noask) ACMD(request) { if (!message || !*message) { - clif->message(sd->fd,msg_txt(277)); // Usage: @request <petition/message to online GMs>. + clif->message(sd->fd,msg_txt(277)); // Usage: @request <petition/message to online GMs>. return false; } - - sprintf(atcmd_output, msg_txt(278), message); // (@request): %s + + sprintf(atcmd_output, msg_txt(278), message); // (@request): %s intif->wis_message_to_gm(sd->status.name, PC_PERM_RECEIVE_REQUESTS, atcmd_output); clif_disp_onlyself(sd, atcmd_output, strlen(atcmd_output)); - clif->message(sd->fd,msg_txt(279)); // @request sent. + clif->message(sd->fd,msg_txt(279)); // @request sent. return true; } @@ -7894,7 +7880,7 @@ ACMD(feelreset) { pc->resetfeel(sd); clif->message(fd, msg_txt(1324)); // Reset 'Feeling' maps. - + return true; } @@ -7902,14 +7888,14 @@ ACMD(feelreset) * AUCTION SYSTEM *------------------------------------------*/ ACMD(auction) { - + if( !battle_config.feature_auction ) { clif->colormes(sd->fd,COLOR_RED,msg_txt(1484)); return false; } - + clif->auction_openwindow(sd); - + return true; } @@ -7947,8 +7933,8 @@ ACMD(ksprotection) /*========================================== * Map Kill Steal Protection Setting *------------------------------------------*/ -ACMD(allowks) { - +ACMD(allowks) +{ if( map->list[sd->bl.m].flag.allowks ) { map->list[sd->bl.m].flag.allowks = 0; clif->message(fd, msg_txt(1330)); // [ Map K.S Protection Active ] @@ -7959,16 +7945,16 @@ ACMD(allowks) { return true; } -ACMD(resetstat) { - +ACMD(resetstat) +{ pc->resetstate(sd); sprintf(atcmd_output, msg_txt(207), sd->status.name); clif->message(fd, atcmd_output); return true; } -ACMD(resetskill) { - +ACMD(resetskill) +{ pc->resetskill(sd,1); sprintf(atcmd_output, msg_txt(206), sd->status.name); clif->message(fd, atcmd_output); @@ -7987,7 +7973,7 @@ ACMD(itemlist) const struct item* items; int size; StringBuf buf; - + if( strcmpi(info->command, "storagelist") == 0 ) { location = "storage"; items = sd->status.storage.items; @@ -8002,34 +7988,34 @@ ACMD(itemlist) size = MAX_INVENTORY; } else return false; - + StrBuf->Init(&buf); - + count = 0; // total slots occupied counter = 0; // total items found for( i = 0; i < size; ++i ) { const struct item* it = &items[i]; struct item_data* itd; - + if( it->nameid == 0 || (itd = itemdb->exists(it->nameid)) == NULL ) continue; - + counter += it->amount; count++; - + if( count == 1 ) { StrBuf->Printf(&buf, msg_txt(1332), location, sd->status.name); // ------ %s items list of '%s' ------ clif->message(fd, StrBuf->Value(&buf)); StrBuf->Clear(&buf); } - + if( it->refine ) StrBuf->Printf(&buf, "%d %s %+d (%s, id: %d)", it->amount, itd->jname, it->refine, itd->name, it->nameid); else StrBuf->Printf(&buf, "%d %s (%s, id: %d)", it->amount, itd->jname, itd->name, it->nameid); - + if( it->equip ) { char equipstr[CHAT_SIZE_MAX]; strcpy(equipstr, msg_txt(1333)); // | equipped: @@ -8065,10 +8051,10 @@ ACMD(itemlist) equipstr[strlen(equipstr) - 2] = '\0'; StrBuf->AppendStr(&buf, equipstr); } - + clif->message(fd, StrBuf->Value(&buf)); StrBuf->Clear(&buf); - + if( it->card[0] == CARD0_PET ) { // pet egg if (it->card[3]) @@ -8105,22 +8091,21 @@ ACMD(itemlist) if( counter2 > 0 ) StrBuf->AppendStr(&buf, ")"); } - + if( StrBuf->Length(&buf) > 0 ) clif->message(fd, StrBuf->Value(&buf)); StrBuf->Clear(&buf); } - + if( count == 0 ) StrBuf->Printf(&buf, msg_txt(1353), location); // No item found in this player's %s. else StrBuf->Printf(&buf, msg_txt(1354), counter, count, location); // %d item(s) found in %d %s slots. - + clif->message(fd, StrBuf->Value(&buf)); - + StrBuf->Destroy(&buf); - return true; } @@ -8151,10 +8136,10 @@ ACMD(stats) { "JobChangeLvl (3rd) - %d", 0 }, { NULL, 0 } }; - + memset(job_jobname, '\0', sizeof(job_jobname)); memset(output, '\0', sizeof(output)); - + //direct array initialization with variables is not standard C compliant. output_table[0].value = sd->status.base_level; output_table[1].format = job_jobname; @@ -8173,17 +8158,16 @@ ACMD(stats) output_table[13].value = sd->status.skill_point; output_table[14].value = sd->change_level_2nd; output_table[15].value = sd->change_level_3rd; - + sprintf(job_jobname, "Job - %s %s", pc->job_name(sd->status.class_), "(level %d)"); sprintf(output, msg_txt(53), sd->status.name); // '%s' stats: - + clif->message(fd, output); - + for (i = 0; output_table[i].format != NULL; i++) { sprintf(output, output_table[i].format, output_table[i].value); clif->message(fd, output); } - return true; } @@ -8191,13 +8175,13 @@ ACMD(delitem) { char item_name[100]; int nameid, amount = 0, total, idx; struct item_data* id; - + if( !message || !*message || ( sscanf(message, "\"%99[^\"]\" %d", item_name, &amount) < 2 && sscanf(message, "%99s %d", item_name, &amount) < 2 ) || amount < 1 ) { clif->message(fd, msg_txt(1355)); // Please enter an item name/ID, a quantity, and a player name (usage: #delitem <player> <item_name_or_ID> <quantity>). return false; } - + if( ( id = itemdb->search_name(item_name) ) != NULL || ( id = itemdb->exists(atoi(item_name)) ) != NULL ) { nameid = id->nameid; @@ -8207,26 +8191,26 @@ ACMD(delitem) { clif->message(fd, msg_txt(19)); // Invalid item ID or name. return false; } - + total = amount; - + // delete items while (amount && (idx = pc->search_inventory(sd, nameid)) != INDEX_NOT_FOUND) { int delamount = ( amount < sd->status.inventory[idx].amount ) ? amount : sd->status.inventory[idx].amount; - + if( sd->inventory_data[idx]->type == IT_PETEGG && sd->status.inventory[idx].card[0] == CARD0_PET ) {// delete pet intif->delete_petdata(MakeDWord(sd->status.inventory[idx].card[1], sd->status.inventory[idx].card[2])); } pc->delitem(sd, idx, delamount, 0, 0, LOG_TYPE_COMMAND); - + amount-= delamount; } - + // notify target sprintf(atcmd_output, msg_txt(113), total-amount); // %d item(s) removed by a GM. clif->message(sd->fd, atcmd_output); - + // notify source if( amount == total ) { @@ -8242,7 +8226,6 @@ ACMD(delitem) { sprintf(atcmd_output, msg_txt(114), total); // %d item(s) removed from the player. clif->message(fd, atcmd_output); } - return true; } @@ -8251,7 +8234,7 @@ ACMD(delitem) { *------------------------------------------*/ ACMD(font) { int font_id; - + font_id = atoi(message); if( font_id == 0 ) { @@ -8277,7 +8260,7 @@ ACMD(font) { } else clif->message(fd, msg_txt(1361)); // Already using this font. - + return true; } @@ -8291,15 +8274,15 @@ void atcommand_commands_sub(struct map_session_data* sd, const int fd, AtCommand AtCommandInfo* cmd; DBIterator *iter = db_iterator(atcommand->db); int count = 0; - + memset(line_buff,' ',CHATBOX_SIZE); line_buff[CHATBOX_SIZE-1] = 0; - + clif->message(fd, msg_txt(273)); // "Available commands:" - + for (cmd = dbi_first(iter); dbi_exists(iter); cmd = dbi_next(iter)) { size_t slen; - + switch( type ) { case COMMAND_CHARCOMMAND: if( cmd->char_groups[pcg->get_idx(sd->group)] == 0 ) @@ -8312,10 +8295,9 @@ void atcommand_commands_sub(struct map_session_data* sd, const int fd, AtCommand default: continue; } - - + slen = strlen(cmd->command); - + // flush the text buffer if this command won't fit into it if ( slen + cur - line_buff >= CHATBOX_SIZE ) { @@ -8324,18 +8306,18 @@ void atcommand_commands_sub(struct map_session_data* sd, const int fd, AtCommand memset(line_buff,' ',CHATBOX_SIZE); line_buff[CHATBOX_SIZE-1] = 0; } - + memcpy(cur,cmd->command,slen); cur += slen+(10-slen%10); - + count++; } dbi_destroy(iter); clif->message(fd,line_buff); - + sprintf(atcmd_output, msg_txt(274), count); // "%d commands found." clif->message(fd, atcmd_output); - + return; } @@ -8359,12 +8341,11 @@ ACMD(charcommands) /* for new mounts */ ACMD(cashmount) { - if (pc_hasmount(sd)) { clif->message(fd, msg_txt(1476)); // You are already mounting something else return false; } - + clif->message(sd->fd,msg_txt(1362)); // NOTICE: If you crash with mount your LUA is outdated. if (!sd->sc.data[SC_ALL_RIDING]) { clif->message(sd->fd,msg_txt(1363)); // You have mounted. @@ -8378,18 +8359,17 @@ ACMD(cashmount) ACMD(accinfo) { char query[NAME_LENGTH]; - + if (!message || !*message || strlen(message) > NAME_LENGTH ) { clif->message(fd, msg_txt(1365)); // Usage: @accinfo/@accountinfo <account_id/char name> clif->message(fd, msg_txt(1366)); // You may search partial name by making use of '%' in the search, ex. "@accinfo %Mario%" lists all characters whose name contains "Mario". return false; } - + //remove const type safestrncpy(query, message, NAME_LENGTH); - intif->request_accinfo( sd->fd, sd->bl.id, pc_get_group_level(sd), query ); - + return true; } @@ -8400,7 +8380,7 @@ ACMD(set) { int toset = 0; bool is_str = false; size_t len; - + if( !message || !*message || (toset = sscanf(message, "%31s %128[^\n]s", reg, val)) < 1 ) { clif->message(fd, msg_txt(1367)); // Usage: @set <variable name> <value> clif->message(fd, msg_txt(1368)); // Usage: ex. "@set PoringCharVar 50" @@ -8408,7 +8388,7 @@ ACMD(set) { clif->message(fd, msg_txt(1370)); // Usage: ex. "@set PoringCharVarSTR$" outputs its value, Super Duper String. return false; } - + /* disabled variable types (they require a proper script state to function, so allowing them would crash the server) */ if( reg[0] == '.' ) { clif->message(fd, msg_txt(1371)); // NPC variables may not be used with @set. @@ -8417,29 +8397,26 @@ ACMD(set) { clif->message(fd, msg_txt(1372)); // Instance variables may not be used with @set. return false; } - + is_str = ( reg[strlen(reg) - 1] == '$' ) ? true : false; - + if( ( len = strlen(val) ) > 1 ) { if( val[0] == '"' && val[len-1] == '"') { val[len-1] = '\0'; //Strip quotes. memmove(val, val+1, len-1); } } - + if( toset >= 2 ) {/* we only set the var if there is an val, otherwise we only output the value */ if( is_str ) script->set_var(sd, reg, (void*) val); else script->set_var(sd, reg, (void*)h64BPTRSIZE((atoi(val)))); - } - + CREATE(data, struct script_data,1); - - + if( is_str ) {// string variable - switch( reg[0] ) { case '@': data->u.str = pc->readregstr(sd, script->add_str(reg)); @@ -8457,7 +8434,6 @@ ACMD(set) { data->u.str = pc_readglobalreg_str(sd, script->add_str(reg)); break; } - if( data->u.str == NULL || data->u.str[0] == '\0' ) {// empty string data->type = C_CONSTSTR; data->u.str = ""; @@ -8465,9 +8441,7 @@ ACMD(set) { data->type = C_STR; data->u.str = aStrdup(data->u.str); } - } else {// integer variable - data->type = C_INT; switch( reg[0] ) { case '@': @@ -8486,10 +8460,8 @@ ACMD(set) { data->u.num = pc_readglobalreg(sd, script->add_str(reg)); break; } - } - - + switch( data->type ) { case C_INT: sprintf(atcmd_output,msg_txt(1373),reg,data->u.num); // %s value is now :%d @@ -8504,11 +8476,9 @@ ACMD(set) { sprintf(atcmd_output,msg_txt(1376),reg,data->type); // %s data type is not supported :%u break; } - clif->message(fd, atcmd_output); - + aFree(data); - return true; } ACMD(reloadquestdb) { @@ -8520,7 +8490,7 @@ ACMD(addperm) { int perm_size = pcg->permission_count; bool add = (strcmpi(info->command, "addperm") == 0) ? true : false; int i; - + if( !message || !*message ) { sprintf(atcmd_output, msg_txt(1378),command); // Usage: %s <permission_name> clif->message(fd, atcmd_output); @@ -8531,9 +8501,8 @@ ACMD(addperm) { } return false; } - + ARR_FIND(0, perm_size, i, strcmpi(pcg->permissions[i].name, message) == 0); - if( i == perm_size ) { sprintf(atcmd_output,msg_txt(1380),message); // '%s' is not a known permission. clif->message(fd, atcmd_output); @@ -8544,7 +8513,7 @@ ACMD(addperm) { } return false; } - + if( add && (sd->extra_temp_permissions&pcg->permissions[i].permission) ) { sprintf(atcmd_output, msg_txt(1381),sd->status.name,pcg->permissions[i].name); // User '%s' already possesses the '%s' permission. clif->message(fd, atcmd_output); @@ -8560,28 +8529,26 @@ ACMD(addperm) { clif->message(fd, atcmd_output); } } - return false; } - + if( add ) sd->extra_temp_permissions |= pcg->permissions[i].permission; else sd->extra_temp_permissions &=~ pcg->permissions[i].permission; - - + sprintf(atcmd_output, msg_txt(1384),sd->status.name); // User '%s' permissions updated successfully. The changes are temporary. clif->message(fd, atcmd_output); - + return true; } -ACMD(unloadnpcfile) { - +ACMD(unloadnpcfile) +{ if( !message || !*message ) { clif->message(fd, msg_txt(1385)); // Usage: @unloadnpcfile <file name> return false; } - + if( npc->unloadfile(message) ) clif->message(fd, msg_txt(1386)); // File unloaded. Be aware that mapflags and monsters spawned directly are not removed. else { @@ -8596,39 +8563,39 @@ ACMD(cart) { sd->status.skill[idx].lv = (x)?1:0; \ sd->status.skill[idx].flag = (x)?1:0; \ } while(0) - + int val = atoi(message); bool need_skill = pc->checkskill(sd, MC_PUSHCART) ? false : true; unsigned int index = skill->get_index(MC_PUSHCART); - + if( !message || !*message || val < 0 || val > MAX_CARTS ) { sprintf(atcmd_output, msg_txt(1390),command,MAX_CARTS); // Unknown Cart (usage: %s <0-%d>). clif->message(fd, atcmd_output); return false; } - + if( val == 0 && !pc_iscarton(sd) ) { clif->message(fd, msg_txt(1391)); // You do not possess a cart to be removed return false; } - + if( need_skill ) { MC_CART_MDFY(1,index); } - + if( pc->setcart(sd, val) ) { if( need_skill ) { MC_CART_MDFY(0,index); } return false;/* @cart failed */ } - + if( need_skill ) { MC_CART_MDFY(0,index); } - + clif->message(fd, msg_txt(1392)); // Cart Added - + return true; #undef MC_CART_MDFY } @@ -8636,7 +8603,7 @@ ACMD(cart) { ACMD(join) { struct hChSysCh *channel = NULL; char name[HCHSYS_NAME_LENGTH], pass[HCHSYS_NAME_LENGTH]; - + if (!message || !*message || sscanf(message, "%19s %19s", name, pass) < 1) { sprintf(atcmd_output, msg_txt(1399),command); // Unknown Channel (usage: %s <#channel_name>) clif->message(fd, atcmd_output); @@ -8658,14 +8625,13 @@ ACMD(join) { clif->message(fd, atcmd_output); return false; } - + if( !channel ) { sprintf(atcmd_output, msg_txt(1400),name,command); // Unknown Channel '%s' (usage: %s <#channel_name>) clif->message(fd, atcmd_output); return false; } - - + if( idb_exists(channel->users, sd->status.char_id) ) { sprintf(atcmd_output, msg_txt(1436),name); // You're already in the '%s' channel clif->message(fd, atcmd_output); @@ -8680,13 +8646,13 @@ ACMD(join) { return false; } } - + if( channel->banned && idb_exists(channel->banned, sd->status.account_id) ) { sprintf(atcmd_output, msg_txt(1438),name); // You cannot join the '%s' channel because you've been banned from it clif->message(fd, atcmd_output); return false; } - + if( !( channel->opt & hChSys_OPT_ANNOUNCE_JOIN ) ) { sprintf(atcmd_output, msg_txt(1403),name); // You're now in the '%s' channel clif->message(fd, atcmd_output); @@ -8703,7 +8669,7 @@ ACMD(join) { } } clif->chsys_join(channel,sd); - + return true; } /* [Ind/Hercules] */ @@ -8755,7 +8721,6 @@ static inline void atcmd_channel_help(int fd, const char *command, bool can_crea clif->message(fd, atcmd_output); clif->message(fd, msg_txt(1463));// - adds or removes <option name> with <option value> to <channel name> channel } - } /* [Ind/Hercules] */ ACMD(channel) { @@ -8763,12 +8728,12 @@ ACMD(channel) { char subcmd[HCHSYS_NAME_LENGTH], sub1[HCHSYS_NAME_LENGTH], sub2[HCHSYS_NAME_LENGTH], sub3[HCHSYS_NAME_LENGTH]; unsigned char k = 0; sub1[0] = sub2[0] = sub3[0] = '\0'; - + if (!message || !*message || sscanf(message, "%19s %19s %19s %19s", subcmd, sub1, sub2, sub3) < 1) { atcmd_channel_help(fd,command,( hChSys.allow_user_channel_creation || pc_has_permission(sd, PC_PERM_HCHSYS_ADMIN) )); return true; } - + if (strcmpi(subcmd,"create") == 0 && (hChSys.allow_user_channel_creation || pc_has_permission(sd, PC_PERM_HCHSYS_ADMIN))) { // sub1 = channel name; sub2 = password; sub3 = unused if (sub1[0] != '#') { @@ -8787,19 +8752,18 @@ ACMD(channel) { clif->message(fd, atcmd_output); return false; } - + CREATE( channel, struct hChSysCh, 1 ); - clif->chsys_create(channel,sub1 + 1,sub2,0); - + channel->owner = sd->status.char_id; channel->type = hChSys_PRIVATE; - + if( !( channel->opt & hChSys_OPT_ANNOUNCE_JOIN ) ) { sprintf(atcmd_output, msg_txt(1403),sub1); // You're now in the '%s' channel clif->message(fd, atcmd_output); } - + clif->chsys_join(channel,sd); } else if (strcmpi(subcmd,"list") == 0) { // sub1 = list type; sub2 = unused; sub3 = unused @@ -8808,7 +8772,7 @@ ACMD(channel) { for (k = 0; k < hChSys.colors_count; k++) { unsigned short msg_len = 1; msg_len += sprintf(mout, "[ %s list colors ] : %s",command,hChSys.colors_name[k]); - + WFIFOHEAD(fd,msg_len + 12); WFIFOW(fd,0) = 0x2C1; WFIFOW(fd,2) = msg_len + 12; @@ -8845,19 +8809,19 @@ ACMD(channel) { clif->message(fd, msg_txt(1405));// Channel name must start with a '#' return false; } - + if (!(channel = strdb_get(clif->channel_db, sub1 + 1))) { sprintf(atcmd_output, msg_txt(1407), sub1);// Channel '%s' is not available clif->message(fd, atcmd_output); return false; } - + if (channel->owner != sd->status.char_id && !pc_has_permission(sd, PC_PERM_HCHSYS_ADMIN)) { sprintf(atcmd_output, msg_txt(1412), sub1);// You're not the owner of channel '%s' clif->message(fd, atcmd_output); return false; } - + for (k = 0; k < hChSys.colors_count; k++) { if (strcmpi(sub2, hChSys.colors_name[k]) == 0) break; @@ -8905,7 +8869,7 @@ ACMD(channel) { clif->message(fd, msg_txt(1405));// Channel name must start with a '#' return false; } - + for (k = 0; k < sd->channel_count; k++) { if (strcmpi(sub1+1,sd->channels[k]->name) == 0) break; @@ -8915,7 +8879,7 @@ ACMD(channel) { clif->message(fd, atcmd_output); return false; } - + sd->gcbind = sd->channels[k]; sprintf(atcmd_output, msg_txt(1431),sub1); // Your global chat is now bound to the '%s' channel clif->message(fd, atcmd_output); @@ -8925,34 +8889,34 @@ ACMD(channel) { clif->message(fd, msg_txt(1432));// Your global chat is not bound to any channel return false; } - + sprintf(atcmd_output, msg_txt(1433),sd->gcbind->name); // Your global chat is no longer bound to the '#%s' channel clif->message(fd, atcmd_output); - + sd->gcbind = NULL; } else if (strcmpi(subcmd,"ban") == 0) { // sub1 = channel name; sub2 = unused; sub3 = unused struct map_session_data *pl_sd = NULL; struct hChSysBanEntry *entry = NULL; char sub4[NAME_LENGTH]; ///< player name - + if (sub1[0] != '#') { clif->message(fd, msg_txt(1405));// Channel name must start with a '#' return false; } - + if (!(channel = strdb_get(clif->channel_db, sub1 + 1))) { sprintf(atcmd_output, msg_txt(1407), sub1);// Channel '%s' is not available clif->message(fd, atcmd_output); return false; } - + if (channel->owner != sd->status.char_id && !pc_has_permission(sd, PC_PERM_HCHSYS_ADMIN)) { sprintf(atcmd_output, msg_txt(1412), sub1);// You're not the owner of channel '%s' clif->message(fd, atcmd_output); return false; } - + if (!message || !*message || sscanf(message, "%19s %19s %23[^\n]", subcmd, sub1, sub4) < 3) { sprintf(atcmd_output, msg_txt(1434), sub4);// Player '%s' was not found clif->message(fd, atcmd_output); @@ -8964,59 +8928,53 @@ ACMD(channel) { clif->message(fd, atcmd_output); return false; } - + if (pc_has_permission(pl_sd, PC_PERM_HCHSYS_ADMIN)) { clif->message(fd, msg_txt(1464)); // Ban failed, not possible to ban this user. return false; } - + if (channel->banned && idb_exists(channel->banned,pl_sd->status.account_id)) { sprintf(atcmd_output, msg_txt(1465), pl_sd->status.name);// Player '%s' is already banned from this channel clif->message(fd, atcmd_output); return false; } - + if (!channel->banned) channel->banned = idb_alloc(DB_OPT_BASE|DB_OPT_ALLOW_NULL_DATA|DB_OPT_RELEASE_DATA); - + CREATE(entry, struct hChSysBanEntry, 1); - safestrncpy(entry->name, pl_sd->status.name, NAME_LENGTH); - idb_put(channel->banned, pl_sd->status.account_id, entry); - + clif->chsys_left(channel,pl_sd); - + sprintf(atcmd_output, msg_txt(1437),pl_sd->status.name,sub1); // Player '%s' has now been banned from '%s' channel clif->message(fd, atcmd_output); } else if (strcmpi(subcmd,"unban") == 0) { // sub1 = channel name; sub2 = unused; sub3 = unused struct map_session_data *pl_sd = NULL; char sub4[NAME_LENGTH]; ///< player name - + if (sub1[0] != '#') { clif->message(fd, msg_txt(1405));// Channel name must start with a '#' return false; } - if (!(channel = strdb_get(clif->channel_db, sub1 + 1))) { sprintf(atcmd_output, msg_txt(1407), sub1);// Channel '%s' is not available clif->message(fd, atcmd_output); return false; } - if (channel->owner != sd->status.char_id && !pc_has_permission(sd, PC_PERM_HCHSYS_ADMIN)) { sprintf(atcmd_output, msg_txt(1412), sub1);// You're not the owner of channel '%s' clif->message(fd, atcmd_output); return false; } - if (!channel->banned) { sprintf(atcmd_output, msg_txt(1439), sub1);// Channel '%s' has no banned players clif->message(fd, atcmd_output); return false; } - if (!message || !*message || sscanf(message, "%19s %19s %23[^\n]", subcmd, sub1, sub4) < 3) { sprintf(atcmd_output, msg_txt(1434), sub4);// Player '%s' was not found clif->message(fd, atcmd_output); @@ -9028,20 +8986,18 @@ ACMD(channel) { clif->message(fd, atcmd_output); return false; } - if (!idb_exists(channel->banned,pl_sd->status.account_id)) { sprintf(atcmd_output, msg_txt(1440), pl_sd->status.name);// Player '%s' is not banned from this channel clif->message(fd, atcmd_output); return false; } - + idb_remove(channel->banned, pl_sd->status.account_id); - if (!db_size(channel->banned)) { db_destroy(channel->banned); channel->banned = NULL; } - + sprintf(atcmd_output, msg_txt(1441),pl_sd->status.name,sub1); // Player '%s' has now been unbanned from the '%s' channel clif->message(fd, atcmd_output); } else if (strcmpi(subcmd,"unbanall") == 0) { @@ -9050,28 +9006,24 @@ ACMD(channel) { clif->message(fd, msg_txt(1405));// Channel name must start with a '#' return false; } - if (!(channel = strdb_get(clif->channel_db, sub1 + 1))) { sprintf(atcmd_output, msg_txt(1407), sub1);// Channel '%s' is not available clif->message(fd, atcmd_output); return false; } - if (channel->owner != sd->status.char_id && !pc_has_permission(sd, PC_PERM_HCHSYS_ADMIN)) { sprintf(atcmd_output, msg_txt(1412), sub1);// You're not the owner of channel '%s' clif->message(fd, atcmd_output); return false; } - if (!channel->banned) { sprintf(atcmd_output, msg_txt(1439), sub1);// Channel '%s' has no banned players clif->message(fd, atcmd_output); return false; } - db_destroy(channel->banned); channel->banned = NULL; - + sprintf(atcmd_output, msg_txt(1442),sub1); // Removed all bans from '%s' channel clif->message(fd, atcmd_output); } else if (strcmpi(subcmd,"banlist") == 0) { @@ -9084,19 +9036,16 @@ ACMD(channel) { clif->message(fd, msg_txt(1405));// Channel name must start with a '#' return false; } - if (!(channel = strdb_get(clif->channel_db, sub1 + 1))) { sprintf(atcmd_output, msg_txt(1407), sub1);// Channel '%s' is not available clif->message(fd, atcmd_output); return false; } - if (channel->owner != sd->status.char_id && !isA) { sprintf(atcmd_output, msg_txt(1412), sub1);// You're not the owner of channel '%s' clif->message(fd, atcmd_output); return false; } - if (!channel->banned) { sprintf(atcmd_output, msg_txt(1439), sub1);// Channel '%s' has no banned players clif->message(fd, atcmd_output); @@ -9104,22 +9053,19 @@ ACMD(channel) { } sprintf(atcmd_output, msg_txt(1443), channel->name);// -- '%s' ban list clif->message(fd, atcmd_output); - + iter = db_iterator(channel->banned); - for (data = iter->first(iter,&key); iter->exists(iter); data = iter->next(iter,&key)) { struct hChSysBanEntry * entry = DB->data2ptr(data); - + if (!isA) sprintf(atcmd_output, msg_txt(1444), entry->name);// - %s %s else sprintf(atcmd_output, msg_txt(1445), entry->name, key.i);// - %s (%d) - + clif->message(fd, atcmd_output); } - dbi_destroy(iter); - } else if (strcmpi(subcmd,"setopt") == 0) { // sub1 = channel name; sub2 = option name; sub3 = value const char* opt_str[3] = { @@ -9127,34 +9073,28 @@ ACMD(channel) { "JoinAnnounce", "MessageDelay", }; - if (sub1[0] != '#') { clif->message(fd, msg_txt(1405));// Channel name must start with a '#' return false; } - if (!(channel = strdb_get(clif->channel_db, sub1 + 1))) { sprintf(atcmd_output, msg_txt(1407), sub1);// Channel '%s' is not available clif->message(fd, atcmd_output); return false; } - if (channel->owner != sd->status.char_id && !pc_has_permission(sd, PC_PERM_HCHSYS_ADMIN)) { sprintf(atcmd_output, msg_txt(1412), sub1);// You're not the owner of channel '%s' clif->message(fd, atcmd_output); return false; } - if (sub2[0] == '\0') { clif->message(fd, msg_txt(1446));// You need to input a option return false; } - for (k = 1; k < 3; k++) { if (strcmpi(sub2,opt_str[k]) == 0) break; } - if (k == 3) { sprintf(atcmd_output, msg_txt(1447), sub2);// '%s' is not a known channel option clif->message(fd, atcmd_output); @@ -9165,7 +9105,6 @@ ACMD(channel) { } return false; } - if (sub3[0] == '\0') { if (k == hChSys_OPT_MSG_DELAY) { sprintf(atcmd_output, msg_txt(1466), opt_str[k]);// For '%s' you need the amount of seconds (from 0 to 10) @@ -9226,12 +9165,10 @@ ACMD(channel) { } } } - } } else { atcmd_channel_help(fd,command,( hChSys.allow_user_channel_creation || pc_has_permission(sd, PC_PERM_HCHSYS_ADMIN) )); } - return true; } /* debug only, delete after */ @@ -9243,7 +9180,7 @@ ACMD(fontcolor) { if( !message || !*message ) { for( k = 0; k < hChSys.colors_count; k++ ) { msg_len += sprintf(mout, "[ %s ] : %s",command,hChSys.colors_name[k]); - + WFIFOHEAD(fd,msg_len + 12); WFIFOW(fd,0) = 0x2C1; WFIFOW(fd,2) = msg_len + 12; @@ -9254,12 +9191,12 @@ ACMD(fontcolor) { } return false; } - + if( message[0] == '0' ) { sd->fontcolor = 0; return true; } - + for( k = 0; k < hChSys.colors_count; k++ ) { if( strcmpi(message,hChSys.colors_name[k]) == 0 ) break; @@ -9269,10 +9206,10 @@ ACMD(fontcolor) { clif->message(fd, atcmd_output); return false; } - + sd->fontcolor = k + 1; msg_len += sprintf(mout, "Color changed to '%s'",hChSys.colors_name[k]); - + WFIFOHEAD(fd,msg_len + 12); WFIFOW(fd,0) = 0x2C1; WFIFOW(fd,2) = msg_len + 12; @@ -9284,7 +9221,7 @@ ACMD(fontcolor) { } ACMD(searchstore){ int val = atoi(message); - + switch( val ) { case 0://EFFECTTYPE_NORMAL case 1://EFFECTTYPE_CASH @@ -9295,7 +9232,6 @@ ACMD(searchstore){ } searchstore->open(sd, 99, val); - return true; } ACMD(costume){ @@ -9318,7 +9254,7 @@ ACMD(costume){ #endif }; unsigned short k = 0, len = ARRAYLENGTH(names); - + if( !message || !*message ) { for( k = 0; k < len; k++ ) { if( sd->sc.data[name2id[k]] ) { @@ -9328,7 +9264,6 @@ ACMD(costume){ return true; } } - clif->message(sd->fd,msg_txt(1472)); for( k = 0; k < len; k++ ) { sprintf(atcmd_output,msg_txt(1471),names[k]);//-- %s @@ -9336,7 +9271,7 @@ ACMD(costume){ } return false; } - + for( k = 0; k < len; k++ ) { if( sd->sc.data[name2id[k]] ) { sprintf(atcmd_output,msg_txt(1470),names[k]);// You're already with a '%s' costume, type '@costume' to remove it. @@ -9344,7 +9279,7 @@ ACMD(costume){ return false; } } - + for( k = 0; k < len; k++ ) { if( strcmpi(message,names[k]) == 0 ) break; @@ -9354,9 +9289,9 @@ ACMD(costume){ clif->message(sd->fd,atcmd_output); return false; } - + sc_start(NULL,&sd->bl, name2id[k], 100, 0, -1); - + return true; } /* for debugging purposes (so users can easily provide us with debug info) */ @@ -9643,17 +9578,17 @@ void atcommand_basecommands(void) { ACMD_DEF(skdebug), }; int i; - + for( i = 0; i < ARRAYLENGTH(atcommand_base); i++ ) { if(!atcommand->add(atcommand_base[i].command,atcommand_base[i].func,false)) { // Should not happen if atcommand_base[] array is OK ShowDebug("atcommand_basecommands: duplicate ACMD_DEF for '%s'.\n", atcommand_base[i].command); continue; } } - + /* @commands from plugins */ HPM_map_atcommands(); - + return; } #undef ACMD_DEF @@ -9669,12 +9604,12 @@ bool atcommand_add(char *name,AtCommandFunc func, bool replace) { CREATE(cmd, AtCommandInfo, 1); strdb_put(atcommand->db, name, cmd); } - + safestrncpy(cmd->command, name, sizeof(cmd->command)); cmd->func = func; cmd->help = NULL; cmd->log = true; - + return true; } @@ -9868,7 +9803,7 @@ bool atcommand_exec(const int fd, struct map_session_data *sd, const char *messa if( battle_config.idletime_criteria & BCIDLE_ATCOMMAND ) sd->idletime = sockt->last_tick; - + //Clearing these to be used once more. memset(command, '\0', sizeof(command)); memset(params, '\0', sizeof(params)); @@ -9894,7 +9829,7 @@ bool atcommand_exec(const int fd, struct map_session_data *sd, const char *messa ) { // Check if self or character invoking; if self == character invoked, then self invoke. bool invokeFlag = ((*atcmd_msg == atcommand->at_symbol) ? 1 : 0); - + // Check if the command initiated is a character command if (*message == atcommand->char_symbol && (ssd = map->nick2sd(charname)) == NULL @@ -9904,10 +9839,10 @@ bool atcommand_exec(const int fd, struct map_session_data *sd, const char *messa clif->message(fd, output); return true; } - + if( binding->log ) /* log only if this command should be logged [Ind/Hercules] */ logs->atcommand(sd, atcmd_msg); - + npc->do_atcmd_event((invokeFlag ? sd : ssd), command, params, binding->npc_event); return true; } @@ -9945,7 +9880,7 @@ bool atcommand_exec(const int fd, struct map_session_data *sd, const char *messa } } } - + // Check if target is valid only if confirmed that player can use command. if (*message == atcommand->char_symbol && (ssd = map->nick2sd(charname)) == NULL @@ -10047,12 +9982,12 @@ void atcommand_config_read(const char* config_filename) { if (nolog != NULL) { int i = 0; int count = libconfig->setting_length(nolog); - + for (i = 0; i < count; ++i) { config_setting_t *command; const char *commandname = NULL; AtCommandInfo *commandinfo = NULL; - + command = libconfig->setting_get_elem(nolog, i); commandname = config_setting_name(command); if ( !( commandinfo = atcommand->exists(commandname) ) ) { @@ -10062,7 +9997,7 @@ void atcommand_config_read(const char* config_filename) { commandinfo->log = false; } } - + // Commands help // We only check if all commands exist help = libconfig->lookup(&atcommand_config, "help"); @@ -10091,7 +10026,7 @@ void atcommand_config_read(const char* config_filename) { } ShowStatus("Done reading '"CL_WHITE"%d"CL_RESET"' command aliases in '"CL_WHITE"%s"CL_RESET"'.\n", num_aliases, config_filename); - + libconfig->destroy(&atcommand_config); return; } @@ -10124,7 +10059,7 @@ void atcommand_db_load_groups(GroupSettings **groups, config_setting_t **command config_setting_t *commands = commands_[i]; int result = 0; int idx = -1; - + if (group == NULL) { ShowError("atcommand_db_load_groups: group is NULL\n"); continue; @@ -10135,12 +10070,12 @@ void atcommand_db_load_groups(GroupSettings **groups, config_setting_t **command ShowError("atcommand_db_load_groups: index (%d) out of bounds [0,%"PRIuS"]\n", idx, sz - 1); continue; } - + if (pcg->has_permission(group, PC_PERM_USE_ALL_COMMANDS)) { atcmd->at_groups[idx] = atcmd->char_groups[idx] = 1; continue; } - + if (commands != NULL) { config_setting_t *cmd = NULL; @@ -10170,28 +10105,28 @@ void atcommand_db_load_groups(GroupSettings **groups, config_setting_t **command bool atcommand_can_use(struct map_session_data *sd, const char *command) { AtCommandInfo *info = atcommand->get_info_byname(atcommand->check_alias(command + 1)); - + 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; } - + 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)); - + 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; } - + return false; } bool atcommand_hp_add(char *name, AtCommandFunc func) { @@ -10201,7 +10136,7 @@ bool atcommand_hp_add(char *name, AtCommandFunc func) { ShowDebug("atcommand_hp_add: Commands can't be added after server is ready, skipping '%s'...\n",name); return false; } - + return HPM_map_add_atcommand(name,func); } @@ -10246,7 +10181,7 @@ void do_init_atcommand(bool minimal) { atcommand->at_symbol = '@'; atcommand->char_symbol = '#'; atcommand->binding_count = 0; - + atcommand->doload(); } @@ -10256,15 +10191,15 @@ void do_final_atcommand(void) { void atcommand_defaults(void) { atcommand = &atcommand_s; - + atcommand->db = NULL; atcommand->alias_db = NULL; - + memset(atcommand->msg_table, 0, sizeof(atcommand->msg_table)); - + atcommand->init = do_init_atcommand; atcommand->final = do_final_atcommand; - + atcommand->exec = atcommand_exec; atcommand->create = atcommand_hp_add; atcommand->can_use = atcommand_can_use; diff --git a/src/map/battle.c b/src/map/battle.c index 73b563d4b..9ee4695f7 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -218,7 +218,7 @@ int battle_delay_damage_sub(int tid, int64 tick, int id, intptr_t data) { } src = map->id2bl(dat->src_id); - + //Check to see if you haven't teleported. [Skotlex] if( src && (target->type != BL_PC || ((TBL_PC*)target)->invincible_timer == INVALID_TIMER) @@ -239,7 +239,7 @@ int battle_delay_damage_sub(int tid, int64 tick, int id, intptr_t data) { status_fix_damage(target, target, dat->damage, dat->delay); map->freeblock_unlock(); } - + if( src && src->type == BL_PC && --((TBL_PC*)src)->delayed_damage == 0 && ((TBL_PC*)src)->state.hold_recalc ) { ((TBL_PC*)src)->state.hold_recalc = 0; status_calc_pc(((TBL_PC*)src),SCO_FORCE); @@ -292,7 +292,7 @@ int battle_delay_damage(int64 tick, int amotion, struct block_list *src, struct if( src->type == BL_PC ) { ((TBL_PC*)src)->delayed_damage++; } - + timer->add(tick+amotion, battle->delay_damage_sub, 0, (intptr_t)dat); return 0; @@ -437,13 +437,13 @@ int64 battle_calc_weapon_damage(struct block_list *src, struct block_list *bl, u sd = BL_CAST(BL_PC, src); damage = status->get_weapon_atk(src, watk, flag); - + if( sd ){ if( type == EQI_HAND_R ) damage = battle->calc_sizefix(sd, damage, EQI_HAND_R, size, flag&8); else damage = battle->calc_sizefix(sd, damage, EQI_HAND_L, size, flag&8); - + if( flag&2 && sd->bonus.arrow_atk ) damage += sd->bonus.arrow_atk; @@ -479,7 +479,7 @@ int64 battle_calc_weapon_damage(struct block_list *src, struct block_list *bl, u // attacker side damage = battle->calc_cardfix(BF_WEAPON, src, bl, nk, s_ele, s_ele_, damage, 2|(type == EQI_HAND_L), flag2); - + // target side damage = battle->calc_cardfix(BF_WEAPON, src, bl, nk, s_ele, s_ele_, damage, 0, flag2); @@ -516,7 +516,7 @@ int64 battle_calc_base_damage(struct block_list *src, struct block_list *bl, uin damage = batk + 3 * battle->calc_weapon_damage(src, bl, skill_id, skill_lv, &st->lhw, nk, n_ele, s_ele, s_ele_, status_get_size(bl), type, flag, flag2) / 4; else damage = (batk << 1) + battle->calc_weapon_damage(src, bl, skill_id, skill_lv, &st->rhw, nk, n_ele, s_ele, s_ele_, status_get_size(bl), type, flag, flag2); - + return damage; } int64 battle_calc_base_damage2(struct status_data *st, struct weapon_atk *wa, struct status_change *sc, unsigned short t_size, struct map_session_data *sd, int flag) { @@ -726,14 +726,14 @@ int64 battle_calc_masteryfix(struct block_list *src, struct block_list *target, nullpo_ret(src); nullpo_ret(target); - + sc = status->get_sc(src); sd = BL_CAST(BL_PC, src); tstatus = status->get_status_data(target); if ( !sd ) return damage; - + damage = battle->add_mastery(sd, target, damage, left); switch( skill_id ){ // specific skill masteries @@ -768,7 +768,7 @@ int64 battle_calc_masteryfix(struct block_list *src, struct block_list *target, damage += 40 * pc->checkskill(sd, RA_RESEARCHTRAP); break; } - + if( sc ){ // sc considered as masteries if(sc->data[SC_GN_CARTBOOST]) damage += 10 * sc->data[SC_GN_CARTBOOST]->val1; @@ -796,9 +796,11 @@ int64 battle_calc_masteryfix(struct block_list *src, struct block_list *target, else damage += sc->data[SC_GS_GATLINGFEVER]->val1; } - //if(sc->data[SC_SPECIALZONE]) - // damage += sc->data[SC_SPECIALZONE]->val2 >> 4; -#endif +#if 0 + if(sc->data[SC_SPECIALZONE]) + damage += sc->data[SC_SPECIALZONE]->val2 >> 4; +#endif // 0 +#endif // RENEWAL } // general skill masteries @@ -850,12 +852,12 @@ int64 battle_calc_masteryfix(struct block_list *src, struct block_list *target, *------------------------------------------*/ int64 battle_calc_elefix(struct block_list *src, struct block_list *target, uint16 skill_id, uint16 skill_lv, int64 damage, int nk, int n_ele, int s_ele, int s_ele_, bool left, int flag){ struct status_data *tstatus; - + nullpo_ret(src); nullpo_ret(target); tstatus = status->get_status_data(target); - + if( (nk&NK_NO_ELEFIX) || n_ele ) return damage; @@ -874,12 +876,12 @@ int64 battle_calc_elefix(struct block_list *src, struct block_list *target, uint damage += battle->attr_fix(src,target,50*skill_lv,ELE_NEUTRAL,tstatus->def_ele, tstatus->ele_lv); } } - + #ifndef RENEWAL { struct status_data *sstatus; struct status_change *sc; - + sstatus = status->get_status_data(src); sc = status->get_sc(src); @@ -898,8 +900,8 @@ int64 battle_calc_elefix(struct block_list *src, struct block_list *target, uint /*========================================== * Calculates card bonuses damage adjustments. * cflag(cardfix flag): - * &1 - calc for left hand. - * &2 - atker side cardfix(BF_WEAPON) otherwise target side(BF_WEAPON). + * &1 - calc for left hand. + * &2 - atker side cardfix(BF_WEAPON) otherwise target side(BF_WEAPON). *------------------------------------------*/ int64 battle_calc_cardfix(int attack_type, struct block_list *src, struct block_list *target, int nk, int s_ele, int s_ele_, int64 damage, int cflag, int wflag){ struct map_session_data *sd, *tsd; @@ -909,7 +911,7 @@ int64 battle_calc_cardfix(int attack_type, struct block_list *src, struct block_ if( !damage ) return 0; - + nullpo_ret(src); nullpo_ret(target); @@ -920,7 +922,7 @@ int64 battle_calc_cardfix(int attack_type, struct block_list *src, struct block_ sstatus = status->get_status_data(src); tstatus = status->get_status_data(target); s_race2 = status->get_race2(src); - + switch(attack_type){ case BF_MAGIC: if ( sd && !(nk&NK_NO_CARDFIX_ATK) ) { @@ -1133,7 +1135,7 @@ int64 battle_calc_cardfix(int attack_type, struct block_list *src, struct block_ } } cardfix = cardfix * (100-tsd->subsize[sstatus->size]) / 100; - cardfix = cardfix * (100-tsd->subrace2[s_race2]) / 100; + cardfix = cardfix * (100-tsd->subrace2[s_race2]) / 100; cardfix = cardfix * (100-tsd->subrace[sstatus->race]) / 100; cardfix = cardfix * (100-tsd->subrace[is_boss(src)?RC_BOSS:RC_NONBOSS]) / 100; if( sstatus->race != RC_DEMIHUMAN ) @@ -1211,13 +1213,13 @@ int64 battle_calc_defense(int attack_type, struct block_list *src, struct block_ struct map_session_data *sd, *tsd; struct status_change *sc, *tsc; int i; - + if( !damage ) return 0; - + nullpo_ret(src); nullpo_ret(target); - + sd = BL_CAST(BL_PC, src); tsd = BL_CAST(BL_PC, target); sstatus = status->get_status_data(src); @@ -1228,10 +1230,10 @@ int64 battle_calc_defense(int attack_type, struct block_list *src, struct block_ switch(attack_type){ case BF_WEAPON: { - /** Take note in RE - * def1 = equip def - * def2 = status def - **/ + /* Take note in RE + * def1 = equip def + * def2 = status def + */ defType def1 = status->get_def(target); //Don't use tstatus->def1 due to skill timer reductions. short def2 = tstatus->def2, vit_def; #ifdef RENEWAL @@ -1257,7 +1259,7 @@ int64 battle_calc_defense(int attack_type, struct block_list *src, struct block_ def1 -= def1 * i / 100; def2 -= def2 * i / 100; } - + if( battle_config.vit_penalty_type && battle_config.vit_penalty_target&target->type ) { unsigned char target_count; //256 max targets should be a sane max target_count = unit->counttargeted(target); @@ -1276,8 +1278,8 @@ int64 battle_calc_defense(int attack_type, struct block_list *src, struct block_ if(def2 < 1) def2 = 1; } //Vitality reduction from rodatazone: http://rodatazone.simgaming.net/mechanics/substats.php#def - if (tsd) //Sd vit-eq - { + if (tsd) { + //Sd vit-eq #ifndef RENEWAL //[VIT*0.5] + rnd([VIT*0.3], max([VIT*0.3],[VIT^2/150]-1)) vit_def = def2*(def2-15)/150; @@ -1301,7 +1303,7 @@ int64 battle_calc_defense(int attack_type, struct block_list *src, struct block_ vit_def = def2; #endif } - + if (battle_config.weapon_defense_type) { vit_def += def1*battle_config.weapon_defense_type; def1 = 0; @@ -1325,7 +1327,6 @@ int64 battle_calc_defense(int attack_type, struct block_list *src, struct block_ else damage = (int)((100.0f - def1 / (def1 + 400.0f) * 90.0f) / 100.0f * damage - vit_def); } - #else if( def1 > 100 ) def1 = 100; if( !(flag&1) ){ @@ -1341,7 +1342,7 @@ int64 battle_calc_defense(int attack_type, struct block_list *src, struct block_ break; case BF_MAGIC: - { + { defType mdef = tstatus->mdef; short mdef2= tstatus->mdef2; #ifdef RENEWAL @@ -1379,7 +1380,7 @@ int64 battle_calc_defense(int attack_type, struct block_list *src, struct block_ else damage = damage * (100-mdef)/100 - mdef2; #endif - } + } break; } return damage; @@ -1515,16 +1516,16 @@ int battle_calc_skillratio(int attack_type, struct block_list *src, struct block skillratio += 25; break; case WZ_VERMILION: - { - int interval = 0, per = interval, ratio = per; - while( (per++) < skill_lv ){ - ratio += interval; - if(per%3==0) interval += 20; - } - if( skill_lv > 9 ) - ratio -= 10; - skillratio += ratio; + { + int interval = 0, per = interval, ratio = per; + while( (per++) < skill_lv ){ + ratio += interval; + if(per%3==0) interval += 20; } + if( skill_lv > 9 ) + ratio -= 10; + skillratio += ratio; + } break; case NJ_HUUJIN: skillratio += 50; @@ -1913,7 +1914,8 @@ int battle_calc_skillratio(int attack_type, struct block_list *src, struct block break; #ifndef RENEWAL case MO_EXTREMITYFIST: - { //Overflow check. [Skotlex] + { + //Overflow check. [Skotlex] unsigned int ratio = skillratio + 100*(8 + st->sp/10); //You'd need something like 6K SP to reach this max, so should be fine for most purposes. if (ratio > 60000) ratio = 60000; //We leave some room here in case skillratio gets further increased. @@ -2082,10 +2084,10 @@ int battle_calc_skillratio(int attack_type, struct block_list *src, struct block case MO_BALKYOUNG: skillratio += 200; break; - case HFLI_MOON: //[orn] + case HFLI_MOON: //[orn] skillratio += 10 + 110 * skill_lv; break; - case HFLI_SBR44: //[orn] + case HFLI_SBR44: //[orn] skillratio += 100 * (skill_lv-1); break; case NPC_VAMPIRE_GIFT: @@ -2238,7 +2240,7 @@ int battle_calc_skillratio(int attack_type, struct block_list *src, struct block RE_LVL_DMOD(100); if( st->rhw.ele == ELE_WIND ) skillratio = skillratio * 125 / 100; - if ( distance_bl(src, target) > 2 ) // Will deal 75% damage outside of 5x5 area. + if ( distance_bl(src, target) > 2 ) // Will deal 75% damage outside of 5x5 area. skillratio = skillratio * 75 / 100; break; case SC_FATALMENACE: @@ -2354,7 +2356,7 @@ int battle_calc_skillratio(int attack_type, struct block_list *src, struct block case SR_FALLENEMPIRE:// ATK [(Skill Level x 150 + 100) x Caster Base Level / 150] % skillratio += 150 *skill_lv; RE_LVL_DMOD(150); - break; + break; case SR_TIGERCANNON:// ATK [((Caster consumed HP + SP) / 4) x Caster Base Level / 100] % { int hp = status_get_max_hp(src) * (10 + 2 * skill_lv) / 100, @@ -2723,7 +2725,7 @@ int64 battle_calc_damage(struct block_list *src,struct block_list *bl,struct Dam if (sce_d) { // If the target is too far away from the devotion caster, autoguard has no effect // Autoguard will be disabled later on - if ((d_bl = map->id2bl(sce_d->val1)) && check_distance_bl(bl, d_bl, sce_d->val3) + if ((d_bl = map->id2bl(sce_d->val1)) && check_distance_bl(bl, d_bl, sce_d->val3) && ((d_bl->type == BL_MER && ((TBL_MER*)d_bl)->master && ((TBL_MER*)d_bl)->master->bl.id == bl->id) || (d_bl->type == BL_PC && ((TBL_PC*)d_bl)->devotion[sce_d->val2] == bl->id)) ) { @@ -2785,8 +2787,8 @@ int64 battle_calc_damage(struct block_list *src,struct block_list *bl,struct Dam if(sc->data[SC_NJ_TATAMIGAESHI] && (flag&(BF_MAGIC|BF_LONG)) == BF_LONG) return 0; - if((sce=sc->data[SC_KAUPE]) && rnd()%100 < sce->val2) - { //Kaupe blocks damage (skill or otherwise) from players, mobs, homuns, mercenaries. + if ((sce=sc->data[SC_KAUPE]) && rnd()%100 < sce->val2) { + //Kaupe blocks damage (skill or otherwise) from players, mobs, homuns, mercenaries. clif->specialeffect(bl, 462, AREA); //Shouldn't end until Breaker's non-weapon part connects. if (skill_id != ASC_BREAKER || !(flag&BF_WEAPON)) @@ -3082,10 +3084,10 @@ int64 battle_calc_damage(struct block_list *src,struct block_list *bl,struct Dam status->change_spread(src, bl); if (sc->data[SC_SHIELDSPELL_REF] && sc->data[SC_SHIELDSPELL_REF]->val1 == 1 && damage > 0) skill->break_equip(bl,EQP_ARMOR,10000,BCT_ENEMY ); - if (sc->data[SC_STYLE_CHANGE] && rnd()%2) { - TBL_HOM *hd = BL_CAST(BL_HOM,bl); - if (hd) homun->addspiritball(hd, 10); - } + if (sc->data[SC_STYLE_CHANGE] && rnd()%2) { + TBL_HOM *hd = BL_CAST(BL_HOM,bl); + if (hd) homun->addspiritball(hd, 10); + } } /* no data claims these settings affect anything other than players */ if( damage && sd && bl->type == BL_PC ) { @@ -3162,7 +3164,7 @@ int64 battle_calc_bg_damage(struct block_list *src, struct block_list *bl, int64 if( bl->type == BL_MOB ) { struct mob_data* md = BL_CAST(BL_MOB, bl); - + if( flag&BF_SKILL && (md->class_ == MOBID_BLUE_CRYST || md->class_ == MOBID_PINK_CRYST) ) return 0; // Crystal cannot receive skill damage on battlegrounds } @@ -3220,7 +3222,6 @@ int64 battle_calc_gvg_damage(struct block_list *src,struct block_list *bl,int64 */ break; } - return damage; } @@ -3286,11 +3287,10 @@ int battle_adjust_skill_damage(int m, unsigned short skill_id) { if( map->list[m].skill_count ) { int i; ARR_FIND(0, map->list[m].skill_count, i, map->list[m].skills[i]->skill_id == skill_id ); - + if( i < map->list[m].skill_count ) { return map->list[m].skills[i]->modifier; } - } return 0; @@ -3314,9 +3314,9 @@ int battle_blewcount_bonus(struct map_session_data *sd, uint16 skill_id) { struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list *target,uint16 skill_id,uint16 skill_lv,int mflag) { int i, nk; short s_ele = 0; - unsigned int skillratio = 100; //Skill dmg modifiers. + unsigned int skillratio = 100; //Skill dmg modifiers. - TBL_PC *sd; + TBL_PC *sd; struct status_change *sc; struct Damage ad; struct status_data *sstatus = status->get_status_data(src); @@ -3324,7 +3324,7 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list struct { unsigned imdef : 1; unsigned infdef : 1; - } flag; + } flag; memset(&ad,0,sizeof(ad)); memset(&flag,0,sizeof(flag)); @@ -3424,8 +3424,8 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list //Adds an absolute value to damage. 100 = +100 damage #define MATK_ADD( a ) ( ad.damage+= (a) ) - switch (skill_id) - { //Calc base damage according to skill + switch (skill_id) { + //Calc base damage according to skill case AL_HEAL: case PR_BENEDICTIO: case PR_SANCTUARY: @@ -3444,7 +3444,7 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list case PR_TURNUNDEAD: //Undead check is on skill_castend_damageid code. i = 20*skill_lv + sstatus->luk + sstatus->int_ + status->get_lv(src) - + 200 - 200*tstatus->hp/tstatus->max_hp; // there is no changed in success chance in renewal. [malufett] + + 200 - 200*tstatus->hp/tstatus->max_hp; // there is no changed in success chance in renewal. [malufett] if(i > 700) i = 700; if(rnd()%1000 < i && !(tstatus->mode&MD_BOSS)) ad.damage = tstatus->hp; @@ -3468,7 +3468,7 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list break; default: { MATK_ADD( status->get_matk(src, 2) ); - + if (nk&NK_SPLASHSPLIT) { // Divide MATK in case of multiple targets skill if(mflag>0) ad.damage/= mflag; @@ -3565,11 +3565,11 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list )) flag.imdef = 1; } - + ad.damage = battle->calc_defense(BF_MAGIC, src, target, skill_id, skill_lv, ad.damage, (flag.imdef?1:0), 0); - - if (skill_id == NPC_EARTHQUAKE) - { //Adds atk2 to the damage, should be influenced by number of hits and skill-ratio, but not mdef reductions. [Skotlex] + + if (skill_id == NPC_EARTHQUAKE) { + //Adds atk2 to the damage, should be influenced by number of hits and skill-ratio, but not mdef reductions. [Skotlex] //Also divide the extra bonuses from atk2 based on the number in range [Kevin] if(mflag>0) ad.damage+= (sstatus->rhw.atk2*skillratio/100)/mflag; @@ -3613,7 +3613,7 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list } } #ifndef RENEWAL - ad.damage = battle->calc_cardfix(BF_MAGIC, src, target, nk, s_ele, 0, ad.damage, 0, ad.flag); + ad.damage = battle->calc_cardfix(BF_MAGIC, src, target, nk, s_ele, 0, ad.damage, 0, ad.flag); #endif } @@ -3660,7 +3660,7 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list * #ifdef RENEWAL struct status_change *sc = status->get_sc(src); #endif - + memset(&md,0,sizeof(md)); nullpo_retr(md, src); @@ -3781,7 +3781,7 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list * }*/ }else{ float vitfactor = 0.0f, ftemp; - + if( (vitfactor=(status_get_vit(target)-120.0f)) > 0) vitfactor = (vitfactor * (matk + atk) / 10) / status_get_vit(target); ftemp = max(0, vitfactor) + (targetVit * (matk + atk)) / 10; @@ -3807,8 +3807,8 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list * if( md.damage < 0 ) md.damage = 0; if( md.damage > INT_MAX>>1 ) - //Overflow prevention, will anyone whine if I cap it to a few billion? - //Not capped to INT_MAX to give some room for further damage increase. + //Overflow prevention, will anyone whine if I cap it to a few billion? + //Not capped to INT_MAX to give some room for further damage increase. md.damage = INT_MAX>>1; break; @@ -3830,7 +3830,7 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list * case GS_FLING: md.damage = sd?sd->status.job_level:status->get_lv(src); break; - case HVAN_EXPLOSION: //[orn] + case HVAN_EXPLOSION: //[orn] md.damage = sstatus->max_hp * (50 + 50 * skill_lv) / 100; break ; case ASC_BREAKER: @@ -3843,7 +3843,7 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list * int64 matk = battle->calc_magic_attack(src, target, skill_id, skill_lv, mflag).damage; short totaldef = status->get_total_def(target) + status->get_total_mdef(target); int64 atk = battle->calc_base_damage(src, target, skill_id, skill_lv, nk, false, s_ele, ELE_NEUTRAL, EQI_HAND_R, (sc && sc->data[SC_MAXIMIZEPOWER]?1:0)|(sc && sc->data[SC_WEAPONPERFECT]?8:0), md.flag); - + if( sc && sc->data[SC_EDP] ) ratio >>= 1; md.damage = (matk + atk) * ratio / 100; @@ -3874,7 +3874,7 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list * **/ case RA_CLUSTERBOMB: case RA_FIRINGTRAP: - case RA_ICEBOUNDTRAP: + case RA_ICEBOUNDTRAP: md.damage = skill_lv * sstatus->dex + sstatus->int_ * 5 ; RE_LVL_TMDMOD(); if(sd) @@ -3974,7 +3974,7 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list * #endif if( skill_id == KO_MUCHANAGE ) hitrate = (int)((10 - ((float)1 / (status_get_dex(src) + status_get_luk(src))) * 500) * ((float)skill_lv / 2 + 5)); - + hitrate = cap_value(hitrate, battle_config.min_hitrate, battle_config.max_hitrate); if(rnd()%100 < hitrate) @@ -4004,7 +4004,7 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list * } } #endif - md.damage = battle->calc_cardfix(BF_MISC, src, target, nk, s_ele, 0, md.damage, 0, md.flag); + md.damage = battle->calc_cardfix(BF_MISC, src, target, nk, s_ele, 0, md.damage, 0, md.flag); if(skill_id){ uint16 rskill;/* redirect skill id */ switch(skill_id){ @@ -4048,7 +4048,7 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list * switch( skill_id ) { case RA_FIRINGTRAP: - case RA_ICEBOUNDTRAP: + case RA_ICEBOUNDTRAP: if( md.damage == 1 ) break; case RA_CLUSTERBOMB: { @@ -4074,7 +4074,7 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list * *------------------------------------------*/ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list *target,uint16 skill_id,uint16 skill_lv,int wflag) { - unsigned int skillratio = 100; //Skill dmg modifiers. + unsigned int skillratio = 100; //Skill dmg modifiers. short temp=0; short s_ele, s_ele_; int i, nk; @@ -4087,21 +4087,21 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list struct status_data *sstatus = status->get_status_data(src); struct status_data *tstatus = status->get_status_data(target); struct { - unsigned hit : 1; //the attack Hit? (not a miss) - unsigned cri : 1; //Critical hit - unsigned idef : 1; //Ignore defense - unsigned idef2 : 1; //Ignore defense (left weapon) - unsigned pdef : 2; //Pierces defense (Investigate/Ice Pick) - unsigned pdef2 : 2; //1: Use def+def2/100, 2: Use def+def2/50 - unsigned infdef : 1; //Infinite defense (plants) - unsigned arrow : 1; //Attack is arrow-based - unsigned rh : 1; //Attack considers right hand (wd.damage) - unsigned lh : 1; //Attack considers left hand (wd.damage2) - unsigned weapon : 1; //It's a weapon attack (consider VVS, and all that) + unsigned hit : 1; ///< the attack Hit? (not a miss) + unsigned cri : 1; ///< Critical hit + unsigned idef : 1; ///< Ignore defense + unsigned idef2 : 1; ///< Ignore defense (left weapon) + unsigned pdef : 2; ///< Pierces defense (Investigate/Ice Pick) + unsigned pdef2 : 2; ///< 1: Use def+def2/100, 2: Use def+def2/50 + unsigned infdef : 1; ///< Infinite defense (plants) + unsigned arrow : 1; ///< Attack is arrow-based + unsigned rh : 1; ///< Attack considers right hand (wd.damage) + unsigned lh : 1; ///< Attack considers left hand (wd.damage2) + unsigned weapon : 1; ///< It's a weapon attack (consider VVS, and all that) #ifdef RENEWAL - unsigned tdef : 1; //Total defense reduction + unsigned tdef : 1; ///< Total defense reduction #endif - } flag; + } flag; memset(&wd,0,sizeof(wd)); memset(&flag,0,sizeof(flag)); @@ -4130,7 +4130,7 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list wd.blewcount=skill->get_blewcount(skill_id,skill_lv); wd.flag = BF_WEAPON; //Initial Flag wd.flag |= (skill_id||wflag)?BF_SKILL:BF_NORMAL; // Baphomet card's splash damage is counted as a skill. [Inkfish] - wd.dmg_lv=ATK_DEF; //This assumption simplifies the assignation later + wd.dmg_lv=ATK_DEF; //This assumption simplifies the assignation later nk = skill->get_nk(skill_id); if( !skill_id && wflag ) //If flag, this is splash damage from Baphomet Card and it always hits. nk |= NK_NO_CARDFIX_ATK|NK_IGNORE_FLEE; @@ -4218,11 +4218,11 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list if( sc && sc->data[SC_BANDING] && sc->data[SC_BANDING]->val2 > 3 ) wd.div_ = sc->data[SC_BANDING]->val2; break; - + case MO_INVESTIGATE: flag.pdef = flag.pdef2 = 2; break; - + case RA_AIMEDBOLT: if( tsc && (tsc->data[SC_WUGBITE] || tsc->data[SC_ANKLESNARE] || tsc->data[SC_ELECTRICSHOCKER]) ) wd.div_ = tstatus->size + 2 + ( (rnd()%100 < 50-tstatus->size*10) ? 1 : 0 ); @@ -4235,8 +4235,8 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list } } else //Range for normal attacks. wd.flag |= flag.arrow?BF_LONG:BF_SHORT; - if ( (!skill_id || skill_id == PA_SACRIFICE) && tstatus->flee2 && rnd()%1000 < tstatus->flee2 ) - { //Check for Lucky Dodge + if ((!skill_id || skill_id == PA_SACRIFICE) && tstatus->flee2 && rnd()%1000 < tstatus->flee2) { + //Check for Lucky Dodge wd.type=0x0b; wd.dmg_lv=ATK_LUCKY; if (wd.div_ < 0) wd.div_*=-1; @@ -4271,7 +4271,7 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list break; case LG_HESPERUSLIT: if ( sc && sc->data[SC_BANDING] && sc->data[SC_BANDING]->val2 == 5 ) - s_ele = ELE_HOLY; // Banding with 5 RGs: change atk element to Holy. + s_ele = ELE_HOLY; // Banding with 5 RGs: change atk element to Holy. break; } @@ -4283,8 +4283,8 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list n_ele = false; } - if(!skill_id) - { //Skills ALWAYS use ONLY your right-hand weapon (tested on Aegis 10.2) + if(!skill_id) { + //Skills ALWAYS use ONLY your right-hand weapon (tested on Aegis 10.2) if (sd && sd->weapontype1 == 0 && sd->weapontype2 > 0) { flag.rh=0; @@ -4294,11 +4294,13 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list flag.lh=1; } - if( sd && !skill_id ) { //Check for double attack. - if( ( ( skill_lv = pc->checkskill(sd,TF_DOUBLE) ) > 0 && sd->weapontype1 == W_DAGGER ) - || ( sd->bonus.double_rate > 0 && sd->weapontype1 != W_FIST ) //Will fail bare-handed - || ( sc && sc->data[SC_KAGEMUSYA] && sd->weapontype1 != W_FIST )) // Need confirmation - { //Success chance is not added, the higher one is used [Skotlex] + if (sd && !skill_id) { + //Check for double attack. + if (( (skill_lv=pc->checkskill(sd,TF_DOUBLE)) > 0 && sd->weapontype1 == W_DAGGER ) + || ( sd->bonus.double_rate > 0 && sd->weapontype1 != W_FIST ) //Will fail bare-handed + || ( sc && sc->data[SC_KAGEMUSYA] && sd->weapontype1 != W_FIST ) // Need confirmation + ) { + //Success chance is not added, the higher one is used [Skotlex] if( rnd()%100 < ( 5*skill_lv > sd->bonus.double_rate ? 5*skill_lv : sc && sc->data[SC_KAGEMUSYA]?sc->data[SC_KAGEMUSYA]->val1*3:sd->bonus.double_rate ) ) { wd.div_ = skill->get_num(TF_DOUBLE,skill_lv?skill_lv:1); @@ -4400,7 +4402,8 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list flag.idef = flag.idef2 = #endif flag.hit = 1; - } else { //Check for Perfect Hit + } else { + //Check for Perfect Hit if(sd && sd->bonus.perfect_hit > 0 && rnd()%100 < sd->bonus.perfect_hit) flag.hit = 1; if (sc && sc->data[SC_FUSION]) { @@ -4423,14 +4426,13 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list flag.hit = 1; } - if (!flag.hit) - { //Hit/Flee calculation - short - flee = tstatus->flee, + if (!flag.hit) { + //Hit/Flee calculation + short flee = tstatus->flee; #ifdef RENEWAL - hitrate = 0; //Default hitrate + short hitrate = 0; //Default hitrate #else - hitrate = 80; //Default hitrate + short hitrate = 80; //Default hitrate #endif if(battle_config.agi_penalty_type && battle_config.agi_penalty_target&target->type) { @@ -4457,9 +4459,8 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list if( sd ) //in Renewal hit bonus from Vultures Eye is not anymore shown in status window hitrate += pc->checkskill(sd,AC_VULTURE); #endif - if(skill_id) - switch(skill_id) - { //Hit skill modifiers + switch(skill_id) { + //Hit skill modifiers //It is proven that bonus is applied on final hitrate, not hit. case SM_BASH: case MS_BASH: @@ -4530,10 +4531,10 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list } else flag.hit = 1; - } //End hit/miss calculation + } //End hit/miss calculation - if (flag.hit && !flag.infdef) //No need to do the math for plants - { //Hitting attack + if (flag.hit && !flag.infdef) { //No need to do the math for plants + //Hitting attack //Assuming that 99% of the cases we will not need to check for the flag.rh... we don't. //ATK_RATE scales the damage. 100 = no change. 50 is halved, 200 is doubled, etc @@ -4551,8 +4552,8 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list #define GET_NORMAL_ATTACK( f ) ( wd.damage = battle->calc_base_damage(src, target, skill_id, skill_lv, nk, n_ele, s_ele, s_ele_, EQI_HAND_R, (f), wd.flag) ) #define GET_NORMAL_ATTACK2( f ) ( wd.damage2 = battle->calc_base_damage(src, target, skill_id, skill_lv, nk, n_ele, s_ele, s_ele_, EQI_HAND_L, (f), wd.flag) ) #endif - switch (skill_id) - { //Calc base damage according to skill + switch (skill_id) { + //Calc base damage according to skill case PA_SACRIFICE: wd.damage = sstatus->max_hp* 9/100; wd.damage2 = 0; @@ -4584,7 +4585,7 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list GET_NORMAL_ATTACK( (sc && sc->data[SC_MAXIMIZEPOWER]?1:0)|(sc && sc->data[SC_WEAPONPERFECT]?8:0) ); wd.damage += battle->calc_masteryfix(src, target, skill_id, skill_lv, 4 * skill_lv + (sd ? sd->bonus.arrow_atk : 0), wd.div_, 0, flag.weapon) - status->get_total_def(target); break; - case MO_EXTREMITYFIST: // [malufett] + case MO_EXTREMITYFIST: // [malufett] { short totaldef = status->get_total_def(target); GET_NORMAL_ATTACK( (sc && sc->data[SC_MAXIMIZEPOWER]?1:0)|8 ); @@ -4636,7 +4637,7 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list } else ATK_ADD(sstatus->rhw.atk2); //Else use Atk2 break; - case HFLI_SBR44: //[orn] + case HFLI_SBR44: //[orn] if(src->type == BL_HOM) { wd.damage = ((TBL_HOM*)src)->homunculus.intimacy ; break; @@ -4702,7 +4703,7 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list #endif } break; - } //End default case + } //End default case } //End switch(skill_id) if( sc && skill_id != PA_SACRIFICE && sc->data[SC_UNLIMIT] && (wd.flag&(BF_LONG|BF_MAGIC)) == BF_LONG) { @@ -4745,12 +4746,12 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list GET_NORMAL_ATTACK( (sc && sc->data[SC_MAXIMIZEPOWER]?1:0)|(sc && sc->data[SC_WEAPONPERFECT]?8:0) ); wd.damage = wd.damage * 70 / 100; //n_ele = true; // FIXME: This is has no effect if it's after GET_NORMAL_ATTACK (was this intended, or was it supposed to be put above?) - + if (sd && index >= 0 && sd->inventory_data[index] && sd->inventory_data[index]->type == IT_WEAPON) ATK_ADD(sd->inventory_data[index]->weight * 7 / 100); - + switch (tstatus->size) { case SZ_SMALL: //Small: 115% ATK_RATE(115); @@ -4862,7 +4863,6 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list if( sc->data[SC_TRUESIGHT] ) ATK_ADDRATE(2*sc->data[SC_TRUESIGHT]->val1); #endif - #ifndef RENEWAL_EDP if( sc->data[SC_EDP] ){ switch(skill_id){ @@ -4967,8 +4967,8 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list } } - if (skill_id != CR_GRANDCROSS && skill_id != NPC_GRANDDARKNESS) - { //Ignore Defense? + if (skill_id != CR_GRANDCROSS && skill_id != NPC_GRANDDARKNESS) { + //Ignore Defense? if (!flag.idef && ( sd->right_weapon.ignore_def_ele & (1<<tstatus->def_ele) || sd->right_weapon.ignore_def_race & (1<<tstatus->race) || @@ -5010,8 +5010,8 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list damage_div_fix(wd.damage, wd.div_); #endif //Post skill/vit reduction damage increases - if( sc ) - { //SC skill damages + if (sc) { + //SC skill damages if(sc->data[SC_AURABLADE] #ifndef RENEWAL && skill_id != LK_SPIRALPIERCE && skill_id != ML_SPIRALPIERCE @@ -5023,7 +5023,7 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list #endif ATK_ADD(20*lv); } - + if( !skill_id ) { if( sc->data[SC_ENCHANTBLADE] ) { //[( ( Skill Lv x 20 ) + 100 ) x ( casterBaseLevel / 150 )] + casterInt @@ -5035,7 +5035,6 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list if( sc->data[SC_GIANTGROWTH] && rnd()%100 < 15 ) ATK_ADDRATE(200); // Triple Damage } - } #ifndef RENEWAL //Refine bonus @@ -5065,7 +5064,7 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list ATK_ADDRATE(40); #endif } //Here ends flag.hit section, the rest of the function applies to both hitting and missing attacks - else if(wd.div_ < 0) //Since the attack missed... + else if(wd.div_ < 0) //Since the attack missed... wd.div_ *= -1; #ifndef RENEWAL if(sd && (temp=pc->checkskill(sd,BS_WEAPONRESEARCH)) > 0) @@ -5113,9 +5112,9 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list } //Card Fix, sd side - wd.damage = battle->calc_cardfix(BF_WEAPON, src, target, nk, s_ele, s_ele_, wd.damage, 2, wd.flag); - if( flag.lh ) - wd.damage2 = battle->calc_cardfix(BF_WEAPON, src, target, nk, s_ele, s_ele_, wd.damage2, 3, wd.flag); + wd.damage = battle->calc_cardfix(BF_WEAPON, src, target, nk, s_ele, s_ele_, wd.damage, 2, wd.flag); + if( flag.lh ) + wd.damage2 = battle->calc_cardfix(BF_WEAPON, src, target, nk, s_ele, s_ele_, wd.damage2, 3, wd.flag); if( skill_id == CR_SHIELDBOOMERANG || skill_id == PA_SHIELDCHAIN ) { //Refine bonus applies after cards and elements. @@ -5125,8 +5124,8 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list } } #endif - //Card Fix, tsd side - if(tsd){ //if player on player then it was already measured above + //Card Fix, tsd side + if(tsd){ //if player on player then it was already measured above wd.damage = battle->calc_cardfix(BF_WEAPON, src, target, nk, s_ele, s_ele_, wd.damage, (flag.lh?1:0), wd.flag); } if( flag.infdef ) { //Plants receive 1 damage when hit @@ -5152,12 +5151,14 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list } if (sd) { - if (!flag.rh && flag.lh) { //Move lh damage to the rh + if (!flag.rh && flag.lh) { + //Move lh damage to the rh wd.damage = wd.damage2; wd.damage2 = 0; flag.rh=1; flag.lh=0; - } else if(flag.rh && flag.lh) { //Dual-wield + } else if(flag.rh && flag.lh) { + //Dual-wield if (wd.damage) { temp = pc->checkskill(sd,AS_RIGHT) * 10; if( (sd->class_&MAPID_UPPERMASK) == MAPID_KAGEROUOBORO ) @@ -5237,7 +5238,7 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list if( wd.damage + wd.damage2 ) { //There is a total damage value int64 damage = wd.damage + wd.damage2; - + if(!wd.damage2) { wd.damage = battle->calc_damage(src,target,&wd,wd.damage,skill_id,skill_lv); if( map_flag_gvg2(target->m) ) @@ -5284,9 +5285,7 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list } else battle->reflect_damage(target, src, &wd, skill_id); - } - } //Reject Sword bugreport:4493 by Daegaladh if(wd.damage && tsc && tsc->data[SC_SWORDREJECT] && @@ -5304,7 +5303,8 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list status_change_end(target, SC_SWORDREJECT, INVALID_TIMER); } #ifndef RENEWAL - if(skill_id == ASC_BREAKER) { //Breaker's int-based damage (a misc attack?) + if(skill_id == ASC_BREAKER) { + //Breaker's int-based damage (a misc attack?) struct Damage md = battle->calc_misc_attack(src, target, skill_id, skill_lv, wflag); wd.damage += md.damage; } @@ -5329,7 +5329,7 @@ struct Damage battle_calc_attack(int attack_type,struct block_list *bl,struct bl memset(&d,0,sizeof(d)); break; } - + #ifdef HMAP_ZONE_DAMAGE_CAP_TYPE if( target && skill_id ) { int i; @@ -5350,7 +5350,7 @@ struct Damage battle_calc_attack(int attack_type,struct block_list *bl,struct bl } } #endif - + if( d.damage + d.damage2 < 1 ) { //Miss/Absorbed //Weapon attacks should go through to cause additional effects. if (d.dmg_lv == ATK_DEF /*&& attack_type&(BF_MAGIC|BF_MISC)*/) // Isn't it that additional effects don't apply if miss? @@ -5396,8 +5396,6 @@ void battle_reflect_damage(struct block_list *target, struct block_list *src, st sc = NULL; if( sc ) { - - if (wd->flag & BF_SHORT && !(skill->get_inf(skill_id) & (INF_GROUND_SKILL | INF_SELF_SKILL))) { if( sc->data[SC_CRESCENTELBOW] && !is_boss(src) && rnd()%100 < sc->data[SC_CRESCENTELBOW]->val2 ){ //ATK [{(Target HP / 100) x Skill Level} x Caster Base Level / 125] % + [Received damage x {1 + (Skill Level x 0.2)}] @@ -5468,7 +5466,7 @@ void battle_reflect_damage(struct block_list *target, struct block_list *src, st if (sce_d && sce_d->val1) d_bl = map->id2bl(sce_d->val1); - + if( sc->data[SC_REFLECTSHIELD] && skill_id != WS_CARTTERMINATION && skill_id != GS_DESPERADO && !(d_bl && !(wd->flag&BF_SKILL)) // It should not be a basic attack if the target is under devotion && !(d_bl && sce_d && !check_distance_bl(target, d_bl, sce_d->val3)) // It should not be out of range if the target is under devotion @@ -6096,7 +6094,7 @@ int battle_check_target( struct block_list *src, struct block_list *target,int f if (flag&BCT_ENEMY && ( map->getcell(m,src->x,src->y,CELL_CHKBASILICA) || map->getcell(m,target->x,target->y,CELL_CHKBASILICA) ) ) { return -1; } - + //t_bl/s_bl hold the 'master' of the attack, while src/target are the actual //objects involved. if( (t_bl = battle->get_master(target)) == NULL ) @@ -6135,7 +6133,8 @@ int battle_check_target( struct block_list *src, struct block_list *target,int f if(((((TBL_MOB*)target)->special_state.ai == 2 || //Marine Spheres (((TBL_MOB*)target)->special_state.ai == 3 && battle_config.summon_flora&1)) && //Floras s_bl->type == BL_PC && src->type != BL_MOB) || (((TBL_MOB*)target)->special_state.ai == 4 && t_bl->id != s_bl->id)) //Zanzoe - { //Targetable by players + { + //Targetable by players state |= BCT_ENEMY; strip_enemy = 0; } @@ -6192,8 +6191,10 @@ int battle_check_target( struct block_list *src, struct block_list *target,int f su->group->skill_id == GN_WALLOFTHORN) { state |= BCT_ENEMY; strip_enemy = 0; - } else //Excepting traps and icewall, you should not be able to target skills. + } else { + //Excepting traps and icewall, you should not be able to target skills. return 0; + } } break; //Valid targets with no special checks here. @@ -6204,7 +6205,7 @@ int battle_check_target( struct block_list *src, struct block_list *target,int f //All else not specified is an invalid target. default: return 0; - } //end switch actual target + } //end switch actual target switch( t_bl->type ) { //Checks on target master case BL_PC: @@ -6350,7 +6351,7 @@ int battle_check_target( struct block_list *src, struct block_list *target,int f if( flag&(BCT_PARTY|BCT_ENEMY) ) { int s_party = status->get_party_id(s_bl); int s_guild = status->get_guild_id(s_bl); - + if( s_party && s_party == status->get_party_id(t_bl) && !(map->list[m].flag.pvp && map->list[m].flag.pvp_noparty) && !(map_flag_gvg(m) && map->list[m].flag.gvg_noparty && !( s_guild && s_guild == status->get_guild_id(t_bl) )) @@ -6399,7 +6400,7 @@ int battle_check_target( struct block_list *src, struct block_list *target,int f if(s_guild && t_guild && (s_guild == t_guild || (!(flag&BCT_SAMEGUILD) && guild->isallied(s_guild, t_guild)))) state |= BCT_GUILD; } - } //end non pvp/gvg chk rivality + } //end non pvp/gvg chk rivality if( !state ) //If not an enemy, nor a guild, nor party, nor yourself, it's neutral. state = BCT_NEUTRAL; @@ -6513,7 +6514,7 @@ static const struct battle_data { { "monster_active_enable", &battle_config.monster_active_enable, 1, 0, 1, }, { "monster_damage_delay_rate", &battle_config.monster_damage_delay_rate, 100, 0, INT_MAX, }, { "monster_loot_type", &battle_config.monster_loot_type, 0, 0, 1, }, -// { "mob_skill_use", &battle_config.mob_skill_use, 1, 0, 1, }, //Deprecated + //{ "mob_skill_use", &battle_config.mob_skill_use, 1, 0, 1, }, //Deprecated { "mob_skill_rate", &battle_config.mob_skill_rate, 100, 0, INT_MAX, }, { "mob_skill_delay", &battle_config.mob_skill_delay, 100, 0, INT_MAX, }, { "mob_count_rate", &battle_config.mob_count_rate, 100, 0, INT_MAX, }, @@ -6783,7 +6784,7 @@ static const struct battle_data { { "invincible.nodamage", &battle_config.invincible_nodamage, 0, 0, 1, }, { "mob_slave_keep_target", &battle_config.mob_slave_keep_target, 0, 0, 1, }, { "autospell_check_range", &battle_config.autospell_check_range, 0, 0, 1, }, - { "knockback_left", &battle_config.knockback_left, 1, 0, 1, }, + { "knockback_left", &battle_config.knockback_left, 1, 0, 1, }, { "client_reshuffle_dice", &battle_config.client_reshuffle_dice, 0, 0, 1, }, { "client_sort_storage", &battle_config.client_sort_storage, 0, 0, 1, }, { "feature.buying_store", &battle_config.feature_buying_store, 1, 0, 1, }, @@ -6834,8 +6835,8 @@ static const struct battle_data { { "mon_trans_disable_in_gvg", &battle_config.mon_trans_disable_in_gvg, 0, 0, 1, }, { "case_sensitive_aegisnames", &battle_config.case_sensitive_aegisnames, 1, 0, 1, }, - { "guild_castle_invite", &battle_config.guild_castle_invite, 0, 0, 1, }, - { "guild_castle_expulsion", &battle_config.guild_castle_expulsion, 0, 0, 1, }, + { "guild_castle_invite", &battle_config.guild_castle_invite, 0, 0, 1, }, + { "guild_castle_expulsion", &battle_config.guild_castle_expulsion, 0, 0, 1, }, { "song_timer_reset", &battle_config.song_timer_reset, 0, 0, 1, }, { "snap_dodge", &battle_config.snap_dodge, 0, 0, 1, }, { "monster_chase_refresh", &battle_config.mob_chase_refresh, 1, 0, 30, }, @@ -6882,7 +6883,7 @@ void Hercules_report(char* date, char *time_c) { /* we get the current time */ time(&curtime); strftime(timestring, 24, "%Y-%m-%d %H:%M:%S", localtime(&curtime)); - + #ifdef CIRCULAR_AREA config |= C_CIRCULAR_AREA; #endif @@ -6894,7 +6895,7 @@ void Hercules_report(char* date, char *time_c) { #ifdef CONSOLE_INPUT config |= C_CONSOLE_INPUT; #endif - + #ifdef SCRIPT_CALLFUNC_CHECK config |= C_SCRIPT_CALLFUNC_CHECK; #endif @@ -6938,7 +6939,7 @@ void Hercules_report(char* date, char *time_c) { #ifdef PACKETVER_RE config |= C_PACKETVER_RE; #endif - + /* non-define part */ if( map->db_use_sql_item_db ) config |= C_SQL_DB_ITEM; @@ -7085,7 +7086,7 @@ void battle_adjust_conf(void) { battle_config.feature_search_stores = 0; } #endif - + #if PACKETVER < 20130724 if( battle_config.feature_banking ) { ShowWarning("conf/battle/feature.conf banking is enabled but it requires PACKETVER 2013-07-24 or newer, disabling...\n"); @@ -7099,7 +7100,7 @@ void battle_adjust_conf(void) { battle_config.feature_roulette = 0; } #endif - + #if PACKETVER > 20120000 && PACKETVER < 20130515 /* exact date (when it started) not known */ if( battle_config.feature_auction == 1 ) { ShowWarning("conf/battle/feature.conf:feature.auction is enabled but it is not stable on PACKETVER "EXPAND_AND_QUOTE(PACKETVER)", disabling...\n"); @@ -7178,15 +7179,15 @@ void do_final_battle(void) { /* initialize the interface */ void battle_defaults(void) { battle = &battle_s; - + battle->bc = &battle_config; - + memset(battle->attr_fix_table, 0, sizeof(battle->attr_fix_table)); battle->delay_damage_ers = NULL; - + battle->init = do_init_battle; battle->final = do_final_battle; - + battle->calc_attack = battle_calc_attack; battle->calc_damage = battle_calc_damage; battle->calc_gvg_damage = battle_calc_gvg_damage; diff --git a/src/map/battle.h b/src/map/battle.h index c44e3e19d..ad879bd1a 100644 --- a/src/map/battle.h +++ b/src/map/battle.h @@ -28,23 +28,24 @@ struct status_data; #define MIN_CLOTH_COLOR (battle->bc->min_cloth_color) #define MAX_CLOTH_COLOR (battle->bc->max_cloth_color) -#define is_boss(bl) (status_get_mode(bl)&MD_BOSS) // Can refine later [Aru] +#define is_boss(bl) (status_get_mode(bl)&MD_BOSS) // Can refine later [Aru] /** * Enumerations **/ -enum { // Flag of the final calculation - BF_WEAPON = 0x0001, - BF_MAGIC = 0x0002, - BF_MISC = 0x0004, - BF_SHORT = 0x0010, - BF_LONG = 0x0040, - BF_SKILL = 0x0100, - BF_NORMAL = 0x0200, - BF_WEAPONMASK=0x000f, - BF_RANGEMASK= 0x00f0, - BF_SKILLMASK= 0x0f00, +enum { + // Flag of the final calculation + BF_WEAPON = 0x0001, + BF_MAGIC = 0x0002, + BF_MISC = 0x0004, + BF_SHORT = 0x0010, + BF_LONG = 0x0040, + BF_SKILL = 0x0100, + BF_NORMAL = 0x0200, + BF_WEAPONMASK = 0x000f, + BF_RANGEMASK = 0x00f0, + BF_SKILLMASK = 0x0f00, }; // state of a single attack attempt; used in flee/def penalty calculations when mobbed @@ -62,17 +63,17 @@ enum e_battle_check_target { //New definitions [Skotlex] BCT_SELF = 0x010000, BCT_ENEMY = 0x020000, BCT_PARTY = 0x040000, - BCT_GUILDALLY = 0x080000, // Only allies, NOT guildmates + BCT_GUILDALLY = 0x080000, ///< Only allies, NOT guildmates BCT_NEUTRAL = 0x100000, - BCT_SAMEGUILD = 0x200000, // No Guild Allies - - BCT_GUILD = 0x280000, // Guild AND allies (BCT_SAMEGUILD|BCT_GUILDALLY) - - BCT_NOGUILD = 0x170000, // This should be (~BCT_GUILD&BCT_ALL) - BCT_NOPARTY = 0x3b0000, // This should be (~BCT_PARTY&BCT_ALL) - BCT_NOENEMY = 0x3d0000, // This should be (~BCT_ENEMY&BCT_ALL) - - BCT_ALL = 0x3f0000, // Sum of BCT_NOONE to BCT_SAMEGUILD + BCT_SAMEGUILD = 0x200000, ///< No Guild Allies + + BCT_GUILD = 0x280000, ///< Guild AND allies (BCT_SAMEGUILD|BCT_GUILDALLY) + + BCT_NOGUILD = 0x170000, ///< This must be (~BCT_GUILD&BCT_ALL) + BCT_NOPARTY = 0x3b0000, ///< This must be (~BCT_PARTY&BCT_ALL) + BCT_NOENEMY = 0x3d0000, ///< This must be (~BCT_ENEMY&BCT_ALL) + + BCT_ALL = 0x3f0000, ///< Sum of BCT_NOONE to BCT_SAMEGUILD }; /** @@ -86,7 +87,7 @@ struct Damage { int amotion,dmotion; int blewcount; //nb of knockback int flag; //chk BF_* flag, (enum below) - enum damage_lv dmg_lv; //ATK_LUCKY,ATK_FLEE,ATK_DEF + enum damage_lv dmg_lv; //ATK_LUCKY,ATK_FLEE,ATK_DEF }; struct Battle_Config { @@ -147,12 +148,12 @@ struct Battle_Config { int monster_active_enable; int monster_damage_delay_rate; int monster_loot_type; - int mob_skill_rate; //[Skotlex] - int mob_skill_delay; //[Skotlex] + int mob_skill_rate; //[Skotlex] + int mob_skill_delay; //[Skotlex] int mob_count_rate; int no_spawn_on_player; //[Skotlex] int force_random_spawn; //[Skotlex] - int mob_spawn_delay, plant_spawn_delay, boss_spawn_delay; // [Skotlex] + int mob_spawn_delay, plant_spawn_delay, boss_spawn_delay; // [Skotlex] int slaves_inherit_mode; int slaves_inherit_speed; int summons_trigger_autospells; @@ -169,7 +170,7 @@ struct Battle_Config { int emergency_call; int guild_aura; int pc_invincible_time; - + int pet_catch_rate; int pet_rename; int pet_friendly_rate; @@ -178,7 +179,7 @@ struct Battle_Config { int pet_status_support; int pet_attack_support; int pet_damage_support; - int pet_support_min_friendly; //[Skotlex] + int pet_support_min_friendly; //[Skotlex] int pet_equip_min_friendly; int pet_support_rate; int pet_attack_exp_to_master; @@ -189,7 +190,7 @@ struct Battle_Config { int pet_max_atk2; //[Skotlex] int pet_no_gvg; //Disables pets in gvg. [Skotlex] int pet_equip_required; - + int skill_min_damage; int finger_offensive_type; int heal_exp; @@ -199,11 +200,11 @@ struct Battle_Config { int shop_exp; int combo_delay_rate; int item_check; - int item_use_interval; //[Skotlex] + int item_use_interval; //[Skotlex] int cashfood_use_interval; int wedding_modifydisplay; - int wedding_ignorepalette; //[Skotlex] - int xmas_ignorepalette; // [Valaris] + int wedding_ignorepalette; //[Skotlex] + int xmas_ignorepalette; // [Valaris] int summer_ignorepalette; // [Zephyrus] int hanbok_ignorepalette; int natural_healhp_interval; @@ -212,7 +213,7 @@ struct Battle_Config { int natural_heal_weight_rate; int arrow_decrement; int max_aspd; - int max_walk_speed; //Maximum walking speed after buffs [Skotlex] + int max_walk_speed; //Maximum walking speed after buffs [Skotlex] int max_hp; int max_sp; int max_lv, aura_lv; @@ -224,8 +225,8 @@ struct Battle_Config { int save_clothcolor; int undead_detect_type; int auto_counter_type; - int min_hitrate; //[Skotlex] - int max_hitrate; //[Skotlex] + int min_hitrate; //[Skotlex] + int max_hitrate; //[Skotlex] int agi_penalty_target; int agi_penalty_type; int agi_penalty_count; @@ -263,33 +264,33 @@ struct Battle_Config { int item_rate_mvp, item_rate_common, item_rate_common_boss, item_rate_card, item_rate_card_boss, item_rate_equip, item_rate_equip_boss, item_rate_heal, item_rate_heal_boss, item_rate_use, item_rate_use_boss, item_rate_treasure, item_rate_adddrop; - + int logarithmic_drops; - int item_drop_common_min,item_drop_common_max; // Added by TyrNemesis^ + int item_drop_common_min,item_drop_common_max; // Added by TyrNemesis^ int item_drop_card_min,item_drop_card_max; int item_drop_equip_min,item_drop_equip_max; - int item_drop_mvp_min,item_drop_mvp_max; // End Addition - int item_drop_heal_min,item_drop_heal_max; // Added by Valatris - int item_drop_use_min,item_drop_use_max; //End + int item_drop_mvp_min,item_drop_mvp_max; // End Addition + int item_drop_heal_min,item_drop_heal_max; // Added by Valatris + int item_drop_use_min,item_drop_use_max; //End int item_drop_treasure_min,item_drop_treasure_max; //by [Skotlex] int item_drop_adddrop_min,item_drop_adddrop_max; //[Skotlex] - - int prevent_logout; // Added by RoVeRT - - int alchemist_summon_reward; // [Valaris] + + int prevent_logout; // Added by RoVeRT + + int alchemist_summon_reward; // [Valaris] int drops_by_luk; int drops_by_luk2; - int equip_natural_break_rate; //Base Natural break rate for attacks. + int equip_natural_break_rate; //Base Natural break rate for attacks. int equip_self_break_rate; //Natural & Penalty skills break rate int equip_skill_break_rate; //Offensive skills break rate int multi_level_up; int max_exp_gain_rate; //Max amount of exp bar % you can get in one go. int pk_mode; int pk_level_range; - + int manner_system; // end additions [Valaris] int show_mob_info; - + int gx_allhit; int gx_disptype; int devotion_level_difference; @@ -305,13 +306,13 @@ struct Battle_Config { int bone_drop; int buyer_name; int dancing_weaponswitch_fix; - + // eAthena additions int night_at_start; // added by [Yor] int day_duration; // added by [Yor] int night_duration; // added by [Yor] int ban_hack_trade; // added by [Yor] - + int min_hair_style; // added by [MouseJstr] int max_hair_style; // added by [MouseJstr] int min_hair_color; // added by [MouseJstr] @@ -319,12 +320,12 @@ struct Battle_Config { int min_cloth_color; // added by [MouseJstr] int max_cloth_color; // added by [MouseJstr] int pet_hair_style; // added by [Skotlex] - + int castrate_dex_scale; // added by [MouseJstr] int area_size; // added by [MouseJstr] - + int max_def, over_def_bonus; //added by [Skotlex] - + int zeny_from_mobs; // [Valaris] int mobs_level_up; // [Valaris] int mobs_level_up_exp_rate; // [Valaris] @@ -344,12 +345,12 @@ struct Battle_Config { int delay_battle_damage; int hide_woe_damage; int display_version; - - int display_hallucination; // [Skotlex] - int use_statpoint_table; // [Skotlex] - + + int display_hallucination; // [Skotlex] + int use_statpoint_table; // [Skotlex] + int ignore_items_gender; //[Lupus] - + int copyskill_restrict; // [Aru] int berserk_cancels_buffs; // [Aru] int mob_ai; //Configures various mob_ai settings to make them smarter or dumber(official). [Skotlex] @@ -359,23 +360,23 @@ struct Battle_Config { int mob_remove_delay; // Dynamic Mobs - delay before removing mobs from a map [Skotlex] int mob_active_time; //Duration through which mobs execute their Hard AI after players leave their area of sight. int boss_active_time; - - int show_hp_sp_drain, show_hp_sp_gain; //[Skotlex] - + + int show_hp_sp_drain, show_hp_sp_gain; //[Skotlex] + int mob_npc_event_type; //Determines on who the npc_event is executed. [Skotlex] - + int character_size; // if riders have size=2, and baby class riders size=1 [Lupus] int rare_drop_announce; // chance <= to show rare drops global announces - - int retaliate_to_master; //Whether when a mob is attacked by another mob, it will retaliate versus the mob or the mob's master. [Skotlex] - + + int retaliate_to_master; //Whether when a mob is attacked by another mob, it will retaliate versus the mob or the mob's master. [Skotlex] + int duel_allow_pvp; // [LuzZza] int duel_allow_gvg; // [LuzZza] int duel_allow_teleport; // [LuzZza] int duel_autoleave_when_die; // [LuzZza] int duel_time_interval; // [LuzZza] int duel_only_on_same_map; // [Toms] - + int skip_teleport_lv1_menu; // possibility to disable (skip) Teleport Lv1 menu, that have only two lines `Random` and `Cancel` [LuzZza] int mob_max_skilllvl; int allow_skill_without_day; // [Komurka] @@ -389,7 +390,7 @@ struct Battle_Config { int mob_sc_def_rate; int pc_max_sc_def; int mob_max_sc_def; - + int sg_angel_skill_ratio; int sg_miracle_skill_ratio; int sg_miracle_skill_duration; @@ -397,9 +398,9 @@ struct Battle_Config { int override_mob_names; //Enables overriding spawn mob names with the mob_db names. [Skotlex] int min_chat_delay; //Minimum time between client messages. [Skotlex] int friend_auto_add; //When accepting friends, both get friended. [Skotlex] - int hvan_explosion_intimate; // fix [albator] + int hvan_explosion_intimate; // fix [albator] int hom_rename; - int homunculus_show_growth ; //[orn] + int homunculus_show_growth; //[orn] int homunculus_friendly_rate; int quest_exp_rate; int autotrade_mapflag; @@ -410,13 +411,13 @@ struct Battle_Config { int ksprotection; int auction_feeperhour; int auction_maximumprice; - int homunculus_auto_vapor; //Keep Homunculus from Vaporizing when master dies. [L0ne_W0lf] - int display_status_timers; //Show or hide skill buff/delay timers in recent clients [Sara] - int skill_add_heal_rate; //skills that bHealPower has effect on [Inkfish] + int homunculus_auto_vapor; //Keep Homunculus from Vaporizing when master dies. [L0ne_W0lf] + int display_status_timers; //Show or hide skill buff/delay timers in recent clients [Sara] + int skill_add_heal_rate; //skills that bHealPower has effect on [Inkfish] int eq_single_target_reflectable; int invincible_nodamage; int mob_slave_keep_target; - int autospell_check_range; //Enable range check for autospell bonus. [L0ne_W0lf] + int autospell_check_range; //Enable range check for autospell bonus. [L0ne_W0lf] int knockback_left; int client_reshuffle_dice; // Reshuffle /dice int client_sort_storage; @@ -431,11 +432,11 @@ struct Battle_Config { int client_emblem_max_blank_percent; int hom_max_level; int hom_S_max_level; - + // [BattleGround Settings] int bg_update_interval; int bg_flee_penalty; - + // rAthena int max_third_parameter; int max_baby_third_parameter; @@ -443,13 +444,13 @@ struct Battle_Config { int atcommand_max_stat_bypass; int max_third_aspd; int vcast_stat_scale; - + int mvp_tomb_enabled; - + int atcommand_suggestions_enabled; int min_npc_vendchat_distance; int atcommand_mobinfo_type; - + int mob_size_influence; // Enable modifications on earned experience, drop rates and monster status depending on monster size. [mkbu95] int bowling_bash_area; int mob_chase_refresh; //How often a monster should refresh its chase [Playtester] @@ -465,11 +466,11 @@ struct Battle_Config { int packet_obfuscation; int idletime_criteria; int gm_ignore_warpable_area; - + int client_accept_chatdori; // [Ai4rei/Mirei] int snovice_call_type; int guild_notice_changemap; - + int feature_banking; int feature_auction; @@ -481,7 +482,7 @@ struct Battle_Config { int song_timer_reset; // [csnv] int snap_dodge; // Enable or disable dodging damage snapping away [csnv] - + int feature_roulette; }; diff --git a/src/map/battleground.c b/src/map/battleground.c index f7131513d..190f7886d 100644 --- a/src/map/battleground.c +++ b/src/map/battleground.c @@ -157,11 +157,11 @@ int bg_team_leave(struct map_session_data *sd, enum bg_team_leave_type flag) { if( bgd->logout_event[0] && flag ) npc->event(sd, bgd->logout_event, 0); - + if( sd->bg_queue.arena ) { bg->queue_pc_cleanup(sd); } - + return bgd->count; } @@ -267,11 +267,11 @@ int bg_send_xy_timer(int tid, int64 tick, int id, intptr_t data) { enum bg_queue_types bg_str2teamtype (const char *str) { char temp[200], *parse; enum bg_queue_types type = BGQT_INVALID; - + safestrncpy(temp, str, 200); - + parse = strtok(temp,"|"); - + while (parse != NULL) { normalize_name(parse," "); if( strcmpi(parse,"all") == 0 ) @@ -287,7 +287,7 @@ enum bg_queue_types bg_str2teamtype (const char *str) { } parse = strtok(NULL,"|"); } - + return type; } @@ -295,25 +295,24 @@ void bg_config_read(void) { config_t bg_conf; config_setting_t *data = NULL; const char *config_filename = "conf/battlegrounds.conf"; // FIXME hardcoded name - + if (libconfig->read_file(&bg_conf, config_filename)) return; - + data = libconfig->lookup(&bg_conf, "battlegrounds"); - + if (data != NULL) { config_setting_t *settings = libconfig->setting_get_elem(data, 0); config_setting_t *arenas; const char *delay_var; int i, arena_count = 0, offline = 0; - + if( !libconfig->setting_lookup_string(settings, "global_delay_var", &delay_var) ) delay_var = "BG_Delay_Tick"; - + safestrncpy(bg->gdelay_var, delay_var, BG_DELAY_VAR_LENGTH); - + libconfig->setting_lookup_int(settings, "maximum_afk_seconds", &bg->mafksec); - libconfig->setting_lookup_bool(settings, "feature_off", &offline); if( offline == 0 ) @@ -332,14 +331,14 @@ void bg_config_read(void) { int maxDuration; int fillup_duration = 0, pregame_duration = 0; enum bg_queue_types allowedTypes; - + bg->arena[i] = NULL; - + if( !libconfig->setting_lookup_string(arena, "name", &aName) ) { ShowError("bg_config_read: failed to find 'name' for arena #%d\n",i); continue; } - + if( !libconfig->setting_lookup_string(arena, "event", &aEvent) ) { ShowError("bg_config_read: failed to find 'event' for arena #%d\n",i); continue; @@ -347,7 +346,7 @@ void bg_config_read(void) { libconfig->setting_lookup_int(arena, "minLevel", &minLevel); libconfig->setting_lookup_int(arena, "maxLevel", &maxLevel); - + if( minLevel < 0 ) { ShowWarning("bg_config_read: invalid %d value for arena '%s' minLevel\n",minLevel,aName); minLevel = 0; @@ -356,16 +355,16 @@ void bg_config_read(void) { ShowWarning("bg_config_read: invalid %d value for arena '%s' maxLevel\n",maxLevel,aName); maxLevel = MAX_LEVEL; } - + if( !(reward = libconfig->setting_get_member(arena, "reward")) ) { ShowError("bg_config_read: failed to find 'reward' for arena '%s'/#%d\n",aName,i); continue; } - + libconfig->setting_lookup_int(reward, "win", &prizeWin); libconfig->setting_lookup_int(reward, "loss", &prizeLoss); libconfig->setting_lookup_int(reward, "draw", &prizeDraw); - + if( prizeWin < 0 ) { ShowWarning("bg_config_read: invalid %d value for arena '%s' reward:win\n",prizeWin,aName); prizeWin = 0; @@ -378,11 +377,11 @@ void bg_config_read(void) { ShowWarning("bg_config_read: invalid %d value for arena '%s' reward:draw\n",prizeDraw,aName); prizeDraw = 0; } - + libconfig->setting_lookup_int(arena, "minPlayers", &minPlayers); libconfig->setting_lookup_int(arena, "maxPlayers", &maxPlayers); libconfig->setting_lookup_int(arena, "minTeamPlayers", &minTeamPlayers); - + if( minPlayers < 0 ) { ShowWarning("bg_config_read: invalid %d value for arena '%s' minPlayers\n",minPlayers,aName); minPlayers = 0; @@ -400,20 +399,19 @@ void bg_config_read(void) { ShowError("bg_config_read: failed to find 'delay_var' for arena '%s'/#%d\n",aName,i); continue; } - - + if( !libconfig->setting_lookup_string(arena, "allowedTypes", &aTeamTypes) ) { ShowError("bg_config_read: failed to find 'allowedTypes' for arena '%s'/#%d\n",aName,i); continue; } - + libconfig->setting_lookup_int(arena, "maxDuration", &maxDuration); - + if( maxDuration < 0 ) { ShowWarning("bg_config_read: invalid %d value for arena '%s' maxDuration\n",maxDuration,aName); maxDuration = 30; } - + libconfig->setting_lookup_int(arena, "fillDuration", &fillup_duration); libconfig->setting_lookup_int(arena, "pGameDuration", &pregame_duration); @@ -428,9 +426,9 @@ void bg_config_read(void) { } allowedTypes = bg->str2teamtype(aTeamTypes); - + CREATE( bg->arena[i], struct bg_arena, 1 ); - + bg->arena[i]->id = i; safestrncpy(bg->arena[i]->name, aName, NAME_LENGTH); safestrncpy(bg->arena[i]->npc_event, aEvent, EVENT_NAME_LENGTH); @@ -455,7 +453,6 @@ void bg_config_read(void) { } bg->arenas = arena_count; } - libconfig->destroy(&bg_conf); } } @@ -493,7 +490,7 @@ void bg_queue_ready_ack (struct bg_arena *arena, struct map_session_data *sd, bo struct hQueue *queue = &script->hq[arena->queue_id]; int i, count = 0; sd->bg_queue.ready = 1; - + for( i = 0; i < queue->size; i++ ) { if( queue->item[i] > 0 && ( sd = map->id2sd(queue->item[i]) ) ) { if( sd->bg_queue.ready == 1 ) @@ -506,10 +503,9 @@ void bg_queue_ready_ack (struct bg_arena *arena, struct map_session_data *sd, bo arena->begin_timer = INVALID_TIMER; bg->begin(arena); } - } - } + void bg_queue_player_cleanup(struct map_session_data *sd) { if ( sd->bg_queue.client_has_bg_data ) { if( sd->bg_queue.arena ) @@ -527,14 +523,14 @@ void bg_queue_player_cleanup(struct map_session_data *sd) { void bg_match_over(struct bg_arena *arena, bool canceled) { struct hQueue *queue = &script->hq[arena->queue_id]; int i; - + if( !arena->ongoing ) return; arena->ongoing = false; for( i = 0; i < queue->size; i++ ) { struct map_session_data * sd = NULL; - + if( queue->item[i] > 0 && ( sd = map->id2sd(queue->item[i]) ) ) { if( sd->bg_queue.arena ) { bg->team_leave(sd, 0); @@ -559,7 +555,7 @@ void bg_begin(struct bg_arena *arena) { for( i = 0; i < queue->size; i++ ) { struct map_session_data * sd = NULL; - + if( queue->item[i] > 0 && ( sd = map->id2sd(queue->item[i]) ) ) { if( sd->bg_queue.ready == 1 ) count++; @@ -575,23 +571,21 @@ void bg_begin(struct bg_arena *arena) { bg->match_over(arena,true); } else { arena->ongoing = true; - + if( bg->afk_timer_id == INVALID_TIMER && bg->mafksec > 0 ) bg->afk_timer_id = timer->add(timer->gettick()+10000,bg->afk_timer,0,0); - + /* TODO: make this a arena-independent var? or just .@? */ mapreg->setreg(script->add_str("$@bg_queue_id"),arena->queue_id); mapreg->setregstr(script->add_str("$@bg_delay_var$"),bg->gdelay_var); - + count = 0; for( i = 0; i < queue->size; i++ ) { struct map_session_data * sd = NULL; - + if( queue->item[i] > 0 && ( sd = map->id2sd(queue->item[i]) ) ) { if( sd->bg_queue.ready == 1 ) { - mapreg->setreg(reference_uid(script->add_str("$@bg_member"), count), sd->status.account_id); - mapreg->setreg(reference_uid(script->add_str("$@bg_member_group"), count), sd->bg_queue.type == BGQT_GUILD ? sd->status.guild_id : sd->bg_queue.type == BGQT_PARTY ? sd->status.party_id : @@ -607,7 +601,7 @@ void bg_begin(struct bg_arena *arena) { } } mapreg->setreg(script->add_str("$@bg_member_size"),count); - + npc->event_do(arena->npc_event); } } @@ -631,7 +625,7 @@ int bg_afk_timer(int tid, int64 tick, int id, intptr_t data) { count++; } mapit->free(iter); - + if( count ) bg->afk_timer_id = timer->add(timer->gettick()+10000,bg->afk_timer,0,0); else @@ -642,10 +636,10 @@ int bg_afk_timer(int tid, int64 tick, int id, intptr_t data) { void bg_queue_pregame(struct bg_arena *arena) { struct hQueue *queue = &script->hq[arena->queue_id]; int i; - + for( i = 0; i < queue->size; i++ ) { struct map_session_data * sd = NULL; - + if( queue->item[i] > 0 && ( sd = map->id2sd(queue->item[i]) ) ) { clif->bgqueue_battlebegins(sd,arena->id,SELF); } @@ -674,17 +668,17 @@ void bg_queue_add(struct map_session_data *sd, struct bg_arena *arena, enum bg_q enum BATTLEGROUNDS_QUEUE_ACK result = bg->can_queue(sd,arena,type); struct hQueue *queue; int i, count = 0; - + if( arena->begin_timer != INVALID_TIMER || arena->ongoing ) { clif->bgqueue_ack(sd,BGQA_FAIL_QUEUING_FINISHED,arena->id); return; } - + if( result != BGQA_SUCCESS ) { clif->bgqueue_ack(sd,result,arena->id); return; } - + switch( type ) { /* guild/party already validated in can_queue */ case BGQT_PARTY: { struct party_data *p = party->search(sd->status.party_id); @@ -705,7 +699,7 @@ void bg_queue_add(struct map_session_data *sd, struct bg_arena *arena, enum bg_q count = 1; break; } - + if( !(queue = script->queue(arena->queue_id)) || (queue->items+count) > arena->max_players ) { clif->bgqueue_ack(sd,BGQA_FAIL_PPL_OVERAMOUNT,arena->id); return; @@ -746,26 +740,24 @@ void bg_queue_add(struct map_session_data *sd, struct bg_arena *arena, enum bg_q } break; } - clif->bgqueue_ack(sd,BGQA_SUCCESS,arena->id); - bg->queue_check(arena); } enum BATTLEGROUNDS_QUEUE_ACK bg_canqueue(struct map_session_data *sd, struct bg_arena *arena, enum bg_queue_types type) { int tick; unsigned int tsec; - + if( !(arena->allowed_types & type) ) return BGQA_FAIL_TYPE_INVALID; - + if ( sd->status.base_level > arena->max_level || sd->status.base_level < arena->min_level ) return BGQA_FAIL_LEVEL_INCORRECT; - + if ( !(sd->class_&JOBL_2) ) /* TODO: maybe make this a per-arena setting, so users may make custom arenas like baby-only,whatever. */ return BGQA_FAIL_CLASS_INVALID; - + tsec = (unsigned int)time(NULL); - + if ( ( tick = pc_readglobalreg(sd, script->add_str(bg->gdelay_var)) ) && tsec < tick ) { char response[100]; if( (tick-tsec) > 60 ) @@ -775,7 +767,7 @@ enum BATTLEGROUNDS_QUEUE_ACK bg_canqueue(struct map_session_data *sd, struct bg_ clif->colormes(sd->fd,COLOR_RED,response); return BGQA_FAIL_DESERTER; } - + if ( ( tick = pc_readglobalreg(sd, script->add_str(arena->delay_var)) ) && tsec < tick ) { char response[100]; if( (tick-tsec) > 60 ) @@ -788,7 +780,7 @@ enum BATTLEGROUNDS_QUEUE_ACK bg_canqueue(struct map_session_data *sd, struct bg_ if( sd->bg_queue.arena != NULL ) return BGQA_DUPLICATE_REQUEST; - + switch(type) { case BGQT_GUILD: if( !sd->guild || !sd->state.gmaster_flag ) @@ -831,7 +823,7 @@ enum BATTLEGROUNDS_QUEUE_ACK bg_canqueue(struct map_session_data *sd, struct bg_ if( !is_leader ) return BGQA_NOT_PARTY_GUILD_LEADER; - + if( count < arena->min_team_players ) { char response[100]; if( count != p->party.count && p->party.count >= arena->min_team_players ) @@ -841,7 +833,6 @@ enum BATTLEGROUNDS_QUEUE_ACK bg_canqueue(struct map_session_data *sd, struct bg_ clif->colormes(sd->fd,COLOR_RED,response); return BGQA_FAIL_TEAM_COUNT; } - } else return BGQA_NOT_PARTY_GUILD_LEADER; } @@ -852,7 +843,6 @@ enum BATTLEGROUNDS_QUEUE_ACK bg_canqueue(struct map_session_data *sd, struct bg_ ShowDebug("bg_canqueue: unknown/unsupported type %d\n",type); return BGQA_DUPLICATE_REQUEST; } - return BGQA_SUCCESS; } void do_init_battleground(bool minimal) { @@ -867,22 +857,22 @@ void do_init_battleground(bool minimal) { void do_final_battleground(void) { int i; - + db_destroy(bg->team_db); - + for( i = 0; i < bg->arenas; i++ ) { if( bg->arena[i] ) aFree(bg->arena[i]); } - + if( bg->arena ) aFree(bg->arena); } void battleground_defaults(void) { bg = &bg_s; - + bg->queue_on = false; - + bg->mafksec = 0; bg->afk_timer_id = INVALID_TIMER; bg->arena = NULL; diff --git a/src/map/buyingstore.c b/src/map/buyingstore.c index 84b917cfc..8efffa342 100644 --- a/src/map/buyingstore.c +++ b/src/map/buyingstore.c @@ -294,8 +294,11 @@ void buyingstore_trade(struct map_session_data* sd, int account_id, unsigned int return; } - if( sd->status.inventory[index].expire_time || (sd->status.inventory[index].bound && !pc_can_give_bound_items(sd)) || !itemdb_cantrade(&sd->status.inventory[index], pc_get_group_level(sd), pc_get_group_level(pl_sd)) || memcmp(sd->status.inventory[index].card, buyingstore->blankslots, sizeof(buyingstore->blankslots)) ) - {// non-tradable item + if (sd->status.inventory[index].expire_time || (sd->status.inventory[index].bound && !pc_can_give_bound_items(sd)) + || !itemdb_cantrade(&sd->status.inventory[index], pc_get_group_level(sd), pc_get_group_level(pl_sd)) + || memcmp(sd->status.inventory[index].card, buyingstore->blankslots, sizeof(buyingstore->blankslots)) + ) { + // non-tradable item clif->buyingstore_trade_failed_seller(sd, BUYINGSTORE_TRADE_SELLER_FAILED, nameid); return; } @@ -367,7 +370,7 @@ void buyingstore_trade(struct map_session_data* sd, int account_id, unsigned int chrif->save(sd, 0); chrif->save(pl_sd, 0); } - + // check whether or not there is still something to buy ARR_FIND( 0, pl_sd->buyingstore.slots, i, pl_sd->buyingstore.items[i].amount != 0 ); if( i == pl_sd->buyingstore.slots ) @@ -459,7 +462,7 @@ bool buyingstore_searchall(struct map_session_data* sd, const struct s_search_st } void buyingstore_defaults(void) { buyingstore = &buyingstore_s; - + buyingstore->nextid = 0; memset(buyingstore->blankslots,0,sizeof(buyingstore->blankslots)); /* */ diff --git a/src/map/chat.c b/src/map/chat.c index cd7b5f811..9c67e0f44 100644 --- a/src/map/chat.c +++ b/src/map/chat.c @@ -61,10 +61,10 @@ struct chat_data* chat_createchat(struct block_list* bl, const char* title, cons } map->addiddb(&cd->bl); - + if( bl->type != BL_NPC ) cd->kick_list = idb_alloc(DB_OPT_BASE); - + return cd; } @@ -156,20 +156,20 @@ bool chat_joinchat(struct map_session_data* sd, int chatid, const char* pass) { pc_setchatid(sd,cd->bl.id); - clif->joinchatok(sd, cd); //To the person who newly joined the list of all - clif->addchat(cd, sd); //Reports To the person who already in the chat - clif->dispchat(cd, 0); //Reported number of changes to the people around + clif->joinchatok(sd, cd); //To the person who newly joined the list of all + clif->addchat(cd, sd); //Reports To the person who already in the chat + clif->dispchat(cd, 0); //Reported number of changes to the people around - chat->trigger_event(cd); //Event + chat->trigger_event(cd); //Event - return true; + return true; } /*========================================== * Leave a chatroom * Return - * 0: User not found in chatroom/Missing data + * 0: User not found in chatroom/Missing data * 1: Success * 2: Chat room deleted (chat room empty) * 3: Owner changed (Owner left and a new one as assigned) @@ -188,8 +188,8 @@ int chat_leavechat(struct map_session_data* sd, bool kicked) { } ARR_FIND( 0, cd->users, i, cd->usersd[i] == sd ); - if ( i == cd->users ) - { // Not found in the chatroom? + if (i == cd->users) { + // Not found in the chatroom? pc_setchatid(sd, 0); return 0; } @@ -213,7 +213,7 @@ int chat_leavechat(struct map_session_data* sd, bool kicked) { map->deliddb(&cd->bl); map->delblock(&cd->bl); map->freeblock(&cd->bl); - + su = map->find_skill_unit_oncell(&sd->bl, sd->bl.x, sd->bl.y, AL_WARP, NULL, 0); group = (su != NULL) ? su->group : NULL; if (group != NULL) @@ -326,7 +326,7 @@ bool chat_kickchat(struct map_session_data* sd, const char* kickusername) { nullpo_ret(sd); cd = (struct chat_data *)map->id2bl(sd->chatID); - + if( cd==NULL || (struct block_list *)sd != cd->owner ) return false; @@ -336,7 +336,7 @@ bool chat_kickchat(struct map_session_data* sd, const char* kickusername) { if (pc_has_permission(cd->usersd[i], PC_PERM_NO_CHAT_KICK)) return false; //gm kick protection [Valaris] - + idb_iput(cd->kick_list,cd->usersd[i]->status.char_id,1); chat->leave(cd->usersd[i],1); @@ -385,14 +385,14 @@ bool chat_deletenpcchat(struct npc_data* nd) { cd = (struct chat_data*)map->id2bl(nd->chat_id); if( cd == NULL ) return false; - + chat->npc_kick_all(cd); clif->clearchat(cd, 0); map->deliddb(&cd->bl); map->delblock(&cd->bl); map->freeblock(&cd->bl); nd->chat_id = 0; - + return true; } @@ -452,7 +452,7 @@ bool chat_npckickall(struct chat_data* cd) *-------------------------------------*/ void chat_defaults(void) { chat = &chat_s; - + /* funcs */ chat->create_pc_chat = chat_createpcchat; chat->join = chat_joinchat; diff --git a/src/map/chat.h b/src/map/chat.h index e055c04ed..6fca018f4 100644 --- a/src/map/chat.h +++ b/src/map/chat.h @@ -16,21 +16,21 @@ struct npc_data; #define MAX_CHAT_USERS 20 struct chat_data { - struct block_list bl; // data for this map object - char title[CHATROOM_TITLE_SIZE]; // room title - char pass[CHATROOM_PASS_SIZE]; // password - bool pub; // private/public flag - uint8 users; // current user count - uint8 limit; // join limit - uint8 trigger; // number of users needed to trigger event - uint32 zeny; // required zeny to join - uint32 minLvl; // minimum base level to join - uint32 maxLvl; // maximum base level allowed to join + struct block_list bl; ///< data for this map object + char title[CHATROOM_TITLE_SIZE]; ///< room title + char pass[CHATROOM_PASS_SIZE]; ///< password + bool pub; ///< private/public flag + uint8 users; ///< current user count + uint8 limit; ///< join limit + uint8 trigger; ///< number of users needed to trigger event + uint32 zeny; ///< required zeny to join + uint32 minLvl; ///< minimum base level to join + uint32 maxLvl; ///< maximum base level allowed to join struct map_session_data* usersd[MAX_CHAT_USERS]; struct block_list* owner; char npc_event[EVENT_NAME_LENGTH]; /* isn't this a waste? there is a enormous overhead, wouldn't something like skill_blockpc_start be better here? [Ind] */ - DBMap* kick_list; //DBMap of users who were kicked from this chat + DBMap* kick_list; ///< DBMap of users who were kicked from this chat }; /*===================================== @@ -39,7 +39,6 @@ struct chat_data { * created by Susu *-------------------------------------*/ struct chat_interface { - /* funcs */ bool (*create_pc_chat) (struct map_session_data* sd, const char* title, const char* pass, int limit, bool pub); bool (*join) (struct map_session_data* sd, int chatid, const char* pass); diff --git a/src/map/chrif.c b/src/map/chrif.c index c78b34309..a5003ab95 100644 --- a/src/map/chrif.c +++ b/src/map/chrif.c @@ -116,7 +116,6 @@ struct auth_node* chrif_search(int account_id) { struct auth_node* chrif_auth_check(int account_id, int char_id, enum sd_state state) { struct auth_node *node = chrif->search(account_id); - return ( node && node->char_id == char_id && node->state == state ) ? node : NULL; } @@ -125,24 +124,23 @@ bool chrif_auth_delete(int account_id, int char_id, enum sd_state state) { if ( (node = chrif->auth_check(account_id, char_id, state) ) ) { int fd = node->sd ? node->sd->fd : node->fd; - + if ( session[fd] && session[fd]->session_data == node->sd ) session[fd]->session_data = NULL; - + if ( node->sd ) { - if( node->sd->regs.vars ) node->sd->regs.vars->destroy(node->sd->regs.vars, script->reg_destroy); - + if( node->sd->regs.arrays ) node->sd->regs.arrays->destroy(node->sd->regs.arrays, script->array_free_db); - + aFree(node->sd); } - + ers_free(chrif->auth_db_ers, node); idb_remove(chrif->auth_db,account_id); - + return true; } return false; @@ -151,52 +149,52 @@ bool chrif_auth_delete(int account_id, int char_id, enum sd_state state) { //Moves the sd character to the auth_db structure. bool chrif_sd_to_auth(TBL_PC* sd, enum sd_state state) { struct auth_node *node; - + if ( chrif->search(sd->status.account_id) ) return false; //Already exists? node = ers_alloc(chrif->auth_db_ers, struct auth_node); - + memset(node, 0, sizeof(struct auth_node)); - + node->account_id = sd->status.account_id; node->char_id = sd->status.char_id; node->login_id1 = sd->login_id1; node->login_id2 = sd->login_id2; node->sex = sd->status.sex; node->fd = sd->fd; - node->sd = sd; //Data from logged on char. + node->sd = sd; //Data from logged on char. node->node_created = timer->gettick(); //timestamp for node timeouts node->state = state; sd->state.active = 0; - + idb_put(chrif->auth_db, node->account_id, node); - + return true; } -bool chrif_auth_logout(TBL_PC* sd, enum sd_state state) { - +bool chrif_auth_logout(TBL_PC* sd, enum sd_state state) +{ if(sd->fd && state == ST_LOGOUT) { //Disassociate player, and free it after saving ack returns. [Skotlex] //fd info must not be lost for ST_MAPCHANGE as a final packet needs to be sent to the player. if ( session[sd->fd] ) session[sd->fd]->session_data = NULL; sd->fd = 0; } - + return chrif->sd_to_auth(sd, state); } bool chrif_auth_finished(TBL_PC* sd) { struct auth_node *node= chrif->search(sd->status.account_id); - + if ( node && node->sd == sd && node->state == ST_LOGIN ) { node->sd = NULL; - + return chrif->auth_delete(node->account_id, node->char_id, ST_LOGIN); } - + return false; } // sets char-server's user id @@ -221,16 +219,16 @@ void chrif_checkdefaultlogin(void) { // sets char-server's ip address bool chrif_setip(const char* ip) { char ip_str[16]; - + if ( !( chrif->ip = host2ip(ip) ) ) { ShowWarning("Failed to Resolve Char Server Address! (%s)\n", ip); return false; } - + safestrncpy(chrif->ip_str, ip, sizeof(chrif->ip_str)); - + ShowInfo("Char Server IP Address : '"CL_WHITE"%s"CL_RESET"' -> '"CL_WHITE"%s"CL_RESET"'.\n", ip, ip2str(chrif->ip, ip_str)); - + return true; } @@ -314,9 +312,9 @@ void chrif_connect(int fd) { // sends maps to char-server void chrif_sendmap(int fd) { int i; - + ShowStatus("Sending maps to char server...\n"); - + // Sending normal maps, not instances WFIFOHEAD(fd, 4 + instance->start_id * 4); WFIFOW(fd,0) = 0x2afa; @@ -335,7 +333,7 @@ void chrif_recvmap(int fd) { for(i = 10, j = 0; i < RFIFOW(fd,2); i += 4, j++) { map->setipport(RFIFOW(fd,i), ip, port); } - + if (battle_config.etc_log) ShowStatus("Received maps from %d.%d.%d.%d:%d (%d maps)\n", CONVIP(ip), port, j); @@ -352,7 +350,7 @@ void chrif_removemap(int fd) { map->eraseipport(RFIFOW(fd, i), ip, port); chrif->other_mapserver_count--; - + if(battle_config.etc_log) ShowStatus("remove map of server %d.%d.%d.%d:%d (%d maps)\n", CONVIP(ip), port, j); } @@ -389,7 +387,7 @@ bool chrif_changemapserver(struct map_session_data* sd, uint32 ip, uint16 port) WFIFOL(chrif->fd,31) = htonl(session[sd->fd]->client_addr); WFIFOL(chrif->fd,35) = sd->group_id; WFIFOSET(chrif->fd,39); - + return true; } @@ -397,7 +395,7 @@ bool chrif_changemapserver(struct map_session_data* sd, uint32 ip, uint16 port) /// R 2b06 <account_id>.L <login_id1>.L <login_id2>.L <char_id>.L <map_index>.W <x>.W <y>.W <ip>.L <port>.W bool chrif_changemapserverack(int account_id, int login_id1, int login_id2, int char_id, short map_index, short x, short y, uint32 ip, uint16 port) { struct auth_node *node; - + if ( !( node = chrif->auth_check(account_id, char_id, ST_MAPCHANGE) ) ) return false; @@ -436,7 +434,7 @@ void chrif_connectack(int fd) { ShowStatus("Event '"CL_WHITE"OnInterIfInitOnce"CL_RESET"' executed with '"CL_WHITE"%d"CL_RESET"' NPCs.\n", npc->event_doall("OnInterIfInitOnce")); guild->castle_map_init(); } - + sockt->datasync(fd, true); chrif->skillid2idx(fd); } @@ -446,7 +444,7 @@ void chrif_connectack(int fd) { */ int chrif_reconnect(DBKey key, DBData *data, va_list ap) { struct auth_node *node = DB->data2ptr(data); - + switch (node->state) { case ST_LOGIN: if ( node->sd ) {//Since there is no way to request the char auth, make it fail. @@ -463,7 +461,7 @@ int chrif_reconnect(DBKey key, DBData *data, va_list ap) { struct map_session_data *sd = node->sd; uint32 ip; uint16 port; - + if( map->mapname2ipport(sd->mapindex,&ip,&port) == 0 ) chrif->changemapserver(sd, ip, port); else //too much lag/timeout is the closest explanation for this error. @@ -471,7 +469,6 @@ int chrif_reconnect(DBKey key, DBData *data, va_list ap) { break; } } - return 0; } @@ -480,9 +477,9 @@ int chrif_reconnect(DBKey key, DBData *data, va_list ap) { void chrif_on_ready(void) { static bool once = false; ShowStatus("Map Server is now online.\n"); - + chrif->state = 2; - + chrif->check_shutdown(); //If there are players online, send them to the char-server. [Skotlex] @@ -496,7 +493,7 @@ void chrif_on_ready(void) { //Re-save any guild castles that were modified in the disconnection time. guild->castle_reconnect(-1, 0, 0); - + if( !once ) { #ifdef AUTOTRADE_PERSISTENCY pc->autotrade_load(); @@ -509,23 +506,23 @@ void chrif_on_ready(void) { /*========================================== * *------------------------------------------*/ -void chrif_sendmapack(int fd) { - +void chrif_sendmapack(int fd) +{ if (RFIFOB(fd,2)) { ShowFatalError("chrif : send map list to char server failed %d\n", RFIFOB(fd,2)); exit(EXIT_FAILURE); } memcpy(map->wisp_server_name, RFIFOP(fd,3), NAME_LENGTH); - + chrif->on_ready(); } /*========================================== * Request sc_data from charserver [Skotlex] *------------------------------------------*/ -bool chrif_scdata_request(int account_id, int char_id) { - +bool chrif_scdata_request(int account_id, int char_id) +{ #ifdef ENABLE_SC_SAVING chrif_check(false); @@ -535,7 +532,6 @@ bool chrif_scdata_request(int account_id, int char_id) { WFIFOL(chrif->fd,6) = char_id; WFIFOSET(chrif->fd,10); #endif - return true; } @@ -544,7 +540,7 @@ bool chrif_scdata_request(int account_id, int char_id) { *------------------------------------------*/ void chrif_authreq(struct map_session_data *sd, bool hstandalone) { struct auth_node *node= chrif->search(sd->bl.id); - + if( node != NULL || !chrif->isconnected() ) { set_eof(sd->fd); return; @@ -621,7 +617,7 @@ void chrif_authok(int fd) { } else { //Auth Failed pc->authfail(sd); } - + chrif_char_offline(sd); //Set him offline, the char server likely has it set as online already. chrif->auth_delete(account_id, char_id, ST_LOGIN); } @@ -639,7 +635,7 @@ void chrif_authfail(int fd) {/* HELLO WORLD. ip in RFIFOL 15 is not being used ( sex = RFIFOB(fd,14); node = chrif->search(account_id); - + if( node != NULL && node->account_id == account_id && node->char_id == char_id && @@ -660,7 +656,7 @@ void chrif_authfail(int fd) {/* HELLO WORLD. ip in RFIFOL 15 is not being used ( int auth_db_cleanup_sub(DBKey key, DBData *data, va_list ap) { struct auth_node *node = DB->data2ptr(data); const char* states[] = { "Login", "Logout", "Map change" }; - + if(DIFF_TICK(timer->gettick(),node->node_created)>60000) { switch (node->state) { case ST_LOGOUT: @@ -694,7 +690,7 @@ bool chrif_charselectreq(struct map_session_data* sd, uint32 s_ip) { if( !sd->bl.id || !sd->login_id1 ) return false; - + chrif_check(false); WFIFOHEAD(chrif->fd,22); @@ -713,10 +709,10 @@ bool chrif_charselectreq(struct map_session_data* sd, uint32 s_ip) { * Search Char trough id on char serv *------------------------------------------*/ bool chrif_searchcharid(int char_id) { - + if( !char_id ) return false; - + chrif_check(false); WFIFOHEAD(chrif->fd,6); @@ -731,7 +727,7 @@ bool chrif_searchcharid(int char_id) { * Change Email *------------------------------------------*/ bool chrif_changeemail(int id, const char *actual_email, const char *new_email) { - + if (battle_config.etc_log) ShowInfo("chrif_changeemail: account: %d, actual_email: '%s', new_email: '%s'.\n", id, actual_email, new_email); @@ -753,8 +749,8 @@ bool chrif_changeemail(int id, const char *actual_email, const char *new_email) * type of operation: * 1: block, 2: ban, 3: unblock, 4: unban, 5: changesex (use next function for 5), 6: charban *------------------------------------------*/ -bool chrif_char_ask_name(int acc, const char* character_name, unsigned short operation_type, int year, int month, int day, int hour, int minute, int second) { - +bool chrif_char_ask_name(int acc, const char* character_name, unsigned short operation_type, int year, int month, int day, int hour, int minute, int second) +{ chrif_check(false); WFIFOHEAD(chrif->fd,44); @@ -762,7 +758,7 @@ bool chrif_char_ask_name(int acc, const char* character_name, unsigned short ope WFIFOL(chrif->fd,2) = acc; safestrncpy((char*)WFIFOP(chrif->fd,6), character_name, NAME_LENGTH); WFIFOW(chrif->fd,30) = operation_type; - + if ( operation_type == 2 || operation_type == 6 ) { WFIFOW(chrif->fd,32) = year; WFIFOW(chrif->fd,34) = month; @@ -771,14 +767,14 @@ bool chrif_char_ask_name(int acc, const char* character_name, unsigned short ope WFIFOW(chrif->fd,40) = minute; WFIFOW(chrif->fd,42) = second; } - + WFIFOSET(chrif->fd,44); return true; } bool chrif_changesex(struct map_session_data *sd) { chrif_check(false); - + WFIFOHEAD(chrif->fd,44); WFIFOW(chrif->fd,0) = 0x2b0e; WFIFOL(chrif->fd,2) = sd->status.account_id; @@ -811,9 +807,9 @@ bool chrif_char_ask_name_answer(int acc, const char* player_name, uint16 type, u char action[25]; char output[256]; bool charsrv = ( type == 6 || type == 7 ) ? true : false; - + sd = map->id2sd(acc); - + if( acc < 0 || sd == NULL ) { ShowError("chrif_char_ask_name_answer failed - player not online.\n"); return false; @@ -822,7 +818,7 @@ bool chrif_char_ask_name_answer(int acc, const char* player_name, uint16 type, u /* re-use previous msg_txt */ if( type == 6 ) type = 2; if( type == 7 ) type = 4; - + if( type > 0 && type <= 5 ) snprintf(action,25,"%s",msg_txt(427+type)); //block|ban|unblock|unban|change the sex of else @@ -835,7 +831,7 @@ bool chrif_char_ask_name_answer(int acc, const char* player_name, uint16 type, u case 3 : sprintf(output, msg_txt(427), action, NAME_LENGTH, player_name); break; default: output[0] = '\0'; break; } - + clif->message(sd->fd, output); return true; } @@ -846,7 +842,7 @@ bool chrif_char_ask_name_answer(int acc, const char* player_name, uint16 type, u void chrif_changedsex(int fd) { int acc = RFIFOL(fd,2); //int sex = RFIFOL(fd,6); // Dead store. Uncomment if needed again. - + if ( battle_config.etc_log ) ShowNotice("chrif_changedsex %d.\n", acc); @@ -896,7 +892,7 @@ bool chrif_divorceack(int char_id, int partner_id) { if (sd->status.inventory[i].nameid == WEDDING_RING_M || sd->status.inventory[i].nameid == WEDDING_RING_F) pc->delitem(sd, i, 1, 0, 0, LOG_TYPE_OTHER); } - + return true; } /*========================================== @@ -932,10 +928,10 @@ void chrif_idbanned(int fd) { struct map_session_data *sd; id = RFIFOL(fd,2); - + if ( battle_config.etc_log ) ShowNotice("chrif_idbanned %d.\n", id); - + sd = ( RFIFOB(fd,6) == 2 ) ? map->charid2sd(id) : map->id2sd(id); if ( id < 0 || sd == NULL ) { @@ -981,10 +977,10 @@ int chrif_disconnectplayer(int fd) { sd = map->id2sd(account_id); if( sd == NULL ) { struct auth_node* auth = chrif->search(account_id); - + if( auth != NULL && chrif->auth_delete(account_id, auth->char_id, ST_LOGIN) ) return 0; - + return -1; } @@ -1011,7 +1007,7 @@ int chrif_disconnectplayer(int fd) { *------------------------------------------*/ int chrif_updatefamelist(struct map_session_data* sd) { char type; - + chrif_check(-1); switch(sd->class_ & MAPID_UPPERMASK) { @@ -1051,30 +1047,24 @@ void chrif_recvfamelist(int fd) { memset(pc->taekwon_fame_list, 0, sizeof(pc->taekwon_fame_list)); size = RFIFOW(fd, 6); //Blacksmith block size - for (num = 0; len < size && num < MAX_FAME_LIST; num++) { memcpy(&pc->smith_fame_list[num], RFIFOP(fd,len), sizeof(struct fame_list)); - len += sizeof(struct fame_list); + len += sizeof(struct fame_list); } - total += num; size = RFIFOW(fd, 4); //Alchemist block size - for (num = 0; len < size && num < MAX_FAME_LIST; num++) { memcpy(&pc->chemist_fame_list[num], RFIFOP(fd,len), sizeof(struct fame_list)); - len += sizeof(struct fame_list); + len += sizeof(struct fame_list); } - total += num; size = RFIFOW(fd, 2); //Total packet length - for (num = 0; len < size && num < MAX_FAME_LIST; num++) { memcpy(&pc->taekwon_fame_list[num], RFIFOP(fd,len), sizeof(struct fame_list)); - len += sizeof(struct fame_list); + len += sizeof(struct fame_list); } - total += num; ShowInfo("Received Fame List of '"CL_WHITE"%d"CL_RESET"' characters.\n", total); @@ -1085,21 +1075,20 @@ void chrif_recvfamelist(int fd) { int chrif_updatefamelist_ack(int fd) { struct fame_list* list; uint8 index; - + switch (RFIFOB(fd,2)) { case RANKTYPE_BLACKSMITH: list = pc->smith_fame_list; break; case RANKTYPE_ALCHEMIST: list = pc->chemist_fame_list; break; case RANKTYPE_TAEKWON: list = pc->taekwon_fame_list; break; default: return 0; } - + index = RFIFOB(fd, 3); - if (index >= MAX_FAME_LIST) return 0; - + list[index].fame = RFIFOL(fd,4); - + return 1; } @@ -1114,12 +1103,12 @@ bool chrif_save_scdata(struct map_session_data *sd) { //parses the sc_data of th chrif_check(false); tick = timer->gettick(); - + WFIFOHEAD(chrif->fd, 14 + SC_MAX*sizeof(struct status_change_data)); WFIFOW(chrif->fd,0) = 0x2b1c; WFIFOL(chrif->fd,4) = sd->status.account_id; WFIFOL(chrif->fd,8) = sd->status.char_id; - + for (i = 0; i < SC_MAX; i++) { if (!sc->data[i]) continue; @@ -1142,15 +1131,15 @@ bool chrif_save_scdata(struct map_session_data *sd) { //parses the sc_data of th &data, sizeof(struct status_change_data)); count++; } - + if (count == 0) return true; //Nothing to save. | Everything was as successful as if there was something to save. - + WFIFOW(chrif->fd,12) = count; WFIFOW(chrif->fd,2) = 14 +count*sizeof(struct status_change_data); //Total packet size WFIFOSET(chrif->fd,WFIFOW(chrif->fd,2)); #endif - + return true; } @@ -1164,30 +1153,29 @@ bool chrif_load_scdata(int fd) { aid = RFIFOL(fd,4); //Player Account ID cid = RFIFOL(fd,8); //Player Char ID - + sd = map->id2sd(aid); - + if ( !sd ) { ShowError("chrif_load_scdata: Player of AID %d not found!\n", aid); return false; } - + if ( sd->status.char_id != cid ) { ShowError("chrif_load_scdata: Receiving data for account %d, char id does not matches (%d != %d)!\n", aid, sd->status.char_id, cid); return false; } - + count = RFIFOW(fd,12); //sc_count - + for (i = 0; i < count; i++) { data = (struct status_change_data*)RFIFOP(fd,14 + i*sizeof(struct status_change_data)); status->change_start(NULL, &sd->bl, (sc_type)data->type, 10000, data->val1, data->val2, data->val3, data->val4, data->tick, SCFLAG_NOAVOID|SCFLAG_FIXEDTICK|SCFLAG_LOADED|SCFLAG_FIXEDRATE); } - + pc->scdata_received(sd); #endif - return true; } @@ -1204,7 +1192,6 @@ bool chrif_ragsrvinfo(int base_rate, int job_rate, int drop_rate) { WFIFOL(chrif->fd,6) = job_rate; WFIFOL(chrif->fd,10) = drop_rate; WFIFOSET(chrif->fd,14); - return true; } @@ -1270,7 +1257,7 @@ void chrif_on_disconnect(void) { if( chrif->connected != 1 ) ShowWarning("Connection to Char Server lost.\n\n"); chrif->connected = 0; - + chrif->other_mapserver_count = 0; //Reset counter. We receive ALL maps from all map-servers on reconnect. map->eraseallipport(); @@ -1281,19 +1268,19 @@ void chrif_on_disconnect(void) { void chrif_update_ip(int fd) { uint32 new_ip; - + WFIFOHEAD(fd,6); - + new_ip = host2ip(chrif->ip_str); - + if (new_ip && new_ip != chrif->ip) chrif->ip = new_ip; //Update chrif->ip new_ip = clif->refresh_ip(); - + if (!new_ip) return; //No change - + WFIFOW(fd,0) = 0x2736; WFIFOL(fd,2) = htonl(new_ip); WFIFOSET(fd,6); @@ -1310,12 +1297,12 @@ void chrif_keepalive_ack(int fd) { } void chrif_skillid2idx(int fd) { int i, count = 0; - + if( fd == 0 ) fd = chrif->fd; - + if( !session_isValid(fd) ) return; - + WFIFOHEAD(fd,4 + (MAX_SKILL * 4)); WFIFOW(fd,0) = 0x2b0b; for(i = 0; i < MAX_SKILL; i++) { @@ -1367,12 +1354,12 @@ int chrif_parse(int fd) { } cmd = RFIFOW(fd,0); - + if (cmd < 0x2af8 || cmd >= 0x2af8 + ARRAYLENGTH(chrif->packet_len_table) || chrif->packet_len_table[cmd-0x2af8] == 0) { r = intif->parse(fd); // Passed on to the intif - if (r == 1) continue; // Treated in intif - if (r == 2) return 0; // Didn't have enough data (len==-1) + if (r == 1) continue; // Treated in intif + if (r == 2) return 0; // Didn't have enough data (len==-1) ShowWarning("chrif_parse: session #%d, intif->parse failed (unrecognized command 0x%.4x).\n", fd, cmd); set_eof(fd); @@ -1448,20 +1435,18 @@ bool send_users_tochar(void) { chrif_check(false); users = map->usercount(); - + WFIFOHEAD(chrif->fd, 6+8*users); WFIFOW(chrif->fd,0) = 0x2aff; - + iter = mapit_getallusers(); - for( sd = (TBL_PC*)mapit->first(iter); mapit->exists(iter); sd = (TBL_PC*)mapit->next(iter) ) { WFIFOL(chrif->fd,6+8*i) = sd->status.account_id; WFIFOL(chrif->fd,6+8*i+4) = sd->status.char_id; i++; } - mapit->free(iter); - + WFIFOW(chrif->fd,2) = 6 + 8*users; WFIFOW(chrif->fd,4) = users; WFIFOSET(chrif->fd, 6+8*users); @@ -1471,7 +1456,7 @@ bool send_users_tochar(void) { /*========================================== * timerFunction - * Check the connection to char server, (if it down) + * Check the connection to char server, (if it down) *------------------------------------------*/ int check_connect_char_server(int tid, int64 tick, int id, intptr_t data) { static int displayed = 0; @@ -1482,7 +1467,7 @@ int check_connect_char_server(int tid, int64 tick, int id, intptr_t data) { } chrif->state = 0; - + if ( ( chrif->fd = make_connection(chrif->ip, chrif->port,NULL) ) == -1) //Attempt to connect later. [Skotlex] return 0; @@ -1507,8 +1492,8 @@ int check_connect_char_server(int tid, int64 tick, int id, intptr_t data) { /*========================================== * Asks char server to remove friend_id from the friend list of char_id *------------------------------------------*/ -bool chrif_removefriend(int char_id, int friend_id) { - +bool chrif_removefriend(int char_id, int friend_id) +{ chrif_check(false); WFIFOHEAD(chrif->fd,10); @@ -1516,7 +1501,6 @@ bool chrif_removefriend(int char_id, int friend_id) { WFIFOL(chrif->fd,2) = char_id; WFIFOL(chrif->fd,6) = friend_id; WFIFOSET(chrif->fd,10); - return true; } @@ -1524,13 +1508,12 @@ void chrif_send_report(char* buf, int len) { #ifndef STATS_OPT_OUT if( chrif->fd > 0 ) { WFIFOHEAD(chrif->fd,len + 2); - + WFIFOW(chrif->fd,0) = 0x3008; - memcpy(WFIFOP(chrif->fd,2), buf, len); - + WFIFOSET(chrif->fd,len + 2); - + flush_fifo(chrif->fd); /* ensure it's sent now. */ } #endif @@ -1539,13 +1522,13 @@ void chrif_send_report(char* buf, int len) { /** * Sends a single scdata for saving into char server, meant to ensure integrity of duration-less conditions **/ -void chrif_save_scdata_single(int account_id, int char_id, short type, struct status_change_entry *sce) { - +void chrif_save_scdata_single(int account_id, int char_id, short type, struct status_change_entry *sce) +{ if( !chrif->isconnected() ) return; - + WFIFOHEAD(chrif->fd, 28); - + WFIFOW(chrif->fd, 0) = 0x2740; WFIFOL(chrif->fd, 2) = account_id; WFIFOL(chrif->fd, 6) = char_id; @@ -1554,46 +1537,42 @@ void chrif_save_scdata_single(int account_id, int char_id, short type, struct st WFIFOL(chrif->fd, 16) = sce->val2; WFIFOL(chrif->fd, 20) = sce->val3; WFIFOL(chrif->fd, 24) = sce->val4; - + WFIFOSET(chrif->fd, 28); - } /** * Sends a single scdata deletion request into char server, meant to ensure integrity of duration-less conditions **/ -void chrif_del_scdata_single(int account_id, int char_id, short type) { - +void chrif_del_scdata_single(int account_id, int char_id, short type) +{ if( !chrif->isconnected() ) { ShowError("MAYDAY! failed to delete status %d from CID:%d/AID:%d\n",type,char_id,account_id); return; } - WFIFOHEAD(chrif->fd, 12); - + WFIFOW(chrif->fd, 0) = 0x2741; WFIFOL(chrif->fd, 2) = account_id; WFIFOL(chrif->fd, 6) = char_id; WFIFOW(chrif->fd, 10) = type; - - WFIFOSET(chrif->fd, 12); + WFIFOSET(chrif->fd, 12); } -/** ` +/** * @see DBApply */ int auth_db_final(DBKey key, DBData *data, va_list ap) { struct auth_node *node = DB->data2ptr(data); - + if (node->sd) { - if( node->sd->regs.vars ) node->sd->regs.vars->destroy(node->sd->regs.vars, script->reg_destroy); - + if( node->sd->regs.arrays ) node->sd->regs.arrays->destroy(node->sd->regs.arrays, script->array_free_db); - + aFree(node->sd); } ers_free(chrif->auth_db_ers, node); @@ -1604,15 +1583,15 @@ int auth_db_final(DBKey key, DBData *data, va_list ap) { /*========================================== * Destructor *------------------------------------------*/ -void do_final_chrif(void) { - +void do_final_chrif(void) +{ if( chrif->fd != -1 ) { do_close(chrif->fd); chrif->fd = -1; } chrif->auth_db->destroy(chrif->auth_db, chrif->auth_db_final); - + ers_destroy(chrif->auth_db_ers); } @@ -1648,12 +1627,12 @@ void do_init_chrif(bool minimal) { *-------------------------------------*/ void chrif_defaults(void) { const int packet_len_table[CHRIF_PACKET_LEN_TABLE_SIZE] = { // U - used, F - free - 60, 3,-1,27,10,-1, 6,-1, // 2af8-2aff: U->2af8, U->2af9, U->2afa, U->2afb, U->2afc, U->2afd, U->2afe, U->2aff - 6,-1,18, 7,-1,39,30, 10, // 2b00-2b07: U->2b00, U->2b01, U->2b02, U->2b03, U->2b04, U->2b05, U->2b06, U->2b07 - 6,30, -1, 0,86, 7,44,34, // 2b08-2b0f: U->2b08, U->2b09, U->2b0a, F->2b0b, U->2b0c, U->2b0d, U->2b0e, U->2b0f - 11,10,10, 0,11, 0,266,10, // 2b10-2b17: U->2b10, U->2b11, U->2b12, F->2b13, U->2b14, F->2b15, U->2b16, U->2b17 - 2,10, 2,-1,-1,-1, 2, 7, // 2b18-2b1f: U->2b18, U->2b19, U->2b1a, U->2b1b, U->2b1c, U->2b1d, U->2b1e, U->2b1f - -1,10, 8, 2, 2,14,19,19, // 2b20-2b27: U->2b20, U->2b21, U->2b22, U->2b23, U->2b24, U->2b25, U->2b26, U->2b27 + 60, 3, -1, 27, 10, -1, 6, -1, // 2af8-2aff: U->2af8, U->2af9, U->2afa, U->2afb, U->2afc, U->2afd, U->2afe, U->2aff + 6, -1, 18, 7, -1, 39, 30, 10, // 2b00-2b07: U->2b00, U->2b01, U->2b02, U->2b03, U->2b04, U->2b05, U->2b06, U->2b07 + 6, 30, -1, 0, 86, 7, 44, 34, // 2b08-2b0f: U->2b08, U->2b09, U->2b0a, F->2b0b, U->2b0c, U->2b0d, U->2b0e, U->2b0f + 11, 10, 10, 0, 11, 0,266, 10, // 2b10-2b17: U->2b10, U->2b11, U->2b12, F->2b13, U->2b14, F->2b15, U->2b16, U->2b17 + 2, 10, 2, -1, -1, -1, 2, 7, // 2b18-2b1f: U->2b18, U->2b19, U->2b1a, U->2b1b, U->2b1c, U->2b1d, U->2b1e, U->2b1f + -1, 10, 8, 2, 2, 14, 19, 19, // 2b20-2b27: U->2b20, U->2b21, U->2b22, U->2b23, U->2b24, U->2b25, U->2b26, U->2b27 }; chrif = &chrif_s; @@ -1661,7 +1640,7 @@ void chrif_defaults(void) { /* vars */ chrif->connected = 0; chrif->other_mapserver_count = 0; - + memcpy(chrif->packet_len_table,&packet_len_table,sizeof(chrif->packet_len_table)); chrif->fd = -1; chrif->srvinfo = 0; @@ -1671,36 +1650,36 @@ void chrif_defaults(void) { memset(chrif->userid,0,sizeof(chrif->userid)); memset(chrif->passwd,0,sizeof(chrif->passwd)); chrif->state = 0; - + /* */ chrif->auth_db = NULL; chrif->auth_db_ers = NULL; /* */ chrif->init = do_init_chrif; chrif->final = do_final_chrif; - + /* funcs */ chrif->setuserid = chrif_setuserid; chrif->setpasswd = chrif_setpasswd; chrif->checkdefaultlogin = chrif_checkdefaultlogin; chrif->setip = chrif_setip; chrif->setport = chrif_setport; - + chrif->isconnected = chrif_isconnected; chrif->check_shutdown = chrif_check_shutdown; - + chrif->search = chrif_search; chrif->auth_check = chrif_auth_check; chrif->auth_delete = chrif_auth_delete; chrif->auth_finished = chrif_auth_finished; - + chrif->authreq = chrif_authreq; chrif->authok = chrif_authok; chrif->scdata_request = chrif_scdata_request; chrif->save = chrif_save; chrif->charselectreq = chrif_charselectreq; chrif->changemapserver = chrif_changemapserver; - + chrif->searchcharid = chrif_searchcharid; chrif->changeemail = chrif_changeemail; chrif->char_ask_name = chrif_char_ask_name; @@ -1715,13 +1694,13 @@ void chrif_defaults(void) { chrif->changesex = chrif_changesex; //chrif->chardisconnect = chrif_chardisconnect; chrif->divorce = chrif_divorce; - + chrif->removefriend = chrif_removefriend; chrif->send_report = chrif_send_report; - + chrif->flush = chrif_flush; chrif->skillid2idx = chrif_skillid2idx; - + chrif->sd_to_auth = chrif_sd_to_auth; chrif->check_connect_char_server = check_connect_char_server; chrif->auth_logout = chrif_auth_logout; @@ -1732,7 +1711,7 @@ void chrif_defaults(void) { chrif->auth_db_final = auth_db_final; chrif->send_usercount_tochar = send_usercount_tochar; chrif->auth_db_cleanup = auth_db_cleanup; - + chrif->connect = chrif_connect; chrif->connectack = chrif_connectack; chrif->sendmap = chrif_sendmap; diff --git a/src/map/chrif.h b/src/map/chrif.h index 11baaf5ff..2ef4d0eb5 100644 --- a/src/map/chrif.h +++ b/src/map/chrif.h @@ -48,7 +48,7 @@ struct auth_node { struct chrif_interface { /* vars */ - + int connected; int other_mapserver_count; //Holds count of how many other map servers are online (apart of this instance) [Skotlex] @@ -73,22 +73,22 @@ struct chrif_interface { void (*checkdefaultlogin) (void); bool (*setip) (const char* ip); void (*setport) (uint16 port); - + int (*isconnected) (void); void (*check_shutdown) (void); - + struct auth_node* (*search) (int account_id); struct auth_node* (*auth_check) (int account_id, int char_id, enum sd_state state); bool (*auth_delete) (int account_id, int char_id, enum sd_state state); bool (*auth_finished) (struct map_session_data* sd); - + void (*authreq) (struct map_session_data* sd, bool hstandalone); void (*authok) (int fd); bool (*scdata_request) (int account_id, int char_id); bool (*save) (struct map_session_data* sd, int flag); bool (*charselectreq) (struct map_session_data* sd, uint32 s_ip); bool (*changemapserver) (struct map_session_data* sd, uint32 ip, uint16 port); - + bool (*searchcharid) (int char_id); bool (*changeemail) (int id, const char *actual_email, const char *new_email); bool (*char_ask_name) (int acc, const char* character_name, unsigned short operation_type, int year, int month, int day, int hour, int minute, int second); @@ -104,13 +104,13 @@ struct chrif_interface { bool (*changesex) (struct map_session_data *sd); //int (*chardisconnect) (struct map_session_data *sd); // FIXME: Commented out in clif.c, function does not exist bool (*divorce) (int partner_id1, int partner_id2); - + bool (*removefriend) (int char_id, int friend_id); void (*send_report) (char* buf, int len); - + bool (*flush) (void); void (*skillid2idx) (int fd); - + bool (*sd_to_auth) (TBL_PC* sd, enum sd_state state); int (*check_connect_char_server) (int tid, int64 tick, int id, intptr_t data); bool (*auth_logout) (TBL_PC* sd, enum sd_state state); diff --git a/src/map/clif.c b/src/map/clif.c index 7ca37fa38..950898ba5 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -76,12 +76,15 @@ static struct packet_npc_market_open npcmarket_open; static inline int itemtype(int type) { switch( type ) { #if PACKETVER >= 20080827 - case IT_WEAPON: return IT_ARMOR; + case IT_WEAPON: + return IT_ARMOR; case IT_ARMOR: case IT_PETARMOR: #endif - case IT_PETEGG: return IT_WEAPON; - default: return type; + case IT_PETEGG: + return IT_WEAPON; + default: + return type; } } @@ -1467,7 +1470,7 @@ void clif_hominfo(struct map_session_data *sd, struct homun_data *hd, int flag) /// 3 = accessory? /// ? = ignored void clif_send_homdata(struct map_session_data *sd, int state, int param) -{ //[orn] +{ int fd = sd->fd; if ( (state == SP_INTIMATE) && (param >= 910) && (sd->hd->homunculus.class_ == sd->hd->homunculusDB->evo_class) ) @@ -1538,7 +1541,7 @@ void clif_homskillup(struct map_session_data *sd, uint16 skill_id) { //[orn] WFIFOSET(fd,packet_len(0x239)); } -void clif_hom_food(struct map_session_data *sd,int foodid,int fail) //[orn] +void clif_hom_food(struct map_session_data *sd,int foodid,int fail) { int fd; nullpo_retv(sd); @@ -1584,7 +1587,7 @@ void clif_move2(struct block_list *bl, struct view_data *vd, struct unit_data *u case BL_PC: { TBL_PC *sd = ((TBL_PC*)bl); - // clif_movepc(sd); + //clif_movepc(sd); if(sd->state.size==SZ_BIG) // tiny/big players [Valaris] clif->specialeffect(&sd->bl,423,AREA); else if(sd->state.size==SZ_MEDIUM) @@ -2946,7 +2949,7 @@ void clif_updatestatus(struct map_session_data *sd,int type) case SP_WEIGHT: pc->updateweightstatus(sd); WFIFOHEAD(fd,14); - WFIFOW(fd,0)=0xb0; //Need to re-set as pc->updateweightstatus can alter the buffer. [Skotlex] + WFIFOW(fd,0)=0xb0; //Need to re-set as pc->updateweightstatus can alter the buffer. [Skotlex] WFIFOW(fd,2)=type; WFIFOL(fd,4)=sd->weight; break; @@ -4933,8 +4936,8 @@ void clif_deleteskill(struct map_session_data *sd, int id) /// 010e <skill id>.W <level>.W <sp cost>.W <attack range>.W <upgradable>.B /// Merged clif_skillup and clif_guild_skillup, same packet was used [panikon] /// flag: -/// 0: guild call -/// 1: player call +/// 0: guild call +/// 1: player call void clif_skillup(struct map_session_data *sd, uint16 skill_id, int skill_lv, int flag) { int fd; @@ -5065,7 +5068,8 @@ void clif_skill_fail(struct map_session_data *sd,uint16 skill_id,enum useskill_f { int fd; - if (!sd) { //Since this is the most common nullpo.... + if (!sd) { + //Since this is the most common nullpo.... ShowDebug("clif_skill_fail: Error, received NULL sd for skill %d\n", skill_id); return; } @@ -5376,7 +5380,7 @@ void clif_skill_memomessage(struct map_session_data* sd, int type) /// type: /// 0 = "Unable to Teleport in this area" in color 0xFFFF00 (cyan) /// 1 = "Saved point cannot be memorized." in color 0x0000FF (red) -/// 2 = "This skill cannot be used within this area." in color 0xFFFF00 (cyan) +/// 2 = "This skill cannot be used within this area." in color 0xFFFF00 (cyan) /// /// @param sd Who receives the message /// @param type What message @@ -5421,10 +5425,11 @@ void clif_skill_estimation(struct map_session_data *sd,struct block_list *dst) { WBUFW(buf,16) = (battle_config.estimation_type&1?dstatus->mdef:0) + (battle_config.estimation_type&2?dstatus->mdef2:0); WBUFW(buf,18) = dstatus->def_ele; - for(i=0;i<9;i++) + for(i=0;i<9;i++) { WBUFB(buf,20+i)= (unsigned char)battle->attr_ratio(i+1,dstatus->def_ele, dstatus->ele_lv); -// The following caps negative attributes to 0 since the client displays them as 255-fix. [Skotlex] -// WBUFB(buf,20+i)= (unsigned char)((fix=battle->attr_ratio(i+1,dstatus->def_ele, dstatus->ele_lv))<0?0:fix); + // The following caps negative attributes to 0 since the client displays them as 255-fix. [Skotlex] + //WBUFB(buf,20+i)= (unsigned char)((fix=battle->attr_ratio(i+1,dstatus->def_ele, dstatus->ele_lv))<0?0:fix); + } clif->send(buf,packet_len(0x18c),&sd->bl,sd->status.party_id>0?PARTY_SAMEMAP:SELF); } @@ -5507,7 +5512,8 @@ void clif_cooking_list(struct map_session_data *sd, int trigger, uint16 skill_id c++; } - if( skill_id == AM_PHARMACY ) { // Only send it while Cooking else check for c. + if( skill_id == AM_PHARMACY ) { + // Only send it while Cooking else check for c. WFIFOW(fd,2) = 6 + 2 * c; WFIFOSET(fd,WFIFOW(fd,2)); } @@ -5998,17 +6004,17 @@ void clif_use_card(struct map_session_data *sd,int idx) if(itemdb_isspecial(sd->status.inventory[i].card[0])) //Can't slot it continue; - if(sd->status.inventory[i].identify==0 ) //Not identified + if (sd->status.inventory[i].identify == 0) //Not identified continue; - if((sd->inventory_data[i]->equip&ep)==0) //Not equippable on this part. + if ((sd->inventory_data[i]->equip&ep) == 0) //Not equippable on this part. continue; if(sd->inventory_data[i]->type==IT_WEAPON && ep==EQP_SHIELD) //Shield card won't go on left weapon. continue; ARR_FIND( 0, sd->inventory_data[i]->slot, j, sd->status.inventory[i].card[j] == 0 ); - if( j == sd->inventory_data[i]->slot ) // No room + if (j == sd->inventory_data[i]->slot) // No room continue; if( sd->status.inventory[i].equip > 0 ) // Do not check items that are already equipped @@ -6764,7 +6770,7 @@ void clif_party_message(struct party_data* p, int account_id, const char* mes, i WBUFW(buf,0)=0x109; WBUFW(buf,2)=len+8; WBUFL(buf,4)=account_id; - safestrncpy((char *)WBUFP(buf,8), mes, len); + safestrncpy((char *)WBUFP(buf,8), mes, len); clif->send(buf,len+8,&sd->bl,PARTY); } } @@ -7167,20 +7173,20 @@ void clif_devotion(struct block_list *src, struct map_session_data *tsd) * 01e1 <id>.L <amount>.W (ZC_SPIRITS2) *------------------------------------------*/ void clif_spiritball(struct block_list *bl) { - unsigned char buf[16]; - TBL_PC *sd = BL_CAST(BL_PC,bl); - TBL_HOM *hd = BL_CAST(BL_HOM,bl); + unsigned char buf[16]; + TBL_PC *sd = BL_CAST(BL_PC,bl); + TBL_HOM *hd = BL_CAST(BL_HOM,bl); - nullpo_retv(bl); + nullpo_retv(bl); - WBUFW(buf, 0) = 0x1d0; - WBUFL(buf, 2) = bl->id; + WBUFW(buf, 0) = 0x1d0; + WBUFL(buf, 2) = bl->id; WBUFW(buf, 6) = 0; //init to 0 - switch(bl->type){ - case BL_PC: WBUFW(buf, 6) = sd->spiritball; break; - case BL_HOM: WBUFW(buf, 6) = hd->homunculus.spiritball; break; - } - clif->send(buf, packet_len(0x1d0), bl, AREA); + switch(bl->type){ + case BL_PC: WBUFW(buf, 6) = sd->spiritball; break; + case BL_HOM: WBUFW(buf, 6) = hd->homunculus.spiritball; break; + } + clif->send(buf, packet_len(0x1d0), bl, AREA); } @@ -7448,9 +7454,9 @@ void clif_guild_basicinfo(struct map_session_data *sd) { WFIFOL(fd,18)=g->average_lv; WFIFOL(fd,22)=(uint32)cap_value(g->exp,0,INT32_MAX); WFIFOL(fd,26)=g->next_exp; - WFIFOL(fd,30)=0; // Tax Points - WFIFOL(fd,34)=0; // Honor: (left) Vulgar [-100,100] Famed (right) - WFIFOL(fd,38)=0; // Virtue: (down) Wicked [-100,100] Righteous (up) + WFIFOL(fd,30)=0; // Tax Points + WFIFOL(fd,34)=0; // Honor: (left) Vulgar [-100,100] Famed (right) + WFIFOL(fd,38)=0; // Virtue: (down) Wicked [-100,100] Righteous (up) WFIFOL(fd,42)=g->emblem_id; memcpy(WFIFOP(fd,46),g->name, NAME_LENGTH); memcpy(WFIFOP(fd,70),g->master, NAME_LENGTH); @@ -7525,7 +7531,7 @@ void clif_guild_memberlist(struct map_session_data *sd) WFIFOL(fd,c*104+22)=(int)cap_value(m->exp,0,INT32_MAX); WFIFOL(fd,c*104+26)=m->online; WFIFOL(fd,c*104+30)=m->position; - memset(WFIFOP(fd,c*104+34),0,50); //[Ind] - This is displayed in the 'note' column but being you can't edit it it's sent empty. + memset(WFIFOP(fd,c*104+34),0,50); //[Ind] - This is displayed in the 'note' column but being you can't edit it it's sent empty. memcpy(WFIFOP(fd,c*104+84),m->name,NAME_LENGTH); c++; } @@ -8643,9 +8649,11 @@ void clif_charnameack (int fd, struct block_list *bl) } } break; - case BL_CHAT: //FIXME: Clients DO request this... what should be done about it? The chat's title may not fit... [Skotlex] - // memcpy(WBUFP(buf,6), (struct chat*)->title, NAME_LENGTH); - // break; + case BL_CHAT: +#if 0 //FIXME: Clients DO request this... what should be done about it? The chat's title may not fit... [Skotlex] + memcpy(WBUFP(buf,6), (struct chat*)->title, NAME_LENGTH); + break; +#endif return; case BL_ELEM: memcpy(WBUFP(buf,6), ((TBL_ELEM*)bl)->db->name, NAME_LENGTH); @@ -8954,7 +8962,7 @@ void clif_viewequip_ack(struct map_session_data* sd, struct map_session_data* ts for( i = 0; i < EQI_MAX; i++ ) { if( (k = tsd->equip_index[i]) >= 0 ) { - if (tsd->status.inventory[k].nameid <= 0 || tsd->inventory_data[k] == NULL) // Item doesn't exist + if (tsd->status.inventory[k].nameid <= 0 || tsd->inventory_data[k] == NULL) // Item doesn't exist continue; clif_item_equip(k+2,&viewequip_list.list[equip++],&tsd->status.inventory[k],tsd->inventory_data[k],pc->equippoint(tsd,k)); @@ -9045,8 +9053,8 @@ bool clif_process_message(struct map_session_data *sd, int format, char **name_, packetlen = RFIFOW(fd,2); // basic structure checks - if( packetlen < 4 + 1 ) - { // 4-byte header and at least an empty string is expected + if (packetlen < 4 + 1) { + // 4-byte header and at least an empty string is expected ShowWarning("clif_process_message: Received malformed packet from player '%s' (no message data)!\n", sd->status.name); return false; } @@ -9085,8 +9093,8 @@ bool clif_process_message(struct map_session_data *sd, int format, char **name_, name = text; namelen = strnlen(name, NAME_LENGTH-1); // name length (w/o zero byte) - if( name[namelen] != '\0' ) - { // only restriction is that the name must be zero-terminated + if (name[namelen] != '\0') { + // only restriction is that the name must be zero-terminated ShowWarning("clif_process_message: Player '%s' sent an unterminated name!\n", sd->status.name); return false; } @@ -9095,19 +9103,19 @@ bool clif_process_message(struct map_session_data *sd, int format, char **name_, messagelen = textlen - NAME_LENGTH; // this should be the message length (w/ zero byte included) } - if( messagelen != strnlen(message, messagelen)+1 ) - { // the declared length must match real length + if (messagelen != strnlen(message, messagelen)+1) { + // the declared length must match real length ShowWarning("clif_process_message: Received malformed packet from player '%s' (length is incorrect)!\n", sd->status.name); return false; } // verify <message> part of the packet - if( message[messagelen-1] != '\0' ) - { // message must be zero-terminated + if (message[messagelen-1] != '\0') { + // message must be zero-terminated ShowWarning("clif_process_message: Player '%s' sent an unterminated message string!\n", sd->status.name); return false; } - if( messagelen > CHAT_SIZE_MAX-1 ) - { // messages mustn't be too long + if (messagelen > CHAT_SIZE_MAX-1) { + // messages mustn't be too long // Normally you can only enter CHATBOX_SIZE-1 letters into the chat box, but Frost Joke / Dazzler's text can be longer. // Also, the physical size of strings that use multibyte encoding can go multiple times over the chatbox capacity. // Neither the official client nor server place any restriction on the length of the data in the packet, @@ -9407,7 +9415,7 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) { clif->spawn(&sd->pd->bl); clif->send_petdata(sd,sd->pd,0,0); clif->send_petstatus(sd); -// skill->unit_move(&sd->pd->bl,timer->gettick(),1); + //skill->unit_move(&sd->pd->bl,timer->gettick(),1); } } @@ -9800,7 +9808,7 @@ void clif_disconnect_ack(struct map_session_data* sd, short result) /// 0 = quit void clif_parse_QuitGame(int fd, struct map_session_data *sd) { - /* Rovert's prevent logout option fixed [Valaris] */ + /* Rovert's prevent logout option fixed [Valaris] */ if( !sd->sc.data[SC_CLOAKING] && !sd->sc.data[SC_HIDING] && !sd->sc.data[SC_CHASEWALK] && !sd->sc.data[SC_CLOAKINGEXCEED] && !sd->sc.data[SC__INVISIBILITY] && (!battle_config.prevent_logout || DIFF_TICK(timer->gettick(), sd->canlog_tick) > battle_config.prevent_logout) ) { @@ -9827,7 +9835,7 @@ void clif_parse_GetCharNameRequest(int fd, struct map_session_data *sd) { bl = map->id2bl(id); if( bl == NULL ) - return; // Lagged clients could request names of already gone mobs/players. [Skotlex] + return; // Lagged clients could request names of already gone mobs/players. [Skotlex] if( sd->bl.m != bl->m || !check_distance_bl(&sd->bl, bl, AREA_SIZE) ) return; // Block namerequests past view range @@ -10361,10 +10369,12 @@ void clif_parse_Restart(int fd, struct map_session_data *sd) { pc->respawn(sd,CLR_OUTSIGHT); break; case 0x01: - /* Rovert's Prevent logout option - Fixed [Valaris] */ - if( !sd->sc.data[SC_CLOAKING] && !sd->sc.data[SC_HIDING] && !sd->sc.data[SC_CHASEWALK] && !sd->sc.data[SC_CLOAKINGEXCEED] && !sd->sc.data[SC__INVISIBILITY] && - (!battle_config.prevent_logout || DIFF_TICK(timer->gettick(), sd->canlog_tick) > battle_config.prevent_logout) ) - { //Send to char-server for character selection. + /* Rovert's Prevent logout option - Fixed [Valaris] */ + if (!sd->sc.data[SC_CLOAKING] && !sd->sc.data[SC_HIDING] && !sd->sc.data[SC_CHASEWALK] + && !sd->sc.data[SC_CLOAKINGEXCEED] && !sd->sc.data[SC__INVISIBILITY] + && (!battle_config.prevent_logout || DIFF_TICK(timer->gettick(), sd->canlog_tick) > battle_config.prevent_logout) + ) { + //Send to char-server for character selection. chrif->charselectreq(sd, session[fd]->client_addr); } else { clif->disconnect_ack(sd, 1); @@ -11553,7 +11563,7 @@ void clif_parse_UseSkillToPos(int fd, struct map_session_data *sd) RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[1]), //skill num RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[2]), //pos x RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[3]), //pos y - -1 //Skill more info. + -1 //Skill more info. ); } @@ -12232,8 +12242,7 @@ void clif_parse_PartyMessage(int fd, struct map_session_data* sd) if( sd->sc.data[SC_BERSERK] || (sd->sc.data[SC_DEEP_SLEEP] && sd->sc.data[SC_DEEP_SLEEP]->val2) || (sd->sc.data[SC_NOCHAT] && sd->sc.data[SC_NOCHAT]->val1&MANNER_NOCHAT) ) return; - if( battle_config.min_chat_delay ) - { //[Skotlex] + if (battle_config.min_chat_delay) { if (DIFF_TICK(sd->cantalk_tick, timer->gettick()) > 0) return; sd->cantalk_tick = timer->gettick() + battle_config.min_chat_delay; @@ -12738,11 +12747,11 @@ void clif_parse_PartyBookingAckRecall(int fd, struct map_session_data *sd) /// 08f8 <caller AID>.L <reason>.B /// <reason>: -/// REASON_PROHIBITION = 0x0 -/// REASON_MASTER_IN_PROHIBITION_MAP = 0x1 -/// REASON_REFUSE = 0x2 -/// REASON_NOT_PARTY_MEMBER = 0x3 -/// REASON_ETC = 0x4 +/// REASON_PROHIBITION = 0x0 +/// REASON_MASTER_IN_PROHIBITION_MAP = 0x1 +/// REASON_REFUSE = 0x2 +/// REASON_NOT_PARTY_MEMBER = 0x3 +/// REASON_ETC = 0x4 void clif_PartyBookingFailedRecall(int fd, struct map_session_data *sd) { } @@ -12968,22 +12977,22 @@ void clif_parse_GuildRequestInfo(int fd, struct map_session_data *sd) return; switch( RFIFOL(fd,2) ) { - case 0: // Basic Information Guild, hostile alliance information + case 0: // Basic Information Guild, hostile alliance information clif->guild_basicinfo(sd); clif->guild_allianceinfo(sd); break; - case 1: // Members list, list job title + case 1: // Members list, list job title clif->guild_positionnamelist(sd); clif->guild_memberlist(sd); break; - case 2: // List job title, title information list + case 2: // List job title, title information list clif->guild_positionnamelist(sd); clif->guild_positioninfolist(sd); break; - case 3: // Skill list + case 3: // Skill list clif->guild_skillinfo(sd); break; - case 4: // Expulsion list + case 4: // Expulsion list clif->guild_expulsionlist(sd); break; default: @@ -13295,8 +13304,7 @@ void clif_parse_GuildMessage(int fd, struct map_session_data* sd) if( sd->sc.data[SC_BERSERK] || (sd->sc.data[SC_DEEP_SLEEP] && sd->sc.data[SC_DEEP_SLEEP]->val2) || (sd->sc.data[SC_NOCHAT] && sd->sc.data[SC_NOCHAT]->val1&MANNER_NOCHAT) ) return; - if( battle_config.min_chat_delay ) - { //[Skotlex] + if (battle_config.min_chat_delay) { if (DIFF_TICK(sd->cantalk_tick, timer->gettick()) > 0) return; sd->cantalk_tick = timer->gettick() + battle_config.min_chat_delay; @@ -14276,8 +14284,8 @@ void clif_PVPInfo(struct map_session_data* sd) { WFIFOW(fd,0) = 0x210; WFIFOL(fd,2) = sd->status.char_id; WFIFOL(fd,6) = sd->status.account_id; - WFIFOL(fd,10) = sd->pvp_won; // times won - WFIFOL(fd,14) = sd->pvp_lost; // times lost + WFIFOL(fd,10) = sd->pvp_won; // times won + WFIFOL(fd,14) = sd->pvp_lost; // times lost WFIFOL(fd,18) = sd->pvp_point; WFIFOSET(fd, packet_len(0x210)); } @@ -14335,7 +14343,7 @@ void clif_ranklist(struct map_session_data *sd, enum fame_list_type type) { WFIFOW(fd, 0) = 0x97d; WFIFOW(fd, 2) = type; clif_ranklist_sub(WFIFOP(fd,4), type); - + if( (upperMask == MAPID_BLACKSMITH && type == RANKTYPE_BLACKSMITH) || (upperMask == MAPID_ALCHEMIST && type == RANKTYPE_ALCHEMIST) || (upperMask == MAPID_TAEKWON && type == RANKTYPE_TAEKWON) @@ -14510,9 +14518,10 @@ void clif_parse_FeelSaveOk(int fd,struct map_session_data *sd) sd->feel_map[i].m = sd->bl.m; pc_setglobalreg(sd,script->add_str(pc->sg_info[i].feel_var),sd->feel_map[i].index); -//Are these really needed? Shouldn't they show up automatically from the feel save packet? -// clif_misceffect2(&sd->bl, 0x1b0); -// clif_misceffect2(&sd->bl, 0x21f); +#if 0 // Are these really needed? Shouldn't they show up automatically from the feel save packet? + clif_misceffect2(&sd->bl, 0x1b0); + clif_misceffect2(&sd->bl, 0x21f); +#endif // 0 clif->feel_info(sd, i, 0); clif_menuskill_clear(sd); } @@ -15299,7 +15308,7 @@ void clif_parse_Auction_setitem(int fd, struct map_session_data *sd) !sd->status.inventory[idx].identify || !itemdb_canauction(&sd->status.inventory[idx],pc_get_group_level(sd)) || // Quest Item or something else (sd->status.inventory[idx].bound && !pc_can_give_bound_items(sd)) ) { - clif->auction_setitem(sd->fd, idx, true); + clif->auction_setitem(sd->fd, idx, true); return; } @@ -15410,7 +15419,7 @@ void clif_parse_Auction_register(int fd, struct map_session_data *sd) if( sd->status.inventory[sd->auction.index].bound && !pc_can_give_bound_items(sd) ) { clif->message(sd->fd, msg_txt(293)); clif->auction_message(fd, 2); // The auction has been canceled - return; + return; } safestrncpy(auction.item_name, item->jname, sizeof(auction.item_name)); @@ -15587,7 +15596,7 @@ void clif_cashshop_show(struct map_session_data *sd, struct npc_data *nd) { /// For error return codes see enum cashshop_error@clif.h void clif_cashshop_ack(struct map_session_data* sd, int error) { struct npc_data *nd; - int fd = sd->fd; + int fd = sd->fd; int currency[2] = { 0,0 }; if( (nd = map->id2nd(sd->npc_shopid)) && nd->subtype == SCRIPT ) { @@ -15618,34 +15627,33 @@ void clif_cashshop_ack(struct map_session_data* sd, int error) { /// 0288 <packet len>.W <kafra points>.L <count>.W { <amount>.W <name id>.W }.4B*count (PACKETVER >= 20100803) void clif_parse_cashshop_buy(int fd, struct map_session_data *sd) { - int fail = 0; - nullpo_retv(sd); + int fail = 0; + nullpo_retv(sd); - if( sd->state.trading || !sd->npc_shopid || pc_has_permission(sd,PC_PERM_DISABLE_STORE) ) - fail = 1; - else { + if( sd->state.trading || !sd->npc_shopid || pc_has_permission(sd,PC_PERM_DISABLE_STORE) ) + fail = 1; + else { #if PACKETVER < 20101116 - short nameid = RFIFOW(fd,2); - short amount = RFIFOW(fd,4); - int points = RFIFOL(fd,6); + short nameid = RFIFOW(fd,2); + short amount = RFIFOW(fd,4); + int points = RFIFOL(fd,6); - fail = npc->cashshop_buy(sd, nameid, amount, points); + fail = npc->cashshop_buy(sd, nameid, amount, points); #else - int len = RFIFOW(fd,2); - int points = RFIFOL(fd,4); - int count = RFIFOW(fd,8); - unsigned short* item_list = (unsigned short*)RFIFOP(fd,10); - - if( len < 10 || len != 10 + count * 4) - { - ShowWarning("Player %u sent incorrect cash shop buy packet (len %u:%u)!\n", sd->status.char_id, len, 10 + count * 4); - return; - } - fail = npc->cashshop_buylist(sd,points,count,item_list); + int len = RFIFOW(fd,2); + int points = RFIFOL(fd,4); + int count = RFIFOW(fd,8); + unsigned short* item_list = (unsigned short*)RFIFOP(fd,10); + + if( len < 10 || len != 10 + count * 4) { + ShowWarning("Player %u sent incorrect cash shop buy packet (len %u:%u)!\n", sd->status.char_id, len, 10 + count * 4); + return; + } + fail = npc->cashshop_buylist(sd,points,count,item_list); #endif - } + } - clif->cashshop_ack(sd,fail); + clif->cashshop_ack(sd,fail); } @@ -15813,7 +15821,7 @@ void clif_parse_PartyTick(int fd, struct map_session_data* sd) /// 02b1 <packet len>.W <num>.L { <quest id>.L <active>.B }*num void clif_quest_send_list(struct map_session_data *sd) { int fd = sd->fd; - int i; + int i; #if PACKETVER >= 20141022 int info_len = 15; int len = sd->avail_quests*info_len+8; @@ -15822,8 +15830,8 @@ void clif_quest_send_list(struct map_session_data *sd) { #else int info_len = 5; int len = sd->avail_quests*info_len+8; - WFIFOHEAD(fd,len); - WFIFOW(fd, 0) = 0x2b1; + WFIFOHEAD(fd,len); + WFIFOW(fd, 0) = 0x2b1; #endif WFIFOW(fd, 2) = len; WFIFOL(fd, 4) = sd->avail_quests; @@ -16600,8 +16608,8 @@ void clif_parse_ItemListWindowSelected(int fd, struct map_session_data* sd) { case 0: // Change Material skill->changematerial(sd,n,item_list); break; - case 1: // Level 1: Pure to Rough - case 2: // Level 2: Rough to Pure + case 1: // Level 1: Pure to Rough + case 2: // Level 2: Rough to Pure skill->elementalanalysis(sd,n,type,item_list); break; } @@ -17451,8 +17459,8 @@ void clif_charm(struct map_session_data *sd,short type) /// /// R 0908 <index>.w <type>.b /// type: -/// 0 = move item to personal tab -/// 1 = move item to normal tab +/// 0 = move item to personal tab +/// 1 = move item to normal tab void clif_parse_MoveItem(int fd, struct map_session_data *sd) { #if PACKETVER >= 20111122 int index; @@ -17870,7 +17878,7 @@ void clif_bgqueue_update_info(struct map_session_data *sd, unsigned char arena_i safestrncpy(p.bg_name, bg->arena[arena_id]->name, sizeof(p.bg_name)); p.position = position; - sd->bg_queue.client_has_bg_data = true; // Client creates bg data when this packet arrives + sd->bg_queue.client_has_bg_data = true; // Client creates bg data when this packet arrives clif->send(&p,sizeof(p), &sd->bl, SELF); } diff --git a/src/map/clif.h b/src/map/clif.h index a56fbe458..ccaedabcb 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -86,14 +86,14 @@ typedef enum send_target { DUEL, DUEL_WOS, SELF, - + BG, // BattleGround System BG_WOS, BG_SAMEMAP, BG_SAMEMAP_WOS, BG_AREA, BG_AREA_WOS, - + BG_QUEUE, } send_target; @@ -352,16 +352,16 @@ enum clif_messages { * Used to answer CZ_PC_BUY_CASH_POINT_ITEM (clif_parse_cashshop_buy) **/ enum cashshop_error { - ERROR_TYPE_NONE = 0, // The deal has successfully completed. (ERROR_TYPE_NONE) - ERROR_TYPE_NPC, // The Purchase has failed because the NPC does not exist. (ERROR_TYPE_NPC) - ERROR_TYPE_SYSTEM, // The Purchase has failed because the Kafra Shop System is not working correctly. (ERROR_TYPE_SYSTEM) - ERROR_TYPE_INVENTORY_WEIGHT, // You are over your Weight Limit. (ERROR_TYPE_INVENTORY_WEIGHT) - ERROR_TYPE_EXCHANGE, // You cannot purchase items while you are in a trade. (ERROR_TYPE_EXCHANGE) - ERROR_TYPE_ITEM_ID, // The Purchase has failed because the Item Information was incorrect. (ERROR_TYPE_ITEM_ID) - ERROR_TYPE_MONEY, // You do not have enough Kafra Credit Points. (ERROR_TYPE_MONEY) + ERROR_TYPE_NONE = 0, ///< The deal has successfully completed. (ERROR_TYPE_NONE) + ERROR_TYPE_NPC = 1, ///< The Purchase has failed because the NPC does not exist. (ERROR_TYPE_NPC) + ERROR_TYPE_SYSTEM = 2, ///< The Purchase has failed because the Kafra Shop System is not working correctly. (ERROR_TYPE_SYSTEM) + ERROR_TYPE_INVENTORY_WEIGHT = 3, ///< You are over your Weight Limit. (ERROR_TYPE_INVENTORY_WEIGHT) + ERROR_TYPE_EXCHANGE = 4, ///< You cannot purchase items while you are in a trade. (ERROR_TYPE_EXCHANGE) + ERROR_TYPE_ITEM_ID = 5, ///< The Purchase has failed because the Item Information was incorrect. (ERROR_TYPE_ITEM_ID) + ERROR_TYPE_MONEY = 6, ///< You do not have enough Kafra Credit Points. (ERROR_TYPE_MONEY) // Unofficial type names - ERROR_TYPE_QUANTITY, // You can purchase up to 10 items. (ERROR_TYPE_QUANTITY) - ERROR_TYPE_NOT_ALL, // Some items could not be purchased. (ERROR_TYPE_NOT_ALL) + ERROR_TYPE_QUANTITY = 7, ///< You can purchase up to 10 items. (ERROR_TYPE_QUANTITY) + ERROR_TYPE_NOT_ALL = 8, ///< Some items could not be purchased. (ERROR_TYPE_NOT_ALL) }; /** @@ -375,40 +375,40 @@ enum clif_colors { }; enum hChSysChOpt { - hChSys_OPT_BASE = 0x0, - hChSys_OPT_ANNOUNCE_JOIN = 0x1, - hChSys_OPT_MSG_DELAY = 0x2, + hChSys_OPT_BASE = 0x0, + hChSys_OPT_ANNOUNCE_JOIN = 0x1, + hChSys_OPT_MSG_DELAY = 0x2, }; enum hChSysChType { - hChSys_PUBLIC = 0, - hChSys_PRIVATE = 1, - hChSys_MAP = 2, - hChSys_ALLY = 3, - hChSys_IRC = 4, + hChSys_PUBLIC = 0, + hChSys_PRIVATE = 1, + hChSys_MAP = 2, + hChSys_ALLY = 3, + hChSys_IRC = 4, }; enum CASH_SHOP_TABS { - CASHSHOP_TAB_NEW = 0, - CASHSHOP_TAB_POPULAR = 1, - CASHSHOP_TAB_LIMITED = 2, - CASHSHOP_TAB_RENTAL = 3, + CASHSHOP_TAB_NEW = 0, + CASHSHOP_TAB_POPULAR = 1, + CASHSHOP_TAB_LIMITED = 2, + CASHSHOP_TAB_RENTAL = 3, CASHSHOP_TAB_PERPETUITY = 4, - CASHSHOP_TAB_BUFF = 5, - CASHSHOP_TAB_RECOVERY = 6, - CASHSHOP_TAB_ETC = 7, + CASHSHOP_TAB_BUFF = 5, + CASHSHOP_TAB_RECOVERY = 6, + CASHSHOP_TAB_ETC = 7, CASHSHOP_TAB_MAX, }; enum CASH_SHOP_BUY_RESULT { - CSBR_SUCCESS = 0x0, - CSBR_SHORTTAGE_CASH = 0x2, - CSBR_UNKONWN_ITEM = 0x3, - CSBR_INVENTORY_WEIGHT = 0x4, - CSBR_INVENTORY_ITEMCNT = 0x5, - CSBR_RUNE_OVERCOUNT = 0x9, - CSBR_EACHITEM_OVERCOUNT = 0xa, - CSBR_UNKNOWN = 0xb, + CSBR_SUCCESS = 0x0, + CSBR_SHORTTAGE_CASH = 0x2, + CSBR_UNKONWN_ITEM = 0x3, + CSBR_INVENTORY_WEIGHT = 0x4, + CSBR_INVENTORY_ITEMCNT = 0x5, + CSBR_RUNE_OVERCOUNT = 0x9, + CSBR_EACHITEM_OVERCOUNT = 0xa, + CSBR_UNKNOWN = 0xb, }; enum BATTLEGROUNDS_QUEUE_ACK { @@ -587,7 +587,7 @@ struct clif_interface { struct { int *nameid[MAX_ROULETTE_LEVEL];//nameid int *qty[MAX_ROULETTE_LEVEL];//qty of nameid - int items[MAX_ROULETTE_LEVEL];//number of items in the list for each + int items[MAX_ROULETTE_LEVEL];//number of items in the list for each } rd; /* */ unsigned int cryptKey[3]; diff --git a/src/map/duel.h b/src/map/duel.h index e88f6ec4e..5466f3b43 100644 --- a/src/map/duel.h +++ b/src/map/duel.h @@ -37,7 +37,7 @@ struct duel_interface { void (*leave) (const unsigned int did, struct map_session_data* sd); void (*showinfo) (const unsigned int did, struct map_session_data* sd); int (*checktime) (struct map_session_data* sd); - + void (*init) (bool minimal); void (*final) (void); }; diff --git a/src/map/elemental.c b/src/map/elemental.c index b594c8899..50d6c34b3 100644 --- a/src/map/elemental.c +++ b/src/map/elemental.c @@ -246,7 +246,8 @@ int elemental_data_received(struct s_elemental *ele, bool flag) { } db = &elemental->db[i]; - if( !sd->ed ) { // Initialize it after first summon. + if( !sd->ed ) { + // Initialize it after first summon. sd->ed = ed = (struct elemental_data*)aCalloc(1,sizeof(struct elemental_data)); ed->bl.type = BL_ELEM; ed->bl.id = npc->get_new_npc_id(); @@ -322,8 +323,8 @@ int elemental_clean_single_effect(struct elemental_data *ed, uint16 skill_id) { case SC_UPHEAVAL_OPTION: case SC_CIRCLE_OF_FIRE_OPTION: case SC_TIDAL_WEAPON_OPTION: - if( bl ) status_change_end(bl,type,INVALID_TIMER); // Master - status_change_end(&ed->bl,type-1,INVALID_TIMER); // Elemental Spirit + if( bl ) status_change_end(bl,type,INVALID_TIMER); // Master + status_change_end(&ed->bl,type-1,INVALID_TIMER); // Elemental Spirit break; case SC_ZEPHYR: if( bl ) status_change_end(bl,type,INVALID_TIMER); @@ -409,7 +410,7 @@ int elemental_action(struct elemental_data *ed, struct block_list *bl, int64 tic return 0; if( ed->target_id ) - elemental->unlocktarget(ed); // Remove previous target. + elemental->unlocktarget(ed); // Remove previous target. ARR_FIND(0, MAX_ELESKILLTREE, i, ed->db->skill[i].id && (ed->db->skill[i].mode&EL_SKILLMODE_AGGRESSIVE)); if( i == MAX_ELESKILLTREE ) @@ -426,7 +427,7 @@ int elemental_action(struct elemental_data *ed, struct block_list *bl, int64 tic else if( DIFF_TICK(tick, ed->ud.canact_tick) < 0 ) return 0; - ed->target_id = ed->ud.skilltarget = bl->id; // Set new target + ed->target_id = ed->ud.skilltarget = bl->id; // Set new target ed->last_thinktime = tick; // Not in skill range. @@ -504,7 +505,7 @@ int elemental_change_mode_ack(struct elemental_data *ed, int mode) { else if( DIFF_TICK(timer->gettick(), ed->ud.canact_tick) < 0 ) return 0; - ed->target_id = bl->id; // Set new target + ed->target_id = bl->id; // Set new target ed->last_thinktime = timer->gettick(); if( skill->get_inf(skill_id) & INF_GROUND_SKILL ) @@ -512,7 +513,7 @@ int elemental_change_mode_ack(struct elemental_data *ed, int mode) { else unit->skilluse_id(&ed->bl,bl->id,skill_id,skill_lv); - ed->target_id = 0; // Reset target after casting the skill to avoid continuous attack. + ed->target_id = 0; // Reset target after casting the skill to avoid continuous attack. return 1; } @@ -532,9 +533,9 @@ int elemental_change_mode(struct elemental_data *ed, int mode) { ed->battle_status.mode = ed->elemental.mode = mode; // Normalize elemental mode to elemental skill mode. - if( mode == EL_MODE_AGGRESSIVE ) mode = EL_SKILLMODE_AGGRESSIVE; // Aggressive spirit mode -> Aggressive spirit skill. - else if( mode == EL_MODE_ASSIST ) mode = EL_SKILLMODE_ASSIST; // Assist spirit mode -> Assist spirit skill. - else mode = EL_SKILLMODE_PASIVE; // Passive spirit mode -> Passive spirit skill. + if( mode == EL_MODE_AGGRESSIVE ) mode = EL_SKILLMODE_AGGRESSIVE; // Aggressive spirit mode -> Aggressive spirit skill. + else if( mode == EL_MODE_ASSIST ) mode = EL_SKILLMODE_ASSIST; // Assist spirit mode -> Assist spirit skill. + else mode = EL_SKILLMODE_PASIVE; // Passive spirit mode -> Passive spirit skill. // Use a skill immediately after every change mode. if( mode != EL_SKILLMODE_AGGRESSIVE ) @@ -580,7 +581,7 @@ struct skill_condition elemental_skill_get_requirements(uint16 skill_id, uint16 memset(&req,0,sizeof(req)); if( idx == 0 ) // invalid skill id - return req; + return req; if( skill_lv < 1 || skill_lv > MAX_SKILL_LEVEL ) return req; @@ -660,12 +661,16 @@ int elemental_ai_sub_timer(struct elemental_data *ed, struct map_session_data *s int sp = 5; switch(ed->vd->class_){ - case 2115: case 2118: - case 2121: case 2124: + case 2115: + case 2118: + case 2121: + case 2124: sp = 8; break; - case 2116: case 2119: - case 2122: case 2125: + case 2116: + case 2119: + case 2122: + case 2125: sp = 11; break; } @@ -701,13 +706,15 @@ int elemental_ai_sub_timer(struct elemental_data *ed, struct map_session_data *s mode = status_get_mode(&ed->bl); master_dist = distance_bl(&sd->bl, &ed->bl); - if( master_dist > AREA_SIZE ) { // Master out of vision range. + if( master_dist > AREA_SIZE ) { + // Master out of vision range. elemental->unlocktarget(ed); unit->warp(&ed->bl,sd->bl.m,sd->bl.x,sd->bl.y,CLR_TELEPORT); clif->elemental_updatestatus(sd,SP_HP); clif->elemental_updatestatus(sd,SP_SP); return 0; - } else if( master_dist > MAX_ELEDISTANCE ) { // Master too far, chase. + } else if( master_dist > MAX_ELEDISTANCE ) { + // Master too far, chase. short x = sd->bl.x, y = sd->bl.y; if( ed->target_id ) elemental->unlocktarget(ed); diff --git a/src/map/elemental.h b/src/map/elemental.h index 0c8fff8b3..ca13c30b8 100644 --- a/src/map/elemental.h +++ b/src/map/elemental.h @@ -79,22 +79,22 @@ struct elemental_interface { /* funcs */ bool (*class) (int class_); struct view_data * (*get_viewdata) (int class_); - + int (*create) (struct map_session_data *sd, int class_, unsigned int lifetime); int (*data_received) (struct s_elemental *ele, bool flag); int (*save) (struct elemental_data *ed); - + int (*change_mode_ack) (struct elemental_data *ed, int mode); int (*change_mode) (struct elemental_data *ed, int mode); - + void (*heal) (struct elemental_data *ed, int hp, int sp); int (*dead) (struct elemental_data *ed); - + int (*delete) (struct elemental_data *ed, int reply); void (*summon_stop) (struct elemental_data *ed); - + int (*get_lifetime) (struct elemental_data *ed); - + int (*unlocktarget) (struct elemental_data *ed); int (*skillnotok) (uint16 skill_id, struct elemental_data *ed); int (*set_target) (struct map_session_data *sd, struct block_list *bl); @@ -102,11 +102,11 @@ struct elemental_interface { int (*clean_effect) (struct elemental_data *ed); int (*action) (struct elemental_data *ed, struct block_list *bl, int64 tick); struct skill_condition (*skill_get_requirements) (uint16 skill_id, uint16 skill_lv); - + int (*read_skilldb) (void); void (*reload_db) (void); void (*reload_skilldb) (void); - + int (*search_index) (int class_); void (*summon_init) (struct elemental_data *ed); int (*summon_end_timer) (int tid, int64 tick, int id, intptr_t data); diff --git a/src/map/guild.c b/src/map/guild.c index 1d9cf03a9..e43a5881e 100644 --- a/src/map/guild.c +++ b/src/map/guild.c @@ -63,10 +63,10 @@ int guild_skill_get_max (int id) { // Retrieve skill_lv learned by guild int guild_checkskill(struct guild *g, int id) { - int idx = id - GD_SKILLBASE; - if (idx < 0 || idx >= MAX_GUILDSKILL) - return 0; - return g->skill[idx].lv; + int idx = id - GD_SKILLBASE; + if (idx < 0 || idx >= MAX_GUILDSKILL) + return 0; + return g->skill[idx].lv; } /*========================================== @@ -236,17 +236,17 @@ void guild_makemember(struct guild_member *m,struct map_session_data *sd) nullpo_retv(sd); memset(m,0,sizeof(struct guild_member)); - m->account_id =sd->status.account_id; - m->char_id =sd->status.char_id; - m->hair =sd->status.hair; - m->hair_color =sd->status.hair_color; - m->gender =sd->status.sex; - m->class_ =sd->status.class_; - m->lv =sd->status.base_level; -// m->exp =0; -// m->exp_payper =0; - m->online =1; - m->position =MAX_GUILDPOSITION-1; + m->account_id = sd->status.account_id; + m->char_id = sd->status.char_id; + m->hair = sd->status.hair; + m->hair_color = sd->status.hair_color; + m->gender = sd->status.sex; + m->class_ = sd->status.class_; + m->lv = sd->status.base_level; + //m->exp = 0; + //m->exp_payper = 0; + m->online = 1; + m->position = MAX_GUILDPOSITION-1; memcpy(m->name,sd->status.name,NAME_LENGTH); return; } @@ -366,14 +366,14 @@ int guild_created(int account_id,int guild_id) { if(sd==NULL) return 0; if(!guild_id) { - clif->guild_created(sd, 2); // Creation failure (presence of the same name Guild) + clif->guild_created(sd, 2); // Creation failure (presence of the same name Guild) return 0; } //struct guild *g; sd->status.guild_id=guild_id; clif->guild_created(sd,0); if(battle_config.guild_emperium_check) - pc->delitem(sd,pc->search_inventory(sd,ITEMID_EMPERIUM),1,0,0,LOG_TYPE_CONSUME); //emperium consumption + pc->delitem(sd,pc->search_inventory(sd,ITEMID_EMPERIUM),1,0,0,LOG_TYPE_CONSUME); //emperium consumption return 0; } @@ -567,32 +567,32 @@ int guild_recv_info(struct guild *sg) { bm++; } - for (i = 0; i < g->max_member; i++) { //Transmission of information at all members + for (i = 0; i < g->max_member; i++) { //Transmission of information at all members sd = g->member[i].sd; if( sd==NULL ) continue; sd->guild = g; - if (before.guild_lv != g->guild_lv || bm != m || - before.max_member != g->max_member) { - clif->guild_basicinfo(sd); //Submit basic information - clif->guild_emblem(sd, g); //Submit emblem - } + if (before.guild_lv != g->guild_lv || bm != m + || before.max_member != g->max_member) { + clif->guild_basicinfo(sd); //Submit basic information + clif->guild_emblem(sd, g); //Submit emblem + } - if (bm != m) { //Send members information - clif->guild_memberlist(g->member[i].sd); - } + if (bm != m) { //Send members information + clif->guild_memberlist(g->member[i].sd); + } - if (before.skill_point != g->skill_point) - clif->guild_skillinfo(sd); //Submit information skills + if (before.skill_point != g->skill_point) + clif->guild_skillinfo(sd); //Submit information skills if (guild_new) { // Send information and affiliation if unsent - clif->guild_belonginfo(sd, g); - //clif->guild_notice(sd, g); Is already sent in clif_parse_LoadEndAck - sd->guild_emblem_id = g->emblem_id; - } - } + clif->guild_belonginfo(sd, g); + //clif->guild_notice(sd, g); Is already sent in clif_parse_LoadEndAck + sd->guild_emblem_id = g->emblem_id; + } + } - //Occurrence of an event + //Occurrence of an event if (guild->infoevent_db->remove(guild->infoevent_db, DB->i2key(sg->guild_id), &data)) { struct eventlist *ev = DB->data2ptr(&data), *ev2; while(ev) { @@ -610,8 +610,8 @@ int guild_recv_info(struct guild *sg) { * Player sd send a guild invatation to player tsd to join his guild *--------------------------------------------*/ int guild_invite(struct map_session_data *sd, struct map_session_data *tsd) { - struct guild *g; - int i; + struct guild *g; + int i; nullpo_ret(sd); @@ -624,7 +624,7 @@ int guild_invite(struct map_session_data *sd, struct map_session_data *tsd) { return 0; //Invite permission. if(!battle_config.invite_request_check) { - if (tsd->party_invite > 0 || tsd->trade_partner || tsd->adopt_invite) { //checking if there no other invitation pending + if (tsd->party_invite > 0 || tsd->trade_partner || tsd->adopt_invite) { //checking if there no other invitation pending clif->guild_inviteack(sd,0); return 0; } @@ -635,8 +635,8 @@ int guild_invite(struct map_session_data *sd, struct map_session_data *tsd) { return 0; } - if( tsd->status.guild_id > 0 - || tsd->guild_invite > 0 + if( tsd->status.guild_id > 0 + || tsd->guild_invite > 0 || ( (map->agit_flag || map->agit2_flag) && map->list[tsd->bl.m].flag.gvg_castle && !battle_config.guild_castle_invite @@ -730,7 +730,8 @@ void guild_member_joined(struct map_session_data *sd) guild->request_info(sd->status.guild_id); return; } - if (strcmp(sd->status.name,g->master) == 0) { // set the Guild Master flag + if (strcmp(sd->status.name,g->master) == 0) { + // set the Guild Master flag sd->state.gmaster_flag = 1; // prevent Guild Skills from being used directly after relog if( battle_config.guild_skill_relog_delay ) @@ -823,8 +824,8 @@ int guild_leave(struct map_session_data* sd, int guild_id, int account_id, int c return 0; if( sd->status.account_id != account_id - || sd->status.char_id != char_id - || sd->status.guild_id != guild_id + || sd->status.char_id != char_id + || sd->status.guild_id != guild_id // Can't leave inside castles || ((map->agit_flag || map->agit2_flag) && map->list[sd->bl.m].flag.gvg_castle @@ -855,11 +856,11 @@ int guild_expulsion(struct map_session_data* sd, int guild_id, int account_id, i return 0; if( (ps=guild->getposition(g,sd))<0 || !(g->position[ps].mode&0x0010) ) - return 0; //Expulsion permission + return 0; //Expulsion permission //Can't leave inside guild castles. - if ((tsd = map->id2sd(account_id)) - && tsd->status.char_id == char_id + if ((tsd = map->id2sd(account_id)) + && tsd->status.char_id == char_id && ((map->agit_flag || map->agit2_flag) && map->list[sd->bl.m].flag.gvg_castle && !battle_config.guild_castle_expulsion) @@ -976,8 +977,8 @@ int guild_send_memberinfoshort(struct map_session_data *sd,int online) return 0; } - if(sd->state.connect_new) - { //Note that this works because it is invoked in parse_LoadEndAck before connect_new is cleared. + if (sd->state.connect_new) { + //Note that this works because it is invoked in parse_LoadEndAck before connect_new is cleared. clif->guild_belonginfo(sd,g); sd->guild_emblem_id = g->emblem_id; } @@ -1392,8 +1393,8 @@ void guild_guildaura_refresh(struct map_session_data *sd, uint16 skill_id, uint1 /*==================================================== * Count number of relations the guild has. * Flag: - * 0 = allied - * 1 = enemy + * 0 = allied + * 1 = enemy *---------------------------------------------------*/ int guild_get_alliance_count(struct guild *g,int flag) { @@ -1401,9 +1402,8 @@ int guild_get_alliance_count(struct guild *g,int flag) nullpo_ret(g); - for(i=c=0;i<MAX_GUILDALLIANCE;i++){ - if( g->alliance[i].guild_id>0 && - g->alliance[i].opposition==flag ) + for(i=c=0;i<MAX_GUILDALLIANCE;i++) { + if(g->alliance[i].guild_id>0 && g->alliance[i].opposition==flag) c++; } return c; @@ -1421,8 +1421,8 @@ void guild_block_skill(struct map_session_data *sd, int time) /*==================================================== * Check relation between guild_id1 and guild_id2. * Flag: - * 0 = allied - * 1 = enemy + * 0 = allied + * 1 = enemy * Returns true if yes. *---------------------------------------------------*/ int guild_check_alliance(int guild_id1, int guild_id2, int flag) @@ -1467,7 +1467,7 @@ int guild_reqalliance(struct map_session_data *sd,struct map_session_data *tsd) if(sd->status.guild_id == tsd->status.guild_id) return 0; - if( guild->get_alliance_count(g[0],0) >= battle_config.max_guild_alliance ) { + if( guild->get_alliance_count(g[0],0) >= battle_config.max_guild_alliance ) { clif->guild_allianceack(sd,4); return 0; } @@ -1481,9 +1481,8 @@ int guild_reqalliance(struct map_session_data *sd,struct map_session_data *tsd) return 0; } - for (i = 0; i < MAX_GUILDALLIANCE; i++) { // check if already allied - if( g[0]->alliance[i].guild_id==tsd->status.guild_id && - g[0]->alliance[i].opposition==0){ + for (i = 0; i < MAX_GUILDALLIANCE; i++) { // check if already allied + if(g[0]->alliance[i].guild_id==tsd->status.guild_id && g[0]->alliance[i].opposition==0) { clif->guild_allianceack(sd,0); return 0; } @@ -1509,13 +1508,13 @@ int guild_reply_reqalliance(struct map_session_data *sd,int account_id,int flag) return 0; } - if (sd->guild_alliance != tsd->status.guild_id) // proposed guild_id alliance doesn't match tsd guildid + if (sd->guild_alliance != tsd->status.guild_id) // proposed guild_id alliance doesn't match tsd guildid return 0; - if (flag == 1) { // consent + if (flag == 1) { // consent int i; - struct guild *g, *tg; // Reconfirm the number of alliance + struct guild *g, *tg; // Reconfirm the number of alliance g=sd->guild; tg=tsd->guild; @@ -1543,11 +1542,11 @@ int guild_reply_reqalliance(struct map_session_data *sd,int account_id,int flag) tsd->status.account_id,sd->status.account_id,9 ); } - // inform other servers + // inform other servers intif->guild_alliance( sd->status.guild_id,tsd->status.guild_id, sd->status.account_id,tsd->status.account_id,0 ); return 0; - } else { // deny + } else { // deny sd->guild_alliance=0; sd->guild_alliance_account=0; if(tsd!=NULL) @@ -1590,7 +1589,7 @@ int guild_opposition(struct map_session_data *sd,struct map_session_data *tsd) if(sd->status.guild_id == tsd->status.guild_id) return 0; - if( guild->get_alliance_count(g,1) >= battle_config.max_guild_alliance ) { + if( guild->get_alliance_count(g,1) >= battle_config.max_guild_alliance ) { clif->guild_oppositionack(sd,1); return 0; } @@ -1711,7 +1710,8 @@ int guild_broken_sub(DBKey key, DBData *data, va_list ap) nullpo_ret(g); - for(i=0;i<MAX_GUILDALLIANCE;i++){ // Destroy all relationships + for(i=0;i<MAX_GUILDALLIANCE;i++) { + // Destroy all relationships if(g->alliance[i].guild_id==guild_id){ for(j=0;j<g->max_member;j++) if( (sd=g->member[j].sd)!=NULL ) @@ -1757,7 +1757,8 @@ int guild_broken(int guild_id,int flag) if(flag!=0 || g==NULL) return 0; - for(i=0;i<g->max_member;i++){ // Destroy all relationships + for(i=0;i<g->max_member;i++){ + // Destroy all relationships if((sd=g->member[i].sd)!=NULL){ if(sd->state.storage_flag == 2) gstorage->pc_quit(sd,1); @@ -1886,11 +1887,13 @@ int guild_break(struct map_session_data *sd,char *name) { return 0; if(!sd->state.gmaster_flag) return 0; - for(i=0;i<g->max_member;i++){ - if( g->member[i].account_id>0 && ( - g->member[i].account_id!=sd->status.account_id || - g->member[i].char_id!=sd->status.char_id )) + for (i = 0; i < g->max_member; i++) { + if (g->member[i].account_id > 0 + && (g->member[i].account_id!=sd->status.account_id + || g->member[i].char_id!=sd->status.char_id + )) { break; + } } if(i<g->max_member){ clif->guild_broken(sd,2); @@ -2094,7 +2097,8 @@ int guild_castledataloadack(int len, struct guild_castle *gc) * Start normal woe and triggers all npc OnAgitStart *---------------------------------------------------*/ void guild_agit_start(void) -{ // Run All NPC_Event[OnAgitStart] +{ + // Run All NPC_Event[OnAgitStart] int c = npc->event_doall("OnAgitStart"); ShowStatus("NPC_Event:[OnAgitStart] Run (%d) Events by @AgitStart.\n",c); } @@ -2103,7 +2107,8 @@ void guild_agit_start(void) * End normal woe and triggers all npc OnAgitEnd *---------------------------------------------------*/ void guild_agit_end(void) -{ // Run All NPC_Event[OnAgitEnd] +{ + // Run All NPC_Event[OnAgitEnd] int c = npc->event_doall("OnAgitEnd"); ShowStatus("NPC_Event:[OnAgitEnd] Run (%d) Events by @AgitEnd.\n",c); } @@ -2112,7 +2117,8 @@ void guild_agit_end(void) * Start woe2 and triggers all npc OnAgitStart2 *---------------------------------------------------*/ void guild_agit2_start(void) -{ // Run All NPC_Event[OnAgitStart2] +{ + // Run All NPC_Event[OnAgitStart2] int c = npc->event_doall("OnAgitStart2"); ShowStatus("NPC_Event:[OnAgitStart2] Run (%d) Events by @AgitStart2.\n",c); } @@ -2121,7 +2127,8 @@ void guild_agit2_start(void) * End woe2 and triggers all npc OnAgitEnd2 *---------------------------------------------------*/ void guild_agit2_end(void) -{ // Run All NPC_Event[OnAgitEnd2] +{ + // Run All NPC_Event[OnAgitEnd2] int c = npc->event_doall("OnAgitEnd2"); ShowStatus("NPC_Event:[OnAgitEnd2] Run (%d) Events by @AgitEnd2.\n",c); } diff --git a/src/map/guild.h b/src/map/guild.h index 126325eef..eb6de7070 100644 --- a/src/map/guild.h +++ b/src/map/guild.h @@ -13,8 +13,8 @@ /** * Defines **/ -#define GUILD_SEND_XY_INVERVAL 5000 // Interval of sending coordinates and HP -#define GUILD_PAYEXP_INVERVAL 10000 //Interval (maximum survival time of the cache, in milliseconds) +#define GUILD_SEND_XY_INVERVAL 5000 // Interval of sending coordinates and HP +#define GUILD_PAYEXP_INVERVAL 10000 //Interval (maximum survival time of the cache, in milliseconds) #define MAX_GUILD_SKILL_REQUIRE 5 /** diff --git a/src/map/homunculus.c b/src/map/homunculus.c index f4ffc62a6..e45f654ff 100644 --- a/src/map/homunculus.c +++ b/src/map/homunculus.c @@ -78,39 +78,39 @@ enum homun_type homunculus_class2type(int class_) { } void homunculus_addspiritball(struct homun_data *hd, int max) { - nullpo_retv(hd); + nullpo_retv(hd); - if (max > MAX_SKILL_LEVEL) - max = MAX_SKILL_LEVEL; - if (hd->homunculus.spiritball < 0) - hd->homunculus.spiritball = 0; + if (max > MAX_SKILL_LEVEL) + max = MAX_SKILL_LEVEL; + if (hd->homunculus.spiritball < 0) + hd->homunculus.spiritball = 0; - if (hd->homunculus.spiritball && hd->homunculus.spiritball >= max) { - hd->homunculus.spiritball = max; - } - else - hd->homunculus.spiritball++; + if (hd->homunculus.spiritball && hd->homunculus.spiritball >= max) { + hd->homunculus.spiritball = max; + } + else + hd->homunculus.spiritball++; - clif->spiritball(&hd->bl); + clif->spiritball(&hd->bl); } void homunculus_delspiritball(struct homun_data *hd, int count, int type) { - nullpo_retv(hd); - - if (hd->homunculus.spiritball <= 0) { - hd->homunculus.spiritball = 0; - return; - } - if (count <= 0) - return; - if (count > MAX_SKILL_LEVEL) - count = MAX_SKILL_LEVEL; - if (count > hd->homunculus.spiritball) - count = hd->homunculus.spiritball; - - hd->homunculus.spiritball -= count; - if (!type) - clif->spiritball(&hd->bl); + nullpo_retv(hd); + + if (hd->homunculus.spiritball <= 0) { + hd->homunculus.spiritball = 0; + return; + } + if (count <= 0) + return; + if (count > MAX_SKILL_LEVEL) + count = MAX_SKILL_LEVEL; + if (count > hd->homunculus.spiritball) + count = hd->homunculus.spiritball; + + hd->homunculus.spiritball -= count; + if (!type) + clif->spiritball(&hd->bl); } void homunculus_damaged(struct homun_data *hd) { @@ -313,7 +313,7 @@ bool homunculus_levelup(struct homun_data *hd) { hom = &hd->homunculus; hom->level++ ; if (!(hom->level % 3)) - hom->skillpts++; //1 skillpoint each 3 base level + hom->skillpts++; //1 skillpoint each 3 base level hom->exp -= hd->exp_next; hd->exp_next = homun->exptable[hom->level - 1]; @@ -500,7 +500,7 @@ int homunculus_gainexp(struct homun_data *hd,unsigned int exp) { return 0; } - //levelup + //levelup while( hd->homunculus.exp > hd->exp_next && homun->levelup(hd) ); if( hd->exp_next == 0 ) @@ -601,7 +601,7 @@ bool homunculus_feed(struct map_session_data *sd, struct homun_data *hd) { emotion = E_HO; } - hd->homunculus.hunger += 10; //dunno increase value for each food + hd->homunculus.hunger += 10; //dunno increase value for each food if(hd->homunculus.hunger > 100) hd->homunculus.hunger = 100; @@ -912,7 +912,7 @@ bool homunculus_ressurect(struct map_session_data* sd, unsigned char per, short hd = sd->hd; - if (hd->homunculus.vaporize != HOM_ST_ACTIVE) + if (hd->homunculus.vaporize != HOM_ST_ACTIVE) return false; // vaporized homunculi need to be 'called' if (!status->isdead(&hd->bl)) @@ -1151,7 +1151,7 @@ bool homunculus_read_skill_db_sub(char* split[], int columns, int current) { int minJobLevelPresent = 0; if( columns == 15 ) - minJobLevelPresent = 1; // MinJobLvl has been added - FIXME: is this extra field even needed anymore? + minJobLevelPresent = 1; // MinJobLvl has been added - FIXME: is this extra field even needed anymore? // check for bounds [celest] classid = atoi(split[0]) - HM_CLASS_BASE; diff --git a/src/map/homunculus.h b/src/map/homunculus.h index 25ccabf48..263922e4e 100644 --- a/src/map/homunculus.h +++ b/src/map/homunculus.h @@ -65,7 +65,7 @@ struct homun_data { int hungry_timer; //[orn] unsigned int exp_next; char blockskill[MAX_SKILL]; // [orn] - + int64 masterteleport_timer; }; diff --git a/src/map/instance.c b/src/map/instance.c index 5789d7dd6..4140973b1 100644 --- a/src/map/instance.c +++ b/src/map/instance.c @@ -273,7 +273,7 @@ int instance_add_map(const char *name, int instance_id, bool usebasename, const * type : result (0 = map id | 1 = instance id) *--------------------------------------*/ int instance_map2imap(int16 m, int instance_id) { - int i; + int i; if( !instance->valid(instance_id) ) { return -1; @@ -282,12 +282,12 @@ int instance_map2imap(int16 m, int instance_id) { for( i = 0; i < instance->list[instance_id].num_map; i++ ) { if( instance->list[instance_id].map[i] && map->list[instance->list[instance_id].map[i]].instance_src_map == m ) return instance->list[instance_id].map[i]; - } - return -1; + } + return -1; } int instance_mapname2imap(const char *map_name, int instance_id) { - int i; + int i; if( !instance->valid(instance_id) ) { return -1; @@ -296,8 +296,8 @@ int instance_mapname2imap(const char *map_name, int instance_id) { for( i = 0; i < instance->list[instance_id].num_map; i++ ) { if( instance->list[instance_id].map[i] && !strcmpi(map->list[map->list[instance->list[instance_id].map[i]].instance_src_map].name,map_name) ) return instance->list[instance_id].map[i]; - } - return -1; + } + return -1; } diff --git a/src/map/instance.h b/src/map/instance.h index 2ee77d3e3..4848c9c59 100644 --- a/src/map/instance.h +++ b/src/map/instance.h @@ -41,17 +41,17 @@ struct instance_data { unsigned short users; struct reg_db regs; ///< Instance variables for scripts - + int progress_timer; unsigned int progress_timeout; int idle_timer; unsigned int idle_timeout, idle_timeoutval; - + unsigned int original_progress_timeout; - + struct point respawn; ///< reload spawn - + /** HPM Custom Struct */ struct HPluginData **hdata; unsigned int hdatac; diff --git a/src/map/intif.c b/src/map/intif.c index c20905bcf..73fb648ae 100644 --- a/src/map/intif.c +++ b/src/map/intif.c @@ -210,8 +210,8 @@ int intif_wis_message(struct map_session_data *sd, char *nick, char *mes, size_t if (intif->CheckForCharServer()) return 0; - if (chrif->other_mapserver_count < 1) - { //Character not found. + if (chrif->other_mapserver_count < 1) { + //Character not found. clif->wis_end(sd->fd, 1); return 0; } @@ -924,8 +924,8 @@ void intif_parse_WisMessage(int fd) { strcmp(sd->ignore[i].name, wisp_source) != 0 ; i++); - if (i < MAX_IGNORE_LIST && sd->ignore[i].name[0] != '\0') - { //Ignored + if (i < MAX_IGNORE_LIST && sd->ignore[i].name[0] != '\0') { + //Ignored intif_wis_replay(id, 2); return; } @@ -1113,7 +1113,7 @@ void intif_parse_LoadGuildStorage(int fd) } if (RFIFOW(fd,2)-13 != sizeof(struct guild_storage)) { ShowError("intif_parse_LoadGuildStorage: data size mismatch %d != %"PRIuS"\n", RFIFOW(fd,2)-13, sizeof(struct guild_storage)); - gstor->storage_status = 0; + gstor->storage_status = 0; return; } @@ -2136,7 +2136,7 @@ void intif_request_accinfo( int u_fd, int aid, int group_lv, char* query ) { WFIFOL(inter_fd,2) = u_fd; WFIFOL(inter_fd,6) = aid; WFIFOL(inter_fd,10) = group_lv; - safestrncpy((char *)WFIFOP(inter_fd,14), query, NAME_LENGTH); + safestrncpy((char *)WFIFOP(inter_fd,14), query, NAME_LENGTH); WFIFOSET(inter_fd,2 + 4 + 4 + 4 + NAME_LENGTH); @@ -2196,12 +2196,13 @@ int intif_parse(int fd) { int packet_len, cmd; cmd = RFIFOW(fd,0); - // Verify ID of the packet - if(cmd<0x3800 || cmd>=0x3800+(sizeof(intif->packet_len_table)/sizeof(intif->packet_len_table[0])) || - intif->packet_len_table[cmd-0x3800]==0){ - return 0; + // Verify ID of the packet + if (cmd < 0x3800 || cmd >= 0x3800+(sizeof(intif->packet_len_table)/sizeof(intif->packet_len_table[0])) + || intif->packet_len_table[cmd-0x3800] == 0 + ) { + return 0; } - // Check the length of the packet + // Check the length of the packet packet_len = intif->packet_len_table[cmd-0x3800]; if(packet_len==-1){ if(RFIFOREST(fd)<4) @@ -2211,7 +2212,7 @@ int intif_parse(int fd) if((int)RFIFOREST(fd)<packet_len){ return 2; } - // Processing branch + // Processing branch switch(cmd){ case 0x3800: if (RFIFOL(fd,4) == 0xFF000000) //Normal announce. @@ -2219,57 +2220,57 @@ int intif_parse(int fd) else //Color announce. clif->broadcast2(NULL, (char *) RFIFOP(fd,16), packet_len-16, RFIFOL(fd,4), RFIFOW(fd,8), RFIFOW(fd,10), RFIFOW(fd,12), RFIFOW(fd,14), ALL_CLIENT); break; - case 0x3801: intif->pWisMessage(fd); break; - case 0x3802: intif->pWisEnd(fd); break; - case 0x3803: intif->pWisToGM(fd); break; - case 0x3804: intif->pRegisters(fd); break; - case 0x3806: intif->pChangeNameOk(fd); break; - case 0x3807: intif->pMessageToFD(fd); break; - case 0x3818: intif->pLoadGuildStorage(fd); break; - case 0x3819: intif->pSaveGuildStorage(fd); break; - case 0x3820: intif->pPartyCreated(fd); break; - case 0x3821: intif->pPartyInfo(fd); break; - case 0x3822: intif->pPartyMemberAdded(fd); break; - case 0x3823: intif->pPartyOptionChanged(fd); break; - case 0x3824: intif->pPartyMemberWithdraw(fd); break; - case 0x3825: intif->pPartyMove(fd); break; - case 0x3826: intif->pPartyBroken(fd); break; - case 0x3827: intif->pPartyMessage(fd); break; - case 0x3830: intif->pGuildCreated(fd); break; - case 0x3831: intif->pGuildInfo(fd); break; - case 0x3832: intif->pGuildMemberAdded(fd); break; - case 0x3834: intif->pGuildMemberWithdraw(fd); break; - case 0x3835: intif->pGuildMemberInfoShort(fd); break; - case 0x3836: intif->pGuildBroken(fd); break; - case 0x3837: intif->pGuildMessage(fd); break; - case 0x3839: intif->pGuildBasicInfoChanged(fd); break; - case 0x383a: intif->pGuildMemberInfoChanged(fd); break; - case 0x383b: intif->pGuildPosition(fd); break; - case 0x383c: intif->pGuildSkillUp(fd); break; - case 0x383d: intif->pGuildAlliance(fd); break; - case 0x383e: intif->pGuildNotice(fd); break; - case 0x383f: intif->pGuildEmblem(fd); break; - case 0x3840: intif->pGuildCastleDataLoad(fd); break; - case 0x3843: intif->pGuildMasterChanged(fd); break; + case 0x3801: intif->pWisMessage(fd); break; + case 0x3802: intif->pWisEnd(fd); break; + case 0x3803: intif->pWisToGM(fd); break; + case 0x3804: intif->pRegisters(fd); break; + case 0x3806: intif->pChangeNameOk(fd); break; + case 0x3807: intif->pMessageToFD(fd); break; + case 0x3818: intif->pLoadGuildStorage(fd); break; + case 0x3819: intif->pSaveGuildStorage(fd); break; + case 0x3820: intif->pPartyCreated(fd); break; + case 0x3821: intif->pPartyInfo(fd); break; + case 0x3822: intif->pPartyMemberAdded(fd); break; + case 0x3823: intif->pPartyOptionChanged(fd); break; + case 0x3824: intif->pPartyMemberWithdraw(fd); break; + case 0x3825: intif->pPartyMove(fd); break; + case 0x3826: intif->pPartyBroken(fd); break; + case 0x3827: intif->pPartyMessage(fd); break; + case 0x3830: intif->pGuildCreated(fd); break; + case 0x3831: intif->pGuildInfo(fd); break; + case 0x3832: intif->pGuildMemberAdded(fd); break; + case 0x3834: intif->pGuildMemberWithdraw(fd); break; + case 0x3835: intif->pGuildMemberInfoShort(fd); break; + case 0x3836: intif->pGuildBroken(fd); break; + case 0x3837: intif->pGuildMessage(fd); break; + case 0x3839: intif->pGuildBasicInfoChanged(fd); break; + case 0x383a: intif->pGuildMemberInfoChanged(fd); break; + case 0x383b: intif->pGuildPosition(fd); break; + case 0x383c: intif->pGuildSkillUp(fd); break; + case 0x383d: intif->pGuildAlliance(fd); break; + case 0x383e: intif->pGuildNotice(fd); break; + case 0x383f: intif->pGuildEmblem(fd); break; + case 0x3840: intif->pGuildCastleDataLoad(fd); break; + case 0x3843: intif->pGuildMasterChanged(fd); break; //Quest system - case 0x3860: intif->pQuestLog(fd); break; - case 0x3861: intif->pQuestSave(fd); break; + case 0x3860: intif->pQuestLog(fd); break; + case 0x3861: intif->pQuestSave(fd); break; // Mail System - case 0x3848: intif->pMailInboxReceived(fd); break; - case 0x3849: intif->pMailNew(fd); break; - case 0x384a: intif->pMailGetAttach(fd); break; - case 0x384b: intif->pMailDelete(fd); break; - case 0x384c: intif->pMailReturn(fd); break; - case 0x384d: intif->pMailSend(fd); break; + case 0x3848: intif->pMailInboxReceived(fd); break; + case 0x3849: intif->pMailNew(fd); break; + case 0x384a: intif->pMailGetAttach(fd); break; + case 0x384b: intif->pMailDelete(fd); break; + case 0x384c: intif->pMailReturn(fd); break; + case 0x384d: intif->pMailSend(fd); break; // Auction System - case 0x3850: intif->pAuctionResults(fd); break; - case 0x3851: intif->pAuctionRegister(fd); break; - case 0x3852: intif->pAuctionCancel(fd); break; - case 0x3853: intif->pAuctionClose(fd); break; - case 0x3854: intif->pAuctionMessage(fd); break; - case 0x3855: intif->pAuctionBid(fd); break; + case 0x3850: intif->pAuctionResults(fd); break; + case 0x3851: intif->pAuctionRegister(fd); break; + case 0x3852: intif->pAuctionCancel(fd); break; + case 0x3853: intif->pAuctionClose(fd); break; + case 0x3854: intif->pAuctionMessage(fd); break; + case 0x3855: intif->pAuctionBid(fd); break; //Bound items case 0x3856: #ifdef GP_BOUND_ITEMS @@ -2279,27 +2280,27 @@ int intif_parse(int fd) #endif break; // Mercenary System - case 0x3870: intif->pMercenaryReceived(fd); break; - case 0x3871: intif->pMercenaryDeleted(fd); break; - case 0x3872: intif->pMercenarySaved(fd); break; + case 0x3870: intif->pMercenaryReceived(fd); break; + case 0x3871: intif->pMercenaryDeleted(fd); break; + case 0x3872: intif->pMercenarySaved(fd); break; // Elemental System - case 0x387c: intif->pElementalReceived(fd); break; - case 0x387d: intif->pElementalDeleted(fd); break; - case 0x387e: intif->pElementalSaved(fd); break; + case 0x387c: intif->pElementalReceived(fd); break; + case 0x387d: intif->pElementalDeleted(fd); break; + case 0x387e: intif->pElementalSaved(fd); break; - case 0x3880: intif->pCreatePet(fd); break; - case 0x3881: intif->pRecvPetData(fd); break; - case 0x3882: intif->pSavePetOk(fd); break; - case 0x3883: intif->pDeletePetOk(fd); break; - case 0x3890: intif->pCreateHomunculus(fd); break; - case 0x3891: intif->pRecvHomunculusData(fd); break; - case 0x3892: intif->pSaveHomunculusOk(fd); break; - case 0x3893: intif->pDeleteHomunculusOk(fd); break; + case 0x3880: intif->pCreatePet(fd); break; + case 0x3881: intif->pRecvPetData(fd); break; + case 0x3882: intif->pSavePetOk(fd); break; + case 0x3883: intif->pDeletePetOk(fd); break; + case 0x3890: intif->pCreateHomunculus(fd); break; + case 0x3891: intif->pRecvHomunculusData(fd); break; + case 0x3892: intif->pSaveHomunculusOk(fd); break; + case 0x3893: intif->pDeleteHomunculusOk(fd); break; default: ShowError("intif_parse : unknown packet %d %x\n",fd,RFIFOW(fd,0)); return 0; } - // Skip packet + // Skip packet RFIFOSKIP(fd,packet_len); return 1; } diff --git a/src/map/irc-bot.c b/src/map/irc-bot.c index 6f016697f..8a510b969 100644 --- a/src/map/irc-bot.c +++ b/src/map/irc-bot.c @@ -122,7 +122,7 @@ int irc_parse(int fd) { ircbot->fails = 0; ircbot->ip = host2ip(hChSys.irc_server); timer->add(timer->gettick() + 120000, ircbot->connect_timer, 0, 0); - return 0; + return 0; } if( !RFIFOREST(fd) ) diff --git a/src/map/itemdb.c b/src/map/itemdb.c index 41e0a5348..67aab7a18 100644 --- a/src/map/itemdb.c +++ b/src/map/itemdb.c @@ -320,8 +320,8 @@ void itemdb_jobid2mapid(unsigned int *bclass, unsigned int jobmask) int i; bclass[0]= bclass[1]= bclass[2]= 0; //Base classes - if (jobmask & 1<<JOB_NOVICE) - { //Both Novice/Super-Novice are counted with the same ID + if (jobmask & 1<<JOB_NOVICE) { + //Both Novice/Super-Novice are counted with the same ID bclass[0] |= 1<<MAPID_NOVICE; bclass[1] |= 1<<MAPID_NOVICE; } @@ -354,9 +354,10 @@ void itemdb_jobid2mapid(unsigned int *bclass, unsigned int jobmask) bclass[2] |= 1<<MAPID_MERCHANT; if (jobmask & 1<<JOB_BARD) bclass[2] |= 1<<MAPID_ARCHER; -// Bard/Dancer share the same slot now. -// if (jobmask & 1<<JOB_DANCER) -// bclass[2] |= 1<<MAPID_ARCHER; +#if 0 // Bard/Dancer share the same slot now. + if (jobmask & 1<<JOB_DANCER) + bclass[2] |= 1<<MAPID_ARCHER; +#endif // 0 if (jobmask & 1<<JOB_ROGUE) bclass[2] |= 1<<MAPID_THIEF; //Special classes that don't fit above. @@ -487,16 +488,16 @@ int itemdb_isequip2(struct item_data *data) { *------------------------------------------*/ int itemdb_isstackable(int nameid) { - int type=itemdb_type(nameid); - switch(type) { - case IT_WEAPON: - case IT_ARMOR: - case IT_PETEGG: - case IT_PETARMOR: - return 0; - default: - return 1; - } + int type=itemdb_type(nameid); + switch(type) { + case IT_WEAPON: + case IT_ARMOR: + case IT_PETEGG: + case IT_PETARMOR: + return 0; + default: + return 1; + } } /*========================================== @@ -504,16 +505,16 @@ int itemdb_isstackable(int nameid) *------------------------------------------*/ int itemdb_isstackable2(struct item_data *data) { - nullpo_ret(data); - switch(data->type) { - case IT_WEAPON: - case IT_ARMOR: - case IT_PETEGG: - case IT_PETARMOR: - return 0; - default: - return 1; - } + nullpo_ret(data); + switch(data->type) { + case IT_WEAPON: + case IT_ARMOR: + case IT_PETEGG: + case IT_PETARMOR: + return 0; + default: + return 1; + } } @@ -576,7 +577,7 @@ int itemdb_isrestricted(struct item* item, int gmlv, int gmlv2, int (*func)(stru } /*========================================== - * Specifies if item-type should drop unidentified. + * Specifies if item-type should drop unidentified. *------------------------------------------*/ int itemdb_isidentified(int nameid) { int type=itemdb_type(nameid); diff --git a/src/map/itemdb.h b/src/map/itemdb.h index 8d8cfd7c2..a1c4d1053 100644 --- a/src/map/itemdb.h +++ b/src/map/itemdb.h @@ -374,7 +374,7 @@ enum ItemNouseRestrictions { struct item_data { uint16 nameid; char name[ITEM_NAME_LENGTH],jname[ITEM_NAME_LENGTH]; - + //Do not add stuff between value_buy and view_id (see how getiteminfo works) int value_buy; int value_sell; @@ -396,21 +396,21 @@ struct item_data { int delay; //Lupus: I rearranged order of these fields due to compatibility with ITEMINFO script command -// some script commands should be revised as well... - unsigned int class_base[3]; //Specifies if the base can wear this item (split in 3 indexes per type: 1-1, 2-1, 2-2) - unsigned class_upper : 6; //Specifies if the upper-type can equip it (bitfield, 0x01: normal, 0x02: upper, 0x04: baby normal, 0x08: third normal, 0x10: third upper, 0x20: third baby) +// some script commands should be revised as well... + unsigned int class_base[3]; ///< Specifies if the base can wear this item (split in 3 indexes per type: 1-1, 2-1, 2-2) + unsigned class_upper : 6; ///< Specifies if the upper-type can equip it (bitfield, 0x01: normal, 0x02: upper, 0x04: baby normal, 0x08: third normal, 0x10: third upper, 0x20: third baby) struct { unsigned short chance; int id; - } mob[MAX_SEARCH]; //Holds the mobs that have the highest drop rate for this item. [Skotlex] - struct script_code *script; //Default script for everything. - struct script_code *equip_script; //Script executed once when equipping. - struct script_code *unequip_script;//Script executed once when unequipping. + } mob[MAX_SEARCH]; ///< Holds the mobs that have the highest drop rate for this item. [Skotlex] + struct script_code *script; ///< Default script for everything. + struct script_code *equip_script; ///< Script executed once when equipping. + struct script_code *unequip_script; ///< Script executed once when unequipping. struct { unsigned available : 1; - unsigned no_refine : 1; // [celest] - unsigned delay_consume : 1; // Signifies items that are not consumed immediately upon double-click [Skotlex] - unsigned trade_restriction : 9; ///< Item trade restrictions mask (@see enum ItemTradeRestrictions) + unsigned no_refine : 1; // [celest] + unsigned delay_consume : 1; ///< Signifies items that are not consumed immediately upon double-click [Skotlex] + unsigned trade_restriction : 9; ///< Item trade restrictions mask (@see enum ItemTradeRestrictions) unsigned autoequip: 1; unsigned buyingstore : 1; unsigned bindonequip : 1; @@ -426,7 +426,7 @@ struct item_data { unsigned int flag; ///< Item nouse restriction mask (@see enum ItemNouseRestrictions) unsigned short override; } item_usage; - short gm_lv_trade_override; //GM-level to override trade_restriction + short gm_lv_trade_override; ///< GM-level to override trade_restriction /* bugreport:309 */ struct item_combo **combos; unsigned char combos_count; diff --git a/src/map/log.c b/src/map/log.c index f0fd6795c..92956fa67 100644 --- a/src/map/log.c +++ b/src/map/log.c @@ -45,7 +45,7 @@ char log_picktype2char(e_log_pick_type type) { case LOG_TYPE_BUYING_STORE: return 'B'; // (B)uying Store case LOG_TYPE_LOOT: return 'L'; // (L)oot (consumed monster pick/drop) case LOG_TYPE_BANK: return 'K'; // Ban(K) Transactions - case LOG_TYPE_OTHER: return 'X'; // Other + case LOG_TYPE_OTHER: return 'X'; // Other } // should not get here, fallback diff --git a/src/map/log.h b/src/map/log.h index 40dbf6761..fb61b6e66 100644 --- a/src/map/log.h +++ b/src/map/log.h @@ -110,7 +110,7 @@ struct log_interface { void (*atcommand) (struct map_session_data* sd, const char* message); void (*branch) (struct map_session_data* sd); void (*mvpdrop) (struct map_session_data* sd, int monster_id, int* log_mvp); - + void (*pick_sub) (int id, int16 m, e_log_pick_type type, int amount, struct item* itm, struct item_data *data); void (*zeny_sub) (struct map_session_data* sd, e_log_pick_type type, struct map_session_data* src_sd, int amount); void (*npc_sub) (struct map_session_data* sd, const char *message); @@ -118,12 +118,12 @@ struct log_interface { void (*atcommand_sub) (struct map_session_data* sd, const char* message); void (*branch_sub) (struct map_session_data* sd); void (*mvpdrop_sub) (struct map_session_data* sd, int monster_id, int* log_mvp); - + int (*config_read) (const char* cfgName); void (*config_done) (void); void (*sql_init) (void); void (*sql_final) (void); - + char (*picktype2char) (e_log_pick_type type); char (*chattype2char) (e_log_chat_type type); bool (*should_log_item) (int nameid, int amount, int refine, struct item_data *id); diff --git a/src/map/map.c b/src/map/map.c index 9e2727b07..651c895ec 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -309,7 +309,7 @@ int map_moveblock(struct block_list *bl, int x1, int y1, int64 tick) { skill->unit_move(bl,tick,2); status_change_end(bl, SC_RG_CCONFINE_M, INVALID_TIMER); status_change_end(bl, SC_RG_CCONFINE_S, INVALID_TIMER); - // status_change_end(bl, SC_BLADESTOP, INVALID_TIMER); //Won't stop when you are knocked away, go figure... + //status_change_end(bl, SC_BLADESTOP, INVALID_TIMER); //Won't stop when you are knocked away, go figure... status_change_end(bl, SC_NJ_TATAMIGAESHI, INVALID_TIMER); status_change_end(bl, SC_MAGICROD, INVALID_TIMER); if (sc && sc->data[SC_PROPERTYWALK] && @@ -395,8 +395,8 @@ int map_moveblock(struct block_list *bl, int x1, int y1, int64 tick) { /*========================================== * Counts specified number of objects on given cell. - * flag: - * 0x1 - only count standing units + * flag: + * 0x1 - only count standing units * TODO: merge with bl_getall_area *------------------------------------------*/ int map_count_oncell(int16 m, int16 x, int16 y, int type, int flag) { @@ -1493,8 +1493,8 @@ int map_search_freecell(struct block_list *src, int16 m, int16 *x,int16 *y, int1 * Returns true on success and sets x and y to cell found. * Otherwise returns false and x and y are not changed. * type: Types of block to count - * flag: - * 0x1 - only count standing units + * flag: + * 0x1 - only count standing units *------------------------------------------*/ bool map_closest_freecell(int16 m, int16 *x, int16 *y, int type, int flag) { @@ -1520,7 +1520,7 @@ bool map_closest_freecell(int16 m, int16 *x, int16 *y, int type, int flag) *y = ty; return true; } - } + } //Full diagonal search else if(dir%2 == 1 && costrange%MOVE_DIAGONAL_COST == 0) { tx = *x+dx*(costrange/MOVE_DIAGONAL_COST); @@ -2507,35 +2507,31 @@ uint8 map_calc_dir(struct block_list* src, int16 x, int16 y) dx = x-src->x; dy = y-src->y; - if( dx == 0 && dy == 0 ) - { // both are standing on the same spot. + if (dx == 0 && dy == 0) { + // both are standing on the same spot. // aegis-style, makes knockback default to the left. // athena-style, makes knockback default to behind 'src'. dir = (battle_config.knockback_left ? 6 : unit->getdir(src)); - } - else if( dx >= 0 && dy >=0 ) - { // upper-right - if( dx*2 < dy || dx == 0 ) dir = 0; // up - else if( dx > dy*2+1 || dy == 0 ) dir = 6; // right - else dir = 7; // up-right - } - else if( dx >= 0 && dy <= 0 ) - { // lower-right - if( dx*2 < -dy || dx == 0 ) dir = 4; // down - else if( dx > -dy*2+1 || dy == 0 ) dir = 6; // right - else dir = 5; // down-right - } - else if( dx <= 0 && dy <= 0 ) - { // lower-left - if( dx*2 > dy || dx == 0 ) dir = 4; // down - else if( dx < dy*2-1 || dy == 0 ) dir = 2; // left - else dir = 3; // down-left - } - else - { // upper-left - if( -dx*2 < dy || dx == 0 ) dir = 0; // up - else if( -dx > dy*2+1 || dy == 0) dir = 2; // left - else dir = 1; // up-left + } else if (dx >= 0 && dy >=0) { + // upper-right + if( dx*2 < dy || dx == 0 ) dir = 0; // up + else if( dx > dy*2+1 || dy == 0 ) dir = 6; // right + else dir = 7; // up-right + } else if (dx >= 0 && dy <= 0) { + // lower-right + if( dx*2 < -dy || dx == 0 ) dir = 4; // down + else if( dx > -dy*2+1 || dy == 0 ) dir = 6; // right + else dir = 5; // down-right + } else if (dx <= 0 && dy <= 0) { + // lower-left + if( dx*2 > dy || dx == 0 ) dir = 4; // down + else if( dx < dy*2-1 || dy == 0 ) dir = 2; // left + else dir = 3; // down-left + } else { + // upper-left + if( -dx*2 < dy || dx == 0 ) dir = 0; // up + else if( -dx > dy*2+1 || dy == 0) dir = 2; // left + else dir = 1; // up-left } return dir; } @@ -3482,8 +3478,8 @@ int map_readallmaps (void) { map->list[i].m = i; map->addmap2db(&map->list[i]); - memset(map->list[i].moblist, 0, sizeof(map->list[i].moblist)); //Initialize moblist [Skotlex] - map->list[i].mob_delete_timer = INVALID_TIMER; //Initialize timer [Skotlex] + memset(map->list[i].moblist, 0, sizeof(map->list[i].moblist)); //Initialize moblist [Skotlex] + map->list[i].mob_delete_timer = INVALID_TIMER; //Initialize timer [Skotlex] map->list[i].bxs = (map->list[i].xs + BLOCK_SIZE - 1) / BLOCK_SIZE; map->list[i].bys = (map->list[i].ys + BLOCK_SIZE - 1) / BLOCK_SIZE; @@ -5940,7 +5936,7 @@ int do_init(int argc, char *argv[]) exit(EXIT_SUCCESS); } - npc->event_do_oninit( false ); // Init npcs (OnInit) + npc->event_do_oninit( false ); // Init npcs (OnInit) npc->market_fromsql(); /* after OnInit */ if (battle_config.pk_mode) diff --git a/src/map/map.h b/src/map/map.h index 1766220af..bb6e43ac3 100644 --- a/src/map/map.h +++ b/src/map/map.h @@ -315,20 +315,20 @@ struct block_list { // Mob List Held in memory for Dynamic Mobs [Wizputer] // Expanded to specify all mob-related spawn data by [Skotlex] struct spawn_data { - short class_; //Class, used because a mob can change it's class - unsigned short m, x, y; //Spawn information (map, point, spawn-area around point) + short class_; ///< Class, used because a mob can change it's class + unsigned short m, x, y; ///< Spawn information (map, point, spawn-area around point) signed short xs, ys; - unsigned short num; //Number of mobs using this structure - unsigned short active;//Number of mobs that are already spawned (for mob_remove_damaged: no) - unsigned int delay1, delay2; //Spawn delay (fixed base + random variance) + unsigned short num; ///< Number of mobs using this structure + unsigned short active; ///< Number of mobs that are already spawned (for mob_remove_damaged: no) + unsigned int delay1, delay2; ///< Spawn delay (fixed base + random variance) unsigned int level; struct { - unsigned int size : 2; //Holds if mob has to be tiny/large - unsigned int ai : 4; //Special AI for summoned monsters. + unsigned int size : 2; ///< Holds if mob has to be tiny/large + unsigned int ai : 4; ///< Special AI for summoned monsters. //0: Normal mob | 1: Standard summon, attacks mobs //2: Alchemist Marine Sphere | 3: Alchemist Summon Flora | 4: Summon Zanzou - unsigned int dynamic : 1; //Whether this data is indexed by a map's dynamic mob list - unsigned int boss : 1; //0: Non-boss monster | 1: Boss monster + unsigned int dynamic : 1; ///< Whether this data is indexed by a map's dynamic mob list + unsigned int boss : 1; ///< 0: Non-boss monster | 1: Boss monster } state; char name[NAME_LENGTH], eventname[EVENT_NAME_LENGTH]; //Name/event }; @@ -343,18 +343,18 @@ struct flooritem_data { }; enum status_point_types { - SP_SPEED,SP_BASEEXP,SP_JOBEXP,SP_KARMA,SP_MANNER,SP_HP,SP_MAXHP,SP_SP, // 0-7 - SP_MAXSP,SP_STATUSPOINT,SP_0a,SP_BASELEVEL,SP_SKILLPOINT,SP_STR,SP_AGI,SP_VIT, // 8-15 - SP_INT,SP_DEX,SP_LUK,SP_CLASS,SP_ZENY,SP_SEX,SP_NEXTBASEEXP,SP_NEXTJOBEXP, // 16-23 - SP_WEIGHT,SP_MAXWEIGHT,SP_1a,SP_1b,SP_1c,SP_1d,SP_1e,SP_1f, // 24-31 - SP_USTR,SP_UAGI,SP_UVIT,SP_UINT,SP_UDEX,SP_ULUK,SP_26,SP_27, // 32-39 - SP_28,SP_ATK1,SP_ATK2,SP_MATK1,SP_MATK2,SP_DEF1,SP_DEF2,SP_MDEF1, // 40-47 - SP_MDEF2,SP_HIT,SP_FLEE1,SP_FLEE2,SP_CRITICAL,SP_ASPD,SP_36,SP_JOBLEVEL, // 48-55 - SP_UPPER,SP_PARTNER,SP_CART,SP_FAME,SP_UNBREAKABLE, //56-60 - SP_CARTINFO=99, // 99 - - SP_BASEJOB=119, // 100+19 - celest - SP_BASECLASS=120, //Hmm.. why 100+19? I just use the next one... [Skotlex] + SP_SPEED,SP_BASEEXP,SP_JOBEXP,SP_KARMA,SP_MANNER,SP_HP,SP_MAXHP,SP_SP, // 0-7 + SP_MAXSP,SP_STATUSPOINT,SP_0a,SP_BASELEVEL,SP_SKILLPOINT,SP_STR,SP_AGI,SP_VIT, // 8-15 + SP_INT,SP_DEX,SP_LUK,SP_CLASS,SP_ZENY,SP_SEX,SP_NEXTBASEEXP,SP_NEXTJOBEXP, // 16-23 + SP_WEIGHT,SP_MAXWEIGHT,SP_1a,SP_1b,SP_1c,SP_1d,SP_1e,SP_1f, // 24-31 + SP_USTR,SP_UAGI,SP_UVIT,SP_UINT,SP_UDEX,SP_ULUK,SP_26,SP_27, // 32-39 + SP_28,SP_ATK1,SP_ATK2,SP_MATK1,SP_MATK2,SP_DEF1,SP_DEF2,SP_MDEF1, // 40-47 + SP_MDEF2,SP_HIT,SP_FLEE1,SP_FLEE2,SP_CRITICAL,SP_ASPD,SP_36,SP_JOBLEVEL, // 48-55 + SP_UPPER,SP_PARTNER,SP_CART,SP_FAME,SP_UNBREAKABLE, //56-60 + SP_CARTINFO=99, // 99 + + SP_BASEJOB=119, // 100+19 - celest + SP_BASECLASS=120, //Hmm.. why 100+19? I just use the next one... [Skotlex] SP_KILLERRID=121, SP_KILLEDRID=122, SP_SLOTCHANGE=123, @@ -367,10 +367,10 @@ enum status_point_types { SP_MERCFLEE=165, SP_MERCKILLS=189, SP_MERCFAITH=190, // original 1000- - SP_ATTACKRANGE=1000, SP_ATKELE,SP_DEFELE, // 1000-1002 + SP_ATTACKRANGE=1000, SP_ATKELE,SP_DEFELE, // 1000-1002 SP_CASTRATE, SP_MAXHPRATE, SP_MAXSPRATE, SP_SPRATE, // 1003-1006 SP_ADDELE, SP_ADDRACE, SP_ADDSIZE, SP_SUBELE, SP_SUBRACE, // 1007-1011 - SP_ADDEFF, SP_RESEFF, // 1012-1013 + SP_ADDEFF, SP_RESEFF, // 1012-1013 SP_BASE_ATK,SP_ASPD_RATE,SP_HP_RECOV_RATE,SP_SP_RECOV_RATE,SP_SPEED_RATE, // 1014-1018 SP_CRITICAL_DEF,SP_NEAR_ATK_DEF,SP_LONG_ATK_DEF, // 1019-1021 SP_DOUBLE_RATE, SP_DOUBLE_ADD_RATE, SP_SKILL_HEAL, SP_MATK_RATE, // 1022-1025 @@ -401,8 +401,8 @@ enum status_point_types { SP_CRIT_ATK_RATE, SP_CRITICAL_ADDRACE, SP_NO_REGEN, SP_ADDEFF_WHENHIT, SP_AUTOSPELL_WHENHIT, // 2013-2017 SP_SKILL_ATK, SP_UNSTRIPABLE, SP_AUTOSPELL_ONSKILL, // 2018-2020 SP_SP_GAIN_VALUE, SP_HP_REGEN_RATE, SP_HP_LOSS_RATE, SP_ADDRACE2, SP_HP_GAIN_VALUE, // 2021-2025 - SP_SUBSIZE, SP_HP_DRAIN_VALUE_RACE, SP_ADD_ITEM_HEAL_RATE, SP_SP_DRAIN_VALUE_RACE, SP_EXP_ADDRACE, // 2026-2030 - SP_SP_GAIN_RACE, SP_SUBRACE2, SP_UNBREAKABLE_SHOES, // 2031-2033 + SP_SUBSIZE, SP_HP_DRAIN_VALUE_RACE, SP_ADD_ITEM_HEAL_RATE, SP_SP_DRAIN_VALUE_RACE, SP_EXP_ADDRACE, // 2026-2030 + SP_SP_GAIN_RACE, SP_SUBRACE2, SP_UNBREAKABLE_SHOES, // 2031-2033 SP_UNSTRIPABLE_WEAPON,SP_UNSTRIPABLE_ARMOR,SP_UNSTRIPABLE_HELM,SP_UNSTRIPABLE_SHIELD, // 2034-2037 SP_INTRAVISION, SP_ADD_MONSTER_DROP_CHAINITEM, SP_SP_LOSS_RATE, // 2038-2040 SP_ADD_SKILL_BLOW, SP_SP_VANISH_RATE, SP_MAGIC_SP_GAIN_VALUE, SP_MAGIC_HP_GAIN_VALUE, SP_ADD_CLASS_DROP_ITEM, //2041-2045 @@ -410,8 +410,7 @@ enum status_point_types { SP_SKILL_COOLDOWN,SP_SKILL_FIXEDCAST, SP_SKILL_VARIABLECAST, SP_FIXCASTRATE, SP_VARCASTRATE, //2050-2054 SP_SKILL_USE_SP,SP_MAGIC_ATK_ELE, SP_ADD_FIXEDCAST, SP_ADD_VARIABLECAST, //2055-2058 SP_SET_DEF_RACE,SP_SET_MDEF_RACE, //2059-2060 - - + /* must be the last, plugins add bonuses from this value onwards */ SP_LAST_KNOWN, }; @@ -450,17 +449,17 @@ typedef enum { // used by map->getcell() typedef enum { - CELL_GETTYPE, // retrieves a cell's 'gat' type + CELL_GETTYPE, ///< retrieves a cell's 'gat' type - CELL_CHKWALL, // wall (gat type 1) - CELL_CHKWATER, // water (gat type 3) - CELL_CHKCLIFF, // cliff/gap (gat type 5) + CELL_CHKWALL, ///< wall (gat type 1) + CELL_CHKWATER, ///< water (gat type 3) + CELL_CHKCLIFF, ///< cliff/gap (gat type 5) - CELL_CHKPASS, // passable cell (gat type non-1/5) - CELL_CHKREACH, // Same as PASS, but ignores the cell-stacking mod. - CELL_CHKNOPASS, // non-passable cell (gat types 1 and 5) - CELL_CHKNOREACH, // Same as NOPASS, but ignores the cell-stacking mod. - CELL_CHKSTACK, // whether cell is full (reached cell stacking limit) + CELL_CHKPASS, ///< passable cell (gat type non-1/5) + CELL_CHKREACH, ///< Same as PASS, but ignores the cell-stacking mod. + CELL_CHKNOPASS, ///< non-passable cell (gat types 1 and 5) + CELL_CHKNOREACH, ///< Same as NOPASS, but ignores the cell-stacking mod. + CELL_CHKSTACK, ///< whether cell is full (reached cell stacking limit) CELL_CHKNPC, CELL_CHKBASILICA, @@ -507,11 +506,11 @@ struct mapflag_skill_adjust { }; enum map_zone_skill_subtype { - MZS_NONE = 0x0, - MZS_CLONE = 0x01, - MZS_BOSS = 0x02, + MZS_NONE = 0x0, + MZS_CLONE = 0x01, + MZS_BOSS = 0x02, - MZS_ALL = 0xFFF, + MZS_ALL = 0xFFF }; struct map_zone_disabled_skill_entry { @@ -578,7 +577,7 @@ struct map_data { char name[MAP_NAME_LENGTH]; uint16 index; // The map index used by the mapindex* functions. struct mapcell* cell; // Holds the information of each map cell (NULL if the map is not on this map-server). - + /* 2D Orthogonal Range Search: Grid Implementation "Algorithms in Java, Parts 1-4" 3.18, Robert Sedgewick Map is divided into squares, called blocks (side length = BLOCK_SIZE). @@ -590,7 +589,7 @@ struct map_data { */ struct block_list **block; // Grid array of block_lists containing only non-BL_MOB objects struct block_list **block_mob; // Grid array of block_lists containing only BL_MOB objects - + int16 m; int16 xs,ys; // map dimensions (in cells) int16 bxs,bys; // map dimensions (in blocks) @@ -633,10 +632,10 @@ struct map_data { unsigned fireworks : 1; unsigned sakura : 1; // [Valaris] unsigned leaves : 1; // [Valaris] - unsigned nobaseexp : 1; // [Lorky] added by Lupus - unsigned nojobexp : 1; // [Lorky] - unsigned nomobloot : 1; // [Lorky] - unsigned nomvploot : 1; // [Lorky] + unsigned nobaseexp : 1; // [Lorky] added by Lupus + unsigned nojobexp : 1; // [Lorky] + unsigned nomobloot : 1; // [Lorky] + unsigned nomvploot : 1; // [Lorky] unsigned nightenabled :1; //For night display. [Skotlex] unsigned nodrop : 1; unsigned novending : 1; @@ -657,9 +656,9 @@ struct map_data { unsigned short drop_list_count; struct spawn_data *moblist[MAX_MOB_LIST_PER_MAP]; // [Wizputer] - int mob_delete_timer; // [Skotlex] - int jexp; // map experience multiplicator - int bexp; // map experience multiplicator + int mob_delete_timer; // [Skotlex] + int jexp; // map experience multiplicator + int bexp; // map experience multiplicator int nocommand; //Blocks @/# commands for non-gms. [Skotlex] // Instance Variables @@ -702,14 +701,14 @@ struct map_data { int (*getcellp)(struct map_data* m,int16 x,int16 y,cell_chk cellchk); void (*setcell) (int16 m, int16 x, int16 y, cell_t cell, bool flag); char *cellPos; - + /* ShowEvent Data Cache */ struct questinfo *qi_data; unsigned short qi_count; - + /* speeds up clif_updatestatus processing by causing hpmeter to run only when someone with the permission can view it */ unsigned short hpmeter_visible; - + /* HPM Custom Struct */ struct HPluginData **hdata; unsigned int hdatac; @@ -730,7 +729,7 @@ struct map_data_other_server { /// Bitfield of flags for the iterator. enum e_mapitflags { MAPIT_NORMAL = 0, - // MAPIT_PCISPLAYING = 1,// Unneeded as pc_db/id_db will only hold authed, active players. + //MAPIT_PCISPLAYING = 1,// Unneeded as pc_db/id_db will only hold authed, active players. }; struct s_mapiterator; @@ -764,7 +763,7 @@ typedef struct skill_unit TBL_SKILL; typedef struct pet_data TBL_PET; typedef struct homun_data TBL_HOM; typedef struct mercenary_data TBL_MER; -typedef struct elemental_data TBL_ELEM; +typedef struct elemental_data TBL_ELEM; #define BL_CAST(type_, bl) \ ( ((bl) == (struct block_list*)NULL || (bl)->type != (type_)) ? (T ## type_ *)NULL : (T ## type_ *)(bl) ) @@ -846,17 +845,17 @@ struct map_interface { char npc_market_data_db[32]; char default_codepage[32]; - + int server_port; char server_ip[32]; char server_id[32]; char server_pw[100]; char server_db[32]; Sql* mysql_handle; - + int port; int users; - int enable_grf; //To enable/disable reading maps from GRF files, bypassing mapcache [blackhole89] + int enable_grf; //To enable/disable reading maps from GRF files, bypassing mapcache [blackhole89] bool ip_set; bool char_ip_set; @@ -1016,7 +1015,7 @@ struct map_interface { void (*clean) (int i); void (*do_shutdown) (void); - + int (*freeblock_timer) (int tid, int64 tick, int id, intptr_t data); int (*searchrandfreecell) (int16 m, int16 *x, int16 *y, int stack); int (*count_sub) (struct block_list *bl, va_list ap); diff --git a/src/map/mercenary.h b/src/map/mercenary.h index 270245e96..68f60b08b 100644 --- a/src/map/mercenary.h +++ b/src/map/mercenary.h @@ -42,7 +42,7 @@ struct mercenary_data { struct map_session_data *master; int contract_timer; - + unsigned devotion_flag : 1; int64 masterteleport_timer; }; @@ -55,26 +55,26 @@ struct mercenary_data { struct mercenary_interface { /* vars */ - + struct s_mercenary_db db[MAX_MERCENARY_CLASS]; /* funcs */ void (*init) (bool minimal); - + bool (*class) (int class_); struct view_data * (*get_viewdata) (int class_); - + int (*create) (struct map_session_data *sd, int class_, unsigned int lifetime); int (*data_received) (struct s_mercenary *merc, bool flag); int (*save) (struct mercenary_data *md); - + void (*heal) (struct mercenary_data *md, int hp, int sp); int (*dead) (struct mercenary_data *md); - + int (*delete) (struct mercenary_data *md, int reply); void (*contract_stop) (struct mercenary_data *md); - + int (*get_lifetime) (struct mercenary_data *md); int (*get_guild) (struct mercenary_data *md); int (*get_faith) (struct mercenary_data *md); @@ -82,14 +82,14 @@ struct mercenary_interface { int (*get_calls) (struct mercenary_data *md); int (*set_calls) (struct mercenary_data *md, int value); int (*kills) (struct mercenary_data *md); - + int (*checkskill) (struct mercenary_data *md, uint16 skill_id); int (*read_db) (void); int (*read_skilldb) (void); - + int (*killbonus) (struct mercenary_data *md); int (*search_index) (int class_); - + int (*contract_end_timer) (int tid, int64 tick, int id, intptr_t data); bool (*read_db_sub) (char* str[], int columns, int current); bool (*read_skill_db_sub) (char* str[], int columns, int current); diff --git a/src/map/mob.c b/src/map/mob.c index 5af3f99b4..28e70c5c0 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -48,9 +48,9 @@ struct mob_interface mob_s; -#define ACTIVE_AI_RANGE 2 //Distance added on top of 'AREA_SIZE' at which mobs enter active AI mode. +#define ACTIVE_AI_RANGE 2 //Distance added on top of 'AREA_SIZE' at which mobs enter active AI mode. -#define IDLE_SKILL_INTERVAL 10 //Active idle skills should be triggered every 1 second (1000/MIN_MOBTHINKTIME) +#define IDLE_SKILL_INTERVAL 10 //Active idle skills should be triggered every 1 second (1000/MIN_MOBTHINKTIME) // Probability for mobs far from players from doing their IDLE skill. (rate of 1000 minute) // in Aegis, this is 100% for mobs that have been activated by players and none otherwise. @@ -59,8 +59,8 @@ struct mob_interface mob_s; // in Aegis, this is 100% for mobs that have been activated by players and none otherwise. #define MOB_LAZYMOVEPERC(md) ((md)->state.spotted?1000:0) #define MOB_MAX_DELAY (24*3600*1000) -#define MAX_MINCHASE 30 //Max minimum chase value to use for mobs. -#define RUDE_ATTACKED_COUNT 2 //After how many rude-attacks should the skill be used? +#define MAX_MINCHASE 30 //Max minimum chase value to use for mobs. +#define RUDE_ATTACKED_COUNT 2 //After how many rude-attacks should the skill be used? //Dynamic item drop ratio database for per-item drop ratio modifiers overriding global drop ratios. #define MAX_ITEMRATIO_MOBS 10 @@ -502,7 +502,7 @@ int mob_once_spawn(struct map_session_data* sd, int16 m, int16 x, int16 y, const else if( gc->guild_id ) //Guild not yet available, retry in 5. timer->add(timer->gettick()+5000,mob->spawn_guardian_sub,md->bl.id,gc->guild_id); } - } // end addition [Valaris] + } // end addition [Valaris] mob->spawn(md); @@ -677,8 +677,8 @@ int mob_spawn_guardian(const char* mapname, short x, short y, const char* mobnam else g = guild->search(gc->guild_id); - if( has_index && gc->guardian[guardian].id ) - { //Check if guardian already exists, refuse to spawn if so. + if( has_index && gc->guardian[guardian].id ) { + //Check if guardian already exists, refuse to spawn if so. struct mob_data *md2 = (TBL_MOB*)map->id2bl(gc->guardian[guardian].id); if (md2 && md2->bl.type == BL_MOB && md2->guardian_data @@ -805,7 +805,8 @@ int mob_linksearch(struct block_list *bl,va_list ap) { && !md->target_id) { md->last_linktime = tick; - if( mob->can_reach(md,target,md->db->range2, MSS_FOLLOW) ){ // Reachability judging + if (mob->can_reach(md,target,md->db->range2, MSS_FOLLOW)) { + // Reachability judging md->target_id = target->id; md->min_chase=md->db->range3; return 1; @@ -853,17 +854,20 @@ int mob_setdelayspawn(struct mob_data *md) //Apply the spawn delay fix [Skotlex] db = mob->db(md->spawn->class_); mode = db->status.mode; - if (mode & MD_BOSS) { //Bosses + if (mode & MD_BOSS) { + //Bosses if (battle_config.boss_spawn_delay != 100) { // Divide by 100 first to prevent overflows //(precision loss is minimal as duration is in ms already) spawntime = spawntime/100*battle_config.boss_spawn_delay; } - } else if (mode&MD_PLANT) { //Plants + } else if (mode&MD_PLANT) { + //Plants if (battle_config.plant_spawn_delay != 100) { spawntime = spawntime/100*battle_config.plant_spawn_delay; } - } else if (battle_config.mob_spawn_delay != 100) { //Normal mobs + } else if (battle_config.mob_spawn_delay != 100) { + //Normal mobs spawntime = spawntime/100*battle_config.mob_spawn_delay; } @@ -943,7 +947,7 @@ int mob_spawn (struct mob_data *md) md->spawn_timer = INVALID_TIMER; } -// md->master_id = 0; + //md->master_id = 0; md->master_dist = 0; md->state.aggressive = md->status.mode&MD_ANGRY?1:0; @@ -1027,7 +1031,7 @@ int mob_target(struct mob_data *md,struct block_list *bl,int dist) if(!status->check_skilluse(&md->bl, bl, 0, 0)) return 0; - md->target_id = bl->id; // Since there was no disturbance, it locks on to target. + md->target_id = bl->id; // Since there was no disturbance, it locks on to target. if (md->state.provoke_flag && bl->id != md->state.provoke_flag) md->state.provoke_flag = 0; md->min_chase=dist+md->db->range3; @@ -1197,8 +1201,8 @@ int mob_ai_sub_hard_slavemob(struct mob_data *md, int64 tick) { if (bl->prev == NULL) return 0; //Master not on a map? Could be warping, do not process. - if(status_get_mode(&md->bl)&MD_CANMOVE) - { //If the mob can move, follow around. [Check by Skotlex] + if (status_get_mode(&md->bl)&MD_CANMOVE) { + //If the mob can move, follow around. [Check by Skotlex] int old_dist; // Distance with between slave and master is measured. @@ -1235,8 +1239,7 @@ int mob_ai_sub_hard_slavemob(struct mob_data *md, int64 tick) { } //Avoid attempting to lock the master's target too often to avoid unnecessary overload. [Skotlex] - if (DIFF_TICK(md->last_linktime, tick) < MIN_MOBLINKTIME && !md->target_id) - { + if (DIFF_TICK(md->last_linktime, tick) < MIN_MOBLINKTIME && !md->target_id) { struct unit_data *ud = unit->bl2ud(bl); md->last_linktime = tick; @@ -1327,7 +1330,8 @@ int mob_randomwalk(struct mob_data *md, int64 tick) { d =12-md->move_fail_count; if(d<5) d=5; if(d>7) d=7; - for(i=0;i<retrycount;i++){ // Search of a movable place + for (i = 0; i < retrycount; i++) { + // Search of a movable place int r=rnd(); x=r%(d*2+1)-d; y=r/(d*2+1)%(d*2+1)-d; @@ -1442,23 +1446,23 @@ bool mob_ai_sub_hard(struct mob_data *md, int64 tick) { } // Check for target change. - if( md->attacked_id && mode&MD_CANATTACK ) - { - if( md->attacked_id == md->target_id ) - { //Rude attacked check. - if( !battle->check_range(&md->bl, tbl, md->status.rhw.range) - && ( //Can't attack back and can't reach back. - (!can_move && DIFF_TICK(tick, md->ud.canmove_tick) > 0 && (battle_config.mob_ai&0x2 || (md->sc.data[SC_SPIDERWEB] && md->sc.data[SC_SPIDERWEB]->val1) - || md->sc.data[SC_WUGBITE] || md->sc.data[SC_VACUUM_EXTREME] || md->sc.data[SC_THORNS_TRAP] - || md->sc.data[SC__MANHOLE] // Not yet confirmed if boss will teleport once it can't reach target. - || md->walktoxy_fail_count > 0) - ) - || !mob->can_reach(md, tbl, md->min_chase, MSS_RUSH) - ) - && md->state.attacked_count++ >= RUDE_ATTACKED_COUNT - && !mob->skill_use(md, tick, MSC_RUDEATTACKED) // If can't rude Attack - && can_move && unit->escape(&md->bl, tbl, rnd()%10 +1)) // Attempt escape - { //Escaped + if (md->attacked_id && mode&MD_CANATTACK) { + if (md->attacked_id == md->target_id) { + //Rude attacked check. + if (!battle->check_range(&md->bl, tbl, md->status.rhw.range) + && ( //Can't attack back and can't reach back. + (!can_move && DIFF_TICK(tick, md->ud.canmove_tick) > 0 && (battle_config.mob_ai&0x2 || (md->sc.data[SC_SPIDERWEB] && md->sc.data[SC_SPIDERWEB]->val1) + || md->sc.data[SC_WUGBITE] || md->sc.data[SC_VACUUM_EXTREME] || md->sc.data[SC_THORNS_TRAP] + || md->sc.data[SC__MANHOLE] // Not yet confirmed if boss will teleport once it can't reach target. + || md->walktoxy_fail_count > 0) + ) + || !mob->can_reach(md, tbl, md->min_chase, MSS_RUSH) + ) + && md->state.attacked_count++ >= RUDE_ATTACKED_COUNT + && !mob->skill_use(md, tick, MSC_RUDEATTACKED) // If can't rude Attack + && can_move && unit->escape(&md->bl, tbl, rnd()%10 +1) // Attempt escape + ) { + //Escaped md->attacked_id = 0; return true; } @@ -1483,9 +1487,10 @@ bool mob_ai_sub_hard(struct mob_data *md, int64 tick) { ) { // Rude attacked if (md->state.attacked_count++ >= RUDE_ATTACKED_COUNT - && !mob->skill_use(md, tick, MSC_RUDEATTACKED) && can_move - && !tbl && unit->escape(&md->bl, abl, rnd()%10 +1)) - { //Escaped. + && !mob->skill_use(md, tick, MSC_RUDEATTACKED) && can_move + && !tbl && unit->escape(&md->bl, abl, rnd()%10 +1) + ) { + //Escaped. //TODO: Maybe it shouldn't attempt to run if it has another, valid target? md->attacked_id = 0; return true; @@ -1496,9 +1501,11 @@ bool mob_ai_sub_hard(struct mob_data *md, int64 tick) { //Can't attack back, but didn't invoke a rude attacked skill... } else { //Attackable - if (!tbl || dist < md->status.rhw.range || !check_distance_bl(&md->bl, tbl, dist) - || battle->get_target(tbl) != md->bl.id) - { //Change if the new target is closer than the actual one + if (!tbl || dist < md->status.rhw.range + || !check_distance_bl(&md->bl, tbl, dist) + || battle->get_target(tbl) != md->bl.id + ) { + //Change if the new target is closer than the actual one //or if the previous target is not attacking the mob. [Skotlex] md->target_id = md->attacked_id; // set target if (md->state.attacked_count) @@ -1556,20 +1563,20 @@ bool mob_ai_sub_hard(struct mob_data *md, int64 tick) { } //Target exists, attack or loot as applicable. - if (tbl->type == BL_ITEM) - { //Loot time. + if (tbl->type == BL_ITEM) { + //Loot time. struct flooritem_data *fitem; if (md->ud.target == tbl->id && md->ud.walktimer != INVALID_TIMER) return true; //Already locked. - if (md->lootitem == NULL) - { //Can't loot... + if (md->lootitem == NULL) { + //Can't loot... mob->unlocktarget (md, tick); return true; } - if (!check_distance_bl(&md->bl, tbl, 1)) - { //Still not within loot range. - if (!(mode&MD_CANMOVE)) - { //A looter that can't move? Real smart. + if (!check_distance_bl(&md->bl, tbl, 1)) { + //Still not within loot range. + if (!(mode&MD_CANMOVE)) { + //A looter that can't move? Real smart. mob->unlocktarget(md,tick); return true; } @@ -1590,14 +1597,15 @@ bool mob_ai_sub_hard(struct mob_data *md, int64 tick) { if (md->lootitem_count < LOOTITEM_SIZE) { memcpy (&md->lootitem[md->lootitem_count++], &fitem->item_data, sizeof(md->lootitem[0])); - } else { //Destroy first looted item... + } else { + //Destroy first looted item... if (md->lootitem[0].card[0] == CARD0_PET) intif->delete_petdata( MakeDWord(md->lootitem[0].card[1],md->lootitem[0].card[2]) ); memmove(&md->lootitem[0], &md->lootitem[1], (LOOTITEM_SIZE-1)*sizeof(md->lootitem[0])); memcpy (&md->lootitem[LOOTITEM_SIZE-1], &fitem->item_data, sizeof(md->lootitem[0])); } - if (pcdb_checkid(md->vd->class_)) - { //Give them walk act/delay to properly mimic players. [Skotlex] + if (pcdb_checkid(md->vd->class_)) { + //Give them walk act/delay to properly mimic players. [Skotlex] clif->takeitem(&md->bl,tbl); md->ud.canact_tick = tick + md->status.amotion; unit->set_walkdelay(&md->bl, tick, md->status.amotion, 1); @@ -1610,9 +1618,9 @@ bool mob_ai_sub_hard(struct mob_data *md, int64 tick) { //Attempt to attack. //At this point we know the target is attackable, we just gotta check if the range matches. - if (battle->check_range(&md->bl, tbl, md->status.rhw.range) && !(md->sc.option&OPTION_HIDE)) - { //Target within range and able to use normal attack, engage - if (md->ud.target != tbl->id || md->ud.attacktimer == INVALID_TIMER) + if (battle->check_range(&md->bl, tbl, md->status.rhw.range) && !(md->sc.option&OPTION_HIDE)) { + //Target within range and able to use normal attack, engage + if (md->ud.target != tbl->id || md->ud.attacktimer == INVALID_TIMER) { //Only attack if no more attack delay left if(tbl->type == BL_PC) mob->log_damage(md, tbl, 0); //Log interaction (counts as 'attacker' for the exp bonus) @@ -1623,7 +1631,7 @@ bool mob_ai_sub_hard(struct mob_data *md, int64 tick) { //Monsters in berserk state, unable to use normal attacks, will always attempt a skill if(md->ud.walktimer == INVALID_TIMER && (md->state.skillstate == MSS_BERSERK || md->state.skillstate == MSS_ANGRY)) { - if (DIFF_TICK(md->ud.canmove_tick, tick) <= MIN_MOBTHINKTIME && DIFF_TICK(md->ud.canact_tick, tick) < -MIN_MOBTHINKTIME*IDLE_SKILL_INTERVAL) + if (DIFF_TICK(md->ud.canmove_tick, tick) <= MIN_MOBTHINKTIME && DIFF_TICK(md->ud.canact_tick, tick) < -MIN_MOBTHINKTIME*IDLE_SKILL_INTERVAL) { //Only use skill if able to walk on next tick and not used a skill the last second mob->skill_use(md, tick, -1); } @@ -1638,15 +1646,15 @@ bool mob_ai_sub_hard(struct mob_data *md, int64 tick) { return true; //Out of range... - if (!(mode&MD_CANMOVE) || (!can_move && DIFF_TICK(tick, md->ud.canmove_tick) > 0)) - { //Can't chase. Immobile and trapped mobs should unlock target and use an idle skill. + if (!(mode&MD_CANMOVE) || (!can_move && DIFF_TICK(tick, md->ud.canmove_tick) > 0)) { + //Can't chase. Immobile and trapped mobs should unlock target and use an idle skill. if (md->ud.attacktimer == INVALID_TIMER) { //Only unlock target if no more attack delay left //This handles triggering idle/walk skill. mob->unlocktarget(md,tick); } return true; - } + } if (md->ud.walktimer != INVALID_TIMER && md->ud.target == tbl->id && ( @@ -1667,8 +1675,8 @@ bool mob_ai_sub_hard(struct mob_data *md, int64 tick) { int mob_ai_sub_hard_timer(struct block_list *bl, va_list ap) { struct mob_data *md = (struct mob_data*)bl; int64 tick = va_arg(ap, int64); - if (mob->ai_sub_hard(md, tick)) - { //Hard AI triggered. + if (mob->ai_sub_hard(md, tick)) { + //Hard AI triggered. if(!md->state.spotted) md->state.spotted = 1; md->last_pcneartime = tick; @@ -1706,11 +1714,11 @@ int mob_ai_sub_lazy(struct mob_data *md, va_list args) { if (md->bl.prev==NULL || md->status.hp == 0) return 1; - if(battle_config.mob_active_time && - md->last_pcneartime && - !(md->status.mode&MD_BOSS) && - DIFF_TICK(tick,md->last_thinktime) > MIN_MOBTHINKTIME) - { + if (battle_config.mob_active_time + && md->last_pcneartime + && !(md->status.mode&MD_BOSS) + && DIFF_TICK(tick,md->last_thinktime) > MIN_MOBTHINKTIME + ) { if (DIFF_TICK(tick,md->last_pcneartime) < battle_config.mob_active_time) return (int)mob->ai_sub_hard(md, tick); md->last_pcneartime = 0; @@ -1840,7 +1848,8 @@ void mob_item_drop(struct mob_data *md, struct item_drop_list *dlist, struct ite && sd->bl.m == md->bl.m && check_distance_blxy(&sd->bl, dlist->x, dlist->y, AUTOLOOT_DISTANCE) #endif - ) { //Autoloot. + ) { + //Autoloot. if (party->share_loot(party->search(sd->status.party_id), sd, &ditem->item_data, sd->status.char_id) == 0 ) { @@ -1995,13 +2004,14 @@ void mob_log_damage(struct mob_data *md, struct block_list *src, int damage) if(md->dmglog[i].id==char_id && md->dmglog[i].flag==flag) break; - if(md->dmglog[i].id==0) { //Store data in first empty slot. + if(md->dmglog[i].id==0) { + //Store data in first empty slot. md->dmglog[i].id = char_id; md->dmglog[i].flag= flag; break; } - if(md->dmglog[i].dmg<mindmg && i) - { //Never overwrite first hit slot (he gets double exp bonus) + if (md->dmglog[i].dmg<mindmg && i) { + //Never overwrite first hit slot (he gets double exp bonus) minpos=i; mindmg=md->dmglog[i].dmg; } @@ -2145,8 +2155,8 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type) { // determines, if the monster was killed by homunculus' damage only homkillonly = (bool)( ( dmgbltypes&BL_HOM ) && !( dmgbltypes&~BL_HOM ) ); - if(!battle_config.exp_calc_type && count > 1) - { //Apply first-attacker 200% exp share bonus + if (!battle_config.exp_calc_type && count > 1) { + //Apply first-attacker 200% exp share bonus //TODO: Determine if this should go before calculating the MVP player instead of after. if (UINT_MAX - md->dmglog[0].dmg > md->tdmg) { md->tdmg += md->dmglog[0].dmg; @@ -2246,7 +2256,8 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type) { pnum++; flag=0; } - } else { //Add to total + } else { + //Add to total if (pt[j].base_exp > UINT_MAX - base_exp) pt[j].base_exp = UINT_MAX; else @@ -2445,7 +2456,8 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type) { timer->add(tick + (!battle_config.delay_battle_damage?500:0), mob->delay_item_drop, 0, (intptr_t)dlist); else //No drops ers_free(item_drop_list_ers, dlist); - } else if (md->lootitem && md->lootitem_count) { //Loot MUST drop! + } else if (md->lootitem && md->lootitem_count) { + //Loot MUST drop! struct item_drop_list *dlist = ers_alloc(item_drop_list_ers, struct item_drop_list); dlist->m = md->bl.m; dlist->x = md->bl.x; @@ -2540,9 +2552,10 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type) { logs->mvpdrop(mvp_sd, md->class_, log_mvp); } - if (type&2 && !sd && md->class_ == MOBID_EMPERIUM && md->guardian_data) - //Emperium destroyed by script. Discard mvp character. [Skotlex] + if (type&2 && !sd && md->class_ == MOBID_EMPERIUM && md->guardian_data) { + //Emperium destroyed by script. Discard mvp character. [Skotlex] mvp_sd = NULL; + } rebirth = ( md->sc.data[SC_KAIZEL] || (md->sc.data[SC_REBIRTH] && !md->state.rebirth) ); if( !rebirth ) { // Only trigger event on final kill @@ -2643,7 +2656,7 @@ void mob_revive(struct mob_data *md, unsigned int hp) md->next_walktime = tick+rnd()%1000+MIN_RANDOMWALKTIME; md->last_linktime = tick; md->last_pcneartime = 0; - memset(md->dmglog, 0, sizeof(md->dmglog)); // Reset the damage done on the rebirthed monster, otherwise will grant full exp + damage done. [Valaris] + memset(md->dmglog, 0, sizeof(md->dmglog)); // Reset the damage done on the rebirthed monster, otherwise will grant full exp + damage done. [Valaris] md->tdmg = 0; if (!md->bl.prev) map->addblock(&md->bl); @@ -2662,8 +2675,8 @@ int mob_guardian_guildchange(struct mob_data *md) if (!md->guardian_data) return 0; - if( md->guardian_data->castle->guild_id == 0 ) - { //Castle with no owner? Delete the guardians. + if (md->guardian_data->castle->guild_id == 0) { + //Castle with no owner? Delete the guardians. if( md->class_ == MOBID_EMPERIUM ) //But don't delete the emperium, just clear it's guild-data md->guardian_data->g = NULL; else { @@ -2675,8 +2688,8 @@ int mob_guardian_guildchange(struct mob_data *md) } g = guild->search(md->guardian_data->castle->guild_id); - if( g == NULL ) - { //Properly remove guardian info from Castle data. + if (g == NULL) { + //Properly remove guardian info from Castle data. ShowError("mob_guardian_guildchange: New Guild (id %d) does not exists!\n", md->guardian_data->castle->guild_id); if (md->guardian_data->number >= 0 && md->guardian_data->number < MAX_GUARDIANS) guild->castledatasave(md->guardian_data->castle->castle_id, 10+md->guardian_data->number, 0); @@ -2700,7 +2713,7 @@ int mob_random_class (int *value, size_t count) if (count < 1) { count = 0; while(count < 5 && mob->db_checkid(value[count])) count++; - if(count < 1) // nothing found + if(count < 1) // nothing found return 0; } else { // check if at least the first value is valid @@ -2925,8 +2938,7 @@ int mob_summonslave(struct mob_data *md2,int *value,int amount,uint16 skill_id) md->status.hp = md->status.max_hp*hp_rate/100; //Inherit the aggressive mode of the master. - if (battle_config.slaves_inherit_mode && md->master_id) - { + if (battle_config.slaves_inherit_mode && md->master_id) { switch (battle_config.slaves_inherit_mode) { case 1: //Always aggressive if (!(md->status.mode&MD_AGGRESSIVE)) @@ -3116,16 +3128,16 @@ int mobskill_use(struct mob_data *md, int64 tick, int event) { { case MSC_ALWAYS: flag = 1; break; - case MSC_MYHPLTMAXRATE: // HP< maxhp% + case MSC_MYHPLTMAXRATE: // HP< maxhp% flag = get_percentage(md->status.hp, md->status.max_hp); flag = (flag <= c2); - break; + break; case MSC_MYHPINRATE: flag = get_percentage(md->status.hp, md->status.max_hp); flag = (flag >= c2 && flag <= ms[i].val[0]); break; - case MSC_MYSTATUSON: // status[num] on - case MSC_MYSTATUSOFF: // status[num] off + case MSC_MYSTATUSON: // status[num] on + case MSC_MYSTATUSOFF: // status[num] off if (!md->sc.count) { flag = 0; } else if (ms[i].cond2 == -1) { @@ -3136,26 +3148,26 @@ int mobskill_use(struct mob_data *md, int64 tick, int event) { flag = (md->sc.data[ms[i].cond2]!=NULL); } flag ^= (ms[i].cond1 == MSC_MYSTATUSOFF); break; - case MSC_FRIENDHPLTMAXRATE: // friend HP < maxhp% + case MSC_FRIENDHPLTMAXRATE: // friend HP < maxhp% flag = ((fbl = mob->getfriendhprate(md, 0, ms[i].cond2)) != NULL); break; - case MSC_FRIENDHPINRATE : + case MSC_FRIENDHPINRATE: flag = ((fbl = mob->getfriendhprate(md, ms[i].cond2, ms[i].val[0])) != NULL); break; - case MSC_FRIENDSTATUSON: // friend status[num] on - case MSC_FRIENDSTATUSOFF: // friend status[num] off + case MSC_FRIENDSTATUSON: // friend status[num] on + case MSC_FRIENDSTATUSOFF: // friend status[num] off flag = ((fmd = mob->getfriendstatus(md, ms[i].cond1, ms[i].cond2)) != NULL); break; - case MSC_SLAVELT: // slave < num + case MSC_SLAVELT: // slave < num flag = (mob->countslave(&md->bl) < c2 ); break; - case MSC_ATTACKPCGT: // attack pc > num + case MSC_ATTACKPCGT: // attack pc > num flag = (unit->counttargeted(&md->bl) > c2); break; - case MSC_SLAVELE: // slave <= num + case MSC_SLAVELE: // slave <= num flag = (mob->countslave(&md->bl) <= c2 ); break; - case MSC_ATTACKPCGE: // attack pc >= num + case MSC_ATTACKPCGE: // attack pc >= num flag = (unit->counttargeted(&md->bl) >= c2); break; case MSC_AFTERSKILL: flag = (md->ud.skill_id == c2); break; case MSC_RUDEATTACKED: flag = (md->state.attacked_count >= RUDE_ATTACKED_COUNT); - if (flag) md->state.attacked_count = 0; //Rude attacked count should be reset after the skill condition is met. Thanks to Komurka [Skotlex] + if (flag) md->state.attacked_count = 0; //Rude attacked count should be reset after the skill condition is met. Thanks to Komurka [Skotlex] break; case MSC_MASTERHPLTMAXRATE: flag = ((fbl = mob->getmasterhpltmaxrate(md, ms[i].cond2)) != NULL); break; @@ -3201,7 +3213,7 @@ int mobskill_use(struct mob_data *md, int64 tick, int event) { if (!bl) continue; x = bl->x; - y = bl->y; + y = bl->y; // Look for an area to cast the spell around... if (ms[i].target >= MST_AROUND1 || ms[i].target >= MST_AROUND5) { j = ms[i].target >= MST_AROUND1? @@ -3260,10 +3272,10 @@ int mobskill_use(struct mob_data *md, int64 tick, int event) { if ( ms[ i ].msg_id ){ //Display color message [SnakeDrak] struct mob_chat *mc = mob->chat(ms[i].msg_id); char temp[CHAT_SIZE_MAX]; - char name[NAME_LENGTH]; - snprintf(name, sizeof name,"%s", md->name); - strtok(name, "#"); // discard extra name identifier if present [Daegaladh] - snprintf(temp, sizeof temp,"%s : %s", name, mc->msg); + char name[NAME_LENGTH]; + snprintf(name, sizeof name,"%s", md->name); + strtok(name, "#"); // discard extra name identifier if present [Daegaladh] + snprintf(temp, sizeof temp,"%s : %s", name, mc->msg); clif->messagecolor(&md->bl, mc->color, temp); } if(!(battle_config.mob_ai&0x200)) { //pass on delay to same skill. @@ -3555,8 +3567,8 @@ int mob_makedummymobdb(int class_) { if (mob->db(class_) == mob->dummy) return 1; //Using the mob->dummy data already. [Skotlex] - if (class_ > 0 && class_ <= MAX_MOB_DB) - { //Remove the mob data so that it uses the dummy data instead. + if (class_ > 0 && class_ <= MAX_MOB_DB) { + //Remove the mob data so that it uses the dummy data instead. aFree(mob->db_data[class_]); mob->db_data[class_] = NULL; } @@ -3708,7 +3720,7 @@ bool mob_parse_dbrow(char** str) { if (mstatus->luk < 1) mstatus->luk = 1; //Tests showed that chase range is effectively 2 cells larger than expected [Playtester] - if (db->range3 > 0) + if (db->range3 > 0) db->range3 += 2; db->range2 = atoi(str[20]); @@ -3819,8 +3831,8 @@ bool mob_parse_dbrow(char** str) { id = itemdb->search(db->dropitem[i].nameid); type = id->type; rate = atoi(str[k+1]); - if( (class_ >= 1324 && class_ <= 1363) || (class_ >= 1938 && class_ <= 1946) ) - { //Treasure box drop rates [Skotlex] + if( (class_ >= 1324 && class_ <= 1363) || (class_ >= 1938 && class_ <= 1946) ) { + //Treasure box drop rates [Skotlex] rate_adjust = battle_config.item_rate_treasure; ratemin = battle_config.item_drop_treasure_min; ratemax = battle_config.item_drop_treasure_max; @@ -3990,8 +4002,8 @@ bool mob_readdb_mobavail(char* str[], int columns, int current) class_=atoi(str[0]); - if(mob->db(class_) == mob->dummy) // invalid class (probably undefined in db) - { + if(mob->db(class_) == mob->dummy) { + // invalid class (probably undefined in db) ShowWarning("mob_readdb_mobavail: Unknown mob id %d.\n", class_); return false; } @@ -4042,7 +4054,7 @@ int mob_read_randommonster(void) for( i = 0; i < ARRAYLENGTH(mobfile) && i < MAX_RANDOMMONSTER; i++ ) { unsigned int count = 0; - mob->db_data[0]->summonper[i] = 1002; // Default fallback value, in case the database does not provide one + mob->db_data[0]->summonper[i] = 1002; // Default fallback value, in case the database does not provide one sprintf(line, "%s/%s", map->db_path, mobfile[i]); fp=fopen(line,"r"); if(fp==NULL){ @@ -4209,16 +4221,16 @@ bool mob_parse_row_mobskilldb(char** str, int columns, int current) char str[32]; enum MobSkillState id; } state[] = { - { "any", MSS_ANY }, //All states except Dead - { "idle", MSS_IDLE }, - { "walk", MSS_WALK }, - { "loot", MSS_LOOT }, - { "dead", MSS_DEAD }, - { "attack", MSS_BERSERK }, //Retaliating attack - { "angry", MSS_ANGRY }, //Preemptive attack (aggressive mobs) - { "chase", MSS_RUSH }, //Chase escaping target - { "follow", MSS_FOLLOW }, //Preemptive chase (aggressive mobs) - { "anytarget",MSS_ANYTARGET }, //Berserk+Angry+Rush+Follow + { "any", MSS_ANY }, //All states except Dead + { "idle", MSS_IDLE }, + { "walk", MSS_WALK }, + { "loot", MSS_LOOT }, + { "dead", MSS_DEAD }, + { "attack", MSS_BERSERK }, //Retaliating attack + { "angry", MSS_ANGRY }, //Preemptive attack (aggressive mobs) + { "chase", MSS_RUSH }, //Chase escaping target + { "follow", MSS_FOLLOW }, //Preemptive chase (aggressive mobs) + { "anytarget", MSS_ANYTARGET }, //Berserk+Angry+Rush+Follow }; static const struct { char str[32]; @@ -4248,33 +4260,33 @@ bool mob_parse_row_mobskilldb(char** str, int columns, int current) { "alchemist", MSC_ALCHEMIST }, { "onspawn", MSC_SPAWN }, }, cond2[] ={ - { "anybad", -1 }, - { "stone", SC_STONE }, - { "freeze", SC_FREEZE }, - { "stun", SC_STUN }, - { "sleep", SC_SLEEP }, - { "poison", SC_POISON }, - { "curse", SC_CURSE }, - { "silence", SC_SILENCE }, - { "confusion", SC_CONFUSION }, - { "blind", SC_BLIND }, - { "hiding", SC_HIDING }, - { "sight", SC_SIGHT }, + { "anybad", -1 }, + { "stone", SC_STONE }, + { "freeze", SC_FREEZE }, + { "stun", SC_STUN }, + { "sleep", SC_SLEEP }, + { "poison", SC_POISON }, + { "curse", SC_CURSE }, + { "silence", SC_SILENCE }, + { "confusion", SC_CONFUSION }, + { "blind", SC_BLIND }, + { "hiding", SC_HIDING }, + { "sight", SC_SIGHT }, }, target[] = { - { "target", MST_TARGET }, - { "randomtarget", MST_RANDOM }, - { "self", MST_SELF }, - { "friend", MST_FRIEND }, - { "master", MST_MASTER }, - { "around5", MST_AROUND5 }, - { "around6", MST_AROUND6 }, - { "around7", MST_AROUND7 }, - { "around8", MST_AROUND8 }, - { "around1", MST_AROUND1 }, - { "around2", MST_AROUND2 }, - { "around3", MST_AROUND3 }, - { "around4", MST_AROUND4 }, - { "around", MST_AROUND }, + { "target", MST_TARGET }, + { "randomtarget", MST_RANDOM }, + { "self", MST_SELF }, + { "friend", MST_FRIEND }, + { "master", MST_MASTER }, + { "around5", MST_AROUND5 }, + { "around6", MST_AROUND6 }, + { "around7", MST_AROUND7 }, + { "around8", MST_AROUND8 }, + { "around1", MST_AROUND1 }, + { "around2", MST_AROUND2 }, + { "around3", MST_AROUND3 }, + { "around4", MST_AROUND4 }, + { "around", MST_AROUND }, }; static int last_mob_id = 0; // ensures that only one error message per mob id is printed @@ -4301,8 +4313,8 @@ bool mob_parse_row_mobskilldb(char** str, int columns, int current) return true; } - if (mob_id < 0) - { //Prepare global skill. [Skotlex] + if (mob_id < 0) { + //Prepare global skill. [Skotlex] memset(&gms, 0, sizeof (struct mob_skill)); ms = &gms; } else { @@ -4413,8 +4425,8 @@ bool mob_parse_row_mobskilldb(char** str, int columns, int current) ms->val[1] = 0; ms->val[4] = 1; //request to return mode to normal. } - if(ms->skill_id == NPC_EMOTION_ON && mob_id>0 && ms->val[1]) - { //Adds a mode to the mob. + if (ms->skill_id == NPC_EMOTION_ON && mob_id>0 && ms->val[1]) { + //Adds a mode to the mob. //Remove aggressive mode when the new mob type is passive. if (!(ms->val[1]&MD_AGGRESSIVE)) ms->val[3]|=MD_AGGRESSIVE; @@ -4432,8 +4444,8 @@ bool mob_parse_row_mobskilldb(char** str, int columns, int current) else ms->msg_id=0; - if (mob_id < 0) - { //Set this skill to ALL mobs. [Skotlex] + if (mob_id < 0) { + //Set this skill to ALL mobs. [Skotlex] mob_id *= -1; for (i = 1; i < MAX_MOB_DB; i++) { @@ -4638,8 +4650,11 @@ void mob_reload(void) { mob->load(false); } +/** + * Clears spawn related information for a script reload. + */ void mob_clear_spawninfo() -{ //Clears spawn related information for a script reload. +{ int i; for (i = 0; i < MAX_MOB_DB; i++) if (mob->db_data[i]) diff --git a/src/map/mob.h b/src/map/mob.h index f3937c0d1..c61d29103 100644 --- a/src/map/mob.h +++ b/src/map/mob.h @@ -106,7 +106,7 @@ struct mob_db { unsigned int base_exp,job_exp; unsigned int mexp; short range2,range3; - short race2; // celest + short race2; // celest unsigned short lv; struct { int nameid,p; } dropitem[MAX_MOB_DROP]; struct { int nameid,p; } mvpitem[MAX_MVP_DROP]; @@ -125,7 +125,7 @@ struct mob_data { struct view_data *vd; struct status_data status, *base_status; //Second one is in case of leveling up mobs, or tiny/large mobs. struct status_change sc; - struct mob_db *db; //For quick data access (saves doing mob_db(md->class_) all the time) [Skotlex] + struct mob_db *db; //For quick data access (saves doing mob_db(md->class_) all the time) [Skotlex] char name[NAME_LENGTH]; struct { unsigned int size : 2; //Small/Big monsters. @@ -193,8 +193,8 @@ struct mob_data { enum { - MST_TARGET = 0, - MST_RANDOM, //Random Target! + MST_TARGET = 0, + MST_RANDOM, //Random Target! MST_SELF, MST_FRIEND, MST_MASTER, @@ -206,9 +206,9 @@ enum { MST_AROUND2, MST_AROUND3, MST_AROUND4, - MST_AROUND = MST_AROUND4, + MST_AROUND = MST_AROUND4, - MSC_ALWAYS = 0x0000, + MSC_ALWAYS = 0x0000, MSC_MYHPLTMAXRATE, MSC_MYHPINRATE, MSC_FRIENDHPLTMAXRATE, diff --git a/src/map/npc.c b/src/map/npc.c index 7378ac470..ce668bfae 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -63,14 +63,16 @@ static struct view_data npc_viewdb2[MAX_NPC_CLASS2_END-MAX_NPC_CLASS2_START]; unsigned int npc_market_qty[MAX_INVENTORY]; static struct script_event_s -{ //Holds pointers to the commonly executed scripts for speedup. [Skotlex] +{ + //Holds pointers to the commonly executed scripts for speedup. [Skotlex] struct event_data *event[UCHAR_MAX]; const char *event_name[UCHAR_MAX]; uint8 event_count; } script_event[NPCE_MAX]; struct view_data* npc_get_viewdata(int class_) -{ //Returns the viewdata for normal npc classes. +{ + //Returns the viewdata for normal npc classes. if( class_ == INVISIBLE_CLASS ) return &npc_viewdb[0]; if (npcdb_checkid(class_) || class_ == WARP_CLASS){ @@ -103,12 +105,12 @@ int npc_get_new_npc_id(void) { } int npc_isnear_sub(struct block_list* bl, va_list args) { - struct npc_data *nd = (struct npc_data*)bl; - - if( nd->option & (OPTION_HIDE|OPTION_INVISIBLE) ) - return 0; + struct npc_data *nd = (struct npc_data*)bl; + + if( nd->option & (OPTION_HIDE|OPTION_INVISIBLE) ) + return 0; - return 1; + return 1; } bool npc_isnear(struct block_list * bl) { @@ -885,9 +887,10 @@ int npc_touch_areanpc(struct map_session_data* sd, int16 m, int16 x, int16 y) nullpo_retr(1, sd); - // Why not enqueue it? [Inkfish] - //if(sd->npc_id) - // return 1; +#if 0 // Why not enqueue it? [Inkfish] + if(sd->npc_id) + return 1; +#endif // 0 for(i=0;i<map->list[m].npc_num;i++) { if (map->list[m].npc[i]->option&OPTION_INVISIBLE) { @@ -1211,7 +1214,7 @@ int npc_scriptcont(struct map_session_data* sd, int id, bool closing) { TBL_NPC* nd = BL_CAST(BL_NPC, target); ShowDebug("npc_scriptcont: %s (sd->npc_id=%d) is not %s (id=%d).\n", nd_sd?(char*)nd_sd->name:"'Unknown NPC'", (int)sd->npc_id, - nd?(char*)nd->name:"'Unknown NPC'", (int)id); + nd?(char*)nd->name:"'Unknown NPC'", (int)id); return 1; } @@ -1270,7 +1273,7 @@ int npc_buysellsel(struct map_session_data* sd, int id, int type) { sd->npc_id = 0; return 1; } - + if (nd->option & OPTION_INVISIBLE) // can't buy if npc is not visible (hack?) return 1; @@ -1807,11 +1810,11 @@ int npc_buylist(struct map_session_data* sd, int n, unsigned short* item_list) { return npc->buylist_sub(sd,n,item_list,nd->master_nd); if( z > (double)sd->status.zeny ) - return 1; // Not enough Zeny + return 1; // Not enough Zeny if( w + sd->weight > sd->max_weight ) - return 2; // Too heavy + return 2; // Too heavy if( pc->inventoryblank(sd) < new_ ) - return 3; // Not enough space to store items + return 3; // Not enough space to store items pc->payzeny(sd,(int)z,LOG_TYPE_NPC, NULL); @@ -1920,13 +1923,13 @@ int npc_market_buylist(struct map_session_data* sd, unsigned short list_size, st } if( z > (double)sd->status.zeny ) /* TODO find official response for this */ - return 1; // Not enough Zeny + return 1; // Not enough Zeny if( w + sd->weight > sd->max_weight ) /* TODO find official response for this */ - return 1; // Too heavy + return 1; // Too heavy if( pc->inventoryblank(sd) < new_ ) /* TODO find official response for this */ - return 1; // Not enough space to store items + return 1; // Not enough space to store items pc->payzeny(sd,(int)z,LOG_TYPE_NPC, NULL); @@ -2449,7 +2452,7 @@ void npc_parsename(struct npc_data* nd, const char* name, const char* start, con // Support for using Constants in place of NPC View IDs. int npc_parseview(const char* w4, const char* start, const char* buffer, const char* filepath) { int val = -1, i = 0; - char viewid[1024]; // Max size of name from const.txt, see script->read_constdb. + char viewid[1024]; // Max size of name from const.txt, see script->read_constdb. // Extract view ID / constant while (w4[i] != '\0') { @@ -2489,7 +2492,7 @@ bool npc_viewisid(const char * viewid) } } - return true; + return true; } //Add then display an npc warp on map @@ -2839,7 +2842,7 @@ const char* npc_skip_script(const char* start, const char* buffer, const char* f /// <map name>,<x>,<y>,<facing>%TAB%script%TAB%<NPC Name>%TAB%<sprite id>,{<code>} /// <map name>,<x>,<y>,<facing>%TAB%script%TAB%<NPC Name>%TAB%<sprite id>,<triggerX>,<triggerY>,{<code>} const char* npc_parse_script(char* w1, char* w2, char* w3, char* w4, const char* start, const char* buffer, const char* filepath, int options, int *retval) { - int x, y, dir = 0, m, xs = 0, ys = 0; // [Valaris] thanks to fov + int x, y, dir = 0, m, xs = 0, ys = 0; // [Valaris] thanks to fov char mapname[32]; struct script_code *scriptroot; int i; @@ -3605,7 +3608,7 @@ const char* npc_parse_mob(char* w1, char* w2, char* w3, char* w4, const char* st } /*========================================== * Set or disable mapflag on map - * eg : bat_c01 mapflag battleground 2 + * eg : bat_c01<TAB>mapflag<TAB>battleground<TAB>2 * also chking if mapflag conflict with another *------------------------------------------*/ const char* npc_parse_mapflag(char* w1, char* w2, char* w3, char* w4, const char* start, const char* buffer, const char* filepath, int *retval) { @@ -3629,7 +3632,7 @@ const char* npc_parse_mapflag(char* w1, char* w2, char* w3, char* w4, const char } if (w4 && !strcmpi(w4, "off")) - state = 0; //Disable mapflag rather than enable it. [Skotlex] + state = 0; //Disable mapflag rather than enable it. [Skotlex] if (!strcmpi(w3, "nosave")) { char savemap[32]; diff --git a/src/map/npc.h b/src/map/npc.h index 4c904e1ac..9c497ffe9 100644 --- a/src/map/npc.h +++ b/src/map/npc.h @@ -61,7 +61,7 @@ struct npc_data { int touching_id; int64 next_walktime; uint8 dir; - + unsigned size : 2; struct status_data status; diff --git a/src/map/packets.h b/src/map/packets.h index 3240a97a1..bb5222e93 100644 --- a/src/map/packets.h +++ b/src/map/packets.h @@ -1654,128 +1654,128 @@ packet(0x020d,-1); packet(0x0802,18,clif->pPartyBookingRegisterReq,2,4,6); // Booking System packet(0x0803,4); packet(0x0804,8); // Booking System - packet(0x0805,-1); - packet(0x0806,4,clif->pPartyBookingDeleteReq,2);// Booking System - //packet(0x0807,2); - packet(0x0808,4); // Booking System - //packet(0x0809,14); - //packet(0x080A,50); - //packet(0x080B,18); - //packet(0x080C,6); -#endif - - //2009-12-29aRagexeRE + packet(0x0805,-1); + packet(0x0806,4,clif->pPartyBookingDeleteReq,2);// Booking System + //packet(0x0807,2); + packet(0x0808,4); // Booking System + //packet(0x0809,14); + //packet(0x080A,50); + //packet(0x080B,18); + //packet(0x080C,6); +#endif + + //2009-12-29aRagexeRE #if PACKETVER >= 20091229 - packet(0x0804,14,clif->pPartyBookingSearchReq,2,4,6,8,12);// Booking System - packet(0x0806,2,clif->pPartyBookingDeleteReq,0);// Booking System - packet(0x0807,4); - packet(0x0808,14,clif->pPartyBookingUpdateReq,2); // Booking System - packet(0x0809,50); - packet(0x080A,18); - packet(0x080B,6);// Booking System -#endif - - //2010-01-05aRagexeRE + packet(0x0804,14,clif->pPartyBookingSearchReq,2,4,6,8,12);// Booking System + packet(0x0806,2,clif->pPartyBookingDeleteReq,0);// Booking System + packet(0x0807,4); + packet(0x0808,14,clif->pPartyBookingUpdateReq,2); // Booking System + packet(0x0809,50); + packet(0x080A,18); + packet(0x080B,6);// Booking System +#endif + + //2010-01-05aRagexeRE #if PACKETVER >= 20100105 - packet(0x0801,-1,clif->pPurchaseReq2,2,4,8,12); + packet(0x0801,-1,clif->pPurchaseReq2,2,4,8,12); #endif - - //2010-01-26aRagexeRE + + //2010-01-26aRagexeRE #if PACKETVER >= 20100126 - //packet(0x080C,2); - //packet(0x080D,3); - packet(0x080E,14); + //packet(0x080C,2); + //packet(0x080D,3); + packet(0x080E,14); #endif - - //2010-02-09aRagexeRE + + //2010-02-09aRagexeRE #if PACKETVER >= 20100209 - //packet(0x07F0,6); + //packet(0x07F0,6); #endif - - //2010-02-23aRagexeRE + + //2010-02-23aRagexeRE #if PACKETVER >= 20100223 - packet(0x080F,20); + packet(0x080F,20); #endif - - //2010-03-03aRagexeRE + + //2010-03-03aRagexeRE #if PACKETVER >= 20100303 - packet(0x0810,3); - packet(0x0811,-1,clif->pReqOpenBuyingStore,2,4,8,9,89); - //packet(0x0812,86); - //packet(0x0813,6); - //packet(0x0814,6); - //packet(0x0815,-1); - //packet(0x0817,-1); - //packet(0x0818,6); - //packet(0x0819,4); -#endif - - //2010-03-09aRagexeRE + packet(0x0810,3); + packet(0x0811,-1,clif->pReqOpenBuyingStore,2,4,8,9,89); + //packet(0x0812,86); + //packet(0x0813,6); + //packet(0x0814,6); + //packet(0x0815,-1); + //packet(0x0817,-1); + //packet(0x0818,6); + //packet(0x0819,4); +#endif + + //2010-03-09aRagexeRE #if PACKETVER >= 20100309 - packet(0x0813,-1); - //packet(0x0814,2); - //packet(0x0815,6); - packet(0x0816,6); - packet(0x0818,-1); - //packet(0x0819,10); - //packet(0x081A,4); - //packet(0x081B,4); - //packet(0x081C,6); - packet(0x081d,22); - packet(0x081e,8); -#endif - - //2010-03-23aRagexeRE + packet(0x0813,-1); + //packet(0x0814,2); + //packet(0x0815,6); + packet(0x0816,6); + packet(0x0818,-1); + //packet(0x0819,10); + //packet(0x081A,4); + //packet(0x081B,4); + //packet(0x081C,6); + packet(0x081d,22); + packet(0x081e,8); +#endif + + //2010-03-23aRagexeRE #if PACKETVER >= 20100323 - //packet(0x081F,-1); + //packet(0x081F,-1); #endif - - //2010-04-06aRagexeRE + + //2010-04-06aRagexeRE #if PACKETVER >= 20100406 - //packet(0x081A,6); + //packet(0x081A,6); #endif - - //2010-04-13aRagexeRE + + //2010-04-13aRagexeRE #if PACKETVER >= 20100413 - //packet(0x081A,10); - packet(0x0820,11); - //packet(0x0821,2); - //packet(0x0822,9); - //packet(0x0823,-1); -#endif - - //2010-04-14dRagexeRE + //packet(0x081A,10); + packet(0x0820,11); + //packet(0x0821,2); + //packet(0x0822,9); + //packet(0x0823,-1); +#endif + + //2010-04-14dRagexeRE #if PACKETVER >= 20100414 - //packet(0x081B,8); + //packet(0x081B,8); #endif - - //2010-04-20aRagexeRE + + //2010-04-20aRagexeRE #if PACKETVER >= 20100420 - packet(0x0812,8); - packet(0x0814,86); - packet(0x0815,2,clif->pReqCloseBuyingStore,0); - packet(0x0817,6,clif->pReqClickBuyingStore,2); - packet(0x0819,-1,clif->pReqTradeBuyingStore,2,4,8,12); - packet(0x081a,4); - packet(0x081b,10); - packet(0x081c,10); - packet(0x0824,6); -#endif - - //2010-06-01aRagexeRE + packet(0x0812,8); + packet(0x0814,86); + packet(0x0815,2,clif->pReqCloseBuyingStore,0); + packet(0x0817,6,clif->pReqClickBuyingStore,2); + packet(0x0819,-1,clif->pReqTradeBuyingStore,2,4,8,12); + packet(0x081a,4); + packet(0x081b,10); + packet(0x081c,10); + packet(0x0824,6); +#endif + + //2010-06-01aRagexeRE #if PACKETVER >= 20100601 - //packet(0x0825,-1); - //packet(0x0826,4); - packet(0x0835,-1,clif->pSearchStoreInfo,2,4,5,9,13,14,15); - packet(0x0836,-1); - packet(0x0837,3); - //packet(0x0838,3); -#endif - - //2010-06-08aRagexeRE + //packet(0x0825,-1); + //packet(0x0826,4); + packet(0x0835,-1,clif->pSearchStoreInfo,2,4,5,9,13,14,15); + packet(0x0836,-1); + packet(0x0837,3); + //packet(0x0838,3); +#endif + + //2010-06-08aRagexeRE #if PACKETVER >= 20100608 - packet(0x0838,2,clif->pSearchStoreInfoNextPage,0); - packet(0x083A,4); // Search Stalls Feature + packet(0x0838,2,clif->pSearchStoreInfoNextPage,0); + packet(0x083A,4); // Search Stalls Feature packet(0x083B,2,clif->pCloseSearchStoreInfo,0); packet(0x083C,12,clif->pSearchStoreInfoListItemClick,2,6,10); packet(0x083D,6); @@ -2415,7 +2415,7 @@ packet(0x020d,-1); packet(0x0873,36,clif->pStoragePassword,0); packet(0x097C,4,clif->pRanklist); #endif - + //2013-08-07Ragexe (Shakto) #if PACKETVER >= 20130807 packet(0x0369,7,clif->pActionRequest,2,6); @@ -2700,7 +2700,7 @@ packet(0x020d,-1); #endif // 2014-04-02gRagexe - Themon -#if PACKETVER >= 20140402 +#if PACKETVER >= 20140402 packet(0x0946,7,clif->pActionRequest,2,6); packet(0x0868,10,clif->pUseSkillToId,2,4,6); packet(0x093F,5,clif->pWalkToXY,2); @@ -2734,7 +2734,7 @@ packet(0x020d,-1); #endif // 2014-04-16aRagexe - Themon -#if PACKETVER >= 20140416 +#if PACKETVER >= 20140416 packet(0x0369,7,clif->pActionRequest,2,6); packet(0x083C,10,clif->pUseSkillToId,2,4,6); packet(0x0437,5,clif->pWalkToXY,2); diff --git a/src/map/packets_struct.h b/src/map/packets_struct.h index 1c6deab96..71471e5c6 100644 --- a/src/map/packets_struct.h +++ b/src/map/packets_struct.h @@ -279,10 +279,10 @@ struct EQUIPITEM_INFO { int HireExpireDate; #endif #if PACKETVER >= 20080102 - unsigned short bindOnEquipType; + unsigned short bindOnEquipType; #endif #if PACKETVER >= 20100629 - unsigned short wItemSpriteNumber; + unsigned short wItemSpriteNumber; #endif #if PACKETVER >= 20120925 struct { @@ -672,7 +672,7 @@ struct packet_bgqueue_register { struct packet_bgqueue_update_info { short PacketType; char bg_name[NAME_LENGTH]; - int position; + int position; } __attribute__((packed)); struct packet_bgqueue_checkstate { diff --git a/src/map/party.c b/src/map/party.c index f4a5c870a..668251b5d 100644 --- a/src/map/party.c +++ b/src/map/party.c @@ -11,7 +11,7 @@ #include <stdlib.h> #include <string.h> -#include "atcommand.h" //msg_txt() +#include "atcommand.h" //msg_txt() #include "battle.h" #include "clif.h" #include "instance.h" @@ -41,7 +41,7 @@ struct party_interface party_s; * Used when creating/adding people to a party. [Skotlex] *------------------------------------------*/ void party_fill_member(struct party_member* member, struct map_session_data* sd, unsigned int leader) { - member->account_id = sd->status.account_id; + member->account_id = sd->status.account_id; member->char_id = sd->status.char_id; safestrncpy(member->name, sd->status.name, NAME_LENGTH); member->class_ = sd->status.class_; @@ -87,8 +87,8 @@ TBL_PC* party_sd_check(int party_id, int account_id, int char_id) { if( sd->status.party_id == 0 ) sd->status.party_id = party_id;// auto-join if not in a party - if (sd->status.party_id != party_id) - { //If player belongs to a different party, kick him out. + if (sd->status.party_id != party_id) { + //If player belongs to a different party, kick him out. intif->party_leave(party_id,account_id,char_id); return NULL; } @@ -674,8 +674,8 @@ bool party_changeleader(struct map_session_data *sd, struct map_session_data *ts if (mi == MAX_PARTY) return false; //Shouldn't happen - if (!p->party.member[mi].leader) - { //Need to be a party leader. + if (!p->party.member[mi].leader) { + //Need to be a party leader. clif->message(sd->fd, msg_txt(282)); return false; } @@ -979,14 +979,14 @@ int party_share_loot(struct party_data* p, struct map_session_data* sd, struct i if (p && p->party.item&2 && (first_charid || !(battle_config.party_share_type&1))) { //item distribution to party members. - if (battle_config.party_share_type&2) - { //Round Robin + if (battle_config.party_share_type&2) { + //Round Robin TBL_PC* psd; i = p->itemc; do { i++; if (i >= MAX_PARTY) - i = 0; // reset counter to 1st person in party so it'll stop when it reaches "itemc" + i = 0; // reset counter to 1st person in party so it'll stop when it reaches "itemc" if( (psd = p->data[i].sd) == NULL || sd->bl.m != psd->bl.m || pc_isdead(psd) || (battle_config.idle_no_share && pc_isidle(psd)) ) continue; @@ -999,9 +999,8 @@ int party_share_loot(struct party_data* p, struct map_session_data* sd, struct i target = psd; break; } while (i != p->itemc); - } - else - { //Random pick + } else { + //Random pick TBL_PC* psd[MAX_PARTY]; int count = 0; //Collect pick candidates @@ -1013,11 +1012,12 @@ int party_share_loot(struct party_data* p, struct map_session_data* sd, struct i } while (count > 0) { //Pick a random member. i = rnd()%count; - if (pc->additem(psd[i],item_data,item_data->amount,LOG_TYPE_PICKDROP_PLAYER)) - { //Discard this receiver. + if (pc->additem(psd[i],item_data,item_data->amount,LOG_TYPE_PICKDROP_PLAYER)) { + //Discard this receiver. psd[i] = psd[count-1]; count--; - } else { //Successful pick. + } else { + //Successful pick. target = psd[i]; break; } @@ -1172,7 +1172,7 @@ void party_recruit_register(struct map_session_data *sd, short level, const char memcpy(pb_ad->charname,sd->status.name,NAME_LENGTH); pb_ad->expiretime = (int)time(NULL); - pb_ad->p_detail.level = level; + pb_ad->p_detail.level = level; safestrncpy(pb_ad->p_detail.notice, notice, PB_NOTICE_LENGTH); clif->PartyRecruitRegisterAck(sd, 0); @@ -1185,7 +1185,7 @@ void party_recruit_register(struct map_session_data *sd, short level, const char void party_booking_register(struct map_session_data *sd, short level, short mapid, short* job) { #ifndef PARTY_RECRUIT struct party_booking_ad_info *pb_ad; - int i; + int i; pb_ad = (struct party_booking_ad_info*)idb_get(party->booking_db, sd->status.char_id); @@ -1202,7 +1202,7 @@ void party_booking_register(struct map_session_data *sd, short level, short mapi memcpy(pb_ad->charname,sd->status.name,NAME_LENGTH); pb_ad->expiretime = (int)time(NULL); - pb_ad->p_detail.level = level; + pb_ad->p_detail.level = level; pb_ad->p_detail.mapid = mapid; for(i=0;i<PARTY_BOOKING_JOBS;i++) diff --git a/src/map/party.h b/src/map/party.h index d62db23a7..f6cd448a6 100644 --- a/src/map/party.h +++ b/src/map/party.h @@ -30,12 +30,12 @@ struct party_data { short *instance; unsigned short instances; struct { - unsigned monk : 1; //There's at least one monk in party? - unsigned sg : 1; //There's at least one Star Gladiator in party? - unsigned snovice :1; //There's a Super Novice - unsigned tk : 1; //There's a taekwon + unsigned monk : 1; ///< There's at least one monk in party? + unsigned sg : 1; ///< There's at least one Star Gladiator in party? + unsigned snovice :1; ///< There's a Super Novice + unsigned tk : 1; ///< There's a taekwon } state; - + /* HPM Custom Struct */ struct HPluginData **hdata; unsigned int hdatac; @@ -46,8 +46,8 @@ struct party_data { #ifndef PARTY_RECRUIT struct party_booking_detail { short level; - short mapid; - short job[PARTY_BOOKING_JOBS]; + short mapid; + short job[PARTY_BOOKING_JOBS]; }; struct party_booking_ad_info { @@ -87,7 +87,7 @@ struct party_interface { struct party_data* (*searchname) (const char* str); int (*getmemberid) (struct party_data* p, struct map_session_data* sd); struct map_session_data* (*getavailablesd) (struct party_data *p); - + int (*create) (struct map_session_data *sd,char *name, int item, int item2); void (*created) (int account_id,int char_id,int fail,int party_id,char *name); int (*request_info) (int party_id, int char_id); diff --git a/src/map/path.c b/src/map/path.c index 9aeb108fa..a7315da3c 100644 --- a/src/map/path.c +++ b/src/map/path.c @@ -53,7 +53,7 @@ BHEAP_STRUCT_DECL(node_heap, struct path_node*); /// Estimates the cost from (x0,y0) to (x1,y1). /// This is inadmissible (overestimating) heuristic used by game client. -#define heuristic(x0, y0, x1, y1) (MOVE_COST * (abs((x1) - (x0)) + abs((y1) - (y0)))) // Manhattan distance +#define heuristic(x0, y0, x1, y1) (MOVE_COST * (abs((x1) - (x0)) + abs((y1) - (y0)))) // Manhattan distance /// @} // Translates dx,dy into walking direction @@ -435,7 +435,7 @@ unsigned int distance(int dx, int dy) min = dy; max = dx; } - // coefficients equivalent to ( 123/128 * max ) and ( 51/128 * min ) + // coefficients equivalent to ( 123/128 * max ) and ( 51/128 * min ) return ((( max << 8 ) + ( max << 3 ) - ( max << 4 ) - ( max << 1 ) + ( min << 7 ) - ( min << 5 ) + ( min << 3 ) - ( min << 1 )) >> 8 ); #else diff --git a/src/map/pc.c b/src/map/pc.c index 1e651b321..6ba06c82b 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -388,7 +388,8 @@ int pc_setrestartvalue(struct map_session_data *sd,int type) { bst = &sd->base_status; st = &sd->battle_status; - if (type&1) { //Normal resurrection + if (type&1) { + //Normal resurrection st->hp = 1; //Otherwise status->heal may fail if dead. status->heal(&sd->bl, bst->hp, 0, 1); if( st->sp < bst->sp ) @@ -554,7 +555,7 @@ int pc_makesavestatus(struct map_session_data *sd) if(!battle_config.save_clothcolor) sd->status.clothes_color=0; - //Only copy the Cart/Peco/Falcon options, the rest are handled via + //Only copy the Cart/Peco/Falcon options, the rest are handled via //status change load/saving. [Skotlex] #ifdef NEW_CARTS sd->status.option = sd->sc.option&(OPTION_INVISIBLE|OPTION_FALCON|OPTION_RIDING|OPTION_DRAGON|OPTION_WUG|OPTION_WUGRIDER|OPTION_MADOGEAR); @@ -643,12 +644,15 @@ int pc_equippoint(struct map_session_data *sd,int n) return 0; //Not equippable by players. ep = sd->inventory_data[n]->equip; - if(sd->inventory_data[n]->look == W_DAGGER || - sd->inventory_data[n]->look == W_1HSWORD || - sd->inventory_data[n]->look == W_1HAXE) { - if( (pc->checkskill(sd,AS_LEFT) > 0 || - (sd->class_&MAPID_UPPERMASK) == MAPID_ASSASSIN || - (sd->class_&MAPID_UPPERMASK) == MAPID_KAGEROUOBORO) ) { //Kagerou and Oboro can dual wield daggers. [Rytech] + if (sd->inventory_data[n]->look == W_DAGGER + || sd->inventory_data[n]->look == W_1HSWORD + || sd->inventory_data[n]->look == W_1HAXE + ) { + if (pc->checkskill(sd,AS_LEFT) > 0 + || (sd->class_&MAPID_UPPERMASK) == MAPID_ASSASSIN + || (sd->class_&MAPID_UPPERMASK) == MAPID_KAGEROUOBORO + ) { + //Kagerou and Oboro can dual wield daggers. [Rytech] if( ep == EQP_HAND_R ) return EQP_ARMS; if( ep == EQP_SHADOW_WEAPON ) @@ -1201,8 +1205,8 @@ int pc_set_hate_mob(struct map_session_data *sd, int pos, struct block_list *bl) int class_; if (!sd || !bl || pos < 0 || pos > 2) return 0; - if (sd->hate_mob[pos] != -1) - { //Can't change hate targets. + if (sd->hate_mob[pos] != -1) { + //Can't change hate targets. clif->hate_info(sd, pos, sd->hate_mob[pos], 0); //Display current return 0; } @@ -1830,10 +1834,10 @@ int pc_bonus_autospell_onskill(struct s_autospell *spell, int max, short src_ski return 0; } - spell[i].flag = src_skill; - spell[i].id = id; - spell[i].lv = lv; - spell[i].rate = rate; + spell[i].flag = src_skill; + spell[i].id = id; + spell[i].lv = lv; + spell[i].rate = rate; spell[i].card_id = card_id; return 1; } @@ -1910,8 +1914,8 @@ int pc_bonus_item_drop(struct s_add_drop *drop, const short max, short id, short && race > 0 ) { drop[i].race |= race; - if(drop[i].rate > 0 && rate > 0) - { //Both are absolute rates. + if (drop[i].rate > 0 && rate > 0) { + //Both are absolute rates. if (drop[i].rate < rate) drop[i].rate = rate; } else @@ -2308,19 +2312,19 @@ int pc_bonus(struct map_session_data *sd,int type,int val) { break; } break; - case SP_SPEED_RATE: //Non stackable increase + case SP_SPEED_RATE: //Non stackable increase if(sd->state.lr_flag != 2) sd->bonus.speed_rate = min(sd->bonus.speed_rate, -val); break; - case SP_SPEED_ADDRATE: //Stackable increase + case SP_SPEED_ADDRATE: //Stackable increase if(sd->state.lr_flag != 2) sd->bonus.speed_add_rate -= val; break; - case SP_ASPD: //Raw increase + case SP_ASPD: //Raw increase if(sd->state.lr_flag != 2) sd->bonus.aspd_add -= 10*val; break; - case SP_ASPD_RATE: //Stackable increase - Made it linear as per rodatazone + case SP_ASPD_RATE: //Stackable increase - Made it linear as per rodatazone if(sd->state.lr_flag != 2) #ifndef RENEWAL_ASPD bst->aspd_rate -= 10*val; @@ -2533,7 +2537,7 @@ int pc_bonus(struct map_session_data *sd,int type,int val) { if(sd->state.lr_flag != 2) sd->bonus.magic_damage_return += val; break; - case SP_ALL_STATS: // [Valaris] + case SP_ALL_STATS: // [Valaris] if(sd->state.lr_flag!=2) { sd->param_bonus[SP_STR-SP_STR]+=val; sd->param_bonus[SP_AGI-SP_STR]+=val; @@ -2543,13 +2547,13 @@ int pc_bonus(struct map_session_data *sd,int type,int val) { sd->param_bonus[SP_LUK-SP_STR]+=val; } break; - case SP_AGI_VIT: // [Valaris] + case SP_AGI_VIT: // [Valaris] if(sd->state.lr_flag!=2) { sd->param_bonus[SP_AGI-SP_STR]+=val; sd->param_bonus[SP_VIT-SP_STR]+=val; } break; - case SP_AGI_DEX_STR: // [Valaris] + case SP_AGI_DEX_STR: // [Valaris] if(sd->state.lr_flag!=2) { sd->param_bonus[SP_AGI-SP_STR]+=val; sd->param_bonus[SP_DEX-SP_STR]+=val; @@ -2593,7 +2597,7 @@ int pc_bonus(struct map_session_data *sd,int type,int val) { sd->bonus.classchange=val; break; case SP_LONG_ATK_RATE: - if(sd->state.lr_flag != 2) //[Lupus] it should stack, too. As any other cards rate bonuses + if(sd->state.lr_flag != 2) //[Lupus] it should stack, too. As any other cards rate bonuses sd->bonus.long_attack_atk_rate+=val; break; case SP_BREAK_WEAPON_RATE: @@ -3920,10 +3924,10 @@ int pc_getzeny(struct map_session_data *sd,int zeny, enum e_log_pick_type type, /** * Searches for the specified item ID in inventory and return its inventory index. - * + * * If the item is found, the returned value is guaranteed to be a valid index * (non-negative, smaller than MAX_INVENTORY). - * + * * @param sd Character to search on. * @param item_id The item ID to search. * @return the inventory index of the first instance of the requested item. @@ -3940,14 +3944,14 @@ int pc_search_inventory(struct map_session_data *sd, int item_id) { /*========================================== * Attempt to add a new item to inventory. * Return: - 0 = success - 1 = invalid itemid not found or negative amount - 2 = overweight - 3 = ? - 4 = no free place found - 5 = max amount reached - 6 = ? - 7 = stack limitation + * 0 = success + * 1 = invalid itemid not found or negative amount + * 2 = overweight + * 3 = ? + * 4 = no free place found + * 5 = max amount reached + * 6 = ? + * 7 = stack limitation *------------------------------------------*/ int pc_additem(struct map_session_data *sd,struct item *item_data,int amount,e_log_pick_type log_type) { @@ -4060,11 +4064,11 @@ int pc_additem(struct map_session_data *sd,struct item *item_data,int amount,e_l * Remove an item at index n from inventory by amount. * Parameters : * @type - * 1 : don't notify deletion - * 2 : don't notify weight change + * 1 : don't notify deletion + * 2 : don't notify weight change * Return: - * 0 = success - * 1 = invalid itemid or negative amount + * 0 = success + * 1 = invalid itemid or negative amount *------------------------------------------*/ int pc_delitem(struct map_session_data *sd,int n,int amount,int type, short reason, e_log_pick_type log_type) { @@ -4094,8 +4098,8 @@ int pc_delitem(struct map_session_data *sd,int n,int amount,int type, short reas /*========================================== * Attempt to drop an item. * Return: - * 0 = fail - * 1 = success + * 0 = fail + * 1 = success *------------------------------------------*/ int pc_dropitem(struct map_session_data *sd,int n,int amount) { @@ -4137,8 +4141,8 @@ int pc_dropitem(struct map_session_data *sd,int n,int amount) /*========================================== * Attempt to pick up an item. * Return: - * 0 = fail - * 1 = success + * 0 = fail + * 1 = success *------------------------------------------*/ int pc_takeitem(struct map_session_data *sd,struct flooritem_data *fitem) { @@ -4151,7 +4155,7 @@ int pc_takeitem(struct map_session_data *sd,struct flooritem_data *fitem) nullpo_ret(fitem); if(!check_distance_bl(&fitem->bl, &sd->bl, 2) && sd->ud.skill_id!=BS_GREED) - return 0; // Distance is too far + return 0; // Distance is too far if( pc_has_permission(sd,PC_PERM_DISABLE_PICK_UP) ) return 0; @@ -4208,8 +4212,8 @@ int pc_takeitem(struct map_session_data *sd,struct flooritem_data *fitem) /*========================================== * Check if item is usable. * Return: - * 0 = no - * 1 = yes + * 0 = no + * 1 = yes *------------------------------------------*/ int pc_isUseitem(struct map_session_data *sd,int n) { @@ -4392,8 +4396,8 @@ int pc_isUseitem(struct map_session_data *sd,int n) /*========================================== * Last checks to use an item. * Return: - * 0 = fail - * 1 = success + * 0 = fail + * 1 = success *------------------------------------------*/ int pc_useitem(struct map_session_data *sd,int n) { int64 tick = timer->gettick(); @@ -4547,8 +4551,8 @@ int pc_useitem(struct map_session_data *sd,int n) { /*========================================== * Add item on cart for given index. * Return: - * 0 = success - * 1 = fail + * 0 = success + * 1 = fail *------------------------------------------*/ int pc_cart_additem(struct map_session_data *sd,struct item *item_data,int amount,e_log_pick_type log_type) { @@ -4567,8 +4571,8 @@ int pc_cart_additem(struct map_session_data *sd,struct item *item_data,int amoun return 1; } - if( !itemdb_cancartstore(item_data, pc_get_group_level(sd)) || (item_data->bound > IBT_ACCOUNT && !pc_can_give_bound_items(sd))) - { // Check item trade restrictions [Skotlex] + if (!itemdb_cancartstore(item_data, pc_get_group_level(sd)) || (item_data->bound > IBT_ACCOUNT && !pc_can_give_bound_items(sd))) { + // Check item trade restrictions clif->message (sd->fd, msg_txt(264)); return 1;/* TODO: there is no official response to this? */ } @@ -4581,7 +4585,7 @@ int pc_cart_additem(struct map_session_data *sd,struct item *item_data,int amoun { ARR_FIND( 0, MAX_CART, i, sd->status.cart[i].nameid == item_data->nameid && sd->status.cart[i].bound == item_data->bound && - sd->status.cart[i].card[0] == item_data->card[0] && sd->status.cart[i].card[1] == item_data->card[1] && + sd->status.cart[i].card[0] == item_data->card[0] && sd->status.cart[i].card[1] == item_data->card[1] && sd->status.cart[i].card[2] == item_data->card[2] && sd->status.cart[i].card[3] == item_data->card[3] ); }; @@ -4616,8 +4620,8 @@ int pc_cart_additem(struct map_session_data *sd,struct item *item_data,int amoun /*========================================== * Delete item on cart for given index. * Return: - * 0 = success - * 1 = fail + * 0 = success + * 1 = fail *------------------------------------------*/ int pc_cart_delitem(struct map_session_data *sd,int n,int amount,int type,e_log_pick_type log_type) { struct item_data * data; @@ -4645,8 +4649,8 @@ int pc_cart_delitem(struct map_session_data *sd,int n,int amount,int type,e_log_ /*========================================== * Transfer item from inventory to cart. * Return: - * 0 = fail - * 1 = succes + * 0 = fail + * 1 = succes *------------------------------------------*/ int pc_putitemtocart(struct map_session_data *sd,int idx,int amount) { @@ -4672,8 +4676,8 @@ int pc_putitemtocart(struct map_session_data *sd,int idx,int amount) /*========================================== * Get number of item in cart. * Return: - -1 = itemid not found or no amount found - x = remaining itemid on cart after get + * -1 = itemid not found or no amount found + * x = remaining itemid on cart after get *------------------------------------------*/ int pc_cartitem_amount(struct map_session_data* sd, int idx, int amount) { @@ -4691,8 +4695,8 @@ int pc_cartitem_amount(struct map_session_data* sd, int idx, int amount) /*========================================== * Retrieve an item at index idx from cart. * Return: - * 0 = player not found or (FIXME) succes (from pc->cart_delitem) - * 1 = failure + * 0 = player not found or (FIXME) succes (from pc->cart_delitem) + * 1 = failure *------------------------------------------*/ int pc_getitemfromcart(struct map_session_data *sd,int idx,int amount) { @@ -4772,8 +4776,8 @@ int pc_show_steal(struct block_list *bl,va_list ap) /*========================================== * Steal an item from bl (mob). * Return: - * 0 = fail - * 1 = succes + * 0 = fail + * 1 = succes *------------------------------------------*/ int pc_steal_item(struct map_session_data *sd,struct block_list *bl, uint16 skill_lv) { @@ -4799,7 +4803,7 @@ int pc_steal_item(struct map_session_data *sd,struct block_list *bl, uint16 skil map->list[bl->m].flag.nomobloot || // check noloot map flag [Lorky] (battle_config.skill_steal_max_tries && //Reached limit of steal attempts. [Lupus] md->state.steal_flag++ >= battle_config.skill_steal_max_tries) - ) { //Can't steal from + ) { //Can't steal from md->state.steal_flag = UCHAR_MAX; return 0; } @@ -5118,8 +5122,8 @@ int pc_setpos(struct map_session_data* sd, unsigned short map_index, int x, int * Warp player sd to random location on current map. * May fail if no walkable cell found (1000 attempts). * Return: - * 0 = fail or FIXME success (from pc->setpos) - * x(1|2) = fail + * 0 = fail or FIXME success (from pc->setpos) + * x(1|2) = fail *------------------------------------------*/ int pc_randomwarp(struct map_session_data *sd, clr_type type) { int x,y,i=0; @@ -5239,7 +5243,7 @@ int pc_checkskill2(struct map_session_data *sd,uint16 index) { * Chk if we still have the correct weapon to continue the skill (actually status) * If not ending it * Return - * 0 - No status found or all done + * 0 - No status found or all done *------------------------------------------*/ int pc_checkallowskill(struct map_session_data *sd) { @@ -5735,7 +5739,7 @@ const char* job_name(int class_) case JOB_ARCH_BISHOP_T: // 659 case JOB_MECHANIC_T: // 660 case JOB_GUILLOTINE_CROSS_T: // 661 - return msg_txt(656 - JOB_RUNE_KNIGHT_T+class_); + return msg_txt(656 - JOB_RUNE_KNIGHT_T+class_); case JOB_ROYAL_GUARD: // 631 case JOB_SORCERER: // 632 @@ -5753,7 +5757,7 @@ const char* job_name(int class_) case JOB_SURA_T: // 666 case JOB_GENETIC_T: // 667 case JOB_SHADOW_CHASER_T: // 668 - return msg_txt(662 - JOB_ROYAL_GUARD_T+class_); + return msg_txt(662 - JOB_ROYAL_GUARD_T+class_); case JOB_RUNE_KNIGHT2: return msg_txt(625); @@ -5855,7 +5859,7 @@ int pc_follow_timer(int tid, int64 tick, int id, intptr_t data) { pc->setpos(sd, map_id2index(tbl->m), tbl->x, tbl->y, CLR_TELEPORT); } sd->followtimer = timer->add( - tick + 1000, // increase time a bit to loosen up map's load + tick + 1000, // increase time a bit to loosen up map's load pc->follow_timer, sd->bl.id, 0); return 0; } @@ -5907,7 +5911,7 @@ int pc_checkbaselevelup(struct map_session_data *sd) { } while ((next=pc->nextbaseexp(sd)) > 0 && sd->status.base_exp >= next); - if (battle_config.pet_lv_rate && sd->pd) //<Skotlex> update pet's level + if (battle_config.pet_lv_rate && sd->pd) //<Skotlex> update pet's level status_calc_pet(sd->pd,SCO_NONE); clif->updatestatus(sd,SP_STATUSPOINT); @@ -6109,12 +6113,12 @@ bool pc_gainexp(struct map_session_data *sd, struct block_list *src, unsigned in *------------------------------------------*/ unsigned int pc_maxbaselv(struct map_session_data *sd) { - return pc->max_level[pc->class2idx(sd->status.class_)][0]; + return pc->max_level[pc->class2idx(sd->status.class_)][0]; } unsigned int pc_maxjoblv(struct map_session_data *sd) { - return pc->max_level[pc->class2idx(sd->status.class_)][1]; + return pc->max_level[pc->class2idx(sd->status.class_)][1]; } /*========================================== @@ -6145,8 +6149,8 @@ unsigned int pc_thisbaseexp(struct map_session_data *sd) /*========================================== * job level exp lookup * Return: - * 0 = not found - * x = exp for level + * 0 = not found + * x = exp for level *------------------------------------------*/ //Job exp needed for next level. @@ -6470,7 +6474,7 @@ int pc_allskillup(struct map_session_data *sd) continue; //Cannot be learned normally. sd->status.skill[idx].id = id; - sd->status.skill[idx].lv = skill->tree_get_max(id, sd->status.class_); // celest + sd->status.skill[idx].lv = skill->tree_get_max(id, sd->status.class_); // celest } } status_calc_pc(sd,SCO_NONE); @@ -6508,7 +6512,7 @@ int pc_resetlvl(struct map_session_data* sd,int type) sd->status.dex=1; sd->status.luk=1; if(sd->status.class_ == JOB_NOVICE_HIGH) { - sd->status.status_point=100; // not 88 [celest] + sd->status.status_point=100; // not 88 [celest] // give platinum skills upon changing pc->skill(sd,142,1,0); pc->skill(sd,143,1,0); @@ -6547,12 +6551,12 @@ int pc_resetlvl(struct map_session_data* sd,int type) clif->updatestatus(sd,SP_NEXTJOBEXP); clif->updatestatus(sd,SP_SKILLPOINT); - clif->updatestatus(sd,SP_USTR); // Updates needed stat points - Valaris + clif->updatestatus(sd,SP_USTR); // Updates needed stat points - Valaris clif->updatestatus(sd,SP_UAGI); clif->updatestatus(sd,SP_UVIT); clif->updatestatus(sd,SP_UINT); clif->updatestatus(sd,SP_UDEX); - clif->updatestatus(sd,SP_ULUK); // End Addition + clif->updatestatus(sd,SP_ULUK); // End Addition for(i=0;i<EQI_MAX;i++) { // unequip items that can't be equipped by base 1 [Valaris] if(sd->equip_index[i] >= 0) @@ -6575,10 +6579,10 @@ int pc_resetstate(struct map_session_data* sd) { nullpo_ret(sd); - if (battle_config.use_statpoint_table) - { // New statpoint table used here - Dexity - if (sd->status.base_level > MAX_LEVEL) - { //pc->statp[] goes out of bounds, can't reset! + if (battle_config.use_statpoint_table) { + // New statpoint table used here - Dexity + if (sd->status.base_level > MAX_LEVEL) { + //pc->statp[] goes out of bounds, can't reset! ShowError("pc_resetstate: Can't reset stats of %d:%d, the base level (%d) is greater than the max level supported (%d)\n", sd->status.account_id, sd->status.char_id, sd->status.base_level, MAX_LEVEL); return 0; @@ -6613,12 +6617,12 @@ int pc_resetstate(struct map_session_data* sd) clif->updatestatus(sd,SP_DEX); clif->updatestatus(sd,SP_LUK); - clif->updatestatus(sd,SP_USTR); // Updates needed stat points - Valaris + clif->updatestatus(sd,SP_USTR); // Updates needed stat points - Valaris clif->updatestatus(sd,SP_UAGI); clif->updatestatus(sd,SP_UVIT); clif->updatestatus(sd,SP_UINT); clif->updatestatus(sd,SP_UDEX); - clif->updatestatus(sd,SP_ULUK); // End Addition + clif->updatestatus(sd,SP_ULUK); // End Addition clif->updatestatus(sd,SP_STATUSPOINT); @@ -7001,12 +7005,13 @@ int pc_dead(struct map_session_data *sd,struct block_list *src) { case BL_MOB: { struct mob_data *md=(struct mob_data *)src; - if(md->target_id==sd->bl.id) + if (md->target_id==sd->bl.id) mob->unlocktarget(md,tick); - if(battle_config.mobs_level_up && md->status.hp && - (unsigned int)md->level < pc->maxbaselv(sd) && - !md->guardian_data && !md->special_state.ai// Guardians/summons should not level. [Skotlex] - ) { // monster level up [Valaris] + if (battle_config.mobs_level_up && md->status.hp + && (unsigned int)md->level < pc->maxbaselv(sd) + && !md->guardian_data && !md->special_state.ai// Guardians/summons should not level. [Skotlex] + ) { + // monster level up [Valaris] clif->misceffect(&md->bl,0); md->level++; status_calc_mob(md, SCO_NONE); @@ -7048,19 +7053,20 @@ int pc_dead(struct map_session_data *sd,struct block_list *src) { // karma going down = more 'good' / more honourable. // The Karma System way... - if (sd->status.karma > ssd->status.karma) { // If player killed was more evil + if (sd->status.karma > ssd->status.karma) { + // If player killed was more evil sd->status.karma--; ssd->status.karma--; } - else if (sd->status.karma < ssd->status.karma) // If player killed was more good + else if (sd->status.karma < ssd->status.karma) // If player killed was more good ssd->status.karma++; // or the PK System way... - if (sd->status.karma > 0) // player killed is dishonourable? + if (sd->status.karma > 0) // player killed is dishonourable? ssd->status.karma--; // honour points earned - sd->status.karma++; // honour points lost + sd->status.karma++; // honour points lost // To-do: Receive exp on certain occasions #endif @@ -7118,7 +7124,7 @@ int pc_dead(struct map_session_data *sd,struct block_list *src) { } if(base_penalty) { - if (battle_config.pk_mode && src && src->type==BL_PC) + if (battle_config.pk_mode && src && src->type==BL_PC) base_penalty*=2; if( sd->status.mod_death != 100 ) base_penalty = base_penalty * sd->status.mod_death / 100; @@ -7140,7 +7146,7 @@ int pc_dead(struct map_session_data *sd,struct block_list *src) { } if(base_penalty) { - if (battle_config.pk_mode && src && src->type==BL_PC) + if (battle_config.pk_mode && src && src->type==BL_PC) base_penalty*=2; if( sd->status.mod_death != 100 ) base_penalty = base_penalty * sd->status.mod_death / 100; @@ -7309,32 +7315,32 @@ int pc_readparam(struct map_session_data* sd,int type) case SP_FAME: val = sd->status.fame; break; case SP_KILLERRID: val = sd->killerrid; break; case SP_KILLEDRID: val = sd->killedrid; break; - case SP_SLOTCHANGE: val = sd->status.slotchange; break; - case SP_CHARRENAME: val = sd->status.rename; break; + case SP_SLOTCHANGE: val = sd->status.slotchange; break; + case SP_CHARRENAME: val = sd->status.rename; break; case SP_MOD_EXP: val = sd->status.mod_exp; break; case SP_MOD_DROP: val = sd->status.mod_drop; break; case SP_MOD_DEATH: val = sd->status.mod_death; break; case SP_CRITICAL: val = sd->battle_status.cri/10; break; case SP_ASPD: val = (2000-sd->battle_status.amotion)/10; break; - case SP_BASE_ATK: val = sd->battle_status.batk; break; - case SP_DEF1: val = sd->battle_status.def; break; - case SP_DEF2: val = sd->battle_status.def2; break; - case SP_MDEF1: val = sd->battle_status.mdef; break; - case SP_MDEF2: val = sd->battle_status.mdef2; break; - case SP_HIT: val = sd->battle_status.hit; break; - case SP_FLEE1: val = sd->battle_status.flee; break; - case SP_FLEE2: val = sd->battle_status.flee2; break; - case SP_DEFELE: val = sd->battle_status.def_ele; break; + case SP_BASE_ATK: val = sd->battle_status.batk; break; + case SP_DEF1: val = sd->battle_status.def; break; + case SP_DEF2: val = sd->battle_status.def2; break; + case SP_MDEF1: val = sd->battle_status.mdef; break; + case SP_MDEF2: val = sd->battle_status.mdef2; break; + case SP_HIT: val = sd->battle_status.hit; break; + case SP_FLEE1: val = sd->battle_status.flee; break; + case SP_FLEE2: val = sd->battle_status.flee2; break; + case SP_DEFELE: val = sd->battle_status.def_ele; break; #ifndef RENEWAL_CAST case SP_VARCASTRATE: #endif case SP_CASTRATE: val = sd->castrate+=val; break; - case SP_MAXHPRATE: val = sd->hprate; break; - case SP_MAXSPRATE: val = sd->sprate; break; - case SP_SPRATE: val = sd->dsprate; break; - case SP_SPEED_RATE: val = sd->bonus.speed_rate; break; + case SP_MAXHPRATE: val = sd->hprate; break; + case SP_MAXSPRATE: val = sd->sprate; break; + case SP_SPRATE: val = sd->dsprate; break; + case SP_SPEED_RATE: val = sd->bonus.speed_rate; break; case SP_SPEED_ADDRATE: val = sd->bonus.speed_add_rate; break; case SP_ASPD_RATE: #ifndef RENEWAL_ASPD @@ -7847,7 +7853,7 @@ int pc_jobchange(struct map_session_data *sd,int job, int upper) for(i=0;i<EQI_MAX;i++) { if(sd->equip_index[i] >= 0) if(!pc->isequip(sd,sd->equip_index[i])) - pc->unequipitem(sd,sd->equip_index[i],2); // unequip invalid item for class + pc->unequipitem(sd,sd->equip_index[i],2); // unequip invalid item for class } //Change look, if disguised, you need to undisguise @@ -7911,7 +7917,7 @@ int pc_jobchange(struct map_session_data *sd,int job, int upper) chrif->buildfamelist(); } else if (sd->status.fame > 0) { //It may be that now they are famous? - switch (sd->class_&MAPID_UPPERMASK) { + switch (sd->class_&MAPID_UPPERMASK) { case MAPID_BLACKSMITH: case MAPID_ALCHEMIST: case MAPID_TAEKWON: @@ -7958,7 +7964,7 @@ int pc_changelook(struct map_session_data *sd,int type,int val) clif->skillinfoblock(sd); return 0; break; - case LOOK_HAIR: //Use the battle_config limits! [Skotlex] + case LOOK_HAIR: //Use the battle_config limits! [Skotlex] val = cap_value(val, MIN_HAIR_STYLE, MAX_HAIR_STYLE); if (sd->status.hair != val) { @@ -7980,7 +7986,7 @@ int pc_changelook(struct map_session_data *sd,int type,int val) case LOOK_HEAD_MID: sd->status.head_mid=val; break; - case LOOK_HAIR_COLOR: //Use the battle_config limits! [Skotlex] + case LOOK_HAIR_COLOR: //Use the battle_config limits! [Skotlex] val = cap_value(val, MIN_HAIR_COLOR, MAX_HAIR_COLOR); if (sd->status.hair_color != val) { @@ -7990,7 +7996,7 @@ int pc_changelook(struct map_session_data *sd,int type,int val) GMI_HAIR_COLOR,&sd->status.hair_color,sizeof(sd->status.hair_color)); } break; - case LOOK_CLOTHES_COLOR: //Use the battle_config limits! [Skotlex] + case LOOK_CLOTHES_COLOR: //Use the battle_config limits! [Skotlex] val = cap_value(val, MIN_CLOTH_COLOR, MAX_CLOTH_COLOR); sd->status.clothes_color=val; @@ -8154,7 +8160,7 @@ int pc_setcart(struct map_session_data *sd,int type) { } /* FIXME: These setter methods are inconsistent in their class/skill checks. - They should be changed so that they all either do or skip the checks.*/ + * They should be changed so that they all either do or skip the checks.*/ /** * Gives/removes a falcon. @@ -8310,7 +8316,7 @@ bool pc_can_talk( struct map_session_data *sd ) { int pc_candrop(struct map_session_data *sd, struct item *item) { if( item && (item->expire_time || (item->bound && !pc_can_give_bound_items(sd))) ) - return 0; + return 0; if( !pc_can_give_items(sd) ) //check if this GM level can drop items return 0; return (itemdb_isdropable(item, pc_get_group_level(sd))); @@ -8847,13 +8853,13 @@ int pc_equipitem(struct map_session_data *sd,int n,int req_pos) ShowInfo("equip %d(%d) %x:%x\n",sd->status.inventory[n].nameid,n,id?id->equip:0,req_pos); if(!pc->isequip(sd,n) || !(pos&req_pos) || sd->status.inventory[n].equip != 0 || sd->status.inventory[n].attribute==1 ) { // [Valaris] // FIXME: pc->isequip: equip level failure uses 2 instead of 0 - clif->equipitemack(sd,n,0,EIA_FAIL); // fail + clif->equipitemack(sd,n,0,EIA_FAIL); // fail return 0; } if (sd->sc.data[SC_BERSERK] || sd->sc.data[SC_NO_SWITCH_EQUIP]) { - clif->equipitemack(sd,n,0,EIA_FAIL); // fail + clif->equipitemack(sd,n,0,EIA_FAIL); // fail return 0; } @@ -8868,7 +8874,7 @@ int pc_equipitem(struct map_session_data *sd,int n,int req_pos) if (pos == EQP_ACC) //User specified both slots.. pos = sd->equip_index[EQI_ACC_R] >= 0 ? EQP_ACC_L : EQP_ACC_R; } else if(pos == EQP_ARMS && id->equip == EQP_HAND_R) { //Dual wield capable weapon. - pos = (req_pos&EQP_ARMS); + pos = (req_pos&EQP_ARMS); if (pos == EQP_ARMS) //User specified both slots, pick one for them. pos = sd->equip_index[EQI_HAND_R] >= 0 ? EQP_HAND_L : EQP_HAND_R; } else if(pos == EQP_SHADOW_ACC) { //Accesories should only go in one of the two, @@ -8876,13 +8882,13 @@ int pc_equipitem(struct map_session_data *sd,int n,int req_pos) if (pos == EQP_SHADOW_ACC) //User specified both slots.. pos = sd->equip_index[EQI_SHADOW_ACC_R] >= 0 ? EQP_SHADOW_ACC_L : EQP_SHADOW_ACC_R; } else if( pos == EQP_SHADOW_ARMS && id->equip == EQP_SHADOW_WEAPON) { //Dual wield capable weapon. - pos = (req_pos&EQP_SHADOW_ARMS); + pos = (req_pos&EQP_SHADOW_ARMS); if (pos == EQP_SHADOW_ARMS) //User specified both slots, pick one for them. pos = sd->equip_index[EQI_SHADOW_WEAPON] >= 0 ? EQP_SHADOW_SHIELD : EQP_SHADOW_WEAPON; } - if (pos&EQP_HAND_R && battle_config.use_weapon_skill_range&BL_PC) - { //Update skill-block range database when weapon range changes. [Skotlex] + if (pos&EQP_HAND_R && battle_config.use_weapon_skill_range&BL_PC) { + //Update skill-block range database when weapon range changes. [Skotlex] i = sd->equip_index[EQI_HAND_R]; if (i < 0 || !sd->inventory_data[i]) //No data, or no weapon equipped flag = 1; @@ -9414,8 +9420,8 @@ int pc_calc_pvprank_timer(int tid, int64 tick, int id, intptr_t data) { /*========================================== * Checking if sd is married * Return: - * partner_id = yes - * 0 = no + * partner_id = yes + * 0 = no *------------------------------------------*/ int pc_ismarried(struct map_session_data *sd) { @@ -9429,8 +9435,8 @@ int pc_ismarried(struct map_session_data *sd) /*========================================== * Marry player sd to player dstsd * Return: - * -1 = fail - * 0 = success + * -1 = fail + * 0 = success *------------------------------------------*/ int pc_marriage(struct map_session_data *sd,struct map_session_data *dstsd) { @@ -9446,8 +9452,8 @@ int pc_marriage(struct map_session_data *sd,struct map_session_data *dstsd) /*========================================== * Divorce sd from its partner * Return: - * -1 = fail - * 0 = success + * -1 = fail + * 0 = success *------------------------------------------*/ int pc_divorce(struct map_session_data *sd) { @@ -10199,11 +10205,11 @@ void pc_read_skill_tree(void) { libconfig->destroy(&skill_tree_conf); - /* lets update all players skill tree */ - iter = mapit_getallusers(); - for( sd = (TBL_PC*)mapit->first(iter); mapit->exists(iter); sd = (TBL_PC*)mapit->next(iter) ) - clif->skillinfoblock(sd); - mapit->free(iter); + /* lets update all players skill tree */ + iter = mapit_getallusers(); + for( sd = (TBL_PC*)mapit->first(iter); mapit->exists(iter); sd = (TBL_PC*)mapit->next(iter) ) + clif->skillinfoblock(sd); + mapit->free(iter); } bool pc_readdb_levelpenalty(char* fields[], int columns, int current) { #if defined(RENEWAL_DROP) || defined(RENEWAL_EXP) @@ -10291,7 +10297,7 @@ int pc_readdb(void) { //Reverse check in case the array has a bunch of trailing zeros... [Skotlex] //The reasoning behind the -2 is this... if the max level is 5, then the array //should look like this: - //0: x, 1: x, 2: x: 3: x 4: 0 <- last valid value is at 3. + //0: x, 1: x, 2: x: 3: x 4: 0 <- last valid value is at 3. while ((ui = pc->max_level[job][type]) >= 2 && pc->exp_table[job][type][ui-2] <= 0) pc->max_level[job][type]--; if (pc->max_level[job][type] < maxlv) { @@ -10303,7 +10309,7 @@ int pc_readdb(void) { pc->exp_table[job][type][ui] = pc->exp_table[job][type][ui-1]; pc->max_level[job][type] = maxlv; } -// ShowDebug("%s - Class %d: %d\n", type?"Job":"Base", job_id, pc->max_level[job][type]); + //ShowDebug("%s - Class %d: %d\n", type?"Job":"Base", job_id, pc->max_level[job][type]); for (i = 1; i < job_count; i++) { job_id = jobs[i]; if (!pcdb_checkid(job_id)) { @@ -10313,7 +10319,7 @@ int pc_readdb(void) { job = pc->class2idx(job_id); memcpy(pc->exp_table[job][type], pc->exp_table[jobs[0]][type], sizeof(pc->exp_table[0][0])); pc->max_level[job][type] = maxlv; -// ShowDebug("%s - Class %d: %u\n", type?"Job":"Base", job_id, pc->max_level[job][type]); + //ShowDebug("%s - Class %d: %u\n", type?"Job":"Base", job_id, pc->max_level[job][type]); } } fclose(fp); diff --git a/src/map/pc.h b/src/map/pc.h index b7a0b099c..aa2bb0e74 100644 --- a/src/map/pc.h +++ b/src/map/pc.h @@ -29,7 +29,7 @@ #define MAX_PC_BONUS 10 #define MAX_PC_SKILL_REQUIRE 5 #define MAX_PC_FEELHATE 3 -#define PVP_CALCRANK_INTERVAL 1000 // PVP calculation interval +#define PVP_CALCRANK_INTERVAL 1000 // PVP calculation interval //Equip indexes constants. (eg: sd->equip_index[EQI_AMMO] returns the index //where the arrows are equipped) @@ -80,7 +80,7 @@ struct weapon_data { } hp_drain[RC_MAX], sp_drain[RC_MAX]; struct { short class_, rate; - } add_dmg[MAX_PC_BONUS]; + } add_dmg[MAX_PC_BONUS]; struct { short flag, rate; unsigned char ele; @@ -145,7 +145,7 @@ struct map_session_data { unsigned int snovice_dead_flag : 1; //Explosion spirits on death: 0 off, 1 used. unsigned int abra_flag : 2; // Abracadabra bugfix by Aru unsigned int autocast : 1; // Autospell flag [Inkfish] - unsigned int autotrade : 2; //By Fantik + unsigned int autotrade : 2; //By Fantik unsigned int showdelay :1; unsigned int showexp :1; unsigned int showzeny :1; @@ -202,13 +202,13 @@ struct map_session_data { unsigned int bonus_coma : 1; } special_state; int login_id1, login_id2; - unsigned short class_; //This is the internal job ID used by the map server to simplify comparisons/queries/etc. [Skotlex] - + unsigned short class_; //This is the internal job ID used by the map server to simplify comparisons/queries/etc. [Skotlex] + /// Groups & permissions int group_id; GroupSettings *group; unsigned int extra_temp_permissions; /* permissions from @addperm */ - + struct mmo_charstatus status; struct item_data* inventory_data[MAX_INVENTORY]; // direct pointers to itemdb entries (faster than doing item_id lookups) short equip_index[EQI_MAX]; @@ -301,7 +301,7 @@ struct map_session_data { } hp_loss, sp_loss, hp_regen, sp_regen; struct { short class_, rate; - } add_def[MAX_PC_BONUS], add_mdef[MAX_PC_BONUS], add_mdmg[MAX_PC_BONUS]; + } add_def[MAX_PC_BONUS], add_mdef[MAX_PC_BONUS], add_mdmg[MAX_PC_BONUS]; struct s_add_drop add_drop[MAX_PC_BONUS]; struct { int nameid; @@ -349,7 +349,7 @@ struct map_session_data { short sp_gain_value, hp_gain_value, magic_sp_gain_value, magic_hp_gain_value; short sp_vanish_rate; short sp_vanish_per, sp_vanish_trigger; - unsigned short unbreakable; // chance to prevent ANY equipment breaking [celest] + unsigned short unbreakable; // chance to prevent ANY equipment breaking [celest] unsigned short unbreakable_equip; //100% break resistance on certain equipment unsigned short unstripable_equip; int fixcastrate,varcastrate; @@ -362,7 +362,7 @@ struct map_session_data { int matk_rate; int critical_rate,hit_rate,flee_rate,flee2_rate,def_rate,def2_rate,mdef_rate,mdef2_rate; int itemid; - short itemindex; //Used item's index in sd->inventory [Skotlex] + short itemindex; //Used item's index in sd->inventory [Skotlex] short catch_target_class; // pet catching, stores a pet class to catch (short now) [zzo] short spiritball, spiritball_old; int spirit_timer[MAX_SPIRITBALL]; @@ -400,7 +400,7 @@ struct map_session_data { struct s_search_store_info searchstore; struct pet_data *pd; - struct homun_data *hd; // [blackhole89] + struct homun_data *hd; // [blackhole89] struct mercenary_data *md; struct elemental_data *ed; @@ -481,14 +481,14 @@ struct map_session_data { struct pc_combos *combos; unsigned char combo_count; - + /** * Guarantees your friend request is legit (for bugreport:4629) **/ int friend_req; int shadowform_id; - + /* [Ind/Hercules] */ struct hChSysCh **channels; unsigned char channel_count; @@ -497,14 +497,14 @@ struct map_session_data { unsigned char fontcolor; unsigned int fontcolor_tid; int64 hchsysch_tick; - + /* [Ind/Hercules] */ struct sc_display_entry **sc_display; unsigned char sc_display_count; - + short *instance; unsigned short instances; - + /* Possible Thanks to Yommy~! */ struct { unsigned int ready : 1;/* did he accept the 'match is about to start, enter' dialog? */ @@ -515,26 +515,26 @@ struct map_session_data { int *queues; unsigned int queues_count; - + /* Made Possible Thanks to Yommy~! */ unsigned int cryptKey; ///< Packet obfuscation key to be used for the next received packet unsigned short (*parse_cmd_func)(int fd, struct map_session_data *sd); ///< parse_cmd_func used by this player - + unsigned char delayed_damage;//ref. counter bugreport:7307 [Ind/Hercules] - + /* HPM Custom Struct */ struct HPluginData **hdata; unsigned int hdatac; - + /* expiration_time timer id */ int expiration_tid; time_t expiration_time; - + /* */ struct { unsigned int second,third; } sktree; - + /** * Account/Char variables & array control of those variables **/ @@ -542,14 +542,14 @@ struct map_session_data { unsigned char vars_received;/* char loading is only complete when you get it all. */ bool vars_ok; bool vars_dirty; - + struct { short stage; short prizeIdx; short prizeStage; bool claimPrize; } roulette; - + // temporary debugging of bug #3504 const char* delunit_prevfile; int delunit_prevline; @@ -622,13 +622,13 @@ struct map_session_data { //JOB_NOVICE isn't checked for class_ is supposed to be unsigned #define pcdb_checkid_sub(class_) \ ( \ - ( (class_) < JOB_MAX_BASIC ) \ -|| ( (class_) >= JOB_NOVICE_HIGH && (class_) <= JOB_DARK_COLLECTOR ) \ -|| ( (class_) >= JOB_RUNE_KNIGHT && (class_) <= JOB_MECHANIC_T2 ) \ -|| ( (class_) >= JOB_BABY_RUNE && (class_) <= JOB_BABY_MECHANIC2 ) \ -|| ( (class_) >= JOB_SUPER_NOVICE_E && (class_) <= JOB_SUPER_BABY_E ) \ -|| ( (class_) >= JOB_KAGEROU && (class_) <= JOB_OBORO ) \ -|| ( (class_) >= JOB_REBELLION && (class_) < JOB_MAX ) \ + ( (class_) < JOB_MAX_BASIC ) \ + || ( (class_) >= JOB_NOVICE_HIGH && (class_) <= JOB_DARK_COLLECTOR ) \ + || ( (class_) >= JOB_RUNE_KNIGHT && (class_) <= JOB_MECHANIC_T2 ) \ + || ( (class_) >= JOB_BABY_RUNE && (class_) <= JOB_BABY_MECHANIC2 ) \ + || ( (class_) >= JOB_SUPER_NOVICE_E && (class_) <= JOB_SUPER_BABY_E ) \ + || ( (class_) >= JOB_KAGEROU && (class_) <= JOB_OBORO ) \ + || ( (class_) >= JOB_REBELLION && (class_) < JOB_MAX ) \ ) #define pcdb_checkid(class_) pcdb_checkid_sub((unsigned int)(class_)) @@ -649,18 +649,16 @@ struct map_session_data { #define pc_rightside_def(sd) ((sd)->battle_status.def2) #define pc_leftside_mdef(sd) ((sd)->battle_status.mdef) #define pc_rightside_mdef(sd) ( (sd)->battle_status.mdef2 - ((sd)->battle_status.vit>>1) ) -#define pc_leftside_matk(sd) \ - (\ - ((sd)->sc.data[SC_MAGICPOWER] && (sd)->sc.data[SC_MAGICPOWER]->val4) \ +#define pc_leftside_matk(sd) (\ + ((sd)->sc.data[SC_MAGICPOWER] && (sd)->sc.data[SC_MAGICPOWER]->val4) \ ?((sd)->battle_status.matk_min * 100 + 50) / ((sd)->sc.data[SC_MAGICPOWER]->val3+100) \ - :(sd)->battle_status.matk_min \ - ) -#define pc_rightside_matk(sd) \ - (\ - ((sd)->sc.data[SC_MAGICPOWER] && (sd)->sc.data[SC_MAGICPOWER]->val4) \ + :(sd)->battle_status.matk_min \ +) +#define pc_rightside_matk(sd) (\ + ((sd)->sc.data[SC_MAGICPOWER] && (sd)->sc.data[SC_MAGICPOWER]->val4) \ ?((sd)->battle_status.matk_max * 100 + 50) / ((sd)->sc.data[SC_MAGICPOWER]->val3+100) \ - :(sd)->battle_status.matk_max \ - ) + :(sd)->battle_status.matk_max \ +) #endif #define pc_get_group_id(sd) ( (sd)->group_id ) @@ -777,12 +775,12 @@ struct pc_interface { /* funcs */ void (*init) (bool minimal); void (*final) (void); - + struct map_session_data* (*get_dummy_sd) (void); int (*class2idx) (int class_); bool (*can_talk) (struct map_session_data *sd); bool (*can_attack) ( struct map_session_data *sd, int target_id ); - + bool (*can_use_command) (struct map_session_data *sd, const char *command); int (*set_group) (struct map_session_data *sd, int group_id); bool (*should_log_commands) (struct map_session_data *sd); @@ -794,25 +792,25 @@ struct pc_interface { bool (*authok) (struct map_session_data *sd, int login_id2, time_t expiration_time, int group_id, struct mmo_charstatus *st, bool changing_mapservers); void (*authfail) (struct map_session_data *sd); int (*reg_received) (struct map_session_data *sd); - + int (*isequip) (struct map_session_data *sd,int n); int (*equippoint) (struct map_session_data *sd,int n); int (*setinventorydata) (struct map_session_data *sd); - + int (*checkskill) (struct map_session_data *sd,uint16 skill_id); int (*checkskill2) (struct map_session_data *sd,uint16 index); int (*checkallowskill) (struct map_session_data *sd); int (*checkequip) (struct map_session_data *sd,int pos); - + int (*calc_skilltree) (struct map_session_data *sd); int (*calc_skilltree_normalize_job) (struct map_session_data *sd); int (*clean_skilltree) (struct map_session_data *sd); - + int (*setpos) (struct map_session_data* sd, unsigned short map_index, int x, int y, clr_type clrtype); int (*setsavepoint) (struct map_session_data *sd, short map_index, int x, int y); int (*randomwarp) (struct map_session_data *sd,clr_type type); int (*memo) (struct map_session_data* sd, int pos); - + int (*checkadditem) (struct map_session_data *sd,int nameid,int amount); int (*inventoryblank) (struct map_session_data *sd); int (*search_inventory) (struct map_session_data *sd,int item_id); @@ -824,45 +822,45 @@ struct pc_interface { // Special Shop System int (*paycash) (struct map_session_data *sd, int price, int points); int (*getcash) (struct map_session_data *sd, int cash, int points); - + int (*cart_additem) (struct map_session_data *sd,struct item *item_data,int amount,e_log_pick_type log_type); int (*cart_delitem) (struct map_session_data *sd,int n,int amount,int type,e_log_pick_type log_type); int (*putitemtocart) (struct map_session_data *sd,int idx,int amount); int (*getitemfromcart) (struct map_session_data *sd,int idx,int amount); int (*cartitem_amount) (struct map_session_data *sd,int idx,int amount); - + int (*takeitem) (struct map_session_data *sd,struct flooritem_data *fitem); int (*dropitem) (struct map_session_data *sd,int n,int amount); - + bool (*isequipped) (struct map_session_data *sd, int nameid); bool (*can_Adopt) (struct map_session_data *p1_sd, struct map_session_data *p2_sd, struct map_session_data *b_sd); bool (*adoption) (struct map_session_data *p1_sd, struct map_session_data *p2_sd, struct map_session_data *b_sd); - + int (*updateweightstatus) (struct map_session_data *sd); - + int (*addautobonus) (struct s_autobonus *bonus,char max,const char *bonus_script,short rate,unsigned int dur,short atk_type,const char *o_script,unsigned short pos,bool onskill); int (*exeautobonus) (struct map_session_data* sd,struct s_autobonus *bonus); int (*endautobonus) (int tid, int64 tick, int id, intptr_t data); int (*delautobonus) (struct map_session_data* sd,struct s_autobonus *bonus,char max,bool restore); - + int (*bonus) (struct map_session_data *sd,int type,int val); int (*bonus2) (struct map_session_data *sd,int type,int type2,int val); int (*bonus3) (struct map_session_data *sd,int type,int type2,int type3,int val); int (*bonus4) (struct map_session_data *sd,int type,int type2,int type3,int type4,int val); int (*bonus5) (struct map_session_data *sd,int type,int type2,int type3,int type4,int type5,int val); int (*skill) (struct map_session_data *sd, int id, int level, int flag); - + int (*insert_card) (struct map_session_data *sd,int idx_card,int idx_equip); - + int (*steal_item) (struct map_session_data *sd,struct block_list *bl, uint16 skill_lv); int (*steal_coin) (struct map_session_data *sd,struct block_list *bl); - + int (*modifybuyvalue) (struct map_session_data *sd,int orig_value); int (*modifysellvalue) (struct map_session_data *sd,int orig_value); - + int (*follow) (struct map_session_data *sd, int target_id); // [MouseJstr] int (*stop_following) (struct map_session_data *sd); - + unsigned int (*maxbaselv) (struct map_session_data *sd); unsigned int (*maxjoblv) (struct map_session_data *sd); int (*checkbaselevelup) (struct map_session_data *sd); @@ -888,11 +886,11 @@ struct pc_interface { int (*unequipitem) (struct map_session_data *sd,int n,int flag); int (*checkitem) (struct map_session_data *sd); int (*useitem) (struct map_session_data *sd,int n); - + int (*skillatk_bonus) (struct map_session_data *sd, uint16 skill_id); int (*skillheal_bonus) (struct map_session_data *sd, uint16 skill_id); int (*skillheal2_bonus) (struct map_session_data *sd, uint16 skill_id); - + void (*damage) (struct map_session_data *sd,struct block_list *src,unsigned int hp, unsigned int sp); int (*dead) (struct map_session_data *sd,struct block_list *src); void (*revive) (struct map_session_data *sd,unsigned int hp, unsigned int sp); @@ -909,7 +907,7 @@ struct pc_interface { void (*setridingwug) (struct map_session_data *sd, bool flag); int (*changelook) (struct map_session_data *sd,int type,int val); int (*equiplookall) (struct map_session_data *sd); - + int (*readparam) (struct map_session_data *sd,int type); int (*setparam) (struct map_session_data *sd,int type,int val); int (*readreg) (struct map_session_data *sd, int64 reg); @@ -920,15 +918,15 @@ struct pc_interface { int (*setregistry) (struct map_session_data *sd, int64 reg, int val); char * (*readregistry_str) (struct map_session_data *sd, int64 reg); int (*setregistry_str) (struct map_session_data *sd, int64 reg, const char *val); - + int (*addeventtimer) (struct map_session_data *sd,int tick,const char *name); int (*deleventtimer) (struct map_session_data *sd,const char *name); int (*cleareventtimer) (struct map_session_data *sd); int (*addeventtimercount) (struct map_session_data *sd,const char *name,int tick); - + int (*calc_pvprank) (struct map_session_data *sd); int (*calc_pvprank_timer) (int tid, int64 tick, int id, intptr_t data); - + int (*ismarried) (struct map_session_data *sd); int (*marriage) (struct map_session_data *sd,struct map_session_data *dstsd); int (*divorce) (struct map_session_data *sd); @@ -936,27 +934,27 @@ struct pc_interface { struct map_session_data * (*get_father) (struct map_session_data *sd); struct map_session_data * (*get_mother) (struct map_session_data *sd); struct map_session_data * (*get_child) (struct map_session_data *sd); - + void (*bleeding) (struct map_session_data *sd, unsigned int diff_tick); void (*regen) (struct map_session_data *sd, unsigned int diff_tick); - + void (*setstand) (struct map_session_data *sd); int (*candrop) (struct map_session_data *sd,struct item *item); - + int (*jobid2mapid) (unsigned short b_class); // Skotlex int (*mapid2jobid) (unsigned short class_, int sex); // Skotlex - + const char * (*job_name) (int class_); - + void (*setinvincibletimer) (struct map_session_data* sd, int val); void (*delinvincibletimer) (struct map_session_data* sd); - + int (*addspiritball) (struct map_session_data *sd,int interval,int max); int (*delspiritball) (struct map_session_data *sd,int count,int type); void (*addfame) (struct map_session_data *sd,int count); unsigned char (*famerank) (int char_id, int job); int (*set_hate_mob) (struct map_session_data *sd, int pos, struct block_list *bl); - + int (*readdb) (void); int (*map_day_timer) (int tid, int64 tick, int id, intptr_t data); // by [yor] int (*map_night_timer) (int tid, int64 tick, int id, intptr_t data); // by [yor] @@ -964,25 +962,25 @@ struct pc_interface { void (*inventory_rentals) (struct map_session_data *sd); int (*inventory_rental_clear) (struct map_session_data *sd); void (*inventory_rental_add) (struct map_session_data *sd, int seconds); - + int (*disguise) (struct map_session_data *sd, int class_); bool (*isautolooting) (struct map_session_data *sd, int nameid); - + void (*overheat) (struct map_session_data *sd, int val); - + int (*banding) (struct map_session_data *sd, uint16 skill_lv); - + void (*itemcd_do) (struct map_session_data *sd, bool load); - + int (*load_combo) (struct map_session_data *sd); - + int (*add_charm) (struct map_session_data *sd,int interval,int max,int type); int (*del_charm) (struct map_session_data *sd,int count,int type); - + void (*baselevelchanged) (struct map_session_data *sd); int (*level_penalty_mod) (int diff, unsigned char race, unsigned short mode, int type); int (*calc_skillpoint) (struct map_session_data* sd); - + int (*invincible_timer) (int tid, int64 tick, int id, intptr_t data); int (*spiritball_timer) (int tid, int64 tick, int id, intptr_t data); int (*check_banding) ( struct block_list *bl, va_list ap ); @@ -1010,19 +1008,19 @@ struct pc_interface { int (*checkcombo) (struct map_session_data *sd, struct item_data *data ); int (*calcweapontype) (struct map_session_data *sd); int (*removecombo) (struct map_session_data *sd, struct item_data *data ); - + void (*bank_deposit) (struct map_session_data *sd, int money); void (*bank_withdraw) (struct map_session_data *sd, int money); - + void (*rental_expire) (struct map_session_data *sd, int i); void (*scdata_received) (struct map_session_data *sd); - + void (*bound_clear) (struct map_session_data *sd, enum e_item_bound_type type); - + int (*expiration_timer) (int tid, int64 tick, int id, intptr_t data); int (*global_expiration_timer) (int tid, int64 tick, int id, intptr_t data); void (*expire_check) (struct map_session_data *sd); - + /** * Autotrade persistency [Ind/Hercules <3] **/ diff --git a/src/map/pet.c b/src/map/pet.c index d90727b97..0378ea0c3 100644 --- a/src/map/pet.c +++ b/src/map/pet.c @@ -510,7 +510,7 @@ int pet_catch_process2(struct map_session_data* sd, int target_id) { if (sd->catch_target_class == 0 && !(md->status.mode&MD_BOSS)) sd->catch_target_class = md->class_; if(i < 0 || sd->catch_target_class != md->class_) { - clif->emotion(&md->bl, E_AG); //mob will do /ag if wrong lure is used on them. + clif->emotion(&md->bl, E_AG); //mob will do /ag if wrong lure is used on them. clif->pet_roulette(sd,0); sd->catch_target_class = -1; return 1; @@ -911,17 +911,18 @@ int pet_ai_sub_hard(struct pet_data *pd, struct map_session_data *sd, int64 tick if (target->type != BL_ITEM) { //enemy targetted - if(!battle->check_range(&pd->bl,target,pd->status.rhw.range)) - { //Chase + if(!battle->check_range(&pd->bl,target,pd->status.rhw.range)) { + //Chase if(!unit->walktobl(&pd->bl, target, pd->status.rhw.range, 2)) pet->unlocktarget(pd); //Unreachable target. return 0; } //Continuous attack. unit->attack(&pd->bl, pd->target_id, 1); - } else { //Item Targeted, attempt loot - if (!check_distance_bl(&pd->bl, target, 1)) - { //Out of range + } else { + //Item Targeted, attempt loot + if (!check_distance_bl(&pd->bl, target, 1)) { + //Out of range if(!unit->walktobl(&pd->bl, target, 1, 1)) //Unreachable target. pet->unlocktarget(pd); return 0; @@ -1036,7 +1037,7 @@ int pet_lootitem_drop(struct pet_data *pd,struct map_session_data *sd) memset(pd->loot->item,0,pd->loot->max * sizeof(struct item)); pd->loot->count = 0; pd->loot->weight = 0; - pd->ud.canact_tick = timer->gettick()+10000; //prevent picked up during 10*1000ms + pd->ud.canact_tick = timer->gettick()+10000; //prevent picked up during 10*1000ms if (dlist->item) timer->add(timer->gettick()+540,pet->delay_item_drop,0,(intptr_t)dlist); @@ -1103,8 +1104,8 @@ int pet_recovery_timer(int tid, int64 tick, int id, intptr_t data) { return 0; } - if(sd->sc.data[pd->recovery->type]) - { //Display a heal animation? + if (sd->sc.data[pd->recovery->type]) { + //Display a heal animation? //Detoxify is chosen for now. clif->skill_nodamage(&pd->bl,&sd->bl,TF_DETOXIFY,1,1); status_change_end(&sd->bl, pd->recovery->type, INVALID_TIMER); @@ -1170,8 +1171,8 @@ int pet_skill_support_timer(int tid, int64 tick, int id, intptr_t data) { st = status->get_status_data(&sd->bl); - if (DIFF_TICK(pd->ud.canact_tick, tick) > 0) - { //Wait until the pet can act again. + if (DIFF_TICK(pd->ud.canact_tick, tick) > 0) { + //Wait until the pet can act again. pd->s_skill->timer=timer->add(pd->ud.canact_tick,pet->skill_support_timer,sd->bl.id,0); return 0; } diff --git a/src/map/pet.h b/src/map/pet.h index 5c890ef85..286109126 100644 --- a/src/map/pet.h +++ b/src/map/pet.h @@ -41,16 +41,16 @@ struct s_pet_db { enum { PET_CLASS,PET_CATCH,PET_EGG,PET_EQUIP,PET_FOOD }; struct pet_recovery { //Stat recovery - enum sc_type type; //Status Change id - unsigned short delay; //How long before curing (secs). + enum sc_type type; ///< Status Change id + unsigned short delay; ///< How long before curing (secs). int timer; }; struct pet_bonus { - unsigned short type; //bStr, bVit? - unsigned short val; //Qty + unsigned short type; //bStr, bVit? + unsigned short val; //Qty unsigned short duration; //in secs - unsigned short delay; //Time before RENEWAL_CAST (secs) + unsigned short delay; //Time before RENEWAL_CAST (secs) int timer; }; @@ -93,7 +93,7 @@ struct pet_data { } state; int move_fail_count; int64 next_walktime, last_thinktime; - short rate_fix; //Support rate as modified by intimacy (1000 = 100%) [Skotlex] + short rate_fix; //Support rate as modified by intimacy (1000 = 100%) [Skotlex] struct pet_recovery* recovery; struct pet_bonus* bonus; diff --git a/src/map/script.h b/src/map/script.h index 90804dd5b..e28abf970 100644 --- a/src/map/script.h +++ b/src/map/script.h @@ -187,7 +187,7 @@ typedef enum c_op { C_USERFUNC, // internal script function C_USERFUNC_POS, // internal script function label C_REF, // the next call to c_op2 should push back a ref to the left operand - + // operators C_OP3, // a ? b : c C_LOR, // a || b @@ -265,7 +265,7 @@ enum e_arglist { *------------------------------------------*/ enum { - MF_NOMEMO, //0 + MF_NOMEMO, //0 MF_NOTELEPORT, MF_NOSAVE, MF_NOBRANCH, @@ -275,7 +275,7 @@ enum { MF_PVP_NOPARTY, MF_PVP_NOGUILD, MF_GVG, - MF_GVG_NOPARTY, //10 + MF_GVG_NOPARTY, //10 MF_NOTRADE, MF_NOSKILL, MF_NOWARP, @@ -293,7 +293,7 @@ enum { MF_GVG_DUNGEON, MF_NIGHTENABLED, MF_NOBASEEXP, - MF_NOJOBEXP, //30 + MF_NOJOBEXP, //30 MF_NOMOBLOOT, MF_NOMVPLOOT, MF_NORETURN, @@ -303,7 +303,7 @@ enum { MF_NOCOMMAND, MF_NODROP, MF_JEXP, - MF_BEXP, //40 + MF_BEXP, //40 MF_NOVENDING, MF_LOADEVENT, MF_NOCHAT, @@ -313,7 +313,7 @@ enum { MF_AUTOTRADE, MF_ALLOWKS, MF_MONSTER_NOTELEPORT, - MF_PVP_NOCALCRANK, //50 + MF_PVP_NOCALCRANK, //50 MF_BATTLEGROUND, MF_RESET, MF_NOTOMB, @@ -460,9 +460,9 @@ struct script_syntax_data { int count; int flag; struct linkdb_node *case_label; - } curly[256]; // Information right parenthesis - int curly_count; // The number of right brackets - int index; // Number of the syntax used in the script + } curly[256]; // Information right parenthesis + int curly_count; // The number of right brackets + int index; // Number of the syntax used in the script }; struct casecheck_data { diff --git a/src/map/searchstore.c b/src/map/searchstore.c index 72b28aacd..782c14987 100644 --- a/src/map/searchstore.c +++ b/src/map/searchstore.c @@ -333,7 +333,7 @@ bool searchstore_result(struct map_session_data* sd, unsigned int store_id, int void searchstore_defaults (void) { searchstore = &searchstore_s; - + searchstore->open = searchstore_open; searchstore->query = searchstore_query; searchstore->querynext = searchstore_querynext; @@ -344,5 +344,5 @@ void searchstore_defaults (void) { searchstore->queryremote = searchstore_queryremote; searchstore->clearremote = searchstore_clearremote; searchstore->result = searchstore_result; - + } diff --git a/src/map/skill.c b/src/map/skill.c index c9e68531d..169f4bcb9 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -45,7 +45,7 @@ #include "../common/timer.h" #include "../common/utils.h" -#define SKILLUNITTIMER_INTERVAL 100 +#define SKILLUNITTIMER_INTERVAL 100 // ranges reserved for mapping skill ids to skilldb offsets #define HM_SKILLRANGEMIN 750 @@ -145,49 +145,49 @@ void skill_chk(uint16* skill_id) { } while(0) #define skill_glv(lv) min((lv),MAX_SKILL_LEVEL-1) // Skill DB -int skill_get_hit( uint16 skill_id ) { skill_get (skill->db[skill_id].hit, skill_id); } -int skill_get_inf( uint16 skill_id ) { skill_get (skill->db[skill_id].inf, skill_id); } -int skill_get_ele( uint16 skill_id , uint16 skill_lv ) { skill_get (skill->db[skill_id].element[skill_glv(skill_lv-1)], skill_id); } -int skill_get_nk( uint16 skill_id ) { skill_get (skill->db[skill_id].nk, skill_id); } -int skill_get_max( uint16 skill_id ) { skill_get (skill->db[skill_id].max, skill_id); } -int skill_get_range( uint16 skill_id , uint16 skill_lv ) { skill_get2 (skill->db[skill_id].range[skill_glv(skill_lv-1)], skill_id, skill_lv); } -int skill_get_splash( uint16 skill_id , uint16 skill_lv ) { skill_get2 ( (skill->db[skill_id].splash[skill_glv(skill_lv-1)]>=0?skill->db[skill_id].splash[skill_glv(skill_lv-1)]:AREA_SIZE), skill_id, skill_lv); } -int skill_get_hp( uint16 skill_id ,uint16 skill_lv ) { skill_get2 (skill->db[skill_id].hp[skill_glv(skill_lv-1)], skill_id, skill_lv); } -int skill_get_sp( uint16 skill_id ,uint16 skill_lv ) { skill_get2 (skill->db[skill_id].sp[skill_glv(skill_lv-1)], skill_id, skill_lv); } -int skill_get_hp_rate(uint16 skill_id, uint16 skill_lv ) { skill_get2 (skill->db[skill_id].hp_rate[skill_glv(skill_lv-1)], skill_id, skill_lv); } -int skill_get_sp_rate(uint16 skill_id, uint16 skill_lv ) { skill_get2 (skill->db[skill_id].sp_rate[skill_glv(skill_lv-1)], skill_id, skill_lv); } -int skill_get_state(uint16 skill_id) { skill_get (skill->db[skill_id].state, skill_id); } -int skill_get_spiritball(uint16 skill_id, uint16 skill_lv) { skill_get2 (skill->db[skill_id].spiritball[skill_glv(skill_lv-1)], skill_id, skill_lv); } -int skill_get_itemid(uint16 skill_id, int idx) { skill_get (skill->db[skill_id].itemid[idx], skill_id); } -int skill_get_itemqty(uint16 skill_id, int idx) { skill_get (skill->db[skill_id].amount[idx], skill_id); } -int skill_get_zeny( uint16 skill_id ,uint16 skill_lv ) { skill_get2 (skill->db[skill_id].zeny[skill_glv(skill_lv-1)], skill_id, skill_lv); } -int skill_get_num( uint16 skill_id ,uint16 skill_lv ) { skill_get2 (skill->db[skill_id].num[skill_glv(skill_lv-1)], skill_id, skill_lv); } -int skill_get_cast( uint16 skill_id ,uint16 skill_lv ) { skill_get2 (skill->db[skill_id].cast[skill_glv(skill_lv-1)], skill_id, skill_lv); } -int skill_get_delay( uint16 skill_id ,uint16 skill_lv ) { skill_get2 (skill->db[skill_id].delay[skill_glv(skill_lv-1)], skill_id, skill_lv); } -int skill_get_walkdelay( uint16 skill_id ,uint16 skill_lv ) { skill_get2 (skill->db[skill_id].walkdelay[skill_glv(skill_lv-1)], skill_id, skill_lv); } -int skill_get_time( uint16 skill_id ,uint16 skill_lv ) { skill_get2 (skill->db[skill_id].upkeep_time[skill_glv(skill_lv-1)], skill_id, skill_lv); } -int skill_get_time2( uint16 skill_id ,uint16 skill_lv ) { skill_get2 (skill->db[skill_id].upkeep_time2[skill_glv(skill_lv-1)], skill_id, skill_lv); } -int skill_get_castdef( uint16 skill_id ) { skill_get (skill->db[skill_id].cast_def_rate, skill_id); } -int skill_get_weapontype( uint16 skill_id ) { skill_get (skill->db[skill_id].weapon, skill_id); } -int skill_get_ammotype( uint16 skill_id ) { skill_get (skill->db[skill_id].ammo, skill_id); } -int skill_get_ammo_qty( uint16 skill_id, uint16 skill_lv ) { skill_get2 (skill->db[skill_id].ammo_qty[skill_glv(skill_lv-1)], skill_id, skill_lv); } -int skill_get_inf2( uint16 skill_id ) { skill_get (skill->db[skill_id].inf2, skill_id); } -int skill_get_castcancel( uint16 skill_id ) { skill_get (skill->db[skill_id].castcancel, skill_id); } -int skill_get_maxcount( uint16 skill_id ,uint16 skill_lv ) { skill_get2 (skill->db[skill_id].maxcount[skill_glv(skill_lv-1)], skill_id, skill_lv); } -int skill_get_blewcount( uint16 skill_id ,uint16 skill_lv ) { skill_get2 (skill->db[skill_id].blewcount[skill_glv(skill_lv-1)], skill_id, skill_lv); } -int skill_get_mhp( uint16 skill_id ,uint16 skill_lv ) { skill_get2 (skill->db[skill_id].mhp[skill_glv(skill_lv-1)], skill_id, skill_lv); } -int skill_get_castnodex( uint16 skill_id ,uint16 skill_lv ) { skill_get2 (skill->db[skill_id].castnodex[skill_glv(skill_lv-1)], skill_id, skill_lv); } -int skill_get_delaynodex( uint16 skill_id ,uint16 skill_lv ){ skill_get2 (skill->db[skill_id].delaynodex[skill_glv(skill_lv-1)], skill_id, skill_lv); } -int skill_get_type( uint16 skill_id ) { skill_get (skill->db[skill_id].skill_type, skill_id); } -int skill_get_unit_id ( uint16 skill_id, int flag ){ skill_get (skill->db[skill_id].unit_id[flag], skill_id); } -int skill_get_unit_interval( uint16 skill_id ) { skill_get (skill->db[skill_id].unit_interval, skill_id); } -int skill_get_unit_range( uint16 skill_id, uint16 skill_lv ) { skill_get2 (skill->db[skill_id].unit_range[skill_glv(skill_lv-1)], skill_id, skill_lv); } -int skill_get_unit_target( uint16 skill_id ) { skill_get (skill->db[skill_id].unit_target&BCT_ALL, skill_id); } -int skill_get_unit_bl_target( uint16 skill_id ) { skill_get (skill->db[skill_id].unit_target&BL_ALL, skill_id); } -int skill_get_unit_flag( uint16 skill_id ) { skill_get (skill->db[skill_id].unit_flag, skill_id); } -int skill_get_unit_layout_type( uint16 skill_id ,uint16 skill_lv ){ skill_get2 (skill->db[skill_id].unit_layout_type[skill_glv(skill_lv-1)], skill_id, skill_lv); } -int skill_get_cooldown( uint16 skill_id, uint16 skill_lv ) { skill_get2 (skill->db[skill_id].cooldown[skill_glv(skill_lv-1)], skill_id, skill_lv); } -int skill_get_fixed_cast( uint16 skill_id ,uint16 skill_lv ) { +int skill_get_hit( uint16 skill_id ) { skill_get (skill->db[skill_id].hit, skill_id); } +int skill_get_inf( uint16 skill_id ) { skill_get (skill->db[skill_id].inf, skill_id); } +int skill_get_ele( uint16 skill_id , uint16 skill_lv ) { skill_get (skill->db[skill_id].element[skill_glv(skill_lv-1)], skill_id); } +int skill_get_nk( uint16 skill_id ) { skill_get (skill->db[skill_id].nk, skill_id); } +int skill_get_max( uint16 skill_id ) { skill_get (skill->db[skill_id].max, skill_id); } +int skill_get_range( uint16 skill_id , uint16 skill_lv ) { skill_get2 (skill->db[skill_id].range[skill_glv(skill_lv-1)], skill_id, skill_lv); } +int skill_get_splash( uint16 skill_id , uint16 skill_lv ) { skill_get2 ( (skill->db[skill_id].splash[skill_glv(skill_lv-1)]>=0?skill->db[skill_id].splash[skill_glv(skill_lv-1)]:AREA_SIZE), skill_id, skill_lv); } +int skill_get_hp( uint16 skill_id ,uint16 skill_lv ) { skill_get2 (skill->db[skill_id].hp[skill_glv(skill_lv-1)], skill_id, skill_lv); } +int skill_get_sp( uint16 skill_id ,uint16 skill_lv ) { skill_get2 (skill->db[skill_id].sp[skill_glv(skill_lv-1)], skill_id, skill_lv); } +int skill_get_hp_rate(uint16 skill_id, uint16 skill_lv ) { skill_get2 (skill->db[skill_id].hp_rate[skill_glv(skill_lv-1)], skill_id, skill_lv); } +int skill_get_sp_rate(uint16 skill_id, uint16 skill_lv ) { skill_get2 (skill->db[skill_id].sp_rate[skill_glv(skill_lv-1)], skill_id, skill_lv); } +int skill_get_state(uint16 skill_id) { skill_get (skill->db[skill_id].state, skill_id); } +int skill_get_spiritball(uint16 skill_id, uint16 skill_lv) { skill_get2 (skill->db[skill_id].spiritball[skill_glv(skill_lv-1)], skill_id, skill_lv); } +int skill_get_itemid(uint16 skill_id, int idx) { skill_get (skill->db[skill_id].itemid[idx], skill_id); } +int skill_get_itemqty(uint16 skill_id, int idx) { skill_get (skill->db[skill_id].amount[idx], skill_id); } +int skill_get_zeny( uint16 skill_id ,uint16 skill_lv ) { skill_get2 (skill->db[skill_id].zeny[skill_glv(skill_lv-1)], skill_id, skill_lv); } +int skill_get_num( uint16 skill_id ,uint16 skill_lv ) { skill_get2 (skill->db[skill_id].num[skill_glv(skill_lv-1)], skill_id, skill_lv); } +int skill_get_cast( uint16 skill_id ,uint16 skill_lv ) { skill_get2 (skill->db[skill_id].cast[skill_glv(skill_lv-1)], skill_id, skill_lv); } +int skill_get_delay( uint16 skill_id ,uint16 skill_lv ) { skill_get2 (skill->db[skill_id].delay[skill_glv(skill_lv-1)], skill_id, skill_lv); } +int skill_get_walkdelay( uint16 skill_id ,uint16 skill_lv ) { skill_get2 (skill->db[skill_id].walkdelay[skill_glv(skill_lv-1)], skill_id, skill_lv); } +int skill_get_time( uint16 skill_id ,uint16 skill_lv ) { skill_get2 (skill->db[skill_id].upkeep_time[skill_glv(skill_lv-1)], skill_id, skill_lv); } +int skill_get_time2( uint16 skill_id ,uint16 skill_lv ) { skill_get2 (skill->db[skill_id].upkeep_time2[skill_glv(skill_lv-1)], skill_id, skill_lv); } +int skill_get_castdef( uint16 skill_id ) { skill_get (skill->db[skill_id].cast_def_rate, skill_id); } +int skill_get_weapontype( uint16 skill_id ) { skill_get (skill->db[skill_id].weapon, skill_id); } +int skill_get_ammotype( uint16 skill_id ) { skill_get (skill->db[skill_id].ammo, skill_id); } +int skill_get_ammo_qty( uint16 skill_id, uint16 skill_lv ) { skill_get2 (skill->db[skill_id].ammo_qty[skill_glv(skill_lv-1)], skill_id, skill_lv); } +int skill_get_inf2( uint16 skill_id ) { skill_get (skill->db[skill_id].inf2, skill_id); } +int skill_get_castcancel( uint16 skill_id ) { skill_get (skill->db[skill_id].castcancel, skill_id); } +int skill_get_maxcount( uint16 skill_id ,uint16 skill_lv ) { skill_get2 (skill->db[skill_id].maxcount[skill_glv(skill_lv-1)], skill_id, skill_lv); } +int skill_get_blewcount( uint16 skill_id ,uint16 skill_lv ) { skill_get2 (skill->db[skill_id].blewcount[skill_glv(skill_lv-1)], skill_id, skill_lv); } +int skill_get_mhp( uint16 skill_id ,uint16 skill_lv ) { skill_get2 (skill->db[skill_id].mhp[skill_glv(skill_lv-1)], skill_id, skill_lv); } +int skill_get_castnodex( uint16 skill_id ,uint16 skill_lv ) { skill_get2 (skill->db[skill_id].castnodex[skill_glv(skill_lv-1)], skill_id, skill_lv); } +int skill_get_delaynodex( uint16 skill_id ,uint16 skill_lv ){ skill_get2 (skill->db[skill_id].delaynodex[skill_glv(skill_lv-1)], skill_id, skill_lv); } +int skill_get_type( uint16 skill_id ) { skill_get (skill->db[skill_id].skill_type, skill_id); } +int skill_get_unit_id ( uint16 skill_id, int flag ){ skill_get (skill->db[skill_id].unit_id[flag], skill_id); } +int skill_get_unit_interval( uint16 skill_id ) { skill_get (skill->db[skill_id].unit_interval, skill_id); } +int skill_get_unit_range( uint16 skill_id, uint16 skill_lv ) { skill_get2 (skill->db[skill_id].unit_range[skill_glv(skill_lv-1)], skill_id, skill_lv); } +int skill_get_unit_target( uint16 skill_id ) { skill_get (skill->db[skill_id].unit_target&BCT_ALL, skill_id); } +int skill_get_unit_bl_target( uint16 skill_id ) { skill_get (skill->db[skill_id].unit_target&BL_ALL, skill_id); } +int skill_get_unit_flag( uint16 skill_id ) { skill_get (skill->db[skill_id].unit_flag, skill_id); } +int skill_get_unit_layout_type( uint16 skill_id ,uint16 skill_lv ){ skill_get2 (skill->db[skill_id].unit_layout_type[skill_glv(skill_lv-1)], skill_id, skill_lv); } +int skill_get_cooldown( uint16 skill_id, uint16 skill_lv ) { skill_get2 (skill->db[skill_id].cooldown[skill_glv(skill_lv-1)], skill_id, skill_lv); } +int skill_get_fixed_cast( uint16 skill_id ,uint16 skill_lv ) { #ifdef RENEWAL_CAST skill_get2 (skill->db[skill_id].fixed_cast[skill_glv(skill_lv-1)], skill_id, skill_lv); #else @@ -254,8 +254,10 @@ int skill_get_range2 (struct block_list *bl, uint16 skill_id, uint16 skill_lv) { //TODO: Find a way better than hardcoding the list of skills affected by AC_VULTURE switch( skill_id ) { - case AC_SHOWER: case MA_SHOWER: - case AC_DOUBLE: case MA_DOUBLE: + case AC_SHOWER: + case MA_SHOWER: + case AC_DOUBLE: + case MA_DOUBLE: case HT_BLITZBEAT: case AC_CHARGEARROW: case MA_CHARGEARROW: @@ -645,7 +647,7 @@ int skill_additional_effect(struct block_list* src, struct block_list *bl, uint1 nullpo_ret(src); nullpo_ret(bl); - if(skill_id > 0 && !skill_lv) return 0; // don't forget auto attacks! - celest + if(skill_id > 0 && !skill_lv) return 0; // don't forget auto attacks! - celest if( dmg_lv < ATK_BLOCK ) // Don't apply effect if miss. return 0; @@ -805,8 +807,8 @@ int skill_additional_effect(struct block_list* src, struct block_list *bl, uint1 skill_lv = pc->checkskill(sd, TF_POISON); case TF_POISON: case AS_SPLASHER: - if(!sc_start2(src,bl,SC_POISON,(4*skill_lv+10),skill_lv,src->id,skill->get_time2(skill_id,skill_lv)) - && sd && skill_id==TF_POISON + if (!sc_start2(src,bl,SC_POISON,(4*skill_lv+10),skill_lv,src->id,skill->get_time2(skill_id,skill_lv)) + && sd && skill_id==TF_POISON ) clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); break; @@ -823,8 +825,9 @@ int skill_additional_effect(struct block_list* src, struct block_list *bl, uint1 #ifndef RENEWAL case WZ_FROSTNOVA: #endif - if( !sc_start(src,bl,SC_FREEZE,skill_lv*3+35,skill_lv,skill->get_time2(skill_id,skill_lv)) - && sd && skill_id == MG_FROSTDIVER ) + if (!sc_start(src,bl,SC_FREEZE,skill_lv*3+35,skill_lv,skill->get_time2(skill_id,skill_lv)) + && sd && skill_id == MG_FROSTDIVER + ) clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); break; @@ -841,7 +844,7 @@ int skill_additional_effect(struct block_list* src, struct block_list *bl, uint1 #ifdef RENEWAL sc_start(src,bl,SC_FREEZE,65-(5*skill_lv),skill_lv,skill->get_time2(skill_id,skill_lv)); #else - //On third hit, there is a 150% to freeze the target + //On third hit, there is a 150% to freeze the target if(tsc->sg_counter >= 3 && sc_start(src,bl,SC_FREEZE,150,skill_lv,skill->get_time2(skill_id,skill_lv))) tsc->sg_counter = 0; @@ -983,7 +986,7 @@ int skill_additional_effect(struct block_list* src, struct block_list *bl, uint1 case NPC_MENTALBREAKER: { //Based on observations by [Tharis], Mental Breaker should do SP damage - //equal to Matk*skLevel. + //equal to Matk*skLevel. rate = status->get_matk(src, 2); rate*=skill_lv; status_zap(bl, 0, rate); @@ -1045,14 +1048,14 @@ int skill_additional_effect(struct block_list* src, struct block_list *bl, uint1 break; default: sc_start2(src,bl,SC_BLOODING,(5+skill_lv*5),skill_lv,src->id,skill->get_time2(skill_id,3)); - } + } break; case HW_NAPALMVULCAN: sc_start(src,bl,SC_CURSE,5*skill_lv,skill_lv,skill->get_time2(skill_id,skill_lv)); break; - case WS_CARTTERMINATION: // Cart termination + case WS_CARTTERMINATION: sc_start(src,bl,SC_STUN,5*skill_lv,skill_lv,skill->get_time2(skill_id,skill_lv)); break; @@ -1212,7 +1215,7 @@ int skill_additional_effect(struct block_list* src, struct block_list *bl, uint1 break; case LG_HESPERUSLIT: if ( sc && sc->data[SC_BANDING] ) { - if ( sc->data[SC_BANDING]->val2 == 4 ) // 4 banding RGs: Targets will be stunned at 100% chance for 4 ~ 8 seconds, irreducible by STAT. + if ( sc->data[SC_BANDING]->val2 == 4 ) // 4 banding RGs: Targets will be stunned at 100% chance for 4 ~ 8 seconds, irreducible by STAT. status->change_start(src, bl, SC_STUN, 10000, skill_lv, 0, 0, 0, 1000*(4+rand()%4), SCFLAG_FIXEDTICK); else if ( sc->data[SC_BANDING]->val2 == 6 ) // 6 banding RGs: activate Pinpoint Attack Lv1-5 skill->castend_damage_id(src,bl,LG_PINPOINTATTACK,1+rand()%5,tick,0); @@ -1245,7 +1248,7 @@ int skill_additional_effect(struct block_list* src, struct block_list *bl, uint1 else if( dstmd && !is_boss(bl) ) sc_start(src, bl,SC_STOP,100,skill_lv,skill->get_time(skill_id,skill_lv)); break; - case LG_RAYOFGENESIS: // 50% chance to cause Blind on Undead and Demon monsters. + case LG_RAYOFGENESIS: // 50% chance to cause Blind on Undead and Demon monsters. if ( battle->check_undead(tstatus->race, tstatus->def_ele) || tstatus->race == RC_DEMON ) sc_start(src, bl, SC_BLIND,50, skill_lv, skill->get_time(skill_id,skill_lv)); break; @@ -1275,7 +1278,7 @@ int skill_additional_effect(struct block_list* src, struct block_list *bl, uint1 sc_start(src, bl, SC_FEAR, 5 + 5 * skill_lv, skill_lv, skill->get_time(skill_id, skill_lv)); break; case SO_EARTHGRAVE: - sc_start2(src, bl, SC_BLOODING, 5 * skill_lv, skill_lv, src->id, skill->get_time2(skill_id, skill_lv)); // Need official rate. [LimitLine] + sc_start2(src, bl, SC_BLOODING, 5 * skill_lv, skill_lv, src->id, skill->get_time2(skill_id, skill_lv)); // Need official rate. [LimitLine] break; case SO_DIAMONDDUST: rate = 5 + 5 * skill_lv; @@ -1288,7 +1291,8 @@ int skill_additional_effect(struct block_list* src, struct block_list *bl, uint1 break; case GN_SLINGITEM_RANGEMELEEATK: if( sd ) { - switch( sd->itemid ) { // Starting SCs here instead of do it in skill->additional_effect to simplify the code. + switch( sd->itemid ) { + // Starting SCs here instead of do it in skill->additional_effect to simplify the code. case ITEMID_COCONUT_BOMB: sc_start(src, bl, SC_STUN, 100, skill_lv, 5000); // 5 seconds until I get official sc_start(src, bl, SC_BLOODING, 100, skill_lv, 10000); @@ -1308,7 +1312,7 @@ int skill_additional_effect(struct block_list* src, struct block_list *bl, uint1 sc_start(src, bl, SC_STUN, 20 + 10 * skill_lv, skill_lv, skill->get_time2(skill_id, skill_lv)); sc_start2(src, bl, SC_BLOODING, 5 + 5 * skill_lv, skill_lv, src->id,skill->get_time2(skill_id, skill_lv)); break; - case EL_WIND_SLASH: // Non confirmed rate. + case EL_WIND_SLASH: // Non confirmed rate. sc_start2(src, bl, SC_BLOODING, 25, skill_lv, src->id, skill->get_time(skill_id,skill_lv)); break; case EL_STONE_HAMMER: @@ -1361,8 +1365,8 @@ int skill_additional_effect(struct block_list* src, struct block_list *bl, uint1 if (rate) status->change_start(src, bl, SC_COMA, rate, 0, 0, src->id, 0, 0, SCFLAG_NONE); } - if( sd && battle_config.equip_self_break_rate ) - { // Self weapon breaking + if (sd && battle_config.equip_self_break_rate) { + // Self weapon breaking rate = battle_config.equip_natural_break_rate; if( sc ) { @@ -1376,8 +1380,8 @@ int skill_additional_effect(struct block_list* src, struct block_list *bl, uint1 if( rate ) skill->break_equip(src, EQP_WEAPON, rate, BCT_SELF); } - if( battle_config.equip_skill_break_rate && skill_id != WS_CARTTERMINATION && skill_id != ITM_TOMAHAWK ) - { // Cart Termination/Tomahawk won't trigger breaking data. Why? No idea, go ask Gravity. + if (battle_config.equip_skill_break_rate && skill_id != WS_CARTTERMINATION && skill_id != ITM_TOMAHAWK) { + // Cart Termination/Tomahawk won't trigger breaking data. Why? No idea, go ask Gravity. // Target weapon breaking rate = 0; if( sd ) @@ -1565,7 +1569,7 @@ int skill_additional_effect(struct block_list* src, struct block_list *bl, uint1 monster = mob->db(class_); } while ( (monster->status.mode&(MD_BOSS|MD_PLANT) || monster->summonper[0] <= rate) && - (temp++) < 2000); + (temp++) < 2000); if (temp < 2000) mob->class_change(dstmd,class_); } @@ -1680,7 +1684,7 @@ int skill_counter_additional_effect(struct block_list* src, struct block_list *b nullpo_ret(src); nullpo_ret(bl); - if(skill_id > 0 && !skill_lv) return 0; // don't forget auto attacks! [celest] + if(skill_id > 0 && !skill_lv) return 0; // don't forget auto attacks! [celest] sd = BL_CAST(BL_PC, src); dstsd = BL_CAST(BL_PC, bl); @@ -1720,7 +1724,7 @@ int skill_counter_additional_effect(struct block_list* src, struct block_list *b case GS_FULLBUSTER: sc_start(src,src,SC_BLIND,2*skill_lv,skill_lv,skill->get_time2(skill_id,skill_lv)); break; - case HFLI_SBR44: // [orn] + case HFLI_SBR44: // [orn] case HVAN_EXPLOSION: if(src->type == BL_HOM){ TBL_HOM *hd = (TBL_HOM*)src; @@ -1771,7 +1775,7 @@ int skill_counter_additional_effect(struct block_list* src, struct block_list *b if( attack_type&BF_MAGIC ) { sp += sd->bonus.magic_sp_gain_value; hp += sd->bonus.magic_hp_gain_value; - if( skill_id == WZ_WATERBALL ) {// (bugreport:5303) + if( skill_id == WZ_WATERBALL ) {// (bugreport:5303) if( sc->data[SC_SOULLINK] && sc->data[SC_SOULLINK]->val2 == SL_WIZARD && sc->data[SC_SOULLINK]->val3 == WZ_WATERBALL @@ -1895,11 +1899,11 @@ int skill_counter_additional_effect(struct block_list* src, struct block_list *b return 0; } /*========================================================================= - Breaks equipment. On-non players causes the corresponding strip effect. - - rate goes from 0 to 10000 (100.00%) - - flag is a BCT_ flag to indicate which type of adjustment should be used - (BCT_ENEMY/BCT_PARTY/BCT_SELF) are the valid values. ---------------------------------------------------------------------------*/ + * Breaks equipment. On-non players causes the corresponding strip effect. + * - rate goes from 0 to 10000 (100.00%) + * - flag is a BCT_ flag to indicate which type of adjustment should be used + * (BCT_ENEMY/BCT_PARTY/BCT_SELF) are the valid values. + *------------------------------------------------------------------------*/ int skill_break_equip (struct block_list *bl, unsigned short where, int rate, int flag) { const int where_list[4] = {EQP_WEAPON, EQP_ARMOR, EQP_SHIELD, EQP_HELM}; const enum sc_type scatk[4] = {SC_NOEQUIPWEAPON, SC_NOEQUIPARMOR, SC_NOEQUIPSHIELD, SC_NOEQUIPHELM}; @@ -1918,7 +1922,7 @@ int skill_break_equip (struct block_list *bl, unsigned short where, int rate, in rate -= rate*sd->bonus.unbreakable/100; if (where&EQP_WEAPON) { switch (sd->status.weapon) { - case W_FIST: //Bare fists should not break :P + case W_FIST: //Bare fists should not break :P case W_1HAXE: case W_2HAXE: case W_MACE: // Axes and Maces can't be broken [DracoRPG] @@ -2061,13 +2065,13 @@ int skill_blown(struct block_list* src, struct block_list* target, int count, in if (dir == -1) // <optimized>: do the computation here instead of outside dir = map->calc_dir(target, src->x, src->y); // direction from src to target, reversed - if (dir >= 0 && dir < 8) - { // take the reversed 'direction' and reverse it + if (dir >= 0 && dir < 8) { + // take the reversed 'direction' and reverse it dx = -dirx[dir]; dy = -diry[dir]; } - return unit->blown(target, dx, dy, count, flag); // send over the proper flag + return unit->blown(target, dx, dy, count, flag); // send over the proper flag } @@ -2137,7 +2141,7 @@ int skill_attack(int attack_type, struct block_list* src, struct block_list *dsr if(skill_id > 0 && !skill_lv) return 0; - nullpo_ret(src); // Source is the master behind the attack (player/mob/pet) + nullpo_ret(src); // Source is the master behind the attack (player/mob/pet) nullpo_ret(dsrc); // dsrc is the actual originator of the damage, can be the same as src, or a skill casted by src. nullpo_ret(bl); //Target to be attacked. @@ -2354,14 +2358,14 @@ int skill_attack(int attack_type, struct block_list* src, struct block_list *dsr case AC_DOUBLE: // AC_DOUBLE can start the combo with other monster types, but the // monster that's going to be hit by HT_POWER should be RC_BRUTE or RC_INSECT [Panikon] - if( pc->checkskill(sd, HT_POWER) ) - { + if (pc->checkskill(sd, HT_POWER)) { sc_start4(NULL,src,SC_COMBOATTACK,100,HT_POWER,0,1,0,2000); clif->combo_delay(src,2000); } break; case TK_COUNTER: - { //bonus from SG_FRIEND [Komurka] + { + //bonus from SG_FRIEND [Komurka] int level; if(sd->status.party_id>0 && (level = pc->checkskill(sd,SG_FRIEND))) party->skill_check(sd, sd->status.party_id, TK_COUNTER,level); @@ -2388,7 +2392,7 @@ int skill_attack(int attack_type, struct block_list* src, struct block_list *dsr if( pc->checkskill(sd, SR_TIGERCANNON) > 0 || pc->checkskill(sd, SR_GATEOFHELL) > 0 ) combo = 1; break; - } //Switch End + } //Switch End if (combo) { //Possible to chain if ( (combo = DIFF_TICK32(sd->ud.canact_tick, tick)) < 50 ) combo = 50;/* less is a waste. */ sc_start2(NULL,src,SC_COMBOATTACK,100,skill_id,bl->id,combo); @@ -2520,11 +2524,12 @@ int skill_attack(int attack_type, struct block_list* src, struct block_list *dsr map->freeblock_lock(); - if(damage > 0 && dmg.flag&BF_SKILL && tsd - && pc->checkskill(tsd,RG_PLAGIARISM) - && (!sc || !sc->data[SC_PRESERVE]) - && damage < tsd->battle_status.hp) - { //Updated to not be able to copy skills if the blow will kill you. [Skotlex] + if (damage > 0 && dmg.flag&BF_SKILL && tsd + && pc->checkskill(tsd,RG_PLAGIARISM) + && (!sc || !sc->data[SC_PRESERVE]) + && damage < tsd->battle_status.hp + ) { + //Updated to not be able to copy skills if the blow will kill you. [Skotlex] int copy_skill = skill_id, cidx = 0; /** * Copy Referral: dummy skills should point to their source upon copying @@ -2560,7 +2565,7 @@ int skill_attack(int attack_type, struct block_list* src, struct block_list *dsr } cidx = skill->get_index(copy_skill); if ((tsd->status.skill[cidx].id == 0 || tsd->status.skill[cidx].flag == SKILL_FLAG_PLAGIARIZED) && - can_copy(tsd,copy_skill,bl)) // Split all the check into their own function [Aru] + can_copy(tsd,copy_skill,bl)) // Split all the check into their own function [Aru] { int lv, idx = 0; if( sc && sc->data[SC__REPRODUCE] && (lv = sc->data[SC__REPRODUCE]->val1) ) { @@ -2935,7 +2940,8 @@ int skill_check_unit_range2_sub (struct block_list *bl, va_list ap) { int skill_check_unit_range2 (struct block_list *bl, int x, int y, uint16 skill_id, uint16 skill_lv) { int range, type; - switch (skill_id) { // to be expanded later + switch (skill_id) { + // to be expanded later case WZ_ICEWALL: range = 2; break; @@ -3403,7 +3409,7 @@ int skill_activate_reverberation(struct block_list *bl, va_list ap) { int skill_reveal_trap (struct block_list *bl, va_list ap) { TBL_SKILL *su = (TBL_SKILL*)bl; - if (su->alive && su->group && skill->get_inf2(su->group->skill_id)&INF2_TRAP) { //Reveal trap. + if (su->alive && su->group && skill->get_inf2(su->group->skill_id)&INF2_TRAP) { //Reveal trap. //Change look is not good enough, the client ignores it as an actual trap still. [Skotlex] //clif->changetraplook(bl, su->group->unit_id); clif->getareachar_skillunit(&su->bl,su,AREA); @@ -3516,9 +3522,9 @@ int skill_castend_damage_id(struct block_list* src, struct block_list *bl, uint1 case MO_TRIPLEATTACK: case CH_CHAINCRUSH: case CH_TIGERFIST: - case PA_SHIELDCHAIN: // Shield Chain + case PA_SHIELDCHAIN: case PA_SACRIFICE: - case WS_CARTTERMINATION: // Cart Termination + case WS_CARTTERMINATION: case AS_VENOMKNIFE: case HT_PHANTASMIC: case TK_DOWNKICK: @@ -3530,15 +3536,15 @@ int skill_castend_damage_id(struct block_list* src, struct block_list *bl, uint1 case GS_PIERCINGSHOT: case GS_RAPIDSHOWER: case GS_DUST: - case GS_DISARM: // Added disarm. [Reddozen] + case GS_DISARM: case GS_FULLBUSTER: case NJ_SYURIKEN: case NJ_KUNAI: #ifndef RENEWAL case ASC_BREAKER: #endif - case HFLI_MOON: //[orn] - case HFLI_SBR44: //[orn] + case HFLI_MOON: //[orn] + case HFLI_SBR44: //[orn] case NPC_BLEEDING: case NPC_CRITICALWOUND: case NPC_HELLPOWER: @@ -3980,8 +3986,8 @@ int skill_castend_damage_id(struct block_list* src, struct block_list *bl, uint1 skill->castend_nodamage_id); } break; - case CH_PALMSTRIKE: // Palm Strike takes effect 1sec after casting. [Skotlex] - // clif->skill_nodamage(src,bl,skill_id,skill_lv,0); //Can't make this one display the correct attack animation delay :/ + case CH_PALMSTRIKE: // Palm Strike takes effect 1sec after casting. [Skotlex] + //clif->skill_nodamage(src,bl,skill_id,skill_lv,0); //Can't make this one display the correct attack animation delay :/ clif->damage(src,bl,status_get_amotion(src),0,-1,1,4,0); //Display an absorbed damage attack. skill->addtimerskill(src, tick + (1000+status_get_amotion(src)), bl->id, 0, 0, skill_id, skill_lv, BF_WEAPON, flag); break; @@ -4860,7 +4866,7 @@ int skill_castend_id(int tid, int64 tick, int id, intptr_t data) { break; } else if( ud->skill_id == RK_PHANTOMTHRUST && target->type != BL_MOB ) { if( !map_flag_vs(src->m) && battle->check_target(src,target,BCT_PARTY) <= 0 ) - break; // You can use Phantom Thurst on party members in normal maps too. [pakpil] + break; // You can use Phantom Thurst on party members in normal maps too. [pakpil] } if( inf&BCT_ENEMY @@ -4909,8 +4915,8 @@ int skill_castend_id(int tid, int64 tick, int id, intptr_t data) { break; if (ud->state.running && ud->skill_id == TK_JUMPKICK) { - ud->state.running = 0; - status_change_end(src, SC_RUN, INVALID_TIMER); + ud->state.running = 0; + status_change_end(src, SC_RUN, INVALID_TIMER); flag = 1; } @@ -5004,8 +5010,8 @@ int skill_castend_id(int tid, int64 tick, int id, intptr_t data) { skill->consume_requirement(sd,ud->skill_id, ud->skill_lv,1); status->set_sp(src, 0, 0); sc = &sd->sc; - if (sc->count) - { //End states + if (sc->count) { + //End states status_change_end(src, SC_EXPLOSIONSPIRITS, INVALID_TIMER); status_change_end(src, SC_BLADESTOP, INVALID_TIMER); #ifdef RENEWAL @@ -5022,8 +5028,8 @@ int skill_castend_id(int tid, int64 tick, int id, intptr_t data) { if( dir > 2 && dir < 6 ) y = -2; else if( dir == 7 || dir < 2 ) y = 2; else y = 0; - if (unit->movepos(src, src->x+x, src->y+y, 1, 1)) - { //Display movement + animation. + if (unit->movepos(src, src->x+x, src->y+y, 1, 1)) { + //Display movement + animation. clif->slide(src,src->x,src->y); clif->spiritball(src); } @@ -5059,7 +5065,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin int element = 0; enum sc_type type; - if(skill_id > 0 && !skill_lv) return 0; // [Celest] + if(skill_id > 0 && !skill_lv) return 0; // [Celest] nullpo_retr(1, src); nullpo_retr(1, bl); @@ -5115,12 +5121,12 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin //Check for undead skills that convert a no-damage skill into a damage one. [Skotlex] switch (skill_id) { - case HLIF_HEAL: // [orn] + case HLIF_HEAL: // [orn] if (bl->type != BL_HOM) { if (sd) clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0) ; break ; } - case AL_HEAL: + case AL_HEAL: /** * Arch Bishop @@ -5133,7 +5139,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin //Apparently only player casted skills can be offensive like this. if (sd && battle->check_undead(tstatus->race,tstatus->def_ele) && skill_id != AL_INCAGI) { if (battle->check_target(src, bl, BCT_ENEMY) < 1) { - //Offensive heal does not works on non-enemies. [Skotlex] + //Offensive heal does not works on non-enemies. [Skotlex] clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); return 0; } @@ -5225,7 +5231,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin map->freeblock_lock(); switch(skill_id) { - case HLIF_HEAL: // [orn] + case HLIF_HEAL: // [orn] case AL_HEAL: /** * Arch Bishop @@ -5414,7 +5420,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin bl = (struct block_list*)((TBL_PET*)src)->msd; if (!bl) bl = src; unit->skilluse_id(src, bl->id, abra_skill_id, abra_skill_lv); - } else { //Assume offensive skills + } else { //Assume offensive skills int target_id = 0; if (ud->target) target_id = ud->target; @@ -5574,14 +5580,14 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin clif->skill_nodamage(src,bl,skill_id,skill_lv, sc_start4(src,bl,type,100,skill_lv,src->id,0,0,skill->get_time(skill_id,skill_lv))); break; - case SA_FLAMELAUNCHER: // added failure chance and chance to break weapon if turned on [Valaris] + case SA_FLAMELAUNCHER: // added failure chance and chance to break weapon if turned on [Valaris] case SA_FROSTWEAPON: case SA_LIGHTNINGLOADER: case SA_SEISMICWEAPON: if (dstsd) { if(dstsd->status.weapon == W_FIST || (dstsd->sc.count && !dstsd->sc.data[type] && - ( //Allow re-enchanting to lengthen time. [Skotlex] + ( //Allow re-enchanting to lengthen time. [Skotlex] dstsd->sc.data[SC_PROPERTYFIRE] || dstsd->sc.data[SC_PROPERTYWATER] || dstsd->sc.data[SC_PROPERTYWIND] || @@ -5846,7 +5852,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin dstsd->sc.data[SC_PROPERTYGROUND] || dstsd->sc.data[SC_PROPERTYDARK] || dstsd->sc.data[SC_PROPERTYTELEKINESIS] - // dstsd->sc.data[SC_ENCHANTPOISON] //People say you should be able to recast to lengthen the timer. [Skotlex] + //dstsd->sc.data[SC_ENCHANTPOISON] //People say you should be able to recast to lengthen the timer. [Skotlex] ) { clif->skill_nodamage(src,bl,skill_id,skill_lv,0); clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); @@ -6025,12 +6031,15 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin case MO_ABSORBSPIRITS: { int sp = 0; - if (dstsd && dstsd->spiritball && (sd == dstsd || map_flag_vs(src->m) || (sd->duel_group && sd->duel_group == dstsd->duel_group)) && ((dstsd->class_&MAPID_BASEMASK)!=MAPID_GUNSLINGER || (dstsd->class_&MAPID_UPPERMASK)!=MAPID_REBELLION)) - { // split the if for readability, and included gunslingers in the check so that their coins cannot be removed [Reddozen] + if (dstsd && dstsd->spiritball + && (sd == dstsd || map_flag_vs(src->m) || (sd->duel_group && sd->duel_group == dstsd->duel_group)) + && ((dstsd->class_&MAPID_BASEMASK)!=MAPID_GUNSLINGER || (dstsd->class_&MAPID_UPPERMASK)!=MAPID_REBELLION) + ) { + // split the if for readability, and included gunslingers in the check so that their coins cannot be removed [Reddozen] sp = dstsd->spiritball * 7; pc->delspiritball(dstsd,dstsd->spiritball,0); - } else if (dstmd && !(tstatus->mode&MD_BOSS) && rnd() % 100 < 20) - { // check if target is a monster and not a Boss, for the 20% chance to absorb 2 SP per monster's level [Reddozen] + } else if (dstmd && !(tstatus->mode&MD_BOSS) && rnd() % 100 < 20) { + // check if target is a monster and not a Boss, for the 20% chance to absorb 2 SP per monster's level [Reddozen] sp = 2 * dstmd->level; mob->target(dstmd,src,0); } @@ -6137,7 +6146,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin BF_MAGIC, src, src, skill_id, skill_lv, tick, flag, BCT_ENEMY); break; - case HVAN_EXPLOSION: // [orn] + case HVAN_EXPLOSION: // [orn] case NPC_SELFDESTRUCTION: { //Self Destruction hits everyone in range (allies+enemies) @@ -6522,8 +6531,8 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin break; case MC_VENDING: - if(sd) - { //Prevent vending of GMs with unnecessary Level to trade/drop. [Skotlex] + if (sd) { + //Prevent vending of GMs with unnecessary Level to trade/drop. [Skotlex] if ( !pc_can_give_items(sd) ) clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); else { @@ -6747,14 +6756,14 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin sp += sp * i / 100; } } else { - //Maybe replace with potion_hp, but I'm unsure how that works [Playtester] - switch (skill_lv) { - case 1: hp = 45; break; - case 2: hp = 105; break; - case 3: hp = 175; break; - default: hp = 325; break; - } - hp = (hp + rnd()%(skill_lv*20+1)) * (150 + skill_lv*10) / 100; + //Maybe replace with potion_hp, but I'm unsure how that works [Playtester] + switch (skill_lv) { + case 1: hp = 45; break; + case 2: hp = 105; break; + case 3: hp = 175; break; + default: hp = 325; break; + } + hp = (hp + rnd()%(skill_lv*20+1)) * (150 + skill_lv*10) / 100; hp = hp * (100 + (tstatus->vit<<1)) / 100; if( dstsd ) hp = hp * (100 + pc->checkskill(dstsd,SM_RECOVERY)*10) / 100; @@ -6800,7 +6809,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin break; case AM_CP_SHIELD: { int i; - if(dstsd && (i=dstsd->equip_index[EQI_HAND_L])>=0 && dstsd->inventory_data[i] && + if(dstsd && (i=dstsd->equip_index[EQI_HAND_L])>=0 && dstsd->inventory_data[i] && dstsd->inventory_data[i]->type==IT_ARMOR) clif->skill_nodamage(src,bl,skill_id,skill_lv, sc_start(src,bl,type,100,skill_lv,skill->get_time(skill_id,skill_lv))); @@ -6990,8 +6999,8 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin break; //Nothing to cancel. bl_skill_id = ud->skill_id; bl_skill_lv = ud->skill_lv; - if (tstatus->mode & MD_BOSS) - { //Only 10% success chance against bosses. [Skotlex] + if (tstatus->mode & MD_BOSS) { + //Only 10% success chance against bosses. [Skotlex] if (rnd()%100 < 90) { if (sd) clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); @@ -7006,7 +7015,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin status_zap(bl, hp, sp); if (hp && skill_lv >= 5) - hp>>=1; //Recover half damaged HP at level 5 [Skotlex] + hp>>=1; //Recover half damaged HP at level 5 [Skotlex] else hp = 0; @@ -7032,9 +7041,11 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin static const int spellarray[3] = { MG_COLDBOLT,MG_FIREBOLT,MG_LIGHTNINGBOLT }; if(skill_lv >= 10) { spellid = MG_FROSTDIVER; - // if (tsc && tsc->data[SC_SOULLINK] && tsc->data[SC_SOULLINK]->val2 == SA_SAGE) - // maxlv = 10; - // else +#if 0 + if (tsc && tsc->data[SC_SOULLINK] && tsc->data[SC_SOULLINK]->val2 == SA_SAGE) + maxlv = 10; + else +#endif // 0 maxlv = skill_lv - 9; } else if(skill_lv >=8) { @@ -7110,7 +7121,8 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin struct unit_data *ud = unit->bl2ud(bl); if (clif->skill_nodamage(src,bl,skill_id,skill_lv, sc_start(src,bl,type,100,skill_lv,skill_time)) - && ud) { //Disable attacking/acting/moving for skill's duration. + && ud) { + //Disable attacking/acting/moving for skill's duration. ud->attackabletime = ud->canact_tick = ud->canmove_tick = tick + skill_time; @@ -7359,7 +7371,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin struct skill_unit *su=NULL; if((bl->type==BL_SKILL) && (su=(struct skill_unit *)bl) && (su->group) ){ switch(su->group->unit_id){ - case UNT_ANKLESNARE: // ankle snare + case UNT_ANKLESNARE: if (su->group->val2 != 0) // if it is already trapping something don't spring it, // remove trap should be used instead @@ -7514,7 +7526,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin if(dstsd && dstsd->inventory_data[dstsd->equip_index[EQI_HAND_R]]) { iused=true; clif->skill_nodamage(src,bl,skill_id,skill_lv,sc_start(src,bl,SC_PROTECTWEAPON,100,skill_lv,skill->get_time(skill_id,skill_lv))); - } if(dstsd && (i=dstsd->equip_index[EQI_HAND_L])>=0 && dstsd->inventory_data[i] && + } if(dstsd && (i=dstsd->equip_index[EQI_HAND_L])>=0 && dstsd->inventory_data[i] && dstsd->inventory_data[i]->type==IT_ARMOR) { iused=true; clif->skill_nodamage(src,bl,skill_id,skill_lv,sc_start(src,bl,SC_PROTECTSHIELD,100,skill_lv,skill->get_time(skill_id,skill_lv))); @@ -7533,7 +7545,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin } break; - case RG_CLEANER: //AppleGirl + case RG_CLEANER: //AppleGirl clif->skill_nodamage(src,bl,skill_id,skill_lv,1); break; @@ -7571,16 +7583,16 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin clif->specialeffect(bl, 523 + eff, AREA); switch (eff) { - case 0: // heals SP to 0 + case 0: // heals SP to 0 status_percent_damage(src, bl, 0, 100, false); break; - case 1: // matk halved + case 1: // matk halved sc_start(src,bl,SC_INCMATKRATE,100,-50,skill->get_time2(skill_id,skill_lv)); break; - case 2: // all buffs removed + case 2: // all buffs removed status->change_clear_buffs(bl,1); break; - case 3: // 1000 damage, random armor destroyed + case 3: // 1000 damage, random armor destroyed { status_fix_damage(src, bl, 1000, 0); clif->damage(src,bl,0,0,1000,0,0,0); @@ -7590,49 +7602,49 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin } } break; - case 4: // atk halved + case 4: // atk halved sc_start(src,bl,SC_INCATKRATE,100,-50,skill->get_time2(skill_id,skill_lv)); break; - case 5: // 2000HP heal, random teleported + case 5: // 2000HP heal, random teleported status->heal(src, 2000, 0, 0); if( !map_flag_vs(bl->m) ) unit->warp(bl, -1,-1,-1, CLR_TELEPORT); break; - case 6: // random 2 other effects + case 6: // random 2 other effects if (count == -1) count = 3; else count++; //Should not re-trigger this one. break; - case 7: // stop freeze or stoned + case 7: // stop freeze or stoned { enum sc_type sc[] = { SC_STOP, SC_FREEZE, SC_STONE }; sc_start(src,bl,sc[rnd()%3],100,skill_lv,skill->get_time2(skill_id,skill_lv)); } break; - case 8: // curse coma and poison + case 8: // curse coma and poison sc_start(src,bl,SC_COMA,100,skill_lv,skill->get_time2(skill_id,skill_lv)); sc_start(src,bl,SC_CURSE,100,skill_lv,skill->get_time2(skill_id,skill_lv)); sc_start(src,bl,SC_POISON,100,skill_lv,skill->get_time2(skill_id,skill_lv)); break; - case 9: // confusion + case 9: // confusion sc_start(src,bl,SC_CONFUSION,100,skill_lv,skill->get_time2(skill_id,skill_lv)); break; - case 10: // 6666 damage, atk matk halved, cursed + case 10: // 6666 damage, atk matk halved, cursed status_fix_damage(src, bl, 6666, 0); clif->damage(src,bl,0,0,6666,0,0,0); sc_start(src,bl,SC_INCATKRATE,100,-50,skill->get_time2(skill_id,skill_lv)); sc_start(src,bl,SC_INCMATKRATE,100,-50,skill->get_time2(skill_id,skill_lv)); sc_start(src,bl,SC_CURSE,skill_lv,100,skill->get_time2(skill_id,skill_lv)); break; - case 11: // 4444 damage + case 11: // 4444 damage status_fix_damage(src, bl, 4444, 0); clif->damage(src,bl,0,0,4444,0,0,0); break; - case 12: // stun + case 12: // stun sc_start(src,bl,SC_STUN,100,skill_lv,5000); break; - case 13: // atk,matk,hit,flee,def reduced + case 13: // atk,matk,hit,flee,def reduced sc_start(src,bl,SC_INCATKRATE,100,-20,skill->get_time2(skill_id,skill_lv)); sc_start(src,bl,SC_INCMATKRATE,100,-20,skill->get_time2(skill_id,skill_lv)); sc_start(src,bl,SC_INCHITRATE,100,-20,skill->get_time2(skill_id,skill_lv)); @@ -7668,8 +7680,8 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); break; } - if (skill_id == SL_SUPERNOVICE && dstsd && dstsd->die_counter && !(rnd()%100)) - { //Erase death count 1% of the casts + if (skill_id == SL_SUPERNOVICE && dstsd && dstsd->die_counter && !(rnd()%100)) { + //Erase death count 1% of the casts dstsd->die_counter = 0; pc_setglobalreg(dstsd,script->add_str("PC_DIE_COUNTER"), 0); clif->specialeffect(bl, 0x152, AREA); @@ -7817,7 +7829,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin } break; - case AM_CALLHOMUN: // [orn] + case AM_CALLHOMUN: // [orn] if( sd ) { if (homun->call(sd)) clif->skill_nodamage(src, bl, skill_id, skill_lv, 1); @@ -7835,7 +7847,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin } break; - case HAMI_CASTLE: // [orn] + case HAMI_CASTLE: // [orn] if(rnd()%100 < 20*skill_lv && src != bl) { int x,y; @@ -7864,7 +7876,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin else if (sd) clif->skill_fail(sd, skill_id, USESKILL_FAIL_LEVEL, 0); break; - case HVAN_CHAOTIC: // [orn] + case HVAN_CHAOTIC: // [orn] { static const int per[5][2]={{20,50},{50,60},{25,75},{60,64},{34,67}}; int r = rnd()%100; @@ -8814,15 +8826,24 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin if (!tsc->data[i]) continue; switch(i){ - case SC_POISON: case SC_BLIND: - case SC_FREEZE: case SC_STONE: - case SC_STUN: case SC_SLEEP: - case SC_BLOODING: case SC_CURSE: - case SC_CONFUSION: case SC_ILLUSION: - case SC_SILENCE: case SC_BURNING: - case SC_COLD: case SC_FROSTMISTY: - case SC_DEEP_SLEEP: case SC_FEAR: - case SC_MANDRAGORA: case SC__CHAOS: + case SC_POISON: + case SC_BLIND: + case SC_FREEZE: + case SC_STONE: + case SC_STUN: + case SC_SLEEP: + case SC_BLOODING: + case SC_CURSE: + case SC_CONFUSION: + case SC_ILLUSION: + case SC_SILENCE: + case SC_BURNING: + case SC_COLD: + case SC_FROSTMISTY: + case SC_DEEP_SLEEP: + case SC_FEAR: + case SC_MANDRAGORA: + case SC__CHAOS: status_change_end(bl, (sc_type)i, INVALID_TIMER); } } @@ -8954,7 +8975,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin for( i = 0; i < ARRAYLENGTH(combo); i++ ) skill->addtimerskill(src, tick + 400 * i, bl->id, 0, 0, combo[i], skill_lv, BF_WEAPON, flag|SD_LEVEL); - break; + break; } case WA_SWING_DANCE: case WA_SYMPHONY_OF_LOVER: @@ -9198,9 +9219,9 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin case SO_EL_CONTROL: if( sd ) { - int mode = EL_MODE_PASSIVE; // Standard mode. + int mode = EL_MODE_PASSIVE; // Standard mode. - if( !sd->ed ) break; + if( !sd->ed ) break; if( skill_lv == 4 ) {// At level 4 delete elementals. elemental->delete(sd->ed, 0); @@ -9249,7 +9270,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin int s_hp = sd->battle_status.hp * 10 / 100, s_sp = sd->battle_status.sp * 10 / 100; int e_hp, e_sp; - if( !ed ) break; + if( !ed ) break; if( !status->charge(&sd->bl,s_hp,s_sp) ) { clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); break; @@ -9378,7 +9399,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin } else { clif->skill_nodamage(src,src,skill_id,skill_lv,1); clif->skill_damage(src, ( skill_id == EL_GUST || skill_id == EL_BLAST || skill_id == EL_WILD_STORM )?src:bl, tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, 6); - if( skill_id == EL_WIND_STEP ) // There aren't teleport, just push the master away. + if( skill_id == EL_WIND_STEP ) // There aren't teleport, just push the master away. skill->blown(src,bl,(rnd()%skill->get_blewcount(skill_id,skill_lv))+1,rnd()%8,0); sc_start(src, src,type2,100,skill_lv,skill->get_time(skill_id,skill_lv)); sc_start(src, bl,type,100,skill_lv,skill->get_time(skill_id,skill_lv)); @@ -9767,7 +9788,7 @@ int skill_castend_pos(int tid, int64 tick, int id, intptr_t data) { if( !sd || sd->skillitem != ud->skill_id || skill->get_delay(ud->skill_id,ud->skill_lv) ) ud->canact_tick = tick + skill->delay_fix(src, ud->skill_id, ud->skill_lv); - if (sd) { //Cooldown application + if (sd) { //Cooldown application int i, cooldown = skill->get_cooldown(ud->skill_id, ud->skill_lv); for (i = 0; i < ARRAYLENGTH(sd->skillcooldown) && sd->skillcooldown[i].id; i++) { // Increases/Decreases cooldown of a skill by item/card bonuses. if (sd->skillcooldown[i].id == ud->skill_id){ @@ -9780,15 +9801,15 @@ int skill_castend_pos(int tid, int64 tick, int id, intptr_t data) { } if( battle_config.display_status_timers && sd ) clif->status_change(src, SI_POSTDELAY, 1, skill->delay_fix(src, ud->skill_id, ud->skill_lv), 0, 0, 0); -// if( sd ) -// { -// switch( ud->skill_id ) -// { -// case ????: -// sd->canequip_tick = tick + ????; -// break; -// } -// } +#if 0 + if (sd) { + switch (ud->skill_id) { + case ????: + sd->canequip_tick = tick + ????; + break; + } + } +#endif // 0 unit->set_walkdelay(src, tick, battle_config.default_walk_delay+skill->get_walkdelay(ud->skill_id, ud->skill_lv), 1); status_change_end(src,SC_CAMOUFLAGE, INVALID_TIMER);// only normal attack and auto cast skills benefit from its bonuses map->freeblock_lock(); @@ -9985,7 +10006,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui int r; //if(skill_lv <= 0) return 0; - if(skill_id > 0 && !skill_lv) return 0; // [Celest] + if(skill_id > 0 && !skill_lv) return 0; // [Celest] nullpo_ret(src); @@ -10111,7 +10132,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui case WE_CALLPARTNER: case WE_CALLPARENT: case WE_CALLBABY: - case AC_SHOWER: //Ground-placed skill implementation. + case AC_SHOWER: //Ground-placed skill implementation. case MA_SHOWER: case SA_LANDPROTECTOR: case BD_LULLABY: @@ -10194,7 +10215,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui if( skill->unitsetting(src,skill_id,skill_lv,x,y,0) ) map->list[src->m].setcell(src->m, x, y, CELL_NOICEWALL, true); break; - case RG_GRAFFITI: /* Graffiti [Valaris] */ + case RG_GRAFFITI: skill->clear_unitgroup(src); skill->unitsetting(src,skill_id,skill_lv,x,y,0); flag|=1; @@ -10438,7 +10459,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui sc_start(src,src,type,100,skill_lv,skill->get_time2(skill_id,skill_lv)); break; - case AM_RESURRECTHOMUN: // [orn] + case AM_RESURRECTHOMUN: // [orn] if (sd) { if (!homun->ressurect(sd, 20*skill_lv, x, y)) { clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); @@ -10764,7 +10785,8 @@ bool skill_dance_switch(struct skill_unit* su, int flag) { } prevflag = flag; - if( !flag ) { //Transform + if( !flag ) { + //Transform uint16 skill_id = su->val2&UF_SONG ? BA_DISSONANCE : DC_UGLYDANCE; // backup @@ -10782,7 +10804,8 @@ bool skill_dance_switch(struct skill_unit* su, int flag) { group->target_flag = skill->get_unit_target(skill_id); group->bl_flag = skill->get_unit_bl_target(skill_id); group->interval = skill->get_unit_interval(skill_id); - } else { //Restore + } else { + //Restore group->skill_id = backup.skill_id; group->skill_lv = backup.skill_lv; group->unit_id = backup.unit_id; @@ -10827,7 +10850,7 @@ struct skill_unit_group* skill_unitsetting(struct block_list *src, uint16 skill_ sd = BL_CAST(BL_PC, src); st = status->get_status_data(src); - sc = status->get_sc(src); // for traps, firewall and fogwall - celest + sc = status->get_sc(src); // for traps, firewall and fogwall - celest switch( skill_id ) { case SO_ELEMENTAL_SHIELD: @@ -10854,10 +10877,10 @@ struct skill_unit_group* skill_unitsetting(struct block_list *src, uint16 skill_ case AL_WARP: val1=skill_lv+6; - if(!(flag&1)) + if(!(flag&1)) { limit=2000; - else // previous implementation (not used anymore) - { //Warp Portal morphing to active mode, extract relevant data from src. [Skotlex] + } else { // previous implementation (not used anymore) + //Warp Portal morphing to active mode, extract relevant data from src. [Skotlex] if( src->type != BL_SKILL ) return NULL; group = ((TBL_SKILL*)src)->group; src = map->id2bl(group->src_id); @@ -10882,7 +10905,7 @@ struct skill_unit_group* skill_unitsetting(struct block_list *src, uint16 skill_ limit=1000; val1=skill_lv+2; break; - case WZ_QUAGMIRE: //The target changes to "all" if used in a gvg map. [Skotlex] + case WZ_QUAGMIRE: //The target changes to "all" if used in a gvg map. [Skotlex] case AM_DEMONSTRATION: case GN_HELLS_PLANT: if( skill_id == GN_HELLS_PLANT && map->getcell(src->m, x, y, CELL_CHKLANDPROTECTOR) ) @@ -10936,17 +10959,18 @@ struct skill_unit_group* skill_unitsetting(struct block_list *src, uint16 skill_ case SA_VIOLENTGALE: { struct skill_unit_group *old_sg; - if ((old_sg = skill->locate_element_field(src)) != NULL) - { //HelloKitty confirmed that these are interchangeable, + if ((old_sg = skill->locate_element_field(src)) != NULL) { + //HelloKitty confirmed that these are interchangeable, //so you can change element and not consume gemstones. - if (( - old_sg->skill_id == SA_VOLCANO || - old_sg->skill_id == SA_DELUGE || - old_sg->skill_id == SA_VIOLENTGALE - ) && old_sg->limit > 0) - { //Use the previous limit (minus the elapsed time) [Skotlex] + if (( old_sg->skill_id == SA_VOLCANO + || old_sg->skill_id == SA_DELUGE + || old_sg->skill_id == SA_VIOLENTGALE + ) + && old_sg->limit > 0 + ) { + //Use the previous limit (minus the elapsed time) [Skotlex] limit = old_sg->limit - DIFF_TICK32(timer->gettick(), old_sg->tick); - if (limit < 0) //This can happen... + if (limit < 0) //This can happen... limit = skill->get_time(skill_id,skill_lv); } skill->clear_group(src,1); @@ -11030,22 +11054,22 @@ struct skill_unit_group* skill_unitsetting(struct block_list *src, uint16 skill_ break; case BD_DRUMBATTLEFIELD: #ifdef RENEWAL - val1 = (skill_lv+5)*25; //Watk increase - val2 = skill_lv*10; //Def increase + val1 = (skill_lv+5)*25; //Watk increase + val2 = skill_lv*10; //Def increase #else - val1 = (skill_lv+1)*25; //Watk increase - val2 = (skill_lv+1)*2; //Def increase + val1 = (skill_lv+1)*25; //Watk increase + val2 = (skill_lv+1)*2; //Def increase #endif break; case BD_RINGNIBELUNGEN: - val1 = (skill_lv+2)*25; //Watk increase + val1 = (skill_lv+2)*25; //Watk increase break; case BD_RICHMANKIM: val1 = 25 + 11*skill_lv; //Exp increase bonus. break; case BD_SIEGFRIED: - val1 = 55 + skill_lv*5; //Elemental Resistance - val2 = skill_lv*10; //Status ailment resistance + val1 = 55 + skill_lv*5; //Elemental Resistance + val2 = skill_lv*10; //Status ailment resistance break; case WE_CALLPARTNER: if (sd) val1 = sd->status.partner_id; @@ -11168,7 +11192,7 @@ struct skill_unit_group* skill_unitsetting(struct block_list *src, uint16 skill_ group->state.song_dance = (unit_flag&(UF_DANCE|UF_SONG)?1:0)|(unit_flag&UF_ENSEMBLE?2:0); //Signals if this is a song/dance/duet group->state.guildaura = ( skill_id >= GD_LEADERSHIP && skill_id <= GD_HAWKEYES )?1:0; group->item_id = req_item; - //if tick is greater than current, do not invoke onplace function just yet. [Skotlex] + //if tick is greater than current, do not invoke onplace function just yet. [Skotlex] if (DIFF_TICK(group->tick, timer->gettick()) > SKILLUNITTIMER_INTERVAL) active_flag = 0; @@ -11479,12 +11503,13 @@ int skill_unit_onplace(struct skill_unit *src, struct block_list *bl, int64 tick sc_start4(ss,bl,type,100,sg->skill_lv,0,BCT_ENEMY,sg->group_id,sg->limit); break; - // officially, icewall has no problems existing on occupied cells [ultramage] - // case UNT_ICEWALL: //Destroy the cell. [Skotlex] - // src->val1 = 0; - // if(src->limit + sg->tick > tick + 700) - // src->limit = DIFF_TICK32(tick+700,sg->tick); - // break; +#if 0 // officially, icewall has no problems existing on occupied cells [ultramage] + case UNT_ICEWALL: //Destroy the cell. [Skotlex] + src->val1 = 0; + if(src->limit + sg->tick > tick + 700) + src->limit = DIFF_TICK32(tick+700,sg->tick); + break; +#endif // 0 case UNT_MOONLIT: //Knockback out of area if affected char isn't in Moonlit effect @@ -11497,7 +11522,7 @@ int skill_unit_onplace(struct skill_unit *src, struct block_list *bl, int64 tick case UNT_WALLOFTHORN: if( status_get_mode(bl)&MD_BOSS ) - break; // iRO Wiki says that this skill don't affect to Boss monsters. + break; // iRO Wiki says that this skill don't affect to Boss monsters. if( map_flag_vs(bl->m) || bl->id == src->bl.id || battle->check_target(&src->bl,bl, BCT_ENEMY) == 1 ) skill->attack(skill->get_type(sg->skill_id), ss, &src->bl, bl, sg->skill_id, sg->skill_lv, tick, 0); break; @@ -11563,9 +11588,20 @@ int skill_unit_onplace_timer(struct skill_unit *src, struct block_list *bl, int6 if ( tsc && tsc->data[SC_HOVERING] ) { switch ( skill_id ) { - case HT_SKIDTRAP: case HT_LANDMINE: case HT_ANKLESNARE: case HT_FLASHER: case HT_SHOCKWAVE: - case HT_SANDMAN: case HT_FREEZINGTRAP: case HT_BLASTMINE: case HT_CLAYMORETRAP: case HW_GRAVITATION: - case SA_DELUGE: case SA_VOLCANO: case SA_VIOLENTGALE: case NJ_SUITON: + case HT_SKIDTRAP: + case HT_LANDMINE: + case HT_ANKLESNARE: + case HT_FLASHER: + case HT_SHOCKWAVE: + case HT_SANDMAN: + case HT_FREEZINGTRAP: + case HT_BLASTMINE: + case HT_CLAYMORETRAP: + case HW_GRAVITATION: + case SA_DELUGE: + case SA_VOLCANO: + case SA_VIOLENTGALE: + case NJ_SUITON: return 0; } } @@ -11827,7 +11863,7 @@ int skill_unit_onplace_timer(struct skill_unit *src, struct block_list *bl, int6 skill->additional_effect(ss, bl, sg->skill_id, sg->skill_lv, BF_LONG|BF_SKILL|BF_MISC, ATK_DEF, tick); break; - case UNT_UGLYDANCE: //Ugly Dance [Skotlex] + case UNT_UGLYDANCE: if (ss->id != bl->id) skill->additional_effect(ss, bl, sg->skill_id, sg->skill_lv, BF_LONG|BF_SKILL|BF_MISC, ATK_DEF, tick); break; @@ -11854,7 +11890,7 @@ int skill_unit_onplace_timer(struct skill_unit *src, struct block_list *bl, int6 status->heal(bl, heal, 0, 0); } break; - case UNT_TATAMIGAESHI: + case UNT_TATAMIGAESHI: case UNT_DEMONSTRATION: skill->attack(BF_WEAPON,ss,&src->bl,bl,sg->skill_id,sg->skill_lv,tick,0); break; @@ -12078,7 +12114,7 @@ int skill_unit_onplace_timer(struct skill_unit *src, struct block_list *bl, int6 clif->fixpos(bl); sg->val2 = bl->id; } else - sec = 3000; // Couldn't trap it? + sec = 3000; // Couldn't trap it? sg->limit = DIFF_TICK32(tick, sg->tick) + sec; } else if( tsc->data[SC_THORNS_TRAP] && bl->id == sg->val2 ) skill->attack(skill->get_type(GN_THORNS_TRAP), ss, ss, bl, sg->skill_id, sg->skill_lv, tick, SD_LEVEL|SD_ANIMATION); @@ -12127,7 +12163,8 @@ int skill_unit_onplace_timer(struct skill_unit *src, struct block_list *bl, int6 break; case UNT_WARMER: - { // It has effect on everything, including monsters, undead property and demon + { + // It has effect on everything, including monsters, undead property and demon int hp = 0; if( ssc && ssc->data[SC_HEATER_OPTION] ) hp = tstatus->max_hp * 3 * sg->skill_lv / 100; @@ -12267,7 +12304,8 @@ int skill_unit_onout(struct skill_unit *src, struct block_list *bl, int64 tick) if( sce && sce->val4 == src->bl.id ) status_change_end(bl, type, INVALID_TIMER); break; - case UNT_HERMODE: //Clear Hermode if the owner moved. + case UNT_HERMODE: + //Clear Hermode if the owner moved. if (sce && sce->val3 == BCT_SELF && sce->val4 == sg->group_id) status_change_end(bl, type, INVALID_TIMER); break; @@ -12328,8 +12366,8 @@ int skill_unit_onleft(uint16 skill_id, struct block_list *bl, int64 tick) { case BD_ROKISWEIL: case BD_INTOABYSS: case BD_SIEGFRIED: - if(sc && sc->data[SC_DANCING] && (sc->data[SC_DANCING]->val1&0xFFFF) == skill_id) - { //Check if you just stepped out of your ensemble skill to cancel dancing. [Skotlex] + if(sc && sc->data[SC_DANCING] && (sc->data[SC_DANCING]->val1&0xFFFF) == skill_id) { + //Check if you just stepped out of your ensemble skill to cancel dancing. [Skotlex] //We don't check for SC_LONGING because someone could always have knocked you back and out of the song/dance. //FIXME: This code is not perfect, it doesn't checks for the real ensemble's owner, //it only checks if you are doing the same ensemble. So if there's two chars doing an ensemble @@ -12437,7 +12475,7 @@ int skill_unit_effect(struct block_list* bl, va_list ap) { return 0; // Don't let a Bard/Dancer update their own song timer if( flag&4 ) - skill->unit_onleft(skill_id, bl, tick); + skill->unit_onleft(skill_id, bl, tick); } if( dissonance ) skill->dance_switch(su, 1); @@ -12487,7 +12525,7 @@ int skill_check_condition_char_sub (struct block_list *bl, va_list ap) { struct block_list *src; struct map_session_data *sd; struct map_session_data *tsd; - int *p_sd; //Contains the list of characters found. + int *p_sd; //Contains the list of characters found. nullpo_ret(bl); nullpo_ret(tsd=(struct map_session_data*)bl); @@ -12578,7 +12616,8 @@ int skill_check_pc_partner (struct map_session_data *sd, uint16 skill_id, uint16 if (!battle_config.player_skill_partner_check || pc_has_permission(sd, PC_PERM_SKILL_UNCONDITIONAL)) return is_chorus ? MAX_PARTY : 99; //As if there were infinite partners. - if (cast_flag) { //Execute the skill on the partners. + if (cast_flag) { + //Execute the skill on the partners. struct map_session_data* tsd; switch (skill_id) { case PR_BENEDICTIO: @@ -12651,7 +12690,7 @@ int skill_isammotype (struct map_session_data *sd, int skill_id) (sd->status.weapon == W_BOW || (sd->status.weapon >= W_REVOLVER && sd->status.weapon <= W_GRENADE)) && skill_id != HT_PHANTASMIC && skill->get_type(skill_id) == BF_WEAPON && - !(skill->get_nk(skill_id)&NK_NO_DAMAGE) && + !(skill->get_nk(skill_id)&NK_NO_DAMAGE) && !skill->get_spiritball(skill_id,1) //Assume spirit spheres are used as ammo instead. ); } @@ -12694,8 +12733,8 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id if (sd->chatID) return 0; - if( pc_has_permission(sd, PC_PERM_SKILL_UNCONDITIONAL) && sd->skillitem != skill_id ) - { //GMs don't override the skillItem check, otherwise they can use items without them being consumed! [Skotlex] + if (pc_has_permission(sd, PC_PERM_SKILL_UNCONDITIONAL) && sd->skillitem != skill_id) { + //GMs don't override the skillItem check, otherwise they can use items without them being consumed! [Skotlex] sd->state.arrow_atk = skill->get_ammotype(skill_id)?1:0; //Need to do arrow state check. sd->spiritball_old = sd->spiritball; //Need to do Spiritball check. return 1; @@ -12737,8 +12776,8 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id sd->inventory_data[i] == NULL || !sd->inventory_data[i]->flag.delay_consume || sd->status.inventory[i].amount < 1 - ) - { //Something went wrong, item exploit? + ) { + //Something went wrong, item exploit? sd->itemid = sd->itemindex = -1; return 0; } @@ -12825,20 +12864,34 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id // Check the skills that can be used whiled using mado if( pc_ismadogear(sd) ) { switch ( skill_id ) { - case BS_GREED: case NC_BOOSTKNUCKLE: - case NC_PILEBUNKER: case NC_VULCANARM: - case NC_FLAMELAUNCHER: case NC_COLDSLOWER: - case NC_ARMSCANNON: case NC_ACCELERATION: - case NC_HOVERING: case NC_F_SIDESLIDE: - case NC_B_SIDESLIDE: case NC_SELFDESTRUCTION: - case NC_SHAPESHIFT: case NC_EMERGENCYCOOL: - case NC_INFRAREDSCAN: case NC_ANALYZE: - case NC_MAGNETICFIELD: case NC_NEUTRALBARRIER: - case NC_STEALTHFIELD: case NC_REPAIR: - case NC_AXEBOOMERANG: case NC_POWERSWING: - case NC_AXETORNADO: case NC_SILVERSNIPER: - case NC_MAGICDECOY: case NC_DISJOINT: - case NC_MAGMA_ERUPTION: case ALL_FULL_THROTTLE: + case BS_GREED: + case NC_BOOSTKNUCKLE: + case NC_PILEBUNKER: + case NC_VULCANARM: + case NC_FLAMELAUNCHER: + case NC_COLDSLOWER: + case NC_ARMSCANNON: + case NC_ACCELERATION: + case NC_HOVERING: + case NC_F_SIDESLIDE: + case NC_B_SIDESLIDE: + case NC_SELFDESTRUCTION: + case NC_SHAPESHIFT: + case NC_EMERGENCYCOOL: + case NC_INFRAREDSCAN: + case NC_ANALYZE: + case NC_MAGNETICFIELD: + case NC_NEUTRALBARRIER: + case NC_STEALTHFIELD: + case NC_REPAIR: + case NC_AXEBOOMERANG: + case NC_POWERSWING: + case NC_AXETORNADO: + case NC_SILVERSNIPER: + case NC_MAGICDECOY: + case NC_DISJOINT: + case NC_MAGMA_ERUPTION: + case ALL_FULL_THROTTLE: case NC_MAGMA_ERUPTION_DOTDAMAGE: break; default: @@ -12930,12 +12983,13 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id } return 0; case MO_EXTREMITYFIST: - // if(sc && sc->data[SC_EXTREMITYFIST]) //To disable Asura during the 5 min skill block uncomment this... - // return 0; - if( sc && (sc->data[SC_BLADESTOP] || sc->data[SC_CURSEDCIRCLE_ATKER]) ) +#if 0 //To disable Asura during the 5 min skill block uncomment this block... + if(sc && sc->data[SC_EXTREMITYFIST]) + return 0; +#endif // 0 + if (sc && (sc->data[SC_BLADESTOP] || sc->data[SC_CURSEDCIRCLE_ATKER])) break; - if( sc && sc->data[SC_COMBOATTACK] ) - { + if (sc && sc->data[SC_COMBOATTACK]) { switch(sc->data[SC_COMBOATTACK]->val1) { case MO_COMBOFINISH: case CH_TIGERFIST: @@ -12944,9 +12998,8 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id default: return 0; } - } - else if( !unit->can_move(&sd->bl) ) - { //Placed here as ST_MOVE_ENABLE should not apply if rooted or on a combo. [Skotlex] + } else if (!unit->can_move(&sd->bl)) { + //Placed here as ST_MOVE_ENABLE should not apply if rooted or on a combo. [Skotlex] clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); return 0; } @@ -12981,14 +13034,15 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id if(!(sc && sc->data[SC_COMBOATTACK]) || sc->data[SC_COMBOATTACK]->val1 == TK_JUMPKICK) return 0; //Combo needs to be ready - if (sc->data[SC_COMBOATTACK]->val3) { //Kick chain + if (sc->data[SC_COMBOATTACK]->val3) { //Kick chain //Do not repeat a kick. if (sc->data[SC_COMBOATTACK]->val3 != skill_id) break; status_change_end(&sd->bl, SC_COMBOATTACK, INVALID_TIMER); return 0; } - if(sc->data[SC_COMBOATTACK]->val1 != skill_id && !( sd && sd->status.base_level >= 90 && pc->famerank(sd->status.char_id, MAPID_TAEKWON) )) { //Cancel combo wait. + if(sc->data[SC_COMBOATTACK]->val1 != skill_id && !( sd && sd->status.base_level >= 90 && pc->famerank(sd->status.char_id, MAPID_TAEKWON) )) { + //Cancel combo wait. unit->cancel_combo(&sd->bl); return 0; } @@ -13295,11 +13349,11 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id case LG_RAYOFGENESIS: case LG_HESPERUSLIT: if( sc && sc->data[SC_INSPIRATION] ) - return 1; // Don't check for partner. + return 1; // Don't check for partner. if( !(sc && sc->data[SC_BANDING]) ) { clif->skill_fail(sd,skill_id,USESKILL_FAIL,0); return 0; - } + } if( sc->data[SC_BANDING] && sc->data[SC_BANDING]->val2 < (skill_id == LG_RAYOFGENESIS ? 2 : 3) ) return 0; // Just fails, no msg here. @@ -13370,7 +13424,7 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id } break; case SO_FIREWALK: - case SO_ELECTRICWALK: // Can't be casted until you've walked all cells. + case SO_ELECTRICWALK: // Can't be casted until you've walked all cells. if( sc && sc->data[SC_PROPERTYWALK] && sc->data[SC_PROPERTYWALK]->val3 < skill->get_maxcount(sc->data[SC_PROPERTYWALK]->val1,sc->data[SC_PROPERTYWALK]->val2) ) { clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); @@ -13589,12 +13643,14 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id return 0; } +#if 0 // There's no need to check if the skill is part of a combo if it's // already been checked before, see unit_skilluse_id2 [Panikon] // Note that if this check is read part of issue:8047 will reappear! - //if( sd->sc.data[SC_COMBOATTACK] && !skill->is_combo(skill_id ) ) - // return 0; - + if( sd->sc.data[SC_COMBOATTACK] && !skill->is_combo(skill_id ) ) + return 0; +#endif // 0 + return 1; } @@ -13919,7 +13975,7 @@ struct skill_condition skill_get_requirement(struct map_session_data* sd, uint16 idx = skill->get_index(skill_id); if( idx == 0 ) // invalid skill id - return req; + return req; if( skill_lv < 1 || skill_lv > MAX_SKILL_LEVEL ) return req; @@ -14000,7 +14056,7 @@ struct skill_condition skill_get_requirement(struct map_session_data* sd, uint16 continue; break; case WZ_FIREPILLAR: // celest - if (skill_lv <= 5) // no gems required at level 1-5 + if (skill_lv <= 5) // no gems required at level 1-5 continue; break; case AB_ADORAMUS: @@ -14031,10 +14087,9 @@ struct skill_condition skill_get_requirement(struct map_session_data* sd, uint16 req.itemid[i] = skill->db[idx].itemid[i]; req.amount[i] = skill->db[idx].amount[i]; - if( itemid_isgemstone(req.itemid[i]) && skill_id != HW_GANBANTEIN ) - { - if( sd->special_state.no_gemstone ) - { // All gem skills except Hocus Pocus and Ganbantein can cast for free with Mistress card [helvetica] + if (itemid_isgemstone(req.itemid[i]) && skill_id != HW_GANBANTEIN) { + if (sd->special_state.no_gemstone) { + // All gem skills except Hocus Pocus and Ganbantein can cast for free with Mistress card [helvetica] if( skill_id != SA_ABRACADABRA ) req.itemid[i] = req.amount[i] = 0; else if( --req.amount[i] < 1 ) @@ -14146,7 +14201,7 @@ struct skill_condition skill_get_requirement(struct map_session_data* sd, uint16 case CH_TIGERFIST: req.spiritball = 3; break; - case CH_CHAINCRUSH: //It should consume whatever is left as long as it's at least 1. + case CH_CHAINCRUSH: //It should consume whatever is left as long as it's at least 1. req.spiritball = sd->spiritball?sd->spiritball:1; break; } @@ -14196,10 +14251,10 @@ int skill_castfix (struct block_list *bl, uint16 skill_id, uint16 skill_lv) { // calculate base cast time (reduced by dex) if( !(skill->get_castnodex(skill_id, skill_lv)&1) ) { int scale = battle_config.castrate_dex_scale - status_get_dex(bl); - if( scale > 0 ) // not instant cast + if( scale > 0 ) // not instant cast time = time * scale / battle_config.castrate_dex_scale; else - return 0; // instant cast + return 0; // instant cast } // calculate cast time reduced by item/card bonuses @@ -14224,9 +14279,9 @@ int skill_castfix (struct block_list *bl, uint16 skill_id, uint16 skill_lv) { if (battle_config.cast_rate != 100) time = time * battle_config.cast_rate / 100; // return final cast time - time = max(time, 0); + time = max(time, 0); -// ShowInfo("Castime castfix = %d\n",time); + //ShowInfo("Castime castfix = %d\n",time); return time; } @@ -14411,10 +14466,11 @@ int skill_delay_fix (struct block_list *bl, uint16 skill_id, uint16 skill_lv) { return battle_config.min_skill_delay_limit; if (time < 0) - time = -time + status_get_amotion(bl); // If set to <0, add to attack motion. + time = -time + status_get_amotion(bl); // If set to <0, add to attack motion. // Delay reductions - switch (skill_id) { //Monk combo skills have their delay reduced by agi/dex. + switch (skill_id) { + //Monk combo skills have their delay reduced by agi/dex. case MO_TRIPLEATTACK: case MO_CHAINCOMBO: case MO_COMBOFINISH: @@ -14429,16 +14485,16 @@ int skill_delay_fix (struct block_list *bl, uint16 skill_id, uint16 skill_lv) { time = 0; // There is no Delay on Basilica creation, only on cancel break; default: - if (battle_config.delay_dependon_dex && !(delaynodex&1)) - { // if skill delay is allowed to be reduced by dex + if (battle_config.delay_dependon_dex && !(delaynodex&1)) { + // if skill delay is allowed to be reduced by dex int scale = battle_config.castrate_dex_scale - status_get_dex(bl); if (scale > 0) time = time * scale / battle_config.castrate_dex_scale; else //To be capped later to minimum. time = 0; } - if (battle_config.delay_dependon_agi && !(delaynodex&1)) - { // if skill delay is allowed to be reduced by agi + if (battle_config.delay_dependon_agi && !(delaynodex&1)) { + // if skill delay is allowed to be reduced by agi int scale = battle_config.castrate_dex_scale - status_get_agi(bl); if (scale > 0) time = time * scale / battle_config.castrate_dex_scale; @@ -14749,7 +14805,8 @@ void skill_weaponrefine (struct map_session_data *sd, int idx) if(item->nameid > 0 && ditem->type == IT_WEAPON) { - if( ditem->flag.no_refine ){ // if the item isn't refinable + if( ditem->flag.no_refine ) { + // if the item isn't refinable clif->skill_fail(sd,sd->menuskill_id,USESKILL_FAIL_LEVEL,0); return; } @@ -14830,7 +14887,7 @@ int skill_autospell (struct map_session_data *sd, uint16 skill_id) if(!skill_lv || !lv) return 0; // Player must learn the skill before doing auto-spell [Lance] - if(skill_id==MG_NAPALMBEAT) maxlv=3; + if(skill_id==MG_NAPALMBEAT) maxlv=3; else if(skill_id==MG_COLDBOLT || skill_id==MG_FIREBOLT || skill_id==MG_LIGHTNINGBOLT){ if (sd->sc.data[SC_SOULLINK] && sd->sc.data[SC_SOULLINK]->val2 == SL_SAGE) maxlv =10; //Soul Linker bonus. [Skotlex] @@ -15971,7 +16028,7 @@ int skill_unit_timer_sub(DBKey key, DBData *data, va_list ap) { struct skill_unit* su = DB->data2ptr(data); struct skill_unit_group* group = su->group; int64 tick = va_arg(ap,int64); - bool dissonance; + bool dissonance; struct block_list* bl = &su->bl; if( !su->alive ) @@ -16216,8 +16273,8 @@ int skill_unit_move_sub(struct block_list* bl, va_list ap) { //Necessary in case the group is deleted after calling on_place/on_out [Skotlex] skill_id = su->group->skill_id; - if( su->group->interval != -1 && !(skill->get_unit_flag(skill_id)&UF_DUALMODE) && skill_id != BD_LULLABY ) //Lullaby is the exception, bugreport:411 - { //Non-dualmode unit skills with a timer don't trigger when walking, so just return + if( su->group->interval != -1 && !(skill->get_unit_flag(skill_id)&UF_DUALMODE) && skill_id != BD_LULLABY ) { //Lullaby is the exception, bugreport:411 + //Non-dualmode unit skills with a timer don't trigger when walking, so just return if( dissonance ) skill->dance_switch(su, 1); return 0; } @@ -16331,11 +16388,11 @@ int skill_unit_move_unit_group(struct skill_unit_group *group, int16 m, int16 dx return 0; //Icewalls and Wall of Thorns don't get knocked back m_flag = (int *) aCalloc(group->unit_count, sizeof(int)); - // m_flag - // 0: Neither of the following (skill_unit_onplace & skill_unit_onout are needed) - // 1: Unit will move to a slot that had another unit of the same group (skill_unit_onplace not needed) - // 2: Another unit from same group will end up positioned on this unit (skill_unit_onout not needed) - // 3: Both 1+2. + // m_flag: + // 0: Neither of the following (skill_unit_onplace & skill_unit_onout are needed) + // 1: Unit will move to a slot that had another unit of the same group (skill_unit_onplace not needed) + // 2: Another unit from same group will end up positioned on this unit (skill_unit_onout not needed) + // 3: Both 1+2. for(i=0;i<group->unit_count;i++) { su1=&group->unit[i]; if (!su1->alive || su1->bl.m!=m) @@ -16787,9 +16844,8 @@ int skill_produce_mix(struct map_session_data *sd, uint16 skill_id, int nameid, } break; default: - if (sd->menuskill_id == AM_PHARMACY && - sd->menuskill_val > 10 && sd->menuskill_val <= 20) - { //Assume Cooking Dish + if (sd->menuskill_id == AM_PHARMACY && sd->menuskill_val > 10 && sd->menuskill_val <= 20) { + //Assume Cooking Dish if (sd->menuskill_val >= 15) //Legendary Cooking Set. make_per = 10000; //100% Success else @@ -16880,9 +16936,10 @@ int skill_produce_mix(struct map_session_data *sd, uint16 skill_id, int nameid, } } -// if(log_config.produce > 0) -// log_produce(sd,nameid,slot1,slot2,slot3,1); -//TODO update PICKLOG +#if 0 // TODO: update PICKLOG + if(log_config.produce > 0) + log_produce(sd,nameid,slot1,slot2,slot3,1); +#endif // 0 if(equip){ clif->produce_effect(sd,0,nameid); @@ -16893,7 +16950,8 @@ int skill_produce_mix(struct map_session_data *sd, uint16 skill_id, int nameid, int fame = 0; tmp_item.amount = 0; - for (i=0; i< qty; i++) { //Apply quantity modifiers. + for (i=0; i< qty; i++) { + //Apply quantity modifiers. if( (skill_id == GN_MIX_COOKING || skill_id == GN_MAKEBOMB || skill_id == GN_S_PHARMACY) && make_per > 1){ tmp_item.amount = qty; break; @@ -16991,9 +17049,10 @@ int skill_produce_mix(struct map_session_data *sd, uint16 skill_id, int nameid, } } //Failure -// if(log_config.produce) -// log_produce(sd,nameid,slot1,slot2,slot3,0); -//TODO update PICKLOG +#if 0 // TODO: update PICKLOG + if(log_config.produce) + log_produce(sd,nameid,slot1,slot2,slot3,0); +#endif // 0 if(equip){ clif->produce_effect(sd,1,nameid); @@ -17314,7 +17373,8 @@ int skill_elementalanalysis(struct map_session_data* sd, int n, uint16 skill_lv, return 1; } - if( skill_lv == 2 && rnd()%100 < 25 ) { // At level 2 have a fail chance. You loose your items if it fails. + if( skill_lv == 2 && rnd()%100 < 25 ) { + // At level 2 have a fail chance. You loose your items if it fails. clif->skill_fail(sd,SO_EL_ANALYSIS,USESKILL_FAIL_LEVEL,0); return 1; } @@ -17366,7 +17426,7 @@ int skill_changematerial(struct map_session_data *sd, int n, unsigned short *ite } } else - break; // No more items required + break; // No more items required } p++; } while(n == j && c == n); @@ -17645,7 +17705,8 @@ int skill_split_atoi (char *str, int *val) { } if(i==0) //No data found. return 0; - if(i==1) { //Single value, have the whole range have the same value. + if(i==1) { + //Single value, have the whole range have the same value. for (; i < MAX_SKILL_LEVEL; i++) val[i] = val[i-1]; return i; @@ -17960,44 +18021,132 @@ int skill_block_check(struct block_list *bl, sc_type type , uint16 skill_id) { if( inf == INF2_SONG_DANCE || skill->get_inf2(skill_id) == INF2_CHORUS_SKILL || inf == INF2_SPIRIT_SKILL ) return 1; // Can't do it. switch( skill_id ) { - case NV_FIRSTAID: case TF_HIDING: case AS_CLOAKING: case WZ_SIGHTRASHER: - case RG_STRIPWEAPON: case RG_STRIPSHIELD: case RG_STRIPARMOR: case WZ_METEOR: - case RG_STRIPHELM: case SC_STRIPACCESSARY: case ST_FULLSTRIP: case WZ_SIGHTBLASTER: - case ST_CHASEWALK: case SC_ENERVATION: case SC_GROOMY: case WZ_ICEWALL: - case SC_IGNORANCE: case SC_LAZINESS: case SC_UNLUCKY: case WZ_STORMGUST: - case SC_WEAKNESS: case AL_RUWACH: case AL_PNEUMA: case WZ_JUPITEL: - case AL_HEAL: case AL_BLESSING: case AL_INCAGI: case WZ_VERMILION: - case AL_TELEPORT: case AL_WARP: case AL_HOLYWATER: case WZ_EARTHSPIKE: - case AL_HOLYLIGHT: case PR_IMPOSITIO: case PR_ASPERSIO: case WZ_HEAVENDRIVE: - case PR_SANCTUARY: case PR_STRECOVERY: case PR_MAGNIFICAT: case WZ_QUAGMIRE: - case ALL_RESURRECTION: case PR_LEXDIVINA: case PR_LEXAETERNA: case HW_GRAVITATION: - case PR_MAGNUS: case PR_TURNUNDEAD: case MG_SRECOVERY: case HW_MAGICPOWER: - case MG_SIGHT: case MG_NAPALMBEAT: case MG_SAFETYWALL: case HW_GANBANTEIN: - case MG_SOULSTRIKE: case MG_COLDBOLT: case MG_FROSTDIVER: case WL_DRAINLIFE: - case MG_STONECURSE: case MG_FIREBALL: case MG_FIREWALL: case WL_SOULEXPANSION: - case MG_FIREBOLT: case MG_LIGHTNINGBOLT: case MG_THUNDERSTORM: case MG_ENERGYCOAT: - case WL_WHITEIMPRISON: case WL_SUMMONFB: case WL_SUMMONBL: case WL_SUMMONWB: - case WL_SUMMONSTONE: case WL_SIENNAEXECRATE: case WL_RELEASE: case WL_EARTHSTRAIN: - case WL_RECOGNIZEDSPELL: case WL_READING_SB: case SA_MAGICROD: case SA_SPELLBREAKER: - case SA_DISPELL: case SA_FLAMELAUNCHER: case SA_FROSTWEAPON: case SA_LIGHTNINGLOADER: - case SA_SEISMICWEAPON: case SA_VOLCANO: case SA_DELUGE: case SA_VIOLENTGALE: - case SA_LANDPROTECTOR: case PF_HPCONVERSION: case PF_SOULCHANGE: case PF_SPIDERWEB: - case PF_FOGWALL: case TK_RUN: case TK_HIGHJUMP: case TK_SEVENWIND: - case SL_KAAHI: case SL_KAUPE: case SL_KAITE: + case NV_FIRSTAID: + case TF_HIDING: + case AS_CLOAKING: + case WZ_SIGHTRASHER: + case RG_STRIPWEAPON: + case RG_STRIPSHIELD: + case RG_STRIPARMOR: + case WZ_METEOR: + case RG_STRIPHELM: + case SC_STRIPACCESSARY: + case ST_FULLSTRIP: + case WZ_SIGHTBLASTER: + case ST_CHASEWALK: + case SC_ENERVATION: + case SC_GROOMY: + case WZ_ICEWALL: + case SC_IGNORANCE: + case SC_LAZINESS: + case SC_UNLUCKY: + case WZ_STORMGUST: + case SC_WEAKNESS: + case AL_RUWACH: + case AL_PNEUMA: + case WZ_JUPITEL: + case AL_HEAL: + case AL_BLESSING: + case AL_INCAGI: + case WZ_VERMILION: + case AL_TELEPORT: + case AL_WARP: + case AL_HOLYWATER: + case WZ_EARTHSPIKE: + case AL_HOLYLIGHT: + case PR_IMPOSITIO: + case PR_ASPERSIO: + case WZ_HEAVENDRIVE: + case PR_SANCTUARY: + case PR_STRECOVERY: + case PR_MAGNIFICAT: + case WZ_QUAGMIRE: + case ALL_RESURRECTION: + case PR_LEXDIVINA: + case PR_LEXAETERNA: + case HW_GRAVITATION: + case PR_MAGNUS: + case PR_TURNUNDEAD: + case MG_SRECOVERY: + case HW_MAGICPOWER: + case MG_SIGHT: + case MG_NAPALMBEAT: + case MG_SAFETYWALL: + case HW_GANBANTEIN: + case MG_SOULSTRIKE: + case MG_COLDBOLT: + case MG_FROSTDIVER: + case WL_DRAINLIFE: + case MG_STONECURSE: + case MG_FIREBALL: + case MG_FIREWALL: + case WL_SOULEXPANSION: + case MG_FIREBOLT: + case MG_LIGHTNINGBOLT: + case MG_THUNDERSTORM: + case MG_ENERGYCOAT: + case WL_WHITEIMPRISON: + case WL_SUMMONFB: + case WL_SUMMONBL: + case WL_SUMMONWB: + case WL_SUMMONSTONE: + case WL_SIENNAEXECRATE: + case WL_RELEASE: + case WL_EARTHSTRAIN: + case WL_RECOGNIZEDSPELL: + case WL_READING_SB: + case SA_MAGICROD: + case SA_SPELLBREAKER: + case SA_DISPELL: + case SA_FLAMELAUNCHER: + case SA_FROSTWEAPON: + case SA_LIGHTNINGLOADER: + case SA_SEISMICWEAPON: + case SA_VOLCANO: + case SA_DELUGE: + case SA_VIOLENTGALE: + case SA_LANDPROTECTOR: + case PF_HPCONVERSION: + case PF_SOULCHANGE: + case PF_SPIDERWEB: + case PF_FOGWALL: + case TK_RUN: + case TK_HIGHJUMP: + case TK_SEVENWIND: + case SL_KAAHI: + case SL_KAUPE: + case SL_KAITE: // Skills that need to be confirmed. - case SO_FIREWALK: case SO_ELECTRICWALK: case SO_SPELLFIST: case SO_EARTHGRAVE: - case SO_DIAMONDDUST: case SO_POISON_BUSTER: case SO_PSYCHIC_WAVE: case SO_CLOUD_KILL: - case SO_STRIKING: case SO_WARMER: case SO_VACUUM_EXTREME: case SO_VARETYR_SPEAR: + case SO_FIREWALK: + case SO_ELECTRICWALK: + case SO_SPELLFIST: + case SO_EARTHGRAVE: + case SO_DIAMONDDUST: + case SO_POISON_BUSTER: + case SO_PSYCHIC_WAVE: + case SO_CLOUD_KILL: + case SO_STRIKING: + case SO_WARMER: + case SO_VACUUM_EXTREME: + case SO_VARETYR_SPEAR: case SO_ARRULLO: - return 1; // Can't do it. + return 1; // Can't do it. } break; case SC_KG_KAGEHUMI: switch(skill_id) { - case TF_HIDING: case AS_CLOAKING: case GC_CLOAKINGEXCEED: case SC_SHADOWFORM: - case MI_HARMONIZE: case CG_MARIONETTE: case AL_TELEPORT: case TF_BACKSLIDING: - case RA_CAMOUFLAGE: case ST_CHASEWALK: case GD_EMERGENCYCALL: + case TF_HIDING: + case AS_CLOAKING: + case GC_CLOAKINGEXCEED: + case SC_SHADOWFORM: + case MI_HARMONIZE: + case CG_MARIONETTE: + case AL_TELEPORT: + case TF_BACKSLIDING: + case RA_CAMOUFLAGE: + case ST_CHASEWALK: + case GD_EMERGENCYCALL: return 1; // needs more info } break; @@ -18010,10 +18159,10 @@ int skill_get_elemental_type( uint16 skill_id , uint16 skill_lv ) { int type = 0; switch( skill_id ) { - case SO_SUMMON_AGNI: type = 2114; break; - case SO_SUMMON_AQUA: type = 2117; break; - case SO_SUMMON_VENTUS: type = 2120; break; - case SO_SUMMON_TERA: type = 2123; break; + case SO_SUMMON_AGNI: type = 2114; break; + case SO_SUMMON_AQUA: type = 2117; break; + case SO_SUMMON_VENTUS: type = 2120; break; + case SO_SUMMON_TERA: type = 2123; break; } type += skill_lv - 1; @@ -18148,7 +18297,7 @@ bool skill_parse_row_requiredb(char* split[], int columns, int current) { skill->split_atoi(split[5],skill->db[idx].sp_rate); skill->split_atoi(split[6],skill->db[idx].zeny); - //Which weapon type are required, see doc/item_db for types + //Which weapon type are required, see doc/item_db for types p = split[7]; for( j = 0; j < 32; j++ ) { int l = atoi(p); diff --git a/src/map/skill.h b/src/map/skill.h index 4ec742bd0..f0a54b982 100644 --- a/src/map/skill.h +++ b/src/map/skill.h @@ -26,29 +26,29 @@ struct status_change_entry; /** * Defines **/ -#define MAX_SKILL_DB MAX_SKILL -#define MAX_SKILL_PRODUCE_DB 270 -#define MAX_PRODUCE_RESOURCE 10 -#define MAX_SKILL_ARROW_DB 140 -#define MAX_ARROW_RESOURCE 5 -#define MAX_SKILL_ABRA_DB 210 -#define MAX_SKILL_IMPROVISE_DB 30 -#define MAX_SKILL_LEVEL 10 -#define MAX_SKILL_UNIT_LAYOUT 45 -#define MAX_SQUARE_LAYOUT 5 // 11*11 Placement of a maximum unit -#define MAX_SKILL_UNIT_COUNT ((MAX_SQUARE_LAYOUT*2+1)*(MAX_SQUARE_LAYOUT*2+1)) -#define MAX_SKILLTIMERSKILL 15 -#define MAX_SKILLUNITGROUP 25 -#define MAX_SKILL_ITEM_REQUIRE 10 +#define MAX_SKILL_DB MAX_SKILL +#define MAX_SKILL_PRODUCE_DB 270 +#define MAX_PRODUCE_RESOURCE 10 +#define MAX_SKILL_ARROW_DB 140 +#define MAX_ARROW_RESOURCE 5 +#define MAX_SKILL_ABRA_DB 210 +#define MAX_SKILL_IMPROVISE_DB 30 +#define MAX_SKILL_LEVEL 10 +#define MAX_SKILL_UNIT_LAYOUT 45 +#define MAX_SQUARE_LAYOUT 5 // 11*11 Placement of a maximum unit +#define MAX_SKILL_UNIT_COUNT ((MAX_SQUARE_LAYOUT*2+1)*(MAX_SQUARE_LAYOUT*2+1)) +#define MAX_SKILLTIMERSKILL 15 +#define MAX_SKILLUNITGROUP 25 +#define MAX_SKILL_ITEM_REQUIRE 10 #define MAX_SKILLUNITGROUPTICKSET 25 -#define MAX_SKILL_NAME_LENGTH 30 +#define MAX_SKILL_NAME_LENGTH 30 // (Epoque:) To-do: replace this macro with some sort of skill tree check (rather than hard-coded skill names) #define skill_ischangesex(id) ( \ ((id) >= BD_ADAPTATION && (id) <= DC_SERVICEFORYOU) || ((id) >= CG_ARROWVULCAN && (id) <= CG_MARIONETTE) || \ ((id) >= CG_LONGINGFREEDOM && (id) <= CG_TAROTCARD) || ((id) >= WA_SWING_DANCE && (id) <= WM_UNLIMITED_HUMMING_VOICE)) -#define MAX_SKILL_SPELLBOOK_DB 17 +#define MAX_SKILL_SPELLBOOK_DB 17 #define MAX_SKILL_MAGICMUSHROOM_DB 23 //Walk intervals at which chase-skills are attempted to be triggered. @@ -99,7 +99,7 @@ enum e_skill_inf2 { INF2_GUILD_ONLY = 0x0800, INF2_NO_ENEMY = 0x1000, INF2_NOLP = 0x2000, // Spells that can ignore Land Protector - INF2_CHORUS_SKILL = 0x4000, // Chorus skill + INF2_CHORUS_SKILL = 0x4000, // Chorus skill }; @@ -112,19 +112,19 @@ enum e_skill_display { }; enum { - UF_DEFNOTENEMY = 0x0001, // If 'defunit_not_enemy' is set, the target is changed to 'friend' - UF_NOREITERATION = 0x0002, // Spell cannot be stacked - UF_NOFOOTSET = 0x0004, // Spell cannot be cast near/on targets - UF_NOOVERLAP = 0x0008, // Spell effects do not overlap - UF_PATHCHECK = 0x0010, // Only cells with a shootable path will be placed - UF_NOPC = 0x0020, // May not target players - UF_NOMOB = 0x0040, // May not target mobs - UF_SKILL = 0x0080, // May target skills - UF_DANCE = 0x0100, // Dance - UF_ENSEMBLE = 0x0200, // Duet - UF_SONG = 0x0400, // Song - UF_DUALMODE = 0x0800, // Spells should trigger both ontimer and onplace/onout/onleft effects. - UF_RANGEDSINGLEUNIT = 0x2000 // Hack for ranged layout, only display center + UF_DEFNOTENEMY = 0x0001, // If 'defunit_not_enemy' is set, the target is changed to 'friend' + UF_NOREITERATION = 0x0002, // Spell cannot be stacked + UF_NOFOOTSET = 0x0004, // Spell cannot be cast near/on targets + UF_NOOVERLAP = 0x0008, // Spell effects do not overlap + UF_PATHCHECK = 0x0010, // Only cells with a shootable path will be placed + UF_NOPC = 0x0020, // May not target players + UF_NOMOB = 0x0040, // May not target mobs + UF_SKILL = 0x0080, // May target skills + UF_DANCE = 0x0100, // Dance + UF_ENSEMBLE = 0x0200, // Duet + UF_SONG = 0x0400, // Song + UF_DUALMODE = 0x0800, // Spells should trigger both ontimer and onplace/onout/onleft effects. + UF_RANGEDSINGLEUNIT = 0x2000, // Hack for ranged layout, only display center }; //Returns the cast type of the skill: ground cast, castend damage, castend no damage @@ -1623,14 +1623,14 @@ enum { UNT_MAKIBISHI, UNT_VENOMFOG, UNT_ICEMINE, - UNT_FLAMECROSS, - UNT_HELLBURNING, - UNT_MAGMA_ERUPTION, + UNT_FLAMECROSS, + UNT_HELLBURNING, + UNT_MAGMA_ERUPTION, UNT_KINGS_GRACE, UNT_GLITTERING_GREED, UNT_B_TRAP, UNT_FIRE_RAIN, - + /** * Guild Auras **/ @@ -1638,7 +1638,7 @@ enum { UNT_GD_GLORYWOUNDS = 0xc2, UNT_GD_SOULCOLD = 0xc3, UNT_GD_HAWKEYES = 0xc4, - + UNT_MAX = 0x190 }; @@ -1703,10 +1703,10 @@ struct skill_unit_group { int bg_id; int map; int target_flag; //Holds BCT_* flag for battle_check_target - int bl_flag; //Holds BL_* flag for map_foreachin* functions + int bl_flag; //Holds BL_* flag for map_foreachin* functions int64 tick; int limit,interval; - + uint16 skill_id,skill_lv; int val1,val2,val3; char *valstr; @@ -1724,9 +1724,9 @@ struct skill_unit_group { struct skill_unit { struct block_list bl; - + struct skill_unit_group *group; - + int limit; int val1,val2; short alive,range; @@ -1852,49 +1852,49 @@ struct skill_interface { int unit_temp[20]; // temporary storage for tracking skill unit skill ids as players move in/out of them int unit_group_newid; /* accesssors */ - int (*get_index) ( uint16 skill_id ); - int (*get_type) ( uint16 skill_id ); - int (*get_hit) ( uint16 skill_id ); - int (*get_inf) ( uint16 skill_id ); - int (*get_ele) ( uint16 skill_id, uint16 skill_lv ); - int (*get_nk) ( uint16 skill_id ); - int (*get_max) ( uint16 skill_id ); - int (*get_range) ( uint16 skill_id, uint16 skill_lv ); - int (*get_range2) (struct block_list *bl, uint16 skill_id, uint16 skill_lv); - int (*get_splash) ( uint16 skill_id, uint16 skill_lv ); - int (*get_hp) ( uint16 skill_id, uint16 skill_lv ); - int (*get_mhp) ( uint16 skill_id, uint16 skill_lv ); - int (*get_sp) ( uint16 skill_id, uint16 skill_lv ); - int (*get_state) (uint16 skill_id); - int (*get_spiritball) (uint16 skill_id, uint16 skill_lv); - int (*get_zeny) ( uint16 skill_id, uint16 skill_lv ); - int (*get_num) ( uint16 skill_id, uint16 skill_lv ); - int (*get_cast) ( uint16 skill_id, uint16 skill_lv ); - int (*get_delay) ( uint16 skill_id, uint16 skill_lv ); - int (*get_walkdelay) ( uint16 skill_id, uint16 skill_lv ); - int (*get_time) ( uint16 skill_id, uint16 skill_lv ); - int (*get_time2) ( uint16 skill_id, uint16 skill_lv ); - int (*get_castnodex) ( uint16 skill_id, uint16 skill_lv ); - int (*get_delaynodex) ( uint16 skill_id ,uint16 skill_lv ); - int (*get_castdef) ( uint16 skill_id ); - int (*get_weapontype) ( uint16 skill_id ); - int (*get_ammotype) ( uint16 skill_id ); - int (*get_ammo_qty) ( uint16 skill_id, uint16 skill_lv ); - int (*get_unit_id) (uint16 skill_id,int flag); - int (*get_inf2) ( uint16 skill_id ); - int (*get_castcancel) ( uint16 skill_id ); - int (*get_maxcount) ( uint16 skill_id, uint16 skill_lv ); - int (*get_blewcount) ( uint16 skill_id, uint16 skill_lv ); - int (*get_unit_flag) ( uint16 skill_id ); - int (*get_unit_target) ( uint16 skill_id ); - int (*get_unit_interval) ( uint16 skill_id ); - int (*get_unit_bl_target) ( uint16 skill_id ); - int (*get_unit_layout_type) ( uint16 skill_id ,uint16 skill_lv ); - int (*get_unit_range) ( uint16 skill_id, uint16 skill_lv ); - int (*get_cooldown) ( uint16 skill_id, uint16 skill_lv ); - int (*tree_get_max) ( uint16 skill_id, int b_class ); - const char* (*get_name) ( uint16 skill_id ); - const char* (*get_desc) ( uint16 skill_id ); + int (*get_index) ( uint16 skill_id ); + int (*get_type) ( uint16 skill_id ); + int (*get_hit) ( uint16 skill_id ); + int (*get_inf) ( uint16 skill_id ); + int (*get_ele) ( uint16 skill_id, uint16 skill_lv ); + int (*get_nk) ( uint16 skill_id ); + int (*get_max) ( uint16 skill_id ); + int (*get_range) ( uint16 skill_id, uint16 skill_lv ); + int (*get_range2) (struct block_list *bl, uint16 skill_id, uint16 skill_lv); + int (*get_splash) ( uint16 skill_id, uint16 skill_lv ); + int (*get_hp) ( uint16 skill_id, uint16 skill_lv ); + int (*get_mhp) ( uint16 skill_id, uint16 skill_lv ); + int (*get_sp) ( uint16 skill_id, uint16 skill_lv ); + int (*get_state) (uint16 skill_id); + int (*get_spiritball) (uint16 skill_id, uint16 skill_lv); + int (*get_zeny) ( uint16 skill_id, uint16 skill_lv ); + int (*get_num) ( uint16 skill_id, uint16 skill_lv ); + int (*get_cast) ( uint16 skill_id, uint16 skill_lv ); + int (*get_delay) ( uint16 skill_id, uint16 skill_lv ); + int (*get_walkdelay) ( uint16 skill_id, uint16 skill_lv ); + int (*get_time) ( uint16 skill_id, uint16 skill_lv ); + int (*get_time2) ( uint16 skill_id, uint16 skill_lv ); + int (*get_castnodex) ( uint16 skill_id, uint16 skill_lv ); + int (*get_delaynodex) ( uint16 skill_id ,uint16 skill_lv ); + int (*get_castdef) ( uint16 skill_id ); + int (*get_weapontype) ( uint16 skill_id ); + int (*get_ammotype) ( uint16 skill_id ); + int (*get_ammo_qty) ( uint16 skill_id, uint16 skill_lv ); + int (*get_unit_id) (uint16 skill_id,int flag); + int (*get_inf2) ( uint16 skill_id ); + int (*get_castcancel) ( uint16 skill_id ); + int (*get_maxcount) ( uint16 skill_id, uint16 skill_lv ); + int (*get_blewcount) ( uint16 skill_id, uint16 skill_lv ); + int (*get_unit_flag) ( uint16 skill_id ); + int (*get_unit_target) ( uint16 skill_id ); + int (*get_unit_interval) ( uint16 skill_id ); + int (*get_unit_bl_target) ( uint16 skill_id ); + int (*get_unit_layout_type) ( uint16 skill_id ,uint16 skill_lv ); + int (*get_unit_range) ( uint16 skill_id, uint16 skill_lv ); + int (*get_cooldown) ( uint16 skill_id, uint16 skill_lv ); + int (*tree_get_max) ( uint16 skill_id, int b_class ); + const char *(*get_name) ( uint16 skill_id ); + const char *(*get_desc) ( uint16 skill_id ); /* check */ void (*chk) (uint16* skill_id); /* whether its CAST_GROUND, CAST_DAMAGE or CAST_NODAMAGE */ diff --git a/src/map/status.c b/src/map/status.c index 4b31b9486..e2eede490 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -245,7 +245,7 @@ void initChangeTables(void) { set_sc( NPC_BARRIER , SC_BARRIER , SI_BLANK , SCB_MDEF|SCB_DEF ); add_sc( NPC_DEFENDER , SC_ARMOR ); add_sc( NPC_LICK , SC_STUN ); - set_sc( NPC_HALLUCINATION , SC_ILLUSION , SI_ILLUSION , SCB_NONE ); + set_sc( NPC_HALLUCINATION , SC_ILLUSION , SI_ILLUSION , SCB_NONE ); add_sc( NPC_REBIRTH , SC_REBIRTH ); add_sc( RG_RAID , SC_STUN ); #ifdef RENEWAL @@ -469,8 +469,8 @@ void initChangeTables(void) { set_sc( HAMI_BLOODLUST , SC_HAMI_BLOODLUST , SI_BLANK , SCB_BATK|SCB_WATK ); // Homunculus S - set_sc( MH_LIGHT_OF_REGENE , SC_LIGHT_OF_REGENE , SI_LIGHT_OF_REGENE , SCB_NONE ); - set_sc( MH_OVERED_BOOST , SC_OVERED_BOOST , SI_OVERED_BOOST , SCB_FLEE|SCB_ASPD|SCB_DEF ); + set_sc( MH_LIGHT_OF_REGENE , SC_LIGHT_OF_REGENE , SI_LIGHT_OF_REGENE , SCB_NONE ); + set_sc( MH_OVERED_BOOST , SC_OVERED_BOOST , SI_OVERED_BOOST , SCB_FLEE|SCB_ASPD|SCB_DEF ); add_sc(MH_STAHL_HORN, SC_STUN); set_sc(MH_ANGRIFFS_MODUS, SC_ANGRIFFS_MODUS, SI_ANGRIFFS_MODUS, SCB_BATK | SCB_DEF | SCB_FLEE | SCB_MAXHP); @@ -529,14 +529,14 @@ void initChangeTables(void) { set_sc( RK_DEATHBOUND , SC_DEATHBOUND , SI_DEATHBOUND , SCB_NONE ); set_sc( RK_WINDCUTTER , SC_FEAR , SI_BLANK , SCB_FLEE|SCB_HIT ); add_sc( RK_DRAGONBREATH , SC_BURNING ); - set_sc( RK_MILLENNIUMSHIELD , SC_MILLENNIUMSHIELD , SI_BLANK , SCB_NONE ); + set_sc( RK_MILLENNIUMSHIELD , SC_MILLENNIUMSHIELD , SI_BLANK , SCB_NONE ); set_sc( RK_REFRESH , SC_REFRESH , SI_REFRESH , SCB_NONE ); set_sc( RK_GIANTGROWTH , SC_GIANTGROWTH , SI_GIANTGROWTH , SCB_STR ); set_sc( RK_STONEHARDSKIN , SC_STONEHARDSKIN , SI_STONEHARDSKIN , SCB_NONE ); set_sc( RK_VITALITYACTIVATION, SC_VITALITYACTIVATION, SI_VITALITYACTIVATION, SCB_REGEN ); set_sc( RK_FIGHTINGSPIRIT , SC_FIGHTINGSPIRIT , SI_FIGHTINGSPIRIT , SCB_WATK|SCB_ASPD ); set_sc( RK_ABUNDANCE , SC_ABUNDANCE , SI_ABUNDANCE , SCB_NONE ); - set_sc( RK_CRUSHSTRIKE , SC_CRUSHSTRIKE , SI_CRUSHSTRIKE , SCB_NONE ); + set_sc( RK_CRUSHSTRIKE , SC_CRUSHSTRIKE , SI_CRUSHSTRIKE , SCB_NONE ); add_sc( RK_DRAGONBREATH_WATER, SC_FROSTMISTY ); /** * GC Guillotine Cross @@ -724,25 +724,25 @@ void initChangeTables(void) { set_sc( EL_ROCK_CRUSHER , SC_ROCK_CRUSHER , SI_ROCK_CRUSHER , SCB_DEF ); set_sc( EL_ROCK_CRUSHER_ATK, SC_ROCK_CRUSHER_ATK , SI_ROCK_CRUSHER_ATK , SCB_SPEED ); - add_sc( KO_YAMIKUMO , SC_HIDING ); - set_sc_with_vfx( KO_JYUMONJIKIRI , SC_KO_JYUMONJIKIRI , SI_KO_JYUMONJIKIRI , SCB_NONE ); - add_sc( KO_MAKIBISHI , SC_STUN ); - set_sc( KO_MEIKYOUSISUI , SC_MEIKYOUSISUI , SI_MEIKYOUSISUI , SCB_NONE ); - set_sc( KO_KYOUGAKU , SC_KYOUGAKU , SI_KYOUGAKU , SCB_STR|SCB_AGI|SCB_VIT|SCB_INT|SCB_DEX|SCB_LUK ); - add_sc( KO_JYUSATSU , SC_CURSE ); - set_sc( KO_ZENKAI , SC_ZENKAI , SI_ZENKAI , SCB_NONE ); - set_sc( KO_IZAYOI , SC_IZAYOI , SI_IZAYOI , SCB_MATK ); - set_sc( KG_KYOMU , SC_KYOMU , SI_KYOMU , SCB_NONE ); - set_sc( KG_KAGEMUSYA , SC_KAGEMUSYA , SI_KAGEMUSYA , SCB_NONE ); - set_sc( KG_KAGEHUMI , SC_KG_KAGEHUMI , SI_KG_KAGEHUMI , SCB_NONE ); - set_sc( OB_ZANGETSU , SC_ZANGETSU , SI_ZANGETSU , SCB_MATK|SCB_BATK ); - set_sc_with_vfx( OB_AKAITSUKI , SC_AKAITSUKI , SI_AKAITSUKI , SCB_NONE ); - set_sc( OB_OBOROGENSOU , SC_GENSOU , SI_GENSOU , SCB_NONE ); - - set_sc( ALL_FULL_THROTTLE , SC_FULL_THROTTLE , SI_FULL_THROTTLE , SCB_SPEED|SCB_STR|SCB_AGI|SCB_VIT|SCB_INT|SCB_DEX|SCB_LUK ); - - add_sc( ALL_REVERSEORCISH , SC_ORCISH ); - set_sc( ALL_ANGEL_PROTECT , SC_ANGEL_PROTECT , SI_ANGEL_PROTECT , SCB_REGEN ); + add_sc( KO_YAMIKUMO , SC_HIDING ); + set_sc_with_vfx( KO_JYUMONJIKIRI , SC_KO_JYUMONJIKIRI , SI_KO_JYUMONJIKIRI , SCB_NONE ); + add_sc( KO_MAKIBISHI , SC_STUN ); + set_sc( KO_MEIKYOUSISUI , SC_MEIKYOUSISUI , SI_MEIKYOUSISUI , SCB_NONE ); + set_sc( KO_KYOUGAKU , SC_KYOUGAKU , SI_KYOUGAKU , SCB_STR|SCB_AGI|SCB_VIT|SCB_INT|SCB_DEX|SCB_LUK ); + add_sc( KO_JYUSATSU , SC_CURSE ); + set_sc( KO_ZENKAI , SC_ZENKAI , SI_ZENKAI , SCB_NONE ); + set_sc( KO_IZAYOI , SC_IZAYOI , SI_IZAYOI , SCB_MATK ); + set_sc( KG_KYOMU , SC_KYOMU , SI_KYOMU , SCB_NONE ); + set_sc( KG_KAGEMUSYA , SC_KAGEMUSYA , SI_KAGEMUSYA , SCB_NONE ); + set_sc( KG_KAGEHUMI , SC_KG_KAGEHUMI , SI_KG_KAGEHUMI , SCB_NONE ); + set_sc( OB_ZANGETSU , SC_ZANGETSU , SI_ZANGETSU , SCB_MATK|SCB_BATK ); + set_sc_with_vfx( OB_AKAITSUKI, SC_AKAITSUKI , SI_AKAITSUKI , SCB_NONE ); + set_sc( OB_OBOROGENSOU , SC_GENSOU , SI_GENSOU , SCB_NONE ); + + set_sc( ALL_FULL_THROTTLE , SC_FULL_THROTTLE , SI_FULL_THROTTLE , SCB_SPEED|SCB_STR|SCB_AGI|SCB_VIT|SCB_INT|SCB_DEX|SCB_LUK ); + + add_sc( ALL_REVERSEORCISH , SC_ORCISH ); + set_sc( ALL_ANGEL_PROTECT , SC_ANGEL_PROTECT , SI_ANGEL_PROTECT , SCB_REGEN ); add_sc( NPC_WIDEHEALTHFEAR , SC_FEAR ); add_sc( NPC_WIDEBODYBURNNING , SC_BURNING ); @@ -750,7 +750,7 @@ void initChangeTables(void) { add_sc( NPC_WIDECOLD , SC_COLD ); add_sc( NPC_WIDE_DEEP_SLEEP , SC_DEEP_SLEEP ); add_sc( NPC_WIDESIREN , SC_SIREN ); - + set_sc_with_vfx( GN_ILLUSIONDOPING , SC_ILLUSIONDOPING , SI_ILLUSIONDOPING , SCB_HIT ); // Storing the target job rather than simply SC_SOULLINK simplifies code later on. @@ -1022,32 +1022,32 @@ void initChangeTables(void) { status->ChangeFlagTable[SC_DECORATION_OF_MUSIC] |= SCB_NONE; /* status->DisplayType Table [Ind/Hercules] */ - status->DisplayType[SC_ALL_RIDING] = true; - status->DisplayType[SC_PUSH_CART] = true; - status->DisplayType[SC_SUMMON1] = true; - status->DisplayType[SC_SUMMON2] = true; - status->DisplayType[SC_SUMMON3] = true; - status->DisplayType[SC_SUMMON4] = true; - status->DisplayType[SC_SUMMON5] = true; - status->DisplayType[SC_CAMOUFLAGE] = true; - status->DisplayType[SC_DUPLELIGHT] = true; - status->DisplayType[SC_ORATIO] = true; - status->DisplayType[SC_FROSTMISTY] = true; - status->DisplayType[SC_VENOMIMPRESS] = true; - status->DisplayType[SC_HALLUCINATIONWALK] = true; - status->DisplayType[SC_ROLLINGCUTTER] = true; - status->DisplayType[SC_BANDING] = true; - status->DisplayType[SC_COLD] = true; - status->DisplayType[SC_DEEP_SLEEP] = true; - status->DisplayType[SC_CURSEDCIRCLE_ATKER]= true; - status->DisplayType[SC_CURSEDCIRCLE_TARGET]= true; - status->DisplayType[SC_BLOOD_SUCKER] = true; - status->DisplayType[SC__SHADOWFORM] = true; - status->DisplayType[SC_MONSTER_TRANSFORM] = true; - status->DisplayType[SC_MOONSTAR] = true; - status->DisplayType[SC_SUPER_STAR] = true; - status->DisplayType[SC_STRANGELIGHTS] = true; - status->DisplayType[SC_DECORATION_OF_MUSIC] = true; + status->DisplayType[SC_ALL_RIDING] = true; + status->DisplayType[SC_PUSH_CART] = true; + status->DisplayType[SC_SUMMON1] = true; + status->DisplayType[SC_SUMMON2] = true; + status->DisplayType[SC_SUMMON3] = true; + status->DisplayType[SC_SUMMON4] = true; + status->DisplayType[SC_SUMMON5] = true; + status->DisplayType[SC_CAMOUFLAGE] = true; + status->DisplayType[SC_DUPLELIGHT] = true; + status->DisplayType[SC_ORATIO] = true; + status->DisplayType[SC_FROSTMISTY] = true; + status->DisplayType[SC_VENOMIMPRESS] = true; + status->DisplayType[SC_HALLUCINATIONWALK] = true; + status->DisplayType[SC_ROLLINGCUTTER] = true; + status->DisplayType[SC_BANDING] = true; + status->DisplayType[SC_COLD] = true; + status->DisplayType[SC_DEEP_SLEEP] = true; + status->DisplayType[SC_CURSEDCIRCLE_ATKER] = true; + status->DisplayType[SC_CURSEDCIRCLE_TARGET] = true; + status->DisplayType[SC_BLOOD_SUCKER] = true; + status->DisplayType[SC__SHADOWFORM] = true; + status->DisplayType[SC_MONSTER_TRANSFORM] = true; + status->DisplayType[SC_MOONSTAR] = true; + status->DisplayType[SC_SUPER_STAR] = true; + status->DisplayType[SC_STRANGELIGHTS] = true; + status->DisplayType[SC_DECORATION_OF_MUSIC] = true; #ifdef RENEWAL_EDP // renewal EDP increases your weapon atk @@ -1141,7 +1141,7 @@ int status_damage(struct block_list *src,struct block_list *target,int64 in_hp, /* here onwards we consider it a 32-type, the client does not support higher and from here onwards the value doesn't get thru percentage modifiers */ hp = (int)cap_value(in_hp,INT_MIN,INT_MAX); sp = (int)cap_value(in_sp,INT_MIN,INT_MAX); - + if(sp && !(target->type&BL_CONSUME)) sp = 0; //Not a valid SP target. @@ -1178,10 +1178,12 @@ int status_damage(struct block_list *src,struct block_list *target,int64 in_hp, if( !st->hp ) flag |= 8; +#if 0 // Let through. battle.c/skill.c have the whole logic of when it's possible or // not to hurt someone (and this check breaks pet catching) [Skotlex] - // if (!target->prev && !(flag&2)) - // return 0; //Cannot damage a bl not on a map, except when "charging" hp/sp + if (!target->prev && !(flag&2)) + return 0; //Cannot damage a bl not on a map, except when "charging" hp/sp +#endif // 0 sc = status->get_sc(target); if( hp && battle_config.invincible_nodamage && src && sc && sc->data[SC_INVINCIBLE] && !sc->data[SC_INVINCIBLEOFF] ) @@ -1190,11 +1192,11 @@ int status_damage(struct block_list *src,struct block_list *target,int64 in_hp, if( hp && !(flag&1) ) { if( sc ) { struct status_change_entry *sce; - + #ifdef DEVOTION_REFLECT_DAMAGE if(src && (sce = sc->data[SC_DEVOTION])) { struct block_list *d_bl = map->id2bl(sce->val1); - + if(d_bl &&((d_bl->type == BL_MER && ((TBL_MER *)d_bl)->master && ((TBL_MER *)d_bl)->master->bl.id == target->id) || (d_bl->type == BL_PC && ((TBL_PC *)d_bl)->devotion[sce->val2] == target->id)) && check_distance_bl(target, d_bl, sce->val3)) { clif->damage(d_bl, d_bl, 0, 0, hp, 0, 0, 0); @@ -1204,7 +1206,6 @@ int status_damage(struct block_list *src,struct block_list *target,int64 in_hp, status_change_end(target, SC_DEVOTION, INVALID_TIMER); } #endif - if (sc->data[SC_STONE] && sc->opt1 == OPT1_STONE) status_change_end(target, SC_STONE, INVALID_TIMER); status_change_end(target, SC_FREEZE, INVALID_TIMER); @@ -1268,8 +1269,8 @@ int status_damage(struct block_list *src,struct block_list *target,int64 in_hp, unit->stop_walking( target, 1 ); } - if( st->hp || (flag&8) ) - { //Still lives or has been dead before this damage. + if (st->hp || (flag&8)) { + //Still lives or has been dead before this damage. if (walkdelay) unit->set_walkdelay(target, timer->gettick(), walkdelay, 0); return (int)(hp+sp); @@ -1287,7 +1288,7 @@ int status_damage(struct block_list *src,struct block_list *target,int64 in_hp, case BL_HOM: flag = homun->dead((TBL_HOM*)target); break; case BL_MER: flag = mercenary->dead((TBL_MER*)target); break; case BL_ELEM: flag = elemental->dead((TBL_ELEM*)target); break; - default: //Unhandled case, do nothing to object. + default: //Unhandled case, do nothing to object. flag = 0; break; } @@ -1373,7 +1374,7 @@ int status_heal(struct block_list *bl,int64 in_hp,int64 in_sp, int flag) { /* here onwards we consider it a 32-type, the client does not support higher and from here onwards the value doesn't get thru percentage modifiers */ hp = (int)cap_value(in_hp,INT_MIN,INT_MAX); sp = (int)cap_value(in_sp,INT_MIN,INT_MAX); - + sc = status->get_sc(bl); if (sc && !sc->count) sc = NULL; @@ -1517,13 +1518,12 @@ int status_revive(struct block_list *bl, unsigned char per_hp, unsigned char per if (bl->prev) //Animation only if character is already on a map. clif->resurrection(bl, 1); - + switch (bl->type) { case BL_PC: pc->revive((TBL_PC*)bl, hp, sp); break; case BL_MOB: mob->revive((TBL_MOB*)bl, hp); break; case BL_HOM: homun->revive((TBL_HOM*)bl, hp, sp); break; } - return 1; } @@ -1543,7 +1543,7 @@ int status_fixed_revive(struct block_list *bl, unsigned int per_hp, unsigned int hp = st->max_hp - st->hp; else if (per_hp && !hp) hp = 1; - + if(sp > st->max_sp - st->sp) sp = st->max_sp - st->sp; else if (per_sp && !sp) @@ -1566,9 +1566,9 @@ int status_fixed_revive(struct block_list *bl, unsigned int per_hp, unsigned int * Checks whether the src can use the skill on the target, * taking into account status/option of both source/target. [Skotlex] * flag: -* 0 - Trying to use skill on target. -* 1 - Cast bar is done. -* 2 - Skill already pulled off, check is due to ground-based skills or splash-damage ones. +* 0 - Trying to use skill on target. +* 1 - Cast bar is done. +* 2 - Skill already pulled off, check is due to ground-based skills or splash-damage ones. * src MAY be null to indicate we shouldn't check it, this is a ground-based skill attack. * target MAY Be null, in which case the checks are only to see * whether the source can cast or not the skill on the ground. @@ -1701,12 +1701,13 @@ int status_check_skilluse(struct block_list *src, struct block_list *target, uin } } if ((sc->data[SC_DANCING]->val1&0xFFFF) == CG_HERMODE && skill_id == BD_ADAPTATION) - return 0; //Can't amp out of Wand of Hermode :/ [Skotlex] + return 0; //Can't amp out of Wand of Hermode :/ [Skotlex] } if (skill_id && //Do not block item-casted skills. (src->type != BL_PC || ((TBL_PC*)src)->skillitem != skill_id) - ) { //Skills blocked through status changes... + ) { + //Skills blocked through status changes... if (!flag && ( //Blocked only from using the skill (stuff like autospell may still go through sc->data[SC_SILENCE] || sc->data[SC_STEELBODY] || @@ -1822,7 +1823,8 @@ int status_check_skilluse(struct block_list *src, struct block_list *target, uin } } break; - case BL_ITEM: //Allow targeting of items to pick'em up (or in the case of mobs, to loot them). + case BL_ITEM: + //Allow targeting of items to pick'em up (or in the case of mobs, to loot them). //TODO: Would be nice if this could be used to judge whether the player can or not pick up the item it targets. [Skotlex] if (st->mode&MD_LOOTER) return 1; @@ -1853,7 +1855,7 @@ int status_check_skilluse(struct block_list *src, struct block_list *target, uin int status_check_visibility(struct block_list *src, struct block_list *target) { int view_range; struct status_change *tsc = NULL; - + switch (src->type) { case BL_MOB: view_range = ((TBL_MOB*)src)->min_chase; @@ -1870,7 +1872,7 @@ int status_check_visibility(struct block_list *src, struct block_list *target) { if( src->type == BL_NPC ) /* NPCs don't care for the rest */ return 1; - + if( ( tsc = status->get_sc(target) ) ) { struct status_data *st = status->get_status_data(src); @@ -1899,11 +1901,14 @@ int status_base_amotion_pc(struct map_session_data *sd, struct status_data *st) short mod = -1; switch( sd->weapontype2 ){ // adjustment for dual wielding - case W_DAGGER: mod = 0; break; // 0, 1, 1 + case W_DAGGER: + mod = 0; + break; // 0, 1, 1 case W_1HSWORD: - case W_1HAXE: mod = 1; + case W_1HAXE: + mod = 1; if( (sd->class_&MAPID_THIRDMASK) == MAPID_GUILLOTINE_CROSS ) // 0, 2, 3 - mod = sd->weapontype2 / W_1HSWORD + W_1HSWORD / sd->weapontype2 ; + mod = sd->weapontype2 / W_1HSWORD + W_1HSWORD / sd->weapontype2; } amotion = ( sd->status.weapon < MAX_WEAPON_TYPE && mod < 0 ) @@ -1926,14 +1931,13 @@ int status_base_amotion_pc(struct map_session_data *sd, struct status_data *st) // percentual delay reduction from stats amotion -= amotion * (4*st->agi + st->dex)/1000; #endif - // raw delay adjustment from bAspd bonus amotion += sd->bonus.aspd_add; /* angra manyu disregards aspd_base and similar */ if( sd->equip_index[EQI_HAND_R] >= 0 && sd->status.inventory[sd->equip_index[EQI_HAND_R]].nameid == ITEMID_ANGRA_MANYU ) return 0; - + return amotion; } @@ -2215,8 +2219,8 @@ int status_calc_mob_(struct mob_data* md, enum e_status_calc_opt opt) { status->calc_misc(&md->bl, mstatus, md->level); - if(flag&4) - { // Strengthen Guardians - custom value +10% / lv + if (flag&4) { + // Strengthen Guardians - custom value +10% / lv struct guild_castle *gc; gc=guild->mapname2gc(map->list[md->bl.m].name); if (!gc) @@ -2297,7 +2301,7 @@ int status_calc_pet_(struct pet_data *pd, enum e_status_calc_opt opt) status->calc_misc(&pd->bl, &pd->status, lv); - if (! (opt&SCO_FIRST) ) //Not done the first time because the pet is not visible yet + if (! (opt&SCO_FIRST) ) //Not done the first time because the pet is not visible yet clif->send_petstatus(sd); } } else if ( opt&SCO_FIRST ) { @@ -2396,7 +2400,7 @@ int status_calc_pc_(struct map_session_data* sd, enum e_status_calc_opt opt) { b_max_weight = sd->max_weight; b_cart_weight_max = sd->cart_weight_max; - pc->calc_skilltree(sd); // SkillTree calculation + pc->calc_skilltree(sd); // SkillTree calculation sd->max_weight = status->max_weight_base[pc->class2idx(sd->status.class_)]+sd->status.str*300; @@ -2472,7 +2476,7 @@ int status_calc_pc_(struct map_session_data* sd, enum e_status_calc_opt opt) { clif->sc_end(&sd->bl,sd->bl.id,SELF,SI_CLAIRVOYANCE); memset(&sd->special_state,0,sizeof(sd->special_state)); - + if (!sd->state.permanent_speed) { memset(&bstatus->max_hp, 0, sizeof(struct status_data)-(sizeof(bstatus->hp)+sizeof(bstatus->sp))); bstatus->speed = DEFAULT_WALK_SPEED; @@ -2481,7 +2485,7 @@ int status_calc_pc_(struct map_session_data* sd, enum e_status_calc_opt opt) { memset(&bstatus->max_hp, 0, sizeof(struct status_data)-(sizeof(bstatus->hp)+sizeof(bstatus->sp))); bstatus->speed = pSpeed; } - + //FIXME: Most of these stuff should be calculated once, but how do I fix the memset above to do that? [Skotlex] //Give them all modes except these (useful for clones) bstatus->mode = MD_MASK&~(MD_BOSS|MD_PLANT|MD_DETECTOR|MD_ANGRY|MD_TARGETWEAK); @@ -2569,8 +2573,8 @@ int status_calc_pc_(struct map_session_data* sd, enum e_status_calc_opt opt) { bstatus->def += sd->inventory_data[index]->def; - if(opt&SCO_FIRST && sd->inventory_data[index]->equip_script) - { //Execute equip-script on login + if (opt&SCO_FIRST && sd->inventory_data[index]->equip_script) { + //Execute equip-script on login script->run(sd->inventory_data[index]->equip_script,0,sd->bl.id,0); if (!calculating) return 1; @@ -2620,8 +2624,8 @@ int status_calc_pc_(struct map_session_data* sd, enum e_status_calc_opt opt) { return 1; } - if(sd->status.inventory[index].card[0]==CARD0_FORGE) - { // Forged weapon + if (sd->status.inventory[index].card[0]==CARD0_FORGE) { + // Forged weapon wd->star += (sd->status.inventory[index].card[1]>>8); if(wd->star >= 15) wd->star = 40; // 3 Star Crumbs now give +40 dmg if(pc->famerank(MakeDWord(sd->status.inventory[index].card[2],sd->status.inventory[index].card[3]) ,MAPID_BLACKSMITH)) @@ -2649,7 +2653,8 @@ int status_calc_pc_(struct map_session_data* sd, enum e_status_calc_opt opt) { if(sd->equip_index[EQI_AMMO] >= 0){ index = sd->equip_index[EQI_AMMO]; - if(sd->inventory_data[index]){ // Arrows + if (sd->inventory_data[index]) { + // Arrows sd->bonus.arrow_atk += sd->inventory_data[index]->atk; sd->state.lr_flag = 2; if( !itemdb_is_GNthrowable(sd->inventory_data[index]->nameid) ) //don't run scripts on throwable items @@ -2664,7 +2669,7 @@ int status_calc_pc_(struct map_session_data* sd, enum e_status_calc_opt opt) { for( i = 0; i < sd->combo_count; i++ ) { struct item_combo *combo = itemdb->id2combo(sd->combos[i].id); unsigned char j; - + /** * ensure combo usage is allowed at this location **/ @@ -2677,10 +2682,10 @@ int status_calc_pc_(struct map_session_data* sd, enum e_status_calc_opt opt) { if( k != map->list[sd->bl.m].zone->disabled_items_count ) break; } - + if( j != combo->count ) continue; - + script->run(sd->combos[i].bonus,0,sd->bl.id,0); if (!calculating) //Abort, script->run retriggered this. return 1; @@ -3191,7 +3196,8 @@ int status_calc_pc_(struct map_session_data* sd, enum e_status_calc_opt opt) { sd->subele[ELE_HOLY] += sc->data[SC_PROVIDENCE]->val2; sd->subrace[RC_DEMON] += sc->data[SC_PROVIDENCE]->val2; } - if(sc->data[SC_ARMORPROPERTY]) { //This status change should grant card-type elemental resist. + if(sc->data[SC_ARMORPROPERTY]) { + //This status change should grant card-type elemental resist. sd->subele[ELE_WATER] += sc->data[SC_ARMORPROPERTY]->val1; sd->subele[ELE_EARTH] += sc->data[SC_ARMORPROPERTY]->val2; sd->subele[ELE_FIRE] += sc->data[SC_ARMORPROPERTY]->val3; @@ -3333,7 +3339,7 @@ int status_calc_homunculus_(struct homun_data *hd, enum e_status_calc_opt opt) { homun->calc_skilltree(hd, 0); if((skill_lv=homun->checkskill(hd,HAMI_SKIN)) > 0) - hstatus->def += skill_lv * 4; + hstatus->def += skill_lv * 4; if((skill_lv = homun->checkskill(hd,HVAN_INSTRUCT)) > 0) { hstatus->int_ += 1 +skill_lv/2 +skill_lv/4 +skill_lv/5; @@ -3578,8 +3584,8 @@ void status_calc_regen_rate(struct block_list *bl, struct regen_data *regen, str || sc->data[SC_MAGICMUSHROOM] || sc->data[SC_RAISINGDRAGON] || sc->data[SC_SATURDAY_NIGHT_FEVER] - ) //No regen - regen->flag = 0; + ) + regen->flag = 0; //No regen if ( sc->data[SC_DANCING] || sc->data[SC_OBLIVIONCURSE] || sc->data[SC_MAXIMIZEPOWER] || sc->data[SC_REBOUND] || ( bl->type == BL_PC && (((TBL_PC*)bl)->class_&MAPID_UPPERMASK) == MAPID_MONK @@ -3868,9 +3874,9 @@ void status_calc_bl_main(struct block_list *bl, /*enum scb_flag*/int flag) { } // No status changes alter these yet. - // if(flag&SCB_SIZE) - // if(flag&SCB_RACE) - // if(flag&SCB_RANGE) + //if(flag&SCB_SIZE) + //if(flag&SCB_RACE) + //if(flag&SCB_RANGE) if(flag&SCB_MAXHP) { if( bl->type&BL_PC ) { @@ -3944,7 +3950,7 @@ void status_calc_bl_main(struct block_list *bl, /*enum scb_flag*/int flag) { amotion = (1000 - 2*st->agi - st->dex) * ((TBL_HOM*)bl)->homunculusDB->baseASPD/1000; #else amotion = (1000 - 4*st->agi - st->dex) * ((TBL_HOM*)bl)->homunculusDB->baseASPD/1000; -#endif +#endif st->aspd_rate = status->calc_aspd_rate(bl, sc, bst->aspd_rate); if(st->aspd_rate != 1000) @@ -4013,7 +4019,7 @@ void status_calc_bl_(struct block_list *bl, enum scb_flag flag, enum e_status_ca return; } } - + // remember previous values st = status->get_status_data(bl); memcpy(&bst, st, sizeof(struct status_data)); @@ -4270,7 +4276,7 @@ unsigned short status_calc_agi(struct block_list *bl, struct status_change *sc, if(sc->data[SC_INC_AGI]) agi += sc->data[SC_INC_AGI]->val2; if(sc->data[SC_GS_ACCURACY]) - agi += 4; // added based on skill updates [Reddozen] + agi += 4; // added based on skill updates [Reddozen] if(sc->data[SC_DEC_AGI]) agi -= sc->data[SC_DEC_AGI]->val2; if(sc->data[SC_QUAGMIRE]) @@ -4446,7 +4452,7 @@ unsigned short status_calc_dex(struct block_list *bl, struct status_change *sc, dex >>= 1; } if(sc->data[SC_GS_ACCURACY]) - dex += 4; // added based on skill updates [Reddozen] + dex += 4; // added based on skill updates [Reddozen] if(sc->data[SC_MARIONETTE_MASTER]) dex -= ((sc->data[SC_MARIONETTE_MASTER]->val4)>>8)&0xFF; if(sc->data[SC_MARIONETTE]) @@ -4578,9 +4584,10 @@ unsigned short status_calc_batk(struct block_list *bl, struct status_change *sc, batk -= batk * 25/100; if( sc->data[SC_ZANGETSU] ) batk += sc->data[SC_ZANGETSU]->val2; - //Curse shouldn't effect on this? <- Curse OR Bleeding?? - // if(sc->data[SC_BLOODING]) - // batk -= batk * 25/100; +#if 0 //Curse shouldn't effect on this? <- Curse OR Bleeding?? + if(sc->data[SC_BLOODING]) + batk -= batk * 25/100; +#endif // 0 if(sc->data[SC_HLIF_FLEET]) batk += batk * sc->data[SC_HLIF_FLEET]->val3/100; if(sc->data[SC__ENERVATION]) @@ -4838,7 +4845,7 @@ signed short status_calc_hit(struct block_list *bl, struct status_change *sc, in hit /= 2; if(sc->data[SC_ILLUSIONDOPING]) hit -= hit * (5 + sc->data[SC_ILLUSIONDOPING]->val1) / 100; //custom - + return (short)cap_value(hit,1,SHRT_MAX); } @@ -4923,7 +4930,7 @@ signed short status_calc_flee(struct block_list *bl, struct status_change *sc, i if(status_get_element(bl) == ELE_WATER) //water type flee /= 2; } - + if( sc->data[SC_OVERED_BOOST] ) // should be final and unmodifiable by any means flee = sc->data[SC_OVERED_BOOST]->val2; @@ -4981,7 +4988,7 @@ defType status_calc_def(struct block_list *bl, struct status_change *sc, int def if(sc->data[SC_STEELBODY]) return 90; #endif - + if(sc->data[SC_STONEHARDSKIN]) def += sc->data[SC_STONEHARDSKIN]->val1; if(sc->data[SC_DRUMBATTLE]) @@ -4989,7 +4996,7 @@ defType status_calc_def(struct block_list *bl, struct status_change *sc, int def if(sc->data[SC_STONESKIN]) def += sc->data[SC_STONESKIN]->val2; - if(sc->data[SC_HAMI_DEFENCE]) //[orn] + if(sc->data[SC_HAMI_DEFENCE]) //[orn] def += sc->data[SC_HAMI_DEFENCE]->val2; if(sc->data[SC_EARTH_INSIGNIA] && sc->data[SC_EARTH_INSIGNIA]->val1 == 2) @@ -5307,7 +5314,7 @@ unsigned short status_calc_speed(struct block_list *bl, struct status_change *sc if( sc->data[SC__GROOMY] ) val = max( val, sc->data[SC__GROOMY]->val2); if( sc->data[SC_GLOOMYDAY] ) - val = max( val, sc->data[SC_GLOOMYDAY]->val3 ); // Should be 50 (-50% speed) + val = max( val, sc->data[SC_GLOOMYDAY]->val3 ); // Should be 50 (-50% speed) if( sc->data[SC_STEALTHFIELD_MASTER] ) val = max( val, 30 ); if( sc->data[SC_BANDING_DEFENCE] ) @@ -5517,7 +5524,7 @@ short status_calc_aspd(struct block_list *bl, struct status_change *sc, short fl skills2 += sc->data[SC_GS_GATLINGFEVER]->val1; if( sc->data[SC_STAR_COMFORT] ) skills2 += 3 * sc->data[SC_STAR_COMFORT]->val1; - + return ( flag&1? (skills1 + pots) : skills2 ); #else return 0; @@ -5899,8 +5906,8 @@ const char* status_get_name(struct block_list *bl) { /*========================================== * Get the class of the current bl * return -* 0 = fail -* class_id = success +* 0 = fail +* class_id = success *------------------------------------------*/ int status_get_class(struct block_list *bl) { nullpo_ret(bl); @@ -5918,8 +5925,8 @@ int status_get_class(struct block_list *bl) { /*========================================== * Get the base level of the current bl * return -* 1 = fail -* level = success +* 1 = fail +* level = success *------------------------------------------*/ int status_get_lv(struct block_list *bl) { nullpo_ret(bl); @@ -6093,7 +6100,7 @@ int status_get_emblem_id(struct block_list *bl) { case BL_MOB: { struct map_session_data *msd; struct mob_data *md = (struct mob_data *)bl; - if (md->guardian_data) //Guardian's guild [Skotlex] + if (md->guardian_data) //Guardian's guild [Skotlex] return (md->guardian_data->g) ? md->guardian_data->g->emblem_id:0; if (md->special_state.ai && (msd = map->id2sd(md->master_id)) != NULL) return msd->guild_emblem_id; //Alchemist's mobs [Skotlex] @@ -6195,7 +6202,8 @@ void status_set_viewdata(struct block_list *bl, int class_) TBL_PC* sd = (TBL_PC*)bl; if (pcdb_checkid(class_)) { if (pc_isridingpeco(sd)) { - switch (class_) { //Adapt class to a Mounted one. + switch (class_) { + //Adapt class to a Mounted one. case JOB_KNIGHT: class_ = JOB_KNIGHT2; break; @@ -6280,7 +6288,7 @@ void status_set_viewdata(struct block_list *bl, int class_) ShowError("status_set_viewdata (NPC): No view data for class %d\n", class_); } break; - case BL_HOM: //[blackhole89] + case BL_HOM: //[blackhole89] { struct homun_data *hd = (struct homun_data*)bl; if (vd) @@ -6350,7 +6358,7 @@ int status_get_sc_def(struct block_list *src, struct block_list *bl, enum sc_typ struct map_session_data *sd; nullpo_ret(bl); - + if(!src) return tick ? tick : 1; // If no source, it can't be resisted (NPC given) @@ -6692,19 +6700,19 @@ int status_get_sc_def(struct block_list *src, struct block_list *bl, enum sc_typ void status_display_add(struct map_session_data *sd, enum sc_type type, int dval1, int dval2, int dval3) { struct sc_display_entry *entry; int i; - + for( i = 0; i < sd->sc_display_count; i++ ) { if( sd->sc_display[i]->type == type ) break; } - + if( i != sd->sc_display_count ) { sd->sc_display[i]->val1 = dval1; sd->sc_display[i]->val2 = dval2; sd->sc_display[i]->val3 = dval3; return; } - + entry = ers_alloc(pc->sc_display_ers, struct sc_display_entry); entry->type = type; @@ -6791,8 +6799,10 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t struct mob_data *md = BL_CAST(BL_MOB,bl); if(md && (md->class_ == MOBID_EMPERIUM || mob_is_battleground(md)) && type != SC_SAFETYWALL && type != SC_PNEUMA) return 0; //Emperium/BG Monsters can't be afflicted by status changes - //if(md && mob_is_gvg(md) && status->sc2scb_flag(type)&SCB_MAXHP) - // return 0; //prevent status addinh hp to gvg mob (like bloodylust=hp*3 etc... +#if 0 + if(md && mob_is_gvg(md) && status->sc2scb_flag(type)&SCB_MAXHP) + return 0; //prevent status addinh hp to gvg mob (like bloodylust=hp*3 etc... +#endif // 0 } if( sc->data[SC_REFRESH] ) { @@ -7146,7 +7156,7 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t { // it doesn't stack or even renewed int i = SC_TOXIN; for(; i<= SC_LEECHESEND; i++) - if(sc->data[i]) return 0; + if(sc->data[i]) return 0; } break; case SC_MAGNETICFIELD: @@ -7296,8 +7306,8 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t status_change_end(bl, SC_ASSUMPTIO, INVALID_TIMER); break; case SC_CARTBOOST: - if(sc->data[SC_DEC_AGI] || sc->data[SC_ADORAMUS]) - { //Cancel Decrease Agi, but take no further effect [Skotlex] + if (sc->data[SC_DEC_AGI] || sc->data[SC_ADORAMUS]) { + //Cancel Decrease Agi, but take no further effect [Skotlex] status_change_end(bl, SC_DEC_AGI, INVALID_TIMER); status_change_end(bl, SC_ADORAMUS, INVALID_TIMER); return 0; @@ -7599,7 +7609,7 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t tick_time = val2 = tick>0?tick:60000; tick = -1; // duration sent to the client should be infinite break; - case SC_EDP: // [Celest] + case SC_EDP: // [Celest] val2 = val1 + 2; //Chance to Poison enemies. val3 = 50*(val1+1); //Damage increase (+50 +50*lv%) #ifdef RENEWAL_EDP @@ -7639,7 +7649,7 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t tick = -1; break; case SC_ENCHANTPOISON: - val2= 250+50*val1; //Poisoning Chance (2.5+0.5%) in 1/10000 rate + val2= 250+50*val1; //Poisoning Chance (2.5+0.5%) in 1/10000 rate case SC_ASPERSIO: case SC_PROPERTYFIRE: case SC_PROPERTYWATER: @@ -7888,12 +7898,12 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t //val4&1 signals the presence of a wall. //val4&2 makes cloak not end on normal attacks [Skotlex] //val4&4 makes cloak not end on using skills - if (bl->type == BL_PC || (bl->type == BL_MOB && ((TBL_MOB*)bl)->special_state.clone) ) //Standard cloaking. + if (bl->type == BL_PC || (bl->type == BL_MOB && ((TBL_MOB*)bl)->special_state.clone) ) //Standard cloaking. val4 |= battle_config.pc_cloak_check_type&7; else val4 |= battle_config.monster_cloak_check_type&7; break; - case SC_SIGHT: /* splash status */ + case SC_SIGHT: /* splash status */ case SC_RUWACH: case SC_WZ_SIGHTBLASTER: val3 = skill->get_splash(val2, val1); //Val2 should bring the skill-id. @@ -8167,7 +8177,7 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t case SC_KAAHI: val2 = 200*val1; //HP heal val3 = 5*val1; //SP cost - val4 = INVALID_TIMER; //Kaahi Timer. + val4 = INVALID_TIMER; //Kaahi Timer. break; case SC_BLESSING: if ((!undead_flag && st->race!=RC_DEMON) || bl->type == BL_PC) @@ -8303,7 +8313,7 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t //2. Set restore point (val3 -> return map, val4 return coords val3 = map_index; val4 = pos; - } else if (!val3 + } else if (!val3 || val3 == sd->mapindex || !sd->sc.data[SC_JAILED] // If player is being jailed and is already in jail (issue: 8206) ) { //Use save point. @@ -8357,11 +8367,12 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t break; case SC_STONESKIN: - if (val2 == NPC_ANTIMAGIC) - { //Boost mdef + if (val2 == NPC_ANTIMAGIC) { + //Boost mdef val2 =-20; val3 = 20; - } else { //Boost def + } else { + //Boost def val2 = 20; val3 =-20; } @@ -8825,7 +8836,7 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t case SC_HEATER_OPTION: val2 = 120; // Watk. TODO: Renewal (Atk2) val3 = (sd ? sd->status.job_level : 0); // % Increase damage. - val4 = 3; // Change into fire element. + val4 = 3; // Change into fire element. break; case SC_TROPIC_OPTION: val2 = 180; // Watk. TODO: Renewal (Atk2) @@ -8835,16 +8846,16 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t val2 = 40; break; case SC_COOLER_OPTION: - val2 = 80; // Bonus Matk + val2 = 80; // Bonus Matk val3 = (sd ? sd->status.job_level : 0); // % Freezing chance - val4 = 1; // Change into water elemet + val4 = 1; // Change into water elemet break; case SC_CHILLY_AIR_OPTION: val2 = 120; // Matk. TODO: Renewal (Matk1) val3 = MG_COLDBOLT; break; case SC_WIND_STEP_OPTION: - val2 = 50; // % Increase speed and flee. + val2 = 50; // % Increase speed and flee. break; case SC_BLAST_OPTION: val2 = (sd ? sd->status.job_level : 0); // % Increase damage @@ -8876,7 +8887,7 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t case SC_WATER_DROP_OPTION: case SC_WIND_CURTAIN_OPTION: case SC_STONE_SHIELD_OPTION: - val2 = 100; // Elemental modifier. + val2 = 100; // Elemental modifier. break; case SC_TROPIC: case SC_CHILLY_AIR: @@ -8908,10 +8919,10 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t tick_time = val3; break; case SC_WATER_BARRIER: - val3 = 20; // Reductions. Atk2, Flee1 + val3 = 20; // Reductions. Atk2, Flee1 break; case SC_ZEPHYR: - val2 = 25; // Flee. + val2 = 25; // Flee. break; case SC_TIDAL_WEAPON: val2 = 20; // Increase Elemental's attack. @@ -8926,7 +8937,7 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t val1 = 15; break; case SC_STOMACHACHE: - val2 = 8; // SP consume. + val2 = 8; // SP consume. val4 = tick / 10000; tick_time = 10000; // [GodLesZ] tick time break; @@ -9061,8 +9072,8 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t val2 = 20+(20*val1); break; default: - if( calc_flag == SCB_NONE && status->SkillChangeTable[type] == 0 && status->IconChangeTable[type] == 0 ) - { //Status change with no calc, no icon, and no skill associated...? + if (calc_flag == SCB_NONE && status->SkillChangeTable[type] == 0 && status->IconChangeTable[type] == 0) { + //Status change with no calc, no icon, and no skill associated...? ShowError("UnknownStatusChange [%d]\n", type); return 0; } @@ -9213,7 +9224,7 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t val_flag |= 1; break; } - + /* [Ind/Hercules] */ if( sd && status->DisplayType[type] ) { int dval1 = 0, dval2 = 0, dval3 = 0; @@ -9317,13 +9328,13 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t opt_flag = 1; switch(type) { //OPT1 - case SC_STONE: sc->opt1 = OPT1_STONEWAIT; break; - case SC_FREEZE: sc->opt1 = OPT1_FREEZE; break; - case SC_STUN: sc->opt1 = OPT1_STUN; break; - case SC_SLEEP: sc->opt1 = OPT1_SLEEP; break; - case SC_BURNING: sc->opt1 = OPT1_BURNING; break; // Burning need this to be showed correctly. [pakpil] - case SC_WHITEIMPRISON: sc->opt1 = OPT1_IMPRISON; break; - case SC_COLD: sc->opt1 = OPT1_CRYSTALIZE; break; + case SC_STONE: sc->opt1 = OPT1_STONEWAIT; break; + case SC_FREEZE: sc->opt1 = OPT1_FREEZE; break; + case SC_STUN: sc->opt1 = OPT1_STUN; break; + case SC_SLEEP: sc->opt1 = OPT1_SLEEP; break; + case SC_BURNING: sc->opt1 = OPT1_BURNING; break; // Burning need this to be showed correctly. [pakpil] + case SC_WHITEIMPRISON: sc->opt1 = OPT1_IMPRISON; break; + case SC_COLD: sc->opt1 = OPT1_CRYSTALIZE; break; //OPT2 case SC_POISON: sc->opt2 |= OPT2_POISON; break; case SC_CURSE: sc->opt2 |= OPT2_CURSE; break; @@ -9349,7 +9360,7 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t break; case SC_OVERTHRUSTMAX: case SC_OVERTHRUST: - case SC_SWOO: //Why does it shares the same opt as Overthrust? Perhaps we'll never know... + case SC_SWOO: //Why does it shares the same opt as Overthrust? Perhaps we'll never know... sc->opt3 |= OPT3_OVERTHRUST; opt_flag = 0; break; @@ -9385,10 +9396,12 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t opt_flag = 0; sc->opt3 |= OPT3_BERSERK; break; -// case ???: // doesn't seem to do anything -// sc->opt3 |= OPT3_LIGHTBLADE; -// opt_flag = 0; -// break; +#if 0 + case ???: // doesn't seem to do anything + sc->opt3 |= OPT3_LIGHTBLADE; + opt_flag = 0; + break; +#endif // 0 case SC_DANCING: if ((val1&0xFFFF) == CG_MOONLIT) sc->opt3 |= OPT3_MOONLIT; @@ -9423,10 +9436,12 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t sc->opt3 |= OPT3_UNDEAD; opt_flag = 0; break; -// case ???: // from DA_CONTRACT (looks like biolab mobs aura) -// sc->opt3 |= OPT3_CONTRACT; -// opt_flag = 0; -// break; +#if 0 + case ???: // from DA_CONTRACT (looks like biolab mobs aura) + sc->opt3 |= OPT3_CONTRACT; + opt_flag = 0; + break; +#endif // 0 //OPTION case SC_HIDING: sc->option |= OPTION_HIDE; @@ -9492,7 +9507,8 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t clif->changelook(bl,LOOK_CLOTHES_COLOR,vd->cloth_color); } } - if (calc_flag&SCB_DYE) { //Reset DYE color + if (calc_flag&SCB_DYE) { + //Reset DYE color if (vd && vd->cloth_color) { val4 = vd->cloth_color; clif->changelook(bl,LOOK_CLOTHES_COLOR,0); @@ -9694,7 +9710,7 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const #ifdef ANTI_MAYAP_CHEAT bool invisible = false; #endif - + nullpo_ret(bl); sc = status->get_sc(bl); @@ -9710,7 +9726,7 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const if( sd && sce->timer == INVALID_TIMER && !sd->state.loggingout ) chrif->del_scdata_single(sd->status.account_id,sd->status.char_id,type); - + if (tid == INVALID_TIMER) { if (type == SC_ENDURE && sce->val4) //Do not end infinite endure. @@ -10333,10 +10349,12 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const opt_flag = 0; sc->opt3 &= ~OPT3_BERSERK; break; - // case ???: // doesn't seem to do anything - // sc->opt3 &= ~OPT3_LIGHTBLADE; - // opt_flag = 0; - // break; +#if 0 + case ???: // doesn't seem to do anything + sc->opt3 &= ~OPT3_LIGHTBLADE; + opt_flag = 0; + break; +#endif // 0 case SC_DANCING: if ((sce->val1&0xFFFF) == CG_MOONLIT) sc->opt3 &= ~OPT3_MOONLIT; @@ -10371,10 +10389,12 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const sc->opt3 &= ~OPT3_UNDEAD; opt_flag = 0; break; - // case ???: // from DA_CONTRACT (looks like biolab mobs aura) - // sc->opt3 &= ~OPT3_CONTRACT; - // opt_flag = 0; - // break; +#if 0 + case ???: // from DA_CONTRACT (looks like biolab mobs aura) + sc->opt3 &= ~OPT3_CONTRACT; + opt_flag = 0; + break; +#endif // 0 default: opt_flag = 0; } @@ -10608,10 +10628,11 @@ int status_change_timer(int tid, int64 tick, int id, intptr_t data) { case SC_KNOWLEDGE: if (!sd) break; - if(bl->m == sd->feel_map[0].m || - bl->m == sd->feel_map[1].m || - bl->m == sd->feel_map[2].m) - { //Timeout will be handled by pc->setpos + if (bl->m == sd->feel_map[0].m + || bl->m == sd->feel_map[1].m + || bl->m == sd->feel_map[2].m + ) { + //Timeout will be handled by pc->setpos sce->timer = INVALID_TIMER; return 0; } @@ -10741,12 +10762,13 @@ int status_change_timer(int tid, int64 tick, int id, intptr_t data) { break; case SC_SPLASHER: - // custom Venom Splasher countdown timer - //if (sce->val4 % 1000 == 0) { - // char counter[10]; - // snprintf (counter, 10, "%d", sce->val4/1000); - // clif->message(bl, counter); - //} +#if 0 // custom Venom Splasher countdown timer + if (sce->val4 % 1000 == 0) { + char counter[10]; + snprintf (counter, 10, "%d", sce->val4/1000); + clif->message(bl, counter); + } +#endif // 0 if((sce->val4 -= 500) > 0) { sc_timer_next(500 + tick, status->change_timer, bl->id, data); return 0; @@ -11163,7 +11185,7 @@ int status_change_timer(int tid, int64 tick, int id, intptr_t data) { if(--(sce->val4) >= 0) { // 1% SP Upkeep Cost int sp = st->max_sp / 100; - + if( st->sp <= sp ) status_change_end(bl,SC_STEALTHFIELD_MASTER,INVALID_TIMER); @@ -11423,9 +11445,9 @@ unsigned short status_get_rand_matk( unsigned short matk_max, unsigned short mat /** * Get bl's matk_max and matk_min values depending on flag * @param flag - * 0 - Get MATK - * 1 - Get MATK w/o SC bonuses - * 3 - Get MATK w/o EATK & SC bonuses + * 0 - Get MATK + * 1 - Get MATK w/o SC bonuses + * 3 - Get MATK w/o EATK & SC bonuses **/ void status_get_matk_sub( struct block_list *bl, int flag, unsigned short *matk_max, unsigned short *matk_min ) { struct status_data *st; @@ -11496,9 +11518,9 @@ void status_get_matk_sub( struct block_list *bl, int flag, unsigned short *matk_ /** * Get bl's matk value depending on flag * @param flag [malufett] - * 1 - Get MATK w/o SC bonuses - * 2 - Get modified MATK - * 3 - Get MATK w/o eATK & SC bonuses + * 1 - Get MATK w/o SC bonuses + * 2 - Get modified MATK + * 3 - Get MATK w/o eATK & SC bonuses * @retval 1 failure * @retval MATK success * @@ -12231,7 +12253,7 @@ void status_defaults(void) { status->readdb = status_readdb; status->init = do_init_status; status->final = do_final_status; - + status->initChangeTables = initChangeTables; status->initDummyData = initDummyData; status->base_amotion_pc = status_base_amotion_pc; diff --git a/src/map/status.h b/src/map/status.h index aca26b1af..00c243543 100644 --- a/src/map/status.h +++ b/src/map/status.h @@ -102,7 +102,7 @@ typedef enum sc_type { SC_BURNING, SC_DEEP_SLEEP, SC_COMMON_MAX = 14, // end - + //Next up, we continue on 20, to leave enough room for additional "common" ailments in the future. SC_PROVOKE = 20, SC_ENDURE, @@ -267,7 +267,7 @@ typedef enum sc_type { SC_DONTFORGETME, //180 SC_FORTUNE, SC_SERVICEFORYOU, - SC_STOP, //Prevents inflicted chars from walking. [Skotlex] + SC_STOP, //Prevents inflicted chars from walking. [Skotlex] SC_STRUP, SC_SOULLINK, SC_COMA, //Not a real SC_, it makes a char's HP/SP hit 1. @@ -324,7 +324,7 @@ typedef enum sc_type { SC_NJ_SUITON, SC_NJ_NEN, SC_KNOWLEDGE, - SC_SMA_READY, //240 + SC_SMA_READY, //240 SC_FLING, SC_HLIF_AVOID, SC_HLIF_CHANGE, @@ -334,7 +334,7 @@ typedef enum sc_type { SC_HAMI_DEFENCE, SC_INCASPDRATE, SC_PLUSAVOIDVALUE, - SC_JAILED, //250 + SC_JAILED, //250 SC_ENCHANTARMS, SC_MAGICALATTACK, SC_STONESKIN, @@ -679,7 +679,7 @@ typedef enum sc_type { SC_ZANGETSU, SC_GENSOU, SC_AKAITSUKI, - + //homon S SC_STYLE_CHANGE, SC_GOLDENE_FERSE, // 540 @@ -705,13 +705,13 @@ typedef enum sc_type { SC_TELEKINESIS_INTENSE, SC_OFFERTORIUM, SC_FRIGG_SONG, // 560 - + SC_ALL_RIDING, SC_HANBOK, SC_MONSTER_TRANSFORM, SC_ANGEL_PROTECT, SC_ILLUSIONDOPING, - + SC_MTF_ASPD, SC_MTF_RANGEATK, SC_MTF_MATK, @@ -724,10 +724,10 @@ typedef enum sc_type { SC_OKTOBERFEST, SC_STRANGELIGHTS, SC_DECORATION_OF_MUSIC, - + SC__MAELSTROM, SC__CHAOS, - + SC__FEINTBOMB_MASTER, SC_FALLENEMPIRE, SC_FLASHCOMBO, // 580 @@ -1494,21 +1494,21 @@ enum si_type { //SI_ = 735, SI_CHILL = 736, SI_BURNT = 737, -// SI_PCCAFE_PLAY_TIME = 738, -// SI_TWISTED_TIME = 739, + //SI_PCCAFE_PLAY_TIME = 738, + //SI_TWISTED_TIME = 739, SI_FLASHCOMBO = 740, -// SI_JITTER_BUFF1 = 741, -// SI_JITTER_BUFF2 = 742, -// SI_JITTER_BUFF3 = 743, -// SI_JITTER_BUFF4 = 744, -// SI_JITTER_BUFF5 = 745, -// SI_JITTER_BUFF6 = 746, -// SI_JITTER_BUFF7 = 747, -// SI_JITTER_BUFF8 = 748, -// SI_JITTER_BUFF9 = 749, -// SI_JITTER_BUFF10 = 750, -// SI_CUP_OF_BOZA = 751, + //SI_JITTER_BUFF1 = 741, + //SI_JITTER_BUFF2 = 742, + //SI_JITTER_BUFF3 = 743, + //SI_JITTER_BUFF4 = 744, + //SI_JITTER_BUFF5 = 745, + //SI_JITTER_BUFF6 = 746, + //SI_JITTER_BUFF7 = 747, + //SI_JITTER_BUFF8 = 748, + //SI_JITTER_BUFF9 = 749, + //SI_JITTER_BUFF10 = 750, + //SI_CUP_OF_BOZA = 751, SI_B_TRAP = 752, SI_E_CHAIN = 753, SI_E_QD_SHOT_READY = 754, @@ -1534,38 +1534,38 @@ enum si_type { SI_PACKING_ENVELOPE9 = 774, SI_PACKING_ENVELOPE10 = 775, SI_GLASTHEIM_TRANS = 776, -// SI_ZONGZI_POUCH_TRANS = 777, + //SI_ZONGZI_POUCH_TRANS = 777, SI_HEAT_BARREL_AFTER = 778, SI_DECORATION_OF_MUSIC = 779, -// SI_OVERSEAEXPUP = 780, -// SI_CLOWN_N_GYPSY_CARD = 781, -// SI_OPEN_NPC_MARKET = 782, -// SI_BEEF_RIB_STEW = 783, -// SI_PORK_RIB_STEW = 784, -// SI_CHUSEOK_MONDAY = 785, -// SI_CHUSEOK_TUESDAY = 786, -// SI_CHUSEOK_WEDNESDAY = 787, -// SI_CHUSEOK_THURSDAY = 788, -// SI_CHUSEOK_FRIDAY = 789, -// SI_CHUSEOK_WEEKEND = 790, -// SI_ALL_LIGHTGUARD = 791, -// SI_ALL_LIGHTGUARD_COOL_TIME = 792, -// SI_MTF_MHP = 793, -// SI_MTF_MSP = 794, -// SI_MTF_PUMPKIN = 795, -// SI_MTF_HITFLEE = 796, -// SI_MTF_CRIDAMAGE2 = 797, -// SI_MTF_SPDRAIN = 798, -// SI_ACUO_MINT_GUM = 799, -// ... -// SI_GUILD_STORAGE = 810, -// ... -// SI_JUMPINGCLAN = 815, -// ... -// SI_MTF_RANGEATK2 = 818, -// SI_MTF_ASPD2 = 819, -// SI_MTF_MATK2 = 820, + //SI_OVERSEAEXPUP = 780, + //SI_CLOWN_N_GYPSY_CARD = 781, + //SI_OPEN_NPC_MARKET = 782, + //SI_BEEF_RIB_STEW = 783, + //SI_PORK_RIB_STEW = 784, + //SI_CHUSEOK_MONDAY = 785, + //SI_CHUSEOK_TUESDAY = 786, + //SI_CHUSEOK_WEDNESDAY = 787, + //SI_CHUSEOK_THURSDAY = 788, + //SI_CHUSEOK_FRIDAY = 789, + //SI_CHUSEOK_WEEKEND = 790, + //SI_ALL_LIGHTGUARD = 791, + //SI_ALL_LIGHTGUARD_COOL_TIME = 792, + //SI_MTF_MHP = 793, + //SI_MTF_MSP = 794, + //SI_MTF_PUMPKIN = 795, + //SI_MTF_HITFLEE = 796, + //SI_MTF_CRIDAMAGE2 = 797, + //SI_MTF_SPDRAIN = 798, + //SI_ACUO_MINT_GUM = 799, + // ... + //SI_GUILD_STORAGE = 810, + // ... + //SI_JUMPINGCLAN = 815, + // ... + //SI_MTF_RANGEATK2 = 818, + //SI_MTF_ASPD2 = 819, + //SI_MTF_MATK2 = 820, SI_MAX, }; @@ -1681,18 +1681,18 @@ enum { OPTION_DRAGON5 = 0x04000000, OPTION_HANBOK = 0x08000000, OPTION_OKTOBERFEST = 0x10000000, - + #ifndef NEW_CARTS OPTION_CART1 = 0x00000008, OPTION_CART2 = 0x00000080, OPTION_CART3 = 0x00000100, OPTION_CART4 = 0x00000200, OPTION_CART5 = 0x00000400, - + /* compound constant for older carts */ OPTION_CART = OPTION_CART1|OPTION_CART2|OPTION_CART3|OPTION_CART4|OPTION_CART5, #endif - + // compound constants OPTION_DRAGON = OPTION_DRAGON1|OPTION_DRAGON2|OPTION_DRAGON3|OPTION_DRAGON4|OPTION_DRAGON5, OPTION_COSTUME = OPTION_WEDDING|OPTION_XMAS|OPTION_SUMMER|OPTION_HANBOK|OPTION_OKTOBERFEST, @@ -1825,7 +1825,7 @@ struct regen_data_sub { struct { unsigned int hp,sp; } tick; - + //Regen rates (where every 1 means +100% regen) struct { unsigned char hp,sp; @@ -1842,18 +1842,18 @@ struct regen_data { struct { unsigned int hp,sp,shp,ssp; } tick; - + //Regen rates (where every 1 means +100% regen) struct { unsigned char hp,sp,shp,ssp; } rate; - + struct { - unsigned walk:1; //Can you regen even when walking? - unsigned gc:1; //Tags when you should have double regen due to GVG castle + unsigned walk:1; //Can you regen even when walking? + unsigned gc:1; //Tags when you should have double regen due to GVG castle unsigned overweight :2; //overweight state (1: 50%, 2: 90%) - unsigned block :2; //Block regen flag (1: Hp, 2: Sp) + unsigned block :2; //Block regen flag (1: Hp, 2: Sp) } state; //skill-regen, sitting-skill-regen (since not all chars with regen need it) @@ -2069,7 +2069,7 @@ struct status_interface { int (*get_matk) (struct block_list *src, int flag); void (*update_matk) ( struct block_list *bl ); int (*readdb) (void); - + void (*initChangeTables) (void); void (*initDummyData) (void); int (*base_amotion_pc) (struct map_session_data *sd, struct status_data *st); diff --git a/src/map/storage.c b/src/map/storage.c index 523f64cc8..755f50cb7 100644 --- a/src/map/storage.c +++ b/src/map/storage.c @@ -85,13 +85,13 @@ int storage_storageopen(struct map_session_data *sd) if(sd->state.storage_flag) return 1; //Already open? - - if( !pc_can_give_items(sd) ) - { //check is this GM level is allowed to put items to storage + + if( !pc_can_give_items(sd) ) { + //check is this GM level is allowed to put items to storage clif->message(sd->fd, msg_txt(246)); return 1; } - + sd->state.storage_flag = 1; storage->sortitem(sd->status.storage.items, ARRAYLENGTH(sd->status.storage.items)); clif->storagelist(sd, sd->status.storage.items, ARRAYLENGTH(sd->status.storage.items)); @@ -128,7 +128,7 @@ int storage_additem(struct map_session_data* sd, struct item* item_data, int amo if( item_data->nameid <= 0 || amount <= 0 ) return 1; - + data = itemdb->search(item_data->nameid); if( data->stack.storage && amount > data->stack.amount ) @@ -136,12 +136,12 @@ int storage_additem(struct map_session_data* sd, struct item* item_data, int amo return 1; } - if( !itemdb_canstore(item_data, pc_get_group_level(sd)) ) - { //Check if item is storable. [Skotlex] + if (!itemdb_canstore(item_data, pc_get_group_level(sd))) { + //Check if item is storable. [Skotlex] clif->message (sd->fd, msg_txt(264)); return 1; } - + if( item_data->bound > IBT_ACCOUNT && !pc_can_give_bound_items(sd) ) { clif->message(sd->fd, msg_txt(294)); return 1; @@ -200,8 +200,8 @@ int storage_delitem(struct map_session_data* sd, int n, int amount) * Add an item to the storage from the inventory. * @index : inventory idx * return - * 0 : fail - * 1 : success + * 0 : fail + * 1 : success *------------------------------------------*/ int storage_storageadd(struct map_session_data* sd, int index, int amount) { nullpo_ret(sd); @@ -216,7 +216,7 @@ int storage_storageadd(struct map_session_data* sd, int index, int amount) { return 0; // No item on that spot if( amount < 1 || amount > sd->status.inventory[index].amount ) - return 0; + return 0; if( storage->additem(sd,&sd->status.inventory[index],amount) == 0 ) pc->delitem(sd,index,amount,0,4,LOG_TYPE_STORAGE); @@ -230,8 +230,8 @@ int storage_storageadd(struct map_session_data* sd, int index, int amount) { * Retrieve an item from the storage into inventory * @index : storage idx * return - * 0 : fail - * 1 : success + * 0 : fail + * 1 : success *------------------------------------------*/ int storage_storageget(struct map_session_data* sd, int index, int amount) { @@ -242,7 +242,7 @@ int storage_storageget(struct map_session_data* sd, int index, int amount) if( sd->status.storage.items[index].nameid <= 0 ) return 0; //Nothing there - + if( amount < 1 || amount > sd->status.storage.items[index].amount ) return 0; @@ -258,22 +258,22 @@ int storage_storageget(struct map_session_data* sd, int index, int amount) * Move an item from cart to storage. * @index : cart inventory index * return - * 0 : fail - * 1 : success + * 0 : fail + * 1 : success *------------------------------------------*/ int storage_storageaddfromcart(struct map_session_data* sd, int index, int amount) { nullpo_ret(sd); if( sd->status.storage.storage_amount > MAX_STORAGE ) - return 0; // storage full / storage closed + return 0; // storage full / storage closed if( index < 0 || index >= MAX_CART ) - return 0; + return 0; if( sd->status.cart[index].nameid <= 0 ) return 0; //No item there. - + if( amount < 1 || amount > sd->status.cart[index].amount ) return 0; @@ -287,8 +287,8 @@ int storage_storageaddfromcart(struct map_session_data* sd, int index, int amoun * Get from Storage to the Cart inventory * @index : storage index * return - * 0 : fail - * 1 : success + * 0 : fail + * 1 : success *------------------------------------------*/ int storage_storagegettocart(struct map_session_data* sd, int index, int amount) { int flag = 0; @@ -296,13 +296,13 @@ int storage_storagegettocart(struct map_session_data* sd, int index, int amount) if( index < 0 || index >= MAX_STORAGE ) return 0; - + if( sd->status.storage.items[index].nameid <= 0 ) return 0; //Nothing there. - + if( amount < 1 || amount > sd->status.storage.items[index].amount ) return 0; - + if( (flag = pc->cart_additem(sd,&sd->status.storage.items[index],amount,LOG_TYPE_STORAGE)) == 0 ) storage->delitem(sd,index,amount); else { @@ -333,7 +333,7 @@ void storage_storageclose(struct map_session_data* sd) { *------------------------------------------*/ void storage_storage_quit(struct map_session_data* sd, int flag) { nullpo_retv(sd); - + if (map->save_settings&4) chrif->save(sd, flag); //Invokes the storage saving as well. @@ -367,9 +367,9 @@ int guild_storage_delete(int guild_id) { /*========================================== * Attempt to open guild storage for sd * return -* 0 : success (open or req to create a new one) -* 1 : fail -* 2 : no guild for sd +* 0 : success (open or req to create a new one) +* 1 : fail +* 2 : no guild for sd *------------------------------------------*/ int storage_guild_storageopen(struct map_session_data* sd) { @@ -382,7 +382,7 @@ int storage_guild_storageopen(struct map_session_data* sd) if(sd->state.storage_flag) return 1; //Can't open both storages at a time. - + if( !pc_can_give_items(sd) ) { //check is this GM level can open guild storage and store items [Lupus] clif->message(sd->fd, msg_txt(246)); return 1; @@ -394,10 +394,10 @@ int storage_guild_storageopen(struct map_session_data* sd) } if(gstor->storage_status) return 1; - + if( gstor->lock ) return 1; - + gstor->storage_status = 1; sd->state.storage_flag = 2; storage->sortitem(gstor->items, ARRAYLENGTH(gstor->items)); @@ -409,8 +409,8 @@ int storage_guild_storageopen(struct map_session_data* sd) /*========================================== * Attempt to add an item in guild storage, then refresh it * return -* 0 : success -* 1 : fail +* 0 : success +* 1 : fail *------------------------------------------*/ int guild_storage_additem(struct map_session_data* sd, struct guild_storage* stor, struct item* item_data, int amount) { @@ -431,8 +431,8 @@ int guild_storage_additem(struct map_session_data* sd, struct guild_storage* sto return 1; } - if( !itemdb_canguildstore(item_data, pc_get_group_level(sd)) || item_data->expire_time ) - { //Check if item is storable. [Skotlex] + if (!itemdb_canguildstore(item_data, pc_get_group_level(sd)) || item_data->expire_time) { + //Check if item is storable. [Skotlex] clif->message (sd->fd, msg_txt(264)); return 1; } @@ -441,7 +441,7 @@ int guild_storage_additem(struct map_session_data* sd, struct guild_storage* sto clif->message(sd->fd, msg_txt(294)); return 1; } - + if(itemdb->isstackable2(data)){ //Stackable for(i=0;i<MAX_GUILD_STORAGE;i++){ if(compare_item(&stor->items[i], item_data)) { @@ -456,10 +456,10 @@ int guild_storage_additem(struct map_session_data* sd, struct guild_storage* sto } //Add item for(i=0;i<MAX_GUILD_STORAGE && stor->items[i].nameid;i++); - + if(i>=MAX_GUILD_STORAGE) return 1; - + memcpy(&stor->items[i],item_data,sizeof(stor->items[0])); stor->items[i].amount=amount; stor->storage_amount++; @@ -472,8 +472,8 @@ int guild_storage_additem(struct map_session_data* sd, struct guild_storage* sto /*========================================== * Attempt to delete an item in guild storage, then refresh it * return -* 0 : success -* 1 : fail +* 0 : success +* 1 : fail *------------------------------------------*/ int guild_storage_delitem(struct map_session_data* sd, struct guild_storage* stor, int n, int amount) { @@ -498,8 +498,8 @@ int guild_storage_delitem(struct map_session_data* sd, struct guild_storage* sto * Attempt to add an item in guild storage from inventory, then refresh it * @index : inventory idx * return -* 0 : fail -* 1 : succes +* 0 : fail +* 1 : succes *------------------------------------------*/ int storage_guild_storageadd(struct map_session_data* sd, int index, int amount) { @@ -507,19 +507,19 @@ int storage_guild_storageadd(struct map_session_data* sd, int index, int amount) nullpo_ret(sd); nullpo_ret(stor=idb_get(gstorage->db,sd->status.guild_id)); - + if( !stor->storage_status || stor->storage_amount > MAX_GUILD_STORAGE ) return 0; - + if( index<0 || index>=MAX_INVENTORY ) return 0; if( sd->status.inventory[index].nameid <= 0 ) return 0; - + if( amount < 1 || amount > sd->status.inventory[index].amount ) return 0; - + if( stor->lock ) { gstorage->close(sd); return 0; @@ -537,8 +537,8 @@ int storage_guild_storageadd(struct map_session_data* sd, int index, int amount) * Attempt to retrieve an item from guild storage to inventory, then refresh it * @index : storage idx * return -* 0 : fail -* 1 : success +* 0 : fail +* 1 : success *------------------------------------------*/ int storage_guild_storageget(struct map_session_data* sd, int index, int amount) { @@ -549,17 +549,17 @@ int storage_guild_storageget(struct map_session_data* sd, int index, int amount) nullpo_ret(stor=idb_get(gstorage->db,sd->status.guild_id)); if(!stor->storage_status) - return 0; - + return 0; + if(index<0 || index>=MAX_GUILD_STORAGE) return 0; if(stor->items[index].nameid <= 0) return 0; - + if(amount < 1 || amount > stor->items[index].amount) - return 0; - + return 0; + if( stor->lock ) { gstorage->close(sd); return 0; @@ -569,7 +569,7 @@ int storage_guild_storageget(struct map_session_data* sd, int index, int amount) gstorage->delitem(sd,stor,index,amount); else //inform fail clif->additem(sd,0,0,flag); -// log_fromstorage(sd, index, 1); + //log_fromstorage(sd, index, 1); return 0; } @@ -578,8 +578,8 @@ int storage_guild_storageget(struct map_session_data* sd, int index, int amount) * Attempt to add an item in guild storage from cart, then refresh it * @index : cart inventory idx * return -* 0 : fail -* 1 : success +* 0 : fail +* 1 : success *------------------------------------------*/ int storage_guild_storageaddfromcart(struct map_session_data* sd, int index, int amount) { @@ -596,7 +596,7 @@ int storage_guild_storageaddfromcart(struct map_session_data* sd, int index, int if( sd->status.cart[index].nameid <= 0 ) return 0; - + if( amount < 1 || amount > sd->status.cart[index].amount ) return 0; @@ -610,8 +610,8 @@ int storage_guild_storageaddfromcart(struct map_session_data* sd, int index, int * Attempt to retrieve an item from guild storage to cart, then refresh it * @index : storage idx * return -* 0 : fail -* 1 : success +* 0 : fail +* 1 : success *------------------------------------------*/ int storage_guild_storagegettocart(struct map_session_data* sd, int index, int amount) { @@ -621,14 +621,14 @@ int storage_guild_storagegettocart(struct map_session_data* sd, int index, int a nullpo_ret(stor=idb_get(gstorage->db,sd->status.guild_id)); if(!stor->storage_status) - return 0; + return 0; if(index<0 || index>=MAX_GUILD_STORAGE) - return 0; - + return 0; + if(stor->items[index].nameid<=0) return 0; - + if(amount < 1 || amount > stor->items[index].amount) return 0; @@ -641,8 +641,8 @@ int storage_guild_storagegettocart(struct map_session_data* sd, int index, int a /*========================================== * Request to save guild storage * return -* 0 : fail (no storage) -* 1 : success +* 0 : fail (no storage) +* 1 : success *------------------------------------------*/ int storage_guild_storagesave(int account_id, int guild_id, int flag) { @@ -652,7 +652,7 @@ int storage_guild_storagesave(int account_id, int guild_id, int flag) { if (flag) //Char quitting, close it. stor->storage_status = 0; - if (stor->dirty) + if (stor->dirty) intif->send_guild_storage(account_id,stor); return 1; } @@ -662,16 +662,16 @@ int storage_guild_storagesave(int account_id, int guild_id, int flag) /*========================================== * ACK save of guild storage * return -* 0 : fail (no storage) -* 1 : success +* 0 : fail (no storage) +* 1 : success *------------------------------------------*/ int storage_guild_storagesaved(int guild_id) { struct guild_storage *stor; if((stor=idb_get(gstorage->db,guild_id)) != NULL) { - if (stor->dirty && stor->storage_status == 0) - { //Storage has been correctly saved. + if (stor->dirty && stor->storage_status == 0) { + //Storage has been correctly saved. stor->dirty = 0; } return 1; @@ -704,7 +704,7 @@ int storage_guild_storage_quit(struct map_session_data* sd, int flag) { nullpo_ret(sd); nullpo_ret(stor=idb_get(gstorage->db,sd->status.guild_id)); - + if(flag) { //Only during a guild break flag is 1 (don't save storage) sd->state.storage_flag = 0; @@ -755,7 +755,7 @@ void storage_defaults(void) { } void gstorage_defaults(void) { gstorage = &gstorage_s; - + /* */ gstorage->init = do_init_gstorage; gstorage->final = do_final_gstorage; diff --git a/src/map/trade.c b/src/map/trade.c index 3bbb73568..4d6909957 100644 --- a/src/map/trade.c +++ b/src/map/trade.c @@ -43,8 +43,8 @@ void trade_traderequest(struct map_session_data *sd, struct map_session_data *ta return; } - if (target_sd->npc_id) - { //Trade fails if you are using an NPC. + if (target_sd->npc_id) { + //Trade fails if you are using an NPC. clif->tradestart(sd, 2); return; } @@ -145,9 +145,10 @@ void trade_tradeack(struct map_session_data *sd, int type) { } //Check if you can start trade. - if (sd->npc_id || sd->state.vending || sd->state.buyingstore || sd->state.storage_flag || - tsd->npc_id || tsd->state.vending || tsd->state.buyingstore || tsd->state.storage_flag) - { //Fail + if (sd->npc_id || sd->state.vending || sd->state.buyingstore || sd->state.storage_flag + || tsd->npc_id || tsd->state.vending || tsd->state.buyingstore || tsd->state.storage_flag + ) { + //Fail clif->tradestart(sd, 2); clif->tradestart(tsd, 2); sd->state.deal_locked = 0; @@ -335,8 +336,8 @@ void trade_tradeadditem(struct map_session_data *sd, short index, short amount) return; } - if( amount == 0 ) - { //Why do this.. ~.~ just send an ack, the item won't display on the trade window. + if (amount == 0) { + //Why do this.. ~.~ just send an ack, the item won't display on the trade window. clif->tradeitemok(sd, index, TIO_SUCCESS); return; } @@ -375,7 +376,7 @@ void trade_tradeadditem(struct map_session_data *sd, short index, short amount) clif->tradeitemok(sd, index+2, TIO_INDROCKS); return; } - + //Locate a trade position ARR_FIND( 0, 10, trade_i, sd->deal.item[trade_i].index == index || sd->deal.item[trade_i].amount == 0 ); if( trade_i == 10 ) //No space left @@ -385,23 +386,22 @@ void trade_tradeadditem(struct map_session_data *sd, short index, short amount) } trade_weight = sd->inventory_data[index]->weight * amount; - if( target_sd->weight + sd->deal.weight + trade_weight > target_sd->max_weight ) - { //fail to add item -- the player was over weighted. + if (target_sd->weight + sd->deal.weight + trade_weight > target_sd->max_weight) { + //fail to add item -- the player was over weighted. clif->tradeitemok(sd, index+2, TIO_OVERWEIGHT); return; } - if( sd->deal.item[trade_i].index == index ) - { //The same item as before is being readjusted. - if( sd->deal.item[trade_i].amount + amount > sd->status.inventory[index].amount ) - { //packet deal exploit check + if (sd->deal.item[trade_i].index == index) { + //The same item as before is being readjusted. + if (sd->deal.item[trade_i].amount + amount > sd->status.inventory[index].amount) { + //packet deal exploit check amount = sd->status.inventory[index].amount - sd->deal.item[trade_i].amount; trade_weight = sd->inventory_data[index]->weight * amount; } sd->deal.item[trade_i].amount += amount; - } - else - { //New deal item + } else { + //New deal item sd->deal.item[trade_i].index = index; sd->deal.item[trade_i].amount = amount; } @@ -427,8 +427,8 @@ void trade_tradeaddzeny(struct map_session_data* sd, int amount) return; } - if( amount < 0 || amount > sd->status.zeny || amount > MAX_ZENY - target_sd->status.zeny ) - { // invalid values, no appropriate packet for it => abort + if (amount < 0 || amount > sd->status.zeny || amount > MAX_ZENY - target_sd->status.zeny) { + // invalid values, no appropriate packet for it => abort trade->cancel(sd); return; } @@ -606,8 +606,7 @@ void trade_tradecommit(struct map_session_data *sd) { clif->tradecompleted(tsd, 0); // save both player to avoid crash: they always have no advantage/disadvantage between the 2 players - if (map->save_settings&1) - { + if (map->save_settings&1) { chrif->save(sd,0); chrif->save(tsd,0); } @@ -616,7 +615,7 @@ void trade_tradecommit(struct map_session_data *sd) { void trade_defaults(void) { trade = &trade_s; - + trade->request = trade_traderequest; trade->ack = trade_tradeack; trade->check_impossible = impossible_trade_check; diff --git a/src/map/unit.c b/src/map/unit.c index 0eb6fdbd2..2ab13b121 100644 --- a/src/map/unit.c +++ b/src/map/unit.c @@ -187,7 +187,7 @@ int unit_step_timer(int tid, int64 tick, int id, intptr_t data) //Execute request now if target is in attack range if(ud->stepskill_id && skill->get_inf(ud->stepskill_id) & INF_GROUND_SKILL) { //Execute ground skill - struct map_data *md = &map->list[bl->m]; + struct map_data *md = &map->list[bl->m]; unit->skilluse_pos(bl, target_id%md->xs, target_id/md->xs, ud->stepskill_id, ud->stepskill_lv); } else { //If a player has target_id set and target is in range, attempt attack @@ -314,7 +314,6 @@ int unit_walktoxy_timer(int tid, int64 tick, int id, intptr_t data) { } } else // reset the tick, he is not far anymore sd->md->masterteleport_timer = 0; - } if( sd->hd ) { if( homun_alive(sd->hd) && !check_distance_bl(&sd->bl, &sd->hd->bl, MAX_MER_DISTANCE) ) { @@ -337,14 +336,15 @@ int unit_walktoxy_timer(int tid, int64 tick, int id, intptr_t data) { if (md->min_chase > md->db->range3) md->min_chase--; //Walk skills are triggered regardless of target due to the idle-walk mob state. //But avoid triggering on stop-walk calls. - if(tid != INVALID_TIMER && - !(ud->walk_count%WALK_SKILL_INTERVAL) && - map->list[bl->m].users > 0 && - mob->skill_use(md, tick, -1)) - { + if (tid != INVALID_TIMER + && !(ud->walk_count%WALK_SKILL_INTERVAL) + && map->list[bl->m].users > 0 + && mob->skill_use(md, tick, -1) + ) { if (!(ud->skill_id == NPC_SELFDESTRUCTION && ud->skilltimer != INVALID_TIMER) - && md->state.skillstate != MSS_WALK) //Walk skills are supposed to be used while walking - { //Skill used, abort walking + && md->state.skillstate != MSS_WALK //Walk skills are supposed to be used while walking + ) { + //Skill used, abort walking clif->fixpos(bl); //Fix position as walk has been canceled. return 0; } @@ -424,8 +424,8 @@ int unit_walktoxy_timer(int tid, int64 tick, int id, intptr_t data) { } if (tbl->m == bl->m && check_distance_bl(bl, tbl, ud->chaserange)) { //Reached destination. - if (ud->state.attack_continue) - { //Aegis uses one before every attack, we should + if (ud->state.attack_continue) { + //Aegis uses one before every attack, we should //only need this one for syncing purposes. [Skotlex] ud->target_to = 0; clif->fixpos(bl); @@ -555,8 +555,8 @@ int unit_walktobl_sub(int tid, int64 tick, int id, intptr_t data) { // if flag&2, start attacking upon arrival within range, otherwise just walk to that character. int unit_walktobl(struct block_list *bl, struct block_list *tbl, int range, int flag) { - struct unit_data *ud = NULL; - struct status_change *sc = NULL; + struct unit_data *ud = NULL; + struct status_change *sc = NULL; nullpo_ret(bl); nullpo_ret(tbl); @@ -590,8 +590,8 @@ int unit_walktobl(struct block_list *bl, struct block_list *tbl, int range, int return 1; } - if(DIFF_TICK(ud->canmove_tick, timer->gettick()) > 0) - { //Can't move, wait a bit before invoking the movement. + if (DIFF_TICK(ud->canmove_tick, timer->gettick()) > 0) { + //Can't move, wait a bit before invoking the movement. timer->add(ud->canmove_tick+1, unit->walktobl_sub, bl->id, ud->target); return 1; } @@ -786,7 +786,7 @@ int unit_setdir(struct block_list *bl,unsigned char dir) uint8 unit_getdir(struct block_list *bl) { struct unit_data *ud; nullpo_ret(bl); - + if( bl->type == BL_NPC ) return ((TBL_NPC*)bl)->dir; ud = unit->bl2ud(bl); @@ -1076,7 +1076,6 @@ int unit_can_move(struct block_list *bl) { ) ) return 0; - if (sc->opt1 > 0 && sc->opt1 != OPT1_STONEWAIT && sc->opt1 != OPT1_BURNING && !(sc->opt1 == OPT1_CRYSTALIZE && bl->type == BL_MOB)) return 0; @@ -1143,10 +1142,10 @@ int unit_set_walkdelay(struct block_list *bl, int64 tick, int delay, int type) { return 0; } ud->canmove_tick = tick + delay; - if (ud->walktimer != INVALID_TIMER) - { //Stop walking, if chasing, readjust timers. - if (delay == 1) - { //Minimal delay (walk-delay) disabled. Just stop walking. + if (ud->walktimer != INVALID_TIMER) { + //Stop walking, if chasing, readjust timers. + if (delay == 1) { + //Minimal delay (walk-delay) disabled. Just stop walking. unit->stop_walking(bl,4); } else { //Resume running after can move again [Kevin] @@ -1214,7 +1213,8 @@ int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill_id, ui if(skill->not_ok(skill_id, sd)) // [MouseJstr] return 0; - switch(skill_id) { //Check for skills that auto-select target + switch (skill_id) { + //Check for skills that auto-select target case MO_CHAINCOMBO: if (sc && sc->data[SC_BLADESTOP]) { if ((target=map->id2bl(sc->data[SC_BLADESTOP]->val4)) == NULL) @@ -1276,7 +1276,7 @@ int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill_id, ui if(!status->check_skilluse(src, target, skill_id, 0)) return 0; - + if( src != target && status->isdead(target) ) { /** * Skills that may be cast on dead targets @@ -1300,7 +1300,7 @@ int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill_id, ui clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); return 0; } - + switch(skill_id){ case SA_CASTCANCEL: if(ud->skill_id != skill_id){ @@ -1408,7 +1408,7 @@ int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill_id, ui temp = 1; break; case CR_DEVOTION: - if (sd) { + if (sd) { int i = 0, count = min(skill_lv, 5); ARR_FIND(0, count, i, sd->devotion[i] == target_id); if (i == count) { @@ -1416,7 +1416,7 @@ int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill_id, ui if(i == count) { clif->skill_fail(sd, skill_id, USESKILL_FAIL_LEVEL, 0); return 0; // Can't cast on other characters when limit is reached - } + } } } break; @@ -1462,7 +1462,7 @@ int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill_id, ui case RA_WUGDASH: if (sc && sc->data[SC_WUGDASH]) casttime = -1; - break; + break; case EL_WIND_SLASH: case EL_HURRICANE: case EL_TYPOON_MIS: @@ -1505,7 +1505,7 @@ int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill_id, ui /** * why the if else chain: these 3 status do not stack, so its efficient that way. **/ - if( sc->data[SC_CLOAKING] && !(sc->data[SC_CLOAKING]->val4&4) && skill_id != AS_CLOAKING ) { + if( sc->data[SC_CLOAKING] && !(sc->data[SC_CLOAKING]->val4&4) && skill_id != AS_CLOAKING ) { status_change_end(src, SC_CLOAKING, INVALID_TIMER); if (!src->prev) return 0; //Warped away! } else if( sc->data[SC_CLOAKINGEXCEED] && !(sc->data[SC_CLOAKINGEXCEED]->val4&4) && skill_id != GC_CLOAKINGEXCEED ) { @@ -1513,10 +1513,10 @@ int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill_id, ui if (!src->prev) return 0; } } - + if(!ud->state.running) //need TK_RUN or WUGDASH handler to be done before that, see bugreport:6026 unit->stop_walking(src,1);// even though this is not how official works but this will do the trick. bugreport:6829 - + // in official this is triggered even if no cast time. clif->skillcasting(src, src->id, target_id, 0,0, skill_id, skill->get_ele(skill_id, skill_lv), casttime); if( casttime > 0 || temp ) @@ -1643,7 +1643,7 @@ int unit_skilluse_pos2( struct block_list *src, short skill_x, short skill_y, ui return 0; } - /* Check range and obstacle */ + /* Check range and obstacle */ bl.type = BL_NUL; bl.m = src->m; bl.x = skill_x; @@ -1691,14 +1691,14 @@ int unit_skilluse_pos2( struct block_list *src, short skill_x, short skill_y, ui ud->state.skillcastcancel = castcancel&&casttime>0?1:0; if( !sd || sd->skillitem != skill_id || skill->get_cast(skill_id,skill_lv) ) ud->canact_tick = tick + casttime + 100; -// if( sd ) -// { -// switch( skill_id ) -// { -// case ????: -// sd->canequip_tick = tick + casttime; -// } -// } +#if 0 + if (sd) { + switch (skill_id) { + case ????: + sd->canequip_tick = tick + casttime; + } + } +#endif // 0 ud->skill_id = skill_id; ud->skill_lv = skill_lv; ud->skillx = skill_x; @@ -1961,7 +1961,7 @@ bool unit_can_reach_bl(struct block_list *bl,struct block_list *tbl, int range, /*========================================== * Calculates position of Pet/Mercenary/Homunculus/Elemental *------------------------------------------*/ -int unit_calc_pos(struct block_list *bl, int tx, int ty, uint8 dir) +int unit_calc_pos(struct block_list *bl, int tx, int ty, uint8 dir) { int dx, dy, x, y, i, k; struct unit_data *ud = unit->bl2ud(bl); @@ -2121,8 +2121,8 @@ int unit_attack_timer_sub(struct block_list* src, int tid, int64 tick) { md->state.skillstate = md->state.aggressive?MSS_ANGRY:MSS_BERSERK; } - if (sstatus->mode&MD_ASSIST && DIFF_TICK(md->last_linktime, tick) < MIN_MOBLINKTIME) - { // Link monsters nearby [Skotlex] + if (sstatus->mode&MD_ASSIST && DIFF_TICK(md->last_linktime, tick) < MIN_MOBLINKTIME) { + // Link monsters nearby [Skotlex] md->last_linktime = tick; map->foreachinrange(mob->linksearch, src, md->db->range2, BL_MOB, md->class_, target, tick); } @@ -2144,7 +2144,7 @@ int unit_attack_timer_sub(struct block_list* src, int tid, int64 tick) { return 1; ud->attackabletime = tick + sstatus->adelay; -// You can't move if you can't attack neither. + // You can't move if you can't attack neither. if (src->type&battle_config.attack_walk_delay) unit->set_walkdelay(src, tick, sstatus->amotion, 1); } @@ -2189,8 +2189,8 @@ int unit_skillcastcancel(struct block_list *bl,int type) if (!ud->state.skillcastcancel) return 0; - if (sd && (sd->special_state.no_castcancel2 || - ( sd->special_state.no_castcancel && !map_flag_gvg(bl->m) && !map->list[bl->m].flag.battleground))) //fixed flags being read the wrong way around [blackhole89] + if (sd && (sd->special_state.no_castcancel2 + || (sd->special_state.no_castcancel && !map_flag_gvg(bl->m) && !map->list[bl->m].flag.battleground))) //fixed flags being read the wrong way around [blackhole89] return 0; } @@ -2534,10 +2534,10 @@ int unit_remove_map(struct block_list *bl, clr_type clrtype, const char* file, i void unit_remove_map_pc(struct map_session_data *sd, clr_type clrtype) { unit->remove_map(&sd->bl,clrtype,ALC_MARK); - + //CLR_RESPAWN is the warp from logging out, CLR_TELEPORT is the warp from teleporting, but pets/homunc need to just 'vanish' instead of showing the warping animation. if (clrtype == CLR_RESPAWN || clrtype == CLR_TELEPORT) clrtype = CLR_OUTSIGHT; - + if(sd->pd) unit->remove_map(&sd->pd->bl, clrtype, ALC_MARK); if(homun_alive(sd->hd)) @@ -2566,7 +2566,7 @@ int unit_free(struct block_list *bl, clr_type clrtype) { nullpo_ret(ud); map->freeblock_lock(); - if( bl->prev ) //Players are supposed to logout with a "warp" effect. + if( bl->prev ) //Players are supposed to logout with a "warp" effect. unit->remove_map(bl, clrtype, ALC_MARK); switch( bl->type ) { @@ -2577,7 +2577,7 @@ int unit_free(struct block_list *bl, clr_type clrtype) { unsigned int k; sd->state.loggingout = 1; - + if( status->isdead(bl) ) pc->setrestartvalue(sd,2); @@ -2636,7 +2636,7 @@ int unit_free(struct block_list *bl, clr_type clrtype) { sd->quest_log = NULL; sd->num_quests = sd->avail_quests = 0; } - + for( k = 0; k < sd->hdatac; k++ ) { if( sd->hdata[k]->flag.free ) { aFree(sd->hdata[k]->data); @@ -2690,10 +2690,10 @@ int unit_free(struct block_list *bl, clr_type clrtype) { aFree (pd->loot); pd->loot = NULL; } - if( pd->pet.intimate > 0 ) + if (pd->pet.intimate > 0) { intif->save_petdata(pd->pet.account_id,&pd->pet); - else - { //Remove pet. + } else { + //Remove pet. intif->delete_petdata(pd->pet.pet_id); if (sd) sd->status.pet_id = 0; } @@ -2839,7 +2839,7 @@ int do_final_unit(void) { void unit_defaults(void) { unit = &unit_s; - + unit->init = do_init_unit; unit->final = do_final_unit; /* */ diff --git a/src/map/vending.c b/src/map/vending.c index 7e9393bf2..bd61d482f 100644 --- a/src/map/vending.c +++ b/src/map/vending.c @@ -134,11 +134,11 @@ void vending_purchasereq(struct map_session_data* sd, int aid, unsigned int uid, clif->buyvending(sd, idx, amount, 2); // you can not buy, because overweight return; } - + //Check to see if cart/vend info is in sync. if( vend[j].amount > vsd->status.cart[idx].amount ) vend[j].amount = vsd->status.cart[idx].amount; - + // if they try to add packets (example: get twice or more 2 apples if marchand has only 3 apples). // here, we check cumulative amounts if( vend[j].amount < amount ) { @@ -146,12 +146,12 @@ void vending_purchasereq(struct map_session_data* sd, int aid, unsigned int uid, clif->buyvending(sd, idx, vsd->vending[j].amount, 4); // not enough quantity return; } - + vend[j].amount -= amount; switch( pc->checkadditem(sd, vsd->status.cart[idx].nameid, amount) ) { case ADDITEM_EXIST: - break; //We'd add this item to the existing one (in buyers inventory) + break; //We'd add this item to the existing one (in buyers inventory) case ADDITEM_NEW: new_++; if (new_ > blank) @@ -190,7 +190,7 @@ void vending_purchasereq(struct map_session_data* sd, int aid, unsigned int uid, for( i = 0, cursor = 0; i < vsd->vend_num; i++ ) { if( vsd->vending[i].amount == 0 ) continue; - + if( cursor != i ) { // speedup vsd->vending[cursor].index = vsd->vending[i].index; vsd->vending[cursor].amount = vsd->vending[i].amount; @@ -245,7 +245,7 @@ void vending_openvending(struct map_session_data* sd, const char* message, const clif->skill_fail(sd, MC_VENDING, USESKILL_FAIL_LEVEL, 0); return; } - + // filter out invalid items i = 0; for( j = 0; j < count; j++ ) { @@ -256,13 +256,13 @@ void vending_openvending(struct map_session_data* sd, const char* message, const index -= 2; // offset adjustment (client says that the first cart position is 2) if( index < 0 || index >= MAX_CART // invalid position - || pc->cartitem_amount(sd, index, amount) < 0 // invalid item or insufficient quantity + || pc->cartitem_amount(sd, index, amount) < 0 // invalid item or insufficient quantity //NOTE: official server does not do any of the following checks! - || !sd->status.cart[index].identify // unidentified item - || sd->status.cart[index].attribute == 1 // broken item - || sd->status.cart[index].expire_time // It should not be in the cart but just in case - || (sd->status.cart[index].bound && !pc_can_give_bound_items(sd)) // can't trade bound items w/o permission - || !itemdb_cantrade(&sd->status.cart[index], pc_get_group_level(sd), pc_get_group_level(sd)) ) // untradeable item + || !sd->status.cart[index].identify // unidentified item + || sd->status.cart[index].attribute == 1 // broken item + || sd->status.cart[index].expire_time // It should not be in the cart but just in case + || (sd->status.cart[index].bound && !pc_can_give_bound_items(sd)) // can't trade bound items w/o permission + || !itemdb_cantrade(&sd->status.cart[index], pc_get_group_level(sd), pc_get_group_level(sd)) ) // untradeable item continue; sd->vending[i].index = index; @@ -287,7 +287,7 @@ void vending_openvending(struct map_session_data* sd, const char* message, const clif->openvending(sd,sd->bl.id,sd->vending); clif->showvendingboard(&sd->bl,message,0); - + idb_put(vending->db, sd->status.char_id, sd); } @@ -372,10 +372,10 @@ void init(bool minimal) { void vending_defaults(void) { vending = &vending_s; - + vending->init = init; vending->final = final; - + vending->close = vending_closevending; vending->open = vending_openvending; vending->list = vending_vendinglistreq; |