Index: map/items/item_shop.cpp =================================================================== --- map/items/item_shop.cpp (revision 4026) +++ map/items/item_shop.cpp (working copy) @@ -30,7 +30,7 @@ m_MinPrice = 0; m_MaxPrice = 0; - + m_DailyIncrease = false; } @@ -43,7 +43,7 @@ return m_MinPrice; } - + uint32 CItemShop::getMaxPrice() { return m_MaxPrice; @@ -53,7 +53,7 @@ { return getQuantity() != 0; } - + bool CItemShop::IsDailyIncrease() { return m_DailyIncrease; @@ -69,7 +69,22 @@ m_MaxPrice = price; } -void CItemShop::setDailyIncreace(uint8 increace) +void CItemShop::setDailyIncrease(uint16 increase) { - m_DailyIncrease = increace > 0; + m_DailyIncrease = increase; +} + +uint16 CItemShop::getDailyIncrease() +{ + return m_DailyIncrease; +} + +void CItemShop::setInitialQuantity(uint16 increase) +{ + m_InitialQuantity = increase; +} + +uint16 CItemShop::getInitialQuantity() +{ + return m_InitialQuantity; } \ No newline at end of file Index: map/items/item_shop.h =================================================================== --- map/items/item_shop.h (revision 4026) +++ map/items/item_shop.h (working copy) @@ -43,13 +43,16 @@ uint32 getMinPrice(); uint32 getMaxPrice(); - + bool IsInMenu(); bool IsDailyIncrease(); - + void setMinPrice(uint32 price); void setMaxPrice(uint32 price); - void setDailyIncreace(uint8 quantity); + void setDailyIncrease(uint16 quantity); + uint16 getDailyIncrease(); + void setInitialQuantity(uint16 quantity); + uint16 getInitialQuantity(); private: @@ -56,7 +59,8 @@ uint32 m_MinPrice; uint32 m_MaxPrice; - bool m_DailyIncrease; + uint16 m_DailyIncrease; + uint16 m_InitialQuantity; }; #endif \ No newline at end of file Index: map/utils/guildutils.cpp =================================================================== --- map/utils/guildutils.cpp (revision 4026) +++ map/utils/guildutils.cpp (working copy) @@ -75,7 +75,7 @@ { CItemContainer* PGuild = *iter; - fmtQuery = "SELECT itemid, min_price, max_price, quantity, daily_increase \ + fmtQuery = "SELECT itemid, min_price, max_price, max_quantity, daily_increase, initial_quantity \ FROM guild_shops \ WHERE guildid = %u \ LIMIT %u"; @@ -93,15 +93,13 @@ PItem->setMinPrice(Sql_GetIntData(SqlHandle,1)); PItem->setMaxPrice(Sql_GetIntData(SqlHandle,2)); PItem->setStackSize(Sql_GetIntData(SqlHandle,3)); - PItem->setDailyIncreace(Sql_GetIntData(SqlHandle,4)); + PItem->setDailyIncrease(Sql_GetIntData(SqlHandle,4)); + PItem->setInitialQuantity(Sql_GetIntData(SqlHandle,5)); //TODO: set price based on previous day stock - PItem->setBasePrice(Sql_GetIntData(SqlHandle,1)); + PItem->setBasePrice(PItem->getMinPrice()); - if (PItem->IsDailyIncrease()) - { - PItem->setQuantity((PItem->getStackSize() * 75) / 100); - } + PItem->setQuantity(PItem->getInitialQuantity()); PGuild->InsertItem(PItem); } } @@ -127,15 +125,9 @@ if (PItem->IsDailyIncrease()) { - PItem->setQuantity(PItem->getQuantity() + (PItem->getStackSize() * 25) / 100); + PItem->setQuantity(PItem->getQuantity() + PItem->getDailyIncrease()); } - uint32 limit = (PItem->getStackSize() * 75) / 100; - if (PItem->getQuantity() > limit) - { - PItem->setQuantity(limit); - } - //TODO: set price based on previous day stock PItem->setBasePrice(PItem->getMinPrice()); }