refactor(Core/Game): restyle game lib with astyle (#3466)

This commit is contained in:
Kargatum
2020-10-12 15:08:15 +07:00
committed by GitHub
parent e99b526e17
commit a2b26272d2
338 changed files with 52196 additions and 50944 deletions

View File

@@ -97,7 +97,7 @@ void WorldSession::HandleAutostoreLootItemOpcode(WorldPacket& recvData)
DoLootRelease(lguid);
}
void WorldSession::HandleLootMoneyOpcode(WorldPacket & /*recvData*/)
void WorldSession::HandleLootMoneyOpcode(WorldPacket& /*recvData*/)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_LOOT_MONEY");
@@ -114,51 +114,51 @@ void WorldSession::HandleLootMoneyOpcode(WorldPacket & /*recvData*/)
switch (GUID_HIPART(guid))
{
case HIGHGUID_GAMEOBJECT:
{
GameObject* go = GetPlayer()->GetMap()->GetGameObject(guid);
{
GameObject* go = GetPlayer()->GetMap()->GetGameObject(guid);
// do not check distance for GO if player is the owner of it (ex. fishing bobber)
if (go && ((go->GetOwnerGUID() == player->GetGUID() || go->IsWithinDistInMap(player, INTERACTION_DISTANCE))))
loot = &go->loot;
// do not check distance for GO if player is the owner of it (ex. fishing bobber)
if (go && ((go->GetOwnerGUID() == player->GetGUID() || go->IsWithinDistInMap(player, INTERACTION_DISTANCE))))
loot = &go->loot;
break;
}
break;
}
case HIGHGUID_CORPSE: // remove insignia ONLY in BG
{
Corpse* bones = ObjectAccessor::GetCorpse(*player, guid);
if (bones && bones->IsWithinDistInMap(player, INTERACTION_DISTANCE))
{
loot = &bones->loot;
shareMoney = false;
}
Corpse* bones = ObjectAccessor::GetCorpse(*player, guid);
break;
}
if (bones && bones->IsWithinDistInMap(player, INTERACTION_DISTANCE))
{
loot = &bones->loot;
shareMoney = false;
}
break;
}
case HIGHGUID_ITEM:
{
if (Item* item = player->GetItemByGuid(guid))
{
loot = &item->loot;
shareMoney = false;
if (Item* item = player->GetItemByGuid(guid))
{
loot = &item->loot;
shareMoney = false;
}
break;
}
break;
}
case HIGHGUID_UNIT:
case HIGHGUID_VEHICLE:
{
Creature* creature = player->GetMap()->GetCreature(guid);
bool lootAllowed = creature && creature->IsAlive() == (player->getClass() == CLASS_ROGUE && creature->loot.loot_type == LOOT_PICKPOCKETING);
if (lootAllowed && creature->IsWithinDistInMap(player, INTERACTION_DISTANCE))
{
loot = &creature->loot;
if (creature->IsAlive())
shareMoney = false;
Creature* creature = player->GetMap()->GetCreature(guid);
bool lootAllowed = creature && creature->IsAlive() == (player->getClass() == CLASS_ROGUE && creature->loot.loot_type == LOOT_PICKPOCKETING);
if (lootAllowed && creature->IsWithinDistInMap(player, INTERACTION_DISTANCE))
{
loot = &creature->loot;
if (creature->IsAlive())
shareMoney = false;
}
else
player->SendLootError(guid, lootAllowed ? LOOT_ERROR_TOO_FAR : LOOT_ERROR_DIDNT_KILL);
break;
}
else
player->SendLootError(guid, lootAllowed ? LOOT_ERROR_TOO_FAR : LOOT_ERROR_DIDNT_KILL);
break;
}
default:
return; // unlootable type
}
@@ -257,8 +257,8 @@ void WorldSession::HandleLootReleaseOpcode(WorldPacket& recvData)
void WorldSession::DoLootRelease(uint64 lguid)
{
Player *player = GetPlayer();
Loot *loot;
Player* player = GetPlayer();
Loot* loot;
player->SetLootGUID(0);
player->SendLootRelease(lguid);
@@ -286,7 +286,8 @@ void WorldSession::DoLootRelease(uint64 lguid)
else if (loot->isLooted() || go->GetGoType() == GAMEOBJECT_TYPE_FISHINGNODE)
{
if (go->GetGoType() == GAMEOBJECT_TYPE_FISHINGHOLE)
{ // The fishing hole used once more
{
// The fishing hole used once more
go->AddUse(); // if the max usage is reached, will be despawned in next tick
if (go->GetUseCount() >= go->GetGOValue()->FishingHole.MaxOpens)
go->SetLootState(GO_JUST_DEACTIVATED);
@@ -295,8 +296,8 @@ void WorldSession::DoLootRelease(uint64 lguid)
}
else
{
go->SetLootState(GO_JUST_DEACTIVATED);
go->SetLootState(GO_JUST_DEACTIVATED);
// Xinef: moved event execution to loot release (after everything is looted)
// Xinef: 99% sure that this worked like this on blizz
// Xinef: prevents exploits with just opening GO and spawning bilions of npcs, which can crash core if you know what you're doin ;)
@@ -504,8 +505,8 @@ void WorldSession::HandleLootMasterGiveOpcode(WorldPacket& recvData)
#endif
// mark as looted
item.count=0;
item.is_looted=true;
item.count = 0;
item.is_looted = true;
loot->NotifyItemRemoved(slotid);
--loot->unlootedCount;