Ejemplo n.º 1
0
void UpdateGuildsStock()
{
    for (std::vector<CItemContainer*>::iterator iter = g_PGuildList.begin(); iter != g_PGuildList.end(); iter++)
	{
		CItemContainer* PGuild = *iter;
        for(uint8 slotid = 1; slotid <= PGuild->GetSize(); ++slotid)
        {
            CItemShop* PItem = (CItemShop*)PGuild->GetItem(slotid);

			PItem->setBasePrice(PItem->getMinPrice() + ((float)(PItem->getStackSize() - PItem->getQuantity()) / PItem->getStackSize()) * (PItem->getMaxPrice() - PItem->getMinPrice()));

            if (PItem->IsDailyIncrease())
            {
                PItem->setQuantity(PItem->getQuantity() + PItem->getDailyIncrease());
            }
        }
	}
    ShowDebug(CL_CYAN"UpdateGuildsStock is finished\n" CL_RESET);
}
Ejemplo n.º 2
0
void UpdateGuildsStock()
{
    for (std::vector<CItemContainer*>::iterator iter = g_PGuildList.begin(); iter != g_PGuildList.end(); iter++)
	{
		CItemContainer* PGuild = *iter;
        for(uint8 slotid = 1; slotid <= PGuild->GetSize(); ++slotid)
        {
            CItemShop* PItem = (CItemShop*)PGuild->GetItem(slotid);

            // TODO: сначала, анализируя текущее количество предметов, обновляем их стоимость

            if (PItem->IsDailyIncrease())
            {
                PItem->setQuantity(PItem->getQuantity() + PItem->getDailyIncrease());
            }

            //TODO: set price based on previous day stock
            PItem->setBasePrice(PItem->getMinPrice());
        }
	}
    ShowDebug(CL_CYAN"UpdateGuildsStock is finished\n" CL_RESET);
}