本文整理汇总了C++中GameObject::GetGOInfo方法的典型用法代码示例。如果您正苦于以下问题:C++ GameObject::GetGOInfo方法的具体用法?C++ GameObject::GetGOInfo怎么用?C++ GameObject::GetGOInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GameObject
的用法示例。
在下文中一共展示了GameObject::GetGOInfo方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HandleAreaTrigger
void BattleGroundNA::HandleAreaTrigger(Player *Source, uint32 Trigger)
{
// this is wrong way to implement these things. On official it done by gameobject spell cast.
if(GetStatus() != STATUS_IN_PROGRESS)
return;
uint32 SpellId = 0;
uint64 buff_guid = 0;
switch(Trigger)
{
case 4536: // buff trigger?
case 4537: // buff trigger?
break;
default:
sLog.outError("WARNING: Unhandled AreaTrigger in Battleground: %u", Trigger);
Source->GetSession()->SendAreaTriggerMessage("Warning: Unhandled AreaTrigger in Battleground: %u", Trigger);
break;
}
if(buff_guid)
{
GameObject *obj = HashMapHolder<GameObject>::Find(buff_guid);
if(obj)
{
if(!obj->isSpawned())
return; // buff not spawned yet
obj->SetRespawnTime(BUFF_RESPAWN_TIME);
obj->SetLootState(GO_LOOTED);
SpellId = obj->GetGOInfo()->data3;
if(SpellId)
Source->CastSpell(Source, SpellId, true);
}
}
}
示例2: HandleGameObjectActivateCommand
static bool HandleGameObjectActivateCommand(ChatHandler* handler, char const* args)
{
if (!*args)
return false;
char* id = handler->extractKeyFromLink((char*)args, "Hgameobject");
if (!id)
return false;
ObjectGuid::LowType guidLow = atoul(id);
if (!guidLow)
return false;
GameObject* object = handler->GetObjectFromPlayerMapByDbGuid(guidLow);
if (!object)
{
handler->PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, guidLow);
handler->SetSentErrorMessage(true);
return false;
}
uint32_t const autoCloseTime = object->GetGOInfo()->GetAutoCloseTime() ? 10000u : 0u;
// Activate
object->SetLootState(GO_READY);
object->UseDoorOrButton(autoCloseTime, false, handler->GetSession()->GetPlayer());
handler->PSendSysMessage("Object activated!");
return true;
}
示例3: HandleGameObjectMoveCommand
//move selected object
static bool HandleGameObjectMoveCommand(ChatHandler* handler, char const* args)
{
uint32 guidLow = GetGuidLowFromArgsOrLastTargetedGo(handler, args);
if (!guidLow)
return false;
GameObject* object = NULL;
// by DB guid
if (GameObjectData const* gameObjectData = sObjectMgr->GetGOData(guidLow))
object = handler->GetObjectGlobalyWithGuidOrNearWithDbGuid(guidLow, gameObjectData->id);
if (!object)
{
handler->PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, guidLow);
handler->SetSentErrorMessage(true);
return false;
}
char* toX = strtok(NULL, " ");
char* toY = strtok(NULL, " ");
char* toZ = strtok(NULL, " ");
if (!toX)
{
Player* player = handler->GetSession()->GetPlayer();
object->Relocate(player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), object->GetOrientation());
object->DestroyForNearbyPlayers();
object->UpdateObjectVisibility();
}
else
{
if (!toY || !toZ)
return false;
float x = (float)atof(toX);
float y = (float)atof(toY);
float z = (float)atof(toZ);
if (!MapManager::IsValidMapCoord(object->GetMapId(), x, y, z))
{
handler->PSendSysMessage(LANG_INVALID_TARGET_COORD, x, y, object->GetMapId());
handler->SetSentErrorMessage(true);
return false;
}
object->Relocate(x, y, z, object->GetOrientation());
object->DestroyForNearbyPlayers();
object->UpdateObjectVisibility();
}
object->SaveToDB();
object->Refresh();
handler->PSendSysMessage(LANG_COMMAND_MOVEOBJMESSAGE, object->GetGUIDLow(), object->GetGOInfo()->name.c_str(), object->GetGUIDLow());
return true;
}
示例4: SendChangePhase
void BfCapturePoint::SendChangePhase()
{
GameObject* capturePoint = GetCapturePointGo();
if (!capturePoint)
return;
for (uint8 team = 0; team < 2; ++team)
for (GuidSet::iterator itr = m_activePlayers[team].begin(); itr != m_activePlayers[team].end(); ++itr) // send to all players present in the area
if (Player* player = ObjectAccessor::FindPlayer(*itr))
{
// send this too, sometimes the slider disappears, dunno why :(
player->SendUpdateWorldState(capturePoint->GetGOInfo()->capturePoint.worldState1, 1);
// send these updates to only the ones in this objective
player->SendUpdateWorldState(capturePoint->GetGOInfo()->capturePoint.worldstate2, (uint32) ceil((m_value + m_maxValue) / (2 * m_maxValue) * 100.0f));
// send this too, sometimes it resets :S
player->SendUpdateWorldState(capturePoint->GetGOInfo()->capturePoint.worldstate3, m_neutralValuePct);
}
}
示例5: HandleGameObjectTurnCommand
//turn selected object
static bool HandleGameObjectTurnCommand(ChatHandler* handler, char const* args)
{
// number or [name] Shift-click form |color|Hgameobject:go_id|h[name]|h|r
char* id = handler->extractKeyFromLink((char*)args, "Hgameobject");
if (!id)
return false;
uint32 guidLow = atoi(id);
if (!guidLow)
return false;
GameObject* object = nullptr;
// by DB guid
if (GameObjectData const* gameObjectData = sObjectMgr->GetGOData(guidLow))
object = handler->GetObjectGlobalyWithGuidOrNearWithDbGuid(guidLow, gameObjectData->id);
if (!object)
{
handler->PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, guidLow);
handler->SetSentErrorMessage(true);
return false;
}
char* orientation = strtok(nullptr, " ");
float oz = 0.f, oy = 0.f, ox = 0.f;
if (orientation)
{
oz = float(atof(orientation));
orientation = strtok(nullptr, " ");
if (orientation)
{
oy = float(atof(orientation));
orientation = strtok(nullptr, " ");
if (orientation)
ox = float(atof(orientation));
}
}
else
{
Player* player = handler->GetSession()->GetPlayer();
oz = player->GetOrientation();
}
object->SetWorldRotationAngles(oz, oy, ox);
object->DestroyForNearbyPlayers();
object->UpdateObjectVisibility();
object->SaveToDB();
object->Refresh();
handler->PSendSysMessage(LANG_COMMAND_TURNOBJMESSAGE, object->GetGUIDLow(), object->GetGOInfo()->name.c_str(), object->GetGUIDLow(), oz, oy, ox);
return true;
}
示例6: HandleGameObjectSetScaleCommand
static bool HandleGameObjectSetScaleCommand(ChatHandler* handler, char const* args)
{
// number or [name] Shift-click form |color|Hgameobject:go_id|h[name]|h|r
char* id = handler->extractKeyFromLink((char*)args, "Hgameobject");
if (!id)
return false;
uint32 guidLow = atoi(id);
if (!guidLow)
return false;
GameObject* object = NULL;
if (GameObjectData const* gameObjectData = sObjectMgr->GetGOData(guidLow))
object = handler->GetObjectGlobalyWithGuidOrNearWithDbGuid(guidLow, gameObjectData->id);
if (!object)
{
handler->PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, guidLow);
handler->SetSentErrorMessage(true);
return false;
}
char* scale_temp = strtok(NULL, " ");
if (!scale_temp)
{
handler->SendSysMessage(LANG_BAD_VALUE);
handler->SetSentErrorMessage(true);
return false;
}
float scale = atof(scale_temp);
if (scale <= 0.0f)
{
scale = object->GetGOInfo()->size;
const_cast<GameObjectData*>(object->GetGOData())->size = -1.0f;
}
else
{
const_cast<GameObjectData*>(object->GetGOData())->size = scale;
}
object->SetObjectScale(scale);
object->DestroyForNearbyPlayers();
object->UpdateObjectVisibility();
object->SaveToDB();
handler->PSendSysMessage("Set %s scale to %f", object->GetGUID().ToString(), scale);
return true;
}
示例7: HandleGameObjectTurnCommand
//turn selected object
static bool HandleGameObjectTurnCommand(ChatHandler* handler, const char* args)
{
// number or [name] Shift-click form |color|Hgameobject:go_id|h[name]|h|r
char* cId = handler->extractKeyFromLink((char*)args,"Hgameobject");
if (!cId)
return false;
uint32 lowguid = atoi(cId);
if (!lowguid)
return false;
GameObject* obj = NULL;
// by DB guid
if (GameObjectData const* go_data = sObjectMgr->GetGOData(lowguid))
obj = handler->GetObjectGlobalyWithGuidOrNearWithDbGuid(lowguid,go_data->id);
if (!obj)
{
handler->PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, lowguid);
handler->SetSentErrorMessage(true);
return false;
}
char* po = strtok(NULL, " ");
float o;
if (po)
{
o = (float)atof(po);
}
else
{
Player *chr = handler->GetSession()->GetPlayer();
o = chr->GetOrientation();
}
obj->Relocate(obj->GetPositionX(), obj->GetPositionY(), obj->GetPositionZ(), o);
obj->UpdateRotationFields();
obj->DestroyForNearbyPlayers();
obj->UpdateObjectVisibility();
obj->SaveToDB();
obj->Refresh();
handler->PSendSysMessage(LANG_COMMAND_TURNOBJMESSAGE, obj->GetGUIDLow(), obj->GetGOInfo()->name, obj->GetGUIDLow(), o);
return true;
}
示例8: HandleGameObjectTurnCommand
//turn selected object
static bool HandleGameObjectTurnCommand(ChatHandler* handler, char const* args)
{
// number or [name] Shift-click form |color|Hgameobject:go_id|h[name]|h|r
char* id = handler->extractKeyFromLink((char*)args, "Hgameobject");
if (!id)
return false;
ObjectGuid::LowType guidLow = strtoull(id, nullptr, 10);
if (!guidLow)
return false;
GameObject* object = NULL;
// by DB guid
if (GameObjectData const* gameObjectData = sObjectMgr->GetGOData(guidLow))
object = handler->GetObjectGlobalyWithGuidOrNearWithDbGuid(guidLow, gameObjectData->id);
if (!object)
{
handler->PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, guidLow);
handler->SetSentErrorMessage(true);
return false;
}
char* orientation = strtok(NULL, " ");
float o;
if (orientation)
o = (float)atof(orientation);
else
{
Player* player = handler->GetSession()->GetPlayer();
o = player->GetOrientation();
}
object->Relocate(object->GetPositionX(), object->GetPositionY(), object->GetPositionZ(), o);
object->RelocateStationaryPosition(object->GetPositionX(), object->GetPositionY(), object->GetPositionZ(), o);
object->UpdateRotationFields();
object->DestroyForNearbyPlayers();
object->UpdateObjectVisibility();
object->SaveToDB();
handler->PSendSysMessage(LANG_COMMAND_TURNOBJMESSAGE, object->GetSpawnId(), object->GetGOInfo()->name.c_str(), object->GetGUID().ToString().c_str(), o);
return true;
}
示例9: HandleGameObjectTurnCommand
//turn selected object
static bool HandleGameObjectTurnCommand(ChatHandler* handler, char const* args)
{
uint32 guidLow = GetGuidLowFromArgsOrLastTargetedGo(handler, args);
if (!guidLow)
return false;
GameObject* object = NULL;
// by DB guid
if (GameObjectData const* gameObjectData = sObjectMgr->GetGOData(guidLow))
object = handler->GetObjectGlobalyWithGuidOrNearWithDbGuid(guidLow, gameObjectData->id);
if (!object)
{
handler->PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, guidLow);
handler->SetSentErrorMessage(true);
return false;
}
char* orientation = strtok(NULL, " ");
float o;
if (orientation)
o = (float)atof(orientation);
else
{
Player* player = handler->GetSession()->GetPlayer();
o = player->GetOrientation();
}
object->Relocate(object->GetPositionX(), object->GetPositionY(), object->GetPositionZ(), o);
object->UpdateRotationFields();
object->DestroyForNearbyPlayers();
object->UpdateObjectVisibility();
object->SaveToDB();
object->Refresh();
handler->PSendSysMessage(LANG_COMMAND_TURNOBJMESSAGE, object->GetGUIDLow(), object->GetGOInfo()->name.c_str(), object->GetGUIDLow(), o);
return true;
}
示例10: ActivateAreaFissures
void instance_naxxramas::ActivateAreaFissures(ChamberArea AreaNo)
{
for (std::list<uint64>::iterator itr = lFissuresGUIDs[AreaNo].begin(); itr != lFissuresGUIDs[AreaNo].end(); ++itr)
{
GameObject* pFissure = instance->GetGameObject(*itr);
if (!pFissure)
continue;
float radius = 4.0f;
Player* pPlayer = NULL;
MaNGOS::AnyPlayerInObjectRangeCheck p_check(pFissure, radius);
MaNGOS::PlayerSearcher<MaNGOS::AnyPlayerInObjectRangeCheck> checker(pFissure, pPlayer , p_check);
Cell::VisitAllObjects(pFissure, checker, radius);
if (pPlayer)
pPlayer->CastSpell(pPlayer, pFissure->GetGOInfo()->trap.spellId, true, NULL, NULL, pFissure->GetGUID());
pFissure->SendGameObjectCustomAnim(pFissure->GetGUID());
}
}
示例11: Execute
bool UseMeetingStoneAction::Execute(Event event)
{
Player* master = GetMaster();
if (!master)
return false;
WorldPacket p(event.getPacket());
p.rpos(0);
ObjectGuid guid;
p >> guid;
if (master->GetSelectedPlayer() && master->GetSelectedPlayer() != bot)
return false;
if (!master->GetSelectedPlayer() && master->GetGroup() != bot->GetGroup())
return false;
if (master->IsBeingTeleported())
return false;
if (bot->IsInCombat())
{
ai->TellMasterNoFacing("I am in combat");
return false;
}
Map* map = master->GetMap();
if (!map)
return NULL;
GameObject *gameObject = map->GetGameObject(guid);
if (!gameObject)
return false;
const GameObjectTemplate* goInfo = gameObject->GetGOInfo();
if (!goInfo || goInfo->type != GAMEOBJECT_TYPE_SUMMONING_RITUAL)
return false;
return Teleport();
}
示例12: HandleGameObjectUseOpcode
void WorldSession::HandleGameObjectUseOpcode(WorldPacket& recv_data)
{
uint64 guid;
recv_data >> guid;
DEBUG_LOG("WORLD: Recvd CMSG_GAMEOBJ_USE Message [guid=%u]", GUID_LOPART(guid));
GameObject* obj = GetPlayer()->GetMap()->GetGameObject(guid);
if (!obj)
return;
FactionTemplateEntry const* faction = sFactionTemplateStore.LookupEntry(obj->GetGOInfo()->faction);
if (faction &&
!_player->isGameMaster() &&
faction->IsHostileTo(*sFactionTemplateStore.LookupEntry(_player->getFaction())) &&
!faction->IsNeutralToAll() &&
!obj->GetOwner())
return;
obj->Use(_player);
}
示例13: DoLootRelease
void WorldSession::DoLootRelease(uint64 lguid)
{
Player *player = GetPlayer();
Loot *loot;
player->SetLootGUID(0);
player->SendLootRelease(lguid);
player->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_LOOTING);
if (!player->IsInWorld())
return;
if (IS_GAMEOBJECT_GUID(lguid))
{
GameObject* go = GetPlayer()->GetMap()->GetGameObject(lguid);
// 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 (loot->isLooted() || go->GetGoType() == GAMEOBJECT_TYPE_FISHINGNODE)
{
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() >= urand(go->GetGOInfo()->fishinghole.minSuccessOpens, go->GetGOInfo()->fishinghole.maxSuccessOpens))
go->SetLootState(GO_JUST_DEACTIVATED);
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)
{
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.
//.........这里部分代码省略.........
示例14: DoLootRelease
void WorldSession::DoLootRelease(ObjectGuid lguid)
{
Player* player = GetPlayer();
Loot* loot;
player->SetLootGuid(ObjectGuid());
player->SendLootRelease(lguid);
player->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_LOOTING);
if (!player->IsInWorld())
{ return; }
switch (lguid.GetHigh())
{
case HIGHGUID_GAMEOBJECT:
{
GameObject* go = GetPlayer()->GetMap()->GetGameObject(lguid);
// not check distance for GO in case owned GO (fishing bobber case, for example) or Fishing hole GO
if (!go || ((go->GetOwnerGuid() != _player->GetObjectGuid() && 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 (loot->isLooted() || go->GetGoType() == GAMEOBJECT_TYPE_FISHINGNODE)
{
// GO is mineral vein? so it is not removed after its looted
if (go->GetGoType() == GAMEOBJECT_TYPE_CHEST)
{
uint32 go_min = go->GetGOInfo()->chest.minSuccessOpens;
uint32 go_max = go->GetGOInfo()->chest.maxSuccessOpens;
// only vein pass this check
if (go_min != 0 && go_max > go_min)
{
float amount_rate = sWorld.getConfig(CONFIG_FLOAT_RATE_MINING_AMOUNT);
float min_amount = go_min * amount_rate;
float max_amount = go_max * amount_rate;
go->AddUse();
float uses = float(go->GetUseCount());
if (uses < max_amount)
{
if (uses >= min_amount)
{
float chance_rate = sWorld.getConfig(CONFIG_FLOAT_RATE_MINING_NEXT);
int32 ReqValue = 175;
LockEntry const* lockInfo = sLockStore.LookupEntry(go->GetGOInfo()->chest.lockId);
if (lockInfo)
{ ReqValue = lockInfo->Skill[0]; }
float skill = float(player->GetSkillValue(SKILL_MINING)) / (ReqValue + 25);
double chance = pow(0.8 * chance_rate, 4 * (1 / double(max_amount)) * double(uses));
if (roll_chance_f(float(100.0f * 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 at next tick
if (go->GetUseCount() >= urand(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);
}
go->SetGoState(GO_STATE_READY);
//.........这里部分代码省略.........
示例15: DoLootRelease
void WorldSession::DoLootRelease(uint64 lguid)
{
Player *player = GetPlayer();
Loot *loot;
player->SetLootGUID(0);
player->SendLootRelease(lguid);
player->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_LOOTING);
if (!player->IsInWorld())
return;
if (IS_GAMEOBJECT_GUID(lguid))
{
GameObject *go = GetPlayer()->GetMap()->GetGameObject(lguid);
// 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 (loot->isLooted() || go->GetGoType() == GAMEOBJECT_TYPE_FISHINGNODE)
{
// GO is mineral vein? so it is not removed after its looted
if (go->GetGoType() == GAMEOBJECT_TYPE_CHEST)
{
uint32 go_min = go->GetGOInfo()->chest.minSuccessOpens;
uint32 go_max = go->GetGOInfo()->chest.maxSuccessOpens;
// only vein pass this check
if (go_min != 0 && go_max > go_min)
{
float amount_rate = sWorld.getRate(RATE_MINING_AMOUNT);
float min_amount = go_min*amount_rate;
float max_amount = go_max*amount_rate;
go->AddUse();
float uses = float(go->GetUseCount());
if (uses < max_amount)
{
if (uses >= min_amount)
{
float chance_rate = sWorld.getRate(RATE_MINING_NEXT);
int32 ReqValue = 175;
LockEntry const *lockInfo = sLockStore.LookupEntry(go->GetGOInfo()->chest.lockId);
if (lockInfo)
ReqValue = lockInfo->requiredminingskill;
float skill = float(player->GetSkillValue(SKILL_MINING))/(ReqValue+25);
double chance = pow(0.8*chance_rate,4*(1/double(max_amount))*double(uses));
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;
//.........这里部分代码省略.........