Trimmed trailing whitespaces in /src/map
This commit is contained in:
parent
aad72b5724
commit
91fef8df97
@ -610,7 +610,7 @@ ACMD_FUNC(jump)
|
||||
*------------------------------------------*/
|
||||
ACMD_FUNC(who) {
|
||||
struct map_session_data *pl_sd = NULL;
|
||||
struct s_mapiterator *iter = NULL;
|
||||
struct s_mapiterator *iter = NULL;
|
||||
char player_name[NAME_LENGTH] = "";
|
||||
int count = 0;
|
||||
int level = 0;
|
||||
@ -2654,7 +2654,7 @@ ACMD_FUNC(stat_all)
|
||||
max_status[5] = pc_maxparameter(sd,PARAM_LUK);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
count = 0;
|
||||
for (i = 0; i < ARRAYLENGTH(status); i++) {
|
||||
short new_value;
|
||||
@ -2989,7 +2989,7 @@ ACMD_FUNC(char_ban)
|
||||
clif_displaymessage(fd, msg_txt(sd,702)); // Time parameter format is +/-<value> to alter. y/a = Year, m = Month, d/j = Day, h = Hour, n/mn = Minute, s = Second.
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
if( timediff < 0 && (
|
||||
(bantype == CHRIF_OP_LOGIN_BAN && !pc_can_use_command(sd, "unban", COMMAND_ATCOMMAND))
|
||||
|| (bantype == CHRIF_OP_BAN && !pc_can_use_command(sd, "charunban", COMMAND_ATCOMMAND))
|
||||
@ -4541,8 +4541,8 @@ ACMD_FUNC(loadnpc)
|
||||
){
|
||||
clif_displaymessage(fd, msg_txt(sd,261));
|
||||
return -1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
npc_read_event_script();
|
||||
|
||||
clif_displaymessage(fd, msg_txt(sd,262));
|
||||
@ -4785,7 +4785,7 @@ ACMD_FUNC(jailfor) {
|
||||
nullpo_retr(-1, sd);
|
||||
|
||||
memset(atcmd_output, '\0', sizeof(atcmd_output));
|
||||
|
||||
|
||||
if (!message || !*message || sscanf(message, "%255s %23[^\n]",atcmd_output,atcmd_player_name) < 2) {
|
||||
clif_displaymessage(fd, msg_txt(sd,400)); //Usage: @jailfor <time> <character name>
|
||||
return -1;
|
||||
@ -4976,7 +4976,7 @@ ACMD_FUNC(disguiseguild)
|
||||
{
|
||||
int id = 0, i;
|
||||
char monster[NAME_LENGTH], guild[NAME_LENGTH];
|
||||
|
||||
|
||||
struct guild *g;
|
||||
|
||||
memset(monster, '\0', sizeof(monster));
|
||||
@ -5389,7 +5389,7 @@ ACMD_FUNC(dropall)
|
||||
struct item_data *item_data = NULL;
|
||||
|
||||
nullpo_retr(-1, sd);
|
||||
|
||||
|
||||
if( message[0] ) {
|
||||
type = atoi(message);
|
||||
if( type != -1 && type != IT_HEALING && type != IT_USABLE && type != IT_ETC && type != IT_WEAPON &&
|
||||
@ -5420,7 +5420,7 @@ ACMD_FUNC(dropall)
|
||||
}
|
||||
}
|
||||
sprintf(atcmd_output, msg_txt(sd,1494), count,count2); // %d items are dropped (%d skipped)!
|
||||
clif_displaymessage(fd, atcmd_output);
|
||||
clif_displaymessage(fd, atcmd_output);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -6835,7 +6835,7 @@ ACMD_FUNC(uptime)
|
||||
}
|
||||
|
||||
/*==========================================
|
||||
* @changesex
|
||||
* @changesex
|
||||
* => Changes one's account sex. Switch from male to female or visversa
|
||||
*------------------------------------------*/
|
||||
ACMD_FUNC(changesex)
|
||||
@ -8956,7 +8956,7 @@ static void atcommand_commands_sub(struct map_session_data* sd, const int fd, At
|
||||
if ( count_bind )
|
||||
clif_displaymessage(fd,line_buff);// last one
|
||||
count += count_bind;
|
||||
|
||||
|
||||
}
|
||||
|
||||
sprintf(atcmd_output, msg_txt(sd,274), count); // "%d commands found."
|
||||
@ -9019,7 +9019,7 @@ ACMD_FUNC(accinfo) {
|
||||
|
||||
/**
|
||||
* @set <variable name{[index]}>{ <value>}
|
||||
*
|
||||
*
|
||||
* Gets or sets a value of a non server variable.
|
||||
* If a value is specified it is used to set the variable's value,
|
||||
* if not the variable's value is read.
|
||||
@ -9468,11 +9468,11 @@ ACMD_FUNC(vip) {
|
||||
char * modif_p;
|
||||
int32 vipdifftime = 0;
|
||||
time_t now=time(NULL);
|
||||
|
||||
|
||||
nullpo_retr(-1, sd);
|
||||
|
||||
memset(atcmd_output, '\0', sizeof(atcmd_output));
|
||||
|
||||
|
||||
if (!message || !*message || sscanf(message, "%255s %23[^\n]",atcmd_output,atcmd_player_name) < 2) {
|
||||
clif_displaymessage(fd, msg_txt(sd,700)); //Usage: @vip <timef> <character name>
|
||||
return -1;
|
||||
@ -9499,7 +9499,7 @@ ACMD_FUNC(vip) {
|
||||
}
|
||||
if(pl_sd->vip.time==0) pl_sd->vip.time=now;
|
||||
pl_sd->vip.time += vipdifftime; //increase or reduce VIP duration
|
||||
|
||||
|
||||
if (pl_sd->vip.time <= now) {
|
||||
pl_sd->vip.time = 0;
|
||||
pl_sd->vip.enabled = 0;
|
||||
@ -9508,7 +9508,7 @@ ACMD_FUNC(vip) {
|
||||
} else {
|
||||
int year,month,day,hour,minute,second;
|
||||
char timestr[21];
|
||||
|
||||
|
||||
split_time((int)(pl_sd->vip.time-now),&year,&month,&day,&hour,&minute,&second);
|
||||
sprintf(atcmd_output,msg_txt(pl_sd,705),year,month,day,hour,minute); // Your VIP status is valid for %d years, %d months, %d days, %d hours and %d minutes.
|
||||
clif_displaymessage(pl_sd->fd,atcmd_output);
|
||||
@ -9523,7 +9523,7 @@ ACMD_FUNC(vip) {
|
||||
clif_displaymessage(fd,atcmd_output);
|
||||
}
|
||||
}
|
||||
chrif_req_login_operation(pl_sd->status.account_id, pl_sd->status.name, CHRIF_OP_LOGIN_VIP, vipdifftime, 7, 0);
|
||||
chrif_req_login_operation(pl_sd->status.account_id, pl_sd->status.name, CHRIF_OP_LOGIN_VIP, vipdifftime, 7, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -9545,9 +9545,9 @@ ACMD_FUNC(showrate) {
|
||||
ACMD_FUNC(fullstrip) {
|
||||
int i;
|
||||
TBL_PC *tsd;
|
||||
|
||||
|
||||
nullpo_retr(-1,sd);
|
||||
|
||||
|
||||
if (!message || !*message) {
|
||||
clif_displaymessage(fd, msg_txt(sd,349)); // Please enter a player name (usage: @fullstrip/@warpto/@goto <char name/ID>).
|
||||
return -1;
|
||||
@ -9557,7 +9557,7 @@ ACMD_FUNC(fullstrip) {
|
||||
clif_displaymessage(fd, msg_txt(sd,3)); // Character not found.
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
for( i = 0; i < EQI_MAX; i++ ) {
|
||||
if( tsd->equip_index[ i ] >= 0 )
|
||||
pc_unequipitem( tsd , tsd->equip_index[ i ] , 2 );
|
||||
|
||||
@ -582,7 +582,7 @@ int battle_calc_cardfix(int attack_type, struct block_list *src, struct block_li
|
||||
if( sd && !(nk&NK_NO_CARDFIX_ATK) ) {
|
||||
cardfix = cardfix * (100 + sd->magic_addrace[tstatus->race] + sd->magic_addrace[RC_ALL] + sd->magic_addrace2[t_race2]) / 100;
|
||||
if( !(nk&NK_NO_ELEFIX) ) { // Affected by Element modifier bonuses
|
||||
cardfix = cardfix * (100 + sd->magic_addele[tstatus->def_ele] + sd->magic_addele[ELE_ALL] +
|
||||
cardfix = cardfix * (100 + sd->magic_addele[tstatus->def_ele] + sd->magic_addele[ELE_ALL] +
|
||||
sd->magic_addele_script[tstatus->def_ele] + sd->magic_addele_script[ELE_ALL]) / 100;
|
||||
cardfix = cardfix * (100 + sd->magic_atk_ele[rh_ele] + sd->magic_atk_ele[ELE_ALL]) / 100;
|
||||
}
|
||||
@ -3257,7 +3257,7 @@ static struct Damage battle_calc_multi_attack(struct Damage wd, struct block_lis
|
||||
{ //Success chance is not added, the higher one is used [Skotlex]
|
||||
int max_rate = max(5*skill_lv,sd->bonus.double_rate);
|
||||
if(sc && sc->data[SC_KAGEMUSYA]) max_rate= max(max_rate,sc->data[SC_KAGEMUSYA]->val1*3);
|
||||
|
||||
|
||||
if( rnd()%100 < max_rate ) {
|
||||
wd.div_ = skill_get_num(TF_DOUBLE,skill_lv?skill_lv:1);
|
||||
wd.type = DMG_MULTI_HIT;
|
||||
@ -6443,7 +6443,7 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list *
|
||||
struct Damage atk = battle_calc_weapon_attack(src, target, skill_id, skill_lv, 0);
|
||||
struct Damage matk = battle_calc_magic_attack(src, target, skill_id, skill_lv, 0);
|
||||
md.damage = 7 * ((atk.damage/skill_lv + matk.damage/skill_lv) * tstatus->vit / 100 );
|
||||
|
||||
|
||||
// AD benefits from endow/element but damage is forced back to neutral
|
||||
md.damage = battle_attr_fix(src, target, md.damage, ELE_NEUTRAL, tstatus->def_ele, tstatus->ele_lv);
|
||||
}
|
||||
@ -6825,7 +6825,7 @@ bool battle_vanish(struct map_session_data *sd, struct block_list *target, struc
|
||||
wd->isspdamage = true;
|
||||
} else // No damage
|
||||
return false;
|
||||
|
||||
|
||||
return true;
|
||||
} else {
|
||||
// bHPVanishRate
|
||||
|
||||
@ -227,7 +227,7 @@ int bg_send_message(struct map_session_data *sd, const char *mes, int len)
|
||||
|
||||
if( sd->bg_id == 0 || (bg = bg_team_search(sd->bg_id)) == NULL )
|
||||
return 0;
|
||||
|
||||
|
||||
clif_bg_message(bg, sd->bl.id, sd->status.name, mes, len);
|
||||
|
||||
return 0;
|
||||
|
||||
@ -258,7 +258,7 @@ void buyingstore_close(struct map_session_data* sd) {
|
||||
nullpo_retv(sd);
|
||||
|
||||
if( sd->state.buyingstore ) {
|
||||
if(
|
||||
if(
|
||||
Sql_Query( mmysql_handle, "DELETE FROM `%s` WHERE buyingstore_id = %d;", buyingstore_items_db, sd->buyer_id ) != SQL_SUCCESS ||
|
||||
Sql_Query( mmysql_handle, "DELETE FROM `%s` WHERE `id` = %d;", buyingstores_db, sd->buyer_id ) != SQL_SUCCESS
|
||||
) {
|
||||
@ -475,7 +475,7 @@ void buyingstore_trade(struct map_session_data* sd, uint32 account_id, unsigned
|
||||
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 )
|
||||
@ -701,7 +701,7 @@ void do_init_buyingstore_autotrade( void ) {
|
||||
uidb_put(buyingstore_autotrader_db, at->char_id, at);
|
||||
}
|
||||
Sql_FreeResult(mmysql_handle);
|
||||
|
||||
|
||||
// Init items for each autotraders
|
||||
iter = db_iterator(buyingstore_autotrader_db);
|
||||
for (at = (struct s_autotrader *)dbi_first(iter); dbi_exists(iter); at = (struct s_autotrader *)dbi_next(iter)) {
|
||||
@ -723,7 +723,7 @@ void do_init_buyingstore_autotrade( void ) {
|
||||
buyingstore_autotrader_remove(at, true);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
//Init the list
|
||||
CREATE(at->entries, struct s_autotrade_entry *,at->count);
|
||||
|
||||
|
||||
@ -940,7 +940,7 @@ int channel_pcsetopt(struct map_session_data *sd, char *chname, const char *opti
|
||||
clif_displaymessage(sd->fd, output);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
s = ARRAYLENGTH(opt_str);
|
||||
ARR_FIND(1,s,k,( strncmpi(option,opt_str[k],3) == 0 )); //we only cmp 3 letter atm
|
||||
if(!option || option[0] == '\0' || k >= s ) {
|
||||
@ -1156,7 +1156,7 @@ void do_init_channel(void) {
|
||||
void do_final_channel(void) {
|
||||
DBIterator *iter;
|
||||
struct Channel *channel;
|
||||
|
||||
|
||||
//delete all in remaining chan db
|
||||
iter = db_iterator(channel_db);
|
||||
for( channel = (struct Channel *)dbi_first(iter); dbi_exists(iter); channel = (struct Channel *)dbi_next(iter) ) {
|
||||
|
||||
@ -17,7 +17,7 @@ struct chat_data;
|
||||
|
||||
struct chat_data {
|
||||
struct block_list bl; // data for this map object
|
||||
char title[CHATROOM_TITLE_SIZE]; // room title
|
||||
char title[CHATROOM_TITLE_SIZE]; // room title
|
||||
char pass[CHATROOM_PASS_SIZE]; // password
|
||||
bool pub; // private/public flag
|
||||
uint8 users; // current user count
|
||||
|
||||
@ -478,10 +478,10 @@ int chrif_changemapserverack(uint32 account_id, int login_id1, int login_id2, ui
|
||||
|
||||
/**
|
||||
* Does the char_serv have validate our connection to him ?
|
||||
* If yes then
|
||||
* If yes then
|
||||
* - Send all our mapname to charserv
|
||||
* - Retrieve guild castle
|
||||
* - Do OnInterIfInit and OnInterIfInitOnce on all npc
|
||||
* - Do OnInterIfInit and OnInterIfInitOnce on all npc
|
||||
* 0x2af9 <errCode>B
|
||||
*/
|
||||
int chrif_connectack(int fd) {
|
||||
@ -563,7 +563,7 @@ void chrif_on_ready(void) {
|
||||
|
||||
//Re-save any guild castles that were modified in the disconnection time.
|
||||
guild_castle_reconnect(-1, 0, 0);
|
||||
|
||||
|
||||
// Charserver is ready for loading autotrader
|
||||
do_init_buyingstore_autotrade();
|
||||
do_init_vending_autotrade();
|
||||
@ -751,7 +751,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 = (struct auth_node *)db_data2ptr(data);
|
||||
|
||||
|
||||
if(DIFF_TICK(gettick(),node->node_created)>60000) {
|
||||
const char* states[] = { "Login", "Logout", "Map change" };
|
||||
switch (node->state) {
|
||||
@ -1095,7 +1095,7 @@ int chrif_ban(int fd) {
|
||||
}
|
||||
|
||||
sd->login_id1++; // change identify, because if player come back in char within the 5 seconds, he can change its characters
|
||||
if (res == 0) {
|
||||
if (res == 0) {
|
||||
int ret_status = RFIFOL(fd,7); // status or final date of a banishment
|
||||
if(0<ret_status && ret_status<=9)
|
||||
clif_displaymessage(sd->fd, msg_txt(sd,411+ret_status));
|
||||
@ -1120,7 +1120,7 @@ int chrif_ban(int fd) {
|
||||
|
||||
int chrif_req_charban(int aid, const char* character_name, int32 timediff){
|
||||
chrif_check(-1);
|
||||
|
||||
|
||||
WFIFOHEAD(char_fd,10+NAME_LENGTH);
|
||||
WFIFOW(char_fd,0) = 0x2b28;
|
||||
WFIFOL(char_fd,2) = aid;
|
||||
@ -1132,7 +1132,7 @@ int chrif_req_charban(int aid, const char* character_name, int32 timediff){
|
||||
|
||||
int chrif_req_charunban(int aid, const char* character_name){
|
||||
chrif_check(-1);
|
||||
|
||||
|
||||
WFIFOHEAD(char_fd,6+NAME_LENGTH);
|
||||
WFIFOW(char_fd,0) = 0x2b2a;
|
||||
WFIFOL(char_fd,2) = aid;
|
||||
|
||||
@ -3385,7 +3385,7 @@ void clif_changelook(struct block_list *bl, int type, int val) {
|
||||
clif_get_weapon_view(sd, &vd->weapon, &vd->shield);
|
||||
val = vd->weapon;
|
||||
}
|
||||
else
|
||||
else
|
||||
vd->weapon = val;
|
||||
break;
|
||||
case LOOK_SHIELD:
|
||||
@ -3393,11 +3393,11 @@ void clif_changelook(struct block_list *bl, int type, int val) {
|
||||
clif_get_weapon_view(sd, &vd->weapon, &vd->shield);
|
||||
val = vd->shield;
|
||||
}
|
||||
else
|
||||
else
|
||||
vd->shield = val;
|
||||
break;
|
||||
case LOOK_BASE:
|
||||
if (!sd)
|
||||
if (!sd)
|
||||
break;
|
||||
|
||||
if ( val == INVISIBLE_CLASS )
|
||||
@ -4833,7 +4833,7 @@ void clif_getareachar_item(struct map_session_data* sd,struct flooritem_data* fi
|
||||
/// 01c9 <id>.L <creator id>.L <x>.W <y>.W <unit id>.B <visible>.B <has msg>.B <msg>.80B (ZC_SKILL_ENTRY2)
|
||||
static void clif_graffiti(struct block_list *bl, struct skill_unit *unit, enum send_target target) {
|
||||
unsigned char buf[128];
|
||||
|
||||
|
||||
nullpo_retv(bl);
|
||||
nullpo_retv(unit);
|
||||
|
||||
@ -5968,7 +5968,7 @@ void clif_displaymessage(const int fd, const char* mes)
|
||||
unsigned long color = (color_table[COLOR_DEFAULT] & 0x0000FF) << 16 | (color_table[COLOR_DEFAULT] & 0x00FF00) | (color_table[COLOR_DEFAULT] & 0xFF0000) >> 16; // RGB to BGR
|
||||
unsigned short len = strnlen(line, CHAT_SIZE_MAX);
|
||||
|
||||
if (len > 0) {
|
||||
if (len > 0) {
|
||||
WFIFOHEAD(fd, 13 + len);
|
||||
WFIFOW(fd, 0) = 0x2C1;
|
||||
WFIFOW(fd, 2) = 13 + len;
|
||||
@ -6305,7 +6305,7 @@ void clif_wis_message(int fd, const char* nick, const char* mes, int mes_len)
|
||||
}
|
||||
|
||||
|
||||
/// Inform the player about the result of his whisper action
|
||||
/// Inform the player about the result of his whisper action
|
||||
/// 0098 <result>.B (ZC_ACK_WHISPER).
|
||||
/// 09df <result>.B <GID>.L (ZC_ACK_WHISPER02).
|
||||
/// result:
|
||||
@ -9128,7 +9128,7 @@ void clif_messagecolor2(struct map_session_data *sd, unsigned long color, const
|
||||
/**
|
||||
* Notifies the client that the storage window is still open
|
||||
*
|
||||
* Should only be used in cases where the client closed the
|
||||
* Should only be used in cases where the client closed the
|
||||
* storage window without server's consent
|
||||
*/
|
||||
void clif_refresh_storagewindow(struct map_session_data *sd) {
|
||||
@ -9769,7 +9769,7 @@ static bool clif_process_message(struct map_session_data* sd, bool whisperFormat
|
||||
}
|
||||
|
||||
// process <name> part of the packet
|
||||
if( whisperFormat ) {
|
||||
if( whisperFormat ) {
|
||||
// name has fixed width
|
||||
if( inputLength < NAME_LENGTH + 1 ) {
|
||||
ShowWarning("clif_process_message: Received malformed packet from player '%s' (packet length is incorrect)!\n", sd->status.name);
|
||||
@ -9788,13 +9788,13 @@ static bool clif_process_message(struct map_session_data* sd, bool whisperFormat
|
||||
}
|
||||
|
||||
message = input + NAME_LENGTH;
|
||||
messageLength = inputLength - NAME_LENGTH;
|
||||
messageLength = inputLength - NAME_LENGTH;
|
||||
}else{
|
||||
// name and message are separated by ' : '
|
||||
size_t seperatorLength = strnlen( seperator, NAME_LENGTH );
|
||||
|
||||
nameLength = strnlen( sd->status.name, NAME_LENGTH - 1 ); // name length (w/o zero byte)
|
||||
|
||||
|
||||
// check if there's enough data provided
|
||||
if( inputLength < nameLength + seperatorLength + 1 ){
|
||||
ShowWarning("clif_process_message: Received malformed packet from player '%s' (no username data)!\n", sd->status.name);
|
||||
@ -9843,7 +9843,7 @@ static bool clif_process_message(struct map_session_data* sd, bool whisperFormat
|
||||
ShowWarning("clif_process_message: Player '%s' sent a message too long ('%.*s')!\n", sd->status.name, CHAT_SIZE_MAX-1, message);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// If it is not a whisper message, set the name to the fakename of the player
|
||||
if( whisperFormat == false && sd->fakename[0] != '\0' ){
|
||||
strcpy( out_name, sd->fakename );
|
||||
@ -11689,7 +11689,7 @@ void clif_parse_SelectCart(int fd,struct map_session_data *sd) {
|
||||
type = (int)RFIFOB(fd,6);
|
||||
|
||||
// Check type
|
||||
if( type < 10 || type > MAX_CARTS )
|
||||
if( type < 10 || type > MAX_CARTS )
|
||||
return;
|
||||
|
||||
pc_setcart(sd, type);
|
||||
@ -11715,7 +11715,7 @@ void clif_parse_ChangeCart(int fd,struct map_session_data *sd)
|
||||
|
||||
type = (int)RFIFOW(fd,packet_db[sd->packet_ver][RFIFOW(fd,0)].pos[0]);
|
||||
|
||||
if(
|
||||
if(
|
||||
#ifdef NEW_CARTS
|
||||
(type == 9 && sd->status.base_level > 130) ||
|
||||
(type == 8 && sd->status.base_level > 120) ||
|
||||
@ -11948,7 +11948,7 @@ void clif_parse_UseSkillToId(int fd, struct map_session_data *sd)
|
||||
} else if( sd->menuskill_id != SA_AUTOSPELL )
|
||||
return; //Can't use skills while a menu is open.
|
||||
}
|
||||
|
||||
|
||||
if( sd->skillitem == skill_id ) {
|
||||
if( skill_lv != sd->skillitemlv )
|
||||
skill_lv = sd->skillitemlv;
|
||||
@ -15495,7 +15495,7 @@ void clif_parse_Auction_search(int fd, struct map_session_data* sd){
|
||||
int page = RFIFOW(fd,info->pos[3]);
|
||||
|
||||
if( !battle_config.feature_auction )
|
||||
return;
|
||||
return;
|
||||
|
||||
clif_parse_Auction_cancelreg(fd, sd);
|
||||
|
||||
@ -15940,7 +15940,7 @@ void clif_quest_send_list(struct map_session_data *sd)
|
||||
offset += 4;
|
||||
WFIFOW(fd, offset) = qi->objectives_count;
|
||||
offset += 2;
|
||||
|
||||
|
||||
if( qi->objectives_count > 0 ){
|
||||
int j;
|
||||
struct mob_db *mob;
|
||||
@ -15974,7 +15974,7 @@ void clif_quest_send_list(struct map_session_data *sd)
|
||||
WFIFOB(fd, offset) = sd->quest_log[i].state;
|
||||
offset += 1;
|
||||
}
|
||||
|
||||
|
||||
WFIFOW(fd, 2) = offset;
|
||||
WFIFOSET(fd, offset);
|
||||
#endif
|
||||
@ -17522,7 +17522,7 @@ int clif_autoshadowspell_list(struct map_session_data *sd) {
|
||||
nullpo_ret(sd);
|
||||
fd = sd->fd;
|
||||
|
||||
if( !fd )
|
||||
if( !fd )
|
||||
return 0;
|
||||
|
||||
if( sd->menuskill_id == SC_AUTOSHADOWSPELL )
|
||||
@ -17530,7 +17530,7 @@ int clif_autoshadowspell_list(struct map_session_data *sd) {
|
||||
|
||||
WFIFOHEAD(fd, 2 * 6 + 4);
|
||||
WFIFOW(fd,0) = 0x442;
|
||||
|
||||
|
||||
//AEGIS listed the specified skills that available for SC_AUTOSHADOWSPELL
|
||||
for( i = 0, c = 0; i < MAX_SKILL; i++ )
|
||||
if( sd->status.skill[i].flag == SKILL_FLAG_PLAGIARIZED && sd->status.skill[i].id > 0 &&
|
||||
@ -17703,9 +17703,9 @@ void __attribute__ ((unused)) clif_parse_dull(int fd, struct map_session_data *s
|
||||
|
||||
void clif_partytickack(struct map_session_data* sd, bool flag) {
|
||||
WFIFOHEAD(sd->fd, packet_len(0x2c9));
|
||||
WFIFOW(sd->fd,0) = 0x2c9;
|
||||
WFIFOW(sd->fd,0) = 0x2c9;
|
||||
WFIFOB(sd->fd,2) = flag;
|
||||
WFIFOSET(sd->fd, packet_len(0x2c9));
|
||||
WFIFOSET(sd->fd, packet_len(0x2c9));
|
||||
}
|
||||
|
||||
/// Ack world info (ZC_ACK_BEFORE_WORLD_INFO)
|
||||
@ -17728,7 +17728,7 @@ void clif_ackworldinfo(struct map_session_data* sd) {
|
||||
/// 0978 <AID>.L
|
||||
void clif_parse_reqworldinfo(int fd,struct map_session_data *sd) {
|
||||
//uint32 aid = RFIFOL(fd,2); //should we trust client ?
|
||||
if(sd)
|
||||
if(sd)
|
||||
clif_ackworldinfo(sd);
|
||||
}
|
||||
|
||||
@ -19482,7 +19482,7 @@ void packetdb_readdb(bool reload)
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
while( fgets(line, sizeof(line), fp) ) {
|
||||
char w1[256],w2[256];
|
||||
ln++;
|
||||
@ -19656,7 +19656,7 @@ void packetdb_readdb(bool reload)
|
||||
#ifdef PACKET_OBFUSCATION
|
||||
if (!key_defined && !clif_cryptKey[0] && !clif_cryptKey[1] && !clif_cryptKey[2]) { // Not defined
|
||||
int use_key = last_key_defined;
|
||||
|
||||
|
||||
if (last_key_defined == -1)
|
||||
ShowError("Can't find packet obfuscation keys!\n");
|
||||
else {
|
||||
|
||||
@ -766,7 +766,7 @@ static bool read_elementaldb_sub(char* str[], int columns, int current) {
|
||||
db = &elemental_db[elemental_count];
|
||||
else
|
||||
db = &elemental_db[i];
|
||||
|
||||
|
||||
db->class_ = atoi(str[0]);
|
||||
safestrncpy(db->sprite, str[1], NAME_LENGTH);
|
||||
safestrncpy(db->name, str[2], NAME_LENGTH);
|
||||
|
||||
@ -2205,7 +2205,7 @@ void do_init_guild(void) {
|
||||
"/"DBIMPORT,
|
||||
};
|
||||
int i;
|
||||
|
||||
|
||||
guild_db = idb_alloc(DB_OPT_RELEASE_DATA);
|
||||
castle_db = idb_alloc(DB_OPT_BASE);
|
||||
guild_expcache_db = idb_alloc(DB_OPT_BASE);
|
||||
@ -2215,18 +2215,18 @@ void do_init_guild(void) {
|
||||
guild_flags_count = 0;
|
||||
|
||||
memset(guild_skill_tree,0,sizeof(guild_skill_tree));
|
||||
|
||||
|
||||
for(i=0; i<ARRAYLENGTH(dbsubpath); i++){
|
||||
int n1 = strlen(db_path)+strlen(dbsubpath[i])+1;
|
||||
char* dbsubpath1 = (char*)aMalloc(n1+1);
|
||||
safesnprintf(dbsubpath1,n1+1,"%s%s",db_path,dbsubpath[i]);
|
||||
|
||||
|
||||
sv_readdb(dbsubpath1, "castle_db.txt", ',', 4, 4, -1, &guild_read_castledb, i);
|
||||
sv_readdb(dbsubpath1, "guild_skill_tree.txt", ',', 2+MAX_GUILD_SKILL_REQUIRE*2, 2+MAX_GUILD_SKILL_REQUIRE*2, -1, &guild_read_guildskill_tree_db, i); //guild skill tree [Komurka]
|
||||
|
||||
|
||||
aFree(dbsubpath1);
|
||||
}
|
||||
|
||||
|
||||
add_timer_func_list(guild_payexp_timer,"guild_payexp_timer");
|
||||
add_timer_func_list(guild_send_xy_timer, "guild_send_xy_timer");
|
||||
add_timer_interval(gettick()+GUILD_PAYEXP_INTERVAL,guild_payexp_timer,0,0,GUILD_PAYEXP_INTERVAL);
|
||||
|
||||
@ -1587,7 +1587,7 @@ void read_homunculus_expdb(void)
|
||||
FILE *fp;
|
||||
char line[1024];
|
||||
int j=0;
|
||||
|
||||
|
||||
sprintf(line, "%s/%s", db_path, filename[i]);
|
||||
fp = fopen(line,"r");
|
||||
if (fp == NULL) {
|
||||
|
||||
@ -244,7 +244,7 @@ static int instance_startidletimer(struct instance_data *im, unsigned short inst
|
||||
static int instance_stopidletimer(struct instance_data *im, unsigned short instance_id)
|
||||
{
|
||||
nullpo_retr(0, im);
|
||||
|
||||
|
||||
// No timer
|
||||
if(im->idle_timer == INVALID_TIMER)
|
||||
return 1;
|
||||
|
||||
@ -65,7 +65,7 @@ int CheckForCharServer(void)
|
||||
* @param rename_flag
|
||||
* @param incubate
|
||||
* @param pet_name
|
||||
* @return
|
||||
* @return
|
||||
*/
|
||||
int intif_create_pet(uint32 account_id,uint32 char_id,short pet_class,short pet_lv,short pet_egg_id,
|
||||
short pet_equip,short intimate,short hungry,char rename_flag,char incubate,char *pet_name)
|
||||
@ -95,7 +95,7 @@ int intif_create_pet(uint32 account_id,uint32 char_id,short pet_class,short pet_
|
||||
* @param account_id
|
||||
* @param char_id
|
||||
* @param pet_id
|
||||
* @return
|
||||
* @return
|
||||
*/
|
||||
int intif_request_petdata(uint32 account_id,uint32 char_id,int pet_id)
|
||||
{
|
||||
@ -115,7 +115,7 @@ int intif_request_petdata(uint32 account_id,uint32 char_id,int pet_id)
|
||||
* Request char-serv to save a pet in persistence (SQL)
|
||||
* @param account_id
|
||||
* @param p
|
||||
* @return
|
||||
* @return
|
||||
*/
|
||||
int intif_save_petdata(uint32 account_id,struct s_pet *p)
|
||||
{
|
||||
@ -134,7 +134,7 @@ int intif_save_petdata(uint32 account_id,struct s_pet *p)
|
||||
/**
|
||||
* Request char-serv to delete the entry for this pet-char association
|
||||
* @param pet_id
|
||||
* @return
|
||||
* @return
|
||||
*/
|
||||
int intif_delete_petdata(int pet_id)
|
||||
{
|
||||
@ -153,7 +153,7 @@ int intif_delete_petdata(int pet_id)
|
||||
* @param sd
|
||||
* @param type
|
||||
* @param name
|
||||
* @return
|
||||
* @return
|
||||
*/
|
||||
int intif_rename(struct map_session_data *sd, int type, char *name)
|
||||
{
|
||||
@ -212,7 +212,7 @@ int intif_broadcast(const char* mes, int len, int type)
|
||||
* @param mes : Message to brodcast
|
||||
* @param len : Size of message
|
||||
* @param fontColor : color to display message
|
||||
* @param fontType :
|
||||
* @param fontType :
|
||||
* @param fontSize :
|
||||
* @param fontAlign :
|
||||
* @param fontY :
|
||||
@ -246,7 +246,7 @@ int intif_broadcast2(const char* mes, int len, unsigned long fontColor, short fo
|
||||
* send a message using the main chat system
|
||||
* @param sd : Player source of message
|
||||
* @param message : the message to sent
|
||||
* @return
|
||||
* @return
|
||||
*/
|
||||
int intif_main_message(struct map_session_data* sd, const char* message)
|
||||
{
|
||||
@ -470,7 +470,7 @@ int intif_saveregistry(struct map_session_data *sd)
|
||||
* Request the registries for this player.
|
||||
* @param sd : Player to load registry
|
||||
* @param flag : Type of registry to load, &1=acc (login-serv), &2=acc (char-serv), &4=char
|
||||
* @return
|
||||
* @return
|
||||
*/
|
||||
int intif_request_registry(struct map_session_data *sd, int flag)
|
||||
{
|
||||
@ -513,7 +513,7 @@ int intif_request_guild_storage(uint32 account_id,int guild_id)
|
||||
* Request to save guild storage
|
||||
* @param account_id : account requesting the save
|
||||
* @param gstor : Guild storage struct to save
|
||||
* @return
|
||||
* @return
|
||||
*/
|
||||
int intif_send_guild_storage(uint32 account_id,struct guild_storage *gstor)
|
||||
{
|
||||
@ -533,7 +533,7 @@ int intif_send_guild_storage(uint32 account_id,struct guild_storage *gstor)
|
||||
* Party creation request
|
||||
* @param member : Struct of 1 party member
|
||||
* @param name : Party name
|
||||
* @param item : item pickup rule
|
||||
* @param item : item pickup rule
|
||||
* @param item2 : item share rule
|
||||
* @return 0=error, 1=msg sent
|
||||
*/
|
||||
@ -576,7 +576,7 @@ int intif_request_partyinfo(int party_id, uint32 char_id)
|
||||
* Request to add a member to party
|
||||
* @param party_id : Party to add member to
|
||||
* @param member : member to add to party
|
||||
* @return
|
||||
* @return
|
||||
*/
|
||||
int intif_party_addmember(int party_id,struct party_member *member)
|
||||
{
|
||||
@ -681,10 +681,10 @@ int intif_break_party(int party_id)
|
||||
return 0;
|
||||
}
|
||||
|
||||
//
|
||||
//
|
||||
/**
|
||||
* Request sending party chat
|
||||
* (we using this in case we have multiple map-serv attached
|
||||
* (we using this in case we have multiple map-serv attached
|
||||
* to be sure all party get the message)
|
||||
* @param party_id : Party identification
|
||||
* @param account_id : Player sending the message
|
||||
@ -874,7 +874,7 @@ int intif_guild_memberinfoshort(int guild_id,uint32 account_id,uint32 char_id,in
|
||||
}
|
||||
|
||||
/**
|
||||
* Guild disbanded notification
|
||||
* Guild disbanded notification
|
||||
* @param guild_id : guild to disband
|
||||
* @return 0=error, 1=msg_sent
|
||||
*/
|
||||
@ -942,7 +942,7 @@ int intif_guild_change_basicinfo(int guild_id,int type,const void *data,int len)
|
||||
/**
|
||||
* Request a change of Guild member information
|
||||
* @param guild_id : Guild to alter
|
||||
* @param account_id : Player aid to alter
|
||||
* @param account_id : Player aid to alter
|
||||
* @param char_id : Player cid to alter
|
||||
* @param type : Type of modification
|
||||
* @param data : Value of modification
|
||||
@ -1013,7 +1013,7 @@ int intif_guild_skillup(int guild_id, uint16 skill_id, uint32 account_id, int ma
|
||||
* Request a new guild relationship
|
||||
* @param guild_id1 : Guild to associate 1
|
||||
* @param guild_id2 : Guild to associate 2
|
||||
* @param account_id1 : aid of player in guild1
|
||||
* @param account_id1 : aid of player in guild1
|
||||
* @param account_id2 : aid of player in guild2
|
||||
* @param flag : (GUILD_ALLIANCE_REMOVE|0|1)
|
||||
* @return 0=error, 1=msg_sent
|
||||
@ -1058,7 +1058,7 @@ int intif_guild_notice(int guild_id,const char *mes1,const char *mes2)
|
||||
* @param guild_id
|
||||
* @param len
|
||||
* @param data
|
||||
* @return
|
||||
* @return
|
||||
*/
|
||||
int intif_guild_emblem(int guild_id,int len,const char *data)
|
||||
{
|
||||
@ -1098,7 +1098,7 @@ int intif_guild_castle_dataload(int num, int *castle_ids)
|
||||
* @param castle_id
|
||||
* @param index
|
||||
* @param value
|
||||
* @return
|
||||
* @return
|
||||
*/
|
||||
int intif_guild_castle_datasave(int castle_id,int index, int value)
|
||||
{
|
||||
@ -1348,7 +1348,7 @@ void intif_parse_Registers(int fd)
|
||||
|
||||
// have it not complain about insertion of vars before loading, and not set those vars as new or modified
|
||||
reg_load = true;
|
||||
|
||||
|
||||
if( RFIFOW(fd, 14) ) {
|
||||
char key[32];
|
||||
unsigned int index;
|
||||
@ -1957,7 +1957,7 @@ void intif_request_questlog(TBL_PC *sd)
|
||||
{
|
||||
if (CheckForCharServer())
|
||||
return;
|
||||
|
||||
|
||||
WFIFOHEAD(inter_fd,6);
|
||||
WFIFOW(inter_fd,0) = 0x3060;
|
||||
WFIFOL(inter_fd,2) = sd->status.char_id;
|
||||
@ -2080,10 +2080,10 @@ int intif_Mail_requestinbox(uint32 char_id, unsigned char flag)
|
||||
}
|
||||
|
||||
/**
|
||||
* Map-serv received a mail from char-serv
|
||||
* Map-serv received a mail from char-serv
|
||||
* (inform user of new mail)
|
||||
* @param fd : char-serv link
|
||||
* @return 0=msg fail, 1=msg received
|
||||
* @return 0=msg fail, 1=msg received
|
||||
*/
|
||||
int intif_parse_Mail_inboxreceived(int fd)
|
||||
{
|
||||
@ -2271,7 +2271,7 @@ int intif_Mail_return(uint32 char_id, int mail_id)
|
||||
/**
|
||||
* Received a returned mail
|
||||
* @param fd
|
||||
* @return
|
||||
* @return
|
||||
*/
|
||||
int intif_parse_Mail_return(int fd)
|
||||
{
|
||||
@ -2600,7 +2600,7 @@ int intif_Auction_bid(uint32 char_id, const char* name, unsigned int auction_id,
|
||||
}
|
||||
|
||||
/**
|
||||
* Get back the money from biding auction,
|
||||
* Get back the money from biding auction,
|
||||
* (someone else have bid it over)
|
||||
* @param fd : char-serv link
|
||||
*/
|
||||
@ -2771,7 +2771,7 @@ int intif_parse_mercenary_saved(int fd)
|
||||
|
||||
/**
|
||||
* Request to create elemental, (verify and save on char-serv)
|
||||
* @param ele : Tmp Elemental data
|
||||
* @param ele : Tmp Elemental data
|
||||
* @return 0=error, 1=msg sent
|
||||
*/
|
||||
int intif_elemental_create(struct s_elemental *ele)
|
||||
@ -2903,7 +2903,7 @@ int intif_request_accinfo(int u_fd, int aid, int group_lv, char* query, char typ
|
||||
|
||||
if( CheckForCharServer() )
|
||||
return 0;
|
||||
|
||||
|
||||
WFIFOHEAD(inter_fd,2 + 4 + 4 + 4 + 1 + NAME_LENGTH);
|
||||
|
||||
WFIFOW(inter_fd,0) = 0x3007;
|
||||
@ -3057,10 +3057,10 @@ void intif_parse_broadcast_obtain_special_item(int fd) {
|
||||
*/
|
||||
void intif_itembound_guild_retrieve(uint32 char_id,uint32 account_id,int guild_id) {
|
||||
struct guild_storage *gstor = gstorage_get_storage(guild_id);
|
||||
|
||||
|
||||
if( CheckForCharServer() )
|
||||
return;
|
||||
|
||||
|
||||
WFIFOHEAD(inter_fd,12);
|
||||
WFIFOW(inter_fd,0) = 0x3056;
|
||||
WFIFOL(inter_fd,2) = char_id;
|
||||
@ -3118,7 +3118,7 @@ void intif_parse_itembound_store2gstorage(int fd) {
|
||||
//-----------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Communication from the inter server, Main entry point interface (inter<=>map)
|
||||
* Communication from the inter server, Main entry point interface (inter<=>map)
|
||||
* @param fd : inter-serv link
|
||||
* @return
|
||||
* 0 (unknow packet).
|
||||
|
||||
@ -209,12 +209,12 @@ char itemdb_pc_get_itemgroup(uint16 group_id, struct map_session_data *sd) {
|
||||
struct s_item_group_db *group;
|
||||
|
||||
nullpo_retr(1,sd);
|
||||
|
||||
|
||||
if (!(group = (struct s_item_group_db *) uidb_get(itemdb_group, group_id))) {
|
||||
ShowError("itemdb_pc_get_itemgroup: Invalid group id '%d' specified.\n",group_id);
|
||||
return 2;
|
||||
}
|
||||
|
||||
|
||||
// Get the 'must' item(s)
|
||||
if (group->must_qty) {
|
||||
for (i = 0; i < group->must_qty; i++)
|
||||
@ -562,7 +562,7 @@ static bool itemdb_read_group(char* str[], int columns, int current) {
|
||||
memset(&entry, 0, sizeof(entry));
|
||||
entry.amount = 1;
|
||||
entry.bound = BOUND_NONE;
|
||||
|
||||
|
||||
str[0] = trim(str[0]);
|
||||
if( ISDIGIT(str[0][0]) ){
|
||||
group_id = atoi(str[0]);
|
||||
@ -633,7 +633,7 @@ static bool itemdb_read_group(char* str[], int columns, int current) {
|
||||
if( columns > 7 ) entry.GUID = atoi(str[7]);
|
||||
if( columns > 8 ) entry.bound = cap_value(atoi(str[8]),BOUND_NONE,BOUND_MAX-1);
|
||||
if( columns > 9 ) entry.isNamed = atoi(str[9]);
|
||||
|
||||
|
||||
if (!(group = (struct s_item_group_db *) uidb_get(itemdb_group, group_id))) {
|
||||
CREATE(group, struct s_item_group_db, 1);
|
||||
group->id = group_id;
|
||||
@ -644,7 +644,7 @@ static bool itemdb_read_group(char* str[], int columns, int current) {
|
||||
if (!rand_group) {
|
||||
RECREATE(group->must, struct s_item_group_entry, group->must_qty+1);
|
||||
group->must[group->must_qty++] = entry;
|
||||
|
||||
|
||||
// If 'must' item isn't set as random item, skip the next process
|
||||
if (!prob) {
|
||||
return true;
|
||||
@ -655,13 +655,13 @@ static bool itemdb_read_group(char* str[], int columns, int current) {
|
||||
rand_group -= 1;
|
||||
|
||||
random = &group->random[rand_group];
|
||||
|
||||
|
||||
RECREATE(random->data, struct s_item_group_entry, random->data_qty+prob);
|
||||
|
||||
// Put the entry to its rand_group
|
||||
for (j = random->data_qty; j < random->data_qty+prob; j++)
|
||||
random->data[j] = entry;
|
||||
|
||||
|
||||
random->data_qty += prob;
|
||||
return true;
|
||||
}
|
||||
@ -875,7 +875,7 @@ static bool itemdb_read_flag(char* fields[], int columns, int current) {
|
||||
ShowError("itemdb_read_flag: Invalid item item with id %hu\n", nameid);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
flag = abs(atoi(fields[1]));
|
||||
set = atoi(fields[1]) > 0;
|
||||
|
||||
@ -1341,7 +1341,7 @@ static bool itemdb_parse_dbrow(char** str, const char* source, int line, int scr
|
||||
static int itemdb_readdb(void){
|
||||
const char* filename[] = {
|
||||
DBPATH"item_db.txt",
|
||||
DBIMPORT"/item_db.txt"
|
||||
DBIMPORT"/item_db.txt"
|
||||
};
|
||||
|
||||
int fi;
|
||||
@ -1658,18 +1658,18 @@ static void itemdb_read(void) {
|
||||
"",
|
||||
"/"DBIMPORT,
|
||||
};
|
||||
|
||||
|
||||
if (db_use_sqldbs)
|
||||
itemdb_read_sqldb();
|
||||
else
|
||||
itemdb_readdb();
|
||||
|
||||
|
||||
for(i=0; i<ARRAYLENGTH(dbsubpath); i++){
|
||||
uint8 n1 = (uint8)(strlen(db_path)+strlen(dbsubpath[i])+1);
|
||||
uint8 n2 = (uint8)(strlen(db_path)+strlen(DBPATH)+strlen(dbsubpath[i])+1);
|
||||
char* dbsubpath1 = (char*)aMalloc(n1+1);
|
||||
char* dbsubpath2 = (char*)aMalloc(n2+1);
|
||||
|
||||
|
||||
|
||||
if(i==0) {
|
||||
safesnprintf(dbsubpath1,n1,"%s%s",db_path,dbsubpath[i]);
|
||||
@ -1679,7 +1679,7 @@ static void itemdb_read(void) {
|
||||
safesnprintf(dbsubpath1,n1,"%s%s",db_path,dbsubpath[i]);
|
||||
safesnprintf(dbsubpath2,n1,"%s%s",db_path,dbsubpath[i]);
|
||||
}
|
||||
|
||||
|
||||
sv_readdb(dbsubpath1, "item_avail.txt", ',', 2, 2, -1, &itemdb_read_itemavail, i);
|
||||
sv_readdb(dbsubpath1, "item_stack.txt", ',', 3, 3, -1, &itemdb_read_stack, i);
|
||||
sv_readdb(dbsubpath1, "item_nouse.txt", ',', 3, 3, -1, &itemdb_read_nouse, i);
|
||||
|
||||
@ -1672,7 +1672,7 @@ 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:
|
||||
* flag:
|
||||
* 0x1 - only count standing units
|
||||
*------------------------------------------*/
|
||||
bool map_closest_freecell(int16 m, int16 *x, int16 *y, int type, int flag)
|
||||
@ -1699,7 +1699,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);
|
||||
@ -1824,7 +1824,7 @@ static DBData create_charid2nick(DBKey key, va_list args)
|
||||
void map_addnickdb(int charid, const char* nick)
|
||||
{
|
||||
struct charid2nick* p;
|
||||
|
||||
|
||||
if( map_charid2sd(charid) )
|
||||
return;// already online
|
||||
|
||||
@ -2016,10 +2016,10 @@ int map_quit(struct map_session_data *sd) {
|
||||
status_change_end(&sd->bl, SC_EQC, INVALID_TIMER);
|
||||
status_change_end(&sd->bl, SC_SPRITEMABLE, INVALID_TIMER);
|
||||
// Remove visuals effect from headgear
|
||||
status_change_end(&sd->bl, SC_MOONSTAR, INVALID_TIMER);
|
||||
status_change_end(&sd->bl, SC_SUPER_STAR, INVALID_TIMER);
|
||||
status_change_end(&sd->bl, SC_STRANGELIGHTS, INVALID_TIMER);
|
||||
status_change_end(&sd->bl, SC_DECORATION_OF_MUSIC, INVALID_TIMER);
|
||||
status_change_end(&sd->bl, SC_MOONSTAR, INVALID_TIMER);
|
||||
status_change_end(&sd->bl, SC_SUPER_STAR, INVALID_TIMER);
|
||||
status_change_end(&sd->bl, SC_STRANGELIGHTS, INVALID_TIMER);
|
||||
status_change_end(&sd->bl, SC_DECORATION_OF_MUSIC, INVALID_TIMER);
|
||||
if (battle_config.debuff_on_logout&1) { //Remove negative buffs
|
||||
status_change_end(&sd->bl, SC_ORCISH, INVALID_TIMER);
|
||||
status_change_end(&sd->bl, SC_STRIPWEAPON, INVALID_TIMER);
|
||||
@ -4715,7 +4715,7 @@ int do_init(int argc, char *argv[])
|
||||
add_timer_func_list(map_clearflooritem_timer, "map_clearflooritem_timer");
|
||||
add_timer_func_list(map_removemobs_timer, "map_removemobs_timer");
|
||||
add_timer_interval(gettick()+1000, map_freeblock_timer, 0, 0, 60*1000);
|
||||
|
||||
|
||||
map_do_init_msg();
|
||||
do_init_path();
|
||||
do_init_atcommand();
|
||||
|
||||
@ -701,7 +701,7 @@ struct map_data {
|
||||
/* 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;
|
||||
};
|
||||
|
||||
@ -531,7 +531,7 @@ static bool mercenary_readdb_sub(char* str[], int columns, int current)
|
||||
status->adelay = atoi(str[23]);
|
||||
status->amotion = atoi(str[24]);
|
||||
status->dmotion = atoi(str[25]);
|
||||
|
||||
|
||||
if (i >= mercenary_count)
|
||||
mercenary_count++;
|
||||
return true;
|
||||
|
||||
@ -370,7 +370,7 @@ int mob_get_random_id(int type, int flag, int lv)
|
||||
|
||||
if (type == MOBG_Bloody_Dead_Branch)
|
||||
flag &= ~4;
|
||||
|
||||
|
||||
if (!msummon) {
|
||||
ShowError("mob_get_random_id: Invalid type (%d) of random monster.\n", type);
|
||||
return 0;
|
||||
@ -434,7 +434,7 @@ bool mob_ksprotected (struct block_list *src, struct block_list *target)
|
||||
struct status_change_entry *sce;
|
||||
struct map_session_data *pl_sd; // Owner
|
||||
char output[128];
|
||||
|
||||
|
||||
if( map[md->bl.m].flag.allowks || map_flag_ks(md->bl.m) )
|
||||
return false; // Ignores GVG, PVP and AllowKS map flags
|
||||
|
||||
@ -1633,7 +1633,7 @@ static bool mob_ai_sub_hard(struct mob_data *md, unsigned int tick)
|
||||
) )
|
||||
{ // Rude attacked
|
||||
if (abl->id != md->bl.id //Self damage does not cause rude attack
|
||||
&& md->state.attacked_count++ >= RUDE_ATTACKED_COUNT
|
||||
&& md->state.attacked_count++ >= RUDE_ATTACKED_COUNT
|
||||
&& !mobskill_use(md, tick, MSC_RUDEATTACKED) && can_move
|
||||
&& !tbl && unit_escape(&md->bl, abl, rnd()%10 +1))
|
||||
{ //Escaped.
|
||||
@ -1765,7 +1765,7 @@ static bool mob_ai_sub_hard(struct mob_data *md, unsigned int tick)
|
||||
//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 (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)
|
||||
@ -1785,9 +1785,9 @@ static bool mob_ai_sub_hard(struct mob_data *md, unsigned int 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(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
|
||||
if (mobskill_use(md, tick, -1))
|
||||
return true;
|
||||
@ -2018,7 +2018,7 @@ static void mob_item_drop(struct mob_data *md, struct item_drop_list *dlist, str
|
||||
sd = map_charid2sd(dlist->first_charid);
|
||||
if( sd == NULL ) sd = map_charid2sd(dlist->second_charid);
|
||||
if( sd == NULL ) sd = map_charid2sd(dlist->third_charid);
|
||||
test_autoloot = sd
|
||||
test_autoloot = sd
|
||||
&& (drop_rate <= sd->state.autoloot || pc_isautolooting(sd, ditem->item_data.nameid))
|
||||
&& (battle_config.idle_no_autoloot == 0 || DIFF_TICK(last_tick, sd->idletime) < battle_config.idle_no_autoloot)
|
||||
&& (battle_config.homunculus_autoloot?1:!flag);
|
||||
@ -4909,7 +4909,7 @@ static void mob_skill_db_set_single(struct s_mob_skill *skill) {
|
||||
mob_skill_db_set_single_sub(mob, skill);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -4966,13 +4966,13 @@ static void mob_load(void)
|
||||
"/"DBIMPORT,
|
||||
};
|
||||
|
||||
for(i=0; i<ARRAYLENGTH(dbsubpath); i++){
|
||||
for(i=0; i<ARRAYLENGTH(dbsubpath); i++){
|
||||
int n1 = strlen(db_path)+strlen(dbsubpath[i])+1;
|
||||
int n2 = strlen(db_path)+strlen(DBPATH)+strlen(dbsubpath[i])+1;
|
||||
|
||||
char* dbsubpath1 = (char*)aMalloc(n1+1);
|
||||
char* dbsubpath2 = (char*)aMalloc(n2+1);
|
||||
|
||||
|
||||
if(i==0) {
|
||||
safesnprintf(dbsubpath1,n1,"%s%s",db_path,dbsubpath[i]);
|
||||
safesnprintf(dbsubpath2,n2,"%s/%s%s",db_path,DBPATH,dbsubpath[i]);
|
||||
@ -4981,7 +4981,7 @@ static void mob_load(void)
|
||||
safesnprintf(dbsubpath1,n1,"%s%s",db_path,dbsubpath[i]);
|
||||
safesnprintf(dbsubpath2,n1,"%s%s",db_path,dbsubpath[i]);
|
||||
}
|
||||
|
||||
|
||||
if (db_use_sqldbs && i==0) //only read once for sql
|
||||
{
|
||||
mob_read_sqldb();
|
||||
@ -5001,7 +5001,7 @@ static void mob_load(void)
|
||||
sv_readdb(dbsubpath2, "mob_boss.txt", ',', 4, 4, -1, &mob_readdb_group, i );
|
||||
sv_readdb(dbsubpath1, "mob_pouch.txt", ',', 4, 4, -1, &mob_readdb_group, i );
|
||||
sv_readdb(dbsubpath1, "mob_classchange.txt", ',', 4, 4, -1, &mob_readdb_group, i );
|
||||
|
||||
|
||||
aFree(dbsubpath1);
|
||||
aFree(dbsubpath2);
|
||||
}
|
||||
|
||||
@ -1236,7 +1236,7 @@ int npc_click(struct map_session_data* sd, struct npc_data* nd)
|
||||
//Hidden/Disabled npc.
|
||||
if (nd->class_ < 0 || nd->sc.option&(OPTION_INVISIBLE|OPTION_HIDE))
|
||||
return 1;
|
||||
|
||||
|
||||
switch(nd->subtype) {
|
||||
case NPCTYPE_SHOP:
|
||||
clif_npcbuysell(sd,nd->bl.id);
|
||||
@ -1546,7 +1546,7 @@ void npc_shop_currency_type(struct map_session_data *sd, struct npc_data *nd, in
|
||||
sprintf(output, msg_txt(sd, 715), nd->u.shop.pointshop_str); // Point Shop List: '%s'
|
||||
clif_broadcast(&sd->bl, output, strlen(output) + 1, BC_BLUE,SELF);
|
||||
}
|
||||
|
||||
|
||||
cost[0] = pc_readreg2(sd, nd->u.shop.pointshop_str);
|
||||
break;
|
||||
}
|
||||
@ -2069,7 +2069,7 @@ int npc_unload(struct npc_data* nd, bool single) {
|
||||
aFree(nd->path);/* remove now that no other instances exist */
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if( single && nd->bl.m != -1 )
|
||||
map_remove_questinfo(nd->bl.m, nd);
|
||||
|
||||
@ -2166,7 +2166,7 @@ int npc_addsrcfile(const char* name)
|
||||
ShowError("npc_addsrcfile: Can't find source file \"%s\"\n", name );
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// prevent multiple insert of source files
|
||||
file = npc_src_files;
|
||||
while( file != NULL )
|
||||
@ -2184,7 +2184,7 @@ int npc_addsrcfile(const char* name)
|
||||
npc_src_files = file;
|
||||
else
|
||||
file_prev->next = file;
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -2595,7 +2595,7 @@ static const char* npc_parse_shop(char* w1, char* w2, char* w3, char* w4, const
|
||||
is_discount = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
CREATE(nd, struct npc_data, 1);
|
||||
|
||||
nd->u.shop.count = 0;
|
||||
@ -2652,7 +2652,7 @@ static const char* npc_parse_shop(char* w1, char* w2, char* w3, char* w4, const
|
||||
//for logs filters, atcommands and iteminfo script command
|
||||
if( id->maxchance == 0 )
|
||||
id->maxchance = -1; // -1 would show that the item's sold in NPC Shop
|
||||
|
||||
|
||||
#if PACKETVER >= 20131223
|
||||
if (nd->u.shop.count && type == NPCTYPE_MARKETSHOP) {
|
||||
uint16 i;
|
||||
@ -4148,11 +4148,11 @@ int npc_parsesrcfile(const char* filepath, bool runOnInit)
|
||||
char* buffer;
|
||||
const char* p;
|
||||
|
||||
if(check_filepath(filepath)!=2) { //this is not a file
|
||||
if(check_filepath(filepath)!=2) { //this is not a file
|
||||
ShowDebug("npc_parsesrcfile: Path doesn't seem to be a file skipping it : '%s'.\n", filepath);
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// read whole file to buffer
|
||||
fp = fopen(filepath, "rb");
|
||||
if( fp == NULL )
|
||||
@ -4243,7 +4243,7 @@ int npc_parsesrcfile(const char* filepath, bool runOnInit)
|
||||
int count2;
|
||||
|
||||
count2 = sscanf(w1,"%23[^,],%6hd,%6hd[^,]",mapname,&x,&y);
|
||||
|
||||
|
||||
if ( count2 < 1 ) {
|
||||
ShowError("npc_parsesrcfile: Invalid script definition in file '%s', line '%d'. Skipping line...\n * w1=%s\n * w2=%s\n * w3=%s\n * w4=%s\n", filepath, strline(buffer,p-buffer), w1, w2, w3, w4);
|
||||
if (strcasecmp(w2,"script") == 0 && count > 3) {
|
||||
|
||||
@ -32,7 +32,7 @@
|
||||
*
|
||||
* defpattern 1, "[^:]+: (.*) loves (.*)", "label";
|
||||
*
|
||||
* this defines a new pattern in set 1 using perl syntax
|
||||
* this defines a new pattern in set 1 using perl syntax
|
||||
* (http://www.troubleshooters.com/codecorn/littperl/perlreg.htm)
|
||||
* and tells it to jump to the supplied label when the pattern
|
||||
* is matched.
|
||||
@ -42,7 +42,7 @@
|
||||
* before the script gets executed.
|
||||
*
|
||||
* activatepset 1;
|
||||
*
|
||||
*
|
||||
* This activates a set of patterns.. You can have many pattern
|
||||
* sets defined and many active all at once. This feature allows
|
||||
* you to set up "conversations" and ever changing expectations of
|
||||
@ -78,7 +78,7 @@ struct pcrematch_set {
|
||||
int setid;
|
||||
};
|
||||
|
||||
/*
|
||||
/*
|
||||
* Entire data structure hung off a NPC
|
||||
*
|
||||
* The reason I have done it this way (a void * in npc_data and then
|
||||
@ -109,29 +109,29 @@ void finalize_pcrematch_entry(struct pcrematch_entry* e)
|
||||
/**
|
||||
* Lookup (and possibly create) a new set of patterns by the set id
|
||||
*/
|
||||
static struct pcrematch_set* lookup_pcreset(struct npc_data* nd, int setid)
|
||||
static struct pcrematch_set* lookup_pcreset(struct npc_data* nd, int setid)
|
||||
{
|
||||
struct pcrematch_set *pcreset;
|
||||
struct npc_parse *npcParse = (struct npc_parse *) nd->chatdb;
|
||||
if (npcParse == NULL)
|
||||
if (npcParse == NULL)
|
||||
nd->chatdb = npcParse = (struct npc_parse *) aCalloc(sizeof(struct npc_parse), 1);
|
||||
|
||||
|
||||
pcreset = npcParse->active;
|
||||
|
||||
|
||||
while (pcreset != NULL) {
|
||||
if (pcreset->setid == setid)
|
||||
break;
|
||||
pcreset = pcreset->next;
|
||||
}
|
||||
if (pcreset == NULL)
|
||||
if (pcreset == NULL)
|
||||
pcreset = npcParse->inactive;
|
||||
|
||||
|
||||
while (pcreset != NULL) {
|
||||
if (pcreset->setid == setid)
|
||||
break;
|
||||
pcreset = pcreset->next;
|
||||
}
|
||||
|
||||
|
||||
if (pcreset == NULL) {
|
||||
pcreset = (struct pcrematch_set *) aCalloc(sizeof(struct pcrematch_set), 1);
|
||||
pcreset->next = npcParse->inactive;
|
||||
@ -141,7 +141,7 @@ static struct pcrematch_set* lookup_pcreset(struct npc_data* nd, int setid)
|
||||
npcParse->inactive = pcreset;
|
||||
pcreset->setid = setid;
|
||||
}
|
||||
|
||||
|
||||
return pcreset;
|
||||
}
|
||||
|
||||
@ -154,7 +154,7 @@ static void activate_pcreset(struct npc_data* nd, int setid)
|
||||
{
|
||||
struct pcrematch_set *pcreset;
|
||||
struct npc_parse *npcParse = (struct npc_parse *) nd->chatdb;
|
||||
if (npcParse == NULL)
|
||||
if (npcParse == NULL)
|
||||
return; // Nothing to activate...
|
||||
pcreset = npcParse->inactive;
|
||||
while (pcreset != NULL) {
|
||||
@ -168,9 +168,9 @@ static void activate_pcreset(struct npc_data* nd, int setid)
|
||||
pcreset->next->prev = pcreset->prev;
|
||||
if (pcreset->prev != NULL)
|
||||
pcreset->prev->next = pcreset->next;
|
||||
else
|
||||
else
|
||||
npcParse->inactive = pcreset->next;
|
||||
|
||||
|
||||
pcreset->prev = NULL;
|
||||
pcreset->next = npcParse->active;
|
||||
if (pcreset->next != NULL)
|
||||
@ -187,7 +187,7 @@ static void deactivate_pcreset(struct npc_data* nd, int setid)
|
||||
{
|
||||
struct pcrematch_set *pcreset;
|
||||
struct npc_parse *npcParse = (struct npc_parse *) nd->chatdb;
|
||||
if (npcParse == NULL)
|
||||
if (npcParse == NULL)
|
||||
return; // Nothing to deactivate...
|
||||
if (setid == -1) {
|
||||
while(npcParse->active != NULL)
|
||||
@ -206,9 +206,9 @@ static void deactivate_pcreset(struct npc_data* nd, int setid)
|
||||
pcreset->next->prev = pcreset->prev;
|
||||
if (pcreset->prev != NULL)
|
||||
pcreset->prev->next = pcreset->next;
|
||||
else
|
||||
else
|
||||
npcParse->active = pcreset->next;
|
||||
|
||||
|
||||
pcreset->prev = NULL;
|
||||
pcreset->next = npcParse->inactive;
|
||||
if (pcreset->next != NULL)
|
||||
@ -224,7 +224,7 @@ static void delete_pcreset(struct npc_data* nd, int setid)
|
||||
int active = 1;
|
||||
struct pcrematch_set *pcreset;
|
||||
struct npc_parse *npcParse = (struct npc_parse *) nd->chatdb;
|
||||
if (npcParse == NULL)
|
||||
if (npcParse == NULL)
|
||||
return; // Nothing to deactivate...
|
||||
pcreset = npcParse->active;
|
||||
while (pcreset != NULL) {
|
||||
@ -241,58 +241,58 @@ static void delete_pcreset(struct npc_data* nd, int setid)
|
||||
pcreset = pcreset->next;
|
||||
}
|
||||
}
|
||||
if (pcreset == NULL)
|
||||
if (pcreset == NULL)
|
||||
return;
|
||||
|
||||
|
||||
if (pcreset->next != NULL)
|
||||
pcreset->next->prev = pcreset->prev;
|
||||
if (pcreset->prev != NULL)
|
||||
pcreset->prev->next = pcreset->next;
|
||||
|
||||
|
||||
if(active)
|
||||
npcParse->active = pcreset->next;
|
||||
else
|
||||
npcParse->inactive = pcreset->next;
|
||||
|
||||
|
||||
pcreset->prev = NULL;
|
||||
pcreset->next = NULL;
|
||||
|
||||
|
||||
while (pcreset->head) {
|
||||
struct pcrematch_entry* n = pcreset->head->next;
|
||||
finalize_pcrematch_entry(pcreset->head);
|
||||
aFree(pcreset->head); // Cleanin' the last ones.. [Lance]
|
||||
pcreset->head = n;
|
||||
}
|
||||
|
||||
|
||||
aFree(pcreset);
|
||||
}
|
||||
|
||||
/**
|
||||
* create a new pattern entry
|
||||
* create a new pattern entry
|
||||
*/
|
||||
static struct pcrematch_entry* create_pcrematch_entry(struct pcrematch_set* set)
|
||||
{
|
||||
struct pcrematch_entry * e = (struct pcrematch_entry *) aCalloc(sizeof(struct pcrematch_entry), 1);
|
||||
struct pcrematch_entry * last = set->head;
|
||||
|
||||
|
||||
// Normally we would have just stuck it at the end of the list but
|
||||
// this doesn't sink up with peoples usage pattern. They wanted
|
||||
// the items defined first to have a higher priority then the
|
||||
// items defined later. as a result, we have to do some work up front.
|
||||
|
||||
|
||||
/* if we are the first pattern, stick us at the end */
|
||||
if (last == NULL) {
|
||||
set->head = e;
|
||||
return e;
|
||||
}
|
||||
|
||||
|
||||
/* Look for the last entry */
|
||||
while (last->next != NULL)
|
||||
last = last->next;
|
||||
|
||||
|
||||
last->next = e;
|
||||
e->next = NULL;
|
||||
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
@ -303,7 +303,7 @@ void npc_chat_def_pattern(struct npc_data* nd, int setid, const char* pattern, c
|
||||
{
|
||||
const char *err;
|
||||
int erroff;
|
||||
|
||||
|
||||
struct pcrematch_set * s = lookup_pcreset(nd, setid);
|
||||
struct pcrematch_entry *e = create_pcrematch_entry(s);
|
||||
e->pattern = aStrdup(pattern);
|
||||
@ -314,7 +314,7 @@ void npc_chat_def_pattern(struct npc_data* nd, int setid, const char* pattern, c
|
||||
|
||||
/**
|
||||
* Delete everything associated with a NPC concerning the pattern
|
||||
* matching code
|
||||
* matching code
|
||||
*
|
||||
* this could be more efficent but.. how often do you do this?
|
||||
*/
|
||||
@ -323,13 +323,13 @@ void npc_chat_finalize(struct npc_data* nd)
|
||||
struct npc_parse *npcParse = (struct npc_parse *) nd->chatdb;
|
||||
if (npcParse == NULL)
|
||||
return;
|
||||
|
||||
|
||||
while(npcParse->active)
|
||||
delete_pcreset(nd, npcParse->active->setid);
|
||||
|
||||
|
||||
while(npcParse->inactive)
|
||||
delete_pcreset(nd, npcParse->inactive->setid);
|
||||
|
||||
|
||||
// Additional cleaning up [Lance]
|
||||
aFree(npcParse);
|
||||
}
|
||||
@ -347,15 +347,15 @@ int npc_chat_sub(struct block_list* bl, va_list ap)
|
||||
struct npc_label_list* lst;
|
||||
struct pcrematch_set* pcreset;
|
||||
struct pcrematch_entry* e;
|
||||
|
||||
|
||||
// Not interested in anything you might have to say...
|
||||
if (npcParse == NULL || npcParse->active == NULL)
|
||||
return 0;
|
||||
|
||||
|
||||
msg = va_arg(ap,char*);
|
||||
len = va_arg(ap,int);
|
||||
sd = va_arg(ap,struct map_session_data *);
|
||||
|
||||
|
||||
// iterate across all active sets
|
||||
for (pcreset = npcParse->active; pcreset != NULL; pcreset = pcreset->next)
|
||||
{
|
||||
@ -363,7 +363,7 @@ int npc_chat_sub(struct block_list* bl, va_list ap)
|
||||
for (e = pcreset->head; e != NULL; e = e->next)
|
||||
{
|
||||
int offsets[2*10 + 10]; // 1/3 reserved for temp space requred by pcre_exec
|
||||
|
||||
|
||||
// perform pattern match
|
||||
int r = pcre_exec(e->pcre_, e->pcre_extra_, msg, len, 0, 0, offsets, ARRAYLENGTH(offsets));
|
||||
if (r > 0)
|
||||
@ -376,7 +376,7 @@ int npc_chat_sub(struct block_list* bl, va_list ap)
|
||||
pcre_copy_substring(msg, offsets, r, i, val, sizeof(val));
|
||||
set_var(sd, var, val);
|
||||
}
|
||||
|
||||
|
||||
// find the target label.. this sucks..
|
||||
lst = nd->u.scr.label_list;
|
||||
ARR_FIND(0, nd->u.scr.label_list_num, i, strncmp(lst[i].name, e->label, sizeof(lst[i].name)) == 0);
|
||||
@ -384,14 +384,14 @@ int npc_chat_sub(struct block_list* bl, va_list ap)
|
||||
ShowWarning("Unable to find label: %s\n", e->label);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// run the npc script
|
||||
run_script(nd->u.scr.script,lst[i].pos,sd->bl.id,nd->bl.id);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -403,9 +403,9 @@ int buildin_defpattern(struct script_state* st)
|
||||
const char* pattern = conv_str(st,& (st->stack->stack_data[st->start+3]));
|
||||
const char* label = conv_str(st,& (st->stack->stack_data[st->start+4]));
|
||||
struct npc_data* nd = (struct npc_data *)map_id2bl(st->oid);
|
||||
|
||||
|
||||
npc_chat_def_pattern(nd, setid, pattern, label);
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -413,9 +413,9 @@ int buildin_activatepset(struct script_state* st)
|
||||
{
|
||||
int setid = conv_num(st,& (st->stack->stack_data[st->start+2]));
|
||||
struct npc_data* nd = (struct npc_data *)map_id2bl(st->oid);
|
||||
|
||||
|
||||
activate_pcreset(nd, setid);
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -423,9 +423,9 @@ int buildin_deactivatepset(struct script_state* st)
|
||||
{
|
||||
int setid = conv_num(st,& (st->stack->stack_data[st->start+2]));
|
||||
struct npc_data* nd = (struct npc_data *)map_id2bl(st->oid);
|
||||
|
||||
|
||||
deactivate_pcreset(nd, setid);
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -433,9 +433,9 @@ int buildin_deletepset(struct script_state* st)
|
||||
{
|
||||
int setid = conv_num(st,& (st->stack->stack_data[st->start+2]));
|
||||
struct npc_data* nd = (struct npc_data *)map_id2bl(st->oid);
|
||||
|
||||
|
||||
delete_pcreset(nd, setid);
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
70
src/map/pc.c
70
src/map/pc.c
@ -819,7 +819,7 @@ bool pc_isequipped(struct map_session_data *sd, unsigned short nameid)
|
||||
continue;
|
||||
if( pc_is_same_equip_index((enum equip_index)i, sd->equip_index, index) )
|
||||
continue;
|
||||
if( !sd->inventory_data[index] )
|
||||
if( !sd->inventory_data[index] )
|
||||
continue;
|
||||
if( sd->inventory_data[index]->nameid == nameid )
|
||||
return true;
|
||||
@ -936,7 +936,7 @@ bool pc_adoption(struct map_session_data *p1_sd, struct map_session_data *p2_sd,
|
||||
|
||||
return false; // Job Change Fail
|
||||
}
|
||||
|
||||
|
||||
/*==========================================
|
||||
* Check if player can use/equip selected item. Used by pc_isUseitem and pc_isequip
|
||||
Returns:
|
||||
@ -1049,7 +1049,7 @@ uint8 pc_isequip(struct map_session_data *sd,int n)
|
||||
//Not equipable by class. [Skotlex]
|
||||
if (!(1ULL<<(sd->class_&MAPID_BASEMASK)&item->class_base[(sd->class_&JOBL_2_1)?1:((sd->class_&JOBL_2_2)?2:0)]))
|
||||
return ITEM_EQUIP_ACK_FAIL;
|
||||
|
||||
|
||||
if (!pc_isItemClass(sd,item))
|
||||
return ITEM_EQUIP_ACK_FAIL;
|
||||
|
||||
@ -1265,7 +1265,7 @@ bool pc_authok(struct map_session_data *sd, uint32 login_id2, time_t expiration_
|
||||
sd->status.cashshop_sent = false;
|
||||
|
||||
sd->last_addeditem_index = -1;
|
||||
|
||||
|
||||
sd->bonus_script.head = NULL;
|
||||
sd->bonus_script.count = 0;
|
||||
|
||||
@ -3835,7 +3835,7 @@ void pc_bonus3(struct map_session_data *sd,int type,int type2,int type3,int val)
|
||||
if (sd->state.lr_flag != 2)
|
||||
pc_bonus_subele(sd, (unsigned char)type2, type3, val);
|
||||
break;
|
||||
|
||||
|
||||
case SP_SP_VANISH_RACE_RATE: // bonus3 bSPVanishRaceRate,r,x,n;
|
||||
PC_BONUS_CHK_RACE(type2,SP_SP_VANISH_RACE_RATE);
|
||||
if(sd->state.lr_flag != 2) {
|
||||
@ -3989,7 +3989,7 @@ void pc_bonus5(struct map_session_data *sd,int type,int type2,int type3,int type
|
||||
if(sd->state.lr_flag != 2)
|
||||
pc_bonus_autospell_onskill(sd->autospell3, ARRAYLENGTH(sd->autospell3), type2, (val&1?-type3:type3), (val&2?-type4:type4), type5, current_equip_card_id);
|
||||
break;
|
||||
|
||||
|
||||
case SP_ADDEFF_ONSKILL: // bonus5 bAddEffOnSkill,sk,eff,n,y,t;
|
||||
PC_BONUS_CHK_SC(type3,SP_ADDEFF_ONSKILL);
|
||||
if( sd->state.lr_flag != 2 )
|
||||
@ -4865,7 +4865,7 @@ bool pc_isUseitem(struct map_session_data *sd,int n)
|
||||
(item->class_base[sd->class_&JOBL_2_1?1:(sd->class_&JOBL_2_2?2:0)])
|
||||
))
|
||||
return false;
|
||||
|
||||
|
||||
if (sd->sc.count && (
|
||||
sd->sc.data[SC_BERSERK] || sd->sc.data[SC_SATURDAYNIGHTFEVER] ||
|
||||
(sd->sc.data[SC_GRAVITATION] && sd->sc.data[SC_GRAVITATION]->val3 == BCT_SELF) ||
|
||||
@ -4880,7 +4880,7 @@ bool pc_isUseitem(struct map_session_data *sd,int n)
|
||||
sd->sc.data[SC_KINGS_GRACE] ||
|
||||
sd->sc.data[SC_SUHIDE]))
|
||||
return false;
|
||||
|
||||
|
||||
if (!pc_isItemClass(sd,item))
|
||||
return false;
|
||||
|
||||
@ -5467,7 +5467,7 @@ enum e_setpos pc_setpos(struct map_session_data* sd, unsigned short mapindex, in
|
||||
x = rnd()%(map[m].xs-2)+1;
|
||||
y = rnd()%(map[m].ys-2)+1;
|
||||
c++;
|
||||
|
||||
|
||||
if(c > (map[m].xs * map[m].ys)*3){ //force out
|
||||
ShowError("pc_setpos: couldn't found a valid coordinates for player '%s' (%d:%d) on (%s), preventing warp\n", sd->status.name, sd->status.account_id, sd->status.char_id, mapindex_id2name(mapindex));
|
||||
return SETPOS_OK; //preventing warp
|
||||
@ -5531,14 +5531,14 @@ enum e_setpos pc_setpos(struct map_session_data* sd, unsigned short mapindex, in
|
||||
}
|
||||
|
||||
pc_cell_basilica(sd);
|
||||
|
||||
|
||||
//check if we gonna be rewarped [lighta]
|
||||
if(npc_check_areanpc(1,m,x,y,0)){
|
||||
sd->count_rewarp++;
|
||||
}
|
||||
else
|
||||
else
|
||||
sd->count_rewarp = 0;
|
||||
|
||||
|
||||
return SETPOS_OK;
|
||||
}
|
||||
|
||||
@ -5642,7 +5642,7 @@ int pc_get_skillcooldown(struct map_session_data *sd, uint16 skill_id, uint16 sk
|
||||
uint8 i;
|
||||
uint16 idx = skill_get_index(skill_id);
|
||||
int cooldown = 0, cooldownlen = ARRAYLENGTH(sd->skillcooldown);
|
||||
|
||||
|
||||
if (!idx) return 0;
|
||||
if (skill_db[idx]->cooldown[skill_lv - 1])
|
||||
cooldown = skill_db[idx]->cooldown[skill_lv - 1];
|
||||
@ -6565,7 +6565,7 @@ void pc_gainexp(struct map_session_data *sd, struct block_list *src, unsigned in
|
||||
|
||||
if (!battle_config.pvp_exp && map[sd->bl.m].flag.pvp) // [MouseJstr]
|
||||
return; // no exp on pvp maps
|
||||
|
||||
|
||||
if (sd->status.guild_id>0)
|
||||
base_exp -= guild_payexp(sd,base_exp);
|
||||
}
|
||||
@ -7738,7 +7738,7 @@ int pc_dead(struct map_session_data *sd,struct block_list *src)
|
||||
base_penalty = u32min(sd->status.base_exp, base_penalty);
|
||||
}
|
||||
}
|
||||
else
|
||||
else
|
||||
base_penalty = 0;
|
||||
|
||||
if ((battle_config.death_penalty_maxlv&2 || !pc_is_maxjoblv(sd)) && job_penalty > 0) {
|
||||
@ -8167,7 +8167,7 @@ bool pc_setparam(struct map_session_data *sd,int type,int val)
|
||||
case SP_CHARMOVE:
|
||||
sd->status.character_moves = val;
|
||||
return true;
|
||||
case SP_CHARRENAME:
|
||||
case SP_CHARRENAME:
|
||||
sd->status.rename = val;
|
||||
return true;
|
||||
case SP_CHARFONT:
|
||||
@ -9048,7 +9048,7 @@ int pc_setregistry(struct map_session_data *sd, int64 reg, int val)
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if ( !reg_load && !sd->vars_ok ) {
|
||||
ShowError("pc_setregistry : refusing to set %s until vars are received.\n", regname);
|
||||
return 0;
|
||||
@ -9365,11 +9365,11 @@ static int pc_checkcombo(struct map_session_data *sd, struct item_data *data) {
|
||||
combo_idx[j].idx=-1;
|
||||
memset(combo_idx[j].card,-1,MAX_SLOTS);
|
||||
}
|
||||
|
||||
|
||||
for( j = 0; j < nb_itemCombo; j++ ) {
|
||||
uint16 id = data->combos[i]->nameid[j], k;
|
||||
bool found = false;
|
||||
|
||||
|
||||
for( k = 0; k < EQI_MAX; k++ ) {
|
||||
short index = sd->equip_index[k];
|
||||
if( index < 0 )
|
||||
@ -9378,7 +9378,7 @@ static int pc_checkcombo(struct map_session_data *sd, struct item_data *data) {
|
||||
continue;
|
||||
if (!sd->inventory_data[index] )
|
||||
continue;
|
||||
|
||||
|
||||
if ( itemdb_type(id) != IT_CARD ) {
|
||||
if ( sd->inventory_data[index]->nameid != id )
|
||||
continue;
|
||||
@ -9400,7 +9400,7 @@ static int pc_checkcombo(struct map_session_data *sd, struct item_data *data) {
|
||||
if ( sd->inventory_data[index]->slot == 0 || itemdb_isspecial(sd->status.inventory[index].card[0]) )
|
||||
continue;
|
||||
for (z = 0; z < sd->inventory_data[index]->slot; z++) {
|
||||
bool do_continue=false;
|
||||
bool do_continue=false;
|
||||
if (sd->status.inventory[index].card[z] != id)
|
||||
continue;
|
||||
if(j>0){
|
||||
@ -11082,7 +11082,7 @@ static bool pc_readdb_job_basehpsp(char* fields[], int columns, int current)
|
||||
use_endlvl = endlvl;
|
||||
if (use_endlvl > job_info[idx].max_level[0])
|
||||
use_endlvl = job_info[idx].max_level[0];
|
||||
|
||||
|
||||
if(type == 0) { //hp type
|
||||
uint16 j;
|
||||
for(j = 0; j < use_endlvl; j++) {
|
||||
@ -11141,7 +11141,7 @@ static bool pc_readdb_job_param(char* fields[], int columns, int current)
|
||||
job_info[idx].max_param.int_ = int_;
|
||||
job_info[idx].max_param.dex = dex;
|
||||
job_info[idx].max_param.luk = luk;
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -11174,7 +11174,7 @@ static int pc_read_statsdb(const char *basedir, int last_s, bool silent){
|
||||
int i=1;
|
||||
char line[24000]; //FIXME this seem too big
|
||||
FILE *fp;
|
||||
|
||||
|
||||
sprintf(line, "%s/statpoint.txt", basedir);
|
||||
fp=fopen(line,"r");
|
||||
if(fp == NULL){
|
||||
@ -11218,7 +11218,7 @@ void pc_readdb(void) {
|
||||
"/"DBIMPORT,
|
||||
//add other path here
|
||||
};
|
||||
|
||||
|
||||
//reset
|
||||
memset(job_info,0,sizeof(job_info)); // job_info table
|
||||
|
||||
@ -11290,7 +11290,7 @@ void pc_readdb(void) {
|
||||
for (; s <= MAX_LEVEL; s++)
|
||||
statp[s] = statp[s-1] + pc_gets_status_point(s-1);
|
||||
battle_config.use_statpoint_table = k; //restore setting
|
||||
|
||||
|
||||
//Checking if all class have their data
|
||||
for (i = 0; i < JOB_MAX; i++) {
|
||||
int idx;
|
||||
@ -11304,7 +11304,7 @@ void pc_readdb(void) {
|
||||
ShowWarning("Class %s (%d) does not have a base exp table.\n", job_name(i), i);
|
||||
if (!job_info[idx].max_level[1])
|
||||
ShowWarning("Class %s (%d) does not have a job exp table.\n", job_name(i), i);
|
||||
|
||||
|
||||
//Init and checking the empty value of Base HP/SP [Cydh]
|
||||
for (j = 0; j < (job_info[idx].max_level[0] ? job_info[idx].max_level[0] : MAX_LEVEL); j++) {
|
||||
if (job_info[idx].base_hp[j] == 0)
|
||||
@ -11624,7 +11624,7 @@ int pc_global_expiration_timer(int tid, unsigned int tick, int id, intptr_t data
|
||||
return 0;
|
||||
}
|
||||
|
||||
void pc_expire_check(struct map_session_data *sd) {
|
||||
void pc_expire_check(struct map_session_data *sd) {
|
||||
/* ongoing timer */
|
||||
if( sd->expiration_tid != INVALID_TIMER )
|
||||
return;
|
||||
@ -11673,7 +11673,7 @@ enum e_BANKING_DEPOSIT_ACK pc_bank_deposit(struct map_session_data *sd, int mone
|
||||
**/
|
||||
enum e_BANKING_WITHDRAW_ACK pc_bank_withdraw(struct map_session_data *sd, int money) {
|
||||
unsigned int limit_check = money + sd->status.zeny;
|
||||
|
||||
|
||||
if( money <= 0 ) {
|
||||
return BWA_UNKNOWN_ERROR;
|
||||
} else if ( money > sd->bank_vault ) {
|
||||
@ -11683,10 +11683,10 @@ enum e_BANKING_WITHDRAW_ACK pc_bank_withdraw(struct map_session_data *sd, int mo
|
||||
clif_colormes(sd->fd,color_table[COLOR_RED],msg_txt(sd,1495)); //You can't withdraw that much money
|
||||
return BWA_UNKNOWN_ERROR;
|
||||
}
|
||||
|
||||
|
||||
if( pc_getzeny(sd,money, LOG_TYPE_BANK, NULL) )
|
||||
return BWA_NO_MONEY;
|
||||
|
||||
|
||||
sd->bank_vault -= money;
|
||||
pc_setreg2(sd, BANK_VAULT_VAR, sd->bank_vault);
|
||||
if( save_settings&CHARSAVE_BANK )
|
||||
@ -11786,7 +11786,7 @@ struct s_bonus_script_entry *pc_bonus_script_add(struct map_session_data *sd, co
|
||||
|
||||
if (!sd)
|
||||
return NULL;
|
||||
|
||||
|
||||
if (!(script = parse_script(script_str, "bonus_script", 0, SCRIPT_IGNORE_EXTERNAL_BRACKETS))) {
|
||||
ShowError("pc_bonus_script_add: Failed to parse script '%s' (CID:%d).\n", script_str, sd->status.char_id);
|
||||
return NULL;
|
||||
@ -11944,7 +11944,7 @@ void pc_bonus_script_clear(struct map_session_data *sd, uint16 flag) {
|
||||
*/
|
||||
void pc_cell_basilica(struct map_session_data *sd) {
|
||||
nullpo_retv(sd);
|
||||
|
||||
|
||||
if (!map_getcell(sd->bl.m,sd->bl.x,sd->bl.y,CELL_CHKBASILICA)) {
|
||||
if (&sd->sc && sd->sc.data[SC_BASILICA])
|
||||
status_change_end(&sd->bl,SC_BASILICA,INVALID_TIMER);
|
||||
@ -11979,7 +11979,7 @@ short pc_maxparameter(struct map_session_data *sd, enum e_params param) {
|
||||
|
||||
return (class_&MAPID_BASEMASK) == MAPID_SUMMONER ? battle_config.max_summoner_parameter :
|
||||
((class_&MAPID_UPPERMASK) == MAPID_KAGEROUOBORO || (class_&MAPID_UPPERMASK) == MAPID_REBELLION) ? battle_config.max_extended_parameter :
|
||||
((class_&JOBL_THIRD) ? ((class_&JOBL_UPPER) ? battle_config.max_third_trans_parameter : ((class_&JOBL_BABY) ? battle_config.max_baby_third_parameter : battle_config.max_third_parameter)) :
|
||||
((class_&JOBL_THIRD) ? ((class_&JOBL_UPPER) ? battle_config.max_third_trans_parameter : ((class_&JOBL_BABY) ? battle_config.max_baby_third_parameter : battle_config.max_third_parameter)) :
|
||||
((class_&JOBL_BABY) ? battle_config.max_baby_parameter :
|
||||
((class_&JOBL_UPPER) ? battle_config.max_trans_parameter : battle_config.max_parameter)));
|
||||
}
|
||||
@ -12014,7 +12014,7 @@ short pc_get_itemgroup_bonus(struct map_session_data* sd, unsigned short nameid)
|
||||
struct s_item_group_db *group = NULL;
|
||||
if (!group_id || !(group = itemdb_group_exists(group_id)))
|
||||
continue;
|
||||
|
||||
|
||||
for (j = 0; j < group->random[0].data_qty; j++) {
|
||||
if (group->random[0].data[j].nameid == nameid) {
|
||||
bonus += sd->itemgrouphealrate[i]->rate;
|
||||
|
||||
@ -63,7 +63,7 @@ static void read_config(void)
|
||||
config_setting_t *groups = NULL;
|
||||
const char *config_filename = "conf/groups.conf"; // FIXME hardcoded name
|
||||
int group_count = 0;
|
||||
|
||||
|
||||
if (conf_read_file(&pc_group_config, config_filename))
|
||||
return;
|
||||
|
||||
@ -135,10 +135,10 @@ static void read_config(void)
|
||||
|
||||
strdb_put(pc_groupname_db, groupname, group_settings);
|
||||
idb_put(pc_group_db, id, group_settings);
|
||||
|
||||
|
||||
}
|
||||
group_count = config_setting_length(groups); // Save number of groups
|
||||
|
||||
|
||||
// Check if all commands and permissions exist
|
||||
iter = db_iterator(pc_group_db);
|
||||
for (group_settings = (GroupSettings *)dbi_first(iter); dbi_exists(iter); group_settings = (GroupSettings *)dbi_next(iter)) {
|
||||
@ -191,9 +191,9 @@ static void read_config(void)
|
||||
*commands = group_settings->commands,
|
||||
*permissions = group_settings->permissions;
|
||||
int j, inherit_count = 0, done = 0;
|
||||
|
||||
|
||||
if (group_settings->inheritance_done) // group already processed
|
||||
continue;
|
||||
continue;
|
||||
|
||||
if ((inherit = group_settings->inherit) == NULL ||
|
||||
(inherit_count = config_setting_length(inherit)) <= 0) { // this group does not inherit from others
|
||||
@ -201,7 +201,7 @@ static void read_config(void)
|
||||
group_settings->inheritance_done = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
for (j = 0; j < inherit_count; ++j) {
|
||||
GroupSettings *inherited_group = NULL;
|
||||
const char *groupname = config_setting_get_string_elem(inherit, j);
|
||||
@ -234,7 +234,7 @@ static void read_config(void)
|
||||
|
||||
++done; // copied commands and permissions from one of inherited groups
|
||||
}
|
||||
|
||||
|
||||
if (done == inherit_count) { // copied commands from all of inherited groups
|
||||
++i;
|
||||
group_settings->inheritance_done = true; // we're done with this group
|
||||
@ -272,7 +272,7 @@ static void read_config(void)
|
||||
|
||||
ShowStatus("Done reading '"CL_WHITE"%d"CL_RESET"' groups in '"CL_WHITE"%s"CL_RESET"'.\n", group_count, config_filename);
|
||||
|
||||
|
||||
|
||||
if( ( pc_group_max = group_count ) ) {
|
||||
DBIterator *iter = db_iterator(pc_group_db);
|
||||
GroupSettings *group_settings = NULL;
|
||||
@ -281,11 +281,11 @@ static void read_config(void)
|
||||
for (group_settings = (GroupSettings *)dbi_first(iter); dbi_exists(iter); group_settings = (GroupSettings *)dbi_next(iter)) {
|
||||
group_ids[i++] = group_settings->id;
|
||||
}
|
||||
|
||||
|
||||
atcommand_db_load_groups(group_ids);
|
||||
|
||||
|
||||
aFree(group_ids);
|
||||
|
||||
|
||||
dbi_destroy(iter);
|
||||
}
|
||||
}
|
||||
@ -330,7 +330,7 @@ bool pc_group_can_use_command(int group_id, const char *command, AtCommandType t
|
||||
commands = group->commands;
|
||||
if (commands != NULL) {
|
||||
config_setting_t *cmd = NULL;
|
||||
|
||||
|
||||
// <commandname> : <bool> (only atcommand)
|
||||
if (type == COMMAND_ATCOMMAND && config_setting_lookup_bool(commands, command, &result))
|
||||
return (bool)result;
|
||||
@ -454,7 +454,7 @@ void pc_groups_reload(void) {
|
||||
|
||||
do_final_pc_groups();
|
||||
do_init_pc_groups();
|
||||
|
||||
|
||||
/* refresh online users permissions */
|
||||
iter = mapit_getallusers();
|
||||
for (sd = (TBL_PC*)mapit_first(iter); mapit_exists(iter); sd = (TBL_PC*)mapit_next(iter)) {
|
||||
|
||||
@ -509,7 +509,7 @@ int pet_birth_process(struct map_session_data *sd, struct s_pet *pet)
|
||||
}
|
||||
|
||||
intif_save_petdata(sd->status.account_id,pet);
|
||||
|
||||
|
||||
if (save_settings&CHARSAVE_PET)
|
||||
chrif_save(sd,0); //is it REALLY Needed to save the char for hatching a pet? [Skotlex]
|
||||
|
||||
|
||||
@ -2240,7 +2240,7 @@ static void read_constdb(void)
|
||||
continue;
|
||||
if(line[0]=='/' && line[1]=='/') //ignore commented line
|
||||
continue;
|
||||
|
||||
|
||||
type=0;
|
||||
if(sscanf(line,"%1023[A-Za-z0-9/_],%1023[A-Za-z0-9/_-],%11d",name,val,&type)>=2 ||
|
||||
sscanf(line,"%1023[A-Za-z0-9/_] %1023[A-Za-z0-9/_-] %11d",name,val,&type)>=2){
|
||||
@ -2805,7 +2805,7 @@ unsigned int script_array_highest_key(struct script_state *st, struct map_sessio
|
||||
return sa->size ? highest_key + 1 : 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return SCRIPT_CMD_SUCCESS;
|
||||
}
|
||||
|
||||
@ -3398,7 +3398,7 @@ struct script_state* script_alloc_state(struct script_code* rootscript, int pos,
|
||||
st->oid = oid;
|
||||
st->sleep.timer = INVALID_TIMER;
|
||||
st->npc_item_flag = battle_config.item_enabled_npc;
|
||||
|
||||
|
||||
if( st->script->instances != USHRT_MAX )
|
||||
st->script->instances++;
|
||||
else {
|
||||
@ -6344,14 +6344,14 @@ BUILDIN_FUNC(deletearray)
|
||||
list = script_array_cpy_list(sa);
|
||||
size = sa->size;
|
||||
qsort(list, size, sizeof(unsigned int), script_array_index_cmp);
|
||||
|
||||
|
||||
ARR_FIND(0, size, i, list[i] >= start);
|
||||
|
||||
|
||||
for( ; i < size && list[i] < start + count; i++ ) {
|
||||
// Clear any entries between start and start+count, if they exist
|
||||
set_reg(st, sd, reference_uid(id, list[i]), name, value, reference_getref(data));
|
||||
}
|
||||
|
||||
|
||||
for( ; i < size && list[i] < end; i++ ) {
|
||||
// Move back count positions any entries between start+count to fill the gaps
|
||||
void* v = get_val2(st, reference_uid(id, list[i]), reference_getref(data));
|
||||
@ -6365,7 +6365,7 @@ BUILDIN_FUNC(deletearray)
|
||||
unsigned int *list = NULL, size = 0;
|
||||
list = script_array_cpy_list(sa);
|
||||
size = sa->size;
|
||||
|
||||
|
||||
for(i = 0; i < size; i++) {
|
||||
if( list[i] >= start ) // Less expensive than sorting it, most likely
|
||||
set_reg(st, sd, reference_uid(id, list[i]), name, value, reference_getref(data));
|
||||
@ -6509,7 +6509,7 @@ BUILDIN_FUNC(countitem)
|
||||
i = 1;
|
||||
aid = 10;
|
||||
}
|
||||
|
||||
|
||||
if( script_hasdata(st,aid) ) {
|
||||
if( !(sd = map_id2sd( (aid = script_getnum(st, aid)) )) ) {
|
||||
ShowError("buildin_%s: player not found (AID=%d).\n", command, aid);
|
||||
@ -6521,7 +6521,7 @@ BUILDIN_FUNC(countitem)
|
||||
if( !(sd = script_rid2sd(st)) )
|
||||
return SCRIPT_CMD_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
if( !strncmp(command, "cart", 4) ) {
|
||||
loc = 1;
|
||||
size = MAX_CART;
|
||||
@ -6543,7 +6543,7 @@ BUILDIN_FUNC(countitem)
|
||||
script_pushint(st,-1);
|
||||
return SCRIPT_CMD_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
data = script_getdata(st, 2);
|
||||
get_val(st, data); // Convert into value in case of a variable
|
||||
|
||||
@ -7090,7 +7090,7 @@ BUILDIN_FUNC(rentitem2) {
|
||||
ShowError("buildin_rentitem2: invalid data type for argument #1 (%d).\n", data->type);
|
||||
return SCRIPT_CMD_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
seconds = script_getnum(st,3);
|
||||
iden = script_getnum(st,4);
|
||||
ref = script_getnum(st,5);
|
||||
@ -7287,7 +7287,7 @@ BUILDIN_FUNC(makeitem2) {
|
||||
struct item item_tmp;
|
||||
struct script_data *data;
|
||||
struct item_data *id;
|
||||
|
||||
|
||||
data = script_getdata(st,2);
|
||||
get_val(st,data);
|
||||
if( data_isstring(data) ){
|
||||
@ -7315,7 +7315,7 @@ BUILDIN_FUNC(makeitem2) {
|
||||
}
|
||||
else
|
||||
m = map_mapname2mapid(mapname);
|
||||
|
||||
|
||||
if ((id = itemdb_search(nameid))) {
|
||||
char iden, ref, attr;
|
||||
memset(&item_tmp,0,sizeof(item_tmp));
|
||||
@ -7323,7 +7323,7 @@ BUILDIN_FUNC(makeitem2) {
|
||||
|
||||
iden = (char)script_getnum(st,7);
|
||||
ref = (char)script_getnum(st,8);
|
||||
attr = (char)script_getnum(st,9);
|
||||
attr = (char)script_getnum(st,9);
|
||||
|
||||
if (id->type==IT_WEAPON || id->type==IT_ARMOR || id->type==IT_SHADOWGEAR) {
|
||||
if(ref > MAX_REFINE) ref = MAX_REFINE;
|
||||
@ -7336,7 +7336,7 @@ BUILDIN_FUNC(makeitem2) {
|
||||
iden = 1;
|
||||
ref = attr = 0;
|
||||
}
|
||||
|
||||
|
||||
item_tmp.identify = iden;
|
||||
item_tmp.refine = ref;
|
||||
item_tmp.attribute = attr;
|
||||
@ -7972,7 +7972,7 @@ BUILDIN_FUNC(getguildname)
|
||||
guild_id = script_getnum(st,2);
|
||||
if( ( g = guild_search(guild_id) ) != NULL )
|
||||
script_pushstrcopy(st,g->name);
|
||||
else
|
||||
else
|
||||
script_pushconststr(st,"null");
|
||||
return SCRIPT_CMD_SUCCESS;
|
||||
}
|
||||
@ -7989,7 +7989,7 @@ BUILDIN_FUNC(getguildmaster)
|
||||
guild_id = script_getnum(st,2);
|
||||
if( ( g = guild_search(guild_id) ) != NULL )
|
||||
script_pushstrcopy(st,g->member[0].name);
|
||||
else
|
||||
else
|
||||
script_pushconststr(st,"null");
|
||||
return SCRIPT_CMD_SUCCESS;
|
||||
}
|
||||
@ -9115,7 +9115,7 @@ BUILDIN_FUNC(end)
|
||||
if (sd){
|
||||
if (sd->state.callshop == 0)
|
||||
clif_scriptclose(sd, st->oid); // If a menu/select/prompt is active, close it.
|
||||
else
|
||||
else
|
||||
sd->state.callshop = 0;
|
||||
}
|
||||
|
||||
@ -11375,7 +11375,7 @@ BUILDIN_FUNC(waitingroomkick)
|
||||
struct npc_data* nd;
|
||||
struct chat_data* cd;
|
||||
const char* kickusername;
|
||||
|
||||
|
||||
nd = npc_name2id(script_getstr(st,2));
|
||||
kickusername = script_getstr(st,3);
|
||||
|
||||
@ -11399,7 +11399,7 @@ BUILDIN_FUNC(getwaitingroomusers)
|
||||
nd = npc_name2id(script_getstr(st, 2));
|
||||
else
|
||||
nd = (struct npc_data *)map_id2bl(st->oid);
|
||||
|
||||
|
||||
if( nd != NULL && (cd=(struct chat_data *)map_id2bl(nd->chat_id)) != NULL ) {
|
||||
for(i = 0; i < cd->users; ++i) {
|
||||
setd_sub(st, NULL, ".@waitingroom_users", j, (void *)__64BPRTSIZE(cd->usersd[i]->status.account_id), NULL);
|
||||
@ -13909,7 +13909,7 @@ BUILDIN_FUNC(atcommand) {
|
||||
|
||||
/** Displays a message for the player only (like system messages like "you got an apple" )
|
||||
* dispbottom("<message>"{,<color>{,<char_id>}})
|
||||
* @param message
|
||||
* @param message
|
||||
* @param color Hex color default (Green)
|
||||
*/
|
||||
BUILDIN_FUNC(dispbottom)
|
||||
@ -18497,7 +18497,7 @@ BUILDIN_FUNC(setquest)
|
||||
}
|
||||
|
||||
//20120410 or 20090218 ? no reason that shouldn't work for 2009
|
||||
pc_show_questinfo(sd);
|
||||
pc_show_questinfo(sd);
|
||||
return SCRIPT_CMD_SUCCESS;
|
||||
}
|
||||
|
||||
@ -18541,7 +18541,7 @@ BUILDIN_FUNC(completequest)
|
||||
BUILDIN_FUNC(changequest)
|
||||
{
|
||||
struct map_session_data *sd;
|
||||
|
||||
|
||||
if (!script_charid2sd(4,sd))
|
||||
return SCRIPT_CMD_FAILURE;
|
||||
|
||||
@ -18674,7 +18674,7 @@ BUILDIN_FUNC(waitingroom2bg)
|
||||
return SCRIPT_CMD_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
for (i = 0; i < cd->users; i++) { // Only add those who are in the chat room
|
||||
struct map_session_data *sd;
|
||||
if( (sd = cd->usersd[i]) != NULL && bg_team_join(bg_id, sd) ){
|
||||
@ -19541,7 +19541,7 @@ BUILDIN_FUNC(showdigit)
|
||||
**/
|
||||
BUILDIN_FUNC(makerune) {
|
||||
TBL_PC* sd;
|
||||
|
||||
|
||||
if (!script_charid2sd(3,sd))
|
||||
return SCRIPT_CMD_FAILURE;
|
||||
clif_skill_produce_mix_list(sd,RK_RUNEMASTERY,24);
|
||||
@ -19553,7 +19553,7 @@ BUILDIN_FUNC(makerune) {
|
||||
**/
|
||||
BUILDIN_FUNC(checkdragon) {
|
||||
TBL_PC* sd;
|
||||
|
||||
|
||||
if (!script_charid2sd(2,sd))
|
||||
return SCRIPT_CMD_FAILURE;
|
||||
if( pc_isridingdragon(sd) )
|
||||
@ -19607,7 +19607,7 @@ BUILDIN_FUNC(setdragon) {
|
||||
**/
|
||||
BUILDIN_FUNC(ismounting) {
|
||||
TBL_PC* sd;
|
||||
|
||||
|
||||
if (!script_charid2sd(2,sd))
|
||||
return SCRIPT_CMD_FAILURE;
|
||||
if( &sd->sc && sd->sc.data[SC_ALL_RIDING] )
|
||||
@ -19625,7 +19625,7 @@ BUILDIN_FUNC(ismounting) {
|
||||
**/
|
||||
BUILDIN_FUNC(setmounting) {
|
||||
TBL_PC* sd;
|
||||
|
||||
|
||||
if (!script_charid2sd(2,sd))
|
||||
return SCRIPT_CMD_FAILURE;
|
||||
if( &sd->sc && sd->sc.option&(OPTION_WUGRIDER|OPTION_RIDING|OPTION_DRAGON|OPTION_MADOGEAR) ) {
|
||||
@ -19966,10 +19966,10 @@ BUILDIN_FUNC(getrandgroupitem) {
|
||||
BUILDIN_FUNC(getgroupitem) {
|
||||
TBL_PC *sd;
|
||||
int group_id = script_getnum(st,2);
|
||||
|
||||
|
||||
if (!script_charid2sd(3,sd))
|
||||
return SCRIPT_CMD_SUCCESS;
|
||||
|
||||
|
||||
if (itemdb_pc_get_itemgroup(group_id,sd)) {
|
||||
ShowError("buildin_getgroupitem: Invalid group id '%d' specified.\n",group_id);
|
||||
return SCRIPT_CMD_FAILURE;
|
||||
@ -20027,7 +20027,7 @@ BUILDIN_FUNC(npcskill)
|
||||
struct npc_data *nd;
|
||||
struct map_session_data *sd;
|
||||
struct script_data *data;
|
||||
|
||||
|
||||
data = script_getdata(st, 2);
|
||||
get_val(st, data); // Convert into value in case of a variable
|
||||
skill_id = data_isstring(data) ? skill_name2id(script_getstr(st, 2)) : script_getnum(st, 2);
|
||||
@ -20504,7 +20504,7 @@ BUILDIN_FUNC(vip_time) {
|
||||
if (sd == NULL)
|
||||
return SCRIPT_CMD_FAILURE;
|
||||
|
||||
chrif_req_login_operation(sd->status.account_id, sd->status.name, CHRIF_OP_LOGIN_VIP, viptime, 7, 0);
|
||||
chrif_req_login_operation(sd->status.account_id, sd->status.name, CHRIF_OP_LOGIN_VIP, viptime, 7, 0);
|
||||
#endif
|
||||
return SCRIPT_CMD_SUCCESS;
|
||||
}
|
||||
@ -20632,7 +20632,7 @@ BUILDIN_FUNC(bonus_script) {
|
||||
|
||||
if (sd == NULL)
|
||||
return SCRIPT_CMD_FAILURE;
|
||||
|
||||
|
||||
script_str = script_getstr(st,2);
|
||||
dur = 1000 * abs(script_getnum(st,3));
|
||||
FETCH(4, flag);
|
||||
@ -20787,7 +20787,7 @@ BUILDIN_FUNC(addspiritball) {
|
||||
uint8 i, count = script_getnum(st,2);
|
||||
uint16 duration = script_getnum(st,3);
|
||||
struct map_session_data *sd = NULL;
|
||||
|
||||
|
||||
if (count == 0)
|
||||
return SCRIPT_CMD_SUCCESS;
|
||||
|
||||
@ -20816,10 +20816,10 @@ BUILDIN_FUNC(addspiritball) {
|
||||
BUILDIN_FUNC(delspiritball) {
|
||||
uint8 count = script_getnum(st,2);
|
||||
struct map_session_data *sd = NULL;
|
||||
|
||||
|
||||
if (count == 0)
|
||||
count = 1;
|
||||
|
||||
|
||||
if (script_hasdata(st,3)) {
|
||||
if (!script_isstring(st,3))
|
||||
sd = map_charid2sd(script_getnum(st,3));
|
||||
@ -20975,7 +20975,7 @@ BUILDIN_FUNC(npcshopupdate) {
|
||||
script_pushint(st,0);
|
||||
return SCRIPT_CMD_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
if (!nd->u.shop.count) {
|
||||
ShowError("buildin_npcshopupdate: Attempt to update empty shop from '%s'.\n", nd->exname);
|
||||
script_pushint(st,0);
|
||||
@ -21374,10 +21374,10 @@ BUILDIN_FUNC(minmax){
|
||||
int value;
|
||||
// Function pointer for our comparison function (either min or max at the moment)
|
||||
int32 (*func)(int32, int32);
|
||||
|
||||
|
||||
// Get the real function name
|
||||
functionname = script_getfuncname(st);
|
||||
|
||||
|
||||
// Our data should start at offset 2
|
||||
i = 2;
|
||||
|
||||
@ -21402,7 +21402,7 @@ BUILDIN_FUNC(minmax){
|
||||
// As long as we have data on our script stack
|
||||
while( script_hasdata(st,i) ){
|
||||
struct script_data *data;
|
||||
|
||||
|
||||
// Get the next piece of data from the script stack
|
||||
data = script_getdata( st, i );
|
||||
|
||||
@ -21444,7 +21444,7 @@ BUILDIN_FUNC(minmax){
|
||||
// Skip empty arrays
|
||||
if( start < end ){
|
||||
int id;
|
||||
|
||||
|
||||
// For getting the values we need the id of the array
|
||||
id = reference_getid( data );
|
||||
|
||||
|
||||
@ -3114,7 +3114,7 @@
|
||||
export_constant(ADOPT_MORE_CHILDREN);
|
||||
export_constant(ADOPT_LEVEL_70);
|
||||
export_constant(ADOPT_MARRIED);
|
||||
|
||||
|
||||
/* directions */
|
||||
export_constant(DIR_NORTH);
|
||||
export_constant(DIR_NORTHWEST);
|
||||
|
||||
@ -1589,12 +1589,12 @@ 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 WM_SOUND_OF_DESTRUCTION:
|
||||
if( tsc && ( tsc->data[SC_SWINGDANCE] || tsc->data[SC_SYMPHONYOFLOVER] || tsc->data[SC_MOONLITSERENADE] ||
|
||||
tsc->data[SC_RUSHWINDMILL] || tsc->data[SC_ECHOSONG] || tsc->data[SC_HARMONIZE] ||
|
||||
tsc->data[SC_VOICEOFSIREN] || tsc->data[SC_DEEPSLEEP] || tsc->data[SC_SIRCLEOFNATURE] ||
|
||||
tsc->data[SC_GLOOMYDAY] || tsc->data[SC_GLOOMYDAY_SK] || tsc->data[SC_SONGOFMANA] ||
|
||||
tsc->data[SC_DANCEWITHWUG] || tsc->data[SC_SATURDAYNIGHTFEVER] || tsc->data[SC_LERADSDEW] ||
|
||||
tsc->data[SC_MELODYOFSINK] || tsc->data[SC_BEYONDOFWARCRY] || tsc->data[SC_UNLIMITEDHUMMINGVOICE] ) &&
|
||||
if( tsc && ( tsc->data[SC_SWINGDANCE] || tsc->data[SC_SYMPHONYOFLOVER] || tsc->data[SC_MOONLITSERENADE] ||
|
||||
tsc->data[SC_RUSHWINDMILL] || tsc->data[SC_ECHOSONG] || tsc->data[SC_HARMONIZE] ||
|
||||
tsc->data[SC_VOICEOFSIREN] || tsc->data[SC_DEEPSLEEP] || tsc->data[SC_SIRCLEOFNATURE] ||
|
||||
tsc->data[SC_GLOOMYDAY] || tsc->data[SC_GLOOMYDAY_SK] || tsc->data[SC_SONGOFMANA] ||
|
||||
tsc->data[SC_DANCEWITHWUG] || tsc->data[SC_SATURDAYNIGHTFEVER] || tsc->data[SC_LERADSDEW] ||
|
||||
tsc->data[SC_MELODYOFSINK] || tsc->data[SC_BEYONDOFWARCRY] || tsc->data[SC_UNLIMITEDHUMMINGVOICE] ) &&
|
||||
rnd()%100 < 4 * skill_lv + 2 * ((sd) ? pc_checkskill(sd, WM_LESSON) : skill_get_max(WM_LESSON)) + 10 * chorusbonus) {
|
||||
status_change_start(src, bl, SC_STUN, 10000, skill_lv, 0, 0, 0, skill_get_time(skill_id,skill_lv), SCSTART_NOTICKDEF);
|
||||
status_change_end(bl, SC_DANCING, INVALID_TIMER);
|
||||
@ -2646,7 +2646,7 @@ static int skill_magic_reflect(struct block_list* src, struct block_list* bl, in
|
||||
* @param skill_id: Target skill
|
||||
* @return 0: Skill is not a combo
|
||||
* 1: Skill is a normal combo
|
||||
* 2: Skill is combo that prioritizes auto-target even if val2 is set
|
||||
* 2: Skill is combo that prioritizes auto-target even if val2 is set
|
||||
* @author Panikon
|
||||
*/
|
||||
int skill_is_combo(uint16 skill_id) {
|
||||
@ -2999,7 +2999,7 @@ void skill_attack_blow(struct block_list *src, struct block_list *dsrc, struct b
|
||||
*
|
||||
* flag&0xF000 - Values from enum e_skill_display
|
||||
* flag&0x3F0000 - Values from enum e_battle_check_target
|
||||
*
|
||||
*
|
||||
* flag&0x1000000 - Return 0 if damage was reflected
|
||||
*-------------------------------------------------------------------------*/
|
||||
int64 skill_attack (int attack_type, struct block_list* src, struct block_list *dsrc, struct block_list *bl, uint16 skill_id, uint16 skill_lv, unsigned int tick, int flag)
|
||||
@ -3072,7 +3072,7 @@ int64 skill_attack (int attack_type, struct block_list* src, struct block_list *
|
||||
dmg.damage = battle_attr_fix(src, bl, pd->a_skill->damage, element, tstatus->def_ele, tstatus->ele_lv);
|
||||
else
|
||||
dmg.damage = pd->a_skill->damage; // Fixed damage
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
dmg.damage = 1*pd->a_skill->div_;
|
||||
@ -4012,7 +4012,7 @@ static int skill_timerskill(int tid, unsigned int tick, int id, intptr_t data)
|
||||
if( nbl == NULL )
|
||||
skl->x++;
|
||||
else
|
||||
skl->x = 0;
|
||||
skl->x = 0;
|
||||
skill_addtimerskill(src, tick + 651, (nbl?nbl:target)->id, skl->x, 0, WL_CHAINLIGHTNING_ATK, skl->skill_lv, skl->type + 1, skl->flag);
|
||||
}
|
||||
}
|
||||
@ -4806,7 +4806,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint
|
||||
if(!map_getcell(bl->m, bl->x, bl->y, CELL_CHKLANDPROTECTOR)) // Nothing should happen if the target is on Land Protector
|
||||
skill_attack(skill_get_type(skill_id), src, src, bl, skill_id, skill_lv, tick, flag);
|
||||
break;
|
||||
|
||||
|
||||
case SM_MAGNUM:
|
||||
case MS_MAGNUM:
|
||||
if( flag&1 ) {
|
||||
@ -7460,7 +7460,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
|
||||
}
|
||||
|
||||
case AM_BERSERKPITCHER:
|
||||
case AM_POTIONPITCHER:
|
||||
case AM_POTIONPITCHER:
|
||||
{
|
||||
int j,hp = 0,sp = 0;
|
||||
if( dstmd && dstmd->mob_id == MOBID_EMPERIUM ) {
|
||||
@ -8103,7 +8103,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
|
||||
|
||||
if( (!f_sd && !m_sd) // if neither was found
|
||||
|| (sd->status.party_id != 0 && //not in same party
|
||||
((!f_sd || sd->status.party_id != f_sd->status.party_id)
|
||||
((!f_sd || sd->status.party_id != f_sd->status.party_id)
|
||||
&& (!m_sd || sd->status.party_id != m_sd->status.party_id) //if both are online they should all be in same team
|
||||
))
|
||||
|| ((!f_sd || !check_distance_bl(&sd->bl, &f_sd->bl, AREA_SIZE)) //not in same screen
|
||||
@ -9156,7 +9156,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
|
||||
clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if(status_isimmune(bl))
|
||||
break;
|
||||
|
||||
@ -10445,7 +10445,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case KO_KAHU_ENTEN:
|
||||
case KO_HYOUHU_HUBUKI:
|
||||
@ -10926,7 +10926,7 @@ static int8 skill_castend_id_check(struct block_list *src, struct block_list *ta
|
||||
if (target->type == BL_SKILL) {
|
||||
TBL_SKILL *su = (TBL_SKILL*)target;
|
||||
if (!su || !su->group)
|
||||
return USESKILL_FAIL_MAX;
|
||||
return USESKILL_FAIL_MAX;
|
||||
if (skill_get_inf2(su->group->skill_id)&INF2_TRAP)
|
||||
return USESKILL_FAIL_MAX;
|
||||
}
|
||||
@ -12946,7 +12946,7 @@ struct skill_unit_group *skill_unitsetting(struct block_list *src, uint16 skill_
|
||||
break;
|
||||
case WZ_WATERBALL:
|
||||
//Check if there are cells that can be turned into waterball units
|
||||
if (!sd || map_getcell(src->m, ux, uy, CELL_CHKWATER)
|
||||
if (!sd || map_getcell(src->m, ux, uy, CELL_CHKWATER)
|
||||
|| (map_find_skill_unit_oncell(src, ux, uy, SA_DELUGE, NULL, 1)) != NULL || (map_find_skill_unit_oncell(src, ux, uy, NJ_SUITON, NULL, 1)) != NULL)
|
||||
break; //Turn water, deluge or suiton into waterball cell
|
||||
continue;
|
||||
@ -14667,7 +14667,7 @@ static bool skill_check_condition_sc_required(struct map_session_data *sd, unsig
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Check skill condition when cast begin
|
||||
* For ammo, only check if the skill need ammo
|
||||
* For checking ammo requirement (type and amount) will be skill_check_condition_castend
|
||||
@ -15231,7 +15231,7 @@ bool skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_i
|
||||
int16 sx = sd->bl.x;
|
||||
int16 sy = sd->bl.y;
|
||||
uint8 dir = (unit_getdir(&sd->bl)) % 8;
|
||||
|
||||
|
||||
switch (dir) {
|
||||
case 0: case 8: sy++; break;
|
||||
case 1: sx--; sy++; break;
|
||||
@ -15269,7 +15269,7 @@ bool skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_i
|
||||
case LG_SHIELDSPELL: {
|
||||
short index = sd->equip_index[EQI_HAND_L];
|
||||
struct item_data *shield_data = NULL;
|
||||
|
||||
|
||||
if (index >= 0 && sd->inventory_data[index] && sd->inventory_data[index]->type == IT_ARMOR)
|
||||
shield_data = sd->inventory_data[index];
|
||||
if (!shield_data || shield_data->type != IT_ARMOR) { // Skill will first check if a shield is equipped. If none is found the skill will fail.
|
||||
@ -15536,7 +15536,7 @@ bool skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_i
|
||||
return false;
|
||||
}
|
||||
|
||||
if( (require.spiritball > 0 && sd->spiritball < require.spiritball) ||
|
||||
if( (require.spiritball > 0 && sd->spiritball < require.spiritball) ||
|
||||
(require.spiritball == -1 && sd->spiritball < 1) ) {
|
||||
clif_skill_fail(sd,skill_id,USESKILL_FAIL_SPIRITS,(require.spiritball == -1)? 1: require.spiritball);
|
||||
return false;
|
||||
@ -17428,7 +17428,7 @@ bool skill_check_shadowform(struct block_list *bl, int64 damage, int hit)
|
||||
if( sc && sc->data[SC__SHADOWFORM] ) {
|
||||
struct block_list *src = map_id2bl(sc->data[SC__SHADOWFORM]->val2);
|
||||
|
||||
if( !src || src->m != bl->m ) {
|
||||
if( !src || src->m != bl->m ) {
|
||||
status_change_end(bl, SC__SHADOWFORM, INVALID_TIMER);
|
||||
return false;
|
||||
}
|
||||
@ -19367,7 +19367,7 @@ int skill_poisoningweapon(struct map_session_data *sd, unsigned short nameid)
|
||||
clif_skill_fail(sd,GC_POISONINGWEAPON,USESKILL_FAIL_LEVEL,0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
chance = 2 + 2 * sd->menuskill_val; // 2 + 2 * skill_lv
|
||||
sc_start4(&sd->bl,&sd->bl, SC_POISONINGWEAPON, 100, pc_checkskill(sd, GC_RESEARCHNEWPOISON), //in Aegis it store the level of GC_RESEARCHNEWPOISON in val1
|
||||
type, chance, val4, skill_get_time(GC_POISONINGWEAPON, sd->menuskill_val));
|
||||
@ -21013,7 +21013,7 @@ static bool skill_parse_row_magicmushroomdb(char* split[], int column, int curre
|
||||
return true;
|
||||
}
|
||||
|
||||
skill_magicmushroom_db[i].skill_id = skill_id;
|
||||
skill_magicmushroom_db[i].skill_id = skill_id;
|
||||
if (i == skill_magicmushroom_count)
|
||||
skill_magicmushroom_count++;
|
||||
|
||||
@ -21258,7 +21258,7 @@ static void skill_readdb(void)
|
||||
"/"DBIMPORT,
|
||||
//add other path here
|
||||
};
|
||||
|
||||
|
||||
db_clear(skilldb_name2id);
|
||||
for(i = 0; i < (UINT16_MAX+1); i++)
|
||||
skilldb_id2idx[i] = 0;
|
||||
@ -21288,7 +21288,7 @@ static void skill_readdb(void)
|
||||
safesnprintf(dbsubpath1,n1,"%s%s",db_path,dbsubpath[i]);
|
||||
safesnprintf(dbsubpath2,n1,"%s%s",db_path,dbsubpath[i]);
|
||||
}
|
||||
|
||||
|
||||
sv_readdb(dbsubpath2, "skill_db.txt" , ',', 18, 18, -1, skill_parse_row_skilldb, i);
|
||||
sv_readdb(dbsubpath2, "skill_require_db.txt" , ',', 34, 34, -1, skill_parse_row_requiredb, i);
|
||||
sv_readdb(dbsubpath2, "skill_cast_db.txt" , ',', 7, 8, -1, skill_parse_row_castdb, i);
|
||||
@ -21311,7 +21311,7 @@ static void skill_readdb(void)
|
||||
aFree(dbsubpath1);
|
||||
aFree(dbsubpath2);
|
||||
}
|
||||
|
||||
|
||||
skill_init_unit_layout();
|
||||
skill_init_nounit_layout();
|
||||
}
|
||||
|
||||
@ -623,7 +623,7 @@ void initChangeTables(void)
|
||||
set_sc( RK_ABUNDANCE , SC_ABUNDANCE , SI_ABUNDANCE , SCB_NONE );
|
||||
set_sc( RK_CRUSHSTRIKE , SC_CRUSHSTRIKE , SI_CRUSHSTRIKE , SCB_NONE );
|
||||
set_sc_with_vfx( RK_DRAGONBREATH_WATER , SC_FREEZING , SI_FROSTMISTY , SCB_ASPD|SCB_SPEED|SCB_DEF|SCB_DEF2 );
|
||||
|
||||
|
||||
/* GC Guillotine Cross */
|
||||
set_sc_with_vfx( GC_VENOMIMPRESS, SC_VENOMIMPRESS , SI_VENOMIMPRESS , SCB_NONE );
|
||||
set_sc( GC_POISONINGWEAPON , SC_POISONINGWEAPON , SI_POISONINGWEAPON , SCB_NONE );
|
||||
@ -1450,7 +1450,7 @@ int status_set_maxhp(struct block_list *bl, unsigned int maxhp, int flag)
|
||||
* @param bl: Object whose SP will be set [PC|HOM|MER|ELEM]
|
||||
* @param sp: What the SP is to be set as
|
||||
* @param flag: Used in case final value is higher than current
|
||||
* Use 2 to display healing effect
|
||||
* Use 2 to display healing effect
|
||||
* @return heal or zapped SP if valid
|
||||
*/
|
||||
int status_set_sp(struct block_list *bl, unsigned int sp, int flag)
|
||||
@ -1502,7 +1502,7 @@ int status_set_maxsp(struct block_list *bl, unsigned int maxsp, int flag)
|
||||
* Takes HP/SP from an Object
|
||||
* @param bl: Object who will have HP/SP taken [PC|MOB|HOM|MER|ELEM]
|
||||
* @param hp: How much HP to charge
|
||||
* @param sp: How much SP to charge
|
||||
* @param sp: How much SP to charge
|
||||
* @return hp+sp through status_damage()
|
||||
* Note: HP/SP are integer values, not percentages. Values should be
|
||||
* calculated either within function call or before
|
||||
@ -1845,8 +1845,8 @@ int status_heal(struct block_list *bl,int64 hhp,int64 hsp, int flag)
|
||||
* @param hp_rate: Percentage of HP to modify. If > 0:percent is of current HP, if < 0:percent is of max HP
|
||||
* @param sp_rate: Percentage of SP to modify. If > 0:percent is of current SP, if < 0:percent is of max SP
|
||||
* @param flag: \n
|
||||
* 0: Heal target \n
|
||||
* 1: Use status_damage \n
|
||||
* 0: Heal target \n
|
||||
* 1: Use status_damage \n
|
||||
* 2: Use status_damage and make sure target must not die from subtraction
|
||||
* @return hp+sp through status_heal()
|
||||
*/
|
||||
@ -2028,7 +2028,7 @@ bool status_check_skilluse(struct block_list *src, struct block_list *target, ui
|
||||
if (skill_id != RK_REFRESH && sc->opt1 && !(sc->opt1 == OPT1_CRYSTALIZE && src->type == BL_MOB) && sc->opt1 != OPT1_BURNING && skill_id != SR_GENTLETOUCH_CURE) { // Stuned/Frozen/etc
|
||||
if (flag != 1) // Can't cast, casted stuff can't damage.
|
||||
return false;
|
||||
if (!(skill_get_inf(skill_id)&INF_GROUND_SKILL))
|
||||
if (!(skill_get_inf(skill_id)&INF_GROUND_SKILL))
|
||||
return false; // Targetted spells can't come off.
|
||||
}
|
||||
|
||||
@ -2698,7 +2698,7 @@ int status_calc_mob_(struct mob_data* md, enum e_status_calc_opt opt)
|
||||
// Remove special AI when this is used by regular mobs.
|
||||
if (mbl->type == BL_MOB && !((TBL_MOB*)mbl)->special_state.ai)
|
||||
md->special_state.ai = AI_NONE;
|
||||
if (ud) {
|
||||
if (ud) {
|
||||
// Different levels of HP according to skill level
|
||||
if(!ud->skill_id) // !FIXME: We lost the unit data for magic decoy in somewhere before this
|
||||
ud->skill_id = ((TBL_PC*)mbl)->menuskill_id;
|
||||
@ -3463,7 +3463,7 @@ int status_calc_pc_(struct map_session_data* sd, enum e_status_calc_opt opt)
|
||||
continue;
|
||||
if (pc_is_same_equip_index((enum equip_index)i, sd->equip_index, index))
|
||||
continue;
|
||||
|
||||
|
||||
if (sd->inventory_data[index]) {
|
||||
int j;
|
||||
struct s_random_opt_data *data;
|
||||
@ -6819,10 +6819,10 @@ static unsigned int status_calc_maxsp(struct block_list *bl, uint64 maxsp)
|
||||
int rate = 100;
|
||||
|
||||
maxsp += status_get_spbonus(bl,STATUS_BONUS_FIX);
|
||||
|
||||
|
||||
if ((rate += status_get_spbonus(bl,STATUS_BONUS_RATE)) != 100)
|
||||
maxsp = maxsp * rate / 100;
|
||||
|
||||
|
||||
return (unsigned int)cap_value(maxsp,1,UINT_MAX);
|
||||
}
|
||||
|
||||
@ -7283,7 +7283,7 @@ enum e_race2 status_get_race2(struct block_list *bl)
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if an object is dead
|
||||
* Checks if an object is dead
|
||||
* @param bl: Object to check [PC|MOB|HOM|MER|ELEM]
|
||||
* @return 1: Is dead or 0: Is alive
|
||||
*/
|
||||
@ -7294,7 +7294,7 @@ int status_isdead(struct block_list *bl)
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if an object is immune to magic
|
||||
* Checks if an object is immune to magic
|
||||
* @param bl: Object to check [PC|MOB|HOM|MER|ELEM]
|
||||
* @return value of magic damage to be blocked
|
||||
*/
|
||||
@ -7311,7 +7311,7 @@ int status_isimmune(struct block_list *bl)
|
||||
}
|
||||
|
||||
/**
|
||||
* Get view data of an object
|
||||
* Get view data of an object
|
||||
* @param bl: Object whose view data to get [PC|MOB|PET|HOM|MER|ELEM|NPC]
|
||||
* @return view data structure bl->vd
|
||||
*/
|
||||
@ -7333,7 +7333,7 @@ struct view_data* status_get_viewdata(struct block_list *bl)
|
||||
/**
|
||||
* Set view data of an object
|
||||
* This function deals with class, mount, and item views
|
||||
* SC views are set in clif_getareachar_unit()
|
||||
* SC views are set in clif_getareachar_unit()
|
||||
* @param bl: Object whose view data to set [PC|MOB|PET|HOM|MER|ELEM|NPC]
|
||||
* @param class_: class of the object
|
||||
*/
|
||||
@ -9958,7 +9958,7 @@ int status_change_start(struct block_list* src, struct block_list* bl,enum sc_ty
|
||||
break;
|
||||
case SC__UNLUCKY:
|
||||
{
|
||||
sc_type rand_eff;
|
||||
sc_type rand_eff;
|
||||
switch(rnd() % 3) {
|
||||
case 1: rand_eff = SC_BLIND; break;
|
||||
case 2: rand_eff = SC_SILENCE; break;
|
||||
@ -10778,7 +10778,7 @@ int status_change_start(struct block_list* src, struct block_list* bl,enum sc_ty
|
||||
opt_flag = 1;
|
||||
switch(type) {
|
||||
// OPT1
|
||||
case SC_STONE:
|
||||
case SC_STONE:
|
||||
if (val3 > 0)
|
||||
sc->opt1 = OPT1_STONEWAIT;
|
||||
else
|
||||
@ -12989,7 +12989,7 @@ int status_change_timer_sub(struct block_list* bl, va_list ap)
|
||||
status_check_skilluse(src, bl, WZ_SIGHTBLASTER, 2))
|
||||
{
|
||||
if (sce) {
|
||||
struct skill_unit *su = NULL;
|
||||
struct skill_unit *su = NULL;
|
||||
if(bl->type == BL_SKILL)
|
||||
su = (struct skill_unit *)bl;
|
||||
if (skill_attack(BF_MAGIC,src,src,bl,WZ_SIGHTBLASTER,sce->val1,tick,0x1000000)
|
||||
@ -13817,7 +13817,7 @@ int status_readdb(void)
|
||||
safesnprintf(dbsubpath1,n1,"%s%s",db_path,dbsubpath[i]);
|
||||
safesnprintf(dbsubpath2,n1,"%s%s",db_path,dbsubpath[i]);
|
||||
}
|
||||
|
||||
|
||||
status_readdb_attrfix(dbsubpath2,i); // !TODO use sv_readdb ?
|
||||
sv_readdb(dbsubpath1, "status_disabled.txt", ',', 2, 2, -1, &status_readdb_status_disabled, i);
|
||||
sv_readdb(dbsubpath1, "size_fix.txt",',',MAX_WEAPON_TYPE,MAX_WEAPON_TYPE,ARRAYLENGTH(atkmods),&status_readdb_sizefix, i);
|
||||
|
||||
@ -385,7 +385,7 @@ void storage_storageclose(struct map_session_data* sd)
|
||||
* @param sd : player to close storage
|
||||
* @param flag :
|
||||
* 1: Character is quitting
|
||||
* 2(x): Character is changing map-servers
|
||||
* 2(x): Character is changing map-servers
|
||||
*/
|
||||
void storage_storage_quit(struct map_session_data* sd, int flag)
|
||||
{
|
||||
@ -402,7 +402,7 @@ void storage_storage_quit(struct map_session_data* sd, int flag)
|
||||
* @see DBCreateData
|
||||
* @param key
|
||||
* @param args
|
||||
* @return
|
||||
* @return
|
||||
*/
|
||||
static DBData create_guildstorage(DBKey key, va_list args)
|
||||
{
|
||||
@ -533,7 +533,7 @@ bool gstorage_additem(struct map_session_data* sd, struct guild_storage* stor, s
|
||||
if(compare_item(&stor->items[i], item)) {
|
||||
if( amount > MAX_AMOUNT - stor->items[i].amount || ( id->stack.guildstorage && amount > id->stack.amount - stor->items[i].amount ) )
|
||||
return false;
|
||||
|
||||
|
||||
stor->items[i].amount+=amount;
|
||||
clif_storageitemadded(sd,&stor->items[i],i,amount);
|
||||
stor->dirty = true;
|
||||
|
||||
@ -202,10 +202,10 @@ int unit_check_start_teleport_timer(struct block_list *sbl)
|
||||
int max_dist = 0;
|
||||
|
||||
switch(sbl->type) {
|
||||
case BL_HOM:
|
||||
case BL_ELEM:
|
||||
case BL_PET:
|
||||
case BL_MER:
|
||||
case BL_HOM:
|
||||
case BL_ELEM:
|
||||
case BL_PET:
|
||||
case BL_MER:
|
||||
msd = unit_get_master(sbl);
|
||||
break;
|
||||
default:
|
||||
@ -284,7 +284,7 @@ int unit_step_timer(int tid, unsigned int 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[bl->m];
|
||||
struct map_data *md = &map[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
|
||||
@ -372,7 +372,7 @@ static int unit_walktoxy_timer(int tid, unsigned int tick, int id, intptr_t data
|
||||
icewall_walk_block = 0;
|
||||
|
||||
//Monsters will walk into an icewall from the west and south if they already started walking
|
||||
if(map_getcell(bl->m,x+dx,y+dy,CELL_CHKNOPASS)
|
||||
if(map_getcell(bl->m,x+dx,y+dy,CELL_CHKNOPASS)
|
||||
&& (icewall_walk_block == 0 || !map_getcell(bl->m,x+dx,y+dy,CELL_CHKICEWALL) || dx < 0 || dy < 0))
|
||||
return unit_walktoxy_sub(bl);
|
||||
|
||||
@ -474,7 +474,7 @@ static int unit_walktoxy_timer(int tid, unsigned int tick, int id, intptr_t data
|
||||
|
||||
if(ud->state.change_walk_target) {
|
||||
if(unit_walktoxy_sub(bl)) {
|
||||
return 1;
|
||||
return 1;
|
||||
} else {
|
||||
clif_fixpos(bl);
|
||||
return 0;
|
||||
@ -900,7 +900,7 @@ int unit_escape(struct block_list *bl, struct block_list *target, short dist)
|
||||
* @param bl: Object to instant warp
|
||||
* @param dst_x: X coordinate to warp to
|
||||
* @param dst_y: Y coordinate to warp to
|
||||
* @param easy:
|
||||
* @param easy:
|
||||
* 0: Hard path check (attempt to go around obstacle)
|
||||
* 1: Easy path check (no obstacle on movement path)
|
||||
* 2: Long path check (no obstacle on line from start to destination)
|
||||
@ -1323,7 +1323,7 @@ int unit_is_walking(struct block_list *bl)
|
||||
return (ud->walktimer != INVALID_TIMER);
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Checks if a unit is able to move based on status changes
|
||||
* View the StatusChangeStateTable in status.c for a list of statuses
|
||||
* Some statuses are still checked here due too specific variables
|
||||
@ -2100,7 +2100,7 @@ int unit_set_target(struct unit_data* ud, int target_id)
|
||||
if( ud->target != target_id ) {
|
||||
struct unit_data * ux;
|
||||
struct block_list* target;
|
||||
|
||||
|
||||
if (ud->target && (target = map_id2bl(ud->target)) && (ux = unit_bl2ud(target)) && ux->target_count > 0)
|
||||
ux->target_count--;
|
||||
|
||||
@ -2188,7 +2188,7 @@ int unit_unattackable(struct block_list *bl)
|
||||
* Requests a unit to attack a target
|
||||
* @param src: Object initiating attack
|
||||
* @param target_id: Target ID (bl->id)
|
||||
* @param continuous:
|
||||
* @param continuous:
|
||||
* 0x1 - Whether or not the attack is ongoing
|
||||
* 0x2 - Whether function was called from unit_step_timer or not
|
||||
* @return Success(0); Fail(1);
|
||||
@ -2255,7 +2255,7 @@ int unit_attack(struct block_list *src,int target_id,int continuous)
|
||||
ud->stepskill_lv = 0;
|
||||
return 0; // Attacking will be handled by unit_walktoxy_timer in this case
|
||||
}
|
||||
|
||||
|
||||
if(DIFF_TICK(ud->attackabletime, gettick()) > 0) // Do attack next time it is possible. [Skotlex]
|
||||
ud->attacktimer=add_timer(ud->attackabletime,unit_attack_timer,src->id,0);
|
||||
else // Attack NOW.
|
||||
@ -2264,7 +2264,7 @@ int unit_attack(struct block_list *src,int target_id,int continuous)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Cancels an ongoing combo, resets attackable time, and restarts the
|
||||
* attack timer to resume attack after amotion time
|
||||
* @author [Skotlex]
|
||||
@ -2579,7 +2579,7 @@ static int unit_attack_timer_sub(struct block_list* src, int tid, unsigned int t
|
||||
// Set mob's ANGRY/BERSERK states.
|
||||
md->state.skillstate = md->state.aggressive?MSS_ANGRY:MSS_BERSERK;
|
||||
|
||||
if (status_has_mode(sstatus,MD_ASSIST) && DIFF_TICK(md->last_linktime, tick) < MIN_MOBLINKTIME) {
|
||||
if (status_has_mode(sstatus,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->mob_id, target, tick);
|
||||
|
||||
@ -279,7 +279,7 @@ int8 vending_openvending(struct map_session_data* sd, const char* message, const
|
||||
int vending_skill_lvl;
|
||||
char message_sql[MESSAGE_SIZE*2];
|
||||
StringBuf buf;
|
||||
|
||||
|
||||
nullpo_retr(false,sd);
|
||||
|
||||
if ( pc_isdead(sd) || !sd->state.prevend || pc_istrading(sd)) {
|
||||
@ -287,7 +287,7 @@ int8 vending_openvending(struct map_session_data* sd, const char* message, const
|
||||
}
|
||||
|
||||
vending_skill_lvl = pc_checkskill(sd, MC_VENDING);
|
||||
|
||||
|
||||
// skill level and cart check
|
||||
if( !vending_skill_lvl || !pc_iscarton(sd) ) {
|
||||
clif_skill_fail(sd, MC_VENDING, USESKILL_FAIL_LEVEL, 0);
|
||||
@ -354,7 +354,7 @@ int8 vending_openvending(struct map_session_data* sd, const char* message, const
|
||||
sd->vender_id = vending_getuid();
|
||||
sd->vend_num = i;
|
||||
safestrncpy(sd->message, message, MESSAGE_SIZE);
|
||||
|
||||
|
||||
Sql_EscapeString( mmysql_handle, message_sql, sd->message );
|
||||
|
||||
if( Sql_Query( mmysql_handle, "INSERT INTO `%s`(`id`, `account_id`, `char_id`, `sex`, `map`, `x`, `y`, `title`, `autotrade`, `body_direction`, `head_direction`, `sit`) "
|
||||
|
||||
@ -21,7 +21,7 @@ DBMap * vending_getdb();
|
||||
void do_final_vending(void);
|
||||
void do_init_vending(void);
|
||||
void do_init_vending_autotrade( void );
|
||||
|
||||
|
||||
void vending_reopen( struct map_session_data* sd );
|
||||
void vending_closevending(struct map_session_data* sd);
|
||||
int8 vending_openvending(struct map_session_data* sd, const char* message, const uint8* data, int count, struct s_autotrader *at);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user