Changeset 139
- Timestamp:
- 11/19/08 13:39:41 (17 years ago)
- Location:
- trunk/src/game
- Files:
-
- 9 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/game/MiscHandler.cpp
r102 r139 773 773 ignoreResult = FRIEND_IGNORE_ADDED; 774 774 775 _player->GetSocial()->AddToSocialList(GUID_LOPART(IgnoreGuid), true); 775 if(!_player->GetSocial()->AddToSocialList(GUID_LOPART(IgnoreGuid), true)) 776 ignoreResult = FRIEND_IGNORE_FULL; 776 777 } 777 778 else if(ignoreResult==FRIEND_IGNORE_ALREADY) -
trunk/src/game/SharedDefines.h
r112 r139 600 600 SPELL_EFFECT_THREAT_ALL = 91, 601 601 SPELL_EFFECT_ENCHANT_HELD_ITEM = 92, 602 SPELL_EFFECT_SUMMON_PHANTASM = 93, 602 SPELL_EFFECT_SUMMON_PHANTASM = 93, //unused 603 603 SPELL_EFFECT_SELF_RESURRECT = 94, 604 604 SPELL_EFFECT_SKINNING = 95, -
trunk/src/game/SocialMgr.cpp
r102 r139 42 42 } 43 43 44 uint32 PlayerSocial::GetNumberOfSocialsWithFlag(SocialFlag flag) 45 { 46 uint32 counter = 0; 47 for(PlayerSocialMap::iterator itr = m_playerSocialMap.begin(); itr != m_playerSocialMap.end(); ++itr) 48 { 49 if(itr->second.Flags & flag) 50 counter++; 51 } 52 return counter; 53 } 54 44 55 bool PlayerSocial::AddToSocialList(uint32 friend_guid, bool ignore) 45 56 { 46 // client limit 47 if(m_playerSocialMap.size() >= 50) 48 return false; 57 // check client limits 58 if(ignore) 59 { 60 if(GetNumberOfSocialsWithFlag(SOCIAL_FLAG_IGNORED) >= SOCIALMGR_IGNORE_LIMIT) 61 return false; 62 } 63 else 64 { 65 if(GetNumberOfSocialsWithFlag(SOCIAL_FLAG_FRIEND) >= SOCIALMGR_FRIEND_LIMIT) 66 return false; 67 } 49 68 50 69 uint32 flag = SOCIAL_FLAG_FRIEND; -
trunk/src/game/SocialMgr.h
r102 r139 112 112 }; 113 113 114 #define SOCIALMGR_FRIEND_LIMIT 50 115 #define SOCIALMGR_IGNORE_LIMIT 25 116 114 117 class PlayerSocial 115 118 { … … 129 132 uint32 GetPlayerGUID() { return m_playerGUID; } 130 133 void SetPlayerGUID(uint32 guid) { m_playerGUID = guid; } 134 uint32 GetNumberOfSocialsWithFlag(SocialFlag flag); 131 135 private: 132 136 PlayerSocialMap m_playerSocialMap; -
trunk/src/game/Spell.cpp
r138 r139 76 76 77 77 m_srcX = m_srcY = m_srcZ = m_destX = m_destY = m_destZ = 0; 78 m_hasDest = false; 78 79 m_strTarget = ""; 79 80 m_targetMask = 0; … … 87 88 { 88 89 if (!target) 90 return; 91 92 m_unitTarget = target; 93 m_unitTargetGUID = target->GetGUID(); 94 m_targetMask |= TARGET_FLAG_UNIT; 95 } 96 97 void SpellCastTargets::setDestination(float x, float y, float z, bool send) 98 { 99 m_destX = x; 100 m_destY = y; 101 m_destZ = z; 102 m_hasDest = true; 103 if(send) 104 m_targetMask |= TARGET_FLAG_DEST_LOCATION; 105 } 106 107 void SpellCastTargets::setDestination(Unit *target, bool send) 108 { 109 if(!target) 89 110 return; 90 111 … … 92 113 m_destY = target->GetPositionY(); 93 114 m_destZ = target->GetPositionZ(); 94 m_unitTarget = target; 95 m_unitTargetGUID = target->GetGUID(); 96 m_targetMask |= TARGET_FLAG_UNIT; 97 } 98 99 void SpellCastTargets::setDestination(float x, float y, float z) 100 { 101 m_destX = x; 102 m_destY = y; 103 m_destZ = z; 104 m_targetMask |= TARGET_FLAG_DEST_LOCATION; 115 m_hasDest = true; 116 if(send) 117 m_targetMask |= TARGET_FLAG_DEST_LOCATION; 105 118 } 106 119 … … 160 173 if(m_targetMask == TARGET_FLAG_SELF) 161 174 { 162 m_destX = caster->GetPositionX();163 m_destY = caster->GetPositionY();164 m_destZ = caster->GetPositionZ();175 //m_destX = caster->GetPositionX(); 176 //m_destY = caster->GetPositionY(); 177 //m_destZ = caster->GetPositionZ(); 165 178 m_unitTarget = caster; 166 179 m_unitTargetGUID = caster->GetGUID(); … … 180 193 return false; 181 194 182 if( m_targetMask & TARGET_FLAG_SOURCE_LOCATION )195 /*if( m_targetMask & TARGET_FLAG_SOURCE_LOCATION ) 183 196 { 184 197 if(data->rpos()+4+4+4 > data->size()) … … 188 201 if(!Trinity::IsValidMapCoord(m_srcX, m_srcY, m_srcZ)) 189 202 return false; 190 } 191 192 if( m_targetMask & TARGET_FLAG_DEST_LOCATION)203 }*/ 204 205 if( m_targetMask & (TARGET_FLAG_SOURCE_LOCATION | TARGET_FLAG_DEST_LOCATION) ) 193 206 { 194 207 if(data->rpos()+4+4+4 > data->size()) … … 196 209 197 210 *data >> m_destX >> m_destY >> m_destZ; 211 m_hasDest = true; 198 212 if(!Trinity::IsValidMapCoord(m_destX, m_destY, m_destZ)) 199 213 return false; … … 415 429 } 416 430 431 if(m_targets.HasDest()) 432 { 433 switch(m_spellInfo->Effect[i]) 434 { 435 case SPELL_EFFECT_SUMMON: 436 case SPELL_EFFECT_SUMMON_WILD: 437 case SPELL_EFFECT_SUMMON_GUARDIAN: 438 case SPELL_EFFECT_SUMMON_PET: 439 case SPELL_EFFECT_SUMMON_POSSESSED: 440 case SPELL_EFFECT_SUMMON_TOTEM: 441 case SPELL_EFFECT_SUMMON_OBJECT_WILD: 442 case SPELL_EFFECT_SUMMON_TOTEM_SLOT1: 443 case SPELL_EFFECT_SUMMON_TOTEM_SLOT2: 444 case SPELL_EFFECT_SUMMON_TOTEM_SLOT3: 445 case SPELL_EFFECT_SUMMON_TOTEM_SLOT4: 446 case SPELL_EFFECT_SUMMON_CRITTER: 447 case SPELL_EFFECT_SUMMON_OBJECT_SLOT1: 448 case SPELL_EFFECT_SUMMON_OBJECT_SLOT2: 449 case SPELL_EFFECT_SUMMON_OBJECT_SLOT3: 450 case SPELL_EFFECT_SUMMON_OBJECT_SLOT4: 451 case SPELL_EFFECT_SUMMON_DEAD_PET: 452 case SPELL_EFFECT_SUMMON_DEMON: 453 { 454 tmpUnitMap.push_back(m_caster); 455 break; 456 } 457 } 458 } 459 460 if(!m_spellInfo->EffectImplicitTargetA[i]) 461 { 462 switch(m_spellInfo->Effect[i]) 463 { 464 case SPELL_EFFECT_PARRY: 465 case SPELL_EFFECT_BLOCK: 466 case SPELL_EFFECT_SKILL: // always with dummy 3 as A 467 case SPELL_EFFECT_LEARN_SPELL: 468 tmpUnitMap.push_back(m_caster); 469 break; 470 } 471 } 472 417 473 if(tmpUnitMap.empty()) 418 474 { 419 if( m_spellInfo->EffectImplicitTargetA[i]==TARGET_SCRIPT ||475 /*if( m_spellInfo->EffectImplicitTargetA[i]==TARGET_SCRIPT || 420 476 m_spellInfo->EffectImplicitTargetB[i]==TARGET_SCRIPT || 421 477 m_spellInfo->EffectImplicitTargetA[i]==TARGET_SCRIPT_COORDINATES || … … 424 480 if(!(m_targets.m_targetMask & TARGET_FLAG_DEST_LOCATION)) 425 481 continue; 426 } 482 }*/ 483 427 484 // add here custom effects that need default target. 428 485 // FOR EVERY TARGET TYPE THERE IS A DIFFERENT FILL!! … … 500 557 } 501 558 case SPELL_EFFECT_RESURRECT: 502 case SPELL_EFFECT_PARRY:503 case SPELL_EFFECT_BLOCK:504 559 case SPELL_EFFECT_CREATE_ITEM: 505 560 case SPELL_EFFECT_TRIGGER_SPELL: 506 561 case SPELL_EFFECT_TRIGGER_MISSILE: 507 case SPELL_EFFECT_LEARN_SPELL:508 562 case SPELL_EFFECT_SKILL_STEP: 509 563 case SPELL_EFFECT_PROFICIENCY: 510 case SPELL_EFFECT_SUMMON_POSSESSED:511 case SPELL_EFFECT_SUMMON_OBJECT_WILD:512 564 case SPELL_EFFECT_SELF_RESURRECT: 513 565 case SPELL_EFFECT_REPUTATION: … … 537 589 } 538 590 break; 539 case SPELL_EFFECT_SUMMON:540 if(m_spellInfo->EffectMiscValueB[i] == SUMMON_TYPE_POSESSED || m_spellInfo->EffectMiscValueB[i] == SUMMON_TYPE_POSESSED2)541 {542 if(m_targets.getUnitTarget())543 tmpUnitMap.push_back(m_targets.getUnitTarget());544 }545 else546 tmpUnitMap.push_back(m_caster);547 break;548 591 case SPELL_EFFECT_SUMMON_CHANGE_ITEM: 549 case SPELL_EFFECT_SUMMON_WILD:550 case SPELL_EFFECT_SUMMON_GUARDIAN:551 592 case SPELL_EFFECT_TRANS_DOOR: 552 593 case SPELL_EFFECT_ADD_FARSIGHT: 553 594 case SPELL_EFFECT_STUCK: 554 595 case SPELL_EFFECT_DESTROY_ALL_TOTEMS: 555 case SPELL_EFFECT_SUMMON_DEMON:556 case SPELL_EFFECT_SKILL:557 case SPELL_EFFECT_SUMMON_OBJECT_SLOT1:558 case SPELL_EFFECT_SUMMON_OBJECT_SLOT2:559 case SPELL_EFFECT_SUMMON_OBJECT_SLOT3:560 case SPELL_EFFECT_SUMMON_OBJECT_SLOT4:561 596 tmpUnitMap.push_back(m_caster); 562 597 break; … … 1218 1253 void Spell::SearchAreaTarget(std::list<Unit*> &TagUnitMap, float radius, const uint32 &type, SpellTargets TargetType, uint32 entry) 1219 1254 { 1220 if(type == PUSH_DEST_CENTER && !m_targets. m_destX && !m_targets.m_destY && !m_targets.m_destZ)1255 if(type == PUSH_DEST_CENTER && !m_targets.HasDest()) 1221 1256 { 1222 1257 sLog.outError( "SPELL: cannot find destination for spell ID %u\n", m_spellInfo->Id ); … … 1297 1332 uint32 EffectChainTarget = m_spellInfo->EffectChainTarget[i]; 1298 1333 uint32 unMaxTargets = m_spellInfo->MaxAffectedTargets; 1334 if(!unMaxTargets) 1335 unMaxTargets = spellmgr.GetSpellExtraAttr(m_spellInfo->Id, SPELL_EXTRA_ATTR_MAX_TARGETS); 1299 1336 if(m_originalCaster) 1300 1337 { … … 1361 1398 }break; 1362 1399 1400 // channel 1401 case TARGET_SINGLE_ENEMY: 1402 if(m_caster->m_currentSpells[CURRENT_CHANNELED_SPELL]) 1403 { 1404 if(Unit* target = m_caster->m_currentSpells[CURRENT_CHANNELED_SPELL]->m_targets.getUnitTarget()) 1405 TagUnitMap.push_back(target); 1406 else 1407 sLog.outError( "SPELL: cannot find channel spell target for spell ID %u\n", m_spellInfo->Id ); 1408 } 1409 else 1410 sLog.outError( "SPELL: no current channeled spell for spell ID %u\n", m_spellInfo->Id ); 1411 break; 1412 case TARGET_DEST_CHANNEL: 1413 if(m_caster->m_currentSpells[CURRENT_CHANNELED_SPELL]) 1414 { 1415 if(m_caster->m_currentSpells[CURRENT_CHANNELED_SPELL]->m_targets.HasDest()) 1416 m_targets = m_caster->m_currentSpells[CURRENT_CHANNELED_SPELL]->m_targets; 1417 else 1418 sLog.outError( "SPELL: cannot find channel spell destination for spell ID %u\n", m_spellInfo->Id ); 1419 } 1420 else 1421 sLog.outError( "SPELL: no current channeled spell for spell ID %u\n", m_spellInfo->Id ); 1422 break; 1423 1363 1424 // reference dest 1364 1425 case TARGET_EFFECT_SELECT: 1365 m_targets.m_targetMask |= TARGET_FLAG_DEST_LOCATION; 1426 m_targets.setDestination(m_caster, true); 1427 break; 1366 1428 case TARGET_ALL_AROUND_CASTER: 1367 { 1368 if(!unMaxTargets) 1369 unMaxTargets = spellmgr.GetSpellExtraAttr(m_spellInfo->Id, SPELL_EXTRA_ATTR_MAX_TARGETS); 1370 m_caster->GetPosition(m_targets.m_destX, m_targets.m_destY, m_targets.m_destZ); 1371 }break; 1429 m_targets.setDestination(m_caster, false); 1430 break; 1372 1431 case TARGET_CURRENT_ENEMY_COORDINATES: 1373 m_targets.m_targetMask |= TARGET_FLAG_DEST_LOCATION; 1432 m_targets.setDestination(m_targets.getUnitTarget(), true); 1433 break; 1374 1434 case TARGET_DUELVSPLAYER_COORDINATES: // no ground? 1375 { 1376 if(Unit* currentTarget = m_targets.getUnitTarget()) 1377 currentTarget->GetPosition(m_targets.m_destX, m_targets.m_destY, m_targets.m_destZ); 1378 }break; 1435 m_targets.setDestination(m_targets.getUnitTarget(), false); 1436 break; 1379 1437 case TARGET_DEST_TABLE_UNKNOWN2: 1380 1438 case TARGET_TABLE_X_Y_Z_COORDINATES: 1381 { 1382 SpellTargetPosition const* st = spellmgr.GetSpellTargetPosition(m_spellInfo->Id); 1383 if(st) 1439 if(SpellTargetPosition const* st = spellmgr.GetSpellTargetPosition(m_spellInfo->Id)) 1384 1440 { 1385 1441 if (st->target_mapId == m_caster->GetMapId()) … … 1388 1444 else 1389 1445 sLog.outError( "SPELL: unknown target coordinates for spell ID %u\n", m_spellInfo->Id ); 1390 }break;1446 break; 1391 1447 1392 1448 // area targets 1393 1449 case TARGET_AREAEFFECT_CUSTOM: 1394 1450 case TARGET_ALL_ENEMY_IN_AREA_INSTANT: 1395 {1396 1451 if(m_spellInfo->Effect[i] == SPELL_EFFECT_PERSISTENT_AREA_AURA) 1397 1452 break; 1398 1453 m_targets.m_targetMask |= TARGET_FLAG_DEST_LOCATION; 1399 }1400 1454 case TARGET_ALL_ENEMY_IN_AREA: 1401 {1402 1455 SearchAreaTarget(TagUnitMap, radius, PUSH_DEST_CENTER, SPELL_TARGETS_AOE_DAMAGE); 1403 }break;1456 break; 1404 1457 case TARGET_ALL_FRIENDLY_UNITS_IN_AREA: 1405 1458 m_targets.m_targetMask |= TARGET_FLAG_DEST_LOCATION; 1406 1459 case TARGET_ALL_FRIENDLY_UNITS_AROUND_CASTER: 1407 {1408 1460 SearchAreaTarget(TagUnitMap, radius, PUSH_DEST_CENTER, SPELL_TARGETS_FRIENDLY); 1409 }break;1461 break; 1410 1462 //case TARGET_AREAEFFECT_CUSTOM: 1411 1463 // m_targets.m_targetMask |= TARGET_FLAG_DEST_LOCATION; … … 1451 1503 SearchAreaTarget(TagUnitMap, radius, PUSH_IN_FRONT, SPELL_TARGETS_FRIENDLY); 1452 1504 }break; 1453 1454 1505 1455 1506 // nearby target … … 1695 1746 } 1696 1747 }break; 1697 case TARGET_MINION:1698 {1699 if(m_spellInfo->Effect[i] != SPELL_EFFECT_DUEL)1700 TagUnitMap.push_back(m_caster);1701 }break;1702 case TARGET_SINGLE_ENEMY:1703 {1704 Unit* pUnitTarget = SelectMagnetTarget();1705 if(pUnitTarget)1706 TagUnitMap.push_back(pUnitTarget);1707 }break;1708 1748 case TARGET_AREAEFFECT_PARTY: 1709 1749 { … … 1879 1919 case TARGET_DEST_CASTER_FRONT_RIGHT: 1880 1920 case TARGET_DEST_CASTER_FRONT: 1921 case TARGET_MINION: 1922 case TARGET_DEST_CASTER_FRONT_LEAP: 1923 case TARGET_DEST_CASTER_FRONT_UNKNOWN: 1881 1924 case TARGET_DEST_CASTER_BACK: 1882 1925 case TARGET_DEST_CASTER_RIGHT: … … 1903 1946 case TARGET_DEST_CASTER_BACK_RIGHT: angle = 3*M_PI/4; break; 1904 1947 case TARGET_DEST_CASTER_FRONT_RIGHT:angle = M_PI/4; break; 1948 case TARGET_MINION: 1949 case TARGET_DEST_CASTER_FRONT_LEAP: 1950 case TARGET_DEST_CASTER_FRONT_UNKNOWN: 1905 1951 case TARGET_DEST_CASTER_FRONT: angle = 0.0f; break; 1906 1952 case TARGET_DEST_CASTER_BACK: angle = M_PI; break; … … 1971 2017 }break; 1972 2018 case TARGET_SELF2: 2019 m_targets.m_hasDest = true; 1973 2020 break; 1974 2021 default: -
trunk/src/game/Spell.h
r110 r139 108 108 m_itemTargetEntry = target.m_itemTargetEntry; 109 109 110 m_srcX = target.m_srcX;111 m_srcY = target.m_srcY;112 m_srcZ = target.m_srcZ;110 //m_srcX = target.m_srcX; 111 //m_srcY = target.m_srcY; 112 //m_srcZ = target.m_srcZ; 113 113 114 114 m_destX = target.m_destX; 115 115 m_destY = target.m_destY; 116 116 m_destZ = target.m_destZ; 117 m_hasDest = target.m_hasDest; 117 118 118 119 m_strTarget = target.m_strTarget; … … 126 127 Unit *getUnitTarget() const { return m_unitTarget; } 127 128 void setUnitTarget(Unit *target); 128 void setDestination(float x, float y, float z); 129 void setDestination(float x, float y, float z, bool send = true); 130 void setDestination(Unit *target, bool send = true); 129 131 130 132 uint64 getGOTargetGUID() const { return m_GOTargetGUID; } … … 148 150 149 151 bool IsEmpty() const { return m_GOTargetGUID==0 && m_unitTargetGUID==0 && m_itemTarget==0 && m_CorpseTargetGUID==0; } 152 bool HasDest() const { return m_hasDest; } 150 153 151 154 void Update(Unit* caster); … … 153 156 float m_srcX, m_srcY, m_srcZ; 154 157 float m_destX, m_destY, m_destZ; 158 bool m_hasDest; 155 159 std::string m_strTarget; 156 160 … … 552 556 : i_data(&data), i_spell(spell), i_push_type(type), i_radius(radius), i_TargetType(TargetType), i_entry(entry) 553 557 { 554 i_originalCaster = spell.Get OriginalCaster();558 i_originalCaster = spell.GetCaster(); 555 559 } 556 560 -
trunk/src/game/SpellAuras.cpp
r123 r139 472 472 } 473 473 474 SingleEnemyTargetAura::SingleEnemyTargetAura(SpellEntry const* spellproto, uint32 eff, int32 *currentBasePoints, Unit *target,475 Unit *caster, Item* castItem) : Aura(spellproto, eff, currentBasePoints, target, caster, castItem)476 {477 if (caster)478 m_casters_target_guid = caster->GetTypeId()==TYPEID_PLAYER ? ((Player*)caster)->GetSelection() : caster->GetUInt64Value(UNIT_FIELD_TARGET);479 else480 m_casters_target_guid = 0;481 }482 483 SingleEnemyTargetAura::~SingleEnemyTargetAura()484 {485 }486 487 Unit* SingleEnemyTargetAura::GetTriggerTarget() const488 {489 return ObjectAccessor::GetUnit(*m_target, m_casters_target_guid);490 }491 492 474 Aura* CreateAura(SpellEntry const* spellproto, uint32 eff, int32 *currentBasePoints, Unit *target, Unit *caster, Item* castItem) 493 475 { 494 476 if (IsAreaAuraEffect(spellproto->Effect[eff])) 495 477 return new AreaAura(spellproto, eff, currentBasePoints, target, caster, castItem); 496 497 uint32 triggeredSpellId = spellproto->EffectTriggerSpell[eff];498 499 SpellEntry const* triggredSpellInfo = sSpellStore.LookupEntry(triggeredSpellId);500 if (triggredSpellInfo)501 for (int i = 0; i < 3; ++i)502 if (triggredSpellInfo->EffectImplicitTargetA[i] == TARGET_SINGLE_ENEMY)503 return new SingleEnemyTargetAura(spellproto, eff, currentBasePoints, target, caster, castItem);504 478 505 479 return new Aura(spellproto, eff, currentBasePoints, target, caster, castItem); … … 1908 1882 } 1909 1883 // All ok cast by default case 1910 Spell *spell = new Spell( caster, triggredSpellInfo, true, originalCasterGUID );1884 Spell *spell = new Spell(m_target, triggredSpellInfo, true, originalCasterGUID ); 1911 1885 1912 1886 SpellCastTargets targets; -
trunk/src/game/SpellAuras.h
r102 r139 362 362 }; 363 363 364 class TRINITY_DLL_SPEC SingleEnemyTargetAura : public Aura365 {366 friend Aura* CreateAura(SpellEntry const* spellproto, uint32 eff, int32 *currentBasePoints, Unit *target, Unit *caster, Item* castItem);367 368 public:369 ~SingleEnemyTargetAura();370 Unit* GetTriggerTarget() const;371 372 protected:373 SingleEnemyTargetAura(SpellEntry const* spellproto, uint32 eff, int32 *currentBasePoints, Unit *target, Unit *caster = NULL, Item* castItem = NULL);374 uint64 m_casters_target_guid;375 };376 377 364 Aura* CreateAura(SpellEntry const* spellproto, uint32 eff, int32 *currentBasePoints, Unit *target, Unit *caster = NULL, Item* castItem = NULL); 378 365 #endif -
trunk/src/game/Unit.cpp
r138 r139 5086 5086 5087 5087 // Cast finish spell (triggeredByAura already not exist!) 5088 CastSpell(this, 27285, true, castItem, NULL, casterGuid); 5088 if(Unit* caster = GetUnit(*this, casterGuid)) 5089 caster->CastSpell(this, 27285, true, castItem); 5089 5090 return true; // no hidden cooldown 5090 5091 } … … 5108 5109 5109 5110 // Cast finish spell (triggeredByAura already not exist!) 5110 CastSpell(this, 32865, true, castItem, NULL, casterGuid); 5111 if(Unit* caster = GetUnit(*this, casterGuid)) 5112 caster->CastSpell(this, 32865, true, castItem); 5111 5113 return true; // no hidden cooldown 5112 5114 }