Vergil93
Advanced User
- Joined
- Jun 19, 2010
- Messages
- 263
- Reaction score
- 6
Chcia?bym by kto?, kto zna si? na tym, przerobi? mi ten skrypt, znaleziony w sourach, tak aby okienko Trade otwiera?o si? niezale?nie od tego w jaki spos?b b?dzie otwierane. W skrypcie jest, ?e tylko NPCty mog? otwiera? nam to okienko, a ja chc? by mo?na by?o je otwiera? w ka?dym momencie, nie tylko poprzez NPCty.
PHP:
void Player::openShopWindow()
{
sendShop();
sendGoods();
}
void Player::closeShopWindow(Npc* npc/* = NULL*/, int32_t onBuy/* = -1*/, int32_t onSell/* = -1*/)
{
if(npc || (npc = getShopOwner(onBuy, onSell)))
npc->onPlayerEndTrade(this, onBuy, onSell);
if(shopOwner)
sendCloseShop();
shopOwner = NULL;
purchaseCallback = saleCallback = -1;
shopOffer.clear();
}
bool Player::canShopItem(uint16_t itemId, uint8_t subType, ShopEvent_t event)
{
for(ShopInfoList::iterator sit = shopOffer.begin(); sit != shopOffer.end(); ++sit)
{
if(sit->itemId != itemId || ((event != SHOPEVENT_BUY || sit->buyPrice < 0)
&& (event != SHOPEVENT_SELL || sit->sellPrice < 0)))
continue;
if(event == SHOPEVENT_SELL)
return true;
const ItemType& it = Item::items[id];
if(it.isFluidContainer() || it.isSplash() || it.isRune())
return sit->subType == subType;
return true;
}
return false;
}