Commands.cpp
Code: Select all
--- Commands.cpp (rev 440)
+++ Commands.cpp (working copy)
@@ -18,6 +18,7 @@
along with EQ2Emulator. If not, see <http://www.gnu.org/licenses/>.
*/
#include "Commands.h"
+#include "ClientPacketFunctions.h"
#include "../common/version.h"
#include "../common/seperator.h"
#include "../common/servertalk.h"
@@ -1574,14 +1575,20 @@
client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Syntax: /loot removeitem {item_id}");
break;
}
+ case COMMAND_LOOT_CORPSE:
case COMMAND_LOOT:{
Spawn* target = client->GetPlayer()->GetTarget();
if(target && target->IsEntity()){
- client->Loot((Entity*)target);
- if(!((Entity*)target)->HasLoot()){
- if(((Entity*)target)->IsNPC())
- client->GetCurrentZone()->RemoveDeadSpawn(target);
+ if(target->GetDistance(client->GetPlayer()) <= 10){
+ client->Loot((Entity*)target);
+ if(!((Entity*)target)->HasLoot()){
+ if(((Entity*)target)->IsNPC())
+ client->GetCurrentZone()->RemoveDeadSpawn(target);
+ }
}
+ else
+ client->Message(CHANNEL_COLOR_YELLOW, "You are too far away to interact with that");
+
}
else if(!target || target->GetHP() > 0)
client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Invalid target.");
@@ -4000,7 +4007,31 @@
client->Message(CHANNEL_COLOR_RED, "You can only cancel friendly spells!");
}
break;
+ }
+ case COMMAND_MOTD:{
+ if(client)
+ ClientPacketFunctions::SendMOTD(client);
+
+ break;
}
+ case COMMAND_RANDOM:{
+ char message[256] = {0};
+ if(sep)
+ {
+ if(sep->GetArgNumber() == 0 && sep->IsNumber(0))
+ sprintf(message, "Random: %s rolls from 1 to %u on the magic dice...and scores a %u!", client->GetPlayer()->GetName(), atoul(sep->arg[0]), MakeRandomInt(1, atoul(sep->arg[0])));
+ else if(sep->GetArgNumber() > 0 && sep->IsNumber(0) && sep->IsNumber(1))
+ sprintf(message, "Random: %s rolls from %u to %u on the magic dice...and scores a %u!", client->GetPlayer()->GetName(), atoul(sep->arg[0]), atoul(sep->arg[1]), MakeRandomInt(atoul(sep->arg[0]), atoul(sep->arg[1])));
+ else
+ sprintf(message, "Random: %s rolls from 1 to 100 on the magic dice...and scores a %u!", client->GetPlayer()->GetName(), MakeRandomInt(1, 100));
+ }
+ else
+ sprintf(message, "Random: %s rolls from 1 to 100 on the magic dice...and scores a %u!", client->GetPlayer()->GetName(), MakeRandomInt(1, 100));
+
+ client->GetPlayer()->GetZone()->HandleChatMessage(0, 0, CHANNEL_EMOTE, message);
+ break;
+ }
+
default:{
LogFile->write(EQEMuLog::Status, "Unhandled command: %s", command->command.data.c_str());
}
Code: Select all
--- Commands.h (rev 440)
+++ Commands.h (working copy)
@@ -479,4 +479,7 @@
#define COMMAND_LOCATION_LIST 274
#define COMMAND_USE_EQUIPPED_ITEM 275
#define COMMAND_CANCEL_MAINTAINED 276
+#define COMMAND_LOOT_CORPSE 277
+#define COMMAND_MOTD 278
+#define COMMAND_RANDOM 279
#endif