diff options
Diffstat (limited to 'src/server/scripts/World')
| -rw-r--r-- | src/server/scripts/World/npcs_special.cpp | 144 |
1 files changed, 73 insertions, 71 deletions
diff --git a/src/server/scripts/World/npcs_special.cpp b/src/server/scripts/World/npcs_special.cpp index 4c913d8c42e..59d49f50c8d 100644 --- a/src/server/scripts/World/npcs_special.cpp +++ b/src/server/scripts/World/npcs_special.cpp @@ -761,40 +761,41 @@ public: void SpellHit(Unit* caster, SpellInfo const* spell) { - if (caster->GetTypeId() == TYPEID_PLAYER && me->isAlive() && spell->Id == 20804) - { - if ((CAST_PLR(caster)->GetQuestStatus(6624) == QUEST_STATUS_INCOMPLETE) || (CAST_PLR(caster)->GetQuestStatus(6622) == QUEST_STATUS_INCOMPLETE)) - if (DoctorGUID) - if (Creature* doctor = Unit::GetCreature(*me, DoctorGUID)) - CAST_AI(npc_doctor::npc_doctorAI, doctor->AI())->PatientSaved(me, CAST_PLR(caster), Coord); + Player* player = caster->ToPlayer(); + if (!player || !me->isAlive() || spell->Id != 20804) + return; - //make not selectable - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + if (player->GetQuestStatus(6624) == QUEST_STATUS_INCOMPLETE || player->GetQuestStatus(6622) == QUEST_STATUS_INCOMPLETE) + if (DoctorGUID) + if (Creature* doctor = Unit::GetCreature(*me, DoctorGUID)) + CAST_AI(npc_doctor::npc_doctorAI, doctor->AI())->PatientSaved(me, player, Coord); - //regen health - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT); + //make not selectable + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - //stand up - me->SetUInt32Value(UNIT_FIELD_BYTES_1, UNIT_STAND_STATE_STAND); + //regen health + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT); - Talk(SAY_DOC); + //stand up + me->SetUInt32Value(UNIT_FIELD_BYTES_1, UNIT_STAND_STATE_STAND); - uint32 mobId = me->GetEntry(); - me->SetWalk(false); + Talk(SAY_DOC); - switch (mobId) - { - case 12923: - case 12924: - case 12925: - me->GetMotionMaster()->MovePoint(0, H_RUNTOX, H_RUNTOY, H_RUNTOZ); - break; - case 12936: - case 12937: - case 12938: - me->GetMotionMaster()->MovePoint(0, A_RUNTOX, A_RUNTOY, A_RUNTOZ); - break; - } + uint32 mobId = me->GetEntry(); + me->SetWalk(false); + + switch (mobId) + { + case 12923: + case 12924: + case 12925: + me->GetMotionMaster()->MovePoint(0, H_RUNTOX, H_RUNTOY, H_RUNTOZ); + break; + case 12936: + case 12937: + case 12938: + me->GetMotionMaster()->MovePoint(0, A_RUNTOX, A_RUNTOY, A_RUNTOZ); + break; } } @@ -1749,52 +1750,53 @@ public: void ReceiveEmote(Player* player, uint32 emote) { me->HandleEmoteCommand(emote); - Unit* own = me->GetOwner(); - if (!own || own->GetTypeId() != TYPEID_PLAYER || CAST_PLR(own)->GetTeam() != player->GetTeam()) - return; - if (emote == TEXT_EMOTE_KISS) + Unit* owner = me->GetOwner(); + if (emote != TEXT_EMOTE_KISS || owner || owner->GetTypeId() != TYPEID_PLAYER || + owner->ToPlayer()->GetTeam() != player->GetTeam()) { - std::string whisp = ""; - switch (rand() % 8) - { - case 0: - whisp.append(SAY_RANDOM_MOJO0); - break; - case 1: - whisp.append(SAY_RANDOM_MOJO1); - break; - case 2: - whisp.append(SAY_RANDOM_MOJO2); - break; - case 3: - whisp.append(SAY_RANDOM_MOJO3); - break; - case 4: - whisp.append(SAY_RANDOM_MOJO4); - break; - case 5: - whisp.append(SAY_RANDOM_MOJO5); - break; - case 6: - whisp.append(SAY_RANDOM_MOJO6a); - whisp.append(player->GetName()); - whisp.append(SAY_RANDOM_MOJO6b); - break; - case 7: - whisp.append(SAY_RANDOM_MOJO7); - break; - } + return; + } - me->MonsterWhisper(whisp.c_str(), player->GetGUID()); - if (victimGUID) - if (Player* victim = Unit::GetPlayer(*me, victimGUID)) - victim->RemoveAura(43906);//remove polymorph frog thing - me->AddAura(43906, player);//add polymorph frog thing - victimGUID = player->GetGUID(); - DoCast(me, 20372, true);//tag.hearts - me->GetMotionMaster()->MoveFollow(player, 0, 0); - hearts = 15000; + std::string whisp = ""; + switch (rand() % 8) + { + case 0: + whisp.append(SAY_RANDOM_MOJO0); + break; + case 1: + whisp.append(SAY_RANDOM_MOJO1); + break; + case 2: + whisp.append(SAY_RANDOM_MOJO2); + break; + case 3: + whisp.append(SAY_RANDOM_MOJO3); + break; + case 4: + whisp.append(SAY_RANDOM_MOJO4); + break; + case 5: + whisp.append(SAY_RANDOM_MOJO5); + break; + case 6: + whisp.append(SAY_RANDOM_MOJO6a); + whisp.append(player->GetName()); + whisp.append(SAY_RANDOM_MOJO6b); + break; + case 7: + whisp.append(SAY_RANDOM_MOJO7); + break; } + + me->MonsterWhisper(whisp.c_str(), player->GetGUID()); + if (victimGUID) + if (Player* victim = Unit::GetPlayer(*me, victimGUID)) + victim->RemoveAura(43906); // remove polymorph frog thing + me->AddAura(43906, player); // add polymorph frog thing + victimGUID = player->GetGUID(); + DoCast(me, 20372, true); // tag.hearts + me->GetMotionMaster()->MoveFollow(player, 0, 0); + hearts = 15000; } }; |
