Changeset 257 for trunk/src/game/Player.cpp
- Timestamp:
- 11/19/08 13:51:33 (17 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/game/Player.cpp
r233 r257 800 800 } 801 801 802 void Player::EnvironmentalDamage(uint64 guid, Enviro nmentalDamageType type, uint32 damage)802 void Player::EnvironmentalDamage(uint64 guid, EnviromentalDamage type, uint32 damage) 803 803 { 804 804 WorldPacket data(SMSG_ENVIRONMENTALDAMAGELOG, (21)); … … 1642 1642 { 1643 1643 // far teleport to another map 1644 Map* oldmap = IsInWorld() ? MapManager::Instance().GetMap(GetMapId(), this) : NULL;1644 Map* oldmap = IsInWorld() ? GetMap() : NULL; 1645 1645 // check if we can enter before stopping combat / removing pet / totems / interrupting spells 1646 1646 … … 3751 3751 } 3752 3752 3753 void Player::ResurrectPlayer(float restore_percent, bool updateToWorld, boolapplySickness)3753 void Player::ResurrectPlayer(float restore_percent, bool applySickness) 3754 3754 { 3755 3755 WorldPacket data(SMSG_DEATH_RELEASE_LOC, 4*4); // remove spirit healer position … … 4282 4282 } 4283 4283 4284 void Player::HandleBaseModValue(BaseModGroup modGroup, BaseModType modType, float amount, bool apply , bool affectStats)4284 void Player::HandleBaseModValue(BaseModGroup modGroup, BaseModType modType, float amount, bool apply) 4285 4285 { 4286 4286 if(modGroup >= BASEMOD_END || modType >= MOD_END) … … 5244 5244 } 5245 5245 5246 Map *m = MapManager::Instance().GetMap(GetMapId(), this);5246 Map *m = GetMap(); 5247 5247 5248 5248 const float old_x = GetPositionX(); … … 5262 5262 5263 5263 // reread after Map::Relocation 5264 m = MapManager::Instance().GetMap(GetMapId(), this);5264 m = GetMap(); 5265 5265 x = GetPositionX(); 5266 5266 y = GetPositionY(); … … 6177 6177 return 0; 6178 6178 6179 return (*result)[0].GetUInt32(); 6179 uint32 id = (*result)[0].GetUInt32(); 6180 delete result; 6181 return id; 6180 6182 } 6181 6183 … … 6708 6710 } 6709 6711 6710 if(!IsUseEquip pedWeapon(slot==EQUIPMENT_SLOT_MAINHAND))6712 if(!IsUseEquipedWeapon(slot==EQUIPMENT_SLOT_MAINHAND)) 6711 6713 return; 6712 6714 … … 8486 8488 return item; 8487 8489 8488 if( item->IsBroken() || !IsUseEquip pedWeapon(attackType==BASE_ATTACK) )8490 if( item->IsBroken() || !IsUseEquipedWeapon(attackType==BASE_ATTACK) ) 8489 8491 return NULL; 8490 8492 … … 8640 8642 return false; 8641 8643 } 8644 8642 8645 8643 8646 bool Player::HasItemCount( uint32 item, uint32 count, bool inBankAlso ) const … … 10156 10159 if( pItem->GetProto()->Bonding == BIND_WHEN_PICKED_UP || 10157 10160 pItem->GetProto()->Bonding == BIND_QUEST_ITEM || 10158 pItem->GetProto()->Bonding == BIND_WHEN_EQUIP PED && IsBagPos(pos) )10161 pItem->GetProto()->Bonding == BIND_WHEN_EQUIPED && IsBagPos(pos) ) 10159 10162 pItem->SetBinding( true ); 10160 10163 … … 10202 10205 if( pItem2->GetProto()->Bonding == BIND_WHEN_PICKED_UP || 10203 10206 pItem2->GetProto()->Bonding == BIND_QUEST_ITEM || 10204 pItem2->GetProto()->Bonding == BIND_WHEN_EQUIP PED && IsBagPos(pos) )10207 pItem2->GetProto()->Bonding == BIND_WHEN_EQUIPED && IsBagPos(pos) ) 10205 10208 pItem2->SetBinding( true ); 10206 10209 … … 10404 10407 10405 10408 // check also BIND_WHEN_PICKED_UP and BIND_QUEST_ITEM for .additem or .additemset case by GM (not binded at adding to inventory) 10406 if( pItem->GetProto()->Bonding == BIND_WHEN_EQUIP PED || pItem->GetProto()->Bonding == BIND_WHEN_PICKED_UP || pItem->GetProto()->Bonding == BIND_QUEST_ITEM )10409 if( pItem->GetProto()->Bonding == BIND_WHEN_EQUIPED || pItem->GetProto()->Bonding == BIND_WHEN_PICKED_UP || pItem->GetProto()->Bonding == BIND_QUEST_ITEM ) 10407 10410 pItem->SetBinding( true ); 10408 10411 … … 10548 10551 if(pItem->HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAGS_WRAPPED)) 10549 10552 CharacterDatabase.PExecute("DELETE FROM character_gifts WHERE item_guid = '%u'", pItem->GetGUIDLow()); 10550 10551 ItemPrototype const *pProto = pItem->GetProto();10552 10553 10553 10554 RemoveEnchantmentDurations(pItem); … … 14208 14209 SetUInt32Value(i, 0); 14209 14210 14210 //QueryResult *result = CharacterDatabase.PQuery("SELECT caster_guid,spell,effect_index, amount,maxduration,remaintime,remaincharges FROM character_aura WHERE guid = '%u'",GetGUIDLow());14211 //QueryResult *result = CharacterDatabase.PQuery("SELECT caster_guid,spell,effect_index,stackcount,amount,maxduration,remaintime,remaincharges FROM character_aura WHERE guid = '%u'",GetGUIDLow()); 14211 14212 14212 14213 if(result) … … 14218 14219 uint32 spellid = fields[1].GetUInt32(); 14219 14220 uint32 effindex = fields[2].GetUInt32(); 14220 int32 damage = (int32)fields[3].GetUInt32(); 14221 int32 maxduration = (int32)fields[4].GetUInt32(); 14222 int32 remaintime = (int32)fields[5].GetUInt32(); 14223 int32 remaincharges = (int32)fields[6].GetUInt32(); 14221 uint32 stackcount = fields[3].GetUInt32(); 14222 int32 damage = (int32)fields[4].GetUInt32(); 14223 int32 maxduration = (int32)fields[5].GetUInt32(); 14224 int32 remaintime = (int32)fields[6].GetUInt32(); 14225 int32 remaincharges = (int32)fields[7].GetUInt32(); 14224 14226 14225 14227 SpellEntry const* spellproto = sSpellStore.LookupEntry(spellid); … … 14258 14260 continue; 14259 14261 14260 Aura* aura = CreateAura(spellproto, effindex, NULL, this, NULL); 14261 if(!damage) 14262 damage = aura->GetModifier()->m_amount; 14263 aura->SetLoadedState(caster_guid,damage,maxduration,remaintime,remaincharges); 14264 AddAura(aura); 14262 for(uint32 i=0; i<stackcount; i++) 14263 { 14264 Aura* aura = CreateAura(spellproto, effindex, NULL, this, NULL); 14265 if(!damage) 14266 damage = aura->GetModifier()->m_amount; 14267 aura->SetLoadedState(caster_guid,damage,maxduration,remaintime,remaincharges); 14268 AddAura(aura); 14269 sLog.outString("Added aura spellid %u, effect %u", spellproto->Id, effindex); 14270 } 14265 14271 } 14266 14272 while( result->NextRow() ); … … 15321 15327 15322 15328 AuraMap const& auras = GetAuras(); 15323 for(AuraMap::const_iterator itr = auras.begin(); itr != auras.end(); ++itr) 15324 { 15325 SpellEntry const *spellInfo = itr->second->GetSpellProto(); 15326 15327 //skip all auras from spells that are passive or need a shapeshift 15328 if (itr->second->IsPassive() || itr->second->IsRemovedOnShapeLost()) 15329 continue; 15330 15331 //do not save single target auras (unless they were cast by the player) 15332 if (itr->second->GetCasterGUID() != GetGUID() && IsSingleTargetSpell(spellInfo)) 15333 continue; 15334 15335 uint8 i; 15336 // or apply at cast SPELL_AURA_MOD_SHAPESHIFT or SPELL_AURA_MOD_STEALTH auras 15337 for (i = 0; i < 3; i++) 15338 if (spellInfo->EffectApplyAuraName[i] == SPELL_AURA_MOD_SHAPESHIFT || 15339 spellInfo->EffectApplyAuraName[i] == SPELL_AURA_MOD_STEALTH) 15329 15330 if (auras.empty()) 15331 return; 15332 15333 spellEffectPair lastEffectPair = auras.begin()->first; 15334 uint32 stackCounter = 1; 15335 15336 for(AuraMap::const_iterator itr = auras.begin(); ; ++itr) 15337 { 15338 if(itr == auras.end() || lastEffectPair != itr->first) 15339 { 15340 AuraMap::const_iterator itr2 = itr; 15341 // save previous spellEffectPair to db 15342 itr2--; 15343 SpellEntry const *spellInfo = itr2->second->GetSpellProto(); 15344 15345 //skip all auras from spells that are passive or need a shapeshift 15346 if (!(itr2->second->IsPassive() || itr2->second->IsRemovedOnShapeLost())) 15347 { 15348 //do not save single target auras (unless they were cast by the player) 15349 if (!(itr2->second->GetCasterGUID() != GetGUID() && IsSingleTargetSpell(spellInfo))) 15350 { 15351 uint8 i; 15352 // or apply at cast SPELL_AURA_MOD_SHAPESHIFT or SPELL_AURA_MOD_STEALTH auras 15353 for (i = 0; i < 3; i++) 15354 if (spellInfo->EffectApplyAuraName[i] == SPELL_AURA_MOD_SHAPESHIFT || 15355 spellInfo->EffectApplyAuraName[i] == SPELL_AURA_MOD_STEALTH) 15356 break; 15357 15358 if (i == 3) 15359 { 15360 CharacterDatabase.PExecute("INSERT INTO character_aura (guid,caster_guid,spell,effect_index,stackcount,amount,maxduration,remaintime,remaincharges) " 15361 "VALUES ('%u', '" I64FMTD "' ,'%u', '%u', '%u', '%d', '%d', '%d', '%d')", 15362 GetGUIDLow(), itr2->second->GetCasterGUID(), (uint32)itr2->second->GetId(), (uint32)itr2->second->GetEffIndex(), stackCounter, itr2->second->GetModifier()->m_amount,int(itr2->second->GetAuraMaxDuration()),int(itr2->second->GetAuraDuration()),int(itr2->second->m_procCharges)); 15363 } 15364 } 15365 } 15366 15367 if(itr == auras.end()) 15340 15368 break; 15341 15342 if (i == 3) 15343 { 15344 CharacterDatabase.PExecute("DELETE FROM character_aura WHERE guid = '%u' and spell = '%u' and effect_index= '%u'",GetGUIDLow(),(uint32)(*itr).second->GetId(), (uint32)(*itr).second->GetEffIndex()); 15345 CharacterDatabase.PExecute("INSERT INTO character_aura (guid,caster_guid,spell,effect_index,amount,maxduration,remaintime,remaincharges) " 15346 "VALUES ('%u', '" I64FMTD "' ,'%u', '%u', '%d', '%d', '%d', '%d')", 15347 GetGUIDLow(), itr->second->GetCasterGUID(), (uint32)(*itr).second->GetId(), (uint32)(*itr).second->GetEffIndex(), (*itr).second->GetModifier()->m_amount,int((*itr).second->GetAuraMaxDuration()),int((*itr).second->GetAuraDuration()),int((*itr).second->m_procCharges)); 15369 } 15370 15371 if (lastEffectPair == itr->first) 15372 stackCounter++; 15373 else 15374 { 15375 lastEffectPair = itr->first; 15376 stackCounter = 1; 15348 15377 } 15349 15378 } … … 17911 17940 continue; 17912 17941 17913 if ( SpellEntry const* spellentry =sSpellStore.LookupEntry(pAbility->spellId))17942 if (sSpellStore.LookupEntry(pAbility->spellId)) 17914 17943 { 17915 17944 // Ok need learn spell … … 18324 18353 Player* not_gray_member_with_max_level = NULL; 18325 18354 18326 // gets the max member level of the group, and the max member level that still gets XP18327 18355 pGroup->GetDataForXPAtKill(pVictim,count,sum_level,member_with_max_level,not_gray_member_with_max_level); 18328 18356 … … 18333 18361 xp = (PvP || !not_gray_member_with_max_level) ? 0 : Trinity::XP::Gain(not_gray_member_with_max_level, pVictim); 18334 18362 18335 // skip in check PvP case (for speed, not used)18363 /// skip in check PvP case (for speed, not used) 18336 18364 bool is_raid = PvP ? false : sMapStore.LookupEntry(GetMapId())->IsRaid() && pGroup->isRaidGroup(); 18337 18365 bool is_dungeon = PvP ? false : sMapStore.LookupEntry(GetMapId())->IsDungeon(); … … 18660 18688 UpdateBlockPercentage(); 18661 18689 } 18690 18691 bool ItemPosCount::isContainedIn(ItemPosCountVec const& vec) const 18692 { 18693 for(ItemPosCountVec::const_iterator itr = vec.begin(); itr != vec.end();++itr) 18694 if(itr->pos == pos) 18695 return true; 18696 return false; 18697 } 18698 18699 //*********************************** 18700 //-------------TRINITY--------------- 18701 //*********************************** 18662 18702 18663 18703 void Player::HandleFallDamage(MovementInfo& movementInfo) … … 18962 19002 } 18963 19003 18964 bool ItemPosCount::isContainedIn(ItemPosCountVec const& vec) const18965 {18966 for(ItemPosCountVec::const_iterator itr = vec.begin(); itr != vec.end();++itr)18967 if(itr->pos == this->pos)18968 return true;18969 18970 return false;18971 }18972 18973 19004 bool Player::isTotalImmunity() 18974 19005 {