//----------------------------------------------- // CHarvestPhrase harvestCorpseResult //----------------------------------------------- void CHarvestPhrase::harvestCorpseResult() { H_AUTO(CHarvestPhrase_harvestCorpseResult); // get harvester character CCharacter *character = PlayerManager.getChar( _ActorRowId ); if (character == NULL) { //nlwarning("<cbHarvestResult> Invalid player Id %s", playerId.toString().c_str() ); return; } // get harvested corpse const CEntityId &harvestedEntity = character->harvestedEntity(); CCreature *creature = CreatureManager.getCreature( harvestedEntity ); if (creature == NULL) { nlwarning("<cbHarvestResult> Invalid creature Id %s", harvestedEntity.toString().c_str() ); // reset harvest info character->resetHarvestInfos(); character->endHarvest(); return; } const vector< CCreatureRawMaterial> &mps = creature->getMps(); if ( character->harvestedMpIndex() >= mps.size() || character->harvestedMpQuantity() > mps[character->harvestedMpIndex()].Quantity ) { // reset harvest info character->resetHarvestInfos(); return; } uint16 quality = _MaxQuality; // create the mp items if any if (quality > 0) { if ( !character->createItemInInventory(INVENTORIES::bag, quality, character->harvestedMpQuantity(), _RawMaterialId, character->getId()) ) { // CMissionEventItem event(CMissionEvent::Harvest,playerId,harvestedEntity,_RawMaterialId,quality,character->harvestedMpQuantity()); // character->processMissionEvent(event); // error creating the object, hand probably not empty // character->resetHarvestInfos(); // return; } else { const CStaticItem *item = CSheets::getForm(_RawMaterialId); if (item) { ///\todo nico: check if this event exists // CMissionEventHarvest event(_RawMaterialId ,character->harvestedMpQuantity(),quality); // character->processMissionEvent( event ); SM_STATIC_PARAMS_3(params, STRING_MANAGER::integer, STRING_MANAGER::item, STRING_MANAGER::integer); params[0].Int = (sint32)character->harvestedMpQuantity(); params[1].SheetId = _RawMaterialId; params[2].Int = (sint32)quality; STRING_MANAGER::sendStringToClient( character->getEntityRowId(), "HARVEST_SUCCESS", params ); } } } // the mp have been destroyed -> do nothing else { } // remove the quantity of mp harvested from the ressource creature->removeMp( character->harvestedMpIndex(), character->harvestedMpQuantity() ); // reset harvest info character->resetHarvestInfos(); } // harvestCorpseResult //