mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 22:37:03 +00:00
[6889] Backport some not client version specific changes and fixes from 303 branch.
This commit is contained in:
parent
480a935216
commit
3da9f3f4cc
56 changed files with 1998 additions and 377 deletions
|
|
@ -173,7 +173,7 @@ void PlayerTaxi::AppendTaximaskTo( ByteBuffer& data, bool all )
|
|||
if(all)
|
||||
{
|
||||
for (uint8 i=0; i<TaxiMaskSize; i++)
|
||||
data << sTaxiNodesMask[i]; // all existed nodes
|
||||
data << uint32(sTaxiNodesMask[i]); // all existed nodes
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -494,13 +494,6 @@ bool Player::Create( uint32 guidlow, std::string name, uint8 race, uint8 class_,
|
|||
for (int i = 0; i < PLAYER_SLOTS_COUNT; i++)
|
||||
m_items[i] = NULL;
|
||||
|
||||
//for(int j = BUYBACK_SLOT_START; j < BUYBACK_SLOT_END; j++)
|
||||
//{
|
||||
// SetUInt64Value(PLAYER_FIELD_VENDORBUYBACK_SLOT_1+j*2,0);
|
||||
// SetUInt32Value(PLAYER_FIELD_BUYBACK_PRICE_1+j,0);
|
||||
// SetUInt32Value(PLAYER_FIELD_BUYBACK_TIMESTAMP_1+j,0);
|
||||
//}
|
||||
|
||||
m_race = race;
|
||||
m_class = class_;
|
||||
|
||||
|
|
@ -796,9 +789,8 @@ void Player::EnvironmentalDamage(uint64 guid, EnviromentalDamage type, uint32 da
|
|||
data << (uint32)damage;
|
||||
data << (uint32)0;
|
||||
data << (uint32)0;
|
||||
//m_session->SendPacket(&data);
|
||||
//Let other players see that you get damage
|
||||
SendMessageToSet(&data, true);
|
||||
|
||||
DealDamage(this, damage, NULL, SELF_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
|
||||
|
||||
if(type==DAMAGE_FALL && !isAlive()) // DealDamage not apply item durability loss at self damage
|
||||
|
|
@ -844,7 +836,7 @@ void Player::HandleDrowning()
|
|||
m_isunderwater|= 0x04;
|
||||
StartMirrorTimer(BREATH_TIMER, UnderWaterTime);
|
||||
}
|
||||
//continius trigger drowning "Damage"
|
||||
//continuous trigger drowning "Damage"
|
||||
if ((m_breathTimer == 0) && (m_isunderwater & 0x01))
|
||||
{
|
||||
//TODO: Check this formula
|
||||
|
|
@ -966,7 +958,7 @@ void Player::SetDrunkValue(uint16 newDrunkenValue, uint32 itemId)
|
|||
return;
|
||||
|
||||
WorldPacket data(SMSG_CROSSED_INEBRIATION_THRESHOLD, (8+4+4));
|
||||
data << GetGUID();
|
||||
data << uint64(GetGUID());
|
||||
data << uint32(newDrunkenState);
|
||||
data << uint32(itemId);
|
||||
|
||||
|
|
@ -1339,7 +1331,7 @@ void Player::BuildEnumData( QueryResult * result, WorldPacket * p_data )
|
|||
*p_data << uint8(getLevel()); // player level
|
||||
// do not use GetMap! it will spawn a new instance since the bound instances are not loaded
|
||||
uint32 zoneId = MapManager::Instance().GetZoneId(GetMapId(), GetPositionX(),GetPositionY());
|
||||
|
||||
sLog.outDebug("Player::BuildEnumData: m:%u, x:%f, y:%f, z:%f zone:%u", GetMapId(), GetPositionX(), GetPositionY(), GetPositionZ(), zoneId);
|
||||
*p_data << zoneId;
|
||||
*p_data << GetMapId();
|
||||
|
||||
|
|
@ -2380,7 +2372,6 @@ void Player::SendInitialSpells()
|
|||
continue;
|
||||
|
||||
data << uint16(itr->first);
|
||||
//data << uint16(itr->second->slotId);
|
||||
data << uint16(0); // it's not slot id
|
||||
|
||||
spellCount +=1;
|
||||
|
|
@ -2407,13 +2398,13 @@ void Player::SendInitialSpells()
|
|||
data << uint16(sEntry->Category); // spell category
|
||||
if(sEntry->Category) // may be wrong, but anyway better than nothing...
|
||||
{
|
||||
data << uint32(0);
|
||||
data << uint32(cooldown);
|
||||
data << uint32(0); // cooldown
|
||||
data << uint32(cooldown); // category cooldown
|
||||
}
|
||||
else
|
||||
{
|
||||
data << uint32(cooldown);
|
||||
data << uint32(0);
|
||||
data << uint32(cooldown); // cooldown
|
||||
data << uint32(0); // category cooldown
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -3399,7 +3390,6 @@ void Player::DestroyForPlayer( Player *target ) const
|
|||
|
||||
if(target == this)
|
||||
{
|
||||
|
||||
for(int i = INVENTORY_SLOT_BAG_START; i < BANK_SLOT_BAG_END; i++)
|
||||
{
|
||||
if(m_items[i] == NULL)
|
||||
|
|
@ -6453,23 +6443,23 @@ void Player::_ApplyItemBonuses(ItemPrototype const *proto,uint8 slot,bool apply)
|
|||
break;
|
||||
case ITEM_MOD_AGILITY: // modify agility
|
||||
HandleStatModifier(UNIT_MOD_STAT_AGILITY, BASE_VALUE, float(val), apply);
|
||||
ApplyStatBuffMod(STAT_AGILITY, val, apply);
|
||||
ApplyStatBuffMod(STAT_AGILITY, float(val), apply);
|
||||
break;
|
||||
case ITEM_MOD_STRENGTH: //modify strength
|
||||
HandleStatModifier(UNIT_MOD_STAT_STRENGTH, BASE_VALUE, float(val), apply);
|
||||
ApplyStatBuffMod(STAT_STRENGTH, val, apply);
|
||||
ApplyStatBuffMod(STAT_STRENGTH, float(val), apply);
|
||||
break;
|
||||
case ITEM_MOD_INTELLECT: //modify intellect
|
||||
HandleStatModifier(UNIT_MOD_STAT_INTELLECT, BASE_VALUE, float(val), apply);
|
||||
ApplyStatBuffMod(STAT_INTELLECT, val, apply);
|
||||
ApplyStatBuffMod(STAT_INTELLECT, float(val), apply);
|
||||
break;
|
||||
case ITEM_MOD_SPIRIT: //modify spirit
|
||||
HandleStatModifier(UNIT_MOD_STAT_SPIRIT, BASE_VALUE, float(val), apply);
|
||||
ApplyStatBuffMod(STAT_SPIRIT, val, apply);
|
||||
ApplyStatBuffMod(STAT_SPIRIT, float(val), apply);
|
||||
break;
|
||||
case ITEM_MOD_STAMINA: //modify stamina
|
||||
HandleStatModifier(UNIT_MOD_STAT_STAMINA, BASE_VALUE, float(val), apply);
|
||||
ApplyStatBuffMod(STAT_STAMINA, val, apply);
|
||||
ApplyStatBuffMod(STAT_STAMINA, float(val), apply);
|
||||
break;
|
||||
case ITEM_MOD_DEFENSE_SKILL_RATING:
|
||||
ApplyRatingMod(CR_DEFENSE_SKILL, int32(val), apply);
|
||||
|
|
@ -8847,7 +8837,7 @@ uint8 Player::_CanStoreItem( uint8 bag, uint8 slot, ItemPosCountVec &dest, uint3
|
|||
}
|
||||
else // equipped bag
|
||||
{
|
||||
// we need check 2 time (specilized/non_specialized), use NULL_BAG to prevent skipping bag
|
||||
// we need check 2 time (specialized/non_specialized), use NULL_BAG to prevent skipping bag
|
||||
res = _CanStoreItem_InBag(bag,dest,pProto,count,true,false,pItem,NULL_BAG,slot);
|
||||
if(res!=EQUIP_ERR_OK)
|
||||
res = _CanStoreItem_InBag(bag,dest,pProto,count,true,true,pItem,NULL_BAG,slot);
|
||||
|
|
@ -10305,7 +10295,6 @@ void Player::DestroyItem( uint8 bag, uint8 slot, bool update )
|
|||
|
||||
if( bag == INVENTORY_SLOT_BAG_0 )
|
||||
{
|
||||
|
||||
SetUInt64Value((uint16)(PLAYER_FIELD_INV_SLOT_HEAD + (slot*2)), 0);
|
||||
|
||||
// equipment and equipped bags can have applied bonuses
|
||||
|
|
@ -12136,7 +12125,7 @@ void Player::RewardQuest( Quest const *pQuest, uint32 reward, Object* questGiver
|
|||
if(pQuest->GetCharTitleId())
|
||||
{
|
||||
if(CharTitlesEntry const* titleEntry = sCharTitlesStore.LookupEntry(pQuest->GetCharTitleId()))
|
||||
SetFlag64(PLAYER__FIELD_KNOWN_TITLES, (uint64(1) << titleEntry->bit_index));
|
||||
SetTitle(titleEntry);
|
||||
}
|
||||
|
||||
// Send reward mail
|
||||
|
|
@ -13153,7 +13142,7 @@ void Player::SendQuestComplete( uint32 quest_id )
|
|||
if( quest_id )
|
||||
{
|
||||
WorldPacket data( SMSG_QUESTUPDATE_COMPLETE, 4 );
|
||||
data << quest_id;
|
||||
data << uint32(quest_id);
|
||||
GetSession()->SendPacket( &data );
|
||||
sLog.outDebug( "WORLD: Sent SMSG_QUESTUPDATE_COMPLETE quest = %u", quest_id );
|
||||
}
|
||||
|
|
@ -13673,14 +13662,14 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
|
|||
SetUInt32Value(UNIT_CHANNEL_SPELL,0);
|
||||
|
||||
// clear charm/summon related fields
|
||||
SetUInt64Value(UNIT_FIELD_CHARM,0);
|
||||
SetUInt64Value(UNIT_FIELD_SUMMON,0);
|
||||
SetUInt64Value(UNIT_FIELD_CHARMEDBY,0);
|
||||
SetUInt64Value(UNIT_FIELD_SUMMONEDBY,0);
|
||||
SetUInt64Value(UNIT_FIELD_CREATEDBY,0);
|
||||
SetCharm(NULL);
|
||||
SetPet(NULL);
|
||||
SetCharmerGUID(NULL);
|
||||
SetOwnerGUID(NULL);
|
||||
SetCreatorGUID(NULL);
|
||||
|
||||
// reset some aura modifiers before aura apply
|
||||
SetUInt64Value(PLAYER_FARSIGHT, 0);
|
||||
SetFarSight(NULL);
|
||||
SetUInt32Value(PLAYER_TRACK_CREATURES, 0 );
|
||||
SetUInt32Value(PLAYER_TRACK_RESOURCES, 0 );
|
||||
|
||||
|
|
@ -13765,7 +13754,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
|
|||
// note: PLAYER__FIELD_KNOWN_TITLES updated at quest status loaded
|
||||
if(uint32 curTitle = GetUInt32Value(PLAYER_CHOSEN_TITLE))
|
||||
{
|
||||
if(!HasFlag64(PLAYER__FIELD_KNOWN_TITLES,uint64(1) << curTitle))
|
||||
if(!HasTitle(curTitle))
|
||||
SetUInt32Value(PLAYER_CHOSEN_TITLE,0);
|
||||
}
|
||||
|
||||
|
|
@ -14380,7 +14369,7 @@ void Player::_LoadQuestStatus(QueryResult *result)
|
|||
if(pQuest->GetCharTitleId())
|
||||
{
|
||||
if(CharTitlesEntry const* titleEntry = sCharTitlesStore.LookupEntry(pQuest->GetCharTitleId()))
|
||||
SetFlag64(PLAYER__FIELD_KNOWN_TITLES, (uint64(1) << titleEntry->bit_index));
|
||||
SetTitle(titleEntry);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -15673,8 +15662,8 @@ void Player::RemovePet(Pet* pet, PetSaveMode mode, bool returnreagent)
|
|||
m_guardianPets.erase(pet->GetGUID());
|
||||
break;
|
||||
default:
|
||||
if(GetPetGUID()==pet->GetGUID())
|
||||
SetPet(0);
|
||||
if(GetPetGUID() == pet->GetGUID())
|
||||
SetPet(NULL);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -18249,7 +18238,7 @@ Player* Player::GetNextRandomRaidMember(float radius)
|
|||
void Player::UpdateUnderwaterState( Map* m, float x, float y, float z )
|
||||
{
|
||||
float water_z = m->GetWaterLevel(x,y);
|
||||
float height_z = m->GetHeight(x,y,z, false); // use .map base surface height
|
||||
float height_z = m->GetHeight(x,y,z, false); // use .map base surface height
|
||||
uint8 flag1 = m->GetTerrainType(x,y);
|
||||
|
||||
//!Underwater check, not in water if underground or above water level
|
||||
|
|
@ -18292,11 +18281,28 @@ bool ItemPosCount::isContainedIn(ItemPosCountVec const& vec) const
|
|||
|
||||
bool Player::isAllowUseBattleGroundObject()
|
||||
{
|
||||
return ( //InBattleGround() && // in battleground - not need, check in other cases
|
||||
!IsMounted() && // not mounted
|
||||
!HasStealthAura() && // not stealthed
|
||||
!HasInvisibilityAura() && // not invisible
|
||||
!HasAura(SPELL_RECENTLY_DROPPED_FLAG, 0) && // can't pickup
|
||||
isAlive() // live player
|
||||
return ( //InBattleGround() && // in battleground - not need, check in other cases
|
||||
!IsMounted() && // not mounted
|
||||
!HasStealthAura() && // not stealthed
|
||||
!HasInvisibilityAura() && // not invisible
|
||||
!HasAura(SPELL_RECENTLY_DROPPED_FLAG, 0) && // can't pickup
|
||||
isAlive() // live player
|
||||
);
|
||||
}
|
||||
|
||||
bool Player::HasTitle(uint32 bitIndex)
|
||||
{
|
||||
if (bitIndex > 128)
|
||||
return false;
|
||||
|
||||
uint32 fieldIndexOffset = bitIndex/32;
|
||||
uint32 flag = 1 << (bitIndex%32);
|
||||
return HasFlag(PLAYER__FIELD_KNOWN_TITLES+fieldIndexOffset, flag);
|
||||
}
|
||||
|
||||
void Player::SetTitle(CharTitlesEntry const* title)
|
||||
{
|
||||
uint32 fieldIndexOffset = title->bit_index/32;
|
||||
uint32 flag = 1 << (title->bit_index%32);
|
||||
SetFlag(PLAYER__FIELD_KNOWN_TITLES+fieldIndexOffset, flag);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue