Untitled

 avatar
unknown
plain_text
8 days ago
2.2 kB
6
Indexable
bool clif_skill_nodamage(struct block_list *src, struct block_list *dst, uint16 skill_id, int heal, t_tick tick)
{
    unsigned char buf[17];
#if PACKETVER < 20130731
    const int cmd = 0x11a;
#else
    const int cmd = 0x9cb;
#endif
    int offset = 0;
    bool success = (tick != 0);

    nullpo_ret(dst);

    // Detectar si la habilidad proviene de un ítem
    bool from_item = (src == dst);

    // Evitar la animación si es un item skill
    if (!from_item) {
        switch (skill_id) {
            case BS_ADRENALINE:
                clif_specialeffect(dst, 98, AREA); break;
            case BS_OVERTHRUST:
                clif_specialeffect(dst, 128, AREA); break;
            case BS_WEAPONPERFECT:
                clif_specialeffect(dst, 103, AREA); break;
            case SN_WINDWALK:
                clif_specialeffect(dst, 389, AREA); break;
            case PR_KYRIE:
                clif_specialeffect(dst, 112, AREA); break;
            case TF_HIDING:
                clif_specialeffect(dst, 16, AREA); break;
            case PR_GLORIA:
                clif_specialeffect(dst, 75, AREA); break;
            case AL_ANGELUS:
                clif_specialeffect(dst, 41, AREA); break;
            default:
                break;
        }
    }

    // Construcción del paquete
    WBUFW(buf, 0) = cmd;
    WBUFW(buf, 2) = skill_id;
#if PACKETVER < 20130731
    WBUFW(buf, 4) = min(heal, INT16_MAX);
#else
    WBUFL(buf, 4) = min(heal, INT32_MAX);
    offset += 2;
#endif
    WBUFL(buf, 6 + offset) = dst->id;
    WBUFL(buf, 10 + offset) = from_item ? 0 : (src ? src->id : 0);
    WBUFB(buf, 14 + offset) = success;

    if (disguised(dst)) {
        clif_send(buf, packet_len(cmd), dst, AREA_WOS);
        WBUFL(buf, 6 + offset) = disguised_bl_id(dst->id);
        clif_send(buf, packet_len(cmd), dst, SELF);
    } else {
        clif_send(buf, packet_len(cmd), dst, AREA);
    }

    if (src && disguised(src)) {
        WBUFL(buf, 10 + offset) = disguised_bl_id(src->id);
        if (disguised(dst))
            WBUFL(buf, 6 + offset) = dst->id;
        clif_send(buf, packet_len(cmd), src, SELF);
    }

    return success;
}
Editor is loading...
Leave a Comment