-Fix chat system not deleting all chan on logout. tid:80999
-Upd @mapinfo to count number of vendors in map -Upd getrandgroupitem to check if valid itemit returned. -Cleanup and KR style git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@17232 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
parent
1fa24b05a6
commit
29970729cf
@ -165,7 +165,7 @@ db_path: db
|
||||
// NOTE: Requires client 2011-03-09aragexeRE or newer.
|
||||
// A window is opened before you can select your character and you will have to enter a pincode by using only your mouse.
|
||||
// Default: yes
|
||||
pincode_enabled: yes
|
||||
pincode_enabled: no
|
||||
|
||||
// How often does a user have to change his pincode?
|
||||
// 0: never (default)
|
||||
|
@ -836,7 +836,7 @@
|
||||
// @mapinfo
|
||||
1038: Please enter at least one valid list number (usage: @mapinfo <0-3> <map>).
|
||||
1039: ------ Map Info ------
|
||||
1040: Map Name: %s | Players In Map: %d | NPCs In Map: %d | Chats In Map: %d
|
||||
1040: Map: %s | Players: %d | NPCs: %d | Chats: %d | Vendings: %d
|
||||
1041: ------ Map Flags ------
|
||||
1042: Town Map
|
||||
1043: Autotrade Enabled
|
||||
|
@ -30,7 +30,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define CHAR_MAX_MSG 200
|
||||
#define CHAR_MAX_MSG 300
|
||||
static char* msg_table[CHAR_MAX_MSG]; // Login Server messages_conf
|
||||
|
||||
char char_db[256] = "char";
|
||||
@ -2724,10 +2724,8 @@ int parse_frommap(int fd)
|
||||
return 0;
|
||||
}
|
||||
|
||||
while(RFIFOREST(fd) >= 2)
|
||||
{
|
||||
switch(RFIFOW(fd,0))
|
||||
{
|
||||
while(RFIFOREST(fd) >= 2){
|
||||
switch(RFIFOW(fd,0)){
|
||||
|
||||
case 0x2afa: // Receiving map names list from the map-server
|
||||
if (RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2))
|
||||
@ -2954,7 +2952,7 @@ int parse_frommap(int fd)
|
||||
|
||||
{
|
||||
struct online_char_data* character = (struct online_char_data*)idb_get(online_char_db, account_id);
|
||||
|
||||
|
||||
if( character != NULL ){
|
||||
character->pincode_success = true;
|
||||
}
|
||||
@ -4624,7 +4622,7 @@ void pincode_decrypt( unsigned long userSeed, char* pin ){
|
||||
tab[i] ^= tab[pos];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for( i = 0; i < 4; i++ ){
|
||||
pin[i] = tab[pin[i]- '0'];
|
||||
}
|
||||
|
@ -9,6 +9,7 @@
|
||||
#define DIFF_TICK(a,b) ((int)((a)-(b)))
|
||||
|
||||
#define INVALID_TIMER -1
|
||||
#define CLIF_WALK_TIMER -2
|
||||
|
||||
// timer flags
|
||||
enum {
|
||||
@ -29,7 +30,7 @@ struct TimerData {
|
||||
int heap_pos;
|
||||
|
||||
// general-purpose storage
|
||||
int id;
|
||||
int id;
|
||||
intptr_t data;
|
||||
};
|
||||
|
||||
|
@ -2483,7 +2483,7 @@ ACMD_FUNC(guildlevelup)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (sd->status.guild_id <= 0 || (guild_info = guild_search(sd->status.guild_id)) == NULL) {
|
||||
if (sd->status.guild_id <= 0 || (guild_info = sd->guild) == NULL) {
|
||||
clif_displaymessage(fd, msg_txt(43)); // You're not in a guild.
|
||||
return -1;
|
||||
}
|
||||
@ -3725,16 +3725,15 @@ ACMD_FUNC(reloadscript)
|
||||
* 0 = no additional information
|
||||
* 1 = Show users in that map and their location
|
||||
* 2 = Shows NPCs in that map
|
||||
* 3 = Shows the shops/chats in that map (not implemented)
|
||||
* 3 = Shows the chats in that map
|
||||
*------------------------------------------*/
|
||||
ACMD_FUNC(mapinfo)
|
||||
{
|
||||
ACMD_FUNC(mapinfo) {
|
||||
struct map_session_data* pl_sd;
|
||||
struct s_mapiterator* iter;
|
||||
struct npc_data *nd = NULL;
|
||||
struct chat_data *cd = NULL;
|
||||
char direction[12];
|
||||
int i, m_id, chat_num, list = 0;
|
||||
int i, m_id, chat_num = 0, list = 0, vend_num = 0;
|
||||
unsigned short m_index;
|
||||
char mapname[24];
|
||||
|
||||
@ -3769,12 +3768,17 @@ ACMD_FUNC(mapinfo)
|
||||
// count chats (for initial message)
|
||||
chat_num = 0;
|
||||
iter = mapit_getallusers();
|
||||
for( pl_sd = (TBL_PC*)mapit_first(iter); mapit_exists(iter); pl_sd = (TBL_PC*)mapit_next(iter) )
|
||||
if( (cd = (struct chat_data*)map_id2bl(pl_sd->chatID)) != NULL && pl_sd->mapindex == m_index && cd->usersd[0] == pl_sd )
|
||||
chat_num++;
|
||||
for( pl_sd = (TBL_PC*)mapit_first(iter); mapit_exists(iter); pl_sd = (TBL_PC*)mapit_next(iter) ) {
|
||||
if( pl_sd->mapindex == m_index ) {
|
||||
if( pl_sd->state.vending )
|
||||
vend_num++;
|
||||
else if( (cd = (struct chat_data*)map_id2bl(pl_sd->chatID)) != NULL && cd->usersd[0] == pl_sd )
|
||||
chat_num++;
|
||||
}
|
||||
}
|
||||
mapit_free(iter);
|
||||
|
||||
sprintf(atcmd_output, msg_txt(1040), mapname, map[m_id].users, map[m_id].npc_num, chat_num); // Map Name: %s | Players In Map: %d | NPCs In Map: %d | Chats In Map: %d
|
||||
sprintf(atcmd_output, msg_txt(1040), mapname, map[m_id].users, map[m_id].npc_num, chat_num, vend_num); // Map: %s | Players: %d | NPCs: %d | Chats: %d | Vendings: %d
|
||||
clif_displaymessage(fd, atcmd_output);
|
||||
clif_displaymessage(fd, msg_txt(1041)); // ------ Map Flags ------
|
||||
if (map[m_id].flag.town)
|
||||
@ -3862,11 +3866,6 @@ ACMD_FUNC(mapinfo)
|
||||
strcat(atcmd_output, msg_txt(1077)); // Fireworks |
|
||||
if (map[m_id].flag.leaves)
|
||||
strcat(atcmd_output, msg_txt(1078)); // Leaves |
|
||||
/**
|
||||
* No longer available, keeping here just in case it's back someday. [Ind]
|
||||
**/
|
||||
//if (map[m_id].flag.rain)
|
||||
// strcat(atcmd_output, msg_txt(1079)); // Rain |
|
||||
if (map[m_id].flag.nightenabled)
|
||||
strcat(atcmd_output, msg_txt(1080)); // Displays Night |
|
||||
clif_displaymessage(fd, atcmd_output);
|
||||
@ -5311,8 +5310,7 @@ ACMD_FUNC(clearcart)
|
||||
*------------------------------------------*/
|
||||
#define MAX_SKILLID_PARTIAL_RESULTS 5
|
||||
#define MAX_SKILLID_PARTIAL_RESULTS_LEN 74 // "skill " (6) + "%d:" (up to 5) + "%s" (up to 30) + " (%s)" (up to 33)
|
||||
ACMD_FUNC(skillid)
|
||||
{
|
||||
ACMD_FUNC(skillid) {
|
||||
int skillen, idx, i, found = 0;
|
||||
DBIterator* iter;
|
||||
DBKey key;
|
||||
@ -5582,8 +5580,7 @@ ACMD_FUNC(changelook)
|
||||
* @autotrade by durf [Lupus] [Paradox924X]
|
||||
* Turns on/off Autotrade for a specific player
|
||||
*------------------------------------------*/
|
||||
ACMD_FUNC(autotrade)
|
||||
{
|
||||
ACMD_FUNC(autotrade) {
|
||||
int i;
|
||||
nullpo_retr(-1, sd);
|
||||
|
||||
@ -5623,13 +5620,13 @@ ACMD_FUNC(autotrade)
|
||||
}
|
||||
}
|
||||
}
|
||||
if( sd->channel_count ) {
|
||||
for( i = 0; i < sd->channel_count; i++ ) {
|
||||
if( sd->channel_count ) { //quit all chan
|
||||
uint8 count = sd->channel_count;
|
||||
for( i = 0; i < count; i++ ) {
|
||||
if( sd->channels[i] != NULL )
|
||||
clif_chsys_left(sd->channels[i],sd);
|
||||
}
|
||||
}
|
||||
|
||||
clif_authfail_fd(sd->fd, 15);
|
||||
|
||||
return 0;
|
||||
@ -5645,7 +5642,7 @@ ACMD_FUNC(changegm)
|
||||
struct map_session_data *pl_sd;
|
||||
nullpo_retr(-1, sd);
|
||||
|
||||
if (sd->status.guild_id == 0 || (g = guild_search(sd->status.guild_id)) == NULL || strcmp(g->master,sd->status.name)) {
|
||||
if (sd->status.guild_id == 0 || (g = sd->guild) == NULL || strcmp(g->master,sd->status.name)) {
|
||||
clif_displaymessage(fd, msg_txt(1181)); // You need to be a Guild Master to use this command.
|
||||
return -1;
|
||||
}
|
||||
@ -7591,7 +7588,7 @@ ACMD_FUNC(mapflag) {
|
||||
clif_displaymessage(sd->fd,atcmd_output);\
|
||||
return 0;\
|
||||
}
|
||||
char flag_name[100];
|
||||
char flag_name[100];
|
||||
short flag=0,i;
|
||||
nullpo_retr(-1, sd);
|
||||
memset(flag_name, '\0', sizeof(flag_name));
|
||||
@ -8773,7 +8770,7 @@ ACMD_FUNC(join) {
|
||||
struct raChSysCh *channel;
|
||||
char name[RACHSYS_NAME_LENGTH], pass[RACHSYS_NAME_LENGTH];
|
||||
DBMap* channel_db = clif_get_channel_db();
|
||||
|
||||
|
||||
if( !message || !*message || sscanf(message, "%s %s", name, pass) < 1 ) {
|
||||
sprintf(atcmd_output, msg_txt(1399),command); // Unknown Channel (usage: %s <#channel_name>)
|
||||
clif_displaymessage(fd, atcmd_output);
|
||||
@ -8821,6 +8818,8 @@ ACMD_FUNC(join) {
|
||||
}
|
||||
|
||||
inline void atcmd_channel_help(int fd, const char *command, bool can_create) {
|
||||
sprintf(atcmd_output, msg_txt(1404),command); // %s failed.
|
||||
clif_displaymessage(fd, atcmd_output);
|
||||
clif_displaymessage(fd, msg_txt(1414));// ---- Available options:
|
||||
if( can_create ) {
|
||||
sprintf(atcmd_output, msg_txt(1415),command);// * %s create <#channel_name> <channel_password>
|
||||
@ -8847,8 +8846,6 @@ inline void atcmd_channel_help(int fd, const char *command, bool can_create) {
|
||||
sprintf(atcmd_output, msg_txt(1429),command);// * %s unbind
|
||||
clif_displaymessage(fd, atcmd_output);
|
||||
clif_displaymessage(fd, msg_txt(1430));// -- Unbinds your global chat from the attached channel, if any.
|
||||
sprintf(atcmd_output, msg_txt(1404),command); // %s failed.
|
||||
clif_displaymessage(fd, atcmd_output);
|
||||
}
|
||||
|
||||
ACMD_FUNC(channel) {
|
||||
@ -8970,10 +8967,7 @@ ACMD_FUNC(channel) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
for(k = 0; k < sd->channel_count; k++) {
|
||||
if( strcmpi(sub1+1,sd->channels[k]->name) == 0 )
|
||||
break;
|
||||
}
|
||||
ARR_FIND(0, sd->channel_count, k, strcmpi(sub1+1,sd->channels[k]->name) == 0);
|
||||
if( k == sd->channel_count ) {
|
||||
sprintf(atcmd_output, msg_txt(1425),sub1);// You're not part of the '%s' channel.
|
||||
clif_displaymessage(fd, atcmd_output);
|
||||
@ -8989,10 +8983,7 @@ ACMD_FUNC(channel) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
for(k = 0; k < sd->channel_count; k++) {
|
||||
if( strcmpi(sub1+1,sd->channels[k]->name) == 0 )
|
||||
break;
|
||||
}
|
||||
ARR_FIND(0, sd->channel_count, k, strcmpi(sub1+1,sd->channels[k]->name) == 0);
|
||||
if( k == sd->channel_count ) {
|
||||
sprintf(atcmd_output, msg_txt(1425),sub1);// You're not part of the '%s' channel.
|
||||
clif_displaymessage(fd, atcmd_output);
|
||||
|
@ -1841,15 +1841,15 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src,struct blo
|
||||
}
|
||||
|
||||
if (!(nk & NK_NO_ELEFIX) && !n_ele)
|
||||
if (src->type == BL_HOM)
|
||||
n_ele = true; //skill is "not elemental"
|
||||
if (src->type == BL_HOM)
|
||||
n_ele = true; //skill is "not elemental"
|
||||
if (sc && sc->data[SC_GOLDENE_FERSE] && ((!skill_id && (rnd() % 100 < sc->data[SC_GOLDENE_FERSE]->val4)) || skill_id == MH_STAHL_HORN)) {
|
||||
s_ele = s_ele_ = ELE_HOLY;
|
||||
n_ele = false;
|
||||
s_ele = s_ele_ = ELE_HOLY;
|
||||
n_ele = false;
|
||||
}
|
||||
|
||||
if(!skill_id)
|
||||
{ //Skills ALWAYS use ONLY your right-hand weapon (tested on Aegis 10.2)
|
||||
{ //Skills ALWAYS use ONLY your right-hand weapon (tested on Aegis 10.2)
|
||||
if (sd && sd->weapontype1 == 0 && sd->weapontype2 > 0)
|
||||
{
|
||||
flag.rh=0;
|
||||
@ -2209,6 +2209,10 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src,struct blo
|
||||
skillratio += 100;
|
||||
if(sc->data[SC_ZENKAI] && sstatus->rhw.ele == sc->data[SC_ZENKAI]->val2 )
|
||||
skillratio += sc->data[SC_ZENKAI]->val1 * 2;
|
||||
#ifdef RENEWAL
|
||||
if( sc && sc->data[SC_TRUESIGHT] )
|
||||
skillratio += 2*sc->data[SC_TRUESIGHT]->val1;
|
||||
#endif
|
||||
}
|
||||
if( !skill_id )
|
||||
{
|
||||
@ -3000,10 +3004,7 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src,struct blo
|
||||
skillratio = (skillratio * status_get_lv(src)) / 120;
|
||||
break;
|
||||
}
|
||||
#ifdef RENEWAL
|
||||
if( sc && sc->data[SC_TRUESIGHT] )
|
||||
skillratio += 2*sc->data[SC_TRUESIGHT]->val1;
|
||||
#endif
|
||||
|
||||
ATK_RATE(skillratio);
|
||||
|
||||
//Constant/misc additions from skills
|
||||
@ -3103,10 +3104,19 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src,struct blo
|
||||
ATK_ADDRATE(2*sc->data[SC_TRUESIGHT]->val1);
|
||||
#endif
|
||||
if( sc->data[SC_GLOOMYDAY_SK] &&
|
||||
( skill_id == LK_SPIRALPIERCE || skill_id == KN_BRANDISHSPEAR ||
|
||||
skill_id == CR_SHIELDBOOMERANG || skill_id == PA_SHIELDCHAIN ||
|
||||
skill_id == LG_SHIELDPRESS ) )
|
||||
( skill_id == LK_SPIRALPIERCE || skill_id == KN_BRANDISHSPEAR ||
|
||||
skill_id == CR_SHIELDBOOMERANG || skill_id == PA_SHIELDCHAIN ||
|
||||
skill_id == LG_SHIELDPRESS ) ) {
|
||||
ATK_ADDRATE(sc->data[SC_GLOOMYDAY_SK]->val2);
|
||||
}
|
||||
if (sc && sc->data[SC_SPIRIT]){
|
||||
if(skill_id == AS_SONICBLOW && sc->data[SC_SPIRIT]->val2 == SL_ASSASIN){
|
||||
ATK_ADDRATE(map_flag_gvg(src->m)?25:100); //+25% dmg on woe/+100% dmg on nonwoe
|
||||
}
|
||||
else if (skill_id == CR_SHIELDBOOMERANG && (sc->data[SC_SPIRIT]->val2 == SL_CRUSADER)){
|
||||
ATK_ADDRATE(100);
|
||||
}
|
||||
}
|
||||
if( sc->data[SC_EDP] ){
|
||||
switch(skill_id){
|
||||
case AS_SPLASHER:
|
||||
@ -3133,20 +3143,10 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src,struct blo
|
||||
if (hd) ATK_ADD(hd->homunculus.spiritball * 3);
|
||||
}
|
||||
}
|
||||
|
||||
switch (skill_id) {
|
||||
case AS_SONICBLOW:
|
||||
if (sc && sc->data[SC_SPIRIT] &&
|
||||
sc->data[SC_SPIRIT]->val2 == SL_ASSASIN)
|
||||
ATK_ADDRATE(map_flag_gvg(src->m)?25:100); //+25% dmg on woe/+100% dmg on nonwoe
|
||||
|
||||
if(sd && pc_checkskill(sd,AS_SONICACCEL)>0)
|
||||
ATK_ADDRATE(10);
|
||||
break;
|
||||
case CR_SHIELDBOOMERANG:
|
||||
if(sc && sc->data[SC_SPIRIT] &&
|
||||
sc->data[SC_SPIRIT]->val2 == SL_CRUSADER)
|
||||
ATK_ADDRATE(100);
|
||||
break;
|
||||
case NC_AXETORNADO:
|
||||
if( (sstatus->rhw.ele) == ELE_WIND || (sstatus->lhw.ele) == ELE_WIND )
|
||||
@ -3180,7 +3180,7 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src,struct blo
|
||||
}
|
||||
|
||||
if (skill_id != CR_GRANDCROSS && skill_id != NPC_GRANDDARKNESS)
|
||||
{ //Ignore Defense?
|
||||
{ //Ignore Defense?
|
||||
if (!flag.idef && (
|
||||
sd->right_weapon.ignore_def_ele & (1<<tstatus->def_ele) ||
|
||||
sd->right_weapon.ignore_def_race & (1<<tstatus->race) ||
|
||||
@ -3366,12 +3366,12 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src,struct blo
|
||||
|
||||
if (sd && flag.weapon &&
|
||||
skill_id != MO_INVESTIGATE &&
|
||||
skill_id != MO_EXTREMITYFIST &&
|
||||
skill_id != CR_GRANDCROSS)
|
||||
skill_id != MO_EXTREMITYFIST &&
|
||||
skill_id != CR_GRANDCROSS)
|
||||
{ //Add mastery damage
|
||||
if(skill_id != ASC_BREAKER && sd->status.weapon == W_KATAR &&
|
||||
(skill=pc_checkskill(sd,ASC_KATAR)) > 0)
|
||||
{ //Adv Katar Mastery is does not applies to ASC_BREAKER,
|
||||
{ //Adv Katar Mastery is does not applies to ASC_BREAKER,
|
||||
// but other masteries DO apply >_>
|
||||
ATK_ADDRATE(10+ 2*skill);
|
||||
}
|
||||
@ -3573,10 +3573,7 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src,struct blo
|
||||
if( --(tsc->data[SC_REJECTSWORD]->val3) <= 0 )
|
||||
status_change_end(target, SC_REJECTSWORD, INVALID_TIMER);
|
||||
}
|
||||
if(skill_id == ASC_BREAKER) { //Breaker's int-based damage (a misc attack?)
|
||||
struct Damage md = battle_calc_misc_attack(src, target, skill_id, skill_lv, wflag);
|
||||
wd.damage += md.damage;
|
||||
}
|
||||
|
||||
if( sc ) {
|
||||
//SG_FUSION hp penalty [Komurka]
|
||||
if (sc->data[SC_FUSION]) {
|
||||
@ -3607,6 +3604,10 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src,struct blo
|
||||
struct Damage md = battle_calc_magic_attack(src, target, skill_id, skill_lv, wflag);
|
||||
wd.damage += md.damage;
|
||||
}
|
||||
else if(skill_id == ASC_BREAKER) { //Breaker's int-based damage (a misc attack?)
|
||||
struct Damage md = battle_calc_misc_attack(src, target, skill_id, skill_lv, wflag);
|
||||
wd.damage += md.damage;
|
||||
}
|
||||
|
||||
return wd;
|
||||
}
|
||||
@ -4374,7 +4375,7 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list *
|
||||
md.damage = 0;
|
||||
if (tsd) md.damage>>=1;
|
||||
if (md.damage < 0 || md.damage > INT_MAX>>1)
|
||||
//Overflow prevention, will anyone whine if I cap it to a few billion?
|
||||
//Overflow prevention, will anyone whine if I cap it to a few billion?
|
||||
//Not capped to INT_MAX to give some room for further damage increase.
|
||||
md.damage = INT_MAX>>1;
|
||||
break;
|
||||
@ -4514,7 +4515,7 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list *
|
||||
}
|
||||
}
|
||||
|
||||
md.damage = battle_calc_cardfix(BF_MISC, src, target, nk, s_ele, 0, md.damage, 0, md.flag);
|
||||
md.damage = battle_calc_cardfix(BF_MISC, src, target, nk, s_ele, 0, md.damage, 0, md.flag);
|
||||
|
||||
if (sd && (i = pc_skillatk_bonus(sd, skill_id)))
|
||||
md.damage += (int64)md.damage*i/100;
|
||||
@ -4808,12 +4809,12 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t
|
||||
}
|
||||
}
|
||||
}
|
||||
if (sc && sc->count) {
|
||||
if (sc->data[SC_CLOAKING] && !(sc->data[SC_CLOAKING]->val4 & 2))
|
||||
status_change_end(src, SC_CLOAKING, INVALID_TIMER);
|
||||
else if (sc->data[SC_CLOAKINGEXCEED] && !(sc->data[SC_CLOAKINGEXCEED]->val4 & 2))
|
||||
status_change_end(src, SC_CLOAKINGEXCEED, INVALID_TIMER);
|
||||
}
|
||||
if (sc && sc->count) {
|
||||
if (sc->data[SC_CLOAKING] && !(sc->data[SC_CLOAKING]->val4 & 2))
|
||||
status_change_end(src, SC_CLOAKING, INVALID_TIMER);
|
||||
else if (sc->data[SC_CLOAKINGEXCEED] && !(sc->data[SC_CLOAKINGEXCEED]->val4 & 2))
|
||||
status_change_end(src, SC_CLOAKINGEXCEED, INVALID_TIMER);
|
||||
}
|
||||
if( tsc && tsc->data[SC_AUTOCOUNTER] && status_check_skilluse(target, src, KN_AUTOCOUNTER, 1) )
|
||||
{
|
||||
uint8 dir = map_calc_dir(target,src->x,src->y);
|
||||
@ -4836,7 +4837,7 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t
|
||||
int duration = skill_get_time2(MO_BLADESTOP,skill_lv);
|
||||
status_change_end(target, SC_BLADESTOP_WAIT, INVALID_TIMER);
|
||||
if(sc_start4(src,src, SC_BLADESTOP, 100, sd?pc_checkskill(sd, MO_BLADESTOP):5, 0, 0, target->id, duration))
|
||||
{ //Target locked.
|
||||
{ //Target locked.
|
||||
clif_damage(src, target, tick, sstatus->amotion, 1, 0, 1, 0, 0); //Display MISS.
|
||||
clif_bladestop(target, src->id, 1);
|
||||
sc_start4(src,target, SC_BLADESTOP, 100, skill_lv, 0, 0, src->id, duration);
|
||||
|
@ -5578,22 +5578,17 @@ void clif_chsys_left(struct raChSysCh *channel, struct map_session_data *sd) {
|
||||
clif_chsys_msg(channel,sd,message);
|
||||
}
|
||||
|
||||
for( i = 0; i < sd->channel_count; i++ ) {
|
||||
if( sd->channels[i] == channel ) {
|
||||
sd->channels[i] = NULL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ARR_FIND(0, sd->channel_count, i, sd->channels[i] == channel);
|
||||
if( i < sd->channel_count ) {
|
||||
unsigned char cursor = 0;
|
||||
sd->channels[i] = NULL;
|
||||
for( i = 0; i < sd->channel_count; i++ ) {
|
||||
if( sd->channels[i] == NULL )
|
||||
continue;
|
||||
if( cursor != i ) {
|
||||
sd->channels[cursor] = sd->channels[i];
|
||||
cursor++;
|
||||
}
|
||||
cursor++;
|
||||
}
|
||||
if ( !(sd->channel_count = cursor) ) {
|
||||
aFree(sd->channels);
|
||||
@ -5609,24 +5604,20 @@ void clif_chsys_delete(struct raChSysCh *channel) {
|
||||
struct map_session_data *sd;
|
||||
unsigned char i;
|
||||
iter = db_iterator(channel->users);
|
||||
for( sd = dbi_first(iter); dbi_exists(iter); sd = dbi_next(iter) ) {
|
||||
for( i = 0; i < sd->channel_count; i++ ) {
|
||||
if( sd->channels[i] == channel ) {
|
||||
sd->channels[i] = NULL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
for( sd = dbi_first(iter); dbi_exists(iter); sd = dbi_next(iter) ) { //for all users
|
||||
ARR_FIND(0, sd->channel_count, i, sd->channels[i] == channel); //found cur chan
|
||||
if( i < sd->channel_count ) {
|
||||
unsigned char cursor = 0;
|
||||
for( i = 0; i < sd->channel_count; i++ ) {
|
||||
sd->channels[i] = NULL;
|
||||
for( i = 0; i < sd->channel_count; i++ ) { //move down links
|
||||
if( sd->channels[i] == NULL )
|
||||
continue;
|
||||
if( cursor != i ) {
|
||||
sd->channels[cursor] = sd->channels[i];
|
||||
cursor++;
|
||||
}
|
||||
cursor++;
|
||||
}
|
||||
if ( !(sd->channel_count = cursor) ) {
|
||||
if ( !(sd->channel_count = cursor) ) { //news chan count = total
|
||||
aFree(sd->channels);
|
||||
sd->channels = NULL;
|
||||
}
|
||||
@ -9032,14 +9023,6 @@ void clif_msg_skill(struct map_session_data* sd, uint16 skill_id, int msg_id)
|
||||
WFIFOSET(fd, packet_len(0x7e6));
|
||||
}
|
||||
|
||||
|
||||
/// View player equip request denied
|
||||
void clif_viewequip_fail(struct map_session_data* sd)
|
||||
{
|
||||
clif_msg(sd, 0x54d);
|
||||
}
|
||||
|
||||
|
||||
/// Validates one global/guild/party/whisper message packet and tries to recognize its components.
|
||||
/// Returns true if the packet was parsed successfully.
|
||||
/// Formats: 0 - <packet id>.w <packet len>.w (<name> : <message>).?B 00
|
||||
@ -10272,17 +10255,14 @@ void clif_parse_WisMessage(int fd, struct map_session_data* sd)
|
||||
}
|
||||
if( channel || (channel = strdb_get(channel_db,chname)) ) {
|
||||
unsigned char k;
|
||||
for( k = 0; k < sd->channel_count; k++ ) {
|
||||
if( sd->channels[k] == channel )
|
||||
break;
|
||||
}
|
||||
ARR_FIND(0, sd->channel_count, k, sd->channels[k] == channel);
|
||||
if( k < sd->channel_count ) {
|
||||
clif_chsys_send(channel,sd,message);
|
||||
} else if( channel->pass[0] == '\0' ) {
|
||||
clif_chsys_join(channel,sd);
|
||||
clif_chsys_send(channel,sd,message);
|
||||
} else {
|
||||
clif_displaymessage(fd, msg_txt(1402));
|
||||
clif_displaymessage(fd, msg_txt(1402)); //You're not in that channel, type '@join <#channel_name>'
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -11056,7 +11036,7 @@ void clif_parse_UseSkillToId(int fd, struct map_session_data *sd)
|
||||
|
||||
if( sd->npc_id ){
|
||||
#ifdef RENEWAL
|
||||
clif_msg(sd, 0x783); // TODO look for the client date that has this message.
|
||||
clif_msg(sd, USAGE_FAIL); // TODO look for the client date that has this message.
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
@ -14767,7 +14747,7 @@ void clif_parse_ViewPlayerEquip(int fd, struct map_session_data* sd)
|
||||
if( tsd->status.show_equip || pc_has_permission(sd, PC_PERM_VIEW_EQUIPMENT) )
|
||||
clif_viewequip_ack(sd, tsd);
|
||||
else
|
||||
clif_viewequip_fail(sd);
|
||||
clif_msg(sd, VIEW_EQUIP_FAIL);
|
||||
}
|
||||
|
||||
|
||||
@ -15125,9 +15105,8 @@ void clif_parse_mercenary_action(int fd, struct map_session_data* sd)
|
||||
/// 1 = Your mercenary soldier has been killed.
|
||||
/// 2 = Your mercenary soldier has been fired.
|
||||
/// 3 = Your mercenary soldier has ran away.
|
||||
void clif_mercenary_message(struct map_session_data* sd, int message)
|
||||
{
|
||||
clif_msg(sd, 1266 + message);
|
||||
void clif_mercenary_message(struct map_session_data* sd, int message){
|
||||
clif_msg(sd, MERC_MSG_BASE + message);
|
||||
}
|
||||
|
||||
|
||||
|
@ -84,8 +84,7 @@ typedef enum send_target {
|
||||
BG_AREA_WOS,
|
||||
} send_target;
|
||||
|
||||
typedef enum emotion_type
|
||||
{
|
||||
typedef enum emotion_type {
|
||||
E_GASP = 0, // /!
|
||||
E_WHAT, // /?
|
||||
E_HO,
|
||||
@ -315,6 +314,13 @@ enum useskill_fail_cause
|
||||
USESKILL_FAIL_THERE_ARE_NPC_AROUND = 83,
|
||||
};
|
||||
|
||||
enum clif_messages {
|
||||
MERC_MSG_BASE = 1266, //0x4f2
|
||||
SKILL_CANT_USE_AREA = 0x536,
|
||||
VIEW_EQUIP_FAIL = 0x54d,
|
||||
USAGE_FAIL = 0x783,
|
||||
};
|
||||
|
||||
int clif_setip(const char* ip);
|
||||
void clif_setbindip(const char* ip);
|
||||
void clif_setport(uint16 port);
|
||||
@ -632,7 +638,6 @@ void clif_send_homdata(struct map_session_data *sd, int state, int param); //[or
|
||||
|
||||
void clif_equiptickack(struct map_session_data* sd, int flag);
|
||||
void clif_viewequip_ack(struct map_session_data* sd, struct map_session_data* tsd);
|
||||
void clif_viewequip_fail(struct map_session_data* sd);
|
||||
void clif_equipcheckbox(struct map_session_data* sd);
|
||||
|
||||
void clif_msg(struct map_session_data* sd, unsigned short id);
|
||||
|
@ -907,7 +907,8 @@ int guild_member_withdraw(int guild_id, int account_id, int char_id, int flag, c
|
||||
storage_guild_storageclose(sd);
|
||||
guild_send_dot_remove(sd);
|
||||
if( raChSys.ally ) {
|
||||
for (i = 0; i < sd->channel_count; i++) {
|
||||
uint8 ch_count = sd->channel_count;
|
||||
for (i = 0; i < ch_count; i++) {
|
||||
if( sd->channels[i] && sd->channels[i]->type == raChSys_ALLY )
|
||||
clif_chsys_left(sd->channels[i],sd);
|
||||
}
|
||||
@ -1497,7 +1498,7 @@ int guild_reply_reqalliance(struct map_session_data *sd,int account_id,int flag)
|
||||
struct guild *g, *tg; // Reconfirm the number of alliance
|
||||
g=sd->guild;
|
||||
tg=tsd->guild;
|
||||
|
||||
|
||||
if(g==NULL || guild_get_alliance_count(g,0) >= battle_config.max_guild_alliance){
|
||||
clif_guild_allianceack(sd,4);
|
||||
clif_guild_allianceack(tsd,3);
|
||||
@ -2210,6 +2211,6 @@ void do_final_guild(void) {
|
||||
guild_expcache_db->destroy(guild_expcache_db,guild_expcache_db_final);
|
||||
guild_infoevent_db->destroy(guild_infoevent_db,eventlist_db_final);
|
||||
ers_destroy(expcache_ers);
|
||||
|
||||
|
||||
aFree(guild_flags);/* never empty; created on boot */
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ enum {
|
||||
ITEMID_CAMOUFLAGE_GENERATOR,
|
||||
ITEMID_HIGH_QUALITY_COOLER,
|
||||
ITEMID_SPECIAL_COOLER,
|
||||
} mecha_item_list;
|
||||
} mecha_item_list;
|
||||
|
||||
//The only item group required by the code to be known. See const.txt for the full list.
|
||||
#define IG_FINDINGORE 6
|
||||
|
@ -11,9 +11,6 @@
|
||||
#include "../common/db.h"
|
||||
#include "../common/msg_conf.h"
|
||||
|
||||
/**
|
||||
* [rAthena.org]
|
||||
**/
|
||||
#include "../config/core.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
@ -22,8 +19,7 @@ struct npc_data;
|
||||
struct item_data;
|
||||
struct raChSysCh;
|
||||
|
||||
enum E_MAPSERVER_ST
|
||||
{
|
||||
enum E_MAPSERVER_ST {
|
||||
MAPSERVER_ST_RUNNING = CORE_ST_LAST,
|
||||
MAPSERVER_ST_SHUTDOWN,
|
||||
MAPSERVER_ST_LAST
|
||||
@ -555,10 +551,6 @@ struct map_data {
|
||||
unsigned fireworks : 1;
|
||||
unsigned sakura : 1; // [Valaris]
|
||||
unsigned leaves : 1; // [Valaris]
|
||||
/**
|
||||
* No longer available, keeping here just in case it's back someday. [Ind]
|
||||
**/
|
||||
//unsigned rain : 1; // [Valaris]
|
||||
unsigned nogo : 1; // [Valaris]
|
||||
unsigned nobaseexp : 1; // [Lorky] added by Lupus
|
||||
unsigned nojobexp : 1; // [Lorky]
|
||||
|
@ -112,23 +112,22 @@ struct view_data* npc_get_viewdata(int class_)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static int npc_isnear_sub(struct block_list* bl, va_list args)
|
||||
{
|
||||
struct npc_data *nd = (struct npc_data*)bl;
|
||||
static int npc_isnear_sub(struct block_list* bl, va_list args) {
|
||||
struct npc_data *nd = (struct npc_data*)bl;
|
||||
|
||||
if( nd->sc.option & (OPTION_HIDE|OPTION_INVISIBLE) )
|
||||
return 0;
|
||||
if( nd->sc.option & (OPTION_HIDE|OPTION_INVISIBLE) )
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
bool npc_isnear(struct block_list * bl)
|
||||
{
|
||||
if( battle_config.min_npc_vendchat_distance > 0 &&
|
||||
map_foreachinrange(npc_isnear_sub,bl, battle_config.min_npc_vendchat_distance, BL_NPC) )
|
||||
return true;
|
||||
bool npc_isnear(struct block_list * bl) {
|
||||
|
||||
return false;
|
||||
if( battle_config.min_npc_vendchat_distance > 0 &&
|
||||
map_foreachinrange(npc_isnear_sub,bl, battle_config.min_npc_vendchat_distance, BL_NPC) )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
int npc_ontouch_event(struct map_session_data *sd, struct npc_data *nd)
|
||||
@ -3235,15 +3234,13 @@ static const char* npc_parse_mapflag(char* w1, char* w2, char* w3, char* w4, con
|
||||
}
|
||||
else if (!strcmpi(w3,"pvp")) {
|
||||
map[m].flag.pvp = state;
|
||||
if( state && (map[m].flag.gvg || map[m].flag.gvg_dungeon || map[m].flag.gvg_castle) )
|
||||
{
|
||||
if( state && (map[m].flag.gvg || map[m].flag.gvg_dungeon || map[m].flag.gvg_castle) ) {
|
||||
map[m].flag.gvg = 0;
|
||||
map[m].flag.gvg_dungeon = 0;
|
||||
map[m].flag.gvg_castle = 0;
|
||||
ShowWarning("npc_parse_mapflag: You can't set PvP and GvG flags for the same map! Removing GvG flags from %s (file '%s', line '%d').\n", map[m].name, filepath, strline(buffer,start-buffer));
|
||||
}
|
||||
if( state && map[m].flag.battleground )
|
||||
{
|
||||
if( state && map[m].flag.battleground ) {
|
||||
map[m].flag.battleground = 0;
|
||||
ShowWarning("npc_parse_mapflag: You can't set PvP and BattleGround flags for the same map! Removing BattleGround flag from %s (file '%s', line '%d').\n", map[m].name, filepath, strline(buffer,start-buffer));
|
||||
}
|
||||
@ -3287,13 +3284,11 @@ static const char* npc_parse_mapflag(char* w1, char* w2, char* w3, char* w4, con
|
||||
map[m].flag.pvp_nocalcrank=state;
|
||||
else if (!strcmpi(w3,"gvg")) {
|
||||
map[m].flag.gvg = state;
|
||||
if( state && map[m].flag.pvp )
|
||||
{
|
||||
if( state && map[m].flag.pvp ) {
|
||||
map[m].flag.pvp = 0;
|
||||
ShowWarning("npc_parse_mapflag: You can't set PvP and GvG flags for the same map! Removing PvP flag from %s (file '%s', line '%d').\n", map[m].name, filepath, strline(buffer,start-buffer));
|
||||
}
|
||||
if( state && map[m].flag.battleground )
|
||||
{
|
||||
if( state && map[m].flag.battleground ) {
|
||||
map[m].flag.battleground = 0;
|
||||
ShowWarning("npc_parse_mapflag: You can't set GvG and BattleGround flags for the same map! Removing BattleGround flag from %s (file '%s', line '%d').\n", map[m].name, filepath, strline(buffer,start-buffer));
|
||||
}
|
||||
@ -3309,23 +3304,19 @@ static const char* npc_parse_mapflag(char* w1, char* w2, char* w3, char* w4, con
|
||||
if (state) map[m].flag.pvp=0;
|
||||
}
|
||||
else if (!strcmpi(w3,"battleground")) {
|
||||
if( state )
|
||||
{
|
||||
if( state ) {
|
||||
if( sscanf(w4, "%d", &state) == 1 )
|
||||
map[m].flag.battleground = state;
|
||||
else
|
||||
map[m].flag.battleground = 1; // Default value
|
||||
}
|
||||
else
|
||||
} else
|
||||
map[m].flag.battleground = 0;
|
||||
|
||||
if( map[m].flag.battleground && map[m].flag.pvp )
|
||||
{
|
||||
if( map[m].flag.battleground && map[m].flag.pvp ) {
|
||||
map[m].flag.pvp = 0;
|
||||
ShowWarning("npc_parse_mapflag: You can't set PvP and BattleGround flags for the same map! Removing PvP flag from %s (file '%s', line '%d').\n", map[m].name, filepath, strline(buffer,start-buffer));
|
||||
}
|
||||
if( map[m].flag.battleground && (map[m].flag.gvg || map[m].flag.gvg_dungeon || map[m].flag.gvg_castle) )
|
||||
{
|
||||
if( map[m].flag.battleground && (map[m].flag.gvg || map[m].flag.gvg_dungeon || map[m].flag.gvg_castle) ) {
|
||||
map[m].flag.gvg = 0;
|
||||
map[m].flag.gvg_dungeon = 0;
|
||||
map[m].flag.gvg_castle = 0;
|
||||
@ -3360,11 +3351,6 @@ static const char* npc_parse_mapflag(char* w1, char* w2, char* w3, char* w4, con
|
||||
map[m].flag.sakura=state;
|
||||
else if (!strcmpi(w3,"leaves"))
|
||||
map[m].flag.leaves=state;
|
||||
/**
|
||||
* No longer available, keeping here just in case it's back someday. [Ind]
|
||||
**/
|
||||
//else if (!strcmpi(w3,"rain"))
|
||||
// map[m].flag.rain=state;
|
||||
else if (!strcmpi(w3,"nightenabled"))
|
||||
map[m].flag.nightenabled=state;
|
||||
else if (!strcmpi(w3,"nogo"))
|
||||
|
@ -342,7 +342,7 @@ bool path_search(struct walkpath_data *wpd,int16 m,int16 x0,int16 y0,int16 x1,in
|
||||
tp[i].flag=0;
|
||||
heap[0]=0;
|
||||
push_heap_path(heap,tp,calc_index(x0,y0));
|
||||
xs = md->xs - 1; // Place by subtracting a pre-
|
||||
xs = md->xs - 1; // Place by subtracting a pre-
|
||||
ys = md->ys-1;
|
||||
|
||||
for(;;)
|
||||
|
19
src/map/pc.c
19
src/map/pc.c
@ -123,8 +123,7 @@ static int pc_invincible_timer(int tid, unsigned int tick, int id, intptr_t data
|
||||
return 0;
|
||||
}
|
||||
|
||||
void pc_setinvincibletimer(struct map_session_data* sd, int val)
|
||||
{
|
||||
void pc_setinvincibletimer(struct map_session_data* sd, int val) {
|
||||
nullpo_retv(sd);
|
||||
|
||||
if( sd->invincible_timer != INVALID_TIMER )
|
||||
@ -1240,18 +1239,18 @@ int pc_reg_received(struct map_session_data *sd)
|
||||
|
||||
static int pc_calc_skillpoint(struct map_session_data* sd)
|
||||
{
|
||||
int i,skill,inf2,skill_point=0;
|
||||
int i,skill_lv,inf2,skill_point=0;
|
||||
|
||||
nullpo_ret(sd);
|
||||
|
||||
for(i=1;i<MAX_SKILL;i++){
|
||||
if( (skill = pc_checkskill(sd,i)) > 0) {
|
||||
if( (skill_lv = pc_checkskill(sd,i)) > 0) {
|
||||
inf2 = skill_get_inf2(i);
|
||||
if((!(inf2&INF2_QUEST_SKILL) || battle_config.quest_skill_learn) &&
|
||||
!(inf2&(INF2_WEDDING_SKILL|INF2_SPIRIT_SKILL)) //Do not count wedding/link skills. [Skotlex]
|
||||
) {
|
||||
if(sd->status.skill[i].flag == SKILL_FLAG_PERMANENT)
|
||||
skill_point += skill;
|
||||
skill_point += skill_lv;
|
||||
else
|
||||
if(sd->status.skill[i].flag == SKILL_FLAG_REPLACED_LV_0)
|
||||
skill_point += (sd->status.skill[i].flag - SKILL_FLAG_REPLACED_LV_0);
|
||||
@ -1366,7 +1365,6 @@ int pc_calc_skilltree(struct map_session_data *sd)
|
||||
for( i = 0; i < MAX_SKILL_TREE && (id = skill_tree[c][i].id) > 0; i++ )
|
||||
{
|
||||
int f;
|
||||
|
||||
if( sd->status.skill[id].id )
|
||||
continue; //Skill already known.
|
||||
|
||||
@ -4216,7 +4214,7 @@ int pc_useitem(struct map_session_data *sd,int n)
|
||||
|
||||
if( sd->npc_id ){
|
||||
#ifdef RENEWAL
|
||||
clif_msg(sd, 0x783); // TODO look for the client date that has this message.
|
||||
clif_msg(sd, USAGE_FAIL); // TODO look for the client date that has this message.
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
@ -6505,8 +6503,7 @@ void pc_damage(struct map_session_data *sd,struct block_list *src,unsigned int h
|
||||
if( !src || src == &sd->bl )
|
||||
return;
|
||||
|
||||
if( pc_issit(sd) )
|
||||
{
|
||||
if( pc_issit(sd) ) {
|
||||
pc_setstand(sd);
|
||||
skill_sit(sd,0);
|
||||
}
|
||||
@ -7568,8 +7565,7 @@ int pc_changelook(struct map_session_data *sd,int type,int val)
|
||||
case LOOK_HAIR_COLOR: //Use the battle_config limits! [Skotlex]
|
||||
val = cap_value(val, MIN_HAIR_COLOR, MAX_HAIR_COLOR);
|
||||
|
||||
if (sd->status.hair_color != val)
|
||||
{
|
||||
if (sd->status.hair_color != val) {
|
||||
sd->status.hair_color=val;
|
||||
if (sd->status.guild_id) //Update Guild Window. [Skotlex]
|
||||
intif_guild_change_memberinfo(sd->status.guild_id,sd->status.account_id,sd->status.char_id,
|
||||
@ -9849,6 +9845,7 @@ void pc_itemcd_do(struct map_session_data *sd, bool load) {
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/*==========================================
|
||||
* pc Init/Terminate
|
||||
*------------------------------------------*/
|
||||
|
@ -2152,10 +2152,10 @@ static void add_buildin_func(void)
|
||||
str_data[n].val = i;
|
||||
str_data[n].func = buildin_func[i].func;
|
||||
|
||||
if (!strcmp(buildin_func[i].name, "set")) buildin_set_ref = n;
|
||||
else if (!strcmp(buildin_func[i].name, "callsub")) buildin_callsub_ref = n;
|
||||
else if (!strcmp(buildin_func[i].name, "callfunc")) buildin_callfunc_ref = n;
|
||||
else if( !strcmp(buildin_func[i].name, "getelementofarray") ) buildin_getelementofarray_ref = n;
|
||||
if (!strcmp(buildin_func[i].name, "set")) buildin_set_ref = n;
|
||||
else if (!strcmp(buildin_func[i].name, "callsub")) buildin_callsub_ref = n;
|
||||
else if (!strcmp(buildin_func[i].name, "callfunc")) buildin_callfunc_ref = n;
|
||||
else if( !strcmp(buildin_func[i].name, "getelementofarray") ) buildin_getelementofarray_ref = n;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -7266,7 +7266,7 @@ BUILDIN_FUNC(strcharinfo)
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if( ( g = guild_search(sd->status.guild_id) ) != NULL ) {
|
||||
if( ( g = sd->guild ) != NULL ) {
|
||||
script_pushstrcopy(st,g->name);
|
||||
} else {
|
||||
script_pushconststr(st,"");
|
||||
@ -10177,7 +10177,7 @@ BUILDIN_FUNC(morphembryo)
|
||||
struct item item_tmp;
|
||||
int m_class, i=0;
|
||||
TBL_PC *sd;
|
||||
|
||||
|
||||
sd = script_rid2sd(st);
|
||||
if( sd == NULL )
|
||||
return 0;
|
||||
@ -10237,7 +10237,7 @@ BUILDIN_FUNC(checkhomcall)
|
||||
|
||||
if( sd == NULL )
|
||||
return 0;
|
||||
|
||||
|
||||
hd = sd->hd;
|
||||
|
||||
if( !hd )
|
||||
@ -10760,10 +10760,6 @@ BUILDIN_FUNC(getmapflag)
|
||||
case MF_FOG: script_pushint(st,map[m].flag.fog); break;
|
||||
case MF_SAKURA: script_pushint(st,map[m].flag.sakura); break;
|
||||
case MF_LEAVES: script_pushint(st,map[m].flag.leaves); break;
|
||||
/**
|
||||
* No longer available, keeping here just in case it's back someday. [Ind]
|
||||
**/
|
||||
//case MF_RAIN: script_pushint(st,map[m].flag.rain); break;
|
||||
case MF_NOGO: script_pushint(st,map[m].flag.nogo); break;
|
||||
case MF_CLOUDS: script_pushint(st,map[m].flag.clouds); break;
|
||||
case MF_CLOUDS2: script_pushint(st,map[m].flag.clouds2); break;
|
||||
@ -10856,10 +10852,6 @@ BUILDIN_FUNC(setmapflag)
|
||||
case MF_FOG: map[m].flag.fog = 1; break;
|
||||
case MF_SAKURA: map[m].flag.sakura = 1; break;
|
||||
case MF_LEAVES: map[m].flag.leaves = 1; break;
|
||||
/**
|
||||
* No longer available, keeping here just in case it's back someday. [Ind]
|
||||
**/
|
||||
//case MF_RAIN: map[m].flag.rain = 1; break;
|
||||
case MF_NOGO: map[m].flag.nogo = 1; break;
|
||||
case MF_CLOUDS: map[m].flag.clouds = 1; break;
|
||||
case MF_CLOUDS2: map[m].flag.clouds2 = 1; break;
|
||||
@ -10940,10 +10932,6 @@ BUILDIN_FUNC(removemapflag)
|
||||
case MF_FOG: map[m].flag.fog = 0; break;
|
||||
case MF_SAKURA: map[m].flag.sakura = 0; break;
|
||||
case MF_LEAVES: map[m].flag.leaves = 0; break;
|
||||
/**
|
||||
* No longer available, keeping here just in case it's back someday. [Ind]
|
||||
**/
|
||||
//case MF_RAIN: map[m].flag.rain = 0; break;
|
||||
case MF_NOGO: map[m].flag.nogo = 0; break;
|
||||
case MF_CLOUDS: map[m].flag.clouds = 0; break;
|
||||
case MF_CLOUDS2: map[m].flag.clouds2 = 0; break;
|
||||
@ -17324,8 +17312,10 @@ BUILDIN_FUNC(getrandgroupitem) {
|
||||
ShowError("getrandgroupitem: qty is <= 0!\n");
|
||||
return 1;
|
||||
}
|
||||
if( (nameid = itemdb_searchrandomid(group)) == UNKNOWN_ITEM_ID ) {
|
||||
return 1; //ensure valid itemid
|
||||
}
|
||||
|
||||
nameid = itemdb_searchrandomid(group);
|
||||
memset(&item_tmp,0,sizeof(item_tmp));
|
||||
item_tmp.nameid = nameid;
|
||||
item_tmp.identify = itemdb_isidentified(nameid);
|
||||
|
302
src/map/skill.c
302
src/map/skill.c
@ -124,8 +124,7 @@ static int skill_check_unit_range2 (struct block_list *bl, int x, int y, uint16
|
||||
static int skill_destroy_trap( struct block_list *bl, va_list ap );
|
||||
static int skill_check_condition_mob_master_sub (struct block_list *bl, va_list ap);
|
||||
//Since only mob-casted splash skills can hit ice-walls
|
||||
static inline int splash_target(struct block_list* bl)
|
||||
{
|
||||
static inline int splash_target(struct block_list* bl) {
|
||||
#ifndef RENEWAL
|
||||
return ( bl->type == BL_MOB ) ? BL_SKILL|BL_CHAR : BL_CHAR;
|
||||
#else // Some skills can now hit ground skills(traps, ice wall & etc.)
|
||||
@ -134,8 +133,7 @@ static inline int splash_target(struct block_list* bl)
|
||||
}
|
||||
|
||||
/// Returns the id of the skill, or 0 if not found.
|
||||
int skill_name2id(const char* name)
|
||||
{
|
||||
int skill_name2id(const char* name) {
|
||||
if( name == NULL )
|
||||
return 0;
|
||||
|
||||
@ -144,8 +142,7 @@ int skill_name2id(const char* name)
|
||||
|
||||
/// Maps skill ids to skill db offsets.
|
||||
/// Returns the skill's array index, or 0 (Unknown Skill).
|
||||
int skill_get_index( uint16 skill_id )
|
||||
{
|
||||
int skill_get_index( uint16 skill_id ) {
|
||||
// avoid ranges reserved for mapping guild/homun/mercenary skills
|
||||
if( (skill_id >= GD_SKILLRANGEMIN && skill_id <= GD_SKILLRANGEMAX)
|
||||
|| (skill_id >= HM_SKILLRANGEMIN && skill_id <= HM_SKILLRANGEMAX)
|
||||
@ -170,19 +167,16 @@ int skill_get_index( uint16 skill_id )
|
||||
return skill_id;
|
||||
}
|
||||
|
||||
const char* skill_get_name( uint16 skill_id )
|
||||
{
|
||||
const char* skill_get_name( uint16 skill_id ) {
|
||||
return skill_db[skill_get_index(skill_id)].name;
|
||||
}
|
||||
|
||||
const char* skill_get_desc( uint16 skill_id )
|
||||
{
|
||||
const char* skill_get_desc( uint16 skill_id ) {
|
||||
return skill_db[skill_get_index(skill_id)].desc;
|
||||
}
|
||||
|
||||
// out of bounds error checking [celest]
|
||||
static void skill_chk(int16* skill_id, uint16 skill_lv)
|
||||
{
|
||||
static void skill_chk(int16* skill_id, uint16 skill_lv) {
|
||||
*skill_id = skill_get_index(*skill_id); // checks/adjusts id
|
||||
if( skill_lv > MAX_SKILL_LEVEL ) *skill_id = 0;
|
||||
}
|
||||
@ -264,8 +258,7 @@ static int skill_unit_effect(struct block_list *bl,va_list ap);
|
||||
int enchant_eff[5] = { 10, 14, 17, 19, 20 };
|
||||
int deluge_eff[5] = { 5, 9, 12, 14, 15 };
|
||||
|
||||
int skill_get_casttype (uint16 skill_id)
|
||||
{
|
||||
int skill_get_casttype (uint16 skill_id) {
|
||||
int inf = skill_get_inf(skill_id);
|
||||
if (inf&(INF_GROUND_SKILL))
|
||||
return CAST_GROUND;
|
||||
@ -282,24 +275,21 @@ int skill_get_casttype (uint16 skill_id)
|
||||
}
|
||||
|
||||
//Returns actual skill range taking into account attack range and AC_OWL [Skotlex]
|
||||
int skill_get_range2 (struct block_list *bl, uint16 skill_id, uint16 skill_lv)
|
||||
{
|
||||
int skill_get_range2 (struct block_list *bl, uint16 skill_id, uint16 skill_lv) {
|
||||
int range;
|
||||
if( bl->type == BL_MOB && battle_config.mob_ai&0x400 )
|
||||
return 9; //Mobs have a range of 9 regardless of skill used.
|
||||
|
||||
range = skill_get_range(skill_id, skill_lv);
|
||||
|
||||
if( range < 0 )
|
||||
{
|
||||
if( range < 0 ) {
|
||||
if( battle_config.use_weapon_skill_range&bl->type )
|
||||
return status_get_range(bl);
|
||||
range *=-1;
|
||||
}
|
||||
|
||||
//TODO: Find a way better than hardcoding the list of skills affected by AC_VULTURE
|
||||
switch( skill_id )
|
||||
{
|
||||
switch( skill_id ) {
|
||||
case AC_SHOWER: case MA_SHOWER:
|
||||
case AC_DOUBLE: case MA_DOUBLE:
|
||||
case HT_BLITZBEAT:
|
||||
@ -706,8 +696,7 @@ int skillnotok_mercenary(uint16 skill_id, struct mercenary_data *md)
|
||||
return skillnotok(skill_id, md->master);
|
||||
}
|
||||
|
||||
struct s_skill_unit_layout* skill_get_unit_layout (uint16 skill_id, uint16 skill_lv, struct block_list* src, int x, int y)
|
||||
{
|
||||
struct s_skill_unit_layout* skill_get_unit_layout (uint16 skill_id, uint16 skill_lv, struct block_list* src, int x, int y) {
|
||||
int pos = skill_get_unit_layout_type(skill_id,skill_lv);
|
||||
uint8 dir;
|
||||
|
||||
@ -769,19 +758,18 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, uint
|
||||
|
||||
if( sd )
|
||||
{ // These statuses would be applied anyway even if the damage was blocked by some skills. [Inkfish]
|
||||
if( skill_id != WS_CARTTERMINATION && skill_id != AM_DEMONSTRATION && skill_id != CR_REFLECTSHIELD && skill_id != MS_REFLECTSHIELD && skill_id != ASC_BREAKER )
|
||||
{ // Trigger status effects
|
||||
if( skill_id != WS_CARTTERMINATION && skill_id != AM_DEMONSTRATION && skill_id != CR_REFLECTSHIELD && skill_id != MS_REFLECTSHIELD && skill_id != ASC_BREAKER ) {
|
||||
// Trigger status effects
|
||||
enum sc_type type;
|
||||
int i;
|
||||
for( i = 0; i < ARRAYLENGTH(sd->addeff) && sd->addeff[i].flag; i++ )
|
||||
{
|
||||
for( i = 0; i < ARRAYLENGTH(sd->addeff) && sd->addeff[i].flag; i++ ) {
|
||||
rate = sd->addeff[i].rate;
|
||||
if( attack_type&BF_LONG ) // Any ranged physical attack takes status arrows into account (Grimtooth...) [DracoRPG]
|
||||
rate += sd->addeff[i].arrow_rate;
|
||||
if( !rate ) continue;
|
||||
|
||||
if( (sd->addeff[i].flag&(ATF_WEAPON|ATF_MAGIC|ATF_MISC)) != (ATF_WEAPON|ATF_MAGIC|ATF_MISC) )
|
||||
{ // Trigger has attack type consideration.
|
||||
if( (sd->addeff[i].flag&(ATF_WEAPON|ATF_MAGIC|ATF_MISC)) != (ATF_WEAPON|ATF_MAGIC|ATF_MISC) ) {
|
||||
// Trigger has attack type consideration.
|
||||
if( (sd->addeff[i].flag&ATF_WEAPON && attack_type&BF_WEAPON) ||
|
||||
(sd->addeff[i].flag&ATF_MAGIC && attack_type&BF_MAGIC) ||
|
||||
(sd->addeff[i].flag&ATF_MISC && attack_type&BF_MISC) ) ;
|
||||
@ -789,8 +777,8 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, uint
|
||||
continue;
|
||||
}
|
||||
|
||||
if( (sd->addeff[i].flag&(ATF_LONG|ATF_SHORT)) != (ATF_LONG|ATF_SHORT) )
|
||||
{ // Trigger has range consideration.
|
||||
if( (sd->addeff[i].flag&(ATF_LONG|ATF_SHORT)) != (ATF_LONG|ATF_SHORT) ) {
|
||||
// Trigger has range consideration.
|
||||
if((sd->addeff[i].flag&ATF_LONG && !(attack_type&BF_LONG)) ||
|
||||
(sd->addeff[i].flag&ATF_SHORT && !(attack_type&BF_SHORT)))
|
||||
continue; //Range Failed.
|
||||
@ -807,12 +795,11 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, uint
|
||||
}
|
||||
}
|
||||
|
||||
if( skill_id )
|
||||
{ // Trigger status effects on skills
|
||||
if( skill_id ) {
|
||||
// Trigger status effects on skills
|
||||
enum sc_type type;
|
||||
int i;
|
||||
for( i = 0; i < ARRAYLENGTH(sd->addeff3) && sd->addeff3[i].skill; i++ )
|
||||
{
|
||||
for( i = 0; i < ARRAYLENGTH(sd->addeff3) && sd->addeff3[i].skill; i++ ) {
|
||||
if( skill_id != sd->addeff3[i].skill || !sd->addeff3[i].rate )
|
||||
continue;
|
||||
type = sd->addeff3[i].id;
|
||||
@ -829,10 +816,8 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, uint
|
||||
if( dmg_lv < ATK_DEF ) // no damage, return;
|
||||
return 0;
|
||||
|
||||
switch(skill_id)
|
||||
{
|
||||
case 0: // Normal attacks (no skill used)
|
||||
{
|
||||
switch(skill_id) {
|
||||
case 0: { // Normal attacks (no skill used)
|
||||
if( attack_type&BF_SKILL )
|
||||
break; // If a normal attack is a skill, it's splash damage. [Inkfish]
|
||||
if(sd) {
|
||||
@ -1746,10 +1731,8 @@ int skill_onskillusage(struct map_session_data *sd, struct block_list *bl, uint1
|
||||
sd->state.autocast = 0;
|
||||
}
|
||||
|
||||
if( sd && sd->autobonus3[0].rate )
|
||||
{
|
||||
for( i = 0; i < ARRAYLENGTH(sd->autobonus3); i++ )
|
||||
{
|
||||
if( sd && sd->autobonus3[0].rate ) {
|
||||
for( i = 0; i < ARRAYLENGTH(sd->autobonus3); i++ ) {
|
||||
if( rnd()%1000 >= sd->autobonus3[i].rate )
|
||||
continue;
|
||||
if( sd->autobonus3[i].active != INVALID_TIMER )
|
||||
@ -1968,11 +1951,9 @@ int skill_counter_additional_effect (struct block_list* src, struct block_list *
|
||||
}
|
||||
|
||||
//Autobonus when attacked
|
||||
if( dstsd && !status_isdead(bl) && dstsd->autobonus2[0].rate && !(skill_id && skill_get_nk(skill_id)&NK_NO_DAMAGE) )
|
||||
{
|
||||
if( dstsd && !status_isdead(bl) && dstsd->autobonus2[0].rate && !(skill_id && skill_get_nk(skill_id)&NK_NO_DAMAGE) ) {
|
||||
int i;
|
||||
for( i = 0; i < ARRAYLENGTH(dstsd->autobonus2); i++ )
|
||||
{
|
||||
for( i = 0; i < ARRAYLENGTH(dstsd->autobonus2); i++ ) {
|
||||
if( rnd()%1000 >= dstsd->autobonus2[i].rate )
|
||||
continue;
|
||||
if( dstsd->autobonus2[i].active != INVALID_TIMER )
|
||||
@ -2120,8 +2101,7 @@ static int skill_area_temp[8];
|
||||
- if 'flag&0x1', position update packets must not be sent.
|
||||
- if 'flag&0x2', skill blown ignores players' special_state.no_knockback
|
||||
-------------------------------------------------------------------------*/
|
||||
int skill_blown(struct block_list* src, struct block_list* target, int count, int8 dir, int flag)
|
||||
{
|
||||
int skill_blown(struct block_list* src, struct block_list* target, int count, int8 dir, int flag) {
|
||||
int dx = 0, dy = 0;
|
||||
struct skill_unit* su = NULL;
|
||||
|
||||
@ -2397,11 +2377,9 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds
|
||||
dmg = battle_calc_attack(attack_type,src,bl,skill_id,skill_lv,flag&0xFFF);
|
||||
|
||||
//Skotlex: Adjusted to the new system
|
||||
if(src->type==BL_PET)
|
||||
{ // [Valaris]
|
||||
if( src->type == BL_PET ) { // [Valaris]
|
||||
struct pet_data *pd = (TBL_PET*)src;
|
||||
if (pd->a_skill && pd->a_skill->div_ && pd->a_skill->id == skill_id)
|
||||
{
|
||||
if (pd->a_skill && pd->a_skill->div_ && pd->a_skill->id == skill_id) {
|
||||
int element = skill_get_ele(skill_id, skill_lv);
|
||||
/*if (skill_id == -1) Does it ever worked?
|
||||
element = sstatus->rhw.ele;*/
|
||||
@ -2528,8 +2506,7 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds
|
||||
skill_combo(src,dsrc,bl,skill_id,skill_lv,tick);
|
||||
|
||||
//Display damage.
|
||||
switch( skill_id )
|
||||
{
|
||||
switch( skill_id ) {
|
||||
case PA_GOSPEL: //Should look like Holy Cross [Skotlex]
|
||||
dmg.dmotion = clif_skill_damage(dsrc,bl,tick,dmg.amotion,dmg.dmotion, damage, dmg.div_, CR_HOLYCROSS, -1, 5);
|
||||
break;
|
||||
@ -2724,8 +2701,8 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds
|
||||
ud->attackabletime = tick + type;
|
||||
}
|
||||
|
||||
if( !dmg.amotion )
|
||||
{ //Instant damage
|
||||
if( !dmg.amotion ) {
|
||||
//Instant damage
|
||||
if( !sc || (!sc->data[SC_DEVOTION] && skill_id != CR_REFLECTSHIELD) )
|
||||
status_fix_damage(src,bl,damage,dmg.dmotion); //Deal damage before knockback to allow stuff like firewall+storm gust combo.
|
||||
if( !status_isdead(bl) && additional_effects )
|
||||
@ -2913,8 +2890,7 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds
|
||||
* then call func with source,target,skill_id,skill_lv,tick,flag
|
||||
*------------------------------------------*/
|
||||
typedef int (*SkillFunc)(struct block_list *, struct block_list *, int, int, unsigned int, int);
|
||||
int skill_area_sub (struct block_list *bl, va_list ap)
|
||||
{
|
||||
int skill_area_sub (struct block_list *bl, va_list ap) {
|
||||
struct block_list *src;
|
||||
uint16 skill_id,skill_lv;
|
||||
int flag;
|
||||
@ -3297,8 +3273,7 @@ static int skill_timerskill(int tid, unsigned int tick, int id, intptr_t data)
|
||||
/**
|
||||
* Warlock
|
||||
**/
|
||||
case WL_CHAINLIGHTNING_ATK:
|
||||
{
|
||||
case WL_CHAINLIGHTNING_ATK: {
|
||||
struct block_list *nbl = NULL; // Next Target of Chain
|
||||
skill_attack(BF_MAGIC,src,src,target,skl->skill_id,skl->skill_lv,tick,skl->flag); // Hit a Lightning on the current Target
|
||||
skill_toggle_magicpower(src, skl->skill_id); // only the first hit will be amplify
|
||||
@ -11490,11 +11465,9 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns
|
||||
ts->tick += sg->interval*(map_count_oncell(bl->m,bl->x,bl->y,BL_CHAR)-1);
|
||||
}
|
||||
|
||||
switch (sg->unit_id)
|
||||
{
|
||||
switch (sg->unit_id) {
|
||||
case UNT_FIREWALL:
|
||||
case UNT_KAEN:
|
||||
{
|
||||
case UNT_KAEN: {
|
||||
int count=0;
|
||||
const int x = bl->x, y = bl->y;
|
||||
|
||||
@ -11517,9 +11490,7 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns
|
||||
{ //Only damage enemies with offensive Sanctuary. [Skotlex]
|
||||
if( battle_check_target(&src->bl,bl,BCT_ENEMY) > 0 && skill_attack(BF_MAGIC, ss, &src->bl, bl, sg->skill_id, sg->skill_lv, tick, 0) )
|
||||
sg->val1 -= 2; // reduce healing count if this was meant for damaging [hekate]
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
int heal = skill_calc_heal(ss,bl,sg->skill_id,sg->skill_lv,true);
|
||||
struct mob_data *md = BL_CAST(BL_MOB, bl);
|
||||
#ifdef RENEWAL
|
||||
@ -11913,8 +11884,7 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns
|
||||
{
|
||||
if( ++sg->val2 % 3 == 0 ) {
|
||||
int hp, sp;
|
||||
switch( sg->skill_lv )
|
||||
{
|
||||
switch( sg->skill_lv ) {
|
||||
case 1: case 2: hp = 3; sp = 2; break;
|
||||
case 3: case 4: hp = 4; sp = 3; break;
|
||||
case 5: default: hp = 5; sp = 4; break;
|
||||
@ -14160,8 +14130,7 @@ int skill_delayfix (struct block_list *bl, uint16 skill_id, uint16 skill_lv)
|
||||
}
|
||||
}
|
||||
|
||||
if ( sc && sc->data[SC_SPIRIT] )
|
||||
{
|
||||
if ( sc && sc->data[SC_SPIRIT] ) {
|
||||
switch (skill_id) {
|
||||
case CR_SHIELDBOOMERANG:
|
||||
if (sc->data[SC_SPIRIT]->val2 == SL_CRUSADER)
|
||||
@ -14315,10 +14284,8 @@ static void skill_brandishspear_dir (struct square* tc, uint8 dir, int are)
|
||||
int c;
|
||||
nullpo_retv(tc);
|
||||
|
||||
for( c = 0; c < 5; c++ )
|
||||
{
|
||||
switch( dir )
|
||||
{
|
||||
for( c = 0; c < 5; c++ ) {
|
||||
switch( dir ) {
|
||||
case 0: tc->val2[c]+=are; break;
|
||||
case 1: tc->val1[c]-=are; tc->val2[c]+=are; break;
|
||||
case 2: tc->val1[c]-=are; break;
|
||||
@ -14820,8 +14787,7 @@ struct skill_unit_group *skill_locate_element_field(struct block_list *bl)
|
||||
}
|
||||
|
||||
// for graffiti cleaner [Valaris]
|
||||
int skill_graffitiremover (struct block_list *bl, va_list ap)
|
||||
{
|
||||
int skill_graffitiremover (struct block_list *bl, va_list ap) {
|
||||
struct skill_unit *unit=NULL;
|
||||
|
||||
nullpo_ret(bl);
|
||||
@ -14836,8 +14802,7 @@ int skill_graffitiremover (struct block_list *bl, va_list ap)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int skill_greed (struct block_list *bl, va_list ap)
|
||||
{
|
||||
int skill_greed (struct block_list *bl, va_list ap) {
|
||||
struct block_list *src;
|
||||
struct map_session_data *sd=NULL;
|
||||
struct flooritem_data *fitem=NULL;
|
||||
@ -15130,23 +15095,16 @@ bool skill_check_cloaking(struct block_list *bl, struct status_change_entry *sce
|
||||
wall = false;
|
||||
}
|
||||
|
||||
if( sce )
|
||||
{
|
||||
if( !wall )
|
||||
{
|
||||
if( sce ) {
|
||||
if( !wall ) {
|
||||
if( sce->val1 < 3 ) //End cloaking.
|
||||
status_change_end(bl, SC_CLOAKING, INVALID_TIMER);
|
||||
else
|
||||
if( sce->val4&1 )
|
||||
{ //Remove wall bonus
|
||||
else if( sce->val4&1 ) { //Remove wall bonus
|
||||
sce->val4&=~1;
|
||||
status_calc_bl(bl,SCB_SPEED);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( !(sce->val4&1) )
|
||||
{ //Add wall speed bonus
|
||||
} else {
|
||||
if( !(sce->val4&1) ) { //Add wall speed bonus
|
||||
sce->val4|=1;
|
||||
status_calc_bl(bl,SCB_SPEED);
|
||||
}
|
||||
@ -15161,23 +15119,18 @@ bool skill_check_camouflage(struct block_list *bl, struct status_change_entry *s
|
||||
static int dy[] = {-1, 0, 1, 0, -1, -1, 1, 1};
|
||||
bool wall = true;
|
||||
|
||||
if( bl->type == BL_PC )
|
||||
{ //Check for walls.
|
||||
if( bl->type == BL_PC ) { //Check for walls.
|
||||
int i;
|
||||
ARR_FIND( 0, 8, i, map_getcell(bl->m, bl->x+dx[i], bl->y+dy[i], CELL_CHKNOPASS) != 0 );
|
||||
if( i == 8 )
|
||||
wall = false;
|
||||
}
|
||||
|
||||
if( sce )
|
||||
{
|
||||
if( !wall )
|
||||
{
|
||||
if( sce ) {
|
||||
if( !wall ) {
|
||||
if( sce->val1 < 3 ) //End camouflage.
|
||||
status_change_end(bl, SC_CAMOUFLAGE, INVALID_TIMER);
|
||||
else
|
||||
if( sce->val3&1 )
|
||||
{ //Remove wall bonus
|
||||
else if( sce->val3&1 ) { //Remove wall bonus
|
||||
sce->val3&=~1;
|
||||
status_calc_bl(bl,SCB_SPEED);
|
||||
}
|
||||
@ -15246,8 +15199,7 @@ struct skill_unit *skill_initunit (struct skill_unit_group *group, int idx, int
|
||||
/*==========================================
|
||||
*
|
||||
*------------------------------------------*/
|
||||
int skill_delunit (struct skill_unit* unit)
|
||||
{
|
||||
int skill_delunit (struct skill_unit* unit) {
|
||||
struct skill_unit_group *group;
|
||||
|
||||
nullpo_ret(unit);
|
||||
@ -15361,8 +15313,7 @@ struct skill_unit_group* skill_initunitgroup (struct block_list* src, int count,
|
||||
|
||||
// find a free spot to store the new unit group
|
||||
ARR_FIND( 0, MAX_SKILLUNITGROUP, i, ud->skillunit[i] == NULL );
|
||||
if(i == MAX_SKILLUNITGROUP)
|
||||
{
|
||||
if(i == MAX_SKILLUNITGROUP) {
|
||||
// array is full, make room by discarding oldest group
|
||||
int j=0;
|
||||
unsigned maxdiff=0,x,tick=gettick();
|
||||
@ -15517,8 +15468,7 @@ int skill_delunitgroup_(struct skill_unit_group *group, const char* file, int li
|
||||
skill_delunit(&group->unit[i]);
|
||||
|
||||
// clear Talkie-box string
|
||||
if( group->valstr != NULL )
|
||||
{
|
||||
if( group->valstr != NULL ) {
|
||||
aFree(group->valstr);
|
||||
group->valstr = NULL;
|
||||
}
|
||||
@ -15532,13 +15482,11 @@ int skill_delunitgroup_(struct skill_unit_group *group, const char* file, int li
|
||||
// locate this group, swap with the last entry and delete it
|
||||
ARR_FIND( 0, MAX_SKILLUNITGROUP, i, ud->skillunit[i] == group );
|
||||
ARR_FIND( i, MAX_SKILLUNITGROUP, j, ud->skillunit[j] == NULL ); j--;
|
||||
if( i < MAX_SKILLUNITGROUP )
|
||||
{
|
||||
if( i < MAX_SKILLUNITGROUP ) {
|
||||
ud->skillunit[i] = ud->skillunit[j];
|
||||
ud->skillunit[j] = NULL;
|
||||
ers_free(skill_unit_ers, group);
|
||||
}
|
||||
else
|
||||
} else
|
||||
ShowError("skill_delunitgroup: Group not found! (src_id: %d skill_id: %d)\n", group->src_id, group->skill_id);
|
||||
|
||||
return 1;
|
||||
@ -15562,8 +15510,7 @@ int skill_clear_unitgroup (struct block_list *src)
|
||||
/*==========================================
|
||||
*
|
||||
*------------------------------------------*/
|
||||
struct skill_unit_group_tickset *skill_unitgrouptickset_search (struct block_list *bl, struct skill_unit_group *group, int tick)
|
||||
{
|
||||
struct skill_unit_group_tickset *skill_unitgrouptickset_search (struct block_list *bl, struct skill_unit_group *group, int tick) {
|
||||
int i,j=-1,k,s,id;
|
||||
struct unit_data *ud;
|
||||
struct skill_unit_group_tickset *set;
|
||||
@ -15603,8 +15550,7 @@ struct skill_unit_group_tickset *skill_unitgrouptickset_search (struct block_lis
|
||||
/*==========================================
|
||||
*
|
||||
*------------------------------------------*/
|
||||
int skill_unit_timer_sub_onplace (struct block_list* bl, va_list ap)
|
||||
{
|
||||
int skill_unit_timer_sub_onplace (struct block_list* bl, va_list ap) {
|
||||
struct skill_unit* unit = va_arg(ap,struct skill_unit *);
|
||||
struct skill_unit_group* group = unit->group;
|
||||
unsigned int tick = va_arg(ap,unsigned int);
|
||||
@ -15768,11 +15714,8 @@ static int skill_unit_timer_sub(DBKey key, DBData *data, va_list ap)
|
||||
default:
|
||||
skill_delunit(unit);
|
||||
}
|
||||
}
|
||||
else
|
||||
{// skill unit is still active
|
||||
switch( group->unit_id )
|
||||
{
|
||||
} else {// skill unit is still active
|
||||
switch( group->unit_id ) {
|
||||
case UNT_ICEWALL:
|
||||
// icewall loses 50 hp every second
|
||||
unit->val1 -= SKILLUNITTIMER_INTERVAL/20; // trap's hp
|
||||
@ -15832,12 +15775,10 @@ static int skill_unit_timer_sub(DBKey key, DBData *data, va_list ap)
|
||||
|
||||
if(unit->range == -1) //Unit disabled, but it should not be deleted yet.
|
||||
group->unit_id = UNT_USED_TRAPS;
|
||||
|
||||
if( group->unit_id == UNT_TATAMIGAESHI )
|
||||
{
|
||||
else if( group->unit_id == UNT_TATAMIGAESHI ) {
|
||||
unit->range = -1; //Disable processed cell.
|
||||
if (--group->val1 <= 0) // number of live cells
|
||||
{ //All tiles were processed, disable skill.
|
||||
if (--group->val1 <= 0) { // number of live cells
|
||||
//All tiles were processed, disable skill.
|
||||
group->target_flag=BCT_NOONE;
|
||||
group->bl_flag= BL_NUL;
|
||||
}
|
||||
@ -15851,8 +15792,7 @@ static int skill_unit_timer_sub(DBKey key, DBData *data, va_list ap)
|
||||
/*==========================================
|
||||
* Executes on all skill units every SKILLUNITTIMER_INTERVAL miliseconds.
|
||||
*------------------------------------------*/
|
||||
int skill_unit_timer(int tid, unsigned int tick, int id, intptr_t data)
|
||||
{
|
||||
int skill_unit_timer(int tid, unsigned int tick, int id, intptr_t data) {
|
||||
map_freeblock_lock();
|
||||
|
||||
skillunit_db->foreach(skillunit_db, skill_unit_timer_sub, tick);
|
||||
@ -15869,8 +15809,7 @@ static int skill_unit_temp[20]; // temporary storage for tracking skill unit sk
|
||||
* 2 : clear that skill_unit
|
||||
* 4 : call_on_left
|
||||
*------------------------------------------*/
|
||||
int skill_unit_move_sub (struct block_list* bl, va_list ap)
|
||||
{
|
||||
int skill_unit_move_sub (struct block_list* bl, va_list ap) {
|
||||
struct skill_unit* unit = (struct skill_unit *)bl;
|
||||
struct skill_unit_group* group = unit->group;
|
||||
|
||||
@ -15902,23 +15841,16 @@ int skill_unit_move_sub (struct block_list* bl, va_list ap)
|
||||
}
|
||||
|
||||
//Target-type check.
|
||||
if( !(group->bl_flag&target->type && battle_check_target(&unit->bl,target,group->target_flag) > 0) )
|
||||
{
|
||||
if( group->src_id == target->id && group->state.song_dance&0x2 )
|
||||
{ //Ensemble check to see if they went out/in of the area [Skotlex]
|
||||
if( flag&1 )
|
||||
{
|
||||
if( flag&2 )
|
||||
{ //Clear this skill id.
|
||||
if( !(group->bl_flag&target->type && battle_check_target(&unit->bl,target,group->target_flag) > 0) ) {
|
||||
if( group->src_id == target->id && group->state.song_dance&0x2 ) { //Ensemble check to see if they went out/in of the area [Skotlex]
|
||||
if( flag&1 ) {
|
||||
if( flag&2 ) { //Clear this skill id.
|
||||
ARR_FIND( 0, ARRAYLENGTH(skill_unit_temp), i, skill_unit_temp[i] == skill_id );
|
||||
if( i < ARRAYLENGTH(skill_unit_temp) )
|
||||
skill_unit_temp[i] = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( flag&2 )
|
||||
{ //Store this skill id.
|
||||
} else {
|
||||
if( flag&2 ) { //Store this skill id.
|
||||
ARR_FIND( 0, ARRAYLENGTH(skill_unit_temp), i, skill_unit_temp[i] == 0 );
|
||||
if( i < ARRAYLENGTH(skill_unit_temp) )
|
||||
skill_unit_temp[i] = skill_id;
|
||||
@ -15981,22 +15913,19 @@ int skill_unit_move_sub (struct block_list* bl, va_list ap)
|
||||
* units to figure out when they have left a group.
|
||||
* flag&4: Force a onleft event (triggered when the bl is killed, for example)
|
||||
*------------------------------------------*/
|
||||
int skill_unit_move (struct block_list *bl, unsigned int tick, int flag)
|
||||
{
|
||||
int skill_unit_move (struct block_list *bl, unsigned int tick, int flag) {
|
||||
nullpo_ret(bl);
|
||||
|
||||
if( bl->prev == NULL )
|
||||
return 0;
|
||||
|
||||
if( flag&2 && !(flag&1) )
|
||||
{ //Onout, clear data
|
||||
if( flag&2 && !(flag&1) ) { //Onout, clear data
|
||||
memset(skill_unit_temp, 0, sizeof(skill_unit_temp));
|
||||
}
|
||||
|
||||
map_foreachincell(skill_unit_move_sub,bl->m,bl->x,bl->y,BL_SKILL,bl,tick,flag);
|
||||
|
||||
if( flag&2 && flag&1 )
|
||||
{ //Onplace, check any skill units you have left.
|
||||
if( flag&2 && flag&1 ) { //Onplace, check any skill units you have left.
|
||||
int i;
|
||||
for( i = 0; i < ARRAYLENGTH(skill_unit_temp); i++ )
|
||||
if( skill_unit_temp[i] )
|
||||
@ -16825,14 +16754,10 @@ static void skill_toggle_magicpower(struct block_list *bl, uint16 skill_id)
|
||||
if (skill_get_nk(skill_id)&NK_NO_DAMAGE || !(skill_get_type(skill_id)&BF_MAGIC))
|
||||
return;
|
||||
|
||||
if (sc && sc->count && sc->data[SC_MAGICPOWER])
|
||||
{
|
||||
if (sc->data[SC_MAGICPOWER]->val4)
|
||||
{
|
||||
if (sc && sc->count && sc->data[SC_MAGICPOWER]) {
|
||||
if (sc->data[SC_MAGICPOWER]->val4) {
|
||||
status_change_end(bl, SC_MAGICPOWER, INVALID_TIMER);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
sc->data[SC_MAGICPOWER]->val4 = 1;
|
||||
status_calc_bl(bl, status_sc2scb_flag(SC_MAGICPOWER));
|
||||
#ifndef RENEWAL
|
||||
@ -17102,8 +17027,7 @@ static int skill_destroy_trap( struct block_list *bl, va_list ap ) {
|
||||
/*==========================================
|
||||
*
|
||||
*------------------------------------------*/
|
||||
int skill_blockpc_end(int tid, unsigned int tick, int id, intptr_t data)
|
||||
{
|
||||
int skill_blockpc_end(int tid, unsigned int tick, int id, intptr_t data) {
|
||||
struct map_session_data *sd = map_id2sd(id);
|
||||
struct skill_cd * cd = NULL;
|
||||
|
||||
@ -17166,10 +17090,8 @@ int skill_blockpc_start_(struct map_session_data *sd, uint16 skill_id, int tick,
|
||||
if( battle_config.display_status_timers )
|
||||
clif_skill_cooldown(sd, idx, tick);
|
||||
|
||||
if( !load )
|
||||
{// not being loaded initially so ensure the skill delay is recorded
|
||||
if( !(cd = idb_get(skillcd_db,sd->status.char_id)) )
|
||||
{// create a new skill cooldown object for map storage
|
||||
if( !load ) {// not being loaded initially so ensure the skill delay is recorded
|
||||
if( !(cd = idb_get(skillcd_db,sd->status.char_id)) ) {// create a new skill cooldown object for map storage
|
||||
CREATE( cd, struct skill_cd, 1 );
|
||||
idb_put( skillcd_db, sd->status.char_id, cd );
|
||||
}
|
||||
@ -17271,12 +17193,10 @@ void skill_usave_trigger(struct map_session_data *sd) {
|
||||
/*
|
||||
*
|
||||
*/
|
||||
int skill_split_str (char *str, char **val, int num)
|
||||
{
|
||||
int skill_split_str (char *str, char **val, int num) {
|
||||
int i;
|
||||
|
||||
for( i = 0; i < num && str; i++ )
|
||||
{
|
||||
for( i = 0; i < num && str; i++ ) {
|
||||
val[i] = str;
|
||||
str = strchr(str,',');
|
||||
if( str )
|
||||
@ -17288,8 +17208,7 @@ int skill_split_str (char *str, char **val, int num)
|
||||
/*
|
||||
*
|
||||
*/
|
||||
int skill_split_atoi (char *str, int *val)
|
||||
{
|
||||
int skill_split_atoi (char *str, int *val) {
|
||||
int i, j, diff, step = 1;
|
||||
|
||||
for (i=0; i<MAX_SKILL_LEVEL; i++) {
|
||||
@ -17301,15 +17220,13 @@ int skill_split_atoi (char *str, int *val)
|
||||
}
|
||||
if(i==0) //No data found.
|
||||
return 0;
|
||||
if(i==1)
|
||||
{ //Single value, have the whole range have the same value.
|
||||
if(i==1) { //Single value, have the whole range have the same value.
|
||||
for (; i < MAX_SKILL_LEVEL; i++)
|
||||
val[i] = val[i-1];
|
||||
return i;
|
||||
}
|
||||
//Check for linear change with increasing steps until we reach half of the data acquired.
|
||||
for (step = 1; step <= i/2; step++)
|
||||
{
|
||||
for (step = 1; step <= i/2; step++) {
|
||||
diff = val[i-1] - val[i-step-1];
|
||||
for(j = i-1; j >= step; j--)
|
||||
if ((val[j]-val[j-step]) != diff)
|
||||
@ -17318,8 +17235,7 @@ int skill_split_atoi (char *str, int *val)
|
||||
if (j>=step) //No match, try next step.
|
||||
continue;
|
||||
|
||||
for(; i < MAX_SKILL_LEVEL; i++)
|
||||
{ //Apply linear increase
|
||||
for(; i < MAX_SKILL_LEVEL; i++) { //Apply linear increase
|
||||
val[i] = val[i-step]+diff;
|
||||
if (val[i] < 1 && val[i-1] >=0) //Check if we have switched from + to -, cap the decrease to 0 in said cases.
|
||||
{ val[i] = 1; diff = 0; step = 1; }
|
||||
@ -17335,8 +17251,7 @@ int skill_split_atoi (char *str, int *val)
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void skill_init_unit_layout (void)
|
||||
{
|
||||
void skill_init_unit_layout (void) {
|
||||
int i,j,size,pos = 0;
|
||||
|
||||
memset(skill_unit_layout,0,sizeof(skill_unit_layout));
|
||||
@ -17624,8 +17539,7 @@ int skill_block_check(struct block_list *bl, sc_type type , uint16 skill_id) {
|
||||
inf = skill_get_inf2(skill_id);
|
||||
if( inf == INF2_SONG_DANCE || /*skill_get_inf2(skill_id) == INF2_CHORUS_SKILL ||*/ inf == INF2_SPIRIT_SKILL )
|
||||
return 1; // Can't do it.
|
||||
switch( skill_id )
|
||||
{
|
||||
switch( skill_id ) {
|
||||
case NV_FIRSTAID: case TF_HIDING: case AS_CLOAKING: case WZ_SIGHTRASHER:
|
||||
case RG_STRIPWEAPON: case RG_STRIPSHIELD: case RG_STRIPARMOR: case WZ_METEOR:
|
||||
case RG_STRIPHELM: case SC_STRIPACCESSARY: case ST_FULLSTRIP: case WZ_SIGHTBLASTER:
|
||||
@ -17699,14 +17613,12 @@ void skill_cooldown_load(struct map_session_data * sd)
|
||||
// always check to make sure the session properly exists
|
||||
nullpo_retv(sd);
|
||||
|
||||
if( !(cd = idb_get(skillcd_db, sd->status.char_id)) )
|
||||
{// no skill cooldown is associated with this character
|
||||
if( !(cd = idb_get(skillcd_db, sd->status.char_id)) ) {// no skill cooldown is associated with this character
|
||||
return;
|
||||
}
|
||||
|
||||
// process each individual cooldown associated with the character
|
||||
for( i = 0; i < cd->cursor; i++ )
|
||||
{
|
||||
for( i = 0; i < cd->cursor; i++ ) {
|
||||
// block the skill from usage but ensure it is not recorded (load = true)
|
||||
skill_blockpc_start_( sd, cd->nameid[i], cd->duration[i], true );
|
||||
}
|
||||
@ -17784,15 +17696,12 @@ static bool skill_parse_row_requiredb(char* split[], int columns, int current)
|
||||
|
||||
//Wich weapon type are required, see doc/item_db for types
|
||||
p = split[7];
|
||||
for( j = 0; j < 32; j++ )
|
||||
{
|
||||
for( j = 0; j < 32; j++ ) {
|
||||
int l = atoi(p);
|
||||
if( l == 99 ) // Any weapon
|
||||
{
|
||||
if( l == 99 ) { // Any weapon
|
||||
skill_db[idx].weapon = 0;
|
||||
break;
|
||||
}
|
||||
else
|
||||
} else
|
||||
skill_db[idx].weapon |= 1<<l;
|
||||
p = strchr(p,':');
|
||||
if(!p)
|
||||
@ -17802,15 +17711,12 @@ static bool skill_parse_row_requiredb(char* split[], int columns, int current)
|
||||
|
||||
//FIXME: document this
|
||||
p = split[8];
|
||||
for( j = 0; j < 32; j++ )
|
||||
{
|
||||
for( j = 0; j < 32; j++ ) {
|
||||
int l = atoi(p);
|
||||
if( l == 99 ) // Any ammo type
|
||||
{
|
||||
if( l == 99 ) { // Any ammo type
|
||||
skill_db[idx].ammo = 0xFFFFFFFF;
|
||||
break;
|
||||
}
|
||||
else if( l ) // 0 stands for no requirement
|
||||
} else if( l ) // 0 stands for no requirement
|
||||
skill_db[idx].ammo |= 1<<l;
|
||||
p = strchr(p,':');
|
||||
if( !p )
|
||||
@ -17953,8 +17859,7 @@ static bool skill_parse_row_producedb(char* split[], int columns, int current)
|
||||
skill_produce_db[current].req_skill = atoi(split[2]);
|
||||
skill_produce_db[current].req_skill_lv = atoi(split[3]);
|
||||
|
||||
for( x = 4, y = 0; x+1 < columns && split[x] && split[x+1] && y < MAX_PRODUCE_RESOURCE; x += 2, y++ )
|
||||
{
|
||||
for( x = 4, y = 0; x+1 < columns && split[x] && split[x+1] && y < MAX_PRODUCE_RESOURCE; x += 2, y++ ) {
|
||||
skill_produce_db[current].mat_id[y] = atoi(split[x]);
|
||||
skill_produce_db[current].mat_amount[y] = atoi(split[x+1]);
|
||||
}
|
||||
@ -17972,8 +17877,7 @@ static bool skill_parse_row_createarrowdb(char* split[], int columns, int curren
|
||||
|
||||
skill_arrow_db[current].nameid = i;
|
||||
|
||||
for( x = 1, y = 0; x+1 < columns && split[x] && split[x+1] && y < MAX_ARROW_RESOURCE; x += 2, y++ )
|
||||
{
|
||||
for( x = 1, y = 0; x+1 < columns && split[x] && split[x+1] && y < MAX_ARROW_RESOURCE; x += 2, y++ ) {
|
||||
skill_arrow_db[current].cre_id[y] = atoi(split[x]);
|
||||
skill_arrow_db[current].cre_amount[y] = atoi(split[x+1]);
|
||||
}
|
||||
@ -17993,8 +17897,7 @@ static bool skill_parse_row_spellbookdb(char* split[], int columns, int current)
|
||||
ShowError("spellbook_db: Passive skills cannot be memorized (%d/%s)\n", skill_id, skill_get_name(skill_id));
|
||||
if( points < 1 )
|
||||
ShowError("spellbook_db: PreservePoints have to be 1 or above! (%d/%s)\n", skill_id, skill_get_name(skill_id));
|
||||
else
|
||||
{
|
||||
else {
|
||||
skill_spellbook_db[current].skill_id = skill_id;
|
||||
skill_spellbook_db[current].point = points;
|
||||
skill_spellbook_db[current].nameid = nameid;
|
||||
@ -18106,8 +18009,7 @@ static bool skill_parse_row_changematerialdb(char* split[], int columns, int cur
|
||||
skill_changematerial_db[current].itemid = skill_id;
|
||||
skill_changematerial_db[current].rate = j;
|
||||
|
||||
for( x = 2, y = 0; x+1 < columns && split[x] && split[x+1] && y < 5; x += 2, y++ )
|
||||
{
|
||||
for( x = 2, y = 0; x+1 < columns && split[x] && split[x+1] && y < 5; x += 2, y++ ) {
|
||||
skill_changematerial_db[current].qty[y] = atoi(split[x]);
|
||||
skill_changematerial_db[current].qty_rate[y] = atoi(split[x+1]);
|
||||
}
|
||||
|
@ -26,8 +26,7 @@ struct status_change_entry;
|
||||
DBMap* skilldb_name2id;
|
||||
|
||||
//Constants to identify the skill's inf value:
|
||||
enum e_skill_inf
|
||||
{
|
||||
enum e_skill_inf {
|
||||
INF_ATTACK_SKILL = 0x01,
|
||||
INF_GROUND_SKILL = 0x02,
|
||||
INF_SELF_SKILL = 0x04, // Skills casted on self where target is automatically chosen
|
||||
@ -39,8 +38,7 @@ enum e_skill_inf
|
||||
//Constants to identify a skill's nk value (damage properties)
|
||||
//The NK value applies only to non INF_GROUND_SKILL skills
|
||||
//when determining skill castend function to invoke.
|
||||
enum e_skill_nk
|
||||
{
|
||||
enum e_skill_nk {
|
||||
NK_NO_DAMAGE = 0x01,
|
||||
NK_SPLASH = 0x02|0x04, // 0x4 = splash & split
|
||||
NK_SPLASHSPLIT = 0x04,
|
||||
@ -53,8 +51,7 @@ enum e_skill_nk
|
||||
|
||||
//A skill with 3 would be no damage + splash: area of effect.
|
||||
//Constants to identify a skill's inf2 value.
|
||||
enum e_skill_inf2
|
||||
{
|
||||
enum e_skill_inf2 {
|
||||
INF2_QUEST_SKILL = 0x0001,
|
||||
INF2_NPC_SKILL = 0x0002, //NPC skills are those that players can't have in their skill tree.
|
||||
INF2_WEDDING_SKILL = 0x0004,
|
||||
@ -76,8 +73,7 @@ enum e_skill_inf2
|
||||
#define WALK_SKILL_INTERVAL 5
|
||||
|
||||
// Flags passed to skill_attack/skill_area_sub
|
||||
enum e_skill_display
|
||||
{
|
||||
enum e_skill_display {
|
||||
SD_LEVEL = 0x1000, // skill_attack will send -1 instead of skill level (affects display of some skills)
|
||||
SD_ANIMATION = 0x2000, // skill_attack will use '5' instead of the skill's 'type' (this makes skills show an animation)
|
||||
SD_SPLASH = 0x4000, // skill_area_sub will count targets in skill_area_temp[2]
|
||||
|
133
src/map/status.c
133
src/map/status.c
@ -2606,8 +2606,7 @@ int status_calc_pc_(struct map_session_data* sd, bool first)
|
||||
data = itemdb_exists(c);
|
||||
if(!data)
|
||||
continue;
|
||||
if(first && data->equip_script)
|
||||
{ //Execute equip-script on login
|
||||
if(first && data->equip_script) {//Execute equip-script on login
|
||||
run_script(data->equip_script,0,sd->bl.id,0);
|
||||
if (!calculating)
|
||||
return 1;
|
||||
@ -4817,7 +4816,7 @@ static signed short status_calc_flee(struct block_list *bl, struct status_change
|
||||
if(!sc || !sc->count)
|
||||
return cap_value(flee,1,SHRT_MAX);
|
||||
if(sc->data[SC_TINDER_BREAKER] || sc->data[SC_TINDER_BREAKER2])
|
||||
return 0; //0 flee
|
||||
return 1; //1 = min flee
|
||||
|
||||
if(sc->data[SC_INCFLEE])
|
||||
flee += sc->data[SC_INCFLEE]->val1;
|
||||
@ -6614,12 +6613,12 @@ int status_change_start(struct block_list* src, struct block_list* bl,enum sc_ty
|
||||
undead_flag = battle_check_undead(status->race,status->def_ele);
|
||||
//Check for inmunities / sc fails
|
||||
switch (type) {
|
||||
case SC_ANGRIFFS_MODUS:
|
||||
case SC_GOLDENE_FERSE:
|
||||
if ((type==SC_GOLDENE_FERSE && sc->data[SC_ANGRIFFS_MODUS])
|
||||
|| (type==SC_ANGRIFFS_MODUS && sc->data[SC_GOLDENE_FERSE])
|
||||
)
|
||||
return 0;
|
||||
case SC_ANGRIFFS_MODUS:
|
||||
case SC_GOLDENE_FERSE:
|
||||
if ((type==SC_GOLDENE_FERSE && sc->data[SC_ANGRIFFS_MODUS])
|
||||
|| (type==SC_ANGRIFFS_MODUS && sc->data[SC_GOLDENE_FERSE])
|
||||
)
|
||||
return 0;
|
||||
case SC_STONE:
|
||||
if(sc->data[SC_POWER_OF_GAIA])
|
||||
return 0;
|
||||
@ -6638,7 +6637,7 @@ int status_change_start(struct block_list* src, struct block_list* bl,enum sc_ty
|
||||
return 0; //Immune to Frozen and Freezing status if under Warmer status. [Jobbie]
|
||||
break;
|
||||
|
||||
//There all like berserk, do not everlap each other
|
||||
//There all like berserk, do not everlap each other
|
||||
case SC__BLOODYLUST:
|
||||
if(!sd) return 0; //should only affect player
|
||||
case SC_BERSERK:
|
||||
@ -9117,8 +9116,7 @@ int status_change_start(struct block_list* src, struct block_list* bl,enum sc_ty
|
||||
* 2 - Do clif
|
||||
* 3 - Do not remove some permanent/time-independent effects
|
||||
*------------------------------------------*/
|
||||
int status_change_clear(struct block_list* bl, int type)
|
||||
{
|
||||
int status_change_clear(struct block_list* bl, int type) {
|
||||
struct status_change* sc;
|
||||
int i;
|
||||
|
||||
@ -9127,69 +9125,64 @@ int status_change_clear(struct block_list* bl, int type)
|
||||
if (!sc || !sc->count)
|
||||
return 0;
|
||||
|
||||
for(i = 0; i < SC_MAX; i++)
|
||||
{
|
||||
for(i = 0; i < SC_MAX; i++) {
|
||||
if(!sc->data[i])
|
||||
continue;
|
||||
|
||||
if(type == 0)
|
||||
switch (i)
|
||||
{ //Type 0: PC killed -> Place here statuses that do not dispel on death.
|
||||
case SC_ELEMENTALCHANGE://Only when its Holy or Dark that it doesn't dispell on death
|
||||
if( sc->data[i]->val2 != ELE_HOLY && sc->data[i]->val2 != ELE_DARK )
|
||||
break;
|
||||
case SC_WEIGHT50:
|
||||
case SC_WEIGHT90:
|
||||
case SC_EDP:
|
||||
case SC_MELTDOWN:
|
||||
case SC_XMAS:
|
||||
case SC_SUMMER:
|
||||
case SC_NOCHAT:
|
||||
case SC_FUSION:
|
||||
case SC_EARTHSCROLL:
|
||||
case SC_READYSTORM:
|
||||
case SC_READYDOWN:
|
||||
case SC_READYCOUNTER:
|
||||
case SC_READYTURN:
|
||||
case SC_DODGE:
|
||||
case SC_JAILED:
|
||||
case SC_EXPBOOST:
|
||||
case SC_ITEMBOOST:
|
||||
case SC_HELLPOWER:
|
||||
case SC_JEXPBOOST:
|
||||
case SC_AUTOTRADE:
|
||||
case SC_WHISTLE:
|
||||
case SC_ASSNCROS:
|
||||
case SC_POEMBRAGI:
|
||||
case SC_APPLEIDUN:
|
||||
case SC_HUMMING:
|
||||
case SC_DONTFORGETME:
|
||||
case SC_FORTUNE:
|
||||
case SC_SERVICE4U:
|
||||
case SC_FOOD_STR_CASH:
|
||||
case SC_FOOD_AGI_CASH:
|
||||
case SC_FOOD_VIT_CASH:
|
||||
case SC_FOOD_DEX_CASH:
|
||||
case SC_FOOD_INT_CASH:
|
||||
case SC_FOOD_LUK_CASH:
|
||||
case SC_DEF_RATE:
|
||||
case SC_MDEF_RATE:
|
||||
case SC_INCHEALRATE:
|
||||
case SC_INCFLEE2:
|
||||
case SC_INCHIT:
|
||||
case SC_ATKPOTION:
|
||||
case SC_MATKPOTION:
|
||||
case SC_S_LIFEPOTION:
|
||||
case SC_L_LIFEPOTION:
|
||||
case SC_PUSH_CART:
|
||||
continue;
|
||||
|
||||
switch (i) { //Type 0: PC killed -> Place here statuses that do not dispel on death.
|
||||
case SC_ELEMENTALCHANGE://Only when its Holy or Dark that it doesn't dispell on death
|
||||
if( sc->data[i]->val2 != ELE_HOLY && sc->data[i]->val2 != ELE_DARK )
|
||||
break;
|
||||
case SC_WEIGHT50:
|
||||
case SC_WEIGHT90:
|
||||
case SC_EDP:
|
||||
case SC_MELTDOWN:
|
||||
case SC_XMAS:
|
||||
case SC_SUMMER:
|
||||
case SC_NOCHAT:
|
||||
case SC_FUSION:
|
||||
case SC_EARTHSCROLL:
|
||||
case SC_READYSTORM:
|
||||
case SC_READYDOWN:
|
||||
case SC_READYCOUNTER:
|
||||
case SC_READYTURN:
|
||||
case SC_DODGE:
|
||||
case SC_JAILED:
|
||||
case SC_EXPBOOST:
|
||||
case SC_ITEMBOOST:
|
||||
case SC_HELLPOWER:
|
||||
case SC_JEXPBOOST:
|
||||
case SC_AUTOTRADE:
|
||||
case SC_WHISTLE:
|
||||
case SC_ASSNCROS:
|
||||
case SC_POEMBRAGI:
|
||||
case SC_APPLEIDUN:
|
||||
case SC_HUMMING:
|
||||
case SC_DONTFORGETME:
|
||||
case SC_FORTUNE:
|
||||
case SC_SERVICE4U:
|
||||
case SC_FOOD_STR_CASH:
|
||||
case SC_FOOD_AGI_CASH:
|
||||
case SC_FOOD_VIT_CASH:
|
||||
case SC_FOOD_DEX_CASH:
|
||||
case SC_FOOD_INT_CASH:
|
||||
case SC_FOOD_LUK_CASH:
|
||||
case SC_DEF_RATE:
|
||||
case SC_MDEF_RATE:
|
||||
case SC_INCHEALRATE:
|
||||
case SC_INCFLEE2:
|
||||
case SC_INCHIT:
|
||||
case SC_ATKPOTION:
|
||||
case SC_MATKPOTION:
|
||||
case SC_S_LIFEPOTION:
|
||||
case SC_L_LIFEPOTION:
|
||||
case SC_PUSH_CART:
|
||||
continue;
|
||||
}
|
||||
|
||||
if( type == 3 )
|
||||
{
|
||||
switch (i)
|
||||
{// TODO: This list may be incomplete
|
||||
if( type == 3 ) {
|
||||
switch (i) {// TODO: This list may be incomplete
|
||||
case SC_WEIGHT50:
|
||||
case SC_WEIGHT90:
|
||||
case SC_NOCHAT:
|
||||
@ -9614,7 +9607,7 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const
|
||||
struct unit_data *ud = unit_bl2ud(bl);
|
||||
if (ud) {
|
||||
ud->state.running = 0;
|
||||
if (ud->walktimer != -1)
|
||||
if (ud->walktimer != INVALID_TIMER)
|
||||
unit_stop_walking(bl,1);
|
||||
}
|
||||
}
|
||||
|
@ -634,8 +634,8 @@ typedef enum sc_type {
|
||||
|
||||
//homon S
|
||||
SC_STYLE_CHANGE,
|
||||
SC_TINDER_BREAKER, //@TODO rewritte me plz
|
||||
SC_TINDER_BREAKER2, //for rewritte and other icone
|
||||
SC_TINDER_BREAKER,
|
||||
SC_TINDER_BREAKER2,
|
||||
SC_CBC,
|
||||
SC_EQC,
|
||||
SC_GOLDENE_FERSE,
|
||||
|
@ -168,7 +168,7 @@ static int unit_walktoxy_timer(int tid, unsigned int tick, int id, intptr_t data
|
||||
if (bl->x != x || bl->y != y || ud->walktimer != INVALID_TIMER)
|
||||
return 0; //map_moveblock has altered the object beyond what we expected (moved/warped it)
|
||||
|
||||
ud->walktimer = -2; // arbitrary non-INVALID_TIMER value to make the clif code send walking packets
|
||||
ud->walktimer = CLIF_WALK_TIMER; // arbitrary non-INVALID_TIMER value to make the clif code send walking packets
|
||||
map_foreachinmovearea(clif_insight, bl, AREA_SIZE, -dx, -dy, sd?BL_ALL:BL_PC, bl);
|
||||
ud->walktimer = INVALID_TIMER;
|
||||
|
||||
@ -632,7 +632,7 @@ int unit_movepos(struct block_list *bl, short dst_x, short dst_y, int easy, bool
|
||||
|
||||
map_moveblock(bl, dst_x, dst_y, gettick());
|
||||
|
||||
ud->walktimer = -2; // arbitrary non-INVALID_TIMER value to make the clif code send walking packets
|
||||
ud->walktimer = CLIF_WALK_TIMER; // arbitrary non-INVALID_TIMER value to make the clif code send walking packets
|
||||
map_foreachinmovearea(clif_insight, bl, AREA_SIZE, -dx, -dy, sd?BL_ALL:BL_PC, bl);
|
||||
ud->walktimer = INVALID_TIMER;
|
||||
|
||||
@ -1354,13 +1354,11 @@ int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill_id, ui
|
||||
}
|
||||
|
||||
|
||||
if( casttime > 0 )
|
||||
{
|
||||
if( casttime > 0 ) {
|
||||
ud->skilltimer = add_timer( tick+casttime, skill_castend_id, src->id, 0 );
|
||||
if( sd && (pc_checkskill(sd,SA_FREECAST) > 0 || skill_id == LG_EXEEDBREAK) )
|
||||
status_calc_bl(&sd->bl, SCB_SPEED);
|
||||
}
|
||||
else
|
||||
} else
|
||||
skill_castend_id(ud->skilltimer,tick,src->id,0);
|
||||
|
||||
return 1;
|
||||
@ -1434,8 +1432,7 @@ int unit_skilluse_pos2( struct block_list *src, short skill_x, short skill_y, ui
|
||||
else
|
||||
range = skill_get_range2(src, skill_id, skill_lv); // Skill cast distance from database
|
||||
|
||||
if( skill_get_state(ud->skill_id) == ST_MOVE_ENABLE )
|
||||
{
|
||||
if( skill_get_state(ud->skill_id) == ST_MOVE_ENABLE ) {
|
||||
if( !unit_can_reach_bl(src, &bl, range + 1, 1, NULL, NULL) )
|
||||
return 0; //Walk-path check failed.
|
||||
}
|
||||
@ -1489,14 +1486,11 @@ int unit_skilluse_pos2( struct block_list *src, short skill_x, short skill_y, ui
|
||||
unit_stop_walking(src,1);
|
||||
// in official this is triggered even if no cast time.
|
||||
clif_skillcasting(src, src->id, 0, skill_x, skill_y, skill_id, skill_get_ele(skill_id, skill_lv), casttime);
|
||||
if( casttime > 0 )
|
||||
{
|
||||
if( casttime > 0 ) {
|
||||
ud->skilltimer = add_timer( tick+casttime, skill_castend_pos, src->id, 0 );
|
||||
if( (sd && pc_checkskill(sd,SA_FREECAST) > 0) || skill_id == LG_EXEEDBREAK)
|
||||
status_calc_bl(&sd->bl, SCB_SPEED);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
ud->skilltimer = INVALID_TIMER;
|
||||
skill_castend_pos(ud->skilltimer,tick,src->id,0);
|
||||
}
|
||||
@ -1888,7 +1882,7 @@ int unit_skillcastcancel(struct block_list *bl,int type)
|
||||
struct map_session_data *sd = NULL;
|
||||
struct unit_data *ud = unit_bl2ud( bl);
|
||||
unsigned int tick=gettick();
|
||||
int ret=0, skill;
|
||||
int ret=0, skill_id;
|
||||
|
||||
nullpo_ret(bl);
|
||||
if (!ud || ud->skilltimer == INVALID_TIMER)
|
||||
@ -1909,11 +1903,11 @@ int unit_skillcastcancel(struct block_list *bl,int type)
|
||||
ud->canact_tick = tick;
|
||||
|
||||
if(type&1 && sd)
|
||||
skill = sd->skill_id_old;
|
||||
skill_id = sd->skill_id_old;
|
||||
else
|
||||
skill = ud->skill_id;
|
||||
skill_id = ud->skill_id;
|
||||
|
||||
if (skill_get_inf(skill) & INF_GROUND_SKILL)
|
||||
if (skill_get_inf(skill_id) & INF_GROUND_SKILL)
|
||||
ret=delete_timer( ud->skilltimer, skill_castend_pos );
|
||||
else
|
||||
ret=delete_timer( ud->skilltimer, skill_castend_id );
|
||||
@ -1925,13 +1919,11 @@ int unit_skillcastcancel(struct block_list *bl,int type)
|
||||
if( sd && pc_checkskill(sd,SA_FREECAST) > 0 )
|
||||
status_calc_bl(&sd->bl, SCB_SPEED);
|
||||
|
||||
if( sd )
|
||||
{
|
||||
switch( skill )
|
||||
{
|
||||
case CG_ARROWVULCAN:
|
||||
sd->canequip_tick = tick;
|
||||
break;
|
||||
if( sd ) {
|
||||
switch( skill_id ) {
|
||||
case CG_ARROWVULCAN:
|
||||
sd->canequip_tick = tick;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2075,7 +2067,7 @@ int unit_remove_map_(struct block_list *bl, clr_type clrtype, const char* file,
|
||||
case BL_PC: {
|
||||
struct map_session_data *sd = (struct map_session_data*)bl;
|
||||
|
||||
if(sd->shadowform_id){
|
||||
if(sd->shadowform_id){ //if shadow target has leave the map
|
||||
struct block_list *d_bl = map_id2bl(sd->shadowform_id);
|
||||
if( d_bl )
|
||||
status_change_end(d_bl,SC__SHADOWFORM,INVALID_TIMER);
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include "chrif.h"
|
||||
#include "vending.h"
|
||||
#include "pc.h"
|
||||
#include "npc.h"
|
||||
#include "skill.h"
|
||||
#include "battle.h"
|
||||
#include "log.h"
|
||||
|
Loading…
x
Reference in New Issue
Block a user