[c12952] Implement Battleground scores storage system

Signed-off-by: Xfurry <xfurry@scriptdev2.com>

(based on commit [12756] - 9b7bb67)

Signed-off-by: Xfurry <xfurry@scriptdev2.com>
[c12953] Extend pvp team indexes to global use

Signed-off-by: Xfurry <xfurry@scriptdev2.com>

(based on commit [12760] - 5c3b410)

Signed-off-by: Xfurry <xfurry@scriptdev2.com>
[c12954] Use shiny new function to play music with the spell

(based on commit [12761] - c37f181)

Signed-off-by: Xfurry <xfurry@scriptdev2.com>
[c12955] Fix build after [c12953]
[c12956] Fix rooted player continue their movement while rooted for other clients.

http://cmangos.net/thread-6756.html
Thank to Moh for pointing.

(based on commit [12762] - c1af307)

Signed-off-by: Xfurry <xfurry@scriptdev2.com>
[c12957] Fix a little memleak. Thank to @kid10.

(based on commit [12763] - dbb69dc)

Signed-off-by: Xfurry <xfurry@scriptdev2.com>
[c12958] Improve EventAI code engine a little bit to be more effective with EVENT_T_RANGE

(based on commit [12765] - f676018)

Signed-off-by: Xfurry <xfurry@scriptdev2.com>
[c12959] EventAI - CodeStyle

(based on commit [12766] - 1c1fb83)

Signed-off-by: Xfurry <xfurry@scriptdev2.com>
[c12960] EventAI - SpeedUp OOC-LoS Event handling

Reorder checks such that range and LoS checks are handled after the faster faction checks.
Also introduce a bool variable to prevent iterating all events every MovementAction

(based on commit [12767] - 86fa6da)

Signed-off-by: Xfurry <xfurry@scriptdev2.com>
[c12961] EventAI - Some random changes

(based on commit [12768] - 6525c80)

Signed-off-by: Xfurry <xfurry@scriptdev2.com>
[c12962] Reverse pvp team indexes for score statistics storage

This updates [12756] and makes @ShinDarth happy

(based on commit [12769] - fab75fc)

Signed-off-by: Xfurry <xfurry@scriptdev2.com>
[c12963] Fix winner team for bg scores storage

(based on commit [12770] - df8a125)

Signed-off-by: Xfurry <xfurry@scriptdev2.com>
[c12964] Rewrite rest management.

Fix Rest when logged in not working in some case.
Also fix rest bonus according to wowwiki.

This need to be backported in all core.
Thank to @TheTrueAnimal for pointing.

(based on commit [12771] - e804879)

Signed-off-by: Xfurry <xfurry@scriptdev2.com>
[c12965] Fix crash when resurect a corpse.

Special thanks to antiroot for his help

(based on commit [12772] - 0532255)

Signed-off-by: Xfurry <xfurry@scriptdev2.com>
[c12966] Fix logic bug in SelectAuraRankForLevel

(based on commit [12773] - bf80378)

Signed-off-by: Xfurry <xfurry@scriptdev2.com>
[c12967] Fix bug that cause AreaAura reaply because the code doesn't search the correct rank of it.

(based on commit [12774] - 215b4b9)

Signed-off-by: Xfurry <xfurry@scriptdev2.com>
[c12968] Fix area aura type raid check.

(based on commit [12775] - 7dd00af)

Signed-off-by: Xfurry <xfurry@scriptdev2.com>
[c12969] Fix AreaAura bug when low level grouped with high level Player. Thank to @tarwyn for his precious help and proposed patch.

http://cmangos.net/thread-6773.html

(based on commit [12776] - 43caf20)

Signed-off-by: Xfurry <xfurry@scriptdev2.com>
[c12970] Fix issue with afk playerin duel logout request from client after 30 mins. We can logout during duel. Btw during duel we must be in combat for some timer without any action. Also change message from "duel cancel" to "duel  FLED"

(based on commit [12777] - cc542de)

Signed-off-by: Xfurry <xfurry@scriptdev2.com>
[c12971] Fix skinning loot bug.

Thank to @TheTrueAnimal for pointing.

(based on commit [12778] - d4cdfb5)

Signed-off-by: Xfurry <xfurry@scriptdev2.com>