bool CreatureObject::GetBuffExists(uint32 BuffIcon) { //Cycle through all buffs for the creature BuffList::iterator it = mBuffList.begin(); while(it != mBuffList.end()) { //Check if the Icon CRCs Match (ie Duplication) Buff* temp = *it; if(temp->GetIcon() == BuffIcon) { //Check if the duplicate isn't marked for deletion if(!temp->GetIsMarkedForDeletion()) { return true; } } it++; } return false; }
void BuffManager::SaveBuffs(PlayerObject* playerObject, uint64 currenttime) { //RemovedDeleted Buffs playerObject->CleanUpBuffs(); BuffList::iterator it = playerObject->GetBuffList()->begin(); while(it != playerObject->GetBuffList()->end()) { Buff* temp = *it; //Check if it is an active Buff if(!temp->GetIsMarkedForDeletion()) { //Save to DB, and remove from the Process Queue AddBuffToDB(temp, currenttime); gWorldManager->removeBuffToProcess(temp->GetID()); } //Free up Memory temp->EraseAttributes(); it = playerObject->GetBuffList()->erase(it); } }