Changeset 142
- Timestamp:
- 11/19/08 13:40:02 (17 years ago)
- Location:
- trunk/src/game
- Files:
-
- 6 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/game/Player.cpp
r136 r142 16604 16604 16605 16605 // prevent stealth flight 16606 Remove SpellsCausingAura(SPELL_AURA_MOD_STEALTH);16606 RemoveInterruptableAura(AURA_INTERRUPT_FLAG_STEALTH); 16607 16607 16608 16608 WorldPacket data(SMSG_ACTIVATETAXIREPLY, 4); -
trunk/src/game/Spell.cpp
r141 r142 95 95 } 96 96 97 void SpellCastTargets::setDestination(float x, float y, float z, bool send )97 void SpellCastTargets::setDestination(float x, float y, float z, bool send, uint32 mapId) 98 98 { 99 99 m_destX = x; … … 103 103 if(send) 104 104 m_targetMask |= TARGET_FLAG_DEST_LOCATION; 105 if(mapId) 106 m_mapId = mapId; 105 107 } 106 108 … … 1007 1009 //if(!IsPositiveSpell(m_spellInfo->Id)) 1008 1010 { 1009 unit->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH); 1011 //do not remove feign death 1012 unit->RemoveInterruptableAura(AURA_INTERRUPT_FLAG_STEALTH + AURA_INTERRUPT_FLAG_DAMAGE); 1010 1013 } 1011 1014 } … … 1013 1016 { 1014 1017 // for delayed spells ignore negative spells (after duel end) for friendly targets 1018 // TODO: this cause soul transfer bugged 1015 1019 if(m_spellInfo->speed > 0.0f && !IsPositiveSpell(m_spellInfo->Id)) 1016 1020 { … … 1250 1254 void Spell::SearchAreaTarget(std::list<Unit*> &TagUnitMap, float radius, const uint32 &type, SpellTargets TargetType, uint32 entry) 1251 1255 { 1252 if(type == PUSH_DEST_CENTER && !m_targets.HasDest()) 1253 { 1254 sLog.outError( "SPELL: cannot find destination for spell ID %u\n", m_spellInfo->Id ); 1255 return; 1256 } 1257 1258 CellPair p(Trinity::ComputeCellPair(m_targets.m_destX, m_targets.m_destY)); 1256 float x, y; 1257 if(type == PUSH_DEST_CENTER) 1258 { 1259 if(!m_targets.HasDest()) 1260 { 1261 sLog.outError( "SPELL: cannot find destination for spell ID %u\n", m_spellInfo->Id ); 1262 return; 1263 } 1264 x = m_targets.m_destX; 1265 y = m_targets.m_destY; 1266 } 1267 else 1268 { 1269 x = m_caster->GetPositionX(); 1270 y = m_caster->GetPositionY(); 1271 } 1272 1273 CellPair p(Trinity::ComputeCellPair(x, y)); 1259 1274 Cell cell(p); 1260 1275 cell.data.Part.reserved = ALL_DISTRICT; … … 1436 1451 if(SpellTargetPosition const* st = spellmgr.GetSpellTargetPosition(m_spellInfo->Id)) 1437 1452 { 1438 if (st->target_mapId == m_caster->GetMapId()) 1453 //TODO: fix this check 1454 if(m_spellInfo->Effect[0] == SPELL_EFFECT_TELEPORT_UNITS 1455 || m_spellInfo->Effect[1] == SPELL_EFFECT_TELEPORT_UNITS 1456 || m_spellInfo->Effect[2] == SPELL_EFFECT_TELEPORT_UNITS) 1457 m_targets.setDestination(st->target_X, st->target_Y, st->target_Z, true, st->target_mapId); 1458 else if(st->target_mapId == m_caster->GetMapId()) 1439 1459 m_targets.setDestination(st->target_X, st->target_Y, st->target_Z); 1440 1460 } 1441 1461 else 1442 1462 sLog.outError( "SPELL: unknown target coordinates for spell ID %u\n", m_spellInfo->Id ); 1463 break; 1464 case TARGET_INNKEEPER_COORDINATES: 1465 if(m_caster->GetTypeId() == TYPEID_PLAYER) 1466 m_targets.setDestination(((Player*)m_caster)->m_homebindX,((Player*)m_caster)->m_homebindY,((Player*)m_caster)->m_homebindZ, true, ((Player*)m_caster)->m_homebindMapId); 1443 1467 break; 1444 1468 … … 1481 1505 case TARGET_IN_FRONT_OF_CASTER: 1482 1506 case TARGET_UNIT_CONE_ENEMY_UNKNOWN: 1483 {1484 1507 switch(spellmgr.GetSpellExtraAttr(m_spellInfo->Id, SPELL_EXTRA_ATTR_CONE_TYPE)) 1485 1508 { … … 1494 1517 SearchAreaTarget(TagUnitMap, radius, PUSH_IN_LINE, SPELL_TARGETS_AOE_DAMAGE); 1495 1518 break; 1496 } 1497 }break; 1519 }break; 1498 1520 case TARGET_UNIT_CONE_ALLY: 1499 {1500 1521 SearchAreaTarget(TagUnitMap, radius, PUSH_IN_FRONT, SPELL_TARGETS_FRIENDLY); 1501 }break;1522 break; 1502 1523 1503 1524 // nearby target … … 2000 2021 case TARGET_DEST_DEST_RANDOM: 2001 2022 { 2002 if(! (m_targets.m_targetMask & TARGET_FLAG_DEST_LOCATION))2023 if(!m_targets.HasDest()) 2003 2024 { 2004 2025 sLog.outError("SPELL: no destination for spell ID %u\n", m_spellInfo->Id); … … 2014 2035 }break; 2015 2036 case TARGET_SELF2: 2016 m_targets.m_hasDest = true; 2037 if(!m_targets.HasDest()) 2038 { 2039 sLog.outError("SPELL: no destination for spell ID %u\n", m_spellInfo->Id); 2040 break; 2041 } 2017 2042 break; 2018 2043 default: … … 2124 2149 if ( !m_IsTriggeredSpell && isSpellBreakStealth(m_spellInfo) ) 2125 2150 { 2126 m_caster->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH); 2127 m_caster->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH); 2151 m_caster->RemoveInterruptableAura(AURA_INTERRUPT_FLAG_STEALTH); 2128 2152 } 2129 2153 -
trunk/src/game/Spell.h
r139 r142 112 112 //m_srcZ = target.m_srcZ; 113 113 114 m_mapId = 0; 114 115 m_destX = target.m_destX; 115 116 m_destY = target.m_destY; … … 127 128 Unit *getUnitTarget() const { return m_unitTarget; } 128 129 void setUnitTarget(Unit *target); 129 void setDestination(float x, float y, float z, bool send = true );130 void setDestination(float x, float y, float z, bool send = true, uint32 mapId = 0); 130 131 void setDestination(Unit *target, bool send = true); 131 132 … … 155 156 156 157 float m_srcX, m_srcY, m_srcZ; 158 uint32 m_mapId; 157 159 float m_destX, m_destY, m_destZ; 158 160 bool m_hasDest; … … 549 551 float i_radius; 550 552 SpellTargets i_TargetType; 551 Unit* i_ originalCaster;553 Unit* i_caster; 552 554 uint32 i_entry; 553 555 … … 556 558 : i_data(&data), i_spell(spell), i_push_type(type), i_radius(radius), i_TargetType(TargetType), i_entry(entry) 557 559 { 558 i_ originalCaster = spell.GetCaster();560 i_caster = spell.GetCaster(); 559 561 } 560 562 … … 563 565 assert(i_data); 564 566 565 if(!i_ originalCaster)567 if(!i_caster) 566 568 return; 567 569 … … 574 576 { 575 577 case SPELL_TARGETS_FRIENDLY: 576 if (!itr->getSource()->isTargetableForAttack() || !i_ originalCaster->IsFriendlyTo( itr->getSource() ))578 if (!itr->getSource()->isTargetableForAttack() || !i_caster->IsFriendlyTo( itr->getSource() )) 577 579 continue; 578 580 break; … … 584 586 continue; 585 587 586 Unit* check = i_ originalCaster->GetCharmerOrOwnerOrSelf();588 Unit* check = i_caster->GetCharmerOrOwnerOrSelf(); 587 589 588 590 if( check->GetTypeId()==TYPEID_PLAYER ) … … 608 610 { 609 611 case PUSH_IN_FRONT: 610 if(i_ spell.GetCaster()->isInFront((Unit*)(itr->getSource()), i_radius, M_PI/3 ))612 if(i_caster->isInFront((Unit*)(itr->getSource()), i_radius, M_PI/3 )) 611 613 i_data->push_back(itr->getSource()); 612 614 break; 613 615 case PUSH_IN_BACK: 614 if(i_ spell.GetCaster()->isInBack((Unit*)(itr->getSource()), i_radius, M_PI/3 ))616 if(i_caster->isInBack((Unit*)(itr->getSource()), i_radius, M_PI/3 )) 615 617 i_data->push_back(itr->getSource()); 616 618 break; 617 619 case PUSH_IN_LINE: 618 if(i_ spell.GetCaster()->isInLine((Unit*)(itr->getSource()), i_radius ))620 if(i_caster->isInLine((Unit*)(itr->getSource()), i_radius )) 619 621 i_data->push_back(itr->getSource()); 620 622 break; 621 623 case PUSH_SELF_CENTER: 622 if(i_ spell.GetCaster()->IsWithinDistInMap((Unit*)(itr->getSource()), i_radius))624 if(i_caster->IsWithinDistInMap((Unit*)(itr->getSource()), i_radius)) 623 625 i_data->push_back(itr->getSource()); 624 626 break; -
trunk/src/game/SpellEffects.cpp
r141 r142 1972 1972 return; 1973 1973 1974 switch (m_spellInfo->EffectImplicitTargetB[i]) 1975 { 1976 case TARGET_INNKEEPER_COORDINATES: 1977 { 1978 // Only players can teleport to innkeeper 1979 if (unitTarget->GetTypeId() != TYPEID_PLAYER) 1980 return; 1981 1982 ((Player*)unitTarget)->TeleportTo(((Player*)unitTarget)->m_homebindMapId,((Player*)unitTarget)->m_homebindX,((Player*)unitTarget)->m_homebindY,((Player*)unitTarget)->m_homebindZ,unitTarget->GetOrientation(),unitTarget==m_caster ? TELE_TO_SPELL : 0); 1983 return; 1984 } 1985 default: 1986 { 1987 // If not exist data for dest location - return 1988 if(!m_targets.HasDest()) 1989 { 1990 sLog.outError( "Spell::EffectTeleportUnits - unknown EffectImplicitTargetB[%u] = %u for spell ID %u\n", i, m_spellInfo->EffectImplicitTargetB[i], m_spellInfo->Id ); 1991 return; 1992 } 1993 // Init dest coordinates 1994 uint32 mapid = m_caster->GetMapId(); 1995 float x = m_targets.m_destX; 1996 float y = m_targets.m_destY; 1997 float z = m_targets.m_destZ; 1998 float orientation = unitTarget->GetOrientation(); 1999 // Teleport 2000 if(unitTarget->GetTypeId() == TYPEID_PLAYER) 2001 ((Player*)unitTarget)->TeleportTo(mapid, x, y, z, orientation, TELE_TO_NOT_LEAVE_COMBAT | TELE_TO_NOT_UNSUMMON_PET | (unitTarget==m_caster ? TELE_TO_SPELL : 0)); 2002 else 2003 { 2004 MapManager::Instance().GetMap(mapid, m_caster)->CreatureRelocation((Creature*)unitTarget, x, y, z, orientation); 2005 WorldPacket data; 2006 unitTarget->BuildTeleportAckMsg(&data, x, y, z, orientation); 2007 unitTarget->SendMessageToSet(&data, false); 2008 } 2009 return; 2010 } 1974 // If not exist data for dest location - return 1975 if(!m_targets.HasDest()) 1976 { 1977 sLog.outError( "Spell::EffectTeleportUnits - does not have destination for spell ID %u\n", m_spellInfo->Id ); 1978 return; 1979 } 1980 // Init dest coordinates 1981 uint32 mapid = m_targets.m_mapId; 1982 float x = m_targets.m_destX; 1983 float y = m_targets.m_destY; 1984 float z = m_targets.m_destZ; 1985 float orientation = unitTarget->GetOrientation(); 1986 sLog.outDebug("Spell::EffectTeleportUnits - teleport unit to %u %f %f %f\n", mapid, x, y, z); 1987 // Teleport 1988 if(unitTarget->GetTypeId() == TYPEID_PLAYER) 1989 ((Player*)unitTarget)->TeleportTo(mapid, x, y, z, orientation, TELE_TO_NOT_LEAVE_COMBAT | TELE_TO_NOT_UNSUMMON_PET | (unitTarget==m_caster ? TELE_TO_SPELL : 0)); 1990 else 1991 { 1992 MapManager::Instance().GetMap(mapid, m_caster)->CreatureRelocation((Creature*)unitTarget, x, y, z, orientation); 1993 WorldPacket data; 1994 unitTarget->BuildTeleportAckMsg(&data, x, y, z, orientation); 1995 unitTarget->SendMessageToSet(&data, false); 2011 1996 } 2012 1997 … … 3490 3475 { 3491 3476 // Reveal action + get attack 3492 m_caster->Remove SpellsCausingAura(SPELL_AURA_MOD_STEALTH);3477 m_caster->RemoveInterruptableAura(AURA_INTERRUPT_FLAG_STEALTH); 3493 3478 if (((Creature*)unitTarget)->AI()) 3494 3479 ((Creature*)unitTarget)->AI()->AttackStart(m_caster); -
trunk/src/game/Unit.cpp
r141 r142 455 455 } 456 456 457 void Unit::RemoveInterruptableAura(uint32 flag) 458 { 459 AuraList::iterator iter, next; 460 for (iter = m_interruptableAuras.begin(); iter != m_interruptableAuras.end(); iter = next) 461 { 462 next = iter; 463 ++next; 464 465 //sLog.outDetail("auraflag:%u flag:%u = %u",(*iter)->GetSpellProto()->AuraInterruptFlags,flag,(*iter)->GetSpellProto()->AuraInterruptFlags & flag); 466 if(*iter && ((*iter)->GetSpellProto()->AuraInterruptFlags & flag) == flag) 467 { 468 RemoveAurasDueToSpell((*iter)->GetId()); 469 if (!m_interruptableAuras.empty()) 470 next = m_interruptableAuras.begin(); 471 else 472 return; 473 } 474 } 475 } 476 457 477 bool Unit::HasAuraType(AuraType auraType) const 458 478 { … … 475 495 476 496 // remove affects from victim (including from 0 damage and DoTs) 477 if(pVictim != this)478 pVictim->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH);497 //if(pVictim != this) 498 // pVictim->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH); 479 499 480 500 // remove affects from attacker at any non-DoT damage (including 0 damage) 481 501 if( damagetype != DOT) 482 502 { 483 RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH); 484 RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH); 503 RemoveInterruptableAura(AURA_INTERRUPT_FLAG_STEALTH); 485 504 486 505 if(pVictim->GetTypeId() == TYPEID_PLAYER && !pVictim->IsStandState() && !pVictim->hasUnitState(UNIT_STAT_STUNNED)) … … 3739 3758 { 3740 3759 m_modAuras[Aur->GetModifier()->m_auraname].push_back(Aur); 3760 if(Aur->GetSpellProto()->AuraInterruptFlags) 3761 m_interruptableAuras.push_back(Aur); 3741 3762 } 3742 3763 … … 4111 4132 { 4112 4133 m_modAuras[(*i).second->GetModifier()->m_auraname].remove((*i).second); 4134 if((*i).second->GetSpellProto()->AuraInterruptFlags) 4135 m_interruptableAuras.remove((*i).second); 4113 4136 } 4114 4137 -
trunk/src/game/Unit.h
r141 r142 72 72 AURA_INTERRUPT_FLAG_UNK12 = 0x00001000, // 12 removed by attack? 73 73 AURA_INTERRUPT_FLAG_UNK13 = 0x00002000, // 13 74 AURA_INTERRUPT_FLAG_STEALTH = 0x00003C00, 74 75 AURA_INTERRUPT_FLAG_UNK14 = 0x00004000, // 14 75 76 AURA_INTERRUPT_FLAG_UNK15 = 0x00008000, // 15 removed by casting a spell? … … 1004 1005 1005 1006 void RemoveSpellsCausingAura(AuraType auraType); 1007 void RemoveInterruptableAura(uint32 flag); 1006 1008 void RemoveRankAurasDueToSpell(uint32 spellId); 1007 1009 bool RemoveNoStackAurasDueToAura(Aura *Aur); … … 1301 1303 1302 1304 AuraList m_modAuras[TOTAL_AURAS]; 1305 AuraList m_interruptableAuras; 1303 1306 float m_auraModifiersGroup[UNIT_MOD_END][MODIFIER_TYPE_END]; 1304 1307 float m_weaponDamage[MAX_ATTACK][2];