예제 #1
0
void SkillRecv::processSkillProduceMixList(Net::MessageIn &msg)
{
    UNIMPLEMENTEDPACKET;

    const int count = (msg.readInt16("len") - 4) / 4 * itemIdLen;
    for (int f = 0; f < count; f ++)
    {
        msg.readItemId("item id");
        for (int d = 0; d < 3; d ++)
            msg.readItemId("material id");
    }
}
예제 #2
0
void SkillRecv::processSkillProduceEffect(Net::MessageIn &msg)
{
    UNIMPLEMENTEDPACKET;

    msg.readInt16("flag");
    msg.readItemId("item id");
}
예제 #3
0
void SkillRecv::processSkillArrowCreateList(Net::MessageIn &msg)
{
    UNIMPLEMENTEDPACKET;

    const int count = (msg.readInt16("len") - 4) / itemIdLen;
    for (int f = 0; f < count; f ++)
        msg.readItemId("item id");
}
예제 #4
0
void SkillRecv::processSkillFailed(Net::MessageIn &msg)
{
    // Action failed (ex. sit because you have not reached the
    // right level)
    const int skillId = msg.readInt16("skill id");
    const int bskill  = msg.readItemId("btype");
    const int itemId  = msg.readItemId("item id");
    const signed char success = msg.readUInt8("success");
    const signed char reason  = msg.readUInt8("reason");
    if (success != CAST_S32(SKILL_FAILED)
        && bskill == CAST_S32(BSKILL_EMOTE))
    {
        logger->log("Action: %d/%d", bskill, success);
    }

    if (localPlayer != nullptr)
        localPlayer->stopCast(true);
    std::string txt;
    if (success == CAST_S32(SKILL_FAILED) && bskill != 0)
    {
        if ((localPlayer != nullptr) && bskill == CAST_S32(BSKILL_EMOTE)
            && reason == CAST_S32(RFAIL_SKILLDEP))
        {
            localPlayer->stopAdvert();
        }

        const SkillInfo *const info = skillDialog->getSkill(bskill);
        if (info != nullptr)
        {
            txt = info->errorText;
        }
        else
        {
            // TRANSLATORS: skill error message
            txt = strprintf(_("Unknown skill error: %d"), bskill);
        }
    }
    else
    {
        const SkillInfo *const info = skillDialog->getSkill(skillId);
        if (info != nullptr)
        {
            txt = info->errorText + ".";
        }
        else
        {
            // TRANSLATORS: skill error message
            txt = strprintf(_("Unknown skill error: %d."), skillId);
        }
    }

    txt.append(" ");
    switch (reason)
    {
        case RFAIL_SKILLDEP:
            // TRANSLATORS: error message
            txt.append(_("You have not yet reached a high enough lvl!"));
            break;
        case RFAIL_INSUFHP:
            // TRANSLATORS: error message
            txt.append(_("Insufficient HP!"));
            break;
        case RFAIL_INSUFSP:
            // TRANSLATORS: error message
            txt.append(_("Insufficient SP!"));
            break;
        case RFAIL_NOMEMO:
            // TRANSLATORS: error message
            txt.append(_("You have no memos!"));
            break;
        case RFAIL_SKILLDELAY:
            // TRANSLATORS: error message
            txt.append(_("You cannot do that right now!"));
            break;
        case RFAIL_ZENY:
            // TRANSLATORS: error message
            txt.append(_("Seems you need more money... ;-)"));
            break;
        case RFAIL_WEAPON:
            // TRANSLATORS: error message
            txt.append(_("You cannot use this skill with that "
                "kind of weapon!"));
            break;
        case RFAIL_REDGEM:
            // TRANSLATORS: error message
            txt.append(_("You need another red gem!"));
            break;
        case RFAIL_BLUEGEM:
            // TRANSLATORS: error message
            txt.append(_("You need another blue gem!"));
            break;
        case RFAIL_OVERWEIGHT:
            // TRANSLATORS: error message
            txt.append(_("You're carrying to much to do this!"));
            break;
        case RFAIL_SUMMON:
            // TRANSLATORS: error message
            txt.append(_("Fail summon."));
            break;
        case RFAIL_SPIRITS:
            // TRANSLATORS: error message
            txt.append(_("Need spirits."));
            break;
        case RFAIL_NEED_EQUIPMENT:
        {
            const int amount = bskill;
            const ItemInfo &info = ItemDB::get(itemId);
            if (amount == 1)
            {
                // TRANSLATORS: skill error message
                txt.append(strprintf(_("Need equipment %s."),
                    info.getLink().c_str()));
            }
            else
            {
                // TRANSLATORS: skill error message
                txt.append(strprintf(_("Need equipment %s and amount %d"),
                    info.getLink().c_str(),
                    amount));
            }
            break;
        }
        case RFAIL_NEED_ITEM:
        {
            const int amount = bskill;
            const ItemInfo &info = ItemDB::get(itemId);
            if (amount == 1)
            {
                // TRANSLATORS: skill error message
                txt.append(strprintf(_("Need item %s."),
                    info.getLink().c_str()));
            }
            else
            {
                // TRANSLATORS: skill error message
                txt.append(strprintf(_("Need item %s and amount %d"),
                    info.getLink().c_str(),
                    amount));
            }
            break;
        }
        case RFAIL:
        {
            // TRANSLATORS: error message
            txt.append(_("Skill failed!"));
            break;
        }

        default:
            UNIMPLEMENTEDPACKETFIELD(reason);
            break;
    }

    NotifyManager::notify(NotifyTypes::SKILL_FAIL_MESSAGE, txt);
}