Example #1
0
void Creature::setOutfit(const Outfit& outfit)
{
    if(outfit.getCategory() != ThingCategoryCreature) {
        if(!g_things.isValidDatId(outfit.getAuxId(), outfit.getCategory()))
            return;
        m_outfit.setAuxId(outfit.getAuxId());
        m_outfit.setCategory(outfit.getCategory());
    } else {
        if(outfit.getId() > 0 && !g_things.isValidDatId(outfit.getId(), ThingCategoryCreature))
            return;
        m_outfit = outfit;
    }
    m_walkAnimationPhase = 0; // might happen when player is walking and outfit is changed.
}
Example #2
0
int push_luavalue(const Outfit& outfit)
{
    g_lua.createTable(0, 8);
    g_lua.pushInteger(outfit.getId());
    g_lua.setField("type");
    g_lua.pushInteger(outfit.getAuxId());
    g_lua.setField("auxType");
    if(g_game.getFeature(Otc::GamePlayerAddons)) {
        g_lua.pushInteger(outfit.getAddons());
        g_lua.setField("addons");
    }
    g_lua.pushInteger(outfit.getHead());
    g_lua.setField("head");
    g_lua.pushInteger(outfit.getBody());
    g_lua.setField("body");
    g_lua.pushInteger(outfit.getLegs());
    g_lua.setField("legs");
    g_lua.pushInteger(outfit.getFeet());
    g_lua.setField("feet");
    if(g_game.getFeature(Otc::GamePlayerMounts)) {
        g_lua.pushInteger(outfit.getMount());
        g_lua.setField("mount");
    }
    return 1;
}
void ProtocolGame::sendChangeOutfit(const Outfit& outfit)
{
    OutputMessagePtr msg(new OutputMessage);
    msg->addU8(Proto::ClientChangeOutfit);
    if(g_game.getFeature(Otc::GameLooktypeU16))
        msg->addU16(outfit.getId());
    else
        msg->addU8(outfit.getId());
    msg->addU8(outfit.getHead());
    msg->addU8(outfit.getBody());
    msg->addU8(outfit.getLegs());
    msg->addU8(outfit.getFeet());
    if(g_game.getFeature(Otc::GamePlayerAddons))
        msg->addU8(outfit.getAddons());
    if(g_game.getFeature(Otc::GamePlayerMounts))
        msg->addU16(outfit.getMount());
    send(msg);
}
Example #4
0
void ProtocolGame::sendChangeOutfit(const Outfit& outfit)
{
    OutputMessage msg;
    msg.addU8(Proto::ClientChangeOutfit);

    msg.addU16(outfit.getId());
    msg.addU8(outfit.getHead());
    msg.addU8(outfit.getBody());
    msg.addU8(outfit.getLegs());
    msg.addU8(outfit.getFeet());
    msg.addU8(outfit.getAddons());

    send(msg);
}
void ProtocolGame::sendSetOutfit(const Outfit& outfit)
{
    OutputMessage oMsg;
    oMsg.addU8(Proto::ClientSetOutfit);

    oMsg.addU16(outfit.getId());
    oMsg.addU8(outfit.getHead());
    oMsg.addU8(outfit.getBody());
    oMsg.addU8(outfit.getLegs());
    oMsg.addU8(outfit.getFeet());
    oMsg.addU8(outfit.getAddons());

    send(oMsg);
}