Example #1
0
void pawsPetStatWindow::SetTarget( GEMClientActor* actor )
{
    csString signal;
    target = actor ? actor : NULL;
    if ( target )
    {
        // Setup the Doll
        if ( !SetupDoll() )
            return;

        // Set control Subscriptions
        targetID.Clear();
        targetID.Append(actor->GetEID().Unbox());
        signal.Format("fVitalValue0:%s", targetID.GetData());
        PawsManager::GetSingleton().Subscribe(signal, hpBar);
        PawsManager::GetSingleton().Subscribe(signal, hpCurrent);

        signal.Format("fVitalValue1:%s", targetID.GetData());
        PawsManager::GetSingleton().Subscribe(signal, manaBar);
        PawsManager::GetSingleton().Subscribe(signal, manaCurrent);

        signal.Format("fVitalValue2:%s", targetID.GetData());
        PawsManager::GetSingleton().Subscribe(signal, pysStaminaBar);
        PawsManager::GetSingleton().Subscribe(signal, pysStaminaCurrent);

        signal.Format("fVitalValue3:%s", targetID.GetData());
        PawsManager::GetSingleton().Subscribe(signal, menStaminaBar);
        PawsManager::GetSingleton().Subscribe(signal, menStaminaCurrent);
    }
}
Example #2
0
bool pawsInventoryWindow::PostSetup()
{
    // If you add something here, DO NOT FORGET TO CHANGE 'INVENTORY_EQUIP_COUNT'!!!
    const char* equipmentSlotNames[] = { "lefthand", "righthand", "leftfinger", "rightfinger", "helm", "neck", "back", "arms", "gloves", "boots", "legs", "belt", "bracers", "torso", "mind" };

    // Setup the Doll
    if ( !SetupDoll() )
        return false;

    money = dynamic_cast <pawsMoney*> (FindWidget("Money"));
    if ( money )
    {
        money->SetContainer( CONTAINER_INVENTORY_MONEY );
    }

    for(size_t x = 0; x < INVENTORY_EQUIP_COUNT-1; x++)
    {
        if(!SetupSlot(equipmentSlotNames[x]))
            return false;
    }

    pawsListBox* bulkList = dynamic_cast <pawsListBox*> (FindWidget("BulkList"));
    if (bulkList)
    {
        int colCount = bulkList->GetTotalColumns();
        int rowCount = (int) ceil(float(INVENTORY_BULK_COUNT)/colCount);

        for(int r = 0; r < rowCount; r ++)
        {
            pawsListBoxRow* listRow = bulkList->NewRow(r);
            for (int j = 0; j < colCount; j++)
            {
                int i = r*colCount + j;
                pawsSlot* slot;
                slot = dynamic_cast <pawsSlot*> (listRow->GetColumn(j));
                slot->SetContainer( CONTAINER_INVENTORY_BULK );
                //csString name;
                slot->SetSlotID( i );
                csString name;
                name.Format("invslot_%d", 16 + i ); // 16 equip slots come first
                slot->SetSlotName(name);

                if(i >= INVENTORY_BULK_COUNT)
                {
                    slot->Hide();
                    continue;
                }

                //printf("Subscribing bulk slot to %s.\n",name.GetData() );
                PawsManager::GetSingleton().Subscribe( name, slot );
                PawsManager::GetSingleton().Subscribe("sigClearInventorySlots", slot);
                bulkSlots[i] = slot;
            }
        }
    }

    // subscribe all equipment slots to sigClearInventorySlots - needed e.g for stacks of ammo or showing the orignal tooltip
    for(size_t z = 0; z < INVENTORY_EQUIP_COUNT-1; z++)
    {
        pawsSlot* slotname = dynamic_cast<pawsSlot*>(FindWidget(equipmentSlotNames[z]));
        if(slotname)
        {
            PawsManager::GetSingleton().Subscribe("sigClearInventorySlots", slotname);
        }
    }

    // Ask the server to send us the inventory
    inventoryCache = psengine->GetInventoryCache();
    if (!inventoryCache)
        return false;

    if ( !inventoryCache->GetInventory() )
    {
        inventoryCache->SetCacheStatus(psCache::INVALID);
        return false;
    }

    return true;
}
bool pawsSkillWindow::PostSetup()
{
    // Setup the Doll
    if ( !SetupDoll() )
    {
        return false;
    }

    xml =  csQueryRegistry<iDocumentSystem > ( PawsManager::GetSingleton().GetObjectRegistry());

    skills[CAT_STATS].list =
        static_cast<pawsListBox*>(FindWidget("StatsSkillList"));
    skills[CAT_STATS].description =
        static_cast<pawsMultiLineTextBox*>(FindWidget("StatsDescription"));
    skills[CAT_STATS].indWidget = "StatsIndicator";
    skills[CAT_STATS].tabName = "Stats Button";

    skills[CAT_COMBAT].list =
        static_cast<pawsListBox*>(FindWidget("CombatSkillList"));
    skills[CAT_COMBAT].description =
        static_cast<pawsMultiLineTextBox*>(FindWidget("CombatDescription"));
    skills[CAT_COMBAT].indWidget = "CombatIndicator";
    skills[CAT_COMBAT].tabName = "Combat Button";

    skills[CAT_MAGIC].list =
        static_cast<pawsListBox*>(FindWidget("MagicSkillList"));
    skills[CAT_MAGIC].description =
        static_cast<pawsMultiLineTextBox*>(FindWidget("MagicDescription"));
    skills[CAT_MAGIC].indWidget = "MagicIndicator";
    skills[CAT_MAGIC].tabName = "Magic Button";

    skills[CAT_JOBS].list =
        static_cast<pawsListBox*>(FindWidget("JobsSkillList"));
    skills[CAT_JOBS].description =
        static_cast<pawsMultiLineTextBox*>(FindWidget("JobsDescription"));
    skills[CAT_JOBS].indWidget = "JobsIndicator";
    skills[CAT_JOBS].tabName = "Jobs Button";

    skills[CAT_VARIOUS].list =
        static_cast<pawsListBox*>(FindWidget("VariousSkillList"));
    skills[CAT_VARIOUS].description =
        static_cast<pawsMultiLineTextBox*>(FindWidget("VariousDescription"));
    skills[CAT_VARIOUS].indWidget = "VariousIndicator";
    skills[CAT_VARIOUS].tabName = "Various Button";

    factionList = static_cast<pawsListBox*>(FindWidget("FactionList"));
    factionsDescription = static_cast<pawsMultiLineTextBox*>(FindWidget("FactionDescription"));

    hpBar = dynamic_cast <pawsProgressBar*> (FindWidget("HPBar"));
    manaBar = dynamic_cast <pawsProgressBar*> (FindWidget("ManaBar"));
    pysStaminaBar = dynamic_cast <pawsProgressBar*> (FindWidget("PysStaminaBar"));
    menStaminaBar = dynamic_cast <pawsProgressBar*> (FindWidget("MenStaminaBar"));
    experienceBar = dynamic_cast <pawsProgressBar*> (FindWidget("ExperienceBar"));

    hpFrac = dynamic_cast <pawsTextBox*> (FindWidget("HPFrac"));
    manaFrac = dynamic_cast <pawsTextBox*> (FindWidget("ManaFrac"));
    pysStaminaFrac = dynamic_cast <pawsTextBox*> (FindWidget("PysStaminaFrac"));
    menStaminaFrac = dynamic_cast <pawsTextBox*> (FindWidget("MenStaminaFrac"));
    experiencePerc = dynamic_cast <pawsTextBox*> (FindWidget("ExperiencePerc"));

    if ( !hpBar || !manaBar || !pysStaminaBar || !menStaminaBar || !experienceBar
         || !hpFrac || !manaFrac || !pysStaminaFrac || !menStaminaFrac || !experiencePerc )
    {
        return false;
    }

    hpBar->SetTotalValue(1);
    manaBar->SetTotalValue(1);
    pysStaminaBar->SetTotalValue(1);
    menStaminaBar->SetTotalValue(1);
    experienceBar->SetTotalValue(1);

    currentTab =0;
    previousTab =0;

    psengine->GetMsgHandler()->Subscribe(this, MSGTYPE_GUISKILL);
    psengine->GetMsgHandler()->Subscribe(this, MSGTYPE_FACTION_INFO);

    return true;
}