Changeset 18 for trunk/src/game/Player.cpp
- Timestamp:
- 11/19/08 13:23:29 (17 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/game/Player.cpp
r12 r18 5795 5795 return; 5796 5796 5797 ReputationOnKillEntry const* Rep = objmgr.GetReputationOnKilEntry( pVictim->GetEntry());5797 ReputationOnKillEntry const* Rep = objmgr.GetReputationOnKilEntry(((Creature*)pVictim)->GetCreatureInfo()->Entry); 5798 5798 5799 5799 if(!Rep) … … 16381 16381 } 16382 16382 16383 // load vendor items if not yet 16384 pCreature->LoadGoods(); 16385 16386 CreatureItem* crItem = pCreature->FindItem(item); 16387 if(!crItem) 16383 VendorItemData const* vItems = pCreature->GetVendorItems(); 16384 if(!vItems || vItems->Empty()) 16388 16385 { 16389 16386 SendBuyError( BUY_ERR_CANT_FIND_ITEM, pCreature, item, 0); … … 16391 16388 } 16392 16389 16393 if( crItem->maxcount != 0 && crItem->count < count ) 16394 { 16395 SendBuyError( BUY_ERR_ITEM_ALREADY_SOLD, pCreature, item, 0); 16390 VendorItem const* crItem = vItems->FindItem(item); 16391 if(!crItem) 16392 { 16393 SendBuyError( BUY_ERR_CANT_FIND_ITEM, pCreature, item, 0); 16396 16394 return false; 16395 } 16396 16397 // check current item amount if it limited 16398 if( crItem->maxcount != 0 ) 16399 { 16400 if(pCreature->GetVendorItemCurrentCount(crItem) < pProto->BuyCount * count ) 16401 { 16402 SendBuyError( BUY_ERR_ITEM_ALREADY_SOLD, pCreature, item, 0); 16403 return false; 16404 } 16397 16405 } 16398 16406 … … 16509 16517 if(Item *it = StoreNewItem( dest, item, true )) 16510 16518 { 16511 if( crItem->maxcount != 0 ) 16512 crItem->count -= pProto->BuyCount * count; 16519 uint32 new_count = pCreature->UpdateVendorItemCurrentCount(crItem,pProto->BuyCount * count); 16513 16520 16514 16521 WorldPacket data(SMSG_BUY_ITEM, (8+4+4+4)); 16515 16522 data << pCreature->GetGUID(); 16516 data << (uint32)crItem->i d; // entry16517 data << (uint32) crItem->count;16523 data << (uint32)crItem->item; 16524 data << (uint32)(crItem->maxcount > 0 ? new_count : 0xFFFFFFFF); 16518 16525 data << (uint32)count; 16519 16526 GetSession()->SendPacket(&data); 16520 16527 16521 SendNewItem(it, count, true, false, false);16528 SendNewItem(it, pProto->BuyCount*count, true, false, false); 16522 16529 } 16523 16530 } … … 16549 16556 if(Item *it = EquipNewItem( dest, item, pProto->BuyCount * count, true )) 16550 16557 { 16551 if( crItem->maxcount != 0 ) 16552 crItem->count -= pProto->BuyCount * count; 16558 uint32 new_count = pCreature->UpdateVendorItemCurrentCount(crItem,pProto->BuyCount * count); 16553 16559 16554 16560 WorldPacket data(SMSG_BUY_ITEM, (8+4+4+4)); 16555 16561 data << pCreature->GetGUID(); 16556 data << (uint32)crItem->i d; // entry16557 data << (uint32) crItem->count;16562 data << (uint32)crItem->item; 16563 data << (uint32)(crItem->maxcount > 0 ? new_count : 0xFFFFFFFF); 16558 16564 data << (uint32)count; 16559 16565 GetSession()->SendPacket(&data); 16560 16566 16561 SendNewItem(it, count, true, false, false);16567 SendNewItem(it, pProto->BuyCount*count, true, false, false); 16562 16568 16563 16569 AutoUnequipOffhandIfNeed(); … … 16570 16576 } 16571 16577 16572 return crItem->maxcount!=0 ?true:false;16578 return crItem->maxcount!=0; 16573 16579 } 16574 16580 … … 17175 17181 // set fly flag if in fly form or taxi flight to prevent visually drop at ground in showup moment 17176 17182 if(HasAuraType(SPELL_AURA_MOD_INCREASE_FLIGHT_SPEED) || isInFlight()) 17177 SetUnitMovementFlags(GetUnitMovementFlags() |MOVEMENTFLAG_FLYING2);17183 AddUnitMovementFlag(MOVEMENTFLAG_FLYING2); 17178 17184 } 17179 17185 … … 18168 18174 return false; 18169 18175 } 18176 18177 bool Player::isAllowUseBattleGroundObject() 18178 { 18179 return ( //InBattleGround() && // in battleground - not need, check in other cases 18180 !IsMounted() && // not mounted 18181 !HasStealthAura() && // not stealthed 18182 !HasInvisibilityAura() && // not invisible 18183 !HasAura(SPELL_RECENTLY_DROPPED_FLAG, 0) && // can't pickup 18184 isAlive() // live player 18185 ); 18186 }