Register for your free account! | Forgot your password?

Go Back   elitepvpers > Popular Games > World of Warcraft > WoW Private Server
You last visited: Today at 05:31

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

Advertisement



[TrinityCore] DuelReset Script

Discussion on [TrinityCore] DuelReset Script within the WoW Private Server forum part of the World of Warcraft category.

Reply
 
Old   #1
 
elite*gold: 700
Join Date: Aug 2017
Posts: 174
Received Thanks: 24
[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 03/13/2018, 17:13   #2
 
Ghost_1013's Avatar
 
elite*gold: 0
Join Date: Aug 2017
Posts: 326
Received Thanks: 116
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 03/13/2018, 17:21   #3
 
elite*gold: 700
Join Date: Aug 2017
Posts: 174
Received Thanks: 24
Und das ganze nochmal erneut eingerückt entsprechend den Code Richtlinien für TrinityCore von Ghost_1013

Lucky_Patcher is offline  
Old 03/15/2018, 18:28   #4
 
Kaev <3's Avatar
 
elite*gold: 110
Join Date: Mar 2008
Posts: 856
Received Thanks: 388
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


Similar Threads Similar Threads
Custom Script auf TrinityCore funktioniert nicht
04/01/2014 - WoW Private Server - 3 Replies
Guten Abend Community.. Wollte vorhin anfangen ein paar "Customscripts" (C++) auf meinen Server zu packen. Bin nach diesem Tutorial vorgegangen (für Linux): How-to_CustomScript Sprich in die ScriptLoader.cpp eingefügt: #ifdef SCRIPTS /* This is where custom scripts' loading functions should be declared. */ void AddSC_professions_npc();
Custom Script auf TrinityCore funktioniert nicht
04/01/2014 - WoW Private Server - 1 Replies
Guten Abend Community.. Wollte vorhin anfangen ein paar "Customscripts" (C++) auf meinen Server zu packen. Bin nach diesem Tutorial vorgegangen (für Linux): How-to_CustomScript Sprich in die ScriptLoader.cpp eingefügt: #ifdef SCRIPTS /* This is where custom scripts' loading functions should be declared. */ void AddSC_professions_npc();
TrinityCore C++ Script Fehler
03/02/2014 - WoW Private Server - 2 Replies
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 10ten Kill anfängt mit den ganzen streaks und es bis zu den 50ten kill geht... Doch leider habe ich beim kompliren wieder einen fehler... Und der komplette script: Danke euch
TrinityCore c++ Script
03/01/2014 - WoW Private Server - 9 Replies
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 folgender script Es sollt eigentlich ohne probleme gehen aber ich bekomme folgendenen fehler: Es war auch so als ich es dan entpackt habe hies es nur Trainer(was auch nicht ging) der script hab ich dan umgeändert in SymbolixDEV_NPC.cpp und trozdem klappt es nicht... Ich danke euch allen!
Fragen zu TrinityCore
09/04/2009 - WoW Private Server - 1 Replies
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 -und mehr infos dazu wehr nicht shclecht -und ja noch gm commands (habe leidern ur commands von Mangos/Ascent suche welche für Trinty! 3.1.3! Mfg



All times are GMT +1. The time now is 05:31.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.