daily pastebin goal
0%
SHARE
TWEET

ДВа облика

StormDev2 Jan 21st, 2019 65 in 274 days
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. enum WorgSpells
  2. {
  3.     //ID спела
  4.     SPELL_TWO_FORM = 99273,
  5.     //Модели
  6.     WORG_MODEL_MALE = 19723,
  7.     WORG_MODEL_FEMALE = 19724
  8. };
  9.  
  10. class spell_worgen_double_form : public SpellScriptLoader
  11. {
  12.     public:
  13.         spell_worgen_double_form() : SpellScriptLoader("spell_worgen_double_form") { }
  14.  
  15.         class spell_worgen_double_form_SpellScript : public AuraScript
  16.         {
  17.             PrepareAuraScript(spell_worgen_double_form_SpellScript);
  18.  
  19.             void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
  20.             {
  21.                 Unit* target = GetTarget();
  22.                 if (target->GetTypeId() == TYPEID_PLAYER)
  23.                 {
  24.                     if (target->getGender() == GENDER_MALE){
  25.                         target->SetDisplayId(WORG_MODEL_MALE);
  26.                     }else{
  27.                         target->SetDisplayId(WORG_MODEL_FEMALE);
  28.                     }
  29.                 }else{
  30.                     if(target->HasAura(SPELL_TWO_FORM)){
  31.                         target->RemoveAurasDueToSpell(SPELL_TWO_FORM);
  32.                     }
  33.                 }
  34.             }
  35.  
  36.             void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
  37.             {
  38.                 Unit* target = GetTarget();
  39.                 if (target->GetTypeId() == TYPEID_PLAYER)
  40.                     target->RestoreDisplayId();
  41.             }
  42.  
  43.             void Register() override
  44.             {
  45.                 AfterEffectApply += AuraEffectRemoveFn(spell_worgen_double_form_SpellScript::OnApply, EFFECT_0, SPELL_AURA_TRANSFORM, AURA_EFFECT_HANDLE_REAL);
  46.                 AfterEffectRemove += AuraEffectRemoveFn(spell_worgen_double_form_SpellScript::OnRemove, EFFECT_0, SPELL_AURA_TRANSFORM, AURA_EFFECT_HANDLE_REAL);
  47.             }
  48.         };
  49.  
  50.         AuraScript* GetAuraScript() const override
  51.         {
  52.             return new spell_worgen_double_form_SpellScript();
  53.         }
  54. };
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top