Follow up e0c8e01

Move skill_get_cooldown_ into pc_get_skillcooldown
and add a short src_doc description to promote his usage
(and avoid duplicate code)
Fix few cppcheck issues (variable scope optimisation mostly)
This commit is contained in:
lighta 2014-03-18 17:36:23 -04:00
parent 26aad11908
commit 51f26d43d2
11 changed files with 91 additions and 91 deletions

View File

@ -150,7 +150,6 @@ bool mapif_homunculus_save(struct s_homunculus* hd)
// Load an homunculus
bool mapif_homunculus_load(int homun_id, struct s_homunculus* hd)
{
int i;
char* data;
size_t len;
@ -198,7 +197,7 @@ bool mapif_homunculus_load(int homun_id, struct s_homunculus* hd)
Sql_GetData(sql_handle, 21, &data, NULL); hd->vaporize = atoi(data);
Sql_FreeResult(sql_handle);
hd->intimacy = cap_value(hd->intimacy, 0, 100000);
hd->intimacy = min(hd->intimacy,100000);
hd->hunger = cap_value(hd->hunger, 0, 100);
// Load Homunculus Skill
@ -209,6 +208,7 @@ bool mapif_homunculus_load(int homun_id, struct s_homunculus* hd)
}
while( SQL_SUCCESS == Sql_NextRow(sql_handle) )
{
int i;
// id
Sql_GetData(sql_handle, 0, &data, NULL);
i = atoi(data);

View File

@ -63,7 +63,6 @@ static int int_party_check_lv(struct party_data *p) {
static void int_party_calc_state(struct party_data *p)
{
int i;
unsigned int lv;
p->min_lv = UINT_MAX;
p->max_lv = 0;
p->party.count =
@ -93,7 +92,7 @@ static void int_party_calc_state(struct party_data *p)
}
//max/min levels.
for(i=0;i<MAX_PARTY;i++){
lv=p->party.member[i].lv;
unsigned int lv=p->party.member[i].lv;
if (!lv) continue;
if(p->party.member[i].online &&
//On families, the kid is not counted towards exp share rules.

View File

@ -475,7 +475,6 @@ static void db_rebalance_erase(DBNode node, DBNode *root)
DBNode y = node;
DBNode x = NULL;
DBNode x_parent = NULL;
DBNode w;
DB_COUNTSTAT(db_rebalance_erase);
// Select where to change the tree
@ -543,6 +542,7 @@ static void db_rebalance_erase(DBNode node, DBNode *root)
// Restore the RED-BLACK properties
if (y->color != RED) {
while (x != *root && (x == NULL || x->color == BLACK)) {
DBNode w;
if (x == x_parent->left) {
w = x_parent->right;
if (w->color == RED) {
@ -1414,7 +1414,6 @@ static bool db_obj_exists(DBMap* self, DBKey key)
{
DBMap_impl* db = (DBMap_impl*)self;
DBNode node;
int c;
bool found = false;
DB_COUNTSTAT(db_exists);
@ -1436,7 +1435,7 @@ static bool db_obj_exists(DBMap* self, DBKey key)
db_free_lock(db);
node = db->ht[db->hash(key, db->maxlen)%HASH_SIZE];
while (node) {
c = db->cmp(key, node->key, db->maxlen);
int c = db->cmp(key, node->key, db->maxlen);
if (c == 0) {
if (!(node->deleted)) {
db->cache = node;
@ -1465,7 +1464,6 @@ static DBData* db_obj_get(DBMap* self, DBKey key)
{
DBMap_impl* db = (DBMap_impl*)self;
DBNode node;
int c;
DBData *data = NULL;
DB_COUNTSTAT(db_get);
@ -1488,7 +1486,7 @@ static DBData* db_obj_get(DBMap* self, DBKey key)
db_free_lock(db);
node = db->ht[db->hash(key, db->maxlen)%HASH_SIZE];
while (node) {
c = db->cmp(key, node->key, db->maxlen);
int c = db->cmp(key, node->key, db->maxlen);
if (c == 0) {
if (!(node->deleted)) {
data = &node->data;
@ -1856,7 +1854,7 @@ static int db_obj_remove(DBMap* self, DBKey key, DBData *out_data)
DBMap_impl* db = (DBMap_impl*)self;
DBNode node;
unsigned int hash;
int c = 0, retval = 0;
int retval = 0;
DB_COUNTSTAT(db_remove);
if (db == NULL) return 0; // nullpo candidate
@ -1874,7 +1872,7 @@ static int db_obj_remove(DBMap* self, DBKey key, DBData *out_data)
db_free_lock(db);
hash = db->hash(key, db->maxlen)%HASH_SIZE;
for(node = db->ht[hash]; node; ){
c = db->cmp(key, node->key, db->maxlen);
int c = db->cmp(key, node->key, db->maxlen);
if (c == 0) {
if (!(node->deleted)) {
if (db->cache == node)

View File

@ -1842,12 +1842,11 @@ int login_config_read(const char* cfgName)
if (sscanf(w2, "%3d, %32s", &group, md5) == 2) {
struct client_hash_node *nnode;
int i;
CREATE(nnode, struct client_hash_node, 1);
if (strcmpi(md5, "disabled") == 0) {
nnode->hash[0] = '\0';
} else {
int i;
for (i = 0; i < 32; i += 2) {
char buf[3];
unsigned int byte;
@ -1859,10 +1858,8 @@ int login_config_read(const char* cfgName)
nnode->hash[i / 2] = (uint8)(byte & 0xFF);
}
}
nnode->group_id = group;
nnode->next = login_config.client_hash_nodes;
login_config.client_hash_nodes = nnode;
}
} else if(strcmpi(w1, "chars_per_account") == 0) { //maxchars per account [Sirius]

View File

@ -143,9 +143,7 @@ static const char* atcommand_help_string(const char* command)
*------------------------------------------*/
ACMD_FUNC(send)
{
int len=0,off,end,type;
long num;
int len=0,type;
// read message type as hex number (without the 0x)
if(!message || !*message ||
!((sscanf(message, "len %x", &type)==1 && (len=1))
@ -187,9 +185,9 @@ ACMD_FUNC(send)
}\
}
//define GET_VALUE
if (type > 0 && type < MAX_PACKET_DB) {
int off,end;
long num;
if(len)
{// show packet length
sprintf(atcmd_output, msg_txt(sd,904), type, packet_db[sd->packet_ver][type].len); // Packet 0x%x length: %d
@ -404,7 +402,7 @@ static void warp_get_suggestions(struct map_session_data* sd, const char *name)
// if no maps found, search by edit distance
if (!count) {
unsigned int distance[MAX_MAP_PER_SERVER][2];
int j, min;
int j;
// calculate Levenshtein distance for all maps
for (i = 0; i < MAX_MAP_PER_SERVER; i++) {
@ -419,7 +417,7 @@ static void warp_get_suggestions(struct map_session_data* sd, const char *name)
// selection sort elements as needed
count = min(MAX_SUGGESTIONS, 5); // results past 5 aren't worth showing
for (i = 0; i < count; i++) {
min = i;
int min = i;
for (j = i+1; j < MAX_MAP_PER_SERVER; j++) {
if (distance[j][0] < distance[min][0])
min = j;
@ -618,7 +616,6 @@ ACMD_FUNC(jump)
ACMD_FUNC(who) {
struct map_session_data *pl_sd = NULL;
struct s_mapiterator *iter = NULL;
char map_name[MAP_NAME_LENGTH_EXT] = "";
char player_name[NAME_LENGTH] = "";
int count = 0;
int level = 0;
@ -634,6 +631,7 @@ ACMD_FUNC(who) {
nullpo_retr(-1, sd);
if (strstr(command, "map") != NULL) {
char map_name[MAP_NAME_LENGTH_EXT] = "";
if (sscanf(message, "%15s %23s", map_name, player_name) < 1 || (map_id = map_mapname2mapid(map_name)) < 0)
map_id = sd->bl.m;
} else {
@ -721,7 +719,7 @@ ACMD_FUNC(whogm)
struct map_session_data* pl_sd;
struct s_mapiterator* iter;
int j, count;
int pl_level, level;
int level;
char match_text[CHAT_SIZE_MAX];
char player_name[NAME_LENGTH];
struct guild *g;
@ -744,7 +742,7 @@ ACMD_FUNC(whogm)
iter = mapit_getallusers();
for( pl_sd = (TBL_PC*)mapit_first(iter); mapit_exists(iter); pl_sd = (TBL_PC*)mapit_next(iter) )
{
pl_level = pc_get_group_level(pl_sd);
int pl_level = pc_get_group_level(pl_sd);
if (!pl_level)
continue;
@ -2009,7 +2007,7 @@ ACMD_FUNC(monster)
int mob_id;
int number = 0;
int count;
int i, k, range;
int i, range;
short mx, my;
unsigned int size;
nullpo_retr(-1, sd);
@ -2075,9 +2073,13 @@ ACMD_FUNC(monster)
count = 0;
range = (int)sqrt((float)number) +2; // calculation of an odd number (+ 4 area around)
for (i = 0; i < number; i++) {
int k;
map_search_freecell(&sd->bl, 0, &mx, &my, range, range, 0);
k = mob_once_spawn(sd, sd->bl.m, mx, my, name, mob_id, 1, eventname, size, AI_NONE);
count += (k != 0) ? 1 : 0;
if(k) {
//mapreg_setreg(reference_uid(add_str("$@mobid"), i),k); //retain created mobid in array uncomment if needed
count ++;
}
}
if (count != 0)
@ -2145,7 +2147,7 @@ ACMD_FUNC(killmonster)
*------------------------------------------*/
ACMD_FUNC(refine)
{
int i,j, position = 0, refine = 0, current_position, final_refine;
int j, position = 0, refine = 0, current_position, final_refine;
int count;
nullpo_retr(-1, sd);
@ -2180,6 +2182,7 @@ ACMD_FUNC(refine)
count = 0;
for (j = 0; j < EQI_MAX; j++) {
int i;
if ((i = sd->equip_index[j]) < 0)
continue;
if(j == EQI_AMMO) continue;
@ -3837,7 +3840,6 @@ ACMD_FUNC(partysharelvl) {
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 = 0, list = 0, vend_num = 0;
@ -4087,7 +4089,7 @@ ACMD_FUNC(mapinfo) {
clif_displaymessage(fd, msg_txt(sd,482)); // ----- NPCs in Map -----
for (i = 0; i < map[m_id].npc_num;)
{
nd = map[m_id].npc[i];
struct npc_data *nd = map[m_id].npc[i];
switch(nd->ud.dir) {
case 0: strcpy(direction, msg_txt(sd,491)); break; // North
case 1: strcpy(direction, msg_txt(sd,492)); break; // North West
@ -4526,7 +4528,6 @@ char* txt_time(unsigned int duration)
ACMD_FUNC(servertime)
{
const struct TimerData * timer_data;
const struct TimerData * timer_data2;
time_t time_server; // variable for number of seconds (used with time() function)
struct tm *datetime; // variable for time in structure ->tm_mday, ->tm_sec, ...
char temp[CHAT_SIZE_MAX];
@ -4562,6 +4563,7 @@ ACMD_FUNC(servertime)
} else
clif_displaymessage(fd, msg_txt(sd,232)); // Game time: The game is in permanent night.
else {
const struct TimerData * timer_data2;
if (night_flag == 0) {
timer_data = get_timer(night_timer_tid);
timer_data2 = get_timer(day_timer_tid);
@ -4882,7 +4884,7 @@ ACMD_FUNC(disguiseguild)
{
int id = 0, i;
char monster[NAME_LENGTH], guild[NAME_LENGTH];
struct map_session_data *pl_sd;
struct guild *g;
memset(monster, '\0', sizeof(monster));
@ -4914,9 +4916,11 @@ ACMD_FUNC(disguiseguild)
return -1;
}
for( i = 0; i < g->max_member; i++ )
for( i = 0; i < g->max_member; i++ ){
struct map_session_data *pl_sd;
if( (pl_sd = g->member[i].sd) && !pc_isriding(pl_sd) )
pc_disguise(pl_sd, id);
}
clif_displaymessage(fd, msg_txt(sd,122)); // Disguise applied.
return 0;
@ -4966,7 +4970,6 @@ ACMD_FUNC(undisguiseall)
ACMD_FUNC(undisguiseguild)
{
char guild_name[NAME_LENGTH];
struct map_session_data *pl_sd;
struct guild *g;
int i;
nullpo_retr(-1, sd);
@ -4983,9 +4986,11 @@ ACMD_FUNC(undisguiseguild)
return -1;
}
for(i = 0; i < g->max_member; i++)
for(i = 0; i < g->max_member; i++){
struct map_session_data *pl_sd;
if( (pl_sd = g->member[i].sd) && pl_sd->disguise )
pc_disguise(pl_sd, 0);
}
clif_displaymessage(fd, msg_txt(sd,124)); // Undisguise applied.
@ -5450,7 +5455,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) {
int skillen, idx, i, found = 0;
int skillen, i, found = 0;
DBIterator* iter;
DBKey key;
DBData *data;
@ -5468,7 +5473,7 @@ ACMD_FUNC(skillid) {
iter = db_iterator(skilldb_name2id);
for( data = iter->first(iter,&key); iter->exists(iter); data = iter->next(iter,&key) ) {
idx = skill_get_index(db_data2i(data));
int idx = skill_get_index(db_data2i(data));
if (strnicmp(key.str, message, skillen) == 0 || strnicmp(skill_db[idx].desc, message, skillen) == 0) {
sprintf(atcmd_output, msg_txt(sd,1164), db_data2i(data), skill_db[idx].desc, key.str); // skill %d: %s (%s)
clif_displaymessage(fd, atcmd_output);
@ -6921,8 +6926,7 @@ ACMD_FUNC(mobinfo)
struct item_data *item_data;
struct mob_db *mob, *mob_array[MAX_SEARCH];
int count;
int i, j, k;
unsigned int base_exp, job_exp;
int i, k;
memset(atcmd_output, '\0', sizeof(atcmd_output));
memset(atcmd_output2, '\0', sizeof(atcmd_output2));
@ -6951,6 +6955,7 @@ ACMD_FUNC(mobinfo)
count = MAX_SEARCH;
}
for (k = 0; k < count; k++) {
unsigned int j,base_exp,job_exp;
mob = mob_array[k];
base_exp = mob->base_exp;
job_exp = mob->job_exp;
@ -6962,11 +6967,11 @@ ACMD_FUNC(mobinfo)
}
#endif
#ifdef VIP_ENABLE
// Display EXP rate increase for VIP.
if (pc_isvip(sd) && (battle_config.vip_base_exp_increase || battle_config.vip_job_exp_increase)) {
base_exp += battle_config.vip_base_exp_increase;
job_exp += battle_config.vip_job_exp_increase;
}
// Display EXP rate increase for VIP.
if (pc_isvip(sd) && (battle_config.vip_base_exp_increase || battle_config.vip_job_exp_increase)) {
base_exp += battle_config.vip_base_exp_increase;
job_exp += battle_config.vip_job_exp_increase;
}
#endif
// stats
if (mob->mexp)
@ -7444,7 +7449,7 @@ ACMD_FUNC(homshuffle)
*------------------------------------------*/
ACMD_FUNC(iteminfo)
{
struct item_data *item_data, *item_array[MAX_SEARCH];
struct item_data *item_array[MAX_SEARCH];
int i, count = 1;
if (!message || !*message) {
@ -7465,7 +7470,7 @@ ACMD_FUNC(iteminfo)
count = MAX_SEARCH;
}
for (i = 0; i < count; i++) {
item_data = item_array[i];
struct item_data * item_data = item_array[i];
sprintf(atcmd_output, msg_txt(sd,1277), // Item: '%s'/'%s'[%d] (%d) Type: %s | Extra Effect: %s
item_data->name,item_data->jname,item_data->slot,item_data->nameid,
(item_data->type != IT_AMMO) ? itemdb_typename((enum item_types)item_data->type) : itemdb_typename_ammo((enum e_item_ammo)item_data->look),
@ -7548,7 +7553,7 @@ ACMD_FUNC(whodrops)
ACMD_FUNC(whereis)
{
struct mob_db *mob, *mob_array[MAX_SEARCH];
struct mob_db *mob_array[MAX_SEARCH];
int count;
int i, j, k;
@ -7576,7 +7581,7 @@ ACMD_FUNC(whereis)
count = MAX_SEARCH;
}
for (k = 0; k < count; k++) {
mob = mob_array[k];
struct mob_db *mob = mob_array[k];
snprintf(atcmd_output, sizeof atcmd_output, msg_txt(sd,1289), mob->jname); // %s spawns in:
clif_displaymessage(fd, atcmd_output);
@ -9230,8 +9235,6 @@ ACMD_FUNC(channel) {
ACMD_FUNC(fontcolor)
{
unsigned char k;
if( !message || !*message ) {
channel_display_list(sd,"colors");
return -1;
@ -9240,6 +9243,7 @@ ACMD_FUNC(fontcolor)
if( strcmpi(message,"Normal") == 0 ) {
sd->fontcolor = 0;
} else {
unsigned char k;
ARR_FIND(0,Channel_Config.colors_count,k,( strcmpi(message,Channel_Config.colors_name[k]) == 0 ));
if( k == Channel_Config.colors_count ) {
sprintf(atcmd_output, msg_txt(sd,1411), message);// Unknown color '%s'.
@ -9804,7 +9808,7 @@ static void atcommand_get_suggestions(struct map_session_data* sd, const char *n
bool is_atcommand(const int fd, struct map_session_data* sd, const char* message, int type)
{
char charname[NAME_LENGTH], params[100];
char charname2[NAME_LENGTH], params2[100];
char charname2[NAME_LENGTH];
char command[100];
char output[CHAT_SIZE_MAX];
@ -9848,6 +9852,7 @@ bool is_atcommand(const int fd, struct map_session_data* sd, const char* message
if (*message == charcommand_symbol) {
do {
int x, y, z;
char params2[100];
//Checks to see if #command has a name or a name + parameters.
x = sscanf(message, "%99s \"%23[^\"]\" %99[^\n]", command, charname, params);

View File

@ -3847,9 +3847,10 @@ struct Damage battle_attack_sc_bonus(struct Damage wd, struct block_list *src, u
{
struct map_session_data *sd = BL_CAST(BL_PC, src);
struct status_change *sc = status_get_sc(src);
int chorusbonus = 0, type;
int chorusbonus = 0;
if( sd ) {
int type;
// Minstrel/Wanderer number check for chorus skills.
// Bonus remains 0 unless 3 or more Minstrels/Wanderers are in the party.
if( sd->status.party_id ) {

View File

@ -1500,7 +1500,7 @@ int clif_homskillinfoblock(struct map_session_data *sd)
{ //[orn]
struct homun_data *hd;
int fd = sd->fd;
int i,j,len=4,id;
int i,j,len=4;
WFIFOHEAD(fd, 4+37*MAX_HOMUNSKILL);
hd = sd->hd;
@ -1509,7 +1509,8 @@ int clif_homskillinfoblock(struct map_session_data *sd)
WFIFOW(fd,0)=0x235;
for ( i = 0; i < MAX_HOMUNSKILL; i++){
if( (id = hd->homunculus.hskill[i].id) != 0 ){
int id = hd->homunculus.hskill[i].id;
if( id != 0 ){
int combo = (hd->homunculus.hskill[i].flag)&SKILL_FLAG_TMP_COMBO;
j = id - HM_SKILLBASE;
WFIFOW(fd,len ) = id;

View File

@ -5160,6 +5160,32 @@ int pc_memo(struct map_session_data* sd, int pos)
//
// Skills
//
/**
* Get the skill current cooldown for player.
* (get the db base cooldown for skill + player specific cooldown)
* @param sd : player pointer
* @param id : skill id
* @param lv : skill lv
* @return player skill cooldown
*/
int pc_get_skillcooldown(struct map_session_data *sd, int id, int lv) {
int i, cooldown=0;
int idx = skill_get_index (id);
int cooldownlen = ARRAYLENGTH(sd->skillcooldown);
if (!idx) return 0;
if (skill_db[idx].cooldown[lv - 1])
cooldown = skill_db[idx].cooldown[lv - 1];
ARR_FIND(0, cooldownlen, i, sd->skillcooldown[i].id == id);
if(i<cooldownlen){
cooldown += sd->skillcooldown[i].val;
cooldown = max(0,cooldown);
}
return cooldown;
}
/*==========================================
* Return player sd skill_lv learned for given skill
*------------------------------------------*/

View File

@ -826,6 +826,7 @@ int pc_isequip(struct map_session_data *sd,int n);
int pc_equippoint(struct map_session_data *sd,int n);
int pc_setinventorydata(struct map_session_data *sd);
int pc_get_skillcooldown(struct map_session_data *sd, int id, int lv);
int pc_checkskill(struct map_session_data *sd,uint16 skill_id);
short pc_checkequip(struct map_session_data *sd,int pos);
bool pc_checkequip2(struct map_session_data *sd,int nameid,int min, int max);

View File

@ -9151,7 +9151,7 @@ BUILDIN_FUNC(monster)
for(i=0; i<amount; i++){ //not optimised
int mobid = mob_once_spawn(sd, m, x, y, str, class_, 1, event, size, ai);
mapreg_setreg(reference_uid(add_str("$@mobid"), i),mobid);
if(mobid) mapreg_setreg(reference_uid(add_str("$@mobid"), i),mobid);
}
return SCRIPT_CMD_SUCCESS;
}

View File

@ -250,28 +250,6 @@ int skill_tree_get_max(uint16 skill_id, int b_class)
else
return skill_get_max(skill_id);
}
int skill_get_cooldown_(struct map_session_data *sd, int id, int lv) {
int i, cooldown;
int idx = skill_get_index (id);
if (!idx) return 0;
cooldown = 0;
if (skill_db[idx].cooldown[lv - 1])
cooldown = skill_db[idx].cooldown[lv - 1];
for (i = 0; i < ARRAYLENGTH(sd->skillcooldown) && sd->skillcooldown[i].id; i++) {
if (sd->skillcooldown[i].id == id) {
cooldown += sd->skillcooldown[i].val;
if (cooldown < 0)
cooldown = 0;
break;
}
}
return cooldown;
}
int skill_frostjoke_scream(struct block_list *bl,va_list ap);
int skill_check_target_c_marker(struct block_list *bl,va_list ap);
int skill_attack_area(struct block_list *bl,va_list ap);
@ -3634,18 +3612,17 @@ static int skill_timerskill(int tid, unsigned int tick, int id, intptr_t data)
* Warlock
**/
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
if( skl->type < (4 + skl->skill_lv - 1) && skl->x < 3 )
{ // Remaining Chains Hit
struct block_list *nbl = NULL; // Next Target of Chain
nbl = battle_getenemyarea(src, target->x, target->y, (skl->type>2)?2:3, // After 2 bounces, it will bounce to other targets in 7x7 range.
BL_CHAR|BL_SKILL, target->id); // Search for a new Target around current one...
if( nbl == NULL )
skl->x++;
else
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);
}
}
@ -4946,13 +4923,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint
sd->ud.canact_tick = tick + skill_delayfix(src, skill_id, skill_lv);
clif_status_change(src, SI_ACTIONDELAY, 1, skill_delayfix(src, skill_id, skill_lv), 0, 0, 0);
cooldown = skill_get_cooldown(skill_id, skill_lv);
for (i = 0; i < ARRAYLENGTH(sd->skillcooldown) && sd->skillcooldown[i].id; i++) {
if( sd->skillcooldown[i].id == skill_id ) {
cooldown += sd->skillcooldown[i].val;
break;
}
}
cooldown = pc_get_skillcooldown(sd,skill_id, skill_lv);
if( cooldown )
skill_blockpc_start(sd, skill_id, cooldown);
}
@ -10345,7 +10316,7 @@ int skill_castend_id(int tid, unsigned int tick, int id, intptr_t data)
if( !sd || sd->skillitem != ud->skill_id || skill_get_delay(ud->skill_id,ud->skill_lv) )
ud->canact_tick = tick + skill_delayfix(src, ud->skill_id, ud->skill_lv); //Tests show wings don't overwrite the delay but skill scrolls do. [Inkfish]
if (sd) { //Cooldown application
int cooldown = skill_get_cooldown_(sd,ud->skill_id, ud->skill_lv); // Increases/Decreases cooldown of a skill by item/card bonuses.
int cooldown = pc_get_skillcooldown(sd,ud->skill_id, ud->skill_lv); // Increases/Decreases cooldown of a skill by item/card bonuses.
if(cooldown) skill_blockpc_start(sd, ud->skill_id, cooldown);
}
if( battle_config.display_status_timers && sd )
@ -10571,7 +10542,7 @@ int skill_castend_pos(int tid, unsigned int tick, int id, intptr_t data)
if( !sd || sd->skillitem != ud->skill_id || skill_get_delay(ud->skill_id,ud->skill_lv) )
ud->canact_tick = tick + skill_delayfix(src, ud->skill_id, ud->skill_lv);
if (sd) { //Cooldown application
int cooldown = skill_get_cooldown_(sd,ud->skill_id, ud->skill_lv);
int cooldown = pc_get_skillcooldown(sd,ud->skill_id, ud->skill_lv);
if(cooldown) skill_blockpc_start(sd, ud->skill_id, cooldown);
}
if( battle_config.display_status_timers && sd )
@ -15590,7 +15561,7 @@ void skill_weaponrefine (struct map_session_data *sd, int idx)
if(item->nameid > 0 && ditem->type == IT_WEAPON)
{
int i = 0, ep = 0, per;
int i = 0, per;
int material[5] = { 0, ITEMID_PHRACON, ITEMID_EMVERETARCON, ITEMID_ORIDECON, ITEMID_ORIDECON, };
if( ditem->flag.no_refine ) { // if the item isn't refinable
clif_skill_fail(sd,sd->menuskill_id,USESKILL_FAIL_LEVEL,0);
@ -15612,6 +15583,7 @@ void skill_weaponrefine (struct map_session_data *sd, int idx)
pc_delitem(sd, i, 1, 0, 0, LOG_TYPE_OTHER);
if (per > rnd() % 100) {
int ep=0;
log_pick_pc(sd, LOG_TYPE_OTHER, -1, item);
item->refine++;
log_pick_pc(sd, LOG_TYPE_OTHER, 1, item);