Register for your free account! | Forgot your password?

Go Back   elitepvpers > World of Warcraft > WoW Private Server
You last visited: Today at 07:37

  • Please register to post and access all features, it's quick, easy and FREE!

 

[TrinityCore] DuelReset Script

Reply
 
Old   #1

 
elite*gold: 229
Join Date: Aug 2017
Posts: 76
Received Thanks: 8
[TrinityCore] DuelReset Script

Sollte bei der aktuellen Core funktionieren.

PHP Code:
/*
* Copyright (C) 2008-2018 TrinityCore <https://www.trinitycore.org/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/

/* --[[ Coded by CoC / Lucky_Patcher 2018 || Do not remove this Copyright || You are allowed to modify this script.]]-- */

#include "ScriptMgr.h"
#include "Config.h"
#include "Player.h"
#include "World.h"

class duel_reset : public PlayerScript
{
public:
    
duel_reset() : PlayerScript("duel_reset") { }

    
void OnDuelEnd(PlayerwinnerPlayerlooserDuelCompleteType type)
    {
        if (
sWorld->getBoolConfig(CONFIG_DUEL_RESET_COOLDOWN_ON_FINISH))
        {
            if (
sWorld->getBoolConfig(CONFIG_DUEL_RESET_COOLDOWN_ONLY_IN_ELWYNN_AND_DUROTAR))
            {
                if (
winner->GetZoneId() == 14 || winner->GetZoneId() == 12)
                {
                    if (
type == DUEL_WON)
                    {
                        
winner->RemoveArenaSpellCooldowns();
                        
looser->RemoveArenaSpellCooldowns();
                        
winner->SetHealth(winner->GetMaxHealth());
                        
looser->SetHealth(looser->GetMaxHealth());

                        if (
winner->getPowerType() == POWER_MANA)
                            
winner->SetPower(POWER_MANAwinner->GetMaxPower(POWER_MANA));

                        if (
looser->getPowerType() == POWER_MANA)
                            
looser->SetPower(POWER_MANAlooser->GetMaxPower(POWER_MANA));
                    }

                    
winner->HandleEmoteCommand(EMOTE_ONESHOT_DANCE);
                    
looser->HandleEmoteCommand(EMOTE_ONESHOT_SALUTE);
                }
            }
            else
            {
                if (
type == DUEL_WON)
                {
                    
winner->RemoveArenaSpellCooldowns();
                    
looser->RemoveArenaSpellCooldowns();
                    
winner->SetHealth(winner->GetMaxHealth());
                    
looser->SetHealth(looser->GetMaxHealth());

                    if (
winner->getPowerType() == POWER_MANA)
                        
winner->SetPower(POWER_MANAwinner->GetMaxPower(POWER_MANA));

                    if (
looser->getPowerType() == POWER_MANA)
                        
looser->SetPower(POWER_MANAlooser->GetMaxPower(POWER_MANA));
                }

                
winner->HandleEmoteCommand(EMOTE_ONESHOT_DANCE);
                
looser->HandleEmoteCommand(EMOTE_ONESHOT_SALUTE);
            }
        }
    }

    
void OnDuelStart(Playerplayer1Playerplayer2)
    {
        if (
sWorld->getBoolConfig(CONFIG_DUEL_RESET_COOLDOWN_ON_START))
        {
            if (
sWorld->getBoolConfig(CONFIG_DUEL_RESET_COOLDOWN_ONLY_IN_ELWYNN_AND_DUROTAR))
            {
                if (
player1->GetZoneId() == 14 || player1->GetZoneId() == 12)
                {
                    
player1->RemoveArenaSpellCooldowns();
                    
player2->RemoveArenaSpellCooldowns();
                    
player1->SetHealth(player1->GetMaxHealth());
                    
player2->SetHealth(player2->GetMaxHealth());

                    if (
sWorld->getBoolConfig(CONFIG_DUEL_RESET_COOLDOWN_RESET_ENERGY_ON_START))
                    {
                        switch (
player1->getPowerType())
                        {
                        case 
POWER_MANA:
                            
player1->SetPower(POWER_MANA0);
                            break;
                        case 
POWER_RAGE:
                            
player1->SetPower(POWER_RAGE0);
                            break;
                        case 
POWER_RUNIC_POWER:
                            
player1->SetPower(POWER_RUNIC_POWER0);
                            break;
                        case 
POWER_FOCUS:
                            
player1->SetPower(POWER_FOCUS0);
                            break;
                        case 
POWER_ENERGY:
                            
player1->SetPower(POWER_ENERGY0);
                            break;
                        default:
                            break;
                        }

                        switch (
player2->getPowerType())
                        {
                        case 
POWER_MANA:
                            
player2->SetPower(POWER_MANA0);
                            break;
                        case 
POWER_RAGE:
                            
player2->SetPower(POWER_RAGE0);
                            break;
                        case 
POWER_RUNIC_POWER:
                            
player2->SetPower(POWER_RUNIC_POWER0);
                            break;
                        case 
POWER_FOCUS:
                            
player2->SetPower(POWER_FOCUS0);
                            break;
                        case 
POWER_ENERGY:
                            
player2->SetPower(POWER_ENERGY0);
                            break;
                        default:
                            break;
                        }
                    }

                    if (
sWorld->getBoolConfig(CONFIG_DUEL_RESET_COOLDOWN_MAX_ENERGY_ON_START))
                    {
                        switch (
player1->getPowerType())
                        {
                        case 
POWER_MANA:
                            
player1->SetPower(POWER_MANAplayer1->GetMaxPower(POWER_MANA));
                            break;
                        case 
POWER_RAGE:
                            
player1->SetPower(POWER_RAGEplayer1->GetMaxPower(POWER_RAGE));
                            break;
                        case 
POWER_RUNIC_POWER:
                            
player1->SetPower(POWER_RUNIC_POWERplayer1->GetMaxPower(POWER_RUNIC_POWER));
                            break;
                        case 
POWER_FOCUS:
                            
player1->SetPower(POWER_FOCUSplayer1->GetMaxPower(POWER_FOCUS));
                            break;
                        case 
POWER_ENERGY:
                            
player1->SetPower(POWER_ENERGYplayer1->GetMaxPower(POWER_ENERGY));
                            break;
                        default:
                            break;
                        }

                        switch (
player2->getPowerType())
                        {
                        case 
POWER_MANA:
                            
player2->SetPower(POWER_MANAplayer2->GetMaxPower(POWER_MANA));
                            break;
                        case 
POWER_RAGE:
                            
player2->SetPower(POWER_RAGEplayer2->GetMaxPower(POWER_RAGE));
                            break;
                        case 
POWER_RUNIC_POWER:
                            
player2->SetPower(POWER_RUNIC_POWERplayer2->GetMaxPower(POWER_RUNIC_POWER));
                            break;
                        case 
POWER_FOCUS:
                            
player2->SetPower(POWER_FOCUSplayer2->GetMaxPower(POWER_FOCUS));
                            break;
                        case 
POWER_ENERGY:
                            
player2->SetPower(POWER_ENERGYplayer2->GetMaxPower(POWER_ENERGY));
                            break;
                        default:
                            break;
                        }
                    }
                }
            }
        }
    }
};

void AddSC_DuelReset()
{
    new 
duel_reset();

In der Datei World.h noch folgendes direkt über BOOL_CONFIG_VALUE_COUNT : hinzufügen.

PHP Code:
    CONFIG_DUEL_RESET_COOLDOWN_ON_START,
    
CONFIG_DUEL_RESET_COOLDOWN_ON_FINISH,
    
CONFIG_DUEL_RESET_COOLDOWN_ONLY_IN_ELWYNN_AND_DUROTAR,
    
CONFIG_DUEL_RESET_COOLDOWN_RESET_ENERGY_ON_START,
    
CONFIG_DUEL_RESET_COOLDOWN_MAX_ENERGY_ON_START
Viel Spaß damit.



Lucky_Patcher is offline  
Old   #2
 
elite*gold: 0
Join Date: Aug 2017
Posts: 152
Received Thanks: 55
Code:
/*
* Copyright (C) 2008-2018 TrinityCore <https://www.trinitycore.org/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/

/* --[[ Improved by Ghost_1013 || Coded by CoC / Lucky_Patcher 2018 || Do not remove this Copyright || You are allowed to modify this script.]]-- */

#include "ScriptMgr.h"
#include "Config.h"
#include "Player.h"
#include "World.h"

class duel_reset : public PlayerScript
{
public:
    duel_reset() : PlayerScript("duel_reset") { }

    void OnDuelEnd(Player* winner, Player* looser, DuelCompleteType type)
    {
        if (!sWorld->getBoolConfig(CONFIG_DUEL_RESET_COOLDOWN_ON_FINISH))
        {
            return;
        }

        if (sWorld->getBoolConfig(CONFIG_DUEL_RESET_COOLDOWN_ONLY_IN_ELWYNN_AND_DUROTAR) && (winner->GetZoneId() != 14 || winner->GetZoneId() != 12))
        {
            return;
        }
     
        if (type == DUEL_WON)
        {
            winner->RemoveArenaSpellCooldowns();
            looser->RemoveArenaSpellCooldowns();
            winner->SetHealth(winner->GetMaxHealth());
            looser->SetHealth(looser->GetMaxHealth());

            if (winner->getPowerType() == POWER_MANA)
                winner->SetPower(POWER_MANA, winner->GetMaxPower(POWER_MANA));

            if (looser->getPowerType() == POWER_MANA)
                looser->SetPower(POWER_MANA, looser->GetMaxPower(POWER_MANA));
        }

        winner->HandleEmoteCommand(EMOTE_ONESHOT_DANCE);
        looser->HandleEmoteCommand(EMOTE_ONESHOT_SALUTE);
    }

    void OnDuelStart(Player* player1, Player* player2)
    {
        if (!sWorld->getBoolConfig(CONFIG_DUEL_RESET_COOLDOWN_ON_START))
        {
            return;
        }

        if (sWorld->getBoolConfig(CONFIG_DUEL_RESET_COOLDOWN_ONLY_IN_ELWYNN_AND_DUROTAR) && (player1->GetZoneId() != 14 || player1->GetZoneId() != 12))
        {
            return;
        }

        Player* players[2] = {player1, player2};

        for(Player* player : players)
        {
            player->RemoveArenaSpellCooldowns();
            player->SetHealth(player->GetMaxHealth());

            if (sWorld->getBoolConfig(CONFIG_DUEL_RESET_COOLDOWN_RESET_ENERGY_ON_START))
            {
                switch (player->getPowerType())
                {
                case POWER_MANA:
                    player->SetPower(POWER_MANA, 0);
                    break;
                case POWER_RAGE:
                    player->SetPower(POWER_RAGE, 0);
                    break;
                case POWER_RUNIC_POWER:
                    player->SetPower(POWER_RUNIC_POWER, 0);
                    break;
                case POWER_FOCUS:
                    player->SetPower(POWER_FOCUS, 0);
                    break;
                case POWER_ENERGY:
                    player->SetPower(POWER_ENERGY, 0);
                    break;
                default:
                    break;
                }
            }

            if (sWorld->getBoolConfig(CONFIG_DUEL_RESET_COOLDOWN_MAX_ENERGY_ON_START))
            {
                switch (player->getPowerType())
                {
                case POWER_MANA:
                    player->SetPower(POWER_MANA, player->GetMaxPower(POWER_MANA));
                    break;
                case POWER_RAGE:
                    player->SetPower(POWER_RAGE, player->GetMaxPower(POWER_RAGE));
                    break;
                case POWER_RUNIC_POWER:
                    player->SetPower(POWER_RUNIC_POWER, player->GetMaxPower(POWER_RUNIC_POWER));
                    break;
                case POWER_FOCUS:
                    player->SetPower(POWER_FOCUS, player->GetMaxPower(POWER_FOCUS));
                    break;
                case POWER_ENERGY:
                    player->SetPower(POWER_ENERGY, player->GetMaxPower(POWER_ENERGY));
                    break;
                default:
                    break;
                }
            }
        }
   
        
    }
};

void AddSC_DuelReset()
{
    new duel_reset();
}
Der Code sollte äquivalent sein, ist aber leserlicher.


Ghost_1013 is offline  
Old   #3

 
elite*gold: 229
Join Date: Aug 2017
Posts: 76
Received Thanks: 8
Und das ganze nochmal erneut eingerückt entsprechend den Code Richtlinien für TrinityCore von Ghost_1013

Lucky_Patcher is offline  
Old   #4
 
elite*gold: 110
Join Date: Mar 2008
Posts: 836
Received Thanks: 365
Statt den Switches könntest du auch einfach player->SetPower(player->getPowerType(), 0); usw. machen. Macht den Code wesentlich kürzer.
Kaev <3 is offline  
Thanks
1 User
Reply



« Previous Thread | Next Thread »

Similar Threads
Custom Script auf TrinityCore funktioniert nicht
Guten Abend Community.. Wollte vorhin anfangen ein paar "Customscripts" (C++) auf meinen Server zu packen. Bin nach diesem Tutorial vorgegangen...
3 Replies - WoW Private Server
Custom Script auf TrinityCore funktioniert nicht
Guten Abend Community.. Wollte vorhin anfangen ein paar "Customscripts" (C++) auf meinen Server zu packen. Bin nach diesem Tutorial vorgegangen...
1 Replies - WoW PServer Hosting
TrinityCore C++ Script Fehler
Hallo liebe leute, ich habe mal einen neuen script entdeckt der sich Killstream nennt... Ich wollte es so in meinem Server haben das man bei dem...
2 Replies - WoW PServer Hosting
TrinityCore c++ Script
Hallo liebe leute, ich hoffe ihr könnt mir hierbei weiter helfen und zwar habe ich versucht den folgenden script auf meinem server zu bringen...
9 Replies - WoW PServer Hosting
Fragen zu TrinityCore
Heyho ich hab da mal paar fragen -wie erstelle ic hda ei naccoutn bzw brauch ich nen md5 hash? -was ist der acceslevel von Admin ,gm ,user usw...
1 Replies - WoW PServer Hosting



All times are GMT +2. The time now is 07:37.


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Abuse
Copyright ©2018 elitepvpers All Rights Reserved.