REPO: code-style clean-up
* Fixed pPlayer->player * Fixed pCreature->creature ~DevNote: codestyle for Player should be (*player), not *plr or *p... same goes for Creatures (*creature)... more cleaning needed. We've way too many codestyles happening here.
This commit is contained in:
@@ -13291,11 +13291,11 @@ void Player::SendEquipError(InventoryResult msg, Item* pItem, Item* pItem2, uint
|
||||
GetSession()->SendPacket(&data);
|
||||
}
|
||||
|
||||
void Player::SendBuyError(BuyResult msg, Creature* pCreature, uint32 item, uint32 param)
|
||||
void Player::SendBuyError(BuyResult msg, Creature* creature, uint32 item, uint32 param)
|
||||
{
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_BUY_FAILED");
|
||||
WorldPacket data(SMSG_BUY_FAILED, (8+4+4+1));
|
||||
data << uint64(pCreature ? pCreature->GetGUID() : 0);
|
||||
data << uint64(creature ? creature->GetGUID() : 0);
|
||||
data << uint32(item);
|
||||
if (param > 0)
|
||||
data << uint32(param);
|
||||
@@ -13303,11 +13303,11 @@ void Player::SendBuyError(BuyResult msg, Creature* pCreature, uint32 item, uint3
|
||||
GetSession()->SendPacket(&data);
|
||||
}
|
||||
|
||||
void Player::SendSellError(SellResult msg, Creature* pCreature, uint64 guid, uint32 param)
|
||||
void Player::SendSellError(SellResult msg, Creature* creature, uint64 guid, uint32 param)
|
||||
{
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_SELL_ITEM");
|
||||
WorldPacket data(SMSG_SELL_ITEM, (8+8+(param?4:0)+1)); // last check 2.0.10
|
||||
data << uint64(pCreature ? pCreature->GetGUID() : 0);
|
||||
data << uint64(creature ? creature->GetGUID() : 0);
|
||||
data << uint64(guid);
|
||||
if (param > 0)
|
||||
data << uint32(param);
|
||||
@@ -14348,11 +14348,11 @@ void Player::PrepareQuestMenu(uint64 guid)
|
||||
QuestRelationBounds pObjectQIR;
|
||||
|
||||
// pets also can have quests
|
||||
Creature* pCreature = ObjectAccessor::GetCreatureOrPetOrVehicle(*this, guid);
|
||||
if (pCreature)
|
||||
Creature* creature = ObjectAccessor::GetCreatureOrPetOrVehicle(*this, guid);
|
||||
if (creature)
|
||||
{
|
||||
pObjectQR = sObjectMgr->GetCreatureQuestRelationBounds(pCreature->GetEntry());
|
||||
pObjectQIR = sObjectMgr->GetCreatureQuestInvolvedRelationBounds(pCreature->GetEntry());
|
||||
pObjectQR = sObjectMgr->GetCreatureQuestRelationBounds(creature->GetEntry());
|
||||
pObjectQIR = sObjectMgr->GetCreatureQuestInvolvedRelationBounds(creature->GetEntry());
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -14459,10 +14459,10 @@ void Player::SendPreparedQuest(uint64 guid)
|
||||
std::string title = "";
|
||||
|
||||
// need pet case for some quests
|
||||
Creature* pCreature = ObjectAccessor::GetCreatureOrPetOrVehicle(*this, guid);
|
||||
if (pCreature)
|
||||
Creature* creature = ObjectAccessor::GetCreatureOrPetOrVehicle(*this, guid);
|
||||
if (creature)
|
||||
{
|
||||
uint32 textid = GetGossipTextId(pCreature);
|
||||
uint32 textid = GetGossipTextId(creature);
|
||||
GossipText const* gossiptext = sObjectMgr->GetGossipText(textid);
|
||||
if (!gossiptext)
|
||||
{
|
||||
@@ -14507,9 +14507,9 @@ Quest const* Player::GetNextQuest(uint64 guid, Quest const* pQuest)
|
||||
{
|
||||
QuestRelationBounds pObjectQR;
|
||||
|
||||
Creature* pCreature = ObjectAccessor::GetCreatureOrPetOrVehicle(*this, guid);
|
||||
if (pCreature)
|
||||
pObjectQR = sObjectMgr->GetCreatureQuestRelationBounds(pCreature->GetEntry());
|
||||
Creature* creature = ObjectAccessor::GetCreatureOrPetOrVehicle(*this, guid);
|
||||
if (creature)
|
||||
pObjectQR = sObjectMgr->GetCreatureQuestRelationBounds(creature->GetEntry());
|
||||
else
|
||||
{
|
||||
//we should obtain map pointer from GetMap() in 99% of cases. Special case
|
||||
@@ -16253,12 +16253,12 @@ void Player::SendQuestConfirmAccept(const Quest* pQuest, Player* pReceiver)
|
||||
}
|
||||
}
|
||||
|
||||
void Player::SendPushToPartyResponse(Player* pPlayer, uint32 msg)
|
||||
void Player::SendPushToPartyResponse(Player* player, uint32 msg)
|
||||
{
|
||||
if (pPlayer)
|
||||
if (player)
|
||||
{
|
||||
WorldPacket data(MSG_QUEST_PUSH_RESULT, (8+1));
|
||||
data << uint64(pPlayer->GetGUID());
|
||||
data << uint64(player->GetGUID());
|
||||
data << uint8(msg); // valid values: 0-8
|
||||
GetSession()->SendPacket(&data);
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent MSG_QUEST_PUSH_RESULT");
|
||||
@@ -20434,24 +20434,24 @@ bool Player::BuyItemFromVendorSlot(uint64 vendorguid, uint32 vendorslot, uint32
|
||||
return false;
|
||||
}
|
||||
|
||||
Creature* pCreature = GetNPCIfCanInteractWith(vendorguid, UNIT_NPC_FLAG_VENDOR);
|
||||
if (!pCreature)
|
||||
Creature* creature = GetNPCIfCanInteractWith(vendorguid, UNIT_NPC_FLAG_VENDOR);
|
||||
if (!creature)
|
||||
{
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: BuyItemFromVendor - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(vendorguid)));
|
||||
SendBuyError(BUY_ERR_DISTANCE_TOO_FAR, NULL, item, 0);
|
||||
return false;
|
||||
}
|
||||
|
||||
VendorItemData const* vItems = pCreature->GetVendorItems();
|
||||
VendorItemData const* vItems = creature->GetVendorItems();
|
||||
if (!vItems || vItems->Empty())
|
||||
{
|
||||
SendBuyError(BUY_ERR_CANT_FIND_ITEM, pCreature, item, 0);
|
||||
SendBuyError(BUY_ERR_CANT_FIND_ITEM, creature, item, 0);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (vendorslot >= vItems->GetItemCount())
|
||||
{
|
||||
SendBuyError(BUY_ERR_CANT_FIND_ITEM, pCreature, item, 0);
|
||||
SendBuyError(BUY_ERR_CANT_FIND_ITEM, creature, item, 0);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -20459,23 +20459,23 @@ bool Player::BuyItemFromVendorSlot(uint64 vendorguid, uint32 vendorslot, uint32
|
||||
// store diff item (cheating)
|
||||
if (!crItem || crItem->item != item)
|
||||
{
|
||||
SendBuyError(BUY_ERR_CANT_FIND_ITEM, pCreature, item, 0);
|
||||
SendBuyError(BUY_ERR_CANT_FIND_ITEM, creature, item, 0);
|
||||
return false;
|
||||
}
|
||||
|
||||
// check current item amount if it limited
|
||||
if (crItem->maxcount != 0)
|
||||
{
|
||||
if (pCreature->GetVendorItemCurrentCount(crItem) < pProto->BuyCount * count)
|
||||
if (creature->GetVendorItemCurrentCount(crItem) < pProto->BuyCount * count)
|
||||
{
|
||||
SendBuyError(BUY_ERR_ITEM_ALREADY_SOLD, pCreature, item, 0);
|
||||
SendBuyError(BUY_ERR_ITEM_ALREADY_SOLD, creature, item, 0);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (pProto->RequiredReputationFaction && (uint32(GetReputationRank(pProto->RequiredReputationFaction)) < pProto->RequiredReputationRank))
|
||||
{
|
||||
SendBuyError(BUY_ERR_REPUTATION_REQUIRE, pCreature, item, 0);
|
||||
SendBuyError(BUY_ERR_REPUTATION_REQUIRE, creature, item, 0);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -20525,17 +20525,17 @@ bool Player::BuyItemFromVendorSlot(uint64 vendorguid, uint32 vendorslot, uint32
|
||||
|
||||
// reputation discount
|
||||
if (price)
|
||||
price = uint32(floor(price * GetReputationPriceDiscount(pCreature)));
|
||||
price = uint32(floor(price * GetReputationPriceDiscount(creature)));
|
||||
|
||||
if (!HasEnoughMoney(price))
|
||||
{
|
||||
SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, pCreature, item, 0);
|
||||
SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, creature, item, 0);
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((bag == NULL_BAG && slot == NULL_SLOT) || IsInventoryPos(bag, slot))
|
||||
{
|
||||
if (!_StoreOrEquipNewItem(vendorslot, item, count, bag, slot, price, pProto, pCreature, crItem, true))
|
||||
if (!_StoreOrEquipNewItem(vendorslot, item, count, bag, slot, price, pProto, creature, crItem, true))
|
||||
return false;
|
||||
}
|
||||
else if (IsEquipmentPos(bag, slot))
|
||||
@@ -20545,7 +20545,7 @@ bool Player::BuyItemFromVendorSlot(uint64 vendorguid, uint32 vendorslot, uint32
|
||||
SendEquipError(EQUIP_ERR_ITEM_CANT_BE_EQUIPPED, NULL, NULL);
|
||||
return false;
|
||||
}
|
||||
if (!_StoreOrEquipNewItem(vendorslot, item, count, bag, slot, price, pProto, pCreature, crItem, false))
|
||||
if (!_StoreOrEquipNewItem(vendorslot, item, count, bag, slot, price, pProto, creature, crItem, false))
|
||||
return false;
|
||||
}
|
||||
else
|
||||
@@ -21961,9 +21961,9 @@ bool Player::GetBGAccessByLevel(BattlegroundTypeId bgTypeId) const
|
||||
return true;
|
||||
}
|
||||
|
||||
float Player::GetReputationPriceDiscount(Creature const* pCreature) const
|
||||
float Player::GetReputationPriceDiscount(Creature const* creature) const
|
||||
{
|
||||
FactionTemplateEntry const* vendor_faction = pCreature->getFactionTemplateEntry();
|
||||
FactionTemplateEntry const* vendor_faction = creature->getFactionTemplateEntry();
|
||||
if (!vendor_faction || !vendor_faction->faction)
|
||||
return 1.0f;
|
||||
|
||||
|
||||
@@ -1317,8 +1317,8 @@ class Player : public Unit, public GridObject<Player>
|
||||
void RemoveItemFromBuyBackSlot(uint32 slot, bool del);
|
||||
uint32 GetMaxKeyringSize() const { return KEYRING_SLOT_END-KEYRING_SLOT_START; }
|
||||
void SendEquipError(InventoryResult msg, Item* pItem, Item* pItem2 = NULL, uint32 itemid = 0);
|
||||
void SendBuyError(BuyResult msg, Creature* pCreature, uint32 item, uint32 param);
|
||||
void SendSellError(SellResult msg, Creature* pCreature, uint64 guid, uint32 param);
|
||||
void SendBuyError(BuyResult msg, Creature* creature, uint32 item, uint32 param);
|
||||
void SendSellError(SellResult msg, Creature* creature, uint64 guid, uint32 param);
|
||||
void AddWeaponProficiency(uint32 newflag) { m_WeaponProficiency |= newflag; }
|
||||
void AddArmorProficiency(uint32 newflag) { m_ArmorProficiency |= newflag; }
|
||||
uint32 GetWeaponProficiency() const { return m_WeaponProficiency; }
|
||||
@@ -1337,7 +1337,7 @@ class Player : public Unit, public GridObject<Player>
|
||||
bool BuyItemFromVendorSlot(uint64 vendorguid, uint32 vendorslot, uint32 item, uint8 count, uint8 bag, uint8 slot);
|
||||
bool _StoreOrEquipNewItem(uint32 vendorslot, uint32 item, uint8 count, uint8 bag, uint8 slot, int32 price, ItemTemplate const* pProto, Creature* pVendor, VendorItem const* crItem, bool bStore);
|
||||
|
||||
float GetReputationPriceDiscount(Creature const* pCreature) const;
|
||||
float GetReputationPriceDiscount(Creature const* creature) const;
|
||||
|
||||
Player* GetTrader() const { return m_trade ? m_trade->GetTrader() : NULL; }
|
||||
TradeData* GetTradeData() const { return m_trade; }
|
||||
@@ -1485,7 +1485,7 @@ class Player : public Unit, public GridObject<Player>
|
||||
void SendQuestTimerFailed(uint32 quest_id);
|
||||
void SendCanTakeQuestResponse(uint32 msg);
|
||||
void SendQuestConfirmAccept(Quest const* pQuest, Player* pReceiver);
|
||||
void SendPushToPartyResponse(Player* pPlayer, uint32 msg);
|
||||
void SendPushToPartyResponse(Player* player, uint32 msg);
|
||||
void SendQuestUpdateAddItem(Quest const* pQuest, uint32 item_idx, uint16 count);
|
||||
void SendQuestUpdateAddCreatureOrGo(Quest const* pQuest, uint64 guid, uint32 creatureOrGO_idx, uint16 old_count, uint16 add_count);
|
||||
void SendQuestUpdateAddPlayer(Quest const* pQuest, uint16 old_count, uint16 add_count);
|
||||
|
||||
Reference in New Issue
Block a user