neotokyo
11-15-2002, 11:35 AM
add this function somewhere in the attack.cpp
// neotokyo 14-Nov-02
// Helperfunction to check for Lifetaps
bool IsLifetapSpell(int16 spell_id)
{
// filter out invalid spell_ids
if (spell_id <= 0 || spell_id >= 0xffff)
return false;
// if database says its a tap, i am sure its right
if (spells[spell_id].targettype == ST_Tap)
return true;
// now check some additional lifetaps just to make sure
// i.e. lifebane isnt recognized since type == target not tap
switch(spell_id)
{
case 1613:
case 341:
case 445:
case 502:
case 447:
case 525:
case 2115: // Ancient: Lifebane
case 446:
case 524:
case 1618:
case 1393: // Gangrenous touch of zu'muul
case 1735: // trucidation
return true;
}
return false;
}
add this snippet of code into the same file, into function
"NPC:Damage" just before the check for Death (1st return in the function) and after the "was hit by non melee" message.
// if spell is lifetap add hp to the caster
if (other && IsLifetapSpell( spell_id ))
{
int32 healedhp;
// check if healing would be greater than max hp
// use temp var to store actual healing value
if ( other->GetHP() + damage > other->GetMaxHP())
{
healedhp = other->GetMaxHP() - other->GetHP();
other->SetHP(other->GetMaxHP());
}
else
{
healedhp = damage;
other->SetHP(other->GetHP() + damage);
}
// not sure if i need to send this or not. didnt hurt yet though ;-)
APPLAYER hp_app;
other->CreateHPPacket(&hp_app);
// if client was casting the spell there need to be some messages
if (other->IsClient())
{
other->CastToClient()->Message(4,"You have been healed for %d points of damage.", healedhp);
other->CastToClient()->QueuePacket(&hp_app);
}
// emote goes with every one ... even npcs
entity_list.MessageClose(this, true, 300, MT_Emote, "%s beams a smile at %s", other->GetName(), this->GetName() );
entity_list.QueueCloseClients(this, &hp_app, false, 600, other);
}
and remove these lines of code in the same function -> obsolete
else if (attack_skill == 0x231)
{
if (spell_id != 0xFFFF && spell_id != 0)
{
if (spells[spell_id].targettype == ST_Tap)
{
other->SetHP(GetHP() + damage);
}
}
}
this doesnt cover PVP yet (i guess - couldnt test it cause no one joined my test server ;-) just normal Player vs Mobs Combat, but should include lifetap procs
have fun...
// neotokyo 14-Nov-02
// Helperfunction to check for Lifetaps
bool IsLifetapSpell(int16 spell_id)
{
// filter out invalid spell_ids
if (spell_id <= 0 || spell_id >= 0xffff)
return false;
// if database says its a tap, i am sure its right
if (spells[spell_id].targettype == ST_Tap)
return true;
// now check some additional lifetaps just to make sure
// i.e. lifebane isnt recognized since type == target not tap
switch(spell_id)
{
case 1613:
case 341:
case 445:
case 502:
case 447:
case 525:
case 2115: // Ancient: Lifebane
case 446:
case 524:
case 1618:
case 1393: // Gangrenous touch of zu'muul
case 1735: // trucidation
return true;
}
return false;
}
add this snippet of code into the same file, into function
"NPC:Damage" just before the check for Death (1st return in the function) and after the "was hit by non melee" message.
// if spell is lifetap add hp to the caster
if (other && IsLifetapSpell( spell_id ))
{
int32 healedhp;
// check if healing would be greater than max hp
// use temp var to store actual healing value
if ( other->GetHP() + damage > other->GetMaxHP())
{
healedhp = other->GetMaxHP() - other->GetHP();
other->SetHP(other->GetMaxHP());
}
else
{
healedhp = damage;
other->SetHP(other->GetHP() + damage);
}
// not sure if i need to send this or not. didnt hurt yet though ;-)
APPLAYER hp_app;
other->CreateHPPacket(&hp_app);
// if client was casting the spell there need to be some messages
if (other->IsClient())
{
other->CastToClient()->Message(4,"You have been healed for %d points of damage.", healedhp);
other->CastToClient()->QueuePacket(&hp_app);
}
// emote goes with every one ... even npcs
entity_list.MessageClose(this, true, 300, MT_Emote, "%s beams a smile at %s", other->GetName(), this->GetName() );
entity_list.QueueCloseClients(this, &hp_app, false, 600, other);
}
and remove these lines of code in the same function -> obsolete
else if (attack_skill == 0x231)
{
if (spell_id != 0xFFFF && spell_id != 0)
{
if (spells[spell_id].targettype == ST_Tap)
{
other->SetHP(GetHP() + damage);
}
}
}
this doesnt cover PVP yet (i guess - couldnt test it cause no one joined my test server ;-) just normal Player vs Mobs Combat, but should include lifetap procs
have fun...