*Add script of quest "How to win friends and influence enemies". Author ckegg. With some modifications.
*Fix the bug that persuader can be used on other creatures. --HG-- branch : trunk
This commit is contained in:
@@ -58,6 +58,7 @@ struct TRINITY_DLL_DECL npc_crusade_persuadedAI : public ScriptedAI
|
||||
uiSpeech_counter = 0;
|
||||
uiPlayerGUID = 0;
|
||||
me->SetReactState(REACT_AGGRESSIVE);
|
||||
me->RestoreFaction();
|
||||
}
|
||||
|
||||
void SpellHit(Unit *caster, const SpellEntry *spell)
|
||||
@@ -66,36 +67,34 @@ struct TRINITY_DLL_DECL npc_crusade_persuadedAI : public ScriptedAI
|
||||
{
|
||||
if(CAST_PLR(caster)->GetQuestStatus(12720) == QUEST_STATUS_INCOMPLETE)
|
||||
{
|
||||
if (rand()%100 < 5) // chance
|
||||
uiPlayerGUID = caster->GetGUID();
|
||||
uiSpeech_timer = 1000;
|
||||
uiSpeech_counter = 1;
|
||||
me->setFaction(caster->getFaction());
|
||||
me->CombatStop(true);
|
||||
me->GetMotionMaster()->MoveIdle();
|
||||
me->SetReactState(REACT_PASSIVE);
|
||||
DoCastAOE(58111, true);
|
||||
|
||||
switch(rand()%6)
|
||||
{
|
||||
uiPlayerGUID = caster->GetGUID();
|
||||
uiSpeech_timer = 1000;
|
||||
uiSpeech_counter = 1;
|
||||
me->setFaction(35);
|
||||
me->CombatStop(true);
|
||||
me->GetMotionMaster()->MoveIdle();
|
||||
me->SetReactState(REACT_PASSIVE);
|
||||
case 0: DoScriptText(SAY_PERSUADE1, caster);break;
|
||||
case 1: DoScriptText(SAY_PERSUADE2, caster);break;
|
||||
case 2: DoScriptText(SAY_PERSUADE3, caster);break;
|
||||
case 3: DoScriptText(SAY_PERSUADE4, caster);break;
|
||||
case 4: DoScriptText(SAY_PERSUADE5, caster);break;
|
||||
case 5: DoScriptText(SAY_PERSUADE6, caster);break;
|
||||
case 6: DoScriptText(SAY_PERSUADE7, caster);break;
|
||||
}
|
||||
|
||||
switch(rand()%6)
|
||||
{
|
||||
case 0: DoScriptText(SAY_PERSUADE1, caster);break;
|
||||
case 1: DoScriptText(SAY_PERSUADE2, caster);break;
|
||||
case 2: DoScriptText(SAY_PERSUADE3, caster);break;
|
||||
case 3: DoScriptText(SAY_PERSUADE4, caster);break;
|
||||
case 4: DoScriptText(SAY_PERSUADE5, caster);break;
|
||||
case 5: DoScriptText(SAY_PERSUADE6, caster);break;
|
||||
case 6: DoScriptText(SAY_PERSUADE7, caster);break;
|
||||
}
|
||||
|
||||
switch(rand()%5)
|
||||
{
|
||||
case 0: DoScriptText(SAY_CRUSADER1, me);break;
|
||||
case 1: DoScriptText(SAY_CRUSADER2, me);break;
|
||||
case 2: DoScriptText(SAY_CRUSADER3, me);break;
|
||||
case 3: DoScriptText(SAY_CRUSADER4, me);break;
|
||||
case 4: DoScriptText(SAY_CRUSADER5, me);break;
|
||||
case 5: DoScriptText(SAY_CRUSADER6, me);break;
|
||||
}
|
||||
switch(rand()%5)
|
||||
{
|
||||
case 0: DoScriptText(SAY_CRUSADER1, me);break;
|
||||
case 1: DoScriptText(SAY_CRUSADER2, me);break;
|
||||
case 2: DoScriptText(SAY_CRUSADER3, me);break;
|
||||
case 3: DoScriptText(SAY_CRUSADER4, me);break;
|
||||
case 4: DoScriptText(SAY_CRUSADER5, me);break;
|
||||
case 5: DoScriptText(SAY_CRUSADER6, me);break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -122,17 +121,16 @@ struct TRINITY_DLL_DECL npc_crusade_persuadedAI : public ScriptedAI
|
||||
case 4: DoScriptText(SAY_PERSUADED4, me); uiSpeech_timer = 8000; break;
|
||||
case 5: DoScriptText(SAY_PERSUADED5, pPlayer); uiSpeech_timer = 8000; break;
|
||||
case 6: DoScriptText(SAY_PERSUADED6, me);
|
||||
me->RestoreFaction();
|
||||
pPlayer->Kill(me);
|
||||
//me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
|
||||
//me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
|
||||
uiSpeech_counter = 0;
|
||||
if(pPlayer->GetQuestStatus(12720) == QUEST_STATUS_INCOMPLETE)
|
||||
pPlayer->AreaExploredOrEventHappens(12720);
|
||||
pPlayer->GroupEventHappens(12720, me);
|
||||
return;
|
||||
}
|
||||
|
||||
++uiSpeech_counter;
|
||||
DoCastAOE(58111, true);
|
||||
}else uiSpeech_timer -= diff;
|
||||
|
||||
return;
|
||||
|
||||
+19
-4
@@ -7334,6 +7334,18 @@ void Player::CastItemCombatSpell(Unit *target, WeaponAttackType attType, uint32
|
||||
|
||||
if(spellData.SpellPPMRate)
|
||||
{
|
||||
if(spellData.SpellId == 52781) // Persuasive Strike
|
||||
{
|
||||
switch(target->GetEntry())
|
||||
{
|
||||
default:
|
||||
return;
|
||||
case 28939:
|
||||
case 28940:
|
||||
case 28610:
|
||||
break;
|
||||
}
|
||||
}
|
||||
uint32 WeaponSpeed = GetAttackTime(attType);
|
||||
chance = GetPPMProcChance(WeaponSpeed, spellData.SpellPPMRate, spellInfo);
|
||||
}
|
||||
@@ -7383,10 +7395,13 @@ void Player::CastItemCombatSpell(Unit *target, WeaponAttackType attType, uint32
|
||||
|
||||
float chance = pEnchant->amount[s] != 0 ? float(pEnchant->amount[s]) : GetWeaponProcChance();
|
||||
|
||||
if (entry && entry->PPMChance)
|
||||
chance = GetPPMProcChance(proto->Delay, entry->PPMChance, spellInfo);
|
||||
else if (entry && entry->customChance)
|
||||
chance = entry->customChance;
|
||||
if (entry)
|
||||
{
|
||||
if(entry->PPMChance)
|
||||
chance = GetPPMProcChance(proto->Delay, entry->PPMChance, spellInfo);
|
||||
else if(entry->customChance)
|
||||
chance = entry->customChance;
|
||||
}
|
||||
|
||||
// Apply spell mods
|
||||
ApplySpellMod(pEnchant->spellid[s],SPELLMOD_CHANCE_OF_SUCCESS,chance);
|
||||
|
||||
Reference in New Issue
Block a user