Project tidy up and sync pt2

This commit is contained in:
Antz 2020-01-09 15:16:08 +00:00
parent 87b8e0ad13
commit 0417581bd5
No known key found for this signature in database
GPG Key ID: 0DF907270598C85F
20 changed files with 192 additions and 299 deletions

View File

@ -812,6 +812,9 @@ void BattleGroundAV::Reset()
InitNode(BG_AV_NODES_SNOWFALL_GRAVE, BG_AV_TEAM_NEUTRAL, false); // give snowfall neutral owner
}
/// <summary>
/// Gets the premature finish winning team.
/// </summary>
Team BattleGroundAV::GetPrematureWinner()
{
int32 hordeScore = m_TeamScores[TEAM_INDEX_HORDE];

View File

@ -171,7 +171,6 @@ class BattleGroundQueue
* @param bgTypeId
* @param bracketId
* @param isPremade
* @return GroupQueueInfo
*/
GroupQueueInfo* AddGroup(Player* leader, Group* group, BattleGroundTypeId bgTypeId, BattleGroundBracketId bracketId, bool isPremade);
/**
@ -540,6 +539,7 @@ class BattleGroundMgr
* @param Team2StartLocY
* @param Team2StartLocZ
* @param Team2StartLocO
* @param StartMaxDist
* @return uint32
*/
uint32 CreateBattleGround(BattleGroundTypeId bgTypeId, uint32 MinPlayersPerTeam, uint32 MaxPlayersPerTeam, uint32 LevelMin, uint32 LevelMax, char const* BattleGroundName, uint32 MapID, float Team1StartLocX, float Team1StartLocY, float Team1StartLocZ, float Team1StartLocO, float Team2StartLocX, float Team2StartLocY, float Team2StartLocZ, float Team2StartLocO, float StartMaxDist);

View File

@ -1262,7 +1262,7 @@ void Creature::SelectLevel(uint32 forcedLevel /*= USE_DEFAULT_DATABASE_LEVEL*/)
uint32 rank = IsPet() ? 0 : cinfo->Rank; // TODO :: IsPet probably not needed here
// level
// level
uint32 level = forcedLevel;
uint32 const minlevel = cinfo->MinLevel;
uint32 const maxlevel = cinfo->MaxLevel;
@ -2131,9 +2131,6 @@ bool Creature::LoadCreatureAddon(bool reload)
// 3 StandMiscFlags
SetByteValue(UNIT_FIELD_BYTES_1, 0, uint8(cainfo->bytes1 & 0xFF));
// SetByteValue(UNIT_FIELD_BYTES_1, 1, uint8((cainfo->bytes1 >> 8) & 0xFF));
// SetByteValue(UNIT_FIELD_BYTES_1, 1, 0);
// SetByteValue(UNIT_FIELD_BYTES_2, 2, 0);
SetByteValue(UNIT_FIELD_BYTES_1, 3, uint8((cainfo->bytes1 >> 24) & 0xFF));
}
@ -2684,8 +2681,7 @@ void Creature::AddToRemoveListInMaps(uint32 db_guid, CreatureData const* data)
struct SpawnCreatureInMapsWorker
{
SpawnCreatureInMapsWorker(uint32 guid, CreatureData const* data)
: i_guid(guid), i_data(data) {}
SpawnCreatureInMapsWorker(uint32 guid, CreatureData const* data) : i_guid(guid), i_data(data) {}
void operator()(Map* map)
{
@ -2693,7 +2689,6 @@ struct SpawnCreatureInMapsWorker
if (map->IsLoaded(i_data->posX, i_data->posY))
{
Creature* pCreature = new Creature;
// DEBUG_LOG("Spawning creature %u",*itr);
if (!pCreature->LoadFromDB(i_guid, map))
{
delete pCreature;

View File

@ -536,9 +536,9 @@ class Creature : public Unit
bool CanWalk() const { return GetCreatureInfo()->InhabitType & INHABIT_GROUND; }
virtual bool CanSwim() const override { return GetCreatureInfo()->InhabitType & INHABIT_WATER; }
bool IsSwimming() const { return (m_movementInfo.HasMovementFlag((MovementFlags)(MOVEFLAG_SWIMMING))); }
bool IsSwimming() const { return (m_movementInfo.HasMovementFlag((MovementFlags)(MOVEFLAG_SWIMMING))); }
virtual bool CanFly() const override { return (GetCreatureInfo()->InhabitType & INHABIT_AIR) || m_movementInfo.HasMovementFlag((MovementFlags)(MOVEFLAG_LEVITATING | MOVEFLAG_CAN_FLY)); }
bool IsFlying() const { return (m_movementInfo.HasMovementFlag((MovementFlags)(MOVEFLAG_FLYING|MOVEFLAG_LEVITATING))); }
bool IsFlying() const { return (m_movementInfo.HasMovementFlag((MovementFlags)(MOVEFLAG_FLYING | MOVEFLAG_LEVITATING))); }
bool IsTrainerOf(Player* player, bool msg) const;
bool CanInteractWithBattleMaster(Player* player, bool msg) const;
bool CanTrainAndResetTalentsOf(Player* pPlayer) const;

View File

@ -169,7 +169,7 @@ void CreatureAI::SetCombatMovementFlag(uint8 flag, bool setFlag)
{
m_combatMovement &= ~flag;
if (m_combatMovement == 0)
m_creature->addUnitState(UNIT_STAT_NO_COMBAT_MOVEMENT);
{ m_creature->addUnitState(UNIT_STAT_NO_COMBAT_MOVEMENT); }
}
}
@ -205,7 +205,7 @@ void CreatureAI::HandleMovementOnAttackStart(Unit* victim)
{
MotionMaster* creatureMotion = m_creature->GetMotionMaster();
MovementGeneratorType mmgen = creatureMotion->GetCurrentMovementGeneratorType();
if (IsCombatMovement())
{ creatureMotion->MoveChase(victim, m_attackDistance, m_attackAngle); }

View File

@ -475,22 +475,22 @@ void GameObject::Update(uint32 update_diff, uint32 p_time)
if (visualGO)
visualGO->SetLootState(GO_JUST_DEACTIVATED);
}
if (!trapEntry)
break;
GameObjectInfo const* trapInfo = sGOStorage.LookupEntry<GameObjectInfo>(trapEntry);
if (!trapInfo || trapInfo->type != GAMEOBJECT_TYPE_TRAP)
break;
float range = 0.5f;
GameObject* trapGO = NULL;
MaNGOS::NearestGameObjectEntryInObjectRangeCheck go_check(*this, trapEntry, range);
MaNGOS::GameObjectLastSearcher<MaNGOS::NearestGameObjectEntryInObjectRangeCheck> checker(trapGO, go_check);
Cell::VisitGridObjects(this, checker, range);
// found correct GO
if (trapGO)
trapGO->SetLootState(GO_JUST_DEACTIVATED);
@ -1167,7 +1167,7 @@ void GameObject::Use(Unit* user)
// FIXME: when GO casting will be implemented trap must cast spell to target
if (goInfo->trap.spellId)
{ caster->CastSpell(user, goInfo->trap.spellId, true, NULL, NULL, GetObjectGuid()); }
{ caster->CastSpell(user, goInfo->trap.spellId, true, NULL, NULL, GetObjectGuid()); }
// use template cooldown if provided
m_cooldownTime = time(NULL) + (goInfo->trap.cooldown ? goInfo->trap.cooldown : uint32(4));
@ -1874,7 +1874,7 @@ uint32 GameObject::RollMineralVein(uint32 entry) //Maybe incedicite bloodst
default: //default case for copper or not listet special veins
entrynew = entry;
}
}
return entrynew;
}

View File

@ -295,8 +295,11 @@ void Object::BuildMovementUpdate(ByteBuffer* data, uint8 updateFlags) const
data->appendPackGUID(0);
}
// 0x2
if (updateFlags & UPDATEFLAG_TRANSPORT)
*data << uint32(WorldTimer::getMSTime());
{
*data << uint32(WorldTimer::getMSTime()); // ms time
}
}
void Object::BuildValuesUpdate(uint8 updatetype, ByteBuffer* data, UpdateMask* updateMask, Player* target) const
@ -324,79 +327,79 @@ void Object::BuildValuesUpdate(uint8 updatetype, ByteBuffer* data, UpdateMask* u
{
for (uint16 index = 0; index < m_valuesCount; ++index)
{
if(updateMask->GetBit(index))
{
if (index == UNIT_NPC_FLAGS)
if (updateMask->GetBit(index))
{
uint32 appendValue = m_uint32Values[index];
if (GetTypeId() == TYPEID_UNIT)
if (index == UNIT_NPC_FLAGS)
{
if (appendValue & UNIT_NPC_FLAG_TRAINER)
uint32 appendValue = m_uint32Values[index];
if (GetTypeId() == TYPEID_UNIT)
{
if (!((Creature*)this)->IsTrainerOf(target, false))
{ appendValue &= ~UNIT_NPC_FLAG_TRAINER; }
}
if (appendValue & UNIT_NPC_FLAG_STABLEMASTER)
{
if (target->getClass() != CLASS_HUNTER)
{ appendValue &= ~UNIT_NPC_FLAG_STABLEMASTER; }
}
}
*data << uint32(appendValue);
}
// FIXME: Some values at server stored in float format but must be sent to client in uint32 format
else if (index >= UNIT_FIELD_BASEATTACKTIME && index <= UNIT_FIELD_RANGEDATTACKTIME)
{
// convert from float to uint32 and send
*data << uint32(m_floatValues[index] < 0 ? 0 : m_floatValues[index]);
}
// there are some float values which may be negative or can't get negative due to other checks
else if ((index >= PLAYER_FIELD_NEGSTAT0 && index <= PLAYER_FIELD_NEGSTAT4) ||
(index >= PLAYER_FIELD_RESISTANCEBUFFMODSPOSITIVE && index <= (PLAYER_FIELD_RESISTANCEBUFFMODSPOSITIVE + 6)) ||
(index >= PLAYER_FIELD_RESISTANCEBUFFMODSNEGATIVE && index <= (PLAYER_FIELD_RESISTANCEBUFFMODSNEGATIVE + 6)) ||
(index >= PLAYER_FIELD_POSSTAT0 && index <= PLAYER_FIELD_POSSTAT4))
{
*data << uint32(m_floatValues[index]);
}
// Gamemasters should be always able to select units - remove not selectable flag
else if (index == UNIT_FIELD_FLAGS && target->isGameMaster())
{
*data << (m_uint32Values[index] & ~UNIT_FLAG_NOT_SELECTABLE);
}
/* Hide loot animation for players that aren't permitted to loot the corpse */
else if (index == UNIT_DYNAMIC_FLAGS && GetTypeId() == TYPEID_UNIT)
{
uint32 send_value = m_uint32Values[index];
/* Initiate pointer to creature so we can check loot */
if (Creature* my_creature = (Creature*)this)
/* If the creature is NOT fully looted */
if (!my_creature->loot.isLooted())
/* If the lootable flag is NOT set */
if (!(send_value & UNIT_DYNFLAG_LOOTABLE))
if (appendValue & UNIT_NPC_FLAG_TRAINER)
{
/* Update it on the creature */
my_creature->SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE);
/* Update it in the packet */
send_value = send_value | UNIT_DYNFLAG_LOOTABLE;
if (!((Creature*)this)->IsTrainerOf(target, false))
{ appendValue &= ~UNIT_NPC_FLAG_TRAINER; }
}
/* If we're not allowed to loot the target, destroy the lootable flag */
if (!target->isAllowedToLoot((Creature*)this))
if (send_value & UNIT_DYNFLAG_LOOTABLE)
{ send_value = send_value & ~UNIT_DYNFLAG_LOOTABLE; }
if (appendValue & UNIT_NPC_FLAG_STABLEMASTER)
{
if (target->getClass() != CLASS_HUNTER)
{ appendValue &= ~UNIT_NPC_FLAG_STABLEMASTER; }
}
}
/* If we are allowed to loot it and mob is tapped by us, destroy the tapped flag */
bool is_tapped = target->IsTappedByMeOrMyGroup((Creature*)this);
*data << uint32(appendValue);
}
// FIXME: Some values at server stored in float format but must be sent to client in uint32 format
else if (index >= UNIT_FIELD_BASEATTACKTIME && index <= UNIT_FIELD_RANGEDATTACKTIME)
{
// convert from float to uint32 and send
*data << uint32(m_floatValues[index] < 0 ? 0 : m_floatValues[index]);
}
/* If the creature has tapped flag but is tapped by us, remove the flag */
if (send_value & UNIT_DYNFLAG_TAPPED && is_tapped)
{ send_value = send_value & ~UNIT_DYNFLAG_TAPPED; }
// there are some float values which may be negative or can't get negative due to other checks
else if ((index >= PLAYER_FIELD_NEGSTAT0 && index <= PLAYER_FIELD_NEGSTAT4) ||
(index >= PLAYER_FIELD_RESISTANCEBUFFMODSPOSITIVE && index <= (PLAYER_FIELD_RESISTANCEBUFFMODSPOSITIVE + 6)) ||
(index >= PLAYER_FIELD_RESISTANCEBUFFMODSNEGATIVE && index <= (PLAYER_FIELD_RESISTANCEBUFFMODSNEGATIVE + 6)) ||
(index >= PLAYER_FIELD_POSSTAT0 && index <= PLAYER_FIELD_POSSTAT4))
{
*data << uint32(m_floatValues[index]);
}
// Gamemasters should be always able to select units - remove not selectable flag
else if (index == UNIT_FIELD_FLAGS && target->isGameMaster())
{
*data << (m_uint32Values[index] & ~UNIT_FLAG_NOT_SELECTABLE);
}
/* Hide loot animation for players that aren't permitted to loot the corpse */
else if (index == UNIT_DYNAMIC_FLAGS && GetTypeId() == TYPEID_UNIT)
{
uint32 send_value = m_uint32Values[index];
/* Initiate pointer to creature so we can check loot */
if (Creature* my_creature = (Creature*)this)
/* If the creature is NOT fully looted */
if (!my_creature->loot.isLooted())
/* If the lootable flag is NOT set */
if (!(send_value & UNIT_DYNFLAG_LOOTABLE))
{
/* Update it on the creature */
my_creature->SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE);
/* Update it in the packet */
send_value = send_value | UNIT_DYNFLAG_LOOTABLE;
}
/* If we're not allowed to loot the target, destroy the lootable flag */
if (!target->isAllowedToLoot((Creature*)this))
if (send_value & UNIT_DYNFLAG_LOOTABLE)
{ send_value = send_value & ~UNIT_DYNFLAG_LOOTABLE; }
/* If we are allowed to loot it and mob is tapped by us, destroy the tapped flag */
bool is_tapped = target->IsTappedByMeOrMyGroup((Creature*)this);
/* If the creature has tapped flag but is tapped by us, remove the flag */
if (send_value & UNIT_DYNFLAG_TAPPED && is_tapped)
{ send_value = send_value & ~UNIT_DYNFLAG_TAPPED; }
// Checking SPELL_AURA_EMPATHY and caster
if (send_value & UNIT_DYNFLAG_SPECIALINFO && ((Unit*)this)->IsAlive())
@ -414,48 +417,48 @@ void Object::BuildValuesUpdate(uint8 updatetype, ByteBuffer* data, UpdateMask* u
send_value &= ~UNIT_DYNFLAG_SPECIALINFO;
}
*data << send_value;
*data << send_value;
}
else
{
// send in current format (float as float, uint32 as uint32)
*data << m_uint32Values[index];
}
}
else
{
// send in current format (float as float, uint32 as uint32)
*data << m_uint32Values[index];
}
}
}
}
else if (isType(TYPEMASK_GAMEOBJECT)) // gameobject case
{
for (uint16 index = 0; index < m_valuesCount; ++index)
{
if (updateMask->GetBit(index))
{
// send in current format (float as float, uint32 as uint32)
if (index == GAMEOBJECT_DYN_FLAGS)
if (updateMask->GetBit(index))
{
if (IsActivateToQuest)
// send in current format (float as float, uint32 as uint32)
if (index == GAMEOBJECT_DYN_FLAGS)
{
switch (((GameObject*)this)->GetGoType())
if (IsActivateToQuest)
{
case GAMEOBJECT_TYPE_QUESTGIVER:
case GAMEOBJECT_TYPE_CHEST:
case GAMEOBJECT_TYPE_GENERIC:
case GAMEOBJECT_TYPE_SPELL_FOCUS:
case GAMEOBJECT_TYPE_GOOBER:
*data << uint16(GO_DYNFLAG_LO_ACTIVATE);
*data << uint16(0);
break;
default:
*data << uint32(0); // unknown, not happen.
break;
switch (((GameObject*)this)->GetGoType())
{
case GAMEOBJECT_TYPE_QUESTGIVER:
case GAMEOBJECT_TYPE_CHEST:
case GAMEOBJECT_TYPE_GENERIC:
case GAMEOBJECT_TYPE_SPELL_FOCUS:
case GAMEOBJECT_TYPE_GOOBER:
*data << uint16(GO_DYNFLAG_LO_ACTIVATE);
*data << uint16(0);
break;
default:
*data << uint32(0); // unknown, not happen.
break;
}
}
else
{ *data << uint32(0); } // disable quest object
}
else
{ *data << uint32(0); } // disable quest object
{ *data << m_uint32Values[index]; } // other cases
}
else
{ *data << m_uint32Values[index]; } // other cases
}
}
}
else // other objects case (no special index checks)

View File

@ -41,7 +41,6 @@
INSTANTIATE_SINGLETON_2(ObjectAccessor, CLASS_LOCK);
INSTANTIATE_CLASS_MUTEX(ObjectAccessor, ACE_Recursive_Thread_Mutex);
ObjectAccessor::ObjectAccessor() : i_playerMap(), i_corpseMap(), i_corpseGuard()
{
}

View File

@ -186,10 +186,10 @@ ObjectMgr::~ObjectMgr()
{ delete[] playerClassInfo[class_].levelInfo; }
for (int race = 0; race < MAX_RACES; ++race)
{
for (int class_ = 0; class_ < MAX_CLASSES; ++class_)
{ delete[] playerInfo[race][class_].levelInfo; }
}
{
for (int class_ = 0; class_ < MAX_CLASSES; ++class_)
{ delete[] playerInfo[race][class_].levelInfo; }
}
// free objects
for (GroupMap::iterator itr = mGroupMap.begin(); itr != mGroupMap.end(); ++itr)
@ -1212,10 +1212,10 @@ void ObjectMgr::LoadCreatures()
}
if (gameEvent == 0 && GuidPoolId == 0 && EntryPoolId == 0) // if not this is to be managed by GameEvent System or Pool system
{ AddCreatureToGrid(guid, &data); }
{ AddCreatureToGrid(guid, &data); }
if (cInfo->ExtraFlags & CREATURE_EXTRA_FLAG_ACTIVE)
{ m_activeCreatures.insert(ActiveCreatureGuidsOnMap::value_type(data.mapid, guid)); }
{ m_activeCreatures.insert(ActiveCreatureGuidsOnMap::value_type(data.mapid, guid)); }
++count;
}
@ -1705,8 +1705,6 @@ void ObjectMgr::LoadItemPrototypes()
if (proto->RequiredReputationRank == MIN_REPUTATION_RANK)
{ sLog.outErrorDb("Item (Entry: %u) has min. reputation rank in RequiredReputationRank (0) but RequiredReputationFaction > 0, faction setting is useless.", i); }
}
// else if(proto->RequiredReputationRank > MIN_REPUTATION_RANK)
// sLog.outErrorDb("Item (Entry: %u) has RequiredReputationFaction ==0 but RequiredReputationRank > 0, rank setting is useless.",i);
if (proto->Stackable == 0)
{
@ -8276,7 +8274,6 @@ void ObjectMgr::LoadGossipMenuItems(std::set<uint32>& gossipScriptSet)
gMenuItem.action_poi_id = fields[7].GetUInt32();
gMenuItem.action_script_id = fields[8].GetUInt32();
gMenuItem.box_coded = fields[9].GetUInt8() != 0;
// gMenuItem.box_money = fields[10].GetUInt32();
gMenuItem.box_text = fields[11].GetCppString();
gMenuItem.conditionId = fields[12].GetUInt16();

View File

@ -411,9 +411,6 @@ void Pet::SavePetToDB(PetSaveMode mode)
_SaveSpellCooldowns();
_SaveAuras();
//uint32 loyalty = 1;
//if (getPetType() != HUNTER_PET)
// { loyalty = GetLoyaltyLevel(); }
uint32 ownerLow = GetOwnerGuid().GetCounter();
// remove current data
@ -1308,7 +1305,6 @@ void Pet::_LoadSpellCooldowns()
WorldPacket data(SMSG_SPELL_COOLDOWN, (8 + size_t(result->GetRowCount()) * 8));
data << ObjectGuid(GetObjectGuid());
//[-ZERO] data << uint8(0x0); // flags (0x1, 0x2)
do
{
@ -2010,7 +2006,6 @@ void Pet::CastOwnerTalentAuras()
if (!GetOwner() || GetOwner()->GetTypeId() != TYPEID_PLAYER)
{ return; }
//Player* pOwner = static_cast<Player*>(GetOwner());
// Add below code handling spells cast by pet when owner/player has aura from talent
}

View File

@ -124,8 +124,6 @@ enum PetTalk
PET_TALK_ATTACK = 1
};
// [-ZERO] Need recheck and drop not existed cases
enum PetNameInvalidReason
{
// custom, not send

View File

@ -89,7 +89,6 @@
#define SKILL_PERM_BONUS(x) int16(PAIR32_HIPART(x))
#define MAKE_SKILL_BONUS(t, p) MAKE_PAIR32(t,p)
// [-ZERO] need recheck, some values known not existed in 1.12.1
enum CharacterFlags
{
CHARACTER_FLAG_NONE = 0x00000000,
@ -2728,11 +2727,6 @@ void Player::SendMailResult(uint32 mailId, MailResponseType mailAction, MailResp
data << (uint32) mailError;
if (mailError == MAIL_ERR_EQUIP_ERROR)
{ data << (uint32) equipError; }
//else if (mailAction == MAIL_ITEM_TAKEN) // [-ZERO]
//{
// data << (uint32) item_guid; // item guid low?
// data << (uint32) item_count; // item count?
//}
GetSession()->SendPacket(&data);
}
@ -3622,7 +3616,6 @@ void Player::InitVisibleBits()
updateVisualBits.SetBit(UNIT_FIELD_FACTIONTEMPLATE);
updateVisualBits.SetBit(UNIT_FIELD_BYTES_0);
updateVisualBits.SetBit(UNIT_FIELD_FLAGS);
//[-ZERO] updateVisualBits.SetBit(UNIT_FIELD_FLAGS_2);
for (uint16 i = UNIT_FIELD_AURA; i < UNIT_FIELD_AURASTATE; ++i)
{ updateVisualBits.SetBit(i); }
updateVisualBits.SetBit(UNIT_FIELD_AURASTATE);
@ -3772,7 +3765,6 @@ TrainerSpellState Player::GetTrainerSpellState(TrainerSpell const* trainer_spell
SpellEntry const* spell = sSpellStore.LookupEntry(trainer_spell->spell);
SpellEntry const* TriggerSpell = sSpellStore.LookupEntry(spell->EffectTriggerSpell[0]);
// known spell
if (HasSpell(TriggerSpell->Id))
{ return TRAINER_SPELL_GRAY; }
@ -3805,7 +3797,6 @@ TrainerSpellState Player::GetTrainerSpellState(TrainerSpell const* trainer_spell
{ return TRAINER_SPELL_RED; }
// exist, already checked at loading
// SpellEntry const* spell = sSpellStore.LookupEntry(trainer_spell->spell);
// secondary prof. or not prof. spell
uint32 skill = spell->EffectMiscValue[1];
@ -4126,20 +4117,7 @@ void Player::SetLevitate(bool /*enable*/)
void Player::SetCanFly(bool /*enable*/)
{
// TODO: check if there is something similar for 1.12.x (99% chance there is not)
// WorldPacket data;
// if (enable)
// data.Initialize(SMSG_MOVE_SET_CAN_FLY, 12);
// else
// data.Initialize(SMSG_MOVE_UNSET_CAN_FLY, 12);
//
// data << GetPackGUID();
// data << uint32(0); // unk
// SendMessageToSet(&data, true);
//
// data.Initialize(MSG_MOVE_UPDATE_CAN_FLY, 64);
// data << GetPackGUID();
// m_movementInfo.Write(data);
// SendMessageToSet(&data, false);
}
void Player::SetFeatherFall(bool enable)
@ -8599,31 +8577,7 @@ InventoryResult Player::_CanTakeMoreSimilarItems(uint32 entry, uint32 count, Ite
bool Player::HasItemTotemCategory(uint32 /*TotemCategory*/) const
{
/*[-ZERO] Item *pItem;
for(uint8 i = EQUIPMENT_SLOT_START; i < INVENTORY_SLOT_ITEM_END; ++i)
{
pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i );
if( pItem && IsTotemCategoryCompatiableWith(pItem->GetProto()->TotemCategory,TotemCategory ))
return true;
}
for(uint8 i = KEYRING_SLOT_START; i < KEYRING_SLOT_END; ++i)
{
pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i );
if( pItem && IsTotemCategoryCompatiableWith(pItem->GetProto()->TotemCategory,TotemCategory ))
return true;
}
for(uint8 i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; ++i)
{
if(Bag *pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, i ))
{
for(uint32 j = 0; j < pBag->GetBagSize(); ++j)
{
pItem = GetItemByPos( i, j );
if( pItem && IsTotemCategoryCompatiableWith(pItem->GetProto()->TotemCategory,TotemCategory ))
return true;
}
}
} */
return false;
}
@ -10288,7 +10242,7 @@ void Player::VisualizeItem(uint8 slot, Item* pItem)
// check also BIND_WHEN_PICKED_UP and BIND_QUEST_ITEM for .additem or .additemset case by GM (not binded at adding to inventory)
ItemPrototype const* itemProto = pItem->GetProto();
if (itemProto->Bonding == BIND_WHEN_EQUIPPED || itemProto->Bonding == BIND_WHEN_PICKED_UP || itemProto->Bonding == BIND_QUEST_ITEM)
pItem->SetBinding(true);
{ pItem->SetBinding(true); }
DEBUG_LOG("STORAGE: EquipItem slot = %u, item = %u", slot, pItem->GetEntry());
@ -11207,8 +11161,6 @@ void Player::SendBuyError(BuyResult msg, Creature* pCreature, uint32 item, uint3
WorldPacket data(SMSG_BUY_FAILED, (8 + 4 + 1));
data << (pCreature ? pCreature->GetObjectGuid() : ObjectGuid());
data << uint32(item);
//if (param > 0)
// { data << uint32(param); } // [-ZERO]
data << uint8(msg);
GetSession()->SendPacket(&data);
}
@ -11219,8 +11171,6 @@ void Player::SendSellError(SellResult msg, Creature* pCreature, ObjectGuid itemG
WorldPacket data(SMSG_SELL_ITEM, (8 + 8 + /*(param ? 4 : 0) +*/ 1)); // last check [ZERO]
data << (pCreature ? pCreature->GetObjectGuid() : ObjectGuid());
data << ObjectGuid(itemGuid);
//if (param > 0)
// { data << uint32(param); } // [-ZERO]
data << uint8(msg);
GetSession()->SendPacket(&data);
}
@ -11566,7 +11516,6 @@ void Player::SendNewItem(Item* item, uint32 count, bool received, bool created,
data << uint32(item->GetItemSuffixFactor()); // SuffixFactor
data << uint32(item->GetItemRandomPropertyId()); // random item property id
data << uint32(count); // count of items
//data << uint32(GetItemCount(item->GetEntry())); // [-ZERO] count of items in inventory
if (broadcast && GetGroup())
{ GetGroup()->BroadcastPacket(&data, true); }
@ -15202,7 +15151,6 @@ void Player::_LoadBoundInstances(QueryResult* result)
InstancePlayerBind* Player::GetBoundInstance(uint32 mapid)
{
//const MapEntry* entry = sMapStore.LookupEntry(mapid);
BoundInstancesMap::iterator itr = m_boundInstances.find(mapid);
if (itr != m_boundInstances.end())
@ -15305,7 +15253,6 @@ void Player::SendRaidInfo()
size_t p_counter = data.wpos();
data << uint32(counter); // placeholder
//time_t now = time(NULL);
for (BoundInstancesMap::const_iterator itr = m_boundInstances.begin(); itr != m_boundInstances.end(); ++itr)
{
@ -17824,7 +17771,6 @@ inline void BeforeVisibilityDestroy(WorldObject* o, Player* p)
}
}
//2 params version (2p)
void Player::UpdateVisibilityOf(WorldObject const* viewPoint, WorldObject* target)
{
if (HaveAtClient(target))
@ -17990,7 +17936,7 @@ void Player::SendInitialPacketsBeforeAddToMap()
/* This packet seems useless...
* TODO: Work out if we need SMSG_SET_REST_START */
WorldPacket data(SMSG_SET_REST_START, 4);
data << uint32(0); // rest state time
data << uint32(0); // unknown, may be rest state time or experience
GetSession()->SendPacket(&data);
/* Send information about player's home binding */
@ -18034,7 +17980,7 @@ void Player::SendInitialPacketsAfterAddToMap()
UpdateZone(newzone, newarea); // This calls SendInitWorldStates
/* Login effect spell */
CastSpell(this, 836, true);
CastSpell(this, 836, true); // LOGINEFFECT
/* Sets aura effects that need to be sent after the player is added to the map
* We use SendMessageToSet so that it's sent to everyone, including the player
@ -18548,19 +18494,14 @@ void Player::UpdateForQuestWorldObjects()
if (m_clientGUIDs.empty())
{ return; }
// UpdateData udata;
// WorldPacket packet;
for (GuidSet::const_iterator itr = m_clientGUIDs.begin(); itr != m_clientGUIDs.end(); ++itr)
{
if (itr->IsGameObject())
{
if (GameObject* obj = GetMap()->GetGameObject(*itr))
// obj->BuildValuesUpdateBlockForPlayer(&udata,this);
{ obj->SendCreateUpdateToPlayer(this); } //[-ZERO] we must send create packet because of GAMEOBJECT_FLAGS change (not dynamic) - probably incorrect
}
}
// udata.BuildPacket(&packet);
// GetSession()->SendPacket(&packet);
}
void Player::SummonIfPossible(bool agree)
@ -18691,9 +18632,6 @@ bool Player::HasItemFitToSpellReqirements(SpellEntry const* spellInfo, Item cons
bool Player::CanNoReagentCast(SpellEntry const* /*spellInfo*/) const
{
// don't take reagents for spells with SPELL_ATTR_EX5_NO_REAGENT_WHILE_PREP
//[-ZERO] if (spellInfo->AttributesEx5 & SPELL_ATTR_EX5_NO_REAGENT_WHILE_PREP &&
// HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PREPARATION))
// return true;
return false;
}

View File

@ -332,11 +332,6 @@ enum RaidGroupError
{
ERR_RAID_GROUP_REQUIRED = 1,
ERR_RAID_GROUP_FULL = 2
//ERR_RAID_GROUP_NONE = 0,
//ERR_RAID_GROUP_LOWLEVEL = 1,
//ERR_RAID_GROUP_ONLY = 2,
//ERR_RAID_GROUP_FULL = 3,
//ERR_RAID_GROUP_REQUIREMENTS_UNMATCH = 4
};
enum DrunkenState

View File

@ -2,7 +2,7 @@
* MaNGOS is a full featured server for World of Warcraft, supporting
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
*
* Copyright (C) 2005-2020 MaNGOS <http://getmangos.eu>
* Copyright (C) 2005-2020 MaNGOS <https://getmangos.eu>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -2,7 +2,7 @@
* MaNGOS is a full featured server for World of Warcraft, supporting
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
*
* Copyright (C) 2005-2020 MaNGOS <http://getmangos.eu>
* Copyright (C) 2005-2020 MaNGOS <https://getmangos.eu>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -27,6 +27,7 @@
#include "Platform/Define.h"
#include <vector>
class Player;
class ObjectGuid;

View File

@ -244,7 +244,7 @@ bool ReputationMgr::SetReputation(FactionEntry const* factionEntry, int32 standi
#endif /* ENABLE_ELUNA */
bool res = false;
// if spillover definition exists in DB
// if spillover definition exists in DB, override DBC
if (const RepSpilloverTemplate* repTemplate = sObjectMgr.GetRepSpilloverTemplate(factionEntry->ID))
{
for (uint32 i = 0; i < MAX_SPILLOVER_FACTIONS; ++i)
@ -370,11 +370,6 @@ void ReputationMgr::SetAtWar(FactionState* faction, bool atWar)
else
{ faction->Flags &= ~FACTION_FLAG_AT_WAR; }
//WorldPacket data(SMSG_SET_FACTION_ATWAR, 4 + 1);
//data << uint32(faction->ID);
//data << uint8(faction->Flags & FACTION_FLAG_AT_WAR); // the client tests only FACTION_FLAG_AT_WAR
//m_player->SendDirectMessage(&data);
faction->needSend = true;
faction->needSave = true;
}

View File

@ -816,14 +816,6 @@ bool IsPositiveEffect(SpellEntry const* spellproto, SpellEffectIndex effIndex)
if (spellproto->HasAttribute(SPELL_ATTR_UNK26) && effIndex == EFFECT_INDEX_0)
{ return false; }
break;
// case SPELL_AURA_TRANSFORM:
// // some spells negative
// switch (spellproto->Id)
// {
// default
// break;
// }
// break;
case SPELL_AURA_MOD_SCALE:
// some spells negative
switch (spellproto->Id)
@ -1678,7 +1670,7 @@ void SpellMgr::LoadSpellLinked()
delete result;
sLog.outString();
sLog.outString(">> Loaded %u spell linked definitions", count);
sLog.outString(">> Loaded %u spell linked definitions", count);
}
SpellLinkedSet SpellMgr::GetSpellLinked(uint32 spell_id, SpellLinkedType type) const
@ -1692,7 +1684,9 @@ SpellLinkedSet SpellMgr::GetSpellLinked(uint32 spell_id, SpellLinkedType type) c
for (SpellLinkedMap::const_iterator itr = bounds.first; itr != bounds.second; ++itr)
{
if (itr->second.type == type)
{ result.insert(itr->second.linkedId); }
{
result.insert(itr->second.linkedId);
}
}
}
return result;

View File

@ -317,22 +317,18 @@ void Player::UpdateAttackPowerAndDamage(bool ranged)
void Player::CalculateMinMaxDamage(WeaponAttackType attType, bool normalized, float& min_damage, float& max_damage)
{
UnitMods unitMod;
//UnitMods attPower;
switch (attType)
{
case BASE_ATTACK:
default:
unitMod = UNIT_MOD_DAMAGE_MAINHAND;
//attPower = UNIT_MOD_ATTACK_POWER;
break;
case OFF_ATTACK:
unitMod = UNIT_MOD_DAMAGE_OFFHAND;
//attPower = UNIT_MOD_ATTACK_POWER;
break;
case RANGED_ATTACK:
unitMod = UNIT_MOD_DAMAGE_RANGED;
//attPower = UNIT_MOD_ATTACK_POWER_RANGED;
break;
}

View File

@ -1774,29 +1774,29 @@ void Unit::DealMeleeDamage(CalcDamageInfo* damageInfo, bool durabilityLoss)
// 20% base chance
float Probability = 20.0f;
// there is a newbie protection, at level 10 just 7% base chance; assuming linear function
if (pVictim->getLevel() < 30)
{
Probability = 0.65f * pVictim->getLevel() + 0.5f;
}
uint32 VictimDefense = pVictim->GetDefenseSkillValue();
uint32 AttackerMeleeSkill = GetUnitMeleeSkill();
Probability *= AttackerMeleeSkill / (float)VictimDefense;
if (Probability > 40.0f)
{
Probability = 40.0f;
}
if (roll_chance_f(Probability))
{
CastSpell(pVictim, 1604, true);
}
// there is a newbie protection, at level 10 just 7% base chance; assuming linear function
if (pVictim->getLevel() < 30)
{
Probability = 0.65f * pVictim->getLevel() + 0.5f;
}
uint32 VictimDefense = pVictim->GetDefenseSkillValue();
uint32 AttackerMeleeSkill = GetUnitMeleeSkill();
Probability *= AttackerMeleeSkill / (float)VictimDefense;
if (Probability > 40.0f)
{
Probability = 40.0f;
}
if (roll_chance_f(Probability))
{
CastSpell(pVictim, 1604, true);
}
}
// update at damage Judgement aura duration that applied by attacker at victim
if (damageInfo->damage)
{
@ -1964,7 +1964,6 @@ void Unit::CalculateDamageAbsorbAndResist(Unit* pCaster, SpellSchoolMask schoolM
if (!(mod->m_miscvalue & schoolMask))
{ continue; }
//SpellEntry const* spellProto = (*i)->GetSpellProto();
// Max Amount can be absorbed by this aura
int32 currentAbsorb = mod->m_amount;
@ -4212,16 +4211,6 @@ void Unit::RemoveAllAurasOnEvade()
// Linked and flying auras should not be removed on evade
for (SpellAuraHolderMap::iterator iter = m_spellAuraHolders.begin(); iter != m_spellAuraHolders.end();)
{
// Note: for the moment this part of the function is used as a placeholder to keep in sync with master branch
/*SpellEntry const* proto = iter->second->GetSpellProto();
if (!IsSpellHaveAura(proto, SPELL_AURA_CONTROL_VEHICLE))
{
RemoveSpellAuraHolder(iter->second, AURA_REMOVE_BY_DEFAULT);
iter = m_spellAuraHolders.begin();
}
else
++iter;*/
RemoveSpellAuraHolder(iter->second, AURA_REMOVE_BY_DEFAULT);
iter = m_spellAuraHolders.begin();
}
@ -4549,30 +4538,30 @@ void Unit::SendPeriodicAuraLog(SpellPeriodicAuraLogInfo* pInfo)
data << uint32(mod->m_auraname); // auraId
switch (mod->m_auraname)
{
case SPELL_AURA_PERIODIC_DAMAGE:
case SPELL_AURA_PERIODIC_DAMAGE_PERCENT:
data << uint32(pInfo->damage); // damage
data << uint32(aura->GetSpellProto()->School);
data << uint32(pInfo->absorb); // absorb
data << uint32(pInfo->resist); // resist
break;
case SPELL_AURA_PERIODIC_HEAL:
case SPELL_AURA_OBS_MOD_HEALTH:
data << uint32(pInfo->damage); // damage
break;
case SPELL_AURA_OBS_MOD_MANA:
case SPELL_AURA_PERIODIC_ENERGIZE:
data << uint32(mod->m_miscvalue); // power type
data << uint32(pInfo->damage); // damage
break;
case SPELL_AURA_PERIODIC_MANA_LEECH:
data << uint32(mod->m_miscvalue); // power type
data << uint32(pInfo->damage); // amount
data << float(pInfo->multiplier); // gain multiplier
break;
default:
sLog.outError("Unit::SendPeriodicAuraLog: unknown aura %u", uint32(mod->m_auraname));
return;
case SPELL_AURA_PERIODIC_DAMAGE:
case SPELL_AURA_PERIODIC_DAMAGE_PERCENT:
data << uint32(pInfo->damage); // damage
data << uint32(aura->GetSpellProto()->School);
data << uint32(pInfo->absorb); // absorb
data << uint32(pInfo->resist); // resist
break;
case SPELL_AURA_PERIODIC_HEAL:
case SPELL_AURA_OBS_MOD_HEALTH:
data << uint32(pInfo->damage); // damage
break;
case SPELL_AURA_OBS_MOD_MANA:
case SPELL_AURA_PERIODIC_ENERGIZE:
data << uint32(mod->m_miscvalue); // power type
data << uint32(pInfo->damage); // damage
break;
case SPELL_AURA_PERIODIC_MANA_LEECH:
data << uint32(mod->m_miscvalue); // power type
data << uint32(pInfo->damage); // amount
data << float(pInfo->multiplier); // gain multiplier
break;
default:
sLog.outError("Unit::SendPeriodicAuraLog: unknown aura %u", uint32(mod->m_auraname));
return;
}
aura->GetTarget()->SendMessageToSet(&data, true);
@ -4632,13 +4621,6 @@ void Unit::SendAttackStateUpdate(CalcDamageInfo* damageInfo)
data << uint32(0); // spell id, seen with heroic strike and disarm as examples.
// HITINFO_NOACTION normally set if spell
data << uint32(damageInfo->blocked_amount);
//if (damageInfo->HitInfo & HITINFO_UNK0)
//{
// data << uint32(0) << float(0) << float(0) << float(0) << float(0) << float(0) << float(0) << float(0) << float(0);
// for (int i = 0; i < 4; ++i)
// data << float(0) << float(0);
// data << uint32(0);
//}
SendMessageToSet(&data, true); /**/
}
@ -5434,7 +5416,6 @@ void Unit::SendHealSpellLog(Unit* pVictim, uint32 SpellID, uint32 Damage, bool c
data << uint32(SpellID);
data << uint32(Damage);
data << uint8(critical ? 1 : 0);
// data << uint8(0); // [-ZERO]
SendMessageToSet(&data, true);
}
@ -6953,6 +6934,7 @@ void Unit::UpdateSpeed(UnitMoveType mtype, bool forced, float ratio)
case MOVE_WALK:
break;
case MOVE_RUN:
{
if (IsMounted()) // Use on mount auras
{
main_speed_mod = GetMaxPositiveAuraModifier(SPELL_AURA_MOD_INCREASE_MOUNTED_SPEED);
@ -6966,11 +6948,14 @@ void Unit::UpdateSpeed(UnitMoveType mtype, bool forced, float ratio)
non_stack_bonus = (100.0f + GetMaxPositiveAuraModifier(SPELL_AURA_MOD_SPEED_NOT_STACK)) / 100.0f;
}
break;
}
case MOVE_RUN_BACK:
return;
case MOVE_SWIM:
{
main_speed_mod = GetMaxPositiveAuraModifier(SPELL_AURA_MOD_INCREASE_SWIM_SPEED);
break;
}
case MOVE_SWIM_BACK:
return;
default:
@ -6986,6 +6971,7 @@ void Unit::UpdateSpeed(UnitMoveType mtype, bool forced, float ratio)
{
case MOVE_RUN:
case MOVE_SWIM:
{
// Normalize speed by 191 aura SPELL_AURA_USE_NORMAL_MOVEMENT_SPEED if need
// TODO: possible affect only on MOVE_RUN
if (int32 normalization = GetMaxPositiveAuraModifier(SPELL_AURA_USE_NORMAL_MOVEMENT_SPEED))
@ -6996,6 +6982,7 @@ void Unit::UpdateSpeed(UnitMoveType mtype, bool forced, float ratio)
{ speed = max_speed; }
}
break;
}
default:
break;
}
@ -7452,7 +7439,7 @@ int32 Unit::CalculateSpellDamage(Unit const* target, SpellEntry const* spellProt
switch (randomPoints)
{
case 0:
case 0: // not used
case 1: basePoints += baseDice; break; // range 1..1
default:
{
@ -8389,6 +8376,7 @@ void Unit::ProcDamageAndSpellFor(bool isVictim, Unit* pTarget, uint32 procFlag,
{ continue; }
SpellProcEventEntry const* spellProcEvent = NULL;
// check if that aura is triggered by proc event (then it will be managed by proc handler)
if (!IsTriggeredAtSpellProcEvent(pTarget, itr->second, procSpell, procFlag, procExtra, attType, isVictim, spellProcEvent))
{ continue; }
@ -8806,7 +8794,7 @@ void Unit::SetStandState(uint8 state)
SetByteValue(UNIT_FIELD_BYTES_1, 0, state);
if (!IsSeatedState())
RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_NOT_SEATED);
{ RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_NOT_SEATED); }
if (GetTypeId() == TYPEID_PLAYER)
{

View File

@ -82,7 +82,7 @@ enum SpellAuraInterruptFlags
AURA_INTERRUPT_FLAG_NOT_SHEATHED = 0x00000200, // 9 removed by unsheathing
AURA_INTERRUPT_FLAG_UNK10 = 0x00000400, // 10
AURA_INTERRUPT_FLAG_UNK11 = 0x00000800, // 11
AURA_INTERRUPT_FLAG_MELEE_ATTACK = 0x00001000, // 12 removed by melee attack
AURA_INTERRUPT_FLAG_MELEE_ATTACK = 0x00001000, // 12 removed by melee attacks
AURA_INTERRUPT_FLAG_UNK13 = 0x00002000, // 13
AURA_INTERRUPT_FLAG_UNK14 = 0x00004000, // 14
AURA_INTERRUPT_FLAG_UNK15 = 0x00008000, // 15 removed by casting a spell?
@ -529,7 +529,6 @@ enum UnitFlags
UNIT_FLAG_SHEATHE = 0x40000000,
// UNIT_FLAG_UNK_31 = 0x80000000 // no affect in 1.12.1
// [-ZERO] TBC enumerations [?]
UNIT_FLAG_NOT_ATTACKABLE_1 = 0x00000080, ///< ?? (UNIT_FLAG_PVP_ATTACKABLE | UNIT_FLAG_NOT_ATTACKABLE_1) is NON_PVP_ATTACKABLE
UNIT_FLAG_LOOTING = 0x00000400, ///< loot animation
UNIT_FLAG_PET_IN_COMBAT = 0x00000800, ///< in combat?, 2.0.8
@ -539,7 +538,6 @@ enum UnitFlags
UNIT_FLAG_CONFUSED = 0x00400000,
UNIT_FLAG_FLEEING = 0x00800000,
UNIT_FLAG_PLAYER_CONTROLLED = 0x01000000, ///< used in spell Eyes of the Beast for pet... let attack by controlled creature
// [-ZERO] UNIT_FLAG_MOUNT = 0x08000000,
UNIT_FLAG_UNK_28 = 0x10000000,
UNIT_FLAG_UNK_29 = 0x20000000 ///< used in Feign Death spell
};
@ -1065,8 +1063,6 @@ enum ReactiveType
{
REACTIVE_DEFENSE = 1,
REACTIVE_HUNTER_PARRY = 2,
// REACTIVE_CRIT = 3,
// REACTIVE_HUNTER_CRIT = 4,
REACTIVE_OVERPOWER = 5
};
@ -2888,16 +2884,16 @@ class Unit : public WorldObject
* \see MovementInfo::HasMovementFlag
*/
bool IsRooted() const { return m_movementInfo.HasMovementFlag(MOVEFLAG_ROOT); }
/**
* Roots or unroots this \ref Unit depending on the enabled parameter.
* @param enabled whether we should root (true) or unroot (false) this \ref Unit
* \see Player::SetRoot
*/
virtual void SetLevitate(bool /*enabled*/) {}
virtual void SetSwim(bool /*enabled*/) {}
virtual void SetCanFly(bool /*enabled*/) {}
virtual void SetFeatherFall(bool /*enabled*/) {}
virtual void SetHover(bool /*enabled*/) {}
/**
* Roots or unroots this \ref Unit depending on the enabled parameter.
* @param enabled whether we should root (true) or unroot (false) this \ref Unit
* \see Player::SetRoot
*/
virtual void SetRoot(bool /*enabled*/) {}
/**
* Changes this \ref Unit s ability to walk on water.