Beispiel #1
0
void PlayerFactory::createRogue(Player* player) const
{
    ItemManager & itemManager = ItemManager::get();

    FAWorld::Item item = itemManager.getBaseItem(121);
    player->mInventory.putItem(item,
                               FAWorld::Item::eqLEFTHAND,
                               FAWorld::Item::eqFLOOR,
                               0, 0, 0, false);

    item = itemManager.getBaseItem(43);
    item.setCount(100);
    player->mInventory.putItem(item,
                               FAWorld::Item::eqINV,
                               FAWorld::Item::eqFLOOR,
                               3, 0, 0,false);

    item = itemManager.getBaseItem(79);
    player->mInventory.putItem(item,
                               FAWorld::Item::eqBELT,
                               FAWorld::Item::eqFLOOR,
                               0, 0, 0, false);

    item = itemManager.getBaseItem(79);
    player->mInventory.putItem(item,
                               FAWorld::Item::eqBELT,
                               FAWorld::Item::eqFLOOR,
                               0, 0, 1, false);

    player->setSpriteClass("rogue");
    player->setIdleAnimation("plrgfx/rogue/rlb/rlbst.cl2");
    player->setWalkAnimation("plrgfx/rogue/rlb/rlbwl.cl2");
}
Beispiel #2
0
void PlayerFactory::createSorcerer(Player* player) const
{
    ItemManager & itemManager = ItemManager::get();

    FAWorld::Item item = itemManager.getBaseItem(124);
    player->mInventory.putItem(item,
                               FAWorld::Item::eqLEFTHAND,
                               FAWorld::Item::eqFLOOR,
                               0, 0, 0, false);

    item = itemManager.getBaseItem(43);
    item.setCount(100);
    player->mInventory.putItem(item,
                               FAWorld::Item::eqINV,
                               FAWorld::Item::eqFLOOR,
                               3, 0, 0, false);

    item = itemManager.getBaseItem(81);
    player->mInventory.putItem(item,
                               FAWorld::Item::eqBELT,
                               FAWorld::Item::eqFLOOR,
                               0, 0, 0, false);

    item = itemManager.getBaseItem(81);
    player->mInventory.putItem(item,
                               FAWorld::Item::eqBELT,
                               FAWorld::Item::eqBELT,
                               0, 0, 1, false);

    player->setSpriteClass("sorceror");
    player->setIdleAnimation("plrgfx/sorceror/slt/sltst.cl2");
    player->setWalkAnimation("plrgfx/sorceror/slt/sltwl.cl2");

}
Beispiel #3
0
void PlayerFactory::createWarrior()
{
    ItemManager & itemManager = ItemManager::get();

    mStats = new FAWorld::MeleeStats(mCharStats, mPlayer);

    FAWorld::Item item = itemManager.getBaseItem(125);
    mPlayer->mInventory.putItem(
                item,
                FAWorld::Item::eqLEFTHAND,
                FAWorld::Item::eqFLOOR,
                0, 0, 0, false);

    item = itemManager.getBaseItem(18);
    mPlayer->mInventory.putItem(
                item,
                FAWorld::Item::eqRIGHTHAND,
                FAWorld::Item::eqFLOOR,
                0, 0, 0, false);

    item = itemManager.getBaseItem(26);
    mPlayer->mInventory.putItem(
                item,
                FAWorld::Item::eqINV,
                FAWorld::Item::eqFLOOR,
                0, 0, 0, false);

    item = itemManager.getBaseItem(43);
    item.setCount(100);
    mPlayer->mInventory.putItem(item,
                               FAWorld::Item::eqINV,
                               FAWorld::Item::eqFLOOR,
                               3, 0, 0, false);

    item = itemManager.getBaseItem(79);
    mPlayer->mInventory.putItem(item,
                               FAWorld::Item::eqBELT,
                               FAWorld::Item::eqFLOOR,
                               0, 0, 0, false);

    item = itemManager.getBaseItem(79);
    mPlayer->mInventory.putItem(item,
                               FAWorld::Item::eqBELT,
                               FAWorld::Item::eqFLOOR,
                               0, 0, 1, false);
    mPlayer->setSpriteClass("warrior");
    mPlayer->setIdleAnimation("plrgfx/warrior/wld/wldst.cl2");
    mPlayer->setWalkAnimation("plrgfx/warrior/wld/wldwl.cl2");
}
Beispiel #4
0
    boost::python::dict FAPythonFuncs::updateInventory()
    {
        boost::python::dict dict, cursorDict, headDict, amuletDict, leftHandDict, rightHandDict, leftRingDict, rightRingDict, bodyDict, itemDict;

        FAWorld::Item cursor = mPlayerInv.getItemAt(FAWorld::Item::eqCURSOR);
        FAWorld::Item head = mPlayerInv.getItemAt(FAWorld::Item::eqHEAD);
        FAWorld::Item amulet = mPlayerInv.getItemAt(FAWorld::Item::eqAMULET);
        FAWorld::Item leftHand = mPlayerInv.getItemAt(FAWorld::Item::eqLEFTHAND);
        FAWorld::Item rightHand = mPlayerInv.getItemAt(FAWorld::Item::eqRIGHTHAND);
        FAWorld::Item leftRing = mPlayerInv.getItemAt(FAWorld::Item::eqLEFTRING);
        FAWorld::Item rightRing = mPlayerInv.getItemAt(FAWorld::Item::eqRIGHTRING);
        FAWorld::Item body = mPlayerInv.getItemAt(FAWorld::Item::eqBODY);

        dict["cursor"] = cursorDict;

        cursorDict["graphic"] = cursor.getGraphicValue();
        cursorDict["empty"] = cursor.isEmpty();
        cursorDict["invX"] = cursor.getInvCoords().first;
        cursorDict["invY"] = cursor.getInvCoords().second;
        cursorDict["real"] = cursor.isReal();
        cursorDict["sizeX"] = cursor.getInvSize().first;
        cursorDict["sizeY"] = cursor.getInvSize().second;
        cursorDict["cornerX"] = cursor.getCornerCoords().first;
        cursorDict["cornerY"] = cursor.getCornerCoords().second;

        dict["head"] = headDict;

        headDict["graphic"] = head.getGraphicValue();
        headDict["empty"] = head.isEmpty();
        headDict["invX"] = head.getInvCoords().first;
        headDict["invY"] = head.getInvCoords().second;
        headDict["real"] = head.isReal();
        headDict["sizeX"] = head.getInvSize().first;
        headDict["sizeY"] = head.getInvSize().second;
        headDict["cornerX"] = head.getCornerCoords().first;
        headDict["cornerY"] = head.getCornerCoords().second;

        dict["body"] = bodyDict;

        bodyDict["graphic"] = body.getGraphicValue();
        bodyDict["empty"] = body.isEmpty();
        bodyDict["invX"] = body.getInvCoords().first;
        bodyDict["invY"] = body.getInvCoords().second;
        bodyDict["real"] = body.isReal();
        bodyDict["sizeX"] = body.getInvSize().first;
        bodyDict["sizeY"] = body.getInvSize().second;
        bodyDict["cornerX"] = body.getCornerCoords().first;
        bodyDict["cornerY"] = body.getCornerCoords().second;

        dict["leftHand"] = leftHandDict;

        leftHandDict["graphic"] = leftHand.getGraphicValue();
        leftHandDict["empty"] = leftHand.isEmpty();
        leftHandDict["invX"] = leftHand.getInvCoords().first;
        leftHandDict["invY"] = leftHand.getInvCoords().second;
        leftHandDict["real"] = leftHand.isReal();
        leftHandDict["sizeX"] = leftHand.getInvSize().first;
        leftHandDict["sizeY"] = leftHand.getInvSize().second;
        leftHandDict["cornerX"] = leftHand.getCornerCoords().first;
        leftHandDict["cornerY"] = leftHand.getCornerCoords().second;

        dict["rightHand"] = rightHandDict;

        rightHandDict["graphic"] = rightHand.getGraphicValue();
        rightHandDict["empty"] = rightHand.isEmpty();
        rightHandDict["invX"] = rightHand.getInvCoords().first;
        rightHandDict["invY"] = rightHand.getInvCoords().second;
        rightHandDict["real"] = rightHand.isReal();
        rightHandDict["sizeX"] = rightHand.getInvSize().first;
        rightHandDict["sizeY"] = rightHand.getInvSize().second;
        rightHandDict["cornerX"] = rightHand.getCornerCoords().first;
        rightHandDict["cornerY"] = rightHand.getCornerCoords().second;

        dict["leftRing"] = leftRingDict;

        leftRingDict["graphic"] = leftRing.getGraphicValue();
        leftRingDict["empty"] = leftRing.isEmpty();
        leftRingDict["invX"] = leftRing.getInvCoords().first;
        leftRingDict["invY"] = leftRing.getInvCoords().second;
        leftRingDict["real"] = leftRing.isReal();
        leftRingDict["sizeX"] = leftRing.getInvSize().first;
        leftRingDict["sizeY"] = leftRing.getInvSize().second;
        leftRingDict["cornerX"] = leftRing.getCornerCoords().first;
        leftRingDict["cornerY"] = leftRing.getCornerCoords().second;

        dict["rightRing"] = rightRingDict;

        rightRingDict["graphic"] = rightRing.getGraphicValue();
        rightRingDict["empty"] = rightRing.isEmpty();
        rightRingDict["invX"] = rightRing.getInvCoords().first;
        rightRingDict["invY"] = rightRing.getInvCoords().second;
        rightRingDict["real"] = rightRing.isReal();
        rightRingDict["sizeX"] = rightRing.getInvSize().first;
        rightRingDict["sizeY"] = rightRing.getInvSize().second;
        rightRingDict["cornerX"] = rightRing.getCornerCoords().first;
        rightRingDict["cornerY"] = rightRing.getCornerCoords().second;

        dict["amulet"] = amuletDict;

        amuletDict["graphic"] = amulet.getGraphicValue();
        amuletDict["empty"] = amulet.isEmpty();
        amuletDict["invX"] = amulet.getInvCoords().first;
        amuletDict["invY"] = amulet.getInvCoords().second;
        amuletDict["real"] = amulet.isReal();
        amuletDict["sizeX"] = amulet.getInvSize().first;
        amuletDict["sizeY"] = amulet.getInvSize().second;
        amuletDict["cornerX"] = amulet.getCornerCoords().first;
        amuletDict["cornerY"] = amulet.getCornerCoords().second;

        boost::python::list inventoryList, beltList;
        dict["inventoryBox"] = inventoryList;
        for(uint8_t i=0;i<4;i++)
        {
            for(uint8_t j=0;j<10;j++)
            {
                boost::python::dict itemDict;
                FAWorld::Item item = mPlayerInv.getItemAt(FAWorld::Item::eqINV, i, j);
                if(!item.isEmpty())
                {
                    itemDict["graphic"] = item.getGraphicValue();
                    itemDict["empty"] = false;
                    itemDict["invX"] = item.getInvCoords().first;
                    itemDict["invY"] = item.getInvCoords().second;
                    itemDict["real"] = item.isReal();
                    itemDict["sizeX"] = item.getInvSize().first;
                    itemDict["sizeY"] = item.getInvSize().second;
                    itemDict["cornerX"] = item.getCornerCoords().first;
                    itemDict["cornerY"] = item.getCornerCoords().second;
                }
                else
                {
                    itemDict["graphic"] = 0;
                    itemDict["empty"] = true;
                    itemDict["invX"] = item.getInvCoords().first;
                    itemDict["invY"] = item.getInvCoords().second;
                }
                inventoryList.append(itemDict);
            }
        }
        FAWorld::Item beltItem;
        for(uint8_t i=0;i<8;i++)
        {
            boost::python::dict beltDict;
            beltItem = mPlayerInv.getItemAt(FAWorld::Item::eqBELT, 0, 0, i);
            if(!beltItem.isEmpty())
            {
                beltDict["graphic"] = beltItem.getGraphicValue();
                beltDict["empty"] = false;
                beltDict["invX"] = beltItem.getInvCoords().first;
                beltDict["invY"] = beltItem.getInvCoords().second;
                beltDict["real"] = beltItem.isReal();
                beltDict["sizeX"] = beltItem.getInvSize().first;
                beltDict["sizeY"] = beltItem.getInvSize().second;
                beltDict["cornerX"] = beltItem.getCornerCoords().first;
                beltDict["cornerY"] = beltItem.getCornerCoords().second;
            }
            else
            {
                beltDict["graphic"] = 0;
                beltDict["empty"] = true;
                beltDict["real"] = false;
                beltDict["invX"] = beltItem.getInvCoords().first;
                beltDict["invY"] = beltItem.getInvCoords().second;
            }
            beltList.append(beltDict);
        }
        dict["belt"] = beltList;
        return dict;
    }
Beispiel #5
0
    void FAPythonFuncs::placeItem(uint32_t toPara,
                   uint32_t fromPara,
                   uint32_t fromY,
                   uint32_t fromX,
                   uint32_t toY,
                   uint32_t toX,
                   uint32_t beltX)
    {

        if(fromX >= 10 || fromY >=4 || toX>=10 || toY>=4)
            return;
        FAWorld::Item::equipLoc to   = static_cast<FAWorld::Item::equipLoc>(toPara);
        FAWorld::Item::equipLoc from = static_cast<FAWorld::Item::equipLoc>(fromPara);
        FAWorld::Item item = mPlayerInv.getItemAt(
                    from,
                    fromY,
                    fromX, beltX);
        if(item.isEmpty())
            return;
        if(!item.isReal() && !item.isEmpty())
        {
            item = mPlayerInv.getItemAt(
                        FAWorld::Item::eqINV,
                        item.getCornerCoords().second,
                        item.getCornerCoords().first);

            fromX = item.getInvCoords().first;
            fromY = item.getInvCoords().second;
        }
        if(to == FAWorld::Item::eqCURSOR)
        {

                if(mPlayerInv.getItemAt(FAWorld::Item::eqCURSOR).isEmpty())
                {

                    if(mPlayerInv.putItem(item, FAWorld::Item::eqCURSOR, from, fromY, fromX, beltX))
                    {

                        if(item.getGraphicValue() > 179)
                        {

                            cursorPath = "";
                            cursorFrame = 0;
                        }
                        else
                        {
                            cursorPath = "data/inv/objcurs.cel";
                            cursorFrame = item.getGraphicValue();

                        }
                    }

                }

        }

        else if(to == FAWorld::Item::eqINV)
        {
            item = mPlayerInv.getItemAt(FAWorld::Item::eqCURSOR);
            if(mPlayerInv.putItem(item, to, FAWorld::Item::eqCURSOR, toY, toX))
            {
                cursorPath = "";
                cursorFrame = 0;
            }

        }
        else if(to == FAWorld::Item::eqLEFTHAND || to == FAWorld::Item::eqRIGHTHAND)
        {

            item = mPlayerInv.getItemAt(FAWorld::Item::eqCURSOR);
            if(mPlayerInv.putItem(item, to, FAWorld::Item::eqCURSOR, toY, toX))
            {
                cursorPath = "";
                cursorFrame = 0;
            }

        }
        else if(to == FAWorld::Item::eqLEFTRING || to == FAWorld::Item::eqRIGHTRING)
        {
            item = mPlayerInv.getItemAt(FAWorld::Item::eqCURSOR);
            if (mPlayerInv.putItem(item, to, FAWorld::Item::eqCURSOR, toY, toX))
            {
                cursorPath = "";
                cursorFrame = 0;
            }

        }
        else
        {

            item = mPlayerInv.getItemAt(from, fromY, fromX);
            if(mPlayerInv.putItem(item, to, from, toY, toX, beltX))
            {
                cursorPath = "";
                cursorFrame = 0;
            }

        }
        return;
    }