summaryrefslogtreecommitdiff
path: root/src/actions
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-09-11 12:36:18 +0300
committerAndrei Karas <akaras@inbox.ru>2014-09-11 12:36:18 +0300
commit71d50c2de2cfe8c9d5b1653596eae90761c8a9d6 (patch)
tree88234658b6397123e6c3176d119d1a45df672ed4 /src/actions
parent660d3b585ab50038e5b2ea3fb9cf4049a7e697d1 (diff)
downloadmanaverse-71d50c2de2cfe8c9d5b1653596eae90761c8a9d6.tar.gz
manaverse-71d50c2de2cfe8c9d5b1653596eae90761c8a9d6.tar.bz2
manaverse-71d50c2de2cfe8c9d5b1653596eae90761c8a9d6.tar.xz
manaverse-71d50c2de2cfe8c9d5b1653596eae90761c8a9d6.zip
Add action and chat command for "catch pet".
New chat command: /catchpet - Try catch selected monster
Diffstat (limited to 'src/actions')
-rw-r--r--src/actions/actions.cpp17
-rw-r--r--src/actions/actions.h1
2 files changed, 18 insertions, 0 deletions
diff --git a/src/actions/actions.cpp b/src/actions/actions.cpp
index 250e43227..e3ad3a11a 100644
--- a/src/actions/actions.cpp
+++ b/src/actions/actions.cpp
@@ -1157,4 +1157,21 @@ impHandler(uploadLog)
return true;
}
+impHandler(catchPet)
+{
+ if (!localPlayer || !actorManager)
+ return false;
+
+ Being *target = nullptr;
+ if (!event.args.empty())
+ target = actorManager->findNearestByName(event.args);
+ if (!target)
+ target = localPlayer->getTarget();
+ else
+ localPlayer->setTarget(target);
+ if (target)
+ Net::getPetHandler()->catchPet(target);
+ return true;
+}
+
} // namespace Actions
diff --git a/src/actions/actions.h b/src/actions/actions.h
index 04535700a..d03c8b8ac 100644
--- a/src/actions/actions.h
+++ b/src/actions/actions.h
@@ -88,6 +88,7 @@ namespace Actions
decHandler(uploadConfig);
decHandler(uploadServerConfig);
decHandler(uploadLog);
+ decHandler(catchPet);
} // namespace Actions
#undef decHandler