本文整理汇总了C++中ItemPosCountVec类的典型用法代码示例。如果您正苦于以下问题:C++ ItemPosCountVec类的具体用法?C++ ItemPosCountVec怎么用?C++ ItemPosCountVec使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ItemPosCountVec类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnGossipHello
bool OnGossipHello(Player* pPlayer, Creature* /*pCreature*/)
{
if( pPlayer->IsActiveQuest( QUEST_A_MEETING_WITH_THE_MAGISTER ) && pPlayer->GetQuestStatus( QUEST_A_MEETING_WITH_THE_MAGISTER ) != QUEST_STATUS_COMPLETE )
{
ItemPosCountVec dest;
uint32 count = 1, no_space_count = 0;
uint8 msg = pPlayer->CanStoreNewItem( NULL_BAG, NULL_SLOT, dest, ITEM_QUEST, count, &no_space_count );
if( msg == EQUIP_ERR_ITEM_NOT_FOUND ) {
sLog->outErrorDb( "[src/server/scripts/Northrend/dalaran.cpp] Item (Entry %u) not exist in `item_template`.", ITEM_QUEST );
return false;
}
if( msg != EQUIP_ERR_OK ) // convert to possible store amount
count -= no_space_count;
if( count != 0 && !dest.empty( ) ) // can add some
if( Item* item = pPlayer->StoreNewItem( dest, ITEM_QUEST, true, 0 ) )
pPlayer->SendNewItem( item, count, true, false );
}
if( pPlayer->GetQuestStatus( QUEST_AN_AUDIENCE_WITH_THE_ARCANIST ) == QUEST_STATUS_COMPLETE )
{
if( pPlayer->HasAura( SPELL_SILVER_COVENANT_DISGUISE_F ) )
pPlayer->RemoveAurasDueToSpell( SPELL_SILVER_COVENANT_DISGUISE_F );
if( pPlayer->HasAura( SPELL_SILVER_COVENANT_DISGUISE_M ) )
pPlayer->RemoveAurasDueToSpell( SPELL_SILVER_COVENANT_DISGUISE_M );
}
return false;
}
示例2: HandleAutoBankItemOpcode
void WorldSession::HandleAutoBankItemOpcode(WorldPacket& recvPacket)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_AUTOBANK_ITEM");
uint8 srcbag, srcslot;
recvPacket >> srcbag >> srcslot;
sLog->outDebug(LOG_FILTER_NETWORKIO, "STORAGE: receive srcbag = %u, srcslot = %u", srcbag, srcslot);
Item* pItem = _player->GetItemByPos(srcbag, srcslot);
if (!pItem)
return;
ItemPosCountVec dest;
InventoryResult msg = _player->CanBankItem(NULL_BAG, NULL_SLOT, dest, pItem, false);
if (msg != EQUIP_ERR_OK)
{
_player->SendEquipError(msg, pItem, NULL);
return;
}
if (dest.size() == 1 && dest[0].pos == pItem->GetPos())
{
_player->SendEquipError(EQUIP_ERR_NONE, pItem, NULL);
return;
}
_player->RemoveItem(srcbag, srcslot, true);
_player->ItemRemovedQuestCheck(pItem->GetEntry(), pItem->GetCount());
_player->BankItem(dest, pItem, true);
}
示例3: DEBUG_LOG
void WorldSession::HandleAutoBankItemOpcode(WorldPacket& recvPacket)
{
DEBUG_LOG("WORLD: CMSG_AUTOBANK_ITEM");
uint8 srcbag, srcslot;
recvPacket >> srcbag >> srcslot;
DEBUG_LOG("STORAGE: receive srcbag = %u, srcslot = %u", srcbag, srcslot);
Item *pItem = _player->GetItemByPos( srcbag, srcslot );
if( !pItem )
return;
ItemPosCountVec dest;
uint8 msg = _player->CanBankItem( NULL_BAG, NULL_SLOT, dest, pItem, false );
if( msg != EQUIP_ERR_OK )
{
_player->SendEquipError( msg, pItem, NULL );
return;
}
// no-op: placed in same slot
if(dest.size() == 1 && dest[0].pos == pItem->GetPos())
{
// just remove gray item state
_player->SendEquipError( EQUIP_ERR_NONE, pItem, NULL );
return;
}
_player->RemoveItem(srcbag, srcslot, true);
_player->BankItem( dest, pItem, true );
}
示例4: switch
void BattleGround::RewardMark(Player *plr,uint32 count)
{
// 'Inactive' this aura prevents the player from gaining honor points and battleground tokens
if(plr->GetDummyAura(SPELL_AURA_PLAYER_INACTIVE))
return;
BattleGroundMarks mark;
bool IsSpell;
switch(GetTypeID())
{
case BATTLEGROUND_AV:
IsSpell = true;
if(count == ITEM_WINNER_COUNT)
mark = SPELL_AV_MARK_WINNER;
else
mark = SPELL_AV_MARK_LOSER;
break;
case BATTLEGROUND_WS:
IsSpell = true;
if(count == ITEM_WINNER_COUNT)
mark = SPELL_WS_MARK_WINNER;
else
mark = SPELL_WS_MARK_LOSER;
break;
case BATTLEGROUND_AB:
IsSpell = true;
if(count == ITEM_WINNER_COUNT)
mark = SPELL_AB_MARK_WINNER;
else
mark = SPELL_AB_MARK_LOSER;
break;/*
case BATTLEGROUND_EY:
IsSpell = false;
mark = ITEM_EY_MARK_OF_HONOR;
break;*/
default:
return;
}
if(IsSpell)
plr->CastSpell(plr, mark, true);
else if ( objmgr.GetItemPrototype( mark ) )
{
ItemPosCountVec dest;
uint32 no_space_count = 0;
uint8 msg = plr->CanStoreNewItem( NULL_BAG, NULL_SLOT, dest, mark, count, &no_space_count );
if( msg != EQUIP_ERR_OK ) // convert to possible store amount
count -= no_space_count;
if( count != 0 && !dest.empty()) // can add some
if(Item* item = plr->StoreNewItem( dest, mark, true, 0))
plr->SendNewItem(item,count,false,true);
if(no_space_count > 0)
SendRewardMarkByMail(plr,mark,no_space_count);
}
}
示例5: AddItemChoixS
void AddItemChoixS(Player *player, uint32 item_id, int choix) {
uint32 noSpaceForCount = 0;
ItemPosCountVec dest;
InventoryResult msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, item_id, 1, &noSpaceForCount);
if (msg != EQUIP_ERR_OK)
if (dest.empty()) {
ChatHandler(player->GetSession()).PSendSysMessage("Vous n'avez plus de place.");
return; }
if (Item* item = player->StoreNewItem(dest, item_id, true, ChoixS(item_id, choix)))
player->SendNewItem(item, 1, true, false);
return; }
示例6: TC_LOG_ERROR
void WorldSession::HandleAutoStoreBagItemOpcode(WorldPackets::Item::AutoStoreBagItem& packet)
{
if (!packet.Inv.Items.empty())
{
TC_LOG_ERROR("network", "HandleAutoStoreBagItemOpcode - Invalid itemCount (" SZFMTD ")", packet.Inv.Items.size());
return;
}
TC_LOG_DEBUG("network", "HandleAutoStoreBagItemOpcode: receive ContainerSlotA: %u, SlotA: %u, ContainerSlotB: %u",
packet.ContainerSlotA, packet.SlotA, packet.ContainerSlotB);
Item* item = _player->GetItemByPos(packet.ContainerSlotA, packet.SlotA);
if (!item)
return;
if (!_player->IsValidPos(packet.ContainerSlotB, NULL_SLOT, false)) // can be autostore pos
{
_player->SendEquipError(EQUIP_ERR_WRONG_SLOT);
return;
}
uint16 src = item->GetPos();
// check unequip potability for equipped items and bank bags
if (_player->IsEquipmentPos(src) || _player->IsBagPos(src))
{
InventoryResult msg = _player->CanUnequipItem(src, !_player->IsBagPos(src));
if (msg != EQUIP_ERR_OK)
{
_player->SendEquipError(msg, item);
return;
}
}
ItemPosCountVec dest;
InventoryResult msg = _player->CanStoreItem(packet.ContainerSlotB, NULL_SLOT, dest, item, false);
if (msg != EQUIP_ERR_OK)
{
_player->SendEquipError(msg, item);
return;
}
// no-op: placed in same slot
if (dest.size() == 1 && dest[0].pos == src)
{
// just remove grey item state
_player->SendEquipError(EQUIP_ERR_INTERNAL_BAG_ERROR, item);
return;
}
_player->RemoveItem(packet.ContainerSlotA, packet.SlotA, true);
_player->StoreItem(dest, item, true);
}
示例7: CHECK_PACKET_SIZE
void WorldSession::HandleAutoStoreBagItemOpcode( WorldPacket & recv_data )
{
CHECK_PACKET_SIZE(recv_data,1+1+1);
//sLog.outDebug("WORLD: CMSG_AUTOSTORE_BAG_ITEM");
uint8 srcbag, srcslot, dstbag;
recv_data >> srcbag >> srcslot >> dstbag;
//sLog.outDebug("STORAGE: receive srcbag = %u, srcslot = %u, dstbag = %u", srcbag, srcslot, dstbag);
Item *pItem = _player->GetItemByPos( srcbag, srcslot );
if( !pItem )
return;
if(!_player->IsValidPos(dstbag,NULL_SLOT))
{
_player->SendEquipError( EQUIP_ERR_ITEM_DOESNT_GO_TO_SLOT, NULL, NULL );
return;
}
uint16 src = pItem->GetPos();
// check unequip potability for equipped items and bank bags
if(_player->IsEquipmentPos ( src ) || _player->IsBagPos ( src ))
{
uint8 msg = _player->CanUnequipItem( src, !_player->IsBagPos ( src ));
if(msg != EQUIP_ERR_OK)
{
_player->SendEquipError( msg, pItem, NULL );
return;
}
}
ItemPosCountVec dest;
uint8 msg = _player->CanStoreItem( dstbag, NULL_SLOT, dest, pItem, false );
if( msg != EQUIP_ERR_OK )
{
_player->SendEquipError( msg, pItem, NULL );
return;
}
// no-op: placed in same slot
if(dest.size()==1 && dest[0].pos==src)
{
// just remove grey item state
_player->SendEquipError( EQUIP_ERR_NONE, pItem, NULL );
return;
}
_player->RemoveItem(srcbag, srcslot, true );
_player->StoreItem( dest, pItem, true );
}
示例8: HandleAutoStoreBagItemOpcode
void WorldSession::HandleAutoStoreBagItemOpcode(WorldPacket& recvData)
{
//TC_LOG_DEBUG("network", "WORLD: CMSG_AUTOSTORE_BAG_ITEM");
uint8 srcbag, srcslot, dstbag;
recvData >> srcbag >> srcslot >> dstbag;
//TC_LOG_DEBUG("STORAGE: receive srcbag = %u, srcslot = %u, dstbag = %u", srcbag, srcslot, dstbag);
Item* pItem = _player->GetItemByPos(srcbag, srcslot);
if (!pItem)
return;
if (!_player->IsValidPos(dstbag, NULL_SLOT, false)) // can be autostore pos
{
_player->SendEquipError(EQUIP_ERR_ITEM_DOESNT_GO_TO_SLOT, nullptr, nullptr);
return;
}
uint16 src = pItem->GetPos();
// check unequip potability for equipped items and bank bags
if (_player->IsEquipmentPos (src) || _player->IsBagPos (src))
{
InventoryResult msg = _player->CanUnequipItem(src, !_player->IsBagPos (src));
if (msg != EQUIP_ERR_OK)
{
_player->SendEquipError(msg, pItem, nullptr);
return;
}
}
ItemPosCountVec dest;
InventoryResult msg = _player->CanStoreItem(dstbag, NULL_SLOT, dest, pItem, false);
if (msg != EQUIP_ERR_OK)
{
_player->SendEquipError(msg, pItem, nullptr);
return;
}
// no-op: placed in same slot
if (dest.size() == 1 && dest[0].pos == src)
{
// just remove grey item state
_player->SendEquipError(EQUIP_ERR_NONE, pItem, nullptr);
return;
}
_player->RemoveItem(srcbag, srcslot, true);
_player->StoreItem(dest, pItem, true);
}
示例9: DEBUG_LOG
void WorldSession::HandleAutoBankItemOpcode(WorldPacket& recvPacket)
{
DEBUG_LOG("WORLD: CMSG_AUTOBANK_ITEM");
uint8 srcbag, srcslot;
recvPacket >> srcbag >> srcslot;
DEBUG_LOG("STORAGE: receive srcbag = %u, srcslot = %u", srcbag, srcslot);
Item *pItem = _player->GetItemByPos( srcbag, srcslot );
if( !pItem )
return;
// WPE dupe protection
if(pItem->IsBag())
if(!((Bag *)pItem)->IsEmpty())
{
// GM announce
sWorld.SendGMWorldText(SECURITY_MODERATOR, LANG_ANTIWPE_NOTIFY, GetPlayerName(), pItem->GetProto()->ItemId);
sLog.outInterest("WPE PROTECTION: Hrac %s duplikuje pomocou itemu %u", GetPlayerName(), pItem->GetProto()->ItemId);
// Permanent Ban
sWorld.BanAccount(BAN_CHARACTER, GetPlayerName(),0 ,"WPE Duplication Item","Casso's WPE Protection");
}
ItemPosCountVec dest;
uint8 msg = _player->CanBankItem( NULL_BAG, NULL_SLOT, dest, pItem, false );
if( msg != EQUIP_ERR_OK )
{
_player->SendEquipError( msg, pItem, NULL );
return;
}
// no-op: placed in same slot
if(dest.size() == 1 && dest[0].pos == pItem->GetPos())
{
// just remove gray item state
_player->SendEquipError( EQUIP_ERR_NONE, pItem, NULL );
return;
}
_player->RemoveItem(srcbag, srcslot, true);
_player->BankItem( dest, pItem, true );
}
示例10: RewardItem
void BattleGround::RewardItem(Player* plr, uint32 item_id, uint32 count)
{
ItemPosCountVec dest;
uint32 no_space_count = 0;
uint8 msg = plr->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, item_id, count, &no_space_count);
if (msg == EQUIP_ERR_ITEM_NOT_FOUND)
{
sLog.outErrorDb("Battleground reward item (Entry %u) not exist in `item_template`.", item_id);
return;
}
if (msg != EQUIP_ERR_OK) // convert to possible store amount
count -= no_space_count;
if (count != 0 && !dest.empty()) // can add some
if (Item* item = plr->StoreNewItem(dest, item_id, true, 0))
plr->SendNewItem(item, count, true, false);
if (no_space_count > 0)
SendRewardMarkByMail(plr, item_id, no_space_count);
}
示例11: RewardMarkOfHonor
void BattlefieldWG::RewardMarkOfHonor(Player* player, uint32 count)
{
// 'Inactive' this aura prevents the player from gaining honor points and battleground tokens
if (count == 0)
return;
ItemPosCountVec dest;
uint32 no_space_count = 0;
uint8 msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, WG_MARK_OF_HONOR, count, &no_space_count);
if (msg == EQUIP_ERR_ITEM_NOT_FOUND)
{
return;
}
if (msg != EQUIP_ERR_OK) // convert to possible store amount
count -= no_space_count;
if (count != 0 && !dest.empty()) // can add some
if (Item * item = player->StoreNewItem(dest, WG_MARK_OF_HONOR, true, 0))
player->SendNewItem(item, count, true, false);
}
示例12: TC_LOG_DEBUG
void WorldSession::HandleAutoBankItemOpcode(WorldPacket& recvPacket)
{
TC_LOG_DEBUG("network", "WORLD: CMSG_AUTOBANK_ITEM");
uint8 srcbag, srcslot;
recvPacket >> srcbag >> srcslot;
TC_LOG_DEBUG("network", "STORAGE: receive srcbag = %u, srcslot = %u", srcbag, srcslot);
if (!CanUseBank())
{
TC_LOG_DEBUG("network", "WORLD: HandleAutoBankItemOpcode - Unit (%s) not found or you can't interact with him.", m_currentBankerGUID.ToString().c_str());
return;
}
Item* pItem = _player->GetItemByPos(srcbag, srcslot);
if (!pItem)
return;
ItemPosCountVec dest;
InventoryResult msg = _player->CanBankItem(NULL_BAG, NULL_SLOT, dest, pItem, false);
if (msg != EQUIP_ERR_OK)
{
_player->SendEquipError(msg, pItem, nullptr);
return;
}
if (dest.size() == 1 && dest[0].pos == pItem->GetPos())
{
_player->SendEquipError(EQUIP_ERR_NONE, pItem, nullptr);
return;
}
_player->RemoveItem(srcbag, srcslot, true);
_player->ItemRemovedQuestCheck(pItem->GetEntry(), pItem->GetCount());
_player->BankItem(dest, pItem, true);
}
示例13: HandleBoutiqueItemCommand
static bool HandleBoutiqueItemCommand(ChatHandler *handler, const char *args) {
uint32 achatId = (uint32)atol(args);
if (!achatId) {
handler->PSendSysMessage(11007, handler->GetSession()->GetPlayerName().c_str());
return false;
}
const char* reqcount = "SELECT nom, itemId, recup, quantite FROM boutique_achat WHERE accountId = '%u' AND id='%u'";
QueryResult resultcount = LoginDatabase.PQuery(reqcount, handler->GetSession()->GetAccountId(), achatId);
if (!resultcount) {
//Cet achat n'existe pas, ne vous est pas attribue ou n'est pas disponible sur ce serveur.
handler->PSendSysMessage(11008);
return true;
}
Field* fieldscount = resultcount->Fetch();
//Vous avez déjà attribué cet achat à un de vos personnages
if (fieldscount[2].GetInt32()!=0) {
const char* reqperso = "SELECT count(*), name FROM characters WHERE guid='%u'";
QueryResult resultperso = CharacterDatabase.PQuery(reqperso, fieldscount[2].GetInt32());
Field* fieldperso = resultperso->Fetch();
handler->PSendSysMessage(11014, fieldperso[1].GetCString());
}
uint32 itemId = fieldscount[1].GetInt32();
const char* qmask = "SELECT 1 FROM boutique_produit WHERE realmMask & '%u' != 0 and itemId = '%u'";
QueryResult reqmask = LoginDatabase.PQuery(qmask, (1<<(realmID-1)), itemId);
if (!reqmask) {
//Ce produit ou service n'est pas disponible pour ce royaume.
handler->PSendSysMessage(11018);
return true;
}
ItemTemplate const *tmp = sObjectMgr->GetItemTemplate(itemId);
if (!tmp) {
handler->PSendSysMessage(11011); //Cet objet n'existe pas. Veuillez contacter un MJ et lui d�©crire le probl�¨me
return false;
}
//Adding items
uint32 noSpaceForCount = 0;
Player* plTarget = handler->GetSession()->GetPlayer();
Player* pl = plTarget;
uint32 count = fieldscount[3].GetInt32();
// check space and find places
ItemPosCountVec dest;
uint8 msg = plTarget->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemId, count, &noSpaceForCount);
if (msg != EQUIP_ERR_OK) // convert to possible store amount
count -= noSpaceForCount;
if (count == 0 || dest.empty()) // can't add any
{
handler->PSendSysMessage(11015);
handler->SetSentErrorMessage(true);
return false;
}
Item* item = plTarget->StoreNewItem(dest, itemId, true, Item::GenerateItemRandomPropertyId(itemId));
for (ItemPosCountVec::const_iterator itr = dest.begin(); itr != dest.end(); ++itr) {
if (Item* item1 = pl->GetItemByPos(itr->pos)) {
item1->SetBinding(true);
}
}
if (count > 0 && item)
{
plTarget->SendNewItem(item,count,true,false);
const char* requpdate = "UPDATE boutique_achat SET realmID = '%u', recup='%u' WHERE id='%u'";
LoginDatabase.PExecute(requpdate, realmID, (uint32)handler->GetSession()->GetPlayer()->GetGUIDLow(), achatId);
handler->PSendSysMessage(11013, fieldscount[0].GetCString());
}
if (noSpaceForCount > 0)
handler->PSendSysMessage(11015);
plTarget->SaveToDB();
return true;
}
示例14: strtok
bool ChatHandler::HandleAddItemToAllCommand(char* args)
{
if (!*args)
return false;
uint32 itemId = 0;
// Vyextrahovanie mena itemu
if (args[0] == '[') // [name] manual form
{
char* citemName = citemName = strtok((char*)args, "]");
if (citemName && citemName[0])
{
std::string itemName = citemName + 1;
WorldDatabase.escape_string(itemName);
QueryResult *result = WorldDatabase.PQuery("SELECT entry FROM item_template WHERE name = '%s'", itemName.c_str());
if (!result)
{
PSendSysMessage(LANG_COMMAND_COULDNOTFIND, citemName + 1);
SetSentErrorMessage(true);
return false;
}
itemId = result->Fetch()->GetUInt16();
delete result;
}
else
return false;
}
else // item_id or [name] Shift-click form |color|Hitem:item_id:0:0:0|h[name]|h|r
{
char* cId = ExtractKeyFromLink(&args, "Hitem");
if (!cId)
return false;
itemId = atol(cId);
}
// Ziskanie poctu itemov (nepovinny parameter, defaultne 1)
char* ccount = strtok(NULL, " ");
int32 countproto = 1;
if (ccount)
countproto = strtol(ccount, NULL, 10);
if (countproto == 0)
countproto = 1;
//Odrstranenie itemov sa nepovoluje
if (countproto < 0)
{
// TODO bodol by aj vypis
return false;
}
// Ziskanie typu itemu
ItemPrototype const *pProto = sObjectMgr.GetItemPrototype(itemId);
if (!pProto)
{
PSendSysMessage(LANG_COMMAND_ITEMIDINVALID, itemId);
SetSentErrorMessage(true);
return false;
}
Player* pl = m_session->GetPlayer();
// Prechod vsetkymi hracmi servra
HashMapHolder<Player>::MapType& m = ObjectAccessor::Instance().GetPlayers();
for (HashMapHolder<Player>::MapType::iterator itr = m.begin(); itr != m.end(); ++itr)
{
int32 count = countproto;
Player* plTarget = itr->second;
//Adding items
uint32 noSpaceForCount = 0;
// check space and find places
ItemPosCountVec dest;
uint8 msg = plTarget->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemId, count, &noSpaceForCount);
if (msg != EQUIP_ERR_OK) // convert to possible store amount
count -= noSpaceForCount;
if (count == 0 || dest.empty()) // can't add any
{
PSendSysMessage(LANG_ITEM_CANNOT_CREATE, itemId, noSpaceForCount);
SetSentErrorMessage(true);
continue;
}
Item* item = plTarget->StoreNewItem(dest, itemId, true, Item::GenerateItemRandomPropertyId(itemId));
if (count > 0 && item)
{
pl->SendNewItem(item, count, false, true);
if (pl != plTarget)
plTarget->SendNewItem(item, count, true, false);
}
if (noSpaceForCount > 0)
PSendSysMessage(LANG_ITEM_CANNOT_CREATE, itemId, noSpaceForCount);
}
//.........这里部分代码省略.........
示例15: strtol
// Mysteria Star
bool ChatHandler::HandleMarkCommand(char* args)
{
uint32 itemId = 38186;
int32 count;
// ak nieje parameter, pocet je defaultne 1
if (!*args)
count = 1;
else
count = strtol(args, NULL, 10);
// ak je vlozena hodnota chybna, vrati 0
if (count == 0)
return false;
// Ziskanie targetu hraca
Player* pl = m_session->GetPlayer();
Player* plTarget = getSelectedPlayer();
// Ak nieje target, da Eventerovi samotnemu.
//TODO: ma to vobec vyznam?
if (!plTarget)
plTarget = pl;
// Sprava do Logu (len pri detajlnom log-ovani)
sLog.outDetail(GetMangosString(LANG_ADDITEM), itemId, count);
// Snaha vytvorit objekt (malo by sa podarit ale aj motyka vystreli...)
ItemPrototype const *pProto = ObjectMgr::GetItemPrototype(itemId);
if (!pProto)
{
PSendSysMessage(LANG_COMMAND_ITEMIDINVALID, itemId);
SetSentErrorMessage(true);
return false;
}
// odobratie itemu (zaporny pocet)
if (count < 0)
{
if (!plTarget->HasItemCount(itemId, -count, false)) // itemId, count, inBankAlso
{
ChatHandler(pl->GetSession()).PSendSysMessage("You do not have enough Mysteria Star!");
pl->GetSession()->SendNotification("You do not have enough Mysteria Star!");
return false;
}
plTarget->DestroyItemCount(itemId, -count, true, false);
PSendSysMessage(LANG_REMOVEITEM, itemId, -count, GetNameLink(plTarget).c_str());
return true;
}
// Pridanie itemu
uint32 noSpaceForCount = 0;
// kontrola miesta v bagu a najdenie miesta
ItemPosCountVec dest;
uint8 msg = plTarget->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemId, count, &noSpaceForCount);
if (msg != EQUIP_ERR_OK) // convert to possible store amount
count -= noSpaceForCount;
if (count == 0 || dest.empty()) // can't add any
{
PSendSysMessage(LANG_ITEM_CANNOT_CREATE, itemId, noSpaceForCount);
SetSentErrorMessage(true);
return false;
}
Item* item = plTarget->StoreNewItem(dest, itemId, true, Item::GenerateItemRandomPropertyId(itemId));
// Odstranenie bindovania ak gm si da item sam aby ho mohol tradeovat
//
// TODO ma to vyznam?
/*
if(pl==plTarget)
for(ItemPosCountVec::const_iterator itr = dest.begin(); itr != dest.end(); ++itr)
if(Item* item1 = pl->GetItemByPos(itr->pos))
item1->SetBinding( false );
*/
// Pridanie itemu
if (count > 0 && item)
{
pl->SendNewItem(item, count, false, true);
if (pl != plTarget)
plTarget->SendNewItem(item, count, true, false);
}
// Chyba pri nedostatku miesta
if (noSpaceForCount > 0)
PSendSysMessage(LANG_ITEM_CANNOT_CREATE, itemId, noSpaceForCount);
return true;
}