本文整理汇总了C++中Creature::AllLootRemovedFromCorpse方法的典型用法代码示例。如果您正苦于以下问题:C++ Creature::AllLootRemovedFromCorpse方法的具体用法?C++ Creature::AllLootRemovedFromCorpse怎么用?C++ Creature::AllLootRemovedFromCorpse使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Creature
的用法示例。
在下文中一共展示了Creature::AllLootRemovedFromCorpse方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DoLootRelease
//.........这里部分代码省略.........
// if the round robin player release, reset it.
if (player->GetGUID() == loot->roundRobinPlayer)
{
if (Group* group = player->GetGroup())
{
if (group->GetLootMethod() != MASTER_LOOT)
{
loot->roundRobinPlayer = 0;
}
}
else
loot->roundRobinPlayer = 0;
}
}
}
else if (IS_CORPSE_GUID(lguid)) // ONLY remove insignia at BG
{
Corpse* corpse = ObjectAccessor::GetCorpse(*player, lguid);
if (!corpse || !corpse->IsWithinDistInMap(_player, INTERACTION_DISTANCE))
return;
loot = &corpse->loot;
if (loot->isLooted())
{
loot->clear();
corpse->RemoveFlag(CORPSE_FIELD_DYNAMIC_FLAGS, CORPSE_DYNFLAG_LOOTABLE);
}
}
else if (IS_ITEM_GUID(lguid))
{
Item* pItem = player->GetItemByGuid(lguid);
if (!pItem)
return;
ItemTemplate const* proto = pItem->GetTemplate();
// destroy only 5 items from stack in case prospecting and milling
if (proto->Flags & (ITEM_PROTO_FLAG_PROSPECTABLE | ITEM_PROTO_FLAG_MILLABLE))
{
pItem->m_lootGenerated = false;
pItem->loot.clear();
uint32 count = pItem->GetCount();
// >=5 checked in spell code, but will work for cheating cases also with removing from another stacks.
if (count > 5)
count = 5;
player->DestroyItemCount(pItem, count, true);
}
else
// FIXME: item must not be deleted in case not fully looted state. But this pre-request implement loot saving in DB at item save. Or cheating possible.
player->DestroyItem(pItem->GetBagSlot(), pItem->GetSlot(), true);
return; // item can be looted only single player
}
else
{
Creature* creature = GetPlayer()->GetMap()->GetCreature(lguid);
bool lootAllowed = creature && creature->isAlive() == (player->getClass() == CLASS_ROGUE && creature->lootForPickPocketed);
if (!lootAllowed || !creature->IsWithinDistInMap(_player, INTERACTION_DISTANCE))
return;
loot = &creature->loot;
if (loot->isLooted())
{
// skip pickpocketing loot for speed, skinning timer reduction is no-op in fact
if (!creature->isAlive())
creature->AllLootRemovedFromCorpse();
creature->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE);
loot->clear();
}
else
{
// if the round robin player release, reset it.
if (player->GetGUID() == loot->roundRobinPlayer)
{
if (Group* group = player->GetGroup())
{
if (group->GetLootMethod() != MASTER_LOOT)
{
loot->roundRobinPlayer = 0;
group->SendLooter(creature, NULL);
// force update of dynamic flags, otherwise other group's players still not able to loot.
creature->ForceValuesUpdateAtIndex(UNIT_DYNAMIC_FLAGS);
}
}
else
loot->roundRobinPlayer = 0;
}
}
}
//Player is not looking at loot list, he doesn't need to see updates on the loot list
loot->RemoveLooter(player->GetGUID());
}
示例2: DoLootRelease
//.........这里部分代码省略.........
go->SetLootState(GO_ACTIVATED);
if (player->GetInstanceId())
{
Map *map = go->GetMap();
if (map->IsDungeon())
{
if (map->IsRaidOrHeroicDungeon())
{
((InstanceMap *)map)->PermBindAllPlayers(player);
}
else
{
// the reset time is set but not added to the scheduler
// until the players leave the instance
time_t resettime = go->GetRespawnTimeEx() + 2 * HOUR;
if(InstanceSave *save = player->GetMap()->GetInstanceSave())
if(save->GetResetTime() < resettime) save->SetResetTime(resettime);
}
}
}
break;
}
case HIGHGUID_CORPSE: // ONLY remove insignia at BG
{
Corpse *corpse = _player->GetMap()->GetCorpse(lguid);
if (!corpse || !corpse->IsWithinDistInMap(_player,INTERACTION_DISTANCE) )
return;
loot = &corpse->loot;
if (loot->isLooted())
{
loot->clear();
corpse->RemoveFlag(CORPSE_FIELD_DYNAMIC_FLAGS, CORPSE_DYNFLAG_LOOTABLE);
}
break;
}
case HIGHGUID_ITEM:
{
Item *pItem = player->GetItemByGuid(lguid );
if(!pItem)
return;
ItemPrototype const* proto = pItem->GetProto();
// destroy only 5 items from stack in case prospecting and milling
if( (proto->BagFamily & (BAG_FAMILY_MASK_MINING_SUPP|BAG_FAMILY_MASK_HERBS)) &&
proto->Class == ITEM_CLASS_TRADE_GOODS)
{
pItem->m_lootGenerated = false;
pItem->loot.clear();
uint32 count = pItem->GetCount();
// >=5 checked in spell code, but will work for cheating cases also with removing from another stacks.
if(count > 5)
count = 5;
player->DestroyItemCount(pItem, count, true);
}
else
// FIXME: item don't must be deleted in case not fully looted state. But this pre-request implement loot saving in DB at item save. Or checting possible.
player->DestroyItem( pItem->GetBagSlot(),pItem->GetSlot(), true);
return; // item can be looted only single player
}
case HIGHGUID_UNIT:
{
Creature* pCreature = GetPlayer()->GetMap()->GetCreature(lguid);
bool ok_loot = pCreature && pCreature->isAlive() == (player->getClass()==CLASS_ROGUE && pCreature->lootForPickPocketed);
if ( !ok_loot || !pCreature->IsWithinDistInMap(_player,INTERACTION_DISTANCE) )
return;
loot = &pCreature->loot;
// update next looter
if(Group* group = pCreature->GetGroupLootRecipient())
if (group->GetLooterGuid() == player->GetObjectGuid())
group->UpdateLooterGuid(pCreature);
if (loot->isLooted())
{
// for example skinning after normal loot
pCreature->PrepareBodyLootState();
if(!pCreature->isAlive())
pCreature->AllLootRemovedFromCorpse();
}
break;
}
default:
{
sLog.outError("%s is unsupported for looting.", lguid.GetString().c_str());
return;
}
}
//Player is not looking at loot list, he doesn't need to see updates on the loot list
loot->RemoveLooter(player->GetGUID());
}
示例3: DoLootRelease
//.........这里部分代码省略.........
case HIGHGUID_CORPSE: // ONLY remove insignia at BG
{
Corpse *corpse = _player->GetMap()->GetCorpse(lguid);
if (!corpse || !corpse->IsWithinDistInMap(_player,INTERACTION_DISTANCE) )
return;
loot = &corpse->loot;
if (loot->isLooted())
{
loot->clear();
corpse->RemoveFlag(CORPSE_FIELD_DYNAMIC_FLAGS, CORPSE_DYNFLAG_LOOTABLE);
}
break;
}
case HIGHGUID_ITEM:
{
Item *pItem = player->GetItemByGuid(lguid );
if (!pItem)
return;
switch (pItem->loot.loot_type)
{
// temporary loot in stacking items, clear loot state, no auto loot move
case LOOT_MILLING:
case LOOT_PROSPECTING:
{
uint32 count = pItem->GetCount();
// >=5 checked in spell code, but will work for cheating cases also with removing from another stacks.
if(count > 5)
count = 5;
// reset loot for allow repeat looting if stack > 5
pItem->loot.clear();
pItem->SetLootState(ITEM_LOOT_REMOVED);
player->DestroyItemCount(pItem, count, true);
break;
}
// temporary loot, auto loot move
case LOOT_DISENCHANTING:
{
if (!pItem->loot.isLooted())
player->AutoStoreLoot(pItem->loot); // can be lost if no space
pItem->loot.clear();
pItem->SetLootState(ITEM_LOOT_REMOVED);
player->DestroyItem( pItem->GetBagSlot(),pItem->GetSlot(), true);
break;
}
// normal persistence loot
default:
{
// must be destroyed only if no loot
if (pItem->loot.isLooted())
{
pItem->SetLootState(ITEM_LOOT_REMOVED);
player->DestroyItem( pItem->GetBagSlot(),pItem->GetSlot(), true);
}
break;
}
}
return; // item can be looted only single player
}
case HIGHGUID_UNIT:
case HIGHGUID_VEHICLE:
{
Creature* pCreature = GetPlayer()->GetMap()->GetCreature(lguid);
bool ok_loot = pCreature && pCreature->isAlive() == (player->getClass()==CLASS_ROGUE && pCreature->lootForPickPocketed);
if ( !ok_loot || !pCreature->IsWithinDistInMap(_player,INTERACTION_DISTANCE) )
return;
loot = &pCreature->loot;
// update next looter
if(Group* group = pCreature->GetGroupLootRecipient())
if (group->GetLooterGuid() == player->GetObjectGuid())
group->UpdateLooterGuid(pCreature);
if (loot->isLooted())
{
// for example skinning after normal loot
pCreature->PrepareBodyLootState();
if(!pCreature->isAlive())
pCreature->AllLootRemovedFromCorpse();
}
break;
}
default:
{
sLog.outError("%s is unsupported for looting.", lguid.GetString().c_str());
return;
}
}
//Player is not looking at loot list, he doesn't need to see updates on the loot list
loot->RemoveLooter(player->GetGUID());
}
示例4: DoLootRelease
//.........这里部分代码省略.........
// not check distance for GO in case owned GO (fishing bobber case, for example) or Fishing hole GO
if (!go || (go->GetOwnerGUID() != _player->GetGUID() && go->GetGoType() != GAMEOBJECT_TYPE_FISHINGHOLE) && !go->IsWithinDistInMap(_player,INTERACTION_DISTANCE))
return;
loot = &go->loot;
if (go->GetGoType() == GAMEOBJECT_TYPE_DOOR)
{
// locked doors are opened with spelleffect openlock, prevent remove its as looted
go->UseDoorOrButton();
}
else if ((go->GetGoType() == GAMEOBJECT_TYPE_CHEST && go->GetGOInfo()->chest.consumable) || loot->isLooted())
{
if (go->GetGoType() == GAMEOBJECT_TYPE_FISHINGHOLE)
{ // The fishing hole used once more
go->AddUse(); // if the max usage is reached, will be despawned in next tick
if (go->GetUseCount()>=irand(go->GetGOInfo()->fishinghole.minSuccessOpens,go->GetGOInfo()->fishinghole.maxSuccessOpens))
{
go->SetLootState(GO_JUST_DEACTIVATED);
}
else
go->SetLootState(GO_READY);
}
else if (go->GetGoType() == GAMEOBJECT_TYPE_FISHINGNODE)
go->SetLootState(GO_JUST_DEACTIVATED);
loot->clear();
}
}
else if (IS_CORPSE_GUID(lguid)) // ONLY remove insignia at BG
{
Corpse *corpse = ObjectAccessor::GetCorpse(*player, lguid);
if (!corpse || !corpse->IsWithinDistInMap(_player,INTERACTION_DISTANCE))
return;
loot = &corpse->loot;
if (loot->isLooted())
{
loot->clear();
corpse->RemoveFlag(CORPSE_FIELD_DYNAMIC_FLAGS, CORPSE_DYNFLAG_LOOTABLE);
}
}
else if (IS_ITEM_GUID(lguid))
{
Item *pItem = player->GetItemByGuid(lguid);
if (!pItem)
return;
ItemPrototype const* proto = pItem->GetProto();
// destroy only 5 items from stack in case prospecting and milling
if ((proto->BagFamily & BAG_FAMILY_MASK_MINING_SUPP) &&
proto->Class == ITEM_CLASS_TRADE_GOODS)
{
pItem->m_lootGenerated = false;
pItem->loot.clear();
uint32 count = 5;
player->DestroyItemCount(pItem, count, true);
}
else
// FIXME: item don't must be deleted in case not fully looted state. But this pre-request implement loot saving in DB at item save. Or checting possible.
player->DestroyItem(pItem->GetBagSlot(),pItem->GetSlot(), true);
return; // item can be looted only single player
}
else
{
Creature* pCreature = GetPlayer()->GetMap()->GetCreature(lguid);
bool ok_loot = pCreature && pCreature->isAlive() == (player->getClass()==CLASS_ROGUE && pCreature->lootForPickPocketed);
if (!ok_loot || !pCreature->IsWithinDistInMap(_player,INTERACTION_DISTANCE))
return;
loot = &pCreature->loot;
if (player->GetGUID() == loot->looterGUID)
{
loot->looterGUID = 0;
if (Group *group = player->GetGroup())
group->SendRoundRobin(loot, pCreature);
}
if (loot->isLooted())
{
// skip pickpocketing loot for speed, skinning timer redunction is no-op in fact
if (!pCreature->isAlive())
pCreature->AllLootRemovedFromCorpse();
pCreature->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE);
loot->clear();
}
}
//Player is not looking at loot list, he doesn't need to see updates on the loot list
loot->RemoveLooter(player->GetGUID());
// should be fixed after some research in loot implementation etc
// loot->RemoveQuestLoot(player);
}
示例5: DoLootRelease
//.........这里部分代码省略.........
else
go->SetLootState(GO_READY);
}
else
go->SetLootState(GO_JUST_DEACTIVATED);
loot->clear();
}
else
{
// not fully looted object
go->SetLootState(GO_ACTIVATED, player);
// if the round robin player release, reset it.
if (player->GetGUID() == loot->roundRobinPlayer)
loot->roundRobinPlayer = 0;
}
}
else if (IS_CORPSE_GUID(lguid)) // ONLY remove insignia at BG
{
Corpse* corpse = ObjectAccessor::GetCorpse(*player, lguid);
if (!corpse || !corpse->IsWithinDistInMap(_player, INTERACTION_DISTANCE))
return;
loot = &corpse->loot;
if (loot->isLooted())
{
loot->clear();
corpse->RemoveFlag(CORPSE_FIELD_DYNAMIC_FLAGS, CORPSE_DYNFLAG_LOOTABLE);
}
}
else if (IS_ITEM_GUID(lguid))
{
Item* pItem = player->GetItemByGuid(lguid);
if (!pItem)
return;
ItemTemplate const* proto = pItem->GetTemplate();
// destroy only 5 items from stack in case prospecting and milling
if (proto->Flags & (ITEM_PROTO_FLAG_PROSPECTABLE | ITEM_PROTO_FLAG_MILLABLE))
{
pItem->m_lootGenerated = false;
pItem->loot.clear();
uint32 count = pItem->GetCount();
// >=5 checked in spell code, but will work for cheating cases also with removing from another stacks.
if (count > 5)
count = 5;
player->DestroyItemCount(pItem, count, true);
}
else
{
if (pItem->loot.isLooted()) // Only delete item if no loot or money (unlooted loot is saved to db)
player->DestroyItem(pItem->GetBagSlot(), pItem->GetSlot(), true);
}
return; // item can be looted only single player
}
else
{
Creature* creature = GetPlayer()->GetMap()->GetCreature(lguid);
bool lootAllowed = creature && creature->IsAlive() == (player->getClass() == CLASS_ROGUE && creature->lootForPickPocketed);
if (!lootAllowed || !creature->IsWithinDistInMap(_player, INTERACTION_DISTANCE))
return;
loot = &creature->loot;
if (loot->isLooted())
{
// skip pickpocketing loot for speed, skinning timer reduction is no-op in fact
if (!creature->IsAlive())
creature->AllLootRemovedFromCorpse();
creature->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE);
loot->clear();
}
else
{
// if the round robin player release, reset it.
if (player->GetGUID() == loot->roundRobinPlayer)
{
loot->roundRobinPlayer = 0;
if (Group* group = player->GetGroup())
{
group->SendLooter(creature, NULL);
// force update of dynamic flags, otherwise other group's players still not able to loot.
creature->ForceValuesUpdateAtIndex(UNIT_DYNAMIC_FLAGS);
}
}
}
}
//Player is not looking at loot list, he doesn't need to see updates on the loot list
loot->RemoveLooter(player->GetGUID());
}
示例6: DoLootRelease
//.........这里部分代码省略.........
case LOOT_PROSPECTING:
{
uint32 count = pItem->GetCount();
// >=5 checked in spell code, but will work for cheating cases also with removing from another stacks.
if (count > 5)
count = 5;
// reset loot for allow repeat looting if stack > 5
pItem->loot.clear();
pItem->SetLootState(ITEM_LOOT_REMOVED);
player->DestroyItemCount(pItem, count, true);
break;
}
// temporary loot, auto loot move
case LOOT_DISENCHANTING:
{
if (!pItem->loot.isLooted())
{ player->AutoStoreLoot(pItem->loot); } // can be lost if no space
pItem->loot.clear();
pItem->SetLootState(ITEM_LOOT_REMOVED);
player->DestroyItem(pItem->GetBagSlot(), pItem->GetSlot(), true);
break;
}
// normal persistence loot
default:
{
// must be destroyed only if no loot
if (pItem->loot.isLooted())
{
pItem->SetLootState(ITEM_LOOT_REMOVED);
player->DestroyItem(pItem->GetBagSlot(), pItem->GetSlot(), true);
}
break;
}
}
return; // item can be looted only single player
}
case HIGHGUID_UNIT:
{
/* Get creature pointer */
Creature* pCreature = GetPlayer()->GetMap()->GetCreature(lguid);
bool ok_loot = (pCreature && // The creature exists (we dont have a null pointer)
pCreature->IsAlive() == // Creature is alive and we're a rogue and creature can be pickpocketed
(player->getClass() == CLASS_ROGUE && pCreature->lootForPickPocketed));
if (!ok_loot || !pCreature->IsWithinDistInMap(_player, INTERACTION_DISTANCE))
{ return; }
/* Copy creature loot to loot variable */
loot = &pCreature->loot;
/* Update for other players. */
if(!loot->isLooted())
{
Group const* group = pCreature->GetGroupLootRecipient();
if (group && !pCreature->hasBeenLootedOnce)
{
// Checking whether it has been looted once by the designed looter (master loot case).
switch (group->GetLootMethod())
{
case FREE_FOR_ALL:
case NEED_BEFORE_GREED:
case ROUND_ROBIN:
case GROUP_LOOT:
{
pCreature->hasBeenLootedOnce = true;
break;
}
case MASTER_LOOT:
{
pCreature->hasBeenLootedOnce = (group->GetLooterGuid() == player->GetObjectGuid());
break;
}
}
pCreature->MarkFlagUpdateForClient(UNIT_DYNAMIC_FLAGS);
}
}
/* We've completely looted the creature, mark it as available for skinning */
if (loot->isLooted() && !pCreature->IsAlive())
{
/* Update Creature: for example skinning after normal loot */
pCreature->PrepareBodyLootState();
pCreature->AllLootRemovedFromCorpse();
}
break;
}
default:
{
sLog.outError("%s is unsupported for looting.", lguid.GetString().c_str());
return;
}
}
// Player is not looking at loot list, he doesn't need to see updates on the loot list
loot->RemoveLooter(player->GetObjectGuid());
}
示例7: DoLootRelease
//.........这里部分代码省略.........
if (roll_chance_f(100*chance+skill))
{
go->SetLootState(GO_READY);
}
else // not have more uses
go->SetLootState(GO_JUST_DEACTIVATED);
}
else // 100% chance until min uses
go->SetLootState(GO_READY);
}
else // max uses already
go->SetLootState(GO_JUST_DEACTIVATED);
}
else // not vein
go->SetLootState(GO_JUST_DEACTIVATED);
}
else if (go->GetGoType() == GAMEOBJECT_TYPE_FISHINGHOLE)
{ // The fishing hole used once more
go->AddUse(); // if the max usage is reached, will be despawned in next tick
if (go->GetUseCount() >= irand(go->GetGOInfo()->fishinghole.minSuccessOpens,go->GetGOInfo()->fishinghole.maxSuccessOpens))
{
go->SetLootState(GO_JUST_DEACTIVATED);
}
else
go->SetLootState(GO_READY);
}
else // not chest (or vein/herb/etc)
go->SetLootState(GO_JUST_DEACTIVATED);
loot->clear();
}
else
// not fully looted object
go->SetLootState(GO_ACTIVATED);
}
else if (IS_CORPSE_GUID(lguid)) // ONLY remove insignia at BG
{
Corpse *corpse = ObjectAccessor::GetCorpse(*player, lguid);
if (!corpse || !corpse->IsWithinDistInMap(_player,INTERACTION_DISTANCE))
return;
loot = &corpse->loot;
if (loot->isLooted())
{
loot->clear();
corpse->RemoveFlag(CORPSE_FIELD_DYNAMIC_FLAGS, CORPSE_DYNFLAG_LOOTABLE);
}
}
else if (IS_ITEM_GUID(lguid))
{
Item *pItem = player->GetItemByGuid(lguid);
if (!pItem)
return;
if ((pItem->GetProto()->BagFamily & BAG_FAMILY_MASK_MINING_SUPP) &&
pItem->GetProto()->Class == ITEM_CLASS_TRADE_GOODS &&
pItem->GetCount() >= 5)
{
pItem->m_lootGenerated = false;
pItem->loot.clear();
uint32 count = 5;
player->DestroyItemCount(pItem, count, true);
}
else
// FIXME: item must not be deleted in case not fully looted state. But this pre-request implement loot saving in DB at item save. Or cheating possible.
player->DestroyItem(pItem->GetBagSlot(),pItem->GetSlot(), true);
return; // item can be looted only single player
}
else
{
Creature* pCreature = GetPlayer()->GetMap()->GetCreature(lguid);
bool ok_loot = pCreature && pCreature->isAlive() == (player->getClass() == CLASS_ROGUE && pCreature->lootForPickPocketed);
if (!ok_loot || !pCreature->IsWithinDistInMap(_player,INTERACTION_DISTANCE))
return;
loot = &pCreature->loot;
// update next looter
if (Player *recipient = pCreature->GetLootRecipient())
if (Group* group = recipient->GetGroup())
if (group->GetLooterGuid() == player->GetGUID())
group->UpdateLooterGuid(pCreature);
if (loot->isLooted())
{
// skip pickpocketing loot for speed, skinning timer redunction is no-op in fact
if (!pCreature->isAlive())
pCreature->AllLootRemovedFromCorpse();
pCreature->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE);
loot->clear();
}
}
//Player is not looking at loot list, he doesn't need to see updates on the loot list
loot->RemoveLooter(player->GetGUID());
}