10-28-2025, 11:58 PM
//skill.cpp
bool CSkill::IsReady(CCharacter* ch)
{
if (m_state != SKILL_CON_NORMAL)
return false;
if (m_proto == NULL)
return false;
float reusetime = m_proto->m_reuseTime;
// À̺κР¼öÁ¤Çϰí...
// fix bug delay coodown by apolo
#if defined(BUGFIX_GUILD_SKILL_COOLTIME) || defined(SKILL_TYPE_NO_COOL_TIME)
if (1
#ifdef BUGFIX_GUILD_SKILL_COOLTIME
&& !(m_proto->m_flag & SF_GUILD)
#endif
#ifdef SKILL_TYPE_NO_COOL_TIME
&& !(m_proto->m_applyState & SCT_NO_COOL_TIME)
#endif
)
#endif // defined(BUGFIX_GUILD_SKILL_COOLTIME || SKILL_TYPE_NO_COOL_TIME)
reusetime += ch->m_magicSpeed;
if (IS_PC(ch))
{
CPC* pPC = TO_PC(ch);
if (pPC->m_opDecreaseSkillDelay > 0 || pPC->m_skillCooltime != 0)
{
int prob = pPC->m_opDecreaseSkillDelay;
#if defined(BUGFIX_GUILD_SKILL_COOLTIME) || defined(SKILL_TYPE_NO_COOL_TIME)
if (1
#ifdef BUGFIX_GUILD_SKILL_COOLTIME
&& !(m_proto->m_flag & SF_GUILD)
#endif
#ifdef SKILL_TYPE_NO_COOL_TIME
&& !(m_proto->m_applyState & SCT_NO_COOL_TIME)
#endif
)
#endif // defined(BUGFIX_GUILD_SKILL_COOLTIME || SKILL_TYPE_NO_COOL_TIME)
{
// Aplicar reducción lineal
reusetime -= reusetime * (prob) / 100;
// ==========================================
// PROTECTION: Negative cooldown
// ==========================================
if (reusetime < 0)
reusetime = 0;
}
}
}
if (IS_ELEMENTAL(ch))
{
CElemental* pEle = TO_ELEMENTAL(ch);
if (pEle->GetOwner()->m_opDecreaseSkillDelay > 0 || pEle->GetOwner()->m_skillCooltime != 0)
{
int prob = pEle->GetOwner()->m_opDecreaseSkillDelay + pEle->GetOwner()->m_skillCooltime;
// Aplicar reducción
reusetime -= reusetime * (prob) / 100;
// Cooldown mínimo para elementales
if (reusetime <= 0)
reusetime = 0.1;
}
}
if (IS_APET(ch))
{
reusetime = reusetime / 100;
}
//ÇØ´ç ½ºÅ³ÀÌ ±æµå ½ºÅ³ÀÎ °æ¿ì
if (this->m_proto->m_flag & SF_GUILD)
{
//À¯Àú
if (IS_PC(ch))
{
CPC* pc = TO_PC(ch);
if (pc->m_guildInfo == NULL)
{
//��ŷ�õ� ���� ����
LOG_ERROR("HACKING? : invalid skill guildinfo. char_index[%d], skill_index[%d]", pc->m_index, this->m_proto->m_index);
pc->m_desc->Close("Invalid guildInfo");
return false;
}
GUILD_SKILL_USETIME_DATA::iterator it = m_gskill_usetime.find(pc->m_index);
if (it == m_gskill_usetime.end())
{
//������
return true;
}
else
{
//������
if (gserver->m_pulse - it->second < reusetime)
return false;
}
}
}
else
{
if (m_usetime > 0)
{
if (IS_PC(ch)) {
if (gserver->m_pulse - m_usetime < reusetime)
return false;
}
else {
if (gserver->m_pulse - m_usetime < reusetime)
return false;
}
}
}
return true;
}
/myinfoskill.cpp
DOUBLE MyInfoSkill::GetReuseSkill(int nIndex)
{
CSkill& rSkill = _pNetwork->GetSkillData(nIndex);
int nCoolTimeReductionRate = 0;
DOUBLE dCoolTime = 0.0;
DOUBLE dReuseTime = 0.0;
int nReuseTime = 0;
if (rSkill.GetJob() != PET_JOB && rSkill.GetJob() != WILDPET_JOB &&
!(rSkill.GetFlag() & SF_GUILD))
{
// ½ºÅ³ ÄðŸÀÓ ¿É¼ÇÀº ij¸¯ÅÍ¿¡°Ô¸¸ ºÙ´Â´Ù.
if (!(rSkill.Skill_Data.appState & SCT_NOCOOLTIME))
{
nCoolTimeReductionRate = UIMGR()->GetCoolTimeReductionRate();
dCoolTime = 1.0 - (DOUBLE(nCoolTimeReductionRate) / 100.0); //fix 100%
if (dCoolTime < 0.0)
dCoolTime = 0.0;
}
}
if (rSkill.GetReUseTime())
{
dReuseTime = DOUBLE(rSkill.GetReUseTime() + _pNetwork->MyCharacterInfo.magicspeed) / 10.0 * (nCoolTimeReductionRate ? dCoolTime : 1);
return dReuseTime;
}
return 0.0;
}
__int64 MyInfoSkill::GetUseItem( int nIndex )
{
map_useItem_iter iter = m_mapUseItem.find(nIndex);
if (iter != m_mapUseItem.end())
return iter->second;
return 0;
}
bool CSkill::IsReady(CCharacter* ch)
{
if (m_state != SKILL_CON_NORMAL)
return false;
if (m_proto == NULL)
return false;
float reusetime = m_proto->m_reuseTime;
// À̺κР¼öÁ¤Çϰí...
// fix bug delay coodown by apolo
#if defined(BUGFIX_GUILD_SKILL_COOLTIME) || defined(SKILL_TYPE_NO_COOL_TIME)
if (1
#ifdef BUGFIX_GUILD_SKILL_COOLTIME
&& !(m_proto->m_flag & SF_GUILD)
#endif
#ifdef SKILL_TYPE_NO_COOL_TIME
&& !(m_proto->m_applyState & SCT_NO_COOL_TIME)
#endif
)
#endif // defined(BUGFIX_GUILD_SKILL_COOLTIME || SKILL_TYPE_NO_COOL_TIME)
reusetime += ch->m_magicSpeed;
if (IS_PC(ch))
{
CPC* pPC = TO_PC(ch);
if (pPC->m_opDecreaseSkillDelay > 0 || pPC->m_skillCooltime != 0)
{
int prob = pPC->m_opDecreaseSkillDelay;
#if defined(BUGFIX_GUILD_SKILL_COOLTIME) || defined(SKILL_TYPE_NO_COOL_TIME)
if (1
#ifdef BUGFIX_GUILD_SKILL_COOLTIME
&& !(m_proto->m_flag & SF_GUILD)
#endif
#ifdef SKILL_TYPE_NO_COOL_TIME
&& !(m_proto->m_applyState & SCT_NO_COOL_TIME)
#endif
)
#endif // defined(BUGFIX_GUILD_SKILL_COOLTIME || SKILL_TYPE_NO_COOL_TIME)
{
// Aplicar reducción lineal
reusetime -= reusetime * (prob) / 100;
// ==========================================
// PROTECTION: Negative cooldown
// ==========================================
if (reusetime < 0)
reusetime = 0;
}
}
}
if (IS_ELEMENTAL(ch))
{
CElemental* pEle = TO_ELEMENTAL(ch);
if (pEle->GetOwner()->m_opDecreaseSkillDelay > 0 || pEle->GetOwner()->m_skillCooltime != 0)
{
int prob = pEle->GetOwner()->m_opDecreaseSkillDelay + pEle->GetOwner()->m_skillCooltime;
// Aplicar reducción
reusetime -= reusetime * (prob) / 100;
// Cooldown mínimo para elementales
if (reusetime <= 0)
reusetime = 0.1;
}
}
if (IS_APET(ch))
{
reusetime = reusetime / 100;
}
//ÇØ´ç ½ºÅ³ÀÌ ±æµå ½ºÅ³ÀÎ °æ¿ì
if (this->m_proto->m_flag & SF_GUILD)
{
//À¯Àú
if (IS_PC(ch))
{
CPC* pc = TO_PC(ch);
if (pc->m_guildInfo == NULL)
{
//��ŷ�õ� ���� ����
LOG_ERROR("HACKING? : invalid skill guildinfo. char_index[%d], skill_index[%d]", pc->m_index, this->m_proto->m_index);
pc->m_desc->Close("Invalid guildInfo");
return false;
}
GUILD_SKILL_USETIME_DATA::iterator it = m_gskill_usetime.find(pc->m_index);
if (it == m_gskill_usetime.end())
{
//������
return true;
}
else
{
//������
if (gserver->m_pulse - it->second < reusetime)
return false;
}
}
}
else
{
if (m_usetime > 0)
{
if (IS_PC(ch)) {
if (gserver->m_pulse - m_usetime < reusetime)
return false;
}
else {
if (gserver->m_pulse - m_usetime < reusetime)
return false;
}
}
}
return true;
}
/myinfoskill.cpp
DOUBLE MyInfoSkill::GetReuseSkill(int nIndex)
{
CSkill& rSkill = _pNetwork->GetSkillData(nIndex);
int nCoolTimeReductionRate = 0;
DOUBLE dCoolTime = 0.0;
DOUBLE dReuseTime = 0.0;
int nReuseTime = 0;
if (rSkill.GetJob() != PET_JOB && rSkill.GetJob() != WILDPET_JOB &&
!(rSkill.GetFlag() & SF_GUILD))
{
// ½ºÅ³ ÄðŸÀÓ ¿É¼ÇÀº ij¸¯ÅÍ¿¡°Ô¸¸ ºÙ´Â´Ù.
if (!(rSkill.Skill_Data.appState & SCT_NOCOOLTIME))
{
nCoolTimeReductionRate = UIMGR()->GetCoolTimeReductionRate();
dCoolTime = 1.0 - (DOUBLE(nCoolTimeReductionRate) / 100.0); //fix 100%
if (dCoolTime < 0.0)
dCoolTime = 0.0;
}
}
if (rSkill.GetReUseTime())
{
dReuseTime = DOUBLE(rSkill.GetReUseTime() + _pNetwork->MyCharacterInfo.magicspeed) / 10.0 * (nCoolTimeReductionRate ? dCoolTime : 1);
return dReuseTime;
}
return 0.0;
}
__int64 MyInfoSkill::GetUseItem( int nIndex )
{
map_useItem_iter iter = m_mapUseItem.find(nIndex);
if (iter != m_mapUseItem.end())
return iter->second;
return 0;
}

