[Bug Fix] Fix rule check and add rule for pickpocket command (#3492)

* Fix bugs in skills

-Add rule for allowing pickpocket
-Fix method that is supposed to check rule
-Changed Z axis range for pickpocket (was failing on giants)

* Add zoffset to account for taller models
This commit is contained in:
Jonathan Sider 2023-07-15 19:46:26 -07:00 committed by GitHub
parent e06d28ad20
commit 70ce81fb0a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 2 deletions

View File

@ -637,6 +637,7 @@ RULE_BOOL(Bots, OldRaceRezEffects, false, "Older clients had ID 757 for races wi
RULE_BOOL(Bots, ResurrectionSickness, true, "Use Resurrection Sickness based on Resurrection spell cast, set to false to disable Resurrection Sickness.")
RULE_INT(Bots, OldResurrectionSicknessSpell, 757, "757 is Default Old Resurrection Sickness Spell")
RULE_INT(Bots, ResurrectionSicknessSpell, 756, "756 is Default Resurrection Sickness Spell")
RULE_BOOL(Bots, AllowPickpocketCommand, true, "Allows the use of the bot command 'pickpocket'")
RULE_CATEGORY_END()
RULE_CATEGORY(Chat)

View File

@ -9170,7 +9170,7 @@ bool helper_cast_standard_spell(Bot* casting_bot, Mob* target_mob, int spell_id,
bool helper_command_disabled(Client* bot_owner, bool rule_value, const char* command)
{
if (rule_value) {
if (!rule_value) {
bot_owner->Message(Chat::White, "Bot command %s is not enabled on this server.", command);
return true;
}
@ -9999,6 +9999,10 @@ void bot_command_caster_range(Client* c, const Seperator* sep)
void bot_command_pickpocket(Client *c, const Seperator *sep)
{
if (helper_command_disabled(c, RuleB(Bots, AllowPickpocketCommand), "pickpocket")) {
return;
}
if (helper_command_alias_fail(c, "bot_command_pickpocket", sep->arg[0], "pickpocket")) {
return;
}
@ -10032,7 +10036,9 @@ void bot_command_pickpocket(Client *c, const Seperator *sep)
glm::vec4 mob_distance = (c->GetPosition() - target_mob->GetPosition());
float mob_xy_distance = ((mob_distance.x * mob_distance.x) + (mob_distance.y * mob_distance.y));
float mob_z_distance = (mob_distance.z * mob_distance.z);
if (mob_z_distance >= 25 || mob_xy_distance > 250) {
float z_offset_diff = target_mob->GetZOffset() - c->GetZOffset();
if (mob_z_distance >= (35-z_offset_diff) || mob_xy_distance > 250) {
c->Message(Chat::White, "You must be closer to an enemy to use this command");
return;
}