[Help/Request] Small modifications to the core...

First of all, I hope I’m posting this help/request in the right place.

Second, I’m an ‘extreme novice’ when it comes to this C++, basically viewing the .cpp files of the core is my first exposure to C++, so I’m still learning.

Third, and this is the important part: I want this for my core/server. I am not asking that this be added to the source, just mine. (Unless people like the idea and want to add it to theirs of course.)

Here is what I’m wanting to do:

1a. Change the current ‘.cooldown’ command.

1b. I want this to be a TOGGLE, example: ‘.cooldown on/off’ like the ‘.gm on/off’ command

  1. Change the number of talents PETS get at each level.

.cooldown command is cool and all, but it becomes a pain when you’re testing a lot of things rapidly. Having to enter (or use a macro) every time I need to reset cooldowns is getting rather annoying.

#1a/b EXAMPLES: (quote = SendNotification like when GM ON is used. Code = Chat Output)

Entering ‘.cooldown on’ would give you this…

Cooldown ON

Global Cooldowns are OFF. This means abilities/spells/etc have 0 cooldown time.

Entering ‘.cooldown off’ would give you this…

Cooldown OFF

Global Cooldowns are ON. This means abilities/spells/etc have normal cooldown times.

#2 EXAMPLES:

Here is how the config is at the moment:

[/CODE][code]

Rate.Mining.Next

Description: Mining rates.

Default: Chance to to mine a deposit again.

Rate.Mining.Next = 1

Rate.Talent

Description: Talent point rate.

Default: 1

Rate.Talent = 1

Rate.Reputation.Gain

Description: Reputation gain rate.

Default: 1

Rate.Reputation.Gain = 1

[/code]
And here is how I want mine to look:


# Rate.Mining.Next

#	 Description: Mining rates.

#	 Default:	 Chance to to mine a deposit again.

Rate.Mining.Next = 1

#

# Rate.Talent

#	 Description: Talent point rate.

#	 Default:	 1

Rate.Talent = 1

#

# Rate.Pet.Talent

#	 Description: Pet Talent point rate.

#	 Default:	 1

Rate.Pet.Talent = 1

#

# Rate.Reputation.Gain

#	 Description: Reputation gain rate.

#	 Default:	 1

Rate.Reputation.Gain = 1

So I need to know what files to add/modify to make these changes, any help would be welcome.

If you do help me, please provide file names and locations (example: \src\server\scripts\Commands cs_cooldown.cpp [not an actual file, used as an example] )

Also provide code blocks above and below where code is added.

Please keep in mind that I am a novice with this C++ so please be as detailed as possible.

Thanks.

I know, double-posting is frowned upon. I just wanted to reply with a .cpp I’m trying to figure out…

I’ve made ‘cs_cd.cpp’

I know I’m probably 90% wrong on this file, that is where you C++ folks come in and help me get this working…

I took the cs_gm.cpp and changed it (a copy of it not the original). I need to know what files to put in #include and any other things I need to do to this file and other files to achieve the Cooldown On/Off Toggle I’m wanting to put in my server/core.


/*

* Copyright (C) 2008-2012 TrinityCore <http://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/>.

*/

/* ScriptData

Name: cd_commandscript

%Complete: 100

Comment: cooldown command

Category: commandscripts

EndScriptData */

#include ""

class cd_commandscript : public CommandScript

{

public:

cd_commandscript() : CommandScript("cd_commandscript") { }

ChatCommand* GetCommands() const

{

	 static ChatCommand cdCommandTable[] =

	 {

		 { "",			 SEC_MODERATOR,	 false, &HandleCDCommand,				 "", NULL },

		 { NULL,			 0,				 false, NULL,							 "", NULL }

	 };

	 static ChatCommand commandTable[] =

	 {

		 { "cd",			 SEC_MODERATOR,	 false, NULL,					 "", cdCommandTable },

		 { NULL,			 0,				 false, NULL,							 "", NULL }

	 };

	 return commandTable;

}

//Enable\Disable Coolown Mode

static bool HandleCDCommand(ChatHandler* handler, char const* args)

{

	 if (!*args)

	 {

		 if (handler->GetSession()->GetPlayer()->isCooldown())

			 handler->GetSession()->SendNotification(LANG_COOLDOWN_ON);

		 else

			 handler->GetSession()->SendNotification(LANG_COOLDOWN_OFF);

		 return true;

	 }

	 std::string param = (char*)args;

	 if (param == "on")

	 {

		 handler->GetSession()->GetPlayer()->SetCooldown(true);

		 handler->GetSession()->SendNotification(LANG_COOLDOWN_ON);

		 return true;

	 }

	 if (param == "off")

	 {

		 handler->GetSession()->GetPlayer()->SetCooldown(false);

		 handler->GetSession()->SendNotification(LANG_COOLDOWN_OFF);

		 return true;

	 }

	 handler->SendSysMessage(LANG_USE_BOL);

	 handler->SetSentErrorMessage(true);

	 return false;

}

};

void AddSC_cd_commandscript()

{

new cd_commandscript();

}

One day ago .cheat cooldown on/off command was introduced, it does exactly what you want

https://github.com/TrinityCore/TrinityCore/commit/908ae08a0aed76c3d6a1a66848c9811ece44a1e7

Yeah. I tried it already. Several times I got “Build Failed” in Visual C++ Express. I restored the .bak files of the altered ones and it built just fine.
Every time I edit a file, I copy it to the desktop and add .bak to it in the event something ‘breaks’ on me.

Can we also have the modifications to the .start command like Aokromes suggested here? http://pastebin.com/MfDiN7a2

like .start to graveyard or inn?

Test this https://github.com/TrinityCore/TrinityCore/pull/7588

sql imported with some errors, after .unstuck my hearth was set to 9hr 3 min cd lol.

I guess I have to do some work on that then…

Could you give me the sql error you get?

2012_8_31_00_world_trinity_string.sql causes error


Query:

INSERT INTO `command` (`name`, `security`, `help`) VALUES ('unstuck', 0, 'Syntax: .unstuck $playername [inn/graveyard/startzone]\r\n\r\nTeleports specified player to specified location. Default location is player\'s current hearth location.')

Error occured at:2012-09-02 01:48:44

Line no.:1

Error Code: 1062 - Duplicate entry 'unstuck' for key 'PRIMARY'

redundant sql possibly after 2012_8_31_00_world_command.sql ?