EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Development::Bots (https://www.eqemulator.org/forums/forumdisplay.php?f=676)
-   -   bot command change (https://www.eqemulator.org/forums/showthread.php?t=39828)

zhangshen147 07-04-2015 12:38 PM

bot command change
 
Set #bot spawn command Character using the level limit.

add common/ruletypes.h
Code:

#ifdef BOTS
RULE_CATEGORY(Bots)
RULE_REAL(Bots, BotManaRegen, 2.0) // Adjust mana regen for bots, 1 is fast and higher numbers slow it down 3 is about the same as players.
RULE_BOOL(Bots, BotFinishBuffing, false) // Allow for buffs to complete even if the bot caster is out of mana. Only affects buffing out of combat.
RULE_INT(Bots, CreateBotCount, 150) // Number of bots that each account can create
RULE_INT(Bots, SpawnBotCount, 71) // Number of bots a character can have spawned at one time, You + 71 bots is a 12 group raid
RULE_BOOL(Bots, BotQuest, false) // Optional quest method to manage bot spawn limits using the quest_globals name bot_spawn_limit, see: /bazaar/Aediles_Thrall.pl
RULE_BOOL(Bots, BotGroupBuffing, false) // Bots will cast single target buffs as group buffs, default is false for single. Does not make single target buffs work for MGB.
RULE_BOOL(Bots, BotSpellQuest, false) // Anita Thrall's (Anita_Thrall.pl) Bot Spell Scriber quests.
RULE_INT(Bots, BotAAExpansion, 8) // Bots get AAs through this expansion
RULE_BOOL(Bots, BotGroupXP, false) // Determines whether client gets xp for bots outside their group.
RULE_BOOL(Bots, BotBardUseOutOfCombatSongs, true) // Determines whether bard bots use additional out of combat songs.
RULE_BOOL(Bots, BotLevelsWithOwner, false) // Auto-updates spawned bots as owner levels/de-levels (false is original behavior)
RULE_INT ( Bots, BotSpawnCharacterLevel, 45 ) // add custom rules to bot spawn commands to limit via character level.
RULE_CATEGORY_END()
#endif

add zone/bot.cpp
line 9403
Code:

void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
        // All bot command processing occurs here now instead of in command.cpp

        // TODO: Log any possible error messages as most of these will be MySQL error messages.
        std::string TempErrorMessage;
        int16 charlevel = (RuleI(Bots, BotSpawnCharacterLevel)); // Character level limit order bot spawn

        if(sep->arg[1][0] == '\0') {
                c->Message(13, "Bad argument, type #bot help");
                return;

and line 9767
Code:

        if(!strcasecmp(sep->arg[1], "spawn") ) {
                if(c->GetLevel() > charlevel) {
                        c->Message(0, "Sorry, your level is too high to use this command.");
                        return;
                }

               
                uint32 botId = GetBotIDByBotName(std::string(sep->arg[2]));

add to you mysql database
Quote:

INSERT INTO `rule_values` (`ruleset_id`, `rule_name`, `rule_value`, `notes`) VALUES (1, 'Bots:BotSpawnCharacterLevel', '45', 'add custom rules to bot spawn commands to limit via character level.');
over~

Kingly_Krab 07-04-2015 01:48 PM

The way you did this, upon merging people will have to add this rule to their database manually, having a RULE_BOOL with a default value of false to check if the rule is enabled and if their level is greater than the RULE_INT value.

zhangshen147 07-04-2015 02:06 PM

Quote:

Originally Posted by Kingly_Krab (Post 241463)
The way you did this, upon merging people will have to add this rule to their database manually, having a RULE_BOOL with a default value of false to check if the rule is enabled and if their level is greater than the RULE_INT value.

sorry ~ Forgot to amend the database, has been corrected.:D

Kingly_Krab 07-05-2015 09:16 PM

I will be adding this in my next pull request with it turned off by default. Once I get it merged I'll make another post here. Cool idea, I don't see why it can't be done, that's what rules are for, optional functionality.

Kingly_Krab 07-06-2015 09:23 AM

Here's my pull request. I added the ability to optionally enable it as well as a default value of 0 on the level required.

Kingly_Krab 07-06-2015 02:58 PM

Implemented as of this commit.

zhangshen147 07-07-2015 11:58 PM

Quote:

Originally Posted by Kingly_Krab (Post 241508)
Implemented as of this commit.

:D,its a good job~
But you seem to have forgotten database SQL settings.

Quote:

INSERT INTO `rule_values` (`ruleset_id`, `rule_name`, `rule_value`, `notes`) VALUES (1, 'Bots:BotSpawnCharacterLevel', '45', 'add custom rules to bot spawn commands to limit via character level.');

Kingly_Krab 07-08-2015 12:12 AM

It's not necessary to have those since it has a default value, but you can add them to the database if you want to change them.


All times are GMT -4. The time now is 06:31 AM.

Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.