Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
460 views
in Technique[技术] by (71.8m points)

azerothcore - What is the proper method to apply auras to players in raids?

I am scaling my server to 5 player raids so I am trying to apply auras to all players in a raid that give players all of the raid buffs/debuffs they would normally have if all classes/specs with each buff were present in the raid. This would effectively make it so that players always have the full array of buffs to their class regardless of group composition.

For one of the buffs and all of the debuffs, I made custom spells that applied a spell to the players that would give them an aura that applied the debuffs to mobs within 40 yards of the players. I then added these spells to Spell_Area for a raid zone and associated them in Spell_Group with the actual spell to prevent stacking. I had two issues by doing this.

1st, None of the custom buff/debuff spells were visible on the players(buffs) or enemy creatures (debuffs). I confirmed via GM command that the auras were being applied and with players attacking it was apparent that the effects were in fact being applied so just a visual error.

2nd, Shortly after beginning a raid, there would be massive server lag. The longer the players were inside the raid, the worse the lag would get. I was able to ascertain that it appears like the spells are being constantly reapplied to the players which shouldn't be happening because it should just apply the spell when they enter the area.

The visual issue is something I'm not really too concerned about since the intended effect is at least happening but the server lag makes raids unplayable. Is there a way to apply these auras without getting the lag or is there a better method of giving all the players their associated buffs/debuffs?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I cannot say if this would reduce the lag as I don't have the possibility to try this.

But what you could do is for the spellscript that applies the aura for the creature is to first check if the creature has the aura on it and if not, then add it.

As for applying the aura to the player I found that it is possible to do it within

void OnPlayerAreaUpdate(Player* player, uint32  /*oldArea*/, uint32 newArea) override

in instance_icecrown_citadel.cpp by adding this check

            if (!(player->isDead()) && !(player->HasAura(47889)))
                player->AddAura(47889, player);

This way it will not add the aura in case the player has the aura and is not dead. It will also add the aura if the player has been dead and is revived.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...