Post Pacific  

Go Back   Post Pacific > Lineage 2 > Lineage 2 Help
FAQ Community Calendar Today's Posts Search

Notices

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old 29.06.2009, 21:02   #2
FidoW
Guest
 
Posts: n/a
Default newbie dev help :D

COPCondition_have_debuff::foundDebuff is wrong, id is going to take always the last skill_id so you are going to be really lucky if anytime return true.

Something like this would be better.

bool COPCondition_have_debuff::foundDebuff(CCreature *pCreature, int nSkillID){

for(int i=0;i<pCreature->vBuff.size();i++) {

if(nSkillID == pCreature->vBuff[i].pSkillInfo->skill_id)

return true;

}

return false;

}

Also "bool COPCondition_have_debuff::CanUse" isn't checking for valid target, your checking caster twice, one if is valid user and another if is valid creature, and if is valid user.. is valid creature you know, also no need to write so much extra code, try something so simple like this:

bool COPCondition_have_debuff::CanUse(CCreature *pSkillUser, CObject *pTargetObject)

{

L2SERVER_SHARED_GUARD(nCOPCondition_have_abnormal) ;

TLS_TRACE_BEGIN;

bool bResult = false;

User *pCaster = (User*)pSkillUser;

CCreature *pTarget = (CCreature*)pTargetObject;

if(pCaster->IsValidUser() && pTarget->IsValidCreature())

bResult = foundDebuff(pTarget, debuff);

TLS_TRACE_END;

return bResult;

};

I would suggest you also to use correct names for the pointers like "pCaster" and "pTarget" and the same for double or int values, just to follow the same line all the rest of the extender has been coded.

And please, try to use correct tabulation >.<

Версия форума 2009–2010. Восстановлено из публичного снимка Wayback Machine. Тема могла сохраниться частично. Время показано по часам снимка; часовой пояс не установлен. Дата в снимке: 06-29-2009, 09:02 PM. Открыть источник.
 
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 17:32.