add currentmusic, define forcepos in aoclient.h
This commit is contained in:
parent
30ffc94a10
commit
d04fef0ded
@ -198,6 +198,7 @@ class AOClient : public QObject {
|
||||
void cmdBgLock(int argc, QStringList argv);
|
||||
void cmdBgUnlock(int argc, QStringList argv);
|
||||
void cmdStatus(int argc, QStringList argv);
|
||||
void cmdCurrentMusic(int argc, QStringList argv);
|
||||
// Moderation
|
||||
void cmdMods(int argc, QStringList argv);
|
||||
void cmdBan(int argc, QStringList argv);
|
||||
@ -213,6 +214,7 @@ class AOClient : public QObject {
|
||||
void cmdTimer(int argc, QStringList argv);
|
||||
// Messaging/Client
|
||||
void cmdPos(int argc, QStringList argv);
|
||||
void cmdForcePos(int argc, QStringList argv);
|
||||
void cmdSwitch(int argc, QStringList argv);
|
||||
void cmdRandomChar(int argc, QStringList argv);
|
||||
void cmdG(int argc, QStringList argv);
|
||||
@ -280,6 +282,8 @@ class AOClient : public QObject {
|
||||
{"mods", {ACLFlags.value("NONE"), 0, &AOClient::cmdMods}},
|
||||
{"help", {ACLFlags.value("NONE"), 0, &AOClient::cmdHelp}},
|
||||
{"status", {ACLFlags.value("NONE"), 1, &AOClient::cmdStatus}},
|
||||
{"forcepos", {ACLFlags.value("CM"), 2, &AOClient::cmdForcePos}},
|
||||
{"currentmusic", {ACLFlags.value("NONE"), 0, &AOClient::cmdCurrentMusic}},
|
||||
};
|
||||
|
||||
QString partial_packet;
|
||||
|
@ -71,6 +71,8 @@ class AreaData : public QObject {
|
||||
QString document;
|
||||
int def_hp;
|
||||
int pro_hp;
|
||||
QString current_music;
|
||||
QString music_played_by;
|
||||
Logger* logger;
|
||||
};
|
||||
|
||||
|
@ -696,7 +696,11 @@ void AOClient::cmdArea(int argc, QStringList argv)
|
||||
|
||||
void AOClient::cmdPlay(int argc, QStringList argv)
|
||||
{
|
||||
sendPacket("MC", {argv.join(" "), QString::number(server->getCharID(current_char)), showname, "1", "0"});
|
||||
AreaData* area = server->areas[current_area];
|
||||
QString song = argv.join(" ");
|
||||
area->current_music = song;
|
||||
area->music_played_by = showname;
|
||||
sendPacket("MC", {song, QString::number(server->getCharID(current_char)), showname, "1", "0"});
|
||||
}
|
||||
|
||||
void AOClient::cmdAreaKick(int argc, QStringList argv)
|
||||
@ -777,7 +781,8 @@ void AOClient::cmdHelp(int argc, QStringList argv)
|
||||
sendServerMessage(entries.join("\n"));
|
||||
}
|
||||
|
||||
void AOClient::cmdStatus(int argc, QStringList argv) {
|
||||
void AOClient::cmdStatus(int argc, QStringList argv)
|
||||
{
|
||||
AreaData* area = server->areas[current_area];
|
||||
QString arg = argv[0].toLower();
|
||||
if (arg == "idle")
|
||||
@ -799,6 +804,15 @@ void AOClient::cmdStatus(int argc, QStringList argv) {
|
||||
arup(ARUPType::STATUS, true);
|
||||
}
|
||||
|
||||
void AOClient::cmdCurrentMusic(int argc, QStringList argv)
|
||||
{
|
||||
AreaData* area = server->areas[current_area];
|
||||
if (area->current_music != "" && area->current_music != "~stop.mp3") // dummy track for stopping music
|
||||
sendServerMessage("The current song is " + area->current_music + " played by " + area->music_played_by);
|
||||
else
|
||||
sendServerMessage("There is no music playing.");
|
||||
}
|
||||
|
||||
QStringList AOClient::buildAreaList(int area_idx)
|
||||
{
|
||||
QStringList entries;
|
||||
|
@ -180,6 +180,8 @@ void AOClient::pktChangeMusic(AreaData* area, int argc, QStringList argv, AOPack
|
||||
if (song == argument) {
|
||||
// We have a song here
|
||||
AOPacket music_change("MC", {song, argv[1], argv[2], "1", "0", argv[3]});
|
||||
area->current_music = song;
|
||||
area->music_played_by = argv[2];
|
||||
server->broadcast(music_change, current_area);
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user