EVENTFUNC(dead_event)
{
const SCharDeadEventInfo* info = dynamic_cast<SCharDeadEventInfo*>(event->info);
if ( info == NULL )
{
sys_err( "dead_event> <Factor> NULL pointer" );
return 0;
}
LPCHARACTER ch = NULL;
if (true == info->isPC)
{
ch = CHARACTER_MANAGER::instance().FindByPID( info->dwID );
}
else
{
ch = CHARACTER_MANAGER::instance().Find( info->dwID );
}
if (NULL == ch)
{
sys_err("DEAD_EVENT: cannot find char pointer with %s id(%d)", info->isPC ? "PC" : "MOB", info->dwID );
return 0;
}
if ((ch->GetRaceNum() == (WORD)(MeleyLair::STATUE_VNUM)) && !ch->IsPC())
return 0;
ch->m_pkDeadEvent = NULL;
if (ch->GetDesc())
{
ch->GetDesc()->SetPhase(PHASE_GAME);
ch->SetPosition(POS_STANDING);
#ifdef __AUTO_HUNT__
if (ch->IsAutoHuntActive())
{
ch->RestartAtSamePos();
ch->PointChange(POINT_HP, ch->GetMaxHP() - ch->GetHP());
ch->PointChange(POINT_SP, ch->GetMaxSP() - ch->GetSP());
ch->ReviveInvisible(5);
#ifdef _MOUNT_SYSTEM
ch->CheckMount();
#endif
}
else
#endif
{
PIXEL_POSITION pos;
if (SECTREE_MANAGER::instance().GetRecallPositionByEmpire(ch->GetMapIndex(), ch->GetEmpire(), pos))
{
ch->ChatPacket(CHAT_TYPE_COMMAND, "AutoChatStopped");
ch->WarpSet(pos.x, pos.y);
}
else
{
sys_err("cannot find spawn position (name %s)", ch->GetName());
ch->ChatPacket(CHAT_TYPE_COMMAND, "AutoChatStopped");
ch->WarpSet(EMPIRE_START_X(ch->GetEmpire()), EMPIRE_START_Y(ch->GetEmpire()));
}
ch->PointChange(POINT_HP, (ch->GetMaxHP() / 2) - ch->GetHP(), true);
ch->DeathPenalty(0);
}
ch->StartRecoveryEvent();
ch->ChatPacket(CHAT_TYPE_COMMAND, "CloseRestartWindow");
}
else
{
// if (ch->IsMonster() == true)
// {
// if (ch->IsRevive() == false && ch->HasReviverInParty() == true)
// {
// ch->SetPosition(POS_STANDING);
// ch->SetHP(ch->GetMaxHP());
// ch->ViewReencode();
// ch->SetAggressive();
// ch->SetRevive(true);
// return 0;
// }
// // M2_DELETE(ch);
// // return 0;
// }
M2_DESTROY_CHARACTER(ch);
// M2_DELETE(ch);
}
return 0;
}